@qin-ui/antd-vue-pro 2.0.16 → 2.0.19
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/es/antd-vue-pro.css +13 -13
- package/es/component-provider/index.js +151 -3
- package/es/core/index-BrBzu6aj.js +362 -0
- package/es/form/index.js +28 -243
- package/es/index.d.ts +60 -180
- package/es/index.js +9 -7
- package/es/table/index.js +63 -189
- package/package.json +3 -2
- package/es/component-provider/index-D8NF18a1.js +0 -163
package/es/table/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { createElementBlock, openBlock, createElementVNode, defineComponent, ref, computed, watch, watchEffect, createBlock, unref, mergeProps, withCtx, createVNode, renderSlot, resolveDynamicComponent, createTextVNode, createCommentVNode, Fragment, toDisplayString, normalizeStyle,
|
|
2
|
-
import {
|
|
3
|
-
import _sfc_main$9, { ContainerFragment as _sfc_main$a
|
|
1
|
+
import { createElementBlock, openBlock, createElementVNode, defineComponent, ref, computed, watch, watchEffect, createBlock, unref, mergeProps, withCtx, createVNode, renderSlot, resolveDynamicComponent, createTextVNode, createCommentVNode, Fragment, toDisplayString, normalizeStyle, useModel, renderList, withModifiers, mergeModels, inject, useAttrs, useSlots, onMounted, normalizeClass, createSlots, normalizeProps, guardReactiveProps, nextTick } from "vue";
|
|
2
|
+
import { INJECT_CONFIG } from "../component-provider/index.js";
|
|
3
|
+
import _sfc_main$9, { ContainerFragment as _sfc_main$a } from "../form/index.js";
|
|
4
4
|
import { Space, Button, theme, Dropdown, Menu, MenuItem, Checkbox, MenuDivider, Table } from "ant-design-vue";
|
|
5
|
-
import { p as pick
|
|
5
|
+
import { p as pick } from "../vendor/utils/lodash-es-p6jau26B.js";
|
|
6
|
+
import { g as getObject, c as camelizeProperties, f as useTable$1 } from "../core/index-BrBzu6aj.js";
|
|
6
7
|
import { useConfigContextInject } from "ant-design-vue/es/config-provider/context";
|
|
7
8
|
import { tableProps } from "ant-design-vue/es/table";
|
|
8
9
|
const _export_sfc = (sfc, props) => {
|
|
@@ -43,7 +44,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
43
44
|
},
|
|
44
45
|
emits: ["search", "reset"],
|
|
45
46
|
setup(__props, { emit: __emit }) {
|
|
46
|
-
const props = __props;
|
|
47
47
|
const emit = __emit;
|
|
48
48
|
const proFormHeight = ref("unset");
|
|
49
49
|
const collapseHeight = ref(0);
|
|
@@ -51,11 +51,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
51
51
|
const rowGap = 16;
|
|
52
52
|
const columnGap = 24;
|
|
53
53
|
const computedExpand = computed(() => {
|
|
54
|
-
if (!
|
|
55
|
-
if (
|
|
54
|
+
if (!__props.expand) return false;
|
|
55
|
+
if (__props.expand === true) return { minExpandRows: 2, expandStatus: false };
|
|
56
56
|
return {
|
|
57
|
-
minExpandRows: Math.max(Math.floor(
|
|
58
|
-
expandStatus:
|
|
57
|
+
minExpandRows: Math.max(Math.floor(__props.expand.minExpandRows ?? 2), 1),
|
|
58
|
+
expandStatus: __props.expand.expandStatus ?? false
|
|
59
59
|
};
|
|
60
60
|
});
|
|
61
61
|
const showExpandToggle = ref(false);
|
|
@@ -63,10 +63,10 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
63
63
|
const changeExpandStatus = () => {
|
|
64
64
|
expandStatus.value = !expandStatus.value;
|
|
65
65
|
};
|
|
66
|
-
const { formRef, getFormData } =
|
|
66
|
+
const { formRef, getFormData } = __props.form;
|
|
67
67
|
const setInitExpandStatus = () => {
|
|
68
68
|
expandStatus.value = false;
|
|
69
|
-
if (formRef.value &&
|
|
69
|
+
if (formRef.value && __props.expand) {
|
|
70
70
|
const formEl = formRef.value.$el;
|
|
71
71
|
const formItemsEl = formEl.querySelectorAll(".ant-form-item>[path]");
|
|
72
72
|
const observer = new IntersectionObserver(
|
|
@@ -77,7 +77,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
77
77
|
const searchFieldValue = path ? getFormData == null ? void 0 : getFormData(path) : void 0;
|
|
78
78
|
return ![null, void 0].includes(searchFieldValue);
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return __props.expand.expandStatus;
|
|
81
81
|
});
|
|
82
82
|
observer.disconnect();
|
|
83
83
|
},
|
|
@@ -92,7 +92,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
92
92
|
[
|
|
93
93
|
() => {
|
|
94
94
|
var _a, _b, _c;
|
|
95
|
-
return (_c = (_b = (_a =
|
|
95
|
+
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;
|
|
96
96
|
},
|
|
97
97
|
() => formRef.value
|
|
98
98
|
],
|
|
@@ -109,7 +109,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
109
109
|
watchEffect(
|
|
110
110
|
() => {
|
|
111
111
|
if (typeof proFormHeight.value !== "number") return;
|
|
112
|
-
if (
|
|
112
|
+
if (__props.layout === "grid" && computedExpand.value) {
|
|
113
113
|
const { minExpandRows } = computedExpand.value;
|
|
114
114
|
collapseHeight.value = Math.min(
|
|
115
115
|
minExpandRows * rowHeight + (minExpandRows - 1) * rowGap,
|
|
@@ -126,7 +126,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
126
126
|
{ flush: "post" }
|
|
127
127
|
);
|
|
128
128
|
const layoutProps = computed(
|
|
129
|
-
() =>
|
|
129
|
+
() => __props.layout === "grid" ? {
|
|
130
130
|
grid: {
|
|
131
131
|
gutter: [columnGap, rowGap],
|
|
132
132
|
style: { flex: 1, marginRight: "12px" }
|
|
@@ -186,7 +186,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
186
186
|
onClick: onSearch
|
|
187
187
|
}, {
|
|
188
188
|
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
189
|
-
createTextVNode("
|
|
189
|
+
createTextVNode("查询 ", -1)
|
|
190
190
|
])]),
|
|
191
191
|
_: 1
|
|
192
192
|
}))
|
|
@@ -223,20 +223,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
|
-
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-
|
|
227
|
-
function useModel(props, name, options) {
|
|
228
|
-
const eventName = `onUpdate:${name}`;
|
|
229
|
-
const emitUpdate = props[eventName];
|
|
230
|
-
const _modelValue = ref(toValue(options == null ? void 0 : options.default));
|
|
231
|
-
const modelValue = computed({
|
|
232
|
-
get: () => props[name] === void 0 ? _modelValue.value : props[name],
|
|
233
|
-
set: (val) => {
|
|
234
|
-
_modelValue.value = val;
|
|
235
|
-
emitUpdate == null ? void 0 : emitUpdate(val);
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
return modelValue;
|
|
239
|
-
}
|
|
226
|
+
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-41da0f82"]]);
|
|
240
227
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
241
228
|
__name: "DefaultSearchFormContainer",
|
|
242
229
|
setup(__props) {
|
|
@@ -285,13 +272,16 @@ function _sfc_render$1(_ctx, _cache) {
|
|
|
285
272
|
const ColumnHeightOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1]]);
|
|
286
273
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
287
274
|
__name: "SizeControl",
|
|
275
|
+
props: {
|
|
276
|
+
"size": {},
|
|
277
|
+
"sizeModifiers": {}
|
|
278
|
+
},
|
|
279
|
+
emits: ["update:size"],
|
|
288
280
|
setup(__props) {
|
|
289
281
|
var _a;
|
|
290
|
-
const attrs = useAttrs();
|
|
291
282
|
const configContext = useConfigContextInject();
|
|
292
|
-
const size = useModel(
|
|
293
|
-
|
|
294
|
-
});
|
|
283
|
+
const size = useModel(__props, "size");
|
|
284
|
+
size.value = size.value ?? ((_a = configContext.componentSize) == null ? void 0 : _a.value) ?? "large";
|
|
295
285
|
const onSizeChange = (val) => {
|
|
296
286
|
size.value = val.key;
|
|
297
287
|
};
|
|
@@ -308,7 +298,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
308
298
|
overlay: withCtx(() => [
|
|
309
299
|
createVNode(unref(Menu), {
|
|
310
300
|
style: { "width": "100px", "text-align": "center" },
|
|
311
|
-
"selected-keys":
|
|
301
|
+
"selected-keys": size.value ? [size.value] : [],
|
|
312
302
|
items: sizeOptions,
|
|
313
303
|
onClick: onSizeChange
|
|
314
304
|
}, null, 8, ["selected-keys"])
|
|
@@ -329,7 +319,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
329
319
|
};
|
|
330
320
|
}
|
|
331
321
|
});
|
|
332
|
-
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
322
|
+
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-db17998d"]]);
|
|
333
323
|
const _sfc_main$2 = {};
|
|
334
324
|
const _hoisted_1$1 = {
|
|
335
325
|
focusable: "false",
|
|
@@ -350,15 +340,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
350
340
|
__name: "ColumnControl",
|
|
351
341
|
props: {
|
|
352
342
|
columns: {},
|
|
353
|
-
table: { default: void 0 }
|
|
343
|
+
table: { default: () => void 0 }
|
|
354
344
|
},
|
|
355
345
|
setup(__props) {
|
|
356
|
-
const props = __props;
|
|
357
346
|
const open = ref(false);
|
|
358
347
|
const checkAll = ref(false);
|
|
359
348
|
const indeterminate = ref(false);
|
|
360
349
|
const checkedColumnsOptions = computed(
|
|
361
|
-
() =>
|
|
350
|
+
() => __props.columns.flatMap(
|
|
362
351
|
(item) => item.key && item.title ? {
|
|
363
352
|
label: item.title,
|
|
364
353
|
value: item.key,
|
|
@@ -376,7 +365,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
376
365
|
var _a;
|
|
377
366
|
(_a = checkedColumnsOptions.value) == null ? void 0 : _a.forEach((item) => {
|
|
378
367
|
var _a2, _b;
|
|
379
|
-
(_b = (_a2 =
|
|
368
|
+
(_b = (_a2 = __props.table) == null ? void 0 : _a2.setColumn) == null ? void 0 : _b.call(_a2, item.value, {
|
|
380
369
|
hidden: !val.includes(item.value)
|
|
381
370
|
});
|
|
382
371
|
});
|
|
@@ -475,7 +464,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
475
464
|
};
|
|
476
465
|
}
|
|
477
466
|
});
|
|
478
|
-
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
467
|
+
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-d503f78a"]]);
|
|
479
468
|
const _hoisted_1 = { class: "pro-table_header" };
|
|
480
469
|
const _hoisted_2 = {
|
|
481
470
|
key: 0,
|
|
@@ -496,27 +485,32 @@ const _hoisted_5 = {
|
|
|
496
485
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
497
486
|
...{ name: "ProTable", inheritAttrs: false },
|
|
498
487
|
__name: "BaseTable",
|
|
499
|
-
props: {
|
|
500
|
-
table: { default: void 0 },
|
|
488
|
+
props: /* @__PURE__ */ mergeModels({
|
|
489
|
+
table: { default: () => void 0 },
|
|
501
490
|
search: { type: Function, default: void 0 },
|
|
502
|
-
addIndexColumn: { type: Boolean, default: void 0 },
|
|
503
|
-
immediateSearch: { type: Boolean, default: void 0 },
|
|
504
|
-
control: { type: [Boolean, Object], default: void 0 },
|
|
505
|
-
searchFormConfig: { default: void 0 },
|
|
491
|
+
addIndexColumn: { type: Boolean, default: () => void 0 },
|
|
492
|
+
immediateSearch: { type: Boolean, default: () => void 0 },
|
|
493
|
+
control: { type: [Boolean, Object], default: () => void 0 },
|
|
494
|
+
searchFormConfig: { default: () => void 0 },
|
|
506
495
|
tableContainer: { type: [Object, Function, Boolean], default: void 0 }
|
|
507
|
-
},
|
|
496
|
+
}, {
|
|
497
|
+
"size": {},
|
|
498
|
+
"sizeModifiers": {},
|
|
499
|
+
"loading": { type: Boolean },
|
|
500
|
+
"loadingModifiers": {}
|
|
501
|
+
}),
|
|
502
|
+
emits: ["update:size", "update:loading"],
|
|
508
503
|
setup(__props) {
|
|
509
|
-
const props = __props;
|
|
510
504
|
const config = INJECT_CONFIG["pro-table"];
|
|
511
505
|
const injectProps = inject(config.injectionKey, config.default);
|
|
512
506
|
const tableProperties = Object.keys(tableProps());
|
|
513
507
|
const injectAttrs = pick(injectProps, tableProperties);
|
|
514
508
|
const computedSearchFormConfig = computed(() => {
|
|
515
509
|
var _a, _b;
|
|
516
|
-
const container = ((_a =
|
|
510
|
+
const container = ((_a = __props.searchFormConfig) == null ? void 0 : _a.container) ?? ((_b = injectProps.searchFormConfig) == null ? void 0 : _b.container) ?? DefaultSearchFormContainer;
|
|
517
511
|
return {
|
|
518
512
|
...injectProps.searchFormConfig,
|
|
519
|
-
...getObject(
|
|
513
|
+
...getObject(__props.searchFormConfig),
|
|
520
514
|
container: container ? container : void 0
|
|
521
515
|
};
|
|
522
516
|
});
|
|
@@ -524,21 +518,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
524
518
|
const tableAttrs = computed(() => {
|
|
525
519
|
return pick(camelizeProperties(attrs), tableProperties);
|
|
526
520
|
});
|
|
527
|
-
const { columns, dataSource, searchForm, pageParam, setPageParam } =
|
|
528
|
-
const size = useModel(
|
|
529
|
-
const loading = useModel(
|
|
521
|
+
const { columns, dataSource, searchForm, pageParam, setPageParam } = __props.table || {};
|
|
522
|
+
const size = useModel(__props, "size");
|
|
523
|
+
const loading = useModel(__props, "loading");
|
|
530
524
|
const _search = async () => {
|
|
531
525
|
var _a;
|
|
532
526
|
try {
|
|
533
527
|
loading.value = true;
|
|
534
|
-
await ((_a =
|
|
528
|
+
await ((_a = __props.search) == null ? void 0 : _a.call(__props));
|
|
535
529
|
} finally {
|
|
536
530
|
loading.value = false;
|
|
537
531
|
}
|
|
538
532
|
};
|
|
539
533
|
const reset = () => {
|
|
540
534
|
var _a;
|
|
541
|
-
(_a =
|
|
535
|
+
(_a = __props.table) == null ? void 0 : _a.resetQueryParams();
|
|
542
536
|
nextTick(() => {
|
|
543
537
|
_search();
|
|
544
538
|
});
|
|
@@ -565,7 +559,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
565
559
|
};
|
|
566
560
|
});
|
|
567
561
|
const computedTableContainer = computed(() => {
|
|
568
|
-
const container =
|
|
562
|
+
const container = __props.tableContainer ?? injectProps.tableContainer ?? DefaultTableContainer;
|
|
569
563
|
return container ? container : void 0;
|
|
570
564
|
});
|
|
571
565
|
const indexColumn = {
|
|
@@ -576,7 +570,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
576
570
|
};
|
|
577
571
|
const computedColumns = computed(
|
|
578
572
|
() => [
|
|
579
|
-
...
|
|
573
|
+
...__props.addIndexColumn ?? injectProps.addIndexColumn ? [indexColumn] : [],
|
|
580
574
|
...(tableAttrs.value.columns ?? (columns == null ? void 0 : columns.value) ?? []).flatMap(
|
|
581
575
|
(item, index) => {
|
|
582
576
|
if (item.key) return [{ ...item, key: item.key }];
|
|
@@ -614,13 +608,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
614
608
|
return !!(searchFormSlot || ((_a = computedSearchFormConfig.value) == null ? void 0 : _a.hidden) !== true && searchForm && ((_b = searchForm.fields.value.filter((item) => !item.hidden)) == null ? void 0 : _b.length) > 0);
|
|
615
609
|
});
|
|
616
610
|
const computedControl = computed(() => {
|
|
617
|
-
const
|
|
618
|
-
const sizeControl = (
|
|
619
|
-
const columnControl = (
|
|
611
|
+
const mergedControl = __props.control ?? injectProps.control;
|
|
612
|
+
const sizeControl = (mergedControl == null ? void 0 : mergedControl.sizeControl) ?? mergedControl;
|
|
613
|
+
const columnControl = (mergedControl == null ? void 0 : mergedControl.columnControl) ?? mergedControl;
|
|
620
614
|
return { sizeControl, columnControl };
|
|
621
615
|
});
|
|
622
616
|
onMounted(() => {
|
|
623
|
-
if (
|
|
617
|
+
if (__props.immediateSearch ?? injectProps.immediateSearch) {
|
|
624
618
|
_search();
|
|
625
619
|
}
|
|
626
620
|
});
|
|
@@ -657,21 +651,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
657
651
|
])) : createCommentVNode("", true),
|
|
658
652
|
computedControl.value.sizeControl ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
659
653
|
createVNode(unref(SizeControl), {
|
|
660
|
-
size:
|
|
661
|
-
"onUpdate:size": _cache[0] || (_cache[0] = ($event) =>
|
|
654
|
+
size: size.value,
|
|
655
|
+
"onUpdate:size": _cache[0] || (_cache[0] = ($event) => size.value = $event)
|
|
662
656
|
}, null, 8, ["size"])
|
|
663
657
|
])) : createCommentVNode("", true),
|
|
664
658
|
computedControl.value.columnControl ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
665
659
|
createVNode(unref(ColumnControl), {
|
|
666
660
|
columns: computedColumns.value,
|
|
667
|
-
table:
|
|
661
|
+
table: __props.table
|
|
668
662
|
}, null, 8, ["columns", "table"])
|
|
669
663
|
])) : createCommentVNode("", true)
|
|
670
664
|
]),
|
|
671
665
|
renderSlot(_ctx.$slots, "table", {}, () => [
|
|
672
666
|
createVNode(unref(Table), mergeProps({ class: "pro-table_content" }, computedTableProps.value, {
|
|
673
|
-
size:
|
|
674
|
-
loading:
|
|
667
|
+
size: size.value,
|
|
668
|
+
loading: loading.value,
|
|
675
669
|
columns: visibleComputedColumns.value,
|
|
676
670
|
"data-source": computedDataSource.value,
|
|
677
671
|
pagination: computedPagination.value,
|
|
@@ -694,128 +688,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
694
688
|
};
|
|
695
689
|
}
|
|
696
690
|
});
|
|
697
|
-
const BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
698
|
-
const
|
|
699
|
-
const pageParamProperty = ["current", "pageSize", "total"];
|
|
700
|
-
const useTable = (params) => {
|
|
701
|
-
const {
|
|
702
|
-
columns: initColumns = [],
|
|
703
|
-
dataSource: initDataSource = [],
|
|
704
|
-
pageParam: initPageParam = getDefaultPageParam(),
|
|
705
|
-
searchParam: initSearchParam = {},
|
|
706
|
-
searchFields: initSearchFields = []
|
|
707
|
-
} = params;
|
|
708
|
-
const _initSearchParam = cloneDeep(toValue(initSearchParam));
|
|
709
|
-
const columns = ref([]);
|
|
710
|
-
columns.value = initColumns;
|
|
711
|
-
const dataSource = ref(initDataSource);
|
|
712
|
-
const pageParam = reactive(initPageParam);
|
|
713
|
-
const setPageParam = (pa) => {
|
|
714
|
-
let newPageParam = pa;
|
|
715
|
-
if (typeof pa === "function") {
|
|
716
|
-
newPageParam = pa(pageParam);
|
|
717
|
-
}
|
|
718
|
-
Object.assign(pageParam, pick(newPageParam, pageParamProperty));
|
|
719
|
-
};
|
|
720
|
-
const searchForm = useForm(initSearchParam, initSearchFields, true);
|
|
721
|
-
const resetQueryParams = () => {
|
|
722
|
-
Object.assign(pageParam, getDefaultPageParam());
|
|
723
|
-
searchForm.setFormData(cloneDeep(_initSearchParam));
|
|
724
|
-
};
|
|
725
|
-
const updaterMatch = (key, updater, options = {}) => {
|
|
726
|
-
if (!key) return;
|
|
727
|
-
const { all = typeof key === "function" } = options;
|
|
728
|
-
for (let i = 0; i < columns.value.length; i++) {
|
|
729
|
-
const columnItem = columns.value[i];
|
|
730
|
-
let matched = false;
|
|
731
|
-
if (typeof key === "function") {
|
|
732
|
-
matched = key(columnItem);
|
|
733
|
-
} else if (columnItem.key) {
|
|
734
|
-
matched = columnItem.key === key;
|
|
735
|
-
} else if (columnItem.dataIndex) {
|
|
736
|
-
const dataIndexKey = Array.isArray(columnItem.dataIndex) ? columnItem.dataIndex.join(".") : columnItem.dataIndex;
|
|
737
|
-
matched = dataIndexKey === key;
|
|
738
|
-
} else {
|
|
739
|
-
matched = key === i;
|
|
740
|
-
}
|
|
741
|
-
if (matched) {
|
|
742
|
-
updater({
|
|
743
|
-
column: columnItem,
|
|
744
|
-
columnIndex: i,
|
|
745
|
-
group: columns.value
|
|
746
|
-
});
|
|
747
|
-
if (!all) return;
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
const setColumn = (key, column, options) => {
|
|
752
|
-
if (!key || !column) return;
|
|
753
|
-
const { updateType = "merge", ...rest } = options || {};
|
|
754
|
-
updaterMatch(
|
|
755
|
-
key,
|
|
756
|
-
({ column: preColumn, columnIndex, group }) => {
|
|
757
|
-
let value = column;
|
|
758
|
-
if (typeof column === "function") {
|
|
759
|
-
value = column(preColumn);
|
|
760
|
-
}
|
|
761
|
-
if (!value) return;
|
|
762
|
-
if (updateType === "rewrite") {
|
|
763
|
-
group[columnIndex] = value;
|
|
764
|
-
} else {
|
|
765
|
-
Object.assign(preColumn, value);
|
|
766
|
-
}
|
|
767
|
-
},
|
|
768
|
-
rest
|
|
769
|
-
);
|
|
770
|
-
};
|
|
771
|
-
function deleteColumn(path, options) {
|
|
772
|
-
if (!path) return;
|
|
773
|
-
updaterMatch(
|
|
774
|
-
path,
|
|
775
|
-
({ columnIndex, group }) => {
|
|
776
|
-
group.splice(columnIndex, 1);
|
|
777
|
-
},
|
|
778
|
-
options
|
|
779
|
-
);
|
|
780
|
-
}
|
|
781
|
-
function addColumns(path, newColumns, options, placement) {
|
|
782
|
-
if (newColumns.length === 0) return;
|
|
783
|
-
if (path) {
|
|
784
|
-
updaterMatch(
|
|
785
|
-
path,
|
|
786
|
-
({ columnIndex, group }) => {
|
|
787
|
-
const index = placement === "after" ? columnIndex + 1 : columnIndex;
|
|
788
|
-
group.splice(index, 0, ...newColumns);
|
|
789
|
-
},
|
|
790
|
-
options
|
|
791
|
-
);
|
|
792
|
-
} else if (placement === "after") {
|
|
793
|
-
columns.value.push(...newColumns);
|
|
794
|
-
} else {
|
|
795
|
-
columns.value.unshift(...newColumns);
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
function appendColumn(path, column, options) {
|
|
799
|
-
const newColumns = Array.isArray(column) ? column : [column];
|
|
800
|
-
addColumns(path, newColumns, options, "after");
|
|
801
|
-
}
|
|
802
|
-
function prependColumn(path, column, options) {
|
|
803
|
-
const newColumns = Array.isArray(column) ? column : [column];
|
|
804
|
-
addColumns(path, newColumns, options, "before");
|
|
805
|
-
}
|
|
806
|
-
return {
|
|
807
|
-
columns,
|
|
808
|
-
dataSource,
|
|
809
|
-
pageParam,
|
|
810
|
-
searchForm,
|
|
811
|
-
setColumn,
|
|
812
|
-
deleteColumn,
|
|
813
|
-
appendColumn,
|
|
814
|
-
prependColumn,
|
|
815
|
-
setPageParam,
|
|
816
|
-
resetQueryParams
|
|
817
|
-
};
|
|
818
|
-
};
|
|
691
|
+
const BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-291baca6"]]);
|
|
692
|
+
const useTable = useTable$1;
|
|
819
693
|
export {
|
|
820
694
|
BaseTable as default,
|
|
821
695
|
useTable
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qin-ui/antd-vue-pro",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.19",
|
|
4
4
|
"description": "二次封装antd vue组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -30,12 +30,13 @@
|
|
|
30
30
|
"private": false,
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"ant-design-vue": "^4",
|
|
33
|
-
"vue": "^3.
|
|
33
|
+
"vue": "^3.5.0"
|
|
34
34
|
},
|
|
35
35
|
"bugs": {
|
|
36
36
|
"url": "https://github.com/dufan3715/pro-components/issues"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@qin-ui/core": "workspace:^",
|
|
39
40
|
"@types/lodash-es": "^4.17.12",
|
|
40
41
|
"ant-design-vue": "^4",
|
|
41
42
|
"lodash-es": "^4.17.21",
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { camelize, defineComponent, provide, renderSlot } from "vue";
|
|
2
|
-
import { i as isPlainObject } from "../vendor/utils/lodash-es-p6jau26B.js";
|
|
3
|
-
const getPopupContainer = (triggerNode) => triggerNode.closest(".ant-form");
|
|
4
|
-
const INJECT_CONFIG = {
|
|
5
|
-
"pro-table": {
|
|
6
|
-
injectionKey: Symbol(""),
|
|
7
|
-
default: {
|
|
8
|
-
pagination: {
|
|
9
|
-
showTotal: (total) => `共 ${total} 条`,
|
|
10
|
-
showSizeChanger: true,
|
|
11
|
-
pageSizeOptions: ["10", "20", "30", "40", "50", "100"],
|
|
12
|
-
showQuickJumper: true
|
|
13
|
-
},
|
|
14
|
-
searchFormConfig: {
|
|
15
|
-
layout: "grid",
|
|
16
|
-
expand: { minExpandRows: 2, expandStatus: false }
|
|
17
|
-
},
|
|
18
|
-
control: true,
|
|
19
|
-
addIndexColumn: true
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"pro-form": {
|
|
23
|
-
injectionKey: Symbol(""),
|
|
24
|
-
default: { grid: { gutter: { xs: 8, sm: 16, md: 16, lg: 24 } } }
|
|
25
|
-
},
|
|
26
|
-
"pro-form-item": {
|
|
27
|
-
injectionKey: Symbol(""),
|
|
28
|
-
default: { validateFirst: true, span: 8 }
|
|
29
|
-
},
|
|
30
|
-
// field
|
|
31
|
-
input: {
|
|
32
|
-
injectionKey: Symbol(""),
|
|
33
|
-
default: { maxlength: 100, allowClear: true, placeholder: "请输入" }
|
|
34
|
-
},
|
|
35
|
-
textarea: {
|
|
36
|
-
injectionKey: Symbol(""),
|
|
37
|
-
default: {
|
|
38
|
-
maxlength: 200,
|
|
39
|
-
autoSize: { minRows: 3, maxRows: 6 },
|
|
40
|
-
showCount: true,
|
|
41
|
-
allowClear: true,
|
|
42
|
-
placeholder: "请输入"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"input-password": {
|
|
46
|
-
injectionKey: Symbol(""),
|
|
47
|
-
default: { maxlength: 100, allowClear: true, placeholder: "请输入" }
|
|
48
|
-
},
|
|
49
|
-
"input-search": {
|
|
50
|
-
injectionKey: Symbol(""),
|
|
51
|
-
default: {}
|
|
52
|
-
},
|
|
53
|
-
"input-number": {
|
|
54
|
-
injectionKey: Symbol(""),
|
|
55
|
-
default: {
|
|
56
|
-
max: 10 ** 15 - 1,
|
|
57
|
-
min: -1000000000000001,
|
|
58
|
-
controls: false,
|
|
59
|
-
placeholder: "请输入",
|
|
60
|
-
style: { width: "100%" }
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
select: {
|
|
64
|
-
injectionKey: Symbol(""),
|
|
65
|
-
default: { allowClear: true, placeholder: "请选择", getPopupContainer }
|
|
66
|
-
},
|
|
67
|
-
cascader: {
|
|
68
|
-
injectionKey: Symbol(""),
|
|
69
|
-
default: { allowClear: true, placeholder: "请选择", getPopupContainer }
|
|
70
|
-
},
|
|
71
|
-
"date-picker": {
|
|
72
|
-
injectionKey: Symbol(""),
|
|
73
|
-
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
74
|
-
},
|
|
75
|
-
"date-picker.date": {
|
|
76
|
-
injectionKey: Symbol(""),
|
|
77
|
-
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
78
|
-
},
|
|
79
|
-
"date-picker.week": {
|
|
80
|
-
injectionKey: Symbol(""),
|
|
81
|
-
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
82
|
-
},
|
|
83
|
-
"date-picker.month": {
|
|
84
|
-
injectionKey: Symbol(""),
|
|
85
|
-
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
86
|
-
},
|
|
87
|
-
"date-picker.year": {
|
|
88
|
-
injectionKey: Symbol(""),
|
|
89
|
-
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
90
|
-
},
|
|
91
|
-
"date-picker.quarter": {
|
|
92
|
-
injectionKey: Symbol(""),
|
|
93
|
-
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
94
|
-
},
|
|
95
|
-
"range-picker": {
|
|
96
|
-
injectionKey: Symbol(""),
|
|
97
|
-
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
98
|
-
},
|
|
99
|
-
"time-picker": {
|
|
100
|
-
injectionKey: Symbol(""),
|
|
101
|
-
default: { allowClear: true, getPopupContainer, style: { width: "100%" } }
|
|
102
|
-
},
|
|
103
|
-
"checkbox-group": {
|
|
104
|
-
injectionKey: Symbol(""),
|
|
105
|
-
default: {}
|
|
106
|
-
},
|
|
107
|
-
"radio-group": {
|
|
108
|
-
injectionKey: Symbol(""),
|
|
109
|
-
default: {}
|
|
110
|
-
},
|
|
111
|
-
switch: {
|
|
112
|
-
injectionKey: Symbol(""),
|
|
113
|
-
default: { modelName: "checked" }
|
|
114
|
-
},
|
|
115
|
-
slider: {
|
|
116
|
-
injectionKey: Symbol(""),
|
|
117
|
-
default: {}
|
|
118
|
-
},
|
|
119
|
-
"tree-select": {
|
|
120
|
-
injectionKey: Symbol(""),
|
|
121
|
-
default: {}
|
|
122
|
-
},
|
|
123
|
-
transfer: {
|
|
124
|
-
injectionKey: Symbol(""),
|
|
125
|
-
default: {}
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
function getObject(val) {
|
|
129
|
-
return isPlainObject(val) ? val : {};
|
|
130
|
-
}
|
|
131
|
-
function camelizeProperties(obj) {
|
|
132
|
-
return Object.fromEntries(
|
|
133
|
-
Object.entries(obj).map(([key, value]) => [camelize(key), value])
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
137
|
-
...{
|
|
138
|
-
inheritAttrs: false
|
|
139
|
-
},
|
|
140
|
-
__name: "index",
|
|
141
|
-
props: {
|
|
142
|
-
componentVars: {}
|
|
143
|
-
},
|
|
144
|
-
setup(__props) {
|
|
145
|
-
const props = __props;
|
|
146
|
-
if (props.componentVars) {
|
|
147
|
-
Object.entries(props.componentVars).forEach(([key, val]) => {
|
|
148
|
-
const config = INJECT_CONFIG[key];
|
|
149
|
-
if (!config) return;
|
|
150
|
-
provide(config.injectionKey, { ...config.default, ...getObject(val) });
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
return (_ctx, _cache) => {
|
|
154
|
-
return renderSlot(_ctx.$slots, "default");
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
export {
|
|
159
|
-
INJECT_CONFIG as I,
|
|
160
|
-
_sfc_main as _,
|
|
161
|
-
camelizeProperties as c,
|
|
162
|
-
getObject as g
|
|
163
|
-
};
|