@progress/kendo-react-layout 13.4.0-develop.1 → 13.4.0-develop.3

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.
@@ -5,233 +5,218 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as d from "react";
9
- import a from "prop-types";
10
- import { getScrollbarWidth as f, canUseDOM as y, classNames as m, Draggable as x } from "@progress/kendo-react-common";
11
- import { ResizeHandlers as E } from "./ResizeHandlers.mjs";
12
- const g = 200, p = class p extends d.Component {
13
- constructor() {
14
- super(...arguments), this.state = {
15
- rtl: !1,
16
- visibleHint: !1
17
- }, this.oldSize = {}, this.draggable = null, this.dragging = !1, this.resizing = !1, this.element = null, this.hintElement = null, this.ignoreDrag = !1, this.pressOffset = { x: 0, y: 0 }, this.pressXY = { x: 0, y: 0 }, this.currentTranslate = { x: 0, y: 0 }, this.preventDataOps = void 0, this.handleResize = (t, e) => {
18
- if (e.end) {
19
- this.handleRelease();
8
+ import * as n from "react";
9
+ import o from "prop-types";
10
+ import { getScrollbarWidth as G, canUseDOM as J, classNames as Y, Draggable as Q } from "@progress/kendo-react-common";
11
+ import { ResizeHandlers as Z } from "./ResizeHandlers.mjs";
12
+ const O = 200, T = {
13
+ resizable: !0,
14
+ reorderable: !0
15
+ }, N = (t) => {
16
+ var B, X;
17
+ const b = (B = t.reorderable) != null ? B : T.reorderable, H = (X = t.resizable) != null ? X : T.resizable, s = n.useRef(null), c = n.useRef(null), k = n.useRef(null), v = n.useRef({}), E = n.useRef(!1), D = n.useRef(!1), z = n.useRef(!1), $ = n.useRef({ x: 0, y: 0 }), w = n.useRef({ x: 0, y: 0 }), u = n.useRef({ x: 0, y: 0 }), P = n.useRef(void 0), x = n.useRef(t), [R, F] = n.useState(!1), [q, I] = n.useState(!1), d = n.useCallback(() => k.current ? k.current.element : void 0, []), S = n.useCallback(() => {
18
+ if (s.current && c.current) {
19
+ const e = s.current.getBoundingClientRect();
20
+ c.current.style.top = e.top + "px", c.current.style.left = e.left + "px", c.current.style.height = s.current.offsetHeight + "px", c.current.style.width = s.current.offsetWidth + "px";
21
+ }
22
+ }, []), A = n.useCallback(() => {
23
+ S();
24
+ }, [S]), p = n.useCallback(() => {
25
+ setTimeout(() => {
26
+ S();
27
+ }, 100);
28
+ }, [S]), U = n.useCallback(() => {
29
+ const e = d();
30
+ if (!e || !c.current)
31
+ return;
32
+ const r = e.getBoundingClientRect(), i = r.top + u.current.y, a = r.left + u.current.x;
33
+ c.current.style.top = `${i}px`, c.current.style.left = `${a}px`, c.current.style.display = "block";
34
+ }, [d]), L = n.useCallback(() => {
35
+ E.current = D.current = !1, u.current = { x: 0, y: 0 }, s.current && c.current && (s.current.style.zIndex = "1", c.current.classList.remove("k-layout-item-hint-resize"), I(!1));
36
+ const e = d();
37
+ e && (e.style.transform = "translate(0px, 0px)", e.style.transition = `transform ${O}ms cubic-bezier(0.2, 0, 0, 1) 0s`, e.style.marginRight = "0px", e.style.marginLeft = "0px", e.style.height = "100%", e.classList.remove("k-cursor-grabbing"), b && e.classList.add("k-cursor-move")), t.onRelease();
38
+ }, [t, b, d]), W = n.useCallback(
39
+ (e, r) => {
40
+ if (r.end) {
41
+ L();
20
42
  return;
21
43
  }
22
- if (!this.element || !this.hintElement)
44
+ if (!s.current || !c.current)
23
45
  return;
24
- const n = t.clientX, l = t.clientY;
25
- this.resizing = !0;
26
- const r = (e.direction !== "ns" ? n - this.pressXY.x : 0) * (this.state.rtl ? -1 : 1), s = e.direction !== "ew" ? l - this.pressXY.y : 0;
27
- if (this.dragElement && (this.state.rtl ? this.dragElement.style.marginLeft = -r + "px" : this.dragElement.style.marginRight = -r + "px", this.dragElement.style.height = `calc(100% + ${s}px)`), this.hintElement.classList.add("k-layout-item-hint-resize"), this.preventDataOps)
46
+ const i = e.clientX, a = e.clientY;
47
+ D.current = !0;
48
+ const f = (r.direction !== "ns" ? i - w.current.x : 0) * (R ? -1 : 1), l = r.direction !== "ew" ? a - w.current.y : 0, h = d();
49
+ if (h && (R ? h.style.marginLeft = -f + "px" : h.style.marginRight = -f + "px", h.style.height = `calc(100% + ${l}px)`), c.current.classList.add("k-layout-item-hint-resize"), P.current)
28
50
  return;
29
- let i = 0, o = 0;
30
- const h = this.element.getBoundingClientRect();
31
- r > h.width / this.props.defaultPosition.colSpan / 3 && (i = 1), r < -h.width / this.props.defaultPosition.colSpan / 1.25 && (i = -1), s > h.height / this.props.defaultPosition.rowSpan / 3 && (o = 1), s < -h.height / this.props.defaultPosition.rowSpan / 1.25 && (o = -1), (i !== 0 || o !== 0) && this.props.update(this.props.index, 0, 0, o, i);
32
- }, this.handlePress = (t) => {
33
- if (!this.dragElement)
51
+ let g = 0, y = 0;
52
+ const C = s.current.getBoundingClientRect();
53
+ f > C.width / t.defaultPosition.colSpan / 3 && (g = 1), f < -C.width / t.defaultPosition.colSpan / 1.25 && (g = -1), l > C.height / t.defaultPosition.rowSpan / 3 && (y = 1), l < -C.height / t.defaultPosition.rowSpan / 1.25 && (y = -1), (g !== 0 || y !== 0) && t.update(t.index, 0, 0, y, g);
54
+ },
55
+ [R, t, L, d]
56
+ ), M = n.useCallback(
57
+ (e) => {
58
+ var a;
59
+ const r = d();
60
+ if (!r)
34
61
  return;
35
- if (this.pressXY = {
36
- x: t.event.clientX,
37
- y: t.event.clientY
38
- }, this.ignoreDrag = !1, this.props.ignoreDrag && this.props.ignoreDrag(t.event.originalEvent)) {
39
- this.ignoreDrag = !0;
62
+ if (w.current = {
63
+ x: e.event.clientX,
64
+ y: e.event.clientY
65
+ }, z.current = !1, (a = t.ignoreDrag) != null && a.call(t, e.event.originalEvent)) {
66
+ z.current = !0;
40
67
  return;
41
68
  }
42
- this.element && (this.element.style.zIndex = "10", this.setState({ visibleHint: !0 })), this.dragElement.classList.remove("k-cursor-move"), this.dragElement.classList.add("k-cursor-grabbing");
43
- const e = this.dragElement.getBoundingClientRect();
44
- this.pressOffset = {
45
- x: t.event.clientX - e.x,
46
- y: t.event.clientY - e.y
47
- }, this.props.onPress();
48
- }, this.handleDrag = (t) => {
49
- var i;
50
- if (this.ignoreDrag)
51
- return;
52
- const e = this.dragElement;
53
- if (t.event.originalEvent.defaultPrevented || !e)
69
+ s.current && (s.current.style.zIndex = "10", I(!0)), r.classList.remove("k-cursor-move"), r.classList.add("k-cursor-grabbing");
70
+ const i = r.getBoundingClientRect();
71
+ $.current = {
72
+ x: e.event.clientX - i.x,
73
+ y: e.event.clientY - i.y
74
+ }, t.onPress();
75
+ },
76
+ [t, d]
77
+ ), j = n.useCallback(
78
+ (e) => {
79
+ var h;
80
+ if (z.current)
54
81
  return;
55
- this.dragging = !0, t.event.originalEvent.preventDefault();
56
- const n = e.getBoundingClientRect();
57
- if (this.currentTranslate = {
58
- x: t.event.clientX - n.x - this.pressOffset.x + this.currentTranslate.x,
59
- y: t.event.clientY - n.y - this.pressOffset.y + this.currentTranslate.y
60
- }, e.style.transform = `translate(${this.currentTranslate.x}px, ${this.currentTranslate.y}px)`, e.style.transition = "transform 0s", this.preventDataOps)
82
+ const r = d();
83
+ if (e.event.originalEvent.defaultPrevented || !r)
61
84
  return;
62
- let l = 0, r = 0;
63
- this.currentTranslate.y > 0.7 * n.height / this.props.defaultPosition.rowSpan && (r = 1), this.currentTranslate.y < 0.7 * -n.height / this.props.defaultPosition.rowSpan && (r = -1), this.currentTranslate.x > 0.7 * n.width / this.props.defaultPosition.colSpan && (l = 1), this.currentTranslate.x < 0.7 * -n.width / this.props.defaultPosition.colSpan && (l = -1), this.props.update(this.props.index, r, this.state.rtl ? -l : l, 0, 0);
64
- const s = (i = this.element) == null ? void 0 : i.closest(".k-tilelayout");
65
- if (s && this.hintElement) {
66
- const o = s.getBoundingClientRect(), h = f() || 50;
67
- t.event.clientX < o.left - h || t.event.clientX > o.right - h || t.event.clientY < o.top || t.event.clientY > o.bottom ? this.hintElement.style.display = "none" : this.hintElement.style.display = "block";
68
- }
69
- }, this.handleRelease = () => {
70
- this.dragging = this.resizing = !1, this.currentTranslate = { x: 0, y: 0 }, this.element && this.hintElement && (this.element.style.zIndex = "1", this.hintElement.classList.remove("k-layout-item-hint-resize"), this.setState({ visibleHint: !1 }));
71
- const t = this.dragElement;
72
- t && (t.style.transform = "translate(0px, 0px)", t.style.transition = `transform ${g}ms cubic-bezier(0.2, 0, 0, 1) 0s`, t.style.marginRight = "0px", t.style.marginLeft = "0px", t.style.height = "100%", t.classList.remove("k-cursor-grabbing"), this.reorderable && t.classList.add("k-cursor-move")), this.props.onRelease();
73
- }, this.handleMouseDown = () => {
74
- this.setInitialHintPosition();
75
- }, this.handleMouseUp = () => {
76
- setTimeout(() => {
77
- this.setInitialHintPosition();
78
- }, 100);
79
- }, this.calcNewHintPosition = () => {
80
- if (!this.dragElement || !this.hintElement)
85
+ E.current = !0, e.event.originalEvent.preventDefault();
86
+ const i = r.getBoundingClientRect();
87
+ if (u.current = {
88
+ x: e.event.clientX - i.x - $.current.x + u.current.x,
89
+ y: e.event.clientY - i.y - $.current.y + u.current.y
90
+ }, r.style.transform = `translate(${u.current.x}px, ${u.current.y}px)`, r.style.transition = "transform 0s", P.current)
81
91
  return;
82
- const t = this.dragElement.getBoundingClientRect(), e = t.top + this.currentTranslate.y, n = t.left + this.currentTranslate.x;
83
- this.hintElement.style.top = `${e}px`, this.hintElement.style.left = `${n}px`, this.hintElement.style.display = "block";
84
- };
85
- }
86
- get reorderable() {
87
- return this.props.reorderable !== void 0 ? this.props.reorderable : p.defaultProps.reorderable;
88
- }
89
- get dragElement() {
90
- return this.draggable ? this.draggable.element : void 0;
91
- }
92
- componentDidMount() {
93
- this.element && (getComputedStyle(this.element).direction === "rtl" && this.setState({
94
- rtl: !0
95
- }), this.hintElement && (this.hintElement.style.height = this.element.offsetHeight + "px", this.hintElement.style.width = this.element.offsetWidth + "px"));
96
- }
97
- render() {
98
- y && clearTimeout && typeof clearTimeout == "function" && (clearTimeout(this.preventDataOps), this.preventDataOps = window.setTimeout(() => {
99
- this.preventDataOps = void 0;
100
- }, 200));
101
- const t = this.props.defaultPosition, e = this.props.resizable !== void 0 ? this.props.resizable : p.defaultProps.resizable, n = {
102
- gridColumnStart: t.col,
103
- gridColumnEnd: `span ${t.colSpan}`,
104
- gridRowStart: t.row,
105
- gridRowEnd: `span ${t.rowSpan}`,
106
- outline: "none",
107
- order: t.order,
108
- display: "block",
109
- ...this.props.hintStyle
110
- }, l = {
111
- gridColumnStart: t.col,
112
- gridColumnEnd: `span ${t.colSpan}`,
113
- gridRowStart: t.row,
114
- gridRowEnd: `span ${t.rowSpan}`,
115
- order: t.order
116
- }, r = /* @__PURE__ */ d.createElement(
117
- "div",
118
- {
119
- ref: (s) => {
120
- this.draggable = s ? { element: s } : null;
121
- },
122
- role: "listitem",
123
- tabIndex: 0,
124
- "aria-labelledby": typeof this.props.header == "string" ? this.props.header : `tile-${this.props.index}`,
125
- "aria-keyshortcuts": "Enter",
126
- className: m(
127
- "k-tilelayout-item k-card",
128
- { "k-cursor-move": this.reorderable },
129
- this.props.className
130
- ),
131
- style: { height: "100%", ...l, ...this.props.style },
132
- onMouseDown: this.handleMouseDown,
133
- onMouseUp: this.handleMouseUp
134
- },
135
- this.props.children,
136
- /* @__PURE__ */ d.createElement(
137
- E,
138
- {
139
- onPress: this.handlePress,
140
- onResize: this.handleResize,
141
- resizable: e,
142
- rtl: this.state.rtl
143
- }
144
- )
145
- );
146
- return /* @__PURE__ */ d.createElement(d.Fragment, null, this.state.visibleHint && /* @__PURE__ */ d.createElement(
147
- "div",
148
- {
149
- ref: (s) => {
150
- this.hintElement = s;
151
- },
152
- style: { position: "fixed", ...n },
153
- className: m("k-layout-item-hint", this.props.hintClassName)
92
+ let a = 0, f = 0;
93
+ u.current.y > 0.7 * i.height / t.defaultPosition.rowSpan && (f = 1), u.current.y < 0.7 * -i.height / t.defaultPosition.rowSpan && (f = -1), u.current.x > 0.7 * i.width / t.defaultPosition.colSpan && (a = 1), u.current.x < 0.7 * -i.width / t.defaultPosition.colSpan && (a = -1), t.update(t.index, f, R ? -a : a, 0, 0);
94
+ const l = (h = s.current) == null ? void 0 : h.closest(".k-tilelayout");
95
+ if (l && c.current) {
96
+ const g = l.getBoundingClientRect(), y = G() || 50;
97
+ e.event.clientX < g.left - y || e.event.clientX > g.right - y || e.event.clientY < g.top || e.event.clientY > g.bottom ? c.current.style.display = "none" : c.current.style.display = "block";
154
98
  }
155
- ), /* @__PURE__ */ d.createElement(
156
- x,
157
- {
158
- ref: (s) => {
159
- this.draggable = s, this.element = s ? s.element : null;
160
- },
161
- onDrag: this.props.reorderable ? this.handleDrag : void 0,
162
- onRelease: this.props.reorderable ? this.handleRelease : void 0,
163
- onPress: this.props.reorderable ? this.handlePress : void 0
164
- },
165
- r
166
- ));
167
- }
168
- /**
169
- * @hidden
170
- */
171
- getSnapshotBeforeUpdate(t) {
172
- return this.oldSize = {}, this.dragElement && (this.oldSize = this.dragElement.getBoundingClientRect()), null;
173
- }
174
- /**
175
- * @hidden
176
- */
177
- setInitialHintPosition() {
178
- if (this.element && this.hintElement) {
179
- const t = this.element.getBoundingClientRect();
180
- this.hintElement.style.top = t.top + "px", this.hintElement.style.left = t.left + "px", this.hintElement.style.height = this.element.offsetHeight + "px", this.hintElement.style.width = this.element.offsetWidth + "px";
181
- }
182
- }
183
- /**
184
- * @hidden
185
- */
186
- componentDidUpdate(t) {
187
- const e = this.dragElement;
99
+ },
100
+ [t, R, d]
101
+ );
102
+ n.useEffect(() => {
103
+ s.current && (getComputedStyle(s.current).direction === "rtl" && F(!0), c.current && (c.current.style.height = s.current.offsetHeight + "px", c.current.style.width = s.current.offsetWidth + "px"));
104
+ }, []), n.useLayoutEffect(() => {
105
+ const e = d();
188
106
  if (!e)
189
107
  return;
190
- const n = e.getBoundingClientRect(), l = this.oldSize;
191
- if (this.resizing) {
192
- const i = n.width - l.width;
193
- if (this.state.rtl) {
194
- const c = parseFloat(e.style.marginLeft || "0");
195
- e.style.marginLeft = c - i + "px";
108
+ const r = e.getBoundingClientRect(), i = v.current;
109
+ if (!(i != null && i.width)) {
110
+ v.current = r, x.current = t;
111
+ return;
112
+ }
113
+ if (D.current) {
114
+ const l = r.width - i.width;
115
+ if (R) {
116
+ const y = parseFloat(e.style.marginLeft || "0");
117
+ e.style.marginLeft = y - l + "px";
196
118
  } else {
197
- const c = parseFloat(e.style.marginRight || "0");
198
- e.style.marginRight = c + i + "px";
119
+ const y = parseFloat(e.style.marginRight || "0");
120
+ e.style.marginRight = y + l + "px";
199
121
  }
200
- this.pressXY.x += this.state.rtl ? -i : i;
201
- const o = n.height - l.height, h = parseFloat(e.style.height.substring(12));
202
- e.style.height = `calc(100% + ${h + o}px)`, this.pressXY.y += o;
122
+ w.current.x += R ? -l : l;
123
+ const h = r.height - i.height, g = parseFloat(e.style.height.substring(12));
124
+ e.style.height = `calc(100% + ${g + h}px)`, w.current.y += h;
203
125
  }
204
- const r = l.left - n.left, s = l.top - n.top;
205
- if (!(r === 0 && s === 0)) {
206
- if (this.dragging) {
207
- (t.defaultPosition.order !== this.props.defaultPosition.order || t.defaultPosition.col !== this.props.defaultPosition.col) && (this.currentTranslate.x = 0, this.currentTranslate.y = 0, e.style.transform = "", this.calcNewHintPosition());
208
- return;
209
- }
210
- Math.abs(s) < 15 && Math.abs(r) < 15 || requestAnimationFrame(() => {
211
- const i = this.element;
212
- i && (i.style.transform = `translate(${r}px, ${s}px)`, i.style.transition = "transform 0s", requestAnimationFrame(() => {
213
- i.style.transform = "", i.style.transition = `transform ${g}ms cubic-bezier(0.2, 0, 0, 1) 0s`;
214
- }));
215
- });
126
+ const a = i.left - r.left, f = i.top - r.top;
127
+ if (a === 0 && f === 0) {
128
+ v.current = r, x.current = t;
129
+ return;
130
+ }
131
+ if (E.current) {
132
+ (x.current.defaultPosition.order !== t.defaultPosition.order || x.current.defaultPosition.col !== t.defaultPosition.col) && (u.current.x = 0, u.current.y = 0, e.style.transform = "", U()), v.current = r, x.current = t;
133
+ return;
134
+ }
135
+ if (Math.abs(f) < 15 && Math.abs(a) < 15) {
136
+ v.current = r, x.current = t;
137
+ return;
216
138
  }
217
- }
139
+ requestAnimationFrame(() => {
140
+ const l = s.current;
141
+ l && (l.style.transform = `translate(${a}px, ${f}px)`, l.style.transition = "transform 0s", requestAnimationFrame(() => {
142
+ l.style.transform = "", l.style.transition = `transform ${O}ms cubic-bezier(0.2, 0, 0, 1) 0s`;
143
+ }));
144
+ }), v.current = r, x.current = t;
145
+ }), J && clearTimeout && typeof clearTimeout == "function" && (clearTimeout(P.current), P.current = window.setTimeout(() => {
146
+ P.current = void 0;
147
+ }, 200));
148
+ const m = t.defaultPosition, K = {
149
+ gridColumnStart: m.col,
150
+ gridColumnEnd: `span ${m.colSpan}`,
151
+ gridRowStart: m.row,
152
+ gridRowEnd: `span ${m.rowSpan}`,
153
+ outline: "none",
154
+ order: m.order,
155
+ display: "block",
156
+ ...t.hintStyle
157
+ }, V = {
158
+ gridColumnStart: m.col,
159
+ gridColumnEnd: `span ${m.colSpan}`,
160
+ gridRowStart: m.row,
161
+ gridRowEnd: `span ${m.rowSpan}`,
162
+ order: m.order
163
+ }, _ = /* @__PURE__ */ n.createElement(
164
+ "div",
165
+ {
166
+ role: "listitem",
167
+ tabIndex: 0,
168
+ "aria-labelledby": typeof t.header == "string" ? t.header : `tile-${t.index}`,
169
+ "aria-keyshortcuts": "Enter",
170
+ className: Y("k-tilelayout-item k-card", { "k-cursor-move": b }, t.className),
171
+ style: { height: "100%", ...V, ...t.style },
172
+ onMouseDown: A,
173
+ onMouseUp: p
174
+ },
175
+ t.children,
176
+ /* @__PURE__ */ n.createElement(Z, { onPress: M, onResize: W, resizable: H, rtl: R })
177
+ );
178
+ return /* @__PURE__ */ n.createElement(n.Fragment, null, q && /* @__PURE__ */ n.createElement(
179
+ "div",
180
+ {
181
+ ref: (e) => {
182
+ c.current = e;
183
+ },
184
+ style: { position: "fixed", ...K },
185
+ className: Y("k-layout-item-hint", t.hintClassName)
186
+ }
187
+ ), /* @__PURE__ */ n.createElement(
188
+ Q,
189
+ {
190
+ ref: (e) => {
191
+ k.current = e, s.current = e ? e.element : null;
192
+ },
193
+ onDrag: b ? j : void 0,
194
+ onRelease: b ? L : void 0,
195
+ onPress: b ? M : void 0
196
+ },
197
+ _
198
+ ));
218
199
  };
219
- p.propTypes = {
220
- defaultPosition: a.object.isRequired,
221
- style: a.object,
222
- className: a.string,
223
- hintStyle: a.object,
224
- hintClassName: a.string,
225
- header: a.any,
226
- body: a.any,
227
- item: a.any,
228
- resizable: a.oneOf(["horizontal", "vertical", !0, !1]),
229
- reorderable: a.bool
230
- }, p.displayName = "KendoTileLayoutItem", p.defaultProps = {
231
- resizable: !0,
232
- reorderable: !0
200
+ N.propTypes = {
201
+ update: o.func.isRequired,
202
+ index: o.number.isRequired,
203
+ defaultPosition: o.object.isRequired,
204
+ ignoreDrag: o.func,
205
+ onPress: o.func.isRequired,
206
+ onRelease: o.func.isRequired,
207
+ children: o.node,
208
+ style: o.object,
209
+ className: o.string,
210
+ hintStyle: o.object,
211
+ hintClassName: o.string,
212
+ header: o.any,
213
+ body: o.any,
214
+ item: o.any,
215
+ resizable: o.oneOf(["horizontal", "vertical", !0, !1]),
216
+ reorderable: o.bool
233
217
  };
234
- let u = p;
218
+ N.displayName = "KendoTileLayoutItem";
219
+ N.defaultProps = T;
235
220
  export {
236
- u as InternalTile
221
+ N as InternalTile
237
222
  };
@@ -5,12 +5,13 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
+ import { TileResizeMode } from './interfaces/index.js';
8
9
  import * as React from 'react';
9
10
  /**
10
11
  * @hidden
11
12
  */
12
13
  export interface ResizeHandlersProps {
13
- resizable: string | boolean;
14
+ resizable: TileResizeMode;
14
15
  onResize: (e: any, args: {
15
16
  end: boolean;
16
17
  direction: any;
@@ -21,7 +22,4 @@ export interface ResizeHandlersProps {
21
22
  /**
22
23
  * @hidden
23
24
  */
24
- export declare class ResizeHandlers extends React.Component<ResizeHandlersProps, {}> {
25
- handleResize: (event: any, isEnd: boolean, direction: any) => void;
26
- render(): React.JSX.Element | null;
27
- }
25
+ export declare const ResizeHandlers: React.FC<ResizeHandlersProps>;
@@ -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"),a=require("@progress/kendo-react-common");function o(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const s=o(l),i=t=>s.createElement(a.Draggable,{onPress:t.onPress,onDrag:e=>{t.onResize(e.event,!1,t.d)},onRelease:e=>{t.onResize(e.event,!0,t.d)}},s.createElement("div",{className:"k-resize-handle k-cursor-"+t.d+"-resize",style:{bottom:0,right:0,...t.style}}));class c extends s.Component{constructor(){super(...arguments),this.handleResize=(e,n,r)=>{e.originalEvent.preventDefault(),this.props.onResize(e,{end:n,direction:r})}}render(){const{resizable:e,onPress:n,rtl:r}=this.props;return e?s.createElement(s.Fragment,null,e!=="vertical"&&s.createElement(i,{onPress:n,onResize:this.handleResize,d:"ew",style:r?{top:0,width:9,left:0,right:""}:{top:0,width:9,right:0,left:""}}),e!=="horizontal"&&s.createElement(i,{onPress:n,onResize:this.handleResize,d:"ns",style:{left:0,height:9}}),e===!0&&s.createElement(i,{onPress:n,onResize:this.handleResize,d:r?"nesw":"nwse",style:r?{width:9,height:9,right:"",left:0}:{width:9,height:9,right:0,left:""}})):null}}exports.ResizeHandlers=c;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),u=require("@progress/kendo-react-common");function g(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const l=g(d),i=e=>l.createElement(u.Draggable,{onPress:e.onPress,onDrag:t=>{e.onResize(t.event,!1,e.d)},onRelease:t=>{e.onResize(t.event,!0,e.d)}},l.createElement("div",{className:"k-resize-handle k-cursor-"+e.d+"-resize",style:{bottom:0,right:0,...e.style}})),f=({resizable:e,onResize:t,onPress:n,rtl:r})=>{const a=l.useCallback((c,o,s)=>{c.originalEvent.preventDefault(),t(c,{end:o,direction:s})},[t]);return e?l.createElement(l.Fragment,null,e!=="vertical"&&l.createElement(i,{onPress:n,onResize:a,d:"ew",style:r?{top:0,width:9,left:0,right:""}:{top:0,width:9,right:0,left:""}}),e!=="horizontal"&&l.createElement(i,{onPress:n,onResize:a,d:"ns",style:{left:0,height:9}}),e===!0&&l.createElement(i,{onResize:a,onPress:n,d:r?"nesw":"nwse",style:r?{width:9,height:9,right:"",left:0}:{width:9,height:9,right:0,left:""}})):null};exports.ResizeHandlers=f;
@@ -5,54 +5,51 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as n from "react";
9
- import { Draggable as l } from "@progress/kendo-react-common";
10
- const i = (t) => /* @__PURE__ */ n.createElement(
11
- l,
8
+ import * as t from "react";
9
+ import { Draggable as o } from "@progress/kendo-react-common";
10
+ const r = (e) => /* @__PURE__ */ t.createElement(
11
+ o,
12
12
  {
13
- onPress: t.onPress,
14
- onDrag: (e) => {
15
- t.onResize(e.event, !1, t.d);
13
+ onPress: e.onPress,
14
+ onDrag: (n) => {
15
+ e.onResize(n.event, !1, e.d);
16
16
  },
17
- onRelease: (e) => {
18
- t.onResize(e.event, !0, t.d);
17
+ onRelease: (n) => {
18
+ e.onResize(n.event, !0, e.d);
19
19
  }
20
20
  },
21
- /* @__PURE__ */ n.createElement(
21
+ /* @__PURE__ */ t.createElement(
22
22
  "div",
23
23
  {
24
- className: "k-resize-handle k-cursor-" + t.d + "-resize",
25
- style: { bottom: 0, right: 0, ...t.style }
24
+ className: "k-resize-handle k-cursor-" + e.d + "-resize",
25
+ style: { bottom: 0, right: 0, ...e.style }
26
26
  }
27
27
  )
28
- );
29
- class h extends n.Component {
30
- constructor() {
31
- super(...arguments), this.handleResize = (e, s, r) => {
32
- e.originalEvent.preventDefault(), this.props.onResize(e, { end: s, direction: r });
33
- };
34
- }
35
- render() {
36
- const { resizable: e, onPress: s, rtl: r } = this.props;
37
- return e ? /* @__PURE__ */ n.createElement(n.Fragment, null, e !== "vertical" && /* @__PURE__ */ n.createElement(
38
- i,
39
- {
40
- onPress: s,
41
- onResize: this.handleResize,
42
- d: "ew",
43
- style: r ? { top: 0, width: 9, left: 0, right: "" } : { top: 0, width: 9, right: 0, left: "" }
44
- }
45
- ), e !== "horizontal" && /* @__PURE__ */ n.createElement(i, { onPress: s, onResize: this.handleResize, d: "ns", style: { left: 0, height: 9 } }), e === !0 && /* @__PURE__ */ n.createElement(
46
- i,
47
- {
48
- onPress: s,
49
- onResize: this.handleResize,
50
- d: r ? "nesw" : "nwse",
51
- style: r ? { width: 9, height: 9, right: "", left: 0 } : { width: 9, height: 9, right: 0, left: "" }
52
- }
53
- )) : null;
54
- }
55
- }
28
+ ), g = ({ resizable: e, onResize: n, onPress: l, rtl: i }) => {
29
+ const a = t.useCallback(
30
+ (h, s, d) => {
31
+ h.originalEvent.preventDefault(), n(h, { end: s, direction: d });
32
+ },
33
+ [n]
34
+ );
35
+ return e ? /* @__PURE__ */ t.createElement(t.Fragment, null, e !== "vertical" && /* @__PURE__ */ t.createElement(
36
+ r,
37
+ {
38
+ onPress: l,
39
+ onResize: a,
40
+ d: "ew",
41
+ style: i ? { top: 0, width: 9, left: 0, right: "" } : { top: 0, width: 9, right: 0, left: "" }
42
+ }
43
+ ), e !== "horizontal" && /* @__PURE__ */ t.createElement(r, { onPress: l, onResize: a, d: "ns", style: { left: 0, height: 9 } }), e === !0 && /* @__PURE__ */ t.createElement(
44
+ r,
45
+ {
46
+ onResize: a,
47
+ onPress: l,
48
+ d: i ? "nesw" : "nwse",
49
+ style: i ? { width: 9, height: 9, right: "", left: 0 } : { width: 9, height: 9, right: 0, left: "" }
50
+ }
51
+ )) : null;
52
+ };
56
53
  export {
57
- h as ResizeHandlers
54
+ g as ResizeHandlers
58
55
  };