@qin-ui/antd-vue-pro 2.5.3 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI-CONTEXT.md +30 -10
- package/api.json +23 -3
- package/es/antd-vue-pro.css +6 -6
- package/es/components/component-provider/components/index.vue.d.ts.map +1 -1
- package/es/components/component-provider/types/index.d.ts +1 -1
- package/es/components/component-provider/types/index.d.ts.map +1 -1
- package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -1
- package/es/components/form/components/BaseField/utils/index.d.ts +1 -2
- package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -1
- package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -1
- package/es/components/table/components/ProTable.vue.d.ts +11 -3
- package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
- package/es/components/table/components/TableEllipsisTooltip.vue.d.ts +19 -0
- package/es/components/table/components/TableEllipsisTooltip.vue.d.ts.map +1 -0
- package/es/components/table/hooks/useEllipsisTooltip.d.ts +45 -0
- package/es/components/table/hooks/useEllipsisTooltip.d.ts.map +1 -0
- package/es/components/table/hooks/useEllipsisTooltipColumns.d.ts +19 -0
- package/es/components/table/hooks/useEllipsisTooltipColumns.d.ts.map +1 -0
- package/es/components/table/index.d.ts +1 -1
- package/es/components/table/index.d.ts.map +1 -1
- package/es/components/table/types/index.d.ts +47 -2
- package/es/components/table/types/index.d.ts.map +1 -1
- package/es/index.js +544 -118
- package/es/index.js.map +1 -1
- package/es/shared/core/index.d.ts +1 -1
- package/es/shared/core/index.d.ts.map +1 -1
- package/es/shared/ui/index.d.ts +2 -1
- package/es/shared/ui/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/component-provider/components/index.vue +31 -8
- package/src/components/component-provider/types/index.ts +1 -0
- package/src/components/form/components/BaseField/index.vue +21 -12
- package/src/components/form/components/BaseField/utils/index.ts +5 -5
- package/src/components/form/components/ProForm/index.vue +9 -2
- package/src/components/table/components/ProTable.vue +198 -71
- package/src/components/table/components/TableEllipsisTooltip.vue +90 -0
- package/src/components/table/hooks/useEllipsisTooltip.ts +244 -0
- package/src/components/table/hooks/useEllipsisTooltipColumns.ts +154 -0
- package/src/components/table/index.ts +7 -1
- package/src/components/table/types/index.ts +63 -2
- package/src/shared/core/index.ts +2 -0
- package/src/shared/ui/index.ts +3 -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, onBeforeUnmount, createCommentVNode, createSlots, renderList, createVNode, watch, h, toRaw, unref, provide, useSlots, shallowRef, onUpdated, triggerRef, createElementVNode, withModifiers, normalizeStyle, nextTick, mergeModels, useModel,
|
|
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";
|
|
4
|
-
import { useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, useReactiveAttrs, cloneDeep, getObject, InjectionFormSlotsKey, isPlainObject, resolveFieldIdentity, toPath, isObjectItem, InjectionFormKey, createFormProxy,
|
|
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, TableColumn } from "ant-design-vue";
|
|
4
|
+
import { useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, useReactiveAttrs, cloneDeep, getObject, omitBy, InjectionFormSlotsKey, isPlainObject, resolveFieldIdentity, toPath, isObjectItem, InjectionFormKey, createFormProxy, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, useSearchFormExpand, pick, callListeners, isPromise, useTable as useTable$1, omit, mergeComponentVars } 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$
|
|
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$
|
|
175
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
176
176
|
...{ name: "SlotComponent", inheritAttrs: false },
|
|
177
177
|
__name: "index",
|
|
178
178
|
props: {
|
|
@@ -230,10 +230,11 @@ const getPlaceholderProps = (key, injectProps, t) => {
|
|
|
230
230
|
};
|
|
231
231
|
const getInitProps = (field, injectProps = {}, t) => {
|
|
232
232
|
const { component } = field;
|
|
233
|
-
const picker = component === "date-picker" ? "" : field.picker;
|
|
234
233
|
if (typeof component === "string") {
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
return {
|
|
235
|
+
...injectProps,
|
|
236
|
+
...getPlaceholderProps(component, injectProps, t)
|
|
237
|
+
};
|
|
237
238
|
}
|
|
238
239
|
return {};
|
|
239
240
|
};
|
|
@@ -265,7 +266,7 @@ const useLocale = () => {
|
|
|
265
266
|
};
|
|
266
267
|
return { t, lang };
|
|
267
268
|
};
|
|
268
|
-
const _sfc_main$
|
|
269
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
269
270
|
...{ name: "BaseField", inheritAttrs: false },
|
|
270
271
|
__name: "index",
|
|
271
272
|
props: {
|
|
@@ -309,9 +310,11 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
309
310
|
});
|
|
310
311
|
const attrs = useReactiveAttrs();
|
|
311
312
|
const pickerVal = attrs.picker;
|
|
312
|
-
const
|
|
313
|
-
const
|
|
314
|
-
const
|
|
313
|
+
const baseConfigKey = typeof props.component === "string" ? props.component : "";
|
|
314
|
+
const pickerConfigKey = pickerVal || (baseConfigKey === "date-picker" ? "date" : "");
|
|
315
|
+
const subtypeConfigKey = baseConfigKey && pickerConfigKey ? `${baseConfigKey}.${pickerConfigKey}` : "";
|
|
316
|
+
const baseInjectConfig = baseConfigKey ? getInjectConfig(baseConfigKey) : void 0;
|
|
317
|
+
const subtypeInjectConfig = subtypeConfigKey ? getInjectConfig(subtypeConfigKey) : void 0;
|
|
315
318
|
const componentVars = inject(INJECT_COMPONENT_VARS, void 0);
|
|
316
319
|
const value = computed({
|
|
317
320
|
get() {
|
|
@@ -349,10 +352,12 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
349
352
|
});
|
|
350
353
|
const parentDisabled = useInjectDisabled();
|
|
351
354
|
const groupedAttrs = computed(() => {
|
|
352
|
-
var _a;
|
|
355
|
+
var _a, _b;
|
|
353
356
|
const currentInjectProps = {
|
|
354
|
-
...
|
|
355
|
-
...getObject(
|
|
357
|
+
...getObject(baseInjectConfig == null ? void 0 : baseInjectConfig.default),
|
|
358
|
+
...getObject(subtypeInjectConfig == null ? void 0 : subtypeInjectConfig.default),
|
|
359
|
+
...getObject((_a = toValue(componentVars)) == null ? void 0 : _a[baseConfigKey]),
|
|
360
|
+
...getObject((_b = toValue(componentVars)) == null ? void 0 : _b[subtypeConfigKey])
|
|
356
361
|
};
|
|
357
362
|
const initProps = getInitProps(
|
|
358
363
|
{ component: props.component, picker: attrs.picker },
|
|
@@ -360,9 +365,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
360
365
|
t
|
|
361
366
|
);
|
|
362
367
|
const effectiveModelProp = attrs.modelProp ?? initProps.modelProp ?? "value";
|
|
368
|
+
const definedAttrs = omitBy(attrs, (value2) => value2 === void 0);
|
|
363
369
|
const mergedProps = mergeProps(
|
|
364
370
|
initProps,
|
|
365
|
-
|
|
371
|
+
definedAttrs,
|
|
366
372
|
{ class: attrs.componentClass, style: attrs.componentStyle },
|
|
367
373
|
{ disabled: attrs.disabled ?? parentDisabled.value ?? initProps.disabled },
|
|
368
374
|
{ modelProp: effectiveModelProp }
|
|
@@ -396,7 +402,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
396
402
|
getComponentComputedProps: () => groupedAttrs.value.attrs
|
|
397
403
|
});
|
|
398
404
|
return (_ctx, _cache) => {
|
|
399
|
-
return openBlock(), createBlock(_sfc_main$
|
|
405
|
+
return openBlock(), createBlock(_sfc_main$g, {
|
|
400
406
|
component: groupedAttrs.value.componentContainer,
|
|
401
407
|
path: props.path
|
|
402
408
|
}, {
|
|
@@ -412,7 +418,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
412
418
|
return {
|
|
413
419
|
name,
|
|
414
420
|
fn: withCtx((scoped) => [
|
|
415
|
-
createVNode(_sfc_main$
|
|
421
|
+
createVNode(_sfc_main$f, mergeProps({
|
|
416
422
|
path: props.path
|
|
417
423
|
}, scoped, { component: slot }), null, 16, ["path", "component"])
|
|
418
424
|
])
|
|
@@ -495,7 +501,7 @@ function useGroupedField(field) {
|
|
|
495
501
|
() => groupField(toValue(field), toValue(injectFormItemProps) || {})
|
|
496
502
|
);
|
|
497
503
|
}
|
|
498
|
-
const _sfc_main$
|
|
504
|
+
const _sfc_main$d = defineComponent({
|
|
499
505
|
name: "BaseFormItem",
|
|
500
506
|
inheritAttrs: false,
|
|
501
507
|
props: {
|
|
@@ -562,7 +568,7 @@ const _sfc_main$c = defineComponent({
|
|
|
562
568
|
const renderFormItemSlots = (groupedField) => {
|
|
563
569
|
const slots = {};
|
|
564
570
|
Object.entries(groupedField.formItemSlots).forEach(([name, slot]) => {
|
|
565
|
-
slots[name] = (scope) => h(_sfc_main$
|
|
571
|
+
slots[name] = (scope) => h(_sfc_main$f, {
|
|
566
572
|
path: groupedField.path,
|
|
567
573
|
component: slot,
|
|
568
574
|
...scope || {}
|
|
@@ -571,13 +577,13 @@ const _sfc_main$c = defineComponent({
|
|
|
571
577
|
slots.default = () => {
|
|
572
578
|
const field = props.field;
|
|
573
579
|
if (field.fields) {
|
|
574
|
-
return h(_sfc_main$
|
|
580
|
+
return h(_sfc_main$c, {
|
|
575
581
|
grid: field.grid ?? props.grid,
|
|
576
582
|
fields: field.fields,
|
|
577
583
|
disabled: toValue(field.disabled)
|
|
578
584
|
});
|
|
579
585
|
}
|
|
580
|
-
return h(_sfc_main$
|
|
586
|
+
return h(_sfc_main$e, {
|
|
581
587
|
key: componentKey.value,
|
|
582
588
|
ref: setFieldRef,
|
|
583
589
|
...groupedField.componentProps,
|
|
@@ -663,7 +669,7 @@ const getFieldDataKey = (field, rawFormData) => {
|
|
|
663
669
|
const rest = segments.slice(lastRowIndex + 1).join(".");
|
|
664
670
|
return `data:${rowIds.join("/")}:${rest}`;
|
|
665
671
|
};
|
|
666
|
-
const _sfc_main$
|
|
672
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
667
673
|
...{ name: "BaseFormItems", inheritAttrs: false },
|
|
668
674
|
__name: "index",
|
|
669
675
|
props: {
|
|
@@ -768,7 +774,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
768
774
|
return enableGrid.value ? (openBlock(), createBlock(unref(Row), normalizeProps(mergeProps({ key: 0 }, computedGridProps.value)), {
|
|
769
775
|
default: withCtx(() => [
|
|
770
776
|
(openBlock(true), createElementBlock(Fragment, null, renderList(renderedFields.value, (item) => {
|
|
771
|
-
return openBlock(), createBlock(_sfc_main$
|
|
777
|
+
return openBlock(), createBlock(_sfc_main$d, {
|
|
772
778
|
key: item.key,
|
|
773
779
|
field: item.field,
|
|
774
780
|
grid: props.grid,
|
|
@@ -780,7 +786,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
780
786
|
]),
|
|
781
787
|
_: 1
|
|
782
788
|
}, 16)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(renderedFields.value, (item) => {
|
|
783
|
-
return openBlock(), createBlock(_sfc_main$
|
|
789
|
+
return openBlock(), createBlock(_sfc_main$d, {
|
|
784
790
|
key: item.key,
|
|
785
791
|
field: item.field,
|
|
786
792
|
grid: props.grid,
|
|
@@ -792,7 +798,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
792
798
|
};
|
|
793
799
|
}
|
|
794
800
|
});
|
|
795
|
-
const _sfc_main$
|
|
801
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
796
802
|
...{ name: "ProForm", inheritAttrs: false },
|
|
797
803
|
__name: "index",
|
|
798
804
|
props: {
|
|
@@ -814,10 +820,13 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
814
820
|
var _a;
|
|
815
821
|
return (_a = currentForm.value) == null ? void 0 : _a.formData;
|
|
816
822
|
});
|
|
817
|
-
const
|
|
818
|
-
|
|
819
|
-
return (
|
|
820
|
-
|
|
823
|
+
const formRefSetter = computed(() => {
|
|
824
|
+
const form = currentForm.value;
|
|
825
|
+
return (el) => {
|
|
826
|
+
var _a;
|
|
827
|
+
return (_a = form == null ? void 0 : form.setFormRef) == null ? void 0 : _a.call(form, el);
|
|
828
|
+
};
|
|
829
|
+
});
|
|
821
830
|
let formInstanceCounter = 0;
|
|
822
831
|
const formInstanceKeyMap = /* @__PURE__ */ new WeakMap();
|
|
823
832
|
const getFormKey = (f) => {
|
|
@@ -851,11 +860,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
851
860
|
return (_ctx, _cache) => {
|
|
852
861
|
return openBlock(), createBlock(unref(Form), mergeProps({
|
|
853
862
|
key: formKey.value,
|
|
854
|
-
ref:
|
|
863
|
+
ref: formRefSetter.value,
|
|
855
864
|
model: formData.value
|
|
856
865
|
}, formAttrs.value, { class: "pro-form" }), {
|
|
857
866
|
default: withCtx(() => [
|
|
858
|
-
createVNode(_sfc_main$
|
|
867
|
+
createVNode(_sfc_main$c, {
|
|
859
868
|
fields: fields.value,
|
|
860
869
|
grid: props.grid
|
|
861
870
|
}, null, 8, ["fields", "grid"]),
|
|
@@ -879,7 +888,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
879
888
|
}
|
|
880
889
|
return target;
|
|
881
890
|
};
|
|
882
|
-
const _sfc_main$
|
|
891
|
+
const _sfc_main$a = {};
|
|
883
892
|
const _hoisted_1$3 = {
|
|
884
893
|
focusable: "false",
|
|
885
894
|
"data-icon": "down",
|
|
@@ -894,8 +903,8 @@ function _sfc_render$2(_ctx, _cache) {
|
|
|
894
903
|
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
904
|
])]);
|
|
896
905
|
}
|
|
897
|
-
const DownOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
898
|
-
const _sfc_main$
|
|
906
|
+
const DownOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$2]]);
|
|
907
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
899
908
|
...{ name: "SearchForm" },
|
|
900
909
|
__name: "SearchForm",
|
|
901
910
|
props: {
|
|
@@ -953,7 +962,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
953
962
|
emitSearch();
|
|
954
963
|
};
|
|
955
964
|
return (_ctx, _cache) => {
|
|
956
|
-
return openBlock(), createBlock(_sfc_main$
|
|
965
|
+
return openBlock(), createBlock(_sfc_main$b, mergeProps(layoutProps.value, {
|
|
957
966
|
form: props.form,
|
|
958
967
|
class: "pro-table_search-form transition",
|
|
959
968
|
onSubmit: withModifiers(onSearchSubmit, ["prevent"])
|
|
@@ -1034,8 +1043,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1034
1043
|
};
|
|
1035
1044
|
}
|
|
1036
1045
|
});
|
|
1037
|
-
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1038
|
-
const _sfc_main$
|
|
1046
|
+
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-bf6cca54"]]);
|
|
1047
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
1039
1048
|
__name: "DefaultSearchFormContainer",
|
|
1040
1049
|
setup(__props) {
|
|
1041
1050
|
const { token } = theme.useToken();
|
|
@@ -1049,8 +1058,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1049
1058
|
};
|
|
1050
1059
|
}
|
|
1051
1060
|
});
|
|
1052
|
-
const DefaultSearchFormContainer = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1053
|
-
const _sfc_main$
|
|
1061
|
+
const DefaultSearchFormContainer = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-570a1898"]]);
|
|
1062
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1054
1063
|
__name: "DefaultTableContainer",
|
|
1055
1064
|
setup(__props) {
|
|
1056
1065
|
const { token } = theme.useToken();
|
|
@@ -1064,8 +1073,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1064
1073
|
};
|
|
1065
1074
|
}
|
|
1066
1075
|
});
|
|
1067
|
-
const DefaultTableContainer = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1068
|
-
const _sfc_main$
|
|
1076
|
+
const DefaultTableContainer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-e5c97b2f"]]);
|
|
1077
|
+
const _sfc_main$6 = {};
|
|
1069
1078
|
const _hoisted_1$2 = {
|
|
1070
1079
|
focusable: "false",
|
|
1071
1080
|
"data-icon": "column-height",
|
|
@@ -1080,8 +1089,8 @@ function _sfc_render$1(_ctx, _cache) {
|
|
|
1080
1089
|
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
1090
|
])]);
|
|
1082
1091
|
}
|
|
1083
|
-
const ColumnHeightOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1084
|
-
const _sfc_main$
|
|
1092
|
+
const ColumnHeightOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$1]]);
|
|
1093
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1085
1094
|
__name: "SizeControl",
|
|
1086
1095
|
props: /* @__PURE__ */ mergeModels({
|
|
1087
1096
|
effectiveSize: { default: void 0 }
|
|
@@ -1138,8 +1147,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1138
1147
|
};
|
|
1139
1148
|
}
|
|
1140
1149
|
});
|
|
1141
|
-
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1142
|
-
const _sfc_main$
|
|
1150
|
+
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-950f061f"]]);
|
|
1151
|
+
const _sfc_main$4 = {};
|
|
1143
1152
|
const _hoisted_1$1 = {
|
|
1144
1153
|
focusable: "false",
|
|
1145
1154
|
"data-icon": "filter",
|
|
@@ -1154,8 +1163,8 @@ function _sfc_render(_ctx, _cache) {
|
|
|
1154
1163
|
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
1164
|
])]);
|
|
1156
1165
|
}
|
|
1157
|
-
const FilterOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1158
|
-
const _sfc_main$
|
|
1166
|
+
const FilterOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render]]);
|
|
1167
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1159
1168
|
__name: "ColumnControl",
|
|
1160
1169
|
props: {
|
|
1161
1170
|
columns: {},
|
|
@@ -1320,7 +1329,315 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1320
1329
|
};
|
|
1321
1330
|
}
|
|
1322
1331
|
});
|
|
1323
|
-
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1332
|
+
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-58650608"]]);
|
|
1333
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1334
|
+
...{ name: "TableEllipsisTooltip", inheritAttrs: false },
|
|
1335
|
+
__name: "TableEllipsisTooltip",
|
|
1336
|
+
props: {
|
|
1337
|
+
open: { type: Boolean, default: false },
|
|
1338
|
+
content: { default: "" },
|
|
1339
|
+
anchorStyle: { default: () => ({
|
|
1340
|
+
position: "fixed",
|
|
1341
|
+
pointerEvents: "none",
|
|
1342
|
+
opacity: 0
|
|
1343
|
+
}) },
|
|
1344
|
+
container: { type: Function, default: () => void 0 }
|
|
1345
|
+
},
|
|
1346
|
+
setup(__props) {
|
|
1347
|
+
const props = __props;
|
|
1348
|
+
const attrs = useAttrs();
|
|
1349
|
+
const HostTooltip = Tooltip;
|
|
1350
|
+
const tooltipRef = ref(null);
|
|
1351
|
+
const forceAlign = async () => {
|
|
1352
|
+
var _a;
|
|
1353
|
+
if (!props.open) return;
|
|
1354
|
+
await nextTick();
|
|
1355
|
+
const instance = tooltipRef.value;
|
|
1356
|
+
(_a = (instance == null ? void 0 : instance.forceAlign) ?? (instance == null ? void 0 : instance.forcePopupAlign)) == null ? void 0 : _a();
|
|
1357
|
+
};
|
|
1358
|
+
watch(() => props.anchorStyle, forceAlign, { deep: true });
|
|
1359
|
+
watch(
|
|
1360
|
+
() => props.open,
|
|
1361
|
+
(value) => {
|
|
1362
|
+
if (value) forceAlign();
|
|
1363
|
+
}
|
|
1364
|
+
);
|
|
1365
|
+
const getContainerNode = () => {
|
|
1366
|
+
var _a;
|
|
1367
|
+
const container = (_a = props.container) == null ? void 0 : _a.call(props);
|
|
1368
|
+
if (container) return container;
|
|
1369
|
+
return typeof document !== "undefined" ? document.body : void 0;
|
|
1370
|
+
};
|
|
1371
|
+
const getPopupContainer2 = () => getContainerNode() ?? document.body;
|
|
1372
|
+
return (_ctx, _cache) => {
|
|
1373
|
+
return openBlock(), createBlock(Teleport, {
|
|
1374
|
+
to: getContainerNode() ?? "body"
|
|
1375
|
+
}, [
|
|
1376
|
+
createVNode(unref(HostTooltip), mergeProps(unref(attrs), {
|
|
1377
|
+
ref_key: "tooltipRef",
|
|
1378
|
+
ref: tooltipRef,
|
|
1379
|
+
open: __props.open,
|
|
1380
|
+
title: __props.content,
|
|
1381
|
+
trigger: [],
|
|
1382
|
+
"get-popup-container": getPopupContainer2
|
|
1383
|
+
}), {
|
|
1384
|
+
default: withCtx(() => [
|
|
1385
|
+
createElementVNode("span", {
|
|
1386
|
+
class: "pro-table_ellipsis-tooltip-anchor",
|
|
1387
|
+
style: normalizeStyle(__props.anchorStyle),
|
|
1388
|
+
"aria-hidden": "true"
|
|
1389
|
+
}, null, 4)
|
|
1390
|
+
]),
|
|
1391
|
+
_: 1
|
|
1392
|
+
}, 16, ["open", "title"])
|
|
1393
|
+
], 8, ["to"]);
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
const ELLIPSIS_TOOLTIP_CELL_ATTR = "data-pro-table-ellipsis";
|
|
1398
|
+
const PRO_TABLE_ROOT_ATTR = "data-pro-table-root";
|
|
1399
|
+
const ANCHOR_BASE_STYLE = {
|
|
1400
|
+
position: "fixed",
|
|
1401
|
+
pointerEvents: "none",
|
|
1402
|
+
opacity: 0
|
|
1403
|
+
};
|
|
1404
|
+
const getCellText = (cell) => {
|
|
1405
|
+
const text = cell.innerText || cell.textContent || "";
|
|
1406
|
+
return text.replace(/\s+/g, " ").trim();
|
|
1407
|
+
};
|
|
1408
|
+
const measureCell = (cell) => {
|
|
1409
|
+
const text = getCellText(cell);
|
|
1410
|
+
return {
|
|
1411
|
+
text,
|
|
1412
|
+
overflow: Boolean(text) && cell.scrollWidth > cell.clientWidth
|
|
1413
|
+
};
|
|
1414
|
+
};
|
|
1415
|
+
function useEllipsisTooltip(rootRef, enabled, delay, leaveDelay) {
|
|
1416
|
+
const open = ref(false);
|
|
1417
|
+
const content = ref("");
|
|
1418
|
+
const anchorStyle = ref({
|
|
1419
|
+
...ANCHOR_BASE_STYLE
|
|
1420
|
+
});
|
|
1421
|
+
let activeCell = null;
|
|
1422
|
+
let pendingCell = null;
|
|
1423
|
+
let openTimer = null;
|
|
1424
|
+
let closeTimer = null;
|
|
1425
|
+
const clearOpenTimer = () => {
|
|
1426
|
+
if (openTimer === null) return;
|
|
1427
|
+
clearTimeout(openTimer);
|
|
1428
|
+
openTimer = null;
|
|
1429
|
+
pendingCell = null;
|
|
1430
|
+
};
|
|
1431
|
+
const clearCloseTimer = () => {
|
|
1432
|
+
if (closeTimer === null) return;
|
|
1433
|
+
clearTimeout(closeTimer);
|
|
1434
|
+
closeTimer = null;
|
|
1435
|
+
};
|
|
1436
|
+
const close = () => {
|
|
1437
|
+
clearOpenTimer();
|
|
1438
|
+
clearCloseTimer();
|
|
1439
|
+
open.value = false;
|
|
1440
|
+
activeCell = null;
|
|
1441
|
+
};
|
|
1442
|
+
const getEventRoot = (node) => {
|
|
1443
|
+
var _a;
|
|
1444
|
+
const element = node instanceof Element ? node : node == null ? void 0 : node.parentElement;
|
|
1445
|
+
return ((_a = element == null ? void 0 : element.closest) == null ? void 0 : _a.call(element, `[${PRO_TABLE_ROOT_ATTR}]`)) ?? null;
|
|
1446
|
+
};
|
|
1447
|
+
const getCellFromEvent = (event) => {
|
|
1448
|
+
var _a;
|
|
1449
|
+
const target = event.target;
|
|
1450
|
+
const cell = (_a = target == null ? void 0 : target.closest) == null ? void 0 : _a.call(target, `[${ELLIPSIS_TOOLTIP_CELL_ATTR}]`);
|
|
1451
|
+
if (!(cell instanceof HTMLElement)) return null;
|
|
1452
|
+
const root = rootRef.value;
|
|
1453
|
+
if (!root) return null;
|
|
1454
|
+
if (cell.closest(`[${PRO_TABLE_ROOT_ATTR}]`) !== root) return null;
|
|
1455
|
+
return cell;
|
|
1456
|
+
};
|
|
1457
|
+
const onMouseOver = (event) => {
|
|
1458
|
+
const cell = getCellFromEvent(event);
|
|
1459
|
+
if (!cell) return;
|
|
1460
|
+
clearCloseTimer();
|
|
1461
|
+
if (cell === activeCell || cell === pendingCell) return;
|
|
1462
|
+
close();
|
|
1463
|
+
const measurement = measureCell(cell);
|
|
1464
|
+
if (!measurement.overflow) return;
|
|
1465
|
+
const rect = cell.getBoundingClientRect();
|
|
1466
|
+
if (!rect.width || !rect.height) return;
|
|
1467
|
+
content.value = measurement.text;
|
|
1468
|
+
anchorStyle.value = {
|
|
1469
|
+
...ANCHOR_BASE_STYLE,
|
|
1470
|
+
left: `${rect.left}px`,
|
|
1471
|
+
top: `${rect.top}px`,
|
|
1472
|
+
width: `${rect.width}px`,
|
|
1473
|
+
height: `${rect.height}px`
|
|
1474
|
+
};
|
|
1475
|
+
pendingCell = cell;
|
|
1476
|
+
openTimer = setTimeout(
|
|
1477
|
+
() => {
|
|
1478
|
+
openTimer = null;
|
|
1479
|
+
pendingCell = null;
|
|
1480
|
+
if (!cell.isConnected) return;
|
|
1481
|
+
activeCell = cell;
|
|
1482
|
+
open.value = true;
|
|
1483
|
+
},
|
|
1484
|
+
Math.max(0, delay.value)
|
|
1485
|
+
);
|
|
1486
|
+
};
|
|
1487
|
+
const onMouseOut = (event) => {
|
|
1488
|
+
if (!activeCell && !pendingCell) return;
|
|
1489
|
+
const owner = activeCell ?? pendingCell;
|
|
1490
|
+
const target = event.target;
|
|
1491
|
+
if (!owner || !target || !owner.contains(target)) return;
|
|
1492
|
+
const related = event.relatedTarget;
|
|
1493
|
+
if (related && owner.contains(related)) {
|
|
1494
|
+
const relatedRoot = getEventRoot(related);
|
|
1495
|
+
if (!relatedRoot || relatedRoot === rootRef.value) return;
|
|
1496
|
+
close();
|
|
1497
|
+
return;
|
|
1498
|
+
}
|
|
1499
|
+
if (pendingCell) {
|
|
1500
|
+
close();
|
|
1501
|
+
return;
|
|
1502
|
+
}
|
|
1503
|
+
clearCloseTimer();
|
|
1504
|
+
const delayMs = Math.max(0, leaveDelay.value);
|
|
1505
|
+
if (delayMs === 0) {
|
|
1506
|
+
close();
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
closeTimer = setTimeout(() => {
|
|
1510
|
+
closeTimer = null;
|
|
1511
|
+
close();
|
|
1512
|
+
}, delayMs);
|
|
1513
|
+
};
|
|
1514
|
+
const onViewportChange = () => close();
|
|
1515
|
+
let listening = false;
|
|
1516
|
+
const addViewportListeners = () => {
|
|
1517
|
+
if (listening || typeof window === "undefined") return;
|
|
1518
|
+
listening = true;
|
|
1519
|
+
window.addEventListener("scroll", onViewportChange, true);
|
|
1520
|
+
window.addEventListener("resize", onViewportChange);
|
|
1521
|
+
};
|
|
1522
|
+
const removeViewportListeners = () => {
|
|
1523
|
+
if (!listening) return;
|
|
1524
|
+
listening = false;
|
|
1525
|
+
window.removeEventListener("scroll", onViewportChange, true);
|
|
1526
|
+
window.removeEventListener("resize", onViewportChange);
|
|
1527
|
+
};
|
|
1528
|
+
onDeactivated(close);
|
|
1529
|
+
onMounted(() => {
|
|
1530
|
+
if (enabled.value) addViewportListeners();
|
|
1531
|
+
});
|
|
1532
|
+
watch(enabled, (value) => {
|
|
1533
|
+
if (value) {
|
|
1534
|
+
addViewportListeners();
|
|
1535
|
+
} else {
|
|
1536
|
+
removeViewportListeners();
|
|
1537
|
+
close();
|
|
1538
|
+
}
|
|
1539
|
+
});
|
|
1540
|
+
onBeforeUnmount(() => {
|
|
1541
|
+
removeViewportListeners();
|
|
1542
|
+
clearOpenTimer();
|
|
1543
|
+
clearCloseTimer();
|
|
1544
|
+
});
|
|
1545
|
+
return {
|
|
1546
|
+
open,
|
|
1547
|
+
content,
|
|
1548
|
+
anchorStyle,
|
|
1549
|
+
onMouseOver,
|
|
1550
|
+
onMouseOut,
|
|
1551
|
+
close
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
function useEllipsisTooltipColumns(getColumns, globalEnabled = () => false) {
|
|
1555
|
+
const originalColumns = /* @__PURE__ */ new WeakMap();
|
|
1556
|
+
const registerColumnClone = (next, source) => {
|
|
1557
|
+
if (next !== source && isObjectItem(next) && !originalColumns.has(next)) {
|
|
1558
|
+
originalColumns.set(next, source);
|
|
1559
|
+
}
|
|
1560
|
+
return next;
|
|
1561
|
+
};
|
|
1562
|
+
const resolveOriginalColumn = (column) => {
|
|
1563
|
+
const raw = toRaw(column);
|
|
1564
|
+
const source = originalColumns.get(raw) ?? raw.__originColumn__;
|
|
1565
|
+
if (!isObjectItem(source)) return column;
|
|
1566
|
+
return originalColumns.get(toRaw(source)) ?? source;
|
|
1567
|
+
};
|
|
1568
|
+
const resolveSorterColumn = (sorter) => sorter && typeof sorter === "object" && sorter.column ? { ...sorter, column: resolveOriginalColumn(sorter.column) } : sorter;
|
|
1569
|
+
const transformColumns = (columns, global, ancestors = /* @__PURE__ */ new Set()) => {
|
|
1570
|
+
const list = [];
|
|
1571
|
+
let changed = false;
|
|
1572
|
+
let hasTooltip = false;
|
|
1573
|
+
let cycleSkipped = false;
|
|
1574
|
+
for (const column of columns) {
|
|
1575
|
+
if (!isObjectItem(column) || toValue(column.hidden)) {
|
|
1576
|
+
changed = true;
|
|
1577
|
+
continue;
|
|
1578
|
+
}
|
|
1579
|
+
let childChanged = false;
|
|
1580
|
+
let childColumns = column.children;
|
|
1581
|
+
let childHasTooltip = false;
|
|
1582
|
+
if (Array.isArray(column.children) && column.children.length > 0) {
|
|
1583
|
+
if (ancestors.has(column)) {
|
|
1584
|
+
changed = true;
|
|
1585
|
+
cycleSkipped = true;
|
|
1586
|
+
continue;
|
|
1587
|
+
}
|
|
1588
|
+
ancestors.add(column);
|
|
1589
|
+
const child = transformColumns(column.children, global, ancestors);
|
|
1590
|
+
ancestors.delete(column);
|
|
1591
|
+
childChanged = child.changed;
|
|
1592
|
+
childColumns = child.columns;
|
|
1593
|
+
childHasTooltip = child.hasTooltip;
|
|
1594
|
+
cycleSkipped = cycleSkipped || child.cycleSkipped;
|
|
1595
|
+
if (childColumns.length === 0 && !child.cycleSkipped) {
|
|
1596
|
+
changed = true;
|
|
1597
|
+
continue;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
const ellipsis = column.ellipsis;
|
|
1601
|
+
const explicit = ellipsis === false ? false : isPlainObject(ellipsis) ? ellipsis.showTooltip : void 0;
|
|
1602
|
+
const tooltipEnabled = explicit === false ? false : global || explicit === true;
|
|
1603
|
+
let next = column;
|
|
1604
|
+
if (childChanged || tooltipEnabled) {
|
|
1605
|
+
const { showTooltip: _showTooltip, ...restEllipsis } = isPlainObject(
|
|
1606
|
+
ellipsis
|
|
1607
|
+
) ? ellipsis : {};
|
|
1608
|
+
const customCell = column.customCell;
|
|
1609
|
+
next = {
|
|
1610
|
+
...column,
|
|
1611
|
+
...childChanged ? { children: childColumns } : {},
|
|
1612
|
+
...tooltipEnabled ? {
|
|
1613
|
+
ellipsis: { ...restEllipsis, showTitle: false },
|
|
1614
|
+
customCell: (record, rowIndex, cellColumn) => ({
|
|
1615
|
+
...(customCell == null ? void 0 : customCell(record, rowIndex, cellColumn)) ?? {},
|
|
1616
|
+
[ELLIPSIS_TOOLTIP_CELL_ATTR]: ""
|
|
1617
|
+
})
|
|
1618
|
+
} : {}
|
|
1619
|
+
};
|
|
1620
|
+
registerColumnClone(next, column);
|
|
1621
|
+
changed = true;
|
|
1622
|
+
}
|
|
1623
|
+
if (tooltipEnabled || childHasTooltip) hasTooltip = true;
|
|
1624
|
+
list.push(next);
|
|
1625
|
+
}
|
|
1626
|
+
return {
|
|
1627
|
+
columns: changed ? list : columns,
|
|
1628
|
+
changed,
|
|
1629
|
+
hasTooltip,
|
|
1630
|
+
cycleSkipped
|
|
1631
|
+
};
|
|
1632
|
+
};
|
|
1633
|
+
const state = computed(() => transformColumns(getColumns(), globalEnabled()));
|
|
1634
|
+
return {
|
|
1635
|
+
columns: computed(() => state.value.columns),
|
|
1636
|
+
hasTooltip: computed(() => state.value.hasTooltip),
|
|
1637
|
+
resolveOriginalColumn,
|
|
1638
|
+
resolveSorterColumn
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1324
1641
|
const _hoisted_1 = { class: "pro-table_header" };
|
|
1325
1642
|
const _hoisted_2 = {
|
|
1326
1643
|
key: 0,
|
|
@@ -1348,7 +1665,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1348
1665
|
immediateSearch: { type: Boolean, default: void 0 },
|
|
1349
1666
|
control: { type: [Boolean, Object], default: void 0 },
|
|
1350
1667
|
searchFormConfig: { default: void 0 },
|
|
1351
|
-
tableContainer: { type: [Object, Function, Boolean], default: void 0 }
|
|
1668
|
+
tableContainer: { type: [Object, Function, Boolean], default: void 0 },
|
|
1669
|
+
ellipsisTooltip: { type: [Boolean, Object], default: void 0 }
|
|
1352
1670
|
}, {
|
|
1353
1671
|
"size": {},
|
|
1354
1672
|
"sizeModifiers": {},
|
|
@@ -1384,6 +1702,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1384
1702
|
return rest;
|
|
1385
1703
|
});
|
|
1386
1704
|
const attrs = useReactiveAttrs();
|
|
1705
|
+
const rootRef = ref(null);
|
|
1387
1706
|
const size = useModel(__props, "size");
|
|
1388
1707
|
const loading = useModel(__props, "loading");
|
|
1389
1708
|
let searchSequence = 0;
|
|
@@ -1402,16 +1721,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1402
1721
|
if (props.search && attrs.onSearch) {
|
|
1403
1722
|
warnSearchConfig("duplicate");
|
|
1404
1723
|
}
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1724
|
+
const results = callListeners(search);
|
|
1725
|
+
if (!results.length) return;
|
|
1726
|
+
const promises = results.filter(isPromise);
|
|
1727
|
+
if (!promises.length) {
|
|
1408
1728
|
warnSearchConfig("not-promise");
|
|
1409
1729
|
return;
|
|
1410
1730
|
}
|
|
1411
1731
|
const seq = ++searchSequence;
|
|
1412
1732
|
loading.value = true;
|
|
1413
1733
|
try {
|
|
1414
|
-
await
|
|
1734
|
+
const settled = await Promise.allSettled(promises);
|
|
1735
|
+
const rejected = settled.find((item) => item.status === "rejected");
|
|
1736
|
+
if (rejected) throw rejected.reason;
|
|
1415
1737
|
} finally {
|
|
1416
1738
|
if (seq === searchSequence) {
|
|
1417
1739
|
loading.value = false;
|
|
@@ -1432,6 +1754,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1432
1754
|
"table"
|
|
1433
1755
|
];
|
|
1434
1756
|
const slots = useSlots();
|
|
1757
|
+
const slotsRef = shallowRef(slots);
|
|
1758
|
+
onUpdated(() => {
|
|
1759
|
+
triggerRef(slotsRef);
|
|
1760
|
+
});
|
|
1435
1761
|
const forwardedSlotNames = () => Object.keys(slots).filter(
|
|
1436
1762
|
(name) => !customSlotNames.includes(name)
|
|
1437
1763
|
);
|
|
@@ -1471,19 +1797,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1471
1797
|
const effectiveSize = computed(() => {
|
|
1472
1798
|
return size.value ?? injectAttrs.value.size;
|
|
1473
1799
|
});
|
|
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
1800
|
const computedTableContainer = computed(() => {
|
|
1488
1801
|
const container = props.tableContainer ?? injectProps.value.tableContainer ?? DefaultTableContainer;
|
|
1489
1802
|
return container ? container : void 0;
|
|
@@ -1504,45 +1817,102 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1504
1817
|
width: 80,
|
|
1505
1818
|
customRender: ({ index: index2 }) => getIndex(index2)
|
|
1506
1819
|
}));
|
|
1507
|
-
const
|
|
1820
|
+
const slotIndexRender = ({ index: index2 }) => getIndex(index2);
|
|
1821
|
+
const columnSource = computed(() => {
|
|
1508
1822
|
var _a;
|
|
1509
|
-
|
|
1510
|
-
const needIndex = props.addIndexColumn ?? injectProps.value.addIndexColumn;
|
|
1511
|
-
return needIndex ? [indexColumn.value, ...cols] : cols;
|
|
1823
|
+
return resolveOwnedProp("columns") ?? toValue((_a = props.table) == null ? void 0 : _a.columns) ?? [];
|
|
1512
1824
|
});
|
|
1513
|
-
const
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1825
|
+
const slotColumnsMode = computed(
|
|
1826
|
+
() => !hasExplicitColumns.value && Boolean(slotsRef.value.default) && columnSource.value.length === 0
|
|
1827
|
+
);
|
|
1828
|
+
const indexEnabled = computed(
|
|
1829
|
+
() => Boolean(props.addIndexColumn ?? injectProps.value.addIndexColumn)
|
|
1830
|
+
);
|
|
1831
|
+
const computedColumns = computed(() => {
|
|
1832
|
+
if (slotColumnsMode.value) return [];
|
|
1833
|
+
return indexEnabled.value ? [indexColumn.value, ...columnSource.value] : columnSource.value;
|
|
1834
|
+
});
|
|
1835
|
+
const ellipsisTooltipValue = computed(
|
|
1836
|
+
() => props.ellipsisTooltip ?? injectProps.value.ellipsisTooltip
|
|
1837
|
+
);
|
|
1838
|
+
const ellipsisTooltipConfig = computed(
|
|
1839
|
+
() => typeof ellipsisTooltipValue.value === "object" && ellipsisTooltipValue.value ? ellipsisTooltipValue.value : {}
|
|
1840
|
+
);
|
|
1841
|
+
const ellipsisTooltipGlobal = computed(
|
|
1842
|
+
() => Boolean(ellipsisTooltipValue.value)
|
|
1843
|
+
);
|
|
1844
|
+
const {
|
|
1845
|
+
columns: visibleComputedColumns,
|
|
1846
|
+
hasTooltip: ellipsisTooltipEnabled,
|
|
1847
|
+
resolveOriginalColumn,
|
|
1848
|
+
resolveSorterColumn
|
|
1849
|
+
} = useEllipsisTooltipColumns(
|
|
1850
|
+
() => computedColumns.value,
|
|
1851
|
+
() => ellipsisTooltipGlobal.value
|
|
1852
|
+
);
|
|
1853
|
+
const hostColumns = computed(
|
|
1854
|
+
() => slotColumnsMode.value ? void 0 : visibleComputedColumns.value
|
|
1855
|
+
);
|
|
1856
|
+
const computedTableProps = computed(() => {
|
|
1857
|
+
const merged = {
|
|
1858
|
+
...injectAttrs.value,
|
|
1859
|
+
...omitBy(
|
|
1860
|
+
pick(camelAttrs.value, tableProperties),
|
|
1861
|
+
(value) => value === void 0
|
|
1862
|
+
)
|
|
1863
|
+
};
|
|
1864
|
+
delete merged.onChange;
|
|
1865
|
+
const resizeColumn = merged.onResizeColumn;
|
|
1866
|
+
if (typeof resizeColumn === "function") {
|
|
1867
|
+
merged.onResizeColumn = (width, column) => resizeColumn(width, resolveOriginalColumn(column));
|
|
1536
1868
|
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1869
|
+
merged.size = effectiveSize.value;
|
|
1870
|
+
merged.loading = void 0;
|
|
1871
|
+
return merged;
|
|
1872
|
+
});
|
|
1873
|
+
const ellipsisTooltipContainer = computed(() => {
|
|
1874
|
+
const getPopupContainer2 = ellipsisTooltipConfig.value.getPopupContainer;
|
|
1875
|
+
if (!getPopupContainer2) return void 0;
|
|
1876
|
+
return () => {
|
|
1877
|
+
if (typeof document === "undefined") return void 0;
|
|
1878
|
+
const root = rootRef.value ?? document.body;
|
|
1879
|
+
return getPopupContainer2(root) ?? document.body;
|
|
1880
|
+
};
|
|
1881
|
+
});
|
|
1882
|
+
const ellipsisTooltipDelay = computed(
|
|
1883
|
+
() => Math.max(0, (ellipsisTooltipConfig.value.mouseEnterDelay ?? 0.2) * 1e3)
|
|
1884
|
+
);
|
|
1885
|
+
const ellipsisTooltipLeaveDelay = computed(
|
|
1886
|
+
() => Math.max(0, (ellipsisTooltipConfig.value.mouseLeaveDelay ?? 0.1) * 1e3)
|
|
1887
|
+
);
|
|
1888
|
+
const ellipsisTooltipProps = computed(() => {
|
|
1889
|
+
const config2 = ellipsisTooltipConfig.value;
|
|
1890
|
+
const {
|
|
1891
|
+
getPopupContainer: _getPopupContainer,
|
|
1892
|
+
mouseEnterDelay: _mouseEnterDelay,
|
|
1893
|
+
mouseLeaveDelay: _mouseLeaveDelay,
|
|
1894
|
+
...rest
|
|
1895
|
+
} = config2;
|
|
1896
|
+
return rest;
|
|
1541
1897
|
});
|
|
1898
|
+
const {
|
|
1899
|
+
open: ellipsisTooltipOpen,
|
|
1900
|
+
content: ellipsisTooltipContent,
|
|
1901
|
+
anchorStyle: ellipsisTooltipAnchorStyle,
|
|
1902
|
+
onMouseOver: onEllipsisMouseOver,
|
|
1903
|
+
onMouseOut: onEllipsisMouseOut,
|
|
1904
|
+
close: closeEllipsisTooltip
|
|
1905
|
+
} = useEllipsisTooltip(
|
|
1906
|
+
rootRef,
|
|
1907
|
+
ellipsisTooltipEnabled,
|
|
1908
|
+
ellipsisTooltipDelay,
|
|
1909
|
+
ellipsisTooltipLeaveDelay
|
|
1910
|
+
);
|
|
1542
1911
|
const computedDataSource = computed(() => {
|
|
1543
1912
|
var _a;
|
|
1544
1913
|
return resolveOwnedProp("dataSource") ?? toValue((_a = props.table) == null ? void 0 : _a.dataSource) ?? [];
|
|
1545
1914
|
});
|
|
1915
|
+
watch([visibleComputedColumns, computedDataSource], closeEllipsisTooltip);
|
|
1546
1916
|
const computedPagination = computed(() => {
|
|
1547
1917
|
var _a, _b, _c;
|
|
1548
1918
|
const attrsPagination = resolveOwnedProp("pagination");
|
|
@@ -1572,7 +1942,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1572
1942
|
);
|
|
1573
1943
|
};
|
|
1574
1944
|
const onTableChange = (...args) => {
|
|
1575
|
-
var _a, _b, _c
|
|
1945
|
+
var _a, _b, _c;
|
|
1576
1946
|
(_b = (_a = props.table) == null ? void 0 : _a.setPageParam) == null ? void 0 : _b.call(_a, args[0]);
|
|
1577
1947
|
const nextPagination = computedPagination.value;
|
|
1578
1948
|
if (((_c = props.table) == null ? void 0 : _c.pageParam) && nextPagination !== false) {
|
|
@@ -1584,8 +1954,18 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1584
1954
|
);
|
|
1585
1955
|
if (shadowed.length) warnPaginationShadow(shadowed);
|
|
1586
1956
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1957
|
+
const nextArgs = [...args];
|
|
1958
|
+
const sorterArg = nextArgs[2];
|
|
1959
|
+
if (Array.isArray(sorterArg)) {
|
|
1960
|
+
nextArgs[2] = sorterArg.map(resolveSorterColumn);
|
|
1961
|
+
} else if (sorterArg) {
|
|
1962
|
+
nextArgs[2] = resolveSorterColumn(sorterArg);
|
|
1963
|
+
}
|
|
1964
|
+
try {
|
|
1965
|
+
callListeners(attrs.onChange ?? injectProps.value.onChange, ...nextArgs);
|
|
1966
|
+
} finally {
|
|
1967
|
+
_search();
|
|
1968
|
+
}
|
|
1589
1969
|
};
|
|
1590
1970
|
const searchFormVisible = computed(() => {
|
|
1591
1971
|
var _a, _b, _c, _d;
|
|
@@ -1624,10 +2004,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1624
2004
|
});
|
|
1625
2005
|
return (_ctx, _cache) => {
|
|
1626
2006
|
return openBlock(), createElementBlock("div", {
|
|
2007
|
+
ref_key: "rootRef",
|
|
2008
|
+
ref: rootRef,
|
|
1627
2009
|
class: normalizeClass(["pro-table", unref(attrs).class]),
|
|
1628
|
-
|
|
2010
|
+
"data-pro-table-root": "",
|
|
2011
|
+
style: normalizeStyle(unref(attrs).style),
|
|
2012
|
+
onMouseover: _cache[1] || (_cache[1] = //@ts-ignore
|
|
2013
|
+
(...args) => unref(onEllipsisMouseOver) && unref(onEllipsisMouseOver)(...args)),
|
|
2014
|
+
onMouseout: _cache[2] || (_cache[2] = //@ts-ignore
|
|
2015
|
+
(...args) => unref(onEllipsisMouseOut) && unref(onEllipsisMouseOut)(...args))
|
|
1629
2016
|
}, [
|
|
1630
|
-
searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(_sfc_main$
|
|
2017
|
+
searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(_sfc_main$g, {
|
|
1631
2018
|
key: 0,
|
|
1632
2019
|
component: computedSearchFormConfig.value.container
|
|
1633
2020
|
}, {
|
|
@@ -1650,7 +2037,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1650
2037
|
}),
|
|
1651
2038
|
_: 3
|
|
1652
2039
|
}, 8, ["component"])) : createCommentVNode("", true),
|
|
1653
|
-
createVNode(_sfc_main$
|
|
2040
|
+
createVNode(_sfc_main$g, { component: computedTableContainer.value }, {
|
|
1654
2041
|
default: withCtx(() => [
|
|
1655
2042
|
createElementVNode("div", _hoisted_1, [
|
|
1656
2043
|
_ctx.$slots["button-bar"] ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
@@ -1675,7 +2062,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1675
2062
|
])) : createCommentVNode("", true)
|
|
1676
2063
|
]),
|
|
1677
2064
|
renderSlot(_ctx.$slots, "table", normalizeProps(guardReactiveProps({
|
|
1678
|
-
columns: visibleComputedColumns
|
|
2065
|
+
columns: unref(visibleComputedColumns),
|
|
1679
2066
|
dataSource: computedDataSource.value,
|
|
1680
2067
|
pagination: computedPagination.value,
|
|
1681
2068
|
loading: loading.value,
|
|
@@ -1684,7 +2071,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1684
2071
|
})), () => [
|
|
1685
2072
|
createVNode(unref(Table), mergeProps({ class: "pro-table_content" }, computedTableProps.value, {
|
|
1686
2073
|
loading: loading.value,
|
|
1687
|
-
columns:
|
|
2074
|
+
columns: hostColumns.value,
|
|
1688
2075
|
"data-source": computedDataSource.value,
|
|
1689
2076
|
pagination: computedPagination.value,
|
|
1690
2077
|
onChange: onTableChange
|
|
@@ -1693,7 +2080,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1693
2080
|
return {
|
|
1694
2081
|
name,
|
|
1695
2082
|
fn: withCtx((scoped) => [
|
|
1696
|
-
|
|
2083
|
+
name === "default" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2084
|
+
slotColumnsMode.value && indexEnabled.value ? (openBlock(), createBlock(unref(TableColumn), {
|
|
2085
|
+
key: "__INDEX__",
|
|
2086
|
+
title: unref(t)("table.index"),
|
|
2087
|
+
width: 80,
|
|
2088
|
+
"data-index": "__INDEX__",
|
|
2089
|
+
"custom-render": slotIndexRender
|
|
2090
|
+
}, null, 8, ["title"])) : createCommentVNode("", true),
|
|
2091
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(scoped || {})), void 0, true)
|
|
2092
|
+
], 64)) : isSlotRenderable(name, scoped) ? renderSlot(_ctx.$slots, name, normalizeProps(mergeProps({ key: 1 }, scoped)), void 0, true) : createCommentVNode("", true)
|
|
1697
2093
|
])
|
|
1698
2094
|
};
|
|
1699
2095
|
})
|
|
@@ -1701,12 +2097,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1701
2097
|
], true)
|
|
1702
2098
|
]),
|
|
1703
2099
|
_: 3
|
|
1704
|
-
}, 8, ["component"])
|
|
1705
|
-
|
|
2100
|
+
}, 8, ["component"]),
|
|
2101
|
+
unref(ellipsisTooltipEnabled) ? (openBlock(), createBlock(_sfc_main$2, mergeProps({
|
|
2102
|
+
key: 1,
|
|
2103
|
+
open: unref(ellipsisTooltipOpen),
|
|
2104
|
+
content: unref(ellipsisTooltipContent),
|
|
2105
|
+
"anchor-style": unref(ellipsisTooltipAnchorStyle),
|
|
2106
|
+
container: ellipsisTooltipContainer.value
|
|
2107
|
+
}, ellipsisTooltipProps.value), null, 16, ["open", "content", "anchor-style", "container"])) : createCommentVNode("", true)
|
|
2108
|
+
], 38);
|
|
1706
2109
|
};
|
|
1707
2110
|
}
|
|
1708
2111
|
});
|
|
1709
|
-
const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
2112
|
+
const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-1d90bfc7"]]);
|
|
1710
2113
|
function useTable(params) {
|
|
1711
2114
|
return useTable$1(params);
|
|
1712
2115
|
}
|
|
@@ -1727,6 +2130,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1727
2130
|
(key) => {
|
|
1728
2131
|
const config = INJECT_CONFIG[key];
|
|
1729
2132
|
const ignored = config.ignoreProps;
|
|
2133
|
+
const parentConfig = inject(
|
|
2134
|
+
config.injectionKey,
|
|
2135
|
+
void 0
|
|
2136
|
+
);
|
|
1730
2137
|
provide(
|
|
1731
2138
|
config.injectionKey,
|
|
1732
2139
|
computed(
|
|
@@ -1735,6 +2142,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1735
2142
|
return omit(
|
|
1736
2143
|
{
|
|
1737
2144
|
...config.default,
|
|
2145
|
+
...toValue(parentConfig) || {},
|
|
1738
2146
|
...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
|
|
1739
2147
|
},
|
|
1740
2148
|
ignored ?? []
|
|
@@ -1748,12 +2156,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1748
2156
|
Object.keys(props.componentVars).forEach((key) => {
|
|
1749
2157
|
if (!(key in INJECT_CONFIG)) {
|
|
1750
2158
|
const config = ensureInjectConfig(key);
|
|
2159
|
+
const parentConfig = inject(
|
|
2160
|
+
config.injectionKey,
|
|
2161
|
+
void 0
|
|
2162
|
+
);
|
|
1751
2163
|
provide(
|
|
1752
2164
|
config.injectionKey,
|
|
1753
2165
|
computed(() => {
|
|
1754
2166
|
var _a;
|
|
1755
2167
|
return {
|
|
1756
|
-
...
|
|
2168
|
+
...toValue(parentConfig) || {},
|
|
1757
2169
|
...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
|
|
1758
2170
|
};
|
|
1759
2171
|
})
|
|
@@ -1761,17 +2173,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1761
2173
|
}
|
|
1762
2174
|
});
|
|
1763
2175
|
}
|
|
2176
|
+
const parentComponentVars = inject(INJECT_COMPONENT_VARS, void 0);
|
|
1764
2177
|
provide(
|
|
1765
2178
|
INJECT_COMPONENT_VARS,
|
|
1766
|
-
computed(
|
|
2179
|
+
computed(
|
|
2180
|
+
() => mergeComponentVars(
|
|
2181
|
+
toValue(parentComponentVars),
|
|
2182
|
+
props.componentVars
|
|
2183
|
+
)
|
|
2184
|
+
)
|
|
1767
2185
|
);
|
|
2186
|
+
const parentComponents = inject(INJECT_COMPONENTS, void 0);
|
|
1768
2187
|
provide(
|
|
1769
2188
|
INJECT_COMPONENTS,
|
|
1770
|
-
computed(() =>
|
|
2189
|
+
computed(() => ({
|
|
2190
|
+
...toValue(parentComponents) || {},
|
|
2191
|
+
...props.componentMap ?? {}
|
|
2192
|
+
}))
|
|
1771
2193
|
);
|
|
2194
|
+
const parentLocale = inject(LOCALE_INJECT_KEY, void 0);
|
|
1772
2195
|
provide(
|
|
1773
2196
|
LOCALE_INJECT_KEY,
|
|
1774
|
-
computed(() =>
|
|
2197
|
+
computed(() => ({
|
|
2198
|
+
...toValue(parentLocale) || {},
|
|
2199
|
+
...props.locale ?? {}
|
|
2200
|
+
}))
|
|
1775
2201
|
);
|
|
1776
2202
|
return (_ctx, _cache) => {
|
|
1777
2203
|
return renderSlot(_ctx.$slots, "default");
|
|
@@ -1794,7 +2220,7 @@ const index = {
|
|
|
1794
2220
|
* ```
|
|
1795
2221
|
*/
|
|
1796
2222
|
install(app) {
|
|
1797
|
-
app.component(_sfc_main$
|
|
2223
|
+
app.component(_sfc_main$b.name, _sfc_main$b);
|
|
1798
2224
|
app.component(ProTable.name, ProTable);
|
|
1799
2225
|
app.component(
|
|
1800
2226
|
_sfc_main.name ?? "ProComponentProvider",
|
|
@@ -1803,12 +2229,12 @@ const index = {
|
|
|
1803
2229
|
}
|
|
1804
2230
|
};
|
|
1805
2231
|
export {
|
|
1806
|
-
_sfc_main$
|
|
2232
|
+
_sfc_main$g as ContainerFragment,
|
|
1807
2233
|
LOCALE_INJECT_KEY,
|
|
1808
2234
|
_sfc_main as ProComponentProvider,
|
|
1809
|
-
_sfc_main$
|
|
2235
|
+
_sfc_main$b as ProForm,
|
|
1810
2236
|
ProTable,
|
|
1811
|
-
_sfc_main$
|
|
2237
|
+
_sfc_main$f as SlotComponent,
|
|
1812
2238
|
index as default,
|
|
1813
2239
|
enUS2 as enUS,
|
|
1814
2240
|
useFields,
|