@progress/kendo-vue-buttons 8.2.0 → 8.3.0-develop.2
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/SegmentedControl/SegmentedControl.d.ts +67 -0
- package/SegmentedControl/SegmentedControl.js +8 -0
- package/SegmentedControl/SegmentedControl.mjs +204 -0
- package/SegmentedControl/interfaces/SegmentedControlTypes.d.ts +204 -0
- package/SegmentedControl/interfaces/index.d.ts +8 -0
- package/SmartPasteButton/SmartPasteButton.d.ts +130 -0
- package/SmartPasteButton/SmartPasteButton.js +8 -0
- package/SmartPasteButton/SmartPasteButton.mjs +245 -0
- package/SmartPasteButton/index.d.ts +9 -0
- package/SmartPasteButton/interfaces/SmartPasteButtonHandle.d.ts +20 -0
- package/SmartPasteButton/interfaces/SmartPasteButtonProps.d.ts +58 -0
- package/SmartPasteButton/interfaces/SmartPasteFormField.d.ts +35 -0
- package/SmartPasteButton/interfaces/index.d.ts +10 -0
- package/dist/cdn/js/kendo-vue-buttons.js +1 -1
- package/index.d.mts +2 -0
- package/index.d.ts +2 -0
- package/index.js +1 -1
- package/index.mjs +20 -16
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +6 -5
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { PropType } from 'vue';
|
|
9
|
+
import { SegmentedControlState, SegmentedItemProps } from './interfaces';
|
|
10
|
+
/**
|
|
11
|
+
* Represents the Kendo UI for Vue SegmentedControl component.
|
|
12
|
+
*
|
|
13
|
+
* The SegmentedControl displays a horizontal set of mutually exclusive button segments,
|
|
14
|
+
* allowing the user to select one option at a time.
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
declare const SegmentedControl: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
18
|
+
items: {
|
|
19
|
+
type: PropType<SegmentedItemProps[]>;
|
|
20
|
+
default: () => any[];
|
|
21
|
+
};
|
|
22
|
+
size: PropType<"small" | "medium" | "large">;
|
|
23
|
+
layoutMode: {
|
|
24
|
+
type: PropType<"stretch" | "compact">;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
value: PropType<string>;
|
|
28
|
+
defaultValue: PropType<string>;
|
|
29
|
+
itemTemplate: PropType<string | ((itemData: SegmentedItemProps) => any)>;
|
|
30
|
+
}>, {}, {
|
|
31
|
+
interactionState: SegmentedControlState;
|
|
32
|
+
}, {
|
|
33
|
+
selectedItemValue(): string | undefined;
|
|
34
|
+
sizeClass(): string | undefined;
|
|
35
|
+
buttonClass(): (itemValue: string, disabled: boolean | undefined, isSelected: boolean) => string;
|
|
36
|
+
iconClass(): (iconClassName: string | undefined, isSelected: boolean) => string;
|
|
37
|
+
}, {
|
|
38
|
+
updateThumbPosition(): void;
|
|
39
|
+
updateState(state: Partial<SegmentedControlState>): void;
|
|
40
|
+
handleButtonClick(itemData: SegmentedItemProps, e: MouseEvent): void;
|
|
41
|
+
handleMouseEnter(itemValue: string, disabled: boolean | undefined, onMouseEnter: (e: MouseEvent) => void, e: MouseEvent): void;
|
|
42
|
+
handleMouseLeave(onMouseLeave: (e: MouseEvent) => void, e: MouseEvent): void;
|
|
43
|
+
handleFocus(itemValue: string, onFocus: (e: FocusEvent) => void, e: FocusEvent): void;
|
|
44
|
+
handleBlur(onBlur: (e: FocusEvent) => void, e: FocusEvent): void;
|
|
45
|
+
}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
46
|
+
change: (value: string) => true;
|
|
47
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
48
|
+
items: {
|
|
49
|
+
type: PropType<SegmentedItemProps[]>;
|
|
50
|
+
default: () => any[];
|
|
51
|
+
};
|
|
52
|
+
size: PropType<"small" | "medium" | "large">;
|
|
53
|
+
layoutMode: {
|
|
54
|
+
type: PropType<"stretch" | "compact">;
|
|
55
|
+
default: string;
|
|
56
|
+
};
|
|
57
|
+
value: PropType<string>;
|
|
58
|
+
defaultValue: PropType<string>;
|
|
59
|
+
itemTemplate: PropType<string | ((itemData: SegmentedItemProps) => any)>;
|
|
60
|
+
}>> & Readonly<{
|
|
61
|
+
onChange?: (value: string) => any;
|
|
62
|
+
}>, {
|
|
63
|
+
items: SegmentedItemProps[];
|
|
64
|
+
layoutMode: "stretch" | "compact";
|
|
65
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
66
|
+
export { SegmentedControl };
|
|
67
|
+
export type { SegmentedControlProps, SegmentedItemProps } from './interfaces';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),o=require("@progress/kendo-vue-common"),z=require("../package-metadata.js"),T=n.defineComponent({name:"KendoSegmentedControl",emits:{change:e=>!0},props:{items:{type:Array,default:()=>[]},size: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?o.kendoThemeMaps.sizeMap[e]:void 0},buttonClass(){return(e,t,s)=>o.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)=>o.classNames("k-segmented-control-button-icon",{...e&&{[e]:t}})}},watch:{selectedItemValue(){n.nextTick(()=>{this.updateThumbPosition()})}},created(){o.validatePackage(z.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 i=e.offsetWidth,{offsetWidth:c,offsetLeft:d}=s,a=`${d}px`,r=`${i-d-c}px`;t.style.left!==a&&(t.style.left=a),t.style.right!==r&&(t.style.right=r)},updateState(e){this.interactionState={...this.interactionState,...e}},handleButtonClick(e,t){var s,i;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),(i=e.onClick)==null||i.call(e,t)}},handleMouseEnter(e,t,s,i){t||this.updateState({hoveredValue:e}),s==null||s(i)},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,i=this.sizeClass,c=this.selectedItemValue,d=s?o.templateRendering.call(this,s,{}):void 0;return n.createVNode("div",{ref:"element",role:"group",class:o.classNames("k-segmented-control",i&&`k-segmented-control-${i}`,{"k-segmented-control-stretched":t==="stretch"})},[n.createVNode("div",{class:"k-segmented-control-thumb",ref:"thumb","aria-hidden":"true"},null),(e||[]).map(a=>{const{value:r,disabled:u,text:p,svgIcon:f,iconClassName:m,type:b="button",onMouseEnter:g,onMouseLeave:v,onFocus:k,onBlur:V,title:S,dir:C,"aria-label":y}=a,h=c===r;return n.createVNode("button",{key:r,type:b,class:this.buttonClass(r,u,h),disabled:u,"aria-disabled":u||void 0,"aria-pressed":h,title:S,dir:C,"aria-label":y,onClick:l=>this.handleButtonClick(a,l),onMouseenter:l=>this.handleMouseEnter(r,u,g,l),onMouseleave:l=>this.handleMouseLeave(v,l),onFocus:l=>this.handleFocus(r,k,l),onBlur:l=>this.handleBlur(V,l)},[o.getTemplate.call(this,{h:n.h,template:d,defaultRendering:n.createVNode(n.Fragment,null,[f&&n.createVNode(o.Icon,{class:this.iconClass(m,h),icon:f},null),n.createVNode("span",{class:"k-segmented-control-button-text"},[p])]),additionalProps:{item:a}})])})])}});exports.SegmentedControl=T;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { defineComponent as $, createVNode as o, h as T, Fragment as I, nextTick as p } from "vue";
|
|
9
|
+
import { templateRendering as O, classNames as h, getTemplate as x, Icon as P, validatePackage as _, kendoThemeMaps as M } from "@progress/kendo-vue-common";
|
|
10
|
+
import { packageMetadata as w } from "../package-metadata.mjs";
|
|
11
|
+
const B = /* @__PURE__ */ $({
|
|
12
|
+
name: "KendoSegmentedControl",
|
|
13
|
+
emits: {
|
|
14
|
+
change: (e) => !0
|
|
15
|
+
},
|
|
16
|
+
props: {
|
|
17
|
+
items: {
|
|
18
|
+
type: Array,
|
|
19
|
+
default: () => []
|
|
20
|
+
},
|
|
21
|
+
size: String,
|
|
22
|
+
layoutMode: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "compact"
|
|
25
|
+
},
|
|
26
|
+
value: String,
|
|
27
|
+
defaultValue: String,
|
|
28
|
+
itemTemplate: [String, Function]
|
|
29
|
+
},
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
interactionState: {
|
|
33
|
+
selectedValue: this.$props.defaultValue,
|
|
34
|
+
hoveredValue: void 0,
|
|
35
|
+
focusedValue: void 0
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
computed: {
|
|
40
|
+
selectedItemValue() {
|
|
41
|
+
var e;
|
|
42
|
+
return (e = this.$props.value) != null ? e : this.interactionState.selectedValue;
|
|
43
|
+
},
|
|
44
|
+
sizeClass() {
|
|
45
|
+
const e = this.$props.size;
|
|
46
|
+
return e ? M.sizeMap[e] : void 0;
|
|
47
|
+
},
|
|
48
|
+
buttonClass() {
|
|
49
|
+
return (e, t, s) => h("k-segmented-control-button", {
|
|
50
|
+
"k-selected": s,
|
|
51
|
+
"k-hover": this.interactionState.hoveredValue === e && !t,
|
|
52
|
+
"k-focus": this.interactionState.focusedValue === e && !t,
|
|
53
|
+
"k-disabled": t
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
iconClass() {
|
|
57
|
+
return (e, t) => h("k-segmented-control-button-icon", {
|
|
58
|
+
...e && {
|
|
59
|
+
[e]: t
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
watch: {
|
|
65
|
+
selectedItemValue() {
|
|
66
|
+
p(() => {
|
|
67
|
+
this.updateThumbPosition();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
created() {
|
|
72
|
+
_(w), this._resizeObserver = null;
|
|
73
|
+
},
|
|
74
|
+
mounted() {
|
|
75
|
+
p(() => {
|
|
76
|
+
this.updateThumbPosition();
|
|
77
|
+
}), this._resizeObserver = new ResizeObserver(() => {
|
|
78
|
+
this.updateThumbPosition();
|
|
79
|
+
});
|
|
80
|
+
const e = this.$refs.element;
|
|
81
|
+
e && this._resizeObserver.observe(e);
|
|
82
|
+
},
|
|
83
|
+
beforeUnmount() {
|
|
84
|
+
this._resizeObserver && (this._resizeObserver.disconnect(), this._resizeObserver = null);
|
|
85
|
+
},
|
|
86
|
+
methods: {
|
|
87
|
+
updateThumbPosition() {
|
|
88
|
+
const e = this.$refs.element, t = this.$refs.thumb;
|
|
89
|
+
if (!e || !t)
|
|
90
|
+
return;
|
|
91
|
+
const s = e.querySelector(".k-segmented-control-button.k-selected");
|
|
92
|
+
if (!s)
|
|
93
|
+
return;
|
|
94
|
+
const n = e.offsetWidth, {
|
|
95
|
+
offsetWidth: u,
|
|
96
|
+
offsetLeft: d
|
|
97
|
+
} = s, r = `${d}px`, l = `${n - d - u}px`;
|
|
98
|
+
t.style.left !== r && (t.style.left = r), t.style.right !== l && (t.style.right = l);
|
|
99
|
+
},
|
|
100
|
+
updateState(e) {
|
|
101
|
+
this.interactionState = {
|
|
102
|
+
...this.interactionState,
|
|
103
|
+
...e
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
handleButtonClick(e, t) {
|
|
107
|
+
var s, n;
|
|
108
|
+
if (!e.disabled) {
|
|
109
|
+
if (this.selectedItemValue === e.value) {
|
|
110
|
+
(s = e.onClick) == null || s.call(e, t);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.$props.value === void 0 && e && this.updateState({
|
|
114
|
+
selectedValue: e.value
|
|
115
|
+
}), this.$emit("change", e.value), (n = e.onClick) == null || n.call(e, t);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
handleMouseEnter(e, t, s, n) {
|
|
119
|
+
t || this.updateState({
|
|
120
|
+
hoveredValue: e
|
|
121
|
+
}), s == null || s(n);
|
|
122
|
+
},
|
|
123
|
+
handleMouseLeave(e, t) {
|
|
124
|
+
this.updateState({
|
|
125
|
+
hoveredValue: void 0
|
|
126
|
+
}), e == null || e(t);
|
|
127
|
+
},
|
|
128
|
+
handleFocus(e, t, s) {
|
|
129
|
+
this.updateState({
|
|
130
|
+
focusedValue: e
|
|
131
|
+
}), t == null || t(s);
|
|
132
|
+
},
|
|
133
|
+
handleBlur(e, t) {
|
|
134
|
+
this.updateState({
|
|
135
|
+
focusedValue: void 0
|
|
136
|
+
}), e == null || e(t);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
render() {
|
|
140
|
+
const {
|
|
141
|
+
items: e,
|
|
142
|
+
layoutMode: t,
|
|
143
|
+
itemTemplate: s
|
|
144
|
+
} = this.$props, n = this.sizeClass, u = this.selectedItemValue, d = s ? O.call(this, s, {}) : void 0;
|
|
145
|
+
return o("div", {
|
|
146
|
+
ref: "element",
|
|
147
|
+
role: "group",
|
|
148
|
+
class: h("k-segmented-control", n && `k-segmented-control-${n}`, {
|
|
149
|
+
"k-segmented-control-stretched": t === "stretch"
|
|
150
|
+
})
|
|
151
|
+
}, [o("div", {
|
|
152
|
+
class: "k-segmented-control-thumb",
|
|
153
|
+
ref: "thumb",
|
|
154
|
+
"aria-hidden": "true"
|
|
155
|
+
}, null), (e || []).map((r) => {
|
|
156
|
+
const {
|
|
157
|
+
value: l,
|
|
158
|
+
disabled: a,
|
|
159
|
+
text: m,
|
|
160
|
+
svgIcon: f,
|
|
161
|
+
iconClassName: b,
|
|
162
|
+
type: g = "button",
|
|
163
|
+
onMouseEnter: v,
|
|
164
|
+
onMouseLeave: k,
|
|
165
|
+
onFocus: S,
|
|
166
|
+
onBlur: V,
|
|
167
|
+
title: C,
|
|
168
|
+
dir: z,
|
|
169
|
+
"aria-label": y
|
|
170
|
+
} = r, c = u === l;
|
|
171
|
+
return o("button", {
|
|
172
|
+
key: l,
|
|
173
|
+
type: g,
|
|
174
|
+
class: this.buttonClass(l, a, c),
|
|
175
|
+
disabled: a,
|
|
176
|
+
"aria-disabled": a || void 0,
|
|
177
|
+
"aria-pressed": c,
|
|
178
|
+
title: C,
|
|
179
|
+
dir: z,
|
|
180
|
+
"aria-label": y,
|
|
181
|
+
onClick: (i) => this.handleButtonClick(r, i),
|
|
182
|
+
onMouseenter: (i) => this.handleMouseEnter(l, a, v, i),
|
|
183
|
+
onMouseleave: (i) => this.handleMouseLeave(k, i),
|
|
184
|
+
onFocus: (i) => this.handleFocus(l, S, i),
|
|
185
|
+
onBlur: (i) => this.handleBlur(V, i)
|
|
186
|
+
}, [x.call(this, {
|
|
187
|
+
h: T,
|
|
188
|
+
template: d,
|
|
189
|
+
defaultRendering: o(I, null, [f && o(P, {
|
|
190
|
+
class: this.iconClass(b, c),
|
|
191
|
+
icon: f
|
|
192
|
+
}, null), o("span", {
|
|
193
|
+
class: "k-segmented-control-button-text"
|
|
194
|
+
}, [m])]),
|
|
195
|
+
additionalProps: {
|
|
196
|
+
item: r
|
|
197
|
+
}
|
|
198
|
+
})]);
|
|
199
|
+
})]);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
export {
|
|
203
|
+
B as SegmentedControl
|
|
204
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { SVGIcon } from '@progress/kendo-vue-common';
|
|
9
|
+
import { ButtonProps } from '../../Button';
|
|
10
|
+
/**
|
|
11
|
+
* Represents the properties of a single item within the SegmentedControl component.
|
|
12
|
+
*/
|
|
13
|
+
export interface SegmentedItemProps {
|
|
14
|
+
/**
|
|
15
|
+
* The unique identifier for the SegmentedItem. Used to match against the SegmentedControl's `value` to determine selection.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```vue
|
|
19
|
+
* <SegmentedControl :items="[{ value: 'option1', text: 'Option 1' }]" />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
value: string;
|
|
23
|
+
/**
|
|
24
|
+
* Sets an SVG icon to render inside the item using an `Icon` element.
|
|
25
|
+
* Only rendered when `itemTemplate` is not provided.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```vue
|
|
29
|
+
* <SegmentedControl :items="[{ value: 'opt1', text: 'Bold', svgIcon: boldIcon }]" />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
svgIcon?: SVGIcon;
|
|
33
|
+
/**
|
|
34
|
+
* Specifies the text label of the SegmentedItem.
|
|
35
|
+
* Rendered inside a `<span>` element. Only rendered when `itemTemplate` is not provided.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```vue
|
|
39
|
+
* <SegmentedControl :items="[{ value: 'opt1', text: 'Option 1' }]" />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
text?: string;
|
|
43
|
+
/**
|
|
44
|
+
* CSS class name applied to the icon element only when the item is selected.
|
|
45
|
+
* Has no effect when `itemTemplate` is provided.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```vue
|
|
49
|
+
* <SegmentedControl :items="[{ value: 'opt1', text: 'Bold', svgIcon: boldIcon, iconClassName: 'active-icon' }]" />
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
iconClassName?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the `title` HTML attribute of the item button.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```vue
|
|
58
|
+
* <SegmentedControl :items="[{ value: 'opt1', title: 'Option 1 tooltip' }]" />
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
title?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Represents the `dir` HTML attribute of the item button, controlling text directionality.
|
|
64
|
+
*/
|
|
65
|
+
dir?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Specifies whether the item is disabled.
|
|
68
|
+
*/
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Specifies the `type` HTML attribute of the item button.
|
|
72
|
+
*
|
|
73
|
+
* @default "button"
|
|
74
|
+
*/
|
|
75
|
+
type?: 'button' | 'submit' | 'reset';
|
|
76
|
+
/**
|
|
77
|
+
* The `aria-label` HTML attribute of the item button.
|
|
78
|
+
*/
|
|
79
|
+
'aria-label'?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Event handler fired when the item button is clicked.
|
|
82
|
+
*/
|
|
83
|
+
onClick?: (e: MouseEvent) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Event handler fired when the mouse pointer enters the item button.
|
|
86
|
+
*/
|
|
87
|
+
onMouseEnter?: (e: MouseEvent) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Event handler fired when the mouse pointer leaves the item button.
|
|
90
|
+
*/
|
|
91
|
+
onMouseLeave?: (e: MouseEvent) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Event handler fired when the item button receives focus.
|
|
94
|
+
*/
|
|
95
|
+
onFocus?: (e: FocusEvent) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Event handler fired when the item button loses focus.
|
|
98
|
+
*/
|
|
99
|
+
onBlur?: (e: FocusEvent) => void;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Represents the properties of the SegmentedControl component.
|
|
103
|
+
*
|
|
104
|
+
* The SegmentedControl displays a horizontal set of mutually exclusive button segments,
|
|
105
|
+
* allowing the user to select one option at a time.
|
|
106
|
+
*/
|
|
107
|
+
export interface SegmentedControlProps {
|
|
108
|
+
/**
|
|
109
|
+
* Specifies the collection of items rendered as buttons inside the SegmentedControl.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```vue
|
|
113
|
+
* <SegmentedControl :items="[{ value: 'opt1', text: 'Option 1' }, { value: 'opt2', text: 'Option 2' }]" />
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
items?: Array<SegmentedItemProps>;
|
|
117
|
+
/**
|
|
118
|
+
* Sets the size of the SegmentedControl items. The value is mapped through `kendoThemeMaps.sizeMap`
|
|
119
|
+
* to the corresponding CSS size class.
|
|
120
|
+
*
|
|
121
|
+
* The available options are:
|
|
122
|
+
* - `small`
|
|
123
|
+
* - `medium`
|
|
124
|
+
* - `large`
|
|
125
|
+
* - `null` — Does not set a size className.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```vue
|
|
129
|
+
* <SegmentedControl :size="'large'" :items="items" />
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
size?: ButtonProps['size'];
|
|
133
|
+
/**
|
|
134
|
+
* Specifies the layout mode of the SegmentedControl.
|
|
135
|
+
*
|
|
136
|
+
* - `compact`: Items are sized based on their content (default).
|
|
137
|
+
* - `stretch`: Items stretch to fill the available horizontal space, applying the `k-segmented-control-stretched` CSS class.
|
|
138
|
+
*
|
|
139
|
+
* @default "compact"
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```vue
|
|
143
|
+
* <SegmentedControl :layout-mode="'stretch'" :items="items" />
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
layoutMode?: 'compact' | 'stretch';
|
|
147
|
+
/**
|
|
148
|
+
* The currently selected item value.
|
|
149
|
+
* When provided, the component operates in controlled mode and the `change` event must be used to update this value.
|
|
150
|
+
* The item whose `value` matches this prop receives the `k-selected` CSS class.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```vue
|
|
154
|
+
* <SegmentedControl :value="selectedValue" @change="(val) => selectedValue = val" :items="items" />
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
value?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Sets the initially selected item value when the component is in uncontrolled mode (i.e., `value` is not provided).
|
|
160
|
+
* Once set, subsequent changes to `defaultValue` are ignored.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```vue
|
|
164
|
+
* <SegmentedControl :default-value="'option2'" :items="items" />
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
defaultValue?: string;
|
|
168
|
+
/**
|
|
169
|
+
* A custom template for the item content. When provided, it replaces the default rendering
|
|
170
|
+
* (SVG icon + text span) entirely.
|
|
171
|
+
*
|
|
172
|
+
* Accepts a string (slot name) or a render function. The slot receives `{ props: { item } }`
|
|
173
|
+
* where `item` is the full item configuration object.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```vue
|
|
177
|
+
* <SegmentedControl :items="items" :item-template="'myTemplate'">
|
|
178
|
+
* <template #myTemplate="{ props }">
|
|
179
|
+
* <span>{{ props.item.text }}</span>
|
|
180
|
+
* </template>
|
|
181
|
+
* </SegmentedControl>
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
itemTemplate?: string | ((itemData: SegmentedItemProps) => any);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Represents the internal interaction state of the SegmentedControl component.
|
|
188
|
+
*
|
|
189
|
+
* @hidden
|
|
190
|
+
*/
|
|
191
|
+
export interface SegmentedControlState {
|
|
192
|
+
/**
|
|
193
|
+
* The `value` of the currently selected item in uncontrolled mode.
|
|
194
|
+
*/
|
|
195
|
+
selectedValue?: string;
|
|
196
|
+
/**
|
|
197
|
+
* The `value` of the item currently being hovered over.
|
|
198
|
+
*/
|
|
199
|
+
hoveredValue?: string;
|
|
200
|
+
/**
|
|
201
|
+
* The `value` of the item that currently has keyboard focus.
|
|
202
|
+
*/
|
|
203
|
+
focusedValue?: string;
|
|
204
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
export * from './SegmentedControlTypes';
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { KendoSmartPaste, SmartPasteField } from '@progress/kendo-smartpaste-common';
|
|
9
|
+
import { SmartPasteFormField, SmartPasteClickEvent } from './interfaces';
|
|
10
|
+
import { PropType } from 'vue';
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
declare const SmartPasteButton: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
15
|
+
disabled: {
|
|
16
|
+
type: PropType<boolean>;
|
|
17
|
+
default: any;
|
|
18
|
+
};
|
|
19
|
+
fillMode: {
|
|
20
|
+
type: PropType<"flat" | "link" | "solid" | "outline">;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
rounded: {
|
|
24
|
+
type: PropType<"small" | "medium" | "large" | "full" | "none">;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
size: {
|
|
28
|
+
type: PropType<"small" | "medium" | "large">;
|
|
29
|
+
default: string;
|
|
30
|
+
};
|
|
31
|
+
svgIcon: {
|
|
32
|
+
type: PropType<import('@progress/kendo-vue-common').SVGIcon>;
|
|
33
|
+
default: () => import('@progress/kendo-svg-icons').SVGIcon;
|
|
34
|
+
};
|
|
35
|
+
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "dark" | "light" | "inverse">;
|
|
36
|
+
formFields: PropType<SmartPasteFormField[]>;
|
|
37
|
+
togglable: {
|
|
38
|
+
type: PropType<boolean>;
|
|
39
|
+
default: boolean;
|
|
40
|
+
};
|
|
41
|
+
selected: {
|
|
42
|
+
type: PropType<boolean>;
|
|
43
|
+
default: any;
|
|
44
|
+
};
|
|
45
|
+
icon: PropType<string>;
|
|
46
|
+
iconClass: PropType<string>;
|
|
47
|
+
imageUrl: PropType<string>;
|
|
48
|
+
imageAlt: PropType<string>;
|
|
49
|
+
tabIndex: PropType<number>;
|
|
50
|
+
id: PropType<string>;
|
|
51
|
+
type: {
|
|
52
|
+
type: PropType<string>;
|
|
53
|
+
default: string;
|
|
54
|
+
};
|
|
55
|
+
role: PropType<string>;
|
|
56
|
+
ariaLabel: PropType<string>;
|
|
57
|
+
ariaPressed: PropType<boolean>;
|
|
58
|
+
title: PropType<string>;
|
|
59
|
+
dir: PropType<string>;
|
|
60
|
+
iconSize: PropType<string>;
|
|
61
|
+
}>, {}, {}, {}, {
|
|
62
|
+
getSmartPasteInstance(): KendoSmartPaste | null;
|
|
63
|
+
getButtonElement(): HTMLButtonElement | null;
|
|
64
|
+
extractFormConfig(): SmartPasteFormField[] | SmartPasteField[] | undefined;
|
|
65
|
+
extractClipboard(): Promise<string>;
|
|
66
|
+
populateFormFieldsInternal(fieldValues: Record<string, any>, fields?: SmartPasteFormField[] | SmartPasteField[]): void;
|
|
67
|
+
handleClick(event: Event): Promise<void>;
|
|
68
|
+
}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
69
|
+
click: (event: SmartPasteClickEvent) => true;
|
|
70
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
71
|
+
disabled: {
|
|
72
|
+
type: PropType<boolean>;
|
|
73
|
+
default: any;
|
|
74
|
+
};
|
|
75
|
+
fillMode: {
|
|
76
|
+
type: PropType<"flat" | "link" | "solid" | "outline">;
|
|
77
|
+
default: string;
|
|
78
|
+
};
|
|
79
|
+
rounded: {
|
|
80
|
+
type: PropType<"small" | "medium" | "large" | "full" | "none">;
|
|
81
|
+
default: string;
|
|
82
|
+
};
|
|
83
|
+
size: {
|
|
84
|
+
type: PropType<"small" | "medium" | "large">;
|
|
85
|
+
default: string;
|
|
86
|
+
};
|
|
87
|
+
svgIcon: {
|
|
88
|
+
type: PropType<import('@progress/kendo-vue-common').SVGIcon>;
|
|
89
|
+
default: () => import('@progress/kendo-svg-icons').SVGIcon;
|
|
90
|
+
};
|
|
91
|
+
themeColor: PropType<"base" | "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "dark" | "light" | "inverse">;
|
|
92
|
+
formFields: PropType<SmartPasteFormField[]>;
|
|
93
|
+
togglable: {
|
|
94
|
+
type: PropType<boolean>;
|
|
95
|
+
default: boolean;
|
|
96
|
+
};
|
|
97
|
+
selected: {
|
|
98
|
+
type: PropType<boolean>;
|
|
99
|
+
default: any;
|
|
100
|
+
};
|
|
101
|
+
icon: PropType<string>;
|
|
102
|
+
iconClass: PropType<string>;
|
|
103
|
+
imageUrl: PropType<string>;
|
|
104
|
+
imageAlt: PropType<string>;
|
|
105
|
+
tabIndex: PropType<number>;
|
|
106
|
+
id: PropType<string>;
|
|
107
|
+
type: {
|
|
108
|
+
type: PropType<string>;
|
|
109
|
+
default: string;
|
|
110
|
+
};
|
|
111
|
+
role: PropType<string>;
|
|
112
|
+
ariaLabel: PropType<string>;
|
|
113
|
+
ariaPressed: PropType<boolean>;
|
|
114
|
+
title: PropType<string>;
|
|
115
|
+
dir: PropType<string>;
|
|
116
|
+
iconSize: PropType<string>;
|
|
117
|
+
}>> & Readonly<{
|
|
118
|
+
onClick?: (event: SmartPasteClickEvent) => any;
|
|
119
|
+
}>, {
|
|
120
|
+
type: string;
|
|
121
|
+
size: "small" | "medium" | "large";
|
|
122
|
+
rounded: "small" | "medium" | "large" | "full" | "none";
|
|
123
|
+
selected: boolean;
|
|
124
|
+
disabled: boolean;
|
|
125
|
+
fillMode: "flat" | "link" | "solid" | "outline";
|
|
126
|
+
togglable: boolean;
|
|
127
|
+
svgIcon: import('@progress/kendo-vue-common').SVGIcon;
|
|
128
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
129
|
+
export { SmartPasteButton };
|
|
130
|
+
export type { SmartPasteButtonProps, SmartPasteClickEvent, SmartPasteFormField, SmartPasteButtonHandle } from './interfaces';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("vue"),f=require("@progress/kendo-vue-common"),x=require("@progress/kendo-smartpaste-common"),b=require("../Button.js"),v=require("@progress/kendo-svg-icons"),B=require("../package-metadata.js");function T(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!p.isVNode(e)}const q=[".k-input",".k-picker",".k-checkbox",".k-radio",".k-switch",".k-rating",".k-slider"],M=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},N=(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}}))}},O=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:()=>v.pasteSparkleIcon},themeColor:String,formFields:Array,togglable:{type:Boolean,default:!1},selected:{type:Boolean,default:void 0},icon:String,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(B.packageMetadata),this.smartPasteInstance=null},methods:{getSmartPasteInstance(){return this.getButtonElement()?(this.smartPasteInstance||(this.smartPasteInstance=new x.KendoSmartPaste({getElement:()=>this.getButtonElement(),customInputs:q.map(t=>({identifier:t})),getSmartPasteField:t=>{const r=M(t.element);return r?{...t,field:r}:t},setKendoInputValue:N})),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:y,role:I,ariaLabel:E,ariaPressed:k,title:C,dir:P,iconSize:F}=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:y,role:I,ariaLabel:E,ariaPressed:k,title:C,dir:P,iconSize:F,onClick:this.handleClick};return e?p.createVNode(b.Button,S,T(e)?e:{default:()=>[e]}):p.createVNode(b.Button,S,null)}});exports.SmartPasteButton=O;
|