@dxos/plugin-sheet 0.6.12-main.89e9959 → 0.6.12-main.ac23639

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.
Files changed (96) hide show
  1. package/dist/lib/browser/{SheetContainer-LG77O4RM.mjs → SheetContainer-XBTEYQ6T.mjs} +4 -4
  2. package/dist/lib/browser/{chunk-QILRZNE5.mjs → chunk-D3QTX46O.mjs} +4 -5
  3. package/dist/lib/browser/chunk-D3QTX46O.mjs.map +7 -0
  4. package/dist/lib/browser/{chunk-CHQAW4F4.mjs → chunk-NA6NLHDE.mjs} +117 -260
  5. package/dist/lib/browser/chunk-NA6NLHDE.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-WZMOZKQZ.mjs → chunk-NZBWHQSR.mjs} +21 -25
  7. package/dist/lib/browser/chunk-NZBWHQSR.mjs.map +7 -0
  8. package/dist/lib/browser/index.mjs +8 -17
  9. package/dist/lib/browser/index.mjs.map +4 -4
  10. package/dist/lib/browser/meta.json +1 -1
  11. package/dist/lib/browser/meta.mjs +1 -1
  12. package/dist/lib/browser/types.mjs +4 -8
  13. package/dist/lib/node/{SheetContainer-OZ7DHH4L.cjs → SheetContainer-HSRYKV52.cjs} +16 -16
  14. package/dist/lib/node/{chunk-BNARJ5GM.cjs → chunk-QIFIGEKV.cjs} +6 -7
  15. package/dist/lib/node/chunk-QIFIGEKV.cjs.map +7 -0
  16. package/dist/lib/node/{chunk-5FTFZL5W.cjs → chunk-UXH6GKEU.cjs} +61 -202
  17. package/dist/lib/node/chunk-UXH6GKEU.cjs.map +7 -0
  18. package/dist/lib/node/{chunk-AOP42UAA.cjs → chunk-XYGN3RTG.cjs} +27 -33
  19. package/dist/lib/node/chunk-XYGN3RTG.cjs.map +7 -0
  20. package/dist/lib/node/index.cjs +29 -37
  21. package/dist/lib/node/index.cjs.map +4 -4
  22. package/dist/lib/node/meta.cjs +3 -3
  23. package/dist/lib/node/meta.cjs.map +1 -1
  24. package/dist/lib/node/meta.json +1 -1
  25. package/dist/lib/node/types.cjs +8 -12
  26. package/dist/lib/node/types.cjs.map +2 -2
  27. package/dist/lib/node-esm/{SheetContainer-4XS2G25Z.mjs → SheetContainer-Q4PHM7ZE.mjs} +4 -4
  28. package/dist/lib/node-esm/{chunk-RR2AO4SM.mjs → chunk-GH33JLIW.mjs} +21 -25
  29. package/dist/lib/node-esm/chunk-GH33JLIW.mjs.map +7 -0
  30. package/dist/lib/node-esm/{chunk-KK3XL37M.mjs → chunk-J2KAVUQA.mjs} +117 -260
  31. package/dist/lib/node-esm/chunk-J2KAVUQA.mjs.map +7 -0
  32. package/dist/lib/node-esm/{chunk-IU2L277A.mjs → chunk-VCYJWE3O.mjs} +4 -5
  33. package/dist/lib/node-esm/chunk-VCYJWE3O.mjs.map +7 -0
  34. package/dist/lib/node-esm/index.mjs +8 -17
  35. package/dist/lib/node-esm/index.mjs.map +4 -4
  36. package/dist/lib/node-esm/meta.json +1 -1
  37. package/dist/lib/node-esm/meta.mjs +1 -1
  38. package/dist/lib/node-esm/types.mjs +4 -8
  39. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  40. package/dist/types/src/components/{CellEditor/CellEditor.stories.d.ts → GridSheet/SheetCellEditor.stories.d.ts} +2 -2
  41. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -0
  42. package/dist/types/src/components/GridSheet/util.d.ts +2 -2
  43. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
  44. package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -1
  45. package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +1 -1
  46. package/dist/types/src/extensions/editor/extension.d.ts.map +1 -0
  47. package/dist/types/src/extensions/editor/extension.test.d.ts.map +1 -0
  48. package/dist/types/src/extensions/editor/index.d.ts +2 -0
  49. package/dist/types/src/extensions/editor/index.d.ts.map +1 -0
  50. package/dist/types/src/extensions/index.d.ts +1 -0
  51. package/dist/types/src/extensions/index.d.ts.map +1 -1
  52. package/dist/types/src/meta.d.ts +3 -6
  53. package/dist/types/src/meta.d.ts.map +1 -1
  54. package/dist/types/src/model/formatting-model.d.ts +3 -0
  55. package/dist/types/src/model/formatting-model.d.ts.map +1 -1
  56. package/dist/types/src/model/sheet-model.d.ts +3 -2
  57. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  58. package/dist/types/src/types.d.ts +4 -20
  59. package/dist/types/src/types.d.ts.map +1 -1
  60. package/package.json +36 -34
  61. package/src/components/GridSheet/GridSheet.tsx +14 -32
  62. package/src/components/{CellEditor/CellEditor.stories.tsx → GridSheet/SheetCellEditor.stories.tsx} +2 -2
  63. package/src/components/GridSheet/util.ts +2 -6
  64. package/src/components/Sheet/Sheet.stories.tsx +4 -3
  65. package/src/components/Sheet/Sheet.tsx +2 -8
  66. package/src/{components/CellEditor → extensions/editor}/index.ts +0 -1
  67. package/src/extensions/index.ts +1 -0
  68. package/src/{meta.tsx → meta.ts} +3 -3
  69. package/src/model/formatting-model.ts +11 -8
  70. package/src/model/sheet-model.test.ts +1 -3
  71. package/src/model/sheet-model.ts +13 -11
  72. package/src/types.ts +8 -35
  73. package/dist/lib/browser/chunk-CHQAW4F4.mjs.map +0 -7
  74. package/dist/lib/browser/chunk-QILRZNE5.mjs.map +0 -7
  75. package/dist/lib/browser/chunk-WZMOZKQZ.mjs.map +0 -7
  76. package/dist/lib/node/chunk-5FTFZL5W.cjs.map +0 -7
  77. package/dist/lib/node/chunk-AOP42UAA.cjs.map +0 -7
  78. package/dist/lib/node/chunk-BNARJ5GM.cjs.map +0 -7
  79. package/dist/lib/node-esm/chunk-IU2L277A.mjs.map +0 -7
  80. package/dist/lib/node-esm/chunk-KK3XL37M.mjs.map +0 -7
  81. package/dist/lib/node-esm/chunk-RR2AO4SM.mjs.map +0 -7
  82. package/dist/types/src/components/CellEditor/CellEditor.d.ts +0 -34
  83. package/dist/types/src/components/CellEditor/CellEditor.d.ts.map +0 -1
  84. package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +0 -1
  85. package/dist/types/src/components/CellEditor/extension.d.ts.map +0 -1
  86. package/dist/types/src/components/CellEditor/extension.test.d.ts.map +0 -1
  87. package/dist/types/src/components/CellEditor/index.d.ts +0 -3
  88. package/dist/types/src/components/CellEditor/index.d.ts.map +0 -1
  89. package/src/components/CellEditor/CellEditor.tsx +0 -163
  90. /package/dist/lib/browser/{SheetContainer-LG77O4RM.mjs.map → SheetContainer-XBTEYQ6T.mjs.map} +0 -0
  91. /package/dist/lib/node/{SheetContainer-OZ7DHH4L.cjs.map → SheetContainer-HSRYKV52.cjs.map} +0 -0
  92. /package/dist/lib/node-esm/{SheetContainer-4XS2G25Z.mjs.map → SheetContainer-Q4PHM7ZE.mjs.map} +0 -0
  93. /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.d.ts +0 -0
  94. /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.test.d.ts +0 -0
  95. /package/src/{components/CellEditor → extensions/editor}/extension.test.ts +0 -0
  96. /package/src/{components/CellEditor → extensions/editor}/extension.ts +0 -0
@@ -4,6 +4,7 @@ import { type SchemaProvides } from '@dxos/plugin-client';
4
4
  import { type MarkdownExtensionProvides } from '@dxos/plugin-markdown';
5
5
  import { type SpaceInitProvides } from '@dxos/plugin-space';
6
6
  import { type StackProvides } from '@dxos/plugin-stack';
7
+ import { FieldValueType } from '@dxos/schema';
7
8
  export declare enum SheetAction {
8
9
  CREATE = "dxos.org/plugin/sheet/action/create"
9
10
  }
@@ -19,25 +20,8 @@ export declare const CellValue: S.Struct<{
19
20
  value: typeof S.Any;
20
21
  }>;
21
22
  export type CellValue = S.Schema.Type<typeof CellValue>;
22
- /**
23
- * https://www.tutorialsteacher.com/typescript/typescript-number
24
- */
25
- export declare enum ValueTypeEnum {
26
- Null = 0,
27
- Number = 1,
28
- Boolean = 2,
29
- String = 3,
30
- Percent = 10,
31
- Currency = 11,
32
- DateTime = 20,
33
- Date = 21,
34
- Time = 22,
35
- URL = 30,
36
- DID = 31
37
- }
38
- export declare const ValueType: S.Enums<typeof ValueTypeEnum>;
39
23
  export declare const Formatting: S.Struct<{
40
- type: S.optional<S.Enums<typeof ValueTypeEnum>>;
24
+ type: S.optional<S.Enums<typeof FieldValueType>>;
41
25
  format: S.optional<typeof S.String>;
42
26
  precision: S.optional<typeof S.Number>;
43
27
  classNames: S.optional<S.Array$<typeof S.String>>;
@@ -67,7 +51,7 @@ declare const SheetType_base: import("@dxos/echo-schema").AbstractTypedObject<{
67
51
  };
68
52
  formatting: {
69
53
  [x: string]: {
70
- type?: ValueTypeEnum | undefined;
54
+ type?: FieldValueType | undefined;
71
55
  format?: string | undefined;
72
56
  precision?: number | undefined;
73
57
  classNames?: readonly string[] | undefined;
@@ -122,7 +106,7 @@ declare const SheetType_base: import("@dxos/echo-schema").AbstractTypedObject<{
122
106
  size: S.optional<typeof S.Number>;
123
107
  }>>>>;
124
108
  formatting: S.mutable<S.Record$<typeof S.String, S.mutable<S.Struct<{
125
- type: S.optional<S.Enums<typeof ValueTypeEnum>>;
109
+ type: S.optional<S.Enums<typeof FieldValueType>>;
126
110
  format: S.optional<typeof S.String>;
127
111
  precision: S.optional<typeof S.Number>;
128
112
  classNames: S.optional<S.Array$<typeof S.String>>;
@@ -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,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,KAAK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;;AAnC9pB,qBAAa,SAAU,SAAQ,cAwB7B;CAAG;AAEL,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACnC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-sheet",
3
- "version": "0.6.12-main.89e9959",
3
+ "version": "0.6.12-main.ac23639",
4
4
  "description": "Braneframe sketch plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -65,7 +65,7 @@
65
65
  "@dnd-kit/modifiers": "^6.0.0",
66
66
  "@dnd-kit/sortable": "^7.0.1",
67
67
  "@dnd-kit/utilities": "^3.2.0",
68
- "@effect/schema": "^0.67.16",
68
+ "@effect/schema": "^0.75.1",
69
69
  "@lezer/common": "^1.2.2",
70
70
  "@lezer/highlight": "^1.2.1",
71
71
  "@lezer/lezer": "^1.1.2",
@@ -74,34 +74,36 @@
74
74
  "@radix-ui/react-context": "^1.0.0",
75
75
  "@tanstack/react-virtual": "^3.9.0",
76
76
  "codemirror-lang-spreadsheet": "^1.3.0",
77
+ "date-fns": "^3.3.1",
77
78
  "hyperformula": "^2.7.1",
78
79
  "lodash.defaultsdeep": "^4.6.1",
79
80
  "re-resizable": "^6.9.17",
80
81
  "react-markdown": "^8.0.5",
81
82
  "react-resize-detector": "^11.0.1",
82
- "@dxos/app-framework": "0.6.12-main.89e9959",
83
- "@dxos/async": "0.6.12-main.89e9959",
84
- "@dxos/context": "0.6.12-main.89e9959",
85
- "@dxos/client": "0.6.12-main.89e9959",
86
- "@dxos/crypto": "0.6.12-main.89e9959",
87
- "@dxos/keys": "0.6.12-main.89e9959",
88
- "@dxos/debug": "0.6.12-main.89e9959",
89
- "@dxos/echo-schema": "0.6.12-main.89e9959",
90
- "@dxos/invariant": "0.6.12-main.89e9959",
91
- "@dxos/log": "0.6.12-main.89e9959",
92
- "@dxos/plugin-attention": "0.6.12-main.89e9959",
93
- "@dxos/plugin-graph": "0.6.12-main.89e9959",
94
- "@dxos/plugin-markdown": "0.6.12-main.89e9959",
95
- "@dxos/plugin-script": "0.6.12-main.89e9959",
96
- "@dxos/plugin-client": "0.6.12-main.89e9959",
97
- "@dxos/plugin-space": "0.6.12-main.89e9959",
98
- "@dxos/plugin-stack": "0.6.12-main.89e9959",
99
- "@dxos/react-client": "0.6.12-main.89e9959",
100
- "@dxos/react-hooks": "0.6.12-main.89e9959",
101
- "@dxos/react-ui-attention": "0.6.12-main.89e9959",
102
- "@dxos/react-ui-grid": "0.6.12-main.89e9959",
103
- "@dxos/util": "0.6.12-main.89e9959",
104
- "@dxos/react-ui-editor": "0.6.12-main.89e9959"
83
+ "@dxos/async": "0.6.12-main.ac23639",
84
+ "@dxos/app-framework": "0.6.12-main.ac23639",
85
+ "@dxos/context": "0.6.12-main.ac23639",
86
+ "@dxos/client": "0.6.12-main.ac23639",
87
+ "@dxos/crypto": "0.6.12-main.ac23639",
88
+ "@dxos/debug": "0.6.12-main.ac23639",
89
+ "@dxos/invariant": "0.6.12-main.ac23639",
90
+ "@dxos/keys": "0.6.12-main.ac23639",
91
+ "@dxos/log": "0.6.12-main.ac23639",
92
+ "@dxos/echo-schema": "0.6.12-main.ac23639",
93
+ "@dxos/plugin-attention": "0.6.12-main.ac23639",
94
+ "@dxos/plugin-graph": "0.6.12-main.ac23639",
95
+ "@dxos/plugin-client": "0.6.12-main.ac23639",
96
+ "@dxos/plugin-markdown": "0.6.12-main.ac23639",
97
+ "@dxos/plugin-space": "0.6.12-main.ac23639",
98
+ "@dxos/plugin-stack": "0.6.12-main.ac23639",
99
+ "@dxos/react-hooks": "0.6.12-main.ac23639",
100
+ "@dxos/react-client": "0.6.12-main.ac23639",
101
+ "@dxos/plugin-script": "0.6.12-main.ac23639",
102
+ "@dxos/react-ui-attention": "0.6.12-main.ac23639",
103
+ "@dxos/schema": "0.6.12-main.ac23639",
104
+ "@dxos/react-ui-grid": "0.6.12-main.ac23639",
105
+ "@dxos/react-ui-editor": "0.6.12-main.ac23639",
106
+ "@dxos/util": "0.6.12-main.ac23639"
105
107
  },
106
108
  "devDependencies": {
107
109
  "@lezer/generator": "^1.7.1",
@@ -114,20 +116,20 @@
114
116
  "react": "~18.2.0",
115
117
  "react-dom": "~18.2.0",
116
118
  "vite": "5.4.7",
117
- "@dxos/echo-generator": "0.6.12-main.89e9959",
118
- "@dxos/random": "0.6.12-main.89e9959",
119
- "@dxos/react-ui-syntax-highlighter": "0.6.12-main.89e9959",
120
- "@dxos/react-ui": "0.6.12-main.89e9959",
121
- "@dxos/react-ui-types": "0.6.12-main.89e9959",
122
- "@dxos/react-ui-theme": "0.6.12-main.89e9959",
123
- "@dxos/storybook-utils": "0.6.12-main.89e9959"
119
+ "@dxos/random": "0.6.12-main.ac23639",
120
+ "@dxos/echo-generator": "0.6.12-main.ac23639",
121
+ "@dxos/react-ui": "0.6.12-main.ac23639",
122
+ "@dxos/react-ui-syntax-highlighter": "0.6.12-main.ac23639",
123
+ "@dxos/react-ui-theme": "0.6.12-main.ac23639",
124
+ "@dxos/storybook-utils": "0.6.12-main.ac23639",
125
+ "@dxos/react-ui-types": "0.6.12-main.ac23639"
124
126
  },
125
127
  "peerDependencies": {
126
128
  "@phosphor-icons/react": "^2.1.5",
127
129
  "react": "~18.2.0",
128
130
  "react-dom": "~18.2.0",
129
- "@dxos/react-ui": "0.6.12-main.89e9959",
130
- "@dxos/react-ui-theme": "0.6.12-main.89e9959"
131
+ "@dxos/react-ui": "0.6.12-main.ac23639",
132
+ "@dxos/react-ui-theme": "0.6.12-main.ac23639"
131
133
  },
132
134
  "publishConfig": {
133
135
  "access": "public"
@@ -10,44 +10,18 @@ import {
10
10
  type GridContentProps,
11
11
  type GridScopedProps,
12
12
  useGridContext,
13
+ editorKeys,
14
+ type EditorKeysProps,
15
+ GridCellEditor,
13
16
  } from '@dxos/react-ui-grid';
14
17
 
15
18
  import { colLabelCell, dxGridCellIndexToSheetCellAddress, rowLabelCell, useSheetModelDxGridProps } from './util';
16
19
  import { rangeToA1Notation, type CellRange } from '../../defs';
20
+ import { rangeExtension, sheetExtension, type CellRangeNotifier } from '../../extensions';
17
21
  import { type ComputeGraph } from '../../graph';
18
22
  import { useFormattingModel, useSheetModel, type UseSheetModelOptions } from '../../hooks';
19
23
  import { type SheetModel, type FormattingModel } from '../../model';
20
24
  import { type SheetType } from '../../types';
21
- import {
22
- CellEditor,
23
- type CellEditorProps,
24
- type CellRangeNotifier,
25
- editorKeys,
26
- type EditorKeysProps,
27
- rangeExtension,
28
- sheetExtension,
29
- } from '../CellEditor';
30
-
31
- const GridSheetCellEditor = ({
32
- model,
33
- extension,
34
- __gridScope,
35
- }: GridScopedProps<Pick<CellEditorProps, 'extension'> & { model: SheetModel }>) => {
36
- const { id, editing, setEditing, editBox } = useGridContext('GridSheetCellEditor', __gridScope);
37
- const cell = dxGridCellIndexToSheetCellAddress(editing);
38
-
39
- return editing ? (
40
- <CellEditor
41
- variant='grid'
42
- value={editing.initialContent ?? (cell ? model.getCellText(cell) : undefined)}
43
- autoFocus
44
- box={editBox}
45
- onBlur={() => setEditing(null)}
46
- extension={extension}
47
- gridId={id}
48
- />
49
- ) : null;
50
- };
51
25
 
52
26
  const initialCells = {
53
27
  grid: {},
@@ -82,7 +56,7 @@ const GridSheetImpl = ({
82
56
  const handleClose = useCallback<NonNullable<EditorKeysProps['onClose']> | NonNullable<EditorKeysProps['onNav']>>(
83
57
  (value, { key, shift }) => {
84
58
  if (value !== undefined) {
85
- model.setValue(dxGridCellIndexToSheetCellAddress(editing)!, value);
59
+ model.setValue(dxGridCellIndexToSheetCellAddress(editing!.index), value);
86
60
  }
87
61
  setEditing(null);
88
62
  const axis = ['Enter', 'ArrowUp', 'ArrowDown'].includes(key)
@@ -136,9 +110,17 @@ const GridSheetImpl = ({
136
110
  [model, handleClose, editing],
137
111
  );
138
112
 
113
+ const getCellContent = useCallback(
114
+ (index: string) => {
115
+ const cell = dxGridCellIndexToSheetCellAddress(index);
116
+ return model.getCellText(cell);
117
+ },
118
+ [model],
119
+ );
120
+
139
121
  return (
140
122
  <>
141
- <GridSheetCellEditor model={model} extension={extension} />
123
+ <GridCellEditor getCellContent={getCellContent} extension={extension} />
142
124
  <Grid.Content
143
125
  initialCells={initialCells}
144
126
  columns={columns}
@@ -9,12 +9,12 @@ import React, { useEffect, useMemo, useState } from 'react';
9
9
  import { Client } from '@dxos/client';
10
10
  import { createDocAccessor, type EchoReactiveObject } from '@dxos/client/echo';
11
11
  import { automerge } from '@dxos/react-ui-editor';
12
+ import { CellEditor, type CellEditorProps } from '@dxos/react-ui-grid';
12
13
  import { withTheme } from '@dxos/storybook-utils';
13
14
 
14
15
  import { HyperFormula } from '#hyperformula';
15
- import { CellEditor, type CellEditorProps } from './CellEditor';
16
- import { sheetExtension } from './extension';
17
16
  import { createSheet } from '../../defs';
17
+ import { sheetExtension } from '../../extensions';
18
18
  import { defaultFunctions } from '../../graph';
19
19
  import { SheetType } from '../../types';
20
20
 
@@ -6,7 +6,6 @@ import { type MutableRefObject, useEffect, useLayoutEffect, useState } from 'rea
6
6
 
7
7
  import { createDocAccessor } from '@dxos/react-client/echo';
8
8
  import {
9
- type GridEditing,
10
9
  type GridContentProps,
11
10
  type DxGridElement,
12
11
  type DxGridAxisMeta,
@@ -21,11 +20,8 @@ import { mx } from '@dxos/react-ui-theme';
21
20
  import { type CellAddress } from '../../defs';
22
21
  import { type SheetModel, type FormattingModel } from '../../model';
23
22
 
24
- export const dxGridCellIndexToSheetCellAddress = (gridEditing: GridEditing): CellAddress | null => {
25
- if (!gridEditing) {
26
- return null;
27
- }
28
- const [colStr, rowStr] = gridEditing.index.split(',');
23
+ export const dxGridCellIndexToSheetCellAddress = (index: string): CellAddress => {
24
+ const [colStr, rowStr] = index.split(',');
29
25
  return {
30
26
  col: parseInt(colStr),
31
27
  row: parseInt(rowStr),
@@ -11,6 +11,7 @@ import { useSpace } from '@dxos/react-client/echo';
11
11
  import { withClientProvider } from '@dxos/react-client/testing';
12
12
  import { Button } from '@dxos/react-ui';
13
13
  import { mx } from '@dxos/react-ui-theme';
14
+ import { FieldValueType } from '@dxos/schema';
14
15
  import { withLayout, withTheme } from '@dxos/storybook-utils';
15
16
 
16
17
  import { Sheet } from './Sheet';
@@ -21,7 +22,7 @@ import { type ComputeGraph } from '../../graph';
21
22
  import { testFunctionPlugins } from '../../graph/testing';
22
23
  import { useComputeGraph } from '../../hooks';
23
24
  import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
24
- import { SheetType, ValueTypeEnum } from '../../types';
25
+ import { SheetType } from '../../types';
25
26
  import { Toolbar, type ToolbarActionHandler } from '../Toolbar';
26
27
 
27
28
  // TODO(burdon): Allow toolbar to access sheet context; provide state for current cursor/range.
@@ -69,12 +70,12 @@ const SheetWithToolbar = ({ graph, debug }: { graph: ComputeGraph; debug?: boole
69
70
  }
70
71
 
71
72
  case 'date': {
72
- format.type = ValueTypeEnum.Date;
73
+ format.type = FieldValueType.Date;
73
74
  format.format = 'YYYY-MM-DD';
74
75
  break;
75
76
  }
76
77
  case 'currency': {
77
- format.type = ValueTypeEnum.Currency;
78
+ format.type = FieldValueType.Currency;
78
79
  format.precision = 2;
79
80
  break;
80
81
  }
@@ -42,6 +42,7 @@ import { fullyQualifiedId, createDocAccessor } from '@dxos/client/echo';
42
42
  import { log } from '@dxos/log';
43
43
  import { type ThemedClassName } from '@dxos/react-ui';
44
44
  import { ATTENABLE_ATTRIBUTE, useAttendableAttributes, useAttention, useAttentionPath } from '@dxos/react-ui-attention';
45
+ import { CellEditor, type EditorKeysProps, editorKeys } from '@dxos/react-ui-grid';
45
46
  import { mx } from '@dxos/react-ui-theme';
46
47
 
47
48
  import {
@@ -73,14 +74,7 @@ import {
73
74
  addressToIndex,
74
75
  addressFromIndex,
75
76
  } from '../../defs';
76
- import {
77
- CellEditor,
78
- type CellRangeNotifier,
79
- type EditorKeysProps,
80
- editorKeys,
81
- rangeExtension,
82
- sheetExtension,
83
- } from '../CellEditor';
77
+ import { rangeExtension, sheetExtension, type CellRangeNotifier } from '../../extensions';
84
78
 
85
79
  // TODO(burdon): Virtualization bug.
86
80
  // TODO(burdon): Toolbar styles and formatting.
@@ -2,5 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export * from './CellEditor';
6
5
  export * from './extension';
@@ -3,3 +3,4 @@
3
3
  //
4
4
 
5
5
  export * from './compute';
6
+ export * from './editor';
@@ -2,13 +2,13 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { pluginMeta } from '@dxos/app-framework';
5
+ import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
7
  export const SHEET_PLUGIN = 'dxos.org/plugin/sheet';
8
8
 
9
- export default pluginMeta({
9
+ export default {
10
10
  id: SHEET_PLUGIN,
11
11
  name: 'Sheet',
12
12
  description: 'A simple spreadsheet plugin.',
13
13
  icon: 'ph--grid-nine--regular',
14
- });
14
+ } satisfies PluginMeta;
@@ -3,17 +3,20 @@
3
3
  //
4
4
 
5
5
  import { type ClassNameValue } from '@dxos/react-ui-types';
6
+ import { FieldValueType } from '@dxos/schema';
6
7
 
7
8
  import { type SheetModel } from './sheet-model';
8
9
  import { type CellAddress, inRange } from '../defs';
9
10
  import { addressToIndex, rangeFromIndex } from '../defs';
10
- import { ValueTypeEnum } from '../types';
11
11
 
12
12
  export type CellFormat = {
13
13
  value?: string;
14
14
  classNames?: ClassNameValue;
15
15
  };
16
16
 
17
+ /**
18
+ * @deprecated See react-ui-data.
19
+ */
17
20
  export class FormattingModel {
18
21
  constructor(private readonly _model: SheetModel) {}
19
22
 
@@ -55,7 +58,7 @@ export class FormattingModel {
55
58
 
56
59
  const type = formatting?.type ?? this._model.getValueType(cell);
57
60
  switch (type) {
58
- case ValueTypeEnum.Boolean: {
61
+ case FieldValueType.Boolean: {
59
62
  return {
60
63
  value: (value as boolean).toLocaleString().toUpperCase(),
61
64
  classNames: [...classNames, value ? '!text-greenText' : '!text-orangeText'],
@@ -66,15 +69,15 @@ export class FormattingModel {
66
69
  // Numbers.
67
70
  //
68
71
 
69
- case ValueTypeEnum.Number: {
72
+ case FieldValueType.Number: {
70
73
  return { value: value.toLocaleString(locales), classNames: [...classNames, defaultNumber] };
71
74
  }
72
75
 
73
- case ValueTypeEnum.Percent: {
76
+ case FieldValueType.Percent: {
74
77
  return { value: (value as number) * 100 + '%', classNames: [...classNames, defaultNumber] };
75
78
  }
76
79
 
77
- case ValueTypeEnum.Currency: {
80
+ case FieldValueType.Currency: {
78
81
  return {
79
82
  value: (value as number).toLocaleString(locales, {
80
83
  style: 'currency',
@@ -90,17 +93,17 @@ export class FormattingModel {
90
93
  // Dates.
91
94
  //
92
95
 
93
- case ValueTypeEnum.DateTime: {
96
+ case FieldValueType.DateTime: {
94
97
  const date = this._model.toLocalDate(value as number);
95
98
  return { value: date.toLocaleString(locales), classNames };
96
99
  }
97
100
 
98
- case ValueTypeEnum.Date: {
101
+ case FieldValueType.Date: {
99
102
  const date = this._model.toLocalDate(value as number);
100
103
  return { value: date.toLocaleDateString(locales), classNames };
101
104
  }
102
105
 
103
- case ValueTypeEnum.Time: {
106
+ case FieldValueType.Time: {
104
107
  const date = this._model.toLocalDate(value as number);
105
108
  return { value: date.toLocaleTimeString(locales), classNames };
106
109
  }
@@ -8,12 +8,10 @@ import { Trigger } from '@dxos/async';
8
8
  import { FunctionType } from '@dxos/plugin-script/types';
9
9
 
10
10
  import { SheetModel } from './sheet-model';
11
- import { createSheet, addressFromA1Notation } from '../defs';
11
+ import { addressFromA1Notation, createSheet } from '../defs';
12
12
  import { TestBuilder, testFunctionPlugins } from '../graph/testing';
13
13
  import { type CellScalarValue } from '../types';
14
14
 
15
- // TODO(burdon): GPT("prompt", inputs); e.g., with large text cells.
16
-
17
15
  describe('SheetModel', () => {
18
16
  let testBuilder: TestBuilder;
19
17
  beforeEach(async () => {
@@ -12,6 +12,7 @@ import { getTypename } from '@dxos/echo-schema';
12
12
  import { invariant } from '@dxos/invariant';
13
13
  import { PublicKey } from '@dxos/keys';
14
14
  import { log } from '@dxos/log';
15
+ import { FieldValueType } from '@dxos/schema';
15
16
 
16
17
  import { DetailedCellError, ExportedCellChange } from '#hyperformula';
17
18
  import {
@@ -24,16 +25,17 @@ import {
24
25
  } from '../defs';
25
26
  import { addressFromIndex, addressToIndex, initialize, insertIndices, ReadonlyException } from '../defs';
26
27
  import { type ComputeNode, type ComputeGraph, createSheetName, type ComputeNodeEvent } from '../graph';
27
- import { type CellScalarValue, type CellValue, type SheetType, ValueTypeEnum } from '../types';
28
-
29
- const typeMap: Record<string, ValueTypeEnum> = {
30
- BOOLEAN: ValueTypeEnum.Boolean,
31
- NUMBER_RAW: ValueTypeEnum.Number,
32
- NUMBER_PERCENT: ValueTypeEnum.Percent,
33
- NUMBER_CURRENCY: ValueTypeEnum.Currency,
34
- NUMBER_DATETIME: ValueTypeEnum.DateTime,
35
- NUMBER_DATE: ValueTypeEnum.Date,
36
- NUMBER_TIME: ValueTypeEnum.Time,
28
+ import { type CellScalarValue, type CellValue, type SheetType } from '../types';
29
+
30
+ // Map sheet types to system types.
31
+ const typeMap: Record<string, FieldValueType> = {
32
+ BOOLEAN: FieldValueType.Boolean,
33
+ NUMBER_RAW: FieldValueType.Number,
34
+ NUMBER_PERCENT: FieldValueType.Percent,
35
+ NUMBER_CURRENCY: FieldValueType.Currency,
36
+ NUMBER_DATETIME: FieldValueType.DateTime,
37
+ NUMBER_DATE: FieldValueType.Date,
38
+ NUMBER_TIME: FieldValueType.Time,
37
39
  };
38
40
 
39
41
  const getTopLeft = (range: CellRange): CellAddress => {
@@ -269,7 +271,7 @@ export class SheetModel extends Resource {
269
271
  /**
270
272
  * Get value type.
271
273
  */
272
- getValueType(cell: CellAddress): ValueTypeEnum {
274
+ getValueType(cell: CellAddress): FieldValueType {
273
275
  invariant(this._node);
274
276
  const addr = toSimpleCellAddress(this._node.sheetId, cell);
275
277
  const type = this._node.graph.hf.getCellValueDetailedType(addr);
package/src/types.ts CHANGED
@@ -15,6 +15,7 @@ import { type MarkdownExtensionProvides } from '@dxos/plugin-markdown';
15
15
  import { type SpaceInitProvides } from '@dxos/plugin-space';
16
16
  import { ThreadType } from '@dxos/plugin-space/types';
17
17
  import { type StackProvides } from '@dxos/plugin-stack';
18
+ import { FieldValueType } from '@dxos/schema';
18
19
 
19
20
  import { SHEET_PLUGIN } from './meta';
20
21
 
@@ -51,41 +52,14 @@ export const CellValue = S.Struct({
51
52
  // TODO(burdon): How to store dates (datetime, date, time), percentages, etc.
52
53
  // Consider import/export; natural access for other plugins. Special handling for currency (precision).
53
54
  // TODO(burdon): Automerge (long string) or short string or number.
54
- // TODO(burdon): Arrays?
55
55
  value: S.Any,
56
56
  });
57
57
 
58
58
  export type CellValue = S.Schema.Type<typeof CellValue>;
59
59
 
60
- /**
61
- * https://www.tutorialsteacher.com/typescript/typescript-number
62
- */
63
- // TODO(burdon): Format vs. value.
64
- export enum ValueTypeEnum {
65
- Null = 0,
66
- Number = 1,
67
- Boolean = 2,
68
- String = 3,
69
-
70
- // Special numbers.
71
- Percent = 10,
72
- Currency = 11,
73
-
74
- // Dates.
75
- DateTime = 20,
76
- Date = 21,
77
- Time = 22,
78
-
79
- // Validated string types.
80
- // TODO(burdon): Define effect types.
81
- URL = 30,
82
- DID = 31,
83
- }
84
-
85
- export const ValueType = S.Enums(ValueTypeEnum);
86
-
60
+ // TODO(burdon): IMPORTANT: Reconcile with Field definition.
87
61
  export const Formatting = S.Struct({
88
- type: S.optional(ValueType),
62
+ type: S.optional(S.Enums(FieldValueType)),
89
63
  format: S.optional(S.String),
90
64
  precision: S.optional(S.Number),
91
65
  classNames: S.optional(S.Array(S.String)),
@@ -99,13 +73,11 @@ export const RowColumnMeta = S.Struct({
99
73
  });
100
74
 
101
75
  // TODO(burdon): Index to all updates when rows/columns are inserted/deleted.
102
- // TODO(wittjosiah): Migrate typename to remove `Type` suffix.
103
- // TODO(wittjosiah): Rename title to name to align with other schemas.
104
76
  export class SheetType extends TypedObject({ typename: 'dxos.org/type/SheetType', version: '0.1.0' })({
105
77
  name: S.optional(S.String),
106
78
 
107
79
  // Sparse map of cells referenced by index.
108
- cells: S.mutable(S.Record(S.String, S.mutable(CellValue))),
80
+ cells: S.mutable(S.Record({ key: S.String, value: S.mutable(CellValue) })),
109
81
 
110
82
  // Ordered row indices.
111
83
  rows: S.mutable(S.Array(S.String)),
@@ -114,13 +86,14 @@ export class SheetType extends TypedObject({ typename: 'dxos.org/type/SheetType'
114
86
  columns: S.mutable(S.Array(S.String)),
115
87
 
116
88
  // Row metadata referenced by index.
117
- rowMeta: S.mutable(S.Record(S.String, S.mutable(RowColumnMeta))),
89
+ rowMeta: S.mutable(S.Record({ key: S.String, value: S.mutable(RowColumnMeta) })),
118
90
 
119
91
  // Column metadata referenced by index.
120
- columnMeta: S.mutable(S.Record(S.String, S.mutable(RowColumnMeta))),
92
+ columnMeta: S.mutable(S.Record({ key: S.String, value: S.mutable(RowColumnMeta) })),
121
93
 
94
+ // TODO(burdon): Change to array.
122
95
  // Cell formatting referenced by indexed range.
123
- formatting: S.mutable(S.Record(S.String, S.mutable(Formatting))),
96
+ formatting: S.mutable(S.Record({ key: S.String, value: S.mutable(Formatting) })),
124
97
 
125
98
  // Threads associated with the sheet
126
99
  threads: S.optional(S.mutable(S.Array(ref(ThreadType)))),