@progress/kendo-vue-inputs 2.7.1 → 2.7.3-dev.202201070829
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 +10 -0
- package/dist/es/main.js +10 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/switch/Switch.js +4 -1
- 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 +10 -0
- package/dist/npm/main.js +11 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/switch/Switch.js +4 -1
- package/package.json +13 -7
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
import { classNames, Keys, // useDir,
|
|
6
|
+
getTabIndex, guid } from '@progress/kendo-vue-common';
|
|
7
|
+
import { validatePackage } from '@progress/kendo-vue-common';
|
|
8
|
+
import { packageMetadata } from '../package-metadata';
|
|
9
|
+
import { Picker } from './Picker';
|
|
10
|
+
import { ColorPalette, DEFAULT_PRESET, DEFAULT_TILE_SIZE } from './ColorPalette';
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var DEFAULT_GRADIENT_SETTINGS = {
|
|
16
|
+
opacity: true
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
var DEFAULT_PALETTE_SETTINGS = {
|
|
23
|
+
palette: DEFAULT_PRESET,
|
|
24
|
+
tileSize: DEFAULT_TILE_SIZE
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @hidden
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
var isControlled = function isControlled(prop) {
|
|
31
|
+
return prop !== undefined;
|
|
32
|
+
}; // tslint:enable:max-line-length
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var ColorPicker = {
|
|
36
|
+
name: 'KendoColorPicker',
|
|
37
|
+
props: {
|
|
38
|
+
value: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: undefined
|
|
41
|
+
},
|
|
42
|
+
defaultValue: String,
|
|
43
|
+
disabled: Boolean,
|
|
44
|
+
dir: String,
|
|
45
|
+
id: String,
|
|
46
|
+
ariaLabelledBy: String,
|
|
47
|
+
ariaDescribedBy: String,
|
|
48
|
+
paletteSettings: {
|
|
49
|
+
type: Object,
|
|
50
|
+
default: function _default() {
|
|
51
|
+
return DEFAULT_PALETTE_SETTINGS;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
valid: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: true
|
|
57
|
+
},
|
|
58
|
+
tabIndex: {
|
|
59
|
+
type: Number,
|
|
60
|
+
default: 0
|
|
61
|
+
},
|
|
62
|
+
title: String,
|
|
63
|
+
icon: String,
|
|
64
|
+
iconClassName: String,
|
|
65
|
+
popupSettings: Object,
|
|
66
|
+
open: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: undefined
|
|
69
|
+
},
|
|
70
|
+
size: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: 'medium',
|
|
73
|
+
validator: function validator(value) {
|
|
74
|
+
return [null, 'small', 'medium', 'large'].includes(value);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
rounded: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: 'medium',
|
|
80
|
+
validator: function validator(value) {
|
|
81
|
+
return [null, 'small', 'medium', 'large', 'pill'].includes(value);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
fillMode: {
|
|
85
|
+
type: String,
|
|
86
|
+
default: 'solid',
|
|
87
|
+
validator: function validator(value) {
|
|
88
|
+
return [null, 'solid', 'flat', 'outline'].includes(value);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
data: function data() {
|
|
93
|
+
return {
|
|
94
|
+
focused: false,
|
|
95
|
+
stateValue: '',
|
|
96
|
+
stateOpen: false
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
computed: {
|
|
100
|
+
isValueControlled: function isValueControlled() {
|
|
101
|
+
return isControlled(this.$props.value);
|
|
102
|
+
},
|
|
103
|
+
isOpenControlled: function isOpenControlled() {
|
|
104
|
+
return isControlled(this.$props.open);
|
|
105
|
+
},
|
|
106
|
+
computedValue: function computedValue() {
|
|
107
|
+
return this.isValueControlled ? this.$props.value : this.stateValue;
|
|
108
|
+
},
|
|
109
|
+
computedOpen: function computedOpen() {
|
|
110
|
+
return this.isOpenControlled ? this.$props.open : this.stateOpen;
|
|
111
|
+
},
|
|
112
|
+
computedIconClassName: function computedIconClassName() {
|
|
113
|
+
var icon = this.$props.icon;
|
|
114
|
+
return this.$props.iconClassName || icon && "k-icon k-i-" + icon;
|
|
115
|
+
},
|
|
116
|
+
wrapperClassName: function wrapperClassName() {
|
|
117
|
+
return {
|
|
118
|
+
'k-widget': true,
|
|
119
|
+
'k-colorpicker': true,
|
|
120
|
+
'k-state-invalid': this.valid === false
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
spanClassName: function spanClassName() {
|
|
124
|
+
var disabled = this.$props.disabled;
|
|
125
|
+
return {
|
|
126
|
+
'k-picker-wrap': true,
|
|
127
|
+
'k-state-disabled': disabled,
|
|
128
|
+
'k-state-focused': this.focused
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
created: function created() {
|
|
133
|
+
validatePackage(packageMetadata);
|
|
134
|
+
this.focusableElementGuid = guid();
|
|
135
|
+
},
|
|
136
|
+
mounted: function mounted() {
|
|
137
|
+
this.focusableElement = this.$refs[this.focusableElementGuid];
|
|
138
|
+
this.button = this.v3 ? this.buttonRef : this.$refs.button;
|
|
139
|
+
this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
|
|
140
|
+
},
|
|
141
|
+
updated: function updated() {
|
|
142
|
+
this.button = this.v3 ? this.buttonRef : this.$refs.button;
|
|
143
|
+
this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
|
|
144
|
+
},
|
|
145
|
+
// @ts-ignore
|
|
146
|
+
setup: !gh ? undefined : function () {
|
|
147
|
+
var v3 = !!gh;
|
|
148
|
+
return {
|
|
149
|
+
v3: v3
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
render: function render(createElement) {
|
|
154
|
+
var _this2 = this;
|
|
155
|
+
|
|
156
|
+
var _this = this;
|
|
157
|
+
|
|
158
|
+
var h = gh || createElement;
|
|
159
|
+
var _a = this.$props,
|
|
160
|
+
disabled = _a.disabled,
|
|
161
|
+
tabIndex = _a.tabIndex; // const dir = useDir(focusableElementGuid, props.dir);
|
|
162
|
+
|
|
163
|
+
return h("span", {
|
|
164
|
+
"class": this.wrapperClassName
|
|
165
|
+
}, [h("span", {
|
|
166
|
+
id: this.$props.id,
|
|
167
|
+
attrs: this.v3 ? undefined : {
|
|
168
|
+
id: this.$props.id,
|
|
169
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
170
|
+
"aria-describedby": this.$props.ariaDescribedBy,
|
|
171
|
+
tabIndex: getTabIndex(tabIndex, disabled),
|
|
172
|
+
title: this.$props.title
|
|
173
|
+
},
|
|
174
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
175
|
+
"aria-describedby": this.$props.ariaDescribedBy,
|
|
176
|
+
"class": this.spanClassName,
|
|
177
|
+
ref: this.focusableElementGuid,
|
|
178
|
+
tabIndex: getTabIndex(tabIndex, disabled),
|
|
179
|
+
title: this.$props.title,
|
|
180
|
+
onKeydown: this.onKeyDownHandler,
|
|
181
|
+
on: this.v3 ? undefined : {
|
|
182
|
+
"keydown": this.onKeyDownHandler,
|
|
183
|
+
"focusin": this.onFocusHandler,
|
|
184
|
+
"focusout": this.onBlurHandler
|
|
185
|
+
},
|
|
186
|
+
onFocusin: this.onFocusHandler,
|
|
187
|
+
onFocusout: this.onBlurHandler
|
|
188
|
+
}, [!this.computedIconClassName ? h("span", {
|
|
189
|
+
onClick: this.onActiveColorClickHandler,
|
|
190
|
+
on: this.v3 ? undefined : {
|
|
191
|
+
"click": this.onActiveColorClickHandler
|
|
192
|
+
},
|
|
193
|
+
"class": 'k-selected-color',
|
|
194
|
+
style: {
|
|
195
|
+
backgroundColor: this.computedValue
|
|
196
|
+
}
|
|
197
|
+
}, [!this.computedValue && h("span", {
|
|
198
|
+
"class": 'k-icon k-i-line'
|
|
199
|
+
})]) : h("span", {
|
|
200
|
+
onClick: this.onActiveColorClickHandler,
|
|
201
|
+
on: this.v3 ? undefined : {
|
|
202
|
+
"click": this.onActiveColorClickHandler
|
|
203
|
+
},
|
|
204
|
+
"class": classNames('k-tool-icon', this.computedIconClassName)
|
|
205
|
+
}, [h("span", {
|
|
206
|
+
"class": 'k-selected-color',
|
|
207
|
+
style: {
|
|
208
|
+
backgroundColor: this.computedValue
|
|
209
|
+
}
|
|
210
|
+
})]), h("span", {
|
|
211
|
+
onClick: this.onClickHandler,
|
|
212
|
+
on: this.v3 ? undefined : {
|
|
213
|
+
"click": this.onClickHandler
|
|
214
|
+
},
|
|
215
|
+
"class": 'k-select',
|
|
216
|
+
ref: this.v3 ? function (el) {
|
|
217
|
+
_this.buttonRef = el;
|
|
218
|
+
} : 'button'
|
|
219
|
+
}, [h("span", {
|
|
220
|
+
"class": 'k-icon k-i-arrow-s'
|
|
221
|
+
})]), // @ts-ignore function children
|
|
222
|
+
h(Picker // dir={dir}
|
|
223
|
+
, {
|
|
224
|
+
open: this.computedOpen,
|
|
225
|
+
attrs: this.v3 ? undefined : {
|
|
226
|
+
open: this.computedOpen,
|
|
227
|
+
popupAnchor: this.focusableElementGuid
|
|
228
|
+
},
|
|
229
|
+
onOpen: this.onOpenHandler,
|
|
230
|
+
on: this.v3 ? undefined : {
|
|
231
|
+
"open": this.onOpenHandler
|
|
232
|
+
},
|
|
233
|
+
popupAnchor: this.focusableElementGuid
|
|
234
|
+
}, this.v3 ? function () {
|
|
235
|
+
return [// @ts-ignore function children
|
|
236
|
+
h(ColorPalette, {
|
|
237
|
+
onKeydown: _this2.onKeyDownHandler // {...paletteSettings}
|
|
238
|
+
,
|
|
239
|
+
on: _this2.v3 ? undefined : {
|
|
240
|
+
"keydown": _this2.onKeyDownHandler,
|
|
241
|
+
"change": _this2.onPaletteChangeHandler
|
|
242
|
+
},
|
|
243
|
+
ref: _this2.v3 ? function (el) {
|
|
244
|
+
_this.paletteRef = el;
|
|
245
|
+
} : 'palette',
|
|
246
|
+
value: _this2.computedValue || undefined,
|
|
247
|
+
attrs: _this2.v3 ? undefined : {
|
|
248
|
+
value: _this2.computedValue || undefined
|
|
249
|
+
},
|
|
250
|
+
onChange: _this2.onPaletteChangeHandler
|
|
251
|
+
})];
|
|
252
|
+
} : [h(ColorPalette, {
|
|
253
|
+
onKeydown: _this2.onKeyDownHandler,
|
|
254
|
+
on: _this2.v3 ? undefined : {
|
|
255
|
+
"keydown": _this2.onKeyDownHandler,
|
|
256
|
+
"change": _this2.onPaletteChangeHandler
|
|
257
|
+
},
|
|
258
|
+
ref: _this2.v3 ? function (el) {
|
|
259
|
+
_this.paletteRef = el;
|
|
260
|
+
} : 'palette',
|
|
261
|
+
value: _this2.computedValue || undefined,
|
|
262
|
+
attrs: _this2.v3 ? undefined : {
|
|
263
|
+
value: _this2.computedValue || undefined
|
|
264
|
+
},
|
|
265
|
+
onChange: _this2.onPaletteChangeHandler
|
|
266
|
+
})])])]);
|
|
267
|
+
},
|
|
268
|
+
methods: {
|
|
269
|
+
focusElement: function focusElement() {
|
|
270
|
+
if (this.focusableElement) {
|
|
271
|
+
this.focusableElement.focus();
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
setOpen: function setOpen(nextOpen, isBlur) {
|
|
275
|
+
if (!this.isOpenControlled) {
|
|
276
|
+
if (!nextOpen && !isBlur && this.focusableElement) {
|
|
277
|
+
this.focusableElement.focus();
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
this.stateOpen = nextOpen;
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
onKeyDownHandler: function onKeyDownHandler(event) {
|
|
284
|
+
var altKey = event.altKey,
|
|
285
|
+
keyCode = event.keyCode;
|
|
286
|
+
|
|
287
|
+
if (keyCode === Keys.esc) {
|
|
288
|
+
this.setOpen(false);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (keyCode === Keys.enter && !this.isOpenControlled) {
|
|
293
|
+
event.preventDefault();
|
|
294
|
+
event.stopPropagation();
|
|
295
|
+
this.setOpen(!this.computedOpen);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if (altKey && (keyCode === Keys.up || keyCode === Keys.down)) {
|
|
300
|
+
event.preventDefault();
|
|
301
|
+
event.stopPropagation();
|
|
302
|
+
|
|
303
|
+
if (keyCode === Keys.up && this.focusableElement) {
|
|
304
|
+
this.focusableElement.focus();
|
|
305
|
+
this.setOpen(false);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (keyCode === Keys.down) {
|
|
309
|
+
this.setOpen(true);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
onOpenHandler: function onOpenHandler() {
|
|
314
|
+
// Skip content autofocus when in controlled mode
|
|
315
|
+
if (!this.isOpenControlled) {
|
|
316
|
+
if (this.palette) {
|
|
317
|
+
this.palette.focus();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
onClickHandler: function onClickHandler() {
|
|
322
|
+
this.setOpen(!this.computedOpen, true);
|
|
323
|
+
},
|
|
324
|
+
onActiveColorClickHandler: function onActiveColorClickHandler(event) {
|
|
325
|
+
this.$emit('activecolorclick', {
|
|
326
|
+
event: event,
|
|
327
|
+
value: this.computedValue
|
|
328
|
+
});
|
|
329
|
+
},
|
|
330
|
+
onFocusHandler: function onFocusHandler(event) {
|
|
331
|
+
if (this.blurTimeoutRef) {
|
|
332
|
+
clearTimeout(this.blurTimeoutRef);
|
|
333
|
+
this.blurTimeoutRef = undefined; // case where moving back to input from popup
|
|
334
|
+
// if (event.target === this.focusableElement) {
|
|
335
|
+
// this.setOpen(false); // in this case we should focus input on keydown
|
|
336
|
+
// }
|
|
337
|
+
} else {
|
|
338
|
+
this.focused = true;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
this.$emit('focus', {
|
|
342
|
+
event: event
|
|
343
|
+
});
|
|
344
|
+
},
|
|
345
|
+
onBlurTimeout: function onBlurTimeout() {
|
|
346
|
+
if (this.palette && document.activeElement !== this.palette.$el) {
|
|
347
|
+
this.setOpen(false, true);
|
|
348
|
+
this.focused = false;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
this.blurTimeoutRef = undefined;
|
|
352
|
+
},
|
|
353
|
+
onBlurHandler: function onBlurHandler(event) {
|
|
354
|
+
clearTimeout(this.blurTimeoutRef);
|
|
355
|
+
this.blurTimeoutRef = window.setTimeout(this.onBlurTimeout, 200);
|
|
356
|
+
this.$emit('blur', {
|
|
357
|
+
event: event
|
|
358
|
+
});
|
|
359
|
+
},
|
|
360
|
+
onChangeHandler: function onChangeHandler(event, isPalette) {
|
|
361
|
+
var currentValue = isPalette ? event.rgbaValue : event.value;
|
|
362
|
+
|
|
363
|
+
if (!this.isValueControlled) {
|
|
364
|
+
this.stateValue = currentValue;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (isPalette) {
|
|
368
|
+
this.setOpen(false);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
this.$emit('change', {
|
|
372
|
+
value: currentValue,
|
|
373
|
+
event: event
|
|
374
|
+
});
|
|
375
|
+
},
|
|
376
|
+
onPaletteChangeHandler: function onPaletteChangeHandler(event) {
|
|
377
|
+
this.onChangeHandler(event, true);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
var ColorPickerVue3 = ColorPicker;
|
|
382
|
+
export { ColorPicker, ColorPickerVue3 };
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { PickerProps } from './interfaces/PickerProps';
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export interface PickerState {
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export interface PickerComputed {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
export interface PickerMethods {
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
focus: (e: any) => void;
|
|
25
|
+
toggleIfApplicable: () => void;
|
|
26
|
+
handleClick: (event: any) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
export interface PickerData {
|
|
32
|
+
currentActive: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
export interface PickerAll extends Vue, PickerMethods, PickerData, PickerComputed, PickerState {
|
|
38
|
+
}
|
|
39
|
+
declare let Picker: ComponentOptions<PickerAll, DefaultData<PickerData>, DefaultMethods<PickerAll>, PickerComputed, RecordPropsDefinition<PickerProps>>;
|
|
40
|
+
declare const PickerVue3: DefineComponent<PickerProps, any, PickerData, PickerComputed, PickerMethods, {}, {}, {}, string, PickerProps, PickerProps, {}>;
|
|
41
|
+
export { Picker, PickerVue3 };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
import { Popup } from '@progress/kendo-vue-popup';
|
|
6
|
+
import { classNames, getDefaultSlots } from '@progress/kendo-vue-common';
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var ANCHOR_VERTICAL_ALIGN = 'bottom';
|
|
12
|
+
/**
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var POPUP_VERTICAL_ALIGN = 'top'; // tslint:enable:max-line-length
|
|
17
|
+
|
|
18
|
+
var Picker = {
|
|
19
|
+
name: 'KendoPicker',
|
|
20
|
+
props: {
|
|
21
|
+
popupSettings: Object,
|
|
22
|
+
dir: String,
|
|
23
|
+
open: Boolean,
|
|
24
|
+
popupAnchor: String
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
horizontalAlign: function horizontalAlign() {
|
|
28
|
+
return this.$props.dir === 'rtl' ? 'right' : 'left';
|
|
29
|
+
},
|
|
30
|
+
anchorAlign: function anchorAlign() {
|
|
31
|
+
return {
|
|
32
|
+
horizontal: this.horizontalAlign,
|
|
33
|
+
vertical: ANCHOR_VERTICAL_ALIGN
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
popupAlign: function popupAlign() {
|
|
37
|
+
return {
|
|
38
|
+
horizontal: this.horizontalAlign,
|
|
39
|
+
vertical: POPUP_VERTICAL_ALIGN
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
setup: !gh ? undefined : function () {
|
|
45
|
+
var v3 = !!gh;
|
|
46
|
+
return {
|
|
47
|
+
v3: v3
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
render: function render(createElement) {
|
|
52
|
+
var h = gh || createElement;
|
|
53
|
+
var defaultSlot = getDefaultSlots(this);
|
|
54
|
+
var popupSettings = this.$props.popupSettings || {};
|
|
55
|
+
return (// @ts-ignore function children
|
|
56
|
+
h(Popup // style={{
|
|
57
|
+
// ...(popupSettings || {}).style,
|
|
58
|
+
// direction: this.$props.dir as any
|
|
59
|
+
// }}
|
|
60
|
+
// {...popupSettings}
|
|
61
|
+
, {
|
|
62
|
+
anchor: this.$props.popupAnchor,
|
|
63
|
+
attrs: this.v3 ? undefined : {
|
|
64
|
+
anchor: this.$props.popupAnchor,
|
|
65
|
+
anchorAlign: this.anchorAlign,
|
|
66
|
+
popupAlign: this.popupAlign,
|
|
67
|
+
show: this.$props.open
|
|
68
|
+
},
|
|
69
|
+
anchorAlign: this.anchorAlign,
|
|
70
|
+
popupAlign: this.popupAlign,
|
|
71
|
+
show: this.$props.open,
|
|
72
|
+
onOpen: this.onOpen,
|
|
73
|
+
on: this.v3 ? undefined : {
|
|
74
|
+
"open": this.onOpen,
|
|
75
|
+
"close": this.onClose
|
|
76
|
+
},
|
|
77
|
+
onClose: this.onClose,
|
|
78
|
+
"class": classNames('k-reset', popupSettings.className)
|
|
79
|
+
}, this.v3 ? function () {
|
|
80
|
+
return [defaultSlot];
|
|
81
|
+
} : [defaultSlot])
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
methods: {
|
|
85
|
+
onOpen: function onOpen() {
|
|
86
|
+
this.$emit('open');
|
|
87
|
+
},
|
|
88
|
+
onClose: function onClose() {
|
|
89
|
+
this.$emit('close');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var PickerVue3 = Picker;
|
|
94
|
+
export { Picker, PickerVue3 };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The arguments for the `onChange` ColorPalette event.
|
|
3
|
+
*/
|
|
4
|
+
export interface ColorPaletteChangeEvent {
|
|
5
|
+
/**
|
|
6
|
+
* The current value of the ColorPalette.
|
|
7
|
+
*/
|
|
8
|
+
value: string;
|
|
9
|
+
/**
|
|
10
|
+
* The current value of the ColorPalette in RGBA format.
|
|
11
|
+
*/
|
|
12
|
+
rgbaValue: string;
|
|
13
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { TileSize } from '../models/tile-size';
|
|
2
|
+
import { ColorPaletteChangeEvent } from './ColorPaletteChangeEvent';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the props of the [KendoReact ColorPalette component]({% slug overview_colorpalette %}).
|
|
5
|
+
*/
|
|
6
|
+
export interface ColorPaletteProps {
|
|
7
|
+
/**
|
|
8
|
+
* The color palette that will be displayed.
|
|
9
|
+
*
|
|
10
|
+
* The supported values are:
|
|
11
|
+
* * The name of the predefined palette preset (for example, `office`, `basic`, and `apex`).
|
|
12
|
+
* * A string array.
|
|
13
|
+
*/
|
|
14
|
+
palette?: string[] | string;
|
|
15
|
+
/**
|
|
16
|
+
* Specifies the number of columns that will be displayed.
|
|
17
|
+
* Defaults to `10`.
|
|
18
|
+
*/
|
|
19
|
+
columns?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Specifies the size of a color cell in px.
|
|
22
|
+
* Defaults to `24`.
|
|
23
|
+
*/
|
|
24
|
+
tileSize?: number | TileSize;
|
|
25
|
+
/**
|
|
26
|
+
* The default value of the ColorPalette.
|
|
27
|
+
*/
|
|
28
|
+
defaultValue?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The value of the ColorPalette.
|
|
31
|
+
*/
|
|
32
|
+
value?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Determines whether the ColorPalette is disabled
|
|
35
|
+
* ([more information and example]({% slug disabled_colorpalette %})).
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```jsx
|
|
39
|
+
* class App extends React.Component {
|
|
40
|
+
* render() {
|
|
41
|
+
* return (
|
|
42
|
+
* <ColorPalette disabled={true} />
|
|
43
|
+
* );
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
46
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Sets the `tabIndex` property of the ColorPalette.
|
|
52
|
+
*/
|
|
53
|
+
tabIndex?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Specifies the id of the component.
|
|
56
|
+
*/
|
|
57
|
+
id?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
|
|
60
|
+
* For example these elements could contain error or hint message.
|
|
61
|
+
*/
|
|
62
|
+
ariaDescribedBy?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Identifies the element(s) which will label the component.
|
|
65
|
+
*/
|
|
66
|
+
ariaLabelledBy?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Determines the event handler that will be fired when the user edits the value.
|
|
69
|
+
*/
|
|
70
|
+
onChange?: (event: ColorPaletteChangeEvent) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Represent the focus event of the ColorPalette.
|
|
73
|
+
*/
|
|
74
|
+
onFocus?: (event: FocusEvent) => void;
|
|
75
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TileSize } from '../models/tile-size';
|
|
2
|
+
/**
|
|
3
|
+
* The settings of the ColorPalette that is nested inside the popup of the ColorPicker
|
|
4
|
+
* ([see example]({% slug customizecolorpicker_colorpicker %}#toc-customizing-the-palette-popup)).
|
|
5
|
+
*/
|
|
6
|
+
export interface ColorPickerPaletteSettings {
|
|
7
|
+
/**
|
|
8
|
+
* Specifies the set of colors.
|
|
9
|
+
* Provides a set of predefined palette presets (for example, `office`, `basic`, and `apex`)
|
|
10
|
+
* and enables you to implement a custom color palette.
|
|
11
|
+
* Defaults to the `office` preset.
|
|
12
|
+
*
|
|
13
|
+
* The supported values are:
|
|
14
|
+
* * The name of the predefined palette preset (for example, `office`, `basic`, and `apex`).
|
|
15
|
+
* * A string with comma-separated colors.
|
|
16
|
+
* * A string array.
|
|
17
|
+
*/
|
|
18
|
+
palette?: string | Array<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the number of columns that will be displayed.
|
|
21
|
+
* Defaults to `10`.
|
|
22
|
+
*/
|
|
23
|
+
columns?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Specifies the size of a color cell.
|
|
26
|
+
*
|
|
27
|
+
* The possible values are:
|
|
28
|
+
* * (Default) `24`
|
|
29
|
+
* * `{ width: number, height: number }`
|
|
30
|
+
*/
|
|
31
|
+
tileSize?: number | TileSize;
|
|
32
|
+
}
|