@qin-ui/antd-vue-pro 2.0.15 → 2.0.18
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-BeGPcKnM.js +511 -0
- package/es/component-provider/index.js +2 -2
- package/es/form/index.js +28 -248
- package/es/index.d.ts +60 -180
- package/es/index.js +8 -7
- package/es/table/index.js +62 -189
- package/package.json +5 -2
- package/es/component-provider/index-D8NF18a1.js +0 -163
package/es/table/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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 { a as INJECT_CONFIG, g as getObject, c as camelizeProperties, h as useTable$1 } from "../component-provider/index-BeGPcKnM.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
6
|
import { useConfigContextInject } from "ant-design-vue/es/config-provider/context";
|
|
7
7
|
import { tableProps } from "ant-design-vue/es/table";
|
|
8
8
|
const _export_sfc = (sfc, props) => {
|
|
@@ -43,7 +43,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
43
43
|
},
|
|
44
44
|
emits: ["search", "reset"],
|
|
45
45
|
setup(__props, { emit: __emit }) {
|
|
46
|
-
const props = __props;
|
|
47
46
|
const emit = __emit;
|
|
48
47
|
const proFormHeight = ref("unset");
|
|
49
48
|
const collapseHeight = ref(0);
|
|
@@ -51,11 +50,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
51
50
|
const rowGap = 16;
|
|
52
51
|
const columnGap = 24;
|
|
53
52
|
const computedExpand = computed(() => {
|
|
54
|
-
if (!
|
|
55
|
-
if (
|
|
53
|
+
if (!__props.expand) return false;
|
|
54
|
+
if (__props.expand === true) return { minExpandRows: 2, expandStatus: false };
|
|
56
55
|
return {
|
|
57
|
-
minExpandRows: Math.max(Math.floor(
|
|
58
|
-
expandStatus:
|
|
56
|
+
minExpandRows: Math.max(Math.floor(__props.expand.minExpandRows ?? 2), 1),
|
|
57
|
+
expandStatus: __props.expand.expandStatus ?? false
|
|
59
58
|
};
|
|
60
59
|
});
|
|
61
60
|
const showExpandToggle = ref(false);
|
|
@@ -63,10 +62,10 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
63
62
|
const changeExpandStatus = () => {
|
|
64
63
|
expandStatus.value = !expandStatus.value;
|
|
65
64
|
};
|
|
66
|
-
const { formRef, getFormData } =
|
|
65
|
+
const { formRef, getFormData } = __props.form;
|
|
67
66
|
const setInitExpandStatus = () => {
|
|
68
67
|
expandStatus.value = false;
|
|
69
|
-
if (formRef.value &&
|
|
68
|
+
if (formRef.value && __props.expand) {
|
|
70
69
|
const formEl = formRef.value.$el;
|
|
71
70
|
const formItemsEl = formEl.querySelectorAll(".ant-form-item>[path]");
|
|
72
71
|
const observer = new IntersectionObserver(
|
|
@@ -77,7 +76,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
77
76
|
const searchFieldValue = path ? getFormData == null ? void 0 : getFormData(path) : void 0;
|
|
78
77
|
return ![null, void 0].includes(searchFieldValue);
|
|
79
78
|
}
|
|
80
|
-
return
|
|
79
|
+
return __props.expand.expandStatus;
|
|
81
80
|
});
|
|
82
81
|
observer.disconnect();
|
|
83
82
|
},
|
|
@@ -92,7 +91,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
92
91
|
[
|
|
93
92
|
() => {
|
|
94
93
|
var _a, _b, _c;
|
|
95
|
-
return (_c = (_b = (_a =
|
|
94
|
+
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
95
|
},
|
|
97
96
|
() => formRef.value
|
|
98
97
|
],
|
|
@@ -109,7 +108,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
109
108
|
watchEffect(
|
|
110
109
|
() => {
|
|
111
110
|
if (typeof proFormHeight.value !== "number") return;
|
|
112
|
-
if (
|
|
111
|
+
if (__props.layout === "grid" && computedExpand.value) {
|
|
113
112
|
const { minExpandRows } = computedExpand.value;
|
|
114
113
|
collapseHeight.value = Math.min(
|
|
115
114
|
minExpandRows * rowHeight + (minExpandRows - 1) * rowGap,
|
|
@@ -126,7 +125,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
126
125
|
{ flush: "post" }
|
|
127
126
|
);
|
|
128
127
|
const layoutProps = computed(
|
|
129
|
-
() =>
|
|
128
|
+
() => __props.layout === "grid" ? {
|
|
130
129
|
grid: {
|
|
131
130
|
gutter: [columnGap, rowGap],
|
|
132
131
|
style: { flex: 1, marginRight: "12px" }
|
|
@@ -186,7 +185,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
186
185
|
onClick: onSearch
|
|
187
186
|
}, {
|
|
188
187
|
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
189
|
-
createTextVNode("
|
|
188
|
+
createTextVNode("查询 ", -1)
|
|
190
189
|
])]),
|
|
191
190
|
_: 1
|
|
192
191
|
}))
|
|
@@ -223,20 +222,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
223
222
|
};
|
|
224
223
|
}
|
|
225
224
|
});
|
|
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
|
-
}
|
|
225
|
+
const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-41da0f82"]]);
|
|
240
226
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
241
227
|
__name: "DefaultSearchFormContainer",
|
|
242
228
|
setup(__props) {
|
|
@@ -285,13 +271,16 @@ function _sfc_render$1(_ctx, _cache) {
|
|
|
285
271
|
const ColumnHeightOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$1]]);
|
|
286
272
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
287
273
|
__name: "SizeControl",
|
|
274
|
+
props: {
|
|
275
|
+
"size": {},
|
|
276
|
+
"sizeModifiers": {}
|
|
277
|
+
},
|
|
278
|
+
emits: ["update:size"],
|
|
288
279
|
setup(__props) {
|
|
289
280
|
var _a;
|
|
290
|
-
const attrs = useAttrs();
|
|
291
281
|
const configContext = useConfigContextInject();
|
|
292
|
-
const size = useModel(
|
|
293
|
-
|
|
294
|
-
});
|
|
282
|
+
const size = useModel(__props, "size");
|
|
283
|
+
size.value = size.value ?? ((_a = configContext.componentSize) == null ? void 0 : _a.value) ?? "large";
|
|
295
284
|
const onSizeChange = (val) => {
|
|
296
285
|
size.value = val.key;
|
|
297
286
|
};
|
|
@@ -308,7 +297,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
308
297
|
overlay: withCtx(() => [
|
|
309
298
|
createVNode(unref(Menu), {
|
|
310
299
|
style: { "width": "100px", "text-align": "center" },
|
|
311
|
-
"selected-keys":
|
|
300
|
+
"selected-keys": size.value ? [size.value] : [],
|
|
312
301
|
items: sizeOptions,
|
|
313
302
|
onClick: onSizeChange
|
|
314
303
|
}, null, 8, ["selected-keys"])
|
|
@@ -329,7 +318,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
329
318
|
};
|
|
330
319
|
}
|
|
331
320
|
});
|
|
332
|
-
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
321
|
+
const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-db17998d"]]);
|
|
333
322
|
const _sfc_main$2 = {};
|
|
334
323
|
const _hoisted_1$1 = {
|
|
335
324
|
focusable: "false",
|
|
@@ -350,15 +339,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
350
339
|
__name: "ColumnControl",
|
|
351
340
|
props: {
|
|
352
341
|
columns: {},
|
|
353
|
-
table: { default: void 0 }
|
|
342
|
+
table: { default: () => void 0 }
|
|
354
343
|
},
|
|
355
344
|
setup(__props) {
|
|
356
|
-
const props = __props;
|
|
357
345
|
const open = ref(false);
|
|
358
346
|
const checkAll = ref(false);
|
|
359
347
|
const indeterminate = ref(false);
|
|
360
348
|
const checkedColumnsOptions = computed(
|
|
361
|
-
() =>
|
|
349
|
+
() => __props.columns.flatMap(
|
|
362
350
|
(item) => item.key && item.title ? {
|
|
363
351
|
label: item.title,
|
|
364
352
|
value: item.key,
|
|
@@ -376,7 +364,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
376
364
|
var _a;
|
|
377
365
|
(_a = checkedColumnsOptions.value) == null ? void 0 : _a.forEach((item) => {
|
|
378
366
|
var _a2, _b;
|
|
379
|
-
(_b = (_a2 =
|
|
367
|
+
(_b = (_a2 = __props.table) == null ? void 0 : _a2.setColumn) == null ? void 0 : _b.call(_a2, item.value, {
|
|
380
368
|
hidden: !val.includes(item.value)
|
|
381
369
|
});
|
|
382
370
|
});
|
|
@@ -475,7 +463,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
475
463
|
};
|
|
476
464
|
}
|
|
477
465
|
});
|
|
478
|
-
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
466
|
+
const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-d503f78a"]]);
|
|
479
467
|
const _hoisted_1 = { class: "pro-table_header" };
|
|
480
468
|
const _hoisted_2 = {
|
|
481
469
|
key: 0,
|
|
@@ -496,27 +484,32 @@ const _hoisted_5 = {
|
|
|
496
484
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
497
485
|
...{ name: "ProTable", inheritAttrs: false },
|
|
498
486
|
__name: "BaseTable",
|
|
499
|
-
props: {
|
|
500
|
-
table: { default: void 0 },
|
|
487
|
+
props: /* @__PURE__ */ mergeModels({
|
|
488
|
+
table: { default: () => void 0 },
|
|
501
489
|
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 },
|
|
490
|
+
addIndexColumn: { type: Boolean, default: () => void 0 },
|
|
491
|
+
immediateSearch: { type: Boolean, default: () => void 0 },
|
|
492
|
+
control: { type: [Boolean, Object], default: () => void 0 },
|
|
493
|
+
searchFormConfig: { default: () => void 0 },
|
|
506
494
|
tableContainer: { type: [Object, Function, Boolean], default: void 0 }
|
|
507
|
-
},
|
|
495
|
+
}, {
|
|
496
|
+
"size": {},
|
|
497
|
+
"sizeModifiers": {},
|
|
498
|
+
"loading": { type: Boolean },
|
|
499
|
+
"loadingModifiers": {}
|
|
500
|
+
}),
|
|
501
|
+
emits: ["update:size", "update:loading"],
|
|
508
502
|
setup(__props) {
|
|
509
|
-
const props = __props;
|
|
510
503
|
const config = INJECT_CONFIG["pro-table"];
|
|
511
504
|
const injectProps = inject(config.injectionKey, config.default);
|
|
512
505
|
const tableProperties = Object.keys(tableProps());
|
|
513
506
|
const injectAttrs = pick(injectProps, tableProperties);
|
|
514
507
|
const computedSearchFormConfig = computed(() => {
|
|
515
508
|
var _a, _b;
|
|
516
|
-
const container = ((_a =
|
|
509
|
+
const container = ((_a = __props.searchFormConfig) == null ? void 0 : _a.container) ?? ((_b = injectProps.searchFormConfig) == null ? void 0 : _b.container) ?? DefaultSearchFormContainer;
|
|
517
510
|
return {
|
|
518
511
|
...injectProps.searchFormConfig,
|
|
519
|
-
...getObject(
|
|
512
|
+
...getObject(__props.searchFormConfig),
|
|
520
513
|
container: container ? container : void 0
|
|
521
514
|
};
|
|
522
515
|
});
|
|
@@ -524,21 +517,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
524
517
|
const tableAttrs = computed(() => {
|
|
525
518
|
return pick(camelizeProperties(attrs), tableProperties);
|
|
526
519
|
});
|
|
527
|
-
const { columns, dataSource, searchForm, pageParam, setPageParam } =
|
|
528
|
-
const size = useModel(
|
|
529
|
-
const loading = useModel(
|
|
520
|
+
const { columns, dataSource, searchForm, pageParam, setPageParam } = __props.table || {};
|
|
521
|
+
const size = useModel(__props, "size");
|
|
522
|
+
const loading = useModel(__props, "loading");
|
|
530
523
|
const _search = async () => {
|
|
531
524
|
var _a;
|
|
532
525
|
try {
|
|
533
526
|
loading.value = true;
|
|
534
|
-
await ((_a =
|
|
527
|
+
await ((_a = __props.search) == null ? void 0 : _a.call(__props));
|
|
535
528
|
} finally {
|
|
536
529
|
loading.value = false;
|
|
537
530
|
}
|
|
538
531
|
};
|
|
539
532
|
const reset = () => {
|
|
540
533
|
var _a;
|
|
541
|
-
(_a =
|
|
534
|
+
(_a = __props.table) == null ? void 0 : _a.resetQueryParams();
|
|
542
535
|
nextTick(() => {
|
|
543
536
|
_search();
|
|
544
537
|
});
|
|
@@ -565,7 +558,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
565
558
|
};
|
|
566
559
|
});
|
|
567
560
|
const computedTableContainer = computed(() => {
|
|
568
|
-
const container =
|
|
561
|
+
const container = __props.tableContainer ?? injectProps.tableContainer ?? DefaultTableContainer;
|
|
569
562
|
return container ? container : void 0;
|
|
570
563
|
});
|
|
571
564
|
const indexColumn = {
|
|
@@ -576,7 +569,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
576
569
|
};
|
|
577
570
|
const computedColumns = computed(
|
|
578
571
|
() => [
|
|
579
|
-
...
|
|
572
|
+
...__props.addIndexColumn ?? injectProps.addIndexColumn ? [indexColumn] : [],
|
|
580
573
|
...(tableAttrs.value.columns ?? (columns == null ? void 0 : columns.value) ?? []).flatMap(
|
|
581
574
|
(item, index) => {
|
|
582
575
|
if (item.key) return [{ ...item, key: item.key }];
|
|
@@ -614,13 +607,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
614
607
|
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
608
|
});
|
|
616
609
|
const computedControl = computed(() => {
|
|
617
|
-
const
|
|
618
|
-
const sizeControl = (
|
|
619
|
-
const columnControl = (
|
|
610
|
+
const mergedControl = __props.control ?? injectProps.control;
|
|
611
|
+
const sizeControl = (mergedControl == null ? void 0 : mergedControl.sizeControl) ?? mergedControl;
|
|
612
|
+
const columnControl = (mergedControl == null ? void 0 : mergedControl.columnControl) ?? mergedControl;
|
|
620
613
|
return { sizeControl, columnControl };
|
|
621
614
|
});
|
|
622
615
|
onMounted(() => {
|
|
623
|
-
if (
|
|
616
|
+
if (__props.immediateSearch ?? injectProps.immediateSearch) {
|
|
624
617
|
_search();
|
|
625
618
|
}
|
|
626
619
|
});
|
|
@@ -657,21 +650,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
657
650
|
])) : createCommentVNode("", true),
|
|
658
651
|
computedControl.value.sizeControl ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
659
652
|
createVNode(unref(SizeControl), {
|
|
660
|
-
size:
|
|
661
|
-
"onUpdate:size": _cache[0] || (_cache[0] = ($event) =>
|
|
653
|
+
size: size.value,
|
|
654
|
+
"onUpdate:size": _cache[0] || (_cache[0] = ($event) => size.value = $event)
|
|
662
655
|
}, null, 8, ["size"])
|
|
663
656
|
])) : createCommentVNode("", true),
|
|
664
657
|
computedControl.value.columnControl ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
665
658
|
createVNode(unref(ColumnControl), {
|
|
666
659
|
columns: computedColumns.value,
|
|
667
|
-
table:
|
|
660
|
+
table: __props.table
|
|
668
661
|
}, null, 8, ["columns", "table"])
|
|
669
662
|
])) : createCommentVNode("", true)
|
|
670
663
|
]),
|
|
671
664
|
renderSlot(_ctx.$slots, "table", {}, () => [
|
|
672
665
|
createVNode(unref(Table), mergeProps({ class: "pro-table_content" }, computedTableProps.value, {
|
|
673
|
-
size:
|
|
674
|
-
loading:
|
|
666
|
+
size: size.value,
|
|
667
|
+
loading: loading.value,
|
|
675
668
|
columns: visibleComputedColumns.value,
|
|
676
669
|
"data-source": computedDataSource.value,
|
|
677
670
|
pagination: computedPagination.value,
|
|
@@ -694,128 +687,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
694
687
|
};
|
|
695
688
|
}
|
|
696
689
|
});
|
|
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
|
-
};
|
|
690
|
+
const BaseTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-291baca6"]]);
|
|
691
|
+
const useTable = useTable$1;
|
|
819
692
|
export {
|
|
820
693
|
BaseTable as default,
|
|
821
694
|
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.18",
|
|
4
4
|
"description": "二次封装antd vue组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -28,9 +28,12 @@
|
|
|
28
28
|
"author": "dufan3715",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"private": false,
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@qin-ui/core": "workspace:^"
|
|
33
|
+
},
|
|
31
34
|
"peerDependencies": {
|
|
32
35
|
"ant-design-vue": "^4",
|
|
33
|
-
"vue": "^3.
|
|
36
|
+
"vue": "^3.5.0"
|
|
34
37
|
},
|
|
35
38
|
"bugs": {
|
|
36
39
|
"url": "https://github.com/dufan3715/pro-components/issues"
|
|
@@ -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
|
-
};
|