@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
|
@@ -18,13 +18,14 @@ var __assign = this && this.__assign || function () {
|
|
|
18
18
|
import * as Vue from 'vue';
|
|
19
19
|
var allVue = Vue;
|
|
20
20
|
var gh = allVue.h;
|
|
21
|
-
var isV3 = allVue.version[0] === '3';
|
|
21
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
22
22
|
import { NumericTextBox } from '../main';
|
|
23
23
|
import { HexInput } from './HexInput';
|
|
24
24
|
import { Button } from '@progress/kendo-vue-buttons';
|
|
25
25
|
import { Label } from '@progress/kendo-vue-labels';
|
|
26
26
|
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
27
|
-
import { messages, colorGradientR, colorGradientHex, colorGradientA, colorGradientB, colorGradientG } from '../messages';
|
|
27
|
+
import { messages, colorGradientR, colorGradientHex, colorGradientA, colorGradientB, colorGradientG, colorGradientRLabel, colorGradientGLabel, colorGradientBLabel, colorGradientALabel, colorGradientInputColorButton } from '../messages';
|
|
28
|
+
import { guid, Keys } from '@progress/kendo-vue-common';
|
|
28
29
|
/**
|
|
29
30
|
* @hidden
|
|
30
31
|
*/
|
|
@@ -38,12 +39,11 @@ var ColorInputVue2 = {
|
|
|
38
39
|
name: 'KendoColorInput',
|
|
39
40
|
// @ts-ignore
|
|
40
41
|
emits: {
|
|
41
|
-
'focus': null,
|
|
42
|
-
'blur': null,
|
|
43
42
|
'hexchange': null,
|
|
44
43
|
'rgbachange': null
|
|
45
44
|
},
|
|
46
45
|
props: {
|
|
46
|
+
tabIndex: Number,
|
|
47
47
|
rgba: Object,
|
|
48
48
|
hex: String,
|
|
49
49
|
opacity: Boolean,
|
|
@@ -54,11 +54,20 @@ var ColorInputVue2 = {
|
|
|
54
54
|
default: null
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
+
created: function created() {
|
|
58
|
+
this.hexInputId = guid();
|
|
59
|
+
},
|
|
57
60
|
data: function data() {
|
|
58
61
|
return {
|
|
59
62
|
inputMode: modes[1]
|
|
60
63
|
};
|
|
61
64
|
},
|
|
65
|
+
mounted: function mounted() {
|
|
66
|
+
this.lastFocusable = this.$refs.hexinput || this.$refs.numerica || this.$refs.numericb;
|
|
67
|
+
},
|
|
68
|
+
updated: function updated() {
|
|
69
|
+
this.lastFocusable = this.$refs.hexinput || this.$refs.numerica || this.$refs.numericb;
|
|
70
|
+
},
|
|
62
71
|
// @ts-ignore
|
|
63
72
|
setup: !isV3 ? undefined : function () {
|
|
64
73
|
var v3 = !!isV3;
|
|
@@ -70,79 +79,93 @@ var ColorInputVue2 = {
|
|
|
70
79
|
render: function render(createElement) {
|
|
71
80
|
var h = gh || createElement;
|
|
72
81
|
var localizationService = provideLocalizationService(this);
|
|
73
|
-
var hexMessage = localizationService.toLanguageString(
|
|
82
|
+
var hexMessage = localizationService.toLanguageString(colorGradientHex, messages[colorGradientHex]);
|
|
83
|
+
var buttonMessage = localizationService.toLanguageString(colorGradientInputColorButton, messages[colorGradientInputColorButton]);
|
|
74
84
|
var rMessage = localizationService.toLanguageString(colorGradientR, messages[colorGradientR]);
|
|
75
|
-
var gMessage = localizationService.toLanguageString(
|
|
76
|
-
var bMessage = localizationService.toLanguageString(
|
|
77
|
-
var aMessage = localizationService.toLanguageString(
|
|
85
|
+
var gMessage = localizationService.toLanguageString(colorGradientG, messages[colorGradientG]);
|
|
86
|
+
var bMessage = localizationService.toLanguageString(colorGradientB, messages[colorGradientB]);
|
|
87
|
+
var aMessage = localizationService.toLanguageString(colorGradientA, messages[colorGradientA]);
|
|
88
|
+
var rLabelMessage = localizationService.toLanguageString(colorGradientRLabel, messages[colorGradientRLabel]);
|
|
89
|
+
var gLabelMessage = localizationService.toLanguageString(colorGradientGLabel, messages[colorGradientGLabel]);
|
|
90
|
+
var bLabelMessage = localizationService.toLanguageString(colorGradientBLabel, messages[colorGradientBLabel]);
|
|
91
|
+
var aLabelMessage = localizationService.toLanguageString(colorGradientALabel, messages[colorGradientALabel]);
|
|
78
92
|
return h("div", {
|
|
79
93
|
"class": "k-colorgradient-inputs k-hstack"
|
|
80
94
|
}, [h("div", {
|
|
81
95
|
"class": "k-vstack"
|
|
82
96
|
}, [h(Button, {
|
|
83
|
-
|
|
97
|
+
ariaLabel: buttonMessage,
|
|
84
98
|
attrs: this.v3 ? undefined : {
|
|
99
|
+
ariaLabel: buttonMessage,
|
|
100
|
+
tabIndex: this.tabIndex,
|
|
101
|
+
type: "button",
|
|
85
102
|
fillMode: 'flat',
|
|
86
103
|
icon: 'arrows-kpi'
|
|
87
104
|
},
|
|
105
|
+
tabIndex: this.tabIndex,
|
|
106
|
+
type: "button",
|
|
107
|
+
fillMode: 'flat',
|
|
88
108
|
icon: 'arrows-kpi',
|
|
89
|
-
|
|
109
|
+
"class": "k-colorgradient-toggle-mode k-icon-button",
|
|
110
|
+
onClick: this.onToggleModeChange,
|
|
90
111
|
on: this.v3 ? undefined : {
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"click": this.onToggleModeChange
|
|
112
|
+
"click": this.onToggleModeChange,
|
|
113
|
+
"keydown": this.onKeyDown
|
|
94
114
|
},
|
|
95
|
-
|
|
96
|
-
"class": "k-colorgradient-toggle-mode k-icon-button",
|
|
97
|
-
onClick: this.onToggleModeChange
|
|
115
|
+
onKeydown: this.onKeyDown
|
|
98
116
|
})]), this.inputMode === 'hex' && h("div", {
|
|
99
117
|
"class": "k-vstack k-flex-1"
|
|
100
118
|
}, [h("span", {
|
|
101
|
-
"class": "k-hex-value
|
|
119
|
+
"class": "k-hex-value"
|
|
102
120
|
}, [h(HexInput, {
|
|
103
|
-
|
|
121
|
+
id: this.hexInputId,
|
|
104
122
|
attrs: this.v3 ? undefined : {
|
|
123
|
+
id: this.hexInputId,
|
|
124
|
+
tabIndex: this.tabIndex,
|
|
105
125
|
hex: this.$props.hex,
|
|
106
126
|
disabled: this.$props.disabled
|
|
107
127
|
},
|
|
108
|
-
|
|
128
|
+
tabIndex: this.tabIndex,
|
|
129
|
+
hex: this.$props.hex,
|
|
130
|
+
onHexchange: this.onHexChange,
|
|
109
131
|
on: this.v3 ? undefined : {
|
|
110
|
-
"focus": this.onFocus,
|
|
111
|
-
"blur": this.onBlur,
|
|
112
132
|
"hexchange": this.onHexChange
|
|
113
133
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
disabled: this.$props.disabled
|
|
134
|
+
disabled: this.$props.disabled,
|
|
135
|
+
ref: 'hexinput'
|
|
117
136
|
})]), // @ts-ignore function children
|
|
118
137
|
h(Label, {
|
|
119
|
-
"class": "k-colorgradient-input-label"
|
|
138
|
+
"class": "k-colorgradient-input-label",
|
|
139
|
+
"for": this.hexInputId,
|
|
140
|
+
attrs: this.v3 ? undefined : {
|
|
141
|
+
"for": this.hexInputId
|
|
142
|
+
}
|
|
120
143
|
}, this.v3 ? function () {
|
|
121
144
|
return [hexMessage];
|
|
122
145
|
} : [hexMessage])]), (this.inputMode === 'rgb' || this.inputMode === 'rgba') && [h("div", {
|
|
123
146
|
"class": "k-vstack"
|
|
124
147
|
}, [h(NumericTextBox, {
|
|
125
|
-
|
|
148
|
+
tabIndex: this.tabIndex,
|
|
126
149
|
attrs: this.v3 ? undefined : {
|
|
150
|
+
tabIndex: this.tabIndex,
|
|
127
151
|
value: this.$props.rgba.r,
|
|
128
152
|
min: 0,
|
|
129
153
|
max: 255,
|
|
130
154
|
spinners: false,
|
|
131
155
|
format: "n",
|
|
156
|
+
ariaLabel: rLabelMessage,
|
|
132
157
|
disabled: this.$props.disabled
|
|
133
158
|
},
|
|
159
|
+
value: this.$props.rgba.r,
|
|
134
160
|
min: 0,
|
|
135
161
|
max: 255,
|
|
136
162
|
spinners: false,
|
|
137
163
|
format: "n",
|
|
138
|
-
|
|
164
|
+
ariaLabel: rLabelMessage,
|
|
165
|
+
onChange: this.onRgbaRChange,
|
|
139
166
|
on: this.v3 ? undefined : {
|
|
140
|
-
"focus": this.onFocus,
|
|
141
|
-
"blur": this.onBlur,
|
|
142
167
|
"change": this.onRgbaRChange
|
|
143
168
|
},
|
|
144
|
-
onBlur: this.onBlur,
|
|
145
|
-
onChange: this.onRgbaRChange,
|
|
146
169
|
disabled: this.$props.disabled
|
|
147
170
|
}), // @ts-ignore function children
|
|
148
171
|
h(Label, {
|
|
@@ -152,27 +175,27 @@ var ColorInputVue2 = {
|
|
|
152
175
|
} : [rMessage])]), h("div", {
|
|
153
176
|
"class": "k-vstack"
|
|
154
177
|
}, [h(NumericTextBox, {
|
|
155
|
-
|
|
178
|
+
tabIndex: this.tabIndex,
|
|
156
179
|
attrs: this.v3 ? undefined : {
|
|
180
|
+
tabIndex: this.tabIndex,
|
|
157
181
|
value: this.$props.rgba.g,
|
|
158
182
|
min: 0,
|
|
159
183
|
max: 255,
|
|
160
184
|
spinners: false,
|
|
161
185
|
format: "n",
|
|
186
|
+
ariaLabel: gLabelMessage,
|
|
162
187
|
disabled: this.$props.disabled
|
|
163
188
|
},
|
|
189
|
+
value: this.$props.rgba.g,
|
|
164
190
|
min: 0,
|
|
165
191
|
max: 255,
|
|
166
192
|
spinners: false,
|
|
167
193
|
format: "n",
|
|
168
|
-
|
|
194
|
+
ariaLabel: gLabelMessage,
|
|
195
|
+
onChange: this.onRgbaGChange,
|
|
169
196
|
on: this.v3 ? undefined : {
|
|
170
|
-
"focus": this.onFocus,
|
|
171
|
-
"blur": this.onBlur,
|
|
172
197
|
"change": this.onRgbaGChange
|
|
173
198
|
},
|
|
174
|
-
onBlur: this.onBlur,
|
|
175
|
-
onChange: this.onRgbaGChange,
|
|
176
199
|
disabled: this.$props.disabled
|
|
177
200
|
}), // @ts-ignore function children
|
|
178
201
|
h(Label, {
|
|
@@ -182,28 +205,29 @@ var ColorInputVue2 = {
|
|
|
182
205
|
} : [gMessage])]), h("div", {
|
|
183
206
|
"class": "k-vstack"
|
|
184
207
|
}, [h(NumericTextBox, {
|
|
185
|
-
|
|
208
|
+
tabIndex: this.tabIndex,
|
|
186
209
|
attrs: this.v3 ? undefined : {
|
|
210
|
+
tabIndex: this.tabIndex,
|
|
187
211
|
value: this.$props.rgba.b,
|
|
188
212
|
min: 0,
|
|
189
213
|
max: 255,
|
|
190
214
|
spinners: false,
|
|
191
215
|
format: "n",
|
|
216
|
+
ariaLabel: bLabelMessage,
|
|
192
217
|
disabled: this.$props.disabled
|
|
193
218
|
},
|
|
219
|
+
value: this.$props.rgba.b,
|
|
194
220
|
min: 0,
|
|
195
221
|
max: 255,
|
|
196
222
|
spinners: false,
|
|
197
223
|
format: "n",
|
|
198
|
-
|
|
224
|
+
ariaLabel: bLabelMessage,
|
|
225
|
+
onChange: this.onRgbaBChange,
|
|
199
226
|
on: this.v3 ? undefined : {
|
|
200
|
-
"focus": this.onFocus,
|
|
201
|
-
"blur": this.onBlur,
|
|
202
227
|
"change": this.onRgbaBChange
|
|
203
228
|
},
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
disabled: this.$props.disabled
|
|
229
|
+
disabled: this.$props.disabled,
|
|
230
|
+
ref: 'numericb'
|
|
207
231
|
}), // @ts-ignore function children
|
|
208
232
|
h(Label, {
|
|
209
233
|
"class": "k-colorgradient-input-label"
|
|
@@ -212,30 +236,31 @@ var ColorInputVue2 = {
|
|
|
212
236
|
} : [bMessage])])], this.inputMode === 'rgba' && h("div", {
|
|
213
237
|
"class": "k-vstack"
|
|
214
238
|
}, [this.$props.opacity && h(NumericTextBox, {
|
|
215
|
-
|
|
239
|
+
tabIndex: this.tabIndex,
|
|
216
240
|
attrs: this.v3 ? undefined : {
|
|
241
|
+
tabIndex: this.tabIndex,
|
|
217
242
|
value: this.$props.rgba.a,
|
|
218
243
|
min: 0,
|
|
219
244
|
max: 1,
|
|
220
245
|
step: 0.01,
|
|
221
246
|
spinners: false,
|
|
222
247
|
format: "n2",
|
|
248
|
+
ariaLabel: aLabelMessage,
|
|
223
249
|
disabled: this.$props.disabled
|
|
224
250
|
},
|
|
251
|
+
value: this.$props.rgba.a,
|
|
225
252
|
min: 0,
|
|
226
253
|
max: 1,
|
|
227
254
|
step: 0.01,
|
|
228
255
|
spinners: false,
|
|
229
256
|
format: "n2",
|
|
230
|
-
|
|
257
|
+
ariaLabel: aLabelMessage,
|
|
258
|
+
onChange: this.onRgbaAChange,
|
|
231
259
|
on: this.v3 ? undefined : {
|
|
232
|
-
"focus": this.onFocus,
|
|
233
|
-
"blur": this.onBlur,
|
|
234
260
|
"change": this.onRgbaAChange
|
|
235
261
|
},
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
disabled: this.$props.disabled
|
|
262
|
+
disabled: this.$props.disabled,
|
|
263
|
+
ref: 'numerica'
|
|
239
264
|
}), this.$props.opacity && // @ts-ignore function children
|
|
240
265
|
h(Label, {
|
|
241
266
|
"class": "k-colorgradient-input-label"
|
|
@@ -244,14 +269,8 @@ var ColorInputVue2 = {
|
|
|
244
269
|
} : [aMessage])])]);
|
|
245
270
|
},
|
|
246
271
|
methods: {
|
|
247
|
-
onFocus: function onFocus(event) {
|
|
248
|
-
this.$emit('focus', event);
|
|
249
|
-
},
|
|
250
|
-
onBlur: function onBlur(event) {
|
|
251
|
-
this.$emit('blur', event);
|
|
252
|
-
},
|
|
253
272
|
onHexChange: function onHexChange(event) {
|
|
254
|
-
this.$emit('hexchange', event);
|
|
273
|
+
this.$emit('hexchange', event.hex, event.value, event);
|
|
255
274
|
},
|
|
256
275
|
onRgbaRChange: function onRgbaRChange(event) {
|
|
257
276
|
this.dispatchRgbaChange({
|
|
@@ -303,6 +322,11 @@ var ColorInputVue2 = {
|
|
|
303
322
|
} else {
|
|
304
323
|
this.inputMode = modes[index];
|
|
305
324
|
}
|
|
325
|
+
},
|
|
326
|
+
onKeyDown: function onKeyDown(e) {
|
|
327
|
+
if (e.keyCode === Keys.enter) {
|
|
328
|
+
e.stopPropagation();
|
|
329
|
+
}
|
|
306
330
|
}
|
|
307
331
|
}
|
|
308
332
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as Vue from 'vue';
|
|
3
3
|
var allVue = Vue;
|
|
4
4
|
var gh = allVue.h;
|
|
5
|
-
var isV3 = allVue.version[0] === '3';
|
|
5
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
6
6
|
import { ColorPaletteService } from './utils/color-palette.service';
|
|
7
7
|
import { classNames, Keys, guid, getTabIndex, validatePackage, setRef, getRef } from '@progress/kendo-vue-common';
|
|
8
8
|
import { packageMetadata } from '../package-metadata';
|
|
@@ -30,11 +30,17 @@ export var DEFAULT_PRESET = 'office';
|
|
|
30
30
|
|
|
31
31
|
var ColorPaletteVue2 = {
|
|
32
32
|
name: 'KendoColorPalette',
|
|
33
|
+
model: {
|
|
34
|
+
event: 'changemodel'
|
|
35
|
+
},
|
|
33
36
|
// @ts-ignore
|
|
34
37
|
emits: {
|
|
35
38
|
'keydown': null,
|
|
36
39
|
'focus': null,
|
|
37
40
|
'blur': null,
|
|
41
|
+
'changemodel': null,
|
|
42
|
+
'update:modelValue': null,
|
|
43
|
+
'update:modelRgbaValue': null,
|
|
38
44
|
'change': null
|
|
39
45
|
},
|
|
40
46
|
props: {
|
|
@@ -47,6 +53,8 @@ var ColorPaletteVue2 = {
|
|
|
47
53
|
type: [Number, Object],
|
|
48
54
|
default: DEFAULT_TILE_SIZE
|
|
49
55
|
},
|
|
56
|
+
modelValue: String,
|
|
57
|
+
modelRgbaValue: String,
|
|
50
58
|
defaultValue: String,
|
|
51
59
|
value: String,
|
|
52
60
|
disabled: Boolean,
|
|
@@ -73,7 +81,7 @@ var ColorPaletteVue2 = {
|
|
|
73
81
|
return this.$props.value === undefined;
|
|
74
82
|
},
|
|
75
83
|
selectedColor: function selectedColor() {
|
|
76
|
-
return this.$props.value !== undefined ? this.$props.value : this.currentValue !== undefined ? this.currentValue : this.$props.defaultValue;
|
|
84
|
+
return this.$props.value !== undefined ? this.$props.value : this.modelValue !== undefined ? this.modelValue : this.modelRgbaValue !== undefined ? this.modelRgbaValue : this.currentValue !== undefined ? this.currentValue : this.$props.defaultValue;
|
|
77
85
|
}
|
|
78
86
|
},
|
|
79
87
|
data: function data() {
|
|
@@ -129,7 +137,8 @@ var ColorPaletteVue2 = {
|
|
|
129
137
|
id: this.createCellId({
|
|
130
138
|
row: rowIndex,
|
|
131
139
|
col: i
|
|
132
|
-
})
|
|
140
|
+
}),
|
|
141
|
+
role: 'gridcell'
|
|
133
142
|
},
|
|
134
143
|
"aria-selected": isSelected ? true : this.$props.disabled ? undefined : false,
|
|
135
144
|
style: {
|
|
@@ -150,7 +159,8 @@ var ColorPaletteVue2 = {
|
|
|
150
159
|
row: rowIndex,
|
|
151
160
|
col: i
|
|
152
161
|
}),
|
|
153
|
-
key: i
|
|
162
|
+
key: i,
|
|
163
|
+
role: 'gridcell'
|
|
154
164
|
});
|
|
155
165
|
}, this);
|
|
156
166
|
};
|
|
@@ -173,9 +183,10 @@ var ColorPaletteVue2 = {
|
|
|
173
183
|
attrs: this.v3 ? undefined : {
|
|
174
184
|
id: this.$props.id,
|
|
175
185
|
"aria-disabled": this.$props.disabled ? 'true' : undefined,
|
|
176
|
-
"aria-activedescendant":
|
|
186
|
+
"aria-activedescendant": focusedCellCoords && this.createCellId(focusedCellCoords),
|
|
177
187
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
178
188
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
189
|
+
role: "grid",
|
|
179
190
|
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled)
|
|
180
191
|
},
|
|
181
192
|
"class": className,
|
|
@@ -188,17 +199,14 @@ var ColorPaletteVue2 = {
|
|
|
188
199
|
onFocusout: this.onBlur,
|
|
189
200
|
onKeydown: this.onKeyDown,
|
|
190
201
|
"aria-disabled": this.$props.disabled ? 'true' : undefined,
|
|
191
|
-
"aria-activedescendant":
|
|
202
|
+
"aria-activedescendant": focusedCellCoords && this.createCellId(focusedCellCoords),
|
|
192
203
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
193
204
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
205
|
+
role: "grid",
|
|
194
206
|
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
195
207
|
ref: setRef(this, 'wrapper')
|
|
196
208
|
}, [h("div", {
|
|
197
|
-
"class": "k-colorpalette-table-wrap"
|
|
198
|
-
role: "grid",
|
|
199
|
-
attrs: this.v3 ? undefined : {
|
|
200
|
-
role: "grid"
|
|
201
|
-
}
|
|
209
|
+
"class": "k-colorpalette-table-wrap"
|
|
202
210
|
}, [h("table", {
|
|
203
211
|
"class": "k-colorpalette-table k-palette",
|
|
204
212
|
role: "presentation",
|
|
@@ -221,19 +229,19 @@ var ColorPaletteVue2 = {
|
|
|
221
229
|
onKeyDown: function onKeyDown(event) {
|
|
222
230
|
switch (event.keyCode) {
|
|
223
231
|
case Keys.down:
|
|
224
|
-
this.handleCellNavigation(0, 1);
|
|
232
|
+
this.handleCellNavigation(event, 0, 1);
|
|
225
233
|
break;
|
|
226
234
|
|
|
227
235
|
case Keys.up:
|
|
228
|
-
this.handleCellNavigation(0, -1);
|
|
236
|
+
this.handleCellNavigation(event, 0, -1);
|
|
229
237
|
break;
|
|
230
238
|
|
|
231
239
|
case Keys.right:
|
|
232
|
-
this.handleCellNavigation(1, 0);
|
|
240
|
+
this.handleCellNavigation(event, 1, 0);
|
|
233
241
|
break;
|
|
234
242
|
|
|
235
243
|
case Keys.left:
|
|
236
|
-
this.handleCellNavigation(-1, 0);
|
|
244
|
+
this.handleCellNavigation(event, -1, 0);
|
|
237
245
|
break;
|
|
238
246
|
|
|
239
247
|
case Keys.enter:
|
|
@@ -271,7 +279,9 @@ var ColorPaletteVue2 = {
|
|
|
271
279
|
target: this
|
|
272
280
|
});
|
|
273
281
|
},
|
|
274
|
-
handleCellNavigation: function handleCellNavigation(horizontalStep, verticalStep) {
|
|
282
|
+
handleCellNavigation: function handleCellNavigation(event, horizontalStep, verticalStep) {
|
|
283
|
+
event.preventDefault();
|
|
284
|
+
|
|
275
285
|
if (this.focusedColorCooridanates) {
|
|
276
286
|
var newCoords = this.paletteService.getNextCell(this.focusedColorCooridanates, horizontalStep, verticalStep);
|
|
277
287
|
this.focusedColor = this.paletteService.getColorAt(newCoords);
|
|
@@ -287,11 +297,15 @@ var ColorPaletteVue2 = {
|
|
|
287
297
|
this.dispatchChangeEvent(this.focusedColor, event);
|
|
288
298
|
},
|
|
289
299
|
dispatchChangeEvent: function dispatchChangeEvent(value, event) {
|
|
300
|
+
var rgbaValue = parseColor(value, 'rgba');
|
|
301
|
+
this.$emit('changemodel', value);
|
|
302
|
+
this.$emit('update:modelValue', value);
|
|
303
|
+
this.$emit('update:modelRgbaValue', rgbaValue);
|
|
290
304
|
this.$emit('change', {
|
|
291
305
|
event: event,
|
|
292
306
|
component: this,
|
|
293
307
|
value: value,
|
|
294
|
-
rgbaValue:
|
|
308
|
+
rgbaValue: rgbaValue
|
|
295
309
|
});
|
|
296
310
|
},
|
|
297
311
|
getPaletteInfo: function getPaletteInfo() {
|