@vue-ui-kit/ant 2.0.5 → 2.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-ui-kit/ant",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "Vue3 UI Kit based on Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -338,7 +338,11 @@ export interface PCanvasGridProps<
338
338
  D extends Recordable = Recordable,
339
339
  F extends Recordable = Recordable,
340
340
  > {
341
- selectConfig?: SelectConfig<D>;
341
+ staticConfig?: {
342
+ selectable?: boolean;
343
+ showCount?: boolean;
344
+ tree?: boolean;
345
+ };
342
346
  manualFetch?: boolean;
343
347
  formConfig?: PFormProps<F>;
344
348
  columns: CanvasColumnProps<D>[];
@@ -65,7 +65,7 @@
65
65
  (event: 'resetQuery'): void;
66
66
  }>();
67
67
 
68
- const { formConfig, pageConfig, columns, toolbarConfig, proxyConfig, config, selectConfig } =
68
+ const { formConfig, pageConfig, columns, toolbarConfig, proxyConfig, config, staticConfig } =
69
69
  toRefs(props);
70
70
  const gridDefaults = getGridDefaults();
71
71
  const canvasTableDefaults = getCanvasTableDefaults();
@@ -307,19 +307,40 @@
307
307
  break;
308
308
  }
309
309
  };
310
- const finalColumns = computed<CanvasColumnProps<D>[]>(() =>
311
- selectConfig.value?.multiple
312
- ? [
313
- {
314
- type: 'selection',
310
+ const finalColumns = computed<CanvasColumnProps<D>[]>(() => {
311
+ if (!staticConfig.value || (!staticConfig.value.selectable && !staticConfig.value.tree)) {
312
+ return columns.value;
313
+ }
314
+ const firstColumn: CanvasColumnProps<D> =
315
+ staticConfig.value.selectable && staticConfig.value.tree
316
+ ? {
317
+ type: 'tree-selection',
315
318
  width: 40,
316
319
  widthFillDisable: true,
317
320
  title: '',
318
- },
319
- ...columns.value,
320
- ]
321
- : columns.value,
322
- );
321
+ }
322
+ : staticConfig.value.selectable
323
+ ? {
324
+ type: 'selection',
325
+ width: 40,
326
+ widthFillDisable: true,
327
+ title: '',
328
+ }
329
+ : staticConfig.value.tree
330
+ ? {
331
+ type: 'tree',
332
+ width: 40,
333
+ widthFillDisable: true,
334
+ title: '',
335
+ }
336
+ : {
337
+ type: 'index',
338
+ width: 40,
339
+ widthFillDisable: true,
340
+ title: '',
341
+ };
342
+ return [firstColumn, ...columns.value];
343
+ });
323
344
  const resetQueryFormData = (lazy?: boolean) => {
324
345
  if (formConfig.value && formConfig.value.items.length > 0) {
325
346
  if (formConfig.value.customReset) {
@@ -364,7 +385,7 @@
364
385
  const formHeight = formOriginHeight.includes('px')
365
386
  ? toNumber(formOriginHeight.replace('px', ''))
366
387
  : 0;
367
- const showCountHeight = selectConfig.value?.showCount ? 22 : 0;
388
+ const showCountHeight = staticConfig.value?.showCount ? 22 : 0;
368
389
  renderHeight.value =
369
390
  toNumber(ph.replace('px', '')) -
370
391
  propsWithDefaults.value.fitCanvasHeight -
@@ -502,7 +523,7 @@
502
523
  </div>
503
524
  <div :class="`p-pane flex-1 h-0 p-inner-scroll`">
504
525
  <div
505
- v-if="selectConfig?.multiple && selectConfig.showCount"
526
+ v-if="staticConfig?.selectable && staticConfig.showCount"
506
527
  class="w-full text-slate-5 pl-4"
507
528
  >
508
529
  已选:{{ selectedRowKeys.length }}
@@ -52,7 +52,10 @@
52
52
  { content: '复制', code: 'copy' },
53
53
  { content: '删除', code: 'delete' },
54
54
  ];
55
- const getPopupContainer = () => rootRef.value?.$el ?? document.body;
55
+ const getPopupContainer = (el) =>
56
+ el?.parentElement?.parentElement?.parentElement?.parentElement?.parentElement?.parentElement ??
57
+ rootRef.value?.$el ??
58
+ document.body;
56
59
  // 实际是否强制渲染
57
60
  const fr = computed(() => {
58
61
  return props.forceRender || model.value.length <= 5;