@progress/kendo-vue-inputs 3.5.0 → 3.5.1-dev.202208150613
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-vue-inputs.js +1 -1
- package/dist/es/checkbox/Checkbox.js +1 -1
- package/dist/es/checkbox/interfaces/CheckboxChangeEvent.js +1 -0
- package/dist/es/checkbox/interfaces/CheckboxFocusEvent.js +1 -0
- package/dist/es/checkbox/interfaces/CheckboxProps.js +1 -0
- package/dist/es/colors/ColorContrastLabels.js +3 -3
- package/dist/es/colors/ColorContrastSvg.js +2 -2
- package/dist/es/colors/ColorGradient.js +7 -7
- package/dist/es/colors/ColorPalette.js +1 -1
- package/dist/es/colors/ColorPicker.js +4 -4
- package/dist/es/colors/interfaces/ColorGradientChangeEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorGradientProps.js +1 -0
- package/dist/es/colors/interfaces/ColorPaletteChangeEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPaletteProps.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerActiveColorClick.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerBlurEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerChangeEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerFocusEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerPaletteSettings.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerPopupSettings.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerProps.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerView.js +1 -0
- package/dist/es/colors/interfaces/FlatColorPickerViewChangeEvent.js +1 -0
- package/dist/es/colors/interfaces/PickerPopupSettings.js +1 -0
- package/dist/es/colors/interfaces/PickerProps.js +1 -0
- package/dist/es/colors/models/hsva.js +1 -0
- package/dist/es/colors/models/output-format.js +1 -0
- package/dist/es/colors/models/rgb.js +1 -0
- package/dist/es/colors/models/rgba.js +1 -0
- package/dist/es/colors/models/table-cell.js +1 -0
- package/dist/es/colors/models/tile-size.js +1 -0
- package/dist/es/colors/utils/color-parser.js +1 -1
- package/dist/es/colors/utils/svg-calc.js +4 -4
- package/dist/es/input/Input.js +2 -2
- package/dist/es/interfaces/Direction.js +1 -0
- package/dist/es/interfaces/ToggleBaseProps.js +1 -0
- package/dist/es/maskedtextbox/MaskedTextBox.js +3 -3
- package/dist/es/maskedtextbox/MaskedTextBoxProps.js +1 -0
- package/dist/es/maskedtextbox/parsing/result.js +1 -1
- package/dist/es/numerictextbox/NumericTextBox.js +2 -2
- package/dist/es/numerictextbox/interfaces/NumericTextBoxData.js +1 -0
- package/dist/es/numerictextbox/interfaces/NumericTextBoxProps.js +1 -0
- package/dist/es/numerictextbox/utils/index.js +4 -4
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/RadioButton.js +1 -1
- package/dist/es/radiobutton/interfaces/RadioButtonBlurEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioButtonChangeEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioButtonFocusEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioButtonProps.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioGroupChangeEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioGroupFocusEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioGroupProps.js +1 -0
- package/dist/es/range-slider/RangeSlider.js +4 -4
- package/dist/es/slider/SliderLabel.js +2 -2
- package/dist/es/switch/Switch.js +3 -3
- package/dist/es/textarea/TextArea.js +3 -3
- package/dist/es/textarea/interfaces/TextAreaBlurEvent.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaChangeEvent.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaFlow.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaFocusEvent.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaProps.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaResize.js +1 -0
- package/dist/esm/additionalTypes.ts +21 -0
- package/dist/esm/checkbox/Checkbox.d.ts +79 -0
- package/dist/esm/checkbox/Checkbox.js +373 -0
- package/dist/esm/checkbox/interfaces/CheckboxChangeEvent.d.ts +9 -0
- package/dist/esm/checkbox/interfaces/CheckboxChangeEvent.js +1 -0
- package/dist/esm/checkbox/interfaces/CheckboxFocusEvent.d.ts +5 -0
- package/dist/esm/checkbox/interfaces/CheckboxFocusEvent.js +1 -0
- package/dist/esm/checkbox/interfaces/CheckboxProps.d.ts +110 -0
- package/dist/esm/checkbox/interfaces/CheckboxProps.js +1 -0
- package/dist/esm/colors/ColorContrastLabels.d.ts +49 -0
- package/dist/esm/colors/ColorContrastLabels.js +84 -0
- package/dist/esm/colors/ColorContrastSvg.d.ts +50 -0
- package/dist/esm/colors/ColorContrastSvg.js +130 -0
- package/dist/esm/colors/ColorGradient.d.ts +54 -0
- package/dist/esm/colors/ColorGradient.js +515 -0
- package/dist/esm/colors/ColorInput.d.ts +57 -0
- package/dist/esm/colors/ColorInput.js +343 -0
- package/dist/esm/colors/ColorPalette.d.ts +60 -0
- package/dist/esm/colors/ColorPalette.js +343 -0
- package/dist/esm/colors/ColorPicker.d.ts +57 -0
- package/dist/esm/colors/ColorPicker.js +505 -0
- package/dist/esm/colors/FlatColorPicker.d.ts +139 -0
- package/dist/esm/colors/FlatColorPicker.js +539 -0
- package/dist/esm/colors/HexInput.d.ts +52 -0
- package/dist/esm/colors/HexInput.js +110 -0
- package/dist/esm/colors/Picker.d.ts +46 -0
- package/dist/esm/colors/Picker.js +110 -0
- package/dist/esm/colors/interfaces/ColorGradientChangeEvent.d.ts +13 -0
- package/dist/esm/colors/interfaces/ColorGradientChangeEvent.js +1 -0
- package/dist/esm/colors/interfaces/ColorGradientProps.d.ts +68 -0
- package/dist/esm/colors/interfaces/ColorGradientProps.js +1 -0
- package/dist/esm/colors/interfaces/ColorPaletteChangeEvent.d.ts +13 -0
- package/dist/esm/colors/interfaces/ColorPaletteChangeEvent.js +1 -0
- package/dist/esm/colors/interfaces/ColorPaletteProps.d.ts +71 -0
- package/dist/esm/colors/interfaces/ColorPaletteProps.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerActiveColorClick.d.ts +13 -0
- package/dist/esm/colors/interfaces/ColorPickerActiveColorClick.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerBlurEvent.d.ts +9 -0
- package/dist/esm/colors/interfaces/ColorPickerBlurEvent.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerChangeEvent.d.ts +17 -0
- package/dist/esm/colors/interfaces/ColorPickerChangeEvent.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerFocusEvent.d.ts +9 -0
- package/dist/esm/colors/interfaces/ColorPickerFocusEvent.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerPaletteSettings.d.ts +32 -0
- package/dist/esm/colors/interfaces/ColorPickerPaletteSettings.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerPopupSettings.d.ts +14 -0
- package/dist/esm/colors/interfaces/ColorPickerPopupSettings.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerProps.d.ts +176 -0
- package/dist/esm/colors/interfaces/ColorPickerProps.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerView.d.ts +10 -0
- package/dist/esm/colors/interfaces/ColorPickerView.js +1 -0
- package/dist/esm/colors/interfaces/FlatColorPickerViewChangeEvent.d.ts +13 -0
- package/dist/esm/colors/interfaces/FlatColorPickerViewChangeEvent.js +1 -0
- package/dist/esm/colors/interfaces/PickerPopupSettings.d.ts +14 -0
- package/dist/esm/colors/interfaces/PickerPopupSettings.js +1 -0
- package/dist/esm/colors/interfaces/PickerProps.d.ts +46 -0
- package/dist/esm/colors/interfaces/PickerProps.js +1 -0
- package/dist/esm/colors/models/hsva.d.ts +9 -0
- package/dist/esm/colors/models/hsva.js +1 -0
- package/dist/esm/colors/models/output-format.d.ts +4 -0
- package/dist/esm/colors/models/output-format.js +1 -0
- package/dist/esm/colors/models/palette-presets.d.ts +53 -0
- package/dist/esm/colors/models/palette-presets.js +54 -0
- package/dist/esm/colors/models/rgb.d.ts +8 -0
- package/dist/esm/colors/models/rgb.js +1 -0
- package/dist/esm/colors/models/rgba.d.ts +9 -0
- package/dist/esm/colors/models/rgba.js +1 -0
- package/dist/esm/colors/models/table-cell.d.ts +7 -0
- package/dist/esm/colors/models/table-cell.js +1 -0
- package/dist/esm/colors/models/tile-size.d.ts +11 -0
- package/dist/esm/colors/models/tile-size.js +1 -0
- package/dist/esm/colors/utils/color-cache.d.ts +43 -0
- package/dist/esm/colors/utils/color-cache.js +75 -0
- package/dist/esm/colors/utils/color-palette.service.d.ts +13 -0
- package/dist/esm/colors/utils/color-palette.service.js +67 -0
- package/dist/esm/colors/utils/color-parser.d.ts +71 -0
- package/dist/esm/colors/utils/color-parser.js +145 -0
- package/dist/esm/colors/utils/misc.d.ts +15 -0
- package/dist/esm/colors/utils/misc.js +20 -0
- package/dist/esm/colors/utils/svg-calc.d.ts +62 -0
- package/dist/esm/colors/utils/svg-calc.js +103 -0
- package/dist/esm/input/Input.d.ts +189 -0
- package/dist/esm/input/Input.js +426 -0
- package/dist/esm/input-separator/InputSeparator.d.ts +26 -0
- package/dist/esm/input-separator/InputSeparator.js +43 -0
- package/dist/esm/interfaces/Direction.d.ts +1 -0
- package/dist/esm/interfaces/Direction.js +1 -0
- package/dist/esm/interfaces/ToggleBaseProps.d.ts +8 -0
- package/dist/esm/interfaces/ToggleBaseProps.js +1 -0
- package/dist/esm/main.d.ts +39 -0
- package/dist/esm/main.js +37 -0
- package/dist/esm/maskedtextbox/MaskedTextBox.d.ts +76 -0
- package/dist/esm/maskedtextbox/MaskedTextBox.js +511 -0
- package/dist/esm/maskedtextbox/MaskedTextBoxProps.d.ts +219 -0
- package/dist/esm/maskedtextbox/MaskedTextBoxProps.js +2 -0
- package/dist/esm/maskedtextbox/masking.service.d.ts +41 -0
- package/dist/esm/maskedtextbox/masking.service.js +206 -0
- package/dist/esm/maskedtextbox/parsing/combinators.d.ts +9 -0
- package/dist/esm/maskedtextbox/parsing/combinators.js +24 -0
- package/dist/esm/maskedtextbox/parsing/parsers.d.ts +47 -0
- package/dist/esm/maskedtextbox/parsing/parsers.js +154 -0
- package/dist/esm/maskedtextbox/parsing/result.d.ts +23 -0
- package/dist/esm/maskedtextbox/parsing/result.js +39 -0
- package/dist/esm/maskedtextbox/parsing/stream.d.ts +22 -0
- package/dist/esm/maskedtextbox/parsing/stream.js +41 -0
- package/dist/esm/maskedtextbox/utils.d.ts +16 -0
- package/dist/esm/maskedtextbox/utils.js +56 -0
- package/dist/esm/messages/index.d.ts +160 -0
- package/dist/esm/messages/index.js +162 -0
- package/dist/esm/numerictextbox/NumericTextBox.d.ts +87 -0
- package/dist/esm/numerictextbox/NumericTextBox.js +684 -0
- package/dist/esm/numerictextbox/interfaces/NumericTextBoxData.d.ts +15 -0
- package/dist/esm/numerictextbox/interfaces/NumericTextBoxData.js +1 -0
- package/dist/esm/numerictextbox/interfaces/NumericTextBoxProps.d.ts +178 -0
- package/dist/esm/numerictextbox/interfaces/NumericTextBoxProps.js +1 -0
- package/dist/esm/numerictextbox/utils/index.d.ts +119 -0
- package/dist/esm/numerictextbox/utils/index.js +646 -0
- package/dist/esm/package-metadata.d.ts +5 -0
- package/dist/esm/package-metadata.js +11 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/radiobutton/RadioButton.d.ts +55 -0
- package/dist/esm/radiobutton/RadioButton.js +195 -0
- package/dist/esm/radiobutton/RadioGroup.d.ts +57 -0
- package/dist/esm/radiobutton/RadioGroup.js +218 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonBlurEvent.d.ts +5 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonBlurEvent.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonChangeEvent.d.ts +9 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonChangeEvent.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonFocusEvent.d.ts +5 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonFocusEvent.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonProps.d.ts +107 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonProps.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupChangeEvent.d.ts +9 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupChangeEvent.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupFocusEvent.d.ts +5 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupFocusEvent.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupProps.d.ts +81 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupProps.js +1 -0
- package/dist/esm/range-slider/RangeSlider.d.ts +176 -0
- package/dist/esm/range-slider/RangeSlider.js +617 -0
- package/dist/esm/range-slider/range-raducer.d.ts +35 -0
- package/dist/esm/range-slider/range-raducer.js +157 -0
- package/dist/esm/slider/Slider.d.ts +140 -0
- package/dist/esm/slider/Slider.js +395 -0
- package/dist/esm/slider/SliderLabel.d.ts +65 -0
- package/dist/esm/slider/SliderLabel.js +121 -0
- package/dist/esm/switch/Switch.d.ts +182 -0
- package/dist/esm/switch/Switch.js +342 -0
- package/dist/esm/switch/util.d.ts +8 -0
- package/dist/esm/switch/util.js +46 -0
- package/dist/esm/textarea/TextArea.d.ts +81 -0
- package/dist/esm/textarea/TextArea.js +422 -0
- package/dist/esm/textarea/interfaces/TextAreaBlurEvent.d.ts +5 -0
- package/dist/esm/textarea/interfaces/TextAreaBlurEvent.js +1 -0
- package/dist/esm/textarea/interfaces/TextAreaChangeEvent.d.ts +9 -0
- package/dist/esm/textarea/interfaces/TextAreaChangeEvent.js +1 -0
- package/dist/esm/textarea/interfaces/TextAreaFlow.d.ts +8 -0
- package/dist/esm/textarea/interfaces/TextAreaFlow.js +1 -0
- package/dist/esm/textarea/interfaces/TextAreaFocusEvent.d.ts +5 -0
- package/dist/esm/textarea/interfaces/TextAreaFocusEvent.js +1 -0
- package/dist/esm/textarea/interfaces/TextAreaProps.d.ts +170 -0
- package/dist/esm/textarea/interfaces/TextAreaProps.js +1 -0
- package/dist/esm/textarea/interfaces/TextAreaResize.d.ts +10 -0
- package/dist/esm/textarea/interfaces/TextAreaResize.js +1 -0
- package/dist/npm/checkbox/Checkbox.js +12 -12
- package/dist/npm/colors/ColorContrastLabels.js +5 -5
- package/dist/npm/colors/ColorContrastSvg.js +4 -4
- package/dist/npm/colors/ColorGradient.js +42 -42
- package/dist/npm/colors/ColorInput.js +2 -2
- package/dist/npm/colors/ColorPalette.js +12 -12
- package/dist/npm/colors/ColorPicker.js +15 -15
- package/dist/npm/colors/FlatColorPicker.js +10 -10
- package/dist/npm/colors/HexInput.js +4 -4
- package/dist/npm/colors/Picker.js +2 -2
- package/dist/npm/colors/utils/color-palette.service.js +6 -6
- package/dist/npm/colors/utils/color-parser.js +48 -37
- package/dist/npm/colors/utils/misc.js +5 -3
- package/dist/npm/colors/utils/svg-calc.js +12 -8
- package/dist/npm/input/Input.js +4 -4
- package/dist/npm/input-separator/InputSeparator.js +1 -1
- package/dist/npm/main.js +7 -2
- package/dist/npm/maskedtextbox/MaskedTextBox.js +8 -8
- package/dist/npm/maskedtextbox/masking.service.js +19 -19
- package/dist/npm/maskedtextbox/parsing/combinators.js +4 -2
- package/dist/npm/maskedtextbox/parsing/parsers.js +14 -7
- package/dist/npm/maskedtextbox/parsing/result.js +1 -1
- package/dist/npm/numerictextbox/NumericTextBox.js +22 -22
- package/dist/npm/numerictextbox/utils/index.js +145 -116
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/RadioButton.js +8 -8
- package/dist/npm/radiobutton/RadioGroup.js +5 -5
- package/dist/npm/range-slider/RangeSlider.js +17 -17
- package/dist/npm/range-slider/range-raducer.js +4 -2
- package/dist/npm/slider/Slider.js +7 -7
- package/dist/npm/slider/SliderLabel.js +3 -3
- package/dist/npm/switch/Switch.js +13 -13
- package/dist/npm/switch/util.js +2 -1
- package/dist/npm/textarea/TextArea.js +7 -7
- package/package.json +17 -11
|
@@ -0,0 +1,539 @@
|
|
|
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
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
22
|
+
import { classNames, validatePackage, getTabIndex, setRef, focusContainer, focusFirstFocusableChild, Keys, templateRendering, getListeners, getTemplate } from '@progress/kendo-vue-common';
|
|
23
|
+
import { ButtonGroup, Button } from '@progress/kendo-vue-buttons';
|
|
24
|
+
import { ColorPalette } from './ColorPalette.js';
|
|
25
|
+
import { ColorGradient } from './ColorGradient.js';
|
|
26
|
+
import { packageMetadata } from '../package-metadata.js';
|
|
27
|
+
import { messages, flatColorPickerApplyBtn, flatColorPickerCancelBtn, flatColorPickerGradientBtn, flatColorPickerPaletteBtn, flatColorPickerClearBtn } from '../messages.js';
|
|
28
|
+
import { parseColor } from './utils/color-parser.js';
|
|
29
|
+
import { DEFAULT_GRADIENT_SETTINGS, DEFAULT_PALETTE_SETTINGS } from './utils/color-cache.js';
|
|
30
|
+
import { provideLocalizationService } from '@progress/kendo-vue-intl';
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
var FlatColorPickerVue2 = {
|
|
36
|
+
name: 'KendoFlatColorPicker',
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
emits: {
|
|
39
|
+
'viewchange': null,
|
|
40
|
+
'changemodel': null,
|
|
41
|
+
'update:modelValue': null,
|
|
42
|
+
'update:modelRgbaValue': null,
|
|
43
|
+
'focus': null,
|
|
44
|
+
'blur': null,
|
|
45
|
+
'focusout': null,
|
|
46
|
+
'keydown': null,
|
|
47
|
+
'change': null
|
|
48
|
+
},
|
|
49
|
+
props: {
|
|
50
|
+
modelValue: String,
|
|
51
|
+
modelRgbaValue: String,
|
|
52
|
+
value: String,
|
|
53
|
+
prevValue: String,
|
|
54
|
+
tabIndex: Number,
|
|
55
|
+
disabled: Boolean,
|
|
56
|
+
view: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'combo',
|
|
59
|
+
validator: function validator(value) {
|
|
60
|
+
return ['gradient', 'palette', 'combo'].includes(value);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
selectedView: {
|
|
64
|
+
type: Number,
|
|
65
|
+
default: undefined
|
|
66
|
+
},
|
|
67
|
+
header: [String, Function, Object],
|
|
68
|
+
footer: [String, Function, Object],
|
|
69
|
+
showClearButton: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: true
|
|
72
|
+
},
|
|
73
|
+
showPreview: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: true
|
|
76
|
+
},
|
|
77
|
+
showButtons: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: true
|
|
80
|
+
},
|
|
81
|
+
gradientSettings: {
|
|
82
|
+
type: Object,
|
|
83
|
+
default: function _default() {
|
|
84
|
+
return DEFAULT_GRADIENT_SETTINGS;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
paletteSettings: {
|
|
88
|
+
type: Object,
|
|
89
|
+
default: function _default() {
|
|
90
|
+
return DEFAULT_PALETTE_SETTINGS;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
inject: {
|
|
95
|
+
kendoLocalizationService: {
|
|
96
|
+
default: null
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
created: function created() {
|
|
100
|
+
validatePackage(packageMetadata);
|
|
101
|
+
},
|
|
102
|
+
computed: {
|
|
103
|
+
isColorGradient: function isColorGradient() {
|
|
104
|
+
return this.view !== 'combo' ? this.view === 'gradient' : this.selectedView !== undefined ? this.selectedView === 0 : this.currentView === 'gradient';
|
|
105
|
+
},
|
|
106
|
+
computedColor: function computedColor() {
|
|
107
|
+
return this.value !== undefined ? this.value : this.modelValue !== undefined ? this.modelValue : this.modelRgbaValue !== undefined ? this.modelRgbaValue : this.colorValue;
|
|
108
|
+
},
|
|
109
|
+
computedPrevColor: function computedPrevColor() {
|
|
110
|
+
return this.prevValue !== undefined ? this.prevValue : this.currentPrevColor;
|
|
111
|
+
},
|
|
112
|
+
previewClass: function previewClass() {
|
|
113
|
+
return {
|
|
114
|
+
'k-coloreditor-preview-color': true,
|
|
115
|
+
'k-color-preview': true,
|
|
116
|
+
'k-no-color': !this.colorValue
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
currentClass: function currentClass() {
|
|
120
|
+
return {
|
|
121
|
+
'k-coloreditor-current-color': true,
|
|
122
|
+
'k-color-preview': true,
|
|
123
|
+
'k-no-color': !this.computedPrevColor
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
computedTabIndex: function computedTabIndex() {
|
|
127
|
+
return this.focused ? 0 : -1;
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
data: function data() {
|
|
131
|
+
var initialValue = this.value || this.defaultValue || this.modelValue || this.modelRgbaValue;
|
|
132
|
+
return {
|
|
133
|
+
currentView: 'gradient',
|
|
134
|
+
colorValue: initialValue,
|
|
135
|
+
currentPrevColor: initialValue,
|
|
136
|
+
focused: false
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
// @ts-ignore
|
|
140
|
+
setup: !isV3 ? undefined : function () {
|
|
141
|
+
var v3 = !!isV3;
|
|
142
|
+
return {
|
|
143
|
+
v3: v3
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
// @ts-ignore
|
|
147
|
+
render: function render(createElement) {
|
|
148
|
+
var _this2 = this;
|
|
149
|
+
|
|
150
|
+
var _this = this;
|
|
151
|
+
|
|
152
|
+
var h = gh || createElement;
|
|
153
|
+
var localizationService = provideLocalizationService(this);
|
|
154
|
+
var gradientMessage = localizationService.toLanguageString(flatColorPickerGradientBtn, messages[flatColorPickerGradientBtn]);
|
|
155
|
+
var paletteMessage = localizationService.toLanguageString(flatColorPickerPaletteBtn, messages[flatColorPickerPaletteBtn]);
|
|
156
|
+
var clearMessage = localizationService.toLanguageString(flatColorPickerClearBtn, messages[flatColorPickerClearBtn]);
|
|
157
|
+
var cancelMessage = localizationService.toLanguageString(flatColorPickerCancelBtn, messages[flatColorPickerCancelBtn]);
|
|
158
|
+
var applyMessage = localizationService.toLanguageString(flatColorPickerApplyBtn, messages[flatColorPickerApplyBtn]);
|
|
159
|
+
var headerTemplate = templateRendering.call(this, this.$props.header, getListeners.call(this));
|
|
160
|
+
var footerTemplate = templateRendering.call(this, this.$props.footer, getListeners.call(this));
|
|
161
|
+
var header = getTemplate.call(this, {
|
|
162
|
+
h: h,
|
|
163
|
+
template: headerTemplate
|
|
164
|
+
});
|
|
165
|
+
var footer = getTemplate.call(this, {
|
|
166
|
+
h: h,
|
|
167
|
+
template: footerTemplate
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
var renderGradiente = function renderGradiente() {
|
|
171
|
+
return h(ColorGradient, __assign({
|
|
172
|
+
attrs: this.v3 ? undefined : __assign({
|
|
173
|
+
tabIndex: -1,
|
|
174
|
+
value: this.colorValue,
|
|
175
|
+
innerTabIndex: this.computedTabIndex
|
|
176
|
+
}, this.gradientSettings),
|
|
177
|
+
ref: setRef(this, 'gradient'),
|
|
178
|
+
tabIndex: -1,
|
|
179
|
+
value: this.colorValue,
|
|
180
|
+
innerTabIndex: this.computedTabIndex,
|
|
181
|
+
onChange: this.handleColorChange,
|
|
182
|
+
onKeydown: this.innerKeyDown,
|
|
183
|
+
on: this.v3 ? undefined : {
|
|
184
|
+
'change': this.handleColorChange,
|
|
185
|
+
'keydown': this.innerKeyDown
|
|
186
|
+
}
|
|
187
|
+
}, this.gradientSettings));
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
var renderPalette = function renderPalette() {
|
|
191
|
+
return h(ColorPalette, __assign({
|
|
192
|
+
on: this.v3 ? undefined : {
|
|
193
|
+
'change': this.handlePaletteColorChange,
|
|
194
|
+
'keydown': this.gradientKeyDown
|
|
195
|
+
},
|
|
196
|
+
ref: setRef(this, 'palette'),
|
|
197
|
+
tabIndex: this.computedTabIndex,
|
|
198
|
+
value: this.colorValue,
|
|
199
|
+
attrs: this.v3 ? undefined : __assign({
|
|
200
|
+
tabIndex: this.computedTabIndex,
|
|
201
|
+
value: this.colorValue
|
|
202
|
+
}, this.paletteSettings),
|
|
203
|
+
onChange: this.handlePaletteColorChange,
|
|
204
|
+
onKeydown: this.gradientKeyDown
|
|
205
|
+
}, this.paletteSettings));
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
return h("div", {
|
|
209
|
+
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
210
|
+
attrs: this.v3 ? undefined : {
|
|
211
|
+
tabindex: getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
212
|
+
"aria-disabled": this.$props.disabled
|
|
213
|
+
},
|
|
214
|
+
onFocus: this.onFocus,
|
|
215
|
+
on: this.v3 ? undefined : {
|
|
216
|
+
"focus": this.onFocus,
|
|
217
|
+
"blur": this.onBlur,
|
|
218
|
+
"focusout": this.onFocusout,
|
|
219
|
+
"keydown": this.onKeyDownHandler
|
|
220
|
+
},
|
|
221
|
+
onBlur: this.onBlur,
|
|
222
|
+
onFocusout: this.onFocusout,
|
|
223
|
+
onKeydown: this.onKeyDownHandler,
|
|
224
|
+
"class": classNames('k-flatcolorpicker k-coloreditor', {
|
|
225
|
+
'k-disabled': this.$props.disabled
|
|
226
|
+
}),
|
|
227
|
+
"aria-disabled": this.$props.disabled
|
|
228
|
+
}, [header, this.$props.showClearButton && this.$props.showPreview && h("div", {
|
|
229
|
+
"class": "k-coloreditor-header k-hstack"
|
|
230
|
+
}, [this.$props.view === 'combo' && h("div", {
|
|
231
|
+
"class": "k-coloreditor-header-actions k-hstack"
|
|
232
|
+
}, [// @ts-ignore function children
|
|
233
|
+
h(ButtonGroup, this.v3 ? function () {
|
|
234
|
+
return [// @ts-ignore function children
|
|
235
|
+
h(Button, {
|
|
236
|
+
tabIndex: _this2.computedTabIndex,
|
|
237
|
+
attrs: _this2.v3 ? undefined : {
|
|
238
|
+
tabIndex: _this2.computedTabIndex,
|
|
239
|
+
type: "button",
|
|
240
|
+
togglable: true,
|
|
241
|
+
fillMode: 'flat',
|
|
242
|
+
selected: _this2.isColorGradient,
|
|
243
|
+
ariaLabel: gradientMessage
|
|
244
|
+
},
|
|
245
|
+
type: "button",
|
|
246
|
+
togglable: true,
|
|
247
|
+
fillMode: 'flat',
|
|
248
|
+
selected: _this2.isColorGradient,
|
|
249
|
+
onKeydown: _this2.handleButtonKeydown,
|
|
250
|
+
on: _this2.v3 ? undefined : {
|
|
251
|
+
"keydown": _this2.handleButtonKeydown,
|
|
252
|
+
"click": function click(e) {
|
|
253
|
+
return _this.handleViewChange(e, 'gradient');
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
ariaLabel: gradientMessage,
|
|
257
|
+
onClick: function click(e) {
|
|
258
|
+
return _this.handleViewChange(e, 'gradient');
|
|
259
|
+
}
|
|
260
|
+
}, _this2.v3 ? function () {
|
|
261
|
+
return [h("span", {
|
|
262
|
+
"class": "k-icon k-i-color-canvas"
|
|
263
|
+
})];
|
|
264
|
+
} : [h("span", {
|
|
265
|
+
"class": "k-icon k-i-color-canvas"
|
|
266
|
+
})]), // @ts-ignore function children
|
|
267
|
+
h(Button, {
|
|
268
|
+
tabIndex: _this2.computedTabIndex,
|
|
269
|
+
attrs: _this2.v3 ? undefined : {
|
|
270
|
+
tabIndex: _this2.computedTabIndex,
|
|
271
|
+
type: "button",
|
|
272
|
+
togglable: true,
|
|
273
|
+
fillMode: 'flat',
|
|
274
|
+
selected: !_this2.isColorGradient,
|
|
275
|
+
ariaLabel: paletteMessage
|
|
276
|
+
},
|
|
277
|
+
type: "button",
|
|
278
|
+
togglable: true,
|
|
279
|
+
fillMode: 'flat',
|
|
280
|
+
selected: !_this2.isColorGradient,
|
|
281
|
+
onKeydown: _this2.handleButtonKeydown,
|
|
282
|
+
on: _this2.v3 ? undefined : {
|
|
283
|
+
"keydown": _this2.handleButtonKeydown,
|
|
284
|
+
"click": function click(e) {
|
|
285
|
+
return _this.handleViewChange(e, 'palette');
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
ariaLabel: paletteMessage,
|
|
289
|
+
onClick: function click(e) {
|
|
290
|
+
return _this.handleViewChange(e, 'palette');
|
|
291
|
+
}
|
|
292
|
+
}, _this2.v3 ? function () {
|
|
293
|
+
return [h("span", {
|
|
294
|
+
"class": "k-icon k-i-palette"
|
|
295
|
+
})];
|
|
296
|
+
} : [h("span", {
|
|
297
|
+
"class": "k-icon k-i-palette"
|
|
298
|
+
})])];
|
|
299
|
+
} : [h(Button, {
|
|
300
|
+
tabIndex: _this2.computedTabIndex,
|
|
301
|
+
attrs: _this2.v3 ? undefined : {
|
|
302
|
+
tabIndex: _this2.computedTabIndex,
|
|
303
|
+
type: "button",
|
|
304
|
+
togglable: true,
|
|
305
|
+
fillMode: 'flat',
|
|
306
|
+
selected: _this2.isColorGradient,
|
|
307
|
+
ariaLabel: gradientMessage
|
|
308
|
+
},
|
|
309
|
+
type: "button",
|
|
310
|
+
togglable: true,
|
|
311
|
+
fillMode: 'flat',
|
|
312
|
+
selected: _this2.isColorGradient,
|
|
313
|
+
onKeydown: _this2.handleButtonKeydown,
|
|
314
|
+
on: _this2.v3 ? undefined : {
|
|
315
|
+
"keydown": _this2.handleButtonKeydown,
|
|
316
|
+
"click": function click(e) {
|
|
317
|
+
return _this.handleViewChange(e, 'gradient');
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
ariaLabel: gradientMessage,
|
|
321
|
+
onClick: function click(e) {
|
|
322
|
+
return _this.handleViewChange(e, 'gradient');
|
|
323
|
+
}
|
|
324
|
+
}, _this2.v3 ? function () {
|
|
325
|
+
return [h("span", {
|
|
326
|
+
"class": "k-icon k-i-color-canvas"
|
|
327
|
+
})];
|
|
328
|
+
} : [h("span", {
|
|
329
|
+
"class": "k-icon k-i-color-canvas"
|
|
330
|
+
})]), h(Button, {
|
|
331
|
+
tabIndex: _this2.computedTabIndex,
|
|
332
|
+
attrs: _this2.v3 ? undefined : {
|
|
333
|
+
tabIndex: _this2.computedTabIndex,
|
|
334
|
+
type: "button",
|
|
335
|
+
togglable: true,
|
|
336
|
+
fillMode: 'flat',
|
|
337
|
+
selected: !_this2.isColorGradient,
|
|
338
|
+
ariaLabel: paletteMessage
|
|
339
|
+
},
|
|
340
|
+
type: "button",
|
|
341
|
+
togglable: true,
|
|
342
|
+
fillMode: 'flat',
|
|
343
|
+
selected: !_this2.isColorGradient,
|
|
344
|
+
onKeydown: _this2.handleButtonKeydown,
|
|
345
|
+
on: _this2.v3 ? undefined : {
|
|
346
|
+
"keydown": _this2.handleButtonKeydown,
|
|
347
|
+
"click": function click(e) {
|
|
348
|
+
return _this.handleViewChange(e, 'palette');
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
ariaLabel: paletteMessage,
|
|
352
|
+
onClick: function click(e) {
|
|
353
|
+
return _this.handleViewChange(e, 'palette');
|
|
354
|
+
}
|
|
355
|
+
}, _this2.v3 ? function () {
|
|
356
|
+
return [h("span", {
|
|
357
|
+
"class": "k-icon k-i-palette"
|
|
358
|
+
})];
|
|
359
|
+
} : [h("span", {
|
|
360
|
+
"class": "k-icon k-i-palette"
|
|
361
|
+
})])])]), h("div", {
|
|
362
|
+
"class": "k-spacer"
|
|
363
|
+
}), h("div", {
|
|
364
|
+
"class": "k-coloreditor-header-actions k-hstack"
|
|
365
|
+
}, [this.$props.showClearButton && // @ts-ignore function children
|
|
366
|
+
h(Button, {
|
|
367
|
+
tabIndex: this.computedTabIndex,
|
|
368
|
+
attrs: this.v3 ? undefined : {
|
|
369
|
+
tabIndex: this.computedTabIndex,
|
|
370
|
+
type: "button",
|
|
371
|
+
fillMode: 'flat',
|
|
372
|
+
ariaLabel: clearMessage
|
|
373
|
+
},
|
|
374
|
+
type: "button",
|
|
375
|
+
fillMode: 'flat',
|
|
376
|
+
ariaLabel: clearMessage,
|
|
377
|
+
onKeydown: this.handleButtonKeydown,
|
|
378
|
+
on: this.v3 ? undefined : {
|
|
379
|
+
"keydown": this.handleButtonKeydown,
|
|
380
|
+
"click": this.handleResetColor
|
|
381
|
+
},
|
|
382
|
+
onClick: this.handleResetColor
|
|
383
|
+
}, this.v3 ? function () {
|
|
384
|
+
return [h("span", {
|
|
385
|
+
"class": "k-icon k-i-reset-color"
|
|
386
|
+
})];
|
|
387
|
+
} : [h("span", {
|
|
388
|
+
"class": "k-icon k-i-reset-color"
|
|
389
|
+
})]), this.$props.showPreview && h("div", {
|
|
390
|
+
"class": "k-coloreditor-preview k-vstack"
|
|
391
|
+
}, [h("span", {
|
|
392
|
+
"class": this.previewClass,
|
|
393
|
+
style: {
|
|
394
|
+
background: this.colorValue
|
|
395
|
+
}
|
|
396
|
+
}, [!this.colorValue && h("span", {
|
|
397
|
+
"class": "k-color-preview-mask"
|
|
398
|
+
})]), h("span", {
|
|
399
|
+
"class": this.currentClass,
|
|
400
|
+
style: {
|
|
401
|
+
background: this.computedPrevColor
|
|
402
|
+
},
|
|
403
|
+
onClick: this.handlePrevColorClick,
|
|
404
|
+
on: this.v3 ? undefined : {
|
|
405
|
+
"click": this.handlePrevColorClick
|
|
406
|
+
}
|
|
407
|
+
}, [!this.computedPrevColor && h("span", {
|
|
408
|
+
"class": "k-color-preview-mask"
|
|
409
|
+
})])])])]), h("div", {
|
|
410
|
+
"class": "k-coloreditor-views k-vstack"
|
|
411
|
+
}, [this.isColorGradient ? renderGradiente.call(this) : renderPalette.call(this)]), this.$props.showButtons && h("div", {
|
|
412
|
+
"class": "k-coloreditor-footer k-actions k-actions-end"
|
|
413
|
+
}, [// @ts-ignore function children
|
|
414
|
+
h(Button, {
|
|
415
|
+
tabIndex: this.computedTabIndex,
|
|
416
|
+
attrs: this.v3 ? undefined : {
|
|
417
|
+
tabIndex: this.computedTabIndex,
|
|
418
|
+
type: "button"
|
|
419
|
+
},
|
|
420
|
+
type: "button",
|
|
421
|
+
"class": "k-coloreditor-cancel",
|
|
422
|
+
onKeydown: this.handleButtonKeydown,
|
|
423
|
+
on: this.v3 ? undefined : {
|
|
424
|
+
"keydown": this.handleButtonKeydown,
|
|
425
|
+
"click": this.handleCancelBtnClick
|
|
426
|
+
},
|
|
427
|
+
onClick: this.handleCancelBtnClick
|
|
428
|
+
}, this.v3 ? function () {
|
|
429
|
+
return [cancelMessage];
|
|
430
|
+
} : [cancelMessage]), // @ts-ignore function children
|
|
431
|
+
h(Button, {
|
|
432
|
+
tabIndex: this.computedTabIndex,
|
|
433
|
+
attrs: this.v3 ? undefined : {
|
|
434
|
+
tabIndex: this.computedTabIndex,
|
|
435
|
+
type: "button"
|
|
436
|
+
},
|
|
437
|
+
type: "button",
|
|
438
|
+
"class": "k-coloreditor-apply k-primary",
|
|
439
|
+
onKeydown: this.handleButtonKeydown,
|
|
440
|
+
on: this.v3 ? undefined : {
|
|
441
|
+
"keydown": this.handleButtonKeydown,
|
|
442
|
+
"click": this.handleApplyBtnClick
|
|
443
|
+
},
|
|
444
|
+
onClick: this.handleApplyBtnClick
|
|
445
|
+
}, this.v3 ? function () {
|
|
446
|
+
return [applyMessage];
|
|
447
|
+
} : [applyMessage])]), footer]);
|
|
448
|
+
},
|
|
449
|
+
methods: {
|
|
450
|
+
focus: function focus() {
|
|
451
|
+
var _this = this;
|
|
452
|
+
|
|
453
|
+
this.focused = true;
|
|
454
|
+
setTimeout(function () {
|
|
455
|
+
focusFirstFocusableChild(_this.$el);
|
|
456
|
+
}, 1);
|
|
457
|
+
},
|
|
458
|
+
onKeyDownHandler: function onKeyDownHandler(e) {
|
|
459
|
+
var element = this.$el;
|
|
460
|
+
this.focused = focusContainer(e, element);
|
|
461
|
+
this.$emit('keydown', e);
|
|
462
|
+
},
|
|
463
|
+
handleViewChange: function handleViewChange(event, viewType) {
|
|
464
|
+
this.currentView = viewType;
|
|
465
|
+
this.$emit('viewchange', {
|
|
466
|
+
event: event,
|
|
467
|
+
viewType: viewType
|
|
468
|
+
});
|
|
469
|
+
},
|
|
470
|
+
handleResetColor: function handleResetColor() {
|
|
471
|
+
this.colorValue = null;
|
|
472
|
+
},
|
|
473
|
+
handleColorChange: function handleColorChange(event) {
|
|
474
|
+
this.colorValue = event.value;
|
|
475
|
+
},
|
|
476
|
+
handlePaletteColorChange: function handlePaletteColorChange(event) {
|
|
477
|
+
this.colorValue = event.value;
|
|
478
|
+
},
|
|
479
|
+
handleApplyBtnClick: function handleApplyBtnClick(event) {
|
|
480
|
+
var rgbaValue = parseColor(this.colorValue, 'rgba');
|
|
481
|
+
this.currentPrevColor = this.colorValue;
|
|
482
|
+
this.$emit('changemodel', this.colorValue);
|
|
483
|
+
this.$emit('update:modelValue', this.colorValue);
|
|
484
|
+
this.$emit('update:modelRgbaValue', rgbaValue);
|
|
485
|
+
this.$emit('change', {
|
|
486
|
+
event: event,
|
|
487
|
+
value: this.colorValue,
|
|
488
|
+
rgbaValue: rgbaValue
|
|
489
|
+
});
|
|
490
|
+
},
|
|
491
|
+
innerKeyDown: function innerKeyDown(event) {
|
|
492
|
+
if (event.keyCode === Keys.enter) {
|
|
493
|
+
this.handleApplyBtnClick(event);
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
gradientKeyDown: function gradientKeyDown(event) {
|
|
497
|
+
event.stopPropagation();
|
|
498
|
+
|
|
499
|
+
if (!this.showButtons && event.keyCode === Keys.enter) {
|
|
500
|
+
this.handleApplyBtnClick(event);
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
handleButtonKeydown: function handleButtonKeydown(e) {
|
|
504
|
+
if (e.keyCode === Keys.enter) {
|
|
505
|
+
e.stopPropagation();
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
handleCancelBtnClick: function handleCancelBtnClick() {
|
|
509
|
+
this.colorValue = this.computedPrevColor;
|
|
510
|
+
},
|
|
511
|
+
handlePrevColorClick: function handlePrevColorClick() {
|
|
512
|
+
this.colorValue = this.computedPrevColor;
|
|
513
|
+
},
|
|
514
|
+
onFocus: function onFocus(event) {
|
|
515
|
+
this.$emit('focus', {
|
|
516
|
+
event: event,
|
|
517
|
+
target: this
|
|
518
|
+
});
|
|
519
|
+
},
|
|
520
|
+
onBlur: function onBlur(event) {
|
|
521
|
+
this.$emit('blur', {
|
|
522
|
+
event: event,
|
|
523
|
+
target: this
|
|
524
|
+
});
|
|
525
|
+
},
|
|
526
|
+
onFocusout: function onFocusout(event) {
|
|
527
|
+
this.$emit('focusout', {
|
|
528
|
+
event: event,
|
|
529
|
+
target: this
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
/**
|
|
535
|
+
* @hidden
|
|
536
|
+
*/
|
|
537
|
+
|
|
538
|
+
var FlatColorPicker = FlatColorPickerVue2;
|
|
539
|
+
export { FlatColorPicker, FlatColorPickerVue2 };
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
tabIndex: number;
|
|
11
|
+
hex: string;
|
|
12
|
+
onHexChange?: any;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
export interface HexInputState {
|
|
19
|
+
originalHex: string;
|
|
20
|
+
hex: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @hidden
|
|
24
|
+
*/
|
|
25
|
+
export interface HexInputComputed {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
export interface HexInputMethods {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
export interface HexInputData {
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @hidden
|
|
41
|
+
*/
|
|
42
|
+
export interface HexInputAll extends Vue2type, HexInputMethods, HexInputData, HexInputComputed, HexInputState {
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @hidden
|
|
46
|
+
*/
|
|
47
|
+
declare let HexInputVue2: ComponentOptions<HexInputAll, DefaultData<HexInputData>, DefaultMethods<HexInputAll>, HexInputComputed, RecordPropsDefinition<HexInputProps>>;
|
|
48
|
+
/**
|
|
49
|
+
* @hidden
|
|
50
|
+
*/
|
|
51
|
+
declare const HexInput: DefineComponent<HexInputProps, any, HexInputData, HexInputComputed, HexInputMethods, {}, {}, {}, string, HexInputProps, HexInputProps, {}>;
|
|
52
|
+
export { HexInput, HexInputVue2 };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import * as Vue from 'vue';
|
|
3
|
+
var allVue = Vue;
|
|
4
|
+
var gh = allVue.h;
|
|
5
|
+
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
6
|
+
import { parseColor } from './utils/color-parser.js';
|
|
7
|
+
import { isPresent } from './utils/misc.js';
|
|
8
|
+
import { Input as KInput } from '../input/Input.js';
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
var HexInputVue2 = {
|
|
14
|
+
name: 'KendoHexInput',
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
emits: {
|
|
17
|
+
'hexchange': null,
|
|
18
|
+
'blur': null,
|
|
19
|
+
'focus': null
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
tabIndex: Number,
|
|
23
|
+
hex: String,
|
|
24
|
+
disabled: Boolean
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
isHexValid: function isHexValid() {
|
|
28
|
+
return !!parseColor(this.currentHex, 'rgba');
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
data: function data() {
|
|
32
|
+
return {
|
|
33
|
+
currentHex: this.$props.hex,
|
|
34
|
+
originalHex: this.$props.hex
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
mounted: function mounted() {
|
|
38
|
+
this._input = this.$refs.input._input;
|
|
39
|
+
},
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
setup: !isV3 ? undefined : function () {
|
|
42
|
+
var v3 = !!isV3;
|
|
43
|
+
return {
|
|
44
|
+
v3: v3
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
watch: {
|
|
48
|
+
hex: function hex(newValue) {
|
|
49
|
+
this.currentHex = newValue;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
render: function render(createElement) {
|
|
54
|
+
var h = gh || createElement;
|
|
55
|
+
return h(KInput, {
|
|
56
|
+
value: this.currentHex,
|
|
57
|
+
attrs: this.v3 ? undefined : {
|
|
58
|
+
value: this.currentHex,
|
|
59
|
+
valid: this.isHexValid,
|
|
60
|
+
disabled: this.$props.disabled,
|
|
61
|
+
tabIndex: this.tabIndex
|
|
62
|
+
},
|
|
63
|
+
onInput: this.onChange,
|
|
64
|
+
on: this.v3 ? undefined : {
|
|
65
|
+
"input": this.onChange,
|
|
66
|
+
"change": this.onChange,
|
|
67
|
+
"focus": this.onFocus,
|
|
68
|
+
"blur": this.onBlur
|
|
69
|
+
},
|
|
70
|
+
onChange: this.onChange,
|
|
71
|
+
onFocus: this.onFocus,
|
|
72
|
+
onBlur: this.onBlur,
|
|
73
|
+
valid: this.isHexValid,
|
|
74
|
+
disabled: this.$props.disabled,
|
|
75
|
+
tabIndex: this.tabIndex,
|
|
76
|
+
ref: 'input'
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
methods: {
|
|
80
|
+
onChange: function onChange(event) {
|
|
81
|
+
var hex = event.target.value;
|
|
82
|
+
var value = parseColor(hex, 'rgba');
|
|
83
|
+
this.currentHex = hex;
|
|
84
|
+
|
|
85
|
+
if (isPresent(value)) {
|
|
86
|
+
this.$emit('hexchange', {
|
|
87
|
+
hex: hex,
|
|
88
|
+
value: value,
|
|
89
|
+
event: event
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
onBlur: function onBlur(event) {
|
|
94
|
+
if (!isPresent(parseColor(this.hex, 'rgba'))) {
|
|
95
|
+
this.currentHex = this.originalHex;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
this.$emit('blur', event);
|
|
99
|
+
},
|
|
100
|
+
onFocus: function onFocus(event) {
|
|
101
|
+
this.$emit('focus', event);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* @hidden
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
var HexInput = HexInputVue2;
|
|
110
|
+
export { HexInput, HexInputVue2 };
|