@qin-ui/antd-vue-pro 2.5.3 → 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 (30) hide show
  1. package/AI-CONTEXT.md +30 -10
  2. package/api.json +23 -3
  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/table/components/ProTable.vue.d.ts +3 -1
  7. package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
  8. package/es/components/table/components/TableEllipsisTooltip.vue.d.ts +19 -0
  9. package/es/components/table/components/TableEllipsisTooltip.vue.d.ts.map +1 -0
  10. package/es/components/table/hooks/useEllipsisTooltip.d.ts +45 -0
  11. package/es/components/table/hooks/useEllipsisTooltip.d.ts.map +1 -0
  12. package/es/components/table/hooks/useEllipsisTooltipColumns.d.ts +19 -0
  13. package/es/components/table/hooks/useEllipsisTooltipColumns.d.ts.map +1 -0
  14. package/es/components/table/index.d.ts +1 -1
  15. package/es/components/table/index.d.ts.map +1 -1
  16. package/es/components/table/types/index.d.ts +46 -2
  17. package/es/components/table/types/index.d.ts.map +1 -1
  18. package/es/index.js +438 -87
  19. package/es/index.js.map +1 -1
  20. package/es/shared/ui/index.d.ts +2 -1
  21. package/es/shared/ui/index.d.ts.map +1 -1
  22. package/package.json +2 -2
  23. package/src/components/component-provider/types/index.ts +1 -0
  24. package/src/components/table/components/ProTable.vue +128 -56
  25. package/src/components/table/components/TableEllipsisTooltip.vue +90 -0
  26. package/src/components/table/hooks/useEllipsisTooltip.ts +244 -0
  27. package/src/components/table/hooks/useEllipsisTooltipColumns.ts +139 -0
  28. package/src/components/table/index.ts +7 -1
  29. package/src/components/table/types/index.ts +62 -2
  30. package/src/shared/ui/index.ts +2 -0
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
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, onBeforeUnmount, createCommentVNode, createSlots, renderList, createVNode, watch, h, toRaw, unref, provide, useSlots, shallowRef, onUpdated, triggerRef, createElementVNode, withModifiers, normalizeStyle, nextTick, mergeModels, useModel, getCurrentInstance, onMounted, 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, Table } from "ant-design-vue";
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
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";
@@ -154,7 +154,7 @@ const ensureInjectConfig = (key) => {
154
154
  DYNAMIC_INJECT_CONFIG[key] = created;
155
155
  return created;
156
156
  };
157
- const _sfc_main$f = /* @__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$f = /* @__PURE__ */ defineComponent({
172
172
  };
173
173
  }
174
174
  });
175
- const _sfc_main$e = /* @__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$d = /* @__PURE__ */ defineComponent({
268
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
269
269
  ...{ name: "BaseField", inheritAttrs: false },
270
270
  __name: "index",
271
271
  props: {
@@ -396,7 +396,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
396
396
  getComponentComputedProps: () => groupedAttrs.value.attrs
397
397
  });
398
398
  return (_ctx, _cache) => {
399
- return openBlock(), createBlock(_sfc_main$f, {
399
+ return openBlock(), createBlock(_sfc_main$g, {
400
400
  component: groupedAttrs.value.componentContainer,
401
401
  path: props.path
402
402
  }, {
@@ -412,7 +412,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
412
412
  return {
413
413
  name,
414
414
  fn: withCtx((scoped) => [
415
- createVNode(_sfc_main$e, mergeProps({
415
+ createVNode(_sfc_main$f, mergeProps({
416
416
  path: props.path
417
417
  }, scoped, { component: slot }), null, 16, ["path", "component"])
418
418
  ])
@@ -495,7 +495,7 @@ function useGroupedField(field) {
495
495
  () => groupField(toValue(field), toValue(injectFormItemProps) || {})
496
496
  );
497
497
  }
498
- const _sfc_main$c = defineComponent({
498
+ const _sfc_main$d = defineComponent({
499
499
  name: "BaseFormItem",
500
500
  inheritAttrs: false,
501
501
  props: {
@@ -562,7 +562,7 @@ const _sfc_main$c = defineComponent({
562
562
  const renderFormItemSlots = (groupedField) => {
563
563
  const slots = {};
564
564
  Object.entries(groupedField.formItemSlots).forEach(([name, slot]) => {
565
- slots[name] = (scope) => h(_sfc_main$e, {
565
+ slots[name] = (scope) => h(_sfc_main$f, {
566
566
  path: groupedField.path,
567
567
  component: slot,
568
568
  ...scope || {}
@@ -571,13 +571,13 @@ const _sfc_main$c = defineComponent({
571
571
  slots.default = () => {
572
572
  const field = props.field;
573
573
  if (field.fields) {
574
- return h(_sfc_main$b, {
574
+ return h(_sfc_main$c, {
575
575
  grid: field.grid ?? props.grid,
576
576
  fields: field.fields,
577
577
  disabled: toValue(field.disabled)
578
578
  });
579
579
  }
580
- return h(_sfc_main$d, {
580
+ return h(_sfc_main$e, {
581
581
  key: componentKey.value,
582
582
  ref: setFieldRef,
583
583
  ...groupedField.componentProps,
@@ -663,7 +663,7 @@ const getFieldDataKey = (field, rawFormData) => {
663
663
  const rest = segments.slice(lastRowIndex + 1).join(".");
664
664
  return `data:${rowIds.join("/")}:${rest}`;
665
665
  };
666
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
666
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
667
667
  ...{ name: "BaseFormItems", inheritAttrs: false },
668
668
  __name: "index",
669
669
  props: {
@@ -768,7 +768,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
768
768
  return enableGrid.value ? (openBlock(), createBlock(unref(Row), normalizeProps(mergeProps({ key: 0 }, computedGridProps.value)), {
769
769
  default: withCtx(() => [
770
770
  (openBlock(true), createElementBlock(Fragment, null, renderList(renderedFields.value, (item) => {
771
- return openBlock(), createBlock(_sfc_main$c, {
771
+ return openBlock(), createBlock(_sfc_main$d, {
772
772
  key: item.key,
773
773
  field: item.field,
774
774
  grid: props.grid,
@@ -780,7 +780,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
780
780
  ]),
781
781
  _: 1
782
782
  }, 16)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(renderedFields.value, (item) => {
783
- return openBlock(), createBlock(_sfc_main$c, {
783
+ return openBlock(), createBlock(_sfc_main$d, {
784
784
  key: item.key,
785
785
  field: item.field,
786
786
  grid: props.grid,
@@ -792,7 +792,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
792
792
  };
793
793
  }
794
794
  });
795
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
795
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
796
796
  ...{ name: "ProForm", inheritAttrs: false },
797
797
  __name: "index",
798
798
  props: {
@@ -855,7 +855,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
855
855
  model: formData.value
856
856
  }, formAttrs.value, { class: "pro-form" }), {
857
857
  default: withCtx(() => [
858
- createVNode(_sfc_main$b, {
858
+ createVNode(_sfc_main$c, {
859
859
  fields: fields.value,
860
860
  grid: props.grid
861
861
  }, null, 8, ["fields", "grid"]),
@@ -879,7 +879,7 @@ const _export_sfc = (sfc, props) => {
879
879
  }
880
880
  return target;
881
881
  };
882
- const _sfc_main$9 = {};
882
+ const _sfc_main$a = {};
883
883
  const _hoisted_1$3 = {
884
884
  focusable: "false",
885
885
  "data-icon": "down",
@@ -894,8 +894,8 @@ function _sfc_render$2(_ctx, _cache) {
894
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)
895
895
  ])]);
896
896
  }
897
- const DownOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$2]]);
898
- 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({
899
899
  ...{ name: "SearchForm" },
900
900
  __name: "SearchForm",
901
901
  props: {
@@ -953,7 +953,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
953
953
  emitSearch();
954
954
  };
955
955
  return (_ctx, _cache) => {
956
- return openBlock(), createBlock(_sfc_main$a, mergeProps(layoutProps.value, {
956
+ return openBlock(), createBlock(_sfc_main$b, mergeProps(layoutProps.value, {
957
957
  form: props.form,
958
958
  class: "pro-table_search-form transition",
959
959
  onSubmit: withModifiers(onSearchSubmit, ["prevent"])
@@ -1034,8 +1034,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1034
1034
  };
1035
1035
  }
1036
1036
  });
1037
- const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-bf6cca54"]]);
1038
- 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({
1039
1039
  __name: "DefaultSearchFormContainer",
1040
1040
  setup(__props) {
1041
1041
  const { token } = theme.useToken();
@@ -1049,8 +1049,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1049
1049
  };
1050
1050
  }
1051
1051
  });
1052
- const DefaultSearchFormContainer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-570a1898"]]);
1053
- 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({
1054
1054
  __name: "DefaultTableContainer",
1055
1055
  setup(__props) {
1056
1056
  const { token } = theme.useToken();
@@ -1064,8 +1064,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1064
1064
  };
1065
1065
  }
1066
1066
  });
1067
- const DefaultTableContainer = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-e5c97b2f"]]);
1068
- const _sfc_main$5 = {};
1067
+ const DefaultTableContainer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-e5c97b2f"]]);
1068
+ const _sfc_main$6 = {};
1069
1069
  const _hoisted_1$2 = {
1070
1070
  focusable: "false",
1071
1071
  "data-icon": "column-height",
@@ -1080,8 +1080,8 @@ function _sfc_render$1(_ctx, _cache) {
1080
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)
1081
1081
  ])]);
1082
1082
  }
1083
- const ColumnHeightOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$1]]);
1084
- 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({
1085
1085
  __name: "SizeControl",
1086
1086
  props: /* @__PURE__ */ mergeModels({
1087
1087
  effectiveSize: { default: void 0 }
@@ -1138,8 +1138,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1138
1138
  };
1139
1139
  }
1140
1140
  });
1141
- const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-950f061f"]]);
1142
- const _sfc_main$3 = {};
1141
+ const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-950f061f"]]);
1142
+ const _sfc_main$4 = {};
1143
1143
  const _hoisted_1$1 = {
1144
1144
  focusable: "false",
1145
1145
  "data-icon": "filter",
@@ -1154,8 +1154,8 @@ function _sfc_render(_ctx, _cache) {
1154
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)
1155
1155
  ])]);
1156
1156
  }
1157
- const FilterOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render]]);
1158
- 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({
1159
1159
  __name: "ColumnControl",
1160
1160
  props: {
1161
1161
  columns: {},
@@ -1320,7 +1320,303 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1320
1320
  };
1321
1321
  }
1322
1322
  });
1323
- 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
+ }
1324
1620
  const _hoisted_1 = { class: "pro-table_header" };
1325
1621
  const _hoisted_2 = {
1326
1622
  key: 0,
@@ -1348,7 +1644,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1348
1644
  immediateSearch: { type: Boolean, default: void 0 },
1349
1645
  control: { type: [Boolean, Object], default: void 0 },
1350
1646
  searchFormConfig: { default: void 0 },
1351
- 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 }
1352
1649
  }, {
1353
1650
  "size": {},
1354
1651
  "sizeModifiers": {},
@@ -1384,6 +1681,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1384
1681
  return rest;
1385
1682
  });
1386
1683
  const attrs = useReactiveAttrs();
1684
+ const rootRef = ref(null);
1387
1685
  const size = useModel(__props, "size");
1388
1686
  const loading = useModel(__props, "loading");
1389
1687
  let searchSequence = 0;
@@ -1471,19 +1769,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1471
1769
  const effectiveSize = computed(() => {
1472
1770
  return size.value ?? injectAttrs.value.size;
1473
1771
  });
1474
- const computedTableProps = computed(() => {
1475
- const merged = {
1476
- ...injectAttrs.value,
1477
- ...omitBy(
1478
- pick(camelAttrs.value, tableProperties),
1479
- (value) => value === void 0
1480
- )
1481
- };
1482
- delete merged.onChange;
1483
- merged.size = effectiveSize.value;
1484
- merged.loading = void 0;
1485
- return merged;
1486
- });
1487
1772
  const computedTableContainer = computed(() => {
1488
1773
  const container = props.tableContainer ?? injectProps.value.tableContainer ?? DefaultTableContainer;
1489
1774
  return container ? container : void 0;
@@ -1510,39 +1795,84 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1510
1795
  const needIndex = props.addIndexColumn ?? injectProps.value.addIndexColumn;
1511
1796
  return needIndex ? [indexColumn.value, ...cols] : cols;
1512
1797
  });
1513
- const filterVisibleColumns = (columns, ancestors = /* @__PURE__ */ new Set()) => {
1514
- const list = [];
1515
- let changed = false;
1516
- for (const column of columns) {
1517
- if (!isObjectItem(column) || toValue(column.hidden)) {
1518
- changed = true;
1519
- continue;
1520
- }
1521
- if (Array.isArray(column.children) && column.children.length > 0) {
1522
- if (ancestors.has(column)) {
1523
- changed = true;
1524
- continue;
1525
- }
1526
- ancestors.add(column);
1527
- const filtered = filterVisibleColumns(column.children, ancestors);
1528
- ancestors.delete(column);
1529
- if (filtered.changed) {
1530
- changed = true;
1531
- list.push({ ...column, children: filtered.list });
1532
- continue;
1533
- }
1534
- }
1535
- 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));
1536
1828
  }
1537
- return { list, changed };
1538
- };
1539
- const visibleComputedColumns = computed(() => {
1540
- return filterVisibleColumns(computedColumns.value).list;
1829
+ merged.size = effectiveSize.value;
1830
+ merged.loading = void 0;
1831
+ return merged;
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;
1541
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
+ );
1542
1871
  const computedDataSource = computed(() => {
1543
1872
  var _a;
1544
1873
  return resolveOwnedProp("dataSource") ?? toValue((_a = props.table) == null ? void 0 : _a.dataSource) ?? [];
1545
1874
  });
1875
+ watch([visibleComputedColumns, computedDataSource], closeEllipsisTooltip);
1546
1876
  const computedPagination = computed(() => {
1547
1877
  var _a, _b, _c;
1548
1878
  const attrsPagination = resolveOwnedProp("pagination");
@@ -1584,7 +1914,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1584
1914
  );
1585
1915
  if (shadowed.length) warnPaginationShadow(shadowed);
1586
1916
  }
1587
- (_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);
1588
1925
  _search();
1589
1926
  };
1590
1927
  const searchFormVisible = computed(() => {
@@ -1624,10 +1961,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1624
1961
  });
1625
1962
  return (_ctx, _cache) => {
1626
1963
  return openBlock(), createElementBlock("div", {
1964
+ ref_key: "rootRef",
1965
+ ref: rootRef,
1627
1966
  class: normalizeClass(["pro-table", unref(attrs).class]),
1628
- 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))
1629
1973
  }, [
1630
- searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(_sfc_main$f, {
1974
+ searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(_sfc_main$g, {
1631
1975
  key: 0,
1632
1976
  component: computedSearchFormConfig.value.container
1633
1977
  }, {
@@ -1650,7 +1994,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1650
1994
  }),
1651
1995
  _: 3
1652
1996
  }, 8, ["component"])) : createCommentVNode("", true),
1653
- createVNode(_sfc_main$f, { component: computedTableContainer.value }, {
1997
+ createVNode(_sfc_main$g, { component: computedTableContainer.value }, {
1654
1998
  default: withCtx(() => [
1655
1999
  createElementVNode("div", _hoisted_1, [
1656
2000
  _ctx.$slots["button-bar"] ? (openBlock(), createElementBlock("div", _hoisted_2, [
@@ -1675,7 +2019,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1675
2019
  ])) : createCommentVNode("", true)
1676
2020
  ]),
1677
2021
  renderSlot(_ctx.$slots, "table", normalizeProps(guardReactiveProps({
1678
- columns: visibleComputedColumns.value,
2022
+ columns: unref(visibleComputedColumns),
1679
2023
  dataSource: computedDataSource.value,
1680
2024
  pagination: computedPagination.value,
1681
2025
  loading: loading.value,
@@ -1684,7 +2028,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1684
2028
  })), () => [
1685
2029
  createVNode(unref(Table), mergeProps({ class: "pro-table_content" }, computedTableProps.value, {
1686
2030
  loading: loading.value,
1687
- columns: visibleComputedColumns.value,
2031
+ columns: unref(visibleComputedColumns),
1688
2032
  "data-source": computedDataSource.value,
1689
2033
  pagination: computedPagination.value,
1690
2034
  onChange: onTableChange
@@ -1701,12 +2045,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1701
2045
  ], true)
1702
2046
  ]),
1703
2047
  _: 3
1704
- }, 8, ["component"])
1705
- ], 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);
1706
2057
  };
1707
2058
  }
1708
2059
  });
1709
- 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"]]);
1710
2061
  function useTable(params) {
1711
2062
  return useTable$1(params);
1712
2063
  }
@@ -1794,7 +2145,7 @@ const index = {
1794
2145
  * ```
1795
2146
  */
1796
2147
  install(app) {
1797
- app.component(_sfc_main$a.name, _sfc_main$a);
2148
+ app.component(_sfc_main$b.name, _sfc_main$b);
1798
2149
  app.component(ProTable.name, ProTable);
1799
2150
  app.component(
1800
2151
  _sfc_main.name ?? "ProComponentProvider",
@@ -1803,12 +2154,12 @@ const index = {
1803
2154
  }
1804
2155
  };
1805
2156
  export {
1806
- _sfc_main$f as ContainerFragment,
2157
+ _sfc_main$g as ContainerFragment,
1807
2158
  LOCALE_INJECT_KEY,
1808
2159
  _sfc_main as ProComponentProvider,
1809
- _sfc_main$a as ProForm,
2160
+ _sfc_main$b as ProForm,
1810
2161
  ProTable,
1811
- _sfc_main$e as SlotComponent,
2162
+ _sfc_main$f as SlotComponent,
1812
2163
  index as default,
1813
2164
  enUS2 as enUS,
1814
2165
  useFields,