@progress/kendo-vue-inputs 3.3.2 → 3.3.3-dev.202205261455

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.
@@ -89,6 +89,34 @@ export interface InputProps extends FormComponentProps {
89
89
  * Specifies the placeholder of an `input` element. Used to define if the input is empty.
90
90
  */
91
91
  placeholder?: string;
92
+ /**
93
+ * Defines a string prop that controls the input icon.
94
+ */
95
+ iconName: String;
96
+ /**
97
+ * Defines if the inputPrefix will be shown. Accepts a slot name, a `render` function, or a Vue component.
98
+ */
99
+ inputPrefix: Boolean | String | Object | Function;
100
+ /**
101
+ * Defines if the inputSuffix will be shown. Accepts a slot name, a `render` function, or a Vue component.
102
+ */
103
+ inputSuffix: Boolean | String | Object | Function;
104
+ /**
105
+ * Defines a boolean prop that controls whether to show the validation icon. Defaults to 'false'.
106
+ */
107
+ showValidationIcon: Boolean;
108
+ /**
109
+ * Defines a boolean prop that controls whether to show the loading icon. Defaults to 'false'.
110
+ */
111
+ showLoadingIcon: Boolean;
112
+ /**
113
+ * Defines a boolean prop that controls whether to show the clear icon. Defaults to 'false'.
114
+ */
115
+ showClearButton: Boolean;
116
+ /**
117
+ * Defines additional class to the inner input element.
118
+ */
119
+ inputClass: String;
92
120
  }
93
121
  /**
94
122
  * @hidden
@@ -121,7 +149,7 @@ export interface InputMethods {
121
149
  isInvalid: (state: any) => any;
122
150
  setValidity: () => void;
123
151
  handleInput?: () => void;
124
- handleChange?: (event: any) => void;
152
+ handleChange: (event: any) => void;
125
153
  handleKeyup?: (event: any) => void;
126
154
  handleKeydown?: (event: any) => void;
127
155
  handleKeypress?: (event: any) => void;
@@ -19,7 +19,7 @@ import * as Vue from 'vue';
19
19
  var allVue = Vue;
20
20
  var gh = allVue.h;
21
21
  var ref = allVue.ref;
22
- import { guid, validatePackage, kendoThemeMaps } from '@progress/kendo-vue-common';
22
+ import { guid, templateDefinition, validatePackage, kendoThemeMaps, templateRendering, getListeners, getTemplate } from '@progress/kendo-vue-common';
23
23
  import { packageMetadata } from '../package-metadata';
24
24
  import { FloatingLabel } from '@progress/kendo-vue-labels';
25
25
  var InputVue2 = {
@@ -99,7 +99,14 @@ var InputVue2 = {
99
99
  validityStyles: {
100
100
  type: Boolean,
101
101
  default: true
102
- }
102
+ },
103
+ iconName: String,
104
+ inputPrefix: templateDefinition,
105
+ inputSuffix: templateDefinition,
106
+ showValidationIcon: Boolean,
107
+ showLoadingIcon: Boolean,
108
+ showClearButton: Boolean,
109
+ inputClass: String
103
110
  },
104
111
  data: function data() {
105
112
  return {
@@ -138,12 +145,15 @@ var InputVue2 = {
138
145
  var _this = this;
139
146
 
140
147
  var h = gh || createElement;
141
- var listeners = this.v3 ? this.$attrs : this.$listeners;
142
148
  var isValid = !this.$props.validityStyles || this.validity().valid;
143
149
  var _a = this.$props,
144
150
  label = _a.label,
145
151
  id = _a.id,
146
- required = _a.required;
152
+ required = _a.required,
153
+ iconName = _a.iconName,
154
+ showValidationIcon = _a.showValidationIcon,
155
+ showLoadingIcon = _a.showLoadingIcon,
156
+ showClearButton = _a.showClearButton;
147
157
  var inputId = id || this._inputId;
148
158
  var textbox = h('input', __assign(__assign({
149
159
  domProps: this.v3 ? null : __assign(__assign({}, this.$attrs), {
@@ -183,9 +193,47 @@ var InputVue2 = {
183
193
  onAnimationstart: this.handleAutoFill,
184
194
  onAnimationend: this.handleAutoFillEnd
185
195
  }));
196
+ var inputPrefixTemplate = templateRendering.call(this, this.$props.inputPrefix, getListeners.call(this));
197
+ var inputSuffixTemplate = templateRendering.call(this, this.$props.inputSuffix, getListeners.call(this));
198
+ var inputPrefix = getTemplate.call(this, {
199
+ h: h,
200
+ template: inputPrefixTemplate,
201
+ additionalProps: {
202
+ value: this.computedValue,
203
+ valid: isValid
204
+ }
205
+ });
206
+ var inputSuffix = getTemplate.call(this, {
207
+ h: h,
208
+ template: inputSuffixTemplate,
209
+ additionalProps: {
210
+ value: this.computedValue,
211
+ valid: isValid
212
+ }
213
+ });
186
214
  var inputWrapper = h("span", {
187
215
  "class": this.inputWrapperClass()
188
- }, [textbox]);
216
+ }, [iconName && h("span", {
217
+ "class": "k-input-icon k-icon k-i-" + iconName
218
+ }), this.$props.inputPrefix && h("span", {
219
+ "class": "k-input-prefix"
220
+ }, [inputPrefix]), textbox, this.$props.inputSuffix && h("span", {
221
+ "class": "k-input-suffix"
222
+ }, [inputSuffix]), showValidationIcon && isValid && h("span", {
223
+ "class": "k-input-validation-icon k-icon k-i-check"
224
+ }), showValidationIcon && !isValid && h("span", {
225
+ "class": "k-input-validation-icon k-icon k-i-warning"
226
+ }), showLoadingIcon && h("span", {
227
+ "class": "k-input-loading-icon k-icon k-i-loading"
228
+ }), showClearButton && this.computedValue && h("span", {
229
+ onClick: this.clearClick,
230
+ on: this.v3 ? undefined : {
231
+ "click": this.clearClick
232
+ },
233
+ "class": "k-clear-value"
234
+ }, [h("span", {
235
+ "class": "k-icon k-i-x"
236
+ })])]);
189
237
  return label ? // @ts-ignore function children
190
238
  h(FloatingLabel, {
191
239
  label: label,
@@ -226,6 +274,9 @@ var InputVue2 = {
226
274
  handleKeypress: function handleKeypress(e) {
227
275
  this.$emit('keypress', e);
228
276
  },
277
+ clearClick: function clearClick(event) {
278
+ this.emitUpdate(event, 'change', '');
279
+ },
229
280
  focus: function focus() {
230
281
  if (this._input) {
231
282
  this._input.focus();
@@ -265,32 +316,26 @@ var InputVue2 = {
265
316
  }
266
317
  },
267
318
  handleInput: function handleInput(event) {
268
- var that = this;
269
- this.$data.currentValue = event.target.value;
270
- this.$data.valueDuringOnChange = event.target.value;
271
- this.$nextTick(function () {
272
- that.$emit('changemodel', event.target.value);
273
- that.$emit('update:modelValue', event.target.value);
274
- that.$emit('input', {
275
- event: event,
276
- value: event.target.value,
277
- component: that,
278
- target: event.target,
279
- validity: that.validity()
280
- });
281
- that.$data.valueDuringOnChange = undefined;
282
- });
319
+ this.emitUpdate(event, 'input', event.target.value);
283
320
  },
284
321
  handleChange: function handleChange(event) {
322
+ this.emitUpdate(event, 'change', event.target.value);
323
+ },
324
+ emitUpdate: function emitUpdate(event, eventName, value) {
285
325
  var that = this;
286
- this.$data.currentValue = event.target.value;
287
- this.$data.valueDuringOnChange = event.target.value;
326
+
327
+ if (this.disabled) {
328
+ return;
329
+ }
330
+
331
+ this.$data.currentValue = value;
332
+ this.$data.valueDuringOnChange = value;
288
333
  this.$nextTick(function () {
289
- that.$emit('changemodel', event.target.value);
290
- that.$emit('update:modelValue', event.target.value);
291
- that.$emit('change', {
334
+ that.$emit('changemodel', value);
335
+ that.$emit('update:modelValue', value);
336
+ that.$emit(eventName, {
292
337
  event: event,
293
- value: event.target.value,
338
+ value: value,
294
339
  component: that,
295
340
  target: event.target,
296
341
  validity: that.validity()
@@ -331,7 +376,7 @@ var InputVue2 = {
331
376
  return _a = {
332
377
  'k-textbox': true,
333
378
  'k-input': true
334
- }, _a["k-input-" + (kendoThemeMaps.sizeMap[size] || size)] = size, _a["k-input-" + fillMode] = fillMode, _a["k-rounded-" + (kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded, _a['k-invalid'] = !isValid, _a['k-required'] = this.required, _a['k-disabled'] = this.$props.disabled, _a;
379
+ }, _a["k-input-" + (kendoThemeMaps.sizeMap[size] || size)] = size, _a["k-input-" + fillMode] = fillMode, _a["k-rounded-" + (kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded, _a['k-invalid'] = !isValid, _a['k-required'] = this.required, _a['k-disabled'] = this.$props.disabled, _a[this.inputClass] = this.inputClass, _a;
335
380
  }
336
381
  },
337
382
  computed: {
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-vue-inputs',
6
6
  productName: 'Kendo UI for Vue',
7
7
  productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
8
- publishDate: 1653315229,
8
+ publishDate: 1653576328,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
11
11
  };
@@ -89,6 +89,34 @@ export interface InputProps extends FormComponentProps {
89
89
  * Specifies the placeholder of an `input` element. Used to define if the input is empty.
90
90
  */
91
91
  placeholder?: string;
92
+ /**
93
+ * Defines a string prop that controls the input icon.
94
+ */
95
+ iconName: String;
96
+ /**
97
+ * Defines if the inputPrefix will be shown. Accepts a slot name, a `render` function, or a Vue component.
98
+ */
99
+ inputPrefix: Boolean | String | Object | Function;
100
+ /**
101
+ * Defines if the inputSuffix will be shown. Accepts a slot name, a `render` function, or a Vue component.
102
+ */
103
+ inputSuffix: Boolean | String | Object | Function;
104
+ /**
105
+ * Defines a boolean prop that controls whether to show the validation icon. Defaults to 'false'.
106
+ */
107
+ showValidationIcon: Boolean;
108
+ /**
109
+ * Defines a boolean prop that controls whether to show the loading icon. Defaults to 'false'.
110
+ */
111
+ showLoadingIcon: Boolean;
112
+ /**
113
+ * Defines a boolean prop that controls whether to show the clear icon. Defaults to 'false'.
114
+ */
115
+ showClearButton: Boolean;
116
+ /**
117
+ * Defines additional class to the inner input element.
118
+ */
119
+ inputClass: String;
92
120
  }
93
121
  /**
94
122
  * @hidden
@@ -121,7 +149,7 @@ export interface InputMethods {
121
149
  isInvalid: (state: any) => any;
122
150
  setValidity: () => void;
123
151
  handleInput?: () => void;
124
- handleChange?: (event: any) => void;
152
+ handleChange: (event: any) => void;
125
153
  handleKeyup?: (event: any) => void;
126
154
  handleKeydown?: (event: any) => void;
127
155
  handleKeypress?: (event: any) => void;
@@ -110,7 +110,14 @@ var InputVue2 = {
110
110
  validityStyles: {
111
111
  type: Boolean,
112
112
  default: true
113
- }
113
+ },
114
+ iconName: String,
115
+ inputPrefix: kendo_vue_common_1.templateDefinition,
116
+ inputSuffix: kendo_vue_common_1.templateDefinition,
117
+ showValidationIcon: Boolean,
118
+ showLoadingIcon: Boolean,
119
+ showClearButton: Boolean,
120
+ inputClass: String
114
121
  },
115
122
  data: function data() {
116
123
  return {
@@ -149,12 +156,15 @@ var InputVue2 = {
149
156
  var _this = this;
150
157
 
151
158
  var h = gh || createElement;
152
- var listeners = this.v3 ? this.$attrs : this.$listeners;
153
159
  var isValid = !this.$props.validityStyles || this.validity().valid;
154
160
  var _a = this.$props,
155
161
  label = _a.label,
156
162
  id = _a.id,
157
- required = _a.required;
163
+ required = _a.required,
164
+ iconName = _a.iconName,
165
+ showValidationIcon = _a.showValidationIcon,
166
+ showLoadingIcon = _a.showLoadingIcon,
167
+ showClearButton = _a.showClearButton;
158
168
  var inputId = id || this._inputId;
159
169
  var textbox = h('input', __assign(__assign({
160
170
  domProps: this.v3 ? null : __assign(__assign({}, this.$attrs), {
@@ -194,9 +204,47 @@ var InputVue2 = {
194
204
  onAnimationstart: this.handleAutoFill,
195
205
  onAnimationend: this.handleAutoFillEnd
196
206
  }));
207
+ var inputPrefixTemplate = kendo_vue_common_1.templateRendering.call(this, this.$props.inputPrefix, kendo_vue_common_1.getListeners.call(this));
208
+ var inputSuffixTemplate = kendo_vue_common_1.templateRendering.call(this, this.$props.inputSuffix, kendo_vue_common_1.getListeners.call(this));
209
+ var inputPrefix = kendo_vue_common_1.getTemplate.call(this, {
210
+ h: h,
211
+ template: inputPrefixTemplate,
212
+ additionalProps: {
213
+ value: this.computedValue,
214
+ valid: isValid
215
+ }
216
+ });
217
+ var inputSuffix = kendo_vue_common_1.getTemplate.call(this, {
218
+ h: h,
219
+ template: inputSuffixTemplate,
220
+ additionalProps: {
221
+ value: this.computedValue,
222
+ valid: isValid
223
+ }
224
+ });
197
225
  var inputWrapper = h("span", {
198
226
  "class": this.inputWrapperClass()
199
- }, [textbox]);
227
+ }, [iconName && h("span", {
228
+ "class": "k-input-icon k-icon k-i-" + iconName
229
+ }), this.$props.inputPrefix && h("span", {
230
+ "class": "k-input-prefix"
231
+ }, [inputPrefix]), textbox, this.$props.inputSuffix && h("span", {
232
+ "class": "k-input-suffix"
233
+ }, [inputSuffix]), showValidationIcon && isValid && h("span", {
234
+ "class": "k-input-validation-icon k-icon k-i-check"
235
+ }), showValidationIcon && !isValid && h("span", {
236
+ "class": "k-input-validation-icon k-icon k-i-warning"
237
+ }), showLoadingIcon && h("span", {
238
+ "class": "k-input-loading-icon k-icon k-i-loading"
239
+ }), showClearButton && this.computedValue && h("span", {
240
+ onClick: this.clearClick,
241
+ on: this.v3 ? undefined : {
242
+ "click": this.clearClick
243
+ },
244
+ "class": "k-clear-value"
245
+ }, [h("span", {
246
+ "class": "k-icon k-i-x"
247
+ })])]);
200
248
  return label ? // @ts-ignore function children
201
249
  h(kendo_vue_labels_1.FloatingLabel, {
202
250
  label: label,
@@ -237,6 +285,9 @@ var InputVue2 = {
237
285
  handleKeypress: function handleKeypress(e) {
238
286
  this.$emit('keypress', e);
239
287
  },
288
+ clearClick: function clearClick(event) {
289
+ this.emitUpdate(event, 'change', '');
290
+ },
240
291
  focus: function focus() {
241
292
  if (this._input) {
242
293
  this._input.focus();
@@ -276,32 +327,26 @@ var InputVue2 = {
276
327
  }
277
328
  },
278
329
  handleInput: function handleInput(event) {
279
- var that = this;
280
- this.$data.currentValue = event.target.value;
281
- this.$data.valueDuringOnChange = event.target.value;
282
- this.$nextTick(function () {
283
- that.$emit('changemodel', event.target.value);
284
- that.$emit('update:modelValue', event.target.value);
285
- that.$emit('input', {
286
- event: event,
287
- value: event.target.value,
288
- component: that,
289
- target: event.target,
290
- validity: that.validity()
291
- });
292
- that.$data.valueDuringOnChange = undefined;
293
- });
330
+ this.emitUpdate(event, 'input', event.target.value);
294
331
  },
295
332
  handleChange: function handleChange(event) {
333
+ this.emitUpdate(event, 'change', event.target.value);
334
+ },
335
+ emitUpdate: function emitUpdate(event, eventName, value) {
296
336
  var that = this;
297
- this.$data.currentValue = event.target.value;
298
- this.$data.valueDuringOnChange = event.target.value;
337
+
338
+ if (this.disabled) {
339
+ return;
340
+ }
341
+
342
+ this.$data.currentValue = value;
343
+ this.$data.valueDuringOnChange = value;
299
344
  this.$nextTick(function () {
300
- that.$emit('changemodel', event.target.value);
301
- that.$emit('update:modelValue', event.target.value);
302
- that.$emit('change', {
345
+ that.$emit('changemodel', value);
346
+ that.$emit('update:modelValue', value);
347
+ that.$emit(eventName, {
303
348
  event: event,
304
- value: event.target.value,
349
+ value: value,
305
350
  component: that,
306
351
  target: event.target,
307
352
  validity: that.validity()
@@ -342,7 +387,7 @@ var InputVue2 = {
342
387
  return _a = {
343
388
  'k-textbox': true,
344
389
  'k-input': true
345
- }, _a["k-input-" + (kendo_vue_common_1.kendoThemeMaps.sizeMap[size] || size)] = size, _a["k-input-" + fillMode] = fillMode, _a["k-rounded-" + (kendo_vue_common_1.kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded, _a['k-invalid'] = !isValid, _a['k-required'] = this.required, _a['k-disabled'] = this.$props.disabled, _a;
390
+ }, _a["k-input-" + (kendo_vue_common_1.kendoThemeMaps.sizeMap[size] || size)] = size, _a["k-input-" + fillMode] = fillMode, _a["k-rounded-" + (kendo_vue_common_1.kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded, _a['k-invalid'] = !isValid, _a['k-required'] = this.required, _a['k-disabled'] = this.$props.disabled, _a[this.inputClass] = this.inputClass, _a;
346
391
  }
347
392
  },
348
393
  computed: {
@@ -8,7 +8,7 @@ exports.packageMetadata = {
8
8
  name: '@progress/kendo-vue-inputs',
9
9
  productName: 'Kendo UI for Vue',
10
10
  productCodes: ['KENDOUIVUE', 'KENDOUICOMPLETE'],
11
- publishDate: 1653315229,
11
+ publishDate: 1653576328,
12
12
  version: '',
13
13
  licensingDocsUrl: 'https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning'
14
14
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@progress/kendo-vue-inputs",
3
3
  "description": "Kendo UI for Vue Input package",
4
- "version": "3.3.2",
4
+ "version": "3.3.3-dev.202205261455",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/telerik/kendo-vue.git"
@@ -38,21 +38,21 @@
38
38
  "vue": "^2.6.12 || ^3.0.2"
39
39
  },
40
40
  "dependencies": {
41
- "@progress/kendo-vue-buttons": "3.3.2",
42
- "@progress/kendo-vue-common": "3.3.2",
43
- "@progress/kendo-vue-labels": "3.3.2",
44
- "@progress/kendo-vue-popup": "3.3.2"
41
+ "@progress/kendo-vue-buttons": "3.3.3-dev.202205261455",
42
+ "@progress/kendo-vue-common": "3.3.3-dev.202205261455",
43
+ "@progress/kendo-vue-labels": "3.3.3-dev.202205261455",
44
+ "@progress/kendo-vue-popup": "3.3.3-dev.202205261455"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@progress/kendo-data-query": "^1.5.5",
48
48
  "@progress/kendo-date-math": "^1.5.4",
49
49
  "@progress/kendo-drawing": "^1.8.0",
50
50
  "@progress/kendo-licensing": "^1.1.0",
51
- "@progress/kendo-vue-buttons": "3.3.2",
52
- "@progress/kendo-vue-form": "3.3.2",
53
- "@progress/kendo-vue-intl": "3.3.2",
54
- "@progress/kendo-vue-labels": "3.3.2",
55
- "@progress/kendo-vue-tooltip": "3.3.2",
51
+ "@progress/kendo-vue-buttons": "3.3.3-dev.202205261455",
52
+ "@progress/kendo-vue-form": "3.3.3-dev.202205261455",
53
+ "@progress/kendo-vue-intl": "3.3.3-dev.202205261455",
54
+ "@progress/kendo-vue-labels": "3.3.3-dev.202205261455",
55
+ "@progress/kendo-vue-tooltip": "3.3.3-dev.202205261455",
56
56
  "cldr-core": "^34.0.0",
57
57
  "cldr-dates-full": "^34.0.0",
58
58
  "cldr-numbers-full": "^34.0.0"