@progress/kendo-vue-inputs 2.7.0 → 2.7.2-dev.202201020746
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 +15 -0
- package/dist/es/main.js +15 -0
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/switch/Switch.d.ts +131 -0
- package/dist/es/switch/Switch.js +307 -0
- package/dist/es/switch/util.d.ts +8 -0
- package/dist/es/switch/util.js +46 -0
- package/dist/es/textarea/TextArea.d.ts +46 -0
- package/dist/es/textarea/TextArea.js +251 -0
- package/dist/es/textarea/interfaces/TextAreaBlurEvent.d.ts +5 -0
- package/dist/es/textarea/interfaces/TextAreaBlurEvent.js +0 -0
- package/dist/es/textarea/interfaces/TextAreaChangeEvent.d.ts +9 -0
- package/dist/es/textarea/interfaces/TextAreaChangeEvent.js +0 -0
- package/dist/es/textarea/interfaces/TextAreaFocusEvent.d.ts +5 -0
- package/dist/es/textarea/interfaces/TextAreaFocusEvent.js +0 -0
- package/dist/es/textarea/interfaces/TextAreaProps.d.ts +84 -0
- package/dist/es/textarea/interfaces/TextAreaProps.js +0 -0
- 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 +15 -0
- package/dist/npm/main.js +17 -0
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/switch/Switch.d.ts +131 -0
- package/dist/npm/switch/Switch.js +320 -0
- package/dist/npm/switch/util.d.ts +8 -0
- package/dist/npm/switch/util.js +49 -0
- package/dist/npm/textarea/TextArea.d.ts +46 -0
- package/dist/npm/textarea/TextArea.js +261 -0
- package/dist/npm/textarea/interfaces/TextAreaBlurEvent.d.ts +5 -0
- package/dist/npm/textarea/interfaces/TextAreaBlurEvent.js +2 -0
- package/dist/npm/textarea/interfaces/TextAreaChangeEvent.d.ts +9 -0
- package/dist/npm/textarea/interfaces/TextAreaChangeEvent.js +2 -0
- package/dist/npm/textarea/interfaces/TextAreaFocusEvent.d.ts +5 -0
- package/dist/npm/textarea/interfaces/TextAreaFocusEvent.js +2 -0
- package/dist/npm/textarea/interfaces/TextAreaProps.d.ts +84 -0
- package/dist/npm/textarea/interfaces/TextAreaProps.js +5 -0
- package/package.json +13 -7
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { FormComponentProps } from '@progress/kendo-vue-common';
|
|
2
|
+
import { TextAreaBlurEvent } from './TextAreaBlurEvent';
|
|
3
|
+
import { TextAreaChangeEvent } from './TextAreaChangeEvent';
|
|
4
|
+
import { TextAreaFocusEvent } from './TextAreaFocusEvent';
|
|
5
|
+
/**
|
|
6
|
+
* Represents the props of the [Kendo UI for Vue TextArea component]({% slug overview_textarea %}).
|
|
7
|
+
*/
|
|
8
|
+
export interface TextAreaProps extends FormComponentProps {
|
|
9
|
+
/**
|
|
10
|
+
* 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).
|
|
11
|
+
* For example these elements could contain error or hint message.
|
|
12
|
+
*/
|
|
13
|
+
ariaDescribedBy?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Identifies the element(s) which will label the component.
|
|
16
|
+
*/
|
|
17
|
+
ariaLabelledBy?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Specifies if the textarea element will resize its height automatically ([see example]({% slug sizing_textarea %})).
|
|
20
|
+
* Defaults to `false`.
|
|
21
|
+
*/
|
|
22
|
+
autoSize?: boolean;
|
|
23
|
+
modelValue?: string | string[] | number;
|
|
24
|
+
/**
|
|
25
|
+
* Specifies a list of CSS classes that will be added to the TextArea.
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The default value of the TextArea ([see example]({% slug default_textarea %})).
|
|
30
|
+
*/
|
|
31
|
+
defaultValue?: string | string[] | number;
|
|
32
|
+
/**
|
|
33
|
+
* Represents the `dir` HTML attribute.
|
|
34
|
+
*/
|
|
35
|
+
dir?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Specifies if the TextArea is disabled ([see example]({% slug disabled_textarea %})).
|
|
38
|
+
*/
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Sets the read-only state of the TextArea.
|
|
42
|
+
*/
|
|
43
|
+
readOnly?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Specifies an exact height size for the TextArea to take ([see example]({% slug sizing_textarea %})).
|
|
46
|
+
*/
|
|
47
|
+
rows?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the `id` of the TextArea.
|
|
50
|
+
*/
|
|
51
|
+
id?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Specifies the `name` property of the `textarea` DOM element.
|
|
54
|
+
*
|
|
55
|
+
* This property is part of the [FormComponentProps]({% slug api_common_formcomponentprops %}) interface.
|
|
56
|
+
*/
|
|
57
|
+
name?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The hint that is displayed when the TextArea is empty.
|
|
60
|
+
*/
|
|
61
|
+
placeholder?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Sets the `tabIndex` property of the TextArea.
|
|
64
|
+
* Defaults to `0`.
|
|
65
|
+
*/
|
|
66
|
+
tabIndex?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Sets the value to be submitted ([see example]({% slug controlled_textarea %})).
|
|
69
|
+
*/
|
|
70
|
+
value?: string | string[] | number;
|
|
71
|
+
validityStyles?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The event handler that will be fired when the changes the selected value.
|
|
74
|
+
*/
|
|
75
|
+
onChange?: (event: TextAreaChangeEvent) => void;
|
|
76
|
+
/**
|
|
77
|
+
* The event handler that will be fired when TextArea is focused.
|
|
78
|
+
*/
|
|
79
|
+
onFocus?: (event: TextAreaFocusEvent) => void;
|
|
80
|
+
/**
|
|
81
|
+
* The event handler that will be fired when TextArea is blurred.
|
|
82
|
+
*/
|
|
83
|
+
onBlur?: (event: TextAreaBlurEvent) => void;
|
|
84
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { ColorPaletteService } from './utils/color-palette.service';
|
|
8
|
+
import { ColorPaletteProps } from './interfaces/ColorPaletteProps';
|
|
9
|
+
/**
|
|
10
|
+
* @hidden
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFAULT_TILE_SIZE = 24;
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_COLUMNS_COUNT = 10;
|
|
17
|
+
/**
|
|
18
|
+
* @hidden
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEFAULT_PRESET = "office";
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export interface ColorPaletteState {
|
|
25
|
+
wrapper: HTMLDivElement | null;
|
|
26
|
+
paletteService: ColorPaletteService;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @hidden
|
|
30
|
+
*/
|
|
31
|
+
export interface ColorPaletteComputed {
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
export interface ColorPaletteMethods {
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
export interface ColorPaletteData {
|
|
44
|
+
selectedColor?: string;
|
|
45
|
+
focusedColor?: string;
|
|
46
|
+
isFirstRender: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @hidden
|
|
50
|
+
*/
|
|
51
|
+
export interface ColorPaletteAll extends Vue, ColorPaletteMethods, ColorPaletteData, ColorPaletteComputed, ColorPaletteState {
|
|
52
|
+
}
|
|
53
|
+
declare let ColorPalette: ComponentOptions<ColorPaletteAll, DefaultData<ColorPaletteData>, DefaultMethods<ColorPaletteAll>, ColorPaletteComputed, RecordPropsDefinition<ColorPaletteProps>>;
|
|
54
|
+
declare const ColorPaletteVue3: DefineComponent<ColorPaletteProps, any, ColorPaletteData, ColorPaletteComputed, ColorPaletteMethods, {}, {}, {}, string, ColorPaletteProps, ColorPaletteProps, {}>;
|
|
55
|
+
export { ColorPalette, ColorPaletteVue3 };
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ColorPaletteVue3 = exports.ColorPalette = exports.DEFAULT_PRESET = exports.DEFAULT_COLUMNS_COUNT = exports.DEFAULT_TILE_SIZE = void 0; // @ts-ignore
|
|
7
|
+
|
|
8
|
+
var Vue = require("vue");
|
|
9
|
+
|
|
10
|
+
var allVue = Vue;
|
|
11
|
+
var gh = allVue.h;
|
|
12
|
+
|
|
13
|
+
var color_palette_service_1 = require("./utils/color-palette.service");
|
|
14
|
+
|
|
15
|
+
var kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
16
|
+
|
|
17
|
+
var package_metadata_1 = require("../package-metadata");
|
|
18
|
+
|
|
19
|
+
var palette_presets_1 = require("./models/palette-presets");
|
|
20
|
+
|
|
21
|
+
var misc_1 = require("./utils/misc");
|
|
22
|
+
|
|
23
|
+
var color_parser_1 = require("./utils/color-parser");
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
exports.DEFAULT_TILE_SIZE = 24;
|
|
30
|
+
/**
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
exports.DEFAULT_COLUMNS_COUNT = 10;
|
|
35
|
+
/**
|
|
36
|
+
* @hidden
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
exports.DEFAULT_PRESET = 'office'; // tslint:enable:max-line-length
|
|
40
|
+
|
|
41
|
+
var ColorPalette = {
|
|
42
|
+
name: 'KendoColorPalette',
|
|
43
|
+
props: {
|
|
44
|
+
palette: {
|
|
45
|
+
type: [String, Array],
|
|
46
|
+
default: exports.DEFAULT_PRESET
|
|
47
|
+
},
|
|
48
|
+
columns: Number,
|
|
49
|
+
tileSize: {
|
|
50
|
+
type: [Number, Object],
|
|
51
|
+
default: exports.DEFAULT_TILE_SIZE
|
|
52
|
+
},
|
|
53
|
+
defaultValue: String,
|
|
54
|
+
value: String,
|
|
55
|
+
disabled: Boolean,
|
|
56
|
+
tabIndex: Number,
|
|
57
|
+
id: String,
|
|
58
|
+
ariaLabelledBy: String,
|
|
59
|
+
ariaDescribedBy: String
|
|
60
|
+
},
|
|
61
|
+
created: function created() {
|
|
62
|
+
kendo_vue_common_1.validatePackage(package_metadata_1.packageMetadata);
|
|
63
|
+
},
|
|
64
|
+
mounted: function mounted() {
|
|
65
|
+
this.wrapper = this.v3 ? this.wrapperRef : this.$refs.wrapper;
|
|
66
|
+
},
|
|
67
|
+
updated: function updated() {
|
|
68
|
+
this.wrapper = this.v3 ? this.wrapperRef : this.$refs.wrapper;
|
|
69
|
+
},
|
|
70
|
+
computed: {
|
|
71
|
+
focusedColorCooridanates: function focusedColorCooridanates() {
|
|
72
|
+
return this.focusedColor ? this.paletteService.getCellCoordsFor(this.focusedColor) : undefined;
|
|
73
|
+
},
|
|
74
|
+
isUncontrolled: function isUncontrolled() {
|
|
75
|
+
return this.$props.value === undefined;
|
|
76
|
+
},
|
|
77
|
+
selectedColor: function selectedColor() {
|
|
78
|
+
return this.$props.value !== undefined ? this.$props.value : this.currentValue !== undefined ? this.currentValue : this.$props.defaultValue;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
data: function data() {
|
|
82
|
+
return {
|
|
83
|
+
focusedColor: undefined,
|
|
84
|
+
currentValue: undefined,
|
|
85
|
+
isFirstRender: true
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
setup: !gh ? undefined : function () {
|
|
90
|
+
var v3 = !!gh;
|
|
91
|
+
return {
|
|
92
|
+
v3: v3
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
// @ts-ignore
|
|
96
|
+
render: function render(createElement) {
|
|
97
|
+
var _this = this;
|
|
98
|
+
|
|
99
|
+
var h = gh || createElement;
|
|
100
|
+
var paletteInfo = this.getPaletteInfo();
|
|
101
|
+
var svc = this.paletteService = new color_palette_service_1.ColorPaletteService();
|
|
102
|
+
svc.setColorMatrix(paletteInfo.colors, paletteInfo.columns);
|
|
103
|
+
var selectedCellCoords = svc.getCellCoordsFor(this.selectedColor);
|
|
104
|
+
var focusedCellCoords = svc.getCellCoordsFor(this.focusedColor);
|
|
105
|
+
var className = kendo_vue_common_1.classNames('k-colorpalette', {
|
|
106
|
+
'k-state-disabled': this.$props.disabled
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
var renderColumns = function renderColumns(columns, rowIndex, cSelectedCellCoords, cFocusedCellCoords) {
|
|
110
|
+
var rowIsSelected = cSelectedCellCoords !== undefined && cSelectedCellCoords.row === rowIndex;
|
|
111
|
+
var selectedColumn = cSelectedCellCoords && cSelectedCellCoords.col;
|
|
112
|
+
var rowIsFocused = cFocusedCellCoords !== undefined && cFocusedCellCoords.row === rowIndex;
|
|
113
|
+
var focusedColumn = cFocusedCellCoords && cFocusedCellCoords.col;
|
|
114
|
+
var tileSize = typeof this.$props.tileSize !== 'number' ? this.$props.tileSize : {
|
|
115
|
+
width: this.$props.tileSize,
|
|
116
|
+
height: this.$props.tileSize
|
|
117
|
+
};
|
|
118
|
+
var width = tileSize.width + 'px';
|
|
119
|
+
var height = tileSize.height + 'px';
|
|
120
|
+
return columns.map(function (color, i) {
|
|
121
|
+
var _this = this;
|
|
122
|
+
|
|
123
|
+
var isSelected = rowIsSelected && selectedColumn === i;
|
|
124
|
+
var tdClassName = kendo_vue_common_1.classNames('k-colorpalette-tile', {
|
|
125
|
+
'k-state-selected': isSelected,
|
|
126
|
+
'k-state-focus': rowIsFocused && focusedColumn === i
|
|
127
|
+
});
|
|
128
|
+
return h("td", {
|
|
129
|
+
"class": tdClassName,
|
|
130
|
+
"aria-label": color,
|
|
131
|
+
attrs: this.v3 ? undefined : {
|
|
132
|
+
"aria-label": color,
|
|
133
|
+
"aria-selected": isSelected ? true : this.$props.disabled ? undefined : false,
|
|
134
|
+
id: this.createCellId({
|
|
135
|
+
row: rowIndex,
|
|
136
|
+
col: i
|
|
137
|
+
})
|
|
138
|
+
},
|
|
139
|
+
"aria-selected": isSelected ? true : this.$props.disabled ? undefined : false,
|
|
140
|
+
style: {
|
|
141
|
+
backgroundColor: color,
|
|
142
|
+
width: width,
|
|
143
|
+
height: height,
|
|
144
|
+
minWidth: width
|
|
145
|
+
},
|
|
146
|
+
onClick: function onClick(event) {
|
|
147
|
+
return _this.onColorClick(color, event);
|
|
148
|
+
},
|
|
149
|
+
on: this.v3 ? undefined : {
|
|
150
|
+
"click": function onClick(event) {
|
|
151
|
+
return _this.onColorClick(color, event);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
id: this.createCellId({
|
|
155
|
+
row: rowIndex,
|
|
156
|
+
col: i
|
|
157
|
+
}),
|
|
158
|
+
key: i
|
|
159
|
+
});
|
|
160
|
+
}, this);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
var renderRows = function renderRows(rows, rSelectedCellCoords, rFocusedCellCoords) {
|
|
164
|
+
return rows.map(function (row, i) {
|
|
165
|
+
return h("tr", {
|
|
166
|
+
role: "row",
|
|
167
|
+
attrs: this.v3 ? undefined : {
|
|
168
|
+
role: "row"
|
|
169
|
+
},
|
|
170
|
+
key: i
|
|
171
|
+
}, [renderColumns.call(this, row, i, rSelectedCellCoords, rFocusedCellCoords)]);
|
|
172
|
+
}, this);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
if (paletteInfo.colors.length) {
|
|
176
|
+
return h("div", {
|
|
177
|
+
id: this.$props.id,
|
|
178
|
+
attrs: this.v3 ? undefined : {
|
|
179
|
+
id: this.$props.id,
|
|
180
|
+
"aria-disabled": this.$props.disabled ? 'true' : undefined,
|
|
181
|
+
"aria-activedescendant": selectedCellCoords && this.createCellId(selectedCellCoords),
|
|
182
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
183
|
+
"aria-describedby": this.$props.ariaDescribedBy,
|
|
184
|
+
tabIndex: kendo_vue_common_1.getTabIndex(this.$props.tabIndex, this.$props.disabled)
|
|
185
|
+
},
|
|
186
|
+
"class": className,
|
|
187
|
+
onFocusin: this.onFocus,
|
|
188
|
+
on: this.v3 ? undefined : {
|
|
189
|
+
"focusin": this.onFocus,
|
|
190
|
+
"focusout": this.onBlur,
|
|
191
|
+
"keydown": this.onKeyDown
|
|
192
|
+
},
|
|
193
|
+
onFocusout: this.onBlur,
|
|
194
|
+
onKeydown: this.onKeyDown,
|
|
195
|
+
"aria-disabled": this.$props.disabled ? 'true' : undefined,
|
|
196
|
+
"aria-activedescendant": selectedCellCoords && this.createCellId(selectedCellCoords),
|
|
197
|
+
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
198
|
+
"aria-describedby": this.$props.ariaDescribedBy,
|
|
199
|
+
tabIndex: kendo_vue_common_1.getTabIndex(this.$props.tabIndex, this.$props.disabled),
|
|
200
|
+
ref: this.v3 ? function (el) {
|
|
201
|
+
_this.wrapperRef = el;
|
|
202
|
+
} : 'wrapper'
|
|
203
|
+
}, [h("div", {
|
|
204
|
+
"class": "k-colorpalette-table-wrap",
|
|
205
|
+
role: "grid",
|
|
206
|
+
attrs: this.v3 ? undefined : {
|
|
207
|
+
role: "grid"
|
|
208
|
+
}
|
|
209
|
+
}, [h("table", {
|
|
210
|
+
"class": "k-colorpalette-table k-palette",
|
|
211
|
+
role: "presentation",
|
|
212
|
+
attrs: this.v3 ? undefined : {
|
|
213
|
+
role: "presentation"
|
|
214
|
+
}
|
|
215
|
+
}, [h("tbody", [renderRows.call(this, svc.colorRows, selectedCellCoords, focusedCellCoords)])])])]);
|
|
216
|
+
} else {
|
|
217
|
+
// In this way, the code prevents an eventual focus of the component when no cells are available.
|
|
218
|
+
// This is needed because upon focus the first cell gets focused.
|
|
219
|
+
return '';
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
methods: {
|
|
223
|
+
focus: function focus() {
|
|
224
|
+
if (this.wrapper) {
|
|
225
|
+
this.wrapper.focus();
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
getDerivedStateFromProps: function getDerivedStateFromProps(props, state) {
|
|
229
|
+
if (!state.isFirstRender && props.value !== undefined) {
|
|
230
|
+
// The component is in controlled mode.
|
|
231
|
+
if (props.value === '' && state.selectedColor !== undefined) {
|
|
232
|
+
// The selection has to be removed.
|
|
233
|
+
return {
|
|
234
|
+
selectedColor: undefined
|
|
235
|
+
};
|
|
236
|
+
} else if (props.value !== '' && props.value !== state.selectedColor) {
|
|
237
|
+
return {
|
|
238
|
+
selectedColor: props.value
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
} else if (state.isFirstRender) {
|
|
242
|
+
return {
|
|
243
|
+
isFirstRender: false
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return null;
|
|
248
|
+
},
|
|
249
|
+
onKeyDown: function onKeyDown(event) {
|
|
250
|
+
switch (event.keyCode) {
|
|
251
|
+
case kendo_vue_common_1.Keys.down:
|
|
252
|
+
this.handleCellNavigation(0, 1);
|
|
253
|
+
break;
|
|
254
|
+
|
|
255
|
+
case kendo_vue_common_1.Keys.up:
|
|
256
|
+
this.handleCellNavigation(0, -1);
|
|
257
|
+
break;
|
|
258
|
+
|
|
259
|
+
case kendo_vue_common_1.Keys.right:
|
|
260
|
+
this.handleCellNavigation(1, 0);
|
|
261
|
+
break;
|
|
262
|
+
|
|
263
|
+
case kendo_vue_common_1.Keys.left:
|
|
264
|
+
this.handleCellNavigation(-1, 0);
|
|
265
|
+
break;
|
|
266
|
+
|
|
267
|
+
case kendo_vue_common_1.Keys.enter:
|
|
268
|
+
this.handleEnter(event);
|
|
269
|
+
break;
|
|
270
|
+
|
|
271
|
+
default:
|
|
272
|
+
this.$emit('keydown', event);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
event.preventDefault();
|
|
277
|
+
this.$emit('keydown', event);
|
|
278
|
+
},
|
|
279
|
+
onColorClick: function onColorClick(color, event) {
|
|
280
|
+
if (this.isUncontrolled) {
|
|
281
|
+
this.currentValue = color;
|
|
282
|
+
this.focusedColor = color;
|
|
283
|
+
} else {
|
|
284
|
+
this.focusedColor = color;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
this.dispatchChangeEvent(color, event);
|
|
288
|
+
},
|
|
289
|
+
onFocus: function onFocus(event) {
|
|
290
|
+
this.focusedColor = this.selectedColor || this.paletteService.colorRows[0][0];
|
|
291
|
+
this.$emit('focus', {
|
|
292
|
+
event: event,
|
|
293
|
+
target: this
|
|
294
|
+
});
|
|
295
|
+
},
|
|
296
|
+
onBlur: function onBlur(event) {
|
|
297
|
+
this.focusedColor = undefined;
|
|
298
|
+
this.$emit('blur', {
|
|
299
|
+
event: event,
|
|
300
|
+
target: this
|
|
301
|
+
});
|
|
302
|
+
},
|
|
303
|
+
handleCellNavigation: function handleCellNavigation(horizontalStep, verticalStep) {
|
|
304
|
+
if (this.focusedColorCooridanates) {
|
|
305
|
+
var newCoords = this.paletteService.getNextCell(this.focusedColorCooridanates, horizontalStep, verticalStep);
|
|
306
|
+
this.focusedColor = this.paletteService.getColorAt(newCoords);
|
|
307
|
+
} else {
|
|
308
|
+
this.focusedColor = this.paletteService.colorRows[0][0];
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
handleEnter: function handleEnter(event) {
|
|
312
|
+
if (this.isUncontrolled) {
|
|
313
|
+
this.currentValue = this.focusedColor;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
this.dispatchChangeEvent(this.focusedColor, event);
|
|
317
|
+
},
|
|
318
|
+
dispatchChangeEvent: function dispatchChangeEvent(value, event) {
|
|
319
|
+
this.$emit('change', {
|
|
320
|
+
event: event,
|
|
321
|
+
component: this,
|
|
322
|
+
value: value,
|
|
323
|
+
rgbaValue: color_parser_1.parseColor(value, 'rgba')
|
|
324
|
+
});
|
|
325
|
+
},
|
|
326
|
+
getPaletteInfo: function getPaletteInfo() {
|
|
327
|
+
if (typeof this.$props.palette === 'string') {
|
|
328
|
+
var preset = palette_presets_1.PALETTEPRESETS[this.$props.palette];
|
|
329
|
+
|
|
330
|
+
if (misc_1.isPresent(preset)) {
|
|
331
|
+
return {
|
|
332
|
+
colors: preset.colors,
|
|
333
|
+
columns: this.$props.columns || preset.columns || exports.DEFAULT_COLUMNS_COUNT
|
|
334
|
+
};
|
|
335
|
+
} else {
|
|
336
|
+
return {
|
|
337
|
+
colors: [],
|
|
338
|
+
columns: 0
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
} else {
|
|
342
|
+
return {
|
|
343
|
+
colors: this.$props.palette || [],
|
|
344
|
+
columns: this.$props.columns || exports.DEFAULT_COLUMNS_COUNT
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
createCellId: function createCellId(cellCoords) {
|
|
349
|
+
return this.guid + "_" + cellCoords.row + "_" + cellCoords.col;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
exports.ColorPalette = ColorPalette;
|
|
354
|
+
var ColorPaletteVue3 = ColorPalette;
|
|
355
|
+
exports.ColorPaletteVue3 = ColorPaletteVue3;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { ColorPickerProps } from './interfaces/ColorPickerProps';
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export interface ColorPickerHandle {
|
|
12
|
+
element: HTMLSpanElement | null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export interface ColorPickerState {
|
|
18
|
+
focusableElementGuid: string;
|
|
19
|
+
focusableElement: any;
|
|
20
|
+
palette: any | null;
|
|
21
|
+
blurTimeout: any | undefined;
|
|
22
|
+
button: HTMLSpanElement | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
export interface ColorPickerComputed {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
33
|
+
export interface ColorPickerMethods {
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
focus: (e: any) => void;
|
|
36
|
+
toggleIfApplicable: () => void;
|
|
37
|
+
handleClick: (event: any) => void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @hidden
|
|
41
|
+
*/
|
|
42
|
+
export interface ColorPickerData {
|
|
43
|
+
currentActive: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @hidden
|
|
47
|
+
*/
|
|
48
|
+
export interface ColorPickerAll extends Vue, ColorPickerMethods, ColorPickerData, ColorPickerComputed, ColorPickerState {
|
|
49
|
+
}
|
|
50
|
+
declare let ColorPicker: ComponentOptions<ColorPickerAll, DefaultData<ColorPickerData>, DefaultMethods<ColorPickerAll>, ColorPickerComputed, RecordPropsDefinition<ColorPickerProps>>;
|
|
51
|
+
declare const ColorPickerVue3: DefineComponent<ColorPickerProps, any, ColorPickerData, ColorPickerComputed, ColorPickerMethods, {}, {}, {}, string, ColorPickerProps, ColorPickerProps, {}>;
|
|
52
|
+
export { ColorPicker, ColorPickerVue3 };
|