@pungfe/element 0.0.1-alpha.4

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.js ADDED
@@ -0,0 +1,1382 @@
1
+ import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, useModel, inject, mergeModels, computed, toValue, onMounted, nextTick, getCurrentScope, onScopeDispose, getCurrentInstance, shallowRef, watch, createElementBlock, Fragment, renderList, useSlots, createSlots, normalizeProps, guardReactiveProps, ref, provide, createVNode, resolveComponent, createTextVNode, useTemplateRef, toDisplayString, normalizeClass } from "vue";
2
+ import { ElButton, ElCascader, ElCheckboxGroup, ElCheckbox, ElColorPicker, ElDialog, ElDivider, ElForm, ElFormItem, ElMessage, ElImage, ElInput, ElPagination, ElRate, ElPopconfirm, ElScrollbar, ElSpace, ElTable, ElTableColumn, ElTabs, ElText, ElUpload } from "element-plus";
3
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
4
+ __name: "XButton",
5
+ props: {
6
+ size: {},
7
+ disabled: { type: Boolean, default: void 0 },
8
+ type: {},
9
+ icon: {},
10
+ nativeType: {},
11
+ loading: { type: Boolean },
12
+ loadingIcon: {},
13
+ plain: { type: Boolean },
14
+ text: { type: Boolean },
15
+ link: { type: Boolean },
16
+ bg: { type: Boolean },
17
+ autofocus: { type: Boolean },
18
+ round: { type: Boolean },
19
+ circle: { type: Boolean },
20
+ color: {},
21
+ dark: { type: Boolean },
22
+ autoInsertSpace: { type: Boolean },
23
+ tag: {}
24
+ },
25
+ emits: ["click"],
26
+ setup(__props, { emit: __emit }) {
27
+ const props = __props;
28
+ const emit = __emit;
29
+ return (_ctx, _cache) => {
30
+ return openBlock(), createBlock(unref(ElButton), mergeProps(props, {
31
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("click", $event))
32
+ }), {
33
+ default: withCtx(() => [
34
+ renderSlot(_ctx.$slots, "default")
35
+ ]),
36
+ _: 3
37
+ }, 16);
38
+ };
39
+ }
40
+ });
41
+ const X_FORM_ITEM_LABEL = /* @__PURE__ */ Symbol("X_FORM_ITEM_LABEL");
42
+ const X_FORM_VALIDATIONS = /* @__PURE__ */ Symbol("X_FORM_VALIDATIONS");
43
+ const X_FORM_ITEM_VALIDATION = /* @__PURE__ */ Symbol(
44
+ "X_FORM_ITEM_VALIDATION"
45
+ );
46
+ const X_FORM_TAB_UPDATE_HOOK = /* @__PURE__ */ Symbol(
47
+ "X_FORM_TAB_UPDATE_HOOK"
48
+ );
49
+ const X_TAB_PANES = /* @__PURE__ */ Symbol("X_TAB_PANES");
50
+ const X_TAB_PANE = /* @__PURE__ */ Symbol("X_TAB_PANE");
51
+ const X_TABLE_QUERY_UPDATE_HOOK = /* @__PURE__ */ Symbol(
52
+ "X_TABLE_QUERY_UPDATE_HOOK"
53
+ );
54
+ const X_TABLE_QUERY_EXECUTE_HOOK = /* @__PURE__ */ Symbol(
55
+ "X_TABLE_QUERY_EXECUTE_HOOK"
56
+ );
57
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
58
+ __name: "XCascader",
59
+ props: /* @__PURE__ */ mergeModels({
60
+ clearable: {
61
+ type: Boolean
62
+ },
63
+ placeholder: {
64
+ default: "请选择"
65
+ },
66
+ disabled: {
67
+ type: Boolean,
68
+ default: void 0
69
+ },
70
+ props: {}
71
+ }, {
72
+ "modelValue": {},
73
+ "modelModifiers": {}
74
+ }),
75
+ emits: /* @__PURE__ */ mergeModels(["blur", "change"], ["update:modelValue"]),
76
+ setup(__props, {
77
+ emit: __emit
78
+ }) {
79
+ const props = __props;
80
+ const emit = __emit;
81
+ const model = useModel(__props, "modelValue");
82
+ const formItemValidation = inject(X_FORM_ITEM_VALIDATION, void 0);
83
+ if (formItemValidation?.required) {
84
+ const {
85
+ validator,
86
+ label
87
+ } = formItemValidation;
88
+ formItemValidation.validator = () => {
89
+ if (!model.value) {
90
+ return `请输入${label}`;
91
+ }
92
+ return validator?.();
93
+ };
94
+ }
95
+ const formItemLabel = inject(X_FORM_ITEM_LABEL, void 0);
96
+ const tableQueryUpdateHook = inject(X_TABLE_QUERY_UPDATE_HOOK, void 0);
97
+ const tableQueryExecuteHook = inject(X_TABLE_QUERY_EXECUTE_HOOK, void 0);
98
+ tableQueryUpdateHook?.on(([label, value]) => formItemLabel === label && value === void 0 && (model.value = void 0));
99
+ tableQueryExecuteHook?.on(() => formItemLabel && tableQueryUpdateHook?.trigger([formItemLabel, model.value]));
100
+ const blur = () => {
101
+ formItemValidation?.validate();
102
+ emit("blur");
103
+ };
104
+ return (_ctx, _cache) => {
105
+ return openBlock(), createBlock(unref(ElCascader), mergeProps(props, {
106
+ modelValue: model.value,
107
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
108
+ onBlur: blur
109
+ }), null, 16, ["modelValue"]);
110
+ };
111
+ }
112
+ });
113
+ function tryOnScopeDispose(fn, failSilently) {
114
+ if (getCurrentScope()) {
115
+ onScopeDispose(fn, failSilently);
116
+ return true;
117
+ }
118
+ return false;
119
+ }
120
+ const isClient = typeof window !== "undefined" && typeof document !== "undefined";
121
+ typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
122
+ function toArray(value) {
123
+ return Array.isArray(value) ? value : [value];
124
+ }
125
+ function getLifeCycleTarget(target) {
126
+ return getCurrentInstance();
127
+ }
128
+ function tryOnMounted(fn, sync = true, target) {
129
+ if (getLifeCycleTarget()) onMounted(fn, target);
130
+ else if (sync) fn();
131
+ else nextTick(fn);
132
+ }
133
+ // @__NO_SIDE_EFFECTS__
134
+ function useArrayMap(list, fn) {
135
+ return computed(() => toValue(list).map((i) => toValue(i)).map(fn));
136
+ }
137
+ const defaultWindow = isClient ? window : void 0;
138
+ function unrefElement(elRef) {
139
+ var _$el;
140
+ const plain = toValue(elRef);
141
+ return (_$el = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _$el !== void 0 ? _$el : plain;
142
+ }
143
+ // @__NO_SIDE_EFFECTS__
144
+ function useMounted() {
145
+ const isMounted = shallowRef(false);
146
+ const instance = getCurrentInstance();
147
+ if (instance) onMounted(() => {
148
+ isMounted.value = true;
149
+ }, instance);
150
+ return isMounted;
151
+ }
152
+ // @__NO_SIDE_EFFECTS__
153
+ function useSupported(callback) {
154
+ const isMounted = /* @__PURE__ */ useMounted();
155
+ return computed(() => {
156
+ isMounted.value;
157
+ return Boolean(callback());
158
+ });
159
+ }
160
+ function useResizeObserver(target, callback, options = {}) {
161
+ const { window: window$1 = defaultWindow, ...observerOptions } = options;
162
+ let observer;
163
+ const isSupported = /* @__PURE__ */ useSupported(() => window$1 && "ResizeObserver" in window$1);
164
+ const cleanup = () => {
165
+ if (observer) {
166
+ observer.disconnect();
167
+ observer = void 0;
168
+ }
169
+ };
170
+ const stopWatch = watch(computed(() => {
171
+ const _targets = toValue(target);
172
+ return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
173
+ }), (els) => {
174
+ cleanup();
175
+ if (isSupported.value && window$1) {
176
+ observer = new ResizeObserver(callback);
177
+ for (const _el of els) if (_el) observer.observe(_el, observerOptions);
178
+ }
179
+ }, {
180
+ immediate: true,
181
+ flush: "post"
182
+ });
183
+ const stop = () => {
184
+ cleanup();
185
+ stopWatch();
186
+ };
187
+ tryOnScopeDispose(stop);
188
+ return {
189
+ isSupported,
190
+ stop
191
+ };
192
+ }
193
+ function useElementSize(target, initialSize = {
194
+ width: 0,
195
+ height: 0
196
+ }, options = {}) {
197
+ const { window: window$1 = defaultWindow, box = "content-box" } = options;
198
+ const isSVG = computed(() => {
199
+ var _unrefElement;
200
+ return (_unrefElement = unrefElement(target)) === null || _unrefElement === void 0 || (_unrefElement = _unrefElement.namespaceURI) === null || _unrefElement === void 0 ? void 0 : _unrefElement.includes("svg");
201
+ });
202
+ const width = shallowRef(initialSize.width);
203
+ const height = shallowRef(initialSize.height);
204
+ const { stop: stop1 } = useResizeObserver(target, ([entry]) => {
205
+ const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
206
+ if (window$1 && isSVG.value) {
207
+ const $elem = unrefElement(target);
208
+ if ($elem) {
209
+ const rect = $elem.getBoundingClientRect();
210
+ width.value = rect.width;
211
+ height.value = rect.height;
212
+ }
213
+ } else if (boxSize) {
214
+ const formatBoxSize = toArray(boxSize);
215
+ width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
216
+ height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
217
+ } else {
218
+ width.value = entry.contentRect.width;
219
+ height.value = entry.contentRect.height;
220
+ }
221
+ }, options);
222
+ tryOnMounted(() => {
223
+ const ele = unrefElement(target);
224
+ if (ele) {
225
+ width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
226
+ height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
227
+ }
228
+ });
229
+ const stop2 = watch(() => unrefElement(target), (ele) => {
230
+ width.value = ele ? initialSize.width : 0;
231
+ height.value = ele ? initialSize.height : 0;
232
+ });
233
+ function stop() {
234
+ stop1();
235
+ stop2();
236
+ }
237
+ return {
238
+ width,
239
+ height,
240
+ stop
241
+ };
242
+ }
243
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
244
+ __name: "XCheckbox",
245
+ props: /* @__PURE__ */ mergeModels({
246
+ data: {},
247
+ factory: {
248
+ type: Function
249
+ },
250
+ identify: {
251
+ type: Function
252
+ },
253
+ ariaControls: {},
254
+ label: {},
255
+ value: {},
256
+ indeterminate: {
257
+ type: Boolean
258
+ },
259
+ disabled: {
260
+ type: Boolean
261
+ },
262
+ checked: {
263
+ type: Boolean
264
+ },
265
+ name: {},
266
+ trueValue: {},
267
+ falseValue: {},
268
+ trueLabel: {},
269
+ falseLabel: {},
270
+ id: {},
271
+ border: {
272
+ type: Boolean
273
+ },
274
+ size: {},
275
+ tabindex: {},
276
+ validateEvent: {
277
+ type: Boolean
278
+ },
279
+ ariaLabel: {}
280
+ }, {
281
+ "modelValue": {},
282
+ "modelModifiers": {}
283
+ }),
284
+ emits: ["update:modelValue"],
285
+ setup(__props) {
286
+ const model = useModel(__props, "modelValue");
287
+ const init = /* @__PURE__ */ useArrayMap(() => __props.data, __props.factory);
288
+ const options = computed(() => [...init.value]);
289
+ const forward = (value) => {
290
+ if (typeof value === "object") {
291
+ if (__props.identify) {
292
+ return __props.identify(value);
293
+ } else {
294
+ throw new Error("`identify` is required when value's type extends `object` or `object[]`");
295
+ }
296
+ } else {
297
+ return value;
298
+ }
299
+ };
300
+ const backward = (key) => options.value.map((item) => item.value).find((item) => forward(item) === key);
301
+ const _options = computed(() => options.value.map((item) => {
302
+ const key = forward(item.value);
303
+ return {
304
+ ...item,
305
+ key,
306
+ value: key
307
+ };
308
+ }));
309
+ const _model = computed({
310
+ get: () => model.value && model.value.map(forward),
311
+ set: (val) => model.value = Array.isArray(val) ? val.map((item) => backward(item)) : []
312
+ });
313
+ const formItemValidation = inject(X_FORM_ITEM_VALIDATION, void 0);
314
+ if (formItemValidation?.required) {
315
+ const {
316
+ validator,
317
+ label
318
+ } = formItemValidation;
319
+ formItemValidation.validator = () => {
320
+ if (!model.value || Array.isArray(model.value) && model.value.length === 0) {
321
+ return `请选择${label}`;
322
+ }
323
+ return validator?.();
324
+ };
325
+ }
326
+ return (_ctx, _cache) => {
327
+ return openBlock(), createBlock(unref(ElCheckboxGroup), mergeProps({
328
+ modelValue: _model.value,
329
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _model.value = $event)
330
+ }, {
331
+ disabled: __props.disabled,
332
+ size: __props.size
333
+ }), {
334
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_options.value, (item) => {
335
+ return openBlock(), createBlock(unref(ElCheckbox), {
336
+ key: item.key,
337
+ disabled: item.disabled,
338
+ label: item.label,
339
+ value: item.value
340
+ }, null, 8, ["disabled", "label", "value"]);
341
+ }), 128))]),
342
+ _: 1
343
+ }, 16, ["modelValue"]);
344
+ };
345
+ }
346
+ });
347
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
348
+ __name: "XColorPicker",
349
+ props: /* @__PURE__ */ mergeModels({
350
+ clearable: {
351
+ type: Boolean
352
+ },
353
+ disabled: {
354
+ type: Boolean,
355
+ default: void 0
356
+ }
357
+ }, {
358
+ "modelValue": {},
359
+ "modelModifiers": {}
360
+ }),
361
+ emits: ["update:modelValue"],
362
+ setup(__props) {
363
+ const props = __props;
364
+ const model = useModel(__props, "modelValue");
365
+ const formItemValidation = inject(X_FORM_ITEM_VALIDATION, void 0);
366
+ if (formItemValidation?.required) {
367
+ const {
368
+ validator,
369
+ label
370
+ } = formItemValidation;
371
+ formItemValidation.validator = () => {
372
+ if (!model.value) {
373
+ return `请输入${label}`;
374
+ }
375
+ return validator?.();
376
+ };
377
+ }
378
+ const formItemLabel = inject(X_FORM_ITEM_LABEL, void 0);
379
+ const tableQueryUpdateHook = inject(X_TABLE_QUERY_UPDATE_HOOK, void 0);
380
+ const tableQueryExecuteHook = inject(X_TABLE_QUERY_EXECUTE_HOOK, void 0);
381
+ tableQueryUpdateHook?.on(([label, value]) => formItemLabel === label && value === void 0 && (model.value = void 0));
382
+ tableQueryExecuteHook?.on(() => formItemLabel && tableQueryUpdateHook?.trigger([formItemLabel, model.value]));
383
+ return (_ctx, _cache) => {
384
+ return openBlock(), createBlock(unref(ElColorPicker), mergeProps(props, {
385
+ modelValue: model.value,
386
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event)
387
+ }), null, 16, ["modelValue"]);
388
+ };
389
+ }
390
+ });
391
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
392
+ __name: "XDialog",
393
+ props: /* @__PURE__ */ mergeModels({
394
+ title: {},
395
+ bodyClass: {}
396
+ }, {
397
+ "modelValue": {
398
+ type: Boolean
399
+ },
400
+ "modelModifiers": {}
401
+ }),
402
+ emits: ["update:modelValue"],
403
+ setup(__props) {
404
+ const {
405
+ header,
406
+ footer
407
+ } = useSlots();
408
+ const model = useModel(__props, "modelValue");
409
+ return (_ctx, _cache) => {
410
+ return openBlock(), createBlock(unref(ElDialog), {
411
+ modelValue: model.value,
412
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
413
+ title: __props.title,
414
+ "body-class": `flex flex-col ${__props.bodyClass}`
415
+ }, createSlots({
416
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
417
+ _: 2
418
+ }, [header ? {
419
+ name: "header",
420
+ fn: withCtx(() => [renderSlot(_ctx.$slots, "header")]),
421
+ key: "0"
422
+ } : void 0, footer ? {
423
+ name: "footer",
424
+ fn: withCtx(() => [renderSlot(_ctx.$slots, "footer")]),
425
+ key: "1"
426
+ } : void 0]), 1032, ["modelValue", "title", "body-class"]);
427
+ };
428
+ }
429
+ });
430
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
431
+ __name: "XDivider",
432
+ props: {
433
+ direction: {},
434
+ contentPosition: {},
435
+ borderStyle: {}
436
+ },
437
+ setup(__props) {
438
+ const props = __props;
439
+ return (_ctx, _cache) => {
440
+ return openBlock(), createBlock(unref(ElDivider), normalizeProps(guardReactiveProps(props)), {
441
+ default: withCtx(() => [
442
+ renderSlot(_ctx.$slots, "default")
443
+ ]),
444
+ _: 3
445
+ }, 16);
446
+ };
447
+ }
448
+ });
449
+ const XFormItem = /* @__PURE__ */ defineComponent((props, {
450
+ expose
451
+ }) => {
452
+ const tabPane = inject(X_TAB_PANE, void 0);
453
+ const formTabUpdateHook = inject(X_FORM_TAB_UPDATE_HOOK, void 0);
454
+ const error = ref();
455
+ const validation = {
456
+ label: props.label,
457
+ required: props.required,
458
+ clearValidate() {
459
+ error.value = void 0;
460
+ },
461
+ validate() {
462
+ error.value = validation.validator?.() ?? void 0;
463
+ if (error.value && tabPane?.name) {
464
+ ElMessage({
465
+ plain: true,
466
+ type: "warning",
467
+ message: error.value
468
+ });
469
+ formTabUpdateHook?.trigger(tabPane.name);
470
+ }
471
+ return !error.value;
472
+ }
473
+ };
474
+ const validations = inject(X_FORM_VALIDATIONS, void 0);
475
+ validations?.push(validation);
476
+ provide(X_FORM_ITEM_VALIDATION, validation);
477
+ expose({
478
+ ...validation
479
+ });
480
+ provide(X_FORM_ITEM_LABEL, props.label);
481
+ return () => createVNode(ElFormItem, mergeProps({
482
+ label: props.label,
483
+ labelPosition: props.labelPosition,
484
+ labelWidth: props.labelWidth,
485
+ required: props.required
486
+ }, {
487
+ "error": error.value
488
+ }), {
489
+ label: () => props.label,
490
+ default: () => props.content?.()
491
+ });
492
+ }, {
493
+ props: ["label", "required", "content", "tooltip"]
494
+ });
495
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
496
+ __name: "XForm",
497
+ props: {
498
+ content: {
499
+ type: Function
500
+ },
501
+ data: {
502
+ default: () => () => {
503
+ }
504
+ },
505
+ disabled: {
506
+ type: Boolean
507
+ },
508
+ inline: {
509
+ type: Boolean
510
+ },
511
+ labelWidth: {},
512
+ labelPosition: {},
513
+ statusIcon: {
514
+ type: Boolean,
515
+ default: true
516
+ }
517
+ },
518
+ setup(__props, {
519
+ expose: __expose
520
+ }) {
521
+ const form = ref();
522
+ const validations = [];
523
+ provide(X_FORM_VALIDATIONS, validations);
524
+ const validate = () => validations.every((item) => item.validate());
525
+ const resetFields = () => {
526
+ form.value?.resetFields();
527
+ validations.forEach((item) => item.clearValidate());
528
+ };
529
+ __expose({
530
+ data: __props.data,
531
+ validate,
532
+ resetFields
533
+ });
534
+ const Content = () => __props.content?.({
535
+ data: __props.data
536
+ });
537
+ return (_ctx, _cache) => {
538
+ return openBlock(), createBlock(unref(ElForm), mergeProps({
539
+ ref_key: "form",
540
+ ref: form
541
+ }, {
542
+ inline: __props.inline,
543
+ disabled: __props.disabled,
544
+ labelWidth: __props.labelWidth,
545
+ model: __props.data,
546
+ labelPosition: __props.labelPosition,
547
+ statusIcon: __props.statusIcon
548
+ }), {
549
+ default: withCtx(() => [createVNode(Content)]),
550
+ _: 1
551
+ }, 16);
552
+ };
553
+ }
554
+ });
555
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
556
+ __name: "XImage",
557
+ props: {
558
+ hideOnClickModal: { type: Boolean },
559
+ src: {},
560
+ fit: {},
561
+ loading: {},
562
+ lazy: { type: Boolean },
563
+ scrollContainer: {},
564
+ previewSrcList: {},
565
+ previewTeleported: { type: Boolean },
566
+ zIndex: {},
567
+ initialIndex: {},
568
+ infinite: { type: Boolean },
569
+ closeOnPressEscape: { type: Boolean },
570
+ zoomRate: {},
571
+ scale: {},
572
+ minScale: {},
573
+ maxScale: {},
574
+ showProgress: { type: Boolean },
575
+ crossorigin: {}
576
+ },
577
+ setup(__props) {
578
+ const props = __props;
579
+ return (_ctx, _cache) => {
580
+ return openBlock(), createBlock(unref(ElImage), normalizeProps(guardReactiveProps(props)), null, 16);
581
+ };
582
+ }
583
+ });
584
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
585
+ __name: "XInput",
586
+ props: /* @__PURE__ */ mergeModels({
587
+ clearable: {
588
+ type: Boolean
589
+ },
590
+ placeholder: {
591
+ default: "请输入"
592
+ },
593
+ disabled: {
594
+ type: Boolean,
595
+ default: void 0
596
+ },
597
+ size: {},
598
+ type: {},
599
+ showPassword: {
600
+ type: Boolean
601
+ },
602
+ autosize: {}
603
+ }, {
604
+ "modelValue": {},
605
+ "modelModifiers": {}
606
+ }),
607
+ emits: /* @__PURE__ */ mergeModels(["blur", "change"], ["update:modelValue"]),
608
+ setup(__props, {
609
+ emit: __emit
610
+ }) {
611
+ const props = __props;
612
+ const emit = __emit;
613
+ const model = useModel(__props, "modelValue");
614
+ const formItemValidation = inject(X_FORM_ITEM_VALIDATION, void 0);
615
+ if (formItemValidation?.required) {
616
+ const {
617
+ validator,
618
+ label
619
+ } = formItemValidation;
620
+ formItemValidation.validator = () => {
621
+ if (!model.value) {
622
+ return `请输入${label}`;
623
+ }
624
+ return validator?.();
625
+ };
626
+ }
627
+ const formItemLabel = inject(X_FORM_ITEM_LABEL, void 0);
628
+ const tableQueryUpdateHook = inject(X_TABLE_QUERY_UPDATE_HOOK, void 0);
629
+ const tableQueryExecuteHook = inject(X_TABLE_QUERY_EXECUTE_HOOK, void 0);
630
+ tableQueryUpdateHook?.on(([label, value]) => formItemLabel === label && value === void 0 && (model.value = void 0));
631
+ tableQueryExecuteHook?.on(() => formItemLabel && tableQueryUpdateHook?.trigger([formItemLabel, model.value]));
632
+ const change = (value) => emit("change", value);
633
+ const blur = () => {
634
+ formItemValidation?.validate();
635
+ emit("blur");
636
+ };
637
+ return (_ctx, _cache) => {
638
+ return openBlock(), createBlock(unref(ElInput), mergeProps(props, {
639
+ modelValue: model.value,
640
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
641
+ onBlur: blur,
642
+ onChange: change
643
+ }), null, 16, ["modelValue"]);
644
+ };
645
+ }
646
+ });
647
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
648
+ __name: "XInputNumber",
649
+ props: /* @__PURE__ */ mergeModels({
650
+ placeholder: {
651
+ default: "请输入"
652
+ },
653
+ disabled: {
654
+ type: Boolean,
655
+ default: void 0
656
+ },
657
+ align: {
658
+ default: "left"
659
+ },
660
+ size: {},
661
+ step: {},
662
+ max: {},
663
+ min: {},
664
+ controls: {
665
+ type: Boolean
666
+ },
667
+ precision: {},
668
+ stepStrictly: {
669
+ type: Boolean
670
+ }
671
+ }, {
672
+ "modelValue": {},
673
+ "modelModifiers": {}
674
+ }),
675
+ emits: /* @__PURE__ */ mergeModels(["blur"], ["update:modelValue"]),
676
+ setup(__props, {
677
+ emit: __emit
678
+ }) {
679
+ const props = __props;
680
+ const emit = __emit;
681
+ const model = useModel(__props, "modelValue");
682
+ const formItemValidation = inject(X_FORM_ITEM_VALIDATION, void 0);
683
+ if (formItemValidation?.required) {
684
+ const {
685
+ validator,
686
+ label
687
+ } = formItemValidation;
688
+ formItemValidation.validator = () => {
689
+ if (model.value === void 0) {
690
+ return `请输入${label}`;
691
+ }
692
+ return validator?.();
693
+ };
694
+ }
695
+ const blur = () => {
696
+ formItemValidation?.validate();
697
+ emit("blur");
698
+ };
699
+ return (_ctx, _cache) => {
700
+ const _component_ElInputNumber = resolveComponent("ElInputNumber");
701
+ return openBlock(), createBlock(_component_ElInputNumber, mergeProps(props, {
702
+ modelValue: model.value,
703
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
704
+ onBlur: blur
705
+ }), null, 16, ["modelValue"]);
706
+ };
707
+ }
708
+ });
709
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
710
+ __name: "XPagination",
711
+ props: /* @__PURE__ */ mergeModels({
712
+ sizes: { default: () => [20, 50, 100] },
713
+ pageSize: {},
714
+ defaultPageSize: {},
715
+ total: {},
716
+ pageCount: {},
717
+ pagerCount: {},
718
+ currentPage: {},
719
+ defaultCurrentPage: {},
720
+ layout: { default: "prev, pager, next, jumper, ->, total" },
721
+ popperClass: {},
722
+ popperStyle: {},
723
+ prevText: {},
724
+ prevIcon: {},
725
+ nextText: {},
726
+ nextIcon: {},
727
+ teleported: { type: Boolean },
728
+ small: { type: Boolean },
729
+ size: {},
730
+ background: { type: Boolean, default: true },
731
+ disabled: { type: Boolean },
732
+ hideOnSinglePage: { type: Boolean },
733
+ appendSizeTo: {}
734
+ }, {
735
+ "size": {},
736
+ "sizeModifiers": {},
737
+ "current": {},
738
+ "currentModifiers": {}
739
+ }),
740
+ emits: /* @__PURE__ */ mergeModels(["sizeChange", "currentChange"], ["update:size", "update:current"]),
741
+ setup(__props, { emit: __emit }) {
742
+ const emit = __emit;
743
+ const size = useModel(__props, "size");
744
+ const current = useModel(__props, "current");
745
+ return (_ctx, _cache) => {
746
+ return openBlock(), createBlock(unref(ElPagination), mergeProps({ background: __props.background, pageSizes: __props.sizes, layout: __props.layout, total: __props.total }, {
747
+ "current-page": current.value,
748
+ "onUpdate:currentPage": _cache[0] || (_cache[0] = ($event) => current.value = $event),
749
+ "page-size": size.value,
750
+ "onUpdate:pageSize": _cache[1] || (_cache[1] = ($event) => size.value = $event),
751
+ onSizeChange: _cache[2] || (_cache[2] = ($event) => emit("sizeChange", $event)),
752
+ onCurrentChange: _cache[3] || (_cache[3] = ($event) => emit("currentChange", $event))
753
+ }), null, 16, ["current-page", "page-size"]);
754
+ };
755
+ }
756
+ });
757
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
758
+ __name: "XRate",
759
+ props: /* @__PURE__ */ mergeModels({
760
+ ariaLabel: {},
761
+ id: {},
762
+ lowThreshold: {},
763
+ highThreshold: {},
764
+ max: {},
765
+ colors: {},
766
+ voidColor: {},
767
+ disabledVoidColor: {},
768
+ icons: {},
769
+ voidIcon: {},
770
+ disabledVoidIcon: {},
771
+ disabled: {
772
+ type: Boolean,
773
+ default: void 0
774
+ },
775
+ allowHalf: {
776
+ type: Boolean
777
+ },
778
+ showText: {
779
+ type: Boolean
780
+ },
781
+ showScore: {
782
+ type: Boolean
783
+ },
784
+ textColor: {},
785
+ texts: {},
786
+ scoreTemplate: {},
787
+ size: {},
788
+ clearable: {
789
+ type: Boolean
790
+ }
791
+ }, {
792
+ "modelValue": {},
793
+ "modelModifiers": {}
794
+ }),
795
+ emits: ["update:modelValue"],
796
+ setup(__props) {
797
+ const props = __props;
798
+ const model = useModel(__props, "modelValue");
799
+ return (_ctx, _cache) => {
800
+ return openBlock(), createBlock(unref(ElRate), mergeProps(props, {
801
+ modelValue: model.value,
802
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event)
803
+ }), null, 16, ["modelValue"]);
804
+ };
805
+ }
806
+ });
807
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
808
+ __name: "XReconfirm",
809
+ props: {
810
+ title: { default: "是否执行?" }
811
+ },
812
+ emits: ["cancel", "confirm"],
813
+ setup(__props, { emit: __emit }) {
814
+ const emit = __emit;
815
+ return (_ctx, _cache) => {
816
+ const _component_XButton = resolveComponent("XButton");
817
+ return openBlock(), createBlock(unref(ElPopconfirm), {
818
+ title: __props.title,
819
+ onCancel: _cache[0] || (_cache[0] = () => emit("cancel")),
820
+ onConfirm: _cache[1] || (_cache[1] = () => emit("confirm"))
821
+ }, {
822
+ reference: withCtx(() => [
823
+ renderSlot(_ctx.$slots, "default")
824
+ ]),
825
+ actions: withCtx(({ confirm, cancel }) => [
826
+ createVNode(_component_XButton, {
827
+ size: "small",
828
+ onClick: cancel
829
+ }, {
830
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [
831
+ createTextVNode(" 取消 ", -1)
832
+ ])]),
833
+ _: 1
834
+ }, 8, ["onClick"]),
835
+ createVNode(_component_XButton, {
836
+ type: "danger",
837
+ size: "small",
838
+ onClick: confirm
839
+ }, {
840
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [
841
+ createTextVNode(" 确定 ", -1)
842
+ ])]),
843
+ _: 1
844
+ }, 8, ["onClick"])
845
+ ]),
846
+ _: 3
847
+ }, 8, ["title"]);
848
+ };
849
+ }
850
+ });
851
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
852
+ __name: "XScrollbar",
853
+ props: {
854
+ ariaLabel: {},
855
+ ariaOrientation: {},
856
+ distance: {},
857
+ height: {},
858
+ maxHeight: {},
859
+ native: {
860
+ type: Boolean
861
+ },
862
+ wrapStyle: {},
863
+ wrapClass: {},
864
+ viewClass: {},
865
+ viewStyle: {},
866
+ noresize: {
867
+ type: Boolean
868
+ },
869
+ tag: {},
870
+ always: {
871
+ type: Boolean
872
+ },
873
+ minSize: {},
874
+ tabindex: {},
875
+ id: {},
876
+ role: {}
877
+ },
878
+ setup(__props, {
879
+ expose: __expose
880
+ }) {
881
+ const props = __props;
882
+ const el = useTemplateRef("scrollbar");
883
+ const wrapRef = computed(() => el.value?.wrapRef);
884
+ const viewRef = computed(() => wrapRef.value?.firstElementChild);
885
+ __expose({
886
+ wrapRef,
887
+ viewRef
888
+ });
889
+ return (_ctx, _cache) => {
890
+ return openBlock(), createBlock(unref(ElScrollbar), mergeProps({
891
+ ref: "scrollbar"
892
+ }, props), {
893
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
894
+ _: 3
895
+ }, 16);
896
+ };
897
+ }
898
+ });
899
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
900
+ __name: "XSelect",
901
+ props: /* @__PURE__ */ mergeModels({
902
+ data: {},
903
+ factory: {
904
+ type: Function
905
+ },
906
+ identify: {
907
+ type: Function
908
+ },
909
+ supplement: {
910
+ type: Function
911
+ },
912
+ ariaLabel: {},
913
+ emptyValues: {},
914
+ valueOnClear: {},
915
+ name: {},
916
+ id: {},
917
+ autocomplete: {},
918
+ automaticDropdown: {
919
+ type: Boolean
920
+ },
921
+ size: {},
922
+ effect: {},
923
+ disabled: {
924
+ type: Boolean,
925
+ default: () => void 0
926
+ },
927
+ clearable: {
928
+ type: Boolean
929
+ },
930
+ filterable: {
931
+ type: Boolean
932
+ },
933
+ allowCreate: {
934
+ type: Boolean
935
+ },
936
+ loading: {
937
+ type: Boolean
938
+ },
939
+ popperClass: {},
940
+ popperStyle: {},
941
+ popperOptions: {},
942
+ remote: {
943
+ type: Boolean
944
+ },
945
+ debounce: {},
946
+ loadingText: {},
947
+ noMatchText: {},
948
+ noDataText: {},
949
+ remoteMethod: {},
950
+ filterMethod: {},
951
+ multiple: {
952
+ type: Boolean
953
+ },
954
+ multipleLimit: {},
955
+ placeholder: {
956
+ default: "请选择"
957
+ },
958
+ defaultFirstOption: {
959
+ type: Boolean
960
+ },
961
+ reserveKeyword: {
962
+ type: Boolean
963
+ },
964
+ valueKey: {},
965
+ collapseTags: {
966
+ type: Boolean
967
+ },
968
+ collapseTagsTooltip: {
969
+ type: Boolean
970
+ },
971
+ maxCollapseTags: {},
972
+ teleported: {
973
+ type: Boolean
974
+ },
975
+ persistent: {
976
+ type: Boolean
977
+ },
978
+ clearIcon: {},
979
+ fitInputWidth: {
980
+ type: Boolean
981
+ },
982
+ suffixIcon: {},
983
+ tagType: {},
984
+ tagEffect: {},
985
+ validateEvent: {
986
+ type: Boolean
987
+ },
988
+ remoteShowSuffix: {
989
+ type: Boolean
990
+ },
991
+ showArrow: {
992
+ type: Boolean
993
+ },
994
+ offset: {},
995
+ placement: {},
996
+ fallbackPlacements: {},
997
+ tabindex: {},
998
+ appendTo: {},
999
+ options: {},
1000
+ props: {}
1001
+ }, {
1002
+ "modelValue": {},
1003
+ "modelModifiers": {}
1004
+ }),
1005
+ emits: /* @__PURE__ */ mergeModels(["blur", "change"], ["update:modelValue"]),
1006
+ setup(__props, {
1007
+ emit: __emit
1008
+ }) {
1009
+ const emit = __emit;
1010
+ const model = useModel(__props, "modelValue");
1011
+ const supplements = ref([]);
1012
+ const init = /* @__PURE__ */ useArrayMap(() => __props.data, __props.factory);
1013
+ const options = computed(() => [...(/* @__PURE__ */ useArrayMap(supplements, __props.factory)).value, ...init.value]);
1014
+ const forward = (value) => {
1015
+ if (typeof value === "object") {
1016
+ if (__props.identify) {
1017
+ return __props.identify(value);
1018
+ } else {
1019
+ throw new Error("`identify` is required when value's type extends `object` or `object[]`");
1020
+ }
1021
+ } else {
1022
+ return value;
1023
+ }
1024
+ };
1025
+ const backward = (key) => options.value.map((item) => item.value).find((item) => forward(item) === key);
1026
+ let no = 0;
1027
+ watch([model, init], async () => {
1028
+ no++;
1029
+ if (model.value) {
1030
+ const lacks = [].concat(model.value).filter((item) => !init.value.map((it) => forward(it.value)).includes(forward(item)));
1031
+ const _no = no;
1032
+ const data = await __props.supplement?.(lacks);
1033
+ if (_no === no && data) {
1034
+ supplements.value = data;
1035
+ }
1036
+ } else {
1037
+ supplements.value = [];
1038
+ }
1039
+ }, {
1040
+ immediate: true
1041
+ });
1042
+ const _options = computed(() => options.value.map((item) => {
1043
+ const key = forward(item.value);
1044
+ return {
1045
+ ...item,
1046
+ key,
1047
+ value: key
1048
+ };
1049
+ }));
1050
+ const _model = computed({
1051
+ get: () => model.value && (Array.isArray(model.value) ? model.value.map(forward) : forward(model.value)),
1052
+ set: (val) => {
1053
+ if (Array.isArray(val)) {
1054
+ model.value = val.map((item) => backward(item));
1055
+ } else {
1056
+ model.value = val === void 0 ? void 0 : backward(val) || (__props.allowCreate ? val : void 0);
1057
+ }
1058
+ }
1059
+ });
1060
+ const formItemValidation = inject(X_FORM_ITEM_VALIDATION, void 0);
1061
+ if (formItemValidation?.required) {
1062
+ const {
1063
+ validator,
1064
+ label
1065
+ } = formItemValidation;
1066
+ formItemValidation.validator = () => {
1067
+ if (!model.value || Array.isArray(model.value) && model.value.length === 0) {
1068
+ return `请选择${label}`;
1069
+ }
1070
+ return validator?.();
1071
+ };
1072
+ }
1073
+ const formItemLabel = inject(X_FORM_ITEM_LABEL, void 0);
1074
+ const tableQueryUpdateHook = inject(X_TABLE_QUERY_UPDATE_HOOK, void 0);
1075
+ const tableQueryExecuteHook = inject(X_TABLE_QUERY_EXECUTE_HOOK, void 0);
1076
+ tableQueryUpdateHook?.on(([label, value]) => formItemLabel === label && value === void 0 && (_model.value = void 0));
1077
+ tableQueryExecuteHook?.on(() => formItemLabel && tableQueryUpdateHook?.trigger([formItemLabel, _model.value === void 0 ? void 0 : [].concat(_model.value).map((item) => _options.value.find((option) => option.value === item).label).join(",")]));
1078
+ const change = (value) => emit("change", value);
1079
+ const blur = () => {
1080
+ formItemValidation?.validate();
1081
+ emit("blur");
1082
+ };
1083
+ return (_ctx, _cache) => {
1084
+ const _component_ElOption = resolveComponent("ElOption");
1085
+ const _component_ElSelect = resolveComponent("ElSelect");
1086
+ return openBlock(), createBlock(_component_ElSelect, mergeProps({
1087
+ allowCreate: __props.allowCreate,
1088
+ clearable: __props.clearable,
1089
+ filterable: __props.filterable,
1090
+ remote: __props.remote,
1091
+ remoteMethod: __props.remoteMethod,
1092
+ placeholder: __props.placeholder,
1093
+ disabled: __props.disabled,
1094
+ size: __props.size,
1095
+ loading: __props.loading,
1096
+ multiple: __props.multiple,
1097
+ collapseTags: __props.collapseTags,
1098
+ collapseTagsTooltip: __props.collapseTags
1099
+ }, {
1100
+ modelValue: _model.value,
1101
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _model.value = $event),
1102
+ onBlur: blur,
1103
+ onChange: change
1104
+ }), {
1105
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_options.value, (item) => {
1106
+ return openBlock(), createBlock(_component_ElOption, {
1107
+ key: item.key,
1108
+ label: item.label,
1109
+ value: item.value
1110
+ }, {
1111
+ default: withCtx(() => [createTextVNode(toDisplayString(item.label), 1)]),
1112
+ _: 2
1113
+ }, 1032, ["label", "value"]);
1114
+ }), 128))]),
1115
+ _: 1
1116
+ }, 16, ["modelValue"]);
1117
+ };
1118
+ }
1119
+ });
1120
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1121
+ __name: "XSpace",
1122
+ props: {
1123
+ direction: {},
1124
+ class: {},
1125
+ style: {},
1126
+ alignment: {},
1127
+ prefixCls: {},
1128
+ spacer: {},
1129
+ wrap: {
1130
+ type: Boolean
1131
+ },
1132
+ fill: {
1133
+ type: Boolean
1134
+ },
1135
+ fillRatio: {},
1136
+ size: {}
1137
+ },
1138
+ setup(__props) {
1139
+ const props = __props;
1140
+ return (_ctx, _cache) => {
1141
+ return openBlock(), createBlock(unref(ElSpace), normalizeProps(guardReactiveProps(props)), {
1142
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1143
+ _: 3
1144
+ }, 16);
1145
+ };
1146
+ }
1147
+ });
1148
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1149
+ __name: "XTable",
1150
+ props: {
1151
+ data: {},
1152
+ height: {},
1153
+ columns: {},
1154
+ showOverflowTooltip: {
1155
+ type: Boolean
1156
+ },
1157
+ border: {
1158
+ type: Boolean
1159
+ },
1160
+ highlightCurrentRow: {
1161
+ type: Boolean
1162
+ },
1163
+ spanMethod: {
1164
+ type: Function
1165
+ }
1166
+ },
1167
+ emits: ["rowClick", "selectionChange", "headerDragend"],
1168
+ setup(__props, {
1169
+ emit: __emit
1170
+ }) {
1171
+ const emit = __emit;
1172
+ const container = useTemplateRef("container");
1173
+ const el = ref();
1174
+ const size = useElementSize(container);
1175
+ const _height = computed(() => __props.height ?? size.height.value);
1176
+ const X = () => createVNode(ElTable, mergeProps({
1177
+ "ref": el
1178
+ }, {
1179
+ data: __props.data,
1180
+ height: _height.value,
1181
+ showOverflowTooltip: __props.showOverflowTooltip,
1182
+ border: __props.border,
1183
+ highlightCurrentRow: __props.highlightCurrentRow,
1184
+ spanMethod: __props.spanMethod
1185
+ }, {
1186
+ "onRow-click": (row) => emit("rowClick", row),
1187
+ "onSelection-change": (rows) => emit("selectionChange", rows),
1188
+ "onHeader-dragend": (newWidth, oldWidth, column) => emit("headerDragend", newWidth, oldWidth, column)
1189
+ }), {
1190
+ default: () => __props.columns.map((column) => createVNode(ElTableColumn, column, {
1191
+ default: ({
1192
+ $index,
1193
+ row
1194
+ }) => column.content?.({
1195
+ index: $index,
1196
+ row
1197
+ }),
1198
+ header: () => column.header?.({
1199
+ column
1200
+ }) ?? column.label
1201
+ }))
1202
+ });
1203
+ return (_ctx, _cache) => {
1204
+ return openBlock(), createElementBlock("div", {
1205
+ ref_key: "container",
1206
+ ref: container,
1207
+ class: normalizeClass([__props.height === void 0 && "h-full"])
1208
+ }, [createVNode(X)], 2);
1209
+ };
1210
+ }
1211
+ });
1212
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1213
+ __name: "XTabs",
1214
+ props: /* @__PURE__ */ mergeModels({
1215
+ type: {},
1216
+ defaultValue: {},
1217
+ addable: {
1218
+ type: Boolean,
1219
+ default: () => void 0
1220
+ },
1221
+ editable: {
1222
+ type: Boolean,
1223
+ default: () => void 0
1224
+ },
1225
+ tabPosition: {}
1226
+ }, {
1227
+ "modelValue": {},
1228
+ "modelModifiers": {}
1229
+ }),
1230
+ emits: /* @__PURE__ */ mergeModels(["tabChange", "tabRemove"], ["update:modelValue"]),
1231
+ setup(__props, {
1232
+ emit: __emit
1233
+ }) {
1234
+ const emit = __emit;
1235
+ const model = useModel(__props, "modelValue");
1236
+ const panes = [];
1237
+ provide(X_TAB_PANES, panes);
1238
+ return (_ctx, _cache) => {
1239
+ return openBlock(), createBlock(unref(ElTabs), mergeProps({
1240
+ addable: __props.addable,
1241
+ editable: __props.editable,
1242
+ type: __props.type,
1243
+ defaultValue: __props.defaultValue,
1244
+ tabPosition: __props.tabPosition
1245
+ }, {
1246
+ modelValue: model.value,
1247
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
1248
+ onTabChange: _cache[1] || (_cache[1] = (name) => emit("tabChange", name)),
1249
+ onTabRemove: _cache[2] || (_cache[2] = (name) => emit("tabRemove", name))
1250
+ }), {
1251
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1252
+ _: 3
1253
+ }, 16, ["modelValue"]);
1254
+ };
1255
+ }
1256
+ });
1257
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1258
+ __name: "XText",
1259
+ props: {
1260
+ type: {},
1261
+ size: {},
1262
+ truncated: { type: Boolean, default: () => void 0 }
1263
+ },
1264
+ setup(__props) {
1265
+ return (_ctx, _cache) => {
1266
+ return openBlock(), createBlock(unref(ElText), normalizeProps(guardReactiveProps({ type: __props.type, size: __props.size, truncated: __props.truncated })), {
1267
+ default: withCtx(() => [
1268
+ renderSlot(_ctx.$slots, "default")
1269
+ ]),
1270
+ _: 3
1271
+ }, 16);
1272
+ };
1273
+ }
1274
+ });
1275
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1276
+ __name: "XUpload",
1277
+ props: /* @__PURE__ */ mergeModels({
1278
+ action: {},
1279
+ data: {
1280
+ type: Function
1281
+ },
1282
+ disabled: {
1283
+ type: Boolean,
1284
+ default: () => void 0
1285
+ },
1286
+ limit: {},
1287
+ multiple: {
1288
+ type: Boolean
1289
+ },
1290
+ showFileList: {
1291
+ type: Boolean,
1292
+ default: true
1293
+ },
1294
+ drag: {
1295
+ type: Boolean
1296
+ },
1297
+ accept: {},
1298
+ listType: {},
1299
+ maxSize: {
1300
+ default: () => Infinity
1301
+ }
1302
+ }, {
1303
+ "modelValue": {},
1304
+ "modelModifiers": {}
1305
+ }),
1306
+ emits: ["update:modelValue"],
1307
+ setup(__props) {
1308
+ const model = useModel(__props, "modelValue");
1309
+ const fileList = computed(() => [].concat(model.value ?? []).reverse().map((it) => ({
1310
+ name: it.split("/").findLast(() => true),
1311
+ url: it,
1312
+ uid: Number(it.slice(0, it.lastIndexOf("/")).split("/").findLast(() => true))
1313
+ })));
1314
+ const formItemValidation = inject(X_FORM_ITEM_VALIDATION, void 0);
1315
+ if (formItemValidation?.required) {
1316
+ const {
1317
+ validator,
1318
+ label
1319
+ } = formItemValidation;
1320
+ formItemValidation.validator = () => {
1321
+ if (!model.value || Array.isArray(model.value) && model.value.length === 0) {
1322
+ return `请上传${label}`;
1323
+ }
1324
+ return validator?.();
1325
+ };
1326
+ }
1327
+ const beforeUpload = (rawFile) => {
1328
+ if (rawFile.size > __props.maxSize) {
1329
+ ElMessage.warning("文件过大,请重新选择");
1330
+ }
1331
+ return rawFile.size < __props.maxSize;
1332
+ };
1333
+ const preview = (uploadFile) => window.open(uploadFile.url);
1334
+ const remove = (uploadFile, uploadFiles) => {
1335
+ model.value = Array.isArray(model.value) ? uploadFiles.map((it) => it.url) : void 0;
1336
+ };
1337
+ return (_ctx, _cache) => {
1338
+ return openBlock(), createBlock(unref(ElUpload), normalizeProps(guardReactiveProps({
1339
+ limit: __props.limit,
1340
+ disabled: __props.disabled,
1341
+ data: __props.data,
1342
+ maxSize: __props.maxSize,
1343
+ showFileList: __props.showFileList,
1344
+ fileList: fileList.value,
1345
+ beforeUpload,
1346
+ onPreview: preview,
1347
+ onRemove: remove
1348
+ })), {
1349
+ file: withCtx(({
1350
+ file
1351
+ }) => [renderSlot(_ctx.$slots, "file", {
1352
+ file
1353
+ })]),
1354
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1355
+ _: 3
1356
+ }, 16);
1357
+ };
1358
+ }
1359
+ });
1360
+ export {
1361
+ _sfc_main$j as XButton,
1362
+ _sfc_main$i as XCascader,
1363
+ _sfc_main$h as XCheckbox,
1364
+ _sfc_main$g as XColorPicker,
1365
+ _sfc_main$f as XDialog,
1366
+ _sfc_main$e as XDivider,
1367
+ _sfc_main$d as XForm,
1368
+ XFormItem,
1369
+ _sfc_main$c as XImage,
1370
+ _sfc_main$b as XInput,
1371
+ _sfc_main$a as XInputNumber,
1372
+ _sfc_main$9 as XPagination,
1373
+ _sfc_main$8 as XRate,
1374
+ _sfc_main$7 as XReconfirm,
1375
+ _sfc_main$6 as XScrollbar,
1376
+ _sfc_main$5 as XSelect,
1377
+ _sfc_main$4 as XSpace,
1378
+ _sfc_main$3 as XTable,
1379
+ _sfc_main$2 as XTabs,
1380
+ _sfc_main$1 as XText,
1381
+ _sfc_main as XUpload
1382
+ };