zova-module-a-table 5.1.15 → 5.1.16
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/cli/tableCell/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +7 -6
- package/cli/tableCellActionRow/boilerplate/{{sceneName}}.{{beanName}}.tsx_ +19 -0
- package/dist/component/table/controller.d.ts +3 -7
- package/dist/component/table/controller.d.ts.map +1 -1
- package/dist/index.js +6 -39
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/component/table/controller.tsx +13 -31
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { IResourceTableCellOptionsBase } from 'zova-module-a-openapi';
|
|
2
2
|
|
|
3
3
|
import { BeanBase } from 'zova';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
4
|
+
import { TableCell, type IJsxRenderContextTableCell, type ITableCellRender, type NextTableCellRender } from 'zova-module-a-table';
|
|
5
|
+
|
|
6
|
+
declare module 'zova-module-a-openapi' {
|
|
7
|
+
export interface IResourceTableCellRecord {
|
|
8
|
+
'<%=argv.module%>:<%=argv.beanName%>'?: ITableCellOptions<%=argv.beanNameCapitalize%>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
10
11
|
|
|
11
12
|
export interface ITableCellOptions<%=argv.beanNameCapitalize%> extends IResourceTableCellOptionsBase {}
|
|
12
13
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IResourceTableActionRowOptionsBase } from 'zova-module-a-openapi';
|
|
2
|
+
|
|
3
|
+
import { BeanBase } from 'zova';
|
|
4
|
+
import { type IJsxRenderContextTableCell, type ITableCellRender, type NextTableCellRender, TableCell } from 'zova-module-a-table';
|
|
5
|
+
|
|
6
|
+
declare module 'zova-module-a-openapi' {
|
|
7
|
+
export interface IResourceTableActionRowRecord {
|
|
8
|
+
'<%=argv.module%>:<%=argv.beanName%>'?: ITableCellOptions<%=argv.beanNameCapitalize%>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ITableCellOptions<%=argv.beanNameCapitalize%> extends IResourceTableActionRowOptionsBase {}
|
|
13
|
+
|
|
14
|
+
@TableCell<ITableCellOptions<%=argv.beanNameCapitalize%>>()
|
|
15
|
+
export class TableCell<%=argv.beanNameCapitalize%> extends BeanBase implements ITableCellRender {
|
|
16
|
+
render(_options: ITableCellOptions<%=argv.beanNameCapitalize%>, _renderContext: IJsxRenderContextTableCell, next: NextTableCellRender) {
|
|
17
|
+
return next();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IResourceTableActionRowOptionsBase, TypeTableCellRenderComponent } from 'zova-module-a-openapi';
|
|
2
2
|
import { celEnvBase } from '@cabloy/utils';
|
|
3
3
|
import { CellContext } 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';
|
|
7
|
-
import { BeanResourceProviders } from 'zova-module-a-openapi';
|
|
8
7
|
import type { ITableMeta, TypeColumn, TypeTable, TypeTableGetColumns } from '../../types/table.js';
|
|
9
8
|
import type { IJsxRenderContextTableCell } from '../../types/tableCell.js';
|
|
10
9
|
import { BeanControllerTableBase } from '../../lib/beanControllerTableBase.js';
|
|
@@ -12,7 +11,6 @@ import { ITableCellRenderColumnOptions, type IJsxRenderContextTableColumn, type
|
|
|
12
11
|
export interface ControllerTableProps<TData extends {} = {}> {
|
|
13
12
|
data?: TData[];
|
|
14
13
|
schema?: SchemaObject;
|
|
15
|
-
tableProvider?: ITableProvider;
|
|
16
14
|
tableScope?: ITableScope;
|
|
17
15
|
getColumns?: TypeTableGetColumns<TData>;
|
|
18
16
|
slotDefault?: (table: ControllerTable<TData>) => VNode;
|
|
@@ -22,11 +20,9 @@ export declare class ControllerTable<TData extends {} = {}> extends BeanControll
|
|
|
22
20
|
properties: SchemaObject[] | undefined;
|
|
23
21
|
columns: TypeColumn<TData>[];
|
|
24
22
|
table: TypeTable<TData>;
|
|
25
|
-
tableProvider: ITableProvider;
|
|
26
23
|
tableMeta: ITableMeta<TData>;
|
|
27
24
|
zovaJsx: ZovaJsx;
|
|
28
25
|
columnCelEnv: typeof celEnvBase;
|
|
29
|
-
$$beanResourceProviders: BeanResourceProviders;
|
|
30
26
|
protected __init__(): Promise<void>;
|
|
31
27
|
get schema(): SchemaObject | undefined;
|
|
32
28
|
get data(): TData[] | undefined;
|
|
@@ -40,7 +36,7 @@ export declare class ControllerTable<TData extends {} = {}> extends BeanControll
|
|
|
40
36
|
getCellJsxRenderContext(celScope: ITableCellScope, cellContext: CellContext<TData, any>): IJsxRenderContextTableCell;
|
|
41
37
|
cellRenderPrepare(renders: TypeTableCellRenderComponent | TypeTableCellRenderComponent[]): Promise<any[]>;
|
|
42
38
|
private _createColumnRender;
|
|
43
|
-
cellRender(render: TypeTableCellRenderComponent, columnProps:
|
|
39
|
+
cellRender(render: TypeTableCellRenderComponent, columnProps: IResourceTableActionRowOptionsBase, renderContext: IJsxRenderContextTableCell): any;
|
|
44
40
|
private _cellRender;
|
|
45
41
|
private _cellRenderInner;
|
|
46
42
|
getColumnProperty(name: string): SchemaObject | undefined;
|
|
@@ -48,6 +44,6 @@ export declare class ControllerTable<TData extends {} = {}> extends BeanControll
|
|
|
48
44
|
getColumnScope(name: string, scopeExtra?: {}): ITableColumnScope;
|
|
49
45
|
getColumnComponentPropsTop(name: string, celScope: {}, renderContext: {}): ITableCellRenderColumnOptions;
|
|
50
46
|
private _getColumnComponentPropsTopByRest;
|
|
51
|
-
getRenderProvider(render: TypeTableCellRenderComponent | undefined):
|
|
47
|
+
getRenderProvider(render: TypeTableCellRenderComponent | undefined): TypeTableCellRenderComponent;
|
|
52
48
|
}
|
|
53
49
|
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/component/table/controller.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/component/table/controller.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAmC,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAE/I,OAAO,EAAE,UAAU,EAAsB,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAqE,MAAM,qBAAqB,CAAC;AACrH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAE5B,OAAO,EAAkB,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,KAAK,EAA8B,0BAA0B,EAAoB,MAAM,0BAA0B,CAAC;AAEzH,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EACL,6BAA6B,EAC7B,KAAK,4BAA4B,EAEjC,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAEjB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,oBAAoB,CAAC,KAAK,SAAS,EAAE,GAAG,EAAE;IACzD,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACxC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;CACxD;AAED,qBACa,eAAe,CAAC,KAAK,SAA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CAAC,MAAM,EAAE,4BAA4B,GAAG,SAAS,GAAG,4BAA4B;CAGzG"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BeanControllerBase, BeanControllerPageBase, BeanInfo, BeanRenderBase, BeanScopeBase,
|
|
1
|
+
import { BeanControllerBase, BeanControllerPageBase, BeanInfo, BeanRenderBase, BeanScopeBase, appResource, cast, createBeanDecorator, deepEqual, deepExtend, objectAssignReactive, prepareComponentOptions, useController } from "zova";
|
|
2
2
|
import { celEnvBase, isNilOrEmptyString } from "@cabloy/utils";
|
|
3
3
|
import { FlexRender, createColumnHelper, getCoreRowModel, useVueTable } from "@tanstack/vue-table";
|
|
4
4
|
import { classes } from "typestyle";
|
|
@@ -18,43 +18,21 @@ var BeanControllerTableBase = class extends BeanControllerBase {
|
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/component/table/controller.tsx
|
|
21
|
-
var _dec$2, _dec2$2,
|
|
22
|
-
|
|
23
|
-
r && Object.defineProperty(e, i, {
|
|
24
|
-
enumerable: r.enumerable,
|
|
25
|
-
configurable: r.configurable,
|
|
26
|
-
writable: r.writable,
|
|
27
|
-
value: r.initializer ? r.initializer.call(l) : void 0
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function _applyDecoratedDescriptor(i, e, r, n, l) {
|
|
31
|
-
var a = {};
|
|
32
|
-
return Object.keys(n).forEach(function(i) {
|
|
33
|
-
a[i] = n[i];
|
|
34
|
-
}), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function(r, n) {
|
|
35
|
-
return n(i, e, r) || r;
|
|
36
|
-
}, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a;
|
|
37
|
-
}
|
|
38
|
-
var ControllerTable = (_dec$2 = Controller(), _dec2$2 = BeanInfo({ module: "a-table" }), _dec3 = Use("a-openapi.bean.resourceProviders"), _dec4 = Reflect.metadata("design:type", typeof BeanResourceProviders === "undefined" ? Object : BeanResourceProviders), _dec$2(_class$2 = _dec2$2(_class$2 = (_class2 = (_ControllerTable = class ControllerTable extends BeanControllerTableBase {
|
|
21
|
+
var _dec$2, _dec2$2, _class$2, _ControllerTable;
|
|
22
|
+
var ControllerTable = (_dec$2 = Controller(), _dec2$2 = BeanInfo({ module: "a-table" }), _dec$2(_class$2 = _dec2$2(_class$2 = (_ControllerTable = class ControllerTable extends BeanControllerTableBase {
|
|
39
23
|
constructor(...args) {
|
|
40
24
|
super(...args);
|
|
41
25
|
this.properties = void 0;
|
|
42
26
|
this.columns = void 0;
|
|
43
27
|
this.table = void 0;
|
|
44
|
-
this.tableProvider = void 0;
|
|
45
28
|
this.tableMeta = void 0;
|
|
46
29
|
this.zovaJsx = void 0;
|
|
47
30
|
this.columnCelEnv = void 0;
|
|
48
|
-
_initializerDefineProperty(this, "$$beanResourceProviders", _descriptor, this);
|
|
49
31
|
}
|
|
50
32
|
async __init__() {
|
|
51
33
|
this.bean._setBean("$$table", this);
|
|
52
|
-
this.tableProvider = this.$computed(() => {
|
|
53
|
-
const tableProvider = this.$$beanResourceProviders.tableProvider;
|
|
54
|
-
return this.$props.tableProvider ? deepExtend({}, tableProvider, this.$props.tableProvider) : tableProvider;
|
|
55
|
-
});
|
|
56
34
|
this.columnCelEnv = this._getColumnCelEnv();
|
|
57
|
-
this.zovaJsx = this.bean._newBeanSimple(ZovaJsx, false,
|
|
35
|
+
this.zovaJsx = this.bean._newBeanSimple(ZovaJsx, false, void 0, this.columnCelEnv);
|
|
58
36
|
this._createProperties();
|
|
59
37
|
await this.refreshMeta();
|
|
60
38
|
this.$watch(() => this.$props.schema, async (newValue, oldValue) => {
|
|
@@ -271,20 +249,9 @@ var ControllerTable = (_dec$2 = Controller(), _dec2$2 = BeanInfo({ module: "a-ta
|
|
|
271
249
|
};
|
|
272
250
|
}
|
|
273
251
|
getRenderProvider(render) {
|
|
274
|
-
|
|
275
|
-
if (typeof render === "string") {
|
|
276
|
-
const render2 = this.tableProvider.components?.[render];
|
|
277
|
-
if (!render2) throw new Error(`not found table cell component of: ${render}`);
|
|
278
|
-
return render2;
|
|
279
|
-
}
|
|
280
|
-
return render;
|
|
252
|
+
return render || "text";
|
|
281
253
|
}
|
|
282
|
-
}, _ControllerTable.$propsDefault = {}, _ControllerTable)
|
|
283
|
-
configurable: true,
|
|
284
|
-
enumerable: true,
|
|
285
|
-
writable: true,
|
|
286
|
-
initializer: null
|
|
287
|
-
}), _class2)) || _class$2) || _class$2);
|
|
254
|
+
}, _ControllerTable.$propsDefault = {}, _ControllerTable)) || _class$2) || _class$2);
|
|
288
255
|
//#endregion
|
|
289
256
|
//#region src/component/table/render.tsx
|
|
290
257
|
var _dec$1, _dec2$1, _class$1;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["celEnvBase","isNilOrEmptyString","createColumnHelper","getCoreRowModel","classes","appResource","cast","deepEqual","deepExtend","objectAssignReactive","Use","isJsxComponent","ZovaJsx","Controller","BeanControllerTableBase","ControllerTable","_dec","_dec2","__z_BeanInfo","module","_dec3","_dec4","Reflect","metadata","BeanResourceProviders","Object","_class","_class2","_ControllerTable","constructor","args","properties","columns","table","tableProvider","tableMeta","zovaJsx","columnCelEnv","_initializerDefineProperty","_descriptor","__init__","bean","_setBean","$computed","$$beanResourceProviders","$props","_getColumnCelEnv","_newBeanSimple","components","_createProperties","refreshMeta","$watch","schema","newValue","oldValue","_createTable","data","_createTableMeta","_createColumns","self","tableOptions","getRowId","row","id","renderFallbackValue","scope","config","manualPagination","$useTable","getColumns","_createColumnsMiddle","key","render","columnScope","getColumnScope","jsxRenderContext","getColumnJsxRenderContext","visible","columnProps","getColumnComponentPropsTop","_createColumnRender","columnHelper","property","push","accessor","header","_props","title","cell","props","renders","$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","sys","_getBean","renderContext","beanInstance","beanOptions","getBean","onionOptions","options","checkVisible","_cellRender","undefined","cellRender","cellScope","_getBeanSyncOnly","cellProps","setTransientObject","getValue","name","_cellRenderInner","value","fallbackValue","cellProps2","renderJsxProps","class","style","$style","children","length","renderJsxChildrenDirect","getColumnProperty","find","celEnv","clone","registerFunction","transientObject","scopeExtra","tableScope","rest","_getColumnComponentPropsTopByRest","_renderContext","evaluateExpression","assign","render2","Error","$propsDefault","_applyDecoratedDescriptor","prototype","configurable","enumerable","writable","initializer","FlexRender","BeanRenderBase","Render","RenderTable","_dec","_dec2","__z_BeanInfo","module","_class","_renderTableDefault","table","_createVNode","getFlatHeaders","map","header","id","column","columnDef","getContext","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 type { RowData, Table } from '@tanstack/table-core';\nimport type { TableOptionsWithReactiveData } from '@tanstack/vue-table';\n\nimport { useVueTable } from '@tanstack/vue-table';\nimport { markRaw } from 'vue';\nimport { BeanControllerBase } from 'zova';\n\nexport class BeanControllerTableBase extends BeanControllerBase {\n public $useTable<TData extends RowData>(initialOptions: TableOptionsWithReactiveData<TData>): Table<TData> {\n return this.ctx.util.instanceScope(() => {\n return markRaw(useVueTable(initialOptions));\n });\n }\n\n public async refreshMeta() {\n throw new Error('should implement refreshMeta');\n }\n}\n","import type {\n IResourceActionRowOptionsBase,\n ISchemaObjectExtensionFieldRest,\n ITableProvider,\n TypeTableCellRenderComponent,\n TypeTableCellRenderComponentProvider,\n} from 'zova-module-a-openapi';\n\nimport { celEnvBase, isNilOrEmptyString } from '@cabloy/utils';\nimport { CellContext, createColumnHelper, getCoreRowModel, TableOptionsWithReactiveData } from '@tanstack/vue-table';\nimport { SchemaObject } from 'openapi3-ts/oas31';\nimport { classes } from 'typestyle';\nimport { VNode } from 'vue';\nimport { appResource, cast, deepEqual, deepExtend, objectAssignReactive, Use } from 'zova';\nimport { isJsxComponent, ZovaJsx } from 'zova-jsx';\nimport { Controller } from 'zova-module-a-bean';\nimport { BeanResourceProviders } from 'zova-module-a-openapi';\n\nimport type { ITableMeta, TypeColumn, TypeTable, TypeTableGetColumns } from '../../types/table.js';\nimport type { IDecoratorTableCellOptions, IJsxRenderContextTableCell, ITableCellRender } from '../../types/tableCell.js';\n\nimport { BeanControllerTableBase } from '../../lib/beanControllerTableBase.js';\nimport {\n ITableCellRenderColumnOptions,\n type IJsxRenderContextTableColumn,\n type ITableCellRenderColumnProps,\n type ITableCellScope,\n type ITableColumnScope,\n type ITableScope,\n type TypeTableCellRender,\n} from '../../types/tableColumn.js';\n\nexport interface ControllerTableProps<TData extends {} = {}> {\n data?: TData[];\n schema?: SchemaObject;\n tableProvider?: ITableProvider;\n tableScope?: ITableScope;\n getColumns?: TypeTableGetColumns<TData>;\n slotDefault?: (table: ControllerTable<TData>) => VNode;\n}\n\n@Controller()\nexport class ControllerTable<TData extends {} = {}> extends BeanControllerTableBase {\n static $propsDefault = {};\n\n properties: SchemaObject[] | undefined;\n columns: TypeColumn<TData>[];\n table: TypeTable<TData>;\n tableProvider: ITableProvider;\n tableMeta: ITableMeta<TData>;\n zovaJsx: ZovaJsx;\n columnCelEnv: typeof celEnvBase;\n\n @Use()\n $$beanResourceProviders: BeanResourceProviders;\n\n protected async __init__() {\n this.bean._setBean('$$table', this);\n this.tableProvider = this.$computed(() => {\n const tableProvider = this.$$beanResourceProviders.tableProvider;\n return this.$props.tableProvider ? deepExtend({}, tableProvider, this.$props.tableProvider) : tableProvider;\n });\n // jsx\n this.columnCelEnv = this._getColumnCelEnv();\n this.zovaJsx = this.bean._newBeanSimple(ZovaJsx, false, this.tableProvider.components, 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 get schema() {\n return this.$props.schema;\n }\n\n get data() {\n return this.$props.data;\n }\n\n public async refreshMeta() {\n this.tableMeta = await this._createTableMeta();\n this.columns = await this._createColumns();\n }\n\n private _createTable() {\n // eslint-disable-next-line\n const self = this;\n const tableOptions: TableOptionsWithReactiveData<TData> = {\n getRowId: (row: TData) => cast(row).id,\n getCoreRowModel: getCoreRowModel(),\n renderFallbackValue: this.scope.config.renderFallbackValue,\n manualPagination: true,\n get data() {\n return self.data || [];\n },\n get columns() {\n return self.columns;\n },\n };\n this.table = this.$useTable(tableOptions);\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 (key: string, render: TypeTableCellRenderComponent): 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(key, columnScope, jsxRenderContext);\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(properties: SchemaObject[]): 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 }),\n );\n }\n return columns;\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: SchemaObject[] = [];\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(key, columnScope, jsxRenderContext);\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(celScope: ITableCellScope, cellContext: CellContext<TData, any>): 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(renders: TypeTableCellRenderComponent | TypeTableCellRenderComponent[]) {\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.sys.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.sys.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 (beanInstance?.checkVisible && !(await beanInstance.checkVisible(columnProps as any, renderContext))) return;\n }\n return cellContext => {\n if (!cellContext) return;\n return this._cellRender(render, columnProps, columnScope, cellContext, renderProvider, beanInstance, undefined, undefined, undefined);\n };\n }\n\n public cellRender(render: TypeTableCellRenderComponent, columnProps: IResourceActionRowOptionsBase, renderContext: IJsxRenderContextTableCell) {\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.sys.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') {\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(cellProps, {}, cellScope, jsxRenderContext) as any;\n if (cellProps2.class || cellProps2.style) {\n cellProps2.class = classes(cellProps2.class, jsxRenderContext.$host.$style(cellProps2.style));\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): SchemaObject | 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);\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(name: string, celScope: {}, renderContext: {}): 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(render: TypeTableCellRenderComponent | undefined): TypeTableCellRenderComponentProvider {\n if (!render || render === ('text' as TypeTableCellRenderComponentProvider)) return 'text';\n if (typeof render === 'string') {\n const render2 = this.tableProvider.components?.[render];\n if (!render2) throw new Error(`not found table cell component of: ${render}`);\n return render2;\n }\n return render;\n }\n}\n","import { 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 _renderTableDefault() {\n const table = this.table;\n return (\n <table class=\"table\">\n <thead>\n <tr>\n {table.getFlatHeaders().map(header => {\n return (\n <th key={header.id}>\n <FlexRender\n render={header.column.columnDef.header}\n props={header.getContext()}\n ></FlexRender>\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 return (\n <td key={cell.id}>\n <FlexRender\n render={cell.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 type { TypeControllerInnerProps } from 'zova';\n\nimport { defineComponent } from 'vue';\nimport { prepareComponentOptions, useController } from 'zova';\n\nimport type { ControllerTableProps } from '../../component/table/controller.jsx';\n\nimport { ControllerTable } from '../../component/table/controller.jsx';\nimport { RenderTable } from '../../component/table/render.jsx';\nexport type TypeControllerTablePublicProps<TData extends {} = {}> = {\n controllerRef?: (ref: ControllerTable<TData>) => void;\n} & ControllerTableProps<TData>;\n\ntype ControllerInnerProps<TData extends {} = {}> = TypeControllerInnerProps<\n ControllerTableProps<TData>,\n keyof typeof ControllerTable.$propsDefault\n>;\ndeclare module 'zova-module-a-table' {\n export interface ControllerTable<TData extends {} = {}> {\n $props: ControllerInnerProps<TData>;\n }\n}\ndeclare module 'zova-module-a-table' {\n export interface RenderTable<TData extends {} = {}> extends ControllerTable<TData> {}\n}\nexport const ZTable = defineComponent(\n <TData extends {} = {}>(_props: TypeControllerTablePublicProps<TData>) => {\n useController(ControllerTable, RenderTable, undefined);\n return () => {};\n },\n prepareComponentOptions(),\n);\ndeclare module 'zova-module-a-bean' {\n export interface IVonaComponentRecord {\n 'a-table:table': ControllerTableProps;\n }\n}\n","import type { ZovaSys } from 'zova';\n\nexport const config = (_sys: ZovaSys) => {\n return {\n renderFallbackValue: '--',\n };\n};\n","// eslint-disable\n/** controller: begin */\nexport * from '../component/table/controller.jsx';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-table' {\n \n export interface ControllerTable {\n /** @internal */\n get scope(): ScopeModuleATable;\n } \n}\n/** controller: end */\n/** controller: begin */\nimport { ControllerTable } from '../component/table/controller.jsx';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordLocal {\n 'a-table.controller.table': ControllerTable;\n }\n}\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';\ndeclare module 'zova' {\nexport interface IComponentRecord {\n 'a-table:table': ControllerTable;\n}\nexport interface IZovaComponentRecord {\n 'a-table:table': typeof ZTable;\n}\n}\n/** components: end */\n/** render: begin */\nexport * from '../component/table/render.jsx';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-table' {\n \n export interface RenderTable {\n /** @internal */\n get scope(): ScopeModuleATable;\n } \n}\n/** render: end */\n/** render: begin */\nimport { RenderTable } from '../component/table/render.jsx';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordLocal {\n 'a-table.render.table': RenderTable;\n }\n}\n/** render: end */\n/** config: begin */\nexport * from '../config/config.js';\nimport { config } from '../config/config.js';\n/** config: end */\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil, TypeModuleConfig } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\n\n@Scope()\nexport class ScopeModuleATable extends BeanScopeBase {}\n\nexport interface ScopeModuleATable {\n util: BeanScopeUtil;\nconfig: TypeModuleConfig<typeof config>;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'a-table': ScopeModuleATable;\n }\n \n export interface IBeanScopeConfig {\n 'a-table': ReturnType<typeof config>;\n }\n\n \n\n \n}\n \n/** scope: end */\n","import type { RowData, Table } from '@tanstack/table-core';\nimport type { TableOptionsWithReactiveData } from '@tanstack/vue-table';\n\nimport { useVueTable } from '@tanstack/vue-table';\nimport { markRaw } from 'vue';\nimport { BeanControllerPageBase } from 'zova';\n\nexport class BeanControllerPageTableBase extends BeanControllerPageBase {\n public $useTable<TData extends RowData>(initialOptions: TableOptionsWithReactiveData<TData>): Table<TData> {\n return this.ctx.util.instanceScope(() => {\n return markRaw(useVueTable(initialOptions));\n });\n }\n\n public async refreshMeta() {\n throw new Error('should implement refreshMeta');\n }\n}\n","import { createBeanDecorator } from 'zova';\n\nimport type { IDecoratorTableCellOptions } from '../types/tableCell.js';\n\nexport function TableCell<T extends IDecoratorTableCellOptions>(options?: T): ClassDecorator {\n return createBeanDecorator('tableCell', 'sys', true, options);\n}\n"],"mappings":";;;;;;;;AAGA,IAAS,0BAAT,cAA2C,mBAAM;CACjD,UAAS,gBAAmB;AAC5B,SAAS,KAAA,IAAA,KAAA,oBAAgC;;IAEnC;;CAEJ,MAAE,cAAgB;AAChB,QAAE,IAAO,MAAO,+BAA6B;;;;;;;;;;;;;;;;;;;;;;AC+BjD,IACae,mBAAeC,SAD3BH,YAAY,EAAAI,UAAAC,SAAA,EAAAC,QAAA,WAAA,CAAA,EAAAC,QAYVV,IAAG,mCAAE,EAAAW,QAAAC,QAAAC,SAAA,eAAA,OAAAC,0BAAA,cAAAC,SAAAD,sBAAA,EAAAR,OAAAU,WAAAT,QAAAS,YAAAC,WAAAC,mBAZR,MACab,wBAA+CD,wBAAwB;CAAAe,YAAA,GAAAC,MAAA;AAAA,QAAA,GAAAA,KAAA;AAAA,OAGlFC,aAAU,KAAA;AAAA,OACVC,UAAO,KAAA;AAAA,OACPC,QAAK,KAAA;AAAA,OACLC,gBAA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;GAEjD,yBAA2B,CAAA;;;ACP3B,IAAa,UAAS,SAAQ;UAE9B,qBAAuB,MACrB;;;;;;ACHF,IAAG,MAAO,OAAA;AAeV,IAAA,aAAA,EACE,SAAE,QACH;AAiBD,IAAQ,qBAAc,OAAA,OAAA,EAAA,QAAA,SAAA,EACtB,QAAO,WACN,CAAC,EAAE,KAAC,SAAa,MAAC,SAAA,MAAe,0BAAA,cAAA,GAAA,IAAA,OAAA,IAAA;;;;ACjClC,IAAS,8BAAT,cAAiD,uBAAA;CACjD,UAAS,gBAAmB;AAC5B,SAAS,KAAA,IAAA,KAAA,oBAAoC;;IAEvC;;CAEJ,MAAE,cAAgB;AAChB,QAAE,IAAO,MAAO,+BAA6B;;;;;;ACRjD,QAAO,oBAAO,aAA4B,OAAO,MAAG,QAAM"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["celEnvBase","isNilOrEmptyString","createColumnHelper","getCoreRowModel","classes","appResource","cast","deepEqual","deepExtend","objectAssignReactive","isJsxComponent","ZovaJsx","Controller","BeanControllerTableBase","ControllerTable","_dec","_dec2","__z_BeanInfo","module","_class","_ControllerTable","constructor","args","properties","columns","table","tableMeta","zovaJsx","columnCelEnv","__init__","bean","_setBean","_getColumnCelEnv","_newBeanSimple","undefined","_createProperties","refreshMeta","$watch","$props","schema","newValue","oldValue","_createTable","data","_createTableMeta","_createColumns","self","tableOptions","getRowId","row","id","renderFallbackValue","scope","config","manualPagination","$useTable","getColumns","_createColumnsMiddle","key","render","columnScope","getColumnScope","jsxRenderContext","getColumnJsxRenderContext","visible","columnProps","getColumnComponentPropsTop","_createColumnRender","columnHelper","property","push","accessor","header","_props","title","cell","props","renders","$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","sys","_getBean","renderContext","beanInstance","beanOptions","getBean","onionOptions","options","checkVisible","_cellRender","cellRender","cellScope","_getBeanSyncOnly","cellProps","setTransientObject","getValue","name","_cellRenderInner","value","fallbackValue","cellProps2","renderJsxProps","class","style","$style","children","length","renderJsxChildrenDirect","getColumnProperty","find","celEnv","clone","registerFunction","transientObject","scopeExtra","tableScope","rest","_getColumnComponentPropsTopByRest","_renderContext","evaluateExpression","Object","assign","$propsDefault","FlexRender","BeanRenderBase","Render","RenderTable","_dec","_dec2","__z_BeanInfo","module","_class","_renderTableDefault","table","_createVNode","getFlatHeaders","map","header","id","column","columnDef","getContext","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 type { RowData, Table } from '@tanstack/table-core';\nimport type { TableOptionsWithReactiveData } from '@tanstack/vue-table';\n\nimport { useVueTable } from '@tanstack/vue-table';\nimport { markRaw } from 'vue';\nimport { BeanControllerBase } from 'zova';\n\nexport class BeanControllerTableBase extends BeanControllerBase {\n public $useTable<TData extends RowData>(initialOptions: TableOptionsWithReactiveData<TData>): Table<TData> {\n return this.ctx.util.instanceScope(() => {\n return markRaw(useVueTable(initialOptions));\n });\n }\n\n public async refreshMeta() {\n throw new Error('should implement refreshMeta');\n }\n}\n","import type { IResourceTableActionRowOptionsBase, ISchemaObjectExtensionFieldRest, TypeTableCellRenderComponent } from 'zova-module-a-openapi';\n\nimport { celEnvBase, isNilOrEmptyString } from '@cabloy/utils';\nimport { CellContext, createColumnHelper, getCoreRowModel, TableOptionsWithReactiveData } from '@tanstack/vue-table';\nimport { SchemaObject } from 'openapi3-ts/oas31';\nimport { classes } from 'typestyle';\nimport { VNode } from 'vue';\nimport { appResource, cast, deepEqual, deepExtend, objectAssignReactive } from 'zova';\nimport { isJsxComponent, ZovaJsx } from 'zova-jsx';\nimport { Controller } from 'zova-module-a-bean';\n\nimport type { ITableMeta, TypeColumn, TypeTable, TypeTableGetColumns } from '../../types/table.js';\nimport type { IDecoratorTableCellOptions, IJsxRenderContextTableCell, ITableCellRender } from '../../types/tableCell.js';\n\nimport { BeanControllerTableBase } from '../../lib/beanControllerTableBase.js';\nimport {\n ITableCellRenderColumnOptions,\n type IJsxRenderContextTableColumn,\n type ITableCellRenderColumnProps,\n type ITableCellScope,\n type ITableColumnScope,\n type ITableScope,\n type TypeTableCellRender,\n} from '../../types/tableColumn.js';\n\nexport interface ControllerTableProps<TData extends {} = {}> {\n data?: TData[];\n schema?: SchemaObject;\n tableScope?: ITableScope;\n getColumns?: TypeTableGetColumns<TData>;\n slotDefault?: (table: ControllerTable<TData>) => VNode;\n}\n\n@Controller()\nexport class ControllerTable<TData extends {} = {}> extends BeanControllerTableBase {\n static $propsDefault = {};\n\n properties: SchemaObject[] | undefined;\n columns: TypeColumn<TData>[];\n table: TypeTable<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 get schema() {\n return this.$props.schema;\n }\n\n get data() {\n return this.$props.data;\n }\n\n public async refreshMeta() {\n this.tableMeta = await this._createTableMeta();\n this.columns = await this._createColumns();\n }\n\n private _createTable() {\n // eslint-disable-next-line\n const self = this;\n const tableOptions: TableOptionsWithReactiveData<TData> = {\n getRowId: (row: TData) => cast(row).id,\n getCoreRowModel: getCoreRowModel(),\n renderFallbackValue: this.scope.config.renderFallbackValue,\n manualPagination: true,\n get data() {\n return self.data || [];\n },\n get columns() {\n return self.columns;\n },\n };\n this.table = this.$useTable(tableOptions);\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 (key: string, render: TypeTableCellRenderComponent): 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(key, columnScope, jsxRenderContext);\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(properties: SchemaObject[]): 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 }),\n );\n }\n return columns;\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: SchemaObject[] = [];\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(key, columnScope, jsxRenderContext);\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(celScope: ITableCellScope, cellContext: CellContext<TData, any>): 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(renders: TypeTableCellRenderComponent | TypeTableCellRenderComponent[]) {\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.sys.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.sys.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 (beanInstance?.checkVisible && !(await beanInstance.checkVisible(columnProps as any, renderContext))) return;\n }\n return cellContext => {\n if (!cellContext) return;\n return this._cellRender(render, columnProps, columnScope, cellContext, renderProvider, beanInstance, undefined, undefined, undefined);\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.sys.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: TypeTableCellRenderComponent,\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: TypeTableCellRenderComponent,\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(cellProps, {}, cellScope, jsxRenderContext) as any;\n if (cellProps2.class || cellProps2.style) {\n cellProps2.class = classes(cellProps2.class, jsxRenderContext.$host.$style(cellProps2.style));\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): SchemaObject | 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);\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(name: string, celScope: {}, renderContext: {}): 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(render: TypeTableCellRenderComponent | undefined): TypeTableCellRenderComponent {\n return render || ('text' as TypeTableCellRenderComponent);\n }\n}\n","import { 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 _renderTableDefault() {\n const table = this.table;\n return (\n <table class=\"table\">\n <thead>\n <tr>\n {table.getFlatHeaders().map(header => {\n return (\n <th key={header.id}>\n <FlexRender\n render={header.column.columnDef.header}\n props={header.getContext()}\n ></FlexRender>\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 return (\n <td key={cell.id}>\n <FlexRender\n render={cell.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 type { TypeControllerInnerProps } from 'zova';\n\nimport { defineComponent } from 'vue';\nimport { prepareComponentOptions, useController } from 'zova';\n\nimport type { ControllerTableProps } from '../../component/table/controller.jsx';\n\nimport { ControllerTable } from '../../component/table/controller.jsx';\nimport { RenderTable } from '../../component/table/render.jsx';\nexport type TypeControllerTablePublicProps<TData extends {} = {}> = {\n controllerRef?: (ref: ControllerTable<TData>) => void;\n} & ControllerTableProps<TData>;\n\ntype ControllerInnerProps<TData extends {} = {}> = TypeControllerInnerProps<\n ControllerTableProps<TData>,\n keyof typeof ControllerTable.$propsDefault\n>;\ndeclare module 'zova-module-a-table' {\n export interface ControllerTable<TData extends {} = {}> {\n $props: ControllerInnerProps<TData>;\n }\n}\ndeclare module 'zova-module-a-table' {\n export interface RenderTable<TData extends {} = {}> extends ControllerTable<TData> {}\n}\nexport const ZTable = defineComponent(\n <TData extends {} = {}>(_props: TypeControllerTablePublicProps<TData>) => {\n useController(ControllerTable, RenderTable, undefined);\n return () => {};\n },\n prepareComponentOptions(),\n);\ndeclare module 'zova-module-a-bean' {\n export interface IVonaComponentRecord {\n 'a-table:table': ControllerTableProps;\n }\n}\n","import type { ZovaSys } from 'zova';\n\nexport const config = (_sys: ZovaSys) => {\n return {\n renderFallbackValue: '--',\n };\n};\n","// eslint-disable\n/** controller: begin */\nexport * from '../component/table/controller.jsx';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-table' {\n \n export interface ControllerTable {\n /** @internal */\n get scope(): ScopeModuleATable;\n } \n}\n/** controller: end */\n/** controller: begin */\nimport { ControllerTable } from '../component/table/controller.jsx';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordLocal {\n 'a-table.controller.table': ControllerTable;\n }\n}\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';\ndeclare module 'zova' {\nexport interface IComponentRecord {\n 'a-table:table': ControllerTable;\n}\nexport interface IZovaComponentRecord {\n 'a-table:table': typeof ZTable;\n}\n}\n/** components: end */\n/** render: begin */\nexport * from '../component/table/render.jsx';\n\nimport 'zova';\ndeclare module 'zova' {\n \n \n}\ndeclare module 'zova-module-a-table' {\n \n export interface RenderTable {\n /** @internal */\n get scope(): ScopeModuleATable;\n } \n}\n/** render: end */\n/** render: begin */\nimport { RenderTable } from '../component/table/render.jsx';\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanRecordLocal {\n 'a-table.render.table': RenderTable;\n }\n}\n/** render: end */\n/** config: begin */\nexport * from '../config/config.js';\nimport { config } from '../config/config.js';\n/** config: end */\n/** scope: begin */\nimport { BeanScopeBase, type BeanScopeUtil, TypeModuleConfig } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\n\n@Scope()\nexport class ScopeModuleATable extends BeanScopeBase {}\n\nexport interface ScopeModuleATable {\n util: BeanScopeUtil;\nconfig: TypeModuleConfig<typeof config>;\n}\n\nimport 'zova';\ndeclare module 'zova' {\n export interface IBeanScopeRecord {\n 'a-table': ScopeModuleATable;\n }\n \n export interface IBeanScopeConfig {\n 'a-table': ReturnType<typeof config>;\n }\n\n \n\n \n}\n \n/** scope: end */\n","import type { RowData, Table } from '@tanstack/table-core';\nimport type { TableOptionsWithReactiveData } from '@tanstack/vue-table';\n\nimport { useVueTable } from '@tanstack/vue-table';\nimport { markRaw } from 'vue';\nimport { BeanControllerPageBase } from 'zova';\n\nexport class BeanControllerPageTableBase extends BeanControllerPageBase {\n public $useTable<TData extends RowData>(initialOptions: TableOptionsWithReactiveData<TData>): Table<TData> {\n return this.ctx.util.instanceScope(() => {\n return markRaw(useVueTable(initialOptions));\n });\n }\n\n public async refreshMeta() {\n throw new Error('should implement refreshMeta');\n }\n}\n","import { createBeanDecorator } from 'zova';\n\nimport type { IDecoratorTableCellOptions } from '../types/tableCell.js';\n\nexport function TableCell<T extends IDecoratorTableCellOptions>(options?: T): ClassD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F,IAAG,MAAO,OAAA;AAeV,IAAA,aAAA,EACE,SAAE,QACH;AAiBD,IAAQ,qBAAc,OAAA,OAAA,EAAA,QAAA,SAAA,EACtB,QAAO,WACN,CAAC,EAAE,KAAC,SAAa,MAAC,SAAA,MAAe,0BAAA,cAAA,GAAA,IAAA,OAAA,IAAA;;;;ACjClC,IAAS,8BAAT,cAAiD,uBAAA;CACjD,UAAS,gBAAmB;AAC5B,SAAS,KAAA,IAAA,KAAA,oBAAoC;;IAEvC;;CAEJ,MAAE,cAAgB;AAChB,QAAE,IAAO,MAAO,+BAA6B;;;;;;ACRjD,QAAO,oBAAO,aAA4B,OAAO,MAAG,QAAM"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-module-a-table",
|
|
3
|
-
"version": "5.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "5.1.16",
|
|
4
|
+
"gitHead": "f5fbd410ec433943070bb60839f1e762f98593c6",
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Zova Module"
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"beanGeneral": true,
|
|
58
58
|
"optionsGlobalInterfaceName": "IDecoratorTableCellOptions",
|
|
59
59
|
"optionsGlobalInterfaceFrom": "zova-module-a-table",
|
|
60
|
-
"boilerplate": "tableCell/boilerplate"
|
|
60
|
+
"boilerplate": "tableCell/boilerplate",
|
|
61
|
+
"boilerplateActionRow": "tableCellActionRow/boilerplate"
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
IResourceActionRowOptionsBase,
|
|
3
|
-
ISchemaObjectExtensionFieldRest,
|
|
4
|
-
ITableProvider,
|
|
5
|
-
TypeTableCellRenderComponent,
|
|
6
|
-
TypeTableCellRenderComponentProvider,
|
|
7
|
-
} from 'zova-module-a-openapi';
|
|
1
|
+
import type { IResourceTableActionRowOptionsBase, ISchemaObjectExtensionFieldRest, TypeTableCellRenderComponent } from 'zova-module-a-openapi';
|
|
8
2
|
|
|
9
3
|
import { celEnvBase, isNilOrEmptyString } from '@cabloy/utils';
|
|
10
4
|
import { CellContext, createColumnHelper, getCoreRowModel, TableOptionsWithReactiveData } from '@tanstack/vue-table';
|
|
11
5
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
12
6
|
import { classes } from 'typestyle';
|
|
13
7
|
import { VNode } from 'vue';
|
|
14
|
-
import { appResource, cast, deepEqual, deepExtend, objectAssignReactive
|
|
8
|
+
import { appResource, cast, deepEqual, deepExtend, objectAssignReactive } from 'zova';
|
|
15
9
|
import { isJsxComponent, ZovaJsx } from 'zova-jsx';
|
|
16
10
|
import { Controller } from 'zova-module-a-bean';
|
|
17
|
-
import { BeanResourceProviders } from 'zova-module-a-openapi';
|
|
18
11
|
|
|
19
12
|
import type { ITableMeta, TypeColumn, TypeTable, TypeTableGetColumns } from '../../types/table.js';
|
|
20
13
|
import type { IDecoratorTableCellOptions, IJsxRenderContextTableCell, ITableCellRender } from '../../types/tableCell.js';
|
|
@@ -33,7 +26,6 @@ import {
|
|
|
33
26
|
export interface ControllerTableProps<TData extends {} = {}> {
|
|
34
27
|
data?: TData[];
|
|
35
28
|
schema?: SchemaObject;
|
|
36
|
-
tableProvider?: ITableProvider;
|
|
37
29
|
tableScope?: ITableScope;
|
|
38
30
|
getColumns?: TypeTableGetColumns<TData>;
|
|
39
31
|
slotDefault?: (table: ControllerTable<TData>) => VNode;
|
|
@@ -46,23 +38,15 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
46
38
|
properties: SchemaObject[] | undefined;
|
|
47
39
|
columns: TypeColumn<TData>[];
|
|
48
40
|
table: TypeTable<TData>;
|
|
49
|
-
tableProvider: ITableProvider;
|
|
50
41
|
tableMeta: ITableMeta<TData>;
|
|
51
42
|
zovaJsx: ZovaJsx;
|
|
52
43
|
columnCelEnv: typeof celEnvBase;
|
|
53
44
|
|
|
54
|
-
@Use()
|
|
55
|
-
$$beanResourceProviders: BeanResourceProviders;
|
|
56
|
-
|
|
57
45
|
protected async __init__() {
|
|
58
46
|
this.bean._setBean('$$table', this);
|
|
59
|
-
this.tableProvider = this.$computed(() => {
|
|
60
|
-
const tableProvider = this.$$beanResourceProviders.tableProvider;
|
|
61
|
-
return this.$props.tableProvider ? deepExtend({}, tableProvider, this.$props.tableProvider) : tableProvider;
|
|
62
|
-
});
|
|
63
47
|
// jsx
|
|
64
48
|
this.columnCelEnv = this._getColumnCelEnv();
|
|
65
|
-
this.zovaJsx = this.bean._newBeanSimple(ZovaJsx, false,
|
|
49
|
+
this.zovaJsx = this.bean._newBeanSimple(ZovaJsx, false, undefined, this.columnCelEnv);
|
|
66
50
|
// properties
|
|
67
51
|
this._createProperties();
|
|
68
52
|
// tableMeta/columns
|
|
@@ -249,7 +233,11 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
249
233
|
};
|
|
250
234
|
}
|
|
251
235
|
|
|
252
|
-
public cellRender(
|
|
236
|
+
public cellRender(
|
|
237
|
+
render: TypeTableCellRenderComponent,
|
|
238
|
+
columnProps: IResourceTableActionRowOptionsBase,
|
|
239
|
+
renderContext: IJsxRenderContextTableCell,
|
|
240
|
+
) {
|
|
253
241
|
// render
|
|
254
242
|
const cellScope = renderContext.$celScope;
|
|
255
243
|
// renderProvider
|
|
@@ -284,7 +272,7 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
284
272
|
columnProps: ITableCellRenderColumnProps | undefined,
|
|
285
273
|
columnScope: ITableColumnScope | undefined,
|
|
286
274
|
cellContext: CellContext<TData, any>,
|
|
287
|
-
renderProvider:
|
|
275
|
+
renderProvider: TypeTableCellRenderComponent,
|
|
288
276
|
beanInstance: ITableCellRender | undefined,
|
|
289
277
|
cellProps: any | undefined,
|
|
290
278
|
cellScope: ITableCellScope | undefined,
|
|
@@ -317,7 +305,7 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
317
305
|
columnProps: ITableCellRenderColumnProps | undefined,
|
|
318
306
|
columnScope: ITableColumnScope | undefined,
|
|
319
307
|
cellContext: CellContext<TData, any>,
|
|
320
|
-
renderProvider:
|
|
308
|
+
renderProvider: TypeTableCellRenderComponent,
|
|
321
309
|
beanInstance: ITableCellRender | undefined,
|
|
322
310
|
cellProps: any | undefined,
|
|
323
311
|
cellScope: ITableCellScope | undefined,
|
|
@@ -332,7 +320,7 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
332
320
|
cellScope = objectAssignReactive({}, columnScope, { value, fallbackValue })!;
|
|
333
321
|
}
|
|
334
322
|
// render: text
|
|
335
|
-
if (renderProvider === 'text') {
|
|
323
|
+
if (renderProvider === ('text' as TypeTableCellRenderComponent)) {
|
|
336
324
|
return isNilOrEmptyString(value) ? fallbackValue : value;
|
|
337
325
|
}
|
|
338
326
|
// renderContext
|
|
@@ -410,13 +398,7 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
410
398
|
// return isJsxComponent(render) ? cast(render).type : render;
|
|
411
399
|
// }
|
|
412
400
|
|
|
413
|
-
public getRenderProvider(render: TypeTableCellRenderComponent | undefined):
|
|
414
|
-
|
|
415
|
-
if (typeof render === 'string') {
|
|
416
|
-
const render2 = this.tableProvider.components?.[render];
|
|
417
|
-
if (!render2) throw new Error(`not found table cell component of: ${render}`);
|
|
418
|
-
return render2;
|
|
419
|
-
}
|
|
420
|
-
return render;
|
|
401
|
+
public getRenderProvider(render: TypeTableCellRenderComponent | undefined): TypeTableCellRenderComponent {
|
|
402
|
+
return render || ('text' as TypeTableCellRenderComponent);
|
|
421
403
|
}
|
|
422
404
|
}
|