zova-module-a-table 5.1.39 → 5.1.40
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/component/table/controller.d.ts +7 -1
- package/dist/component/table/controller.d.ts.map +1 -1
- package/dist/component/table/render.d.ts.map +1 -1
- package/dist/index.js +72 -11
- package/dist/index.js.map +1 -1
- package/dist/types/table.d.ts +1 -0
- package/dist/types/table.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/component/table/controller.tsx +86 -26
- package/src/component/table/render.tsx +30 -6
- package/src/types/table.ts +2 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IResourceTableActionRowOptionsBase, ISchemaObjectExtensionField, TypeTableCellRenderComponent, TypeTableCellRenderComponentProvider } from 'zova-module-a-openapi';
|
|
2
2
|
import { celEnvBase } from '@cabloy/utils';
|
|
3
|
-
import { CellContext, OnChangeFn, Row, SortingState } from '@tanstack/vue-table';
|
|
3
|
+
import { CellContext, OnChangeFn, Row, RowSelectionState, SortingState } from '@tanstack/vue-table';
|
|
4
4
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
5
5
|
import { VNode } from 'vue';
|
|
6
6
|
import { ZovaJsx } from 'zova-jsx';
|
|
@@ -15,6 +15,9 @@ export interface ControllerTableProps<TData extends {} = {}> {
|
|
|
15
15
|
schemaOrder?: SchemaObject;
|
|
16
16
|
sorting?: SortingState;
|
|
17
17
|
onSortingChange?: OnChangeFn<SortingState>;
|
|
18
|
+
enableRowSelection?: boolean | ((row: Row<TData>) => boolean);
|
|
19
|
+
rowSelection?: RowSelectionState;
|
|
20
|
+
onRowSelectionChange?: OnChangeFn<RowSelectionState>;
|
|
18
21
|
tableScope?: ITableScope;
|
|
19
22
|
getColumns?: TypeTableGetColumns<TData>;
|
|
20
23
|
slotDefault?: (table: ControllerTable<TData>) => VNode;
|
|
@@ -31,10 +34,13 @@ export declare class ControllerTable<TData extends {} = {}> extends BeanControll
|
|
|
31
34
|
get schema(): SchemaObject | undefined;
|
|
32
35
|
get data(): TData[] | undefined;
|
|
33
36
|
get sorting(): SortingState;
|
|
37
|
+
get rowSelection(): RowSelectionState;
|
|
34
38
|
refreshMeta(): Promise<void>;
|
|
35
39
|
private _createTable;
|
|
36
40
|
private _createColumns;
|
|
37
41
|
private _createColumnsMiddle;
|
|
42
|
+
private _getRowId;
|
|
43
|
+
private _canSelectRow;
|
|
38
44
|
private _getColumnPinning;
|
|
39
45
|
private _isOrderable;
|
|
40
46
|
private _createProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/component/table/controller.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kCAAkC,EAClC,2BAA2B,EAE3B,4BAA4B,EAC5B,oCAAoC,EACrC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAsB,MAAM,eAAe,CAAC;AAC/D,OAAO,EACL,WAAW,EAIX,UAAU,EACV,GAAG,EACH,YAAY,EAEb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAS5B,OAAO,EAAkB,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,KAAK,EAEV,0BAA0B,EAE3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,4BAA4B,EAE5B,eAAe,EACf,iBAAiB,EACjB,WAAW,EAEZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/component/table/controller.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kCAAkC,EA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MAAM,EAAE,4BAA4B,EACpC,WAAW,EAAE,kCAAkC,EAC/C,aAAa,EAAE,0BAA0B;IA+B3C,OAAO,CAAC,WAAW;IAiCnB,OAAO,CAAC,gBAAgB;IA4DjB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,2BAA2B,GAAG,SAAS;IAK/E,OAAO,CAAC,gBAAgB;IAcjB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,EAAE,GAAG,iBAAiB;IAQhE,0BAA0B,CAC/B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,EAAE,EACZ,aAAa,EAAE,EAAE,GAChB,6BAA6B;IAMhC,OAAO,CAAC,iCAAiC;IAgBlC,iBAAiB,CACtB,MAAM,EAAE,4BAA4B,GAAG,SAAS,GAC/C,oCAAoC;CAOxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/component/table/render.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/component/table/render.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAKtC,qBACa,WAAY,SAAQ,cAAc;IAC7C,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,mBAAmB;IAkGpB,MAAM;;;CAGd"}
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,9 @@ var BeanControllerTableBase = class extends BeanControllerBase {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
//#endregion
|
|
23
|
+
//#region src/types/table.ts
|
|
24
|
+
var TableColumnIdSelection = "$$selection";
|
|
25
|
+
//#endregion
|
|
23
26
|
//#region src/component/table/controller.tsx
|
|
24
27
|
var _dec$2, _dec2$2, _class$2, _ControllerTable;
|
|
25
28
|
var ControllerTable = (_dec$2 = Controller(), _dec2$2 = BeanInfo({ module: "a-table" }), _dec$2(_class$2 = _dec2$2(_class$2 = (_ControllerTable = class ControllerTable extends BeanControllerTableBase {
|
|
@@ -41,6 +44,10 @@ var ControllerTable = (_dec$2 = Controller(), _dec2$2 = BeanInfo({ module: "a-ta
|
|
|
41
44
|
if (deepEqual(newValue, oldValue)) return;
|
|
42
45
|
await this.refreshMeta();
|
|
43
46
|
});
|
|
47
|
+
this.$watch(() => this.$props.enableRowSelection, async (newValue, oldValue) => {
|
|
48
|
+
if (newValue === oldValue) return;
|
|
49
|
+
await this.refreshMeta();
|
|
50
|
+
});
|
|
44
51
|
this._createTable();
|
|
45
52
|
}
|
|
46
53
|
get schema() {
|
|
@@ -52,6 +59,9 @@ var ControllerTable = (_dec$2 = Controller(), _dec2$2 = BeanInfo({ module: "a-ta
|
|
|
52
59
|
get sorting() {
|
|
53
60
|
return this.$props.sorting ?? [];
|
|
54
61
|
}
|
|
62
|
+
get rowSelection() {
|
|
63
|
+
return this.$props.rowSelection ?? {};
|
|
64
|
+
}
|
|
55
65
|
async refreshMeta() {
|
|
56
66
|
this.tableMeta = await this._createTableMeta();
|
|
57
67
|
this.columns = await this._createColumns();
|
|
@@ -60,20 +70,30 @@ var ControllerTable = (_dec$2 = Controller(), _dec2$2 = BeanInfo({ module: "a-ta
|
|
|
60
70
|
_createTable() {
|
|
61
71
|
const self = this;
|
|
62
72
|
const tableOptions = {
|
|
63
|
-
getRowId:
|
|
73
|
+
getRowId: (originalRow, index, parent) => this._getRowId(originalRow, index, parent),
|
|
64
74
|
getCoreRowModel: getCoreRowModel(),
|
|
65
75
|
renderFallbackValue: this.scope.config.renderFallbackValue,
|
|
66
76
|
manualPagination: true,
|
|
67
77
|
manualSorting: true,
|
|
68
78
|
enableMultiSort: false,
|
|
69
79
|
enableSortingRemoval: false,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
80
|
+
enableRowSelection: (row) => self._canSelectRow(row),
|
|
81
|
+
state: {
|
|
82
|
+
get sorting() {
|
|
83
|
+
return self.sorting;
|
|
84
|
+
},
|
|
85
|
+
get rowSelection() {
|
|
86
|
+
return self.rowSelection;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
73
89
|
onSortingChange: (updater) => {
|
|
74
90
|
const sorting = functionalUpdate(updater, self.sorting).slice(0, 1);
|
|
75
91
|
self.$props.onSortingChange?.(sorting);
|
|
76
92
|
},
|
|
93
|
+
onRowSelectionChange: (updater) => {
|
|
94
|
+
const rowSelection = functionalUpdate(updater, self.rowSelection);
|
|
95
|
+
self.$props.onRowSelectionChange?.(rowSelection);
|
|
96
|
+
},
|
|
77
97
|
get initialState() {
|
|
78
98
|
return { columnPinning: self._getColumnPinning() };
|
|
79
99
|
},
|
|
@@ -89,8 +109,7 @@ var ControllerTable = (_dec$2 = Controller(), _dec2$2 = BeanInfo({ module: "a-ta
|
|
|
89
109
|
}
|
|
90
110
|
async _createColumns() {
|
|
91
111
|
if (!this.properties) return [];
|
|
92
|
-
|
|
93
|
-
return await this.$props.getColumns(async (properties) => {
|
|
112
|
+
const columns = !this.$props.getColumns ? await this._createColumnsMiddle(this.tableMeta.properties) : await this.$props.getColumns(async (properties) => {
|
|
94
113
|
return await this._createColumnsMiddle(properties ?? this.tableMeta.properties);
|
|
95
114
|
}, async (key, render) => {
|
|
96
115
|
const columnScope = this.getColumnScope(key);
|
|
@@ -99,6 +118,19 @@ var ControllerTable = (_dec$2 = Controller(), _dec2$2 = BeanInfo({ module: "a-ta
|
|
|
99
118
|
if (visible === false) return;
|
|
100
119
|
return await this._createColumnRender(render, columnProps, columnScope, jsxRenderContext);
|
|
101
120
|
}, this);
|
|
121
|
+
if (!this.$props.enableRowSelection) return columns;
|
|
122
|
+
return [createColumnHelper().display({
|
|
123
|
+
id: "$$selection",
|
|
124
|
+
header: "",
|
|
125
|
+
cell: "",
|
|
126
|
+
size: 48,
|
|
127
|
+
enableSorting: false,
|
|
128
|
+
meta: { rest: {
|
|
129
|
+
fixed: "left",
|
|
130
|
+
width: 48,
|
|
131
|
+
align: "center"
|
|
132
|
+
} }
|
|
133
|
+
}), ...columns];
|
|
102
134
|
}
|
|
103
135
|
async _createColumnsMiddle(properties) {
|
|
104
136
|
const tableMeta = this.tableMeta;
|
|
@@ -120,8 +152,19 @@ var ControllerTable = (_dec$2 = Controller(), _dec2$2 = BeanInfo({ module: "a-ta
|
|
|
120
152
|
}
|
|
121
153
|
return columns;
|
|
122
154
|
}
|
|
155
|
+
_getRowId(originalRow, index, parent) {
|
|
156
|
+
const id = this.$props.getRowId?.(originalRow, index, parent) ?? cast(originalRow).id;
|
|
157
|
+
if (isNilOrEmptyString(id)) return `__unselectable_${parent ? `${parent.id}.` : ""}${index}`;
|
|
158
|
+
return String(id);
|
|
159
|
+
}
|
|
160
|
+
_canSelectRow(row) {
|
|
161
|
+
const enableRowSelection = this.$props.enableRowSelection;
|
|
162
|
+
if (!enableRowSelection) return false;
|
|
163
|
+
if (isNilOrEmptyString(this.$props.getRowId?.(row.original, row.index, row.getParentRow()) ?? cast(row.original).id)) return false;
|
|
164
|
+
return typeof enableRowSelection === "function" ? enableRowSelection(row) : true;
|
|
165
|
+
}
|
|
123
166
|
_getColumnPinning() {
|
|
124
|
-
const left = [];
|
|
167
|
+
const left = this.$props.enableRowSelection ? ["$$selection"] : [];
|
|
125
168
|
const right = [];
|
|
126
169
|
for (const property of this.tableMeta?.properties ?? []) {
|
|
127
170
|
const fixed = property.rest?.fixed;
|
|
@@ -329,7 +372,15 @@ var RenderTable = (_dec$1 = Render(), _dec2$1 = BeanInfo({ module: "a-table" }),
|
|
|
329
372
|
const sorted = column.getIsSorted();
|
|
330
373
|
const fixed = column.getIsPinned();
|
|
331
374
|
const headerDefinition = column.columnDef.header;
|
|
332
|
-
const headerContent = createVNode(
|
|
375
|
+
const headerContent = column.id === "$$selection" ? createVNode("input", {
|
|
376
|
+
"type": "checkbox",
|
|
377
|
+
"checked": table.getIsAllPageRowsSelected(),
|
|
378
|
+
"indeterminate": table.getIsSomePageRowsSelected(),
|
|
379
|
+
"aria-checked": table.getIsSomePageRowsSelected() ? "mixed" : void 0,
|
|
380
|
+
"aria-label": "Select all rows on this page",
|
|
381
|
+
"disabled": table.getRowModel().rows.every((row) => !row.getCanSelect()),
|
|
382
|
+
"onChange": table.getToggleAllPageRowsSelectedHandler()
|
|
383
|
+
}, null) : createVNode(FlexRender, {
|
|
333
384
|
"render": headerDefinition,
|
|
334
385
|
"props": header.getContext()
|
|
335
386
|
}, null);
|
|
@@ -354,13 +405,23 @@ var RenderTable = (_dec$1 = Render(), _dec2$1 = BeanInfo({ module: "a-table" }),
|
|
|
354
405
|
"aria-label": `Sort by ${column.id}`
|
|
355
406
|
}, [headerContent, createVNode("span", { "aria-hidden": "true" }, [sortIcon])]) : headerContent]);
|
|
356
407
|
})])]), createVNode("tbody", null, [table.getRowModel().rows.map((row) => {
|
|
357
|
-
return createVNode("tr", {
|
|
408
|
+
return createVNode("tr", {
|
|
409
|
+
"key": row.id,
|
|
410
|
+
"aria-selected": row.getIsSelected()
|
|
411
|
+
}, [row.getVisibleCells().map((cell) => {
|
|
358
412
|
const column = cell.column;
|
|
413
|
+
const selection = column.id === "$$selection";
|
|
359
414
|
return createVNode("td", {
|
|
360
415
|
"key": cell.id,
|
|
361
416
|
"class": column.getIsPinned() ? "bg-base-100" : void 0,
|
|
362
417
|
"style": this._getColumnStyle(column)
|
|
363
|
-
}, [createVNode(
|
|
418
|
+
}, [selection ? createVNode("input", {
|
|
419
|
+
"type": "checkbox",
|
|
420
|
+
"checked": row.getIsSelected(),
|
|
421
|
+
"disabled": !row.getCanSelect(),
|
|
422
|
+
"aria-label": `Select row ${row.id}`,
|
|
423
|
+
"onChange": row.getToggleSelectedHandler()
|
|
424
|
+
}, null) : createVNode(FlexRender, {
|
|
364
425
|
"render": column.columnDef.cell,
|
|
365
426
|
"props": cell.getContext()
|
|
366
427
|
}, null)]);
|
|
@@ -412,6 +473,6 @@ function TableCell(options) {
|
|
|
412
473
|
return createBeanDecorator("tableCell", "app", true, options);
|
|
413
474
|
}
|
|
414
475
|
//#endregion
|
|
415
|
-
export { BeanControllerPageTableBase, BeanControllerTableBase, ControllerTable, RenderTable, ScopeModuleATable, TableCell, ZTable, components, config };
|
|
476
|
+
export { BeanControllerPageTableBase, BeanControllerTableBase, ControllerTable, RenderTable, ScopeModuleATable, TableCell, TableColumnIdSelection, ZTable, components, config };
|
|
416
477
|
|
|
417
478
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["celEnvBase","isNilOrEmptyString","createColumnHelper","functionalUpdate","getCoreRowModel","appResource","beanFullNameFromOnionName","cast","deepEqual","deepExtend","objectAssignReactive","isJsxComponent","ZovaJsx","Controller","BeanControllerTableBase","ControllerTable","_dec","_dec2","__z_BeanInfo","module","_class","_ControllerTable","constructor","args","properties","columns","tableMeta","zovaJsx","columnCelEnv","__init__","bean","_setBean","_getColumnCelEnv","_newBeanSimple","undefined","_createProperties","refreshMeta","$watch","$props","schema","newValue","oldValue","_createTable","data","sorting","_createTableMeta","_createColumns","table","setColumnPinning","_getColumnPinning","self","tableOptions","getRowId","originalRow","id","renderFallbackValue","scope","config","manualPagination","manualSorting","enableMultiSort","enableSortingRemoval","state","onSortingChange","updater","slice","initialState","columnPinning","$useTable","getColumns","_createColumnsMiddle","key","render","columnScope","getColumnScope","jsxRenderContext","getColumnJsxRenderContext","visible","columnProps","getColumnComponentPropsTop","_createColumnRender","columnHelper","property","push","accessor","header","_props","title","cell","props","renders","size","rest","width","enableSorting","_isOrderable","sortDescFirst","meta","left","right","fixed","schemaOrder","keys","schemaKey","schemaKeys","some","Object","prototype","hasOwnProperty","call","$computed","$sdk","loadSchemaProperties","promises","res","Promise","all","filter","_item","index","item","forEach","celScope","app","ctx","$scene","$host","$celScope","$jsx","$$table","getCellJsxRenderContext","cellContext","cellRenderPrepare","Array","isArray","renderProviders","map","getRenderProvider","renderProvider","includes","_getBean","renderContext","beanInstance","beanOptions","getBean","onionOptions","options","checkVisible","_cellRender","cellRender","cellScope","_getBeanSyncOnly","cellProps","setTransientObject","getValue","name","row","_cellRenderInner","value","fallbackValue","cellProps2","renderJsxProps","class","style","$cssMerge","$style","children","length","renderJsxChildrenDirect","getColumnProperty","find","celEnv","clone","registerFunction","transientObject","defaultValue","scopeExtra","tableScope","_getColumnComponentPropsTopByRest","_renderContext","evaluateExpression","assign","$propsDefault","FlexRender","BeanRenderBase","Render","RenderTable","_dec","_dec2","__z_BeanInfo","module","_class","_getColumnStyle","column","rest","columnDef","meta","fixed","getIsPinned","width","undefined","minWidth","textAlign","align","position","left","getStart","right","getAfter","zIndex","_renderTableDefault","table","_createVNode","getFlatHeaders","map","header","canSort","getCanSort","sorted","getIsSorted","headerDefinition","headerContent","getContext","sortAria","sortIcon","id","getToggleSortingHandler","getRowModel","rows","row","getVisibleCells","cell","render","$slotDefault"],"sources":["../src/lib/beanControllerTableBase.ts","../src/component/table/controller.tsx","../src/component/table/render.tsx","../src/.metadata/component/table.ts","../src/config/config.ts","../src/.metadata/index.ts","../src/lib/beanControllerPageTableBase.ts","../src/lib/tableCell.ts"],"sourcesContent":["import { useVueTable } from '@tanstack/vue-table';\nimport { markRaw } from 'vue';\nimport { BeanControllerBase } from 'zova';\nexport class BeanControllerTableBase extends BeanControllerBase {\n constructor(...args) {\n super(...args);\n this.table = void 0;\n }\n $useTable(initialOptions) {\n return this.ctx.util.instanceScope(() => {\n return markRaw(useVueTable(initialOptions));\n });\n }\n async refreshMeta() {\n throw new Error('should implement refreshMeta');\n }\n}","import type {\n IResourceTableActionRowOptionsBase,\n ISchemaObjectExtensionField,\n ISchemaObjectExtensionFieldRest,\n TypeTableCellRenderComponent,\n TypeTableCellRenderComponentProvider,\n} from 'zova-module-a-openapi';\n\nimport { celEnvBase, isNilOrEmptyString } from '@cabloy/utils';\nimport {\n CellContext,\n createColumnHelper,\n functionalUpdate,\n getCoreRowModel,\n OnChangeFn,\n Row,\n SortingState,\n TableOptionsWithReactiveData,\n} from '@tanstack/vue-table';\nimport { SchemaObject } from 'openapi3-ts/oas31';\nimport { VNode } from 'vue';\nimport {\n appResource,\n beanFullNameFromOnionName,\n cast,\n deepEqual,\n deepExtend,\n objectAssignReactive,\n} from 'zova';\nimport { isJsxComponent, ZovaJsx } from 'zova-jsx';\nimport { Controller } from 'zova-module-a-bean';\n\nimport type { ITableMeta, TypeColumn, TypeTableGetColumns } from '../../types/table.js';\nimport type {\n IDecoratorTableCellOptions,\n IJsxRenderContextTableCell,\n ITableCellRender,\n} from '../../types/tableCell.js';\nimport type {\n IJsxRenderContextTableColumn,\n ITableCellRenderColumnProps,\n ITableCellScope,\n ITableColumnScope,\n ITableScope,\n TypeTableCellRender,\n} from '../../types/tableColumn.js';\n\nimport { BeanControllerTableBase } from '../../lib/beanControllerTableBase.js';\nimport { ITableCellRenderColumnOptions } from '../../types/tableColumn.js';\n\nexport interface ControllerTableProps<TData extends {} = {}> {\n data?: TData[];\n schema?: SchemaObject;\n schemaOrder?: SchemaObject;\n sorting?: SortingState;\n onSortingChange?: OnChangeFn<SortingState>;\n tableScope?: ITableScope;\n getColumns?: TypeTableGetColumns<TData>;\n slotDefault?: (table: ControllerTable<TData>) => VNode;\n getRowId?: (originalRow: TData, index: number, parent?: Row<TData>) => string;\n}\n\n@Controller()\nexport class ControllerTable<TData extends {} = {}> extends BeanControllerTableBase<TData> {\n static $propsDefault = {};\n\n // table: TypeTable<TData>; // in BeanControllerTableBase\n\n properties: ISchemaObjectExtensionField[] | undefined;\n columns: TypeColumn<TData>[];\n tableMeta: ITableMeta<TData>;\n zovaJsx: ZovaJsx;\n columnCelEnv: typeof celEnvBase;\n\n protected async __init__() {\n this.bean._setBean('$$table', this);\n // jsx\n this.columnCelEnv = this._getColumnCelEnv();\n this.zovaJsx = this.bean._newBeanSimple(ZovaJsx, false, undefined, this.columnCelEnv);\n // properties\n this._createProperties();\n // tableMeta/columns\n await this.refreshMeta();\n // watch\n this.$watch(\n () => this.$props.schema,\n async (newValue, oldValue) => {\n if (deepEqual(newValue, oldValue)) return;\n await this.refreshMeta();\n },\n );\n // table\n this._createTable();\n }\n\n public get schema() {\n return this.$props.schema;\n }\n\n public get data() {\n return this.$props.data;\n }\n\n public get sorting() {\n return this.$props.sorting ?? [];\n }\n\n public async refreshMeta() {\n this.tableMeta = await this._createTableMeta();\n this.columns = await this._createColumns();\n this.table?.setColumnPinning(this._getColumnPinning());\n }\n\n private _createTable() {\n // eslint-disable-next-line\n const self = this;\n const tableOptions: TableOptionsWithReactiveData<TData> = {\n getRowId: this.$props.getRowId ?? ((originalRow: TData) => cast(originalRow).id),\n getCoreRowModel: getCoreRowModel(),\n renderFallbackValue: this.scope.config.renderFallbackValue,\n manualPagination: true,\n manualSorting: true,\n enableMultiSort: false,\n enableSortingRemoval: false,\n state: {\n get sorting() {\n return self.sorting;\n },\n },\n onSortingChange: updater => {\n const sorting = functionalUpdate(updater, self.sorting).slice(0, 1);\n self.$props.onSortingChange?.(sorting);\n },\n get initialState() {\n const columnPinning = self._getColumnPinning();\n return { columnPinning };\n },\n get data() {\n return self.data || [];\n },\n get columns() {\n return self.columns;\n },\n };\n this.table = this.$useTable(tableOptions);\n this.table.setColumnPinning(this._getColumnPinning());\n }\n\n private async _createColumns() {\n if (!this.properties) return [];\n if (!this.$props.getColumns) return await this._createColumnsMiddle(this.tableMeta.properties);\n return await this.$props.getColumns(\n async properties => {\n return await this._createColumnsMiddle(properties ?? this.tableMeta.properties);\n },\n async (\n key: string,\n render: TypeTableCellRenderComponent,\n ): Promise<TypeTableCellRender<TData, any> | undefined> => {\n // columnScope\n const columnScope = this.getColumnScope(key);\n // renderContext\n const jsxRenderContext = this.getColumnJsxRenderContext(columnScope);\n // columnProps\n const { visible, columnProps } = this.getColumnComponentPropsTop(\n key,\n columnScope,\n jsxRenderContext,\n );\n // visible\n if (visible === false) return;\n return await this._createColumnRender(render, columnProps, columnScope, jsxRenderContext);\n },\n this,\n );\n }\n\n private async _createColumnsMiddle(\n properties: ISchemaObjectExtensionField[],\n ): Promise<TypeColumn<TData>[]> {\n const tableMeta = this.tableMeta;\n const columnHelper = createColumnHelper<TData>();\n const columns: TypeColumn<TData>[] = [];\n for (const property of properties) {\n const key = property.key!;\n columns.push(\n columnHelper.accessor(key as any, {\n id: key,\n header: _props => {\n return property?.title || key;\n },\n cell: props => tableMeta.renders[key](props),\n size: property.rest?.width,\n enableSorting: property.rest?.enableSorting === true && this._isOrderable(property),\n sortDescFirst: property.rest?.sortDescFirst === true,\n meta: { rest: property.rest },\n }),\n );\n }\n return columns;\n }\n\n private _getColumnPinning() {\n const left: string[] = [];\n const right: string[] = [];\n for (const property of this.tableMeta?.properties ?? []) {\n const fixed = property.rest?.fixed;\n if (fixed === 'left') left.push(property.key!);\n if (fixed === 'right') right.push(property.key!);\n }\n return { left, right };\n }\n\n private _isOrderable(property: ISchemaObjectExtensionField) {\n const properties = this.$props.schemaOrder?.properties;\n if (!properties) return false;\n const keys = [property.key, property.schemaKey, ...(property.schemaKeys ?? [])];\n return keys.some(key => key && Object.prototype.hasOwnProperty.call(properties, key));\n }\n\n private _createProperties() {\n this.properties = this.$computed(() => {\n return this.$sdk.loadSchemaProperties(this.schema, 'table');\n });\n }\n\n private async _createTableMeta() {\n let properties: ISchemaObjectExtensionField[] = [];\n const renders: Record<string, TypeTableCellRender<TData>> = {};\n if (!this.properties) return { properties, renders };\n const promises: Promise<any>[] = [];\n for (const property of this.properties) {\n const key = property.key!;\n // columnScope\n const columnScope = this.getColumnScope(key);\n // renderContext\n const jsxRenderContext = this.getColumnJsxRenderContext(columnScope);\n // columnProps\n const { visible, render, columnProps } = this.getColumnComponentPropsTop(\n key,\n columnScope,\n jsxRenderContext,\n );\n // visible\n if (visible === false) continue;\n // property\n properties.push(property);\n // render\n promises.push(this._createColumnRender(render, columnProps, columnScope, jsxRenderContext));\n }\n let res = await Promise.all(promises);\n properties = properties.filter((_item, index) => !!res[index]);\n res = res.filter(item => !!item);\n properties.forEach((item, index) => {\n renders[item.key!] = res[index];\n });\n return { properties, renders };\n }\n\n public getColumnJsxRenderContext(celScope: ITableColumnScope): IJsxRenderContextTableColumn {\n return {\n app: this.app,\n ctx: this.ctx,\n $scene: 'tableColumn',\n $host: this,\n $celScope: celScope,\n $jsx: this.zovaJsx,\n $$table: this,\n };\n }\n\n public getCellJsxRenderContext(\n celScope: ITableCellScope,\n cellContext: CellContext<TData, any>,\n ): IJsxRenderContextTableCell {\n return {\n app: this.app,\n ctx: this.ctx,\n $scene: 'tableCell',\n $host: this,\n $celScope: celScope,\n $jsx: this.zovaJsx,\n $$table: this,\n cellContext,\n };\n }\n\n public async cellRenderPrepare(\n renders: TypeTableCellRenderComponent | TypeTableCellRenderComponent[],\n ) {\n if (!Array.isArray(renders)) renders = [renders];\n const renderProviders = renders.map(item => this.getRenderProvider(item));\n const promises: Promise<any>[] = renderProviders.map(renderProvider =>\n (async () => {\n if (typeof renderProvider === 'string' && renderProvider.includes('.tableCell.')) {\n return await this.app.bean._getBean(renderProvider as any, true);\n }\n })(),\n );\n return await Promise.all(promises);\n }\n\n private async _createColumnRender(\n render: TypeTableCellRenderComponent | undefined,\n columnProps: ITableCellRenderColumnProps | undefined,\n columnScope: ITableColumnScope,\n renderContext: IJsxRenderContextTableColumn,\n ): Promise<TypeTableCellRender<TData, any> | undefined> {\n // renderProvider\n const renderProvider = this.getRenderProvider(render);\n // beanInstance\n let beanInstance: ITableCellRender | undefined;\n if (typeof renderProvider === 'string' && renderProvider.includes('.tableCell.')) {\n beanInstance = await this.app.bean._getBean(renderProvider as any, true);\n const beanOptions = appResource.getBean(renderProvider as any);\n const onionOptions = beanOptions?.options as IDecoratorTableCellOptions | undefined;\n columnProps = deepExtend({}, onionOptions, columnProps);\n // should not eval jsx columnProps\n // columnProps = this.zovaJsx.renderJsxProps(columnProps as any, {}, columnScope, renderContext) as any;\n if (\n beanInstance?.checkVisible &&\n !(await beanInstance.checkVisible(columnProps as any, renderContext))\n ) {\n return;\n }\n }\n return cellContext => {\n if (!cellContext) return;\n return this._cellRender(\n render,\n columnProps,\n columnScope,\n cellContext,\n renderProvider,\n beanInstance,\n undefined,\n undefined,\n undefined,\n );\n };\n }\n\n public cellRender(\n render: TypeTableCellRenderComponent,\n columnProps: IResourceTableActionRowOptionsBase,\n renderContext: IJsxRenderContextTableCell,\n ) {\n // render\n const cellScope = renderContext.$celScope;\n // renderProvider\n const renderProvider = this.getRenderProvider(render);\n // beanInstance\n let beanInstance: ITableCellRender | undefined;\n if (typeof renderProvider === 'string' && renderProvider.includes('.tableCell.')) {\n beanInstance = this.app.bean._getBeanSyncOnly(renderProvider as any);\n const beanOptions = appResource.getBean(renderProvider as any);\n const onionOptions = beanOptions?.options as IDecoratorTableCellOptions | undefined;\n columnProps = deepExtend({}, onionOptions, columnProps);\n // should not eval jsx columnProps\n // columnProps = this.zovaJsx.renderJsxProps(columnProps as any, {}, renderContext.$celScope, renderContext) as any;\n }\n // const cellProps = isJsxComponent(render) ? Object.assign({}, columnProps, cast(render).props) : columnProps;\n const cellProps = columnProps;\n return this._cellRender(\n render,\n columnProps as ITableCellRenderColumnProps,\n undefined,\n renderContext.cellContext,\n renderProvider,\n beanInstance,\n cellProps,\n cellScope,\n renderContext,\n );\n }\n\n private _cellRender(\n render: TypeTableCellRenderComponent | undefined,\n columnProps: ITableCellRenderColumnProps | undefined,\n columnScope: ITableColumnScope | undefined,\n cellContext: CellContext<TData, any>,\n renderProvider: TypeTableCellRenderComponentProvider,\n beanInstance: ITableCellRender | undefined,\n cellProps: any | undefined,\n cellScope: ITableCellScope | undefined,\n jsxRenderContext: IJsxRenderContextTableCell | undefined,\n ) {\n return this.zovaJsx.setTransientObject(\n {\n getValue: (name: string) => {\n return cellContext.row.getValue(name);\n },\n },\n () => {\n return this._cellRenderInner(\n render,\n columnProps,\n columnScope,\n cellContext,\n renderProvider,\n beanInstance,\n cellProps,\n cellScope,\n jsxRenderContext,\n );\n },\n );\n }\n\n private _cellRenderInner(\n render: TypeTableCellRenderComponent | undefined,\n columnProps: ITableCellRenderColumnProps | undefined,\n columnScope: ITableColumnScope | undefined,\n cellContext: CellContext<TData, any>,\n renderProvider: TypeTableCellRenderComponentProvider,\n beanInstance: ITableCellRender | undefined,\n cellProps: any | undefined,\n cellScope: ITableCellScope | undefined,\n jsxRenderContext: IJsxRenderContextTableCell | undefined,\n ) {\n // value\n const value = cellContext.getValue();\n // renderFallbackValue\n const fallbackValue = this.table.options.renderFallbackValue;\n // cellScope\n if (!cellScope) {\n cellScope = objectAssignReactive({}, columnScope, { value, fallbackValue })!;\n }\n // render: text\n if (renderProvider === ('text' as TypeTableCellRenderComponent)) {\n return isNilOrEmptyString(value) ? fallbackValue : value;\n }\n // renderContext\n if (!jsxRenderContext) {\n jsxRenderContext = this.getCellJsxRenderContext(cellScope, cellContext);\n }\n // beanInstance\n if (beanInstance) {\n // jsx: props\n if (!cellProps) {\n // cellProps = isJsxComponent(render) ? Object.assign({}, columnProps, cast(render).props) : columnProps;\n cellProps = columnProps;\n }\n const cellProps2 = this.zovaJsx.renderJsxProps(\n cellProps,\n {},\n cellScope,\n jsxRenderContext,\n ) as any;\n if (cellProps2.class || cellProps2.style) {\n cellProps2.class = jsxRenderContext.$host.$cssMerge(\n cellProps2.class,\n jsxRenderContext.$host.$style(cellProps2.style),\n );\n delete cellProps2.style;\n }\n return beanInstance.render(cellProps2, jsxRenderContext, () => {\n const children = isJsxComponent(render) && cast(render).children;\n if (children && children.length > 0) {\n return this.zovaJsx.renderJsxChildrenDirect(children, cellScope, jsxRenderContext);\n } else {\n return value;\n }\n });\n }\n // general component\n return this.zovaJsx.render(render!, {}, cellScope, jsxRenderContext);\n }\n\n public getColumnProperty(name: string): ISchemaObjectExtensionField | undefined {\n if (!this.properties) return;\n return this.properties.find(item => item.key === name);\n }\n\n private _getColumnCelEnv(): typeof celEnvBase {\n const celEnv = celEnvBase.clone();\n celEnv.registerFunction('getProperty(string):dyn', name => {\n return this.getColumnProperty(name);\n });\n celEnv.registerFunction('getValue(string):dyn', name => {\n return this.zovaJsx.transientObject.getValue(name) ?? null;\n });\n celEnv.registerFunction('getValue(string, dyn):dyn', (name, defaultValue) => {\n return this.zovaJsx.transientObject.getValue(name) ?? defaultValue;\n });\n return celEnv;\n }\n\n public getColumnScope(name: string, scopeExtra?: {}): ITableColumnScope {\n return objectAssignReactive({}, this.$props.tableScope, {\n name,\n property: this.getColumnProperty(name),\n ...scopeExtra,\n });\n }\n\n public getColumnComponentPropsTop(\n name: string,\n celScope: {},\n renderContext: {},\n ): ITableCellRenderColumnOptions {\n const property = this.getColumnProperty(name);\n const rest = property?.rest;\n return this._getColumnComponentPropsTopByRest(rest, name, celScope, renderContext);\n }\n\n private _getColumnComponentPropsTopByRest(\n rest: ISchemaObjectExtensionFieldRest | undefined,\n name: string,\n celScope: {},\n _renderContext: {},\n ): ITableCellRenderColumnOptions {\n const visible = this.zovaJsx.evaluateExpression(rest?.visible, celScope);\n const render = rest?.render as TypeTableCellRenderComponent | undefined;\n const columnProps = Object.assign({ key: name }, cast(rest)?.columnProps);\n return { visible, render, columnProps };\n }\n\n // public getRenderFlattern(render: TypeTableCellRenderComponent): TypeTableCellRenderComponent {\n // return isJsxComponent(render) ? cast(render).type : render;\n // }\n\n public getRenderProvider(\n render: TypeTableCellRenderComponent | undefined,\n ): TypeTableCellRenderComponentProvider {\n if (!render) return 'text';\n if (typeof render === 'string' && render.includes(':')) {\n return beanFullNameFromOnionName(render, 'tableCell');\n }\n return render;\n }\n}\n","import type { AriaAttributes, CSSProperties } from 'vue';\n\nimport { FlexRender } from '@tanstack/vue-table';\nimport { BeanRenderBase } from 'zova';\nimport { Render } from 'zova-module-a-bean';\n\n@Render()\nexport class RenderTable extends BeanRenderBase {\n private _getColumnStyle(column: any): CSSProperties {\n const rest = (column.columnDef.meta as any)?.rest;\n const fixed = column.getIsPinned();\n const width = rest?.width ? `${rest.width}px` : undefined;\n return {\n width,\n minWidth: width,\n textAlign: rest?.align,\n position: fixed ? ('sticky' as const) : undefined,\n left: fixed === 'left' ? `${column.getStart('left')}px` : undefined,\n right: fixed === 'right' ? `${column.getAfter('right')}px` : undefined,\n zIndex: fixed ? 1 : undefined,\n };\n }\n\n private _renderTableDefault() {\n const table = this.table;\n return (\n <table class=\"table\">\n <thead>\n <tr>\n {table.getFlatHeaders().map(header => {\n const column = header.column;\n const canSort = column.getCanSort();\n const sorted = column.getIsSorted();\n const fixed = column.getIsPinned();\n const headerDefinition = column.columnDef.header;\n const headerContent = (\n <FlexRender render={headerDefinition} props={header.getContext()}></FlexRender>\n );\n let sortAria: AriaAttributes['aria-sort'] = 'none';\n let sortIcon: '▲' | '▼' | '↕' = '↕';\n if (sorted === 'asc') {\n sortAria = 'ascending';\n sortIcon = '▲';\n } else if (sorted === 'desc') {\n sortAria = 'descending';\n sortIcon = '▼';\n }\n return (\n <th\n key={header.id}\n class={fixed ? 'bg-base-100' : undefined}\n style={this._getColumnStyle(column)}\n aria-sort={sortAria}\n >\n {canSort ? (\n <button\n type=\"button\"\n class=\"inline-flex w-full items-center gap-1\"\n onClick={column.getToggleSortingHandler()}\n aria-label={`Sort by ${column.id}`}\n >\n {headerContent}\n <span aria-hidden=\"true\">{sortIcon}</span>\n </button>\n ) : (\n headerContent\n )}\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody>\n {table.getRowModel().rows.map(row => {\n return (\n <tr key={row.id}>\n {row.getVisibleCells().map(cell => {\n const column = cell.column;\n return (\n <td\n key={cell.id}\n class={column.getIsPinned() ? 'bg-base-100' : undefined}\n style={this._getColumnStyle(column)}\n >\n <FlexRender\n render={column.columnDef.cell}\n props={cell.getContext()}\n ></FlexRender>\n </td>\n );\n })}\n </tr>\n );\n })}\n </tbody>\n </table>\n );\n }\n\n public render() {\n return this.$slotDefault ? this.$slotDefault(this) : this._renderTableDefault();\n }\n}\n","import { defineComponent } from 'vue';\nimport { prepareComponentOptions, useController } from 'zova';\nimport { ControllerTable } from '../../component/table/controller.jsx';\nimport { RenderTable } from '../../component/table/render.jsx';\nexport const ZTable = defineComponent(_props => {\n useController(ControllerTable, RenderTable, undefined);\n return () => {};\n}, prepareComponentOptions());","export const config = _sys => {\n return {\n renderFallbackValue: '--'\n };\n};","var _dec, _dec2, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\n// eslint-disable\n/** controller: begin */\nexport * from '../component/table/controller.jsx';\nimport 'zova';\n/** controller: end */\n/** controller: begin */\nimport { ControllerTable } from '../component/table/controller.jsx';\nimport 'zova';\n/** controller: end */\n\n/** components: begin */\nexport * from './component/table.js';\nimport { ZTable } from './component/table.js';\nexport const components = {\n 'table': ZTable\n};\nimport 'zova';\n/** components: end */\n/** render: begin */\nexport * from '../component/table/render.jsx';\nimport 'zova';\n/** render: end */\n/** render: begin */\nimport { RenderTable } from '../component/table/render.jsx';\nimport 'zova';\n/** render: end */\n/** config: begin */\nexport * from '../config/config.js';\n/** config: end */\n/** scope: begin */\nimport { BeanScopeBase } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\nexport let ScopeModuleATable = (_dec = Scope(), _dec2 = __z_BeanInfo({\n module: \"a-table\"\n}), _dec(_class = _dec2(_class = class ScopeModuleATable extends BeanScopeBase {}) || _class) || _class);\nimport 'zova';\n\n/** scope: end */","import { useVueTable } from '@tanstack/vue-table';\nimport { markRaw } from 'vue';\nimport { BeanControllerPageBase } from 'zova';\nexport class BeanControllerPageTableBase extends BeanControllerPageBase {\n constructor(...args) {\n super(...args);\n this.table = void 0;\n }\n $useTable(initialOptions) {\n return this.ctx.util.instanceScope(() => {\n return markRaw(useVueTable(initialOptions));\n });\n }\n async refreshMeta() {\n throw new Error('should implement refreshMeta');\n }\n}","import { createBeanDecorator } from 'zova';\nexport function TableCell(options) {\n return createBeanDecorator('tableCell', 'app', true, options);\n}"],"mappings":";;;;;;;AAGA,IAAa,0BAAb,cAA6C,mBAAmB;CAC9D,YAAY,GAAG,MAAM;EACnB,MAAM,GAAG,IAAI;EACb,KAAK,QAAQ,KAAK;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reRowModel","appResource","beanFullNameFromOnionName","cast","deepEqual","deepExtend","objectAssignReactive","isJsxComponent","ZovaJsx","Controller","BeanControllerTableBase","TableColumnIdSelection","ControllerTable","_dec","_dec2","__z_BeanInfo","module","_class","_ControllerTable","constructor","args","properties","columns","tableMeta","zovaJsx","columnCelEnv","__init__","bean","_setBean","_getColumnCelEnv","_newBeanSimple","undefined","_createProperties","refreshMeta","$watch","$props","schema","newValue","oldValue","enableRowSelection","_createTable","data","sorting","rowSelection","_createTableMeta","_createColumns","table","setColumnPinning","_getColumnPinning","self","tableOptions","getRowId","originalRow","index","parent","_getRowId","renderFallbackValue","scope","config","manualPagination","manualSorting","enableMultiSort","enableSortingRemoval","row","_canSelectRow","state","onSortingChange","updater","slice","onRowSelectionChange","initialState","columnPinning","$useTable","getColumns","_createColumnsMiddle","key","render","columnScope","getColumnScope","jsxRenderContext","getColumnJsxRenderContext","visible","columnProps","getColumnComponentPropsTop","_createColumnRender","columnHelper","display","id","header","cell","size","enableSorting","meta","rest","fixed","width","align","property","push","accessor","_props","title","props","renders","_isOrderable","sortDescFirst","String","originalId","original","getParentRow","left","right","schemaOrder","keys","schemaKey","schemaKeys","some","Object","prototype","hasOwnProperty","call","$computed","$sdk","loadSchemaProperties","promises","res","Promise","all","filter","_item","item","forEach","celScope","app","ctx","$scene","$host","$celScope","$jsx","$$table","getCellJsxRenderContext","cellContext","cellRenderPrepare","Array","isArray","renderProviders","map","getRenderProvider","renderProvider","includes","_getBean","renderContext","beanInstance","beanOptions","getBean","onionOptions","options","checkVisible","_cellRender","cellRender","cellScope","_getBeanSyncOnly","cellProps","setTransientObject","getValue","name","_cellRenderInner","value","fallbackValue","cellProps2","renderJsxProps","class","style","$cssMerge","$style","children","length","renderJsxChildrenDirect","getColumnProperty","find","celEnv","clone","registerFunction","transientObject","defaultValue","scopeExtra","tableScope","_getColumnComponentPropsTopByRest","_renderContext","evaluateExpression","assign","$propsDefault","FlexRender","BeanRenderBase","Render","TableColumnIdSelection","RenderTable","_dec","_dec2","__z_BeanInfo","module","_class","_getColumnStyle","column","rest","columnDef","meta","fixed","getIsPinned","width","undefined","minWidth","textAlign","align","position","left","getStart","right","getAfter","zIndex","_renderTableDefault","table","_createVNode","getFlatHeaders","map","header","canSort","getCanSort","sorted","getIsSorted","headerDefinition","selection","id","headerContent","getIsAllPageRowsSelected","getIsSomePageRowsSelected","getRowModel","rows","every","row","getCanSelect","getToggleAllPageRowsSelectedHandler","getContext","sortAria","sortIcon","getToggleSortingHandler","getIsSelected","getVisibleCells","cell","getToggleSelectedHandler","render","$slotDefault"],"sources":["../src/lib/beanControllerTableBase.ts","../src/types/table.ts","../src/component/table/controller.tsx","../src/component/table/render.tsx","../src/.metadata/component/table.ts","../src/config/config.ts","../src/.metadata/index.ts","../src/lib/beanControllerPageTableBase.ts","../src/lib/tableCell.ts"],"sourcesContent":["import { useVueTable } from '@tanstack/vue-table';\nimport { markRaw } from 'vue';\nimport { BeanControllerBase } from 'zova';\nexport class BeanControllerTableBase extends BeanControllerBase {\n constructor(...args) {\n super(...args);\n this.table = void 0;\n }\n $useTable(initialOptions) {\n return this.ctx.util.instanceScope(() => {\n return markRaw(useVueTable(initialOptions));\n });\n }\n async refreshMeta() {\n throw new Error('should implement refreshMeta');\n }\n}","export const TableColumnIdSelection = '$$selection';","import type {\n IResourceTableActionRowOptionsBase,\n ISchemaObjectExtensionField,\n ISchemaObjectExtensionFieldRest,\n TypeTableCellRenderComponent,\n TypeTableCellRenderComponentProvider,\n} from 'zova-module-a-openapi';\n\nimport { celEnvBase, isNilOrEmptyString } from '@cabloy/utils';\nimport {\n CellContext,\n createColumnHelper,\n functionalUpdate,\n getCoreRowModel,\n OnChangeFn,\n Row,\n RowSelectionState,\n SortingState,\n TableOptionsWithReactiveData,\n} from '@tanstack/vue-table';\nimport { SchemaObject } from 'openapi3-ts/oas31';\nimport { VNode } from 'vue';\nimport {\n appResource,\n beanFullNameFromOnionName,\n cast,\n deepEqual,\n deepExtend,\n objectAssignReactive,\n} from 'zova';\nimport { isJsxComponent, ZovaJsx } from 'zova-jsx';\nimport { Controller } from 'zova-module-a-bean';\n\nimport type { ITableMeta, TypeColumn, TypeTableGetColumns } from '../../types/table.js';\nimport type {\n IDecoratorTableCellOptions,\n IJsxRenderContextTableCell,\n ITableCellRender,\n} from '../../types/tableCell.js';\nimport type {\n IJsxRenderContextTableColumn,\n ITableCellRenderColumnProps,\n ITableCellScope,\n ITableColumnScope,\n ITableScope,\n TypeTableCellRender,\n} from '../../types/tableColumn.js';\n\nimport { BeanControllerTableBase } from '../../lib/beanControllerTableBase.js';\nimport { TableColumnIdSelection } from '../../types/table.js';\nimport { ITableCellRenderColumnOptions } from '../../types/tableColumn.js';\n\nexport interface ControllerTableProps<TData extends {} = {}> {\n data?: TData[];\n schema?: SchemaObject;\n schemaOrder?: SchemaObject;\n sorting?: SortingState;\n onSortingChange?: OnChangeFn<SortingState>;\n enableRowSelection?: boolean | ((row: Row<TData>) => boolean);\n rowSelection?: RowSelectionState;\n onRowSelectionChange?: OnChangeFn<RowSelectionState>;\n tableScope?: ITableScope;\n getColumns?: TypeTableGetColumns<TData>;\n slotDefault?: (table: ControllerTable<TData>) => VNode;\n getRowId?: (originalRow: TData, index: number, parent?: Row<TData>) => string;\n}\n\n@Controller()\nexport class ControllerTable<TData extends {} = {}> extends BeanControllerTableBase<TData> {\n static $propsDefault = {};\n\n // table: TypeTable<TData>; // in BeanControllerTableBase\n\n properties: ISchemaObjectExtensionField[] | undefined;\n columns: TypeColumn<TData>[];\n tableMeta: ITableMeta<TData>;\n zovaJsx: ZovaJsx;\n columnCelEnv: typeof celEnvBase;\n\n protected async __init__() {\n this.bean._setBean('$$table', this);\n // jsx\n this.columnCelEnv = this._getColumnCelEnv();\n this.zovaJsx = this.bean._newBeanSimple(ZovaJsx, false, undefined, this.columnCelEnv);\n // properties\n this._createProperties();\n // tableMeta/columns\n await this.refreshMeta();\n // watch\n this.$watch(\n () => this.$props.schema,\n async (newValue, oldValue) => {\n if (deepEqual(newValue, oldValue)) return;\n await this.refreshMeta();\n },\n );\n this.$watch(\n () => this.$props.enableRowSelection,\n async (newValue, oldValue) => {\n if (newValue === oldValue) return;\n await this.refreshMeta();\n },\n );\n // table\n this._createTable();\n }\n\n public get schema() {\n return this.$props.schema;\n }\n\n public get data() {\n return this.$props.data;\n }\n\n public get sorting() {\n return this.$props.sorting ?? [];\n }\n\n public get rowSelection() {\n return this.$props.rowSelection ?? {};\n }\n\n public async refreshMeta() {\n this.tableMeta = await this._createTableMeta();\n this.columns = await this._createColumns();\n this.table?.setColumnPinning(this._getColumnPinning());\n }\n\n private _createTable() {\n // eslint-disable-next-line\n const self = this;\n const tableOptions: TableOptionsWithReactiveData<TData> = {\n getRowId: (originalRow, index, parent) => this._getRowId(originalRow, index, parent),\n getCoreRowModel: getCoreRowModel(),\n renderFallbackValue: this.scope.config.renderFallbackValue,\n manualPagination: true,\n manualSorting: true,\n enableMultiSort: false,\n enableSortingRemoval: false,\n enableRowSelection: row => self._canSelectRow(row),\n state: {\n get sorting() {\n return self.sorting;\n },\n get rowSelection() {\n return self.rowSelection;\n },\n },\n onSortingChange: updater => {\n const sorting = functionalUpdate(updater, self.sorting).slice(0, 1);\n self.$props.onSortingChange?.(sorting);\n },\n onRowSelectionChange: updater => {\n const rowSelection = functionalUpdate(updater, self.rowSelection);\n self.$props.onRowSelectionChange?.(rowSelection);\n },\n get initialState() {\n const columnPinning = self._getColumnPinning();\n return { columnPinning };\n },\n get data() {\n return self.data || [];\n },\n get columns() {\n return self.columns;\n },\n };\n this.table = this.$useTable(tableOptions);\n this.table.setColumnPinning(this._getColumnPinning());\n }\n\n private async _createColumns() {\n if (!this.properties) return [];\n const columns = !this.$props.getColumns\n ? await this._createColumnsMiddle(this.tableMeta.properties)\n : await this.$props.getColumns(\n async properties => {\n return await this._createColumnsMiddle(properties ?? this.tableMeta.properties);\n },\n async (\n key: string,\n render: TypeTableCellRenderComponent,\n ): Promise<TypeTableCellRender<TData, any> | undefined> => {\n // columnScope\n const columnScope = this.getColumnScope(key);\n // renderContext\n const jsxRenderContext = this.getColumnJsxRenderContext(columnScope);\n // columnProps\n const { visible, columnProps } = this.getColumnComponentPropsTop(\n key,\n columnScope,\n jsxRenderContext,\n );\n // visible\n if (visible === false) return;\n return await this._createColumnRender(\n render,\n columnProps,\n columnScope,\n jsxRenderContext,\n );\n },\n this,\n );\n if (!this.$props.enableRowSelection) return columns;\n const columnHelper = createColumnHelper<TData>();\n return [\n columnHelper.display({\n id: TableColumnIdSelection,\n header: '',\n cell: '',\n size: 48,\n enableSorting: false,\n meta: { rest: { fixed: 'left', width: 48, align: 'center' } },\n }),\n ...columns,\n ];\n }\n\n private async _createColumnsMiddle(\n properties: ISchemaObjectExtensionField[],\n ): Promise<TypeColumn<TData>[]> {\n const tableMeta = this.tableMeta;\n const columnHelper = createColumnHelper<TData>();\n const columns: TypeColumn<TData>[] = [];\n for (const property of properties) {\n const key = property.key!;\n columns.push(\n columnHelper.accessor(key as any, {\n id: key,\n header: _props => {\n return property?.title || key;\n },\n cell: props => tableMeta.renders[key](props),\n size: property.rest?.width,\n enableSorting: property.rest?.enableSorting === true && this._isOrderable(property),\n sortDescFirst: property.rest?.sortDescFirst === true,\n meta: { rest: property.rest },\n }),\n );\n }\n return columns;\n }\n\n private _getRowId(originalRow: TData, index: number, parent?: Row<TData>) {\n const id = this.$props.getRowId?.(originalRow, index, parent) ?? cast(originalRow).id;\n if (isNilOrEmptyString(id)) {\n return `__unselectable_${parent ? `${parent.id}.` : ''}${index}`;\n }\n return String(id);\n }\n\n private _canSelectRow(row: Row<TData>) {\n const enableRowSelection = this.$props.enableRowSelection;\n if (!enableRowSelection) return false;\n const originalId =\n this.$props.getRowId?.(row.original, row.index, row.getParentRow()) ?? cast(row.original).id;\n if (isNilOrEmptyString(originalId)) return false;\n return typeof enableRowSelection === 'function' ? enableRowSelection(row) : true;\n }\n\n private _getColumnPinning() {\n const left: string[] = this.$props.enableRowSelection ? [TableColumnIdSelection] : [];\n const right: string[] = [];\n for (const property of this.tableMeta?.properties ?? []) {\n const fixed = property.rest?.fixed;\n if (fixed === 'left') left.push(property.key!);\n if (fixed === 'right') right.push(property.key!);\n }\n return { left, right };\n }\n\n private _isOrderable(property: ISchemaObjectExtensionField) {\n const properties = this.$props.schemaOrder?.properties;\n if (!properties) return false;\n const keys = [property.key, property.schemaKey, ...(property.schemaKeys ?? [])];\n return keys.some(key => key && Object.prototype.hasOwnProperty.call(properties, key));\n }\n\n private _createProperties() {\n this.properties = this.$computed(() => {\n return this.$sdk.loadSchemaProperties(this.schema, 'table');\n });\n }\n\n private async _createTableMeta() {\n let properties: ISchemaObjectExtensionField[] = [];\n const renders: Record<string, TypeTableCellRender<TData>> = {};\n if (!this.properties) return { properties, renders };\n const promises: Promise<any>[] = [];\n for (const property of this.properties) {\n const key = property.key!;\n // columnScope\n const columnScope = this.getColumnScope(key);\n // renderContext\n const jsxRenderContext = this.getColumnJsxRenderContext(columnScope);\n // columnProps\n const { visible, render, columnProps } = this.getColumnComponentPropsTop(\n key,\n columnScope,\n jsxRenderContext,\n );\n // visible\n if (visible === false) continue;\n // property\n properties.push(property);\n // render\n promises.push(this._createColumnRender(render, columnProps, columnScope, jsxRenderContext));\n }\n let res = await Promise.all(promises);\n properties = properties.filter((_item, index) => !!res[index]);\n res = res.filter(item => !!item);\n properties.forEach((item, index) => {\n renders[item.key!] = res[index];\n });\n return { properties, renders };\n }\n\n public getColumnJsxRenderContext(celScope: ITableColumnScope): IJsxRenderContextTableColumn {\n return {\n app: this.app,\n ctx: this.ctx,\n $scene: 'tableColumn',\n $host: this,\n $celScope: celScope,\n $jsx: this.zovaJsx,\n $$table: this,\n };\n }\n\n public getCellJsxRenderContext(\n celScope: ITableCellScope,\n cellContext: CellContext<TData, any>,\n ): IJsxRenderContextTableCell {\n return {\n app: this.app,\n ctx: this.ctx,\n $scene: 'tableCell',\n $host: this,\n $celScope: celScope,\n $jsx: this.zovaJsx,\n $$table: this,\n cellContext,\n };\n }\n\n public async cellRenderPrepare(\n renders: TypeTableCellRenderComponent | TypeTableCellRenderComponent[],\n ) {\n if (!Array.isArray(renders)) renders = [renders];\n const renderProviders = renders.map(item => this.getRenderProvider(item));\n const promises: Promise<any>[] = renderProviders.map(renderProvider =>\n (async () => {\n if (typeof renderProvider === 'string' && renderProvider.includes('.tableCell.')) {\n return await this.app.bean._getBean(renderProvider as any, true);\n }\n })(),\n );\n return await Promise.all(promises);\n }\n\n private async _createColumnRender(\n render: TypeTableCellRenderComponent | undefined,\n columnProps: ITableCellRenderColumnProps | undefined,\n columnScope: ITableColumnScope,\n renderContext: IJsxRenderContextTableColumn,\n ): Promise<TypeTableCellRender<TData, any> | undefined> {\n // renderProvider\n const renderProvider = this.getRenderProvider(render);\n // beanInstance\n let beanInstance: ITableCellRender | undefined;\n if (typeof renderProvider === 'string' && renderProvider.includes('.tableCell.')) {\n beanInstance = await this.app.bean._getBean(renderProvider as any, true);\n const beanOptions = appResource.getBean(renderProvider as any);\n const onionOptions = beanOptions?.options as IDecoratorTableCellOptions | undefined;\n columnProps = deepExtend({}, onionOptions, columnProps);\n // should not eval jsx columnProps\n // columnProps = this.zovaJsx.renderJsxProps(columnProps as any, {}, columnScope, renderContext) as any;\n if (\n beanInstance?.checkVisible &&\n !(await beanInstance.checkVisible(columnProps as any, renderContext))\n ) {\n return;\n }\n }\n return cellContext => {\n if (!cellContext) return;\n return this._cellRender(\n render,\n columnProps,\n columnScope,\n cellContext,\n renderProvider,\n beanInstance,\n undefined,\n undefined,\n undefined,\n );\n };\n }\n\n public cellRender(\n render: TypeTableCellRenderComponent,\n columnProps: IResourceTableActionRowOptionsBase,\n renderContext: IJsxRenderContextTableCell,\n ) {\n // render\n const cellScope = renderContext.$celScope;\n // renderProvider\n const renderProvider = this.getRenderProvider(render);\n // beanInstance\n let beanInstance: ITableCellRender | undefined;\n if (typeof renderProvider === 'string' && renderProvider.includes('.tableCell.')) {\n beanInstance = this.app.bean._getBeanSyncOnly(renderProvider as any);\n const beanOptions = appResource.getBean(renderProvider as any);\n const onionOptions = beanOptions?.options as IDecoratorTableCellOptions | undefined;\n columnProps = deepExtend({}, onionOptions, columnProps);\n // should not eval jsx columnProps\n // columnProps = this.zovaJsx.renderJsxProps(columnProps as any, {}, renderContext.$celScope, renderContext) as any;\n }\n // const cellProps = isJsxComponent(render) ? Object.assign({}, columnProps, cast(render).props) : columnProps;\n const cellProps = columnProps;\n return this._cellRender(\n render,\n columnProps as ITableCellRenderColumnProps,\n undefined,\n renderContext.cellContext,\n renderProvider,\n beanInstance,\n cellProps,\n cellScope,\n renderContext,\n );\n }\n\n private _cellRender(\n render: TypeTableCellRenderComponent | undefined,\n columnProps: ITableCellRenderColumnProps | undefined,\n columnScope: ITableColumnScope | undefined,\n cellContext: CellContext<TData, any>,\n renderProvider: TypeTableCellRenderComponentProvider,\n beanInstance: ITableCellRender | undefined,\n cellProps: any | undefined,\n cellScope: ITableCellScope | undefined,\n jsxRenderContext: IJsxRenderContextTableCell | undefined,\n ) {\n return this.zovaJsx.setTransientObject(\n {\n getValue: (name: string) => {\n return cellContext.row.getValue(name);\n },\n },\n () => {\n return this._cellRenderInner(\n render,\n columnProps,\n columnScope,\n cellContext,\n renderProvider,\n beanInstance,\n cellProps,\n cellScope,\n jsxRenderContext,\n );\n },\n );\n }\n\n private _cellRenderInner(\n render: TypeTableCellRenderComponent | undefined,\n columnProps: ITableCellRenderColumnProps | undefined,\n columnScope: ITableColumnScope | undefined,\n cellContext: CellContext<TData, any>,\n renderProvider: TypeTableCellRenderComponentProvider,\n beanInstance: ITableCellRender | undefined,\n cellProps: any | undefined,\n cellScope: ITableCellScope | undefined,\n jsxRenderContext: IJsxRenderContextTableCell | undefined,\n ) {\n // value\n const value = cellContext.getValue();\n // renderFallbackValue\n const fallbackValue = this.table.options.renderFallbackValue;\n // cellScope\n if (!cellScope) {\n cellScope = objectAssignReactive({}, columnScope, { value, fallbackValue })!;\n }\n // render: text\n if (renderProvider === ('text' as TypeTableCellRenderComponent)) {\n return isNilOrEmptyString(value) ? fallbackValue : value;\n }\n // renderContext\n if (!jsxRenderContext) {\n jsxRenderContext = this.getCellJsxRenderContext(cellScope, cellContext);\n }\n // beanInstance\n if (beanInstance) {\n // jsx: props\n if (!cellProps) {\n // cellProps = isJsxComponent(render) ? Object.assign({}, columnProps, cast(render).props) : columnProps;\n cellProps = columnProps;\n }\n const cellProps2 = this.zovaJsx.renderJsxProps(\n cellProps,\n {},\n cellScope,\n jsxRenderContext,\n ) as any;\n if (cellProps2.class || cellProps2.style) {\n cellProps2.class = jsxRenderContext.$host.$cssMerge(\n cellProps2.class,\n jsxRenderContext.$host.$style(cellProps2.style),\n );\n delete cellProps2.style;\n }\n return beanInstance.render(cellProps2, jsxRenderContext, () => {\n const children = isJsxComponent(render) && cast(render).children;\n if (children && children.length > 0) {\n return this.zovaJsx.renderJsxChildrenDirect(children, cellScope, jsxRenderContext);\n } else {\n return value;\n }\n });\n }\n // general component\n return this.zovaJsx.render(render!, {}, cellScope, jsxRenderContext);\n }\n\n public getColumnProperty(name: string): ISchemaObjectExtensionField | undefined {\n if (!this.properties) return;\n return this.properties.find(item => item.key === name);\n }\n\n private _getColumnCelEnv(): typeof celEnvBase {\n const celEnv = celEnvBase.clone();\n celEnv.registerFunction('getProperty(string):dyn', name => {\n return this.getColumnProperty(name);\n });\n celEnv.registerFunction('getValue(string):dyn', name => {\n return this.zovaJsx.transientObject.getValue(name) ?? null;\n });\n celEnv.registerFunction('getValue(string, dyn):dyn', (name, defaultValue) => {\n return this.zovaJsx.transientObject.getValue(name) ?? defaultValue;\n });\n return celEnv;\n }\n\n public getColumnScope(name: string, scopeExtra?: {}): ITableColumnScope {\n return objectAssignReactive({}, this.$props.tableScope, {\n name,\n property: this.getColumnProperty(name),\n ...scopeExtra,\n });\n }\n\n public getColumnComponentPropsTop(\n name: string,\n celScope: {},\n renderContext: {},\n ): ITableCellRenderColumnOptions {\n const property = this.getColumnProperty(name);\n const rest = property?.rest;\n return this._getColumnComponentPropsTopByRest(rest, name, celScope, renderContext);\n }\n\n private _getColumnComponentPropsTopByRest(\n rest: ISchemaObjectExtensionFieldRest | undefined,\n name: string,\n celScope: {},\n _renderContext: {},\n ): ITableCellRenderColumnOptions {\n const visible = this.zovaJsx.evaluateExpression(rest?.visible, celScope);\n const render = rest?.render as TypeTableCellRenderComponent | undefined;\n const columnProps = Object.assign({ key: name }, cast(rest)?.columnProps);\n return { visible, render, columnProps };\n }\n\n // public getRenderFlattern(render: TypeTableCellRenderComponent): TypeTableCellRenderComponent {\n // return isJsxComponent(render) ? cast(render).type : render;\n // }\n\n public getRenderProvider(\n render: TypeTableCellRenderComponent | undefined,\n ): TypeTableCellRenderComponentProvider {\n if (!render) return 'text';\n if (typeof render === 'string' && render.includes(':')) {\n return beanFullNameFromOnionName(render, 'tableCell');\n }\n return render;\n }\n}\n","import type { AriaAttributes, CSSProperties } from 'vue';\n\nimport { FlexRender } from '@tanstack/vue-table';\nimport { BeanRenderBase } from 'zova';\nimport { Render } from 'zova-module-a-bean';\n\nimport { TableColumnIdSelection } from '../../types/table.js';\n\n@Render()\nexport class RenderTable extends BeanRenderBase {\n private _getColumnStyle(column: any): CSSProperties {\n const rest = (column.columnDef.meta as any)?.rest;\n const fixed = column.getIsPinned();\n const width = rest?.width ? `${rest.width}px` : undefined;\n return {\n width,\n minWidth: width,\n textAlign: rest?.align,\n position: fixed ? ('sticky' as const) : undefined,\n left: fixed === 'left' ? `${column.getStart('left')}px` : undefined,\n right: fixed === 'right' ? `${column.getAfter('right')}px` : undefined,\n zIndex: fixed ? 1 : undefined,\n };\n }\n\n private _renderTableDefault() {\n const table = this.table;\n return (\n <table class=\"table\">\n <thead>\n <tr>\n {table.getFlatHeaders().map(header => {\n const column = header.column;\n const canSort = column.getCanSort();\n const sorted = column.getIsSorted();\n const fixed = column.getIsPinned();\n const headerDefinition = column.columnDef.header;\n const selection = column.id === TableColumnIdSelection;\n const headerContent = selection ? (\n <input\n type=\"checkbox\"\n checked={table.getIsAllPageRowsSelected()}\n indeterminate={table.getIsSomePageRowsSelected()}\n aria-checked={table.getIsSomePageRowsSelected() ? 'mixed' : undefined}\n aria-label=\"Select all rows on this page\"\n disabled={table.getRowModel().rows.every(row => !row.getCanSelect())}\n onChange={table.getToggleAllPageRowsSelectedHandler()}\n />\n ) : (\n <FlexRender render={headerDefinition} props={header.getContext()}></FlexRender>\n );\n let sortAria: AriaAttributes['aria-sort'] = 'none';\n let sortIcon: '▲' | '▼' | '↕' = '↕';\n if (sorted === 'asc') {\n sortAria = 'ascending';\n sortIcon = '▲';\n } else if (sorted === 'desc') {\n sortAria = 'descending';\n sortIcon = '▼';\n }\n return (\n <th\n key={header.id}\n class={fixed ? 'bg-base-100' : undefined}\n style={this._getColumnStyle(column)}\n aria-sort={sortAria}\n >\n {canSort ? (\n <button\n type=\"button\"\n class=\"inline-flex w-full items-center gap-1\"\n onClick={column.getToggleSortingHandler()}\n aria-label={`Sort by ${column.id}`}\n >\n {headerContent}\n <span aria-hidden=\"true\">{sortIcon}</span>\n </button>\n ) : (\n headerContent\n )}\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody>\n {table.getRowModel().rows.map(row => {\n return (\n <tr key={row.id} aria-selected={row.getIsSelected()}>\n {row.getVisibleCells().map(cell => {\n const column = cell.column;\n const selection = column.id === TableColumnIdSelection;\n return (\n <td\n key={cell.id}\n class={column.getIsPinned() ? 'bg-base-100' : undefined}\n style={this._getColumnStyle(column)}\n >\n {selection ? (\n <input\n type=\"checkbox\"\n checked={row.getIsSelected()}\n disabled={!row.getCanSelect()}\n aria-label={`Select row ${row.id}`}\n onChange={row.getToggleSelectedHandler()}\n />\n ) : (\n <FlexRender\n render={column.columnDef.cell}\n props={cell.getContext()}\n ></FlexRender>\n )}\n </td>\n );\n })}\n </tr>\n );\n })}\n </tbody>\n </table>\n );\n }\n\n public render() {\n return this.$slotDefault ? this.$slotDefault(this) : this._renderTableDefault();\n }\n}\n","import { defineComponent } from 'vue';\nimport { prepareComponentOptions, useController } from 'zova';\nimport { ControllerTable } from '../../component/table/controller.jsx';\nimport { RenderTable } from '../../component/table/render.jsx';\nexport const ZTable = defineComponent(_props => {\n useController(ControllerTable, RenderTable, undefined);\n return () => {};\n}, prepareComponentOptions());","export const config = _sys => {\n return {\n renderFallbackValue: '--'\n };\n};","var _dec, _dec2, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\n// eslint-disable\n/** controller: begin */\nexport * from '../component/table/controller.jsx';\nimport 'zova';\n/** controller: end */\n/** controller: begin */\nimport { ControllerTable } from '../component/table/controller.jsx';\nimport 'zova';\n/** controller: end */\n\n/** components: begin */\nexport * from './component/table.js';\nimport { ZTable } from './component/table.js';\nexport const components = {\n 'table': ZTable\n};\nimport 'zova';\n/** components: end */\n/** render: begin */\nexport * from '../component/table/render.jsx';\nimport 'zova';\n/** render: end */\n/** render: begin */\nimport { RenderTable } from '../component/table/render.jsx';\nimport 'zova';\n/** render: end */\n/** config: begin */\nexport * from '../config/config.js';\n/** config: end */\n/** scope: begin */\nimport { BeanScopeBase } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\nexport let ScopeModuleATable = (_dec = Scope(), _dec2 = __z_BeanInfo({\n module: \"a-table\"\n}), _dec(_class = _dec2(_class = class ScopeModuleATable extends BeanScopeBase {}) || _class) || _class);\nimport 'zova';\n\n/** scope: end */","import { useVueTable } from '@tanstack/vue-table';\nimport { markRaw } from 'vue';\nimport { BeanControllerPageBase } from 'zova';\nexport class BeanControllerPageTableBase extends BeanControllerPageBase {\n constructor(...args) {\n super(...args);\n this.table = void 0;\n }\n $useTable(initialOptions) {\n return this.ctx.util.instanceScope(() => {\n return markRaw(useVueTable(initialOptions));\n });\n }\n async refreshMeta() {\n throw new Error('should implement refreshMeta');\n }\n}","import { createBeanDecorator } from 'zova';\nexport function TableCell(options) {\n return createBeanDecorator('tableCell', 'app', true, options);\n}"],"mappings":";;;;;;;AAGA,IAAa,0BAAb,cAA6C,mBAAmB;CAC9D,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AAG,wBAAwB,CAAC;;;ACP5B,IAAa,UAAS,SAAQ;CAC5B,OAAO,EACL,qBAAqB,KACvB;AACF;;;;;ACJA,IAAI,MAAM,OAAO;AAejB,IAAa,aAAa,EACxB,SAAS,OACX;AAiBA,IAAW,qBAAqB,OAAO,MAAM,GAAG,QAAQ,SAAa,EACnE,QAAQ,UACV,CAAC,GAAG,KAAK,SAAS,MAAM,SAAS,MAAM,0BAA0B,cAAc,CAAC,CAAC,KAAK,MAAM,KAAK;;;;ACjCjG,IAAa,8BAAb,cAAiD,uBAAuB;CACtE,YAAY,GAAG,MAAM;EACnB,MAAM,GAAG,IAAI;EACb,KAAK,QAAQ,KAAK;CACpB;CACA,UAAU,gBAAgB;EACxB,OAAO,KAAK,IAAI,KAAK,oBAAoB;GACvC,OAAO,QAAQ,YAAY,cAAc,CAAC;EAC5C,CAAC;CACH;CACA,MAAM,cAAc;EAClB,MAAM,IAAI,MAAM,8BAA8B;CAChD;AACF;;;ACfA,SAAgB,UAAU,SAAS;CACjC,OAAO,oBAAoB,aAAa,OAAO,MAAM,OAAO;AAC9D"}
|
package/dist/types/table.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { ControllerTable } from '../component/table/controller.jsx';
|
|
|
4
4
|
import type { TypeTableCellRender } from './tableColumn.js';
|
|
5
5
|
export type TypeTable<TData extends {} = {}> = ReturnType<typeof useVueTable<TData>>;
|
|
6
6
|
export type TypeColumn<TData extends {} = {}> = ColumnDef<TData, any>;
|
|
7
|
+
export declare const TableColumnIdSelection = "$$selection";
|
|
7
8
|
export interface ITableMeta<TData extends {} = {}> {
|
|
8
9
|
properties: ISchemaObjectExtensionField[];
|
|
9
10
|
renders: Record<string, TypeTableCellRender<TData>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/types/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAA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AG,EAAE,IAAI,CACvD,IAAI,EAAE,uBAAuB,CAAC,KAAK,CAAC,EACpC,kBAAkB,EAAE,2BAA2B,CAAC,KAAK,CAAC,EACtD,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,KAC1B,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getCoreRowModel,
|
|
15
15
|
OnChangeFn,
|
|
16
16
|
Row,
|
|
17
|
+
RowSelectionState,
|
|
17
18
|
SortingState,
|
|
18
19
|
TableOptionsWithReactiveData,
|
|
19
20
|
} from '@tanstack/vue-table';
|
|
@@ -46,6 +47,7 @@ import type {
|
|
|
46
47
|
} from '../../types/tableColumn.js';
|
|
47
48
|
|
|
48
49
|
import { BeanControllerTableBase } from '../../lib/beanControllerTableBase.js';
|
|
50
|
+
import { TableColumnIdSelection } from '../../types/table.js';
|
|
49
51
|
import { ITableCellRenderColumnOptions } from '../../types/tableColumn.js';
|
|
50
52
|
|
|
51
53
|
export interface ControllerTableProps<TData extends {} = {}> {
|
|
@@ -54,6 +56,9 @@ export interface ControllerTableProps<TData extends {} = {}> {
|
|
|
54
56
|
schemaOrder?: SchemaObject;
|
|
55
57
|
sorting?: SortingState;
|
|
56
58
|
onSortingChange?: OnChangeFn<SortingState>;
|
|
59
|
+
enableRowSelection?: boolean | ((row: Row<TData>) => boolean);
|
|
60
|
+
rowSelection?: RowSelectionState;
|
|
61
|
+
onRowSelectionChange?: OnChangeFn<RowSelectionState>;
|
|
57
62
|
tableScope?: ITableScope;
|
|
58
63
|
getColumns?: TypeTableGetColumns<TData>;
|
|
59
64
|
slotDefault?: (table: ControllerTable<TData>) => VNode;
|
|
@@ -89,6 +94,13 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
89
94
|
await this.refreshMeta();
|
|
90
95
|
},
|
|
91
96
|
);
|
|
97
|
+
this.$watch(
|
|
98
|
+
() => this.$props.enableRowSelection,
|
|
99
|
+
async (newValue, oldValue) => {
|
|
100
|
+
if (newValue === oldValue) return;
|
|
101
|
+
await this.refreshMeta();
|
|
102
|
+
},
|
|
103
|
+
);
|
|
92
104
|
// table
|
|
93
105
|
this._createTable();
|
|
94
106
|
}
|
|
@@ -105,6 +117,10 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
105
117
|
return this.$props.sorting ?? [];
|
|
106
118
|
}
|
|
107
119
|
|
|
120
|
+
public get rowSelection() {
|
|
121
|
+
return this.$props.rowSelection ?? {};
|
|
122
|
+
}
|
|
123
|
+
|
|
108
124
|
public async refreshMeta() {
|
|
109
125
|
this.tableMeta = await this._createTableMeta();
|
|
110
126
|
this.columns = await this._createColumns();
|
|
@@ -115,22 +131,30 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
115
131
|
// eslint-disable-next-line
|
|
116
132
|
const self = this;
|
|
117
133
|
const tableOptions: TableOptionsWithReactiveData<TData> = {
|
|
118
|
-
getRowId:
|
|
134
|
+
getRowId: (originalRow, index, parent) => this._getRowId(originalRow, index, parent),
|
|
119
135
|
getCoreRowModel: getCoreRowModel(),
|
|
120
136
|
renderFallbackValue: this.scope.config.renderFallbackValue,
|
|
121
137
|
manualPagination: true,
|
|
122
138
|
manualSorting: true,
|
|
123
139
|
enableMultiSort: false,
|
|
124
140
|
enableSortingRemoval: false,
|
|
141
|
+
enableRowSelection: row => self._canSelectRow(row),
|
|
125
142
|
state: {
|
|
126
143
|
get sorting() {
|
|
127
144
|
return self.sorting;
|
|
128
145
|
},
|
|
146
|
+
get rowSelection() {
|
|
147
|
+
return self.rowSelection;
|
|
148
|
+
},
|
|
129
149
|
},
|
|
130
150
|
onSortingChange: updater => {
|
|
131
151
|
const sorting = functionalUpdate(updater, self.sorting).slice(0, 1);
|
|
132
152
|
self.$props.onSortingChange?.(sorting);
|
|
133
153
|
},
|
|
154
|
+
onRowSelectionChange: updater => {
|
|
155
|
+
const rowSelection = functionalUpdate(updater, self.rowSelection);
|
|
156
|
+
self.$props.onRowSelectionChange?.(rowSelection);
|
|
157
|
+
},
|
|
134
158
|
get initialState() {
|
|
135
159
|
const columnPinning = self._getColumnPinning();
|
|
136
160
|
return { columnPinning };
|
|
@@ -148,31 +172,50 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
148
172
|
|
|
149
173
|
private async _createColumns() {
|
|
150
174
|
if (!this.properties) return [];
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
175
|
+
const columns = !this.$props.getColumns
|
|
176
|
+
? await this._createColumnsMiddle(this.tableMeta.properties)
|
|
177
|
+
: await this.$props.getColumns(
|
|
178
|
+
async properties => {
|
|
179
|
+
return await this._createColumnsMiddle(properties ?? this.tableMeta.properties);
|
|
180
|
+
},
|
|
181
|
+
async (
|
|
182
|
+
key: string,
|
|
183
|
+
render: TypeTableCellRenderComponent,
|
|
184
|
+
): Promise<TypeTableCellRender<TData, any> | undefined> => {
|
|
185
|
+
// columnScope
|
|
186
|
+
const columnScope = this.getColumnScope(key);
|
|
187
|
+
// renderContext
|
|
188
|
+
const jsxRenderContext = this.getColumnJsxRenderContext(columnScope);
|
|
189
|
+
// columnProps
|
|
190
|
+
const { visible, columnProps } = this.getColumnComponentPropsTop(
|
|
191
|
+
key,
|
|
192
|
+
columnScope,
|
|
193
|
+
jsxRenderContext,
|
|
194
|
+
);
|
|
195
|
+
// visible
|
|
196
|
+
if (visible === false) return;
|
|
197
|
+
return await this._createColumnRender(
|
|
198
|
+
render,
|
|
199
|
+
columnProps,
|
|
200
|
+
columnScope,
|
|
201
|
+
jsxRenderContext,
|
|
202
|
+
);
|
|
203
|
+
},
|
|
204
|
+
this,
|
|
169
205
|
);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
206
|
+
if (!this.$props.enableRowSelection) return columns;
|
|
207
|
+
const columnHelper = createColumnHelper<TData>();
|
|
208
|
+
return [
|
|
209
|
+
columnHelper.display({
|
|
210
|
+
id: TableColumnIdSelection,
|
|
211
|
+
header: '',
|
|
212
|
+
cell: '',
|
|
213
|
+
size: 48,
|
|
214
|
+
enableSorting: false,
|
|
215
|
+
meta: { rest: { fixed: 'left', width: 48, align: 'center' } },
|
|
216
|
+
}),
|
|
217
|
+
...columns,
|
|
218
|
+
];
|
|
176
219
|
}
|
|
177
220
|
|
|
178
221
|
private async _createColumnsMiddle(
|
|
@@ -200,8 +243,25 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
200
243
|
return columns;
|
|
201
244
|
}
|
|
202
245
|
|
|
246
|
+
private _getRowId(originalRow: TData, index: number, parent?: Row<TData>) {
|
|
247
|
+
const id = this.$props.getRowId?.(originalRow, index, parent) ?? cast(originalRow).id;
|
|
248
|
+
if (isNilOrEmptyString(id)) {
|
|
249
|
+
return `__unselectable_${parent ? `${parent.id}.` : ''}${index}`;
|
|
250
|
+
}
|
|
251
|
+
return String(id);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
private _canSelectRow(row: Row<TData>) {
|
|
255
|
+
const enableRowSelection = this.$props.enableRowSelection;
|
|
256
|
+
if (!enableRowSelection) return false;
|
|
257
|
+
const originalId =
|
|
258
|
+
this.$props.getRowId?.(row.original, row.index, row.getParentRow()) ?? cast(row.original).id;
|
|
259
|
+
if (isNilOrEmptyString(originalId)) return false;
|
|
260
|
+
return typeof enableRowSelection === 'function' ? enableRowSelection(row) : true;
|
|
261
|
+
}
|
|
262
|
+
|
|
203
263
|
private _getColumnPinning() {
|
|
204
|
-
const left: string[] = [];
|
|
264
|
+
const left: string[] = this.$props.enableRowSelection ? [TableColumnIdSelection] : [];
|
|
205
265
|
const right: string[] = [];
|
|
206
266
|
for (const property of this.tableMeta?.properties ?? []) {
|
|
207
267
|
const fixed = property.rest?.fixed;
|
|
@@ -4,6 +4,8 @@ import { FlexRender } from '@tanstack/vue-table';
|
|
|
4
4
|
import { BeanRenderBase } from 'zova';
|
|
5
5
|
import { Render } from 'zova-module-a-bean';
|
|
6
6
|
|
|
7
|
+
import { TableColumnIdSelection } from '../../types/table.js';
|
|
8
|
+
|
|
7
9
|
@Render()
|
|
8
10
|
export class RenderTable extends BeanRenderBase {
|
|
9
11
|
private _getColumnStyle(column: any): CSSProperties {
|
|
@@ -33,7 +35,18 @@ export class RenderTable extends BeanRenderBase {
|
|
|
33
35
|
const sorted = column.getIsSorted();
|
|
34
36
|
const fixed = column.getIsPinned();
|
|
35
37
|
const headerDefinition = column.columnDef.header;
|
|
36
|
-
const
|
|
38
|
+
const selection = column.id === TableColumnIdSelection;
|
|
39
|
+
const headerContent = selection ? (
|
|
40
|
+
<input
|
|
41
|
+
type="checkbox"
|
|
42
|
+
checked={table.getIsAllPageRowsSelected()}
|
|
43
|
+
indeterminate={table.getIsSomePageRowsSelected()}
|
|
44
|
+
aria-checked={table.getIsSomePageRowsSelected() ? 'mixed' : undefined}
|
|
45
|
+
aria-label="Select all rows on this page"
|
|
46
|
+
disabled={table.getRowModel().rows.every(row => !row.getCanSelect())}
|
|
47
|
+
onChange={table.getToggleAllPageRowsSelectedHandler()}
|
|
48
|
+
/>
|
|
49
|
+
) : (
|
|
37
50
|
<FlexRender render={headerDefinition} props={header.getContext()}></FlexRender>
|
|
38
51
|
);
|
|
39
52
|
let sortAria: AriaAttributes['aria-sort'] = 'none';
|
|
@@ -73,19 +86,30 @@ export class RenderTable extends BeanRenderBase {
|
|
|
73
86
|
<tbody>
|
|
74
87
|
{table.getRowModel().rows.map(row => {
|
|
75
88
|
return (
|
|
76
|
-
<tr key={row.id}>
|
|
89
|
+
<tr key={row.id} aria-selected={row.getIsSelected()}>
|
|
77
90
|
{row.getVisibleCells().map(cell => {
|
|
78
91
|
const column = cell.column;
|
|
92
|
+
const selection = column.id === TableColumnIdSelection;
|
|
79
93
|
return (
|
|
80
94
|
<td
|
|
81
95
|
key={cell.id}
|
|
82
96
|
class={column.getIsPinned() ? 'bg-base-100' : undefined}
|
|
83
97
|
style={this._getColumnStyle(column)}
|
|
84
98
|
>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
99
|
+
{selection ? (
|
|
100
|
+
<input
|
|
101
|
+
type="checkbox"
|
|
102
|
+
checked={row.getIsSelected()}
|
|
103
|
+
disabled={!row.getCanSelect()}
|
|
104
|
+
aria-label={`Select row ${row.id}`}
|
|
105
|
+
onChange={row.getToggleSelectedHandler()}
|
|
106
|
+
/>
|
|
107
|
+
) : (
|
|
108
|
+
<FlexRender
|
|
109
|
+
render={column.columnDef.cell}
|
|
110
|
+
props={cell.getContext()}
|
|
111
|
+
></FlexRender>
|
|
112
|
+
)}
|
|
89
113
|
</td>
|
|
90
114
|
);
|
|
91
115
|
})}
|
package/src/types/table.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type TypeTable<TData extends {} = {}> = ReturnType<typeof useVueTable<TDa
|
|
|
11
11
|
|
|
12
12
|
export type TypeColumn<TData extends {} = {}> = ColumnDef<TData, any>;
|
|
13
13
|
|
|
14
|
+
export const TableColumnIdSelection = '$$selection';
|
|
15
|
+
|
|
14
16
|
export interface ITableMeta<TData extends {} = {}> {
|
|
15
17
|
properties: ISchemaObjectExtensionField[];
|
|
16
18
|
renders: Record<string, TypeTableCellRender<TData>>;
|