@svgrid/grid-wc 3.0.29 → 3.0.31

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.
@@ -0,0 +1,109 @@
1
+ //#region ../grid/dist/merges.js
2
+ var e = (e, t) => `${e}:${t}`;
3
+ function t(t) {
4
+ if (!t || t.length === 0) return null;
5
+ let n = /* @__PURE__ */ new Map(), r = [];
6
+ for (let i of t) {
7
+ let t = Math.max(1, Math.floor(i.rowSpan)), a = Math.max(1, Math.floor(i.colSpan));
8
+ if (t === 1 && a === 1) continue;
9
+ let o = {
10
+ rowIndex: i.rowIndex,
11
+ colIndex: i.colIndex,
12
+ rowSpan: t,
13
+ colSpan: a
14
+ };
15
+ r.push(o);
16
+ for (let r = o.rowIndex; r < o.rowIndex + t; r += 1) for (let t = o.colIndex; t < o.colIndex + a; t += 1) n.set(e(r, t), o);
17
+ }
18
+ return r.length ? {
19
+ list: r,
20
+ byCell: n
21
+ } : null;
22
+ }
23
+ function n(t, n, r) {
24
+ return t?.byCell.get(e(n, r));
25
+ }
26
+ function r(e, t, r) {
27
+ let i = n(e, t, r);
28
+ return !!i && (i.rowIndex !== t || i.colIndex !== r);
29
+ }
30
+ function i(e, t, r) {
31
+ let i = n(e, t, r);
32
+ return i ? {
33
+ rowIndex: i.rowIndex,
34
+ colIndex: i.colIndex
35
+ } : {
36
+ rowIndex: t,
37
+ colIndex: r
38
+ };
39
+ }
40
+ function a(e, t, r) {
41
+ let i = n(e, t, r);
42
+ return i ? {
43
+ rowIndex: i.rowIndex + i.rowSpan - 1,
44
+ colIndex: i.colIndex + i.colSpan - 1
45
+ } : {
46
+ rowIndex: t,
47
+ colIndex: r
48
+ };
49
+ }
50
+ function o(e, t) {
51
+ if (!e) return t;
52
+ let { minRow: n, maxRow: r, minCol: i, maxCol: a } = t;
53
+ for (let t = 0; t < 64; t += 1) {
54
+ let t = !1;
55
+ for (let o of e.list) {
56
+ let e = o.rowIndex + o.rowSpan - 1, s = o.colIndex + o.colSpan - 1;
57
+ o.rowIndex <= r && e >= n && o.colIndex <= a && s >= i && (o.rowIndex < n && (n = o.rowIndex, t = !0), e > r && (r = e, t = !0), o.colIndex < i && (i = o.colIndex, t = !0), s > a && (a = s, t = !0));
58
+ }
59
+ if (!t) break;
60
+ }
61
+ return n === t.minRow && r === t.maxRow && i === t.minCol && a === t.maxCol ? t : {
62
+ minRow: n,
63
+ maxRow: r,
64
+ minCol: i,
65
+ maxCol: a
66
+ };
67
+ }
68
+ function s(e, t, r, i) {
69
+ if (!e) return r;
70
+ let a = n(e, r.rowIndex, r.colIndex);
71
+ if (!a) return r;
72
+ if (n(e, t.rowIndex, t.colIndex) !== a) return {
73
+ rowIndex: a.rowIndex,
74
+ colIndex: a.colIndex
75
+ };
76
+ let o = Math.sign(r.rowIndex - t.rowIndex), s = Math.sign(r.colIndex - t.colIndex);
77
+ if (o === 0 && s === 0) return {
78
+ rowIndex: a.rowIndex,
79
+ colIndex: a.colIndex
80
+ };
81
+ let c = r.rowIndex, l = r.colIndex;
82
+ if (o > 0 ? c = a.rowIndex + a.rowSpan : o < 0 && (c = a.rowIndex - 1), s > 0 ? l = a.colIndex + a.colSpan : s < 0 && (l = a.colIndex - 1), c < 0 || c > i.maxRow || l < 0 || l > i.maxCol) return {
83
+ rowIndex: a.rowIndex,
84
+ colIndex: a.colIndex
85
+ };
86
+ let u = n(e, c, l);
87
+ return u ? {
88
+ rowIndex: u.rowIndex,
89
+ colIndex: u.colIndex
90
+ } : {
91
+ rowIndex: c,
92
+ colIndex: l
93
+ };
94
+ }
95
+ function c(e, t, r, i) {
96
+ let a = n(e, t, r);
97
+ if (!a) return null;
98
+ let o = Math.max(a.rowIndex, i.firstRow), s = Math.max(a.colIndex, i.firstCol);
99
+ if (t !== o || r !== s) return { kind: "skip" };
100
+ let c = o === a.rowIndex && s === a.colIndex, l = Math.max(1, Math.min(a.rowIndex + a.rowSpan - t, i.lastRow - t + 1)), u = Math.max(1, Math.min(a.colIndex + a.colSpan - r, i.lastCol - r + 1));
101
+ return {
102
+ kind: c ? "origin" : "continuation",
103
+ merge: a,
104
+ rowSpan: l,
105
+ colSpan: u
106
+ };
107
+ }
108
+ //#endregion
109
+ export { t as buildMergeIndex, a as endOf, o as expandRectToMerges, r as isCovered, n as mergeAt, c as mergeDrawAt, i as originOf, s as stepPastMerge };
@@ -0,0 +1,109 @@
1
+ //#region ../grid/dist/merges.js
2
+ var e = (e, t) => `${e}:${t}`;
3
+ function t(t) {
4
+ if (!t || t.length === 0) return null;
5
+ let n = /* @__PURE__ */ new Map(), r = [];
6
+ for (let i of t) {
7
+ let t = Math.max(1, Math.floor(i.rowSpan)), a = Math.max(1, Math.floor(i.colSpan));
8
+ if (t === 1 && a === 1) continue;
9
+ let o = {
10
+ rowIndex: i.rowIndex,
11
+ colIndex: i.colIndex,
12
+ rowSpan: t,
13
+ colSpan: a
14
+ };
15
+ r.push(o);
16
+ for (let r = o.rowIndex; r < o.rowIndex + t; r += 1) for (let t = o.colIndex; t < o.colIndex + a; t += 1) n.set(e(r, t), o);
17
+ }
18
+ return r.length ? {
19
+ list: r,
20
+ byCell: n
21
+ } : null;
22
+ }
23
+ function n(t, n, r) {
24
+ return t?.byCell.get(e(n, r));
25
+ }
26
+ function r(e, t, r) {
27
+ let i = n(e, t, r);
28
+ return !!i && (i.rowIndex !== t || i.colIndex !== r);
29
+ }
30
+ function i(e, t, r) {
31
+ let i = n(e, t, r);
32
+ return i ? {
33
+ rowIndex: i.rowIndex,
34
+ colIndex: i.colIndex
35
+ } : {
36
+ rowIndex: t,
37
+ colIndex: r
38
+ };
39
+ }
40
+ function a(e, t, r) {
41
+ let i = n(e, t, r);
42
+ return i ? {
43
+ rowIndex: i.rowIndex + i.rowSpan - 1,
44
+ colIndex: i.colIndex + i.colSpan - 1
45
+ } : {
46
+ rowIndex: t,
47
+ colIndex: r
48
+ };
49
+ }
50
+ function o(e, t) {
51
+ if (!e) return t;
52
+ let { minRow: n, maxRow: r, minCol: i, maxCol: a } = t;
53
+ for (let t = 0; t < 64; t += 1) {
54
+ let t = !1;
55
+ for (let o of e.list) {
56
+ let e = o.rowIndex + o.rowSpan - 1, s = o.colIndex + o.colSpan - 1;
57
+ o.rowIndex <= r && e >= n && o.colIndex <= a && s >= i && (o.rowIndex < n && (n = o.rowIndex, t = !0), e > r && (r = e, t = !0), o.colIndex < i && (i = o.colIndex, t = !0), s > a && (a = s, t = !0));
58
+ }
59
+ if (!t) break;
60
+ }
61
+ return n === t.minRow && r === t.maxRow && i === t.minCol && a === t.maxCol ? t : {
62
+ minRow: n,
63
+ maxRow: r,
64
+ minCol: i,
65
+ maxCol: a
66
+ };
67
+ }
68
+ function s(e, t, r, i) {
69
+ if (!e) return r;
70
+ let a = n(e, r.rowIndex, r.colIndex);
71
+ if (!a) return r;
72
+ if (n(e, t.rowIndex, t.colIndex) !== a) return {
73
+ rowIndex: a.rowIndex,
74
+ colIndex: a.colIndex
75
+ };
76
+ let o = Math.sign(r.rowIndex - t.rowIndex), s = Math.sign(r.colIndex - t.colIndex);
77
+ if (o === 0 && s === 0) return {
78
+ rowIndex: a.rowIndex,
79
+ colIndex: a.colIndex
80
+ };
81
+ let c = r.rowIndex, l = r.colIndex;
82
+ if (o > 0 ? c = a.rowIndex + a.rowSpan : o < 0 && (c = a.rowIndex - 1), s > 0 ? l = a.colIndex + a.colSpan : s < 0 && (l = a.colIndex - 1), c < 0 || c > i.maxRow || l < 0 || l > i.maxCol) return {
83
+ rowIndex: a.rowIndex,
84
+ colIndex: a.colIndex
85
+ };
86
+ let u = n(e, c, l);
87
+ return u ? {
88
+ rowIndex: u.rowIndex,
89
+ colIndex: u.colIndex
90
+ } : {
91
+ rowIndex: c,
92
+ colIndex: l
93
+ };
94
+ }
95
+ function c(e, t, r, i) {
96
+ let a = n(e, t, r);
97
+ if (!a) return null;
98
+ let o = Math.max(a.rowIndex, i.firstRow), s = Math.max(a.colIndex, i.firstCol);
99
+ if (t !== o || r !== s) return { kind: "skip" };
100
+ let c = o === a.rowIndex && s === a.colIndex, l = Math.max(1, Math.min(a.rowIndex + a.rowSpan - t, i.lastRow - t + 1)), u = Math.max(1, Math.min(a.colIndex + a.colSpan - r, i.lastCol - r + 1));
101
+ return {
102
+ kind: c ? "origin" : "continuation",
103
+ merge: a,
104
+ rowSpan: l,
105
+ colSpan: u
106
+ };
107
+ }
108
+ //#endregion
109
+ export { t as buildMergeIndex, a as endOf, o as expandRectToMerges, r as isCovered, n as mergeAt, c as mergeDrawAt, i as originOf, s as stepPastMerge };