tiddy 2.6.3 → 2.8.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 vue27 from "vue";
1
+ import * as vue47 from "vue";
2
2
  import { AllowedComponentProps, CSSProperties, Component, ComputedRef, DefineComponent, Directive, ExtractPublicPropTypes, HTMLAttributes, PropType, Raw, Ref, 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";
@@ -162,22 +162,42 @@ declare const arrayFieldPropsDef: {
162
162
  rawValue: {
163
163
  type: PropType<AnyFunction>;
164
164
  };
165
- outerEmptyAction: {
165
+ slotProp: {
166
166
  type: StringConstructor;
167
+ required: false;
168
+ };
169
+ outerEmptyAction: {
170
+ type: PropType<OrArray<SlotDef>>;
167
171
  default: null;
168
172
  };
169
173
  emptyAction: {
170
- type: StringConstructor;
174
+ type: PropType<OrArray<SlotDef>>;
171
175
  default: null;
172
176
  };
173
177
  rowAction: {
174
- type: StringConstructor;
178
+ type: PropType<OrArray<SlotDef>>;
175
179
  default: null;
176
180
  };
177
181
  lineStyle: {
178
182
  type: PropType<CSSProperties>;
179
183
  default: () => {};
180
184
  };
185
+ item: {
186
+ type: PropType<OrRef<TdFormItemProps>>;
187
+ default: () => {};
188
+ };
189
+ lineClass: {
190
+ type: StringConstructor;
191
+ default: string;
192
+ };
193
+ rowFieldClass: {
194
+ type: StringConstructor;
195
+ default: string;
196
+ };
197
+ rowActionClass: {
198
+ type: StringConstructor;
199
+ default: string;
200
+ };
181
201
  mandatory: {
182
202
  type: BooleanConstructor;
183
203
  default: boolean;
@@ -211,6 +231,17 @@ declare const layoutFieldPropsDef: {
211
231
  default: string;
212
232
  required: true;
213
233
  };
234
+ component: {
235
+ type: PropType<string | Component | Raw<Component>>;
236
+ };
237
+ widget: {
238
+ type: PropType<Record<string, any>>;
239
+ default: () => {};
240
+ };
241
+ on: {
242
+ type: PropType<Record<string, AnyFunction>>;
243
+ default: () => {};
244
+ };
214
245
  slots: {
215
246
  type: PropType<OrArray<SlotDef>>;
216
247
  default: () => never[];
@@ -260,7 +291,7 @@ declare function isValidateError(prop: string): boolean;
260
291
  declare const expose$1: {
261
292
  reValidateErrorFields: typeof reValidateErrorFields;
262
293
  isValidateError: typeof isValidateError;
263
- model: vue27.ComputedRef<unknown>;
294
+ model: vue47.ComputedRef<unknown>;
264
295
  };
265
296
  type __TdFormExpose = typeof expose$1 & FormInstance;
266
297
  declare var __VLS_11$2: {}, __VLS_13$1: {}, __VLS_19$1: {};
@@ -271,24 +302,24 @@ type __VLS_Slots$4 = {} & {
271
302
  } & {
272
303
  suffix?: (props: typeof __VLS_19$1) => any;
273
304
  };
274
- declare const __VLS_base$4: vue27.DefineComponent<vue27.ExtractPropTypes<{
305
+ declare const __VLS_base$4: vue47.DefineComponent<vue47.ExtractPropTypes<{
275
306
  fields: {
276
- type: vue27.PropType<TdFormFieldProps[]>;
307
+ type: vue47.PropType<TdFormFieldProps[]>;
277
308
  default: () => never[];
278
309
  };
279
310
  item: {
280
- type: vue27.PropType<element_plus0.FormItemProps>;
311
+ type: vue47.PropType<element_plus0.FormItemProps>;
281
312
  default: () => {};
282
313
  };
283
- }>, __TdFormExpose, {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {
314
+ }>, __TdFormExpose, {}, {}, {}, vue47.ComponentOptionsMixin, vue47.ComponentOptionsMixin, {
284
315
  submit: (data: any) => any;
285
- }, string, vue27.PublicProps, Readonly<vue27.ExtractPropTypes<{
316
+ }, string, vue47.PublicProps, Readonly<vue47.ExtractPropTypes<{
286
317
  fields: {
287
- type: vue27.PropType<TdFormFieldProps[]>;
318
+ type: vue47.PropType<TdFormFieldProps[]>;
288
319
  default: () => never[];
289
320
  };
290
321
  item: {
291
- type: vue27.PropType<element_plus0.FormItemProps>;
322
+ type: vue47.PropType<element_plus0.FormItemProps>;
292
323
  default: () => {};
293
324
  };
294
325
  }>> & Readonly<{
@@ -296,7 +327,7 @@ declare const __VLS_base$4: vue27.DefineComponent<vue27.ExtractPropTypes<{
296
327
  }>, {
297
328
  fields: TdFormFieldProps[];
298
329
  item: element_plus0.FormItemProps;
299
- }, {}, {}, {}, string, vue27.ComponentProvideOptions, true, {}, any>;
330
+ }, {}, {}, {}, string, vue47.ComponentProvideOptions, true, {}, any>;
300
331
  declare const __VLS_export$6: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
301
332
  declare const _default$3: typeof __VLS_export$6;
302
333
  type __VLS_WithSlots$4<T, S> = T & {
@@ -308,46 +339,46 @@ type __VLS_WithSlots$4<T, S> = T & {
308
339
  //#region src/form/form-item.vue.d.ts
309
340
  declare var __VLS_10$1: string | number, __VLS_11$1: any;
310
341
  type __VLS_Slots$3 = {} & { [K in NonNullable<typeof __VLS_10$1>]?: (props: typeof __VLS_11$1) => any };
311
- declare const __VLS_base$3: vue27.DefineComponent<vue27.ExtractPropTypes<{
342
+ declare const __VLS_base$3: vue47.DefineComponent<vue47.ExtractPropTypes<{
312
343
  messageLabel: {
313
- type: vue27.PropType<OrRef<string>>;
344
+ type: vue47.PropType<OrRef<string>>;
314
345
  default: string;
315
346
  };
316
347
  formatMessage: {
317
- type: vue27.PropType<AnyFunction>;
348
+ type: vue47.PropType<AnyFunction>;
318
349
  default: null;
319
350
  };
320
351
  hideRequiredAsterisk: {
321
- type: vue27.PropType<boolean>;
352
+ type: vue47.PropType<boolean>;
322
353
  default: boolean;
323
354
  };
324
355
  errorLayout: {
325
- type: vue27.PropType<"nowrap" | "wrap" | "expand">;
356
+ type: vue47.PropType<"nowrap" | "wrap" | "expand">;
326
357
  default: string;
327
358
  };
328
- }>, {}, {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {}, string, vue27.PublicProps, Readonly<vue27.ExtractPropTypes<{
359
+ }>, {}, {}, {}, {}, vue47.ComponentOptionsMixin, vue47.ComponentOptionsMixin, {}, string, vue47.PublicProps, Readonly<vue47.ExtractPropTypes<{
329
360
  messageLabel: {
330
- type: vue27.PropType<OrRef<string>>;
361
+ type: vue47.PropType<OrRef<string>>;
331
362
  default: string;
332
363
  };
333
364
  formatMessage: {
334
- type: vue27.PropType<AnyFunction>;
365
+ type: vue47.PropType<AnyFunction>;
335
366
  default: null;
336
367
  };
337
368
  hideRequiredAsterisk: {
338
- type: vue27.PropType<boolean>;
369
+ type: vue47.PropType<boolean>;
339
370
  default: boolean;
340
371
  };
341
372
  errorLayout: {
342
- type: vue27.PropType<"nowrap" | "wrap" | "expand">;
373
+ type: vue47.PropType<"nowrap" | "wrap" | "expand">;
343
374
  default: string;
344
375
  };
345
376
  }>> & Readonly<{}>, {
346
- hideRequiredAsterisk: boolean;
347
377
  messageLabel: OrRef<string>;
348
378
  formatMessage: AnyFunction;
379
+ hideRequiredAsterisk: boolean;
349
380
  errorLayout: "wrap" | "nowrap" | "expand";
350
- }, {}, {}, {}, string, vue27.ComponentProvideOptions, true, {}, any>;
381
+ }, {}, {}, {}, string, vue47.ComponentProvideOptions, true, {}, any>;
351
382
  declare const __VLS_export$5: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
352
383
  declare const _default$5: typeof __VLS_export$5;
353
384
  type __VLS_WithSlots$3<T, S> = T & {
@@ -357,7 +388,7 @@ type __VLS_WithSlots$3<T, S> = T & {
357
388
  };
358
389
  //#endregion
359
390
  //#region src/form/form-field.vue.d.ts
360
- declare const __VLS_export$4: vue27.DefineComponent<{}, {}, {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {}, string, vue27.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue27.ComponentProvideOptions, true, {}, any>;
391
+ declare const __VLS_export$4: vue47.DefineComponent<{}, {}, {}, {}, {}, vue47.ComponentOptionsMixin, vue47.ComponentOptionsMixin, {}, string, vue47.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue47.ComponentProvideOptions, true, {}, any>;
361
392
  declare const _default$4: typeof __VLS_export$4;
362
393
  //#endregion
363
394
  //#region src/form/index.d.ts
@@ -405,19 +436,19 @@ type __VLS_Slots$2 = {} & { [K in NonNullable<typeof __VLS_16>]?: (props: typeof
405
436
  } & {
406
437
  after?: (props: typeof __VLS_19) => any;
407
438
  };
408
- declare const __VLS_base$2: vue27.DefineComponent<vue27.ExtractPropTypes<{
439
+ declare const __VLS_base$2: vue47.DefineComponent<vue47.ExtractPropTypes<{
409
440
  columns: {
410
- type: vue27.PropType<TdTableColumnProps[]>;
441
+ type: vue47.PropType<TdTableColumnProps[]>;
411
442
  default: () => never[];
412
443
  };
413
- }>, TableInstance, {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {}, string, vue27.PublicProps, Readonly<vue27.ExtractPropTypes<{
444
+ }>, TableInstance, {}, {}, {}, vue47.ComponentOptionsMixin, vue47.ComponentOptionsMixin, {}, string, vue47.PublicProps, Readonly<vue47.ExtractPropTypes<{
414
445
  columns: {
415
- type: vue27.PropType<TdTableColumnProps[]>;
446
+ type: vue47.PropType<TdTableColumnProps[]>;
416
447
  default: () => never[];
417
448
  };
418
449
  }>> & Readonly<{}>, {
419
450
  columns: TdTableColumnProps[];
420
- }, {}, {}, {}, string, vue27.ComponentProvideOptions, true, {}, any>;
451
+ }, {}, {}, {}, string, vue47.ComponentProvideOptions, true, {}, any>;
421
452
  declare const __VLS_export$3: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
422
453
  declare const _default$6: typeof __VLS_export$3;
423
454
  type __VLS_WithSlots$2<T, S> = T & {
@@ -427,55 +458,55 @@ type __VLS_WithSlots$2<T, S> = T & {
427
458
  };
428
459
  //#endregion
429
460
  //#region src/table/table-col.vue.d.ts
430
- declare const __VLS_export$2: vue27.DefineComponent<vue27.ExtractPropTypes<{
461
+ declare const __VLS_export$2: vue47.DefineComponent<vue47.ExtractPropTypes<{
431
462
  slots: {
432
- type: vue27.PropType<OrArray<SlotDef>>;
463
+ type: vue47.PropType<OrArray<SlotDef>>;
433
464
  default: null;
434
465
  };
435
466
  columns: {
436
- type: vue27.PropType<TdTableColumnProps[]>;
467
+ type: vue47.PropType<TdTableColumnProps[]>;
437
468
  default: () => never[];
438
469
  };
439
470
  transform: {
440
- type: vue27.PropType<AnyFunction[]>;
471
+ type: vue47.PropType<AnyFunction[]>;
441
472
  default: () => never[];
442
473
  };
443
474
  hide: {
444
- type: vue27.PropType<boolean | vue27.Ref<boolean>>;
475
+ type: vue47.PropType<boolean | vue47.Ref<boolean>>;
445
476
  default: false;
446
477
  };
447
478
  dangerouslyUseHTMLString: {
448
- type: vue27.PropType<boolean | vue27.Ref<boolean>>;
479
+ type: vue47.PropType<boolean | vue47.Ref<boolean>>;
449
480
  default: false;
450
481
  };
451
- }>, {}, {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {}, string, vue27.PublicProps, Readonly<vue27.ExtractPropTypes<{
482
+ }>, {}, {}, {}, {}, vue47.ComponentOptionsMixin, vue47.ComponentOptionsMixin, {}, string, vue47.PublicProps, Readonly<vue47.ExtractPropTypes<{
452
483
  slots: {
453
- type: vue27.PropType<OrArray<SlotDef>>;
484
+ type: vue47.PropType<OrArray<SlotDef>>;
454
485
  default: null;
455
486
  };
456
487
  columns: {
457
- type: vue27.PropType<TdTableColumnProps[]>;
488
+ type: vue47.PropType<TdTableColumnProps[]>;
458
489
  default: () => never[];
459
490
  };
460
491
  transform: {
461
- type: vue27.PropType<AnyFunction[]>;
492
+ type: vue47.PropType<AnyFunction[]>;
462
493
  default: () => never[];
463
494
  };
464
495
  hide: {
465
- type: vue27.PropType<boolean | vue27.Ref<boolean>>;
496
+ type: vue47.PropType<boolean | vue47.Ref<boolean>>;
466
497
  default: false;
467
498
  };
468
499
  dangerouslyUseHTMLString: {
469
- type: vue27.PropType<boolean | vue27.Ref<boolean>>;
500
+ type: vue47.PropType<boolean | vue47.Ref<boolean>>;
470
501
  default: false;
471
502
  };
472
503
  }>> & Readonly<{}>, {
473
504
  slots: OrArray<SlotDef>;
474
- hide: boolean | vue27.Ref<boolean, boolean>;
505
+ hide: boolean | vue47.Ref<boolean, boolean>;
475
506
  columns: TdTableColumnProps[];
476
507
  transform: AnyFunction[];
477
- dangerouslyUseHTMLString: boolean | vue27.Ref<boolean, boolean>;
478
- }, {}, {}, {}, string, vue27.ComponentProvideOptions, true, {}, any>;
508
+ dangerouslyUseHTMLString: boolean | vue47.Ref<boolean, boolean>;
509
+ }, {}, {}, {}, string, vue47.ComponentProvideOptions, true, {}, any>;
479
510
  declare const _default$7: typeof __VLS_export$2;
480
511
  //#endregion
481
512
  //#region src/table/index.d.ts
@@ -508,7 +539,7 @@ declare var __VLS_13: "default" | "footer" | "header" | "title", __VLS_14: {
508
539
  titleClass?: string | undefined;
509
540
  };
510
541
  type __VLS_Slots$1 = {} & { [K in NonNullable<typeof __VLS_13>]?: (props: typeof __VLS_14) => any };
511
- declare const __VLS_base$1: vue27.DefineComponent<{}, __TdDialogExpose, {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {}, string, vue27.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue27.ComponentProvideOptions, true, {}, any>;
542
+ declare const __VLS_base$1: vue47.DefineComponent<{}, __TdDialogExpose, {}, {}, {}, vue47.ComponentOptionsMixin, vue47.ComponentOptionsMixin, {}, string, vue47.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue47.ComponentProvideOptions, true, {}, any>;
512
543
  declare const __VLS_export$1: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
513
544
  declare const _default: typeof __VLS_export$1;
514
545
  type __VLS_WithSlots$1<T, S> = T & {
@@ -547,7 +578,7 @@ type __VLS_Props = {
547
578
  };
548
579
  declare var __VLS_10: string | number, __VLS_11: any;
549
580
  type __VLS_Slots = {} & { [K in NonNullable<typeof __VLS_10>]?: (props: typeof __VLS_11) => any };
550
- declare const __VLS_base: vue27.DefineComponent<__VLS_Props, SelectInstance, {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {}, string, vue27.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue27.ComponentProvideOptions, false, {}, any>;
581
+ declare const __VLS_base: vue47.DefineComponent<__VLS_Props, SelectInstance, {}, {}, {}, vue47.ComponentOptionsMixin, vue47.ComponentOptionsMixin, {}, string, vue47.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue47.ComponentProvideOptions, false, {}, any>;
551
582
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
552
583
  declare const _default$2: typeof __VLS_export;
553
584
  type __VLS_WithSlots<T, S> = T & {
@@ -567,7 +598,7 @@ interface DirectiveConfig {
567
598
  modifiers?: Record<string, boolean>;
568
599
  enable?: boolean;
569
600
  }
570
- declare const _default$1: vue27.DefineComponent<vue27.ExtractPropTypes<{
601
+ declare const _default$1: vue47.DefineComponent<vue47.ExtractPropTypes<{
571
602
  directives: {
572
603
  type: () => DirectiveConfig[];
573
604
  default: () => never[];
@@ -580,11 +611,11 @@ declare const _default$1: vue27.DefineComponent<vue27.ExtractPropTypes<{
580
611
  type: StringConstructor;
581
612
  default: string;
582
613
  };
583
- }>, () => vue27.VNode<vue27.RendererNode, vue27.RendererElement, {
614
+ }>, () => vue47.VNode<vue47.RendererNode, vue47.RendererElement, {
584
615
  [key: string]: any;
585
- }> | vue27.VNode<vue27.RendererNode, vue27.RendererElement, {
616
+ }> | vue47.VNode<vue47.RendererNode, vue47.RendererElement, {
586
617
  [key: string]: any;
587
- }>[], {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {}, string, vue27.PublicProps, Readonly<vue27.ExtractPropTypes<{
618
+ }>[], {}, {}, {}, vue47.ComponentOptionsMixin, vue47.ComponentOptionsMixin, {}, string, vue47.PublicProps, Readonly<vue47.ExtractPropTypes<{
588
619
  directives: {
589
620
  type: () => DirectiveConfig[];
590
621
  default: () => never[];
@@ -601,13 +632,13 @@ declare const _default$1: vue27.DefineComponent<vue27.ExtractPropTypes<{
601
632
  directives: DirectiveConfig[];
602
633
  wrap: boolean;
603
634
  tag: string;
604
- }, {}, {}, {}, string, vue27.ComponentProvideOptions, true, {}, any>;
635
+ }, {}, {}, {}, string, vue47.ComponentProvideOptions, true, {}, any>;
605
636
  //#endregion
606
637
  //#region src/hooks/use-reuse.d.ts
607
- declare function useReuse(): (vue27.DefineComponent<{}, () => null, {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {}, string, vue27.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue27.ComponentProvideOptions, true, {}, any> | vue27.DefineComponent<{}, () => vue27.VNode<vue27.RendererNode, vue27.RendererElement, {
638
+ declare function useReuse(): (vue47.DefineComponent<{}, () => null, {}, {}, {}, vue47.ComponentOptionsMixin, vue47.ComponentOptionsMixin, {}, string, vue47.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue47.ComponentProvideOptions, true, {}, any> | vue47.DefineComponent<{}, () => vue47.VNode<vue47.RendererNode, vue47.RendererElement, {
608
639
  [key: string]: any;
609
- }>[] | undefined, {}, {}, {}, vue27.ComponentOptionsMixin, vue27.ComponentOptionsMixin, {}, string, vue27.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue27.ComponentProvideOptions, true, {}, any> | vue27.ComputedRef<Readonly<{
610
- [name: string]: vue27.Slot<any> | undefined;
640
+ }>[] | undefined, {}, {}, {}, vue47.ComponentOptionsMixin, vue47.ComponentOptionsMixin, {}, string, vue47.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue47.ComponentProvideOptions, true, {}, any> | vue47.ComputedRef<Readonly<{
641
+ [name: string]: vue47.Slot<any> | undefined;
611
642
  }>>)[];
612
643
  //#endregion
613
644
  //#region src/utils/index.d.ts
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ function getSlotsFactory(slots) {
8
8
  if (typeof name === "string") {
9
9
  const slot = slots[name];
10
10
  if (slot) return [{
11
- name: name.replace(/[\w-]+?_/, ""),
11
+ name: name.replace(/[\w-]+?_?/, ""),
12
12
  component: slot,
13
13
  slot: true
14
14
  }];
@@ -16,7 +16,7 @@ function getSlotsFactory(slots) {
16
16
  }
17
17
  if (name instanceof RegExp) return Object.keys(slots).flatMap((slotName) => {
18
18
  if (name.test(slotName)) return [{
19
- name: slotName.replace(/[\w-]+?_/, ""),
19
+ name: slotName.replace(/[\w-]+?_?/, ""),
20
20
  component: slots[slotName],
21
21
  slot: true
22
22
  }];
@@ -26,7 +26,7 @@ function getSlotsFactory(slots) {
26
26
  });
27
27
  }
28
28
  function resolveSlotNames(names, prop, type) {
29
- const propReg = prop ? /* @__PURE__ */ new RegExp(`^${toKebabCase([prop, type].filter(Boolean).join("-"))}_`) : void 0;
29
+ const propReg = prop ? /* @__PURE__ */ new RegExp(`^${toKebabCase([prop, type].filter(Boolean).join("-"))}(_|$)`) : void 0;
30
30
  return ensureArray(names ?? propReg);
31
31
  }
32
32
  const keys = /* @__PURE__ */ new WeakMap();
@@ -172,22 +172,54 @@ const arrayFieldPropsDef = {
172
172
  required: true
173
173
  },
174
174
  rawValue: { type: Function },
175
- outerEmptyAction: {
175
+ slotProp: {
176
176
  type: String,
177
+ required: false
178
+ },
179
+ outerEmptyAction: {
180
+ type: [
181
+ Array,
182
+ Object,
183
+ String
184
+ ],
177
185
  default: null
178
186
  },
179
187
  emptyAction: {
180
- type: String,
188
+ type: [
189
+ Array,
190
+ Object,
191
+ String
192
+ ],
181
193
  default: null
182
194
  },
183
195
  rowAction: {
184
- type: String,
196
+ type: [
197
+ Array,
198
+ Object,
199
+ String
200
+ ],
185
201
  default: null
186
202
  },
187
203
  lineStyle: {
188
204
  type: Object,
189
205
  default: () => ({})
190
206
  },
207
+ item: {
208
+ type: Object,
209
+ default: () => ({})
210
+ },
211
+ lineClass: {
212
+ type: String,
213
+ default: ""
214
+ },
215
+ rowFieldClass: {
216
+ type: String,
217
+ default: ""
218
+ },
219
+ rowActionClass: {
220
+ type: String,
221
+ default: ""
222
+ },
191
223
  mandatory: {
192
224
  type: Boolean,
193
225
  default: false
@@ -201,6 +233,19 @@ const layoutFieldPropsDef = {
201
233
  default: "layout",
202
234
  required: true
203
235
  },
236
+ component: { type: [
237
+ String,
238
+ Object,
239
+ Function
240
+ ] },
241
+ widget: {
242
+ type: Object,
243
+ default: () => ({})
244
+ },
245
+ on: {
246
+ type: Object,
247
+ default: () => ({})
248
+ },
204
249
  slots: {
205
250
  type: [
206
251
  Array,
@@ -580,8 +625,6 @@ var widget_field_default = widget_field_vue_vue_type_script_setup_true_lang_defa
580
625
 
581
626
  //#endregion
582
627
  //#region src/form/array-field.vue?vue&type=script&setup=true&lang.ts
583
- const _hoisted_1 = { class: "row-item" };
584
- const _hoisted_2 = { class: "row-action" };
585
628
  var array_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
586
629
  inheritAttrs: false,
587
630
  __name: "array-field",
@@ -591,14 +634,14 @@ var array_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
591
634
  const attrs = useAttrs();
592
635
  const fieldProps = computed(() => {
593
636
  return {
594
- ...cut(props, [(k) => k.endsWith("Action") || ["lineStyle"].includes(k)]),
637
+ ...cut(props, [(k) => k.endsWith("Action") || k.endsWith("Class") || ["lineStyle", "item"].includes(k)]),
595
638
  ...attrs
596
639
  };
597
640
  });
598
641
  const formCtx = inject(formCtxKey);
599
- const OuterEmptySlot = formCtx.getParentSlots(resolveSlotNames(props.outerEmptyAction ?? `${props.prop}-action_outer`))[0];
600
- const EmptySlot = formCtx.getParentSlots(resolveSlotNames(props.emptyAction ?? `${props.prop}-action_empty`))[0];
601
- const RowSlot = formCtx.getParentSlots(resolveSlotNames(props.rowAction ?? `${props.prop}-action_row`))[0];
642
+ const OuterEmptySlot = formCtx.getParentSlots(resolveSlotNames(props.outerEmptyAction, `${props.prop || props.slotProp}-action-outer`))[0];
643
+ const EmptySlot = formCtx.getParentSlots(resolveSlotNames(props.emptyAction, `${props.prop || props.slotProp}-action-empty`))[0];
644
+ const RowSlot = formCtx.getParentSlots(resolveSlotNames(props.rowAction, `${props.prop || props.slotProp}-action-row`))[0];
602
645
  const parentFullProp = computed(() => attrs["full-prop"] || "");
603
646
  const values = computed(() => {
604
647
  return getDeepValue(formCtx.model, parentFullProp.value, { fallback: [] });
@@ -610,6 +653,10 @@ var array_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
610
653
  p.labelPosition = indexProp(p.labelPosition, -1);
611
654
  return p;
612
655
  });
656
+ const itemAttrs = computed(() => {
657
+ const entries = Object.entries(unref(props.item)).map(([k, v]) => [k, unref(v)]);
658
+ return Object.assign({}, Object.fromEntries(entries), labelProps.value);
659
+ });
613
660
  function indexProp(v, index, value) {
614
661
  if (isFunction(v)) return v(index);
615
662
  if (isNullOrUndef(value)) return v;
@@ -653,7 +700,7 @@ var array_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
653
700
  key: 0,
654
701
  add: lineAction.add.bind(null, -1),
655
702
  empty: true
656
- }, null, 8, ["add"])) : (openBlock(), createBlock(form_item_default, mergeProps({ key: 1 }, labelProps.value, { class: "layout-form-item" }), {
703
+ }, null, 8, ["add"])) : (openBlock(), createBlock(form_item_default, mergeProps({ key: 1 }, itemAttrs.value, { class: "layout-form-item" }), {
657
704
  default: withCtx(() => [unref(EmptySlot) && !values.value.length ? (openBlock(), createBlock(resolveDynamicComponent(unref(EmptySlot).component), {
658
705
  key: 0,
659
706
  add: lineAction.add.bind(null, -1),
@@ -661,9 +708,9 @@ var array_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
661
708
  }, null, 8, ["add"])) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(values.value, (v, vi) => {
662
709
  return openBlock(), createElementBlock("div", {
663
710
  key: unref(getKey)(v),
664
- class: "list-row",
711
+ class: normalizeClass(["list-row", _ctx.lineClass]),
665
712
  style: normalizeStyle(_ctx.lineStyle)
666
- }, [createElementVNode("div", _hoisted_1, [createVNode(form_field_default, mergeProps({ "name-space": "layout-form-item" }, { ref_for: true }, fieldProps.value, {
713
+ }, [createElementVNode("div", { class: normalizeClass(["row-item", _ctx.rowFieldClass]) }, [createVNode(form_field_default, mergeProps({ "name-space": "layout-form-item" }, { ref_for: true }, fieldProps.value, {
667
714
  label: indexProp(_ctx.label, vi),
668
715
  "label-width": indexProp(_ctx.labelWidth, vi),
669
716
  "label-position": indexProp(_ctx.labelPosition, vi),
@@ -676,7 +723,7 @@ var array_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
676
723
  "label-position",
677
724
  "full-prop",
678
725
  "prop"
679
- ])]), createElementVNode("div", _hoisted_2, [unref(RowSlot) ? (openBlock(), createBlock(resolveDynamicComponent(unref(RowSlot).component), {
726
+ ])], 2), createElementVNode("div", { class: normalizeClass(["row-action", _ctx.rowActionClass]) }, [unref(RowSlot) ? (openBlock(), createBlock(resolveDynamicComponent(unref(RowSlot).component), {
680
727
  key: 0,
681
728
  up: lineAction.up.bind(null, vi),
682
729
  down: lineAction.down.bind(null, vi),
@@ -700,7 +747,7 @@ var array_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
700
747
  "single",
701
748
  "row",
702
749
  "full-prop"
703
- ])) : createCommentVNode("v-if", true)])], 4);
750
+ ])) : createCommentVNode("v-if", true)], 2)], 6);
704
751
  }), 128))]),
705
752
  _: 1
706
753
  }, 16));
@@ -721,7 +768,17 @@ var layout_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
721
768
  const props = __props;
722
769
  const attrs = useAttrs();
723
770
  const layoutProps = computed(() => {
724
- return Object.assign({}, cut(attrs, ["full-prop"]), cut(props, ["fields"]));
771
+ const p = Object.assign({}, cut(attrs, [
772
+ "full-prop",
773
+ "widget",
774
+ "on"
775
+ ]), cut(props, ["fields"]));
776
+ const w = Object.fromEntries(Object.entries(unref(props.widget)).map(([k, v]) => [k, unref(v)]));
777
+ return Object.assign(p, w);
778
+ });
779
+ const LayoutComponent = computed(() => {
780
+ if (props.component) return props.component;
781
+ return "div";
725
782
  });
726
783
  const formCtx = inject(formCtxKey);
727
784
  const subFields = computed(() => {
@@ -729,22 +786,32 @@ var layout_field_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
729
786
  return [field, { "full-prop": [attrs["full-prop"], field.prop].filter(Boolean).join(".") }];
730
787
  });
731
788
  });
732
- const { prefix: prefixSlots, suffix: suffixSlots } = groupBy(formCtx.getParentSlots(ensureArray(props.slots)), (slot) => slot.name.match(/^[a-z]+/i)?.[0] ?? "");
789
+ const layoutSlots = formCtx.getParentSlots(ensureArray(props.slots));
790
+ const subSlots = props.component ? layoutSlots : [];
791
+ const { prefix: prefixSlots, suffix: suffixSlots } = groupBy(layoutSlots, (slot) => slot.name.match(/^[a-z]+/i)?.[0] ?? "");
733
792
  return (_ctx, _cache) => {
734
- return openBlock(), createElementBlock("div", mergeProps({ class: "layout-item" }, layoutProps.value), [
735
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(prefixSlots), (psc) => {
736
- return openBlock(), createBlock(deep_slot_default, mergeProps({ key: psc.name }, { ref_for: true }, psc, { "ctx-key": unref(formCtxKey) }), null, 16, ["ctx-key"]);
737
- }), 128)),
738
- (openBlock(true), createElementBlock(Fragment, null, renderList(subFields.value, (field) => {
739
- return openBlock(), createBlock(form_field_default, mergeProps({ key: unref(getKey)(field[0]) }, { ref_for: true }, {
740
- ...field[0],
741
- ...field[1]
742
- }), null, 16);
743
- }), 128)),
744
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(suffixSlots), (psc) => {
745
- return openBlock(), createBlock(deep_slot_default, mergeProps({ key: psc.name }, { ref_for: true }, psc, { "ctx-key": unref(formCtxKey) }), null, 16, ["ctx-key"]);
746
- }), 128))
747
- ], 16);
793
+ return openBlock(), createBlock(resolveDynamicComponent(LayoutComponent.value), mergeProps({ class: "layout-item" }, layoutProps.value, toHandlers(_ctx.on)), createSlots({
794
+ default: withCtx(() => [
795
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(prefixSlots), (psc) => {
796
+ return openBlock(), createBlock(deep_slot_default, mergeProps({ key: psc.name }, { ref_for: true }, psc, { "ctx-key": unref(formCtxKey) }), null, 16, ["ctx-key"]);
797
+ }), 128)),
798
+ (openBlock(true), createElementBlock(Fragment, null, renderList(subFields.value, (field) => {
799
+ return openBlock(), createBlock(form_field_default, mergeProps({ key: unref(getKey)(field[0]) }, { ref_for: true }, {
800
+ ...field[0],
801
+ ...field[1]
802
+ }), null, 16);
803
+ }), 128)),
804
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(suffixSlots), (psc) => {
805
+ return openBlock(), createBlock(deep_slot_default, mergeProps({ key: psc.name }, { ref_for: true }, psc, { "ctx-key": unref(formCtxKey) }), null, 16, ["ctx-key"]);
806
+ }), 128))
807
+ ]),
808
+ _: 2
809
+ }, [renderList(unref(subSlots), (sl) => {
810
+ return {
811
+ name: sl.name,
812
+ fn: withCtx((scope) => [renderSlot(_ctx.$slots, sl.name, normalizeProps(guardReactiveProps(scope)))])
813
+ };
814
+ })]), 1040);
748
815
  };
749
816
  }
750
817
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiddy",
3
- "version": "2.6.3",
3
+ "version": "2.8.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",