@progress/kendo-vue-buttons 10.2.0-develop.7 → 10.2.0-develop.9
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/Button.d.ts +4 -0
- package/Button.js +1 -1
- package/Button.mjs +53 -44
- package/ButtonInterface.d.ts +18 -0
- package/ListButton/DropDownButton.d.ts +4 -0
- package/ListButton/DropDownButton.js +1 -1
- package/ListButton/DropDownButton.mjs +68 -64
- package/ListButton/SplitButton.d.ts +4 -0
- package/ListButton/SplitButton.js +1 -1
- package/ListButton/SplitButton.mjs +29 -25
- package/ListButton/models/ListButtonProps.d.ts +20 -0
- package/SegmentedControl/SegmentedControl.js +1 -1
- package/SegmentedControl/SegmentedControl.mjs +50 -44
- package/SegmentedControl/interfaces/SegmentedControlTypes.d.ts +12 -1
- package/SmartPasteButton/SmartPasteButton.d.ts +4 -0
- package/SmartPasteButton/SmartPasteButton.js +1 -1
- package/SmartPasteButton/SmartPasteButton.mjs +38 -32
- package/dist/cdn/js/kendo-vue-buttons.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +6 -6
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { defineComponent as
|
|
8
|
+
import { defineComponent as I, createVNode as o, ref as k } from "vue";
|
|
9
9
|
import { Button as l } from "../Button.mjs";
|
|
10
|
-
import { canUseDOM as O, Keys as
|
|
10
|
+
import { canUseDOM as O, Keys as n, getDefaultSlots as y, guid as a, validatePackage as S, classNames as D, templateRendering as h, getListeners as f } from "@progress/kendo-vue-common";
|
|
11
11
|
import { ButtonItem as x } from "./ButtonItem.mjs";
|
|
12
|
-
import
|
|
13
|
-
import { Popup as
|
|
12
|
+
import v from "./utils/navigation.mjs";
|
|
13
|
+
import { Popup as w } from "@progress/kendo-vue-popup";
|
|
14
14
|
import { getPopupAlign as P, getAnchorAlign as B } from "./utils/popup.mjs";
|
|
15
15
|
import { chevronDownIcon as E } from "@progress/kendo-svg-icons";
|
|
16
16
|
import { packageMetadata as K } from "../package-metadata.mjs";
|
|
17
|
-
const L = /* @__PURE__ */
|
|
17
|
+
const L = /* @__PURE__ */ I({
|
|
18
18
|
name: "KendoSplitButton",
|
|
19
19
|
emits: {
|
|
20
20
|
focus: (t) => !0,
|
|
@@ -39,6 +39,8 @@ const L = /* @__PURE__ */ k({
|
|
|
39
39
|
disabled: Boolean,
|
|
40
40
|
icon: String,
|
|
41
41
|
svgIcon: Object,
|
|
42
|
+
endIcon: String,
|
|
43
|
+
endSvgIcon: Object,
|
|
42
44
|
size: String,
|
|
43
45
|
rounded: String,
|
|
44
46
|
fillMode: {
|
|
@@ -96,7 +98,7 @@ const L = /* @__PURE__ */ k({
|
|
|
96
98
|
},
|
|
97
99
|
setup() {
|
|
98
100
|
return {
|
|
99
|
-
kendoAnchorRef:
|
|
101
|
+
kendoAnchorRef: k(null)
|
|
100
102
|
};
|
|
101
103
|
},
|
|
102
104
|
render() {
|
|
@@ -104,26 +106,26 @@ const L = /* @__PURE__ */ k({
|
|
|
104
106
|
const t = this.isRtl(), e = t ? "rtl" : void 0, {
|
|
105
107
|
tabIndex: i,
|
|
106
108
|
disabled: r
|
|
107
|
-
} = this.$props, p =
|
|
109
|
+
} = this.$props, p = y(this), m = function() {
|
|
108
110
|
const {
|
|
109
|
-
item:
|
|
111
|
+
item: s,
|
|
110
112
|
itemRender: c,
|
|
111
|
-
textField:
|
|
113
|
+
textField: $
|
|
112
114
|
} = this.$props;
|
|
113
115
|
return this.buttonsData.length > 0 ? this.buttonsData.map(function(d, u) {
|
|
114
|
-
const
|
|
116
|
+
const C = typeof d != "string" ? {
|
|
115
117
|
...d,
|
|
116
118
|
render: h.call(this, d.render, f.call(this))
|
|
117
119
|
} : d;
|
|
118
120
|
return o(x, {
|
|
119
121
|
role: "menuitem",
|
|
120
|
-
dataItem:
|
|
121
|
-
textField:
|
|
122
|
+
dataItem: C,
|
|
123
|
+
textField: $,
|
|
122
124
|
focused: this.focusedIndex === u,
|
|
123
125
|
onClick: this.onItemClick,
|
|
124
126
|
onDown: this.onItemDown,
|
|
125
127
|
render: h.call(this, c, f.call(this)),
|
|
126
|
-
item:
|
|
128
|
+
item: s,
|
|
127
129
|
key: u,
|
|
128
130
|
index: u,
|
|
129
131
|
id: `${this.guid}-${u}`
|
|
@@ -131,16 +133,16 @@ const L = /* @__PURE__ */ k({
|
|
|
131
133
|
}, this) : null;
|
|
132
134
|
}, g = function() {
|
|
133
135
|
const {
|
|
134
|
-
popupSettings:
|
|
136
|
+
popupSettings: s = {},
|
|
135
137
|
size: c
|
|
136
138
|
} = this.$props;
|
|
137
|
-
return o(
|
|
139
|
+
return o(w, {
|
|
138
140
|
anchor: this._anchor,
|
|
139
141
|
show: this.computedOpened,
|
|
140
|
-
animate:
|
|
141
|
-
popupClass: D("k-menu-popup",
|
|
142
|
-
anchorAlign:
|
|
143
|
-
popupAlign:
|
|
142
|
+
animate: s.animate,
|
|
143
|
+
popupClass: D("k-menu-popup", s.popupClass),
|
|
144
|
+
anchorAlign: s.anchorAlign || B(t),
|
|
145
|
+
popupAlign: s.popupAlign || P(t),
|
|
144
146
|
style: t ? {
|
|
145
147
|
direction: "rtl"
|
|
146
148
|
} : void 0
|
|
@@ -165,13 +167,15 @@ const L = /* @__PURE__ */ k({
|
|
|
165
167
|
rounded: this.$props.rounded,
|
|
166
168
|
fillMode: this.$props.fillMode,
|
|
167
169
|
themeColor: this.$props.themeColor,
|
|
168
|
-
onClick: (
|
|
170
|
+
onClick: (s) => this.onItemClick(s, -1),
|
|
169
171
|
disabled: r || void 0,
|
|
170
172
|
tabIndex: i,
|
|
171
173
|
accessKey: this.$props.accessKey,
|
|
172
174
|
class: this.$props.buttonClass,
|
|
173
175
|
icon: this.$props.icon,
|
|
174
176
|
svgIcon: this.$props.svgIcon,
|
|
177
|
+
endIcon: this.$props.endIcon,
|
|
178
|
+
endSvgIcon: this.$props.endSvgIcon,
|
|
175
179
|
iconClass: this.$props.iconClass,
|
|
176
180
|
imageUrl: this.$props.imageUrl,
|
|
177
181
|
dir: e,
|
|
@@ -205,20 +209,20 @@ const L = /* @__PURE__ */ k({
|
|
|
205
209
|
},
|
|
206
210
|
onKeyDown(t) {
|
|
207
211
|
if (t.altKey) {
|
|
208
|
-
!this.computedOpened && t.keyCode ===
|
|
212
|
+
!this.computedOpened && t.keyCode === n.down ? (this.dispatchPopupEvent(t, !0), this.focusedIndex = 0, this.currentOpened = !0) : this.computedOpened && t.keyCode === n.up && (this.dispatchPopupEvent(t, !1), this.focusedIndex = -1, this.currentOpened = !1);
|
|
209
213
|
return;
|
|
210
214
|
}
|
|
211
215
|
let e;
|
|
212
|
-
if (t.keyCode ===
|
|
216
|
+
if (t.keyCode === n.enter || t.keyCode === n.space ? (t.preventDefault(), this.dispatchClickEvent(t, this.focusedIndex), this.focusedIndex !== void 0 && this.focusedIndex >= 0 && (e = {
|
|
213
217
|
focusedIndex: this.computedOpened ? -1 : 0,
|
|
214
218
|
currentOpened: !this.computedOpened
|
|
215
|
-
}, this.dispatchPopupEvent(t, e.currentOpened))) : this.computedOpened && t.keyCode ===
|
|
219
|
+
}, this.dispatchPopupEvent(t, e.currentOpened))) : this.computedOpened && t.keyCode === n.esc && (e = {
|
|
216
220
|
focusedIndex: -1,
|
|
217
221
|
currentOpened: !1
|
|
218
222
|
}, this.dispatchPopupEvent(t, e.currentOpened)), this.computedOpened) {
|
|
219
|
-
const i =
|
|
223
|
+
const i = v(this.focusedIndex, t.keyCode, t.altKey, this.buttonsData.length);
|
|
220
224
|
i !== this.focusedIndex && (e = e || {}, e.focusedIndex = i);
|
|
221
|
-
const r = t.keyCode ===
|
|
225
|
+
const r = t.keyCode === n.up || t.keyCode === n.down || t.keyCode === n.left || t.keyCode === n.right;
|
|
222
226
|
!t.altKey && r && t.preventDefault();
|
|
223
227
|
}
|
|
224
228
|
e && (this.focusedIndex = e.focusedIndex, this.focused = e.focused, e.currentOpened !== void 0 && (this.currentOpened = e.currentOpened));
|
|
@@ -49,6 +49,16 @@ export interface DropDownButtonProps {
|
|
|
49
49
|
* Defines an SVGIcon to be rendered within the DropDownButton.
|
|
50
50
|
*/
|
|
51
51
|
svgIcon?: SVGIcon;
|
|
52
|
+
/**
|
|
53
|
+
* Sets the name of a font icon to render after the DropDownButton text.
|
|
54
|
+
* Use it with `icon` or `svgIcon` to display icons on both sides of the text.
|
|
55
|
+
*/
|
|
56
|
+
endIcon?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the SVG icon to render after the DropDownButton text.
|
|
59
|
+
* Use it with `icon` or `svgIcon` to display icons on both sides of the text.
|
|
60
|
+
*/
|
|
61
|
+
endSvgIcon?: SVGIcon;
|
|
52
62
|
/**
|
|
53
63
|
* Defines an icon with a custom CSS class that will be rendered next to the main button text ([see example]({% slug icons_dropdownbutton %})).
|
|
54
64
|
*/
|
|
@@ -192,6 +202,16 @@ export interface SplitButtonProps {
|
|
|
192
202
|
* Defines an SVGIcon to be rendered within the SplitButton.
|
|
193
203
|
*/
|
|
194
204
|
svgIcon?: SVGIcon;
|
|
205
|
+
/**
|
|
206
|
+
* Sets the name of a font icon to render after the primary button text.
|
|
207
|
+
* Does not affect the dropdown arrow button.
|
|
208
|
+
*/
|
|
209
|
+
endIcon?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Sets the SVG icon to render after the primary button text.
|
|
212
|
+
* Does not affect the dropdown arrow button.
|
|
213
|
+
*/
|
|
214
|
+
endSvgIcon?: SVGIcon;
|
|
195
215
|
/**
|
|
196
216
|
* Defines an icon with a custom CSS class that will be rendered next to the main button text ([see example]({% slug icons_splitbutton %})).
|
|
197
217
|
*/
|
|
@@ -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 n=require("vue"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),i=require("@progress/kendo-vue-common"),I=require("../package-metadata.js"),N=n.defineComponent({name:"KendoSegmentedControl",emits:{change:e=>!0},props:{items:{type:Array,default:()=>[]},size:String,rounded:String,layoutMode:{type:String,default:"compact"},value:String,defaultValue:String,itemTemplate:[String,Function]},data(){return{interactionState:{selectedValue:this.$props.defaultValue,hoveredValue:void 0,focusedValue:void 0}}},computed:{selectedItemValue(){var e;return(e=this.$props.value)!=null?e:this.interactionState.selectedValue},sizeClass(){const e=this.$props.size;return e?i.kendoThemeMaps.sizeMap[e]:void 0},roundedClass(){const e=this.$props.rounded;return e?i.kendoThemeMaps.roundedMap[e]:void 0},buttonClass(){return(e,t,s)=>i.classNames("k-segmented-control-button",{"k-selected":s,"k-hover":this.interactionState.hoveredValue===e&&!t,"k-focus":this.interactionState.focusedValue===e&&!t,"k-disabled":t})},iconClass(){return(e,t)=>i.classNames("k-segmented-control-button-icon",{...e&&{[e]:t}})}},watch:{selectedItemValue(){n.nextTick(()=>{this.updateThumbPosition()})}},created(){i.validatePackage(I.packageMetadata),this._resizeObserver=null},mounted(){n.nextTick(()=>{this.updateThumbPosition()}),this._resizeObserver=new ResizeObserver(()=>{this.updateThumbPosition()});const e=this.$refs.element;e&&this._resizeObserver.observe(e)},beforeUnmount(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)},methods:{updateThumbPosition(){const e=this.$refs.element,t=this.$refs.thumb;if(!e||!t)return;const s=e.querySelector(".k-segmented-control-button.k-selected");if(!s)return;const l=e.offsetWidth,{offsetWidth:a,offsetLeft:u}=s,c=`${u}px`,d=`${l-u-a}px`;t.style.left!==c&&(t.style.left=c),t.style.right!==d&&(t.style.right=d)},updateState(e){this.interactionState={...this.interactionState,...e}},handleButtonClick(e,t){var s,l;if(!e.disabled){if(this.selectedItemValue===e.value){(s=e.onClick)==null||s.call(e,t);return}this.$props.value===void 0&&e&&this.updateState({selectedValue:e.value}),this.$emit("change",e.value),(l=e.onClick)==null||l.call(e,t)}},handleMouseEnter(e,t,s,l){t||this.updateState({hoveredValue:e}),s==null||s(l)},handleMouseLeave(e,t){this.updateState({hoveredValue:void 0}),e==null||e(t)},handleFocus(e,t,s){this.updateState({focusedValue:e}),t==null||t(s)},handleBlur(e,t){this.updateState({focusedValue:void 0}),e==null||e(t)}},render(){const{items:e,layoutMode:t,itemTemplate:s}=this.$props,l=this.sizeClass,a=this.roundedClass,u=this.selectedItemValue,c=s?i.templateRendering.call(this,s,{}):void 0;return n.createVNode("div",{ref:"element",role:"group",class:i.classNames("k-segmented-control",l&&`k-segmented-control-${l}`,a&&`k-rounded-${a}`,{"k-segmented-control-stretched":t==="stretch"})},[n.createVNode("div",{class:"k-segmented-control-thumb",ref:"thumb","aria-hidden":"true"},null),(e||[]).map(d=>{const{value:r,disabled:h,text:v,svgIcon:f,endIcon:m,endSvgIcon:g,iconClassName:b,type:k="button",onMouseEnter:S,onMouseLeave:V,onFocus:C,onBlur:y,title:z,dir:$,"aria-label":T}=d,p=u===r;return n.createVNode("button",{key:r,type:k,class:this.buttonClass(r,h,p),disabled:h,"aria-disabled":h||void 0,"aria-pressed":p,title:z,dir:$,"aria-label":T,onClick:o=>this.handleButtonClick(d,o),onMouseenter:o=>this.handleMouseEnter(r,h,S,o),onMouseleave:o=>this.handleMouseLeave(V,o),onFocus:o=>this.handleFocus(r,C,o),onBlur:o=>this.handleBlur(y,o)},[i.getTemplate.call(this,{h:n.h,template:c,defaultRendering:n.createVNode(n.Fragment,null,[f&&n.createVNode(i.Icon,{class:this.iconClass(b,p),icon:f},null),n.createVNode("span",{class:"k-segmented-control-button-text"},[v]),(m||g)&&n.createVNode(i.Icon,{class:this.iconClass(b,p),name:m,icon:g},null)]),additionalProps:{item:d}})])})])}});exports.SegmentedControl=N;
|
|
@@ -5,10 +5,10 @@
|
|
|
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 { templateRendering as
|
|
10
|
-
import { packageMetadata as
|
|
11
|
-
const
|
|
8
|
+
import { defineComponent as M, createVNode as l, h as P, Fragment as _, nextTick as v } from "vue";
|
|
9
|
+
import { templateRendering as w, classNames as p, getTemplate as R, Icon as k, validatePackage as W, kendoThemeMaps as S } from "@progress/kendo-vue-common";
|
|
10
|
+
import { packageMetadata as L } from "../package-metadata.mjs";
|
|
11
|
+
const q = /* @__PURE__ */ M({
|
|
12
12
|
name: "KendoSegmentedControl",
|
|
13
13
|
emits: {
|
|
14
14
|
change: (e) => !0
|
|
@@ -44,11 +44,11 @@ const F = /* @__PURE__ */ I({
|
|
|
44
44
|
},
|
|
45
45
|
sizeClass() {
|
|
46
46
|
const e = this.$props.size;
|
|
47
|
-
return e ?
|
|
47
|
+
return e ? S.sizeMap[e] : void 0;
|
|
48
48
|
},
|
|
49
49
|
roundedClass() {
|
|
50
50
|
const e = this.$props.rounded;
|
|
51
|
-
return e ?
|
|
51
|
+
return e ? S.roundedMap[e] : void 0;
|
|
52
52
|
},
|
|
53
53
|
buttonClass() {
|
|
54
54
|
return (e, t, s) => p("k-segmented-control-button", {
|
|
@@ -68,16 +68,16 @@ const F = /* @__PURE__ */ I({
|
|
|
68
68
|
},
|
|
69
69
|
watch: {
|
|
70
70
|
selectedItemValue() {
|
|
71
|
-
|
|
71
|
+
v(() => {
|
|
72
72
|
this.updateThumbPosition();
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
created() {
|
|
77
|
-
|
|
77
|
+
W(L), this._resizeObserver = null;
|
|
78
78
|
},
|
|
79
79
|
mounted() {
|
|
80
|
-
|
|
80
|
+
v(() => {
|
|
81
81
|
this.updateThumbPosition();
|
|
82
82
|
}), this._resizeObserver = new ResizeObserver(() => {
|
|
83
83
|
this.updateThumbPosition();
|
|
@@ -99,8 +99,8 @@ const F = /* @__PURE__ */ I({
|
|
|
99
99
|
const n = e.offsetWidth, {
|
|
100
100
|
offsetWidth: o,
|
|
101
101
|
offsetLeft: a
|
|
102
|
-
} = s, u = `${a}px`,
|
|
103
|
-
t.style.left !== u && (t.style.left = u), t.style.right !==
|
|
102
|
+
} = s, u = `${a}px`, r = `${n - a - o}px`;
|
|
103
|
+
t.style.left !== u && (t.style.left = u), t.style.right !== r && (t.style.right = r);
|
|
104
104
|
},
|
|
105
105
|
updateState(e) {
|
|
106
106
|
this.interactionState = {
|
|
@@ -146,64 +146,70 @@ const F = /* @__PURE__ */ I({
|
|
|
146
146
|
items: e,
|
|
147
147
|
layoutMode: t,
|
|
148
148
|
itemTemplate: s
|
|
149
|
-
} = this.$props, n = this.sizeClass, o = this.roundedClass, a = this.selectedItemValue, u = s ?
|
|
150
|
-
return
|
|
149
|
+
} = this.$props, n = this.sizeClass, o = this.roundedClass, a = this.selectedItemValue, u = s ? w.call(this, s, {}) : void 0;
|
|
150
|
+
return l("div", {
|
|
151
151
|
ref: "element",
|
|
152
152
|
role: "group",
|
|
153
153
|
class: p("k-segmented-control", n && `k-segmented-control-${n}`, o && `k-rounded-${o}`, {
|
|
154
154
|
"k-segmented-control-stretched": t === "stretch"
|
|
155
155
|
})
|
|
156
|
-
}, [
|
|
156
|
+
}, [l("div", {
|
|
157
157
|
class: "k-segmented-control-thumb",
|
|
158
158
|
ref: "thumb",
|
|
159
159
|
"aria-hidden": "true"
|
|
160
|
-
}, null), (e || []).map((
|
|
160
|
+
}, null), (e || []).map((r) => {
|
|
161
161
|
const {
|
|
162
162
|
value: d,
|
|
163
163
|
disabled: c,
|
|
164
|
-
text:
|
|
164
|
+
text: C,
|
|
165
165
|
svgIcon: f,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
166
|
+
endIcon: m,
|
|
167
|
+
endSvgIcon: b,
|
|
168
|
+
iconClassName: g,
|
|
169
|
+
type: V = "button",
|
|
170
|
+
onMouseEnter: z,
|
|
171
|
+
onMouseLeave: $,
|
|
172
|
+
onFocus: y,
|
|
173
|
+
onBlur: I,
|
|
174
|
+
title: T,
|
|
175
|
+
dir: O,
|
|
176
|
+
"aria-label": x
|
|
177
|
+
} = r, h = a === d;
|
|
178
|
+
return l("button", {
|
|
177
179
|
key: d,
|
|
178
|
-
type:
|
|
180
|
+
type: V,
|
|
179
181
|
class: this.buttonClass(d, c, h),
|
|
180
182
|
disabled: c,
|
|
181
183
|
"aria-disabled": c || void 0,
|
|
182
184
|
"aria-pressed": h,
|
|
183
|
-
title:
|
|
184
|
-
dir:
|
|
185
|
-
"aria-label":
|
|
186
|
-
onClick: (i) => this.handleButtonClick(
|
|
187
|
-
onMouseenter: (i) => this.handleMouseEnter(d, c,
|
|
188
|
-
onMouseleave: (i) => this.handleMouseLeave(
|
|
189
|
-
onFocus: (i) => this.handleFocus(d,
|
|
190
|
-
onBlur: (i) => this.handleBlur(
|
|
191
|
-
}, [
|
|
192
|
-
h:
|
|
185
|
+
title: T,
|
|
186
|
+
dir: O,
|
|
187
|
+
"aria-label": x,
|
|
188
|
+
onClick: (i) => this.handleButtonClick(r, i),
|
|
189
|
+
onMouseenter: (i) => this.handleMouseEnter(d, c, z, i),
|
|
190
|
+
onMouseleave: (i) => this.handleMouseLeave($, i),
|
|
191
|
+
onFocus: (i) => this.handleFocus(d, y, i),
|
|
192
|
+
onBlur: (i) => this.handleBlur(I, i)
|
|
193
|
+
}, [R.call(this, {
|
|
194
|
+
h: P,
|
|
193
195
|
template: u,
|
|
194
|
-
defaultRendering:
|
|
195
|
-
class: this.iconClass(
|
|
196
|
+
defaultRendering: l(_, null, [f && l(k, {
|
|
197
|
+
class: this.iconClass(g, h),
|
|
196
198
|
icon: f
|
|
197
|
-
}, null),
|
|
199
|
+
}, null), l("span", {
|
|
198
200
|
class: "k-segmented-control-button-text"
|
|
199
|
-
}, [
|
|
201
|
+
}, [C]), (m || b) && l(k, {
|
|
202
|
+
class: this.iconClass(g, h),
|
|
203
|
+
name: m,
|
|
204
|
+
icon: b
|
|
205
|
+
}, null)]),
|
|
200
206
|
additionalProps: {
|
|
201
|
-
item:
|
|
207
|
+
item: r
|
|
202
208
|
}
|
|
203
209
|
})]);
|
|
204
210
|
})]);
|
|
205
211
|
}
|
|
206
212
|
});
|
|
207
213
|
export {
|
|
208
|
-
|
|
214
|
+
q as SegmentedControl
|
|
209
215
|
};
|
|
@@ -30,6 +30,17 @@ export interface SegmentedItemProps {
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
svgIcon?: SVGIcon;
|
|
33
|
+
/**
|
|
34
|
+
* Sets the name of a font icon to render after the item text.
|
|
35
|
+
* Only rendered when `itemTemplate` is not provided.
|
|
36
|
+
*/
|
|
37
|
+
endIcon?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Sets the SVG icon to render after the item text.
|
|
40
|
+
* Use it with `svgIcon` to display icons on both sides of the text.
|
|
41
|
+
* Only rendered when `itemTemplate` is not provided.
|
|
42
|
+
*/
|
|
43
|
+
endSvgIcon?: SVGIcon;
|
|
33
44
|
/**
|
|
34
45
|
* Specifies the text label of the SegmentedItem.
|
|
35
46
|
* Rendered inside a `<span>` element. Only rendered when `itemTemplate` is not provided.
|
|
@@ -187,7 +198,7 @@ export interface SegmentedControlProps {
|
|
|
187
198
|
defaultValue?: string;
|
|
188
199
|
/**
|
|
189
200
|
* A custom template for the item content. When provided, it replaces the default rendering
|
|
190
|
-
* (
|
|
201
|
+
* (leading icon, text span, and end icon) entirely.
|
|
191
202
|
*
|
|
192
203
|
* Accepts a string (slot name) or a render function. The slot receives `{ props: { item } }`
|
|
193
204
|
* where `item` is the full item configuration object.
|
|
@@ -43,6 +43,8 @@ declare const SmartPasteButton: import('vue').DefineComponent<import('vue').Extr
|
|
|
43
43
|
default: any;
|
|
44
44
|
};
|
|
45
45
|
icon: PropType<string>;
|
|
46
|
+
endIcon: PropType<string>;
|
|
47
|
+
endSvgIcon: PropType<import('@progress/kendo-vue-common').SVGIcon>;
|
|
46
48
|
iconClass: PropType<string>;
|
|
47
49
|
imageUrl: PropType<string>;
|
|
48
50
|
imageAlt: PropType<string>;
|
|
@@ -99,6 +101,8 @@ declare const SmartPasteButton: import('vue').DefineComponent<import('vue').Extr
|
|
|
99
101
|
default: any;
|
|
100
102
|
};
|
|
101
103
|
icon: PropType<string>;
|
|
104
|
+
endIcon: PropType<string>;
|
|
105
|
+
endSvgIcon: PropType<import('@progress/kendo-vue-common').SVGIcon>;
|
|
102
106
|
iconClass: PropType<string>;
|
|
103
107
|
imageUrl: PropType<string>;
|
|
104
108
|
imageAlt: PropType<string>;
|
|
@@ -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 p=require("vue"),f=require("@progress/kendo-vue-common"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("vue"),f=require("@progress/kendo-vue-common"),B=require("@progress/kendo-smartpaste-common"),b=require("../Button.js"),T=require("@progress/kendo-svg-icons"),q=require("../package-metadata.js");function O(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!p.isVNode(e)}const M=[".k-input",".k-picker",".k-checkbox",".k-radio",".k-switch",".k-rating",".k-slider"],N=e=>{const t=e.querySelector("input, select, textarea");return(t==null?void 0:t.getAttribute("name"))||(t==null?void 0:t.getAttribute("id"))||e.getAttribute("id")||null},V=(e,t)=>{const r=e.element,n=r instanceof HTMLInputElement||r instanceof HTMLSelectElement||r instanceof HTMLTextAreaElement?r:r.querySelector("input, select, textarea");if(n){if(n instanceof HTMLSelectElement){const i=Array.from(n.querySelectorAll("option")),s=i.find(a=>a.textContent===t)||i.find(a=>{var l;return(l=a.textContent)==null?void 0:l.includes(t)});s&&(n.selectedIndex=i.indexOf(s))}else if(n instanceof HTMLInputElement&&n.type==="date"){const i=new Date(t);n.value=isNaN(i.getTime())?t:i.toISOString().split("T")[0]}else n.value=t;n.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{fromSmartComponents:!0}})),n.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{fromSmartComponents:!0}}))}},w=p.defineComponent({name:"KendoSmartPasteButton",emits:{click:e=>!0},props:{disabled:{type:Boolean,default:void 0},fillMode:{type:String,default:"solid"},rounded:{type:String,default:"medium"},size:{type:String,default:"medium"},svgIcon:{type:Object,default:()=>T.pasteSparkleIcon},themeColor:String,formFields:Array,togglable:{type:Boolean,default:!1},selected:{type:Boolean,default:void 0},icon:String,endIcon:String,endSvgIcon:Object,iconClass:String,imageUrl:String,imageAlt:String,tabIndex:Number,id:String,type:{type:String,default:"button"},role:String,ariaLabel:String,ariaPressed:Boolean,title:String,dir:String,iconSize:String},created(){f.validatePackage(q.packageMetadata),this.smartPasteInstance=null},methods:{getSmartPasteInstance(){return this.getButtonElement()?(this.smartPasteInstance||(this.smartPasteInstance=new B.KendoSmartPaste({getElement:()=>this.getButtonElement(),customInputs:M.map(t=>({identifier:t})),getSmartPasteField:t=>{const r=N(t.element);return r?{...t,field:r}:t},setKendoInputValue:V})),this.smartPasteInstance):null},getButtonElement(){var t;const e=this.$refs.buttonRef;return(t=e==null?void 0:e.$el)!=null?t:null},extractFormConfig(){const e=this.getSmartPasteInstance();if(!e)return this.$props.formFields;const r=e.extractFormConfig().reduce((o,n)=>o.some(i=>i.field===n.field)?o:[...o,n],[]);return this.$props.formFields?this.$props.formFields.map(o=>{const n=r.find(i=>i.field===o.field);if(n){const i={...n,...o,element:n.element};return n.type==="kendo-input"&&(i.type="kendo-input"),i}return o}):r},async extractClipboard(){try{return await navigator.clipboard.readText()}catch{return""}},populateFormFieldsInternal(e,t){if(!e||!t)return;const r=Object.entries(e).reduce((i,[s,a])=>(a!=null&&(i[s]=a),i),{}),o=this.getButtonElement();if(o){const i=f.getKendoPasteEventTarget(o);f.dispatchKendoPasteEvent(i,r)}const n=this.getSmartPasteInstance();n&&n.populateFormFields({fieldValues:r},t)},async handleClick(e){if(this.$props.disabled)return;const t=await this.extractClipboard(),r=this.extractFormConfig(),o=r==null?void 0:r.map(s=>{var c,u,m;const{element:a,...l}=s,d=(c=this.$props.formFields)==null?void 0:c.find(g=>g.field===l.field);return{...l,type:(u=d==null?void 0:d.type)!=null?u:l.type,field:l.field||"",allowedValues:(m=l.allowedValues)!=null?m:[]}}),i={event:e,requestData:{content:t,formFields:o},setResponse:s=>{s!=null&&s.fieldValues&&this.populateFormFieldsInternal(s.fieldValues,r)}};this.$emit("click",i)}},render(){const e=f.getDefaultSlots(this),{disabled:t,fillMode:r,rounded:o,size:n,svgIcon:i,themeColor:s,togglable:a,selected:l,icon:d,iconClass:c,imageUrl:u,imageAlt:m,tabIndex:g,id:h,type:I,role:y,ariaLabel:E,ariaPressed:k,title:C,dir:P,iconSize:F,endIcon:v,endSvgIcon:x}=this.$props,S={ref:"buttonRef",disabled:t,fillMode:r,rounded:o,size:n,svgIcon:i,themeColor:s,togglable:a,selected:l,icon:d,iconClass:c,imageUrl:u,imageAlt:m,tabIndex:g,id:h,type:I,role:y,ariaLabel:E,ariaPressed:k,title:C,dir:P,iconSize:F,endIcon:v,endSvgIcon:x,onClick:this.handleClick};return e?p.createVNode(b.Button,S,O(e)?e:{default:()=>[e]}):p.createVNode(b.Button,S,null)}});exports.SmartPasteButton=w;
|
|
@@ -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 { getDefaultSlots as
|
|
10
|
-
import { KendoSmartPaste as
|
|
8
|
+
import { defineComponent as v, createVNode as g, isVNode as T } from "vue";
|
|
9
|
+
import { getDefaultSlots as B, getKendoPasteEventTarget as O, dispatchKendoPasteEvent as w, validatePackage as A } from "@progress/kendo-vue-common";
|
|
10
|
+
import { KendoSmartPaste as N } from "@progress/kendo-smartpaste-common";
|
|
11
11
|
import { Button as S } from "../Button.mjs";
|
|
12
|
-
import { pasteSparkleIcon as
|
|
13
|
-
import { packageMetadata as
|
|
14
|
-
function
|
|
15
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !
|
|
12
|
+
import { pasteSparkleIcon as $ } from "@progress/kendo-svg-icons";
|
|
13
|
+
import { packageMetadata as L } from "../package-metadata.mjs";
|
|
14
|
+
function M(e) {
|
|
15
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !T(e);
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const V = [".k-input", ".k-picker", ".k-checkbox", ".k-radio", ".k-switch", ".k-rating", ".k-slider"], j = (e) => {
|
|
18
18
|
const t = e.querySelector("input, select, textarea");
|
|
19
19
|
return (t == null ? void 0 : t.getAttribute("name")) || (t == null ? void 0 : t.getAttribute("id")) || e.getAttribute("id") || null;
|
|
20
|
-
},
|
|
20
|
+
}, K = (e, t) => {
|
|
21
21
|
const r = e.element, n = r instanceof HTMLInputElement || r instanceof HTMLSelectElement || r instanceof HTMLTextAreaElement ? r : r.querySelector("input, select, textarea");
|
|
22
22
|
if (n) {
|
|
23
23
|
if (n instanceof HTMLSelectElement) {
|
|
@@ -43,7 +43,7 @@ const L = [".k-input", ".k-picker", ".k-checkbox", ".k-radio", ".k-switch", ".k-
|
|
|
43
43
|
}
|
|
44
44
|
}));
|
|
45
45
|
}
|
|
46
|
-
},
|
|
46
|
+
}, U = /* @__PURE__ */ v({
|
|
47
47
|
name: "KendoSmartPasteButton",
|
|
48
48
|
emits: {
|
|
49
49
|
click: (e) => !0
|
|
@@ -67,7 +67,7 @@ const L = [".k-input", ".k-picker", ".k-checkbox", ".k-radio", ".k-switch", ".k-
|
|
|
67
67
|
},
|
|
68
68
|
svgIcon: {
|
|
69
69
|
type: Object,
|
|
70
|
-
default: () =>
|
|
70
|
+
default: () => $
|
|
71
71
|
},
|
|
72
72
|
themeColor: String,
|
|
73
73
|
formFields: Array,
|
|
@@ -80,6 +80,8 @@ const L = [".k-input", ".k-picker", ".k-checkbox", ".k-radio", ".k-switch", ".k-
|
|
|
80
80
|
default: void 0
|
|
81
81
|
},
|
|
82
82
|
icon: String,
|
|
83
|
+
endIcon: String,
|
|
84
|
+
endSvgIcon: Object,
|
|
83
85
|
iconClass: String,
|
|
84
86
|
imageUrl: String,
|
|
85
87
|
imageAlt: String,
|
|
@@ -97,23 +99,23 @@ const L = [".k-input", ".k-picker", ".k-checkbox", ".k-radio", ".k-switch", ".k-
|
|
|
97
99
|
iconSize: String
|
|
98
100
|
},
|
|
99
101
|
created() {
|
|
100
|
-
|
|
102
|
+
A(L), this.smartPasteInstance = null;
|
|
101
103
|
},
|
|
102
104
|
methods: {
|
|
103
105
|
getSmartPasteInstance() {
|
|
104
|
-
return this.getButtonElement() ? (this.smartPasteInstance || (this.smartPasteInstance = new
|
|
106
|
+
return this.getButtonElement() ? (this.smartPasteInstance || (this.smartPasteInstance = new N({
|
|
105
107
|
getElement: () => this.getButtonElement(),
|
|
106
|
-
customInputs:
|
|
108
|
+
customInputs: V.map((t) => ({
|
|
107
109
|
identifier: t
|
|
108
110
|
})),
|
|
109
111
|
getSmartPasteField: (t) => {
|
|
110
|
-
const r =
|
|
112
|
+
const r = j(t.element);
|
|
111
113
|
return r ? {
|
|
112
114
|
...t,
|
|
113
115
|
field: r
|
|
114
116
|
} : t;
|
|
115
117
|
},
|
|
116
|
-
setKendoInputValue:
|
|
118
|
+
setKendoInputValue: K
|
|
117
119
|
})), this.smartPasteInstance) : null;
|
|
118
120
|
},
|
|
119
121
|
getButtonElement() {
|
|
@@ -151,8 +153,8 @@ const L = [".k-input", ".k-picker", ".k-checkbox", ".k-radio", ".k-switch", ".k-
|
|
|
151
153
|
return;
|
|
152
154
|
const r = Object.entries(e).reduce((i, [s, a]) => (a != null && (i[s] = a), i), {}), o = this.getButtonElement();
|
|
153
155
|
if (o) {
|
|
154
|
-
const i =
|
|
155
|
-
|
|
156
|
+
const i = O(o);
|
|
157
|
+
w(i, r);
|
|
156
158
|
}
|
|
157
159
|
const n = this.getSmartPasteInstance();
|
|
158
160
|
n && n.populateFormFields({
|
|
@@ -188,7 +190,7 @@ const L = [".k-input", ".k-picker", ".k-checkbox", ".k-radio", ".k-switch", ".k-
|
|
|
188
190
|
}
|
|
189
191
|
},
|
|
190
192
|
render() {
|
|
191
|
-
const e =
|
|
193
|
+
const e = B(this), {
|
|
192
194
|
disabled: t,
|
|
193
195
|
fillMode: r,
|
|
194
196
|
rounded: o,
|
|
@@ -202,14 +204,16 @@ const L = [".k-input", ".k-picker", ".k-checkbox", ".k-radio", ".k-switch", ".k-
|
|
|
202
204
|
imageUrl: u,
|
|
203
205
|
imageAlt: m,
|
|
204
206
|
tabIndex: f,
|
|
205
|
-
id:
|
|
206
|
-
type:
|
|
207
|
-
role:
|
|
208
|
-
ariaLabel:
|
|
209
|
-
ariaPressed:
|
|
207
|
+
id: b,
|
|
208
|
+
type: h,
|
|
209
|
+
role: I,
|
|
210
|
+
ariaLabel: y,
|
|
211
|
+
ariaPressed: E,
|
|
210
212
|
title: C,
|
|
211
213
|
dir: P,
|
|
212
|
-
iconSize: k
|
|
214
|
+
iconSize: k,
|
|
215
|
+
endIcon: x,
|
|
216
|
+
endSvgIcon: F
|
|
213
217
|
} = this.$props, p = {
|
|
214
218
|
ref: "buttonRef",
|
|
215
219
|
disabled: t,
|
|
@@ -225,21 +229,23 @@ const L = [".k-input", ".k-picker", ".k-checkbox", ".k-radio", ".k-switch", ".k-
|
|
|
225
229
|
imageUrl: u,
|
|
226
230
|
imageAlt: m,
|
|
227
231
|
tabIndex: f,
|
|
228
|
-
id:
|
|
229
|
-
type:
|
|
230
|
-
role:
|
|
231
|
-
ariaLabel:
|
|
232
|
-
ariaPressed:
|
|
232
|
+
id: b,
|
|
233
|
+
type: h,
|
|
234
|
+
role: I,
|
|
235
|
+
ariaLabel: y,
|
|
236
|
+
ariaPressed: E,
|
|
233
237
|
title: C,
|
|
234
238
|
dir: P,
|
|
235
239
|
iconSize: k,
|
|
240
|
+
endIcon: x,
|
|
241
|
+
endSvgIcon: F,
|
|
236
242
|
onClick: this.handleClick
|
|
237
243
|
};
|
|
238
|
-
return e ? g(S, p,
|
|
244
|
+
return e ? g(S, p, M(e) ? e : {
|
|
239
245
|
default: () => [e]
|
|
240
246
|
}) : g(S, p, null);
|
|
241
247
|
}
|
|
242
248
|
});
|
|
243
249
|
export {
|
|
244
|
-
|
|
250
|
+
U as SmartPasteButton
|
|
245
251
|
};
|