tiddy 2.4.0 → 2.5.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,5 +1,5 @@
1
- import * as vue14 from "vue";
2
- import { AllowedComponentProps, CSSProperties, Component, ComputedRef, DefineComponent, ExtractPublicPropTypes, PropType, Raw, Ref as Ref$1, Slot } from "vue";
1
+ import * as vue69 from "vue";
2
+ import { AllowedComponentProps, CSSProperties, Component, ComputedRef, DefineComponent, ExtractPublicPropTypes, HTMLAttributes, 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
 
@@ -23,6 +23,9 @@ type OrRef<T> = T | Ref<T>;
23
23
  type TdFieldsProps = {
24
24
  fields: TdFormFieldProps[];
25
25
  };
26
+ type TdArrayFieldsProps = {
27
+ fields: OrFunction<TdFormFieldProps[]>;
28
+ };
26
29
  declare const objectFieldPropsDef: {
27
30
  prop: {
28
31
  type: PropType<OrFunction<string>>;
@@ -148,7 +151,7 @@ declare const arrayFieldPropsDef: {
148
151
  type: PropType<FormProps["labelPosition"]>;
149
152
  };
150
153
  fields: {
151
- type: PropType<any[]>;
154
+ type: PropType<OrFunction<any[]>>;
152
155
  default: () => never[];
153
156
  };
154
157
  type: {
@@ -180,7 +183,7 @@ declare const arrayFieldPropsDef: {
180
183
  default: boolean;
181
184
  };
182
185
  };
183
- type TdArrayFieldProps = TdFieldsProps & ExtractPublicPropTypes<typeof arrayFieldPropsDef> & AllowedComponentProps;
186
+ type TdArrayFieldProps = TdArrayFieldsProps & ExtractPublicPropTypes<typeof arrayFieldPropsDef> & AllowedComponentProps;
184
187
  declare const layoutFieldPropsDef: {
185
188
  prop: {
186
189
  type: PropType<OrFunction<string>>;
@@ -241,10 +244,10 @@ declare const tdformItemProps: {
241
244
  };
242
245
  };
243
246
  type TdFormItemProps = ExtractPublicPropTypes<typeof tdformItemProps> & Partial<FormItemProps>;
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>>>): {
247
+ type PropsOrRef<T> = { [K in keyof T]?: OrRef<T[K]> } | Ref$1<T>;
248
+ declare function widget<T>(c: T | Raw<T>, props?: PropsOrRef<PropsOf<T> & HTMLAttributes>): {
246
249
  component: T | Raw<T>;
247
- widget: any;
250
+ widget: PropsOrRef<PropsOf<T> & HTMLAttributes> | undefined;
248
251
  };
249
252
  //#endregion
250
253
  //#region src/form/form.vue.d.ts
@@ -253,7 +256,7 @@ declare function isValidateError(prop: string): boolean;
253
256
  declare const expose$1: {
254
257
  reValidateErrorFields: typeof reValidateErrorFields;
255
258
  isValidateError: typeof isValidateError;
256
- model: vue14.ComputedRef<unknown>;
259
+ model: vue69.ComputedRef<unknown>;
257
260
  };
258
261
  type __TdFormExpose = typeof expose$1 & FormInstance;
259
262
  declare var __VLS_11$2: {}, __VLS_13$1: {}, __VLS_19$1: {};
@@ -264,24 +267,24 @@ type __VLS_Slots$4 = {} & {
264
267
  } & {
265
268
  suffix?: (props: typeof __VLS_19$1) => any;
266
269
  };
267
- declare const __VLS_base$4: vue14.DefineComponent<vue14.ExtractPropTypes<{
270
+ declare const __VLS_base$4: vue69.DefineComponent<vue69.ExtractPropTypes<{
268
271
  fields: {
269
- type: vue14.PropType<TdFormFieldProps[]>;
272
+ type: vue69.PropType<TdFormFieldProps[]>;
270
273
  default: () => never[];
271
274
  };
272
275
  item: {
273
- type: vue14.PropType<element_plus0.FormItemProps>;
276
+ type: vue69.PropType<element_plus0.FormItemProps>;
274
277
  default: () => {};
275
278
  };
276
- }>, __TdFormExpose, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {
279
+ }>, __TdFormExpose, {}, {}, {}, vue69.ComponentOptionsMixin, vue69.ComponentOptionsMixin, {
277
280
  submit: (data: any) => any;
278
- }, string, vue14.PublicProps, Readonly<vue14.ExtractPropTypes<{
281
+ }, string, vue69.PublicProps, Readonly<vue69.ExtractPropTypes<{
279
282
  fields: {
280
- type: vue14.PropType<TdFormFieldProps[]>;
283
+ type: vue69.PropType<TdFormFieldProps[]>;
281
284
  default: () => never[];
282
285
  };
283
286
  item: {
284
- type: vue14.PropType<element_plus0.FormItemProps>;
287
+ type: vue69.PropType<element_plus0.FormItemProps>;
285
288
  default: () => {};
286
289
  };
287
290
  }>> & Readonly<{
@@ -289,7 +292,7 @@ declare const __VLS_base$4: vue14.DefineComponent<vue14.ExtractPropTypes<{
289
292
  }>, {
290
293
  fields: TdFormFieldProps[];
291
294
  item: element_plus0.FormItemProps;
292
- }, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
295
+ }, {}, {}, {}, string, vue69.ComponentProvideOptions, true, {}, any>;
293
296
  declare const __VLS_export$6: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
294
297
  declare const _default$2: typeof __VLS_export$6;
295
298
  type __VLS_WithSlots$4<T, S> = T & {
@@ -301,37 +304,37 @@ type __VLS_WithSlots$4<T, S> = T & {
301
304
  //#region src/form/form-item.vue.d.ts
302
305
  declare var __VLS_10$1: string | number, __VLS_11$1: any;
303
306
  type __VLS_Slots$3 = {} & { [K in NonNullable<typeof __VLS_10$1>]?: (props: typeof __VLS_11$1) => any };
304
- declare const __VLS_base$3: vue14.DefineComponent<vue14.ExtractPropTypes<{
307
+ declare const __VLS_base$3: vue69.DefineComponent<vue69.ExtractPropTypes<{
305
308
  messageLabel: {
306
- type: vue14.PropType<OrRef<string>>;
309
+ type: vue69.PropType<OrRef<string>>;
307
310
  default: string;
308
311
  };
309
312
  formatMessage: {
310
- type: vue14.PropType<AnyFunction>;
313
+ type: vue69.PropType<AnyFunction>;
311
314
  default: null;
312
315
  };
313
316
  hideRequiredAsterisk: {
314
- type: vue14.PropType<boolean>;
317
+ type: vue69.PropType<boolean>;
315
318
  default: boolean;
316
319
  };
317
- }>, {}, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<vue14.ExtractPropTypes<{
320
+ }>, {}, {}, {}, {}, vue69.ComponentOptionsMixin, vue69.ComponentOptionsMixin, {}, string, vue69.PublicProps, Readonly<vue69.ExtractPropTypes<{
318
321
  messageLabel: {
319
- type: vue14.PropType<OrRef<string>>;
322
+ type: vue69.PropType<OrRef<string>>;
320
323
  default: string;
321
324
  };
322
325
  formatMessage: {
323
- type: vue14.PropType<AnyFunction>;
326
+ type: vue69.PropType<AnyFunction>;
324
327
  default: null;
325
328
  };
326
329
  hideRequiredAsterisk: {
327
- type: vue14.PropType<boolean>;
330
+ type: vue69.PropType<boolean>;
328
331
  default: boolean;
329
332
  };
330
333
  }>> & Readonly<{}>, {
331
334
  hideRequiredAsterisk: boolean;
332
335
  messageLabel: any;
333
336
  formatMessage: AnyFunction;
334
- }, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
337
+ }, {}, {}, {}, string, vue69.ComponentProvideOptions, true, {}, any>;
335
338
  declare const __VLS_export$5: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
336
339
  declare const _default$4: typeof __VLS_export$5;
337
340
  type __VLS_WithSlots$3<T, S> = T & {
@@ -341,7 +344,7 @@ type __VLS_WithSlots$3<T, S> = T & {
341
344
  };
342
345
  //#endregion
343
346
  //#region src/form/form-field.vue.d.ts
344
- declare const __VLS_export$4: vue14.DefineComponent<{}, {}, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
347
+ declare const __VLS_export$4: vue69.DefineComponent<{}, {}, {}, {}, {}, vue69.ComponentOptionsMixin, vue69.ComponentOptionsMixin, {}, string, vue69.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue69.ComponentProvideOptions, true, {}, any>;
345
348
  declare const _default$3: typeof __VLS_export$4;
346
349
  //#endregion
347
350
  //#region src/form/index.d.ts
@@ -389,19 +392,19 @@ type __VLS_Slots$2 = {} & { [K in NonNullable<typeof __VLS_16>]?: (props: typeof
389
392
  } & {
390
393
  after?: (props: typeof __VLS_19) => any;
391
394
  };
392
- declare const __VLS_base$2: vue14.DefineComponent<vue14.ExtractPropTypes<{
395
+ declare const __VLS_base$2: vue69.DefineComponent<vue69.ExtractPropTypes<{
393
396
  columns: {
394
- type: vue14.PropType<TdTableColumnProps[]>;
397
+ type: vue69.PropType<TdTableColumnProps[]>;
395
398
  default: () => never[];
396
399
  };
397
- }>, TableInstance, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<vue14.ExtractPropTypes<{
400
+ }>, TableInstance, {}, {}, {}, vue69.ComponentOptionsMixin, vue69.ComponentOptionsMixin, {}, string, vue69.PublicProps, Readonly<vue69.ExtractPropTypes<{
398
401
  columns: {
399
- type: vue14.PropType<TdTableColumnProps[]>;
402
+ type: vue69.PropType<TdTableColumnProps[]>;
400
403
  default: () => never[];
401
404
  };
402
405
  }>> & Readonly<{}>, {
403
406
  columns: TdTableColumnProps[];
404
- }, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
407
+ }, {}, {}, {}, string, vue69.ComponentProvideOptions, true, {}, any>;
405
408
  declare const __VLS_export$3: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
406
409
  declare const _default$5: typeof __VLS_export$3;
407
410
  type __VLS_WithSlots$2<T, S> = T & {
@@ -411,55 +414,55 @@ type __VLS_WithSlots$2<T, S> = T & {
411
414
  };
412
415
  //#endregion
413
416
  //#region src/table/table-col.vue.d.ts
414
- declare const __VLS_export$2: vue14.DefineComponent<vue14.ExtractPropTypes<{
417
+ declare const __VLS_export$2: vue69.DefineComponent<vue69.ExtractPropTypes<{
415
418
  slots: {
416
- type: vue14.PropType<OrArray<SlotDef>>;
419
+ type: vue69.PropType<OrArray<SlotDef>>;
417
420
  default: null;
418
421
  };
419
422
  columns: {
420
- type: vue14.PropType<TdTableColumnProps[]>;
423
+ type: vue69.PropType<TdTableColumnProps[]>;
421
424
  default: () => never[];
422
425
  };
423
426
  transform: {
424
- type: vue14.PropType<AnyFunction[]>;
427
+ type: vue69.PropType<AnyFunction[]>;
425
428
  default: () => never[];
426
429
  };
427
430
  hide: {
428
- type: vue14.PropType<boolean | vue14.Ref<boolean>>;
431
+ type: vue69.PropType<boolean | vue69.Ref<boolean>>;
429
432
  default: false;
430
433
  };
431
434
  dangerouslyUseHTMLString: {
432
- type: vue14.PropType<boolean | vue14.Ref<boolean>>;
435
+ type: vue69.PropType<boolean | vue69.Ref<boolean>>;
433
436
  default: false;
434
437
  };
435
- }>, {}, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<vue14.ExtractPropTypes<{
438
+ }>, {}, {}, {}, {}, vue69.ComponentOptionsMixin, vue69.ComponentOptionsMixin, {}, string, vue69.PublicProps, Readonly<vue69.ExtractPropTypes<{
436
439
  slots: {
437
- type: vue14.PropType<OrArray<SlotDef>>;
440
+ type: vue69.PropType<OrArray<SlotDef>>;
438
441
  default: null;
439
442
  };
440
443
  columns: {
441
- type: vue14.PropType<TdTableColumnProps[]>;
444
+ type: vue69.PropType<TdTableColumnProps[]>;
442
445
  default: () => never[];
443
446
  };
444
447
  transform: {
445
- type: vue14.PropType<AnyFunction[]>;
448
+ type: vue69.PropType<AnyFunction[]>;
446
449
  default: () => never[];
447
450
  };
448
451
  hide: {
449
- type: vue14.PropType<boolean | vue14.Ref<boolean>>;
452
+ type: vue69.PropType<boolean | vue69.Ref<boolean>>;
450
453
  default: false;
451
454
  };
452
455
  dangerouslyUseHTMLString: {
453
- type: vue14.PropType<boolean | vue14.Ref<boolean>>;
456
+ type: vue69.PropType<boolean | vue69.Ref<boolean>>;
454
457
  default: false;
455
458
  };
456
459
  }>> & Readonly<{}>, {
457
- hide: boolean | vue14.Ref<boolean, boolean>;
458
460
  slots: OrArray<SlotDef>;
459
461
  columns: TdTableColumnProps[];
460
462
  transform: AnyFunction[];
461
- dangerouslyUseHTMLString: boolean | vue14.Ref<boolean, boolean>;
462
- }, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
463
+ hide: boolean | vue69.Ref<boolean, boolean>;
464
+ dangerouslyUseHTMLString: boolean | vue69.Ref<boolean, boolean>;
465
+ }, {}, {}, {}, string, vue69.ComponentProvideOptions, true, {}, any>;
463
466
  declare const _default$6: typeof __VLS_export$2;
464
467
  //#endregion
465
468
  //#region src/table/index.d.ts
@@ -492,7 +495,7 @@ declare var __VLS_13: "default" | "title" | "header" | "footer", __VLS_14: {
492
495
  titleClass?: string | undefined;
493
496
  };
494
497
  type __VLS_Slots$1 = {} & { [K in NonNullable<typeof __VLS_13>]?: (props: typeof __VLS_14) => any };
495
- declare const __VLS_base$1: vue14.DefineComponent<{}, __TdDialogExpose, {}, {}, {}, vue14.ComponentOptionsMixin, vue14.ComponentOptionsMixin, {}, string, vue14.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue14.ComponentProvideOptions, true, {}, any>;
498
+ declare const __VLS_base$1: vue69.DefineComponent<{}, __TdDialogExpose, {}, {}, {}, vue69.ComponentOptionsMixin, vue69.ComponentOptionsMixin, {}, string, vue69.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue69.ComponentProvideOptions, true, {}, any>;
496
499
  declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
497
500
  declare const _default: typeof __VLS_export$1;
498
501
  type __VLS_WithSlots$1<T, S> = T & {
@@ -531,7 +534,7 @@ type __VLS_Props = {
531
534
  };
532
535
  declare var __VLS_10: string | number, __VLS_11: any;
533
536
  type __VLS_Slots = {} & { [K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => 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>;
537
+ declare const __VLS_base: vue69.DefineComponent<__VLS_Props, SelectInstance, {}, {}, {}, vue69.ComponentOptionsMixin, vue69.ComponentOptionsMixin, {}, string, vue69.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue69.ComponentProvideOptions, false, {}, any>;
535
538
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
536
539
  declare const _default$1: typeof __VLS_export;
537
540
  type __VLS_WithSlots<T, S> = T & {
@@ -544,10 +547,10 @@ type __VLS_WithSlots<T, S> = T & {
544
547
  type TdEnumSelectInstance = InstanceType<typeof _default$1>;
545
548
  //#endregion
546
549
  //#region src/hooks/use-reuse.d.ts
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, {
550
+ declare function useReuse(): (vue69.DefineComponent<{}, () => null, {}, {}, {}, vue69.ComponentOptionsMixin, vue69.ComponentOptionsMixin, {}, string, vue69.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue69.ComponentProvideOptions, true, {}, any> | vue69.DefineComponent<{}, () => vue69.VNode<vue69.RendererNode, vue69.RendererElement, {
548
551
  [key: string]: any;
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;
552
+ }>[] | undefined, {}, {}, {}, vue69.ComponentOptionsMixin, vue69.ComponentOptionsMixin, {}, string, vue69.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue69.ComponentProvideOptions, true, {}, any> | vue69.ComputedRef<Readonly<{
553
+ [name: string]: vue69.Slot<any> | undefined;
551
554
  }>>)[];
552
555
  //#endregion
553
556
  //#region src/utils/index.d.ts
package/dist/index.js CHANGED
@@ -46,6 +46,10 @@ const fieldsPropsDef = { fields: {
46
46
  type: Array,
47
47
  default: () => []
48
48
  } };
49
+ const arrayFieldsPropsDef = { fields: {
50
+ type: [Array, Function],
51
+ default: () => []
52
+ } };
49
53
  const commonFieldPropsDef = {
50
54
  prop: {
51
55
  type: [String, Function],
@@ -188,7 +192,7 @@ const arrayFieldPropsDef = {
188
192
  type: Boolean,
189
193
  default: false
190
194
  },
191
- ...fieldsPropsDef,
195
+ ...arrayFieldsPropsDef,
192
196
  ...commonFieldPropsDef
193
197
  };
194
198
  const layoutFieldPropsDef = {
@@ -684,9 +688,11 @@ var form_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
684
688
  setup(__props) {
685
689
  const attrs = useAttrs();
686
690
  const fullProp = computed(() => attrs["full-prop"] || attrs.prop);
691
+ const formCtx = inject(formCtxKey);
687
692
  const fieldAttrs = computed(() => {
688
693
  const attr = {};
689
694
  for (const [k, v] of Object.entries(attrs)) if (k === "component" && v) attr[k] = markRaw(toRaw(v));
695
+ else if (k === "fields" && isFunction(v) && !attrs.type) attr[k] = v(getDeepValue(formCtx.model, attrs["full-prop"]));
690
696
  else attr[k] = v;
691
697
  return attr;
692
698
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiddy",
3
- "version": "2.4.0",
3
+ "version": "2.5.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",