@progress/kendo-vue-inputs 6.1.0-develop.4 → 6.1.0-develop.6
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/ColorGradient.js +2 -2
- package/colors/ColorGradient.mjs +104 -89
- package/colors/ColorInput.js +1 -1
- package/colors/ColorInput.mjs +68 -61
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +68 -59
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +113 -57
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +82 -60
- package/colors/HexInput.js +1 -1
- package/colors/HexInput.mjs +13 -11
- package/colors/common/ColorsAdaptiveMode.js +8 -0
- package/colors/common/ColorsAdaptiveMode.mjs +91 -0
- package/colors/utils/color-cache.js +1 -1
- package/colors/utils/color-cache.mjs +2 -7
- package/dist/cdn/js/kendo-vue-inputs.js +1 -1
- package/index.d.mts +116 -7
- package/index.d.ts +116 -7
- package/messages/main.js +2 -2
- package/messages/main.mjs +26 -24
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +9 -9
package/colors/ColorPicker.mjs
CHANGED
|
@@ -5,20 +5,22 @@
|
|
|
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 { Button as
|
|
10
|
-
import { kendoThemeMaps as
|
|
11
|
-
import { packageMetadata as
|
|
12
|
-
import { Picker as
|
|
13
|
-
import { FlatColorPicker as
|
|
14
|
-
import {
|
|
15
|
-
import { provideLocalizationService as
|
|
16
|
-
import { colorPickerDropdownButtonAriaLabel as
|
|
17
|
-
import { caretAltDownIcon as
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
import { defineComponent as A, createVNode as o, isVNode as R, h as I } from "vue";
|
|
9
|
+
import { Button as D } from "@progress/kendo-vue-buttons";
|
|
10
|
+
import { ADAPTIVE_SMALL_BREAKPOINT as M, ADAPTIVE_MEDIUM_BREAKPOINT as E, kendoThemeMaps as c, validatePackage as N, guid as p, canUseDOM as H, getRef as a, getTabIndex as F, classNames as h, Icon as L, getIconName as K, Keys as n, setRef as _ } from "@progress/kendo-vue-common";
|
|
11
|
+
import { packageMetadata as z } from "../package-metadata.mjs";
|
|
12
|
+
import { Picker as j } from "./Picker.mjs";
|
|
13
|
+
import { FlatColorPicker as x } from "./FlatColorPicker.mjs";
|
|
14
|
+
import { DEFAULT_GRADIENT_SETTINGS as W } from "./utils/color-cache.mjs";
|
|
15
|
+
import { provideLocalizationService as G } from "@progress/kendo-vue-intl";
|
|
16
|
+
import { colorPickerDropdownButtonAriaLabel as f, messages as s, colorPickerAdaptiveTitle as m, flatColorPickerApplyBtn as g, flatColorPickerCancelBtn as b } from "../messages/main.mjs";
|
|
17
|
+
import { caretAltDownIcon as U } from "@progress/kendo-svg-icons";
|
|
18
|
+
import { DEFAULT_PRESET as q } from "./ColorPalette.mjs";
|
|
19
|
+
import { ColorsAdaptiveMode as J } from "./common/ColorsAdaptiveMode.mjs";
|
|
20
|
+
function Q(e) {
|
|
21
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !R(e);
|
|
20
22
|
}
|
|
21
|
-
const
|
|
23
|
+
const ue = /* @__PURE__ */ A({
|
|
22
24
|
name: "KendoColorPicker",
|
|
23
25
|
model: {
|
|
24
26
|
event: "changemodel"
|
|
@@ -63,7 +65,9 @@ const Q = /* @__PURE__ */ w({
|
|
|
63
65
|
paletteSettings: {
|
|
64
66
|
type: Object,
|
|
65
67
|
default: function() {
|
|
66
|
-
return
|
|
68
|
+
return {
|
|
69
|
+
palette: q
|
|
70
|
+
};
|
|
67
71
|
}
|
|
68
72
|
},
|
|
69
73
|
valid: {
|
|
@@ -87,7 +91,7 @@ const Q = /* @__PURE__ */ w({
|
|
|
87
91
|
gradientSettings: {
|
|
88
92
|
type: Object,
|
|
89
93
|
default: function() {
|
|
90
|
-
return
|
|
94
|
+
return W;
|
|
91
95
|
}
|
|
92
96
|
},
|
|
93
97
|
flatColorPickerSettings: {
|
|
@@ -131,18 +135,34 @@ const Q = /* @__PURE__ */ w({
|
|
|
131
135
|
selectedView: {
|
|
132
136
|
type: Number,
|
|
133
137
|
default: void 0
|
|
138
|
+
},
|
|
139
|
+
adaptive: {
|
|
140
|
+
type: Boolean,
|
|
141
|
+
default: !1
|
|
142
|
+
},
|
|
143
|
+
adaptiveTitle: {
|
|
144
|
+
type: String
|
|
134
145
|
}
|
|
135
146
|
},
|
|
136
147
|
inject: {
|
|
137
148
|
kendoLocalizationService: {
|
|
138
149
|
default: null
|
|
150
|
+
},
|
|
151
|
+
adaptiveModeBreakpoints: {
|
|
152
|
+
default: {
|
|
153
|
+
small: M,
|
|
154
|
+
medium: E
|
|
155
|
+
}
|
|
139
156
|
}
|
|
140
157
|
},
|
|
141
158
|
data() {
|
|
142
159
|
return {
|
|
143
160
|
focused: !1,
|
|
144
161
|
currentValue: this.$props.defaultValue,
|
|
145
|
-
currentOpen: !1
|
|
162
|
+
currentOpen: !1,
|
|
163
|
+
flatcolorpickerRef: null,
|
|
164
|
+
windowWidth: 0,
|
|
165
|
+
observer: null
|
|
146
166
|
};
|
|
147
167
|
},
|
|
148
168
|
computed: {
|
|
@@ -168,55 +188,76 @@ const Q = /* @__PURE__ */ w({
|
|
|
168
188
|
"k-picker": !0,
|
|
169
189
|
"k-colorpicker": !0,
|
|
170
190
|
"k-icon-picker": !0,
|
|
171
|
-
[`k-picker-${
|
|
191
|
+
[`k-picker-${c.sizeMap[e] || e}`]: e,
|
|
172
192
|
[`k-picker-${i}`]: i,
|
|
173
|
-
[`k-rounded-${
|
|
193
|
+
[`k-rounded-${c.roundedMap[t] || t}`]: t,
|
|
174
194
|
"k-invalid": !this.valid,
|
|
175
195
|
"k-disabled": this.disabled,
|
|
176
196
|
"k-focus": this.focused
|
|
177
197
|
};
|
|
198
|
+
},
|
|
199
|
+
animationStyles() {
|
|
200
|
+
return this.windowWidth <= this.adaptiveModeBreakpoints.small ? {
|
|
201
|
+
top: 0,
|
|
202
|
+
width: "100%",
|
|
203
|
+
height: "100%"
|
|
204
|
+
} : void 0;
|
|
205
|
+
},
|
|
206
|
+
classNameAdaptive() {
|
|
207
|
+
return this.windowWidth <= this.adaptiveModeBreakpoints.small ? "k-adaptive-actionsheet k-actionsheet-fullscreen" : "k-adaptive-actionsheet k-actionsheet-bottom";
|
|
208
|
+
},
|
|
209
|
+
adaptiveState() {
|
|
210
|
+
return !!(this.$props.adaptive && this.windowWidth && this.windowWidth <= this.adaptiveModeBreakpoints.medium);
|
|
178
211
|
}
|
|
179
212
|
},
|
|
180
213
|
created() {
|
|
181
|
-
|
|
214
|
+
N(z), this._popupId = "popup" + p(), this.focusableElementGuid = p();
|
|
182
215
|
},
|
|
183
216
|
mounted() {
|
|
184
|
-
this.button =
|
|
217
|
+
this.observer = H && window.ResizeObserver && new ResizeObserver(this.calculateMedia), document != null && document.body && this.observer && this.observer.observe(document.body), this.flatcolorpickerRef = a(this, "flatcolorpicker"), this.button = a(this, "button");
|
|
218
|
+
},
|
|
219
|
+
unmounted() {
|
|
220
|
+
var e;
|
|
221
|
+
(e = this.document) != null && e.body && this.observer && this.observer.disconnect();
|
|
185
222
|
},
|
|
186
223
|
render() {
|
|
187
224
|
let e;
|
|
188
|
-
const
|
|
189
|
-
disabled:
|
|
190
|
-
tabIndex:
|
|
191
|
-
dir:
|
|
192
|
-
view:
|
|
193
|
-
selectedView:
|
|
194
|
-
showClearButton:
|
|
195
|
-
showPreview:
|
|
196
|
-
showButtons:
|
|
197
|
-
popupSettings:
|
|
198
|
-
|
|
199
|
-
|
|
225
|
+
const {
|
|
226
|
+
disabled: i,
|
|
227
|
+
tabIndex: t,
|
|
228
|
+
dir: u,
|
|
229
|
+
view: k,
|
|
230
|
+
selectedView: v,
|
|
231
|
+
showClearButton: w,
|
|
232
|
+
showPreview: y,
|
|
233
|
+
showButtons: C,
|
|
234
|
+
popupSettings: S,
|
|
235
|
+
size: B,
|
|
236
|
+
adaptiveTitle: V
|
|
237
|
+
} = this.$props, l = G(this), O = l.toLanguageString(f, s[f]), $ = V || l.toLanguageString(m, s[m]), T = l.toLanguageString(g, s[g]), P = l.toLanguageString(b, s[b]), d = function() {
|
|
238
|
+
return I(x, {
|
|
200
239
|
onKeydown: this.onKeyDownHandler,
|
|
201
|
-
ref:
|
|
202
|
-
view:
|
|
203
|
-
selectedView:
|
|
204
|
-
showClearButton:
|
|
205
|
-
showPreview:
|
|
206
|
-
showButtons:
|
|
240
|
+
ref: _(this, "flatcolorpicker"),
|
|
241
|
+
view: k,
|
|
242
|
+
selectedView: v,
|
|
243
|
+
showClearButton: w,
|
|
244
|
+
showPreview: y,
|
|
245
|
+
showButtons: this.adaptiveState ? !1 : C,
|
|
246
|
+
size: this.adaptiveState ? "large" : B,
|
|
207
247
|
value: this.computedValue || void 0,
|
|
208
248
|
onChange: this.onFlatChangeHandler,
|
|
209
249
|
onFocusout: this.onBlurHandler,
|
|
210
250
|
onViewchange: this.onViewChange,
|
|
211
251
|
paletteSettings: this.paletteSettings,
|
|
212
252
|
gradientSettings: this.gradientSettings,
|
|
253
|
+
adaptive: this.adaptiveState,
|
|
213
254
|
...this.flatColorPickerSettings
|
|
214
255
|
});
|
|
215
256
|
};
|
|
216
257
|
return o("span", {
|
|
217
258
|
class: this.wrapperClassName,
|
|
218
259
|
role: "combobox",
|
|
219
|
-
dir:
|
|
260
|
+
dir: u,
|
|
220
261
|
id: this.$props.id,
|
|
221
262
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
222
263
|
"aria-describedby": this.$props.ariaDescribedBy,
|
|
@@ -224,7 +265,7 @@ const Q = /* @__PURE__ */ w({
|
|
|
224
265
|
"aria-haspopup": "dialog",
|
|
225
266
|
"aria-expanded": this.computedOpen,
|
|
226
267
|
ref: this.focusableElementGuid,
|
|
227
|
-
tabindex:
|
|
268
|
+
tabindex: F(t, i),
|
|
228
269
|
title: this.$props.title,
|
|
229
270
|
onKeydown: this.onButtonKeyDown,
|
|
230
271
|
onFocusin: this.onFocusHandler,
|
|
@@ -233,45 +274,60 @@ const Q = /* @__PURE__ */ w({
|
|
|
233
274
|
onClick: this.onActiveColorClickHandler,
|
|
234
275
|
class: "k-input-inner"
|
|
235
276
|
}, [o("span", {
|
|
236
|
-
class:
|
|
277
|
+
class: h("k-value-icon", "k-color-preview", {
|
|
237
278
|
"k-no-color": !this.computedValue,
|
|
238
279
|
"k-icon-color-preview": this.icon || this.iconClassName
|
|
239
280
|
})
|
|
240
|
-
}, [(this.iconClassName || this.icon || this.svgIcon) && o(
|
|
241
|
-
class:
|
|
242
|
-
name:
|
|
281
|
+
}, [(this.iconClassName || this.icon || this.svgIcon) && o(L, {
|
|
282
|
+
class: h("k-color-preview-icon", this.iconClassName),
|
|
283
|
+
name: K(this.icon),
|
|
243
284
|
icon: this.svgIcon
|
|
244
285
|
}, null), o("span", {
|
|
245
286
|
class: "k-color-preview-mask",
|
|
246
287
|
style: {
|
|
247
288
|
backgroundColor: this.computedValue
|
|
248
289
|
}
|
|
249
|
-
}, null)])]), o(
|
|
290
|
+
}, null)])]), o(D, {
|
|
250
291
|
type: "button",
|
|
251
292
|
tabIndex: -1,
|
|
252
|
-
ref: (
|
|
253
|
-
this.buttonRef =
|
|
293
|
+
ref: (r) => {
|
|
294
|
+
this.buttonRef = r;
|
|
254
295
|
},
|
|
255
296
|
onClick: this.onClickHandler,
|
|
256
297
|
rounded: null,
|
|
257
298
|
class: "k-input-button",
|
|
258
299
|
icon: "caret-alt-down",
|
|
259
|
-
svgIcon:
|
|
260
|
-
"aria-label":
|
|
261
|
-
}, null), o(
|
|
262
|
-
dir:
|
|
300
|
+
svgIcon: U,
|
|
301
|
+
"aria-label": O
|
|
302
|
+
}, null), !this.adaptiveState && o(j, {
|
|
303
|
+
dir: u,
|
|
263
304
|
id: this._popupId,
|
|
264
305
|
open: this.computedOpen,
|
|
265
306
|
onOpen: this.onOpenHandler,
|
|
266
307
|
popupAnchor: this.focusableElementGuid,
|
|
267
308
|
popupSettings: {
|
|
268
|
-
...
|
|
309
|
+
...S
|
|
269
310
|
}
|
|
270
|
-
},
|
|
311
|
+
}, Q(e = d.call(this)) ? e : {
|
|
271
312
|
default: () => [e]
|
|
272
|
-
})
|
|
313
|
+
}), this.adaptiveState && o(J, {
|
|
314
|
+
expand: this.computedOpen,
|
|
315
|
+
animationStyles: this.animationStyles,
|
|
316
|
+
classNameAdaptive: this.classNameAdaptive,
|
|
317
|
+
title: $,
|
|
318
|
+
applyText: T,
|
|
319
|
+
cancelText: P,
|
|
320
|
+
componentToRender: d.call(this),
|
|
321
|
+
onActionSheetClose: () => this.setOpen(!this.computedOpen),
|
|
322
|
+
onCancelBtnClick: () => this.flatcolorpickerRef.handleCancelBtnClick(),
|
|
323
|
+
onApplyBtnClick: (r) => this.flatcolorpickerRef.triggerChange(r)
|
|
324
|
+
}, null)]);
|
|
273
325
|
},
|
|
274
326
|
methods: {
|
|
327
|
+
calculateMedia(e) {
|
|
328
|
+
for (let i of e)
|
|
329
|
+
this.windowWidth = i.target.clientWidth;
|
|
330
|
+
},
|
|
275
331
|
focusElement() {
|
|
276
332
|
this.$el && this.$el.focus();
|
|
277
333
|
},
|
|
@@ -309,7 +365,7 @@ const Q = /* @__PURE__ */ w({
|
|
|
309
365
|
i && t === n.up && (e.preventDefault(), e.stopPropagation(), this.setOpen(!1), this.focusElement());
|
|
310
366
|
},
|
|
311
367
|
onOpenHandler() {
|
|
312
|
-
const e =
|
|
368
|
+
const e = a(this, "flatcolorpicker");
|
|
313
369
|
e && e.focus();
|
|
314
370
|
},
|
|
315
371
|
onClickHandler() {
|
|
@@ -339,7 +395,7 @@ const Q = /* @__PURE__ */ w({
|
|
|
339
395
|
e || this.setOpen(!1, !0), this.focused = e, this.blurTimeoutRef = void 0;
|
|
340
396
|
},
|
|
341
397
|
onBlurHandler() {
|
|
342
|
-
clearTimeout(this.blurTimeoutRef), this.palette =
|
|
398
|
+
clearTimeout(this.blurTimeoutRef), this.palette = a(this, "palette"), this.gradient = a(this, "gradient"), this.blurTimeoutRef = setTimeout(this.onBlurTimeout, 200);
|
|
343
399
|
},
|
|
344
400
|
onViewChange(e) {
|
|
345
401
|
this.$emit("viewchange", e);
|
|
@@ -358,5 +414,5 @@ const Q = /* @__PURE__ */ w({
|
|
|
358
414
|
}
|
|
359
415
|
});
|
|
360
416
|
export {
|
|
361
|
-
|
|
417
|
+
ue as ColorPicker
|
|
362
418
|
};
|
|
@@ -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"),
|
|
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"),r=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:null,changemodel:null,"update:modelValue":null,"update:modelRgbaValue":null,focus:null,blur:null,focusout:null,keydown:null,change:null},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,default:"medium"},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:l}=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]),i=n.toLanguageString(a.flatColorPickerCancelBtn,a.messages[a.flatColorPickerCancelBtn]),s=n.toLanguageString(a.flatColorPickerApplyBtn,a.messages[a.flatColorPickerApplyBtn]),m=o.templateRendering.call(this,this.$props.header,o.getListeners.call(this)),f=o.templateRendering.call(this,this.$props.footer,o.getListeners.call(this)),k=o.getTemplate.call(this,{h:t.h,template:m}),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:l,...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},[k,this.$props.showClearButton&&this.$props.showPreview&&t.createVNode("div",{class:"k-coloreditor-header k-hstack"},[this.$props.view==="combo"&&t.createVNode("div",{class:"k-coloreditor-header-actions k-hstack"},[t.createVNode(r.ButtonGroup,{class:"k-button-group-flat"},{default:()=>[t.createVNode(r.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")},{default:()=>[t.createVNode(o.Icon,{size:e,name:"droplet-slider",icon:d.dropletSliderIcon},null)]}),t.createVNode(r.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")},{default:()=>[t.createVNode(o.Icon,{size:e,name:"palette",icon: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(r.Button,{tabIndex:this.computedTabIndex,type:"button",fillMode:"flat",ariaLabel:C,size:e,onKeydown:this.handleButtonKeydown,onClick:this.handleResetColor},{default:()=>[t.createVNode(o.Icon,{size:e,name:"droplet-slash",icon:d.dropletSlashIcon},null)]}),this.$props.showPreview&&t.createVNode("div",{class:"k-coloreditor-preview k-vstack"},[t.createVNode("span",{class:this.previewClass,style:{background:this.colorValue}},[!this.colorValue&&t.createVNode("span",{class:"k-color-preview-mask"},null)]),t.createVNode("span",{class:this.currentClass,style:{background:this.computedPrevColor},onClick:this.handlePrevColorClick},[!this.computedPrevColor&&t.createVNode("span",{class:"k-color-preview-mask"},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-end"},[t.createVNode(r.Button,{tabIndex:this.computedTabIndex,type:"button",class:"k-coloreditor-cancel",size:e,onKeydown:this.handleButtonKeydown,onClick:this.handleCancelBtnClick},h(i)?i:{default:()=>[i]}),t.createVNode(r.Button,{tabIndex:this.computedTabIndex,type:"button",class:"k-coloreditor-apply k-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 l=this.$el;this.focused=o.focusContainer(e,l),this.$emit("keydown",e)},handleViewChange(e,l){this.currentView=l,this.$emit("viewchange",{event:e,viewType:l})},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 l=B.parseColor(this.colorValue,"rgba");this.currentPrevColor=this.colorValue,this.$emit("changemodel",this.colorValue),this.$emit("update:modelValue",this.colorValue),this.$emit("update:modelRgbaValue",l),this.$emit("change",{event:e,value:this.colorValue,rgbaValue:l})},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;
|
|
@@ -5,21 +5,21 @@
|
|
|
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 { dropletSliderIcon as
|
|
10
|
-
import { validatePackage as
|
|
11
|
-
import { ButtonGroup as
|
|
12
|
-
import { ColorPalette as
|
|
13
|
-
import { ColorGradient as
|
|
14
|
-
import { packageMetadata as
|
|
15
|
-
import { flatColorPickerGradientBtn as
|
|
16
|
-
import { parseColor as
|
|
17
|
-
import { DEFAULT_GRADIENT_SETTINGS as
|
|
18
|
-
import { provideLocalizationService as
|
|
19
|
-
function
|
|
20
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
8
|
+
import { defineComponent as T, h as n, createVNode as t, isVNode as z } from "vue";
|
|
9
|
+
import { dropletSliderIcon as F, paletteIcon as L, dropletSlashIcon as R } from "@progress/kendo-svg-icons";
|
|
10
|
+
import { validatePackage as M, templateRendering as h, getListeners as p, getTemplate as g, getTabIndex as G, classNames as D, kendoThemeMaps as j, Icon as c, focusFirstFocusableChild as N, focusContainer as E, Keys as u, setRef as m } from "@progress/kendo-vue-common";
|
|
11
|
+
import { ButtonGroup as O, Button as l } from "@progress/kendo-vue-buttons";
|
|
12
|
+
import { DEFAULT_PRESET as A, ColorPalette as _ } from "./ColorPalette.mjs";
|
|
13
|
+
import { ColorGradient as H } from "./ColorGradient.mjs";
|
|
14
|
+
import { packageMetadata as U } from "../package-metadata.mjs";
|
|
15
|
+
import { flatColorPickerGradientBtn as f, messages as a, flatColorPickerPaletteBtn as C, flatColorPickerClearBtn as k, flatColorPickerCancelBtn as b, flatColorPickerApplyBtn as w } from "../messages/main.mjs";
|
|
16
|
+
import { parseColor as q } from "./utils/color-parser.mjs";
|
|
17
|
+
import { DEFAULT_GRADIENT_SETTINGS as J } from "./utils/color-cache.mjs";
|
|
18
|
+
import { provideLocalizationService as Q } from "@progress/kendo-vue-intl";
|
|
19
|
+
function v(e) {
|
|
20
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !z(e);
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const re = /* @__PURE__ */ T({
|
|
23
23
|
name: "KendoFlatColorPicker",
|
|
24
24
|
emits: {
|
|
25
25
|
viewchange: null,
|
|
@@ -67,15 +67,22 @@ const ae = /* @__PURE__ */ K({
|
|
|
67
67
|
gradientSettings: {
|
|
68
68
|
type: Object,
|
|
69
69
|
default: function() {
|
|
70
|
-
return
|
|
70
|
+
return J;
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
paletteSettings: {
|
|
74
74
|
type: Object,
|
|
75
75
|
default: function() {
|
|
76
|
-
return
|
|
76
|
+
return {
|
|
77
|
+
palette: A
|
|
78
|
+
};
|
|
77
79
|
}
|
|
78
|
-
}
|
|
80
|
+
},
|
|
81
|
+
size: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: "medium"
|
|
84
|
+
},
|
|
85
|
+
adaptive: Boolean
|
|
79
86
|
},
|
|
80
87
|
inject: {
|
|
81
88
|
kendoLocalizationService: {
|
|
@@ -83,7 +90,7 @@ const ae = /* @__PURE__ */ K({
|
|
|
83
90
|
}
|
|
84
91
|
},
|
|
85
92
|
created() {
|
|
86
|
-
|
|
93
|
+
M(U);
|
|
87
94
|
},
|
|
88
95
|
computed: {
|
|
89
96
|
isColorGradient() {
|
|
@@ -123,47 +130,54 @@ const ae = /* @__PURE__ */ K({
|
|
|
123
130
|
};
|
|
124
131
|
},
|
|
125
132
|
render() {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}), S = p.call(this, {
|
|
130
|
-
h:
|
|
131
|
-
template:
|
|
132
|
-
}),
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
const {
|
|
134
|
+
size: e,
|
|
135
|
+
adaptive: o
|
|
136
|
+
} = this.$props, i = Q(this), y = i.toLanguageString(f, a[f]), V = i.toLanguageString(C, a[C]), B = i.toLanguageString(k, a[k]), r = i.toLanguageString(b, a[b]), s = i.toLanguageString(w, a[w]), P = h.call(this, this.$props.header, p.call(this)), S = h.call(this, this.$props.footer, p.call(this)), I = g.call(this, {
|
|
137
|
+
h: n,
|
|
138
|
+
template: P
|
|
139
|
+
}), $ = g.call(this, {
|
|
140
|
+
h: n,
|
|
141
|
+
template: S
|
|
142
|
+
}), K = function() {
|
|
143
|
+
return n(H, {
|
|
144
|
+
ref: m(this, "gradient"),
|
|
135
145
|
tabIndex: -1,
|
|
136
146
|
value: this.colorValue,
|
|
137
147
|
innerTabIndex: this.computedTabIndex,
|
|
148
|
+
size: e,
|
|
138
149
|
onChange: this.handleColorChange,
|
|
139
150
|
onKeydown: this.innerKeyDown,
|
|
151
|
+
adaptive: o,
|
|
140
152
|
...this.gradientSettings
|
|
141
153
|
});
|
|
142
|
-
},
|
|
143
|
-
return
|
|
144
|
-
ref:
|
|
154
|
+
}, x = function() {
|
|
155
|
+
return n(_, {
|
|
156
|
+
ref: m(this, "palette"),
|
|
145
157
|
tabIndex: this.computedTabIndex,
|
|
146
158
|
value: this.colorValue,
|
|
159
|
+
size: e,
|
|
147
160
|
onChange: this.handlePaletteColorChange,
|
|
148
161
|
onKeydown: this.gradientKeyDown,
|
|
149
162
|
...this.paletteSettings
|
|
150
163
|
});
|
|
151
164
|
};
|
|
152
165
|
return t("div", {
|
|
153
|
-
tabindex:
|
|
166
|
+
tabindex: G(this.$props.tabIndex, this.$props.disabled),
|
|
154
167
|
onFocus: this.onFocus,
|
|
155
168
|
onBlur: this.onBlur,
|
|
156
169
|
onFocusout: this.onFocusout,
|
|
157
170
|
onKeydown: this.onKeyDownHandler,
|
|
158
171
|
class: D("k-flatcolorpicker k-coloreditor", {
|
|
172
|
+
[`k-coloreditor-${j.sizeMap[e] || e}`]: e,
|
|
159
173
|
"k-disabled": this.$props.disabled
|
|
160
174
|
}),
|
|
161
175
|
"aria-disabled": this.$props.disabled
|
|
162
|
-
}, [
|
|
176
|
+
}, [I, this.$props.showClearButton && this.$props.showPreview && t("div", {
|
|
163
177
|
class: "k-coloreditor-header k-hstack"
|
|
164
178
|
}, [this.$props.view === "combo" && t("div", {
|
|
165
179
|
class: "k-coloreditor-header-actions k-hstack"
|
|
166
|
-
}, [t(
|
|
180
|
+
}, [t(O, {
|
|
167
181
|
class: "k-button-group-flat"
|
|
168
182
|
}, {
|
|
169
183
|
default: () => [t(l, {
|
|
@@ -173,12 +187,14 @@ const ae = /* @__PURE__ */ K({
|
|
|
173
187
|
fillMode: "flat",
|
|
174
188
|
selected: this.isColorGradient,
|
|
175
189
|
onKeydown: this.handleButtonKeydown,
|
|
176
|
-
ariaLabel:
|
|
177
|
-
|
|
190
|
+
ariaLabel: y,
|
|
191
|
+
size: e,
|
|
192
|
+
onClick: (d) => this.handleViewChange(d, "gradient")
|
|
178
193
|
}, {
|
|
179
|
-
default: () => [t(
|
|
194
|
+
default: () => [t(c, {
|
|
195
|
+
size: e,
|
|
180
196
|
name: "droplet-slider",
|
|
181
|
-
icon:
|
|
197
|
+
icon: F
|
|
182
198
|
}, null)]
|
|
183
199
|
}), t(l, {
|
|
184
200
|
tabIndex: this.computedTabIndex,
|
|
@@ -187,12 +203,14 @@ const ae = /* @__PURE__ */ K({
|
|
|
187
203
|
fillMode: "flat",
|
|
188
204
|
selected: !this.isColorGradient,
|
|
189
205
|
onKeydown: this.handleButtonKeydown,
|
|
190
|
-
ariaLabel:
|
|
191
|
-
|
|
206
|
+
ariaLabel: V,
|
|
207
|
+
size: e,
|
|
208
|
+
onClick: (d) => this.handleViewChange(d, "palette")
|
|
192
209
|
}, {
|
|
193
|
-
default: () => [t(
|
|
210
|
+
default: () => [t(c, {
|
|
211
|
+
size: e,
|
|
194
212
|
name: "palette",
|
|
195
|
-
icon:
|
|
213
|
+
icon: L
|
|
196
214
|
}, null)]
|
|
197
215
|
})]
|
|
198
216
|
})]), t("div", {
|
|
@@ -203,13 +221,15 @@ const ae = /* @__PURE__ */ K({
|
|
|
203
221
|
tabIndex: this.computedTabIndex,
|
|
204
222
|
type: "button",
|
|
205
223
|
fillMode: "flat",
|
|
206
|
-
ariaLabel:
|
|
224
|
+
ariaLabel: B,
|
|
225
|
+
size: e,
|
|
207
226
|
onKeydown: this.handleButtonKeydown,
|
|
208
227
|
onClick: this.handleResetColor
|
|
209
228
|
}, {
|
|
210
|
-
default: () => [t(
|
|
229
|
+
default: () => [t(c, {
|
|
230
|
+
size: e,
|
|
211
231
|
name: "droplet-slash",
|
|
212
|
-
icon:
|
|
232
|
+
icon: R
|
|
213
233
|
}, null)]
|
|
214
234
|
}), this.$props.showPreview && t("div", {
|
|
215
235
|
class: "k-coloreditor-preview k-vstack"
|
|
@@ -230,35 +250,37 @@ const ae = /* @__PURE__ */ K({
|
|
|
230
250
|
class: "k-color-preview-mask"
|
|
231
251
|
}, null)])])])]), t("div", {
|
|
232
252
|
class: "k-coloreditor-views k-vstack"
|
|
233
|
-
}, [this.isColorGradient ?
|
|
253
|
+
}, [this.isColorGradient ? K.call(this) : x.call(this)]), this.$props.showButtons && t("div", {
|
|
234
254
|
class: "k-coloreditor-footer k-actions k-actions-end"
|
|
235
255
|
}, [t(l, {
|
|
236
256
|
tabIndex: this.computedTabIndex,
|
|
237
257
|
type: "button",
|
|
238
258
|
class: "k-coloreditor-cancel",
|
|
259
|
+
size: e,
|
|
239
260
|
onKeydown: this.handleButtonKeydown,
|
|
240
261
|
onClick: this.handleCancelBtnClick
|
|
241
|
-
},
|
|
242
|
-
default: () => [
|
|
262
|
+
}, v(r) ? r : {
|
|
263
|
+
default: () => [r]
|
|
243
264
|
}), t(l, {
|
|
244
265
|
tabIndex: this.computedTabIndex,
|
|
245
266
|
type: "button",
|
|
246
267
|
class: "k-coloreditor-apply k-primary",
|
|
268
|
+
size: e,
|
|
247
269
|
onKeydown: this.handleButtonKeydown,
|
|
248
270
|
onClick: this.triggerChange
|
|
249
|
-
},
|
|
250
|
-
default: () => [
|
|
251
|
-
})]),
|
|
271
|
+
}, v(s) ? s : {
|
|
272
|
+
default: () => [s]
|
|
273
|
+
})]), $]);
|
|
252
274
|
},
|
|
253
275
|
methods: {
|
|
254
276
|
focus() {
|
|
255
277
|
this.focused = !0, setTimeout(() => {
|
|
256
|
-
|
|
278
|
+
N(this.$el);
|
|
257
279
|
}, 1);
|
|
258
280
|
},
|
|
259
281
|
onKeyDownHandler(e) {
|
|
260
282
|
const o = this.$el;
|
|
261
|
-
this.focused =
|
|
283
|
+
this.focused = E(e, o), this.$emit("keydown", e);
|
|
262
284
|
},
|
|
263
285
|
handleViewChange(e, o) {
|
|
264
286
|
this.currentView = o, this.$emit("viewchange", {
|
|
@@ -267,16 +289,16 @@ const ae = /* @__PURE__ */ K({
|
|
|
267
289
|
});
|
|
268
290
|
},
|
|
269
291
|
handleResetColor() {
|
|
270
|
-
this.colorValue = null, this.showButtons
|
|
292
|
+
this.colorValue = null, !this.showButtons && !this.adaptive && this.triggerChange();
|
|
271
293
|
},
|
|
272
294
|
handleColorChange(e) {
|
|
273
|
-
this.colorValue = e.value, this.showButtons
|
|
295
|
+
this.colorValue = e.value, !this.showButtons && !this.adaptive && this.triggerChange(e);
|
|
274
296
|
},
|
|
275
297
|
handlePaletteColorChange(e) {
|
|
276
|
-
this.colorValue = e.value, this.showButtons
|
|
298
|
+
this.colorValue = e.value, !this.showButtons && !this.adaptive && this.triggerChange(e);
|
|
277
299
|
},
|
|
278
300
|
triggerChange(e) {
|
|
279
|
-
const o =
|
|
301
|
+
const o = q(this.colorValue, "rgba");
|
|
280
302
|
this.currentPrevColor = this.colorValue, this.$emit("changemodel", this.colorValue), this.$emit("update:modelValue", this.colorValue), this.$emit("update:modelRgbaValue", o), this.$emit("change", {
|
|
281
303
|
event: e,
|
|
282
304
|
value: this.colorValue,
|
|
@@ -284,13 +306,13 @@ const ae = /* @__PURE__ */ K({
|
|
|
284
306
|
});
|
|
285
307
|
},
|
|
286
308
|
innerKeyDown(e) {
|
|
287
|
-
e.keyCode ===
|
|
309
|
+
e.keyCode === u.enter && this.triggerChange(e);
|
|
288
310
|
},
|
|
289
311
|
gradientKeyDown(e) {
|
|
290
|
-
e.stopPropagation(), !this.showButtons && e.keyCode ===
|
|
312
|
+
e.stopPropagation(), !this.showButtons && e.keyCode === u.enter && this.triggerChange(e);
|
|
291
313
|
},
|
|
292
314
|
handleButtonKeydown(e) {
|
|
293
|
-
e.keyCode ===
|
|
315
|
+
e.keyCode === u.enter && e.stopPropagation();
|
|
294
316
|
},
|
|
295
317
|
handleCancelBtnClick() {
|
|
296
318
|
this.colorValue = this.computedPrevColor;
|
|
@@ -319,5 +341,5 @@ const ae = /* @__PURE__ */ K({
|
|
|
319
341
|
}
|
|
320
342
|
});
|
|
321
343
|
export {
|
|
322
|
-
|
|
344
|
+
re as FlatColorPicker
|
|
323
345
|
};
|
package/colors/HexInput.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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),r=require("./utils/color-parser.js"),s=require("./utils/misc.js"),o=require("../textbox/TextBox.js"),u=n.defineComponent({name:"KendoHexInput",emits:{hexchange:null,blur:null,focus:null},props:{tabIndex:Number,hex:String,disabled:Boolean,id:String,size:String},computed:{isHexValid(){return!!r.parseColor(this.currentHex,"rgba")}},data(){return{currentHex:this.$props.hex,originalHex:this.$props.hex}},mounted(){this._input=this.$refs.input._input},watch:{hex:function(e){this.currentHex=e}},render(){return n.createVNode(o.TextBox,{id:this.$props.id,value:this.currentHex,onInput:this.onChange,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,valid:this.isHexValid,disabled:this.$props.disabled,size:this.$props.size,tabIndex:this.tabIndex,ref:"input"},null)},methods:{onChange(e){const t=e.target.value,i=r.parseColor(t,"rgba");this.currentHex=t,s.isPresent(i)&&this.$emit("hexchange",{hex:t,value:i,event:e})},onBlur(e){s.isPresent(r.parseColor(this.hex,"rgba"))||(this.currentHex=this.originalHex),this.$emit("blur",e)},onFocus(e){this.$emit("focus",e)}}});exports.HexInput=u;
|