@progress/kendo-vue-buttons 10.1.1-develop.2 → 10.2.0-develop.10
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.d.ts +3 -0
- package/SegmentedControl/SegmentedControl.js +1 -1
- package/SegmentedControl/SegmentedControl.mjs +64 -53
- package/SegmentedControl/interfaces/SegmentedControlTypes.d.ts +31 -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
|
*/
|
|
@@ -20,6 +20,7 @@ declare const SegmentedControl: import('vue').DefineComponent<import('vue').Extr
|
|
|
20
20
|
default: () => any[];
|
|
21
21
|
};
|
|
22
22
|
size: PropType<"small" | "medium" | "xs" | "large">;
|
|
23
|
+
rounded: PropType<"small" | "medium" | "large" | "full" | "none">;
|
|
23
24
|
layoutMode: {
|
|
24
25
|
type: PropType<"stretch" | "compact">;
|
|
25
26
|
default: string;
|
|
@@ -32,6 +33,7 @@ declare const SegmentedControl: import('vue').DefineComponent<import('vue').Extr
|
|
|
32
33
|
}, {
|
|
33
34
|
selectedItemValue(): string | undefined;
|
|
34
35
|
sizeClass(): string | undefined;
|
|
36
|
+
roundedClass(): string | undefined;
|
|
35
37
|
buttonClass(): (itemValue: string, disabled: boolean | undefined, isSelected: boolean) => string;
|
|
36
38
|
iconClass(): (iconClassName: string | undefined, isSelected: boolean) => string;
|
|
37
39
|
}, {
|
|
@@ -50,6 +52,7 @@ declare const SegmentedControl: import('vue').DefineComponent<import('vue').Extr
|
|
|
50
52
|
default: () => any[];
|
|
51
53
|
};
|
|
52
54
|
size: PropType<"small" | "medium" | "xs" | "large">;
|
|
55
|
+
rounded: PropType<"small" | "medium" | "large" | "full" | "none">;
|
|
53
56
|
layoutMode: {
|
|
54
57
|
type: PropType<"stretch" | "compact">;
|
|
55
58
|
default: 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 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
|
|
@@ -19,6 +19,7 @@ const B = /* @__PURE__ */ $({
|
|
|
19
19
|
default: () => []
|
|
20
20
|
},
|
|
21
21
|
size: String,
|
|
22
|
+
rounded: String,
|
|
22
23
|
layoutMode: {
|
|
23
24
|
type: String,
|
|
24
25
|
default: "compact"
|
|
@@ -43,10 +44,14 @@ const B = /* @__PURE__ */ $({
|
|
|
43
44
|
},
|
|
44
45
|
sizeClass() {
|
|
45
46
|
const e = this.$props.size;
|
|
46
|
-
return e ?
|
|
47
|
+
return e ? S.sizeMap[e] : void 0;
|
|
48
|
+
},
|
|
49
|
+
roundedClass() {
|
|
50
|
+
const e = this.$props.rounded;
|
|
51
|
+
return e ? S.roundedMap[e] : void 0;
|
|
47
52
|
},
|
|
48
53
|
buttonClass() {
|
|
49
|
-
return (e, t, s) =>
|
|
54
|
+
return (e, t, s) => p("k-segmented-control-button", {
|
|
50
55
|
"k-selected": s,
|
|
51
56
|
"k-hover": this.interactionState.hoveredValue === e && !t,
|
|
52
57
|
"k-focus": this.interactionState.focusedValue === e && !t,
|
|
@@ -54,7 +59,7 @@ const B = /* @__PURE__ */ $({
|
|
|
54
59
|
});
|
|
55
60
|
},
|
|
56
61
|
iconClass() {
|
|
57
|
-
return (e, t) =>
|
|
62
|
+
return (e, t) => p("k-segmented-control-button-icon", {
|
|
58
63
|
...e && {
|
|
59
64
|
[e]: t
|
|
60
65
|
}
|
|
@@ -63,16 +68,16 @@ const B = /* @__PURE__ */ $({
|
|
|
63
68
|
},
|
|
64
69
|
watch: {
|
|
65
70
|
selectedItemValue() {
|
|
66
|
-
|
|
71
|
+
v(() => {
|
|
67
72
|
this.updateThumbPosition();
|
|
68
73
|
});
|
|
69
74
|
}
|
|
70
75
|
},
|
|
71
76
|
created() {
|
|
72
|
-
|
|
77
|
+
W(L), this._resizeObserver = null;
|
|
73
78
|
},
|
|
74
79
|
mounted() {
|
|
75
|
-
|
|
80
|
+
v(() => {
|
|
76
81
|
this.updateThumbPosition();
|
|
77
82
|
}), this._resizeObserver = new ResizeObserver(() => {
|
|
78
83
|
this.updateThumbPosition();
|
|
@@ -92,10 +97,10 @@ const B = /* @__PURE__ */ $({
|
|
|
92
97
|
if (!s)
|
|
93
98
|
return;
|
|
94
99
|
const n = e.offsetWidth, {
|
|
95
|
-
offsetWidth:
|
|
96
|
-
offsetLeft:
|
|
97
|
-
} = s,
|
|
98
|
-
t.style.left !==
|
|
100
|
+
offsetWidth: o,
|
|
101
|
+
offsetLeft: a
|
|
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);
|
|
99
104
|
},
|
|
100
105
|
updateState(e) {
|
|
101
106
|
this.interactionState = {
|
|
@@ -141,57 +146,63 @@ const B = /* @__PURE__ */ $({
|
|
|
141
146
|
items: e,
|
|
142
147
|
layoutMode: t,
|
|
143
148
|
itemTemplate: s
|
|
144
|
-
} = this.$props, n = this.sizeClass,
|
|
145
|
-
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", {
|
|
146
151
|
ref: "element",
|
|
147
152
|
role: "group",
|
|
148
|
-
class:
|
|
153
|
+
class: p("k-segmented-control", n && `k-segmented-control-${n}`, o && `k-rounded-${o}`, {
|
|
149
154
|
"k-segmented-control-stretched": t === "stretch"
|
|
150
155
|
})
|
|
151
|
-
}, [
|
|
156
|
+
}, [l("div", {
|
|
152
157
|
class: "k-segmented-control-thumb",
|
|
153
158
|
ref: "thumb",
|
|
154
159
|
"aria-hidden": "true"
|
|
155
160
|
}, null), (e || []).map((r) => {
|
|
156
161
|
const {
|
|
157
|
-
value:
|
|
158
|
-
disabled:
|
|
159
|
-
text:
|
|
162
|
+
value: d,
|
|
163
|
+
disabled: c,
|
|
164
|
+
text: C,
|
|
160
165
|
svgIcon: f,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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", {
|
|
179
|
+
key: d,
|
|
180
|
+
type: V,
|
|
181
|
+
class: this.buttonClass(d, c, h),
|
|
182
|
+
disabled: c,
|
|
183
|
+
"aria-disabled": c || void 0,
|
|
184
|
+
"aria-pressed": h,
|
|
185
|
+
title: T,
|
|
186
|
+
dir: O,
|
|
187
|
+
"aria-label": x,
|
|
181
188
|
onClick: (i) => this.handleButtonClick(r, i),
|
|
182
|
-
onMouseenter: (i) => this.handleMouseEnter(
|
|
183
|
-
onMouseleave: (i) => this.handleMouseLeave(
|
|
184
|
-
onFocus: (i) => this.handleFocus(
|
|
185
|
-
onBlur: (i) => this.handleBlur(
|
|
186
|
-
}, [
|
|
187
|
-
h:
|
|
188
|
-
template:
|
|
189
|
-
defaultRendering:
|
|
190
|
-
class: this.iconClass(
|
|
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,
|
|
195
|
+
template: u,
|
|
196
|
+
defaultRendering: l(_, null, [f && l(k, {
|
|
197
|
+
class: this.iconClass(g, h),
|
|
191
198
|
icon: f
|
|
192
|
-
}, null),
|
|
199
|
+
}, null), l("span", {
|
|
193
200
|
class: "k-segmented-control-button-text"
|
|
194
|
-
}, [
|
|
201
|
+
}, [C]), (m || b) && l(k, {
|
|
202
|
+
class: this.iconClass(g, h),
|
|
203
|
+
name: m,
|
|
204
|
+
icon: b
|
|
205
|
+
}, null)]),
|
|
195
206
|
additionalProps: {
|
|
196
207
|
item: r
|
|
197
208
|
}
|
|
@@ -200,5 +211,5 @@ const B = /* @__PURE__ */ $({
|
|
|
200
211
|
}
|
|
201
212
|
});
|
|
202
213
|
export {
|
|
203
|
-
|
|
214
|
+
q as SegmentedControl
|
|
204
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.
|
|
@@ -131,6 +142,25 @@ export interface SegmentedControlProps {
|
|
|
131
142
|
* ```
|
|
132
143
|
*/
|
|
133
144
|
size?: ButtonProps['size'];
|
|
145
|
+
/**
|
|
146
|
+
* Configures the `roundness` of the SegmentedControl. The value is mapped through `kendoThemeMaps.roundedMap`
|
|
147
|
+
* to the corresponding `k-rounded-*` CSS class.
|
|
148
|
+
*
|
|
149
|
+
* The available options are:
|
|
150
|
+
* - `none`
|
|
151
|
+
* - `small`
|
|
152
|
+
* - `medium`
|
|
153
|
+
* - `large`
|
|
154
|
+
* - `full`
|
|
155
|
+
*
|
|
156
|
+
* @default undefined (theme-controlled)
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```vue
|
|
160
|
+
* <SegmentedControl :rounded="'medium'" :items="items" />
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
rounded?: 'none' | 'small' | 'medium' | 'large' | 'full';
|
|
134
164
|
/**
|
|
135
165
|
* Specifies the layout mode of the SegmentedControl.
|
|
136
166
|
*
|
|
@@ -168,7 +198,7 @@ export interface SegmentedControlProps {
|
|
|
168
198
|
defaultValue?: string;
|
|
169
199
|
/**
|
|
170
200
|
* A custom template for the item content. When provided, it replaces the default rendering
|
|
171
|
-
* (
|
|
201
|
+
* (leading icon, text span, and end icon) entirely.
|
|
172
202
|
*
|
|
173
203
|
* Accepts a string (slot name) or a render function. The slot receives `{ props: { item } }`
|
|
174
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;
|