@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,395 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColorPickerVue3 = exports.ColorPicker = void 0; // @ts-ignore
|
|
7
|
+
|
|
8
|
+
var Vue = require("vue");
|
|
9
|
+
|
|
10
|
+
var allVue = Vue;
|
|
11
|
+
var gh = allVue.h;
|
|
12
|
+
|
|
13
|
+
var kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
14
|
+
|
|
15
|
+
var kendo_vue_common_2 = require("@progress/kendo-vue-common");
|
|
16
|
+
|
|
17
|
+
var package_metadata_1 = require("../package-metadata");
|
|
18
|
+
|
|
19
|
+
var Picker_1 = require("./Picker");
|
|
20
|
+
|
|
21
|
+
var ColorPalette_1 = require("./ColorPalette");
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var DEFAULT_GRADIENT_SETTINGS = {
|
|
28
|
+
opacity: true
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
var DEFAULT_PALETTE_SETTINGS = {
|
|
35
|
+
palette: ColorPalette_1.DEFAULT_PRESET,
|
|
36
|
+
tileSize: ColorPalette_1.DEFAULT_TILE_SIZE
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* @hidden
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
var isControlled = function isControlled(prop) {
|
|
43
|
+
return prop !== undefined;
|
|
44
|
+
}; // tslint:enable:max-line-length
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
var ColorPicker = {
|
|
48
|
+
name: 'KendoColorPicker',
|
|
49
|
+
props: {
|
|
50
|
+
value: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: undefined
|
|
53
|
+
},
|
|
54
|
+
defaultValue: String,
|
|
55
|
+
disabled: Boolean,
|
|
56
|
+
dir: String,
|
|
57
|
+
id: String,
|
|
58
|
+
ariaLabelledBy: String,
|
|
59
|
+
ariaDescribedBy: String,
|
|
60
|
+
paletteSettings: {
|
|
61
|
+
type: Object,
|
|
62
|
+
default: function _default() {
|
|
63
|
+
return DEFAULT_PALETTE_SETTINGS;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
valid: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: true
|
|
69
|
+
},
|
|
70
|
+
tabIndex: {
|
|
71
|
+
type: Number,
|
|
72
|
+
default: 0
|
|
73
|
+
},
|
|
74
|
+
title: String,
|
|
75
|
+
icon: String,
|
|
76
|
+
iconClassName: String,
|
|
77
|
+
popupSettings: Object,
|
|
78
|
+
open: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: undefined
|
|
81
|
+
},
|
|
82
|
+
size: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: 'medium',
|
|
85
|
+
validator: function validator(value) {
|
|
86
|
+
return [null, 'small', 'medium', 'large'].includes(value);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
rounded: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: 'medium',
|
|
92
|
+
validator: function validator(value) {
|
|
93
|
+
return [null, 'small', 'medium', 'large', 'pill'].includes(value);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
fillMode: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: 'solid',
|
|
99
|
+
validator: function validator(value) {
|
|
100
|
+
return [null, 'solid', 'flat', 'outline'].includes(value);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
data: function data() {
|
|
105
|
+
return {
|
|
106
|
+
focused: false,
|
|
107
|
+
stateValue: '',
|
|
108
|
+
stateOpen: false
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
computed: {
|
|
112
|
+
isValueControlled: function isValueControlled() {
|
|
113
|
+
return isControlled(this.$props.value);
|
|
114
|
+
},
|
|
115
|
+
isOpenControlled: function isOpenControlled() {
|
|
116
|
+
return isControlled(this.$props.open);
|
|
117
|
+
},
|
|
118
|
+
computedValue: function computedValue() {
|
|
119
|
+
return this.isValueControlled ? this.$props.value : this.stateValue;
|
|
120
|
+
},
|
|
121
|
+
computedOpen: function computedOpen() {
|
|
122
|
+
return this.isOpenControlled ? this.$props.open : this.stateOpen;
|
|
123
|
+
},
|
|
124
|
+
computedIconClassName: function computedIconClassName() {
|
|
125
|
+
var icon = this.$props.icon;
|
|
126
|
+
return this.$props.iconClassName || icon && "k-icon k-i-" + icon;
|
|
127
|
+
},
|
|
128
|
+
wrapperClassName: function wrapperClassName() {
|
|
129
|
+
return {
|
|
130
|
+
'k-widget': true,
|
|
131
|
+
'k-colorpicker': true,
|
|
132
|
+
'k-state-invalid': this.valid === false
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
spanClassName: function spanClassName() {
|
|
136
|
+
var disabled = this.$props.disabled;
|
|
137
|
+
return {
|
|
138
|
+
'k-picker-wrap': true,
|
|
139
|
+
'k-state-disabled': disabled,
|
|
140
|
+
'k-state-focused': this.focused
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
created: function created() {
|
|
145
|
+
kendo_vue_common_2.validatePackage(package_metadata_1.packageMetadata);
|
|
146
|
+
this.focusableElementGuid = kendo_vue_common_1.guid();
|
|
147
|
+
},
|
|
148
|
+
mounted: function mounted() {
|
|
149
|
+
this.focusableElement = this.$refs[this.focusableElementGuid];
|
|
150
|
+
this.button = this.v3 ? this.buttonRef : this.$refs.button;
|
|
151
|
+
this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
|
|
152
|
+
},
|
|
153
|
+
updated: function updated() {
|
|
154
|
+
this.button = this.v3 ? this.buttonRef : this.$refs.button;
|
|
155
|
+
this.palette = this.v3 ? this.paletteRef : this.$refs.palette;
|
|
156
|
+
},
|
|
157
|
+
// @ts-ignore
|
|
158
|
+
setup: !gh ? undefined : function () {
|
|
159
|
+
var v3 = !!gh;
|
|
160
|
+
return {
|
|
161
|
+
v3: v3
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
// @ts-ignore
|
|
165
|
+
render: function render(createElement) {
|
|
166
|
+
var _this2 = this;
|
|
167
|
+
|
|
168
|
+
var _this = this;
|
|
169
|
+
|
|
170
|
+
var h = gh || createElement;
|
|
171
|
+
var _a = this.$props,
|
|
172
|
+
disabled = _a.disabled,
|
|
173
|
+
tabIndex = _a.tabIndex; // const dir = useDir(focusableElementGuid, props.dir);
|
|
174
|
+
|
|
175
|
+
return h("span", {
|
|
176
|
+
"class": this.wrapperClassName
|
|
177
|
+
}, [h("span", {
|
|
178
|
+
id: this.$props.id,
|
|
179
|
+
attrs: this.v3 ? undefined : {
|
|
180
|
+
id: this.$props.id,
|
|
181
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
182
|
+
"aria-describedby": this.$props.ariaDescribedBy,
|
|
183
|
+
tabIndex: kendo_vue_common_1.getTabIndex(tabIndex, disabled),
|
|
184
|
+
title: this.$props.title
|
|
185
|
+
},
|
|
186
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
187
|
+
"aria-describedby": this.$props.ariaDescribedBy,
|
|
188
|
+
"class": this.spanClassName,
|
|
189
|
+
ref: this.focusableElementGuid,
|
|
190
|
+
tabIndex: kendo_vue_common_1.getTabIndex(tabIndex, disabled),
|
|
191
|
+
title: this.$props.title,
|
|
192
|
+
onKeydown: this.onKeyDownHandler,
|
|
193
|
+
on: this.v3 ? undefined : {
|
|
194
|
+
"keydown": this.onKeyDownHandler,
|
|
195
|
+
"focusin": this.onFocusHandler,
|
|
196
|
+
"focusout": this.onBlurHandler
|
|
197
|
+
},
|
|
198
|
+
onFocusin: this.onFocusHandler,
|
|
199
|
+
onFocusout: this.onBlurHandler
|
|
200
|
+
}, [!this.computedIconClassName ? h("span", {
|
|
201
|
+
onClick: this.onActiveColorClickHandler,
|
|
202
|
+
on: this.v3 ? undefined : {
|
|
203
|
+
"click": this.onActiveColorClickHandler
|
|
204
|
+
},
|
|
205
|
+
"class": 'k-selected-color',
|
|
206
|
+
style: {
|
|
207
|
+
backgroundColor: this.computedValue
|
|
208
|
+
}
|
|
209
|
+
}, [!this.computedValue && h("span", {
|
|
210
|
+
"class": 'k-icon k-i-line'
|
|
211
|
+
})]) : h("span", {
|
|
212
|
+
onClick: this.onActiveColorClickHandler,
|
|
213
|
+
on: this.v3 ? undefined : {
|
|
214
|
+
"click": this.onActiveColorClickHandler
|
|
215
|
+
},
|
|
216
|
+
"class": kendo_vue_common_1.classNames('k-tool-icon', this.computedIconClassName)
|
|
217
|
+
}, [h("span", {
|
|
218
|
+
"class": 'k-selected-color',
|
|
219
|
+
style: {
|
|
220
|
+
backgroundColor: this.computedValue
|
|
221
|
+
}
|
|
222
|
+
})]), h("span", {
|
|
223
|
+
onClick: this.onClickHandler,
|
|
224
|
+
on: this.v3 ? undefined : {
|
|
225
|
+
"click": this.onClickHandler
|
|
226
|
+
},
|
|
227
|
+
"class": 'k-select',
|
|
228
|
+
ref: this.v3 ? function (el) {
|
|
229
|
+
_this.buttonRef = el;
|
|
230
|
+
} : 'button'
|
|
231
|
+
}, [h("span", {
|
|
232
|
+
"class": 'k-icon k-i-arrow-s'
|
|
233
|
+
})]), // @ts-ignore function children
|
|
234
|
+
h(Picker_1.Picker, {
|
|
235
|
+
// dir={dir}
|
|
236
|
+
open: this.computedOpen,
|
|
237
|
+
attrs: this.v3 ? undefined : {
|
|
238
|
+
open: this.computedOpen,
|
|
239
|
+
popupAnchor: this.focusableElementGuid
|
|
240
|
+
},
|
|
241
|
+
onOpen: this.onOpenHandler,
|
|
242
|
+
on: this.v3 ? undefined : {
|
|
243
|
+
"open": this.onOpenHandler
|
|
244
|
+
},
|
|
245
|
+
popupAnchor: this.focusableElementGuid
|
|
246
|
+
}, this.v3 ? function () {
|
|
247
|
+
return [// @ts-ignore function children
|
|
248
|
+
h(ColorPalette_1.ColorPalette, {
|
|
249
|
+
onKeydown: _this2.onKeyDownHandler // {...paletteSettings}
|
|
250
|
+
,
|
|
251
|
+
on: _this2.v3 ? undefined : {
|
|
252
|
+
"keydown": _this2.onKeyDownHandler,
|
|
253
|
+
"change": _this2.onPaletteChangeHandler
|
|
254
|
+
},
|
|
255
|
+
ref: _this2.v3 ? function (el) {
|
|
256
|
+
_this.paletteRef = el;
|
|
257
|
+
} : 'palette',
|
|
258
|
+
value: _this2.computedValue || undefined,
|
|
259
|
+
attrs: _this2.v3 ? undefined : {
|
|
260
|
+
value: _this2.computedValue || undefined
|
|
261
|
+
},
|
|
262
|
+
onChange: _this2.onPaletteChangeHandler
|
|
263
|
+
})];
|
|
264
|
+
} : [h(ColorPalette_1.ColorPalette, {
|
|
265
|
+
onKeydown: _this2.onKeyDownHandler,
|
|
266
|
+
on: _this2.v3 ? undefined : {
|
|
267
|
+
"keydown": _this2.onKeyDownHandler,
|
|
268
|
+
"change": _this2.onPaletteChangeHandler
|
|
269
|
+
},
|
|
270
|
+
ref: _this2.v3 ? function (el) {
|
|
271
|
+
_this.paletteRef = el;
|
|
272
|
+
} : 'palette',
|
|
273
|
+
value: _this2.computedValue || undefined,
|
|
274
|
+
attrs: _this2.v3 ? undefined : {
|
|
275
|
+
value: _this2.computedValue || undefined
|
|
276
|
+
},
|
|
277
|
+
onChange: _this2.onPaletteChangeHandler
|
|
278
|
+
})])])]);
|
|
279
|
+
},
|
|
280
|
+
methods: {
|
|
281
|
+
focusElement: function focusElement() {
|
|
282
|
+
if (this.focusableElement) {
|
|
283
|
+
this.focusableElement.focus();
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
setOpen: function setOpen(nextOpen, isBlur) {
|
|
287
|
+
if (!this.isOpenControlled) {
|
|
288
|
+
if (!nextOpen && !isBlur && this.focusableElement) {
|
|
289
|
+
this.focusableElement.focus();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
this.stateOpen = nextOpen;
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
onKeyDownHandler: function onKeyDownHandler(event) {
|
|
296
|
+
var altKey = event.altKey,
|
|
297
|
+
keyCode = event.keyCode;
|
|
298
|
+
|
|
299
|
+
if (keyCode === kendo_vue_common_1.Keys.esc) {
|
|
300
|
+
this.setOpen(false);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (keyCode === kendo_vue_common_1.Keys.enter && !this.isOpenControlled) {
|
|
305
|
+
event.preventDefault();
|
|
306
|
+
event.stopPropagation();
|
|
307
|
+
this.setOpen(!this.computedOpen);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (altKey && (keyCode === kendo_vue_common_1.Keys.up || keyCode === kendo_vue_common_1.Keys.down)) {
|
|
312
|
+
event.preventDefault();
|
|
313
|
+
event.stopPropagation();
|
|
314
|
+
|
|
315
|
+
if (keyCode === kendo_vue_common_1.Keys.up && this.focusableElement) {
|
|
316
|
+
this.focusableElement.focus();
|
|
317
|
+
this.setOpen(false);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (keyCode === kendo_vue_common_1.Keys.down) {
|
|
321
|
+
this.setOpen(true);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
onOpenHandler: function onOpenHandler() {
|
|
326
|
+
// Skip content autofocus when in controlled mode
|
|
327
|
+
if (!this.isOpenControlled) {
|
|
328
|
+
if (this.palette) {
|
|
329
|
+
this.palette.focus();
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
onClickHandler: function onClickHandler() {
|
|
334
|
+
this.setOpen(!this.computedOpen, true);
|
|
335
|
+
},
|
|
336
|
+
onActiveColorClickHandler: function onActiveColorClickHandler(event) {
|
|
337
|
+
this.$emit('activecolorclick', {
|
|
338
|
+
event: event,
|
|
339
|
+
value: this.computedValue
|
|
340
|
+
});
|
|
341
|
+
},
|
|
342
|
+
onFocusHandler: function onFocusHandler(event) {
|
|
343
|
+
if (this.blurTimeoutRef) {
|
|
344
|
+
clearTimeout(this.blurTimeoutRef);
|
|
345
|
+
this.blurTimeoutRef = undefined; // case where moving back to input from popup
|
|
346
|
+
// if (event.target === this.focusableElement) {
|
|
347
|
+
// this.setOpen(false); // in this case we should focus input on keydown
|
|
348
|
+
// }
|
|
349
|
+
} else {
|
|
350
|
+
this.focused = true;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
this.$emit('focus', {
|
|
354
|
+
event: event
|
|
355
|
+
});
|
|
356
|
+
},
|
|
357
|
+
onBlurTimeout: function onBlurTimeout() {
|
|
358
|
+
if (this.palette && document.activeElement !== this.palette.$el) {
|
|
359
|
+
this.setOpen(false, true);
|
|
360
|
+
this.focused = false;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
this.blurTimeoutRef = undefined;
|
|
364
|
+
},
|
|
365
|
+
onBlurHandler: function onBlurHandler(event) {
|
|
366
|
+
clearTimeout(this.blurTimeoutRef);
|
|
367
|
+
this.blurTimeoutRef = window.setTimeout(this.onBlurTimeout, 200);
|
|
368
|
+
this.$emit('blur', {
|
|
369
|
+
event: event
|
|
370
|
+
});
|
|
371
|
+
},
|
|
372
|
+
onChangeHandler: function onChangeHandler(event, isPalette) {
|
|
373
|
+
var currentValue = isPalette ? event.rgbaValue : event.value;
|
|
374
|
+
|
|
375
|
+
if (!this.isValueControlled) {
|
|
376
|
+
this.stateValue = currentValue;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
if (isPalette) {
|
|
380
|
+
this.setOpen(false);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
this.$emit('change', {
|
|
384
|
+
value: currentValue,
|
|
385
|
+
event: event
|
|
386
|
+
});
|
|
387
|
+
},
|
|
388
|
+
onPaletteChangeHandler: function onPaletteChangeHandler(event) {
|
|
389
|
+
this.onChangeHandler(event, true);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
exports.ColorPicker = ColorPicker;
|
|
394
|
+
var ColorPickerVue3 = ColorPicker;
|
|
395
|
+
exports.ColorPickerVue3 = 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,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PickerVue3 = exports.Picker = void 0; // @ts-ignore
|
|
7
|
+
|
|
8
|
+
var Vue = require("vue");
|
|
9
|
+
|
|
10
|
+
var allVue = Vue;
|
|
11
|
+
var gh = allVue.h;
|
|
12
|
+
|
|
13
|
+
var kendo_vue_popup_1 = require("@progress/kendo-vue-popup");
|
|
14
|
+
|
|
15
|
+
var kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
16
|
+
/**
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var ANCHOR_VERTICAL_ALIGN = 'bottom';
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var POPUP_VERTICAL_ALIGN = 'top'; // tslint:enable:max-line-length
|
|
27
|
+
|
|
28
|
+
var Picker = {
|
|
29
|
+
name: 'KendoPicker',
|
|
30
|
+
props: {
|
|
31
|
+
popupSettings: Object,
|
|
32
|
+
dir: String,
|
|
33
|
+
open: Boolean,
|
|
34
|
+
popupAnchor: String
|
|
35
|
+
},
|
|
36
|
+
computed: {
|
|
37
|
+
horizontalAlign: function horizontalAlign() {
|
|
38
|
+
return this.$props.dir === 'rtl' ? 'right' : 'left';
|
|
39
|
+
},
|
|
40
|
+
anchorAlign: function anchorAlign() {
|
|
41
|
+
return {
|
|
42
|
+
horizontal: this.horizontalAlign,
|
|
43
|
+
vertical: ANCHOR_VERTICAL_ALIGN
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
popupAlign: function popupAlign() {
|
|
47
|
+
return {
|
|
48
|
+
horizontal: this.horizontalAlign,
|
|
49
|
+
vertical: POPUP_VERTICAL_ALIGN
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
setup: !gh ? undefined : function () {
|
|
55
|
+
var v3 = !!gh;
|
|
56
|
+
return {
|
|
57
|
+
v3: v3
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
render: function render(createElement) {
|
|
62
|
+
var h = gh || createElement;
|
|
63
|
+
var defaultSlot = kendo_vue_common_1.getDefaultSlots(this);
|
|
64
|
+
var popupSettings = this.$props.popupSettings || {};
|
|
65
|
+
return (// @ts-ignore function children
|
|
66
|
+
h(kendo_vue_popup_1.Popup, {
|
|
67
|
+
// style={{
|
|
68
|
+
// ...(popupSettings || {}).style,
|
|
69
|
+
// direction: this.$props.dir as any
|
|
70
|
+
// }}
|
|
71
|
+
// {...popupSettings}
|
|
72
|
+
anchor: this.$props.popupAnchor,
|
|
73
|
+
attrs: this.v3 ? undefined : {
|
|
74
|
+
anchor: this.$props.popupAnchor,
|
|
75
|
+
anchorAlign: this.anchorAlign,
|
|
76
|
+
popupAlign: this.popupAlign,
|
|
77
|
+
show: this.$props.open
|
|
78
|
+
},
|
|
79
|
+
anchorAlign: this.anchorAlign,
|
|
80
|
+
popupAlign: this.popupAlign,
|
|
81
|
+
show: this.$props.open,
|
|
82
|
+
onOpen: this.onOpen,
|
|
83
|
+
on: this.v3 ? undefined : {
|
|
84
|
+
"open": this.onOpen,
|
|
85
|
+
"close": this.onClose
|
|
86
|
+
},
|
|
87
|
+
onClose: this.onClose,
|
|
88
|
+
"class": kendo_vue_common_1.classNames('k-reset', popupSettings.className)
|
|
89
|
+
}, this.v3 ? function () {
|
|
90
|
+
return [defaultSlot];
|
|
91
|
+
} : [defaultSlot])
|
|
92
|
+
);
|
|
93
|
+
},
|
|
94
|
+
methods: {
|
|
95
|
+
onOpen: function onOpen() {
|
|
96
|
+
this.$emit('open');
|
|
97
|
+
},
|
|
98
|
+
onClose: function onClose() {
|
|
99
|
+
this.$emit('close');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
exports.Picker = Picker;
|
|
104
|
+
var PickerVue3 = Picker;
|
|
105
|
+
exports.PickerVue3 = 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
|
+
}
|
|
@@ -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
|
+
}
|