@progress/kendo-vue-inputs 3.3.6 → 3.4.1-dev.202206280838
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/ColorContrastLabels.d.ts +49 -0
- package/dist/es/colors/ColorContrastLabels.js +79 -0
- package/dist/es/colors/ColorContrastSvg.d.ts +50 -0
- package/dist/es/colors/ColorContrastSvg.js +108 -0
- package/dist/es/colors/ColorGradient.d.ts +51 -0
- package/dist/es/colors/ColorGradient.js +407 -0
- package/dist/es/colors/ColorInput.d.ts +54 -0
- package/dist/es/colors/ColorInput.js +268 -0
- package/dist/es/colors/FlatColorPicker.d.ts +103 -0
- package/dist/es/colors/FlatColorPicker.js +294 -0
- package/dist/es/colors/HexInput.d.ts +51 -0
- package/dist/es/colors/HexInput.js +71 -0
- package/dist/es/colors/interfaces/ColorGradientChangeEvent.d.ts +9 -0
- package/dist/es/colors/interfaces/ColorGradientChangeEvent.js +0 -0
- package/dist/es/colors/interfaces/ColorGradientProps.d.ts +56 -0
- package/dist/es/colors/interfaces/ColorGradientProps.js +0 -0
- package/dist/es/input-separator/InputSeparator.d.ts +8 -1
- package/dist/es/input-separator/InputSeparator.js +8 -1
- package/dist/es/main.d.ts +1 -0
- package/dist/es/main.js +1 -0
- package/dist/es/messages/index.d.ts +15 -0
- package/dist/es/messages/index.js +15 -0
- package/dist/es/numerictextbox/NumericTextBox.d.ts +4 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/range-slider/RangeSlider.js +2 -2
- package/dist/es/slider/Slider.d.ts +4 -0
- package/dist/npm/colors/ColorContrastLabels.d.ts +49 -0
- package/dist/npm/colors/ColorContrastLabels.js +91 -0
- package/dist/npm/colors/ColorContrastSvg.d.ts +50 -0
- package/dist/npm/colors/ColorContrastSvg.js +119 -0
- package/dist/npm/colors/ColorGradient.d.ts +51 -0
- package/dist/npm/colors/ColorGradient.js +426 -0
- package/dist/npm/colors/ColorInput.d.ts +54 -0
- package/dist/npm/colors/ColorInput.js +283 -0
- package/dist/npm/colors/FlatColorPicker.d.ts +103 -0
- package/dist/npm/colors/FlatColorPicker.js +309 -0
- package/dist/npm/colors/HexInput.d.ts +51 -0
- package/dist/npm/colors/HexInput.js +83 -0
- package/dist/npm/colors/interfaces/ColorGradientChangeEvent.d.ts +9 -0
- package/dist/npm/colors/interfaces/ColorGradientChangeEvent.js +2 -0
- package/dist/npm/colors/interfaces/ColorGradientProps.d.ts +56 -0
- package/dist/npm/colors/interfaces/ColorGradientProps.js +2 -0
- package/dist/npm/input-separator/InputSeparator.d.ts +8 -1
- package/dist/npm/input-separator/InputSeparator.js +8 -1
- package/dist/npm/main.d.ts +1 -0
- package/dist/npm/main.js +1 -0
- package/dist/npm/messages/index.d.ts +15 -0
- package/dist/npm/messages/index.js +16 -1
- package/dist/npm/numerictextbox/NumericTextBox.d.ts +4 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/range-slider/RangeSlider.js +2 -2
- package/dist/npm/slider/Slider.d.ts +4 -0
- package/package.json +11 -11
|
@@ -0,0 +1,268 @@
|
|
|
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
|
+
|
|
18
|
+
import * as Vue from 'vue';
|
|
19
|
+
var allVue = Vue;
|
|
20
|
+
var gh = allVue.h;
|
|
21
|
+
import { NumericTextBox } from '../main';
|
|
22
|
+
import { HexInput } from './HexInput';
|
|
23
|
+
import { Button } from '@progress/kendo-vue-buttons';
|
|
24
|
+
import { Label } from '@progress/kendo-vue-labels';
|
|
25
|
+
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
26
|
+
import { messages, colorGradientR, colorGradientHex, colorGradientA, colorGradientB, colorGradientG } from '../messages';
|
|
27
|
+
/**
|
|
28
|
+
* @hidden
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
var modes = ['rgba', 'rgb', 'hex'];
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
var ColorInputVue2 = {
|
|
37
|
+
name: 'KendoColorInput',
|
|
38
|
+
props: {
|
|
39
|
+
rgba: Object,
|
|
40
|
+
hex: String,
|
|
41
|
+
opacity: Boolean,
|
|
42
|
+
disabled: Boolean
|
|
43
|
+
},
|
|
44
|
+
data: function data() {
|
|
45
|
+
return {
|
|
46
|
+
inputMode: modes[1]
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
setup: !gh ? undefined : function () {
|
|
51
|
+
var v3 = !!gh;
|
|
52
|
+
return {
|
|
53
|
+
v3: v3
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
render: function render(createElement) {
|
|
58
|
+
var h = gh || createElement;
|
|
59
|
+
var localizationService = provideLocalizationService(this);
|
|
60
|
+
var hexMessage = localizationService.toLanguageString(colorGradientR, messages[colorGradientHex]);
|
|
61
|
+
var rMessage = localizationService.toLanguageString(colorGradientR, messages[colorGradientR]);
|
|
62
|
+
var gMessage = localizationService.toLanguageString(colorGradientR, messages[colorGradientG]);
|
|
63
|
+
var bMessage = localizationService.toLanguageString(colorGradientR, messages[colorGradientB]);
|
|
64
|
+
var aMessage = localizationService.toLanguageString(colorGradientR, messages[colorGradientA]);
|
|
65
|
+
return h("div", {
|
|
66
|
+
"class": "k-colorgradient-inputs k-hstack"
|
|
67
|
+
}, [h("div", {
|
|
68
|
+
"class": "k-vstack"
|
|
69
|
+
}, [h(Button, {
|
|
70
|
+
fillMode: 'flat',
|
|
71
|
+
attrs: this.v3 ? undefined : {
|
|
72
|
+
fillMode: 'flat',
|
|
73
|
+
icon: 'arrows-kpi'
|
|
74
|
+
},
|
|
75
|
+
icon: 'arrows-kpi',
|
|
76
|
+
"class": "k-colorgradient-toggle-mode k-icon-button",
|
|
77
|
+
onClick: this.onToggleModeChange.bind(this),
|
|
78
|
+
on: this.v3 ? undefined : {
|
|
79
|
+
"click": this.onToggleModeChange.bind(this)
|
|
80
|
+
}
|
|
81
|
+
})]), this.inputMode === 'hex' && h("div", {
|
|
82
|
+
"class": "k-vstack k-flex-1"
|
|
83
|
+
}, [h("span", {
|
|
84
|
+
"class": "k-hex-value k-textbox k-input"
|
|
85
|
+
}, [h(HexInput, {
|
|
86
|
+
hex: this.$props.hex,
|
|
87
|
+
attrs: this.v3 ? undefined : {
|
|
88
|
+
hex: this.$props.hex,
|
|
89
|
+
disabled: this.$props.disabled
|
|
90
|
+
},
|
|
91
|
+
onHexChange: this.$props.onHexChange,
|
|
92
|
+
on: this.v3 ? undefined : {
|
|
93
|
+
"hexChange": this.$props.onHexChange
|
|
94
|
+
},
|
|
95
|
+
disabled: this.$props.disabled
|
|
96
|
+
})]), // @ts-ignore function children
|
|
97
|
+
h(Label, {
|
|
98
|
+
"class": "k-colorgradient-input-label"
|
|
99
|
+
}, this.v3 ? function () {
|
|
100
|
+
return [hexMessage];
|
|
101
|
+
} : [hexMessage])]), (this.inputMode === 'rgb' || this.inputMode === 'rgba') && [h("div", {
|
|
102
|
+
"class": "k-vstack"
|
|
103
|
+
}, [h(NumericTextBox, {
|
|
104
|
+
value: this.$props.rgba.r,
|
|
105
|
+
attrs: this.v3 ? undefined : {
|
|
106
|
+
value: this.$props.rgba.r,
|
|
107
|
+
min: 0,
|
|
108
|
+
max: 255,
|
|
109
|
+
spinners: false,
|
|
110
|
+
format: "n",
|
|
111
|
+
disabled: this.$props.disabled
|
|
112
|
+
},
|
|
113
|
+
min: 0,
|
|
114
|
+
max: 255,
|
|
115
|
+
spinners: false,
|
|
116
|
+
format: "n",
|
|
117
|
+
onChange: this.onRgbaRChange,
|
|
118
|
+
on: this.v3 ? undefined : {
|
|
119
|
+
"change": this.onRgbaRChange
|
|
120
|
+
},
|
|
121
|
+
disabled: this.$props.disabled
|
|
122
|
+
}), // @ts-ignore function children
|
|
123
|
+
h(Label, {
|
|
124
|
+
"class": "k-colorgradient-input-label"
|
|
125
|
+
}, this.v3 ? function () {
|
|
126
|
+
return [rMessage];
|
|
127
|
+
} : [rMessage])]), h("div", {
|
|
128
|
+
"class": "k-vstack"
|
|
129
|
+
}, [h(NumericTextBox, {
|
|
130
|
+
value: this.$props.rgba.g,
|
|
131
|
+
attrs: this.v3 ? undefined : {
|
|
132
|
+
value: this.$props.rgba.g,
|
|
133
|
+
min: 0,
|
|
134
|
+
max: 255,
|
|
135
|
+
spinners: false,
|
|
136
|
+
format: "n",
|
|
137
|
+
disabled: this.$props.disabled
|
|
138
|
+
},
|
|
139
|
+
min: 0,
|
|
140
|
+
max: 255,
|
|
141
|
+
spinners: false,
|
|
142
|
+
format: "n",
|
|
143
|
+
onChange: this.onRgbaGChange,
|
|
144
|
+
on: this.v3 ? undefined : {
|
|
145
|
+
"change": this.onRgbaGChange
|
|
146
|
+
},
|
|
147
|
+
disabled: this.$props.disabled
|
|
148
|
+
}), // @ts-ignore function children
|
|
149
|
+
h(Label, {
|
|
150
|
+
"class": "k-colorgradient-input-label"
|
|
151
|
+
}, this.v3 ? function () {
|
|
152
|
+
return [gMessage];
|
|
153
|
+
} : [gMessage])]), h("div", {
|
|
154
|
+
"class": "k-vstack"
|
|
155
|
+
}, [h(NumericTextBox, {
|
|
156
|
+
value: this.$props.rgba.b,
|
|
157
|
+
attrs: this.v3 ? undefined : {
|
|
158
|
+
value: this.$props.rgba.b,
|
|
159
|
+
min: 0,
|
|
160
|
+
max: 255,
|
|
161
|
+
spinners: false,
|
|
162
|
+
format: "n",
|
|
163
|
+
disabled: this.$props.disabled
|
|
164
|
+
},
|
|
165
|
+
min: 0,
|
|
166
|
+
max: 255,
|
|
167
|
+
spinners: false,
|
|
168
|
+
format: "n",
|
|
169
|
+
onChange: this.onRgbaBChange,
|
|
170
|
+
on: this.v3 ? undefined : {
|
|
171
|
+
"change": this.onRgbaBChange
|
|
172
|
+
},
|
|
173
|
+
disabled: this.$props.disabled
|
|
174
|
+
}), // @ts-ignore function children
|
|
175
|
+
h(Label, {
|
|
176
|
+
"class": "k-colorgradient-input-label"
|
|
177
|
+
}, this.v3 ? function () {
|
|
178
|
+
return [bMessage];
|
|
179
|
+
} : [bMessage])])], this.inputMode === 'rgba' && h("div", {
|
|
180
|
+
"class": "k-vstack"
|
|
181
|
+
}, [this.$props.opacity && h(NumericTextBox, {
|
|
182
|
+
value: this.$props.rgba.a,
|
|
183
|
+
attrs: this.v3 ? undefined : {
|
|
184
|
+
value: this.$props.rgba.a,
|
|
185
|
+
min: 0,
|
|
186
|
+
max: 1,
|
|
187
|
+
step: 0.01,
|
|
188
|
+
spinners: false,
|
|
189
|
+
format: "n2",
|
|
190
|
+
disabled: this.$props.disabled
|
|
191
|
+
},
|
|
192
|
+
min: 0,
|
|
193
|
+
max: 1,
|
|
194
|
+
step: 0.01,
|
|
195
|
+
spinners: false,
|
|
196
|
+
format: "n2",
|
|
197
|
+
onChange: this.onRgbaAChange,
|
|
198
|
+
on: this.v3 ? undefined : {
|
|
199
|
+
"change": this.onRgbaAChange
|
|
200
|
+
},
|
|
201
|
+
disabled: this.$props.disabled
|
|
202
|
+
}), "(this.$props.opacity &&", // @ts-ignore function children
|
|
203
|
+
h(Label, {
|
|
204
|
+
"class": "k-colorgradient-input-label"
|
|
205
|
+
}, this.v3 ? function () {
|
|
206
|
+
return [aMessage];
|
|
207
|
+
} : [aMessage]), ")"])]);
|
|
208
|
+
},
|
|
209
|
+
methods: {
|
|
210
|
+
onRgbaRChange: function onRgbaRChange(event) {
|
|
211
|
+
this.dispatchRgbaChange({
|
|
212
|
+
r: event.value
|
|
213
|
+
}, event);
|
|
214
|
+
},
|
|
215
|
+
onRgbaGChange: function onRgbaGChange(event) {
|
|
216
|
+
this.dispatchRgbaChange({
|
|
217
|
+
g: event.value
|
|
218
|
+
}, event);
|
|
219
|
+
},
|
|
220
|
+
onRgbaBChange: function onRgbaBChange(event) {
|
|
221
|
+
this.dispatchRgbaChange({
|
|
222
|
+
b: event.value
|
|
223
|
+
}, event);
|
|
224
|
+
},
|
|
225
|
+
onRgbaAChange: function onRgbaAChange(event) {
|
|
226
|
+
this.dispatchRgbaChange({
|
|
227
|
+
a: event.value
|
|
228
|
+
}, event);
|
|
229
|
+
},
|
|
230
|
+
dispatchRgbaChange: function dispatchRgbaChange(newValue, event) {
|
|
231
|
+
var rgba = __assign({}, this.$props.rgba);
|
|
232
|
+
|
|
233
|
+
if (newValue.r !== undefined) {
|
|
234
|
+
rgba.r = newValue.r;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (newValue.g !== undefined) {
|
|
238
|
+
rgba.g = newValue.g;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (newValue.b !== undefined) {
|
|
242
|
+
rgba.b = newValue.b;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (newValue.a !== undefined) {
|
|
246
|
+
rgba.a = newValue.a;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
this.$props.onRgbaChange(rgba, event);
|
|
250
|
+
},
|
|
251
|
+
onToggleModeChange: function onToggleModeChange() {
|
|
252
|
+
var index = modes.length - 1 === modes.indexOf(this.inputMode) ? 0 : modes.indexOf(this.inputMode) + 1;
|
|
253
|
+
|
|
254
|
+
if (!this.$props.opacity) {
|
|
255
|
+
var nextIndex = modes[index] === 'rgba' ? index + 1 : index;
|
|
256
|
+
this.inputMode = modes[nextIndex];
|
|
257
|
+
} else {
|
|
258
|
+
this.inputMode = modes[index];
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* @hidden
|
|
265
|
+
*/
|
|
266
|
+
|
|
267
|
+
var ColorInput = ColorInputVue2;
|
|
268
|
+
export { ColorInput, ColorInputVue2 };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Represents the properties of [FlatColorPicker](% slug api_inputs_flatcolorpicker %) component.
|
|
8
|
+
*/
|
|
9
|
+
export interface FlatColorPickerProps {
|
|
10
|
+
/**
|
|
11
|
+
* Sets the `id` property of the top `div` element of the FlatColorPicker.
|
|
12
|
+
*/
|
|
13
|
+
id?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Sets additional classes to the FlatColorPicker.
|
|
16
|
+
*/
|
|
17
|
+
className?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Sets the color value.
|
|
20
|
+
*/
|
|
21
|
+
value?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Sets the `tabIndex` property of the FlatColorPicker.
|
|
24
|
+
*/
|
|
25
|
+
tabIndex?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Determines whether the FlatColorPicker is disabled.
|
|
28
|
+
*/
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Sets the FlatColorPicker view. The default is `ColorGradient`.
|
|
32
|
+
*/
|
|
33
|
+
view?: 'ColorGradient' | 'ColorPalette' | string;
|
|
34
|
+
/**
|
|
35
|
+
* Sets custom header component.
|
|
36
|
+
*/
|
|
37
|
+
header?: any;
|
|
38
|
+
/**
|
|
39
|
+
* Specifies whether clear button will be rendered in the header.
|
|
40
|
+
*/
|
|
41
|
+
showClearButton?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Specifies whether preview and revert color boxes will be rendered in the header.
|
|
44
|
+
*/
|
|
45
|
+
showPreview?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Specifies whether action buttons will be rendered in the footer.
|
|
48
|
+
*/
|
|
49
|
+
showButtons?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Represents the target (element and props) of the FlatColorPicker.
|
|
53
|
+
*/
|
|
54
|
+
export interface FlatColorPickerHandle {
|
|
55
|
+
/**
|
|
56
|
+
* The current element or `null` if there is none.
|
|
57
|
+
*/
|
|
58
|
+
element: HTMLDivElement | null;
|
|
59
|
+
/**
|
|
60
|
+
* The props values of the FlatColorPicker.
|
|
61
|
+
*/
|
|
62
|
+
props: FlatColorPickerProps;
|
|
63
|
+
/**
|
|
64
|
+
* The focus event callback.
|
|
65
|
+
*/
|
|
66
|
+
focus: () => void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @hidden
|
|
70
|
+
*/
|
|
71
|
+
export interface FlatColorPickerState {
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @hidden
|
|
75
|
+
*/
|
|
76
|
+
export interface FlatColorPickerComputed {
|
|
77
|
+
[key: string]: any;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @hidden
|
|
81
|
+
*/
|
|
82
|
+
export interface FlatColorPickerMethods {
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @hidden
|
|
87
|
+
*/
|
|
88
|
+
export interface FlatColorPickerData {
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @hidden
|
|
92
|
+
*/
|
|
93
|
+
export interface FlatColorPickerAll extends Vue2type, FlatColorPickerMethods, FlatColorPickerData, FlatColorPickerComputed, FlatColorPickerState {
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @hidden
|
|
97
|
+
*/
|
|
98
|
+
declare let FlatColorPickerVue2: ComponentOptions<FlatColorPickerAll, DefaultData<FlatColorPickerData>, DefaultMethods<FlatColorPickerAll>, FlatColorPickerComputed, RecordPropsDefinition<FlatColorPickerProps>>;
|
|
99
|
+
/**
|
|
100
|
+
* @hidden
|
|
101
|
+
*/
|
|
102
|
+
declare const FlatColorPicker: DefineComponent<FlatColorPickerProps, any, FlatColorPickerData, FlatColorPickerComputed, FlatColorPickerMethods, {}, {}, {}, string, FlatColorPickerProps, FlatColorPickerProps, {}>;
|
|
103
|
+
export { FlatColorPicker, FlatColorPickerVue2 };
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
import { classNames, validatePackage, getTabIndex } from '@progress/kendo-vue-common';
|
|
6
|
+
import { ButtonGroup, Button } from '@progress/kendo-vue-buttons';
|
|
7
|
+
import { ColorPalette } from './ColorPalette';
|
|
8
|
+
import { ColorGradient } from './ColorGradient';
|
|
9
|
+
import { packageMetadata } from '../package-metadata';
|
|
10
|
+
import { messages, flatColorPickerApplyBtn, flatColorPickerCancelBtn } from '../messages';
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
var FlatColorPickerVue2 = {
|
|
16
|
+
name: 'KendoFlatColorPicker',
|
|
17
|
+
created: function created() {
|
|
18
|
+
validatePackage(packageMetadata);
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
value: String,
|
|
22
|
+
tabIndex: Number,
|
|
23
|
+
disabled: Boolean,
|
|
24
|
+
view: {
|
|
25
|
+
type: String,
|
|
26
|
+
validator: function validator(value) {
|
|
27
|
+
return ['ColorGradient', 'ColorPalette'].includes(value);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
header: [String, Object, Function, Boolean],
|
|
31
|
+
showClearButton: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: true
|
|
34
|
+
},
|
|
35
|
+
showPreview: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: true
|
|
38
|
+
},
|
|
39
|
+
showButtons: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
computed: {
|
|
45
|
+
isColorGradient: function isColorGradient() {
|
|
46
|
+
return this.view ? this.view === 'ColorGradient' : this.currentView === 'ColorGradient';
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
data: function data() {
|
|
50
|
+
return {
|
|
51
|
+
currentView: 'ColorGradient',
|
|
52
|
+
colorValue: 'rgba(255, 255, 255, 1)',
|
|
53
|
+
prevColor: 'rgba(255, 255, 255, 1)'
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
setup: !gh ? undefined : function () {
|
|
58
|
+
var v3 = !!gh;
|
|
59
|
+
return {
|
|
60
|
+
v3: v3
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
render: function render(createElement) {
|
|
65
|
+
var _this = this;
|
|
66
|
+
|
|
67
|
+
var h = gh || createElement;
|
|
68
|
+
return h("div", {
|
|
69
|
+
tabIndex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
70
|
+
attrs: this.v3 ? undefined : {
|
|
71
|
+
tabIndex: getTabIndex(this.$props.tabIndex, this.$props.disabled)
|
|
72
|
+
},
|
|
73
|
+
"class": classNames('k-flatcolorpicker k-coloreditor', {
|
|
74
|
+
'k-disabled': this.$props.disabled
|
|
75
|
+
}),
|
|
76
|
+
onBlur: this.handleFlatColorPickerBlur,
|
|
77
|
+
on: this.v3 ? undefined : {
|
|
78
|
+
"blur": this.handleFlatColorPickerBlur
|
|
79
|
+
}
|
|
80
|
+
}, [this.$props.header || h("div", {
|
|
81
|
+
"class": "k-coloreditor-header k-hstack"
|
|
82
|
+
}, [h("div", {
|
|
83
|
+
"class": "k-coloreditor-header-actions k-hstack"
|
|
84
|
+
}, [// @ts-ignore function children
|
|
85
|
+
h(ButtonGroup, this.v3 ? function () {
|
|
86
|
+
return [// @ts-ignore function children
|
|
87
|
+
h(Button, {
|
|
88
|
+
type: "button",
|
|
89
|
+
attrs: _this.v3 ? undefined : {
|
|
90
|
+
type: "button",
|
|
91
|
+
togglable: true,
|
|
92
|
+
fillMode: 'flat',
|
|
93
|
+
selected: _this.colorGradientView
|
|
94
|
+
},
|
|
95
|
+
togglable: true,
|
|
96
|
+
fillMode: 'flat',
|
|
97
|
+
selected: _this.colorGradientView
|
|
98
|
+
}, _this.v3 ? function () {
|
|
99
|
+
return [h("span", {
|
|
100
|
+
"class": "k-icon k-i-color-canvas"
|
|
101
|
+
})];
|
|
102
|
+
} : [h("span", {
|
|
103
|
+
"class": "k-icon k-i-color-canvas"
|
|
104
|
+
})]), // @ts-ignore function children
|
|
105
|
+
h(Button, {
|
|
106
|
+
type: "button",
|
|
107
|
+
attrs: _this.v3 ? undefined : {
|
|
108
|
+
type: "button",
|
|
109
|
+
togglable: true,
|
|
110
|
+
fillMode: 'flat',
|
|
111
|
+
selected: !_this.colorGradientView
|
|
112
|
+
},
|
|
113
|
+
togglable: true,
|
|
114
|
+
fillMode: 'flat',
|
|
115
|
+
selected: !_this.colorGradientView
|
|
116
|
+
}, _this.v3 ? function () {
|
|
117
|
+
return [h("span", {
|
|
118
|
+
"class": "k-icon k-i-palette"
|
|
119
|
+
})];
|
|
120
|
+
} : [h("span", {
|
|
121
|
+
"class": "k-icon k-i-palette"
|
|
122
|
+
})])];
|
|
123
|
+
} : [h(Button, {
|
|
124
|
+
type: "button",
|
|
125
|
+
attrs: _this.v3 ? undefined : {
|
|
126
|
+
type: "button",
|
|
127
|
+
togglable: true,
|
|
128
|
+
fillMode: 'flat',
|
|
129
|
+
selected: _this.colorGradientView
|
|
130
|
+
},
|
|
131
|
+
togglable: true,
|
|
132
|
+
fillMode: 'flat',
|
|
133
|
+
selected: _this.colorGradientView
|
|
134
|
+
}, _this.v3 ? function () {
|
|
135
|
+
return [h("span", {
|
|
136
|
+
"class": "k-icon k-i-color-canvas"
|
|
137
|
+
})];
|
|
138
|
+
} : [h("span", {
|
|
139
|
+
"class": "k-icon k-i-color-canvas"
|
|
140
|
+
})]), h(Button, {
|
|
141
|
+
type: "button",
|
|
142
|
+
attrs: _this.v3 ? undefined : {
|
|
143
|
+
type: "button",
|
|
144
|
+
togglable: true,
|
|
145
|
+
fillMode: 'flat',
|
|
146
|
+
selected: !_this.colorGradientView
|
|
147
|
+
},
|
|
148
|
+
togglable: true,
|
|
149
|
+
fillMode: 'flat',
|
|
150
|
+
selected: !_this.colorGradientView
|
|
151
|
+
}, _this.v3 ? function () {
|
|
152
|
+
return [h("span", {
|
|
153
|
+
"class": "k-icon k-i-palette"
|
|
154
|
+
})];
|
|
155
|
+
} : [h("span", {
|
|
156
|
+
"class": "k-icon k-i-palette"
|
|
157
|
+
})])])]), h("div", {
|
|
158
|
+
"class": "k-spacer"
|
|
159
|
+
}), h("div", {
|
|
160
|
+
"class": "k-coloreditor-header-actions k-hstack"
|
|
161
|
+
}, [this.$props.showClearButton && // @ts-ignore function children
|
|
162
|
+
h(Button, {
|
|
163
|
+
type: "button",
|
|
164
|
+
attrs: this.v3 ? undefined : {
|
|
165
|
+
type: "button",
|
|
166
|
+
fillMode: 'flat'
|
|
167
|
+
},
|
|
168
|
+
fillMode: 'flat',
|
|
169
|
+
onClick: this.handleResetColor,
|
|
170
|
+
on: this.v3 ? undefined : {
|
|
171
|
+
"click": this.handleResetColor
|
|
172
|
+
}
|
|
173
|
+
}, this.v3 ? function () {
|
|
174
|
+
return [h("span", {
|
|
175
|
+
"class": "k-icon k-i-reset-color"
|
|
176
|
+
})];
|
|
177
|
+
} : [h("span", {
|
|
178
|
+
"class": "k-icon k-i-reset-color"
|
|
179
|
+
})]), this.$props.showPreview && defaultProps.showPreview && h("div", {
|
|
180
|
+
"class": "k-coloreditor-preview k-vstack"
|
|
181
|
+
}, [h("span", {
|
|
182
|
+
"class": "k-coloreditor-preview-color k-color-preview",
|
|
183
|
+
style: {
|
|
184
|
+
background: this.colorValue
|
|
185
|
+
}
|
|
186
|
+
}), h("span", {
|
|
187
|
+
"class": "k-coloreditor-current-color k-color-preview",
|
|
188
|
+
style: {
|
|
189
|
+
background: this.prevColor
|
|
190
|
+
},
|
|
191
|
+
onClick: this.handlePrevColorClick,
|
|
192
|
+
on: this.v3 ? undefined : {
|
|
193
|
+
"click": this.handlePrevColorClick
|
|
194
|
+
}
|
|
195
|
+
})])])]), h("div", {
|
|
196
|
+
"class": "k-coloreditor-views k-vstack"
|
|
197
|
+
}, [this.isColorGradient ? h(ColorGradient // ref={colorGradientRef}
|
|
198
|
+
, {
|
|
199
|
+
value: this.colorValue,
|
|
200
|
+
attrs: this.v3 ? undefined : {
|
|
201
|
+
value: this.colorValue
|
|
202
|
+
},
|
|
203
|
+
onChange: this.handleColorChange,
|
|
204
|
+
on: this.v3 ? undefined : {
|
|
205
|
+
"change": this.handleColorChange,
|
|
206
|
+
"focus": this.handleFocus
|
|
207
|
+
},
|
|
208
|
+
onFocus: this.handleFocus
|
|
209
|
+
}) : h(ColorPalette, {
|
|
210
|
+
value: this.colorValue,
|
|
211
|
+
attrs: this.v3 ? undefined : {
|
|
212
|
+
value: this.colorValue
|
|
213
|
+
},
|
|
214
|
+
onChange: this.handleColorChange,
|
|
215
|
+
on: this.v3 ? undefined : {
|
|
216
|
+
"change": this.handleColorChange,
|
|
217
|
+
"focus": this.handleFocus
|
|
218
|
+
},
|
|
219
|
+
onFocus: this.handleFocus
|
|
220
|
+
})]), this.$props.showButtons && defaultProps.showButtons && h("div", {
|
|
221
|
+
"class": "k-coloreditor-footer k-actions k-actions-end"
|
|
222
|
+
}, [// @ts-ignore function children
|
|
223
|
+
h(Button, {
|
|
224
|
+
type: "button",
|
|
225
|
+
attrs: this.v3 ? undefined : {
|
|
226
|
+
type: "button"
|
|
227
|
+
},
|
|
228
|
+
"class": "k-coloreditor-cancel",
|
|
229
|
+
onClick: this.handleCancelBtnClick,
|
|
230
|
+
on: this.v3 ? undefined : {
|
|
231
|
+
"click": this.handleCancelBtnClick
|
|
232
|
+
}
|
|
233
|
+
}, this.v3 ? function () {
|
|
234
|
+
return [messages[flatColorPickerCancelBtn]];
|
|
235
|
+
} : [messages[flatColorPickerCancelBtn]]), // @ts-ignore function children
|
|
236
|
+
h(Button, {
|
|
237
|
+
type: "button",
|
|
238
|
+
attrs: this.v3 ? undefined : {
|
|
239
|
+
type: "button"
|
|
240
|
+
},
|
|
241
|
+
"class": "k-coloreditor-apply k-primary",
|
|
242
|
+
onClick: this.handleApplyBtnClick,
|
|
243
|
+
on: this.v3 ? undefined : {
|
|
244
|
+
"click": this.handleApplyBtnClick
|
|
245
|
+
}
|
|
246
|
+
}, this.v3 ? function () {
|
|
247
|
+
return [messages[flatColorPickerApplyBtn]];
|
|
248
|
+
} : [messages[flatColorPickerApplyBtn]])])]);
|
|
249
|
+
},
|
|
250
|
+
methods: {
|
|
251
|
+
focus: function focus() {
|
|
252
|
+
if (this.$el) {
|
|
253
|
+
this.$el.focus();
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
handleViewChange: function handleViewChange(viewType) {
|
|
257
|
+
this.currentView = viewType;
|
|
258
|
+
},
|
|
259
|
+
handleResetColor: function handleResetColor() {
|
|
260
|
+
this.colorValue = 'rgba(255, 255, 255, 1)';
|
|
261
|
+
},
|
|
262
|
+
handleColorChange: function handleColorChange(event) {
|
|
263
|
+
this.colorValue = event.value;
|
|
264
|
+
},
|
|
265
|
+
handleApplyBtnClick: function handleApplyBtnClick() {
|
|
266
|
+
this.prevColor = this.colorValue;
|
|
267
|
+
},
|
|
268
|
+
handleCancelBtnClick: function handleCancelBtnClick() {
|
|
269
|
+
this.prevColor = 'rgba(255, 255, 255, 1)';
|
|
270
|
+
},
|
|
271
|
+
handlePrevColorClick: function handlePrevColorClick() {
|
|
272
|
+
this.colorValue = this.prevColor;
|
|
273
|
+
},
|
|
274
|
+
handleFocus: function handleFocus() {
|
|
275
|
+
if (this.$el) {
|
|
276
|
+
this.$el.focus();
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
handleFlatColorPickerBlur: function handleFlatColorPickerBlur() {
|
|
280
|
+
this.prevColor(this.colorValue);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
var defaultProps = {
|
|
285
|
+
showClearButton: true,
|
|
286
|
+
showPreview: true,
|
|
287
|
+
showButtons: true
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* @hidden
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
var FlatColorPicker = FlatColorPickerVue2;
|
|
294
|
+
export { FlatColorPicker, FlatColorPickerVue2 };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from '../additionalTypes';
|
|
2
|
+
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
+
declare type DefaultMethods<V> = {
|
|
4
|
+
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export interface HexInputProps {
|
|
10
|
+
hex: string;
|
|
11
|
+
onHexChange?: any;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export interface HexInputState {
|
|
18
|
+
originalHex: string;
|
|
19
|
+
hex: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export interface HexInputComputed {
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @hidden
|
|
29
|
+
*/
|
|
30
|
+
export interface HexInputMethods {
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
export interface HexInputData {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @hidden
|
|
40
|
+
*/
|
|
41
|
+
export interface HexInputAll extends Vue2type, HexInputMethods, HexInputData, HexInputComputed, HexInputState {
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @hidden
|
|
45
|
+
*/
|
|
46
|
+
declare let HexInputVue2: ComponentOptions<HexInputAll, DefaultData<HexInputData>, DefaultMethods<HexInputAll>, HexInputComputed, RecordPropsDefinition<HexInputProps>>;
|
|
47
|
+
/**
|
|
48
|
+
* @hidden
|
|
49
|
+
*/
|
|
50
|
+
declare const HexInput: DefineComponent<HexInputProps, any, HexInputData, HexInputComputed, HexInputMethods, {}, {}, {}, string, HexInputProps, HexInputProps, {}>;
|
|
51
|
+
export { HexInput, HexInputVue2 };
|