orion-design 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/dist/LovInput.vue_vue_type_script_setup_true_lang-QrvjS12n.js +401 -0
  2. package/dist/LovInput.vue_vue_type_script_setup_true_lang-QrvjS12n.js.map +1 -0
  3. package/dist/TableSelect.vue_vue_type_script_setup_true_lang-DmAuOipe.js +313 -0
  4. package/dist/TableSelect.vue_vue_type_script_setup_true_lang-DmAuOipe.js.map +1 -0
  5. package/dist/components/Edittable/Edittable.d.ts +9 -2
  6. package/dist/components/Edittable/hooks/useEdittable.d.ts +2 -1
  7. package/dist/components/Edittable/hooks/useEdittable.js +60 -63
  8. package/dist/components/Edittable/hooks/useEdittable.js.map +1 -1
  9. package/dist/components/Edittable/index.d.ts +5 -0
  10. package/dist/components/Edittable/index.js +360 -324
  11. package/dist/components/Edittable/index.js.map +1 -1
  12. package/dist/components/Edittable/utils/index.d.ts +2 -0
  13. package/dist/components/Edittable/utils/index.js +47 -37
  14. package/dist/components/Edittable/utils/index.js.map +1 -1
  15. package/dist/components/Form/LovInput/LovInput.vue.d.ts +7 -1
  16. package/dist/components/Form/index.js +371 -377
  17. package/dist/components/Form/index.js.map +1 -1
  18. package/dist/components/Input/DateInput/DateInput.d.ts +0 -1
  19. package/dist/components/Input/DateInput/DateInput.vue.d.ts +3 -0
  20. package/dist/components/Input/FileInput/FileInput.vue.d.ts +6 -3
  21. package/dist/components/Input/LovInput/LovInput.d.ts +0 -1
  22. package/dist/components/Input/LovInput/LovInput.js.map +1 -1
  23. package/dist/components/Input/LovInput/LovInput.vue.d.ts +6 -6
  24. package/dist/components/Input/NumberInput/NumberInput.d.ts +0 -1
  25. package/dist/components/Input/NumberInput/NumberInput.vue.d.ts +3 -0
  26. package/dist/components/Input/PasswordInput/PasswordInput.d.ts +0 -1
  27. package/dist/components/Input/PasswordInput/PasswordInput.vue.d.ts +3 -0
  28. package/dist/components/Input/StringInput/StringInput.d.ts +0 -1
  29. package/dist/components/Input/StringInput/StringInput.vue.d.ts +3 -0
  30. package/dist/components/Input/TableSelect/TableSelect.d.ts +0 -1
  31. package/dist/components/Input/TableSelect/TableSelect.js.map +1 -1
  32. package/dist/components/Input/TableSelect/TableSelect.vue.d.ts +6 -6
  33. package/dist/components/Input/Textarea/Textarea.d.ts +0 -1
  34. package/dist/components/Input/Textarea/Textarea.vue.d.ts +3 -0
  35. package/dist/components/Input/index.d.ts +35 -9
  36. package/dist/components/Input/index.js +2 -2
  37. package/dist/version/version.d.ts +1 -1
  38. package/dist/version/version.js +1 -1
  39. package/dist/version/version.js.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/LovInput.vue_vue_type_script_setup_true_lang-C__ELopU.js +0 -400
  42. package/dist/LovInput.vue_vue_type_script_setup_true_lang-C__ELopU.js.map +0 -1
  43. package/dist/TableSelect.vue_vue_type_script_setup_true_lang-0WMTwNxX.js +0 -310
  44. package/dist/TableSelect.vue_vue_type_script_setup_true_lang-0WMTwNxX.js.map +0 -1
@@ -0,0 +1,401 @@
1
+ import { defineComponent as y, mergeModels as c, useSlots as A, useModel as V, openBlock as f, createBlock as h, unref as d, createSlots as D, withCtx as v, renderSlot as b, computed as g, createElementBlock as T, Fragment as E, renderList as U, ref as B, useTemplateRef as S, provide as P, reactive as j, createVNode as N } from "vue";
2
+ import { ElInput as O, ElSelect as Y, ElOption as x, dayjs as w, ElTimePicker as L, ElDatePicker as R, ElInputNumber as W, ElCheckbox as z, ElDropdown as K } from "element-plus";
3
+ import { useInputCode as I } from "./components/Input/hooks/index.js";
4
+ import { getSingleCodeContent as G, getMultiCodeContent as q } from "./components/Input/utils/index.js";
5
+ import $ from "./error/OrionError.js";
6
+ import { isDate as J, isString as Q, toNumber as X } from "lodash-es";
7
+ import { lovContextKey as Z } from "./components/Input/LovInput/LovInput.js";
8
+ import { cG as _ } from "./index-CIR6wX_E.js";
9
+ const ie = /* @__PURE__ */ y({
10
+ name: "OStringInput",
11
+ inheritAttrs: !1,
12
+ __name: "StringInput",
13
+ props: /* @__PURE__ */ c({
14
+ maxlength: {},
15
+ placeholder: {},
16
+ disabled: { type: Boolean }
17
+ }, {
18
+ modelValue: {},
19
+ modelModifiers: {}
20
+ }),
21
+ emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
22
+ setup(a, { emit: p }) {
23
+ const s = A(), u = p, o = (n) => {
24
+ u("change", n);
25
+ }, r = V(a, "modelValue");
26
+ return (n, e) => (f(), h(d(O), {
27
+ modelValue: r.value,
28
+ "onUpdate:modelValue": e[0] || (e[0] = (t) => r.value = t),
29
+ maxlength: n.maxlength,
30
+ placeholder: n.placeholder,
31
+ disabled: n.disabled,
32
+ onChange: o
33
+ }, D({ _: 2 }, [
34
+ d(s).prefix ? {
35
+ name: "prefix",
36
+ fn: v(() => [
37
+ b(n.$slots, "prefix")
38
+ ]),
39
+ key: "0"
40
+ } : void 0,
41
+ d(s).suffix ? {
42
+ name: "suffix",
43
+ fn: v(() => [
44
+ b(n.$slots, "suffix")
45
+ ]),
46
+ key: "1"
47
+ } : void 0,
48
+ d(s).prepend ? {
49
+ name: "prepend",
50
+ fn: v(() => [
51
+ b(n.$slots, "prepend")
52
+ ]),
53
+ key: "2"
54
+ } : void 0,
55
+ d(s).append ? {
56
+ name: "append",
57
+ fn: v(() => [
58
+ b(n.$slots, "append")
59
+ ]),
60
+ key: "3"
61
+ } : void 0
62
+ ]), 1032, ["modelValue", "maxlength", "placeholder", "disabled"]));
63
+ }
64
+ }), ue = /* @__PURE__ */ y({
65
+ name: "OSingleSelect",
66
+ inheritAttrs: !1,
67
+ __name: "SingleSelect",
68
+ props: /* @__PURE__ */ c({
69
+ placeholder: {},
70
+ disabled: { type: Boolean },
71
+ code: {},
72
+ clearable: { type: Boolean },
73
+ filterable: { type: Boolean }
74
+ }, {
75
+ modelValue: {},
76
+ modelModifiers: {}
77
+ }),
78
+ emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
79
+ setup(a, { emit: p }) {
80
+ const s = p, u = (e) => {
81
+ s("change", e);
82
+ }, o = V(a, "modelValue"), r = I(), n = g(() => o.value ? G(r.value, o.value) : null);
83
+ return (e, t) => e.disabled ? (f(), h(d(O), {
84
+ key: 0,
85
+ "model-value": n.value,
86
+ placeholder: e.placeholder,
87
+ disabled: !0,
88
+ readonly: !0
89
+ }, null, 8, ["model-value", "placeholder"])) : (f(), h(d(Y), {
90
+ key: 1,
91
+ modelValue: o.value,
92
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => o.value = l),
93
+ placeholder: e.placeholder,
94
+ clearable: e.clearable,
95
+ filterable: e.filterable,
96
+ onChange: u
97
+ }, {
98
+ default: v(() => [
99
+ (f(!0), T(E, null, U(d(r), (l) => (f(), h(d(x), {
100
+ key: l.value,
101
+ label: l.content,
102
+ value: l.value
103
+ }, null, 8, ["label", "value"]))), 128))
104
+ ]),
105
+ _: 1
106
+ }, 8, ["modelValue", "placeholder", "clearable", "filterable"]));
107
+ }
108
+ }), me = /* @__PURE__ */ y({
109
+ name: "OMultiSelect",
110
+ inheritAttrs: !1,
111
+ __name: "MultiSelect",
112
+ props: /* @__PURE__ */ c({
113
+ placeholder: {},
114
+ disabled: { type: Boolean },
115
+ code: {},
116
+ collapseTags: { type: Boolean },
117
+ collapseTagsTooltip: { type: Boolean }
118
+ }, {
119
+ modelValue: {},
120
+ modelModifiers: {}
121
+ }),
122
+ emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
123
+ setup(a, { emit: p }) {
124
+ const s = p, u = (t) => {
125
+ s("change", t.join(","));
126
+ }, o = V(a, "modelValue"), r = g({
127
+ get: () => {
128
+ if (o.value)
129
+ return o.value.split(",");
130
+ },
131
+ set: (t) => {
132
+ t ? o.value = t.join(",") : o.value = "";
133
+ }
134
+ }), n = I(), e = g(() => o.value ? q(n.value, o.value) : null);
135
+ return (t, l) => t.disabled ? (f(), h(d(O), {
136
+ key: 0,
137
+ "model-value": e.value,
138
+ placeholder: t.placeholder,
139
+ disabled: !0,
140
+ readonly: !0
141
+ }, null, 8, ["model-value", "placeholder"])) : (f(), h(d(Y), {
142
+ key: 1,
143
+ modelValue: r.value,
144
+ "onUpdate:modelValue": l[0] || (l[0] = (m) => r.value = m),
145
+ placeholder: t.placeholder,
146
+ multiple: "",
147
+ "collapse-tags": t.collapseTags,
148
+ "collapse-tags-tooltip": t.collapseTagsTooltip,
149
+ onChange: u
150
+ }, {
151
+ default: v(() => [
152
+ (f(!0), T(E, null, U(d(n), (m) => (f(), h(d(x), {
153
+ key: m.value,
154
+ label: m.content,
155
+ value: m.value
156
+ }, null, 8, ["label", "value"]))), 128))
157
+ ]),
158
+ _: 1
159
+ }, 8, ["modelValue", "placeholder", "collapse-tags", "collapse-tags-tooltip"]));
160
+ }
161
+ }), fe = /* @__PURE__ */ y({
162
+ name: "ODateInput",
163
+ inheritAttrs: !1,
164
+ __name: "DateInput",
165
+ props: /* @__PURE__ */ c({
166
+ maxlength: {},
167
+ placeholder: {},
168
+ disabled: { type: Boolean },
169
+ editable: { type: Boolean, default: !0 },
170
+ clearable: { type: Boolean, default: !0 },
171
+ format: { default: "YYYY-MM-DD" },
172
+ sourceFormat: {}
173
+ }, {
174
+ modelValue: {},
175
+ modelModifiers: {}
176
+ }),
177
+ emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
178
+ setup(a, { emit: p }) {
179
+ const s = p, u = (l) => {
180
+ a.sourceFormat ? s("change", w(l).format(r.value)) : s("change", l);
181
+ }, o = g(() => a.format.startsWith("H") || a.format.startsWith("h") || a.format.startsWith("m") || a.format.startsWith("s")), r = g(() => a.sourceFormat ? a.sourceFormat : o.value ? "HH:mm:ss" : "YYYY-MM-DD"), n = g(() => {
182
+ let l = "date";
183
+ return (a.format.indexOf("y") > -1 || a.format.indexOf("Y") > -1) && (l = "year"), a.format.indexOf("M") > -1 && (l = "month"), (a.format.indexOf("d") > -1 || a.format.indexOf("D") > -1) && (l = "date"), (a.format.indexOf("H") > -1 || a.format.indexOf("h") > -1 || a.format.indexOf("k") > -1 || a.format.indexOf("m") > -1 || a.format.indexOf("s") > -1 || a.format.indexOf("S") > -1) && (l = "datetime"), l;
184
+ }), e = V(a, "modelValue"), t = g({
185
+ get: () => {
186
+ if (e.value) {
187
+ if (J(e.value))
188
+ return e.value;
189
+ if (Q(e.value)) {
190
+ const l = w(e.value, r.value, !0);
191
+ if (!l.isValid())
192
+ throw new $(`日期输入框的值无效,不符合${r.value}格式`);
193
+ return l.toDate();
194
+ } else
195
+ throw new $("日期输入框的值只能为字符串或日期类型");
196
+ }
197
+ },
198
+ set: (l) => {
199
+ a.sourceFormat ? l ? e.value = w(l).format(r.value) : e.value = "" : l ? e.value = l : e.value = void 0;
200
+ }
201
+ });
202
+ return (l, m) => o.value ? (f(), h(d(L), {
203
+ key: 0,
204
+ modelValue: t.value,
205
+ "onUpdate:modelValue": m[0] || (m[0] = (k) => t.value = k),
206
+ placeholder: l.placeholder,
207
+ disabled: l.disabled,
208
+ editable: l.editable,
209
+ clearable: l.clearable,
210
+ format: l.format,
211
+ "arrow-control": "",
212
+ style: { width: "100%" },
213
+ onChange: u
214
+ }, null, 8, ["modelValue", "placeholder", "disabled", "editable", "clearable", "format"])) : (f(), h(d(R), {
215
+ key: 1,
216
+ modelValue: t.value,
217
+ "onUpdate:modelValue": m[1] || (m[1] = (k) => t.value = k),
218
+ placeholder: l.placeholder,
219
+ disabled: l.disabled,
220
+ editable: l.editable,
221
+ clearable: l.clearable,
222
+ type: n.value,
223
+ format: l.format,
224
+ style: { width: "100%" },
225
+ onChange: u
226
+ }, null, 8, ["modelValue", "placeholder", "disabled", "editable", "clearable", "type", "format"]));
227
+ }
228
+ }), ce = /* @__PURE__ */ y({
229
+ name: "ONumberInput",
230
+ inheritAttrs: !1,
231
+ __name: "NumberInput",
232
+ props: /* @__PURE__ */ c({
233
+ placeholder: {},
234
+ disabled: { type: Boolean },
235
+ min: {},
236
+ max: {},
237
+ step: {},
238
+ stepStrictly: { type: Boolean },
239
+ precision: {},
240
+ controls: { type: Boolean, default: !0 },
241
+ controlsPosition: {}
242
+ }, {
243
+ modelValue: {},
244
+ modelModifiers: {}
245
+ }),
246
+ emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
247
+ setup(a, { emit: p }) {
248
+ const s = A(), u = p, o = (e) => {
249
+ u("change", e);
250
+ }, r = V(a, "modelValue"), n = g({
251
+ get: () => X(r.value),
252
+ set: (e) => {
253
+ r.value = e;
254
+ }
255
+ });
256
+ return (e, t) => (f(), h(d(W), {
257
+ modelValue: n.value,
258
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => n.value = l),
259
+ placeholder: e.placeholder,
260
+ disabled: e.disabled,
261
+ min: e.min,
262
+ max: e.max,
263
+ step: e.step,
264
+ "step-strictly": e.stepStrictly,
265
+ precision: e.precision,
266
+ controls: e.controls,
267
+ "controls-position": e.controlsPosition,
268
+ style: { width: "100%" },
269
+ onChange: o
270
+ }, D({ _: 2 }, [
271
+ d(s)["decrease-icon"] ? {
272
+ name: "decrease-icon",
273
+ fn: v(() => [
274
+ b(e.$slots, "decrease-icon")
275
+ ]),
276
+ key: "0"
277
+ } : void 0,
278
+ d(s)["increase-icon"] ? {
279
+ name: "increase-icon",
280
+ fn: v(() => [
281
+ b(e.$slots, "increase-icon")
282
+ ]),
283
+ key: "1"
284
+ } : void 0,
285
+ d(s).prefix ? {
286
+ name: "prefix",
287
+ fn: v(() => [
288
+ b(e.$slots, "prefix")
289
+ ]),
290
+ key: "2"
291
+ } : void 0,
292
+ d(s).suffix ? {
293
+ name: "suffix",
294
+ fn: v(() => [
295
+ b(e.$slots, "suffix")
296
+ ]),
297
+ key: "3"
298
+ } : void 0
299
+ ]), 1032, ["modelValue", "placeholder", "disabled", "min", "max", "step", "step-strictly", "precision", "controls", "controls-position"]));
300
+ }
301
+ }), pe = /* @__PURE__ */ y({
302
+ name: "OCheckbox",
303
+ inheritAttrs: !1,
304
+ __name: "Checkbox",
305
+ props: /* @__PURE__ */ c({
306
+ disabled: { type: Boolean }
307
+ }, {
308
+ modelValue: {},
309
+ modelModifiers: {}
310
+ }),
311
+ emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
312
+ setup(a, { emit: p }) {
313
+ const s = p, u = (n) => {
314
+ s("change", n ? "1" : "0");
315
+ }, o = V(a, "modelValue"), r = g({
316
+ get: () => o.value ? o.value == "1" : !1,
317
+ set: (n) => {
318
+ const e = o.value, t = n ? "1" : "0";
319
+ (e || n) && (o.value = t);
320
+ }
321
+ });
322
+ return (n, e) => (f(), h(d(z), {
323
+ modelValue: r.value,
324
+ "onUpdate:modelValue": e[0] || (e[0] = (t) => r.value = t),
325
+ disabled: n.disabled,
326
+ onChange: u
327
+ }, null, 8, ["modelValue", "disabled"]));
328
+ }
329
+ }), ve = /* @__PURE__ */ y({
330
+ name: "OLovInput",
331
+ inheritAttrs: !1,
332
+ __name: "LovInput",
333
+ props: /* @__PURE__ */ c({
334
+ maxlength: {},
335
+ placeholder: {},
336
+ disabled: { type: Boolean }
337
+ }, {
338
+ modelValue: {},
339
+ modelModifiers: {}
340
+ }),
341
+ emits: /* @__PURE__ */ c(["select", "clear"], ["update:modelValue"]),
342
+ setup(a, { emit: p }) {
343
+ const s = p, u = V(a, "modelValue"), o = B(!1), r = B(!1), n = S("input"), e = S("dropdown"), t = (i) => {
344
+ o.value = i;
345
+ }, l = () => {
346
+ r.value || (r.value = !0), o.value || e.value.handleOpen();
347
+ };
348
+ let m;
349
+ const k = (i) => {
350
+ m = i;
351
+ }, F = (i) => {
352
+ ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Enter", "Space"].indexOf(i.code) > -1 && (o.value && m && m(i.code), i.stopPropagation()), ["ArrowUp", "ArrowDown"].indexOf(i.code) > -1 && !o.value && e.value.handleOpen();
353
+ }, H = async (i) => {
354
+ o.value && n.value.focus(), !(i.relatedTarget && i.relatedTarget.closest(".el-popper")) && r.value && s("clear");
355
+ };
356
+ return P(
357
+ Z,
358
+ j({
359
+ lovValue: u,
360
+ backfill: (i) => {
361
+ e.value.handleClose(), s("select", i), r.value && (r.value = !1);
362
+ },
363
+ registerKeydownHandler: k
364
+ })
365
+ ), (i, C) => (f(), h(d(K), {
366
+ ref: "dropdown",
367
+ trigger: "click",
368
+ onVisibleChange: t,
369
+ style: { width: "100%" }
370
+ }, {
371
+ dropdown: v(() => [
372
+ b(i.$slots, "default")
373
+ ]),
374
+ default: v(() => [
375
+ N(d(O), {
376
+ ref: "input",
377
+ modelValue: u.value,
378
+ "onUpdate:modelValue": C[0] || (C[0] = (M) => u.value = M),
379
+ maxlength: i.maxlength,
380
+ placeholder: i.placeholder,
381
+ disabled: i.disabled,
382
+ onInput: l,
383
+ onKeydown: F,
384
+ onBlur: H,
385
+ "suffix-icon": d(_)
386
+ }, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "suffix-icon"])
387
+ ]),
388
+ _: 3
389
+ }, 512));
390
+ }
391
+ });
392
+ export {
393
+ ie as _,
394
+ ue as a,
395
+ me as b,
396
+ pe as c,
397
+ fe as d,
398
+ ve as e,
399
+ ce as f
400
+ };
401
+ //# sourceMappingURL=LovInput.vue_vue_type_script_setup_true_lang-QrvjS12n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LovInput.vue_vue_type_script_setup_true_lang-QrvjS12n.js","sources":["../src/components/Input/StringInput/StringInput.vue","../src/components/Input/SingleSelect/SingleSelect.vue","../src/components/Input/MultiSelect/MultiSelect.vue","../src/components/Input/DateInput/DateInput.vue","../src/components/Input/NumberInput/NumberInput.vue","../src/components/Input/Checkbox/Checkbox.vue","../src/components/Input/LovInput/LovInput.vue"],"sourcesContent":["<template>\r\n <el-input v-model=\"model\" :maxlength=\"maxlength\" :placeholder=\"placeholder\" :disabled=\"disabled\" @change=\"onChange\">\r\n <template v-if=\"slots.prefix\" #prefix>\r\n <slot name=\"prefix\"></slot>\r\n </template>\r\n <template v-if=\"slots.suffix\" #suffix>\r\n <slot name=\"suffix\"></slot>\r\n </template>\r\n <template v-if=\"slots.prepend\" #prepend>\r\n <slot name=\"prepend\"></slot>\r\n </template>\r\n <template v-if=\"slots.append\" #append>\r\n <slot name=\"append\"></slot>\r\n </template>\r\n </el-input>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { StringInputProps } from './StringInput'\r\nimport { ElInput } from 'element-plus'\r\nimport { useSlots } from 'vue'\r\n\r\ndefineOptions({ name: 'OStringInput', inheritAttrs: false })\r\nconst slots = useSlots()\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<StringInputProps>()\r\n\r\nconst model = defineModel<string>()\r\n</script>\r\n","<template>\r\n <el-input v-if=\"disabled\" :model-value=\"content\" :placeholder=\"placeholder\" :disabled=\"true\" :readonly=\"true\" />\r\n <el-select v-else v-model=\"model\" :placeholder=\"placeholder\" :clearable=\"clearable\" :filterable=\"filterable\"\r\n @change=\"onChange\">\r\n <el-option v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :label=\"codeItem.content\"\r\n :value=\"codeItem.value\" />\r\n </el-select>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { SingleSelectProps } from './SingleSelect'\r\nimport { useInputCode } from '../hooks'\r\nimport { getSingleCodeContent } from '../utils'\r\nimport { ElInput, ElSelect, ElOption } from 'element-plus'\r\nimport { computed } from 'vue'\r\n\r\ndefineOptions({ name: 'OSingleSelect', 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 { placeholder, disabled, clearable, filterable } = defineProps<SingleSelectProps>()\r\n\r\nconst model = defineModel<string>()\r\nconst normalizedCode = useInputCode()\r\nconst content = computed(() => model.value ? getSingleCodeContent(normalizedCode.value, model.value) : null)\r\n</script>\r\n","<template>\r\n <el-input v-if=\"disabled\" :model-value=\"content\" :placeholder=\"placeholder\" :disabled=\"true\" :readonly=\"true\" />\r\n <el-select v-else v-model=\"elModel\" :placeholder=\"placeholder\" multiple :collapse-tags=\"collapseTags\"\r\n :collapse-tags-tooltip=\"collapseTagsTooltip\" @change=\"onChange\">\r\n <el-option v-for=\"codeItem in normalizedCode\" :key=\"codeItem.value\" :label=\"codeItem.content\"\r\n :value=\"codeItem.value\" />\r\n </el-select>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { MultiSelectProps } from './MultiSelect'\r\nimport { useInputCode } from '../hooks'\r\nimport { getMultiCodeContent } from '../utils'\r\nimport { ElInput, ElSelect, ElOption } from 'element-plus'\r\nimport { computed } from 'vue'\r\n\r\ndefineOptions({ name: 'OMultiSelect', 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 { placeholder, disabled, collapseTags, collapseTagsTooltip } = defineProps<MultiSelectProps>()\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\nconst content = computed(() => model.value ? getMultiCodeContent(normalizedCode.value, model.value) : null)\r\n</script>\r\n","<template>\r\n <el-time-picker v-if=\"isTimePicker\" v-model=\"elModel\" :placeholder=\"placeholder\" :disabled=\"disabled\"\r\n :editable=\"editable\" :clearable=\"clearable\" :format=\"format\" arrow-control style=\"width: 100%\" @change=\"onChange\" />\r\n <el-date-picker v-else v-model=\"elModel\" :placeholder=\"placeholder\" :disabled=\"disabled\" :editable=\"editable\"\r\n :clearable=\"clearable\" :type=\"dateType\" :format=\"format\" style=\"width: 100%\" @change=\"onChange\" />\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { DateInputProps } from './DateInput'\r\nimport OrionError from '../../../error/OrionError'\r\nimport { ElDatePicker, ElTimePicker, dayjs } from 'element-plus'\r\nimport { computed } from 'vue'\r\nimport { isDate, isString } from 'lodash-es'\r\n\r\ndefineOptions({ name: 'ODateInput', inheritAttrs: false })\r\nconst emit = defineEmits<{\r\n (e: 'change', value: Date | string): void\r\n}>()\r\nconst onChange = (value: Date) => {\r\n if (sourceFormat) {\r\n emit('change', dayjs(value).format(normalizedSourceFormat.value))\r\n } else {\r\n emit('change', value)\r\n }\r\n}\r\n\r\nconst {\r\n placeholder,\r\n disabled,\r\n // readonly,\r\n editable = true,\r\n clearable = true,\r\n format = 'YYYY-MM-DD',\r\n sourceFormat,\r\n} = defineProps<DateInputProps>()\r\n\r\nconst isTimePicker = computed(() => format.startsWith('H') || format.startsWith('h') || format.startsWith('m') || format.startsWith('s'))\r\n\r\nconst normalizedSourceFormat = computed(() => {\r\n if (sourceFormat) {\r\n return sourceFormat\r\n }\r\n if (isTimePicker.value) {\r\n return 'HH:mm:ss'\r\n } else {\r\n return 'YYYY-MM-DD'\r\n }\r\n})\r\n\r\nconst dateType = computed(() => {\r\n let picker: 'date' | 'year' | 'month' | 'datetime' = 'date'\r\n\r\n // 配置年 yyyy指年 YYYY指周年,年末年初的值可能有所变化\r\n if (format.indexOf('y') > -1 || format.indexOf('Y') > -1) {\r\n picker = 'year'\r\n }\r\n\r\n // 配置月,M指月份,m指分钟\r\n if (format.indexOf('M') > -1) {\r\n picker = 'month'\r\n }\r\n\r\n // 配置日,d指星期,D指月的天,DDD指年的天\r\n if (format.indexOf('d') > -1 || format.indexOf('D') > -1) {\r\n picker = 'date'\r\n }\r\n\r\n // 配置小时,H指24小时制(0~23),k指24小时制(1~24),h指12小时制,m指分钟,s指秒,S指小数秒\r\n if (\r\n format.indexOf('H') > -1 ||\r\n format.indexOf('h') > -1 ||\r\n format.indexOf('k') > -1 ||\r\n format.indexOf('m') > -1 ||\r\n format.indexOf('s') > -1 ||\r\n format.indexOf('S') > -1\r\n ) {\r\n picker = 'datetime'\r\n }\r\n\r\n return picker\r\n})\r\n\r\nconst model = defineModel<Date | string>()\r\nconst elModel = computed<Date | undefined>({\r\n get: () => {\r\n if (!model.value) {\r\n return undefined\r\n }\r\n if (isDate(model.value)) {\r\n return model.value as Date\r\n } else if (isString(model.value)) {\r\n const dayjsObj = dayjs(model.value, normalizedSourceFormat.value, true)\r\n if (!dayjsObj.isValid()) {\r\n throw new OrionError(`日期输入框的值无效,不符合${normalizedSourceFormat.value}格式`)\r\n }\r\n return dayjsObj.toDate()\r\n } else {\r\n throw new OrionError('日期输入框的值只能为字符串或日期类型')\r\n }\r\n },\r\n set: (newValue) => {\r\n if (sourceFormat) {\r\n if (!newValue) {\r\n model.value = ''\r\n } else {\r\n model.value = dayjs(newValue).format(normalizedSourceFormat.value)\r\n }\r\n } else {\r\n if (!newValue) {\r\n model.value = undefined\r\n } else {\r\n model.value = newValue\r\n }\r\n }\r\n },\r\n})\r\n</script>\r\n","<template>\r\n <el-input-number v-model=\"elModel\" :placeholder=\"placeholder\" :disabled=\"disabled\" :min=\"min\" :max=\"max\" :step=\"step\"\r\n :step-strictly=\"stepStrictly\" :precision=\"precision\" :controls=\"controls\" :controls-position=\"controlsPosition\"\r\n style=\"width: 100%\" @change=\"onChange\">\r\n <template v-if=\"slots['decrease-icon']\" #decrease-icon>\r\n <slot name=\"decrease-icon\"></slot>\r\n </template>\r\n <template v-if=\"slots['increase-icon']\" #increase-icon>\r\n <slot name=\"increase-icon\"></slot>\r\n </template>\r\n <template v-if=\"slots['prefix']\" #prefix>\r\n <slot name=\"prefix\"></slot>\r\n </template>\r\n <template v-if=\"slots['suffix']\" #suffix>\r\n <slot name=\"suffix\"></slot>\r\n </template>\r\n </el-input-number>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { NumberInputProps } from './NumberInput'\r\nimport { ElInputNumber } from 'element-plus'\r\nimport { computed, useSlots } from 'vue'\r\nimport { toNumber } from 'lodash-es'\r\n\r\ndefineOptions({ name: 'ONumberInput', inheritAttrs: false })\r\nconst slots = useSlots()\r\nconst emit = defineEmits<{\r\n (e: 'change', value: number | undefined): void\r\n}>()\r\nconst onChange = (value: number | undefined) => {\r\n emit('change', value)\r\n}\r\n\r\nconst {\r\n placeholder,\r\n disabled,\r\n min,\r\n max,\r\n step,\r\n stepStrictly,\r\n precision,\r\n controls = true,\r\n controlsPosition,\r\n} = defineProps<NumberInputProps>()\r\n\r\nconst model = defineModel<number>()\r\nconst elModel = computed<number | undefined>({\r\n get: () => {\r\n return toNumber(model.value)\r\n },\r\n set: (newValue) => {\r\n model.value = newValue\r\n },\r\n})\r\n</script>\r\n","<template>\r\n <el-checkbox v-model=\"elModel\" :disabled=\"disabled\" @change=\"onChange\"></el-checkbox>\r\n</template>\r\n\r\n<script setup lang=\"ts\">\r\nimport type { CheckboxProps } from './Checkbox'\r\nimport { ElCheckbox } from 'element-plus'\r\nimport { computed } from 'vue'\r\n\r\ndefineOptions({ name: 'OCheckbox', 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<CheckboxProps>()\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-dropdown ref=\"dropdown\" :trigger=\"'click'\" @visible-change=\"onVisibleChange\" style=\"width: 100%\">\r\n <el-input ref=\"input\" v-model=\"model\" :maxlength=\"maxlength\" :placeholder=\"placeholder\" :disabled=\"disabled\"\r\n @input=\"onInput\" @keydown=\"onKeydown\" @blur=\"onBlur\" :suffix-icon=\"Search\" />\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 { KeydownHandler, LovContext, lovContextKey, type LovInputProps } from './LovInput'\r\nimport { ElInput, ElDropdown } from 'element-plus'\r\nimport { Search } from '@element-plus/icons-vue'\r\nimport { provide, reactive, ref, useTemplateRef } from 'vue'\r\n\r\ndefineOptions({ name: 'OLovInput', inheritAttrs: false })\r\n\r\nconst emit = defineEmits<{\r\n (e: 'select', params: Record<string, any>): void\r\n (e: 'clear'): void\r\n}>()\r\nconst { maxlength, placeholder, disabled } = defineProps<LovInputProps>()\r\nconst model = defineModel<string>()\r\n\r\nconst visible = ref(false)\r\nconst changed = ref(false)\r\nconst inputRef = useTemplateRef('input')\r\nconst dropdownRef = useTemplateRef('dropdown')\r\n\r\nconst onVisibleChange = (val: boolean) => {\r\n visible.value = val\r\n}\r\n\r\nconst onInput = () => {\r\n if (!changed.value) {\r\n changed.value = true\r\n }\r\n\r\n if (!visible.value) {\r\n dropdownRef.value!.handleOpen()\r\n }\r\n}\r\n\r\nlet keydownHandler: KeydownHandler | undefined\r\nconst registerKeydownHandler: LovContext['registerKeydownHandler'] = (handler) => {\r\n keydownHandler = handler\r\n}\r\n\r\nconst onKeydown = (e: any) => {\r\n const fallthroughCodes = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Enter', 'Space']\r\n\r\n if (fallthroughCodes.indexOf(e.code) > -1) {\r\n if (visible.value) {\r\n keydownHandler && keydownHandler(e.code)\r\n }\r\n e.stopPropagation()\r\n }\r\n\r\n const triggerCodes = ['ArrowUp', 'ArrowDown']\r\n if (triggerCodes.indexOf(e.code) > -1 && !visible.value) {\r\n dropdownRef.value!.handleOpen()\r\n }\r\n}\r\n\r\n\r\nconst onBlur = async (e: FocusEvent) => {\r\n if (visible.value) {\r\n inputRef.value!.focus()\r\n }\r\n\r\n if (e.relatedTarget) {\r\n const target = e.relatedTarget as HTMLElement\r\n if (target.closest('.el-popper')) {\r\n return\r\n }\r\n }\r\n\r\n if (changed.value) {\r\n emit('clear')\r\n }\r\n}\r\n\r\nconst backfill: LovContext['backfill'] = (params) => {\r\n dropdownRef.value!.handleClose()\r\n\r\n emit('select', params)\r\n\r\n if (changed.value) {\r\n changed.value = false\r\n }\r\n}\r\n\r\nprovide(\r\n lovContextKey,\r\n reactive({\r\n lovValue: model,\r\n backfill,\r\n registerKeydownHandler,\r\n })\r\n)\r\n</script>\r\n"],"names":["slots","useSlots","emit","__emit","onChange","value","model","_useModel","__props","normalizedCode","useInputCode","content","computed","getSingleCodeContent","elModel","newValue","getMultiCodeContent","dayjs","normalizedSourceFormat","isTimePicker","dateType","picker","isDate","isString","dayjsObj","OrionError","toNumber","_newValue","oldValue","visible","ref","changed","inputRef","useTemplateRef","dropdownRef","onVisibleChange","val","onInput","keydownHandler","registerKeydownHandler","handler","onKeydown","e","onBlur","provide","lovContextKey","reactive","params"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuBA,UAAMA,IAAQC,KACRC,IAAOC,GAGPC,IAAW,CAACC,MAAkB;AAClC,MAAAH,EAAK,UAAUG,CAAK;AAAA,IAAA,GAKhBC,IAAQC,EAAoBC,GAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChBlC,UAAMN,IAAOC,GAGPC,IAAW,CAACC,MAAe;AAC/B,MAAAH,EAAK,UAAUG,CAAK;AAAA,IAAA,GAKhBC,IAAQC,EAAoBC,GAAA,YAAA,GAC5BC,IAAiBC,KACjBC,IAAUC,EAAS,MAAMN,EAAM,QAAQO,EAAqBJ,EAAe,OAAOH,EAAM,KAAK,IAAI,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACX3G,UAAMJ,IAAOC,GAGPC,IAAW,CAACC,MAAe;AAC/B,MAAAH,EAAK,UAAUG,EAAM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