@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.
- package/dist/lib/browser/{chunk-IYCSJDMB.mjs → chunk-3FR6NHPD.mjs} +7 -5
- package/dist/lib/browser/chunk-3FR6NHPD.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1405 -1067
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{chunk-MHBMVCFZ.cjs → chunk-NB3SFHGA.cjs} +9 -7
- package/dist/lib/node/chunk-NB3SFHGA.cjs.map +7 -0
- package/dist/lib/node/index.cjs +1409 -1051
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +3 -3
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{chunk-BMWGPXPL.mjs → chunk-RLVVOZW5.mjs} +7 -5
- package/dist/lib/node-esm/chunk-RLVVOZW5.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1405 -1067
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/_deprecated/hooks/useColumnSorting.d.ts +1 -1
- package/dist/types/src/components/Table/ColumnActionsMenu.d.ts +4 -3
- package/dist/types/src/components/Table/ColumnActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/ColumnSettings.d.ts +3 -2
- package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
- package/dist/types/src/components/Table/CreateRefPanel.d.ts +3 -2
- package/dist/types/src/components/Table/CreateRefPanel.d.ts.map +1 -1
- package/dist/types/src/components/Table/RefPanel.d.ts +4 -3
- package/dist/types/src/components/Table/RefPanel.d.ts.map +1 -1
- package/dist/types/src/components/Table/RowActionsMenu.d.ts +3 -2
- package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.d.ts +2 -1
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts +3 -2
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +18 -0
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -0
- package/dist/types/src/components/TableToolbar/index.d.ts +2 -0
- package/dist/types/src/components/TableToolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +31 -71
- package/dist/types/src/components/testing.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/model/index.d.ts +1 -0
- package/dist/types/src/model/index.d.ts.map +1 -1
- package/dist/types/src/model/modal-controller.d.ts +6 -2
- package/dist/types/src/model/modal-controller.d.ts.map +1 -1
- package/dist/types/src/model/selection-model.d.ts.map +1 -1
- package/dist/types/src/model/table-model.d.ts +19 -31
- package/dist/types/src/model/table-model.d.ts.map +1 -1
- package/dist/types/src/model/table-presentation.d.ts +22 -0
- package/dist/types/src/model/table-presentation.d.ts.map +1 -0
- package/dist/types/src/model/table-presentation.test.d.ts +2 -0
- package/dist/types/src/model/table-presentation.test.d.ts.map +1 -0
- package/dist/types/src/model/table-sorting.d.ts +53 -0
- package/dist/types/src/model/table-sorting.d.ts.map +1 -0
- package/dist/types/src/playwright/TableManager.d.ts +2 -1
- package/dist/types/src/playwright/TableManager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +46 -154
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/table-buttons.d.ts +63 -19
- package/dist/types/src/util/table-buttons.d.ts.map +1 -1
- package/dist/types/src/util/table-controls.d.ts +32 -9
- package/dist/types/src/util/table-controls.d.ts.map +1 -1
- package/dist/types/src/util/table.d.ts +3 -2
- package/dist/types/src/util/table.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +30 -29
- package/src/components/Table/ColumnActionsMenu.tsx +12 -12
- package/src/components/Table/ColumnSettings.tsx +11 -11
- package/src/components/Table/CreateRefPanel.tsx +13 -14
- package/src/components/Table/RefPanel.tsx +9 -9
- package/src/components/Table/RowActionsMenu.tsx +6 -7
- package/src/components/Table/Table.stories.tsx +67 -38
- package/src/components/Table/Table.tsx +239 -148
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +13 -12
- package/src/components/TableCellEditor/TableCellEditor.tsx +6 -4
- package/src/components/TableToolbar/TableToolbar.tsx +72 -0
- package/src/components/{Toolbar → TableToolbar}/index.ts +1 -1
- package/src/components/index.ts +1 -1
- package/src/components/testing.ts +10 -8
- package/src/index.ts +2 -0
- package/src/model/index.ts +1 -0
- package/src/model/modal-controller.ts +15 -48
- package/src/model/selection-model.ts +12 -1
- package/src/model/table-model.test.ts +4 -76
- package/src/model/table-model.ts +73 -304
- package/src/model/table-presentation.test.ts +102 -0
- package/src/model/table-presentation.ts +223 -0
- package/src/model/table-sorting.ts +201 -0
- package/src/playwright/TableManager.ts +5 -1
- package/src/playwright/smoke.spec.ts +94 -9
- package/src/translations.ts +2 -1
- package/src/types/table.ts +4 -4
- package/src/util/index.ts +1 -0
- package/src/util/table-buttons.ts +127 -48
- package/src/util/table-controls.ts +71 -7
- package/src/util/table.ts +93 -52
- package/dist/lib/browser/chunk-IYCSJDMB.mjs.map +0 -7
- package/dist/lib/node/chunk-MHBMVCFZ.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-BMWGPXPL.mjs.map +0 -7
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -21
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/common.d.ts +0 -14
- package/dist/types/src/components/Toolbar/common.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/src/components/Toolbar/Toolbar.tsx +0 -87
- package/src/components/Toolbar/common.tsx +0 -71
|
@@ -1,161 +1,53 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S, Expando } from '@dxos/echo-schema';
|
|
2
2
|
export declare const TableSchema: S.Struct<{
|
|
3
|
-
id:
|
|
4
|
-
random(): ObjectId;
|
|
5
|
-
};
|
|
3
|
+
id: import("@dxos/echo-schema").ObjectIdClass;
|
|
6
4
|
name: S.optional<typeof S.String>;
|
|
7
|
-
view: S.optional<
|
|
8
|
-
name: string
|
|
9
|
-
schema
|
|
10
|
-
|
|
11
|
-
fields: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}>>;
|
|
21
|
-
threads: S.optional<S.Array$<ref<{
|
|
22
|
-
name?: string | undefined;
|
|
23
|
-
anchor?: string | undefined;
|
|
24
|
-
status?: "active" | "staged" | "resolved" | undefined;
|
|
25
|
-
messages: import("@dxos/echo-schema").Ref<{
|
|
26
|
-
text: string;
|
|
27
|
-
timestamp: string;
|
|
28
|
-
state?: import("@dxos/plugin-space").MessageState | undefined;
|
|
29
|
-
sender: {
|
|
30
|
-
name?: string | undefined;
|
|
31
|
-
contact?: import("@dxos/echo-schema").Ref<{
|
|
32
|
-
name?: string | undefined;
|
|
33
|
-
identifiers: {
|
|
34
|
-
readonly value: string;
|
|
35
|
-
readonly type: string;
|
|
36
|
-
}[];
|
|
37
|
-
} & {
|
|
38
|
-
id: string;
|
|
39
|
-
}>;
|
|
40
|
-
identityKey?: string | undefined;
|
|
41
|
-
email?: string | undefined;
|
|
42
|
-
};
|
|
43
|
-
parts?: import("@dxos/echo-schema").Ref<import("@dxos/echo-schema").Expando>[] | undefined;
|
|
44
|
-
properties?: {
|
|
45
|
-
[x: string]: any;
|
|
46
|
-
} | undefined;
|
|
47
|
-
context?: import("@dxos/echo-schema").Ref<import("@dxos/echo-schema").Expando>;
|
|
48
|
-
} & {
|
|
49
|
-
id: string;
|
|
50
|
-
}>[];
|
|
51
|
-
} & {
|
|
52
|
-
id: string;
|
|
53
|
-
}>>>;
|
|
5
|
+
view: S.optional<import("@dxos/echo-schema").Ref$<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
|
|
6
|
+
name: S.SchemaClass<string, string, never>;
|
|
7
|
+
query: S.Schema<import("@dxos/echo-schema").QueryType, import("@dxos/echo-schema").QueryType, never>;
|
|
8
|
+
schema: S.optional<S.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
9
|
+
fields: S.mutable<S.Array$<S.mutable<S.Struct<{
|
|
10
|
+
id: typeof S.String;
|
|
11
|
+
path: S.Schema<import("@dxos/echo-schema").JsonPath, import("@dxos/echo-schema").JsonPath, never>;
|
|
12
|
+
visible: S.optional<typeof S.Boolean>;
|
|
13
|
+
size: S.optional<typeof S.Number>;
|
|
14
|
+
referencePath: S.optional<S.Schema<import("@dxos/echo-schema").JsonPath, import("@dxos/echo-schema").JsonPath, never>>;
|
|
15
|
+
}>>>>;
|
|
16
|
+
}, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>>>;
|
|
17
|
+
threads: S.optional<S.Array$<import("@dxos/echo-schema").Ref$<Expando>>>;
|
|
54
18
|
}>;
|
|
55
|
-
declare const TableType_base: import("@dxos/echo-schema").
|
|
56
|
-
|
|
57
|
-
id: string;
|
|
58
|
-
view?: import("@dxos/echo-schema").Ref<{
|
|
59
|
-
name: string;
|
|
60
|
-
schema?: import("@dxos/echo-schema").JsonSchemaType | undefined;
|
|
61
|
-
query: import("@dxos/echo-schema").QueryType;
|
|
62
|
-
fields: {
|
|
63
|
-
referencePath?: import("@dxos/echo-schema").JsonPath | undefined;
|
|
64
|
-
id: string;
|
|
65
|
-
path: import("@dxos/echo-schema").JsonPath;
|
|
66
|
-
visible?: boolean | undefined;
|
|
67
|
-
size?: number | undefined;
|
|
68
|
-
}[];
|
|
69
|
-
} & {
|
|
70
|
-
id: string;
|
|
71
|
-
}>;
|
|
72
|
-
threads?: readonly import("@dxos/echo-schema").Ref<{
|
|
73
|
-
name?: string | undefined;
|
|
74
|
-
anchor?: string | undefined;
|
|
75
|
-
status?: "active" | "staged" | "resolved" | undefined;
|
|
76
|
-
messages: import("@dxos/echo-schema").Ref<{
|
|
77
|
-
text: string;
|
|
78
|
-
timestamp: string;
|
|
79
|
-
state?: import("@dxos/plugin-space").MessageState | undefined;
|
|
80
|
-
sender: {
|
|
81
|
-
name?: string | undefined;
|
|
82
|
-
contact?: import("@dxos/echo-schema").Ref<{
|
|
83
|
-
name?: string | undefined;
|
|
84
|
-
identifiers: {
|
|
85
|
-
readonly value: string;
|
|
86
|
-
readonly type: string;
|
|
87
|
-
}[];
|
|
88
|
-
} & {
|
|
89
|
-
id: string;
|
|
90
|
-
}>;
|
|
91
|
-
identityKey?: string | undefined;
|
|
92
|
-
email?: string | undefined;
|
|
93
|
-
};
|
|
94
|
-
parts?: import("@dxos/echo-schema").Ref<import("@dxos/echo-schema").Expando>[] | undefined;
|
|
95
|
-
properties?: {
|
|
96
|
-
[x: string]: any;
|
|
97
|
-
} | undefined;
|
|
98
|
-
context?: import("@dxos/echo-schema").Ref<import("@dxos/echo-schema").Expando>;
|
|
99
|
-
} & {
|
|
100
|
-
id: string;
|
|
101
|
-
}>[];
|
|
102
|
-
} & {
|
|
103
|
-
id: string;
|
|
104
|
-
}>[] | undefined;
|
|
105
|
-
} & {
|
|
106
|
-
id: string;
|
|
107
|
-
}, S.Struct.Encoded<{
|
|
108
|
-
readonly id: S.SchemaClass<string, string, never> & {
|
|
109
|
-
random(): ObjectId;
|
|
110
|
-
};
|
|
19
|
+
declare const TableType_base: import("@dxos/echo-schema").TypedObjectPrototype<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
|
|
20
|
+
readonly id: import("@dxos/echo-schema").ObjectIdClass;
|
|
111
21
|
readonly name: S.optional<typeof S.String>;
|
|
112
|
-
readonly view: S.optional<
|
|
113
|
-
name: string
|
|
114
|
-
schema
|
|
115
|
-
|
|
116
|
-
fields: {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
readonly
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}[];
|
|
142
|
-
} & {
|
|
143
|
-
id: string;
|
|
144
|
-
}>;
|
|
145
|
-
identityKey?: string | undefined;
|
|
146
|
-
email?: string | undefined;
|
|
147
|
-
};
|
|
148
|
-
parts?: import("@dxos/echo-schema").Ref<import("@dxos/echo-schema").Expando>[] | undefined;
|
|
149
|
-
properties?: {
|
|
150
|
-
[x: string]: any;
|
|
151
|
-
} | undefined;
|
|
152
|
-
context?: import("@dxos/echo-schema").Ref<import("@dxos/echo-schema").Expando>;
|
|
153
|
-
} & {
|
|
154
|
-
id: string;
|
|
155
|
-
}>[];
|
|
156
|
-
} & {
|
|
157
|
-
id: string;
|
|
158
|
-
}>>>;
|
|
22
|
+
readonly view: S.optional<import("@dxos/echo-schema").Ref$<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
|
|
23
|
+
name: S.SchemaClass<string, string, never>;
|
|
24
|
+
query: S.Schema<import("@dxos/echo-schema").QueryType, import("@dxos/echo-schema").QueryType, never>;
|
|
25
|
+
schema: S.optional<S.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
26
|
+
fields: S.mutable<S.Array$<S.mutable<S.Struct<{
|
|
27
|
+
id: typeof S.String;
|
|
28
|
+
path: S.Schema<import("@dxos/echo-schema").JsonPath, import("@dxos/echo-schema").JsonPath, never>;
|
|
29
|
+
visible: S.optional<typeof S.Boolean>;
|
|
30
|
+
size: S.optional<typeof S.Number>;
|
|
31
|
+
referencePath: S.optional<S.Schema<import("@dxos/echo-schema").JsonPath, import("@dxos/echo-schema").JsonPath, never>>;
|
|
32
|
+
}>>>>;
|
|
33
|
+
}, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>>>;
|
|
34
|
+
readonly threads: S.optional<S.Array$<import("@dxos/echo-schema").Ref$<Expando>>>;
|
|
35
|
+
}, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>, S.Struct.Encoded<{
|
|
36
|
+
readonly id: import("@dxos/echo-schema").ObjectIdClass;
|
|
37
|
+
readonly name: S.optional<typeof S.String>;
|
|
38
|
+
readonly view: S.optional<import("@dxos/echo-schema").Ref$<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
|
|
39
|
+
name: S.SchemaClass<string, string, never>;
|
|
40
|
+
query: S.Schema<import("@dxos/echo-schema").QueryType, import("@dxos/echo-schema").QueryType, never>;
|
|
41
|
+
schema: S.optional<S.Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
42
|
+
fields: S.mutable<S.Array$<S.mutable<S.Struct<{
|
|
43
|
+
id: typeof S.String;
|
|
44
|
+
path: S.Schema<import("@dxos/echo-schema").JsonPath, import("@dxos/echo-schema").JsonPath, never>;
|
|
45
|
+
visible: S.optional<typeof S.Boolean>;
|
|
46
|
+
size: S.optional<typeof S.Number>;
|
|
47
|
+
referencePath: S.optional<S.Schema<import("@dxos/echo-schema").JsonPath, import("@dxos/echo-schema").JsonPath, never>>;
|
|
48
|
+
}>>>>;
|
|
49
|
+
}, import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectOptions>>>;
|
|
50
|
+
readonly threads: S.optional<S.Array$<import("@dxos/echo-schema").Ref$<Expando>>>;
|
|
159
51
|
}>>;
|
|
160
52
|
export declare class TableType extends TableType_base {
|
|
161
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/types/table.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/types/table.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,CAAC,EAAe,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAI3E,eAAO,MAAM,WAAW;;;;cAWL,EAAG,WAAW;eAGmK,EAAG,MAAM;gBAAmI,EAAG,QAAQ,CAAC,EAAE,MAAM;gBAAgJ,EAAG,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;uBAAqB,EAAG,MAAM;kBAAe,EAAG,MAAM;qBAA6C,EAAG,QAAQ,QAAO,EAAG,OAAO;kBAAgB,EAAG,QAAQ,QAAO,EAAG,MAAM;2BAAyB,EAAG,QAAQ,CAAC,EAAE,MAAM;;;;EAR/uB,CAAC;;;;;cAKgB,EAAG,WAAW;eAGmK,EAAG,MAAM;gBAAmI,EAAG,QAAQ,CAAC,EAAE,MAAM;gBAAgJ,EAAG,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;uBAAqB,EAAG,MAAM;kBAAe,EAAG,MAAM;qBAA6C,EAAG,QAAQ,QAAO,EAAG,OAAO;kBAAgB,EAAG,QAAQ,QAAO,EAAG,MAAM;2BAAyB,EAAG,QAAQ,CAAC,EAAE,MAAM;;;;;;;;cAH9tB,EAAG,WAAW;eAGmK,EAAG,MAAM;gBAAmI,EAAG,QAAQ,CAAC,EAAE,MAAM;gBAAgJ,EAAG,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;uBAAqB,EAAG,MAAM;kBAAe,EAAG,MAAM;qBAA6C,EAAG,QAAQ,QAAO,EAAG,OAAO;kBAAgB,EAAG,QAAQ,QAAO,EAAG,MAAM;2BAAyB,EAAG,QAAQ,CAAC,EAAE,MAAM;;;;;AAJjvB,qBAAa,SAAU,SAAQ,cAGT;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,32 +1,76 @@
|
|
|
1
|
+
export type TableButton = 'columnSettings' | 'rowMenu' | 'newColumn' | 'referencedCell' | 'sort';
|
|
2
|
+
export declare const BUTTON_IDENTIFIERS: {
|
|
3
|
+
[K in TableButton]: string;
|
|
4
|
+
};
|
|
5
|
+
type ButtonData = {
|
|
6
|
+
type: 'columnSettings';
|
|
7
|
+
fieldId: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'newColumn';
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'referencedCell';
|
|
13
|
+
schemaId: string;
|
|
14
|
+
targetId: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'rowMenu';
|
|
17
|
+
rowIndex: number;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'sort';
|
|
20
|
+
fieldId: string;
|
|
21
|
+
direction?: 'asc' | 'desc';
|
|
22
|
+
};
|
|
1
23
|
export declare const tableButtons: {
|
|
2
|
-
readonly
|
|
24
|
+
readonly addColumn: {
|
|
3
25
|
readonly attr: string;
|
|
4
|
-
readonly icon:
|
|
5
|
-
readonly render: ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
26
|
+
readonly icon: "ph--plus--regular";
|
|
27
|
+
readonly render: ({ disabled }: Omit<Extract<ButtonData, {
|
|
28
|
+
type: "newColumn";
|
|
29
|
+
}>, "type">) => string;
|
|
30
|
+
readonly getData: (_el: HTMLElement) => Extract<ButtonData, {
|
|
31
|
+
type: "newColumn";
|
|
32
|
+
}>;
|
|
9
33
|
};
|
|
10
34
|
readonly columnSettings: {
|
|
11
35
|
readonly attr: string;
|
|
12
|
-
readonly icon:
|
|
13
|
-
readonly render: ({ fieldId }: {
|
|
14
|
-
|
|
15
|
-
}) => string;
|
|
36
|
+
readonly icon: "ph--caret-down--regular";
|
|
37
|
+
readonly render: ({ fieldId }: Omit<Extract<ButtonData, {
|
|
38
|
+
type: "columnSettings";
|
|
39
|
+
}>, "type">) => string;
|
|
40
|
+
readonly getData: (el: HTMLElement) => Extract<ButtonData, {
|
|
41
|
+
type: "columnSettings";
|
|
42
|
+
}>;
|
|
43
|
+
};
|
|
44
|
+
readonly referencedCell: {
|
|
45
|
+
readonly attr: string;
|
|
46
|
+
readonly icon: "ph--link-simple-horizontal--regular";
|
|
47
|
+
readonly render: ({ targetId, schemaId }: Omit<Extract<ButtonData, {
|
|
48
|
+
type: "referencedCell";
|
|
49
|
+
}>, "type">) => string;
|
|
50
|
+
readonly getData: (el: HTMLElement) => Extract<ButtonData, {
|
|
51
|
+
type: "referencedCell";
|
|
52
|
+
}>;
|
|
16
53
|
};
|
|
17
54
|
readonly rowMenu: {
|
|
18
55
|
readonly attr: string;
|
|
19
|
-
readonly icon:
|
|
20
|
-
readonly render: ({ rowIndex }: {
|
|
21
|
-
|
|
22
|
-
}) => string;
|
|
56
|
+
readonly icon: "ph--dots-three--regular";
|
|
57
|
+
readonly render: ({ rowIndex }: Omit<Extract<ButtonData, {
|
|
58
|
+
type: "rowMenu";
|
|
59
|
+
}>, "type">) => string;
|
|
60
|
+
readonly getData: (el: HTMLElement) => Extract<ButtonData, {
|
|
61
|
+
type: "rowMenu";
|
|
62
|
+
}>;
|
|
23
63
|
};
|
|
24
|
-
readonly
|
|
64
|
+
readonly sort: {
|
|
25
65
|
readonly attr: string;
|
|
26
|
-
readonly icon:
|
|
27
|
-
readonly render: ({
|
|
28
|
-
|
|
29
|
-
}) => string;
|
|
66
|
+
readonly icon: "ph--sort-ascending--regular";
|
|
67
|
+
readonly render: ({ fieldId, direction }: Omit<Extract<ButtonData, {
|
|
68
|
+
type: "sort";
|
|
69
|
+
}>, "type">) => string;
|
|
70
|
+
readonly getData: (el: HTMLElement) => Extract<ButtonData, {
|
|
71
|
+
type: "sort";
|
|
72
|
+
}>;
|
|
30
73
|
};
|
|
31
74
|
};
|
|
75
|
+
export {};
|
|
32
76
|
//# sourceMappingURL=table-buttons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-buttons.d.ts","sourceRoot":"","sources":["../../../../src/util/table-buttons.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table-buttons.d.ts","sourceRoot":"","sources":["../../../../src/util/table-buttons.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,MAAM,CAAC;AAEjG,eAAO,MAAM,kBAAkB,EAAE;KAAG,CAAC,IAAI,WAAW,GAAG,MAAM;CAMnD,CAAC;AAEX,KAAK,UAAU,GACX;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,CAAC;AA2HlE,eAAO,MAAM,YAAY;;;;wCA/FA,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,WAAW,CAAA;SAAE,CAAC,EAAE,MAAM,CAAC;gCAShE,WAAW,KAAG,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,WAAW,CAAA;SAAE,CAAC;;;;;uCAMjD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,gBAAgB,CAAA;SAAE,CAAC,EAAE,MAAM,CAAC;+BAUrE,WAAW,KAAG,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,gBAAgB,CAAA;SAAE,CAAC;;;;;kDAS1C,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,gBAAgB,CAAA;SAAE,CAAC,EAAE,MAAM,CAAC;+BAWhF,WAAW,KAAG,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,gBAAgB,CAAA;SAAE,CAAC;;;;;wCAUpD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,SAAS,CAAA;SAAE,CAAC,EAAE,MAAM,CAAC;+BAU/D,WAAW,KAAG,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,SAAS,CAAA;SAAE,CAAC;;;;;kDASnC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,EAAE,MAAM,CAAC;+BActE,WAAW,KAAG,OAAO,CAAC,UAAU,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;;CAazD,CAAC"}
|
|
@@ -1,21 +1,44 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export type RenderCheckboxProps = {
|
|
1
|
+
export type TableControl = 'checkbox' | 'switch';
|
|
2
|
+
export type ControlData = {
|
|
3
|
+
type: 'checkbox';
|
|
6
4
|
rowIndex: number;
|
|
7
5
|
header?: boolean;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'switch';
|
|
8
|
+
colIndex: number;
|
|
9
|
+
rowIndex: number;
|
|
10
|
+
};
|
|
11
|
+
type CommonRenderProps = {
|
|
8
12
|
checked?: boolean;
|
|
9
13
|
disabled?: boolean;
|
|
10
14
|
};
|
|
15
|
+
export type RenderCheckboxProps = CommonRenderProps & Omit<Extract<ControlData, {
|
|
16
|
+
type: 'checkbox';
|
|
17
|
+
}>, 'type'>;
|
|
18
|
+
export type RenderSwitchProps = CommonRenderProps & Omit<Extract<ControlData, {
|
|
19
|
+
type: 'switch';
|
|
20
|
+
}>, 'type'>;
|
|
21
|
+
export declare const CONTROL_IDENTIFIERS: {
|
|
22
|
+
readonly checkbox: "data-table-checkbox";
|
|
23
|
+
readonly switch: "data-table-switch";
|
|
24
|
+
};
|
|
11
25
|
export declare const renderCheckbox: ({ rowIndex, header, checked, disabled, }: RenderCheckboxProps) => string;
|
|
26
|
+
export declare const renderSwitch: ({ colIndex, rowIndex, checked, disabled }: RenderSwitchProps) => string;
|
|
12
27
|
export declare const tableControls: {
|
|
13
28
|
readonly checkbox: {
|
|
14
|
-
readonly
|
|
15
|
-
readonly checkbox: "data-table-checkbox";
|
|
16
|
-
readonly header: "data-table-header";
|
|
17
|
-
};
|
|
29
|
+
readonly attr: "data-table-checkbox";
|
|
18
30
|
readonly render: ({ rowIndex, header, checked, disabled, }: RenderCheckboxProps) => string;
|
|
31
|
+
readonly getData: (el: HTMLElement) => Extract<ControlData, {
|
|
32
|
+
type: "checkbox";
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
readonly switch: {
|
|
36
|
+
readonly attr: "data-table-switch";
|
|
37
|
+
readonly render: ({ colIndex, rowIndex, checked, disabled }: RenderSwitchProps) => string;
|
|
38
|
+
readonly getData: (el: HTMLElement) => Extract<ControlData, {
|
|
39
|
+
type: "switch";
|
|
40
|
+
}>;
|
|
19
41
|
};
|
|
20
42
|
};
|
|
43
|
+
export {};
|
|
21
44
|
//# sourceMappingURL=table-controls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-controls.d.ts","sourceRoot":"","sources":["../../../../src/util/table-controls.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"table-controls.d.ts","sourceRoot":"","sources":["../../../../src/util/table-controls.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjD,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAC/G,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAE3G,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAwBX,eAAO,MAAM,cAAc,6CAKxB,mBAAmB,KAAG,MAQxB,CAAC;AAEF,eAAO,MAAM,YAAY,8CAA+D,iBAAiB,KAAG,MAQ3G,CAAC;AAEF,eAAO,MAAM,aAAa;;;oEApBvB,mBAAmB,KAAG,MAAM;+BAwBb,WAAW,KAAG,OAAO,CAAC,WAAW,EAAE;YAAE,IAAI,EAAE,UAAU,CAAA;SAAE,CAAC;;;;qEAdc,iBAAiB,KAAG,MAAM;+BAuBhG,WAAW,KAAG,OAAO,CAAC,WAAW,EAAE;YAAE,IAAI,EAAE,QAAQ,CAAA;SAAE,CAAC;;CAM9D,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type EchoSchema } from '@dxos/echo-schema';
|
|
2
2
|
import { type Space } from '@dxos/react-client/echo';
|
|
3
3
|
import { type TableType } from '../types';
|
|
4
4
|
type InitialiseTableProps = {
|
|
5
5
|
space: Space;
|
|
6
6
|
table: TableType;
|
|
7
7
|
initialRow?: boolean;
|
|
8
|
+
initialSchema?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare const initializeTable: ({ space, table, initialRow }: InitialiseTableProps) =>
|
|
10
|
+
export declare const initializeTable: ({ space, table, initialRow, initialSchema, }: InitialiseTableProps) => Promise<EchoSchema>;
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/util/table.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/util/table.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,UAAU,EAIhB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGtE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAMF,eAAO,MAAM,eAAe,iDAKzB,oBAAoB,KAAG,OAAO,CAAC,UAAU,CAwF3C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"5.7.2"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-table",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5-labs.a279d8c",
|
|
4
4
|
"description": "A table component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -53,26 +53,27 @@
|
|
|
53
53
|
"@tanstack/react-virtual": "^3.9.0",
|
|
54
54
|
"date-fns": "^3.3.1",
|
|
55
55
|
"lodash.orderby": "^4.6.0",
|
|
56
|
-
"@dxos/context": "0.7.
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/invariant": "0.7.
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/live-object": "0.7.
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/react-client": "0.7.
|
|
66
|
-
"@dxos/plugin-space": "0.7.
|
|
67
|
-
"@dxos/react-ui-attention": "0.7.
|
|
68
|
-
"@dxos/react-ui-
|
|
69
|
-
"@dxos/react-ui-
|
|
70
|
-
"@dxos/react-ui-searchlist": "0.7.
|
|
71
|
-
"@dxos/react-ui-
|
|
72
|
-
"@dxos/react-ui-
|
|
73
|
-
"@dxos/react-ui-
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
56
|
+
"@dxos/context": "0.7.5-labs.a279d8c",
|
|
57
|
+
"@dxos/echo-schema": "0.7.5-labs.a279d8c",
|
|
58
|
+
"@dxos/debug": "0.7.5-labs.a279d8c",
|
|
59
|
+
"@dxos/invariant": "0.7.5-labs.a279d8c",
|
|
60
|
+
"@dxos/lit-grid": "0.7.5-labs.a279d8c",
|
|
61
|
+
"@dxos/live-object": "0.7.5-labs.a279d8c",
|
|
62
|
+
"@dxos/keys": "0.7.5-labs.a279d8c",
|
|
63
|
+
"@dxos/log": "0.7.5-labs.a279d8c",
|
|
64
|
+
"@dxos/plugin-search": "0.7.5-labs.a279d8c",
|
|
65
|
+
"@dxos/react-client": "0.7.5-labs.a279d8c",
|
|
66
|
+
"@dxos/plugin-space": "0.7.5-labs.a279d8c",
|
|
67
|
+
"@dxos/react-ui-attention": "0.7.5-labs.a279d8c",
|
|
68
|
+
"@dxos/react-ui-grid": "0.7.5-labs.a279d8c",
|
|
69
|
+
"@dxos/react-ui-form": "0.7.5-labs.a279d8c",
|
|
70
|
+
"@dxos/react-ui-searchlist": "0.7.5-labs.a279d8c",
|
|
71
|
+
"@dxos/react-ui-stack": "0.7.5-labs.a279d8c",
|
|
72
|
+
"@dxos/react-ui-types": "0.7.5-labs.a279d8c",
|
|
73
|
+
"@dxos/react-ui-menu": "0.7.5-labs.a279d8c",
|
|
74
|
+
"@dxos/react-ui-syntax-highlighter": "0.7.5-labs.a279d8c",
|
|
75
|
+
"@dxos/schema": "0.7.5-labs.a279d8c",
|
|
76
|
+
"@dxos/util": "0.7.5-labs.a279d8c"
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
78
79
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -83,19 +84,19 @@
|
|
|
83
84
|
"react": "~18.2.0",
|
|
84
85
|
"react-dom": "~18.2.0",
|
|
85
86
|
"vite": "5.4.7",
|
|
86
|
-
"@dxos/echo-signals": "0.7.
|
|
87
|
-
"@dxos/random": "0.7.
|
|
88
|
-
"@dxos/react-ui": "0.7.
|
|
89
|
-
"@dxos/react-ui-theme": "0.7.
|
|
90
|
-
"@dxos/
|
|
91
|
-
"@dxos/
|
|
87
|
+
"@dxos/echo-signals": "0.7.5-labs.a279d8c",
|
|
88
|
+
"@dxos/random": "0.7.5-labs.a279d8c",
|
|
89
|
+
"@dxos/react-ui": "0.7.5-labs.a279d8c",
|
|
90
|
+
"@dxos/react-ui-theme": "0.7.5-labs.a279d8c",
|
|
91
|
+
"@dxos/storybook-utils": "0.7.5-labs.a279d8c",
|
|
92
|
+
"@dxos/test-utils": "0.7.5-labs.a279d8c"
|
|
92
93
|
},
|
|
93
94
|
"peerDependencies": {
|
|
94
95
|
"@phosphor-icons/react": "^2.1.5",
|
|
95
96
|
"react": "~18.2.0",
|
|
96
97
|
"react-dom": "~18.2.0",
|
|
97
|
-
"@dxos/react-ui": "0.7.
|
|
98
|
-
"@dxos/react-ui-theme": "0.7.
|
|
98
|
+
"@dxos/react-ui": "0.7.5-labs.a279d8c",
|
|
99
|
+
"@dxos/react-ui-theme": "0.7.5-labs.a279d8c"
|
|
99
100
|
},
|
|
100
101
|
"publishConfig": {
|
|
101
102
|
"access": "public"
|
|
@@ -6,31 +6,31 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { DropdownMenu, useTranslation } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
|
-
import { type TableModel } from '../../model';
|
|
9
|
+
import { type TableModel, type ModalController } from '../../model';
|
|
10
10
|
import { translationKey } from '../../translations';
|
|
11
11
|
|
|
12
|
-
type ColumnActionsMenuProps = { model
|
|
12
|
+
type ColumnActionsMenuProps = { model: TableModel; modals: ModalController };
|
|
13
13
|
|
|
14
|
-
export const ColumnActionsMenu = ({ model }: ColumnActionsMenuProps) => {
|
|
14
|
+
export const ColumnActionsMenu = ({ model, modals }: ColumnActionsMenuProps) => {
|
|
15
15
|
const { t } = useTranslation(translationKey);
|
|
16
|
-
const state =
|
|
17
|
-
if (
|
|
16
|
+
const state = modals.state.value;
|
|
17
|
+
if (state?.type !== 'column') {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const currentSort = model.sorting;
|
|
21
|
+
const currentSort = model.sorting?.sorting;
|
|
22
22
|
const isCurrentColumnSorted = currentSort?.fieldId === state.fieldId;
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
|
-
<DropdownMenu.Root modal={false} open={
|
|
26
|
-
<DropdownMenu.VirtualTrigger virtualRef={
|
|
25
|
+
<DropdownMenu.Root modal={false} open={true} onOpenChange={modals.close}>
|
|
26
|
+
<DropdownMenu.VirtualTrigger virtualRef={modals.trigger} />
|
|
27
27
|
<DropdownMenu.Portal>
|
|
28
28
|
<DropdownMenu.Content>
|
|
29
29
|
<DropdownMenu.Viewport>
|
|
30
30
|
{(!isCurrentColumnSorted || currentSort?.direction === 'asc') && (
|
|
31
31
|
<DropdownMenu.Item
|
|
32
32
|
data-testid='column-sort-descending'
|
|
33
|
-
onClick={() => model.setSort(state.fieldId, 'desc')}
|
|
33
|
+
onClick={() => model.sorting?.setSort(state.fieldId, 'desc')}
|
|
34
34
|
>
|
|
35
35
|
{t('column action sort descending')}
|
|
36
36
|
</DropdownMenu.Item>
|
|
@@ -38,13 +38,13 @@ export const ColumnActionsMenu = ({ model }: ColumnActionsMenuProps) => {
|
|
|
38
38
|
{(!isCurrentColumnSorted || currentSort?.direction === 'desc') && (
|
|
39
39
|
<DropdownMenu.Item
|
|
40
40
|
data-testid='column-sort-ascending'
|
|
41
|
-
onClick={() => model.setSort(state.fieldId, 'asc')}
|
|
41
|
+
onClick={() => model.sorting?.setSort(state.fieldId, 'asc')}
|
|
42
42
|
>
|
|
43
43
|
{t('column action sort ascending')}
|
|
44
44
|
</DropdownMenu.Item>
|
|
45
45
|
)}
|
|
46
46
|
{isCurrentColumnSorted && (
|
|
47
|
-
<DropdownMenu.Item data-testid='column-clear-sort' onClick={() => model.clearSort()}>
|
|
47
|
+
<DropdownMenu.Item data-testid='column-clear-sort' onClick={() => model.sorting?.clearSort()}>
|
|
48
48
|
{t('column action clear sorting')}
|
|
49
49
|
</DropdownMenu.Item>
|
|
50
50
|
)}
|
|
@@ -53,7 +53,7 @@ export const ColumnActionsMenu = ({ model }: ColumnActionsMenuProps) => {
|
|
|
53
53
|
{t('column action delete')}
|
|
54
54
|
</DropdownMenu.Item>
|
|
55
55
|
)}
|
|
56
|
-
<DropdownMenu.Item data-testid='column-settings' onClick={() =>
|
|
56
|
+
<DropdownMenu.Item data-testid='column-settings' onClick={() => modals.openColumnSettings()}>
|
|
57
57
|
{t('column action settings')}
|
|
58
58
|
</DropdownMenu.Item>
|
|
59
59
|
</DropdownMenu.Viewport>
|
|
@@ -9,13 +9,13 @@ import { DropdownMenu } from '@dxos/react-ui';
|
|
|
9
9
|
import { FieldEditor } from '@dxos/react-ui-form';
|
|
10
10
|
import { type FieldType } from '@dxos/schema';
|
|
11
11
|
|
|
12
|
-
import { type TableModel } from '../../model';
|
|
12
|
+
import { type TableModel, type ModalController } from '../../model';
|
|
13
13
|
|
|
14
|
-
type ColumnSettingsProps = { model?: TableModel; onNewColumn: () => void };
|
|
14
|
+
type ColumnSettingsProps = { model?: TableModel; modals: ModalController; onNewColumn: () => void };
|
|
15
15
|
|
|
16
|
-
export const ColumnSettings = ({ model, onNewColumn }: ColumnSettingsProps) => {
|
|
16
|
+
export const ColumnSettings = ({ model, modals, onNewColumn }: ColumnSettingsProps) => {
|
|
17
17
|
const [newField, setNewField] = useState<FieldType>();
|
|
18
|
-
const state =
|
|
18
|
+
const state = modals.state.value;
|
|
19
19
|
|
|
20
20
|
const space = getSpace(model?.table);
|
|
21
21
|
|
|
@@ -34,17 +34,17 @@ export const ColumnSettings = ({ model, onNewColumn }: ColumnSettingsProps) => {
|
|
|
34
34
|
if (state?.type === 'columnSettings') {
|
|
35
35
|
const { mode } = state;
|
|
36
36
|
if (mode.type === 'edit') {
|
|
37
|
-
return model?.table?.view?.fields.find((f) => f.id === mode.fieldId);
|
|
37
|
+
return model?.table?.view?.target?.fields.find((f) => f.id === mode.fieldId);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
return undefined;
|
|
41
|
-
}, [model?.table?.view?.fields, state]);
|
|
41
|
+
}, [model?.table?.view?.target?.fields, state]);
|
|
42
42
|
|
|
43
43
|
const field = existingField ?? newField;
|
|
44
44
|
|
|
45
45
|
const handleSave = useCallback(() => {
|
|
46
|
-
|
|
47
|
-
}, [
|
|
46
|
+
modals.close();
|
|
47
|
+
}, [modals]);
|
|
48
48
|
|
|
49
49
|
const handleCancel = useCallback(() => {
|
|
50
50
|
if (state?.type === 'columnSettings' && state.mode.type === 'create' && newField) {
|
|
@@ -52,18 +52,18 @@ export const ColumnSettings = ({ model, onNewColumn }: ColumnSettingsProps) => {
|
|
|
52
52
|
}
|
|
53
53
|
}, [model?.projection, state, newField]);
|
|
54
54
|
|
|
55
|
-
if (!model?.table?.view || !model.projection || !field) {
|
|
55
|
+
if (!model?.table?.view?.target || !model.projection || !field) {
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
60
|
<DropdownMenu.Root modal={false} open={state?.type === 'columnSettings'}>
|
|
61
|
-
<DropdownMenu.VirtualTrigger virtualRef={
|
|
61
|
+
<DropdownMenu.VirtualTrigger virtualRef={modals.trigger} />
|
|
62
62
|
<DropdownMenu.Portal>
|
|
63
63
|
<DropdownMenu.Content classNames='md:is-64'>
|
|
64
64
|
<DropdownMenu.Viewport>
|
|
65
65
|
<FieldEditor
|
|
66
|
-
view={model.table.view}
|
|
66
|
+
view={model.table.view.target!}
|
|
67
67
|
projection={model.projection}
|
|
68
68
|
field={field}
|
|
69
69
|
registry={space?.db.schemaRegistry}
|