From e50297f5af615e4d45601749c042adba3a5d50cf Mon Sep 17 00:00:00 2001 From: Mariusz Jurowicz Date: Thu, 7 Jun 2018 10:49:48 +0200 Subject: [PATCH] #7322 fix missing types and type properties --- js/notebook/src/extension/UIOptionsHelper.ts | 2 +- .../src/extension/initializationCells.ts | 2 +- .../dataGrid/column/DataGridColumn.ts | 2 + .../tableDisplay/dataGrid/column/selectors.ts | 6 +- .../dataGrid/highlighter/Highlighter.ts | 2 + .../highlighter/HighlighterManager.ts | 2 + .../dataGrid/modal/ColumnLimitModal.ts | 1 - js/notebook/src/tsconfig.json | 2 - js/notebook/src/types/global.env.d.ts | 27 +++++++ js/notebook/src/types/index.d.ts | 17 +++++ .../dataGrid/modal/ColumnLimitModal.d.ts | 1 - js/notebook/src/types/widgets.d.ts | 70 ++++++++++++++++++- js/notebook/src/widgets.ts | 2 +- 13 files changed, 123 insertions(+), 13 deletions(-) diff --git a/js/notebook/src/extension/UIOptionsHelper.ts b/js/notebook/src/extension/UIOptionsHelper.ts index 7e875cd5ca..59aef6293b 100644 --- a/js/notebook/src/extension/UIOptionsHelper.ts +++ b/js/notebook/src/extension/UIOptionsHelper.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import './../global.env'; +/// import BeakerXApi from "../tree/Utils/BeakerXApi"; import * as GistPublish from "./gistPublish/index"; diff --git a/js/notebook/src/extension/initializationCells.ts b/js/notebook/src/extension/initializationCells.ts index 4f15c5ab71..e7f5ca597e 100644 --- a/js/notebook/src/extension/initializationCells.ts +++ b/js/notebook/src/extension/initializationCells.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import '../global.env'; +/// interface IInitCellsOptions { run_on_kernel_ready: boolean, diff --git a/js/notebook/src/tableDisplay/dataGrid/column/DataGridColumn.ts b/js/notebook/src/tableDisplay/dataGrid/column/DataGridColumn.ts index e7c930261e..ab90302f21 100644 --- a/js/notebook/src/tableDisplay/dataGrid/column/DataGridColumn.ts +++ b/js/notebook/src/tableDisplay/dataGrid/column/DataGridColumn.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +/// + import ColumnMenu from "../headerMenu/ColumnMenu"; import IndexMenu from "../headerMenu/IndexMenu"; import { BeakerXDataGrid } from "../BeakerXDataGrid"; diff --git a/js/notebook/src/tableDisplay/dataGrid/column/selectors.ts b/js/notebook/src/tableDisplay/dataGrid/column/selectors.ts index 25e9386c91..4d06e861bd 100644 --- a/js/notebook/src/tableDisplay/dataGrid/column/selectors.ts +++ b/js/notebook/src/tableDisplay/dataGrid/column/selectors.ts @@ -14,12 +14,12 @@ * limitations under the License. */ +/// + import {IBeakerXDataGridState} from "../store/BeakerXDataStore"; import { - DEFAULT_INDEX_COLUMN_NAME, selectColumnNames, selectColumnOrder, selectColumnsFrozen, - selectColumnsFrozenNames, + selectColumnNames, selectColumnOrder, selectColumnsVisible, - selectHasIndex } from "../model/selectors"; import {find} from "@phosphor/algorithm"; import {IColumnPosition, IColumnsState, IColumnState} from "../interface/IColumn"; diff --git a/js/notebook/src/tableDisplay/dataGrid/highlighter/Highlighter.ts b/js/notebook/src/tableDisplay/dataGrid/highlighter/Highlighter.ts index 4d8bbc3fe1..a057d08fef 100644 --- a/js/notebook/src/tableDisplay/dataGrid/highlighter/Highlighter.ts +++ b/js/notebook/src/tableDisplay/dataGrid/highlighter/Highlighter.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +/// + import IHihglighterState, { HIGHLIGHTER_STYLE } from "../interface/IHighlighterState"; import { CellRenderer } from "@phosphor/datagrid"; import DataGridColumn from "../column/DataGridColumn"; diff --git a/js/notebook/src/tableDisplay/dataGrid/highlighter/HighlighterManager.ts b/js/notebook/src/tableDisplay/dataGrid/highlighter/HighlighterManager.ts index 8753401421..94a4faf70a 100644 --- a/js/notebook/src/tableDisplay/dataGrid/highlighter/HighlighterManager.ts +++ b/js/notebook/src/tableDisplay/dataGrid/highlighter/HighlighterManager.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +/// + import IHihglighterState, { HIGHLIGHTER_STYLE, HIGHLIGHTER_TYPE diff --git a/js/notebook/src/tableDisplay/dataGrid/modal/ColumnLimitModal.ts b/js/notebook/src/tableDisplay/dataGrid/modal/ColumnLimitModal.ts index d367f4d078..76709613fc 100644 --- a/js/notebook/src/tableDisplay/dataGrid/modal/ColumnLimitModal.ts +++ b/js/notebook/src/tableDisplay/dataGrid/modal/ColumnLimitModal.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import '../../../global.env'; import ColumnManager from "../column/ColumnManager"; import createModalTemplate from './columnLimitModalTemplate'; import {BeakerXDataGrid} from "../BeakerXDataGrid"; diff --git a/js/notebook/src/tsconfig.json b/js/notebook/src/tsconfig.json index 40014205e4..e93a34b505 100644 --- a/js/notebook/src/tsconfig.json +++ b/js/notebook/src/tsconfig.json @@ -6,8 +6,6 @@ "module": "ES2015", "target": "es5", "allowJs": true, - "declaration": true, - "declarationDir": "./types", "moduleResolution": "Node", "noEmit": true, "lib": ["dom", "es5", "es2015"], diff --git a/js/notebook/src/types/global.env.d.ts b/js/notebook/src/types/global.env.d.ts index 082bb53916..dd2cbc93e0 100644 --- a/js/notebook/src/types/global.env.d.ts +++ b/js/notebook/src/types/global.env.d.ts @@ -1,3 +1,30 @@ +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value: V): this; + readonly size: number; +} + +interface MapConstructor { + new (): Map; + new (entries?: ReadonlyArray<[K, V]>): Map; + readonly prototype: Map; +} + +declare var Map: MapConstructor; + +declare interface NumberConstructor { + isNaN: (number: number) => boolean, + isFinite: (number: number) => boolean +} + +declare interface Array { + from: (arrayLike: any[]) => any[] +} + interface GlobalEnvironment { BEAKERX_MODULE_VERSION; __webpack_public_path__; diff --git a/js/notebook/src/types/index.d.ts b/js/notebook/src/types/index.d.ts index 8221443f75..e4082c2008 100644 --- a/js/notebook/src/types/index.d.ts +++ b/js/notebook/src/types/index.d.ts @@ -1,4 +1,21 @@ +/* + * Copyright 2018 TWO SIGMA OPEN SOURCE, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /// +/// // Export widget models and views, and the npm package version number. export * from './BxHTML'; diff --git a/js/notebook/src/types/tableDisplay/dataGrid/modal/ColumnLimitModal.d.ts b/js/notebook/src/types/tableDisplay/dataGrid/modal/ColumnLimitModal.d.ts index 712fb53135..2b8446a169 100644 --- a/js/notebook/src/types/tableDisplay/dataGrid/modal/ColumnLimitModal.d.ts +++ b/js/notebook/src/types/tableDisplay/dataGrid/modal/ColumnLimitModal.d.ts @@ -1,4 +1,3 @@ -import '../../../global.env'; import ColumnManager from "../column/ColumnManager"; import { BeakerXDataGrid } from "../BeakerXDataGrid"; import { BeakerXDataStore } from "../store/BeakerXDataStore"; diff --git a/js/notebook/src/types/widgets.d.ts b/js/notebook/src/types/widgets.d.ts index 24d55a494b..a4d9b679cb 100644 --- a/js/notebook/src/types/widgets.d.ts +++ b/js/notebook/src/types/widgets.d.ts @@ -1,5 +1,5 @@ /* - * Copyright 2017 TWO SIGMA OPEN SOURCE, LLC + * Copyright 2018 TWO SIGMA OPEN SOURCE, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -export { +import { DOMWidgetView, DOMWidgetModel, LayoutModel, @@ -26,4 +26,68 @@ export { unpack_models, } from "@jupyter-widgets/base"; -export * from "@jupyter-widgets/controls"; +import { + HTMLModel, + HTMLView, + BoxModel, + BoxView, + StringModel, + DescriptionView, + DescriptionModel, + VBoxModel, + VBoxView, + TabModel, + TabView, + CheckboxModel, + CheckboxView, + SelectView, + SelectModel, + LabeledDOMWidgetView, + PasswordView, + PasswordModel, + SelectMultipleView, + SelectMultipleModel, + TextareaView, + TextareaModel, + TextView, + TextModel +} from "@jupyter-widgets/controls"; + +export declare const widgets: { + DOMWidgetView: typeof DOMWidgetView, + DOMWidgetModel: typeof DOMWidgetModel, + LayoutModel: typeof LayoutModel, + LayoutView: typeof LayoutView, + StyleModel: typeof StyleModel, + StyleView: typeof StyleView, + WidgetModel: typeof WidgetModel, + WidgetView: typeof WidgetView, + unpack_models: typeof unpack_models, + + HTMLModel: typeof HTMLModel, + HTMLView: typeof HTMLView, + BoxModel: typeof BoxModel, + BoxView: typeof BoxView + StringModel: typeof StringModel, + DescriptionView: typeof DescriptionView, + DescriptionModel: typeof DescriptionModel, + VBoxModel: typeof VBoxModel, + VBoxView: typeof VBoxView, + TabModel: typeof TabModel, + TabView: typeof TabView, + CheckboxModel: typeof CheckboxModel, + CheckboxView: typeof CheckboxView, + SelectModel: typeof SelectModel, + SelectView: typeof SelectView, + LabeledDOMWidgetView: typeof LabeledDOMWidgetView, + PasswordModel: typeof PasswordModel, + PasswordView: typeof PasswordView, + SelectMultipleModel: typeof SelectMultipleModel, + SelectMultipleView: typeof SelectMultipleView, + TextareaModel: typeof TextareaModel, + TextareaView: typeof TextareaView, + TextModel: typeof TextModel, + TextView: typeof TextView, +}; + +export default widgets; diff --git a/js/notebook/src/widgets.ts b/js/notebook/src/widgets.ts index f9e9109e6f..32e3290439 100644 --- a/js/notebook/src/widgets.ts +++ b/js/notebook/src/widgets.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -/// +/// const base = require('@jupyter-widgets/base'); const controls = require('@jupyter-widgets/controls');