@qin-ui/antd-vue-pro 2.4.5 → 2.5.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.
- package/AI-CONTEXT.md +26 -2
- package/README.md +44 -37
- package/api.json +24 -9
- package/es/antd-vue-pro.css +15 -15
- package/es/components/component-provider/components/index.vue.d.ts +3 -3
- package/es/components/component-provider/components/index.vue.d.ts.map +1 -1
- package/es/components/component-provider/constants/index.d.ts +20 -4
- package/es/components/component-provider/constants/index.d.ts.map +1 -1
- package/es/components/component-provider/types/index.d.ts +7 -3
- package/es/components/component-provider/types/index.d.ts.map +1 -1
- package/es/components/form/components/BaseField/index.vue.d.ts +7 -1
- package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -1
- package/es/components/form/components/BaseField/utils/index.d.ts +18 -0
- package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -1
- package/es/components/form/components/BaseFormItem/index.vue.d.ts +3 -0
- package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -1
- package/es/components/form/components/ContainerFragment/index.vue.d.ts +1 -0
- package/es/components/form/components/ContainerFragment/index.vue.d.ts.map +1 -1
- package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -1
- package/es/components/form/components/SlotComponent/index.vue.d.ts +1 -0
- package/es/components/form/components/SlotComponent/index.vue.d.ts.map +1 -1
- package/es/components/form/components/index.d.ts +4 -0
- package/es/components/form/components/index.d.ts.map +1 -1
- package/es/components/form/constants/index.d.ts.map +1 -1
- package/es/components/form/hooks/useFields.d.ts +2 -0
- package/es/components/form/hooks/useFields.d.ts.map +1 -1
- package/es/components/form/hooks/useGroupFieldAttrs.d.ts +10 -0
- package/es/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -1
- package/es/components/form/index.d.ts +2 -2
- package/es/components/form/index.d.ts.map +1 -1
- package/es/components/form/types/index.d.ts +75 -44
- package/es/components/form/types/index.d.ts.map +1 -1
- package/es/components/form/utils/fieldKey.d.ts +13 -0
- package/es/components/form/utils/fieldKey.d.ts.map +1 -0
- package/es/components/table/components/ColumnControl.vue.d.ts +3 -0
- package/es/components/table/components/ColumnControl.vue.d.ts.map +1 -1
- package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts.map +1 -1
- package/es/components/table/components/DefaultTableContainer.vue.d.ts.map +1 -1
- package/es/components/table/components/ProTable.vue.d.ts +8 -1
- package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
- package/es/components/table/components/SearchForm.vue.d.ts +9 -1
- package/es/components/table/components/SearchForm.vue.d.ts.map +1 -1
- package/es/components/table/components/SizeControl.vue.d.ts +7 -2
- package/es/components/table/components/SizeControl.vue.d.ts.map +1 -1
- package/es/components/table/hooks/useTable.d.ts.map +1 -1
- package/es/components/table/index.d.ts +4 -1
- package/es/components/table/index.d.ts.map +1 -1
- package/es/components/table/types/index.d.ts +14 -6
- package/es/components/table/types/index.d.ts.map +1 -1
- package/es/index.d.ts +8 -4
- package/es/index.d.ts.map +1 -1
- package/es/index.js +259 -123
- package/es/index.js.map +1 -1
- package/es/locale/index.d.ts +2 -0
- package/es/locale/index.d.ts.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 +15 -3
- package/es/shared/ui/index.d.ts.map +1 -1
- package/package.json +5 -3
- package/src/components/component-provider/components/index.vue +26 -12
- package/src/components/component-provider/constants/index.ts +33 -6
- package/src/components/component-provider/types/index.ts +17 -9
- package/src/components/form/components/BaseField/index.vue +41 -13
- package/src/components/form/components/BaseField/utils/index.ts +19 -1
- package/src/components/form/components/BaseFormItem/index.vue +28 -30
- package/src/components/form/components/ContainerFragment/index.vue +3 -1
- package/src/components/form/components/ProForm/index.vue +19 -14
- package/src/components/form/components/SlotComponent/index.vue +14 -4
- package/src/components/form/components/index.ts +8 -1
- package/src/components/form/constants/index.ts +3 -4
- package/src/components/form/hooks/useFields.ts +3 -1
- package/src/components/form/hooks/useGroupFieldAttrs.ts +29 -13
- package/src/components/form/index.ts +1 -3
- package/src/components/form/types/index.ts +79 -46
- package/src/components/form/utils/fieldKey.ts +27 -0
- package/src/components/table/components/ColumnControl.vue +17 -3
- package/src/components/table/components/DefaultSearchFormContainer.vue +5 -0
- package/src/components/table/components/DefaultTableContainer.vue +5 -0
- package/src/components/table/components/ProTable.vue +228 -69
- package/src/components/table/components/SearchForm.vue +56 -19
- package/src/components/table/components/SizeControl.vue +21 -1
- package/src/components/table/hooks/useTable.ts +1 -1
- package/src/components/table/index.ts +8 -3
- package/src/components/table/types/index.ts +15 -7
- package/src/index.ts +12 -5
- package/src/locale/index.ts +2 -0
- package/src/shared/core/index.ts +11 -0
- package/src/shared/ui/index.ts +22 -4
- package/tsconfig.json +0 -1
package/es/index.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import "./antd-vue-pro.css";
|
|
2
|
-
import { defineComponent, createBlock, renderSlot, openBlock, resolveDynamicComponent, normalizeProps, mergeProps, withCtx, createElementBlock,
|
|
2
|
+
import { defineComponent, createBlock, renderSlot, openBlock, resolveDynamicComponent, normalizeProps, mergeProps, withCtx, createElementBlock, Fragment, createTextVNode, toDisplayString, inject, computed, toValue, ref, createCommentVNode, createSlots, renderList, createVNode, toRaw, resolveComponent, unref, provide, useSlots, shallowRef, onUpdated, triggerRef, createElementVNode, withModifiers, normalizeStyle, nextTick, mergeModels, useModel, watch, getCurrentInstance, onMounted, normalizeClass, guardReactiveProps } 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 { useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, cloneDeep, InjectionFormSlotsKey, isPlainObject,
|
|
4
|
+
import { useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, useReactiveAttrs, cloneDeep, getObject, InjectionFormSlotsKey, isPlainObject, resolveFieldIdentity, isObjectItem, toPath, createFormProxy, InjectionFormKey, omitBy, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, useSearchFormExpand, pick, isPromise, useTable as useTable$1, omit } from "@qin-ui/pro-components-core";
|
|
5
5
|
import { enUS as enUS2, useFormData, zhCN as zhCN2, zhTW as zhTW2 } from "@qin-ui/pro-components-core";
|
|
6
6
|
import { useConfigContextInject } from "ant-design-vue/es/config-provider/context";
|
|
7
|
-
import { useInjectFormItemContext,
|
|
7
|
+
import { useInjectFormItemContext, useProvideFormItemContext } from "ant-design-vue/es/form/FormItemContext";
|
|
8
8
|
import { useInjectDisabled, useProviderDisabled } from "ant-design-vue/es/config-provider/DisabledContext";
|
|
9
9
|
import { colProps } from "ant-design-vue/es/grid/Col";
|
|
10
|
+
import { formItemProps } from "ant-design-vue/es/form";
|
|
10
11
|
import { tableProps } from "ant-design-vue/es/table";
|
|
11
12
|
const getPopupContainer = (triggerNode) => {
|
|
12
13
|
var _a;
|
|
13
14
|
return ((_a = triggerNode.closest) == null ? void 0 : _a.call(triggerNode, "form[class*='-form']")) || (typeof document !== "undefined" ? document.body : void 0);
|
|
14
15
|
};
|
|
15
16
|
const INJECT_COMPONENTS = Symbol("INJECT_COMPONENTS");
|
|
17
|
+
const INJECT_COMPONENT_VARS = Symbol("COMPONENT_VARS");
|
|
16
18
|
const INJECT_CONFIG = {
|
|
17
19
|
"pro-table": {
|
|
18
20
|
injectionKey: Symbol(""),
|
|
21
|
+
// 列 / 数据源取自组件绑定或 `:table` 实例,加载态由组件自身状态驱动
|
|
22
|
+
ignoreProps: ["loading", "columns", "dataSource"],
|
|
19
23
|
default: {
|
|
20
24
|
pagination: {
|
|
21
25
|
showSizeChanger: true,
|
|
@@ -32,6 +36,8 @@ const INJECT_CONFIG = {
|
|
|
32
36
|
},
|
|
33
37
|
"pro-form": {
|
|
34
38
|
injectionKey: Symbol(""),
|
|
39
|
+
// 表单实例由 `:form` 显式传入
|
|
40
|
+
ignoreProps: ["form"],
|
|
35
41
|
default: { grid: { gutter: { xs: 8, sm: 16, md: 16, lg: 24 } } }
|
|
36
42
|
},
|
|
37
43
|
"pro-form-item": {
|
|
@@ -174,8 +180,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
174
180
|
},
|
|
175
181
|
setup(__props) {
|
|
176
182
|
const props = __props;
|
|
183
|
+
const isRenderable = (c) => c !== null && c !== void 0 && (typeof c === "function" || typeof c === "object");
|
|
177
184
|
return (_ctx, _cache) => {
|
|
178
|
-
return
|
|
185
|
+
return isRenderable(props.component) ? (openBlock(), createBlock(resolveDynamicComponent(props.component), normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), null, 16)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
179
186
|
createTextVNode(toDisplayString(props.component), 1)
|
|
180
187
|
], 64));
|
|
181
188
|
};
|
|
@@ -265,7 +272,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
265
272
|
component: { default: void 0 },
|
|
266
273
|
path: { default: "" }
|
|
267
274
|
},
|
|
268
|
-
|
|
275
|
+
emits: ["field-value-change"],
|
|
276
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
269
277
|
const cloneDeepIfObject = (val) => (
|
|
270
278
|
// 原始值直接传递,引用值克隆快照
|
|
271
279
|
typeof val === "object" && val !== null ? cloneDeep(val) : val
|
|
@@ -274,15 +282,24 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
274
282
|
const { t } = useLocale();
|
|
275
283
|
const form = useForm(false);
|
|
276
284
|
const componentRef = ref();
|
|
285
|
+
const emit = __emit;
|
|
277
286
|
const formItemContext = useInjectFormItemContext();
|
|
278
|
-
|
|
279
|
-
formItemContext.
|
|
287
|
+
useProvideFormItemContext({
|
|
288
|
+
id: formItemContext.id,
|
|
289
|
+
onFieldBlur: formItemContext.onFieldBlur,
|
|
290
|
+
onFieldChange: () => {
|
|
291
|
+
},
|
|
292
|
+
clearValidate: formItemContext.clearValidate
|
|
293
|
+
});
|
|
294
|
+
const triggerFormItemChange = (value2) => {
|
|
295
|
+
emit("field-value-change", value2);
|
|
280
296
|
};
|
|
281
|
-
const attrs =
|
|
297
|
+
const attrs = useReactiveAttrs();
|
|
282
298
|
const pickerVal = attrs.picker;
|
|
283
299
|
const injectConfigKey = typeof props.component === "string" ? [props.component, pickerVal].filter(Boolean).join(".") : "";
|
|
284
300
|
const componentInjectConfig = injectConfigKey ? getInjectConfig(injectConfigKey) : void 0;
|
|
285
301
|
const rawInjectComponentProps = componentInjectConfig ? inject(componentInjectConfig.injectionKey, componentInjectConfig.default) : void 0;
|
|
302
|
+
const componentVars = inject(INJECT_COMPONENT_VARS, void 0);
|
|
286
303
|
const value = computed({
|
|
287
304
|
get() {
|
|
288
305
|
var _a;
|
|
@@ -303,7 +320,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
303
320
|
newVal = setFormatter(val, oldVal);
|
|
304
321
|
}
|
|
305
322
|
(_b = form.setFormData) == null ? void 0 : _b.call(form, props.path, newVal);
|
|
306
|
-
triggerFormItemChange();
|
|
323
|
+
triggerFormItemChange(newVal);
|
|
307
324
|
const { onUpdateValue } = groupedAttrs.value;
|
|
308
325
|
if (typeof onUpdateValue === "function") {
|
|
309
326
|
onUpdateValue(val);
|
|
@@ -314,7 +331,11 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
314
331
|
});
|
|
315
332
|
const parentDisabled = useInjectDisabled();
|
|
316
333
|
const groupedAttrs = computed(() => {
|
|
317
|
-
|
|
334
|
+
var _a;
|
|
335
|
+
const currentInjectProps = {
|
|
336
|
+
...toValue(rawInjectComponentProps) || {},
|
|
337
|
+
...getObject((_a = toValue(componentVars)) == null ? void 0 : _a[injectConfigKey])
|
|
338
|
+
};
|
|
318
339
|
const initProps = getInitProps(
|
|
319
340
|
{ component: props.component, picker: attrs.picker },
|
|
320
341
|
currentInjectProps,
|
|
@@ -386,6 +407,19 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
386
407
|
};
|
|
387
408
|
}
|
|
388
409
|
});
|
|
410
|
+
const fieldKeyMap = /* @__PURE__ */ new WeakMap();
|
|
411
|
+
let fieldKeySeed = 0;
|
|
412
|
+
const getFieldKey = (field) => {
|
|
413
|
+
if (field === null || typeof field !== "object")
|
|
414
|
+
return `raw_${String(field)}`;
|
|
415
|
+
const raw = toRaw(field);
|
|
416
|
+
let key = fieldKeyMap.get(raw);
|
|
417
|
+
if (key === void 0) {
|
|
418
|
+
key = ++fieldKeySeed;
|
|
419
|
+
fieldKeyMap.set(raw, key);
|
|
420
|
+
}
|
|
421
|
+
return key;
|
|
422
|
+
};
|
|
389
423
|
const formItemPropKeys = Object.keys(formItemProps()).concat([
|
|
390
424
|
"formItemContainer"
|
|
391
425
|
]);
|
|
@@ -404,7 +438,7 @@ function useGroupFieldAttrs(validFields) {
|
|
|
404
438
|
const componentProps = { slots: {} };
|
|
405
439
|
const formItemSlots = {};
|
|
406
440
|
if (isPlainObject(field)) {
|
|
407
|
-
const { path, name, fields, formItemClass, formItemStyle, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, formItemContainer, ...rest } = field;
|
|
441
|
+
const { path: _path, name: _name, fields, formItemClass, formItemStyle, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, formItemContainer, ...rest } = field;
|
|
408
442
|
const { class: injectClassName, style: injectStyle, span: injectSpan, xs, sm, md, lg, xl, xxl, formItemContainer: injectFormItemContainer, ...injectRest } = rawInject;
|
|
409
443
|
const initGridItemProps = span || span === 0 ? { span } : { xs, sm, md, lg, xl, xxl, span: injectSpan };
|
|
410
444
|
gridItemProps2 = fields ? { ...initGridItemProps, span: span ?? 24 } : initGridItemProps;
|
|
@@ -432,25 +466,30 @@ function useGroupFieldAttrs(validFields) {
|
|
|
432
466
|
componentProps.slots[k] = slots[k];
|
|
433
467
|
}
|
|
434
468
|
});
|
|
435
|
-
|
|
469
|
+
if (formItemSlots.label && formItemProps2.label !== void 0) {
|
|
470
|
+
delete formItemProps2.label;
|
|
471
|
+
}
|
|
472
|
+
const raw2 = resolveFieldIdentity(field);
|
|
436
473
|
return {
|
|
437
|
-
path:
|
|
474
|
+
path: raw2,
|
|
438
475
|
gridItemProps: gridItemProps2,
|
|
439
476
|
formItemProps: formItemProps2,
|
|
440
477
|
formItemSlots,
|
|
441
478
|
componentProps,
|
|
442
479
|
formItemContainer: container,
|
|
443
|
-
rawField: field
|
|
480
|
+
rawField: field,
|
|
481
|
+
renderKey: getFieldKey(field)
|
|
444
482
|
};
|
|
445
483
|
}
|
|
446
|
-
const raw =
|
|
484
|
+
const raw = resolveFieldIdentity(field);
|
|
447
485
|
return {
|
|
448
|
-
path:
|
|
486
|
+
path: raw,
|
|
449
487
|
gridItemProps: gridItemProps2,
|
|
450
488
|
formItemProps: formItemProps2,
|
|
451
489
|
formItemSlots,
|
|
452
490
|
componentProps,
|
|
453
|
-
rawField: field
|
|
491
|
+
rawField: field,
|
|
492
|
+
renderKey: getFieldKey(field)
|
|
454
493
|
};
|
|
455
494
|
});
|
|
456
495
|
});
|
|
@@ -464,22 +503,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
464
503
|
disabled: { type: Boolean, default: void 0 }
|
|
465
504
|
},
|
|
466
505
|
setup(__props) {
|
|
467
|
-
let fieldKeySeed = 0;
|
|
468
|
-
const fieldKeyMap = /* @__PURE__ */ new WeakMap();
|
|
469
|
-
const getFieldKey = (field) => {
|
|
470
|
-
const raw = toRaw(field);
|
|
471
|
-
let key = fieldKeyMap.get(raw);
|
|
472
|
-
if (key === void 0) {
|
|
473
|
-
key = ++fieldKeySeed;
|
|
474
|
-
fieldKeyMap.set(raw, key);
|
|
475
|
-
}
|
|
476
|
-
return key;
|
|
477
|
-
};
|
|
478
506
|
const props = __props;
|
|
479
507
|
const validFields = computed(
|
|
480
508
|
() => (
|
|
481
|
-
// hidden 支持 Ref/ComputedRef
|
|
482
|
-
(props.fields ?? []).filter(
|
|
509
|
+
// hidden 支持 Ref / ComputedRef 响应式形态(统一使用 toValue 取值)
|
|
510
|
+
(props.fields ?? []).filter(
|
|
511
|
+
(field) => isObjectItem(field) && !toValue(field.hidden)
|
|
512
|
+
)
|
|
483
513
|
)
|
|
484
514
|
);
|
|
485
515
|
useProviderDisabled(computed(() => props.disabled));
|
|
@@ -518,6 +548,12 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
518
548
|
}
|
|
519
549
|
}
|
|
520
550
|
};
|
|
551
|
+
const onFieldValueChange = (item) => {
|
|
552
|
+
var _a, _b;
|
|
553
|
+
if (((_a = item.formItemProps) == null ? void 0 : _a.autoLink) === false) return;
|
|
554
|
+
const instance = formItemInstanceMap.get(toRaw(item.rawField));
|
|
555
|
+
(_b = instance == null ? void 0 : instance.onFieldChange) == null ? void 0 : _b.call(instance);
|
|
556
|
+
};
|
|
521
557
|
const setFormItemRef = (field, el, formItemProps2) => {
|
|
522
558
|
if (!field || typeof field !== "object") return;
|
|
523
559
|
const raw = toRaw(field);
|
|
@@ -563,7 +599,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
563
599
|
default: withCtx(() => [
|
|
564
600
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(groupedFields), (item) => {
|
|
565
601
|
return openBlock(), createBlock(_sfc_main$e, mergeProps({
|
|
566
|
-
key: item.
|
|
602
|
+
key: item.renderKey,
|
|
567
603
|
component: enableGrid.value ? unref(Col) : void 0
|
|
568
604
|
}, { ref_for: true }, item.gridItemProps), {
|
|
569
605
|
default: withCtx(() => [
|
|
@@ -589,8 +625,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
589
625
|
ref_for: true,
|
|
590
626
|
ref: (el) => setComponentRef(item.rawField, el)
|
|
591
627
|
}, { ref_for: true }, item.componentProps, {
|
|
592
|
-
path: item.path
|
|
593
|
-
|
|
628
|
+
path: item.path,
|
|
629
|
+
onFieldValueChange: ($event) => onFieldValueChange(item)
|
|
630
|
+
}), null, 16, ["path", "onFieldValueChange"]))
|
|
594
631
|
]),
|
|
595
632
|
_: 2
|
|
596
633
|
}, [
|
|
@@ -623,15 +660,13 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
623
660
|
...{ name: "ProForm", inheritAttrs: false },
|
|
624
661
|
__name: "index",
|
|
625
662
|
props: {
|
|
626
|
-
grid: { type: [Boolean, Object], default:
|
|
663
|
+
grid: { type: [Boolean, Object], default: void 0 },
|
|
627
664
|
form: { default: void 0 }
|
|
628
665
|
},
|
|
629
666
|
setup(__props) {
|
|
630
667
|
const props = __props;
|
|
631
|
-
|
|
632
|
-
const currentForm = computed(
|
|
633
|
-
() => props.form ?? (fallbackForm ?? (fallbackForm = useForm()))
|
|
634
|
-
);
|
|
668
|
+
const fallbackForm = useForm();
|
|
669
|
+
const currentForm = computed(() => props.form ?? fallbackForm);
|
|
635
670
|
const formProxy = createFormProxy(() => currentForm.value);
|
|
636
671
|
provide(InjectionFormKey, formProxy);
|
|
637
672
|
const fields = computed(() => {
|
|
@@ -659,14 +694,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
659
694
|
const formKey = computed(() => getFormKey(currentForm.value));
|
|
660
695
|
const config = INJECT_CONFIG["pro-form"];
|
|
661
696
|
const injectFormConfig = inject(config.injectionKey, config.default);
|
|
662
|
-
const attrs =
|
|
697
|
+
const attrs = useReactiveAttrs();
|
|
663
698
|
const injectAttrs = computed(() => {
|
|
664
699
|
const raw = toValue(injectFormConfig);
|
|
665
700
|
const { grid: _injectGrid, ...rest } = raw || {};
|
|
666
701
|
return rest;
|
|
667
702
|
});
|
|
668
703
|
const formAttrs = computed(() => {
|
|
669
|
-
return mergeProps(
|
|
704
|
+
return mergeProps(
|
|
705
|
+
injectAttrs.value,
|
|
706
|
+
omitBy(camelizeProperties(attrs), (value) => value === void 0)
|
|
707
|
+
);
|
|
670
708
|
});
|
|
671
709
|
const slots = useSlots();
|
|
672
710
|
const formSlotsRef = shallowRef(slots);
|
|
@@ -725,7 +763,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
725
763
|
...{ name: "SearchForm" },
|
|
726
764
|
__name: "SearchForm",
|
|
727
765
|
props: {
|
|
728
|
-
form: {
|
|
766
|
+
form: {},
|
|
729
767
|
layout: { default: "grid" },
|
|
730
768
|
expand: { type: [Boolean, Object], default: true },
|
|
731
769
|
searchButton: { type: [Object, Function, Boolean], default: void 0 },
|
|
@@ -762,13 +800,27 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
762
800
|
const onReset = () => {
|
|
763
801
|
emit("reset");
|
|
764
802
|
};
|
|
765
|
-
|
|
803
|
+
let searchTriggeredInTick = false;
|
|
804
|
+
const emitSearch = () => {
|
|
805
|
+
searchTriggeredInTick = true;
|
|
806
|
+
nextTick(() => {
|
|
807
|
+
searchTriggeredInTick = false;
|
|
808
|
+
});
|
|
766
809
|
emit("search");
|
|
767
810
|
};
|
|
811
|
+
const onSearchSubmit = () => {
|
|
812
|
+
if (searchTriggeredInTick) return;
|
|
813
|
+
emitSearch();
|
|
814
|
+
};
|
|
815
|
+
const onSearchClick = () => {
|
|
816
|
+
if (searchTriggeredInTick) return;
|
|
817
|
+
emitSearch();
|
|
818
|
+
};
|
|
768
819
|
return (_ctx, _cache) => {
|
|
769
820
|
return openBlock(), createBlock(_sfc_main$a, mergeProps(layoutProps.value, {
|
|
770
821
|
form: props.form,
|
|
771
|
-
class: "pro-table_search-form transition"
|
|
822
|
+
class: "pro-table_search-form transition",
|
|
823
|
+
onSubmit: withModifiers(onSearchSubmit, ["prevent"])
|
|
772
824
|
}), {
|
|
773
825
|
default: withCtx(() => [
|
|
774
826
|
createVNode(unref(Space), {
|
|
@@ -793,17 +845,16 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
793
845
|
}))
|
|
794
846
|
], 64)) : createCommentVNode("", true)
|
|
795
847
|
], true),
|
|
796
|
-
renderSlot(_ctx.$slots, "search-button", { onSearch }, () => [
|
|
848
|
+
renderSlot(_ctx.$slots, "search-button", { onSearch: onSearchClick }, () => [
|
|
797
849
|
props.searchButton !== false ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
798
850
|
props.searchButton ? (openBlock(), createBlock(resolveDynamicComponent(props.searchButton), {
|
|
799
851
|
key: 0,
|
|
800
|
-
onClick:
|
|
852
|
+
onClick: onSearchClick
|
|
801
853
|
})) : (openBlock(), createBlock(unref(Button), {
|
|
802
854
|
key: 1,
|
|
803
855
|
class: "pro-table_search-form_search-button",
|
|
804
856
|
type: "primary",
|
|
805
|
-
"html-type": "submit"
|
|
806
|
-
onClick: onSearch
|
|
857
|
+
"html-type": "submit"
|
|
807
858
|
}, {
|
|
808
859
|
default: withCtx(() => [
|
|
809
860
|
createTextVNode(toDisplayString(unref(t)("table.query")), 1)
|
|
@@ -847,7 +898,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
847
898
|
};
|
|
848
899
|
}
|
|
849
900
|
});
|
|
850
|
-
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-
|
|
901
|
+
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-bf6cca54"]]);
|
|
851
902
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
852
903
|
__name: "DefaultSearchFormContainer",
|
|
853
904
|
setup(__props) {
|
|
@@ -862,7 +913,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
862
913
|
};
|
|
863
914
|
}
|
|
864
915
|
});
|
|
865
|
-
const DefaultSearchFormContainer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-
|
|
916
|
+
const DefaultSearchFormContainer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-570a1898"]]);
|
|
866
917
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
867
918
|
__name: "DefaultTableContainer",
|
|
868
919
|
setup(__props) {
|
|
@@ -877,7 +928,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
877
928
|
};
|
|
878
929
|
}
|
|
879
930
|
});
|
|
880
|
-
const DefaultTableContainer = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-
|
|
931
|
+
const DefaultTableContainer = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-e5c97b2f"]]);
|
|
881
932
|
const _sfc_main$5 = {};
|
|
882
933
|
const _hoisted_1$2 = {
|
|
883
934
|
focusable: "false",
|
|
@@ -896,19 +947,22 @@ function _sfc_render$1(_ctx, _cache) {
|
|
|
896
947
|
const ColumnHeightOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$1]]);
|
|
897
948
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
898
949
|
__name: "SizeControl",
|
|
899
|
-
props: {
|
|
950
|
+
props: /* @__PURE__ */ mergeModels({
|
|
951
|
+
effectiveSize: { default: void 0 }
|
|
952
|
+
}, {
|
|
900
953
|
"size": {},
|
|
901
954
|
"sizeModifiers": {}
|
|
902
|
-
},
|
|
955
|
+
}),
|
|
903
956
|
emits: ["update:size"],
|
|
904
957
|
setup(__props) {
|
|
905
958
|
const { t } = useLocale();
|
|
906
959
|
const configContext = useConfigContextInject();
|
|
960
|
+
const props = __props;
|
|
907
961
|
const size = useModel(__props, "size");
|
|
908
962
|
const currentSize = computed(
|
|
909
963
|
() => {
|
|
910
964
|
var _a;
|
|
911
|
-
return size.value ?? ((_a = configContext.componentSize) == null ? void 0 : _a.value) ?? "large";
|
|
965
|
+
return props.effectiveSize ?? size.value ?? ((_a = configContext.componentSize) == null ? void 0 : _a.value) ?? "large";
|
|
912
966
|
}
|
|
913
967
|
);
|
|
914
968
|
const onSizeChange = (val) => {
|
|
@@ -948,7 +1002,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
948
1002
|
};
|
|
949
1003
|
}
|
|
950
1004
|
});
|
|
951
|
-
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
1005
|
+
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-950f061f"]]);
|
|
952
1006
|
const _sfc_main$3 = {};
|
|
953
1007
|
const _hoisted_1$1 = {
|
|
954
1008
|
focusable: "false",
|
|
@@ -979,7 +1033,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
979
1033
|
const checkAll = ref(false);
|
|
980
1034
|
const indeterminate = ref(false);
|
|
981
1035
|
const checkedColumnsOptions = computed(
|
|
982
|
-
() => props.columns.flatMap((item) => {
|
|
1036
|
+
() => props.columns.filter(isObjectItem).flatMap((item) => {
|
|
983
1037
|
var _a, _b, _c, _d, _e, _f;
|
|
984
1038
|
const rawKey = item.key ?? (Array.isArray(item.dataIndex) ? item.dataIndex.join(".") : item.dataIndex);
|
|
985
1039
|
if (!rawKey || !item.title) return [];
|
|
@@ -991,7 +1045,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
991
1045
|
return {
|
|
992
1046
|
label,
|
|
993
1047
|
value: key,
|
|
994
|
-
checked: !item.hidden || disabled,
|
|
1048
|
+
checked: !toValue(item.hidden) || disabled,
|
|
995
1049
|
disabled
|
|
996
1050
|
};
|
|
997
1051
|
})
|
|
@@ -1130,7 +1184,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1130
1184
|
};
|
|
1131
1185
|
}
|
|
1132
1186
|
});
|
|
1133
|
-
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
1187
|
+
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-58650608"]]);
|
|
1134
1188
|
const _hoisted_1 = { class: "pro-table_header" };
|
|
1135
1189
|
const _hoisted_2 = {
|
|
1136
1190
|
key: 0,
|
|
@@ -1185,31 +1239,37 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1185
1239
|
container: container ? container : void 0
|
|
1186
1240
|
};
|
|
1187
1241
|
});
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1190
|
-
|
|
1242
|
+
const searchFormProps = computed(() => {
|
|
1243
|
+
const {
|
|
1244
|
+
container: _container,
|
|
1245
|
+
hidden: _hidden,
|
|
1246
|
+
...rest
|
|
1247
|
+
} = computedSearchFormConfig.value;
|
|
1248
|
+
return rest;
|
|
1191
1249
|
});
|
|
1250
|
+
const attrs = useReactiveAttrs();
|
|
1192
1251
|
const size = useModel(__props, "size");
|
|
1193
1252
|
const loading = useModel(__props, "loading");
|
|
1194
1253
|
let searchSequence = 0;
|
|
1195
|
-
|
|
1254
|
+
const SEARCH_WARN_MESSAGES = {
|
|
1255
|
+
duplicate: "同时配置了 :search prop 与 @search 监听,@search 监听不会被执行,请仅保留其一。",
|
|
1256
|
+
"not-promise": "search 未返回 Promise,本次查询不参与 loading 竞态管理(在途请求的 loading 状态保持不变)。"
|
|
1257
|
+
};
|
|
1258
|
+
const warnedSearchReasons = /* @__PURE__ */ new Set();
|
|
1196
1259
|
const warnSearchConfig = (reason) => {
|
|
1197
|
-
if (
|
|
1198
|
-
|
|
1199
|
-
console.warn(`[ProTable] ${reason}`);
|
|
1260
|
+
if (warnedSearchReasons.has(reason)) return;
|
|
1261
|
+
warnedSearchReasons.add(reason);
|
|
1262
|
+
console.warn(`[ProTable] ${SEARCH_WARN_MESSAGES[reason]}`);
|
|
1200
1263
|
};
|
|
1201
1264
|
const _search = async () => {
|
|
1202
|
-
|
|
1265
|
+
const search = props.search || attrs.onSearch;
|
|
1203
1266
|
if (props.search && attrs.onSearch) {
|
|
1204
|
-
warnSearchConfig(
|
|
1205
|
-
"同时配置了 :search prop 与 @search 监听,@search 监听不会被执行,请仅保留其一。"
|
|
1206
|
-
);
|
|
1267
|
+
warnSearchConfig("duplicate");
|
|
1207
1268
|
}
|
|
1208
|
-
|
|
1269
|
+
if (!search) return;
|
|
1270
|
+
const searchPromise = search();
|
|
1209
1271
|
if (!isPromise(searchPromise)) {
|
|
1210
|
-
warnSearchConfig(
|
|
1211
|
-
"search 未返回 Promise,本次查询不参与 loading 竞态管理(在途请求的 loading 状态保持不变)。"
|
|
1212
|
-
);
|
|
1272
|
+
warnSearchConfig("not-promise");
|
|
1213
1273
|
return;
|
|
1214
1274
|
}
|
|
1215
1275
|
const seq = ++searchSequence;
|
|
@@ -1256,13 +1316,37 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1256
1316
|
(_b = (_a = props.table) == null ? void 0 : _a.setPageParam) == null ? void 0 : _b.call(_a, { current: 1 });
|
|
1257
1317
|
_search();
|
|
1258
1318
|
};
|
|
1319
|
+
const instance = getCurrentInstance();
|
|
1320
|
+
const isBoundProp = (name) => {
|
|
1321
|
+
const vnodeProps = (instance == null ? void 0 : instance.vnode.props) || {};
|
|
1322
|
+
const kebab = name.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
|
|
1323
|
+
return name in vnodeProps || kebab in vnodeProps || `onUpdate:${name}` in vnodeProps;
|
|
1324
|
+
};
|
|
1325
|
+
const camelAttrs = computed(
|
|
1326
|
+
() => camelizeProperties(attrs)
|
|
1327
|
+
);
|
|
1328
|
+
const resolveOwnedProp = (name) => {
|
|
1329
|
+
const attrValue = camelAttrs.value[name];
|
|
1330
|
+
return isBoundProp(name) ? props[name] ?? attrValue : attrValue;
|
|
1331
|
+
};
|
|
1332
|
+
const hasExplicitColumns = computed(
|
|
1333
|
+
() => resolveOwnedProp("columns") !== void 0
|
|
1334
|
+
);
|
|
1335
|
+
const effectiveSize = computed(() => {
|
|
1336
|
+
return size.value ?? injectAttrs.value.size;
|
|
1337
|
+
});
|
|
1259
1338
|
const computedTableProps = computed(() => {
|
|
1260
|
-
|
|
1339
|
+
const merged = {
|
|
1261
1340
|
...injectAttrs.value,
|
|
1262
|
-
...
|
|
1263
|
-
|
|
1264
|
-
|
|
1341
|
+
...omitBy(
|
|
1342
|
+
pick(camelAttrs.value, tableProperties),
|
|
1343
|
+
(value) => value === void 0
|
|
1344
|
+
)
|
|
1265
1345
|
};
|
|
1346
|
+
delete merged.onChange;
|
|
1347
|
+
merged.size = effectiveSize.value;
|
|
1348
|
+
merged.loading = void 0;
|
|
1349
|
+
return merged;
|
|
1266
1350
|
});
|
|
1267
1351
|
const computedTableContainer = computed(() => {
|
|
1268
1352
|
const container = props.tableContainer ?? injectProps.value.tableContainer ?? DefaultTableContainer;
|
|
@@ -1270,13 +1354,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1270
1354
|
});
|
|
1271
1355
|
const getIndex = (i) => {
|
|
1272
1356
|
var _a;
|
|
1357
|
+
const pagination = computedPagination.value;
|
|
1358
|
+
if (pagination === false) return i + 1;
|
|
1273
1359
|
const pageParam = (_a = props.table) == null ? void 0 : _a.pageParam;
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
return (current - 1) * pageSize + i + 1;
|
|
1278
|
-
}
|
|
1279
|
-
return i + 1;
|
|
1360
|
+
const current = pagination.current ?? (pageParam == null ? void 0 : pageParam.current) ?? 1;
|
|
1361
|
+
const pageSize = pagination.pageSize ?? (pageParam == null ? void 0 : pageParam.pageSize) ?? 10;
|
|
1362
|
+
return (current - 1) * pageSize + i + 1;
|
|
1280
1363
|
};
|
|
1281
1364
|
const indexColumn = computed(() => ({
|
|
1282
1365
|
title: t("table.index"),
|
|
@@ -1287,34 +1370,61 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1287
1370
|
}));
|
|
1288
1371
|
const computedColumns = computed(() => {
|
|
1289
1372
|
var _a;
|
|
1290
|
-
const cols =
|
|
1373
|
+
const cols = resolveOwnedProp("columns") ?? toValue((_a = props.table) == null ? void 0 : _a.columns) ?? [];
|
|
1291
1374
|
const needIndex = props.addIndexColumn ?? injectProps.value.addIndexColumn;
|
|
1292
1375
|
return needIndex ? [indexColumn.value, ...cols] : cols;
|
|
1293
1376
|
});
|
|
1377
|
+
const filterVisibleColumns = (columns, ancestors = /* @__PURE__ */ new Set()) => {
|
|
1378
|
+
const list = [];
|
|
1379
|
+
let changed = false;
|
|
1380
|
+
for (const column of columns) {
|
|
1381
|
+
if (!isObjectItem(column) || toValue(column.hidden)) {
|
|
1382
|
+
changed = true;
|
|
1383
|
+
continue;
|
|
1384
|
+
}
|
|
1385
|
+
if (Array.isArray(column.children) && column.children.length > 0) {
|
|
1386
|
+
if (ancestors.has(column)) {
|
|
1387
|
+
changed = true;
|
|
1388
|
+
continue;
|
|
1389
|
+
}
|
|
1390
|
+
ancestors.add(column);
|
|
1391
|
+
const filtered = filterVisibleColumns(column.children, ancestors);
|
|
1392
|
+
ancestors.delete(column);
|
|
1393
|
+
if (filtered.changed) {
|
|
1394
|
+
changed = true;
|
|
1395
|
+
list.push({ ...column, children: filtered.list });
|
|
1396
|
+
continue;
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
list.push(column);
|
|
1400
|
+
}
|
|
1401
|
+
return { list, changed };
|
|
1402
|
+
};
|
|
1294
1403
|
const visibleComputedColumns = computed(() => {
|
|
1295
|
-
return computedColumns.value
|
|
1404
|
+
return filterVisibleColumns(computedColumns.value).list;
|
|
1296
1405
|
});
|
|
1297
1406
|
const computedDataSource = computed(() => {
|
|
1298
1407
|
var _a;
|
|
1299
|
-
return
|
|
1408
|
+
return resolveOwnedProp("dataSource") ?? toValue((_a = props.table) == null ? void 0 : _a.dataSource) ?? [];
|
|
1300
1409
|
});
|
|
1301
1410
|
const computedPagination = computed(() => {
|
|
1302
|
-
var _a, _b, _c
|
|
1303
|
-
|
|
1304
|
-
if (
|
|
1411
|
+
var _a, _b, _c;
|
|
1412
|
+
const attrsPagination = resolveOwnedProp("pagination");
|
|
1413
|
+
if (attrsPagination === false) return false;
|
|
1414
|
+
if (isPlainObject(attrsPagination)) {
|
|
1305
1415
|
const globalPagination = injectAttrs.value.pagination === false ? {} : injectAttrs.value.pagination;
|
|
1306
1416
|
return {
|
|
1307
1417
|
...globalPagination,
|
|
1308
1418
|
...(_a = props.table) == null ? void 0 : _a.pageParam,
|
|
1309
|
-
...
|
|
1310
|
-
showTotal: (
|
|
1419
|
+
...attrsPagination,
|
|
1420
|
+
showTotal: (attrsPagination == null ? void 0 : attrsPagination.showTotal) ?? (globalPagination == null ? void 0 : globalPagination.showTotal) ?? ((total) => t("pagination.total", { total }))
|
|
1311
1421
|
};
|
|
1312
1422
|
}
|
|
1313
1423
|
if (injectAttrs.value.pagination === false) return false;
|
|
1314
1424
|
return {
|
|
1315
1425
|
...injectAttrs.value.pagination,
|
|
1316
|
-
...(
|
|
1317
|
-
showTotal: ((
|
|
1426
|
+
...(_b = props.table) == null ? void 0 : _b.pageParam,
|
|
1427
|
+
showTotal: ((_c = injectAttrs.value.pagination) == null ? void 0 : _c.showTotal) ?? ((total) => t("pagination.total", { total }))
|
|
1318
1428
|
};
|
|
1319
1429
|
});
|
|
1320
1430
|
const onTableChange = (...args) => {
|
|
@@ -1327,9 +1437,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1327
1437
|
var _a, _b, _c, _d;
|
|
1328
1438
|
const searchFields = (_b = (_a = props.table) == null ? void 0 : _a.searchForm) == null ? void 0 : _b.fields;
|
|
1329
1439
|
const fieldList = (Array.isArray(searchFields) ? searchFields : searchFields == null ? void 0 : searchFields.value) ?? [];
|
|
1330
|
-
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);
|
|
1440
|
+
return !!(((_c = computedSearchFormConfig.value) == null ? void 0 : _c.hidden) !== true && ((_d = props.table) == null ? void 0 : _d.searchForm) && fieldList.filter((item) => isObjectItem(item) && !toValue(item.hidden)).length > 0);
|
|
1331
1441
|
});
|
|
1332
|
-
const
|
|
1442
|
+
const resolvedControl = computed(() => {
|
|
1333
1443
|
const controlConfig = props.control ?? injectProps.value.control;
|
|
1334
1444
|
if (controlConfig === true) {
|
|
1335
1445
|
return { sizeControl: true, columnControl: true };
|
|
@@ -1342,6 +1452,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1342
1452
|
columnControl: (controlConfig == null ? void 0 : controlConfig.columnControl) ?? false
|
|
1343
1453
|
};
|
|
1344
1454
|
});
|
|
1455
|
+
const computedControl = computed(
|
|
1456
|
+
() => hasExplicitColumns.value && resolvedControl.value.columnControl ? { ...resolvedControl.value, columnControl: false } : resolvedControl.value
|
|
1457
|
+
);
|
|
1345
1458
|
const columnControlConfig = computed(() => {
|
|
1346
1459
|
const cc = computedControl.value.columnControl;
|
|
1347
1460
|
return typeof cc === "object" ? cc : void 0;
|
|
@@ -1364,20 +1477,23 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1364
1477
|
key: 0,
|
|
1365
1478
|
component: computedSearchFormConfig.value.container
|
|
1366
1479
|
}, {
|
|
1367
|
-
default: withCtx(() =>
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1480
|
+
default: withCtx(() => {
|
|
1481
|
+
var _a;
|
|
1482
|
+
return [
|
|
1483
|
+
renderSlot(_ctx.$slots, "search-form", normalizeProps(guardReactiveProps({ form: (_a = props.table) == null ? void 0 : _a.searchForm, search: searchPage1st, reset })), () => {
|
|
1484
|
+
var _a2;
|
|
1485
|
+
return [
|
|
1486
|
+
((_a2 = props.table) == null ? void 0 : _a2.searchForm) ? (openBlock(), createBlock(SearchForm, mergeProps({
|
|
1487
|
+
key: 0,
|
|
1488
|
+
form: props.table.searchForm
|
|
1489
|
+
}, searchFormProps.value, {
|
|
1490
|
+
onSearch: searchPage1st,
|
|
1491
|
+
onReset: reset
|
|
1492
|
+
}), null, 16, ["form"])) : createCommentVNode("", true)
|
|
1493
|
+
];
|
|
1494
|
+
}, true)
|
|
1495
|
+
];
|
|
1496
|
+
}),
|
|
1381
1497
|
_: 3
|
|
1382
1498
|
}, 8, ["component"])) : createCommentVNode("", true),
|
|
1383
1499
|
createVNode(_sfc_main$e, { component: computedTableContainer.value }, {
|
|
@@ -1392,8 +1508,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1392
1508
|
computedControl.value.sizeControl ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
1393
1509
|
createVNode(SizeControl, {
|
|
1394
1510
|
size: size.value,
|
|
1395
|
-
"onUpdate:size": _cache[0] || (_cache[0] = ($event) => size.value = $event)
|
|
1396
|
-
|
|
1511
|
+
"onUpdate:size": _cache[0] || (_cache[0] = ($event) => size.value = $event),
|
|
1512
|
+
"effective-size": effectiveSize.value
|
|
1513
|
+
}, null, 8, ["size", "effective-size"])
|
|
1397
1514
|
])) : createCommentVNode("", true),
|
|
1398
1515
|
computedControl.value.columnControl ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
1399
1516
|
createVNode(ColumnControl, {
|
|
@@ -1403,9 +1520,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1403
1520
|
}, null, 8, ["columns", "table", "column-control"])
|
|
1404
1521
|
])) : createCommentVNode("", true)
|
|
1405
1522
|
]),
|
|
1406
|
-
renderSlot(_ctx.$slots, "table", {
|
|
1523
|
+
renderSlot(_ctx.$slots, "table", normalizeProps(guardReactiveProps({
|
|
1524
|
+
columns: visibleComputedColumns.value,
|
|
1525
|
+
dataSource: computedDataSource.value,
|
|
1526
|
+
pagination: computedPagination.value,
|
|
1527
|
+
loading: loading.value,
|
|
1528
|
+
size: effectiveSize.value,
|
|
1529
|
+
onChange: onTableChange
|
|
1530
|
+
})), () => [
|
|
1407
1531
|
createVNode(unref(Table), mergeProps({ class: "pro-table_content" }, computedTableProps.value, {
|
|
1408
|
-
size: size.value,
|
|
1409
1532
|
loading: loading.value,
|
|
1410
1533
|
columns: visibleComputedColumns.value,
|
|
1411
1534
|
"data-source": computedDataSource.value,
|
|
@@ -1420,7 +1543,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1420
1543
|
])
|
|
1421
1544
|
};
|
|
1422
1545
|
})
|
|
1423
|
-
]), 1040, ["
|
|
1546
|
+
]), 1040, ["loading", "columns", "data-source", "pagination"])
|
|
1424
1547
|
], true)
|
|
1425
1548
|
]),
|
|
1426
1549
|
_: 3
|
|
@@ -1429,7 +1552,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1429
1552
|
};
|
|
1430
1553
|
}
|
|
1431
1554
|
});
|
|
1432
|
-
const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
1555
|
+
const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e7753db3"]]);
|
|
1433
1556
|
function useTable(params) {
|
|
1434
1557
|
return useTable$1(params);
|
|
1435
1558
|
}
|
|
@@ -1449,15 +1572,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1449
1572
|
Object.keys(INJECT_CONFIG).forEach(
|
|
1450
1573
|
(key) => {
|
|
1451
1574
|
const config = INJECT_CONFIG[key];
|
|
1575
|
+
const ignored = config.ignoreProps;
|
|
1452
1576
|
provide(
|
|
1453
1577
|
config.injectionKey,
|
|
1454
|
-
computed(
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1578
|
+
computed(
|
|
1579
|
+
() => {
|
|
1580
|
+
var _a;
|
|
1581
|
+
return omit(
|
|
1582
|
+
{
|
|
1583
|
+
...config.default,
|
|
1584
|
+
...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
|
|
1585
|
+
},
|
|
1586
|
+
ignored ?? []
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1589
|
+
)
|
|
1461
1590
|
);
|
|
1462
1591
|
}
|
|
1463
1592
|
);
|
|
@@ -1478,6 +1607,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1478
1607
|
}
|
|
1479
1608
|
});
|
|
1480
1609
|
}
|
|
1610
|
+
provide(
|
|
1611
|
+
INJECT_COMPONENT_VARS,
|
|
1612
|
+
computed(() => props.componentVars ?? {})
|
|
1613
|
+
);
|
|
1481
1614
|
provide(
|
|
1482
1615
|
INJECT_COMPONENTS,
|
|
1483
1616
|
computed(() => props.componentMap)
|
|
@@ -1493,7 +1626,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1493
1626
|
});
|
|
1494
1627
|
const index = {
|
|
1495
1628
|
/**
|
|
1496
|
-
*
|
|
1629
|
+
* 安装方法
|
|
1497
1630
|
* @description 全局注册所有组件(ProForm、ProTable、ProComponentProvider)
|
|
1498
1631
|
*
|
|
1499
1632
|
* @param {App} app - Vue 应用实例
|
|
@@ -1509,7 +1642,10 @@ const index = {
|
|
|
1509
1642
|
install(app) {
|
|
1510
1643
|
app.component(_sfc_main$a.name, _sfc_main$a);
|
|
1511
1644
|
app.component(ProTable.name, ProTable);
|
|
1512
|
-
app.component(
|
|
1645
|
+
app.component(
|
|
1646
|
+
_sfc_main.name ?? "ProComponentProvider",
|
|
1647
|
+
_sfc_main
|
|
1648
|
+
);
|
|
1513
1649
|
}
|
|
1514
1650
|
};
|
|
1515
1651
|
export {
|