@schemx/vant 0.1.11-alpha.20260616152026.eac77d3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,2921 @@
1
+ import { WithRemoteOptions, useFieldContext, rendererRegistry } from "@schemx/vue";
2
+ import { default as default2, WithRemoteOptions as WithRemoteOptions2, default as default3, rendererRegistry as rendererRegistry2, useEffect, useField, useFieldContext as useFieldContext2, useForm, useWatch, validatorRegistry } from "@schemx/vue";
3
+ import { defineComponent, useSlots, computed, openBlock, createElementBlock, normalizeClass, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, ref, watch, unref, createVNode, createSlots, withCtx, useModel, createBlock, mergeProps, mergeModels, useAttrs, Fragment, renderList, normalizeStyle, withModifiers, nextTick } from "vue";
4
+ import { Field, Icon, CheckboxGroup, Checkbox, Popup, DatePicker, Calendar, Picker, RadioGroup, Radio, Rate, Slider, Stepper, Switch, Uploader, Cascader, Button } from "vant";
5
+ import classNames from "classnames";
6
+ import dayjs from "dayjs";
7
+ export * from "@schemx/core";
8
+ function getFieldProps(attrs, key, defaultValue = void 0) {
9
+ return (attrs == null ? void 0 : attrs[key]) ?? defaultValue;
10
+ }
11
+ function isEmptyDisplayValue(value) {
12
+ return value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0;
13
+ }
14
+ function findTreeItem(tree, targetValue, options = {}) {
15
+ const { labelKey = "label", valueKey = "value", childrenKey = "children" } = options;
16
+ const result = { node: null, labels: [], values: [] };
17
+ if (!Array.isArray(tree) || targetValue === void 0 || targetValue === null) {
18
+ return result;
19
+ }
20
+ const search = (nodes, labels, values) => {
21
+ for (const node of nodes) {
22
+ const currentLabels = [...labels, node[labelKey]];
23
+ const currentValues = [...values, node[valueKey]];
24
+ if (node[valueKey] === targetValue) {
25
+ return { node, labels: currentLabels, values: currentValues };
26
+ }
27
+ if (Array.isArray(node[childrenKey]) && node[childrenKey].length > 0) {
28
+ const found = search(node[childrenKey], currentLabels, currentValues);
29
+ if (found) return found;
30
+ }
31
+ }
32
+ return null;
33
+ };
34
+ return search(tree, [], []) || result;
35
+ }
36
+ function getFileName(url) {
37
+ if (!url) return String(Date.now());
38
+ try {
39
+ const cleanUrl = url.split("?")[0].split("#")[0];
40
+ const parts = cleanUrl.split("/");
41
+ const fileName = parts[parts.length - 1];
42
+ return fileName || String(Date.now());
43
+ } catch {
44
+ return String(Date.now());
45
+ }
46
+ }
47
+ const _hoisted_1$3 = ["role", "tabindex", "aria-disabled"];
48
+ const _hoisted_2$3 = {
49
+ key: 0,
50
+ class: "schemx-cell__prefix"
51
+ };
52
+ const _hoisted_3$1 = {
53
+ key: 1,
54
+ class: "schemx-cell__suffix"
55
+ };
56
+ const _hoisted_4$1 = {
57
+ key: 2,
58
+ class: "schemx-cell__arrow",
59
+ "aria-hidden": "true"
60
+ };
61
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
62
+ ...{
63
+ name: "SchemxCell",
64
+ inheritAttrs: false
65
+ },
66
+ __name: "index",
67
+ props: {
68
+ value: { type: [String, Number, Boolean], default: "" },
69
+ placeholder: { default: "" },
70
+ readonlyPlaceholder: { default: "-" },
71
+ disabled: { type: Boolean, default: false },
72
+ readonly: { type: Boolean, default: false },
73
+ isLink: { type: Boolean, default: true },
74
+ align: { default: "right" },
75
+ className: { default: "" },
76
+ customClass: { default: "" },
77
+ prefix: { default: "" },
78
+ suffix: { default: "" }
79
+ },
80
+ emits: ["click"],
81
+ setup(__props, { emit: __emit }) {
82
+ const props = __props;
83
+ const emit = __emit;
84
+ const slots = useSlots();
85
+ const isDisabled = computed(() => props.disabled);
86
+ const isReadonly = computed(() => props.readonly);
87
+ const isEditable = computed(() => !props.readonly && !props.disabled);
88
+ const rootClass = computed(() => {
89
+ return [
90
+ "schemx-cell",
91
+ props.className,
92
+ isEditable.value && "schemx-cell--clickable",
93
+ isDisabled.value && "schemx-cell--disabled",
94
+ isReadonly.value && "schemx-cell--readonly",
95
+ !props.value && "schemx-cell--placeholder"
96
+ ];
97
+ });
98
+ const customClass = computed(
99
+ () => ["schemx-cell__value", `schemx-cell__value--${valueAlign.value}`, props.customClass].filter(Boolean).join(" ")
100
+ );
101
+ const cellValue = computed(() => {
102
+ if (isEmptyDisplayValue(props.value)) {
103
+ return isReadonly.value ? props.readonlyPlaceholder : props.placeholder;
104
+ }
105
+ return props.value.toString();
106
+ });
107
+ const valueAlign = computed(() => {
108
+ return props.align === "top" ? "right" : props.align;
109
+ });
110
+ const hasPrefix = computed(
111
+ () => Boolean(slots.prefix) || !isEmptyDisplayValue(props.prefix)
112
+ );
113
+ const hasSuffix = computed(
114
+ () => Boolean(slots.suffix) || !isEmptyDisplayValue(props.suffix)
115
+ );
116
+ const handleClick = (event) => {
117
+ if (!isEditable.value) return;
118
+ emit("click", event);
119
+ };
120
+ const handleKeydown = (event) => {
121
+ if (event.key !== "Enter" && event.key !== " ") return;
122
+ event.preventDefault();
123
+ handleClick();
124
+ };
125
+ return (_ctx, _cache) => {
126
+ return openBlock(), createElementBlock("div", {
127
+ class: normalizeClass(rootClass.value),
128
+ role: isEditable.value ? "button" : void 0,
129
+ tabindex: isEditable.value ? 0 : void 0,
130
+ "aria-disabled": !isEditable.value ? "true" : void 0,
131
+ onClick: handleClick,
132
+ onKeydown: handleKeydown
133
+ }, [
134
+ hasPrefix.value ? (openBlock(), createElementBlock("span", _hoisted_2$3, [
135
+ renderSlot(_ctx.$slots, "prefix", {}, () => [
136
+ createTextVNode(toDisplayString(props.prefix), 1)
137
+ ])
138
+ ])) : createCommentVNode("", true),
139
+ createElementVNode("span", {
140
+ class: normalizeClass(customClass.value)
141
+ }, [
142
+ renderSlot(_ctx.$slots, "default", {}, () => [
143
+ createTextVNode(toDisplayString(cellValue.value), 1)
144
+ ])
145
+ ], 2),
146
+ hasSuffix.value ? (openBlock(), createElementBlock("span", _hoisted_3$1, [
147
+ renderSlot(_ctx.$slots, "suffix", {}, () => [
148
+ createTextVNode(toDisplayString(props.suffix), 1)
149
+ ])
150
+ ])) : createCommentVNode("", true),
151
+ isEditable.value && props.isLink ? (openBlock(), createElementBlock("span", _hoisted_4$1)) : createCommentVNode("", true)
152
+ ], 42, _hoisted_1$3);
153
+ };
154
+ }
155
+ });
156
+ function formatNumber(value, allowDot = true, allowMinus = true) {
157
+ if (allowDot) {
158
+ value = value.replace(/[^-0-9.]/g, "");
159
+ const dotIndex = value.indexOf(".");
160
+ if (dotIndex !== -1) {
161
+ value = value.slice(0, dotIndex + 1) + value.slice(dotIndex + 1).replace(/\./g, "");
162
+ }
163
+ } else {
164
+ value = value.replace(/[^-0-9]/g, "");
165
+ }
166
+ if (allowMinus) {
167
+ const minusIndex = value.indexOf("-");
168
+ if (minusIndex > 0) {
169
+ value = value.replace(/-/g, "");
170
+ } else if (minusIndex === 0) {
171
+ value = "-" + value.slice(1).replace(/-/g, "");
172
+ }
173
+ } else {
174
+ value = value.replace(/-/g, "");
175
+ }
176
+ return value;
177
+ }
178
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
179
+ ...{
180
+ name: "SchemxInput",
181
+ inheritAttrs: false
182
+ },
183
+ __name: "index",
184
+ props: {
185
+ value: { default: "" },
186
+ onChange: { type: Function, default: void 0 },
187
+ onBlur: { type: Function, default: void 0 },
188
+ onFocus: { type: Function, default: void 0 },
189
+ type: { default: "text" },
190
+ readonly: { type: Boolean, default: false },
191
+ disabled: { type: Boolean, default: false },
192
+ autofocus: { type: Boolean, default: false },
193
+ maxlength: { default: void 0 },
194
+ min: { default: void 0 },
195
+ max: { default: void 0 },
196
+ rows: { default: void 0 },
197
+ autosize: { type: [Boolean, Object], default: false },
198
+ formatter: { default: void 0 },
199
+ formatTrigger: { default: "onChange" },
200
+ clearable: { default: false },
201
+ clearIcon: { default: "clear" },
202
+ clearTrigger: { default: "focus" },
203
+ leftIcon: { default: "" },
204
+ rightIcon: { default: "" },
205
+ showWordLimit: { default: false },
206
+ className: { default: "" },
207
+ readonlyPlaceholder: { default: "-" },
208
+ autocomplete: { default: void 0 },
209
+ autocapitalize: { default: void 0 },
210
+ autocorrect: { default: void 0 },
211
+ enterkeyhint: { default: void 0 },
212
+ spellcheck: { type: [Boolean, null], default: null },
213
+ inputmode: { default: void 0 },
214
+ align: { default: "left" },
215
+ placeholder: { default: "" },
216
+ formItemProps: {}
217
+ },
218
+ emits: ["update:value", "change", "blur", "focus", "clear", "keypress", "click-input", "click-left-icon", "click-right-icon"],
219
+ setup(__props, { expose: __expose, emit: __emit }) {
220
+ const props = __props;
221
+ const emit = __emit;
222
+ const fieldRef = ref(null);
223
+ const internalValue = ref(String(props.value ?? ""));
224
+ const computedPlaceholder = computed(() => {
225
+ if (props.readonly) {
226
+ return props.readonlyPlaceholder;
227
+ }
228
+ return props.placeholder || "";
229
+ });
230
+ const fieldType = computed(() => {
231
+ const { type } = props;
232
+ if (type === "textarea") {
233
+ return "textarea";
234
+ }
235
+ if (type === "password") {
236
+ return "password";
237
+ }
238
+ if (type === "number") {
239
+ return "number";
240
+ }
241
+ if (type === "digit") {
242
+ return "digit";
243
+ }
244
+ return "text";
245
+ });
246
+ const computedInputmode = computed(() => {
247
+ if (props.inputmode) return props.inputmode;
248
+ const { type } = props;
249
+ if (type === "number") return "decimal";
250
+ if (type === "digit") return "numeric";
251
+ return void 0;
252
+ });
253
+ const computedAutosize = computed(() => {
254
+ if (props.type !== "textarea") return false;
255
+ return props.autosize;
256
+ });
257
+ const fieldFormatter = computed(() => {
258
+ if (props.type === "number" || props.type === "digit") {
259
+ const isNumber = props.type === "number";
260
+ return (value) => formatNumber(value, isNumber, isNumber);
261
+ }
262
+ return props.formatter;
263
+ });
264
+ const handleUpdateModelValue = (value) => {
265
+ var _a;
266
+ let processedValue = value;
267
+ (_a = props.onChange) == null ? void 0 : _a.call(props, processedValue);
268
+ emit("update:value", processedValue);
269
+ emit("change", processedValue);
270
+ };
271
+ const handleFocus = (event) => {
272
+ var _a;
273
+ (_a = props.onFocus) == null ? void 0 : _a.call(props, event);
274
+ emit("focus", event);
275
+ };
276
+ const handleBlur = (event) => {
277
+ var _a, _b;
278
+ if ((props.type === "number" || props.type === "digit") && internalValue.value !== "") {
279
+ const { min, max } = props;
280
+ const numValue = parseFloat(internalValue.value);
281
+ if (!isNaN(numValue)) {
282
+ const clampedValue = Math.min(
283
+ Math.max(numValue, min ?? -Infinity),
284
+ max ?? Infinity
285
+ );
286
+ if (numValue !== clampedValue) {
287
+ const stringValue = String(clampedValue);
288
+ internalValue.value = stringValue;
289
+ (_a = props.onChange) == null ? void 0 : _a.call(props, stringValue);
290
+ emit("update:value", stringValue);
291
+ emit("change", stringValue);
292
+ }
293
+ }
294
+ }
295
+ (_b = props.onBlur) == null ? void 0 : _b.call(props, event);
296
+ emit("blur", event);
297
+ };
298
+ const handleKeypress = (event) => {
299
+ emit("keypress", event);
300
+ };
301
+ const handleClickInput = (event) => {
302
+ emit("click-input", event);
303
+ };
304
+ const handleClickLeftIcon = (event) => {
305
+ emit("click-left-icon", event);
306
+ };
307
+ const handleClickRightIcon = (event) => {
308
+ emit("click-right-icon", event);
309
+ };
310
+ const handleClear = (event) => {
311
+ var _a;
312
+ (_a = props.onChange) == null ? void 0 : _a.call(props, "");
313
+ emit("update:value", "");
314
+ emit("clear", event);
315
+ };
316
+ const handleClickRoot = (event) => {
317
+ if (props.disabled) return;
318
+ const target = event.target;
319
+ if (!(target instanceof Element)) return;
320
+ const interactiveSelector = [
321
+ "input",
322
+ "textarea",
323
+ "button",
324
+ "a",
325
+ "select",
326
+ "option",
327
+ "label",
328
+ "[role='button']",
329
+ "[tabindex]",
330
+ "[contenteditable='true']",
331
+ ".van-field__clear",
332
+ ".van-field__button",
333
+ ".van-field__left-icon",
334
+ ".van-field__right-icon"
335
+ ].join(",");
336
+ if (target.closest(interactiveSelector)) return;
337
+ focus();
338
+ };
339
+ const focus = () => {
340
+ var _a, _b, _c, _d;
341
+ const input = (_c = (_b = (_a = fieldRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.querySelector) == null ? void 0 : _c.call(_b, "input, textarea");
342
+ (_d = input == null ? void 0 : input.focus) == null ? void 0 : _d.call(input);
343
+ };
344
+ const blur = () => {
345
+ var _a, _b, _c, _d;
346
+ const input = (_c = (_b = (_a = fieldRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.querySelector) == null ? void 0 : _c.call(_b, "input, textarea");
347
+ (_d = input == null ? void 0 : input.blur) == null ? void 0 : _d.call(input);
348
+ };
349
+ __expose({
350
+ focus,
351
+ blur,
352
+ get inputRef() {
353
+ var _a, _b, _c;
354
+ return ((_c = (_b = (_a = fieldRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.querySelector) == null ? void 0 : _c.call(_b, "input, textarea")) || null;
355
+ }
356
+ });
357
+ watch(
358
+ () => props.value,
359
+ (newVal) => {
360
+ const stringVal = String(newVal ?? "");
361
+ if (stringVal !== internalValue.value) {
362
+ internalValue.value = stringVal;
363
+ }
364
+ }
365
+ );
366
+ return (_ctx, _cache) => {
367
+ return openBlock(), createElementBlock("div", {
368
+ class: normalizeClass(unref(classNames)("schemx-input", props.className)),
369
+ onClick: handleClickRoot
370
+ }, [
371
+ createVNode(unref(Field), {
372
+ ref_key: "fieldRef",
373
+ ref: fieldRef,
374
+ modelValue: internalValue.value,
375
+ "onUpdate:modelValue": [
376
+ _cache[0] || (_cache[0] = ($event) => internalValue.value = $event),
377
+ handleUpdateModelValue
378
+ ],
379
+ type: fieldType.value,
380
+ placeholder: computedPlaceholder.value,
381
+ disabled: props.disabled,
382
+ readonly: props.readonly,
383
+ autofocus: props.autofocus,
384
+ maxlength: props.maxlength,
385
+ rows: props.rows !== void 0 ? +props.rows : void 0,
386
+ autosize: computedAutosize.value,
387
+ formatter: fieldFormatter.value,
388
+ "format-trigger": props.formatTrigger,
389
+ clearable: props.clearable,
390
+ "clear-icon": props.clearIcon,
391
+ "clear-trigger": props.clearTrigger,
392
+ "left-icon": props.leftIcon || (_ctx.$slots["left-icon"] ? void 0 : void 0),
393
+ "right-icon": props.rightIcon || (_ctx.$slots["right-icon"] ? void 0 : void 0),
394
+ "show-word-limit": props.showWordLimit,
395
+ autocomplete: props.autocomplete,
396
+ autocapitalize: props.autocapitalize,
397
+ autocorrect: props.autocorrect,
398
+ enterkeyhint: props.enterkeyhint,
399
+ spellcheck: props.spellcheck ?? void 0,
400
+ inputmode: computedInputmode.value,
401
+ "input-align": props.align,
402
+ onFocus: handleFocus,
403
+ onBlur: handleBlur,
404
+ onClear: handleClear,
405
+ onKeypress: handleKeypress,
406
+ onClickInput: handleClickInput,
407
+ onClickLeftIcon: handleClickLeftIcon,
408
+ onClickRightIcon: handleClickRightIcon
409
+ }, createSlots({ _: 2 }, [
410
+ _ctx.$slots["left-icon"] ? {
411
+ name: "left-icon",
412
+ fn: withCtx(() => [
413
+ renderSlot(_ctx.$slots, "left-icon")
414
+ ]),
415
+ key: "0"
416
+ } : void 0,
417
+ _ctx.$slots["right-icon"] ? {
418
+ name: "right-icon",
419
+ fn: withCtx(() => [
420
+ renderSlot(_ctx.$slots, "right-icon")
421
+ ]),
422
+ key: "1"
423
+ } : void 0,
424
+ _ctx.$slots.button ? {
425
+ name: "button",
426
+ fn: withCtx(() => [
427
+ renderSlot(_ctx.$slots, "button")
428
+ ]),
429
+ key: "2"
430
+ } : void 0,
431
+ _ctx.$slots.extra ? {
432
+ name: "extra",
433
+ fn: withCtx(() => [
434
+ renderSlot(_ctx.$slots, "extra")
435
+ ]),
436
+ key: "3"
437
+ } : void 0
438
+ ]), 1032, ["modelValue", "type", "placeholder", "disabled", "readonly", "autofocus", "maxlength", "rows", "autosize", "formatter", "format-trigger", "clearable", "clear-icon", "clear-trigger", "left-icon", "right-icon", "show-word-limit", "autocomplete", "autocapitalize", "autocorrect", "enterkeyhint", "spellcheck", "inputmode", "input-align"])
439
+ ], 2);
440
+ };
441
+ }
442
+ });
443
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
444
+ ...{
445
+ name: "InputRendererComponent",
446
+ inheritAttrs: false
447
+ },
448
+ __name: "index",
449
+ props: /* @__PURE__ */ mergeModels({
450
+ value: { default: "" },
451
+ onChange: { type: Function, default: void 0 },
452
+ onBlur: { type: Function, default: void 0 },
453
+ onFocus: { type: Function, default: void 0 },
454
+ type: { default: "text" },
455
+ readonly: { type: Boolean, default: false },
456
+ disabled: { type: Boolean, default: false },
457
+ placeholder: { default: "" },
458
+ autofocus: { type: Boolean, default: false },
459
+ maxlength: { default: void 0 },
460
+ min: { default: void 0 },
461
+ max: { default: void 0 },
462
+ rows: { default: void 0 },
463
+ autosize: { type: [Boolean, Object], default: false },
464
+ formatter: { default: void 0 },
465
+ formatTrigger: { default: "onChange" },
466
+ clearable: { default: false },
467
+ clearIcon: { default: "clear" },
468
+ clearTrigger: { default: "focus" },
469
+ leftIcon: { default: "" },
470
+ rightIcon: { default: "" },
471
+ showWordLimit: { default: false },
472
+ className: { default: "" },
473
+ readonlyPlaceholder: { default: "-" },
474
+ formItemProps: {},
475
+ autocomplete: { default: void 0 },
476
+ autocapitalize: { default: void 0 },
477
+ autocorrect: { default: void 0 },
478
+ enterkeyhint: { default: void 0 },
479
+ spellcheck: { type: [Boolean, null], default: null },
480
+ inputmode: { default: void 0 },
481
+ align: { default: "left" }
482
+ }, {
483
+ "value": {},
484
+ "valueModifiers": {}
485
+ }),
486
+ emits: ["update:value"],
487
+ setup(__props, { expose: __expose }) {
488
+ const props = __props;
489
+ const inputValue = useModel(__props, "value");
490
+ const inputRef = ref(null);
491
+ const modelValue = computed(() => String(inputValue.value ?? props.value ?? ""));
492
+ const placeholder = computed(() => props.placeholder || "请选择");
493
+ const inputProps = computed(() => {
494
+ const { value: _value, ...rest } = props;
495
+ return rest;
496
+ });
497
+ __expose({
498
+ focus: () => {
499
+ var _a, _b;
500
+ return (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
501
+ },
502
+ blur: () => {
503
+ var _a, _b;
504
+ return (_b = (_a = inputRef.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
505
+ }
506
+ });
507
+ return (_ctx, _cache) => {
508
+ return openBlock(), createElementBlock("div", {
509
+ class: normalizeClass(["schemx-renderer", "schemx-input-renderer", props.className])
510
+ }, [
511
+ props.readonly ? (openBlock(), createBlock(_sfc_main$k, {
512
+ key: 0,
513
+ value: modelValue.value,
514
+ placeholder: placeholder.value,
515
+ "readonly-placeholder": props.readonlyPlaceholder,
516
+ readonly: props.readonly,
517
+ disabled: props.disabled
518
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$j), mergeProps({
519
+ key: 1,
520
+ ref_key: "inputRef",
521
+ ref: inputRef
522
+ }, inputProps.value, {
523
+ value: inputValue.value,
524
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
525
+ }), createSlots({ _: 2 }, [
526
+ _ctx.$slots["left-icon"] ? {
527
+ name: "left-icon",
528
+ fn: withCtx(() => [
529
+ renderSlot(_ctx.$slots, "left-icon")
530
+ ]),
531
+ key: "0"
532
+ } : void 0,
533
+ _ctx.$slots["right-icon"] ? {
534
+ name: "right-icon",
535
+ fn: withCtx(() => [
536
+ renderSlot(_ctx.$slots, "right-icon")
537
+ ]),
538
+ key: "1"
539
+ } : void 0,
540
+ _ctx.$slots.button ? {
541
+ name: "button",
542
+ fn: withCtx(() => [
543
+ renderSlot(_ctx.$slots, "button")
544
+ ]),
545
+ key: "2"
546
+ } : void 0,
547
+ _ctx.$slots.extra ? {
548
+ name: "extra",
549
+ fn: withCtx(() => [
550
+ renderSlot(_ctx.$slots, "extra")
551
+ ]),
552
+ key: "3"
553
+ } : void 0
554
+ ]), 1040, ["value"]))
555
+ ], 2);
556
+ };
557
+ }
558
+ });
559
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
560
+ ...{
561
+ name: "TextRendererComponent",
562
+ inheritAttrs: false
563
+ },
564
+ __name: "index",
565
+ props: /* @__PURE__ */ mergeModels({
566
+ className: { default: "" },
567
+ placeholder: { default: void 0 },
568
+ readonlyPlaceholder: { default: "-" },
569
+ readonly: { type: Boolean, default: false },
570
+ disabled: { type: Boolean, default: false },
571
+ value: { default: "" },
572
+ onChange: {},
573
+ onBlur: {},
574
+ onFocus: {},
575
+ align: { default: "right" },
576
+ clearable: { type: Boolean, default: false },
577
+ clearIcon: { default: "clear" },
578
+ clearTrigger: { default: "focus" },
579
+ leftIcon: { default: "" },
580
+ rightIcon: { default: "" },
581
+ showWordLimit: { type: Boolean, default: false },
582
+ maxlength: {},
583
+ min: {},
584
+ max: {},
585
+ formatter: {},
586
+ formatTrigger: {},
587
+ autocomplete: {},
588
+ autocapitalize: {},
589
+ autofocus: { type: Boolean },
590
+ type: {},
591
+ rows: {},
592
+ autosize: { type: [Boolean, Object] },
593
+ autocorrect: {},
594
+ enterkeyhint: {},
595
+ spellcheck: { type: [Boolean, null] },
596
+ inputmode: {},
597
+ formItemProps: {}
598
+ }, {
599
+ "value": {},
600
+ "valueModifiers": {}
601
+ }),
602
+ emits: ["update:value"],
603
+ setup(__props, { expose: __expose }) {
604
+ const props = __props;
605
+ const textValue = useModel(__props, "value");
606
+ const slots = useSlots();
607
+ const inputRef = ref(null);
608
+ const passwordVisible = ref(false);
609
+ const isPasswordMode = computed(() => props.type === "password");
610
+ const inputType = computed(() => {
611
+ if (isPasswordMode.value) {
612
+ return passwordVisible.value ? "text" : "password";
613
+ }
614
+ return props.type || "text";
615
+ });
616
+ const passwordIcon = computed(() => {
617
+ return passwordVisible.value ? "eye-o" : "closed-eye";
618
+ });
619
+ const handleTogglePassword = () => {
620
+ passwordVisible.value = !passwordVisible.value;
621
+ };
622
+ __expose({
623
+ focus: () => {
624
+ var _a, _b;
625
+ return (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
626
+ },
627
+ blur: () => {
628
+ var _a, _b;
629
+ return (_b = (_a = inputRef.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
630
+ }
631
+ });
632
+ return (_ctx, _cache) => {
633
+ return openBlock(), createElementBlock("div", {
634
+ class: normalizeClass(
635
+ unref(classNames)("schemx-renderer", "schemx-text-renderer", props.className, {
636
+ "schemx-renderer-readonly": __props.readonly,
637
+ "schemx-renderer-disabled": __props.disabled
638
+ })
639
+ )
640
+ }, [
641
+ props.readonly ? (openBlock(), createBlock(_sfc_main$k, {
642
+ key: 0,
643
+ value: textValue.value,
644
+ placeholder: __props.placeholder,
645
+ "readonly-placeholder": props.readonlyPlaceholder,
646
+ readonly: props.readonly,
647
+ disabled: props.disabled
648
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$j), {
649
+ key: 1,
650
+ ref_key: "inputRef",
651
+ ref: inputRef,
652
+ value: textValue.value,
653
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => textValue.value = $event),
654
+ type: inputType.value,
655
+ placeholder: props.placeholder,
656
+ "readonly-placeholder": props.readonlyPlaceholder,
657
+ readonly: props.readonly,
658
+ disabled: props.disabled,
659
+ align: props.align,
660
+ maxlength: props.maxlength,
661
+ min: props.min,
662
+ max: props.max,
663
+ formatter: props.formatter,
664
+ "format-trigger": props.formatTrigger,
665
+ autocomplete: props.autocomplete,
666
+ autofocus: props.autofocus,
667
+ clearable: props.clearable,
668
+ "clear-icon": props.clearIcon,
669
+ "clear-trigger": props.clearTrigger,
670
+ "left-icon": props.leftIcon,
671
+ "right-icon": isPasswordMode.value || props.readonly ? "" : props.rightIcon,
672
+ "show-word-limit": props.showWordLimit && !props.readonly && !props.disabled,
673
+ onChange: props.onChange,
674
+ onBlur: props.onBlur,
675
+ onFocus: props.onFocus
676
+ }, createSlots({
677
+ "right-icon": withCtx(() => [
678
+ isPasswordMode.value && !props.readonly ? (openBlock(), createBlock(unref(Icon), {
679
+ key: 0,
680
+ name: passwordIcon.value,
681
+ class: "schemx-text-renderer__password-icon",
682
+ onClick: handleTogglePassword
683
+ }, null, 8, ["name"])) : unref(slots)["right-icon"] ? renderSlot(_ctx.$slots, "right-icon", { key: 1 }) : createCommentVNode("", true)
684
+ ]),
685
+ _: 2
686
+ }, [
687
+ unref(slots)["left-icon"] ? {
688
+ name: "left-icon",
689
+ fn: withCtx(() => [
690
+ renderSlot(_ctx.$slots, "left-icon")
691
+ ]),
692
+ key: "0"
693
+ } : void 0,
694
+ unref(slots).button ? {
695
+ name: "button",
696
+ fn: withCtx(() => [
697
+ renderSlot(_ctx.$slots, "button")
698
+ ]),
699
+ key: "1"
700
+ } : void 0,
701
+ unref(slots).extra ? {
702
+ name: "extra",
703
+ fn: withCtx(() => [
704
+ renderSlot(_ctx.$slots, "extra")
705
+ ]),
706
+ key: "2"
707
+ } : void 0
708
+ ]), 1032, ["value", "type", "placeholder", "readonly-placeholder", "readonly", "disabled", "align", "maxlength", "min", "max", "formatter", "format-trigger", "autocomplete", "autofocus", "clearable", "clear-icon", "clear-trigger", "left-icon", "right-icon", "show-word-limit", "onChange", "onBlur", "onFocus"]))
709
+ ], 2);
710
+ };
711
+ }
712
+ });
713
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
714
+ ...{
715
+ name: "TextAreaRendererComponent",
716
+ inheritAttrs: false
717
+ },
718
+ __name: "index",
719
+ props: /* @__PURE__ */ mergeModels({
720
+ value: { default: "" },
721
+ onChange: {},
722
+ onBlur: {},
723
+ onFocus: { type: Function, default: void 0 },
724
+ className: { default: "" },
725
+ autosize: { type: [Boolean, Object], default: () => ({ minRows: 2, maxRows: 6 }) },
726
+ autoSize: { type: [Boolean, Object], default: void 0 },
727
+ rows: { default: void 0 },
728
+ maxlength: {},
729
+ readonly: { type: Boolean, default: false },
730
+ readonlyPlaceholder: { default: "-" },
731
+ disabled: { type: Boolean, default: false },
732
+ align: { default: "left" },
733
+ showWordLimit: { type: Boolean, default: false },
734
+ autofocus: { type: Boolean },
735
+ min: {},
736
+ max: {},
737
+ formatter: {},
738
+ formatTrigger: {},
739
+ clearable: {},
740
+ clearIcon: {},
741
+ clearTrigger: {},
742
+ leftIcon: {},
743
+ rightIcon: {},
744
+ autocomplete: {},
745
+ autocapitalize: {},
746
+ autocorrect: {},
747
+ enterkeyhint: {},
748
+ spellcheck: { type: [Boolean, null] },
749
+ inputmode: {},
750
+ placeholder: { default: void 0 },
751
+ formItemProps: {}
752
+ }, {
753
+ "value": {},
754
+ "valueModifiers": {}
755
+ }),
756
+ emits: ["update:value"],
757
+ setup(__props, { expose: __expose }) {
758
+ const props = __props;
759
+ const textAreaValue = useModel(__props, "value");
760
+ const slots = useSlots();
761
+ const inputRef = ref(null);
762
+ const computedAutosize = computed(() => {
763
+ return props.autoSize ?? props.autosize ?? { minRows: 2, maxRows: 6 };
764
+ });
765
+ const computedRows = computed(() => {
766
+ if (props.rows !== void 0) {
767
+ return props.rows;
768
+ }
769
+ const autosize = computedAutosize.value;
770
+ if (typeof autosize === "object" && autosize.minRows) {
771
+ return autosize.minRows;
772
+ }
773
+ return 2;
774
+ });
775
+ __expose({
776
+ focus: () => {
777
+ var _a, _b;
778
+ return (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
779
+ },
780
+ blur: () => {
781
+ var _a, _b;
782
+ return (_b = (_a = inputRef.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
783
+ }
784
+ });
785
+ return (_ctx, _cache) => {
786
+ return openBlock(), createElementBlock("div", {
787
+ class: normalizeClass(["schemx-renderer", "schemx-textarea-renderer", props.className])
788
+ }, [
789
+ props.readonly ? (openBlock(), createBlock(_sfc_main$k, {
790
+ key: 0,
791
+ value: textAreaValue.value,
792
+ placeholder: props.placeholder,
793
+ "readonly-placeholder": props.readonlyPlaceholder,
794
+ readonly: props.readonly,
795
+ disabled: props.disabled
796
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$j), {
797
+ key: 1,
798
+ ref_key: "inputRef",
799
+ ref: inputRef,
800
+ value: textAreaValue.value,
801
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => textAreaValue.value = $event),
802
+ type: "textarea",
803
+ placeholder: props.placeholder,
804
+ "readonly-placeholder": props.readonlyPlaceholder,
805
+ readonly: props.readonly,
806
+ disabled: props.disabled,
807
+ align: props.align,
808
+ rows: computedRows.value,
809
+ autosize: computedAutosize.value,
810
+ maxlength: props.maxlength,
811
+ "show-word-limit": props.showWordLimit && !props.readonly && !props.disabled,
812
+ onChange: props.onChange,
813
+ onBlur: props.onBlur,
814
+ onFocus: props.onFocus
815
+ }, createSlots({ _: 2 }, [
816
+ unref(slots)["left-icon"] ? {
817
+ name: "left-icon",
818
+ fn: withCtx(() => [
819
+ renderSlot(_ctx.$slots, "left-icon")
820
+ ]),
821
+ key: "0"
822
+ } : void 0,
823
+ unref(slots)["right-icon"] ? {
824
+ name: "right-icon",
825
+ fn: withCtx(() => [
826
+ renderSlot(_ctx.$slots, "right-icon")
827
+ ]),
828
+ key: "1"
829
+ } : void 0,
830
+ unref(slots).button ? {
831
+ name: "button",
832
+ fn: withCtx(() => [
833
+ renderSlot(_ctx.$slots, "button")
834
+ ]),
835
+ key: "2"
836
+ } : void 0,
837
+ unref(slots).extra ? {
838
+ name: "extra",
839
+ fn: withCtx(() => [
840
+ renderSlot(_ctx.$slots, "extra")
841
+ ]),
842
+ key: "3"
843
+ } : void 0
844
+ ]), 1032, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled", "align", "rows", "autosize", "maxlength", "show-word-limit", "onChange", "onBlur", "onFocus"]))
845
+ ], 2);
846
+ };
847
+ }
848
+ });
849
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
850
+ ...{
851
+ name: "CheckboxRendererComponent",
852
+ inheritAttrs: false
853
+ },
854
+ __name: "index",
855
+ props: /* @__PURE__ */ mergeModels({
856
+ value: { default: () => [] },
857
+ onChange: { type: Function, default: () => {
858
+ } },
859
+ options: { default: () => [] },
860
+ fieldNames: { default: () => ({}) },
861
+ className: { default: "" },
862
+ readonly: { type: Boolean, default: false },
863
+ view: { type: Boolean, default: false },
864
+ readonlyPlaceholder: { default: "-" },
865
+ disabled: { type: Boolean, default: false },
866
+ placeholder: {},
867
+ align: {},
868
+ formItemProps: {}
869
+ }, {
870
+ "value": {},
871
+ "valueModifiers": {}
872
+ }),
873
+ emits: ["update:value"],
874
+ setup(__props) {
875
+ const props = __props;
876
+ const attrs = useAttrs();
877
+ const checkboxValue = useModel(__props, "value");
878
+ const labelName = computed(() => {
879
+ var _a;
880
+ return ((_a = props.fieldNames) == null ? void 0 : _a.label) || "label";
881
+ });
882
+ const valueName = computed(() => {
883
+ var _a;
884
+ return ((_a = props.fieldNames) == null ? void 0 : _a.value) || "value";
885
+ });
886
+ const disabledName = computed(() => {
887
+ var _a;
888
+ return ((_a = props.fieldNames) == null ? void 0 : _a.disabled) || "disabled";
889
+ });
890
+ const placeholder = computed(() => props.placeholder || "请选择");
891
+ const contentAlign = computed(() => getFieldProps(attrs, "align", "right"));
892
+ const modelValue = computed(() => {
893
+ const value = checkboxValue.value ?? props.value;
894
+ if (!value) return [];
895
+ return typeof value === "string" ? value.split(",") : value;
896
+ });
897
+ const fieldValue = computed(() => {
898
+ var _a;
899
+ return (_a = modelValue.value) == null ? void 0 : _a.map((v) => getOption(v, labelName.value)).join("、");
900
+ });
901
+ const checkProps = computed(() => {
902
+ const { value, className, formItemProps, ...rest } = props;
903
+ const style = {
904
+ display: "flex",
905
+ flexWrap: "wrap",
906
+ gap: "8px 12px",
907
+ justifyContent: contentAlign.value,
908
+ ...(attrs == null ? void 0 : attrs.style) || {}
909
+ };
910
+ return { ...attrs, ...rest, style };
911
+ });
912
+ const handleChange = (value) => {
913
+ var _a;
914
+ if (props.readonly || props.disabled) return;
915
+ checkboxValue.value = value;
916
+ (_a = props.onChange) == null ? void 0 : _a.call(props, value);
917
+ };
918
+ const getOption = (v, key) => {
919
+ const option = props.options.find((option2) => option2[valueName.value] === v);
920
+ return option ? option[key] : v;
921
+ };
922
+ return (_ctx, _cache) => {
923
+ return openBlock(), createElementBlock("div", {
924
+ class: normalizeClass([
925
+ "schemx-renderer",
926
+ "schemx-checkbox-renderer",
927
+ __props.className,
928
+ { "schemx-renderer-readonly": props.readonly }
929
+ ])
930
+ }, [
931
+ props.readonly ? (openBlock(), createBlock(_sfc_main$k, {
932
+ key: 0,
933
+ value: fieldValue.value,
934
+ placeholder: placeholder.value,
935
+ "readonly-placeholder": props.readonlyPlaceholder,
936
+ readonly: props.readonly,
937
+ disabled: props.disabled
938
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"])) : (openBlock(), createBlock(unref(CheckboxGroup), mergeProps({ key: 1 }, checkProps.value, {
939
+ disabled: __props.disabled,
940
+ "model-value": modelValue.value,
941
+ "onUpdate:modelValue": handleChange
942
+ }), {
943
+ default: withCtx(() => [
944
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
945
+ return openBlock(), createBlock(unref(Checkbox), mergeProps({
946
+ key: option[valueName.value],
947
+ name: option[valueName.value],
948
+ disabled: __props.disabled || option[disabledName.value]
949
+ }, { ref_for: true }, option), {
950
+ default: withCtx(() => [
951
+ createTextVNode(toDisplayString(option[labelName.value]), 1)
952
+ ]),
953
+ _: 2
954
+ }, 1040, ["name", "disabled"]);
955
+ }), 128))
956
+ ]),
957
+ _: 1
958
+ }, 16, ["disabled", "model-value"]))
959
+ ], 2);
960
+ };
961
+ }
962
+ });
963
+ const CheckboxRenderer = WithRemoteOptions(_sfc_main$f);
964
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
965
+ ...{
966
+ name: "DateRendererComponent",
967
+ inheritAttrs: false
968
+ },
969
+ __name: "index",
970
+ props: /* @__PURE__ */ mergeModels({
971
+ value: { default: "" },
972
+ onConfirm: { type: Function, default: () => {
973
+ } },
974
+ onChange: { type: Function, default: () => {
975
+ } },
976
+ format: { type: [String, Function], default: "YYYY-MM-DD" },
977
+ className: { default: "" },
978
+ readonly: { type: Boolean, default: false },
979
+ readonlyPlaceholder: { default: "-" },
980
+ disabled: { type: Boolean, default: false },
981
+ contentAlign: {},
982
+ popupProps: {},
983
+ popupClassName: { default: "" },
984
+ onClose: {},
985
+ placeholder: { default: void 0 },
986
+ align: {},
987
+ formItemProps: {}
988
+ }, {
989
+ "value": {},
990
+ "valueModifiers": {}
991
+ }),
992
+ emits: ["update:value"],
993
+ setup(__props) {
994
+ const props = __props;
995
+ const attrs = useAttrs();
996
+ const dateValue = useModel(__props, "value");
997
+ const showPicker = ref(false);
998
+ const placeholder = computed(() => props.placeholder || "请选择");
999
+ const align = computed(
1000
+ () => getFieldProps(props, "contentAlign", "right")
1001
+ );
1002
+ const title = computed(() => props.title || placeholder.value);
1003
+ const datePickerProps = computed(() => {
1004
+ const {
1005
+ value: _value,
1006
+ onChange: _onChange,
1007
+ onConfirm: _onConfirm,
1008
+ onClose: _onClose,
1009
+ format: _format,
1010
+ className: _className,
1011
+ popupClassName: _popupClassName,
1012
+ readonlyPlaceholder: _readonlyPlaceholder,
1013
+ contentAlign: _contentAlign,
1014
+ formItemProps: _formItemProps,
1015
+ popupProps: _popupProps,
1016
+ title: _title,
1017
+ ...rest
1018
+ } = props;
1019
+ return { ...attrs, ...rest, title: title.value };
1020
+ });
1021
+ const popupProps = computed(() => ({
1022
+ round: true,
1023
+ position: "bottom",
1024
+ safeAreaInsetBottom: true,
1025
+ teleport: "body",
1026
+ ...props.popupProps
1027
+ }));
1028
+ const getValue = (value) => {
1029
+ if (!value) return "";
1030
+ let dateValue2;
1031
+ if (typeof value === "string") {
1032
+ dateValue2 = dayjs(value);
1033
+ } else if (Array.isArray(value)) {
1034
+ if (value.length === 0) return "";
1035
+ dateValue2 = dayjs(value.join("-"));
1036
+ } else if (value instanceof Date) {
1037
+ dateValue2 = dayjs(value);
1038
+ } else {
1039
+ dateValue2 = dayjs(value);
1040
+ }
1041
+ const formatStr = typeof props.format === "string" ? props.format : "YYYY-MM-DD";
1042
+ return dateValue2.format(formatStr);
1043
+ };
1044
+ const fieldValue = computed(() => {
1045
+ return getValue(dateValue.value);
1046
+ });
1047
+ const modelValue = computed(() => {
1048
+ const value = getValue(dateValue.value) || (/* @__PURE__ */ new Date()).toISOString();
1049
+ const dateParts = dayjs(value).format("YYYY-MM-DD").split("-");
1050
+ return dateParts;
1051
+ });
1052
+ const handleConfirm = ({ selectedValues }) => {
1053
+ var _a, _b;
1054
+ const formattedValue = getValue(selectedValues);
1055
+ dateValue.value = formattedValue;
1056
+ (_a = props.onConfirm) == null ? void 0 : _a.call(props, formattedValue);
1057
+ (_b = props.onChange) == null ? void 0 : _b.call(props, formattedValue);
1058
+ showPicker.value = false;
1059
+ };
1060
+ const handleCancel = () => {
1061
+ showPicker.value = false;
1062
+ };
1063
+ const handleClick = () => {
1064
+ if (props.readonly || props.disabled) return;
1065
+ showPicker.value = true;
1066
+ };
1067
+ return (_ctx, _cache) => {
1068
+ return openBlock(), createElementBlock("div", {
1069
+ class: normalizeClass(["schemx-renderer", "schemx-date-renderer", props.className])
1070
+ }, [
1071
+ createVNode(_sfc_main$k, {
1072
+ placeholder: placeholder.value,
1073
+ "readonly-placeholder": props.readonlyPlaceholder,
1074
+ readonly: props.readonly,
1075
+ disabled: props.disabled,
1076
+ "content-align": align.value,
1077
+ value: fieldValue.value,
1078
+ onClick: handleClick
1079
+ }, null, 8, ["placeholder", "readonly-placeholder", "readonly", "disabled", "content-align", "value"]),
1080
+ !props.readonly && !props.disabled ? (openBlock(), createBlock(unref(Popup), mergeProps({
1081
+ key: 0,
1082
+ show: showPicker.value,
1083
+ "onUpdate:show": _cache[0] || (_cache[0] = ($event) => showPicker.value = $event),
1084
+ class: unref(classNames)("schemx-date-popup-renderer", props.popupClassName)
1085
+ }, popupProps.value, { "safe-area-inset-bottom": "" }), {
1086
+ default: withCtx(() => [
1087
+ createVNode(unref(DatePicker), mergeProps({ "model-value": modelValue.value }, datePickerProps.value, {
1088
+ onConfirm: handleConfirm,
1089
+ onCancel: handleCancel
1090
+ }), null, 16, ["model-value"])
1091
+ ]),
1092
+ _: 1
1093
+ }, 16, ["show", "class"])) : createCommentVNode("", true)
1094
+ ], 2);
1095
+ };
1096
+ }
1097
+ });
1098
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1099
+ ...{
1100
+ name: "CalendarRendererComponent",
1101
+ inheritAttrs: false
1102
+ },
1103
+ __name: "index",
1104
+ props: /* @__PURE__ */ mergeModels({
1105
+ value: { default: "" },
1106
+ onConfirm: { type: Function, default: () => {
1107
+ } },
1108
+ onChange: { type: Function, default: () => {
1109
+ } },
1110
+ className: { default: "" },
1111
+ popupClassName: {},
1112
+ view: { type: Boolean },
1113
+ readonly: { type: Boolean, default: false },
1114
+ readonlyPlaceholder: { default: "-" },
1115
+ disabled: { type: Boolean, default: false },
1116
+ type: { default: "single" },
1117
+ title: {},
1118
+ format: { default: "YYYY-MM-DD" },
1119
+ separator: { default: " - " },
1120
+ contentAlign: {},
1121
+ placeholder: { default: "" },
1122
+ align: {},
1123
+ formItemProps: {}
1124
+ }, {
1125
+ "value": {},
1126
+ "valueModifiers": {}
1127
+ }),
1128
+ emits: ["update:value"],
1129
+ setup(__props) {
1130
+ const props = __props;
1131
+ const attrs = useAttrs();
1132
+ const calendarValue = useModel(__props, "value");
1133
+ const showCalendar = ref(false);
1134
+ const minSelectableDate = new Date(1970, 0, 1);
1135
+ const maxSelectableDate = dayjs().add(10, "year").toDate();
1136
+ const placeholder = computed(() => (props == null ? void 0 : props.placeholder) || "请选择");
1137
+ const align = computed(
1138
+ () => getFieldProps(props, "contentAlign", "right")
1139
+ );
1140
+ const title = computed(() => props.title || placeholder.value);
1141
+ const isReadonly = computed(() => props.readonly || Boolean(props.view));
1142
+ const calendarProps = computed(() => {
1143
+ const {
1144
+ value: _value,
1145
+ onChange: _onChange,
1146
+ onConfirm: _onConfirm,
1147
+ className: _className,
1148
+ popupClassName: _popupClassName,
1149
+ format: _format,
1150
+ separator: _separator,
1151
+ contentAlign: _contentAlign,
1152
+ type: _type,
1153
+ formItemProps: _formItemProps,
1154
+ minDate = minSelectableDate,
1155
+ maxDate = maxSelectableDate,
1156
+ ...rest
1157
+ } = props;
1158
+ return {
1159
+ ...attrs,
1160
+ ...rest,
1161
+ class: classNames("schemx-calendar-popup-renderer", props.popupClassName),
1162
+ minDate,
1163
+ maxDate,
1164
+ safeAreaInsetBottom: true,
1165
+ teleport: "body",
1166
+ title: title.value
1167
+ };
1168
+ });
1169
+ const modelValue = computed(() => {
1170
+ const value = getValue(calendarValue.value);
1171
+ return Array.isArray(value) ? value.join(props.separator) : value;
1172
+ });
1173
+ const getValue = (value) => {
1174
+ if (!value) return "";
1175
+ if (Array.isArray(value)) {
1176
+ return value.map((i) => dayjs(i).format(props.format));
1177
+ } else {
1178
+ return dayjs(value).format(props.format);
1179
+ }
1180
+ };
1181
+ const handleConfirm = (date) => {
1182
+ var _a, _b;
1183
+ if (isReadonly.value || props.disabled) return;
1184
+ const value = getValue(date);
1185
+ calendarValue.value = date;
1186
+ (_a = props.onConfirm) == null ? void 0 : _a.call(props, value);
1187
+ (_b = props.onChange) == null ? void 0 : _b.call(props, value);
1188
+ showCalendar.value = false;
1189
+ };
1190
+ const handleClick = () => {
1191
+ if (isReadonly.value || props.disabled) return;
1192
+ showCalendar.value = true;
1193
+ };
1194
+ return (_ctx, _cache) => {
1195
+ return openBlock(), createElementBlock("div", {
1196
+ class: normalizeClass(["schemx-renderer", "schemx-calendar-renderer", props.className])
1197
+ }, [
1198
+ createVNode(_sfc_main$k, {
1199
+ placeholder: placeholder.value,
1200
+ "readonly-placeholder": props.readonlyPlaceholder,
1201
+ readonly: isReadonly.value,
1202
+ disabled: props.disabled,
1203
+ value: modelValue.value,
1204
+ "content-align": align.value,
1205
+ onClick: handleClick
1206
+ }, null, 8, ["placeholder", "readonly-placeholder", "readonly", "disabled", "value", "content-align"]),
1207
+ !isReadonly.value && !props.disabled ? (openBlock(), createBlock(unref(Calendar), mergeProps({ key: 0 }, calendarProps.value, {
1208
+ show: showCalendar.value,
1209
+ "onUpdate:show": _cache[0] || (_cache[0] = ($event) => showCalendar.value = $event),
1210
+ onConfirm: handleConfirm
1211
+ }), null, 16, ["show"])) : createCommentVNode("", true)
1212
+ ], 2);
1213
+ };
1214
+ }
1215
+ });
1216
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1217
+ ...{
1218
+ name: "NumberRendererComponent",
1219
+ inheritAttrs: false
1220
+ },
1221
+ __name: "index",
1222
+ props: /* @__PURE__ */ mergeModels({
1223
+ value: { default: "" },
1224
+ onChange: {},
1225
+ onBlur: {},
1226
+ onFocus: {},
1227
+ className: { default: "" },
1228
+ type: { default: "number" },
1229
+ readonly: { type: Boolean, default: false },
1230
+ readonlyPlaceholder: { default: "-" },
1231
+ disabled: { type: Boolean, default: false },
1232
+ align: { default: "right" },
1233
+ clearable: { type: Boolean, default: false },
1234
+ min: { default: void 0 },
1235
+ max: { default: void 0 },
1236
+ maxlength: {},
1237
+ autofocus: { type: Boolean },
1238
+ rows: {},
1239
+ autosize: { type: [Boolean, Object] },
1240
+ formatter: {},
1241
+ formatTrigger: {},
1242
+ clearIcon: {},
1243
+ clearTrigger: {},
1244
+ leftIcon: {},
1245
+ rightIcon: {},
1246
+ showWordLimit: {},
1247
+ autocomplete: {},
1248
+ autocapitalize: {},
1249
+ autocorrect: {},
1250
+ enterkeyhint: {},
1251
+ spellcheck: { type: [Boolean, null] },
1252
+ inputmode: {},
1253
+ placeholder: { default: void 0 },
1254
+ formItemProps: {}
1255
+ }, {
1256
+ "value": {},
1257
+ "valueModifiers": {}
1258
+ }),
1259
+ emits: ["update:value"],
1260
+ setup(__props, { expose: __expose }) {
1261
+ const props = __props;
1262
+ const slots = useSlots();
1263
+ const numberValue = useModel(__props, "value");
1264
+ const inputRef = ref(null);
1265
+ const placeholder = computed(() => props.placeholder || "请选择");
1266
+ const handleChange = (value) => {
1267
+ var _a, _b;
1268
+ if (value === "" || value === null || value === void 0) {
1269
+ numberValue.value = "";
1270
+ (_a = props.onChange) == null ? void 0 : _a.call(props, "");
1271
+ return;
1272
+ }
1273
+ numberValue.value = value;
1274
+ (_b = props.onChange) == null ? void 0 : _b.call(props, value);
1275
+ };
1276
+ __expose({
1277
+ focus: () => {
1278
+ var _a, _b;
1279
+ return (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
1280
+ },
1281
+ blur: () => {
1282
+ var _a, _b;
1283
+ return (_b = (_a = inputRef.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
1284
+ }
1285
+ });
1286
+ return (_ctx, _cache) => {
1287
+ return openBlock(), createElementBlock("div", {
1288
+ class: normalizeClass(["schemx-renderer", "schemx-number-renderer", props.className])
1289
+ }, [
1290
+ props.readonly ? (openBlock(), createBlock(_sfc_main$k, {
1291
+ key: 0,
1292
+ value: numberValue.value,
1293
+ placeholder: placeholder.value,
1294
+ "readonly-placeholder": props.readonlyPlaceholder,
1295
+ readonly: props.readonly,
1296
+ disabled: props.disabled
1297
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$j), {
1298
+ key: 1,
1299
+ ref_key: "inputRef",
1300
+ ref: inputRef,
1301
+ value: numberValue.value,
1302
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => numberValue.value = $event),
1303
+ type: props.type,
1304
+ placeholder: props.placeholder,
1305
+ "readonly-placeholder": props.readonlyPlaceholder,
1306
+ readonly: props.readonly,
1307
+ disabled: props.disabled,
1308
+ align: props.align,
1309
+ min: props.min,
1310
+ max: props.max,
1311
+ maxlength: props.maxlength,
1312
+ clearable: props.clearable,
1313
+ onChange: handleChange,
1314
+ onBlur: props.onBlur,
1315
+ onFocus: props.onFocus
1316
+ }, createSlots({ _: 2 }, [
1317
+ unref(slots)["left-icon"] ? {
1318
+ name: "left-icon",
1319
+ fn: withCtx(() => [
1320
+ renderSlot(_ctx.$slots, "left-icon")
1321
+ ]),
1322
+ key: "0"
1323
+ } : void 0,
1324
+ unref(slots)["right-icon"] ? {
1325
+ name: "right-icon",
1326
+ fn: withCtx(() => [
1327
+ renderSlot(_ctx.$slots, "right-icon")
1328
+ ]),
1329
+ key: "1"
1330
+ } : void 0,
1331
+ unref(slots).button ? {
1332
+ name: "button",
1333
+ fn: withCtx(() => [
1334
+ renderSlot(_ctx.$slots, "button")
1335
+ ]),
1336
+ key: "2"
1337
+ } : void 0,
1338
+ unref(slots).extra ? {
1339
+ name: "extra",
1340
+ fn: withCtx(() => [
1341
+ renderSlot(_ctx.$slots, "extra")
1342
+ ]),
1343
+ key: "3"
1344
+ } : void 0
1345
+ ]), 1032, ["value", "type", "placeholder", "readonly-placeholder", "readonly", "disabled", "align", "min", "max", "maxlength", "clearable", "onBlur", "onFocus"]))
1346
+ ], 2);
1347
+ };
1348
+ }
1349
+ });
1350
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1351
+ ...{
1352
+ name: "PickerRendererComponent",
1353
+ inheritAttrs: false
1354
+ },
1355
+ __name: "index",
1356
+ props: /* @__PURE__ */ mergeModels({
1357
+ value: { default: void 0 },
1358
+ onConfirm: { type: Function, default: () => {
1359
+ } },
1360
+ onChange: { type: Function, default: () => {
1361
+ } },
1362
+ className: { default: "" },
1363
+ emitPath: { type: Boolean, default: false },
1364
+ showAllLevels: { type: Boolean, default: false },
1365
+ separator: { default: " - " },
1366
+ readonly: { type: Boolean, default: false },
1367
+ readonlyPlaceholder: { default: "-" },
1368
+ disabled: { type: Boolean, default: false },
1369
+ title: { default: "" },
1370
+ options: { default: () => [] },
1371
+ columns: {},
1372
+ columnsFieldNames: {},
1373
+ fieldNames: { default: () => ({ text: "text", value: "value", children: "children" }) },
1374
+ contentAlign: {},
1375
+ popupProps: {},
1376
+ popupClassName: { default: "" },
1377
+ placeholder: {},
1378
+ align: {},
1379
+ formItemProps: {}
1380
+ }, {
1381
+ "value": {},
1382
+ "valueModifiers": {}
1383
+ }),
1384
+ emits: ["update:value"],
1385
+ setup(__props) {
1386
+ const props = __props;
1387
+ const attrs = useAttrs();
1388
+ const pickerValue = useModel(__props, "value");
1389
+ const showPicker = ref(false);
1390
+ const placeholder = computed(() => (props == null ? void 0 : props.placeholder) || "请选择");
1391
+ const title = computed(() => props.title || placeholder.value);
1392
+ const pickerProps = computed(() => {
1393
+ const {
1394
+ value: _value,
1395
+ onChange: _onChange,
1396
+ onConfirm: _onConfirm,
1397
+ className: _className,
1398
+ popupClassName: _popupClassName,
1399
+ readonlyPlaceholder: _readonlyPlaceholder,
1400
+ separator: _separator,
1401
+ showAllLevels: _showAllLevels,
1402
+ emitPath: _emitPath,
1403
+ options: _options,
1404
+ columns: _columns,
1405
+ columnsFieldNames: _columnsFieldNames,
1406
+ fieldNames: _fieldNames,
1407
+ contentAlign: _contentAlign,
1408
+ formItemProps: _formItemProps,
1409
+ popupProps: _popupProps,
1410
+ title: _title,
1411
+ ...rest
1412
+ } = props;
1413
+ return { ...attrs, ...rest, title: title.value };
1414
+ });
1415
+ const popupProps = computed(() => ({
1416
+ round: true,
1417
+ position: "bottom",
1418
+ safeAreaInsetBottom: true,
1419
+ teleport: "body",
1420
+ ...props.popupProps
1421
+ }));
1422
+ const columns = computed(() => {
1423
+ var _a;
1424
+ if (Array.isArray(props.options) && ((_a = props.options) == null ? void 0 : _a.length) > 0) {
1425
+ return props.options;
1426
+ }
1427
+ return (props == null ? void 0 : props.columns) || [];
1428
+ });
1429
+ const fieldNames = computed(
1430
+ () => (props == null ? void 0 : props.columnsFieldNames) || (props == null ? void 0 : props.fieldNames)
1431
+ );
1432
+ const fieldValue = computed(() => {
1433
+ var _a, _b, _c, _d;
1434
+ const result = findTreeItem(columns.value, pickerValue.value, {
1435
+ labelKey: (_a = fieldNames.value) == null ? void 0 : _a.text,
1436
+ valueKey: (_b = fieldNames.value) == null ? void 0 : _b.value,
1437
+ childrenKey: (_c = fieldNames.value) == null ? void 0 : _c.children
1438
+ });
1439
+ const label = props.showAllLevels ? result == null ? void 0 : result.labels : result == null ? void 0 : result.labels.slice(-1);
1440
+ return result.labels.length ? label == null ? void 0 : label.join(props.separator) : (_d = pickerValue.value) == null ? void 0 : _d.toString();
1441
+ });
1442
+ const modelValue = computed(() => {
1443
+ if (pickerValue.value === void 0 || pickerValue.value === null || pickerValue.value === "") {
1444
+ return [];
1445
+ }
1446
+ return Array.isArray(pickerValue.value) ? pickerValue.value : [pickerValue.value];
1447
+ });
1448
+ const handleConfirm = (values) => {
1449
+ var _a, _b;
1450
+ const value = props.emitPath ? values.selectedValues : values.selectedValues[values.selectedValues.length - 1];
1451
+ pickerValue.value = value;
1452
+ (_a = props.onConfirm) == null ? void 0 : _a.call(props, value, values);
1453
+ (_b = props.onChange) == null ? void 0 : _b.call(props, value, values);
1454
+ showPicker.value = false;
1455
+ };
1456
+ const handleCancel = () => {
1457
+ showPicker.value = false;
1458
+ };
1459
+ const handleClick = () => {
1460
+ if (props.readonly || props.disabled) return;
1461
+ showPicker.value = true;
1462
+ };
1463
+ return (_ctx, _cache) => {
1464
+ return openBlock(), createElementBlock("div", {
1465
+ class: normalizeClass(["schemx-renderer", "schemx-picker-renderer", props.className])
1466
+ }, [
1467
+ createVNode(_sfc_main$k, {
1468
+ placeholder: placeholder.value,
1469
+ "readonly-placeholder": props.readonlyPlaceholder,
1470
+ readonly: props.readonly,
1471
+ disabled: props.disabled,
1472
+ value: fieldValue.value,
1473
+ onClick: handleClick
1474
+ }, null, 8, ["placeholder", "readonly-placeholder", "readonly", "disabled", "value"]),
1475
+ !props.readonly && !props.disabled ? (openBlock(), createBlock(unref(Popup), mergeProps({
1476
+ key: 0,
1477
+ show: showPicker.value,
1478
+ "onUpdate:show": _cache[0] || (_cache[0] = ($event) => showPicker.value = $event),
1479
+ class: unref(classNames)("schemx-picker-popup-renderer", props.popupClassName)
1480
+ }, popupProps.value, { "safe-area-inset-bottom": "" }), {
1481
+ default: withCtx(() => [
1482
+ createVNode(unref(Picker), mergeProps({
1483
+ "model-value": modelValue.value,
1484
+ columns: columns.value,
1485
+ "columns-field-names": fieldNames.value
1486
+ }, pickerProps.value, {
1487
+ onConfirm: handleConfirm,
1488
+ onCancel: handleCancel
1489
+ }), {
1490
+ empty: withCtx(() => [..._cache[1] || (_cache[1] = [
1491
+ createElementVNode("div", { class: "schemx-picker-empty" }, "No data", -1)
1492
+ ])]),
1493
+ _: 1
1494
+ }, 16, ["model-value", "columns", "columns-field-names"])
1495
+ ]),
1496
+ _: 1
1497
+ }, 16, ["show", "class"])) : createCommentVNode("", true)
1498
+ ], 2);
1499
+ };
1500
+ }
1501
+ });
1502
+ const PickerRenderer = WithRemoteOptions(_sfc_main$b);
1503
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1504
+ ...{
1505
+ name: "RadioRendererComponent",
1506
+ inheritAttrs: false
1507
+ },
1508
+ __name: "index",
1509
+ props: /* @__PURE__ */ mergeModels({
1510
+ value: { default: void 0 },
1511
+ onChange: { type: Function, default: () => {
1512
+ } },
1513
+ options: { default: () => [] },
1514
+ className: { default: "" },
1515
+ fieldNames: { default: () => ({}) },
1516
+ readonly: { type: Boolean, default: false },
1517
+ view: { type: Boolean, default: false },
1518
+ readonlyPlaceholder: { default: "-" },
1519
+ disabled: { type: Boolean, default: false },
1520
+ placeholder: {},
1521
+ align: {},
1522
+ formItemProps: {}
1523
+ }, {
1524
+ "value": {},
1525
+ "valueModifiers": {}
1526
+ }),
1527
+ emits: ["update:value"],
1528
+ setup(__props) {
1529
+ const props = __props;
1530
+ const attrs = useAttrs();
1531
+ const radioValue = useModel(__props, "value");
1532
+ const labelName = computed(() => {
1533
+ var _a;
1534
+ return ((_a = props.fieldNames) == null ? void 0 : _a.label) || "label";
1535
+ });
1536
+ const valueName = computed(() => {
1537
+ var _a;
1538
+ return ((_a = props.fieldNames) == null ? void 0 : _a.value) || "value";
1539
+ });
1540
+ const disabledName = computed(() => {
1541
+ var _a;
1542
+ return ((_a = props.fieldNames) == null ? void 0 : _a.disabled) || "disabled";
1543
+ });
1544
+ const placeholder = computed(() => props.placeholder || "请选择");
1545
+ const contentAlign = computed(() => getFieldProps(attrs, "align", "right"));
1546
+ const fieldValue = computed(() => {
1547
+ return getOption(radioValue.value ?? props.value, labelName.value);
1548
+ });
1549
+ const radioProps = computed(() => {
1550
+ const { value, className, formItemProps, ...rest } = props;
1551
+ const style = {
1552
+ display: "flex",
1553
+ flexWrap: "wrap",
1554
+ gap: "8px 12px",
1555
+ justifyContent: contentAlign.value,
1556
+ ...(attrs == null ? void 0 : attrs.style) || {}
1557
+ };
1558
+ return { ...attrs, ...rest, style };
1559
+ });
1560
+ const handleChange = (value) => {
1561
+ var _a;
1562
+ if (props.readonly || props.disabled) return;
1563
+ radioValue.value = value;
1564
+ (_a = props.onChange) == null ? void 0 : _a.call(props, value);
1565
+ };
1566
+ const getOption = (v, key) => {
1567
+ const option = props.options.find((option2) => option2[valueName.value] === v);
1568
+ return option ? option[key] : v;
1569
+ };
1570
+ return (_ctx, _cache) => {
1571
+ return openBlock(), createElementBlock("div", {
1572
+ class: normalizeClass([
1573
+ "schemx-renderer",
1574
+ "schemx-radio-renderer",
1575
+ __props.className,
1576
+ { "schemx-renderer-readonly": props.readonly }
1577
+ ]),
1578
+ style: normalizeStyle({ textAlign: contentAlign.value })
1579
+ }, [
1580
+ props.readonly ? (openBlock(), createBlock(_sfc_main$k, {
1581
+ key: 0,
1582
+ value: fieldValue.value,
1583
+ placeholder: placeholder.value,
1584
+ "readonly-placeholder": props.readonlyPlaceholder,
1585
+ readonly: props.readonly,
1586
+ disabled: props.disabled
1587
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"])) : (openBlock(), createBlock(unref(RadioGroup), mergeProps({ key: 1 }, radioProps.value, {
1588
+ "model-value": radioValue.value,
1589
+ "onUpdate:modelValue": handleChange
1590
+ }), {
1591
+ default: withCtx(() => [
1592
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
1593
+ return openBlock(), createBlock(unref(Radio), mergeProps({
1594
+ key: option[valueName.value],
1595
+ name: option[valueName.value],
1596
+ disabled: __props.disabled || option[disabledName.value]
1597
+ }, { ref_for: true }, option), {
1598
+ default: withCtx(() => [
1599
+ createTextVNode(toDisplayString(option[labelName.value]), 1)
1600
+ ]),
1601
+ _: 2
1602
+ }, 1040, ["name", "disabled"]);
1603
+ }), 128))
1604
+ ]),
1605
+ _: 1
1606
+ }, 16, ["model-value"]))
1607
+ ], 6);
1608
+ };
1609
+ }
1610
+ });
1611
+ const RadioRenderer = WithRemoteOptions(_sfc_main$a);
1612
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1613
+ ...{
1614
+ name: "RateRendererComponent",
1615
+ inheritAttrs: false
1616
+ },
1617
+ __name: "index",
1618
+ props: /* @__PURE__ */ mergeModels({
1619
+ value: { default: 0 },
1620
+ onChange: { type: Function, default: () => {
1621
+ } },
1622
+ count: { default: 5 },
1623
+ allowHalf: { type: Boolean, default: false },
1624
+ className: { default: "" },
1625
+ readonly: { type: Boolean, default: false },
1626
+ readonlyPlaceholder: { default: "-" },
1627
+ disabled: { type: Boolean, default: false },
1628
+ placeholder: {},
1629
+ align: {},
1630
+ formItemProps: {}
1631
+ }, {
1632
+ "value": {},
1633
+ "valueModifiers": {}
1634
+ }),
1635
+ emits: ["update:value"],
1636
+ setup(__props) {
1637
+ const props = __props;
1638
+ const attrs = useAttrs();
1639
+ const rateValue = useModel(__props, "value");
1640
+ const rateProps = computed(() => {
1641
+ const {
1642
+ value: _value,
1643
+ onChange: _onChange,
1644
+ className: _className,
1645
+ formItemProps: _formItemProps,
1646
+ ...rest
1647
+ } = props;
1648
+ return { ...attrs, rest };
1649
+ });
1650
+ const handleChange = (value) => {
1651
+ var _a;
1652
+ if (props.disabled || props.readonly) return;
1653
+ rateValue.value = value;
1654
+ (_a = props.onChange) == null ? void 0 : _a.call(props, value);
1655
+ };
1656
+ return (_ctx, _cache) => {
1657
+ return openBlock(), createElementBlock("div", {
1658
+ class: normalizeClass([
1659
+ "schemx-renderer",
1660
+ "schemx-rate-renderer",
1661
+ __props.className,
1662
+ {
1663
+ "schemx-rate-renderer__readonly": props.readonly,
1664
+ "schemx-rate-renderer__disabled": props.disabled
1665
+ }
1666
+ ])
1667
+ }, [
1668
+ createVNode(unref(Rate), mergeProps(rateProps.value, {
1669
+ "model-value": rateValue.value,
1670
+ count: __props.count,
1671
+ "allow-half": __props.allowHalf,
1672
+ disabled: props.disabled,
1673
+ "onUpdate:modelValue": handleChange
1674
+ }), null, 16, ["model-value", "count", "allow-half", "disabled"])
1675
+ ], 2);
1676
+ };
1677
+ }
1678
+ });
1679
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1680
+ ...{
1681
+ name: "SliderRendererComponent",
1682
+ inheritAttrs: false
1683
+ },
1684
+ __name: "index",
1685
+ props: /* @__PURE__ */ mergeModels({
1686
+ value: { default: 0 },
1687
+ onChange: { type: Function, default: () => {
1688
+ } },
1689
+ min: { default: 0 },
1690
+ max: { default: 100 },
1691
+ step: { default: 1 },
1692
+ range: { type: Boolean, default: false },
1693
+ className: { default: "" },
1694
+ readonly: { type: Boolean, default: false },
1695
+ readonlyPlaceholder: { default: "-" },
1696
+ disabled: { type: Boolean, default: false },
1697
+ button: { type: Boolean, default: true },
1698
+ placeholder: {},
1699
+ align: {},
1700
+ formItemProps: {}
1701
+ }, {
1702
+ "value": {},
1703
+ "valueModifiers": {}
1704
+ }),
1705
+ emits: ["update:value"],
1706
+ setup(__props) {
1707
+ const props = __props;
1708
+ const attrs = useAttrs();
1709
+ const sliderValue = useModel(__props, "value");
1710
+ const placeholder = computed(() => props.placeholder || "请选择");
1711
+ const displayValue = computed(() => {
1712
+ return Array.isArray(sliderValue.value) ? sliderValue.value.join(" - ") : sliderValue.value;
1713
+ });
1714
+ const sliderProps = computed(() => {
1715
+ const { value, className, formItemProps, ...rest } = props;
1716
+ return { ...attrs, ...rest };
1717
+ });
1718
+ const handleChange = (value) => {
1719
+ var _a;
1720
+ if (props.readonly || props.disabled) return;
1721
+ sliderValue.value = value;
1722
+ (_a = props.onChange) == null ? void 0 : _a.call(props, value);
1723
+ };
1724
+ return (_ctx, _cache) => {
1725
+ return openBlock(), createElementBlock("div", {
1726
+ class: normalizeClass(["schemx-renderer", "schemx-slider-renderer", props.className])
1727
+ }, [
1728
+ props.readonly ? (openBlock(), createBlock(_sfc_main$k, {
1729
+ key: 0,
1730
+ value: displayValue.value,
1731
+ placeholder: placeholder.value,
1732
+ "readonly-placeholder": props.readonlyPlaceholder,
1733
+ readonly: props.readonly,
1734
+ disabled: props.disabled
1735
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"])) : (openBlock(), createBlock(unref(Slider), mergeProps({ key: 1 }, sliderProps.value, {
1736
+ "model-value": sliderValue.value,
1737
+ "onUpdate:modelValue": handleChange
1738
+ }), null, 16, ["model-value"]))
1739
+ ], 2);
1740
+ };
1741
+ }
1742
+ });
1743
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1744
+ ...{
1745
+ name: "StepperRendererComponent",
1746
+ inheritAttrs: false
1747
+ },
1748
+ __name: "index",
1749
+ props: /* @__PURE__ */ mergeModels({
1750
+ value: { default: 0 },
1751
+ onChange: { type: Function, default: () => {
1752
+ } },
1753
+ min: { default: void 0 },
1754
+ max: { default: void 0 },
1755
+ step: { default: 1 },
1756
+ integer: { type: Boolean, default: false },
1757
+ decimalLength: { default: void 0 },
1758
+ className: { default: "" },
1759
+ readonly: { type: Boolean, default: false },
1760
+ readonlyPlaceholder: { default: "-" },
1761
+ disabled: { type: Boolean, default: false },
1762
+ allowEmpty: { type: Boolean, default: false },
1763
+ placeholder: {},
1764
+ align: {},
1765
+ formItemProps: {}
1766
+ }, {
1767
+ "value": {},
1768
+ "valueModifiers": {}
1769
+ }),
1770
+ emits: ["update:value"],
1771
+ setup(__props) {
1772
+ const props = __props;
1773
+ const attrs = useAttrs();
1774
+ const stepperValue = useModel(__props, "value");
1775
+ const placeholder = computed(() => props.placeholder || "请选择");
1776
+ const stepperProps = computed(() => {
1777
+ const { value, className, formItemProps, ...rest } = props;
1778
+ return { ...attrs, ...rest };
1779
+ });
1780
+ const handleChange = (value) => {
1781
+ var _a;
1782
+ if (props.readonly || props.disabled) return;
1783
+ stepperValue.value = value;
1784
+ (_a = props.onChange) == null ? void 0 : _a.call(props, value);
1785
+ };
1786
+ return (_ctx, _cache) => {
1787
+ return openBlock(), createElementBlock("div", {
1788
+ class: normalizeClass(["schemx-renderer", "schemx-stepper-renderer", props.className])
1789
+ }, [
1790
+ props.readonly ? (openBlock(), createBlock(_sfc_main$k, {
1791
+ key: 0,
1792
+ value: stepperValue.value,
1793
+ placeholder: placeholder.value,
1794
+ "readonly-placeholder": props.readonlyPlaceholder,
1795
+ readonly: props.readonly,
1796
+ disabled: props.disabled
1797
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"])) : (openBlock(), createBlock(unref(Stepper), mergeProps({ key: 1 }, stepperProps.value, {
1798
+ "model-value": stepperValue.value,
1799
+ "onUpdate:modelValue": handleChange
1800
+ }), null, 16, ["model-value"]))
1801
+ ], 2);
1802
+ };
1803
+ }
1804
+ });
1805
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1806
+ ...{
1807
+ name: "SwitchRendererComponent",
1808
+ inheritAttrs: false
1809
+ },
1810
+ __name: "index",
1811
+ props: /* @__PURE__ */ mergeModels({
1812
+ value: { type: [Boolean, String, Number], default: false },
1813
+ onChange: { type: Function, default: () => {
1814
+ } },
1815
+ className: { default: "" },
1816
+ activeText: { default: void 0 },
1817
+ activeValue: { type: [Boolean, String, Number], default: true },
1818
+ inactiveValue: { type: [Boolean, String, Number], default: false },
1819
+ inactiveText: { default: void 0 },
1820
+ readonly: { type: Boolean, default: false },
1821
+ readonlyPlaceholder: { default: "-" },
1822
+ disabled: { type: Boolean, default: false },
1823
+ placeholder: {},
1824
+ align: {},
1825
+ formItemProps: {}
1826
+ }, {
1827
+ "value": { type: [Boolean, String, Number] },
1828
+ "valueModifiers": {}
1829
+ }),
1830
+ emits: ["update:value"],
1831
+ setup(__props) {
1832
+ const props = __props;
1833
+ const attrs = useAttrs();
1834
+ const switchValue = useModel(__props, "value");
1835
+ const switchLoading = ref(false);
1836
+ const contentAlign = computed(
1837
+ () => getFieldProps(attrs, "align", "right")
1838
+ );
1839
+ const fieldValue = computed(() => {
1840
+ return (switchValue.value ?? props.value) === props.activeValue ? props.activeText : props.inactiveText;
1841
+ });
1842
+ const handleChange = async (value) => {
1843
+ var _a;
1844
+ if (props.readonly || props.disabled) return;
1845
+ try {
1846
+ switchLoading.value = true;
1847
+ const nextValue = await ((_a = props.onChange) == null ? void 0 : _a.call(props, value));
1848
+ switchValue.value = nextValue ?? value;
1849
+ switchLoading.value = false;
1850
+ } catch (error) {
1851
+ switchLoading.value = false;
1852
+ }
1853
+ };
1854
+ return (_ctx, _cache) => {
1855
+ return openBlock(), createElementBlock("div", {
1856
+ class: normalizeClass(["schemx-renderer", "schemx-switch-renderer", props.className]),
1857
+ style: normalizeStyle({ justifyContent: contentAlign.value })
1858
+ }, [
1859
+ props.readonly ? (openBlock(), createBlock(_sfc_main$k, {
1860
+ key: 0,
1861
+ value: fieldValue.value,
1862
+ placeholder: props.placeholder,
1863
+ "readonly-placeholder": props.readonlyPlaceholder,
1864
+ readonly: props.readonly,
1865
+ disabled: props.disabled
1866
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"])) : (openBlock(), createBlock(unref(Switch), mergeProps({
1867
+ key: 1,
1868
+ size: "22px"
1869
+ }, unref(attrs), {
1870
+ "model-value": switchValue.value,
1871
+ loading: switchLoading.value,
1872
+ disabled: __props.disabled,
1873
+ "onUpdate:modelValue": handleChange
1874
+ }), null, 16, ["model-value", "loading", "disabled"]))
1875
+ ], 6);
1876
+ };
1877
+ }
1878
+ });
1879
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1880
+ ...{
1881
+ name: "UploadRendererComponent",
1882
+ inheritAttrs: false
1883
+ },
1884
+ __name: "index",
1885
+ props: /* @__PURE__ */ mergeModels({
1886
+ value: { default: () => [] },
1887
+ onChange: { type: Function, default: () => {
1888
+ } },
1889
+ accept: { default: "*" },
1890
+ className: { default: "" },
1891
+ showUpload: { default: true },
1892
+ disableUpload: { type: Boolean, default: false },
1893
+ deletable: { default: true },
1894
+ readonly: { default: false },
1895
+ view: { type: Boolean, default: false },
1896
+ readonlyPlaceholder: { default: "-" },
1897
+ disabled: { default: false },
1898
+ uploader: { type: Function, default: () => Promise.resolve({}) },
1899
+ propsHttp: { default: () => ({
1900
+ res: "data",
1901
+ url: "link",
1902
+ name: "originalName"
1903
+ }) },
1904
+ placeholder: {},
1905
+ align: {},
1906
+ formItemProps: {}
1907
+ }, {
1908
+ "value": {},
1909
+ "valueModifiers": {}
1910
+ }),
1911
+ emits: ["update:value"],
1912
+ setup(__props) {
1913
+ const props = __props;
1914
+ const attrs = useAttrs();
1915
+ const uploadAttrs = attrs;
1916
+ const uploadValue = useModel(__props, "value");
1917
+ const field = useFieldContext();
1918
+ const uploadRef = ref(null);
1919
+ const uploadingFiles = ref([]);
1920
+ const httpRes = Object.assign({}, props.propsHttp, {
1921
+ res: "data",
1922
+ url: "link",
1923
+ name: "originalName"
1924
+ });
1925
+ const normalizeFile = (item) => {
1926
+ if (!item) return null;
1927
+ const url = (item == null ? void 0 : item.url) || item;
1928
+ return {
1929
+ ...typeof item === "string" ? {} : item,
1930
+ url,
1931
+ uid: (item == null ? void 0 : item.uid) || getFileName(url),
1932
+ status: (item == null ? void 0 : item.status) || "done"
1933
+ };
1934
+ };
1935
+ const innerFileList = computed(() => {
1936
+ const propsFiles = (Array.isArray(uploadValue.value) ? uploadValue.value : [uploadValue.value]).filter(Boolean).map(normalizeFile).filter(Boolean);
1937
+ const fileMap = /* @__PURE__ */ new Map();
1938
+ propsFiles.forEach((file) => {
1939
+ if (file.uid) {
1940
+ fileMap.set(file.uid, file);
1941
+ }
1942
+ });
1943
+ uploadingFiles.value.forEach((file) => {
1944
+ if (file.uid) {
1945
+ fileMap.set(file.uid, file);
1946
+ }
1947
+ });
1948
+ return Array.from(fileMap.values());
1949
+ });
1950
+ watch(
1951
+ () => uploadValue.value,
1952
+ (newVal) => {
1953
+ if (!newVal || Array.isArray(newVal) && newVal.length === 0) {
1954
+ uploadingFiles.value = [];
1955
+ }
1956
+ },
1957
+ { deep: true }
1958
+ );
1959
+ const viewComputed = computed(() => props.view);
1960
+ const readonlyComputed = computed(() => props.readonly);
1961
+ const disabledComputed = computed(() => props.disabled);
1962
+ const deletableComputed = computed(
1963
+ () => viewComputed.value || readonlyComputed.value ? false : props.deletable
1964
+ );
1965
+ const showUploadComputed = computed(
1966
+ () => viewComputed.value || readonlyComputed.value ? false : props.showUpload
1967
+ );
1968
+ const uploaderReadonlyComputed = computed(
1969
+ () => viewComputed.value || readonlyComputed.value
1970
+ );
1971
+ const rootClass = computed(
1972
+ () => classNames("schemx-renderer", "schemx-upload-renderer", props.className)
1973
+ );
1974
+ const resetFieldPending = () => {
1975
+ uploadingFiles.value.some((i) => i.status === "uploading");
1976
+ };
1977
+ const onSuccess = (res, file) => {
1978
+ var _a;
1979
+ const index = uploadingFiles.value.findIndex((i) => i.uid === file.uid);
1980
+ if (index === -1) return;
1981
+ const completedFile = {
1982
+ ...uploadingFiles.value[index],
1983
+ url: res[httpRes.res][httpRes.url],
1984
+ name: res[httpRes.res][httpRes.name],
1985
+ status: "done",
1986
+ message: "上传成功"
1987
+ };
1988
+ uploadingFiles.value = uploadingFiles.value.filter((i) => i.uid !== file.uid);
1989
+ const currentDoneFiles = (Array.isArray(uploadValue.value) ? uploadValue.value : []).filter(Boolean).map(normalizeFile).filter(Boolean);
1990
+ const nextFiles = [...currentDoneFiles, completedFile];
1991
+ uploadValue.value = nextFiles;
1992
+ (_a = props.onChange) == null ? void 0 : _a.call(props, nextFiles);
1993
+ resetFieldPending();
1994
+ };
1995
+ const onFail = (_error, file) => {
1996
+ const index = uploadingFiles.value.findIndex((i) => i.uid === file.uid);
1997
+ if (index === -1) return;
1998
+ uploadingFiles.value[index] = {
1999
+ ...uploadingFiles.value[index],
2000
+ status: "failed",
2001
+ message: "上传失败"
2002
+ };
2003
+ resetFieldPending();
2004
+ };
2005
+ const handleBeforeRead = (file) => {
2006
+ if (uploadAttrs.beforeRead) {
2007
+ return uploadAttrs.beforeRead(file);
2008
+ }
2009
+ return true;
2010
+ };
2011
+ const afterRead = async (files) => {
2012
+ try {
2013
+ if (uploadAttrs.afterRead) {
2014
+ return uploadAttrs.afterRead(files);
2015
+ }
2016
+ const _fileList = Array.isArray(files) ? files : [files];
2017
+ field.setPending(true, "文件上传中");
2018
+ const uploadList = _fileList.map((item) => {
2019
+ var _a;
2020
+ const newItem = {
2021
+ ...item,
2022
+ url: item.objectUrl,
2023
+ uid: getFileName(item.objectUrl),
2024
+ status: "uploading",
2025
+ message: "上传中..."
2026
+ };
2027
+ if (!newItem.file) {
2028
+ throw "file is undefined";
2029
+ }
2030
+ (_a = props.uploader) == null ? void 0 : _a.call(props, newItem.file).then((res) => {
2031
+ onSuccess(res, newItem);
2032
+ }).catch((error) => {
2033
+ onFail(error, newItem);
2034
+ });
2035
+ return newItem;
2036
+ });
2037
+ uploadingFiles.value = [...uploadingFiles.value, ...uploadList];
2038
+ } catch (error) {
2039
+ console.error("Upload failed:", error.message || "上传失败");
2040
+ }
2041
+ };
2042
+ const onDelete = (file, detail) => {
2043
+ var _a;
2044
+ if (uploadAttrs.onDelete) {
2045
+ return uploadAttrs.onDelete(file, detail);
2046
+ }
2047
+ if (file.status === "uploading" || file.status === "failed") {
2048
+ uploadingFiles.value = uploadingFiles.value.filter((i) => i.uid !== file.uid);
2049
+ return;
2050
+ }
2051
+ const currentFiles = (Array.isArray(uploadValue.value) ? uploadValue.value : []).filter(Boolean).map(normalizeFile).filter((i) => i && i.uid !== file.uid);
2052
+ uploadValue.value = currentFiles;
2053
+ (_a = props.onChange) == null ? void 0 : _a.call(props, currentFiles);
2054
+ };
2055
+ return (_ctx, _cache) => {
2056
+ return openBlock(), createElementBlock("div", {
2057
+ class: normalizeClass(["schemx-renderer", "schemx-upload-renderer", props.className])
2058
+ }, [
2059
+ createVNode(unref(Uploader), mergeProps(_ctx.$attrs, {
2060
+ ref_key: "uploadRef",
2061
+ ref: uploadRef,
2062
+ "result-type": "file",
2063
+ multiple: true,
2064
+ class: rootClass.value,
2065
+ "model-value": innerFileList.value,
2066
+ "show-upload": showUploadComputed.value,
2067
+ deletable: deletableComputed.value,
2068
+ disabled: disabledComputed.value,
2069
+ readonly: uploaderReadonlyComputed.value,
2070
+ "before-read": handleBeforeRead,
2071
+ "after-read": afterRead,
2072
+ accept: __props.accept,
2073
+ onDelete
2074
+ }), null, 16, ["class", "model-value", "show-upload", "deletable", "disabled", "readonly", "accept"])
2075
+ ], 2);
2076
+ };
2077
+ }
2078
+ });
2079
+ function omitBy(obj, shouldOmit) {
2080
+ const result = {};
2081
+ const keys = Object.keys(obj);
2082
+ for (let i = 0; i < keys.length; i++) {
2083
+ const key = keys[i];
2084
+ const value = obj[key];
2085
+ if (!shouldOmit(value, key)) result[key] = value;
2086
+ }
2087
+ return result;
2088
+ }
2089
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
2090
+ ...{
2091
+ name: "CascaderRendererComponent",
2092
+ inheritAttrs: false
2093
+ },
2094
+ __name: "index",
2095
+ props: /* @__PURE__ */ mergeModels({
2096
+ value: { default: () => [] },
2097
+ onConfirm: { type: Function, default: void 0 },
2098
+ onChange: { type: Function, default: void 0 },
2099
+ className: { default: "" },
2100
+ showAllLevels: { type: Boolean, default: true },
2101
+ emitPath: { type: Boolean, default: true },
2102
+ fieldNames: { default: () => ({ text: "label", value: "value", children: "children" }) },
2103
+ separator: { default: " - " },
2104
+ readonly: { type: Boolean, default: false },
2105
+ readonlyPlaceholder: { default: "-" },
2106
+ disabled: { type: Boolean, default: false },
2107
+ options: { default: () => [] },
2108
+ contentAlign: {},
2109
+ title: { default: void 0 },
2110
+ popupProps: { default: () => ({}) },
2111
+ popupClassName: { default: "" },
2112
+ placeholder: { default: void 0 },
2113
+ align: {},
2114
+ formItemProps: {}
2115
+ }, {
2116
+ "value": {},
2117
+ "valueModifiers": {}
2118
+ }),
2119
+ emits: ["update:value"],
2120
+ setup(__props) {
2121
+ const props = __props;
2122
+ const attrs = useAttrs();
2123
+ const cascaderModel = useModel(__props, "value");
2124
+ const showCascader = ref(false);
2125
+ const placeholder = computed(() => props.placeholder || "请选择");
2126
+ const fieldNames = computed(() => props.fieldNames);
2127
+ const title = computed(() => props.title ?? placeholder.value);
2128
+ const cascaderProps = computed(() => {
2129
+ const {
2130
+ value: _value,
2131
+ onChange: _onChange,
2132
+ onConfirm: _onConfirm,
2133
+ className: _className,
2134
+ readonlyPlaceholder: _readonlyPlaceholder,
2135
+ showAllLevels: _showAllLevels,
2136
+ emitPath: _emitPath,
2137
+ separator: _separator,
2138
+ contentAlign: _contentAlign,
2139
+ placeholder: _placeholder,
2140
+ formItemProps: _formItemProps,
2141
+ popupProps: _popupProps,
2142
+ title: _title,
2143
+ ...rest
2144
+ } = props;
2145
+ return { ...attrs, ...rest, placeholder: placeholder.value, title: title.value };
2146
+ });
2147
+ const columns = computed(() => {
2148
+ if (Array.isArray(props.options) && props.options.length > 0) {
2149
+ return props.options;
2150
+ }
2151
+ return [];
2152
+ });
2153
+ const cascaderValue = computed(() => {
2154
+ if (!Array.isArray(cascaderModel.value) || cascaderModel.value.length === 0) {
2155
+ return void 0;
2156
+ }
2157
+ return cascaderModel.value[cascaderModel.value.length - 1];
2158
+ });
2159
+ const fieldValue = computed(() => {
2160
+ const targetValue = Array.isArray(cascaderModel.value) ? cascaderModel.value[cascaderModel.value.length - 1] : cascaderModel.value;
2161
+ const result = findTreeItem(columns.value, targetValue, {
2162
+ labelKey: fieldNames.value.text,
2163
+ valueKey: fieldNames.value.value,
2164
+ childrenKey: fieldNames.value.children
2165
+ });
2166
+ if (!result.labels.length) return "";
2167
+ const labels = props.showAllLevels ? result.labels : result.labels.slice(-1);
2168
+ return labels.join(props.separator);
2169
+ });
2170
+ const popupProps = computed(() => {
2171
+ return {
2172
+ round: true,
2173
+ position: "bottom",
2174
+ safeAreaInsetBottom: true,
2175
+ teleport: "body",
2176
+ ...omitBy(props.popupProps, (_, key) => key === "show")
2177
+ };
2178
+ });
2179
+ const handleClick = () => {
2180
+ if (props.readonly || props.disabled) return;
2181
+ showCascader.value = true;
2182
+ };
2183
+ const handleConfirm = (data) => {
2184
+ var _a, _b;
2185
+ if (props.readonly || props.disabled) return;
2186
+ const valueKey = fieldNames.value.value || "value";
2187
+ const valuePath = data.selectedOptions.map((i) => i[valueKey]);
2188
+ const value = props.emitPath ? valuePath : [data.value];
2189
+ cascaderModel.value = value;
2190
+ (_a = props.onConfirm) == null ? void 0 : _a.call(props, value);
2191
+ (_b = props.onChange) == null ? void 0 : _b.call(props, value);
2192
+ showCascader.value = false;
2193
+ };
2194
+ const handleClose = () => {
2195
+ showCascader.value = false;
2196
+ };
2197
+ return (_ctx, _cache) => {
2198
+ return openBlock(), createElementBlock("div", {
2199
+ class: normalizeClass(["schemx-renderer", "schemx-cascader-renderer", props.className])
2200
+ }, [
2201
+ createVNode(_sfc_main$k, {
2202
+ value: fieldValue.value,
2203
+ placeholder: placeholder.value,
2204
+ "readonly-placeholder": props.readonlyPlaceholder,
2205
+ readonly: props.readonly,
2206
+ disabled: props.disabled,
2207
+ onClick: handleClick
2208
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"]),
2209
+ !props.readonly && !props.disabled ? (openBlock(), createBlock(unref(Popup), mergeProps({
2210
+ key: 0,
2211
+ show: showCascader.value,
2212
+ "onUpdate:show": _cache[0] || (_cache[0] = ($event) => showCascader.value = $event),
2213
+ class: unref(classNames)("schemx-cascader-popup-renderer", props.popupClassName)
2214
+ }, popupProps.value, { "safe-area-inset-bottom": "" }), {
2215
+ default: withCtx(() => [
2216
+ createVNode(unref(Cascader), mergeProps(cascaderProps.value, {
2217
+ "model-value": cascaderValue.value,
2218
+ onFinish: handleConfirm,
2219
+ onClose: handleClose
2220
+ }), null, 16, ["model-value"])
2221
+ ]),
2222
+ _: 1
2223
+ }, 16, ["show", "class"])) : createCommentVNode("", true)
2224
+ ], 2);
2225
+ };
2226
+ }
2227
+ });
2228
+ const _hoisted_1$2 = { class: "selector" };
2229
+ const _hoisted_2$2 = ["onClick"];
2230
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2231
+ ...{
2232
+ name: "SSelector"
2233
+ },
2234
+ __name: "Selector",
2235
+ props: {
2236
+ modelValue: { default: () => [] },
2237
+ options: { default: () => [] },
2238
+ multiple: { type: Boolean, default: false },
2239
+ fieldNames: { default: () => ({ label: "label", value: "value", disabled: "disabled" }) },
2240
+ disabled: { type: Boolean, default: false }
2241
+ },
2242
+ emits: ["update:modelValue", "change"],
2243
+ setup(__props, { emit: __emit }) {
2244
+ const props = __props;
2245
+ const emit = __emit;
2246
+ const labelKey = computed(() => {
2247
+ var _a;
2248
+ return ((_a = props.fieldNames) == null ? void 0 : _a.label) || "label";
2249
+ });
2250
+ const valueKey = computed(() => {
2251
+ var _a;
2252
+ return ((_a = props.fieldNames) == null ? void 0 : _a.value) || "value";
2253
+ });
2254
+ const disabledKey = computed(() => {
2255
+ var _a;
2256
+ return ((_a = props.fieldNames) == null ? void 0 : _a.disabled) || "disabled";
2257
+ });
2258
+ const selectedValues = computed(() => {
2259
+ if (props.multiple) {
2260
+ return Array.isArray(props.modelValue) ? props.modelValue : [];
2261
+ }
2262
+ return props.modelValue === void 0 || props.modelValue === null ? [] : [props.modelValue];
2263
+ });
2264
+ const options = computed(() => Array.isArray(props.options) ? props.options : []);
2265
+ const isSelected = (option) => {
2266
+ return selectedValues.value.includes(option == null ? void 0 : option[valueKey.value]);
2267
+ };
2268
+ const handleClick = (option) => {
2269
+ if (props.disabled || (option == null ? void 0 : option[disabledKey.value])) return;
2270
+ const value = option == null ? void 0 : option[valueKey.value];
2271
+ if (props.multiple) {
2272
+ const next = selectedValues.value.includes(value) ? selectedValues.value.filter((item) => item !== value) : [...selectedValues.value, value];
2273
+ emit("update:modelValue", next);
2274
+ emit("change", next, option);
2275
+ return;
2276
+ }
2277
+ emit("update:modelValue", value);
2278
+ emit("change", value, option);
2279
+ };
2280
+ const optionClass = (item) => ({
2281
+ option: true,
2282
+ active: isSelected(item),
2283
+ disabled: props.disabled || !!(item == null ? void 0 : item[disabledKey.value])
2284
+ });
2285
+ return (_ctx, _cache) => {
2286
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
2287
+ (openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (item) => {
2288
+ return openBlock(), createElementBlock("div", {
2289
+ key: item[valueKey.value],
2290
+ class: normalizeClass(optionClass(item)),
2291
+ onClick: ($event) => handleClick(item)
2292
+ }, [
2293
+ renderSlot(_ctx.$slots, "item", { item }, () => [
2294
+ createTextVNode(toDisplayString(item[labelKey.value]), 1)
2295
+ ])
2296
+ ], 10, _hoisted_2$2);
2297
+ }), 128))
2298
+ ]);
2299
+ };
2300
+ }
2301
+ });
2302
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2303
+ ...{
2304
+ name: "SelectorRendererComponent",
2305
+ inheritAttrs: false
2306
+ },
2307
+ __name: "index",
2308
+ props: /* @__PURE__ */ mergeModels({
2309
+ value: { default: void 0 },
2310
+ onChange: { type: Function, default: () => {
2311
+ } },
2312
+ options: { default: () => [] },
2313
+ className: { default: "" },
2314
+ fieldNames: { default: () => ({}) },
2315
+ readonly: { type: Boolean, default: false },
2316
+ view: { type: Boolean, default: false },
2317
+ readonlyPlaceholder: { default: "-" },
2318
+ disabled: { type: Boolean, default: false },
2319
+ placeholder: {},
2320
+ align: {},
2321
+ formItemProps: {}
2322
+ }, {
2323
+ "value": {},
2324
+ "valueModifiers": {}
2325
+ }),
2326
+ emits: ["update:value"],
2327
+ setup(__props) {
2328
+ const props = __props;
2329
+ const attrs = useAttrs();
2330
+ const selectorValue = useModel(__props, "value");
2331
+ const labelName = computed(() => {
2332
+ var _a;
2333
+ return ((_a = props.fieldNames) == null ? void 0 : _a.label) || "label";
2334
+ });
2335
+ const valueName = computed(() => {
2336
+ var _a;
2337
+ return ((_a = props.fieldNames) == null ? void 0 : _a.value) || "value";
2338
+ });
2339
+ const contentAlign = computed(() => getFieldProps(attrs, "align", "right"));
2340
+ const fieldValue = computed(() => {
2341
+ return getOption(selectorValue.value ?? props.value, labelName.value);
2342
+ });
2343
+ const selectorProps = computed(() => {
2344
+ const { value, className: _className, formItemProps: _formItemProps, ...rest } = props;
2345
+ return { ...attrs, rest };
2346
+ });
2347
+ const handleChange = (value) => {
2348
+ var _a;
2349
+ if (props.readonly || props.disabled) return;
2350
+ selectorValue.value = value;
2351
+ (_a = props.onChange) == null ? void 0 : _a.call(props, value);
2352
+ };
2353
+ const getOption = (v, key) => {
2354
+ const option = props.options.find(
2355
+ (option2) => option2[valueName.value] === v
2356
+ );
2357
+ return option ? option[key] : v;
2358
+ };
2359
+ return (_ctx, _cache) => {
2360
+ var _a;
2361
+ return openBlock(), createElementBlock("div", {
2362
+ class: normalizeClass([
2363
+ "schemx-renderer",
2364
+ "schemx-selector-renderer",
2365
+ __props.className,
2366
+ {
2367
+ "schemx-renderer-readonly": __props.readonly
2368
+ }
2369
+ ])
2370
+ }, [
2371
+ props.readonly ? (openBlock(), createBlock(_sfc_main$k, {
2372
+ key: 0,
2373
+ value: fieldValue.value,
2374
+ placeholder: __props.placeholder,
2375
+ "readonly-placeholder": props.readonlyPlaceholder,
2376
+ readonly: props.readonly,
2377
+ disabled: props.disabled
2378
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"])) : (openBlock(), createBlock(_sfc_main$3, mergeProps({ key: 1 }, selectorProps.value, {
2379
+ options: __props.options,
2380
+ "field-names": __props.fieldNames,
2381
+ disabled: props.disabled,
2382
+ "model-value": selectorValue.value,
2383
+ style: {
2384
+ display: "flex",
2385
+ flexWrap: "wrap",
2386
+ gap: "8px 12px",
2387
+ justifyContent: contentAlign.value,
2388
+ ...((_a = unref(attrs)) == null ? void 0 : _a.style) || {}
2389
+ },
2390
+ "onUpdate:modelValue": handleChange
2391
+ }), null, 16, ["options", "field-names", "disabled", "model-value", "style"]))
2392
+ ], 2);
2393
+ };
2394
+ }
2395
+ });
2396
+ const SelectorRenderer = WithRemoteOptions(_sfc_main$2);
2397
+ const _hoisted_1$1 = { class: "schemx-select-picker" };
2398
+ const _hoisted_2$1 = { class: "schemx-select-picker-actions" };
2399
+ const _hoisted_3 = { class: "schemx-select-picker-title" };
2400
+ const _hoisted_4 = { class: "schemx-select-picker-options" };
2401
+ const _hoisted_5 = {
2402
+ key: 1,
2403
+ class: "schemx-select-picker-empty"
2404
+ };
2405
+ const _hoisted_6 = { class: "schemx-select-picker-footer" };
2406
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2407
+ ...{
2408
+ name: "SelectPickerRendererComponent",
2409
+ inheritAttrs: false
2410
+ },
2411
+ __name: "index",
2412
+ props: /* @__PURE__ */ mergeModels({
2413
+ value: { default: void 0 },
2414
+ onChange: { type: Function, default: () => {
2415
+ } },
2416
+ onConfirm: { type: Function, default: () => {
2417
+ } },
2418
+ className: { default: "" },
2419
+ popupClassName: { default: "" },
2420
+ view: { type: Boolean },
2421
+ options: { default: () => [] },
2422
+ columns: { default: () => [] },
2423
+ fieldNames: { default: () => ({}) },
2424
+ type: { default: "checkbox" },
2425
+ readonly: { type: Boolean, default: false },
2426
+ readonlyPlaceholder: { default: "-" },
2427
+ disabled: { type: Boolean, default: false },
2428
+ title: { default: "" },
2429
+ contentAlign: {},
2430
+ popupProps: {},
2431
+ placeholder: {},
2432
+ align: {},
2433
+ formItemProps: {}
2434
+ }, {
2435
+ "value": {},
2436
+ "valueModifiers": {}
2437
+ }),
2438
+ emits: ["update:value"],
2439
+ setup(__props) {
2440
+ const props = __props;
2441
+ const selectPickerValue = useModel(__props, "value");
2442
+ const pendingValue = ref();
2443
+ const showPicker = ref(false);
2444
+ const placeholder = computed(() => props.placeholder || "请选择");
2445
+ const type = computed(() => props.type || "checkbox");
2446
+ const labelName = computed(() => {
2447
+ var _a;
2448
+ return ((_a = props.fieldNames) == null ? void 0 : _a.label) || "label";
2449
+ });
2450
+ const valueName = computed(() => {
2451
+ var _a;
2452
+ return ((_a = props.fieldNames) == null ? void 0 : _a.value) || "value";
2453
+ });
2454
+ const disabledName = computed(() => {
2455
+ var _a;
2456
+ return ((_a = props.fieldNames) == null ? void 0 : _a.disabled) || "disabled";
2457
+ });
2458
+ const isReadonly = computed(() => props.readonly || Boolean(props.view));
2459
+ const popupProps = computed(() => ({
2460
+ round: true,
2461
+ position: "bottom",
2462
+ safeAreaInsetBottom: true,
2463
+ teleport: "body",
2464
+ closeable: true,
2465
+ closeIconPosition: "top-right",
2466
+ ...props.popupProps
2467
+ }));
2468
+ const columns = computed(() => {
2469
+ if (Array.isArray(props.options) && props.options.length > 0) return props.options;
2470
+ return props.columns || [];
2471
+ });
2472
+ const normalizeValue = (value) => {
2473
+ if (type.value === "checkbox") return Array.isArray(value) ? value : [];
2474
+ return value ?? "";
2475
+ };
2476
+ const displayValue = computed(
2477
+ () => normalizeValue(selectPickerValue.value ?? props.value)
2478
+ );
2479
+ const activeValue = computed(
2480
+ () => normalizeValue(pendingValue.value ?? displayValue.value)
2481
+ );
2482
+ const checkboxValue = computed(
2483
+ () => Array.isArray(activeValue.value) ? activeValue.value : []
2484
+ );
2485
+ const radioValue = computed(
2486
+ () => Array.isArray(activeValue.value) ? "" : activeValue.value
2487
+ );
2488
+ const getOption = (value) => {
2489
+ return columns.value.find((option) => option[valueName.value] === value);
2490
+ };
2491
+ const getOptionLabel = (value) => {
2492
+ const option = getOption(value);
2493
+ return String((option == null ? void 0 : option[labelName.value]) ?? value ?? "");
2494
+ };
2495
+ const fieldValue = computed(() => {
2496
+ const value = displayValue.value;
2497
+ if (Array.isArray(value)) {
2498
+ return value.map((item) => getOptionLabel(item)).filter(Boolean).join("、");
2499
+ }
2500
+ return getOptionLabel(value);
2501
+ });
2502
+ const selectedItems = computed(() => {
2503
+ const value = activeValue.value;
2504
+ if (Array.isArray(value)) {
2505
+ return value.map((item) => getOption(item)).filter(Boolean);
2506
+ }
2507
+ return getOption(value) || {};
2508
+ });
2509
+ const handleClick = () => {
2510
+ if (isReadonly.value || props.disabled) return;
2511
+ pendingValue.value = displayValue.value;
2512
+ showPicker.value = true;
2513
+ };
2514
+ const handleCheckboxChange = (value) => {
2515
+ pendingValue.value = value;
2516
+ };
2517
+ const handleRadioChange = (value) => {
2518
+ pendingValue.value = value;
2519
+ };
2520
+ const handleClose = () => {
2521
+ pendingValue.value = void 0;
2522
+ showPicker.value = false;
2523
+ };
2524
+ const handleConfirm = () => {
2525
+ if (isReadonly.value || props.disabled) return;
2526
+ const value = activeValue.value;
2527
+ const detail = {
2528
+ value,
2529
+ selectedItems: selectedItems.value
2530
+ };
2531
+ selectPickerValue.value = value;
2532
+ props.onChange(value, detail);
2533
+ props.onConfirm(value, detail);
2534
+ pendingValue.value = void 0;
2535
+ showPicker.value = false;
2536
+ };
2537
+ return (_ctx, _cache) => {
2538
+ return openBlock(), createElementBlock("div", {
2539
+ class: normalizeClass(["schemx-renderer", "schemx-select-picker-renderer", props.className])
2540
+ }, [
2541
+ createVNode(_sfc_main$k, {
2542
+ value: fieldValue.value,
2543
+ placeholder: placeholder.value,
2544
+ "readonly-placeholder": props.readonlyPlaceholder,
2545
+ readonly: isReadonly.value,
2546
+ disabled: props.disabled,
2547
+ onClick: handleClick
2548
+ }, null, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled"]),
2549
+ !isReadonly.value && !props.disabled ? (openBlock(), createBlock(unref(Popup), mergeProps({
2550
+ key: 0,
2551
+ show: showPicker.value,
2552
+ "onUpdate:show": _cache[0] || (_cache[0] = ($event) => showPicker.value = $event),
2553
+ class: unref(classNames)("schemx-select-picker-popup-renderer", props.popupClassName)
2554
+ }, popupProps.value, {
2555
+ "safe-area-inset-bottom": "",
2556
+ onClose: handleClose
2557
+ }), {
2558
+ default: withCtx(() => [
2559
+ createElementVNode("div", _hoisted_1$1, [
2560
+ createElementVNode("div", _hoisted_2$1, [
2561
+ createElementVNode("div", _hoisted_3, toDisplayString(props.title || placeholder.value), 1)
2562
+ ]),
2563
+ createElementVNode("div", _hoisted_4, [
2564
+ columns.value.length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2565
+ type.value === "checkbox" ? (openBlock(), createBlock(unref(CheckboxGroup), {
2566
+ key: 0,
2567
+ "model-value": checkboxValue.value,
2568
+ "onUpdate:modelValue": handleCheckboxChange
2569
+ }, {
2570
+ default: withCtx(() => [
2571
+ (openBlock(true), createElementBlock(Fragment, null, renderList(columns.value, (option) => {
2572
+ return openBlock(), createBlock(unref(Checkbox), mergeProps({
2573
+ key: option[valueName.value],
2574
+ shape: "square",
2575
+ name: option[valueName.value],
2576
+ disabled: __props.disabled || option[disabledName.value]
2577
+ }, { ref_for: true }, option), {
2578
+ default: withCtx(() => [
2579
+ createTextVNode(toDisplayString(option[labelName.value]), 1)
2580
+ ]),
2581
+ _: 2
2582
+ }, 1040, ["name", "disabled"]);
2583
+ }), 128))
2584
+ ]),
2585
+ _: 1
2586
+ }, 8, ["model-value"])) : (openBlock(), createBlock(unref(RadioGroup), {
2587
+ key: 1,
2588
+ "model-value": radioValue.value,
2589
+ "onUpdate:modelValue": handleRadioChange
2590
+ }, {
2591
+ default: withCtx(() => [
2592
+ (openBlock(true), createElementBlock(Fragment, null, renderList(columns.value, (option) => {
2593
+ return openBlock(), createBlock(unref(Radio), mergeProps({
2594
+ key: option[valueName.value],
2595
+ name: option[valueName.value],
2596
+ disabled: __props.disabled || option[disabledName.value]
2597
+ }, { ref_for: true }, option), {
2598
+ default: withCtx(() => [
2599
+ createTextVNode(toDisplayString(option[labelName.value]), 1)
2600
+ ]),
2601
+ _: 2
2602
+ }, 1040, ["name", "disabled"]);
2603
+ }), 128))
2604
+ ]),
2605
+ _: 1
2606
+ }, 8, ["model-value"]))
2607
+ ], 64)) : (openBlock(), createElementBlock("div", _hoisted_5, "No data"))
2608
+ ]),
2609
+ createElementVNode("div", _hoisted_6, [
2610
+ createVNode(unref(Button), {
2611
+ type: "primary",
2612
+ block: "",
2613
+ onClick: handleConfirm
2614
+ }, {
2615
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [
2616
+ createTextVNode("确认", -1)
2617
+ ])]),
2618
+ _: 1
2619
+ })
2620
+ ])
2621
+ ])
2622
+ ]),
2623
+ _: 1
2624
+ }, 16, ["show", "class"])) : createCommentVNode("", true)
2625
+ ], 2);
2626
+ };
2627
+ }
2628
+ });
2629
+ const SelectPickerRenderer = WithRemoteOptions(_sfc_main$1);
2630
+ function defaultMaskFormatter(value) {
2631
+ const chars = [...value];
2632
+ const length = chars.length;
2633
+ if (length <= 0) return "";
2634
+ if (length <= 2) return "*".repeat(length);
2635
+ if (length <= 6) return `${chars[0]}****${chars[length - 1]}`;
2636
+ return `${chars.slice(0, 3).join("")}****${chars.slice(-4).join("")}`;
2637
+ }
2638
+ const _hoisted_1 = ["aria-label"];
2639
+ const _hoisted_2 = ["aria-label"];
2640
+ const _sfc_main = /* @__PURE__ */ defineComponent({
2641
+ ...{
2642
+ name: "SensitiveInput",
2643
+ inheritAttrs: false
2644
+ },
2645
+ __name: "index",
2646
+ props: {
2647
+ value: { default: "" },
2648
+ onChange: { type: Function, default: void 0 },
2649
+ formatter: { type: Function, default: void 0 },
2650
+ maskFormatter: { type: Function, default: defaultMaskFormatter },
2651
+ defaultRevealed: { type: Boolean, default: false },
2652
+ revealed: { type: Boolean, default: void 0 },
2653
+ onRevealChange: { type: Function, default: void 0 },
2654
+ revealable: { type: Boolean, default: true },
2655
+ revealText: { default: "显示" },
2656
+ hideText: { default: "隐藏" },
2657
+ revealIcon: { default: "eye-o" },
2658
+ hideIcon: { default: "closed-eye" },
2659
+ focusOnReveal: { type: Boolean, default: true },
2660
+ hideOnBlur: { type: Boolean, default: false },
2661
+ revealWhenReadonly: { type: Boolean, default: false },
2662
+ onBlur: { type: Function, default: void 0 },
2663
+ onFocus: { type: Function, default: void 0 },
2664
+ readonly: { type: Boolean, default: false },
2665
+ disabled: { type: Boolean, default: false },
2666
+ autofocus: { type: Boolean },
2667
+ maxlength: {},
2668
+ min: {},
2669
+ max: {},
2670
+ rows: {},
2671
+ autosize: { type: [Boolean, Object] },
2672
+ formatTrigger: {},
2673
+ clearable: {},
2674
+ clearIcon: {},
2675
+ clearTrigger: {},
2676
+ leftIcon: {},
2677
+ rightIcon: {},
2678
+ showWordLimit: {},
2679
+ className: { default: "" },
2680
+ readonlyPlaceholder: { default: "-" },
2681
+ autocomplete: {},
2682
+ autocapitalize: {},
2683
+ autocorrect: {},
2684
+ enterkeyhint: {},
2685
+ spellcheck: { type: [Boolean, null] },
2686
+ inputmode: {},
2687
+ align: { default: "right" },
2688
+ placeholder: { default: "" },
2689
+ formItemProps: {}
2690
+ },
2691
+ emits: ["update:value", "update:revealed", "change", "reveal-change", "blur"],
2692
+ setup(__props, { expose: __expose, emit: __emit }) {
2693
+ const props = __props;
2694
+ const emit = __emit;
2695
+ const inputRef = ref(null);
2696
+ const innerRevealed = ref(props.defaultRevealed);
2697
+ const rawValue = computed(() => String(props.value ?? ""));
2698
+ const isRevealed = computed(() => props.revealed ?? innerRevealed.value);
2699
+ const canReveal = computed(() => {
2700
+ if (!props.revealable || props.disabled) return false;
2701
+ if (props.readonly && !props.revealWhenReadonly) return false;
2702
+ return !isEmptyDisplayValue(rawValue.value);
2703
+ });
2704
+ const formattedValue = computed(() => {
2705
+ if (isEmptyDisplayValue(rawValue.value)) return "";
2706
+ return props.formatter ? props.formatter(rawValue.value) : rawValue.value;
2707
+ });
2708
+ const maskedValue = computed(() => {
2709
+ if (isEmptyDisplayValue(rawValue.value)) return "";
2710
+ return props.maskFormatter(rawValue.value, {
2711
+ placeholder: props.placeholder,
2712
+ readonlyPlaceholder: props.readonlyPlaceholder
2713
+ });
2714
+ });
2715
+ const displayValue = computed(
2716
+ () => isRevealed.value && props.readonly ? formattedValue.value : maskedValue.value
2717
+ );
2718
+ const showInput = computed(() => isRevealed.value && !props.readonly && !props.disabled);
2719
+ const inputProps = computed(() => {
2720
+ const {
2721
+ value: _value,
2722
+ onChange: _onChange,
2723
+ revealed: _revealed,
2724
+ onRevealChange: _onRevealChange,
2725
+ defaultRevealed: _defaultRevealed,
2726
+ revealable: _revealable,
2727
+ revealText: _revealText,
2728
+ hideText: _hideText,
2729
+ revealIcon: _revealIcon,
2730
+ hideIcon: _hideIcon,
2731
+ focusOnReveal: _focusOnReveal,
2732
+ hideOnBlur: _hideOnBlur,
2733
+ revealWhenReadonly: _revealWhenReadonly,
2734
+ maskFormatter: _maskFormatter,
2735
+ ...rest
2736
+ } = props;
2737
+ return rest;
2738
+ });
2739
+ const showAriaLabel = computed(() => props.revealText || "显示完整内容");
2740
+ const hideAriaLabel = computed(() => props.hideText || "隐藏完整内容");
2741
+ const setRevealed = (next) => {
2742
+ var _a;
2743
+ if (props.revealed === void 0) {
2744
+ innerRevealed.value = next;
2745
+ }
2746
+ (_a = props.onRevealChange) == null ? void 0 : _a.call(props, next);
2747
+ emit("update:revealed", next);
2748
+ emit("reveal-change", next);
2749
+ };
2750
+ const toggleReveal = () => {
2751
+ if (!canReveal.value) return;
2752
+ const next = !isRevealed.value;
2753
+ setRevealed(next);
2754
+ if (next && props.focusOnReveal && !props.readonly) {
2755
+ nextTick(() => {
2756
+ var _a, _b;
2757
+ return (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
2758
+ });
2759
+ }
2760
+ };
2761
+ const handleInputChange = (value) => {
2762
+ var _a;
2763
+ (_a = props.onChange) == null ? void 0 : _a.call(props, value);
2764
+ emit("update:value", value);
2765
+ emit("change", value);
2766
+ };
2767
+ const handleInputBlur = (event) => {
2768
+ var _a;
2769
+ (_a = props.onBlur) == null ? void 0 : _a.call(props, event);
2770
+ emit("blur", event);
2771
+ if (props.hideOnBlur) {
2772
+ setRevealed(false);
2773
+ }
2774
+ };
2775
+ __expose({
2776
+ focus: () => {
2777
+ var _a, _b;
2778
+ return (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
2779
+ },
2780
+ blur: () => {
2781
+ var _a, _b;
2782
+ return (_b = (_a = inputRef.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
2783
+ }
2784
+ });
2785
+ return (_ctx, _cache) => {
2786
+ return openBlock(), createElementBlock("div", {
2787
+ class: normalizeClass(["schemx-sensitive-input", props.className])
2788
+ }, [
2789
+ showInput.value ? (openBlock(), createBlock(unref(_sfc_main$j), mergeProps({
2790
+ key: 0,
2791
+ ref_key: "inputRef",
2792
+ ref: inputRef
2793
+ }, inputProps.value, {
2794
+ value: formattedValue.value,
2795
+ "on-change": handleInputChange,
2796
+ "on-blur": handleInputBlur
2797
+ }), {
2798
+ button: withCtx(() => [
2799
+ canReveal.value ? (openBlock(), createElementBlock("button", {
2800
+ key: 0,
2801
+ type: "button",
2802
+ class: "schemx-sensitive-input__toggle",
2803
+ "data-testid": "sensitive-toggle",
2804
+ "aria-label": hideAriaLabel.value,
2805
+ onClick: withModifiers(toggleReveal, ["stop"])
2806
+ }, [
2807
+ props.hideIcon ? (openBlock(), createBlock(unref(Icon), {
2808
+ key: 0,
2809
+ name: props.hideIcon
2810
+ }, null, 8, ["name"])) : createCommentVNode("", true),
2811
+ createElementVNode("span", null, toDisplayString(props.hideText), 1)
2812
+ ], 8, _hoisted_1)) : createCommentVNode("", true)
2813
+ ]),
2814
+ _: 1
2815
+ }, 16, ["value"])) : (openBlock(), createBlock(_sfc_main$k, {
2816
+ key: 1,
2817
+ value: displayValue.value,
2818
+ placeholder: props.placeholder,
2819
+ "readonly-placeholder": props.readonlyPlaceholder,
2820
+ readonly: props.readonly,
2821
+ disabled: props.disabled,
2822
+ "is-link": false,
2823
+ align: props.align
2824
+ }, {
2825
+ suffix: withCtx(() => [
2826
+ canReveal.value ? (openBlock(), createElementBlock("button", {
2827
+ key: 0,
2828
+ type: "button",
2829
+ class: "schemx-sensitive-input__toggle",
2830
+ "data-testid": "sensitive-toggle",
2831
+ "aria-label": showAriaLabel.value,
2832
+ onClick: withModifiers(toggleReveal, ["stop"])
2833
+ }, [
2834
+ props.revealIcon ? (openBlock(), createBlock(unref(Icon), {
2835
+ key: 0,
2836
+ name: props.revealIcon
2837
+ }, null, 8, ["name"])) : createCommentVNode("", true),
2838
+ createElementVNode("span", null, toDisplayString(props.revealText), 1)
2839
+ ], 8, _hoisted_2)) : createCommentVNode("", true)
2840
+ ]),
2841
+ _: 1
2842
+ }, 8, ["value", "placeholder", "readonly-placeholder", "readonly", "disabled", "align"]))
2843
+ ], 2);
2844
+ };
2845
+ }
2846
+ });
2847
+ const DEFAULT_RENDERER_TYPES = [
2848
+ "input",
2849
+ "text",
2850
+ "textarea",
2851
+ "number",
2852
+ "switch",
2853
+ "radio",
2854
+ "checkbox",
2855
+ "date",
2856
+ "calendar",
2857
+ "picker",
2858
+ "selectPicker",
2859
+ "selector",
2860
+ "sensitiveInput",
2861
+ "rate",
2862
+ "slider",
2863
+ "stepper",
2864
+ "upload",
2865
+ "cascader"
2866
+ ];
2867
+ rendererRegistry.registerAll({
2868
+ input: _sfc_main$i,
2869
+ text: _sfc_main$h,
2870
+ textarea: _sfc_main$g,
2871
+ number: _sfc_main$c,
2872
+ switch: _sfc_main$6,
2873
+ radio: RadioRenderer,
2874
+ checkbox: CheckboxRenderer,
2875
+ date: _sfc_main$e,
2876
+ calendar: _sfc_main$d,
2877
+ picker: PickerRenderer,
2878
+ selectPicker: SelectPickerRenderer,
2879
+ selector: SelectorRenderer,
2880
+ sensitiveInput: _sfc_main,
2881
+ rate: _sfc_main$9,
2882
+ slider: _sfc_main$8,
2883
+ stepper: _sfc_main$7,
2884
+ upload: _sfc_main$5,
2885
+ cascader: _sfc_main$4
2886
+ });
2887
+ export {
2888
+ _sfc_main$d as CalendarRenderer,
2889
+ _sfc_main$4 as CascaderRenderer,
2890
+ CheckboxRenderer,
2891
+ DEFAULT_RENDERER_TYPES,
2892
+ _sfc_main$e as DateRenderer,
2893
+ _sfc_main$i as InputRenderer,
2894
+ _sfc_main$c as NumberRenderer,
2895
+ PickerRenderer,
2896
+ RadioRenderer,
2897
+ _sfc_main$9 as RateRenderer,
2898
+ default2 as SchemxForm,
2899
+ SelectPickerRenderer,
2900
+ SelectorRenderer,
2901
+ _sfc_main as SensitiveInputRenderer,
2902
+ _sfc_main$8 as SliderRenderer,
2903
+ _sfc_main$7 as StepperRenderer,
2904
+ _sfc_main$6 as SwitchRenderer,
2905
+ _sfc_main$g as TextAreaRenderer,
2906
+ _sfc_main$h as TextRenderer,
2907
+ _sfc_main$5 as UploadRenderer,
2908
+ WithRemoteOptions2 as WithRemoteOptions,
2909
+ default3 as default,
2910
+ findTreeItem,
2911
+ getFieldProps,
2912
+ getFileName,
2913
+ rendererRegistry2 as rendererRegistry,
2914
+ useEffect,
2915
+ useField,
2916
+ useFieldContext2 as useFieldContext,
2917
+ useForm,
2918
+ useWatch,
2919
+ validatorRegistry
2920
+ };
2921
+ //# sourceMappingURL=index.mjs.map