@progress/kendo-vue-inputs 3.4.2 → 3.4.3
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/ColorContrastSvg.d.ts +1 -1
- package/dist/es/colors/ColorGradient.d.ts +1 -0
- package/dist/es/colors/ColorGradient.js +77 -55
- package/dist/es/colors/ColorInput.js +58 -13
- package/dist/es/colors/ColorPalette.d.ts +0 -1
- package/dist/es/colors/ColorPalette.js +5 -28
- package/dist/es/colors/ColorPicker.d.ts +0 -1
- package/dist/es/colors/ColorPicker.js +170 -87
- package/dist/es/colors/FlatColorPicker.js +56 -18
- package/dist/es/colors/HexInput.js +25 -7
- package/dist/es/colors/interfaces/ColorPickerProps.d.ts +6 -1
- package/dist/es/colors/utils/color-palette.service.d.ts +1 -0
- package/dist/es/colors/utils/color-palette.service.js +7 -16
- package/dist/es/main.d.ts +1 -0
- package/dist/es/main.js +1 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/slider/Slider.js +12 -2
- package/dist/npm/colors/ColorContrastSvg.d.ts +1 -1
- package/dist/npm/colors/ColorGradient.d.ts +1 -0
- package/dist/npm/colors/ColorGradient.js +76 -54
- package/dist/npm/colors/ColorInput.js +58 -13
- package/dist/npm/colors/ColorPalette.d.ts +0 -1
- package/dist/npm/colors/ColorPalette.js +5 -28
- package/dist/npm/colors/ColorPicker.d.ts +0 -1
- package/dist/npm/colors/ColorPicker.js +169 -85
- package/dist/npm/colors/FlatColorPicker.js +56 -18
- package/dist/npm/colors/HexInput.js +25 -7
- package/dist/npm/colors/interfaces/ColorPickerProps.d.ts +6 -1
- package/dist/npm/colors/utils/color-palette.service.d.ts +1 -0
- package/dist/npm/colors/utils/color-palette.service.js +7 -16
- package/dist/npm/main.d.ts +1 -0
- package/dist/npm/main.js +2 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/slider/Slider.js +12 -2
- package/package.json +14 -14
|
@@ -1,14 +1,31 @@
|
|
|
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
21
|
var isV3 = allVue.version[0] === '3';
|
|
6
22
|
import { Button } from '@progress/kendo-vue-buttons';
|
|
7
23
|
import { classNames, Keys, // useDir,
|
|
8
|
-
getTabIndex, guid, kendoThemeMaps, validatePackage } from '@progress/kendo-vue-common';
|
|
24
|
+
getTabIndex, guid, kendoThemeMaps, validatePackage, setRef, getRef } from '@progress/kendo-vue-common';
|
|
9
25
|
import { packageMetadata } from '../package-metadata';
|
|
10
26
|
import { Picker } from './Picker';
|
|
11
27
|
import { ColorPalette, DEFAULT_PRESET, DEFAULT_TILE_SIZE } from './ColorPalette';
|
|
28
|
+
import { ColorGradient } from './ColorGradient';
|
|
12
29
|
/**
|
|
13
30
|
* @hidden
|
|
14
31
|
*/
|
|
@@ -38,6 +55,15 @@ var isControlled = function isControlled(prop) {
|
|
|
38
55
|
|
|
39
56
|
var ColorPickerVue2 = {
|
|
40
57
|
name: 'KendoColorPicker',
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
emits: {
|
|
60
|
+
'open': null,
|
|
61
|
+
'close': null,
|
|
62
|
+
'activecolorclick': null,
|
|
63
|
+
'focus': null,
|
|
64
|
+
'blur': null,
|
|
65
|
+
'change': null
|
|
66
|
+
},
|
|
41
67
|
props: {
|
|
42
68
|
value: {
|
|
43
69
|
type: String,
|
|
@@ -66,7 +92,18 @@ var ColorPickerVue2 = {
|
|
|
66
92
|
title: String,
|
|
67
93
|
icon: String,
|
|
68
94
|
iconClassName: String,
|
|
69
|
-
popupSettings:
|
|
95
|
+
popupSettings: {
|
|
96
|
+
type: Object,
|
|
97
|
+
default: function _default() {
|
|
98
|
+
return {};
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
gradientSettings: {
|
|
102
|
+
type: Object,
|
|
103
|
+
default: function _default() {
|
|
104
|
+
return {};
|
|
105
|
+
}
|
|
106
|
+
},
|
|
70
107
|
open: {
|
|
71
108
|
type: Boolean,
|
|
72
109
|
default: undefined
|
|
@@ -91,27 +128,34 @@ var ColorPickerVue2 = {
|
|
|
91
128
|
validator: function validator(value) {
|
|
92
129
|
return [null, 'solid', 'flat', 'outline'].includes(value);
|
|
93
130
|
}
|
|
131
|
+
},
|
|
132
|
+
view: {
|
|
133
|
+
type: String,
|
|
134
|
+
default: 'palette',
|
|
135
|
+
validator: function validator(value) {
|
|
136
|
+
return ['gradient', 'palette', 'combo'].includes(value);
|
|
137
|
+
}
|
|
94
138
|
}
|
|
95
139
|
},
|
|
96
140
|
data: function data() {
|
|
97
141
|
return {
|
|
98
142
|
focused: false,
|
|
99
|
-
|
|
100
|
-
|
|
143
|
+
currentValue: this.$props.defaultValue,
|
|
144
|
+
currentOpen: false
|
|
101
145
|
};
|
|
102
146
|
},
|
|
103
147
|
computed: {
|
|
104
148
|
isValueControlled: function isValueControlled() {
|
|
105
|
-
return
|
|
149
|
+
return this.$props.value !== undefined;
|
|
106
150
|
},
|
|
107
151
|
isOpenControlled: function isOpenControlled() {
|
|
108
|
-
return
|
|
152
|
+
return this.$props.open !== undefined;
|
|
109
153
|
},
|
|
110
154
|
computedValue: function computedValue() {
|
|
111
|
-
return this.isValueControlled ? this.$props.value : this.
|
|
155
|
+
return this.isValueControlled ? this.$props.value : this.currentValue;
|
|
112
156
|
},
|
|
113
157
|
computedOpen: function computedOpen() {
|
|
114
|
-
return this.isOpenControlled ? this.$props.open : this.
|
|
158
|
+
return this.isOpenControlled ? this.$props.open : this.currentOpen;
|
|
115
159
|
},
|
|
116
160
|
computedIconClassName: function computedIconClassName() {
|
|
117
161
|
var icon = this.$props.icon;
|
|
@@ -126,7 +170,8 @@ var ColorPickerVue2 = {
|
|
|
126
170
|
rounded = _b.rounded;
|
|
127
171
|
return _a = {
|
|
128
172
|
'k-picker': true,
|
|
129
|
-
'k-colorpicker': true
|
|
173
|
+
'k-colorpicker': true,
|
|
174
|
+
'k-icon-picker': true
|
|
130
175
|
}, _a["k-picker-" + (kendoThemeMaps.sizeMap[size] || size)] = size, _a["k-picker-" + fillMode] = fillMode, _a["k-rounded-" + (kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded, _a['k-invalid'] = !this.valid, _a['k-disabled'] = this.disabled, _a['k-focus'] = this.focused, _a;
|
|
131
176
|
}
|
|
132
177
|
},
|
|
@@ -135,13 +180,9 @@ var ColorPickerVue2 = {
|
|
|
135
180
|
this.focusableElementGuid = guid();
|
|
136
181
|
},
|
|
137
182
|
mounted: function mounted() {
|
|
138
|
-
this.
|
|
139
|
-
this.button = this.v3 ? this.buttonRef : this.$refs.button;
|
|
140
|
-
this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
|
|
183
|
+
this.button = getRef(this, 'button');
|
|
141
184
|
},
|
|
142
|
-
updated: function updated() {
|
|
143
|
-
this.button = this.v3 ? this.buttonRef : this.$refs.button;
|
|
144
|
-
this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
|
|
185
|
+
updated: function updated() {// this.button = getRef(this, 'button');
|
|
145
186
|
},
|
|
146
187
|
// @ts-ignore
|
|
147
188
|
setup: !isV3 ? undefined : function () {
|
|
@@ -162,7 +203,49 @@ var ColorPickerVue2 = {
|
|
|
162
203
|
var _b = this.$props,
|
|
163
204
|
disabled = _b.disabled,
|
|
164
205
|
tabIndex = _b.tabIndex,
|
|
165
|
-
dir = _b.dir
|
|
206
|
+
dir = _b.dir,
|
|
207
|
+
view = _b.view;
|
|
208
|
+
|
|
209
|
+
var renderGradiente = function renderGradiente() {
|
|
210
|
+
return h(ColorGradient, __assign({
|
|
211
|
+
tabIndex: 0,
|
|
212
|
+
attrs: this.v3 ? undefined : __assign({
|
|
213
|
+
tabIndex: 0,
|
|
214
|
+
value: this.computedValue || undefined
|
|
215
|
+
}, this.gradientSettings),
|
|
216
|
+
ref: setRef(this, 'gradient'),
|
|
217
|
+
value: this.computedValue || undefined,
|
|
218
|
+
onChange: this.onGradientChangeHandler,
|
|
219
|
+
on: this.v3 ? undefined : {
|
|
220
|
+
'change': this.onGradientChangeHandler,
|
|
221
|
+
'focus': this.onFocusHandler,
|
|
222
|
+
'blur': this.onBlurHandler,
|
|
223
|
+
'keydown': this.onKeyDownHandler
|
|
224
|
+
},
|
|
225
|
+
onFocus: this.onFocusHandler,
|
|
226
|
+
onBlur: this.onBlurHandler,
|
|
227
|
+
onKeydown: this.onKeyDownHandler
|
|
228
|
+
}, this.gradientSettings));
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
var renderPalette = function renderPalette() {
|
|
232
|
+
return h(ColorPalette, __assign({
|
|
233
|
+
onKeydown: this.onKeyDownHandler,
|
|
234
|
+
on: this.v3 ? undefined : {
|
|
235
|
+
'keydown': this.onKeyDownHandler,
|
|
236
|
+
'change': this.onPaletteChangeHandler,
|
|
237
|
+
'blur': this.onBlurHandler
|
|
238
|
+
},
|
|
239
|
+
ref: setRef(this, 'palette'),
|
|
240
|
+
value: this.computedValue || undefined,
|
|
241
|
+
attrs: this.v3 ? undefined : __assign({
|
|
242
|
+
value: this.computedValue || undefined
|
|
243
|
+
}, this.paletteSettings),
|
|
244
|
+
onChange: this.onPaletteChangeHandler,
|
|
245
|
+
onBlur: this.onBlurHandler
|
|
246
|
+
}, this.paletteSettings));
|
|
247
|
+
}; // const dir = useDir(focusableElementGuid, props.dir);
|
|
248
|
+
|
|
166
249
|
|
|
167
250
|
return h("span", {
|
|
168
251
|
"class": this.wrapperClassName,
|
|
@@ -181,14 +264,14 @@ var ColorPickerVue2 = {
|
|
|
181
264
|
ref: this.focusableElementGuid,
|
|
182
265
|
tabindex: getTabIndex(tabIndex, disabled),
|
|
183
266
|
title: this.$props.title,
|
|
184
|
-
onKeydown: this.
|
|
267
|
+
onKeydown: this.onButtonKeyDown,
|
|
185
268
|
on: this.v3 ? undefined : {
|
|
186
|
-
"keydown": this.
|
|
269
|
+
"keydown": this.onButtonKeyDown,
|
|
187
270
|
"focusin": this.onFocusHandler,
|
|
188
|
-
"focusout": this.
|
|
271
|
+
"focusout": this.onButtonBlur
|
|
189
272
|
},
|
|
190
273
|
onFocusin: this.onFocusHandler,
|
|
191
|
-
onFocusout: this.
|
|
274
|
+
onFocusout: this.onButtonBlur
|
|
192
275
|
}, [h("span", {
|
|
193
276
|
onClick: this.onActiveColorClickHandler,
|
|
194
277
|
on: this.v3 ? undefined : {
|
|
@@ -212,9 +295,11 @@ var ColorPickerVue2 = {
|
|
|
212
295
|
type: "button",
|
|
213
296
|
attrs: this.v3 ? undefined : {
|
|
214
297
|
type: "button",
|
|
298
|
+
tabindex: -1,
|
|
215
299
|
rounded: null,
|
|
216
300
|
icon: 'arrow-s'
|
|
217
301
|
},
|
|
302
|
+
tabindex: -1,
|
|
218
303
|
ref: this.v3 ? function (el) {
|
|
219
304
|
_this.buttonRef = el;
|
|
220
305
|
} : 'button',
|
|
@@ -240,94 +325,78 @@ var ColorPickerVue2 = {
|
|
|
240
325
|
},
|
|
241
326
|
popupAnchor: this.focusableElementGuid
|
|
242
327
|
}, this.v3 ? function () {
|
|
243
|
-
return [
|
|
244
|
-
|
|
245
|
-
onKeydown: _this2.onKeyDownHandler // {...paletteSettings}
|
|
246
|
-
,
|
|
247
|
-
on: _this2.v3 ? undefined : {
|
|
248
|
-
"keydown": _this2.onKeyDownHandler,
|
|
249
|
-
"change": _this2.onPaletteChangeHandler,
|
|
250
|
-
"blur": _this2.onBlurHandler
|
|
251
|
-
},
|
|
252
|
-
ref: _this2.v3 ? function (el) {
|
|
253
|
-
_this.paletteRef = el;
|
|
254
|
-
} : 'palette',
|
|
255
|
-
value: _this2.computedValue || undefined,
|
|
256
|
-
attrs: _this2.v3 ? undefined : {
|
|
257
|
-
value: _this2.computedValue || undefined
|
|
258
|
-
},
|
|
259
|
-
onChange: _this2.onPaletteChangeHandler,
|
|
260
|
-
onBlur: _this2.onBlurHandler
|
|
261
|
-
})];
|
|
262
|
-
} : [h(ColorPalette, {
|
|
263
|
-
onKeydown: _this2.onKeyDownHandler,
|
|
264
|
-
on: _this2.v3 ? undefined : {
|
|
265
|
-
"keydown": _this2.onKeyDownHandler,
|
|
266
|
-
"change": _this2.onPaletteChangeHandler,
|
|
267
|
-
"blur": _this2.onBlurHandler
|
|
268
|
-
},
|
|
269
|
-
ref: _this2.v3 ? function (el) {
|
|
270
|
-
_this.paletteRef = el;
|
|
271
|
-
} : 'palette',
|
|
272
|
-
value: _this2.computedValue || undefined,
|
|
273
|
-
attrs: _this2.v3 ? undefined : {
|
|
274
|
-
value: _this2.computedValue || undefined
|
|
275
|
-
},
|
|
276
|
-
onChange: _this2.onPaletteChangeHandler,
|
|
277
|
-
onBlur: _this2.onBlurHandler
|
|
278
|
-
})])]);
|
|
328
|
+
return [(view === 'combo' || view === 'gradient') && renderGradiente.call(_this2), (view === 'combo' || view === 'palette') && renderPalette.call(_this2)];
|
|
329
|
+
} : [(view === 'combo' || view === 'gradient') && renderGradiente.call(_this2), (view === 'combo' || view === 'palette') && renderPalette.call(_this2)])]);
|
|
279
330
|
},
|
|
280
331
|
methods: {
|
|
281
332
|
focusElement: function focusElement() {
|
|
282
|
-
if (this
|
|
283
|
-
this.
|
|
333
|
+
if (this.$el) {
|
|
334
|
+
this.$el.focus();
|
|
284
335
|
}
|
|
285
336
|
},
|
|
286
337
|
setOpen: function setOpen(nextOpen, isBlur) {
|
|
287
|
-
if (!this
|
|
288
|
-
|
|
289
|
-
this.focusableElement.focus();
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
this.stateOpen = nextOpen;
|
|
338
|
+
if (!nextOpen && !isBlur && this.$el) {
|
|
339
|
+
this.$el.focus();
|
|
293
340
|
}
|
|
341
|
+
|
|
342
|
+
this.currentOpen = nextOpen;
|
|
343
|
+
this.$emit(nextOpen ? 'open' : 'close');
|
|
294
344
|
},
|
|
295
|
-
|
|
345
|
+
onButtonKeyDown: function onButtonKeyDown(event) {
|
|
296
346
|
var altKey = event.altKey,
|
|
297
347
|
keyCode = event.keyCode;
|
|
298
348
|
|
|
299
349
|
if (keyCode === Keys.esc) {
|
|
350
|
+
event.preventDefault();
|
|
351
|
+
event.stopPropagation();
|
|
300
352
|
this.setOpen(false);
|
|
301
353
|
return;
|
|
302
354
|
}
|
|
303
355
|
|
|
304
|
-
if (keyCode === Keys.enter
|
|
356
|
+
if (keyCode === Keys.enter) {
|
|
305
357
|
event.preventDefault();
|
|
306
358
|
event.stopPropagation();
|
|
307
359
|
this.setOpen(!this.computedOpen);
|
|
308
360
|
return;
|
|
309
361
|
}
|
|
310
362
|
|
|
311
|
-
if (altKey &&
|
|
363
|
+
if (altKey && keyCode === Keys.down) {
|
|
312
364
|
event.preventDefault();
|
|
313
365
|
event.stopPropagation();
|
|
366
|
+
this.setOpen(true);
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
onKeyDownHandler: function onKeyDownHandler(event) {
|
|
370
|
+
var altKey = event.altKey,
|
|
371
|
+
keyCode = event.keyCode;
|
|
314
372
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
373
|
+
if (keyCode === Keys.esc) {
|
|
374
|
+
event.preventDefault();
|
|
375
|
+
event.stopPropagation();
|
|
376
|
+
this.setOpen(false);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
319
379
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
380
|
+
if (keyCode === Keys.enter) {
|
|
381
|
+
event.preventDefault();
|
|
382
|
+
event.stopPropagation();
|
|
383
|
+
this.focusElement();
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (altKey && keyCode === Keys.up) {
|
|
388
|
+
event.preventDefault();
|
|
389
|
+
event.stopPropagation();
|
|
390
|
+
this.setOpen(false);
|
|
391
|
+
this.focusElement();
|
|
323
392
|
}
|
|
324
393
|
},
|
|
325
394
|
onOpenHandler: function onOpenHandler() {
|
|
326
395
|
// Skip content autofocus when in controlled mode
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
396
|
+
var palette = getRef(this, 'palette');
|
|
397
|
+
|
|
398
|
+
if (palette) {
|
|
399
|
+
palette.focus();
|
|
331
400
|
}
|
|
332
401
|
},
|
|
333
402
|
onClickHandler: function onClickHandler() {
|
|
@@ -339,13 +408,22 @@ var ColorPickerVue2 = {
|
|
|
339
408
|
value: this.computedValue
|
|
340
409
|
});
|
|
341
410
|
},
|
|
411
|
+
isViewFocused: function isViewFocused() {
|
|
412
|
+
var _a, _b;
|
|
413
|
+
|
|
414
|
+
return !!((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest('.k-colorpalette')) || !!((_b = document.activeElement) === null || _b === void 0 ? void 0 : _b.closest('.k-colorgradient'));
|
|
415
|
+
},
|
|
416
|
+
onButtonBlur: function onButtonBlur() {
|
|
417
|
+
this.focused = this.isViewFocused();
|
|
418
|
+
},
|
|
342
419
|
onFocusHandler: function onFocusHandler(event) {
|
|
343
420
|
if (this.blurTimeoutRef) {
|
|
344
421
|
clearTimeout(this.blurTimeoutRef);
|
|
345
422
|
this.blurTimeoutRef = undefined; // case where moving back to input from popup
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
423
|
+
|
|
424
|
+
if (event.target === this.$el) {
|
|
425
|
+
this.setOpen(false); // in this case we should focus input on keydown
|
|
426
|
+
}
|
|
349
427
|
} else {
|
|
350
428
|
this.focused = true;
|
|
351
429
|
}
|
|
@@ -355,18 +433,20 @@ var ColorPickerVue2 = {
|
|
|
355
433
|
});
|
|
356
434
|
},
|
|
357
435
|
onBlurTimeout: function onBlurTimeout() {
|
|
358
|
-
var
|
|
436
|
+
var viewIsFocused = this.isViewFocused();
|
|
359
437
|
|
|
360
|
-
if (!
|
|
438
|
+
if (!viewIsFocused) {
|
|
361
439
|
this.setOpen(false, true);
|
|
362
440
|
}
|
|
363
441
|
|
|
364
|
-
this.focused =
|
|
442
|
+
this.focused = viewIsFocused;
|
|
365
443
|
this.blurTimeoutRef = undefined;
|
|
366
444
|
},
|
|
367
445
|
onBlurHandler: function onBlurHandler(event) {
|
|
368
446
|
clearTimeout(this.blurTimeoutRef);
|
|
369
|
-
this.
|
|
447
|
+
this.palette = getRef(this, 'palette');
|
|
448
|
+
this.gradient = getRef(this, 'gradient');
|
|
449
|
+
this.blurTimeoutRef = setTimeout(this.onBlurTimeout, 200);
|
|
370
450
|
this.$emit('blur', {
|
|
371
451
|
event: event
|
|
372
452
|
});
|
|
@@ -375,7 +455,7 @@ var ColorPickerVue2 = {
|
|
|
375
455
|
var currentValue = isPalette ? event.rgbaValue : event.value;
|
|
376
456
|
|
|
377
457
|
if (!this.isValueControlled) {
|
|
378
|
-
this.
|
|
458
|
+
this.currentValue = currentValue;
|
|
379
459
|
}
|
|
380
460
|
|
|
381
461
|
if (isPalette) {
|
|
@@ -387,6 +467,9 @@ var ColorPickerVue2 = {
|
|
|
387
467
|
event: event
|
|
388
468
|
});
|
|
389
469
|
},
|
|
470
|
+
onGradientChangeHandler: function onGradientChangeHandler(event) {
|
|
471
|
+
this.onChangeHandler(event, false);
|
|
472
|
+
},
|
|
390
473
|
onPaletteChangeHandler: function onPaletteChangeHandler(event) {
|
|
391
474
|
this.onChangeHandler(event, true);
|
|
392
475
|
}
|
|
@@ -63,6 +63,8 @@ var FlatColorPickerVue2 = {
|
|
|
63
63
|
},
|
|
64
64
|
// @ts-ignore
|
|
65
65
|
render: function render(createElement) {
|
|
66
|
+
var _this2 = this;
|
|
67
|
+
|
|
66
68
|
var _this = this;
|
|
67
69
|
|
|
68
70
|
var h = gh || createElement;
|
|
@@ -87,16 +89,24 @@ var FlatColorPickerVue2 = {
|
|
|
87
89
|
return [// @ts-ignore function children
|
|
88
90
|
h(Button, {
|
|
89
91
|
type: "button",
|
|
90
|
-
attrs:
|
|
92
|
+
attrs: _this2.v3 ? undefined : {
|
|
91
93
|
type: "button",
|
|
92
94
|
togglable: true,
|
|
93
95
|
fillMode: 'flat',
|
|
94
|
-
selected:
|
|
96
|
+
selected: _this2.isColorGradient
|
|
95
97
|
},
|
|
96
98
|
togglable: true,
|
|
97
99
|
fillMode: 'flat',
|
|
98
|
-
selected:
|
|
99
|
-
|
|
100
|
+
selected: _this2.isColorGradient,
|
|
101
|
+
onClick: function onClick(e) {
|
|
102
|
+
return _this.handleViewChange(e, 'ColorGradient');
|
|
103
|
+
},
|
|
104
|
+
on: _this2.v3 ? undefined : {
|
|
105
|
+
"click": function onClick(e) {
|
|
106
|
+
return _this.handleViewChange(e, 'ColorGradient');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}, _this2.v3 ? function () {
|
|
100
110
|
return [h("span", {
|
|
101
111
|
"class": "k-icon k-i-color-canvas"
|
|
102
112
|
})];
|
|
@@ -105,16 +115,24 @@ var FlatColorPickerVue2 = {
|
|
|
105
115
|
})]), // @ts-ignore function children
|
|
106
116
|
h(Button, {
|
|
107
117
|
type: "button",
|
|
108
|
-
attrs:
|
|
118
|
+
attrs: _this2.v3 ? undefined : {
|
|
109
119
|
type: "button",
|
|
110
120
|
togglable: true,
|
|
111
121
|
fillMode: 'flat',
|
|
112
|
-
selected: !
|
|
122
|
+
selected: !_this2.isColorGradient
|
|
113
123
|
},
|
|
114
124
|
togglable: true,
|
|
115
125
|
fillMode: 'flat',
|
|
116
|
-
selected: !
|
|
117
|
-
|
|
126
|
+
selected: !_this2.isColorGradient,
|
|
127
|
+
onClick: function onClick(e) {
|
|
128
|
+
return _this.handleViewChange(e, 'ColorPalette');
|
|
129
|
+
},
|
|
130
|
+
on: _this2.v3 ? undefined : {
|
|
131
|
+
"click": function onClick(e) {
|
|
132
|
+
return _this.handleViewChange(e, 'ColorPalette');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, _this2.v3 ? function () {
|
|
118
136
|
return [h("span", {
|
|
119
137
|
"class": "k-icon k-i-palette"
|
|
120
138
|
})];
|
|
@@ -123,16 +141,24 @@ var FlatColorPickerVue2 = {
|
|
|
123
141
|
})])];
|
|
124
142
|
} : [h(Button, {
|
|
125
143
|
type: "button",
|
|
126
|
-
attrs:
|
|
144
|
+
attrs: _this2.v3 ? undefined : {
|
|
127
145
|
type: "button",
|
|
128
146
|
togglable: true,
|
|
129
147
|
fillMode: 'flat',
|
|
130
|
-
selected:
|
|
148
|
+
selected: _this2.isColorGradient
|
|
131
149
|
},
|
|
132
150
|
togglable: true,
|
|
133
151
|
fillMode: 'flat',
|
|
134
|
-
selected:
|
|
135
|
-
|
|
152
|
+
selected: _this2.isColorGradient,
|
|
153
|
+
onClick: function onClick(e) {
|
|
154
|
+
return _this.handleViewChange(e, 'ColorGradient');
|
|
155
|
+
},
|
|
156
|
+
on: _this2.v3 ? undefined : {
|
|
157
|
+
"click": function onClick(e) {
|
|
158
|
+
return _this.handleViewChange(e, 'ColorGradient');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}, _this2.v3 ? function () {
|
|
136
162
|
return [h("span", {
|
|
137
163
|
"class": "k-icon k-i-color-canvas"
|
|
138
164
|
})];
|
|
@@ -140,16 +166,24 @@ var FlatColorPickerVue2 = {
|
|
|
140
166
|
"class": "k-icon k-i-color-canvas"
|
|
141
167
|
})]), h(Button, {
|
|
142
168
|
type: "button",
|
|
143
|
-
attrs:
|
|
169
|
+
attrs: _this2.v3 ? undefined : {
|
|
144
170
|
type: "button",
|
|
145
171
|
togglable: true,
|
|
146
172
|
fillMode: 'flat',
|
|
147
|
-
selected: !
|
|
173
|
+
selected: !_this2.isColorGradient
|
|
148
174
|
},
|
|
149
175
|
togglable: true,
|
|
150
176
|
fillMode: 'flat',
|
|
151
|
-
selected: !
|
|
152
|
-
|
|
177
|
+
selected: !_this2.isColorGradient,
|
|
178
|
+
onClick: function onClick(e) {
|
|
179
|
+
return _this.handleViewChange(e, 'ColorPalette');
|
|
180
|
+
},
|
|
181
|
+
on: _this2.v3 ? undefined : {
|
|
182
|
+
"click": function onClick(e) {
|
|
183
|
+
return _this.handleViewChange(e, 'ColorPalette');
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}, _this2.v3 ? function () {
|
|
153
187
|
return [h("span", {
|
|
154
188
|
"class": "k-icon k-i-palette"
|
|
155
189
|
})];
|
|
@@ -254,8 +288,12 @@ var FlatColorPickerVue2 = {
|
|
|
254
288
|
this.$el.focus();
|
|
255
289
|
}
|
|
256
290
|
},
|
|
257
|
-
handleViewChange: function handleViewChange(viewType) {
|
|
291
|
+
handleViewChange: function handleViewChange(event, viewType) {
|
|
258
292
|
this.currentView = viewType;
|
|
293
|
+
this.$emit('viewchange', {
|
|
294
|
+
event: event,
|
|
295
|
+
viewType: viewType
|
|
296
|
+
});
|
|
259
297
|
},
|
|
260
298
|
handleResetColor: function handleResetColor() {
|
|
261
299
|
this.colorValue = 'rgba(255, 255, 255, 1)';
|
|
@@ -278,7 +316,7 @@ var FlatColorPickerVue2 = {
|
|
|
278
316
|
}
|
|
279
317
|
},
|
|
280
318
|
handleFlatColorPickerBlur: function handleFlatColorPickerBlur() {
|
|
281
|
-
this.prevColor
|
|
319
|
+
this.prevColor = this.colorValue;
|
|
282
320
|
}
|
|
283
321
|
}
|
|
284
322
|
};
|
|
@@ -12,16 +12,27 @@ import { Input } from '../input/Input';
|
|
|
12
12
|
|
|
13
13
|
var HexInputVue2 = {
|
|
14
14
|
name: 'KendoHexInput',
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
emits: {
|
|
17
|
+
'hexchange': null,
|
|
18
|
+
'blur': null,
|
|
19
|
+
'focus': null
|
|
20
|
+
},
|
|
15
21
|
props: {
|
|
16
22
|
hex: String,
|
|
17
23
|
disabled: Boolean
|
|
18
24
|
},
|
|
19
25
|
data: function data() {
|
|
20
26
|
return {
|
|
21
|
-
|
|
27
|
+
currentHex: this.$props.hex,
|
|
22
28
|
originalHex: this.$props.hex
|
|
23
29
|
};
|
|
24
30
|
},
|
|
31
|
+
computed: {
|
|
32
|
+
computedHex: function computedHex() {
|
|
33
|
+
return this.hex !== undefined ? this.hex : this.currentHex;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
25
36
|
// @ts-ignore
|
|
26
37
|
setup: !isV3 ? undefined : function () {
|
|
27
38
|
var v3 = !!isV3;
|
|
@@ -33,16 +44,18 @@ var HexInputVue2 = {
|
|
|
33
44
|
render: function render(createElement) {
|
|
34
45
|
var h = gh || createElement;
|
|
35
46
|
return h(Input, {
|
|
36
|
-
value: this.
|
|
47
|
+
value: this.computedHex,
|
|
37
48
|
attrs: this.v3 ? undefined : {
|
|
38
|
-
value: this.
|
|
49
|
+
value: this.computedHex,
|
|
39
50
|
disabled: this.$props.disabled
|
|
40
51
|
},
|
|
41
52
|
onChange: this.onChange,
|
|
42
53
|
on: this.v3 ? undefined : {
|
|
43
54
|
"change": this.onChange,
|
|
55
|
+
"focus": this.onFocus,
|
|
44
56
|
"blur": this.onBlur
|
|
45
57
|
},
|
|
58
|
+
onFocus: this.onFocus,
|
|
46
59
|
onBlur: this.onBlur,
|
|
47
60
|
disabled: this.$props.disabled
|
|
48
61
|
});
|
|
@@ -51,16 +64,21 @@ var HexInputVue2 = {
|
|
|
51
64
|
onChange: function onChange(event) {
|
|
52
65
|
var hex = event.target.value;
|
|
53
66
|
var value = parseColor(hex, 'rgba');
|
|
54
|
-
this.
|
|
67
|
+
this.currentHex = hex;
|
|
55
68
|
|
|
56
69
|
if (isPresent(value)) {
|
|
57
|
-
this.$
|
|
70
|
+
this.$emit('hexchange', hex, value, event);
|
|
58
71
|
}
|
|
59
72
|
},
|
|
60
|
-
onBlur: function onBlur() {
|
|
73
|
+
onBlur: function onBlur(event) {
|
|
61
74
|
if (!isPresent(parseColor(this.hex, 'rgba'))) {
|
|
62
|
-
this.
|
|
75
|
+
this.currentHex = this.originalHex;
|
|
63
76
|
}
|
|
77
|
+
|
|
78
|
+
this.$emit('blur', event);
|
|
79
|
+
},
|
|
80
|
+
onFocus: function onFocus(event) {
|
|
81
|
+
this.$emit('focus', event);
|
|
64
82
|
}
|
|
65
83
|
}
|
|
66
84
|
};
|
|
@@ -5,6 +5,7 @@ import { ColorPickerActiveColorClick } from './ColorPickerActiveColorClick';
|
|
|
5
5
|
import { ColorPickerPopupSettings } from './ColorPickerPopupSettings';
|
|
6
6
|
import { ColorPickerPaletteSettings } from './ColorPickerPaletteSettings';
|
|
7
7
|
import { ColorPickerView } from './ColorPickerView';
|
|
8
|
+
import { ColorGradientProps } from './ColorGradientProps';
|
|
8
9
|
/**
|
|
9
10
|
* Represents the props of the [Kendo UI for Vue ColorPicker component]({% slug overview_colorpicker %}).
|
|
10
11
|
*/
|
|
@@ -46,7 +47,7 @@ export interface ColorPickerProps {
|
|
|
46
47
|
* Sets the view which the ColorPicker will render in the popup
|
|
47
48
|
* ([see example]({% slug combinedview_colorpicker %})).
|
|
48
49
|
*/
|
|
49
|
-
view?: ColorPickerView;
|
|
50
|
+
view?: ColorPickerView | string;
|
|
50
51
|
/**
|
|
51
52
|
* Represents the `dir` HTML attribute.
|
|
52
53
|
*/
|
|
@@ -68,6 +69,10 @@ export interface ColorPickerProps {
|
|
|
68
69
|
* ([see example]({% slug customizecolorpicker_colorpicker %}#toc-customizing-the-palette-popup)).
|
|
69
70
|
*/
|
|
70
71
|
paletteSettings?: ColorPickerPaletteSettings;
|
|
72
|
+
/**
|
|
73
|
+
* Configures the ColorGradient that is displayed in the ColorPicker popup.
|
|
74
|
+
*/
|
|
75
|
+
gradientSettings?: ColorGradientProps;
|
|
71
76
|
/**
|
|
72
77
|
* Configures the popup of the ColorPicker.
|
|
73
78
|
*/
|
|
@@ -5,6 +5,7 @@ import { TableCell } from '../models/table-cell';
|
|
|
5
5
|
export declare class ColorPaletteService {
|
|
6
6
|
colorRows: string[][];
|
|
7
7
|
setColorMatrix(palette: string[], columns: number): void;
|
|
8
|
+
isInColors(colors: any, current: any): boolean;
|
|
8
9
|
getCellCoordsFor(color?: string): TableCell | undefined;
|
|
9
10
|
getColorAt(cellCoords: TableCell): string | undefined;
|
|
10
11
|
getNextCell(current: TableCell, horizontalStep: number, verticalStep: number): TableCell;
|