@ibiz-template/vue3-components 0.7.41-alpha.123 → 0.7.41-alpha.124

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 (55) hide show
  1. package/dist/chart-D8ak71ob.js +1 -0
  2. package/dist/index-BApiCD3N.js +339 -0
  3. package/dist/{index.es-DRy77DO2.js → index.es-16xILT5D.js} +1 -1
  4. package/dist/index.min.css +1 -1
  5. package/dist/index.system.min.js +1 -1
  6. package/dist/{wang-editor-B_LobLwM.js → wang-editor-BjVpWCI4.js} +1 -1
  7. package/dist/{xlsx-util-Zj1X0MzV.js → xlsx-util-BJgXbQ94.js} +1 -1
  8. package/es/control/chart/chart.mjs +30 -20
  9. package/es/control/data-view/data-view.mjs +27 -12
  10. package/es/control/data-view/data-view.util.mjs +43 -0
  11. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.mjs +2 -1
  12. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.mjs +2 -1
  13. package/es/control/grid/grid/grid-control.util.mjs +8 -7
  14. package/es/control/grid/grid/grid.mjs +32 -30
  15. package/es/control/list/list.mjs +10 -2
  16. package/es/control/tree/tree.mjs +12 -3
  17. package/es/control/tree-grid/tree-grid.mjs +33 -29
  18. package/es/control/tree-grid-ex/tree-grid-ex.mjs +32 -27
  19. package/es/editor/autocomplete/autocomplete-editor.controller.mjs +1 -2
  20. package/es/editor/data-picker/picker-editor.controller.mjs +1 -2
  21. package/es/editor/list-box/list-box-picker-editor.controller.mjs +2 -5
  22. package/es/panel-component/global-search/global-search.controller.mjs +1 -4
  23. package/lib/control/chart/chart.cjs +29 -19
  24. package/lib/control/data-view/data-view.cjs +25 -10
  25. package/lib/control/data-view/data-view.util.cjs +45 -0
  26. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.cjs +2 -1
  27. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.cjs +2 -1
  28. package/lib/control/grid/grid/grid-control.util.cjs +8 -7
  29. package/lib/control/grid/grid/grid.cjs +32 -30
  30. package/lib/control/list/list.cjs +8 -0
  31. package/lib/control/tree/tree.cjs +11 -2
  32. package/lib/control/tree-grid/tree-grid.cjs +32 -28
  33. package/lib/control/tree-grid-ex/tree-grid-ex.cjs +31 -26
  34. package/lib/editor/autocomplete/autocomplete-editor.controller.cjs +1 -2
  35. package/lib/editor/data-picker/picker-editor.controller.cjs +1 -2
  36. package/lib/editor/list-box/list-box-picker-editor.controller.cjs +2 -5
  37. package/lib/panel-component/global-search/global-search.controller.cjs +1 -4
  38. package/package.json +4 -4
  39. package/src/control/chart/chart.tsx +42 -36
  40. package/src/control/data-view/data-view.tsx +32 -15
  41. package/src/control/data-view/data-view.util.ts +68 -0
  42. package/src/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.tsx +3 -1
  43. package/src/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid2/repeater-grid2.tsx +3 -0
  44. package/src/control/grid/grid/grid-control.util.ts +12 -11
  45. package/src/control/grid/grid/grid.tsx +46 -35
  46. package/src/control/list/list.tsx +20 -1
  47. package/src/control/tree/tree.tsx +18 -4
  48. package/src/control/tree-grid/tree-grid.tsx +46 -33
  49. package/src/control/tree-grid-ex/tree-grid-ex.tsx +45 -25
  50. package/src/editor/autocomplete/autocomplete-editor.controller.ts +1 -2
  51. package/src/editor/data-picker/picker-editor.controller.ts +1 -2
  52. package/src/editor/list-box/list-box-picker-editor.controller.ts +2 -6
  53. package/src/panel-component/global-search/global-search.controller.ts +1 -5
  54. package/dist/chart-De-66DWN.js +0 -1
  55. package/dist/index-BoohvOk8.js +0 -339
@@ -181,10 +181,7 @@ class GlobalSearchController extends runtime.PanelItemController {
181
181
  func.appId
182
182
  );
183
183
  if (deACMode) {
184
- let acItemProvider;
185
- if (deACMode.itemSysPFPluginId) {
186
- acItemProvider = await runtime.getAcItemProvider(deACMode);
187
- }
184
+ const acItemProvider = await runtime.getAcItemProvider(deACMode);
188
185
  this.state.items.push({
189
186
  deACMode,
190
187
  acItemProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/vue3-components",
3
- "version": "0.7.41-alpha.123",
3
+ "version": "0.7.41-alpha.124",
4
4
  "description": "web端组件库(vue3)",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.mjs",
@@ -37,10 +37,10 @@
37
37
  "@ibiz-template-plugin/data-view": "0.0.8",
38
38
  "@ibiz-template/core": "0.7.41-alpha.119",
39
39
  "@ibiz-template/devtool": "0.0.16",
40
- "@ibiz-template/model-helper": "0.7.41-alpha.129",
41
- "@ibiz-template/runtime": "0.7.41-alpha.128",
40
+ "@ibiz-template/model-helper": "0.7.41-alpha.130",
41
+ "@ibiz-template/runtime": "0.7.41-alpha.130",
42
42
  "@ibiz-template/theme": "0.7.39",
43
- "@ibiz-template/vue3-util": "0.7.41-alpha.128",
43
+ "@ibiz-template/vue3-util": "0.7.41-alpha.130",
44
44
  "@ibiz-template/web-theme": "3.16.0",
45
45
  "@ibiz/model-core": "^0.1.89",
46
46
  "@imengyu/vue3-context-menu": "^1.3.5",
@@ -76,6 +76,46 @@ const ChartControl = defineComponent({
76
76
  const drillDetailRef = ref(); // 数据反查框
77
77
  let tempParams: IData; // 点击的图表回调事件参数
78
78
 
79
+ // 子类类名透传
80
+ const childClass = [
81
+ {
82
+ class: `${ns.em('grid', 'body-row')} ${semanticClass('table.body.row')}`,
83
+ selector: '.el-table__row',
84
+ },
85
+ {
86
+ class: `${ns.em('grid', 'header-row')} ${semanticClass('table.header.row')}`,
87
+ selector: '.el-table__header tr',
88
+ },
89
+ {
90
+ class: `${ns.em('grid', 'body-cell')} ${semanticClass('table.body.cell')}`,
91
+ selector: '.el-table__body .el-table__cell',
92
+ },
93
+ {
94
+ class: `${ns.em('grid', 'header-cell')} ${semanticClass('table.header.cell')}`,
95
+ selector: '.el-table__header .el-table__cell',
96
+ },
97
+ ];
98
+
99
+ // 子类样式透传
100
+ const childStyle = [
101
+ {
102
+ class: semanticStyle('table.body.row'),
103
+ selector: '.el-table__row',
104
+ },
105
+ {
106
+ class: semanticStyle('table.header.row'),
107
+ selector: '.el-table__header tr',
108
+ },
109
+ {
110
+ class: semanticStyle('table.body.cell'),
111
+ selector: '.el-table__body .el-table__cell',
112
+ },
113
+ {
114
+ class: semanticStyle('table.header.cell'),
115
+ selector: '.el-table__header .el-table__cell',
116
+ },
117
+ ];
118
+
79
119
  // 本地数据模式
80
120
  const initSimpleData = (): void => {
81
121
  if (!props.data) {
@@ -248,42 +288,8 @@ const ChartControl = defineComponent({
248
288
  style={{ width: '100%' }}
249
289
  max-height={maxHeight.value}
250
290
  span-method={c.spanMethod.bind(c)}
251
- header-row-style={(...args: IData[]) =>
252
- semanticStyle('table.header.row', args)
253
- }
254
- header-row-class-name={(...args: IData[]) => {
255
- return [
256
- ns.em('grid', 'header-row'),
257
- semanticClass('table.header.row', args),
258
- ].join(' ');
259
- }}
260
- header-cell-style={(...args: IData[]) =>
261
- semanticStyle('table.header.cell', args)
262
- }
263
- header-cell-class-name={(...args: IData[]) => {
264
- return [
265
- ns.em('grid', 'header-cell'),
266
- semanticClass('table.header.cell', args),
267
- ].join(' ');
268
- }}
269
- row-style={(...args: IData[]) =>
270
- semanticStyle('table.body.row', args)
271
- }
272
- row-class-name={(...args: IData[]) => {
273
- return [
274
- ns.em('grid', 'body-row'),
275
- semanticClass('table.body.row', args),
276
- ].join(' ');
277
- }}
278
- cell-style={(...args: IData[]) =>
279
- semanticStyle('table.body.cell', args)
280
- }
281
- cell-class-name={(...args: IData[]) => {
282
- return [
283
- ns.em('grid', 'body-cell'),
284
- semanticClass('table.body.cell', args),
285
- ].join(' ');
286
- }}
291
+ v-child-class={childClass}
292
+ v-child-style={childStyle}
287
293
  >
288
294
  {c.state.gridHeaders.map((column: IData) => {
289
295
  return (
@@ -30,10 +30,12 @@ import {
30
30
  IControlProvider,
31
31
  IMDControlGroupState,
32
32
  DataViewControlController,
33
+ getMDCtrlItemProvider,
33
34
  } from '@ibiz-template/runtime';
34
35
  import { createUUID } from 'qx-util';
35
36
  import draggable from 'vuedraggable';
36
37
  import { usePagination } from '../../util';
38
+ import { useDataViewSkeleton } from './data-view.util';
37
39
  import './data-view.scss';
38
40
 
39
41
  export const DataViewControl = defineComponent({
@@ -353,6 +355,17 @@ export const DataViewControl = defineComponent({
353
355
 
354
356
  // 绘制卡片
355
357
  const renderCard = (item: IData): VNode => {
358
+ // 多数据部件项绘制器
359
+ const provider = getMDCtrlItemProvider(c.model);
360
+ if (provider)
361
+ return h(resolveComponent(provider.component), {
362
+ data: item,
363
+ controller: c,
364
+ onClick: (event: MouseEvent): Promise<void> =>
365
+ onRowClick(item, event),
366
+ onDblclick: (event: MouseEvent): Promise<void> =>
367
+ onDbRowClick(item, event),
368
+ });
356
369
  const itemStyle = ns.cssVarBlock({
357
370
  'item-bg-color': `${item.bgcolor || ''}`,
358
371
  'text-color': `${item.fontcolor || ''}`,
@@ -781,6 +794,12 @@ export const DataViewControl = defineComponent({
781
794
 
782
795
  // 单行高度
783
796
  const ITEM_HEIGHT: number = 24;
797
+
798
+ // 骨架屏:按容器宽度计算单行最大卡片数
799
+ const { setSkeletonContentRef, calcSkeletonCount } = useDataViewSkeleton({
800
+ model: c.model,
801
+ });
802
+
784
803
  // 计算骨架屏行数
785
804
  const calcSkeletonRows = (): number => {
786
805
  const { cardHeight } = c.model;
@@ -850,25 +869,23 @@ export const DataViewControl = defineComponent({
850
869
  // 绘制分组骨架屏
851
870
  const renderGroupSkeleton = (): VNode => {
852
871
  return (
853
- <div class={ns.b('skeleton')}>
872
+ <div class={[ns.e('content'), ns.b('group-content')]}>
854
873
  {Array.from({ length: 3 }, () => (
855
- <div class={ns.b('skeleton-group')}>
856
- <div class={ns.be('skeleton-group', 'header')}>
874
+ <div class={ns.be('group-content', 'item')}>
875
+ <div class={ns.be('group-content', 'item-header')}>
857
876
  <el-skeleton animated rows={1}>
858
877
  {{
859
878
  template: () => (
860
- <el-skeleton-item variant='rect' style='width: 15%' />
879
+ <el-skeleton-item
880
+ variant='rect'
881
+ style='width: 15%;height: 24px;'
882
+ />
861
883
  ),
862
884
  }}
863
885
  </el-skeleton>
864
886
  </div>
865
- <div
866
- class={[
867
- ns.be('skeleton', 'content'),
868
- ns.be('skeleton-group', 'content'),
869
- ]}
870
- >
871
- {renderSkeletonCardLayout(3)}
887
+ <div ref={setSkeletonContentRef}>
888
+ {renderSkeletonCardLayout(calcSkeletonCount(3))}
872
889
  </div>
873
890
  </div>
874
891
  ))}
@@ -881,10 +898,10 @@ export const DataViewControl = defineComponent({
881
898
  if (c.state.enableGroup) {
882
899
  return renderGroupSkeleton();
883
900
  }
884
- const count = c.state.size || 6;
901
+ const count = c.state.size || calcSkeletonCount(6);
885
902
  return (
886
- <div class={ns.b('skeleton')}>
887
- <div class={ns.be('skeleton', 'content')}>
903
+ <div class={ns.e('content')}>
904
+ <div ref={setSkeletonContentRef}>
888
905
  {renderSkeletonCardLayout(Math.min(count, 20))}
889
906
  </div>
890
907
  </div>
@@ -996,7 +1013,7 @@ export const DataViewControl = defineComponent({
996
1013
  const provider = c.view.providers[id];
997
1014
  return h(resolveComponent(provider?.component || 'IBizControlShell'), {
998
1015
  class: [ns.e('searchbar'), semanticClass('searchbar')],
999
- style: semanticStyle(searchbar),
1016
+ style: semanticStyle('searchbar'),
1000
1017
  context: c.view.context,
1001
1018
  params: c.view.params,
1002
1019
  modelData: searchbar,
@@ -0,0 +1,68 @@
1
+ import { ref, onBeforeUnmount } from 'vue';
2
+ import { IDEDataView } from '@ibiz/model-core';
3
+
4
+ /**
5
+ * 数据视图骨架屏 hook
6
+ *
7
+ * 配置了卡片宽度且为 flex 布局时,按容器宽度计算单行最大骨架卡片数,否则使用默认数量
8
+ *
9
+ * @author zhangpingchuan
10
+ */
11
+ export const useDataViewSkeleton = ({
12
+ model,
13
+ }: {
14
+ model: IDEDataView;
15
+ }): {
16
+ setSkeletonContentRef: (el: unknown) => void;
17
+ calcSkeletonCount: (defaultCount: number) => number;
18
+ } => {
19
+ // 骨架屏内容容器元素与宽度(用于按卡片宽度计算单行最大卡片数)
20
+ let skeletonContentEl: HTMLElement | undefined;
21
+ const skeletonContainerWidth = ref(0);
22
+ let skeletonResizeObserver: ResizeObserver | undefined;
23
+
24
+ // 函数式 ref:骨架屏内容容器挂载/卸载时测量宽度并监听尺寸变化
25
+ const setSkeletonContentRef = (el: unknown) => {
26
+ skeletonResizeObserver?.disconnect();
27
+ skeletonResizeObserver = undefined;
28
+ skeletonContentEl = (el as HTMLElement) || undefined;
29
+ if (skeletonContentEl) {
30
+ const update = () => {
31
+ skeletonContainerWidth.value = skeletonContentEl!.clientWidth;
32
+ };
33
+ update();
34
+ skeletonResizeObserver = new ResizeObserver(update);
35
+ skeletonResizeObserver.observe(skeletonContentEl);
36
+ }
37
+ };
38
+
39
+ onBeforeUnmount(() => {
40
+ skeletonResizeObserver?.disconnect();
41
+ });
42
+
43
+ // 配置了卡片宽度且为 flex 布局时,按容器宽度计算骨架屏卡片数量,否则用默认数量
44
+ const calcSkeletonCount = (defaultCount: number): number => {
45
+ const { cardWidth, cardColXS, cardColSM, cardColMD, cardColLG } = model;
46
+ if (
47
+ !cardWidth ||
48
+ !skeletonContainerWidth.value ||
49
+ cardColXS ||
50
+ cardColSM ||
51
+ cardColMD ||
52
+ cardColLG
53
+ ) {
54
+ return defaultCount;
55
+ }
56
+ // n * cardWidth + (n - 1) * gap <= containerWidth
57
+ let gap = 0;
58
+ if (skeletonContentEl) {
59
+ gap = Number.parseFloat(getComputedStyle(skeletonContentEl).gap) || 0;
60
+ }
61
+ const count = Math.floor(
62
+ (skeletonContainerWidth.value + gap) / (cardWidth + gap),
63
+ );
64
+ return Math.max(1, count);
65
+ };
66
+
67
+ return { setSkeletonContentRef, calcSkeletonCount };
68
+ };
@@ -345,8 +345,10 @@ export const RepeaterGrid: ReturnType<typeof defineComponent> = defineComponent(
345
345
  <el-table-column type='index' width={66} align='center'>
346
346
  {{
347
347
  default: (opts: IData) => {
348
+ const rowEnableDelete =
349
+ this.controller.getRowEnableDelete(opts.row);
348
350
  const { $index } = opts;
349
- if (!this.controller.enableDelete) {
351
+ if (!this.controller.enableDelete || !rowEnableDelete) {
350
352
  return <span>{$index + 1}</span>;
351
353
  }
352
354
  return [
@@ -407,6 +407,8 @@ export const RepeaterGrid2: ReturnType<typeof defineComponent> =
407
407
  <el-table-column width={80} align='center'>
408
408
  {{
409
409
  default: (opts: IData) => {
410
+ const rowEnableDelete =
411
+ this.controller.getRowEnableDelete(opts.row);
410
412
  const { $index } = opts;
411
413
  return (
412
414
  <div class={this.ns.b('action-group')}>
@@ -434,6 +436,7 @@ export const RepeaterGrid2: ReturnType<typeof defineComponent> =
434
436
  ></ion-icon>
435
437
  )}
436
438
  {this.controller.enableDelete &&
439
+ rowEnableDelete &&
437
440
  !isEmpty &&
438
441
  this.renderRemoveBtn($index)}
439
442
  </div>
@@ -191,10 +191,21 @@ export function useITableEvent(c: GridController): {
191
191
 
192
192
  // 所有表格列
193
193
  const allGridColumns: IDEGridColumn[] = [];
194
+ const headerCellClassNameMap: Map<string, string> = new Map();
194
195
  recursiveIterate(
195
196
  c.model,
196
197
  (column: IDEGridColumn) => {
197
198
  allGridColumns.push(column);
199
+ if (
200
+ column.codeName &&
201
+ column.headerSysCss &&
202
+ column.headerSysCss.cssName
203
+ ) {
204
+ headerCellClassNameMap.set(
205
+ column.codeName,
206
+ column.headerSysCss.cssName,
207
+ );
208
+ }
198
209
  },
199
210
  { childrenFields: ['degridColumns'] },
200
211
  );
@@ -581,17 +592,7 @@ export function useITableEvent(c: GridController): {
581
592
  _rowIndex: number;
582
593
  _columnIndex: number;
583
594
  }): string {
584
- const columnModel = allGridColumns.find(gridColumn => {
585
- return gridColumn.codeName === column.property;
586
- });
587
- if (
588
- columnModel &&
589
- columnModel.headerSysCss &&
590
- columnModel.headerSysCss.cssName
591
- ) {
592
- return columnModel.headerSysCss.cssName;
593
- }
594
- return '';
595
+ return headerCellClassNameMap.get(column.property) || '';
595
596
  }
596
597
 
597
598
  watch(
@@ -462,6 +462,46 @@ export const GridControl = defineComponent({
462
462
  const { headerCssVars } = useGridHeaderStyle(tableRef, ns);
463
463
  const { cleanup = NOOP, setDragEvent } = useGridDraggable(tableRef, ns, c);
464
464
 
465
+ // 子类类名透传
466
+ const childClass = [
467
+ {
468
+ class: semanticClass('body.row'),
469
+ selector: '.el-table__row',
470
+ },
471
+ {
472
+ class: semanticClass('header.row'),
473
+ selector: '.el-table__header tr',
474
+ },
475
+ {
476
+ class: semanticClass('body.cell'),
477
+ selector: '.el-table__body .el-table__cell',
478
+ },
479
+ {
480
+ class: semanticClass('header.cell'),
481
+ selector: '.el-table__header .el-table__cell',
482
+ },
483
+ ];
484
+
485
+ // 子类样式透传
486
+ const childStyle = [
487
+ {
488
+ class: semanticStyle('body.row'),
489
+ selector: '.el-table__row',
490
+ },
491
+ {
492
+ class: semanticStyle('header.row'),
493
+ selector: '.el-table__header tr',
494
+ },
495
+ {
496
+ class: semanticStyle('body.cell'),
497
+ selector: '.el-table__body .el-table__cell',
498
+ },
499
+ {
500
+ class: semanticStyle('header.cell'),
501
+ selector: '.el-table__header .el-table__cell',
502
+ },
503
+ ];
504
+
465
505
  c.evt.on('onLoadSuccess', () => {
466
506
  if (setDragEvent) {
467
507
  setDragEvent();
@@ -706,6 +746,8 @@ export const GridControl = defineComponent({
706
746
  isLodeMoreDisabled,
707
747
  semanticClass,
708
748
  semanticStyle,
749
+ childClass,
750
+ childStyle,
709
751
  pageSemantic,
710
752
  onRowClick,
711
753
  spanMethod,
@@ -777,44 +819,13 @@ export const GridControl = defineComponent({
777
819
  onHeaderDragend={this.headerDragend}
778
820
  default-expand-all={defaultExpandAll}
779
821
  show-header={!this.c.state.hideHeader}
780
- row-class-name={(event: { row: IData; rowIndex: number }) => {
781
- return [
782
- this.handleRowClassName(event),
783
- this.semanticClass('body.row', { event }),
784
- ].join(' ');
785
- }}
786
- header-row-class-name={(...args: IData[]) =>
787
- this.semanticClass('header.row', { args })
788
- }
789
- row-style={(...args: IData[]) =>
790
- this.semanticStyle('body.row', { args })
791
- }
792
- header-row-style={(...args: IData[]) =>
793
- this.semanticStyle('header.row', { args })
794
- }
822
+ row-class-name={this.handleRowClassName}
795
823
  highlight-current-row={state.singleSelect}
796
824
  expandRowKeys={this.c.state.expandRowKeys}
797
825
  onSelectionChange={this.onSelectionChange}
798
- cell-class-name={(...args: IData[]) =>
799
- this.semanticClass('body.cell', { args })
800
- }
801
- header-cell-class-name={(data: {
802
- _row: IData;
803
- column: IData;
804
- _rowIndex: number;
805
- _columnIndex: number;
806
- }) => {
807
- return [
808
- this.handleHeaderCellClassName(data),
809
- this.semanticClass('header.cell', { event: data }),
810
- ].join(' ');
811
- }}
812
- cell-style={(...args: IData[]) =>
813
- this.semanticStyle('body.cell', { args })
814
- }
815
- header-cell-style={(...args: IData[]) =>
816
- this.semanticStyle('header.cell', { args })
817
- }
826
+ header-cell-class-name={this.handleHeaderCellClassName}
827
+ v-child-class={this.childClass}
828
+ v-child-style={this.childStyle}
818
829
  onExpandChange={(row: IData, expanded: boolean) =>
819
830
  this.c.expandChange(row, expanded)
820
831
  }
@@ -8,7 +8,16 @@ import {
8
8
  hasEmptyPanelRenderer,
9
9
  useControlPopoverzIndex,
10
10
  } from '@ibiz-template/vue3-util';
11
- import { ref, VNode, watch, PropType, computed, defineComponent } from 'vue';
11
+ import {
12
+ h,
13
+ ref,
14
+ VNode,
15
+ watch,
16
+ PropType,
17
+ computed,
18
+ defineComponent,
19
+ resolveComponent,
20
+ } from 'vue';
12
21
  import { IDEList, ILayoutPanel, IUIActionGroupDetail } from '@ibiz/model-core';
13
22
  import { isNil, debounce } from 'lodash-es';
14
23
  import {
@@ -17,6 +26,7 @@ import {
17
26
  IDragChangeInfo,
18
27
  IControlProvider,
19
28
  IMDControlGroupState,
29
+ getMDCtrlItemProvider,
20
30
  } from '@ibiz-template/runtime';
21
31
  import draggable from 'vuedraggable';
22
32
  import { showTitle } from '@ibiz-template/core';
@@ -394,6 +404,15 @@ export const ListControl = defineComponent({
394
404
  };
395
405
 
396
406
  const renderItem = (item: IData) => {
407
+ // 多数据部件项绘制器
408
+ const provider = getMDCtrlItemProvider(c.model);
409
+ if (provider)
410
+ return h(resolveComponent(provider.component), {
411
+ data: item,
412
+ controller: c,
413
+ onClick: (): Promise<void> => c.onRowClick(item),
414
+ onDblclick: (): Promise<void> => c.onDbRowClick(item),
415
+ });
397
416
  const cardStyle = ns.cssVarBlock({
398
417
  'item-bg-color': `${item.bgcolor || ''}`,
399
418
  'text-color': `${item.fontcolor || ''}`,
@@ -1,10 +1,11 @@
1
1
  /* eslint-disable no-nested-ternary */
2
2
  import {
3
- useControlController,
4
3
  useNamespace,
5
4
  useSemanticNode,
5
+ useControlController,
6
6
  } from '@ibiz-template/vue3-util';
7
7
  import {
8
+ h,
8
9
  ref,
9
10
  Ref,
10
11
  VNode,
@@ -1092,11 +1093,24 @@ export const TreeControl = defineComponent({
1092
1093
  if (this.newNodeKey === data._id) return this.renderNewNode();
1093
1094
 
1094
1095
  const nodeData = this.findNodeData(data._uuid, this.c)!;
1095
- if (!nodeData) {
1096
- return null;
1097
- }
1096
+ if (!nodeData) return null;
1098
1097
  const nodeModel = this.c.getNodeModel(nodeData._nodeId)!;
1099
1098
 
1099
+ // 通过适配器绘制
1100
+ const provider = this.c.nodeProvider[nodeData._nodeId];
1101
+ if (provider)
1102
+ return h(resolveComponent(provider.component), {
1103
+ data: nodeData,
1104
+ model: nodeModel,
1105
+ controller: this.c,
1106
+ onDblclick: (evt: MouseEvent) =>
1107
+ this.onNodeDbClick(nodeData, evt),
1108
+ onClick: (evt: MouseEvent) =>
1109
+ this.onNodeClick(nodeData, data, evt),
1110
+ onContextmenu: (evt: MouseEvent) =>
1111
+ this.onNodeContextmenu(nodeData, evt),
1112
+ });
1113
+
1100
1114
  // 绘制编辑项
1101
1115
  if (this.editingNodeKey === nodeData._id) {
1102
1116
  return (
@@ -109,6 +109,46 @@ export const TreeGridControl = defineComponent({
109
109
  const ns2 = useNamespace(`control-${c.model.controlType!.toLowerCase()}`);
110
110
  const { semanticClass, semanticStyle } = useSemanticNode(c);
111
111
 
112
+ // 子类类名透传
113
+ const childClass = [
114
+ {
115
+ class: semanticClass('body.row'),
116
+ selector: '.el-table__row',
117
+ },
118
+ {
119
+ class: semanticClass('header.row'),
120
+ selector: '.el-table__header tr',
121
+ },
122
+ {
123
+ class: semanticClass('body.cell'),
124
+ selector: '.el-table__body .el-table__cell',
125
+ },
126
+ {
127
+ class: semanticClass('header.cell'),
128
+ selector: '.el-table__header .el-table__cell',
129
+ },
130
+ ];
131
+
132
+ // 子类样式透传
133
+ const childStyle = [
134
+ {
135
+ class: semanticStyle('body.row'),
136
+ selector: '.el-table__row',
137
+ },
138
+ {
139
+ class: semanticStyle('header.row'),
140
+ selector: '.el-table__header tr',
141
+ },
142
+ {
143
+ class: semanticStyle('body.cell'),
144
+ selector: '.el-table__body .el-table__cell',
145
+ },
146
+ {
147
+ class: semanticStyle('header.cell'),
148
+ selector: '.el-table__header .el-table__cell',
149
+ },
150
+ ];
151
+
112
152
  const {
113
153
  tableRef,
114
154
  onRowClick,
@@ -323,6 +363,8 @@ export const TreeGridControl = defineComponent({
323
363
  semanticClass,
324
364
  semanticStyle,
325
365
  pageSemantic,
366
+ childClass,
367
+ childStyle,
326
368
  loadData,
327
369
  onRowClick,
328
370
  renderColumn,
@@ -383,39 +425,10 @@ export const TreeGridControl = defineComponent({
383
425
  onExpandChange={(row: IData, expanded: boolean) =>
384
426
  this.c.expandChange(row, expanded)
385
427
  }
386
- row-class-name={(event: { row: IData; rowIndex: number }) => {
387
- return [
388
- this.handleRowClassName(event),
389
- this.semanticClass('body.row', { event }),
390
- ].join(' ');
391
- }}
392
- header-row-class-name={(...args: IData[]) =>
393
- this.semanticClass('header.row', { args })
394
- }
395
- row-style={(...args: IData[]) =>
396
- this.semanticStyle('body.row', { args })
397
- }
398
- header-row-style={(...args: IData[]) =>
399
- this.semanticStyle('header.row', { args })
400
- }
401
- cell-class-name={(...args: IData[]) =>
402
- this.semanticClass('body.cell', { args })
403
- }
404
- header-cell-class-name={(data: {
405
- _row: IData;
406
- column: IData;
407
- _rowIndex: number;
408
- _columnIndex: number;
409
- }) => {
410
- return [
411
- this.handleHeaderCellClassName(data),
412
- this.semanticClass('header.cell', { event: data }),
413
- ].join(' ');
414
- }}
415
- cell-style={(...args: IData[]) =>
416
- this.semanticStyle('body.cell', { args })
417
- }
418
- header-cell-style={this.semanticStyle('header.cell')}
428
+ v-child-class={this.childClass}
429
+ v-child-style={this.childStyle}
430
+ row-class-name={this.handleRowClassName}
431
+ header-cell-class-name={this.handleHeaderCellClassName}
419
432
  tree-props={{ children: 'children', hasChildren: 'hasChildren' }}
420
433
  data={
421
434
  this.c.state.showTreeGrid ? state.treeGirdData : this.tableData