From b480e92ae719f458f34e10d0f719c6c5f7159cf4 Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Tue, 14 Aug 2018 10:24:47 +0200 Subject: [PATCH 01/78] Add react-visibility-sensor --- types/react-visibility-sensor/index.d.ts | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 types/react-visibility-sensor/index.d.ts diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts new file mode 100644 index 0000000000..0ba06eccee --- /dev/null +++ b/types/react-visibility-sensor/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for react-visibility-sensor 3.11.1 +// Project: https://github.com/joshwnj/react-visibility-sensor +// Definitions by: Rasmus Bergström +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "react-visibility-sensor" { + import * as React from "react"; + + interface Shape { + top?: number; + left?: number; + bottom?: number; + right?: number; + } + + interface Props { + onChange: (isVisible: boolean, visibilityRect?: Shape) => void; + active?: boolean; + partialVisibility?: boolean; + offset?: Shape; + minTopValue?: number; + intervalCheck?: boolean; + intervalDelay?: number; + scrollCheck?: boolean; + scrollDelay?: number; + scrollThrottle?: number; + resizeCheck?: boolean; + resizeDelay?: number; + resizeThrottle?: number; + delayedCall?: boolean; + } + + const ReactVisibilitySensor: React.StatelessComponent; + + export = ReactVisibilitySensor; +} From 66e4c9349c38885cbcef17a4420b9e5be6b7f582 Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Tue, 14 Aug 2018 10:36:06 +0200 Subject: [PATCH 02/78] Add ts-config for react-visibility-sensor --- types/react-visibility-sensor/tsconfig.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 types/react-visibility-sensor/tsconfig.json diff --git a/types/react-visibility-sensor/tsconfig.json b/types/react-visibility-sensor/tsconfig.json new file mode 100644 index 0000000000..057c8e9b0b --- /dev/null +++ b/types/react-visibility-sensor/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "esnext", + "lib": ["es7", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "tests.tsx"] +} From c6cdeef61a4cc4f09df2c8b6090d30bbdf244299 Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Tue, 14 Aug 2018 10:39:19 +0200 Subject: [PATCH 03/78] Rename tests file conform documentation --- types/react-visibility-sensor/react-visibility-sensor-tests.tsx | 1 + types/react-visibility-sensor/tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 types/react-visibility-sensor/react-visibility-sensor-tests.tsx diff --git a/types/react-visibility-sensor/react-visibility-sensor-tests.tsx b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx new file mode 100644 index 0000000000..7b85954889 --- /dev/null +++ b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx @@ -0,0 +1 @@ +export default null diff --git a/types/react-visibility-sensor/tsconfig.json b/types/react-visibility-sensor/tsconfig.json index 057c8e9b0b..304331bed3 100644 --- a/types/react-visibility-sensor/tsconfig.json +++ b/types/react-visibility-sensor/tsconfig.json @@ -13,5 +13,5 @@ "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": ["index.d.ts", "tests.tsx"] + "files": ["index.d.ts", "react-visibility-sensor-tests.tsx"] } From cb8f091f6cb6d25a81fb202636754bca87f7288b Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Tue, 14 Aug 2018 10:44:25 +0200 Subject: [PATCH 04/78] Add Typescript version --- types/react-visibility-sensor/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts index 0ba06eccee..8f32bde0d4 100644 --- a/types/react-visibility-sensor/index.d.ts +++ b/types/react-visibility-sensor/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/joshwnj/react-visibility-sensor // Definitions by: Rasmus Bergström // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Typescript 3.0.1 declare module "react-visibility-sensor" { import * as React from "react"; From d6db1cbc831f56ac2667eb86eb0057756d36bbab Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Tue, 14 Aug 2018 10:46:56 +0200 Subject: [PATCH 05/78] Fix typo --- types/react-visibility-sensor/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts index 8f32bde0d4..5bfae449ea 100644 --- a/types/react-visibility-sensor/index.d.ts +++ b/types/react-visibility-sensor/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/joshwnj/react-visibility-sensor // Definitions by: Rasmus Bergström // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Typescript 3.0.1 +// Typescript Version: 3.0 declare module "react-visibility-sensor" { import * as React from "react"; From 37b615e01196c62ce5652ced6e9cacb8b7b2031a Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Tue, 14 Aug 2018 11:14:23 +0200 Subject: [PATCH 06/78] Fix another typo --- types/react-visibility-sensor/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts index 5bfae449ea..6d20ade01a 100644 --- a/types/react-visibility-sensor/index.d.ts +++ b/types/react-visibility-sensor/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/joshwnj/react-visibility-sensor // Definitions by: Rasmus Bergström // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Typescript Version: 3.0 +// TypeScript Version: 3.0 declare module "react-visibility-sensor" { import * as React from "react"; From f023c3b7421e38a476c2579605923baad2145fed Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Tue, 14 Aug 2018 11:29:43 +0200 Subject: [PATCH 07/78] Change TypeScript version --- types/react-visibility-sensor/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts index 6d20ade01a..9259d7876a 100644 --- a/types/react-visibility-sensor/index.d.ts +++ b/types/react-visibility-sensor/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/joshwnj/react-visibility-sensor // Definitions by: Rasmus Bergström // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.7 declare module "react-visibility-sensor" { import * as React from "react"; From 281aeb56b946d0a1ea275222068f92059e22188b Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Wed, 29 Aug 2018 10:14:53 +0200 Subject: [PATCH 08/78] Add type reference link --- types/react-visibility-sensor/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts index 9259d7876a..50e134b73a 100644 --- a/types/react-visibility-sensor/index.d.ts +++ b/types/react-visibility-sensor/index.d.ts @@ -5,6 +5,7 @@ // TypeScript Version: 2.7 declare module "react-visibility-sensor" { + /// import * as React from "react"; interface Shape { From 72a7247089c167355dc5d155404a8524c38a5501 Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Wed, 29 Aug 2018 10:56:18 +0200 Subject: [PATCH 09/78] Fix TypeScript Version --- types/react-visibility-sensor/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts index 50e134b73a..a490952cb4 100644 --- a/types/react-visibility-sensor/index.d.ts +++ b/types/react-visibility-sensor/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/joshwnj/react-visibility-sensor // Definitions by: Rasmus Bergström // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.7 +// TypeScript Version: 2.8 declare module "react-visibility-sensor" { /// From 4dff6b7da4bfef257ad06b8e6af42b7d62d4944f Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Wed, 29 Aug 2018 11:00:56 +0200 Subject: [PATCH 10/78] Add tslint.json --- types/react-visibility-sensor/tslint.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 types/react-visibility-sensor/tslint.json diff --git a/types/react-visibility-sensor/tslint.json b/types/react-visibility-sensor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-visibility-sensor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b553b09b386275713ae0e2819b06ccd6ebe8b344 Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Wed, 29 Aug 2018 11:46:48 +0200 Subject: [PATCH 11/78] Add tests and make them pass --- types/react-visibility-sensor/index.d.ts | 59 +++++++++---------- .../react-visibility-sensor-tests.tsx | 26 +++++++- types/react-visibility-sensor/tsconfig.json | 2 +- 3 files changed, 54 insertions(+), 33 deletions(-) diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts index a490952cb4..2d435c61f7 100644 --- a/types/react-visibility-sensor/index.d.ts +++ b/types/react-visibility-sensor/index.d.ts @@ -1,38 +1,35 @@ -// Type definitions for react-visibility-sensor 3.11.1 +// Type definitions for react-visibility-sensor 3.11 // Project: https://github.com/joshwnj/react-visibility-sensor // Definitions by: Rasmus Bergström // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -declare module "react-visibility-sensor" { - /// - import * as React from "react"; +import * as React from "react"; - interface Shape { - top?: number; - left?: number; - bottom?: number; - right?: number; - } - - interface Props { - onChange: (isVisible: boolean, visibilityRect?: Shape) => void; - active?: boolean; - partialVisibility?: boolean; - offset?: Shape; - minTopValue?: number; - intervalCheck?: boolean; - intervalDelay?: number; - scrollCheck?: boolean; - scrollDelay?: number; - scrollThrottle?: number; - resizeCheck?: boolean; - resizeDelay?: number; - resizeThrottle?: number; - delayedCall?: boolean; - } - - const ReactVisibilitySensor: React.StatelessComponent; - - export = ReactVisibilitySensor; +interface Shape { + top?: number; + left?: number; + bottom?: number; + right?: number; } + +interface Props { + onChange: (isVisible: boolean, visibilityRect?: Shape) => void; + active?: boolean; + partialVisibility?: boolean; + offset?: Shape; + minTopValue?: number; + intervalCheck?: boolean; + intervalDelay?: number; + scrollCheck?: boolean; + scrollDelay?: number; + scrollThrottle?: number; + resizeCheck?: boolean; + resizeDelay?: number; + resizeThrottle?: number; + delayedCall?: boolean; +} + +declare const ReactVisibilitySensor: React.StatelessComponent; + +export default ReactVisibilitySensor; diff --git a/types/react-visibility-sensor/react-visibility-sensor-tests.tsx b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx index 7b85954889..36a4687fe7 100644 --- a/types/react-visibility-sensor/react-visibility-sensor-tests.tsx +++ b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx @@ -1 +1,25 @@ -export default null +import * as React from "react"; + +import ReactVisibilitySensor from "react-visibility-sensor"; +const num = 1; +const bool = true; +const shape = { top: num, left: num, bottom: num, right: num }; + +const component = ( + {}} + active={bool} + partialVisibility={bool} + offset={shape} + minTopValue={num} + intervalCheck={bool} + intervalDelay={num} + scrollCheck={bool} + scrollDelay={num} + scrollThrottle={num} + resizeCheck={bool} + resizeDelay={num} + resizeThrottle={num} + delayedCall={bool} + /> +); diff --git a/types/react-visibility-sensor/tsconfig.json b/types/react-visibility-sensor/tsconfig.json index 304331bed3..ad9bbbdf5c 100644 --- a/types/react-visibility-sensor/tsconfig.json +++ b/types/react-visibility-sensor/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "esnext", + "module": "commonjs", "lib": ["es7", "dom"], "noImplicitAny": true, "noImplicitThis": true, From 38733696c8a8ea88d9fd37b28f0bce0ed5f3ea78 Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Wed, 29 Aug 2018 12:06:06 +0200 Subject: [PATCH 12/78] Add children --- types/react-visibility-sensor/index.d.ts | 3 +++ .../react-visibility-sensor-tests.tsx | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts index 2d435c61f7..15ca04d262 100644 --- a/types/react-visibility-sensor/index.d.ts +++ b/types/react-visibility-sensor/index.d.ts @@ -28,6 +28,9 @@ interface Props { resizeDelay?: number; resizeThrottle?: number; delayedCall?: boolean; + children?: ( + args: { isVisible: boolean; visibilityRect?: Shape } + ) => React.ReactNode; } declare const ReactVisibilitySensor: React.StatelessComponent; diff --git a/types/react-visibility-sensor/react-visibility-sensor-tests.tsx b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx index 36a4687fe7..e71cd0e20e 100644 --- a/types/react-visibility-sensor/react-visibility-sensor-tests.tsx +++ b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx @@ -20,6 +20,7 @@ const component = ( resizeCheck={bool} resizeDelay={num} resizeThrottle={num} - delayedCall={bool} - /> + delayedCall={bool}> + {({ isVisible: bool, visibilityRect: shape }) =>
} + ); From 7a544a8216ef512631271307d5435cd6cf18a7b5 Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Wed, 29 Aug 2018 13:24:25 +0200 Subject: [PATCH 13/78] Use dts-gen template --- types/react-visibility-sensor/index.d.ts | 2 +- types/react-visibility-sensor/tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts index 15ca04d262..5898f1b8ad 100644 --- a/types/react-visibility-sensor/index.d.ts +++ b/types/react-visibility-sensor/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for react-visibility-sensor 3.11 -// Project: https://github.com/joshwnj/react-visibility-sensor +// Project: https://github.com/joshwnj/react-visibility-sensor#readme // Definitions by: Rasmus Bergström // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/react-visibility-sensor/tsconfig.json b/types/react-visibility-sensor/tsconfig.json index ad9bbbdf5c..29d5985cfe 100644 --- a/types/react-visibility-sensor/tsconfig.json +++ b/types/react-visibility-sensor/tsconfig.json @@ -6,8 +6,8 @@ "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, - "baseUrl": "../", "jsx": "react", + "baseUrl": "../", "typeRoots": ["../"], "types": [], "noEmit": true, From dda5b233ced87c596001b0174c68261cdaf69443 Mon Sep 17 00:00:00 2001 From: jrasmusbm Date: Thu, 30 Aug 2018 09:11:51 +0200 Subject: [PATCH 14/78] Export Shape conform code review https://github.com/DefinitelyTyped/DefinitelyTyped/pull/28493#commitcomment-30333784 --- types/react-visibility-sensor/index.d.ts | 2 +- .../react-visibility-sensor/react-visibility-sensor-tests.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts index 5898f1b8ad..2aa3b9adde 100644 --- a/types/react-visibility-sensor/index.d.ts +++ b/types/react-visibility-sensor/index.d.ts @@ -6,7 +6,7 @@ import * as React from "react"; -interface Shape { +export interface Shape { top?: number; left?: number; bottom?: number; diff --git a/types/react-visibility-sensor/react-visibility-sensor-tests.tsx b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx index e71cd0e20e..9c8e552479 100644 --- a/types/react-visibility-sensor/react-visibility-sensor-tests.tsx +++ b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx @@ -1,9 +1,9 @@ import * as React from "react"; -import ReactVisibilitySensor from "react-visibility-sensor"; +import ReactVisibilitySensor, { Shape } from "react-visibility-sensor"; const num = 1; const bool = true; -const shape = { top: num, left: num, bottom: num, right: num }; +const shape: Shape = { top: num, left: num, bottom: num, right: num }; const component = ( Date: Wed, 5 Sep 2018 10:46:22 +0200 Subject: [PATCH 15/78] Perform changes conform instructions from armanio123 --- types/react-visibility-sensor/index.d.ts | 6 ++++-- .../react-visibility-sensor-tests.tsx | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/types/react-visibility-sensor/index.d.ts b/types/react-visibility-sensor/index.d.ts index 2aa3b9adde..9e8776cb8f 100644 --- a/types/react-visibility-sensor/index.d.ts +++ b/types/react-visibility-sensor/index.d.ts @@ -6,7 +6,9 @@ import * as React from "react"; -export interface Shape { +export as namespace ReactVisibilitySensor; + +interface Shape { top?: number; left?: number; bottom?: number; @@ -35,4 +37,4 @@ interface Props { declare const ReactVisibilitySensor: React.StatelessComponent; -export default ReactVisibilitySensor; +export = ReactVisibilitySensor; diff --git a/types/react-visibility-sensor/react-visibility-sensor-tests.tsx b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx index 9c8e552479..9dca0efb34 100644 --- a/types/react-visibility-sensor/react-visibility-sensor-tests.tsx +++ b/types/react-visibility-sensor/react-visibility-sensor-tests.tsx @@ -1,9 +1,10 @@ import * as React from "react"; -import ReactVisibilitySensor, { Shape } from "react-visibility-sensor"; +import * as ReactVisibilitySensor from "react-visibility-sensor"; + const num = 1; const bool = true; -const shape: Shape = { top: num, left: num, bottom: num, right: num }; +const shape = { top: num, left: num, bottom: num, right: num }; const component = ( Date: Tue, 11 Sep 2018 16:25:08 +0300 Subject: [PATCH 16/78] [jss] Correction to JSSPlugin definition --- types/jss/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jss/index.d.ts b/types/jss/index.d.ts index c8e0f13c6c..edcb0ba95f 100644 --- a/types/jss/index.d.ts +++ b/types/jss/index.d.ts @@ -77,7 +77,7 @@ export interface StyleSheet { export type GenerateClassName = (rule: Rule, sheet?: StyleSheet) => string; export interface JSSPlugin { - [key: string]: () => Partial<{ + [key: string]: Partial<{ onCreateRule(name: string, style: Style, options: RuleOptions): Rule; onProcessRule(rule: Rule, sheet: StyleSheet): void; onProcessStyle(style: Style, rule: Rule, sheet: StyleSheet): Style; From b3475335476d7b326f4a98cced59e2ccc706e426 Mon Sep 17 00:00:00 2001 From: AlexStacker <525029662@qq.com> Date: Fri, 14 Sep 2018 11:25:12 +0800 Subject: [PATCH 17/78] Update missing parameter types --- types/select2/v3/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/select2/v3/index.d.ts b/types/select2/v3/index.d.ts index 771d997384..73f1873df1 100644 --- a/types/select2/v3/index.d.ts +++ b/types/select2/v3/index.d.ts @@ -112,6 +112,14 @@ interface Select2Plugin { * @params triggerChange Should a change event be triggered */ (method: 'data', value: any, triggerChange?: boolean): any; + /** + * Whether it is open + */ + (method: 'opened'): boolean; + /** + * Whether it is in focus + */ + (method: 'isFocused'): boolean; /** * Reverts changes to DOM done by Select2. Any selection done via Select2 will be preserved. */ @@ -124,11 +132,19 @@ interface Select2Plugin { * Closes the dropdown */ (method: 'close'): JQuery; + /** + * Disables Select2 + */ + (method: 'disable'): JQuery; /** * Enables or disables Select2 and its underlying form component * @param value True if it should be enabled false if it should be disabled */ (method: 'enable', value?: boolean): JQuery; + /** + * Enable its focus + */ + (method: 'focus'): JQuery; /** * Toggles readonly mode on Select2 and its underlying form component * @param value True if it should be readonly false if it should be read write From 1335935bc89f043c4d7b6234c2ca449f7fd67e34 Mon Sep 17 00:00:00 2001 From: AlexStacker <525029662@qq.com> Date: Fri, 14 Sep 2018 21:28:41 +0800 Subject: [PATCH 18/78] Add test examples --- types/select2/v3/select2-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/select2/v3/select2-tests.ts b/types/select2/v3/select2-tests.ts index 2d5a400352..c820a246ef 100644 --- a/types/select2/v3/select2-tests.ts +++ b/types/select2/v3/select2-tests.ts @@ -220,6 +220,10 @@ $("#e8").select2("data"); $("#e8").select2("data", { id: "CA", text: "Califoria" }); $("#e8").select2("destroy"); $("#e8").select2("open"); +$("#e8").select2("opened"); +$("#e8").select2("focus"); +$("#e8").select2("isFocused"); +$("#e8").select2("disable"); $("#e8").select2("enable", false); $("#e8").select2("readonly", false); $("#e8").select2('container'); From 5d8ff34ff2746f9ace97cc5a8d8723c0bc994116 Mon Sep 17 00:00:00 2001 From: Conrad Holtzhausen Date: Mon, 17 Sep 2018 15:02:03 +0200 Subject: [PATCH 19/78] @types/chart.js: added missing legendCallback to ChartOptions --- types/chart.js/chart.js-tests.ts | 32 ++++++++++++++++++++++---------- types/chart.js/index.d.ts | 2 ++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index 36f25643d9..41ab453e0f 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -5,8 +5,8 @@ import { Chart, ChartData, Point } from "chart.js"; // => chartjs.Chart const plugin = { - afterDraw: (chartInstance: Chart, easing: string, options?: any) => { - } + afterDraw: (chartInstance: Chart, easing: string, options?: any) => { + } }; const chart: Chart = new Chart(new CanvasRenderingContext2D(), { @@ -82,6 +82,18 @@ if (chart.chartArea) { console.log(chart.chartArea.left); } +// Testing custom legends +chart.config.options = { + ...chart.config.options, + legend: { + display: false, + }, + legendCallback: () => 'legend replacement' +}; +chart.update(); +const customLegend = chart.generateLegend(); +console.log(customLegend === 'legend replacement'); + // Testing radial chart const tickOptions: Chart.LinearTickOptions = { max: 100, @@ -107,14 +119,14 @@ const chartConfig: Chart.ChartConfiguration = { data: { labels: ['#apples', '#pears', '#apricots', '#acorns', '#amigas', "#orics"], datasets: [{ - label: "test", - lineTension: 0.15, - data: [1, 1, 2, 3, 5], - backgroundColor: '#37738353', - borderColor: '#37738353', - borderWidth: 3, - fill: true - }] + label: "test", + lineTension: 0.15, + data: [1, 1, 2, 3, 5], + backgroundColor: '#37738353', + borderColor: '#37738353', + borderWidth: 3, + fill: true + }] }, options: radarChartOptions }; diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 49027a2bea..81b35185ae 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -14,6 +14,7 @@ // Francesco Benedetto // Alexandros Dorodoulis // Manuel Heidrich +// Conrad Holtzhausen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -264,6 +265,7 @@ declare namespace Chart { aspectRatio?: number; maintainAspectRatio?: boolean; events?: string[]; + legendCallback?(chart: Chart): string; onHover?(this: Chart, event: MouseEvent, activeElements: Array<{}>): any; onClick?(event?: MouseEvent, activeElements?: Array<{}>): any; onResize?(this: Chart, newSize: ChartSize): void; From b587df40521d909cd798f5e8989a8fa2a49c7f5a Mon Sep 17 00:00:00 2001 From: Tyler Singer-Clark Date: Mon, 17 Sep 2018 11:10:08 -0400 Subject: [PATCH 20/78] added 'scatter' to ChartType list --- types/chart.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 49027a2bea..8160c001a0 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -163,7 +163,7 @@ interface Model { } declare namespace Chart { - type ChartType = 'line' | 'bar' | 'horizontalBar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie'; + type ChartType = 'line' | 'bar' | 'horizontalBar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie' | 'scatter'; type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; From 6f8c4c842792536c9d814b59599140dcaa613eae Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Mon, 17 Sep 2018 09:43:54 -0700 Subject: [PATCH 21/78] Update index.d.ts --- types/office-runtime/index.d.ts | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 4e45c8dc82..6d62d78688 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -14,7 +14,7 @@ declare namespace OfficeRuntime { const AsyncStorage: AsyncStorage; // tslint:disable-next-line:interface-name - /** + /* * Asynchronous, global, and persistent key-value storage for Excel Custom Functions only. * @beta * @@ -27,32 +27,32 @@ declare namespace OfficeRuntime { * */ interface AsyncStorage { - /** + /* * @beta * Retrieves an object based on a key and invokes a callback when finished. Returns a Promise. * */ getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise; - /** + /* * @beta * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. * */ setItem(key: string, value: string, callback?: (error?: Error) => void): Promise; - /** + /* * @beta * Removes an item for specified key and invokes a callback when finished. Returns a Promise. * * */ removeItem(key: string, callback?: (error?: Error) => void): Promise; - /** + /* * @beta * Erases all AsyncStorage. Returns a Promise. * */ clear(callback?: (error?: Error) => void): Promise; - /** + /* * @beta * Returns a Promise with all keys for your custom function. * @@ -64,13 +64,13 @@ declare namespace OfficeRuntime { * */ multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise; - /** + /* * @beta * Deletes a batch of keys, specified in the `keys` array. * */ multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise;/** - /** + /* * @beta * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. * @@ -78,33 +78,33 @@ declare namespace OfficeRuntime { multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise; } - /** + /* * @beta * Object representing the dialog box for Excel Custom Functions only. * */ interface Dialog { - /** + /* * @beta * Method that closes a dialog box. */ close(): Promise; } - /** + /* * * Provides options for how a dialog is displayed for Excel Custom Functions only. * */ interface DisplayWebDialogOptions { - /** + /* * @beta * Determines whether the dialog box displays as a popup (false) or within an IFrame (true). This setting is only applicable to custom functions running on Excel Online. * * [Api set: Dialog 1.2] */ displayInIFrame?: boolean; - /** + /* * @beta * Defines the height of the dialog box as a percentage of the current display. * @@ -120,7 +120,7 @@ declare namespace OfficeRuntime { */ width?: string; - /** + /* * @beta * True if title is hidden from the dialog box. * @@ -128,7 +128,7 @@ declare namespace OfficeRuntime { */ hideTitle?: boolean; - /** + /* * @beta * Callback that is run when the dialog box sends a message to its parent. * @@ -136,7 +136,7 @@ declare namespace OfficeRuntime { */ onMessage?: (message: string, dialog?: Dialog) => void; - /** + /* * @beta * Callback that is run when the dialog box is closed. * @@ -144,12 +144,12 @@ declare namespace OfficeRuntime { */ onClose?: () => void; - /** + /* * @beta * Callback that is run when the dialog box sends an error. * * */ - onRuntimeError?: (error: Error, dialog?: Dialog) => void; + onMessage?(message: string, dialog?: Dialog): void } } From 0badead1af0532d00cf7e7a39e7cf21c3a11ceed Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Mon, 17 Sep 2018 09:46:32 -0700 Subject: [PATCH 22/78] Update index.d.ts --- types/office-runtime/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 6d62d78688..d8915fbf97 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -58,7 +58,7 @@ declare namespace OfficeRuntime { * */ getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise; - /** + /* * @beta * Stores multiple key-value pairs in one batch. Returns a Promise. When a key doesn't exist, returns null. * From 155358277dc81ce2c92cbff890e799eb5917c82f Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Mon, 17 Sep 2018 09:47:25 -0700 Subject: [PATCH 23/78] minor fix --- types/office-runtime/office-runtime-tests.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/office-runtime/office-runtime-tests.ts b/types/office-runtime/office-runtime-tests.ts index a8d8f09675..1b422ba1ed 100644 --- a/types/office-runtime/office-runtime-tests.ts +++ b/types/office-runtime/office-runtime-tests.ts @@ -55,10 +55,10 @@ OfficeRuntime.displayWebDialog("https://localhost:3000", { width: '50%', displayInIFrame: false, hideTitle: true, -     onMessage: (message, dialog) => { -         console.log(message); -             dialog.close(); -             } +    onMessage: (message, dialog) => { + console.log(message); + dialog.close(); + } } ) @@ -74,4 +74,4 @@ OfficeRuntime.displayWebDialog("https://localhost:3000", { console.log(error); dialog.close(); } -}) \ No newline at end of file +}) From 866c802cf7ee68859f917cd256de3c585eef17ea Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Mon, 17 Sep 2018 09:51:01 -0700 Subject: [PATCH 24/78] Editing out the long list of lint things as we may not need them --- types/office-runtime/tslint.json | 80 +------------------------------- 1 file changed, 2 insertions(+), 78 deletions(-) diff --git a/types/office-runtime/tslint.json b/types/office-runtime/tslint.json index 5c50b51e66..f93cf8562a 100644 --- a/types/office-runtime/tslint.json +++ b/types/office-runtime/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} \ No newline at end of file + "extends": "dtslint/dt.json" +} From b3bf8ded031de9dbccedfc4992fc0431421eacaa Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Tue, 18 Sep 2018 09:26:11 -0700 Subject: [PATCH 25/78] removing spaces --- types/office-runtime/index.d.ts | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index d8915fbf97..e3583e2a8f 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -29,51 +29,42 @@ declare namespace OfficeRuntime { interface AsyncStorage { /* * @beta - * Retrieves an object based on a key and invokes a callback when finished. Returns a Promise. - * + * Retrieves an object based on a key and invokes a callback when finished. Returns a Promise. */ getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise; /* * @beta * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. - * */ setItem(key: string, value: string, callback?: (error?: Error) => void): Promise; /* * @beta * Removes an item for specified key and invokes a callback when finished. Returns a Promise. - * - * */ removeItem(key: string, callback?: (error?: Error) => void): Promise; /* * @beta * Erases all AsyncStorage. Returns a Promise. - * */ clear(callback?: (error?: Error) => void): Promise; /* * @beta * Returns a Promise with all keys for your custom function. - * */ getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise; /* * @beta * Stores multiple key-value pairs in one batch. Returns a Promise. When a key doesn't exist, returns null. - * */ multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise; /* * @beta * Deletes a batch of keys, specified in the `keys` array. - * */ multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise;/** /* * @beta * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. - * */ multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise; } @@ -81,7 +72,6 @@ declare namespace OfficeRuntime { /* * @beta * Object representing the dialog box for Excel Custom Functions only. - * */ interface Dialog { /* @@ -92,9 +82,7 @@ declare namespace OfficeRuntime { } /* - * * Provides options for how a dialog is displayed for Excel Custom Functions only. - * */ interface DisplayWebDialogOptions { /* @@ -131,24 +119,18 @@ declare namespace OfficeRuntime { /* * @beta * Callback that is run when the dialog box sends a message to its parent. - * - * */ onMessage?: (message: string, dialog?: Dialog) => void; /* * @beta * Callback that is run when the dialog box is closed. - * - * */ onClose?: () => void; /* * @beta * Callback that is run when the dialog box sends an error. - * - * */ onMessage?(message: string, dialog?: Dialog): void } From 8409fb07b211bf95fe3645c8cf51c4aeb7dad4d2 Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Tue, 18 Sep 2018 09:27:42 -0700 Subject: [PATCH 26/78] Update tsconfig.json --- types/office-runtime/tsconfig.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/types/office-runtime/tsconfig.json b/types/office-runtime/tsconfig.json index 0609e72ad0..75d7064acb 100644 --- a/types/office-runtime/tsconfig.json +++ b/types/office-runtime/tsconfig.json @@ -2,8 +2,7 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, @@ -20,4 +19,4 @@ "index.d.ts", "office-runtime-tests.ts" ] -} \ No newline at end of file +} From 97a40fb289a95d2f1801f64945741989bbc77008 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 09:37:40 -0700 Subject: [PATCH 27/78] fixes --- types/office-runtime/index.d.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index e3583e2a8f..34eaf48c23 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for office-runtime +// Type definitions for office-runtime 1.0 // Project: http://dev.office.com/ // Definitions by: Michael Zlatskovsky , Michelle Scharlock // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -61,7 +61,7 @@ declare namespace OfficeRuntime { * @beta * Deletes a batch of keys, specified in the `keys` array. */ - multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise;/** + multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise; /* * @beta * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. @@ -116,13 +116,7 @@ declare namespace OfficeRuntime { */ hideTitle?: boolean; - /* - * @beta - * Callback that is run when the dialog box sends a message to its parent. - */ - onMessage?: (message: string, dialog?: Dialog) => void; - - /* + /* * @beta * Callback that is run when the dialog box is closed. */ From c2f92b7c3026d9f03f268c52b55acbf921d65693 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 09:40:05 -0700 Subject: [PATCH 28/78] fixes --- types/office-runtime/office-runtime-tests.ts | 63 +++++++++----------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/types/office-runtime/office-runtime-tests.ts b/types/office-runtime/office-runtime-tests.ts index 1b422ba1ed..667eb2e84b 100644 --- a/types/office-runtime/office-runtime-tests.ts +++ b/types/office-runtime/office-runtime-tests.ts @@ -4,74 +4,67 @@ Copyright (c) Microsoft Corporation */ OfficeRuntime.AsyncStorage.getItem("foo", () => { - //do a thing + // perform an action }) -OfficeRuntime.AsyncStorage.getItem("foo").then(value => console.log(value)) +OfficeRuntime.AsyncStorage.getItem("foo").then(value => console.log(value)); OfficeRuntime.AsyncStorage.setItem("foo", "bar"); -OfficeRuntime.AsyncStorage.setItem("foo", "bar").then(error => console.log(error)) +OfficeRuntime.AsyncStorage.setItem("foo", "bar").then(error => console.log(error)); -OfficeRuntime.AsyncStorage.removeItem("foo"); +OfficeRuntime.AsyncStorage.removeItem("foo"); OfficeRuntime.AsyncStorage.removeItem("foo", () => { - //do a thing -}) + // perform an action +}); OfficeRuntime.AsyncStorage.clear(); OfficeRuntime.AsyncStorage.clear(() => { - //do a thing -}) + // perform an action +}); OfficeRuntime.AsyncStorage.getAllKeys().then(keys => { keys.forEach(item => console.log(item)); -}) +}); + OfficeRuntime.AsyncStorage.getAllKeys((error, keys) => { if (error) { - console.error(error); + console.error(error); } else { keys.forEach(item => console.log(item)); } -}) +}); OfficeRuntime.AsyncStorage.multiSet( - [["username", "foo"], ["yearOfBirth", "2001"]], + [["username", "foo"], ["yearOfBirth", "2001"]], errors => { errors.filter(error => error != null).forEach(error => console.log(error)); } -) +); -OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]); -OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]).then(value => console.log(value)) +OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]); +OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]).then(value => console.log(value)); OfficeRuntime.AsyncStorage.multiGet(["username", "yearOfBirth"]).then( values => { - console.log(values[0][1]) - console.log(values[1][1]) + console.log(values[0][1]); + console.log(values[1][1]); } -) - - -OfficeRuntime.displayWebDialog("https://localhost:3000", { - height: '50', - width: '50%', - displayInIFrame: false, - hideTitle: true, -    onMessage: (message, dialog) => { - console.log(message); - dialog.close(); - } - } -) +); +OfficeRuntime.displayWebDialog("https://localhost:3000", { + height: 50, + width: 50%, + displayInIFrame: false +}); OfficeRuntime.displayWebDialog("https://localhost:3000", { onClose: () => { - console.log("closed"); + console.log("closed"); } -}) +}); OfficeRuntime.displayWebDialog("https://localhost:3000", { onRuntimeError: (error, dialog) => { - console.log(error); + console.log(error); dialog.close(); } -}) +}); From 25fe3a5300bfedd140baa00d54349a49eb8c81dc Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 09:47:19 -0700 Subject: [PATCH 29/78] ch ch ch changes --- types/office-runtime/index.d.ts | 18 +++++------------- types/office-runtime/office-runtime-tests.ts | 11 +---------- types/office-runtime/tsconfig.json | 3 ++- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 34eaf48c23..0847829553 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -15,7 +15,7 @@ declare namespace OfficeRuntime { // tslint:disable-next-line:interface-name /* - * Asynchronous, global, and persistent key-value storage for Excel Custom Functions only. + * Asynchronous, global, and persistent key-value storage that can be used by Excel Custom Functions. * @beta * * @remarks @@ -49,7 +49,7 @@ declare namespace OfficeRuntime { clear(callback?: (error?: Error) => void): Promise; /* * @beta - * Returns a Promise with all keys for your custom function. + * Returns a Promise with all keys. */ getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise; /* @@ -71,7 +71,7 @@ declare namespace OfficeRuntime { /* * @beta - * Object representing the dialog box for Excel Custom Functions only. + * Object representing the dialog box. */ interface Dialog { /* @@ -82,37 +82,29 @@ declare namespace OfficeRuntime { } /* - * Provides options for how a dialog is displayed for Excel Custom Functions only. + * Provides options for how a dialog is displayed. */ interface DisplayWebDialogOptions { /* * @beta * Determines whether the dialog box displays as a popup (false) or within an IFrame (true). This setting is only applicable to custom functions running on Excel Online. - * - * [Api set: Dialog 1.2] */ displayInIFrame?: boolean; /* * @beta * Defines the height of the dialog box as a percentage of the current display. - * - * [Api set: Dialog 1.2] */ height?: string; /** * @beta * Defines the width of the dialog box as a percentage of the current display. - * - * [Api set: Dialog 1.2] */ width?: string; /* * @beta * True if title is hidden from the dialog box. - * - * [Api set: Dialog 1.2] */ hideTitle?: boolean; @@ -126,6 +118,6 @@ declare namespace OfficeRuntime { * @beta * Callback that is run when the dialog box sends an error. */ - onMessage?(message: string, dialog?: Dialog): void + onMessage?(message: string, dialog?: Dialog): void } } diff --git a/types/office-runtime/office-runtime-tests.ts b/types/office-runtime/office-runtime-tests.ts index 667eb2e84b..889665b3df 100644 --- a/types/office-runtime/office-runtime-tests.ts +++ b/types/office-runtime/office-runtime-tests.ts @@ -5,7 +5,7 @@ Copyright (c) Microsoft Corporation OfficeRuntime.AsyncStorage.getItem("foo", () => { // perform an action -}) +}); OfficeRuntime.AsyncStorage.getItem("foo").then(value => console.log(value)); OfficeRuntime.AsyncStorage.setItem("foo", "bar"); @@ -51,8 +51,6 @@ OfficeRuntime.AsyncStorage.multiGet(["username", "yearOfBirth"]).then( ); OfficeRuntime.displayWebDialog("https://localhost:3000", { - height: 50, - width: 50%, displayInIFrame: false }); @@ -61,10 +59,3 @@ OfficeRuntime.displayWebDialog("https://localhost:3000", { console.log("closed"); } }); - -OfficeRuntime.displayWebDialog("https://localhost:3000", { - onRuntimeError: (error, dialog) => { - console.log(error); - dialog.close(); - } -}); diff --git a/types/office-runtime/tsconfig.json b/types/office-runtime/tsconfig.json index 75d7064acb..f8559f2ebd 100644 --- a/types/office-runtime/tsconfig.json +++ b/types/office-runtime/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, From 03634965e7f146d7ddcab37c9190d56ed7418d18 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 10:12:17 -0700 Subject: [PATCH 30/78] changes --- types/office-runtime/index.d.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 0847829553..216e2f2adc 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -12,18 +12,18 @@ Copyright (c) Microsoft Corporation declare namespace OfficeRuntime { function displayWebDialog(url: string, options: DisplayWebDialogOptions): Promise; const AsyncStorage: AsyncStorage; - + // tslint:disable-next-line:interface-name /* * Asynchronous, global, and persistent key-value storage that can be used by Excel Custom Functions. * @beta * - * @remarks - * Each add-in instance has its own storage partition, unique to a user and their device. + * @remarks + * Each add-in instance has its own storage partition, unique to a user and their device. * - * The default amount of total storage allowed per add-in is 5MB. + * The default amount of total storage allowed per add-in is 5MB. * - * Each method listed below returns a Promise object. + * Each method listed below returns a Promise object. * */ interface AsyncStorage { @@ -34,27 +34,27 @@ declare namespace OfficeRuntime { getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise; /* * @beta - * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. + * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. */ setItem(key: string, value: string, callback?: (error?: Error) => void): Promise; /* * @beta - * Removes an item for specified key and invokes a callback when finished. Returns a Promise. + * Removes an item for specified key and invokes a callback when finished. Returns a Promise. */ removeItem(key: string, callback?: (error?: Error) => void): Promise; /* * @beta - * Erases all AsyncStorage. Returns a Promise. + * Erases all AsyncStorage. Returns a Promise. */ clear(callback?: (error?: Error) => void): Promise; /* * @beta - * Returns a Promise with all keys. + * Returns a Promise with all keys. */ getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise; /* * @beta - * Stores multiple key-value pairs in one batch. Returns a Promise. When a key doesn't exist, returns null. + * Stores multiple key-value pairs in one batch. Returns a Promise. When a key doesn't exist, returns null. */ multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise; /* @@ -64,11 +64,10 @@ declare namespace OfficeRuntime { multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise; /* * @beta - * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. + * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. */ multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise; } - /* * @beta * Object representing the dialog box. From f6166df47366ef512f47bbdf2c6deb30fa5420c8 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 10:14:46 -0700 Subject: [PATCH 31/78] spaces --- types/office-runtime/index.d.ts | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 216e2f2adc..74cb1179a3 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -20,11 +20,11 @@ declare namespace OfficeRuntime { * * @remarks * Each add-in instance has its own storage partition, unique to a user and their device. - * + * * The default amount of total storage allowed per add-in is 5MB. - * + * * Each method listed below returns a Promise object. - * + * */ interface AsyncStorage { /* @@ -34,7 +34,7 @@ declare namespace OfficeRuntime { getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise; /* * @beta - * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. + * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. */ setItem(key: string, value: string, callback?: (error?: Error) => void): Promise; /* @@ -70,23 +70,23 @@ declare namespace OfficeRuntime { } /* * @beta - * Object representing the dialog box. + * Object representing the dialog box. */ interface Dialog { /* * @beta - * Method that closes a dialog box. + * Method that closes a dialog box. */ close(): Promise; } /* - * Provides options for how a dialog is displayed. + * Provides options for how a dialog is displayed. */ interface DisplayWebDialogOptions { /* * @beta - * Determines whether the dialog box displays as a popup (false) or within an IFrame (true). This setting is only applicable to custom functions running on Excel Online. + * Determines whether the dialog box displays as a popup (false) or within an IFrame (true). This setting is only applicable to custom functions running on Excel Online. */ displayInIFrame?: boolean; /* @@ -94,25 +94,21 @@ declare namespace OfficeRuntime { * Defines the height of the dialog box as a percentage of the current display. */ height?: string; - - /** - * @beta - * Defines the width of the dialog box as a percentage of the current display. - */ - width?: string; - /* * @beta - * True if title is hidden from the dialog box. + * Defines the width of the dialog box as a percentage of the current display. + */ + width?: string; + /* + * @beta + * True if title is hidden from the dialog box. */ hideTitle?: boolean; - /* * @beta * Callback that is run when the dialog box is closed. */ onClose?: () => void; - /* * @beta * Callback that is run when the dialog box sends an error. From 2c2c7e2acd34d93b1f5d21d80ce3ed1f1fa9ab7f Mon Sep 17 00:00:00 2001 From: mscharlock Date: Tue, 18 Sep 2018 10:17:01 -0700 Subject: [PATCH 32/78] lint fix --- types/office-runtime/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index 74cb1179a3..bb0d779b11 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -79,7 +79,7 @@ declare namespace OfficeRuntime { */ close(): Promise; } - + /* * Provides options for how a dialog is displayed. */ @@ -113,6 +113,6 @@ declare namespace OfficeRuntime { * @beta * Callback that is run when the dialog box sends an error. */ - onMessage?(message: string, dialog?: Dialog): void + onMessage?(message: string, dialog?: Dialog): void; } } From 785ca92c273d9c1e5d8515f04c0e7058c347c027 Mon Sep 17 00:00:00 2001 From: Mike North Date: Tue, 18 Sep 2018 10:19:15 -0700 Subject: [PATCH 33/78] [ember] TSLint - enable jsdoc-format rule --- types/ember/index.d.ts | 449 ++++++++++++++++++++-------------------- types/ember/tslint.json | 1 - 2 files changed, 224 insertions(+), 226 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 390bad601a..94ed739323 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -208,11 +208,10 @@ declare module 'ember' { const ViewMixin: Ember.Mixin; /** - Ember.CoreView is an abstract class that exists to give view-like behavior to both Ember's main - view class Ember.Component and other classes that don't need the full functionality of Ember.Component. - - Unless you have specific needs for CoreView, you will use Ember.Component in your applications. - **/ + * Ember.CoreView is an abstract class that exists to give view-like behavior to both Ember's main + * view class Ember.Component and other classes that don't need the full functionality of Ember.Component. + * Unless you have specific needs for CoreView, you will use Ember.Component in your applications. + */ class CoreView extends Ember.Object.extend(Ember.Evented, Ember.ActionHandler) {} interface ActionSupport { sendAction(action: string, ...params: any[]): void; @@ -221,17 +220,17 @@ declare module 'ember' { interface ClassNamesSupport { /** - A list of properties of the view to apply as class names. If the property is a string value, - the value of that string will be applied as a class name. - - If the value of the property is a Boolean, the name of that property is added as a dasherized - class name. - - If you would prefer to use a custom value instead of the dasherized property name, you can - pass a binding like this: `classNameBindings: ['isUrgent:urgent']` - - This list of properties is inherited from the component's superclasses as well. - */ + * A list of properties of the view to apply as class names. If the property is a string value, + * the value of that string will be applied as a class name. + * + * If the value of the property is a Boolean, the name of that property is added as a dasherized + * class name. + * + * If you would prefer to use a custom value instead of the dasherized property name, you can + * pass a binding like this: `classNameBindings: ['isUrgent:urgent']` + * + * This list of properties is inherited from the component's superclasses as well. + */ classNameBindings: string[]; /** * Standard CSS class names to apply to the view's outer element. This @@ -248,11 +247,11 @@ declare module 'ember' { actionContext?: Ember.Object; } /** - Ember.TargetActionSupport is a mixin that can be included in a class to add a triggerAction method - with semantics similar to the Handlebars {{action}} helper. In normal Ember usage, the {{action}} - helper is usually the best choice. This mixin is most often useful when you are doing more - complex event handling in Components. - **/ + * Ember.TargetActionSupport is a mixin that can be included in a class to add a triggerAction method + * with semantics similar to the Handlebars {{action}} helper. In normal Ember usage, the {{action}} + * helper is usually the best choice. This mixin is most often useful when you are doing more + * complex event handling in Components. + */ interface TargetActionSupport { triggerAction(opts: TriggerActionOptions): boolean; } @@ -367,111 +366,111 @@ declare module 'ember' { } const _RegistryProxyMixin: Mixin<_RegistryProxyMixin>; /** - Ember.ActionHandler is available on some familiar classes including Ember.Route, - Ember.Component, and Ember.Controller. (Internally the mixin is used by Ember.CoreView, - Ember.ControllerMixin, and Ember.Route and available to the above classes through inheritance.) - **/ + * Ember.ActionHandler is available on some familiar classes including Ember.Route, + * Ember.Component, and Ember.Controller. (Internally the mixin is used by Ember.CoreView, + * Ember.ControllerMixin, and Ember.Route and available to the above classes through inheritance.) + */ interface ActionHandler { /** - Triggers a named action on the ActionHandler. Any parameters supplied after the actionName - string will be passed as arguments to the action target function. - - If the ActionHandler has its target property set, actions may bubble to the target. - Bubbling happens when an actionName can not be found in the ActionHandler's actions - hash or if the action target function returns true. - **/ + * Triggers a named action on the ActionHandler. Any parameters supplied after the actionName + * string will be passed as arguments to the action target function. + * + * If the ActionHandler has its target property set, actions may bubble to the target. + * Bubbling happens when an actionName can not be found in the ActionHandler's actions + * hash or if the action target function returns true. + */ send(actionName: string, ...args: any[]): void; /** - The collection of functions, keyed by name, available on this ActionHandler as action targets. - **/ + * The collection of functions, keyed by name, available on this ActionHandler as action targets. + */ actions: ActionsHash; } const ActionHandler: Ember.Mixin; /** - An instance of Ember.Application is the starting point for every Ember application. It helps to - instantiate, initialize and coordinate the many objects that make up your app. - **/ + * An instance of Ember.Application is the starting point for every Ember application. It helps to + * instantiate, initialize and coordinate the many objects that make up your app. + */ class Application extends Engine { /** - Call advanceReadiness after any asynchronous setup logic has completed. - Each call to deferReadiness must be matched by a call to advanceReadiness - or the application will never become ready and routing will not begin. - **/ + * Call advanceReadiness after any asynchronous setup logic has completed. + * Each call to deferReadiness must be matched by a call to advanceReadiness + * or the application will never become ready and routing will not begin. + */ advanceReadiness(): void; /** - Use this to defer readiness until some condition is true. - - This allows you to perform asynchronous setup logic and defer - booting your application until the setup has finished. - - However, if the setup requires a loading UI, it might be better - to use the router for this purpose. - */ + * Use this to defer readiness until some condition is true. + * + * This allows you to perform asynchronous setup logic and defer + * booting your application until the setup has finished. + * + * However, if the setup requires a loading UI, it might be better + * to use the router for this purpose. + */ deferReadiness(): void; /** - defines an injection or typeInjection - **/ + * defines an injection or typeInjection + */ inject(factoryNameOrType: string, property: string, injectionName: string): void; /** - This injects the test helpers into the window's scope. If a function of the - same name has already been defined it will be cached (so that it can be reset - if the helper is removed with `unregisterHelper` or `removeTestHelpers`). - Any callbacks registered with `onInjectHelpers` will be called once the - helpers have been injected. - **/ + * This injects the test helpers into the window's scope. If a function of the + * same name has already been defined it will be cached (so that it can be reset + * if the helper is removed with `unregisterHelper` or `removeTestHelpers`). + * Any callbacks registered with `onInjectHelpers` will be called once the + * helpers have been injected. + */ injectTestHelpers(): void; /** - registers a factory for later injection - @param fullName type:name (e.g., 'model:user') - @param factory (e.g., App.Person) - **/ + * registers a factory for later injection + * @param fullName type:name (e.g., 'model:user') + * @param factory (e.g., App.Person) + */ register(fullName: string, factory: Function, options?: {}): void; /** - This removes all helpers that have been registered, and resets and functions - that were overridden by the helpers. - **/ + * This removes all helpers that have been registered, and resets and functions + * that were overridden by the helpers. + */ removeTestHelpers(): void; /** - Reset the application. This is typically used only in tests. - **/ + * Reset the application. This is typically used only in tests. + */ reset(): void; /** - This hook defers the readiness of the application, so that you can start - the app when your tests are ready to run. It also sets the router's - location to 'none', so that the window's location will not be modified - (preventing both accidental leaking of state between tests and interference - with your testing framework). - **/ + * This hook defers the readiness of the application, so that you can start + * the app when your tests are ready to run. It also sets the router's + * location to 'none', so that the window's location will not be modified + * (preventing both accidental leaking of state between tests and interference + * with your testing framework). + */ setupForTesting(): void; /** - The DOM events for which the event dispatcher should listen. - */ + * The DOM events for which the event dispatcher should listen. + */ customEvents: EventDispatcherEvents; /** - The Ember.EventDispatcher responsible for delegating events to this application's views. - **/ + * The Ember.EventDispatcher responsible for delegating events to this application's views. + */ eventDispatcher: EventDispatcher; /** - Set this to provide an alternate class to Ember.DefaultResolver - **/ + * Set this to provide an alternate class to Ember.DefaultResolver + */ resolver: DefaultResolver; /** - The root DOM element of the Application. This can be specified as an - element or a jQuery-compatible selector string. - - This is the element that will be passed to the Application's, eventDispatcher, - which sets up the listeners for event delegation. Every view in your application - should be a child of the element you specify here. - **/ + * The root DOM element of the Application. This can be specified as an + * element or a jQuery-compatible selector string. + * + * This is the element that will be passed to the Application's, eventDispatcher, + * which sets up the listeners for event delegation. Every view in your application + * should be a child of the element you specify here. + */ rootElement: HTMLElement | string; /** - Called when the Application has become ready. - The call will be delayed until the DOM has become ready. - **/ + * Called when the Application has become ready. + * The call will be delayed until the DOM has become ready. + */ ready: Function; /** - Application's router. - **/ + * Application's router. + */ Router: Router; registry: Registry; /** @@ -485,14 +484,14 @@ declare module 'ember' { buildInstance(options?: object): ApplicationInstance; } /** - The `ApplicationInstance` encapsulates all of the stateful aspects of a - running `Application`. - **/ + * The `ApplicationInstance` encapsulates all of the stateful aspects of a + * running `Application`. + */ class ApplicationInstance extends EngineInstance {} /** - This module implements Observer-friendly Array-like behavior. This mixin is picked up by the - Array class as well as other controllers, etc. that want to appear to be arrays. - **/ + * This module implements Observer-friendly Array-like behavior. This mixin is picked up by the + * Array class as well as other controllers, etc. that want to appear to be arrays. + */ interface Array extends Enumerable { /** * __Required.__ You must implement this method to apply this mixin. @@ -569,10 +568,10 @@ declare module 'ember' { const Array: Mixin>; /** - An ArrayProxy wraps any other object that implements Ember.Array and/or Ember.MutableArray, - forwarding all requests. This makes it very useful for a number of binding use cases or other cases - where being able to swap out the underlying array is useful. - **/ + * An ArrayProxy wraps any other object that implements Ember.Array and/or Ember.MutableArray, + * forwarding all requests. This makes it very useful for a number of binding use cases or other cases + * where being able to swap out the underlying array is useful. + */ interface ArrayProxy extends MutableArray {} class ArrayProxy extends Object.extend(MutableArray as {}) { content: NativeArray; @@ -585,15 +584,15 @@ declare module 'ember' { objectAtContent(idx: number): T | undefined; } /** - AutoLocation will select the best location option based off browser support with the priority order: history, hash, none. - **/ + * AutoLocation will select the best location option based off browser support with the priority order: history, hash, none. + */ class AutoLocation extends Object {} /** * Connects the properties of two objects so that whenever the value of one property changes, * the other property will be changed also. * * @deprecated https://emberjs.com/deprecations/v2.x#toc_ember-binding - **/ + */ class Binding { constructor(toPath: string, fromPath: string); connect(obj: any): Binding; @@ -604,9 +603,9 @@ declare module 'ember' { toString(): string; } /** - The internal class used to create text inputs when the {{input}} helper is used - with type of checkbox. See Handlebars.helpers.input for usage details. - **/ + * The internal class used to create text inputs when the {{input}} helper is used + * with type of checkbox. See Handlebars.helpers.input for usage details. + */ class Checkbox extends Component {} /** * Implements some standard methods for comparing objects. Add this mixin to @@ -617,10 +616,10 @@ declare module 'ember' { } const Comparable: Mixin; /** - A view that is completely isolated. Property access in its templates go to the view object - and actions are targeted at the view object. There is no access to the surrounding context or - outer controller; all contextual information is passed in. - **/ + * A view that is completely isolated. Property access in its templates go to the view object + * and actions are targeted at the view object. There is no access to the surrounding context or + * outer controller; all contextual information is passed in. + */ class Component extends CoreView.extend(ViewMixin, ActionSupport, ClassNamesSupport) { // methods readDOMAttr(name: string): string; @@ -690,11 +689,11 @@ declare module 'ember' { willUpdate(): void; } /** - A computed property transforms an objects function into a property. - By default the function backing the computed property will only be called once and the result - will be cached. You can specify various properties that your computed property is dependent on. - This will force the cached result to be recomputed if the dependencies are modified. - **/ + * A computed property transforms an objects function into a property. + * By default the function backing the computed property will only be called once and the result + * will be cached. You can specify various properties that your computed property is dependent on. + * This will force the cached result to be recomputed if the dependencies are modified. + */ class ComputedProperty { // Necessary in order to avoid losing type information // see: https://github.com/typed-ember/ember-cli-typescript/issues/246#issuecomment-414812013 @@ -737,9 +736,9 @@ declare module 'ember' { factoryFor(fullName: string, options?: {}): any; } /** - The ContainerDebugAdapter helps the container and resolver interface - with tools that debug Ember such as the Ember Inspector for Chrome and Firefox. - **/ + * The ContainerDebugAdapter helps the container and resolver interface + * with tools that debug Ember such as the Ember Inspector for Chrome and Firefox. + */ class ContainerDebugAdapter extends Object { resolver: Resolver; canCatalogEntriesByType(type: string): boolean; @@ -782,15 +781,15 @@ declare module 'ember' { /** * As of Ember 3.1, CoreObject constructor takes initial object properties as an argument. * See: https://github.com/emberjs/ember.js/commit/4709935854d4c29b0d2c054614d53fa2c55309b1 - **/ + */ constructor(properties?: object); _super(...args: any[]): any; /** - An overridable method called when objects are instantiated. By default, - does nothing unless it is overridden during class definition. - **/ + * An overridable method called when objects are instantiated. By default, + * does nothing unless it is overridden during class definition. + */ init(): void; /** @@ -800,39 +799,39 @@ declare module 'ember' { concatenatedProperties: any[]; /** - Destroyed object property flag. If this property is true the observers and bindings were - already removed by the effect of calling the destroy() method. - @default false - **/ + * Destroyed object property flag. If this property is true the observers and bindings were + * already removed by the effect of calling the destroy() method. + * @default false + */ isDestroyed: boolean; /** - Destruction scheduled flag. The destroy() method has been called. The object stays intact - until the end of the run loop at which point the isDestroyed flag is set. - @default false - **/ + * Destruction scheduled flag. The destroy() method has been called. The object stays intact + * until the end of the run loop at which point the isDestroyed flag is set. + * @default false + */ isDestroying: boolean; /** - Destroys an object by setting the `isDestroyed` flag and removing its - metadata, which effectively destroys observers and bindings. - If you try to set a property on a destroyed object, an exception will be - raised. - Note that destruction is scheduled for the end of the run loop and does not - happen immediately. It will set an isDestroying flag immediately. - @return receiver - */ + * Destroys an object by setting the `isDestroyed` flag and removing its + * metadata, which effectively destroys observers and bindings. + * If you try to set a property on a destroyed object, an exception will be + * raised. + * Note that destruction is scheduled for the end of the run loop and does not + * happen immediately. It will set an isDestroying flag immediately. + * @return receiver + */ destroy(): CoreObject; /** - Override to implement teardown. - */ + * Override to implement teardown. + */ willDestroy(): void; /** - Returns a string representation which attempts to provide more information than Javascript's toString - typically does, in a generic way for all Ember objects (e.g., ""). - @return string representation - **/ + * Returns a string representation which attempts to provide more information than Javascript's toString + * typically does, in a generic way for all Ember objects (e.g., ""). + * @return string representation + */ toString(): string; static create(this: Class): InstanceType; @@ -987,14 +986,14 @@ declare module 'ember' { ): obj is Instance; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + * Iterate over each computed property for the class, passing its name and any + * associated metadata (see metaForProperty) to the callback. + */ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + * Returns the original hash that was passed to meta(). + * @param key property name + */ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1308,8 +1307,8 @@ declare module 'ember' { } const Enumerable: Mixin>; /** - A subclass of the JavaScript Error object for use in Ember. - **/ + * A subclass of the JavaScript Error object for use in Ember. + */ const Error: ErrorConstructor; /** * `Ember.EventDispatcher` handles delegating browser events to their @@ -1689,8 +1688,8 @@ declare module 'ember' { */ class ObjectProxy extends Object { /** - The object whose properties will be forwarded. - **/ + * The object whose properties will be forwarded. + */ content: Object; } /** @@ -1846,41 +1845,41 @@ declare module 'ember' { } class Resolver extends Ember.Object {} /** - The `Ember.Route` class is used to define individual routes. Refer to - the [routing guide](http://emberjs.com/guides/routing/) for documentation. - */ + * The `Ember.Route` class is used to define individual routes. Refer to + * the [routing guide](http://emberjs.com/guides/routing/) for documentation. + */ class Route extends Object.extend(ActionHandler, Evented) { // methods /** - This hook is called after this route's model has resolved. - It follows identical async/promise semantics to `beforeModel` - but is provided the route's resolved model in addition to - the `transition`, and is therefore suited to performing - logic that can only take place after the model has already - resolved. - */ + * This hook is called after this route's model has resolved. + * It follows identical async/promise semantics to `beforeModel` + * but is provided the route's resolved model in addition to + * the `transition`, and is therefore suited to performing + * logic that can only take place after the model has already + * resolved. + */ afterModel(resolvedModel: any, transition: Transition): any; /** - This hook is the first of the route entry validation hooks - called when an attempt is made to transition into a route - or one of its children. It is called before `model` and - `afterModel`, and is appropriate for cases when: - 1) A decision can be made to redirect elsewhere without - needing to resolve the model first. - 2) Any async operations need to occur first before the - model is attempted to be resolved. - This hook is provided the current `transition` attempt - as a parameter, which can be used to `.abort()` the transition, - save it for a later `.retry()`, or retrieve values set - on it from a previous hook. You can also just call - `this.transitionTo` to another route to implicitly - abort the `transition`. - You can return a promise from this hook to pause the - transition until the promise resolves (or rejects). This could - be useful, for instance, for retrieving async code from - the server that is required to enter a route. - */ + * This hook is the first of the route entry validation hooks + * called when an attempt is made to transition into a route + * or one of its children. It is called before `model` and + * `afterModel`, and is appropriate for cases when: + * 1) A decision can be made to redirect elsewhere without + * needing to resolve the model first. + * 2) Any async operations need to occur first before the + * model is attempted to be resolved. + * This hook is provided the current `transition` attempt + * as a parameter, which can be used to `.abort()` the transition, + * save it for a later `.retry()`, or retrieve values set + * on it from a previous hook. You can also just call + * `this.transitionTo` to another route to implicitly + * abort the `transition`. + * You can return a promise from this hook to pause the + * transition until the promise resolves (or rejects). This could + * be useful, for instance, for retrieving async code from + * the server that is required to enter a route. + */ beforeModel(transition: Transition): any; /** @@ -2240,15 +2239,15 @@ declare module 'ember' { const TextSupport: Ember.Mixin; interface Transition { /** - Aborts the Transition. Note you can also implicitly abort a transition - by initiating another transition while a previous one is underway. - */ + * Aborts the Transition. Note you can also implicitly abort a transition + * by initiating another transition while a previous one is underway. + */ abort(): Transition; /** - Retries a previously-aborted transition (making sure to abort the - transition if it's still active). Returns a new transition that - represents the new attempt to transition. - */ + * Retries a previously-aborted transition (making sure to abort the + * transition if it's still active). Returns a new transition that + * represents the new attempt to transition. + */ retry(): Transition; } interface ViewTargetActionSupport { @@ -3395,44 +3394,44 @@ declare module 'ember' { export class RouterService extends Ember.Service { // /** - Name of the current route. - This property represent the logical name of the route, - which is comma separated. - For the following router: - ```app/router.js - Router.map(function() { - this.route('about'); - this.route('blog', function () { - this.route('post', { path: ':post_id' }); - }); - }); - ``` - It will return: - * `index` when you visit `/` - * `about` when you visit `/about` - * `blog.index` when you visit `/blog` - * `blog.post` when you visit `/blog/some-post-id` - */ + * Name of the current route. + * This property represent the logical name of the route, + * which is comma separated. + * For the following router: + * ```app/router.js + * Router.map(function() { + * this.route('about'); + * this.route('blog', function () { + * this.route('post', { path: ':post_id' }); + * }); + * }); + * ``` + * It will return: + * * `index` when you visit `/` + * * `about` when you visit `/about` + * * `blog.index` when you visit `/blog` + * * `blog.post` when you visit `/blog/some-post-id` + */ readonly currentRouteName: string; // /** - Current URL for the application. - This property represent the URL path for this route. - For the following router: - ```app/router.js - Router.map(function() { - this.route('about'); - this.route('blog', function () { - this.route('post', { path: ':post_id' }); - }); - }); - ``` - It will return: - * `/` when you visit `/` - * `/about` when you visit `/about` - * `/blog` when you visit `/blog` - * `/blog/some-post-id` when you visit `/blog/some-post-id` - */ + * Current URL for the application. + * This property represent the URL path for this route. + * For the following router: + * ```app/router.js + * Router.map(function() { + * this.route('about'); + * this.route('blog', function () { + * this.route('post', { path: ':post_id' }); + * }); + * }); + * ``` + * It will return: + * * `/` when you visit `/` + * * `/about` when you visit `/about` + * * `/blog` when you visit `/blog` + * * `/blog/some-post-id` when you visit `/blog/some-post-id` + */ readonly currentURL: string; // /** diff --git a/types/ember/tslint.json b/types/ember/tslint.json index f77f8d2ed8..06f587c95b 100755 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -3,7 +3,6 @@ "rules": { // Heavy use of Function type in this older package. "ban-types": false, - "jsdoc-format": false, "no-misused-new": false, // these are disabled because of rfc176 module exports From 4178768102da715d2254bae2997d37d828cc9886 Mon Sep 17 00:00:00 2001 From: Michelle Scharlock Date: Tue, 18 Sep 2018 10:22:24 -0700 Subject: [PATCH 34/78] Update index.d.ts --- types/office-runtime/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts index bb0d779b11..3f57014bc9 100644 --- a/types/office-runtime/index.d.ts +++ b/types/office-runtime/index.d.ts @@ -79,7 +79,6 @@ declare namespace OfficeRuntime { */ close(): Promise; } - /* * Provides options for how a dialog is displayed. */ From 904726d3015ae3e83116c5efb68692ce96b93567 Mon Sep 17 00:00:00 2001 From: Mike North Date: Tue, 18 Sep 2018 10:21:54 -0700 Subject: [PATCH 35/78] [ember] TSLint - enable no-empty-interface rule --- types/ember/index.d.ts | 2 ++ types/ember/test/function-ext.ts | 1 + types/ember/test/route.ts | 4 +++- types/ember/test/string-ext.ts | 1 + types/ember/tslint.json | 6 ------ 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index 94ed739323..ad4fb714c0 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -3609,6 +3609,7 @@ declare module '@ember/controller' { // A type registry for Ember `Controller`s. Meant to be declaration-merged // so string lookups resolve to the correct type. + // tslint:disable-next-line:no-empty-interface export interface Registry {} } @@ -3832,6 +3833,7 @@ declare module '@ember/service' { // A type registry for Ember `Service`s. Meant to be declaration-merged so // string lookups resolve to the correct type. + // tslint:disable-next-line:no-empty-interface interface Registry {} } diff --git a/types/ember/test/function-ext.ts b/types/ember/test/function-ext.ts index 37d831d49a..e811539252 100755 --- a/types/ember/test/function-ext.ts +++ b/types/ember/test/function-ext.ts @@ -1,6 +1,7 @@ import Ember from 'ember'; declare global { + // tslint:disable-next-line:no-empty-interface interface Function extends Ember.FunctionPrototypeExtensions {} } diff --git a/types/ember/test/route.ts b/types/ember/test/route.ts index 84e432dbd3..2256ee3561 100755 --- a/types/ember/test/route.ts +++ b/types/ember/test/route.ts @@ -3,7 +3,9 @@ import Object from '@ember/object'; import Array from '@ember/array'; import Ember from 'ember'; // currently needed for Transition -interface Post extends Ember.Object {} +interface Post extends Ember.Object { + title: string; +} interface Posts extends Array {} diff --git a/types/ember/test/string-ext.ts b/types/ember/test/string-ext.ts index e4ac77d5b4..6d625fd670 100644 --- a/types/ember/test/string-ext.ts +++ b/types/ember/test/string-ext.ts @@ -1,6 +1,7 @@ import Ember from 'ember'; declare global { + // tslint:disable-next-line:no-empty-interface interface String extends Ember.StringPrototypeExtensions {} } diff --git a/types/ember/tslint.json b/types/ember/tslint.json index 06f587c95b..fd735346c9 100755 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -11,12 +11,6 @@ "no-declare-current-package": false, "no-self-import": false, - // We use interfaces in a number of places to express things (including - // mixins in particular, but also including extending a global - // interface) which TS currently can't express correctly. - "no-empty-interface": false, - - "no-duplicate-imports": false, "no-unnecessary-qualifier": false, "prefer-const": false, "no-void-expression": false, From be8b27cff9f54e5ddd5e28b218ee6def4be87609 Mon Sep 17 00:00:00 2001 From: Mike North Date: Tue, 18 Sep 2018 10:28:49 -0700 Subject: [PATCH 36/78] [ember] TSLint - enable ban-types and no-misused-new rules --- types/ember/index.d.ts | 32 ++++++++++++++++---------------- types/ember/test/ember-tests.ts | 2 +- types/ember/tslint.json | 4 ---- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index ad4fb714c0..c994c97edd 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -319,7 +319,7 @@ declare module 'ember' { /** * Given a fullName return the corresponding factory. */ - resolveRegistration(fullName: string): Function; + resolveRegistration(fullName: string): (...args: any[]) => any; /** * Registers a factory or value that can be used for dependency injection (with * `inject`) or for service lookup. Each factory is registered with @@ -424,7 +424,7 @@ declare module 'ember' { * @param fullName type:name (e.g., 'model:user') * @param factory (e.g., App.Person) */ - register(fullName: string, factory: Function, options?: {}): void; + register(fullName: string, factory: (...args: any[]) => any, options?: {}): void; /** * This removes all helpers that have been registered, and resets and functions * that were overridden by the helpers. @@ -467,7 +467,7 @@ declare module 'ember' { * Called when the Application has become ready. * The call will be delayed until the DOM has become ready. */ - ready: Function; + ready: (...args: any[]) => any; /** * Application's router. */ @@ -756,7 +756,7 @@ declare module 'ember' { scope?: QueryParamScopeTypes, as?: string }}>; - target: Object; + target: object; } const ControllerMixin: Ember.Mixin; class Controller extends Object.extend(ControllerMixin) {} @@ -989,7 +989,7 @@ declare module 'ember' { * Iterate over each computed property for the class, passing its name and any * associated metadata (see metaForProperty) to the callback. */ - static eachComputedProperty(callback: Function, binding: {}): void; + static eachComputedProperty(callback: (...args: any[]) => any, binding: {}): void; /** * Returns the original hash that was passed to meta(). * @param key property name @@ -1418,7 +1418,7 @@ declare module 'ember' { * for Ember. */ const Instrumentation: { - instrument(name: string, payload: any, callback: Function, binding: any): void; + instrument(name: string, payload: any, callback: (...args: any[]) => any, binding: any): void; reset(): void; subscribe(pattern: string, object: any): void; unsubscribe(subscriber: any): void; @@ -1511,7 +1511,7 @@ declare module 'ember' { class Map { copy(): Map; static create(): Map; - forEach(callback: Function, self: any): void; + forEach(callback: (...args: any[]) => any, self: any): void; get(key: any): any; has(key: any): boolean; set(key: any, value: any): void; @@ -1690,7 +1690,7 @@ declare module 'ember' { /** * The object whose properties will be forwarded. */ - content: Object; + content: object; } /** * This mixin provides properties and property observing functionality, core features of the Ember object model. @@ -1796,7 +1796,7 @@ declare module 'ember' { clear(): void; copy(): OrderedSet; static create(): OrderedSet; - forEach(fn: Function, self: any): void; + forEach(fn: (...args: any[]) => any, self: any): void; has(obj: any): boolean; isEmpty(): boolean; toArray(): any[]; @@ -2227,11 +2227,11 @@ declare module 'ember' { * in as the only argument. */ interface TextSupport extends TargetActionSupport { - cancel(event: Function): void; - focusIn(event: Function): void; - focusOut(event: Function): void; - insertNewLine(event: Function): void; - keyPress(event: Function): void; + cancel(event: (...args: any[]) => any): void; + focusIn(event: (...args: any[]) => any): void; + focusOut(event: (...args: any[]) => any): void; + insertNewLine(event: (...args: any[]) => any): void; + keyPress(event: (...args: any[]) => any): void; action: string; bubbles: boolean; onEvent: string; @@ -2415,7 +2415,7 @@ declare module 'ember' { const String: boolean; } namespace Handlebars { - function compile(string: string): Function; + function compile(string: string): (...args: any[]) => any; function compile(environment: any, options?: any, context?: any, asObject?: any): any; function precompile(string: string, options: any): void; class Compiler {} @@ -3257,7 +3257,7 @@ declare module 'ember' { * Detects when a specific package of Ember (e.g. 'Ember.Application') * has fully loaded and is available for extension. */ - function onLoad(name: string, callback: Function): any; + function onLoad(name: string, callback: (...args: any[]) => any): any; /** * Called when an Ember.js package (e.g Ember.Application) has finished * loading. Triggers any callbacks registered for this event. diff --git a/types/ember/test/ember-tests.ts b/types/ember/test/ember-tests.ts index c78cb282a2..01aaab7452 100755 --- a/types/ember/test/ember-tests.ts +++ b/types/ember/test/ember-tests.ts @@ -136,7 +136,7 @@ people2.isAny('isHappy', 'true'); people2.isAny('isHappy'); // Examples taken from http://emberjs.com/api/classes/Em.RSVP.Promise.html -const promise = new Ember.RSVP.Promise((resolve: Function, reject: Function) => { +const promise = new Ember.RSVP.Promise((resolve: (...args: any[]) => any, reject: (...args: any[]) => any) => { // on success resolve('ok!'); diff --git a/types/ember/tslint.json b/types/ember/tslint.json index fd735346c9..fb499c74f8 100755 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -1,10 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - // Heavy use of Function type in this older package. - "ban-types": false, - "no-misused-new": false, - // these are disabled because of rfc176 module exports "strict-export-declare-modifiers": false, "no-single-declare-module": false, From 8671c9d4c695a0b97015d42e0f1a5f7b249c8b0c Mon Sep 17 00:00:00 2001 From: Mike North Date: Tue, 18 Sep 2018 10:31:58 -0700 Subject: [PATCH 37/78] [ember] TSLint - enable prefer-const rule --- types/ember/test/application.ts | 12 ++++++------ types/ember/test/array-proxy.ts | 2 +- types/ember/test/array.ts | 4 ++-- types/ember/test/computed.ts | 4 ++-- types/ember/test/debug.ts | 2 +- types/ember/test/detect-instance.ts | 2 +- types/ember/test/detect.ts | 2 +- types/ember/test/engine.ts | 12 ++++++------ types/ember/test/event.ts | 8 ++++---- types/ember/test/helper.ts | 4 ++-- types/ember/test/object.ts | 12 ++++++------ types/ember/test/private/computed-tests.ts | 10 +++++----- types/ember/test/reopen.ts | 6 +++--- types/ember/test/run.ts | 20 ++++++++++---------- types/ember/test/test.ts | 2 +- types/ember/test/transition.ts | 2 +- types/ember/test/utils.ts | 2 +- types/ember/tslint.json | 2 -- 18 files changed, 53 insertions(+), 55 deletions(-) diff --git a/types/ember/test/application.ts b/types/ember/test/application.ts index fe4152c01a..414be66660 100755 --- a/types/ember/test/application.ts +++ b/types/ember/test/application.ts @@ -1,7 +1,7 @@ import Ember from 'ember'; import { assertType } from "./lib/assert"; -let BaseApp = Ember.Application.extend({ +const BaseApp = Ember.Application.extend({ modulePrefix: 'my-app' }); @@ -19,14 +19,14 @@ BaseApp.instanceInitializer({ } }); -let App1 = BaseApp.create({ +const App1 = BaseApp.create({ rootElement: '#app-one', customEvents: { paste: 'paste' } }); -let App2 = BaseApp.create({ +const App2 = BaseApp.create({ rootElement: '#app-two', customEvents: { mouseenter: null, @@ -34,8 +34,8 @@ let App2 = BaseApp.create({ } }); -let App3 = BaseApp.create(); +const App3 = BaseApp.create(); -let App3Instance1 = App3.buildInstance(); +const App3Instance1 = App3.buildInstance(); -let App3Instance2 = App3.buildInstance({ foo: 'bar' }); +const App3Instance2 = App3.buildInstance({ foo: 'bar' }); diff --git a/types/ember/test/array-proxy.ts b/types/ember/test/array-proxy.ts index dceea7b847..d3167323ff 100644 --- a/types/ember/test/array-proxy.ts +++ b/types/ember/test/array-proxy.ts @@ -21,6 +21,6 @@ class MyNewProxy extends Ember.ArrayProxy { isNew = true; } -let x = MyNewProxy.create({ content: Ember.A([1, 2, 3]) }) as MyNewProxy; +const x = MyNewProxy.create({ content: Ember.A([1, 2, 3]) }) as MyNewProxy; assertType(x.get('firstObject')); assertType(x.isNew); diff --git a/types/ember/test/array.ts b/types/ember/test/array.ts index 8416a4a9ec..a56e428387 100755 --- a/types/ember/test/array.ts +++ b/types/ember/test/array.ts @@ -42,7 +42,7 @@ const codes: number[] = letters.map((item, index, enumerable) => { return item.charCodeAt(0); }); -let value = '1,2,3'; -let filters = Ember.A(value.split(',')); +const value = '1,2,3'; +const filters = Ember.A(value.split(',')); filters.push('4'); filters.sort(); diff --git a/types/ember/test/computed.ts b/types/ember/test/computed.ts index f93b07a0f5..347e2c61e2 100755 --- a/types/ember/test/computed.ts +++ b/types/ember/test/computed.ts @@ -23,7 +23,7 @@ const Person = Ember.Object.extend({ return this.get('fullName'); }, set(key, value) { - let [first, last] = value.split(' '); + const [first, last] = value.split(' '); this.set('firstName', first); this.set('lastName', last); return value; @@ -38,7 +38,7 @@ const Person = Ember.Object.extend({ fullNameSetOnly: Ember.computed('firstName', 'lastName', { set(key, value) { - let [first, last] = value.split(' '); + const [first, last] = value.split(' '); this.set('firstName', first); this.set('lastName', last); return value; diff --git a/types/ember/test/debug.ts b/types/ember/test/debug.ts index b3f4bb5f17..58d53c41ca 100644 --- a/types/ember/test/debug.ts +++ b/types/ember/test/debug.ts @@ -12,7 +12,7 @@ const { * @ember/debug tests */ runInDebug(); // $ExpectError -let x = runInDebug(() => console.log('Should not show up in prod')); // $ExpectType void +const x = runInDebug(() => console.log('Should not show up in prod')); // $ExpectType void // Log a warning if we have more than 3 tomsters const tomsterCount = 2; diff --git a/types/ember/test/detect-instance.ts b/types/ember/test/detect-instance.ts index 1b25beb244..67b379a113 100755 --- a/types/ember/test/detect-instance.ts +++ b/types/ember/test/detect-instance.ts @@ -9,7 +9,7 @@ class ES6Class extends Ember.Object { bar: string; } -let testObject = null; +const testObject = null; if (ExtendClass.detectInstance(testObject)) { assertType(testObject.foo); diff --git a/types/ember/test/detect.ts b/types/ember/test/detect.ts index cd54880f9f..5b23c10a20 100755 --- a/types/ember/test/detect.ts +++ b/types/ember/test/detect.ts @@ -9,7 +9,7 @@ class ES6Class extends Ember.Object { bar: string; } -let TestClass = Ember.Object; +const TestClass = Ember.Object; if (ExtendClass.detect(TestClass)) { assertType(TestClass.create().foo); diff --git a/types/ember/test/engine.ts b/types/ember/test/engine.ts index 508bd3be4d..49030ea511 100755 --- a/types/ember/test/engine.ts +++ b/types/ember/test/engine.ts @@ -1,7 +1,7 @@ import Ember from 'ember'; import { assertType } from "./lib/assert"; -let BaseEngine = Ember.Engine.extend({ +const BaseEngine = Ember.Engine.extend({ modulePrefix: 'my-engine' }); @@ -19,14 +19,14 @@ BaseEngine.instanceInitializer({ } }); -let Engine1 = BaseEngine.create({ +const Engine1 = BaseEngine.create({ rootElement: '#engine-one', customEvents: { paste: 'paste' } }); -let Engine2 = BaseEngine.create({ +const Engine2 = BaseEngine.create({ rootElement: '#engine-two', customEvents: { mouseenter: null, @@ -34,8 +34,8 @@ let Engine2 = BaseEngine.create({ } }); -let Engine3 = BaseEngine.create(); +const Engine3 = BaseEngine.create(); -let Engine3Instance1 = Engine3.buildInstance(); +const Engine3Instance1 = Engine3.buildInstance(); -let Engine3Instance2 = Engine3.buildInstance({ foo: 'bar' }); +const Engine3Instance2 = Engine3.buildInstance({ foo: 'bar' }); diff --git a/types/ember/test/event.ts b/types/ember/test/event.ts index c934072440..c6d95324f1 100755 --- a/types/ember/test/event.ts +++ b/types/ember/test/event.ts @@ -1,25 +1,25 @@ import Ember from 'ember'; function testOn() { - let Job = Ember.Object.extend({ + const Job = Ember.Object.extend({ logCompleted: Ember.on('completed', function() { console.log('Job completed!'); }) }); - let job = Job.create(); + const job = Job.create(); Ember.sendEvent(job, 'completed'); // Logs 'Job completed!' } function testEvented() { - let Person = Ember.Object.extend(Ember.Evented, { + const Person = Ember.Object.extend(Ember.Evented, { greet() { this.trigger('greet'); } }); - let person = Person.create(); + const person = Person.create(); person.on('greet', function() { console.log('Our person has greeted'); diff --git a/types/ember/test/helper.ts b/types/ember/test/helper.ts index 2aa79a5ba1..dcad36489a 100755 --- a/types/ember/test/helper.ts +++ b/types/ember/test/helper.ts @@ -1,8 +1,8 @@ import Ember from 'ember'; const FormatCurrencyHelper = Ember.Helper.helper(function(params, hash: { currency: string }) { - let cents = params[0]; - let currency = hash.currency; + const cents = params[0]; + const currency = hash.currency; return `${currency}${cents * 0.01}`; }); diff --git a/types/ember/test/object.ts b/types/ember/test/object.ts index 4547bd40af..060bf8ca81 100755 --- a/types/ember/test/object.ts +++ b/types/ember/test/object.ts @@ -34,8 +34,8 @@ class Foo extends Ember.Object.extend({ }) { b = 5; baz() { - let y = this.b; // $ExpectType number - let z = this.a; // $ExpectType ComputedProperty + const y = this.b; // $ExpectType number + const z = this.a; // $ExpectType ComputedProperty this.b = 10; this.get('b').toFixed(4); // $ExpectType string this.set('a', 'abc').split(','); // $ExpectType string[] @@ -54,10 +54,10 @@ export class Foo2 extends Ember.Object { name!: string; changeName(name: string) { - let a: string = this.set('name', name); - let b: number = this.set('name', name); // $ExpectError - let x: string = Ember.set(this, 'name', name); - let y: number = Ember.set(this, 'name', name); // $ExpectError + const a: string = this.set('name', name); + const b: number = this.set('name', name); // $ExpectError + const x: string = Ember.set(this, 'name', name); + const y: number = Ember.set(this, 'name', name); // $ExpectError this.setProperties({ name }); diff --git a/types/ember/test/private/computed-tests.ts b/types/ember/test/private/computed-tests.ts index a4c3e819f6..496881c612 100644 --- a/types/ember/test/private/computed-tests.ts +++ b/types/ember/test/private/computed-tests.ts @@ -18,13 +18,13 @@ class Example1 extends Ember.Object.extend({ fullName!: ComputedProperty; } -let unwrappedGetters1: UnwrapComputedPropertyGetters = {} as any; +const unwrappedGetters1: UnwrapComputedPropertyGetters = {} as any; unwrappedGetters1.firstName; // $ExpectType string unwrappedGetters1.lastName; // $ExpectType string unwrappedGetters1.fullName; // $ExpectType string unwrappedGetters1.allNames; // $ExpectType string[] -let unwrappedSetters1: UnwrapComputedPropertySetters = {} as any; +const unwrappedSetters1: UnwrapComputedPropertySetters = {} as any; unwrappedSetters1.firstName; // $ExpectType string unwrappedSetters1.lastName; // $ExpectType string unwrappedSetters1.fullName; // $ExpectType string @@ -52,15 +52,15 @@ class Example2 extends Ember.Object.extend({ this.get('lastName').split(','); // $ExpectType string[] } } -let ex2 = new Example2(); +const ex2 = new Example2(); -let unwrappedGetters2: UnwrapComputedPropertyGetters = (ex2 as any) as UnwrapComputedPropertyGetters; +const unwrappedGetters2: UnwrapComputedPropertyGetters = (ex2 as any) as UnwrapComputedPropertyGetters; assertType(unwrappedGetters2.firstName); // $ExpectType string assertType(unwrappedGetters2.lastName); // $ExpectType string assertType(unwrappedGetters2.fullName); // $ExpectType string assertType(unwrappedGetters2.allNames); // $ExpectType string[] -let unwrappedSetters2: UnwrapComputedPropertySetters = null as any; +const unwrappedSetters2: UnwrapComputedPropertySetters = null as any; assertType(unwrappedSetters2.firstName); // $ExpectType string assertType(unwrappedSetters2.lastName); // $ExpectType string assertType(unwrappedSetters2.fullName); // $ExpectType string diff --git a/types/ember/test/reopen.ts b/types/ember/test/reopen.ts index ee5ee04edc..13b149d460 100755 --- a/types/ember/test/reopen.ts +++ b/types/ember/test/reopen.ts @@ -26,13 +26,13 @@ assertType(Person2.create().name); assertType(Person2.create().sayHello()); assertType(Person2.species); -let tom = Person2.create({ +const tom = Person2.create({ name: 'Tom Dale' }); -let badTom = Person2.create({ name: 99 }); // $ExpectError +const badTom = Person2.create({ name: 99 }); // $ExpectError -let yehuda = Person2.createPerson('Yehuda Katz'); +const yehuda = Person2.createPerson('Yehuda Katz'); tom.sayHello(); // "Hello. My name is Tom Dale" yehuda.sayHello(); // "Hello. My name is Yehuda Katz" diff --git a/types/ember/test/run.ts b/types/ember/test/run.ts index 8d1c82e6e3..7e11c0263a 100755 --- a/types/ember/test/run.ts +++ b/types/ember/test/run.ts @@ -6,7 +6,7 @@ import { assertType } from "./lib/assert"; assertType(Ember.run.queues); function testRun() { - let r = run(function() { + const r = run(function() { // code to be executed within a RunLoop return 123; }); @@ -38,43 +38,43 @@ function testBind() { function testCancel() { const myContext = {}; - let runNext = run.next(myContext, function() { + const runNext = run.next(myContext, function() { // will not be executed }); run.cancel(runNext); - let runLater = run.later(myContext, function() { + const runLater = run.later(myContext, function() { // will not be executed }, 500); run.cancel(runLater); - let runScheduleOnce = run.scheduleOnce('afterRender', myContext, function() { + const runScheduleOnce = run.scheduleOnce('afterRender', myContext, function() { // will not be executed }); run.cancel(runScheduleOnce); - let runOnce = run.once(myContext, function() { + const runOnce = run.once(myContext, function() { // will not be executed }); run.cancel(runOnce); - let throttle = run.throttle(myContext, function() { + const throttle = run.throttle(myContext, function() { // will not be executed }, 1, false); run.cancel(throttle); - let debounce = run.debounce(myContext, function() { + const debounce = run.debounce(myContext, function() { // will not be executed }, 1); run.cancel(debounce); - let debounceImmediate = run.debounce(myContext, function() { + const debounceImmediate = run.debounce(myContext, function() { // will be executed since we passed in true (immediate) }, 100, true); @@ -86,7 +86,7 @@ function testDebounce() { function runIt() { } - let myContext = { name: 'debounce' }; + const myContext = { name: 'debounce' }; run.debounce(runIt, 150); run.debounce(myContext, runIt, 150); @@ -197,7 +197,7 @@ function testThrottle() { function runIt() { } - let myContext = { name: 'throttle' }; + const myContext = { name: 'throttle' }; run.throttle(runIt, 150); run.throttle(myContext, runIt, 150); diff --git a/types/ember/test/test.ts b/types/ember/test/test.ts index 6cd1b2b908..41ea843dd6 100755 --- a/types/ember/test/test.ts +++ b/types/ember/test/test.ts @@ -1,6 +1,6 @@ import Ember from 'ember'; -let pending = 0; +const pending = 0; Ember.Test.registerWaiter(() => pending !== 0); declare const MyDb: { diff --git a/types/ember/test/transition.ts b/types/ember/test/transition.ts index 3a64675c24..47d171e250 100755 --- a/types/ember/test/transition.ts +++ b/types/ember/test/transition.ts @@ -15,7 +15,7 @@ Ember.Controller.extend({ actions: { login() { // Log the user in, then reattempt previous transition if it exists. - let previousTransition = this.get('previousTransition'); + const previousTransition = this.get('previousTransition'); if (previousTransition) { this.set('previousTransition', null); previousTransition.retry(); diff --git a/types/ember/test/utils.ts b/types/ember/test/utils.ts index f9b1f198d2..d0f8ac0282 100755 --- a/types/ember/test/utils.ts +++ b/types/ember/test/utils.ts @@ -67,7 +67,7 @@ function testDeprecateFunc() { return ''; } - let oldMethod = Ember.deprecateFunc('Please use the new method', { id: 'deprecated.id', until: '6.0' }, newMethod); + const oldMethod = Ember.deprecateFunc('Please use the new method', { id: 'deprecated.id', until: '6.0' }, newMethod); assertType(newMethod('first', 123)); assertType(oldMethod('first', 123)); } diff --git a/types/ember/tslint.json b/types/ember/tslint.json index fb499c74f8..7629acc439 100755 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -8,10 +8,8 @@ "no-self-import": false, "no-unnecessary-qualifier": false, - "prefer-const": false, "no-void-expression": false, "only-arrow-functions": false, - "no-submodule-imports": false, // false positives "unified-signatures": false From 56c434309f9e06f54f9ff4f0befc405d450a552a Mon Sep 17 00:00:00 2001 From: Mike North Date: Tue, 18 Sep 2018 10:37:09 -0700 Subject: [PATCH 38/78] [ember] TSLint - enable no-void-expression rule --- types/ember/test/debug.ts | 2 +- types/ember/test/reopen.ts | 4 ++-- types/ember/test/utils.ts | 10 +++++----- types/ember/tslint.json | 1 - 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/types/ember/test/debug.ts b/types/ember/test/debug.ts index 58d53c41ca..e71beba975 100644 --- a/types/ember/test/debug.ts +++ b/types/ember/test/debug.ts @@ -12,7 +12,7 @@ const { * @ember/debug tests */ runInDebug(); // $ExpectError -const x = runInDebug(() => console.log('Should not show up in prod')); // $ExpectType void +runInDebug(() => console.log('Should not show up in prod')); // $ExpectType void // Log a warning if we have more than 3 tomsters const tomsterCount = 2; diff --git a/types/ember/test/reopen.ts b/types/ember/test/reopen.ts index 13b149d460..c62789c944 100755 --- a/types/ember/test/reopen.ts +++ b/types/ember/test/reopen.ts @@ -12,7 +12,7 @@ const Person = Ember.Object.extend({ assertType(Person.reopen()); assertType(Person.create().name); -assertType(Person.create().sayHello()); +Person.create().sayHello(); // $ExpectType void const Person2 = Person.reopenClass({ species: 'Homo sapiens', @@ -23,7 +23,7 @@ const Person2 = Person.reopenClass({ }); assertType(Person2.create().name); -assertType(Person2.create().sayHello()); +Person2.create().sayHello(); // $ExpectType void assertType(Person2.species); const tom = Person2.create({ diff --git a/types/ember/test/utils.ts b/types/ember/test/utils.ts index d0f8ac0282..7e9b275f42 100755 --- a/types/ember/test/utils.ts +++ b/types/ember/test/utils.ts @@ -120,7 +120,7 @@ function testTryInvoke() { Ember.tryInvoke(new Foo(), 'add', ['4', 3]); // $ExpectType undefined } -(function() { +(() => { /** typeOf */ // TODO: more specific return type in @types/ember https://github.com/typed-ember/ember-cli-typescript/issues/259 Ember.typeOf(); // $ExpectType "undefined" @@ -146,7 +146,7 @@ function testTryInvoke() { Ember.typeOf((new Date()) as RegExp | Date); // "regexp" | "date" })(); -(function() { /* assign */ +(() => { /* assign */ Ember.assign({}, { a: 'b'}); Ember.assign({}, { a: 'b'}).a; // $ExpectType string Ember.assign({ a: 6 }, { a: 'b'}).a; // $ExpectType string @@ -157,12 +157,12 @@ function testTryInvoke() { Ember.assign({ a: 'hello' }, { b: 6 }, { a: true }).a; // $ExpectType boolean Ember.assign({ a: 'hello' }, '', { a: true }).a; // $ExpectError Ember.assign({ d: ['gobias industries'] }, { a: 'hello' }, { b: 6 }, { a: true }).d; // $ExpectType string[] -}()); +})(); -(function() { /* merge */ +(() => { /* merge */ Ember.merge({}, { a: 'b'}); Ember.merge({}, { a: 'b'}).a; // $ExpectType string Ember.merge({ a: 6 }, { a: 'b'}).a; // $ExpectType string Ember.merge({ a: 6 }, {}).a; // $ExpectType number Ember.merge({ b: 6 }, {}).a; // $ExpectError -}()); +})(); diff --git a/types/ember/tslint.json b/types/ember/tslint.json index 7629acc439..32ed17f322 100755 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -8,7 +8,6 @@ "no-self-import": false, "no-unnecessary-qualifier": false, - "no-void-expression": false, "only-arrow-functions": false, // false positives From e93e4972f1938a5d53818f0c0026943fade5abdb Mon Sep 17 00:00:00 2001 From: Mike North Date: Tue, 18 Sep 2018 10:49:30 -0700 Subject: [PATCH 39/78] [ember] TSLint - enable only-arrow-functions rule --- types/ember/test/application-instance.ts | 4 +-- types/ember/test/engine-instance.ts | 4 +-- types/ember/test/event.ts | 12 ++++---- types/ember/test/function-ext.ts | 3 ++ types/ember/test/helper.ts | 2 +- types/ember/test/run.ts | 38 ++++++++++++------------ types/ember/test/test.ts | 6 ++-- types/ember/test/utils.ts | 3 +- types/ember/tslint.json | 1 - 9 files changed, 37 insertions(+), 36 deletions(-) diff --git a/types/ember/test/application-instance.ts b/types/ember/test/application-instance.ts index 9ae22e5f26..4ee5cb2027 100644 --- a/types/ember/test/application-instance.ts +++ b/types/ember/test/application-instance.ts @@ -24,6 +24,6 @@ appInstance.lookup('route:basic'); appInstance.boot(); -(async function() { +(async () => { await appInstance.boot(); -}()); +})(); diff --git a/types/ember/test/engine-instance.ts b/types/ember/test/engine-instance.ts index c74914dea5..6358377639 100644 --- a/types/ember/test/engine-instance.ts +++ b/types/ember/test/engine-instance.ts @@ -21,6 +21,6 @@ engineInstance.lookup('route:basic'); engineInstance.boot(); -(async function() { +(async () => { await engineInstance.boot(); -}()); +})(); diff --git a/types/ember/test/event.ts b/types/ember/test/event.ts index c6d95324f1..97e68c52c8 100755 --- a/types/ember/test/event.ts +++ b/types/ember/test/event.ts @@ -2,7 +2,7 @@ import Ember from 'ember'; function testOn() { const Job = Ember.Object.extend({ - logCompleted: Ember.on('completed', function() { + logCompleted: Ember.on('completed', () => { console.log('Job completed!'); }) }); @@ -21,22 +21,22 @@ function testEvented() { const person = Person.create(); - person.on('greet', function() { + person.on('greet', () => { console.log('Our person has greeted'); }); - person.on('greet', function() { + person.on('greet', () => { console.log('Our person has greeted'); - }).one('greet', function() { + }).one('greet', () => { console.log('Offer one-time special'); - }).off('event', {}, function() {}); + }).off('event', {}, () => {}); person.greet(); } function testObserver() { Ember.Object.extend({ - valueObserver: Ember.observer('value', function() { + valueObserver: Ember.observer('value', () => { // Executes whenever the "value" property changes }) }); diff --git a/types/ember/test/function-ext.ts b/types/ember/test/function-ext.ts index e811539252..77fd35c5d2 100755 --- a/types/ember/test/function-ext.ts +++ b/types/ember/test/function-ext.ts @@ -8,6 +8,7 @@ declare global { Ember.Object.extend({ foo: '', + // tslint:disable-next-line:only-arrow-functions arr: function() { return []; }.property(), @@ -16,7 +17,9 @@ Ember.Object.extend({ return this.get('foo'); }.property('foo', 'bar.@each.baz'), + // tslint:disable-next-line:only-arrow-functions observer: function() {}.observes('foo', 'bar'), + // tslint:disable-next-line:only-arrow-functions on: function() {}.on('foo', 'bar'), }); diff --git a/types/ember/test/helper.ts b/types/ember/test/helper.ts index dcad36489a..4743841e31 100755 --- a/types/ember/test/helper.ts +++ b/types/ember/test/helper.ts @@ -1,6 +1,6 @@ import Ember from 'ember'; -const FormatCurrencyHelper = Ember.Helper.helper(function(params, hash: { currency: string }) { +const FormatCurrencyHelper = Ember.Helper.helper((params, hash: { currency: string }) => { const cents = params[0]; const currency = hash.currency; return `${currency}${cents * 0.01}`; diff --git a/types/ember/test/run.ts b/types/ember/test/run.ts index 7e11c0263a..596ad5eb07 100755 --- a/types/ember/test/run.ts +++ b/types/ember/test/run.ts @@ -6,7 +6,7 @@ import { assertType } from "./lib/assert"; assertType(Ember.run.queues); function testRun() { - const r = run(function() { + const r = run(() => { // code to be executed within a RunLoop return 123; }); @@ -38,43 +38,43 @@ function testBind() { function testCancel() { const myContext = {}; - const runNext = run.next(myContext, function() { + const runNext = run.next(myContext, () => { // will not be executed }); run.cancel(runNext); - const runLater = run.later(myContext, function() { + const runLater = run.later(myContext, () => { // will not be executed }, 500); run.cancel(runLater); - const runScheduleOnce = run.scheduleOnce('afterRender', myContext, function() { + const runScheduleOnce = run.scheduleOnce('afterRender', myContext, () => { // will not be executed }); run.cancel(runScheduleOnce); - const runOnce = run.once(myContext, function() { + const runOnce = run.once(myContext, () => { // will not be executed }); run.cancel(runOnce); - const throttle = run.throttle(myContext, function() { + const throttle = run.throttle(myContext, () => { // will not be executed }, 1, false); run.cancel(throttle); - const debounce = run.debounce(myContext, function() { + const debounce = run.debounce(myContext, () => { // will not be executed }, 1); run.cancel(debounce); - const debounceImmediate = run.debounce(myContext, function() { + const debounceImmediate = run.debounce(myContext, () => { // will be executed since we passed in true (immediate) }, 100, true); @@ -112,20 +112,20 @@ function testBegin() { } function testJoin() { - run.join(function() { + run.join(() => { // creates a new run-loop }); - run(function() { + run(() => { // creates a new run-loop - run.join(function() { + run.join(() => { // joins with the existing run-loop, and queues for invocation on // the existing run-loops action queue. }); }); - new RSVP.Promise(function(resolve) { - Ember.run.later(function() { + new RSVP.Promise((resolve) => { + Ember.run.later(() => { resolve({ msg: 'Hold Your Horses' }); }, 3000); }); @@ -133,14 +133,14 @@ function testJoin() { function testLater() { const myContext = {}; - run.later(myContext, function() { + run.later(myContext, () => { // code here will execute within a RunLoop in about 500ms with this == myContext }, 500); } function testNext() { const myContext = {}; - run.next(myContext, function() { + run.next(myContext, () => { // code to be executed in the next run loop, // which will be scheduled after the current one }); @@ -160,12 +160,12 @@ function testOnce() { function testSchedule() { Ember.Component.extend({ init() { - run.schedule('sync', this, function() { + run.schedule('sync', this, () => { // this will be executed in the first RunLoop queue, when bindings are synced console.log('scheduled on sync queue'); }); - run.schedule('actions', this, function() { + run.schedule('actions', this, () => { // this will be executed in the 'actions' queue, after bindings have synced. console.log('scheduled on actions queue'); }); @@ -183,12 +183,12 @@ function testScheduleOnce() { } const myContext = {}; - run(function() { + run(() => { run.scheduleOnce('afterRender', myContext, sayHi); run.scheduleOnce('afterRender', myContext, sayHi); // sayHi will only be executed once, in the afterRender queue of the RunLoop }); - run.scheduleOnce('actions', myContext, function() { + run.scheduleOnce('actions', myContext, () => { console.log('Closure'); }); } diff --git a/types/ember/test/test.ts b/types/ember/test/test.ts index 41ea843dd6..a0decd2699 100755 --- a/types/ember/test/test.ts +++ b/types/ember/test/test.ts @@ -8,15 +8,15 @@ declare const MyDb: { }; Ember.Test.registerWaiter(MyDb, MyDb.hasPendingTransactions); -Ember.Test.promise(function(resolve) { +Ember.Test.promise((resolve) => { window.setTimeout(resolve, 500); }); -Ember.Test.registerHelper('boot', function(app) { +Ember.Test.registerHelper('boot', (app) => { Ember.run(app, app.advanceReadiness); }); -Ember.Test.registerAsyncHelper('boot', function(app) { +Ember.Test.registerAsyncHelper('boot', (app) => { Ember.run(app, app.advanceReadiness); }); diff --git a/types/ember/test/utils.ts b/types/ember/test/utils.ts index 7e9b275f42..e92bb3d5fc 100755 --- a/types/ember/test/utils.ts +++ b/types/ember/test/utils.ts @@ -54,7 +54,7 @@ function testAssign() { } function testOnError() { - Ember.onerror = function(error) { + Ember.onerror = (error) => { Ember.$.post('/report-error', { stack: error.stack, otherInformation: 'whatever app state you want to provide' @@ -122,7 +122,6 @@ function testTryInvoke() { (() => { /** typeOf */ - // TODO: more specific return type in @types/ember https://github.com/typed-ember/ember-cli-typescript/issues/259 Ember.typeOf(); // $ExpectType "undefined" Ember.typeOf(null); // $ExpectType "null" Ember.typeOf(undefined); // $ExpectType "undefined" diff --git a/types/ember/tslint.json b/types/ember/tslint.json index 32ed17f322..84d5b4686d 100755 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -8,7 +8,6 @@ "no-self-import": false, "no-unnecessary-qualifier": false, - "only-arrow-functions": false, // false positives "unified-signatures": false From 18ef99e96fc9745e876a563bd3f33739094cf6e1 Mon Sep 17 00:00:00 2001 From: Mike North Date: Tue, 18 Sep 2018 10:50:18 -0700 Subject: [PATCH 40/78] [ember] TSLint - enable no-single-declare-module rule --- types/ember/tslint.json | 1 - 1 file changed, 1 deletion(-) diff --git a/types/ember/tslint.json b/types/ember/tslint.json index 84d5b4686d..fa8da19714 100755 --- a/types/ember/tslint.json +++ b/types/ember/tslint.json @@ -3,7 +3,6 @@ "rules": { // these are disabled because of rfc176 module exports "strict-export-declare-modifiers": false, - "no-single-declare-module": false, "no-declare-current-package": false, "no-self-import": false, From 7b2730a7d30ed4ceb88a56a57ee182d07d658b21 Mon Sep 17 00:00:00 2001 From: Mike North Date: Tue, 18 Sep 2018 12:05:42 -0700 Subject: [PATCH 41/78] [ember] allow anything to be registered to the container --- types/ember/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index c994c97edd..35b7349bad 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -424,7 +424,7 @@ declare module 'ember' { * @param fullName type:name (e.g., 'model:user') * @param factory (e.g., App.Person) */ - register(fullName: string, factory: (...args: any[]) => any, options?: {}): void; + register(fullName: string, factory: any): void; /** * This removes all helpers that have been registered, and resets and functions * that were overridden by the helpers. From 658a0d362fc06767d8574463419b983b8b52c0ca Mon Sep 17 00:00:00 2001 From: tjh Date: Tue, 18 Sep 2018 14:59:25 -0700 Subject: [PATCH 42/78] Fix responsive section (should be singleton not array) --- types/highcharts/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index a71e07c925..7ad9f1a439 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -6167,7 +6167,7 @@ declare namespace Highcharts { * Allows setting a set of rules to apply for different screen or chart sizes. Each rule specifies additional chart options. * @since 5.0.0 */ - responsive?: ResponsiveOptions[]; + responsive?: ResponsiveOptions; /** * The actual series to append to the chart. In addition to the members listed below, any member of the plotOptions * for that specific type of plot can be added to a series individually. For example, even though a general From f6e09715b08987b73ec26b8da1140969eb2e441e Mon Sep 17 00:00:00 2001 From: tjh Date: Tue, 18 Sep 2018 15:38:34 -0700 Subject: [PATCH 43/78] Make this.axis.defaultLabelFormatter accessible from Axis formatter --- types/highcharts/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 7ad9f1a439..5546dd29e9 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -59,6 +59,8 @@ declare namespace Highcharts { value: any; isFirst: number; isLast: number; + chart: ChartObject; + axis: AxisObject; } interface AxisLabels { @@ -103,7 +105,8 @@ declare namespace Highcharts { format?: string; /** * Callback JavaScript function to format the label. The value is given by this.value. Additional properties for - * this are axis, chart, isFirst and isLast. + * this are axis, chart, isFirst and isLast. The value of the default label formatter can be retrieved by calling + * this.axis.defaultLabelFormatter.call(this) within the function. * @default function() {return this.value;} */ formatter?(this: AxisLabelFormatterOptions): string; @@ -6248,6 +6251,7 @@ declare namespace Highcharts { * @since 1.2.0 */ addPlotLine(options: PlotLines): void; + defaultLabelFormatter(this: AxisLabelFormatterOptions): string; /** * Get the current extremes for the axis. * @since 1.2.0 From 5da5029bf8480ff0412121f30d18d8c3f9c97955 Mon Sep 17 00:00:00 2001 From: tjh Date: Tue, 18 Sep 2018 15:45:25 -0700 Subject: [PATCH 44/78] Add various AxisObject fields --- types/highcharts/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 5546dd29e9..0ced2b5b3d 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -6239,6 +6239,13 @@ declare namespace Highcharts { * Configuration options for the axes are given in options.xAxis and options.yAxis. */ interface AxisObject { + dataMin: number; + dataMax: number; + userMin: number; + userMax: number; + bottom: number; + left: number; + width: number; /** * Add a plot band after render time. * @param options A configuration object consisting of the same members as options.xAxis.plotBands From d2ab76ec4237cfccb337982060de4c168b9e2036 Mon Sep 17 00:00:00 2001 From: tjh Date: Tue, 18 Sep 2018 15:48:43 -0700 Subject: [PATCH 45/78] Add tooltip "outside" option --- types/highcharts/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 0ced2b5b3d..f0835d2dac 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -5926,6 +5926,16 @@ declare namespace Highcharts { * The y value. */ formatter?(): boolean | string; + /** + * Whether to allow the tooltip to render outside the chart's SVG element box. + * By default (false), the tooltip is rendered within the chart's SVG element, which results in + * the tooltip being aligned inside the chart area. For small charts, this may result in + * clipping or overlapping. When true, a separate SVG element is created and overlaid on the + * page, allowing the tooltip to be aligned inside the page itself. + * @default false + * @since 6.1.1 + */ + outside?: boolean; /** * Padding inside the tooltip, in pixels. * @since 5.0.0 From f2065466d2d7621939ccd58dd46a83281d622735 Mon Sep 17 00:00:00 2001 From: tjh Date: Tue, 18 Sep 2018 16:11:55 -0700 Subject: [PATCH 46/78] Add Annotations options --- types/highcharts/index.d.ts | 314 ++++++++++++++++++++++++++++++++++++ 1 file changed, 314 insertions(+) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index f0835d2dac..f8854eeb97 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -379,6 +379,316 @@ declare namespace Highcharts { zIndex?: number; } + export interface AnnotationsPoint { + /** + * The x position of the point. Units can be either in axis or chart pixel coordinates. + * @default undefined + * @since 6.0.0 + */ + x?: number; + /** + * This number defines which xAxis the point is connected to. + * It refers to either the axis id or the index of the axis in the xAxis array. + * If the option is not configured or the axis is not found the point's x coordinate refers to the chart pixels. + * @default undefined + * @since 6.0.0 + */ + xAxis?: number | string; + /** + * The y position of the point. Units can be either in axis or chart pixel coordinates. + * @default undefined + * @since 6.0.0 + */ + y?: number; + /** + * This number defines which yAxis the point is connected to. + * It refers to either the axis id or the index of the axis in the yAxis array. + * If the option is not configured or the axis is not found the point's y coordinate refers to the chart pixels. + * @default undefined + * @since 6.0.0 + */ + yAxis?: number; + } + + export interface AnnotationsLabelOptions { + /** + * The alignment of the annotation's label. If right, the right side of the label should be touching the point. + * @default "center" + * @since 6.0.0 + */ + align?: "left" | "center" | "right"; + /** + * The alignment of the annotation's label. If right, the right side of the label should be touching the point. + * @default false + * @since 6.0.0 + */ + allowOverlap?: boolean; + /** + * The background color or gradient for the annotation's label. + * @default rgba(0, 0, 0, 0.75) + * @since 6.0.0 + */ + backgroundColor?: string | Highcharts.Gradient; + /** + * The border color for the annotation's label. + * @default "black" + * @since 6.0.0 + */ + borderColor?: string | Highcharts.Gradient; + /** + * The border radius in pixels for the annotation's label. + * @default 1 + * @since 6.0.0 + */ + borderRadius?: number; + /** + * The border width in pixels for the annotation's label. + * @default 1 + * @since 6.0.0 + */ + borderWidth?: number; + /** + * Whether to hide the annotation's label that is outside the plot area. + * @default false + * @since 6.0.0 + */ + crop?: boolean; + /** + * The label's pixel distance from the point. + * @default undefined + * @since 6.0.0 + */ + distance?: number; + /** + * A format string for the data label. + * @default undefined + * @since 6.0.0 + */ + format?: string; + /** + * Callback JavaScript function to format the annotation's label. + * Note that if a format or text are defined, the format or text take precedence and the formatter is ignored. + * This refers to a point object. + * @default function () { return defined(this.y) ? this.y : 'Annotation label'; } + * @since 6.0.0 + */ + formatter?: Function; + /** + * How to handle the annotation's label that flow outside the plot area. + * The justify option aligns the label inside the plot area. + * @default "justify + * @since 6.0.0 + */ + overflow?: "justify" | "none"; + /** + * When either the borderWidth or the backgroundColor is set, this is the padding within the box. + * @default 5 + * @since 6.0.0 + */ + padding?: number; + /** + * The shadow of the box. The shadow can be an object configuration containing color, offsetX, offsetY, opacity and width. + * @default false + * @since 6.0.0 + */ + shadow?: + | boolean + | { + color?: string | Highcharts.Gradient; + offsetX?: number; + offsetY?: number; + opacity?: number; + width?: number; + }; + /** + * The name of a symbol to use for the border around the label. Symbols are predefined functions on the Renderer object. + * @default "callout" + * @since 6.0.0 + */ + shape?: "connector" | "rect" | "circle" | "diamond" | "triangle"; + /** + * Styles for the annotation's label. + * @default "callout" + * @since 6.0.0 + */ + style?: { + /** + * @default "contrast" + * @since 6.0.0 + */ + color?: string; + fontFamily?: string; + /** + * @default "11px" + * @since 6.0.0 + */ + fontSize?: string; + /** + * @default "normal" + * @since 6.0.0 + */ + fontWeight?: string; + textAlign?: string; + }; + /** + * Alias for the format option. + * @default undefined + * @since 6.0.0 + */ + text?: string; + /** + * Whether to use HTML to render the annotation's label. + * @default false + * @since 6.0.0 + */ + useHTML?: boolean; + /** + * The vertical alignment of the annotation's label. + * @default "bottom" + * @since 6.0.0 + */ + verticalAlign?: "bottom" | "middle" | "top"; + /** + * The x position offset of the label relative to the point. + * Note that if a distance is defined, the distance takes precedence over x and y options. + * @default 0 + * @since 6.0.0 + */ + x?: number; + /** + * The y position offset of the label relative to the point. + * Note that if a distance is defined, the distance takes precedence over x and y options. + * @default -16 + * @since 6.0.0 + */ + y?: number; + } + + export interface AnnotationsLabel extends AnnotationsLabelOptions { + /** + * This option defines the point to which the label will be connected. + * It can be either the point which exists in the series - it is referenced by the point's id + * - or a new point with defined x, y properties and optionally axes. + * @since 6.0.0 + */ + point?: string | AnnotationsPoint; + } + + export interface AnnotationsShapeOptions { + /** + * The color of the shape's fill. + * @default rgba(0, 0, 0, 0.75) + * @since 6.0.0 + */ + fill: string; + /** + * The height of the shape. + * @default undefined + * @since 6.0.0 + */ + height: number; + /** + * The radius of the shape. + * @default 0 + * @since 6.0.0 + */ + r: number; + /** + * The color of the shape's stroke. + * @default rgba(0, 0, 0, 0.75) + * @since 6.0.0 + */ + stroke: string; + /** + * The pixel stroke width of the shape. + * @default 1 + * @since 6.0.0 + */ + strokeWidth: number; + /** + * The type of the shape, e.g. circle or rectangle. + * @default "rect" + * @since 6.0.0 + */ + type: "circle" | "path" | "rect"; + /** + * The width of the shape. + * @default undefined + * @since 6.0.0 + */ + width: number; + } + + export interface AnnotationsShape extends AnnotationsShapeOptions { + /** + * Id of the marker which will be drawn at the final vertex of the path. Custom markers can be defined in defs property. + * @default undefined + * @since 6.0.0 + */ + markerEnd: string; + /** + * Id of the marker which will be drawn at the final vertex of the path. Custom markers can be defined in defs property. + * @default undefined + * @since 6.0.0 + */ + markerStart: string; + /** + * This option defines the point to which the shape will be connected. + * It can be either the point which exists in the series - it is referenced by the point's id + * - or a new point with defined x, y properties and optionally axes. + * @since 6.0.0 + */ + point?: string | AnnotationsPoint; + /** + * An array of points for the shape. This option is available for shapes which can use multiple points such as path. + * A point can be either a point object or a point's id. + * @default undefined + * @since 6.0.0 + */ + points?: (string | AnnotationsPoint)[]; + } + + /** + * Options for configuring annotations, for example labels, arrows or shapes. Annotations can be tied to points, + * axis coordinates or chart pixel coordinates. + */ + export interface AnnotationsOptions { + /** + * Options for annotation's labels. Each label inherits options from the labelOptions object. + * An option from the labelOptions can be overwritten by config for a specific label. + * @since 6.0.0 + */ + labelOptions?: AnnotationsLabelOptions; + /** + * An array of labels for the annotation. For options that apply to multiple labels, they can be added to the labelOptions. + * @since 6.0.0 + */ + labels?: AnnotationsLabel[]; + /** + * Options for annotation's shapes. Each shape inherits options from the shapeOptions object. + * An option from the shapeOptions can be overwritten by config for a specific shape. + * @since 6.0.0 + */ + shapeOptions?: AnnotationsShapeOptions; + /** + * An array of shapes for the annotation. For options that apply to multiple shapes, they can be added to the shapeOptions. + * @since 6.0.0 + */ + shapes?: AnnotationsShape[]; + /** + * Whether the annotation is visible. + * @default true + * @since 6.0.0 + */ + visible?: boolean; + /** + * The Z index of the annotation. + * @default 6 + * @since 6.0.0 + */ + zIndex?: number; + } + /** * Options for configuring accessibility for the chart. Requires the accessibility module to be loaded. * For a description of the module and information on its features, see Highcharts Accessibility. @@ -6092,6 +6402,10 @@ declare namespace Highcharts { * @since 5.0.0 */ accessibility?: AccessibilityOptions; + /** + * Options for configuring annotations, for example labels, arrows or shapes. + */ + annotations?: AnnotationsOptions; /** * Options regarding the chart area and plot area as well as general chart options. */ From 900b55c595c8865c69d795259a117547f29b2122 Mon Sep 17 00:00:00 2001 From: tjh Date: Tue, 18 Sep 2018 16:13:52 -0700 Subject: [PATCH 47/78] Add DataPoint description field --- types/highcharts/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index f8854eeb97..f27d3db040 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -5870,6 +5870,12 @@ declare namespace Highcharts { * Individual data label for each point. The options are the same as the ones for plotOptions.series.dataLabels */ dataLabels?: DataLabels; + /** + * A description of the point to add to the screen reader information about the point. + * @default undefined + * @since 5.0.0 + */ + description?: string; /** * The id of a series in the drilldown.series array to use for a drilldown for this point. * @since 3.0.8 From cad369b391d2d1cd21586a9f70ab90dff88116c9 Mon Sep 17 00:00:00 2001 From: tjh Date: Tue, 18 Sep 2018 16:20:33 -0700 Subject: [PATCH 48/78] Add various ChartObject fields --- types/highcharts/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index f27d3db040..ad2d401cad 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -6711,6 +6711,8 @@ declare namespace Highcharts { * @since 3.0.8 */ addSeriesAsDrilldown(point: PointObject, seriesOptions: IndividualSeriesOptions): void; + chartHeight?: number; + chartWidth?: number; /** * A reference to the containing HTML element, dynamically inserted into the element given in chart.renderTo. * @since 1.2.5 @@ -6820,6 +6822,10 @@ declare namespace Highcharts { * @since 1.2.0 */ options: Options; + plotLeft?: number; + plotSizeX?: number; + plotSizeY?: number; + plotTop?: number; /** * Exporting module required. Clears away other elements in the page and prints the chart as it is displayed. By * default, when the exporting module is enabled, a button at the upper left calls this method. From 5f56516a12d150f81d70653743b92ecd4518bc1d Mon Sep 17 00:00:00 2001 From: tjh Date: Tue, 18 Sep 2018 17:06:06 -0700 Subject: [PATCH 49/78] Remove export statements and namespace references --- types/highcharts/index.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index ad2d401cad..bc6eddbd80 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -379,7 +379,7 @@ declare namespace Highcharts { zIndex?: number; } - export interface AnnotationsPoint { + interface AnnotationsPoint { /** * The x position of the point. Units can be either in axis or chart pixel coordinates. * @default undefined @@ -410,7 +410,7 @@ declare namespace Highcharts { yAxis?: number; } - export interface AnnotationsLabelOptions { + interface AnnotationsLabelOptions { /** * The alignment of the annotation's label. If right, the right side of the label should be touching the point. * @default "center" @@ -428,13 +428,13 @@ declare namespace Highcharts { * @default rgba(0, 0, 0, 0.75) * @since 6.0.0 */ - backgroundColor?: string | Highcharts.Gradient; + backgroundColor?: string | Gradient; /** * The border color for the annotation's label. * @default "black" * @since 6.0.0 */ - borderColor?: string | Highcharts.Gradient; + borderColor?: string | Gradient; /** * The border radius in pixels for the annotation's label. * @default 1 @@ -494,7 +494,7 @@ declare namespace Highcharts { shadow?: | boolean | { - color?: string | Highcharts.Gradient; + color?: string | Gradient; offsetX?: number; offsetY?: number; opacity?: number; @@ -564,7 +564,7 @@ declare namespace Highcharts { y?: number; } - export interface AnnotationsLabel extends AnnotationsLabelOptions { + interface AnnotationsLabel extends AnnotationsLabelOptions { /** * This option defines the point to which the label will be connected. * It can be either the point which exists in the series - it is referenced by the point's id @@ -574,7 +574,7 @@ declare namespace Highcharts { point?: string | AnnotationsPoint; } - export interface AnnotationsShapeOptions { + interface AnnotationsShapeOptions { /** * The color of the shape's fill. * @default rgba(0, 0, 0, 0.75) @@ -619,7 +619,7 @@ declare namespace Highcharts { width: number; } - export interface AnnotationsShape extends AnnotationsShapeOptions { + interface AnnotationsShape extends AnnotationsShapeOptions { /** * Id of the marker which will be drawn at the final vertex of the path. Custom markers can be defined in defs property. * @default undefined @@ -645,14 +645,14 @@ declare namespace Highcharts { * @default undefined * @since 6.0.0 */ - points?: (string | AnnotationsPoint)[]; + points?: Array; } /** * Options for configuring annotations, for example labels, arrows or shapes. Annotations can be tied to points, * axis coordinates or chart pixel coordinates. */ - export interface AnnotationsOptions { + interface AnnotationsOptions { /** * Options for annotation's labels. Each label inherits options from the labelOptions object. * An option from the labelOptions can be overwritten by config for a specific label. From e4fcf2bfb1aaf5053b15e4ea6ae0951a970a89b5 Mon Sep 17 00:00:00 2001 From: Dyma <32801166+dymafr@users.noreply.github.com> Date: Wed, 19 Sep 2018 14:45:29 +0200 Subject: [PATCH 50/78] Mongoose - add findOneAndDelete Add missing findOneAndDelete method --- types/mongoose/index.d.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 2ac8410672..7a28f641f6 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -2832,6 +2832,32 @@ declare module "mongoose" { /** sets the document fields to return */ select?: any; }, callback?: (err: any, res: T | null) => void): DocumentQuery; + + /** + * Issues a mongodb findOneAndDelete command. + * Finds a matching document, removes it, passing the found document (if any) to the + * callback. Executes immediately if callback is passed. + */ + findOneAndDelete(): DocumentQuery; + findOneAndDelete(conditions: any, + callback?: (err: any, res: T | null) => void): DocumentQuery; + findOneAndDelete(conditions: any, options: { + /** + * if multiple docs are found by the conditions, sets the sort order to choose + * which doc to update + */ + sort?: any; + /** puts a time limit on the query - requires mongodb >= 2.6.0 */ + maxTimeMS?: number; + /** sets the document fields to return */ + select?: any; + /** like select, it determines which fields to return */ + projection?: any; + /** if true, returns the raw result from the MongoDB driver */ + rawResult?: boolean; + /** overwrites the schema's strict mode option for this update */ + strict?: boolean|string; + }, callback?: (err: any, res: T | null) => void): DocumentQuery; /** * Issues a mongodb findAndModify update command. From 0f4418007c0b29a8fa5485d306d196d863b48ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Vieira?= Date: Wed, 19 Sep 2018 16:21:56 +0100 Subject: [PATCH 51/78] Add NextComponentType akin to React.ComponentType. --- types/next/app.d.ts | 47 +++++++++--- types/next/document.d.ts | 47 ++++++++++-- types/next/index.d.ts | 69 ++++++++++++----- types/next/test/next-app-tests.tsx | 94 ++++++++++++++++++++---- types/next/test/next-component-tests.tsx | 92 +++++++++++++++++++++-- 5 files changed, 294 insertions(+), 55 deletions(-) diff --git a/types/next/app.d.ts b/types/next/app.d.ts index d077c0e95a..aef2980063 100644 --- a/types/next/app.d.ts +++ b/types/next/app.d.ts @@ -1,19 +1,46 @@ import * as React from "react"; -import { NextContext } from "."; +import { NextContext, NextComponentType } from "."; import { RouterProps, DefaultQuery } from "./router"; -export interface AppComponentProps { - Component: React.ComponentType; - router: RouterProps; - pageProps: any; -} +// Deprecated +export type AppComponentProps = AppProps; +export type AppComponentContext = NextAppContext; +// End Deprecated -export interface AppComponentContext { - Component: React.ComponentType; +/** + * Context passed to App.getInitialProps. + * Component is dynamic - cannot infer type. + * + * @template Q Query object schema. + */ +export interface NextAppContext { + Component: NextComponentType>; router: RouterProps; ctx: NextContext; } -export class Container extends React.Component { } +/** + * Props passed to the App component. + * Component and pageProps are dynamic - cannot infer type. + * + * @template Q Query object schema. + */ +export interface AppProps { + Component: NextComponentType>; + router: RouterProps; + pageProps: any; +} -export default class App extends React.Component> { } +/** + * App component type. Differs from the default type because the context it passes + * to getInitialProps and the props is passes to the component are different. + * + * @template IP Initial props returned from getInitialProps. + * @template C Context passed to getInitialProps. + */ +export type AppComponentType = NextComponentType; + +export class Container extends React.Component {} +export default class App extends React.Component { + getInitialProps(context: C): Promise | IP; +} diff --git a/types/next/document.d.ts b/types/next/document.d.ts index e6ba38b6c9..2e9880db51 100644 --- a/types/next/document.d.ts +++ b/types/next/document.d.ts @@ -1,6 +1,6 @@ import * as React from "react"; - -import { NextContext } from "."; +import { NextContext, NextComponentType } from "."; +import { DefaultQuery } from "./router"; export interface RenderPageResponse { buildManifest: { [key: string]: any }; @@ -21,16 +21,25 @@ export interface AnyPageProps extends PageProps { [key: string]: any; } -export type Enhancer = (page: React.ComponentType

) => React.ComponentType; +export type Enhancer = ( + page: React.ComponentType

+) => React.ComponentType; /** - * Context object used inside `Document` + * Context passed to Document.getInitialProps. + * + * @template Q Query object schema. */ -export interface NextDocumentContext extends NextContext { +export interface NextDocumentContext extends NextContext { /** A callback that executes the actual React rendering logic (synchronously) */ - renderPage(enhancer?: Enhancer): RenderPageResponse; // tslint:disable-line:no-unnecessary-generics + renderPage( + enhancer?: Enhancer // tslint:disable-line no-unnecessary-generics + ): RenderPageResponse; } +/** + * Props passed to the Document component. + */ export interface DocumentProps { __NEXT_DATA__?: any; dev?: boolean; @@ -45,18 +54,40 @@ export interface DocumentProps { [key: string]: any; } +/** + * Props supported by the Head component. + */ export interface HeadProps { nonce?: string; [key: string]: any; } +/** + * Props supported by the NextScript component. + */ export interface NextScriptProps { nonce?: string; + [key: string]: any; } +/** + * Document component type. Differs from the default type because the context it passes + * to getInitialProps and the props is passes to the component are different. + * + * @template IP Initial props returned from getInitialProps. + * @template C Context passed to getInitialProps. + */ +export type DocumentComponentType = NextComponentType< + IP & DocumentProps, + IP, + C +>; + export class Head extends React.Component {} export class Main extends React.Component {} export class NextScript extends React.Component {} -export default class Document extends React.Component { - static getInitialProps(ctx: NextDocumentContext): Promise | DocumentProps; +export default class Document extends React.Component< + IP & DocumentProps +> { + getInitialProps(context: C): Promise | IP; } diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 08e82106ab..13815cf958 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -16,16 +16,22 @@ import * as url from "url"; import { Response as NodeResponse } from "node-fetch"; -import { SingletonRouter, DefaultQuery } from './router'; +import { SingletonRouter, DefaultQuery } from "./router"; declare namespace next { // Deprecated type QueryStringMapObject = DefaultQuery; + type ServerConfig = NextConfig; + // End Deprecated + + type UrlLike = url.UrlObject | url.Url; /** * Context object used in methods like `getInitialProps()` * https://github.com/zeit/next.js/blob/6.1.1/server/render.js#L77 * https://github.com/zeit/next.js/blob/6.1.1/readme.md#fetching-data-and-component-lifecycle + * + * @template Q Query object schema. */ interface NextContext { /** path section of URL */ @@ -44,19 +50,11 @@ declare namespace next { err?: Error; } - type NextSFC = NextStatelessComponent; - interface NextStatelessComponent - extends React.StatelessComponent { - getInitialProps?: (ctx: NextContext) => Promise; - } - - type UrlLike = url.UrlObject | url.Url; - /** * Next.js config schema. * https://github.com/zeit/next.js/blob/6.1.1/server/config.js#L10 */ - interface ServerConfig { + interface NextConfig { webpack?: any; webpackDevMiddleware?: any; poweredByHeader?: boolean; @@ -83,7 +81,7 @@ declare namespace next { dev?: boolean; staticMarkup?: boolean; quiet?: boolean; - conf?: ServerConfig; + conf?: NextConfig; } /** @@ -97,7 +95,7 @@ declare namespace next { quiet: boolean; router: SingletonRouter; http: null | http.Server; - nextConfig: ServerConfig; + nextConfig: NextConfig; distDir: string; buildId: string; hotReloader: any; @@ -114,7 +112,7 @@ declare namespace next { getHotReloader( dir: string, - options: { quiet: boolean; config: ServerConfig; buildId: string } + options: { quiet: boolean; config: NextConfig; buildId: string } ): any; handleRequest( req: http.IncomingMessage, @@ -132,11 +130,7 @@ declare namespace next { close(): Promise; defineRoutes(): Promise; start(): Promise; - run( - req: http.IncomingMessage, - res: http.ServerResponse, - parsedUrl: UrlLike - ): Promise; + run(req: http.IncomingMessage, res: http.ServerResponse, parsedUrl: UrlLike): Promise; render( req: http.IncomingMessage, @@ -182,6 +176,45 @@ declare namespace next { getCompilationError(): Promise; send404(res: http.ServerResponse): void; } + + /** + * Next.js counterpart of React.ComponentType. + * Specially useful in HOCs that receive Next.js components. + */ + type NextComponentType

= + | NextComponentClass + | NextStatelessComponent; + + /** + * Next.js counterpart of React.SFC/React.StatelessComponent. + * + * @template P Component props. + * @template IP Initial props returned from getInitialProps. + * @template C Context passed to getInitialProps. + */ + type NextSFC

= NextStatelessComponent; + type NextStatelessComponent

= React.StatelessComponent

& + NextStaticLifecycle; + + /** + * Next.js counterpart of React.ComponentClass. + * + * @template P Component props. + * @template IP Initial props returned from getInitialProps. + * @template C Context passed to getInitialProps. + */ + type NextComponentClass

= React.ComponentClass

& + NextStaticLifecycle; + + /** + * Next.js specific lifecycle methods. + * + * @template IP Initial props returned from getInitialProps and passed to the component. + * @template C Context passed to getInitialProps. + */ + interface NextStaticLifecycle { + getInitialProps?: (ctx: C) => Promise | IP; + } } declare function next(options?: next.ServerOptions): next.Server; diff --git a/types/next/test/next-app-tests.tsx b/types/next/test/next-app-tests.tsx index ffdcbaaf65..331df9e92f 100644 --- a/types/next/test/next-app-tests.tsx +++ b/types/next/test/next-app-tests.tsx @@ -1,24 +1,15 @@ import * as React from "react"; -import App, { Container, AppComponentContext } from "next/app"; -import { NextStatelessComponent } from "next"; +import App, { Container, NextAppContext, AppProps, AppComponentType } from "next/app"; interface NextComponentProps { example: string; } -class TestApp extends App { - static async getInitialProps({ Component, router, ctx }: AppComponentContext) { - let pageProps = {}; - // TODO: fix AppComponentContext to return NextComponentType instead of React.ComponentType - const Page = Component as NextStatelessComponent; - - if (Page.getInitialProps) { - pageProps = await Page.getInitialProps(ctx); - } - - return { pageProps }; - } +interface TypedQuery { + id?: string; +} +class TestApp extends App { render() { const { Component, router, pageProps } = this.props; return ( @@ -28,3 +19,78 @@ class TestApp extends App { ); } } + +class TestAppWithProps extends App { + static async getInitialProps({ Component, router, ctx }: NextAppContext) { + const pageProps = Component.getInitialProps && (await Component.getInitialProps(ctx)); + return { pageProps, example: "foobar" }; + } + + render() { + const { Component, router, pageProps, example } = this.props; + return ; + } +} + +class TestAppWithTypedQuery extends App<{}, NextAppContext> { + static async getInitialProps({ ctx }: NextAppContext) { + const { id } = ctx.query; + const processQuery = (id?: string) => id; + processQuery(id); + } +} + +interface WithExampleProps { + example: string; +} + +interface WithExampleHocProps { + test: string; +} + +interface TestProps { + ownProp: boolean; +} + +// Stateful HOC that adds props to wrapped component. Similar to what withRedux does. +// tslint:disable-next-line no-unnecessary-generics +const withExample =

(App: AppComponentType

) => + class extends React.Component

{ + test: string; + + static async getInitialProps(context: NextAppContext) { + const pageProps = App.getInitialProps && (await App.getInitialProps(context)); + + // tslint:disable-next-line prefer-object-spread + return Object.assign({}, pageProps, { test: "test" }); + } + + constructor(props: P & AppProps & WithExampleHocProps) { + super(props); + this.test = props.test; + } + + render() { + return ; + } + }; + +// Basic stateless HOC. Similar to what withAuth would do. +// tslint:disable-next-line no-unnecessary-generics +const withBasic =

(App: AppComponentType) => + class extends React.Component

{ + static async getInitialProps(context: C) { + const pageProps = App.getInitialProps && (await App.getInitialProps(context)); + + // tslint:disable-next-line prefer-object-spread + return Object.assign({}, pageProps); + } + + render() { + return ; + } + }; + +withExample(TestAppWithProps); + +withBasic(TestAppWithTypedQuery); diff --git a/types/next/test/next-component-tests.tsx b/types/next/test/next-component-tests.tsx index 37cd7264ef..4ba145ee15 100644 --- a/types/next/test/next-component-tests.tsx +++ b/types/next/test/next-component-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { NextStatelessComponent, NextContext } from "next"; +import { NextStatelessComponent, NextContext, NextComponentType } from "next"; interface NextComponentProps { example: string; @@ -12,13 +12,11 @@ interface TypedQuery { class ClassNext extends React.Component { static async getInitialProps(ctx: NextContext) { const { example } = ctx.query; - return { example }; + return { example: example as string }; } render() { - return ( -

I'm a class component! {this.props.example}
- ); + return
I'm a class component! {this.props.example}
; } } @@ -38,3 +36,87 @@ StatelessNext.getInitialProps = async ({ query }: NextContext) => { const { example } = query; return { example: example as string }; }; + +interface WithExampleProps { + example: string; +} + +interface WithExampleHocProps { + test: string; +} + +interface TestProps { + ownProp: boolean; +} + +// Stateful HOC that adds props to wrapped component. Similar to what withRedux does. +// tslint:disable-next-line use-default-type-parameter +const withExample =

(Page: NextComponentType

) => + class extends React.Component

{ + test: string; + + static async getInitialProps(ctx: NextContext) { + const pageProps = Page.getInitialProps && (await Page.getInitialProps(ctx)); + + // tslint:disable-next-line prefer-object-spread + return Object.assign({}, pageProps, { test: "test" }); + } + + constructor(props: P & WithExampleHocProps) { + super(props); + this.test = props.test; + } + + render() { + return ; + } + }; + +// Basic stateless HOC. Similar to what withAuth would do. +// tslint:disable-next-line no-unnecessary-generics +const withBasic =

(Page: NextComponentType

) => + class extends React.Component

{ + static async getInitialProps(ctx: NextContext) { + const pageProps = Page.getInitialProps && (await Page.getInitialProps(ctx)); + + // tslint:disable-next-line prefer-object-spread + const props = Object.assign({}, pageProps); + + if (ctx.query.example === "bar") { + // Redirect + } + + return props; + } + + render() { + return ; + } + }; + +class NextWithExample extends React.Component { + static async getInitialProps(ctx: NextContext) { + const { id } = ctx.query; + const processQuery = (id?: string) => id; + processQuery(id); + return { ownProp: true }; + } + + render() { + const { ownProp, example } = this.props; + return ( +

+ I'm wrapped in a HOC that gives me an example prop! {example} {ownProp} +
+ ); + } +} + +// P template is inferred as . +withExample(NextWithExample); + +// P template inferred as . +withBasic(ClassNext); + +// P template inferred as +withBasic(withExample(NextWithExample)); From 5be1841543b055410a5585f075abf2f62680e3fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Vieira?= Date: Wed, 19 Sep 2018 17:01:02 +0100 Subject: [PATCH 52/78] Add type docs for NextComponentType type. --- types/next/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 13815cf958..c66e4c82ac 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -180,6 +180,10 @@ declare namespace next { /** * Next.js counterpart of React.ComponentType. * Specially useful in HOCs that receive Next.js components. + * + * @template P Component props. + * @template IP Initial props returned from getInitialProps. + * @template C Context passed to getInitialProps. */ type NextComponentType

= | NextComponentClass From 72c94cafc659957c842f443f04b441b10c23e4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joa=CC=83o=20Vieira?= Date: Wed, 19 Sep 2018 17:10:57 +0100 Subject: [PATCH 53/78] Fix next-typescript test testing type name. --- types/zeit__next-typescript/zeit__next-typescript-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/zeit__next-typescript/zeit__next-typescript-tests.ts b/types/zeit__next-typescript/zeit__next-typescript-tests.ts index a7b58c46fc..6a9a87ac50 100644 --- a/types/zeit__next-typescript/zeit__next-typescript-tests.ts +++ b/types/zeit__next-typescript/zeit__next-typescript-tests.ts @@ -1,3 +1,3 @@ import withTypescript = require('@zeit/next-typescript'); -withTypescript({}); // $ExpectType ServerConfig +withTypescript({}); // $ExpectType NextConfig From 3e5de7d25e6574c0e6fd65b53b07faadd2a07702 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 19 Sep 2018 13:18:42 -0400 Subject: [PATCH 54/78] v6 and v7 to comply with schema definition type. --- types/json-schema/index.d.ts | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/types/json-schema/index.d.ts b/types/json-schema/index.d.ts index 314f285b59..b5d9aedc83 100644 --- a/types/json-schema/index.d.ts +++ b/types/json-schema/index.d.ts @@ -214,7 +214,8 @@ export type JSONSchema6Type = any[] | boolean | number | null | object | string * JSON Schema V6 * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01 */ -export interface JSONSchema6 { +export type JSONSchema6 = JSONSchema6Object | boolean; +export interface JSONSchema6Object { $id?: string $ref?: string $schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | @@ -281,7 +282,7 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9 */ - items?: boolean | JSONSchema6 | JSONSchema6[] + items?: JSONSchema6 | JSONSchema6[] /** * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. @@ -292,7 +293,7 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10 */ - additionalItems?: boolean | JSONSchema6 + additionalItems?: JSONSchema6 /** * Must be a non-negative integer. @@ -321,7 +322,7 @@ export interface JSONSchema6 { * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14 */ - contains?: boolean | JSONSchema6 + contains?: JSONSchema6 /** * Must be a non-negative integer. @@ -356,7 +357,7 @@ export interface JSONSchema6 { * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18 */ properties?: { - [k: string]: boolean | JSONSchema6 + [k: string]: JSONSchema6 } /** @@ -368,7 +369,7 @@ export interface JSONSchema6 { * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19 */ patternProperties?: { - [k: string]: boolean | JSONSchema6 + [k: string]: JSONSchema6 } /** @@ -378,7 +379,7 @@ export interface JSONSchema6 { * The default value is an empty schema which allows any value for additional properties. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20 */ - additionalProperties?: boolean | JSONSchema6 + additionalProperties?: JSONSchema6 /** * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. @@ -388,7 +389,7 @@ export interface JSONSchema6 { * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21 */ dependencies?: { - [k: string]: boolean | JSONSchema6 | string[] + [k: string]: JSONSchema6 | string[] } /** @@ -397,7 +398,7 @@ export interface JSONSchema6 { * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22 */ - propertyNames?: boolean | JSONSchema6 + propertyNames?: JSONSchema6 /** * This provides an enumeration of all possible values that are valid @@ -440,13 +441,13 @@ export interface JSONSchema6 { /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29 */ - not?: boolean | JSONSchema6 + not?: JSONSchema6 /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1 */ definitions?: { - [k: string]: boolean | JSONSchema6 + [k: string]: JSONSchema6 } /** @@ -508,7 +509,12 @@ export type JSONSchema7Version = 'http://json-schema.org/schema#' | 'http://json-schema.org/draft-07/schema#' | 'http://json-schema.org/draft-07/hyper-schema#'; -export interface JSONSchema7 { +/** + * JSON Schema v7 + * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01 + */ +export type JSONSchema7 = JSONSchema7Object | boolean; +export interface JSONSchema7Object { $id?: string; $ref?: string; $schema?: JSONSchema7Version; From 92b3fb7b10378ef02f7605d4593d729ad0d4147a Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 19 Sep 2018 13:35:12 -0400 Subject: [PATCH 55/78] Added tests for v6 and v7 bool types. --- types/json-schema/json-schema-tests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/json-schema/json-schema-tests.ts b/types/json-schema/json-schema-tests.ts index 66cf7c5af5..8d43385aea 100644 --- a/types/json-schema/json-schema-tests.ts +++ b/types/json-schema/json-schema-tests.ts @@ -149,6 +149,7 @@ import { propertyNames: {}, format: 'date-time' } + const c: JSONSchema7 = false; } /* JSON Schema 7 */ @@ -167,7 +168,7 @@ import { const c: JSONSchema7Type = [1, 2] } -// JSONSchema4 +// JSONSchema7 () => { const a: JSONSchema7 = {} const b: JSONSchema7 = { @@ -228,4 +229,5 @@ import { if: {}, then: {} } + const c: JSONSchema7 = false; } From 0d7ab87136520634baf79ac5f4d43293966901ab Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 19 Sep 2018 16:01:02 -0400 Subject: [PATCH 56/78] Refactored my changes to avoid breaking classes that implement JSONSchema6/7 and added test to avoid breaking this in the future. --- types/json-schema/index.d.ts | 64 +++++++++++++------------- types/json-schema/json-schema-tests.ts | 32 +++++++++---- 2 files changed, 55 insertions(+), 41 deletions(-) diff --git a/types/json-schema/index.d.ts b/types/json-schema/index.d.ts index b5d9aedc83..156a86c9a5 100644 --- a/types/json-schema/index.d.ts +++ b/types/json-schema/index.d.ts @@ -214,8 +214,8 @@ export type JSONSchema6Type = any[] | boolean | number | null | object | string * JSON Schema V6 * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01 */ -export type JSONSchema6 = JSONSchema6Object | boolean; -export interface JSONSchema6Object { +export type JSONSchema6Definition = JSONSchema6 | boolean; +export interface JSONSchema6 { $id?: string $ref?: string $schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' | @@ -282,7 +282,7 @@ export interface JSONSchema6Object { * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9 */ - items?: JSONSchema6 | JSONSchema6[] + items?: JSONSchema6Definition | JSONSchema6Definition[] /** * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. @@ -293,7 +293,7 @@ export interface JSONSchema6Object { * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10 */ - additionalItems?: JSONSchema6 + additionalItems?: JSONSchema6Definition /** * Must be a non-negative integer. @@ -322,7 +322,7 @@ export interface JSONSchema6Object { * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14 */ - contains?: JSONSchema6 + contains?: JSONSchema6Definition /** * Must be a non-negative integer. @@ -357,7 +357,7 @@ export interface JSONSchema6Object { * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18 */ properties?: { - [k: string]: JSONSchema6 + [k: string]: JSONSchema6Definition } /** @@ -369,7 +369,7 @@ export interface JSONSchema6Object { * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19 */ patternProperties?: { - [k: string]: JSONSchema6 + [k: string]: JSONSchema6Definition } /** @@ -379,7 +379,7 @@ export interface JSONSchema6Object { * The default value is an empty schema which allows any value for additional properties. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20 */ - additionalProperties?: JSONSchema6 + additionalProperties?: JSONSchema6Definition /** * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. @@ -389,7 +389,7 @@ export interface JSONSchema6Object { * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21 */ dependencies?: { - [k: string]: JSONSchema6 | string[] + [k: string]: JSONSchema6Definition | string[] } /** @@ -398,7 +398,7 @@ export interface JSONSchema6Object { * Omitting this keyword has the same behavior as an empty schema. * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22 */ - propertyNames?: JSONSchema6 + propertyNames?: JSONSchema6Definition /** * This provides an enumeration of all possible values that are valid @@ -426,28 +426,28 @@ export interface JSONSchema6Object { /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26 */ - allOf?: JSONSchema6[] + allOf?: JSONSchema6Definition[] /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27 */ - anyOf?: JSONSchema6[] + anyOf?: JSONSchema6Definition[] /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28 */ - oneOf?: JSONSchema6[] + oneOf?: JSONSchema6Definition[] /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29 */ - not?: JSONSchema6 + not?: JSONSchema6Definition /** * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1 */ definitions?: { - [k: string]: JSONSchema6 + [k: string]: JSONSchema6Definition } /** @@ -513,8 +513,8 @@ export type JSONSchema7Version = 'http://json-schema.org/schema#' * JSON Schema v7 * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01 */ -export type JSONSchema7 = JSONSchema7Object | boolean; -export interface JSONSchema7Object { +export type JSONSchema7Definition = JSONSchema7 | boolean; +export interface JSONSchema7 { $id?: string; $ref?: string; $schema?: JSONSchema7Version; @@ -546,8 +546,8 @@ export interface JSONSchema7Object { /** * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4 */ - items?: JSONSchema7 | JSONSchema7[]; - additionalItems?: JSONSchema7; + items?: JSONSchema7Definition | JSONSchema7Definition[]; + additionalItems?: JSONSchema7Definition; maxItems?: number; minItems?: number; uniqueItems?: boolean; @@ -560,31 +560,31 @@ export interface JSONSchema7Object { minProperties?: number; required?: string[]; properties?: { - [key: string]: JSONSchema7; + [key: string]: JSONSchema7Definition; }; patternProperties?: { - [key: string]: JSONSchema7; + [key: string]: JSONSchema7Definition; }; - additionalProperties?: JSONSchema7; + additionalProperties?: JSONSchema7Definition; dependencies?: { - [key: string]: JSONSchema7 | string[]; + [key: string]: JSONSchema7Definition | string[]; }; - propertyNames?: JSONSchema7; + propertyNames?: JSONSchema7Definition; /** * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6 */ - if?: JSONSchema7; - then?: JSONSchema7; - else?: JSONSchema7; + if?: JSONSchema7Definition; + then?: JSONSchema7Definition; + else?: JSONSchema7Definition; /** * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7 */ - allOf?: JSONSchema7[]; - anyOf?: JSONSchema7[]; - oneOf?: JSONSchema7[]; - not?: JSONSchema7; + allOf?: JSONSchema7Definition[]; + anyOf?: JSONSchema7Definition[]; + oneOf?: JSONSchema7Definition[]; + not?: JSONSchema7Definition; /** * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7 @@ -601,7 +601,7 @@ export interface JSONSchema7Object { * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9 */ definitions?: { - [key: string]: JSONSchema7; + [key: string]: JSONSchema7Definition; }; /** diff --git a/types/json-schema/json-schema-tests.ts b/types/json-schema/json-schema-tests.ts index 8d43385aea..ae750271b5 100644 --- a/types/json-schema/json-schema-tests.ts +++ b/types/json-schema/json-schema-tests.ts @@ -8,7 +8,9 @@ import { JSONSchema7, JSONSchema7Array, JSONSchema7Type, - JSONSchema7TypeName + JSONSchema7TypeName, + JSONSchema6Definition, + JSONSchema7Definition } from 'json-schema' /* JSON Schema 4 */ @@ -80,6 +82,10 @@ import { } } +// Class +class Schema4 implements JSONSchema4 { +} + /* JSON Schema 6 */ // SimpleType @@ -96,10 +102,10 @@ import { const c: JSONSchema6Type = [1, 2] } -// JSONSchema6 +// JSONSchema6Definition () => { - const a: JSONSchema6 = {} - const b: JSONSchema6 = { + const a: JSONSchema6Definition = {} + const b: JSONSchema6Definition = { $id: 'foo', $ref: 'foo/bar', $schema: 'http://json-schema.org/schema#', @@ -149,7 +155,11 @@ import { propertyNames: {}, format: 'date-time' } - const c: JSONSchema7 = false; + const c: JSONSchema6Definition = false; +} + +// Class +class Schema6 implements JSONSchema6 { } /* JSON Schema 7 */ @@ -168,10 +178,10 @@ import { const c: JSONSchema7Type = [1, 2] } -// JSONSchema7 +// JSONSchema7Definition () => { - const a: JSONSchema7 = {} - const b: JSONSchema7 = { + const a: JSONSchema7Definition = {} + const b: JSONSchema7Definition = { $id: 'foo', $ref: 'foo/bar', $schema: 'http://json-schema.org/schema#', @@ -229,5 +239,9 @@ import { if: {}, then: {} } - const c: JSONSchema7 = false; + const c: JSONSchema7Definition = false; +} + +// Class +class Schema7 implements JSONSchema7 { } From d5932111adc73575263d32fcb27f6cd16b7d9327 Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Wed, 19 Sep 2018 15:08:41 -0700 Subject: [PATCH 57/78] Excel 1.8 Updates --- types/office-js/index.d.ts | 6320 +++++++++++++++++++++++++++++++++++- 1 file changed, 6267 insertions(+), 53 deletions(-) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index 9e51ad6fad..f83ff2c41a 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -17176,12 +17176,9 @@ declare namespace OfficeExtension { //////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////// ////////////////////// Begin OfficeCore //////////////////////// //////////////////////////////////////////////////////////////// @@ -17209,6 +17206,15 @@ declare namespace OfficeCore { //////////////////////////////////////////////////////////////// declare namespace Excel { + /** + * + * Creates and opens a new workbook. Optionally, the workbook can be pre-populated with a base64-encoded .xlsx file. + * + * [Api set: ExcelApi 1.8] + * + * @param base64File Optional. The base64 encoded .xlsx file. The default value is null. + */ + function createWorkbook(base64?: string): Promise; interface ThreeArrowsSet { [index: number]: Icon; redDownArrow: Icon; @@ -17575,14 +17581,14 @@ declare namespace Excel { * * Gets the range that represents the changed area of a specific worksheet. * - * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * [Api set: ExcelApi 1.8] */ getRange(ctx: Excel.RequestContext): Excel.Range; /** * * Gets the range that represents the changed area of a specific worksheet. It might return null object. * - * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * [Api set: ExcelApi 1.8] */ getRangeOrNullObject(ctx: Excel.RequestContext): Excel.Range; } @@ -17639,14 +17645,14 @@ declare namespace Excel { * * Gets the range that represents the changed area of a table on a specific worksheet. * - * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * [Api set: ExcelApi 1.8] */ getRange(ctx: Excel.RequestContext): Excel.Range; /** * * Gets the range that represents the changed area of a table on a specific worksheet. It might return null object. * - * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * [Api set: ExcelApi 1.8] */ getRangeOrNullObject(ctx: Excel.RequestContext): Excel.Range; } @@ -17824,6 +17830,158 @@ declare namespace Excel { */ worksheetId: string; } + /** + * + * Provides information about the chart that raised the Added event. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartAddedEventArgs { + /** + * + * Gets the id of the chart that is added to the worksheet. + * + * [Api set: ExcelApi 1.8] + */ + chartId: string; + /** + * + * Gets the source of the event. See Excel.EventSource for details. + * + * [Api set: ExcelApi 1.8] + */ + source: Excel.EventSource | "Local" | "Remote"; + /** + * + * Gets the type of the event. See Excel.EventType for details. + * + * [Api set: ExcelApi 1.8] + */ + type: "ChartAdded"; + /** + * + * Gets the id of the worksheet in which the chart is added. + * + * [Api set: ExcelApi 1.8] + */ + worksheetId: string; + } + /** + * + * Provides information about the chart that raised the Activated event. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartActivatedEventArgs { + /** + * + * Gets the id of the chart that is activated. + * + * [Api set: ExcelApi 1.8] + */ + chartId: string; + /** + * + * Gets the type of the event. See Excel.EventType for details. + * + * [Api set: ExcelApi 1.8] + */ + type: "ChartActivated"; + /** + * + * Gets the id of the worksheet in which the chart is activated. + * + * [Api set: ExcelApi 1.8] + */ + worksheetId: string; + } + /** + * + * Provides information about the chart that raised the Deactivated event. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartDeactivatedEventArgs { + /** + * + * Gets the id of the chart that is deactivated. + * + * [Api set: ExcelApi 1.8] + */ + chartId: string; + /** + * + * Gets the type of the event. See Excel.EventType for details. + * + * [Api set: ExcelApi 1.8] + */ + type: "ChartDeactivated"; + /** + * + * Gets the id of the worksheet in which the chart is deactivated. + * + * [Api set: ExcelApi 1.8] + */ + worksheetId: string; + } + /** + * + * Provides information about the chart that raised the Deleted event. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartDeletedEventArgs { + /** + * + * Gets the id of the chart that is deleted from the worksheet. + * + * [Api set: ExcelApi 1.8] + */ + chartId: string; + /** + * + * Gets the source of the event. See Excel.EventSource for details. + * + * [Api set: ExcelApi 1.8] + */ + source: Excel.EventSource | "Local" | "Remote"; + /** + * + * Gets the type of the event. See Excel.EventType for details. + * + * [Api set: ExcelApi 1.8] + */ + type: "ChartDeleted"; + /** + * + * Gets the id of the worksheet in which the chart is deleted. + * + * [Api set: ExcelApi 1.8] + */ + worksheetId: string; + } + /** + * + * Provides information about the worksheet that raised the Calculated event. + * + * [Api set: ExcelApi 1.8] + */ + interface WorksheetCalculatedEventArgs { + /** + * + * Gets the type of the event. See Excel.EventType for details. + * + * [Api set: ExcelApi 1.8] + */ + type: "WorksheetCalculated"; + /** + * + * Gets the id of the worksheet that is calculated. + * + * [Api set: ExcelApi 1.8] + */ + worksheetId: string; + } /** * * Represents the Excel Runtime class. @@ -17831,9 +17989,49 @@ declare namespace Excel { * [Api set: ExcelApi 1.5] */ class Runtime extends OfficeExtension.ClientObject { - toJSON(): { - [key: string]: string; - }; + /** + * + * Turn on/off JavaScript events in current taskpane or content add-in. + * + * [Api set: ExcelApi 1.8] + */ + enableEvents: boolean; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.Runtime): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.RuntimeUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.Runtime): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.Runtime` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.Runtime` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.Runtime` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.RuntimeLoadOptions): Excel.Runtime; + load(option?: string | string[]): Excel.Runtime; + load(option?: { + select?: string; + expand?: string; + }): Excel.Runtime; + toJSON(): Excel.Interfaces.RuntimeData; } /** * @@ -18016,6 +18214,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ readonly name: string; + /** + * + * True if the workbook is open in Read-only mode. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readonly readOnly: boolean; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. * * @remarks @@ -18131,6 +18336,35 @@ declare namespace Excel { }): Excel.WorkbookProtection; toJSON(): Excel.Interfaces.WorkbookProtectionData; } + /** + * + * The WorkbookCreated object is the top level object created by Application.CreateWorkbook. A WorkbookCreated object is a special Workbook object. + * + * [Api set: ExcelApi 1.8] + */ + class WorkbookCreated extends OfficeExtension.ClientObject { + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.WorkbookCreated` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.WorkbookCreated` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.WorkbookCreated` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: string | string[]): Excel.WorkbookCreated; + load(option?: { + select?: string; + expand?: string; + }): Excel.WorkbookCreated; + toJSON(): Excel.Interfaces.WorkbookCreatedData; + } /** * * An Excel worksheet is a grid of cells. It can contain data, tables, charts, etc. @@ -18204,6 +18438,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ position: number; + /** + * + * Gets or sets the worksheet's gridlines flag. + This flag determines whether gridlines are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showGridlines: boolean; + /** + * + * Gets or sets the worksheet's headings flag. + This flag determines whether headings are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showHeadings: boolean; /** * * Returns the standard (default) height of all the rows in the worksheet, in points. Read-only. @@ -18407,6 +18657,15 @@ declare namespace Excel { * @eventproperty */ readonly onActivated: OfficeExtension.EventHandlers; + /** + * + * Occurs when the worksheet is calculated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onCalculated: OfficeExtension.EventHandlers; /** * * Occurs when data changed on a specific worksheet. @@ -18542,6 +18801,15 @@ declare namespace Excel { * @eventproperty */ readonly onAdded: OfficeExtension.EventHandlers; + /** + * + * Occurs when any worksheet in the workbook is calculated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onCalculated: OfficeExtension.EventHandlers; /** * * Occurs when any worksheet in the workbook is deactivated. @@ -18808,6 +19076,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.6] */ readonly conditionalFormats: Excel.ConditionalFormatCollection; + /** + * + * Returns a data validation object. + * + * [Api set: ExcelApi 1.8] + */ + readonly dataValidation: Excel.DataValidation; /** * * Returns a format object, encapsulating the range's font, fill, borders, alignment, and other properties. Read-only. @@ -20327,6 +20602,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ readonly id: string; + /** + * + * Returns a numeric id. + * + * [Api set: ExcelApi 1.8] + */ + readonly legacyId: string; /** * * Name of the table. @@ -20836,6 +21118,327 @@ declare namespace Excel { }): Excel.TableRow; toJSON(): Excel.Interfaces.TableRowData; } + /** + * + * Represents the data validation applied to the current range. + * + * [Api set: ExcelApi 1.8] + */ + class DataValidation extends OfficeExtension.ClientObject { + /** + * + * Error alert when user enters invalid data. + * + * [Api set: ExcelApi 1.8] + */ + errorAlert: Excel.DataValidationErrorAlert; + /** + * + * Ignore blanks: no data validation will be performed on blank cells, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + ignoreBlanks: boolean; + /** + * + * Prompt when users select a cell. + * + * [Api set: ExcelApi 1.8] + */ + prompt: Excel.DataValidationPrompt; + /** + * + * Data Validation rule that contains different type of data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + rule: Excel.DataValidationRule; + /** + * + * Type of the data validation, see Excel.DataValidationType for details. + * + * [Api set: ExcelApi 1.8] + */ + readonly type: Excel.DataValidationType | "None" | "WholeNumber" | "Decimal" | "List" | "Date" | "Time" | "TextLength" | "Custom" | "Inconsistent" | "MixedCriteria"; + /** + * + * Represents if all cell values are valid according to the data validation rules. + Returns true if all cell values are valid, or false if all cell values are invalid. + Returns null if there are both valid and invalid cell values within the range. + * + * [Api set: ExcelApi 1.8] + */ + readonly valid: boolean; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.DataValidation): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.DataValidationUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.DataValidation): void; + /** + * + * Clears the data validation from the current range. + * + * [Api set: ExcelApi 1.8] + */ + clear(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.DataValidation` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.DataValidation` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.DataValidation` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.DataValidationLoadOptions): Excel.DataValidation; + load(option?: string | string[]): Excel.DataValidation; + load(option?: { + select?: string; + expand?: string; + }): Excel.DataValidation; + toJSON(): Excel.Interfaces.DataValidationData; + } + /** + * + * Data validation rule contains different types of data validation. You can only use one of them at a time according the Excel.DataValidationType. + * + * [Api set: ExcelApi 1.8] + */ + interface DataValidationRule { + /** + * + * Custom data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + custom?: Excel.CustomDataValidation; + /** + * + * Date data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + date?: Excel.DateTimeDataValidation; + /** + * + * Decimal data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + decimal?: Excel.BasicDataValidation; + /** + * + * List data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + list?: Excel.ListDataValidation; + /** + * + * TextLength data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + textLength?: Excel.BasicDataValidation; + /** + * + * Time data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + time?: Excel.DateTimeDataValidation; + /** + * + * WholeNumber data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + wholeNumber?: Excel.BasicDataValidation; + } + /** + * + * Represents the Basic Type data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + interface BasicDataValidation { + /** + * + * Gets or sets the Formula1, i.e. minimum value or value depending of the operator. + When setting the value, it can be passed in as a number, a range object, or a string formula (where the string is either a stringified number, a cell reference like "=A1", or a formula like "=MIN(A1, B1)"). + When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc. + * + * [Api set: ExcelApi 1.8] + */ + formula1: string | number | Range; + /** + * + * Gets or sets the Formula2, i.e. maximum value or value depending of the operator. + When setting the value, it can be passed in as a number, a range object, or a string formula (where the string is either a stringified number, a cell reference like "=A1", or a formula like "=MIN(A1, B1)"). + When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc. + * + * [Api set: ExcelApi 1.8] + */ + formula2?: string | number | Range; + /** + * + * The operator to use for validating the data. + * + * [Api set: ExcelApi 1.8] + */ + operator: Excel.DataValidationOperator | "Between" | "NotBetween" | "EqualTo" | "NotEqualTo" | "GreaterThan" | "LessThan" | "GreaterThanOrEqualTo" | "LessThanOrEqualTo"; + } + /** + * + * Represents the Date data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + interface DateTimeDataValidation { + /** + * + * Gets or sets the Formula1, i.e. minimum value or value depending of the operator. + When setting the value, it can be passed in as a Date, a Range object, or a string formula (where the string is either a stringified date/time in ISO8601 format, a cell reference like "=A1", or a formula like "=MIN(A1, B1)"). + When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc. + * + * [Api set: ExcelApi 1.8] + */ + formula1: string | Date | Range; + /** + * + * Gets or sets the Formula2, i.e. maximum value or value depending of the operator. + When setting the value, it can be passed in as a Date, a Range object, or a string (where the string is either a stringified date/time in ISO8601 format, a cell reference like "=A1", or a formula like "=MIN(A1, B1)"). + When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc. + * + * [Api set: ExcelApi 1.8] + */ + formula2?: string | Date | Range; + /** + * + * The operator to use for validating the data. + * + * [Api set: ExcelApi 1.8] + */ + operator: Excel.DataValidationOperator | "Between" | "NotBetween" | "EqualTo" | "NotEqualTo" | "GreaterThan" | "LessThan" | "GreaterThanOrEqualTo" | "LessThanOrEqualTo"; + } + /** + * + * Represents the List data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + interface ListDataValidation { + /** + * + * Displays the list in cell drop down or not, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + inCellDropDown: boolean; + /** + * + * Source of the list for data validation + When setting the value, it can be passed in as a Excel Range object, or a string that contains comma separated number, boolean or date. + * + * [Api set: ExcelApi 1.8] + */ + source: string | Range; + } + /** + * + * Represents the Custom data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + interface CustomDataValidation { + /** + * + * Custom data validation formula, it is to create special rules, such as preventing duplicates, or limiting the total in a range of cells. + * + * [Api set: ExcelApi 1.8] + */ + formula: string; + } + /** + * + * Represents the error alert properties for the data validation. + * + * [Api set: ExcelApi 1.8] + */ + interface DataValidationErrorAlert { + /** + * + * Represents error alert message. + * + * [Api set: ExcelApi 1.8] + */ + message: string; + /** + * + * It determines show error alert dialog or not when users enter invalid data, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + showAlert: boolean; + /** + * + * Represents Data validation alert type, please see Excel.DataValidationAlertStyle for details. + * + * [Api set: ExcelApi 1.8] + */ + style: Excel.DataValidationAlertStyle | "Stop" | "Warning" | "Information"; + /** + * + * Represents error alert dialog title. + * + * [Api set: ExcelApi 1.8] + */ + title: string; + } + /** + * + * Represents the user prompt properties for the data validation. + * + * [Api set: ExcelApi 1.8] + */ + interface DataValidationPrompt { + /** + * + * Represents the message of the prompt. + * + * [Api set: ExcelApi 1.8] + */ + message: string; + /** + * + * It determines showing the prompt or not when user selects a cell with the data validation. + * + * [Api set: ExcelApi 1.8] + */ + showPrompt: boolean; + /** + * + * Represents the title for the prompt. + * + * [Api set: ExcelApi 1.8] + */ + title: string; + } /** * * A format object encapsulating the range's font, fill, borders, alignment, and other properties. @@ -21360,7 +21963,7 @@ declare namespace Excel { * @param sourceData The Range object corresponding to the source data. * @param seriesBy Optional. Specifies the way columns or rows are used as data series on the chart. See Excel.ChartSeriesBy for details. */ - add(type: "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel", sourceData: Range, seriesBy?: "Auto" | "Columns" | "Rows"): Excel.Chart; + add(type: "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel", sourceData: Range, seriesBy?: "Auto" | "Columns" | "Rows"): Excel.Chart; /** * * Returns the number of charts in the worksheet. @@ -21414,6 +22017,42 @@ declare namespace Excel { load(option?: Excel.Interfaces.ChartCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.ChartCollection; load(option?: string | string[]): Excel.ChartCollection; load(option?: OfficeExtension.LoadOption): Excel.ChartCollection; + /** + * + * Occurs when a chart is activated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onActivated: OfficeExtension.EventHandlers; + /** + * + * Occurs when a new chart is added to the worksheet. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onAdded: OfficeExtension.EventHandlers; + /** + * + * Occurs when a chart is deactivated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onDeactivated: OfficeExtension.EventHandlers; + /** + * + * Occurs when a chart is deleted. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onDeleted: OfficeExtension.EventHandlers; toJSON(): Excel.Interfaces.ChartCollectionData; } /** @@ -21454,6 +22093,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ readonly legend: Excel.ChartLegend; + /** + * + * Represents the plotArea for the chart. + * + * [Api set: ExcelApi 1.8] + */ + readonly plotArea: Excel.ChartPlotArea; /** * * Represents either a single series or collection of series in the chart. Read-only. @@ -21475,13 +22121,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.2] */ readonly worksheet: Excel.Worksheet; + /** + * + * Returns or sets a ChartCategoryLabelLevel enumeration constant referring to + the level of where the category labels are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + categoryLabelLevel: number; /** * * Represents the type of the chart. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + /** + * + * Returns or sets the way that blank cells are plotted on a chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + displayBlanksAs: Excel.ChartDisplayBlanksAs | "NotPlotted" | "Zero" | "Interplotted"; /** * * Represents the height, in points, of the chart object. @@ -21510,6 +22171,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name: string; + /** + * + * Returns or sets the way columns or rows are used as data series on the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotBy: Excel.ChartPlotBy | "Rows" | "Columns"; + /** + * + * True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotVisibleOnly: boolean; + /** + * + * Returns or sets a ChartSeriesNameLevel enumeration constant referring to + the level of where the series names are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + seriesNameLevel: number; /** * * Represents whether to display all field buttons on a PivotChart. @@ -21517,6 +22200,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showAllFieldButtons: boolean; + /** + * + * Represents whether to to show the data labels when the value is greater than the maximum value on the value axis. + If value axis became smaller than the size of data points, you can use this property to set whether to show the data labels. + This property applies to 2-D charts only. + * + * [Api set: ExcelApi 1.8] + */ + showDataLabelsOverMaximum: boolean; + /** + * + * Returns or sets the chart style for the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + style: number; /** * * Represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). @@ -21627,6 +22326,24 @@ declare namespace Excel { select?: string; expand?: string; }): Excel.Chart; + /** + * + * Occurs when the chart is activated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onActivated: OfficeExtension.EventHandlers; + /** + * + * Occurs when the chart is deactivated. + * + * [Api set: ExcelApi 1.8] + * + * @eventproperty + */ + readonly onDeactivated: OfficeExtension.EventHandlers; toJSON(): Excel.Interfaces.ChartData; } /** @@ -21763,6 +22480,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ class ChartSeries extends OfficeExtension.ClientObject { + /** + * + * Represents a collection of all dataLabels in the series. + * + * [Api set: ExcelApi 1.8] + */ + readonly dataLabels: Excel.ChartDataLabels; /** * * Represents the formatting of a chart series, which includes fill and line formatting. Read-only. @@ -21784,13 +22508,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ readonly trendlines: Excel.ChartTrendlineCollection; + /** + * + * Returns or sets the group for the specified series. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + axisGroup: Excel.ChartAxisGroup | "Primary" | "Secondary"; /** * * Represents the chart type of a series. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -21799,6 +22530,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ doughnutHoleSize: number; + /** + * + * Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + explosion: number; /** * * Boolean value representing if the series is filtered or not. Not applicable for surface charts. @@ -21806,6 +22544,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ filtered: boolean; + /** + * + * Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + firstSliceAngle: number; /** * * Represents the gap width of a chart series. Only valid on bar and column charts, as well as @@ -21821,6 +22566,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ hasDataLabels: boolean; + /** + * + * True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + invertIfNegative: boolean; /** * * Represents markers background color of a chart series. @@ -21856,6 +22608,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name: string; + /** + * + * Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + overlap: number; /** * * Represents the plot order of a chart series within the chart group. @@ -21863,6 +22622,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ plotOrder: number; + /** + * + * Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + secondPlotSize: number; /** * * Boolean value representing if the series has a shadow or not. @@ -21877,6 +22643,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ smooth: boolean; + /** + * + * Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + splitType: Excel.ChartSplitStype | "SplitByPosition" | "SplitByValue" | "SplitByPercentValue" | "SplitByCustomSplit"; + /** + * + * True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + varyByCategories: boolean; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. * * @remarks @@ -22336,6 +23116,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ readonly title: Excel.ChartAxisTitle; + /** + * + * Represents the alignment for the specified axis tick label. See Excel.ChartTextHorizontalAlignment for detail. + * + * [Api set: ExcelApi 1.8] + */ + alignment: Excel.ChartTickLabelAlignment | "Center" | "Left" | "Right"; /** * * Represents the group for the specified axis. See Excel.ChartAxisGroup for details. Read-only. @@ -22378,6 +23165,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ readonly height: number; + /** + * + * Represents whether value axis crosses the category axis between categories. + * + * [Api set: ExcelApi 1.8] + */ + isBetweenCategories: boolean; /** * * Represents the distance, in points, from the left edge of the axis to the left of chart area. Null if the axis is not visible. Read-only. @@ -22448,6 +23242,41 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ minorUnit: any; + /** + * + * Represents whether an axis is multilevel or not. + * + * [Api set: ExcelApi 1.8] + */ + multiLevel: boolean; + /** + * + * Represents the format code for the axis tick label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat: string; + /** + * + * Represents the distance between the levels of labels, and the distance between the first level and the axis line. The value should be an integer from 0 to 1000. + * + * [Api set: ExcelApi 1.8] + */ + offset: number; + /** + * + * Represents the specified axis position where the other axis crosses. See Excel.ChartAxisPosition for details. + * + * [Api set: ExcelApi 1.8] + */ + position: Excel.ChartAxisPosition | "Automatic" | "Maximum" | "Minimum" | "Custom"; + /** + * + * Represents the specified axis position where the other axis crosses at. Read Only. Set to this property should use SetPositionAt(double) method. + * + * [Api set: ExcelApi 1.8] + */ + readonly positionAt: number; /** * * Represents whether Microsoft Excel plots data points from last to first. @@ -22469,6 +23298,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showDisplayUnitLabel: boolean; + /** + * + * Represents the text orientation of the axis tick label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation: any; /** * * Represents the position of tick-mark labels on the specified axis. See Excel.ChartAxisTickLabelPosition for details. @@ -22550,6 +23386,15 @@ declare namespace Excel { * @param value Custom value of the display unit. */ setCustomDisplayUnit(value: number): void; + /** + * + * Set the specified axis position where the other axis crosses at. + * + * [Api set: ExcelApi 1.8] + * + * @param value Custom value of the crosses at + */ + setPositionAt(value: number): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. * @@ -22580,6 +23425,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ class ChartAxisFormat extends OfficeExtension.ClientObject { + /** + * + * Represents chart fill formatting. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readonly fill: Excel.ChartFill; /** * * Represents the font attributes (font name, font size, color, etc.) for a chart axis element. Read-only. @@ -22673,6 +23525,15 @@ declare namespace Excel { set(properties: Interfaces.ChartAxisTitleUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ set(properties: Excel.ChartAxisTitle): void; + /** + * + * A string value that represents the formula of chart axis title using A1-style notation. + * + * [Api set: ExcelApi 1.8] + * + * @param formula a string that present the formula to set + */ + setFormula(formula: string): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. * @@ -22703,6 +23564,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ class ChartAxisTitleFormat extends OfficeExtension.ClientObject { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + readonly border: Excel.ChartBorder; + /** + * + * Represents chart fill formatting. + * + * [Api set: ExcelApi 1.8] + */ + readonly fill: Excel.ChartFill; /** * * Represents the font attributes, such as font name, font size, color, etc. of chart axis title object. Read-only. @@ -22761,6 +23636,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ readonly format: Excel.ChartDataLabelFormat; + /** + * + * Represents whether data labels automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText: boolean; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the format code for data labels. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -22817,6 +23714,21 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ showValue: boolean; + /** + * + * Represents the text orientation of data labels. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. * * @remarks @@ -22861,6 +23773,56 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ class ChartDataLabel extends OfficeExtension.ClientObject { + /** + * + * Represents the format of chart data label. + * + * [Api set: ExcelApi 1.8] + */ + readonly format: Excel.ChartDataLabelFormat; + /** + * + * Boolean value representing if data label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText: boolean; + /** + * + * String value that represents the formula of chart data label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula: string; + /** + * + * Returns the height, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + readonly height: number; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart data label to the left edge of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left: number; + /** + * + * String value that represents the format code for data label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -22917,6 +23879,42 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showValue: boolean; + /** + * + * String representing the text of the data label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text: string; + /** + * + * Represents the text orientation of chart data label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation: number; + /** + * + * Represents the distance, in points, from the top edge of chart data label to the top of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; + /** + * + * Returns the width, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + readonly width: number; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. * * @remarks @@ -22961,6 +23959,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ class ChartDataLabelFormat extends OfficeExtension.ClientObject { + /** + * + * Represents the border format, which includes color, linestyle, and weight. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readonly border: Excel.ChartBorder; /** * * Represents the fill format of the current chart data label. Read-only. @@ -23242,6 +24247,34 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ class ChartLegendEntry extends OfficeExtension.ClientObject { + /** + * + * Represents the height of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + readonly height: number; + /** + * + * Represents the index of the LegendEntry in the Chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + readonly index: number; + /** + * + * Represents the left of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + readonly left: number; + /** + * + * Represents the top of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + readonly top: number; /** * * Represents the visible of a chart legend entry. @@ -23249,6 +24282,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ visible: boolean; + /** + * + * Represents the width of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + readonly width: number; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. * * @remarks @@ -23338,6 +24378,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ class ChartLegendFormat extends OfficeExtension.ClientObject { + /** + * + * Represents the border format, which includes color, linestyle, and weight. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readonly border: Excel.ChartBorder; /** * * Represents the fill format of an object, which includes background formating information. Read-only. @@ -23732,6 +24779,13 @@ declare namespace Excel { set(properties: Interfaces.ChartBorderUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ set(properties: Excel.ChartBorder): void; + /** + * + * Clear the border format of a chart element. + * + * [Api set: ExcelApi 1.8] + */ + clear(): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. * @@ -23927,6 +24981,27 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ readonly format: Excel.ChartTrendlineFormat; + /** + * + * Represents the label of a chart trendline. + * + * [Api set: ExcelApi 1.8] + */ + readonly label: Excel.ChartTrendlineLabel; + /** + * + * Represents the number of periods that the trendline extends backward. + * + * [Api set: ExcelApi 1.8] + */ + backwardPeriod: number; + /** + * + * Represents the number of periods that the trendline extends forward. + * + * [Api set: ExcelApi 1.8] + */ + forwardPeriod: number; /** * * Represents the intercept value of the trendline. Can be set to a numeric value or an empty string (for automatic values). The returned value is always a number. @@ -23955,6 +25030,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ polynomialOrder: number; + /** + * + * True if the equation for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showEquation: boolean; + /** + * + * True if the R-squared for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showRSquared: boolean; /** * * Represents the type of a chart trendline. @@ -24120,6 +25209,373 @@ declare namespace Excel { }): Excel.ChartTrendlineFormat; toJSON(): Excel.Interfaces.ChartTrendlineFormatData; } + /** + * + * This object represents the attributes for a chart trendline lable object. + * + * [Api set: ExcelApi 1.8] + */ + class ChartTrendlineLabel extends OfficeExtension.ClientObject { + /** + * + * Represents the format of chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + readonly format: Excel.ChartTrendlineLabelFormat; + /** + * + * Boolean value representing if trendline label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText: boolean; + /** + * + * String value that represents the formula of chart trendline label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula: string; + /** + * + * Returns the height, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + readonly height: number; + /** + * + * Represents the horizontal alignment for chart trendline label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of trendline label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart trendline label to the left edge of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left: number; + /** + * + * String value that represents the format code for trendline label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat: string; + /** + * + * String representing the text of the trendline label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text: string; + /** + * + * Represents the text orientation of chart trendline label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation: number; + /** + * + * Represents the distance, in points, from the top edge of chart trendline label to the top of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top: number; + /** + * + * Represents the vertical alignment of chart trendline label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of trendline label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; + /** + * + * Returns the width, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + readonly width: number; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.ChartTrendlineLabel): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ChartTrendlineLabelUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.ChartTrendlineLabel): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.ChartTrendlineLabel` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.ChartTrendlineLabel` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.ChartTrendlineLabel` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.ChartTrendlineLabelLoadOptions): Excel.ChartTrendlineLabel; + load(option?: string | string[]): Excel.ChartTrendlineLabel; + load(option?: { + select?: string; + expand?: string; + }): Excel.ChartTrendlineLabel; + toJSON(): Excel.Interfaces.ChartTrendlineLabelData; + } + /** + * + * Encapsulates the format properties for the chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + class ChartTrendlineLabelFormat extends OfficeExtension.ClientObject { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + readonly border: Excel.ChartBorder; + /** + * + * Represents the fill format of the current chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + readonly fill: Excel.ChartFill; + /** + * + * Represents the font attributes (font name, font size, color, etc.) for a chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + readonly font: Excel.ChartFont; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.ChartTrendlineLabelFormat): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ChartTrendlineLabelFormatUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.ChartTrendlineLabelFormat): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.ChartTrendlineLabelFormat` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.ChartTrendlineLabelFormat` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.ChartTrendlineLabelFormat` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.ChartTrendlineLabelFormatLoadOptions): Excel.ChartTrendlineLabelFormat; + load(option?: string | string[]): Excel.ChartTrendlineLabelFormat; + load(option?: { + select?: string; + expand?: string; + }): Excel.ChartTrendlineLabelFormat; + toJSON(): Excel.Interfaces.ChartTrendlineLabelFormatData; + } + /** + * + * This object represents the attributes for a chart plotArea object. + * + * [Api set: ExcelApi 1.8] + */ + class ChartPlotArea extends OfficeExtension.ClientObject { + /** + * + * Represents the formatting of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + readonly format: Excel.ChartPlotAreaFormat; + /** + * + * Represents the height value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + height: number; + /** + * + * Represents the insideHeight value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideHeight: number; + /** + * + * Represents the insideLeft value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideLeft: number; + /** + * + * Represents the insideTop value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideTop: number; + /** + * + * Represents the insideWidth value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideWidth: number; + /** + * + * Represents the left value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + left: number; + /** + * + * Represents the position of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + position: Excel.ChartPlotAreaPosition | "Automatic" | "Custom"; + /** + * + * Represents the top value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + top: number; + /** + * + * Represents the width value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + width: number; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.ChartPlotArea): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ChartPlotAreaUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.ChartPlotArea): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.ChartPlotArea` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.ChartPlotArea` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.ChartPlotArea` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.ChartPlotAreaLoadOptions): Excel.ChartPlotArea; + load(option?: string | string[]): Excel.ChartPlotArea; + load(option?: { + select?: string; + expand?: string; + }): Excel.ChartPlotArea; + toJSON(): Excel.Interfaces.ChartPlotAreaData; + } + /** + * + * Represents the format properties for chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + class ChartPlotAreaFormat extends OfficeExtension.ClientObject { + /** + * + * Represents the border attributes of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + readonly border: Excel.ChartBorder; + /** + * + * Represents the fill format of an object, which includes background formating information. + * + * [Api set: ExcelApi 1.8] + */ + readonly fill: Excel.ChartFill; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.ChartPlotAreaFormat): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.ChartPlotAreaFormatUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.ChartPlotAreaFormat): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.ChartPlotAreaFormat` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.ChartPlotAreaFormat` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.ChartPlotAreaFormat` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.ChartPlotAreaFormatLoadOptions): Excel.ChartPlotAreaFormat; + load(option?: string | string[]): Excel.ChartPlotAreaFormat; + load(option?: { + select?: string; + expand?: string; + }): Excel.ChartPlotAreaFormat; + toJSON(): Excel.Interfaces.ChartPlotAreaFormatData; + } /** * * Manages sorting operations on Range objects. @@ -24792,6 +26248,18 @@ declare namespace Excel { class PivotTableCollection extends OfficeExtension.ClientObject { /** Gets the loaded child items in this collection. */ readonly items: Excel.PivotTable[]; + /** + * + * Add a Pivottable based on the specified source data and insert it at the top left cell of the destination range. + * + * [Api set: ExcelApi 1.8] + * + * @param name The name of the new PivotTable. + * @param source The source data for the new PivotTable, this can either be a range (or string address including the worksheet name) or a table. + * @param destination The cell in the upper-left corner of the PivotTable report's destination range (the range on the worksheet where the resulting report will be placed). + * @returns Returns the newly inserted PivotTable. + */ + add(name: string, source: Range | string | Table, destination: Range | string): Excel.PivotTable; /** * * Gets the number of pivot tables in the collection. @@ -24854,6 +26322,48 @@ declare namespace Excel { * Our {@link https://docs.microsoft.com/office/dev/add-ins/excel/excel-add-ins-pivottables | how-to guide on working with PivotTables} has detailed walkthroughs, images, and code samples. */ class PivotTable extends OfficeExtension.ClientObject { + /** + * + * The Column Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly columnHierarchies: Excel.RowColumnPivotHierarchyCollection; + /** + * + * The Data Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly dataHierarchies: Excel.DataPivotHierarchyCollection; + /** + * + * The Filter Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly filterHierarchies: Excel.FilterPivotHierarchyCollection; + /** + * + * The Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly hierarchies: Excel.PivotHierarchyCollection; + /** + * + * The PivotLayout describing the layout and visual structure of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly layout: Excel.PivotLayout; + /** + * + * The Row Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + readonly rowHierarchies: Excel.RowColumnPivotHierarchyCollection; /** * * The worksheet containing the current PivotTable. @@ -24889,6 +26399,13 @@ declare namespace Excel { set(properties: Interfaces.PivotTableUpdateData, options?: OfficeExtension.UpdateOptions): void; /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ set(properties: Excel.PivotTable): void; + /** + * + * Deletes the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + delete(): void; /** * * Refreshes the PivotTable. @@ -24919,6 +26436,1234 @@ declare namespace Excel { }): Excel.PivotTable; toJSON(): Excel.Interfaces.PivotTableData; } + /** + * + * Represents the visual layout of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + class PivotLayout extends OfficeExtension.ClientObject { + /** + * + * This property indicates the PivotLayoutType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + layoutType: Excel.PivotLayoutType | "Compact" | "Tabular" | "Outline"; + /** + * + * True if the PivotTable report shows grand totals for columns. + * + * [Api set: ExcelApi 1.8] + */ + showColumnGrandTotals: boolean; + /** + * + * True if the PivotTable report shows grand totals for rows. + * + * [Api set: ExcelApi 1.8] + */ + showRowGrandTotals: boolean; + /** + * + * This property indicates the SubtotalLocationType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + subtotalLocation: Excel.SubtotalLocationType | "AtTop" | "AtBottom" | "Off"; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.PivotLayout): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PivotLayoutUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.PivotLayout): void; + /** + * + * Returns the range where the PivotTable's column labels reside. + * + * [Api set: ExcelApi 1.8] + */ + getColumnLabelRange(): Excel.Range; + /** + * + * Returns the range where the PivotTable's data values reside. + * + * [Api set: ExcelApi 1.8] + */ + getDataBodyRange(): Excel.Range; + /** + * + * Returns the range of the PivotTable's filter area. + * + * [Api set: ExcelApi 1.8] + */ + getFilterAxisRange(): Excel.Range; + /** + * + * Returns the range the PivotTable exists on, excluding the filter area. + * + * [Api set: ExcelApi 1.8] + */ + getRange(): Excel.Range; + /** + * + * Returns the range where the PivotTable's row labels reside. + * + * [Api set: ExcelApi 1.8] + */ + getRowLabelRange(): Excel.Range; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotLayout` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotLayout` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotLayout` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotLayoutLoadOptions): Excel.PivotLayout; + load(option?: string | string[]): Excel.PivotLayout; + load(option?: { + select?: string; + expand?: string; + }): Excel.PivotLayout; + toJSON(): Excel.Interfaces.PivotLayoutData; + } + /** + * + * Represents a collection of all the PivotTables that are part of the workbook or worksheet. + * + * [Api set: ExcelApi 1.8] + */ + class PivotHierarchyCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.PivotHierarchy[]; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a PivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.PivotHierarchy; + /** + * + * Gets a PivotHierarchy by name. If the PivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.PivotHierarchy; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotHierarchyCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotHierarchyCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotHierarchyCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotHierarchyCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.PivotHierarchyCollection; + load(option?: string | string[]): Excel.PivotHierarchyCollection; + load(option?: OfficeExtension.LoadOption): Excel.PivotHierarchyCollection; + toJSON(): Excel.Interfaces.PivotHierarchyCollectionData; + } + /** + * + * Represents the Excel PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + class PivotHierarchy extends OfficeExtension.ClientObject { + /** + * + * Returns the PivotFields associated with the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly fields: Excel.PivotFieldCollection; + /** + * + * Id of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Name of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.PivotHierarchy): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PivotHierarchyUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.PivotHierarchy): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotHierarchy` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotHierarchy` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotHierarchy` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotHierarchyLoadOptions): Excel.PivotHierarchy; + load(option?: string | string[]): Excel.PivotHierarchy; + load(option?: { + select?: string; + expand?: string; + }): Excel.PivotHierarchy; + toJSON(): Excel.Interfaces.PivotHierarchyData; + } + /** + * + * Represents a collection of RowColumnPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + class RowColumnPivotHierarchyCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.RowColumnPivotHierarchy[]; + /** + * + * Adds the PivotHierarchy to the current axis. If the hierarchy is present elsewhere on the row, column, + or filter axis, it will be removed from that location. + * + * [Api set: ExcelApi 1.8] + */ + add(pivotHierarchy: Excel.PivotHierarchy): Excel.RowColumnPivotHierarchy; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a RowColumnPivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.RowColumnPivotHierarchy; + /** + * + * Gets a RowColumnPivotHierarchy by name. If the RowColumnPivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the RowColumnPivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.RowColumnPivotHierarchy; + /** + * + * Removes the PivotHierarchy from the current axis. + * + * [Api set: ExcelApi 1.8] + */ + remove(rowColumnPivotHierarchy: Excel.RowColumnPivotHierarchy): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.RowColumnPivotHierarchyCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.RowColumnPivotHierarchyCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.RowColumnPivotHierarchyCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.RowColumnPivotHierarchyCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.RowColumnPivotHierarchyCollection; + load(option?: string | string[]): Excel.RowColumnPivotHierarchyCollection; + load(option?: OfficeExtension.LoadOption): Excel.RowColumnPivotHierarchyCollection; + toJSON(): Excel.Interfaces.RowColumnPivotHierarchyCollectionData; + } + /** + * + * Represents the Excel RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + class RowColumnPivotHierarchy extends OfficeExtension.ClientObject { + /** + * + * Returns the PivotFields associated with the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly fields: Excel.PivotFieldCollection; + /** + * + * Id of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Name of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** + * + * Position of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position: number; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.RowColumnPivotHierarchy): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.RowColumnPivotHierarchyUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.RowColumnPivotHierarchy): void; + /** + * + * Reset the RowColumnPivotHierarchy back to its default values. + * + * [Api set: ExcelApi 1.8] + */ + setToDefault(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.RowColumnPivotHierarchy` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.RowColumnPivotHierarchy` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.RowColumnPivotHierarchy` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.RowColumnPivotHierarchyLoadOptions): Excel.RowColumnPivotHierarchy; + load(option?: string | string[]): Excel.RowColumnPivotHierarchy; + load(option?: { + select?: string; + expand?: string; + }): Excel.RowColumnPivotHierarchy; + toJSON(): Excel.Interfaces.RowColumnPivotHierarchyData; + } + /** + * + * Represents a collection of FilterPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + class FilterPivotHierarchyCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.FilterPivotHierarchy[]; + /** + * + * Adds the PivotHierarchy to the current axis. If the hierarchy is present elsewhere on the row, column, + or filter axis, it will be removed from that location. + * + * [Api set: ExcelApi 1.8] + */ + add(pivotHierarchy: Excel.PivotHierarchy): Excel.FilterPivotHierarchy; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a FilterPivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.FilterPivotHierarchy; + /** + * + * Gets a FilterPivotHierarchy by name. If the FilterPivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the FilterPivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.FilterPivotHierarchy; + /** + * + * Removes the PivotHierarchy from the current axis. + * + * [Api set: ExcelApi 1.8] + */ + remove(filterPivotHierarchy: Excel.FilterPivotHierarchy): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.FilterPivotHierarchyCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.FilterPivotHierarchyCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.FilterPivotHierarchyCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.FilterPivotHierarchyCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.FilterPivotHierarchyCollection; + load(option?: string | string[]): Excel.FilterPivotHierarchyCollection; + load(option?: OfficeExtension.LoadOption): Excel.FilterPivotHierarchyCollection; + toJSON(): Excel.Interfaces.FilterPivotHierarchyCollectionData; + } + /** + * + * Represents the Excel FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + class FilterPivotHierarchy extends OfficeExtension.ClientObject { + /** + * + * Returns the PivotFields associated with the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly fields: Excel.PivotFieldCollection; + /** + * + * Determines whether to allow multiple filter items. + * + * [Api set: ExcelApi 1.8] + */ + enableMultipleFilterItems: boolean; + /** + * + * Id of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Name of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** + * + * Position of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position: number; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.FilterPivotHierarchy): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.FilterPivotHierarchyUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.FilterPivotHierarchy): void; + /** + * + * Reset the FilterPivotHierarchy back to its default values. + * + * [Api set: ExcelApi 1.8] + */ + setToDefault(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.FilterPivotHierarchy` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.FilterPivotHierarchy` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.FilterPivotHierarchy` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.FilterPivotHierarchyLoadOptions): Excel.FilterPivotHierarchy; + load(option?: string | string[]): Excel.FilterPivotHierarchy; + load(option?: { + select?: string; + expand?: string; + }): Excel.FilterPivotHierarchy; + toJSON(): Excel.Interfaces.FilterPivotHierarchyData; + } + /** + * + * Represents a collection of DataPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + class DataPivotHierarchyCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.DataPivotHierarchy[]; + /** + * + * Adds the PivotHierarchy to the current axis. + * + * [Api set: ExcelApi 1.8] + */ + add(pivotHierarchy: Excel.PivotHierarchy): Excel.DataPivotHierarchy; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a DataPivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.DataPivotHierarchy; + /** + * + * Gets a DataPivotHierarchy by name. If the DataPivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the DataPivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.DataPivotHierarchy; + /** + * + * Removes the PivotHierarchy from the current axis. + * + * [Api set: ExcelApi 1.8] + */ + remove(DataPivotHierarchy: Excel.DataPivotHierarchy): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.DataPivotHierarchyCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.DataPivotHierarchyCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.DataPivotHierarchyCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.DataPivotHierarchyCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.DataPivotHierarchyCollection; + load(option?: string | string[]): Excel.DataPivotHierarchyCollection; + load(option?: OfficeExtension.LoadOption): Excel.DataPivotHierarchyCollection; + toJSON(): Excel.Interfaces.DataPivotHierarchyCollectionData; + } + /** + * + * Represents the Excel DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + class DataPivotHierarchy extends OfficeExtension.ClientObject { + /** + * + * Returns the PivotFields associated with the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly field: Excel.PivotField; + /** + * + * Id of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Name of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** + * + * Number format of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat: string; + /** + * + * Position of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position: number; + /** + * + * Determines whether the data should be sown as a specific summary calculation or not. + * + * [Api set: ExcelApi 1.8] + */ + showAs: Excel.ShowAsRule; + /** + * + * Determines whether to show all items of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + summarizeBy: Excel.AggregationFunction | "Unknown" | "Automatic" | "Sum" | "Count" | "Average" | "Max" | "Min" | "Product" | "CountNumbers" | "StandardDeviation" | "StandardDeviationP" | "Variance" | "VarianceP"; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.DataPivotHierarchy): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.DataPivotHierarchyUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.DataPivotHierarchy): void; + /** + * + * Reset the DataPivotHierarchy back to its default values. + * + * [Api set: ExcelApi 1.8] + */ + setToDefault(): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.DataPivotHierarchy` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.DataPivotHierarchy` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.DataPivotHierarchy` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.DataPivotHierarchyLoadOptions): Excel.DataPivotHierarchy; + load(option?: string | string[]): Excel.DataPivotHierarchy; + load(option?: { + select?: string; + expand?: string; + }): Excel.DataPivotHierarchy; + toJSON(): Excel.Interfaces.DataPivotHierarchyData; + } + /** + * [Api set: ExcelApi 1.8] + */ + interface ShowAsRule { + /** + * + * The Base PivotField to base the ShowAs calculation, if applicable based on the ShowAsCalculation type, else null. + * + * [Api set: ExcelApi 1.8] + */ + baseField?: Excel.PivotField; + /** + * + * The Base Item to base the ShowAs calculation on, if applicable based on the ShowAsCalculation type, else null. + * + * [Api set: ExcelApi 1.8] + */ + baseItem?: Excel.PivotItem; + /** + * + * The ShowAs Calculation to use for the Data PivotField. See Excel.ShowAsCalculation for Details. + * + * [Api set: ExcelApi 1.8] + */ + calculation: Excel.ShowAsCalculation | "Unknown" | "None" | "PercentOfGrandTotal" | "PercentOfRowTotal" | "PercentOfColumnTotal" | "PercentOfParentRowTotal" | "PercentOfParentColumnTotal" | "PercentOfParentTotal" | "PercentOf" | "RunningTotal" | "PercentRunningTotal" | "DifferenceFrom" | "PercentDifferenceFrom" | "RankAscending" | "RankDecending" | "Index"; + } + /** + * + * Represents a collection of all the PivotTables that are part of the workbook or worksheet. + * + * [Api set: ExcelApi 1.8] + */ + class PivotFieldCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.PivotField[]; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a PivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.PivotField; + /** + * + * Gets a PivotHierarchy by name. If the PivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.PivotField; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotFieldCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotFieldCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotFieldCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotFieldCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.PivotFieldCollection; + load(option?: string | string[]): Excel.PivotFieldCollection; + load(option?: OfficeExtension.LoadOption): Excel.PivotFieldCollection; + toJSON(): Excel.Interfaces.PivotFieldCollectionData; + } + /** + * + * Represents the Excel PivotField. + * + * [Api set: ExcelApi 1.8] + */ + class PivotField extends OfficeExtension.ClientObject { + /** + * + * Returns the PivotFields associated with the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + readonly items: Excel.PivotItemCollection; + /** + * + * Id of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Name of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** + * + * Determines whether to show all items of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + showAllItems: boolean; + /** + * + * Subtotals of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + subtotals: Excel.Subtotals; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.PivotField): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PivotFieldUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.PivotField): void; + /** + * + * Sorts the PivotField. If a DataPivotHierarchy is specified, then sort will be applied based on it, if not sort will be based on the PivotField itself. + * + * [Api set: ExcelApi 1.8] + * + * @param sortby Represents whether the sorting is done in an ascending or descending order. + */ + sortByLabels(sortby: Excel.SortBy): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotField` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotField` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotField` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotFieldLoadOptions): Excel.PivotField; + load(option?: string | string[]): Excel.PivotField; + load(option?: { + select?: string; + expand?: string; + }): Excel.PivotField; + toJSON(): Excel.Interfaces.PivotFieldData; + } + /** + * + * Represents a collection of all the Pivot Items related to their parent PivotField. + * + * [Api set: ExcelApi 1.8] + */ + class PivotItemCollection extends OfficeExtension.ClientObject { + /** Gets the loaded child items in this collection. */ + readonly items: Excel.PivotItem[]; + /** + * + * Gets the number of pivot hierarchies in the collection. + * + * [Api set: ExcelApi 1.8] + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets a PivotHierarchy by its name or id. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotTable to be retrieved. + */ + getItem(name: string): Excel.PivotItem; + /** + * + * Gets a PivotHierarchy by name. If the PivotHierarchy does not exist, will return a null object. + * + * [Api set: ExcelApi 1.8] + * + * @param name Name of the PivotHierarchy to be retrieved. + */ + getItemOrNullObject(name: string): Excel.PivotItem; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotItemCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotItemCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotItemCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotItemCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.PivotItemCollection; + load(option?: string | string[]): Excel.PivotItemCollection; + load(option?: OfficeExtension.LoadOption): Excel.PivotItemCollection; + toJSON(): Excel.Interfaces.PivotItemCollectionData; + } + /** + * + * Represents the Excel PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + class PivotItem extends OfficeExtension.ClientObject { + /** + * + * Id of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + readonly id: string; + /** + * + * Determines whether the item is expanded to show child items or if it's collapsed and child items are hidden. + * + * [Api set: ExcelApi 1.8] + */ + isExpanded: boolean; + /** + * + * Name of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + name: string; + /** + * + * Determines whether the PivotItem is visible or not. + * + * [Api set: ExcelApi 1.8] + */ + visible: boolean; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.PivotItem): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PivotItemUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.PivotItem): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotItem` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotItem` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotItem` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotItemLoadOptions): Excel.PivotItem; + load(option?: string | string[]): Excel.PivotItem; + load(option?: { + select?: string; + expand?: string; + }): Excel.PivotItem; + toJSON(): Excel.Interfaces.PivotItemData; + } + /** + * + * Subtotals for the Pivot Field. + * + * [Api set: ExcelApi 1.8] + */ + interface Subtotals { + /** + * + * If Automatic is set to true, then all other values will be ignored when setting the Subtotals. + * + * [Api set: ExcelApi 1.8] + */ + automatic?: boolean; + average?: boolean; + count?: boolean; + countNumbers?: boolean; + max?: boolean; + min?: boolean; + product?: boolean; + standardDeviation?: boolean; + standardDeviationP?: boolean; + sum?: boolean; + variance?: boolean; + varianceP?: boolean; + } + /** + * + * Represents the sort direction. + * + * [Api set: ExcelApi 1.8] + */ + enum SortBy { + /** + * + * Ascending sort. Smallest to largest or A to Z. + * + */ + ascending = "Ascending", + /** + * + * Descending sort. Largest to smallest or Z to A. + * + */ + descending = "Descending", + } + /** + * + * Aggregation Function for the Data Pivot Field. + * + * [Api set: ExcelApi 1.8] + */ + enum AggregationFunction { + /** + * + * Aggregation function is unknown or unsupported. + * + */ + unknown = "Unknown", + /** + * + * Excel will automatically select the aggregation based on the data items. + * + */ + automatic = "Automatic", + /** + * + * Aggregate using the sum of the data, equivalent to the SUM function. + * + */ + sum = "Sum", + /** + * + * Aggregate using the count of items in the data, equivalent to the COUNTA function. + * + */ + count = "Count", + /** + * + * Aggregate using the average of the data, equivalent to the AVERAGE function. + * + */ + average = "Average", + /** + * + * Aggregate using the maximum value of the data, equivalent to the MAX function. + * + */ + max = "Max", + /** + * + * Aggregate using the minimum value of the data, equivalent to the MIN function. + * + */ + min = "Min", + /** + * + * Aggregate using the product of the data, equivalent to the PRODUCT function. + * + */ + product = "Product", + /** + * + * Aggregate using the count of numbers in the data, equivalent to the COUNTA function. + * + */ + countNumbers = "CountNumbers", + /** + * + * Aggregate using the standard deviation of the data, equivalent to the STDEV function. + * + */ + standardDeviation = "StandardDeviation", + /** + * + * Aggregate using the standard deviation of the data, equivalent to the STDEVP function. + * + */ + standardDeviationP = "StandardDeviationP", + /** + * + * Aggregate using the variance of the data, equivalent to the VAR function. + * + */ + variance = "Variance", + /** + * + * Aggregate using the variance of the data, equivalent to the VARP function. + * + */ + varianceP = "VarianceP", + } + /** + * + * The ShowAs Calculation function for the Data Pivot Field. + * + * [Api set: ExcelApi 1.8] + */ + enum ShowAsCalculation { + /** + * + * Calculation is unknown or unsupported. + * + */ + unknown = "Unknown", + /** + * + * No calculation is applied. + * + */ + none = "None", + /** + * + * Percent of the grand total. + * + */ + percentOfGrandTotal = "PercentOfGrandTotal", + /** + * + * Percent of the row total. + * + */ + percentOfRowTotal = "PercentOfRowTotal", + /** + * + * Percent of the column total. + * + */ + percentOfColumnTotal = "PercentOfColumnTotal", + /** + * + * Percent of the row total for the specified Base Field. + * + */ + percentOfParentRowTotal = "PercentOfParentRowTotal", + /** + * + * Percent of the column total for the specified Base Field. + * + */ + percentOfParentColumnTotal = "PercentOfParentColumnTotal", + /** + * + * Percent of the grand total for the specified Base Field. + * + */ + percentOfParentTotal = "PercentOfParentTotal", + /** + * + * Percent of the specified Base Field and Base Item. + * + */ + percentOf = "PercentOf", + /** + * + * Running Total of the specified Base Field. + * + */ + runningTotal = "RunningTotal", + /** + * + * Percent Running Total of the specified Base Field. + * + */ + percentRunningTotal = "PercentRunningTotal", + /** + * + * Difference from the specified Base Field and Base Item. + * + */ + differenceFrom = "DifferenceFrom", + /** + * + * Difference from the specified Base Field and Base Item. + * + */ + percentDifferenceFrom = "PercentDifferenceFrom", + /** + * + * Ascending Rank of the specified Base Field. + * + */ + rankAscending = "RankAscending", + /** + * + * Descending Rank of the specified Base Field. + * + */ + rankDecending = "RankDecending", + /** + * + * Calculates the values as follows: + ((value in cell) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total)) + * + */ + index = "Index", + } /** * * Represents workbook properties. @@ -26815,6 +29560,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ readonly font: Excel.RangeFont; + /** + * + * Indicates if text is automatically indented when the text alignment in a cell is set to equal distribution. + * + * [Api set: ExcelApi 1.8] + */ + autoIndent: boolean; /** * * Indicates if the style is a built-in style. @@ -26927,6 +29679,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ shrinkToFit: boolean; + /** + * + * The text orientation for the style. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation: number; /** * * Represents the vertical alignment for the style. See Excel.VerticalAlignment for details. @@ -27299,6 +30058,13 @@ declare namespace Excel { plus = "Plus", picture = "Picture", } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartPlotAreaPosition { + automatic = "Automatic", + custom = "Custom", + } /** * * Specifies whether the series are by rows or by columns. On Desktop, the "auto" option will inspect the source data shape to automatically guess whether the data is by rows or columns; on Excel Online, "auto" will simply default to "columns". @@ -27341,6 +30107,14 @@ declare namespace Excel { justify = "Justify", distributed = "Distributed", } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartTickLabelAlignment { + center = "Center", + left = "Left", + right = "Right", + } /** * [Api set: ExcelApi 1.1] */ @@ -27349,15 +30123,9 @@ declare namespace Excel { columnClustered = "ColumnClustered", columnStacked = "ColumnStacked", columnStacked100 = "ColumnStacked100", - _3DColumnClustered = "3DColumnClustered", - _3DColumnStacked = "3DColumnStacked", - _3DColumnStacked100 = "3DColumnStacked100", barClustered = "BarClustered", barStacked = "BarStacked", barStacked100 = "BarStacked100", - _3DBarClustered = "3DBarClustered", - _3DBarStacked = "3DBarStacked", - _3DBarStacked100 = "3DBarStacked100", lineStacked = "LineStacked", lineStacked100 = "LineStacked100", lineMarkers = "LineMarkers", @@ -27365,7 +30133,6 @@ declare namespace Excel { lineMarkersStacked100 = "LineMarkersStacked100", pieOfPie = "PieOfPie", pieExploded = "PieExploded", - _3DPieExploded = "3DPieExploded", barOfPie = "BarOfPie", xyscatterSmooth = "XYScatterSmooth", xyscatterSmoothNoMarkers = "XYScatterSmoothNoMarkers", @@ -27373,8 +30140,6 @@ declare namespace Excel { xyscatterLinesNoMarkers = "XYScatterLinesNoMarkers", areaStacked = "AreaStacked", areaStacked100 = "AreaStacked100", - _3DAreaStacked = "3DAreaStacked", - _3DAreaStacked100 = "3DAreaStacked100", doughnutExploded = "DoughnutExploded", radarMarkers = "RadarMarkers", radarFilled = "RadarFilled", @@ -27409,19 +30174,20 @@ declare namespace Excel { pyramidBarStacked = "PyramidBarStacked", pyramidBarStacked100 = "PyramidBarStacked100", pyramidCol = "PyramidCol", - _3DColumn = "3DColumn", line = "Line", - _3DLine = "3DLine", - _3DPie = "3DPie", pie = "Pie", xyscatter = "XYScatter", - _3DArea = "3DArea", area = "Area", doughnut = "Doughnut", radar = "Radar", histogram = "Histogram", + boxwhisker = "Boxwhisker", pareto = "Pareto", regionMap = "RegionMap", + treemap = "Treemap", + waterfall = "Waterfall", + sunburst = "Sunburst", + funnel = "Funnel", } /** * [Api set: ExcelApi 1.1] @@ -27430,6 +30196,52 @@ declare namespace Excel { none = "None", single = "Single", } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartDisplayBlanksAs { + notPlotted = "NotPlotted", + zero = "Zero", + interplotted = "Interplotted", + } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartPlotBy { + rows = "Rows", + columns = "Columns", + } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartSplitStype { + splitByPosition = "SplitByPosition", + splitByValue = "SplitByValue", + splitByPercentValue = "SplitByPercentValue", + splitByCustomSplit = "SplitByCustomSplit", + } + /** + * [Api set: ExcelApi 1.8] + */ + enum ChartColorScheme { + colorfulPalette1 = "ColorfulPalette1", + colorfulPalette2 = "ColorfulPalette2", + colorfulPalette3 = "ColorfulPalette3", + colorfulPalette4 = "ColorfulPalette4", + monochromaticPalette1 = "MonochromaticPalette1", + monochromaticPalette2 = "MonochromaticPalette2", + monochromaticPalette3 = "MonochromaticPalette3", + monochromaticPalette4 = "MonochromaticPalette4", + monochromaticPalette5 = "MonochromaticPalette5", + monochromaticPalette6 = "MonochromaticPalette6", + monochromaticPalette7 = "MonochromaticPalette7", + monochromaticPalette8 = "MonochromaticPalette8", + monochromaticPalette9 = "MonochromaticPalette9", + monochromaticPalette10 = "MonochromaticPalette10", + monochromaticPalette11 = "MonochromaticPalette11", + monochromaticPalette12 = "MonochromaticPalette12", + monochromaticPalette13 = "MonochromaticPalette13", + } /** * [Api set: ExcelApi 1.7] */ @@ -27751,6 +30563,101 @@ declare namespace Excel { single = "Single", double = "Double", } + /** + * + * Represents Data validation type enum. + * + * [Api set: ExcelApi 1.8] + */ + enum DataValidationType { + /** + * + * None means allow any value and so there is no data validation in the range. + * + */ + none = "None", + /** + * + * Whole number data validation type + * + */ + wholeNumber = "WholeNumber", + /** + * + * Decimal data validation type + * + */ + decimal = "Decimal", + /** + * + * List data validation type + * + */ + list = "List", + /** + * + * Date data validation type + * + */ + date = "Date", + /** + * + * Time data validation type + * + */ + time = "Time", + /** + * + * Text length data validation type + * + */ + textLength = "TextLength", + /** + * + * Custom data validation type + * + */ + custom = "Custom", + /** + * + * Inconsistent means that the range has inconsistent data validation (there are different rules on different cells) + * + */ + inconsistent = "Inconsistent", + /** + * + * MixedCriteria means that the range has data validation present on some but not all cells + * + */ + mixedCriteria = "MixedCriteria", + } + /** + * + * Represents Data validation operator enum. + * + * [Api set: ExcelApi 1.8] + */ + enum DataValidationOperator { + between = "Between", + notBetween = "NotBetween", + equalTo = "EqualTo", + notEqualTo = "NotEqualTo", + greaterThan = "GreaterThan", + lessThan = "LessThan", + greaterThanOrEqualTo = "GreaterThanOrEqualTo", + lessThanOrEqualTo = "LessThanOrEqualTo", + } + /** + * + * Represents Data validation error alert style. The default is "Stop". + * + * [Api set: ExcelApi 1.8] + */ + enum DataValidationAlertStyle { + stop = "Stop", + warning = "Warning", + information = "Information", + } /** * [Api set: ExcelApi 1.1] */ @@ -27975,7 +30882,6 @@ declare namespace Excel { justify = "Justify", distributed = "Distributed", } - /** * [Api set: ExcelApi 1.7] */ @@ -28162,6 +31068,18 @@ declare namespace Excel { * */ tableDeleted = "TableDeleted", + /** + * + * TableFiltered represents the type of event registered on table or TableCollection, and occurs when data of table is filtered. + * + */ + tableFiltered = "TableFiltered", + /** + * + * WorksheetFiltered represents the type of event registered on worksheet or WorksheetCollection, and occurs when data of autofilter in the worksheet is filtered. + * + */ + worksheetFiltered = "WorksheetFiltered", /** * * ShapeActivated represents the type of event that is registered on Shape, and occurs when shape activates. @@ -28174,6 +31092,12 @@ declare namespace Excel { * */ shapeDeactivated = "ShapeDeactivated", + /** + * + * VisualChange represents the type of event registered on Visual, and occurs when there is a visual change. + * + */ + visualChange = "VisualChange", } /** * [Api set: ExcelApi 1.7] @@ -28196,6 +31120,52 @@ declare namespace Excel { manager = "Manager", company = "Company", } + /** + * [Api set: ExcelApi 1.8] + */ + enum SubtotalLocationType { + /** + * + * Subtotals are at the top. + * + */ + atTop = "AtTop", + /** + * + * Subtotals are at the bottom. + * + */ + atBottom = "AtBottom", + /** + * + * Subtotals are off. + * + */ + off = "Off", + } + /** + * [Api set: ExcelApi 1.8] + */ + enum PivotLayoutType { + /** + * + * A horizontally compressed form with labels from the next field in the same column. + * + */ + compact = "Compact", + /** + * + * Inner fields' items are always on a new line relative to the outer fields' items. + * + */ + tabular = "Tabular", + /** + * + * Inner fields' items are on same row as outer fields' items and subtotals are always on the bottom. + * + */ + outline = "Outline", + } /** * [Api set: ExcelApi 1.7] */ @@ -32140,6 +35110,16 @@ declare namespace Excel { */ $skip?: number; } + /** An interface for updating data on the Runtime object, for use in "runtime.set({ ... })". */ + interface RuntimeUpdateData { + /** + * + * Turn on/off JavaScript events in current taskpane or content add-in. + * + * [Api set: ExcelApi 1.8] + */ + enableEvents?: boolean; + } /** An interface for updating data on the Application object, for use in "application.set({ ... })". */ interface ApplicationUpdateData { /** @@ -32176,6 +35156,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ position?: number; + /** + * + * Gets or sets the worksheet's gridlines flag. + This flag determines whether gridlines are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showGridlines?: boolean; + /** + * + * Gets or sets the worksheet's headings flag. + This flag determines whether headings are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showHeadings?: boolean; /** * * Returns or sets the standard (default) width of all the columns in the worksheet. @@ -32207,6 +35203,13 @@ declare namespace Excel { } /** An interface for updating data on the Range object, for use in "range.set({ ... })". */ interface RangeUpdateData { + /** + * + * Returns a data validation object. + * + * [Api set: ExcelApi 1.8] + */ + dataValidation?: Excel.Interfaces.DataValidationUpdateData; /** * * Returns a format object, encapsulating the range's font, fill, borders, alignment, and other properties. @@ -32486,6 +35489,37 @@ declare namespace Excel { */ values?: any[][]; } + /** An interface for updating data on the DataValidation object, for use in "dataValidation.set({ ... })". */ + interface DataValidationUpdateData { + /** + * + * Error alert when user enters invalid data. + * + * [Api set: ExcelApi 1.8] + */ + errorAlert?: Excel.DataValidationErrorAlert; + /** + * + * Ignore blanks: no data validation will be performed on blank cells, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + ignoreBlanks?: boolean; + /** + * + * Prompt when users select a cell. + * + * [Api set: ExcelApi 1.8] + */ + prompt?: Excel.DataValidationPrompt; + /** + * + * Data Validation rule that contains different type of data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + rule?: Excel.DataValidationRule; + } /** An interface for updating data on the RangeFormat object, for use in "rangeFormat.set({ ... })". */ interface RangeFormatUpdateData { /** @@ -32710,18 +35744,40 @@ declare namespace Excel { legend?: Excel.Interfaces.ChartLegendUpdateData; /** * + * Represents the plotArea for the chart. + * + * [Api set: ExcelApi 1.8] + */ + plotArea?: Excel.Interfaces.ChartPlotAreaUpdateData; + /** + * * Represents the title of the specified chart, including the text, visibility, position, and formating of the title. * * [Api set: ExcelApi 1.1] */ title?: Excel.Interfaces.ChartTitleUpdateData; + /** + * + * Returns or sets a ChartCategoryLabelLevel enumeration constant referring to + the level of where the category labels are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + categoryLabelLevel?: number; /** * * Represents the type of the chart. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + /** + * + * Returns or sets the way that blank cells are plotted on a chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + displayBlanksAs?: Excel.ChartDisplayBlanksAs | "NotPlotted" | "Zero" | "Interplotted"; /** * * Represents the height, in points, of the chart object. @@ -32743,6 +35799,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: string; + /** + * + * Returns or sets the way columns or rows are used as data series on the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotBy?: Excel.ChartPlotBy | "Rows" | "Columns"; + /** + * + * True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotVisibleOnly?: boolean; + /** + * + * Returns or sets a ChartSeriesNameLevel enumeration constant referring to + the level of where the series names are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + seriesNameLevel?: number; /** * * Represents whether to display all field buttons on a PivotChart. @@ -32750,6 +35828,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showAllFieldButtons?: boolean; + /** + * + * Represents whether to to show the data labels when the value is greater than the maximum value on the value axis. + If value axis became smaller than the size of data points, you can use this property to set whether to show the data labels. + This property applies to 2-D charts only. + * + * [Api set: ExcelApi 1.8] + */ + showDataLabelsOverMaximum?: boolean; + /** + * + * Returns or sets the chart style for the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + style?: number; /** * * Represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). @@ -32788,6 +35882,13 @@ declare namespace Excel { } /** An interface for updating data on the ChartSeries object, for use in "chartSeries.set({ ... })". */ interface ChartSeriesUpdateData { + /** + * + * Represents a collection of all dataLabels in the series. + * + * [Api set: ExcelApi 1.8] + */ + dataLabels?: Excel.Interfaces.ChartDataLabelsUpdateData; /** * * Represents the formatting of a chart series, which includes fill and line formatting. @@ -32795,13 +35896,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ format?: Excel.Interfaces.ChartSeriesFormatUpdateData; + /** + * + * Returns or sets the group for the specified series. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + axisGroup?: Excel.ChartAxisGroup | "Primary" | "Secondary"; /** * * Represents the chart type of a series. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -32810,6 +35918,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ doughnutHoleSize?: number; + /** + * + * Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + explosion?: number; /** * * Boolean value representing if the series is filtered or not. Not applicable for surface charts. @@ -32817,6 +35932,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ filtered?: boolean; + /** + * + * Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + firstSliceAngle?: number; /** * * Represents the gap width of a chart series. Only valid on bar and column charts, as well as @@ -32832,6 +35954,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ hasDataLabels?: boolean; + /** + * + * True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + invertIfNegative?: boolean; /** * * Represents markers background color of a chart series. @@ -32867,6 +35996,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: string; + /** + * + * Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + overlap?: number; /** * * Represents the plot order of a chart series within the chart group. @@ -32874,6 +36010,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ plotOrder?: number; + /** + * + * Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + secondPlotSize?: number; /** * * Boolean value representing if the series has a shadow or not. @@ -32888,6 +36031,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ smooth?: boolean; + /** + * + * Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + splitType?: Excel.ChartSplitStype | "SplitByPosition" | "SplitByValue" | "SplitByPercentValue" | "SplitByCustomSplit"; + /** + * + * True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + varyByCategories?: boolean; } /** An interface for updating data on the ChartSeriesFormat object, for use in "chartSeriesFormat.set({ ... })". */ interface ChartSeriesFormatUpdateData { @@ -33019,6 +36176,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ title?: Excel.Interfaces.ChartAxisTitleUpdateData; + /** + * + * Represents the alignment for the specified axis tick label. See Excel.ChartTextHorizontalAlignment for detail. + * + * [Api set: ExcelApi 1.8] + */ + alignment?: Excel.ChartTickLabelAlignment | "Center" | "Left" | "Right"; /** * * Returns or sets the base unit for the specified category axis. @@ -33047,6 +36211,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ displayUnit?: Excel.ChartAxisDisplayUnit | "None" | "Hundreds" | "Thousands" | "TenThousands" | "HundredThousands" | "Millions" | "TenMillions" | "HundredMillions" | "Billions" | "Trillions" | "Custom"; + /** + * + * Represents whether value axis crosses the category axis between categories. + * + * [Api set: ExcelApi 1.8] + */ + isBetweenCategories?: boolean; /** * * Represents the base of the logarithm when using logarithmic scales. @@ -33110,6 +36281,34 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ minorUnit?: any; + /** + * + * Represents whether an axis is multilevel or not. + * + * [Api set: ExcelApi 1.8] + */ + multiLevel?: boolean; + /** + * + * Represents the format code for the axis tick label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * Represents the distance between the levels of labels, and the distance between the first level and the axis line. The value should be an integer from 0 to 1000. + * + * [Api set: ExcelApi 1.8] + */ + offset?: number; + /** + * + * Represents the specified axis position where the other axis crosses. See Excel.ChartAxisPosition for details. + * + * [Api set: ExcelApi 1.8] + */ + position?: Excel.ChartAxisPosition | "Automatic" | "Maximum" | "Minimum" | "Custom"; /** * * Represents whether Microsoft Excel plots data points from last to first. @@ -33131,6 +36330,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showDisplayUnitLabel?: boolean; + /** + * + * Represents the text orientation of the axis tick label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: any; /** * * Represents the position of tick-mark labels on the specified axis. See Excel.ChartAxisTickLabelPosition for details. @@ -33203,6 +36409,13 @@ declare namespace Excel { } /** An interface for updating data on the ChartAxisTitleFormat object, for use in "chartAxisTitleFormat.set({ ... })". */ interface ChartAxisTitleFormatUpdateData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderUpdateData; /** * * Represents the font attributes, such as font name, font size, color, etc. of chart axis title object. @@ -33220,6 +36433,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ format?: Excel.Interfaces.ChartDataLabelFormatUpdateData; + /** + * + * Represents whether data labels automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the format code for data labels. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -33276,9 +36511,67 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ showValue?: boolean; + /** + * + * Represents the text orientation of data labels. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; } /** An interface for updating data on the ChartDataLabel object, for use in "chartDataLabel.set({ ... })". */ interface ChartDataLabelUpdateData { + /** + * + * Represents the format of chart data label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartDataLabelFormatUpdateData; + /** + * + * Boolean value representing if data label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart data label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: string; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart data label to the left edge of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * String value that represents the format code for data label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -33335,9 +36628,45 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showValue?: boolean; + /** + * + * String representing the text of the data label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: string; + /** + * + * Represents the text orientation of chart data label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the distance, in points, from the top edge of chart data label to the top of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; } /** An interface for updating data on the ChartDataLabelFormat object, for use in "chartDataLabelFormat.set({ ... })". */ interface ChartDataLabelFormatUpdateData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderUpdateData; /** * * Represents the font attributes (font name, font size, color, etc.) for a chart data label. @@ -33455,6 +36784,13 @@ declare namespace Excel { } /** An interface for updating data on the ChartLegendFormat object, for use in "chartLegendFormat.set({ ... })". */ interface ChartLegendFormatUpdateData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderUpdateData; /** * * Represents the font attributes such as font name, font size, color, etc. of a chart legend. @@ -33672,6 +37008,27 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ format?: Excel.Interfaces.ChartTrendlineFormatUpdateData; + /** + * + * Represents the label of a chart trendline. + * + * [Api set: ExcelApi 1.8] + */ + label?: Excel.Interfaces.ChartTrendlineLabelUpdateData; + /** + * + * Represents the number of periods that the trendline extends backward. + * + * [Api set: ExcelApi 1.8] + */ + backwardPeriod?: number; + /** + * + * Represents the number of periods that the trendline extends forward. + * + * [Api set: ExcelApi 1.8] + */ + forwardPeriod?: number; /** * * Represents the intercept value of the trendline. Can be set to a numeric value or an empty string (for automatic values). The returned value is always a number. @@ -33700,6 +37057,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ polynomialOrder?: number; + /** + * + * True if the equation for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showEquation?: boolean; + /** + * + * True if the R-squared for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showRSquared?: boolean; /** * * Represents the type of a chart trendline. @@ -33722,6 +37093,181 @@ declare namespace Excel { */ line?: Excel.Interfaces.ChartLineFormatUpdateData; } + /** An interface for updating data on the ChartTrendlineLabel object, for use in "chartTrendlineLabel.set({ ... })". */ + interface ChartTrendlineLabelUpdateData { + /** + * + * Represents the format of chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartTrendlineLabelFormatUpdateData; + /** + * + * Boolean value representing if trendline label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart trendline label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: string; + /** + * + * Represents the horizontal alignment for chart trendline label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of trendline label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart trendline label to the left edge of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * String value that represents the format code for trendline label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * String representing the text of the trendline label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: string; + /** + * + * Represents the text orientation of chart trendline label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the distance, in points, from the top edge of chart trendline label to the top of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the vertical alignment of chart trendline label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of trendline label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; + } + /** An interface for updating data on the ChartTrendlineLabelFormat object, for use in "chartTrendlineLabelFormat.set({ ... })". */ + interface ChartTrendlineLabelFormatUpdateData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderUpdateData; + /** + * + * Represents the font attributes (font name, font size, color, etc.) for a chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + font?: Excel.Interfaces.ChartFontUpdateData; + } + /** An interface for updating data on the ChartPlotArea object, for use in "chartPlotArea.set({ ... })". */ + interface ChartPlotAreaUpdateData { + /** + * + * Represents the formatting of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartPlotAreaFormatUpdateData; + /** + * + * Represents the height value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + height?: number; + /** + * + * Represents the insideHeight value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideHeight?: number; + /** + * + * Represents the insideLeft value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideLeft?: number; + /** + * + * Represents the insideTop value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideTop?: number; + /** + * + * Represents the insideWidth value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideWidth?: number; + /** + * + * Represents the left value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * Represents the position of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + position?: Excel.ChartPlotAreaPosition | "Automatic" | "Custom"; + /** + * + * Represents the top value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the width value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + width?: number; + } + /** An interface for updating data on the ChartPlotAreaFormat object, for use in "chartPlotAreaFormat.set({ ... })". */ + interface ChartPlotAreaFormatUpdateData { + /** + * + * Represents the border attributes of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderUpdateData; + } /** An interface for updating data on the CustomXmlPartScopedCollection object, for use in "customXmlPartScopedCollection.set({ ... })". */ interface CustomXmlPartScopedCollectionUpdateData { items?: Excel.Interfaces.CustomXmlPartData[]; @@ -33744,6 +37290,205 @@ declare namespace Excel { */ name?: string; } + /** An interface for updating data on the PivotLayout object, for use in "pivotLayout.set({ ... })". */ + interface PivotLayoutUpdateData { + /** + * + * This property indicates the PivotLayoutType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + layoutType?: Excel.PivotLayoutType | "Compact" | "Tabular" | "Outline"; + /** + * + * True if the PivotTable report shows grand totals for columns. + * + * [Api set: ExcelApi 1.8] + */ + showColumnGrandTotals?: boolean; + /** + * + * True if the PivotTable report shows grand totals for rows. + * + * [Api set: ExcelApi 1.8] + */ + showRowGrandTotals?: boolean; + /** + * + * This property indicates the SubtotalLocationType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + subtotalLocation?: Excel.SubtotalLocationType | "AtTop" | "AtBottom" | "Off"; + } + /** An interface for updating data on the PivotHierarchyCollection object, for use in "pivotHierarchyCollection.set({ ... })". */ + interface PivotHierarchyCollectionUpdateData { + items?: Excel.Interfaces.PivotHierarchyData[]; + } + /** An interface for updating data on the PivotHierarchy object, for use in "pivotHierarchy.set({ ... })". */ + interface PivotHierarchyUpdateData { + /** + * + * Name of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + } + /** An interface for updating data on the RowColumnPivotHierarchyCollection object, for use in "rowColumnPivotHierarchyCollection.set({ ... })". */ + interface RowColumnPivotHierarchyCollectionUpdateData { + items?: Excel.Interfaces.RowColumnPivotHierarchyData[]; + } + /** An interface for updating data on the RowColumnPivotHierarchy object, for use in "rowColumnPivotHierarchy.set({ ... })". */ + interface RowColumnPivotHierarchyUpdateData { + /** + * + * Name of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Position of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + } + /** An interface for updating data on the FilterPivotHierarchyCollection object, for use in "filterPivotHierarchyCollection.set({ ... })". */ + interface FilterPivotHierarchyCollectionUpdateData { + items?: Excel.Interfaces.FilterPivotHierarchyData[]; + } + /** An interface for updating data on the FilterPivotHierarchy object, for use in "filterPivotHierarchy.set({ ... })". */ + interface FilterPivotHierarchyUpdateData { + /** + * + * Determines whether to allow multiple filter items. + * + * [Api set: ExcelApi 1.8] + */ + enableMultipleFilterItems?: boolean; + /** + * + * Name of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Position of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + } + /** An interface for updating data on the DataPivotHierarchyCollection object, for use in "dataPivotHierarchyCollection.set({ ... })". */ + interface DataPivotHierarchyCollectionUpdateData { + items?: Excel.Interfaces.DataPivotHierarchyData[]; + } + /** An interface for updating data on the DataPivotHierarchy object, for use in "dataPivotHierarchy.set({ ... })". */ + interface DataPivotHierarchyUpdateData { + /** + * + * Returns the PivotFields associated with the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + field?: Excel.Interfaces.PivotFieldUpdateData; + /** + * + * Name of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Number format of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * Position of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + /** + * + * Determines whether the data should be sown as a specific summary calculation or not. + * + * [Api set: ExcelApi 1.8] + */ + showAs?: Excel.ShowAsRule; + /** + * + * Determines whether to show all items of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + summarizeBy?: Excel.AggregationFunction | "Unknown" | "Automatic" | "Sum" | "Count" | "Average" | "Max" | "Min" | "Product" | "CountNumbers" | "StandardDeviation" | "StandardDeviationP" | "Variance" | "VarianceP"; + } + /** An interface for updating data on the PivotFieldCollection object, for use in "pivotFieldCollection.set({ ... })". */ + interface PivotFieldCollectionUpdateData { + items?: Excel.Interfaces.PivotFieldData[]; + } + /** An interface for updating data on the PivotField object, for use in "pivotField.set({ ... })". */ + interface PivotFieldUpdateData { + /** + * + * Name of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Determines whether to show all items of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + showAllItems?: boolean; + /** + * + * Subtotals of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + subtotals?: Excel.Subtotals; + } + /** An interface for updating data on the PivotItemCollection object, for use in "pivotItemCollection.set({ ... })". */ + interface PivotItemCollectionUpdateData { + items?: Excel.Interfaces.PivotItemData[]; + } + /** An interface for updating data on the PivotItem object, for use in "pivotItem.set({ ... })". */ + interface PivotItemUpdateData { + /** + * + * Determines whether the item is expanded to show child items or if it's collapsed and child items are hidden. + * + * [Api set: ExcelApi 1.8] + */ + isExpanded?: boolean; + /** + * + * Name of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Determines whether the PivotItem is visible or not. + * + * [Api set: ExcelApi 1.8] + */ + visible?: boolean; + } /** An interface for updating data on the DocumentProperties object, for use in "documentProperties.set({ ... })". */ interface DocumentPropertiesUpdateData { /** @@ -34379,6 +38124,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ font?: Excel.Interfaces.RangeFontUpdateData; + /** + * + * Indicates if text is automatically indented when the text alignment in a cell is set to equal distribution. + * + * [Api set: ExcelApi 1.8] + */ + autoIndent?: boolean; /** * * Indicates if the formula will be hidden when the worksheet is protected. @@ -34477,6 +38229,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ shrinkToFit?: boolean; + /** + * + * The text orientation for the style. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; /** * * Represents the vertical alignment for the style. See Excel.VerticalAlignment for details. @@ -34496,6 +38255,16 @@ declare namespace Excel { interface StyleCollectionUpdateData { items?: Excel.Interfaces.StyleData[]; } + /** An interface describing the data returned by calling "runtime.toJSON()". */ + interface RuntimeData { + /** + * + * Turn on/off JavaScript events in current taskpane or content add-in. + * + * [Api set: ExcelApi 1.8] + */ + enableEvents?: boolean; + } /** An interface describing the data returned by calling "application.toJSON()". */ interface ApplicationData { /** @@ -34592,6 +38361,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ name?: string; + /** + * + * True if the workbook is open in Read-only mode. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readOnly?: boolean; } /** An interface describing the data returned by calling "workbookProtection.toJSON()". */ interface WorkbookProtectionData { @@ -34603,6 +38379,16 @@ declare namespace Excel { */ protected?: boolean; } + /** An interface describing the data returned by calling "workbookCreated.toJSON()". */ + interface WorkbookCreatedData { + /** + * + * Returns a value that uniquely identifies the WorkbookCreated object. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + } /** An interface describing the data returned by calling "worksheet.toJSON()". */ interface WorksheetData { /** @@ -34661,6 +38447,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ position?: number; + /** + * + * Gets or sets the worksheet's gridlines flag. + This flag determines whether gridlines are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showGridlines?: boolean; + /** + * + * Gets or sets the worksheet's headings flag. + This flag determines whether headings are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showHeadings?: boolean; /** * * Returns the standard (default) height of all the rows in the worksheet, in points. Read-only. @@ -34725,6 +38527,13 @@ declare namespace Excel { conditionalFormats?: Excel.Interfaces.ConditionalFormatData[]; /** * + * Returns a data validation object. + * + * [Api set: ExcelApi 1.8] + */ + dataValidation?: Excel.Interfaces.DataValidationData; + /** + * * Returns a format object, encapsulating the range's font, fill, borders, alignment, and other properties. Read-only. * * [Api set: ExcelApi 1.1] @@ -35182,6 +38991,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ id?: string; + /** + * + * Returns a numeric id. + * + * [Api set: ExcelApi 1.8] + */ + legacyId?: string; /** * * Name of the table. @@ -35295,6 +39111,53 @@ declare namespace Excel { */ values?: any[][]; } + /** An interface describing the data returned by calling "dataValidation.toJSON()". */ + interface DataValidationData { + /** + * + * Error alert when user enters invalid data. + * + * [Api set: ExcelApi 1.8] + */ + errorAlert?: Excel.DataValidationErrorAlert; + /** + * + * Ignore blanks: no data validation will be performed on blank cells, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + ignoreBlanks?: boolean; + /** + * + * Prompt when users select a cell. + * + * [Api set: ExcelApi 1.8] + */ + prompt?: Excel.DataValidationPrompt; + /** + * + * Data Validation rule that contains different type of data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + rule?: Excel.DataValidationRule; + /** + * + * Type of the data validation, see Excel.DataValidationType for details. + * + * [Api set: ExcelApi 1.8] + */ + type?: Excel.DataValidationType | "None" | "WholeNumber" | "Decimal" | "List" | "Date" | "Time" | "TextLength" | "Custom" | "Inconsistent" | "MixedCriteria"; + /** + * + * Represents if all cell values are valid according to the data validation rules. + Returns true if all cell values are valid, or false if all cell values are invalid. + Returns null if there are both valid and invalid cell values within the range. + * + * [Api set: ExcelApi 1.8] + */ + valid?: boolean; + } /** An interface describing the data returned by calling "rangeFormat.toJSON()". */ interface RangeFormatData { /** @@ -35533,6 +39396,13 @@ declare namespace Excel { legend?: Excel.Interfaces.ChartLegendData; /** * + * Represents the plotArea for the chart. + * + * [Api set: ExcelApi 1.8] + */ + plotArea?: Excel.Interfaces.ChartPlotAreaData; + /** + * * Represents either a single series or collection of series in the chart. Read-only. * * [Api set: ExcelApi 1.1] @@ -35552,13 +39422,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.2] */ worksheet?: Excel.Interfaces.WorksheetData; + /** + * + * Returns or sets a ChartCategoryLabelLevel enumeration constant referring to + the level of where the category labels are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + categoryLabelLevel?: number; /** * * Represents the type of the chart. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + /** + * + * Returns or sets the way that blank cells are plotted on a chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + displayBlanksAs?: Excel.ChartDisplayBlanksAs | "NotPlotted" | "Zero" | "Interplotted"; /** * * Represents the height, in points, of the chart object. @@ -35587,6 +39472,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: string; + /** + * + * Returns or sets the way columns or rows are used as data series on the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotBy?: Excel.ChartPlotBy | "Rows" | "Columns"; + /** + * + * True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotVisibleOnly?: boolean; + /** + * + * Returns or sets a ChartSeriesNameLevel enumeration constant referring to + the level of where the series names are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + seriesNameLevel?: number; /** * * Represents whether to display all field buttons on a PivotChart. @@ -35594,6 +39501,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showAllFieldButtons?: boolean; + /** + * + * Represents whether to to show the data labels when the value is greater than the maximum value on the value axis. + If value axis became smaller than the size of data points, you can use this property to set whether to show the data labels. + This property applies to 2-D charts only. + * + * [Api set: ExcelApi 1.8] + */ + showDataLabelsOverMaximum?: boolean; + /** + * + * Returns or sets the chart style for the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + style?: number; /** * * Represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). @@ -35632,6 +39555,13 @@ declare namespace Excel { } /** An interface describing the data returned by calling "chartSeries.toJSON()". */ interface ChartSeriesData { + /** + * + * Represents a collection of all dataLabels in the series. + * + * [Api set: ExcelApi 1.8] + */ + dataLabels?: Excel.Interfaces.ChartDataLabelsData; /** * * Represents the formatting of a chart series, which includes fill and line formatting. Read-only. @@ -35653,13 +39583,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ trendlines?: Excel.Interfaces.ChartTrendlineData[]; + /** + * + * Returns or sets the group for the specified series. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + axisGroup?: Excel.ChartAxisGroup | "Primary" | "Secondary"; /** * * Represents the chart type of a series. See Excel.ChartType for details. * * [Api set: ExcelApi 1.7] */ - chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; + chartType?: Excel.ChartType | "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Boxwhisker" | "Pareto" | "RegionMap" | "Treemap" | "Waterfall" | "Sunburst" | "Funnel"; /** * * Represents the doughnut hole size of a chart series. Only valid on doughnut and doughnutExploded charts. @@ -35668,6 +39605,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ doughnutHoleSize?: number; + /** + * + * Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + explosion?: number; /** * * Boolean value representing if the series is filtered or not. Not applicable for surface charts. @@ -35675,6 +39619,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ filtered?: boolean; + /** + * + * Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + firstSliceAngle?: number; /** * * Represents the gap width of a chart series. Only valid on bar and column charts, as well as @@ -35690,6 +39641,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ hasDataLabels?: boolean; + /** + * + * True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + invertIfNegative?: boolean; /** * * Represents markers background color of a chart series. @@ -35725,6 +39683,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: string; + /** + * + * Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + overlap?: number; /** * * Represents the plot order of a chart series within the chart group. @@ -35732,6 +39697,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ plotOrder?: number; + /** + * + * Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + secondPlotSize?: number; /** * * Boolean value representing if the series has a shadow or not. @@ -35746,6 +39718,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ smooth?: boolean; + /** + * + * Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + splitType?: Excel.ChartSplitStype | "SplitByPosition" | "SplitByValue" | "SplitByPercentValue" | "SplitByCustomSplit"; + /** + * + * True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + varyByCategories?: boolean; } /** An interface describing the data returned by calling "chartSeriesFormat.toJSON()". */ interface ChartSeriesFormatData { @@ -35884,6 +39870,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ title?: Excel.Interfaces.ChartAxisTitleData; + /** + * + * Represents the alignment for the specified axis tick label. See Excel.ChartTextHorizontalAlignment for detail. + * + * [Api set: ExcelApi 1.8] + */ + alignment?: Excel.ChartTickLabelAlignment | "Center" | "Left" | "Right"; /** * * Represents the group for the specified axis. See Excel.ChartAxisGroup for details. Read-only. @@ -35940,6 +39933,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ height?: number; + /** + * + * Represents whether value axis crosses the category axis between categories. + * + * [Api set: ExcelApi 1.8] + */ + isBetweenCategories?: boolean; /** * * Represents the distance, in points, from the left edge of the axis to the left of chart area. Null if the axis is not visible. Read-only. @@ -36010,6 +40010,41 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ minorUnit?: any; + /** + * + * Represents whether an axis is multilevel or not. + * + * [Api set: ExcelApi 1.8] + */ + multiLevel?: boolean; + /** + * + * Represents the format code for the axis tick label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * Represents the distance between the levels of labels, and the distance between the first level and the axis line. The value should be an integer from 0 to 1000. + * + * [Api set: ExcelApi 1.8] + */ + offset?: number; + /** + * + * Represents the specified axis position where the other axis crosses. See Excel.ChartAxisPosition for details. + * + * [Api set: ExcelApi 1.8] + */ + position?: Excel.ChartAxisPosition | "Automatic" | "Maximum" | "Minimum" | "Custom"; + /** + * + * Represents the specified axis position where the other axis crosses at. Read Only. Set to this property should use SetPositionAt(double) method. + * + * [Api set: ExcelApi 1.8] + */ + positionAt?: number; /** * * Represents whether Microsoft Excel plots data points from last to first. @@ -36031,6 +40066,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showDisplayUnitLabel?: boolean; + /** + * + * Represents the text orientation of the axis tick label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: any; /** * * Represents the position of tick-mark labels on the specified axis. See Excel.ChartAxisTickLabelPosition for details. @@ -36124,6 +40166,13 @@ declare namespace Excel { } /** An interface describing the data returned by calling "chartAxisTitleFormat.toJSON()". */ interface ChartAxisTitleFormatData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderData; /** * * Represents the font attributes, such as font name, font size, color, etc. of chart axis title object. Read-only. @@ -36141,6 +40190,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ format?: Excel.Interfaces.ChartDataLabelFormatData; + /** + * + * Represents whether data labels automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the format code for data labels. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -36197,9 +40268,74 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ showValue?: boolean; + /** + * + * Represents the text orientation of data labels. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; } /** An interface describing the data returned by calling "chartDataLabel.toJSON()". */ interface ChartDataLabelData { + /** + * + * Represents the format of chart data label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartDataLabelFormatData; + /** + * + * Boolean value representing if data label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart data label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: string; + /** + * + * Returns the height, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + height?: number; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart data label to the left edge of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * String value that represents the format code for data label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -36256,9 +40392,52 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showValue?: boolean; + /** + * + * String representing the text of the data label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: string; + /** + * + * Represents the text orientation of chart data label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the distance, in points, from the top edge of chart data label to the top of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; + /** + * + * Returns the width, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + width?: number; } /** An interface describing the data returned by calling "chartDataLabelFormat.toJSON()". */ interface ChartDataLabelFormatData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderData; /** * * Represents the font attributes (font name, font size, color, etc.) for a chart data label. Read-only. @@ -36369,6 +40548,34 @@ declare namespace Excel { } /** An interface describing the data returned by calling "chartLegendEntry.toJSON()". */ interface ChartLegendEntryData { + /** + * + * Represents the height of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + height?: number; + /** + * + * Represents the index of the LegendEntry in the Chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + index?: number; + /** + * + * Represents the left of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * Represents the top of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; /** * * Represents the visible of a chart legend entry. @@ -36376,6 +40583,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ visible?: boolean; + /** + * + * Represents the width of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + width?: number; } /** An interface describing the data returned by calling "chartLegendEntryCollection.toJSON()". */ interface ChartLegendEntryCollectionData { @@ -36383,6 +40597,13 @@ declare namespace Excel { } /** An interface describing the data returned by calling "chartLegendFormat.toJSON()". */ interface ChartLegendFormatData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderData; /** * * Represents the font attributes such as font name, font size, color, etc. of a chart legend. Read-only. @@ -36614,6 +40835,27 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ format?: Excel.Interfaces.ChartTrendlineFormatData; + /** + * + * Represents the label of a chart trendline. + * + * [Api set: ExcelApi 1.8] + */ + label?: Excel.Interfaces.ChartTrendlineLabelData; + /** + * + * Represents the number of periods that the trendline extends backward. + * + * [Api set: ExcelApi 1.8] + */ + backwardPeriod?: number; + /** + * + * Represents the number of periods that the trendline extends forward. + * + * [Api set: ExcelApi 1.8] + */ + forwardPeriod?: number; /** * * Represents the intercept value of the trendline. Can be set to a numeric value or an empty string (for automatic values). The returned value is always a number. @@ -36642,6 +40884,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ polynomialOrder?: number; + /** + * + * True if the equation for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showEquation?: boolean; + /** + * + * True if the R-squared for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showRSquared?: boolean; /** * * Represents the type of a chart trendline. @@ -36664,6 +40920,195 @@ declare namespace Excel { */ line?: Excel.Interfaces.ChartLineFormatData; } + /** An interface describing the data returned by calling "chartTrendlineLabel.toJSON()". */ + interface ChartTrendlineLabelData { + /** + * + * Represents the format of chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartTrendlineLabelFormatData; + /** + * + * Boolean value representing if trendline label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart trendline label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: string; + /** + * + * Returns the height, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + height?: number; + /** + * + * Represents the horizontal alignment for chart trendline label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of trendline label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: Excel.ChartTextHorizontalAlignment | "Center" | "Left" | "Right" | "Justify" | "Distributed"; + /** + * + * Represents the distance, in points, from the left edge of chart trendline label to the left edge of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * String value that represents the format code for trendline label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * String representing the text of the trendline label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: string; + /** + * + * Represents the text orientation of chart trendline label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; + /** + * + * Represents the distance, in points, from the top edge of chart trendline label to the top of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the vertical alignment of chart trendline label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of trendline label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: Excel.ChartTextVerticalAlignment | "Center" | "Bottom" | "Top" | "Justify" | "Distributed"; + /** + * + * Returns the width, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + width?: number; + } + /** An interface describing the data returned by calling "chartTrendlineLabelFormat.toJSON()". */ + interface ChartTrendlineLabelFormatData { + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderData; + /** + * + * Represents the font attributes (font name, font size, color, etc.) for a chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + font?: Excel.Interfaces.ChartFontData; + } + /** An interface describing the data returned by calling "chartPlotArea.toJSON()". */ + interface ChartPlotAreaData { + /** + * + * Represents the formatting of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartPlotAreaFormatData; + /** + * + * Represents the height value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + height?: number; + /** + * + * Represents the insideHeight value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideHeight?: number; + /** + * + * Represents the insideLeft value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideLeft?: number; + /** + * + * Represents the insideTop value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideTop?: number; + /** + * + * Represents the insideWidth value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideWidth?: number; + /** + * + * Represents the left value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + left?: number; + /** + * + * Represents the position of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + position?: Excel.ChartPlotAreaPosition | "Automatic" | "Custom"; + /** + * + * Represents the top value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + top?: number; + /** + * + * Represents the width value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + width?: number; + } + /** An interface describing the data returned by calling "chartPlotAreaFormat.toJSON()". */ + interface ChartPlotAreaFormatData { + /** + * + * Represents the border attributes of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderData; + } /** An interface describing the data returned by calling "tableSort.toJSON()". */ interface TableSortData { /** @@ -36729,6 +41174,48 @@ declare namespace Excel { } /** An interface describing the data returned by calling "pivotTable.toJSON()". */ interface PivotTableData { + /** + * + * The Column Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + columnHierarchies?: Excel.Interfaces.RowColumnPivotHierarchyData[]; + /** + * + * The Data Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + dataHierarchies?: Excel.Interfaces.DataPivotHierarchyData[]; + /** + * + * The Filter Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + filterHierarchies?: Excel.Interfaces.FilterPivotHierarchyData[]; + /** + * + * The Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + hierarchies?: Excel.Interfaces.PivotHierarchyData[]; + /** + * + * The PivotLayout describing the layout and visual structure of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + layout?: Excel.Interfaces.PivotLayoutData; + /** + * + * The Row Pivot Hierarchies of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + rowHierarchies?: Excel.Interfaces.RowColumnPivotHierarchyData[]; /** * * The worksheet containing the current PivotTable. @@ -36751,6 +41238,275 @@ declare namespace Excel { */ name?: string; } + /** An interface describing the data returned by calling "pivotLayout.toJSON()". */ + interface PivotLayoutData { + /** + * + * This property indicates the PivotLayoutType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + layoutType?: Excel.PivotLayoutType | "Compact" | "Tabular" | "Outline"; + /** + * + * True if the PivotTable report shows grand totals for columns. + * + * [Api set: ExcelApi 1.8] + */ + showColumnGrandTotals?: boolean; + /** + * + * True if the PivotTable report shows grand totals for rows. + * + * [Api set: ExcelApi 1.8] + */ + showRowGrandTotals?: boolean; + /** + * + * This property indicates the SubtotalLocationType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + subtotalLocation?: Excel.SubtotalLocationType | "AtTop" | "AtBottom" | "Off"; + } + /** An interface describing the data returned by calling "pivotHierarchyCollection.toJSON()". */ + interface PivotHierarchyCollectionData { + items?: Excel.Interfaces.PivotHierarchyData[]; + } + /** An interface describing the data returned by calling "pivotHierarchy.toJSON()". */ + interface PivotHierarchyData { + /** + * + * Returns the PivotFields associated with the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + fields?: Excel.Interfaces.PivotFieldData[]; + /** + * + * Id of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Name of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + } + /** An interface describing the data returned by calling "rowColumnPivotHierarchyCollection.toJSON()". */ + interface RowColumnPivotHierarchyCollectionData { + items?: Excel.Interfaces.RowColumnPivotHierarchyData[]; + } + /** An interface describing the data returned by calling "rowColumnPivotHierarchy.toJSON()". */ + interface RowColumnPivotHierarchyData { + /** + * + * Returns the PivotFields associated with the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + fields?: Excel.Interfaces.PivotFieldData[]; + /** + * + * Id of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Name of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Position of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + } + /** An interface describing the data returned by calling "filterPivotHierarchyCollection.toJSON()". */ + interface FilterPivotHierarchyCollectionData { + items?: Excel.Interfaces.FilterPivotHierarchyData[]; + } + /** An interface describing the data returned by calling "filterPivotHierarchy.toJSON()". */ + interface FilterPivotHierarchyData { + /** + * + * Returns the PivotFields associated with the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + fields?: Excel.Interfaces.PivotFieldData[]; + /** + * + * Determines whether to allow multiple filter items. + * + * [Api set: ExcelApi 1.8] + */ + enableMultipleFilterItems?: boolean; + /** + * + * Id of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Name of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Position of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + } + /** An interface describing the data returned by calling "dataPivotHierarchyCollection.toJSON()". */ + interface DataPivotHierarchyCollectionData { + items?: Excel.Interfaces.DataPivotHierarchyData[]; + } + /** An interface describing the data returned by calling "dataPivotHierarchy.toJSON()". */ + interface DataPivotHierarchyData { + /** + * + * Returns the PivotFields associated with the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + field?: Excel.Interfaces.PivotFieldData; + /** + * + * Id of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Name of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Number format of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: string; + /** + * + * Position of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: number; + /** + * + * Determines whether the data should be sown as a specific summary calculation or not. + * + * [Api set: ExcelApi 1.8] + */ + showAs?: Excel.ShowAsRule; + /** + * + * Determines whether to show all items of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + summarizeBy?: Excel.AggregationFunction | "Unknown" | "Automatic" | "Sum" | "Count" | "Average" | "Max" | "Min" | "Product" | "CountNumbers" | "StandardDeviation" | "StandardDeviationP" | "Variance" | "VarianceP"; + } + /** An interface describing the data returned by calling "pivotFieldCollection.toJSON()". */ + interface PivotFieldCollectionData { + items?: Excel.Interfaces.PivotFieldData[]; + } + /** An interface describing the data returned by calling "pivotField.toJSON()". */ + interface PivotFieldData { + /** + * + * Returns the PivotFields associated with the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + items?: Excel.Interfaces.PivotItemData[]; + /** + * + * Id of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Name of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Determines whether to show all items of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + showAllItems?: boolean; + /** + * + * Subtotals of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + subtotals?: Excel.Subtotals; + } + /** An interface describing the data returned by calling "pivotItemCollection.toJSON()". */ + interface PivotItemCollectionData { + items?: Excel.Interfaces.PivotItemData[]; + } + /** An interface describing the data returned by calling "pivotItem.toJSON()". */ + interface PivotItemData { + /** + * + * Id of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + id?: string; + /** + * + * Determines whether the item is expanded to show child items or if it's collapsed and child items are hidden. + * + * [Api set: ExcelApi 1.8] + */ + isExpanded?: boolean; + /** + * + * Name of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + name?: string; + /** + * + * Determines whether the PivotItem is visible or not. + * + * [Api set: ExcelApi 1.8] + */ + visible?: boolean; + } /** An interface describing the data returned by calling "documentProperties.toJSON()". */ interface DocumentPropertiesData { /** @@ -37428,6 +42184,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ font?: Excel.Interfaces.RangeFontData; + /** + * + * Indicates if text is automatically indented when the text alignment in a cell is set to equal distribution. + * + * [Api set: ExcelApi 1.8] + */ + autoIndent?: boolean; /** * * Indicates if the style is a built-in style. @@ -37540,6 +42303,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ shrinkToFit?: boolean; + /** + * + * The text orientation for the style. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: number; /** * * Represents the vertical alignment for the style. See Excel.VerticalAlignment for details. @@ -37576,6 +42346,22 @@ declare namespace Excel { */ value?: T; } + /** + * + * Represents the Excel Runtime class. + * + * [Api set: ExcelApi 1.5] + */ + interface RuntimeLoadOptions { + $all?: boolean; + /** + * + * Turn on/off JavaScript events in current taskpane or content add-in. + * + * [Api set: ExcelApi 1.8] + */ + enableEvents?: boolean; + } /** * * Represents the Excel application that manages the workbook. @@ -37642,6 +42428,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ name?: boolean; + /** + * + * True if the workbook is open in Read-only mode. Read-only. + * + * [Api set: ExcelApi 1.8] + */ + readOnly?: boolean; } /** * @@ -37709,6 +42502,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ position?: boolean; + /** + * + * Gets or sets the worksheet's gridlines flag. + This flag determines whether gridlines are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showGridlines?: boolean; + /** + * + * Gets or sets the worksheet's headings flag. + This flag determines whether headings are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showHeadings?: boolean; /** * * Returns the standard (default) height of all the rows in the worksheet, in points. Read-only. @@ -37791,6 +42600,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ position?: boolean; + /** + * + * For EACH ITEM in the collection: Gets or sets the worksheet's gridlines flag. + This flag determines whether gridlines are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showGridlines?: boolean; + /** + * + * For EACH ITEM in the collection: Gets or sets the worksheet's headings flag. + This flag determines whether headings are visible to the user. + * + * [Api set: ExcelApi 1.8] + */ + showHeadings?: boolean; /** * * For EACH ITEM in the collection: Returns the standard (default) height of all the rows in the worksheet, in points. Read-only. @@ -37856,6 +42681,13 @@ declare namespace Excel { $all?: boolean; /** * + * Returns a data validation object. + * + * [Api set: ExcelApi 1.8] + */ + dataValidation?: Excel.Interfaces.DataValidationLoadOptions; + /** + * * Returns a format object, encapsulating the range's font, fill, borders, alignment, and other properties. * * [Api set: ExcelApi 1.1] @@ -38533,6 +43365,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ id?: boolean; + /** + * + * For EACH ITEM in the collection: Returns a numeric id. + * + * [Api set: ExcelApi 1.8] + */ + legacyId?: boolean; /** * * For EACH ITEM in the collection: Name of the table. @@ -38640,6 +43479,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ id?: boolean; + /** + * + * Returns a numeric id. + * + * [Api set: ExcelApi 1.8] + */ + legacyId?: boolean; /** * * Name of the table. @@ -38834,6 +43680,59 @@ declare namespace Excel { */ values?: boolean; } + /** + * + * Represents the data validation applied to the current range. + * + * [Api set: ExcelApi 1.8] + */ + interface DataValidationLoadOptions { + $all?: boolean; + /** + * + * Error alert when user enters invalid data. + * + * [Api set: ExcelApi 1.8] + */ + errorAlert?: boolean; + /** + * + * Ignore blanks: no data validation will be performed on blank cells, it defaults to true. + * + * [Api set: ExcelApi 1.8] + */ + ignoreBlanks?: boolean; + /** + * + * Prompt when users select a cell. + * + * [Api set: ExcelApi 1.8] + */ + prompt?: boolean; + /** + * + * Data Validation rule that contains different type of data validation criteria. + * + * [Api set: ExcelApi 1.8] + */ + rule?: boolean; + /** + * + * Type of the data validation, see Excel.DataValidationType for details. + * + * [Api set: ExcelApi 1.8] + */ + type?: boolean; + /** + * + * Represents if all cell values are valid according to the data validation rules. + Returns true if all cell values are valid, or false if all cell values are invalid. + Returns null if there are both valid and invalid cell values within the range. + * + * [Api set: ExcelApi 1.8] + */ + valid?: boolean; + } /** * * A format object encapsulating the range's font, fill, borders, alignment, and other properties. @@ -39137,6 +44036,13 @@ declare namespace Excel { legend?: Excel.Interfaces.ChartLegendLoadOptions; /** * + * For EACH ITEM in the collection: Represents the plotArea for the chart. + * + * [Api set: ExcelApi 1.8] + */ + plotArea?: Excel.Interfaces.ChartPlotAreaLoadOptions; + /** + * * For EACH ITEM in the collection: Represents either a single series or collection of series in the chart. * * [Api set: ExcelApi 1.1] @@ -39156,6 +44062,14 @@ declare namespace Excel { * [Api set: ExcelApi 1.2] */ worksheet?: Excel.Interfaces.WorksheetLoadOptions; + /** + * + * For EACH ITEM in the collection: Returns or sets a ChartCategoryLabelLevel enumeration constant referring to + the level of where the category labels are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + categoryLabelLevel?: boolean; /** * * For EACH ITEM in the collection: Represents the type of the chart. See Excel.ChartType for details. @@ -39163,6 +44077,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ chartType?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the way that blank cells are plotted on a chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + displayBlanksAs?: boolean; /** * * For EACH ITEM in the collection: Represents the height, in points, of the chart object. @@ -39191,6 +44112,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the way columns or rows are used as data series on the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotBy?: boolean; + /** + * + * For EACH ITEM in the collection: True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotVisibleOnly?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets a ChartSeriesNameLevel enumeration constant referring to + the level of where the series names are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + seriesNameLevel?: boolean; /** * * For EACH ITEM in the collection: Represents whether to display all field buttons on a PivotChart. @@ -39198,6 +44141,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showAllFieldButtons?: boolean; + /** + * + * For EACH ITEM in the collection: Represents whether to to show the data labels when the value is greater than the maximum value on the value axis. + If value axis became smaller than the size of data points, you can use this property to set whether to show the data labels. + This property applies to 2-D charts only. + * + * [Api set: ExcelApi 1.8] + */ + showDataLabelsOverMaximum?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the chart style for the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + style?: boolean; /** * * For EACH ITEM in the collection: Represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). @@ -39251,6 +44210,13 @@ declare namespace Excel { legend?: Excel.Interfaces.ChartLegendLoadOptions; /** * + * Represents the plotArea for the chart. + * + * [Api set: ExcelApi 1.8] + */ + plotArea?: Excel.Interfaces.ChartPlotAreaLoadOptions; + /** + * * Represents either a single series or collection of series in the chart. * * [Api set: ExcelApi 1.1] @@ -39270,6 +44236,14 @@ declare namespace Excel { * [Api set: ExcelApi 1.2] */ worksheet?: Excel.Interfaces.WorksheetLoadOptions; + /** + * + * Returns or sets a ChartCategoryLabelLevel enumeration constant referring to + the level of where the category labels are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + categoryLabelLevel?: boolean; /** * * Represents the type of the chart. See Excel.ChartType for details. @@ -39277,6 +44251,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ chartType?: boolean; + /** + * + * Returns or sets the way that blank cells are plotted on a chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + displayBlanksAs?: boolean; /** * * Represents the height, in points, of the chart object. @@ -39305,6 +44286,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: boolean; + /** + * + * Returns or sets the way columns or rows are used as data series on the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotBy?: boolean; + /** + * + * True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + plotVisibleOnly?: boolean; + /** + * + * Returns or sets a ChartSeriesNameLevel enumeration constant referring to + the level of where the series names are being sourced from. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + seriesNameLevel?: boolean; /** * * Represents whether to display all field buttons on a PivotChart. @@ -39312,6 +44315,22 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showAllFieldButtons?: boolean; + /** + * + * Represents whether to to show the data labels when the value is greater than the maximum value on the value axis. + If value axis became smaller than the size of data points, you can use this property to set whether to show the data labels. + This property applies to 2-D charts only. + * + * [Api set: ExcelApi 1.8] + */ + showDataLabelsOverMaximum?: boolean; + /** + * + * Returns or sets the chart style for the chart. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + style?: boolean; /** * * Represents the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). @@ -39360,6 +44379,13 @@ declare namespace Excel { $all?: boolean; /** * + * For EACH ITEM in the collection: Represents a collection of all dataLabels in the series. + * + * [Api set: ExcelApi 1.8] + */ + dataLabels?: Excel.Interfaces.ChartDataLabelsLoadOptions; + /** + * * For EACH ITEM in the collection: Represents the formatting of a chart series, which includes fill and line formatting. * * [Api set: ExcelApi 1.1] @@ -39372,6 +44398,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ points?: Excel.Interfaces.ChartPointsCollectionLoadOptions; + /** + * + * For EACH ITEM in the collection: Returns or sets the group for the specified series. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + axisGroup?: boolean; /** * * For EACH ITEM in the collection: Represents the chart type of a series. See Excel.ChartType for details. @@ -39387,6 +44420,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ doughnutHoleSize?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + explosion?: boolean; /** * * For EACH ITEM in the collection: Boolean value representing if the series is filtered or not. Not applicable for surface charts. @@ -39394,6 +44434,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ filtered?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + firstSliceAngle?: boolean; /** * * For EACH ITEM in the collection: Represents the gap width of a chart series. Only valid on bar and column charts, as well as @@ -39409,6 +44456,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ hasDataLabels?: boolean; + /** + * + * For EACH ITEM in the collection: True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + invertIfNegative?: boolean; /** * * For EACH ITEM in the collection: Represents markers background color of a chart series. @@ -39444,6 +44498,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: boolean; + /** + * + * For EACH ITEM in the collection: Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + overlap?: boolean; /** * * For EACH ITEM in the collection: Represents the plot order of a chart series within the chart group. @@ -39451,6 +44512,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ plotOrder?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + secondPlotSize?: boolean; /** * * For EACH ITEM in the collection: Boolean value representing if the series has a shadow or not. @@ -39465,6 +44533,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ smooth?: boolean; + /** + * + * For EACH ITEM in the collection: Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + splitType?: boolean; + /** + * + * For EACH ITEM in the collection: True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + varyByCategories?: boolean; } /** * @@ -39476,6 +44558,13 @@ declare namespace Excel { $all?: boolean; /** * + * Represents a collection of all dataLabels in the series. + * + * [Api set: ExcelApi 1.8] + */ + dataLabels?: Excel.Interfaces.ChartDataLabelsLoadOptions; + /** + * * Represents the formatting of a chart series, which includes fill and line formatting. * * [Api set: ExcelApi 1.1] @@ -39488,6 +44577,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ points?: Excel.Interfaces.ChartPointsCollectionLoadOptions; + /** + * + * Returns or sets the group for the specified series. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + axisGroup?: boolean; /** * * Represents the chart type of a series. See Excel.ChartType for details. @@ -39503,6 +44599,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ doughnutHoleSize?: boolean; + /** + * + * Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Returns 0 (zero) if there's no explosion (the tip of the slice is in the center of the pie). Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + explosion?: boolean; /** * * Boolean value representing if the series is filtered or not. Not applicable for surface charts. @@ -39510,6 +44613,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ filtered?: boolean; + /** + * + * Returns or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts. Can be a value from 0 through 360. Read/Write + * + * [Api set: ExcelApi 1.8] + */ + firstSliceAngle?: boolean; /** * * Represents the gap width of a chart series. Only valid on bar and column charts, as well as @@ -39525,6 +44635,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ hasDataLabels?: boolean; + /** + * + * True if Microsoft Excel inverts the pattern in the item when it corresponds to a negative number. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + invertIfNegative?: boolean; /** * * Represents markers background color of a chart series. @@ -39560,6 +44677,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ name?: boolean; + /** + * + * Specifies how bars and columns are positioned. Can be a value between – 100 and 100. Applies only to 2-D bar and 2-D column charts. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + overlap?: boolean; /** * * Represents the plot order of a chart series within the chart group. @@ -39567,6 +44691,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ plotOrder?: boolean; + /** + * + * Returns or sets the size of the secondary section of either a pie of pie chart or a bar of pie chart, as a percentage of the size of the primary pie. Can be a value from 5 to 200. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + secondPlotSize?: boolean; /** * * Boolean value representing if the series has a shadow or not. @@ -39581,6 +44712,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ smooth?: boolean; + /** + * + * Returns or sets the way the two sections of either a pie of pie chart or a bar of pie chart are split. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + splitType?: boolean; + /** + * + * True if Microsoft Excel assigns a different color or pattern to each data marker. The chart must contain only one series. Read/Write. + * + * [Api set: ExcelApi 1.8] + */ + varyByCategories?: boolean; } /** * @@ -39810,6 +44955,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ title?: Excel.Interfaces.ChartAxisTitleLoadOptions; + /** + * + * Represents the alignment for the specified axis tick label. See Excel.ChartTextHorizontalAlignment for detail. + * + * [Api set: ExcelApi 1.8] + */ + alignment?: boolean; /** * * Represents the group for the specified axis. See Excel.ChartAxisGroup for details. Read-only. @@ -39866,6 +45018,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ height?: boolean; + /** + * + * Represents whether value axis crosses the category axis between categories. + * + * [Api set: ExcelApi 1.8] + */ + isBetweenCategories?: boolean; /** * * Represents the distance, in points, from the left edge of the axis to the left of chart area. Null if the axis is not visible. Read-only. @@ -39936,6 +45095,41 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ minorUnit?: boolean; + /** + * + * Represents whether an axis is multilevel or not. + * + * [Api set: ExcelApi 1.8] + */ + multiLevel?: boolean; + /** + * + * Represents the format code for the axis tick label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; + /** + * + * Represents the distance between the levels of labels, and the distance between the first level and the axis line. The value should be an integer from 0 to 1000. + * + * [Api set: ExcelApi 1.8] + */ + offset?: boolean; + /** + * + * Represents the specified axis position where the other axis crosses. See Excel.ChartAxisPosition for details. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + /** + * + * Represents the specified axis position where the other axis crosses at. Read Only. Set to this property should use SetPositionAt(double) method. + * + * [Api set: ExcelApi 1.8] + */ + positionAt?: boolean; /** * * Represents whether Microsoft Excel plots data points from last to first. @@ -39957,6 +45151,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showDisplayUnitLabel?: boolean; + /** + * + * Represents the text orientation of the axis tick label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; /** * * Represents the position of tick-mark labels on the specified axis. See Excel.ChartAxisTickLabelPosition for details. @@ -40070,6 +45271,13 @@ declare namespace Excel { $all?: boolean; /** * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderLoadOptions; + /** + * * Represents the font attributes, such as font name, font size, color, etc. of chart axis title object. * * [Api set: ExcelApi 1.1] @@ -40091,6 +45299,28 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ format?: Excel.Interfaces.ChartDataLabelFormatLoadOptions; + /** + * + * Represents whether data labels automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: boolean; + /** + * + * Represents the format code for data labels. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -40147,6 +45377,21 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ showValue?: boolean; + /** + * + * Represents the text orientation of data labels. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: boolean; } /** * @@ -40156,6 +45401,56 @@ declare namespace Excel { */ interface ChartDataLabelLoadOptions { $all?: boolean; + /** + * + * Represents the format of chart data label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartDataLabelFormatLoadOptions; + /** + * + * Boolean value representing if data label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart data label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: boolean; + /** + * + * Returns the height, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + height?: boolean; + /** + * + * Represents the horizontal alignment for chart data label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of data label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: boolean; + /** + * + * Represents the distance, in points, from the left edge of chart data label to the left edge of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: boolean; + /** + * + * String value that represents the format code for data label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; /** * * DataLabelPosition value that represents the position of the data label. See Excel.ChartDataLabelPosition for details. @@ -40212,6 +45507,42 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ showValue?: boolean; + /** + * + * String representing the text of the data label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: boolean; + /** + * + * Represents the text orientation of chart data label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; + /** + * + * Represents the distance, in points, from the top edge of chart data label to the top of chart area. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: boolean; + /** + * + * Represents the vertical alignment of chart data label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of data label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: boolean; + /** + * + * Returns the width, in points, of the chart data label. Read-only. Null if chart data label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + width?: boolean; } /** * @@ -40223,6 +45554,13 @@ declare namespace Excel { $all?: boolean; /** * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderLoadOptions; + /** + * * Represents the font attributes (font name, font size, color, etc.) for a chart data label. * * [Api set: ExcelApi 1.1] @@ -40348,6 +45686,34 @@ declare namespace Excel { */ interface ChartLegendEntryLoadOptions { $all?: boolean; + /** + * + * Represents the height of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + height?: boolean; + /** + * + * Represents the index of the LegendEntry in the Chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + index?: boolean; + /** + * + * Represents the left of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + left?: boolean; + /** + * + * Represents the top of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + top?: boolean; /** * * Represents the visible of a chart legend entry. @@ -40355,6 +45721,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ visible?: boolean; + /** + * + * Represents the width of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + width?: boolean; } /** * @@ -40364,6 +45737,34 @@ declare namespace Excel { */ interface ChartLegendEntryCollectionLoadOptions { $all?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the height of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + height?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the index of the LegendEntry in the Chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + index?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the left of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + left?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the top of a chart legendEntry. + * + * [Api set: ExcelApi 1.8] + */ + top?: boolean; /** * * For EACH ITEM in the collection: Represents the visible of a chart legend entry. @@ -40371,6 +45772,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ visible?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the width of the legendEntry on the chart Legend. + * + * [Api set: ExcelApi 1.8] + */ + width?: boolean; } /** * @@ -40382,6 +45790,13 @@ declare namespace Excel { $all?: boolean; /** * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderLoadOptions; + /** + * * Represents the font attributes such as font name, font size, color, etc. of a chart legend. * * [Api set: ExcelApi 1.1] @@ -40653,6 +46068,27 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ format?: Excel.Interfaces.ChartTrendlineFormatLoadOptions; + /** + * + * Represents the label of a chart trendline. + * + * [Api set: ExcelApi 1.8] + */ + label?: Excel.Interfaces.ChartTrendlineLabelLoadOptions; + /** + * + * Represents the number of periods that the trendline extends backward. + * + * [Api set: ExcelApi 1.8] + */ + backwardPeriod?: boolean; + /** + * + * Represents the number of periods that the trendline extends forward. + * + * [Api set: ExcelApi 1.8] + */ + forwardPeriod?: boolean; /** * * Represents the intercept value of the trendline. Can be set to a numeric value or an empty string (for automatic values). The returned value is always a number. @@ -40681,6 +46117,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ polynomialOrder?: boolean; + /** + * + * True if the equation for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showEquation?: boolean; + /** + * + * True if the R-squared for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showRSquared?: boolean; /** * * Represents the type of a chart trendline. @@ -40704,6 +46154,27 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ format?: Excel.Interfaces.ChartTrendlineFormatLoadOptions; + /** + * + * For EACH ITEM in the collection: Represents the label of a chart trendline. + * + * [Api set: ExcelApi 1.8] + */ + label?: Excel.Interfaces.ChartTrendlineLabelLoadOptions; + /** + * + * For EACH ITEM in the collection: Represents the number of periods that the trendline extends backward. + * + * [Api set: ExcelApi 1.8] + */ + backwardPeriod?: boolean; + /** + * + * For EACH ITEM in the collection: Represents the number of periods that the trendline extends forward. + * + * [Api set: ExcelApi 1.8] + */ + forwardPeriod?: boolean; /** * * For EACH ITEM in the collection: Represents the intercept value of the trendline. Can be set to a numeric value or an empty string (for automatic values). The returned value is always a number. @@ -40732,6 +46203,20 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ polynomialOrder?: boolean; + /** + * + * For EACH ITEM in the collection: True if the equation for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showEquation?: boolean; + /** + * + * For EACH ITEM in the collection: True if the R-squared for the trendline is displayed on the chart. + * + * [Api set: ExcelApi 1.8] + */ + showRSquared?: boolean; /** * * For EACH ITEM in the collection: Represents the type of a chart trendline. @@ -40756,6 +46241,219 @@ declare namespace Excel { */ line?: Excel.Interfaces.ChartLineFormatLoadOptions; } + /** + * + * This object represents the attributes for a chart trendline lable object. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartTrendlineLabelLoadOptions { + $all?: boolean; + /** + * + * Represents the format of chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartTrendlineLabelFormatLoadOptions; + /** + * + * Boolean value representing if trendline label automatically generates appropriate text based on context. + * + * [Api set: ExcelApi 1.8] + */ + autoText?: boolean; + /** + * + * String value that represents the formula of chart trendline label using A1-style notation. + * + * [Api set: ExcelApi 1.8] + */ + formula?: boolean; + /** + * + * Returns the height, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + height?: boolean; + /** + * + * Represents the horizontal alignment for chart trendline label. See Excel.ChartTextHorizontalAlignment for details. + This property is valid only when TextOrientation of trendline label is 90, -90 or 180. + * + * [Api set: ExcelApi 1.8] + */ + horizontalAlignment?: boolean; + /** + * + * Represents the distance, in points, from the left edge of chart trendline label to the left edge of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + left?: boolean; + /** + * + * String value that represents the format code for trendline label. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; + /** + * + * String representing the text of the trendline label on a chart. + * + * [Api set: ExcelApi 1.8] + */ + text?: boolean; + /** + * + * Represents the text orientation of chart trendline label. The value should be an integer either from -90 to 90, or 180 for vertically-oriented text. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; + /** + * + * Represents the distance, in points, from the top edge of chart trendline label to the top of chart area. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + top?: boolean; + /** + * + * Represents the vertical alignment of chart trendline label. See Excel.ChartTextVerticalAlignment for details. + This property is valid only when TextOrientation of trendline label is 0. + * + * [Api set: ExcelApi 1.8] + */ + verticalAlignment?: boolean; + /** + * + * Returns the width, in points, of the chart trendline label. Read-only. Null if chart trendline label is not visible. + * + * [Api set: ExcelApi 1.8] + */ + width?: boolean; + } + /** + * + * Encapsulates the format properties for the chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartTrendlineLabelFormatLoadOptions { + $all?: boolean; + /** + * + * Represents the border format, which includes color, linestyle, and weight. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderLoadOptions; + /** + * + * Represents the font attributes (font name, font size, color, etc.) for a chart trendline label. + * + * [Api set: ExcelApi 1.8] + */ + font?: Excel.Interfaces.ChartFontLoadOptions; + } + /** + * + * This object represents the attributes for a chart plotArea object. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartPlotAreaLoadOptions { + $all?: boolean; + /** + * + * Represents the formatting of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + format?: Excel.Interfaces.ChartPlotAreaFormatLoadOptions; + /** + * + * Represents the height value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + height?: boolean; + /** + * + * Represents the insideHeight value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideHeight?: boolean; + /** + * + * Represents the insideLeft value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideLeft?: boolean; + /** + * + * Represents the insideTop value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideTop?: boolean; + /** + * + * Represents the insideWidth value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + insideWidth?: boolean; + /** + * + * Represents the left value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + left?: boolean; + /** + * + * Represents the position of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + /** + * + * Represents the top value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + top?: boolean; + /** + * + * Represents the width value of plotArea. + * + * [Api set: ExcelApi 1.8] + */ + width?: boolean; + } + /** + * + * Represents the format properties for chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + interface ChartPlotAreaFormatLoadOptions { + $all?: boolean; + /** + * + * Represents the border attributes of a chart plotArea. + * + * [Api set: ExcelApi 1.8] + */ + border?: Excel.Interfaces.ChartBorderLoadOptions; + } /** * * Manages sorting operations on Table objects. @@ -40883,6 +46581,13 @@ declare namespace Excel { $all?: boolean; /** * + * For EACH ITEM in the collection: The PivotLayout describing the layout and visual structure of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + layout?: Excel.Interfaces.PivotLayoutLoadOptions; + /** + * * For EACH ITEM in the collection: The worksheet containing the current PivotTable. * * [Api set: ExcelApi 1.3] @@ -40913,6 +46618,13 @@ declare namespace Excel { $all?: boolean; /** * + * The PivotLayout describing the layout and visual structure of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + layout?: Excel.Interfaces.PivotLayoutLoadOptions; + /** + * * The worksheet containing the current PivotTable. * * [Api set: ExcelApi 1.3] @@ -40933,6 +46645,487 @@ declare namespace Excel { */ name?: boolean; } + /** + * + * Represents the visual layout of the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotLayoutLoadOptions { + $all?: boolean; + /** + * + * This property indicates the PivotLayoutType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + layoutType?: boolean; + /** + * + * True if the PivotTable report shows grand totals for columns. + * + * [Api set: ExcelApi 1.8] + */ + showColumnGrandTotals?: boolean; + /** + * + * True if the PivotTable report shows grand totals for rows. + * + * [Api set: ExcelApi 1.8] + */ + showRowGrandTotals?: boolean; + /** + * + * This property indicates the SubtotalLocationType of all fields on the PivotTable. If fields have different states, this will be null. + * + * [Api set: ExcelApi 1.8] + */ + subtotalLocation?: boolean; + } + /** + * + * Represents a collection of all the PivotTables that are part of the workbook or worksheet. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotHierarchyCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Id of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + } + /** + * + * Represents the Excel PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotHierarchyLoadOptions { + $all?: boolean; + /** + * + * Id of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Name of the PivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + } + /** + * + * Represents a collection of RowColumnPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + interface RowColumnPivotHierarchyCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Id of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Position of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + } + /** + * + * Represents the Excel RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + interface RowColumnPivotHierarchyLoadOptions { + $all?: boolean; + /** + * + * Id of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Name of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * Position of the RowColumnPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + } + /** + * + * Represents a collection of FilterPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + interface FilterPivotHierarchyCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether to allow multiple filter items. + * + * [Api set: ExcelApi 1.8] + */ + enableMultipleFilterItems?: boolean; + /** + * + * For EACH ITEM in the collection: Id of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Position of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + } + /** + * + * Represents the Excel FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + interface FilterPivotHierarchyLoadOptions { + $all?: boolean; + /** + * + * Determines whether to allow multiple filter items. + * + * [Api set: ExcelApi 1.8] + */ + enableMultipleFilterItems?: boolean; + /** + * + * Id of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Name of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * Position of the FilterPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + } + /** + * + * Represents a collection of DataPivotHierarchy items associated with the PivotTable. + * + * [Api set: ExcelApi 1.8] + */ + interface DataPivotHierarchyCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Returns the PivotFields associated with the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + field?: Excel.Interfaces.PivotFieldLoadOptions; + /** + * + * For EACH ITEM in the collection: Id of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Number format of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; + /** + * + * For EACH ITEM in the collection: Position of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether the data should be sown as a specific summary calculation or not. + * + * [Api set: ExcelApi 1.8] + */ + showAs?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether to show all items of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + summarizeBy?: boolean; + } + /** + * + * Represents the Excel DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + interface DataPivotHierarchyLoadOptions { + $all?: boolean; + /** + * + * Returns the PivotFields associated with the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + field?: Excel.Interfaces.PivotFieldLoadOptions; + /** + * + * Id of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Name of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * Number format of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + numberFormat?: boolean; + /** + * + * Position of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + position?: boolean; + /** + * + * Determines whether the data should be sown as a specific summary calculation or not. + * + * [Api set: ExcelApi 1.8] + */ + showAs?: boolean; + /** + * + * Determines whether to show all items of the DataPivotHierarchy. + * + * [Api set: ExcelApi 1.8] + */ + summarizeBy?: boolean; + } + /** + * + * Represents a collection of all the PivotTables that are part of the workbook or worksheet. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotFieldCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Id of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether to show all items of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + showAllItems?: boolean; + /** + * + * For EACH ITEM in the collection: Subtotals of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + subtotals?: boolean; + } + /** + * + * Represents the Excel PivotField. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotFieldLoadOptions { + $all?: boolean; + /** + * + * Id of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Name of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * Determines whether to show all items of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + showAllItems?: boolean; + /** + * + * Subtotals of the PivotField. + * + * [Api set: ExcelApi 1.8] + */ + subtotals?: boolean; + } + /** + * + * Represents a collection of all the Pivot Items related to their parent PivotField. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotItemCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Id of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether the item is expanded to show child items or if it's collapsed and child items are hidden. + * + * [Api set: ExcelApi 1.8] + */ + isExpanded?: boolean; + /** + * + * For EACH ITEM in the collection: Name of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: Determines whether the PivotItem is visible or not. + * + * [Api set: ExcelApi 1.8] + */ + visible?: boolean; + } + /** + * + * Represents the Excel PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + interface PivotItemLoadOptions { + $all?: boolean; + /** + * + * Id of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + id?: boolean; + /** + * + * Determines whether the item is expanded to show child items or if it's collapsed and child items are hidden. + * + * [Api set: ExcelApi 1.8] + */ + isExpanded?: boolean; + /** + * + * Name of the PivotItem. + * + * [Api set: ExcelApi 1.8] + */ + name?: boolean; + /** + * + * Determines whether the PivotItem is visible or not. + * + * [Api set: ExcelApi 1.8] + */ + visible?: boolean; + } /** * * Represents workbook properties. @@ -41925,6 +48118,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ font?: Excel.Interfaces.RangeFontLoadOptions; + /** + * + * Indicates if text is automatically indented when the text alignment in a cell is set to equal distribution. + * + * [Api set: ExcelApi 1.8] + */ + autoIndent?: boolean; /** * * Indicates if the style is a built-in style. @@ -42037,6 +48237,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ shrinkToFit?: boolean; + /** + * + * The text orientation for the style. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; /** * * Represents the vertical alignment for the style. See Excel.VerticalAlignment for details. @@ -42081,6 +48288,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ font?: Excel.Interfaces.RangeFontLoadOptions; + /** + * + * For EACH ITEM in the collection: Indicates if text is automatically indented when the text alignment in a cell is set to equal distribution. + * + * [Api set: ExcelApi 1.8] + */ + autoIndent?: boolean; /** * * For EACH ITEM in the collection: Indicates if the style is a built-in style. @@ -42193,6 +48407,13 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ shrinkToFit?: boolean; + /** + * + * For EACH ITEM in the collection: The text orientation for the style. + * + * [Api set: ExcelApi 1.8] + */ + textOrientation?: boolean; /** * * For EACH ITEM in the collection: Represents the vertical alignment for the style. See Excel.VerticalAlignment for details. @@ -53276,13 +59497,6 @@ declare namespace Word { * Executes a batch script that performs actions on the Word object model, using the RequestContext of previously-created API objects. * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared RequestContext, which means that any changes applied to these objects will be picked up by "context.sync()". * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Word application. Since the Office add-in and the Word application run in two different processes, the RequestContext is required to get access to the Word object model from the add-in. - * - * @remarks - * In addition to this signature, the method also has the following signatures: - * - * `run(batch: (context: Word.RequestContext) => Promise): Promise;` - * - * `run(objects: OfficeExtension.ClientObject[], batch: (context: Word.RequestContext) => Promise): Promise;` */ function run(objects: OfficeExtension.ClientObject[], batch: (context: Word.RequestContext) => Promise): Promise; } @@ -59499,16 +65713,16 @@ declare namespace OneNote { * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the OneNote application. Since the Office add-in and the OneNote application run in two different processes, the request context is required to get access to the OneNote object model from the add-in. */ function run(batch: (context: OneNote.RequestContext) => Promise): Promise; - /** - * Executes a batch script that performs actions on the OneNote object model, using the request context of a previously-created API object. - * @param object - A previously-created API object. The batch will use the same request context as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". - * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - */ - function run(object: OfficeExtension.ClientObject, batch: (context: OneNote.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the OneNote object model, using the request context of previously-created API objects. * @param object - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared request context, which means that any changes applied to these objects will be picked up by "context.sync()". * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + */ + function run(objects: OfficeExtension.ClientObject[], batch: (context: OneNote.RequestContext) => Promise): Promise; + /** + * Executes a batch script that performs actions on the OneNote object model, using the request context of a previously-created API object. + * @param object - A previously-created API object. The batch will use the same request context as the passed-in object, which means that any changes applied to the object will be picked up by "context.sync()". + * @param batch - A function that takes in an OneNote.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. * * @remarks * In addition to this signature, the method also has the following signatures: @@ -59517,7 +65731,7 @@ declare namespace OneNote { * * `run(objects: OfficeExtension.ClientObject[], batch: (context: OneNote.RequestContext) => Promise): Promise;` */ - function run(objects: OfficeExtension.ClientObject[], batch: (context: OneNote.RequestContext) => Promise): Promise; + function run(object: OfficeExtension.ClientObject, batch: (context: OneNote.RequestContext) => Promise): Promise; } @@ -62062,16 +68276,16 @@ declare namespace Visio { * @param batch - A function that takes in an Visio.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. */ function run(object: OfficeExtension.ClientObject | OfficeExtension.EmbeddedSession, batch: (context: Visio.RequestContext) => Promise): Promise; - /** - * Executes a batch script that performs actions on the Visio object model, using the RequestContext of a previously-created object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. - * @param contextObject - A previously-created Visio.RequestContext. This context will get re-used by the batch function (instead of having a new context created). This means that the batch will be able to pick up changes made to existing API objects, if those objects were derived from this same context. - * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Visio application. Since the Office add-in and the Visio application run in two different processes, the RequestContext is required to get access to the Visio object model from the add-in. - */ - function run(contextObject: OfficeExtension.ClientRequestContext, batch: (context: Visio.RequestContext) => Promise): Promise; /** * Executes a batch script that performs actions on the Visio object model, using the request context of previously-created API objects. * @param objects - An array of previously-created API objects. The array will be validated to make sure that all of the objects share the same context. The batch will use this shared request context, which means that any changes applied to these objects will be picked up by "context.sync()". * @param batch - A function that takes in a Visio.RequestContext and returns a promise (typically, just the result of "context.sync()"). When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + */ + function run(objects: OfficeExtension.ClientObject[], batch: (context: Visio.RequestContext) => Promise): Promise; + /** + * Executes a batch script that performs actions on the Visio object model, using the RequestContext of a previously-created object. When the promise is resolved, any tracked objects that were automatically allocated during execution will be released. + * @param contextObject - A previously-created Visio.RequestContext. This context will get re-used by the batch function (instead of having a new context created). This means that the batch will be able to pick up changes made to existing API objects, if those objects were derived from this same context. + * @param batch - A function that takes in a RequestContext and returns a promise (typically, just the result of "context.sync()"). The context parameter facilitates requests to the Visio application. Since the Office add-in and the Visio application run in two different processes, the RequestContext is required to get access to the Visio object model from the add-in. * * @remarks * In addition to this signature, the method also has the following signatures: @@ -62082,7 +68296,7 @@ declare namespace Visio { * * `run(objects: OfficeExtension.ClientObject[], batch: (context: Visio.RequestContext) => Promise): Promise;` */ - function run(objects: OfficeExtension.ClientObject[], batch: (context: Visio.RequestContext) => Promise): Promise; + function run(contextObject: OfficeExtension.ClientRequestContext, batch: (context: Visio.RequestContext) => Promise): Promise; } @@ -62106,4 +68320,4 @@ declare namespace Visio { //////////////////////////////////////////////////////////////// ////////////////////// End PowerPoint APIs ///////////////////// -//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// \ No newline at end of file From 3a58a893ea105e4fe65dcbf9a6a3f889c97f6bdd Mon Sep 17 00:00:00 2001 From: Alex Jerabek Date: Wed, 19 Sep 2018 15:13:20 -0700 Subject: [PATCH 58/78] Revert _3D enums --- types/office-js/index.d.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index f83ff2c41a..96da063a76 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -30123,9 +30123,15 @@ declare namespace Excel { columnClustered = "ColumnClustered", columnStacked = "ColumnStacked", columnStacked100 = "ColumnStacked100", + _3DColumnClustered = "3DColumnClustered", + _3DColumnStacked = "3DColumnStacked", + _3DColumnStacked100 = "3DColumnStacked100", barClustered = "BarClustered", barStacked = "BarStacked", barStacked100 = "BarStacked100", + _3DBarClustered = "3DBarClustered", + _3DBarStacked = "3DBarStacked", + _3DBarStacked100 = "3DBarStacked100", lineStacked = "LineStacked", lineStacked100 = "LineStacked100", lineMarkers = "LineMarkers", @@ -30133,6 +30139,7 @@ declare namespace Excel { lineMarkersStacked100 = "LineMarkersStacked100", pieOfPie = "PieOfPie", pieExploded = "PieExploded", + _3DPieExploded = "3DPieExploded", barOfPie = "BarOfPie", xyscatterSmooth = "XYScatterSmooth", xyscatterSmoothNoMarkers = "XYScatterSmoothNoMarkers", @@ -30140,6 +30147,8 @@ declare namespace Excel { xyscatterLinesNoMarkers = "XYScatterLinesNoMarkers", areaStacked = "AreaStacked", areaStacked100 = "AreaStacked100", + _3DAreaStacked = "3DAreaStacked", + _3DAreaStacked100 = "3DAreaStacked100", doughnutExploded = "DoughnutExploded", radarMarkers = "RadarMarkers", radarFilled = "RadarFilled", @@ -30174,9 +30183,13 @@ declare namespace Excel { pyramidBarStacked = "PyramidBarStacked", pyramidBarStacked100 = "PyramidBarStacked100", pyramidCol = "PyramidCol", + _3DColumn = "3DColumn", line = "Line", + _3DLine = "3DLine", + _3DPie = "3DPie", pie = "Pie", xyscatter = "XYScatter", + _3DArea = "3DArea", area = "Area", doughnut = "Doughnut", radar = "Radar", From 08373d33736edfbe2d08035c41d24e9de582ec42 Mon Sep 17 00:00:00 2001 From: Teoxoy <28601907+Teoxoy@users.noreply.github.com> Date: Thu, 20 Sep 2018 03:01:56 +0200 Subject: [PATCH 59/78] updated Container.addChild If you pass the args to addChild via spread operator over an array you will get: [ts] Expected at least 1 arguments, but got 0 or more. I think this is the best way to solve it. --- types/pixi.js/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/pixi.js/index.d.ts b/types/pixi.js/index.d.ts index 5e1ca464e2..17913f4903 100644 --- a/types/pixi.js/index.d.ts +++ b/types/pixi.js/index.d.ts @@ -290,8 +290,7 @@ declare namespace PIXI { protected onChildrenChange: (...args: any[]) => void; addChild( - child: T, - ...additionalChildren: DisplayObject[] + ...children: T[] ): T; addChildAt(child: T, index: number): T; swapChildren(child: DisplayObject, child2: DisplayObject): void; From df91a2a54413939976e1000302cccd120e63ed40 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Wed, 19 Sep 2018 23:58:41 -0400 Subject: [PATCH 60/78] [react-reconciler] Fix export --- types/react-reconciler/ReactElementType.d.ts | 4 - types/react-reconciler/ReactFiber.d.ts | 130 ---- .../ReactFiberExpirationTime.d.ts | 1 - .../ReactFiberNewContext.d.ts | 7 - .../ReactFiberReconciler.d.ts | 255 -------- types/react-reconciler/ReactFiberRoot.d.ts | 76 --- .../react-reconciler/ReactFiberScheduler.d.ts | 4 - .../react-reconciler/ReactSideEffectTags.d.ts | 1 - types/react-reconciler/ReactTypeOfMode.d.ts | 1 - types/react-reconciler/ReactTypes.d.ts | 30 - types/react-reconciler/ReactUpdateQueue.d.ts | 28 - types/react-reconciler/ReactWorkTags.d.ts | 18 - types/react-reconciler/Tracking.d.ts | 6 - types/react-reconciler/index.d.ts | 591 +++++++++++++++++- .../test/react-reconciler-tests.ts | 2 +- 15 files changed, 579 insertions(+), 575 deletions(-) delete mode 100644 types/react-reconciler/ReactElementType.d.ts delete mode 100644 types/react-reconciler/ReactFiber.d.ts delete mode 100644 types/react-reconciler/ReactFiberExpirationTime.d.ts delete mode 100644 types/react-reconciler/ReactFiberNewContext.d.ts delete mode 100644 types/react-reconciler/ReactFiberReconciler.d.ts delete mode 100644 types/react-reconciler/ReactFiberRoot.d.ts delete mode 100644 types/react-reconciler/ReactFiberScheduler.d.ts delete mode 100644 types/react-reconciler/ReactSideEffectTags.d.ts delete mode 100644 types/react-reconciler/ReactTypeOfMode.d.ts delete mode 100644 types/react-reconciler/ReactTypes.d.ts delete mode 100644 types/react-reconciler/ReactUpdateQueue.d.ts delete mode 100644 types/react-reconciler/ReactWorkTags.d.ts delete mode 100644 types/react-reconciler/Tracking.d.ts diff --git a/types/react-reconciler/ReactElementType.d.ts b/types/react-reconciler/ReactElementType.d.ts deleted file mode 100644 index f30d70586e..0000000000 --- a/types/react-reconciler/ReactElementType.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface Source { - fileName: string; - lineNumber: number; -} diff --git a/types/react-reconciler/ReactFiber.d.ts b/types/react-reconciler/ReactFiber.d.ts deleted file mode 100644 index 6ea29c798b..0000000000 --- a/types/react-reconciler/ReactFiber.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { Source } from './ReactElementType'; -import { ExpirationTime } from './ReactFiberExpirationTime'; -import { ContextDependency } from './ReactFiberNewContext'; -import { SideEffectTag } from './ReactSideEffectTags'; -import { TypeOfMode } from './ReactTypeOfMode'; -import { RefObject } from './ReactTypes'; -import { UpdateQueue } from './ReactUpdateQueue'; -import { WorkTag } from './ReactWorkTags'; - -// A Fiber is work on a Component that needs to be done or was done. There can -// be more than one per component. -export interface Fiber { - // These first fields are conceptually members of an Instance. This used to - // be split into a separate type and intersected with the other Fiber fields, - // but until Flow fixes its intersection bugs, we've merged them into a - // single type. - - // An Instance is shared between all versions of a component. We can easily - // break this out into a separate object to avoid copying so much to the - // alternate versions of the tree. We put this on a single object for now to - // minimize the number of objects created during the initial render. - - // Tag identifying the type of fiber. - tag: WorkTag; - - // Unique identifier of this child. - key: null | string; - - // The function/class/module associated with this fiber. - type: any; - - // The local state associated with this fiber. - stateNode: any; - - // Conceptual aliases - // parent : Instance -> return The parent happens to be the same as the - // return fiber since we've merged the fiber and instance. - - // Remaining fields belong to Fiber - - // The Fiber to return to after finishing processing this one. - // This is effectively the parent, but there can be multiple parents (two) - // so this is only the parent of the thing we're currently processing. - // It is conceptually the same as the return address of a stack frame. - return: Fiber | null; - - // Singly Linked List Tree Structure. - child: Fiber | null; - sibling: Fiber | null; - index: number; - - // The ref last used to attach this node. - // I'll avoid adding an owner field for prod and model that as functions. - ref: null | (((handle: any) => void) & { _stringRef: string | null | undefined }) | RefObject; - - // Input is the data coming into process this fiber. Arguments. Props. - pendingProps: any; // This type will be more specific once we overload the tag. - memoizedProps: any; // The props used to create the output. - - // A queue of state updates and callbacks. - updateQueue: UpdateQueue | null; - - // The state used to create the output - memoizedState: any; - - // A linked-list of contexts that this fiber depends on - firstContextDependency: ContextDependency | null; - - // Bitfield that describes properties about the fiber and its subtree. E.g. - // the AsyncMode flag indicates whether the subtree should be async-by- - // default. When a fiber is created, it inherits the mode of its - // parent. Additional flags can be set at creation time, but after that the - // value should remain unchanged throughout the fiber's lifetime, particularly - // before its child fibers are created. - mode: TypeOfMode; - - // Effect - effectTag: SideEffectTag; - - // Singly linked list fast path to the next fiber with side-effects. - nextEffect: Fiber | null; - - // The first and last fiber with side-effect within this subtree. This allows - // us to reuse a slice of the linked list when we reuse the work done within - // this fiber. - firstEffect: Fiber | null; - lastEffect: Fiber | null; - - // Represents a time in the future by which this work should be completed. - // Does not include work found in its subtree. - expirationTime: ExpirationTime; - - // This is used to quickly determine if a subtree has no pending changes. - childExpirationTime: ExpirationTime; - - // This is a pooled version of a Fiber. Every fiber that gets updated will - // eventually have a pair. There are cases when we can clean up pairs to save - // memory if we need to. - alternate: Fiber | null; - - // Time spent rendering this Fiber and its descendants for the current update. - // This tells us how well the tree makes use of sCU for memoization. - // It is reset to 0 each time we render and only updated when we don't bailout. - // This field is only set when the enableProfilerTimer flag is enabled. - actualDuration?: number; - - // If the Fiber is currently active in the "render" phase, - // This marks the time at which the work began. - // This field is only set when the enableProfilerTimer flag is enabled. - actualStartTime?: number; - - // Duration of the most recent render time for this Fiber. - // This value is not updated when we bailout for memoization purposes. - // This field is only set when the enableProfilerTimer flag is enabled. - selfBaseDuration?: number; - - // Sum of base times for all descedents of this Fiber. - // This value bubbles up during the "complete" phase. - // This field is only set when the enableProfilerTimer flag is enabled. - treeBaseDuration?: number; - - // Conceptual aliases - // workInProgress : Fiber -> alternate The alternate used for reuse happens - // to be the same as work in progress. - // __DEV__ only - _debugID?: number; - _debugSource?: Source | null; - _debugOwner?: Fiber | null; - _debugIsCurrentlyTiming?: boolean; -} diff --git a/types/react-reconciler/ReactFiberExpirationTime.d.ts b/types/react-reconciler/ReactFiberExpirationTime.d.ts deleted file mode 100644 index 8fb86f26ef..0000000000 --- a/types/react-reconciler/ReactFiberExpirationTime.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type ExpirationTime = number; diff --git a/types/react-reconciler/ReactFiberNewContext.d.ts b/types/react-reconciler/ReactFiberNewContext.d.ts deleted file mode 100644 index a212df9839..0000000000 --- a/types/react-reconciler/ReactFiberNewContext.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ReactContext } from './ReactTypes'; - -export interface ContextDependency { - context: ReactContext; - observedBits: number; - next: ContextDependency | null; -} diff --git a/types/react-reconciler/ReactFiberReconciler.d.ts b/types/react-reconciler/ReactFiberReconciler.d.ts deleted file mode 100644 index aa8ed61fe5..0000000000 --- a/types/react-reconciler/ReactFiberReconciler.d.ts +++ /dev/null @@ -1,255 +0,0 @@ -import { Component } from 'react'; -import { Fiber } from './ReactFiber'; -import { ExpirationTime } from './ReactFiberExpirationTime'; -import { FiberRoot } from './ReactFiberRoot'; -import { Deadline } from './ReactFiberScheduler'; -import { ReactNodeList } from './ReactTypes'; - -export type OpaqueHandle = Fiber; -export type OpaqueRoot = FiberRoot; - -export interface HostConfig { - getPublicInstance(instance: Instance | TextInstance): PublicInstance; - getRootHostContext(rootContainerInstance: Container): HostContext; - getChildHostContext(parentHostContext: HostContext, type: Type, rootContainerInstance: Container): HostContext; - - prepareForCommit(containerInfo: Container): void; - resetAfterCommit(containerInfo: Container): void; - - createInstance( - type: Type, - props: Props, - rootContainerInstance: Container, - hostContext: HostContext, - internalInstanceHandle: OpaqueHandle, - ): Instance; - appendInitialChild(parentInstance: Instance, child: Instance | TextInstance): void; - finalizeInitialChildren( - parentInstance: Instance, - type: Type, - props: Props, - rootContainerInstance: Container, - hostContext: HostContext, - ): boolean; - - prepareUpdate( - instance: Instance, - type: Type, - oldProps: Props, - newProps: Props, - rootContainerInstance: Container, - hostContext: HostContext, - ): null | UpdatePayload; - - shouldSetTextContent(type: Type, props: Props): boolean; - shouldDeprioritizeSubtree(type: Type, props: Props): boolean; - - createTextInstance( - text: string, - rootContainerInstance: Container, - hostContext: HostContext, - internalInstanceHandle: OpaqueHandle, - ): TextInstance; - - scheduleDeferredCallback( - callback: (deadline: Deadline) => void, - options?: { timeout: number }, - ): any; - cancelDeferredCallback(callbackID: any): void; - - setTimeout(handler: (...args: any[]) => void, timeout: number): TimeoutHandle | NoTimeout; - clearTimeout(handle: TimeoutHandle | NoTimeout): void; - noTimeout: NoTimeout; - - now(): number; - - // Temporary workaround for scenario where multiple renderers concurrently - // render using the same context objects. E.g. React DOM and React ART on the - // same page. DOM is the primary renderer; ART is the secondary renderer. - isPrimaryRenderer: boolean; - - supportsMutation: boolean; - supportsPersistence: boolean; - supportsHydration: boolean; - - // ------------------- - // Mutation - // (optional) - // ------------------- - appendChild?(parentInstance: Instance, child: Instance | TextInstance): void; - appendChildToContainer?(container: Container, child: Instance | TextInstance): void; - commitTextUpdate?(textInstance: TextInstance, oldText: string, newText: string): void; - commitMount?( - instance: Instance, - type: Type, - newProps: Props, - internalInstanceHandle: OpaqueHandle, - ): void; - commitUpdate?( - instance: Instance, - updatePayload: UpdatePayload, - type: Type, - oldProps: Props, - newProps: Props, - internalInstanceHandle: OpaqueHandle, - ): void; - insertBefore?(parentInstance: Instance, child: Instance | TextInstance, beforeChild: Instance | TextInstance): void; - insertInContainerBefore?( - container: Container, - child: Instance | TextInstance, - beforeChild: Instance | TextInstance, - ): void; - removeChild?(parentInstance: Instance, child: Instance | TextInstance): void; - removeChildFromContainer?(container: Container, child: Instance | TextInstance): void; - resetTextContent?(instance: Instance): void; - - // ------------------- - // Persistence - // (optional) - // ------------------- - cloneInstance?( - instance: Instance, - updatePayload: null | UpdatePayload, - type: Type, - oldProps: Props, - newProps: Props, - internalInstanceHandle: OpaqueHandle, - keepChildren: boolean, - recyclableInstance: Instance, - ): Instance; - - createContainerChildSet?(container: Container): ChildSet; - - appendChildToContainerChildSet?(childSet: ChildSet, child: Instance | TextInstance): void; - finalizeContainerChildren?(container: Container, newChildren: ChildSet): void; - - replaceContainerChildren?(container: Container, newChildren: ChildSet): void; - - // ------------------- - // Hydration - // (optional) - // ------------------- - canHydrateInstance?(instance: HydratableInstance, type: Type, props: Props): null | Instance; - canHydrateTextInstance?(instance: HydratableInstance, text: string): null | TextInstance; - getNextHydratableSibling?(instance: Instance | TextInstance | HydratableInstance): null | HydratableInstance; - getFirstHydratableChild?(parentInstance: Instance | Container): null | HydratableInstance; - hydrateInstance?( - instance: Instance, - type: Type, - props: Props, - rootContainerInstance: Container, - hostContext: HostContext, - internalInstanceHandle: OpaqueHandle, - ): null | UpdatePayload; - hydrateTextInstance?( - textInstance: TextInstance, - text: string, - internalInstanceHandle: OpaqueHandle, - ): boolean; - didNotMatchHydratedContainerTextInstance?( - parentContainer: Container, - textInstance: TextInstance, - text: string, - ): void; - didNotMatchHydratedTextInstance?( - parentType: Type, - parentProps: Props, - parentInstance: Instance, - textInstance: TextInstance, - text: string, - ): void; - didNotHydrateContainerInstance?(parentContainer: Container, instance: Instance | TextInstance): void; - didNotHydrateInstance?( - parentType: Type, - parentProps: Props, - parentInstance: Instance, - instance: Instance | TextInstance, - ): void; - didNotFindHydratableContainerInstance?( - parentContainer: Container, - type: Type, - props: Props, - ): void; - didNotFindHydratableContainerTextInstance?( - parentContainer: Container, - text: string, - ): void; - didNotFindHydratableInstance?( - parentType: Type, - parentProps: Props, - parentInstance: Instance, - type: Type, - props: Props, - ): void; - didNotFindHydratableTextInstance?( - parentType: Type, - parentProps: Props, - parentInstance: Instance, - text: string, - ): void; -} - -// 0 is PROD, 1 is DEV. -// Might add PROFILE later. -export type BundleType = 0 | 1; - -export interface DevToolsConfig { - bundleType: BundleType; - version: string; - rendererPackageName: string; - // Note: this actually *does* depend on Fiber internal fields. - // Used by "inspect clicked DOM element" in React DevTools. - findFiberByHostInstance?: (instance: Instance | TextInstance) => Fiber; - // Used by RN in-app inspector. - // This API is unfortunately RN-specific. - // TODO: Change it to accept Fiber instead and type it properly. - getInspectorDataForViewTag?: (tag: number) => object; -} - -export interface Reconciler { - updateContainerAtExpirationTime( - element: ReactNodeList, - container: OpaqueRoot, - parentComponent: Component | null | undefined, - expirationTime: ExpirationTime, - callback: () => void | null | undefined, - ): ExpirationTime; - createContainer( - containerInfo: Container, - isAsync: boolean, - hydrate: boolean, - ): OpaqueRoot; - updateContainer( - element: ReactNodeList, - container: OpaqueRoot, - parentComponent: Component | null | undefined, - callback: () => void | null | undefined, - ): ExpirationTime; - flushRoot(root: OpaqueRoot, expirationTime: ExpirationTime): void; - requestWork(root: OpaqueRoot, expirationTime: ExpirationTime): void; - computeUniqueAsyncExpiration(): ExpirationTime; - batchedUpdates(fn: () => A): A; - unbatchedUpdates(fn: () => A): A; - deferredUpdates(fn: () => A): A; - syncUpdates(fn: () => A): A; - interactiveUpdates(fn: () => A): A; - flushInteractiveUpdates(): void; - flushControlled(fn: () => any): void; - flushSync(fn: () => A): A; - - // Used to extract the return value from the initial render. Legacy API. - getPublicRootInstance( - container: OpaqueRoot, - ): Component | PublicInstance | null; - - // Use for findDOMNode/findHostNode. Legacy API. - findHostInstance(component: object): PublicInstance | null; - - // Used internally for filtering out portals. Legacy API. - findHostInstanceWithNoPortals(component: Fiber): PublicInstance | null; - injectIntoDevTools(devToolsConfig: DevToolsConfig): boolean; -} - -export default function ( - config: HostConfig, -): Reconciler; diff --git a/types/react-reconciler/ReactFiberRoot.d.ts b/types/react-reconciler/ReactFiberRoot.d.ts deleted file mode 100644 index 0117eb9d51..0000000000 --- a/types/react-reconciler/ReactFiberRoot.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Fiber } from './ReactFiber'; -import { ExpirationTime } from './ReactFiberExpirationTime'; -import { Interaction } from './Tracking'; - -// TODO: This should be lifted into the renderer. -export interface Batch { - _defer: boolean; - _expirationTime: ExpirationTime; - _onComplete: () => any; - _next: Batch | null; -} - -export type PendingInteractionMap = Map>; - -export interface BaseFiberRootProperties { - // Any additional information from the host associated with this root. - containerInfo: any; - // Used only by persistent updates. - pendingChildren: any; - // The currently active root fiber. This is the mutable root of the tree. - current: Fiber; - - // The following priority levels are used to distinguish between 1) - // uncommitted work, 2) uncommitted work that is suspended, and 3) uncommitted - // work that may be unsuspended. We choose not to track each individual - // pending level, trading granularity for performance. - // - // The earliest and latest priority levels that are suspended from committing. - earliestSuspendedTime: ExpirationTime; - latestSuspendedTime: ExpirationTime; - // The earliest and latest priority levels that are not known to be suspended. - earliestPendingTime: ExpirationTime; - latestPendingTime: ExpirationTime; - // The latest priority level that was pinged by a resolved promise and can - // be retried. - latestPingedTime: ExpirationTime; - - // If an error is thrown, and there are no more updates in the queue, we try - // rendering from the root one more time, synchronously, before handling - // the error. - didError: boolean; - - pendingCommitExpirationTime: ExpirationTime; - // A finished work-in-progress HostRoot that's ready to be committed. - finishedWork: Fiber | null; - // Timeout handle returned by setTimeout. Used to cancel a pending timeout, if - // it's superseded by a new one. - timeoutHandle: any; - // Top context object, used by renderSubtreeIntoContainer - context: object | null; - pendingContext: object | null; - // Determines if we should attempt to hydrate on the initial mount - readonly hydrate: boolean; - // Remaining expiration time on this root. - // TODO: Lift this into the renderer - nextExpirationTimeToWorkOn: ExpirationTime; - expirationTime: ExpirationTime; - // List of top-level batches. This list indicates whether a commit should be - // deferred. Also contains completion callbacks. - // TODO: Lift this into the renderer - firstBatch: Batch | null; - // Linked-list of roots - nextScheduledRoot: FiberRoot | null; -} - -// The following attributes are only used by interaction tracking builds. -// They enable interactions to be associated with their async work, -// And expose interaction metadata to the React DevTools Profiler plugin. -// Note that these attributes are only defined when the enableSchedulerTracking flag is enabled. -export interface ProfilingOnlyFiberRootProperties { - interactionThreadID: number; - memoizedInteractions: Set; - pendingInteractionMap: PendingInteractionMap; -} - -export type FiberRoot = BaseFiberRootProperties & ProfilingOnlyFiberRootProperties; diff --git a/types/react-reconciler/ReactFiberScheduler.d.ts b/types/react-reconciler/ReactFiberScheduler.d.ts deleted file mode 100644 index cfbadb016d..0000000000 --- a/types/react-reconciler/ReactFiberScheduler.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface Deadline { - timeRemaining: () => number; - didTimeout: boolean; -} diff --git a/types/react-reconciler/ReactSideEffectTags.d.ts b/types/react-reconciler/ReactSideEffectTags.d.ts deleted file mode 100644 index e2eec15313..0000000000 --- a/types/react-reconciler/ReactSideEffectTags.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type SideEffectTag = number; diff --git a/types/react-reconciler/ReactTypeOfMode.d.ts b/types/react-reconciler/ReactTypeOfMode.d.ts deleted file mode 100644 index 3e5c56b922..0000000000 --- a/types/react-reconciler/ReactTypeOfMode.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type TypeOfMode = number; diff --git a/types/react-reconciler/ReactTypes.d.ts b/types/react-reconciler/ReactTypes.d.ts deleted file mode 100644 index d962385049..0000000000 --- a/types/react-reconciler/ReactTypes.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ReactNode } from 'react'; - -export type ReactEmpty = null | undefined | boolean; - -export type ReactNodeList = ReactEmpty | ReactNode; - -export interface ReactProviderType { - $$typeof: symbol | number; - _context: ReactContext; -} - -export interface ReactContext { - $$typeof: symbol | number; - Consumer: ReactContext; - Provider: ReactProviderType; - unstable_read: () => T; - - _calculateChangedBits: ((a: T, b: T) => number) | null; - - _currentValue: T; - _currentValue2: T; - - // DEV only - _currentRenderer?: object | null; - _currentRenderer2?: object | null; -} - -export interface RefObject { - current: any; -} diff --git a/types/react-reconciler/ReactUpdateQueue.d.ts b/types/react-reconciler/ReactUpdateQueue.d.ts deleted file mode 100644 index 497ce9f0f6..0000000000 --- a/types/react-reconciler/ReactUpdateQueue.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { ExpirationTime } from './ReactFiberExpirationTime'; - -export interface Update { - expirationTime: ExpirationTime; - - tag: 0 | 1 | 2 | 3; - payload: any; - callback: (() => any) | null; - - next: Update | null; - nextEffect: Update | null; -} - -export interface UpdateQueue { - baseState: State; - - firstUpdate: Update | null; - lastUpdate: Update | null; - - firstCapturedUpdate: Update | null; - lastCapturedUpdate: Update | null; - - firstEffect: Update | null; - lastEffect: Update | null; - - firstCapturedEffect: Update | null; - lastCapturedEffect: Update | null; -} diff --git a/types/react-reconciler/ReactWorkTags.d.ts b/types/react-reconciler/ReactWorkTags.d.ts deleted file mode 100644 index fe7d38193c..0000000000 --- a/types/react-reconciler/ReactWorkTags.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export type WorkTag = - | 0 - | 1 - | 2 - | 3 - | 4 - | 5 - | 6 - | 7 - | 8 - | 9 - | 10 - | 11 - | 12 - | 13 - | 14 - | 15 - | 16; diff --git a/types/react-reconciler/Tracking.d.ts b/types/react-reconciler/Tracking.d.ts deleted file mode 100644 index 145815131c..0000000000 --- a/types/react-reconciler/Tracking.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface Interaction { - __count: number; - id: number; - name: string; - timestamp: number; -} diff --git a/types/react-reconciler/index.d.ts b/types/react-reconciler/index.d.ts index 97be10b84f..38f0cc92a3 100644 --- a/types/react-reconciler/index.d.ts +++ b/types/react-reconciler/index.d.ts @@ -4,17 +4,582 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -export { default } from './ReactFiberReconciler'; +import { Component, ReactNode } from 'react'; -export * from './ReactElementType'; -export * from './ReactFiber'; -export * from './ReactFiberNewContext'; -export * from './ReactFiberReconciler'; -export * from './ReactFiberRoot'; -export * from './ReactFiberScheduler'; -export * from './ReactSideEffectTags'; -export * from './ReactTypeOfMode'; -export * from './ReactTypes'; -export * from './ReactUpdateQueue'; -export * from './ReactWorkTags'; -export * from './Tracking'; +declare function ReactReconciler( + config: ReactReconciler.HostConfig, +): ReactReconciler.Reconciler; + +declare namespace ReactReconciler { + // react-ronciler/ReactFiber + + // A Fiber is work on a Component that needs to be done or was done. There can + // be more than one per component. + interface Fiber { + // These first fields are conceptually members of an Instance. This used to + // be split into a separate type and intersected with the other Fiber fields, + // but until Flow fixes its intersection bugs, we've merged them into a + // single type. + + // An Instance is shared between all versions of a component. We can easily + // break this out into a separate object to avoid copying so much to the + // alternate versions of the tree. We put this on a single object for now to + // minimize the number of objects created during the initial render. + + // Tag identifying the type of fiber. + tag: WorkTag; + + // Unique identifier of this child. + key: null | string; + + // The function/class/module associated with this fiber. + type: any; + + // The local state associated with this fiber. + stateNode: any; + + // Conceptual aliases + // parent : Instance -> return The parent happens to be the same as the + // return fiber since we've merged the fiber and instance. + + // Remaining fields belong to Fiber + + // The Fiber to return to after finishing processing this one. + // This is effectively the parent, but there can be multiple parents (two) + // so this is only the parent of the thing we're currently processing. + // It is conceptually the same as the return address of a stack frame. + return: Fiber | null; + + // Singly Linked List Tree Structure. + child: Fiber | null; + sibling: Fiber | null; + index: number; + + // The ref last used to attach this node. + // I'll avoid adding an owner field for prod and model that as functions. + ref: null | (((handle: any) => void) & { _stringRef: string | null | undefined }) | RefObject; + + // Input is the data coming into process this fiber. Arguments. Props. + pendingProps: any; // This type will be more specific once we overload the tag. + memoizedProps: any; // The props used to create the output. + + // A queue of state updates and callbacks. + updateQueue: UpdateQueue | null; + + // The state used to create the output + memoizedState: any; + + // A linked-list of contexts that this fiber depends on + firstContextDependency: ContextDependency | null; + + // Bitfield that describes properties about the fiber and its subtree. E.g. + // the AsyncMode flag indicates whether the subtree should be async-by- + // default. When a fiber is created, it inherits the mode of its + // parent. Additional flags can be set at creation time, but after that the + // value should remain unchanged throughout the fiber's lifetime, particularly + // before its child fibers are created. + mode: TypeOfMode; + + // Effect + effectTag: SideEffectTag; + + // Singly linked list fast path to the next fiber with side-effects. + nextEffect: Fiber | null; + + // The first and last fiber with side-effect within this subtree. This allows + // us to reuse a slice of the linked list when we reuse the work done within + // this fiber. + firstEffect: Fiber | null; + lastEffect: Fiber | null; + + // Represents a time in the future by which this work should be completed. + // Does not include work found in its subtree. + expirationTime: ExpirationTime; + + // This is used to quickly determine if a subtree has no pending changes. + childExpirationTime: ExpirationTime; + + // This is a pooled version of a Fiber. Every fiber that gets updated will + // eventually have a pair. There are cases when we can clean up pairs to save + // memory if we need to. + alternate: Fiber | null; + + // Time spent rendering this Fiber and its descendants for the current update. + // This tells us how well the tree makes use of sCU for memoization. + // It is reset to 0 each time we render and only updated when we don't bailout. + // This field is only set when the enableProfilerTimer flag is enabled. + actualDuration?: number; + + // If the Fiber is currently active in the "render" phase, + // This marks the time at which the work began. + // This field is only set when the enableProfilerTimer flag is enabled. + actualStartTime?: number; + + // Duration of the most recent render time for this Fiber. + // This value is not updated when we bailout for memoization purposes. + // This field is only set when the enableProfilerTimer flag is enabled. + selfBaseDuration?: number; + + // Sum of base times for all descedents of this Fiber. + // This value bubbles up during the "complete" phase. + // This field is only set when the enableProfilerTimer flag is enabled. + treeBaseDuration?: number; + + // Conceptual aliases + // workInProgress : Fiber -> alternate The alternate used for reuse happens + // to be the same as work in progress. + // __DEV__ only + _debugID?: number; + _debugSource?: Source | null; + _debugOwner?: Fiber | null; + _debugIsCurrentlyTiming?: boolean; + } + + // react-reconciler/ReactFiberExpirationTime + + type ExpirationTime = number; + + // react-reconciler/ReactFiberNewContext + + interface ContextDependency { + context: ReactContext; + observedBits: number; + next: ContextDependency | null; + } + + // react-reconciler/ReactFiberReconciler + + type OpaqueHandle = Fiber; + type OpaqueRoot = FiberRoot; + + interface HostConfig { + getPublicInstance(instance: Instance | TextInstance): PublicInstance; + getRootHostContext(rootContainerInstance: Container): HostContext; + getChildHostContext(parentHostContext: HostContext, type: Type, rootContainerInstance: Container): HostContext; + + prepareForCommit(containerInfo: Container): void; + resetAfterCommit(containerInfo: Container): void; + + createInstance( + type: Type, + props: Props, + rootContainerInstance: Container, + hostContext: HostContext, + internalInstanceHandle: OpaqueHandle, + ): Instance; + appendInitialChild(parentInstance: Instance, child: Instance | TextInstance): void; + finalizeInitialChildren( + parentInstance: Instance, + type: Type, + props: Props, + rootContainerInstance: Container, + hostContext: HostContext, + ): boolean; + + prepareUpdate( + instance: Instance, + type: Type, + oldProps: Props, + newProps: Props, + rootContainerInstance: Container, + hostContext: HostContext, + ): null | UpdatePayload; + + shouldSetTextContent(type: Type, props: Props): boolean; + shouldDeprioritizeSubtree(type: Type, props: Props): boolean; + + createTextInstance( + text: string, + rootContainerInstance: Container, + hostContext: HostContext, + internalInstanceHandle: OpaqueHandle, + ): TextInstance; + + scheduleDeferredCallback( + callback: (deadline: Deadline) => void, + options?: { timeout: number }, + ): any; + cancelDeferredCallback(callbackID: any): void; + + setTimeout(handler: (...args: any[]) => void, timeout: number): TimeoutHandle | NoTimeout; + clearTimeout(handle: TimeoutHandle | NoTimeout): void; + noTimeout: NoTimeout; + + now(): number; + + // Temporary workaround for scenario where multiple renderers concurrently + // render using the same context objects. E.g. React DOM and React ART on the + // same page. DOM is the primary renderer; ART is the secondary renderer. + isPrimaryRenderer: boolean; + + supportsMutation: boolean; + supportsPersistence: boolean; + supportsHydration: boolean; + + // ------------------- + // Mutation + // (optional) + // ------------------- + appendChild?(parentInstance: Instance, child: Instance | TextInstance): void; + appendChildToContainer?(container: Container, child: Instance | TextInstance): void; + commitTextUpdate?(textInstance: TextInstance, oldText: string, newText: string): void; + commitMount?( + instance: Instance, + type: Type, + newProps: Props, + internalInstanceHandle: OpaqueHandle, + ): void; + commitUpdate?( + instance: Instance, + updatePayload: UpdatePayload, + type: Type, + oldProps: Props, + newProps: Props, + internalInstanceHandle: OpaqueHandle, + ): void; + insertBefore?(parentInstance: Instance, child: Instance | TextInstance, beforeChild: Instance | TextInstance): void; + insertInContainerBefore?( + container: Container, + child: Instance | TextInstance, + beforeChild: Instance | TextInstance, + ): void; + removeChild?(parentInstance: Instance, child: Instance | TextInstance): void; + removeChildFromContainer?(container: Container, child: Instance | TextInstance): void; + resetTextContent?(instance: Instance): void; + + // ------------------- + // Persistence + // (optional) + // ------------------- + cloneInstance?( + instance: Instance, + updatePayload: null | UpdatePayload, + type: Type, + oldProps: Props, + newProps: Props, + internalInstanceHandle: OpaqueHandle, + keepChildren: boolean, + recyclableInstance: Instance, + ): Instance; + + createContainerChildSet?(container: Container): ChildSet; + + appendChildToContainerChildSet?(childSet: ChildSet, child: Instance | TextInstance): void; + finalizeContainerChildren?(container: Container, newChildren: ChildSet): void; + + replaceContainerChildren?(container: Container, newChildren: ChildSet): void; + + // ------------------- + // Hydration + // (optional) + // ------------------- + canHydrateInstance?(instance: HydratableInstance, type: Type, props: Props): null | Instance; + canHydrateTextInstance?(instance: HydratableInstance, text: string): null | TextInstance; + getNextHydratableSibling?(instance: Instance | TextInstance | HydratableInstance): null | HydratableInstance; + getFirstHydratableChild?(parentInstance: Instance | Container): null | HydratableInstance; + hydrateInstance?( + instance: Instance, + type: Type, + props: Props, + rootContainerInstance: Container, + hostContext: HostContext, + internalInstanceHandle: OpaqueHandle, + ): null | UpdatePayload; + hydrateTextInstance?( + textInstance: TextInstance, + text: string, + internalInstanceHandle: OpaqueHandle, + ): boolean; + didNotMatchHydratedContainerTextInstance?( + parentContainer: Container, + textInstance: TextInstance, + text: string, + ): void; + didNotMatchHydratedTextInstance?( + parentType: Type, + parentProps: Props, + parentInstance: Instance, + textInstance: TextInstance, + text: string, + ): void; + didNotHydrateContainerInstance?(parentContainer: Container, instance: Instance | TextInstance): void; + didNotHydrateInstance?( + parentType: Type, + parentProps: Props, + parentInstance: Instance, + instance: Instance | TextInstance, + ): void; + didNotFindHydratableContainerInstance?( + parentContainer: Container, + type: Type, + props: Props, + ): void; + didNotFindHydratableContainerTextInstance?( + parentContainer: Container, + text: string, + ): void; + didNotFindHydratableInstance?( + parentType: Type, + parentProps: Props, + parentInstance: Instance, + type: Type, + props: Props, + ): void; + didNotFindHydratableTextInstance?( + parentType: Type, + parentProps: Props, + parentInstance: Instance, + text: string, + ): void; + } + + // 0 is PROD, 1 is DEV. + // Might add PROFILE later. + type BundleType = 0 | 1; + + interface DevToolsConfig { + bundleType: BundleType; + version: string; + rendererPackageName: string; + // Note: this actually *does* depend on Fiber internal fields. + // Used by "inspect clicked DOM element" in React DevTools. + findFiberByHostInstance?: (instance: Instance | TextInstance) => Fiber; + // Used by RN in-app inspector. + // This API is unfortunately RN-specific. + // TODO: Change it to accept Fiber instead and type it properly. + getInspectorDataForViewTag?: (tag: number) => object; + } + + interface Reconciler { + updateContainerAtExpirationTime( + element: ReactNodeList, + container: OpaqueRoot, + parentComponent: Component | null | undefined, + expirationTime: ExpirationTime, + callback: () => void | null | undefined, + ): ExpirationTime; + createContainer( + containerInfo: Container, + isAsync: boolean, + hydrate: boolean, + ): OpaqueRoot; + updateContainer( + element: ReactNodeList, + container: OpaqueRoot, + parentComponent: Component | null | undefined, + callback: () => void | null | undefined, + ): ExpirationTime; + flushRoot(root: OpaqueRoot, expirationTime: ExpirationTime): void; + requestWork(root: OpaqueRoot, expirationTime: ExpirationTime): void; + computeUniqueAsyncExpiration(): ExpirationTime; + batchedUpdates(fn: () => A): A; + unbatchedUpdates(fn: () => A): A; + deferredUpdates(fn: () => A): A; + syncUpdates(fn: () => A): A; + interactiveUpdates(fn: () => A): A; + flushInteractiveUpdates(): void; + flushControlled(fn: () => any): void; + flushSync(fn: () => A): A; + + // Used to extract the return value from the initial render. Legacy API. + getPublicRootInstance( + container: OpaqueRoot, + ): Component | PublicInstance | null; + + // Use for findDOMNode/findHostNode. Legacy API. + findHostInstance(component: object): PublicInstance | null; + + // Used internally for filtering out portals. Legacy API. + findHostInstanceWithNoPortals(component: Fiber): PublicInstance | null; + injectIntoDevTools(devToolsConfig: DevToolsConfig): boolean; + } + + // react-reconciler/ReactFiberRoot + + // TODO: This should be lifted into the renderer. + interface Batch { + _defer: boolean; + _expirationTime: ExpirationTime; + _onComplete: () => any; + _next: Batch | null; + } + + type PendingInteractionMap = Map>; + + interface BaseFiberRootProperties { + // Any additional information from the host associated with this root. + containerInfo: any; + // Used only by persistent updates. + pendingChildren: any; + // The currently active root fiber. This is the mutable root of the tree. + current: Fiber; + + // The following priority levels are used to distinguish between 1) + // uncommitted work, 2) uncommitted work that is suspended, and 3) uncommitted + // work that may be unsuspended. We choose not to track each individual + // pending level, trading granularity for performance. + // + // The earliest and latest priority levels that are suspended from committing. + earliestSuspendedTime: ExpirationTime; + latestSuspendedTime: ExpirationTime; + // The earliest and latest priority levels that are not known to be suspended. + earliestPendingTime: ExpirationTime; + latestPendingTime: ExpirationTime; + // The latest priority level that was pinged by a resolved promise and can + // be retried. + latestPingedTime: ExpirationTime; + + // If an error is thrown, and there are no more updates in the queue, we try + // rendering from the root one more time, synchronously, before handling + // the error. + didError: boolean; + + pendingCommitExpirationTime: ExpirationTime; + // A finished work-in-progress HostRoot that's ready to be committed. + finishedWork: Fiber | null; + // Timeout handle returned by setTimeout. Used to cancel a pending timeout, if + // it's superseded by a new one. + timeoutHandle: any; + // Top context object, used by renderSubtreeIntoContainer + context: object | null; + pendingContext: object | null; + // Determines if we should attempt to hydrate on the initial mount + readonly hydrate: boolean; + // Remaining expiration time on this root. + // TODO: Lift this into the renderer + nextExpirationTimeToWorkOn: ExpirationTime; + expirationTime: ExpirationTime; + // List of top-level batches. This list indicates whether a commit should be + // deferred. Also contains completion callbacks. + // TODO: Lift this into the renderer + firstBatch: Batch | null; + // Linked-list of roots + nextScheduledRoot: FiberRoot | null; + } + + // The following attributes are only used by interaction tracking builds. + // They enable interactions to be associated with their async work, + // And expose interaction metadata to the React DevTools Profiler plugin. + // Note that these attributes are only defined when the enableSchedulerTracking flag is enabled. + interface ProfilingOnlyFiberRootProperties { + interactionThreadID: number; + memoizedInteractions: Set; + pendingInteractionMap: PendingInteractionMap; + } + + type FiberRoot = BaseFiberRootProperties & ProfilingOnlyFiberRootProperties; + + // react-reconciler/ReactFiberScheduler + + interface Deadline { + timeRemaining: () => number; + didTimeout: boolean; + } + + // react-reconciler/ReactTypeOfMode + + type TypeOfMode = number; + + // react-reconciler/ReactUpdateQueue + + interface Update { + expirationTime: ExpirationTime; + + tag: 0 | 1 | 2 | 3; + payload: any; + callback: (() => any) | null; + + next: Update | null; + nextEffect: Update | null; + } + + interface UpdateQueue { + baseState: State; + + firstUpdate: Update | null; + lastUpdate: Update | null; + + firstCapturedUpdate: Update | null; + lastCapturedUpdate: Update | null; + + firstEffect: Update | null; + lastEffect: Update | null; + + firstCapturedEffect: Update | null; + lastCapturedEffect: Update | null; + } + + // schedule/Tracking + + interface Interaction { + __count: number; + id: number; + name: string; + timestamp: number; + } + + // shared/ReactElementType + + interface Source { + fileName: string; + lineNumber: number; + } + + // shared/ReactSideEffectTags + + type SideEffectTag = number; + + // shared/ReactTypes + + type ReactEmpty = null | undefined | boolean; + + type ReactNodeList = ReactEmpty | ReactNode; + + interface ReactProviderType { + $$typeof: symbol | number; + _context: ReactContext; + } + + interface ReactContext { + $$typeof: symbol | number; + Consumer: ReactContext; + Provider: ReactProviderType; + unstable_read: () => T; + + _calculateChangedBits: ((a: T, b: T) => number) | null; + + _currentValue: T; + _currentValue2: T; + + // DEV only + _currentRenderer?: object | null; + _currentRenderer2?: object | null; + } + + interface RefObject { + current: any; + } + + // shared/ReactWorkTags + + type WorkTag = + | 0 + | 1 + | 2 + | 3 + | 4 + | 5 + | 6 + | 7 + | 8 + | 9 + | 10 + | 11 + | 12 + | 13 + | 14 + | 15 + | 16; +} + +export = ReactReconciler; diff --git a/types/react-reconciler/test/react-reconciler-tests.ts b/types/react-reconciler/test/react-reconciler-tests.ts index 9008446d6a..5896ff1ea3 100644 --- a/types/react-reconciler/test/react-reconciler-tests.ts +++ b/types/react-reconciler/test/react-reconciler-tests.ts @@ -1,4 +1,4 @@ -import ReactFiberReconciler from 'react-reconciler'; +import * as ReactFiberReconciler from 'react-reconciler'; import * as ReactTestHostConfig from './ReactTestHostConfig'; // $ExpectType Reconciler From 502af779fb6a9c77f1d30e6ad5af34e01283a0dd Mon Sep 17 00:00:00 2001 From: mscharlock Date: Wed, 19 Sep 2018 21:34:31 -0700 Subject: [PATCH 61/78] adding comment --- types/custom-functions-runtime/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index e233a869fd..3b44fb9d21 100644 --- a/types/custom-functions-runtime/index.d.ts +++ b/types/custom-functions-runtime/index.d.ts @@ -9,6 +9,9 @@ office-js Copyright (c) Microsoft Corporation */ +/* +* Enables you to map your own name that uses lowercase letters to a function. +*/ declare let CustomFunctionMappings: { [key: string]: Function }; declare namespace CustomFunctions { From eff4c9777949979178ecd8d42333abf41032367d Mon Sep 17 00:00:00 2001 From: dkpsk Date: Thu, 20 Sep 2018 20:39:19 +0900 Subject: [PATCH 62/78] fix definition for getProperty to return string | null --- types/google-apps-script/google-apps-script.properties.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/google-apps-script/google-apps-script.properties.d.ts b/types/google-apps-script/google-apps-script.properties.d.ts index 184c46b28f..af38a01c9f 100644 --- a/types/google-apps-script/google-apps-script.properties.d.ts +++ b/types/google-apps-script/google-apps-script.properties.d.ts @@ -19,7 +19,7 @@ declare namespace GoogleAppsScript { deleteProperty(key: string): Properties; getKeys(): string[]; getProperties(): Object; - getProperty(key: string): string; + getProperty(key: string): string | null; setProperties(properties: Object): Properties; setProperties(properties: Object, deleteAllOthers: boolean): Properties; setProperty(key: string, value: string): Properties; @@ -56,7 +56,7 @@ declare namespace GoogleAppsScript { deleteProperty(key: string): ScriptProperties; getKeys(): string[]; getProperties(): Object; - getProperty(key: string): string; + getProperty(key: string): string | null; setProperties(properties: Object): ScriptProperties; setProperties(properties: Object, deleteAllOthers: boolean): ScriptProperties; setProperty(key: string, value: string): ScriptProperties; @@ -73,7 +73,7 @@ declare namespace GoogleAppsScript { deleteProperty(key: string): UserProperties; getKeys(): string[]; getProperties(): Object; - getProperty(key: string): string; + getProperty(key: string): string | null; setProperties(properties: Object): UserProperties; setProperties(properties: Object, deleteAllOthers: boolean): UserProperties; setProperty(key: string, value: string): UserProperties; From 74e1cea0b92c80e5710e7ca0b55566f226eb443d Mon Sep 17 00:00:00 2001 From: Guillermo Gombau Date: Thu, 20 Sep 2018 14:13:24 +0200 Subject: [PATCH 63/78] Add vec2#rotate --- types/gl-matrix/gl-matrix-tests.ts | 1 + types/gl-matrix/index.d.ts | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/types/gl-matrix/gl-matrix-tests.ts b/types/gl-matrix/gl-matrix-tests.ts index cf9c4ef616..e557acf79d 100644 --- a/types/gl-matrix/gl-matrix-tests.ts +++ b/types/gl-matrix/gl-matrix-tests.ts @@ -74,6 +74,7 @@ outVec2 = vec2.cross(outVec3, vec2A, vec2B); outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5); outVec2 = vec2.random(outVec2); outVec2 = vec2.random(outVec2, 5.0); +outVec2 = vec2.rotate(outVec2, vec2A, vec2B, Math.PI * 0.5); outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A); outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA); outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A); diff --git a/types/gl-matrix/index.d.ts b/types/gl-matrix/index.d.ts index 2c86b6a057..33db200cd6 100644 --- a/types/gl-matrix/index.d.ts +++ b/types/gl-matrix/index.d.ts @@ -374,6 +374,17 @@ declare module 'gl-matrix' { */ public static random(out: vec2, scale: number): vec2; + /** + * Rotate a 2D vector + * + * @param out The receiving vec2 + * @param a The vec2 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + public static rotate(out: vec2, a: vec2, b: vec2, c: number): vec2; + /** * Transforms the vec2 with a mat2 * @@ -1959,13 +1970,13 @@ declare module 'gl-matrix' { * @returns out */ public static transpose(out: mat3, a: mat3): mat3; - + /** * Generates a 2D projection matrix with the given bounds * * @param out the receiving matrix * @param width width of your gl context - * @param height height of gl context + * @param height height of gl context * @returns out */ public static projection(out: mat3, width: number, height: number): mat3; @@ -2510,9 +2521,9 @@ declare module 'gl-matrix' { public static getTranslation(out: vec3, mat: mat4): vec3; /** - * Returns the scaling factor component of a transformation matrix. - * If a matrix is built with fromRotationTranslationScale with a - * normalized Quaternion parameter, the returned vector will be + * Returns the scaling factor component of a transformation matrix. + * If a matrix is built with fromRotationTranslationScale with a + * normalized Quaternion parameter, the returned vector will be * the same as the scaling vector originally supplied. * @param {vec3} out Vector to receive scaling factor component * @param {mat4} mat Matrix to be decomposed (input) From a8fbb851de7970d4d0d2b88fc36f5e3cd7d2b497 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Thu, 20 Sep 2018 08:54:47 -0400 Subject: [PATCH 64/78] Disable rule --- types/react-reconciler/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-reconciler/index.d.ts b/types/react-reconciler/index.d.ts index 38f0cc92a3..df371c0d25 100644 --- a/types/react-reconciler/index.d.ts +++ b/types/react-reconciler/index.d.ts @@ -7,6 +7,7 @@ import { Component, ReactNode } from 'react'; declare function ReactReconciler( + // eslint-disable-next-line no-unnecessary-generics config: ReactReconciler.HostConfig, ): ReactReconciler.Reconciler; From 138afa6e2c2e3c4f77a13073bdeb8e8ea4f62af8 Mon Sep 17 00:00:00 2001 From: Silas Rech Date: Thu, 20 Sep 2018 15:03:20 +0200 Subject: [PATCH 65/78] Fixes + update to 11.9 --- types/i18next/index.d.ts | 50 ++- types/i18next/v8/i18next-tests.ts | 455 ++++++++++++++++++++++ types/i18next/v8/index.d.ts | 619 ++++++++++++++++++++++++++++++ types/i18next/v8/tsconfig.json | 29 ++ types/i18next/v8/tslint.json | 1 + 5 files changed, 1148 insertions(+), 6 deletions(-) create mode 100644 types/i18next/v8/i18next-tests.ts create mode 100644 types/i18next/v8/index.d.ts create mode 100644 types/i18next/v8/tsconfig.json create mode 100644 types/i18next/v8/tslint.json diff --git a/types/i18next/index.d.ts b/types/i18next/index.d.ts index 484745bcad..9c310a4770 100644 --- a/types/i18next/index.d.ts +++ b/types/i18next/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for i18next 8.4 +// Type definitions for i18next 11.9 // Project: http://i18next.com // Definitions by: Michael Ledin // Budi Irawan // Giedrius Grabauskas +// Silas Rech // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -15,6 +16,18 @@ declare namespace i18next { type FormatFunction = (value: string, format?: string, lng?: string) => string; + /* tslint:disable-next-line:no-empty-interface */ + interface DetectionPluginOptions { + } + + /* tslint:disable-next-line:no-empty-interface */ + interface BackendPluginOptions { + } + + /* tslint:disable-next-line:no-empty-interface */ + interface CachePluginOptions { + } + interface InterpolationOptions { /** * format function see formatting for details @@ -37,6 +50,11 @@ declare namespace i18next { * @default true */ escapeValue?: boolean; + /** + * If true, then value passed into escape function is not casted to string, use with custom escape function that does its own type check + * @default false + */ + useRawValueToEscape?: boolean; /** * prefix for interpolation * @default '{{' @@ -91,7 +109,12 @@ declare namespace i18next { * global variables to use in interpolation replacements * @default undefined */ - defaultVariables?: any; + defaultVariables?: { [index: string]: any }; + /** + * after how many interpolation runs to break out before throwing a stack overflow + * @default 1000 + */ + maxReplaces?: number; } interface ReactOptions { @@ -204,6 +227,15 @@ declare namespace i18next { */ saveMissing?: boolean; + /** + * experimental: enable to update default values using the saveMissing + * (Works only if defaultValue different from translated value. + * Only useful on initial development or when keeping code as source of truth not changing values outside of code. + * Only supported if backend supports it already) + * @default false + */ + updateMissing?: boolean; + /** * @default 'fallback' */ @@ -213,7 +245,7 @@ declare namespace i18next { * Used for custom missing key handling (needs saveMissing set to true!) * @default false */ - missingKeyHandler?: false | ((lng: string, ns: string, key: string, fallbackValue: string) => void); + missingKeyHandler?: false | ((lngs: string[], ns: string, key: string, fallbackValue: string) => void); /** * receives a key that was not found in `t()` and returns a value, that will be returned by `t()` @@ -227,6 +259,12 @@ declare namespace i18next { */ appendNamespaceToMissingKey?: boolean; + /** + * gets called in case a interpolation value is undefined. This method will not be called if the value is empty string or null + * @default noop + */ + missingInterpolationHandler?: (text: string, value: any) => any; + /** * will use 'plural' as suffix for languages only having 1 plural form, setting it to false will suffix all with numbers * @default true @@ -284,19 +322,19 @@ declare namespace i18next { * options for language detection - check documentation of plugin * @default undefined */ - detection?: object; + detection?: DetectionPluginOptions; /** * options for backend - check documentation of plugin * @default undefined */ - backend?: object; + backend?: BackendPluginOptions; /** * options for cache layer - check documentation of plugin * @default undefined */ - cache?: object; + cache?: CachePluginOptions; /** * options for react - check documentation of plugin diff --git a/types/i18next/v8/i18next-tests.ts b/types/i18next/v8/i18next-tests.ts new file mode 100644 index 0000000000..1a425084e8 --- /dev/null +++ b/types/i18next/v8/i18next-tests.ts @@ -0,0 +1,455 @@ +import * as i18next from 'i18next'; + +i18next.init({ + lng: "en", + debug: true, + resources: { + en: { + translation: { + key: "hello world" + } + } + } +}, (err: any, t: i18next.TranslationFunction) => { + // initialized and ready to go! + const value: string = i18next.t('key'); +}); + +i18next.init({ initImmediate: false }); + +i18next.init({ + lng: 'en', + debug: true, + resources: { + en: { + translation: { + key: "hello world" + } + }, + de: { + translation: { + key: "hello welt" + } + } + } +}, (err: any, t: i18next.TranslationFunction) => { + // init set content + updateContent(); +}); + +i18next.init({ + ns: ['common', 'moduleA', 'moduleB'], + defaultNS: 'moduleA' +}, (err: any, t: i18next.TranslationFunction) => { + i18next.t('myKey'); // key in moduleA namespace (defined default) + i18next.t('common:myKey'); // key in common namespace +}); + +i18next.loadNamespaces('anotherNamespace', (err: any, t: i18next.TranslationFunction) => { /* ... */ }); + +// fallback to one language +i18next.init({ + lng: 'en-GB' +}, () => { + i18next.t('i18n'); // -> "Internationalisation" + i18next.t('i18n_short'); // -> "i18n" (from en.json) + + // force loading en + i18next.t('i18n', { lng: 'en' }); // -> "Internationalization" +}); + +// fallback to one language +i18next.init({ + fallbackLng: 'en' +}); + +// fallback ordered +i18next.init({ + fallbackLng: ['fr', 'en'] +}); + +// fallback depending on user language +i18next.init({ + fallbackLng: { + 'de-CH': ['fr', 'it'], + 'zh-HANT': ['zh-HANS', 'en'], + es: ['fr'], + default: ['en'] + } +}); + +const updateContent = () => { + const value: string = i18next.t('key'); +}; + +const changeLng = (lng: string) => { + i18next.changeLanguage(lng); +}; + +i18next.init({ + // files to load + ns: ['app', 'common'], + + // default namespace (needs no prefix on calling t) + defaultNS: 'app', + + // fallback, can be a string or an array of namespaces + fallbackNS: 'common' +}, () => { + i18next.t('title'); // -> "i18next" + + i18next.t('button.save'); // -> "save" (fallback from common) + + // without fallbackNS you would have to prefix namespace + // to access keys in that namespace + i18next.t('common:button.save'); // -> "save" +}); + +i18next.init({ + lng: 'de', + + // allow keys to be phrases having `:`, `.` + nsSeparator: false, + keySeparator: false, + + // do not load a fallback + fallbackLng: false +}); + +const error404 = '404'; +i18next.t([`error.${error404}`, 'error.unspecific']); // -> "The page was not found" + +const error502 = '502'; +i18next.t([`error.${error502}`, 'error.unspecific']); // -> "Something went wrong" + +i18next.t('No one says a key can not be the fallback.'); +// -> "Niemand sagt ein key kann nicht als Ersatz dienen." + +i18next.t('This will be shown if the current loaded translations to not have this.'); +// -> "This will be shown if the current loaded translations to not have this." + +const languageChangedCallback = () => { + updateContent(); +}; + +i18next.on('languageChanged', languageChangedCallback); +i18next.off('languageChanged', languageChangedCallback); + +i18next + .init({ + fallbackLng: 'en', + debug: true, + ns: ['special', 'common'], + defaultNS: 'special', + backend: { + // load from i18next-gitbook repo + loadPath: 'https://raw.githubusercontent.com/i18next/i18next-gitbook/master/locales/{{lng}}/{{ns}}.json', + crossDomain: true + } + }, (err: any, t: i18next.TranslationFunction) => { + // init set content + updateContent2(); + }); + +// just set some content and react to language changes +// could be optimized using vue-i18next, jquery-i18next, react-i18next, ... +const updateContent2 = () => { + const value: string = i18next.t('title', { what: 'i18next' }); + const value2: string = i18next.t('common:button.save', { count: Math.floor(Math.random() * 2 + 1) }); + const value3 = `detected user language: "${i18next.language}" --> loaded languages: "${i18next.languages.join(', ')}"`; +}; + +i18next.init({ + fallbackLng: 'en', + ns: ['file1', 'file2'], + defaultNS: 'file1', + debug: true +}, (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +// with only callback +i18next.init((err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +const v: string = i18next.t('my.key'); +const a: boolean = i18next.exists('my.key'); + +// fix language to german +const de = i18next.getFixedT('de'); +const z: string = de('myKey'); + +// or fix the namespace to anotherNamespace +const anotherNamespace = i18next.getFixedT(null, 'anotherNamespace'); +const x: string = anotherNamespace('anotherNamespaceKey'); // no need to prefix ns i18n.t('anotherNamespace:anotherNamespaceKey'); + +i18next.changeLanguage('en', (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +i18next.loadNamespaces('myNamespace', (err: any, t: i18next.TranslationFunction) => { /* resources have been loaded */ }); +i18next.loadNamespaces(['myNamespace1', 'myNamespace2'], (err: any, t: i18next.TranslationFunction) => { /* resources have been loaded */ }); + +i18next.loadLanguages('de', (err: any, t: i18next.TranslationFunction) => { /* resources have been loaded */ }); +i18next.loadLanguages(['de', 'fr'], (err: any, t: i18next.TranslationFunction) => { /* resources have been loaded */ }); + +// reload all +i18next.reloadResources(); + +// reload languages +i18next.reloadResources(['de', 'fr']); + +// reload namespaces for all languages +i18next.reloadResources(null, ['ns1', 'ns2']); + +// reload namespaces in languages +i18next.reloadResources(['de', 'fr'], ['ns1', 'ns2']); + +// for current language +i18next.dir(); + +// for another language +i18next.dir('en-US'); // -> "ltr"; +i18next.dir('ar'); // -> "rtl"; + +// key = 'hello {{what}}' +i18next.t('key', { what: i18next.format('world', 'uppercase') }); // -> hello WORLD + +const newInstance = i18next.createInstance({ + fallbackLng: 'en', + ns: ['file1', 'file2'], + defaultNS: 'file1', + debug: true +}, (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +// is the same as +newInstance.init({ + fallbackLng: 'en', + ns: ['file1', 'file2'], + defaultNS: 'file1', + debug: true +}, (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +const newInstance2 = i18next.cloneInstance({ + fallbackLng: 'en', + ns: ['file1', 'file2'], + defaultNS: 'file1', + debug: true +}, (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +// is the same as +const newInstance3 = i18next.cloneInstance(); +newInstance.init({ + fallbackLng: 'en', + ns: ['file1', 'file2'], + defaultNS: 'file1', + debug: true +}, (err: any, t: i18next.TranslationFunction) => { + if (err) { + console.log('something went wrong loading', err); + return; + } + t('key'); // -> same as i18next.t +}); + +i18next.on('initialized', options => { }); +i18next.on('loaded', loaded => { }); +i18next.on('failedLoading', (lng: string, ns: string, msg: string) => { }); +i18next.on('missingKey', (lngs: string[], namespace: string, key: string, res: string) => { }); +i18next.on('added', (lng: string, ns: string) => { }); +i18next.on('removed', (lng: string, ns: string) => { }); +i18next.on('languageChanged', (lng: string) => { }); +i18next.on("customEvent", () => { }); + +i18next.getResource("en", "test", "key"); +i18next.getResource("en", "test", "key", { keySeparator: "-" }); + +i18next.addResource("en", "test", "key", "value"); +i18next.addResource("en", "test", "key", "value", { keySeparator: "-", silent: false }); + +i18next.addResources("en", "test", { key: "value" }); + +i18next.addResourceBundle('en', 'translations', { + key: 'value', +}, true, true); + +const has: boolean = i18next.hasResourceBundle("en", "test"); + +i18next.getResourceBundle("en", "test"); + +i18next.removeResourceBundle("en", "test"); + +i18next + .init({ + resources: { + en: { + namespace1: { + key: 'hello from namespace 1' + }, + namespace2: { + key: 'hello from namespace 2' + } + }, + de: { + namespace1: { + key: 'hallo von namespace 1' + }, + namespace2: { + key: 'hallo von namespace 2' + } + } + } + }); + +i18next.init(); + +i18next.addResourceBundle("en", 'namespace1', { + key: 'hello from namespace 1' +}); + +i18next + .init({ + backend: { + // for all available options read the backend's repository readme file + loadPath: '/locales/{{lng}}/{{ns}}.json' + } + }); + +i18next.init({ + ns: ['common', 'moduleA'], + defaultNS: 'moduleA' +}); + +i18next.t('key', { what: 'i18next', how: 'great' }); + +const author = { + name: 'Jan', + github: 'jamuhl' +}; +i18next.t('key', { author }); + +i18next.t('keyEscaped', { myVar: '' }); +// -> "no danger <img />" + +i18next.t('keyUnescaped', { myVar: '' }); +// -> "dangerous " + +i18next.t('keyEscaped', { myVar: '', interpolation: { escapeValue: false } }); +// -> "no danger " (obviously could be dangerous) + +i18next + .init({ + lng: 'en', + fallbackLng: 'en', + + resources: { + en: { + translation: { + key1: 'test', + interpolateKey: 'add {{insert}} {{up, uppercase}}', + interpolateKey2: 'add {{insert}} {{up, uppercase}}' + } + } + }, + + interpolation: { + escapeValue: false, // not needed for react!! + formatSeparator: ',', + format: (value: string, format: string, lng: string) => { + if (format === 'uppercase') return value.toUpperCase(); + return value; + } + } + }); + +i18next.t('key', { count: 0 }); // -> "items" +i18next.t('key', { count: 1 }); // -> "item" +i18next.t('key', { count: 5 }); // -> "items" +i18next.t('key', { count: 100 }); // -> "items" +i18next.t('keyWithCount', { count: 0 }); // -> "0 items" +i18next.t('keyWithCount', { count: 1 }); // -> "1 item" +i18next.t('keyWithCount', { count: 5 }); // -> "5 items" +i18next.t('keyWithCount', { count: 100 }); // -> "100 items" + +i18next.t('key1_interval', { postProcess: 'interval', count: 1 }); // -> "one item" +i18next.t('key1_interval', { postProcess: 'interval', count: 4 }); // -> "a few items" +i18next.t('key1_interval', { postProcess: 'interval', count: 100 }); // -> "a lot of items" + +// not matching into a range it will fallback to +// the regular plural form +i18next.t('key2_interval', { postProcess: 'interval', count: 1 }); // -> "one item" +i18next.t('key2_interval', { postProcess: 'interval', count: 4 }); // -> "a few items" +i18next.t('key2_interval', { postProcess: 'interval', count: 100 }); // -> "100 items" +i18next.t('friend', { context: 'male', count: 1 }); // -> "A boyfriend" +i18next.t('friend', { context: 'male', count: 1 }); // -> "A boyfriend" +i18next.t('friend', { context: 'female', count: 100 }); // -> "100 girlfriends" +i18next.t('friend', { context: 'female', count: 100 }); // -> "100 girlfriends" +i18next.t('tree', { returnObjects: true, something: 'gold' }); +// -> { res: 'added gold' } + +i18next.t('array', { returnObjects: true }); +// -> ['a', 'b', 'c'] +i18next.t('arrayJoin', { joinArrays: '+' }); +// -> "line1+line2+line3" + +i18next.t('arrayJoinWithInterpolation', { myVar: 'interpolate', joinArrays: ' ' }); +// -> "you can interpolate" + +i18next.t('arrayOfObjects.0.name'); +// -> "tom" + +type KeyList = "friend" | "tree"; + +interface CustomOptions { + myVar: string; +} + +i18next.t("friend"); +i18next.t(["friend", "tree"]); +i18next.t("friend", { myVar: "someValue" }); +i18next.t(["friend", "tree"], { myVar: "someValue" }); +i18next.t("friend", { myVar: "someValue" }); +i18next.t(["friend", "tree"], { myVar: "someValue" }); + +const t1: i18next.TranslationFunction = (key: string, options: i18next.TranslationOptions) => ""; +const t2: i18next.TranslationFunction<{ value: string }> = (key: string, options: i18next.TranslationOptions) => ({ value: "asd" }); +const t3: i18next.TranslationFunction = (key: string | string[], options: i18next.TranslationOptions) => ""; +const t4: i18next.TranslationFunction = (key: KeyList | KeyList[], options: i18next.TranslationOptions) => ""; + +i18next.exists("friend"); +i18next.exists(["friend", "tree"]); +i18next.exists("friend", { myVar: "someValue" }); +i18next.exists(["friend", "tree"], { myVar: "someValue" }); +i18next.exists("friend", { myVar: "someValue" }); +i18next.exists(["friend", "tree"], { myVar: "someValue" }); diff --git a/types/i18next/v8/index.d.ts b/types/i18next/v8/index.d.ts new file mode 100644 index 0000000000..484745bcad --- /dev/null +++ b/types/i18next/v8/index.d.ts @@ -0,0 +1,619 @@ +// Type definitions for i18next 8.4 +// Project: http://i18next.com +// Definitions by: Michael Ledin +// Budi Irawan +// Giedrius Grabauskas +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare namespace i18next { + interface FallbackLngObjList { + [language: string]: string[]; + } + + type FallbackLng = string | string[] | FallbackLngObjList; + + type FormatFunction = (value: string, format?: string, lng?: string) => string; + + interface InterpolationOptions { + /** + * format function see formatting for details + * @default noop + */ + format?: FormatFunction; + /** + * used to separate format from interpolation value + * @default ',' + */ + formatSeparator?: string; + /** + * escape function + * @default str => str + */ + escape?(str: string): string; + + /** + * escape passed in values to avoid xss injection + * @default true + */ + escapeValue?: boolean; + /** + * prefix for interpolation + * @default '{{' + */ + prefix?: string; + /** + * suffix for interpolation + * @default '}}' + */ + suffix?: string; + /** + * escaped prefix for interpolation (regexSafe) + * @default undefined + */ + prefixEscaped?: string; + /** + * escaped suffix for interpolation (regexSafe) + * @default undefined + */ + suffixEscaped?: string; + /** + * suffix to unescaped mode + * @default undefined + */ + unescapeSuffix?: string; + /** + * prefix to unescaped mode + * @default '-' + */ + unescapePrefix?: string; + /** + * prefix for nesting + * @default '$t(' + */ + nestingPrefix?: string; + /** + * suffix for nesting + * @default ')' + */ + nestingSuffix?: string; + /** + * escaped prefix for nesting (regexSafe) + * @default undefined + */ + nestingPrefixEscaped?: string; + /** + * escaped suffix for nesting (regexSafe) + * @default undefined + */ + nestingSuffixEscaped?: string; + /** + * global variables to use in interpolation replacements + * @default undefined + */ + defaultVariables?: any; + } + + interface ReactOptions { + /** + * set to true if you like to wait for loaded in every translated hoc + * @default false + */ + wait?: boolean; + /** + * set it to fallback to let passed namespaces to translated hoc act as fallbacks + * @default 'default' + */ + nsMode?: 'default' | 'fallback'; + /** + * set it to the default parent element created by the Trans component. + * @default 'div' + */ + defaultTransParent?: string; + /** + * set which events trigger a rerender, can be set to false or string of events + * @default 'languageChanged loaded' + */ + bindI18n?: string | false; + /** + * set which events on store trigger a rerender, can be set to false or string of events + * @default 'added removed' + */ + bindStore?: string | false; + } + + interface InitOptions { + /** + * logs info level to console output. Helps finding issues with loading not working. + * @default false + */ + debug?: boolean; + + /** + * resources to initialize with (if not using loading or not appending using addResourceBundle) + * @default undefined + */ + resources?: Resource; + + /** + * language to use (overrides language detection) + * @default undefined + */ + lng?: string; + + /** + * language to use if translations in user language are not available. + * @default 'dev' + */ + fallbackLng?: false | FallbackLng; + + /** + * array of allowed languages + * @default false + */ + whitelist?: false | string[]; + + /** + * if true will pass eg. en-US if finding en in whitelist + * @default false + */ + nonExplicitWhitelist?: boolean; + + /** + * language codes to lookup, given set language is + * 'en-US': 'all' --> ['en-US', 'en', 'dev'], + * 'currentOnly' --> 'en-US', + * 'languageOnly' --> 'en' + * @default 'all' + */ + load?: "all" | "currentOnly" | "languageOnly"; + + /** + * array of languages to preload. Important on serverside to assert translations are loaded before rendering views. + * @default false + */ + preload?: false | string[]; + + /** + * language will be lowercased eg. en-US --> en-us + * @default false + */ + lowerCaseLng?: boolean; + + /** + * string or array of namespaces to load + * @default 'translation' + */ + ns?: string | string[]; + + /** + * default namespace used if not passed to translation function + * @default 'translation' + */ + defaultNS?: string; + + /** + * string or array of namespaces to lookup key if not found in given namespace. + * @default false + */ + fallbackNS?: false | string | string[]; + + /** + * calls save missing key function on backend if key not found + * @default false + */ + saveMissing?: boolean; + + /** + * @default 'fallback' + */ + saveMissingTo?: "current" | "all" | "fallback"; + + /** + * Used for custom missing key handling (needs saveMissing set to true!) + * @default false + */ + missingKeyHandler?: false | ((lng: string, ns: string, key: string, fallbackValue: string) => void); + + /** + * receives a key that was not found in `t()` and returns a value, that will be returned by `t()` + * @default noop + */ + parseMissingKeyHandler?(key: string): any; + + /** + * appends namespace to missing key + * @default false + */ + appendNamespaceToMissingKey?: boolean; + + /** + * will use 'plural' as suffix for languages only having 1 plural form, setting it to false will suffix all with numbers + * @default true + */ + simplifyPluralSuffix?: boolean; + + /** + * string or array of postProcessors to apply per default + * @default false + */ + postProcess?: false | string | string[]; + + /** + * allows null values as valid translation + * @default true + */ + returnNull?: boolean; + + /** + * allows empty string as valid translation + * @default true + */ + returnEmptyString?: boolean; + + /** + * allows objects as valid translation result + * @default false + */ + returnObjects?: boolean; + + /** + * Gets called if object was passed in as key but returnObjects was set to false + * @default noop + */ + returnedObjectHandler?(key: string, value: string, options: any): void; + + /** + * char, eg. '\n' that arrays will be joined by + * @default false + */ + joinArrays?: false | string; + + /** + * default: sets defaultValue + * @default args => ({ defaultValue: args[1] }) + */ + overloadTranslationOptionHandler?(args: string[]): TranslationOptions; + + /** + * @see https://www.i18next.com/interpolation.html + */ + interpolation?: InterpolationOptions; + + /** + * options for language detection - check documentation of plugin + * @default undefined + */ + detection?: object; + + /** + * options for backend - check documentation of plugin + * @default undefined + */ + backend?: object; + + /** + * options for cache layer - check documentation of plugin + * @default undefined + */ + cache?: object; + + /** + * options for react - check documentation of plugin + * @default undefined + */ + react?: ReactOptions; + + /** + * triggers resource loading in init function inside a setTimeout (default async behaviour). + * Set it to false if your backend loads resources sync - that way calling i18next.t after + * init is possible without relaying on the init callback. + * @default true + */ + initImmediate?: boolean; + + /** + * char to separate keys + * @default '.' + */ + keySeparator?: false | string; + + /** + * char to split namespace from key + * @default ':' + */ + nsSeparator?: false | string; + + /** + * char to split plural from key + * @default '_' + */ + pluralSeparator?: string; + + /** + * char to split context from key + * @default '_' + */ + contextSeparator?: string; + + /** + * prefixes the namespace to the returned key when using cimode + * @default false + */ + appendNamespaceToCIMode?: boolean; + + /** + * Compatibility JSON version + */ + compatibilityJSON?: string; + } + + // Add an indexer to assure that interpolation arguments can be passed + type TranslationOptions = TranslationOptionsBase & TCustomOptions & { [key: string]: any }; + + interface TranslationOptionsBase { + /** + * defaultValue to return if a translation was not found + */ + defaultValue?: any; + /** + * count value used for plurals + */ + count?: number; + /** + * used for contexts (eg. male\female) + */ + context?: any; + /** + * object with vars for interpolation - or put them directly in options + */ + replace?: any; + /** + * override language to use + */ + lng?: string; + /** + * override languages to use + */ + lngs?: string[]; + /** + * override language to lookup key if not found see fallbacks for details + */ + fallbackLng?: FallbackLng; + /** + * override namespaces (string or array) + */ + ns?: string | string[]; + /** + * override char to separate keys + */ + keySeparator?: string; + /** + * override char to split namespace from key + */ + nsSeparator?: string; + /** + * accessing an object not a translation string (can be set globally too) + */ + returnObjects?: boolean; + /** + * char, eg. '\n' that arrays will be joined by (can be set globally too) + */ + joinArrays?: string; + /** + * string or array of postProcessors to apply see interval plurals as a sample + */ + postProcess?: string | string[]; + /** + * override interpolation options + */ + interpolation?: InterpolationOptions; + } + + type Callback = (error: any, t: TranslationFunction) => void; + + type TranslationFunction = + (key: TKeys | TKeys[], options?: TranslationOptions) => TResult; + + interface Resource { + [language: string]: ResourceLanguage; + } + + interface ResourceLanguage { + [namespace: string]: ResourceKey; + } + + interface ResourceKey { + [key: string]: any; + } + + interface i18n { + /** + * The default export of the i18next module is an i18next instance ready to be initialized by calling init. + * You can create additional instances using the createInstance function. + * + * @param options - Initial options. + * @param callback - will be called after all translations were loaded or with an error when failed (in case of using a backend). + */ + init(options: InitOptions, callback?: Callback): i18n; + init(callback?: Callback): i18n; + + loadResources(callback?: (err: any) => void): void; + + /** + * The use function is there to load additional plugins to i18next. + * For available module see the plugins page and don't forget to read the documentation of the plugin. + */ + use(module: any): i18n; + + /** + * Please have a look at the translation functions like interpolation, formatting and plurals for more details on using it. + */ + t: TranslationFunction; + + /** + * Uses the same resolve functionality as the t function and returns true if a key exists. + */ + exists: TranslationFunction; + + /** + * Returns a t function that defaults to given language or namespace. + * Both params could be arrays of languages or namespaces and will be treated as fallbacks in that case. + * On the returned function you can like in the t function override the languages or namespaces by passing them in options or by prepending namespace. + */ + getFixedT(lng: string | string[], ns?: string | string[]): TranslationFunction; + getFixedT(lng: null, ns: string | string[]): TranslationFunction; + + /** + * Changes the language. The callback will be called as soon translations were loaded or an error occurs while loading. + * HINT: For easy testing - setting lng to 'cimode' will set t function to always return the key. + */ + changeLanguage(lng: string, callback?: Callback): void; + + /** + * Is set to the current detected or set language. + * If you need the primary used language depending on your configuration (whilelist, load) you will prefer using i18next.languages[0]. + */ + language: string; + + /** + * Is set to an array of language-codes that will be used it order to lookup the translation value. + */ + languages: string[]; + + /** + * Loads additional namespaces not defined in init options. + */ + loadNamespaces(ns: string | string[], callback: Callback): void; + + /** + * Loads additional languages not defined in init options (preload). + */ + loadLanguages(lngs: string | string[], callback: Callback): void; + + /** + * Reloads resources on given state. Optionally you can pass an array of languages and namespaces as params if you don't want to reload all. + */ + reloadResources(lngs?: string[], ns?: string[]): void; + reloadResources(lngs: null, ns: string[]): void; + + /** + * Changes the default namespace. + */ + setDefaultNamespace(ns: string): void; + + /** + * Returns rtl or ltr depending on languages read direction. + */ + dir(lng?: string): "ltr" | "rtl"; + + /** + * Exposes interpolation.format function added on init. + */ + format: FormatFunction; + + /** + * Will return a new i18next instance. + * Please read the options page for details on configuration options. + * Providing a callback will automatically call init. + * The callback will be called after all translations were loaded or with an error when failed (in case of using a backend). + */ + createInstance(options?: InitOptions, callback?: Callback): i18n; + + /** + * Creates a clone of the current instance. Shares store, plugins and initial configuration. + * Can be used to create an instance sharing storage but being independent on set language or namespaces. + */ + cloneInstance(options?: InitOptions, callback?: Callback): i18n; + + /** + * Gets fired after initialization. + */ + on(event: "initialized", callback: (options: InitOptions) => void): void; + + /** + * Gets fired on loaded resources. + */ + on(event: "loaded", callback: (loaded: boolean) => void): void; + + /** + * Gets fired if loading resources failed. + */ + on(event: "failedLoading", callback: (lng: string, ns: string, msg: string) => void): void; + + /** + * Gets fired on accessing a key not existing. + */ + on(event: "missingKey", callback: (lngs: string[], namespace: string, key: string, res: string) => void): void; + + /** + * Gets fired when resources got added or removed. + */ + on(event: "added" | "removed", callback: (lng: string, ns: string) => void): void; + + /** + * Gets fired when changeLanguage got called. + */ + on(event: "languageChanged", callback: (lng: string) => void): void; + + /** + * Event listener + */ + on(event: string, listener: (...args: any[]) => void): void; + + /** + * Remove event listener + */ + off(event: string, listener: (...args: any[]) => void): void; + + /** + * Gets one value by given key. + */ + getResource(lng: string, ns: string, key: string, options?: { keySeparator?: string }): any; + + /** + * Adds one key/value. + */ + addResource(lng: string, ns: string, key: string, value: string, options?: { keySeparator?: string, silent?: boolean }): void; + + /** + * Adds multiple key/values. + */ + addResources(lng: string, ns: string, resources: any): void; + + /** + * Adds a complete bundle. + * Setting deep param to true will extend existing translations in that file. + * Setting overwrite to true it will overwrite existing translations in that file. + */ + addResourceBundle(lng: string, ns: string, resources: any, deep?: boolean, overwrite?: boolean): void; + + /** + * Checks if a resource bundle exists. + */ + hasResourceBundle(lng: string, ns: string): boolean; + + /** + * Returns a resource bundle. + */ + getResourceBundle(lng: string, ns: string): any; + + /** + * Removes an existing bundle. + */ + removeResourceBundle(lng: string, ns: string): void; + + /** + * Current options + */ + options: InitOptions; + + /** + * Is initialized + */ + isInitialized: boolean; + } +} + +declare const i18next: i18next.i18n; +export = i18next; diff --git a/types/i18next/v8/tsconfig.json b/types/i18next/v8/tsconfig.json new file mode 100644 index 0000000000..cb9f9ab724 --- /dev/null +++ b/types/i18next/v8/tsconfig.json @@ -0,0 +1,29 @@ +{ + "files": [ + "index.d.ts", + "i18next-tests.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "i18next": [ + "i18next/v8" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/i18next/v8/tslint.json b/types/i18next/v8/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/i18next/v8/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e56c5f3d71dac750848f2ffffc73f7ae0469e9c0 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Thu, 20 Sep 2018 09:29:48 -0400 Subject: [PATCH 66/78] tslint not eslint --- types/react-reconciler/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-reconciler/index.d.ts b/types/react-reconciler/index.d.ts index df371c0d25..3aa6a6189e 100644 --- a/types/react-reconciler/index.d.ts +++ b/types/react-reconciler/index.d.ts @@ -7,7 +7,7 @@ import { Component, ReactNode } from 'react'; declare function ReactReconciler( - // eslint-disable-next-line no-unnecessary-generics + // tslint:disable-next-line:no-unnecessary-generics config: ReactReconciler.HostConfig, ): ReactReconciler.Reconciler; From 5e362d9cc9db9fdd66b9aa1a616581fe118e9898 Mon Sep 17 00:00:00 2001 From: Sascha Englert Date: Thu, 20 Sep 2018 17:12:26 +0200 Subject: [PATCH 67/78] Created obj-str definition --- types/obj-str/index.d.ts | 8 ++++++++ types/obj-str/obj-str-tests.ts | 6 ++++++ types/obj-str/tsconfig.json | 22 ++++++++++++++++++++++ types/obj-str/tslint.json | 1 + 4 files changed, 37 insertions(+) create mode 100644 types/obj-str/index.d.ts create mode 100644 types/obj-str/obj-str-tests.ts create mode 100644 types/obj-str/tsconfig.json create mode 100644 types/obj-str/tslint.json diff --git a/types/obj-str/index.d.ts b/types/obj-str/index.d.ts new file mode 100644 index 0000000000..44672fbd0a --- /dev/null +++ b/types/obj-str/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for obj-str 1.0 +// Project: https://github.com/lukeed/obj-str#readme +// Definitions by: Sascha Englert +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = objstr; + +declare function objstr(obj: { [name: string]: boolean }): string; diff --git a/types/obj-str/obj-str-tests.ts b/types/obj-str/obj-str-tests.ts new file mode 100644 index 0000000000..eea0300de7 --- /dev/null +++ b/types/obj-str/obj-str-tests.ts @@ -0,0 +1,6 @@ +import objstr = require('obj-str'); + +const isTrue = () => true; + +objstr({ foo: true, bar: false, baz: isTrue() }); +//=> 'foo baz' diff --git a/types/obj-str/tsconfig.json b/types/obj-str/tsconfig.json new file mode 100644 index 0000000000..ec7d04011d --- /dev/null +++ b/types/obj-str/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "obj-str-tests.ts" + ] +} diff --git a/types/obj-str/tslint.json b/types/obj-str/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/obj-str/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 40bb1edfacbae3fc4edc48e6321fb947a1e5c9ee Mon Sep 17 00:00:00 2001 From: Sascha Englert Date: Thu, 20 Sep 2018 17:25:57 +0200 Subject: [PATCH 68/78] Adjusted tsconfig and fixed critical whitespace missing in comment /s --- types/obj-str/obj-str-tests.ts | 2 +- types/obj-str/tsconfig.json | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/types/obj-str/obj-str-tests.ts b/types/obj-str/obj-str-tests.ts index eea0300de7..e945aef673 100644 --- a/types/obj-str/obj-str-tests.ts +++ b/types/obj-str/obj-str-tests.ts @@ -3,4 +3,4 @@ import objstr = require('obj-str'); const isTrue = () => true; objstr({ foo: true, bar: false, baz: isTrue() }); -//=> 'foo baz' +// => 'foo baz' diff --git a/types/obj-str/tsconfig.json b/types/obj-str/tsconfig.json index ec7d04011d..e2498d5707 100644 --- a/types/obj-str/tsconfig.json +++ b/types/obj-str/tsconfig.json @@ -1,22 +1,16 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], + "strictFunctionTypes": true, "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "obj-str-tests.ts" - ] + "files": ["index.d.ts", "obj-str-tests.ts"] } From a80a25b7fbf2e52c39a4f60bd59690f97b7ecbdd Mon Sep 17 00:00:00 2001 From: richardison Date: Thu, 20 Sep 2018 11:29:15 -0400 Subject: [PATCH 69/78] Add: click event type to range selector button --- types/highcharts/highstock.d.ts | 8 +++++++- types/highcharts/test/highstock.ts | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/types/highcharts/highstock.d.ts b/types/highcharts/highstock.d.ts index a97ae9effa..0c4fcce94e 100644 --- a/types/highcharts/highstock.d.ts +++ b/types/highcharts/highstock.d.ts @@ -2,7 +2,8 @@ // Project: http://www.highcharts.com/ // Definitions by: David Deutsch -// Definitions by: Dave Baumann +// Dave Baumann +// Richard Ison // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Highcharts from "highcharts"; @@ -31,11 +32,16 @@ declare namespace Highstock { yAxis?: Highcharts.AxisOptions; } + interface RangeSelectButtonEvent { + click?(event: Event): void; + } + interface RangeSelectorButton { type: string; // Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'. count?: number; text: string; dataGrouping?: any; // not sure how this works + events?: RangeSelectButtonEvent; } interface RangeSelectorOptions { diff --git a/types/highcharts/test/highstock.ts b/types/highcharts/test/highstock.ts index 2021e65b68..f1a464f491 100644 --- a/types/highcharts/test/highstock.ts +++ b/types/highcharts/test/highstock.ts @@ -25,6 +25,14 @@ $(() => { rangeSelector: { allButtonsEnabled: true, selected: 1, + buttons: [{ + type: 'month', + count: 1, + text: '1m', + events: { + click: () => { } + } + }], buttonTheme: { // styles for the buttons fill: 'none', stroke: 'none', From 5d9b665d4ca5358140b9d12980d65e1b64ba060d Mon Sep 17 00:00:00 2001 From: richardison Date: Thu, 20 Sep 2018 11:41:46 -0400 Subject: [PATCH 70/78] Update: interface name --- types/highcharts/highstock.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/highcharts/highstock.d.ts b/types/highcharts/highstock.d.ts index 0c4fcce94e..cc92bebe36 100644 --- a/types/highcharts/highstock.d.ts +++ b/types/highcharts/highstock.d.ts @@ -32,7 +32,7 @@ declare namespace Highstock { yAxis?: Highcharts.AxisOptions; } - interface RangeSelectButtonEvent { + interface RangeSelectorButtonEvent { click?(event: Event): void; } @@ -41,7 +41,7 @@ declare namespace Highstock { count?: number; text: string; dataGrouping?: any; // not sure how this works - events?: RangeSelectButtonEvent; + events?: RangeSelectorButtonEvent; } interface RangeSelectorOptions { From 958c9f2ae6aca3f74221a5ee134bf23bb1e646ca Mon Sep 17 00:00:00 2001 From: David Rodrigue Date: Thu, 20 Sep 2018 10:49:19 -0500 Subject: [PATCH 71/78] allow use of https request options --- types/got/got-tests.ts | 2 ++ types/got/index.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/got/got-tests.ts b/types/got/got-tests.ts index 1eb2d89aa8..610ac87c26 100644 --- a/types/got/got-tests.ts +++ b/types/got/got-tests.ts @@ -258,3 +258,5 @@ got('todomvc', { got(new url.URL('http://todomvc.com')); got(url.parse('http://todomvc.com')); + +got('https://todomvc.com', { rejectUnauthorized: false }); diff --git a/types/got/index.d.ts b/types/got/index.d.ts index 86a3d42131..775985e581 100644 --- a/types/got/index.d.ts +++ b/types/got/index.d.ts @@ -75,7 +75,7 @@ declare const got: got.GotFn & CancelError: typeof CancelError; }; -interface InternalRequestOptions extends http.RequestOptions { +interface InternalRequestOptions extends https.RequestOptions { // Redeclare options with `any` type for allow specify types incompatible with http.RequestOptions. timeout?: any; agent?: any; @@ -93,7 +93,7 @@ declare namespace got { type GotStreamFn = (url: GotUrl, options?: GotOptions) => GotEmitter & nodeStream.Duplex; - type GotUrl = string | http.RequestOptions | Url | URL; + type GotUrl = string | https.RequestOptions | Url | URL; interface GotBodyOptions extends GotOptions { body?: string | Buffer | nodeStream.Readable; From ca0f99ff64e65d390ecce1974e209ed22d0f0425 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 20 Sep 2018 18:01:26 +0200 Subject: [PATCH 72/78] Add trimmed flag to chai-dom --- types/chai-dom/chai-dom-tests.ts | 1 + types/chai-dom/index.d.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/types/chai-dom/chai-dom-tests.ts b/types/chai-dom/chai-dom-tests.ts index 2cc7b0f232..ef8a9bb385 100644 --- a/types/chai-dom/chai-dom-tests.ts +++ b/types/chai-dom/chai-dom-tests.ts @@ -13,6 +13,7 @@ function test() { expect(testElement).to.have.id('id'); expect(testElement).to.have.html('foo'); expect(testElement).to.have.text('foo'); + expect(testElement).to.have.trimmed.text('foo'); expect(testElement).to.have.text(['foo', 'bar']); expect(testElement).to.have.value('foo'); expect(testElement).to.be.empty; diff --git a/types/chai-dom/index.d.ts b/types/chai-dom/index.d.ts index 8650ebca1d..c6ecc75326 100644 --- a/types/chai-dom/index.d.ts +++ b/types/chai-dom/index.d.ts @@ -35,6 +35,8 @@ declare namespace Chai { displayed: Assertion; + trimmed: Assertion; + } interface Include { From 98ec210f8da5400bc507bddfc0aa9eb5dc4b4b86 Mon Sep 17 00:00:00 2001 From: Andrei Sedoi Date: Thu, 20 Sep 2018 20:52:48 +0300 Subject: [PATCH 73/78] Specify limit to be a string or a number --- types/micro/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/micro/index.d.ts b/types/micro/index.d.ts index 7914d107bd..f3787b1010 100644 --- a/types/micro/index.d.ts +++ b/types/micro/index.d.ts @@ -19,8 +19,8 @@ export function sendError(req: IncomingMessage, res: ServerResponse, info: { sta export function createError(code: number, msg: string, orig?: Error): Error & { statusCode: number, originalError?: Error }; -export function buffer(req: IncomingMessage, info?: { limit?: string, encoding?: string }): Promise; +export function buffer(req: IncomingMessage, info?: { limit?: string | number, encoding?: string }): Promise; -export function text(req: IncomingMessage, info?: { limit?: string, encoding?: string }): Promise; +export function text(req: IncomingMessage, info?: { limit?: string | number, encoding?: string }): Promise; -export function json(req: IncomingMessage, info?: { limit?: string, encoding?: string }): Promise; +export function json(req: IncomingMessage, info?: { limit?: string | number, encoding?: string }): Promise; From 5a28e59385249ea63761a1c90b49509da66bdd15 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Thu, 20 Sep 2018 14:28:10 -0400 Subject: [PATCH 74/78] Fix import --- types/react-reconciler/test/react-reconciler-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-reconciler/test/react-reconciler-tests.ts b/types/react-reconciler/test/react-reconciler-tests.ts index 5896ff1ea3..d29c7e2fad 100644 --- a/types/react-reconciler/test/react-reconciler-tests.ts +++ b/types/react-reconciler/test/react-reconciler-tests.ts @@ -1,4 +1,4 @@ -import * as ReactFiberReconciler from 'react-reconciler'; +import ReactFiberReconciler = require("react-reconciler"); import * as ReactTestHostConfig from './ReactTestHostConfig'; // $ExpectType Reconciler From 08d723da665a627a31cbe6a38235a3f34e535896 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Thu, 20 Sep 2018 11:49:42 -0700 Subject: [PATCH 75/78] adding comments & end/begin --- types/custom-functions-runtime/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index 3b44fb9d21..94c58c6b7b 100644 --- a/types/custom-functions-runtime/index.d.ts +++ b/types/custom-functions-runtime/index.d.ts @@ -9,6 +9,11 @@ office-js Copyright (c) Microsoft Corporation */ + +//////////////////////////////////////////////////////////////// +//////////////////// Begin custom-functions-runtime //////////// +//////////////////////////////////////////////////////////////// + /* * Enables you to map your own name that uses lowercase letters to a function. */ @@ -31,3 +36,8 @@ declare namespace CustomFunctions { onCanceled: () => void; } } + + +//////////////////////////////////////////////////////////////// +//////////////////// BEnd custom-functions-runtime //////////// +//////////////////////////////////////////////////////////////// \ No newline at end of file From 5542f92ec15f5642166896e17260194e849c454f Mon Sep 17 00:00:00 2001 From: mscharlock Date: Thu, 20 Sep 2018 11:55:15 -0700 Subject: [PATCH 76/78] remove office things --- types/office-runtime/index.d.ts | 117 ------------------- types/office-runtime/office-runtime-tests.ts | 61 ---------- types/office-runtime/tslint.json | 3 - 3 files changed, 181 deletions(-) delete mode 100644 types/office-runtime/index.d.ts delete mode 100644 types/office-runtime/office-runtime-tests.ts delete mode 100644 types/office-runtime/tslint.json diff --git a/types/office-runtime/index.d.ts b/types/office-runtime/index.d.ts deleted file mode 100644 index 3f57014bc9..0000000000 --- a/types/office-runtime/index.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -// Type definitions for office-runtime 1.0 -// Project: http://dev.office.com/ -// Definitions by: Michael Zlatskovsky , Michelle Scharlock -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Typescript Version: 2.4 - -/* -office-runtime -Copyright (c) Microsoft Corporation -*/ - -declare namespace OfficeRuntime { - function displayWebDialog(url: string, options: DisplayWebDialogOptions): Promise; - const AsyncStorage: AsyncStorage; - - // tslint:disable-next-line:interface-name - /* - * Asynchronous, global, and persistent key-value storage that can be used by Excel Custom Functions. - * @beta - * - * @remarks - * Each add-in instance has its own storage partition, unique to a user and their device. - * - * The default amount of total storage allowed per add-in is 5MB. - * - * Each method listed below returns a Promise object. - * - */ - interface AsyncStorage { - /* - * @beta - * Retrieves an object based on a key and invokes a callback when finished. Returns a Promise. - */ - getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise; - /* - * @beta - * Assigns the value for a key-value pair and invokes a callback when finished. Returns a Promise. - */ - setItem(key: string, value: string, callback?: (error?: Error) => void): Promise; - /* - * @beta - * Removes an item for specified key and invokes a callback when finished. Returns a Promise. - */ - removeItem(key: string, callback?: (error?: Error) => void): Promise; - /* - * @beta - * Erases all AsyncStorage. Returns a Promise. - */ - clear(callback?: (error?: Error) => void): Promise; - /* - * @beta - * Returns a Promise with all keys. - */ - getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise; - /* - * @beta - * Stores multiple key-value pairs in one batch. Returns a Promise. When a key doesn't exist, returns null. - */ - multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise; - /* - * @beta - * Deletes a batch of keys, specified in the `keys` array. - */ - multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise; - /* - * @beta - * Fetches a batch of keys, specified in the `keys` array. When a key doesn't exist, returns null. - */ - multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise; - } - /* - * @beta - * Object representing the dialog box. - */ - interface Dialog { - /* - * @beta - * Method that closes a dialog box. - */ - close(): Promise; - } - /* - * Provides options for how a dialog is displayed. - */ - interface DisplayWebDialogOptions { - /* - * @beta - * Determines whether the dialog box displays as a popup (false) or within an IFrame (true). This setting is only applicable to custom functions running on Excel Online. - */ - displayInIFrame?: boolean; - /* - * @beta - * Defines the height of the dialog box as a percentage of the current display. - */ - height?: string; - /* - * @beta - * Defines the width of the dialog box as a percentage of the current display. - */ - width?: string; - /* - * @beta - * True if title is hidden from the dialog box. - */ - hideTitle?: boolean; - /* - * @beta - * Callback that is run when the dialog box is closed. - */ - onClose?: () => void; - /* - * @beta - * Callback that is run when the dialog box sends an error. - */ - onMessage?(message: string, dialog?: Dialog): void; - } - } diff --git a/types/office-runtime/office-runtime-tests.ts b/types/office-runtime/office-runtime-tests.ts deleted file mode 100644 index 889665b3df..0000000000 --- a/types/office-runtime/office-runtime-tests.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* -office-runtime -Copyright (c) Microsoft Corporation -*/ - -OfficeRuntime.AsyncStorage.getItem("foo", () => { - // perform an action -}); -OfficeRuntime.AsyncStorage.getItem("foo").then(value => console.log(value)); - -OfficeRuntime.AsyncStorage.setItem("foo", "bar"); -OfficeRuntime.AsyncStorage.setItem("foo", "bar").then(error => console.log(error)); - -OfficeRuntime.AsyncStorage.removeItem("foo"); -OfficeRuntime.AsyncStorage.removeItem("foo", () => { - // perform an action -}); - -OfficeRuntime.AsyncStorage.clear(); -OfficeRuntime.AsyncStorage.clear(() => { - // perform an action -}); - -OfficeRuntime.AsyncStorage.getAllKeys().then(keys => { - keys.forEach(item => console.log(item)); -}); - -OfficeRuntime.AsyncStorage.getAllKeys((error, keys) => { - if (error) { - console.error(error); - } else { - keys.forEach(item => console.log(item)); - } -}); - -OfficeRuntime.AsyncStorage.multiSet( - [["username", "foo"], ["yearOfBirth", "2001"]], - errors => { - errors.filter(error => error != null).forEach(error => console.log(error)); - } -); - -OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]); -OfficeRuntime.AsyncStorage.multiRemove(["foo", "bar"]).then(value => console.log(value)); - -OfficeRuntime.AsyncStorage.multiGet(["username", "yearOfBirth"]).then( - values => { - console.log(values[0][1]); - console.log(values[1][1]); - } -); - -OfficeRuntime.displayWebDialog("https://localhost:3000", { - displayInIFrame: false -}); - -OfficeRuntime.displayWebDialog("https://localhost:3000", { - onClose: () => { - console.log("closed"); - } -}); diff --git a/types/office-runtime/tslint.json b/types/office-runtime/tslint.json deleted file mode 100644 index f93cf8562a..0000000000 --- a/types/office-runtime/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} From ec31abdd97454f547cb443a5d22c7968252ff9d5 Mon Sep 17 00:00:00 2001 From: mscharlock Date: Thu, 20 Sep 2018 12:11:18 -0700 Subject: [PATCH 77/78] fix line spacing --- types/custom-functions-runtime/index.d.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/types/custom-functions-runtime/index.d.ts b/types/custom-functions-runtime/index.d.ts index b031862efb..b20d38828e 100644 --- a/types/custom-functions-runtime/index.d.ts +++ b/types/custom-functions-runtime/index.d.ts @@ -9,13 +9,12 @@ office-js Copyright (c) Microsoft Corporation */ - //////////////////////////////////////////////////////////////// //////////////////// Begin custom-functions-runtime //////////// //////////////////////////////////////////////////////////////// -/* -* Enables you to map your own name that uses lowercase letters to a function. +/* +* Enables you to map your own name that uses lowercase letters to a function. */ declare let CustomFunctionMappings: { [key: string]: Function }; @@ -37,7 +36,6 @@ declare namespace CustomFunctions { } } - //////////////////////////////////////////////////////////////// //////////////////// End custom-functions-runtime //////////// -//////////////////////////////////////////////////////////////// \ No newline at end of file +//////////////////////////////////////////////////////////////// From e5d1a67ec6e0ab7a9fd7c383ae4209eef9060057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Thu, 20 Sep 2018 09:34:32 +0200 Subject: [PATCH 78/78] browserify: work around TypeScript issue 14107 Changes the overloaded function to a single function that accepts a union. This works around Microsoft/TypeScript#14107. --- types/browserify/browserify-tests.ts | 3 +++ types/browserify/index.d.ts | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/types/browserify/browserify-tests.ts b/types/browserify/browserify-tests.ts index 2a1da315ed..c256d81ca3 100644 --- a/types/browserify/browserify-tests.ts +++ b/types/browserify/browserify-tests.ts @@ -60,3 +60,6 @@ Object.keys(insertGlobals.vars).forEach((x) => { var b = browserify('./browser/main.js', { insertGlobalVars: insertGlobalVars }); + +declare const file: string | string[]; +b.add(file); diff --git a/types/browserify/index.d.ts b/types/browserify/index.d.ts index e419fa2ceb..f9fb6aa3d8 100644 --- a/types/browserify/index.d.ts +++ b/types/browserify/index.d.ts @@ -1,6 +1,9 @@ // Type definitions for Browserify 12.0 // Project: http://browserify.org/ -// Definitions by: Andrew Gaspar , John Vilk , Leonard Thieu +// Definitions by: Andrew Gaspar +// John Vilk +// Leonard Thieu +// Linus Unnebäck // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -102,8 +105,7 @@ interface BrowserifyObject extends NodeJS.EventEmitter { * Add an entry file from file that will be executed when the bundle loads. * If file is an array, each item in file will be added as an entry file. */ - add(file: InputFile[], opts?: FileOptions): BrowserifyObject; - add(file: InputFile, opts?: FileOptions): BrowserifyObject; + add(file: InputFile | InputFile[], opts?: FileOptions): BrowserifyObject; /** * Make file available from outside the bundle with require(file). * The file param is anything that can be resolved by require.resolve().