cabloy 5.1.246 → 5.1.247

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.
Files changed (24) hide show
  1. package/.cabloy-version +1 -1
  2. package/CHANGELOG.md +6 -0
  3. package/package.json +1 -1
  4. package/repo-docs/frontend/column-configuration-guide.md +2 -0
  5. package/repo-docs/frontend/table-guide.md +24 -0
  6. package/repo-e2e/specs/cabloy-basic.spec.ts +350 -28
  7. package/zova/packages-zova/zova/package.json +2 -2
  8. package/zova/src/suite/cabloy-basic/modules/basic-date/src/component/dateRange/controller.tsx +4 -3
  9. package/zova/src/suite/cabloy-basic/modules/basic-date/src/component/formFieldDateRange/controller.tsx +13 -1
  10. package/zova/src/suite/cabloy-basic/modules/basic-details/src/component/blockTable/controller.tsx +1 -1
  11. package/zova/src/suite/cabloy-basic/modules/basic-page/src/component/blockTable/controller.tsx +1 -1
  12. package/zova/src/suite/cabloy-basic/modules/basic-table/src/.metadata/component/rowOperations.ts +31 -0
  13. package/zova/src/suite/cabloy-basic/modules/basic-table/src/.metadata/index.ts +13 -0
  14. package/zova/src/suite/cabloy-basic/modules/basic-table/src/bean/tableCell.actionDelete.tsx +6 -2
  15. package/zova/src/suite/cabloy-basic/modules/basic-table/src/bean/tableCell.actionOperationsRow.tsx +32 -4
  16. package/zova/src/suite/cabloy-basic/modules/basic-table/src/bean/tableCell.actionUpdate.tsx +6 -2
  17. package/zova/src/suite/cabloy-basic/modules/basic-table/src/component/rowOperations/controller.tsx +233 -0
  18. package/zova/src/suite/cabloy-basic/modules/basic-table/src/component/table/controller.tsx +75 -2
  19. package/zova/src/suite/cabloy-basic/modules/basic-table/src/component/table/render.tsx +40 -22
  20. package/zova/src/suite/cabloy-basic/modules/basic-table/src/config/locale/en-us.ts +4 -0
  21. package/zova/src/suite/cabloy-basic/modules/basic-table/src/config/locale/zh-cn.ts +4 -0
  22. package/zova/src/suite-vendor/a-zova/modules/a-table/package.json +1 -1
  23. package/zova/src/suite-vendor/a-zova/modules/a-table/src/component/table/controller.tsx +19 -11
  24. package/zova/src/suite-vendor/a-zova/package.json +2 -2
@@ -10,6 +10,7 @@ import type {
10
10
  import { celEnvBase, isNilOrEmptyString } from '@cabloy/utils';
11
11
  import {
12
12
  CellContext,
13
+ ColumnSizingState,
13
14
  createColumnHelper,
14
15
  functionalUpdate,
15
16
  getCoreRowModel,
@@ -56,6 +57,8 @@ import { reconcileTableLayout } from '../../types/tableLayout.ts';
56
57
  export interface ControllerTableProps<TData extends {} = {}> {
57
58
  data?: TData[];
58
59
  layout?: ITableLayout;
60
+ compact?: boolean;
61
+ columnSizing?: ColumnSizingState;
59
62
  schema?: SchemaObject;
60
63
  schemaOrder?: SchemaObject;
61
64
  sorting?: SortingState;
@@ -125,6 +128,10 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
125
128
  return this.$props.data;
126
129
  }
127
130
 
131
+ public get compact() {
132
+ return this.$props.compact ?? false;
133
+ }
134
+
128
135
  public get sorting() {
129
136
  return this.$props.sorting ?? [];
130
137
  }
@@ -144,7 +151,6 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
144
151
  public async refreshMeta() {
145
152
  this.tableMeta = await this._createTableMeta();
146
153
  this.columns = await this._createColumns();
147
- this.table?.setColumnPinning(this._getColumnPinning());
148
154
  }
149
155
 
150
156
  private _createTable() {
@@ -176,6 +182,9 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
176
182
  get columnSizing() {
177
183
  return self._getColumnSizing();
178
184
  },
185
+ get columnPinning() {
186
+ return self._getColumnPinning();
187
+ },
179
188
  },
180
189
  onSortingChange: updater => {
181
190
  const sorting = functionalUpdate(updater, self.sorting).slice(0, 1);
@@ -185,10 +194,6 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
185
194
  const rowSelection = functionalUpdate(updater, self.rowSelection);
186
195
  self.$props.onRowSelectionChange?.(rowSelection);
187
196
  },
188
- get initialState() {
189
- const columnPinning = self._getColumnPinning();
190
- return { columnPinning };
191
- },
192
197
  get data() {
193
198
  return self.data || [];
194
199
  },
@@ -197,7 +202,6 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
197
202
  },
198
203
  };
199
204
  this.table = this.$useTable(tableOptions);
200
- this.table.setColumnPinning(this._getColumnPinning());
201
205
  }
202
206
 
203
207
  private async _createColumns() {
@@ -318,14 +322,18 @@ export class ControllerTable<TData extends {} = {}> extends BeanControllerTableB
318
322
  }
319
323
 
320
324
  private _getColumnSizing() {
321
- return Object.fromEntries(
322
- this.layout.columns
323
- .filter(column => typeof column.width === 'number')
324
- .map(column => [column.key, column.width as number]),
325
- );
325
+ return {
326
+ ...Object.fromEntries(
327
+ this.layout.columns
328
+ .filter(column => typeof column.width === 'number')
329
+ .map(column => [column.key, column.width as number]),
330
+ ),
331
+ ...this.$props.columnSizing,
332
+ };
326
333
  }
327
334
 
328
335
  private _getColumnPinning() {
336
+ if (this.compact) return { left: [], right: [] };
329
337
  const left: string[] = this.$props.enableRowSelection ? [TableColumnIdSelection] : [];
330
338
  const right: string[] = [];
331
339
  for (const property of this.tableMeta?.properties ?? []) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-suite-a-zova",
3
- "version": "5.1.176",
3
+ "version": "5.1.177",
4
4
  "gitHead": "2c5c19284bab738e492856189acb6fad74b8a7b7",
5
5
  "description": "zova",
6
6
  "license": "MIT",
@@ -29,7 +29,7 @@
29
29
  "zova-module-a-ssrhmr": "^5.1.24",
30
30
  "zova-module-a-ssrserver": "^5.1.27",
31
31
  "zova-module-a-style": "^5.1.36",
32
- "zova-module-a-table": "^5.1.45",
32
+ "zova-module-a-table": "^5.1.46",
33
33
  "zova-module-a-zod": "^5.1.39",
34
34
  "zova-module-a-zova": "^5.1.114"
35
35
  },