@stonecrop/atable 0.11.9 → 0.12.0
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 +58 -52
- package/dist/assets/index.css +1 -1
- package/dist/atable.d.ts +83 -188
- package/dist/atable.js +1087 -1047
- package/dist/atable.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/schemaToColumns.d.ts +16 -0
- package/dist/src/schemaToColumns.d.ts.map +1 -0
- package/dist/src/schemaToColumns.js +20 -0
- package/dist/src/stores/table.d.ts +42 -42
- package/dist/src/stores/table.d.ts.map +1 -1
- package/dist/src/stores/table.js +10 -1
- package/dist/src/types/index.d.ts +27 -146
- package/dist/src/types/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/components/ATable.vue +15 -5
- package/src/components/ATableColumnFilter.vue +30 -8
- package/src/index.ts +1 -0
- package/src/schemaToColumns.ts +24 -0
- package/src/stores/table.ts +10 -1
- package/src/types/index.ts +28 -165
package/dist/src/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import ATableModal from './components/ATableModal.vue';
|
|
|
12
12
|
export { createTableStore } from './stores/table';
|
|
13
13
|
export type { FilterState, FilterStateRecord } from './stores/table';
|
|
14
14
|
export type * from './types';
|
|
15
|
+
export { schemaToColumns } from './schemaToColumns';
|
|
15
16
|
export { AddIcon, DeleteIcon, DuplicateIcon, InsertAboveIcon, InsertBelowIcon, MoveIcon, actionIcons } from './icons';
|
|
16
17
|
/**
|
|
17
18
|
* Install all ATable components
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,OAAO,KAAK,MAAM,wBAAwB,CAAA;AAC1C,OAAO,aAAa,MAA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AAa,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErH;;;;GAIG;AACH,iBAAS,OAAO,CAAC,GAAG,EAAE,GAAG,QAWxB;AAED,OAAO,EACN,KAAK,EACL,aAAa,EACb,UAAU,EACV,IAAI,EACJ,WAAW,EACX,MAAM,EACN,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,OAAO,GACP,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import ATableLoading from './components/ATableLoading.vue';
|
|
|
9
9
|
import ATableLoadingBar from './components/ATableLoadingBar.vue';
|
|
10
10
|
import ATableModal from './components/ATableModal.vue';
|
|
11
11
|
export { createTableStore } from './stores/table';
|
|
12
|
+
export { schemaToColumns } from './schemaToColumns';
|
|
12
13
|
// Icon exports
|
|
13
14
|
export { AddIcon, DeleteIcon, DuplicateIcon, InsertAboveIcon, InsertBelowIcon, MoveIcon, actionIcons } from './icons';
|
|
14
15
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ColumnSchema } from '@stonecrop/schema';
|
|
2
|
+
import type { TableColumn } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Convert an array of doctype field descriptors into ATable column definitions.
|
|
5
|
+
*
|
|
6
|
+
* Fields are excluded when:
|
|
7
|
+
* - `hidden: true` — field should not be visible in any view
|
|
8
|
+
* - no `fieldtype` — non-scalar entry (nested table or fieldset), has no column equivalent
|
|
9
|
+
*
|
|
10
|
+
* `fieldname` is renamed to `name`; `hidden` is stripped. All other `ColumnSchema` properties
|
|
11
|
+
* spread through automatically.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export declare function schemaToColumns(schema: ColumnSchema[]): TableColumn[];
|
|
16
|
+
//# sourceMappingURL=schemaToColumns.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,WAAW,EAAE,CAOrE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert an array of doctype field descriptors into ATable column definitions.
|
|
3
|
+
*
|
|
4
|
+
* Fields are excluded when:
|
|
5
|
+
* - `hidden: true` — field should not be visible in any view
|
|
6
|
+
* - no `fieldtype` — non-scalar entry (nested table or fieldset), has no column equivalent
|
|
7
|
+
*
|
|
8
|
+
* `fieldname` is renamed to `name`; `hidden` is stripped. All other `ColumnSchema` properties
|
|
9
|
+
* spread through automatically.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export function schemaToColumns(schema) {
|
|
14
|
+
return schema
|
|
15
|
+
.filter(f => !f.hidden && f.fieldtype)
|
|
16
|
+
.map(({ fieldname, hidden: _hidden, ...rest }) => ({
|
|
17
|
+
name: fieldname,
|
|
18
|
+
...rest,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
@@ -32,10 +32,14 @@ export declare const createTableStore: (initData: {
|
|
|
32
32
|
}) => import("pinia").Store<`table-${string}`, Pick<{
|
|
33
33
|
columns: import("vue").Ref<{
|
|
34
34
|
name: string;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
36
|
+
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
37
|
+
mask?: ((value: any) => any) | undefined;
|
|
38
|
+
readonly originalIndex?: number | undefined;
|
|
38
39
|
fieldtype?: string | undefined;
|
|
40
|
+
label?: string | undefined;
|
|
41
|
+
align?: "left" | "right" | "center" | "start" | "end" | undefined;
|
|
42
|
+
edit?: boolean | undefined;
|
|
39
43
|
width?: string | undefined;
|
|
40
44
|
pinned?: boolean | undefined;
|
|
41
45
|
resizable?: boolean | undefined;
|
|
@@ -46,20 +50,20 @@ export declare const createTableStore: (initData: {
|
|
|
46
50
|
filterComponent?: string | undefined;
|
|
47
51
|
cellComponent?: string | undefined;
|
|
48
52
|
cellComponentProps?: Record<string, any> | undefined;
|
|
49
|
-
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
50
53
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
51
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
52
|
-
mask?: ((value: any) => any) | undefined;
|
|
53
54
|
isGantt?: boolean | undefined;
|
|
54
55
|
ganttComponent?: string | undefined;
|
|
55
56
|
colspan?: number | undefined;
|
|
56
|
-
originalIndex?: number | undefined;
|
|
57
57
|
}[], TableColumn[] | {
|
|
58
58
|
name: string;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
60
|
+
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
61
|
+
mask?: ((value: any) => any) | undefined;
|
|
62
|
+
readonly originalIndex?: number | undefined;
|
|
62
63
|
fieldtype?: string | undefined;
|
|
64
|
+
label?: string | undefined;
|
|
65
|
+
align?: "left" | "right" | "center" | "start" | "end" | undefined;
|
|
66
|
+
edit?: boolean | undefined;
|
|
63
67
|
width?: string | undefined;
|
|
64
68
|
pinned?: boolean | undefined;
|
|
65
69
|
resizable?: boolean | undefined;
|
|
@@ -70,14 +74,10 @@ export declare const createTableStore: (initData: {
|
|
|
70
74
|
filterComponent?: string | undefined;
|
|
71
75
|
cellComponent?: string | undefined;
|
|
72
76
|
cellComponentProps?: Record<string, any> | undefined;
|
|
73
|
-
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
74
77
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
75
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
76
|
-
mask?: ((value: any) => any) | undefined;
|
|
77
78
|
isGantt?: boolean | undefined;
|
|
78
79
|
ganttComponent?: string | undefined;
|
|
79
80
|
colspan?: number | undefined;
|
|
80
|
-
originalIndex?: number | undefined;
|
|
81
81
|
}[]>;
|
|
82
82
|
config: import("vue").Ref<{
|
|
83
83
|
view?: "uncounted" | "list" | "list-expansion" | undefined;
|
|
@@ -676,10 +676,14 @@ export declare const createTableStore: (initData: {
|
|
|
676
676
|
}, "columns" | "config" | "connectionHandles" | "connectionPaths" | "filterState" | "ganttBars" | "modal" | "rows" | "sortState" | "updates">, Pick<{
|
|
677
677
|
columns: import("vue").Ref<{
|
|
678
678
|
name: string;
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
679
|
+
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
680
|
+
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
681
|
+
mask?: ((value: any) => any) | undefined;
|
|
682
|
+
readonly originalIndex?: number | undefined;
|
|
682
683
|
fieldtype?: string | undefined;
|
|
684
|
+
label?: string | undefined;
|
|
685
|
+
align?: "left" | "right" | "center" | "start" | "end" | undefined;
|
|
686
|
+
edit?: boolean | undefined;
|
|
683
687
|
width?: string | undefined;
|
|
684
688
|
pinned?: boolean | undefined;
|
|
685
689
|
resizable?: boolean | undefined;
|
|
@@ -690,20 +694,20 @@ export declare const createTableStore: (initData: {
|
|
|
690
694
|
filterComponent?: string | undefined;
|
|
691
695
|
cellComponent?: string | undefined;
|
|
692
696
|
cellComponentProps?: Record<string, any> | undefined;
|
|
693
|
-
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
694
697
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
695
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
696
|
-
mask?: ((value: any) => any) | undefined;
|
|
697
698
|
isGantt?: boolean | undefined;
|
|
698
699
|
ganttComponent?: string | undefined;
|
|
699
700
|
colspan?: number | undefined;
|
|
700
|
-
originalIndex?: number | undefined;
|
|
701
701
|
}[], TableColumn[] | {
|
|
702
702
|
name: string;
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
703
|
+
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
704
|
+
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
705
|
+
mask?: ((value: any) => any) | undefined;
|
|
706
|
+
readonly originalIndex?: number | undefined;
|
|
706
707
|
fieldtype?: string | undefined;
|
|
708
|
+
label?: string | undefined;
|
|
709
|
+
align?: "left" | "right" | "center" | "start" | "end" | undefined;
|
|
710
|
+
edit?: boolean | undefined;
|
|
707
711
|
width?: string | undefined;
|
|
708
712
|
pinned?: boolean | undefined;
|
|
709
713
|
resizable?: boolean | undefined;
|
|
@@ -714,14 +718,10 @@ export declare const createTableStore: (initData: {
|
|
|
714
718
|
filterComponent?: string | undefined;
|
|
715
719
|
cellComponent?: string | undefined;
|
|
716
720
|
cellComponentProps?: Record<string, any> | undefined;
|
|
717
|
-
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
718
721
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
719
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
720
|
-
mask?: ((value: any) => any) | undefined;
|
|
721
722
|
isGantt?: boolean | undefined;
|
|
722
723
|
ganttComponent?: string | undefined;
|
|
723
724
|
colspan?: number | undefined;
|
|
724
|
-
originalIndex?: number | undefined;
|
|
725
725
|
}[]>;
|
|
726
726
|
config: import("vue").Ref<{
|
|
727
727
|
view?: "uncounted" | "list" | "list-expansion" | undefined;
|
|
@@ -1320,10 +1320,14 @@ export declare const createTableStore: (initData: {
|
|
|
1320
1320
|
}, "display" | "table" | "filteredRows" | "hasPinnedColumns" | "isGanttView" | "isTreeView" | "isDependencyGraphEnabled" | "numberedRowWidth" | "zeroColumn">, Pick<{
|
|
1321
1321
|
columns: import("vue").Ref<{
|
|
1322
1322
|
name: string;
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1323
|
+
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
1324
|
+
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
1325
|
+
mask?: ((value: any) => any) | undefined;
|
|
1326
|
+
readonly originalIndex?: number | undefined;
|
|
1326
1327
|
fieldtype?: string | undefined;
|
|
1328
|
+
label?: string | undefined;
|
|
1329
|
+
align?: "left" | "right" | "center" | "start" | "end" | undefined;
|
|
1330
|
+
edit?: boolean | undefined;
|
|
1327
1331
|
width?: string | undefined;
|
|
1328
1332
|
pinned?: boolean | undefined;
|
|
1329
1333
|
resizable?: boolean | undefined;
|
|
@@ -1334,20 +1338,20 @@ export declare const createTableStore: (initData: {
|
|
|
1334
1338
|
filterComponent?: string | undefined;
|
|
1335
1339
|
cellComponent?: string | undefined;
|
|
1336
1340
|
cellComponentProps?: Record<string, any> | undefined;
|
|
1337
|
-
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
1338
1341
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
1339
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
1340
|
-
mask?: ((value: any) => any) | undefined;
|
|
1341
1342
|
isGantt?: boolean | undefined;
|
|
1342
1343
|
ganttComponent?: string | undefined;
|
|
1343
1344
|
colspan?: number | undefined;
|
|
1344
|
-
originalIndex?: number | undefined;
|
|
1345
1345
|
}[], TableColumn[] | {
|
|
1346
1346
|
name: string;
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1347
|
+
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
1348
|
+
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
1349
|
+
mask?: ((value: any) => any) | undefined;
|
|
1350
|
+
readonly originalIndex?: number | undefined;
|
|
1350
1351
|
fieldtype?: string | undefined;
|
|
1352
|
+
label?: string | undefined;
|
|
1353
|
+
align?: "left" | "right" | "center" | "start" | "end" | undefined;
|
|
1354
|
+
edit?: boolean | undefined;
|
|
1351
1355
|
width?: string | undefined;
|
|
1352
1356
|
pinned?: boolean | undefined;
|
|
1353
1357
|
resizable?: boolean | undefined;
|
|
@@ -1358,14 +1362,10 @@ export declare const createTableStore: (initData: {
|
|
|
1358
1362
|
filterComponent?: string | undefined;
|
|
1359
1363
|
cellComponent?: string | undefined;
|
|
1360
1364
|
cellComponentProps?: Record<string, any> | undefined;
|
|
1361
|
-
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
1362
1365
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
1363
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
1364
|
-
mask?: ((value: any) => any) | undefined;
|
|
1365
1366
|
isGantt?: boolean | undefined;
|
|
1366
1367
|
ganttComponent?: string | undefined;
|
|
1367
1368
|
colspan?: number | undefined;
|
|
1368
|
-
originalIndex?: number | undefined;
|
|
1369
1369
|
}[]>;
|
|
1370
1370
|
config: import("vue").Ref<{
|
|
1371
1371
|
view?: "uncounted" | "list" | "list-expansion" | undefined;
|
|
@@ -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,EA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AQ,CAAC,KAAG,MAAM;2BAjchD,MAAM;6BAKJ,MAAM;yBAucV,MAAM,WAAW,MAAM,KAAG,OAAO;2CA/Sf,gBAAgB;gCAlB3B,YAAY;6BAvJf,MAAM,YAAY,MAAM;4BAhDzB,MAAM,YAAY,MAAM,SAAS,GAAG;4BAoBpC,MAAM,YAAY,MAAM,SAAS,MAAM;0BAuWzC,MAAM,UAAU,WAAW;6BA/FxB,MAAM;gCAvMH,MAAM;2CA+IK,MAAM;gCAlBjB,MAAM;4BAjCV,cAAc;0BAjKhB,QAAQ,EAAE;6lBA0nBxC,CAAA"}
|
package/dist/src/stores/table.js
CHANGED
|
@@ -328,7 +328,16 @@ export const createTableStore = (initData) => {
|
|
|
328
328
|
const row = rows.value[rowIndex];
|
|
329
329
|
const format = column.format;
|
|
330
330
|
if (!format) {
|
|
331
|
-
|
|
331
|
+
switch (column.fieldtype) {
|
|
332
|
+
case 'Check':
|
|
333
|
+
return value ? '✓' : '✗';
|
|
334
|
+
case 'Date':
|
|
335
|
+
return value != null ? new Date(value).toLocaleDateString() : value;
|
|
336
|
+
case 'Datetime':
|
|
337
|
+
return value != null ? new Date(value).toLocaleString() : value;
|
|
338
|
+
default:
|
|
339
|
+
return value;
|
|
340
|
+
}
|
|
332
341
|
}
|
|
333
342
|
if (typeof format === 'function') {
|
|
334
343
|
return format(value, { table: table.value, row, column });
|
|
@@ -1,166 +1,47 @@
|
|
|
1
1
|
import { useElementBounding } from '@vueuse/core';
|
|
2
2
|
import type { Ref, ShallowRef } from 'vue';
|
|
3
|
+
import type { ColumnSchema } from '@stonecrop/schema';
|
|
3
4
|
import { createTableStore } from '../stores/table';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Runtime column definition for ATable.
|
|
7
|
+
*
|
|
8
|
+
* Extends `ColumnSchema` from `@stonecrop/schema` — all authoring properties (`label`, `fieldtype`, `width`,
|
|
9
|
+
* `pinned`, filter config, cell/modal component names, etc.) are inherited. The overrides
|
|
10
|
+
* below widen three properties for runtime use (live functions, broader alignment values)
|
|
11
|
+
* and add two runtime-only additions (`mask`, `originalIndex`).
|
|
12
|
+
*
|
|
13
|
+
* Schema-based callers should author columns as `ColumnSchema[]` (using `fieldname`) and
|
|
14
|
+
* pass them via ATable's `:schema` prop — `TableColumn` is the internal runtime type and
|
|
15
|
+
* callers working from a doctype schema never need to construct it directly.
|
|
6
16
|
* @public
|
|
7
17
|
*/
|
|
8
|
-
export interface TableColumn {
|
|
9
|
-
/**
|
|
10
|
-
* The key of the column. This is used to identify the column in the table.
|
|
11
|
-
*/
|
|
18
|
+
export interface TableColumn extends Omit<ColumnSchema, 'fieldname' | 'hidden' | 'format' | 'modalComponent'> {
|
|
19
|
+
/** Runtime column key. Corresponds to `fieldname` in `ColumnSchema`; populated by `schemaToColumns`. */
|
|
12
20
|
name: string;
|
|
13
21
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* - `center` - center aligned
|
|
17
|
-
* - `right` - right aligned
|
|
18
|
-
* - `start` - aligned to the start of the column
|
|
19
|
-
* - `end` - aligned to the end of the column
|
|
20
|
-
*
|
|
21
|
-
* @defaultValue 'center'
|
|
22
|
-
*/
|
|
23
|
-
align?: CanvasTextAlign;
|
|
24
|
-
/**
|
|
25
|
-
* Control whether cells for the column is editable.
|
|
26
|
-
*
|
|
27
|
-
* @defaultValue false
|
|
28
|
-
*/
|
|
29
|
-
edit?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* The label of the column. This is displayed in the table header.
|
|
32
|
-
*
|
|
33
|
-
* @defaultValue If no label is provided, a character will be assigned alphabetically,
|
|
34
|
-
* starting from 'A' for the first column, 'B' for the second column, and so on.
|
|
35
|
-
*/
|
|
36
|
-
label?: string;
|
|
37
|
-
/**
|
|
38
|
-
* The semantic field type of the column. Uses the same StonecropFieldType enum as forms.
|
|
39
|
-
* Common values: 'Data', 'Text', 'Int', 'Float', 'Date', 'Select', 'Link', 'Check', etc.
|
|
40
|
-
*
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
fieldtype?: string;
|
|
44
|
-
/**
|
|
45
|
-
* The width of the column. This can be a number (in pixels) or a string (in CSS units).
|
|
46
|
-
*
|
|
47
|
-
* @defaultValue '40ch'
|
|
48
|
-
*/
|
|
49
|
-
width?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Control whether the column should be pinned to the table.
|
|
52
|
-
*
|
|
53
|
-
* @defaultValue false
|
|
54
|
-
*/
|
|
55
|
-
pinned?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Control whether the column can be resized by the user.
|
|
58
|
-
*
|
|
59
|
-
* @defaultValue false
|
|
60
|
-
*/
|
|
61
|
-
resizable?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Control whether the column should be sortable.
|
|
64
|
-
*
|
|
65
|
-
* @defaultValue true
|
|
66
|
-
*/
|
|
67
|
-
sortable?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Control whether the column should be filterable and define filter configuration.
|
|
70
|
-
*
|
|
71
|
-
* @defaultValue true
|
|
72
|
-
*/
|
|
73
|
-
filterable?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* The type of filter for the column.
|
|
76
|
-
*
|
|
77
|
-
* @defaultValue 'text'
|
|
22
|
+
* Widens `ColumnSchema.format` (string-only) to also accept a live function at runtime.
|
|
23
|
+
* Serialized string functions are deserialized by the table store's `getFormattedValue`.
|
|
78
24
|
*/
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Options for select-type filters.
|
|
82
|
-
*/
|
|
83
|
-
filterOptions?: any[];
|
|
84
|
-
/**
|
|
85
|
-
* Custom component for filtering.
|
|
86
|
-
*/
|
|
87
|
-
filterComponent?: string;
|
|
88
|
-
/**
|
|
89
|
-
* The component to use to render the cell for the column. If not provided, the table will
|
|
90
|
-
* render the default `<td>` element.
|
|
91
|
-
*/
|
|
92
|
-
cellComponent?: string;
|
|
93
|
-
/**
|
|
94
|
-
* Additional properties to pass to the table's cell component.
|
|
95
|
-
*
|
|
96
|
-
* Only applicable if the `cellComponent` property is set for the column.
|
|
97
|
-
*/
|
|
98
|
-
cellComponentProps?: Record<string, any>;
|
|
25
|
+
format?: string | ((value: any, context: CellContext) => string);
|
|
99
26
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* - `
|
|
104
|
-
* - `
|
|
105
|
-
*
|
|
106
|
-
* The function should return the name of the component to use for the modal.
|
|
107
|
-
*
|
|
108
|
-
* Additionally, the following properties will be automatically passed to the modal component:
|
|
109
|
-
* - `colIndex` - the column index of the current cell
|
|
110
|
-
* - `rowIndex` - the row index of the current cell
|
|
111
|
-
* - `store` - the table data store
|
|
27
|
+
* Widens `ColumnSchema.modalComponent` (string-only) to also accept a factory function.
|
|
28
|
+
* When a function is provided it receives the cell context and returns the component name.
|
|
29
|
+
* The cell context exposes:
|
|
30
|
+
* - `row` — the row object for the current cell
|
|
31
|
+
* - `column` — the column object for the current cell
|
|
32
|
+
* - `table` — the table object
|
|
112
33
|
*/
|
|
113
34
|
modalComponent?: string | ((context: CellContext) => string);
|
|
114
35
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* Only applicable if the `modalComponent` property is set for the column.
|
|
118
|
-
*/
|
|
119
|
-
modalComponentExtraProps?: Record<string, any>;
|
|
120
|
-
/**
|
|
121
|
-
* The format function to use to format the value of the cell. This can either be a normal or stringified
|
|
122
|
-
* function that takes the value and the cell context and returns a string.
|
|
123
|
-
*/
|
|
124
|
-
format?: string | ((value: any, context: CellContext) => string);
|
|
125
|
-
/**
|
|
126
|
-
* The masking function to use to apply an input mask to the cell. This will accept an input value and
|
|
127
|
-
* return the masked value.
|
|
36
|
+
* Input mask applied to the cell value before display. Accepts a live function only —
|
|
37
|
+
* masks cannot be serialized to JSON so they are absent from `ColumnSchema`.
|
|
128
38
|
*/
|
|
129
39
|
mask?: (value: any) => any;
|
|
130
40
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* Only applicable for Gantt tables.
|
|
134
|
-
*
|
|
135
|
-
* @defaultValue false
|
|
136
|
-
*/
|
|
137
|
-
isGantt?: boolean;
|
|
138
|
-
/**
|
|
139
|
-
* The component to use to render the Gantt bar for the column.
|
|
140
|
-
*
|
|
141
|
-
* Only applicable for Gantt tables.
|
|
142
|
-
*
|
|
143
|
-
* @defaultValue 'AGanttCell'
|
|
144
|
-
*/
|
|
145
|
-
ganttComponent?: string;
|
|
146
|
-
/**
|
|
147
|
-
* The colspan of the Gantt bar for the column. This determines how many columns
|
|
148
|
-
* the Gantt bar should span across.
|
|
149
|
-
*
|
|
150
|
-
* Only applicable for Gantt tables.
|
|
151
|
-
*
|
|
152
|
-
* @defaultValue The number of columns in the table, excluding any pinned columns.
|
|
153
|
-
*/
|
|
154
|
-
colspan?: number;
|
|
155
|
-
/**
|
|
156
|
-
* The original column index for the Gantt bar, excluding any pinned columns.
|
|
157
|
-
* This is evaluated automatically while rendering the table.
|
|
158
|
-
*
|
|
159
|
-
* Only applicable for Gantt tables.
|
|
160
|
-
*
|
|
161
|
-
* @defaultValue 0
|
|
41
|
+
* Runtime Gantt column index (excluding pinned columns). Set automatically during
|
|
42
|
+
* Gantt table rendering.
|
|
162
43
|
*/
|
|
163
|
-
originalIndex?: number;
|
|
44
|
+
readonly originalIndex?: number;
|
|
164
45
|
}
|
|
165
46
|
/**
|
|
166
47
|
* Table cell context definition.
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cA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,GAAG,QAAQ,CAAA;IACzB,UAAU,EAAE,cAAc,CAAA;CAC1B,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,QAAQ,CAAA;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,QAAQ,CAAA;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,QAAQ,CAAA;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,QAAQ,CAAA;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CACf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/atable",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -35,8 +35,9 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@vueuse/components": "^14.2.1",
|
|
37
37
|
"@vueuse/core": "^14.2.1",
|
|
38
|
-
"@stonecrop/
|
|
39
|
-
"@stonecrop/
|
|
38
|
+
"@stonecrop/schema": "0.12.0",
|
|
39
|
+
"@stonecrop/utilities": "0.12.0",
|
|
40
|
+
"@stonecrop/themes": "0.12.0"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
43
|
"pinia": "^3.0.4",
|
|
@@ -92,6 +92,9 @@ import ARow from './ARow.vue'
|
|
|
92
92
|
import ATableHeader from './ATableHeader.vue'
|
|
93
93
|
import ATableModal from './ATableModal.vue'
|
|
94
94
|
import { createTableStore } from '../stores/table'
|
|
95
|
+
import type { ColumnSchema } from '@stonecrop/schema'
|
|
96
|
+
|
|
97
|
+
import { schemaToColumns } from '../schemaToColumns'
|
|
95
98
|
import type {
|
|
96
99
|
ConnectionEvent,
|
|
97
100
|
ConnectionPath,
|
|
@@ -108,11 +111,17 @@ import type {
|
|
|
108
111
|
} from '../types'
|
|
109
112
|
|
|
110
113
|
const rows = defineModel<TableRow[]>('rows', { required: true })
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
// TODO: convert columns from defineModel to a regular prop
|
|
115
|
+
const columns = defineModel<TableColumn[]>('columns')
|
|
116
|
+
|
|
117
|
+
const {
|
|
118
|
+
id = '',
|
|
119
|
+
config = new Object(),
|
|
120
|
+
schema = [],
|
|
121
|
+
} = defineProps<{
|
|
114
122
|
id?: string
|
|
115
123
|
config?: TableConfig
|
|
124
|
+
schema?: ColumnSchema[]
|
|
116
125
|
}>()
|
|
117
126
|
|
|
118
127
|
const emit = defineEmits<{
|
|
@@ -129,7 +138,8 @@ const emit = defineEmits<{
|
|
|
129
138
|
}>()
|
|
130
139
|
|
|
131
140
|
const tableRef = useTemplateRef<HTMLTableElement>('table')
|
|
132
|
-
const
|
|
141
|
+
const resolvedColumns = columns.value?.length ? columns.value : schemaToColumns(schema ?? [])
|
|
142
|
+
const store = createTableStore({ columns: resolvedColumns, rows: rows.value, id, config })
|
|
133
143
|
|
|
134
144
|
store.$onAction(({ name, store, args, after }) => {
|
|
135
145
|
if (name === 'setCellData' || name === 'setCellText') {
|
|
@@ -189,7 +199,7 @@ watch(
|
|
|
189
199
|
)
|
|
190
200
|
|
|
191
201
|
onMounted(() => {
|
|
192
|
-
if (columns.value
|
|
202
|
+
if (columns.value?.some(column => column.pinned)) {
|
|
193
203
|
assignStickyCellWidths()
|
|
194
204
|
|
|
195
205
|
// in tree views, also add a mutation observer to capture and adjust expanded rows
|