zova-module-a-table 5.1.19 → 5.1.20
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 +2 -3
- package/dist/component/table/controller.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/beanControllerPageTableBase.d.ts +5 -3
- package/dist/lib/beanControllerPageTableBase.d.ts.map +1 -1
- package/dist/lib/beanControllerTableBase.d.ts +5 -3
- package/dist/lib/beanControllerTableBase.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/component/table/controller.tsx +81 -18
- package/src/lib/beanControllerPageTableBase.ts +7 -3
- package/src/lib/beanControllerTableBase.ts +7 -3
|
@@ -4,7 +4,7 @@ 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 type { ITableMeta, TypeColumn,
|
|
7
|
+
import type { ITableMeta, TypeColumn, TypeTableGetColumns } from '../../types/table.js';
|
|
8
8
|
import type { IJsxRenderContextTableCell } from '../../types/tableCell.js';
|
|
9
9
|
import { BeanControllerTableBase } from '../../lib/beanControllerTableBase.js';
|
|
10
10
|
import { ITableCellRenderColumnOptions, type IJsxRenderContextTableColumn, type ITableCellScope, type ITableColumnScope, type ITableScope } from '../../types/tableColumn.js';
|
|
@@ -15,11 +15,10 @@ export interface ControllerTableProps<TData extends {} = {}> {
|
|
|
15
15
|
getColumns?: TypeTableGetColumns<TData>;
|
|
16
16
|
slotDefault?: (table: ControllerTable<TData>) => VNode;
|
|
17
17
|
}
|
|
18
|
-
export declare class ControllerTable<TData extends {} = {}> extends BeanControllerTableBase {
|
|
18
|
+
export declare class ControllerTable<TData extends {} = {}> extends BeanControllerTableBase<TData> {
|
|
19
19
|
static $propsDefault: {};
|
|
20
20
|
properties: ISchemaObjectExtensionField[] | undefined;
|
|
21
21
|
columns: TypeColumn<TData>[];
|
|
22
|
-
table: TypeTable<TData>;
|
|
23
22
|
tableMeta: ITableMeta<TData>;
|
|
24
23
|
zovaJsx: ZovaJsx;
|
|
25
24
|
columnCelEnv: typeof celEnvBase;
|
|
@@ -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,
|
|
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,EAIZ,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;AAElC,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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iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,2BAA2B,GAAG,SAAS;IAK/E,OAAO,CAAC,gBAAgB;IAWjB,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"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,10 @@ import { Controller, Render, Scope } from "zova-module-a-bean";
|
|
|
6
6
|
import { createVNode, defineComponent, markRaw } from "vue";
|
|
7
7
|
//#region src/lib/beanControllerTableBase.ts
|
|
8
8
|
var BeanControllerTableBase = class extends BeanControllerBase {
|
|
9
|
+
constructor(...args) {
|
|
10
|
+
super(...args);
|
|
11
|
+
this.table = void 0;
|
|
12
|
+
}
|
|
9
13
|
$useTable(initialOptions) {
|
|
10
14
|
return this.ctx.util.instanceScope(() => {
|
|
11
15
|
return markRaw(useVueTable(initialOptions));
|
|
@@ -23,7 +27,6 @@ var ControllerTable = (_dec$2 = Controller(), _dec2$2 = BeanInfo({ module: "a-ta
|
|
|
23
27
|
super(...args);
|
|
24
28
|
this.properties = void 0;
|
|
25
29
|
this.columns = void 0;
|
|
26
|
-
this.table = void 0;
|
|
27
30
|
this.tableMeta = void 0;
|
|
28
31
|
this.zovaJsx = void 0;
|
|
29
32
|
this.columnCelEnv = void 0;
|
|
@@ -299,6 +302,10 @@ var ScopeModuleATable = (_dec = Scope(), _dec2 = BeanInfo({ module: "a-table" })
|
|
|
299
302
|
//#endregion
|
|
300
303
|
//#region src/lib/beanControllerPageTableBase.ts
|
|
301
304
|
var BeanControllerPageTableBase = class extends BeanControllerPageBase {
|
|
305
|
+
constructor(...args) {
|
|
306
|
+
super(...args);
|
|
307
|
+
this.table = void 0;
|
|
308
|
+
}
|
|
302
309
|
$useTable(initialOptions) {
|
|
303
310
|
return this.ctx.util.instanceScope(() => {
|
|
304
311
|
return markRaw(useVueTable(initialOptions));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["celEnvBase","isNilOrEmptyString","createColumnHelper","getCoreRowModel","appResource","beanFullNameFromOnionName","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","$cssMerge","$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 {\n IResourceTableActionRowOptionsBase,\n ISchemaObjectExtensionField,\n ISchemaObjectExtensionFieldRest,\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 { VNode } from 'vue';\nimport { appResource, beanFullNameFromOnionName, 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: ISchemaObjectExtensionField[] | 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: ISchemaObjectExtensionField[]): 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: 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(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: 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(cellProps, {}, cellScope, jsxRenderContext) as any;\n if (cellProps2.class || cellProps2.style) {\n cellProps2.class = jsxRenderContext.$host.$cssMerge(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): 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);\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) return 'text';\n if (typeof render === 'string' && render.includes(':')) {\n return beanFullNameFromOnionName(render, 'tableCell');\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,KAA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,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","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","_createTableMeta","_createColumns","self","tableOptions","getRowId","row","id","renderFallbackValue","scope","config","manualPagination","table","$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","$cssMerge","$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 { 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\nimport { TypeTable } from '../types/table.js';\n\nexport class BeanControllerTableBase<TData extends {} = {}> extends BeanControllerBase {\n table: TypeTable<TData>;\n\n public $useTable(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 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 getCoreRowModel,\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';\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<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 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 (\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 }),\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: 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.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 (\n beanInstance?.checkVisible &&\n !(await beanInstance.checkVisible(columnProps as any, renderContext))\n )\n return;\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.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' 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);\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 { 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 { 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\nimport { TypeTable } from '../types/table.js';\n\nexport class BeanControllerPageTableBase<TData extends {} = {}> extends BeanControllerPageBase {\n table: TypeTable<TData>;\n\n public $useTable(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,YAAS,GAAQ,MAAM;AACvB,QAAS,GAAA,KAAA;;;;AAIT,SAAO,KAAM,IAAA,KAAA,oBAA8B;AACzC,UAAO,QAAU,YAAM,eAAA,CAAA;;;CAGvB,MAAE,cAAgB;AAChB,QAAE,IAAO,MAAO,+BAA6B;;;;;;ACwCjD,IACac,mBAAeC,SAD3BH,YAAY,EAAAI,UAAAC,SAAA,EAAAC,QAAA,WAAA,CAAA,EAAAH,OAAAI,WAAAH,QAAAG,YAAAC,mBAAb,MACaN,wBAA+CD,wBAA+B;CAAAQ,YAAA,GAAAC,MAAA;AAAA,QAAA,GAAAA,KAAA;AAGzF,OAEAC,aAAU,KAAA;AAAA,OACVC,UAAO,KAAA;AAAA,OACPC,YAAS,KAAA;AAAA,OACTC,UAAO,KAAA;AAAA,OACPC,eAAY,KAAA;;CAEZ,MAAgBC,WAAW;AACzB,OAAKC,KAAKC,SAAS,WAAW,KAAK;AAEnC,OAAKH,eAAe,KAAKI,kBAAkB;AAC3C,OAAKL,UAAU,KAAKG,KAAKG,eAAerB,SAAS,OAAOsB,KAAAA,GAAW,KAAKN,aAAa;AAErF,OAAKO,mBAAmB;AAExB,QAAM,KAAKC,aAAa;AAExB,OAAKC,aACG,KAAKC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T,KAAIU,SAAQ;AACjC,WAAAZ,YAAA,MAAA,EAAA,OACWY,KAAKR,IAAE,EAAA,CAAAJ,YAAAX,YAAA;KAAA,UAEJuB,KAAKP,OAAOC,UAAUM;KAAI,SAC3BA,KAAKL,YAAW;KAAC,EAAA,KAAA,CAAA,CAAA;KAI9B,CAAA,CAAA;IAGN,CAAA,CAAA,CAAA,CAAA;;CAMHM,SAAS;AACd,SAAO,KAAKC,eAAe,KAAKA,aAAa,KAAK,GAAG,KAAKhB,qBAAqB;;EAElF,IAAAD,SAAA,IAAAA;;;;AC5CD,eAAc,iBAAA,aAAgC,KAAA,EAAG;;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,YAAS,GAAQ,MAAM;AACvB,QAAS,GAAA,KAAA;;;;AAIT,SAAO,KAAM,IAAA,KAAA,oBAA4B;AACvC,UAAO,QAAU,YAAM,eAAA,CAAA;;;CAGvB,MAAE,cAAgB;AAChB,QAAE,IAAO,MAAO,+BAA6B;;;;;;ACZjD,QAAO,oBAAO,aAA4B,OAAO,MAAG,QAAM"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table } from '@tanstack/table-core';
|
|
2
2
|
import type { TableOptionsWithReactiveData } from '@tanstack/vue-table';
|
|
3
3
|
import { BeanControllerPageBase } from 'zova';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { TypeTable } from '../types/table.js';
|
|
5
|
+
export declare class BeanControllerPageTableBase<TData extends {} = {}> extends BeanControllerPageBase {
|
|
6
|
+
table: TypeTable<TData>;
|
|
7
|
+
$useTable(initialOptions: TableOptionsWithReactiveData<TData>): Table<TData>;
|
|
6
8
|
refreshMeta(): Promise<void>;
|
|
7
9
|
}
|
|
8
10
|
//# sourceMappingURL=beanControllerPageTableBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beanControllerPageTableBase.d.ts","sourceRoot":"","sources":["../../src/lib/beanControllerPageTableBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"beanControllerPageTableBase.d.ts","sourceRoot":"","sources":["../../src/lib/beanControllerPageTableBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAIxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,qBAAa,2BAA2B,CAAC,KAAK,SAAS,EAAE,GAAG,EAAE,CAAE,SAAQ,sBAAsB;IAC5F,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IAEjB,SAAS,CAAC,cAAc,EAAE,4BAA4B,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;IAMtE,WAAW;CAGzB"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table } from '@tanstack/table-core';
|
|
2
2
|
import type { TableOptionsWithReactiveData } from '@tanstack/vue-table';
|
|
3
3
|
import { BeanControllerBase } from 'zova';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { TypeTable } from '../types/table.js';
|
|
5
|
+
export declare class BeanControllerTableBase<TData extends {} = {}> extends BeanControllerBase {
|
|
6
|
+
table: TypeTable<TData>;
|
|
7
|
+
$useTable(initialOptions: TableOptionsWithReactiveData<TData>): Table<TData>;
|
|
6
8
|
refreshMeta(): Promise<void>;
|
|
7
9
|
}
|
|
8
10
|
//# sourceMappingURL=beanControllerTableBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beanControllerTableBase.d.ts","sourceRoot":"","sources":["../../src/lib/beanControllerTableBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"beanControllerTableBase.d.ts","sourceRoot":"","sources":["../../src/lib/beanControllerTableBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAIxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,qBAAa,uBAAuB,CAAC,KAAK,SAAS,EAAE,GAAG,EAAE,CAAE,SAAQ,kBAAkB;IACpF,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IAEjB,SAAS,CAAC,cAAc,EAAE,4BAA4B,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;IAMtE,WAAW;CAGzB"}
|
package/package.json
CHANGED
|
@@ -7,15 +7,31 @@ import type {
|
|
|
7
7
|
} from 'zova-module-a-openapi';
|
|
8
8
|
|
|
9
9
|
import { celEnvBase, isNilOrEmptyString } from '@cabloy/utils';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
CellContext,
|
|
12
|
+
createColumnHelper,
|
|
13
|
+
getCoreRowModel,
|
|
14
|
+
TableOptionsWithReactiveData,
|
|
15
|
+
} from '@tanstack/vue-table';
|
|
11
16
|
import { SchemaObject } from 'openapi3-ts/oas31';
|
|
12
17
|
import { VNode } from 'vue';
|
|
13
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
appResource,
|
|
20
|
+
beanFullNameFromOnionName,
|
|
21
|
+
cast,
|
|
22
|
+
deepEqual,
|
|
23
|
+
deepExtend,
|
|
24
|
+
objectAssignReactive,
|
|
25
|
+
} from 'zova';
|
|
14
26
|
import { isJsxComponent, ZovaJsx } from 'zova-jsx';
|
|
15
27
|
import { Controller } from 'zova-module-a-bean';
|
|
16
28
|
|
|
17
|
-
import type { ITableMeta, TypeColumn,
|
|
18
|
-
import type {
|
|
29
|
+
import type { ITableMeta, TypeColumn, TypeTableGetColumns } from '../../types/table.js';
|
|
30
|
+
import type {
|
|
31
|
+
IDecoratorTableCellOptions,
|
|
32
|
+
IJsxRenderContextTableCell,
|
|
33
|
+
ITableCellRender,
|
|
34
|
+
} from '../../types/tableCell.js';
|
|
19
35
|
|
|
20
36
|
import { BeanControllerTableBase } from '../../lib/beanControllerTableBase.js';
|
|
21
37
|
import {
|
|
@@ -37,12 +53,13 @@ export interface ControllerTableProps<TData extends {} = {}> {
|
|
|
37
53
|
}
|
|
38
54
|
|
|
39
55
|
@Controller()
|
|
40
|
-
export class ControllerTable<TData extends {} = {}> extends BeanControllerTableBase {
|
|
56
|
+
export class ControllerTable<TData extends {} = {}> extends BeanControllerTableBase<TData> {
|
|
41
57
|
static $propsDefault = {};
|
|
42
58
|
|
|
59
|
+
// table: TypeTable<TData>; // in BeanControllerTableBase
|
|
60
|
+
|
|
43
61
|
properties: ISchemaObjectExtensionField[] | undefined;
|
|
44
62
|
columns: TypeColumn<TData>[];
|
|
45
|
-
table: TypeTable<TData>;
|
|
46
63
|
tableMeta: ITableMeta<TData>;
|
|
47
64
|
zovaJsx: ZovaJsx;
|
|
48
65
|
columnCelEnv: typeof celEnvBase;
|
|
@@ -106,13 +123,20 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
106
123
|
async properties => {
|
|
107
124
|
return await this._createColumnsMiddle(properties ?? this.tableMeta.properties);
|
|
108
125
|
},
|
|
109
|
-
async (
|
|
126
|
+
async (
|
|
127
|
+
key: string,
|
|
128
|
+
render: TypeTableCellRenderComponent,
|
|
129
|
+
): Promise<TypeTableCellRender<TData, any> | undefined> => {
|
|
110
130
|
// columnScope
|
|
111
131
|
const columnScope = this.getColumnScope(key);
|
|
112
132
|
// renderContext
|
|
113
133
|
const jsxRenderContext = this.getColumnJsxRenderContext(columnScope);
|
|
114
134
|
// columnProps
|
|
115
|
-
const { visible, columnProps } = this.getColumnComponentPropsTop(
|
|
135
|
+
const { visible, columnProps } = this.getColumnComponentPropsTop(
|
|
136
|
+
key,
|
|
137
|
+
columnScope,
|
|
138
|
+
jsxRenderContext,
|
|
139
|
+
);
|
|
116
140
|
// visible
|
|
117
141
|
if (visible === false) return;
|
|
118
142
|
return await this._createColumnRender(render, columnProps, columnScope, jsxRenderContext);
|
|
@@ -121,7 +145,9 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
121
145
|
);
|
|
122
146
|
}
|
|
123
147
|
|
|
124
|
-
private async _createColumnsMiddle(
|
|
148
|
+
private async _createColumnsMiddle(
|
|
149
|
+
properties: ISchemaObjectExtensionField[],
|
|
150
|
+
): Promise<TypeColumn<TData>[]> {
|
|
125
151
|
const tableMeta = this.tableMeta;
|
|
126
152
|
const columnHelper = createColumnHelper<TData>();
|
|
127
153
|
const columns: TypeColumn<TData>[] = [];
|
|
@@ -158,7 +184,11 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
158
184
|
// renderContext
|
|
159
185
|
const jsxRenderContext = this.getColumnJsxRenderContext(columnScope);
|
|
160
186
|
// columnProps
|
|
161
|
-
const { visible, render, columnProps } = this.getColumnComponentPropsTop(
|
|
187
|
+
const { visible, render, columnProps } = this.getColumnComponentPropsTop(
|
|
188
|
+
key,
|
|
189
|
+
columnScope,
|
|
190
|
+
jsxRenderContext,
|
|
191
|
+
);
|
|
162
192
|
// visible
|
|
163
193
|
if (visible === false) continue;
|
|
164
194
|
// property
|
|
@@ -187,7 +217,10 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
187
217
|
};
|
|
188
218
|
}
|
|
189
219
|
|
|
190
|
-
public getCellJsxRenderContext(
|
|
220
|
+
public getCellJsxRenderContext(
|
|
221
|
+
celScope: ITableCellScope,
|
|
222
|
+
cellContext: CellContext<TData, any>,
|
|
223
|
+
): IJsxRenderContextTableCell {
|
|
191
224
|
return {
|
|
192
225
|
app: this.app,
|
|
193
226
|
ctx: this.ctx,
|
|
@@ -200,7 +233,9 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
200
233
|
};
|
|
201
234
|
}
|
|
202
235
|
|
|
203
|
-
public async cellRenderPrepare(
|
|
236
|
+
public async cellRenderPrepare(
|
|
237
|
+
renders: TypeTableCellRenderComponent | TypeTableCellRenderComponent[],
|
|
238
|
+
) {
|
|
204
239
|
if (!Array.isArray(renders)) renders = [renders];
|
|
205
240
|
const renderProviders = renders.map(item => this.getRenderProvider(item));
|
|
206
241
|
const promises: Promise<any>[] = renderProviders.map(renderProvider =>
|
|
@@ -230,11 +265,25 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
230
265
|
columnProps = deepExtend({}, onionOptions, columnProps);
|
|
231
266
|
// should not eval jsx columnProps
|
|
232
267
|
// columnProps = this.zovaJsx.renderJsxProps(columnProps as any, {}, columnScope, renderContext) as any;
|
|
233
|
-
if (
|
|
268
|
+
if (
|
|
269
|
+
beanInstance?.checkVisible &&
|
|
270
|
+
!(await beanInstance.checkVisible(columnProps as any, renderContext))
|
|
271
|
+
)
|
|
272
|
+
return;
|
|
234
273
|
}
|
|
235
274
|
return cellContext => {
|
|
236
275
|
if (!cellContext) return;
|
|
237
|
-
return this._cellRender(
|
|
276
|
+
return this._cellRender(
|
|
277
|
+
render,
|
|
278
|
+
columnProps,
|
|
279
|
+
columnScope,
|
|
280
|
+
cellContext,
|
|
281
|
+
renderProvider,
|
|
282
|
+
beanInstance,
|
|
283
|
+
undefined,
|
|
284
|
+
undefined,
|
|
285
|
+
undefined,
|
|
286
|
+
);
|
|
238
287
|
};
|
|
239
288
|
}
|
|
240
289
|
|
|
@@ -339,9 +388,17 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
339
388
|
// cellProps = isJsxComponent(render) ? Object.assign({}, columnProps, cast(render).props) : columnProps;
|
|
340
389
|
cellProps = columnProps;
|
|
341
390
|
}
|
|
342
|
-
const cellProps2 = this.zovaJsx.renderJsxProps(
|
|
391
|
+
const cellProps2 = this.zovaJsx.renderJsxProps(
|
|
392
|
+
cellProps,
|
|
393
|
+
{},
|
|
394
|
+
cellScope,
|
|
395
|
+
jsxRenderContext,
|
|
396
|
+
) as any;
|
|
343
397
|
if (cellProps2.class || cellProps2.style) {
|
|
344
|
-
cellProps2.class = jsxRenderContext.$host.$cssMerge(
|
|
398
|
+
cellProps2.class = jsxRenderContext.$host.$cssMerge(
|
|
399
|
+
cellProps2.class,
|
|
400
|
+
jsxRenderContext.$host.$style(cellProps2.style),
|
|
401
|
+
);
|
|
345
402
|
delete cellProps2.style;
|
|
346
403
|
}
|
|
347
404
|
return beanInstance.render(cellProps2, jsxRenderContext, () => {
|
|
@@ -381,7 +438,11 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
381
438
|
});
|
|
382
439
|
}
|
|
383
440
|
|
|
384
|
-
public getColumnComponentPropsTop(
|
|
441
|
+
public getColumnComponentPropsTop(
|
|
442
|
+
name: string,
|
|
443
|
+
celScope: {},
|
|
444
|
+
renderContext: {},
|
|
445
|
+
): ITableCellRenderColumnOptions {
|
|
385
446
|
const property = this.getColumnProperty(name);
|
|
386
447
|
const rest = property?.rest;
|
|
387
448
|
return this._getColumnComponentPropsTopByRest(rest, name, celScope, renderContext);
|
|
@@ -403,7 +464,9 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
|
|
|
403
464
|
// return isJsxComponent(render) ? cast(render).type : render;
|
|
404
465
|
// }
|
|
405
466
|
|
|
406
|
-
public getRenderProvider(
|
|
467
|
+
public getRenderProvider(
|
|
468
|
+
render: TypeTableCellRenderComponent | undefined,
|
|
469
|
+
): TypeTableCellRenderComponentProvider {
|
|
407
470
|
if (!render) return 'text';
|
|
408
471
|
if (typeof render === 'string' && render.includes(':')) {
|
|
409
472
|
return beanFullNameFromOnionName(render, 'tableCell');
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table } from '@tanstack/table-core';
|
|
2
2
|
import type { TableOptionsWithReactiveData } from '@tanstack/vue-table';
|
|
3
3
|
|
|
4
4
|
import { useVueTable } from '@tanstack/vue-table';
|
|
5
5
|
import { markRaw } from 'vue';
|
|
6
6
|
import { BeanControllerPageBase } from 'zova';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { TypeTable } from '../types/table.js';
|
|
9
|
+
|
|
10
|
+
export class BeanControllerPageTableBase<TData extends {} = {}> extends BeanControllerPageBase {
|
|
11
|
+
table: TypeTable<TData>;
|
|
12
|
+
|
|
13
|
+
public $useTable(initialOptions: TableOptionsWithReactiveData<TData>): Table<TData> {
|
|
10
14
|
return this.ctx.util.instanceScope(() => {
|
|
11
15
|
return markRaw(useVueTable(initialOptions));
|
|
12
16
|
});
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table } from '@tanstack/table-core';
|
|
2
2
|
import type { TableOptionsWithReactiveData } from '@tanstack/vue-table';
|
|
3
3
|
|
|
4
4
|
import { useVueTable } from '@tanstack/vue-table';
|
|
5
5
|
import { markRaw } from 'vue';
|
|
6
6
|
import { BeanControllerBase } from 'zova';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { TypeTable } from '../types/table.js';
|
|
9
|
+
|
|
10
|
+
export class BeanControllerTableBase<TData extends {} = {}> extends BeanControllerBase {
|
|
11
|
+
table: TypeTable<TData>;
|
|
12
|
+
|
|
13
|
+
public $useTable(initialOptions: TableOptionsWithReactiveData<TData>): Table<TData> {
|
|
10
14
|
return this.ctx.util.instanceScope(() => {
|
|
11
15
|
return markRaw(useVueTable(initialOptions));
|
|
12
16
|
});
|