@dxos/react-ui-table 0.7.4 → 0.7.5-labs.a279d8c

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 (116) hide show
  1. package/dist/lib/browser/{chunk-IYCSJDMB.mjs → chunk-3FR6NHPD.mjs} +7 -5
  2. package/dist/lib/browser/chunk-3FR6NHPD.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1405 -1067
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/types/index.mjs +1 -1
  7. package/dist/lib/node/{chunk-MHBMVCFZ.cjs → chunk-NB3SFHGA.cjs} +9 -7
  8. package/dist/lib/node/chunk-NB3SFHGA.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +1409 -1051
  10. package/dist/lib/node/index.cjs.map +4 -4
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/types/index.cjs +3 -3
  13. package/dist/lib/node/types/index.cjs.map +1 -1
  14. package/dist/lib/node-esm/{chunk-BMWGPXPL.mjs → chunk-RLVVOZW5.mjs} +7 -5
  15. package/dist/lib/node-esm/chunk-RLVVOZW5.mjs.map +7 -0
  16. package/dist/lib/node-esm/index.mjs +1405 -1067
  17. package/dist/lib/node-esm/index.mjs.map +4 -4
  18. package/dist/lib/node-esm/meta.json +1 -1
  19. package/dist/lib/node-esm/types/index.mjs +1 -1
  20. package/dist/types/src/_deprecated/hooks/useColumnSorting.d.ts +1 -1
  21. package/dist/types/src/components/Table/ColumnActionsMenu.d.ts +4 -3
  22. package/dist/types/src/components/Table/ColumnActionsMenu.d.ts.map +1 -1
  23. package/dist/types/src/components/Table/ColumnSettings.d.ts +3 -2
  24. package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
  25. package/dist/types/src/components/Table/CreateRefPanel.d.ts +3 -2
  26. package/dist/types/src/components/Table/CreateRefPanel.d.ts.map +1 -1
  27. package/dist/types/src/components/Table/RefPanel.d.ts +4 -3
  28. package/dist/types/src/components/Table/RefPanel.d.ts.map +1 -1
  29. package/dist/types/src/components/Table/RowActionsMenu.d.ts +3 -2
  30. package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
  31. package/dist/types/src/components/Table/Table.d.ts +2 -1
  32. package/dist/types/src/components/Table/Table.d.ts.map +1 -1
  33. package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
  34. package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts +3 -2
  35. package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
  36. package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts.map +1 -1
  37. package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +18 -0
  38. package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -0
  39. package/dist/types/src/components/TableToolbar/index.d.ts +2 -0
  40. package/dist/types/src/components/TableToolbar/index.d.ts.map +1 -0
  41. package/dist/types/src/components/index.d.ts +1 -1
  42. package/dist/types/src/components/index.d.ts.map +1 -1
  43. package/dist/types/src/components/testing.d.ts +31 -71
  44. package/dist/types/src/components/testing.d.ts.map +1 -1
  45. package/dist/types/src/index.d.ts +1 -0
  46. package/dist/types/src/index.d.ts.map +1 -1
  47. package/dist/types/src/model/index.d.ts +1 -0
  48. package/dist/types/src/model/index.d.ts.map +1 -1
  49. package/dist/types/src/model/modal-controller.d.ts +6 -2
  50. package/dist/types/src/model/modal-controller.d.ts.map +1 -1
  51. package/dist/types/src/model/selection-model.d.ts.map +1 -1
  52. package/dist/types/src/model/table-model.d.ts +19 -31
  53. package/dist/types/src/model/table-model.d.ts.map +1 -1
  54. package/dist/types/src/model/table-presentation.d.ts +22 -0
  55. package/dist/types/src/model/table-presentation.d.ts.map +1 -0
  56. package/dist/types/src/model/table-presentation.test.d.ts +2 -0
  57. package/dist/types/src/model/table-presentation.test.d.ts.map +1 -0
  58. package/dist/types/src/model/table-sorting.d.ts +53 -0
  59. package/dist/types/src/model/table-sorting.d.ts.map +1 -0
  60. package/dist/types/src/playwright/TableManager.d.ts +2 -1
  61. package/dist/types/src/playwright/TableManager.d.ts.map +1 -1
  62. package/dist/types/src/translations.d.ts +2 -1
  63. package/dist/types/src/translations.d.ts.map +1 -1
  64. package/dist/types/src/types/table.d.ts +46 -154
  65. package/dist/types/src/types/table.d.ts.map +1 -1
  66. package/dist/types/src/util/index.d.ts +1 -0
  67. package/dist/types/src/util/index.d.ts.map +1 -1
  68. package/dist/types/src/util/table-buttons.d.ts +63 -19
  69. package/dist/types/src/util/table-buttons.d.ts.map +1 -1
  70. package/dist/types/src/util/table-controls.d.ts +32 -9
  71. package/dist/types/src/util/table-controls.d.ts.map +1 -1
  72. package/dist/types/src/util/table.d.ts +3 -2
  73. package/dist/types/src/util/table.d.ts.map +1 -1
  74. package/dist/types/tsconfig.tsbuildinfo +1 -0
  75. package/package.json +30 -29
  76. package/src/components/Table/ColumnActionsMenu.tsx +12 -12
  77. package/src/components/Table/ColumnSettings.tsx +11 -11
  78. package/src/components/Table/CreateRefPanel.tsx +13 -14
  79. package/src/components/Table/RefPanel.tsx +9 -9
  80. package/src/components/Table/RowActionsMenu.tsx +6 -7
  81. package/src/components/Table/Table.stories.tsx +67 -38
  82. package/src/components/Table/Table.tsx +239 -148
  83. package/src/components/TableCellEditor/TableCellEditor.stories.tsx +13 -12
  84. package/src/components/TableCellEditor/TableCellEditor.tsx +6 -4
  85. package/src/components/TableToolbar/TableToolbar.tsx +72 -0
  86. package/src/components/{Toolbar → TableToolbar}/index.ts +1 -1
  87. package/src/components/index.ts +1 -1
  88. package/src/components/testing.ts +10 -8
  89. package/src/index.ts +2 -0
  90. package/src/model/index.ts +1 -0
  91. package/src/model/modal-controller.ts +15 -48
  92. package/src/model/selection-model.ts +12 -1
  93. package/src/model/table-model.test.ts +4 -76
  94. package/src/model/table-model.ts +73 -304
  95. package/src/model/table-presentation.test.ts +102 -0
  96. package/src/model/table-presentation.ts +223 -0
  97. package/src/model/table-sorting.ts +201 -0
  98. package/src/playwright/TableManager.ts +5 -1
  99. package/src/playwright/smoke.spec.ts +94 -9
  100. package/src/translations.ts +2 -1
  101. package/src/types/table.ts +4 -4
  102. package/src/util/index.ts +1 -0
  103. package/src/util/table-buttons.ts +127 -48
  104. package/src/util/table-controls.ts +71 -7
  105. package/src/util/table.ts +93 -52
  106. package/dist/lib/browser/chunk-IYCSJDMB.mjs.map +0 -7
  107. package/dist/lib/node/chunk-MHBMVCFZ.cjs.map +0 -7
  108. package/dist/lib/node-esm/chunk-BMWGPXPL.mjs.map +0 -7
  109. package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -21
  110. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
  111. package/dist/types/src/components/Toolbar/common.d.ts +0 -14
  112. package/dist/types/src/components/Toolbar/common.d.ts.map +0 -1
  113. package/dist/types/src/components/Toolbar/index.d.ts +0 -2
  114. package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
  115. package/src/components/Toolbar/Toolbar.tsx +0 -87
  116. package/src/components/Toolbar/common.tsx +0 -71
@@ -1,87 +1,47 @@
1
1
  import { S } from '@dxos/echo-schema';
2
2
  import { TableType } from '../types';
3
- export declare const TestSchema: import("@dxos/echo-schema").AbstractTypedObject<{
4
- name?: string | undefined;
5
- id: string;
6
- active?: boolean | undefined;
7
- age?: number | undefined;
8
- netWorth?: number | undefined;
9
- } & {
10
- id: string;
11
- }, S.Struct.Encoded<{
3
+ export declare const TestSchema: import("@dxos/echo-schema").TypedObjectPrototype<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
4
+ id: typeof S.String;
5
+ name: S.optional<typeof S.String>;
6
+ age: S.optional<typeof S.Number>;
7
+ active: S.optional<typeof S.Boolean>;
8
+ netWorth: S.optional<typeof S.Number>;
9
+ }, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>, S.Struct.Encoded<{
12
10
  id: typeof S.String;
13
11
  name: S.optional<typeof S.String>;
14
12
  age: S.optional<typeof S.Number>;
15
13
  active: S.optional<typeof S.Boolean>;
16
14
  netWorth: S.optional<typeof S.Number>;
17
15
  }>>;
18
- export declare const createTable: (schema?: import("@dxos/echo-schema").AbstractTypedObject<{
19
- name?: string | undefined;
20
- id: string;
21
- active?: boolean | undefined;
22
- age?: number | undefined;
23
- netWorth?: number | undefined;
24
- } & {
25
- id: string;
26
- }, S.Struct.Encoded<{
16
+ export declare const createTable: (schema?: import("@dxos/echo-schema").TypedObjectPrototype<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
17
+ id: typeof S.String;
18
+ name: S.optional<typeof S.String>;
19
+ age: S.optional<typeof S.Number>;
20
+ active: S.optional<typeof S.Boolean>;
21
+ netWorth: S.optional<typeof S.Number>;
22
+ }, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>, S.Struct.Encoded<{
27
23
  id: typeof S.String;
28
24
  name: S.optional<typeof S.String>;
29
25
  age: S.optional<typeof S.Number>;
30
26
  active: S.optional<typeof S.Boolean>;
31
27
  netWorth: S.optional<typeof S.Number>;
32
- }>>) => import("@dxos/react-client/echo").ReactiveObject<{
33
- name?: string | undefined;
34
- id: string;
35
- view?: import("@dxos/echo-schema").Ref<{
36
- name: string;
37
- schema?: import("@dxos/echo-schema").JsonSchemaType | undefined;
38
- query: import("@dxos/echo-schema").QueryType;
39
- fields: {
40
- referencePath?: import("@dxos/echo-schema").JsonPath | undefined;
41
- id: string;
42
- path: import("@dxos/echo-schema").JsonPath;
43
- visible?: boolean | undefined;
44
- size?: number | undefined;
45
- }[];
46
- } & {
47
- id: string;
48
- }>;
49
- threads?: readonly import("@dxos/echo-schema").Ref<{
50
- name?: string | undefined;
51
- anchor?: string | undefined;
52
- status?: "active" | "staged" | "resolved" | undefined;
53
- messages: import("@dxos/echo-schema").Ref<{
54
- text: string;
55
- timestamp: string;
56
- state?: import("packages/plugins/plugin-space/dist/types/src").MessageState | undefined;
57
- sender: {
58
- name?: string | undefined;
59
- contact?: import("@dxos/echo-schema").Ref<{
60
- name?: string | undefined;
61
- identifiers: {
62
- readonly value: string;
63
- readonly type: string;
64
- }[];
65
- } & {
66
- id: string;
67
- }>;
68
- identityKey?: string | undefined;
69
- email?: string | undefined;
70
- };
71
- parts?: import("@dxos/echo-schema").Ref<import("@dxos/echo-schema").Expando>[] | undefined;
72
- properties?: {
73
- [x: string]: any;
74
- } | undefined;
75
- context?: import("@dxos/echo-schema").Ref<import("@dxos/echo-schema").Expando>;
76
- } & {
77
- id: string;
78
- }>[];
79
- } & {
80
- id: string;
81
- }>[] | undefined;
82
- } & {
83
- id: string;
84
- }>;
28
+ }>>) => import("@dxos/react-client/echo").ReactiveObject<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
29
+ readonly id: import("@dxos/echo-schema").ObjectIdClass;
30
+ readonly name: S.optional<typeof S.String>;
31
+ readonly view: S.optional<import("@dxos/echo-schema").Ref$<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
32
+ name: S.SchemaClass<string, string, never>;
33
+ query: S.Schema<import("@dxos/echo-schema").QueryType, import("@dxos/echo-schema").QueryType, never>;
34
+ schema: S.optional<S.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
35
+ fields: S.mutable<S.Array$<S.mutable<S.Struct<{
36
+ id: typeof S.String;
37
+ path: S.Schema<import("@dxos/echo-schema").JsonPath, import("@dxos/echo-schema").JsonPath, never>;
38
+ visible: S.optional<typeof S.Boolean>;
39
+ size: S.optional<typeof S.Number>;
40
+ referencePath: S.optional<S.Schema<import("@dxos/echo-schema").JsonPath, import("@dxos/echo-schema").JsonPath, never>>;
41
+ }>>>>;
42
+ }, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>>>;
43
+ readonly threads: S.optional<S.Array$<import("@dxos/echo-schema").Ref$<import("@dxos/echo-schema").Expando>>>;
44
+ }, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>>;
85
45
  export declare const createItems: (n: number) => {
86
46
  name: string;
87
47
  age: number;
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../src/components/testing.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0B,CAAC,EAAqC,MAAM,mBAAmB,CAAC;AAMjG,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;GAMrB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;yBAEpB,CAAH;;;mBAGO,CAAC;gBACL,CAAC;;;;;;;;;;;;iBAuFwa,CAAC;;oBAA8D,CAAC;uBAAyC,CAAC;wBAAwD,CAAC;;;;;;;;2BAAsP,CAAC;qBAAuC,CAAC;;iBAA8C,CAAC;sBAA4E,CAAC;;;mBAAwE,CAAC;;;;;;;;;EArFnjC,CAAC;AAEF,eAAO,MAAM,WAAW,MAAO,MAAM;;;;;GAWpC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,YAAY,qDAAsD,cAAc,SA8D5F,CAAC"}
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../src/components/testing.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0B,CAAC,EAAqC,MAAM,mBAAmB,CAAC;AAMjG,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,eAAO,MAAM,UAAU;;;;;;;;;;;;GAMrB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;cAEP,EACX,WAAM;eAW2B,EAAG,MACvC;gBAGG,EAAG,QAAQ,CAAC,EAAE,MAAM;gBAWrB,EAAG,OAAO,CAAC,EAAG,MAAK,CAAC,EACzB,OAEG,CAAC,EAAG,MAAK;uBAAqB,EAAG,MAAM;kBAAe,EAAI,MAAK;qBACvD,EAAI,QACb,QAAO,EAAG,OAAO;kBACX,EAAG,QACN,QAEA,EAAG,MAAM;2BACR,EAAE,QAAQ,CAAC,EAAE,MAAM;;;;6FA7BxB,CAAC;AAEF,eAAO,MAAM,WAAW,MAAO,MAAM;;;;;GAWpC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,YAAY,qDAAsD,cAAc,SA8D5F,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import translations from './translations';
2
2
  export * from './components';
3
3
  export * from './hooks';
4
+ export * from './model';
4
5
  export * from './types';
5
6
  export * from './util';
6
7
  export { translations };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './table-model';
2
2
  export * from './modal-controller';
3
+ export * from './table-presentation';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/model/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/model/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type RefObject, type MouseEvent } from 'react';
1
+ import { type RefObject } from 'react';
2
2
  import { type ReactiveObject } from '@dxos/live-object';
3
3
  export type ColumnSettingsMode = {
4
4
  type: 'create';
@@ -32,7 +32,11 @@ export declare class ModalController {
32
32
  private readonly _triggerRef;
33
33
  get state(): import("@preact/signals-core").Signal<ModalState>;
34
34
  get trigger(): RefObject<HTMLButtonElement>;
35
- handleClick: (event: MouseEvent) => boolean;
35
+ setTrigger: (trigger: HTMLElement) => void;
36
+ showRowMenu: (rowIndex: number) => void;
37
+ showColumnMenu: (fieldId: string) => void;
38
+ showColumnCreator: () => void;
39
+ showReferencePanel: (targetId: string, schemaId: string) => void;
36
40
  openColumnSettings: () => void;
37
41
  openCreateRef: (typename: string, anchorCell: Element | null, initialValues?: Record<string, string>, onCreate?: (obj: ReactiveObject<any>) => void) => void;
38
42
  close: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"modal-controller.d.ts","sourceRoot":"","sources":["../../../../src/model/modal-controller.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAyB,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKxD,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IA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,YAAY,SAAU,KAAK,GAAG,MAAM,KAAG,IAAI,CAEhD;CACH"}
1
+ {"version":3,"file":"selection-model.d.ts","sourceRoot":"","sources":["../../../../src/model/selection-model.ts"],"names":[],"mappings":"AAIA,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAErF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,qBAAa,cAAc,CAAC,CAAC,SAAS,YAAY,CAAE,SAAQ,QAAQ;IAyBhE,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAzBvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAE7D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAQ/B;IAEH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAkE;IAEhG,OAAO,CAAC,QAAQ,CAAC,YAAY,CAO1B;gBAGgB,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,EAC1B,mBAAmB,CAAC,GAAE,MAAM,IAAI,aAAA;cAK1B,KAAK;IAY9B,IAAW,SAAS,IAAI,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAElD;IAED,IAAW,YAAY,IAAI,cAAc,CAAC,OAAO,CAAC,CAEjD;IAED,IAAW,cAAc,IAAI,cAAc,CAAC,OAAO,CAAC,CAEnD;IAEM,eAAe,QAAO,CAAC,EAAE,CAG9B;IAEK,kBAAkB,aAAc,MAAM,KAAG,OAAO,CAGrD;IAEK,gBAAgB,WAAY,CAAC,KAAG,OAAO,CAE5C;IAMK,0BAA0B,aAAc,MAAM,KAAG,IAAI,CAW1D;IAEK,YAAY,SAAU,KAAK,GAAG,MAAM,KAAG,IAAI,CAWhD;CACH"}
@@ -1,16 +1,11 @@
1
1
  import { type ReadonlySignal } from '@preact/signals-core';
2
2
  import { Resource } from '@dxos/context';
3
- import { type JsonProp } from '@dxos/echo-schema';
4
- import { type DxGridAxisMeta, type DxGridPlane, type DxGridPlaneCells, type DxGridPlaneRange, type DxGridPlanePosition, type DxGridPosition } from '@dxos/react-ui-grid';
3
+ import { type FieldSortType, type JsonProp } from '@dxos/echo-schema';
4
+ import { type DxGridAxisMeta, type DxGridPlanePosition, type DxGridPosition } from '@dxos/react-ui-grid';
5
5
  import { type ViewProjection } from '@dxos/schema';
6
- import { ModalController } from './modal-controller';
7
6
  import { SelectionModel } from './selection-model';
7
+ import { TableSorting } from './table-sorting';
8
8
  import { type TableType } from '../types';
9
- export type SortDirection = 'asc' | 'desc';
10
- export type SortConfig = {
11
- fieldId: string;
12
- direction: SortDirection;
13
- };
14
9
  export type BaseTableRow = Record<JsonProp, any> & {
15
10
  id: string;
16
11
  };
@@ -19,7 +14,7 @@ export type TableModelProps<T extends BaseTableRow = {
19
14
  }> = {
20
15
  table: TableType;
21
16
  projection: ViewProjection;
22
- sorting?: SortConfig[];
17
+ sorting?: FieldSortType[];
23
18
  pinnedRows?: {
24
19
  top: number[];
25
20
  bottom: number[];
@@ -37,43 +32,32 @@ export declare class TableModel<T extends BaseTableRow = {
37
32
  private readonly _table;
38
33
  private readonly _projection;
39
34
  private readonly _visibleRange;
40
- /**
41
- * Maps display indices to data indices.
42
- * Used for translating between sorted/displayed order and original data order.
43
- * Keys are display indices, values are corresponding data indices.
44
- */
45
- private readonly _displayToDataIndex;
46
35
  private readonly _onInsertRow?;
47
36
  private readonly _onDeleteRows?;
48
37
  private readonly _onDeleteColumn?;
49
38
  private readonly _onCellUpdate?;
50
39
  private readonly _onRowOrderChanged?;
40
+ private readonly _rows;
51
41
  private readonly _sorting;
52
- private _sortedRows;
53
- private _rows;
54
42
  private _pinnedRows;
55
43
  private _selection;
56
44
  private _columnMeta?;
57
- private readonly _modalController;
58
45
  constructor({ table, projection, sorting, pinnedRows, onCellUpdate, onDeleteColumn, onDeleteRows, onInsertRow, onRowOrderChanged, }: TableModelProps<T>);
59
46
  get table(): TableType;
60
47
  get projection(): ViewProjection;
48
+ get rows(): ReadonlySignal<T[]>;
49
+ /**
50
+ * @reactive
51
+ */
52
+ get sorting(): TableSorting<T> | undefined;
61
53
  get pinnedRows(): NonNullable<TableModelProps<T>['pinnedRows']>;
62
54
  get columnMeta(): ReadonlySignal<DxGridAxisMeta>;
63
- get sorting(): SortConfig | undefined;
64
- get modalController(): ModalController;
65
55
  get selection(): SelectionModel<T>;
56
+ /** @reactive */
57
+ get isViewDirty(): boolean;
66
58
  protected _open(): Promise<void>;
67
59
  private initializeColumnMeta;
68
- private initializeSorting;
69
60
  private initializeEffects;
70
- getCells: (range: DxGridPlaneRange, plane: DxGridPlane) => DxGridPlaneCells;
71
- private getMainGridCells;
72
- private getHeaderCells;
73
- private getSelectionColumnCells;
74
- private getActionColumnCells;
75
- private getSelectAllCell;
76
- private getNewColumnCell;
77
61
  setRows: (obj: T[]) => void;
78
62
  getRowCount: () => number;
79
63
  getColumnCount: () => number;
@@ -81,12 +65,16 @@ export declare class TableModel<T extends BaseTableRow = {
81
65
  deleteRow: (rowIndex: number) => void;
82
66
  getCellData: ({ col, row }: DxGridPlanePosition) => any;
83
67
  setCellData: ({ col, row }: DxGridPlanePosition, value: any) => void;
68
+ /**
69
+ * Updates a cell's value using a transform function.
70
+ * @param {DxGridPlanePosition} position - The position of the cell to update.
71
+ * @param {(value: any) => any} update - A function that takes the current value and returns the updated value.
72
+ */
73
+ updateCellData({ col, row }: DxGridPlanePosition, update: (value: any) => any): void;
84
74
  deleteColumn(fieldId: string): void;
85
- handleGridClick: (event: React.MouseEvent) => void;
86
75
  setColumnWidth(columnIndex: number, width: number): void;
87
- setSort(fieldId: string, direction: SortDirection): void;
88
- clearSort(): void;
89
76
  pinRow(rowIndex: number, side: 'top' | 'bottom'): void;
90
77
  unpinRow(rowIndex: number): void;
78
+ saveView(): void;
91
79
  }
92
80
  //# sourceMappingURL=table-model.d.ts.map
@@ -1 +1 @@
1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,0 +1,22 @@
1
+ import { type DxGridPlane, type DxGridPlaneCells, type DxGridPlaneRange } from '@dxos/react-ui-grid';
2
+ import { type BaseTableRow, type TableModel } from './table-model';
3
+ /**
4
+ * Presentation layer for a table component, handling cell rendering and grid display logic.
5
+ * Manages rendering of table cells, headers, selection columns, and action columns across
6
+ * different grid planes.
7
+ */
8
+ export declare class TablePresentation<T extends BaseTableRow = {
9
+ id: string;
10
+ }> {
11
+ private readonly model;
12
+ private readonly _visibleRange;
13
+ constructor(model: TableModel<T>, _visibleRange?: import("@preact/signals-core").Signal<DxGridPlaneRange>);
14
+ getCells(range: DxGridPlaneRange, plane: DxGridPlane): DxGridPlaneCells;
15
+ private getMainGridCells;
16
+ private getHeaderCells;
17
+ private getSelectionColumnCells;
18
+ private getActionColumnCells;
19
+ private getSelectAllCell;
20
+ private getNewColumnCell;
21
+ }
22
+ //# sourceMappingURL=table-presentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-presentation.d.ts","sourceRoot":"","sources":["../../../../src/model/table-presentation.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EAErB,KAAK,gBAAgB,EAEtB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAGnE;;;;GAIG;AACH,qBAAa,iBAAiB,CAAC,CAAC,SAAS,YAAY,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE;IAElE,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBADb,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,aAAa,0DAG5B;IAGG,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,WAAW,GAAG,gBAAgB;IAoB9E,OAAO,CAAC,gBAAgB;IAoFxB,OAAO,CAAC,cAAc;IAwBtB,OAAO,CAAC,uBAAuB;IAgB/B,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,gBAAgB;CAYzB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=table-presentation.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-presentation.test.d.ts","sourceRoot":"","sources":["../../../../src/model/table-presentation.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,53 @@
1
+ import { type Signal, type ReadonlySignal } from '@preact/signals-core';
2
+ import { type SortDirectionType, type FieldSortType } from '@dxos/echo-schema';
3
+ import type { ViewProjection, ViewType } from '@dxos/schema';
4
+ import { type BaseTableRow } from './table-model';
5
+ /**
6
+ * Manages table sorting functionality through display and data index mapping.
7
+ *
8
+ * When a table is sorted, rows visually reorder but we need to maintain references
9
+ * to the original data positions. This is handled through two types of indices:
10
+ *
11
+ * - Display indices: The visual positions after sorting
12
+ * - Data indices: The original positions in the source data
13
+ *
14
+ * The _displayToDataIndex map maintains these relationships, enabling lookups
15
+ * between visual and source positions.
16
+ *
17
+ * Example mapping between display and data indices:
18
+ *
19
+ * Original Data: Sorted Display: Mapping: (Display → Data)
20
+ * ┌──────────────┐ ┌──────────────┐ ┌────────┐
21
+ * │ 0: "Banana" │ => │ 0: "Apple" │ => │ 0 => 1 │
22
+ * │ 1: "Apple" │ => │ 1: "Banana" │ => │ 1 => 0 │
23
+ * │ 2: "Cherry" │ => │ 2: "Cherry" │ => │ 2 => 2 │
24
+ * └──────────────┘ └──────────────┘ └────────┘
25
+ */
26
+ export declare class TableSorting<T extends BaseTableRow> {
27
+ private readonly _view;
28
+ private readonly _projection;
29
+ private readonly _displayToDataIndex;
30
+ private readonly _rows;
31
+ private readonly _localSort;
32
+ private readonly _isDirty;
33
+ readonly sortedRows: ReadonlySignal<T[]>;
34
+ constructor(rows: Signal<T[]>, _view: ViewType | undefined, _projection: ViewProjection);
35
+ /**
36
+ * @reactive
37
+ * @returns Local sort if present, falls back to view sort.
38
+ */
39
+ get sorting(): FieldSortType | undefined;
40
+ /**
41
+ * @reactive
42
+ * @returns Whether local sort differs from view sort.
43
+ */
44
+ get isDirty(): boolean;
45
+ getDataIndex(displayIndex: number): number;
46
+ setSort(fieldId: string, direction: SortDirectionType): void;
47
+ toggleSort(fieldId: string): void;
48
+ clearSort(): void;
49
+ save(): void;
50
+ private initialiseSortedRows;
51
+ private getSortValue;
52
+ }
53
+ //# sourceMappingURL=table-sorting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-sorting.d.ts","sourceRoot":"","sources":["../../../../src/model/table-sorting.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,KAAK,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG1F,OAAO,EAAkC,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE/G,OAAO,KAAK,EAA2B,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEtF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAUlD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,YAAY,CAAC,CAAC,SAAS,YAAY;IAS5C,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAT9B,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA6B;IACjE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgC;IAC3D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IACnD,SAAgB,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;gBAG9C,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,EACA,KAAK,EAAE,QAAQ,GAAG,SAAS,EAC3B,WAAW,EAAE,cAAc;IAoB9C;;;OAGG;IACH,IAAW,OAAO,IAAI,aAAa,GAAG,SAAS,CAS9C;IAED;;;OAGG;IACH,IAAW,OAAO,IAAI,OAAO,CAE5B;IAEM,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAI1C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,IAAI;IAO5D,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAiBjC,SAAS,IAAI,IAAI;IAIjB,IAAI,IAAI,IAAI;IAenB,OAAO,CAAC,oBAAoB;IAkC5B,OAAO,CAAC,YAAY;CAwBrB"}
@@ -1,4 +1,4 @@
1
- import { type Page } from '@playwright/test';
1
+ import { type Locator, type Page } from '@playwright/test';
2
2
  import { DxGridManager } from '@dxos/lit-grid/testing';
3
3
  export declare class TableManager {
4
4
  private readonly page;
@@ -8,6 +8,7 @@ export declare class TableManager {
8
8
  deleteColumn(index: number): Promise<void>;
9
9
  deleteRow(index?: number): Promise<void>;
10
10
  toggleSelectAll(): Promise<void>;
11
+ selection(index: number): Locator;
11
12
  sortColumn(index: number, direction: 'ascending' | 'descending'): Promise<void>;
12
13
  addColumn({ label, format }: {
13
14
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"TableManager.d.ts","sourceRoot":"","sources":["../../../../src/playwright/TableManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAevD,qBAAa,YAAY;IAGX,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;gBAET,IAAI,EAAE,IAAI;IAIvC,IAAW,IAAI,IAAI,aAAa,CAE/B;IAEY,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1C,SAAS,CAAC,KAAK,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,GAAG,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/E,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ9F"}
1
+ {"version":3,"file":"TableManager.d.ts","sourceRoot":"","sources":["../../../../src/playwright/TableManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAevD,qBAAa,YAAY;IAGX,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;gBAET,IAAI,EAAE,IAAI;IAIvC,IAAW,IAAI,IAAI,aAAa,CAE/B;IAEY,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1C,SAAS,CAAC,KAAK,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnC,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAItC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAI3B,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,GAAG,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/E,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ9F"}
@@ -10,7 +10,7 @@ declare const _default: readonly [{
10
10
  readonly 'new schema': "New schema";
11
11
  readonly 'continue label': "Continue";
12
12
  readonly 'create stack section label': "Create table";
13
- readonly 'add row': "Add row";
13
+ readonly 'add row label': "Add row";
14
14
  readonly 'create comment': "Create thread";
15
15
  readonly 'column action sort descending': "Sort Descending";
16
16
  readonly 'column action sort ascending': "Sort Ascending";
@@ -22,6 +22,7 @@ declare const _default: readonly [{
22
22
  readonly 'column deleted label': "Column deleted";
23
23
  readonly 'new column button label': "Create column";
24
24
  readonly 'create new object label': "Create new object “{{text}}”";
25
+ readonly 'save view label': "Save changes to view";
25
26
  };
26
27
  };
27
28
  }];
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,wBA2BW"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,wBA4BW"}