@qin-ui/antd-vue-pro 2.2.4 → 2.3.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 +22 -11
- package/api.json +7 -1
- package/es/antd-vue-pro.css +13 -13
- package/es/components/component-provider/components/index.vue.d.ts +8 -0
- package/es/components/component-provider/components/index.vue.d.ts.map +1 -1
- package/es/components/component-provider/constants/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 +3 -1
- package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -1
- package/es/components/table/components/ColumnControl.vue.d.ts +2 -1
- package/es/components/table/components/ColumnControl.vue.d.ts.map +1 -1
- package/es/components/table/components/ProTable.vue.d.ts +3 -2
- package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
- package/es/components/table/components/SearchForm.vue.d.ts.map +1 -1
- package/es/components/table/components/SizeControl.vue.d.ts.map +1 -1
- package/es/components/table/types/index.d.ts +25 -0
- package/es/components/table/types/index.d.ts.map +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.d.ts.map +1 -1
- package/es/index.js +201 -103
- package/es/index.js.map +1 -1
- package/es/locale/index.d.ts +28 -0
- package/es/locale/index.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/components/component-provider/components/index.vue +16 -1
- package/src/components/component-provider/constants/index.ts +4 -7
- package/src/components/form/components/BaseField/index.vue +10 -4
- package/src/components/form/components/BaseField/utils/index.ts +33 -3
- package/src/components/table/components/ColumnControl.vue +95 -38
- package/src/components/table/components/ProTable.vue +47 -13
- package/src/components/table/components/SearchForm.vue +6 -3
- package/src/components/table/components/SizeControl.vue +9 -5
- package/src/components/table/types/index.ts +26 -0
- package/src/index.ts +1 -0
- package/src/locale/index.ts +71 -0
package/es/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./antd-vue-pro.css";
|
|
2
|
-
import { defineComponent, computed, provide, renderSlot, inject, mergeProps, toValue, normalizeProps, guardReactiveProps, resolveComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString, useSlots, watchEffect, createElementVNode, watch, normalizeStyle, useModel,
|
|
3
|
-
import { InjectionPathKey, isPlainObject, getObject, toPath, useForm as useForm$1, omit, cloneDeep, InjectionFormKey, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, pick, useTable as useTable$1 } from "@qin-ui/pro-components-core";
|
|
4
|
-
import { useFormData } from "@qin-ui/pro-components-core";
|
|
2
|
+
import { defineComponent, computed, provide, renderSlot, inject, mergeProps, toValue, normalizeProps, guardReactiveProps, resolveComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString, useSlots, watchEffect, createElementVNode, watch, normalizeStyle, useModel, onMounted, mergeModels, normalizeClass, nextTick } from "vue";
|
|
3
|
+
import { InjectionPathKey, isPlainObject, getObject, toPath, useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, omit, cloneDeep, InjectionFormKey, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, pick, useTable as useTable$1 } from "@qin-ui/pro-components-core";
|
|
4
|
+
import { enUS as enUS2, useFormData, zhCN as zhCN2, zhTW as zhTW2 } from "@qin-ui/pro-components-core";
|
|
5
5
|
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";
|
|
6
6
|
import { formItemProps, useInjectFormItemContext } from "ant-design-vue/es/form";
|
|
7
7
|
import { colProps } from "ant-design-vue/es/grid/Col";
|
|
8
|
-
import { useProviderDisabled, useInjectDisabled } from "ant-design-vue/es/config-provider/DisabledContext";
|
|
9
8
|
import { useConfigContextInject } from "ant-design-vue/es/config-provider/context";
|
|
9
|
+
import { useProviderDisabled, useInjectDisabled } from "ant-design-vue/es/config-provider/DisabledContext";
|
|
10
10
|
import { tableProps } from "ant-design-vue/es/table";
|
|
11
11
|
const getPopupContainer = (triggerNode) => triggerNode.closest("form[class*='-form']");
|
|
12
12
|
const INJECT_COMPONENTS = Symbol("INJECT_COMPONENTS");
|
|
@@ -15,7 +15,6 @@ const INJECT_CONFIG = {
|
|
|
15
15
|
injectionKey: Symbol(""),
|
|
16
16
|
default: {
|
|
17
17
|
pagination: {
|
|
18
|
-
showTotal: (total) => `共 ${total} 条`,
|
|
19
18
|
showSizeChanger: true,
|
|
20
19
|
pageSizeOptions: ["10", "20", "30", "40", "50", "100"],
|
|
21
20
|
showQuickJumper: true
|
|
@@ -39,7 +38,7 @@ const INJECT_CONFIG = {
|
|
|
39
38
|
// field
|
|
40
39
|
input: {
|
|
41
40
|
injectionKey: Symbol(""),
|
|
42
|
-
default: { maxlength: 100, allowClear: true
|
|
41
|
+
default: { maxlength: 100, allowClear: true }
|
|
43
42
|
},
|
|
44
43
|
textarea: {
|
|
45
44
|
injectionKey: Symbol(""),
|
|
@@ -47,13 +46,12 @@ const INJECT_CONFIG = {
|
|
|
47
46
|
maxlength: 200,
|
|
48
47
|
autoSize: { minRows: 3, maxRows: 6 },
|
|
49
48
|
showCount: true,
|
|
50
|
-
allowClear: true
|
|
51
|
-
placeholder: "请输入"
|
|
49
|
+
allowClear: true
|
|
52
50
|
}
|
|
53
51
|
},
|
|
54
52
|
"input-password": {
|
|
55
53
|
injectionKey: Symbol(""),
|
|
56
|
-
default: { maxlength: 100, allowClear: true
|
|
54
|
+
default: { maxlength: 100, allowClear: true }
|
|
57
55
|
},
|
|
58
56
|
"input-search": {
|
|
59
57
|
injectionKey: Symbol(""),
|
|
@@ -65,17 +63,16 @@ const INJECT_CONFIG = {
|
|
|
65
63
|
max: 10 ** 15 - 1,
|
|
66
64
|
min: -1000000000000001,
|
|
67
65
|
controls: false,
|
|
68
|
-
placeholder: "请输入",
|
|
69
66
|
style: { width: "100%" }
|
|
70
67
|
}
|
|
71
68
|
},
|
|
72
69
|
select: {
|
|
73
70
|
injectionKey: Symbol(""),
|
|
74
|
-
default: { allowClear: true,
|
|
71
|
+
default: { allowClear: true, getPopupContainer }
|
|
75
72
|
},
|
|
76
73
|
cascader: {
|
|
77
74
|
injectionKey: Symbol(""),
|
|
78
|
-
default: { allowClear: true,
|
|
75
|
+
default: { allowClear: true, getPopupContainer }
|
|
79
76
|
},
|
|
80
77
|
"date-picker": {
|
|
81
78
|
injectionKey: Symbol(""),
|
|
@@ -384,18 +381,51 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
384
381
|
function useForm(...args) {
|
|
385
382
|
return useForm$1(...args);
|
|
386
383
|
}
|
|
387
|
-
const
|
|
384
|
+
const PLACEHOLDER_KEYS = {
|
|
385
|
+
input: "input.placeholder",
|
|
386
|
+
textarea: "input.placeholder",
|
|
387
|
+
"input-password": "input.placeholder",
|
|
388
|
+
"input-number": "input.placeholder",
|
|
389
|
+
select: "select.placeholder",
|
|
390
|
+
cascader: "select.placeholder"
|
|
391
|
+
};
|
|
392
|
+
const getPlaceholderProps = (key, injectProps, t) => {
|
|
393
|
+
const placeholderKey = PLACEHOLDER_KEYS[key];
|
|
394
|
+
if (!placeholderKey || injectProps.placeholder !== void 0) return {};
|
|
395
|
+
return { placeholder: t(placeholderKey) };
|
|
396
|
+
};
|
|
397
|
+
const getInitProps = (field, t) => {
|
|
388
398
|
const { component } = field;
|
|
389
399
|
const picker = component === "date-picker" ? "" : field.picker;
|
|
390
400
|
if (typeof component === "string") {
|
|
391
401
|
const k = [component, picker].filter(Boolean).join(".");
|
|
392
402
|
const config = getInjectConfig(k);
|
|
393
|
-
if (!config) return {};
|
|
403
|
+
if (!config) return getPlaceholderProps(k, {}, t);
|
|
394
404
|
const injectProps = inject(config.injectionKey, config.default);
|
|
395
|
-
return injectProps;
|
|
405
|
+
return { ...injectProps, ...getPlaceholderProps(k, injectProps, t) };
|
|
396
406
|
}
|
|
397
407
|
return {};
|
|
398
408
|
};
|
|
409
|
+
const LOCALE_INJECT_KEY = Symbol("pro-locale");
|
|
410
|
+
const useLocale = () => {
|
|
411
|
+
const config = useConfigContextInject();
|
|
412
|
+
const override = inject(LOCALE_INJECT_KEY, void 0);
|
|
413
|
+
const lang = computed(
|
|
414
|
+
() => {
|
|
415
|
+
var _a, _b;
|
|
416
|
+
return resolveLocaleName((_b = (_a = config.locale) == null ? void 0 : _a.value) == null ? void 0 : _b.locale);
|
|
417
|
+
}
|
|
418
|
+
);
|
|
419
|
+
const pack = computed(
|
|
420
|
+
() => lang.value === "zh-TW" ? zhTW : lang.value === "en-US" ? enUS : zhCN
|
|
421
|
+
);
|
|
422
|
+
const t = (key, params) => {
|
|
423
|
+
const overrides = toValue(override);
|
|
424
|
+
const text = (overrides == null ? void 0 : overrides[key]) ?? pack.value[key] ?? key;
|
|
425
|
+
return format(text, params);
|
|
426
|
+
};
|
|
427
|
+
return { t, lang };
|
|
428
|
+
};
|
|
399
429
|
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
400
430
|
...{ name: "BaseField", inheritAttrs: false },
|
|
401
431
|
__name: "index",
|
|
@@ -404,6 +434,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
404
434
|
path: { default: "" }
|
|
405
435
|
},
|
|
406
436
|
setup(__props, { expose: __expose }) {
|
|
437
|
+
const { t } = useLocale();
|
|
407
438
|
const form = useForm(false);
|
|
408
439
|
const { getFormData, setFormData } = form;
|
|
409
440
|
const componentRef = ref();
|
|
@@ -440,10 +471,13 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
440
471
|
});
|
|
441
472
|
const parentDisabled = useInjectDisabled();
|
|
442
473
|
const groupedAttrs = computed(() => {
|
|
443
|
-
const initProps = getInitProps(
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
474
|
+
const initProps = getInitProps(
|
|
475
|
+
{
|
|
476
|
+
component: __props.component,
|
|
477
|
+
picker: attrs.picker
|
|
478
|
+
},
|
|
479
|
+
t
|
|
480
|
+
);
|
|
447
481
|
const mergedProps = mergeProps(
|
|
448
482
|
initProps,
|
|
449
483
|
attrs,
|
|
@@ -625,6 +659,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
625
659
|
},
|
|
626
660
|
emits: ["search", "reset"],
|
|
627
661
|
setup(__props, { emit: __emit }) {
|
|
662
|
+
const { t } = useLocale();
|
|
628
663
|
const emit = __emit;
|
|
629
664
|
const proFormHeight = ref("unset");
|
|
630
665
|
const collapseHeight = ref(0);
|
|
@@ -751,9 +786,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
751
786
|
class: "pro-table_search-form_reset-button",
|
|
752
787
|
onClick: onReset
|
|
753
788
|
}, {
|
|
754
|
-
default: withCtx(() => [
|
|
755
|
-
createTextVNode("
|
|
756
|
-
])
|
|
789
|
+
default: withCtx(() => [
|
|
790
|
+
createTextVNode(toDisplayString(unref(t)("table.reset")), 1)
|
|
791
|
+
]),
|
|
757
792
|
_: 1
|
|
758
793
|
}))
|
|
759
794
|
], 64)) : createCommentVNode("", true)
|
|
@@ -770,9 +805,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
770
805
|
"html-type": "submit",
|
|
771
806
|
onClick: onSearch
|
|
772
807
|
}, {
|
|
773
|
-
default: withCtx(() => [
|
|
774
|
-
createTextVNode("
|
|
775
|
-
])
|
|
808
|
+
default: withCtx(() => [
|
|
809
|
+
createTextVNode(toDisplayString(unref(t)("table.query")), 1)
|
|
810
|
+
]),
|
|
776
811
|
_: 1
|
|
777
812
|
}))
|
|
778
813
|
], 64)) : createCommentVNode("", true)
|
|
@@ -790,7 +825,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
790
825
|
onClick: changeExpandStatus
|
|
791
826
|
}, {
|
|
792
827
|
default: withCtx(() => [
|
|
793
|
-
createTextVNode(toDisplayString(expandStatus.value ? "
|
|
828
|
+
createTextVNode(toDisplayString(expandStatus.value ? unref(t)("table.collapse") : unref(t)("table.expand")) + " ", 1),
|
|
794
829
|
createVNode(DownOutlined, {
|
|
795
830
|
class: "transition",
|
|
796
831
|
style: normalizeStyle([{ "margin-left": "4px" }, { transform: `rotate(${expandStatus.value ? -180 : 0}deg)` }])
|
|
@@ -809,7 +844,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
809
844
|
};
|
|
810
845
|
}
|
|
811
846
|
});
|
|
812
|
-
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-
|
|
847
|
+
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-5b71a5b1"]]);
|
|
813
848
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
814
849
|
__name: "DefaultSearchFormContainer",
|
|
815
850
|
setup(__props) {
|
|
@@ -865,17 +900,18 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
865
900
|
emits: ["update:size"],
|
|
866
901
|
setup(__props) {
|
|
867
902
|
var _a;
|
|
903
|
+
const { t } = useLocale();
|
|
868
904
|
const configContext = useConfigContextInject();
|
|
869
905
|
const size = useModel(__props, "size");
|
|
870
906
|
size.value = size.value ?? ((_a = configContext.componentSize) == null ? void 0 : _a.value) ?? "large";
|
|
871
907
|
const onSizeChange = (val) => {
|
|
872
908
|
size.value = val.key;
|
|
873
909
|
};
|
|
874
|
-
const sizeOptions = [
|
|
875
|
-
{ label: "
|
|
876
|
-
{ label: "
|
|
877
|
-
{ label: "
|
|
878
|
-
];
|
|
910
|
+
const sizeOptions = computed(() => [
|
|
911
|
+
{ label: t("table.sizeDefault"), key: "large" },
|
|
912
|
+
{ label: t("table.sizeMiddle"), key: "middle" },
|
|
913
|
+
{ label: t("table.sizeCompact"), key: "small" }
|
|
914
|
+
]);
|
|
879
915
|
return (_ctx, _cache) => {
|
|
880
916
|
return openBlock(), createBlock(unref(Dropdown), {
|
|
881
917
|
arrow: "",
|
|
@@ -885,9 +921,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
885
921
|
createVNode(unref(Menu), {
|
|
886
922
|
style: { "width": "100px", "text-align": "center" },
|
|
887
923
|
"selected-keys": size.value ? [size.value] : [],
|
|
888
|
-
items: sizeOptions,
|
|
924
|
+
items: sizeOptions.value,
|
|
889
925
|
onClick: onSizeChange
|
|
890
|
-
}, null, 8, ["selected-keys"])
|
|
926
|
+
}, null, 8, ["selected-keys", "items"])
|
|
891
927
|
]),
|
|
892
928
|
default: withCtx(() => [
|
|
893
929
|
createVNode(unref(Button), {
|
|
@@ -905,7 +941,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
905
941
|
};
|
|
906
942
|
}
|
|
907
943
|
});
|
|
908
|
-
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
944
|
+
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-a718ce24"]]);
|
|
909
945
|
const _sfc_main$3 = {};
|
|
910
946
|
const _hoisted_1$1 = {
|
|
911
947
|
focusable: "false",
|
|
@@ -926,45 +962,59 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
926
962
|
__name: "ColumnControl",
|
|
927
963
|
props: {
|
|
928
964
|
columns: {},
|
|
929
|
-
table: { default: () => void 0 }
|
|
965
|
+
table: { default: () => void 0 },
|
|
966
|
+
columnControl: { default: () => void 0 }
|
|
930
967
|
},
|
|
931
968
|
setup(__props) {
|
|
969
|
+
const { t } = useLocale();
|
|
932
970
|
const open = ref(false);
|
|
933
971
|
const checkAll = ref(false);
|
|
934
972
|
const indeterminate = ref(false);
|
|
935
973
|
const checkedColumnsOptions = computed(
|
|
936
|
-
() => __props.columns.flatMap(
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
974
|
+
() => __props.columns.flatMap((item) => {
|
|
975
|
+
var _a, _b, _c, _d, _e, _f;
|
|
976
|
+
if (!item.key || !item.title) return [];
|
|
977
|
+
const key = item.key;
|
|
978
|
+
if ((_b = (_a = __props.columnControl) == null ? void 0 : _a.excludedKeys) == null ? void 0 : _b.some((ek) => String(ek) === key)) return [];
|
|
979
|
+
const disabled = ((_d = (_c = __props.columnControl) == null ? void 0 : _c.disabledKeys) == null ? void 0 : _d.some((dk) => String(dk) === key)) ?? false;
|
|
980
|
+
const label = ((_f = (_e = __props.columnControl) == null ? void 0 : _e.labels) == null ? void 0 : _f[key]) ?? (typeof item.title === "string" ? item.title : key);
|
|
981
|
+
return {
|
|
982
|
+
label,
|
|
983
|
+
value: key,
|
|
984
|
+
checked: !item.hidden || disabled,
|
|
985
|
+
disabled
|
|
986
|
+
};
|
|
987
|
+
})
|
|
988
|
+
);
|
|
989
|
+
const controllableOptions = computed(
|
|
990
|
+
() => checkedColumnsOptions.value.filter((item) => !item.disabled)
|
|
943
991
|
);
|
|
944
992
|
const checkedColumnKeys = computed({
|
|
945
993
|
get() {
|
|
946
994
|
return checkedColumnsOptions.value.flatMap(
|
|
947
995
|
(item) => item.checked ? item.value : []
|
|
948
|
-
)
|
|
996
|
+
);
|
|
949
997
|
},
|
|
950
998
|
set(val) {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
(_b = (
|
|
999
|
+
checkedColumnsOptions.value.forEach((item) => {
|
|
1000
|
+
var _a, _b;
|
|
1001
|
+
if (item.disabled) return;
|
|
1002
|
+
(_b = (_a = __props.table) == null ? void 0 : _a.setColumn) == null ? void 0 : _b.call(_a, item.value, {
|
|
955
1003
|
hidden: !val.includes(item.value)
|
|
956
1004
|
});
|
|
957
1005
|
});
|
|
958
1006
|
}
|
|
959
1007
|
});
|
|
960
|
-
const onCheckAllChange = (
|
|
961
|
-
checkedColumnKeys.value =
|
|
1008
|
+
const onCheckAllChange = () => {
|
|
1009
|
+
checkedColumnKeys.value = checkAll.value ? [] : controllableOptions.value.map((item) => item.value);
|
|
962
1010
|
indeterminate.value = false;
|
|
963
1011
|
};
|
|
964
1012
|
const checkColumnsMenuItemClick = (val) => {
|
|
1013
|
+
const item = checkedColumnsOptions.value.find((o) => o.value === val);
|
|
1014
|
+
if (item == null ? void 0 : item.disabled) return;
|
|
965
1015
|
if (checkedColumnKeys.value.includes(val)) {
|
|
966
1016
|
checkedColumnKeys.value = checkedColumnKeys.value.filter(
|
|
967
|
-
(
|
|
1017
|
+
(item2) => item2 !== val
|
|
968
1018
|
);
|
|
969
1019
|
} else {
|
|
970
1020
|
checkedColumnKeys.value = [...checkedColumnKeys.value, val];
|
|
@@ -972,16 +1022,39 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
972
1022
|
};
|
|
973
1023
|
watch(
|
|
974
1024
|
checkedColumnKeys,
|
|
975
|
-
(
|
|
976
|
-
|
|
977
|
-
|
|
1025
|
+
() => {
|
|
1026
|
+
const controllableChecked = controllableOptions.value.filter(
|
|
1027
|
+
(item) => item.checked
|
|
1028
|
+
);
|
|
1029
|
+
indeterminate.value = !!controllableChecked.length && controllableChecked.length < controllableOptions.value.length;
|
|
1030
|
+
checkAll.value = controllableChecked.length === controllableOptions.value.length && controllableOptions.value.length > 0;
|
|
978
1031
|
},
|
|
979
1032
|
{ immediate: true }
|
|
980
1033
|
);
|
|
1034
|
+
onMounted(() => {
|
|
1035
|
+
var _a, _b;
|
|
1036
|
+
(_b = (_a = __props.columnControl) == null ? void 0 : _a.disabledKeys) == null ? void 0 : _b.forEach((key) => {
|
|
1037
|
+
var _a2, _b2;
|
|
1038
|
+
(_b2 = (_a2 = __props.table) == null ? void 0 : _a2.setColumn) == null ? void 0 : _b2.call(_a2, String(key), { hidden: false });
|
|
1039
|
+
});
|
|
1040
|
+
});
|
|
1041
|
+
watch(
|
|
1042
|
+
() => {
|
|
1043
|
+
var _a;
|
|
1044
|
+
return (_a = __props.columnControl) == null ? void 0 : _a.disabledKeys;
|
|
1045
|
+
},
|
|
1046
|
+
(keys) => {
|
|
1047
|
+
keys == null ? void 0 : keys.forEach((key) => {
|
|
1048
|
+
var _a, _b;
|
|
1049
|
+
(_b = (_a = __props.table) == null ? void 0 : _a.setColumn) == null ? void 0 : _b.call(_a, String(key), { hidden: false });
|
|
1050
|
+
});
|
|
1051
|
+
},
|
|
1052
|
+
{ deep: true }
|
|
1053
|
+
);
|
|
981
1054
|
return (_ctx, _cache) => {
|
|
982
1055
|
return openBlock(), createBlock(unref(Dropdown), {
|
|
983
1056
|
open: open.value,
|
|
984
|
-
"onUpdate:open": _cache[
|
|
1057
|
+
"onUpdate:open": _cache[0] || (_cache[0] = ($event) => open.value = $event),
|
|
985
1058
|
arrow: "",
|
|
986
1059
|
placement: "bottomRight"
|
|
987
1060
|
}, {
|
|
@@ -990,47 +1063,50 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
990
1063
|
style: { "min-width": "100px", "max-height": "500px", "overflow-y": "scroll" },
|
|
991
1064
|
selectable: false
|
|
992
1065
|
}, {
|
|
993
|
-
default: withCtx(() =>
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
indeterminate: indeterminate.value,
|
|
1000
|
-
onChange: onCheckAllChange
|
|
1001
|
-
}, {
|
|
1002
|
-
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
1003
|
-
createTextVNode(" 全选 ", -1)
|
|
1004
|
-
])]),
|
|
1005
|
-
_: 1
|
|
1006
|
-
}, 8, ["checked", "indeterminate"])
|
|
1007
|
-
])
|
|
1008
|
-
]),
|
|
1009
|
-
_: 1
|
|
1010
|
-
})),
|
|
1011
|
-
createVNode(unref(MenuDivider)),
|
|
1012
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(checkedColumnsOptions.value, (item) => {
|
|
1013
|
-
return openBlock(), createBlock(unref(MenuItem), {
|
|
1014
|
-
key: item.value,
|
|
1015
|
-
onClick: ($event) => checkColumnsMenuItemClick(item.value)
|
|
1066
|
+
default: withCtx(() => {
|
|
1067
|
+
var _a, _b;
|
|
1068
|
+
return [
|
|
1069
|
+
!((_a = __props.columnControl) == null ? void 0 : _a.disableCheckAll) ? (openBlock(), createBlock(unref(MenuItem), {
|
|
1070
|
+
key: 0,
|
|
1071
|
+
onClick: onCheckAllChange
|
|
1016
1072
|
}, {
|
|
1017
1073
|
default: withCtx(() => [
|
|
1018
1074
|
createVNode(unref(Checkbox), {
|
|
1019
|
-
|
|
1075
|
+
style: { "pointer-events": "none" },
|
|
1076
|
+
checked: checkAll.value,
|
|
1077
|
+
indeterminate: indeterminate.value
|
|
1020
1078
|
}, {
|
|
1021
1079
|
default: withCtx(() => [
|
|
1022
|
-
|
|
1023
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
1024
|
-
}, ["stop"]))
|
|
1025
|
-
}, toDisplayString(item.label), 1)
|
|
1080
|
+
createTextVNode(toDisplayString(unref(t)("table.selectAll")), 1)
|
|
1026
1081
|
]),
|
|
1027
|
-
_:
|
|
1028
|
-
},
|
|
1082
|
+
_: 1
|
|
1083
|
+
}, 8, ["checked", "indeterminate"])
|
|
1029
1084
|
]),
|
|
1030
|
-
_:
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1085
|
+
_: 1
|
|
1086
|
+
})) : createCommentVNode("", true),
|
|
1087
|
+
!((_b = __props.columnControl) == null ? void 0 : _b.disableCheckAll) ? (openBlock(), createBlock(unref(MenuDivider), { key: 1 })) : createCommentVNode("", true),
|
|
1088
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(checkedColumnsOptions.value, (item) => {
|
|
1089
|
+
return openBlock(), createBlock(unref(MenuItem), {
|
|
1090
|
+
key: item.value,
|
|
1091
|
+
onClick: ($event) => checkColumnsMenuItemClick(item.value)
|
|
1092
|
+
}, {
|
|
1093
|
+
default: withCtx(() => [
|
|
1094
|
+
createVNode(unref(Checkbox), {
|
|
1095
|
+
checked: item.checked,
|
|
1096
|
+
disabled: item.disabled,
|
|
1097
|
+
style: { "pointer-events": "none" }
|
|
1098
|
+
}, {
|
|
1099
|
+
default: withCtx(() => [
|
|
1100
|
+
createTextVNode(toDisplayString(item.label), 1)
|
|
1101
|
+
]),
|
|
1102
|
+
_: 2
|
|
1103
|
+
}, 1032, ["checked", "disabled"])
|
|
1104
|
+
]),
|
|
1105
|
+
_: 2
|
|
1106
|
+
}, 1032, ["onClick"]);
|
|
1107
|
+
}), 128))
|
|
1108
|
+
];
|
|
1109
|
+
}),
|
|
1034
1110
|
_: 1
|
|
1035
1111
|
})
|
|
1036
1112
|
]),
|
|
@@ -1050,7 +1126,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1050
1126
|
};
|
|
1051
1127
|
}
|
|
1052
1128
|
});
|
|
1053
|
-
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
1129
|
+
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-71f76389"]]);
|
|
1054
1130
|
const _hoisted_1 = { class: "pro-table_header" };
|
|
1055
1131
|
const _hoisted_2 = {
|
|
1056
1132
|
key: 0,
|
|
@@ -1087,6 +1163,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1087
1163
|
}),
|
|
1088
1164
|
emits: ["update:size", "update:loading"],
|
|
1089
1165
|
setup(__props) {
|
|
1166
|
+
const { t } = useLocale();
|
|
1090
1167
|
const config = INJECT_CONFIG["pro-table"];
|
|
1091
1168
|
const injectProps = inject(config.injectionKey, config.default);
|
|
1092
1169
|
const tableProperties = Object.keys(tableProps());
|
|
@@ -1148,15 +1225,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1148
1225
|
const container = __props.tableContainer ?? injectProps.tableContainer ?? DefaultTableContainer;
|
|
1149
1226
|
return container ? container : void 0;
|
|
1150
1227
|
});
|
|
1151
|
-
const indexColumn = {
|
|
1152
|
-
title: "
|
|
1228
|
+
const indexColumn = () => ({
|
|
1229
|
+
title: t("table.index"),
|
|
1153
1230
|
dataIndex: "_index",
|
|
1154
1231
|
width: 80,
|
|
1155
1232
|
customRender: ({ index: index2 }) => index2 + 1
|
|
1156
|
-
};
|
|
1233
|
+
});
|
|
1157
1234
|
const computedColumns = computed(
|
|
1158
1235
|
() => [
|
|
1159
|
-
...__props.addIndexColumn ?? injectProps.addIndexColumn ? [indexColumn] : [],
|
|
1236
|
+
...__props.addIndexColumn ?? injectProps.addIndexColumn ? [indexColumn()] : [],
|
|
1160
1237
|
...(tableAttrs.value.columns ?? (columns == null ? void 0 : columns.value) ?? []).flatMap(
|
|
1161
1238
|
(item, index2) => {
|
|
1162
1239
|
if (item.key) return [{ ...item, key: item.key }];
|
|
@@ -1176,11 +1253,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1176
1253
|
return tableAttrs.value.dataSource ?? (dataSource == null ? void 0 : dataSource.value);
|
|
1177
1254
|
});
|
|
1178
1255
|
const computedPagination = computed(() => {
|
|
1256
|
+
var _a, _b;
|
|
1179
1257
|
if (tableAttrs.value.pagination === false) return false;
|
|
1180
1258
|
return {
|
|
1181
1259
|
...injectAttrs.pagination,
|
|
1182
1260
|
...pageParam,
|
|
1183
|
-
...tableAttrs.value.pagination
|
|
1261
|
+
...tableAttrs.value.pagination,
|
|
1262
|
+
showTotal: ((_a = tableAttrs.value.pagination) == null ? void 0 : _a.showTotal) ?? (injectAttrs.pagination === false ? void 0 : (_b = injectAttrs.pagination) == null ? void 0 : _b.showTotal) ?? ((total) => t("pagination.total", { total }))
|
|
1184
1263
|
};
|
|
1185
1264
|
});
|
|
1186
1265
|
const onTableChange = (...args) => {
|
|
@@ -1195,9 +1274,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1195
1274
|
});
|
|
1196
1275
|
const computedControl = computed(() => {
|
|
1197
1276
|
const mergedControl = __props.control ?? injectProps.control;
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1277
|
+
if (typeof mergedControl === "boolean") {
|
|
1278
|
+
return { sizeControl: mergedControl, columnControl: mergedControl };
|
|
1279
|
+
}
|
|
1280
|
+
const c = mergedControl;
|
|
1281
|
+
const sizeControl = c.sizeControl ?? true;
|
|
1282
|
+
const columnControl = c.columnControl ?? true;
|
|
1283
|
+
return { sizeControl: !!sizeControl, columnControl };
|
|
1284
|
+
});
|
|
1285
|
+
const columnControlConfig = computed(() => {
|
|
1286
|
+
const cc = computedControl.value.columnControl;
|
|
1287
|
+
return typeof cc === "object" ? cc : void 0;
|
|
1201
1288
|
});
|
|
1202
1289
|
onMounted(() => {
|
|
1203
1290
|
if (__props.immediateSearch ?? injectProps.immediateSearch) {
|
|
@@ -1244,8 +1331,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1244
1331
|
computedControl.value.columnControl ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
1245
1332
|
createVNode(unref(ColumnControl), {
|
|
1246
1333
|
columns: computedColumns.value,
|
|
1247
|
-
table: __props.table
|
|
1248
|
-
|
|
1334
|
+
table: __props.table,
|
|
1335
|
+
"column-control": columnControlConfig.value
|
|
1336
|
+
}, null, 8, ["columns", "table", "column-control"])
|
|
1249
1337
|
])) : createCommentVNode("", true)
|
|
1250
1338
|
]),
|
|
1251
1339
|
renderSlot(_ctx.$slots, "table", {}, () => [
|
|
@@ -1274,7 +1362,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1274
1362
|
};
|
|
1275
1363
|
}
|
|
1276
1364
|
});
|
|
1277
|
-
const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
1365
|
+
const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-58aab322"]]);
|
|
1278
1366
|
function useTable(params) {
|
|
1279
1367
|
return useTable$1(params);
|
|
1280
1368
|
}
|
|
@@ -1286,7 +1374,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1286
1374
|
__name: "index",
|
|
1287
1375
|
props: {
|
|
1288
1376
|
componentVars: {},
|
|
1289
|
-
componentMap: {}
|
|
1377
|
+
componentMap: {},
|
|
1378
|
+
locale: {}
|
|
1290
1379
|
},
|
|
1291
1380
|
setup(__props) {
|
|
1292
1381
|
const props = __props;
|
|
@@ -1299,6 +1388,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1299
1388
|
if (props.componentMap) {
|
|
1300
1389
|
provide(INJECT_COMPONENTS, props.componentMap);
|
|
1301
1390
|
}
|
|
1391
|
+
provide(
|
|
1392
|
+
LOCALE_INJECT_KEY,
|
|
1393
|
+
computed(() => props.locale)
|
|
1394
|
+
);
|
|
1302
1395
|
return (_ctx, _cache) => {
|
|
1303
1396
|
return renderSlot(_ctx.$slots, "default");
|
|
1304
1397
|
};
|
|
@@ -1327,15 +1420,20 @@ const index = {
|
|
|
1327
1420
|
};
|
|
1328
1421
|
export {
|
|
1329
1422
|
_sfc_main$c as ContainerFragment,
|
|
1423
|
+
LOCALE_INJECT_KEY,
|
|
1330
1424
|
_sfc_main as ProComponentProvider,
|
|
1331
1425
|
_sfc_main$a as ProForm,
|
|
1332
1426
|
ProTable,
|
|
1333
1427
|
_sfc_main$b as SlotComponent,
|
|
1334
1428
|
index as default,
|
|
1429
|
+
enUS2 as enUS,
|
|
1335
1430
|
useFields,
|
|
1336
1431
|
useForm,
|
|
1337
1432
|
useFormData,
|
|
1338
1433
|
useFormRef,
|
|
1339
|
-
|
|
1434
|
+
useLocale,
|
|
1435
|
+
useTable,
|
|
1436
|
+
zhCN2 as zhCN,
|
|
1437
|
+
zhTW2 as zhTW
|
|
1340
1438
|
};
|
|
1341
1439
|
//# sourceMappingURL=index.js.map
|