tiddy 2.3.0 → 2.3.2
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 +66 -63
- package/dist/index.js +27 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { AllowedComponentProps, CSSProperties, Component, DefineComponent, ExtractPublicPropTypes, PropType, Raw, Ref as Ref$1, Slot } from "vue";
|
|
1
|
+
import * as vue56 from "vue";
|
|
2
|
+
import { AllowedComponentProps, CSSProperties, Component, ComputedRef, DefineComponent, ExtractPublicPropTypes, PropType, Raw, Ref as Ref$1, Slot } from "vue";
|
|
3
3
|
import * as element_plus0 from "element-plus";
|
|
4
4
|
import { DialogInstance, DialogProps, FormInstance, FormItemProp, FormItemProps, FormItemRule, FormProps, SelectInstance, TableColumnInstance, TableInstance } from "element-plus";
|
|
5
5
|
|
|
@@ -184,7 +184,7 @@ type TdArrayFieldProps = TdFieldsProps & ExtractPublicPropTypes<typeof arrayFiel
|
|
|
184
184
|
declare const layoutFieldPropsDef: {
|
|
185
185
|
prop: {
|
|
186
186
|
type: PropType<OrFunction<string>>;
|
|
187
|
-
required:
|
|
187
|
+
required: false;
|
|
188
188
|
};
|
|
189
189
|
hide: {
|
|
190
190
|
type: PropType<OrFunction<boolean> | OrRef<boolean>>;
|
|
@@ -213,7 +213,7 @@ declare const layoutFieldPropsDef: {
|
|
|
213
213
|
default: () => never[];
|
|
214
214
|
};
|
|
215
215
|
};
|
|
216
|
-
type TdLayoutFieldProps = Partial<TdFieldsProps> & MakeOptional<ExtractPublicPropTypes<typeof layoutFieldPropsDef>,
|
|
216
|
+
type TdLayoutFieldProps = Partial<TdFieldsProps> & MakeOptional<ExtractPublicPropTypes<typeof layoutFieldPropsDef>, 'prop'> & AllowedComponentProps;
|
|
217
217
|
type TdFormFieldProps = TdObjectFieldProps | TdWidgetFieldProps | TdArrayFieldProps | TdLayoutFieldProps;
|
|
218
218
|
declare const formPropsDef: {
|
|
219
219
|
fields: {
|
|
@@ -252,7 +252,7 @@ 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: vue56.ComputedRef<unknown>;
|
|
256
256
|
};
|
|
257
257
|
type __TdFormExpose = typeof expose$1 & FormInstance;
|
|
258
258
|
declare var __VLS_11$2: {}, __VLS_13$1: {}, __VLS_19$1: {};
|
|
@@ -263,24 +263,24 @@ type __VLS_Slots$4 = {} & {
|
|
|
263
263
|
} & {
|
|
264
264
|
suffix?: (props: typeof __VLS_19$1) => any;
|
|
265
265
|
};
|
|
266
|
-
declare const __VLS_base$4:
|
|
266
|
+
declare const __VLS_base$4: vue56.DefineComponent<vue56.ExtractPropTypes<{
|
|
267
267
|
fields: {
|
|
268
|
-
type:
|
|
268
|
+
type: vue56.PropType<TdFormFieldProps[]>;
|
|
269
269
|
default: () => never[];
|
|
270
270
|
};
|
|
271
271
|
item: {
|
|
272
|
-
type:
|
|
272
|
+
type: vue56.PropType<element_plus0.FormItemProps>;
|
|
273
273
|
default: () => {};
|
|
274
274
|
};
|
|
275
|
-
}>, __TdFormExpose, {}, {}, {},
|
|
275
|
+
}>, __TdFormExpose, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {
|
|
276
276
|
submit: (data: any) => any;
|
|
277
|
-
}, string,
|
|
277
|
+
}, string, vue56.PublicProps, Readonly<vue56.ExtractPropTypes<{
|
|
278
278
|
fields: {
|
|
279
|
-
type:
|
|
279
|
+
type: vue56.PropType<TdFormFieldProps[]>;
|
|
280
280
|
default: () => never[];
|
|
281
281
|
};
|
|
282
282
|
item: {
|
|
283
|
-
type:
|
|
283
|
+
type: vue56.PropType<element_plus0.FormItemProps>;
|
|
284
284
|
default: () => {};
|
|
285
285
|
};
|
|
286
286
|
}>> & Readonly<{
|
|
@@ -288,7 +288,7 @@ declare const __VLS_base$4: vue46.DefineComponent<vue46.ExtractPropTypes<{
|
|
|
288
288
|
}>, {
|
|
289
289
|
fields: TdFormFieldProps[];
|
|
290
290
|
item: element_plus0.FormItemProps;
|
|
291
|
-
}, {}, {}, {}, string,
|
|
291
|
+
}, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
|
|
292
292
|
declare const __VLS_export$6: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
|
|
293
293
|
declare const _default$2: typeof __VLS_export$6;
|
|
294
294
|
type __VLS_WithSlots$4<T, S> = T & {
|
|
@@ -300,37 +300,37 @@ type __VLS_WithSlots$4<T, S> = T & {
|
|
|
300
300
|
//#region src/form/form-item.vue.d.ts
|
|
301
301
|
declare var __VLS_10$1: string | number, __VLS_11$1: any;
|
|
302
302
|
type __VLS_Slots$3 = {} & { [K in NonNullable<typeof __VLS_10$1>]?: (props: typeof __VLS_11$1) => any };
|
|
303
|
-
declare const __VLS_base$3:
|
|
303
|
+
declare const __VLS_base$3: vue56.DefineComponent<vue56.ExtractPropTypes<{
|
|
304
304
|
messageLabel: {
|
|
305
|
-
type:
|
|
305
|
+
type: vue56.PropType<OrRef<string>>;
|
|
306
306
|
default: string;
|
|
307
307
|
};
|
|
308
308
|
formatMessage: {
|
|
309
|
-
type:
|
|
309
|
+
type: vue56.PropType<AnyFunction>;
|
|
310
310
|
default: null;
|
|
311
311
|
};
|
|
312
312
|
hideRequiredAsterisk: {
|
|
313
|
-
type:
|
|
313
|
+
type: vue56.PropType<boolean>;
|
|
314
314
|
default: boolean;
|
|
315
315
|
};
|
|
316
|
-
}>, {}, {}, {}, {},
|
|
316
|
+
}>, {}, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<vue56.ExtractPropTypes<{
|
|
317
317
|
messageLabel: {
|
|
318
|
-
type:
|
|
318
|
+
type: vue56.PropType<OrRef<string>>;
|
|
319
319
|
default: string;
|
|
320
320
|
};
|
|
321
321
|
formatMessage: {
|
|
322
|
-
type:
|
|
322
|
+
type: vue56.PropType<AnyFunction>;
|
|
323
323
|
default: null;
|
|
324
324
|
};
|
|
325
325
|
hideRequiredAsterisk: {
|
|
326
|
-
type:
|
|
326
|
+
type: vue56.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,
|
|
333
|
+
}, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
|
|
334
334
|
declare const __VLS_export$5: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
|
|
335
335
|
declare const _default$4: typeof __VLS_export$5;
|
|
336
336
|
type __VLS_WithSlots$3<T, S> = T & {
|
|
@@ -340,7 +340,7 @@ type __VLS_WithSlots$3<T, S> = T & {
|
|
|
340
340
|
};
|
|
341
341
|
//#endregion
|
|
342
342
|
//#region src/form/form-field.vue.d.ts
|
|
343
|
-
declare const __VLS_export$4:
|
|
343
|
+
declare const __VLS_export$4: vue56.DefineComponent<{}, {}, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
|
|
344
344
|
declare const _default$3: typeof __VLS_export$4;
|
|
345
345
|
//#endregion
|
|
346
346
|
//#region src/form/index.d.ts
|
|
@@ -388,19 +388,19 @@ type __VLS_Slots$2 = {} & { [K in NonNullable<typeof __VLS_16>]?: (props: typeof
|
|
|
388
388
|
} & {
|
|
389
389
|
after?: (props: typeof __VLS_19) => any;
|
|
390
390
|
};
|
|
391
|
-
declare const __VLS_base$2:
|
|
391
|
+
declare const __VLS_base$2: vue56.DefineComponent<vue56.ExtractPropTypes<{
|
|
392
392
|
columns: {
|
|
393
|
-
type:
|
|
393
|
+
type: vue56.PropType<TdTableColumnProps[]>;
|
|
394
394
|
default: () => never[];
|
|
395
395
|
};
|
|
396
|
-
}>, TableInstance, {}, {}, {},
|
|
396
|
+
}>, TableInstance, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<vue56.ExtractPropTypes<{
|
|
397
397
|
columns: {
|
|
398
|
-
type:
|
|
398
|
+
type: vue56.PropType<TdTableColumnProps[]>;
|
|
399
399
|
default: () => never[];
|
|
400
400
|
};
|
|
401
401
|
}>> & Readonly<{}>, {
|
|
402
402
|
columns: TdTableColumnProps[];
|
|
403
|
-
}, {}, {}, {}, string,
|
|
403
|
+
}, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
|
|
404
404
|
declare const __VLS_export$3: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
|
|
405
405
|
declare const _default$5: typeof __VLS_export$3;
|
|
406
406
|
type __VLS_WithSlots$2<T, S> = T & {
|
|
@@ -410,55 +410,55 @@ type __VLS_WithSlots$2<T, S> = T & {
|
|
|
410
410
|
};
|
|
411
411
|
//#endregion
|
|
412
412
|
//#region src/table/table-col.vue.d.ts
|
|
413
|
-
declare const __VLS_export$2:
|
|
413
|
+
declare const __VLS_export$2: vue56.DefineComponent<vue56.ExtractPropTypes<{
|
|
414
414
|
slots: {
|
|
415
|
-
type:
|
|
415
|
+
type: vue56.PropType<OrArray<SlotDef>>;
|
|
416
416
|
default: null;
|
|
417
417
|
};
|
|
418
418
|
columns: {
|
|
419
|
-
type:
|
|
419
|
+
type: vue56.PropType<TdTableColumnProps[]>;
|
|
420
420
|
default: () => never[];
|
|
421
421
|
};
|
|
422
422
|
transform: {
|
|
423
|
-
type:
|
|
423
|
+
type: vue56.PropType<AnyFunction[]>;
|
|
424
424
|
default: () => never[];
|
|
425
425
|
};
|
|
426
426
|
hide: {
|
|
427
|
-
type:
|
|
427
|
+
type: vue56.PropType<boolean | vue56.Ref<boolean>>;
|
|
428
428
|
default: false;
|
|
429
429
|
};
|
|
430
430
|
dangerouslyUseHTMLString: {
|
|
431
|
-
type:
|
|
431
|
+
type: vue56.PropType<boolean | vue56.Ref<boolean>>;
|
|
432
432
|
default: false;
|
|
433
433
|
};
|
|
434
|
-
}>, {}, {}, {}, {},
|
|
434
|
+
}>, {}, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<vue56.ExtractPropTypes<{
|
|
435
435
|
slots: {
|
|
436
|
-
type:
|
|
436
|
+
type: vue56.PropType<OrArray<SlotDef>>;
|
|
437
437
|
default: null;
|
|
438
438
|
};
|
|
439
439
|
columns: {
|
|
440
|
-
type:
|
|
440
|
+
type: vue56.PropType<TdTableColumnProps[]>;
|
|
441
441
|
default: () => never[];
|
|
442
442
|
};
|
|
443
443
|
transform: {
|
|
444
|
-
type:
|
|
444
|
+
type: vue56.PropType<AnyFunction[]>;
|
|
445
445
|
default: () => never[];
|
|
446
446
|
};
|
|
447
447
|
hide: {
|
|
448
|
-
type:
|
|
448
|
+
type: vue56.PropType<boolean | vue56.Ref<boolean>>;
|
|
449
449
|
default: false;
|
|
450
450
|
};
|
|
451
451
|
dangerouslyUseHTMLString: {
|
|
452
|
-
type:
|
|
452
|
+
type: vue56.PropType<boolean | vue56.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,
|
|
459
|
+
hide: boolean | vue56.Ref<boolean, boolean>;
|
|
460
|
+
dangerouslyUseHTMLString: boolean | vue56.Ref<boolean, boolean>;
|
|
461
|
+
}, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
|
|
462
462
|
declare const _default$6: typeof __VLS_export$2;
|
|
463
463
|
//#endregion
|
|
464
464
|
//#region src/table/index.d.ts
|
|
@@ -491,7 +491,7 @@ declare var __VLS_13: "default" | "title" | "header" | "footer", __VLS_14: {
|
|
|
491
491
|
titleClass?: string | undefined;
|
|
492
492
|
};
|
|
493
493
|
type __VLS_Slots$1 = {} & { [K in NonNullable<typeof __VLS_13>]?: (props: typeof __VLS_14) => any };
|
|
494
|
-
declare const __VLS_base$1:
|
|
494
|
+
declare const __VLS_base$1: vue56.DefineComponent<{}, __TdDialogExpose, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
|
|
495
495
|
declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
|
|
496
496
|
declare const _default: typeof __VLS_export$1;
|
|
497
497
|
type __VLS_WithSlots$1<T, S> = T & {
|
|
@@ -504,17 +504,30 @@ type __VLS_WithSlots$1<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/store.d.ts
|
|
508
|
+
type OptionItem<T> = {
|
|
509
|
+
label: string;
|
|
510
|
+
value: T;
|
|
511
|
+
};
|
|
512
|
+
type DataOption<T> = {
|
|
513
|
+
loading: boolean;
|
|
514
|
+
options: Array<OptionItem<T>>;
|
|
515
|
+
fetch?: (code: string) => Promise<OptionItem<T>[]>;
|
|
516
|
+
};
|
|
517
|
+
declare function clearEnum(code: string): void;
|
|
518
|
+
declare function getEnum<T>(code: string, fetch?: DataOption<T>['fetch']): ComputedRef<OptionItem<T>[]>;
|
|
519
|
+
declare function getEnum<T>(code: string, value: T, fetch?: DataOption<T>['fetch']): ComputedRef<OptionItem<T> | undefined>;
|
|
520
|
+
declare function resetEnum(code: string): void;
|
|
521
|
+
declare function setDefaultEnumFetch(fetch: Exclude<DataOption<any>['fetch'], undefined>): void;
|
|
522
|
+
//#endregion
|
|
507
523
|
//#region src/enum-select/enum-select.vue.d.ts
|
|
508
524
|
type __VLS_Props = {
|
|
509
525
|
code: string;
|
|
510
|
-
fetch?:
|
|
511
|
-
label: string;
|
|
512
|
-
value: string;
|
|
513
|
-
}>>;
|
|
526
|
+
fetch?: DataOption<any>['fetch'];
|
|
514
527
|
};
|
|
515
528
|
declare var __VLS_10: string | number, __VLS_11: any;
|
|
516
529
|
type __VLS_Slots = {} & { [K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any };
|
|
517
|
-
declare const __VLS_base:
|
|
530
|
+
declare const __VLS_base: vue56.DefineComponent<__VLS_Props, SelectInstance, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue56.ComponentProvideOptions, false, {}, any>;
|
|
518
531
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
519
532
|
declare const _default$1: typeof __VLS_export;
|
|
520
533
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -523,27 +536,17 @@ type __VLS_WithSlots<T, S> = T & {
|
|
|
523
536
|
};
|
|
524
537
|
};
|
|
525
538
|
//#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
539
|
//#region src/enum-select/index.d.ts
|
|
537
540
|
type TdEnumSelectInstance = InstanceType<typeof _default$1>;
|
|
538
541
|
//#endregion
|
|
539
542
|
//#region src/hooks/use-reuse.d.ts
|
|
540
|
-
declare function useReuse(): (
|
|
543
|
+
declare function useReuse(): (vue56.DefineComponent<{}, () => null, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any> | vue56.DefineComponent<{}, () => vue56.VNode<vue56.RendererNode, vue56.RendererElement, {
|
|
541
544
|
[key: string]: any;
|
|
542
|
-
}>[] | undefined, {}, {}, {},
|
|
543
|
-
[name: string]:
|
|
545
|
+
}>[] | undefined, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any> | vue56.ComputedRef<Readonly<{
|
|
546
|
+
[name: string]: vue56.Slot<any> | undefined;
|
|
544
547
|
}>>)[];
|
|
545
548
|
//#endregion
|
|
546
549
|
//#region src/utils/index.d.ts
|
|
547
550
|
declare function getKey(obj: any): string;
|
|
548
551
|
//#endregion
|
|
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 };
|
|
552
|
+
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, resetEnum, setDefaultEnumFetch, tableColumnPropsDef, tablePropsDef, useReuse, widget };
|
package/dist/index.js
CHANGED
|
@@ -206,7 +206,11 @@ const layoutFieldPropsDef = {
|
|
|
206
206
|
default: () => []
|
|
207
207
|
},
|
|
208
208
|
...fieldsPropsDef,
|
|
209
|
-
...commonFieldPropsDef
|
|
209
|
+
...commonFieldPropsDef,
|
|
210
|
+
prop: {
|
|
211
|
+
type: [String, Function],
|
|
212
|
+
required: false
|
|
213
|
+
}
|
|
210
214
|
};
|
|
211
215
|
const formPropsDef = {
|
|
212
216
|
fields: {
|
|
@@ -983,39 +987,49 @@ var dialog_default = dialog_vue_vue_type_script_setup_true_lang_default;
|
|
|
983
987
|
|
|
984
988
|
//#endregion
|
|
985
989
|
//#region src/enum-select/store.ts
|
|
990
|
+
let defaultFetch;
|
|
986
991
|
const store = ref(/* @__PURE__ */ new Map());
|
|
987
992
|
function getOptions(code, fetch) {
|
|
988
993
|
return computed(() => {
|
|
989
994
|
if (!store.value.has(code)) store.value.set(code, {
|
|
990
995
|
loading: false,
|
|
991
|
-
options: []
|
|
996
|
+
options: [],
|
|
997
|
+
fetch
|
|
992
998
|
});
|
|
993
999
|
const data = store.value.get(code);
|
|
994
|
-
if (!data.options.length && !data.loading) fetchOptions(code
|
|
1000
|
+
if (!data.options.length && !data.loading) fetchOptions(code);
|
|
995
1001
|
return data.options;
|
|
996
1002
|
});
|
|
997
1003
|
}
|
|
998
|
-
async function fetchOptions(code
|
|
999
|
-
if (!store.value.has(code)) store.value.set(code, {
|
|
1000
|
-
loading: true,
|
|
1001
|
-
options: []
|
|
1002
|
-
});
|
|
1004
|
+
async function fetchOptions(code) {
|
|
1003
1005
|
const data = store.value.get(code);
|
|
1004
1006
|
data.loading = true;
|
|
1005
|
-
const options = await fetch?.(code);
|
|
1007
|
+
const options = await (data.fetch || defaultFetch)?.(code);
|
|
1006
1008
|
if (options) {
|
|
1007
1009
|
data.loading = false;
|
|
1008
1010
|
data.options = options;
|
|
1009
1011
|
}
|
|
1010
1012
|
}
|
|
1011
1013
|
function clearEnum(code) {
|
|
1012
|
-
store.value.
|
|
1014
|
+
const data = store.value.get(code);
|
|
1015
|
+
if (!data) return;
|
|
1016
|
+
data.options = [];
|
|
1013
1017
|
}
|
|
1014
|
-
function getEnum(code,
|
|
1018
|
+
function getEnum(code, valueOrFetch, fetch) {
|
|
1019
|
+
const value = isFunction(valueOrFetch) ? void 0 : valueOrFetch;
|
|
1020
|
+
const fetchArg = isFunction(valueOrFetch) ? valueOrFetch : fetch;
|
|
1021
|
+
if (isNullOrUndef(value)) return getOptions(code, fetchArg);
|
|
1015
1022
|
return computed(() => {
|
|
1016
|
-
return getOptions(code,
|
|
1023
|
+
return getOptions(code, fetchArg).value.find((item) => item.value === value);
|
|
1017
1024
|
});
|
|
1018
1025
|
}
|
|
1026
|
+
function resetEnum(code) {
|
|
1027
|
+
if (!store.value.has(code)) return;
|
|
1028
|
+
fetchOptions(code);
|
|
1029
|
+
}
|
|
1030
|
+
function setDefaultEnumFetch(fetch) {
|
|
1031
|
+
defaultFetch = fetch;
|
|
1032
|
+
}
|
|
1019
1033
|
|
|
1020
1034
|
//#endregion
|
|
1021
1035
|
//#region src/enum-select/enum-select.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1098,4 +1112,4 @@ function useReuse() {
|
|
|
1098
1112
|
}
|
|
1099
1113
|
|
|
1100
1114
|
//#endregion
|
|
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 };
|
|
1115
|
+
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, resetEnum, setDefaultEnumFetch, tableColumnPropsDef, tablePropsDef, useReuse, widget };
|