@qin-ui/antd-vue-pro 2.4.5 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI-CONTEXT.md +27 -3
- package/README.md +45 -38
- 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 -126
- 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 +4 -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 +29 -34
- package/src/components/form/components/ContainerFragment/index.vue +3 -1
- package/src/components/form/components/ProForm/index.vue +18 -13
- 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` 显式传入;grid 仅作为启用时的参数默认值,不开启网格
|
|
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));
|
|
@@ -489,10 +519,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
489
519
|
var _a;
|
|
490
520
|
return (_a = toValue(injectFormConfig)) == null ? void 0 : _a.grid;
|
|
491
521
|
});
|
|
492
|
-
const enableGrid = computed(() =>
|
|
493
|
-
if (props.grid !== void 0) return !!props.grid;
|
|
494
|
-
return !!injectGrid.value;
|
|
495
|
-
});
|
|
522
|
+
const enableGrid = computed(() => !!props.grid);
|
|
496
523
|
const computedGridProps = computed(() => {
|
|
497
524
|
return enableGrid.value ? { ...getObject(injectGrid.value), ...getObject(props.grid) } : {};
|
|
498
525
|
});
|
|
@@ -518,6 +545,12 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
518
545
|
}
|
|
519
546
|
}
|
|
520
547
|
};
|
|
548
|
+
const onFieldValueChange = (item) => {
|
|
549
|
+
var _a, _b;
|
|
550
|
+
if (((_a = item.formItemProps) == null ? void 0 : _a.autoLink) === false) return;
|
|
551
|
+
const instance = formItemInstanceMap.get(toRaw(item.rawField));
|
|
552
|
+
(_b = instance == null ? void 0 : instance.onFieldChange) == null ? void 0 : _b.call(instance);
|
|
553
|
+
};
|
|
521
554
|
const setFormItemRef = (field, el, formItemProps2) => {
|
|
522
555
|
if (!field || typeof field !== "object") return;
|
|
523
556
|
const raw = toRaw(field);
|
|
@@ -563,7 +596,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
563
596
|
default: withCtx(() => [
|
|
564
597
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(groupedFields), (item) => {
|
|
565
598
|
return openBlock(), createBlock(_sfc_main$e, mergeProps({
|
|
566
|
-
key: item.
|
|
599
|
+
key: item.renderKey,
|
|
567
600
|
component: enableGrid.value ? unref(Col) : void 0
|
|
568
601
|
}, { ref_for: true }, item.gridItemProps), {
|
|
569
602
|
default: withCtx(() => [
|
|
@@ -589,8 +622,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
589
622
|
ref_for: true,
|
|
590
623
|
ref: (el) => setComponentRef(item.rawField, el)
|
|
591
624
|
}, { ref_for: true }, item.componentProps, {
|
|
592
|
-
path: item.path
|
|
593
|
-
|
|
625
|
+
path: item.path,
|
|
626
|
+
onFieldValueChange: ($event) => onFieldValueChange(item)
|
|
627
|
+
}), null, 16, ["path", "onFieldValueChange"]))
|
|
594
628
|
]),
|
|
595
629
|
_: 2
|
|
596
630
|
}, [
|
|
@@ -628,10 +662,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
628
662
|
},
|
|
629
663
|
setup(__props) {
|
|
630
664
|
const props = __props;
|
|
631
|
-
|
|
632
|
-
const currentForm = computed(
|
|
633
|
-
() => props.form ?? (fallbackForm ?? (fallbackForm = useForm()))
|
|
634
|
-
);
|
|
665
|
+
const fallbackForm = useForm();
|
|
666
|
+
const currentForm = computed(() => props.form ?? fallbackForm);
|
|
635
667
|
const formProxy = createFormProxy(() => currentForm.value);
|
|
636
668
|
provide(InjectionFormKey, formProxy);
|
|
637
669
|
const fields = computed(() => {
|
|
@@ -659,14 +691,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
659
691
|
const formKey = computed(() => getFormKey(currentForm.value));
|
|
660
692
|
const config = INJECT_CONFIG["pro-form"];
|
|
661
693
|
const injectFormConfig = inject(config.injectionKey, config.default);
|
|
662
|
-
const attrs =
|
|
694
|
+
const attrs = useReactiveAttrs();
|
|
663
695
|
const injectAttrs = computed(() => {
|
|
664
696
|
const raw = toValue(injectFormConfig);
|
|
665
697
|
const { grid: _injectGrid, ...rest } = raw || {};
|
|
666
698
|
return rest;
|
|
667
699
|
});
|
|
668
700
|
const formAttrs = computed(() => {
|
|
669
|
-
return mergeProps(
|
|
701
|
+
return mergeProps(
|
|
702
|
+
injectAttrs.value,
|
|
703
|
+
omitBy(camelizeProperties(attrs), (value) => value === void 0)
|
|
704
|
+
);
|
|
670
705
|
});
|
|
671
706
|
const slots = useSlots();
|
|
672
707
|
const formSlotsRef = shallowRef(slots);
|
|
@@ -725,7 +760,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
725
760
|
...{ name: "SearchForm" },
|
|
726
761
|
__name: "SearchForm",
|
|
727
762
|
props: {
|
|
728
|
-
form: {
|
|
763
|
+
form: {},
|
|
729
764
|
layout: { default: "grid" },
|
|
730
765
|
expand: { type: [Boolean, Object], default: true },
|
|
731
766
|
searchButton: { type: [Object, Function, Boolean], default: void 0 },
|
|
@@ -762,13 +797,27 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
762
797
|
const onReset = () => {
|
|
763
798
|
emit("reset");
|
|
764
799
|
};
|
|
765
|
-
|
|
800
|
+
let searchTriggeredInTick = false;
|
|
801
|
+
const emitSearch = () => {
|
|
802
|
+
searchTriggeredInTick = true;
|
|
803
|
+
nextTick(() => {
|
|
804
|
+
searchTriggeredInTick = false;
|
|
805
|
+
});
|
|
766
806
|
emit("search");
|
|
767
807
|
};
|
|
808
|
+
const onSearchSubmit = () => {
|
|
809
|
+
if (searchTriggeredInTick) return;
|
|
810
|
+
emitSearch();
|
|
811
|
+
};
|
|
812
|
+
const onSearchClick = () => {
|
|
813
|
+
if (searchTriggeredInTick) return;
|
|
814
|
+
emitSearch();
|
|
815
|
+
};
|
|
768
816
|
return (_ctx, _cache) => {
|
|
769
817
|
return openBlock(), createBlock(_sfc_main$a, mergeProps(layoutProps.value, {
|
|
770
818
|
form: props.form,
|
|
771
|
-
class: "pro-table_search-form transition"
|
|
819
|
+
class: "pro-table_search-form transition",
|
|
820
|
+
onSubmit: withModifiers(onSearchSubmit, ["prevent"])
|
|
772
821
|
}), {
|
|
773
822
|
default: withCtx(() => [
|
|
774
823
|
createVNode(unref(Space), {
|
|
@@ -793,17 +842,16 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
793
842
|
}))
|
|
794
843
|
], 64)) : createCommentVNode("", true)
|
|
795
844
|
], true),
|
|
796
|
-
renderSlot(_ctx.$slots, "search-button", { onSearch }, () => [
|
|
845
|
+
renderSlot(_ctx.$slots, "search-button", { onSearch: onSearchClick }, () => [
|
|
797
846
|
props.searchButton !== false ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
798
847
|
props.searchButton ? (openBlock(), createBlock(resolveDynamicComponent(props.searchButton), {
|
|
799
848
|
key: 0,
|
|
800
|
-
onClick:
|
|
849
|
+
onClick: onSearchClick
|
|
801
850
|
})) : (openBlock(), createBlock(unref(Button), {
|
|
802
851
|
key: 1,
|
|
803
852
|
class: "pro-table_search-form_search-button",
|
|
804
853
|
type: "primary",
|
|
805
|
-
"html-type": "submit"
|
|
806
|
-
onClick: onSearch
|
|
854
|
+
"html-type": "submit"
|
|
807
855
|
}, {
|
|
808
856
|
default: withCtx(() => [
|
|
809
857
|
createTextVNode(toDisplayString(unref(t)("table.query")), 1)
|
|
@@ -847,7 +895,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
847
895
|
};
|
|
848
896
|
}
|
|
849
897
|
});
|
|
850
|
-
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-
|
|
898
|
+
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-bf6cca54"]]);
|
|
851
899
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
852
900
|
__name: "DefaultSearchFormContainer",
|
|
853
901
|
setup(__props) {
|
|
@@ -862,7 +910,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
862
910
|
};
|
|
863
911
|
}
|
|
864
912
|
});
|
|
865
|
-
const DefaultSearchFormContainer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-
|
|
913
|
+
const DefaultSearchFormContainer = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-570a1898"]]);
|
|
866
914
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
867
915
|
__name: "DefaultTableContainer",
|
|
868
916
|
setup(__props) {
|
|
@@ -877,7 +925,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
877
925
|
};
|
|
878
926
|
}
|
|
879
927
|
});
|
|
880
|
-
const DefaultTableContainer = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-
|
|
928
|
+
const DefaultTableContainer = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-e5c97b2f"]]);
|
|
881
929
|
const _sfc_main$5 = {};
|
|
882
930
|
const _hoisted_1$2 = {
|
|
883
931
|
focusable: "false",
|
|
@@ -896,19 +944,22 @@ function _sfc_render$1(_ctx, _cache) {
|
|
|
896
944
|
const ColumnHeightOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$1]]);
|
|
897
945
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
898
946
|
__name: "SizeControl",
|
|
899
|
-
props: {
|
|
947
|
+
props: /* @__PURE__ */ mergeModels({
|
|
948
|
+
effectiveSize: { default: void 0 }
|
|
949
|
+
}, {
|
|
900
950
|
"size": {},
|
|
901
951
|
"sizeModifiers": {}
|
|
902
|
-
},
|
|
952
|
+
}),
|
|
903
953
|
emits: ["update:size"],
|
|
904
954
|
setup(__props) {
|
|
905
955
|
const { t } = useLocale();
|
|
906
956
|
const configContext = useConfigContextInject();
|
|
957
|
+
const props = __props;
|
|
907
958
|
const size = useModel(__props, "size");
|
|
908
959
|
const currentSize = computed(
|
|
909
960
|
() => {
|
|
910
961
|
var _a;
|
|
911
|
-
return size.value ?? ((_a = configContext.componentSize) == null ? void 0 : _a.value) ?? "large";
|
|
962
|
+
return props.effectiveSize ?? size.value ?? ((_a = configContext.componentSize) == null ? void 0 : _a.value) ?? "large";
|
|
912
963
|
}
|
|
913
964
|
);
|
|
914
965
|
const onSizeChange = (val) => {
|
|
@@ -948,7 +999,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
948
999
|
};
|
|
949
1000
|
}
|
|
950
1001
|
});
|
|
951
|
-
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
1002
|
+
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-950f061f"]]);
|
|
952
1003
|
const _sfc_main$3 = {};
|
|
953
1004
|
const _hoisted_1$1 = {
|
|
954
1005
|
focusable: "false",
|
|
@@ -979,7 +1030,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
979
1030
|
const checkAll = ref(false);
|
|
980
1031
|
const indeterminate = ref(false);
|
|
981
1032
|
const checkedColumnsOptions = computed(
|
|
982
|
-
() => props.columns.flatMap((item) => {
|
|
1033
|
+
() => props.columns.filter(isObjectItem).flatMap((item) => {
|
|
983
1034
|
var _a, _b, _c, _d, _e, _f;
|
|
984
1035
|
const rawKey = item.key ?? (Array.isArray(item.dataIndex) ? item.dataIndex.join(".") : item.dataIndex);
|
|
985
1036
|
if (!rawKey || !item.title) return [];
|
|
@@ -991,7 +1042,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
991
1042
|
return {
|
|
992
1043
|
label,
|
|
993
1044
|
value: key,
|
|
994
|
-
checked: !item.hidden || disabled,
|
|
1045
|
+
checked: !toValue(item.hidden) || disabled,
|
|
995
1046
|
disabled
|
|
996
1047
|
};
|
|
997
1048
|
})
|
|
@@ -1130,7 +1181,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1130
1181
|
};
|
|
1131
1182
|
}
|
|
1132
1183
|
});
|
|
1133
|
-
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
1184
|
+
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-58650608"]]);
|
|
1134
1185
|
const _hoisted_1 = { class: "pro-table_header" };
|
|
1135
1186
|
const _hoisted_2 = {
|
|
1136
1187
|
key: 0,
|
|
@@ -1185,31 +1236,37 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1185
1236
|
container: container ? container : void 0
|
|
1186
1237
|
};
|
|
1187
1238
|
});
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1190
|
-
|
|
1239
|
+
const searchFormProps = computed(() => {
|
|
1240
|
+
const {
|
|
1241
|
+
container: _container,
|
|
1242
|
+
hidden: _hidden,
|
|
1243
|
+
...rest
|
|
1244
|
+
} = computedSearchFormConfig.value;
|
|
1245
|
+
return rest;
|
|
1191
1246
|
});
|
|
1247
|
+
const attrs = useReactiveAttrs();
|
|
1192
1248
|
const size = useModel(__props, "size");
|
|
1193
1249
|
const loading = useModel(__props, "loading");
|
|
1194
1250
|
let searchSequence = 0;
|
|
1195
|
-
|
|
1251
|
+
const SEARCH_WARN_MESSAGES = {
|
|
1252
|
+
duplicate: "同时配置了 :search prop 与 @search 监听,@search 监听不会被执行,请仅保留其一。",
|
|
1253
|
+
"not-promise": "search 未返回 Promise,本次查询不参与 loading 竞态管理(在途请求的 loading 状态保持不变)。"
|
|
1254
|
+
};
|
|
1255
|
+
const warnedSearchReasons = /* @__PURE__ */ new Set();
|
|
1196
1256
|
const warnSearchConfig = (reason) => {
|
|
1197
|
-
if (
|
|
1198
|
-
|
|
1199
|
-
console.warn(`[ProTable] ${reason}`);
|
|
1257
|
+
if (warnedSearchReasons.has(reason)) return;
|
|
1258
|
+
warnedSearchReasons.add(reason);
|
|
1259
|
+
console.warn(`[ProTable] ${SEARCH_WARN_MESSAGES[reason]}`);
|
|
1200
1260
|
};
|
|
1201
1261
|
const _search = async () => {
|
|
1202
|
-
|
|
1262
|
+
const search = props.search || attrs.onSearch;
|
|
1203
1263
|
if (props.search && attrs.onSearch) {
|
|
1204
|
-
warnSearchConfig(
|
|
1205
|
-
"同时配置了 :search prop 与 @search 监听,@search 监听不会被执行,请仅保留其一。"
|
|
1206
|
-
);
|
|
1264
|
+
warnSearchConfig("duplicate");
|
|
1207
1265
|
}
|
|
1208
|
-
|
|
1266
|
+
if (!search) return;
|
|
1267
|
+
const searchPromise = search();
|
|
1209
1268
|
if (!isPromise(searchPromise)) {
|
|
1210
|
-
warnSearchConfig(
|
|
1211
|
-
"search 未返回 Promise,本次查询不参与 loading 竞态管理(在途请求的 loading 状态保持不变)。"
|
|
1212
|
-
);
|
|
1269
|
+
warnSearchConfig("not-promise");
|
|
1213
1270
|
return;
|
|
1214
1271
|
}
|
|
1215
1272
|
const seq = ++searchSequence;
|
|
@@ -1256,13 +1313,37 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1256
1313
|
(_b = (_a = props.table) == null ? void 0 : _a.setPageParam) == null ? void 0 : _b.call(_a, { current: 1 });
|
|
1257
1314
|
_search();
|
|
1258
1315
|
};
|
|
1316
|
+
const instance = getCurrentInstance();
|
|
1317
|
+
const isBoundProp = (name) => {
|
|
1318
|
+
const vnodeProps = (instance == null ? void 0 : instance.vnode.props) || {};
|
|
1319
|
+
const kebab = name.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
|
|
1320
|
+
return name in vnodeProps || kebab in vnodeProps || `onUpdate:${name}` in vnodeProps;
|
|
1321
|
+
};
|
|
1322
|
+
const camelAttrs = computed(
|
|
1323
|
+
() => camelizeProperties(attrs)
|
|
1324
|
+
);
|
|
1325
|
+
const resolveOwnedProp = (name) => {
|
|
1326
|
+
const attrValue = camelAttrs.value[name];
|
|
1327
|
+
return isBoundProp(name) ? props[name] ?? attrValue : attrValue;
|
|
1328
|
+
};
|
|
1329
|
+
const hasExplicitColumns = computed(
|
|
1330
|
+
() => resolveOwnedProp("columns") !== void 0
|
|
1331
|
+
);
|
|
1332
|
+
const effectiveSize = computed(() => {
|
|
1333
|
+
return size.value ?? injectAttrs.value.size;
|
|
1334
|
+
});
|
|
1259
1335
|
const computedTableProps = computed(() => {
|
|
1260
|
-
|
|
1336
|
+
const merged = {
|
|
1261
1337
|
...injectAttrs.value,
|
|
1262
|
-
...
|
|
1263
|
-
|
|
1264
|
-
|
|
1338
|
+
...omitBy(
|
|
1339
|
+
pick(camelAttrs.value, tableProperties),
|
|
1340
|
+
(value) => value === void 0
|
|
1341
|
+
)
|
|
1265
1342
|
};
|
|
1343
|
+
delete merged.onChange;
|
|
1344
|
+
merged.size = effectiveSize.value;
|
|
1345
|
+
merged.loading = void 0;
|
|
1346
|
+
return merged;
|
|
1266
1347
|
});
|
|
1267
1348
|
const computedTableContainer = computed(() => {
|
|
1268
1349
|
const container = props.tableContainer ?? injectProps.value.tableContainer ?? DefaultTableContainer;
|
|
@@ -1270,13 +1351,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1270
1351
|
});
|
|
1271
1352
|
const getIndex = (i) => {
|
|
1272
1353
|
var _a;
|
|
1354
|
+
const pagination = computedPagination.value;
|
|
1355
|
+
if (pagination === false) return i + 1;
|
|
1273
1356
|
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;
|
|
1357
|
+
const current = pagination.current ?? (pageParam == null ? void 0 : pageParam.current) ?? 1;
|
|
1358
|
+
const pageSize = pagination.pageSize ?? (pageParam == null ? void 0 : pageParam.pageSize) ?? 10;
|
|
1359
|
+
return (current - 1) * pageSize + i + 1;
|
|
1280
1360
|
};
|
|
1281
1361
|
const indexColumn = computed(() => ({
|
|
1282
1362
|
title: t("table.index"),
|
|
@@ -1287,34 +1367,61 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1287
1367
|
}));
|
|
1288
1368
|
const computedColumns = computed(() => {
|
|
1289
1369
|
var _a;
|
|
1290
|
-
const cols =
|
|
1370
|
+
const cols = resolveOwnedProp("columns") ?? toValue((_a = props.table) == null ? void 0 : _a.columns) ?? [];
|
|
1291
1371
|
const needIndex = props.addIndexColumn ?? injectProps.value.addIndexColumn;
|
|
1292
1372
|
return needIndex ? [indexColumn.value, ...cols] : cols;
|
|
1293
1373
|
});
|
|
1374
|
+
const filterVisibleColumns = (columns, ancestors = /* @__PURE__ */ new Set()) => {
|
|
1375
|
+
const list = [];
|
|
1376
|
+
let changed = false;
|
|
1377
|
+
for (const column of columns) {
|
|
1378
|
+
if (!isObjectItem(column) || toValue(column.hidden)) {
|
|
1379
|
+
changed = true;
|
|
1380
|
+
continue;
|
|
1381
|
+
}
|
|
1382
|
+
if (Array.isArray(column.children) && column.children.length > 0) {
|
|
1383
|
+
if (ancestors.has(column)) {
|
|
1384
|
+
changed = true;
|
|
1385
|
+
continue;
|
|
1386
|
+
}
|
|
1387
|
+
ancestors.add(column);
|
|
1388
|
+
const filtered = filterVisibleColumns(column.children, ancestors);
|
|
1389
|
+
ancestors.delete(column);
|
|
1390
|
+
if (filtered.changed) {
|
|
1391
|
+
changed = true;
|
|
1392
|
+
list.push({ ...column, children: filtered.list });
|
|
1393
|
+
continue;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
list.push(column);
|
|
1397
|
+
}
|
|
1398
|
+
return { list, changed };
|
|
1399
|
+
};
|
|
1294
1400
|
const visibleComputedColumns = computed(() => {
|
|
1295
|
-
return computedColumns.value
|
|
1401
|
+
return filterVisibleColumns(computedColumns.value).list;
|
|
1296
1402
|
});
|
|
1297
1403
|
const computedDataSource = computed(() => {
|
|
1298
1404
|
var _a;
|
|
1299
|
-
return
|
|
1405
|
+
return resolveOwnedProp("dataSource") ?? toValue((_a = props.table) == null ? void 0 : _a.dataSource) ?? [];
|
|
1300
1406
|
});
|
|
1301
1407
|
const computedPagination = computed(() => {
|
|
1302
|
-
var _a, _b, _c
|
|
1303
|
-
|
|
1304
|
-
if (
|
|
1408
|
+
var _a, _b, _c;
|
|
1409
|
+
const attrsPagination = resolveOwnedProp("pagination");
|
|
1410
|
+
if (attrsPagination === false) return false;
|
|
1411
|
+
if (isPlainObject(attrsPagination)) {
|
|
1305
1412
|
const globalPagination = injectAttrs.value.pagination === false ? {} : injectAttrs.value.pagination;
|
|
1306
1413
|
return {
|
|
1307
1414
|
...globalPagination,
|
|
1308
1415
|
...(_a = props.table) == null ? void 0 : _a.pageParam,
|
|
1309
|
-
...
|
|
1310
|
-
showTotal: (
|
|
1416
|
+
...attrsPagination,
|
|
1417
|
+
showTotal: (attrsPagination == null ? void 0 : attrsPagination.showTotal) ?? (globalPagination == null ? void 0 : globalPagination.showTotal) ?? ((total) => t("pagination.total", { total }))
|
|
1311
1418
|
};
|
|
1312
1419
|
}
|
|
1313
1420
|
if (injectAttrs.value.pagination === false) return false;
|
|
1314
1421
|
return {
|
|
1315
1422
|
...injectAttrs.value.pagination,
|
|
1316
|
-
...(
|
|
1317
|
-
showTotal: ((
|
|
1423
|
+
...(_b = props.table) == null ? void 0 : _b.pageParam,
|
|
1424
|
+
showTotal: ((_c = injectAttrs.value.pagination) == null ? void 0 : _c.showTotal) ?? ((total) => t("pagination.total", { total }))
|
|
1318
1425
|
};
|
|
1319
1426
|
});
|
|
1320
1427
|
const onTableChange = (...args) => {
|
|
@@ -1327,9 +1434,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1327
1434
|
var _a, _b, _c, _d;
|
|
1328
1435
|
const searchFields = (_b = (_a = props.table) == null ? void 0 : _a.searchForm) == null ? void 0 : _b.fields;
|
|
1329
1436
|
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);
|
|
1437
|
+
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
1438
|
});
|
|
1332
|
-
const
|
|
1439
|
+
const resolvedControl = computed(() => {
|
|
1333
1440
|
const controlConfig = props.control ?? injectProps.value.control;
|
|
1334
1441
|
if (controlConfig === true) {
|
|
1335
1442
|
return { sizeControl: true, columnControl: true };
|
|
@@ -1342,6 +1449,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1342
1449
|
columnControl: (controlConfig == null ? void 0 : controlConfig.columnControl) ?? false
|
|
1343
1450
|
};
|
|
1344
1451
|
});
|
|
1452
|
+
const computedControl = computed(
|
|
1453
|
+
() => hasExplicitColumns.value && resolvedControl.value.columnControl ? { ...resolvedControl.value, columnControl: false } : resolvedControl.value
|
|
1454
|
+
);
|
|
1345
1455
|
const columnControlConfig = computed(() => {
|
|
1346
1456
|
const cc = computedControl.value.columnControl;
|
|
1347
1457
|
return typeof cc === "object" ? cc : void 0;
|
|
@@ -1364,20 +1474,23 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1364
1474
|
key: 0,
|
|
1365
1475
|
component: computedSearchFormConfig.value.container
|
|
1366
1476
|
}, {
|
|
1367
|
-
default: withCtx(() =>
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1477
|
+
default: withCtx(() => {
|
|
1478
|
+
var _a;
|
|
1479
|
+
return [
|
|
1480
|
+
renderSlot(_ctx.$slots, "search-form", normalizeProps(guardReactiveProps({ form: (_a = props.table) == null ? void 0 : _a.searchForm, search: searchPage1st, reset })), () => {
|
|
1481
|
+
var _a2;
|
|
1482
|
+
return [
|
|
1483
|
+
((_a2 = props.table) == null ? void 0 : _a2.searchForm) ? (openBlock(), createBlock(SearchForm, mergeProps({
|
|
1484
|
+
key: 0,
|
|
1485
|
+
form: props.table.searchForm
|
|
1486
|
+
}, searchFormProps.value, {
|
|
1487
|
+
onSearch: searchPage1st,
|
|
1488
|
+
onReset: reset
|
|
1489
|
+
}), null, 16, ["form"])) : createCommentVNode("", true)
|
|
1490
|
+
];
|
|
1491
|
+
}, true)
|
|
1492
|
+
];
|
|
1493
|
+
}),
|
|
1381
1494
|
_: 3
|
|
1382
1495
|
}, 8, ["component"])) : createCommentVNode("", true),
|
|
1383
1496
|
createVNode(_sfc_main$e, { component: computedTableContainer.value }, {
|
|
@@ -1392,8 +1505,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1392
1505
|
computedControl.value.sizeControl ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
1393
1506
|
createVNode(SizeControl, {
|
|
1394
1507
|
size: size.value,
|
|
1395
|
-
"onUpdate:size": _cache[0] || (_cache[0] = ($event) => size.value = $event)
|
|
1396
|
-
|
|
1508
|
+
"onUpdate:size": _cache[0] || (_cache[0] = ($event) => size.value = $event),
|
|
1509
|
+
"effective-size": effectiveSize.value
|
|
1510
|
+
}, null, 8, ["size", "effective-size"])
|
|
1397
1511
|
])) : createCommentVNode("", true),
|
|
1398
1512
|
computedControl.value.columnControl ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
1399
1513
|
createVNode(ColumnControl, {
|
|
@@ -1403,9 +1517,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1403
1517
|
}, null, 8, ["columns", "table", "column-control"])
|
|
1404
1518
|
])) : createCommentVNode("", true)
|
|
1405
1519
|
]),
|
|
1406
|
-
renderSlot(_ctx.$slots, "table", {
|
|
1520
|
+
renderSlot(_ctx.$slots, "table", normalizeProps(guardReactiveProps({
|
|
1521
|
+
columns: visibleComputedColumns.value,
|
|
1522
|
+
dataSource: computedDataSource.value,
|
|
1523
|
+
pagination: computedPagination.value,
|
|
1524
|
+
loading: loading.value,
|
|
1525
|
+
size: effectiveSize.value,
|
|
1526
|
+
onChange: onTableChange
|
|
1527
|
+
})), () => [
|
|
1407
1528
|
createVNode(unref(Table), mergeProps({ class: "pro-table_content" }, computedTableProps.value, {
|
|
1408
|
-
size: size.value,
|
|
1409
1529
|
loading: loading.value,
|
|
1410
1530
|
columns: visibleComputedColumns.value,
|
|
1411
1531
|
"data-source": computedDataSource.value,
|
|
@@ -1420,7 +1540,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1420
1540
|
])
|
|
1421
1541
|
};
|
|
1422
1542
|
})
|
|
1423
|
-
]), 1040, ["
|
|
1543
|
+
]), 1040, ["loading", "columns", "data-source", "pagination"])
|
|
1424
1544
|
], true)
|
|
1425
1545
|
]),
|
|
1426
1546
|
_: 3
|
|
@@ -1429,7 +1549,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1429
1549
|
};
|
|
1430
1550
|
}
|
|
1431
1551
|
});
|
|
1432
|
-
const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
1552
|
+
const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e7753db3"]]);
|
|
1433
1553
|
function useTable(params) {
|
|
1434
1554
|
return useTable$1(params);
|
|
1435
1555
|
}
|
|
@@ -1449,15 +1569,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1449
1569
|
Object.keys(INJECT_CONFIG).forEach(
|
|
1450
1570
|
(key) => {
|
|
1451
1571
|
const config = INJECT_CONFIG[key];
|
|
1572
|
+
const ignored = config.ignoreProps;
|
|
1452
1573
|
provide(
|
|
1453
1574
|
config.injectionKey,
|
|
1454
|
-
computed(
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1575
|
+
computed(
|
|
1576
|
+
() => {
|
|
1577
|
+
var _a;
|
|
1578
|
+
return omit(
|
|
1579
|
+
{
|
|
1580
|
+
...config.default,
|
|
1581
|
+
...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
|
|
1582
|
+
},
|
|
1583
|
+
ignored ?? []
|
|
1584
|
+
);
|
|
1585
|
+
}
|
|
1586
|
+
)
|
|
1461
1587
|
);
|
|
1462
1588
|
}
|
|
1463
1589
|
);
|
|
@@ -1478,6 +1604,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1478
1604
|
}
|
|
1479
1605
|
});
|
|
1480
1606
|
}
|
|
1607
|
+
provide(
|
|
1608
|
+
INJECT_COMPONENT_VARS,
|
|
1609
|
+
computed(() => props.componentVars ?? {})
|
|
1610
|
+
);
|
|
1481
1611
|
provide(
|
|
1482
1612
|
INJECT_COMPONENTS,
|
|
1483
1613
|
computed(() => props.componentMap)
|
|
@@ -1493,7 +1623,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1493
1623
|
});
|
|
1494
1624
|
const index = {
|
|
1495
1625
|
/**
|
|
1496
|
-
*
|
|
1626
|
+
* 安装方法
|
|
1497
1627
|
* @description 全局注册所有组件(ProForm、ProTable、ProComponentProvider)
|
|
1498
1628
|
*
|
|
1499
1629
|
* @param {App} app - Vue 应用实例
|
|
@@ -1509,7 +1639,10 @@ const index = {
|
|
|
1509
1639
|
install(app) {
|
|
1510
1640
|
app.component(_sfc_main$a.name, _sfc_main$a);
|
|
1511
1641
|
app.component(ProTable.name, ProTable);
|
|
1512
|
-
app.component(
|
|
1642
|
+
app.component(
|
|
1643
|
+
_sfc_main.name ?? "ProComponentProvider",
|
|
1644
|
+
_sfc_main
|
|
1645
|
+
);
|
|
1513
1646
|
}
|
|
1514
1647
|
};
|
|
1515
1648
|
export {
|