@fewangsit/wangsvue 1.5.195 → 1.5.196-alpha.1

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,3 +1,4 @@
1
+ import { StyleValue } from 'vue';
1
2
  import { ComponentHooks } from '../basecomponent';
2
3
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
3
4
 
@@ -18,26 +19,32 @@ export interface ButtonRadioPassThroughMethodOptions {
18
19
  * Defines instance.
19
20
  */
20
21
  instance: any;
22
+
21
23
  /**
22
24
  * Defines valid properties.
23
25
  */
24
26
  props: ButtonRadioProps;
27
+
25
28
  /**
26
29
  * Defines current inline state.
27
30
  */
28
31
  state: ButtonRadioState;
32
+
29
33
  /**
30
34
  * Defines current options.
31
35
  */
32
36
  context: ButtonRadioContext;
37
+
33
38
  /**
34
39
  * Defines valid attributes.
35
40
  */
36
41
  attrs: any;
42
+
37
43
  /**
38
44
  * Defines parent options.
39
45
  */
40
46
  parent: any;
47
+
41
48
  /**
42
49
  * Defines passthrough(pt) options in global config.
43
50
  */
@@ -53,18 +60,22 @@ export interface ButtonRadioPassThroughOptions {
53
60
  * Used to pass attributes to the root's DOM element.
54
61
  */
55
62
  root?: ButtonRadioPassThroughOptionType;
63
+
56
64
  /**
57
65
  * Used to pass attributes to the input's DOM element.
58
66
  */
59
67
  input?: ButtonRadioPassThroughOptionType;
68
+
60
69
  /**
61
70
  * Used to pass attributes to the box's DOM element.
62
71
  */
63
72
  box?: ButtonRadioPassThroughOptionType;
73
+
64
74
  /**
65
75
  * Used to pass attributes to the icon's DOM element.
66
76
  */
67
77
  icon?: ButtonRadioPassThroughOptionType;
78
+
68
79
  /**
69
80
  * Used to manage all lifecycle hooks.
70
81
  * @see {@link BaseComponent.ComponentHooks}
@@ -94,59 +105,83 @@ export interface ButtonRadioProps {
94
105
  * The label for the input element
95
106
  */
96
107
  label?: string;
108
+
97
109
  /**
98
110
  * Value of the input.
99
111
  */
100
112
  value?: any;
113
+
101
114
  /**
102
115
  * Value binding of the input.
103
116
  */
104
117
  modelValue?: any;
118
+
105
119
  /**
106
120
  * Name of the input element.
107
121
  */
108
122
  name?: string | undefined;
123
+
109
124
  /**
110
125
  * Allows to select a boolean value.
111
126
  * @default false
112
127
  */
113
128
  binary?: boolean;
129
+
114
130
  /**
115
131
  * When present, it specifies that the component should have invalid state style.
116
132
  * @defaultValue false
117
133
  */
118
134
  invalid?: boolean | undefined;
135
+
119
136
  /**
120
137
  * When present, it specifies that the component should be disabled.
121
138
  * @defaultValue false
122
139
  */
123
140
  disabled?: boolean | undefined;
141
+
124
142
  /**
125
143
  * Specifies the input variant of the component.
126
144
  * @defaultValue outlined
127
145
  */
128
146
  variant?: 'outlined' | 'filled' | undefined;
147
+
129
148
  /**
130
149
  * When present, it specifies that an input field is read-only.
131
150
  * @default false
132
151
  */
133
152
  readonly?: boolean | undefined;
153
+
134
154
  /**
135
155
  * Index of the element in tabbing order.
136
156
  */
137
157
  tabindex?: number | undefined;
158
+
138
159
  /**
139
160
  * Identifier of the underlying input element.
140
161
  */
141
162
  inputId?: string | undefined;
163
+
142
164
  /**
143
165
  * Inline style of the input field.
144
166
  */
145
- inputStyle?: object | undefined;
167
+ inputStyle?: StyleValue | undefined;
168
+
146
169
  /**
147
170
  * Style class of the input field.
148
171
  */
149
172
  inputClass?: string | object | undefined;
173
+
174
+ /**
175
+ * Tooltip info about the checkbox.
176
+ */
177
+ tooltip?: string;
178
+
179
+ /**
180
+ * Tooltip position.
181
+ *
182
+ * @default 'top'
183
+ */
184
+ tooltipPos?: 'top' | 'right' | 'left' | 'bottom';
150
185
  }
151
186
 
152
187
  /**
@@ -158,6 +193,7 @@ export interface ButtonRadioContext {
158
193
  * @defaultValue false
159
194
  */
160
195
  checked: boolean;
196
+
161
197
  /**
162
198
  * Current disabled state of the item as a boolean.
163
199
  * @defaultValue false
@@ -173,22 +209,25 @@ export type ButtonRadioEmits = {
173
209
  * Emitted when the value changes.
174
210
  * @param {*} value - New value.
175
211
  */
176
- 'update:modelValue'(value: any): void;
212
+ 'update:modelValue': [value: any];
213
+
177
214
  /**
178
215
  * Callback to invoke on radio button value change.
179
216
  * @param {Event} event - Browser event.
180
217
  */
181
- change(event: Event): void;
218
+ 'change': [event: Event];
219
+
182
220
  /**
183
221
  * Callback to invoke when the component receives focus.
184
222
  * @param {Event} event - Browser event.
185
223
  */
186
- focus(event: Event): void;
224
+ 'focus': [event: Event];
225
+
187
226
  /**
188
227
  * Callback to invoke when the component loses focus.
189
228
  * @param {Event} event - Browser event.
190
229
  */
191
- blur(event: Event): void;
230
+ 'blur': [event: Event];
192
231
  };
193
232
 
194
233
  /**
@@ -3,104 +3,123 @@ import { TreeNode } from '../basetree/BaseTree.vue.d';
3
3
  import { ShortFetchResponse } from '../datatable/DataTable.vue.d';
4
4
 
5
5
  export type KeysModelValue = number[] | undefined;
6
+ export type NodeModelValue =
7
+ | number
8
+ | TreeNode
9
+ | string
10
+ | (number | TreeNode | string)[];
6
11
 
7
12
  export interface ButtonSelectTreeProps {
8
- fetchTree?: (
9
- type: 'group' | 'category',
10
- ) => Promise<ShortFetchResponse<TreeNode> | undefined>;
11
13
  /**
12
- * Specify wether the all tree node should be auto checked once it rendered.
13
- * @default false
14
+ * Below are props that commonly used
15
+ * @example - [type, value as modelvalue, fieldDataKey, selectionMode, useValidator, mandatory, fieldName, validatorMessage, label, dialogHeader]
14
16
  */
15
- autoSelectAll?: boolean;
17
+
16
18
  /**
17
- * The keys model value.
18
- * Keys also be used as field value. If you deal with form validation of edit action,
19
- * you need to bind the initital keys :keys="yourKeys"
19
+ * The tree type.
20
20
  */
21
- keys?: KeysModelValue;
22
- disableKeys?: number[];
21
+ type: 'group' | 'category';
23
22
  /**
24
- * Disable the Select button
23
+ * The model value.
24
+ * If you deal with form validation of edit action,
25
+ * you need to bind the initital value :value="yourValue"
26
+ * Please take a note that you should pass value that match your `props.fieldDataKey`
25
27
  */
26
- disabled?: boolean;
27
- exactDisableKey?: number;
28
+ value?: NodeModelValue;
28
29
  /**
29
- * Disable node 'All' selection
30
+ * If selection mode is single mode and you're on edit form, this props should be used
30
31
  */
31
- disableNodeAll?: boolean;
32
+ selectedNode?: TreeNode;
32
33
  /**
33
- * The selected tree nodes object model value.
34
+ * To determine which field key that will be used as value
34
35
  */
35
- selectedNodes?: TreeNode[];
36
+ fieldDataKey?: string;
36
37
  /**
37
- * Used for single selection model value.
38
+ * The selection Mode.
39
+ *
40
+ * @default 'checkbox';
38
41
  */
39
- selectedNode?: TreeNode;
42
+ selectionMode?: 'single' | 'checkbox';
40
43
  /**
41
- * For checkbox selection, old behavior is preventing select if there is no node selected.
44
+ * Wether the input should be validated with vee-validator or not.
45
+ * If you use this component within form input, you need to set this props as true.
46
+ */
47
+ useValidator?: boolean;
48
+ /**
49
+ * This prop is required if you use this component in a form input.
50
+ * Specify the unique field name, match with your needs for API request.
42
51
  *
43
- * This props comes to make options, wether the selection can be empty or not.
44
- * @default true
52
+ * @default 'selectTree'
45
53
  */
46
- allowEmptySelection?: boolean;
54
+ fieldName?: string;
47
55
  /**
48
- * Set custom header Dialog Select Tree
56
+ * Make this field as mandatory on form input.
49
57
  */
50
- dialogHeader?: string;
58
+ mandatory?: boolean;
51
59
  /**
52
- * The tree type.
60
+ * Set custom validator message.
61
+ * Will be show if invalid="true"
53
62
  */
54
- type: 'group' | 'category';
63
+ validatorMessage?: string;
64
+ /**
65
+ * Set custom header Dialog Select Tree
66
+ */
67
+ dialogHeader?: string;
55
68
  /**
56
69
  * The button label.
57
70
  *
58
71
  * @default 'Select ${props.type}'
59
72
  */
60
73
  label?: string;
74
+
75
+ fetchTree?: (
76
+ type: 'group' | 'category',
77
+ ) => Promise<ShortFetchResponse<TreeNode> | undefined>;
61
78
  /**
62
- * The field label
79
+ * Specify wether the all tree node should be auto checked once it rendered.
80
+ * @default false
63
81
  */
64
- fieldLabel?: string;
82
+ autoSelectAll?: boolean;
83
+ disableKeys?: number[];
65
84
  /**
66
- * The selection Mode.
67
- *
68
- * @default 'checkbox';
85
+ * Disable the Select button
69
86
  */
70
- selectionMode?: 'single' | 'checkbox';
87
+ disabled?: boolean;
88
+ exactDisableKey?: number;
71
89
  /**
72
- * Wether the input should be validated with vee-validator or not.
73
- * If you use this component within form input, you need to set this props as true.
90
+ * Disable node 'All' selection
74
91
  */
75
- useValidator?: boolean;
92
+ disableNodeAll?: boolean;
76
93
  /**
77
- * This prop is required if you use this component in a form input.
78
- * Specify the unique field name, match with your needs for API request.
94
+ * For checkbox selection, old behavior is preventing select if there is no node selected.
79
95
  *
80
- * @default 'selectTree'
96
+ * This props comes to make options, wether the selection can be empty or not.
97
+ * @default true
81
98
  */
82
- fieldName?: string;
99
+ allowEmptySelection?: boolean;
83
100
  /**
84
- * The information to be shown to user by hovering info icon.
101
+ * The field label
85
102
  */
86
- fieldInfo?: string;
103
+ fieldLabel?: string;
87
104
  /**
88
- * Make this field as mandatory on form input.
105
+ * The information to be shown to user by hovering info icon.
89
106
  */
90
- mandatory?: boolean;
107
+ fieldInfo?: string;
91
108
  /**
92
109
  * Invalid state.
93
110
  */
94
111
  invalid?: boolean;
95
112
  /**
96
- * Set custom validator message.
97
- * Will be show if invalid="true"
113
+ * Defines width of button for 'Select Group' / 'Select Category' in px.
114
+ * Deprecated, use props `width` instead
115
+ *
116
+ * @deprecated
98
117
  */
99
- validatorMessage?: string;
118
+ btnWidth?: number;
100
119
  /**
101
120
  * Defines width of button for 'Select Group' / 'Select Category' in px.
102
121
  */
103
- btnWidth?: number;
122
+ width?: number;
104
123
  /**
105
124
  * Defines the tree is readonly and disabled.
106
125
  */
@@ -136,9 +155,7 @@ export interface ButtonSelectTreeProps {
136
155
  }
137
156
 
138
157
  export type ButtonSelectTreeEmits = {
139
- 'update:keys': [keys: KeysModelValue, isAllSelected?: boolean];
140
- 'update:selectedNode': [node: TreeNode | undefined];
141
- 'update:selectedNodes': [nodes: TreeNode[]];
158
+ 'update:value': [keys: NodeModelValue, isAllSelected?: boolean];
142
159
  'dialogShown': [];
143
160
  'dialogHidden': [];
144
161
  'reset': [];
@@ -1,18 +1,15 @@
1
1
  import { DefineComponent } from 'vue';
2
+ import {
3
+ ToggleSwitchEmits,
4
+ ToggleSwitchProps,
5
+ } from '../toggleswitch/ToggleSwitch.vue.d';
2
6
 
3
- export interface ButtonToggleProps {
4
- modelValue?: boolean;
5
- /**
6
- * Whether this button toggle is a tristate toggle.
7
- * @defaultValue false
8
- */
9
- triState?: boolean;
10
- }
11
-
12
- export type ButtonToggleEmits = {
13
- 'update:modelValue': [state: boolean];
14
- };
7
+ export type ButtonToggleProps = ToggleSwitchProps & {};
8
+ export type ButtonToggleEmits = ToggleSwitchEmits & {};
15
9
 
10
+ /**
11
+ * @deprecated Use ToggleSwitch component instead.
12
+ */
16
13
  declare const ButtonToggle: DefineComponent<
17
14
  ButtonToggleProps,
18
15
  ButtonToggleEmits
@@ -8,8 +8,10 @@ type __VLS_PublicProps = {
8
8
  } & typeof __VLS_typeProps;
9
9
  declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<__VLS_PublicProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
10
10
  "update:visible": (visible: boolean) => void;
11
+ reloadTable: () => void;
11
12
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToOption<__VLS_PublicProps>>> & {
12
13
  "onUpdate:visible"?: (visible: boolean) => any;
14
+ onReloadTable?: () => any;
13
15
  }, {}, {}>;
14
16
  export default _default;
15
17
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -24,6 +24,42 @@ export type DialogFormPayload<
24
24
  formValues: FormValuesType;
25
25
  };
26
26
 
27
+ export interface DialogFormLocaleConfig {
28
+ /**
29
+ * @example 'Cancel'
30
+ */
31
+ cancelBtnLabel?: string;
32
+
33
+ /**
34
+ * @example 'Clear Field'
35
+ */
36
+ clearBtnLabel?: string;
37
+
38
+ /**
39
+ * @example 'Stay after submit'
40
+ */
41
+ stayCheckboxLabel?: string;
42
+
43
+ /**
44
+ * @example 'Submit'
45
+ */
46
+ submitBtnLabel?: string;
47
+
48
+ /**
49
+ * Set the label for button expand sidebar right when it is expanded.
50
+ *
51
+ * @example 'Tutup <'
52
+ */
53
+ asideRightExpandedButtonLabel?: string;
54
+
55
+ /**
56
+ * Set the label for button expand sidebar right when it is collapsed.
57
+ *
58
+ * @example 'Lihat data yang ada >'
59
+ */
60
+ asideRightCollapsedButtonLabel?: string;
61
+ }
62
+
27
63
  /**
28
64
  * Props for DialogForm component
29
65
  */
@@ -32,19 +68,17 @@ export interface DialogFormProps extends FormProps {
32
68
  * The template for form buttons.
33
69
  */
34
70
  buttonsTemplate: ('clear' | 'submit' | 'cancel')[];
71
+
35
72
  /**
36
73
  * The dialog header.
37
74
  */
38
75
  header: string;
76
+
39
77
  /**
40
78
  * Value binding to show/hide the dialog.
41
79
  */
42
80
  visible: boolean;
43
81
 
44
- /**
45
- * Determine the button label for form.
46
- */
47
- actionLabel?: string;
48
82
  /**
49
83
  * With in pixel
50
84
  *
@@ -52,53 +86,69 @@ export interface DialogFormProps extends FormProps {
52
86
  */
53
87
  asideRightWidth?: number;
54
88
  class?: string | string[];
89
+
55
90
  /**
56
91
  * Custom button cancel label.
92
+ *
93
+ * @default - The default value from locale configuration {@link DialogFormLocaleConfig.cancelBtnLabel}
94
+ *
57
95
  */
58
96
  cancelBtnLabel?: string;
97
+
59
98
  /**
60
99
  * Custom button clear label.
100
+ *
101
+ * @default - The default value from locale configuration {@link DialogFormLocaleConfig.clearBtnLabel}
61
102
  */
62
103
  clearBtnLabel?: string;
104
+
63
105
  /**
64
106
  * Wether show the Close icon or not.
65
107
  */
66
108
  closable?: boolean;
109
+
67
110
  /**
68
111
  * Close dialog after form validated and submitted.
69
112
  *
70
113
  * @default true
71
114
  */
72
115
  closeOnSubmit?: boolean;
116
+
73
117
  /**
74
118
  * @deprecated
75
119
  */
76
120
  contentClass?: string | string[];
121
+
77
122
  /**
78
123
  * Show Date time on header.
79
124
  */
80
125
  dateHeader?: string;
126
+
81
127
  /**
82
128
  * Set the header icon left beside of the title.
83
129
  */
84
130
  headerIcon?: WangsIcons;
131
+
85
132
  /**
86
133
  * Sets the invalid state.
87
134
  *
88
135
  * @default false
89
136
  */
90
137
  invalid?: boolean;
138
+
91
139
  /**
92
140
  * Prevent form resets after submitted. Default is resetted.
93
141
  *
94
142
  * @default true
95
143
  */
96
144
  resetAfterSubmit?: boolean;
145
+
97
146
  /**
98
147
  * The severity of the dialog.
99
148
  * The severity will determine the dialog icons and color scheme.
100
149
  */
101
150
  severity?: 'success' | 'danger' | 'primary';
151
+
102
152
  /**
103
153
  * Show or hide the checkbox 'Stay after submit.'
104
154
  *
@@ -106,20 +156,27 @@ export interface DialogFormProps extends FormProps {
106
156
  * @default false - if the action is save.
107
157
  */
108
158
  showStayCheckbox?: boolean;
159
+
109
160
  /**
110
161
  * Custom label for stay checkbox.
162
+ *
163
+ * @default - The default value from locale configuration {@link DialogFormLocaleConfig.stayCheckboxLabel}
111
164
  */
112
165
  stayCheckboxLabel?: string;
166
+
113
167
  /**
114
168
  * Custom button submit label.
169
+ * @default - The default value from locale configuration {@link DialogFormLocaleConfig.submitBtnLabel}
115
170
  */
116
171
  submitBtnLabel?: string;
172
+
117
173
  /**
118
174
  * Define the invalid message to be shown on invalid state above the Form submit button.
119
175
  *
120
176
  * @default undefined
121
177
  */
122
178
  validatorMessage?: string;
179
+
123
180
  /**
124
181
  * Additional validation function.
125
182
  * Within this this function, you need to set the invalid props value.
@@ -128,6 +185,7 @@ export interface DialogFormProps extends FormProps {
128
185
  * Otherwise, 'submit' event will be emitted.
129
186
  */
130
187
  validationFunction?: () => void | Promise<void>;
188
+
131
189
  /**
132
190
  * Set the dialog size.
133
191
  *
@@ -147,10 +205,12 @@ export interface ConfirmSlots {
147
205
  * The Visible state.
148
206
  */
149
207
  visible: boolean;
208
+
150
209
  /**
151
210
  * Hide the confirm dialog.
152
211
  */
153
212
  hide: () => void;
213
+
154
214
  /**
155
215
  * The submit function to be called after confirmation.
156
216
  */
@@ -172,18 +232,22 @@ export interface DialogFormSlots {
172
232
  * Slot for action buttons.
173
233
  */
174
234
  'actionButtons': Slot<ActionSlots>;
235
+
175
236
  /**
176
237
  * Slot for aside right expansion.
177
238
  */
178
239
  'aside-right': Slot;
240
+
179
241
  /**
180
242
  * Slot for dialog confirm.
181
243
  */
182
244
  'confirm': Slot<ConfirmSlots>;
245
+
183
246
  /**
184
247
  * The fields slot for the Dialogform. Here is where you can put your Dialogform fields.
185
248
  */
186
249
  'fields': Slot<{ formValues: GenericObject; key?: number }>;
250
+
187
251
  /**
188
252
  * Slot for dialog header.
189
253
  */
@@ -198,22 +262,27 @@ export type DialogFormEmits = {
198
262
  * Emits when 'Clear Field' button clicked.
199
263
  */
200
264
  'clear': [];
265
+
201
266
  /**
202
267
  * When dialog is closed by close button.
203
268
  */
204
269
  'close': [];
270
+
205
271
  /**
206
272
  * Callback to invoke when dialog is hidden.
207
273
  */
208
274
  'hide': [];
275
+
209
276
  /**
210
277
  * Callback to invoke when dialog is shown.
211
278
  */
212
279
  'show': [];
280
+
213
281
  /**
214
282
  * Emits when the form validation succes and props.invalid is 'false'.
215
283
  */
216
284
  'submit': [values: DialogFormPayload];
285
+
217
286
  /**
218
287
  * When dialog is closed.
219
288
  */
@@ -240,6 +309,7 @@ declare class DialogForm extends ClassComponent<
240
309
  * Exposed function to clears the form fields.
241
310
  */
242
311
  clearField: () => void;
312
+
243
313
  /**
244
314
  * The ref of form element.
245
315
  */
@@ -2,6 +2,7 @@ import { TreeSelectionKeys } from 'primevue/tree';
2
2
  import { TreeNode } from '../basetree/BaseTree.vue.d';
3
3
  import { ShortFetchResponse } from '../datatable/DataTable.vue.d';
4
4
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
5
+ import TreeInstance from '../tree/Tree.vue.d';
5
6
 
6
7
  export interface DialogSelectTreeProps {
7
8
  fetchTree?: (
@@ -87,7 +88,9 @@ declare class DialogSelectTree extends ClassComponent<
87
88
  DialogSelectTreeProps,
88
89
  Record<string, unknown>,
89
90
  DialogSelectTreeEmits
90
- > {}
91
+ > {
92
+ treeComponent: TreeInstance;
93
+ }
91
94
 
92
95
  declare module '@vue/runtime-core' {
93
96
  interface GlobalComponents {