@dxos/plugin-sheet 0.7.2 → 0.7.3-staging.971cd8d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{SheetContainer-YAMIOFC6.mjs → SheetContainer-KCLT6PEO.mjs} +8 -6
- package/dist/lib/browser/SheetContainer-KCLT6PEO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QHQFM7LV.mjs → chunk-E5WQ7U7G.mjs} +77 -78
- package/dist/lib/browser/chunk-E5WQ7U7G.mjs.map +7 -0
- package/dist/lib/browser/{chunk-VMSX6Z4X.mjs → chunk-F3HE6D3J.mjs} +76 -26
- package/dist/lib/browser/chunk-F3HE6D3J.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BVUN7SHF.mjs → chunk-JXFPOYNA.mjs} +1 -1
- package/dist/lib/browser/chunk-JXFPOYNA.mjs.map +7 -0
- package/dist/lib/browser/{compute-graph-GGWUX644.mjs → compute-graph-SNUS7HOH.mjs} +3 -3
- package/dist/lib/browser/index.mjs +84 -32
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/node/{SheetContainer-BSDHHYXE.cjs → SheetContainer-VVVRYTQG.cjs} +32 -31
- package/dist/lib/node/SheetContainer-VVVRYTQG.cjs.map +7 -0
- package/dist/lib/node/{chunk-J5ZFWMOD.cjs → chunk-45YW2DX2.cjs} +96 -101
- package/dist/lib/node/chunk-45YW2DX2.cjs.map +7 -0
- package/dist/lib/node/{chunk-O7XR4R7Y.cjs → chunk-KSEEI5VC.cjs} +87 -27
- package/dist/lib/node/chunk-KSEEI5VC.cjs.map +7 -0
- package/dist/lib/node/{chunk-AWKOWDMI.cjs → chunk-OWH2EUHZ.cjs} +4 -4
- package/dist/lib/node/chunk-OWH2EUHZ.cjs.map +7 -0
- package/dist/lib/node/{compute-graph-KGWA2QLE.cjs → compute-graph-WILPHO4A.cjs} +20 -20
- package/dist/lib/node/{compute-graph-KGWA2QLE.cjs.map → compute-graph-WILPHO4A.cjs.map} +2 -2
- package/dist/lib/node/index.cjs +101 -47
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +6 -6
- package/dist/lib/node/types.cjs.map +1 -1
- package/dist/lib/node-esm/{SheetContainer-T47T2NYJ.mjs → SheetContainer-LSBE6Q4X.mjs} +8 -6
- package/dist/lib/node-esm/SheetContainer-LSBE6Q4X.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-CR4K75EL.mjs → chunk-6JF2AHKO.mjs} +76 -26
- package/dist/lib/node-esm/chunk-6JF2AHKO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UIBWRHW7.mjs → chunk-BVS2IQRO.mjs} +1 -1
- package/dist/lib/node-esm/chunk-BVS2IQRO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-6GSTEN7N.mjs → chunk-NYDNXI7L.mjs} +77 -78
- package/dist/lib/node-esm/chunk-NYDNXI7L.mjs.map +7 -0
- package/dist/lib/node-esm/{compute-graph-2SCZT7N5.mjs → compute-graph-S6CVN7RS.mjs} +3 -3
- package/dist/lib/node-esm/index.mjs +84 -32
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types.mjs +1 -1
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +1 -0
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts +0 -2
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +2 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetObjectSettings.d.ts +7 -0
- package/dist/types/src/components/SheetObjectSettings.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/defs/sheet-range-types.d.ts.map +1 -1
- package/dist/types/src/defs/types.d.ts +2 -4
- package/dist/types/src/defs/types.d.ts.map +1 -1
- package/dist/types/src/defs/util.d.ts +8 -0
- package/dist/types/src/defs/util.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/extension.d.ts +2 -1
- package/dist/types/src/extensions/editor/extension.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +0 -4
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/model/testing.d.ts +6 -0
- package/dist/types/src/model/testing.d.ts.map +1 -0
- package/dist/types/src/testing/data.d.ts +3 -0
- package/dist/types/src/testing/data.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/playwright/playwright.config.d.ts +3 -0
- package/dist/types/src/testing/playwright/playwright.config.d.ts.map +1 -0
- package/dist/types/src/testing/playwright/sheet-manager.d.ts +24 -0
- package/dist/types/src/testing/playwright/sheet-manager.d.ts.map +1 -0
- package/dist/types/src/testing/playwright/sheet.spec.d.ts +2 -0
- package/dist/types/src/testing/playwright/sheet.spec.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +1 -2
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +61 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +2 -3
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +40 -37
- package/src/SheetPlugin.tsx +9 -21
- package/src/components/FunctionEditor/FunctionEditor.tsx +2 -2
- package/src/components/GridSheet/GridSheet.stories.tsx +2 -0
- package/src/components/GridSheet/GridSheet.tsx +18 -8
- package/src/components/GridSheet/util.ts +1 -9
- package/src/components/SheetContainer/SheetContainer.stories.tsx +44 -2
- package/src/components/SheetObjectSettings.tsx +38 -0
- package/src/components/Toolbar/Toolbar.tsx +7 -1
- package/src/components/index.ts +1 -0
- package/src/compute-graph/compute-graph.stories.tsx +1 -1
- package/src/compute-graph/compute-graph.test.ts +1 -1
- package/src/defs/sheet-range-types.ts +3 -0
- package/src/defs/types.ts +3 -1
- package/src/defs/util.ts +32 -1
- package/src/extensions/editor/extension.ts +3 -3
- package/src/index.ts +3 -0
- package/src/integrations/thread-ranges.ts +2 -0
- package/src/model/sheet-model.test.ts +35 -1
- package/src/model/sheet-model.ts +5 -17
- package/src/model/testing.ts +35 -0
- package/src/sanity.test.ts +1 -1
- package/src/testing/data.ts +33 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/playwright/playwright.config.ts +18 -0
- package/src/testing/playwright/sheet-manager.ts +91 -0
- package/src/testing/playwright/sheet.spec.ts +78 -0
- package/src/testing/testing.tsx +1 -31
- package/src/translations.ts +4 -0
- package/src/types.ts +1 -3
- package/dist/lib/browser/SheetContainer-YAMIOFC6.mjs.map +0 -7
- package/dist/lib/browser/chunk-BVUN7SHF.mjs.map +0 -7
- package/dist/lib/browser/chunk-QHQFM7LV.mjs.map +0 -7
- package/dist/lib/browser/chunk-VMSX6Z4X.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-BSDHHYXE.cjs.map +0 -7
- package/dist/lib/node/chunk-AWKOWDMI.cjs.map +0 -7
- package/dist/lib/node/chunk-J5ZFWMOD.cjs.map +0 -7
- package/dist/lib/node/chunk-O7XR4R7Y.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-T47T2NYJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6GSTEN7N.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CR4K75EL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UIBWRHW7.mjs.map +0 -7
- /package/dist/lib/browser/{compute-graph-GGWUX644.mjs.map → compute-graph-SNUS7HOH.mjs.map} +0 -0
- /package/dist/lib/node-esm/{compute-graph-2SCZT7N5.mjs.map → compute-graph-S6CVN7RS.mjs.map} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Locator, type Page } from '@playwright/test';
|
|
2
|
+
import { DxGridManager } from '@dxos/lit-grid/testing';
|
|
3
|
+
import { type DxGridPosition, type DxGridAxis } from '@dxos/react-ui-grid';
|
|
4
|
+
/**
|
|
5
|
+
* Test helper for managing dx-grid interactions and assertions in Playwright tests.
|
|
6
|
+
* Provides utilities for cell selection, grid navigation, virtualization checks and event handling.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SheetManager {
|
|
9
|
+
constructor(page: Page, grid?: Locator);
|
|
10
|
+
grid: DxGridManager;
|
|
11
|
+
page: Page;
|
|
12
|
+
ready(): Promise<void>;
|
|
13
|
+
fill(text: string): Promise<void>;
|
|
14
|
+
press(key: string): Promise<void>;
|
|
15
|
+
commit(key: string): Promise<void>;
|
|
16
|
+
cellByText(text: string): Locator;
|
|
17
|
+
setFocusedCellValue(text: string, commitKey: string): Promise<void>;
|
|
18
|
+
selectRange(start: DxGridPosition, end: DxGridPosition): Promise<void>;
|
|
19
|
+
deleteAxis(axis: DxGridAxis, position: number): Promise<void>;
|
|
20
|
+
toolbarAction(key: string, value: string): Locator;
|
|
21
|
+
cellEditor(): Locator;
|
|
22
|
+
rangeInList(a1Coords: string): Locator;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=sheet-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet-manager.d.ts","sourceRoot":"","sources":["../../../../../src/testing/playwright/sheet-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE3E;;;GAGG;AACH,qBAAa,YAAY;gBACX,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,OAAO;IAKtC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IAEL,KAAK;IAKL,IAAI,CAAC,IAAI,EAAE,MAAM;IAOjB,KAAK,CAAC,GAAG,EAAE,MAAM;IAOjB,MAAM,CAAC,GAAG,EAAE,MAAM;IAMxB,UAAU,CAAC,IAAI,EAAE,MAAM;IAIjB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IASnD,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,cAAc;IAWtD,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM;IAQnD,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIxC,UAAU;IAIV,WAAW,CAAC,QAAQ,EAAE,MAAM;CAG7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet.spec.d.ts","sourceRoot":"","sources":["../../../../../src/testing/playwright/sheet.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type Decorator } from '@storybook/react';
|
|
2
2
|
import { type Space } from '@dxos/react-client/echo';
|
|
3
3
|
import { type ComputeGraph, type ComputeGraphOptions } from '../compute-graph';
|
|
4
|
-
import { type
|
|
5
|
-
export declare const createTestCells: () => Record<string, CellValue>;
|
|
4
|
+
import { type CreateSheetOptions } from '../types';
|
|
6
5
|
export declare const useTestSheet: (space?: Space, graph?: ComputeGraph, options?: CreateSheetOptions) => import("../types").SheetType | undefined;
|
|
7
6
|
export declare const withComputeGraphDecorator: (options?: ComputeGraphOptions) => Decorator;
|
|
8
7
|
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../src/testing/testing.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAIrD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAwB,MAAM,kBAAkB,CAAC;AAErG,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../src/testing/testing.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAIrD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAwB,MAAM,kBAAkB,CAAC;AAErG,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,eAAO,MAAM,YAAY,WAAY,KAAK,UAAU,YAAY,YAAY,kBAAkB,6CAW7F,CAAC;AAEF,eAAO,MAAM,yBAAyB,aACzB,mBAAmB,KAAG,SAQhC,CAAC"}
|
|
@@ -1,5 +1,66 @@
|
|
|
1
1
|
declare const _default: readonly [{
|
|
2
2
|
readonly 'en-US': {
|
|
3
|
+
readonly [x: string]: {
|
|
4
|
+
readonly 'typename label': "Sheet";
|
|
5
|
+
readonly 'plugin name'?: undefined;
|
|
6
|
+
readonly 'sheet title placeholder'?: undefined;
|
|
7
|
+
readonly 'create sheet label'?: undefined;
|
|
8
|
+
readonly 'create sheet section label'?: undefined;
|
|
9
|
+
readonly 'cell placeholder'?: undefined;
|
|
10
|
+
readonly 'range key alignment label'?: undefined;
|
|
11
|
+
readonly 'range key style label'?: undefined;
|
|
12
|
+
readonly 'range value start label'?: undefined;
|
|
13
|
+
readonly 'range value center label'?: undefined;
|
|
14
|
+
readonly 'range value end label'?: undefined;
|
|
15
|
+
readonly 'range value softwrap label'?: undefined;
|
|
16
|
+
readonly 'range value highlight label'?: undefined;
|
|
17
|
+
readonly 'toolbar action label'?: undefined;
|
|
18
|
+
readonly 'selection overlaps existing comment label'?: undefined;
|
|
19
|
+
readonly 'comment label'?: undefined;
|
|
20
|
+
readonly 'comment ranges not supported label'?: undefined;
|
|
21
|
+
readonly 'no cursor label'?: undefined;
|
|
22
|
+
readonly 'open comment for sheet cell'?: undefined;
|
|
23
|
+
readonly 'add col before label'?: undefined;
|
|
24
|
+
readonly 'add col after label'?: undefined;
|
|
25
|
+
readonly 'delete col label'?: undefined;
|
|
26
|
+
readonly 'add row before label'?: undefined;
|
|
27
|
+
readonly 'add row after label'?: undefined;
|
|
28
|
+
readonly 'delete row label'?: undefined;
|
|
29
|
+
readonly 'range list heading'?: undefined;
|
|
30
|
+
readonly 'range title'?: undefined;
|
|
31
|
+
readonly 'col dropped label'?: undefined;
|
|
32
|
+
readonly 'row dropped label'?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
readonly 'plugin name': "Sheets";
|
|
35
|
+
readonly 'sheet title placeholder': "New sheet";
|
|
36
|
+
readonly 'create sheet label': "Create sheet";
|
|
37
|
+
readonly 'create sheet section label': "Create sheet";
|
|
38
|
+
readonly 'cell placeholder': "Cell value...";
|
|
39
|
+
readonly 'range key alignment label': "Align";
|
|
40
|
+
readonly 'range key style label': "Style";
|
|
41
|
+
readonly 'range value start label': "Align left";
|
|
42
|
+
readonly 'range value center label': "Align center";
|
|
43
|
+
readonly 'range value end label': "Align right";
|
|
44
|
+
readonly 'range value softwrap label': "Wrap text";
|
|
45
|
+
readonly 'range value highlight label': "Highlight";
|
|
46
|
+
readonly 'toolbar action label': "{{value}}";
|
|
47
|
+
readonly 'selection overlaps existing comment label': "Selected cell already has a comment";
|
|
48
|
+
readonly 'comment label': "Add comment";
|
|
49
|
+
readonly 'comment ranges not supported label': "Commenting on ranges is not yet supported";
|
|
50
|
+
readonly 'no cursor label': "Select a cell to comment";
|
|
51
|
+
readonly 'open comment for sheet cell': "View comments for cell";
|
|
52
|
+
readonly 'add col before label': "Add column before";
|
|
53
|
+
readonly 'add col after label': "Add column after";
|
|
54
|
+
readonly 'delete col label': "Delete column";
|
|
55
|
+
readonly 'add row before label': "Add row before";
|
|
56
|
+
readonly 'add row after label': "Add row after";
|
|
57
|
+
readonly 'delete row label': "Delete row";
|
|
58
|
+
readonly 'range list heading': "Ranges";
|
|
59
|
+
readonly 'range title': "{{position}} — {{value}}";
|
|
60
|
+
readonly 'col dropped label': "Deleted a column";
|
|
61
|
+
readonly 'row dropped label': "Deleted a row";
|
|
62
|
+
readonly 'typename label'?: undefined;
|
|
63
|
+
};
|
|
3
64
|
readonly "dxos.org/plugin/sheet": {
|
|
4
65
|
readonly 'plugin name': "Sheets";
|
|
5
66
|
readonly 'sheet title placeholder': "New sheet";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wBAsCW"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { GraphBuilderProvides, IntentResolverProvides, MetadataRecordsProvides, SurfaceProvides, TranslationsProvides, IntentData } from '@dxos/app-framework';
|
|
2
2
|
import { ref, S } from '@dxos/echo-schema';
|
|
3
|
-
import { type SchemaProvides } from '@dxos/plugin-client';
|
|
4
3
|
import { type MarkdownExtensionProvides } from '@dxos/plugin-markdown';
|
|
5
|
-
import { type
|
|
4
|
+
import { type SchemaProvides } from '@dxos/plugin-space';
|
|
6
5
|
import { type StackProvides } from '@dxos/plugin-stack';
|
|
7
6
|
import { type DxGridAxis } from '@dxos/react-ui-grid';
|
|
8
7
|
import { type SheetModel } from './model';
|
|
@@ -43,7 +42,7 @@ type ThreadProvides<T> = {
|
|
|
43
42
|
createSort: (obj: T) => (anchorA: string | undefined, anchorB: string | undefined) => number;
|
|
44
43
|
};
|
|
45
44
|
};
|
|
46
|
-
export type SheetPluginProvides = SurfaceProvides & IntentResolverProvides & GraphBuilderProvides & MarkdownExtensionProvides & MetadataRecordsProvides & TranslationsProvides & SchemaProvides &
|
|
45
|
+
export type SheetPluginProvides = SurfaceProvides & IntentResolverProvides & GraphBuilderProvides & MarkdownExtensionProvides & MetadataRecordsProvides & TranslationsProvides & SchemaProvides & StackProvides & ThreadProvides<SheetType>;
|
|
47
46
|
export type CellScalarValue = number | string | boolean | null;
|
|
48
47
|
export declare const CellValue: S.Struct<{
|
|
49
48
|
value: typeof S.Any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,UAAU,EACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-sheet",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3-staging.971cd8d",
|
|
4
4
|
"description": "Braneframe sketch plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -69,33 +69,34 @@
|
|
|
69
69
|
"re-resizable": "^6.9.17",
|
|
70
70
|
"react-markdown": "^8.0.5",
|
|
71
71
|
"react-resize-detector": "^11.0.1",
|
|
72
|
-
"@dxos/app-framework": "0.7.
|
|
73
|
-
"@dxos/async": "0.7.
|
|
74
|
-
"@dxos/client": "0.7.
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/plugin-attention": "0.7.
|
|
84
|
-
"@dxos/plugin-
|
|
85
|
-
"@dxos/plugin-
|
|
86
|
-
"@dxos/plugin-
|
|
87
|
-
"@dxos/plugin-stack": "0.7.
|
|
88
|
-
"@dxos/plugin-
|
|
89
|
-
"@dxos/
|
|
90
|
-
"@dxos/react-
|
|
91
|
-
"@dxos/react-
|
|
92
|
-
"@dxos/react-ui-
|
|
93
|
-
"@dxos/react-ui-
|
|
94
|
-
"@dxos/react-ui-
|
|
95
|
-
"@dxos/
|
|
96
|
-
"@dxos/
|
|
97
|
-
"@dxos/react-ui-
|
|
98
|
-
"@dxos/
|
|
72
|
+
"@dxos/app-framework": "0.7.3-staging.971cd8d",
|
|
73
|
+
"@dxos/async": "0.7.3-staging.971cd8d",
|
|
74
|
+
"@dxos/client": "0.7.3-staging.971cd8d",
|
|
75
|
+
"@dxos/context": "0.7.3-staging.971cd8d",
|
|
76
|
+
"@dxos/crypto": "0.7.3-staging.971cd8d",
|
|
77
|
+
"@dxos/echo-schema": "0.7.3-staging.971cd8d",
|
|
78
|
+
"@dxos/debug": "0.7.3-staging.971cd8d",
|
|
79
|
+
"@dxos/live-object": "0.7.3-staging.971cd8d",
|
|
80
|
+
"@dxos/invariant": "0.7.3-staging.971cd8d",
|
|
81
|
+
"@dxos/keys": "0.7.3-staging.971cd8d",
|
|
82
|
+
"@dxos/log": "0.7.3-staging.971cd8d",
|
|
83
|
+
"@dxos/plugin-attention": "0.7.3-staging.971cd8d",
|
|
84
|
+
"@dxos/plugin-client": "0.7.3-staging.971cd8d",
|
|
85
|
+
"@dxos/plugin-graph": "0.7.3-staging.971cd8d",
|
|
86
|
+
"@dxos/plugin-markdown": "0.7.3-staging.971cd8d",
|
|
87
|
+
"@dxos/plugin-stack": "0.7.3-staging.971cd8d",
|
|
88
|
+
"@dxos/plugin-script": "0.7.3-staging.971cd8d",
|
|
89
|
+
"@dxos/plugin-space": "0.7.3-staging.971cd8d",
|
|
90
|
+
"@dxos/react-client": "0.7.3-staging.971cd8d",
|
|
91
|
+
"@dxos/react-hooks": "0.7.3-staging.971cd8d",
|
|
92
|
+
"@dxos/react-ui-attention": "0.7.3-staging.971cd8d",
|
|
93
|
+
"@dxos/react-ui-form": "0.7.3-staging.971cd8d",
|
|
94
|
+
"@dxos/react-ui-editor": "0.7.3-staging.971cd8d",
|
|
95
|
+
"@dxos/react-ui-list": "0.7.3-staging.971cd8d",
|
|
96
|
+
"@dxos/react-ui-stack": "0.7.3-staging.971cd8d",
|
|
97
|
+
"@dxos/react-ui-grid": "0.7.3-staging.971cd8d",
|
|
98
|
+
"@dxos/schema": "0.7.3-staging.971cd8d",
|
|
99
|
+
"@dxos/util": "0.7.3-staging.971cd8d"
|
|
99
100
|
},
|
|
100
101
|
"devDependencies": {
|
|
101
102
|
"@lezer/generator": "^1.7.1",
|
|
@@ -107,19 +108,21 @@
|
|
|
107
108
|
"react": "~18.2.0",
|
|
108
109
|
"react-dom": "~18.2.0",
|
|
109
110
|
"vite": "5.4.7",
|
|
110
|
-
"@dxos/echo-generator": "0.7.
|
|
111
|
-
"@dxos/
|
|
112
|
-
"@dxos/
|
|
113
|
-
"@dxos/react-ui-syntax-highlighter": "0.7.
|
|
114
|
-
"@dxos/react-ui-
|
|
115
|
-
"@dxos/
|
|
116
|
-
"@dxos/
|
|
111
|
+
"@dxos/echo-generator": "0.7.3-staging.971cd8d",
|
|
112
|
+
"@dxos/lit-grid": "0.7.3-staging.971cd8d",
|
|
113
|
+
"@dxos/random": "0.7.3-staging.971cd8d",
|
|
114
|
+
"@dxos/react-ui-syntax-highlighter": "0.7.3-staging.971cd8d",
|
|
115
|
+
"@dxos/react-ui-theme": "0.7.3-staging.971cd8d",
|
|
116
|
+
"@dxos/react-ui": "0.7.3-staging.971cd8d",
|
|
117
|
+
"@dxos/storybook-utils": "0.7.3-staging.971cd8d",
|
|
118
|
+
"@dxos/test-utils": "0.7.3-staging.971cd8d",
|
|
119
|
+
"@dxos/react-ui-types": "0.7.3-staging.971cd8d"
|
|
117
120
|
},
|
|
118
121
|
"peerDependencies": {
|
|
119
122
|
"react": "~18.2.0",
|
|
120
123
|
"react-dom": "~18.2.0",
|
|
121
|
-
"@dxos/react-ui": "0.7.
|
|
122
|
-
"@dxos/react-ui-theme": "0.7.
|
|
124
|
+
"@dxos/react-ui": "0.7.3-staging.971cd8d",
|
|
125
|
+
"@dxos/react-ui-theme": "0.7.3-staging.971cd8d"
|
|
123
126
|
},
|
|
124
127
|
"publishConfig": {
|
|
125
128
|
"access": "public"
|
package/src/SheetPlugin.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import { SpaceAction } from '@dxos/plugin-space';
|
|
|
13
13
|
import { getSpace, isEchoObject } from '@dxos/react-client/echo';
|
|
14
14
|
import { Icon } from '@dxos/react-ui';
|
|
15
15
|
|
|
16
|
-
import { ComputeGraphContextProvider,
|
|
16
|
+
import { ComputeGraphContextProvider, SheetContainer, SheetObjectSettings } from './components';
|
|
17
17
|
import { type ComputeGraphRegistry } from './compute-graph';
|
|
18
18
|
import { compareIndexPositions, createSheet } from './defs';
|
|
19
19
|
import { computeGraphFacet } from './extensions';
|
|
@@ -49,6 +49,7 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
49
49
|
metadata: {
|
|
50
50
|
records: {
|
|
51
51
|
[SheetType.typename]: {
|
|
52
|
+
createObject: SheetAction.CREATE,
|
|
52
53
|
label: (object: any) => (object instanceof SheetType ? object.name : undefined),
|
|
53
54
|
placeholder: ['sheet title placeholder', { ns: SHEET_PLUGIN }],
|
|
54
55
|
icon: 'ph--grid-nine--regular',
|
|
@@ -58,15 +59,10 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
58
59
|
},
|
|
59
60
|
translations,
|
|
60
61
|
echo: {
|
|
62
|
+
schema: [SheetType],
|
|
61
63
|
// TODO(wittjosiah): Factor out to common package/plugin.
|
|
62
64
|
// FunctionType is currently registered here in case script plugin isn't enabled.
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
space: {
|
|
66
|
-
onSpaceCreate: {
|
|
67
|
-
label: ['create sheet label', { ns: SHEET_PLUGIN }],
|
|
68
|
-
action: SheetAction.CREATE,
|
|
69
|
-
},
|
|
65
|
+
system: [FunctionType],
|
|
70
66
|
},
|
|
71
67
|
graph: {
|
|
72
68
|
builder: (plugins) => {
|
|
@@ -144,26 +140,18 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
144
140
|
surface: {
|
|
145
141
|
component: ({ data, role }) => {
|
|
146
142
|
const space = isEchoObject(data.object) ? getSpace(data.object) : undefined;
|
|
147
|
-
if (!space) {
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
143
|
switch (role) {
|
|
152
144
|
case 'article':
|
|
153
145
|
case 'section':
|
|
154
|
-
if (data.object instanceof SheetType) {
|
|
146
|
+
if (space && data.object instanceof SheetType) {
|
|
155
147
|
return <SheetContainer space={space} sheet={data.object} role={role} />;
|
|
156
148
|
}
|
|
157
|
-
|
|
158
|
-
return null;
|
|
149
|
+
break;
|
|
159
150
|
case 'complementary--settings':
|
|
160
151
|
if (data.subject instanceof SheetType) {
|
|
161
|
-
return {
|
|
162
|
-
node: <RangeList sheet={data.subject} />,
|
|
163
|
-
};
|
|
152
|
+
return <SheetObjectSettings sheet={data.subject} />;
|
|
164
153
|
}
|
|
165
|
-
|
|
166
|
-
return null;
|
|
154
|
+
break;
|
|
167
155
|
}
|
|
168
156
|
|
|
169
157
|
return null;
|
|
@@ -186,7 +174,7 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
186
174
|
const undoData = model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
187
175
|
return {
|
|
188
176
|
undoable: {
|
|
189
|
-
message: translations[0]['en-US'][SHEET_PLUGIN][`${axis} dropped label`],
|
|
177
|
+
message: (translations[0]['en-US'][SHEET_PLUGIN] as any)[`${axis} dropped label`],
|
|
190
178
|
data: { ...undoData, model },
|
|
191
179
|
},
|
|
192
180
|
};
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Icon } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
|
-
import { addressToA1Notation, isFormula, rangeToA1Notation } from '../../defs';
|
|
9
|
+
import { addressToA1Notation, isFormula, mapFormulaIndicesToRefs, rangeToA1Notation } from '../../defs';
|
|
10
10
|
import { useSheetContext } from '../SheetContext';
|
|
11
11
|
|
|
12
12
|
export const FunctionEditor = () => {
|
|
@@ -17,7 +17,7 @@ export const FunctionEditor = () => {
|
|
|
17
17
|
if (cursor) {
|
|
18
18
|
value = model.getCellValue(cursor);
|
|
19
19
|
if (isFormula(value)) {
|
|
20
|
-
value = model.graph.mapFunctionBindingFromId(model.
|
|
20
|
+
value = model.graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(model.sheet, value));
|
|
21
21
|
formula = true;
|
|
22
22
|
} else if (value != null) {
|
|
23
23
|
value = String(value);
|
|
@@ -27,9 +27,11 @@ import {
|
|
|
27
27
|
type EditorBlurHandler,
|
|
28
28
|
type GridContentProps,
|
|
29
29
|
type DxGridPosition,
|
|
30
|
+
type DxGridCellIndex,
|
|
31
|
+
parseCellIndex,
|
|
30
32
|
} from '@dxos/react-ui-grid';
|
|
31
33
|
|
|
32
|
-
import { colLabelCell,
|
|
34
|
+
import { colLabelCell, rowLabelCell, useSheetModelDxGridProps } from './util';
|
|
33
35
|
import { DEFAULT_COLUMNS, DEFAULT_ROWS, rangeToA1Notation, type CellRange } from '../../defs';
|
|
34
36
|
import { rangeExtension, sheetExtension, type RangeController } from '../../extensions';
|
|
35
37
|
import { useSelectThreadOnCellFocus, useUpdateFocusedCellOnThreadSelection } from '../../integrations';
|
|
@@ -113,7 +115,7 @@ export const GridSheet = () => {
|
|
|
113
115
|
const handleBlur = useCallback<EditorBlurHandler>(
|
|
114
116
|
(value) => {
|
|
115
117
|
if (value !== undefined) {
|
|
116
|
-
model.setValue(
|
|
118
|
+
model.setValue(parseCellIndex(editing!.index), value);
|
|
117
119
|
}
|
|
118
120
|
},
|
|
119
121
|
[model, editing],
|
|
@@ -293,9 +295,8 @@ export const GridSheet = () => {
|
|
|
293
295
|
);
|
|
294
296
|
|
|
295
297
|
const getCellContent = useCallback(
|
|
296
|
-
(index:
|
|
297
|
-
|
|
298
|
-
return model.getCellText(cell);
|
|
298
|
+
(index: DxGridCellIndex) => {
|
|
299
|
+
return model.getCellText(parseCellIndex(index));
|
|
299
300
|
},
|
|
300
301
|
[model],
|
|
301
302
|
);
|
|
@@ -335,21 +336,30 @@ export const GridSheet = () => {
|
|
|
335
336
|
<DropdownMenu.VirtualTrigger virtualRef={contextMenuAnchorRef} />
|
|
336
337
|
<DropdownMenu.Content side={contextMenuAxis === 'col' ? 'bottom' : 'right'} sideOffset={4} collisionPadding={8}>
|
|
337
338
|
<DropdownMenu.Viewport>
|
|
338
|
-
<DropdownMenu.Item
|
|
339
|
+
<DropdownMenu.Item
|
|
340
|
+
onClick={() => handleAxisMenuAction('insert-before')}
|
|
341
|
+
data-testid={`grid.${contextMenuAxis}.insert-before`}
|
|
342
|
+
>
|
|
339
343
|
<Icon
|
|
340
344
|
size={5}
|
|
341
345
|
icon={contextMenuAxis === 'col' ? 'ph--columns-plus-left--regular' : 'ph--rows-plus-top--regular'}
|
|
342
346
|
/>
|
|
343
347
|
<span>{t(`add ${contextMenuAxis} before label`)}</span>
|
|
344
348
|
</DropdownMenu.Item>
|
|
345
|
-
<DropdownMenu.Item
|
|
349
|
+
<DropdownMenu.Item
|
|
350
|
+
onClick={() => handleAxisMenuAction('insert-after')}
|
|
351
|
+
data-testid={`grid.${contextMenuAxis}.insert-after`}
|
|
352
|
+
>
|
|
346
353
|
<Icon
|
|
347
354
|
size={5}
|
|
348
355
|
icon={contextMenuAxis === 'col' ? 'ph--columns-plus-right--regular' : 'ph--rows-plus-bottom--regular'}
|
|
349
356
|
/>
|
|
350
357
|
<span>{t(`add ${contextMenuAxis} after label`)}</span>
|
|
351
358
|
</DropdownMenu.Item>
|
|
352
|
-
<DropdownMenu.Item
|
|
359
|
+
<DropdownMenu.Item
|
|
360
|
+
onClick={() => handleAxisMenuAction('drop')}
|
|
361
|
+
data-testid={`grid.${contextMenuAxis}.drop`}
|
|
362
|
+
>
|
|
353
363
|
<Icon size={5} icon='ph--backspace--regular' />
|
|
354
364
|
<span>{t(`delete ${contextMenuAxis} label`)}</span>
|
|
355
365
|
</DropdownMenu.Item>
|
|
@@ -20,18 +20,10 @@ import {
|
|
|
20
20
|
} from '@dxos/react-ui-grid';
|
|
21
21
|
import { mx } from '@dxos/react-ui-theme';
|
|
22
22
|
|
|
23
|
-
import {
|
|
23
|
+
import { inRange, cellClassNameForRange, rangeFromIndex } from '../../defs';
|
|
24
24
|
import { parseThreadAnchorAsCellRange } from '../../integrations';
|
|
25
25
|
import { type SheetModel } from '../../model';
|
|
26
26
|
|
|
27
|
-
export const dxGridCellIndexToSheetCellAddress = (index: string): CellAddress => {
|
|
28
|
-
const [colStr, rowStr] = index.split(',');
|
|
29
|
-
return {
|
|
30
|
-
col: parseInt(colStr),
|
|
31
|
-
row: parseInt(rowStr),
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
|
|
35
27
|
const createDxGridColumns = (model: SheetModel): DxGridAxisMeta => {
|
|
36
28
|
return model.sheet.columns.reduce(
|
|
37
29
|
(acc: DxGridAxisMeta, columnId, numericIndex) => {
|
|
@@ -2,18 +2,40 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
5
7
|
import { type Meta } from '@storybook/react';
|
|
6
8
|
import React from 'react';
|
|
7
9
|
|
|
8
|
-
import {
|
|
10
|
+
import { type Intent, IntentProvider } from '@dxos/app-framework';
|
|
11
|
+
import { useSpace, create } from '@dxos/react-client/echo';
|
|
9
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
10
13
|
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
11
14
|
|
|
12
15
|
import { SheetContainer } from './SheetContainer';
|
|
13
16
|
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
14
17
|
import translations from '../../translations';
|
|
15
|
-
import { SheetType } from '../../types';
|
|
18
|
+
import { SheetAction, SheetType } from '../../types';
|
|
16
19
|
import { useComputeGraph } from '../ComputeGraph';
|
|
20
|
+
import { RangeList } from '../RangeList';
|
|
21
|
+
|
|
22
|
+
// TODO(thure via wittjosiah): stories/components should be written such that the dependency on intents is external and provided via callback and then the story can implement it differently.
|
|
23
|
+
const storybookIntentValue = create({
|
|
24
|
+
dispatch: async (intents: Intent | Intent[]) => {
|
|
25
|
+
const intent = Array.isArray(intents) ? intents[0] : intents;
|
|
26
|
+
switch (intent.action) {
|
|
27
|
+
case SheetAction.DROP_AXIS: {
|
|
28
|
+
if (!intent.undo) {
|
|
29
|
+
const { model, axis, axisIndex } = intent.data as SheetAction.DropAxis;
|
|
30
|
+
model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
undo: async () => ({}),
|
|
36
|
+
history: [],
|
|
37
|
+
registerResolver: () => () => {},
|
|
38
|
+
});
|
|
17
39
|
|
|
18
40
|
export const Basic = () => {
|
|
19
41
|
const space = useSpace();
|
|
@@ -26,6 +48,26 @@ export const Basic = () => {
|
|
|
26
48
|
return <SheetContainer space={space} sheet={sheet} role='article' ignoreAttention />;
|
|
27
49
|
};
|
|
28
50
|
|
|
51
|
+
export const Spec = () => {
|
|
52
|
+
const space = useSpace();
|
|
53
|
+
const graph = useComputeGraph(space);
|
|
54
|
+
const sheet = useTestSheet(space, graph, { cells: { A1: { value: 'Ready' } } });
|
|
55
|
+
if (!sheet || !space) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<IntentProvider value={storybookIntentValue}>
|
|
61
|
+
<div role='none' className='grid grid-rows-[66%_33%] grid-cols-1'>
|
|
62
|
+
<SheetContainer space={space} sheet={sheet} role='article' ignoreAttention />
|
|
63
|
+
<div role='none' data-testid='grid.range-list'>
|
|
64
|
+
<RangeList sheet={sheet} />
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</IntentProvider>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
29
71
|
const meta: Meta = {
|
|
30
72
|
title: 'plugins/plugin-sheet/SheetContainer',
|
|
31
73
|
component: SheetContainer,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { SPACE_PLUGIN } from '@dxos/plugin-space/meta';
|
|
8
|
+
import { Input, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
|
|
10
|
+
import { RangeList } from './RangeList';
|
|
11
|
+
import { type SheetType } from '../types';
|
|
12
|
+
|
|
13
|
+
export type SheetObjectSettingsProps = {
|
|
14
|
+
sheet: SheetType;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const SheetObjectSettings = ({ sheet }: SheetObjectSettingsProps) => {
|
|
18
|
+
const { t } = useTranslation(SPACE_PLUGIN);
|
|
19
|
+
|
|
20
|
+
// TODO(burdon): Standardize forms.
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<div role='form' className='flex flex-col w-full p-2 gap-1'>
|
|
24
|
+
<Input.Root>
|
|
25
|
+
<Input.Label>{t('name label')}</Input.Label>
|
|
26
|
+
<Input.TextInput
|
|
27
|
+
placeholder={t('name placeholder')}
|
|
28
|
+
value={sheet.name ?? ''}
|
|
29
|
+
onChange={(event) => {
|
|
30
|
+
sheet.name = event.target.value;
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</Input.Root>
|
|
34
|
+
</div>
|
|
35
|
+
<RangeList sheet={sheet} />
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
@@ -225,7 +225,13 @@ const Alignment = () => {
|
|
|
225
225
|
onValueChange={(value: AlignValue) => onAction?.({ key: alignKey, value })}
|
|
226
226
|
>
|
|
227
227
|
{alignmentOptions.map(({ value, icon }) => (
|
|
228
|
-
<ToolbarItem
|
|
228
|
+
<ToolbarItem
|
|
229
|
+
itemType='toggleGroupItem'
|
|
230
|
+
key={value}
|
|
231
|
+
value={value}
|
|
232
|
+
icon={icon}
|
|
233
|
+
data-testid={`grid.toolbar.${alignKey}.${value}`}
|
|
234
|
+
>
|
|
229
235
|
{t('toolbar action label', {
|
|
230
236
|
key: t(`range key ${alignKey} label`),
|
|
231
237
|
value: t(`range value ${value} label`),
|
package/src/components/index.ts
CHANGED
|
@@ -45,7 +45,7 @@ const Story = () => {
|
|
|
45
45
|
setResult({ functions: { standard: f1.length, echo: f2.length } });
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
space.db.add(create(FunctionType, { name: 'test', version: 1, binding: FUNCTION_NAME }));
|
|
48
|
+
space.db.add(create(FunctionType, { name: 'test', version: '0.0.1', binding: FUNCTION_NAME }));
|
|
49
49
|
}
|
|
50
50
|
}, [space, graph]);
|
|
51
51
|
|
|
@@ -30,7 +30,7 @@ describe('ComputeGraph', () => {
|
|
|
30
30
|
// Create script.
|
|
31
31
|
const trigger = new Trigger();
|
|
32
32
|
graph.update.once(() => trigger.wake());
|
|
33
|
-
const functionObject = space.db.add(create(FunctionType, { name: 'test', version: 1, binding: 'TEST' }));
|
|
33
|
+
const functionObject = space.db.add(create(FunctionType, { name: 'test', version: '0.0.1', binding: 'TEST' }));
|
|
34
34
|
await trigger.wait();
|
|
35
35
|
const functions = graph.getFunctions({ echo: true });
|
|
36
36
|
expect(functions).to.toHaveLength(1);
|
|
@@ -32,8 +32,10 @@ export const cellClassNameForRange = ({ key, value }: SheetType['ranges'][number
|
|
|
32
32
|
default:
|
|
33
33
|
return undefined;
|
|
34
34
|
}
|
|
35
|
+
|
|
35
36
|
case commentKey:
|
|
36
37
|
return 'bg-gridComment';
|
|
38
|
+
|
|
37
39
|
case styleKey:
|
|
38
40
|
switch (value) {
|
|
39
41
|
case 'highlight':
|
|
@@ -43,6 +45,7 @@ export const cellClassNameForRange = ({ key, value }: SheetType['ranges'][number
|
|
|
43
45
|
default:
|
|
44
46
|
return undefined;
|
|
45
47
|
}
|
|
48
|
+
|
|
46
49
|
default:
|
|
47
50
|
return undefined;
|
|
48
51
|
}
|