@progress/kendo-react-layout 11.0.0-develop.9 → 11.0.1-develop.1

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,7 +5,7 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as a from "react";
8
+ import * as r from "react";
9
9
  import t from "prop-types";
10
10
  import { dispatchEvent as y, classNames as w, getter as b } from "@progress/kendo-react-common";
11
11
  import { InternalTile as S } from "./InternalTile.mjs";
@@ -15,26 +15,27 @@ const k = {
15
15
  "column dense": "k-grid-flow-col-dense",
16
16
  "row dense": "k-grid-flow-row-dense",
17
17
  unset: "k-grid-flow-unset"
18
- }, h = class h extends a.Component {
18
+ }, h = class h extends r.Component {
19
19
  constructor() {
20
20
  super(...arguments), this._element = null, this.state = {
21
21
  positions: (this.props.items || []).map(
22
- (r, n) => Object.assign({ order: n, rowSpan: 1, colSpan: 1 }, r.defaultPosition)
23
- )
22
+ (i, n) => Object.assign({ order: n, rowSpan: 1, colSpan: 1 }, i.defaultPosition)
23
+ ),
24
+ activeHint: !1
24
25
  }, this.focus = () => {
25
26
  this._element && this._element.focus();
26
- }, this.update = (r, n, i, s = 0, l = 0) => {
27
- if (n === 0 && i === 0 && !l && !s)
27
+ }, this.update = (i, n, a, s = 0, p = 0) => {
28
+ if (n === 0 && a === 0 && !p && !s)
28
29
  return;
29
30
  let m = !1;
30
- const p = this.state.positions.map((g) => Object.assign({}, g)), o = p[r], c = p.find((g) => g.order === o.order + n);
31
- c && c !== o && (o.order += n, c.order += -n, m = !0);
32
- const d = o.col + i;
33
- i !== 0 && d >= 1 && d + o.colSpan <= (this.props.columns || 3) + 1 && (o.col = d, m = !0);
34
- const e = o.colSpan + l;
35
- l && e >= 1 && e + o.col <= (this.props.columns || 3) + 1 && (o.colSpan = e, m = !0);
36
- const u = o.rowSpan + s;
37
- s && u >= 1 && (o.rowSpan = u, m = !0), m && (this.setState({ positions: p }), y(this.props.onReposition, {}, this, { value: p }));
31
+ const c = this.state.positions.map((f) => Object.assign({}, f)), o = c[i], u = c.find((f) => f.order === o.order + n);
32
+ u && u !== o && (o.order += n, u.order += -n, m = !0);
33
+ const d = o.col + a;
34
+ a !== 0 && d >= 1 && d + o.colSpan <= (this.props.columns || 3) + 1 && (o.col = d, m = !0);
35
+ const e = o.colSpan + p;
36
+ p && e >= 1 && e + o.col <= (this.props.columns || 3) + 1 && (o.colSpan = e, m = !0);
37
+ const l = o.rowSpan + s;
38
+ s && l >= 1 && (o.rowSpan = l, m = !0), m && (this.setState({ positions: c }), y(this.props.onReposition, {}, this, { value: c }));
38
39
  };
39
40
  }
40
41
  /**
@@ -46,59 +47,71 @@ const k = {
46
47
  /**
47
48
  * @hidden
48
49
  */
49
- static getDerivedStateFromProps(r, n) {
50
- return r.positions ? {
51
- positions: r.positions.map((i, s) => Object.assign({ order: s, rowSpan: 1, colSpan: 1 }, i))
52
- } : r.items && (!n.positions || r.items.length !== n.positions.length) ? {
53
- positions: r.items.map(
54
- (i, s) => Object.assign({ order: s, rowSpan: 1, colSpan: 1 }, i.defaultPosition)
50
+ static getDerivedStateFromProps(i, n) {
51
+ return i.positions ? {
52
+ positions: i.positions.map((a, s) => Object.assign({ order: s, rowSpan: 1, colSpan: 1 }, a))
53
+ } : i.items && (!n.positions || i.items.length !== n.positions.length) ? {
54
+ positions: i.items.map(
55
+ (a, s) => Object.assign({ order: s, rowSpan: 1, colSpan: 1 }, a.defaultPosition)
55
56
  )
56
57
  } : null;
57
58
  }
58
59
  render() {
59
60
  const {
60
- className: r,
61
+ className: i,
61
62
  columns: n = 3,
62
- columnWidth: i = "1fr",
63
+ columnWidth: a = "1fr",
63
64
  gap: s,
64
- rowHeight: l = "1fr",
65
+ rowHeight: p = "1fr",
65
66
  style: m,
66
- autoFlow: p = "column",
67
+ autoFlow: c = "column",
67
68
  items: o = []
68
- } = this.props, c = s ? `${typeof s.rows == "number" ? s.rows + "px" : s.rows} ${typeof s.columns == "number" ? s.columns + "px" : s.columns}` : 16, d = {
69
- gridTemplateColumns: `repeat(${n}, minmax(0px, ${typeof i == "number" ? i + "px" : i}))`,
70
- gridAutoRows: `minmax(0px, ${typeof l == "number" ? l + "px" : l})`,
71
- gap: c,
72
- padding: c,
69
+ } = this.props, u = s ? `${typeof s.rows == "number" ? s.rows + "px" : s.rows} ${typeof s.columns == "number" ? s.columns + "px" : s.columns}` : 16, d = {
70
+ gridTemplateColumns: `repeat(${n}, minmax(0px, ${typeof a == "number" ? a + "px" : a}))`,
71
+ gridAutoRows: `minmax(0px, ${typeof p == "number" ? p + "px" : p})`,
72
+ gap: u,
73
+ padding: u,
73
74
  ...m
74
75
  };
75
- return /* @__PURE__ */ a.createElement(
76
+ return /* @__PURE__ */ r.createElement(
76
77
  "div",
77
78
  {
78
79
  ref: (e) => {
79
80
  this._element = e;
80
81
  },
81
82
  dir: this.props.dir,
82
- className: w("k-tilelayout k-pos-relative", k[p], r),
83
+ className: w("k-tilelayout k-pos-relative", k[c], i),
83
84
  style: d,
84
85
  id: this.props.id,
85
- children: o.map((e, u) => /* @__PURE__ */ a.createElement(a.Fragment, { key: this.props.dataItemKey ? b(this.props.dataItemKey)(e) : u }, /* @__PURE__ */ a.createElement(
86
- S,
86
+ role: "list"
87
+ },
88
+ o.map((e, l) => /* @__PURE__ */ r.createElement(r.Fragment, { key: this.props.dataItemKey ? b(this.props.dataItemKey)(e) : l }, /* @__PURE__ */ r.createElement(
89
+ S,
90
+ {
91
+ update: this.update,
92
+ defaultPosition: this.state.positions[l],
93
+ index: l,
94
+ resizable: e.resizable,
95
+ reorderable: e.reorderable,
96
+ style: e.style,
97
+ header: e.header,
98
+ className: e.className,
99
+ hintClassName: e.hintClassName,
100
+ hintStyle: e.hintStyle,
101
+ ignoreDrag: this.props.ignoreDrag,
102
+ onPress: () => this.setState({ activeHint: !0 }),
103
+ onRelease: () => this.setState({ activeHint: !1 })
104
+ },
105
+ e.item ? e.item : /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("div", { className: "k-tilelayout-item-header k-card-header" }, r.isValidElement(e.header) ? e.header : /* @__PURE__ */ r.createElement(
106
+ "div",
87
107
  {
88
- update: this.update,
89
- defaultPosition: this.state.positions[u],
90
- index: u,
91
- resizable: e.resizable,
92
- reorderable: e.reorderable,
93
- style: e.style,
94
- className: e.className,
95
- hintClassName: e.hintClassName,
96
- hintStyle: e.hintStyle,
97
- ignoreDrag: this.props.ignoreDrag
108
+ id: typeof e.header == "string" ? e.header : this.props.id ? `tilelayout-${this.props.id}-${l}` : `tilelayout-${l}`,
109
+ className: "k-card-title"
98
110
  },
99
- e.item ? e.item : /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement("div", { className: "k-tilelayout-item-header k-card-header" }, a.isValidElement(e.header) ? e.header : /* @__PURE__ */ a.createElement("h5", { className: "k-card-title" }, e.header)), /* @__PURE__ */ a.createElement("div", { className: "k-tilelayout-item-body k-card-body" }, e.body))
100
- )))
101
- }
111
+ e.header
112
+ )), /* @__PURE__ */ r.createElement("div", { className: "k-tilelayout-item-body k-card-body" }, e.body))
113
+ ))),
114
+ !this.state.activeHint && /* @__PURE__ */ r.createElement("div", { className: "k-layout-item-hint", style: { display: "none", zIndex: "1", height: "auto" } })
102
115
  );
103
116
  }
104
117
  };
@@ -118,7 +131,7 @@ h.propTypes = {
118
131
  onReposition: t.func,
119
132
  ignoreDrag: t.func
120
133
  }, h.displayName = "KendoTileLayout";
121
- let f = h;
134
+ let g = h;
122
135
  export {
123
- f as TileLayout
136
+ g as TileLayout
124
137
  };