@sigmacomputing/react-embed-sdk 0.2.8 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +53 -2
- package/dist/index.mjs +54 -2
- package/package.json +5 -3
package/dist/index.d.mts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { WorkbookErrorEvent, WorkbookLoadedEvent, WorkbookDataLoadedEvent, WorkbookVariableOnChangeEvent, WorkbookTableCellSelectEvent, WorkbookPublishedEvent, WorkbookFullScreenEvent, WorkbookPageHeightEvent, WorkbookPageSelectedNodeEvent, WorkbookPivotTableCellSelectEvent, WorkbookChartValueSelectEvent, WorkbookCurrentVariablesEvent, WorkbookBookmarkOnCreateEvent, WorkbookChartErrorEvent, WorkbookExploreKeyOnChangeEvent, WorkbookBookmarkOnChangeEvent, UrlOnChangeEvent, WorkbookIdOnChangeEvent } from '@sigmacomputing/embed-sdk';
|
1
|
+
import { WorkbookErrorEvent, WorkbookLoadedEvent, WorkbookDataLoadedEvent, WorkbookVariableOnChangeEvent, WorkbookTableCellSelectEvent, WorkbookPublishedEvent, WorkbookFullScreenEvent, WorkbookPageHeightEvent, WorkbookPageSelectedNodeEvent, WorkbookPivotTableCellSelectEvent, WorkbookChartValueSelectEvent, WorkbookCurrentVariablesEvent, WorkbookBookmarkOnCreateEvent, WorkbookChartErrorEvent, WorkbookExploreKeyOnChangeEvent, WorkbookBookmarkOnChangeEvent, UrlOnChangeEvent, WorkbookIdOnChangeEvent, WorkbookBookmarkCreateEvent } from '@sigmacomputing/embed-sdk';
|
2
2
|
export * from '@sigmacomputing/embed-sdk';
|
3
3
|
import * as react from 'react';
|
4
4
|
|
@@ -158,4 +158,11 @@ declare function useWorkbookBookmarkOnChange(iframeRef: React.RefObject<HTMLIFra
|
|
158
158
|
declare function useUrlOnChange(iframeRef: React.RefObject<HTMLIFrameElement>, onUrlChange: (event: UrlOnChangeEvent) => void): void;
|
159
159
|
declare function useWorkbookIdOnChange(iframeRef: React.RefObject<HTMLIFrameElement>, onIdChange: (event: WorkbookIdOnChangeEvent) => void): void;
|
160
160
|
|
161
|
-
|
161
|
+
declare function getWorkbookVariables(iframeRef: React.RefObject<HTMLIFrameElement>): void;
|
162
|
+
declare function updateWorkbookVariables(iframeRef: React.RefObject<HTMLIFrameElement>, variables: Record<string, string>): void;
|
163
|
+
declare function createWorkbookBookmark(iframeRef: React.RefObject<HTMLIFrameElement>, bookmark: WorkbookBookmarkCreateEvent): void;
|
164
|
+
declare function updateWorkbookBookmark(iframeRef: React.RefObject<HTMLIFrameElement>): void;
|
165
|
+
declare function updateWorkbookFullscreen(iframeRef: React.RefObject<HTMLIFrameElement>, nodeId: string | null): void;
|
166
|
+
declare function updateWorkbookSelectedNodeId(iframeRef: React.RefObject<HTMLIFrameElement>, nodeId: string, nodeType: "element" | "page"): void;
|
167
|
+
|
168
|
+
export { createWorkbookBookmark, getWorkbookVariables, updateWorkbookBookmark, updateWorkbookFullscreen, updateWorkbookSelectedNodeId, updateWorkbookVariables, usePageHeight, useSigmaIframe, useTableCellSelect, useUrlOnChange, useVariableChange, useWorkbookBookmarkOnChange, useWorkbookBookmarkOnCreate, useWorkbookChartError, useWorkbookChartValueSelect, useWorkbookCurrentVariables, useWorkbookDataLoaded, useWorkbookError, useWorkbookExploreKeyOnChange, useWorkbookFullScreen, useWorkbookIdOnChange, useWorkbookLoaded, useWorkbookPageHeight, useWorkbookPageSelectedNode, useWorkbookPivotTableCellSelect, useWorkbookPublished, useWorkbookVariables };
|
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { WorkbookErrorEvent, WorkbookLoadedEvent, WorkbookDataLoadedEvent, WorkbookVariableOnChangeEvent, WorkbookTableCellSelectEvent, WorkbookPublishedEvent, WorkbookFullScreenEvent, WorkbookPageHeightEvent, WorkbookPageSelectedNodeEvent, WorkbookPivotTableCellSelectEvent, WorkbookChartValueSelectEvent, WorkbookCurrentVariablesEvent, WorkbookBookmarkOnCreateEvent, WorkbookChartErrorEvent, WorkbookExploreKeyOnChangeEvent, WorkbookBookmarkOnChangeEvent, UrlOnChangeEvent, WorkbookIdOnChangeEvent } from '@sigmacomputing/embed-sdk';
|
1
|
+
import { WorkbookErrorEvent, WorkbookLoadedEvent, WorkbookDataLoadedEvent, WorkbookVariableOnChangeEvent, WorkbookTableCellSelectEvent, WorkbookPublishedEvent, WorkbookFullScreenEvent, WorkbookPageHeightEvent, WorkbookPageSelectedNodeEvent, WorkbookPivotTableCellSelectEvent, WorkbookChartValueSelectEvent, WorkbookCurrentVariablesEvent, WorkbookBookmarkOnCreateEvent, WorkbookChartErrorEvent, WorkbookExploreKeyOnChangeEvent, WorkbookBookmarkOnChangeEvent, UrlOnChangeEvent, WorkbookIdOnChangeEvent, WorkbookBookmarkCreateEvent } from '@sigmacomputing/embed-sdk';
|
2
2
|
export * from '@sigmacomputing/embed-sdk';
|
3
3
|
import * as react from 'react';
|
4
4
|
|
@@ -158,4 +158,11 @@ declare function useWorkbookBookmarkOnChange(iframeRef: React.RefObject<HTMLIFra
|
|
158
158
|
declare function useUrlOnChange(iframeRef: React.RefObject<HTMLIFrameElement>, onUrlChange: (event: UrlOnChangeEvent) => void): void;
|
159
159
|
declare function useWorkbookIdOnChange(iframeRef: React.RefObject<HTMLIFrameElement>, onIdChange: (event: WorkbookIdOnChangeEvent) => void): void;
|
160
160
|
|
161
|
-
|
161
|
+
declare function getWorkbookVariables(iframeRef: React.RefObject<HTMLIFrameElement>): void;
|
162
|
+
declare function updateWorkbookVariables(iframeRef: React.RefObject<HTMLIFrameElement>, variables: Record<string, string>): void;
|
163
|
+
declare function createWorkbookBookmark(iframeRef: React.RefObject<HTMLIFrameElement>, bookmark: WorkbookBookmarkCreateEvent): void;
|
164
|
+
declare function updateWorkbookBookmark(iframeRef: React.RefObject<HTMLIFrameElement>): void;
|
165
|
+
declare function updateWorkbookFullscreen(iframeRef: React.RefObject<HTMLIFrameElement>, nodeId: string | null): void;
|
166
|
+
declare function updateWorkbookSelectedNodeId(iframeRef: React.RefObject<HTMLIFrameElement>, nodeId: string, nodeType: "element" | "page"): void;
|
167
|
+
|
168
|
+
export { createWorkbookBookmark, getWorkbookVariables, updateWorkbookBookmark, updateWorkbookFullscreen, updateWorkbookSelectedNodeId, updateWorkbookVariables, usePageHeight, useSigmaIframe, useTableCellSelect, useUrlOnChange, useVariableChange, useWorkbookBookmarkOnChange, useWorkbookBookmarkOnCreate, useWorkbookChartError, useWorkbookChartValueSelect, useWorkbookCurrentVariables, useWorkbookDataLoaded, useWorkbookError, useWorkbookExploreKeyOnChange, useWorkbookFullScreen, useWorkbookIdOnChange, useWorkbookLoaded, useWorkbookPageHeight, useWorkbookPageSelectedNode, useWorkbookPivotTableCellSelect, useWorkbookPublished, useWorkbookVariables };
|
package/dist/index.js
CHANGED
@@ -20,6 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
20
20
|
// src/index.ts
|
21
21
|
var src_exports = {};
|
22
22
|
__export(src_exports, {
|
23
|
+
createWorkbookBookmark: () => createWorkbookBookmark,
|
24
|
+
getWorkbookVariables: () => getWorkbookVariables,
|
25
|
+
updateWorkbookBookmark: () => updateWorkbookBookmark,
|
26
|
+
updateWorkbookFullscreen: () => updateWorkbookFullscreen,
|
27
|
+
updateWorkbookSelectedNodeId: () => updateWorkbookSelectedNodeId,
|
28
|
+
updateWorkbookVariables: () => updateWorkbookVariables,
|
23
29
|
usePageHeight: () => usePageHeight,
|
24
30
|
useSigmaIframe: () => useSigmaIframe,
|
25
31
|
useTableCellSelect: () => useTableCellSelect,
|
@@ -334,7 +340,7 @@ function usePageHeight(iframeRef) {
|
|
334
340
|
return height;
|
335
341
|
}
|
336
342
|
|
337
|
-
// src/
|
343
|
+
// src/use-workbook-variables.ts
|
338
344
|
var import_react4 = require("react");
|
339
345
|
var import_embed_sdk2 = require("@sigmacomputing/embed-sdk");
|
340
346
|
var useWorkbookVariables = (iframeRef) => {
|
@@ -366,7 +372,7 @@ var useWorkbookVariables = (iframeRef) => {
|
|
366
372
|
return;
|
367
373
|
}
|
368
374
|
(0, import_embed_sdk2.workbookCurrentVariablesListener)(event, iframeRef.current, (event2) => {
|
369
|
-
if (
|
375
|
+
if (state?.state === "pending") {
|
370
376
|
setState({ state: "success", variables: event2.variables });
|
371
377
|
state.callback(event2.variables);
|
372
378
|
}
|
@@ -382,8 +388,53 @@ var useWorkbookVariables = (iframeRef) => {
|
|
382
388
|
setVariables
|
383
389
|
};
|
384
390
|
};
|
391
|
+
|
392
|
+
// src/mutations.ts
|
393
|
+
var import_embed_sdk3 = require("@sigmacomputing/embed-sdk");
|
394
|
+
function getWorkbookVariables(iframeRef) {
|
395
|
+
if (!iframeRef.current) {
|
396
|
+
throw new Error("iframe is not available");
|
397
|
+
}
|
398
|
+
(0, import_embed_sdk3.workbookVariablesList)(iframeRef.current);
|
399
|
+
}
|
400
|
+
function updateWorkbookVariables(iframeRef, variables) {
|
401
|
+
if (!iframeRef.current) {
|
402
|
+
throw new Error("iframe is not available");
|
403
|
+
}
|
404
|
+
(0, import_embed_sdk3.workbookVariablesUpdate)(iframeRef.current, variables);
|
405
|
+
}
|
406
|
+
function createWorkbookBookmark(iframeRef, bookmark) {
|
407
|
+
if (!iframeRef.current) {
|
408
|
+
throw new Error("iframe is not available");
|
409
|
+
}
|
410
|
+
(0, import_embed_sdk3.workbookBookmarkCreate)(iframeRef.current, bookmark);
|
411
|
+
}
|
412
|
+
function updateWorkbookBookmark(iframeRef) {
|
413
|
+
if (!iframeRef.current) {
|
414
|
+
throw new Error("iframe is not available");
|
415
|
+
}
|
416
|
+
(0, import_embed_sdk3.workbookBookmarkUpdate)(iframeRef.current);
|
417
|
+
}
|
418
|
+
function updateWorkbookFullscreen(iframeRef, nodeId) {
|
419
|
+
if (!iframeRef.current) {
|
420
|
+
throw new Error("iframe is not available");
|
421
|
+
}
|
422
|
+
(0, import_embed_sdk3.workbookFullscreenUpdate)(iframeRef.current, nodeId);
|
423
|
+
}
|
424
|
+
function updateWorkbookSelectedNodeId(iframeRef, nodeId, nodeType) {
|
425
|
+
if (!iframeRef.current) {
|
426
|
+
throw new Error("iframe is not available");
|
427
|
+
}
|
428
|
+
(0, import_embed_sdk3.workbookSelectedNodeIdUpdate)(iframeRef.current, nodeId, nodeType);
|
429
|
+
}
|
385
430
|
// Annotate the CommonJS export names for ESM import in node:
|
386
431
|
0 && (module.exports = {
|
432
|
+
createWorkbookBookmark,
|
433
|
+
getWorkbookVariables,
|
434
|
+
updateWorkbookBookmark,
|
435
|
+
updateWorkbookFullscreen,
|
436
|
+
updateWorkbookSelectedNodeId,
|
437
|
+
updateWorkbookVariables,
|
387
438
|
usePageHeight,
|
388
439
|
useSigmaIframe,
|
389
440
|
useTableCellSelect,
|
package/dist/index.mjs
CHANGED
@@ -307,7 +307,7 @@ function usePageHeight(iframeRef) {
|
|
307
307
|
return height;
|
308
308
|
}
|
309
309
|
|
310
|
-
// src/
|
310
|
+
// src/use-workbook-variables.ts
|
311
311
|
import { useCallback as useCallback2, useEffect as useEffect2, useState as useState3 } from "react";
|
312
312
|
import {
|
313
313
|
workbookVariablesList,
|
@@ -343,7 +343,7 @@ var useWorkbookVariables = (iframeRef) => {
|
|
343
343
|
return;
|
344
344
|
}
|
345
345
|
workbookCurrentVariablesListener2(event, iframeRef.current, (event2) => {
|
346
|
-
if (
|
346
|
+
if (state?.state === "pending") {
|
347
347
|
setState({ state: "success", variables: event2.variables });
|
348
348
|
state.callback(event2.variables);
|
349
349
|
}
|
@@ -359,7 +359,59 @@ var useWorkbookVariables = (iframeRef) => {
|
|
359
359
|
setVariables
|
360
360
|
};
|
361
361
|
};
|
362
|
+
|
363
|
+
// src/mutations.ts
|
364
|
+
import {
|
365
|
+
workbookVariablesList as workbookVariablesList2,
|
366
|
+
workbookVariablesUpdate as workbookVariablesUpdate2,
|
367
|
+
workbookBookmarkCreate,
|
368
|
+
workbookBookmarkUpdate,
|
369
|
+
workbookFullscreenUpdate,
|
370
|
+
workbookSelectedNodeIdUpdate
|
371
|
+
} from "@sigmacomputing/embed-sdk";
|
372
|
+
function getWorkbookVariables(iframeRef) {
|
373
|
+
if (!iframeRef.current) {
|
374
|
+
throw new Error("iframe is not available");
|
375
|
+
}
|
376
|
+
workbookVariablesList2(iframeRef.current);
|
377
|
+
}
|
378
|
+
function updateWorkbookVariables(iframeRef, variables) {
|
379
|
+
if (!iframeRef.current) {
|
380
|
+
throw new Error("iframe is not available");
|
381
|
+
}
|
382
|
+
workbookVariablesUpdate2(iframeRef.current, variables);
|
383
|
+
}
|
384
|
+
function createWorkbookBookmark(iframeRef, bookmark) {
|
385
|
+
if (!iframeRef.current) {
|
386
|
+
throw new Error("iframe is not available");
|
387
|
+
}
|
388
|
+
workbookBookmarkCreate(iframeRef.current, bookmark);
|
389
|
+
}
|
390
|
+
function updateWorkbookBookmark(iframeRef) {
|
391
|
+
if (!iframeRef.current) {
|
392
|
+
throw new Error("iframe is not available");
|
393
|
+
}
|
394
|
+
workbookBookmarkUpdate(iframeRef.current);
|
395
|
+
}
|
396
|
+
function updateWorkbookFullscreen(iframeRef, nodeId) {
|
397
|
+
if (!iframeRef.current) {
|
398
|
+
throw new Error("iframe is not available");
|
399
|
+
}
|
400
|
+
workbookFullscreenUpdate(iframeRef.current, nodeId);
|
401
|
+
}
|
402
|
+
function updateWorkbookSelectedNodeId(iframeRef, nodeId, nodeType) {
|
403
|
+
if (!iframeRef.current) {
|
404
|
+
throw new Error("iframe is not available");
|
405
|
+
}
|
406
|
+
workbookSelectedNodeIdUpdate(iframeRef.current, nodeId, nodeType);
|
407
|
+
}
|
362
408
|
export {
|
409
|
+
createWorkbookBookmark,
|
410
|
+
getWorkbookVariables,
|
411
|
+
updateWorkbookBookmark,
|
412
|
+
updateWorkbookFullscreen,
|
413
|
+
updateWorkbookSelectedNodeId,
|
414
|
+
updateWorkbookVariables,
|
363
415
|
usePageHeight,
|
364
416
|
useSigmaIframe,
|
365
417
|
useTableCellSelect,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sigmacomputing/react-embed-sdk",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.10",
|
4
4
|
"description": "React JavaScript SDK to interact with Sigma Computing's Embed API",
|
5
5
|
"author": "sigmacomputing",
|
6
6
|
"license": "ISC",
|
@@ -20,15 +20,17 @@
|
|
20
20
|
"@types/react": "^18.2.66",
|
21
21
|
"react": "^18.2.0",
|
22
22
|
"react-dom": "^18.2.0",
|
23
|
-
"@sigmacomputing/typescript-config": "0.0.0"
|
23
|
+
"@sigmacomputing/typescript-config": "0.0.0",
|
24
|
+
"@sigmacomputing/eslint-config": "0.0.0"
|
24
25
|
},
|
25
26
|
"dependencies": {
|
26
|
-
"@sigmacomputing/embed-sdk": "0.2.
|
27
|
+
"@sigmacomputing/embed-sdk": "0.2.10"
|
27
28
|
},
|
28
29
|
"scripts": {
|
29
30
|
"prepublish": "pnpm build",
|
30
31
|
"build": "tsup",
|
31
32
|
"dev": "tsup --watch",
|
33
|
+
"lint": "eslint . --ext .ts,.tsx",
|
32
34
|
"test": "echo \"Error: no test specified\" && exit 1"
|
33
35
|
}
|
34
36
|
}
|