tiddy 2.2.0 → 2.3.0
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.d.ts +102 -70
- package/dist/index.js +83 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as vue46 from "vue";
|
|
2
2
|
import { AllowedComponentProps, CSSProperties, Component, DefineComponent, ExtractPublicPropTypes, PropType, Raw, Ref as Ref$1, Slot } from "vue";
|
|
3
3
|
import * as element_plus0 from "element-plus";
|
|
4
|
-
import { DialogInstance, DialogProps, FormInstance, FormItemProp, FormItemProps, FormItemRule, FormProps, TableColumnInstance, TableInstance } from "element-plus";
|
|
4
|
+
import { DialogInstance, DialogProps, FormInstance, FormItemProp, FormItemProps, FormItemRule, FormProps, SelectInstance, TableColumnInstance, TableInstance } from "element-plus";
|
|
5
5
|
|
|
6
6
|
//#region src/types.d.ts
|
|
7
7
|
type OrArray<T> = T | T[];
|
|
@@ -252,35 +252,35 @@ declare function isValidateError(prop: string): boolean;
|
|
|
252
252
|
declare const expose$1: {
|
|
253
253
|
reValidateErrorFields: typeof reValidateErrorFields;
|
|
254
254
|
isValidateError: typeof isValidateError;
|
|
255
|
-
model:
|
|
255
|
+
model: vue46.ComputedRef<unknown>;
|
|
256
256
|
};
|
|
257
257
|
type __TdFormExpose = typeof expose$1 & FormInstance;
|
|
258
|
-
declare var __VLS_11$
|
|
259
|
-
type __VLS_Slots$
|
|
260
|
-
prefix?: (props: typeof __VLS_11$
|
|
258
|
+
declare var __VLS_11$2: {}, __VLS_13$1: {}, __VLS_19$1: {};
|
|
259
|
+
type __VLS_Slots$4 = {} & {
|
|
260
|
+
prefix?: (props: typeof __VLS_11$2) => any;
|
|
261
261
|
} & {
|
|
262
262
|
default?: (props: typeof __VLS_13$1) => any;
|
|
263
263
|
} & {
|
|
264
264
|
suffix?: (props: typeof __VLS_19$1) => any;
|
|
265
265
|
};
|
|
266
|
-
declare const __VLS_base$
|
|
266
|
+
declare const __VLS_base$4: vue46.DefineComponent<vue46.ExtractPropTypes<{
|
|
267
267
|
fields: {
|
|
268
|
-
type:
|
|
268
|
+
type: vue46.PropType<TdFormFieldProps[]>;
|
|
269
269
|
default: () => never[];
|
|
270
270
|
};
|
|
271
271
|
item: {
|
|
272
|
-
type:
|
|
272
|
+
type: vue46.PropType<element_plus0.FormItemProps>;
|
|
273
273
|
default: () => {};
|
|
274
274
|
};
|
|
275
|
-
}>, __TdFormExpose, {}, {}, {},
|
|
275
|
+
}>, __TdFormExpose, {}, {}, {}, vue46.ComponentOptionsMixin, vue46.ComponentOptionsMixin, {
|
|
276
276
|
submit: (data: any) => any;
|
|
277
|
-
}, string,
|
|
277
|
+
}, string, vue46.PublicProps, Readonly<vue46.ExtractPropTypes<{
|
|
278
278
|
fields: {
|
|
279
|
-
type:
|
|
279
|
+
type: vue46.PropType<TdFormFieldProps[]>;
|
|
280
280
|
default: () => never[];
|
|
281
281
|
};
|
|
282
282
|
item: {
|
|
283
|
-
type:
|
|
283
|
+
type: vue46.PropType<element_plus0.FormItemProps>;
|
|
284
284
|
default: () => {};
|
|
285
285
|
};
|
|
286
286
|
}>> & Readonly<{
|
|
@@ -288,65 +288,65 @@ declare const __VLS_base$3: vue51.DefineComponent<vue51.ExtractPropTypes<{
|
|
|
288
288
|
}>, {
|
|
289
289
|
fields: TdFormFieldProps[];
|
|
290
290
|
item: element_plus0.FormItemProps;
|
|
291
|
-
}, {}, {}, {}, string,
|
|
292
|
-
declare const __VLS_export$
|
|
293
|
-
declare const _default$
|
|
294
|
-
type __VLS_WithSlots$
|
|
291
|
+
}, {}, {}, {}, string, vue46.ComponentProvideOptions, true, {}, any>;
|
|
292
|
+
declare const __VLS_export$6: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
|
|
293
|
+
declare const _default$2: typeof __VLS_export$6;
|
|
294
|
+
type __VLS_WithSlots$4<T, S> = T & {
|
|
295
295
|
new (): {
|
|
296
296
|
$slots: S;
|
|
297
297
|
};
|
|
298
298
|
};
|
|
299
299
|
//#endregion
|
|
300
300
|
//#region src/form/form-item.vue.d.ts
|
|
301
|
-
declare var __VLS_10: string | number, __VLS_11: any;
|
|
302
|
-
type __VLS_Slots$
|
|
303
|
-
declare const __VLS_base$
|
|
301
|
+
declare var __VLS_10$1: string | number, __VLS_11$1: any;
|
|
302
|
+
type __VLS_Slots$3 = {} & { [K in NonNullable<typeof __VLS_10$1>]?: (props: typeof __VLS_11$1) => any };
|
|
303
|
+
declare const __VLS_base$3: vue46.DefineComponent<vue46.ExtractPropTypes<{
|
|
304
304
|
messageLabel: {
|
|
305
|
-
type:
|
|
305
|
+
type: vue46.PropType<OrRef<string>>;
|
|
306
306
|
default: string;
|
|
307
307
|
};
|
|
308
308
|
formatMessage: {
|
|
309
|
-
type:
|
|
309
|
+
type: vue46.PropType<AnyFunction>;
|
|
310
310
|
default: null;
|
|
311
311
|
};
|
|
312
312
|
hideRequiredAsterisk: {
|
|
313
|
-
type:
|
|
313
|
+
type: vue46.PropType<boolean>;
|
|
314
314
|
default: boolean;
|
|
315
315
|
};
|
|
316
|
-
}>, {}, {}, {}, {},
|
|
316
|
+
}>, {}, {}, {}, {}, vue46.ComponentOptionsMixin, vue46.ComponentOptionsMixin, {}, string, vue46.PublicProps, Readonly<vue46.ExtractPropTypes<{
|
|
317
317
|
messageLabel: {
|
|
318
|
-
type:
|
|
318
|
+
type: vue46.PropType<OrRef<string>>;
|
|
319
319
|
default: string;
|
|
320
320
|
};
|
|
321
321
|
formatMessage: {
|
|
322
|
-
type:
|
|
322
|
+
type: vue46.PropType<AnyFunction>;
|
|
323
323
|
default: null;
|
|
324
324
|
};
|
|
325
325
|
hideRequiredAsterisk: {
|
|
326
|
-
type:
|
|
326
|
+
type: vue46.PropType<boolean>;
|
|
327
327
|
default: boolean;
|
|
328
328
|
};
|
|
329
329
|
}>> & Readonly<{}>, {
|
|
330
330
|
hideRequiredAsterisk: boolean;
|
|
331
331
|
messageLabel: any;
|
|
332
332
|
formatMessage: AnyFunction;
|
|
333
|
-
}, {}, {}, {}, string,
|
|
334
|
-
declare const __VLS_export$
|
|
335
|
-
declare const _default$
|
|
336
|
-
type __VLS_WithSlots$
|
|
333
|
+
}, {}, {}, {}, string, vue46.ComponentProvideOptions, true, {}, any>;
|
|
334
|
+
declare const __VLS_export$5: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
|
|
335
|
+
declare const _default$4: typeof __VLS_export$5;
|
|
336
|
+
type __VLS_WithSlots$3<T, S> = T & {
|
|
337
337
|
new (): {
|
|
338
338
|
$slots: S;
|
|
339
339
|
};
|
|
340
340
|
};
|
|
341
341
|
//#endregion
|
|
342
342
|
//#region src/form/form-field.vue.d.ts
|
|
343
|
-
declare const __VLS_export$
|
|
344
|
-
declare const _default$
|
|
343
|
+
declare const __VLS_export$4: vue46.DefineComponent<{}, {}, {}, {}, {}, vue46.ComponentOptionsMixin, vue46.ComponentOptionsMixin, {}, string, vue46.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue46.ComponentProvideOptions, true, {}, any>;
|
|
344
|
+
declare const _default$3: typeof __VLS_export$4;
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region src/form/index.d.ts
|
|
347
|
-
type Instance$2 = InstanceType<typeof _default$
|
|
347
|
+
type Instance$2 = InstanceType<typeof _default$2>;
|
|
348
348
|
type TdFormInstance = Instance$2 & Omit<FormInstance, keyof Instance$2>;
|
|
349
|
-
type TdFormItemInstance = InstanceType<typeof _default$
|
|
349
|
+
type TdFormItemInstance = InstanceType<typeof _default$4>;
|
|
350
350
|
//#endregion
|
|
351
351
|
//#region src/table/utils.d.ts
|
|
352
352
|
type TableColumnProp = {
|
|
@@ -383,86 +383,86 @@ type TdTableProps = ExtractPublicPropTypes<typeof tablePropsDef>;
|
|
|
383
383
|
//#endregion
|
|
384
384
|
//#region src/table/table.vue.d.ts
|
|
385
385
|
declare var __VLS_1: {}, __VLS_16: string, __VLS_17: any, __VLS_19: {};
|
|
386
|
-
type __VLS_Slots$
|
|
386
|
+
type __VLS_Slots$2 = {} & { [K in NonNullable<typeof __VLS_16>]?: (props: typeof __VLS_17) => any } & {
|
|
387
387
|
before?: (props: typeof __VLS_1) => any;
|
|
388
388
|
} & {
|
|
389
389
|
after?: (props: typeof __VLS_19) => any;
|
|
390
390
|
};
|
|
391
|
-
declare const __VLS_base$
|
|
391
|
+
declare const __VLS_base$2: vue46.DefineComponent<vue46.ExtractPropTypes<{
|
|
392
392
|
columns: {
|
|
393
|
-
type:
|
|
393
|
+
type: vue46.PropType<TdTableColumnProps[]>;
|
|
394
394
|
default: () => never[];
|
|
395
395
|
};
|
|
396
|
-
}>, TableInstance, {}, {}, {},
|
|
396
|
+
}>, TableInstance, {}, {}, {}, vue46.ComponentOptionsMixin, vue46.ComponentOptionsMixin, {}, string, vue46.PublicProps, Readonly<vue46.ExtractPropTypes<{
|
|
397
397
|
columns: {
|
|
398
|
-
type:
|
|
398
|
+
type: vue46.PropType<TdTableColumnProps[]>;
|
|
399
399
|
default: () => never[];
|
|
400
400
|
};
|
|
401
401
|
}>> & Readonly<{}>, {
|
|
402
402
|
columns: TdTableColumnProps[];
|
|
403
|
-
}, {}, {}, {}, string,
|
|
404
|
-
declare const __VLS_export$
|
|
405
|
-
declare const _default$
|
|
406
|
-
type __VLS_WithSlots$
|
|
403
|
+
}, {}, {}, {}, string, vue46.ComponentProvideOptions, true, {}, any>;
|
|
404
|
+
declare const __VLS_export$3: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
|
|
405
|
+
declare const _default$5: typeof __VLS_export$3;
|
|
406
|
+
type __VLS_WithSlots$2<T, S> = T & {
|
|
407
407
|
new (): {
|
|
408
408
|
$slots: S;
|
|
409
409
|
};
|
|
410
410
|
};
|
|
411
411
|
//#endregion
|
|
412
412
|
//#region src/table/table-col.vue.d.ts
|
|
413
|
-
declare const __VLS_export$
|
|
413
|
+
declare const __VLS_export$2: vue46.DefineComponent<vue46.ExtractPropTypes<{
|
|
414
414
|
slots: {
|
|
415
|
-
type:
|
|
415
|
+
type: vue46.PropType<OrArray<SlotDef>>;
|
|
416
416
|
default: null;
|
|
417
417
|
};
|
|
418
418
|
columns: {
|
|
419
|
-
type:
|
|
419
|
+
type: vue46.PropType<TdTableColumnProps[]>;
|
|
420
420
|
default: () => never[];
|
|
421
421
|
};
|
|
422
422
|
transform: {
|
|
423
|
-
type:
|
|
423
|
+
type: vue46.PropType<AnyFunction[]>;
|
|
424
424
|
default: () => never[];
|
|
425
425
|
};
|
|
426
426
|
hide: {
|
|
427
|
-
type:
|
|
427
|
+
type: vue46.PropType<boolean | vue46.Ref<boolean>>;
|
|
428
428
|
default: false;
|
|
429
429
|
};
|
|
430
430
|
dangerouslyUseHTMLString: {
|
|
431
|
-
type:
|
|
431
|
+
type: vue46.PropType<boolean | vue46.Ref<boolean>>;
|
|
432
432
|
default: false;
|
|
433
433
|
};
|
|
434
|
-
}>, {}, {}, {}, {},
|
|
434
|
+
}>, {}, {}, {}, {}, vue46.ComponentOptionsMixin, vue46.ComponentOptionsMixin, {}, string, vue46.PublicProps, Readonly<vue46.ExtractPropTypes<{
|
|
435
435
|
slots: {
|
|
436
|
-
type:
|
|
436
|
+
type: vue46.PropType<OrArray<SlotDef>>;
|
|
437
437
|
default: null;
|
|
438
438
|
};
|
|
439
439
|
columns: {
|
|
440
|
-
type:
|
|
440
|
+
type: vue46.PropType<TdTableColumnProps[]>;
|
|
441
441
|
default: () => never[];
|
|
442
442
|
};
|
|
443
443
|
transform: {
|
|
444
|
-
type:
|
|
444
|
+
type: vue46.PropType<AnyFunction[]>;
|
|
445
445
|
default: () => never[];
|
|
446
446
|
};
|
|
447
447
|
hide: {
|
|
448
|
-
type:
|
|
448
|
+
type: vue46.PropType<boolean | vue46.Ref<boolean>>;
|
|
449
449
|
default: false;
|
|
450
450
|
};
|
|
451
451
|
dangerouslyUseHTMLString: {
|
|
452
|
-
type:
|
|
452
|
+
type: vue46.PropType<boolean | vue46.Ref<boolean>>;
|
|
453
453
|
default: false;
|
|
454
454
|
};
|
|
455
455
|
}>> & Readonly<{}>, {
|
|
456
456
|
slots: OrArray<SlotDef>;
|
|
457
457
|
columns: TdTableColumnProps[];
|
|
458
458
|
transform: AnyFunction[];
|
|
459
|
-
hide: boolean |
|
|
460
|
-
dangerouslyUseHTMLString: boolean |
|
|
461
|
-
}, {}, {}, {}, string,
|
|
462
|
-
declare const _default$
|
|
459
|
+
hide: boolean | vue46.Ref<boolean, boolean>;
|
|
460
|
+
dangerouslyUseHTMLString: boolean | vue46.Ref<boolean, boolean>;
|
|
461
|
+
}, {}, {}, {}, string, vue46.ComponentProvideOptions, true, {}, any>;
|
|
462
|
+
declare const _default$6: typeof __VLS_export$2;
|
|
463
463
|
//#endregion
|
|
464
464
|
//#region src/table/index.d.ts
|
|
465
|
-
type Instance$1 = InstanceType<typeof _default$
|
|
465
|
+
type Instance$1 = InstanceType<typeof _default$5>;
|
|
466
466
|
type TdTableInstance = Instance$1 & Omit<TableInstance, keyof Instance$1>;
|
|
467
467
|
//#endregion
|
|
468
468
|
//#region src/dialog/utils.d.ts
|
|
@@ -490,11 +490,11 @@ declare var __VLS_13: "default" | "title" | "header" | "footer", __VLS_14: {
|
|
|
490
490
|
titleId?: string | undefined;
|
|
491
491
|
titleClass?: string | undefined;
|
|
492
492
|
};
|
|
493
|
-
type __VLS_Slots = {} & { [K in NonNullable<typeof __VLS_13>]?: (props: typeof __VLS_14) => any };
|
|
494
|
-
declare const __VLS_base:
|
|
495
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
496
|
-
declare const _default: typeof __VLS_export;
|
|
497
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
493
|
+
type __VLS_Slots$1 = {} & { [K in NonNullable<typeof __VLS_13>]?: (props: typeof __VLS_14) => any };
|
|
494
|
+
declare const __VLS_base$1: vue46.DefineComponent<{}, __TdDialogExpose, {}, {}, {}, vue46.ComponentOptionsMixin, vue46.ComponentOptionsMixin, {}, string, vue46.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue46.ComponentProvideOptions, true, {}, any>;
|
|
495
|
+
declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
|
|
496
|
+
declare const _default: typeof __VLS_export$1;
|
|
497
|
+
type __VLS_WithSlots$1<T, S> = T & {
|
|
498
498
|
new (): {
|
|
499
499
|
$slots: S;
|
|
500
500
|
};
|
|
@@ -504,14 +504,46 @@ type __VLS_WithSlots<T, S> = T & {
|
|
|
504
504
|
type Instance = InstanceType<typeof _default>;
|
|
505
505
|
type TdDialogInstance = Instance & Omit<DialogInstance, keyof Instance & string>;
|
|
506
506
|
//#endregion
|
|
507
|
+
//#region src/enum-select/enum-select.vue.d.ts
|
|
508
|
+
type __VLS_Props = {
|
|
509
|
+
code: string;
|
|
510
|
+
fetch?: (code: string) => Promise<Array<{
|
|
511
|
+
label: string;
|
|
512
|
+
value: string;
|
|
513
|
+
}>>;
|
|
514
|
+
};
|
|
515
|
+
declare var __VLS_10: string | number, __VLS_11: any;
|
|
516
|
+
type __VLS_Slots = {} & { [K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any };
|
|
517
|
+
declare const __VLS_base: vue46.DefineComponent<__VLS_Props, SelectInstance, {}, {}, {}, vue46.ComponentOptionsMixin, vue46.ComponentOptionsMixin, {}, string, vue46.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue46.ComponentProvideOptions, false, {}, any>;
|
|
518
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
519
|
+
declare const _default$1: typeof __VLS_export;
|
|
520
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
521
|
+
new (): {
|
|
522
|
+
$slots: S;
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/enum-select/store.d.ts
|
|
527
|
+
declare function clearEnum(code: string): void;
|
|
528
|
+
declare function getEnum(code: string, value: string, fetch?: (code: string) => Promise<Array<{
|
|
529
|
+
label: string;
|
|
530
|
+
value: string;
|
|
531
|
+
}>>): vue46.ComputedRef<{
|
|
532
|
+
label: string;
|
|
533
|
+
value: string;
|
|
534
|
+
} | undefined>;
|
|
535
|
+
//#endregion
|
|
536
|
+
//#region src/enum-select/index.d.ts
|
|
537
|
+
type TdEnumSelectInstance = InstanceType<typeof _default$1>;
|
|
538
|
+
//#endregion
|
|
507
539
|
//#region src/hooks/use-reuse.d.ts
|
|
508
|
-
declare function useReuse(): (
|
|
540
|
+
declare function useReuse(): (vue46.DefineComponent<{}, () => null, {}, {}, {}, vue46.ComponentOptionsMixin, vue46.ComponentOptionsMixin, {}, string, vue46.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue46.ComponentProvideOptions, true, {}, any> | vue46.DefineComponent<{}, () => vue46.VNode<vue46.RendererNode, vue46.RendererElement, {
|
|
509
541
|
[key: string]: any;
|
|
510
|
-
}>[] | undefined, {}, {}, {},
|
|
511
|
-
[name: string]:
|
|
542
|
+
}>[] | undefined, {}, {}, {}, vue46.ComponentOptionsMixin, vue46.ComponentOptionsMixin, {}, string, vue46.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue46.ComponentProvideOptions, true, {}, any> | vue46.ComputedRef<Readonly<{
|
|
543
|
+
[name: string]: vue46.Slot<any> | undefined;
|
|
512
544
|
}>>)[];
|
|
513
545
|
//#endregion
|
|
514
546
|
//#region src/utils/index.d.ts
|
|
515
547
|
declare function getKey(obj: any): string;
|
|
516
548
|
//#endregion
|
|
517
|
-
export { _default as TdDialog, TdDialogInstance, type TdDialogProps, _default$1 as
|
|
549
|
+
export { _default as TdDialog, TdDialogInstance, type TdDialogProps, _default$1 as TdEnumSelect, TdEnumSelectInstance, _default$2 as TdForm, _default$3 as TdFormField, type TdFormFieldProps, TdFormInstance, _default$4 as TdFormItem, TdFormItemInstance, type TdFormProps, _default$5 as TdTable, _default$6 as TdTableCol, type TdTableColumnProps, TdTableInstance, type TdTableProps, clearEnum, formPropsDef, getEnum, getKey, tableColumnPropsDef, tablePropsDef, useReuse, widget };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, h, inject, isRef, markRaw, mergeProps, normalizeClass, normalizeProps, normalizeStyle, onMounted, openBlock, provide, reactive, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toHandlers, toRaw, toRef, unref, useAttrs, useSlots, useTemplateRef, withCtx, withModifiers } from "vue";
|
|
2
|
-
import { ElDialog, ElForm, ElFormItem, ElTable, ElTableColumn, useNamespace } from "element-plus";
|
|
2
|
+
import { ElDialog, ElForm, ElFormItem, ElSelect, ElTable, ElTableColumn, useNamespace } from "element-plus";
|
|
3
3
|
import { cut, ensureArray, getDeepValue, groupBy, isFunction, isNullOrUndef, isObject, isString, pick, setDeepValue, toCamelCase, toKebabCase, uid } from "yatter";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/index.ts
|
|
@@ -981,6 +981,87 @@ var dialog_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
981
981
|
//#region src/dialog/dialog.vue
|
|
982
982
|
var dialog_default = dialog_vue_vue_type_script_setup_true_lang_default;
|
|
983
983
|
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region src/enum-select/store.ts
|
|
986
|
+
const store = ref(/* @__PURE__ */ new Map());
|
|
987
|
+
function getOptions(code, fetch) {
|
|
988
|
+
return computed(() => {
|
|
989
|
+
if (!store.value.has(code)) store.value.set(code, {
|
|
990
|
+
loading: false,
|
|
991
|
+
options: []
|
|
992
|
+
});
|
|
993
|
+
const data = store.value.get(code);
|
|
994
|
+
if (!data.options.length && !data.loading) fetchOptions(code, fetch);
|
|
995
|
+
return data.options;
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
async function fetchOptions(code, fetch) {
|
|
999
|
+
if (!store.value.has(code)) store.value.set(code, {
|
|
1000
|
+
loading: true,
|
|
1001
|
+
options: []
|
|
1002
|
+
});
|
|
1003
|
+
const data = store.value.get(code);
|
|
1004
|
+
data.loading = true;
|
|
1005
|
+
const options = await fetch?.(code);
|
|
1006
|
+
if (options) {
|
|
1007
|
+
data.loading = false;
|
|
1008
|
+
data.options = options;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
function clearEnum(code) {
|
|
1012
|
+
store.value.delete(code);
|
|
1013
|
+
}
|
|
1014
|
+
function getEnum(code, value, fetch) {
|
|
1015
|
+
return computed(() => {
|
|
1016
|
+
return getOptions(code, fetch).value.find((item) => item.value === value);
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
//#endregion
|
|
1021
|
+
//#region src/enum-select/enum-select.vue?vue&type=script&setup=true&lang.ts
|
|
1022
|
+
var enum_select_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
1023
|
+
__name: "enum-select",
|
|
1024
|
+
props: {
|
|
1025
|
+
code: {
|
|
1026
|
+
type: String,
|
|
1027
|
+
required: true
|
|
1028
|
+
},
|
|
1029
|
+
fetch: {
|
|
1030
|
+
type: Function,
|
|
1031
|
+
required: false
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
setup(__props, { expose: __expose }) {
|
|
1035
|
+
const props = __props;
|
|
1036
|
+
const selectRef = useTemplateRef("selectRef");
|
|
1037
|
+
const options = getOptions(props.code, props.fetch);
|
|
1038
|
+
__expose(new Proxy({}, {
|
|
1039
|
+
get(target, key) {
|
|
1040
|
+
return Reflect.get(selectRef.value || {}, key);
|
|
1041
|
+
},
|
|
1042
|
+
has(target, key) {
|
|
1043
|
+
return Reflect.has(selectRef.value || {}, key);
|
|
1044
|
+
}
|
|
1045
|
+
}));
|
|
1046
|
+
return (_ctx, _cache) => {
|
|
1047
|
+
return openBlock(), createBlock(unref(ElSelect), mergeProps({
|
|
1048
|
+
ref_key: "selectRef",
|
|
1049
|
+
ref: selectRef,
|
|
1050
|
+
options: unref(options)
|
|
1051
|
+
}, _ctx.$attrs), createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, name) => {
|
|
1052
|
+
return {
|
|
1053
|
+
name,
|
|
1054
|
+
fn: withCtx((scope) => [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(scope)))])
|
|
1055
|
+
};
|
|
1056
|
+
})]), 1040, ["options"]);
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1060
|
+
|
|
1061
|
+
//#endregion
|
|
1062
|
+
//#region src/enum-select/enum-select.vue
|
|
1063
|
+
var enum_select_default = enum_select_vue_vue_type_script_setup_true_lang_default;
|
|
1064
|
+
|
|
984
1065
|
//#endregion
|
|
985
1066
|
//#region src/hooks/use-reuse.ts
|
|
986
1067
|
function useReuse() {
|
|
@@ -1017,4 +1098,4 @@ function useReuse() {
|
|
|
1017
1098
|
}
|
|
1018
1099
|
|
|
1019
1100
|
//#endregion
|
|
1020
|
-
export { dialog_default as TdDialog, form_default as TdForm, form_field_default as TdFormField, form_item_default as TdFormItem, table_default as TdTable, table_col_default as TdTableCol, formPropsDef, getKey, tableColumnPropsDef, tablePropsDef, useReuse, widget };
|
|
1101
|
+
export { dialog_default as TdDialog, enum_select_default as TdEnumSelect, form_default as TdForm, form_field_default as TdFormField, form_item_default as TdFormItem, table_default as TdTable, table_col_default as TdTableCol, clearEnum, formPropsDef, getEnum, getKey, tableColumnPropsDef, tablePropsDef, useReuse, widget };
|