@progress/kendo-vue-inputs 2.7.0 → 2.7.2-dev.202201020746
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/dist/cdn/js/kendo-vue-inputs.js +1 -1
- package/dist/es/colors/ColorPalette.d.ts +55 -0
- package/dist/es/colors/ColorPalette.js +340 -0
- package/dist/es/colors/ColorPicker.d.ts +52 -0
- package/dist/es/colors/ColorPicker.js +382 -0
- package/dist/es/colors/Picker.d.ts +41 -0
- package/dist/es/colors/Picker.js +94 -0
- package/dist/es/colors/interfaces/ColorPaletteChangeEvent.d.ts +13 -0
- package/dist/es/colors/interfaces/ColorPaletteChangeEvent.js +0 -0
- package/dist/es/colors/interfaces/ColorPaletteProps.d.ts +75 -0
- package/dist/es/colors/interfaces/ColorPaletteProps.js +0 -0
- package/dist/es/colors/interfaces/ColorPickerActiveColorClick.d.ts +13 -0
- package/dist/es/colors/interfaces/ColorPickerActiveColorClick.js +0 -0
- package/dist/es/colors/interfaces/ColorPickerBlurEvent.d.ts +9 -0
- package/dist/es/colors/interfaces/ColorPickerBlurEvent.js +0 -0
- package/dist/es/colors/interfaces/ColorPickerChangeEvent.d.ts +13 -0
- package/dist/es/colors/interfaces/ColorPickerChangeEvent.js +0 -0
- package/dist/es/colors/interfaces/ColorPickerFocusEvent.d.ts +9 -0
- package/dist/es/colors/interfaces/ColorPickerFocusEvent.js +0 -0
- package/dist/es/colors/interfaces/ColorPickerPaletteSettings.d.ts +32 -0
- package/dist/es/colors/interfaces/ColorPickerPaletteSettings.js +0 -0
- package/dist/es/colors/interfaces/ColorPickerPopupSettings.d.ts +14 -0
- package/dist/es/colors/interfaces/ColorPickerPopupSettings.js +0 -0
- package/dist/es/colors/interfaces/ColorPickerProps.d.ts +142 -0
- package/dist/es/colors/interfaces/ColorPickerProps.js +0 -0
- package/dist/es/colors/interfaces/ColorPickerView.d.ts +10 -0
- package/dist/es/colors/interfaces/ColorPickerView.js +0 -0
- package/dist/es/colors/interfaces/PickerPopupSettings.d.ts +14 -0
- package/dist/es/colors/interfaces/PickerPopupSettings.js +0 -0
- package/dist/es/colors/interfaces/PickerProps.d.ts +42 -0
- package/dist/es/colors/interfaces/PickerProps.js +0 -0
- package/dist/es/colors/models/hsva.d.ts +9 -0
- package/dist/es/colors/models/hsva.js +0 -0
- package/dist/es/colors/models/output-format.d.ts +4 -0
- package/dist/es/colors/models/output-format.js +0 -0
- package/dist/es/colors/models/palette-presets.d.ts +53 -0
- package/dist/es/colors/models/palette-presets.js +54 -0
- package/dist/es/colors/models/rgb.d.ts +8 -0
- package/dist/es/colors/models/rgb.js +0 -0
- package/dist/es/colors/models/rgba.d.ts +9 -0
- package/dist/es/colors/models/rgba.js +0 -0
- package/dist/es/colors/models/table-cell.d.ts +7 -0
- package/dist/es/colors/models/table-cell.js +0 -0
- package/dist/es/colors/models/tile-size.d.ts +11 -0
- package/dist/es/colors/models/tile-size.js +0 -0
- package/dist/es/colors/utils/color-cache.d.ts +30 -0
- package/dist/es/colors/utils/color-cache.js +61 -0
- package/dist/es/colors/utils/color-palette.service.d.ts +12 -0
- package/dist/es/colors/utils/color-palette.service.js +76 -0
- package/dist/es/colors/utils/color-parser.d.ts +65 -0
- package/dist/es/colors/utils/color-parser.js +136 -0
- package/dist/es/colors/utils/misc.d.ts +15 -0
- package/dist/es/colors/utils/misc.js +20 -0
- package/dist/es/colors/utils/svg-calc.d.ts +62 -0
- package/dist/es/colors/utils/svg-calc.js +103 -0
- package/dist/es/main.d.ts +15 -0
- package/dist/es/main.js +15 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/switch/Switch.d.ts +131 -0
- package/dist/es/switch/Switch.js +307 -0
- package/dist/es/switch/util.d.ts +8 -0
- package/dist/es/switch/util.js +46 -0
- package/dist/es/textarea/TextArea.d.ts +46 -0
- package/dist/es/textarea/TextArea.js +251 -0
- package/dist/es/textarea/interfaces/TextAreaBlurEvent.d.ts +5 -0
- package/dist/es/textarea/interfaces/TextAreaBlurEvent.js +0 -0
- package/dist/es/textarea/interfaces/TextAreaChangeEvent.d.ts +9 -0
- package/dist/es/textarea/interfaces/TextAreaChangeEvent.js +0 -0
- package/dist/es/textarea/interfaces/TextAreaFocusEvent.d.ts +5 -0
- package/dist/es/textarea/interfaces/TextAreaFocusEvent.js +0 -0
- package/dist/es/textarea/interfaces/TextAreaProps.d.ts +84 -0
- package/dist/es/textarea/interfaces/TextAreaProps.js +0 -0
- package/dist/npm/colors/ColorPalette.d.ts +55 -0
- package/dist/npm/colors/ColorPalette.js +355 -0
- package/dist/npm/colors/ColorPicker.d.ts +52 -0
- package/dist/npm/colors/ColorPicker.js +395 -0
- package/dist/npm/colors/Picker.d.ts +41 -0
- package/dist/npm/colors/Picker.js +105 -0
- package/dist/npm/colors/interfaces/ColorPaletteChangeEvent.d.ts +13 -0
- package/dist/npm/colors/interfaces/ColorPaletteChangeEvent.js +2 -0
- package/dist/npm/colors/interfaces/ColorPaletteProps.d.ts +75 -0
- package/dist/npm/colors/interfaces/ColorPaletteProps.js +2 -0
- package/dist/npm/colors/interfaces/ColorPickerActiveColorClick.d.ts +13 -0
- package/dist/npm/colors/interfaces/ColorPickerActiveColorClick.js +2 -0
- package/dist/npm/colors/interfaces/ColorPickerBlurEvent.d.ts +9 -0
- package/dist/npm/colors/interfaces/ColorPickerBlurEvent.js +2 -0
- package/dist/npm/colors/interfaces/ColorPickerChangeEvent.d.ts +13 -0
- package/dist/npm/colors/interfaces/ColorPickerChangeEvent.js +2 -0
- package/dist/npm/colors/interfaces/ColorPickerFocusEvent.d.ts +9 -0
- package/dist/npm/colors/interfaces/ColorPickerFocusEvent.js +2 -0
- package/dist/npm/colors/interfaces/ColorPickerPaletteSettings.d.ts +32 -0
- package/dist/npm/colors/interfaces/ColorPickerPaletteSettings.js +2 -0
- package/dist/npm/colors/interfaces/ColorPickerPopupSettings.d.ts +14 -0
- package/dist/npm/colors/interfaces/ColorPickerPopupSettings.js +2 -0
- package/dist/npm/colors/interfaces/ColorPickerProps.d.ts +142 -0
- package/dist/npm/colors/interfaces/ColorPickerProps.js +2 -0
- package/dist/npm/colors/interfaces/ColorPickerView.d.ts +10 -0
- package/dist/npm/colors/interfaces/ColorPickerView.js +2 -0
- package/dist/npm/colors/interfaces/PickerPopupSettings.d.ts +14 -0
- package/dist/npm/colors/interfaces/PickerPopupSettings.js +2 -0
- package/dist/npm/colors/interfaces/PickerProps.d.ts +42 -0
- package/dist/npm/colors/interfaces/PickerProps.js +2 -0
- package/dist/npm/colors/models/hsva.d.ts +9 -0
- package/dist/npm/colors/models/hsva.js +2 -0
- package/dist/npm/colors/models/output-format.d.ts +4 -0
- package/dist/npm/colors/models/output-format.js +2 -0
- package/dist/npm/colors/models/palette-presets.d.ts +53 -0
- package/dist/npm/colors/models/palette-presets.js +57 -0
- package/dist/npm/colors/models/rgb.d.ts +8 -0
- package/dist/npm/colors/models/rgb.js +2 -0
- package/dist/npm/colors/models/rgba.d.ts +9 -0
- package/dist/npm/colors/models/rgba.js +2 -0
- package/dist/npm/colors/models/table-cell.d.ts +7 -0
- package/dist/npm/colors/models/table-cell.js +2 -0
- package/dist/npm/colors/models/tile-size.d.ts +11 -0
- package/dist/npm/colors/models/tile-size.js +2 -0
- package/dist/npm/colors/utils/color-cache.d.ts +30 -0
- package/dist/npm/colors/utils/color-cache.js +71 -0
- package/dist/npm/colors/utils/color-palette.service.d.ts +12 -0
- package/dist/npm/colors/utils/color-palette.service.js +79 -0
- package/dist/npm/colors/utils/color-parser.d.ts +65 -0
- package/dist/npm/colors/utils/color-parser.js +139 -0
- package/dist/npm/colors/utils/misc.d.ts +15 -0
- package/dist/npm/colors/utils/misc.js +23 -0
- package/dist/npm/colors/utils/svg-calc.d.ts +62 -0
- package/dist/npm/colors/utils/svg-calc.js +106 -0
- package/dist/npm/main.d.ts +15 -0
- package/dist/npm/main.js +17 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/switch/Switch.d.ts +131 -0
- package/dist/npm/switch/Switch.js +320 -0
- package/dist/npm/switch/util.d.ts +8 -0
- package/dist/npm/switch/util.js +49 -0
- package/dist/npm/textarea/TextArea.d.ts +46 -0
- package/dist/npm/textarea/TextArea.js +261 -0
- package/dist/npm/textarea/interfaces/TextAreaBlurEvent.d.ts +5 -0
- package/dist/npm/textarea/interfaces/TextAreaBlurEvent.js +2 -0
- package/dist/npm/textarea/interfaces/TextAreaChangeEvent.d.ts +9 -0
- package/dist/npm/textarea/interfaces/TextAreaChangeEvent.js +2 -0
- package/dist/npm/textarea/interfaces/TextAreaFocusEvent.d.ts +5 -0
- package/dist/npm/textarea/interfaces/TextAreaFocusEvent.js +2 -0
- package/dist/npm/textarea/interfaces/TextAreaProps.d.ts +84 -0
- package/dist/npm/textarea/interfaces/TextAreaProps.js +5 -0
- package/package.json +13 -7
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
import { guid, noop, Keys, getTabIndex, validatePackage, isRtl } from '@progress/kendo-vue-common';
|
|
6
|
+
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
7
|
+
import { messages, switchValidation } from './../messages';
|
|
8
|
+
import { packageMetadata } from '../package-metadata';
|
|
9
|
+
var SWITCH_CONTAINER = 'k-switch-container';
|
|
10
|
+
var SWITCH_HANDLE = 'k-switch-handle';
|
|
11
|
+
var SWITCH_LABEL_ON = 'k-switch-label-on';
|
|
12
|
+
var SWITCH_LABEL_OFF = 'k-switch-label-off'; // tslint:enable:max-line-length
|
|
13
|
+
|
|
14
|
+
var Switch = {
|
|
15
|
+
name: 'KendoSwitch',
|
|
16
|
+
model: {
|
|
17
|
+
event: 'changemodel'
|
|
18
|
+
},
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
emits: {
|
|
21
|
+
'change': null,
|
|
22
|
+
'changemodel': null,
|
|
23
|
+
'update:modelValue': null,
|
|
24
|
+
'focus': null,
|
|
25
|
+
'blur': null
|
|
26
|
+
},
|
|
27
|
+
props: {
|
|
28
|
+
accessKey: String,
|
|
29
|
+
checked: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: undefined
|
|
32
|
+
},
|
|
33
|
+
className: String,
|
|
34
|
+
disabled: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
defaultChecked: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
dir: String,
|
|
43
|
+
id: String,
|
|
44
|
+
ariaLabelledBy: String,
|
|
45
|
+
ariaDescribedBy: String,
|
|
46
|
+
offLabel: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: 'OFF'
|
|
49
|
+
},
|
|
50
|
+
onLabel: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: 'ON'
|
|
53
|
+
},
|
|
54
|
+
required: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
tabIndex: Number,
|
|
59
|
+
valid: Boolean,
|
|
60
|
+
// validate: {
|
|
61
|
+
// type: Boolean,
|
|
62
|
+
// default: false
|
|
63
|
+
// },
|
|
64
|
+
validityStyles: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: false
|
|
67
|
+
},
|
|
68
|
+
validationMessage: String,
|
|
69
|
+
value: {
|
|
70
|
+
type: [String, Number, Boolean],
|
|
71
|
+
default: undefined
|
|
72
|
+
},
|
|
73
|
+
modelValue: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: undefined
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
created: function created() {
|
|
79
|
+
validatePackage(packageMetadata);
|
|
80
|
+
this._id = guid();
|
|
81
|
+
this.defaultValidationMessage = provideLocalizationService(this);
|
|
82
|
+
},
|
|
83
|
+
data: function data() {
|
|
84
|
+
return {
|
|
85
|
+
currentChecked: this.$props.defaultChecked,
|
|
86
|
+
valueDuringOnChange: undefined,
|
|
87
|
+
focused: false,
|
|
88
|
+
currentDir: undefined
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
computed: {
|
|
92
|
+
computedValue: function computedValue() {
|
|
93
|
+
return this.valueDuringOnChange !== undefined ? this.valueDuringOnChange : this.$props.checked !== undefined ? this.$props.checked : this.$props.value !== undefined ? this.$props.value : this.$props.modelValue !== undefined ? this.$props.modelValue : this.currentChecked;
|
|
94
|
+
},
|
|
95
|
+
switchClassName: function switchClassName() {
|
|
96
|
+
var isValid = !this.validityStyles || this.validity().valid;
|
|
97
|
+
return {
|
|
98
|
+
'k-widget': true,
|
|
99
|
+
'k-switch': true,
|
|
100
|
+
'k-switch-on': this.computedValue,
|
|
101
|
+
'k-switch-off': !this.computedValue,
|
|
102
|
+
'k-state-focused': this.focused,
|
|
103
|
+
'k-state-disabled': this.$props.disabled,
|
|
104
|
+
'k-state-invalid': !isValid
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
mounted: function mounted() {
|
|
109
|
+
this._element = this.v3 ? this.elementRef : this.$refs.element;
|
|
110
|
+
this.input = this.v3 ? this.inputRef : this.$refs.input;
|
|
111
|
+
this.currentDir = this.$props.dir !== undefined ? this.$props.dir : isRtl(this.$el) ? 'rtl' : 'ltr';
|
|
112
|
+
this.setValidity();
|
|
113
|
+
},
|
|
114
|
+
updated: function updated() {
|
|
115
|
+
this.setValidity();
|
|
116
|
+
},
|
|
117
|
+
// @ts-ignore
|
|
118
|
+
setup: !gh ? undefined : function () {
|
|
119
|
+
var v3 = !!gh;
|
|
120
|
+
return {
|
|
121
|
+
v3: v3
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
render: function render(createElement) {
|
|
126
|
+
var _this = this;
|
|
127
|
+
|
|
128
|
+
var h = gh || createElement;
|
|
129
|
+
var _a = this.$props,
|
|
130
|
+
disabled = _a.disabled,
|
|
131
|
+
id = _a.id,
|
|
132
|
+
offLabel = _a.offLabel,
|
|
133
|
+
onLabel = _a.onLabel,
|
|
134
|
+
tabIndex = _a.tabIndex;
|
|
135
|
+
return h("span", {
|
|
136
|
+
"class": this.switchClassName,
|
|
137
|
+
dir: this.currentDir,
|
|
138
|
+
attrs: this.v3 ? undefined : {
|
|
139
|
+
dir: this.currentDir
|
|
140
|
+
},
|
|
141
|
+
onKeydown: this.handleKeyDown,
|
|
142
|
+
on: this.v3 ? undefined : {
|
|
143
|
+
"keydown": this.handleKeyDown,
|
|
144
|
+
"click": this.handleClick,
|
|
145
|
+
"focusout": this.handleWrapperBlur,
|
|
146
|
+
"focusin": this.handleWrapperFocus
|
|
147
|
+
},
|
|
148
|
+
onClick: this.handleClick,
|
|
149
|
+
onFocusout: this.handleWrapperBlur,
|
|
150
|
+
onFocusin: this.handleWrapperFocus
|
|
151
|
+
}, [h("span", {
|
|
152
|
+
"class": SWITCH_CONTAINER,
|
|
153
|
+
id: id || this._id,
|
|
154
|
+
attrs: this.v3 ? undefined : {
|
|
155
|
+
id: id || this._id,
|
|
156
|
+
role: 'switch',
|
|
157
|
+
"aria-checked": this.computedValue,
|
|
158
|
+
"aria-disabled": disabled || undefined,
|
|
159
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
160
|
+
"aria-describedby": this.$props.ariaDescribedBy,
|
|
161
|
+
tabIndex: getTabIndex(tabIndex, disabled, undefined),
|
|
162
|
+
accessKey: this.$props.accessKey
|
|
163
|
+
},
|
|
164
|
+
role: 'switch',
|
|
165
|
+
"aria-checked": this.computedValue,
|
|
166
|
+
"aria-disabled": disabled || undefined,
|
|
167
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
168
|
+
"aria-describedby": this.$props.ariaDescribedBy,
|
|
169
|
+
ref: this.v3 ? function (el) {
|
|
170
|
+
_this.elementRef = el;
|
|
171
|
+
} : 'element',
|
|
172
|
+
tabIndex: getTabIndex(tabIndex, disabled, undefined),
|
|
173
|
+
accessKey: this.$props.accessKey
|
|
174
|
+
}, [h("input", {
|
|
175
|
+
type: "checkbox",
|
|
176
|
+
attrs: this.v3 ? undefined : {
|
|
177
|
+
type: "checkbox",
|
|
178
|
+
tabIndex: -1,
|
|
179
|
+
"aria-hidden": true
|
|
180
|
+
},
|
|
181
|
+
checked: this.v3 ? this.$props.checked : null,
|
|
182
|
+
domProps: this.v3 ? undefined : {
|
|
183
|
+
"checked": this.$props.checked,
|
|
184
|
+
"value": this.computedValue
|
|
185
|
+
},
|
|
186
|
+
ref: this.v3 ? function (el) {
|
|
187
|
+
_this.inputRef = el;
|
|
188
|
+
} : 'input',
|
|
189
|
+
tabIndex: -1,
|
|
190
|
+
"aria-hidden": true,
|
|
191
|
+
value: this.v3 ? this.computedValue : null,
|
|
192
|
+
style: {
|
|
193
|
+
opacity: 0,
|
|
194
|
+
width: 1,
|
|
195
|
+
border: 0,
|
|
196
|
+
zIndex: -1,
|
|
197
|
+
position: 'absolute',
|
|
198
|
+
left: '50%'
|
|
199
|
+
},
|
|
200
|
+
onChange: noop,
|
|
201
|
+
on: this.v3 ? undefined : {
|
|
202
|
+
"change": noop
|
|
203
|
+
}
|
|
204
|
+
}), h("span", {
|
|
205
|
+
"class": SWITCH_LABEL_ON
|
|
206
|
+
}, [onLabel]), h("span", {
|
|
207
|
+
"class": SWITCH_LABEL_OFF
|
|
208
|
+
}, [offLabel]), h("span", {
|
|
209
|
+
"class": SWITCH_HANDLE
|
|
210
|
+
})])]);
|
|
211
|
+
},
|
|
212
|
+
methods: {
|
|
213
|
+
focus: function focus() {
|
|
214
|
+
if (this._element) {
|
|
215
|
+
this._element.focus();
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
element: function element() {
|
|
219
|
+
return this._element;
|
|
220
|
+
},
|
|
221
|
+
name: function name() {
|
|
222
|
+
return this.$props.name;
|
|
223
|
+
},
|
|
224
|
+
validity: function validity() {
|
|
225
|
+
var customError = this.$props.validationMessage !== undefined;
|
|
226
|
+
var isValid = this.$props.valid !== undefined ? this.$props.valid : !this.$props.required ? true : this.computedValue ? true : false;
|
|
227
|
+
var valid = this.$props.valid !== undefined ? this.$props.valid : isValid;
|
|
228
|
+
return {
|
|
229
|
+
customError: customError,
|
|
230
|
+
valid: valid,
|
|
231
|
+
valueMissing: this.computedValue === null
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
setValidity: function setValidity() {
|
|
235
|
+
if (this.input && this.input.setCustomValidity) {
|
|
236
|
+
this.input.setCustomValidity(this.validity().valid ? '' : this.$props.validationMessage || this.defaultValidationMessage.toLanguageString(switchValidation, messages[switchValidation]));
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
limit: function limit(offset, drag, wrapper) {
|
|
240
|
+
var wrapperWidth = wrapper.offsetWidth;
|
|
241
|
+
var margin = drag.offsetWidth;
|
|
242
|
+
|
|
243
|
+
if (offset < 0) {
|
|
244
|
+
return 0;
|
|
245
|
+
} else if (offset > wrapperWidth - margin) {
|
|
246
|
+
return wrapperWidth - margin;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return offset;
|
|
250
|
+
},
|
|
251
|
+
toggle: function toggle(value, event) {
|
|
252
|
+
this.currentChecked = value;
|
|
253
|
+
this.valueDuringOnChange = value;
|
|
254
|
+
this.$emit('change', {
|
|
255
|
+
event: event,
|
|
256
|
+
component: this,
|
|
257
|
+
target: {
|
|
258
|
+
value: value
|
|
259
|
+
},
|
|
260
|
+
name: this.$props.name,
|
|
261
|
+
value: value,
|
|
262
|
+
validity: this.validity()
|
|
263
|
+
});
|
|
264
|
+
this.$emit('changemodel', value);
|
|
265
|
+
this.$emit('update:modelValue', value);
|
|
266
|
+
this.valueDuringOnChange = undefined;
|
|
267
|
+
},
|
|
268
|
+
handleClick: function handleClick(event) {
|
|
269
|
+
if (this.eventTimeStamp === event.timeStamp) {
|
|
270
|
+
// This is guard against the case when wrapped in label, click event is emmited twice
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
this.eventTimeStamp = event.timeStamp;
|
|
275
|
+
this.toggle(!this.computedValue, event);
|
|
276
|
+
},
|
|
277
|
+
handleKeyDown: function handleKeyDown(event) {
|
|
278
|
+
if (this.$props.disabled) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
var keyCode = event.keyCode;
|
|
283
|
+
|
|
284
|
+
if (keyCode === Keys.space || keyCode === Keys.enter) {
|
|
285
|
+
this.toggle(!this.computedValue, event);
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
handleWrapperFocus: function handleWrapperFocus(event) {
|
|
289
|
+
if (this.$props.disabled) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
this.focused = true;
|
|
294
|
+
this.$emit('focus', event);
|
|
295
|
+
},
|
|
296
|
+
handleWrapperBlur: function handleWrapperBlur(event) {
|
|
297
|
+
if (this.$props.disabled) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
this.focused = false;
|
|
302
|
+
this.$emit('blur', event);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
var SwitchVue3 = Switch;
|
|
307
|
+
export { Switch, SwitchVue3 };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export var FRAME_DURATION = 1000 / 60; // 1000ms divided by 60fps
|
|
5
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
export var throttle = function (func, wait, options) {
|
|
9
|
+
if (options === void 0) { options = {}; }
|
|
10
|
+
var timeout, context, args, result;
|
|
11
|
+
var previous = 0;
|
|
12
|
+
options = options || {};
|
|
13
|
+
var later = function () {
|
|
14
|
+
previous = options.leading === false ? 0 : new Date().getTime();
|
|
15
|
+
timeout = null;
|
|
16
|
+
result = func.apply(context, args);
|
|
17
|
+
if (!timeout) {
|
|
18
|
+
context = args = null;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var throttled = function () {
|
|
22
|
+
var now = new Date().getTime();
|
|
23
|
+
if (!previous && options.leading === false) {
|
|
24
|
+
previous = now;
|
|
25
|
+
}
|
|
26
|
+
var remaining = wait - (now - previous);
|
|
27
|
+
context = this;
|
|
28
|
+
args = arguments;
|
|
29
|
+
if (remaining <= 0 || remaining > wait) {
|
|
30
|
+
if (timeout) {
|
|
31
|
+
clearTimeout(timeout);
|
|
32
|
+
timeout = null;
|
|
33
|
+
}
|
|
34
|
+
previous = now;
|
|
35
|
+
result = func.apply(context, args);
|
|
36
|
+
if (!timeout) {
|
|
37
|
+
context = args = null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else if (!timeout && options.trailing !== false) {
|
|
41
|
+
timeout = window.setTimeout(later, remaining);
|
|
42
|
+
}
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
return throttled;
|
|
46
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { DefineComponent } from '../additionalTypes';
|
|
2
|
+
import { RecordPropsDefinition, ComponentOptions } from 'vue/types/options';
|
|
3
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
4
|
+
declare type DefaultMethods<V> = {
|
|
5
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
6
|
+
};
|
|
7
|
+
import { TextAreaProps } from './interfaces/TextAreaProps';
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export interface TextAreaHandle {
|
|
12
|
+
element: HTMLTextAreaElement | null;
|
|
13
|
+
focus: any;
|
|
14
|
+
name?: string | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
export interface TextAreaState {
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export interface TextAreaComputed {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @hidden
|
|
29
|
+
*/
|
|
30
|
+
export interface TextAreaMethods {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
export interface TextAreaData {
|
|
37
|
+
currentActive: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @hidden
|
|
41
|
+
*/
|
|
42
|
+
export interface TextAreaAll extends Vue, TextAreaMethods, TextAreaData, TextAreaComputed, TextAreaState {
|
|
43
|
+
}
|
|
44
|
+
declare let TextArea: ComponentOptions<TextAreaAll, DefaultData<TextAreaData>, DefaultMethods<TextAreaAll>, TextAreaComputed, RecordPropsDefinition<TextAreaProps>>;
|
|
45
|
+
declare const TextAreaVue3: DefineComponent<TextAreaProps, any, TextAreaData, TextAreaComputed, TextAreaMethods, {}, {}, {}, string, TextAreaProps, TextAreaProps, {}>;
|
|
46
|
+
export { TextArea, TextAreaVue3 };
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
|
|
6
|
+
for (var p in s) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
}; // @ts-ignore
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
import * as Vue from 'vue';
|
|
19
|
+
var allVue = Vue;
|
|
20
|
+
var gh = allVue.h;
|
|
21
|
+
import { guid, isRtl, getTabIndex, validatePackage // useDir,
|
|
22
|
+
} from '@progress/kendo-vue-common';
|
|
23
|
+
import { packageMetadata } from '../package-metadata'; // tslint:enable:max-line-length
|
|
24
|
+
|
|
25
|
+
var TextArea = {
|
|
26
|
+
name: 'KendoTextArea',
|
|
27
|
+
inheritAttrs: false,
|
|
28
|
+
model: {
|
|
29
|
+
event: 'changemodel'
|
|
30
|
+
},
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
emits: {
|
|
33
|
+
'input': null,
|
|
34
|
+
'change': null,
|
|
35
|
+
'changemodel': null,
|
|
36
|
+
'update:modelValue': null,
|
|
37
|
+
'focus': null,
|
|
38
|
+
'blur': null
|
|
39
|
+
},
|
|
40
|
+
props: {
|
|
41
|
+
ariaDescribedBy: String,
|
|
42
|
+
ariaLabelledBy: String,
|
|
43
|
+
autoSize: Boolean,
|
|
44
|
+
modelValue: {
|
|
45
|
+
type: [String, Array, Number],
|
|
46
|
+
default: undefined
|
|
47
|
+
},
|
|
48
|
+
defaultValue: [String, Number],
|
|
49
|
+
dir: String,
|
|
50
|
+
disabled: Boolean,
|
|
51
|
+
readOnly: Boolean,
|
|
52
|
+
rows: Number,
|
|
53
|
+
id: String,
|
|
54
|
+
name: String,
|
|
55
|
+
required: Boolean,
|
|
56
|
+
placeholder: String,
|
|
57
|
+
tabIndex: Number,
|
|
58
|
+
valid: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: undefined
|
|
61
|
+
},
|
|
62
|
+
value: [String, Array, Number],
|
|
63
|
+
validityStyles: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: true
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
created: function created() {
|
|
69
|
+
validatePackage(packageMetadata);
|
|
70
|
+
this.calculatedId = guid();
|
|
71
|
+
},
|
|
72
|
+
computed: {
|
|
73
|
+
rootClassName: function rootClassName() {
|
|
74
|
+
return {
|
|
75
|
+
'k-textarea': true,
|
|
76
|
+
'k-state-invalid': this.validityStyles === true ? !this.isValid : false,
|
|
77
|
+
'k-state-disabled': this.$props.disabled
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
computedValue: function computedValue() {
|
|
81
|
+
return this.$props.value !== undefined ? this.$props.value : this.$props.modelValue !== undefined ? this.$props.modelValue : this.currentValue;
|
|
82
|
+
},
|
|
83
|
+
isValid: function isValid() {
|
|
84
|
+
return this.valid !== undefined ? this.valid : !this.required ? true : this.computedValue ? true : false;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
data: function data() {
|
|
88
|
+
return {
|
|
89
|
+
currentValue: this.$props.defaultValue,
|
|
90
|
+
textAreaHeight: 'auto',
|
|
91
|
+
currentDir: 'ltr'
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
mounted: function mounted() {
|
|
95
|
+
this.element = this.v3 ? this.elementRef : this.$refs.element;
|
|
96
|
+
this.currentDir = this.$props.dir !== undefined ? this.$props.dir : isRtl(this.$el) ? 'rtl' : 'ltr';
|
|
97
|
+
this.setValidity();
|
|
98
|
+
},
|
|
99
|
+
updated: function updated() {
|
|
100
|
+
this.element = this.v3 ? this.elementRef : this.$refs.element;
|
|
101
|
+
this.setValidity();
|
|
102
|
+
},
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
setup: !gh ? undefined : function () {
|
|
105
|
+
var v3 = !!gh;
|
|
106
|
+
return {
|
|
107
|
+
v3: v3
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
// @ts-ignore
|
|
111
|
+
render: function render(createElement) {
|
|
112
|
+
var _this = this;
|
|
113
|
+
|
|
114
|
+
var h = gh || createElement;
|
|
115
|
+
var _a = this.$props,
|
|
116
|
+
ariaDescribedBy = _a.ariaDescribedBy,
|
|
117
|
+
ariaLabelledBy = _a.ariaLabelledBy,
|
|
118
|
+
autoSize = _a.autoSize,
|
|
119
|
+
disabled = _a.disabled,
|
|
120
|
+
readOnly = _a.readOnly,
|
|
121
|
+
required = _a.required,
|
|
122
|
+
rows = _a.rows,
|
|
123
|
+
id = _a.id,
|
|
124
|
+
name = _a.name,
|
|
125
|
+
placeholder = _a.placeholder,
|
|
126
|
+
tabIndex = _a.tabIndex;
|
|
127
|
+
|
|
128
|
+
var textAreaAttrs = __assign({
|
|
129
|
+
id: id || this.calculatedId,
|
|
130
|
+
name: name,
|
|
131
|
+
disabled: disabled,
|
|
132
|
+
rows: rows,
|
|
133
|
+
placeholder: placeholder,
|
|
134
|
+
readOnly: readOnly,
|
|
135
|
+
required: required,
|
|
136
|
+
tabIndex: getTabIndex(tabIndex, disabled),
|
|
137
|
+
'aria-labelledby': ariaLabelledBy,
|
|
138
|
+
'aria-describedby': ariaDescribedBy,
|
|
139
|
+
'aria-multiline': true,
|
|
140
|
+
'aria-disabled': disabled || undefined
|
|
141
|
+
}, this.$attrs);
|
|
142
|
+
|
|
143
|
+
var textarea = h('textarea', __assign(__assign({}, textAreaAttrs), {
|
|
144
|
+
attrs: this.v3 ? undefined : textAreaAttrs,
|
|
145
|
+
'class': 'k-input',
|
|
146
|
+
ref: this.v3 ? function (el) {
|
|
147
|
+
_this.elementRef = el;
|
|
148
|
+
} : 'element',
|
|
149
|
+
style: autoSize ? {
|
|
150
|
+
resize: 'none',
|
|
151
|
+
overflow: 'hidden',
|
|
152
|
+
height: this.textAreaHeight
|
|
153
|
+
} : {},
|
|
154
|
+
value: this.v3 ? this.computedValue : null,
|
|
155
|
+
domProps: this.v3 ? undefined : {
|
|
156
|
+
'value': this.computedValue
|
|
157
|
+
},
|
|
158
|
+
onChange: this.handleChange,
|
|
159
|
+
onInput: this.handleInput,
|
|
160
|
+
on: this.v3 ? undefined : {
|
|
161
|
+
'change': this.handleChange,
|
|
162
|
+
'focus': this.handleFocus,
|
|
163
|
+
'blur': this.handleBlur,
|
|
164
|
+
input: this.handleInput
|
|
165
|
+
},
|
|
166
|
+
onFocus: this.handleFocus,
|
|
167
|
+
onBlur: this.handleBlur
|
|
168
|
+
}));
|
|
169
|
+
return h("span", {
|
|
170
|
+
"class": this.rootClassName,
|
|
171
|
+
dir: this.currentDir,
|
|
172
|
+
attrs: this.v3 ? undefined : {
|
|
173
|
+
dir: this.currentDir
|
|
174
|
+
}
|
|
175
|
+
}, [textarea]);
|
|
176
|
+
},
|
|
177
|
+
methods: {
|
|
178
|
+
setValidity: function setValidity() {
|
|
179
|
+
if (this.element && this.element.setCustomValidity) {
|
|
180
|
+
this.element.setCustomValidity(this.isValid ? '' : this.validationMessage || '');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (this.element) {
|
|
184
|
+
this.textAreaHeight = this.element.scrollHeight + "px";
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
focus: function focus() {
|
|
188
|
+
if (this.element) {
|
|
189
|
+
this.element.focus();
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
handleChange: function handleChange(event) {
|
|
193
|
+
var newValue = event.target.value;
|
|
194
|
+
|
|
195
|
+
if (!this.$props.disabled) {
|
|
196
|
+
this.textAreaHeight = 'auto';
|
|
197
|
+
this.currentValue = newValue;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (!this.$props.disabled) {
|
|
201
|
+
this.$emit('change', {
|
|
202
|
+
event: event,
|
|
203
|
+
component: this,
|
|
204
|
+
name: this.element.name,
|
|
205
|
+
value: newValue
|
|
206
|
+
});
|
|
207
|
+
this.$emit('changemodel', newValue);
|
|
208
|
+
this.$emit('update:modelValue', newValue);
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
handleInput: function handleInput(event) {
|
|
212
|
+
var newValue = event.target.value;
|
|
213
|
+
|
|
214
|
+
if (!this.$props.disabled) {
|
|
215
|
+
this.textAreaHeight = 'auto';
|
|
216
|
+
this.currentValue = newValue;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (!this.$props.disabled) {
|
|
220
|
+
this.$emit('input', {
|
|
221
|
+
event: event,
|
|
222
|
+
component: this,
|
|
223
|
+
name: this.element.name,
|
|
224
|
+
value: newValue
|
|
225
|
+
});
|
|
226
|
+
this.$emit('changemodel', newValue);
|
|
227
|
+
this.$emit('update:modelValue', newValue);
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
handleFocus: function handleFocus(event) {
|
|
231
|
+
if (!this.$props.disabled) {
|
|
232
|
+
this.$emit('focus', {
|
|
233
|
+
event: event,
|
|
234
|
+
component: this,
|
|
235
|
+
name: this.element.name
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
handleBlur: function handleBlur(event) {
|
|
240
|
+
if (!this.$props.disabled) {
|
|
241
|
+
this.$emit('blur', {
|
|
242
|
+
event: event,
|
|
243
|
+
component: this,
|
|
244
|
+
name: this.element.name
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
var TextAreaVue3 = TextArea;
|
|
251
|
+
export { TextArea, TextAreaVue3 };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|