@fewangsit/wangsvue 1.5.196-alpha.0 → 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.
@@ -3,6 +3,23 @@ import { CustomValidation } from '../form/Form.vue.d';
3
3
 
4
4
  export type InputNumberEvent = number | string | undefined;
5
5
 
6
+ export interface InputNumberLocaleConfig {
7
+ /**
8
+ * @example 'Tulis {label}' - label can be ommited, and if exist will be replaced with props.label
9
+ */
10
+ defaultPlaceholder?: string;
11
+
12
+ /**
13
+ * @example '{label} sudah ada' - label will be replaced with props.label
14
+ */
15
+ alreadyExistInvalidText?: string;
16
+
17
+ /**
18
+ * @example '{label} must not be empty' - label will be replaced with props.label
19
+ */
20
+ emptyInvalidText?: string;
21
+ }
22
+
6
23
  /**
7
24
  * InputNumber component props
8
25
  */
@@ -11,6 +28,7 @@ export interface InputNumberProps {
11
28
  * Number modelValue of the input.
12
29
  */
13
30
  modelValue?: number;
31
+
14
32
  /**
15
33
  * Sets the initial value of the field.
16
34
  * This will only available with option 'useValidator'.
@@ -18,30 +36,36 @@ export interface InputNumberProps {
18
36
  * In use case like edit form, you need to display the previous inputted value.
19
37
  */
20
38
  value?: number;
39
+
21
40
  /**
22
41
  * Existing values to be checked with validation 'exist' - check the validatorMessage props
23
42
  *
24
43
  * - Need to specify the custom validation : { empty: 'Error message when empty' } within props validatorMessage
25
44
  */
26
45
  existingValues?: number[];
46
+
27
47
  /**
28
48
  * The input label. Tell the user what input is this.
29
49
  */
30
50
  label?: string;
51
+
31
52
  /**
32
53
  * Min input number value.
33
54
  */
34
55
  min?: number;
56
+
35
57
  /**
36
58
  * Max input number value.
37
59
  */
38
60
  max?: number;
61
+
39
62
  /**
40
63
  * The maximum input length.
41
64
  *
42
65
  * @default 16 digit number
43
66
  */
44
67
  maxDigit?: number;
68
+
45
69
  /**
46
70
  * Set the pad start of value.
47
71
  *
@@ -49,11 +73,13 @@ export interface InputNumberProps {
49
73
  * @default 1
50
74
  */
51
75
  padStart?: number;
76
+
52
77
  /**
53
78
  * Weather the input should be validated with vee-validator or not.
54
79
  * If you use this component within form input, you need to set this props as true.
55
80
  */
56
81
  useValidator?: boolean;
82
+
57
83
  /**
58
84
  * This prop is required if you use this component in a form input.
59
85
  * Specify the unique field name, match with your needs for API request.
@@ -61,53 +87,64 @@ export interface InputNumberProps {
61
87
  * @default 'numberInput'
62
88
  */
63
89
  fieldName?: string;
90
+
64
91
  /**
65
92
  * Whether this input field is required or not.
66
93
  */
67
94
  mandatory?: boolean;
95
+
68
96
  /**
69
97
  * Set custom validator message.
70
98
  * Will be show if invalid="true"
71
99
  */
72
100
  validatorMessage?: string | CustomValidation;
101
+
73
102
  /**
74
103
  * Show the validator message on error.
75
104
  *
76
105
  * @default true;
77
106
  */
78
107
  showValidatorMessage?: boolean;
108
+
79
109
  /**
80
110
  * Specify the input placeholder.
81
111
  *
82
112
  * @default 'Enter {label}' or 'Enter number'
83
113
  */
84
114
  placeholder?: string;
115
+
85
116
  /**
86
117
  * Disabled the input.
87
118
  */
88
119
  disabled?: boolean;
120
+
89
121
  /**
90
122
  * State of invalid input.
91
123
  */
92
124
  invalid?: boolean;
125
+
93
126
  /**
94
127
  * Displays increment/decrement buttons.
95
128
  */
96
129
  showButtons?: boolean;
130
+
97
131
  /**
98
132
  * The width of input.
99
133
  */
100
134
  size?: 'small' | 'normal' | 'full';
135
+
101
136
  /**
102
137
  * Defines the behavior of the component.
103
138
  * @defaultValue decimal
104
139
  */
105
140
  mode?: 'decimal' | 'currency';
141
+
106
142
  /**
107
143
  * The currency to use in currency formatting. Possible values are the [ISO 4217 currency codes](https://www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=maintenance-agency), such as 'USD' for the US dollar, 'EUR' for the euro, or 'CNY' for the Chinese RMB.
108
144
  * There is no default value; if the style is 'currency', the currency property must be provided.
109
145
  */
110
146
  currency?: string | undefined;
147
+
111
148
  /**
112
149
  * The `locale` variable specifies the regional setting or language preference to be used.
113
150
  * It is an optional string that can influence date, time, number formatting, and other locale-specific operations.
@@ -115,35 +152,43 @@ export interface InputNumberProps {
115
152
  * If not provided, the system may default to a pre-configured or fallback locale.
116
153
  */
117
154
  locale?: string;
155
+
118
156
  /**
119
157
  * Text to display before the value.
120
158
  */
121
159
  prefix?: string | undefined;
160
+
122
161
  /**
123
162
  * Text to display after the value.
124
163
  */
125
164
  suffix?: string | undefined;
165
+
126
166
  /**
127
167
  * The minimal digits of decimal value.
128
168
  */
129
169
  minFractionDigits?: number;
170
+
130
171
  /**
131
172
  * The maximal digits of decimal value.
132
173
  */
133
174
  maxFractionDigits?: number;
175
+
134
176
  /**
135
177
  * Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators.
136
178
  * @defaultValue false
137
179
  */
138
180
  useGrouping?: boolean;
181
+
139
182
  /**
140
183
  * Show information about the field.
141
184
  */
142
185
  fieldInfo?: string;
186
+
143
187
  /**
144
188
  * The filed info tooltip position
145
189
  */
146
190
  tooltipPos?: 'top' | 'right' | 'bottom' | 'left';
191
+
147
192
  /**
148
193
  * Specify the appearance of addon right and left
149
194
  * - filled - has background and border
@@ -152,22 +197,32 @@ export interface InputNumberProps {
152
197
  * @defaultValue filled
153
198
  */
154
199
  addonVariant?: 'filled' | 'plain';
200
+
155
201
  /**
156
202
  * Class to be bind on addon left component
157
203
  */
158
204
  addonLeftClass?: any;
205
+
206
+ /**
207
+ * Class to be bind on addon left component
208
+ */
209
+ addonRightClass?: any;
210
+
159
211
  /**
160
212
  * Class to be bind on input group component
161
213
  */
162
214
  inputGroupClass?: any;
215
+
163
216
  /**
164
217
  * Class to be bind on input number component
165
218
  */
166
219
  inputNumberClass?: any;
220
+
167
221
  /**
168
222
  * Unique id for input number element
169
223
  */
170
224
  inputId?: string;
225
+
171
226
  /**
172
227
  * Set auto Resize Input
173
228
  * The input width is counted by the value length
@@ -175,6 +230,7 @@ export interface InputNumberProps {
175
230
  * @default false
176
231
  */
177
232
  autoResize?: boolean;
233
+
178
234
  /**
179
235
  * Allow input to have value null or undefined.
180
236
  * If it sets to 'false', when the value is empty, it will fall back to min value if exists, zero otherwise
@@ -195,6 +251,7 @@ export type InputNumberEmits = {
195
251
  * If the inputed number is above max, return the max. And vice versa.
196
252
  */
197
253
  'update:modelValue': [payload?: number];
254
+
198
255
  /**
199
256
  * If you need to check validation, you can use this events.
200
257
  */
@@ -1,5 +1,9 @@
1
1
  import { DefineComponent } from 'vue';
2
2
 
3
+ export interface InputPhoneNumberLocaleConfig {
4
+ defaultPlaceholder?: string;
5
+ }
6
+
3
7
  /**
4
8
  * InputPhoneNumber component props
5
9
  */
@@ -1,6 +1,18 @@
1
1
  import { DefineComponent } from 'vue';
2
2
  import { CustomValidation } from '../form/Form.vue.d';
3
3
 
4
+ export interface InputrangeNumberLocaleConfig {
5
+ /**
6
+ * Locale configuration for min input placeholder.
7
+ */
8
+ minPlaceholder?: string;
9
+
10
+ /**
11
+ * Locale configuration for max input placeholder.
12
+ */
13
+ maxPlaceholder?: string;
14
+ }
15
+
4
16
  /**
5
17
  * InputRangeNumber component props
6
18
  */
@@ -9,55 +21,66 @@ export interface InputRangeNumberProps {
9
21
  * Number modelValue of the input.
10
22
  */
11
23
  modelValue?: number[];
24
+
12
25
  /**
13
26
  * Initial Form value.
14
27
  */
15
28
  value?: number[];
29
+
16
30
  /**
17
31
  * The input label. Tell the user what input is this.
18
32
  */
19
33
  label?: string;
34
+
20
35
  /**
21
36
  * Placeholder for both input
22
37
  *
23
38
  * @default undefined
24
39
  */
25
40
  placeholder?: string;
41
+
26
42
  /**
27
43
  * Specify the min number input placeholder.
28
44
  *
29
- * @default 'Tulis'
45
+ * @default - Default value of Locale Config {@link InputrangeNumberLocaleConfig.minPlaceholder}
30
46
  */
31
47
  minPlaceholder?: string;
48
+
32
49
  /**
33
50
  * Specify the max number input placeholder.
34
51
  *
35
- * @default 'Tulis'
52
+ * @default - Default value of Locale Config {@link InputrangeNumberLocaleConfig.maxPlaceholder}
36
53
  */
37
54
  maxPlaceholder?: string;
55
+
38
56
  /**
39
57
  * Disabled the input.
40
58
  */
41
59
  disabled?: boolean;
60
+
42
61
  /**
43
62
  * State of invalid input.
44
63
  */
45
64
  invalid?: boolean;
65
+
46
66
  /**
47
67
  * Show the text (opsional)
48
68
  *
49
69
  * @default true if mandatory true
50
70
  */
51
71
  showOptionalText?: boolean;
72
+
52
73
  /**
53
74
  * Weather the input should be validated with vee-validator or not.
54
75
  * If you use this component within form input, you need to set this props as true.
55
76
  */
56
77
  useValidator?: boolean;
78
+
57
79
  /**
58
80
  * Whether this input field is required or not.
59
81
  */
60
82
  mandatory?: boolean;
83
+
61
84
  /**
62
85
  * Set custom validator message.
63
86
  * Will be show if invalid="true"
@@ -65,18 +65,22 @@ export interface InputTextPassThroughMethodOptions<T = any> {
65
65
  * Defines instance.
66
66
  */
67
67
  instance: any;
68
+
68
69
  /**
69
70
  * Defines valid properties.
70
71
  */
71
72
  props: InputTextProps;
73
+
72
74
  /**
73
75
  * Defines current options.
74
76
  */
75
77
  context: InputTextContext;
78
+
76
79
  /**
77
80
  * Defines parent instance.
78
81
  */
79
82
  parent: T;
83
+
80
84
  /**
81
85
  * Defines passthrough(pt) options in global config.
82
86
  */
@@ -92,6 +96,7 @@ export interface InputTextPassThroughOptions<T = any> {
92
96
  * Used to pass attributes to the root's DOM element.
93
97
  */
94
98
  root?: InputTextPassThroughOptionType<T>;
99
+
95
100
  /**
96
101
  * Used to manage all lifecycle hooks.
97
102
  * @see {@link BaseComponent.ComponentHooks}
@@ -115,6 +120,7 @@ export interface InputTextContext {
115
120
  * @defaultValue false
116
121
  */
117
122
  filled: boolean;
123
+
118
124
  /**
119
125
  * Current disabled state of the component as a boolean.
120
126
  * @defaultValue false
@@ -127,10 +133,19 @@ export interface InputTextContext {
127
133
  */
128
134
  export interface InputTextProps extends /* @vue-ignore */ InputHTMLAttributes {
129
135
  allowedCharacters?: RegExp;
136
+
137
+ /**
138
+ * Determine whether inputted text should be automatically converted to uppercase or not.
139
+ *
140
+ * @default false
141
+ */
142
+ autoUppercase?: boolean;
143
+
130
144
  /**
131
145
  * String modelValue of the input.
132
146
  */
133
147
  modelValue?: Nullable<string>;
148
+
134
149
  /**
135
150
  * Sets the initial value of the field.
136
151
  * This will only available with option 'useValidator'.
@@ -138,12 +153,14 @@ export interface InputTextProps extends /* @vue-ignore */ InputHTMLAttributes {
138
153
  * In usecase like edit form, you need to display the previous inputted value.
139
154
  */
140
155
  value?: string;
156
+
141
157
  /**
142
158
  * Exisitng values to be checkeed with validation 'exist' - check the validatorMessage props
143
159
  *
144
160
  * - Need to specify the custom validation : { empty: 'Error message when empty' } within props validatorMessage
145
161
  */
146
162
  existingValues?: string[];
163
+
147
164
  /**
148
165
  * The maximun character length allowed.
149
166
  *
@@ -153,15 +170,18 @@ export interface InputTextProps extends /* @vue-ignore */ InputHTMLAttributes {
153
170
  * @default 120 - for InputUrl
154
171
  */
155
172
  maxLength?: number;
173
+
156
174
  /**
157
175
  * The input label. Tell the user what input is this.
158
176
  */
159
177
  label?: string;
178
+
160
179
  /**
161
180
  * Wether the input should be validated with vee-validator or not.
162
181
  * If you use this component within form input, you need to set this props as true.
163
182
  */
164
183
  useValidator?: boolean;
184
+
165
185
  /**
166
186
  * This prop is required if you use this component in a form input.
167
187
  * Specify the unique field name, match with your needs for API request.
@@ -169,67 +189,98 @@ export interface InputTextProps extends /* @vue-ignore */ InputHTMLAttributes {
169
189
  * @default 'textInput'
170
190
  */
171
191
  fieldName?: string;
192
+
172
193
  /**
173
194
  * Wether this input field is required or not.
174
195
  */
175
196
  mandatory?: boolean;
197
+
176
198
  /**
177
199
  * Invalid input state.
178
200
  */
179
201
  invalid?: boolean;
202
+
180
203
  /**
181
204
  * Set manual invalid input container state.
205
+ *
206
+ * @todo: review the usage of this props
182
207
  */
183
208
  manualInvalidContainer?: boolean;
209
+
184
210
  /**
185
211
  * Set custom validator message.
186
- * Will be show if invalid="true"
212
+ * Will be show if invalid="true" or in some conditions. {@link Condition}
213
+ *
214
+ * @example: 'This field is required'
215
+ * @example: { empty: 'This field is required', invalidFormat: 'Email format incorrect' }
187
216
  */
188
- validatorMessage?: string | CustomValidation;
217
+ validatorMessage?:
218
+ | string
219
+ | CustomValidation<'empty' | 'exceed' | 'invalidFormat' | 'exist'>;
220
+
189
221
  /**
190
222
  * Classes for validator message in input field.
191
223
  */
192
224
  validatorMessageClass?: string;
225
+
193
226
  /**
194
227
  * Specify the input placeholder.
195
228
  *
196
229
  * @default 'Enter {label}' or 'Enter {type}'
197
230
  */
198
231
  placeholder?: string;
232
+
199
233
  /**
200
234
  * Specify the validation type. Wether 'email' or 'text' validation.
201
235
  */
202
236
  type?: 'email' | 'text' | 'url' | 'initialname' | 'repositoryname';
237
+
203
238
  /**
204
239
  * Disabled the input.
205
240
  */
206
241
  disabled?: boolean;
242
+
207
243
  /**
208
244
  * Show information to user about the field.
209
245
  */
210
246
  fieldInfo?: string;
247
+
211
248
  /**
212
249
  * Specify classes for input.
213
250
  */
214
251
  inputClass?: string;
252
+
215
253
  /**
216
254
  * Specify classes for input container.
217
255
  */
218
256
  inputContainerClass?: string;
257
+
219
258
  /**
220
259
  * Specify classes for label.
221
260
  */
222
261
  labelClass?: string;
262
+
223
263
  /**
224
264
  * Auto blur while input value has reached the max length.
265
+ *
266
+ * @deprecated This will be removed in the next major update. Use {@link preventInputOnMaxLength} instead.
225
267
  */
226
268
  blurOnReachMaxLength?: boolean;
269
+
270
+ /**
271
+ * Prevent input once the max length is reached, allowing only backspace.
272
+ *
273
+ * @default false
274
+ */
275
+ preventInputOnMaxLength?: boolean;
276
+
227
277
  /**
228
278
  * Validate the input on blur event.
229
279
  *
230
280
  * @default false - on input event
231
281
  */
232
282
  validateOnBlur?: boolean;
283
+
233
284
  /**
234
285
  * For Input URL, whether validate the protocol http/https
235
286
  *
@@ -243,6 +294,17 @@ export interface InputTextProps extends /* @vue-ignore */ InputHTMLAttributes {
243
294
  * @default true
244
295
  */
245
296
  allowSpecialCharacters?: boolean;
297
+
298
+ /**
299
+ * Wether the input should be wrapped with InputGroup Component or not.
300
+ * Currently used for InputPhoneNumber.
301
+ */
302
+ useInputGroup?: boolean;
303
+
304
+ /**
305
+ * Unique id for input number element
306
+ */
307
+ inputId?: string;
246
308
  }
247
309
 
248
310
  /**
@@ -1,55 +1,72 @@
1
+ import { DropdownLocaleConfig } from '../dropdown/Dropdown.vue.d';
2
+ import { CustomValidation } from '../form/Form.vue.d';
1
3
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
2
4
 
3
5
  import { MultiSelectOption, OptionValue } from 'lib/types/options.type';
4
6
 
7
+ export type MultiSelectLocaleConfig = DropdownLocaleConfig & {};
8
+
5
9
  /**
6
10
  * MultiSelect component props
7
11
  */
8
12
  export interface MultiSelectProps {
9
13
  modelValue?: OptionValue[];
14
+
10
15
  /**
11
16
  * If you deals with form validation on edit form action, you can set the initial value of the field.
12
17
  */
13
18
  initialValue?: OptionValue[];
19
+
14
20
  /**
15
21
  * The field label. Tell the user what field input is this.
16
22
  */
17
23
  label?: string;
24
+
18
25
  /**
19
26
  * List of options to display.
20
27
  */
21
28
  options?: MultiSelectOption[] | string[];
29
+
22
30
  /**
23
31
  * Specify the property name of option to be used as label.
24
32
  *
25
33
  * @default undefined - the label will be sets to the option itself.
26
34
  */
27
35
  optionLabel?: string;
36
+
28
37
  /**
29
38
  * Specify the property name of option to be used as value.
30
39
  *
31
40
  * @default undefined - the value will be sets to the option itself.
32
41
  */
33
42
  optionValue?: string;
43
+
34
44
  /**
35
45
  * Determines if the field uses a validator
36
46
  */
37
47
  useValidator?: boolean;
48
+
38
49
  /**
39
50
  * Determines if the field is mandatory
40
51
  */
41
52
  mandatory?: boolean;
53
+
42
54
  /**
43
55
  * Show the text (opsional)
44
56
  *
45
57
  * @default true if mandatory true
46
58
  */
47
59
  showOptionalText?: boolean;
60
+
48
61
  /**
49
62
  * Set custom validator message.
50
63
  * It is rarely use, this component has handled the validator message.
64
+ *
65
+ * @example: 'This field is required'
66
+ * @example: { empty: 'This field is required' }
51
67
  */
52
- validatorMessage?: string;
68
+ validatorMessage?: string | CustomValidation<'empty'>;
69
+
53
70
  /**
54
71
  * This prop is required if you use this component in a form input.
55
72
  * Specify the unique field name, match with your needs for API request.
@@ -57,59 +74,62 @@ export interface MultiSelectProps {
57
74
  * @default 'multiSelect'
58
75
  */
59
76
  fieldName?: string;
77
+
60
78
  /**
61
79
  * Default text to display when no option is selected.
62
80
  *
63
81
  * @default `Select ${label}`
64
82
  */
65
83
  placeholder?: string;
84
+
66
85
  /**
67
86
  * Whether the MultiSelect is in loading state.
68
87
  * @defaultValue false
69
88
  */
70
89
  loading?: boolean;
90
+
71
91
  /**
72
92
  * Show icon 'info' on the right side of label.
73
93
  * Show information to user about the field on icon hover.
74
94
  */
75
95
  fieldInfo?: string;
96
+
76
97
  /**
77
98
  * Hide the input and controls the overlay state from parent component.
78
99
  */
79
100
  controls?: boolean;
101
+
80
102
  /**
81
103
  * Disabled state.
82
104
  */
83
105
  disabled?: boolean;
106
+
84
107
  /**
85
108
  * Wether show the Dropdown option search or not.
86
109
  *
87
110
  * @default true,
88
111
  */
89
112
  filter?: boolean;
113
+
90
114
  /**
91
115
  * The filter input Placeholder
92
116
  *
93
- * @default 'Search'
117
+ * @default 'Search' from Global Locale Config
94
118
  */
95
119
  filterPlaceholder?: string;
120
+
96
121
  /**
97
122
  * Defines how the selected items are displayed.
98
123
  *
99
124
  * @default 'chip'
100
125
  */
101
126
  display?: 'comma' | 'chip';
102
- /**
103
- * Defines the placeholder (label in input) as medium font.
104
- * Used in Preset?.
105
- *
106
- * @default false
107
- */
108
- fontMediumPlaceholder?: boolean;
127
+
109
128
  /**
110
129
  * Label to display after exceeding max selected labels.
111
130
  */
112
131
  selectedItemsLabel?: string;
132
+
113
133
  /**
114
134
  * Decides how many selected item labels to show at most.
115
135
  */
@@ -124,10 +144,12 @@ export type MultiSelectEmits = {
124
144
  * Emits when an option selected.
125
145
  */
126
146
  'update:modelValue': [value: OptionValue[] | undefined];
147
+
127
148
  /**
128
149
  * Emits when overlay shown.
129
150
  */
130
151
  'show': [];
152
+
131
153
  /**
132
154
  * Emits when overlay hidden.
133
155
  */
@@ -152,6 +174,7 @@ declare class MultiSelect extends ClassComponent<
152
174
  * @memberof MultiSelect
153
175
  */
154
176
  showOverlay(): void;
177
+
155
178
  /**
156
179
  * Hides the overlay.
157
180
  *