tiddy 2.3.2 → 2.4.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 CHANGED
@@ -1,4 +1,4 @@
1
- import * as vue56 from "vue";
1
+ import * as vue14 from "vue";
2
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";
@@ -241,7 +241,8 @@ declare const tdformItemProps: {
241
241
  };
242
242
  };
243
243
  type TdFormItemProps = ExtractPublicPropTypes<typeof tdformItemProps> & Partial<FormItemProps>;
244
- declare function widget<T>(c: T | Raw<T>, props?: OrRef<PropsOf<T>>): {
244
+ type PropsOrRef<T> = { [K in keyof T]?: OrRef<T[K]> };
245
+ declare function widget<T>(c: T | Raw<T>, props?: OrRef<PropsOrRef<PropsOf<T>>>): {
245
246
  component: T | Raw<T>;
246
247
  widget: any;
247
248
  };
@@ -252,7 +253,7 @@ declare function isValidateError(prop: string): boolean;
252
253
  declare const expose$1: {
253
254
  reValidateErrorFields: typeof reValidateErrorFields;
254
255
  isValidateError: typeof isValidateError;
255
- model: vue56.ComputedRef<unknown>;
256
+ model: vue14.ComputedRef<unknown>;
256
257
  };
257
258
  type __TdFormExpose = typeof expose$1 & FormInstance;
258
259
  declare var __VLS_11$2: {}, __VLS_13$1: {}, __VLS_19$1: {};
@@ -263,24 +264,24 @@ type __VLS_Slots$4 = {} & {
263
264
  } & {
264
265
  suffix?: (props: typeof __VLS_19$1) => any;
265
266
  };
266
- declare const __VLS_base$4: vue56.DefineComponent<vue56.ExtractPropTypes<{
267
+ declare const __VLS_base$4: vue14.DefineComponent<vue14.ExtractPropTypes<{
267
268
  fields: {
268
- type: vue56.PropType<TdFormFieldProps[]>;
269
+ type: vue14.PropType<TdFormFieldProps[]>;
269
270
  default: () => never[];
270
271
  };
271
272
  item: {
272
- type: vue56.PropType<element_plus0.FormItemProps>;
273
+ type: vue14.PropType<element_plus0.FormItemProps>;
273
274
  default: () => {};
274
275
  };
275
- }>, __TdFormExpose, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {
276
+ }>, __TdFormExpose, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {
276
277
  submit: (data: any) => any;
277
- }, string, vue56.PublicProps, Readonly<vue56.ExtractPropTypes<{
278
+ }, string, vue14.PublicProps, Readonly<vue14.ExtractPropTypes<{
278
279
  fields: {
279
- type: vue56.PropType<TdFormFieldProps[]>;
280
+ type: vue14.PropType<TdFormFieldProps[]>;
280
281
  default: () => never[];
281
282
  };
282
283
  item: {
283
- type: vue56.PropType<element_plus0.FormItemProps>;
284
+ type: vue14.PropType<element_plus0.FormItemProps>;
284
285
  default: () => {};
285
286
  };
286
287
  }>> & Readonly<{
@@ -288,7 +289,7 @@ declare const __VLS_base$4: vue56.DefineComponent<vue56.ExtractPropTypes<{
288
289
  }>, {
289
290
  fields: TdFormFieldProps[];
290
291
  item: element_plus0.FormItemProps;
291
- }, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
292
+ }, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
292
293
  declare const __VLS_export$6: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
293
294
  declare const _default$2: typeof __VLS_export$6;
294
295
  type __VLS_WithSlots$4<T, S> = T & {
@@ -300,37 +301,37 @@ type __VLS_WithSlots$4<T, S> = T & {
300
301
  //#region src/form/form-item.vue.d.ts
301
302
  declare var __VLS_10$1: string | number, __VLS_11$1: any;
302
303
  type __VLS_Slots$3 = {} & { [K in NonNullable<typeof __VLS_10$1>]?: (props: typeof __VLS_11$1) => any };
303
- declare const __VLS_base$3: vue56.DefineComponent<vue56.ExtractPropTypes<{
304
+ declare const __VLS_base$3: vue14.DefineComponent<vue14.ExtractPropTypes<{
304
305
  messageLabel: {
305
- type: vue56.PropType<OrRef<string>>;
306
+ type: vue14.PropType<OrRef<string>>;
306
307
  default: string;
307
308
  };
308
309
  formatMessage: {
309
- type: vue56.PropType<AnyFunction>;
310
+ type: vue14.PropType<AnyFunction>;
310
311
  default: null;
311
312
  };
312
313
  hideRequiredAsterisk: {
313
- type: vue56.PropType<boolean>;
314
+ type: vue14.PropType<boolean>;
314
315
  default: boolean;
315
316
  };
316
- }>, {}, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<vue56.ExtractPropTypes<{
317
+ }>, {}, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<vue14.ExtractPropTypes<{
317
318
  messageLabel: {
318
- type: vue56.PropType<OrRef<string>>;
319
+ type: vue14.PropType<OrRef<string>>;
319
320
  default: string;
320
321
  };
321
322
  formatMessage: {
322
- type: vue56.PropType<AnyFunction>;
323
+ type: vue14.PropType<AnyFunction>;
323
324
  default: null;
324
325
  };
325
326
  hideRequiredAsterisk: {
326
- type: vue56.PropType<boolean>;
327
+ type: vue14.PropType<boolean>;
327
328
  default: boolean;
328
329
  };
329
330
  }>> & Readonly<{}>, {
330
331
  hideRequiredAsterisk: boolean;
331
332
  messageLabel: any;
332
333
  formatMessage: AnyFunction;
333
- }, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
334
+ }, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
334
335
  declare const __VLS_export$5: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
335
336
  declare const _default$4: typeof __VLS_export$5;
336
337
  type __VLS_WithSlots$3<T, S> = T & {
@@ -340,7 +341,7 @@ type __VLS_WithSlots$3<T, S> = T & {
340
341
  };
341
342
  //#endregion
342
343
  //#region src/form/form-field.vue.d.ts
343
- declare const __VLS_export$4: vue56.DefineComponent<{}, {}, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
344
+ declare const __VLS_export$4: vue14.DefineComponent<{}, {}, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
344
345
  declare const _default$3: typeof __VLS_export$4;
345
346
  //#endregion
346
347
  //#region src/form/index.d.ts
@@ -388,19 +389,19 @@ type __VLS_Slots$2 = {} & { [K in NonNullable<typeof __VLS_16>]?: (props: typeof
388
389
  } & {
389
390
  after?: (props: typeof __VLS_19) => any;
390
391
  };
391
- declare const __VLS_base$2: vue56.DefineComponent<vue56.ExtractPropTypes<{
392
+ declare const __VLS_base$2: vue14.DefineComponent<vue14.ExtractPropTypes<{
392
393
  columns: {
393
- type: vue56.PropType<TdTableColumnProps[]>;
394
+ type: vue14.PropType<TdTableColumnProps[]>;
394
395
  default: () => never[];
395
396
  };
396
- }>, TableInstance, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<vue56.ExtractPropTypes<{
397
+ }>, TableInstance, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<vue14.ExtractPropTypes<{
397
398
  columns: {
398
- type: vue56.PropType<TdTableColumnProps[]>;
399
+ type: vue14.PropType<TdTableColumnProps[]>;
399
400
  default: () => never[];
400
401
  };
401
402
  }>> & Readonly<{}>, {
402
403
  columns: TdTableColumnProps[];
403
- }, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
404
+ }, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
404
405
  declare const __VLS_export$3: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
405
406
  declare const _default$5: typeof __VLS_export$3;
406
407
  type __VLS_WithSlots$2<T, S> = T & {
@@ -410,55 +411,55 @@ type __VLS_WithSlots$2<T, S> = T & {
410
411
  };
411
412
  //#endregion
412
413
  //#region src/table/table-col.vue.d.ts
413
- declare const __VLS_export$2: vue56.DefineComponent<vue56.ExtractPropTypes<{
414
+ declare const __VLS_export$2: vue14.DefineComponent<vue14.ExtractPropTypes<{
414
415
  slots: {
415
- type: vue56.PropType<OrArray<SlotDef>>;
416
+ type: vue14.PropType<OrArray<SlotDef>>;
416
417
  default: null;
417
418
  };
418
419
  columns: {
419
- type: vue56.PropType<TdTableColumnProps[]>;
420
+ type: vue14.PropType<TdTableColumnProps[]>;
420
421
  default: () => never[];
421
422
  };
422
423
  transform: {
423
- type: vue56.PropType<AnyFunction[]>;
424
+ type: vue14.PropType<AnyFunction[]>;
424
425
  default: () => never[];
425
426
  };
426
427
  hide: {
427
- type: vue56.PropType<boolean | vue56.Ref<boolean>>;
428
+ type: vue14.PropType<boolean | vue14.Ref<boolean>>;
428
429
  default: false;
429
430
  };
430
431
  dangerouslyUseHTMLString: {
431
- type: vue56.PropType<boolean | vue56.Ref<boolean>>;
432
+ type: vue14.PropType<boolean | vue14.Ref<boolean>>;
432
433
  default: false;
433
434
  };
434
- }>, {}, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<vue56.ExtractPropTypes<{
435
+ }>, {}, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<vue14.ExtractPropTypes<{
435
436
  slots: {
436
- type: vue56.PropType<OrArray<SlotDef>>;
437
+ type: vue14.PropType<OrArray<SlotDef>>;
437
438
  default: null;
438
439
  };
439
440
  columns: {
440
- type: vue56.PropType<TdTableColumnProps[]>;
441
+ type: vue14.PropType<TdTableColumnProps[]>;
441
442
  default: () => never[];
442
443
  };
443
444
  transform: {
444
- type: vue56.PropType<AnyFunction[]>;
445
+ type: vue14.PropType<AnyFunction[]>;
445
446
  default: () => never[];
446
447
  };
447
448
  hide: {
448
- type: vue56.PropType<boolean | vue56.Ref<boolean>>;
449
+ type: vue14.PropType<boolean | vue14.Ref<boolean>>;
449
450
  default: false;
450
451
  };
451
452
  dangerouslyUseHTMLString: {
452
- type: vue56.PropType<boolean | vue56.Ref<boolean>>;
453
+ type: vue14.PropType<boolean | vue14.Ref<boolean>>;
453
454
  default: false;
454
455
  };
455
456
  }>> & Readonly<{}>, {
457
+ hide: boolean | vue14.Ref<boolean, boolean>;
456
458
  slots: OrArray<SlotDef>;
457
459
  columns: TdTableColumnProps[];
458
460
  transform: AnyFunction[];
459
- hide: boolean | vue56.Ref<boolean, boolean>;
460
- dangerouslyUseHTMLString: boolean | vue56.Ref<boolean, boolean>;
461
- }, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
461
+ dangerouslyUseHTMLString: boolean | vue14.Ref<boolean, boolean>;
462
+ }, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
462
463
  declare const _default$6: typeof __VLS_export$2;
463
464
  //#endregion
464
465
  //#region src/table/index.d.ts
@@ -491,7 +492,7 @@ declare var __VLS_13: "default" | "title" | "header" | "footer", __VLS_14: {
491
492
  titleClass?: string | undefined;
492
493
  };
493
494
  type __VLS_Slots$1 = {} & { [K in NonNullable<typeof __VLS_13>]?: (props: typeof __VLS_14) => any };
494
- declare const __VLS_base$1: vue56.DefineComponent<{}, __TdDialogExpose, {}, {}, {}, vue56.ComponentOptionsMixin, vue56.ComponentOptionsMixin, {}, string, vue56.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue56.ComponentProvideOptions, true, {}, any>;
495
+ declare const __VLS_base$1: vue14.DefineComponent<{}, __TdDialogExpose, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
495
496
  declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
496
497
  declare const _default: typeof __VLS_export$1;
497
498
  type __VLS_WithSlots$1<T, S> = T & {
@@ -505,29 +506,32 @@ type Instance = InstanceType<typeof _default>;
505
506
  type TdDialogInstance = Instance & Omit<DialogInstance, keyof Instance & string>;
506
507
  //#endregion
507
508
  //#region src/enum-select/store.d.ts
508
- type OptionItem<T> = {
509
+ type OptionItem<T = any, E = undefined> = E extends undefined ? {
509
510
  label: string;
510
511
  value: T;
511
- };
512
- type DataOption<T> = {
512
+ } : {
513
+ label: string;
514
+ value: T;
515
+ } & E;
516
+ type EnumData<T extends OptionItem> = {
513
517
  loading: boolean;
514
- options: Array<OptionItem<T>>;
515
- fetch?: (code: string) => Promise<OptionItem<T>[]>;
518
+ options: Array<T>;
519
+ fetch?: (code: string) => Promise<T[]>;
516
520
  };
517
521
  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>;
522
+ declare function getEnum<V, E = undefined>(code: string, fetch?: EnumData<OptionItem<V, E>>['fetch']): ComputedRef<OptionItem<V, E>[]>;
523
+ declare function getEnum<V, E = undefined>(code: string, value: V, fetch?: EnumData<OptionItem<V, E>>['fetch']): ComputedRef<OptionItem<V, E> | undefined>;
520
524
  declare function resetEnum(code: string): void;
521
- declare function setDefaultEnumFetch(fetch: Exclude<DataOption<any>['fetch'], undefined>): void;
525
+ declare function setDefaultEnumFetch(fetch: Exclude<EnumData<any>['fetch'], undefined>): void;
522
526
  //#endregion
523
527
  //#region src/enum-select/enum-select.vue.d.ts
524
528
  type __VLS_Props = {
525
529
  code: string;
526
- fetch?: DataOption<any>['fetch'];
530
+ fetch?: EnumData<any>['fetch'];
527
531
  };
528
532
  declare var __VLS_10: string | number, __VLS_11: any;
529
533
  type __VLS_Slots = {} & { [K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any };
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>;
534
+ declare const __VLS_base: vue14.DefineComponent<__VLS_Props, SelectInstance, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue14.ComponentProvideOptions, false, {}, any>;
531
535
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
532
536
  declare const _default$1: typeof __VLS_export;
533
537
  type __VLS_WithSlots<T, S> = T & {
@@ -540,10 +544,10 @@ type __VLS_WithSlots<T, S> = T & {
540
544
  type TdEnumSelectInstance = InstanceType<typeof _default$1>;
541
545
  //#endregion
542
546
  //#region src/hooks/use-reuse.d.ts
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, {
547
+ declare function useReuse(): (vue14.DefineComponent<{}, () => null, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any> | vue14.DefineComponent<{}, () => vue14.VNode<vue14.RendererNode, vue14.RendererElement, {
544
548
  [key: string]: any;
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;
549
+ }>[] | undefined, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any> | vue14.ComputedRef<Readonly<{
550
+ [name: string]: vue14.Slot<any> | undefined;
547
551
  }>>)[];
548
552
  //#endregion
549
553
  //#region src/utils/index.d.ts
package/dist/index.js CHANGED
@@ -440,13 +440,14 @@ var widget_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
440
440
  });
441
441
  const Widget = resolveWidget(props.component);
442
442
  const widgetAttrs = computed(() => {
443
- return {
444
- ...pick(attrs, [{
445
- from: /^widget/,
446
- to: (k) => toCamelCase(k.slice(6))
447
- }]),
443
+ const attr4Widget = pick(attrs, [{
444
+ from: /^widget/,
445
+ to: (k) => toCamelCase(k.slice(6))
446
+ }]);
447
+ return Object.fromEntries(Object.entries({
448
+ ...attr4Widget,
448
449
  ...unref(props.widget)
449
- };
450
+ }).map(([k, v]) => [k, unref(v)]));
450
451
  });
451
452
  const widgetSlots = formCtx.getParentSlots(resolveSlotNames(props.slots, props.prop));
452
453
  const formItemSlots = formCtx.getParentSlots(resolveSlotNames(props.itemSlots, props.prop, "item"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiddy",
3
- "version": "2.3.2",
3
+ "version": "2.4.0",
4
4
  "packageManager": "pnpm@10.11.0",
5
5
  "description": "A set of Vue 3 components based on element-plus",
6
6
  "type": "module",