@aplus-frontend/ui 0.6.0-beta.14 → 0.6.0-beta.16
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/index.mjs +1 -1
- package/es/src/ap-descriptions/ap-descriptions.vue.mjs +9 -8
- package/es/src/ap-form/interface.d.ts +4 -0
- package/es/src/ap-form/search-form/hooks/use-count-per-row.mjs +33 -13
- package/es/src/ap-form/search-form/index.vue.mjs +16 -15
- package/es/src/ap-grid/hooks/use-row-selection.d.ts +100 -0
- package/es/src/ap-grid/hooks/use-row-selection.mjs +122 -0
- package/es/src/ap-grid/index.vue.mjs +272 -238
- package/es/src/ap-grid/interface.d.ts +6 -0
- package/es/src/ap-grid/utils/table.mjs +6 -7
- package/es/src/ap-table/hooks/use-table-paging-ng.d.ts +6 -1
- package/es/src/ap-table/hooks/use-table-paging-ng.mjs +99 -96
- package/es/src/business/ap-label/group/ApLabelGroup.mjs +15 -16
- package/es/src/business/ap-label/interface.d.ts +2 -3
- package/es/src/business/ap-table-modal/table-modal.vue2.mjs +43 -42
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/index.js +1 -1
- package/lib/src/ap-descriptions/ap-descriptions.vue.js +1 -1
- package/lib/src/ap-form/interface.d.ts +4 -0
- package/lib/src/ap-form/search-form/hooks/use-count-per-row.js +1 -1
- package/lib/src/ap-form/search-form/index.vue.js +1 -1
- package/lib/src/ap-grid/hooks/use-row-selection.d.ts +100 -0
- package/lib/src/ap-grid/hooks/use-row-selection.js +1 -0
- package/lib/src/ap-grid/index.vue.js +1 -1
- package/lib/src/ap-grid/interface.d.ts +6 -0
- package/lib/src/ap-grid/utils/table.js +1 -1
- package/lib/src/ap-table/hooks/use-table-paging-ng.d.ts +6 -1
- package/lib/src/ap-table/hooks/use-table-paging-ng.js +1 -1
- package/lib/src/business/ap-label/group/ApLabelGroup.js +1 -1
- package/lib/src/business/ap-label/interface.d.ts +2 -3
- package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
- package/theme/antd-global-overwrite/admin/index.css +9 -194
- package/theme/antd-global-overwrite/admin/table.css +9 -194
- package/theme/antd-global-overwrite/admin/table.less +2 -126
- package/theme/antd-global-overwrite/aplus/index.css +9 -186
- package/theme/antd-global-overwrite/aplus/table.css +9 -186
- package/theme/antd-global-overwrite/aplus/table.less +2 -129
- package/theme/ap-expand-alert/ap-expand-alert.css +2 -1
- package/theme/ap-expand-alert/ap-expand-alert.less +2 -2
- package/theme/ap-table-modal/index.css +15 -13
- package/theme/ap-table-modal/index.less +15 -13
- package/theme/index.css +17 -14
package/es/index.mjs
CHANGED
|
@@ -137,7 +137,7 @@ import { useThrottleRef as Ep } from "./src/hooks/useThrottleRef.mjs";
|
|
|
137
137
|
import { useFullScreen as Rp } from "./src/hooks/useFullScreen.mjs";
|
|
138
138
|
import { useResize as Mp } from "./src/hooks/useResize.mjs";
|
|
139
139
|
const a = console.log;
|
|
140
|
-
a(`APlus-UI version ${p}
|
|
140
|
+
a(`APlus-UI version ${p}`);
|
|
141
141
|
const l = {
|
|
142
142
|
install: (r) => {
|
|
143
143
|
for (const t in o) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as B, createElementBlock as i, openBlock as r, normalizeStyle as E, normalizeClass as d, unref as l, createVNode as _, mergeProps as w, withCtx as b, Fragment as p, renderList as
|
|
1
|
+
import { defineComponent as B, createElementBlock as i, openBlock as r, normalizeStyle as E, normalizeClass as d, unref as l, createVNode as _, mergeProps as w, withCtx as b, Fragment as p, renderList as A, createBlock as c, createCommentVNode as M, h as u, renderSlot as j, resolveDynamicComponent as z } from "vue";
|
|
2
2
|
import { Descriptions as F, DescriptionsItem as m } from "@aplus-frontend/antdv";
|
|
3
3
|
import { mixinsAttachmentExtraProps as G, transformValue as L, isEmptyWithType as R } from "./helper.mjs";
|
|
4
4
|
import { get as S } from "lodash-unified";
|
|
@@ -8,6 +8,7 @@ import { useGlobalConfig as f } from "../config-provider/hooks/use-global-config
|
|
|
8
8
|
import { useNamespace as $ } from "../config-provider/hooks/use-namespace.mjs";
|
|
9
9
|
import I from "./help-message/index.vue2.mjs";
|
|
10
10
|
const O = { key: 0 }, Z = /* @__PURE__ */ B({
|
|
11
|
+
name: "ApDescriptions",
|
|
11
12
|
__name: "ap-descriptions",
|
|
12
13
|
props: {
|
|
13
14
|
descriptionsProps: {},
|
|
@@ -17,7 +18,7 @@ const O = { key: 0 }, Z = /* @__PURE__ */ B({
|
|
|
17
18
|
className: {}
|
|
18
19
|
},
|
|
19
20
|
setup(g) {
|
|
20
|
-
const n = g, v = f("uiMode", "admin"), C = f("apDescriptions"), k = f("downloadCenterTriggerConfig"), { m: P, b:
|
|
21
|
+
const n = g, v = f("uiMode", "admin"), C = f("apDescriptions"), k = f("downloadCenterTriggerConfig"), { m: P, b: D, be: N } = $("ap-descriptions"), T = (e = {}) => {
|
|
21
22
|
var s;
|
|
22
23
|
let o = "";
|
|
23
24
|
return ((s = n.descriptionsProps) == null ? void 0 : s.layout) === "vertical" && (o = "start"), {
|
|
@@ -53,14 +54,14 @@ const O = { key: 0 }, Z = /* @__PURE__ */ B({
|
|
|
53
54
|
return (e, o) => {
|
|
54
55
|
var s;
|
|
55
56
|
return r(), i("div", {
|
|
56
|
-
class: d([e.className, l(
|
|
57
|
+
class: d([e.className, l(D)(), l(P)(l(v))]),
|
|
57
58
|
style: E(e.style)
|
|
58
59
|
}, [
|
|
59
60
|
_(l(F), w(e.descriptionsProps, {
|
|
60
61
|
"label-style": T({ ...((s = e.descriptionsProps) == null ? void 0 : s.labelStyle) || {} })
|
|
61
62
|
}), {
|
|
62
63
|
default: b(() => [
|
|
63
|
-
(r(!0), i(p, null,
|
|
64
|
+
(r(!0), i(p, null, A(e.schemas, (t, a) => (r(), i(p, {
|
|
64
65
|
key: t.field || "empty" + a
|
|
65
66
|
}, [
|
|
66
67
|
t.valueType === "empty" ? (r(), c(l(m), {
|
|
@@ -70,7 +71,7 @@ const O = { key: 0 }, Z = /* @__PURE__ */ B({
|
|
|
70
71
|
span: t.span
|
|
71
72
|
}, null, 8, ["content-style", "label-style", "span"])) : x(t) ? (r(), c(l(m), {
|
|
72
73
|
key: 1,
|
|
73
|
-
class: d(V(t) ? l(
|
|
74
|
+
class: d(V(t) ? l(N)("item", "ellipsis") : ""),
|
|
74
75
|
label: t.label ? u(p, [
|
|
75
76
|
u(I, {
|
|
76
77
|
helpMessage: t.helpMessage,
|
|
@@ -83,12 +84,12 @@ const O = { key: 0 }, Z = /* @__PURE__ */ B({
|
|
|
83
84
|
}, {
|
|
84
85
|
default: b(() => [
|
|
85
86
|
l(R)(l(S)(e.dataSource, t.field), t) ? (r(), i("span", O, "--")) : (r(), i(p, { key: 1 }, [
|
|
86
|
-
t.contentSlotName ?
|
|
87
|
+
t.contentSlotName ? j(e.$slots, t.contentSlotName, {
|
|
87
88
|
key: 0,
|
|
88
89
|
index: a,
|
|
89
90
|
item: y(t),
|
|
90
91
|
record: e.dataSource
|
|
91
|
-
}) : (r(), c(
|
|
92
|
+
}) : (r(), c(z(
|
|
92
93
|
u(p, [
|
|
93
94
|
t.prefix,
|
|
94
95
|
y(t),
|
|
@@ -98,7 +99,7 @@ const O = { key: 0 }, Z = /* @__PURE__ */ B({
|
|
|
98
99
|
], 64))
|
|
99
100
|
]),
|
|
100
101
|
_: 2
|
|
101
|
-
}, 1032, ["class", "label", "span", "content-style", "label-style"])) :
|
|
102
|
+
}, 1032, ["class", "label", "span", "content-style", "label-style"])) : M("", !0)
|
|
102
103
|
], 64))), 128))
|
|
103
104
|
]),
|
|
104
105
|
_: 3
|
|
@@ -162,6 +162,10 @@ export type ApFormSearchFormProps = ApFormProps & {
|
|
|
162
162
|
* 是否可排序
|
|
163
163
|
*/
|
|
164
164
|
sortable?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* 尺寸监听目标元素(用于响应式)
|
|
167
|
+
*/
|
|
168
|
+
resizeTarget?: HTMLElement | null;
|
|
165
169
|
};
|
|
166
170
|
export type ApFormSearchFormPopoverFilterProps = {
|
|
167
171
|
config: Array<{
|
|
@@ -1,17 +1,37 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { ref as a, watchEffect as w, computed as s, unref as i } from "vue";
|
|
2
|
+
import { useResizeObserver as P } from "@vueuse/core";
|
|
3
|
+
import { isUndefined as R } from "lodash-unified";
|
|
4
|
+
const c = [1, 2, 3, 4, 6, 8, 12, 24], g = { xs: 0, sm: 768, md: 1280, lg: 1728 }, z = Object.entries(g).sort(
|
|
5
|
+
(e, n) => n[1] - e[1]
|
|
6
|
+
), T = (e) => {
|
|
7
|
+
const n = a(0);
|
|
8
|
+
w(
|
|
9
|
+
(t) => {
|
|
10
|
+
if (!(R(e.resizeTarget) ? document.documentElement : e.resizeTarget))
|
|
11
|
+
return;
|
|
12
|
+
const { stop: o } = P(e.resizeTarget, (f) => {
|
|
13
|
+
const m = f[0], { width: d } = m.contentRect;
|
|
14
|
+
n.value = d;
|
|
15
|
+
});
|
|
16
|
+
t(() => {
|
|
17
|
+
o();
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
{ flush: "post" }
|
|
21
|
+
);
|
|
22
|
+
const u = s(() => {
|
|
23
|
+
for (const [t, r] of z)
|
|
24
|
+
if (i(n) > r)
|
|
25
|
+
return t;
|
|
26
|
+
return "md";
|
|
27
|
+
});
|
|
28
|
+
return s(() => {
|
|
29
|
+
const t = c.findIndex(
|
|
30
|
+
(o) => o === e.countPerRow
|
|
31
|
+
), r = i(u);
|
|
32
|
+
return r === "lg" ? c[t + 1] || e.countPerRow : r === "xs" && c[t - 1] || e.countPerRow;
|
|
13
33
|
});
|
|
14
34
|
};
|
|
15
35
|
export {
|
|
16
|
-
|
|
36
|
+
T as useCountPerRow
|
|
17
37
|
};
|
|
@@ -5,14 +5,14 @@ import "../item/index.vue2.mjs";
|
|
|
5
5
|
import { genRealChildren as W } from "../item-group/helper.mjs";
|
|
6
6
|
import "../../config-provider/index.mjs";
|
|
7
7
|
import { isArray as ue, isBoolean as ce, omit as pe } from "lodash-unified";
|
|
8
|
-
import { isDef as
|
|
9
|
-
import { execFunc as
|
|
8
|
+
import { isDef as z } from "../../utils/index.mjs";
|
|
9
|
+
import { execFunc as D, diffFormItem as de } from "./utils.mjs";
|
|
10
10
|
import "./components/popover-filter.vue.mjs";
|
|
11
11
|
import { useCountPerRow as fe } from "./hooks/use-count-per-row.mjs";
|
|
12
12
|
import "./components/popover-sorter/index.vue.mjs";
|
|
13
13
|
import { useNamespace as me } from "../../config-provider/hooks/use-namespace.mjs";
|
|
14
14
|
import { useLocale as he } from "../../config-provider/hooks/use-locale.mjs";
|
|
15
|
-
import
|
|
15
|
+
import q from "../item/index.vue.mjs";
|
|
16
16
|
import xe from "./components/popover-filter.vue2.mjs";
|
|
17
17
|
import ye from "./components/popover-sorter/index.vue2.mjs";
|
|
18
18
|
import ge from "../ap-form.vue2.mjs";
|
|
@@ -108,7 +108,8 @@ const s = 24, Ue = /* @__PURE__ */ ae({
|
|
|
108
108
|
sortable: {
|
|
109
109
|
type: Boolean,
|
|
110
110
|
default: !0
|
|
111
|
-
}
|
|
111
|
+
},
|
|
112
|
+
resizeTarget: {}
|
|
112
113
|
},
|
|
113
114
|
setup(f, {
|
|
114
115
|
expose: H
|
|
@@ -119,20 +120,20 @@ const s = 24, Ue = /* @__PURE__ */ ae({
|
|
|
119
120
|
} = me("ap-form-search-form"), {
|
|
120
121
|
t: k
|
|
121
122
|
} = he(), G = fe(o), y = L();
|
|
122
|
-
function
|
|
123
|
+
function T() {
|
|
123
124
|
var a;
|
|
124
125
|
const e = (a = y.value) == null ? void 0 : a.getFieldsValueTransformed(!0);
|
|
125
|
-
|
|
126
|
+
D(o.onSubmit, e);
|
|
126
127
|
}
|
|
127
128
|
function J() {
|
|
128
129
|
var e, a;
|
|
129
|
-
o.customReset || (a = (e = y.value) == null ? void 0 : e.resetFields) == null || a.call(e),
|
|
130
|
+
o.customReset || (a = (e = y.value) == null ? void 0 : e.resetFields) == null || a.call(e), D(o.onReset);
|
|
130
131
|
}
|
|
131
|
-
const K = (e) =>
|
|
132
|
-
let
|
|
132
|
+
const K = (e) => z(e) ? (ue(e) ? e : [e]).join("") : Date.now();
|
|
133
|
+
let I = [];
|
|
133
134
|
const u = U(W(i.default())), b = L(!1), c = U((P = i.extra) == null ? void 0 : P.call(i)), E = _(() => Math.floor(s / n(G)));
|
|
134
135
|
V(() => i.default(), (e) => {
|
|
135
|
-
|
|
136
|
+
I = u.value, u.value = de(I, W(e)), b.value = !1;
|
|
136
137
|
}), V(() => {
|
|
137
138
|
var e;
|
|
138
139
|
return (e = i.extra) == null ? void 0 : e.call(i);
|
|
@@ -145,7 +146,7 @@ const s = 24, Ue = /* @__PURE__ */ ae({
|
|
|
145
146
|
const Y = s * o.maxRows - h * (n(c) && !o.extraInAction ? 2 : 1);
|
|
146
147
|
e.forEach((F, te) => {
|
|
147
148
|
const p = F.props;
|
|
148
|
-
if (ce(p.hidden) ? !!p.hidden :
|
|
149
|
+
if (ce(p.hidden) ? !!p.hidden : z(p.hidden))
|
|
149
150
|
a.push(F);
|
|
150
151
|
else {
|
|
151
152
|
let C = p.span || h;
|
|
@@ -175,7 +176,7 @@ const s = 24, Ue = /* @__PURE__ */ ae({
|
|
|
175
176
|
span: n(E),
|
|
176
177
|
key: "actionWrapper"
|
|
177
178
|
}, {
|
|
178
|
-
default: () => [t(
|
|
179
|
+
default: () => [t(q, null, {
|
|
179
180
|
default: () => [t(N, {
|
|
180
181
|
wrap: "wrap",
|
|
181
182
|
justify: l.value.lastRowOnlyIncludeActionAndExtra && !(n(c) && o.extraInAction) ? "flex-end" : "space-between"
|
|
@@ -187,7 +188,7 @@ const s = 24, Ue = /* @__PURE__ */ ae({
|
|
|
187
188
|
default: () => [t("div", {
|
|
188
189
|
class: m("column-setting-trigger-wrapper")
|
|
189
190
|
}, [l.value.collapseNodes.length ? t(xe, {
|
|
190
|
-
onSubmit:
|
|
191
|
+
onSubmit: T,
|
|
191
192
|
config: l.value.collapseNodes,
|
|
192
193
|
submitLoading: o.submitLoading
|
|
193
194
|
}, null) : null, o.sortable && u.value.length ? t(ye, {
|
|
@@ -196,7 +197,7 @@ const s = 24, Ue = /* @__PURE__ */ ae({
|
|
|
196
197
|
sorted: b.value
|
|
197
198
|
}, null) : null]), t(M, {
|
|
198
199
|
type: "primary",
|
|
199
|
-
onClick:
|
|
200
|
+
onClick: T,
|
|
200
201
|
loading: o.submitLoading,
|
|
201
202
|
htmlType: "submit",
|
|
202
203
|
class: m("action-btn")
|
|
@@ -216,7 +217,7 @@ const s = 24, Ue = /* @__PURE__ */ ae({
|
|
|
216
217
|
span: l.value.extraSpan,
|
|
217
218
|
key: "extraNode"
|
|
218
219
|
}, {
|
|
219
|
-
default: () => [t(
|
|
220
|
+
default: () => [t(q, null, {
|
|
220
221
|
default: () => [t(N, {
|
|
221
222
|
justify: l.value.extraSpan === s || l.value.lastRowOnlyIncludeActionAndExtra ? "start" : "flex-end"
|
|
222
223
|
}, ve(e = n(c)) ? e : {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { TableRowSelection } from '@aplus-frontend/antdv/lib/table/interface';
|
|
2
|
+
import { ComputedRef, Ref } from 'vue';
|
|
3
|
+
import { ApTableProps, ApTableRowSelection } from '../../ap-table';
|
|
4
|
+
import { Recordable } from '../../type';
|
|
5
|
+
export interface RowSelectionReturnType<RecordType = any> {
|
|
6
|
+
rowSelection: ComputedRef<TableRowSelection<RecordType>>;
|
|
7
|
+
selectedRows: Ref<Partial<RecordType>[]>;
|
|
8
|
+
/**
|
|
9
|
+
* 选中某行
|
|
10
|
+
* @param item
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
select: (item: RecordType) => void;
|
|
14
|
+
/**
|
|
15
|
+
* 取消选中某行
|
|
16
|
+
* @param item
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
unSelect: (item: RecordType) => void;
|
|
20
|
+
/**
|
|
21
|
+
* 某行是否被选中
|
|
22
|
+
* @param item
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
isSelected: (item: RecordType) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* 选中当前所有数据
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
selectAll: () => void;
|
|
31
|
+
/**
|
|
32
|
+
* 取消选中当前所有数据
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
unSelectAll: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* 清空所有选中
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
clearAll: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* 切换某行的选中状态
|
|
43
|
+
* @param item
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
toggleSelect: (item: RecordType) => void;
|
|
47
|
+
/**
|
|
48
|
+
* 多项选中
|
|
49
|
+
* @param items
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
selectMulti: (items: RecordType[]) => void;
|
|
53
|
+
/**
|
|
54
|
+
* 多项反选
|
|
55
|
+
* @param items
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
unSelectMulti: (items: RecordType[]) => void;
|
|
59
|
+
/**
|
|
60
|
+
* VxeTable 表格checkbox-change事件
|
|
61
|
+
* @param item
|
|
62
|
+
* @param select
|
|
63
|
+
* @param partRowData
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
selectChange: (item: RecordType, select: boolean, partRowData: RecordType[]) => void;
|
|
67
|
+
/**
|
|
68
|
+
* VxeTable 表格checkbox-all事件
|
|
69
|
+
* @param item
|
|
70
|
+
* @param select
|
|
71
|
+
* @param partRowData
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
selectAllChange: (select: boolean, partRowData: RecordType[]) => void;
|
|
75
|
+
/**
|
|
76
|
+
* VxeTable 表格checkbox-range-change事件
|
|
77
|
+
* @param selected
|
|
78
|
+
* @param partRowData
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
selectRangeChange: (selected: RecordType[], partRowData: RecordType[]) => void;
|
|
82
|
+
/**
|
|
83
|
+
* 通过key勾选多条数据
|
|
84
|
+
* @param keys
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
selectMultiByKeys: (keys: (string | number)[]) => void;
|
|
88
|
+
}
|
|
89
|
+
type RowSelectionParams<T> = Omit<ApTableRowSelection<T>, 'mode'> & {
|
|
90
|
+
/**
|
|
91
|
+
* 数据源(如果是后端分页,则表示当页数据,否则是全量数据)
|
|
92
|
+
*/
|
|
93
|
+
dataSource: Ref<T[]>;
|
|
94
|
+
/**
|
|
95
|
+
* 同Table的rowkey
|
|
96
|
+
*/
|
|
97
|
+
rowKey: ApTableProps['rowKey'];
|
|
98
|
+
};
|
|
99
|
+
declare const useTableRowSelection: <RecordType = Recordable>(props: RowSelectionParams<RecordType>) => RowSelectionReturnType<RecordType>;
|
|
100
|
+
export default useTableRowSelection;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ref as k, computed as v, unref as a } from "vue";
|
|
2
|
+
import { isFunction as i, cloneDeep as M } from "lodash-unified";
|
|
3
|
+
function m(u, c) {
|
|
4
|
+
return !(c != null && c.length) || i(u) ? [] : c.map((f) => ({ [u]: f }));
|
|
5
|
+
}
|
|
6
|
+
const T = (u) => {
|
|
7
|
+
u.defaultSelectedRowKeys;
|
|
8
|
+
const c = k(
|
|
9
|
+
m(u.rowKey, u.defaultSelectedRowKeys)
|
|
10
|
+
);
|
|
11
|
+
function f(e, t) {
|
|
12
|
+
c.value = t;
|
|
13
|
+
}
|
|
14
|
+
const l = (e) => i(u.rowKey) ? u.rowKey(e) : e[u.rowKey], s = v(() => {
|
|
15
|
+
const e = /* @__PURE__ */ new Map();
|
|
16
|
+
return a(c).forEach((t) => {
|
|
17
|
+
e.set(l(t), t);
|
|
18
|
+
}), e;
|
|
19
|
+
});
|
|
20
|
+
function g(e) {
|
|
21
|
+
return a(s).has(l(e));
|
|
22
|
+
}
|
|
23
|
+
function h(e) {
|
|
24
|
+
const t = a(s);
|
|
25
|
+
t.set(l(e), e), c.value = [...t.values()];
|
|
26
|
+
}
|
|
27
|
+
function x(e) {
|
|
28
|
+
const t = a(s);
|
|
29
|
+
for (const n of e)
|
|
30
|
+
t.set(l(n), n);
|
|
31
|
+
c.value = [...t.values()];
|
|
32
|
+
}
|
|
33
|
+
function w(e) {
|
|
34
|
+
if (i(u.rowKey))
|
|
35
|
+
return;
|
|
36
|
+
const t = a(s);
|
|
37
|
+
for (const n of e) {
|
|
38
|
+
const o = a(u.dataSource).find(
|
|
39
|
+
(d) => l(d) === n
|
|
40
|
+
), S = { [u.rowKey]: n };
|
|
41
|
+
t.set(String(n), o || S);
|
|
42
|
+
}
|
|
43
|
+
c.value = [...t.values()];
|
|
44
|
+
}
|
|
45
|
+
function y(e) {
|
|
46
|
+
const t = a(s);
|
|
47
|
+
t.delete(l(e)), c.value = [...t.values()];
|
|
48
|
+
}
|
|
49
|
+
function E(e) {
|
|
50
|
+
const t = a(s);
|
|
51
|
+
for (const n of e)
|
|
52
|
+
t.delete(l(n));
|
|
53
|
+
c.value = [...t.values()];
|
|
54
|
+
}
|
|
55
|
+
function r(e, t) {
|
|
56
|
+
const n = e;
|
|
57
|
+
for (const o of t)
|
|
58
|
+
n.set(l(o), o);
|
|
59
|
+
return n;
|
|
60
|
+
}
|
|
61
|
+
function K(e, t, n) {
|
|
62
|
+
const o = a(s);
|
|
63
|
+
t ? o.set(l(e), e) : o.delete(l(e)), r(o, n), c.value = [...o.values()];
|
|
64
|
+
}
|
|
65
|
+
function A(e, t) {
|
|
66
|
+
const n = M(a(s));
|
|
67
|
+
e ? a(u.dataSource).forEach((o) => {
|
|
68
|
+
n.set(l(o), o);
|
|
69
|
+
}) : a(u.dataSource).forEach((o) => {
|
|
70
|
+
n.delete(l(o));
|
|
71
|
+
}), r(n, t), c.value = [...n.values()];
|
|
72
|
+
}
|
|
73
|
+
function C(e, t) {
|
|
74
|
+
const n = M(a(s));
|
|
75
|
+
a(u.dataSource).forEach((o) => {
|
|
76
|
+
e.find((d) => l(d) === l(o)) ? n.set(l(o), o) : n.delete(l(o));
|
|
77
|
+
}), r(n, t), c.value = [...n.values()];
|
|
78
|
+
}
|
|
79
|
+
function R() {
|
|
80
|
+
const e = a(s);
|
|
81
|
+
a(u.dataSource).forEach((t) => {
|
|
82
|
+
e.set(l(t), t);
|
|
83
|
+
}), c.value = [...e.values()];
|
|
84
|
+
}
|
|
85
|
+
function D(e) {
|
|
86
|
+
const t = a(s), n = l(e);
|
|
87
|
+
t.has(n) ? t.delete(n) : t.set(n, e), c.value = [...t.values()];
|
|
88
|
+
}
|
|
89
|
+
function I() {
|
|
90
|
+
const e = a(s);
|
|
91
|
+
a(u.dataSource).forEach((t) => {
|
|
92
|
+
e.delete(l(t));
|
|
93
|
+
}), c.value = [...e.values()];
|
|
94
|
+
}
|
|
95
|
+
function b() {
|
|
96
|
+
c.value = [];
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
select: h,
|
|
100
|
+
unSelect: y,
|
|
101
|
+
isSelected: g,
|
|
102
|
+
selectAll: R,
|
|
103
|
+
unSelectAll: I,
|
|
104
|
+
clearAll: b,
|
|
105
|
+
toggleSelect: D,
|
|
106
|
+
selectedRows: c,
|
|
107
|
+
selectMulti: x,
|
|
108
|
+
unSelectMulti: E,
|
|
109
|
+
rowSelection: v(() => ({
|
|
110
|
+
...u,
|
|
111
|
+
onChange: f,
|
|
112
|
+
selectedRowKeys: a(c).map((e) => l(e))
|
|
113
|
+
})),
|
|
114
|
+
selectChange: K,
|
|
115
|
+
selectAllChange: A,
|
|
116
|
+
selectRangeChange: C,
|
|
117
|
+
selectMultiByKeys: w
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
export {
|
|
121
|
+
T as default
|
|
122
|
+
};
|