@fewangsit/wangsvue-gsts 1.0.0-alpha.19 → 1.0.0-alpha.20

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.
@@ -420,6 +420,30 @@ export interface BaseTreeProps {
420
420
  * @default false
421
421
  */
422
422
  useOption?: boolean;
423
+
424
+ /**
425
+ * A function to determine when the node should be disabled,
426
+ * When true, it will disabled selection on current node and all level childrend
427
+ *
428
+ * @return true to disabled
429
+ */
430
+ disableNodeWhen?: (node: TreeNode) => boolean;
431
+
432
+ /**
433
+ * A function to determine when the node should be disabled
434
+ * It will only disable current node
435
+ *
436
+ * @return true to disabled
437
+ */
438
+ exactDisableNodeWhen?: (node: TreeNode) => boolean;
439
+
440
+ /**
441
+ * A function to determine when the node should selected
442
+ * It will only disable current node when propagateSelection false
443
+ *
444
+ * @return true to disabled
445
+ */
446
+ nodeSelectedWhen?: (node: TreeNode) => boolean;
423
447
  }
424
448
 
425
449
  /**
@@ -0,0 +1,26 @@
1
+ import { DefineComponent } from 'vue';
2
+
3
+ export interface ButtonCopyProps {
4
+ /**
5
+ * Text to be copied.
6
+ */
7
+ text: string;
8
+ }
9
+
10
+ /**
11
+ * **WangsVue - ButtonCopy**
12
+ *
13
+ * _ButtonCopy is a component for copying text to the clipboard._
14
+ *
15
+ * --- ---
16
+ * ![WangsVue](https://www.wangs.id/wp-content/uploads/2023/12/cropped-Logo_Wangsid-removebg-preview-192x192.png)
17
+ *
18
+ * @group buttons
19
+ */
20
+ declare const ButtonCopy: DefineComponent<
21
+ ButtonCopyProps,
22
+ Record<string, unknown>,
23
+ Record<string, unknown>
24
+ >;
25
+
26
+ export default ButtonCopy;
@@ -1,3 +1,4 @@
1
+ import { Slot } from 'vue';
1
2
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
2
3
  import { TreeNode } from '../basetree/BaseTree.vue.d';
3
4
  import { ShortFetchResponse } from '../datatable/DataTable.vue.d';
@@ -168,6 +169,10 @@ export type ButtonSelectTreeEmits = {
168
169
  'reset': [];
169
170
  };
170
171
 
172
+ export interface ButtonSelectTreeSlots {
173
+ treenode: Slot<{ node: TreeNode }>;
174
+ }
175
+
171
176
  /**
172
177
  * **TSVue v2 - ButtonSelectTree**
173
178
  *
@@ -180,8 +185,8 @@ export type ButtonSelectTreeEmits = {
180
185
  */
181
186
  declare class ButtonSelectTree extends ClassComponent<
182
187
  ButtonSelectTreeProps,
183
- unknown,
184
- ButtonSelectTreeProps
188
+ ButtonSelectTreeSlots,
189
+ ButtonSelectTreeEmits
185
190
  > {}
186
191
 
187
192
  declare module '@vue/runtime-core' {
@@ -18,6 +18,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<
18
18
  stepHour: number;
19
19
  stepMinute: number;
20
20
  timeSeparator: string;
21
+ exactSelection: boolean;
21
22
  }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
22
23
  "update:modelValue": (date: Date | Date[]) => void;
23
24
  "update:epochTimeMillis": (millis?: number | number[]) => void;
@@ -37,6 +38,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<
37
38
  stepHour: number;
38
39
  stepMinute: number;
39
40
  timeSeparator: string;
41
+ exactSelection: boolean;
40
42
  }>>> & {
41
43
  "onUpdate:modelValue"?: (date: Date | Date[]) => any;
42
44
  "onUpdate:epochTimeMillis"?: (millis?: number | number[]) => any;
@@ -48,14 +50,15 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<
48
50
  showOptionalText: boolean;
49
51
  mode: "range" | "single";
50
52
  view: "date" | "month" | "year" | undefined;
51
- valueFormat: "date" | "millis";
52
53
  selectionMode: "range" | "single";
54
+ valueFormat: "date" | "millis";
53
55
  hideOnRangeSelection: boolean | undefined;
54
56
  showYear: boolean;
55
57
  hourFormat: "12" | "24" | undefined;
56
58
  timeSeparator: string | undefined;
57
59
  stepHour: number | undefined;
58
60
  stepMinute: number | undefined;
61
+ exactSelection: boolean;
59
62
  }, {}>;
60
63
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
61
64
  export default _default;
@@ -495,6 +495,15 @@ export interface CalendarProps {
495
495
  * @todo Support number, currently only support 'current'
496
496
  */
497
497
  maxMonth?: 'current' | number | undefined;
498
+ /**
499
+ * When using range selection mode, selecting only the "start date" (without an "end date") will, by default, return a range ending 24 hours later.
500
+ * Enabling this prop will instead return the exact dates selected, without adding an extra day.
501
+ *
502
+ * @example Selecting dates from the 1st to the 5th will return an array of epoch timestamps for each day: [1st, 2nd, 3rd, 4th, 5th].
503
+ * @default false
504
+ * @requires selectionMode = 'range'
505
+ */
506
+ exactSelection?: boolean;
498
507
  }
499
508
 
500
509
  /**
@@ -9,6 +9,16 @@ export interface DataTableLocaleConfig {
9
9
  * Message to display on loading ovevrlay while downloading
10
10
  */
11
11
  downloadingMessage: string;
12
+
13
+ /**
14
+ * Text when booleanValue is true
15
+ */
16
+ trueText: string;
17
+
18
+ /**
19
+ * Text when booleanValue is false
20
+ */
21
+ falseText: string;
12
22
  }
13
23
 
14
24
  export type ChildGroup = {
@@ -158,8 +168,8 @@ export type TogglePresetConfirmDialogProps = Omit<
158
168
  showWhen?:
159
169
  | 'active'
160
170
  | 'inactive'
161
- | ((data: any) => boolean)
162
- | ((data: any) => Promise<boolean>);
171
+ | ((data: any, state: boolean) => boolean)
172
+ | ((data: any, state: boolean) => Promise<boolean>);
163
173
  };
164
174
 
165
175
  interface ColumnConfirmActionPresetBase {
@@ -311,6 +321,12 @@ export interface TableColumn {
311
321
  * Within this property, you only need to set the `showTime` or `showDate` options.
312
322
  */
313
323
  dateFormatOptions?: DateOptions;
324
+ /**
325
+ * Set the fallback text when the cell value is empty. Used in export excel.
326
+ *
327
+ * @example 'N/A'
328
+ */
329
+ emptyText?: string;
314
330
  bodyTemplate?: (data: any, index: number) => string | undefined;
315
331
  bodyComponent?: (data: any, index: number) => TableCellComponent;
316
332
  headerTemplate?: () => string;
@@ -502,10 +518,13 @@ export interface BaseDataTableProps {
502
518
  disableAllRows?: boolean;
503
519
  /**
504
520
  * The query search from ButtonSearch component.
521
+ *
522
+ * @deprecated - not fully supported, may not works properly
505
523
  */
506
524
  search?: string;
507
525
  /**
508
526
  * Tag query for search by scan
527
+ * @deprecated - not fully supported, may not works properly
509
528
  */
510
529
  tag?: string;
511
530
  /**
@@ -599,6 +618,8 @@ export interface BaseDataTableProps {
599
618
  reorderable?: boolean;
600
619
  /**
601
620
  * An array of fields as string to use in global filtering.
621
+ *
622
+ * @default undefined - All fields are used
602
623
  */
603
624
  globalFilterFields?: string[];
604
625
  /**
@@ -1,13 +1,17 @@
1
1
  import { TreeSelectionKeys } from 'primevue/tree';
2
2
  import { TreeNode } from '../basetree/BaseTree.vue.d';
3
- import { ShortFetchResponse } from '../datatable/DataTable.vue.d';
3
+ import { QueryParams, ShortFetchResponse } from '../datatable/DataTable.vue.d';
4
4
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
5
- import TreeInstance from '../tree/Tree.vue.d';
5
+ import TreeInstance, { TreeProps } from '../tree/Tree.vue.d';
6
+ import { Slot } from 'vue';
6
7
 
7
- export interface DialogSelectTreeProps {
8
+ export interface DialogSelectTreeProps
9
+ extends Omit<TreeProps, 'type' | 'filter'> {
8
10
  fetchTree?: (
9
11
  type: 'group' | 'category',
12
+ params?: QueryParams,
10
13
  ) => Promise<ShortFetchResponse<TreeNode> | undefined>;
14
+ params?: QueryParams;
11
15
  visible?: boolean;
12
16
  type?: 'group' | 'category';
13
17
  /**
@@ -73,6 +77,8 @@ export interface DialogSelectTreeProps {
73
77
  * Render hidden dialog to trigger fetch tree
74
78
  */
75
79
  hidden?: boolean;
80
+
81
+ propagateSelection?: boolean;
76
82
  }
77
83
 
78
84
  export type TreeSelectPayload = {
@@ -86,6 +92,25 @@ export type DialogSelectTreeEmits = {
86
92
  hide: [];
87
93
  };
88
94
 
95
+ export interface DialogSelectTreeSlots {
96
+ header: Slot<{
97
+ dialogHeader: string;
98
+ subHeader?: string;
99
+ lists?: (string | object)[];
100
+ listLabel?: string;
101
+ isLoading: boolean;
102
+ filter: string;
103
+ updateFilter: (newFilter?: string) => void; // Hooks to update internal state filter
104
+ }>;
105
+
106
+ /**
107
+ * Slot to customize tree node item
108
+ */
109
+ treenode: Slot<{ node: TreeNode; checked: boolean; disabled: boolean }>;
110
+
111
+ footer: Slot;
112
+ }
113
+
89
114
  /**
90
115
  * **TSVue v2 - DialogSelectTree**
91
116
  *
@@ -96,7 +121,7 @@ export type DialogSelectTreeEmits = {
96
121
  */
97
122
  declare class DialogSelectTree extends ClassComponent<
98
123
  DialogSelectTreeProps,
99
- Record<string, unknown>,
124
+ DialogSelectTreeSlots,
100
125
  DialogSelectTreeEmits
101
126
  > {
102
127
  treeComponent: TreeInstance;
@@ -79,6 +79,13 @@ export interface DropdownProps {
79
79
  */
80
80
  options?: DropdownOption[] | string[] | Record<string, any>;
81
81
 
82
+ /**
83
+ * Allows `null` to be treated as a valid selectable option in the dropdown.
84
+ *
85
+ * When enabled, `null` can be included in the options list and selected by the user.
86
+ */
87
+ allowNullOption?: boolean;
88
+
82
89
  /**
83
90
  * Specify the property name of option to be used as label.
84
91
  *
@@ -24,6 +24,18 @@ export type FileUploadProps = {
24
24
  * Maximum file size allowed in bytes.
25
25
  */
26
26
  maxFileSize?: number | undefined;
27
+ /**
28
+ * Sets the initial value of the field.
29
+ * This will only available with option 'useValidator'.
30
+ * If you use this prop, it is not recommended to use 'v-model' to avoid unexpected behavior.
31
+ */
32
+ value?: File | File[];
33
+
34
+ /**
35
+ * V-model for the file upload component.
36
+ */
37
+ modelValue?: File | File[];
38
+
27
39
  /**
28
40
  * Props to determine whether file upload support multiple files or not
29
41
  *
@@ -116,14 +128,22 @@ export type FileUploadProps = {
116
128
  };
117
129
 
118
130
  export type FileUploadEmits = {
131
+ /**
132
+ * Callback to invoke when there is a file selected.
133
+ */
134
+ 'select': [event: File | File[]];
135
+ /**
136
+ * Callback to invoke when model changed.
137
+ */
138
+ 'update:modelValue': [event: File | File[]];
119
139
  /**
120
140
  * Callback to invoke when file upload is complete.
121
141
  */
122
- upload: [event: FileUploadUploadEvent];
142
+ 'upload': [event: FileUploadUploadEvent];
123
143
  /**
124
144
  * Callback to invoke if file upload fails.
125
145
  */
126
- error: [event: FileUploadErrorEvent | InputErrorCodes];
146
+ 'error': [event: FileUploadErrorEvent | InputErrorCodes];
127
147
  };
128
148
 
129
149
  /**
@@ -7,10 +7,29 @@ import { InputRangeNumberProps } from '../inputrangenumber/InputRangeNumber.vue.
7
7
  import { MultiSelectProps } from '../multiselect/MultiSelect.vue.d';
8
8
  import { ButtonSelectTreeProps } from '../buttonselecttree/ButtonSelectTree.vue.d';
9
9
 
10
+ export type FilterMatchMode =
11
+ | 'CONTAINS'
12
+ | 'EQUALS'
13
+ | 'NOT_EQUALS'
14
+ | 'IN'
15
+ | 'LESS_THAN'
16
+ | 'LESS_THAN_OR_EQUAL_TO'
17
+ | 'GREATER_THAN'
18
+ | 'GREATER_THAN_OR_EQUAL_TO'
19
+ | 'BETWEEN'
20
+ | 'DATE_BETWEEN';
21
+
10
22
  // More specific filter field types
11
23
  export interface MultiSelectFilterField extends MultiSelectProps {
12
24
  type: 'multiselect';
13
- field: string; // The name of the field this filter applies to
25
+ /**
26
+ * The name of the field this filter applies to.
27
+ *
28
+ * When using a static filter, it also specifies the field in the data to be used for generating unique options.
29
+ * For example, if filtering by a user's full name, the field could be 'user.fullName', which will extract
30
+ * unique full names from the table data and use them as filter options.
31
+ */
32
+ field: string;
14
33
  optionField?: string; // @example - actionOptions
15
34
  params?: QueryParams; // Additional QueryParams for the fetchOptionFn
16
35
  fetchOptionFn?:
@@ -20,7 +39,14 @@ export interface MultiSelectFilterField extends MultiSelectProps {
20
39
 
21
40
  export interface DropdownFilterField extends DropdownProps {
22
41
  type: 'dropdown';
23
- field: string; // The name of the field this filter applies to
42
+ /**
43
+ * The name of the field this filter applies to.
44
+ *
45
+ * When using a static filter, it also specifies the field in the data to be used for generating unique options.
46
+ * For example, if filtering by a user's full name, the field could be 'user.fullName', which will extract
47
+ * unique full names from the table data and use them as filter options.
48
+ */
49
+ field: string;
24
50
  optionField?: string; // @example - actionOptions
25
51
  params?: QueryParams; // Additional QueryParams for the fetchOptionFn
26
52
  fetchOptionFn?:
@@ -35,7 +61,17 @@ export interface RangeNumberFilterField extends InputRangeNumberProps {
35
61
  *
36
62
  * @example ['minAge', 'maxAge']
37
63
  */
38
- fields: string[];
64
+ fields?: string[];
65
+
66
+ /**
67
+ * Specify single field for both min and max input.
68
+ * The value will be a number array.
69
+ *
70
+ * Prever use this property when you are working with Static Filtering
71
+ *
72
+ * @example value: [1000,5000] or equal to 'value.0': 1000 & 'value.1': 5000
73
+ */
74
+ field?: string;
39
75
  tooltip?: string;
40
76
  }
41
77
 
@@ -99,6 +135,10 @@ export interface FilterContainerProps {
99
135
  */
100
136
  fieldsPerRow?: number;
101
137
  fields: FilterField[];
138
+ /**
139
+ * Enable static filtering
140
+ */
141
+ static?: boolean;
102
142
  }
103
143
 
104
144
  /**
@@ -113,7 +153,7 @@ export type FilterContainerSlots = {
113
153
  /**
114
154
  * Additional template for field.
115
155
  */
116
- field: Slot<{ field: AdditionalFilterField }>;
156
+ field: Slot<{ field: AdditionalFilterField; fieldName: string }>;
117
157
  };
118
158
 
119
159
  export type FilterContainerEmits = {
@@ -1,3 +1,5 @@
1
1
  import { GenericObject } from 'vee-validate';
2
+ import { FilterField } from '../FilterContainer.vue.d';
2
3
  declare const applyFilter: (values: GenericObject, tableName: string, emit?: (...args: any[]) => any) => void;
4
+ export declare const applyStaticFilter: (values: GenericObject, tableName: string, fields: FilterField[], emit?: (...args: any[]) => any) => void;
3
5
  export default applyFilter;
@@ -295,6 +295,11 @@ declare class Form extends ClassComponent<FormProps, FormSlots, FormEmits> {
295
295
  * }
296
296
  */
297
297
  setErrors(fields: GenericObject): void;
298
+
299
+ /**
300
+ * The form values
301
+ */
302
+ values: GenericObject;
298
303
  }
299
304
 
300
305
  declare module '@vue/runtime-core' {
@@ -42,6 +42,7 @@ export type WangsIcons =
42
42
  | 'building-4'
43
43
  | 'calculator'
44
44
  | 'calendar'
45
+ | 'calendar-event'
45
46
  | 'calendar-todo'
46
47
  | 'chat'
47
48
  | 'chat-check'
@@ -130,6 +131,7 @@ export type WangsIcons =
130
131
  | 'menu-unfold'
131
132
  | 'minus'
132
133
  | 'money-cny-box'
134
+ | 'money-dollar-circle'
133
135
  | 'more'
134
136
  | 'move-to'
135
137
  | 'nfc'
@@ -8,6 +8,7 @@ export { default as BaseTree } from '.././components/basetree/BaseTree.vue';
8
8
  export { default as Breadcrumb } from './breadcrumb/Breadcrumb.vue';
9
9
  export { default as Button } from './button/Button.vue';
10
10
  export { default as ButtonBulkAction } from './buttonbulkaction/ButtonBulkAction.vue';
11
+ export { default as ButtonCopy } from './buttoncopy/ButtonCopy.vue';
11
12
  export { default as ButtonDownload } from './buttondownload/ButtonDownload.vue';
12
13
  export { default as ButtonFilter } from './buttonfilter/ButtonFilter.vue';
13
14
  export { default as ButtonImportExcel } from './buttonImportExcel/ButtonImportExcel.vue';
@@ -3,7 +3,7 @@ import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
3
3
  import { TreeSelectionKeys } from 'primevue/tree';
4
4
  import { MenuItem } from '../../components/menuitem';
5
5
  import { BaseTreeProps, TreeNode } from '../basetree/BaseTree.vue.d';
6
- import { ShortFetchResponse } from '../datatable/DataTable.vue.d';
6
+ import { QueryParams, ShortFetchResponse } from '../datatable/DataTable.vue.d';
7
7
 
8
8
  export interface TreeProps extends BaseTreeProps {
9
9
  /**
@@ -13,7 +13,9 @@ export interface TreeProps extends BaseTreeProps {
13
13
  type: 'group' | 'category';
14
14
  fetchTree?: (
15
15
  type: 'group' | 'category',
16
+ params?: QueryParams,
16
17
  ) => Promise<ShortFetchResponse<TreeNode> | undefined>;
18
+ params?: QueryParams;
17
19
  selectedKeys?: TreeSelectionKeys | number[] | undefined;
18
20
  selectedTreeNodes?: TreeNode[] | undefined;
19
21
  selectionMode?: 'single' | 'checkbox' | undefined;
@@ -52,14 +54,6 @@ export interface TreeProps extends BaseTreeProps {
52
54
  * A list of node keys that should be disabled, affecting only the specified nodes and not their children.
53
55
  */
54
56
  exactDisableKeys?: number[];
55
-
56
- /**
57
- * A function to determine when the node should be disabled
58
- *
59
- * @return true to disabled
60
- */
61
- disableNodeWhen?: (node: TreeNode) => boolean;
62
-
63
57
  /**
64
58
  * Defines the tree is readonly and disabled.
65
59
  */
@@ -93,7 +87,7 @@ export type TreeEmits = {
93
87
  };
94
88
 
95
89
  export interface TreeSlots {
96
- default: Slot<{ node: TreeNode }>;
90
+ default: Slot<{ node: TreeNode; checked: boolean; disabled: boolean }>;
97
91
  }
98
92
 
99
93
  /**
@@ -81,12 +81,6 @@ export interface UserNameProps extends Partial<UserNameComponentConfigs> {
81
81
  * The full user Object
82
82
  */
83
83
  user?: GeneralUser;
84
- /**
85
- * Specify if the component can be emptyable
86
- *
87
- * @default false
88
- */
89
- emptyable?: boolean;
90
84
 
91
85
  /**
92
86
  * When it sets to false, the props.user will be used
@@ -24,6 +24,9 @@ export type Events<CustomEvents = Record<string, any>> = CustomEvents & {
24
24
  };
25
25
  };
26
26
  'data-table:update': TableEvent;
27
+ 'data-table:updated': TableEvent & {
28
+ data: Data[];
29
+ };
27
30
  'data-table:download': TableEvent & {
28
31
  fileName: string;
29
32
  multiTableNames?: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fewangsit/wangsvue-gsts",
3
- "version": "1.0.0-alpha.19",
3
+ "version": "1.0.0-alpha.20",
4
4
  "author": "Wangsit FE Developer",
5
5
  "description": "Global Settings Tagsamurai VueJS Component Library",
6
6
  "type": "module",
@@ -8,7 +8,7 @@ import { CustomColumnLocaleConfig } from '../components/customcolumn/CustomColum
8
8
  import { ButtonSearchLocaleConfig } from '../components/buttonsearch/ButtonSearch.vue.d';
9
9
  import { FilterContainerLocaleConfig } from '../components/filtercontainer/FilterContainer.vue.d';
10
10
  import { MultiSelectLocaleConfig } from '../components/multiselect/MultiSelect.vue.d';
11
- import { DropdownLocaleConfig } from '../components/dropdown/Dropdown.vue.d';
11
+ import { DropdownLocaleConfig, DropdownProps } from '../components/dropdown/Dropdown.vue.d';
12
12
  import { InputCurrencyLocaleConfig } from '../components/inputcurrency/InputCurrency.vue.d';
13
13
  import { TextareaLocaleConfig } from '../components/textarea/Textarea.vue.d';
14
14
  import { InputrangeNumberLocaleConfig } from '../components/inputrangenumber/InputRangeNumber.vue.d';
@@ -43,6 +43,7 @@ export interface ComponentDefaultPropsConfig {
43
43
  DataTable?: Partial<DataTableProps>;
44
44
  Badge?: Partial<BadgeComponentConfigs>;
45
45
  UserName?: UserNameComponentConfigs;
46
+ Dropdown?: DropdownProps;
46
47
  }
47
48
  interface ComponentLocaleConfig {
48
49
  FieldWrapper?: FieldWrapperLocaleConfig;