@qin-ui/antd-vue-pro 2.4.0 → 2.4.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.
Files changed (39) hide show
  1. package/api.json +1 -1
  2. package/es/__tests__/cross-package.spec.d.ts +2 -0
  3. package/es/__tests__/cross-package.spec.d.ts.map +1 -0
  4. package/es/antd-vue-pro.css +11 -11
  5. package/es/index.js +95 -225
  6. package/es/index.js.map +1 -1
  7. package/es/src/components/component-provider/components/index.vue.d.ts.map +1 -1
  8. package/es/src/components/component-provider/constants/index.d.ts +2 -2
  9. package/es/src/components/component-provider/constants/index.d.ts.map +1 -1
  10. package/es/src/components/form/components/BaseField/index.vue.d.ts.map +1 -1
  11. package/es/src/components/form/components/BaseField/utils/index.d.ts +1 -0
  12. package/es/src/components/form/components/BaseField/utils/index.d.ts.map +1 -1
  13. package/es/src/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -1
  14. package/es/src/components/form/components/ProForm/index.vue.d.ts.map +1 -1
  15. package/es/src/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -1
  16. package/es/src/components/table/components/ColumnControl.vue.d.ts.map +1 -1
  17. package/es/src/components/table/components/ProTable.vue.d.ts +4 -1
  18. package/es/src/components/table/components/ProTable.vue.d.ts.map +1 -1
  19. package/es/src/components/table/components/SearchForm.vue.d.ts.map +1 -1
  20. package/es/src/components/table/types/index.d.ts +1 -1
  21. package/es/src/components/table/types/index.d.ts.map +1 -1
  22. package/es/src/locale/index.d.ts +1 -1
  23. package/es/src/locale/index.d.ts.map +1 -1
  24. package/es/src/shared/core/index.d.ts +1 -1
  25. package/es/src/shared/core/index.d.ts.map +1 -1
  26. package/package.json +2 -2
  27. package/src/components/component-provider/components/index.vue +4 -3
  28. package/src/components/component-provider/constants/index.ts +4 -3
  29. package/src/components/form/components/BaseField/index.vue +3 -6
  30. package/src/components/form/components/BaseField/utils/index.ts +11 -0
  31. package/src/components/form/components/BaseFormItem/index.vue +2 -1
  32. package/src/components/form/components/ProForm/index.vue +23 -23
  33. package/src/components/form/hooks/useGroupFieldAttrs.ts +9 -3
  34. package/src/components/table/components/ColumnControl.vue +3 -9
  35. package/src/components/table/components/ProTable.vue +47 -28
  36. package/src/components/table/components/SearchForm.vue +8 -182
  37. package/src/components/table/types/index.ts +1 -1
  38. package/src/locale/index.ts +1 -1
  39. package/src/shared/core/index.ts +11 -0
package/api.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-08-26T05:48:23.618Z",
2
+ "generatedAt": "2026-08-28T06:02:33.200Z",
3
3
  "name": "@qin-ui/antd-vue-pro",
4
4
  "api": [
5
5
  {
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cross-package.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross-package.spec.d.ts","sourceRoot":"","sources":["../../__tests__/cross-package.spec.ts"],"names":[],"mappings":""}
@@ -1,13 +1,13 @@
1
- .pro-table_search-form[data-v-9dca0a5d] [class*='-form-item'] {
1
+ .pro-table_search-form[data-v-15688cc0] [class*='-form-item'] {
2
2
  margin: 0;
3
3
  }
4
- .pro-table_search-form_expand-toggle-button[data-v-9dca0a5d] {
4
+ .pro-table_search-form_expand-toggle-button[data-v-15688cc0] {
5
5
  display: flex;
6
6
  align-items: center;
7
7
  padding: 0;
8
8
  padding-left: 4px;
9
9
  }
10
- .pro-table_search-form .transition[data-v-9dca0a5d] {
10
+ .pro-table_search-form .transition[data-v-15688cc0] {
11
11
  transition: all 0.25s;
12
12
  }
13
13
  .pro-table_search-form-container[data-v-c385cd54] {
@@ -27,32 +27,32 @@
27
27
  .pro-table_size-control_button[data-v-2ac95d3b] svg {
28
28
  transform: scale(1.3);
29
29
  }
30
- .pro-table_column-control_button[data-v-04235d0e] {
30
+ .pro-table_column-control_button[data-v-a94297cd] {
31
31
  display: flex;
32
32
  align-items: center;
33
33
  padding-right: 12px;
34
34
  padding-left: 12px;
35
35
  }
36
- .pro-table_column-control_button[data-v-04235d0e] svg {
36
+ .pro-table_column-control_button[data-v-a94297cd] svg {
37
37
  transform: scale(1.2, 1.4);
38
38
  }
39
- .pro-table_header[data-v-5ce28f7b] {
39
+ .pro-table_header[data-v-41d09d2a] {
40
40
  display: flex;
41
41
  align-items: center;
42
42
  justify-content: flex-end;
43
43
  }
44
- .pro-table_header[data-v-5ce28f7b]:empty {
44
+ .pro-table_header[data-v-41d09d2a]:empty {
45
45
  display: none;
46
46
  }
47
- .pro-table_header + .pro-table_header_content[data-v-5ce28f7b] {
47
+ .pro-table_header + .pro-table_header_content[data-v-41d09d2a] {
48
48
  margin-top: 16px;
49
49
  }
50
- .pro-table_header_button-bar[data-v-5ce28f7b] {
50
+ .pro-table_header_button-bar[data-v-41d09d2a] {
51
51
  flex: 1;
52
52
  }
53
- .pro-table_header_toolbar[data-v-5ce28f7b] {
53
+ .pro-table_header_toolbar[data-v-41d09d2a] {
54
54
  margin-left: 12px;
55
55
  }
56
- .pro-table[data-v-5ce28f7b] [class*='-pagination'] [class*='-pagination-total-text'] {
56
+ .pro-table[data-v-41d09d2a] [class*='-pagination'] [class*='-pagination-total-text'] {
57
57
  flex: 1;
58
58
  }
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./antd-vue-pro.css";
2
- import { inject, computed, toValue, mergeProps, defineComponent, resolveComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode, createSlots, toRaw, ref, useAttrs, createCommentVNode, resolveDynamicComponent, renderSlot, normalizeProps, isVNode, createTextVNode, toDisplayString, provide, useSlots, createElementVNode, onBeforeUnmount, watch, watchEffect, normalizeStyle, useModel, onMounted, mergeModels, normalizeClass, guardReactiveProps, nextTick } from "vue";
2
+ import { inject, computed, toValue, mergeProps, defineComponent, resolveComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode, createSlots, toRaw, ref, useAttrs, createCommentVNode, resolveDynamicComponent, renderSlot, normalizeProps, isVNode, createTextVNode, toDisplayString, provide, useSlots, createElementVNode, normalizeStyle, useModel, watch, mergeModels, onMounted, normalizeClass, guardReactiveProps, nextTick } from "vue";
3
3
  import { Transfer, TreeSelect, Slider, Switch, RadioGroup, CheckboxGroup, TimePicker, RangePicker, DatePicker, Cascader, Select, InputNumber, InputPassword, InputSearch, Textarea, Input, Row, Col, FormItem, Form, Space, Button, theme, Dropdown, Menu, MenuItem, Checkbox, MenuDivider, Table } from "ant-design-vue";
4
- import { isPlainObject, getObject, toPath, useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, cloneDeep, InjectionFormSlotsKey, InjectionFormKey, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, pick, isPromise, useTable as useTable$1 } from "@qin-ui/pro-components-core";
4
+ import { isPlainObject, getObject, toPath, useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, cloneDeep, InjectionFormSlotsKey, createFormProxy, InjectionFormKey, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, useSearchFormExpand, pick, isPromise, useTable as useTable$1 } 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 { colProps } from "ant-design-vue/es/grid/Col";
7
7
  import { formItemProps, useInjectFormItemContext } from "ant-design-vue/es/form";
@@ -64,7 +64,7 @@ const INJECT_CONFIG = {
64
64
  injectionKey: Symbol(""),
65
65
  default: {
66
66
  max: 10 ** 15 - 1,
67
- min: -1000000000000001,
67
+ min: -999999999999999,
68
68
  controls: false,
69
69
  style: { width: "100%" }
70
70
  }
@@ -176,6 +176,8 @@ const formItemPropKeys = Object.keys(formItemProps()).concat([
176
176
  "formItemContainer"
177
177
  ]);
178
178
  const gridItemPropKeys = Object.keys(colProps());
179
+ const gridItemPropKeySet = new Set(gridItemPropKeys);
180
+ const formItemPropKeySet = new Set(formItemPropKeys);
179
181
  function useGroupFieldAttrs(validFields) {
180
182
  const config = INJECT_CONFIG["pro-form-item"];
181
183
  const injectFormItemProps = inject(config.injectionKey, config.default);
@@ -198,10 +200,12 @@ function useGroupFieldAttrs(validFields) {
198
200
  lg,
199
201
  xl,
200
202
  xxl,
203
+ formItemContainer: injectFormItemContainer,
201
204
  ...injectRest
202
205
  } = rawInject;
203
206
  const initGridItemProps = span || span === 0 ? { span } : { xs, sm, md, lg, xl, xxl, span: injectSpan };
204
207
  gridItemProps2 = fields ? { span: span ?? 24 } : initGridItemProps;
208
+ const container = formItemContainer ?? injectFormItemContainer;
205
209
  formItemProps2 = mergeProps(
206
210
  injectRest,
207
211
  { class: injectClassName, style: injectStyle },
@@ -209,9 +213,9 @@ function useGroupFieldAttrs(validFields) {
209
213
  formItemDataAttrs
210
214
  );
211
215
  Object.keys(rest).forEach((k) => {
212
- if (gridItemPropKeys.includes(k)) {
216
+ if (gridItemPropKeySet.has(k)) {
213
217
  gridItemProps2[k] = rest[k];
214
- } else if (formItemPropKeys.includes(k)) {
218
+ } else if (formItemPropKeySet.has(k)) {
215
219
  formItemProps2[k] = rest[k];
216
220
  } else {
217
221
  componentProps[k] = rest[k];
@@ -232,7 +236,7 @@ function useGroupFieldAttrs(validFields) {
232
236
  formItemProps: formItemProps2,
233
237
  formItemSlots,
234
238
  componentProps,
235
- formItemContainer,
239
+ formItemContainer: container,
236
240
  rawField: field
237
241
  };
238
242
  }
@@ -259,7 +263,10 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
259
263
  setup(__props) {
260
264
  const props = __props;
261
265
  const validFields = computed(
262
- () => (props.fields ?? []).filter((field) => !field.hidden)
266
+ () => (
267
+ // hidden 支持 Ref/ComputedRef/getter 等响应式形态(统一使用 toValue 取值)
268
+ (props.fields ?? []).filter((field) => !toValue(field.hidden))
269
+ )
263
270
  );
264
271
  useProviderDisabled(computed(() => props.disabled));
265
272
  const config = INJECT_CONFIG["pro-form"];
@@ -395,6 +402,14 @@ const getInitProps = (field, injectProps = {}, t) => {
395
402
  }
396
403
  return {};
397
404
  };
405
+ const warnedUnknownComponents = /* @__PURE__ */ new Set();
406
+ function warnUnknownComponent(name) {
407
+ if (warnedUnknownComponents.has(name)) return;
408
+ warnedUnknownComponents.add(name);
409
+ console.warn(
410
+ `[pro-components] 未识别的组件类型 "${name}",已降级为原生元素渲染。如为自定义组件请在 componentMap 或 ProComponentProvider 中注册。`
411
+ );
412
+ }
398
413
  const LOCALE_INJECT_KEY = Symbol("pro-locale");
399
414
  const useLocale = () => {
400
415
  const config = useConfigContextInject();
@@ -472,7 +487,6 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
472
487
  initProps,
473
488
  attrs,
474
489
  { class: attrs.componentClass, style: attrs.componentStyle },
475
- { class: initProps.componentClass, style: initProps.componentStyle },
476
490
  { disabled: attrs.disabled ?? parentDisabled.value ?? initProps.disabled },
477
491
  { modelProp: effectiveModelProp }
478
492
  );
@@ -488,14 +502,13 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
488
502
  const formSlots = inject(InjectionFormSlotsKey, void 0);
489
503
  const customComponents = inject(INJECT_COMPONENTS, {});
490
504
  const is = computed(() => {
505
+ var _a;
491
506
  const teleportSlot = props.path && (formSlots == null ? void 0 : formSlots[props.path]);
492
507
  if (teleportSlot) return teleportSlot;
493
508
  if (typeof props.component === "string") {
494
- const resolved = customComponents[props.component] || componentMap[props.component];
509
+ const resolved = ((_a = toValue(customComponents)) == null ? void 0 : _a[props.component]) || componentMap[props.component];
495
510
  if (resolved) return resolved;
496
- console.warn(
497
- `[pro-components] 未识别的组件类型 "${props.component}",已降级为原生元素渲染。如为自定义组件请在 componentMap 或 ProComponentProvider 中注册。`
498
- );
511
+ warnUnknownComponent(props.component);
499
512
  return props.component;
500
513
  }
501
514
  return props.component;
@@ -580,28 +593,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
580
593
  const currentForm = computed(
581
594
  () => props.form ?? fallbackForm
582
595
  );
583
- const formProxy = new Proxy({}, {
584
- get(_, prop) {
585
- const target = currentForm.value;
586
- const val = target == null ? void 0 : target[prop];
587
- if (typeof val === "function") {
588
- return (...args) => {
589
- var _a, _b;
590
- return (_b = (_a = currentForm.value) == null ? void 0 : _a[prop]) == null ? void 0 : _b.call(_a, ...args);
591
- };
592
- }
593
- return val;
594
- },
595
- set(_, prop, value) {
596
- if (currentForm.value) {
597
- currentForm.value[prop] = value;
598
- }
599
- return true;
600
- },
601
- has(_, prop) {
602
- return Boolean(currentForm.value && prop in currentForm.value);
603
- }
604
- });
596
+ const formProxy = createFormProxy(() => currentForm.value);
605
597
  provide(InjectionFormKey, formProxy);
606
598
  const fields = computed(() => {
607
599
  var _a;
@@ -627,11 +619,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
627
619
  const formKey = computed(() => getFormKey(currentForm.value));
628
620
  const config = INJECT_CONFIG["pro-form"];
629
621
  const injectFormConfig = inject(config.injectionKey, config.default);
622
+ const attrs = useAttrs();
630
623
  const injectAttrs = computed(() => {
631
624
  const raw = toValue(injectFormConfig);
632
625
  const { grid: _injectGrid, ...rest } = raw || {};
633
626
  return rest;
634
627
  });
628
+ const formAttrs = computed(() => {
629
+ return mergeProps(injectAttrs.value, camelizeProperties(attrs));
630
+ });
635
631
  const slots = useSlots();
636
632
  provide(InjectionFormSlotsKey, slots);
637
633
  return (_ctx, _cache) => {
@@ -639,7 +635,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
639
635
  key: formKey.value,
640
636
  ref: setFormRef,
641
637
  model: formData.value
642
- }, mergeProps(injectAttrs.value, unref(camelizeProperties)(_ctx.$attrs)), { class: "pro-form" }), {
638
+ }, formAttrs.value, { class: "pro-form" }), {
643
639
  default: withCtx(() => [
644
640
  createVNode(unref(_sfc_main$e), {
645
641
  fields: fields.value,
@@ -701,155 +697,18 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
701
697
  const { t } = useLocale();
702
698
  const props = __props;
703
699
  const emit = __emit;
704
- const proFormHeight = ref("unset");
705
- const collapseHeight = ref(0);
706
- const rowHeight = ref(32);
707
- let resizeObserver = null;
708
- let intersectionObserver = null;
709
- const cleanupObservers = () => {
710
- if (resizeObserver) {
711
- resizeObserver.disconnect();
712
- resizeObserver = null;
713
- }
714
- if (intersectionObserver) {
715
- intersectionObserver.disconnect();
716
- intersectionObserver = null;
717
- }
718
- };
719
- onBeforeUnmount(() => {
720
- cleanupObservers();
721
- });
722
- const computedExpand = computed(() => {
723
- if (!props.expand) return false;
724
- if (props.expand === true) return { minExpandRows: 2, expandStatus: false };
725
- return {
726
- minExpandRows: Math.max(Math.floor(props.expand.minExpandRows ?? 2), 1),
727
- expandStatus: props.expand.expandStatus ?? false
728
- };
729
- });
730
- const showExpandToggle = ref(false);
731
- const expandStatus = ref(true);
732
- const updateHeights = () => {
733
- var _a, _b, _c, _d, _e, _f, _g, _h;
734
- if (!props.expand || !((_b = (_a = props.form) == null ? void 0 : _a.formRef) == null ? void 0 : _b.value)) return;
735
- const proFormEl = (_c = props.form.formRef.value) == null ? void 0 : _c.$el;
736
- if (!proFormEl) return;
737
- const itemHeight = (_f = (_e = (_d = proFormEl == null ? void 0 : proFormEl.querySelector("[class*='-form-item']")) == null ? void 0 : _d.getBoundingClientRect) == null ? void 0 : _e.call(_d)) == null ? void 0 : _f.height;
738
- if (itemHeight && itemHeight > 0) {
739
- rowHeight.value = itemHeight;
740
- }
741
- const naturalHeight = proFormEl.scrollHeight || ((_h = (_g = proFormEl.getBoundingClientRect) == null ? void 0 : _g.call(proFormEl)) == null ? void 0 : _h.height) || 0;
742
- if (naturalHeight > 0) {
743
- proFormHeight.value = naturalHeight;
744
- }
745
- };
746
- const isManualToggle = ref(false);
747
- const changeExpandStatus = () => {
748
- isManualToggle.value = true;
749
- expandStatus.value = !expandStatus.value;
750
- };
751
- const hasFieldValue = (val) => val !== null && val !== void 0 && val !== "" && !(Array.isArray(val) && val.length === 0) && !(typeof val === "object" && Object.keys(val).length === 0);
752
- const setInitExpandStatus = () => {
753
- var _a, _b, _c;
754
- if (isManualToggle.value) return;
755
- const initStatus = computedExpand.value ? computedExpand.value.expandStatus : false;
756
- expandStatus.value = initStatus;
757
- if (((_b = (_a = props.form) == null ? void 0 : _a.formRef) == null ? void 0 : _b.value) && computedExpand.value) {
758
- const formEl = props.form.formRef.value.$el;
759
- const formItemsEl = (_c = formEl == null ? void 0 : formEl.querySelectorAll) == null ? void 0 : _c.call(
760
- formEl,
761
- "[class*='-form-item'] > [path]"
762
- );
763
- if (!formItemsEl || formItemsEl.length === 0) return;
764
- if (intersectionObserver) {
765
- intersectionObserver.disconnect();
766
- }
767
- intersectionObserver = new IntersectionObserver(
768
- (entries) => {
769
- if (isManualToggle.value) return;
770
- expandStatus.value = entries.some((e) => {
771
- var _a2, _b2;
772
- if (e.intersectionRatio === 0) {
773
- const path = e.target.getAttribute("path");
774
- const searchFieldValue = path ? (_b2 = (_a2 = props.form) == null ? void 0 : _a2.getFormData) == null ? void 0 : _b2.call(_a2, path) : void 0;
775
- return hasFieldValue(searchFieldValue);
776
- }
777
- return computedExpand.value ? computedExpand.value.expandStatus : false;
778
- });
779
- intersectionObserver == null ? void 0 : intersectionObserver.disconnect();
780
- },
781
- { root: formEl }
782
- );
783
- formItemsEl.forEach((element) => {
784
- intersectionObserver == null ? void 0 : intersectionObserver.observe(element);
785
- });
786
- }
787
- };
788
- watch(
789
- [
790
- () => {
791
- var _a, _b, _c;
792
- return (_c = (_b = (_a = props.form) == null ? void 0 : _a.fields.value) == null ? void 0 : _b.filter((f) => !f.hidden)) == null ? void 0 : _c.length;
793
- },
794
- () => {
795
- var _a, _b;
796
- return (_b = (_a = props.form) == null ? void 0 : _a.formRef) == null ? void 0 : _b.value;
797
- },
798
- () => props.expand
799
- ],
800
- () => {
801
- updateHeights();
802
- },
803
- { flush: "post", immediate: true }
804
- );
805
- watch(
806
- () => {
807
- var _a, _b;
808
- return (_b = (_a = props.form) == null ? void 0 : _a.formRef) == null ? void 0 : _b.value;
809
- },
810
- (val) => {
811
- if (resizeObserver) {
812
- resizeObserver.disconnect();
813
- resizeObserver = null;
814
- }
815
- const formEl = val == null ? void 0 : val.$el;
816
- if (formEl && typeof ResizeObserver !== "undefined") {
817
- resizeObserver = new ResizeObserver(() => {
818
- updateHeights();
819
- });
820
- resizeObserver.observe(formEl);
821
- }
822
- },
823
- { immediate: true }
824
- );
825
- watchEffect(
826
- () => {
827
- if (typeof proFormHeight.value !== "number") return;
828
- if (props.layout === "grid" && computedExpand.value) {
829
- const { minExpandRows } = computedExpand.value;
830
- collapseHeight.value = Math.min(
831
- minExpandRows * rowHeight.value + (minExpandRows - 1) * props.rowGap,
832
- +proFormHeight.value
833
- );
834
- showExpandToggle.value = +proFormHeight.value - collapseHeight.value > 1;
835
- if (showExpandToggle.value) {
836
- setInitExpandStatus();
837
- }
838
- } else {
839
- showExpandToggle.value = false;
840
- }
841
- },
842
- { flush: "post" }
843
- );
700
+ const { showExpandToggle, expandStatus, changeExpandStatus, heightStyle } = useSearchFormExpand(props);
844
701
  const layoutProps = computed(() => {
845
- const currentHeight = expandStatus.value ? proFormHeight.value : collapseHeight.value;
846
- const heightStyle = currentHeight !== "unset" && currentHeight !== void 0 ? `${currentHeight}px` : void 0;
847
702
  return props.layout === "grid" ? {
848
703
  grid: {
849
704
  gutter: [props.columnGap, props.rowGap],
850
705
  style: { flex: 1, marginRight: "12px" }
851
706
  },
852
- style: { display: "flex", overflow: "hidden", height: heightStyle }
707
+ style: {
708
+ display: "flex",
709
+ overflow: "hidden",
710
+ height: heightStyle.value
711
+ }
853
712
  } : {
854
713
  layout: "inline",
855
714
  style: { gap: `${props.rowGap}px ${props.columnGap}px` },
@@ -910,29 +769,29 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
910
769
  ], 64)) : createCommentVNode("", true)
911
770
  ], true),
912
771
  renderSlot(_ctx.$slots, "expand-button", {
913
- expandStatus: expandStatus.value,
914
- changeExpandStatus
772
+ expandStatus: unref(expandStatus),
773
+ changeExpandStatus: unref(changeExpandStatus)
915
774
  }, () => [
916
- props.expandButton !== false && showExpandToggle.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
775
+ props.expandButton !== false && unref(showExpandToggle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
917
776
  props.expandButton ? (openBlock(), createBlock(resolveDynamicComponent(props.expandButton), {
918
777
  key: 0,
919
- "expand-status": expandStatus.value,
920
- onClick: changeExpandStatus
921
- }, null, 8, ["expand-status"])) : (openBlock(), createBlock(unref(Button), {
778
+ "expand-status": unref(expandStatus),
779
+ onClick: unref(changeExpandStatus)
780
+ }, null, 8, ["expand-status", "onClick"])) : (openBlock(), createBlock(unref(Button), {
922
781
  key: 1,
923
782
  type: "link",
924
783
  class: "pro-table_search-form_expand-toggle-button",
925
- onClick: changeExpandStatus
784
+ onClick: unref(changeExpandStatus)
926
785
  }, {
927
786
  default: withCtx(() => [
928
- createTextVNode(toDisplayString(expandStatus.value ? unref(t)("table.collapse") : unref(t)("table.expand")) + " ", 1),
787
+ createTextVNode(toDisplayString(unref(expandStatus) ? unref(t)("table.collapse") : unref(t)("table.expand")) + " ", 1),
929
788
  createVNode(DownOutlined, {
930
789
  class: "transition",
931
- style: normalizeStyle([{ "margin-left": "4px" }, { transform: `rotate(${expandStatus.value ? -180 : 0}deg)` }])
790
+ style: normalizeStyle([{ "margin-left": "4px" }, { transform: `rotate(${unref(expandStatus) ? -180 : 0}deg)` }])
932
791
  }, null, 8, ["style"])
933
792
  ]),
934
793
  _: 1
935
- }))
794
+ }, 8, ["onClick"]))
936
795
  ], 64)) : createCommentVNode("", true)
937
796
  ], true)
938
797
  ]),
@@ -944,7 +803,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
944
803
  };
945
804
  }
946
805
  });
947
- const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-9dca0a5d"]]);
806
+ const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-15688cc0"]]);
948
807
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
949
808
  __name: "DefaultSearchFormContainer",
950
809
  setup(__props) {
@@ -1138,13 +997,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1138
997
  },
1139
998
  { immediate: true }
1140
999
  );
1141
- onMounted(() => {
1142
- var _a, _b;
1143
- (_b = (_a = props.columnControl) == null ? void 0 : _a.disabledKeys) == null ? void 0 : _b.forEach((key) => {
1144
- var _a2, _b2;
1145
- (_b2 = (_a2 = props.table) == null ? void 0 : _a2.setColumn) == null ? void 0 : _b2.call(_a2, String(key), { hidden: false });
1146
- });
1147
- });
1148
1000
  watch(
1149
1001
  () => {
1150
1002
  var _a;
@@ -1156,7 +1008,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1156
1008
  (_b = (_a = props.table) == null ? void 0 : _a.setColumn) == null ? void 0 : _b.call(_a, String(key), { hidden: false });
1157
1009
  });
1158
1010
  },
1159
- { deep: true }
1011
+ { immediate: true, deep: true }
1160
1012
  );
1161
1013
  return (_ctx, _cache) => {
1162
1014
  return openBlock(), createBlock(unref(Dropdown), {
@@ -1233,7 +1085,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1233
1085
  };
1234
1086
  }
1235
1087
  });
1236
- const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-04235d0e"]]);
1088
+ const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-a94297cd"]]);
1237
1089
  const _hoisted_1 = { class: "pro-table_header" };
1238
1090
  const _hoisted_2 = {
1239
1091
  key: 0,
@@ -1269,13 +1121,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1269
1121
  "loadingModifiers": {}
1270
1122
  }),
1271
1123
  emits: ["update:size", "update:loading"],
1272
- setup(__props) {
1124
+ setup(__props, { expose: __expose }) {
1125
+ const tableProperties = Object.keys(tableProps());
1273
1126
  const props = __props;
1274
1127
  const { t } = useLocale();
1275
1128
  const config = INJECT_CONFIG["pro-table"];
1276
1129
  const injectPropsRaw = inject(config.injectionKey, config.default);
1277
1130
  const injectProps = computed(() => toValue(injectPropsRaw) || {});
1278
- const tableProperties = Object.keys(tableProps());
1279
1131
  const injectAttrs = computed(
1280
1132
  () => pick(injectProps.value, tableProperties)
1281
1133
  );
@@ -1294,14 +1146,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1294
1146
  });
1295
1147
  const size = useModel(__props, "size");
1296
1148
  const loading = useModel(__props, "loading");
1149
+ let searchSequence = 0;
1297
1150
  const _search = async () => {
1298
1151
  var _a;
1152
+ const seq = ++searchSequence;
1299
1153
  const searchPromise = (_a = props.search || attrs.onSearch) == null ? void 0 : _a();
1300
- if (isPromise(searchPromise)) {
1301
- loading.value = true;
1302
- try {
1303
- await searchPromise;
1304
- } finally {
1154
+ if (!isPromise(searchPromise)) return;
1155
+ loading.value = true;
1156
+ try {
1157
+ await searchPromise;
1158
+ } finally {
1159
+ if (seq === searchSequence) {
1305
1160
  loading.value = false;
1306
1161
  }
1307
1162
  }
@@ -1313,15 +1168,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1313
1168
  _search();
1314
1169
  });
1315
1170
  };
1171
+ const customSlotNames = [
1172
+ "search-form",
1173
+ "button-bar",
1174
+ "toolbar",
1175
+ "table"
1176
+ ];
1316
1177
  const slots = useSlots();
1317
- const {
1318
- "search-form": searchFormSlot,
1319
- "button-bar": buttonBarSlot,
1320
- toolbar: toolbarSlot,
1321
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1322
- table: tableSlot,
1323
- ...tableSlots
1324
- } = slots;
1178
+ const forwardedSlotNames = () => Object.keys(slots).filter(
1179
+ (name) => !customSlotNames.includes(name)
1180
+ );
1325
1181
  const searchPage1st = () => {
1326
1182
  var _a, _b;
1327
1183
  (_b = (_a = props.table) == null ? void 0 : _a.setPageParam) == null ? void 0 : _b.call(_a, { current: 1 });
@@ -1339,13 +1195,22 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1339
1195
  const container = props.tableContainer ?? injectProps.value.tableContainer ?? DefaultTableContainer;
1340
1196
  return container ? container : void 0;
1341
1197
  });
1342
- const renderIndex = ({ index: index2 }) => index2 + 1;
1198
+ const getIndex = (i) => {
1199
+ var _a;
1200
+ const pageParam = (_a = props.table) == null ? void 0 : _a.pageParam;
1201
+ if (pageParam && computedPagination.value !== false) {
1202
+ const current = pageParam.current ?? 1;
1203
+ const pageSize = pageParam.pageSize ?? 10;
1204
+ return (current - 1) * pageSize + i + 1;
1205
+ }
1206
+ return i + 1;
1207
+ };
1343
1208
  const indexColumn = computed(() => ({
1344
1209
  title: t("table.index"),
1345
1210
  dataIndex: "_index",
1346
1211
  key: "_index",
1347
1212
  width: 80,
1348
- customRender: renderIndex
1213
+ customRender: ({ index: index2 }) => getIndex(index2)
1349
1214
  }));
1350
1215
  const computedColumns = computed(() => {
1351
1216
  var _a;
@@ -1385,11 +1250,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1385
1250
  (_c = attrs.onChange) == null ? void 0 : _c.call(attrs, ...args);
1386
1251
  _search();
1387
1252
  };
1388
- const showSearch = computed(() => {
1253
+ const searchFormVisible = computed(() => {
1389
1254
  var _a, _b, _c, _d;
1390
1255
  const searchFields = (_b = (_a = props.table) == null ? void 0 : _a.searchForm) == null ? void 0 : _b.fields;
1391
1256
  const fieldList = (Array.isArray(searchFields) ? searchFields : searchFields == null ? void 0 : searchFields.value) ?? [];
1392
- return !!(searchFormSlot || ((_c = computedSearchFormConfig.value) == null ? void 0 : _c.hidden) !== true && ((_d = props.table) == null ? void 0 : _d.searchForm) && fieldList.filter((item) => !item.hidden).length > 0);
1257
+ return !!(((_c = computedSearchFormConfig.value) == null ? void 0 : _c.hidden) !== true && ((_d = props.table) == null ? void 0 : _d.searchForm) && fieldList.filter((item) => !toValue(item.hidden)).length > 0);
1393
1258
  });
1394
1259
  const computedControl = computed(() => {
1395
1260
  const controlConfig = props.control ?? injectProps.value.control;
@@ -1413,12 +1278,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1413
1278
  _search();
1414
1279
  }
1415
1280
  });
1281
+ __expose({
1282
+ /** 手动触发一次查询(与内部搜索共用 loading 竞态守卫),便于外部刷新列表 */
1283
+ search: _search
1284
+ });
1416
1285
  return (_ctx, _cache) => {
1417
1286
  return openBlock(), createElementBlock("div", {
1418
1287
  class: normalizeClass(["pro-table", unref(attrs).class]),
1419
1288
  style: normalizeStyle(unref(attrs).style)
1420
1289
  }, [
1421
- showSearch.value ? (openBlock(), createBlock(unref(_sfc_main$c), {
1290
+ searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(unref(_sfc_main$c), {
1422
1291
  key: 0,
1423
1292
  component: computedSearchFormConfig.value.container
1424
1293
  }, {
@@ -1441,10 +1310,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1441
1310
  createVNode(unref(_sfc_main$c), { component: computedTableContainer.value }, {
1442
1311
  default: withCtx(() => [
1443
1312
  createElementVNode("div", _hoisted_1, [
1444
- unref(buttonBarSlot) ? (openBlock(), createElementBlock("div", _hoisted_2, [
1313
+ _ctx.$slots["button-bar"] ? (openBlock(), createElementBlock("div", _hoisted_2, [
1445
1314
  renderSlot(_ctx.$slots, "button-bar", {}, void 0, true)
1446
1315
  ])) : createCommentVNode("", true),
1447
- unref(toolbarSlot) ? (openBlock(), createElementBlock("div", _hoisted_3, [
1316
+ _ctx.$slots["toolbar"] ? (openBlock(), createElementBlock("div", _hoisted_3, [
1448
1317
  renderSlot(_ctx.$slots, "toolbar", {}, void 0, true)
1449
1318
  ])) : createCommentVNode("", true),
1450
1319
  computedControl.value.sizeControl ? (openBlock(), createElementBlock("div", _hoisted_4, [
@@ -1470,7 +1339,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1470
1339
  pagination: computedPagination.value,
1471
1340
  onChange: onTableChange
1472
1341
  }), createSlots({ _: 2 }, [
1473
- renderList(tableSlots, (_, name) => {
1342
+ renderList(forwardedSlotNames(), (name) => {
1474
1343
  return {
1475
1344
  name,
1476
1345
  fn: withCtx((scoped) => [
@@ -1487,7 +1356,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1487
1356
  };
1488
1357
  }
1489
1358
  });
1490
- const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-5ce28f7b"]]);
1359
+ const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-41d09d2a"]]);
1491
1360
  function useTable(params) {
1492
1361
  return useTable$1(params);
1493
1362
  }
@@ -1536,9 +1405,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1536
1405
  }
1537
1406
  });
1538
1407
  }
1539
- if (props.componentMap) {
1540
- provide(INJECT_COMPONENTS, props.componentMap);
1541
- }
1408
+ provide(
1409
+ INJECT_COMPONENTS,
1410
+ computed(() => props.componentMap)
1411
+ );
1542
1412
  provide(
1543
1413
  LOCALE_INJECT_KEY,
1544
1414
  computed(() => props.locale)