orion-design 1.0.3 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/LovInput.vue_vue_type_script_setup_true_lang-QrvjS12n.js +401 -0
- package/dist/LovInput.vue_vue_type_script_setup_true_lang-QrvjS12n.js.map +1 -0
- package/dist/TableSelect.vue_vue_type_script_setup_true_lang-DmAuOipe.js +313 -0
- package/dist/TableSelect.vue_vue_type_script_setup_true_lang-DmAuOipe.js.map +1 -0
- package/dist/components/Edittable/Edittable.d.ts +9 -2
- package/dist/components/Edittable/columns/EdittableColumnDate.d.ts +1 -1
- package/dist/components/Edittable/columns/EdittableColumnMultiselect.d.ts +1 -1
- package/dist/components/Edittable/columns/EdittableColumnNumber.d.ts +1 -1
- package/dist/components/Edittable/columns/EdittableColumnSingleselect.d.ts +1 -1
- package/dist/components/Edittable/hooks/useEdittable.d.ts +2 -1
- package/dist/components/Edittable/hooks/useEdittable.js +60 -63
- package/dist/components/Edittable/hooks/useEdittable.js.map +1 -1
- package/dist/components/Edittable/index.d.ts +5 -0
- package/dist/components/Edittable/index.js +360 -324
- package/dist/components/Edittable/index.js.map +1 -1
- package/dist/components/Edittable/utils/index.d.ts +2 -0
- package/dist/components/Edittable/utils/index.js +47 -37
- package/dist/components/Edittable/utils/index.js.map +1 -1
- package/dist/components/Form/Form.d.ts +2 -2
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/LovInput/LovInput.vue.d.ts +7 -1
- package/dist/components/Form/index.js +371 -377
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Input/DateInput/DateInput.d.ts +0 -1
- package/dist/components/Input/DateInput/DateInput.vue.d.ts +3 -0
- package/dist/components/Input/FileInput/FileInput.vue.d.ts +6 -3
- package/dist/components/Input/LovInput/LovInput.d.ts +0 -1
- package/dist/components/Input/LovInput/LovInput.js.map +1 -1
- package/dist/components/Input/LovInput/LovInput.vue.d.ts +6 -6
- package/dist/components/Input/NumberInput/NumberInput.d.ts +0 -1
- package/dist/components/Input/NumberInput/NumberInput.vue.d.ts +3 -0
- package/dist/components/Input/PasswordInput/PasswordInput.d.ts +0 -1
- package/dist/components/Input/PasswordInput/PasswordInput.vue.d.ts +3 -0
- package/dist/components/Input/StringInput/StringInput.d.ts +0 -1
- package/dist/components/Input/StringInput/StringInput.vue.d.ts +3 -0
- package/dist/components/Input/TableSelect/TableSelect.d.ts +0 -1
- package/dist/components/Input/TableSelect/TableSelect.js.map +1 -1
- package/dist/components/Input/TableSelect/TableSelect.vue.d.ts +6 -6
- package/dist/components/Input/Textarea/Textarea.d.ts +0 -1
- package/dist/components/Input/Textarea/Textarea.vue.d.ts +3 -0
- package/dist/components/Input/index.d.ts +35 -9
- package/dist/components/Input/index.js +2 -2
- package/dist/components/Tabs/index.d.ts +114 -56
- package/dist/components/Tabs/index.js +88 -464
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/tab-pane.d.ts +8 -16
- package/dist/components/Tabs/tab-pane.js +1 -34
- package/dist/components/Tabs/tab-pane.js.map +1 -1
- package/dist/components/Tabs/tab-pane.vue.d.ts +3 -28
- package/dist/components/Tabs/tabs.d.ts +12 -101
- package/dist/components/Tabs/tabs.js +2 -0
- package/dist/components/Tabs/tabs.js.map +1 -0
- package/dist/components/Tabs/tabs.vue.d.ts +63 -0
- package/dist/components/_util/browser.js +2 -2
- package/dist/components/_util/dom/element.js +1 -1
- package/dist/components/_util/dom/position.js +1 -1
- package/dist/components/_util/dom/scroll.js +1 -1
- package/dist/components/_util/dom/style.js +1 -1
- package/dist/components/_util/index.js +1 -1
- package/dist/components/_util/raf.js +1 -1
- package/dist/components/_util/vue/global-node.js +1 -1
- package/dist/components/components.d.ts +0 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +14 -14
- package/dist/components/index.js.map +1 -1
- package/dist/index-C8JNJPWW.js +8 -0
- package/dist/{index-C9tCD90X.js.map → index-C8JNJPWW.js.map} +1 -1
- package/dist/index.css +1 -1
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +1 -1
- package/dist/version/version.js.map +1 -1
- package/package.json +1 -1
- package/dist/LovInput.vue_vue_type_script_setup_true_lang-C__ELopU.js +0 -400
- package/dist/LovInput.vue_vue_type_script_setup_true_lang-C__ELopU.js.map +0 -1
- package/dist/TableSelect.vue_vue_type_script_setup_true_lang-0WMTwNxX.js +0 -310
- package/dist/TableSelect.vue_vue_type_script_setup_true_lang-0WMTwNxX.js.map +0 -1
- package/dist/components/Tabs/constants.d.ts +0 -19
- package/dist/components/Tabs/constants.js +0 -5
- package/dist/components/Tabs/constants.js.map +0 -1
- package/dist/components/Tabs/tab-bar.d.ts +0 -59
- package/dist/components/Tabs/tab-bar.js +0 -15
- package/dist/components/Tabs/tab-bar.js.map +0 -1
- package/dist/components/Tabs/tab-bar.vue.d.ts +0 -131
- package/dist/components/Tabs/tab-nav.d.ts +0 -237
- package/dist/index-C9tCD90X.js +0 -45
@@ -0,0 +1,313 @@
|
|
1
|
+
import { defineComponent as g, mergeModels as m, useModel as V, openBlock as r, createBlock as f, unref as i, withCtx as h, createElementBlock as C, Fragment as B, renderList as M, createTextVNode as R, toDisplayString as A, computed as S, watch as T, ref as b, useTemplateRef as E, onMounted as U, provide as K, reactive as L, resolveComponent as q, renderSlot as H, createElementVNode as J, createVNode as O, createCommentVNode as Q } from "vue";
|
2
|
+
import { ElInput as _, ElRadioGroup as W, ElRadio as X, ElCheckboxGroup as Y, ElCheckbox as Z, ElSwitch as ee, ElDropdown as le, ElTag as ae } from "element-plus";
|
3
|
+
import { useInputCode as $ } from "./components/Input/hooks/index.js";
|
4
|
+
import { tableSelectContext as oe } from "./components/Input/TableSelect/TableSelect.js";
|
5
|
+
import { k as te, e as ne } from "./index-CIR6wX_E.js";
|
6
|
+
import { pick as de } from "lodash-es";
|
7
|
+
const fe = /* @__PURE__ */ g({
|
8
|
+
name: "OPasswordInput",
|
9
|
+
inheritAttrs: !1,
|
10
|
+
__name: "PasswordInput",
|
11
|
+
props: /* @__PURE__ */ m({
|
12
|
+
maxlength: {},
|
13
|
+
placeholder: {},
|
14
|
+
disabled: { type: Boolean }
|
15
|
+
}, {
|
16
|
+
modelValue: {},
|
17
|
+
modelModifiers: {}
|
18
|
+
}),
|
19
|
+
emits: /* @__PURE__ */ m(["change"], ["update:modelValue"]),
|
20
|
+
setup(d, { emit: p }) {
|
21
|
+
const c = p, u = (a) => {
|
22
|
+
c("change", a);
|
23
|
+
}, l = V(d, "modelValue");
|
24
|
+
return (a, o) => (r(), f(i(_), {
|
25
|
+
modelValue: l.value,
|
26
|
+
"onUpdate:modelValue": o[0] || (o[0] = (e) => l.value = e),
|
27
|
+
maxlength: a.maxlength,
|
28
|
+
placeholder: a.placeholder,
|
29
|
+
disabled: a.disabled,
|
30
|
+
type: "password",
|
31
|
+
onChange: u
|
32
|
+
}, null, 8, ["modelValue", "maxlength", "placeholder", "disabled"]));
|
33
|
+
}
|
34
|
+
}), ve = /* @__PURE__ */ g({
|
35
|
+
name: "OTextarea",
|
36
|
+
inheritAttrs: !1,
|
37
|
+
__name: "Textarea",
|
38
|
+
props: /* @__PURE__ */ m({
|
39
|
+
maxlength: {},
|
40
|
+
placeholder: {},
|
41
|
+
disabled: { type: Boolean },
|
42
|
+
rows: {}
|
43
|
+
}, {
|
44
|
+
modelValue: {},
|
45
|
+
modelModifiers: {}
|
46
|
+
}),
|
47
|
+
emits: /* @__PURE__ */ m(["change"], ["update:modelValue"]),
|
48
|
+
setup(d, { emit: p }) {
|
49
|
+
const c = p, u = (a) => {
|
50
|
+
c("change", a);
|
51
|
+
}, l = V(d, "modelValue");
|
52
|
+
return (a, o) => (r(), f(i(_), {
|
53
|
+
modelValue: l.value,
|
54
|
+
"onUpdate:modelValue": o[0] || (o[0] = (e) => l.value = e),
|
55
|
+
maxlength: a.maxlength,
|
56
|
+
placeholder: a.placeholder,
|
57
|
+
disabled: a.disabled,
|
58
|
+
type: "textarea",
|
59
|
+
rows: a.rows,
|
60
|
+
resize: "none",
|
61
|
+
onChange: u
|
62
|
+
}, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "rows"]));
|
63
|
+
}
|
64
|
+
}), he = /* @__PURE__ */ g({
|
65
|
+
name: "ORadioGroup",
|
66
|
+
inheritAttrs: !1,
|
67
|
+
__name: "RadioGroup",
|
68
|
+
props: /* @__PURE__ */ m({
|
69
|
+
disabled: { type: Boolean },
|
70
|
+
code: {}
|
71
|
+
}, {
|
72
|
+
modelValue: {},
|
73
|
+
modelModifiers: {}
|
74
|
+
}),
|
75
|
+
emits: /* @__PURE__ */ m(["change"], ["update:modelValue"]),
|
76
|
+
setup(d, { emit: p }) {
|
77
|
+
const c = p, u = (o) => {
|
78
|
+
c("change", o);
|
79
|
+
}, l = V(d, "modelValue"), a = $();
|
80
|
+
return (o, e) => (r(), f(i(W), {
|
81
|
+
modelValue: l.value,
|
82
|
+
"onUpdate:modelValue": e[0] || (e[0] = (t) => l.value = t),
|
83
|
+
disabled: o.disabled,
|
84
|
+
onChange: u
|
85
|
+
}, {
|
86
|
+
default: h(() => [
|
87
|
+
(r(!0), C(B, null, M(i(a), (t) => (r(), f(i(X), {
|
88
|
+
key: t.value,
|
89
|
+
value: t.value
|
90
|
+
}, {
|
91
|
+
default: h(() => [
|
92
|
+
R(A(t.content), 1)
|
93
|
+
]),
|
94
|
+
_: 2
|
95
|
+
}, 1032, ["value"]))), 128))
|
96
|
+
]),
|
97
|
+
_: 1
|
98
|
+
}, 8, ["modelValue", "disabled"]));
|
99
|
+
}
|
100
|
+
}), ge = /* @__PURE__ */ g({
|
101
|
+
name: "OCheckboxGroup",
|
102
|
+
inheritAttrs: !1,
|
103
|
+
__name: "CheckboxGroup",
|
104
|
+
props: /* @__PURE__ */ m({
|
105
|
+
disabled: { type: Boolean },
|
106
|
+
code: {}
|
107
|
+
}, {
|
108
|
+
modelValue: {},
|
109
|
+
modelModifiers: {}
|
110
|
+
}),
|
111
|
+
emits: /* @__PURE__ */ m(["change"], ["update:modelValue"]),
|
112
|
+
setup(d, { emit: p }) {
|
113
|
+
const c = p, u = (e) => {
|
114
|
+
c("change", e.join(","));
|
115
|
+
}, l = V(d, "modelValue"), a = S({
|
116
|
+
get: () => {
|
117
|
+
if (l.value)
|
118
|
+
return l.value.split(",");
|
119
|
+
},
|
120
|
+
set: (e) => {
|
121
|
+
e ? l.value = e.join(",") : l.value = "";
|
122
|
+
}
|
123
|
+
}), o = $();
|
124
|
+
return (e, t) => (r(), f(i(Y), {
|
125
|
+
modelValue: a.value,
|
126
|
+
"onUpdate:modelValue": t[0] || (t[0] = (s) => a.value = s),
|
127
|
+
disabled: e.disabled,
|
128
|
+
onChange: u
|
129
|
+
}, {
|
130
|
+
default: h(() => [
|
131
|
+
(r(!0), C(B, null, M(i(o), (s) => (r(), f(i(Z), {
|
132
|
+
key: s.value,
|
133
|
+
label: s.content,
|
134
|
+
value: s.value
|
135
|
+
}, null, 8, ["label", "value"]))), 128))
|
136
|
+
]),
|
137
|
+
_: 1
|
138
|
+
}, 8, ["modelValue", "disabled"]));
|
139
|
+
}
|
140
|
+
}), Ve = /* @__PURE__ */ g({
|
141
|
+
name: "OSwitch",
|
142
|
+
inheritAttrs: !1,
|
143
|
+
__name: "Switch",
|
144
|
+
props: /* @__PURE__ */ m({
|
145
|
+
disabled: { type: Boolean }
|
146
|
+
}, {
|
147
|
+
modelValue: {},
|
148
|
+
modelModifiers: {}
|
149
|
+
}),
|
150
|
+
emits: /* @__PURE__ */ m(["change"], ["update:modelValue"]),
|
151
|
+
setup(d, { emit: p }) {
|
152
|
+
const c = p, u = (o) => {
|
153
|
+
c("change", o ? "1" : "0");
|
154
|
+
}, l = V(d, "modelValue"), a = S({
|
155
|
+
get: () => l.value ? l.value == "1" : !1,
|
156
|
+
set: (o) => {
|
157
|
+
const e = l.value, t = o ? "1" : "0";
|
158
|
+
(e || o) && (l.value = t);
|
159
|
+
}
|
160
|
+
});
|
161
|
+
return (o, e) => (r(), f(i(ee), {
|
162
|
+
modelValue: a.value,
|
163
|
+
"onUpdate:modelValue": e[0] || (e[0] = (t) => a.value = t),
|
164
|
+
disabled: o.disabled,
|
165
|
+
onChange: u
|
166
|
+
}, null, 8, ["modelValue", "disabled"]));
|
167
|
+
}
|
168
|
+
}), be = /* @__PURE__ */ g({
|
169
|
+
name: "OFileInput",
|
170
|
+
inheritAttrs: !1,
|
171
|
+
__name: "FileInput",
|
172
|
+
props: /* @__PURE__ */ m({
|
173
|
+
disabled: { type: Boolean }
|
174
|
+
}, {
|
175
|
+
modelValue: {},
|
176
|
+
modelModifiers: {}
|
177
|
+
}),
|
178
|
+
emits: /* @__PURE__ */ m(["change"], ["update:modelValue"]),
|
179
|
+
setup(d, { emit: p }) {
|
180
|
+
const c = p, u = (e) => {
|
181
|
+
c("change", e);
|
182
|
+
}, l = V(d, "modelValue");
|
183
|
+
T(l, () => {
|
184
|
+
l.value || (a.value = "");
|
185
|
+
});
|
186
|
+
const a = b(""), o = E("inputRef");
|
187
|
+
return U(() => {
|
188
|
+
o.value.input.onchange = (e) => {
|
189
|
+
var s;
|
190
|
+
const t = (s = e == null ? void 0 : e.target) == null ? void 0 : s.files[0];
|
191
|
+
l.value = t, u(t);
|
192
|
+
}, a.value = "";
|
193
|
+
}), (e, t) => (r(), f(i(_), {
|
194
|
+
ref: "inputRef",
|
195
|
+
modelValue: a.value,
|
196
|
+
"onUpdate:modelValue": t[0] || (t[0] = (s) => a.value = s),
|
197
|
+
disabled: e.disabled,
|
198
|
+
type: "file",
|
199
|
+
"validate-event": !1
|
200
|
+
}, null, 8, ["modelValue", "disabled"]));
|
201
|
+
}
|
202
|
+
}), ue = {
|
203
|
+
key: 0,
|
204
|
+
style: { position: "absolute", inset: "4px 30px 4px 4px", overflow: "hidden", pointerEvents: "none" }
|
205
|
+
}, we = /* @__PURE__ */ g({
|
206
|
+
name: "OTableSelect",
|
207
|
+
inheritAttrs: !1,
|
208
|
+
__name: "TableSelect",
|
209
|
+
props: /* @__PURE__ */ m({
|
210
|
+
maxlength: {},
|
211
|
+
placeholder: {},
|
212
|
+
disabled: { type: Boolean },
|
213
|
+
pick: {},
|
214
|
+
tag: { type: Function }
|
215
|
+
}, {
|
216
|
+
modelValue: {},
|
217
|
+
modelModifiers: {}
|
218
|
+
}),
|
219
|
+
emits: /* @__PURE__ */ m(["change"], ["update:modelValue"]),
|
220
|
+
setup(d, { emit: p }) {
|
221
|
+
const c = p, u = V(d, "modelValue"), l = b(""), a = E("input"), o = b(!1), e = b(!1), t = b([]), s = E("dropdown"), v = b([]);
|
222
|
+
U(async () => {
|
223
|
+
w && (v.value = await w(u.value), v.value && (t.value = v.value.map((n) => d.tag(n))));
|
224
|
+
}), T(u, async () => {
|
225
|
+
o.value ? w && (v.value = await w(u.value), v.value && (t.value = v.value.map((n) => d.tag(n)))) : o.value = !0;
|
226
|
+
});
|
227
|
+
const F = (n) => {
|
228
|
+
e.value = n;
|
229
|
+
}, G = () => {
|
230
|
+
e.value || s.value.handleOpen();
|
231
|
+
}, P = () => {
|
232
|
+
a.value.focus();
|
233
|
+
}, D = (n) => {
|
234
|
+
e.value ? ["Enter", "Escape"].indexOf(n.code) > -1 ? s.value.handleClose() : n.code == "ArrowDown" ? n.stopPropagation() : n.code == "Tab" && (e.value = !1, s.value.handleClose()) : ["ArrowUp", "ArrowDown"].indexOf(n.code) > -1 && (s.value.handleOpen(), n.stopPropagation());
|
235
|
+
}, I = () => {
|
236
|
+
e.value ? a.value.focus() : l.value = "";
|
237
|
+
}, N = (n, x) => {
|
238
|
+
o.value = !1, u.value = n.map((y) => de(y, d.pick)), t.value = n.map((y) => d.tag(y)), x && (l.value = ""), c("change", n);
|
239
|
+
}, z = () => {
|
240
|
+
s.value.handleClose();
|
241
|
+
};
|
242
|
+
let w;
|
243
|
+
const j = (n) => {
|
244
|
+
w = n;
|
245
|
+
};
|
246
|
+
return K(
|
247
|
+
oe,
|
248
|
+
L({
|
249
|
+
inputValue: l,
|
250
|
+
selection: v,
|
251
|
+
onSelect: N,
|
252
|
+
selectDone: z,
|
253
|
+
tag: d.tag,
|
254
|
+
registerRowCompletionProvider: j
|
255
|
+
})
|
256
|
+
), (n, x) => {
|
257
|
+
const y = q("o-space");
|
258
|
+
return r(), f(i(le), {
|
259
|
+
ref: "dropdown",
|
260
|
+
trigger: "click",
|
261
|
+
onVisibleChange: F,
|
262
|
+
style: { width: "100%" }
|
263
|
+
}, {
|
264
|
+
dropdown: h(() => [
|
265
|
+
H(n.$slots, "default")
|
266
|
+
]),
|
267
|
+
default: h(() => [
|
268
|
+
J("div", {
|
269
|
+
onFocus: P,
|
270
|
+
style: { position: "relative", width: "100%", height: "100%" }
|
271
|
+
}, [
|
272
|
+
O(i(_), {
|
273
|
+
ref: "input",
|
274
|
+
modelValue: l.value,
|
275
|
+
"onUpdate:modelValue": x[0] || (x[0] = (k) => l.value = k),
|
276
|
+
maxlength: n.maxlength,
|
277
|
+
placeholder: n.placeholder,
|
278
|
+
disabled: n.disabled,
|
279
|
+
onInput: G,
|
280
|
+
onKeydown: D,
|
281
|
+
onBlur: I,
|
282
|
+
"suffix-icon": e.value ? i(te) : i(ne)
|
283
|
+
}, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "suffix-icon"]),
|
284
|
+
e.value ? Q("", !0) : (r(), C("div", ue, [
|
285
|
+
O(y, null, {
|
286
|
+
default: h(() => [
|
287
|
+
(r(!0), C(B, null, M(t.value, (k) => (r(), f(i(ae), { type: "info" }, {
|
288
|
+
default: h(() => [
|
289
|
+
R(A(k), 1)
|
290
|
+
]),
|
291
|
+
_: 2
|
292
|
+
}, 1024))), 256))
|
293
|
+
]),
|
294
|
+
_: 1
|
295
|
+
})
|
296
|
+
]))
|
297
|
+
], 32)
|
298
|
+
]),
|
299
|
+
_: 3
|
300
|
+
}, 512);
|
301
|
+
};
|
302
|
+
}
|
303
|
+
});
|
304
|
+
export {
|
305
|
+
fe as _,
|
306
|
+
ve as a,
|
307
|
+
he as b,
|
308
|
+
ge as c,
|
309
|
+
Ve as d,
|
310
|
+
be as e,
|
311
|
+
we as f
|
312
|
+
};
|
313
|
+
//# sourceMappingURL=TableSelect.vue_vue_type_script_setup_true_lang-DmAuOipe.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TableSelect.vue_vue_type_script_setup_true_lang-DmAuOipe.js","sources":["../src/components/Input/PasswordInput/PasswordInput.vue","../src/components/Input/Textarea/Textarea.vue","../src/components/Input/RadioGroup/RadioGroup.vue","../src/components/Input/CheckboxGroup/CheckboxGroup.vue","../src/components/Input/Switch/Switch.vue","../src/components/Input/FileInput/FileInput.vue","../src/components/Input/TableSelect/TableSelect.vue"],"sourcesContent":["<template>\r\n <el-input v-model=\"model\" :maxlength=\"maxlength\" :placeholder=\"placeholder\" :disabled=\"disabled\" type=\"password\"\r\n @change=\"onChange\" />\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { PasswordInputProps } from './PasswordInput'\r\nimport { ElInput } from 'element-plus'\r\n\r\ndefineOptions({ name: 'OPasswordInput', inheritAttrs: false })\r\nconst emit = defineEmits<{\r\n (e: 'change', value: string): void\r\n}>()\r\nconst onChange = (value: string) => {\r\n emit('change', value)\r\n}\r\n\r\nconst { maxlength, placeholder, disabled } = defineProps<PasswordInputProps>()\r\n\r\nconst model = defineModel<string>()\r\n</script>\r\n","<template>\r\n <el-input v-model=\"model\" :maxlength=\"maxlength\" :placeholder=\"placeholder\" :disabled=\"disabled\" type=\"textarea\"\r\n :rows=\"rows\" :resize=\"'none'\" @change=\"onChange\" />\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { TextareaProps } from './Textarea'\r\nimport { ElInput } from 'element-plus'\r\n\r\ndefineOptions({ name: 'OTextarea', inheritAttrs: false })\r\nconst emit = defineEmits<{\r\n (e: 'change', value: string): void\r\n}>()\r\nconst onChange = (value: string) => {\r\n emit('change', value)\r\n}\r\n\r\nconst { maxlength, placeholder, disabled, rows } = defineProps<TextareaProps>()\r\n\r\nconst model = defineModel<string>()\r\n</script>\r\n","<template>\r\n <el-radio-group v-model=\"model\" :disabled=\"disabled\" @change=\"onChange\">\r\n <el-radio v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :value=\"codeItem.value\">\r\n {{ codeItem.content }}\r\n </el-radio>\r\n </el-radio-group>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { RadioGroupProps } from './RadioGroup'\r\nimport { useInputCode } from '../hooks'\r\nimport { ElRadioGroup, ElRadio } from 'element-plus'\r\n\r\ndefineOptions({ name: 'ORadioGroup', inheritAttrs: false })\r\nconst emit = defineEmits<{\r\n (e: 'change', value: string): void\r\n}>()\r\nconst onChange = (value: any) => {\r\n emit('change', value)\r\n}\r\n\r\nconst { disabled } = defineProps<RadioGroupProps>()\r\n\r\nconst model = defineModel<string>()\r\nconst normalizedCode = useInputCode()\r\n</script>\r\n","<template>\r\n <el-checkbox-group v-model=\"elModel\" :disabled=\"disabled\" @change=\"onChange\">\r\n <el-checkbox v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :label=\"codeItem.content\"\r\n :value=\"codeItem.value\" />\r\n </el-checkbox-group>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { CheckboxGroupProps } from './CheckboxGroup'\r\nimport { useInputCode } from '../hooks'\r\nimport { ElCheckboxGroup, ElCheckbox } from 'element-plus'\r\nimport { computed } from 'vue'\r\n\r\ndefineOptions({ name: 'OCheckboxGroup', inheritAttrs: false })\r\nconst emit = defineEmits<{\r\n (e: 'change', value: string): void\r\n}>()\r\nconst onChange = (value: any) => {\r\n emit('change', value.join(','))\r\n}\r\n\r\nconst { disabled } = defineProps<CheckboxGroupProps>()\r\n\r\nconst model = defineModel<string>()\r\nconst elModel = computed<string[] | undefined>({\r\n get: () => {\r\n if (!model.value) {\r\n return undefined\r\n }\r\n return model.value.split(',')\r\n },\r\n set: (newValue) => {\r\n if (!newValue) {\r\n model.value = ''\r\n } else {\r\n model.value = newValue.join(',')\r\n }\r\n },\r\n})\r\n\r\nconst normalizedCode = useInputCode()\r\n</script>\r\n","<template>\r\n <el-switch v-model=\"elModel\" :disabled=\"disabled\" @change=\"onChange\" />\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { SwitchProps } from './Switch'\r\nimport { ElSwitch } from 'element-plus'\r\nimport { computed } from 'vue'\r\n\r\ndefineOptions({ name: 'OSwitch', inheritAttrs: false })\r\nconst emit = defineEmits<{\r\n (e: 'change', value: '1' | '0'): void\r\n}>()\r\nconst onChange = (value: any) => {\r\n emit('change', value ? '1' : '0')\r\n}\r\n\r\nconst { disabled } = defineProps<SwitchProps>()\r\n\r\nconst model = defineModel<string>()\r\nconst elModel = computed<boolean>({\r\n get: () => {\r\n if (!model.value) {\r\n return false\r\n }\r\n return model.value == '1'\r\n },\r\n set: (_newValue) => {\r\n const oldValue = model.value\r\n const newValue = _newValue ? '1' : '0'\r\n if (oldValue) {\r\n model.value = newValue\r\n } else {\r\n if (_newValue) {\r\n model.value = newValue\r\n }\r\n }\r\n },\r\n})\r\n</script>\r\n","<template>\r\n <el-input ref=\"inputRef\" v-model=\"file\" :disabled=\"disabled\" type=\"file\" :validate-event=\"false\" />\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { FileInputProps } from './FileInput'\r\nimport { ElInput } from 'element-plus'\r\nimport { onMounted, ref, useTemplateRef, watch } from 'vue'\r\n\r\ndefineOptions({ name: 'OFileInput', inheritAttrs: false })\r\n\r\nconst { disabled } = defineProps<FileInputProps>()\r\nconst emit = defineEmits<{\r\n (e: 'change', value: File): void\r\n}>()\r\nconst onChange = (value: File) => {\r\n emit('change', value)\r\n}\r\n\r\nconst model = defineModel<File>()\r\nwatch(model, () => {\r\n if (!model.value) {\r\n file.value = ''\r\n }\r\n})\r\n\r\nconst file = ref('')\r\nconst fileRef = useTemplateRef('inputRef')\r\nonMounted(() => {\r\n fileRef.value!.input!.onchange = (event) => {\r\n //@ts-ignore\r\n const value = event?.target?.files[0]\r\n model.value = value\r\n onChange(value)\r\n }\r\n file.value = ''\r\n})\r\n</script>\r\n","<template>\r\n <el-dropdown ref=\"dropdown\" :trigger=\"'click'\" @visible-change=\"onVisibleChange\" style=\"width: 100%;\">\r\n <div @focus=\"onFocus\" :style=\"{ position: 'relative', width: '100%', height: '100%' }\">\r\n <el-input ref=\"input\" v-model=\"inputValue\" :maxlength=\"maxlength\" :placeholder=\"placeholder\" :disabled=\"disabled\"\r\n @input=\"onInput\" @keydown=\"onKeydown\" @blur=\"onBlur\" :suffix-icon=\"visible ? ArrowUp : ArrowDown\" />\r\n <div v-if=\"!visible\"\r\n :style=\"{ position: 'absolute', inset: '4px 30px 4px 4px', overflow: 'hidden', pointerEvents: 'none' }\">\r\n <o-space>\r\n <el-tag v-for=\"tag in tags\" type=\"info\">{{ tag }}</el-tag>\r\n </o-space>\r\n </div>\r\n </div>\r\n <template #dropdown>\r\n <slot></slot>\r\n </template>\r\n </el-dropdown>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport { RowCompletionProvider, TableSelectContext, tableSelectContext, type TableSelectProps } from './TableSelect'\r\nimport { ElInput, ElDropdown, ElTag } from 'element-plus'\r\nimport { ArrowDown, ArrowUp } from '@element-plus/icons-vue'\r\nimport { onMounted, provide, reactive, ref, useTemplateRef, watch } from 'vue'\r\nimport { pick } from 'lodash-es'\r\n\r\n\r\ndefineOptions({ name: 'OTableSelect', inheritAttrs: false })\r\n\r\nconst emit = defineEmits<{\r\n (e: 'change', selection: any[]): void\r\n}>()\r\nconst { maxlength, placeholder, disabled, pick: pickup, tag } = defineProps<TableSelectProps>()\r\nconst model = defineModel<any[]>()\r\n\r\nconst inputValue = ref('')\r\nconst inputRef = useTemplateRef('input')\r\nconst modifyByForm = ref(false)\r\nconst visible = ref(false)\r\nconst tags = ref<string[]>([])\r\nconst dropdownRef = useTemplateRef('dropdown')\r\nconst selection = ref<any[] | undefined>([])\r\n\r\nonMounted(async () => {\r\n if (completionItemProvider) {\r\n selection.value = await completionItemProvider(model.value)\r\n if (selection.value) {\r\n tags.value = selection.value.map((item) => tag(item))\r\n }\r\n }\r\n})\r\n\r\nwatch(model, async () => {\r\n if (modifyByForm.value) {\r\n if (completionItemProvider) {\r\n selection.value = await completionItemProvider(model.value)\r\n if (selection.value) {\r\n tags.value = selection.value.map((item) => tag(item))\r\n }\r\n }\r\n } else {\r\n modifyByForm.value = true\r\n }\r\n})\r\n\r\nconst onVisibleChange = (val: boolean) => {\r\n visible.value = val\r\n}\r\n\r\nconst onInput = () => {\r\n if (!visible.value) {\r\n dropdownRef.value!.handleOpen()\r\n }\r\n}\r\n\r\nconst onFocus = () => {\r\n inputRef.value!.focus()\r\n}\r\n\r\nconst onKeydown = (e: any) => {\r\n if (visible.value) {\r\n if (['Enter', 'Escape'].indexOf(e.code) > -1) {\r\n dropdownRef.value!.handleClose()\r\n } else if ('ArrowDown' == e.code) {\r\n e.stopPropagation()\r\n } else if ('Tab' == e.code) {\r\n visible.value = false\r\n dropdownRef.value!.handleClose()\r\n }\r\n } else {\r\n if (['ArrowUp', 'ArrowDown'].indexOf(e.code) > -1) {\r\n dropdownRef.value!.handleOpen()\r\n e.stopPropagation()\r\n }\r\n }\r\n}\r\n\r\nconst onBlur = () => {\r\n if (visible.value) {\r\n inputRef.value!.focus()\r\n } else {\r\n inputValue.value = ''\r\n }\r\n}\r\n\r\nconst onSelect: TableSelectContext['onSelect'] = (_selection, clear) => {\r\n modifyByForm.value = false\r\n model.value = _selection.map((item) => pick(item, pickup))\r\n tags.value = _selection.map((item) => tag(item))\r\n if (clear) {\r\n inputValue.value = ''\r\n }\r\n emit('change', _selection)\r\n}\r\n\r\nconst selectDone: TableSelectContext['selectDone'] = () => {\r\n dropdownRef.value!.handleClose()\r\n}\r\n\r\nlet completionItemProvider: RowCompletionProvider | undefined\r\nconst registerRowCompletionProvider: TableSelectContext['registerRowCompletionProvider'] = (provider) => {\r\n completionItemProvider = provider\r\n}\r\n\r\nprovide(\r\n tableSelectContext,\r\n reactive({\r\n inputValue,\r\n selection,\r\n onSelect,\r\n selectDone,\r\n tag,\r\n registerRowCompletionProvider\r\n })\r\n)\r\n</script>"],"names":["emit","__emit","onChange","value","model","_useModel","__props","normalizedCode","useInputCode","elModel","computed","newValue","_newValue","oldValue","watch","file","ref","fileRef","useTemplateRef","onMounted","event","_a","inputValue","inputRef","modifyByForm","visible","tags","dropdownRef","selection","completionItemProvider","item","onVisibleChange","val","onInput","onFocus","onKeydown","e","onBlur","onSelect","_selection","clear","pick","selectDone","registerRowCompletionProvider","provider","provide","tableSelectContext","reactive"],"mappings":";;;;;;;;;;;;;;;;;;;;AAUA,UAAMA,IAAOC,GAGPC,IAAW,CAACC,MAAkB;AAClC,MAAAH,EAAK,UAAUG,CAAK;AAAA,IAAA,GAKhBC,IAAQC,EAAoBC,GAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;ACTlC,UAAMN,IAAOC,GAGPC,IAAW,CAACC,MAAkB;AAClC,MAAAH,EAAK,UAAUG,CAAK;AAAA,IAAA,GAKhBC,IAAQC,EAAoBC,GAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;ACLlC,UAAMN,IAAOC,GAGPC,IAAW,CAACC,MAAe;AAC/B,MAAAH,EAAK,UAAUG,CAAK;AAAA,IAAA,GAKhBC,IAAQC,EAAoBC,GAAA,YAAA,GAC5BC,IAAiBC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVvB,UAAMR,IAAOC,GAGPC,IAAW,CAACC,MAAe;AAC/B,MAAAH,EAAK,UAAUG,EAAM,KAAK,GAAG,CAAC;AAAA,IAAA,GAK1BC,IAAQC,EAAoBC,GAAA,YAAA,GAC5BG,IAAUC,EAA+B;AAAA,MAC7C,KAAK,MAAM;AACL,YAACN,EAAM;AAGJ,iBAAAA,EAAM,MAAM,MAAM,GAAG;AAAA,MAC9B;AAAA,MACA,KAAK,CAACO,MAAa;AACjB,QAAKA,IAGGP,EAAA,QAAQO,EAAS,KAAK,GAAG,IAF/BP,EAAM,QAAQ;AAAA,MAIlB;AAAA,IAAA,CACD,GAEKG,IAA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AACT,MAASxB,MAAIwB,CAAI,CAAC,GAC3CU,MACFlB,EAAW,QAAQ,KAErBtB,EAAK,UAAUuC,CAAU;AAAA,IAAA,GAGrBG,IAA+C,MAAM;AACzD,MAAAf,EAAY,MAAO;IAAY;AAG7B,QAAAE;AACE,UAAAc,IAAqF,CAACC,MAAa;AAC9E,MAAAf,IAAAe;AAAA,IAAA;AAG3B,WAAAC;AAAA,MACEC;AAAA,MACAC,EAAS;AAAA,QACP,YAAAzB;AAAA,QACA,WAAAM;AAAA,QACA,UAAAU;AAAA,QACA,YAAAI;AAAA,QACA,KAAEpC,EAAA;AAAA,QACF,+BAAAqC;AAAA,MAAA,CACD;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { PropType, ExtractPropTypes, CSSProperties, ComponentPublicInstance
|
1
|
+
import { PropType, ExtractPropTypes, CSSProperties, ComponentPublicInstance } from 'vue';
|
2
2
|
type rowClassNameFn = (data: {
|
3
3
|
rowData: any;
|
4
4
|
rowIndex: number;
|
@@ -44,6 +44,8 @@ export declare const edittableProps: () => {
|
|
44
44
|
rowStyle: PropType<CSSProperties | rowStyleFn>;
|
45
45
|
cellClassName: PropType<string | cellClassNameFn>;
|
46
46
|
cellStyle: PropType<CSSProperties | cellStyleFn>;
|
47
|
+
fakeTailRow: BooleanConstructor;
|
48
|
+
tailRowTemplate: PropType<Record<string, any> | (() => Record<string, any>)>;
|
47
49
|
};
|
48
50
|
export type EdittableProps = Partial<ExtractPropTypes<ReturnType<typeof edittableProps>>>;
|
49
51
|
export interface EdittableExpose {
|
@@ -52,7 +54,7 @@ export interface EdittableExpose {
|
|
52
54
|
toggleAllSelection: () => void;
|
53
55
|
getSelectionRows: () => any[];
|
54
56
|
setCurrentRow: (row: any) => void;
|
55
|
-
|
57
|
+
scrollToRow: (index: number) => void;
|
56
58
|
}
|
57
59
|
export type EdittableInstance = ComponentPublicInstance<EdittableProps, EdittableExpose>;
|
58
60
|
declare const _default: import('vue').DefineComponent<ExtractPropTypes<{
|
@@ -74,6 +76,8 @@ declare const _default: import('vue').DefineComponent<ExtractPropTypes<{
|
|
74
76
|
rowStyle: PropType<CSSProperties | rowStyleFn>;
|
75
77
|
cellClassName: PropType<string | cellClassNameFn>;
|
76
78
|
cellStyle: PropType<CSSProperties | cellStyleFn>;
|
79
|
+
fakeTailRow: BooleanConstructor;
|
80
|
+
tailRowTemplate: PropType<Record<string, any> | (() => Record<string, any>)>;
|
77
81
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("selectionChange" | "currentRowChange" | "rowClick" | "rowDblclick" | "cellClick" | "cellDblclick")[], "selectionChange" | "currentRowChange" | "rowClick" | "rowDblclick" | "cellClick" | "cellDblclick", import('vue').PublicProps, Readonly<ExtractPropTypes<{
|
78
82
|
data: ArrayConstructor;
|
79
83
|
showRowNumber: {
|
@@ -93,6 +97,8 @@ declare const _default: import('vue').DefineComponent<ExtractPropTypes<{
|
|
93
97
|
rowStyle: PropType<CSSProperties | rowStyleFn>;
|
94
98
|
cellClassName: PropType<string | cellClassNameFn>;
|
95
99
|
cellStyle: PropType<CSSProperties | cellStyleFn>;
|
100
|
+
fakeTailRow: BooleanConstructor;
|
101
|
+
tailRowTemplate: PropType<Record<string, any> | (() => Record<string, any>)>;
|
96
102
|
}>> & Readonly<{
|
97
103
|
onSelectionChange?: ((...args: any[]) => any) | undefined;
|
98
104
|
onCurrentRowChange?: ((...args: any[]) => any) | undefined;
|
@@ -104,5 +110,6 @@ declare const _default: import('vue').DefineComponent<ExtractPropTypes<{
|
|
104
110
|
showRowNumber: boolean;
|
105
111
|
selectionMode: boolean;
|
106
112
|
currentRowMode: boolean;
|
113
|
+
fakeTailRow: boolean;
|
107
114
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
108
115
|
export default _default;
|
@@ -44,8 +44,8 @@ declare const _default: import('vue').DefineComponent<ExtractPropTypes<{
|
|
44
44
|
format: StringConstructor;
|
45
45
|
sourceFormat: StringConstructor;
|
46
46
|
}>> & Readonly<{}>, {
|
47
|
-
clearable: boolean;
|
48
47
|
editable: boolean;
|
48
|
+
clearable: boolean;
|
49
49
|
cellEditable: boolean;
|
50
50
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
51
51
|
export default _default;
|
@@ -59,8 +59,8 @@ declare const _default: import('vue').DefineComponent<ExtractPropTypes<{
|
|
59
59
|
collapseTags: BooleanConstructor;
|
60
60
|
collapseTagsTooltip: BooleanConstructor;
|
61
61
|
}>> & Readonly<{}>, {
|
62
|
-
collapseTags: boolean;
|
63
62
|
editable: boolean;
|
63
|
+
collapseTags: boolean;
|
64
64
|
collapseTagsTooltip: boolean;
|
65
65
|
cellEditable: boolean;
|
66
66
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
@@ -77,9 +77,9 @@ declare const _default: import('vue').DefineComponent<ExtractPropTypes<{
|
|
77
77
|
controls: BooleanConstructor;
|
78
78
|
controlsPosition: PropType<"" | "right">;
|
79
79
|
}>> & Readonly<{}>, {
|
80
|
+
editable: boolean;
|
80
81
|
thousandsSeparator: boolean;
|
81
82
|
percentage: boolean;
|
82
|
-
editable: boolean;
|
83
83
|
stepStrictly: boolean;
|
84
84
|
controls: boolean;
|
85
85
|
cellEditable: boolean;
|
@@ -59,8 +59,8 @@ declare const _default: import('vue').DefineComponent<ExtractPropTypes<{
|
|
59
59
|
clearable: BooleanConstructor;
|
60
60
|
filterable: BooleanConstructor;
|
61
61
|
}>> & Readonly<{}>, {
|
62
|
-
clearable: boolean;
|
63
62
|
editable: boolean;
|
63
|
+
clearable: boolean;
|
64
64
|
filterable: boolean;
|
65
65
|
cellEditable: boolean;
|
66
66
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
@@ -3,7 +3,7 @@ import { EdittableInstance } from '../../../index.ts';
|
|
3
3
|
interface UseEdittableOptions<Row> {
|
4
4
|
tableRef?: Readonly<ShallowRef<EdittableInstance | null>>;
|
5
5
|
defaultData?: Row[];
|
6
|
-
|
6
|
+
newRowTemplate?: Record<string, any> | (() => Record<string, any>);
|
7
7
|
afterSelectionChange?: (newSelection: Row[]) => void;
|
8
8
|
afterCurrentRowChange?: (currentRow: Row, oldCurrentRow: Row) => void;
|
9
9
|
}
|
@@ -18,6 +18,7 @@ declare const useEdittable: <Row = any>(options: UseEdittableOptions<Row>) => {
|
|
18
18
|
toggleAllSelection: () => void;
|
19
19
|
getSelectionRows: () => Row[];
|
20
20
|
setCurrentRow: (row: Row) => void;
|
21
|
+
scrollToRow: (index: number) => void;
|
21
22
|
appendRow: (rowData: any) => void;
|
22
23
|
insertRow: (rowData: any, index: number) => void;
|
23
24
|
deleteRow: (index: number) => void;
|
@@ -1,91 +1,88 @@
|
|
1
|
-
import { ref as w, reactive as
|
2
|
-
import
|
3
|
-
import { isEqual as
|
4
|
-
import "
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
const { tableRef: o, defaultData: R, newRowSchema: c, afterSelectionChange: g, afterCurrentRowChange: v } = m, l = w(R || []), a = w([]), p = w(), S = (e) => {
|
10
|
-
a.value = e, g && g(e);
|
11
|
-
}, d = (e, t) => {
|
1
|
+
import { ref as w, reactive as U } from "vue";
|
2
|
+
import n from "../../../error/OrionError.js";
|
3
|
+
import { isEqual as j } from "lodash-es";
|
4
|
+
import { createRowData as f } from "../utils/index.js";
|
5
|
+
const J = (h) => {
|
6
|
+
const { tableRef: o, defaultData: R, newRowTemplate: i, afterSelectionChange: g, afterCurrentRowChange: v } = h, l = w(R || []), r = w([]), p = w(), m = (e) => {
|
7
|
+
r.value = e, g && g(e);
|
8
|
+
}, S = (e, t) => {
|
12
9
|
p.value = e, v && v(e, t);
|
13
|
-
},
|
10
|
+
}, b = () => {
|
14
11
|
if (!o)
|
15
|
-
throw new
|
12
|
+
throw new n("调用clearSelection失败,tableRef为空");
|
16
13
|
o.value.clearSelection();
|
17
|
-
},
|
14
|
+
}, C = (e, t) => {
|
18
15
|
if (!o)
|
19
|
-
throw new
|
16
|
+
throw new n("调用toggleRowSelection失败,tableRef为空");
|
20
17
|
o.value.toggleRowSelection(e, t);
|
21
|
-
},
|
18
|
+
}, d = () => {
|
22
19
|
if (!o)
|
23
|
-
throw new
|
20
|
+
throw new n("调用toggleAllSelection失败,tableRef为空");
|
24
21
|
o.value.toggleAllSelection();
|
25
|
-
},
|
22
|
+
}, E = () => {
|
26
23
|
if (!o)
|
27
|
-
throw new
|
24
|
+
throw new n("调用getSelectionRows失败,tableRef为空");
|
28
25
|
return o.value.getSelectionRows();
|
29
|
-
},
|
26
|
+
}, T = (e) => {
|
30
27
|
if (!o)
|
31
|
-
throw new
|
28
|
+
throw new n("调用setCurrentRow失败,tableRef为空");
|
32
29
|
o.value.setCurrentRow(e);
|
33
|
-
},
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
return c && (Y(c) ? n = c() : n = c), q(t, n, e);
|
38
|
-
}, _ = (e) => {
|
39
|
-
l.value.push(u(e));
|
40
|
-
}, A = (e, t) => {
|
41
|
-
l.value.splice(t, 0, u(e));
|
30
|
+
}, A = (e) => {
|
31
|
+
if (!o)
|
32
|
+
throw new n("调用scrollToRow失败,tableRef为空");
|
33
|
+
o.value.scrollToRow(e);
|
42
34
|
}, D = (e) => {
|
35
|
+
l.value.push(f(i, e));
|
36
|
+
}, G = (e, t) => {
|
37
|
+
l.value.splice(t, 0, f(i, e));
|
38
|
+
}, I = (e) => {
|
43
39
|
l.value.splice(e, 1);
|
44
|
-
},
|
45
|
-
l.value[t] =
|
40
|
+
}, q = (e, t) => {
|
41
|
+
l.value[t] = f(i, e);
|
42
|
+
}, x = (e) => {
|
43
|
+
a(e, e - 1);
|
46
44
|
}, F = (e) => {
|
47
|
-
|
48
|
-
},
|
49
|
-
|
50
|
-
|
51
|
-
const n = l.value.splice(e, 1);
|
52
|
-
l.value.splice(t, 0, n[0]);
|
45
|
+
a(e, e + 1);
|
46
|
+
}, a = (e, t) => {
|
47
|
+
const c = l.value.splice(e, 1);
|
48
|
+
l.value.splice(t, 0, c[0]);
|
53
49
|
};
|
54
|
-
return
|
50
|
+
return U({
|
55
51
|
data: l,
|
56
|
-
selection:
|
52
|
+
selection: r,
|
57
53
|
currentRow: p,
|
58
|
-
onSelectionChange:
|
59
|
-
onCurrentRowChange:
|
60
|
-
clearSelection:
|
61
|
-
toggleRowSelection:
|
62
|
-
toggleAllSelection:
|
63
|
-
getSelectionRows:
|
64
|
-
setCurrentRow:
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
54
|
+
onSelectionChange: m,
|
55
|
+
onCurrentRowChange: S,
|
56
|
+
clearSelection: b,
|
57
|
+
toggleRowSelection: C,
|
58
|
+
toggleAllSelection: d,
|
59
|
+
getSelectionRows: E,
|
60
|
+
setCurrentRow: T,
|
61
|
+
scrollToRow: A,
|
62
|
+
appendRow: D,
|
63
|
+
insertRow: G,
|
64
|
+
deleteRow: I,
|
65
|
+
updateRow: q,
|
66
|
+
moveUp: x,
|
67
|
+
moveDown: F,
|
68
|
+
moveTo: a,
|
72
69
|
selectionGroup: () => {
|
73
|
-
if (
|
70
|
+
if (r.value.length < 2)
|
74
71
|
return;
|
75
72
|
let e = 0, t = !0;
|
76
|
-
const
|
77
|
-
l.value.forEach((
|
78
|
-
|
79
|
-
if (
|
80
|
-
return t ? (e =
|
73
|
+
const c = [];
|
74
|
+
l.value.forEach((u, s) => {
|
75
|
+
r.value.forEach((O) => {
|
76
|
+
if (j(u, O))
|
77
|
+
return t ? (e = s, t = !1) : c.push(s), !1;
|
81
78
|
});
|
82
|
-
}),
|
83
|
-
|
79
|
+
}), c.forEach((u, s) => {
|
80
|
+
a(u, e + s + 1);
|
84
81
|
});
|
85
82
|
}
|
86
83
|
});
|
87
84
|
};
|
88
85
|
export {
|
89
|
-
|
86
|
+
J as default
|
90
87
|
};
|
91
88
|
//# sourceMappingURL=useEdittable.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useEdittable.js","sources":["../../../../src/components/Edittable/hooks/useEdittable.ts"],"sourcesContent":["import { reactive, ref } from 'vue'\r\nimport type { Ref, ShallowRef } from 'vue'\r\nimport OrionError from '../../../error/OrionError'\r\nimport type { EdittableInstance } from 'orion-design'\r\nimport { uuid } from '../../../utils'\r\nimport { isEqual, extend, isFunction } from 'lodash-es'\r\
|
1
|
+
{"version":3,"file":"useEdittable.js","sources":["../../../../src/components/Edittable/hooks/useEdittable.ts"],"sourcesContent":["import { nextTick, reactive, ref } from 'vue'\r\nimport type { Ref, ShallowRef } from 'vue'\r\nimport OrionError from '../../../error/OrionError'\r\nimport type { EdittableInstance } from 'orion-design'\r\nimport { uuid } from '../../../utils'\r\nimport { isEqual, extend, isFunction } from 'lodash-es'\r\nimport { createRowData } from '../utils'\r\n\r\ninterface UseEdittableOptions<Row> {\r\n tableRef?: Readonly<ShallowRef<EdittableInstance | null>>\r\n defaultData?: Row[]\r\n newRowTemplate?: Record<string, any> | (() => Record<string, any>)\r\n afterSelectionChange?: (newSelection: Row[]) => void\r\n afterCurrentRowChange?: (currentRow: Row, oldCurrentRow: Row) => void\r\n}\r\n\r\nconst useEdittable = <Row = any>(options: UseEdittableOptions<Row>) => {\r\n const { tableRef, defaultData, newRowTemplate, afterSelectionChange, afterCurrentRowChange } = options\r\n\r\n const data = ref<Row[]>(defaultData ? defaultData : []) as Ref<Row[]>\r\n const selection = ref<Row[]>([]) as Ref<Row[]>\r\n const currentRow = ref<Row>()\r\n\r\n const onSelectionChange = (newSelection: Row[]) => {\r\n selection.value = newSelection\r\n afterSelectionChange && afterSelectionChange(newSelection)\r\n }\r\n const onCurrentRowChange = (newCurrentRow: Row, oldCurrentRow: Row) => {\r\n currentRow.value = newCurrentRow\r\n afterCurrentRowChange && afterCurrentRowChange(newCurrentRow, oldCurrentRow)\r\n }\r\n\r\n const clearSelection = () => {\r\n if (!tableRef) {\r\n throw new OrionError(`调用clearSelection失败,tableRef为空`)\r\n }\r\n tableRef.value!.clearSelection()\r\n }\r\n const toggleRowSelection = (row: Row, selected?: boolean) => {\r\n if (!tableRef) {\r\n throw new OrionError(`调用toggleRowSelection失败,tableRef为空`)\r\n }\r\n tableRef.value!.toggleRowSelection(row, selected)\r\n }\r\n const toggleAllSelection = () => {\r\n if (!tableRef) {\r\n throw new OrionError(`调用toggleAllSelection失败,tableRef为空`)\r\n }\r\n tableRef.value!.toggleAllSelection()\r\n }\r\n const getSelectionRows = () => {\r\n if (!tableRef) {\r\n throw new OrionError(`调用getSelectionRows失败,tableRef为空`)\r\n }\r\n return tableRef.value!.getSelectionRows() as Row[]\r\n }\r\n const setCurrentRow = (row: Row) => {\r\n if (!tableRef) {\r\n throw new OrionError(`调用setCurrentRow失败,tableRef为空`)\r\n }\r\n tableRef.value!.setCurrentRow(row)\r\n }\r\n const scrollToRow = (index: number) => {\r\n if (!tableRef) {\r\n throw new OrionError(`调用scrollToRow失败,tableRef为空`)\r\n }\r\n tableRef.value!.scrollToRow(index)\r\n }\r\n\r\n const appendRow = (rowData: any) => {\r\n data.value.push(createRowData(newRowTemplate, rowData))\r\n }\r\n const insertRow = (rowData: any, index: number) => {\r\n data.value.splice(index, 0, createRowData(newRowTemplate, rowData))\r\n }\r\n const deleteRow = (index: number) => {\r\n data.value.splice(index, 1)\r\n }\r\n const updateRow = (rowData: any, index: number) => {\r\n data.value[index] = createRowData(newRowTemplate, rowData)\r\n }\r\n const moveUp = (index: number) => {\r\n moveTo(index, index - 1)\r\n }\r\n const moveDown = (index: number) => {\r\n moveTo(index, index + 1)\r\n }\r\n const moveTo = (from: number, to: number) => {\r\n const item = data.value.splice(from, 1)\r\n data.value.splice(to, 0, item[0])\r\n }\r\n const selectionGroup = () => {\r\n if (selection.value.length < 2) {\r\n return\r\n }\r\n\r\n let firstRowIndex: number = 0\r\n let firstRowFlag: boolean = true\r\n const leftRowIndexs: number[] = []\r\n\r\n data.value.forEach((e, i) => {\r\n selection.value.forEach((item) => {\r\n if (isEqual(e, item)) {\r\n if (firstRowFlag) {\r\n firstRowIndex = i\r\n firstRowFlag = false\r\n } else {\r\n leftRowIndexs.push(i)\r\n }\r\n return false\r\n }\r\n })\r\n })\r\n\r\n leftRowIndexs.forEach((e, i) => {\r\n moveTo(e, firstRowIndex + i + 1)\r\n })\r\n }\r\n\r\n return reactive({\r\n data,\r\n selection,\r\n currentRow,\r\n onSelectionChange,\r\n onCurrentRowChange,\r\n clearSelection,\r\n toggleRowSelection,\r\n toggleAllSelection,\r\n getSelectionRows,\r\n setCurrentRow,\r\n scrollToRow,\r\n appendRow,\r\n insertRow,\r\n deleteRow,\r\n updateRow,\r\n moveUp,\r\n moveDown,\r\n moveTo,\r\n selectionGroup,\r\n })\r\n}\r\n\r\nexport default useEdittable\r\n"],"names":["useEdittable","options","tableRef","defaultData","newRowTemplate","afterSelectionChange","afterCurrentRowChange","data","ref","selection","currentRow","onSelectionChange","newSelection","onCurrentRowChange","newCurrentRow","oldCurrentRow","clearSelection","OrionError","toggleRowSelection","row","selected","toggleAllSelection","getSelectionRows","setCurrentRow","scrollToRow","index","appendRow","rowData","createRowData","insertRow","deleteRow","updateRow","moveUp","moveTo","moveDown","from","to","item","reactive","firstRowIndex","firstRowFlag","leftRowIndexs","e","i","isEqual"],"mappings":";;;;AAgBM,MAAAA,IAAe,CAAYC,MAAsC;AACrE,QAAM,EAAE,UAAAC,GAAU,aAAAC,GAAa,gBAAAC,GAAgB,sBAAAC,GAAsB,uBAAAC,EAA0B,IAAAL,GAEzFM,IAAOC,EAAWL,KAA4B,CAAE,CAAA,GAChDM,IAAYD,EAAW,CAAA,CAAE,GACzBE,IAAaF,KAEbG,IAAoB,CAACC,MAAwB;AACjD,IAAAH,EAAU,QAAQG,GAClBP,KAAwBA,EAAqBO,CAAY;AAAA,EAAA,GAErDC,IAAqB,CAAC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