@stonecrop/atable 0.13.4 → 0.13.6
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/assets/index.css +1 -1
- package/dist/atable.d.ts +8 -6
- package/dist/atable.js +1401 -1384
- package/dist/atable.js.map +1 -1
- package/dist/src/icons/index.d.ts.map +1 -1
- package/dist/src/icons/index.js +0 -6
- package/dist/src/schemaToColumns.d.ts.map +1 -1
- package/dist/src/schemaToColumns.js +2 -3
- package/dist/src/stores/table.d.ts +8 -6
- package/dist/src/stores/table.d.ts.map +1 -1
- package/dist/src/stores/table.js +97 -98
- package/package.json +11 -14
- package/src/components/ACell.vue +7 -8
- package/src/components/AGanttCell.vue +2 -2
- package/src/components/ATable.vue +7 -7
- package/src/components/ATableColumnFilter.vue +3 -3
- package/src/components/ATableModal.vue +1 -1
- package/src/icons/index.ts +6 -12
- package/src/schemaToColumns.ts +2 -3
- package/src/shims-vue.d.ts +5 -0
- package/src/stores/table.ts +108 -108
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/icons/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,OAAO,MAAM,iCAAiC,CAAA;AACrD,OAAO,UAAU,MAAM,oCAAoC,CAAA;AAC3D,OAAO,aAAa,MAAM,uCAAuC,CAAA;AACjE,OAAO,eAAe,MAAM,0CAA0C,CAAA;AACtE,OAAO,eAAe,MAAM,0CAA0C,CAAA;AACtE,OAAO,QAAQ,MAAM,kCAAkC,CAAA;AAEvD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAA;AAEzF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAO9C,CAAA"}
|
package/dist/src/icons/index.js
CHANGED
|
@@ -3,17 +3,11 @@
|
|
|
3
3
|
* Icons are exported as raw SVG strings for flexibility in rendering.
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
-
// @ts-expect-error Vite raw import
|
|
7
6
|
import AddIcon from './stonecrop-ui-icon-add.svg?raw';
|
|
8
|
-
// @ts-expect-error Vite raw import
|
|
9
7
|
import DeleteIcon from './stonecrop-ui-icon-delete.svg?raw';
|
|
10
|
-
// @ts-expect-error Vite raw import
|
|
11
8
|
import DuplicateIcon from './stonecrop-ui-icon-duplicate.svg?raw';
|
|
12
|
-
// @ts-expect-error Vite raw import
|
|
13
9
|
import InsertAboveIcon from './stonecrop-ui-icon-insert-above.svg?raw';
|
|
14
|
-
// @ts-expect-error Vite raw import
|
|
15
10
|
import InsertBelowIcon from './stonecrop-ui-icon-insert-below.svg?raw';
|
|
16
|
-
// @ts-expect-error Vite raw import
|
|
17
11
|
import MoveIcon from './stonecrop-ui-icon-move.svg?raw';
|
|
18
12
|
export { AddIcon, DeleteIcon, DuplicateIcon, InsertAboveIcon, InsertBelowIcon, MoveIcon };
|
|
19
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaToColumns.d.ts","sourceRoot":"","sources":["../../src/schemaToColumns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"schemaToColumns.d.ts","sourceRoot":"","sources":["../../src/schemaToColumns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,WAAW,EAAE,CA2BrE"}
|
|
@@ -19,7 +19,7 @@ export function schemaToColumns(schema) {
|
|
|
19
19
|
return schema
|
|
20
20
|
.filter(f => !f.hidden && f.fieldtype)
|
|
21
21
|
.map(({ fieldname, hidden: _hidden, ...rest }) => {
|
|
22
|
-
const col = { name: fieldname,
|
|
22
|
+
const col = Object.assign({ name: fieldname }, rest);
|
|
23
23
|
// Link fields: store the linked doctype for async resolution by ACell,
|
|
24
24
|
// and add a sync format that handles pre-resolved AFormLinkValue objects.
|
|
25
25
|
if (rest.fieldtype === 'Link' && !rest.cellComponent) {
|
|
@@ -32,8 +32,7 @@ export function schemaToColumns(schema) {
|
|
|
32
32
|
if (v === null || v === undefined)
|
|
33
33
|
return '';
|
|
34
34
|
if (typeof v === 'object') {
|
|
35
|
-
const
|
|
36
|
-
const display = rec.displayText ?? rec.id ?? '';
|
|
35
|
+
const display = v.displayText ?? v.id ?? '';
|
|
37
36
|
return typeof display === 'string' || typeof display === 'number' ? String(display) : '';
|
|
38
37
|
}
|
|
39
38
|
return String(v);
|
|
@@ -17,6 +17,7 @@ export interface FilterState {
|
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
19
|
export type FilterStateRecord = Record<number, FilterState>;
|
|
20
|
+
declare function getIndent(colIndex: number, indentLevel?: number): string;
|
|
20
21
|
/**
|
|
21
22
|
* Create a table store
|
|
22
23
|
* @param initData - Initial data for the table store
|
|
@@ -626,7 +627,7 @@ export declare const createTableStore: (initData: {
|
|
|
626
627
|
deleteConnection: (connectionId: string) => boolean;
|
|
627
628
|
deleteRow: (rowIndex: number) => TableRow | null;
|
|
628
629
|
duplicateRow: (rowIndex: number) => number;
|
|
629
|
-
getCellData:
|
|
630
|
+
getCellData: (colIndex: number, rowIndex: number) => any;
|
|
630
631
|
getCellDisplayValue: (colIndex: number, rowIndex: number) => any;
|
|
631
632
|
getConnectionsForBar: (barId: string) => {
|
|
632
633
|
id: string;
|
|
@@ -658,7 +659,7 @@ export declare const createTableStore: (initData: {
|
|
|
658
659
|
barId: string;
|
|
659
660
|
}[];
|
|
660
661
|
getHeaderCellStyle: (column: TableColumn) => CSSProperties;
|
|
661
|
-
getIndent:
|
|
662
|
+
getIndent: typeof getIndent;
|
|
662
663
|
getRowExpandSymbol: (rowIndex: number) => "" | "▼" | "►";
|
|
663
664
|
insertRowAbove: (rowIndex: number, rowData?: Partial<TableRow>) => number;
|
|
664
665
|
insertRowBelow: (rowIndex: number, rowData?: Partial<TableRow>) => number;
|
|
@@ -1273,7 +1274,7 @@ export declare const createTableStore: (initData: {
|
|
|
1273
1274
|
deleteConnection: (connectionId: string) => boolean;
|
|
1274
1275
|
deleteRow: (rowIndex: number) => TableRow | null;
|
|
1275
1276
|
duplicateRow: (rowIndex: number) => number;
|
|
1276
|
-
getCellData:
|
|
1277
|
+
getCellData: (colIndex: number, rowIndex: number) => any;
|
|
1277
1278
|
getCellDisplayValue: (colIndex: number, rowIndex: number) => any;
|
|
1278
1279
|
getConnectionsForBar: (barId: string) => {
|
|
1279
1280
|
id: string;
|
|
@@ -1305,7 +1306,7 @@ export declare const createTableStore: (initData: {
|
|
|
1305
1306
|
barId: string;
|
|
1306
1307
|
}[];
|
|
1307
1308
|
getHeaderCellStyle: (column: TableColumn) => CSSProperties;
|
|
1308
|
-
getIndent:
|
|
1309
|
+
getIndent: typeof getIndent;
|
|
1309
1310
|
getRowExpandSymbol: (rowIndex: number) => "" | "▼" | "►";
|
|
1310
1311
|
insertRowAbove: (rowIndex: number, rowData?: Partial<TableRow>) => number;
|
|
1311
1312
|
insertRowBelow: (rowIndex: number, rowData?: Partial<TableRow>) => number;
|
|
@@ -1920,7 +1921,7 @@ export declare const createTableStore: (initData: {
|
|
|
1920
1921
|
deleteConnection: (connectionId: string) => boolean;
|
|
1921
1922
|
deleteRow: (rowIndex: number) => TableRow | null;
|
|
1922
1923
|
duplicateRow: (rowIndex: number) => number;
|
|
1923
|
-
getCellData:
|
|
1924
|
+
getCellData: (colIndex: number, rowIndex: number) => any;
|
|
1924
1925
|
getCellDisplayValue: (colIndex: number, rowIndex: number) => any;
|
|
1925
1926
|
getConnectionsForBar: (barId: string) => {
|
|
1926
1927
|
id: string;
|
|
@@ -1952,7 +1953,7 @@ export declare const createTableStore: (initData: {
|
|
|
1952
1953
|
barId: string;
|
|
1953
1954
|
}[];
|
|
1954
1955
|
getHeaderCellStyle: (column: TableColumn) => CSSProperties;
|
|
1955
|
-
getIndent:
|
|
1956
|
+
getIndent: typeof getIndent;
|
|
1956
1957
|
getRowExpandSymbol: (rowIndex: number) => "" | "▼" | "►";
|
|
1957
1958
|
insertRowAbove: (rowIndex: number, rowData?: Partial<TableRow>) => number;
|
|
1958
1959
|
insertRowBelow: (rowIndex: number, rowData?: Partial<TableRow>) => number;
|
|
@@ -1972,4 +1973,5 @@ export declare const createTableStore: (initData: {
|
|
|
1972
1973
|
updateGanttBar: (event: GanttDragEvent) => void;
|
|
1973
1974
|
updateRows: (newRows: TableRow[]) => void;
|
|
1974
1975
|
}, "addRow" | "clearFilter" | "closeModal" | "createConnection" | "deleteConnection" | "deleteRow" | "duplicateRow" | "getCellData" | "getCellDisplayValue" | "getConnectionsForBar" | "getFormattedValue" | "getHandlesForBar" | "getHeaderCellStyle" | "getIndent" | "getRowExpandSymbol" | "insertRowAbove" | "insertRowBelow" | "isRowGantt" | "isRowVisible" | "moveRow" | "registerConnectionHandle" | "registerGanttBar" | "resizeColumn" | "setCellData" | "setCellText" | "setFilter" | "sortByColumn" | "toggleRowExpand" | "unregisterConnectionHandle" | "unregisterGanttBar" | "updateGanttBar" | "updateRows">>;
|
|
1976
|
+
export {};
|
|
1975
1977
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -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;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,4BAA4B;IAC5B,KAAK,EAAE,GAAG,CAAA;IACV,yCAAyC;IACzC,UAAU,CAAC,EAAE,GAAG,CAAA;IAChB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,GAAG,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;
|
|
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;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,4BAA4B;IAC5B,KAAK,EAAE,GAAG,CAAA;IACV,yCAAyC;IACzC,UAAU,CAAC,EAAE,GAAG,CAAA;IAChB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,GAAG,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AA+F3D,iBAAS,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAMjE;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAg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B,MAAM;4BAjCV,cAAc;0BAzJhB,QAAQ,EAAE;6lBA2iBxC,CAAA"}
|
package/dist/src/stores/table.js
CHANGED
|
@@ -1,6 +1,97 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
2
|
import { computed, ref } from 'vue';
|
|
3
3
|
import { generateHash } from '../utils';
|
|
4
|
+
function isNodeOpen(rowIndex, treeDisplay) {
|
|
5
|
+
const row = treeDisplay[rowIndex];
|
|
6
|
+
if (row.isRoot) {
|
|
7
|
+
return true; // Root nodes are always open
|
|
8
|
+
}
|
|
9
|
+
if (row.parent === null || row.parent === undefined) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
const parentIndex = row.parent;
|
|
13
|
+
if (parentIndex < 0 || parentIndex >= treeDisplay.length) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const parent = treeDisplay[parentIndex];
|
|
17
|
+
// Node is open if parent's children are open AND parent itself is open
|
|
18
|
+
return (parent.childrenOpen || false) && isNodeOpen(parentIndex, treeDisplay);
|
|
19
|
+
}
|
|
20
|
+
function applyFilter(cellValue, filter, column) {
|
|
21
|
+
const filterType = column.filterType || 'text';
|
|
22
|
+
const value = filter.value;
|
|
23
|
+
if (!value && filterType !== 'dateRange' && filterType !== 'checkbox')
|
|
24
|
+
return true;
|
|
25
|
+
switch (filterType) {
|
|
26
|
+
case 'text': {
|
|
27
|
+
const searchableText = typeof cellValue === 'object' && cellValue !== null
|
|
28
|
+
? Object.values(cellValue).join(' ')
|
|
29
|
+
: String(cellValue || '');
|
|
30
|
+
return searchableText.toLowerCase().includes(String(value).toLowerCase());
|
|
31
|
+
}
|
|
32
|
+
case 'number': {
|
|
33
|
+
const numValue = Number(cellValue);
|
|
34
|
+
const filterNum = Number(value);
|
|
35
|
+
return !isNaN(numValue) && !isNaN(filterNum) && numValue === filterNum;
|
|
36
|
+
}
|
|
37
|
+
case 'select':
|
|
38
|
+
return cellValue === value;
|
|
39
|
+
case 'checkbox':
|
|
40
|
+
// For checkbox filter, if checked (true), show only truthy values
|
|
41
|
+
// If unchecked (false/undefined), show all values
|
|
42
|
+
if (value === true) {
|
|
43
|
+
return !!cellValue;
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
case 'date': {
|
|
47
|
+
// Handle both timestamp numbers and date strings
|
|
48
|
+
let cellDate;
|
|
49
|
+
if (typeof cellValue === 'number') {
|
|
50
|
+
// Apply the same year transformation as in the format function
|
|
51
|
+
const originalDate = new Date(cellValue);
|
|
52
|
+
const currentYear = new Date().getFullYear();
|
|
53
|
+
cellDate = new Date(currentYear, originalDate.getMonth(), originalDate.getDate());
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
cellDate = new Date(String(cellValue));
|
|
57
|
+
}
|
|
58
|
+
const filterDate = new Date(String(value));
|
|
59
|
+
return cellDate.toDateString() === filterDate.toDateString();
|
|
60
|
+
}
|
|
61
|
+
case 'dateRange': {
|
|
62
|
+
const startValue = filter.startValue;
|
|
63
|
+
const endValue = filter.endValue;
|
|
64
|
+
if (!startValue && !endValue)
|
|
65
|
+
return true;
|
|
66
|
+
// Handle both timestamp numbers and date strings
|
|
67
|
+
let cellDateRange;
|
|
68
|
+
if (typeof cellValue === 'number') {
|
|
69
|
+
// Apply the same year transformation as in the format function
|
|
70
|
+
const originalDate = new Date(cellValue);
|
|
71
|
+
const currentYear = new Date().getFullYear();
|
|
72
|
+
cellDateRange = new Date(currentYear, originalDate.getMonth(), originalDate.getDate());
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
cellDateRange = new Date(String(cellValue));
|
|
76
|
+
}
|
|
77
|
+
if (startValue && cellDateRange < new Date(String(startValue)))
|
|
78
|
+
return false;
|
|
79
|
+
if (endValue && cellDateRange > new Date(String(endValue)))
|
|
80
|
+
return false;
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
default:
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function getIndent(colIndex, indentLevel) {
|
|
88
|
+
if (indentLevel && colIndex === 0 && indentLevel > 0) {
|
|
89
|
+
return `${indentLevel}ch`;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
return 'inherit';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
4
95
|
/**
|
|
5
96
|
* Create a table store
|
|
6
97
|
* @param initData - Initial data for the table store
|
|
@@ -81,13 +172,13 @@ export const createTableStore = (initData) => {
|
|
|
81
172
|
const rowModifications = ref({});
|
|
82
173
|
const rowExpandStates = ref({});
|
|
83
174
|
const table = computed(() => {
|
|
84
|
-
const
|
|
175
|
+
const tableData = {};
|
|
85
176
|
for (const [colIndex, column] of columns.value.entries()) {
|
|
86
177
|
for (const [rowIndex, row] of rows.value.entries()) {
|
|
87
|
-
|
|
178
|
+
tableData[`${colIndex}:${rowIndex}`] = row[column.name];
|
|
88
179
|
}
|
|
89
180
|
}
|
|
90
|
-
return
|
|
181
|
+
return tableData;
|
|
91
182
|
});
|
|
92
183
|
const display = computed({
|
|
93
184
|
get: () => {
|
|
@@ -109,22 +200,6 @@ export const createTableStore = (initData) => {
|
|
|
109
200
|
// Calculate 'open' property for tree view based on parent's childrenOpen state
|
|
110
201
|
if (isTreeView.value) {
|
|
111
202
|
// Helper function to check if all ancestors are open
|
|
112
|
-
const isNodeOpen = (rowIndex, display) => {
|
|
113
|
-
const row = display[rowIndex];
|
|
114
|
-
if (row.isRoot) {
|
|
115
|
-
return true; // Root nodes are always open
|
|
116
|
-
}
|
|
117
|
-
if (row.parent === null || row.parent === undefined) {
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
const parentIndex = row.parent;
|
|
121
|
-
if (parentIndex < 0 || parentIndex >= display.length) {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
const parent = display[parentIndex];
|
|
125
|
-
// Node is open if parent's children are open AND parent itself is open
|
|
126
|
-
return (parent.childrenOpen || false) && isNodeOpen(parentIndex, display);
|
|
127
|
-
};
|
|
128
203
|
for (let i = 0; i < baseDisplay.length; i++) {
|
|
129
204
|
const row = baseDisplay[i];
|
|
130
205
|
if (!row.isRoot) {
|
|
@@ -333,9 +408,9 @@ export const createTableStore = (initData) => {
|
|
|
333
408
|
case 'Check':
|
|
334
409
|
return value ? '✓' : '✗';
|
|
335
410
|
case 'Date':
|
|
336
|
-
return value != null ? new Date(value).toLocaleDateString() : value;
|
|
411
|
+
return value != null ? new Date(String(value)).toLocaleDateString() : value;
|
|
337
412
|
case 'Datetime':
|
|
338
|
-
return value != null ? new Date(value).toLocaleString() : value;
|
|
413
|
+
return value != null ? new Date(String(value)).toLocaleString() : value;
|
|
339
414
|
default:
|
|
340
415
|
return value;
|
|
341
416
|
}
|
|
@@ -345,7 +420,7 @@ export const createTableStore = (initData) => {
|
|
|
345
420
|
}
|
|
346
421
|
else if (typeof format === 'string') {
|
|
347
422
|
// parse format function from string
|
|
348
|
-
//
|
|
423
|
+
// oxlint-disable-next-line @typescript-eslint/no-implied-eval
|
|
349
424
|
const formatFn = Function(`"use strict";return (${format})`)();
|
|
350
425
|
return formatFn(value, { table: table.value, row, column });
|
|
351
426
|
}
|
|
@@ -363,14 +438,6 @@ export const createTableStore = (initData) => {
|
|
|
363
438
|
modal.value.visible = false;
|
|
364
439
|
}
|
|
365
440
|
};
|
|
366
|
-
const getIndent = (colIndex, indentLevel) => {
|
|
367
|
-
if (indentLevel && colIndex === 0 && indentLevel > 0) {
|
|
368
|
-
return `${indentLevel}ch`;
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
return 'inherit';
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
441
|
const updateGanttBar = (event) => {
|
|
375
442
|
// update the local gantt bar cache
|
|
376
443
|
const ganttBar = rows.value[event.rowIndex]?.gantt;
|
|
@@ -432,7 +499,6 @@ export const createTableStore = (initData) => {
|
|
|
432
499
|
const fromHandle = connectionHandles.value.find(h => h.id === fromHandleId);
|
|
433
500
|
const toHandle = connectionHandles.value.find(h => h.id === toHandleId);
|
|
434
501
|
if (!fromHandle || !toHandle) {
|
|
435
|
-
// eslint-disable-next-line no-console
|
|
436
502
|
console.warn('Cannot create connection: handle not found');
|
|
437
503
|
return null;
|
|
438
504
|
}
|
|
@@ -487,73 +553,6 @@ export const createTableStore = (initData) => {
|
|
|
487
553
|
// Note: The actual sorting is now handled in the filteredRows computed property
|
|
488
554
|
// This ensures that sorting works on filtered data without modifying the original rows
|
|
489
555
|
};
|
|
490
|
-
const applyFilter = (cellValue, filter, column) => {
|
|
491
|
-
const filterType = column.filterType || 'text';
|
|
492
|
-
const value = filter.value;
|
|
493
|
-
if (!value && filterType !== 'dateRange' && filterType !== 'checkbox')
|
|
494
|
-
return true;
|
|
495
|
-
switch (filterType) {
|
|
496
|
-
case 'text': {
|
|
497
|
-
const searchableText = typeof cellValue === 'object' && cellValue !== null
|
|
498
|
-
? Object.values(cellValue).join(' ')
|
|
499
|
-
: String(cellValue || '');
|
|
500
|
-
return searchableText.toLowerCase().includes(String(value).toLowerCase());
|
|
501
|
-
}
|
|
502
|
-
case 'number': {
|
|
503
|
-
const numValue = Number(cellValue);
|
|
504
|
-
const filterNum = Number(value);
|
|
505
|
-
return !isNaN(numValue) && !isNaN(filterNum) && numValue === filterNum;
|
|
506
|
-
}
|
|
507
|
-
case 'select':
|
|
508
|
-
return cellValue === value;
|
|
509
|
-
case 'checkbox':
|
|
510
|
-
// For checkbox filter, if checked (true), show only truthy values
|
|
511
|
-
// If unchecked (false/undefined), show all values
|
|
512
|
-
if (value === true) {
|
|
513
|
-
return !!cellValue;
|
|
514
|
-
}
|
|
515
|
-
return true;
|
|
516
|
-
case 'date': {
|
|
517
|
-
// Handle both timestamp numbers and date strings
|
|
518
|
-
let cellDate;
|
|
519
|
-
if (typeof cellValue === 'number') {
|
|
520
|
-
// Apply the same year transformation as in the format function
|
|
521
|
-
const originalDate = new Date(cellValue);
|
|
522
|
-
const currentYear = new Date().getFullYear();
|
|
523
|
-
cellDate = new Date(currentYear, originalDate.getMonth(), originalDate.getDate());
|
|
524
|
-
}
|
|
525
|
-
else {
|
|
526
|
-
cellDate = new Date(String(cellValue));
|
|
527
|
-
}
|
|
528
|
-
const filterDate = new Date(String(value));
|
|
529
|
-
return cellDate.toDateString() === filterDate.toDateString();
|
|
530
|
-
}
|
|
531
|
-
case 'dateRange': {
|
|
532
|
-
const startValue = filter.startValue;
|
|
533
|
-
const endValue = filter.endValue;
|
|
534
|
-
if (!startValue && !endValue)
|
|
535
|
-
return true;
|
|
536
|
-
// Handle both timestamp numbers and date strings
|
|
537
|
-
let cellDateRange;
|
|
538
|
-
if (typeof cellValue === 'number') {
|
|
539
|
-
// Apply the same year transformation as in the format function
|
|
540
|
-
const originalDate = new Date(cellValue);
|
|
541
|
-
const currentYear = new Date().getFullYear();
|
|
542
|
-
cellDateRange = new Date(currentYear, originalDate.getMonth(), originalDate.getDate());
|
|
543
|
-
}
|
|
544
|
-
else {
|
|
545
|
-
cellDateRange = new Date(String(cellValue));
|
|
546
|
-
}
|
|
547
|
-
if (startValue && cellDateRange < new Date(String(startValue)))
|
|
548
|
-
return false;
|
|
549
|
-
if (endValue && cellDateRange > new Date(String(endValue)))
|
|
550
|
-
return false;
|
|
551
|
-
return true;
|
|
552
|
-
}
|
|
553
|
-
default:
|
|
554
|
-
return true;
|
|
555
|
-
}
|
|
556
|
-
};
|
|
557
556
|
const setFilter = (colIndex, filter) => {
|
|
558
557
|
if (!filter.value && !filter.startValue && !filter.endValue) {
|
|
559
558
|
// Remove filter if empty
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/atable",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -35,16 +35,15 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@vueuse/components": "^14.2.1",
|
|
37
37
|
"@vueuse/core": "^14.2.1",
|
|
38
|
-
"@stonecrop/schema": "0.13.
|
|
39
|
-
"@stonecrop/
|
|
40
|
-
"@stonecrop/
|
|
38
|
+
"@stonecrop/schema": "0.13.6",
|
|
39
|
+
"@stonecrop/themes": "0.13.6",
|
|
40
|
+
"@stonecrop/utilities": "0.13.6"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"pinia": "^3.0.4",
|
|
44
44
|
"vue": "^3.5.33"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@eslint/js": "^10.0.1",
|
|
48
47
|
"@microsoft/api-documenter": "^7.30.5",
|
|
49
48
|
"@rushstack/heft": "^1.2.17",
|
|
50
49
|
"@types/node": "^24.12.4",
|
|
@@ -52,18 +51,15 @@
|
|
|
52
51
|
"@vitest/coverage-istanbul": "^4.1.5",
|
|
53
52
|
"@vitest/ui": "^4.1.5",
|
|
54
53
|
"@vue/test-utils": "^2.4.10",
|
|
55
|
-
"eslint-config-prettier": "^10.1.8",
|
|
56
|
-
"eslint-plugin-vue": "^10.9.0",
|
|
57
|
-
"eslint": "^10.3.0",
|
|
58
|
-
"globals": "^17.6.0",
|
|
59
54
|
"jsdom": "^29.1.1",
|
|
55
|
+
"oxlint": "1.67.0",
|
|
56
|
+
"oxlint-tsgolint": "0.23.0",
|
|
57
|
+
"pinia": "^3.0.4",
|
|
60
58
|
"typescript": "^6.0.3",
|
|
61
|
-
"typescript-eslint": "^8.59.1",
|
|
62
|
-
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
63
59
|
"vite": "^7.3.2",
|
|
64
|
-
"
|
|
65
|
-
"vue": "^3.5.33",
|
|
60
|
+
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
66
61
|
"vitest": "^4.1.5",
|
|
62
|
+
"vue": "^3.5.33",
|
|
67
63
|
"vue-router": "^5.0.6",
|
|
68
64
|
"stonecrop-rig": "0.7.0"
|
|
69
65
|
},
|
|
@@ -78,7 +74,8 @@
|
|
|
78
74
|
"build": "heft build && vite build && rushx docs",
|
|
79
75
|
"dev": "vite",
|
|
80
76
|
"docs": "bash ../common/scripts/run-docs.sh atable",
|
|
81
|
-
"lint": "
|
|
77
|
+
"lint": "oxlint",
|
|
78
|
+
"lint:fix": "oxlint --fix",
|
|
82
79
|
"preview": "vite preview",
|
|
83
80
|
"test": "vitest run --coverage.enabled false",
|
|
84
81
|
"test:watch": "vitest watch",
|
package/src/components/ACell.vue
CHANGED
|
@@ -88,6 +88,7 @@ onMounted(() => {
|
|
|
88
88
|
if (!resolver || typeof raw !== 'string' || raw === '') return
|
|
89
89
|
void resolver(column.linkDoctype, raw).then(text => {
|
|
90
90
|
if (text != null) resolvedText.value = text
|
|
91
|
+
return text
|
|
91
92
|
})
|
|
92
93
|
})
|
|
93
94
|
|
|
@@ -156,13 +157,11 @@ const showModal = () => {
|
|
|
156
157
|
if (addNavigation) {
|
|
157
158
|
let handlers = {
|
|
158
159
|
...defaultKeypressHandlers,
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
'keydown.alt.right': showModal,
|
|
165
|
-
},
|
|
160
|
+
'keydown.f2': showModal,
|
|
161
|
+
'keydown.alt.up': showModal,
|
|
162
|
+
'keydown.alt.down': showModal,
|
|
163
|
+
'keydown.alt.left': showModal,
|
|
164
|
+
'keydown.alt.right': showModal,
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
if (typeof addNavigation === 'object') {
|
|
@@ -303,7 +302,7 @@ const updateCellData = (payload: Event) => {
|
|
|
303
302
|
|
|
304
303
|
// Use nextTick to restore cursor position after Vue's reactive updates but before browser repaint
|
|
305
304
|
void nextTick().then(() => {
|
|
306
|
-
restoreCursorPosition(cursorPosition)
|
|
305
|
+
return restoreCursorPosition(cursorPosition)
|
|
307
306
|
})
|
|
308
307
|
}
|
|
309
308
|
|
|
@@ -397,8 +397,8 @@ function startConnectionDrag(side: 'left' | 'right', event: MouseEvent) {
|
|
|
397
397
|
dragPreview.value.endY = moveEvent.clientY
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
const handleMouseUp = (
|
|
401
|
-
handleConnectionDrop(
|
|
400
|
+
const handleMouseUp = (upEvent: MouseEvent) => {
|
|
401
|
+
handleConnectionDrop(upEvent, side)
|
|
402
402
|
cleanupConnectionDrag(handleMouseMove, handleMouseUp)
|
|
403
403
|
}
|
|
404
404
|
|
|
@@ -152,10 +152,10 @@ const store = createTableStore({
|
|
|
152
152
|
linkResolver: linkResolver ?? injectedLinkResolver,
|
|
153
153
|
})
|
|
154
154
|
|
|
155
|
-
store.$onAction(({ name, store, args, after }) => {
|
|
155
|
+
store.$onAction(({ name, store: storeInstance, args, after }) => {
|
|
156
156
|
if (name === 'setCellData' || name === 'setCellText') {
|
|
157
157
|
const [colIndex, rowIndex, newValue] = args
|
|
158
|
-
const oldValue =
|
|
158
|
+
const oldValue = storeInstance.getCellData(colIndex, rowIndex)
|
|
159
159
|
after(() => {
|
|
160
160
|
// Update rows model to trigger update:rows event
|
|
161
161
|
rows.value = [...store.rows]
|
|
@@ -241,18 +241,18 @@ const assignStickyCellWidths = () => {
|
|
|
241
241
|
// pin cells in row that are sticky
|
|
242
242
|
for (const row of table?.rows || []) {
|
|
243
243
|
let totalWidth = 0
|
|
244
|
-
const
|
|
244
|
+
const pinnedCells: HTMLTableCellElement[] = []
|
|
245
245
|
|
|
246
246
|
for (const column of row.cells) {
|
|
247
247
|
if (column.classList.contains('sticky-column') || column.classList.contains('sticky-index')) {
|
|
248
248
|
column.style.left = `${totalWidth}px`
|
|
249
249
|
totalWidth += column.offsetWidth
|
|
250
|
-
|
|
250
|
+
pinnedCells.push(column)
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
if (
|
|
255
|
-
const lastColumn =
|
|
254
|
+
if (pinnedCells.length > 0) {
|
|
255
|
+
const lastColumn = pinnedCells[pinnedCells.length - 1]
|
|
256
256
|
lastColumn.classList.add('sticky-column-edge')
|
|
257
257
|
}
|
|
258
258
|
}
|
|
@@ -268,7 +268,7 @@ window.addEventListener('keydown', (event: KeyboardEvent) => {
|
|
|
268
268
|
if ($parent) {
|
|
269
269
|
// wait for the modal to close before focusing
|
|
270
270
|
void nextTick().then(() => {
|
|
271
|
-
$parent.focus()
|
|
271
|
+
return $parent.focus()
|
|
272
272
|
})
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -103,13 +103,13 @@ const resolvedFilterType = computed(() => {
|
|
|
103
103
|
}
|
|
104
104
|
})
|
|
105
105
|
|
|
106
|
-
const getSelectOptions = (
|
|
107
|
-
if (
|
|
106
|
+
const getSelectOptions = (col: TableColumn): any[] => {
|
|
107
|
+
if (col.filterOptions) return col.filterOptions
|
|
108
108
|
|
|
109
109
|
// Auto-generate options from data
|
|
110
110
|
const uniqueValues = new Set<any>()
|
|
111
111
|
store.rows.forEach(row => {
|
|
112
|
-
const value = row[
|
|
112
|
+
const value = row[col.name]
|
|
113
113
|
if (value !== null && value !== undefined && value !== '') {
|
|
114
114
|
uniqueValues.add(value)
|
|
115
115
|
}
|
|
@@ -16,7 +16,7 @@ const amodalRef = useTemplateRef('amodal')
|
|
|
16
16
|
const { width: modalWidth, height: modalHeight } = useElementBounding(amodalRef)
|
|
17
17
|
|
|
18
18
|
const amodalStyles = computed((): StyleValue => {
|
|
19
|
-
if (!(store.modal.height && store.modal.width && store.modal.left && store.modal.bottom)) return
|
|
19
|
+
if (!(store.modal.height && store.modal.width && store.modal.left && store.modal.bottom)) return {}
|
|
20
20
|
|
|
21
21
|
const table = store.modal.cell?.closest('table')
|
|
22
22
|
if (!table) return {}
|
package/src/icons/index.ts
CHANGED
|
@@ -4,17 +4,11 @@
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
// @ts-expect-error Vite raw import
|
|
8
7
|
import AddIcon from './stonecrop-ui-icon-add.svg?raw'
|
|
9
|
-
// @ts-expect-error Vite raw import
|
|
10
8
|
import DeleteIcon from './stonecrop-ui-icon-delete.svg?raw'
|
|
11
|
-
// @ts-expect-error Vite raw import
|
|
12
9
|
import DuplicateIcon from './stonecrop-ui-icon-duplicate.svg?raw'
|
|
13
|
-
// @ts-expect-error Vite raw import
|
|
14
10
|
import InsertAboveIcon from './stonecrop-ui-icon-insert-above.svg?raw'
|
|
15
|
-
// @ts-expect-error Vite raw import
|
|
16
11
|
import InsertBelowIcon from './stonecrop-ui-icon-insert-below.svg?raw'
|
|
17
|
-
// @ts-expect-error Vite raw import
|
|
18
12
|
import MoveIcon from './stonecrop-ui-icon-move.svg?raw'
|
|
19
13
|
|
|
20
14
|
export { AddIcon, DeleteIcon, DuplicateIcon, InsertAboveIcon, InsertBelowIcon, MoveIcon }
|
|
@@ -25,10 +19,10 @@ export { AddIcon, DeleteIcon, DuplicateIcon, InsertAboveIcon, InsertBelowIcon, M
|
|
|
25
19
|
* @public
|
|
26
20
|
*/
|
|
27
21
|
export const actionIcons: Record<string, string> = {
|
|
28
|
-
add: AddIcon
|
|
29
|
-
delete: DeleteIcon
|
|
30
|
-
duplicate: DuplicateIcon
|
|
31
|
-
insertAbove: InsertAboveIcon
|
|
32
|
-
insertBelow: InsertBelowIcon
|
|
33
|
-
move: MoveIcon
|
|
22
|
+
add: AddIcon,
|
|
23
|
+
delete: DeleteIcon,
|
|
24
|
+
duplicate: DuplicateIcon,
|
|
25
|
+
insertAbove: InsertAboveIcon,
|
|
26
|
+
insertBelow: InsertBelowIcon,
|
|
27
|
+
move: MoveIcon,
|
|
34
28
|
}
|
package/src/schemaToColumns.ts
CHANGED
|
@@ -23,7 +23,7 @@ export function schemaToColumns(schema: ColumnSchema[]): TableColumn[] {
|
|
|
23
23
|
return schema
|
|
24
24
|
.filter(f => !f.hidden && f.fieldtype)
|
|
25
25
|
.map(({ fieldname, hidden: _hidden, ...rest }) => {
|
|
26
|
-
const col: TableColumn = { name: fieldname,
|
|
26
|
+
const col: TableColumn = Object.assign({ name: fieldname }, rest)
|
|
27
27
|
|
|
28
28
|
// Link fields: store the linked doctype for async resolution by ACell,
|
|
29
29
|
// and add a sync format that handles pre-resolved AFormLinkValue objects.
|
|
@@ -36,8 +36,7 @@ export function schemaToColumns(schema: ColumnSchema[]): TableColumn[] {
|
|
|
36
36
|
col.format = (v: any): string => {
|
|
37
37
|
if (v === null || v === undefined) return ''
|
|
38
38
|
if (typeof v === 'object') {
|
|
39
|
-
const
|
|
40
|
-
const display = rec.displayText ?? rec.id ?? ''
|
|
39
|
+
const display: unknown = v.displayText ?? v.id ?? ''
|
|
41
40
|
return typeof display === 'string' || typeof display === 'number' ? String(display) : ''
|
|
42
41
|
}
|
|
43
42
|
return String(v)
|