@stonecrop/atable 0.4.32 → 0.4.34
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/README.md +44 -0
- package/dist/atable.d.ts +169 -32
- package/dist/atable.js +831 -758
- package/dist/atable.js.map +1 -1
- package/dist/atable.umd.cjs +2 -2
- package/dist/atable.umd.cjs.map +1 -1
- package/dist/src/stores/table.d.ts +78 -6
- package/dist/src/stores/table.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +72 -12
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/stores/table.js +47 -5
- package/package.json +3 -3
- package/src/components/ACell.vue +100 -2
- package/src/stores/table.ts +53 -5
- package/src/types/index.ts +80 -13
|
@@ -53,13 +53,37 @@ export declare const createTableStore: (initData: {
|
|
|
53
53
|
originalIndex?: number | undefined;
|
|
54
54
|
}[]>;
|
|
55
55
|
config: import("vue").Ref<{
|
|
56
|
-
view?: "uncounted" | "list" | "list-expansion" |
|
|
56
|
+
view?: "uncounted" | "list" | "list-expansion" | undefined;
|
|
57
57
|
fullWidth?: boolean | undefined;
|
|
58
|
+
} | {
|
|
59
|
+
view: "tree";
|
|
60
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
61
|
+
fullWidth?: boolean | undefined;
|
|
62
|
+
} | {
|
|
63
|
+
view: "gantt";
|
|
64
|
+
dependencyGraph?: boolean | undefined;
|
|
65
|
+
fullWidth?: boolean | undefined;
|
|
66
|
+
} | {
|
|
67
|
+
view: "tree-gantt";
|
|
68
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
58
69
|
dependencyGraph?: boolean | undefined;
|
|
70
|
+
fullWidth?: boolean | undefined;
|
|
59
71
|
}, TableConfig | {
|
|
60
|
-
view?: "uncounted" | "list" | "list-expansion" |
|
|
72
|
+
view?: "uncounted" | "list" | "list-expansion" | undefined;
|
|
73
|
+
fullWidth?: boolean | undefined;
|
|
74
|
+
} | {
|
|
75
|
+
view: "tree";
|
|
76
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
77
|
+
fullWidth?: boolean | undefined;
|
|
78
|
+
} | {
|
|
79
|
+
view: "gantt";
|
|
80
|
+
dependencyGraph?: boolean | undefined;
|
|
61
81
|
fullWidth?: boolean | undefined;
|
|
82
|
+
} | {
|
|
83
|
+
view: "tree-gantt";
|
|
84
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
62
85
|
dependencyGraph?: boolean | undefined;
|
|
86
|
+
fullWidth?: boolean | undefined;
|
|
63
87
|
}>;
|
|
64
88
|
connectionHandles: import("vue").Ref<{
|
|
65
89
|
id: string;
|
|
@@ -288,13 +312,37 @@ export declare const createTableStore: (initData: {
|
|
|
288
312
|
originalIndex?: number | undefined;
|
|
289
313
|
}[]>;
|
|
290
314
|
config: import("vue").Ref<{
|
|
291
|
-
view?: "uncounted" | "list" | "list-expansion" |
|
|
315
|
+
view?: "uncounted" | "list" | "list-expansion" | undefined;
|
|
316
|
+
fullWidth?: boolean | undefined;
|
|
317
|
+
} | {
|
|
318
|
+
view: "tree";
|
|
319
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
292
320
|
fullWidth?: boolean | undefined;
|
|
321
|
+
} | {
|
|
322
|
+
view: "gantt";
|
|
293
323
|
dependencyGraph?: boolean | undefined;
|
|
324
|
+
fullWidth?: boolean | undefined;
|
|
325
|
+
} | {
|
|
326
|
+
view: "tree-gantt";
|
|
327
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
328
|
+
dependencyGraph?: boolean | undefined;
|
|
329
|
+
fullWidth?: boolean | undefined;
|
|
294
330
|
}, TableConfig | {
|
|
295
|
-
view?: "uncounted" | "list" | "list-expansion" |
|
|
331
|
+
view?: "uncounted" | "list" | "list-expansion" | undefined;
|
|
296
332
|
fullWidth?: boolean | undefined;
|
|
333
|
+
} | {
|
|
334
|
+
view: "tree";
|
|
335
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
336
|
+
fullWidth?: boolean | undefined;
|
|
337
|
+
} | {
|
|
338
|
+
view: "gantt";
|
|
339
|
+
dependencyGraph?: boolean | undefined;
|
|
340
|
+
fullWidth?: boolean | undefined;
|
|
341
|
+
} | {
|
|
342
|
+
view: "tree-gantt";
|
|
343
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
297
344
|
dependencyGraph?: boolean | undefined;
|
|
345
|
+
fullWidth?: boolean | undefined;
|
|
298
346
|
}>;
|
|
299
347
|
connectionHandles: import("vue").Ref<{
|
|
300
348
|
id: string;
|
|
@@ -523,13 +571,37 @@ export declare const createTableStore: (initData: {
|
|
|
523
571
|
originalIndex?: number | undefined;
|
|
524
572
|
}[]>;
|
|
525
573
|
config: import("vue").Ref<{
|
|
526
|
-
view?: "uncounted" | "list" | "list-expansion" |
|
|
574
|
+
view?: "uncounted" | "list" | "list-expansion" | undefined;
|
|
575
|
+
fullWidth?: boolean | undefined;
|
|
576
|
+
} | {
|
|
577
|
+
view: "tree";
|
|
578
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
579
|
+
fullWidth?: boolean | undefined;
|
|
580
|
+
} | {
|
|
581
|
+
view: "gantt";
|
|
582
|
+
dependencyGraph?: boolean | undefined;
|
|
527
583
|
fullWidth?: boolean | undefined;
|
|
584
|
+
} | {
|
|
585
|
+
view: "tree-gantt";
|
|
586
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
528
587
|
dependencyGraph?: boolean | undefined;
|
|
588
|
+
fullWidth?: boolean | undefined;
|
|
529
589
|
}, TableConfig | {
|
|
530
|
-
view?: "uncounted" | "list" | "list-expansion" |
|
|
590
|
+
view?: "uncounted" | "list" | "list-expansion" | undefined;
|
|
591
|
+
fullWidth?: boolean | undefined;
|
|
592
|
+
} | {
|
|
593
|
+
view: "tree";
|
|
594
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
531
595
|
fullWidth?: boolean | undefined;
|
|
596
|
+
} | {
|
|
597
|
+
view: "gantt";
|
|
532
598
|
dependencyGraph?: boolean | undefined;
|
|
599
|
+
fullWidth?: boolean | undefined;
|
|
600
|
+
} | {
|
|
601
|
+
view: "tree-gantt";
|
|
602
|
+
defaultTreeExpansion?: "root" | "branch" | "leaf" | undefined;
|
|
603
|
+
dependencyGraph?: boolean | undefined;
|
|
604
|
+
fullWidth?: boolean | undefined;
|
|
533
605
|
}>;
|
|
534
606
|
connectionHandles: import("vue").Ref<{
|
|
535
607
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/stores/table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,KAAK,CAAA;AAEvD,OAAO,KAAK,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,MAAM,UAAU,CAAA;AAGjB;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU;IAC1C,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,IAAI,EAAE,QAAQ,EAAE,CAAA;IAChB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,KAAK,CAAC,EAAE,UAAU,CAAA;CAClB
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/stores/table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,KAAK,CAAA;AAEvD,OAAO,KAAK,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,MAAM,UAAU,CAAA;AAGjB;;;;;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QzB,CAAC,kBAAkB,MAAM,YAAY,MAAM,KAAG,CAAC;oCA6H7B,MAAM,YAAY,MAAM;kCA+I1B,MAAM;;;;;;;;;;;;;;;;kCA1IN,MAAM,YAAY,MAAM,SAAS,GAAG;8BA8IxC,MAAM;;;;;;;;;;;;iCAlPH,WAAW,KAAG,aAAa;0BAmIlC,MAAM,gBAAgB,MAAM;mCA3FnB,MAAM;2BATd,MAAM;6BAKJ,MAAM;2CA+IQ,gBAAgB;gCAlB3B,YAAY;6BA9If,MAAM,YAAY,MAAM;4BAhDzB,MAAM,YAAY,MAAM,SAAS,GAAG;4BAoBpC,MAAM,YAAY,MAAM,SAAS,MAAM;gCAiEnC,MAAM;2CAsIK,MAAM;gCAlBjB,MAAM;4BAjCV,cAAc;0BAxJhB,QAAQ,EAAE;kdAoTxC,CAAA"}
|
|
@@ -155,26 +155,55 @@ export interface CellContext {
|
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
|
-
*
|
|
158
|
+
* Base table configuration properties shared across all view types.
|
|
159
159
|
* @public
|
|
160
160
|
*/
|
|
161
|
-
export interface
|
|
162
|
-
/**
|
|
163
|
-
* The type of view to display the table in. Possible values:
|
|
164
|
-
* - `uncounted` - row numbers are not displayed in the table
|
|
165
|
-
* - `list` - row numbers are displayed in the table
|
|
166
|
-
* - `list-expansion` - carets are displayed in the number column that expand/collapse the row inline
|
|
167
|
-
* - `tree` - carets are displayed in the number column that expand/collapse grouped rows
|
|
168
|
-
* - `gantt` - view that allows specific rows to be displayed with Gantt functionality
|
|
169
|
-
* - `tree-gantt` - similar to `gantt`, but allows for tree functionality as well
|
|
170
|
-
*/
|
|
171
|
-
view?: 'uncounted' | 'list' | 'list-expansion' | 'tree' | 'gantt' | 'tree-gantt';
|
|
161
|
+
export interface BaseTableConfig {
|
|
172
162
|
/**
|
|
173
163
|
* Control whether the table should be allowed to use the full width of its container.
|
|
174
164
|
*
|
|
175
165
|
* @defaultValue false
|
|
176
166
|
*/
|
|
177
167
|
fullWidth?: boolean;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Table configuration for basic view types (uncounted, list, list-expansion).
|
|
171
|
+
* @public
|
|
172
|
+
*/
|
|
173
|
+
export interface BasicTableConfig extends BaseTableConfig {
|
|
174
|
+
/**
|
|
175
|
+
* The type of view to display the table in.
|
|
176
|
+
*/
|
|
177
|
+
view?: 'uncounted' | 'list' | 'list-expansion';
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Table configuration for tree view types.
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
183
|
+
export interface TreeTableConfig extends BaseTableConfig {
|
|
184
|
+
/**
|
|
185
|
+
* The type of view to display the table in.
|
|
186
|
+
*/
|
|
187
|
+
view: 'tree';
|
|
188
|
+
/**
|
|
189
|
+
* Default expansion state for tree views. Possible values:
|
|
190
|
+
* - `root` - Only top-level nodes are visible (fully collapsed)
|
|
191
|
+
* - `branch` - Shows minimal tree to display all gantt nodes. Expands only the necessary paths to gantt nodes, stops at gantt nodes with no gantt descendants
|
|
192
|
+
* - `leaf` - All nodes are visible (fully expanded)
|
|
193
|
+
*
|
|
194
|
+
* @defaultValue undefined (default behavior is 'leaf' mode)
|
|
195
|
+
*/
|
|
196
|
+
defaultTreeExpansion?: 'root' | 'branch' | 'leaf';
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Table configuration for gantt view types.
|
|
200
|
+
* @public
|
|
201
|
+
*/
|
|
202
|
+
export interface GanttTableConfig extends BaseTableConfig {
|
|
203
|
+
/**
|
|
204
|
+
* The type of view to display the table in.
|
|
205
|
+
*/
|
|
206
|
+
view: 'gantt';
|
|
178
207
|
/**
|
|
179
208
|
* Control whether dependency graph connections should be enabled for Gantt views.
|
|
180
209
|
* When false, connection handles and dependency lines will be hidden.
|
|
@@ -183,6 +212,37 @@ export interface TableConfig {
|
|
|
183
212
|
*/
|
|
184
213
|
dependencyGraph?: boolean;
|
|
185
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Table configuration for tree-gantt view types.
|
|
217
|
+
* @public
|
|
218
|
+
*/
|
|
219
|
+
export interface TreeGanttTableConfig extends BaseTableConfig {
|
|
220
|
+
/**
|
|
221
|
+
* The type of view to display the table in.
|
|
222
|
+
*/
|
|
223
|
+
view: 'tree-gantt';
|
|
224
|
+
/**
|
|
225
|
+
* Default expansion state for tree views. Possible values:
|
|
226
|
+
* - `root` - Only top-level nodes are visible (fully collapsed)
|
|
227
|
+
* - `branch` - Shows minimal tree to display all gantt nodes. Expands only the necessary paths to gantt nodes, stops at gantt nodes with no gantt descendants
|
|
228
|
+
* - `leaf` - All nodes are visible (fully expanded)
|
|
229
|
+
*
|
|
230
|
+
* @defaultValue undefined (default behavior is 'leaf' mode)
|
|
231
|
+
*/
|
|
232
|
+
defaultTreeExpansion?: 'root' | 'branch' | 'leaf';
|
|
233
|
+
/**
|
|
234
|
+
* Control whether dependency graph connections should be enabled for Gantt views.
|
|
235
|
+
* When false, connection handles and dependency lines will be hidden.
|
|
236
|
+
*
|
|
237
|
+
* @defaultValue true
|
|
238
|
+
*/
|
|
239
|
+
dependencyGraph?: boolean;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Table configuration definition using discriminated unions for type safety.
|
|
243
|
+
* @public
|
|
244
|
+
*/
|
|
245
|
+
export type TableConfig = BasicTableConfig | TreeTableConfig | GanttTableConfig | TreeGanttTableConfig;
|
|
186
246
|
/**
|
|
187
247
|
* Table display definition.
|
|
188
248
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD;;;GAGG;AACH,MA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;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAEtB;;OAEG;IACH,QAAQ,EAAE;QACT,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;QACrB,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;KACrB,CAAA;IAED;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAErB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,IAAI,EAAE;QACL,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;KACtB,CAAA;IAED;;OAEG;IACH,EAAE,EAAE;QACH,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;KACtB,CAAA;IAED;;OAEG;IACH,KAAK,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,KAAK,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IAED;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAA;IACzB,UAAU,EAAE,cAAc,CAAA;CAC1B,CAAA"}
|
package/dist/stores/table.js
CHANGED
|
@@ -20,16 +20,53 @@ export const createTableStore = (initData) => {
|
|
|
20
20
|
parents.add(row.parent);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
// Helper function to check if a row has gantt data
|
|
24
|
+
const hasGanttData = (rowIndex) => {
|
|
25
|
+
return rows.value[rowIndex]?.gantt !== undefined;
|
|
26
|
+
};
|
|
27
|
+
// Helper function to check if any descendant has gantt data
|
|
28
|
+
const hasGanttDescendant = (rowIndex) => {
|
|
29
|
+
for (let i = 0; i < rows.value.length; i++) {
|
|
30
|
+
if (rows.value[i].parent === rowIndex) {
|
|
31
|
+
if (hasGanttData(i) || hasGanttDescendant(i)) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
};
|
|
38
|
+
// Helper function to determine if children should be open based on expansion mode
|
|
39
|
+
const shouldChildrenBeOpen = (rowIndex) => {
|
|
40
|
+
const currentConfig = config.value;
|
|
41
|
+
const expansionMode = currentConfig.view === 'tree' || currentConfig.view === 'tree-gantt'
|
|
42
|
+
? currentConfig.defaultTreeExpansion
|
|
43
|
+
: undefined;
|
|
44
|
+
if (!expansionMode)
|
|
45
|
+
return true; // Default behavior - start expanded (leaf mode)
|
|
46
|
+
switch (expansionMode) {
|
|
47
|
+
case 'root':
|
|
48
|
+
return false; // Only root nodes are visible, all children start collapsed
|
|
49
|
+
case 'branch':
|
|
50
|
+
// Only expand if this node leads to gantt nodes OR if this node itself has gantt data AND has gantt children
|
|
51
|
+
return hasGanttDescendant(rowIndex);
|
|
52
|
+
case 'leaf':
|
|
53
|
+
return true; // All nodes should be expanded
|
|
54
|
+
default:
|
|
55
|
+
return true; // Default to expanded if unknown mode
|
|
56
|
+
}
|
|
57
|
+
};
|
|
23
58
|
for (let rowIndex = 0; rowIndex < rows.value.length; rowIndex++) {
|
|
24
59
|
const row = rows.value[rowIndex];
|
|
60
|
+
const isRootNode = row.parent === null || row.parent === undefined;
|
|
61
|
+
const isParentNode = parents.has(rowIndex);
|
|
25
62
|
defaultDisplay[rowIndex] = {
|
|
26
|
-
childrenOpen:
|
|
63
|
+
childrenOpen: shouldChildrenBeOpen(rowIndex),
|
|
27
64
|
expanded: false,
|
|
28
65
|
indent: row.indent || 0,
|
|
29
|
-
isParent:
|
|
30
|
-
isRoot:
|
|
66
|
+
isParent: isParentNode,
|
|
67
|
+
isRoot: isRootNode,
|
|
31
68
|
rowModified: false,
|
|
32
|
-
open:
|
|
69
|
+
open: isRootNode, // This will be recalculated later for non-root nodes
|
|
33
70
|
parent: row.parent,
|
|
34
71
|
};
|
|
35
72
|
}
|
|
@@ -112,7 +149,12 @@ export const createTableStore = (initData) => {
|
|
|
112
149
|
const hasPinnedColumns = computed(() => columns.value.some(col => col.pinned));
|
|
113
150
|
const isGanttView = computed(() => config.value.view === 'gantt' || config.value.view === 'tree-gantt');
|
|
114
151
|
const isTreeView = computed(() => config.value.view === 'tree' || config.value.view === 'tree-gantt');
|
|
115
|
-
const isDependencyGraphEnabled = computed(() =>
|
|
152
|
+
const isDependencyGraphEnabled = computed(() => {
|
|
153
|
+
const currentConfig = config.value;
|
|
154
|
+
return currentConfig.view === 'gantt' || currentConfig.view === 'tree-gantt'
|
|
155
|
+
? currentConfig.dependencyGraph !== false
|
|
156
|
+
: true;
|
|
157
|
+
});
|
|
116
158
|
const numberedRowWidth = computed(() => {
|
|
117
159
|
const indent = Math.ceil(rows.value.length / 100 + 1);
|
|
118
160
|
return `${indent}ch`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/atable",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.34",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@vueuse/core": "^13.6.0",
|
|
43
43
|
"pinia": "^3.0.3",
|
|
44
44
|
"vue": "^3.5.18",
|
|
45
|
-
"@stonecrop/
|
|
46
|
-
"@stonecrop/
|
|
45
|
+
"@stonecrop/utilities": "0.4.34",
|
|
46
|
+
"@stonecrop/themes": "0.4.34"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@microsoft/api-documenter": "^7.26.31",
|
package/src/components/ACell.vue
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
@focus="onFocus"
|
|
12
12
|
@paste="updateCellData"
|
|
13
13
|
@input="debouncedUpdateCellData"
|
|
14
|
-
@click="
|
|
14
|
+
@click="onCellClick"
|
|
15
15
|
class="atable-cell"
|
|
16
16
|
:class="cellClasses">
|
|
17
17
|
<component
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<script setup lang="ts">
|
|
28
28
|
import { KeypressHandlers, defaultKeypressHandlers, useKeyboardNav } from '@stonecrop/utilities'
|
|
29
29
|
import { useDebounceFn, useElementBounding } from '@vueuse/core'
|
|
30
|
-
import { computed, type CSSProperties, ref, useTemplateRef } from 'vue'
|
|
30
|
+
import { computed, type CSSProperties, ref, useTemplateRef, nextTick } from 'vue'
|
|
31
31
|
|
|
32
32
|
import { createTableStore } from '../stores/table'
|
|
33
33
|
import { isHtmlString } from '../utils'
|
|
@@ -85,6 +85,14 @@ const cellClasses = computed(() => {
|
|
|
85
85
|
}
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
+
const onCellClick = () => {
|
|
89
|
+
// First, select all text if the cell is editable
|
|
90
|
+
selectAllText()
|
|
91
|
+
|
|
92
|
+
// Then handle modal display (original showModal behavior)
|
|
93
|
+
showModal()
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
const showModal = () => {
|
|
89
97
|
const { left, bottom, width, height } = useElementBounding(cellRef)
|
|
90
98
|
|
|
@@ -153,9 +161,91 @@ if (addNavigation) {
|
|
|
153
161
|
// }
|
|
154
162
|
// }
|
|
155
163
|
|
|
164
|
+
const selectAllText = () => {
|
|
165
|
+
if (cellRef.value && column.edit) {
|
|
166
|
+
// Use the Selection API to select all text content in the contenteditable cell
|
|
167
|
+
const selection = window.getSelection()
|
|
168
|
+
if (selection) {
|
|
169
|
+
try {
|
|
170
|
+
const range = document.createRange()
|
|
171
|
+
if (range.selectNodeContents) {
|
|
172
|
+
range.selectNodeContents(cellRef.value)
|
|
173
|
+
selection.removeAllRanges()
|
|
174
|
+
selection.addRange(range)
|
|
175
|
+
}
|
|
176
|
+
} catch (error) {
|
|
177
|
+
// Fallback for environments where Range API is not fully supported
|
|
178
|
+
// This is expected in some test environments
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
156
184
|
const onFocus = () => {
|
|
157
185
|
if (cellRef.value) {
|
|
158
186
|
currentData.value = cellRef.value.textContent!
|
|
187
|
+
// Select all text when the cell receives focus
|
|
188
|
+
selectAllText()
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const saveCursorPosition = () => {
|
|
193
|
+
try {
|
|
194
|
+
const selection = window.getSelection()
|
|
195
|
+
if (selection && selection.rangeCount > 0 && cellRef.value) {
|
|
196
|
+
const range = selection.getRangeAt(0)
|
|
197
|
+
// Save the offset from the start of the cell
|
|
198
|
+
const preCaretRange = range.cloneRange()
|
|
199
|
+
if (preCaretRange.selectNodeContents && preCaretRange.setEnd) {
|
|
200
|
+
preCaretRange.selectNodeContents(cellRef.value)
|
|
201
|
+
preCaretRange.setEnd(range.endContainer, range.endOffset)
|
|
202
|
+
return preCaretRange.toString().length
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
// Fallback for environments where Selection API is not fully supported
|
|
207
|
+
}
|
|
208
|
+
return 0
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const restoreCursorPosition = (position: number) => {
|
|
212
|
+
if (!cellRef.value) return
|
|
213
|
+
|
|
214
|
+
try {
|
|
215
|
+
const selection = window.getSelection()
|
|
216
|
+
if (!selection) return
|
|
217
|
+
|
|
218
|
+
let charIndex = 0
|
|
219
|
+
const walker = document.createTreeWalker
|
|
220
|
+
? document.createTreeWalker(cellRef.value, NodeFilter.SHOW_TEXT, null)
|
|
221
|
+
: null
|
|
222
|
+
|
|
223
|
+
if (!walker) return
|
|
224
|
+
|
|
225
|
+
let node: Node | null
|
|
226
|
+
let range: Range | null = null
|
|
227
|
+
|
|
228
|
+
while ((node = walker.nextNode())) {
|
|
229
|
+
const textNode = node as Text
|
|
230
|
+
const nextCharIndex = charIndex + textNode.textContent!.length
|
|
231
|
+
|
|
232
|
+
if (position <= nextCharIndex) {
|
|
233
|
+
range = document.createRange()
|
|
234
|
+
if (range.setStart && range.setEnd) {
|
|
235
|
+
range.setStart(textNode, position - charIndex)
|
|
236
|
+
range.setEnd(textNode, position - charIndex)
|
|
237
|
+
break
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
charIndex = nextCharIndex
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (range && selection.removeAllRanges && selection.addRange) {
|
|
244
|
+
selection.removeAllRanges()
|
|
245
|
+
selection.addRange(range)
|
|
246
|
+
}
|
|
247
|
+
} catch (error) {
|
|
248
|
+
// Fallback for environments where DOM APIs are not fully supported
|
|
159
249
|
}
|
|
160
250
|
}
|
|
161
251
|
|
|
@@ -165,6 +255,9 @@ const updateCellData = (payload: Event) => {
|
|
|
165
255
|
return
|
|
166
256
|
}
|
|
167
257
|
|
|
258
|
+
// Save cursor position before updating
|
|
259
|
+
const cursorPosition = saveCursorPosition()
|
|
260
|
+
|
|
168
261
|
currentData.value = target.textContent!
|
|
169
262
|
|
|
170
263
|
// only apply changes if the cell value has changed after being mounted
|
|
@@ -176,6 +269,11 @@ const updateCellData = (payload: Event) => {
|
|
|
176
269
|
cellModified.value = target.textContent !== originalData
|
|
177
270
|
store.setCellData(colIndex, rowIndex, target.textContent)
|
|
178
271
|
}
|
|
272
|
+
|
|
273
|
+
// Use nextTick to restore cursor position after Vue's reactive updates but before browser repaint
|
|
274
|
+
void nextTick().then(() => {
|
|
275
|
+
restoreCursorPosition(cursorPosition)
|
|
276
|
+
})
|
|
179
277
|
}
|
|
180
278
|
|
|
181
279
|
const debouncedUpdateCellData = useDebounceFn(updateCellData, debounce)
|
package/src/stores/table.ts
CHANGED
|
@@ -42,16 +42,59 @@ export const createTableStore = (initData: {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
// Helper function to check if a row has gantt data
|
|
46
|
+
const hasGanttData = (rowIndex: number): boolean => {
|
|
47
|
+
return rows.value[rowIndex]?.gantt !== undefined
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Helper function to check if any descendant has gantt data
|
|
51
|
+
const hasGanttDescendant = (rowIndex: number): boolean => {
|
|
52
|
+
for (let i = 0; i < rows.value.length; i++) {
|
|
53
|
+
if (rows.value[i].parent === rowIndex) {
|
|
54
|
+
if (hasGanttData(i) || hasGanttDescendant(i)) {
|
|
55
|
+
return true
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return false
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Helper function to determine if children should be open based on expansion mode
|
|
63
|
+
const shouldChildrenBeOpen = (rowIndex: number): boolean => {
|
|
64
|
+
const currentConfig = config.value
|
|
65
|
+
const expansionMode =
|
|
66
|
+
currentConfig.view === 'tree' || currentConfig.view === 'tree-gantt'
|
|
67
|
+
? currentConfig.defaultTreeExpansion
|
|
68
|
+
: undefined
|
|
69
|
+
|
|
70
|
+
if (!expansionMode) return true // Default behavior - start expanded (leaf mode)
|
|
71
|
+
|
|
72
|
+
switch (expansionMode) {
|
|
73
|
+
case 'root':
|
|
74
|
+
return false // Only root nodes are visible, all children start collapsed
|
|
75
|
+
case 'branch':
|
|
76
|
+
// Only expand if this node leads to gantt nodes OR if this node itself has gantt data AND has gantt children
|
|
77
|
+
return hasGanttDescendant(rowIndex)
|
|
78
|
+
case 'leaf':
|
|
79
|
+
return true // All nodes should be expanded
|
|
80
|
+
default:
|
|
81
|
+
return true // Default to expanded if unknown mode
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
45
85
|
for (let rowIndex = 0; rowIndex < rows.value.length; rowIndex++) {
|
|
46
86
|
const row = rows.value[rowIndex]
|
|
87
|
+
const isRootNode = row.parent === null || row.parent === undefined
|
|
88
|
+
const isParentNode = parents.has(rowIndex)
|
|
89
|
+
|
|
47
90
|
defaultDisplay[rowIndex] = {
|
|
48
|
-
childrenOpen:
|
|
91
|
+
childrenOpen: shouldChildrenBeOpen(rowIndex),
|
|
49
92
|
expanded: false,
|
|
50
93
|
indent: row.indent || 0,
|
|
51
|
-
isParent:
|
|
52
|
-
isRoot:
|
|
94
|
+
isParent: isParentNode,
|
|
95
|
+
isRoot: isRootNode,
|
|
53
96
|
rowModified: false,
|
|
54
|
-
open:
|
|
97
|
+
open: isRootNode, // This will be recalculated later for non-root nodes
|
|
55
98
|
parent: row.parent,
|
|
56
99
|
}
|
|
57
100
|
}
|
|
@@ -148,7 +191,12 @@ export const createTableStore = (initData: {
|
|
|
148
191
|
const hasPinnedColumns = computed(() => columns.value.some(col => col.pinned))
|
|
149
192
|
const isGanttView = computed(() => config.value.view === 'gantt' || config.value.view === 'tree-gantt')
|
|
150
193
|
const isTreeView = computed(() => config.value.view === 'tree' || config.value.view === 'tree-gantt')
|
|
151
|
-
const isDependencyGraphEnabled = computed(() =>
|
|
194
|
+
const isDependencyGraphEnabled = computed(() => {
|
|
195
|
+
const currentConfig = config.value
|
|
196
|
+
return currentConfig.view === 'gantt' || currentConfig.view === 'tree-gantt'
|
|
197
|
+
? currentConfig.dependencyGraph !== false
|
|
198
|
+
: true
|
|
199
|
+
})
|
|
152
200
|
|
|
153
201
|
const numberedRowWidth = computed(() => {
|
|
154
202
|
const indent = Math.ceil(rows.value.length / 100 + 1)
|