@progress/kendo-vue-inputs 9.2.0 → 9.3.0-develop.1
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/colors/ColorContrastLabels.js +1 -1
- package/colors/ColorContrastLabels.mjs +4 -4
- package/colors/ColorGradient.d.ts +4 -0
- package/colors/ColorGradient.js +2 -2
- package/colors/ColorGradient.mjs +52 -46
- package/colors/ColorInput.d.ts +2 -2
- package/colors/ColorInput.js +1 -1
- package/colors/ColorInput.mjs +84 -80
- package/colors/ColorPalette.d.ts +2 -0
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +18 -16
- package/colors/FlatColorPicker.d.ts +6 -0
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +65 -75
- package/colors/HexInput.d.ts +1 -0
- package/colors/HexInput.js +1 -1
- package/colors/HexInput.mjs +12 -11
- package/colors/interfaces/ColorGradientProps.d.ts +9 -0
- package/colors/interfaces/ColorPaletteProps.d.ts +4 -0
- package/colors/interfaces/ColorPickerPaletteSettings.d.ts +4 -0
- package/dist/cdn/js/kendo-vue-inputs.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +9 -9
- package/rating/RatingItem.d.ts +3 -3
- package/signature/SignatureBottomActions.d.ts +1 -1
- package/signature/SignatureCanvas.d.ts +3 -3
- package/signature/SignatureDialog.d.ts +8 -8
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +8 -7
- package/slider/SliderLabel.d.ts +1 -1
package/colors/ColorInput.mjs
CHANGED
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as
|
|
9
|
-
import { HexInput as
|
|
10
|
-
import { Button as
|
|
8
|
+
import { defineComponent as z, createVNode as e, isVNode as G } from "vue";
|
|
9
|
+
import { HexInput as y } from "./HexInput.mjs";
|
|
10
|
+
import { Button as B } from "@progress/kendo-vue-buttons";
|
|
11
11
|
import { Label as o } from "@progress/kendo-vue-labels";
|
|
12
|
-
import { provideLocalizationService as
|
|
13
|
-
import { colorGradientHex as
|
|
14
|
-
import { Keys as
|
|
15
|
-
import {
|
|
12
|
+
import { provideLocalizationService as j } from "@progress/kendo-vue-intl";
|
|
13
|
+
import { colorGradientHex as u, messages as a, colorGradientInputColorButton as b, colorGradientR as I, colorGradientG as f, colorGradientB as x, colorGradientA as m, colorGradientRLabel as $, colorGradientGLabel as C, colorGradientBLabel as k, colorGradientALabel as L } from "../messages/main.mjs";
|
|
14
|
+
import { Keys as A, guid as r } from "@progress/kendo-vue-common";
|
|
15
|
+
import { caretAltExpandIcon as H } from "@progress/kendo-svg-icons";
|
|
16
16
|
import { NumericTextBox as l } from "../numerictextbox/NumericTextBox.mjs";
|
|
17
|
-
function
|
|
18
|
-
return typeof
|
|
17
|
+
function d(t) {
|
|
18
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !G(t);
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const n = ["rgba", "rgb", "hex"], q = /* @__PURE__ */ z({
|
|
21
21
|
name: "KendoColorInput",
|
|
22
22
|
emits: {
|
|
23
23
|
hexchange: null,
|
|
@@ -42,11 +42,11 @@ const s = ["rgba", "rgb", "hex"], E = /* @__PURE__ */ R({
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
created() {
|
|
45
|
-
this.hexInputId =
|
|
45
|
+
this.hexInputId = r(), this.rInputId = r(), this.gInputId = r(), this.bInputId = r(), this.aInputId = r();
|
|
46
46
|
},
|
|
47
47
|
data() {
|
|
48
48
|
return {
|
|
49
|
-
inputMode:
|
|
49
|
+
inputMode: n[0]
|
|
50
50
|
};
|
|
51
51
|
},
|
|
52
52
|
mounted() {
|
|
@@ -56,27 +56,27 @@ const s = ["rgba", "rgb", "hex"], E = /* @__PURE__ */ R({
|
|
|
56
56
|
this.lastFocusable = this.$refs.hexinput || this.$refs.numerica || this.$refs.numericb;
|
|
57
57
|
},
|
|
58
58
|
render() {
|
|
59
|
-
const
|
|
60
|
-
return
|
|
59
|
+
const t = j(this), i = t.toLanguageString(u, a[u]), s = t.toLanguageString(b, a[b]), g = t.toLanguageString(I, a[I]), h = t.toLanguageString(f, a[f]), p = t.toLanguageString(x, a[x]), c = t.toLanguageString(m, a[m]), v = t.toLanguageString($, a[$]), M = t.toLanguageString(C, a[C]), R = t.toLanguageString(k, a[k]), S = t.toLanguageString(L, a[L]);
|
|
60
|
+
return e("div", {
|
|
61
61
|
class: "k-colorgradient-inputs k-hstack"
|
|
62
|
-
}, [
|
|
62
|
+
}, [e("div", {
|
|
63
63
|
class: "k-vstack"
|
|
64
|
-
}, [
|
|
65
|
-
ariaLabel:
|
|
64
|
+
}, [e(B, {
|
|
65
|
+
ariaLabel: s,
|
|
66
66
|
tabIndex: this.tabIndex,
|
|
67
67
|
type: "button",
|
|
68
68
|
fillMode: "flat",
|
|
69
|
-
icon: "
|
|
69
|
+
icon: "caret-alt-expand",
|
|
70
70
|
svgIcon: H,
|
|
71
|
-
class: "k-colorgradient-toggle-mode
|
|
71
|
+
class: "k-colorgradient-toggle-mode",
|
|
72
72
|
onClick: this.onToggleModeChange,
|
|
73
73
|
onKeydown: this.onKeyDown,
|
|
74
74
|
size: this.$props.size
|
|
75
|
-
}, null)]), this.inputMode === "hex" &&
|
|
75
|
+
}, null)]), this.inputMode === "hex" && e("div", {
|
|
76
76
|
class: "k-vstack k-flex-1"
|
|
77
|
-
}, [
|
|
77
|
+
}, [e("span", {
|
|
78
78
|
class: "k-hex-value"
|
|
79
|
-
}, [
|
|
79
|
+
}, [e(y, {
|
|
80
80
|
id: this.hexInputId,
|
|
81
81
|
tabIndex: this.tabIndex,
|
|
82
82
|
hex: this.$props.hex,
|
|
@@ -84,70 +84,73 @@ const s = ["rgba", "rgb", "hex"], E = /* @__PURE__ */ R({
|
|
|
84
84
|
disabled: this.$props.disabled,
|
|
85
85
|
ref: "hexinput",
|
|
86
86
|
size: this.$props.size
|
|
87
|
-
}, null)]),
|
|
87
|
+
}, null)]), e(o, {
|
|
88
88
|
class: "k-colorgradient-input-label",
|
|
89
89
|
editorId: this.hexInputId
|
|
90
|
-
},
|
|
91
|
-
default: () => [
|
|
92
|
-
})]), (this.inputMode === "rgb" || this.inputMode === "rgba") && [
|
|
90
|
+
}, d(i) ? i : {
|
|
91
|
+
default: () => [i]
|
|
92
|
+
})]), (this.inputMode === "rgb" || this.inputMode === "rgba") && [e("div", {
|
|
93
93
|
class: "k-vstack"
|
|
94
|
-
}, [
|
|
95
|
-
|
|
94
|
+
}, [e(l, {
|
|
95
|
+
id: this.rInputId,
|
|
96
96
|
tabIndex: this.tabIndex,
|
|
97
97
|
value: this.$props.rgba.r,
|
|
98
98
|
min: 0,
|
|
99
99
|
max: 255,
|
|
100
100
|
spinners: !1,
|
|
101
101
|
format: "n",
|
|
102
|
-
ariaLabel:
|
|
102
|
+
ariaLabel: v,
|
|
103
103
|
onChange: this.onRgbaRChange,
|
|
104
104
|
disabled: this.$props.disabled,
|
|
105
105
|
size: this.$props.size
|
|
106
|
-
}, null),
|
|
107
|
-
class: "k-colorgradient-input-label"
|
|
108
|
-
|
|
106
|
+
}, null), e(o, {
|
|
107
|
+
class: "k-colorgradient-input-label",
|
|
108
|
+
editorId: this.rInputId
|
|
109
|
+
}, d(g) ? g : {
|
|
109
110
|
default: () => [g]
|
|
110
|
-
})]),
|
|
111
|
+
})]), e("div", {
|
|
111
112
|
class: "k-vstack"
|
|
112
|
-
}, [
|
|
113
|
-
|
|
113
|
+
}, [e(l, {
|
|
114
|
+
id: this.gInputId,
|
|
114
115
|
tabIndex: this.tabIndex,
|
|
115
116
|
value: this.$props.rgba.g,
|
|
116
117
|
min: 0,
|
|
117
118
|
max: 255,
|
|
118
119
|
spinners: !1,
|
|
119
120
|
format: "n",
|
|
120
|
-
ariaLabel:
|
|
121
|
+
ariaLabel: M,
|
|
121
122
|
onChange: this.onRgbaGChange,
|
|
122
123
|
disabled: this.$props.disabled,
|
|
123
124
|
size: this.$props.size
|
|
124
|
-
}, null),
|
|
125
|
-
class: "k-colorgradient-input-label"
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
}, null), e(o, {
|
|
126
|
+
class: "k-colorgradient-input-label",
|
|
127
|
+
editorId: this.gInputId
|
|
128
|
+
}, d(h) ? h : {
|
|
129
|
+
default: () => [h]
|
|
130
|
+
})]), e("div", {
|
|
129
131
|
class: "k-vstack"
|
|
130
|
-
}, [
|
|
131
|
-
|
|
132
|
+
}, [e(l, {
|
|
133
|
+
id: this.bInputId,
|
|
132
134
|
tabIndex: this.tabIndex,
|
|
133
135
|
value: this.$props.rgba.b,
|
|
134
136
|
min: 0,
|
|
135
137
|
max: 255,
|
|
136
138
|
spinners: !1,
|
|
137
139
|
format: "n",
|
|
138
|
-
ariaLabel:
|
|
140
|
+
ariaLabel: R,
|
|
139
141
|
onChange: this.onRgbaBChange,
|
|
140
142
|
disabled: this.$props.disabled,
|
|
141
143
|
ref: "numericb",
|
|
142
144
|
size: this.$props.size
|
|
143
|
-
}, null),
|
|
144
|
-
class: "k-colorgradient-input-label"
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
}, null), e(o, {
|
|
146
|
+
class: "k-colorgradient-input-label",
|
|
147
|
+
editorId: this.bInputId
|
|
148
|
+
}, d(p) ? p : {
|
|
149
|
+
default: () => [p]
|
|
150
|
+
})])], this.inputMode === "rgba" && e("div", {
|
|
148
151
|
class: "k-vstack"
|
|
149
|
-
}, [this.$props.opacity &&
|
|
150
|
-
|
|
152
|
+
}, [this.$props.opacity && e(l, {
|
|
153
|
+
id: this.aInputId,
|
|
151
154
|
tabIndex: this.tabIndex,
|
|
152
155
|
value: this.$props.rgba.a,
|
|
153
156
|
min: 0,
|
|
@@ -155,61 +158,62 @@ const s = ["rgba", "rgb", "hex"], E = /* @__PURE__ */ R({
|
|
|
155
158
|
step: 0.01,
|
|
156
159
|
spinners: !1,
|
|
157
160
|
format: "n2",
|
|
158
|
-
ariaLabel:
|
|
161
|
+
ariaLabel: S,
|
|
159
162
|
onChange: this.onRgbaAChange,
|
|
160
163
|
disabled: this.$props.disabled,
|
|
161
164
|
ref: "numerica",
|
|
162
165
|
size: this.$props.size
|
|
163
|
-
}, null), this.$props.opacity &&
|
|
164
|
-
class: "k-colorgradient-input-label"
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
}, null), this.$props.opacity && e(o, {
|
|
167
|
+
class: "k-colorgradient-input-label",
|
|
168
|
+
editorId: this.aInputId
|
|
169
|
+
}, d(c) ? c : {
|
|
170
|
+
default: () => [c]
|
|
167
171
|
})])]);
|
|
168
172
|
},
|
|
169
173
|
methods: {
|
|
170
|
-
onHexChange(
|
|
171
|
-
this.$emit("hexchange",
|
|
174
|
+
onHexChange(t) {
|
|
175
|
+
this.$emit("hexchange", t.hex, t.value, t);
|
|
172
176
|
},
|
|
173
|
-
onRgbaRChange(
|
|
177
|
+
onRgbaRChange(t) {
|
|
174
178
|
this.dispatchRgbaChange({
|
|
175
|
-
r:
|
|
176
|
-
},
|
|
179
|
+
r: t.value
|
|
180
|
+
}, t);
|
|
177
181
|
},
|
|
178
|
-
onRgbaGChange(
|
|
182
|
+
onRgbaGChange(t) {
|
|
179
183
|
this.dispatchRgbaChange({
|
|
180
|
-
g:
|
|
181
|
-
},
|
|
184
|
+
g: t.value
|
|
185
|
+
}, t);
|
|
182
186
|
},
|
|
183
|
-
onRgbaBChange(
|
|
187
|
+
onRgbaBChange(t) {
|
|
184
188
|
this.dispatchRgbaChange({
|
|
185
|
-
b:
|
|
186
|
-
},
|
|
189
|
+
b: t.value
|
|
190
|
+
}, t);
|
|
187
191
|
},
|
|
188
|
-
onRgbaAChange(
|
|
192
|
+
onRgbaAChange(t) {
|
|
189
193
|
this.dispatchRgbaChange({
|
|
190
|
-
a:
|
|
191
|
-
},
|
|
194
|
+
a: t.value
|
|
195
|
+
}, t);
|
|
192
196
|
},
|
|
193
|
-
dispatchRgbaChange(
|
|
194
|
-
let
|
|
197
|
+
dispatchRgbaChange(t, i) {
|
|
198
|
+
let s = {
|
|
195
199
|
...this.$props.rgba
|
|
196
200
|
};
|
|
197
|
-
|
|
201
|
+
t.r !== void 0 && (s.r = t.r), t.g !== void 0 && (s.g = t.g), t.b !== void 0 && (s.b = t.b), t.a !== void 0 && (s.a = t.a), this.$emit("rgbachange", s, i);
|
|
198
202
|
},
|
|
199
203
|
onToggleModeChange() {
|
|
200
|
-
const
|
|
204
|
+
const t = n.length - 1 === n.indexOf(this.inputMode) ? 0 : n.indexOf(this.inputMode) + 1;
|
|
201
205
|
if (this.$props.opacity)
|
|
202
|
-
this.inputMode =
|
|
206
|
+
this.inputMode = n[t];
|
|
203
207
|
else {
|
|
204
|
-
const
|
|
205
|
-
this.inputMode =
|
|
208
|
+
const i = n[t] === "rgba" ? t + 1 : t;
|
|
209
|
+
this.inputMode = n[i];
|
|
206
210
|
}
|
|
207
211
|
},
|
|
208
|
-
onKeyDown(
|
|
209
|
-
|
|
212
|
+
onKeyDown(t) {
|
|
213
|
+
t.keyCode === A.enter && t.stopPropagation();
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
216
|
});
|
|
213
217
|
export {
|
|
214
|
-
|
|
218
|
+
q as ColorInput
|
|
215
219
|
};
|
package/colors/ColorPalette.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ declare const ColorPalette: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
44
44
|
class: PropType<string>;
|
|
45
45
|
ariaLabelledBy: PropType<string>;
|
|
46
46
|
ariaDescribedBy: PropType<string>;
|
|
47
|
+
ariaLabel: PropType<string>;
|
|
47
48
|
size: {
|
|
48
49
|
type: PropType<"small" | "medium" | "large">;
|
|
49
50
|
};
|
|
@@ -95,6 +96,7 @@ declare const ColorPalette: import('vue').DefineComponent<import('vue').ExtractP
|
|
|
95
96
|
class: PropType<string>;
|
|
96
97
|
ariaLabelledBy: PropType<string>;
|
|
97
98
|
ariaDescribedBy: PropType<string>;
|
|
99
|
+
ariaLabel: PropType<string>;
|
|
98
100
|
size: {
|
|
99
101
|
type: PropType<"small" | "medium" | "large">;
|
|
100
102
|
};
|
package/colors/ColorPalette.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),L=require("./utils/color-palette.service.js"),t=require("@progress/kendo-vue-common"),U=require("../package-metadata.js"),D=require("./models/palette-presets.js"),F=require("./utils/misc.js"),I=require("./utils/color-parser.js"),C=10,$="office",K=a.defineComponent({name:"KendoColorPalette",model:{event:"changemodel"},emits:{keydown:e=>!0,focus:e=>!0,blur:e=>!0,changemodel:e=>!0,"update:modelValue":e=>!0,"update:modelRgbaValue":e=>!0,change:e=>!0},props:{palette:{type:[String,Array],default:$},columns:Number,tileSize:{type:[Number,Object]},modelValue:String,modelRgbaValue:String,defaultValue:String,value:String,disabled:Boolean,tabIndex:Number,id:String,class:String,ariaLabelledBy:String,ariaDescribedBy:String,ariaLabel:String,size:{type:[String,null]}},created(){t.validatePackage(U.packageMetadata),this.guid=t.guid()},mounted(){this.wrapper=t.getRef(this,"wrapper")},updated(){this.wrapper=t.getRef(this,"wrapper")},computed:{focusedColorCooridanates(){return this.focusedColor?this.paletteService.getCellCoordsFor(this.focusedColor):void 0},isUncontrolled(){return this.$props.value===void 0},selectedColor(){return this.$props.value!==void 0?this.$props.value:this.modelValue!==void 0?this.modelValue:this.modelRgbaValue!==void 0?this.modelRgbaValue:this.currentValue!==void 0?this.currentValue:this.$props.defaultValue}},data(){return{focusedColor:this.$props.value,currentValue:void 0}},render(){const{size:e,disabled:s,class:o,tileSize:r}=this.$props,p=this.getPaletteInfo(),d=this.paletteService=new L.ColorPaletteService;d.setColorMatrix(p.colors,p.columns);const w=d.getCellCoordsFor(this.selectedColor),f=d.getCellCoordsFor(this.focusedColor),S=t.classNames("k-colorpalette",{[`k-colorpalette-${t.kendoThemeMaps.sizeMap[e]||e}`]:e,"k-disabled":s},o),k=function(g,n,i,l){const c=i!==void 0&&i.row===n,V=i&&i.col,N=l!==void 0&&l.row===n,E=l&&l.col,u=typeof r!="number"?r:{width:r,height:r},b=u?u.width+"px":void 0,P=u?u.height+"px":void 0;return g.map(function(m,h){const y=c&&V===h,R=t.classNames("k-colorpalette-tile",{"k-selected":y,"k-focus":N&&E===h});return a.createVNode("td",{class:R,"aria-label":m,"aria-selected":y?!0:void 0,style:{backgroundColor:m,width:b,height:P,minWidth:b},onClick:T=>this.onColorClick(m,T),id:this.createCellId({row:n,col:h}),key:h,role:"gridcell"},null)},this)},v=function(g,n,i){return g.map(function(l,c){return a.createVNode("tr",{role:"row",key:c},[k.call(this,l,c,n,i)])},this)};return p.colors.length?a.createVNode("div",{id:this.$props.id,class:S,onFocusin:this.onFocus,onFocusout:this.onBlur,onKeydown:this.onKeyDown,"aria-disabled":this.$props.disabled?"true":void 0,"aria-activedescendant":f&&this.createCellId(f),"aria-labelledby":this.$props.ariaLabelledBy,"aria-label":this.$props.ariaLabel,"aria-describedby":this.$props.ariaDescribedBy,role:"grid",tabindex:t.getTabIndex(this.$props.tabIndex,this.$props.disabled),ref:t.setRef(this,"wrapper")},[a.createVNode("table",{class:"k-colorpalette-table",role:"none"},[a.createVNode("tbody",null,[v.call(this,d.colorRows,w,f)])])]):""},methods:{focus(){this.wrapper&&this.wrapper.focus()},onKeyDown(e){switch(e.keyCode){case t.Keys.down:this.handleCellNavigation(e,0,1);break;case t.Keys.up:this.handleCellNavigation(e,0,-1);break;case t.Keys.right:this.handleCellNavigation(e,1,0);break;case t.Keys.left:this.handleCellNavigation(e,-1,0);break;case t.Keys.enter:this.handleEnter(e);break;default:this.$emit("keydown",e);return}this.$emit("keydown",e)},onColorClick(e,s){this.isUncontrolled?(this.currentValue=e,this.focusedColor=e):this.focusedColor=e,this.dispatchChangeEvent(e,s)},onFocus(e){this.focusedColor=this.selectedColor||this.paletteService.colorRows[0][0],this.$emit("focus",{event:e,target:this})},onBlur(e){this.focusedColor=void 0,this.$emit("blur",{event:e,target:this})},handleCellNavigation(e,s,o){if(e.preventDefault(),this.focusedColorCooridanates){const r=this.paletteService.getNextCell(this.focusedColorCooridanates,s,o);this.focusedColor=this.paletteService.getColorAt(r)}else this.focusedColor=this.paletteService.colorRows[0][0]},handleEnter(e){this.isUncontrolled&&(this.currentValue=this.focusedColor),this.dispatchChangeEvent(this.focusedColor,e)},dispatchChangeEvent(e,s){const o=I.parseColor(e,"rgba");this.$emit("changemodel",e),this.$emit("update:modelValue",e),this.$emit("update:modelRgbaValue",o),this.$emit("change",{event:s,component:this,value:e,rgbaValue:o})},getPaletteInfo(){if(typeof this.$props.palette=="string"){const e=D.PALETTEPRESETS[this.$props.palette];return F.isPresent(e)?{colors:e.colors,columns:this.$props.columns||e.columns||C}:{colors:[],columns:0}}else return{colors:this.$props.palette||[],columns:this.$props.columns||C}},createCellId(e){return`${this.guid}_${e.row}_${e.col}`}}});exports.ColorPalette=K;exports.DEFAULT_COLUMNS_COUNT=C;exports.DEFAULT_PRESET=$;
|
package/colors/ColorPalette.mjs
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as
|
|
9
|
-
import { ColorPaletteService as
|
|
10
|
-
import { Keys as n, classNames as $, kendoThemeMaps as
|
|
8
|
+
import { defineComponent as L, createVNode as a } from "vue";
|
|
9
|
+
import { ColorPaletteService as x } from "./utils/color-palette.service.mjs";
|
|
10
|
+
import { Keys as n, classNames as $, kendoThemeMaps as B, setRef as D, getTabIndex as F, getRef as w, validatePackage as U, guid as z } from "@progress/kendo-vue-common";
|
|
11
11
|
import { packageMetadata as A } from "../package-metadata.mjs";
|
|
12
12
|
import { PALETTEPRESETS as K } from "./models/palette-presets.mjs";
|
|
13
13
|
import { isPresent as M } from "./utils/misc.mjs";
|
|
14
14
|
import { parseColor as _ } from "./utils/color-parser.mjs";
|
|
15
|
-
const k = 10, O = "office", X = /* @__PURE__ */
|
|
15
|
+
const k = 10, O = "office", X = /* @__PURE__ */ L({
|
|
16
16
|
name: "KendoColorPalette",
|
|
17
17
|
model: {
|
|
18
18
|
event: "changemodel"
|
|
@@ -45,12 +45,13 @@ const k = 10, O = "office", X = /* @__PURE__ */ x({
|
|
|
45
45
|
class: String,
|
|
46
46
|
ariaLabelledBy: String,
|
|
47
47
|
ariaDescribedBy: String,
|
|
48
|
+
ariaLabel: String,
|
|
48
49
|
size: {
|
|
49
50
|
type: [String, null]
|
|
50
51
|
}
|
|
51
52
|
},
|
|
52
53
|
created() {
|
|
53
|
-
|
|
54
|
+
U(A), this.guid = z();
|
|
54
55
|
},
|
|
55
56
|
mounted() {
|
|
56
57
|
this.wrapper = w(this, "wrapper");
|
|
@@ -81,12 +82,12 @@ const k = 10, O = "office", X = /* @__PURE__ */ x({
|
|
|
81
82
|
disabled: t,
|
|
82
83
|
class: o,
|
|
83
84
|
tileSize: s
|
|
84
|
-
} = this.$props, p = this.getPaletteInfo(), d = this.paletteService = new
|
|
85
|
+
} = this.$props, p = this.getPaletteInfo(), d = this.paletteService = new x();
|
|
85
86
|
d.setColorMatrix(p.colors, p.columns);
|
|
86
|
-
const y = d.getCellCoordsFor(this.selectedColor), f = d.getCellCoordsFor(this.focusedColor),
|
|
87
|
-
[`k-colorpalette-${
|
|
87
|
+
const y = d.getCellCoordsFor(this.selectedColor), f = d.getCellCoordsFor(this.focusedColor), S = $("k-colorpalette", {
|
|
88
|
+
[`k-colorpalette-${B.sizeMap[e] || e}`]: e,
|
|
88
89
|
"k-disabled": t
|
|
89
|
-
}, o),
|
|
90
|
+
}, o), v = function(m, l, r, i) {
|
|
90
91
|
const u = r !== void 0 && r.row === l, N = r && r.col, E = i !== void 0 && i.row === l, R = i && i.col, c = typeof s != "number" ? s : {
|
|
91
92
|
width: s,
|
|
92
93
|
height: s
|
|
@@ -99,7 +100,7 @@ const k = 10, O = "office", X = /* @__PURE__ */ x({
|
|
|
99
100
|
return a("td", {
|
|
100
101
|
class: I,
|
|
101
102
|
"aria-label": g,
|
|
102
|
-
"aria-selected": b ? !0 :
|
|
103
|
+
"aria-selected": b ? !0 : void 0,
|
|
103
104
|
style: {
|
|
104
105
|
backgroundColor: g,
|
|
105
106
|
width: C,
|
|
@@ -120,25 +121,26 @@ const k = 10, O = "office", X = /* @__PURE__ */ x({
|
|
|
120
121
|
return a("tr", {
|
|
121
122
|
role: "row",
|
|
122
123
|
key: u
|
|
123
|
-
}, [
|
|
124
|
+
}, [v.call(this, i, u, l, r)]);
|
|
124
125
|
}, this);
|
|
125
126
|
};
|
|
126
127
|
return p.colors.length ? a("div", {
|
|
127
128
|
id: this.$props.id,
|
|
128
|
-
class:
|
|
129
|
+
class: S,
|
|
129
130
|
onFocusin: this.onFocus,
|
|
130
131
|
onFocusout: this.onBlur,
|
|
131
132
|
onKeydown: this.onKeyDown,
|
|
132
133
|
"aria-disabled": this.$props.disabled ? "true" : void 0,
|
|
133
134
|
"aria-activedescendant": f && this.createCellId(f),
|
|
134
135
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
136
|
+
"aria-label": this.$props.ariaLabel,
|
|
135
137
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
136
138
|
role: "grid",
|
|
137
|
-
tabindex:
|
|
138
|
-
ref:
|
|
139
|
+
tabindex: F(this.$props.tabIndex, this.$props.disabled),
|
|
140
|
+
ref: D(this, "wrapper")
|
|
139
141
|
}, [a("table", {
|
|
140
|
-
class: "k-colorpalette-table
|
|
141
|
-
role: "
|
|
142
|
+
class: "k-colorpalette-table",
|
|
143
|
+
role: "none"
|
|
142
144
|
}, [a("tbody", null, [V.call(this, d.colorRows, y, f)])])]) : "";
|
|
143
145
|
},
|
|
144
146
|
methods: {
|
|
@@ -100,6 +100,10 @@ export interface FlatColorPickerProps {
|
|
|
100
100
|
* The event handler that will be fired when the user edits the value.
|
|
101
101
|
*/
|
|
102
102
|
onChange?: (event: ColorPickerChangeEvent) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Specifies the aria-label attribute of the FlatColorPicker.
|
|
105
|
+
*/
|
|
106
|
+
ariaLabel?: string;
|
|
103
107
|
/**
|
|
104
108
|
* @hidden
|
|
105
109
|
* Internal prop that determines whether the ColorGradient is in adaptive state.
|
|
@@ -171,6 +175,7 @@ declare const FlatColorPicker: import('vue').DefineComponent<import('vue').Extra
|
|
|
171
175
|
size: {
|
|
172
176
|
type: PropType<"small" | "medium" | "large">;
|
|
173
177
|
};
|
|
178
|
+
ariaLabel: PropType<string>;
|
|
174
179
|
adaptive: PropType<boolean>;
|
|
175
180
|
}>, {}, {
|
|
176
181
|
currentView: string;
|
|
@@ -263,6 +268,7 @@ declare const FlatColorPicker: import('vue').DefineComponent<import('vue').Extra
|
|
|
263
268
|
size: {
|
|
264
269
|
type: PropType<"small" | "medium" | "large">;
|
|
265
270
|
};
|
|
271
|
+
ariaLabel: PropType<string>;
|
|
266
272
|
adaptive: PropType<boolean>;
|
|
267
273
|
}>> & Readonly<{
|
|
268
274
|
onBlur?: (event: FlatColorPickerBlurEvent) => any;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),d=require("@progress/kendo-svg-icons"),o=require("@progress/kendo-vue-common"),i=require("@progress/kendo-vue-buttons"),u=require("./ColorPalette.js"),w=require("./ColorGradient.js"),y=require("../package-metadata.js"),a=require("../messages/main.js"),B=require("./utils/color-parser.js"),P=require("./utils/color-cache.js"),S=require("@progress/kendo-vue-intl");function h(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const I=t.defineComponent({name:"KendoFlatColorPicker",emits:{viewchange:e=>!0,changemodel:e=>!0,"update:modelValue":e=>!0,"update:modelRgbaValue":e=>!0,focus:e=>!0,blur:e=>!0,focusout:e=>!0,keydown:e=>!0,change:e=>!0},props:{modelValue:String,modelRgbaValue:String,value:String,prevValue:String,tabIndex:Number,disabled:Boolean,view:{type:String,default:"combo",validator:function(e){return["gradient","palette","combo"].includes(e)}},selectedView:{type:Number,default:void 0},header:[String,Function,Object],footer:[String,Function,Object],showClearButton:{type:Boolean,default:!0},showPreview:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!0},gradientSettings:{type:Object,default:function(){return P.DEFAULT_GRADIENT_SETTINGS}},paletteSettings:{type:Object,default:function(){return{palette:u.DEFAULT_PRESET}}},size:{type:String},adaptive:Boolean},inject:{kendoLocalizationService:{default:null}},created(){o.validatePackage(y.packageMetadata)},computed:{isColorGradient(){return this.view!=="combo"?this.view==="gradient":this.selectedView!==void 0?this.selectedView===0:this.currentView==="gradient"},computedColor(){return this.value!==void 0?this.value:this.modelValue!==void 0?this.modelValue:this.modelRgbaValue!==void 0?this.modelRgbaValue:this.colorValue},computedPrevColor(){return this.prevValue!==void 0?this.prevValue:this.currentPrevColor},previewClass(){return{"k-coloreditor-preview-color":!0,"k-color-preview":!0,"k-no-color":!this.colorValue}},currentClass(){return{"k-coloreditor-current-color":!0,"k-color-preview":!0,"k-no-color":!this.computedPrevColor}},computedTabIndex(){return this.focused?0:-1}},data(){const e=this.value||this.defaultValue||this.modelValue||this.modelRgbaValue;return{currentView:"gradient",colorValue:e,currentPrevColor:e,focused:!1}},render(){const{size:e,adaptive:r}=this.$props,n=S.provideLocalizationService(this),p=n.toLanguageString(a.flatColorPickerGradientBtn,a.messages[a.flatColorPickerGradientBtn]),g=n.toLanguageString(a.flatColorPickerPaletteBtn,a.messages[a.flatColorPickerPaletteBtn]),C=n.toLanguageString(a.flatColorPickerClearBtn,a.messages[a.flatColorPickerClearBtn]),l=n.toLanguageString(a.flatColorPickerCancelBtn,a.messages[a.flatColorPickerCancelBtn]),s=n.toLanguageString(a.flatColorPickerApplyBtn,a.messages[a.flatColorPickerApplyBtn]),k=o.templateRendering.call(this,this.$props.header,o.getListeners.call(this)),f=o.templateRendering.call(this,this.$props.footer,o.getListeners.call(this)),m=o.getTemplate.call(this,{h:t.h,template:k}),v=o.getTemplate.call(this,{h:t.h,template:f}),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),d=require("@progress/kendo-svg-icons"),o=require("@progress/kendo-vue-common"),i=require("@progress/kendo-vue-buttons"),u=require("./ColorPalette.js"),w=require("./ColorGradient.js"),y=require("../package-metadata.js"),a=require("../messages/main.js"),B=require("./utils/color-parser.js"),P=require("./utils/color-cache.js"),S=require("@progress/kendo-vue-intl");function h(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const I=t.defineComponent({name:"KendoFlatColorPicker",emits:{viewchange:e=>!0,changemodel:e=>!0,"update:modelValue":e=>!0,"update:modelRgbaValue":e=>!0,focus:e=>!0,blur:e=>!0,focusout:e=>!0,keydown:e=>!0,change:e=>!0},props:{modelValue:String,modelRgbaValue:String,value:String,prevValue:String,tabIndex:Number,disabled:Boolean,view:{type:String,default:"combo",validator:function(e){return["gradient","palette","combo"].includes(e)}},selectedView:{type:Number,default:void 0},header:[String,Function,Object],footer:[String,Function,Object],showClearButton:{type:Boolean,default:!0},showPreview:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!0},gradientSettings:{type:Object,default:function(){return P.DEFAULT_GRADIENT_SETTINGS}},paletteSettings:{type:Object,default:function(){return{palette:u.DEFAULT_PRESET}}},size:{type:String},ariaLabel:String,adaptive:Boolean},inject:{kendoLocalizationService:{default:null}},created(){o.validatePackage(y.packageMetadata)},computed:{isColorGradient(){return this.view!=="combo"?this.view==="gradient":this.selectedView!==void 0?this.selectedView===0:this.currentView==="gradient"},computedColor(){return this.value!==void 0?this.value:this.modelValue!==void 0?this.modelValue:this.modelRgbaValue!==void 0?this.modelRgbaValue:this.colorValue},computedPrevColor(){return this.prevValue!==void 0?this.prevValue:this.currentPrevColor},previewClass(){return{"k-coloreditor-preview-color":!0,"k-color-preview":!0,"k-no-color":!this.colorValue}},currentClass(){return{"k-coloreditor-current-color":!0,"k-color-preview":!0,"k-no-color":!this.computedPrevColor}},computedTabIndex(){return this.focused?0:-1}},data(){const e=this.value||this.defaultValue||this.modelValue||this.modelRgbaValue;return{currentView:"gradient",colorValue:e,currentPrevColor:e,focused:!1}},render(){const{size:e,adaptive:r}=this.$props,n=S.provideLocalizationService(this),p=n.toLanguageString(a.flatColorPickerGradientBtn,a.messages[a.flatColorPickerGradientBtn]),g=n.toLanguageString(a.flatColorPickerPaletteBtn,a.messages[a.flatColorPickerPaletteBtn]),C=n.toLanguageString(a.flatColorPickerClearBtn,a.messages[a.flatColorPickerClearBtn]),l=n.toLanguageString(a.flatColorPickerCancelBtn,a.messages[a.flatColorPickerCancelBtn]),s=n.toLanguageString(a.flatColorPickerApplyBtn,a.messages[a.flatColorPickerApplyBtn]),k=o.templateRendering.call(this,this.$props.header,o.getListeners.call(this)),f=o.templateRendering.call(this,this.$props.footer,o.getListeners.call(this)),m=o.getTemplate.call(this,{h:t.h,template:k}),v=o.getTemplate.call(this,{h:t.h,template:f}),b=function(){return t.h(w.ColorGradient,{ref:o.setRef(this,"gradient"),tabIndex:-1,value:this.colorValue,innerTabIndex:this.computedTabIndex,size:e,onChange:this.handleColorChange,onKeydown:this.innerKeyDown,adaptive:r,role:"none",...this.gradientSettings})},V=function(){return t.h(u.ColorPalette,{ref:o.setRef(this,"palette"),tabIndex:this.computedTabIndex,value:this.colorValue,size:e,onChange:this.handlePaletteColorChange,onKeydown:this.gradientKeyDown,...this.paletteSettings})};return t.createVNode("div",{tabindex:o.getTabIndex(this.$props.tabIndex,this.$props.disabled),onFocus:this.onFocus,onBlur:this.onBlur,onFocusout:this.onFocusout,onKeydown:this.onKeyDownHandler,class:o.classNames("k-flatcolorpicker k-coloreditor",{[`k-coloreditor-${o.kendoThemeMaps.sizeMap[e]||e}`]:e,"k-disabled":this.$props.disabled}),"aria-disabled":this.$props.disabled||void 0,role:"textbox","aria-label":this.$props.ariaLabel},[m,this.$props.showClearButton&&this.$props.showPreview&&t.createVNode("div",{class:"k-coloreditor-header k-hstack"},[t.createVNode("div",{class:"k-coloreditor-header-actions k-hstack"},[this.$props.view==="combo"&&t.createVNode(i.ButtonGroup,{class:"k-button-group-flat"},{default:()=>[t.createVNode(i.Button,{tabIndex:this.computedTabIndex,type:"button",togglable:!0,fillMode:"flat",selected:this.isColorGradient,onKeydown:this.handleButtonKeydown,ariaLabel:p,size:e,onClick:c=>this.handleViewChange(c,"gradient"),svgIcon:d.dropletSliderIcon},null),t.createVNode(i.Button,{tabIndex:this.computedTabIndex,type:"button",togglable:!0,fillMode:"flat",selected:!this.isColorGradient,onKeydown:this.handleButtonKeydown,ariaLabel:g,size:e,onClick:c=>this.handleViewChange(c,"palette"),svgIcon:d.paletteIcon},null)]})]),t.createVNode("div",{class:"k-spacer"},null),t.createVNode("div",{class:"k-coloreditor-header-actions k-hstack"},[this.$props.showClearButton&&t.createVNode(i.Button,{tabIndex:this.computedTabIndex,type:"button",fillMode:"flat",ariaLabel:C,svgIcon:d.dropletSlashIcon,size:e,onKeydown:this.handleButtonKeydown,onClick:this.handleResetColor},null),this.$props.showPreview&&t.createVNode("div",{class:"k-coloreditor-preview k-vstack"},[t.createVNode("span",{class:this.previewClass},[t.createVNode("span",{class:"k-color-preview-mask",style:{background:this.colorValue}},null)]),t.createVNode("span",{class:this.currentClass},[t.createVNode("span",{class:"k-color-preview-mask",style:{background:this.computedPrevColor},onClick:this.handlePrevColorClick},null)])])])]),t.createVNode("div",{class:"k-coloreditor-views k-vstack"},[this.isColorGradient?b.call(this):V.call(this)]),this.$props.showButtons&&t.createVNode("div",{class:"k-coloreditor-footer k-actions k-actions-horizontal k-actions-start"},[t.createVNode(i.Button,{tabIndex:this.computedTabIndex,type:"button",class:"k-coloreditor-cancel",size:e,onKeydown:this.handleButtonKeydown,onClick:this.handleCancelBtnClick},h(l)?l:{default:()=>[l]}),t.createVNode(i.Button,{tabIndex:this.computedTabIndex,type:"button",class:"k-coloreditor-apply",themeColor:"primary",size:e,onKeydown:this.handleButtonKeydown,onClick:this.triggerChange},h(s)?s:{default:()=>[s]})]),v])},methods:{focus(){this.focused=!0,setTimeout(()=>{o.focusFirstFocusableChild(this.$el)},1)},onKeyDownHandler(e){const r=this.$el;this.focused=o.focusContainer(e,r),this.$emit("keydown",e)},handleViewChange(e,r){this.currentView=r,this.$emit("viewchange",{event:e,viewType:r})},handleResetColor(){this.colorValue=null,!this.showButtons&&!this.adaptive&&this.triggerChange()},handleColorChange(e){this.colorValue=e.value,!this.showButtons&&!this.adaptive&&this.triggerChange(e)},handlePaletteColorChange(e){this.colorValue=e.value,!this.showButtons&&!this.adaptive&&this.triggerChange(e)},triggerChange(e){const r=B.parseColor(this.colorValue,"rgba");this.currentPrevColor=this.colorValue,this.$emit("changemodel",this.colorValue),this.$emit("update:modelValue",this.colorValue),this.$emit("update:modelRgbaValue",r),this.$emit("change",{event:e,value:this.colorValue,rgbaValue:r})},innerKeyDown(e){e.keyCode===o.Keys.enter&&this.triggerChange(e)},gradientKeyDown(e){e.stopPropagation(),!this.showButtons&&e.keyCode===o.Keys.enter&&this.triggerChange(e)},handleButtonKeydown(e){e.keyCode===o.Keys.enter&&e.stopPropagation()},handleCancelBtnClick(){this.colorValue=this.computedPrevColor},handlePrevColorClick(){this.colorValue=this.computedPrevColor},onFocus(e){this.$emit("focus",{event:e,target:this})},onBlur(e){this.$emit("blur",{event:e,target:this})},onFocusout(e){this.$emit("focusout",{event:e,target:this})}}});exports.FlatColorPicker=I;
|