@qin-ui/antd-vue-pro 2.2.4 → 2.3.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 (35) hide show
  1. package/AI-CONTEXT.md +22 -11
  2. package/api.json +7 -1
  3. package/es/antd-vue-pro.css +13 -13
  4. package/es/components/component-provider/components/index.vue.d.ts +8 -0
  5. package/es/components/component-provider/components/index.vue.d.ts.map +1 -1
  6. package/es/components/component-provider/constants/index.d.ts.map +1 -1
  7. package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -1
  8. package/es/components/form/components/BaseField/utils/index.d.ts +3 -1
  9. package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -1
  10. package/es/components/table/components/ColumnControl.vue.d.ts +2 -1
  11. package/es/components/table/components/ColumnControl.vue.d.ts.map +1 -1
  12. package/es/components/table/components/ProTable.vue.d.ts +3 -2
  13. package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
  14. package/es/components/table/components/SearchForm.vue.d.ts.map +1 -1
  15. package/es/components/table/components/SizeControl.vue.d.ts.map +1 -1
  16. package/es/components/table/types/index.d.ts +25 -0
  17. package/es/components/table/types/index.d.ts.map +1 -1
  18. package/es/index.d.ts +1 -0
  19. package/es/index.d.ts.map +1 -1
  20. package/es/index.js +200 -103
  21. package/es/index.js.map +1 -1
  22. package/es/locale/index.d.ts +28 -0
  23. package/es/locale/index.d.ts.map +1 -0
  24. package/package.json +2 -2
  25. package/src/components/component-provider/components/index.vue +16 -1
  26. package/src/components/component-provider/constants/index.ts +4 -7
  27. package/src/components/form/components/BaseField/index.vue +10 -4
  28. package/src/components/form/components/BaseField/utils/index.ts +33 -3
  29. package/src/components/table/components/ColumnControl.vue +91 -38
  30. package/src/components/table/components/ProTable.vue +47 -13
  31. package/src/components/table/components/SearchForm.vue +6 -3
  32. package/src/components/table/components/SizeControl.vue +9 -5
  33. package/src/components/table/types/index.ts +26 -0
  34. package/src/index.ts +1 -0
  35. 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, withModifiers, mergeModels, onMounted, normalizeClass, nextTick } from "vue";
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, placeholder: "请输入" }
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, placeholder: "请输入" }
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, placeholder: "请选择", getPopupContainer }
71
+ default: { allowClear: true, getPopupContainer }
75
72
  },
76
73
  cascader: {
77
74
  injectionKey: Symbol(""),
78
- default: { allowClear: true, placeholder: "请选择", getPopupContainer }
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 getInitProps = (field) => {
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
- component: __props.component,
445
- picker: attrs.picker
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(() => [..._cache[0] || (_cache[0] = [
755
- createTextVNode("重置", -1)
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(() => [..._cache[1] || (_cache[1] = [
774
- createTextVNode("查询 ", -1)
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 ? "收起" : "展开") + " ", 1),
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-aee49e85"]]);
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: "默认", key: "large" },
876
- { label: "中等", key: "middle" },
877
- { label: "紧凑", key: "small" }
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-db17998d"]]);
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
- (item) => item.key && item.title ? {
938
- label: item.title,
939
- value: item.key,
940
- checked: !item.hidden
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
- var _a;
952
- (_a = checkedColumnsOptions.value) == null ? void 0 : _a.forEach((item) => {
953
- var _a2, _b;
954
- (_b = (_a2 = __props.table) == null ? void 0 : _a2.setColumn) == null ? void 0 : _b.call(_a2, item.value, {
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 = (e) => {
961
- checkedColumnKeys.value = e.target.checked ? checkedColumnsOptions.value.map((item) => item.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
- (item) => item !== val
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
- (val) => {
976
- indeterminate.value = !!val.length && val.length < checkedColumnsOptions.value.length;
977
- checkAll.value = val.length === checkedColumnsOptions.value.length;
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[1] || (_cache[1] = ($event) => open.value = $event),
1057
+ "onUpdate:open": _cache[0] || (_cache[0] = ($event) => open.value = $event),
985
1058
  arrow: "",
986
1059
  placement: "bottomRight"
987
1060
  }, {
@@ -990,47 +1063,49 @@ 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
- (openBlock(), createBlock(unref(MenuItem), { key: 0 }, {
995
- default: withCtx(() => [
996
- createElementVNode("div", null, [
997
- createVNode(unref(Checkbox), {
998
- checked: checkAll.value,
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
- checked: checkedColumnKeys.value.includes(item.value)
1075
+ checked: checkAll.value,
1076
+ indeterminate: indeterminate.value,
1077
+ style: { "width": "100%" }
1020
1078
  }, {
1021
1079
  default: withCtx(() => [
1022
- createElementVNode("div", {
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
- _: 2
1028
- }, 1032, ["checked"])
1082
+ _: 1
1083
+ }, 8, ["checked", "indeterminate"])
1029
1084
  ]),
1030
- _: 2
1031
- }, 1032, ["onClick"]);
1032
- }), 128))
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
+ }, {
1098
+ default: withCtx(() => [
1099
+ createElementVNode("div", null, toDisplayString(item.label), 1)
1100
+ ]),
1101
+ _: 2
1102
+ }, 1032, ["checked", "disabled"])
1103
+ ]),
1104
+ _: 2
1105
+ }, 1032, ["onClick"]);
1106
+ }), 128))
1107
+ ];
1108
+ }),
1034
1109
  _: 1
1035
1110
  })
1036
1111
  ]),
@@ -1050,7 +1125,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1050
1125
  };
1051
1126
  }
1052
1127
  });
1053
- const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d503f78a"]]);
1128
+ const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f5bd6ecc"]]);
1054
1129
  const _hoisted_1 = { class: "pro-table_header" };
1055
1130
  const _hoisted_2 = {
1056
1131
  key: 0,
@@ -1087,6 +1162,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1087
1162
  }),
1088
1163
  emits: ["update:size", "update:loading"],
1089
1164
  setup(__props) {
1165
+ const { t } = useLocale();
1090
1166
  const config = INJECT_CONFIG["pro-table"];
1091
1167
  const injectProps = inject(config.injectionKey, config.default);
1092
1168
  const tableProperties = Object.keys(tableProps());
@@ -1148,15 +1224,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1148
1224
  const container = __props.tableContainer ?? injectProps.tableContainer ?? DefaultTableContainer;
1149
1225
  return container ? container : void 0;
1150
1226
  });
1151
- const indexColumn = {
1152
- title: "序号",
1227
+ const indexColumn = () => ({
1228
+ title: t("table.index"),
1153
1229
  dataIndex: "_index",
1154
1230
  width: 80,
1155
1231
  customRender: ({ index: index2 }) => index2 + 1
1156
- };
1232
+ });
1157
1233
  const computedColumns = computed(
1158
1234
  () => [
1159
- ...__props.addIndexColumn ?? injectProps.addIndexColumn ? [indexColumn] : [],
1235
+ ...__props.addIndexColumn ?? injectProps.addIndexColumn ? [indexColumn()] : [],
1160
1236
  ...(tableAttrs.value.columns ?? (columns == null ? void 0 : columns.value) ?? []).flatMap(
1161
1237
  (item, index2) => {
1162
1238
  if (item.key) return [{ ...item, key: item.key }];
@@ -1176,11 +1252,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1176
1252
  return tableAttrs.value.dataSource ?? (dataSource == null ? void 0 : dataSource.value);
1177
1253
  });
1178
1254
  const computedPagination = computed(() => {
1255
+ var _a, _b;
1179
1256
  if (tableAttrs.value.pagination === false) return false;
1180
1257
  return {
1181
1258
  ...injectAttrs.pagination,
1182
1259
  ...pageParam,
1183
- ...tableAttrs.value.pagination
1260
+ ...tableAttrs.value.pagination,
1261
+ 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
1262
  };
1185
1263
  });
1186
1264
  const onTableChange = (...args) => {
@@ -1195,9 +1273,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1195
1273
  });
1196
1274
  const computedControl = computed(() => {
1197
1275
  const mergedControl = __props.control ?? injectProps.control;
1198
- const sizeControl = (mergedControl == null ? void 0 : mergedControl.sizeControl) ?? mergedControl;
1199
- const columnControl = (mergedControl == null ? void 0 : mergedControl.columnControl) ?? mergedControl;
1200
- return { sizeControl, columnControl };
1276
+ if (typeof mergedControl === "boolean") {
1277
+ return { sizeControl: mergedControl, columnControl: mergedControl };
1278
+ }
1279
+ const c = mergedControl;
1280
+ const sizeControl = c.sizeControl ?? true;
1281
+ const columnControl = c.columnControl ?? true;
1282
+ return { sizeControl: !!sizeControl, columnControl };
1283
+ });
1284
+ const columnControlConfig = computed(() => {
1285
+ const cc = computedControl.value.columnControl;
1286
+ return typeof cc === "object" ? cc : void 0;
1201
1287
  });
1202
1288
  onMounted(() => {
1203
1289
  if (__props.immediateSearch ?? injectProps.immediateSearch) {
@@ -1244,8 +1330,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1244
1330
  computedControl.value.columnControl ? (openBlock(), createElementBlock("div", _hoisted_5, [
1245
1331
  createVNode(unref(ColumnControl), {
1246
1332
  columns: computedColumns.value,
1247
- table: __props.table
1248
- }, null, 8, ["columns", "table"])
1333
+ table: __props.table,
1334
+ "column-control": columnControlConfig.value
1335
+ }, null, 8, ["columns", "table", "column-control"])
1249
1336
  ])) : createCommentVNode("", true)
1250
1337
  ]),
1251
1338
  renderSlot(_ctx.$slots, "table", {}, () => [
@@ -1274,7 +1361,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1274
1361
  };
1275
1362
  }
1276
1363
  });
1277
- const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-856c096b"]]);
1364
+ const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-58aab322"]]);
1278
1365
  function useTable(params) {
1279
1366
  return useTable$1(params);
1280
1367
  }
@@ -1286,7 +1373,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1286
1373
  __name: "index",
1287
1374
  props: {
1288
1375
  componentVars: {},
1289
- componentMap: {}
1376
+ componentMap: {},
1377
+ locale: {}
1290
1378
  },
1291
1379
  setup(__props) {
1292
1380
  const props = __props;
@@ -1299,6 +1387,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1299
1387
  if (props.componentMap) {
1300
1388
  provide(INJECT_COMPONENTS, props.componentMap);
1301
1389
  }
1390
+ provide(
1391
+ LOCALE_INJECT_KEY,
1392
+ computed(() => props.locale)
1393
+ );
1302
1394
  return (_ctx, _cache) => {
1303
1395
  return renderSlot(_ctx.$slots, "default");
1304
1396
  };
@@ -1327,15 +1419,20 @@ const index = {
1327
1419
  };
1328
1420
  export {
1329
1421
  _sfc_main$c as ContainerFragment,
1422
+ LOCALE_INJECT_KEY,
1330
1423
  _sfc_main as ProComponentProvider,
1331
1424
  _sfc_main$a as ProForm,
1332
1425
  ProTable,
1333
1426
  _sfc_main$b as SlotComponent,
1334
1427
  index as default,
1428
+ enUS2 as enUS,
1335
1429
  useFields,
1336
1430
  useForm,
1337
1431
  useFormData,
1338
1432
  useFormRef,
1339
- useTable
1433
+ useLocale,
1434
+ useTable,
1435
+ zhCN2 as zhCN,
1436
+ zhTW2 as zhTW
1340
1437
  };
1341
1438
  //# sourceMappingURL=index.js.map