@progress/kendo-vue-inputs 3.4.3 → 3.4.5-dev.202207300828
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/checkbox/Checkbox.js +3 -3
- package/dist/es/colors/ColorContrastLabels.js +8 -4
- package/dist/es/colors/ColorContrastSvg.js +65 -44
- package/dist/es/colors/ColorGradient.d.ts +3 -1
- package/dist/es/colors/ColorGradient.js +160 -57
- package/dist/es/colors/ColorInput.d.ts +3 -0
- package/dist/es/colors/ColorInput.js +82 -58
- package/dist/es/colors/ColorPalette.js +31 -17
- package/dist/es/colors/ColorPicker.d.ts +1 -0
- package/dist/es/colors/ColorPicker.js +90 -70
- package/dist/es/colors/FlatColorPicker.d.ts +41 -5
- package/dist/es/colors/FlatColorPicker.js +307 -110
- package/dist/es/colors/HexInput.d.ts +1 -0
- package/dist/es/colors/HexInput.js +33 -13
- package/dist/es/colors/Picker.js +20 -12
- package/dist/es/colors/interfaces/ColorGradientChangeEvent.d.ts +4 -0
- package/dist/es/colors/interfaces/ColorGradientProps.d.ts +12 -0
- package/dist/es/colors/interfaces/ColorPaletteChangeEvent.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPaletteProps.d.ts +8 -3
- package/dist/es/colors/interfaces/ColorPickerActiveColorClick.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPickerBlurEvent.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPickerChangeEvent.d.ts +4 -3
- package/dist/es/colors/interfaces/ColorPickerFocusEvent.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPickerPaletteSettings.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPickerPopupSettings.d.ts +0 -3
- package/dist/es/colors/interfaces/ColorPickerProps.d.ts +30 -4
- package/dist/es/colors/interfaces/ColorPickerView.d.ts +0 -3
- package/dist/es/colors/interfaces/FlatColorPickerViewChangeEvent.d.ts +13 -0
- package/dist/es/colors/interfaces/FlatColorPickerViewChangeEvent.js +0 -0
- package/dist/es/colors/interfaces/PickerProps.d.ts +4 -0
- package/dist/es/colors/utils/color-cache.d.ts +13 -0
- package/dist/es/colors/utils/color-cache.js +14 -0
- package/dist/es/colors/utils/color-parser.d.ts +7 -1
- package/dist/es/colors/utils/color-parser.js +11 -2
- package/dist/es/input/Input.d.ts +4 -0
- package/dist/es/input/Input.js +9 -4
- package/dist/es/input-separator/InputSeparator.js +1 -1
- package/dist/es/maskedtextbox/MaskedTextBox.js +1 -1
- package/dist/es/messages/index.d.ts +45 -0
- package/dist/es/messages/index.js +46 -0
- package/dist/es/numerictextbox/NumericTextBox.js +4 -1
- package/dist/es/numerictextbox/interfaces/NumericTextBoxProps.d.ts +4 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/RadioButton.js +2 -2
- package/dist/es/radiobutton/RadioGroup.js +2 -2
- package/dist/es/range-slider/RangeSlider.js +2 -2
- package/dist/es/slider/Slider.js +3 -3
- package/dist/es/slider/SliderLabel.js +1 -1
- package/dist/es/switch/Switch.js +1 -1
- package/dist/es/textarea/TextArea.js +1 -1
- package/dist/npm/checkbox/Checkbox.js +3 -3
- package/dist/npm/colors/ColorContrastLabels.js +8 -4
- package/dist/npm/colors/ColorContrastSvg.js +65 -44
- package/dist/npm/colors/ColorGradient.d.ts +3 -1
- package/dist/npm/colors/ColorGradient.js +161 -56
- package/dist/npm/colors/ColorInput.d.ts +3 -0
- package/dist/npm/colors/ColorInput.js +82 -57
- package/dist/npm/colors/ColorPalette.js +31 -17
- package/dist/npm/colors/ColorPicker.d.ts +1 -0
- package/dist/npm/colors/ColorPicker.js +91 -71
- package/dist/npm/colors/FlatColorPicker.d.ts +41 -5
- package/dist/npm/colors/FlatColorPicker.js +307 -107
- package/dist/npm/colors/HexInput.d.ts +1 -0
- package/dist/npm/colors/HexInput.js +31 -11
- package/dist/npm/colors/Picker.js +19 -11
- package/dist/npm/colors/interfaces/ColorGradientChangeEvent.d.ts +4 -0
- package/dist/npm/colors/interfaces/ColorGradientProps.d.ts +12 -0
- package/dist/npm/colors/interfaces/ColorPaletteChangeEvent.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPaletteProps.d.ts +8 -3
- package/dist/npm/colors/interfaces/ColorPickerActiveColorClick.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPickerBlurEvent.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPickerChangeEvent.d.ts +4 -3
- package/dist/npm/colors/interfaces/ColorPickerFocusEvent.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPickerPaletteSettings.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPickerPopupSettings.d.ts +0 -3
- package/dist/npm/colors/interfaces/ColorPickerProps.d.ts +30 -4
- package/dist/npm/colors/interfaces/ColorPickerView.d.ts +0 -3
- package/dist/npm/colors/interfaces/FlatColorPickerViewChangeEvent.d.ts +13 -0
- package/dist/npm/colors/interfaces/FlatColorPickerViewChangeEvent.js +2 -0
- package/dist/npm/colors/interfaces/PickerProps.d.ts +4 -0
- package/dist/npm/colors/utils/color-cache.d.ts +13 -0
- package/dist/npm/colors/utils/color-cache.js +15 -1
- package/dist/npm/colors/utils/color-parser.d.ts +7 -1
- package/dist/npm/colors/utils/color-parser.js +12 -3
- package/dist/npm/input/Input.d.ts +4 -0
- package/dist/npm/input/Input.js +9 -4
- package/dist/npm/input-separator/InputSeparator.js +1 -1
- package/dist/npm/maskedtextbox/MaskedTextBox.js +1 -1
- package/dist/npm/messages/index.d.ts +45 -0
- package/dist/npm/messages/index.js +47 -1
- package/dist/npm/numerictextbox/NumericTextBox.js +4 -1
- package/dist/npm/numerictextbox/interfaces/NumericTextBoxProps.d.ts +4 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/RadioButton.js +2 -2
- package/dist/npm/radiobutton/RadioGroup.js +2 -2
- package/dist/npm/range-slider/RangeSlider.js +2 -2
- package/dist/npm/slider/Slider.js +3 -3
- package/dist/npm/slider/SliderLabel.js +1 -1
- package/dist/npm/switch/Switch.js +1 -1
- package/dist/npm/textarea/TextArea.js +1 -1
- package/package.json +11 -11
|
@@ -1,34 +1,70 @@
|
|
|
1
|
-
|
|
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
|
+
|
|
2
18
|
import * as Vue from 'vue';
|
|
3
19
|
var allVue = Vue;
|
|
4
20
|
var gh = allVue.h;
|
|
5
|
-
var isV3 = allVue.version[0] === '3';
|
|
6
|
-
import { classNames, validatePackage, getTabIndex } from '@progress/kendo-vue-common';
|
|
21
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
22
|
+
import { classNames, validatePackage, getTabIndex, setRef, focusContainer, focusFirstFocusableChild, Keys, templateRendering, getListeners, getTemplate } from '@progress/kendo-vue-common';
|
|
7
23
|
import { ButtonGroup, Button } from '@progress/kendo-vue-buttons';
|
|
8
24
|
import { ColorPalette } from './ColorPalette';
|
|
9
25
|
import { ColorGradient } from './ColorGradient';
|
|
10
26
|
import { packageMetadata } from '../package-metadata';
|
|
11
|
-
import { messages, flatColorPickerApplyBtn, flatColorPickerCancelBtn } from '../messages';
|
|
27
|
+
import { messages, flatColorPickerApplyBtn, flatColorPickerCancelBtn, flatColorPickerGradientBtn, flatColorPickerPaletteBtn, flatColorPickerClearBtn } from '../messages';
|
|
28
|
+
import { parseColor } from './utils/color-parser';
|
|
29
|
+
import { DEFAULT_GRADIENT_SETTINGS, DEFAULT_PALETTE_SETTINGS } from './utils/color-cache';
|
|
30
|
+
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
12
31
|
/**
|
|
13
32
|
* @hidden
|
|
14
33
|
*/
|
|
15
34
|
|
|
16
35
|
var FlatColorPickerVue2 = {
|
|
17
36
|
name: 'KendoFlatColorPicker',
|
|
18
|
-
|
|
19
|
-
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
emits: {
|
|
39
|
+
'viewchange': null,
|
|
40
|
+
'changemodel': null,
|
|
41
|
+
'update:modelValue': null,
|
|
42
|
+
'update:modelRgbaValue': null,
|
|
43
|
+
'focus': null,
|
|
44
|
+
'blur': null,
|
|
45
|
+
'keydown': null,
|
|
46
|
+
'change': null
|
|
20
47
|
},
|
|
21
48
|
props: {
|
|
49
|
+
modelValue: String,
|
|
50
|
+
modelRgbaValue: String,
|
|
22
51
|
value: String,
|
|
52
|
+
prevValue: String,
|
|
23
53
|
tabIndex: Number,
|
|
24
54
|
disabled: Boolean,
|
|
25
55
|
view: {
|
|
26
56
|
type: String,
|
|
57
|
+
default: 'combo',
|
|
27
58
|
validator: function validator(value) {
|
|
28
|
-
return ['
|
|
59
|
+
return ['gradient', 'palette', 'combo'].includes(value);
|
|
29
60
|
}
|
|
30
61
|
},
|
|
31
|
-
|
|
62
|
+
selectedView: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: undefined
|
|
65
|
+
},
|
|
66
|
+
header: [String, Function, Object],
|
|
67
|
+
footer: [String, Function, Object],
|
|
32
68
|
showClearButton: {
|
|
33
69
|
type: Boolean,
|
|
34
70
|
default: true
|
|
@@ -40,18 +76,63 @@ var FlatColorPickerVue2 = {
|
|
|
40
76
|
showButtons: {
|
|
41
77
|
type: Boolean,
|
|
42
78
|
default: true
|
|
79
|
+
},
|
|
80
|
+
gradientSettings: {
|
|
81
|
+
type: Object,
|
|
82
|
+
default: function _default() {
|
|
83
|
+
return DEFAULT_GRADIENT_SETTINGS;
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
paletteSettings: {
|
|
87
|
+
type: Object,
|
|
88
|
+
default: function _default() {
|
|
89
|
+
return DEFAULT_PALETTE_SETTINGS;
|
|
90
|
+
}
|
|
43
91
|
}
|
|
44
92
|
},
|
|
93
|
+
inject: {
|
|
94
|
+
kendoLocalizationService: {
|
|
95
|
+
default: null
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
created: function created() {
|
|
99
|
+
validatePackage(packageMetadata);
|
|
100
|
+
},
|
|
45
101
|
computed: {
|
|
46
102
|
isColorGradient: function isColorGradient() {
|
|
47
|
-
return this.view ? this.view === '
|
|
103
|
+
return this.view !== 'combo' ? this.view === 'gradient' : this.selectedView !== undefined ? this.selectedView === 0 : this.currentView === 'gradient';
|
|
104
|
+
},
|
|
105
|
+
computedColor: function computedColor() {
|
|
106
|
+
return this.value !== undefined ? this.value : this.modelValue !== undefined ? this.modelValue : this.modelRgbaValue !== undefined ? this.modelRgbaValue : this.colorValue;
|
|
107
|
+
},
|
|
108
|
+
computedPrevColor: function computedPrevColor() {
|
|
109
|
+
return this.prevValue !== undefined ? this.prevValue : this.currentPrevColor;
|
|
110
|
+
},
|
|
111
|
+
previewClass: function previewClass() {
|
|
112
|
+
return {
|
|
113
|
+
'k-coloreditor-preview-color': true,
|
|
114
|
+
'k-color-preview': true,
|
|
115
|
+
'k-no-color': !this.colorValue
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
currentClass: function currentClass() {
|
|
119
|
+
return {
|
|
120
|
+
'k-coloreditor-current-color': true,
|
|
121
|
+
'k-color-preview': true,
|
|
122
|
+
'k-no-color': !this.computedPrevColor
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
computedTabIndex: function computedTabIndex() {
|
|
126
|
+
return this.focused ? 0 : -1;
|
|
48
127
|
}
|
|
49
128
|
},
|
|
50
129
|
data: function data() {
|
|
130
|
+
var initialValue = this.value || this.defaultValue || this.modelValue || this.modelRgbaValue;
|
|
51
131
|
return {
|
|
52
|
-
currentView: '
|
|
53
|
-
colorValue:
|
|
54
|
-
|
|
132
|
+
currentView: 'gradient',
|
|
133
|
+
colorValue: initialValue,
|
|
134
|
+
currentPrevColor: initialValue,
|
|
135
|
+
focused: false
|
|
55
136
|
};
|
|
56
137
|
},
|
|
57
138
|
// @ts-ignore
|
|
@@ -68,43 +149,110 @@ var FlatColorPickerVue2 = {
|
|
|
68
149
|
var _this = this;
|
|
69
150
|
|
|
70
151
|
var h = gh || createElement;
|
|
152
|
+
var localizationService = provideLocalizationService(this);
|
|
153
|
+
var gradientMessage = localizationService.toLanguageString(flatColorPickerGradientBtn, messages[flatColorPickerGradientBtn]);
|
|
154
|
+
var paletteMessage = localizationService.toLanguageString(flatColorPickerPaletteBtn, messages[flatColorPickerPaletteBtn]);
|
|
155
|
+
var clearMessage = localizationService.toLanguageString(flatColorPickerClearBtn, messages[flatColorPickerClearBtn]);
|
|
156
|
+
var cancelMessage = localizationService.toLanguageString(flatColorPickerCancelBtn, messages[flatColorPickerCancelBtn]);
|
|
157
|
+
var applyMessage = localizationService.toLanguageString(flatColorPickerApplyBtn, messages[flatColorPickerApplyBtn]);
|
|
158
|
+
var headerTemplate = templateRendering.call(this, this.$props.header, getListeners.call(this));
|
|
159
|
+
var footerTemplate = templateRendering.call(this, this.$props.footer, getListeners.call(this));
|
|
160
|
+
var header = getTemplate.call(this, {
|
|
161
|
+
h: h,
|
|
162
|
+
template: headerTemplate
|
|
163
|
+
});
|
|
164
|
+
var footer = getTemplate.call(this, {
|
|
165
|
+
h: h,
|
|
166
|
+
template: footerTemplate
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
var renderGradiente = function renderGradiente() {
|
|
170
|
+
return h(ColorGradient, __assign({
|
|
171
|
+
attrs: this.v3 ? undefined : __assign({
|
|
172
|
+
tabIndex: -1,
|
|
173
|
+
value: this.colorValue,
|
|
174
|
+
innerTabIndex: this.computedTabIndex
|
|
175
|
+
}, this.gradientSettings),
|
|
176
|
+
ref: setRef(this, 'gradient'),
|
|
177
|
+
tabIndex: -1,
|
|
178
|
+
value: this.colorValue,
|
|
179
|
+
innerTabIndex: this.computedTabIndex,
|
|
180
|
+
onChange: this.handleColorChange,
|
|
181
|
+
onKeydown: this.innerKeyDown,
|
|
182
|
+
on: this.v3 ? undefined : {
|
|
183
|
+
'change': this.handleColorChange,
|
|
184
|
+
'keydown': this.innerKeyDown
|
|
185
|
+
}
|
|
186
|
+
}, this.gradientSettings));
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
var renderPalette = function renderPalette() {
|
|
190
|
+
return h(ColorPalette, __assign({
|
|
191
|
+
on: this.v3 ? undefined : {
|
|
192
|
+
'change': this.handlePaletteColorChange,
|
|
193
|
+
'keydown': this.gradientKeyDown
|
|
194
|
+
},
|
|
195
|
+
ref: setRef(this, 'palette'),
|
|
196
|
+
tabIndex: this.computedTabIndex,
|
|
197
|
+
value: this.colorValue,
|
|
198
|
+
attrs: this.v3 ? undefined : __assign({
|
|
199
|
+
tabIndex: this.computedTabIndex,
|
|
200
|
+
value: this.colorValue
|
|
201
|
+
}, this.paletteSettings),
|
|
202
|
+
onChange: this.handlePaletteColorChange,
|
|
203
|
+
onKeydown: this.gradientKeyDown
|
|
204
|
+
}, this.paletteSettings));
|
|
205
|
+
};
|
|
206
|
+
|
|
71
207
|
return h("div", {
|
|
72
208
|
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
73
209
|
attrs: this.v3 ? undefined : {
|
|
74
|
-
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled)
|
|
210
|
+
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
211
|
+
"aria-disabled": this.$props.disabled
|
|
212
|
+
},
|
|
213
|
+
onFocusin: this.onFocus,
|
|
214
|
+
on: this.v3 ? undefined : {
|
|
215
|
+
"focusin": this.onFocus,
|
|
216
|
+
"focusout": this.onBlur,
|
|
217
|
+
"keydown": this.onKeyDownHandler
|
|
75
218
|
},
|
|
219
|
+
onFocusout: this.onBlur,
|
|
220
|
+
onKeydown: this.onKeyDownHandler,
|
|
76
221
|
"class": classNames('k-flatcolorpicker k-coloreditor', {
|
|
77
222
|
'k-disabled': this.$props.disabled
|
|
78
223
|
}),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"blur": this.handleFlatColorPickerBlur
|
|
82
|
-
}
|
|
83
|
-
}, [this.$props.header || h("div", {
|
|
224
|
+
"aria-disabled": this.$props.disabled
|
|
225
|
+
}, [header, this.$props.showClearButton && this.$props.showPreview && h("div", {
|
|
84
226
|
"class": "k-coloreditor-header k-hstack"
|
|
85
|
-
}, [h("div", {
|
|
227
|
+
}, [this.$props.view === 'combo' && h("div", {
|
|
86
228
|
"class": "k-coloreditor-header-actions k-hstack"
|
|
87
229
|
}, [// @ts-ignore function children
|
|
88
230
|
h(ButtonGroup, this.v3 ? function () {
|
|
89
231
|
return [// @ts-ignore function children
|
|
90
232
|
h(Button, {
|
|
91
|
-
|
|
233
|
+
tabIndex: _this2.computedTabIndex,
|
|
92
234
|
attrs: _this2.v3 ? undefined : {
|
|
235
|
+
tabIndex: _this2.computedTabIndex,
|
|
93
236
|
type: "button",
|
|
94
237
|
togglable: true,
|
|
95
238
|
fillMode: 'flat',
|
|
96
|
-
selected: _this2.isColorGradient
|
|
239
|
+
selected: _this2.isColorGradient,
|
|
240
|
+
ariaLabel: gradientMessage
|
|
97
241
|
},
|
|
242
|
+
type: "button",
|
|
98
243
|
togglable: true,
|
|
99
244
|
fillMode: 'flat',
|
|
100
245
|
selected: _this2.isColorGradient,
|
|
101
|
-
|
|
102
|
-
return _this.handleViewChange(e, 'ColorGradient');
|
|
103
|
-
},
|
|
246
|
+
onKeydown: _this2.handleButtonKeydown,
|
|
104
247
|
on: _this2.v3 ? undefined : {
|
|
105
|
-
"
|
|
106
|
-
|
|
248
|
+
"keydown": _this2.handleButtonKeydown,
|
|
249
|
+
"click": function click(e) {
|
|
250
|
+
return _this.handleViewChange(e, 'gradient');
|
|
107
251
|
}
|
|
252
|
+
},
|
|
253
|
+
ariaLabel: gradientMessage,
|
|
254
|
+
onClick: function click(e) {
|
|
255
|
+
return _this.handleViewChange(e, 'gradient');
|
|
108
256
|
}
|
|
109
257
|
}, _this2.v3 ? function () {
|
|
110
258
|
return [h("span", {
|
|
@@ -114,23 +262,29 @@ var FlatColorPickerVue2 = {
|
|
|
114
262
|
"class": "k-icon k-i-color-canvas"
|
|
115
263
|
})]), // @ts-ignore function children
|
|
116
264
|
h(Button, {
|
|
117
|
-
|
|
265
|
+
tabIndex: _this2.computedTabIndex,
|
|
118
266
|
attrs: _this2.v3 ? undefined : {
|
|
267
|
+
tabIndex: _this2.computedTabIndex,
|
|
119
268
|
type: "button",
|
|
120
269
|
togglable: true,
|
|
121
270
|
fillMode: 'flat',
|
|
122
|
-
selected: !_this2.isColorGradient
|
|
271
|
+
selected: !_this2.isColorGradient,
|
|
272
|
+
ariaLabel: paletteMessage
|
|
123
273
|
},
|
|
274
|
+
type: "button",
|
|
124
275
|
togglable: true,
|
|
125
276
|
fillMode: 'flat',
|
|
126
277
|
selected: !_this2.isColorGradient,
|
|
127
|
-
|
|
128
|
-
return _this.handleViewChange(e, 'ColorPalette');
|
|
129
|
-
},
|
|
278
|
+
onKeydown: _this2.handleButtonKeydown,
|
|
130
279
|
on: _this2.v3 ? undefined : {
|
|
131
|
-
"
|
|
132
|
-
|
|
280
|
+
"keydown": _this2.handleButtonKeydown,
|
|
281
|
+
"click": function click(e) {
|
|
282
|
+
return _this.handleViewChange(e, 'palette');
|
|
133
283
|
}
|
|
284
|
+
},
|
|
285
|
+
ariaLabel: paletteMessage,
|
|
286
|
+
onClick: function click(e) {
|
|
287
|
+
return _this.handleViewChange(e, 'palette');
|
|
134
288
|
}
|
|
135
289
|
}, _this2.v3 ? function () {
|
|
136
290
|
return [h("span", {
|
|
@@ -140,23 +294,29 @@ var FlatColorPickerVue2 = {
|
|
|
140
294
|
"class": "k-icon k-i-palette"
|
|
141
295
|
})])];
|
|
142
296
|
} : [h(Button, {
|
|
143
|
-
|
|
297
|
+
tabIndex: _this2.computedTabIndex,
|
|
144
298
|
attrs: _this2.v3 ? undefined : {
|
|
299
|
+
tabIndex: _this2.computedTabIndex,
|
|
145
300
|
type: "button",
|
|
146
301
|
togglable: true,
|
|
147
302
|
fillMode: 'flat',
|
|
148
|
-
selected: _this2.isColorGradient
|
|
303
|
+
selected: _this2.isColorGradient,
|
|
304
|
+
ariaLabel: gradientMessage
|
|
149
305
|
},
|
|
306
|
+
type: "button",
|
|
150
307
|
togglable: true,
|
|
151
308
|
fillMode: 'flat',
|
|
152
309
|
selected: _this2.isColorGradient,
|
|
153
|
-
|
|
154
|
-
return _this.handleViewChange(e, 'ColorGradient');
|
|
155
|
-
},
|
|
310
|
+
onKeydown: _this2.handleButtonKeydown,
|
|
156
311
|
on: _this2.v3 ? undefined : {
|
|
157
|
-
"
|
|
158
|
-
|
|
312
|
+
"keydown": _this2.handleButtonKeydown,
|
|
313
|
+
"click": function click(e) {
|
|
314
|
+
return _this.handleViewChange(e, 'gradient');
|
|
159
315
|
}
|
|
316
|
+
},
|
|
317
|
+
ariaLabel: gradientMessage,
|
|
318
|
+
onClick: function click(e) {
|
|
319
|
+
return _this.handleViewChange(e, 'gradient');
|
|
160
320
|
}
|
|
161
321
|
}, _this2.v3 ? function () {
|
|
162
322
|
return [h("span", {
|
|
@@ -165,23 +325,29 @@ var FlatColorPickerVue2 = {
|
|
|
165
325
|
} : [h("span", {
|
|
166
326
|
"class": "k-icon k-i-color-canvas"
|
|
167
327
|
})]), h(Button, {
|
|
168
|
-
|
|
328
|
+
tabIndex: _this2.computedTabIndex,
|
|
169
329
|
attrs: _this2.v3 ? undefined : {
|
|
330
|
+
tabIndex: _this2.computedTabIndex,
|
|
170
331
|
type: "button",
|
|
171
332
|
togglable: true,
|
|
172
333
|
fillMode: 'flat',
|
|
173
|
-
selected: !_this2.isColorGradient
|
|
334
|
+
selected: !_this2.isColorGradient,
|
|
335
|
+
ariaLabel: paletteMessage
|
|
174
336
|
},
|
|
337
|
+
type: "button",
|
|
175
338
|
togglable: true,
|
|
176
339
|
fillMode: 'flat',
|
|
177
340
|
selected: !_this2.isColorGradient,
|
|
178
|
-
|
|
179
|
-
return _this.handleViewChange(e, 'ColorPalette');
|
|
180
|
-
},
|
|
341
|
+
onKeydown: _this2.handleButtonKeydown,
|
|
181
342
|
on: _this2.v3 ? undefined : {
|
|
182
|
-
"
|
|
183
|
-
|
|
343
|
+
"keydown": _this2.handleButtonKeydown,
|
|
344
|
+
"click": function click(e) {
|
|
345
|
+
return _this.handleViewChange(e, 'palette');
|
|
184
346
|
}
|
|
347
|
+
},
|
|
348
|
+
ariaLabel: paletteMessage,
|
|
349
|
+
onClick: function click(e) {
|
|
350
|
+
return _this.handleViewChange(e, 'palette');
|
|
185
351
|
}
|
|
186
352
|
}, _this2.v3 ? function () {
|
|
187
353
|
return [h("span", {
|
|
@@ -195,98 +361,101 @@ var FlatColorPickerVue2 = {
|
|
|
195
361
|
"class": "k-coloreditor-header-actions k-hstack"
|
|
196
362
|
}, [this.$props.showClearButton && // @ts-ignore function children
|
|
197
363
|
h(Button, {
|
|
198
|
-
|
|
364
|
+
tabIndex: this.computedTabIndex,
|
|
199
365
|
attrs: this.v3 ? undefined : {
|
|
366
|
+
tabIndex: this.computedTabIndex,
|
|
200
367
|
type: "button",
|
|
201
|
-
fillMode: 'flat'
|
|
368
|
+
fillMode: 'flat',
|
|
369
|
+
ariaLabel: clearMessage
|
|
202
370
|
},
|
|
371
|
+
type: "button",
|
|
203
372
|
fillMode: 'flat',
|
|
204
|
-
|
|
373
|
+
ariaLabel: clearMessage,
|
|
374
|
+
onKeydown: this.handleButtonKeydown,
|
|
205
375
|
on: this.v3 ? undefined : {
|
|
376
|
+
"keydown": this.handleButtonKeydown,
|
|
206
377
|
"click": this.handleResetColor
|
|
207
|
-
}
|
|
378
|
+
},
|
|
379
|
+
onClick: this.handleResetColor
|
|
208
380
|
}, this.v3 ? function () {
|
|
209
381
|
return [h("span", {
|
|
210
382
|
"class": "k-icon k-i-reset-color"
|
|
211
383
|
})];
|
|
212
384
|
} : [h("span", {
|
|
213
385
|
"class": "k-icon k-i-reset-color"
|
|
214
|
-
})]), this.$props.showPreview &&
|
|
386
|
+
})]), this.$props.showPreview && h("div", {
|
|
215
387
|
"class": "k-coloreditor-preview k-vstack"
|
|
216
388
|
}, [h("span", {
|
|
217
|
-
"class":
|
|
389
|
+
"class": this.previewClass,
|
|
218
390
|
style: {
|
|
219
391
|
background: this.colorValue
|
|
220
392
|
}
|
|
221
|
-
}
|
|
222
|
-
"class": "k-
|
|
393
|
+
}, [!this.colorValue && h("span", {
|
|
394
|
+
"class": "k-color-preview-mask"
|
|
395
|
+
})]), h("span", {
|
|
396
|
+
"class": this.currentClass,
|
|
223
397
|
style: {
|
|
224
|
-
background: this.
|
|
398
|
+
background: this.computedPrevColor
|
|
225
399
|
},
|
|
226
400
|
onClick: this.handlePrevColorClick,
|
|
227
401
|
on: this.v3 ? undefined : {
|
|
228
402
|
"click": this.handlePrevColorClick
|
|
229
403
|
}
|
|
230
|
-
}
|
|
404
|
+
}, [!this.computedPrevColor && h("span", {
|
|
405
|
+
"class": "k-color-preview-mask"
|
|
406
|
+
})])])])]), h("div", {
|
|
231
407
|
"class": "k-coloreditor-views k-vstack"
|
|
232
|
-
}, [this.isColorGradient ? h(
|
|
233
|
-
, {
|
|
234
|
-
value: this.colorValue,
|
|
235
|
-
attrs: this.v3 ? undefined : {
|
|
236
|
-
value: this.colorValue
|
|
237
|
-
},
|
|
238
|
-
onChange: this.handleColorChange,
|
|
239
|
-
on: this.v3 ? undefined : {
|
|
240
|
-
"change": this.handleColorChange,
|
|
241
|
-
"focus": this.handleFocus
|
|
242
|
-
},
|
|
243
|
-
onFocus: this.handleFocus
|
|
244
|
-
}) : h(ColorPalette, {
|
|
245
|
-
value: this.colorValue,
|
|
246
|
-
attrs: this.v3 ? undefined : {
|
|
247
|
-
value: this.colorValue
|
|
248
|
-
},
|
|
249
|
-
onChange: this.handleColorChange,
|
|
250
|
-
on: this.v3 ? undefined : {
|
|
251
|
-
"change": this.handleColorChange,
|
|
252
|
-
"focus": this.handleFocus
|
|
253
|
-
},
|
|
254
|
-
onFocus: this.handleFocus
|
|
255
|
-
})]), this.$props.showButtons && defaultProps.showButtons && h("div", {
|
|
408
|
+
}, [this.isColorGradient ? renderGradiente.call(this) : renderPalette.call(this)]), this.$props.showButtons && h("div", {
|
|
256
409
|
"class": "k-coloreditor-footer k-actions k-actions-end"
|
|
257
410
|
}, [// @ts-ignore function children
|
|
258
411
|
h(Button, {
|
|
259
|
-
|
|
412
|
+
tabIndex: this.computedTabIndex,
|
|
260
413
|
attrs: this.v3 ? undefined : {
|
|
414
|
+
tabIndex: this.computedTabIndex,
|
|
261
415
|
type: "button"
|
|
262
416
|
},
|
|
417
|
+
type: "button",
|
|
263
418
|
"class": "k-coloreditor-cancel",
|
|
264
|
-
|
|
419
|
+
onKeydown: this.handleButtonKeydown,
|
|
265
420
|
on: this.v3 ? undefined : {
|
|
421
|
+
"keydown": this.handleButtonKeydown,
|
|
266
422
|
"click": this.handleCancelBtnClick
|
|
267
|
-
}
|
|
423
|
+
},
|
|
424
|
+
onClick: this.handleCancelBtnClick
|
|
268
425
|
}, this.v3 ? function () {
|
|
269
|
-
return [
|
|
270
|
-
} : [
|
|
426
|
+
return [cancelMessage];
|
|
427
|
+
} : [cancelMessage]), // @ts-ignore function children
|
|
271
428
|
h(Button, {
|
|
272
|
-
|
|
429
|
+
tabIndex: this.computedTabIndex,
|
|
273
430
|
attrs: this.v3 ? undefined : {
|
|
431
|
+
tabIndex: this.computedTabIndex,
|
|
274
432
|
type: "button"
|
|
275
433
|
},
|
|
434
|
+
type: "button",
|
|
276
435
|
"class": "k-coloreditor-apply k-primary",
|
|
277
|
-
|
|
436
|
+
onKeydown: this.handleButtonKeydown,
|
|
278
437
|
on: this.v3 ? undefined : {
|
|
438
|
+
"keydown": this.handleButtonKeydown,
|
|
279
439
|
"click": this.handleApplyBtnClick
|
|
280
|
-
}
|
|
440
|
+
},
|
|
441
|
+
onClick: this.handleApplyBtnClick
|
|
281
442
|
}, this.v3 ? function () {
|
|
282
|
-
return [
|
|
283
|
-
} : [
|
|
443
|
+
return [applyMessage];
|
|
444
|
+
} : [applyMessage])]), footer]);
|
|
284
445
|
},
|
|
285
446
|
methods: {
|
|
286
447
|
focus: function focus() {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
448
|
+
var _this = this;
|
|
449
|
+
|
|
450
|
+
this.focused = true;
|
|
451
|
+
setTimeout(function () {
|
|
452
|
+
focusFirstFocusableChild(_this.$el);
|
|
453
|
+
}, 1);
|
|
454
|
+
},
|
|
455
|
+
onKeyDownHandler: function onKeyDownHandler(e) {
|
|
456
|
+
var element = this.$el;
|
|
457
|
+
this.focused = focusContainer(e, element);
|
|
458
|
+
this.$emit('keydown', e);
|
|
290
459
|
},
|
|
291
460
|
handleViewChange: function handleViewChange(event, viewType) {
|
|
292
461
|
this.currentView = viewType;
|
|
@@ -296,35 +465,63 @@ var FlatColorPickerVue2 = {
|
|
|
296
465
|
});
|
|
297
466
|
},
|
|
298
467
|
handleResetColor: function handleResetColor() {
|
|
299
|
-
this.colorValue =
|
|
468
|
+
this.colorValue = null;
|
|
300
469
|
},
|
|
301
470
|
handleColorChange: function handleColorChange(event) {
|
|
302
471
|
this.colorValue = event.value;
|
|
303
472
|
},
|
|
304
|
-
|
|
305
|
-
this.
|
|
473
|
+
handlePaletteColorChange: function handlePaletteColorChange(event) {
|
|
474
|
+
this.colorValue = event.value;
|
|
475
|
+
},
|
|
476
|
+
handleApplyBtnClick: function handleApplyBtnClick(event) {
|
|
477
|
+
var rgbaValue = parseColor(this.colorValue, 'rgba');
|
|
478
|
+
this.currentPrevColor = this.colorValue;
|
|
479
|
+
this.$emit('changemodel', this.colorValue);
|
|
480
|
+
this.$emit('update:modelValue', this.colorValue);
|
|
481
|
+
this.$emit('update:modelRgbaValue', rgbaValue);
|
|
482
|
+
this.$emit('change', {
|
|
483
|
+
event: event,
|
|
484
|
+
value: this.colorValue,
|
|
485
|
+
rgbaValue: rgbaValue
|
|
486
|
+
});
|
|
487
|
+
},
|
|
488
|
+
innerKeyDown: function innerKeyDown(event) {
|
|
489
|
+
if (event.keyCode === Keys.enter) {
|
|
490
|
+
this.handleApplyBtnClick(event);
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
gradientKeyDown: function gradientKeyDown(event) {
|
|
494
|
+
event.stopPropagation();
|
|
495
|
+
|
|
496
|
+
if (!this.showButtons && event.keyCode === Keys.enter) {
|
|
497
|
+
this.handleApplyBtnClick(event);
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
handleButtonKeydown: function handleButtonKeydown(e) {
|
|
501
|
+
if (e.keyCode === Keys.enter) {
|
|
502
|
+
e.stopPropagation();
|
|
503
|
+
}
|
|
306
504
|
},
|
|
307
505
|
handleCancelBtnClick: function handleCancelBtnClick() {
|
|
308
|
-
this.
|
|
506
|
+
this.colorValue = this.computedPrevColor;
|
|
309
507
|
},
|
|
310
508
|
handlePrevColorClick: function handlePrevColorClick() {
|
|
311
|
-
this.colorValue = this.
|
|
509
|
+
this.colorValue = this.computedPrevColor;
|
|
312
510
|
},
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
511
|
+
onFocus: function onFocus(event) {
|
|
512
|
+
this.$emit('focus', {
|
|
513
|
+
event: event,
|
|
514
|
+
target: this
|
|
515
|
+
});
|
|
317
516
|
},
|
|
318
|
-
|
|
319
|
-
this
|
|
517
|
+
onBlur: function onBlur(event) {
|
|
518
|
+
this.$emit('blur', {
|
|
519
|
+
event: event,
|
|
520
|
+
target: this
|
|
521
|
+
});
|
|
320
522
|
}
|
|
321
523
|
}
|
|
322
524
|
};
|
|
323
|
-
var defaultProps = {
|
|
324
|
-
showClearButton: true,
|
|
325
|
-
showPreview: true,
|
|
326
|
-
showButtons: true
|
|
327
|
-
};
|
|
328
525
|
/**
|
|
329
526
|
* @hidden
|
|
330
527
|
*/
|