@qin-ui/antd-vue-pro 2.5.2 → 2.6.0

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 (48) hide show
  1. package/AI-CONTEXT.md +30 -10
  2. package/api.json +24 -4
  3. package/es/antd-vue-pro.css +6 -6
  4. package/es/components/component-provider/types/index.d.ts +1 -1
  5. package/es/components/component-provider/types/index.d.ts.map +1 -1
  6. package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -1
  7. package/es/components/form/components/BaseFormItem/index.vue.d.ts +59 -11
  8. package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -1
  9. package/es/components/form/components/BaseFormItems/index.vue.d.ts +16 -0
  10. package/es/components/form/components/BaseFormItems/index.vue.d.ts.map +1 -0
  11. package/es/components/form/components/index.d.ts +6 -6
  12. package/es/components/form/components/index.d.ts.map +1 -1
  13. package/es/components/form/hooks/useGroupFieldAttrs.d.ts +13 -3
  14. package/es/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -1
  15. package/es/components/form/utils/fieldKey.d.ts +12 -0
  16. package/es/components/form/utils/fieldKey.d.ts.map +1 -1
  17. package/es/components/table/components/ProTable.vue.d.ts +3 -1
  18. package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
  19. package/es/components/table/components/TableEllipsisTooltip.vue.d.ts +19 -0
  20. package/es/components/table/components/TableEllipsisTooltip.vue.d.ts.map +1 -0
  21. package/es/components/table/hooks/useEllipsisTooltip.d.ts +45 -0
  22. package/es/components/table/hooks/useEllipsisTooltip.d.ts.map +1 -0
  23. package/es/components/table/hooks/useEllipsisTooltipColumns.d.ts +19 -0
  24. package/es/components/table/hooks/useEllipsisTooltipColumns.d.ts.map +1 -0
  25. package/es/components/table/index.d.ts +1 -1
  26. package/es/components/table/index.d.ts.map +1 -1
  27. package/es/components/table/types/index.d.ts +46 -2
  28. package/es/components/table/types/index.d.ts.map +1 -1
  29. package/es/index.js +718 -228
  30. package/es/index.js.map +1 -1
  31. package/es/shared/ui/index.d.ts +2 -1
  32. package/es/shared/ui/index.d.ts.map +1 -1
  33. package/package.json +2 -2
  34. package/src/components/component-provider/types/index.ts +1 -0
  35. package/src/components/form/components/BaseField/index.vue +30 -9
  36. package/src/components/form/components/BaseFormItem/index.vue +153 -186
  37. package/src/components/form/components/BaseFormItems/index.vue +186 -0
  38. package/src/components/form/components/ProForm/index.vue +5 -5
  39. package/src/components/form/components/index.ts +6 -6
  40. package/src/components/form/hooks/useGroupFieldAttrs.ts +114 -88
  41. package/src/components/form/utils/fieldKey.ts +63 -0
  42. package/src/components/table/components/ProTable.vue +128 -56
  43. package/src/components/table/components/TableEllipsisTooltip.vue +90 -0
  44. package/src/components/table/hooks/useEllipsisTooltip.ts +244 -0
  45. package/src/components/table/hooks/useEllipsisTooltipColumns.ts +139 -0
  46. package/src/components/table/index.ts +7 -1
  47. package/src/components/table/types/index.ts +62 -2
  48. package/src/shared/ui/index.ts +2 -0
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./antd-vue-pro.css";
2
- import { defineComponent, createBlock, renderSlot, openBlock, resolveDynamicComponent, normalizeProps, mergeProps, withCtx, createElementBlock, Fragment, createTextVNode, toDisplayString, inject, computed, toValue, ref, createCommentVNode, createSlots, renderList, createVNode, toRaw, resolveComponent, unref, provide, useSlots, shallowRef, onUpdated, triggerRef, createElementVNode, withModifiers, normalizeStyle, nextTick, mergeModels, useModel, watch, getCurrentInstance, onMounted, normalizeClass, guardReactiveProps } from "vue";
3
- import { Transfer, TreeSelect, Slider, Switch, RadioGroup, CheckboxGroup, TimePicker, RangePicker, DatePicker, Cascader, Select, InputNumber, InputPassword, InputSearch, Textarea, Input, Row, Col, FormItem, Form, Space, Button, theme, Dropdown, Menu, MenuItem, Checkbox, MenuDivider, Table } from "ant-design-vue";
4
- import { useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, useReactiveAttrs, cloneDeep, getObject, InjectionFormSlotsKey, isPlainObject, resolveFieldIdentity, isObjectItem, toPath, createFormProxy, InjectionFormKey, omitBy, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, useSearchFormExpand, pick, isPromise, useTable as useTable$1, omit } from "@qin-ui/pro-components-core";
2
+ import { defineComponent, createBlock, renderSlot, openBlock, resolveDynamicComponent, normalizeProps, mergeProps, withCtx, createElementBlock, Fragment, createTextVNode, toDisplayString, inject, computed, toValue, ref, onBeforeUnmount, createCommentVNode, createSlots, renderList, createVNode, watch, h, toRaw, unref, provide, useSlots, shallowRef, onUpdated, triggerRef, createElementVNode, withModifiers, normalizeStyle, nextTick, mergeModels, useModel, useAttrs, Teleport, onDeactivated, onMounted, getCurrentInstance, normalizeClass, guardReactiveProps } from "vue";
3
+ import { Transfer, TreeSelect, Slider, Switch, RadioGroup, CheckboxGroup, TimePicker, RangePicker, DatePicker, Cascader, Select, InputNumber, InputPassword, InputSearch, Textarea, Input, FormItem, Col, Row, Form, Space, Button, theme, Dropdown, Menu, MenuItem, Checkbox, MenuDivider, Tooltip, Table } from "ant-design-vue";
4
+ import { useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, useReactiveAttrs, cloneDeep, getObject, InjectionFormSlotsKey, isPlainObject, resolveFieldIdentity, toPath, isObjectItem, InjectionFormKey, createFormProxy, omitBy, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, useSearchFormExpand, pick, isPromise, useTable as useTable$1, omit } from "@qin-ui/pro-components-core";
5
5
  import { enUS as enUS2, useFormData, zhCN as zhCN2, zhTW as zhTW2 } from "@qin-ui/pro-components-core";
6
6
  import { useConfigContextInject } from "ant-design-vue/es/config-provider/context";
7
7
  import { useInjectFormItemContext, useProvideFormItemContext } from "ant-design-vue/es/form/FormItemContext";
@@ -154,7 +154,7 @@ const ensureInjectConfig = (key) => {
154
154
  DYNAMIC_INJECT_CONFIG[key] = created;
155
155
  return created;
156
156
  };
157
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
157
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
158
158
  ...{ name: "ContainerFragment", inheritAttrs: false },
159
159
  __name: "index",
160
160
  props: {
@@ -172,7 +172,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
172
172
  };
173
173
  }
174
174
  });
175
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
175
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
176
176
  ...{ name: "SlotComponent", inheritAttrs: false },
177
177
  __name: "index",
178
178
  props: {
@@ -265,7 +265,7 @@ const useLocale = () => {
265
265
  };
266
266
  return { t, lang };
267
267
  };
268
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
268
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
269
269
  ...{ name: "BaseField", inheritAttrs: false },
270
270
  __name: "index",
271
271
  props: {
@@ -278,6 +278,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
278
278
  // 原始值直接传递,引用值克隆快照
279
279
  typeof val === "object" && val !== null ? cloneDeep(val) : val
280
280
  );
281
+ const isSameValue = (a, b) => a === b || a !== a && b !== b;
281
282
  const props = __props;
282
283
  const { t } = useLocale();
283
284
  const form = useForm(false);
@@ -291,9 +292,21 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
291
292
  },
292
293
  clearValidate: formItemContext.clearValidate
293
294
  });
295
+ let pendingChange = false;
296
+ let pendingChangeValue;
294
297
  const triggerFormItemChange = (value2) => {
295
- emit("field-value-change", value2);
298
+ pendingChangeValue = value2;
299
+ if (pendingChange) return;
300
+ pendingChange = true;
301
+ queueMicrotask(() => {
302
+ if (!pendingChange) return;
303
+ pendingChange = false;
304
+ emit("field-value-change", pendingChangeValue);
305
+ });
296
306
  };
307
+ onBeforeUnmount(() => {
308
+ pendingChange = false;
309
+ });
297
310
  const attrs = useReactiveAttrs();
298
311
  const pickerVal = attrs.picker;
299
312
  const injectConfigKey = typeof props.component === "string" ? [props.component, pickerVal].filter(Boolean).join(".") : "";
@@ -315,12 +328,17 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
315
328
  let newVal = val;
316
329
  const { valueFormatter } = groupedAttrs.value;
317
330
  const setFormatter = typeof valueFormatter === "function" ? valueFormatter : typeof valueFormatter === "object" && typeof (valueFormatter == null ? void 0 : valueFormatter.set) === "function" ? valueFormatter.set : void 0;
331
+ const oldVal = (_a = form.getFormData) == null ? void 0 : _a.call(form, props.path);
318
332
  if (setFormatter) {
319
- const oldVal = setFormatter.length > 1 ? cloneDeepIfObject((_a = form.getFormData) == null ? void 0 : _a.call(form, props.path)) : void 0;
320
- newVal = setFormatter(val, oldVal);
333
+ newVal = setFormatter(
334
+ val,
335
+ setFormatter.length > 1 ? cloneDeepIfObject(oldVal) : void 0
336
+ );
337
+ }
338
+ if (!isSameValue(newVal, oldVal)) {
339
+ (_b = form.setFormData) == null ? void 0 : _b.call(form, props.path, newVal);
340
+ triggerFormItemChange(newVal);
321
341
  }
322
- (_b = form.setFormData) == null ? void 0 : _b.call(form, props.path, newVal);
323
- triggerFormItemChange(newVal);
324
342
  const { onUpdateValue } = groupedAttrs.value;
325
343
  if (typeof onUpdateValue === "function") {
326
344
  onUpdateValue(val);
@@ -378,7 +396,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
378
396
  getComponentComputedProps: () => groupedAttrs.value.attrs
379
397
  });
380
398
  return (_ctx, _cache) => {
381
- return openBlock(), createBlock(_sfc_main$e, {
399
+ return openBlock(), createBlock(_sfc_main$g, {
382
400
  component: groupedAttrs.value.componentContainer,
383
401
  path: props.path
384
402
  }, {
@@ -394,7 +412,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
394
412
  return {
395
413
  name,
396
414
  fn: withCtx((scoped) => [
397
- createVNode(_sfc_main$d, mergeProps({
415
+ createVNode(_sfc_main$f, mergeProps({
398
416
  path: props.path
399
417
  }, scoped, { component: slot }), null, 16, ["path", "component"])
400
418
  ])
@@ -407,8 +425,206 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
407
425
  };
408
426
  }
409
427
  });
428
+ const formItemPropKeys = Object.keys(formItemProps()).concat([
429
+ "formItemContainer"
430
+ ]);
431
+ const gridItemPropKeys = Object.keys(colProps());
432
+ const gridItemPropKeySet = new Set(gridItemPropKeys);
433
+ const formItemPropKeySet = new Set(formItemPropKeys);
434
+ const formItemSlotKeySet = new Set(FORM_ITEM_SLOT_KEYS);
435
+ const groupField = (field, rawInject) => {
436
+ let gridItemProps2 = {};
437
+ let formItemProps2 = {};
438
+ const componentProps = { slots: {} };
439
+ const formItemSlots = {};
440
+ if (isPlainObject(field)) {
441
+ const { path: _path, name: _name, fields, formItemClass, formItemStyle, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, formItemContainer, ...rest } = field;
442
+ const { class: injectClassName, style: injectStyle, span: injectSpan, xs, sm, md, lg, xl, xxl, formItemContainer: injectFormItemContainer, ...injectRest } = rawInject;
443
+ const initGridItemProps = span || span === 0 ? { span } : { xs, sm, md, lg, xl, xxl, span: injectSpan };
444
+ gridItemProps2 = fields ? { ...initGridItemProps, span: span ?? 24 } : initGridItemProps;
445
+ const container = formItemContainer ?? injectFormItemContainer;
446
+ formItemProps2 = mergeProps(
447
+ injectRest,
448
+ { class: injectClassName, style: injectStyle },
449
+ { class: toValue(formItemClass), style: toValue(formItemStyle) },
450
+ formItemDataAttrs
451
+ );
452
+ Object.keys(rest).forEach((k) => {
453
+ if (gridItemPropKeySet.has(k)) {
454
+ gridItemProps2[k] = rest[k];
455
+ } else if (formItemPropKeySet.has(k)) {
456
+ formItemProps2[k] = rest[k];
457
+ } else {
458
+ componentProps[k] = rest[k];
459
+ }
460
+ });
461
+ Object.assign(componentProps, componentDataAttrs);
462
+ Object.keys(slots).forEach((k) => {
463
+ if (formItemSlotKeySet.has(k)) {
464
+ formItemSlots[k] = slots[k];
465
+ } else {
466
+ componentProps.slots[k] = slots[k];
467
+ }
468
+ });
469
+ if (formItemSlots.label && formItemProps2.label !== void 0) {
470
+ delete formItemProps2.label;
471
+ }
472
+ return {
473
+ path: resolveFieldIdentity(field),
474
+ gridItemProps: gridItemProps2,
475
+ formItemProps: formItemProps2,
476
+ formItemSlots,
477
+ componentProps,
478
+ formItemContainer: container,
479
+ rawField: field
480
+ };
481
+ }
482
+ return {
483
+ path: resolveFieldIdentity(field),
484
+ gridItemProps: gridItemProps2,
485
+ formItemProps: formItemProps2,
486
+ formItemSlots,
487
+ componentProps,
488
+ rawField: field
489
+ };
490
+ };
491
+ function useGroupedField(field) {
492
+ const config = INJECT_CONFIG["pro-form-item"];
493
+ const injectFormItemProps = inject(config.injectionKey, config.default);
494
+ return computed(
495
+ () => groupField(toValue(field), toValue(injectFormItemProps) || {})
496
+ );
497
+ }
498
+ const _sfc_main$d = defineComponent({
499
+ name: "BaseFormItem",
500
+ inheritAttrs: false,
501
+ props: {
502
+ /** 字段配置 */
503
+ field: { type: Object, required: true },
504
+ /** 是否启用网格布局 */
505
+ grid: {
506
+ type: [Boolean, Object],
507
+ default: void 0
508
+ },
509
+ /** 上层下发的禁用状态 */
510
+ disabled: { type: Boolean, default: void 0 },
511
+ /** FormItem 实例登记回调 */
512
+ setFormItemRef: {
513
+ type: Function,
514
+ default: void 0
515
+ },
516
+ /** 控件实例登记回调 */
517
+ setComponentRef: {
518
+ type: Function,
519
+ default: void 0
520
+ }
521
+ },
522
+ setup(props) {
523
+ const grouped = useGroupedField(() => props.field);
524
+ const enableGrid = computed(() => !!props.grid);
525
+ const componentKey = computed(() => {
526
+ const field = props.field;
527
+ const component = toValue(field.component);
528
+ if (typeof component !== "string") return "component-object";
529
+ return `string:${component}:${toValue(field.picker) ?? ""}`;
530
+ });
531
+ let formItemInstance;
532
+ const setItemRef = (el) => {
533
+ var _a;
534
+ formItemInstance = el;
535
+ (_a = props.setFormItemRef) == null ? void 0 : _a.call(
536
+ props,
537
+ props.field,
538
+ el,
539
+ () => grouped.value.formItemProps
540
+ );
541
+ };
542
+ const setFieldRef = (el) => {
543
+ var _a;
544
+ (_a = props.setComponentRef) == null ? void 0 : _a.call(props, props.field, el);
545
+ };
546
+ watch(
547
+ () => props.field,
548
+ (next, prev) => {
549
+ var _a, _b;
550
+ if (!prev || prev === next) return;
551
+ (_a = props.setFormItemRef) == null ? void 0 : _a.call(props, prev, null, () => grouped.value.formItemProps);
552
+ (_b = props.setComponentRef) == null ? void 0 : _b.call(props, prev, null);
553
+ },
554
+ { flush: "pre" }
555
+ );
556
+ const onFieldValueChange = () => {
557
+ var _a, _b;
558
+ if (((_a = grouped.value.formItemProps) == null ? void 0 : _a.autoLink) === false) return;
559
+ (_b = formItemInstance == null ? void 0 : formItemInstance.onFieldChange) == null ? void 0 : _b.call(formItemInstance);
560
+ };
561
+ const withContainer = (node, component, containerProps) => component ? h(component, containerProps, { default: () => node }) : node;
562
+ const renderFormItemSlots = (groupedField) => {
563
+ const slots = {};
564
+ Object.entries(groupedField.formItemSlots).forEach(([name, slot]) => {
565
+ slots[name] = (scope) => h(_sfc_main$f, {
566
+ path: groupedField.path,
567
+ component: slot,
568
+ ...scope || {}
569
+ });
570
+ });
571
+ slots.default = () => {
572
+ const field = props.field;
573
+ if (field.fields) {
574
+ return h(_sfc_main$c, {
575
+ grid: field.grid ?? props.grid,
576
+ fields: field.fields,
577
+ disabled: toValue(field.disabled)
578
+ });
579
+ }
580
+ return h(_sfc_main$e, {
581
+ key: componentKey.value,
582
+ ref: setFieldRef,
583
+ ...groupedField.componentProps,
584
+ path: groupedField.path,
585
+ onFieldValueChange
586
+ });
587
+ };
588
+ return slots;
589
+ };
590
+ return () => {
591
+ const groupedField = grouped.value;
592
+ let node = h(
593
+ FormItem,
594
+ {
595
+ ...groupedField.formItemProps,
596
+ ref: setItemRef,
597
+ name: toPath(groupedField.path),
598
+ path: groupedField.path
599
+ },
600
+ renderFormItemSlots(groupedField)
601
+ );
602
+ node = withContainer(node, groupedField.formItemContainer, {
603
+ path: groupedField.path
604
+ });
605
+ node = withContainer(
606
+ node,
607
+ enableGrid.value ? Col : void 0,
608
+ groupedField.gridItemProps
609
+ );
610
+ return node;
611
+ };
612
+ }
613
+ });
410
614
  const fieldKeyMap = /* @__PURE__ */ new WeakMap();
411
615
  let fieldKeySeed = 0;
616
+ const rowKeyMap = /* @__PURE__ */ new WeakMap();
617
+ let rowKeySeed = 0;
618
+ const getRowKey = (row) => {
619
+ const raw = toRaw(row);
620
+ let key = rowKeyMap.get(raw);
621
+ if (key === void 0) {
622
+ key = ++rowKeySeed;
623
+ rowKeyMap.set(raw, key);
624
+ }
625
+ return key;
626
+ };
627
+ const isIndexSegment = (segment) => /^(?:0|[1-9]\d*)$/.test(segment);
412
628
  const getFieldKey = (field) => {
413
629
  if (field === null || typeof field !== "object")
414
630
  return `raw_${String(field)}`;
@@ -420,82 +636,35 @@ const getFieldKey = (field) => {
420
636
  }
421
637
  return key;
422
638
  };
423
- const formItemPropKeys = Object.keys(formItemProps()).concat([
424
- "formItemContainer"
425
- ]);
426
- const gridItemPropKeys = Object.keys(colProps());
427
- const gridItemPropKeySet = new Set(gridItemPropKeys);
428
- const formItemPropKeySet = new Set(formItemPropKeys);
429
- const formItemSlotKeySet = new Set(FORM_ITEM_SLOT_KEYS);
430
- function useGroupFieldAttrs(validFields) {
431
- const config = INJECT_CONFIG["pro-form-item"];
432
- const injectFormItemProps = inject(config.injectionKey, config.default);
433
- return computed(() => {
434
- const rawInject = toValue(injectFormItemProps) || {};
435
- return validFields.value.map((field) => {
436
- let gridItemProps2 = {};
437
- let formItemProps2 = {};
438
- const componentProps = { slots: {} };
439
- const formItemSlots = {};
440
- if (isPlainObject(field)) {
441
- const { path: _path, name: _name, fields, formItemClass, formItemStyle, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, formItemContainer, ...rest } = field;
442
- const { class: injectClassName, style: injectStyle, span: injectSpan, xs, sm, md, lg, xl, xxl, formItemContainer: injectFormItemContainer, ...injectRest } = rawInject;
443
- const initGridItemProps = span || span === 0 ? { span } : { xs, sm, md, lg, xl, xxl, span: injectSpan };
444
- gridItemProps2 = fields ? { ...initGridItemProps, span: span ?? 24 } : initGridItemProps;
445
- const container = formItemContainer ?? injectFormItemContainer;
446
- formItemProps2 = mergeProps(
447
- injectRest,
448
- { class: injectClassName, style: injectStyle },
449
- { class: toValue(formItemClass), style: toValue(formItemStyle) },
450
- formItemDataAttrs
451
- );
452
- Object.keys(rest).forEach((k) => {
453
- if (gridItemPropKeySet.has(k)) {
454
- gridItemProps2[k] = rest[k];
455
- } else if (formItemPropKeySet.has(k)) {
456
- formItemProps2[k] = rest[k];
457
- } else {
458
- componentProps[k] = rest[k];
459
- }
460
- });
461
- Object.assign(componentProps, componentDataAttrs);
462
- Object.keys(slots).forEach((k) => {
463
- if (formItemSlotKeySet.has(k)) {
464
- formItemSlots[k] = slots[k];
465
- } else {
466
- componentProps.slots[k] = slots[k];
467
- }
468
- });
469
- if (formItemSlots.label && formItemProps2.label !== void 0) {
470
- delete formItemProps2.label;
471
- }
472
- const raw2 = resolveFieldIdentity(field);
473
- return {
474
- path: raw2,
475
- gridItemProps: gridItemProps2,
476
- formItemProps: formItemProps2,
477
- formItemSlots,
478
- componentProps,
479
- formItemContainer: container,
480
- rawField: field,
481
- renderKey: getFieldKey(field)
482
- };
483
- }
484
- const raw = resolveFieldIdentity(field);
485
- return {
486
- path: raw,
487
- gridItemProps: gridItemProps2,
488
- formItemProps: formItemProps2,
489
- formItemSlots,
490
- componentProps,
491
- rawField: field,
492
- renderKey: getFieldKey(field)
493
- };
494
- });
495
- });
496
- }
497
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
498
- ...{ name: "BaseFormItem", inheritAttrs: false },
639
+ const getFieldDataKey = (field, rawFormData) => {
640
+ const path = resolveFieldIdentity(field);
641
+ if (!path || rawFormData === null || rawFormData === void 0) {
642
+ return getFieldKey(field);
643
+ }
644
+ const segments = toPath(path);
645
+ let node = rawFormData;
646
+ const rowIds = [];
647
+ let lastRowIndex = -1;
648
+ for (let i = 0; i < segments.length; i++) {
649
+ if (Array.isArray(node)) {
650
+ const segment = segments[i];
651
+ if (!isIndexSegment(segment)) break;
652
+ const element = node[Number(segment)];
653
+ if (element === null || typeof element !== "object") break;
654
+ rowIds.push(getRowKey(toRaw(element)));
655
+ lastRowIndex = i;
656
+ node = element;
657
+ continue;
658
+ }
659
+ if (node === null || typeof node !== "object") break;
660
+ node = node[segments[i]];
661
+ }
662
+ if (lastRowIndex === -1) return getFieldKey(field);
663
+ const rest = segments.slice(lastRowIndex + 1).join(".");
664
+ return `data:${rowIds.join("/")}:${rest}`;
665
+ };
666
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
667
+ ...{ name: "BaseFormItems", inheritAttrs: false },
499
668
  __name: "index",
500
669
  props: {
501
670
  grid: { type: [Boolean, Object], default: void 0 },
@@ -512,6 +681,20 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
512
681
  )
513
682
  )
514
683
  );
684
+ const injectedForm = inject(InjectionFormKey, void 0);
685
+ const renderedFields = computed(() => {
686
+ const rawFormData = (injectedForm == null ? void 0 : injectedForm.formData) ? toRaw(injectedForm.formData) : void 0;
687
+ const seen = /* @__PURE__ */ new Map();
688
+ return validFields.value.map((field) => {
689
+ const baseKey = getFieldDataKey(field, rawFormData);
690
+ const count = seen.get(baseKey) ?? 0;
691
+ seen.set(baseKey, count + 1);
692
+ return {
693
+ field,
694
+ key: count === 0 ? baseKey : `${String(baseKey)}#${count}`
695
+ };
696
+ });
697
+ });
515
698
  useProviderDisabled(computed(() => props.disabled));
516
699
  const config = INJECT_CONFIG["pro-form"];
517
700
  const injectFormConfig = inject(config.injectionKey, config.default);
@@ -545,20 +728,14 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
545
728
  }
546
729
  }
547
730
  };
548
- const onFieldValueChange = (item) => {
549
- var _a, _b;
550
- if (((_a = item.formItemProps) == null ? void 0 : _a.autoLink) === false) return;
551
- const instance = formItemInstanceMap.get(toRaw(item.rawField));
552
- (_b = instance == null ? void 0 : instance.onFieldChange) == null ? void 0 : _b.call(instance);
553
- };
554
- const setFormItemRef = (field, el, formItemProps2) => {
731
+ const setFormItemRef = (field, el, getFormItemProps) => {
555
732
  if (!field || typeof field !== "object") return;
556
733
  const raw = toRaw(field);
557
734
  if (el) {
558
735
  formItemInstanceMap.set(raw, el);
559
736
  defineFieldAccessors(raw, {
560
737
  getFormItemRef: () => formItemInstanceMap.get(raw),
561
- getFormItemComputedProps: () => formItemProps2
738
+ getFormItemComputedProps: getFormItemProps
562
739
  });
563
740
  } else {
564
741
  formItemInstanceMap.delete(raw);
@@ -587,73 +764,35 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
587
764
  delete raw.getComponentComputedProps;
588
765
  }
589
766
  };
590
- const groupedFields = useGroupFieldAttrs(validFields);
591
767
  return (_ctx, _cache) => {
592
- const _component_BaseFormItem = resolveComponent("BaseFormItem");
593
- return openBlock(), createBlock(_sfc_main$e, mergeProps({
594
- component: enableGrid.value ? unref(Row) : void 0
595
- }, computedGridProps.value), {
768
+ return enableGrid.value ? (openBlock(), createBlock(unref(Row), normalizeProps(mergeProps({ key: 0 }, computedGridProps.value)), {
596
769
  default: withCtx(() => [
597
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(groupedFields), (item) => {
598
- return openBlock(), createBlock(_sfc_main$e, mergeProps({
599
- key: item.renderKey,
600
- component: enableGrid.value ? unref(Col) : void 0
601
- }, { ref_for: true }, item.gridItemProps), {
602
- default: withCtx(() => [
603
- createVNode(_sfc_main$e, {
604
- component: item.formItemContainer,
605
- path: item.path
606
- }, {
607
- default: withCtx(() => [
608
- createVNode(unref(FormItem), mergeProps({ ref_for: true }, item.formItemProps, {
609
- ref_for: true,
610
- ref: (el) => setFormItemRef(item.rawField, el, item.formItemProps),
611
- name: unref(toPath)(item.path),
612
- path: item.path
613
- }), createSlots({
614
- default: withCtx(() => [
615
- item.rawField.fields ? (openBlock(), createBlock(_component_BaseFormItem, {
616
- key: 0,
617
- grid: item.rawField.grid ?? props.grid,
618
- fields: item.rawField.fields,
619
- disabled: toValue(item.rawField.disabled)
620
- }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(_sfc_main$c, mergeProps({
621
- key: 1,
622
- ref_for: true,
623
- ref: (el) => setComponentRef(item.rawField, el)
624
- }, { ref_for: true }, item.componentProps, {
625
- path: item.path,
626
- onFieldValueChange: ($event) => onFieldValueChange(item)
627
- }), null, 16, ["path", "onFieldValueChange"]))
628
- ]),
629
- _: 2
630
- }, [
631
- renderList(item.formItemSlots, (slot, name) => {
632
- return {
633
- name,
634
- fn: withCtx((scoped) => [
635
- createVNode(_sfc_main$d, mergeProps({
636
- path: item.path,
637
- component: slot
638
- }, { ref_for: true }, scoped), null, 16, ["path", "component"])
639
- ])
640
- };
641
- })
642
- ]), 1040, ["name", "path"])
643
- ]),
644
- _: 2
645
- }, 1032, ["component", "path"])
646
- ]),
647
- _: 2
648
- }, 1040, ["component"]);
770
+ (openBlock(true), createElementBlock(Fragment, null, renderList(renderedFields.value, (item) => {
771
+ return openBlock(), createBlock(_sfc_main$d, {
772
+ key: item.key,
773
+ field: item.field,
774
+ grid: props.grid,
775
+ disabled: props.disabled,
776
+ "set-form-item-ref": setFormItemRef,
777
+ "set-component-ref": setComponentRef
778
+ }, null, 8, ["field", "grid", "disabled"]);
649
779
  }), 128))
650
780
  ]),
651
781
  _: 1
652
- }, 16, ["component"]);
782
+ }, 16)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(renderedFields.value, (item) => {
783
+ return openBlock(), createBlock(_sfc_main$d, {
784
+ key: item.key,
785
+ field: item.field,
786
+ grid: props.grid,
787
+ disabled: props.disabled,
788
+ "set-form-item-ref": setFormItemRef,
789
+ "set-component-ref": setComponentRef
790
+ }, null, 8, ["field", "grid", "disabled"]);
791
+ }), 128));
653
792
  };
654
793
  }
655
794
  });
656
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
795
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
657
796
  ...{ name: "ProForm", inheritAttrs: false },
658
797
  __name: "index",
659
798
  props: {
@@ -716,7 +855,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
716
855
  model: formData.value
717
856
  }, formAttrs.value, { class: "pro-form" }), {
718
857
  default: withCtx(() => [
719
- createVNode(_sfc_main$b, {
858
+ createVNode(_sfc_main$c, {
720
859
  fields: fields.value,
721
860
  grid: props.grid
722
861
  }, null, 8, ["fields", "grid"]),
@@ -740,7 +879,7 @@ const _export_sfc = (sfc, props) => {
740
879
  }
741
880
  return target;
742
881
  };
743
- const _sfc_main$9 = {};
882
+ const _sfc_main$a = {};
744
883
  const _hoisted_1$3 = {
745
884
  focusable: "false",
746
885
  "data-icon": "down",
@@ -755,8 +894,8 @@ function _sfc_render$2(_ctx, _cache) {
755
894
  createElementVNode("path", { d: "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" }, null, -1)
756
895
  ])]);
757
896
  }
758
- const DownOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$2]]);
759
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
897
+ const DownOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$2]]);
898
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
760
899
  ...{ name: "SearchForm" },
761
900
  __name: "SearchForm",
762
901
  props: {
@@ -814,7 +953,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
814
953
  emitSearch();
815
954
  };
816
955
  return (_ctx, _cache) => {
817
- return openBlock(), createBlock(_sfc_main$a, mergeProps(layoutProps.value, {
956
+ return openBlock(), createBlock(_sfc_main$b, mergeProps(layoutProps.value, {
818
957
  form: props.form,
819
958
  class: "pro-table_search-form transition",
820
959
  onSubmit: withModifiers(onSearchSubmit, ["prevent"])
@@ -895,8 +1034,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
895
1034
  };
896
1035
  }
897
1036
  });
898
- const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-bf6cca54"]]);
899
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1037
+ const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-bf6cca54"]]);
1038
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
900
1039
  __name: "DefaultSearchFormContainer",
901
1040
  setup(__props) {
902
1041
  const { token } = theme.useToken();
@@ -910,8 +1049,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
910
1049
  };
911
1050
  }
912
1051
  });
913
- const DefaultSearchFormContainer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-570a1898"]]);
914
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1052
+ const DefaultSearchFormContainer = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-570a1898"]]);
1053
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
915
1054
  __name: "DefaultTableContainer",
916
1055
  setup(__props) {
917
1056
  const { token } = theme.useToken();
@@ -925,8 +1064,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
925
1064
  };
926
1065
  }
927
1066
  });
928
- const DefaultTableContainer = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-e5c97b2f"]]);
929
- const _sfc_main$5 = {};
1067
+ const DefaultTableContainer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-e5c97b2f"]]);
1068
+ const _sfc_main$6 = {};
930
1069
  const _hoisted_1$2 = {
931
1070
  focusable: "false",
932
1071
  "data-icon": "column-height",
@@ -941,8 +1080,8 @@ function _sfc_render$1(_ctx, _cache) {
941
1080
  createElementVNode("path", { d: "M840 836H184c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h656c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm0-724H184c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h656c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM610.8 378c6 0 9.4-7 5.7-11.7L515.7 238.7a7.14 7.14 0 00-11.3 0L403.6 366.3a7.23 7.23 0 005.7 11.7H476v268h-62.8c-6 0-9.4 7-5.7 11.7l100.8 127.5c2.9 3.7 8.5 3.7 11.3 0l100.8-127.5c3.7-4.7.4-11.7-5.7-11.7H548V378h62.8z" }, null, -1)
942
1081
  ])]);
943
1082
  }
944
- const ColumnHeightOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$1]]);
945
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1083
+ const ColumnHeightOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$1]]);
1084
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
946
1085
  __name: "SizeControl",
947
1086
  props: /* @__PURE__ */ mergeModels({
948
1087
  effectiveSize: { default: void 0 }
@@ -999,8 +1138,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
999
1138
  };
1000
1139
  }
1001
1140
  });
1002
- const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-950f061f"]]);
1003
- const _sfc_main$3 = {};
1141
+ const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-950f061f"]]);
1142
+ const _sfc_main$4 = {};
1004
1143
  const _hoisted_1$1 = {
1005
1144
  focusable: "false",
1006
1145
  "data-icon": "filter",
@@ -1015,8 +1154,8 @@ function _sfc_render(_ctx, _cache) {
1015
1154
  createElementVNode("path", { d: "M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z" }, null, -1)
1016
1155
  ])]);
1017
1156
  }
1018
- const FilterOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
1019
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1157
+ const FilterOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render]]);
1158
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1020
1159
  __name: "ColumnControl",
1021
1160
  props: {
1022
1161
  columns: {},
@@ -1181,7 +1320,303 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1181
1320
  };
1182
1321
  }
1183
1322
  });
1184
- const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-58650608"]]);
1323
+ const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-58650608"]]);
1324
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1325
+ ...{ name: "TableEllipsisTooltip", inheritAttrs: false },
1326
+ __name: "TableEllipsisTooltip",
1327
+ props: {
1328
+ open: { type: Boolean, default: false },
1329
+ content: { default: "" },
1330
+ anchorStyle: { default: () => ({
1331
+ position: "fixed",
1332
+ pointerEvents: "none",
1333
+ opacity: 0
1334
+ }) },
1335
+ container: { type: Function, default: () => void 0 }
1336
+ },
1337
+ setup(__props) {
1338
+ const props = __props;
1339
+ const attrs = useAttrs();
1340
+ const HostTooltip = Tooltip;
1341
+ const tooltipRef = ref(null);
1342
+ const forceAlign = async () => {
1343
+ var _a;
1344
+ if (!props.open) return;
1345
+ await nextTick();
1346
+ const instance = tooltipRef.value;
1347
+ (_a = (instance == null ? void 0 : instance.forceAlign) ?? (instance == null ? void 0 : instance.forcePopupAlign)) == null ? void 0 : _a();
1348
+ };
1349
+ watch(() => props.anchorStyle, forceAlign, { deep: true });
1350
+ watch(
1351
+ () => props.open,
1352
+ (value) => {
1353
+ if (value) forceAlign();
1354
+ }
1355
+ );
1356
+ const getContainerNode = () => {
1357
+ var _a;
1358
+ const container = (_a = props.container) == null ? void 0 : _a.call(props);
1359
+ if (container) return container;
1360
+ return typeof document !== "undefined" ? document.body : void 0;
1361
+ };
1362
+ const getPopupContainer2 = () => getContainerNode() ?? document.body;
1363
+ return (_ctx, _cache) => {
1364
+ return openBlock(), createBlock(Teleport, {
1365
+ to: getContainerNode() ?? "body"
1366
+ }, [
1367
+ createVNode(unref(HostTooltip), mergeProps(unref(attrs), {
1368
+ ref_key: "tooltipRef",
1369
+ ref: tooltipRef,
1370
+ open: __props.open,
1371
+ title: __props.content,
1372
+ trigger: [],
1373
+ "get-popup-container": getPopupContainer2
1374
+ }), {
1375
+ default: withCtx(() => [
1376
+ createElementVNode("span", {
1377
+ class: "pro-table_ellipsis-tooltip-anchor",
1378
+ style: normalizeStyle(__props.anchorStyle),
1379
+ "aria-hidden": "true"
1380
+ }, null, 4)
1381
+ ]),
1382
+ _: 1
1383
+ }, 16, ["open", "title"])
1384
+ ], 8, ["to"]);
1385
+ };
1386
+ }
1387
+ });
1388
+ const ELLIPSIS_TOOLTIP_CELL_ATTR = "data-pro-table-ellipsis";
1389
+ const PRO_TABLE_ROOT_ATTR = "data-pro-table-root";
1390
+ const ANCHOR_BASE_STYLE = {
1391
+ position: "fixed",
1392
+ pointerEvents: "none",
1393
+ opacity: 0
1394
+ };
1395
+ const getCellText = (cell) => {
1396
+ const text = cell.innerText || cell.textContent || "";
1397
+ return text.replace(/\s+/g, " ").trim();
1398
+ };
1399
+ const measureCell = (cell) => {
1400
+ const text = getCellText(cell);
1401
+ return {
1402
+ text,
1403
+ overflow: Boolean(text) && cell.scrollWidth > cell.clientWidth
1404
+ };
1405
+ };
1406
+ function useEllipsisTooltip(rootRef, enabled, delay, leaveDelay) {
1407
+ const open = ref(false);
1408
+ const content = ref("");
1409
+ const anchorStyle = ref({
1410
+ ...ANCHOR_BASE_STYLE
1411
+ });
1412
+ let activeCell = null;
1413
+ let pendingCell = null;
1414
+ let openTimer = null;
1415
+ let closeTimer = null;
1416
+ const clearOpenTimer = () => {
1417
+ if (openTimer === null) return;
1418
+ clearTimeout(openTimer);
1419
+ openTimer = null;
1420
+ pendingCell = null;
1421
+ };
1422
+ const clearCloseTimer = () => {
1423
+ if (closeTimer === null) return;
1424
+ clearTimeout(closeTimer);
1425
+ closeTimer = null;
1426
+ };
1427
+ const close = () => {
1428
+ clearOpenTimer();
1429
+ clearCloseTimer();
1430
+ open.value = false;
1431
+ activeCell = null;
1432
+ };
1433
+ const getEventRoot = (node) => {
1434
+ var _a;
1435
+ const element = node instanceof Element ? node : node == null ? void 0 : node.parentElement;
1436
+ return ((_a = element == null ? void 0 : element.closest) == null ? void 0 : _a.call(element, `[${PRO_TABLE_ROOT_ATTR}]`)) ?? null;
1437
+ };
1438
+ const getCellFromEvent = (event) => {
1439
+ var _a;
1440
+ const target = event.target;
1441
+ const cell = (_a = target == null ? void 0 : target.closest) == null ? void 0 : _a.call(target, `[${ELLIPSIS_TOOLTIP_CELL_ATTR}]`);
1442
+ if (!(cell instanceof HTMLElement)) return null;
1443
+ const root = rootRef.value;
1444
+ if (!root) return null;
1445
+ if (cell.closest(`[${PRO_TABLE_ROOT_ATTR}]`) !== root) return null;
1446
+ return cell;
1447
+ };
1448
+ const onMouseOver = (event) => {
1449
+ const cell = getCellFromEvent(event);
1450
+ if (!cell) return;
1451
+ clearCloseTimer();
1452
+ if (cell === activeCell || cell === pendingCell) return;
1453
+ close();
1454
+ const measurement = measureCell(cell);
1455
+ if (!measurement.overflow) return;
1456
+ const rect = cell.getBoundingClientRect();
1457
+ if (!rect.width || !rect.height) return;
1458
+ content.value = measurement.text;
1459
+ anchorStyle.value = {
1460
+ ...ANCHOR_BASE_STYLE,
1461
+ left: `${rect.left}px`,
1462
+ top: `${rect.top}px`,
1463
+ width: `${rect.width}px`,
1464
+ height: `${rect.height}px`
1465
+ };
1466
+ pendingCell = cell;
1467
+ openTimer = setTimeout(
1468
+ () => {
1469
+ openTimer = null;
1470
+ pendingCell = null;
1471
+ if (!cell.isConnected) return;
1472
+ activeCell = cell;
1473
+ open.value = true;
1474
+ },
1475
+ Math.max(0, delay.value)
1476
+ );
1477
+ };
1478
+ const onMouseOut = (event) => {
1479
+ if (!activeCell && !pendingCell) return;
1480
+ const owner = activeCell ?? pendingCell;
1481
+ const target = event.target;
1482
+ if (!owner || !target || !owner.contains(target)) return;
1483
+ const related = event.relatedTarget;
1484
+ if (related && owner.contains(related)) {
1485
+ const relatedRoot = getEventRoot(related);
1486
+ if (!relatedRoot || relatedRoot === rootRef.value) return;
1487
+ close();
1488
+ return;
1489
+ }
1490
+ if (pendingCell) {
1491
+ close();
1492
+ return;
1493
+ }
1494
+ clearCloseTimer();
1495
+ const delayMs = Math.max(0, leaveDelay.value);
1496
+ if (delayMs === 0) {
1497
+ close();
1498
+ return;
1499
+ }
1500
+ closeTimer = setTimeout(() => {
1501
+ closeTimer = null;
1502
+ close();
1503
+ }, delayMs);
1504
+ };
1505
+ const onViewportChange = () => close();
1506
+ let listening = false;
1507
+ const addViewportListeners = () => {
1508
+ if (listening || typeof window === "undefined") return;
1509
+ listening = true;
1510
+ window.addEventListener("scroll", onViewportChange, true);
1511
+ window.addEventListener("resize", onViewportChange);
1512
+ };
1513
+ const removeViewportListeners = () => {
1514
+ if (!listening) return;
1515
+ listening = false;
1516
+ window.removeEventListener("scroll", onViewportChange, true);
1517
+ window.removeEventListener("resize", onViewportChange);
1518
+ };
1519
+ onDeactivated(close);
1520
+ onMounted(() => {
1521
+ if (enabled.value) addViewportListeners();
1522
+ });
1523
+ watch(enabled, (value) => {
1524
+ if (value) {
1525
+ addViewportListeners();
1526
+ } else {
1527
+ removeViewportListeners();
1528
+ close();
1529
+ }
1530
+ });
1531
+ onBeforeUnmount(() => {
1532
+ removeViewportListeners();
1533
+ clearOpenTimer();
1534
+ clearCloseTimer();
1535
+ });
1536
+ return {
1537
+ open,
1538
+ content,
1539
+ anchorStyle,
1540
+ onMouseOver,
1541
+ onMouseOut,
1542
+ close
1543
+ };
1544
+ }
1545
+ function useEllipsisTooltipColumns(getColumns, globalEnabled = () => false) {
1546
+ const originalColumns = /* @__PURE__ */ new WeakMap();
1547
+ const registerColumnClone = (next, source) => {
1548
+ if (next !== source && isObjectItem(next) && !originalColumns.has(next)) {
1549
+ originalColumns.set(next, source);
1550
+ }
1551
+ return next;
1552
+ };
1553
+ const resolveOriginalColumn = (column) => {
1554
+ const raw = toRaw(column);
1555
+ const source = originalColumns.get(raw) ?? raw.__originColumn__;
1556
+ if (!isObjectItem(source)) return column;
1557
+ return originalColumns.get(toRaw(source)) ?? source;
1558
+ };
1559
+ const resolveSorterColumn = (sorter) => sorter && typeof sorter === "object" && sorter.column ? { ...sorter, column: resolveOriginalColumn(sorter.column) } : sorter;
1560
+ const transformColumns = (columns, global, ancestors = /* @__PURE__ */ new Set()) => {
1561
+ const list = [];
1562
+ let changed = false;
1563
+ let hasTooltip = false;
1564
+ for (const column of columns) {
1565
+ if (!isObjectItem(column) || toValue(column.hidden)) {
1566
+ changed = true;
1567
+ continue;
1568
+ }
1569
+ let childChanged = false;
1570
+ let childColumns = column.children;
1571
+ let childHasTooltip = false;
1572
+ if (Array.isArray(column.children) && column.children.length > 0) {
1573
+ if (ancestors.has(column)) {
1574
+ changed = true;
1575
+ continue;
1576
+ }
1577
+ ancestors.add(column);
1578
+ const child = transformColumns(column.children, global, ancestors);
1579
+ ancestors.delete(column);
1580
+ childChanged = child.changed;
1581
+ childColumns = child.columns;
1582
+ childHasTooltip = child.hasTooltip;
1583
+ }
1584
+ const ellipsis = column.ellipsis;
1585
+ const explicit = ellipsis === false ? false : isPlainObject(ellipsis) ? ellipsis.showTooltip : void 0;
1586
+ const tooltipEnabled = explicit === false ? false : global || explicit === true;
1587
+ let next = column;
1588
+ if (childChanged || tooltipEnabled) {
1589
+ const { showTooltip: _showTooltip, ...restEllipsis } = isPlainObject(
1590
+ ellipsis
1591
+ ) ? ellipsis : {};
1592
+ const customCell = column.customCell;
1593
+ next = {
1594
+ ...column,
1595
+ ...childChanged ? { children: childColumns } : {},
1596
+ ...tooltipEnabled ? {
1597
+ ellipsis: { ...restEllipsis, showTitle: false },
1598
+ customCell: (record, rowIndex, cellColumn) => ({
1599
+ ...(customCell == null ? void 0 : customCell(record, rowIndex, cellColumn)) ?? {},
1600
+ [ELLIPSIS_TOOLTIP_CELL_ATTR]: ""
1601
+ })
1602
+ } : {}
1603
+ };
1604
+ registerColumnClone(next, column);
1605
+ changed = true;
1606
+ }
1607
+ if (tooltipEnabled || childHasTooltip) hasTooltip = true;
1608
+ list.push(next);
1609
+ }
1610
+ return { columns: changed ? list : columns, changed, hasTooltip };
1611
+ };
1612
+ const state = computed(() => transformColumns(getColumns(), globalEnabled()));
1613
+ return {
1614
+ columns: computed(() => state.value.columns),
1615
+ hasTooltip: computed(() => state.value.hasTooltip),
1616
+ resolveOriginalColumn,
1617
+ resolveSorterColumn
1618
+ };
1619
+ }
1185
1620
  const _hoisted_1 = { class: "pro-table_header" };
1186
1621
  const _hoisted_2 = {
1187
1622
  key: 0,
@@ -1209,7 +1644,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1209
1644
  immediateSearch: { type: Boolean, default: void 0 },
1210
1645
  control: { type: [Boolean, Object], default: void 0 },
1211
1646
  searchFormConfig: { default: void 0 },
1212
- tableContainer: { type: [Object, Function, Boolean], default: void 0 }
1647
+ tableContainer: { type: [Object, Function, Boolean], default: void 0 },
1648
+ ellipsisTooltip: { type: [Boolean, Object], default: void 0 }
1213
1649
  }, {
1214
1650
  "size": {},
1215
1651
  "sizeModifiers": {},
@@ -1245,6 +1681,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1245
1681
  return rest;
1246
1682
  });
1247
1683
  const attrs = useReactiveAttrs();
1684
+ const rootRef = ref(null);
1248
1685
  const size = useModel(__props, "size");
1249
1686
  const loading = useModel(__props, "loading");
1250
1687
  let searchSequence = 0;
@@ -1332,19 +1769,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1332
1769
  const effectiveSize = computed(() => {
1333
1770
  return size.value ?? injectAttrs.value.size;
1334
1771
  });
1335
- const computedTableProps = computed(() => {
1336
- const merged = {
1337
- ...injectAttrs.value,
1338
- ...omitBy(
1339
- pick(camelAttrs.value, tableProperties),
1340
- (value) => value === void 0
1341
- )
1342
- };
1343
- delete merged.onChange;
1344
- merged.size = effectiveSize.value;
1345
- merged.loading = void 0;
1346
- return merged;
1347
- });
1348
1772
  const computedTableContainer = computed(() => {
1349
1773
  const container = props.tableContainer ?? injectProps.value.tableContainer ?? DefaultTableContainer;
1350
1774
  return container ? container : void 0;
@@ -1371,39 +1795,84 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1371
1795
  const needIndex = props.addIndexColumn ?? injectProps.value.addIndexColumn;
1372
1796
  return needIndex ? [indexColumn.value, ...cols] : cols;
1373
1797
  });
1374
- const filterVisibleColumns = (columns, ancestors = /* @__PURE__ */ new Set()) => {
1375
- const list = [];
1376
- let changed = false;
1377
- for (const column of columns) {
1378
- if (!isObjectItem(column) || toValue(column.hidden)) {
1379
- changed = true;
1380
- continue;
1381
- }
1382
- if (Array.isArray(column.children) && column.children.length > 0) {
1383
- if (ancestors.has(column)) {
1384
- changed = true;
1385
- continue;
1386
- }
1387
- ancestors.add(column);
1388
- const filtered = filterVisibleColumns(column.children, ancestors);
1389
- ancestors.delete(column);
1390
- if (filtered.changed) {
1391
- changed = true;
1392
- list.push({ ...column, children: filtered.list });
1393
- continue;
1394
- }
1395
- }
1396
- list.push(column);
1798
+ const ellipsisTooltipValue = computed(
1799
+ () => props.ellipsisTooltip ?? injectProps.value.ellipsisTooltip
1800
+ );
1801
+ const ellipsisTooltipConfig = computed(
1802
+ () => typeof ellipsisTooltipValue.value === "object" && ellipsisTooltipValue.value ? ellipsisTooltipValue.value : {}
1803
+ );
1804
+ const ellipsisTooltipGlobal = computed(
1805
+ () => Boolean(ellipsisTooltipValue.value)
1806
+ );
1807
+ const {
1808
+ columns: visibleComputedColumns,
1809
+ hasTooltip: ellipsisTooltipEnabled,
1810
+ resolveOriginalColumn,
1811
+ resolveSorterColumn
1812
+ } = useEllipsisTooltipColumns(
1813
+ () => computedColumns.value,
1814
+ () => ellipsisTooltipGlobal.value
1815
+ );
1816
+ const computedTableProps = computed(() => {
1817
+ const merged = {
1818
+ ...injectAttrs.value,
1819
+ ...omitBy(
1820
+ pick(camelAttrs.value, tableProperties),
1821
+ (value) => value === void 0
1822
+ )
1823
+ };
1824
+ delete merged.onChange;
1825
+ const resizeColumn = merged.onResizeColumn;
1826
+ if (typeof resizeColumn === "function") {
1827
+ merged.onResizeColumn = (width, column) => resizeColumn(width, resolveOriginalColumn(column));
1397
1828
  }
1398
- return { list, changed };
1399
- };
1400
- const visibleComputedColumns = computed(() => {
1401
- return filterVisibleColumns(computedColumns.value).list;
1829
+ merged.size = effectiveSize.value;
1830
+ merged.loading = void 0;
1831
+ return merged;
1402
1832
  });
1833
+ const ellipsisTooltipContainer = computed(() => {
1834
+ const getPopupContainer2 = ellipsisTooltipConfig.value.getPopupContainer;
1835
+ if (!getPopupContainer2) return void 0;
1836
+ return () => {
1837
+ if (typeof document === "undefined") return void 0;
1838
+ const root = rootRef.value ?? document.body;
1839
+ return getPopupContainer2(root) ?? document.body;
1840
+ };
1841
+ });
1842
+ const ellipsisTooltipDelay = computed(
1843
+ () => Math.max(0, (ellipsisTooltipConfig.value.mouseEnterDelay ?? 0.2) * 1e3)
1844
+ );
1845
+ const ellipsisTooltipLeaveDelay = computed(
1846
+ () => Math.max(0, (ellipsisTooltipConfig.value.mouseLeaveDelay ?? 0.1) * 1e3)
1847
+ );
1848
+ const ellipsisTooltipProps = computed(() => {
1849
+ const config2 = ellipsisTooltipConfig.value;
1850
+ const {
1851
+ getPopupContainer: _getPopupContainer,
1852
+ mouseEnterDelay: _mouseEnterDelay,
1853
+ mouseLeaveDelay: _mouseLeaveDelay,
1854
+ ...rest
1855
+ } = config2;
1856
+ return rest;
1857
+ });
1858
+ const {
1859
+ open: ellipsisTooltipOpen,
1860
+ content: ellipsisTooltipContent,
1861
+ anchorStyle: ellipsisTooltipAnchorStyle,
1862
+ onMouseOver: onEllipsisMouseOver,
1863
+ onMouseOut: onEllipsisMouseOut,
1864
+ close: closeEllipsisTooltip
1865
+ } = useEllipsisTooltip(
1866
+ rootRef,
1867
+ ellipsisTooltipEnabled,
1868
+ ellipsisTooltipDelay,
1869
+ ellipsisTooltipLeaveDelay
1870
+ );
1403
1871
  const computedDataSource = computed(() => {
1404
1872
  var _a;
1405
1873
  return resolveOwnedProp("dataSource") ?? toValue((_a = props.table) == null ? void 0 : _a.dataSource) ?? [];
1406
1874
  });
1875
+ watch([visibleComputedColumns, computedDataSource], closeEllipsisTooltip);
1407
1876
  const computedPagination = computed(() => {
1408
1877
  var _a, _b, _c;
1409
1878
  const attrsPagination = resolveOwnedProp("pagination");
@@ -1445,7 +1914,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1445
1914
  );
1446
1915
  if (shadowed.length) warnPaginationShadow(shadowed);
1447
1916
  }
1448
- (_d = attrs.onChange ?? injectProps.value.onChange) == null ? void 0 : _d(...args);
1917
+ const nextArgs = [...args];
1918
+ const sorterArg = nextArgs[2];
1919
+ if (Array.isArray(sorterArg)) {
1920
+ nextArgs[2] = sorterArg.map(resolveSorterColumn);
1921
+ } else if (sorterArg) {
1922
+ nextArgs[2] = resolveSorterColumn(sorterArg);
1923
+ }
1924
+ (_d = attrs.onChange ?? injectProps.value.onChange) == null ? void 0 : _d(...nextArgs);
1449
1925
  _search();
1450
1926
  };
1451
1927
  const searchFormVisible = computed(() => {
@@ -1485,10 +1961,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1485
1961
  });
1486
1962
  return (_ctx, _cache) => {
1487
1963
  return openBlock(), createElementBlock("div", {
1964
+ ref_key: "rootRef",
1965
+ ref: rootRef,
1488
1966
  class: normalizeClass(["pro-table", unref(attrs).class]),
1489
- style: normalizeStyle(unref(attrs).style)
1967
+ "data-pro-table-root": "",
1968
+ style: normalizeStyle(unref(attrs).style),
1969
+ onMouseover: _cache[1] || (_cache[1] = //@ts-ignore
1970
+ (...args) => unref(onEllipsisMouseOver) && unref(onEllipsisMouseOver)(...args)),
1971
+ onMouseout: _cache[2] || (_cache[2] = //@ts-ignore
1972
+ (...args) => unref(onEllipsisMouseOut) && unref(onEllipsisMouseOut)(...args))
1490
1973
  }, [
1491
- searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(_sfc_main$e, {
1974
+ searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(_sfc_main$g, {
1492
1975
  key: 0,
1493
1976
  component: computedSearchFormConfig.value.container
1494
1977
  }, {
@@ -1511,7 +1994,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1511
1994
  }),
1512
1995
  _: 3
1513
1996
  }, 8, ["component"])) : createCommentVNode("", true),
1514
- createVNode(_sfc_main$e, { component: computedTableContainer.value }, {
1997
+ createVNode(_sfc_main$g, { component: computedTableContainer.value }, {
1515
1998
  default: withCtx(() => [
1516
1999
  createElementVNode("div", _hoisted_1, [
1517
2000
  _ctx.$slots["button-bar"] ? (openBlock(), createElementBlock("div", _hoisted_2, [
@@ -1536,7 +2019,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1536
2019
  ])) : createCommentVNode("", true)
1537
2020
  ]),
1538
2021
  renderSlot(_ctx.$slots, "table", normalizeProps(guardReactiveProps({
1539
- columns: visibleComputedColumns.value,
2022
+ columns: unref(visibleComputedColumns),
1540
2023
  dataSource: computedDataSource.value,
1541
2024
  pagination: computedPagination.value,
1542
2025
  loading: loading.value,
@@ -1545,7 +2028,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1545
2028
  })), () => [
1546
2029
  createVNode(unref(Table), mergeProps({ class: "pro-table_content" }, computedTableProps.value, {
1547
2030
  loading: loading.value,
1548
- columns: visibleComputedColumns.value,
2031
+ columns: unref(visibleComputedColumns),
1549
2032
  "data-source": computedDataSource.value,
1550
2033
  pagination: computedPagination.value,
1551
2034
  onChange: onTableChange
@@ -1562,12 +2045,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1562
2045
  ], true)
1563
2046
  ]),
1564
2047
  _: 3
1565
- }, 8, ["component"])
1566
- ], 6);
2048
+ }, 8, ["component"]),
2049
+ unref(ellipsisTooltipEnabled) ? (openBlock(), createBlock(_sfc_main$2, mergeProps({
2050
+ key: 1,
2051
+ open: unref(ellipsisTooltipOpen),
2052
+ content: unref(ellipsisTooltipContent),
2053
+ "anchor-style": unref(ellipsisTooltipAnchorStyle),
2054
+ container: ellipsisTooltipContainer.value
2055
+ }, ellipsisTooltipProps.value), null, 16, ["open", "content", "anchor-style", "container"])) : createCommentVNode("", true)
2056
+ ], 38);
1567
2057
  };
1568
2058
  }
1569
2059
  });
1570
- const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-05315c95"]]);
2060
+ const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-35945e54"]]);
1571
2061
  function useTable(params) {
1572
2062
  return useTable$1(params);
1573
2063
  }
@@ -1655,7 +2145,7 @@ const index = {
1655
2145
  * ```
1656
2146
  */
1657
2147
  install(app) {
1658
- app.component(_sfc_main$a.name, _sfc_main$a);
2148
+ app.component(_sfc_main$b.name, _sfc_main$b);
1659
2149
  app.component(ProTable.name, ProTable);
1660
2150
  app.component(
1661
2151
  _sfc_main.name ?? "ProComponentProvider",
@@ -1664,12 +2154,12 @@ const index = {
1664
2154
  }
1665
2155
  };
1666
2156
  export {
1667
- _sfc_main$e as ContainerFragment,
2157
+ _sfc_main$g as ContainerFragment,
1668
2158
  LOCALE_INJECT_KEY,
1669
2159
  _sfc_main as ProComponentProvider,
1670
- _sfc_main$a as ProForm,
2160
+ _sfc_main$b as ProForm,
1671
2161
  ProTable,
1672
- _sfc_main$d as SlotComponent,
2162
+ _sfc_main$f as SlotComponent,
1673
2163
  index as default,
1674
2164
  enUS2 as enUS,
1675
2165
  useFields,