@fewangsit/wangsvue 1.5.199-alpha.4 → 1.5.199-alpha.5

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.
@@ -1,379 +1,41 @@
1
- import { TransitionProps } from 'vue';
2
1
  import { CustomValidation } from '../form/Form.vue.d';
3
2
  import { ClassComponent } from '../ts-helpers';
4
3
 
5
- export interface CalendarLocaleConfig {
6
- defaultPlaceholder: string;
7
-
8
- /**
9
- * Error message displayed when no selection has been made.
10
- *
11
- * This message can include placeholders:
12
- * - `{label}`: Replaced with the value of `props.label`.
13
- * - `{formattedLabel}`: Replaced with the value of `props.label` formatted with an appropriate article (a/an).
14
- *
15
- * @example
16
- * // If `props.label` is 'Date', the error message will be:
17
- * '{label} must be picked' - 'Date must be picked'
18
- *
19
- * @example
20
- * // If `props.label` is 'Audit Date', the error message will be:
21
- * 'You must pick {formattedLabel}' - 'You must pick an Audit date'
22
- */
23
- emptyInvalidText?: string;
24
-
25
- /**
26
- * The cancel button when props.showTime or showButton
27
- *
28
- * @default 'Cancel'
29
- */
30
- cancelFooterButtonLabel?: string;
31
-
32
- /**
33
- * The apply button when props.showTime or showButton
34
- *
35
- * @default 'Apply'
36
- */
37
- applyFooterButtonLabel?: string;
38
- }
39
-
40
- export type CalendarPresetOptionMethodType = (
41
- options: Partial<CalendarPresetMethodOptions>,
42
- ) => CalendarPresetAttributes;
43
-
44
- /**
45
- * Defines the possible transition types for Calendar.
46
- */
47
- export type CalendarPresetTransitionType =
48
- | {
49
- transition?: TransitionProps;
50
- }
51
- | ((options: CalendarPresetMethodOptions) => TransitionProps)
52
- | undefined;
53
-
54
- /**
55
- * Options passed to methods for pass-through properties.
56
- */
57
- export interface CalendarPresetMethodOptions {
58
- instance: any;
59
- props: CalendarProps;
60
- state: CalendarState;
61
- context: Partial<CalendarContext>;
62
- attrs: any;
63
- parent: any;
64
- global: object | undefined;
65
- }
66
-
67
- /**
68
- * Attributes for Calendar pass-through customization.
69
- */
70
- export interface CalendarPresetAttributes {
71
- class?: any;
72
- style?: any;
73
- [key: string]: any;
74
- }
75
-
76
- /**
77
- * Defines the structure for Calendar pass-through class options.
78
- * Used in preset.
79
- */
80
- export interface CalendarPresetOptions {
81
- root?: CalendarPresetOptionMethodType;
82
- input?: CalendarPresetOptionMethodType;
83
- inputicon?: CalendarPresetAttributes;
84
- dropdownbutton?: {
85
- root?: CalendarPresetAttributes;
86
- };
87
- panel?: CalendarPresetOptionMethodType;
88
- datepickerMask?: CalendarPresetAttributes;
89
- header?: CalendarPresetOptionMethodType;
90
- previousbutton?: CalendarPresetOptionMethodType;
91
- title?: CalendarPresetOptionMethodType;
92
- monthTitle?: CalendarPresetAttributes;
93
- yearTitle?: CalendarPresetOptionMethodType;
94
- nextbutton?: CalendarPresetOptionMethodType;
95
- table?: CalendarPresetAttributes;
96
- tableheadercell?: CalendarPresetAttributes;
97
- tablebodyrow?: CalendarPresetAttributes;
98
- weekheader?: CalendarPresetAttributes;
99
- weeknumber?: CalendarPresetAttributes;
100
- weekday?: CalendarPresetAttributes;
101
- day?: CalendarPresetAttributes;
102
- weeklabelcontainer?: CalendarPresetOptionMethodType;
103
- daylabel?: CalendarPresetOptionMethodType;
104
- monthpicker?: CalendarPresetAttributes;
105
- month?: CalendarPresetOptionMethodType;
106
- yearpicker?: CalendarPresetAttributes;
107
- year?: CalendarPresetOptionMethodType;
108
- timepicker?: CalendarPresetAttributes;
109
- separatorcontainer?: CalendarPresetAttributes;
110
- separator?: CalendarPresetAttributes;
111
- hourpicker?: CalendarPresetAttributes;
112
- timepickerlabel?: CalendarPresetAttributes;
113
- minutepicker?: CalendarPresetAttributes;
114
- secondPicker?: CalendarPresetAttributes;
115
- incrementbutton?: CalendarPresetAttributes;
116
- incrementicon?: CalendarPresetAttributes;
117
- decrementbutton?: CalendarPresetAttributes;
118
- decrementicon?: CalendarPresetAttributes;
119
- container?: CalendarPresetAttributes;
120
- groupcontainer?: CalendarPresetAttributes;
121
- group?: CalendarPresetAttributes;
122
- buttonbar?: CalendarPresetAttributes;
123
- todaybutton?: {
124
- root?: CalendarPresetAttributes;
125
- };
126
- clearbutton?: {
127
- root?: CalendarPresetAttributes;
128
- };
129
- transition?: {
130
- enterFromClass?: string;
131
- enterActiveClass?: string;
132
- leaveActiveClass?: string;
133
- leaveToClass?: string;
134
- };
135
- }
136
-
137
- /**
138
- * Represents the current state of the Calendar component.
139
- */
140
- export interface CalendarState {
141
- currentView: CalendarProps['view'];
142
- }
143
-
144
- /**
145
- * Defines current month options.
146
- */
147
- export interface CalendarMonthOptions {
148
- /**
149
- * Month index.
150
- */
151
- value: number;
152
-
153
- /**
154
- * Selectable state of the month.
155
- */
156
- selectable: boolean;
157
- }
158
-
159
- /**
160
- * Defines current year options.
161
- */
162
- export interface CalendarYearOptions {
163
- /**
164
- * Year value.
165
- */
166
- value: number;
167
-
168
- /**
169
- * Selectable state of the year.
170
- */
171
- selectable: boolean;
172
- }
173
-
174
- export interface CalendarDate {
175
- /**
176
- * Current date.
177
- */
178
- day: number;
179
-
180
- /**
181
- * Current month state.
182
- */
183
- month: number;
184
-
185
- /**
186
- * Current year state.
187
- */
188
- year: number;
189
-
190
- /**
191
- * Current today state of the calendar's day.
192
- */
193
- today: boolean;
194
-
195
- /**
196
- * Selectable state of the day.
197
- */
198
- selectable: boolean;
199
-
200
- /**
201
- * Wether the day is on other month than currently shown
202
- */
203
- otherMonth: boolean;
204
- }
205
-
206
- /**
207
- * Provides contextual information for the Calendar component.
208
- */
209
- export interface CalendarContext {
210
- /**
211
- * Current date.
212
- */
213
- date: CalendarDate;
214
-
215
- /**
216
- * Current today state of the calendar's day.
217
- * @defaultValue false
218
- */
219
- today: boolean;
220
-
221
- /**
222
- * Current other month state of the calendar's day.
223
- */
224
- otherMonth: boolean;
225
-
226
- /**
227
- * Current selected state of the calendar's day or month or year.
228
- * @defaultValue false
229
- */
230
- selected: boolean;
231
-
232
- /**
233
- * Current date is the first selected on range selection
234
- */
235
- firstSelected: boolean;
236
-
237
- /**
238
- * Current date is the last selected on range selection
239
- */
240
- lastSelected: boolean;
241
-
242
- /**
243
- * Current disabled state of the calendar's day or month or year.
244
- * @defaultValue false
245
- */
246
- disabled: boolean;
247
-
248
- /**
249
- * Current month state.
250
- */
251
- month: CalendarMonthOptions;
252
-
253
- /**
254
- * Current month index state.
255
- */
256
- monthIndex: number;
257
-
258
- /**
259
- * Current year state.
260
- */
261
- year: CalendarYearOptions;
262
- }
263
-
264
4
  /**
265
5
  * Calendar component props
266
6
  */
267
7
  export interface CalendarProps {
268
8
  /**
269
- * Bound value of the component.
270
- * Supports single or multiple date selection.
271
- *
272
- * Used with `v-model`.
273
- * @defaultValue null
9
+ * Calendar modelValue is date timestamp: 1706423635731
274
10
  */
275
- modelValue?: Date | Date[] | null;
276
-
11
+ modelValue?: number | number[];
277
12
  /**
278
- * Initial date value for pre-filling forms.
279
- * Typically used for editing existing records.
280
- *
281
- * Accepts epoch timestamps in milliseconds.
282
- *
283
- * It will only watch for changes once.
13
+ * To display the initial date value, used in edit form, taht sometime need to display the already inputed date.
284
14
  */
285
15
  dateValue?: number | number[];
286
-
287
- /**
288
- * Epoch time in milliseconds representing the selected date(s).
289
- *
290
- * Can be used with `v-model:epochTimeMillis` or attaching listener 'onUpdate:epochTimeMillis',
291
- * but the calendar wont update its state when this prop value changed from parent.
292
- *
293
- * If you need to achieve two way data binding, use v-model instead. {@link modelValue}
294
- */
295
- epochTimeMillis?: number | number[];
296
-
297
- /**
298
- * Defines the format in which the field value is handled.
299
- * - `'date'` returns a `Date` object.
300
- * - `'millis'` returns an epoch timestamp in milliseconds.
301
- *
302
- * @default millis
303
- */
304
- valueFormat?: 'date' | 'millis';
305
-
306
16
  /**
307
17
  * Display label on top of Date Input.
308
18
  */
309
19
  label?: string;
310
-
311
- /**
312
- * The input placeholder
313
- * @default - The value on locale config {@link CalendarLocaleConfig.defaultPlaceholder}
314
- */
315
20
  placeholder?: string;
316
21
  disabled?: boolean;
317
-
318
- /**
319
- * Make the calendar states readonly.
320
- * If true, calendar will not allow user interaction with it. But user can view currently selected date and time.
321
- *
322
- * @default false
323
- */
324
- readonly?: boolean;
325
-
326
- /**
327
- * Identifier of the underlying input element.
328
- */
329
- inputId?: string | undefined;
330
-
331
- /**
332
- * Identifier of the wrapper element.
333
- */
334
- id?: string | undefined;
335
-
336
22
  /**
337
23
  * Whether single date or date range model value.
338
24
  *
339
25
  * @default 'single'
340
- * @deprecated use selectionMode
341
26
  */
342
27
  mode?: 'range' | 'single';
343
-
344
- /**
345
- * Whether single date or date range model value.
346
- *
347
- * @default 'single'
348
- */
349
- selectionMode?: 'range' | 'single';
350
-
351
- /**
352
- * Whether to hide the overlay on date selection when showTime is enabled.
353
- * @defaultValue false
354
- */
355
- hideOnDateTimeSelect?: boolean | undefined;
356
-
357
- /**
358
- * Whether to hide the overlay on date selection is completed when selectionMode is range.
359
- * @defaultValue true - when showButtons and showTime false
360
- * @defaultValue false - when showButtons and showTime true
361
- */
362
- hideOnRangeSelection?: boolean | undefined;
363
-
364
28
  /**
365
29
  * Type of view to display.
366
30
  * @defaultValue date
367
31
  */
368
32
  view?: 'date' | 'month' | 'year' | undefined;
369
-
370
33
  /**
371
34
  * Wheter show year picker or not
372
35
  *
373
36
  * @default true
374
37
  */
375
38
  showYear?: boolean;
376
-
377
39
  /**
378
40
  * Show button Apply and cancel on footer.
379
41
  *
@@ -382,166 +44,74 @@ export interface CalendarProps {
382
44
  * @default false;
383
45
  */
384
46
  showButtons?: boolean;
385
-
386
47
  /**
387
48
  * Enable Validator using vee-validate. Combine with TSForm that handle form validation.
388
49
  */
389
50
  useValidator?: boolean;
390
-
391
51
  /**
392
52
  * When used as field in From Validation using TSForm,
393
53
  * specify the unique field name, match with your needs for API request.
394
54
  */
395
55
  fieldName?: string;
396
-
397
- /**
398
- * Show information to user about the field.
399
- */
400
- fieldInfo?: string;
401
-
402
56
  /**
403
57
  * Whether this field should be filled or not.
404
58
  */
405
59
  mandatory?: boolean;
406
-
407
60
  /**
408
61
  * Show the text (opsional)
409
62
  *
410
63
  * @default true if mandatory true
411
64
  */
412
65
  showOptionalText?: boolean;
413
-
414
66
  /**
415
67
  * Sets the invalid state.
416
68
  */
417
69
  invalid?: boolean;
418
-
419
70
  /**
420
71
  * Set the custom validator message.
421
72
  * By default each field has preserved with its validator message, you don't need to worrying about the message.
422
73
  */
423
- validatorMessage?: string | CustomValidation<'empty'>;
424
-
74
+ validatorMessage?: string;
425
75
  /**
426
76
  * Set custom validation message for certain condition
427
- *
428
- * @deprecated - use validatorMessage {@link validatorMessage}
429
77
  */
430
78
  customValidation?: CustomValidation;
431
-
432
- /**
433
- * Format of the date. Defaults to PrimeVue Locale configuration.
434
- */
435
- dateFormat?: string | undefined;
436
-
437
- /**
438
- * Specifies hour format.
439
- * @defaultValue 24
440
- */
441
- hourFormat?: '12' | '24' | undefined;
442
-
443
79
  /**
444
80
  * Defines the calendar to use hour picker.
445
81
  */
446
82
  showTime?: boolean;
447
-
448
- /**
449
- * Separator of time selector.
450
- * @defaultValue :
451
- */
452
- timeSeparator?: string | undefined;
453
-
454
- /**
455
- * Hours to change per step.
456
- * @defaultValue 1
457
- */
458
- stepHour?: number | undefined;
459
-
460
- /**
461
- * Minutes to change per step.
462
- * @defaultValue 1
463
- */
464
- stepMinute?: number | undefined;
465
-
466
83
  /**
467
84
  * Formats the hour picker to 12 hour format.
468
85
  * @default true
469
- *
470
- * @deprecated use {@link hourFormat}
471
86
  */
472
87
  useTimeFormat?: boolean;
473
-
474
88
  /**
475
89
  * The minimum selectable date.
476
90
  */
477
91
  minDate?: Date | undefined;
478
-
479
92
  /**
480
93
  * The maximum selectable date.
481
94
  */
482
95
  maxDate?: Date | undefined;
483
-
484
96
  /**
485
97
  * The maximum selectable year.
486
98
  *
487
99
  * The full year: 2020
488
- * @todo Support number, currently only support 'current'
489
100
  */
490
101
  maxYear?: 'current' | number | undefined;
491
-
492
102
  /**
493
103
  * The maximum selectable months.
494
104
  *
495
105
  * Number 0-11
496
- *
497
- * @todo Support number, currently only support 'current'
498
106
  */
499
107
  maxMonth?: 'current' | number | undefined;
500
108
  }
501
109
 
502
- /**
503
- * Custom Calendar month change event.
504
- * @see {@link CalendarEmits.monthChange}
505
- */
506
- export interface CalendarMonthChangeEvent {
507
- /**
508
- * New month.
509
- */
510
- month: number;
511
-
512
- /**
513
- * New year.
514
- */
515
- year: number;
516
- }
517
-
518
- /**
519
- * Custom Calendar year change event.
520
- * @see {@link CalendarEmits.yearChange}
521
- */
522
- export interface CalendarYearChangeEvent {
523
- /**
524
- * New month.
525
- */
526
- month: number;
527
-
528
- /**
529
- * New year.
530
- */
531
- year: number;
532
- }
533
-
534
110
  /**
535
111
  * Calendar component emits
536
112
  */
537
113
  export type CalendarEmits = {
538
- 'update:modelValue': [
539
- date: Date | Array<Date> | Array<Date | null> | undefined | null,
540
- ];
541
- 'update:epochTimeMillis': [millis?: number | number[]];
542
- 'monthChange': [event: CalendarMonthChangeEvent];
543
- 'yearChange': [event: CalendarYearChangeEvent];
544
- 'dateSelect': [date: Date | Date[]];
114
+ 'update:modelValue': [date?: number | number[]];
545
115
  };
546
116
 
547
117
  /**
@@ -11,6 +11,7 @@ import { PassThroughOptions } from '../passthrough';
11
11
  import {
12
12
  ClassComponent,
13
13
  GlobalComponentConstructor,
14
+ Nullable,
14
15
  PassThrough,
15
16
  } from '../ts-helpers';
16
17
 
@@ -99,6 +100,11 @@ export interface CheckboxState {
99
100
  [key: string]: any;
100
101
  }
101
102
 
103
+ export type CheckboxModelValue =
104
+ | Nullable<boolean>
105
+ | Record<string, any>
106
+ | Record<string, any>[];
107
+
102
108
  /**
103
109
  * Defines valid properties in Checkbox component.
104
110
  */
@@ -109,10 +115,8 @@ export interface CheckboxProps {
109
115
  value?: any;
110
116
  /**
111
117
  * Value binding of the checkbox.
112
- *
113
- * The value is vary depends on the {@link trueValue}, {@link falseValue}, {@link binary}
114
118
  */
115
- modelValue?: any;
119
+ modelValue?: CheckboxModelValue;
116
120
  /**
117
121
  * The checkbox label.
118
122
  */
@@ -285,7 +289,7 @@ export type CheckboxEmits = {
285
289
  * Emitted when the value changes.
286
290
  * @param {*} value - New value.
287
291
  */
288
- 'update:modelValue': [value: any];
292
+ 'update:modelValue': [value: CheckboxModelValue];
289
293
  /**
290
294
  * Callback to invoke on value change.
291
295
  * @param {Event} event - Browser event.
@@ -31,18 +31,6 @@ declare const _default: import('vue').DefineComponent<{
31
31
  type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["deleteNode"]>;
32
32
  required: true;
33
33
  };
34
- view: {
35
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["view"]>;
36
- required: true;
37
- };
38
- innerDecorations: {
39
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["innerDecorations"]>;
40
- required: true;
41
- };
42
- HTMLAttributes: {
43
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["HTMLAttributes"]>;
44
- required: true;
45
- };
46
34
  }, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
47
35
  editor: {
48
36
  type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["editor"]>;
@@ -76,17 +64,5 @@ declare const _default: import('vue').DefineComponent<{
76
64
  type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["deleteNode"]>;
77
65
  required: true;
78
66
  };
79
- view: {
80
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["view"]>;
81
- required: true;
82
- };
83
- innerDecorations: {
84
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["innerDecorations"]>;
85
- required: true;
86
- };
87
- HTMLAttributes: {
88
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["HTMLAttributes"]>;
89
- required: true;
90
- };
91
67
  }>>, {}, {}>;
92
68
  export default _default;
@@ -31,18 +31,6 @@ declare const _default: import('vue').DefineComponent<{
31
31
  type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["deleteNode"]>;
32
32
  required: true;
33
33
  };
34
- view: {
35
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["view"]>;
36
- required: true;
37
- };
38
- innerDecorations: {
39
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["innerDecorations"]>;
40
- required: true;
41
- };
42
- HTMLAttributes: {
43
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["HTMLAttributes"]>;
44
- required: true;
45
- };
46
34
  }, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
47
35
  editor: {
48
36
  type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["editor"]>;
@@ -76,17 +64,5 @@ declare const _default: import('vue').DefineComponent<{
76
64
  type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["deleteNode"]>;
77
65
  required: true;
78
66
  };
79
- view: {
80
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["view"]>;
81
- required: true;
82
- };
83
- innerDecorations: {
84
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["innerDecorations"]>;
85
- required: true;
86
- };
87
- HTMLAttributes: {
88
- type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["HTMLAttributes"]>;
89
- required: true;
90
- };
91
67
  }>>, {}, {}>;
92
68
  export default _default;
@@ -16,9 +16,14 @@ import {
16
16
  PassThrough,
17
17
  } from '../ts-helpers';
18
18
 
19
- export declare type OverlayPanelPassThrougMethodType = (
20
- options: OverlayPanelPassThroughMethodOptions,
21
- ) => OverlayPanelPassThroughAttributes;
19
+ export declare type OverlayPanelPassThroughOptionType =
20
+ | OverlayPanelPassThroughAttributes
21
+ | ((
22
+ options: OverlayPanelPassThroughMethodOptions,
23
+ ) => OverlayPanelPassThroughAttributes | string)
24
+ | string
25
+ | null
26
+ | undefined;
22
27
 
23
28
  export declare type OverlayPanelPassThroughTransitionType =
24
29
  | TransitionProps
@@ -63,19 +68,19 @@ export interface OverlayPanelPassThroughOptions {
63
68
  /**
64
69
  * Used to pass attributes to the root's DOM element.
65
70
  */
66
- root?: OverlayPanelPassThroughAttributes;
71
+ root?: OverlayPanelPassThroughOptionType;
67
72
  /**
68
73
  * Used to pass attributes to the content's DOM element.
69
74
  */
70
- content?: OverlayPanelPassThroughAttributes;
75
+ content?: OverlayPanelPassThroughOptionType;
71
76
  /**
72
77
  * Used to pass attributes to the close button's DOM element.
73
78
  */
74
- closeButton?: OverlayPanelPassThroughAttributes;
79
+ closeButton?: OverlayPanelPassThroughOptionType;
75
80
  /**
76
81
  * Used to pass attributes to the close icon's DOM element.
77
82
  */
78
- closeIcon?: OverlayPanelPassThroughAttributes;
83
+ closeIcon?: OverlayPanelPassThroughOptionType;
79
84
  /**
80
85
  * Used to manage all lifecycle hooks.
81
86
  * @see {@link BaseComponent.ComponentHooks}
@@ -91,8 +96,6 @@ export interface OverlayPanelPassThroughOptions {
91
96
  * Custom passthrough attributes for each DOM elements
92
97
  */
93
98
  export interface OverlayPanelPassThroughAttributes {
94
- class: any;
95
- style?: any;
96
99
  [key: string]: any;
97
100
  }
98
101