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.
Files changed (46) 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/request/leaf7/index.js +21 -21
  38. package/dist/request/leaf7/index.js.map +1 -1
  39. package/dist/version/version.d.ts +1 -1
  40. package/dist/version/version.js +1 -1
  41. package/dist/version/version.js.map +1 -1
  42. package/package.json +1 -1
  43. package/dist/LovInput.vue_vue_type_script_setup_true_lang-C__ELopU.js +0 -400
  44. package/dist/LovInput.vue_vue_type_script_setup_true_lang-C__ELopU.js.map +0 -1
  45. package/dist/TableSelect.vue_vue_type_script_setup_true_lang-0WMTwNxX.js +0 -310
  46. package/dist/TableSelect.vue_vue_type_script_setup_true_lang-0WMTwNxX.js.map +0 -1
@@ -1,400 +0,0 @@
1
- import { defineComponent as g, mergeModels as c, useSlots as $, useModel as V, openBlock as m, createBlock as p, unref as n, createSlots as A, withCtx as f, renderSlot as y, computed as b, createElementBlock as D, Fragment as T, renderList as E, ref as w, useTemplateRef as C, provide as j, reactive as N, createVNode as L } from "vue";
2
- import { ElInput as O, ElSelect as U, ElOption as Y, dayjs as M, ElTimePicker as R, ElDatePicker as W, ElInputNumber as x, 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 S 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__ */ g({
10
- name: "OStringInput",
11
- inheritAttrs: !1,
12
- __name: "StringInput",
13
- props: /* @__PURE__ */ c({
14
- maxlength: {},
15
- placeholder: {},
16
- disabled: { type: Boolean },
17
- readonly: { type: Boolean }
18
- }, {
19
- modelValue: {},
20
- modelModifiers: {}
21
- }),
22
- emits: ["update:modelValue"],
23
- setup(a) {
24
- const s = $(), u = V(a, "modelValue");
25
- return (r, e) => (m(), p(n(O), {
26
- modelValue: u.value,
27
- "onUpdate:modelValue": e[0] || (e[0] = (o) => u.value = o),
28
- maxlength: r.maxlength,
29
- placeholder: r.placeholder,
30
- disabled: r.disabled,
31
- readonly: r.readonly
32
- }, A({ _: 2 }, [
33
- n(s).prefix ? {
34
- name: "prefix",
35
- fn: f(() => [
36
- y(r.$slots, "prefix")
37
- ]),
38
- key: "0"
39
- } : void 0,
40
- n(s).suffix ? {
41
- name: "suffix",
42
- fn: f(() => [
43
- y(r.$slots, "suffix")
44
- ]),
45
- key: "1"
46
- } : void 0,
47
- n(s).prepend ? {
48
- name: "prepend",
49
- fn: f(() => [
50
- y(r.$slots, "prepend")
51
- ]),
52
- key: "2"
53
- } : void 0,
54
- n(s).append ? {
55
- name: "append",
56
- fn: f(() => [
57
- y(r.$slots, "append")
58
- ]),
59
- key: "3"
60
- } : void 0
61
- ]), 1032, ["modelValue", "maxlength", "placeholder", "disabled", "readonly"]));
62
- }
63
- }), ue = /* @__PURE__ */ g({
64
- name: "OSingleSelect",
65
- inheritAttrs: !1,
66
- __name: "SingleSelect",
67
- props: /* @__PURE__ */ c({
68
- placeholder: {},
69
- disabled: { type: Boolean },
70
- code: {},
71
- clearable: { type: Boolean },
72
- filterable: { type: Boolean }
73
- }, {
74
- modelValue: {},
75
- modelModifiers: {}
76
- }),
77
- emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
78
- setup(a, { emit: s }) {
79
- const u = s, r = (d) => {
80
- u("change", d);
81
- }, e = V(a, "modelValue"), o = I(), l = b(() => e.value ? G(o.value, e.value) : null);
82
- return (d, t) => d.disabled ? (m(), p(n(O), {
83
- key: 0,
84
- "model-value": l.value,
85
- placeholder: d.placeholder,
86
- disabled: !0,
87
- readonly: !0
88
- }, null, 8, ["model-value", "placeholder"])) : (m(), p(n(U), {
89
- key: 1,
90
- modelValue: e.value,
91
- "onUpdate:modelValue": t[0] || (t[0] = (v) => e.value = v),
92
- placeholder: d.placeholder,
93
- clearable: d.clearable,
94
- filterable: d.filterable,
95
- onChange: r
96
- }, {
97
- default: f(() => [
98
- (m(!0), D(T, null, E(n(o), (v) => (m(), p(n(Y), {
99
- key: v.value,
100
- label: v.content,
101
- value: v.value
102
- }, null, 8, ["label", "value"]))), 128))
103
- ]),
104
- _: 1
105
- }, 8, ["modelValue", "placeholder", "clearable", "filterable"]));
106
- }
107
- }), me = /* @__PURE__ */ g({
108
- name: "OMultiSelect",
109
- inheritAttrs: !1,
110
- __name: "MultiSelect",
111
- props: /* @__PURE__ */ c({
112
- placeholder: {},
113
- disabled: { type: Boolean },
114
- code: {},
115
- collapseTags: { type: Boolean },
116
- collapseTagsTooltip: { type: Boolean }
117
- }, {
118
- modelValue: {},
119
- modelModifiers: {}
120
- }),
121
- emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
122
- setup(a, { emit: s }) {
123
- const u = s, r = (t) => {
124
- u("change", t.join(","));
125
- }, e = V(a, "modelValue"), o = b({
126
- get: () => {
127
- if (e.value)
128
- return e.value.split(",");
129
- },
130
- set: (t) => {
131
- t ? e.value = t.join(",") : e.value = "";
132
- }
133
- }), l = I(), d = b(() => e.value ? q(l.value, e.value) : null);
134
- return (t, v) => t.disabled ? (m(), p(n(O), {
135
- key: 0,
136
- "model-value": d.value,
137
- placeholder: t.placeholder,
138
- disabled: !0,
139
- readonly: !0
140
- }, null, 8, ["model-value", "placeholder"])) : (m(), p(n(U), {
141
- key: 1,
142
- modelValue: o.value,
143
- "onUpdate:modelValue": v[0] || (v[0] = (h) => o.value = h),
144
- placeholder: t.placeholder,
145
- multiple: "",
146
- "collapse-tags": t.collapseTags,
147
- "collapse-tags-tooltip": t.collapseTagsTooltip,
148
- onChange: r
149
- }, {
150
- default: f(() => [
151
- (m(!0), D(T, null, E(n(l), (h) => (m(), p(n(Y), {
152
- key: h.value,
153
- label: h.content,
154
- value: h.value
155
- }, null, 8, ["label", "value"]))), 128))
156
- ]),
157
- _: 1
158
- }, 8, ["modelValue", "placeholder", "collapse-tags", "collapse-tags-tooltip"]));
159
- }
160
- }), fe = /* @__PURE__ */ g({
161
- name: "ODateInput",
162
- inheritAttrs: !1,
163
- __name: "DateInput",
164
- props: /* @__PURE__ */ c({
165
- maxlength: {},
166
- placeholder: {},
167
- disabled: { type: Boolean },
168
- readonly: { 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: ["update:modelValue"],
178
- setup(a) {
179
- const s = b(() => a.format.startsWith("H") || a.format.startsWith("h") || a.format.startsWith("m") || a.format.startsWith("s")), u = b(() => a.sourceFormat ? a.sourceFormat : s.value ? "HH:mm:ss" : "YYYY-MM-DD"), r = b(() => {
180
- let l = "date";
181
- 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;
182
- }), e = V(a, "modelValue"), o = b({
183
- get: () => {
184
- if (e.value) {
185
- if (J(e.value))
186
- return e.value;
187
- if (Q(e.value)) {
188
- const l = M(e.value, u.value, !0);
189
- if (!l.isValid())
190
- throw new S(`日期输入框的值无效,不符合${u.value}格式`);
191
- return l.toDate();
192
- } else
193
- throw new S("日期输入框的值只能为字符串或日期类型");
194
- }
195
- },
196
- set: (l) => {
197
- a.sourceFormat ? l ? e.value = M(l).format(u.value) : e.value = "" : l ? e.value = l : e.value = void 0;
198
- }
199
- });
200
- return (l, d) => s.value ? (m(), p(n(R), {
201
- key: 0,
202
- modelValue: o.value,
203
- "onUpdate:modelValue": d[0] || (d[0] = (t) => o.value = t),
204
- placeholder: l.placeholder,
205
- disabled: l.disabled,
206
- readonly: l.readonly,
207
- editable: l.editable,
208
- clearable: l.clearable,
209
- format: l.format,
210
- "arrow-control": "",
211
- style: { width: "100%" }
212
- }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "editable", "clearable", "format"])) : (m(), p(n(W), {
213
- key: 1,
214
- modelValue: o.value,
215
- "onUpdate:modelValue": d[1] || (d[1] = (t) => o.value = t),
216
- placeholder: l.placeholder,
217
- disabled: l.disabled,
218
- readonly: l.readonly,
219
- editable: l.editable,
220
- clearable: l.clearable,
221
- type: r.value,
222
- format: l.format,
223
- style: { width: "100%" }
224
- }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "editable", "clearable", "type", "format"]));
225
- }
226
- }), pe = /* @__PURE__ */ g({
227
- name: "ONumberInput",
228
- inheritAttrs: !1,
229
- __name: "NumberInput",
230
- props: /* @__PURE__ */ c({
231
- placeholder: {},
232
- disabled: { type: Boolean },
233
- readonly: { type: Boolean },
234
- min: {},
235
- max: {},
236
- step: {},
237
- stepStrictly: { type: Boolean },
238
- precision: {},
239
- controls: { type: Boolean, default: !0 },
240
- controlsPosition: {}
241
- }, {
242
- modelValue: {},
243
- modelModifiers: {}
244
- }),
245
- emits: ["update:modelValue"],
246
- setup(a) {
247
- const s = $(), u = V(a, "modelValue"), r = b({
248
- get: () => X(u.value),
249
- set: (e) => {
250
- u.value = e;
251
- }
252
- });
253
- return (e, o) => (m(), p(n(x), {
254
- modelValue: r.value,
255
- "onUpdate:modelValue": o[0] || (o[0] = (l) => r.value = l),
256
- placeholder: e.placeholder,
257
- disabled: e.disabled,
258
- readonly: e.readonly,
259
- min: e.min,
260
- max: e.max,
261
- step: e.step,
262
- "step-strictly": e.stepStrictly,
263
- precision: e.precision,
264
- controls: e.controls,
265
- "controls-position": e.controlsPosition,
266
- style: { width: "100%" }
267
- }, A({ _: 2 }, [
268
- n(s)["decrease-icon"] ? {
269
- name: "decrease-icon",
270
- fn: f(() => [
271
- y(e.$slots, "decrease-icon")
272
- ]),
273
- key: "0"
274
- } : void 0,
275
- n(s)["increase-icon"] ? {
276
- name: "increase-icon",
277
- fn: f(() => [
278
- y(e.$slots, "increase-icon")
279
- ]),
280
- key: "1"
281
- } : void 0,
282
- n(s).prefix ? {
283
- name: "prefix",
284
- fn: f(() => [
285
- y(e.$slots, "prefix")
286
- ]),
287
- key: "2"
288
- } : void 0,
289
- n(s).suffix ? {
290
- name: "suffix",
291
- fn: f(() => [
292
- y(e.$slots, "suffix")
293
- ]),
294
- key: "3"
295
- } : void 0
296
- ]), 1032, ["modelValue", "placeholder", "disabled", "readonly", "min", "max", "step", "step-strictly", "precision", "controls", "controls-position"]));
297
- }
298
- }), ce = /* @__PURE__ */ g({
299
- name: "OCheckbox",
300
- inheritAttrs: !1,
301
- __name: "Checkbox",
302
- props: /* @__PURE__ */ c({
303
- disabled: { type: Boolean }
304
- }, {
305
- modelValue: {},
306
- modelModifiers: {}
307
- }),
308
- emits: /* @__PURE__ */ c(["change"], ["update:modelValue"]),
309
- setup(a, { emit: s }) {
310
- const u = s, r = (l) => {
311
- u("change", l ? "1" : "0");
312
- }, e = V(a, "modelValue"), o = b({
313
- get: () => e.value ? e.value == "1" : !1,
314
- set: (l) => {
315
- const d = e.value, t = l ? "1" : "0";
316
- (d || l) && (e.value = t);
317
- }
318
- });
319
- return (l, d) => (m(), p(n(z), {
320
- modelValue: o.value,
321
- "onUpdate:modelValue": d[0] || (d[0] = (t) => o.value = t),
322
- disabled: l.disabled,
323
- onChange: r
324
- }, null, 8, ["modelValue", "disabled"]));
325
- }
326
- }), ve = /* @__PURE__ */ g({
327
- name: "OLovInput",
328
- inheritAttrs: !1,
329
- __name: "LovInput",
330
- props: /* @__PURE__ */ c({
331
- maxlength: {},
332
- placeholder: {},
333
- disabled: { type: Boolean },
334
- readonly: { type: Boolean }
335
- }, {
336
- modelValue: {},
337
- modelModifiers: {}
338
- }),
339
- emits: /* @__PURE__ */ c(["select", "clear"], ["update:modelValue"]),
340
- setup(a, { emit: s }) {
341
- const u = s, r = V(a, "modelValue"), e = w(!1), o = w(!1), l = C("input"), d = C("dropdown"), t = (i) => {
342
- e.value = i;
343
- }, v = () => {
344
- o.value || (o.value = !0), e.value || d.value.handleOpen();
345
- };
346
- let h;
347
- const F = (i) => {
348
- h = i;
349
- }, H = (i) => {
350
- ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Enter", "Space"].indexOf(i.code) > -1 && (e.value && h && h(i.code), i.stopPropagation()), ["ArrowUp", "ArrowDown"].indexOf(i.code) > -1 && !e.value && d.value.handleOpen();
351
- }, P = async (i) => {
352
- e.value && l.value.focus(), !(i.relatedTarget && i.relatedTarget.closest(".el-popper")) && o.value && u("clear");
353
- };
354
- return j(
355
- Z,
356
- N({
357
- lovValue: r,
358
- backfill: (i) => {
359
- d.value.handleClose(), u("select", i), o.value && (o.value = !1);
360
- },
361
- registerKeydownHandler: F
362
- })
363
- ), (i, k) => (m(), p(n(K), {
364
- ref: "dropdown",
365
- trigger: "click",
366
- onVisibleChange: t,
367
- style: { width: "100%" }
368
- }, {
369
- dropdown: f(() => [
370
- y(i.$slots, "default")
371
- ]),
372
- default: f(() => [
373
- L(n(O), {
374
- ref: "input",
375
- modelValue: r.value,
376
- "onUpdate:modelValue": k[0] || (k[0] = (B) => r.value = B),
377
- maxlength: i.maxlength,
378
- placeholder: i.placeholder,
379
- disabled: i.disabled,
380
- readonly: i.readonly,
381
- onInput: v,
382
- onKeydown: H,
383
- onBlur: P,
384
- "suffix-icon": n(_)
385
- }, null, 8, ["modelValue", "maxlength", "placeholder", "disabled", "readonly", "suffix-icon"])
386
- ]),
387
- _: 3
388
- }, 512));
389
- }
390
- });
391
- export {
392
- ie as _,
393
- ue as a,
394
- me as b,
395
- ce as c,
396
- fe as d,
397
- ve as e,
398
- pe as f
399
- };
400
- //# sourceMappingURL=LovInput.vue_vue_type_script_setup_true_lang-C__ELopU.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LovInput.vue_vue_type_script_setup_true_lang-C__ELopU.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\" :readonly=\"readonly\">\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\n\r\nconst { maxlength, placeholder, disabled, readonly } = 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 :readonly=\"readonly\" :editable=\"editable\" :clearable=\"clearable\" :format=\"format\" arrow-control\r\n style=\"width: 100%\" />\r\n <el-date-picker v-else v-model=\"elModel\" :placeholder=\"placeholder\" :disabled=\"disabled\" :readonly=\"readonly\"\r\n :editable=\"editable\" :clearable=\"clearable\" :type=\"dateType\" :format=\"format\" style=\"width: 100%\" />\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\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\" :readonly=\"readonly\" :min=\"min\"\r\n :max=\"max\" :step=\"step\" :step-strictly=\"stepStrictly\" :precision=\"precision\" :controls=\"controls\"\r\n :controls-position=\"controlsPosition\" style=\"width: 100%\">\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\n\r\nconst {\r\n placeholder,\r\n disabled,\r\n readonly,\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 :readonly=\"readonly\" @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, readonly } = 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","model","_useModel","__props","emit","__emit","onChange","value","normalizedCode","useInputCode","content","computed","getSingleCodeContent","elModel","newValue","getMultiCodeContent","isTimePicker","normalizedSourceFormat","dateType","picker","isDate","isString","dayjsObj","dayjs","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,KAIRC,IAAQC,EAAoBC,GAAA,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACVlC,UAA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