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

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/build-entry.d.ts CHANGED
@@ -3,6 +3,7 @@ export { default as eventBus } from './event-bus';
3
3
  export { default as ToastService } from 'primevue/toastservice';
4
4
  export * from './utils';
5
5
  export { formatCurrency } from './components/inputcurrency/helpers/currency.helper';
6
+ export { formatDateTimeRange } from './components/filtercontainer/helpers/formatDateTimeRange.helper';
6
7
  export { default as useLoadingStore } from './components/loading/store/loading.store';
7
8
  export { default as Tooltip } from 'primevue/tooltip';
8
9
  export { Focus } from './directives';
@@ -0,0 +1,50 @@
1
+ import { CalendarProps } from './Calendar.vue.d';
2
+ declare function __VLS_template(): {
3
+ incrementicon?(_: {}): any;
4
+ incrementicon?(_: {}): any;
5
+ decrementicon?(_: {}): any;
6
+ decrementicon?(_: {}): any;
7
+ };
8
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<CalendarProps>, {
9
+ selectionMode: string;
10
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
+ "update:modelValue": (date: Date | Date[]) => void;
12
+ "update:epochTimeMillis": (millis?: number | number[]) => void;
13
+ monthChange: (event: import('./Calendar.vue.d').CalendarMonthChangeEvent) => void;
14
+ yearChange: (event: import('./Calendar.vue.d').CalendarYearChangeEvent) => void;
15
+ dateSelect: (date: Date | Date[]) => void;
16
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<CalendarProps>, {
17
+ selectionMode: string;
18
+ }>>> & {
19
+ "onUpdate:modelValue"?: (date: Date | Date[]) => any;
20
+ "onUpdate:epochTimeMillis"?: (millis?: number | number[]) => any;
21
+ onMonthChange?: (event: import('./Calendar.vue.d').CalendarMonthChangeEvent) => any;
22
+ onYearChange?: (event: import('./Calendar.vue.d').CalendarYearChangeEvent) => any;
23
+ onDateSelect?: (date: Date | Date[]) => any;
24
+ }, {
25
+ selectionMode: "range" | "single";
26
+ }, {}>;
27
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
28
+ export default _default;
29
+ type __VLS_WithDefaults<P, D> = {
30
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
31
+ default: D[K];
32
+ }> : P[K];
33
+ };
34
+ type __VLS_Prettify<T> = {
35
+ [K in keyof T]: T[K];
36
+ } & {};
37
+ type __VLS_WithTemplateSlots<T, S> = T & {
38
+ new (): {
39
+ $slots: S;
40
+ };
41
+ };
42
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
43
+ type __VLS_TypePropsToOption<T> = {
44
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
45
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
46
+ } : {
47
+ type: import('vue').PropType<T[K]>;
48
+ required: true;
49
+ };
50
+ };
@@ -1,41 +1,377 @@
1
+ import { TransitionProps } from 'vue';
1
2
  import { CustomValidation } from '../form/Form.vue.d';
2
3
  import { ClassComponent } from '../ts-helpers';
3
4
 
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
+
4
264
  /**
5
265
  * Calendar component props
6
266
  */
7
267
  export interface CalendarProps {
8
268
  /**
9
- * Calendar modelValue is date timestamp: 1706423635731
269
+ * Bound value of the component.
270
+ * Supports single or multiple date selection.
271
+ *
272
+ * Used with `v-model`.
273
+ * It should not be used with useValidator. v-model should only be used when the Calendar not used in form
274
+ * @defaultValue null
10
275
  */
11
- modelValue?: number | number[];
276
+ modelValue?: Date | Date[] | null;
277
+
12
278
  /**
13
- * To display the initial date value, used in edit form, taht sometime need to display the already inputed date.
279
+ * Initial date value for pre-filling forms.
280
+ * Typically used for editing existing records.
281
+ *
282
+ * Accepts epoch timestamps in milliseconds.
283
+ *
284
+ * It will only watch for changes once.
14
285
  */
15
286
  dateValue?: number | number[];
287
+
288
+ /**
289
+ * Epoch time in milliseconds representing the selected date(s).
290
+ *
291
+ * Can be used with `v-model:epochTimeMillis` for two way binding.
292
+ */
293
+ epochTimeMillis?: number | number[];
294
+
295
+ /**
296
+ * Defines the format in which the field value is handled.
297
+ * - `'date'` returns a `Date` object.
298
+ * - `'millis'` returns an epoch timestamp in milliseconds.
299
+ *
300
+ * @default millis
301
+ */
302
+ valueFormat?: 'date' | 'millis';
303
+
16
304
  /**
17
305
  * Display label on top of Date Input.
18
306
  */
19
307
  label?: string;
308
+
309
+ /**
310
+ * The input placeholder
311
+ * @default - The value on locale config {@link CalendarLocaleConfig.defaultPlaceholder}
312
+ */
20
313
  placeholder?: string;
21
314
  disabled?: boolean;
315
+
316
+ /**
317
+ * Make the calendar states readonly.
318
+ * If true, calendar will not allow user interaction with it. But user can view currently selected date and time.
319
+ *
320
+ * @default false
321
+ */
322
+ readonly?: boolean;
323
+
324
+ /**
325
+ * Identifier of the underlying input element.
326
+ */
327
+ inputId?: string | undefined;
328
+
329
+ /**
330
+ * Identifier of the wrapper element.
331
+ */
332
+ id?: string | undefined;
333
+
22
334
  /**
23
335
  * Whether single date or date range model value.
24
336
  *
25
337
  * @default 'single'
338
+ * @deprecated use selectionMode
26
339
  */
27
340
  mode?: 'range' | 'single';
341
+
342
+ /**
343
+ * Whether single date or date range model value.
344
+ *
345
+ * @default 'single'
346
+ */
347
+ selectionMode?: 'range' | 'single';
348
+
349
+ /**
350
+ * Whether to hide the overlay on date selection when showTime is enabled.
351
+ * @defaultValue false
352
+ */
353
+ hideOnDateTimeSelect?: boolean | undefined;
354
+
355
+ /**
356
+ * Whether to hide the overlay on date selection is completed when selectionMode is range.
357
+ * @defaultValue true - when showButtons and showTime false
358
+ * @defaultValue false - when showButtons and showTime true
359
+ */
360
+ hideOnRangeSelection?: boolean | undefined;
361
+
28
362
  /**
29
363
  * Type of view to display.
30
364
  * @defaultValue date
31
365
  */
32
366
  view?: 'date' | 'month' | 'year' | undefined;
367
+
33
368
  /**
34
369
  * Wheter show year picker or not
35
370
  *
36
371
  * @default true
37
372
  */
38
373
  showYear?: boolean;
374
+
39
375
  /**
40
376
  * Show button Apply and cancel on footer.
41
377
  *
@@ -44,74 +380,166 @@ export interface CalendarProps {
44
380
  * @default false;
45
381
  */
46
382
  showButtons?: boolean;
383
+
47
384
  /**
48
- * Enable Validator using vee-validate. Combine with TSForm that handle form validation.
385
+ * Enable Validator using vee-validate. Combine with Form component that handle form validation.
49
386
  */
50
387
  useValidator?: boolean;
388
+
51
389
  /**
52
- * When used as field in From Validation using TSForm,
390
+ * When used as field in From Validation using Form component,
53
391
  * specify the unique field name, match with your needs for API request.
54
392
  */
55
393
  fieldName?: string;
394
+
395
+ /**
396
+ * Show information to user about the field.
397
+ */
398
+ fieldInfo?: string;
399
+
56
400
  /**
57
401
  * Whether this field should be filled or not.
58
402
  */
59
403
  mandatory?: boolean;
404
+
60
405
  /**
61
406
  * Show the text (opsional)
62
407
  *
63
408
  * @default true if mandatory true
64
409
  */
65
410
  showOptionalText?: boolean;
411
+
66
412
  /**
67
413
  * Sets the invalid state.
68
414
  */
69
415
  invalid?: boolean;
416
+
70
417
  /**
71
418
  * Set the custom validator message.
72
419
  * By default each field has preserved with its validator message, you don't need to worrying about the message.
73
420
  */
74
- validatorMessage?: string;
421
+ validatorMessage?: string | CustomValidation<'empty'>;
422
+
75
423
  /**
76
424
  * Set custom validation message for certain condition
425
+ *
426
+ * @deprecated - use validatorMessage {@link validatorMessage}
77
427
  */
78
428
  customValidation?: CustomValidation;
429
+
430
+ /**
431
+ * Format of the date. Defaults to PrimeVue Locale configuration.
432
+ */
433
+ dateFormat?: string | undefined;
434
+
435
+ /**
436
+ * Specifies hour format.
437
+ * @defaultValue 24
438
+ */
439
+ hourFormat?: '12' | '24' | undefined;
440
+
79
441
  /**
80
442
  * Defines the calendar to use hour picker.
81
443
  */
82
444
  showTime?: boolean;
445
+
446
+ /**
447
+ * Separator of time selector.
448
+ * @defaultValue :
449
+ */
450
+ timeSeparator?: string | undefined;
451
+
452
+ /**
453
+ * Hours to change per step.
454
+ * @defaultValue 1
455
+ */
456
+ stepHour?: number | undefined;
457
+
458
+ /**
459
+ * Minutes to change per step.
460
+ * @defaultValue 1
461
+ */
462
+ stepMinute?: number | undefined;
463
+
83
464
  /**
84
465
  * Formats the hour picker to 12 hour format.
85
466
  * @default true
467
+ *
468
+ * @deprecated use {@link hourFormat}
86
469
  */
87
470
  useTimeFormat?: boolean;
471
+
88
472
  /**
89
473
  * The minimum selectable date.
90
474
  */
91
475
  minDate?: Date | undefined;
476
+
92
477
  /**
93
478
  * The maximum selectable date.
94
479
  */
95
480
  maxDate?: Date | undefined;
481
+
96
482
  /**
97
483
  * The maximum selectable year.
98
484
  *
99
485
  * The full year: 2020
486
+ * @todo Support number, currently only support 'current'
100
487
  */
101
488
  maxYear?: 'current' | number | undefined;
489
+
102
490
  /**
103
491
  * The maximum selectable months.
104
492
  *
105
493
  * Number 0-11
494
+ *
495
+ * @todo Support number, currently only support 'current'
106
496
  */
107
497
  maxMonth?: 'current' | number | undefined;
108
498
  }
109
499
 
500
+ /**
501
+ * Custom Calendar month change event.
502
+ * @see {@link CalendarEmits.monthChange}
503
+ */
504
+ export interface CalendarMonthChangeEvent {
505
+ /**
506
+ * New month.
507
+ */
508
+ month: number;
509
+
510
+ /**
511
+ * New year.
512
+ */
513
+ year: number;
514
+ }
515
+
516
+ /**
517
+ * Custom Calendar year change event.
518
+ * @see {@link CalendarEmits.yearChange}
519
+ */
520
+ export interface CalendarYearChangeEvent {
521
+ /**
522
+ * New month.
523
+ */
524
+ month: number;
525
+
526
+ /**
527
+ * New year.
528
+ */
529
+ year: number;
530
+ }
531
+
110
532
  /**
111
533
  * Calendar component emits
112
534
  */
113
535
  export type CalendarEmits = {
114
- 'update:modelValue': [date?: number | number[]];
536
+ 'update:modelValue': [
537
+ date: Date | Array<Date> | Array<Date | null> | undefined | null,
538
+ ];
539
+ 'update:epochTimeMillis': [millis?: number | number[]];
540
+ 'monthChange': [event: CalendarMonthChangeEvent];
541
+ 'yearChange': [event: CalendarYearChangeEvent];
542
+ 'dateSelect': [date: Date | Date[]];
115
543
  };
116
544
 
117
545
  /**
@@ -11,7 +11,6 @@ import { PassThroughOptions } from '../passthrough';
11
11
  import {
12
12
  ClassComponent,
13
13
  GlobalComponentConstructor,
14
- Nullable,
15
14
  PassThrough,
16
15
  } from '../ts-helpers';
17
16
 
@@ -100,11 +99,6 @@ export interface CheckboxState {
100
99
  [key: string]: any;
101
100
  }
102
101
 
103
- export type CheckboxModelValue =
104
- | Nullable<boolean>
105
- | Record<string, any>
106
- | Record<string, any>[];
107
-
108
102
  /**
109
103
  * Defines valid properties in Checkbox component.
110
104
  */
@@ -115,8 +109,10 @@ export interface CheckboxProps {
115
109
  value?: any;
116
110
  /**
117
111
  * Value binding of the checkbox.
112
+ *
113
+ * The value is vary depends on the {@link trueValue}, {@link falseValue}, {@link binary}
118
114
  */
119
- modelValue?: CheckboxModelValue;
115
+ modelValue?: any;
120
116
  /**
121
117
  * The checkbox label.
122
118
  */
@@ -289,7 +285,7 @@ export type CheckboxEmits = {
289
285
  * Emitted when the value changes.
290
286
  * @param {*} value - New value.
291
287
  */
292
- 'update:modelValue': [value: CheckboxModelValue];
288
+ 'update:modelValue': [value: any];
293
289
  /**
294
290
  * Callback to invoke on value change.
295
291
  * @param {Event} event - Browser event.
@@ -31,6 +31,18 @@ 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
+ };
34
46
  }, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
35
47
  editor: {
36
48
  type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["editor"]>;
@@ -64,5 +76,17 @@ declare const _default: import('vue').DefineComponent<{
64
76
  type: import('vue').PropType<import('@tiptap/vue-3').NodeViewProps["deleteNode"]>;
65
77
  required: true;
66
78
  };
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
+ };
67
91
  }>>, {}, {}>;
68
92
  export default _default;