@fewangsit/wangsvue 1.5.199-alpha.10 → 1.5.199-alpha.2

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,7 +3,6 @@ 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';
7
6
  export { default as useLoadingStore } from './components/loading/store/loading.store';
8
7
  export { default as Tooltip } from 'primevue/tooltip';
9
8
  export { Focus } from './directives';
@@ -1,377 +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
- * It should not be used with useValidator. v-model should only be used when the Calendar not used in form
274
- * @defaultValue null
9
+ * Calendar modelValue is date timestamp: 1706423635731
275
10
  */
276
- modelValue?: Date | Date[] | null;
277
-
11
+ modelValue?: number | number[];
278
12
  /**
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.
13
+ * To display the initial date value, used in edit form, taht sometime need to display the already inputed date.
285
14
  */
286
15
  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
-
304
16
  /**
305
17
  * Display label on top of Date Input.
306
18
  */
307
19
  label?: string;
308
-
309
- /**
310
- * The input placeholder
311
- * @default - The value on locale config {@link CalendarLocaleConfig.defaultPlaceholder}
312
- */
313
20
  placeholder?: string;
314
21
  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
-
334
22
  /**
335
23
  * Whether single date or date range model value.
336
24
  *
337
25
  * @default 'single'
338
- * @deprecated use selectionMode
339
26
  */
340
27
  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
-
362
28
  /**
363
29
  * Type of view to display.
364
30
  * @defaultValue date
365
31
  */
366
32
  view?: 'date' | 'month' | 'year' | undefined;
367
-
368
33
  /**
369
34
  * Wheter show year picker or not
370
35
  *
371
36
  * @default true
372
37
  */
373
38
  showYear?: boolean;
374
-
375
39
  /**
376
40
  * Show button Apply and cancel on footer.
377
41
  *
@@ -380,166 +44,74 @@ export interface CalendarProps {
380
44
  * @default false;
381
45
  */
382
46
  showButtons?: boolean;
383
-
384
47
  /**
385
- * Enable Validator using vee-validate. Combine with Form component that handle form validation.
48
+ * Enable Validator using vee-validate. Combine with TSForm that handle form validation.
386
49
  */
387
50
  useValidator?: boolean;
388
-
389
51
  /**
390
- * When used as field in From Validation using Form component,
52
+ * When used as field in From Validation using TSForm,
391
53
  * specify the unique field name, match with your needs for API request.
392
54
  */
393
55
  fieldName?: string;
394
-
395
- /**
396
- * Show information to user about the field.
397
- */
398
- fieldInfo?: string;
399
-
400
56
  /**
401
57
  * Whether this field should be filled or not.
402
58
  */
403
59
  mandatory?: boolean;
404
-
405
60
  /**
406
61
  * Show the text (opsional)
407
62
  *
408
63
  * @default true if mandatory true
409
64
  */
410
65
  showOptionalText?: boolean;
411
-
412
66
  /**
413
67
  * Sets the invalid state.
414
68
  */
415
69
  invalid?: boolean;
416
-
417
70
  /**
418
71
  * Set the custom validator message.
419
72
  * By default each field has preserved with its validator message, you don't need to worrying about the message.
420
73
  */
421
- validatorMessage?: string | CustomValidation<'empty'>;
422
-
74
+ validatorMessage?: string;
423
75
  /**
424
76
  * Set custom validation message for certain condition
425
- *
426
- * @deprecated - use validatorMessage {@link validatorMessage}
427
77
  */
428
78
  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
-
441
79
  /**
442
80
  * Defines the calendar to use hour picker.
443
81
  */
444
82
  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
-
464
83
  /**
465
84
  * Formats the hour picker to 12 hour format.
466
85
  * @default true
467
- *
468
- * @deprecated use {@link hourFormat}
469
86
  */
470
87
  useTimeFormat?: boolean;
471
-
472
88
  /**
473
89
  * The minimum selectable date.
474
90
  */
475
91
  minDate?: Date | undefined;
476
-
477
92
  /**
478
93
  * The maximum selectable date.
479
94
  */
480
95
  maxDate?: Date | undefined;
481
-
482
96
  /**
483
97
  * The maximum selectable year.
484
98
  *
485
99
  * The full year: 2020
486
- * @todo Support number, currently only support 'current'
487
100
  */
488
101
  maxYear?: 'current' | number | undefined;
489
-
490
102
  /**
491
103
  * The maximum selectable months.
492
104
  *
493
105
  * Number 0-11
494
- *
495
- * @todo Support number, currently only support 'current'
496
106
  */
497
107
  maxMonth?: 'current' | number | undefined;
498
108
  }
499
109
 
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
-
532
110
  /**
533
111
  * Calendar component emits
534
112
  */
535
113
  export type CalendarEmits = {
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[]];
114
+ 'update:modelValue': [date?: number | number[]];
543
115
  };
544
116
 
545
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.
@@ -1,6 +1,6 @@
1
1
  import { GenericObject } from 'vee-validate';
2
2
  import { Slot } from 'vue';
3
- import FormInstance, { FormPayload, FormProps } from '../form/Form.vue.d';
3
+ import { FormPayload, FormProps } from '../form/Form.vue.d';
4
4
  import { WangsIcons } from '../icon/Icon.vue.d';
5
5
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
6
6
 
@@ -313,7 +313,7 @@ declare class DialogForm extends ClassComponent<
313
313
  /**
314
314
  * The ref of form element.
315
315
  */
316
- form: FormInstance;
316
+ form: HTMLFormElement;
317
317
  }
318
318
 
319
319
  declare module '@vue/runtime-core' {
@@ -5,7 +5,6 @@ import { QueryParams } from '../datatable/DataTable.vue.d';
5
5
  import { DropdownProps } from '../dropdown/Dropdown.vue.d';
6
6
  import { InputRangeNumberProps } from '../inputrangenumber/InputRangeNumber.vue.d';
7
7
  import { MultiSelectProps } from '../multiselect/MultiSelect.vue.d';
8
- import { ButtonSelectTreeProps } from '../buttonselecttree/ButtonSelectTree.vue.d';
9
8
 
10
9
  // More specific filter field types
11
10
  export interface MultiSelectFilterField extends MultiSelectProps {
@@ -35,30 +34,12 @@ export interface RangeNumberFilterField extends InputRangeNumberProps {
35
34
  tooltip?: string;
36
35
  }
37
36
 
38
- export interface ButtonSelectTreeFilterField
39
- extends Omit<ButtonSelectTreeProps, 'type' | 'label' | 'fieldLabel'> {
40
- type: 'group' | 'category';
41
- field: string; // The name of the field this filter applies to
42
- /**
43
- * The field label.
44
- */
45
- label?: string;
46
- /**
47
- * The button label.
48
- * @default to Select Group|Category
49
- */
50
- buttonLabel?: string;
51
- }
52
-
53
37
  export interface CalendarFilterField extends CalendarProps {
54
38
  type: 'calendar';
55
39
  field: string;
56
40
  }
57
41
 
58
- export type AdditionalFilterField = ButtonSelectTreeFilterField;
59
-
60
42
  export type FilterField =
61
- | AdditionalFilterField
62
43
  | MultiSelectFilterField
63
44
  | DropdownFilterField
64
45
  | RangeNumberFilterField
@@ -105,11 +86,6 @@ export type FilterContainerSlots = {
105
86
  * @deprecated Please use props.fields instead
106
87
  */
107
88
  default: Slot;
108
-
109
- /**
110
- * Additional template for field.
111
- */
112
- field: Slot<{ field: AdditionalFilterField }>;
113
89
  };
114
90
 
115
91
  export type FilterContainerEmits = {
@@ -1,5 +1,6 @@
1
1
  import { FieldContext, FieldState, GenericObject } from 'vee-validate';
2
2
  import { Ref, Slot } from 'vue';
3
+ import { CheckboxModelValue } from '../checkbox/Checkbox.vue.d';
3
4
  import {
4
5
  ClassComponent,
5
6
  GlobalComponentConstructor,
@@ -200,7 +201,7 @@ declare class Form extends ClassComponent<FormProps, FormSlots, FormEmits> {
200
201
  /**
201
202
  * Whether to keep the dialog remains visible or not after submit.
202
203
  */
203
- stayAfterSubmit: boolean;
204
+ stayAfterSubmit: CheckboxModelValue;
204
205
 
205
206
  /**
206
207
  * Exposed function to clears the form fields.
@@ -260,25 +260,6 @@ export interface ImageProps {
260
260
  * @defaultValue false
261
261
  */
262
262
  unstyled?: boolean;
263
-
264
- /**
265
- * Get image url for specifics project from its server.
266
- * @returns The full URL of the image from the server.
267
- * @param path - the Image path from API Response JSON
268
- * @param width - the image width in pixels
269
- * @param height - the image height in pixels
270
- */
271
- getImageURL?: (
272
- path?: string | null,
273
- width?: number,
274
- height?: number,
275
- ) => string | undefined;
276
-
277
- /**
278
- * The placeholder to be shown when the image failed to load, or the src is not provided.
279
- * It should be preserved by project configuration.
280
- */
281
- placeholder?: string | undefined;
282
263
  }
283
264
 
284
265
  /**