@progress/kendo-react-layout 9.4.0-develop.8 → 9.4.0
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/NOTICE.txt +40 -51
- package/contextmenu/ContextMenu.js +1 -1
- package/contextmenu/ContextMenu.mjs +10 -9
- package/dist/cdn/js/kendo-react-layout.js +1 -1
- package/index.d.mts +93 -17
- package/index.d.ts +93 -17
- package/menu/components/Menu.js +1 -1
- package/menu/components/Menu.mjs +44 -35
- package/menu/components/MenuItemInternal.js +1 -1
- package/menu/components/MenuItemInternal.mjs +41 -33
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +9 -8
- package/tabstrip/TabStrip.js +1 -1
- package/tabstrip/TabStrip.mjs +110 -78
- package/tabstrip/TabStripNavigation.js +1 -1
- package/tabstrip/TabStripNavigation.mjs +109 -115
package/tabstrip/TabStrip.mjs
CHANGED
|
@@ -5,27 +5,39 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
10
|
-
import { TabStripNavigation as
|
|
11
|
-
import { TabStripContent as
|
|
12
|
-
import { validatePackage as
|
|
13
|
-
import { packageMetadata as
|
|
14
|
-
const
|
|
15
|
-
constructor(
|
|
16
|
-
super(
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
import * as c from "react";
|
|
9
|
+
import r from "prop-types";
|
|
10
|
+
import { TabStripNavigation as m } from "./TabStripNavigation.mjs";
|
|
11
|
+
import { TabStripContent as g } from "./TabStripContent.mjs";
|
|
12
|
+
import { validatePackage as v, shouldShowValidationUI as y, Navigation as k, classNames as x, kendoThemeMaps as I, WatermarkOverlay as P } from "@progress/kendo-react-common";
|
|
13
|
+
import { packageMetadata as u } from "../package-metadata.mjs";
|
|
14
|
+
const p = class p extends c.Component {
|
|
15
|
+
constructor(l) {
|
|
16
|
+
super(l), this.tabStripRef = c.createRef(), this.itemsNavRef = c.createRef(), this.showLicenseWatermark = !1, this.onScroll = () => {
|
|
17
|
+
const i = this.horizontalScroll(), o = this.itemsNavRef.current;
|
|
18
|
+
if (!o)
|
|
19
|
+
return;
|
|
20
|
+
const e = o.scrollLeft, t = o.clientWidth, n = o.scrollWidth, s = o.scrollTop, a = o.scrollHeight, d = o.clientHeight;
|
|
21
|
+
let h = null;
|
|
22
|
+
const S = i ? n > t : a > d, f = this.props.dir === "rtl";
|
|
23
|
+
S ? i ? e + t === n || (f && t - e) === n ? h = "end" : e === 0 || f && -e === 0 ? h = "start" : e > 0 && e + t < n || -e > 0 && t - e < n ? h = "middle" : h = null : a - (s + d) === 0 ? h = "bottom" : s === 0 ? h = "top" : s > 0 && a - (s + d) > 0 ? h = "middle" : h = null : h = null, this.setState({ containerScrollPosition: h });
|
|
24
|
+
}, this.handleResize = () => {
|
|
25
|
+
this.onScroll();
|
|
26
|
+
}, this.onSelect = (i) => {
|
|
27
|
+
this.props.selected !== i && this.props.onSelect && this.props.onSelect({
|
|
28
|
+
selected: i
|
|
19
29
|
});
|
|
20
|
-
}, this.onKeyDown = (
|
|
21
|
-
this.navigation.triggerKeyboardEvent(
|
|
22
|
-
}, this.onKeyboardSelect = (
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
}, this.renderContent = (
|
|
26
|
-
const { selected:
|
|
27
|
-
return
|
|
28
|
-
}, u
|
|
30
|
+
}, this.onKeyDown = (i) => {
|
|
31
|
+
this.navigation && this.navigation.triggerKeyboardEvent(i);
|
|
32
|
+
}, this.onKeyboardSelect = (i) => {
|
|
33
|
+
const o = this.children();
|
|
34
|
+
o && o[i].props.disabled || this.onSelect(i);
|
|
35
|
+
}, this.renderContent = (i) => {
|
|
36
|
+
const { selected: o, children: e, tabContentStyle: t } = i, n = c.Children.count(e);
|
|
37
|
+
return o < n && o > -1 ? /* @__PURE__ */ c.createElement(g, { index: o, ...i, style: t }) : null;
|
|
38
|
+
}, v(u), this.showLicenseWatermark = y(u), this.state = {
|
|
39
|
+
containerScrollPosition: null
|
|
40
|
+
}, this.itemsNavRef = c.createRef();
|
|
29
41
|
}
|
|
30
42
|
get contentPanelId() {
|
|
31
43
|
return this.props.id + "-content-panel-id";
|
|
@@ -35,9 +47,9 @@ const d = class d extends a.Component {
|
|
|
35
47
|
}
|
|
36
48
|
/** @hidden */
|
|
37
49
|
componentDidMount() {
|
|
38
|
-
var
|
|
39
|
-
const
|
|
40
|
-
|
|
50
|
+
var o;
|
|
51
|
+
const l = this.tabStripRef.current, i = l && getComputedStyle(l).direction === "rtl" || !1;
|
|
52
|
+
l && (this.navigation = new k({
|
|
41
53
|
tabIndex: 0,
|
|
42
54
|
root: this.tabStripRef,
|
|
43
55
|
rovingTabIndex: !0,
|
|
@@ -45,106 +57,126 @@ const d = class d extends a.Component {
|
|
|
45
57
|
selectors: [".k-tabstrip .k-tabstrip-item"],
|
|
46
58
|
keyboardEvents: {
|
|
47
59
|
keydown: {
|
|
48
|
-
ArrowLeft: (
|
|
49
|
-
|
|
50
|
-
const s =
|
|
51
|
-
|
|
60
|
+
ArrowLeft: (e, t, n) => {
|
|
61
|
+
n.preventDefault();
|
|
62
|
+
const s = t.elements.indexOf(e), a = s !== 0 ? s - 1 : t.elements.length - 1, d = s !== t.elements.length - 1 ? s + 1 : 0;
|
|
63
|
+
i ? (t.focusNext(e), this.onKeyboardSelect(d)) : (t.focusPrevious(e), this.onKeyboardSelect(a));
|
|
52
64
|
},
|
|
53
|
-
ArrowRight: (
|
|
54
|
-
|
|
55
|
-
const s =
|
|
56
|
-
|
|
65
|
+
ArrowRight: (e, t, n) => {
|
|
66
|
+
n.preventDefault();
|
|
67
|
+
const s = t.elements.indexOf(e), a = s !== 0 ? s - 1 : t.elements.length - 1, d = s !== t.elements.length - 1 ? s + 1 : 0;
|
|
68
|
+
i ? (t.focusPrevious(e), this.onKeyboardSelect(a)) : (t.focusNext(e), this.onKeyboardSelect(d));
|
|
57
69
|
},
|
|
58
|
-
ArrowDown: (
|
|
59
|
-
|
|
60
|
-
const s =
|
|
61
|
-
|
|
70
|
+
ArrowDown: (e, t, n) => {
|
|
71
|
+
n.preventDefault();
|
|
72
|
+
const s = t.elements.indexOf(e), a = s !== t.elements.length - 1 ? s + 1 : 0;
|
|
73
|
+
t.focusNext(e), this.onKeyboardSelect(a);
|
|
62
74
|
},
|
|
63
|
-
ArrowUp: (
|
|
64
|
-
|
|
65
|
-
const s =
|
|
66
|
-
|
|
75
|
+
ArrowUp: (e, t, n) => {
|
|
76
|
+
n.preventDefault();
|
|
77
|
+
const s = t.elements.indexOf(e), a = s !== 0 ? s - 1 : t.elements.length - 1;
|
|
78
|
+
t.focusPrevious(e), this.onKeyboardSelect(a);
|
|
67
79
|
},
|
|
68
|
-
Home: (
|
|
69
|
-
|
|
80
|
+
Home: (e, t, n) => {
|
|
81
|
+
n.preventDefault(), t.focusElement(t.first, e), this.onKeyboardSelect(0);
|
|
70
82
|
},
|
|
71
|
-
End: (
|
|
72
|
-
|
|
83
|
+
End: (e, t, n) => {
|
|
84
|
+
n.preventDefault(), t.focusElement(t.last, e), this.onKeyboardSelect(t.elements.length - 1);
|
|
73
85
|
}
|
|
74
86
|
}
|
|
75
87
|
}
|
|
76
|
-
}), (
|
|
88
|
+
}), (o = this.navigation) == null || o.initializeRovingTab(this.props.selected), this.onScroll(), this.resizeObserver = new ResizeObserver(() => this.onScroll()), this.tabStripRef.current && this.resizeObserver.observe(this.tabStripRef.current));
|
|
77
89
|
}
|
|
78
90
|
/** @hidden */
|
|
79
91
|
componentWillUnmount() {
|
|
80
|
-
var
|
|
81
|
-
(
|
|
92
|
+
var l;
|
|
93
|
+
(l = this.navigation) == null || l.removeFocusListener();
|
|
94
|
+
}
|
|
95
|
+
horizontalScroll() {
|
|
96
|
+
return /top|bottom/.test(this.props.tabPosition || "top");
|
|
82
97
|
}
|
|
83
98
|
/**
|
|
84
99
|
* @hidden
|
|
85
100
|
*/
|
|
86
101
|
render() {
|
|
87
|
-
const
|
|
102
|
+
const l = {
|
|
103
|
+
itemsNavRef: this.itemsNavRef,
|
|
88
104
|
...this.props,
|
|
89
105
|
children: this.children(),
|
|
90
106
|
contentPanelId: this.contentPanelId,
|
|
91
107
|
renderAllContent: this.props.renderAllContent,
|
|
92
108
|
navItemId: this.navItemId,
|
|
93
109
|
onKeyDown: this.onKeyDown,
|
|
94
|
-
onSelect: this.onSelect
|
|
95
|
-
|
|
110
|
+
onSelect: this.onSelect,
|
|
111
|
+
onScroll: this.onScroll,
|
|
112
|
+
containerScrollPosition: this.state.containerScrollPosition,
|
|
113
|
+
scrollButtons: this.props.scrollButtons === "hidden" || this.state.containerScrollPosition === null && this.props.scrollButtons === "auto" ? "hidden" : "visible"
|
|
114
|
+
}, { scrollable: i, scrollButtons: o, size: e, tabPosition: t, tabIndex: n } = l, s = t === "bottom", a = x(
|
|
96
115
|
"k-tabstrip k-pos-relative",
|
|
97
116
|
{
|
|
98
|
-
|
|
99
|
-
"k-tabstrip-
|
|
100
|
-
"k-tabstrip-
|
|
101
|
-
"k-tabstrip-
|
|
102
|
-
"k-tabstrip-
|
|
117
|
+
[`k-tabstrip-${I.sizeMap[e] || e}`]: e,
|
|
118
|
+
"k-tabstrip-left": t === "left",
|
|
119
|
+
"k-tabstrip-right": t === "right",
|
|
120
|
+
"k-tabstrip-bottom": t === "bottom",
|
|
121
|
+
"k-tabstrip-top": t === "top",
|
|
122
|
+
"k-tabstrip-scrollable": i,
|
|
123
|
+
"k-tabstrip-scrollable-start k-tabstrip-scrollable-end": i && o === "visible",
|
|
124
|
+
"k-tabstrip-scrollable-start": i && (o === "auto" || !o) && (this.state.containerScrollPosition === "end" || this.state.containerScrollPosition === "middle"),
|
|
125
|
+
"k-tabstrip-scrollable-end": i && o === "auto" && (this.state.containerScrollPosition === "start" || this.state.containerScrollPosition === "middle")
|
|
103
126
|
},
|
|
104
127
|
this.props.className
|
|
105
128
|
);
|
|
106
|
-
return /* @__PURE__ */
|
|
129
|
+
return /* @__PURE__ */ c.createElement(
|
|
107
130
|
"div",
|
|
108
131
|
{
|
|
109
132
|
id: this.props.id,
|
|
110
133
|
ref: this.tabStripRef,
|
|
111
134
|
dir: this.props.dir,
|
|
112
|
-
className:
|
|
113
|
-
style: this.props.style
|
|
135
|
+
className: a,
|
|
136
|
+
style: this.props.style,
|
|
137
|
+
onScroll: this.onScroll,
|
|
138
|
+
onResize: this.handleResize
|
|
114
139
|
},
|
|
115
|
-
!
|
|
116
|
-
this.renderContent(
|
|
117
|
-
|
|
118
|
-
this.showLicenseWatermark && /* @__PURE__ */
|
|
140
|
+
!s && /* @__PURE__ */ c.createElement(m, { ...l, tabIndex: n }),
|
|
141
|
+
this.renderContent(l),
|
|
142
|
+
s && /* @__PURE__ */ c.createElement(m, { ...l, tabIndex: n }),
|
|
143
|
+
this.showLicenseWatermark && /* @__PURE__ */ c.createElement(P, null)
|
|
119
144
|
);
|
|
120
145
|
}
|
|
121
146
|
children() {
|
|
122
|
-
return
|
|
147
|
+
return c.Children.toArray(this.props.children).filter((l) => l);
|
|
123
148
|
}
|
|
124
149
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
150
|
+
p.propTypes = {
|
|
151
|
+
id: r.string,
|
|
152
|
+
animation: r.bool,
|
|
153
|
+
children: r.node,
|
|
154
|
+
onSelect: r.func,
|
|
155
|
+
selected: r.number,
|
|
156
|
+
style: r.object,
|
|
157
|
+
tabContentStyle: r.object,
|
|
158
|
+
tabPosition: r.string,
|
|
159
|
+
tabAlignment: r.string,
|
|
160
|
+
tabIndex: r.number,
|
|
161
|
+
className: r.string,
|
|
162
|
+
dir: r.string,
|
|
163
|
+
renderAllContent: r.bool,
|
|
164
|
+
size: r.oneOf(["small", "medium", "large", null]),
|
|
165
|
+
scrollButtons: r.oneOf(["auto", "visible", "hidden"]),
|
|
166
|
+
scrollButtonsPosition: r.oneOf(["split", "start", "end", "around", "before", "after"])
|
|
167
|
+
}, p.defaultProps = {
|
|
138
168
|
animation: !0,
|
|
139
169
|
tabPosition: "top",
|
|
140
170
|
tabAlignment: "start",
|
|
141
171
|
keepTabsMounted: !1,
|
|
142
172
|
buttonScrollSpeed: 100,
|
|
143
|
-
scrollButtonsPosition: "around",
|
|
144
173
|
mouseScrollSpeed: 10,
|
|
174
|
+
scrollButtons: "auto",
|
|
175
|
+
scrollButtonsPosition: "split",
|
|
176
|
+
size: "medium",
|
|
145
177
|
renderAllContent: !1
|
|
146
178
|
};
|
|
147
|
-
let
|
|
179
|
+
let b = p;
|
|
148
180
|
export {
|
|
149
|
-
|
|
181
|
+
b as TabStrip
|
|
150
182
|
};
|
|
@@ -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 L=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react"),n=require("prop-types"),E=require("./TabStripNavigationItem.js"),w=require("@progress/kendo-react-common"),B=require("@progress/kendo-react-buttons"),m=require("@progress/kendo-svg-icons"),x=require("@progress/kendo-react-intl"),b=require("./messages/index.js");function y(d){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>d[e]})}}return t.default=d,Object.freeze(t)}const h=y(L),M=d=>Array.apply(null,Array(d)),v="smooth",f="prev",S="next",I=class I extends h.Component{constructor(){super(...arguments),this.itemsNavRef=this.props.itemsNavRef||h.createRef(),this.onScroll=()=>{var t,e;(e=(t=this.props).onScroll)==null||e.call(t)},this.isRtl=()=>this.props.dir==="rtl",this.arrowClickPrev=t=>{this.handleArrowClick(f,t)},this.arrowClickNext=t=>{this.handleArrowClick(S,t)},this.handleArrowClick=(t,e)=>{this.setNewScrollPosition(t,e)},this.setNewScrollPosition=(t,e)=>{const o=this.itemsNavRef.current;if(!o)return;const r=this.horizontalScroll(),l=r?o.scrollWidth-o.offsetWidth:o.scrollHeight-o.offsetHeight,i=(e.type==="click"?this.props.buttonScrollSpeed:this.props.mouseScrollSpeed)||0;let s=r?o.scrollLeft:o.scrollTop;this.isRtl()&&this.horizontalScroll()?(t===f&&s<0&&(s+=i),t===S&&s<l&&(s-=i),s=Math.min(0,Math.min(l,s))):(t===f&&s>0&&(s-=i),t===S&&s<l&&(s+=i),s=Math.max(0,Math.min(l,s)));const c=e.type==="click"?v:void 0;r?o.scrollTo({left:s,behavior:c}):o.scrollTo({top:s,behavior:c})},this.renderArrow=t=>{const e=this.horizontalScroll(),o=x.provideLocalizationService(this),r={prev:{arrowTab:"k-tabstrip-prev",fontIcon:e?this.isRtl()?"caret-alt-right":"caret-alt-left":"caret-alt-up",svgIcon:e?this.isRtl()?m.caretAltRightIcon:m.caretAltLeftIcon:m.caretAltUpIcon,title:o.toLanguageString(b.prevArrowTitle,b.messages[b.prevArrowTitle])},next:{arrowTab:"k-tabstrip-next",fontIcon:e?this.isRtl()?"caret-alt-left":"caret-alt-right":"caret-alt-down",svgIcon:e?this.isRtl()?m.caretAltLeftIcon:m.caretAltRightIcon:m.caretAltDownIcon,title:o.toLanguageString(b.nextArrowTitle,b.messages[b.nextArrowTitle])}},l=(t===f?this.props.prevButton:this.props.nextButton)||B.Button,i=t===f?this.arrowClickPrev:this.arrowClickNext,s=this.props.containerScrollPosition===null||t===f&&(this.props.containerScrollPosition==="start"||this.props.containerScrollPosition==="top")||t===S&&(this.props.containerScrollPosition==="end"||this.props.containerScrollPosition==="bottom");return h.createElement(l,{disabled:s,className:w.classNames(`${r[t].arrowTab}`),onClick:i,icon:r[t].fontIcon,svgIcon:r[t].svgIcon,size:this.props.size,tabIndex:-1,fillMode:"flat",title:r[t].title})}}componentDidMount(){this.props.scrollable&&this.scrollToSelected()}componentDidUpdate(t){const{scrollable:e,selected:o}=this.props;e&&t.selected!==o&&this.scrollToSelected()}render(){const{selected:t,tabPosition:e,tabAlignment:o,children:r,onSelect:l,onKeyDown:i,navItemId:s,contentPanelId:c,renderAllContent:a,scrollable:R,scrollButtons:g,scrollButtonsPosition:p}=this.props,N=h.Children.count(r),A=h.Children.toArray(r);let T;r&&(T=M(N).map((D,u,O)=>{const z={active:t===u,disabled:A[u].props.disabled,index:u,title:A[u].props.title,first:u===0,last:u===O.length-1,contentPanelId:c,renderAllContent:a,id:s,onSelect:l,onScroll:this.onScroll};return h.createElement(E.TabStripNavigationItem,{key:u,...z})}));const C=w.classNames("k-tabstrip-items-wrapper k-tabstrip-items-wrapper-scroll",{"k-hstack":e==="top"||e==="bottom","k-vstack":e==="left"||e==="right"}),P=w.classNames("k-tabstrip-items k-tabstrip-items-scroll k-reset",`k-tabstrip-items-${o}`);return h.createElement("div",{className:C},R?h.createElement(h.Fragment,null,g!=="hidden"&&p&&["split","start","around","before"].includes(p)&&this.renderArrow(f),g!=="hidden"&&(p==="start"||p==="before")&&this.renderArrow(S),h.createElement("ul",{ref:this.itemsNavRef,className:P,role:"tablist",tabIndex:this.props.tabIndex,onKeyDown:i,onScroll:this.onScroll,"aria-orientation":e==="left"||e==="right"?"vertical":void 0},T),g!=="hidden"&&(p==="end"||p==="after")&&this.renderArrow(f),g!=="hidden"&&p&&["split","end","around","after"].includes(p)&&this.renderArrow(S)):h.createElement("ul",{className:P,role:"tablist",tabIndex:this.props.tabIndex,onKeyDown:i},T))}scrollToSelected(){const t=this.itemsNavRef.current,e=t&&t.children[this.props.selected||0];if(e instanceof HTMLElement&&t instanceof HTMLElement){const o=this.horizontalScroll(),r=o?t.offsetWidth:t.offsetHeight,l=o?e.offsetWidth:e.offsetHeight,i=o?"left":"top";let s=o?t.scrollLeft:t.scrollTop,c=0;if(this.isRtl()){const a=e.offsetLeft;s=s*-1,a<0?(c=a-l+t.offsetLeft,t.scrollTo({[i]:c,behavior:v})):a+l>r-s&&(c=s+a-l,t.scrollTo({[i]:c,behavior:v}))}else{const a=o?e.offsetLeft-t.offsetLeft:e.offsetTop-t.offsetTop;s+r<a+l?(c=a+l-r,t.scrollTo({[i]:c,behavior:v})):s>a&&(c=a,t.scrollTo({[i]:c,behavior:v}))}}}horizontalScroll(){return/top|bottom/.test(this.props.tabPosition||"top")}};I.propTypes={children:n.oneOfType([n.element,n.arrayOf(n.element)]),onSelect:n.func,onKeyDown:n.func,onScroll:n.func,selected:n.number,tabIndex:n.number,scrollable:n.bool,size:n.oneOf(["small","medium","large"]),scrollButtons:n.oneOf(["auto","visible","hidden"]),scrollButtonsPosition:n.oneOf(["split","start","end","around","before","after"]),containerScrollPosition:n.oneOf(["start","end","top","bottom","middle",null])};let k=I;exports.TabStripNavigation=k;
|
|
@@ -5,77 +5,63 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
10
|
-
import { TabStripNavigationItem as
|
|
11
|
-
import { classNames as
|
|
12
|
-
import { Button as
|
|
13
|
-
import { caretAltRightIcon as k, caretAltLeftIcon as
|
|
8
|
+
import * as h from "react";
|
|
9
|
+
import n from "prop-types";
|
|
10
|
+
import { TabStripNavigationItem as x } from "./TabStripNavigationItem.mjs";
|
|
11
|
+
import { classNames as v } from "@progress/kendo-react-common";
|
|
12
|
+
import { Button as M } from "@progress/kendo-react-buttons";
|
|
13
|
+
import { caretAltRightIcon as k, caretAltLeftIcon as I, caretAltUpIcon as D, caretAltDownIcon as H } from "@progress/kendo-svg-icons";
|
|
14
14
|
import { provideLocalizationService as y } from "@progress/kendo-react-intl";
|
|
15
|
-
import { prevArrowTitle as
|
|
16
|
-
const
|
|
17
|
-
constructor(
|
|
18
|
-
super(
|
|
19
|
-
t
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.handleArrowClick(d, t);
|
|
15
|
+
import { prevArrowTitle as A, messages as P, nextArrowTitle as R } from "./messages/index.mjs";
|
|
16
|
+
const W = (z) => Array.apply(null, Array(z)), b = "smooth", f = "prev", m = "next", w = class w extends h.Component {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments), this.itemsNavRef = this.props.itemsNavRef || h.createRef(), this.onScroll = () => {
|
|
19
|
+
var t, o;
|
|
20
|
+
(o = (t = this.props).onScroll) == null || o.call(t);
|
|
21
|
+
}, this.isRtl = () => this.props.dir === "rtl", this.arrowClickPrev = (t) => {
|
|
22
|
+
this.handleArrowClick(f, t);
|
|
24
23
|
}, this.arrowClickNext = (t) => {
|
|
25
|
-
this.handleArrowClick(
|
|
26
|
-
}, this.handleArrowClick = (t,
|
|
27
|
-
this.setNewScrollPosition(t,
|
|
28
|
-
}, this.setNewScrollPosition = (t,
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
24
|
+
this.handleArrowClick(m, t);
|
|
25
|
+
}, this.handleArrowClick = (t, o) => {
|
|
26
|
+
this.setNewScrollPosition(t, o);
|
|
27
|
+
}, this.setNewScrollPosition = (t, o) => {
|
|
28
|
+
const s = this.itemsNavRef.current;
|
|
29
|
+
if (!s)
|
|
31
30
|
return;
|
|
32
|
-
const
|
|
33
|
-
let
|
|
34
|
-
this.isRtl() && this.horizontalScroll() ? (t ===
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
disabledPrev: h,
|
|
40
|
-
disabledNext: S
|
|
41
|
-
}), e.scrollTo({ left: o, behavior: v });
|
|
42
|
-
} else
|
|
43
|
-
this.setState({
|
|
44
|
-
disabledPrev: h,
|
|
45
|
-
disabledNext: Math.round(i) <= e.clientHeight || Math.floor(i) <= e.clientHeight
|
|
46
|
-
}), e.scrollTo({ top: o, behavior: v });
|
|
47
|
-
}, this.renderArrow = (t, r) => {
|
|
48
|
-
const e = this.horizontalScroll(), c = y(this), n = {
|
|
31
|
+
const r = this.horizontalScroll(), l = r ? s.scrollWidth - s.offsetWidth : s.scrollHeight - s.offsetHeight, i = (o.type === "click" ? this.props.buttonScrollSpeed : this.props.mouseScrollSpeed) || 0;
|
|
32
|
+
let e = r ? s.scrollLeft : s.scrollTop;
|
|
33
|
+
this.isRtl() && this.horizontalScroll() ? (t === f && e < 0 && (e += i), t === m && e < l && (e -= i), e = Math.min(0, Math.min(l, e))) : (t === f && e > 0 && (e -= i), t === m && e < l && (e += i), e = Math.max(0, Math.min(l, e)));
|
|
34
|
+
const c = o.type === "click" ? b : void 0;
|
|
35
|
+
r ? s.scrollTo({ left: e, behavior: c }) : s.scrollTo({ top: e, behavior: c });
|
|
36
|
+
}, this.renderArrow = (t) => {
|
|
37
|
+
const o = this.horizontalScroll(), s = y(this), r = {
|
|
49
38
|
prev: {
|
|
50
39
|
arrowTab: "k-tabstrip-prev",
|
|
51
|
-
fontIcon:
|
|
52
|
-
svgIcon:
|
|
53
|
-
title:
|
|
40
|
+
fontIcon: o ? this.isRtl() ? "caret-alt-right" : "caret-alt-left" : "caret-alt-up",
|
|
41
|
+
svgIcon: o ? this.isRtl() ? k : I : D,
|
|
42
|
+
title: s.toLanguageString(A, P[A])
|
|
54
43
|
},
|
|
55
44
|
next: {
|
|
56
45
|
arrowTab: "k-tabstrip-next",
|
|
57
|
-
fontIcon:
|
|
58
|
-
svgIcon:
|
|
59
|
-
title:
|
|
46
|
+
fontIcon: o ? this.isRtl() ? "caret-alt-left" : "caret-alt-right" : "caret-alt-down",
|
|
47
|
+
svgIcon: o ? this.isRtl() ? I : k : H,
|
|
48
|
+
title: s.toLanguageString(R, P[R])
|
|
60
49
|
}
|
|
61
|
-
}, l = (t ===
|
|
62
|
-
return /* @__PURE__ */
|
|
50
|
+
}, l = (t === f ? this.props.prevButton : this.props.nextButton) || M, i = t === f ? this.arrowClickPrev : this.arrowClickNext, e = this.props.containerScrollPosition === null || t === f && (this.props.containerScrollPosition === "start" || this.props.containerScrollPosition === "top") || t === m && (this.props.containerScrollPosition === "end" || this.props.containerScrollPosition === "bottom");
|
|
51
|
+
return /* @__PURE__ */ h.createElement(
|
|
63
52
|
l,
|
|
64
53
|
{
|
|
65
|
-
disabled:
|
|
66
|
-
className: `${
|
|
67
|
-
onClick:
|
|
68
|
-
icon:
|
|
69
|
-
svgIcon:
|
|
70
|
-
|
|
54
|
+
disabled: e,
|
|
55
|
+
className: v(`${r[t].arrowTab}`),
|
|
56
|
+
onClick: i,
|
|
57
|
+
icon: r[t].fontIcon,
|
|
58
|
+
svgIcon: r[t].svgIcon,
|
|
59
|
+
size: this.props.size,
|
|
71
60
|
tabIndex: -1,
|
|
72
61
|
fillMode: "flat",
|
|
73
|
-
title:
|
|
62
|
+
title: r[t].title
|
|
74
63
|
}
|
|
75
64
|
);
|
|
76
|
-
}, this.state = {
|
|
77
|
-
disabledPrev: this.props.selected === 0,
|
|
78
|
-
disabledNext: this.props.selected === a.Children.count(this.props.children) - 1
|
|
79
65
|
};
|
|
80
66
|
}
|
|
81
67
|
/**
|
|
@@ -87,75 +73,77 @@ const B = (w) => Array.apply(null, Array(w)), O = (w) => w.preventDefault(), u =
|
|
|
87
73
|
/**
|
|
88
74
|
* @hidden
|
|
89
75
|
*/
|
|
90
|
-
componentDidUpdate(
|
|
91
|
-
const { scrollable:
|
|
92
|
-
|
|
93
|
-
disabledPrev: r === 0,
|
|
94
|
-
disabledNext: r === a.Children.count(this.props.children) - 1
|
|
95
|
-
}));
|
|
76
|
+
componentDidUpdate(t) {
|
|
77
|
+
const { scrollable: o, selected: s } = this.props;
|
|
78
|
+
o && t.selected !== s && this.scrollToSelected();
|
|
96
79
|
}
|
|
97
80
|
/**
|
|
98
81
|
* @hidden
|
|
99
82
|
*/
|
|
100
83
|
render() {
|
|
101
84
|
const {
|
|
102
|
-
selected:
|
|
103
|
-
tabPosition:
|
|
104
|
-
tabAlignment:
|
|
105
|
-
children:
|
|
106
|
-
onSelect:
|
|
107
|
-
onKeyDown:
|
|
108
|
-
navItemId:
|
|
109
|
-
contentPanelId:
|
|
110
|
-
renderAllContent:
|
|
111
|
-
scrollable:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
85
|
+
selected: t,
|
|
86
|
+
tabPosition: o,
|
|
87
|
+
tabAlignment: s,
|
|
88
|
+
children: r,
|
|
89
|
+
onSelect: l,
|
|
90
|
+
onKeyDown: i,
|
|
91
|
+
navItemId: e,
|
|
92
|
+
contentPanelId: c,
|
|
93
|
+
renderAllContent: a,
|
|
94
|
+
scrollable: L,
|
|
95
|
+
scrollButtons: u,
|
|
96
|
+
scrollButtonsPosition: p
|
|
97
|
+
} = this.props, E = h.Children.count(r), g = h.Children.toArray(r);
|
|
98
|
+
let S;
|
|
99
|
+
r && (S = W(E).map((U, d, B) => {
|
|
100
|
+
const O = {
|
|
101
|
+
active: t === d,
|
|
102
|
+
disabled: g[d].props.disabled,
|
|
103
|
+
index: d,
|
|
104
|
+
title: g[d].props.title,
|
|
105
|
+
first: d === 0,
|
|
106
|
+
last: d === B.length - 1,
|
|
107
|
+
contentPanelId: c,
|
|
108
|
+
renderAllContent: a,
|
|
109
|
+
id: e,
|
|
110
|
+
onSelect: l,
|
|
111
|
+
onScroll: this.onScroll
|
|
127
112
|
};
|
|
128
|
-
return /* @__PURE__ */
|
|
113
|
+
return /* @__PURE__ */ h.createElement(x, { key: d, ...O });
|
|
129
114
|
}));
|
|
130
|
-
const
|
|
131
|
-
"k-hstack":
|
|
132
|
-
"k-vstack":
|
|
133
|
-
}),
|
|
134
|
-
|
|
115
|
+
const N = v("k-tabstrip-items-wrapper k-tabstrip-items-wrapper-scroll", {
|
|
116
|
+
"k-hstack": o === "top" || o === "bottom",
|
|
117
|
+
"k-vstack": o === "left" || o === "right"
|
|
118
|
+
}), T = v(
|
|
119
|
+
"k-tabstrip-items k-tabstrip-items-scroll k-reset",
|
|
120
|
+
`k-tabstrip-items-${s}`
|
|
121
|
+
);
|
|
122
|
+
return /* @__PURE__ */ h.createElement("div", { className: N }, L ? /* @__PURE__ */ h.createElement(h.Fragment, null, u !== "hidden" && p && ["split", "start", "around", "before"].includes(p) && this.renderArrow(f), u !== "hidden" && (p === "start" || p === "before") && this.renderArrow(m), /* @__PURE__ */ h.createElement(
|
|
135
123
|
"ul",
|
|
136
124
|
{
|
|
137
125
|
ref: this.itemsNavRef,
|
|
138
|
-
className:
|
|
126
|
+
className: T,
|
|
139
127
|
role: "tablist",
|
|
140
128
|
tabIndex: this.props.tabIndex,
|
|
141
|
-
onKeyDown:
|
|
142
|
-
|
|
143
|
-
"aria-orientation":
|
|
129
|
+
onKeyDown: i,
|
|
130
|
+
onScroll: this.onScroll,
|
|
131
|
+
"aria-orientation": o === "left" || o === "right" ? "vertical" : void 0
|
|
144
132
|
},
|
|
145
|
-
|
|
146
|
-
),
|
|
133
|
+
S
|
|
134
|
+
), u !== "hidden" && (p === "end" || p === "after") && this.renderArrow(f), u !== "hidden" && p && ["split", "end", "around", "after"].includes(p) && this.renderArrow(m)) : /* @__PURE__ */ h.createElement("ul", { className: T, role: "tablist", tabIndex: this.props.tabIndex, onKeyDown: i }, S));
|
|
147
135
|
}
|
|
148
136
|
scrollToSelected() {
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
151
|
-
const
|
|
152
|
-
let
|
|
137
|
+
const t = this.itemsNavRef.current, o = t && t.children[this.props.selected || 0];
|
|
138
|
+
if (o instanceof HTMLElement && t instanceof HTMLElement) {
|
|
139
|
+
const s = this.horizontalScroll(), r = s ? t.offsetWidth : t.offsetHeight, l = s ? o.offsetWidth : o.offsetHeight, i = s ? "left" : "top";
|
|
140
|
+
let e = s ? t.scrollLeft : t.scrollTop, c = 0;
|
|
153
141
|
if (this.isRtl()) {
|
|
154
|
-
const
|
|
155
|
-
|
|
142
|
+
const a = o.offsetLeft;
|
|
143
|
+
e = e * -1, a < 0 ? (c = a - l + t.offsetLeft, t.scrollTo({ [i]: c, behavior: b })) : a + l > r - e && (c = e + a - l, t.scrollTo({ [i]: c, behavior: b }));
|
|
156
144
|
} else {
|
|
157
|
-
const
|
|
158
|
-
|
|
145
|
+
const a = s ? o.offsetLeft - t.offsetLeft : o.offsetTop - t.offsetTop;
|
|
146
|
+
e + r < a + l ? (c = a + l - r, t.scrollTo({ [i]: c, behavior: b })) : e > a && (c = a, t.scrollTo({ [i]: c, behavior: b }));
|
|
159
147
|
}
|
|
160
148
|
}
|
|
161
149
|
}
|
|
@@ -163,14 +151,20 @@ const B = (w) => Array.apply(null, Array(w)), O = (w) => w.preventDefault(), u =
|
|
|
163
151
|
return /top|bottom/.test(this.props.tabPosition || "top");
|
|
164
152
|
}
|
|
165
153
|
};
|
|
166
|
-
|
|
167
|
-
children:
|
|
168
|
-
onSelect:
|
|
169
|
-
onKeyDown:
|
|
170
|
-
|
|
171
|
-
|
|
154
|
+
w.propTypes = {
|
|
155
|
+
children: n.oneOfType([n.element, n.arrayOf(n.element)]),
|
|
156
|
+
onSelect: n.func,
|
|
157
|
+
onKeyDown: n.func,
|
|
158
|
+
onScroll: n.func,
|
|
159
|
+
selected: n.number,
|
|
160
|
+
tabIndex: n.number,
|
|
161
|
+
scrollable: n.bool,
|
|
162
|
+
size: n.oneOf(["small", "medium", "large"]),
|
|
163
|
+
scrollButtons: n.oneOf(["auto", "visible", "hidden"]),
|
|
164
|
+
scrollButtonsPosition: n.oneOf(["split", "start", "end", "around", "before", "after"]),
|
|
165
|
+
containerScrollPosition: n.oneOf(["start", "end", "top", "bottom", "middle", null])
|
|
172
166
|
};
|
|
173
|
-
let
|
|
167
|
+
let C = w;
|
|
174
168
|
export {
|
|
175
|
-
|
|
169
|
+
C as TabStripNavigation
|
|
176
170
|
};
|