orion-design 1.0.2 → 1.0.4
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/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/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/request/leaf7/index.js +21 -21
- package/dist/request/leaf7/index.js.map +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
@@ -1,310 +0,0 @@
|
|
1
|
-
import { defineComponent as V, mergeModels as c, useModel as g, openBlock as m, createBlock as f, unref as i, withCtx as h, createElementBlock as C, Fragment as _, 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 k, 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__ */ V({
|
8
|
-
name: "OPasswordInput",
|
9
|
-
inheritAttrs: !1,
|
10
|
-
__name: "PasswordInput",
|
11
|
-
props: /* @__PURE__ */ c({
|
12
|
-
maxlength: {},
|
13
|
-
placeholder: {},
|
14
|
-
disabled: { type: Boolean },
|
15
|
-
readonly: { type: Boolean }
|
16
|
-
}, {
|
17
|
-
modelValue: {},
|
18
|
-
modelModifiers: {}
|
19
|
-
}),
|
20
|
-
emits: ["update:modelValue"],
|
21
|
-
setup(t) {
|
22
|
-
const s = g(t, "modelValue");
|
23
|
-
return (a, n) => (m(), f(i(k), {
|
24
|
-
modelValue: s.value,
|
25
|
-
"onUpdate:modelValue": n[0] || (n[0] = (e) => s.value = e),
|
26
|
-
maxlength: a.maxlength,
|
27
|
-
placeholder: a.placeholder,
|
28
|
-
disabled: a.disabled,
|
29
|
-
readonly: a.readonly,
|
30
|
-
type: "password"
|
31
|
-
}, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly"]));
|
32
|
-
}
|
33
|
-
}), ve = /* @__PURE__ */ V({
|
34
|
-
name: "OTextarea",
|
35
|
-
inheritAttrs: !1,
|
36
|
-
__name: "Textarea",
|
37
|
-
props: /* @__PURE__ */ c({
|
38
|
-
maxlength: {},
|
39
|
-
placeholder: {},
|
40
|
-
disabled: { type: Boolean },
|
41
|
-
readonly: { type: Boolean },
|
42
|
-
rows: {}
|
43
|
-
}, {
|
44
|
-
modelValue: {},
|
45
|
-
modelModifiers: {}
|
46
|
-
}),
|
47
|
-
emits: ["update:modelValue"],
|
48
|
-
setup(t) {
|
49
|
-
const s = g(t, "modelValue");
|
50
|
-
return (a, n) => (m(), f(i(k), {
|
51
|
-
modelValue: s.value,
|
52
|
-
"onUpdate:modelValue": n[0] || (n[0] = (e) => s.value = e),
|
53
|
-
maxlength: a.maxlength,
|
54
|
-
placeholder: a.placeholder,
|
55
|
-
disabled: a.disabled,
|
56
|
-
readonly: a.readonly,
|
57
|
-
type: "textarea",
|
58
|
-
rows: a.rows,
|
59
|
-
resize: "none"
|
60
|
-
}, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly", "rows"]));
|
61
|
-
}
|
62
|
-
}), he = /* @__PURE__ */ V({
|
63
|
-
name: "ORadioGroup",
|
64
|
-
inheritAttrs: !1,
|
65
|
-
__name: "RadioGroup",
|
66
|
-
props: /* @__PURE__ */ c({
|
67
|
-
disabled: { type: Boolean },
|
68
|
-
code: {}
|
69
|
-
}, {
|
70
|
-
modelValue: {},
|
71
|
-
modelModifiers: {}
|
72
|
-
}),
|
73
|
-
emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
|
74
|
-
setup(t, { emit: s }) {
|
75
|
-
const a = s, n = (d) => {
|
76
|
-
a("change", d);
|
77
|
-
}, e = g(t, "modelValue"), r = $();
|
78
|
-
return (d, o) => (m(), f(i(W), {
|
79
|
-
modelValue: e.value,
|
80
|
-
"onUpdate:modelValue": o[0] || (o[0] = (u) => e.value = u),
|
81
|
-
disabled: d.disabled,
|
82
|
-
onChange: n
|
83
|
-
}, {
|
84
|
-
default: h(() => [
|
85
|
-
(m(!0), C(_, null, M(i(r), (u) => (m(), f(i(X), {
|
86
|
-
key: u.value,
|
87
|
-
value: u.value
|
88
|
-
}, {
|
89
|
-
default: h(() => [
|
90
|
-
R(A(u.content), 1)
|
91
|
-
]),
|
92
|
-
_: 2
|
93
|
-
}, 1032, ["value"]))), 128))
|
94
|
-
]),
|
95
|
-
_: 1
|
96
|
-
}, 8, ["modelValue", "disabled"]));
|
97
|
-
}
|
98
|
-
}), Ve = /* @__PURE__ */ V({
|
99
|
-
name: "OCheckboxGroup",
|
100
|
-
inheritAttrs: !1,
|
101
|
-
__name: "CheckboxGroup",
|
102
|
-
props: /* @__PURE__ */ c({
|
103
|
-
disabled: { type: Boolean },
|
104
|
-
code: {}
|
105
|
-
}, {
|
106
|
-
modelValue: {},
|
107
|
-
modelModifiers: {}
|
108
|
-
}),
|
109
|
-
emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
|
110
|
-
setup(t, { emit: s }) {
|
111
|
-
const a = s, n = (o) => {
|
112
|
-
a("change", o.join(","));
|
113
|
-
}, e = g(t, "modelValue"), r = S({
|
114
|
-
get: () => {
|
115
|
-
if (e.value)
|
116
|
-
return e.value.split(",");
|
117
|
-
},
|
118
|
-
set: (o) => {
|
119
|
-
o ? e.value = o.join(",") : e.value = "";
|
120
|
-
}
|
121
|
-
}), d = $();
|
122
|
-
return (o, u) => (m(), f(i(Y), {
|
123
|
-
modelValue: r.value,
|
124
|
-
"onUpdate:modelValue": u[0] || (u[0] = (p) => r.value = p),
|
125
|
-
disabled: o.disabled,
|
126
|
-
onChange: n
|
127
|
-
}, {
|
128
|
-
default: h(() => [
|
129
|
-
(m(!0), C(_, null, M(i(d), (p) => (m(), f(i(Z), {
|
130
|
-
key: p.value,
|
131
|
-
label: p.content,
|
132
|
-
value: p.value
|
133
|
-
}, null, 8, ["label", "value"]))), 128))
|
134
|
-
]),
|
135
|
-
_: 1
|
136
|
-
}, 8, ["modelValue", "disabled"]));
|
137
|
-
}
|
138
|
-
}), ge = /* @__PURE__ */ V({
|
139
|
-
name: "OSwitch",
|
140
|
-
inheritAttrs: !1,
|
141
|
-
__name: "Switch",
|
142
|
-
props: /* @__PURE__ */ c({
|
143
|
-
disabled: { type: Boolean }
|
144
|
-
}, {
|
145
|
-
modelValue: {},
|
146
|
-
modelModifiers: {}
|
147
|
-
}),
|
148
|
-
emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
|
149
|
-
setup(t, { emit: s }) {
|
150
|
-
const a = s, n = (d) => {
|
151
|
-
a("change", d ? "1" : "0");
|
152
|
-
}, e = g(t, "modelValue"), r = S({
|
153
|
-
get: () => e.value ? e.value == "1" : !1,
|
154
|
-
set: (d) => {
|
155
|
-
const o = e.value, u = d ? "1" : "0";
|
156
|
-
(o || d) && (e.value = u);
|
157
|
-
}
|
158
|
-
});
|
159
|
-
return (d, o) => (m(), f(i(ee), {
|
160
|
-
modelValue: r.value,
|
161
|
-
"onUpdate:modelValue": o[0] || (o[0] = (u) => r.value = u),
|
162
|
-
disabled: d.disabled,
|
163
|
-
onChange: n
|
164
|
-
}, null, 8, ["modelValue", "disabled"]));
|
165
|
-
}
|
166
|
-
}), be = /* @__PURE__ */ V({
|
167
|
-
name: "OFileInput",
|
168
|
-
inheritAttrs: !1,
|
169
|
-
__name: "FileInput",
|
170
|
-
props: /* @__PURE__ */ c({
|
171
|
-
disabled: { type: Boolean }
|
172
|
-
}, {
|
173
|
-
modelValue: {},
|
174
|
-
modelModifiers: {}
|
175
|
-
}),
|
176
|
-
emits: ["update:modelValue"],
|
177
|
-
setup(t) {
|
178
|
-
const s = g(t, "modelValue");
|
179
|
-
T(s, () => {
|
180
|
-
s.value || (a.value = "");
|
181
|
-
});
|
182
|
-
const a = b(""), n = E("inputRef");
|
183
|
-
return U(() => {
|
184
|
-
n.value.input.onchange = (e) => {
|
185
|
-
var r;
|
186
|
-
s.value = (r = e == null ? void 0 : e.target) == null ? void 0 : r.files[0];
|
187
|
-
}, a.value = "";
|
188
|
-
}), (e, r) => (m(), f(i(k), {
|
189
|
-
ref: "inputRef",
|
190
|
-
modelValue: a.value,
|
191
|
-
"onUpdate:modelValue": r[0] || (r[0] = (d) => a.value = d),
|
192
|
-
disabled: e.disabled,
|
193
|
-
type: "file",
|
194
|
-
"validate-event": !1
|
195
|
-
}, null, 8, ["modelValue", "disabled"]));
|
196
|
-
}
|
197
|
-
}), ue = {
|
198
|
-
key: 0,
|
199
|
-
style: { position: "absolute", inset: "4px 30px 4px 4px", overflow: "hidden", pointerEvents: "none" }
|
200
|
-
}, ye = /* @__PURE__ */ V({
|
201
|
-
name: "OTableSelect",
|
202
|
-
inheritAttrs: !1,
|
203
|
-
__name: "TableSelect",
|
204
|
-
props: /* @__PURE__ */ c({
|
205
|
-
maxlength: {},
|
206
|
-
placeholder: {},
|
207
|
-
disabled: { type: Boolean },
|
208
|
-
readonly: { type: Boolean },
|
209
|
-
pick: {},
|
210
|
-
tag: { type: Function }
|
211
|
-
}, {
|
212
|
-
modelValue: {},
|
213
|
-
modelModifiers: {}
|
214
|
-
}),
|
215
|
-
emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
|
216
|
-
setup(t, { emit: s }) {
|
217
|
-
const a = s, n = g(t, "modelValue"), e = b(""), r = E("input"), d = b(!1), o = b(!1), u = b([]), p = E("dropdown"), v = b([]);
|
218
|
-
U(async () => {
|
219
|
-
y && (v.value = await y(n.value), v.value && (u.value = v.value.map((l) => t.tag(l))));
|
220
|
-
}), T(n, async () => {
|
221
|
-
d.value ? y && (v.value = await y(n.value), v.value && (u.value = v.value.map((l) => t.tag(l)))) : d.value = !0;
|
222
|
-
});
|
223
|
-
const F = (l) => {
|
224
|
-
o.value = l;
|
225
|
-
}, G = () => {
|
226
|
-
o.value || p.value.handleOpen();
|
227
|
-
}, P = () => {
|
228
|
-
r.value.focus();
|
229
|
-
}, D = (l) => {
|
230
|
-
o.value ? ["Enter", "Escape"].indexOf(l.code) > -1 ? p.value.handleClose() : l.code == "ArrowDown" ? l.stopPropagation() : l.code == "Tab" && (o.value = !1, p.value.handleClose()) : ["ArrowUp", "ArrowDown"].indexOf(l.code) > -1 && (p.value.handleOpen(), l.stopPropagation());
|
231
|
-
}, I = () => {
|
232
|
-
o.value ? r.value.focus() : e.value = "";
|
233
|
-
}, N = (l, x) => {
|
234
|
-
d.value = !1, n.value = l.map((w) => de(w, t.pick)), u.value = l.map((w) => t.tag(w)), x && (e.value = ""), a("change", l);
|
235
|
-
}, z = () => {
|
236
|
-
p.value.handleClose();
|
237
|
-
};
|
238
|
-
let y;
|
239
|
-
const j = (l) => {
|
240
|
-
y = l;
|
241
|
-
};
|
242
|
-
return K(
|
243
|
-
oe,
|
244
|
-
L({
|
245
|
-
inputValue: e,
|
246
|
-
selection: v,
|
247
|
-
onSelect: N,
|
248
|
-
selectDone: z,
|
249
|
-
tag: t.tag,
|
250
|
-
registerRowCompletionProvider: j
|
251
|
-
})
|
252
|
-
), (l, x) => {
|
253
|
-
const w = q("o-space");
|
254
|
-
return m(), f(i(le), {
|
255
|
-
ref: "dropdown",
|
256
|
-
trigger: "click",
|
257
|
-
onVisibleChange: F,
|
258
|
-
style: { width: "100%" }
|
259
|
-
}, {
|
260
|
-
dropdown: h(() => [
|
261
|
-
H(l.$slots, "default")
|
262
|
-
]),
|
263
|
-
default: h(() => [
|
264
|
-
J("div", {
|
265
|
-
onFocus: P,
|
266
|
-
style: { position: "relative", width: "100%", height: "100%" }
|
267
|
-
}, [
|
268
|
-
O(i(k), {
|
269
|
-
ref: "input",
|
270
|
-
modelValue: e.value,
|
271
|
-
"onUpdate:modelValue": x[0] || (x[0] = (B) => e.value = B),
|
272
|
-
maxlength: l.maxlength,
|
273
|
-
placeholder: l.placeholder,
|
274
|
-
disabled: l.disabled,
|
275
|
-
readonly: l.readonly,
|
276
|
-
onInput: G,
|
277
|
-
onKeydown: D,
|
278
|
-
onBlur: I,
|
279
|
-
"suffix-icon": o.value ? i(te) : i(ne)
|
280
|
-
}, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly", "suffix-icon"]),
|
281
|
-
o.value ? Q("", !0) : (m(), C("div", ue, [
|
282
|
-
O(w, null, {
|
283
|
-
default: h(() => [
|
284
|
-
(m(!0), C(_, null, M(u.value, (B) => (m(), f(i(ae), { type: "info" }, {
|
285
|
-
default: h(() => [
|
286
|
-
R(A(B), 1)
|
287
|
-
]),
|
288
|
-
_: 2
|
289
|
-
}, 1024))), 256))
|
290
|
-
]),
|
291
|
-
_: 1
|
292
|
-
})
|
293
|
-
]))
|
294
|
-
], 32)
|
295
|
-
]),
|
296
|
-
_: 3
|
297
|
-
}, 512);
|
298
|
-
};
|
299
|
-
}
|
300
|
-
});
|
301
|
-
export {
|
302
|
-
fe as _,
|
303
|
-
ve as a,
|
304
|
-
he as b,
|
305
|
-
Ve as c,
|
306
|
-
ge as d,
|
307
|
-
be as e,
|
308
|
-
ye as f
|
309
|
-
};
|
310
|
-
//# sourceMappingURL=TableSelect.vue_vue_type_script_setup_true_lang-0WMTwNxX.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TableSelect.vue_vue_type_script_setup_true_lang-0WMTwNxX.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\" :readonly=\"readonly\"\r\n type=\"password\" />\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\n\r\nconst { maxlength, placeholder, disabled, readonly } = 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\" :readonly=\"readonly\"\r\n type=\"textarea\" :rows=\"rows\" :resize=\"'none'\" />\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\n\r\nconst { maxlength, placeholder, disabled, readonly, 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\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\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 model.value = event?.target?.files[0]\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 :readonly=\"readonly\" @input=\"onInput\" @keydown=\"onKeydown\" @blur=\"onBlur\"\r\n :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, readonly, 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":["model","_useModel","__props","emit","__emit","onChange","value","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":";;;;;;;;;;;;;;;;;;;;;AAaM,UAAAA,IAAQC,EAAoB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