e-virt-table 1.2.23 → 1.2.24

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/dist/index.es.js CHANGED
@@ -1,57 +1,57 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: transparent;--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-readonly-text-color: #cfd3dc;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}")),document.head.appendChild(e)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
- var ee = Object.defineProperty;
3
- var ie = (c, t, e) => t in c ? ee(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
4
- var n = (c, t, e) => ie(c, typeof t != "symbol" ? t + "" : t, e);
5
- class se {
1
+ (function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: transparent;--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: rgb(82, 146, 247)}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-readonly-text-color: #cfd3dc;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}")),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ var se = Object.defineProperty;
3
+ var oe = (h, t, e) => t in h ? se(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e;
4
+ var n = (h, t, e) => oe(h, typeof t != "symbol" ? t + "" : t, e);
5
+ class re {
6
6
  constructor(t) {
7
7
  n(this, "rules");
8
8
  this.rules = t;
9
9
  }
10
10
  validate(t) {
11
- const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex: l, value: h, field: d, fieldValue: f } = t;
11
+ const e = [], { column: i, row: s, key: o, rowKey: r, colIndex: a, rowIndex: c, value: l, field: d, fieldValue: f } = t;
12
12
  Array.isArray(this.rules) || (this.rules = [this.rules]);
13
13
  for (const u of this.rules) {
14
14
  if (u.validator) {
15
15
  const x = {
16
16
  field: d,
17
17
  fieldValue: f,
18
- value: h,
18
+ value: l,
19
19
  column: i,
20
20
  colIndex: a,
21
- rowIndex: l,
21
+ rowIndex: c,
22
22
  row: s,
23
23
  key: o,
24
24
  rowKey: r,
25
25
  ...u
26
26
  };
27
- u.validator(x, h, (w) => {
27
+ u.validator(x, l, (w) => {
28
28
  w && e.push({
29
29
  ...x,
30
30
  message: w
31
31
  });
32
32
  });
33
33
  }
34
- if (!u.required && (h == null || h === ""))
34
+ if (!u.required && (l == null || l === ""))
35
35
  return e;
36
- u.pattern && !u.pattern.test(h) && e.push({
37
- value: h,
36
+ u.pattern && !u.pattern.test(l) && e.push({
37
+ value: l,
38
38
  column: i,
39
39
  row: s,
40
40
  key: o,
41
41
  rowKey: r,
42
42
  colIndex: a,
43
- rowIndex: l,
43
+ rowIndex: c,
44
44
  field: d,
45
45
  fieldValue: f,
46
46
  message: u.message || `${o} is pattern validation error`
47
- }), u.required && (h == null || h === "") && e.push({
48
- value: h,
47
+ }), u.required && (l == null || l === "") && e.push({
48
+ value: l,
49
49
  column: i,
50
50
  row: s,
51
51
  key: o,
52
52
  rowKey: r,
53
53
  colIndex: a,
54
- rowIndex: l,
54
+ rowIndex: c,
55
55
  field: d,
56
56
  fieldValue: f,
57
57
  message: u.message || `${o} is required`
@@ -60,27 +60,27 @@ class se {
60
60
  return e;
61
61
  }
62
62
  }
63
- function Lt() {
64
- return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(c) {
63
+ function At() {
64
+ return "xxxxxxxxxxxxxxxxxx".replace(/[x]/g, function(h) {
65
65
  const t = Math.random() * 16 | 0;
66
- return (c === "x" ? t : t & 3 | 8).toString(16);
66
+ return (h === "x" ? t : t & 3 | 8).toString(16);
67
67
  });
68
68
  }
69
- function At(c, t) {
69
+ function Ht(h, t) {
70
70
  let e = 0, i;
71
71
  return function(...s) {
72
72
  const o = (/* @__PURE__ */ new Date()).getTime(), r = o - e;
73
- !e || r >= t ? (c.apply(this, s), e = o) : i || (i = setTimeout(() => {
74
- c.apply(this, s), e = (/* @__PURE__ */ new Date()).getTime(), i = void 0;
73
+ !e || r >= t ? (h.apply(this, s), e = o) : i || (i = setTimeout(() => {
74
+ h.apply(this, s), e = (/* @__PURE__ */ new Date()).getTime(), i = void 0;
75
75
  }, t - r));
76
76
  };
77
77
  }
78
- function Mt(c = []) {
79
- return c.length ? c.map((t) => Mt(t.children) + 1).sort((t, e) => e - t)[0] : 0;
78
+ function Dt(h = []) {
79
+ return h.length ? h.map((t) => Dt(t.children) + 1).sort((t, e) => e - t)[0] : 0;
80
80
  }
81
- function oe(c = []) {
81
+ function ne(h = []) {
82
82
  let t = [], e = [], i = [];
83
- return c.forEach((s) => {
83
+ return h.forEach((s) => {
84
84
  s.fixed === "left" ? t.push(s) : s.fixed === "right" ? i.push(s) : e.push(s);
85
85
  }), [
86
86
  ...t.sort((s, o) => (s.sort ?? 0) - (o.sort ?? 0)),
@@ -88,14 +88,14 @@ function oe(c = []) {
88
88
  ...i.sort((s, o) => (s.sort ?? 0) - (o.sort ?? 0))
89
89
  ];
90
90
  }
91
- function Ht(c = [], t = 1, e = 0) {
92
- return c.map((i) => {
91
+ function Nt(h = [], t = 1, e = 0) {
92
+ return h.map((i) => {
93
93
  if (i.children) {
94
94
  let s = 0, o = i.fixed;
95
95
  i.children.forEach((a) => {
96
96
  a.fixed = o;
97
97
  });
98
- const r = Ht(i.children, t - 1, e + 1);
98
+ const r = Nt(i.children, t - 1, e + 1);
99
99
  return r && r.forEach((a) => {
100
100
  s += a.colspan ?? 0;
101
101
  }), {
@@ -115,72 +115,72 @@ function Ht(c = [], t = 1, e = 0) {
115
115
  };
116
116
  });
117
117
  }
118
- function it(c = []) {
118
+ function et(h = []) {
119
119
  let t = [];
120
- return c.forEach((e) => {
121
- e.children ? t = t.concat(it(e.children)) : t.push(e);
120
+ return h.forEach((e) => {
121
+ e.children ? t = t.concat(et(e.children)) : t.push(e);
122
122
  }), t;
123
123
  }
124
- const mt = /^(\r\n|\n\r|\r|\n)/, re = /^[^\t\r\n]+/, yt = /^\t/;
125
- function ne(c) {
124
+ const yt = /^(\r\n|\n\r|\r|\n)/, ae = /^[^\t\r\n]+/, Ct = /^\t/;
125
+ function ce(h) {
126
126
  let t = [[""]];
127
- if (c.length === 0)
127
+ if (h.length === 0)
128
128
  return t;
129
129
  let e = 0, i = 0, s;
130
- for (; c.length > 0 && s !== c.length; )
131
- if (s = c.length, c.match(yt))
132
- c = c.replace(yt, ""), e += 1, t[i][e] = "";
133
- else if (c.match(mt))
134
- c = c.replace(mt, ""), e = 0, i += 1, t[i] = [""];
130
+ for (; h.length > 0 && s !== h.length; )
131
+ if (s = h.length, h.match(Ct))
132
+ h = h.replace(Ct, ""), e += 1, t[i][e] = "";
133
+ else if (h.match(yt))
134
+ h = h.replace(yt, ""), e = 0, i += 1, t[i] = [""];
135
135
  else {
136
136
  let o = "";
137
- if (c.startsWith('"')) {
137
+ if (h.startsWith('"')) {
138
138
  let r = 0, a = !0;
139
139
  for (; a; ) {
140
- const l = c.slice(0, 1);
141
- l === '"' && (r += 1), o += l, c = c.slice(1), (c.length === 0 || c.match(/^[\t\r\n]/) && r % 2 === 0) && (a = !1);
140
+ const c = h.slice(0, 1);
141
+ c === '"' && (r += 1), o += c, h = h.slice(1), (h.length === 0 || h.match(/^[\t\r\n]/) && r % 2 === 0) && (a = !1);
142
142
  }
143
- o = o.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (l) => new Array(Math.floor(l.length / 2)).fill('"').join(""));
143
+ o = o.replace(/^"/, "").replace(/"$/, "").replace(/["]*/g, (c) => new Array(Math.floor(c.length / 2)).fill('"').join(""));
144
144
  } else {
145
- const r = c.match(re);
146
- o = r ? r[0] : "", c = c.slice(o.length);
145
+ const r = h.match(ae);
146
+ o = r ? r[0] : "", h = h.slice(o.length);
147
147
  }
148
148
  t[i][e] = o;
149
149
  }
150
150
  return Array.isArray(t) && t.length > 1 && t[t.length - 1].length === 1 && t[t.length - 1][0] === "" && (t = t.slice(0, t.length - 1)), t;
151
151
  }
152
- function ae(c) {
152
+ function le(h) {
153
153
  let t, e, i, s, o = "", r;
154
- for (t = 0, e = c.length; t < e; t += 1) {
155
- for (s = c[t].length, i = 0; i < s; i += 1)
156
- i > 0 && (o += " "), r = c[t][i], typeof r == "string" ? r.indexOf(`
154
+ for (t = 0, e = h.length; t < e; t += 1) {
155
+ for (s = h[t].length, i = 0; i < s; i += 1)
156
+ i > 0 && (o += " "), r = h[t][i], typeof r == "string" ? r.indexOf(`
157
157
  `) > -1 ? o += `"${r.replace(/"/g, '""')}"` : o += r : r == null ? o += "" : o += r;
158
158
  t !== e - 1 && (o += `
159
159
  `);
160
160
  }
161
161
  return o;
162
162
  }
163
- function Dt(c, t, e = []) {
163
+ function kt(h, t, e = []) {
164
164
  let i = 0;
165
165
  const s = [];
166
- return c.forEach((o, r) => {
166
+ return h.forEach((o, r) => {
167
167
  if (r === 0)
168
168
  s.push(1);
169
169
  else {
170
- const a = e.reduce((h, d) => `${h}${o[d] ?? ""}`, "") || o[t], l = e.reduce((h, d) => `${h}${c[r - 1][d] ?? ""}`, "") || c[r - 1][t];
171
- a === l ? (s[i] += 1, s.push(0)) : (s.push(1), i = r);
170
+ const a = e.reduce((l, d) => `${l}${o[d] ?? ""}`, "") || o[t], c = e.reduce((l, d) => `${l}${h[r - 1][d] ?? ""}`, "") || h[r - 1][t];
171
+ a === c ? (s[i] += 1, s.push(0)) : (s.push(1), i = r);
172
172
  }
173
173
  }), s;
174
174
  }
175
- function kt(c, t) {
175
+ function Xt(h, t) {
176
176
  let e = "", i = "";
177
177
  const s = {};
178
178
  return t.forEach((o, r) => {
179
- r === 0 ? (e = o.key, i = o.key, s[o.key] = 1) : c[o.key] === c[e] ? (s[o.key] = 0, s[i] += 1) : (s[o.key] = 1, e = o.key, i = o.key);
179
+ r === 0 ? (e = o.key, i = o.key, s[o.key] = 1) : h[o.key] === h[e] ? (s[o.key] = 0, s[i] += 1) : (s[o.key] = 1, e = o.key, i = o.key);
180
180
  }), s;
181
181
  }
182
- function le(c, t, e = []) {
183
- const { visibleRows: i, rowIndex: s, headIndex: o } = c, r = Dt(i, t, e);
182
+ function he(h, t, e = []) {
183
+ const { visibleRows: i, rowIndex: s, headIndex: o } = h, r = kt(i, t, e);
184
184
  return r[s - o] === 0 ? {
185
185
  rowspan: 0,
186
186
  colspan: 0,
@@ -193,10 +193,10 @@ function le(c, t, e = []) {
193
193
  mergeRow: !0
194
194
  };
195
195
  }
196
- function he(c, t = []) {
197
- const { column: e, row: i, visibleLeafColumns: s } = c, o = s.filter((r) => t.includes(r.key));
196
+ function de(h, t = []) {
197
+ const { column: e, row: i, visibleLeafColumns: s } = h, o = s.filter((r) => t.includes(r.key));
198
198
  if (t.includes(e.key)) {
199
- const r = kt(i, o);
199
+ const r = Xt(i, o);
200
200
  return r[e.key] === 0 ? {
201
201
  rowspan: 0,
202
202
  colspan: 0,
@@ -210,11 +210,69 @@ function he(c, t = []) {
210
210
  };
211
211
  }
212
212
  }
213
- function ce(c, t = document.documentElement) {
214
- const e = c.startsWith("--") ? c : `--${c}`;
213
+ function fe(h, t = document.documentElement) {
214
+ const e = h.startsWith("--") ? h : `--${h}`;
215
215
  return getComputedStyle(t).getPropertyValue(e).trim();
216
216
  }
217
- class Xt {
217
+ function bt(h) {
218
+ if (!h) return /* @__PURE__ */ new Date(0);
219
+ if (typeof h == "number")
220
+ return new Date(h);
221
+ const t = String(h).trim(), e = new Date(t);
222
+ if (!isNaN(e.getTime()))
223
+ return e;
224
+ const i = [
225
+ // YYYY-MM-DD
226
+ /^(\d{4})-(\d{1,2})-(\d{1,2})$/,
227
+ // YYYY/MM/DD
228
+ /^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,
229
+ // YYYY.MM.DD
230
+ /^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,
231
+ // DD-MM-YYYY
232
+ /^(\d{1,2})-(\d{1,2})-(\d{4})$/,
233
+ // DD/MM/YYYY
234
+ /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,
235
+ // DD.MM.YYYY
236
+ /^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,
237
+ // MM-DD-YYYY
238
+ /^(\d{1,2})-(\d{1,2})-(\d{4})$/,
239
+ // MM/DD/YYYY
240
+ /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,
241
+ // MM.DD.YYYY
242
+ /^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,
243
+ // YYYYMMDD
244
+ /^(\d{4})(\d{2})(\d{2})$/,
245
+ // 带时间的格式 YYYY-MM-DD HH:mm:ss
246
+ /^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,
247
+ // 带时间的格式 YYYY/MM/DD HH:mm:ss
248
+ /^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/
249
+ ];
250
+ for (const s of i) {
251
+ const o = t.match(s);
252
+ if (o) {
253
+ const r = o.slice(1).map(Number);
254
+ if (s.source.includes("YYYY-MM-DD") || s.source.includes("YYYY/MM/DD") || s.source.includes("YYYY.MM.DD")) {
255
+ const [a, c, l, d = 0, f = 0, u = 0] = r;
256
+ return new Date(a, c - 1, l, d, f, u);
257
+ } else if (s.source.includes("DD-MM-YYYY") || s.source.includes("DD/MM/YYYY") || s.source.includes("DD.MM.YYYY")) {
258
+ const [a, c, l, d = 0, f = 0, u = 0] = r;
259
+ return new Date(l, c - 1, a, d, f, u);
260
+ } else if (s.source.includes("MM-DD-YYYY") || s.source.includes("MM/DD/YYYY") || s.source.includes("MM.DD.YYYY")) {
261
+ const [a, c, l, d = 0, f = 0, u = 0] = r;
262
+ return new Date(l, a - 1, c, d, f, u);
263
+ } else if (s.source.includes("YYYYMMDD")) {
264
+ const [a, c, l] = r;
265
+ return new Date(a, c - 1, l);
266
+ }
267
+ }
268
+ }
269
+ return /* @__PURE__ */ new Date(NaN);
270
+ }
271
+ function xe(h, t) {
272
+ const e = bt(h), i = bt(t);
273
+ return isNaN(e.getTime()) && isNaN(i.getTime()) ? 0 : isNaN(e.getTime()) ? -1 : isNaN(i.getTime()) ? 1 : e.getTime() - i.getTime();
274
+ }
275
+ class Yt {
218
276
  constructor(t, e, i, s, o, r, a) {
219
277
  n(this, "ctx");
220
278
  n(this, "x", 0);
@@ -260,9 +318,9 @@ class Xt {
260
318
  getRightFixedX() {
261
319
  }
262
320
  }
263
- class $ extends Xt {
264
- constructor(e, i, s, o, r, a, l, h, d, f = "body") {
265
- super(e, o, r, a, l, f, h.fixed);
321
+ class xt extends Yt {
322
+ constructor(e, i, s, o, r, a, c, l, d, f = "body") {
323
+ super(e, o, r, a, c, f, l.fixed);
266
324
  n(this, "formatter");
267
325
  n(this, "formatterFooter");
268
326
  n(this, "hoverIconName", "");
@@ -337,7 +395,7 @@ class $ extends Xt {
337
395
  n(this, "selectorCellValueType", "value");
338
396
  n(this, "overflowTooltipMaxWidth", 500);
339
397
  n(this, "overflowTooltipPlacement", "top");
340
- this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = h.key, this.type = h.type || "", this.editorType = h.editorType || "text", this.selectorCellValueType = h.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = h.editorProps || {}, this.cellType = f, this.align = h.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = h.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = h.fixed, this.level = h.level || 0, this.operation = h.operation || !1, this.column = h, this.rules = h.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = h.render, this.overflowTooltipShow = h.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = h.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = h.overflowTooltipPlacement || "top", this.renderFooter = h.renderFooter, this.hoverIconName = h.hoverIconName, this.formatter = h.formatter, this.formatterFooter = h.formatterFooter, this.update();
398
+ this.visibleWidth = this.width, this.visibleHeight = this.height, this.colIndex = s, this.rowIndex = i, this.key = l.key, this.type = l.type || "", this.editorType = l.editorType || "text", this.selectorCellValueType = l.selectorCellValueType || this.ctx.config.SELECTOR_CELL_VALUE_TYPE || "value", this.editorProps = l.editorProps || {}, this.cellType = f, this.align = l.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = l.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = l.fixed, this.level = l.level || 0, this.operation = l.operation || !1, this.column = l, this.rules = l.rules || [], this.row = d, this.rowKey = this.cellType === "body" ? this.ctx.database.getRowKeyForRowIndex(i) : `${this.cellType}_${this.rowIndex}`, this.value = this.getValue(), this.render = l.render, this.overflowTooltipShow = l.overflowTooltipShow !== !1, this.overflowTooltipMaxWidth = l.overflowTooltipMaxWidth || 500, this.overflowTooltipPlacement = l.overflowTooltipPlacement || "top", this.renderFooter = l.renderFooter, this.hoverIconName = l.hoverIconName, this.formatter = l.formatter, this.formatterFooter = l.formatterFooter, this.update();
341
399
  }
342
400
  setWidthHeight(e, i) {
343
401
  this.width = e, this.height = i;
@@ -363,8 +421,8 @@ class $ extends Xt {
363
421
  rowspan: o = 1,
364
422
  relationRowKeys: r,
365
423
  relationColKeys: a,
366
- mergeRow: l = !1,
367
- mergeCol: h = !1
424
+ mergeRow: c = !1,
425
+ mergeCol: l = !1
368
426
  } = i({
369
427
  row: this.row,
370
428
  rowIndex: this.rowIndex,
@@ -377,7 +435,7 @@ class $ extends Xt {
377
435
  visibleLeafColumns: this.ctx.header.visibleLeafColumns,
378
436
  rows: this.ctx.body.data
379
437
  }) || {};
380
- Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(a) && a.length > 0 ? this.relationColKeys = a : this.relationColKeys = [this.key], this.mergeCol = h, this.mergeRow = l, this.colspan = s, this.rowspan = o, this.visibleWidth = this.getWidthByColIndexColSpan(this.colIndex, this.colspan), this.visibleHeight = this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex, this.rowspan);
438
+ Array.isArray(r) && r.length > 0 ? this.relationRowKeys = r : this.relationRowKeys = [this.key], Array.isArray(a) && a.length > 0 ? this.relationColKeys = a : this.relationColKeys = [this.key], this.mergeCol = l, this.mergeRow = c, this.colspan = s, this.rowspan = o, this.visibleWidth = this.getWidthByColIndexColSpan(this.colIndex, this.colspan), this.visibleHeight = this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex, this.rowspan);
381
439
  }
382
440
  }
383
441
  updateSpanInfo() {
@@ -451,31 +509,31 @@ class $ extends Xt {
451
509
  let o, r = 0, a = "";
452
510
  if (!(["tree", "selection-tree", "tree-selection"].includes(this.type) && s === "body"))
453
511
  return;
454
- const l = this.ctx.database.getRowForRowKey(i), { expand: h = !1, hasChildren: d = !1, expandLoading: f = !1, level: u = 0 } = l || {};
455
- this.rowExpand = h, this.rowHasChildren = d;
456
- const { TREE_INDENT: x = 16, CHECKBOX_SIZE: w, TREE_ICON_SIZE: E } = this.ctx.config;
512
+ const c = this.ctx.database.getRowForRowKey(i), { expand: l = !1, hasChildren: d = !1, expandLoading: f = !1, level: u = 0 } = c || {};
513
+ this.rowExpand = l, this.rowHasChildren = d;
514
+ const { TREE_INDENT: x = 16, CHECKBOX_SIZE: w, TREE_ICON_SIZE: m } = this.ctx.config;
457
515
  if (r = u * x, f) {
458
- const I = this.ctx.icons.get("loading");
459
- a = "loading", o = I;
516
+ const R = this.ctx.icons.get("loading");
517
+ a = "loading", o = R;
460
518
  } else if (d) {
461
- const I = this.ctx.icons.get("expand"), _ = this.ctx.icons.get("shrink");
462
- o = h ? _ : I, a = h ? "shrink" : "expand";
519
+ const R = this.ctx.icons.get("expand"), v = this.ctx.icons.get("shrink");
520
+ o = l ? v : R, a = l ? "shrink" : "expand";
463
521
  }
464
- let g = E, p = E, y = this.drawX;
522
+ let g = m, E = m, y = this.drawX;
465
523
  (this.align === "center" || this.align === "right") && (y = this.drawX + (this.visibleWidth - g - 2 * e) / 2, this.align = "left");
466
- let m = y + r + e, b = this.drawY + (this.visibleHeight - p) / 2, C = r + this.drawX + g - 0.5;
467
- this.type === "selection-tree" ? (m = r + this.drawSelectionImageX + this.drawSelectionImageWidth, C = m + g - e / 2) : this.type === "tree-selection" ? C = m + w + g - e / 2 : C = m + g - e / 2, this.drawTextX = C, this.drawTextWidth = this.drawX + this.visibleWidth - C, !(m + g + e > this.drawX + this.visibleWidth) && (b + p + e > this.drawY + this.visibleHeight || (this.drawTreeImageX = m, this.drawTreeImageY = b, this.drawTreeImageWidth = g, this.drawTreeImageHeight = p, o ? (this.drawTreeImageName = a, this.drawTreeImageSource = o) : (this.drawTreeImageName = "", this.drawTreeImageSource = void 0)));
524
+ let p = y + r + e, b = this.drawY + (this.visibleHeight - E) / 2, C = r + this.drawX + g - 0.5;
525
+ this.type === "selection-tree" ? (p = r + this.drawSelectionImageX + this.drawSelectionImageWidth, C = p + g - e / 2) : this.type === "tree-selection" ? C = p + w + g - e / 2 : C = p + g - e / 2, this.drawTextX = C, this.drawTextWidth = this.drawX + this.visibleWidth - C, !(p + g + e > this.drawX + this.visibleWidth) && (b + E + e > this.drawY + this.visibleHeight || (this.drawTreeImageX = p, this.drawTreeImageY = b, this.drawTreeImageWidth = g, this.drawTreeImageHeight = E, o ? (this.drawTreeImageName = a, this.drawTreeImageSource = o) : (this.drawTreeImageName = "", this.drawTreeImageSource = void 0)));
468
526
  }
469
527
  drawTreeLine() {
470
528
  const { TREE_LINE: e, TREE_INDENT: i = 16, TREE_ICON_SIZE: s = 16, TREE_LINE_COLOR: o = "#e1e6eb" } = this.ctx.config;
471
529
  if (!e || this.cellType !== "body" || !["tree", "selection-tree", "tree-selection"].includes(this.type) || this.rowspan === 0 || this.colspan === 0) return;
472
- const r = this.ctx.database.getRowForRowKey(this.rowKey) || {}, a = r.level ?? 0, l = this.drawTreeImageX + this.drawTreeImageWidth / 2, h = this.drawTreeImageY + this.drawTreeImageHeight / 2;
530
+ const r = this.ctx.database.getRowForRowKey(this.rowKey) || {}, a = r.level ?? 0, c = this.drawTreeImageX + this.drawTreeImageWidth / 2, l = this.drawTreeImageY + this.drawTreeImageHeight / 2;
473
531
  let d = this.drawTreeImageX - a * i;
474
532
  const f = Array.isArray(r.parentRowKeys) ? r.parentRowKeys : [];
475
533
  if (a > 0) {
476
534
  for (let g = 0; g < a - 1; g += 1) {
477
- const p = f[g + 1];
478
- if (!!(p ? this.ctx.database.getRowForRowKey(p) || {} : {}).isLastChild) continue;
535
+ const E = f[g + 1];
536
+ if (!!(E ? this.ctx.database.getRowForRowKey(E) || {} : {}).isLastChild) continue;
479
537
  const b = Math.round(this.drawTreeImageX - (a - g) * i + s / 2);
480
538
  this.ctx.paint.drawLine([b, this.drawY, b, this.drawY + this.visibleHeight], {
481
539
  borderColor: o,
@@ -484,15 +542,15 @@ class $ extends Xt {
484
542
  lineDashOffset: 0
485
543
  });
486
544
  }
487
- const u = Math.round(this.drawTreeImageX - i + s / 2), w = !!r.isLastChild ? h : this.drawY + this.visibleHeight;
545
+ const u = Math.round(this.drawTreeImageX - i + s / 2), w = !!r.isLastChild ? l : this.drawY + this.visibleHeight;
488
546
  this.ctx.paint.drawLine([u, this.drawY, u, w], {
489
547
  borderColor: o,
490
548
  borderWidth: 1,
491
549
  lineDash: [4, 4],
492
550
  lineDashOffset: 0
493
551
  });
494
- const E = Math.round(d + (a - 1) * i + s / 2);
495
- this.ctx.paint.drawLine([E, h, l, h], {
552
+ const m = Math.round(d + (a - 1) * i + s / 2);
553
+ this.ctx.paint.drawLine([m, l, c, l], {
496
554
  borderColor: o,
497
555
  borderWidth: 1,
498
556
  lineDash: [4, 4],
@@ -501,7 +559,7 @@ class $ extends Xt {
501
559
  }
502
560
  if (r.hasChildren && r.expand) {
503
561
  const u = this.drawTreeImageY + this.drawTreeImageHeight, x = u + Math.min(this.visibleHeight / 2, Math.max(8, s / 2));
504
- this.ctx.paint.drawLine([l, u, l, x], {
562
+ this.ctx.paint.drawLine([c, u, c, x], {
505
563
  borderColor: o,
506
564
  borderWidth: 1,
507
565
  lineDash: [4, 4],
@@ -517,41 +575,41 @@ class $ extends Xt {
517
575
  FOOTER_CELL_STYLE_METHOD: o,
518
576
  READONLY_TEXT_COLOR: r,
519
577
  BODY_TEXT_COLOR: a,
520
- FOOTER_TEXT_COLOR: l,
521
- FOOTER_BG_COLOR: h,
578
+ FOOTER_TEXT_COLOR: c,
579
+ FOOTER_BG_COLOR: l,
522
580
  HIGHLIGHT_SELECTED_ROW: d,
523
581
  HIGHLIGHT_SELECTED_ROW_COLOR: f,
524
582
  HIGHLIGHT_HOVER_ROW: u,
525
583
  HIGHLIGHT_HOVER_ROW_COLOR: x,
526
584
  STRIPE: w,
527
- STRIPE_COLOR: E
585
+ STRIPE_COLOR: m
528
586
  } = this.ctx.config;
529
587
  if (this.cellType === "footer") {
530
- let _ = h, T = l;
588
+ let v = l, T = c;
531
589
  if (typeof o == "function") {
532
- const v = o, { backgroundColor: R, color: S } = v({
590
+ const S = o, { backgroundColor: I, color: _ } = S({
533
591
  row: this.row,
534
592
  rowIndex: this.rowIndex,
535
593
  colIndex: this.colIndex,
536
594
  column: this.column,
537
595
  value: this.getValue()
538
596
  }) || {};
539
- R && (_ = R), S && (T = S);
597
+ I && (v = I), _ && (T = _);
540
598
  }
541
- this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = _, this.drawTextColor = T;
599
+ this.drawCellSkyBgColor = "transparent", this.drawCellBgColor = v, this.drawTextColor = T;
542
600
  return;
543
601
  }
544
602
  let g = "transparent";
545
- const p = this.ctx.hoverCell, y = this.ctx.currentCell;
546
- let m = this.rowIndex, b = this.rowIndex;
603
+ const E = this.ctx.hoverCell, y = this.ctx.currentCell;
604
+ let p = this.rowIndex, b = this.rowIndex;
547
605
  if (this.rowspan !== 1 && (u || d)) {
548
- const _ = this.getSpanInfo(), { yArr: T } = _;
549
- m = T[0], b = T[1];
606
+ const v = this.getSpanInfo(), { yArr: T } = v;
607
+ p = T[0], b = T[1];
550
608
  }
551
- u && p && (p.rowKey === this.rowKey && (g = x), p.rowIndex >= m && p.rowIndex <= b && (g = x)), d && y && (y.rowKey === this.rowKey && (g = f), y.rowIndex >= m && y.rowIndex <= b && (g = f)), this.drawCellSkyBgColor = g;
552
- let C = e, I = a;
553
- if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, I = r), w && (this.rowIndex % 2 ? C = E : C = e), typeof s == "function") {
554
- const _ = s, { backgroundColor: T, color: v } = _({
609
+ u && E && (E.rowKey === this.rowKey && (g = x), E.rowIndex >= p && E.rowIndex <= b && (g = x)), d && y && (y.rowKey === this.rowKey && (g = f), y.rowIndex >= p && y.rowIndex <= b && (g = f)), this.drawCellSkyBgColor = g;
610
+ let C = e, R = a;
611
+ if (this.ctx.database.getReadonly(this.rowKey, this.key) || (C = i, R = r), w && (this.rowIndex % 2 ? C = m : C = e), typeof s == "function") {
612
+ const v = s, { backgroundColor: T, color: S } = v({
555
613
  row: this.row,
556
614
  rowIndex: this.rowIndex,
557
615
  colIndex: this.colIndex,
@@ -559,60 +617,60 @@ class $ extends Xt {
559
617
  isHasChanged: this.isHasChanged,
560
618
  value: this.getValue()
561
619
  }) || {};
562
- T && (C = T), v && (I = v);
620
+ T && (C = T), S && (R = S);
563
621
  }
564
- this.drawCellBgColor = C, this.drawTextColor = I;
622
+ this.drawCellBgColor = C, this.drawTextColor = R;
565
623
  }
566
624
  updateSelection() {
567
- const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: l, rowKey: h } = this;
625
+ const { visibleWidth: e, visibleHeight: i, rowspan: s, colspan: o, cellType: r, type: a, rowIndex: c, rowKey: l } = this;
568
626
  if (s === 0 || o === 0 || r === "footer" || !["index-selection", "selection", "selection-tree", "tree-selection"].includes(a))
569
627
  return;
570
- const d = this.ctx.database.getRowSelectable(h), { CHECKBOX_SIZE: f = 0, CELL_PADDING: u } = this.ctx.config;
628
+ const d = this.ctx.database.getRowSelectable(l), { CHECKBOX_SIZE: f = 0, CELL_PADDING: u } = this.ctx.config;
571
629
  let x = this.drawX + u;
572
630
  (this.align === "center" || this.align === "right") && (x = this.drawX + (e - f) / 2);
573
- let w = x, E = this.drawY + (i - f) / 2;
631
+ let w = x, m = this.drawY + (i - f) / 2;
574
632
  if (a !== "selection-tree") {
575
633
  if (a === "tree-selection") {
576
- const { TREE_INDENT: y = 16, TREE_ICON_SIZE: m } = this.ctx.config, b = this.ctx.database.getRowForRowKey(h), { level: C = 0 } = b || {}, I = C * y;
577
- w = x + m + I;
634
+ const { TREE_INDENT: y = 16, TREE_ICON_SIZE: p } = this.ctx.config, b = this.ctx.database.getRowForRowKey(l), { level: C = 0 } = b || {}, R = C * y;
635
+ w = x + p + R;
578
636
  }
579
637
  }
580
- let g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck";
638
+ let g = this.ctx.icons.get("checkbox-uncheck"), E = "checkbox-uncheck";
581
639
  if (a === "selection-tree" || a === "tree-selection") {
582
- const y = this.ctx.database.getTreeSelectionState(h);
583
- y.indeterminate && d ? (g = this.ctx.icons.get("checkbox-indeterminate"), p = "checkbox-indeterminate") : y.checked && d ? (g = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : !y.checked && d ? (g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled");
640
+ const y = this.ctx.database.getTreeSelectionState(l);
641
+ y.indeterminate && d ? (g = this.ctx.icons.get("checkbox-indeterminate"), E = "checkbox-indeterminate") : y.checked && d ? (g = this.ctx.icons.get("checkbox-check"), E = "checkbox-check") : !y.checked && d ? (g = this.ctx.icons.get("checkbox-uncheck"), E = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), E = "checkbox-disabled");
584
642
  } else {
585
- const y = this.ctx.database.getRowSelection(h);
586
- y && d ? (g = this.ctx.icons.get("checkbox-check"), p = "checkbox-check") : y && !d ? (g = this.ctx.icons.get("checkbox-check-disabled"), p = "checkbox-check-disabled") : !y && d ? (g = this.ctx.icons.get("checkbox-uncheck"), p = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), p = "checkbox-disabled");
643
+ const y = this.ctx.database.getRowSelection(l);
644
+ y && d ? (g = this.ctx.icons.get("checkbox-check"), E = "checkbox-check") : y && !d ? (g = this.ctx.icons.get("checkbox-check-disabled"), E = "checkbox-check-disabled") : !y && d ? (g = this.ctx.icons.get("checkbox-uncheck"), E = "checkbox-uncheck") : (g = this.ctx.icons.get("checkbox-disabled"), E = "checkbox-disabled");
587
645
  }
588
- w + f + u > this.drawX + this.visibleWidth || E + f + u > this.drawY + this.visibleHeight || (a === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === l || ["checkbox-disabled", "checkbox-check"].includes(p)) && (this.drawSelectionImageX = w, this.drawSelectionImageY = E, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g) : (this.drawSelectionImageX = w, this.drawSelectionImageY = E, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = p, this.drawSelectionImageSource = g));
646
+ w + f + u > this.drawX + this.visibleWidth || m + f + u > this.drawY + this.visibleHeight || (a === "index-selection" ? (this.ctx.hoverCell && this.ctx.hoverCell.rowIndex === c || ["checkbox-disabled", "checkbox-check"].includes(E)) && (this.drawSelectionImageX = w, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = E, this.drawSelectionImageSource = g) : (this.drawSelectionImageX = w, this.drawSelectionImageY = m, this.drawSelectionImageWidth = f, this.drawSelectionImageHeight = f, this.drawSelectionImageName = E, this.drawSelectionImageSource = g));
589
647
  }
590
648
  updateHoverIcon() {
591
649
  if (this.ctx.database.getReadonly(this.rowKey, this.key))
592
650
  return;
593
651
  const { BODY_CELL_HOVER_ICON_METHOD: i, CELL_HOVER_ICON_SIZE: s, CELL_PADDING: o, ENABLE_MERGE_CELL_LINK: r } = this.ctx.config;
594
652
  if (typeof i == "function") {
595
- const h = i({
653
+ const l = i({
596
654
  row: this.row,
597
655
  rowIndex: this.rowIndex,
598
656
  colIndex: this.colIndex,
599
657
  column: this.column,
600
658
  value: this.getValue()
601
659
  });
602
- h !== void 0 && (this.hoverIconName = h);
660
+ l !== void 0 && (this.hoverIconName = l);
603
661
  }
604
662
  const { hoverCell: a } = this.ctx;
605
663
  if (this.hoverIconName && !this.ctx.editing && a) {
606
- let l = 0, h = 0;
607
- if (a.rowKey === this.rowKey && (l = this.drawX + this.width - s - o, h = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
664
+ let c = 0, l = 0;
665
+ if (a.rowKey === this.rowKey && (c = this.drawX + this.width - s - o, l = this.drawY + (this.height - s) / 2), this.rowspan !== 1 && r) {
608
666
  const f = this.getSpanInfo(), { yArr: u } = f, x = u[0], w = u[1];
609
667
  if (a.rowIndex >= x && a.rowIndex <= w) {
610
- const { width: E, height: g, offsetTop: p, offsetLeft: y } = f;
611
- l = this.drawX - y + E - s - o, h = this.drawY - p + (g - s) / 2;
668
+ const { width: m, height: g, offsetTop: E, offsetLeft: y } = f;
669
+ c = this.drawX - y + m - s - o, l = this.drawY - E + (g - s) / 2;
612
670
  }
613
671
  }
614
672
  const d = this.ctx.icons.get(this.hoverIconName);
615
- this.drawHoverImageX = l, this.drawHoverImageY = h, this.drawHoverImageWidth = s, this.drawHoverImageHeight = s, this.drawHoverImageName = this.hoverIconName, this.drawHoverImageSource = d;
673
+ this.drawHoverImageX = c, this.drawHoverImageY = l, this.drawHoverImageWidth = s, this.drawHoverImageHeight = s, this.drawHoverImageName = this.hoverIconName, this.drawHoverImageSource = d;
616
674
  }
617
675
  }
618
676
  // 过去跨度配置
@@ -707,10 +765,10 @@ class $ extends Xt {
707
765
  const { SELECT_BORDER_COLOR: e, ENABLE_AUTOFILL: i, ENABLE_SELECTOR: s, AUTOFILL_POINT_BORDER_COLOR: o } = this.ctx.config;
708
766
  if (!s || !i || this.ctx.editing)
709
767
  return;
710
- const { xArr: r, yArr: a } = this.ctx.selector, l = r[1], h = a[1], { colIndex: d, rowIndex: f, drawX: u, drawY: x } = this;
711
- if (d === l && f === h) {
712
- const E = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
713
- this.ctx.paint.drawRect(u + this.width - E, x + this.height - E, 6, 6, {
768
+ const { xArr: r, yArr: a } = this.ctx.selector, c = r[1], l = a[1], { colIndex: d, rowIndex: f, drawX: u, drawY: x } = this;
769
+ if (d === c && f === l) {
770
+ const m = d === this.ctx.maxColIndex || f === this.ctx.maxRowIndex || d === this.ctx.lastCenterColIndex ? 6 : 4;
771
+ this.ctx.paint.drawRect(u + this.width - m, x + this.height - m, 6, 6, {
714
772
  borderColor: o,
715
773
  fillColor: e
716
774
  });
@@ -742,13 +800,13 @@ class $ extends Xt {
742
800
  );
743
801
  this.ellipsis = o;
744
802
  const { placeholder: r } = this.column;
745
- let a = this.displayText, l = this.drawTextColor;
746
- return !this.ctx.database.getReadonly(this.rowKey, this.key) && r && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (a = r, l = s), this.ctx.paint.drawText(a, this.drawTextX, this.drawTextY, this.drawTextWidth, this.drawTextHeight, {
803
+ let a = this.displayText, c = this.drawTextColor;
804
+ return !this.ctx.database.getReadonly(this.rowKey, this.key) && r && ["", null, void 0].includes(this.text) && this.cellType === "body" && !(this.rowspan === 0 || this.colspan === 0) && (a = r, c = s), this.ctx.paint.drawText(a, this.drawTextX, this.drawTextY, this.drawTextWidth, this.drawTextHeight, {
747
805
  font: i,
748
806
  padding: e,
749
807
  align: this.align,
750
808
  verticalAlign: this.verticalAlign,
751
- color: l
809
+ color: c
752
810
  });
753
811
  }
754
812
  drawImage() {
@@ -814,11 +872,11 @@ class $ extends Xt {
814
872
  fillColor: "transparent",
815
873
  borderWidth: 1
816
874
  });
817
- const [a, l] = i, [h, d] = s;
818
- !(a === l && h === d) && this.colIndex >= a && this.colIndex <= l && this.rowIndex >= h && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.width, this.height, {
875
+ const [a, c] = i, [l, d] = s;
876
+ !(a === c && l === d) && this.colIndex >= a && this.colIndex <= c && this.rowIndex >= l && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.width, this.height, {
819
877
  borderColor: "transparent",
820
878
  fillColor: this.ctx.config.SELECT_AREA_COLOR || "rgba(82,146,247,0.1)"
821
- }), this.operation && this.rowIndex >= h && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.visibleWidth, this.visibleHeight, {
879
+ }), this.operation && this.rowIndex >= l && this.rowIndex <= d && this.ctx.paint.drawRect(this.drawX, this.drawY, this.visibleWidth, this.visibleHeight, {
822
880
  borderColor: "transparent",
823
881
  fillColor: this.ctx.config.SELECT_ROW_COL_BG_COLOR || "transparent"
824
882
  });
@@ -843,13 +901,13 @@ class $ extends Xt {
843
901
  });
844
902
  }
845
903
  drawBorder(e) {
846
- const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: l } = this;
847
- let h = i, d = s;
848
- const { xArr: f, yArr: u, lineDash: x = [], borderWidth: w = 1, borderColor: E, fillColor: g } = e, p = f[0], y = f[1], m = u[0], b = u[1];
849
- if (r >= p && r <= y && o === m) {
850
- const C = r === y ? 1 : 0, I = r === p ? 1 : 0;
851
- this.ctx.paint.drawLine([h + I, d + 1, h + l - C, d + 1], {
852
- borderColor: E,
904
+ const { drawX: i, drawY: s, rowIndex: o, colIndex: r, height: a, width: c } = this;
905
+ let l = i, d = s;
906
+ const { xArr: f, yArr: u, lineDash: x = [], borderWidth: w = 1, borderColor: m, fillColor: g } = e, E = f[0], y = f[1], p = u[0], b = u[1];
907
+ if (r >= E && r <= y && o === p) {
908
+ const C = r === y ? 1 : 0, R = r === E ? 1 : 0;
909
+ this.ctx.paint.drawLine([l + R, d + 1, l + c - C, d + 1], {
910
+ borderColor: m,
853
911
  fillColor: g,
854
912
  borderWidth: w,
855
913
  lineCap: "round",
@@ -857,10 +915,10 @@ class $ extends Xt {
857
915
  lineDash: x
858
916
  });
859
917
  }
860
- if (r === y && o >= m && o <= b) {
861
- const C = o === m ? 1 : 0, I = o === b ? 1 : 0;
862
- this.ctx.paint.drawLine([h + l - 1, d + C, h + l - 1, d + a - I], {
863
- borderColor: E,
918
+ if (r === y && o >= p && o <= b) {
919
+ const C = o === p ? 1 : 0, R = o === b ? 1 : 0;
920
+ this.ctx.paint.drawLine([l + c - 1, d + C, l + c - 1, d + a - R], {
921
+ borderColor: m,
864
922
  fillColor: g,
865
923
  borderWidth: w,
866
924
  lineCap: "round",
@@ -868,10 +926,10 @@ class $ extends Xt {
868
926
  lineDash: x
869
927
  });
870
928
  }
871
- if (r >= p && r <= y && o === b) {
872
- const C = r === y ? 1 : 0, I = r === p ? 1 : 0;
873
- this.ctx.paint.drawLine([h + I, d + a - 1, h + l - C, d + a - 1], {
874
- borderColor: E,
929
+ if (r >= E && r <= y && o === b) {
930
+ const C = r === y ? 1 : 0, R = r === E ? 1 : 0;
931
+ this.ctx.paint.drawLine([l + R, d + a - 1, l + c - C, d + a - 1], {
932
+ borderColor: m,
875
933
  fillColor: g,
876
934
  borderWidth: w,
877
935
  lineCap: "round",
@@ -879,10 +937,10 @@ class $ extends Xt {
879
937
  lineDash: x
880
938
  });
881
939
  }
882
- if (r === p && o >= m && o <= b) {
883
- const C = o === b ? 1 : 0, I = o === m ? 1 : 0;
884
- this.ctx.paint.drawLine([h + 1, d + I, h + 1, d + a - C], {
885
- borderColor: E,
940
+ if (r === E && o >= p && o <= b) {
941
+ const C = o === b ? 1 : 0, R = o === p ? 1 : 0;
942
+ this.ctx.paint.drawLine([l + 1, d + R, l + 1, d + a - C], {
943
+ borderColor: m,
886
944
  fillColor: g,
887
945
  borderWidth: w,
888
946
  lineCap: "round",
@@ -892,8 +950,7 @@ class $ extends Xt {
892
950
  }
893
951
  }
894
952
  }
895
- class de {
896
- //虚拟滚动位置
953
+ class ue {
897
954
  constructor(t, e) {
898
955
  n(this, "loading", !1);
899
956
  n(this, "ctx");
@@ -922,6 +979,8 @@ class de {
922
979
  n(this, "sumHeight", 0);
923
980
  n(this, "filterMethod");
924
981
  n(this, "positions", []);
982
+ //虚拟滚动位置
983
+ n(this, "sortState", /* @__PURE__ */ new Map());
925
984
  this.ctx = t;
926
985
  const { data: i = [], columns: s = [], footerData: o = [] } = e;
927
986
  this.data = i, this.footerData = o, this.columns = s, this.setLoading(!0), this.init();
@@ -929,7 +988,7 @@ class de {
929
988
  // 初始化默认不忽略清空改变值和校验map
930
989
  init(t = !0) {
931
990
  this.clearBufferData(), this.rowKeyMap.clear(), this.checkboxKeyMap.clear(), this.colIndexKeyMap.clear(), this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
932
- const e = this.getColumns(), i = it(e);
991
+ const e = this.getColumns(), i = et(e);
933
992
  if (this.ctx.hasSelection = i.some((s) => s.type === "selection"), this.ctx.hasTree = i.some((s) => s.type === "tree"), t) {
934
993
  this.originalDataMap.clear(), this.changedDataMap.clear(), this.validationErrorMap.clear();
935
994
  const { ROW_KEY: s } = this.ctx.config;
@@ -952,33 +1011,33 @@ class de {
952
1011
  const s = t.length;
953
1012
  t.forEach((o, r) => {
954
1013
  var y;
955
- const { ROW_KEY: a = "", DEFAULT_EXPAND_ALL: l, CELL_HEIGHT: h, SELECTABLE_METHOD: d, CHECKBOX_KEY: f } = this.ctx.config, u = o[a], x = u != null ? `${u}` : Lt();
1014
+ const { ROW_KEY: a = "", DEFAULT_EXPAND_ALL: c, CELL_HEIGHT: l, SELECTABLE_METHOD: d, CHECKBOX_KEY: f } = this.ctx.config, u = o[a], x = u != null ? `${u}` : At();
956
1015
  this.itemRowKeyMap.set(o, x);
957
- const w = o._height || h, E = o._readonly;
1016
+ const w = o._height || l, m = o._readonly;
958
1017
  let g = !0;
959
1018
  if (typeof d == "function" && (g = d), f) {
960
- const m = o[f];
961
- if (this.checkboxKeyMap.has(m)) {
962
- const b = this.checkboxKeyMap.get(m) || [];
963
- b.push(x), this.checkboxKeyMap.set(m, b);
1019
+ const p = o[f];
1020
+ if (this.checkboxKeyMap.has(p)) {
1021
+ const b = this.checkboxKeyMap.get(p) || [];
1022
+ b.push(x), this.checkboxKeyMap.set(p, b);
964
1023
  } else
965
- this.checkboxKeyMap.set(m, [x]);
1024
+ this.checkboxKeyMap.set(p, [x]);
966
1025
  }
967
1026
  this.selectionMap.set(x, {
968
1027
  key: f ? o[f] : x,
969
1028
  row: o,
970
1029
  check: ((y = this.selectionMap.get(x)) == null ? void 0 : y.check) || !1
971
1030
  });
972
- const p = l || this.expandMap.get(x) || o._expand || !1;
973
- this.expandMap.set(x, p), this.rowKeyMap.set(x, {
974
- readonly: E,
1031
+ const E = c || this.expandMap.get(x) || o._expand || !1;
1032
+ this.expandMap.set(x, E), this.rowKeyMap.set(x, {
1033
+ readonly: m,
975
1034
  index: r,
976
1035
  rowIndex: r,
977
1036
  level: e,
978
1037
  height: w,
979
1038
  check: !1,
980
1039
  selectable: g,
981
- expand: p,
1040
+ expand: E,
982
1041
  expandLazy: !1,
983
1042
  hasChildren: o._hasChildren || (Array.isArray(o.children) ? o.children.length > 0 : !1),
984
1043
  expandLoading: !1,
@@ -1002,17 +1061,11 @@ class de {
1002
1061
  s.height = e, s.item._height = e, this.clearBufferData();
1003
1062
  }
1004
1063
  /**
1005
- *
1064
+ * 获取所有行数据(平铺)
1006
1065
  * @returns 获取转化平铺数据
1007
1066
  */
1008
1067
  getAllRowsData() {
1009
- let t = [];
1010
- const e = (i) => {
1011
- i.forEach((s) => {
1012
- t.push(s), Array.isArray(s.children) && e(s.children);
1013
- });
1014
- };
1015
- return e(this.data), t;
1068
+ return [];
1016
1069
  }
1017
1070
  filterColumns(t) {
1018
1071
  return t.reduce((e, i) => {
@@ -1030,7 +1083,7 @@ class de {
1030
1083
  this.columns = t, this.clearBufferData();
1031
1084
  }
1032
1085
  setData(t) {
1033
- this.data = t, this.columns.length && this.init();
1086
+ this.data = t, this.setLoading(!0), this.init();
1034
1087
  }
1035
1088
  /**
1036
1089
  * 统一转化数据,给画body使用,包括过滤树状等,统一入口
@@ -1048,17 +1101,21 @@ class de {
1048
1101
  const i = (o) => {
1049
1102
  o.forEach((r) => {
1050
1103
  t.push(r);
1051
- const a = this.itemRowKeyMap.get(r), { expand: l, hasChildren: h, height: d } = this.rowKeyMap.get(a), f = this.sumHeight;
1104
+ const a = this.itemRowKeyMap.get(r), { expand: c, hasChildren: l, height: d } = this.rowKeyMap.get(a), f = this.sumHeight;
1052
1105
  this.sumHeight += d, this.rowIndexRowKeyMap.set(e, a), this.rowKeyRowIndexMap.set(a, e), this.positions.push({
1053
1106
  top: f,
1054
1107
  height: d,
1055
1108
  bottom: this.sumHeight
1056
- }), e += 1, l && h && i(r.children);
1109
+ }), e += 1, c && l && i(r.children);
1057
1110
  });
1058
1111
  };
1059
1112
  this.rowIndexRowKeyMap.clear(), this.rowKeyRowIndexMap.clear();
1060
1113
  let s = this.data;
1061
- return typeof this.filterMethod == "function" && (s = this.filterMethod(s)), i(s), this.bufferData = t, {
1114
+ if (typeof this.filterMethod == "function" && (s = this.filterMethod(s)), this.sortState.size) {
1115
+ const o = Array.from(this.sortState.entries()).sort((r, a) => r[1].timestamp - a[1].timestamp);
1116
+ s = this.sortDataRecursive(s, o);
1117
+ }
1118
+ return i(s), this.bufferData = t, {
1062
1119
  data: t,
1063
1120
  sumHeight: this.sumHeight,
1064
1121
  positions: this.positions
@@ -1082,6 +1139,64 @@ class de {
1082
1139
  clearFilterMethod() {
1083
1140
  this.filterMethod = void 0;
1084
1141
  }
1142
+ /**
1143
+ * 获取排序状态
1144
+ */
1145
+ getSortState(t) {
1146
+ return this.sortState.get(t) || { direction: "none", timestamp: 0 };
1147
+ }
1148
+ /**
1149
+ * 设置排序状态
1150
+ */
1151
+ setSortState(t, e) {
1152
+ const i = Date.now();
1153
+ this.ctx.config.SORT_STRICTLY && this.sortState.clear(), e === "none" ? this.sortState.delete(t) : this.sortState.set(t, { direction: e, timestamp: i }), this.ctx.emit("sortChange", this.sortState), this.clearBufferData(), this.ctx.emit("draw");
1154
+ }
1155
+ /**
1156
+ * 清除所有排序状态
1157
+ */
1158
+ clearSort() {
1159
+ this.sortState.clear(), this.ctx.emit("sortChange", this.sortState), this.clearBufferData(), this.ctx.emit("draw");
1160
+ }
1161
+ /**
1162
+ * 递归排序方法,支持树形数据
1163
+ * @param data 要排序的数据
1164
+ * @param sortedEntries 排序条目,按时间戳排序
1165
+ * @returns 排序后的数据
1166
+ */
1167
+ sortDataRecursive(t, e) {
1168
+ let i = [...t];
1169
+ for (const [s, { direction: o }] of e) {
1170
+ if (o === "none") continue;
1171
+ const r = this.getColumnByKey(s);
1172
+ !r || !r.column.sortBy || (i = this.applySingleColumnSort(i, s, o, r.column.sortBy));
1173
+ }
1174
+ return i.map((s) => (s.children && Array.isArray(s.children) && (s.children = this.sortDataRecursive(s.children, e)), s));
1175
+ }
1176
+ /**
1177
+ * 对数组进行单列排序
1178
+ * @param data 要排序的数据
1179
+ * @param key 排序的列键
1180
+ * @param direction 排序方向
1181
+ * @param sortBy 排序类型
1182
+ * @returns 排序后的数据
1183
+ */
1184
+ applySingleColumnSort(t, e, i, s) {
1185
+ return t.sort((o, r) => {
1186
+ const a = o[e], c = r[e];
1187
+ let l = 0;
1188
+ if (typeof s == "function")
1189
+ l = s(o, r);
1190
+ else if (s === "number") {
1191
+ const d = Number(a) || 0, f = Number(c) || 0;
1192
+ l = d - f;
1193
+ } else if (s === "string") {
1194
+ const d = String(a || ""), f = String(c || "");
1195
+ l = d.localeCompare(f);
1196
+ } else s === "date" && (l = xe(a, c));
1197
+ return i === "asc" ? l : -l;
1198
+ });
1199
+ }
1085
1200
  /**
1086
1201
  * 根据rowKey,控制指定展开行
1087
1202
  * @param rowKey
@@ -1191,39 +1306,39 @@ class de {
1191
1306
  async batchSetItemValue(t, e = !1, i = !0, s = "none") {
1192
1307
  let o = [], r = i;
1193
1308
  const a = /* @__PURE__ */ new Set();
1194
- let l = [], h = t.map((x) => {
1195
- const { rowKey: w, key: E } = x;
1196
- let g = x.value, p = g;
1197
- const y = this.getRowDataItemForRowKey(w), m = this.getItemValue(w, E), b = this.getVirtualBodyCellByKey(w, E);
1198
- return (b == null ? void 0 : b.type) === "number" && (["", void 0, null].includes(g) ? p = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? p = Number(g) : (p = m, l.push({
1309
+ let c = [], l = t.map((x) => {
1310
+ const { rowKey: w, key: m } = x;
1311
+ let g = x.value, E = g;
1312
+ const y = this.getRowDataItemForRowKey(w), p = this.getItemValue(w, m), b = this.getVirtualBodyCellByKey(w, m);
1313
+ return (b == null ? void 0 : b.type) === "number" && (["", void 0, null].includes(g) ? E = null : /^-?\d+(\.\d+)?$/.test(`${g}`) ? E = Number(g) : (E = p, c.push({
1199
1314
  ...x,
1200
- value: p,
1201
- oldValue: m,
1315
+ value: E,
1316
+ oldValue: p,
1202
1317
  row: y
1203
1318
  }))), {
1204
1319
  ...x,
1205
- value: p,
1206
- oldValue: m,
1320
+ value: E,
1321
+ oldValue: p,
1207
1322
  row: y
1208
1323
  };
1209
1324
  });
1210
- if (h = h.filter((x) => !l.some((w) => x.rowKey === w.rowKey && x.key === w.key)), l.length) {
1325
+ if (l = l.filter((x) => !c.some((w) => x.rowKey === w.rowKey && x.key === w.key)), c.length) {
1211
1326
  const x = {
1212
1327
  code: "ERR_BATCH_SET_NUMBER_VALUE",
1213
1328
  message: "Assignment failed, not a numeric type",
1214
- data: l
1329
+ data: c
1215
1330
  };
1216
1331
  this.ctx.emit("error", x);
1217
1332
  }
1218
- if (!h.length)
1333
+ if (!l.length)
1219
1334
  return;
1220
1335
  const { BEFORE_VALUE_CHANGE_METHOD: d } = this.ctx.config;
1221
- s === "none" && typeof d == "function" && (h = await d(h), r = !1), h.forEach((x) => {
1222
- const { value: w, rowKey: E, key: g } = x, p = this.getItemValue(E, g);
1223
- a.add(E), this.setItemValue(E, g, w, !1, !1, !1, r), o.push({
1224
- rowKey: E,
1336
+ s === "none" && typeof d == "function" && (l = await d(l), r = !1), l.forEach((x) => {
1337
+ const { value: w, rowKey: m, key: g } = x, E = this.getItemValue(m, g);
1338
+ a.add(m), this.setItemValue(m, g, w, !1, !1, !1, r), o.push({
1339
+ rowKey: m,
1225
1340
  key: g,
1226
- oldValue: p,
1341
+ oldValue: E,
1227
1342
  newValue: w
1228
1343
  });
1229
1344
  });
@@ -1231,10 +1346,10 @@ class de {
1231
1346
  a.forEach((x) => {
1232
1347
  f.push(this.ctx.database.getRowDataItemForRowKey(x));
1233
1348
  });
1234
- const u = h.map(({ rowKey: x, key: w }) => this.getValidator(x, w));
1349
+ const u = l.map(({ rowKey: x, key: w }) => this.getValidator(x, w));
1235
1350
  Promise.all(u).then(() => {
1236
1351
  this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1237
- }), this.ctx.emit("change", h, f), e && this.ctx.history.pushState({
1352
+ }), this.ctx.emit("change", l, f), e && this.ctx.history.pushState({
1238
1353
  changeList: o,
1239
1354
  scrollX: this.ctx.scrollX,
1240
1355
  scrollY: this.ctx.scrollY,
@@ -1255,16 +1370,16 @@ class de {
1255
1370
  async setItemValue(t, e, i, s = !1, o = !1, r = !1, a = !0) {
1256
1371
  if (!this.rowKeyMap.has(t))
1257
1372
  return {};
1258
- const { item: l } = this.rowKeyMap.get(t);
1259
- let h = l[e], d = i;
1373
+ const { item: c } = this.rowKeyMap.get(t);
1374
+ let l = c[e], d = i;
1260
1375
  if (a && this.ctx.database.getReadonly(t, e))
1261
1376
  return {
1262
- oldValue: h,
1263
- newValue: h
1377
+ oldValue: l,
1378
+ newValue: l
1264
1379
  };
1265
- l[e] !== null && typeof l[e] == "object" && (h = JSON.parse(JSON.stringify(l[e])));
1380
+ c[e] !== null && typeof c[e] == "object" && (l = JSON.parse(JSON.stringify(c[e])));
1266
1381
  const f = `${t}​_${e}`;
1267
- this.originalDataMap.has(f) || this.originalDataMap.set(f, h);
1382
+ this.originalDataMap.has(f) || this.originalDataMap.set(f, l);
1268
1383
  const u = this.originalDataMap.get(f), x = this.getRowDataItemForRowKey(t);
1269
1384
  if (r) {
1270
1385
  const w = this.getVirtualBodyCellByKey(t, e);
@@ -1274,7 +1389,7 @@ class de {
1274
1389
  else if (/^-?\d+(\.\d+)?$/.test(`${i}`))
1275
1390
  d = Number(i);
1276
1391
  else {
1277
- d = h;
1392
+ d = l;
1278
1393
  const g = {
1279
1394
  code: "ERR_SET_NUMBER_VALUE",
1280
1395
  message: "Assignment failed, not a numeric type",
@@ -1283,46 +1398,46 @@ class de {
1283
1398
  rowKey: t,
1284
1399
  key: e,
1285
1400
  value: d,
1286
- oldValue: h,
1401
+ oldValue: l,
1287
1402
  row: x
1288
1403
  }
1289
1404
  ]
1290
1405
  };
1291
1406
  this.ctx.emit("error", g);
1292
1407
  }
1293
- if (d === h)
1408
+ if (d === l)
1294
1409
  return {
1295
- oldValue: h,
1296
- newValue: h
1410
+ oldValue: l,
1411
+ newValue: l
1297
1412
  };
1298
- let E = [
1413
+ let m = [
1299
1414
  {
1300
1415
  rowKey: t,
1301
1416
  key: e,
1302
1417
  value: d,
1303
- oldValue: h,
1418
+ oldValue: l,
1304
1419
  row: x
1305
1420
  }
1306
1421
  ];
1307
- this.batchSetItemValue(E, s, !1), this.ctx.emit("editChange", {
1422
+ this.batchSetItemValue(m, s, !1), this.ctx.emit("editChange", {
1308
1423
  rowKey: t,
1309
1424
  key: e,
1310
- oldValue: h,
1425
+ oldValue: l,
1311
1426
  value: d,
1312
1427
  originalValue: u,
1313
1428
  row: x
1314
1429
  });
1315
1430
  } else
1316
- this.changedDataMap.set(f, d), l[e] = d;
1431
+ this.changedDataMap.set(f, d), c[e] = d;
1317
1432
  return this.ctx.hasEvent("iterationChange") && this.ctx.emit("iterationChange", {
1318
1433
  rowKey: t,
1319
1434
  key: e,
1320
- oldValue: h,
1435
+ oldValue: l,
1321
1436
  value: d,
1322
1437
  originalValue: this.originalDataMap.get(f),
1323
1438
  row: x
1324
1439
  }), o && this.ctx.emit("draw"), {
1325
- oldValue: h,
1440
+ oldValue: l,
1326
1441
  newValue: d
1327
1442
  };
1328
1443
  }
@@ -1349,8 +1464,8 @@ class de {
1349
1464
  return !1;
1350
1465
  const { item: s } = this.rowKeyMap.get(t), o = s[i];
1351
1466
  this.checkboxKeyMap.has(o) && (this.checkboxKeyMap.get(o) || []).forEach((a) => {
1352
- const l = this.selectionMap.get(a);
1353
- l && (l.check = e);
1467
+ const c = this.selectionMap.get(a);
1468
+ c && (c.check = e);
1354
1469
  });
1355
1470
  }
1356
1471
  }
@@ -1396,11 +1511,11 @@ class de {
1396
1511
  const e = this.getTreeParent(t);
1397
1512
  if (!e)
1398
1513
  return;
1399
- const s = this.getTreeChildren(e).map((h) => this.selectionMap.get(h)), o = s.filter((h) => h == null ? void 0 : h.check).length, r = s.length;
1514
+ const s = this.getTreeChildren(e).map((l) => this.selectionMap.get(l)), o = s.filter((l) => l == null ? void 0 : l.check).length, r = s.length;
1400
1515
  let a = !1;
1401
1516
  r > 0 && (o === 0 ? a = !1 : o === r || this.ctx.config.TREE_SELECT_MODE === "auto" ? a = !0 : this.ctx.config.TREE_SELECT_MODE === "cautious" && (a = !1));
1402
- const l = this.selectionMap.get(e);
1403
- l && l.check !== a && (l.check = a, this.setRowSelectionByCheckboxKey(e, a), this.updateParentTreeSelection(e));
1517
+ const c = this.selectionMap.get(e);
1518
+ c && c.check !== a && (c.check = a, this.setRowSelectionByCheckboxKey(e, a), this.updateParentTreeSelection(e));
1404
1519
  }
1405
1520
  /**
1406
1521
  * 根据rowKey 设置选中状态
@@ -1433,23 +1548,23 @@ class de {
1433
1548
  return { checked: s, indeterminate: !1 };
1434
1549
  let r = !1, a = s;
1435
1550
  if (this.ctx.config.TREE_SELECT_MODE === "auto") {
1436
- const h = (g) => {
1437
- const p = this.getTreeChildren(g);
1551
+ const l = (g) => {
1552
+ const E = this.getTreeChildren(g);
1438
1553
  let y = [];
1439
- for (const m of p)
1440
- y.push(m), y.push(...h(m));
1554
+ for (const p of E)
1555
+ y.push(p), y.push(...l(p));
1441
1556
  return y;
1442
- }, f = h(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0;
1557
+ }, f = l(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0;
1443
1558
  r = w && !(u === x), a = s || w, s && x > 0 && u === 0 && (a = !1, r = !1);
1444
1559
  } else if (this.ctx.config.TREE_SELECT_MODE === "cautious") {
1445
- const h = (g) => {
1446
- const p = this.getTreeChildren(g);
1560
+ const l = (g) => {
1561
+ const E = this.getTreeChildren(g);
1447
1562
  let y = [];
1448
- for (const m of p)
1449
- y.push(m), y.push(...h(m));
1563
+ for (const p of E)
1564
+ y.push(p), y.push(...l(p));
1450
1565
  return y;
1451
- }, f = h(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0, E = u === x;
1452
- r = w && !E, a = s || E, s && x > 0 && u === 0 && (a = !1, r = !1);
1566
+ }, f = l(t).map((g) => this.selectionMap.get(g)), u = f.filter((g) => g == null ? void 0 : g.check).length, x = f.length, w = u > 0, m = u === x;
1567
+ r = w && !m, a = s || m, s && x > 0 && u === 0 && (a = !1, r = !1);
1453
1568
  } else this.ctx.config.TREE_SELECT_MODE === "strictly" && (r = !1, a = s);
1454
1569
  return { checked: a, indeterminate: r };
1455
1570
  }
@@ -1475,9 +1590,9 @@ class de {
1475
1590
  for (const a of o.children) {
1476
1591
  if (this.getRowKeyByItem(a) === s)
1477
1592
  return r;
1478
- const h = e(o.children, s);
1479
- if (h)
1480
- return h;
1593
+ const l = e(o.children, s);
1594
+ if (l)
1595
+ return l;
1481
1596
  }
1482
1597
  }
1483
1598
  return null;
@@ -1552,23 +1667,23 @@ class de {
1552
1667
  let s = 0, o = 0;
1553
1668
  const r = this.selectionMap.size, a = Array.from(this.selectionMap.values()).some((u) => u.check);
1554
1669
  this.rowKeyMap.forEach((u, x) => {
1555
- var E;
1556
- (E = this.selectionMap.get(x)) != null && E.check && (s += 1);
1670
+ var m;
1671
+ (m = this.selectionMap.get(x)) != null && m.check && (s += 1);
1557
1672
  let w = u.selectable;
1558
1673
  typeof w == "function" && (w = w({
1559
1674
  row: u.item,
1560
1675
  rowIndex: u.rowIndex
1561
1676
  })), w && (o += 1);
1562
1677
  });
1563
- const l = r > i && s === 0 && a, h = o && o > s && s > 0 || l, d = o !== 0, f = !!o && o === s;
1678
+ const c = r > i && s === 0 && a, l = o && o > s && s > 0 || c, d = o !== 0, f = !!o && o === s;
1564
1679
  return this.bufferCheckState = {
1565
1680
  buffer: !0,
1566
1681
  check: f,
1567
- indeterminate: h,
1682
+ indeterminate: l,
1568
1683
  selectable: d
1569
1684
  }, {
1570
1685
  check: f,
1571
- indeterminate: h,
1686
+ indeterminate: l,
1572
1687
  selectable: d
1573
1688
  };
1574
1689
  }
@@ -1659,9 +1774,9 @@ class de {
1659
1774
  const s = this.rowKeyMap.get(t), o = this.headerMap.get(e);
1660
1775
  if (!s || !o)
1661
1776
  return !0;
1662
- const r = s.readonly, a = o.readonly, { BODY_CELL_READONLY_METHOD: l } = this.ctx.config;
1663
- if (typeof l == "function" && o) {
1664
- const d = l({
1777
+ const r = s.readonly, a = o.readonly, { BODY_CELL_READONLY_METHOD: c } = this.ctx.config;
1778
+ if (typeof c == "function" && o) {
1779
+ const d = c({
1665
1780
  row: s.item,
1666
1781
  rowIndex: s.rowIndex,
1667
1782
  colIndex: o.colIndex,
@@ -1685,7 +1800,7 @@ class de {
1685
1800
  if (o === void 0)
1686
1801
  return i([]);
1687
1802
  const a = o.column;
1688
- let l = a.rules;
1803
+ let c = a.rules;
1689
1804
  if (typeof r == "function") {
1690
1805
  const d = r({
1691
1806
  row: s.item,
@@ -1694,10 +1809,10 @@ class de {
1694
1809
  column: a,
1695
1810
  value: this.getItemValue(t, e)
1696
1811
  });
1697
- d && (l = d);
1812
+ d && (c = d);
1698
1813
  }
1699
- if (l) {
1700
- const h = {
1814
+ if (c) {
1815
+ const l = {
1701
1816
  row: s.item,
1702
1817
  rowIndex: s.rowIndex,
1703
1818
  colIndex: o.colIndex,
@@ -1707,7 +1822,7 @@ class de {
1707
1822
  value: this.getItemValue(t, e),
1708
1823
  field: e,
1709
1824
  fieldValue: this.getItemValue(t, e)
1710
- }, f = new se(l).validate(h);
1825
+ }, f = new re(c).validate(l);
1711
1826
  this.setValidationError(t, e, f), i(f);
1712
1827
  } else
1713
1828
  this.clearValidationError(t, e), i([]);
@@ -1729,14 +1844,14 @@ class de {
1729
1844
  row: o,
1730
1845
  value: r,
1731
1846
  colIndex: a,
1732
- relationRowKeys: l,
1733
- relationColKeys: h,
1847
+ relationRowKeys: c,
1848
+ relationColKeys: l,
1734
1849
  rowspan: d,
1735
1850
  height: f,
1736
1851
  width: u,
1737
1852
  colspan: x,
1738
1853
  mergeRow: w,
1739
- mergeCol: E
1854
+ mergeCol: m
1740
1855
  } = t;
1741
1856
  if (d === 1 && x === 1)
1742
1857
  return {
@@ -1757,98 +1872,98 @@ class de {
1757
1872
  }
1758
1873
  ]
1759
1874
  };
1760
- let g = e, p = e, y = a, m = a, b = [], C = 0, I = 0, _ = 0, T = 0;
1875
+ let g = e, E = e, y = a, p = a, b = [], C = 0, R = 0, v = 0, T = 0;
1761
1876
  if (d !== 1 && w) {
1762
1877
  T = u;
1763
- const v = l.reduce((R, S) => {
1764
- const O = this.getItemValue(s, S) ?? "";
1765
- return `${R}${O}`;
1878
+ const S = c.reduce((I, _) => {
1879
+ const O = this.getItemValue(s, _) ?? "";
1880
+ return `${I}${O}`;
1766
1881
  }, "");
1767
- for (let R = e - 1; R >= 0; R--) {
1768
- const S = this.rowIndexRowKeyMap.get(R) || "", O = l.reduce((M, L) => {
1769
- const H = this.getItemValue(S, L) ?? "";
1770
- return `${M}${H}`;
1882
+ for (let I = e - 1; I >= 0; I--) {
1883
+ const _ = this.rowIndexRowKeyMap.get(I) || "", O = c.reduce((A, L) => {
1884
+ const H = this.getItemValue(_, L) ?? "";
1885
+ return `${A}${H}`;
1771
1886
  }, "");
1772
- if (v === O)
1773
- g = R;
1887
+ if (S === O)
1888
+ g = I;
1774
1889
  else
1775
1890
  break;
1776
1891
  }
1777
- for (let R = e; R <= this.ctx.maxRowIndex; R++) {
1778
- const S = this.rowIndexRowKeyMap.get(R) || "", O = l.reduce((M, L) => {
1779
- const H = this.getItemValue(S, L) ?? "";
1780
- return `${M}${H}`;
1892
+ for (let I = e; I <= this.ctx.maxRowIndex; I++) {
1893
+ const _ = this.rowIndexRowKeyMap.get(I) || "", O = c.reduce((A, L) => {
1894
+ const H = this.getItemValue(_, L) ?? "";
1895
+ return `${A}${H}`;
1781
1896
  }, "");
1782
- if (v === O)
1783
- p = R;
1897
+ if (S === O)
1898
+ E = I;
1784
1899
  else
1785
1900
  break;
1786
1901
  }
1787
- for (let R = g; R < e; R++) {
1788
- const { height: S } = this.positions[R];
1789
- C += S;
1902
+ for (let I = g; I < e; I++) {
1903
+ const { height: _ } = this.positions[I];
1904
+ C += _;
1790
1905
  }
1791
- for (let R = g; R <= p; R++) {
1792
- const { height: S } = this.positions[R];
1793
- _ += S;
1794
- const O = this.rowIndexRowKeyMap.get(R) || "", { item: M } = this.rowKeyMap.get(O), L = this.getItemValue(O, i);
1906
+ for (let I = g; I <= E; I++) {
1907
+ const { height: _ } = this.positions[I];
1908
+ v += _;
1909
+ const O = this.rowIndexRowKeyMap.get(I) || "", { item: A } = this.rowKeyMap.get(O), L = this.getItemValue(O, i);
1795
1910
  b.push({
1796
1911
  rowKey: O,
1797
1912
  key: i,
1798
1913
  value: L,
1799
- row: M
1914
+ row: A
1800
1915
  });
1801
1916
  }
1802
1917
  }
1803
- if (x !== 1 && E) {
1804
- _ = f;
1805
- for (let v = a - 1; v >= 0; v--) {
1806
- const R = this.getColumnByColIndex(v);
1807
- if (!R)
1918
+ if (x !== 1 && m) {
1919
+ v = f;
1920
+ for (let S = a - 1; S >= 0; S--) {
1921
+ const I = this.getColumnByColIndex(S);
1922
+ if (!I)
1808
1923
  break;
1809
- const S = this.getItemValue(s, i), O = this.getItemValue(s, R.key);
1810
- if (S === O && h.includes(R.key))
1811
- y = v;
1924
+ const _ = this.getItemValue(s, i), O = this.getItemValue(s, I.key);
1925
+ if (_ === O && l.includes(I.key))
1926
+ y = S;
1812
1927
  else
1813
1928
  break;
1814
1929
  }
1815
- for (let v = a; v <= this.ctx.maxColIndex; v++) {
1816
- const R = this.getColumnByColIndex(v);
1817
- if (!R)
1930
+ for (let S = a; S <= this.ctx.maxColIndex; S++) {
1931
+ const I = this.getColumnByColIndex(S);
1932
+ if (!I)
1818
1933
  break;
1819
- const S = this.getItemValue(s, i), O = this.getItemValue(s, R.key);
1820
- if (S === O && h.includes(R.key))
1821
- m = v;
1934
+ const _ = this.getItemValue(s, i), O = this.getItemValue(s, I.key);
1935
+ if (_ === O && l.includes(I.key))
1936
+ p = S;
1822
1937
  else
1823
1938
  break;
1824
1939
  }
1825
- for (let v = y; v < a; v++) {
1826
- const R = this.getColumnByColIndex(v);
1827
- if (!R)
1940
+ for (let S = y; S < a; S++) {
1941
+ const I = this.getColumnByColIndex(S);
1942
+ if (!I)
1828
1943
  break;
1829
- I += R.width || 100;
1944
+ R += I.width || 100;
1830
1945
  }
1831
- for (let v = y; v <= m; v++) {
1832
- const R = this.getColumnByColIndex(v);
1833
- if (!R)
1946
+ for (let S = y; S <= p; S++) {
1947
+ const I = this.getColumnByColIndex(S);
1948
+ if (!I)
1834
1949
  break;
1835
- T += R.width || 100, b.push({
1950
+ T += I.width || 100, b.push({
1836
1951
  rowKey: s,
1837
- key: R.key,
1838
- value: this.getItemValue(s, R.key),
1952
+ key: I.key,
1953
+ value: this.getItemValue(s, I.key),
1839
1954
  row: o
1840
1955
  });
1841
1956
  }
1842
1957
  }
1843
1958
  return {
1844
- xArr: [y, m],
1845
- yArr: [g, p],
1959
+ xArr: [y, p],
1960
+ yArr: [g, E],
1846
1961
  rowspan: d,
1847
1962
  colspan: x,
1848
- height: _,
1963
+ height: v,
1849
1964
  width: T,
1850
1965
  offsetTop: C,
1851
- offsetLeft: I,
1966
+ offsetLeft: R,
1852
1967
  dataList: b
1853
1968
  };
1854
1969
  }
@@ -1862,7 +1977,7 @@ class de {
1862
1977
  const s = this.rowIndexRowKeyMap.get(t), o = `${s}​_${e}`, r = this.getRowForRowIndex(t), a = this.getColumnByKey(e);
1863
1978
  if (!s || !a || !r)
1864
1979
  return;
1865
- const l = this.getItemValue(s, e), h = [
1980
+ const c = this.getItemValue(s, e), l = [
1866
1981
  {
1867
1982
  key: e,
1868
1983
  rowKey: s,
@@ -1870,13 +1985,13 @@ class de {
1870
1985
  colIndex: a.colIndex,
1871
1986
  column: a.column,
1872
1987
  row: r,
1873
- value: l,
1988
+ value: c,
1874
1989
  message: i,
1875
1990
  field: e,
1876
- fieldValue: l
1991
+ fieldValue: c
1877
1992
  }
1878
1993
  ];
1879
- this.validationErrorMap.set(o, h);
1994
+ this.validationErrorMap.set(o, l);
1880
1995
  }
1881
1996
  setValidationError(t, e, i) {
1882
1997
  const s = `${t}​_${e}`;
@@ -1893,7 +2008,7 @@ class de {
1893
2008
  // 获取虚拟单元格,只针对可见的
1894
2009
  getVirtualBodyCell(t, e) {
1895
2010
  const i = this.getColumnByColIndex(e), s = this.getRowForRowIndex(t);
1896
- return !i || !s ? void 0 : new $(this.ctx, t, e, 0, 0, 0, 0, i, s.item, "body");
2011
+ return !i || !s ? void 0 : new xt(this.ctx, t, e, 0, 0, 0, 0, i, s.item, "body");
1897
2012
  }
1898
2013
  getVirtualBodyCellByKey(t, e) {
1899
2014
  const i = this.getRowIndexForRowKey(t), s = this.getColIndexForKey(e);
@@ -1928,7 +2043,7 @@ class de {
1928
2043
  }), i;
1929
2044
  }
1930
2045
  }
1931
- class fe {
2046
+ class ge {
1932
2047
  constructor(t) {
1933
2048
  n(this, "ctx");
1934
2049
  n(this, "history", []);
@@ -1983,7 +2098,7 @@ class fe {
1983
2098
  this.history = [], this.historyIndex = -1;
1984
2099
  }
1985
2100
  }
1986
- class xe {
2101
+ class we {
1987
2102
  constructor(t) {
1988
2103
  n(this, "eventTasks", /* @__PURE__ */ new Map());
1989
2104
  n(this, "ctx");
@@ -2059,7 +2174,7 @@ class xe {
2059
2174
  t.removeEventListener(e, i), this.eventTasks.delete(e);
2060
2175
  }
2061
2176
  }
2062
- class ue {
2177
+ class me {
2063
2178
  constructor() {
2064
2179
  n(this, "events", /* @__PURE__ */ new Map());
2065
2180
  }
@@ -2097,7 +2212,7 @@ class ue {
2097
2212
  this.events.clear();
2098
2213
  }
2099
2214
  }
2100
- class ge {
2215
+ class Ee {
2101
2216
  constructor(t) {
2102
2217
  n(this, "ctx");
2103
2218
  const e = t.getContext("2d");
@@ -2107,6 +2222,9 @@ class ge {
2107
2222
  scale(t) {
2108
2223
  this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.ctx.scale(t, t);
2109
2224
  }
2225
+ measureTextWidth(t, e) {
2226
+ return this.ctx.font = e, this.ctx.measureText(t).width;
2227
+ }
2110
2228
  save() {
2111
2229
  this.ctx.save();
2112
2230
  }
@@ -2133,21 +2251,21 @@ class ge {
2133
2251
  * @param {string} color - 阴影的颜色
2134
2252
  */
2135
2253
  drawShadow(t, e, i, s, o) {
2136
- const { fillColor: r, side: a, shadowWidth: l, colorStart: h, colorEnd: d } = o;
2254
+ const { fillColor: r, side: a, shadowWidth: c, colorStart: l, colorEnd: d } = o;
2137
2255
  this.ctx.save(), r && (this.ctx.fillStyle = r, this.ctx.fillRect(t, e, i, s));
2138
2256
  let f;
2139
2257
  switch (a) {
2140
2258
  case "left":
2141
- f = this.ctx.createLinearGradient(t - l, e, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t - l, e, l, s);
2259
+ f = this.ctx.createLinearGradient(t - c, e, t, e), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t - c, e, c, s);
2142
2260
  break;
2143
2261
  case "right":
2144
- f = this.ctx.createLinearGradient(t + i, e, t + i + l, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t + i, e, l, s);
2262
+ f = this.ctx.createLinearGradient(t + i, e, t + i + c, e), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t + i, e, c, s);
2145
2263
  break;
2146
2264
  case "top":
2147
- f = this.ctx.createLinearGradient(t, e - l, t, e), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e - l, i, l);
2265
+ f = this.ctx.createLinearGradient(t, e - c, t, e), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e - c, i, c);
2148
2266
  break;
2149
2267
  case "bottom":
2150
- f = this.ctx.createLinearGradient(t, e + s, t, e + s + l), f.addColorStop(0, h), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e + s, i, l);
2268
+ f = this.ctx.createLinearGradient(t, e + s, t, e + s + c), f.addColorStop(0, l), f.addColorStop(1, d), this.ctx.fillStyle = f, this.ctx.fillRect(t, e + s, i, c);
2151
2269
  break;
2152
2270
  default:
2153
2271
  console.error("Invalid side specified for shadow");
@@ -2168,12 +2286,12 @@ class ge {
2168
2286
  drawImage(t, e, i, s, o) {
2169
2287
  this.ctx.save(), this.ctx.drawImage(t, e, i, s, o), this.ctx.restore();
2170
2288
  }
2171
- drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: a, radius: l = 0 } = {}) {
2172
- if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), r !== void 0 && (this.ctx.lineWidth = o, this.ctx.strokeStyle = r), l === 0)
2289
+ drawRect(t, e, i, s, { borderWidth: o = 1, borderColor: r, fillColor: a, radius: c = 0 } = {}) {
2290
+ if (this.ctx.save(), this.ctx.beginPath(), a !== void 0 && (this.ctx.fillStyle = a), r !== void 0 && (this.ctx.lineWidth = o, this.ctx.strokeStyle = r), c === 0)
2173
2291
  this.ctx.rect(t - 0.5, e - 0.5, i, s);
2174
2292
  else {
2175
- const [h, d, f, u] = typeof l == "number" ? [l, l, l, l] : l;
2176
- this.ctx.moveTo(t + h, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s - u, u), this.ctx.arcTo(t, e, t + h, e, h);
2293
+ const [l, d, f, u] = typeof c == "number" ? [c, c, c, c] : c;
2294
+ this.ctx.moveTo(t + l, e), this.ctx.arcTo(t + i, e, t + i, e + d, d), this.ctx.arcTo(t + i, e + s, t + i - f, e + s, f), this.ctx.arcTo(t, e + s, t, e + s - u, u), this.ctx.arcTo(t, e, t + l, e, l);
2177
2295
  }
2178
2296
  a !== void 0 && this.ctx.fill(), r !== void 0 && this.ctx.stroke(), this.ctx.restore();
2179
2297
  }
@@ -2191,18 +2309,18 @@ class ge {
2191
2309
  this.ctx.save();
2192
2310
  const {
2193
2311
  font: a = "12px Arial",
2194
- align: l = "center",
2195
- color: h = "#495060",
2312
+ align: c = "center",
2313
+ color: l = "#495060",
2196
2314
  padding: d = 0,
2197
2315
  verticalAlign: f = "middle"
2198
2316
  } = r;
2199
- this.ctx.font = a, this.ctx.fillStyle = h, this.ctx.textBaseline = f, this.ctx.textAlign = l;
2317
+ this.ctx.font = a, this.ctx.fillStyle = l, this.ctx.textBaseline = f, this.ctx.textAlign = c;
2200
2318
  let u = 0;
2201
2319
  f === "top" ? u = i + d : f === "bottom" ? u = i + o - d : u = i + (o + 1) / 2;
2202
2320
  let x = 0;
2203
- l === "left" ? x = e + d : l === "right" ? x = e + s - d : x = e + s / 2;
2204
- const { _text: w, ellipsis: E } = this.handleEllipsis(t, s, d, a);
2205
- return this.ctx.fillText(w, x, u), this.ctx.restore(), E;
2321
+ c === "left" ? x = e + d : c === "right" ? x = e + s - d : x = e + s / 2;
2322
+ const { _text: w, ellipsis: m } = this.handleEllipsis(t, s, d, a);
2323
+ return this.ctx.fillText(w, x, u), this.ctx.restore(), m;
2206
2324
  }
2207
2325
  handleEllipsis(t, e, i = 0, s = "12px Arial") {
2208
2326
  let o = !1, r = t;
@@ -2217,12 +2335,12 @@ class ge {
2217
2335
  _text: "",
2218
2336
  ellipsis: !0
2219
2337
  };
2220
- const l = this.ctx.measureText(t).width;
2221
- if (l && l + a >= e - i * 2) {
2338
+ const c = this.ctx.measureText(t).width;
2339
+ if (c && c + a >= e - i * 2) {
2222
2340
  o = !0;
2223
- let h = 0;
2341
+ let l = 0;
2224
2342
  for (let d = 0; d < t.length; d++)
2225
- if (h += this.ctx.measureText(t[d]).width, h >= e - i * 2 - a) {
2343
+ if (l += this.ctx.measureText(t[d]).width, l >= e - i * 2 - a) {
2226
2344
  r = t.slice(0, d) + "...";
2227
2345
  break;
2228
2346
  }
@@ -2233,7 +2351,7 @@ class ge {
2233
2351
  };
2234
2352
  }
2235
2353
  }
2236
- class Ct {
2354
+ class It {
2237
2355
  constructor(t) {
2238
2356
  n(this, "_config", {});
2239
2357
  /** CSS 类名前缀 */
@@ -2361,6 +2479,16 @@ class Ct {
2361
2479
  n(this, "CHECKBOX_UNCHECK_SVG", "");
2362
2480
  /** 选择框半选中图标 */
2363
2481
  n(this, "CHECKBOX_INDETERMINATE_SVG", "");
2482
+ /** 启用严格排序,即不支持多列排序 */
2483
+ n(this, "SORT_STRICTLY", !0);
2484
+ /** 排序升序图标 */
2485
+ n(this, "SORT_ASC_ICON_SVG", "");
2486
+ /** 排序降序图标 */
2487
+ n(this, "SORT_DESC_ICON_SVG", "");
2488
+ /** 排序默认图标 */
2489
+ n(this, "SORTABLE_ICON_SVG", "");
2490
+ /** 排序图标颜色 */
2491
+ n(this, "SORT_ICON_COLOR", "rgb(82,146,247)");
2364
2492
  /** 单元格只读背景色 */
2365
2493
  n(this, "READONLY_COLOR", "#fff");
2366
2494
  /** 单元格只读文本颜色 */
@@ -2519,14 +2647,14 @@ class Ct {
2519
2647
  let t = {};
2520
2648
  Object.keys(this).forEach((e) => {
2521
2649
  if (e.endsWith("_COLOR") || e.endsWith("_FONT")) {
2522
- const i = `--evt-${e.toLocaleLowerCase().replace(/_/g, "-")}`, s = ce(i);
2650
+ const i = `--evt-${e.toLocaleLowerCase().replace(/_/g, "-")}`, s = fe(i);
2523
2651
  s && (t[e] = s);
2524
2652
  }
2525
2653
  }), Object.assign(this, t, this._config);
2526
2654
  }
2527
2655
  }
2528
- const bt = '<svg t="1724122044148" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M707.648 401.28L489.28 560.704l22.656 30.976 22.656-30.976L316.16 401.216q-3.072-2.24-6.464-3.84-3.456-1.536-7.104-2.432-3.712-0.896-7.488-1.088-3.776-0.128-7.488 0.448-3.776 0.64-7.296 1.92-3.584 1.28-6.784 3.2-3.2 1.984-6.016 4.544-2.816 2.56-5.056 5.632-2.176 3.072-3.84 6.464-1.536 3.456-2.432 7.104-0.896 3.712-1.088 7.488-0.128 3.776 0.448 7.488 0.64 3.776 1.92 7.296 1.28 3.584 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992l218.368 159.552q4.928 3.584 10.752 5.504 5.76 1.92 11.904 1.92 6.08 0 11.904-1.92 5.76-1.92 10.752-5.504l218.368-159.552q3.008-2.24 5.568-4.992 2.56-2.816 4.544-6.016 1.92-3.2 3.264-6.784 1.28-3.52 1.92-7.296 0.576-3.712 0.384-7.488-0.128-3.84-1.024-7.488-0.896-3.648-2.496-7.04-1.6-3.456-3.84-6.528-2.24-3.072-4.992-5.632-2.816-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.584-1.28-7.296-1.856-3.712-0.64-7.488-0.448-3.84 0.192-7.488 1.088-3.648 0.896-7.04 2.496-3.456 1.536-6.528 3.84z m61.056 30.976q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.472-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.72-3.584-3.456-1.408-7.168-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.656 3.584-3.136 2.112-5.76 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.584 6.656-1.408 3.52-2.176 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.176 7.168 1.472 3.52 3.584 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.168-2.176 3.52-1.408 6.656-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.048-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z m-436.736 0q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.408-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.592 3.584-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.24 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.24 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z" p-id="4552"></path></svg>';
2529
- class we {
2656
+ const Rt = '<svg t="1724122044148" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M707.648 401.28L489.28 560.704l22.656 30.976 22.656-30.976L316.16 401.216q-3.072-2.24-6.464-3.84-3.456-1.536-7.104-2.432-3.712-0.896-7.488-1.088-3.776-0.128-7.488 0.448-3.776 0.64-7.296 1.92-3.584 1.28-6.784 3.2-3.2 1.984-6.016 4.544-2.816 2.56-5.056 5.632-2.176 3.072-3.84 6.464-1.536 3.456-2.432 7.104-0.896 3.712-1.088 7.488-0.128 3.776 0.448 7.488 0.64 3.776 1.92 7.296 1.28 3.584 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992l218.368 159.552q4.928 3.584 10.752 5.504 5.76 1.92 11.904 1.92 6.08 0 11.904-1.92 5.76-1.92 10.752-5.504l218.368-159.552q3.008-2.24 5.568-4.992 2.56-2.816 4.544-6.016 1.92-3.2 3.264-6.784 1.28-3.52 1.92-7.296 0.576-3.712 0.384-7.488-0.128-3.84-1.024-7.488-0.896-3.648-2.496-7.04-1.6-3.456-3.84-6.528-2.24-3.072-4.992-5.632-2.816-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.584-1.28-7.296-1.856-3.712-0.64-7.488-0.448-3.84 0.192-7.488 1.088-3.648 0.896-7.04 2.496-3.456 1.536-6.528 3.84z m61.056 30.976q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.472-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.72-3.584-3.456-1.408-7.168-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.656 3.584-3.136 2.112-5.76 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.584 6.656-1.408 3.52-2.176 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.176 7.168 1.472 3.52 3.584 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.168-2.176 3.52-1.408 6.656-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.048-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z m-436.736 0q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.408-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.592 3.584-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.24 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.24 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z" p-id="4552"></path></svg>', ut = '<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>', pe = ut.replace('fill="currentColor" p-id="2016"', 'fill="#bec4c7" p-id="2016"'), ye = ut.replace('fill="currentColor" p-id="2015"', 'fill="#bec4c7" p-id="2015"');
2657
+ class Ce {
2530
2658
  constructor(t) {
2531
2659
  n(this, "ctx");
2532
2660
  n(this, "list", [
@@ -2548,7 +2676,7 @@ class we {
2548
2676
  name: "shrink",
2549
2677
  configName: "CHECKBOX_UNCHECK_SVG",
2550
2678
  configColorName: "SHRINK_ICON_COLOR",
2551
- svg: bt,
2679
+ svg: Rt,
2552
2680
  color: "#4E5969"
2553
2681
  },
2554
2682
  {
@@ -2600,8 +2728,28 @@ class we {
2600
2728
  name: "icon-select",
2601
2729
  configName: "CHECKBOX_UNCHECK_SVG",
2602
2730
  configColorName: "SHRINK_ICON_COLOR",
2603
- svg: bt,
2731
+ svg: Rt,
2604
2732
  color: "#4E5969"
2733
+ },
2734
+ {
2735
+ name: "sort-asc",
2736
+ configName: "SORT_ASC_ICON_SVG",
2737
+ configColorName: "SORT_ICON_COLOR",
2738
+ svg: pe,
2739
+ color: "rgb(82,146,247)"
2740
+ },
2741
+ {
2742
+ name: "sort-desc",
2743
+ configName: "SORT_DESC_ICON_SVG",
2744
+ configColorName: "SORT_ICON_COLOR",
2745
+ svg: ye,
2746
+ color: "rgb(82,146,247)"
2747
+ },
2748
+ {
2749
+ name: "sort-default",
2750
+ configName: "SORTABLE_ICON_SVG",
2751
+ svg: ut,
2752
+ color: "#bec4c7"
2605
2753
  }
2606
2754
  ]);
2607
2755
  n(this, "icons", /* @__PURE__ */ new Map());
@@ -2637,21 +2785,22 @@ class we {
2637
2785
  }
2638
2786
  async createImageFromSVG(t, e, i = !1) {
2639
2787
  const r = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
2640
- e && r.querySelectorAll("*").forEach((h) => {
2641
- h.setAttribute("fill", e);
2788
+ e && r.querySelectorAll("*").forEach((l) => {
2789
+ const d = l.getAttribute("fill");
2790
+ (d === "currentColor" || d === null) && l.setAttribute("fill", e);
2642
2791
  });
2643
2792
  const a = new Image();
2644
- let l = "";
2793
+ let c = "";
2645
2794
  if (i) {
2646
- const h = new Blob([new XMLSerializer().serializeToString(r)], {
2795
+ const l = new Blob([new XMLSerializer().serializeToString(r)], {
2647
2796
  type: "image/svg+xml"
2648
2797
  });
2649
- l = URL.createObjectURL(h);
2798
+ c = URL.createObjectURL(l);
2650
2799
  } else
2651
- l = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(r));
2652
- return a.src = l, new Promise((h, d) => {
2653
- a.onerror = () => d(new Error("Failed to load image")), a.onload = () => {
2654
- h(a);
2800
+ c = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(r));
2801
+ return a.src = c, new Promise((l, d) => {
2802
+ a.onerror = () => d(new Error("Failed to load image:" + t)), a.onload = () => {
2803
+ l(a);
2655
2804
  };
2656
2805
  });
2657
2806
  }
@@ -2659,9 +2808,9 @@ class we {
2659
2808
  return this.icons.get(t);
2660
2809
  }
2661
2810
  }
2662
- class ct extends Xt {
2663
- constructor(e, i, s, o, r, a, l) {
2664
- super(e, s, o, r, a, "header", l.fixed);
2811
+ class lt extends Yt {
2812
+ constructor(e, i, s, o, r, a, c) {
2813
+ super(e, s, o, r, a, "header", c.fixed);
2665
2814
  n(this, "align");
2666
2815
  n(this, "hideHeaderSelection", !1);
2667
2816
  n(this, "verticalAlign", "middle");
@@ -2693,6 +2842,9 @@ class ct extends Xt {
2693
2842
  n(this, "style", {});
2694
2843
  n(this, "drawX", 0);
2695
2844
  n(this, "drawY", 0);
2845
+ n(this, "sortIconName", "sort-default");
2846
+ n(this, "sortAscIconName", "sort-asc");
2847
+ n(this, "sortDescIconName", "sort-desc");
2696
2848
  n(this, "visibleWidth", 0);
2697
2849
  n(this, "visibleHeight", 0);
2698
2850
  n(this, "drawTextX", 0);
@@ -2707,7 +2859,14 @@ class ct extends Xt {
2707
2859
  n(this, "drawSelectionImageHeight", 0);
2708
2860
  n(this, "drawSelectionImageName", "");
2709
2861
  n(this, "drawSelectionImageSource");
2710
- this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = a, this.visibleWidth = r, this.visibleHeight = a, this.colIndex = i, this.key = l.key, this.minWidth = l.minWidth, this.maxWidth = l.maxWidth, this.type = l.type || "", this.editorType = l.editorType || "text", this.hideHeaderSelection = l.hideHeaderSelection || !1, this.align = l.headerAlign || l.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = l.headerVerticalAlign || l.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = l.fixed, this.level = l.level || 0, this.operation = l.operation || !1, this.text = l.title, this.column = l, this.colspan = l.colspan || 1, this.widthFillDisable = l.widthFillDisable || !1, this.rowspan = l.rowspan || 1, this.rules = l.rules, this.readonly = l.readonly || !1, this.required = l.required || !1, this.rowKey = Lt(), this.overflowTooltipShow = l.overflowTooltipHeaderShow !== !1, this.hasChildren = l.children && l.children.length > 0 || !1, this.render = l.renderHeader;
2862
+ // 排序相关
2863
+ n(this, "drawSortImageX", 0);
2864
+ n(this, "drawSortImageY", 0);
2865
+ n(this, "drawSortImageWidth", 0);
2866
+ n(this, "drawSortImageHeight", 0);
2867
+ n(this, "drawSortImageName", "");
2868
+ n(this, "drawSortImageSource");
2869
+ this.ctx = e, this.x = s, this.y = o, this.width = r, this.height = a, this.visibleWidth = r, this.visibleHeight = a, this.colIndex = i, this.key = c.key, this.minWidth = c.minWidth, this.maxWidth = c.maxWidth, this.type = c.type || "", this.editorType = c.editorType || "text", this.hideHeaderSelection = c.hideHeaderSelection || !1, this.align = c.headerAlign || c.align || this.ctx.config.COLUMNS_ALIGN, this.verticalAlign = c.headerVerticalAlign || c.verticalAlign || this.ctx.config.COLUMNS_VERTICAL_ALIGN, this.fixed = c.fixed, this.level = c.level || 0, this.operation = c.operation || !1, this.text = c.title, this.column = c, this.colspan = c.colspan || 1, this.widthFillDisable = c.widthFillDisable || !1, this.rowspan = c.rowspan || 1, this.rules = c.rules, this.readonly = c.readonly || !1, this.required = c.required || !1, this.sortIconName = c.sortIconName || "sort-default", this.sortAscIconName = c.sortAscIconName || "sort-asc", this.sortDescIconName = c.sortDescIconName || "sort-desc", this.rowKey = At(), this.overflowTooltipShow = c.overflowTooltipHeaderShow !== !1, this.hasChildren = c.children && c.children.length > 0 || !1, this.render = c.renderHeader;
2711
2870
  }
2712
2871
  /**
2713
2872
  * 是否可见,覆盖基类方法,表头是跟y滚动条没有关系的所以不需要加滚动参数
@@ -2727,11 +2886,11 @@ class ct extends Xt {
2727
2886
  const { HEADER_CELL_STYLE_METHOD: e, HEADER_BG_COLOR: i, HEADER_TEXT_COLOR: s } = this.ctx.config;
2728
2887
  let o = i, r = s;
2729
2888
  if (typeof e == "function") {
2730
- const a = e, { backgroundColor: l, color: h } = a({
2889
+ const a = e, { backgroundColor: c, color: l } = a({
2731
2890
  colIndex: this.colIndex,
2732
2891
  column: this.column
2733
2892
  }) || {};
2734
- l && (o = l), h && (r = h);
2893
+ c && (o = c), l && (r = l);
2735
2894
  }
2736
2895
  this.drawCellBgColor = o, this.drawTextColor = r;
2737
2896
  }
@@ -2739,14 +2898,25 @@ class ct extends Xt {
2739
2898
  this.updateContainer(), this.displayText = this.getText(), this.drawX = this.getDrawX(), this.drawY = this.getDrawY(), this.drawTextX = this.drawX, this.drawTextY = this.drawY, this.drawTextWidth = this.width, this.drawTextHeight = this.height, this.updateStyle();
2740
2899
  }
2741
2900
  draw() {
2901
+ this.drawEdge(), this.drawSelection(), this.recalculateTextPosition(), this.drawText(), this.drawSelector(), this.drawSortIcon();
2902
+ }
2903
+ drawEdge() {
2742
2904
  const {
2743
2905
  paint: e,
2744
2906
  config: { BORDER_COLOR: i, BORDER: s }
2745
- } = this.ctx, { drawX: o, drawY: r } = this;
2746
- e.drawRect(o, r, this.width, this.height, {
2907
+ } = this.ctx;
2908
+ e.drawRect(this.drawX, this.drawY, this.width, this.height, {
2747
2909
  borderColor: s ? i : "transparent",
2748
2910
  fillColor: this.drawCellBgColor
2749
- }), this.drawSelection(), this.drawText(), this.drawSelector();
2911
+ });
2912
+ }
2913
+ recalculateTextPosition() {
2914
+ let e = this.drawX, i = this.width;
2915
+ if (["selection", "index-selection", "selection-tree", "tree-selection"].includes(this.type)) {
2916
+ const { CHECKBOX_SIZE: s } = this.ctx.config;
2917
+ this.align === "left" || this.align === "right" ? (e = this.drawX + s + 4, i = this.width - e + this.drawX) : (e = this.drawX + (this.width - s) / 2 + s + 1, i = this.width - e + this.drawX);
2918
+ }
2919
+ this.column.sortBy && (this.align === "right" ? (i = this.width - this.ctx.config.CELL_PADDING - 16 - 4, e = this.drawX + this.ctx.config.CELL_PADDING) : this.align === "center" && this.ctx.paint.measureTextWidth(this.displayText, this.ctx.config.HEADER_FONT) + 16 + 4 > this.width - this.ctx.config.CELL_PADDING * 2 && (i = this.width - this.ctx.config.CELL_PADDING * 2 - 16 - 4)), this.drawTextX = e, this.drawTextWidth = i;
2750
2920
  }
2751
2921
  drawText() {
2752
2922
  const {
@@ -2779,15 +2949,12 @@ class ct extends Xt {
2779
2949
  });
2780
2950
  }
2781
2951
  drawSelection() {
2782
- if (this.hideHeaderSelection)
2783
- return;
2784
- const { width: e, height: i, type: s } = this;
2785
- if (["index-selection", "selection", "selection-tree", "tree-selection"].includes(s)) {
2786
- const { indeterminate: o, check: r, selectable: a } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: l = 0, CELL_PADDING: h } = this.ctx.config;
2787
- let d = this.drawX + (e - l) / 2, f = this.drawY + (i - l) / 2;
2788
- this.drawTextX = d + l - h / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX, (this.align === "left" || this.align === "right") && (d = this.drawX + h, this.drawTextX = d + l - h / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX), this.verticalAlign === "top" ? f = this.drawY + h / 2 : this.verticalAlign === "bottom" && (f = this.drawY + i - l - h / 2);
2789
- let u = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck";
2790
- o ? (u = this.ctx.icons.get("checkbox-indeterminate"), x = "checkbox-indeterminate") : r && a ? (u = this.ctx.icons.get("checkbox-check"), x = "checkbox-check") : r && a ? (u = this.ctx.icons.get("checkbox-check-disabled"), x = "checkbox-check-disabled") : !r && a ? (u = this.ctx.icons.get("checkbox-uncheck"), x = "checkbox-uncheck") : (u = this.ctx.icons.get("checkbox-disabled"), x = "checkbox-disabled"), u && (this.drawSelectionImageX = d, this.drawSelectionImageY = f, this.drawSelectionImageWidth = l, this.drawSelectionImageHeight = l, this.drawSelectionImageName = x, this.drawSelectionImageSource = u, this.ctx.paint.drawImage(
2952
+ if (!this.hideHeaderSelection && ["index-selection", "selection", "selection-tree", "tree-selection"].includes(this.type)) {
2953
+ const { indeterminate: e, check: i, selectable: s } = this.ctx.database.getCheckedState(), { CHECKBOX_SIZE: o = 0, CELL_PADDING: r } = this.ctx.config;
2954
+ let a = this.drawX + (this.width - o) / 2, c = this.drawY + (this.height - o) / 2;
2955
+ this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX, (this.align === "left" || this.align === "right") && (a = this.drawX + r, this.drawTextX = a + o - r / 2, this.drawTextWidth = this.drawX + this.visibleWidth - this.drawTextX), this.verticalAlign === "top" ? c = this.drawY + r / 2 : this.verticalAlign === "bottom" && (c = this.drawY + this.height - o - r / 2);
2956
+ let l = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck";
2957
+ e ? (l = this.ctx.icons.get("checkbox-indeterminate"), d = "checkbox-indeterminate") : i && s ? (l = this.ctx.icons.get("checkbox-check"), d = "checkbox-check") : i && !s ? (l = this.ctx.icons.get("checkbox-check-disabled"), d = "checkbox-check-disabled") : !i && s ? (l = this.ctx.icons.get("checkbox-uncheck"), d = "checkbox-uncheck") : (l = this.ctx.icons.get("checkbox-disabled"), d = "checkbox-disabled"), l && (this.drawSelectionImageX = a, this.drawSelectionImageY = c, this.drawSelectionImageWidth = o, this.drawSelectionImageHeight = o, this.drawSelectionImageName = d, this.drawSelectionImageSource = l, this.ctx.paint.drawImage(
2791
2958
  this.drawSelectionImageSource,
2792
2959
  this.drawSelectionImageX,
2793
2960
  this.drawSelectionImageY,
@@ -2796,6 +2963,32 @@ class ct extends Xt {
2796
2963
  ));
2797
2964
  }
2798
2965
  }
2966
+ drawSortIcon() {
2967
+ if (!this.column.sortBy)
2968
+ return;
2969
+ const { CELL_PADDING: e = 0 } = this.ctx.config, i = 16, s = 4;
2970
+ let o = this.sortIconName;
2971
+ const r = this.ctx.database.getSortState(this.key);
2972
+ r.direction === "asc" ? o = this.sortAscIconName : r.direction === "desc" && (o = this.sortDescIconName);
2973
+ const a = this.ctx.icons.get(o);
2974
+ if (!a)
2975
+ return;
2976
+ let c = 0, l = this.drawY + (this.height - i) / 2;
2977
+ if (this.align === "left") {
2978
+ const d = this.ctx.paint.measureTextWidth(this.displayText, this.ctx.config.HEADER_FONT);
2979
+ c = this.drawX + e + d + s;
2980
+ } else if (this.align === "center") {
2981
+ const d = this.ctx.paint.measureTextWidth(this.displayText, this.ctx.config.HEADER_FONT);
2982
+ c = this.drawX + this.width / 2 - d / 2 + d + s;
2983
+ } else this.align === "right" && (c = this.drawX + this.width - e - i);
2984
+ this.drawSortImageX = c, this.drawSortImageY = l, this.drawSortImageWidth = i, this.drawSortImageHeight = i, this.drawSortImageName = o, this.drawSortImageSource = a, this.ctx.paint.drawImage(
2985
+ this.drawSortImageSource,
2986
+ this.drawSortImageX,
2987
+ this.drawSortImageY,
2988
+ this.drawSortImageWidth,
2989
+ this.drawSortImageHeight
2990
+ );
2991
+ }
2799
2992
  getText() {
2800
2993
  return this.render ? "" : this.text;
2801
2994
  }
@@ -2816,7 +3009,7 @@ class ct extends Xt {
2816
3009
  };
2817
3010
  }
2818
3011
  }
2819
- class Ee {
3012
+ class be {
2820
3013
  constructor(t) {
2821
3014
  n(this, "ctx");
2822
3015
  n(this, "visibleHoverCell");
@@ -2848,7 +3041,7 @@ class Ee {
2848
3041
  return;
2849
3042
  const e = this.ctx.getOffset(t).offsetY, i = this.ctx.getOffset(t).offsetX;
2850
3043
  this.handleHeaderEvent(i, e, this.ctx.header.renderCellHeaders, (s) => {
2851
- this.ctx.clickCellHeader = s, this.ctx.emit("cellHeaderClick", s, t), this.selectionClick(s, t);
3044
+ this.ctx.clickCellHeader = s, this.ctx.emit("cellHeaderClick", s, t), this.selectionClick(s, t), this.sortClick(s, t);
2852
3045
  }), this.handleBodyEvent(i, e, this.ctx.body.renderRows, (s) => {
2853
3046
  this.ctx.clickCell = s, this.ctx.emit("cellClick", s, t), this.selectionClick(s, t), this.treeClick(s, t), this.hoverIconClick(s);
2854
3047
  });
@@ -2904,8 +3097,15 @@ class Ee {
2904
3097
  if (!(["selection", "index-selection", "selection-tree", "tree-selection"].includes(t.type) && this.ctx.isPointer))
2905
3098
  return;
2906
3099
  const { offsetY: s, offsetX: o } = this.ctx.getOffset(e), r = s, a = o;
2907
- if (a > t.drawSelectionImageX && a < t.drawSelectionImageX + t.drawSelectionImageWidth && r > t.drawSelectionImageY && r < t.drawSelectionImageY + t.drawSelectionImageHeight)
2908
- if (t instanceof ct)
3100
+ if (this.isInsideElement(
3101
+ a,
3102
+ r,
3103
+ t.drawSelectionImageX,
3104
+ t.drawSelectionImageY,
3105
+ t.drawSelectionImageWidth,
3106
+ t.drawSelectionImageHeight
3107
+ ))
3108
+ if (t instanceof lt)
2909
3109
  t.drawSelectionImageName === "checkbox-uncheck" || t.drawSelectionImageName === "checkbox-indeterminate" ? this.ctx.database.toggleAllSelection() : t.drawSelectionImageName === "checkbox-check" && this.ctx.database.clearSelection(!0);
2910
3110
  else {
2911
3111
  if (!this.ctx.database.getRowSelectable(t.rowKey))
@@ -2921,10 +3121,17 @@ class Ee {
2921
3121
  if (!(["tree", "selection-tree", "tree-selection"].includes(t.type) && this.ctx.isPointer))
2922
3122
  return;
2923
3123
  const { offsetY: s, offsetX: o } = this.ctx.getOffset(e), r = s, a = o;
2924
- if (!(a > t.drawTreeImageX && a < t.drawTreeImageX + t.drawTreeImageWidth && r > t.drawTreeImageY && r < t.drawTreeImageY + t.drawTreeImageHeight))
3124
+ if (!this.isInsideElement(
3125
+ a,
3126
+ r,
3127
+ t.drawTreeImageX,
3128
+ t.drawTreeImageY,
3129
+ t.drawTreeImageWidth,
3130
+ t.drawTreeImageHeight
3131
+ ))
2925
3132
  return;
2926
- const l = this.ctx.database.getRowForRowKey(t.rowKey), { expand: h = !1, expandLazy: d = !1 } = l || {}, { EXPAND_LAZY: f, EXPAND_LAZY_METHOD: u } = this.ctx.config;
2927
- if (f && u && !h && !d)
3133
+ const c = this.ctx.database.getRowForRowKey(t.rowKey), { expand: l = !1, expandLazy: d = !1 } = c || {}, { EXPAND_LAZY: f, EXPAND_LAZY_METHOD: u } = this.ctx.config;
3134
+ if (f && u && !l && !d)
2928
3135
  typeof u == "function" && (this.ctx.database.expandLoading(t.rowKey, !0), u({
2929
3136
  row: t.row,
2930
3137
  rowIndex: t.rowIndex,
@@ -2941,6 +3148,21 @@ class Ee {
2941
3148
  this.ctx.database.expandItem(t.rowKey, !x), this.ctx.emit("expandChange", this.ctx.database.getExpandRowKeys());
2942
3149
  }
2943
3150
  }
3151
+ sortClick(t, e) {
3152
+ const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s;
3153
+ if (!this.isInsideElement(
3154
+ r,
3155
+ o,
3156
+ t.drawSortImageX,
3157
+ t.drawSortImageY,
3158
+ t.drawSortImageWidth,
3159
+ t.drawSortImageHeight
3160
+ ))
3161
+ return;
3162
+ const a = this.ctx.database.getSortState(t.key);
3163
+ let c;
3164
+ a.direction === "none" ? c = "asc" : a.direction === "asc" ? c = "desc" : c = "none", this.ctx.database.setSortState(t.key, c);
3165
+ }
2944
3166
  /**
2945
3167
  * 图标进入和离开事件,包括选中,展开,提示图标等
2946
3168
  * @param cell
@@ -2948,19 +3170,69 @@ class Ee {
2948
3170
  */
2949
3171
  imageEnterAndLeave(t, e) {
2950
3172
  const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s;
2951
- if ((t instanceof $ || t instanceof ct) && r > t.drawSelectionImageX && r < t.drawSelectionImageX + t.drawSelectionImageWidth && o > t.drawSelectionImageY && o < t.drawSelectionImageY + t.drawSelectionImageHeight) {
2952
- this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0, t instanceof $ && (this.ctx.database.getRowSelectable(t.rowKey) || (this.ctx.stageElement.style.cursor = "not-allowed"));
2953
- return;
2954
- }
2955
- if (t instanceof $ && t.drawHoverImageSource && r > t.drawHoverImageX && r < t.drawHoverImageX + t.drawHoverImageWidth && o > t.drawHoverImageY && o < t.drawHoverImageY + t.drawHoverImageHeight) {
2956
- this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0;
2957
- return;
3173
+ if (t instanceof lt) {
3174
+ if (t.drawSelectionImageSource && this.isInsideElement(
3175
+ r,
3176
+ o,
3177
+ t.drawSelectionImageX,
3178
+ t.drawSelectionImageY,
3179
+ t.drawSelectionImageWidth,
3180
+ t.drawSelectionImageHeight
3181
+ )) {
3182
+ this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0;
3183
+ return;
3184
+ }
3185
+ if (t.drawSortImageSource && this.isInsideElement(
3186
+ r,
3187
+ o,
3188
+ t.drawSortImageX,
3189
+ t.drawSortImageY,
3190
+ t.drawSortImageWidth,
3191
+ t.drawSortImageHeight
3192
+ )) {
3193
+ this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0;
3194
+ return;
3195
+ }
2958
3196
  }
2959
- if (t instanceof $ && t.drawTreeImageSource && r > t.drawTreeImageX && r < t.drawTreeImageX + t.drawTreeImageWidth && o > t.drawTreeImageY && o < t.drawTreeImageY + t.drawTreeImageHeight) {
2960
- this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0;
2961
- return;
3197
+ if (t instanceof xt) {
3198
+ if (t.drawSelectionImageSource && this.isInsideElement(
3199
+ r,
3200
+ o,
3201
+ t.drawSelectionImageX,
3202
+ t.drawSelectionImageY,
3203
+ t.drawSelectionImageWidth,
3204
+ t.drawSelectionImageHeight
3205
+ )) {
3206
+ this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0, this.ctx.database.getRowSelectable(t.rowKey) || (this.ctx.stageElement.style.cursor = "not-allowed");
3207
+ return;
3208
+ }
3209
+ if (t.drawHoverImageSource && this.isInsideElement(
3210
+ r,
3211
+ o,
3212
+ t.drawHoverImageX,
3213
+ t.drawHoverImageY,
3214
+ t.drawHoverImageWidth,
3215
+ t.drawHoverImageHeight
3216
+ )) {
3217
+ this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0;
3218
+ return;
3219
+ }
3220
+ if (t.drawTreeImageSource && this.isInsideElement(
3221
+ r,
3222
+ o,
3223
+ t.drawTreeImageX,
3224
+ t.drawTreeImageY,
3225
+ t.drawTreeImageWidth,
3226
+ t.drawTreeImageHeight
3227
+ )) {
3228
+ this.ctx.stageElement.style.cursor = "pointer", this.ctx.isPointer = !0;
3229
+ return;
3230
+ }
2962
3231
  }
2963
3232
  }
3233
+ isInsideElement(t, e, i, s, o, r) {
3234
+ return t > i && t < i + o && e > s && e < s + r;
3235
+ }
2964
3236
  isBusy(t) {
2965
3237
  const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = e, o = i;
2966
3238
  if (!this.ctx.isTarget(t) || this.ctx.stageElement.style.cursor === "row-resize" || this.ctx.stageElement.style.cursor === "col-resize" || this.ctx.columnResizing || this.ctx.rowResizing)
@@ -2972,15 +3244,15 @@ class Ee {
2972
3244
  if (this.isInsideBody(e))
2973
3245
  for (const r of i) {
2974
3246
  const a = r.fixedCells.concat(r.noFixedCells);
2975
- for (const l of a) {
2976
- const h = l.getDrawX(), d = l.getDrawY();
3247
+ for (const c of a) {
3248
+ const l = c.getDrawX(), d = c.getDrawY();
2977
3249
  if (o) {
2978
- if (t > h && t < h + l.visibleWidth && e > d && e < d + l.visibleHeight) {
2979
- s(l);
3250
+ if (t > l && t < l + c.visibleWidth && e > d && e < d + c.visibleHeight) {
3251
+ s(c);
2980
3252
  return;
2981
3253
  }
2982
- } else if (t > h && t < h + l.width && e > d && e < d + l.height) {
2983
- s(l);
3254
+ } else if (t > l && t < l + c.width && e > d && e < d + c.height) {
3255
+ s(c);
2984
3256
  return;
2985
3257
  }
2986
3258
  }
@@ -3002,7 +3274,7 @@ class Ee {
3002
3274
  this.resizeObserver.unobserve(this.ctx.stageElement), this.mutationObserver.disconnect();
3003
3275
  }
3004
3276
  }
3005
- class pe {
3277
+ class Ie {
3006
3278
  constructor(t, e) {
3007
3279
  n(this, "eventBus");
3008
3280
  n(this, "eventBrowser");
@@ -3119,20 +3391,20 @@ class pe {
3119
3391
  canvasElement: o,
3120
3392
  overlayerElement: r,
3121
3393
  editorElement: a,
3122
- emptyElement: l,
3123
- contextMenuElement: h
3394
+ emptyElement: c,
3395
+ contextMenuElement: l
3124
3396
  } = t;
3125
- this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement = l, this.contextMenuElement = h, this.config = new Ct(e.config || {}), this.eventBus = new ue(), this.eventBrowser = new xe(this), this.eventTable = new Ee(this), this.paint = new ge(this.canvasElement), this.database = new de(this, e), this.history = new fe(this), this.icons = new we(this);
3397
+ this.containerElement = i, s.tabIndex = 0, this.stageElement = s, this.canvasElement = o, this.overlayerElement = r, this.editorElement = a, this.emptyElement = c, this.contextMenuElement = l, this.config = new It(e.config || {}), this.eventBus = new me(), this.eventBrowser = new we(this), this.eventTable = new be(this), this.paint = new Ee(this.canvasElement), this.database = new ue(this, e), this.history = new ge(this), this.icons = new Ce(this);
3126
3398
  }
3127
3399
  setConfig(t) {
3128
- this.config = new Ct(t);
3400
+ this.config = new It(t);
3129
3401
  }
3130
3402
  setItemValueByEditor(t, e, i, s = !0, o = !0, r = !0) {
3131
3403
  if (this.config.ENABLE_MERGE_CELL_LINK) {
3132
3404
  const a = this.database.getVirtualBodyCellByKey(t, e);
3133
3405
  if (a && (a.mergeRow || a.mergeCol)) {
3134
- const { dataList: l } = a.getSpanInfo(), h = l.map((d) => ({ ...d, value: i }));
3135
- this.database.batchSetItemValue(h, s, r);
3406
+ const { dataList: c } = a.getSpanInfo(), l = c.map((d) => ({ ...d, value: i }));
3407
+ this.database.batchSetItemValue(l, s, r);
3136
3408
  return;
3137
3409
  }
3138
3410
  }
@@ -3144,9 +3416,9 @@ class pe {
3144
3416
  t.forEach((o) => {
3145
3417
  const r = this.database.getRowIndexForRowKey(o.rowKey), a = this.database.getColIndexForKey(o.key);
3146
3418
  if (r === void 0 || a === void 0) return;
3147
- const l = this.database.getVirtualBodyCell(r, a);
3148
- if (l) {
3149
- const { dataList: h } = l.getSpanInfo(), d = h.map((f) => ({ ...f, value: o.value }));
3419
+ const c = this.database.getVirtualBodyCell(r, a);
3420
+ if (c) {
3421
+ const { dataList: l } = c.getSpanInfo(), d = l.map((f) => ({ ...f, value: o.value }));
3150
3422
  s.push(...d);
3151
3423
  }
3152
3424
  }), this.database.batchSetItemValue(s, e, i);
@@ -3191,7 +3463,7 @@ class pe {
3191
3463
  for (let o = 0; o <= e[1] - e[0]; o++) {
3192
3464
  const r = [];
3193
3465
  for (let a = 0; a <= i[1] - i[0]; a++) {
3194
- const l = o + e[0], h = a + i[0], d = this.database.getVirtualBodyCell(l, h);
3466
+ const c = o + e[0], l = a + i[0], d = this.database.getVirtualBodyCell(c, l);
3195
3467
  d && (d.selectorCellValueType === "displayText" ? r.push(d.displayText) : r.push(d.getValue()));
3196
3468
  }
3197
3469
  s += `${r.join(" ")}\r`, t.push(r);
@@ -3250,7 +3522,7 @@ class pe {
3250
3522
  this.eventTable.destroy(), this.eventBrowser.destroy(), this.eventBus.destroy();
3251
3523
  }
3252
3524
  }
3253
- class Rt {
3525
+ class St {
3254
3526
  constructor(t, e) {
3255
3527
  n(this, "ctx");
3256
3528
  n(this, "type");
@@ -3312,8 +3584,8 @@ class Rt {
3312
3584
  if (this.isOnScrollbar(e, i) && t.target === this.ctx.canvasElement ? this.isFocus = !0 : this.isFocus = !1, r === 0 || s == this.clientX && o == this.clientY) return;
3313
3585
  let a = 0;
3314
3586
  if (this.type === "horizontal" ? a = s - this.clientX : a = o - this.clientY, this.isDragging && a !== 0) {
3315
- let l = 0;
3316
- this.type === "vertical" ? l = this.dragStart + a / (this.visibleDistance - this.barHeight) * this.distance : l = this.dragStart + a / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(l, this.distance));
3587
+ let c = 0;
3588
+ this.type === "vertical" ? c = this.dragStart + a / (this.visibleDistance - this.barHeight) * this.distance : c = this.dragStart + a / (this.visibleDistance - this.barWidth) * this.distance, this.scroll = Math.max(0, Math.min(c, this.distance));
3317
3589
  }
3318
3590
  }
3319
3591
  isPointInElement(t, e, i, s, o, r) {
@@ -3339,23 +3611,23 @@ class Rt {
3339
3611
  stageHeight: i,
3340
3612
  stageWidth: s,
3341
3613
  config: { SCROLLER_TRACK_SIZE: o = 0, SCROLLER_SIZE: r = 0, BORDER: a }
3342
- } = this.ctx, l = s, h = i, d = e.height, f = e.width, u = t.height, x = this.ctx.footer.height;
3614
+ } = this.ctx, c = s, l = i, d = e.height, f = e.width, u = t.height, x = this.ctx.footer.height;
3343
3615
  if (this.type === "vertical") {
3344
- this.visibleDistance = h - o - d, this.distance = u - this.visibleDistance + x, this.trackX = l - o, this.trackY = 0, this.splitPoints = [this.trackX, d, this.trackX + o, d], this.trackWidth = o, this.trackHeight = h, this.barX = this.trackX - 1 + (o - r) / 2, this.barWidth = r;
3616
+ this.visibleDistance = l - o - d, this.distance = u - this.visibleDistance + x, this.trackX = c - o, this.trackY = 0, this.splitPoints = [this.trackX, d, this.trackX + o, d], this.trackWidth = o, this.trackHeight = l, this.barX = this.trackX - 1 + (o - r) / 2, this.barWidth = r;
3345
3617
  const w = this.distance ? this.visibleDistance / (u + x) : 0;
3346
- let E = Math.floor(w * this.visibleDistance);
3347
- E < 30 ? E = 30 : E > this.visibleDistance && (E = 0), this.barHeight = E, this.barY = d + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3618
+ let m = Math.floor(w * this.visibleDistance);
3619
+ m < 30 ? m = 30 : m > this.visibleDistance && (m = 0), this.barHeight = m, this.barY = d + this.scroll / this.distance * (this.visibleDistance - this.barHeight), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3348
3620
  } else {
3349
- this.visibleDistance = l - o, this.distance = f - this.visibleDistance, this.splitPoints = [
3350
- l - o,
3351
- h - o,
3621
+ this.visibleDistance = c - o, this.distance = f - this.visibleDistance, this.splitPoints = [
3622
+ c - o,
3352
3623
  l - o,
3353
- h
3624
+ c - o,
3625
+ l
3354
3626
  ];
3355
3627
  const w = a ? 0 : 0.5;
3356
- this.trackX = 0, this.trackY = h - o + w, this.trackWidth = l, this.trackHeight = o;
3357
- const E = this.distance ? this.visibleDistance / f : 0;
3358
- let g = Math.floor(E * this.visibleDistance);
3628
+ this.trackX = 0, this.trackY = l - o + w, this.trackWidth = c, this.trackHeight = o;
3629
+ const m = this.distance ? this.visibleDistance / f : 0;
3630
+ let g = Math.floor(m * this.visibleDistance);
3359
3631
  this.barY = this.trackY - 1 + (o - r) / 2, g < 30 ? g = 30 : g >= this.visibleDistance && (g = 0), this.barWidth = g, this.barHeight = r, this.barX = this.scroll / this.distance * (this.visibleDistance - this.barWidth), this.scroll = Math.max(0, Math.min(this.scroll, this.distance));
3360
3632
  }
3361
3633
  }
@@ -3377,12 +3649,12 @@ class Rt {
3377
3649
  }), this.ctx.scrollerFocus = this.isFocus;
3378
3650
  }
3379
3651
  }
3380
- class me {
3652
+ class Re {
3381
3653
  constructor(t) {
3382
3654
  n(this, "ctx");
3383
3655
  n(this, "verticalScrollbar");
3384
3656
  n(this, "horizontalScrollbar");
3385
- this.ctx = t, this.verticalScrollbar = new Rt(t, "vertical"), this.horizontalScrollbar = new Rt(t, "horizontal"), this.ctx.on("wheel", (e) => this.onWheel(e)), this.ctx.on("mousedown", (e) => this.onMouseDown(e)), this.ctx.on("mousemove", (e) => this.onMouseMove(e)), this.ctx.on("mouseup", () => this.onMouseUp()), this.ctx.on("touchmove", (e) => this.onTouchmove(e)), this.ctx.on("touchstart", (e) => {
3657
+ this.ctx = t, this.verticalScrollbar = new St(t, "vertical"), this.horizontalScrollbar = new St(t, "horizontal"), this.ctx.on("wheel", (e) => this.onWheel(e)), this.ctx.on("mousedown", (e) => this.onMouseDown(e)), this.ctx.on("mousemove", (e) => this.onMouseMove(e)), this.ctx.on("mouseup", () => this.onMouseUp()), this.ctx.on("touchmove", (e) => this.onTouchmove(e)), this.ctx.on("touchstart", (e) => {
3386
3658
  this.onTouchstart(e);
3387
3659
  }), this.ctx.on("setScroll", (e, i) => {
3388
3660
  this.setScroll(e, i);
@@ -3444,7 +3716,7 @@ class me {
3444
3716
  this.setScrollY(o - e.visibleHeight / 2);
3445
3717
  }
3446
3718
  }
3447
- class ye {
3719
+ class Se {
3448
3720
  constructor(t) {
3449
3721
  n(this, "ctx");
3450
3722
  // 上下文
@@ -3483,7 +3755,7 @@ class ye {
3483
3755
  n(this, "renderFixedCellHeaders", []);
3484
3756
  this.ctx = t, this.ctx.on(
3485
3757
  "resetHeader",
3486
- At(() => {
3758
+ Ht(() => {
3487
3759
  this.init(), this.ctx.emit("draw");
3488
3760
  }, 100)
3489
3761
  ), this.init(), this.initResizeColumn();
@@ -3493,22 +3765,22 @@ class ye {
3493
3765
  config: { HEADER_HEIGHT: t, SCROLLER_TRACK_SIZE: e }
3494
3766
  } = this.ctx, i = this.ctx.database.getColumns();
3495
3767
  this.columns = i, this.allCellHeaders = [], this.leafCellHeaders = [], this.fixedLeftCellHeaders = [], this.fixedRightCellHeaders = [], this.centerCellHeaders = [];
3496
- const s = Mt(i), o = it(i);
3768
+ const s = Dt(i), o = et(i);
3497
3769
  this.height = t * s, this.width = o.reduce((f, u) => {
3498
- const x = u.width || 100, { maxWidth: w, minWidth: E } = u;
3499
- return w && x > w ? f + w : E && x < E ? f + E : f + x;
3770
+ const x = u.width || 100, { maxWidth: w, minWidth: m } = u;
3771
+ return w && x > w ? f + w : m && x < m ? f + m : f + x;
3500
3772
  }, 0), this.visibleHeight = this.height;
3501
- const r = oe(Ht(i, s));
3773
+ const r = ne(Nt(i, s));
3502
3774
  this.columnIndex = 0, this.resizeNum = 0, this.render(r, 0), this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);
3503
3775
  const a = this.ctx.containerElement.getBoundingClientRect();
3504
3776
  this.resizeNum > 0 ? this.ctx.stageWidth = Math.floor(a.width) : this.ctx.stageWidth = Math.floor(this.width + e), this.ctx.stageElement.style.width = this.ctx.stageWidth + "px", this.visibleWidth = this.ctx.stageWidth - e;
3505
- const l = this.visibleWidth - this.width;
3506
- if (this.resizeNum && l > 0) {
3507
- const f = Math.floor(l / this.resizeNum * 100) / 100;
3777
+ const c = this.visibleWidth - this.width;
3778
+ if (this.resizeNum && c > 0) {
3779
+ const f = Math.floor(c / this.resizeNum * 100) / 100;
3508
3780
  this.resizeAllColumn(f);
3509
3781
  }
3510
- const h = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
3511
- this.ctx.fixedLeftWidth = h.reduce((f, u) => f + u.width, 0);
3782
+ const l = this.fixedLeftCellHeaders.filter((f) => !f.hasChildren);
3783
+ this.ctx.fixedLeftWidth = l.reduce((f, u) => f + u.width, 0);
3512
3784
  const d = this.fixedRightCellHeaders.filter((f) => !f.hasChildren);
3513
3785
  this.ctx.fixedRightWidth = d.reduce((f, u) => f + u.width, e), this.ctx.maxColIndex = this.leafCellHeaders.length - 1, this.ctx.header.x = this.x, this.ctx.header.y = this.y, this.ctx.header.width = this.width, this.ctx.header.height = this.height, this.ctx.header.visibleWidth = this.visibleWidth, this.ctx.header.visibleHeight = this.visibleHeight;
3514
3786
  }
@@ -3529,8 +3801,8 @@ class ye {
3529
3801
  } = this.ctx;
3530
3802
  if (this.isResizing && this.resizeTarget) {
3531
3803
  const o = this.resizeTarget.width, r = this.resizeTarget.minWidth, a = this.resizeTarget.maxWidth;
3532
- let l = e.clientX - this.clientX;
3533
- l + o < s && (l = -(o - s)), r && l + o < r && (l = -(o - r)), a && l + o > a && (l = a - o), this.resizeDiff = l, this.ctx.emit("draw");
3804
+ let c = e.clientX - this.clientX;
3805
+ c + o < s && (c = -(o - s)), r && c + o < r && (c = -(o - r)), a && c + o > a && (c = a - o), this.resizeDiff = c, this.ctx.emit("draw");
3534
3806
  } else {
3535
3807
  if (this.resizeTarget = null, this.isMouseDown)
3536
3808
  return;
@@ -3541,9 +3813,9 @@ class ye {
3541
3813
  this.ctx.stageElement.style.cursor === "col-resize" && (this.ctx.stageElement.style.cursor = "default");
3542
3814
  const o = [...this.renderFixedCellHeaders, ...this.renderCenterCellHeaders];
3543
3815
  for (const r of o) {
3544
- const { offsetX: a, offsetY: l } = this.ctx.getOffset(e), h = a, d = r.getDrawX();
3545
- h > d + r.width - 5 && h < d + r.width + 4 && h < i - 4 && // 视窗中最后一列不允许调整宽
3546
- r.colspan <= 1 && this.ctx.isTarget(e) && l <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = r);
3816
+ const { offsetX: a, offsetY: c } = this.ctx.getOffset(e), l = a, d = r.getDrawX();
3817
+ l > d + r.width - 5 && l < d + r.width + 4 && l < i - 4 && // 视窗中最后一列不允许调整宽
3818
+ r.colspan <= 1 && this.ctx.isTarget(e) && c <= this.height && (this.ctx.stageElement.style.cursor = "col-resize", this.resizeTarget = r);
3547
3819
  }
3548
3820
  }
3549
3821
  }));
@@ -3597,10 +3869,10 @@ class ye {
3597
3869
  let s = e;
3598
3870
  const { HEADER_HEIGHT: o = 0 } = this.ctx.config;
3599
3871
  for (let r = 0; r < i; r++) {
3600
- const a = t[r], l = o * (a.rowspan || 0), h = o * (a.level || 0);
3872
+ const a = t[r], c = o * (a.rowspan || 0), l = o * (a.level || 0);
3601
3873
  let { minWidth: d, maxWidth: f } = a, u = a.width || 100;
3602
- d && u < d && (u = d), f && u > f && (u = f), a.children && (u = it(a.children).reduce((E, g) => E + ((g == null ? void 0 : g.width) || 100), 0));
3603
- const x = new ct(this.ctx, this.columnIndex, s, h, u, l, a);
3874
+ d && u < d && (u = d), f && u > f && (u = f), a.children && (u = et(a.children).reduce((m, g) => m + ((g == null ? void 0 : g.width) || 100), 0));
3875
+ const x = new lt(this.ctx, this.columnIndex, s, l, u, c, a);
3604
3876
  this.ctx.database.setHeader(a.key, x), this.allCellHeaders.push(x), a.children || (this.leafCellHeaders.push(x), x.column.widthFillDisable || this.resizeNum++), a.fixed === "left" ? this.fixedLeftCellHeaders.push(x) : a.fixed === "right" ? this.fixedRightCellHeaders.push(x) : this.centerCellHeaders.push(x), !a.children && this.columnIndex++, a.children && this.render(a.children, s), s += u;
3605
3877
  }
3606
3878
  }
@@ -3632,8 +3904,8 @@ class ye {
3632
3904
  colorStart: "rgba(0,0,0,0.1)",
3633
3905
  colorEnd: "rgba(0,0,0,0)"
3634
3906
  }), i < Math.floor(s.width - o - 1) && e !== a) {
3635
- const l = s.width - (this.x + this.width) + o - e;
3636
- this.ctx.paint.drawShadow(l, this.y, e, this.height, {
3907
+ const c = s.width - (this.x + this.width) + o - e;
3908
+ this.ctx.paint.drawShadow(c, this.y, e, this.height, {
3637
3909
  fillColor: r,
3638
3910
  side: "left",
3639
3911
  shadowWidth: 4,
@@ -3674,8 +3946,8 @@ class ye {
3674
3946
  }), this.drawTipLine(), this.drawBottomLine();
3675
3947
  }
3676
3948
  }
3677
- class Nt {
3678
- constructor(t, e, i = 0, s = 0, o = 0, r = 0, a, l = "body") {
3949
+ class Bt {
3950
+ constructor(t, e, i = 0, s = 0, o = 0, r = 0, a, c = "body") {
3679
3951
  n(this, "ctx");
3680
3952
  n(this, "x", 0);
3681
3953
  n(this, "y", 0);
@@ -3688,12 +3960,12 @@ class Nt {
3688
3960
  n(this, "rowKey", "");
3689
3961
  n(this, "rowType", "body");
3690
3962
  n(this, "data");
3691
- this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e) || "", this.rowType = l, this.data = a, this.update();
3963
+ this.ctx = t, this.x = i, this.y = s, this.width = o, this.height = r, this.rowIndex = e, this.rowKey = t.database.getRowKeyForRowIndex(e) || "", this.rowType = c, this.data = a, this.update();
3692
3964
  }
3693
3965
  update() {
3694
3966
  const { header: t } = this.ctx, e = [], i = [], s = [];
3695
3967
  t.renderLeafCellHeaders.forEach((o) => {
3696
- const r = new $(
3968
+ const r = new xt(
3697
3969
  this.ctx,
3698
3970
  this.rowIndex,
3699
3971
  o.colIndex,
@@ -3729,7 +4001,7 @@ class Nt {
3729
4001
  });
3730
4002
  }
3731
4003
  }
3732
- class Ce {
4004
+ class ve {
3733
4005
  constructor(t) {
3734
4006
  n(this, "resizeTarget", null);
3735
4007
  //调整行大小的目标
@@ -3766,8 +4038,8 @@ class Ce {
3766
4038
  FOOTER_FIXED: o,
3767
4039
  SCROLLER_TRACK_SIZE: r = 0,
3768
4040
  HEIGHT: a,
3769
- EMPTY_BODY_HEIGHT: l = 0,
3770
- MAX_HEIGHT: h = 0,
4041
+ EMPTY_BODY_HEIGHT: c = 0,
4042
+ MAX_HEIGHT: l = 0,
3771
4043
  ENABLE_OFFSET_HEIGHT: d = 0,
3772
4044
  OFFSET_HEIGHT: f = 0,
3773
4045
  FOOTER_POSITION: u
@@ -3778,33 +4050,33 @@ class Ce {
3778
4050
  this.x = 0, u === "top" && o ? this.y = e.height + i.height : this.y = e.height;
3779
4051
  const { data: x, sumHeight: w } = s.getData();
3780
4052
  this.height = w, this.data = x, this.width = e.width, this.visibleWidth = this.ctx.stageWidth - r;
3781
- const E = this.ctx.footer.height;
3782
- !this.data.length && !a ? this.height = l : !this.data.length && a && (this.height = a - e.height - E - r);
4053
+ const m = this.ctx.footer.height;
4054
+ !this.data.length && !a ? this.height = c : !this.data.length && a && (this.height = a - e.height - m - r);
3783
4055
  let g = this.height + e.height + r;
3784
- g += E;
3785
- let p = g;
3786
- const y = window.innerHeight, { top: m } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
3787
- if (y > m && d && !a) {
3788
- const O = y - m - f;
3789
- O > e.height + r ? p = O : g > h && (p = h);
3790
- } else this.data.length && a ? p = a : this.data.length && h && g > h && (p = h);
3791
- p > 0 && (this.ctx.stageHeight = Math.floor(p), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
4056
+ g += m;
4057
+ let E = g;
4058
+ const y = window.innerHeight, { top: p } = this.containerRect || this.ctx.containerElement.getBoundingClientRect();
4059
+ if (y > p && d && !a) {
4060
+ const O = y - p - f;
4061
+ O > e.height + r ? E = O : g > l && (E = l);
4062
+ } else this.data.length && a ? E = a : this.data.length && l && g > l && (E = l);
4063
+ E > 0 && (this.ctx.stageHeight = Math.floor(E), this.ctx.stageElement.style.height = `${this.ctx.stageHeight}px`);
3792
4064
  let b = this.ctx.stageHeight - e.height - r;
3793
- o ? this.visibleHeight = b - E : this.visibleHeight = b, this.data.length || (this.height = this.visibleHeight), this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = x;
3794
- const C = window.devicePixelRatio || 1, I = this.ctx.stageWidth * C, _ = this.ctx.stageHeight * C;
3795
- t.width = Math.round(I), t.height = Math.round(_);
4065
+ o ? this.visibleHeight = b - m : this.visibleHeight = b, this.data.length || (this.height = this.visibleHeight), this.ctx.body.x = this.x, this.ctx.body.y = this.y, this.ctx.body.width = this.width, this.ctx.body.height = this.height, this.ctx.body.visibleWidth = this.visibleWidth, this.ctx.body.visibleHeight = this.visibleHeight, this.ctx.body.data = x;
4066
+ const C = window.devicePixelRatio || 1, R = this.ctx.stageWidth * C, v = this.ctx.stageHeight * C;
4067
+ t.width = Math.round(R), t.height = Math.round(v);
3796
4068
  const T = this.data.length ? "not-empty" : "empty";
3797
4069
  this.ctx.emit("emptyChange", {
3798
4070
  isEmpty: T,
3799
4071
  type: T,
3800
4072
  headerHeight: e.height,
3801
4073
  bodyHeight: this.height,
3802
- footerHeight: E,
4074
+ footerHeight: m,
3803
4075
  width: this.width,
3804
- height: this.data.length ? 0 : l + E
4076
+ height: this.data.length ? 0 : c + m
3805
4077
  });
3806
- const v = Math.round(t.width / C * 1e4) / 1e4, R = Math.round(t.height / C * 1e4) / 1e4;
3807
- this.ctx.canvasElement.setAttribute("style", `height:${R}px;width:${v}px;`), this.ctx.paint.scale(C);
4078
+ const S = Math.round(t.width / C * 1e4) / 1e4, I = Math.round(t.height / C * 1e4) / 1e4;
4079
+ this.ctx.canvasElement.setAttribute("style", `height:${I}px;width:${S}px;`), this.ctx.paint.scale(C);
3808
4080
  }
3809
4081
  // 调整行的高度
3810
4082
  initResizeRow() {
@@ -3824,8 +4096,8 @@ class Ce {
3824
4096
  }), this.ctx.on("mousemove", (e) => {
3825
4097
  if (this.ctx.editing) return;
3826
4098
  const { offsetY: i, offsetX: s } = this.ctx.getOffset(e), o = i, r = s, a = e.clientY, {
3827
- stageHeight: l,
3828
- scrollY: h,
4099
+ stageHeight: c,
4100
+ scrollY: l,
3829
4101
  config: { RESIZE_ROW_MIN_HEIGHT: d = 0 }
3830
4102
  } = this.ctx;
3831
4103
  if (this.isResizing && this.resizeTarget) {
@@ -3844,10 +4116,10 @@ class Ce {
3844
4116
  this.ctx.stageElement.style.cursor === "row-resize" && (this.ctx.stageElement.style.cursor = "default");
3845
4117
  for (let f = 0; f < this.renderRows.length; f++) {
3846
4118
  const u = this.renderRows[f];
3847
- if (o > u.y - h + u.height - 1.5 && o < u.y - h + u.height + 1.5 && o < l - 4)
4119
+ if (o > u.y - l + u.height - 1.5 && o < u.y - l + u.height + 1.5 && o < c - 4)
3848
4120
  for (let w = 0; w < u.cells.length; w++) {
3849
- const E = u.cells[w];
3850
- r > E.drawX + 10 && r < E.drawX + E.width - 10 && E.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = u);
4121
+ const m = u.cells[w];
4122
+ r > m.drawX + 10 && r < m.drawX + m.width - 10 && m.rowspan === 1 && (this.ctx.stageElement.style.cursor = "row-resize", this.resizeTarget = u);
3851
4123
  }
3852
4124
  }
3853
4125
  }
@@ -3893,8 +4165,8 @@ class Ce {
3893
4165
  colorStart: "rgba(0,0,0,0.1)",
3894
4166
  colorEnd: "rgba(0,0,0,0)"
3895
4167
  }), i < Math.floor(s.width - o - 1) && e !== a) {
3896
- const l = s.width - (this.x + this.width) + o - e;
3897
- this.ctx.paint.drawShadow(l, this.y, e, this.height, {
4168
+ const c = s.width - (this.x + this.width) + o - e;
4169
+ this.ctx.paint.drawShadow(c, this.y, e, this.height, {
3898
4170
  fillColor: r,
3899
4171
  side: "left",
3900
4172
  shadowWidth: 4,
@@ -3922,15 +4194,15 @@ class Ce {
3922
4194
  config: { CELL_HEIGHT: s }
3923
4195
  } = this.ctx, o = i, { data: r, positions: a } = e.getData();
3924
4196
  this.ctx.maxRowIndex = r.length - 1;
3925
- let l = this.binarySearch(a, o), h = this.binarySearch(a, o + this.visibleHeight);
3926
- if (h === -1 && (h = this.ctx.maxRowIndex), l === -1 && h === this.ctx.maxRowIndex) {
4197
+ let c = this.binarySearch(a, o), l = this.binarySearch(a, o + this.visibleHeight);
4198
+ if (l === -1 && (l = this.ctx.maxRowIndex), c === -1 && l === this.ctx.maxRowIndex) {
3927
4199
  const f = Math.floor(this.visibleHeight / s);
3928
- l = this.ctx.maxRowIndex - f;
4200
+ c = this.ctx.maxRowIndex - f;
3929
4201
  }
3930
- this.headIndex = Math.max(0, l), this.tailIndex = Math.min(this.ctx.maxRowIndex, h + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
4202
+ this.headIndex = Math.max(0, c), this.tailIndex = Math.min(this.ctx.maxRowIndex, l + 1), this.visibleRows = r.slice(this.headIndex, this.tailIndex + 1), this.ctx.body.headIndex = this.headIndex, this.ctx.body.tailIndex = this.tailIndex, this.ctx.body.visibleRows = this.visibleRows;
3931
4203
  const d = [];
3932
4204
  for (let f = 0; f < this.visibleRows.length; f++) {
3933
- const u = this.headIndex + f, x = this.visibleRows[f], { height: w, top: E } = this.ctx.database.getPositionForRowIndex(u), g = new Nt(this.ctx, u, 0, E + this.y, t.width, w, x);
4205
+ const u = this.headIndex + f, x = this.visibleRows[f], { height: w, top: m } = this.ctx.database.getPositionForRowIndex(u), g = new Bt(this.ctx, u, 0, m + this.y, t.width, w, x);
3934
4206
  d.push(g);
3935
4207
  }
3936
4208
  this.renderRows = d, this.ctx.body.renderRows = d;
@@ -3947,7 +4219,7 @@ class Ce {
3947
4219
  }), this.drawTipLine();
3948
4220
  }
3949
4221
  }
3950
- class be {
4222
+ class _e {
3951
4223
  constructor(t) {
3952
4224
  n(this, "ctx");
3953
4225
  n(this, "renderRows", []);
@@ -3978,16 +4250,16 @@ class be {
3978
4250
  stageWidth: o,
3979
4251
  config: { HEADER_BG_COLOR: r, SCROLLER_TRACK_SIZE: a }
3980
4252
  } = this.ctx;
3981
- let l = this.y;
3982
- if (this.ctx.config.FOOTER_FIXED || (l = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, l, t, this.height, {
4253
+ let c = this.y;
4254
+ if (this.ctx.config.FOOTER_FIXED || (c = this.y - this.ctx.scrollY), i > 0 && t !== 0 && this.ctx.paint.drawShadow(this.x, c, t, this.height, {
3983
4255
  fillColor: r,
3984
4256
  side: "right",
3985
4257
  shadowWidth: 4,
3986
4258
  colorStart: "rgba(0,0,0,0.1)",
3987
4259
  colorEnd: "rgba(0,0,0,0)"
3988
4260
  }), i < Math.floor(s.width - o - 1) && e !== a) {
3989
- const h = s.width - (this.x + this.width) + o - e;
3990
- this.ctx.paint.drawShadow(h, l, e, this.height, {
4261
+ const l = s.width - (this.x + this.width) + o - e;
4262
+ this.ctx.paint.drawShadow(l, c, e, this.height, {
3991
4263
  fillColor: r,
3992
4264
  side: "left",
3993
4265
  shadowWidth: 4,
@@ -4002,7 +4274,7 @@ class be {
4002
4274
  let e = this.y;
4003
4275
  const i = [];
4004
4276
  this.data.forEach((s, o) => {
4005
- const r = new Nt(this.ctx, o, 0, e, this.width, t, s, "footer");
4277
+ const r = new Bt(this.ctx, o, 0, e, this.width, t, s, "footer");
4006
4278
  e += t, i.push(r);
4007
4279
  }), this.renderRows = i, this.ctx.footer.renderRows = this.renderRows;
4008
4280
  }
@@ -4028,7 +4300,7 @@ class be {
4028
4300
  }), this.drawTopLine();
4029
4301
  }
4030
4302
  }
4031
- class Re {
4303
+ class Te {
4032
4304
  // 垂直滚动定时器
4033
4305
  constructor(t) {
4034
4306
  n(this, "isCut", !1);
@@ -4047,7 +4319,7 @@ class Re {
4047
4319
  this.moveFocus(t);
4048
4320
  }), this.ctx.on(
4049
4321
  "mousemove",
4050
- At((t) => {
4322
+ Ht((t) => {
4051
4323
  const { offsetY: e, offsetX: i } = this.ctx.getOffset(t), s = this.ctx.isTarget(t) && i > 0 && i < this.ctx.body.visibleWidth && e > this.ctx.header.visibleHeight && e < this.ctx.header.visibleHeight + this.ctx.body.visibleHeight;
4052
4324
  (this.ctx.selectorMove || this.ctx.autofillMove) && (!s && !this.mousedownHeader ? this.startAdjustPosition(t) : this.stopAdjustPosition());
4053
4325
  }, 100)
@@ -4145,30 +4417,30 @@ class Re {
4145
4417
  this.ctx.mousedown && (this.ctx.selectorMove = !0), this.ctx.selector.enable = !0;
4146
4418
  const {
4147
4419
  SELECTOR_AREA_MIN_X: a,
4148
- SELECTOR_AREA_MAX_X: l,
4149
- SELECTOR_AREA_MIN_Y: h,
4420
+ SELECTOR_AREA_MAX_X: c,
4421
+ SELECTOR_AREA_MIN_Y: l,
4150
4422
  SELECTOR_AREA_MAX_Y: d,
4151
4423
  SELECTOR_AREA_MAX_X_OFFSET: f,
4152
4424
  SELECTOR_AREA_MAX_Y_OFFSET: u
4153
- } = this.ctx.config, x = a, w = l || this.ctx.maxColIndex - f, E = h, g = d || this.ctx.maxRowIndex - u;
4154
- let [p, y] = o, [m, b] = r;
4155
- if (p < x || y > w || m < E || b > g)
4425
+ } = this.ctx.config, x = a, w = c || this.ctx.maxColIndex - f, m = l, g = d || this.ctx.maxRowIndex - u;
4426
+ let [E, y] = o, [p, b] = r;
4427
+ if (E < x || y > w || p < m || b > g)
4156
4428
  return;
4157
4429
  if (this.ctx.stageElement.focus({ preventScroll: !0 }), this.ctx.config.ENABLE_MERGE_CELL_LINK) {
4158
- const I = this.adjustMergeCells(o, r);
4159
- m = I.yArr[0], b = I.yArr[1], p = I.xArr[0], y = I.xArr[1], this.ctx.onlyMergeCell = I.onlyMergeCell;
4430
+ const R = this.adjustMergeCells(o, r);
4431
+ p = R.yArr[0], b = R.yArr[1], E = R.xArr[0], y = R.xArr[1], this.ctx.onlyMergeCell = R.onlyMergeCell;
4160
4432
  }
4161
- p === y && m === b ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, p), Math.min(w, y)], r = [Math.max(E, m), Math.min(g, b)];
4433
+ E === y && p === b ? this.ctx.selectOnlyOne = !0 : this.ctx.selectOnlyOne = !1, o = [Math.max(x, E), Math.min(w, y)], r = [Math.max(m, p), Math.min(g, b)];
4162
4434
  const { BEFORE_SET_SELECTOR_METHOD: C } = this.ctx.config;
4163
4435
  if (typeof C == "function") {
4164
- const _ = C({
4436
+ const v = C({
4165
4437
  focusCell: this.ctx.focusCell,
4166
4438
  xArr: o,
4167
4439
  yArr: r
4168
4440
  });
4169
- if (!_)
4441
+ if (!v)
4170
4442
  return;
4171
- o = _.xArr, r = _.yArr;
4443
+ o = v.xArr, r = v.yArr;
4172
4444
  }
4173
4445
  this.ctx.selector.xArr = o, this.ctx.selector.yArr = r, this.ctx.emit("setSelector", this.ctx.selector), this.ctx.emit("drawView");
4174
4446
  }
@@ -4176,35 +4448,35 @@ class Re {
4176
4448
  adjustMergeCells(t, e) {
4177
4449
  var w;
4178
4450
  const [i, s] = e, [o, r] = t;
4179
- let a = [], l = [];
4180
- for (let E = 0; E <= e[1] - e[0]; E++)
4451
+ let a = [], c = [];
4452
+ for (let m = 0; m <= e[1] - e[0]; m++)
4181
4453
  for (let g = 0; g <= t[1] - t[0]; g++) {
4182
- const p = E + e[0], y = g + t[0], m = this.ctx.database.getVirtualBodyCell(p, y);
4183
- m && ((p === i || p === s) && a.push(m), (y === o || y === r) && l.push(m));
4454
+ const E = m + e[0], y = g + t[0], p = this.ctx.database.getVirtualBodyCell(E, y);
4455
+ p && ((E === i || E === s) && a.push(p), (y === o || y === r) && c.push(p));
4184
4456
  }
4185
- const h = a.reduce(
4186
- (E, g) => {
4187
- const { yArr: p } = g.getSpanInfo(), [y, m] = p;
4188
- return E.minY = Math.min(E.minY, y), E.maxY = Math.max(E.maxY, m), E;
4457
+ const l = a.reduce(
4458
+ (m, g) => {
4459
+ const { yArr: E } = g.getSpanInfo(), [y, p] = E;
4460
+ return m.minY = Math.min(m.minY, y), m.maxY = Math.max(m.maxY, p), m;
4189
4461
  },
4190
4462
  {
4191
4463
  minY: i,
4192
4464
  maxY: s
4193
4465
  }
4194
- ), d = l.reduce(
4195
- (E, g) => {
4196
- const { xArr: p } = g.getSpanInfo(), [y, m] = p;
4197
- return E.minX = Math.min(E.minX, y), E.maxX = Math.max(E.maxX, m), E;
4466
+ ), d = c.reduce(
4467
+ (m, g) => {
4468
+ const { xArr: E } = g.getSpanInfo(), [y, p] = E;
4469
+ return m.minX = Math.min(m.minX, y), m.maxX = Math.max(m.maxX, p), m;
4198
4470
  },
4199
4471
  {
4200
4472
  minX: o,
4201
4473
  maxX: r
4202
4474
  }
4203
- ), f = [d.minX, d.maxX], u = [h.minY, h.maxY];
4475
+ ), f = [d.minX, d.maxX], u = [l.minY, l.maxY];
4204
4476
  let x = !1;
4205
- if (d.minX !== d.maxX || h.minY !== h.maxY) {
4206
- const E = JSON.stringify(f) + JSON.stringify(u), g = (w = this.ctx.focusCell) == null ? void 0 : w.getSpanInfo();
4207
- x = (g && JSON.stringify(g.xArr) + JSON.stringify(g.yArr)) === E;
4477
+ if (d.minX !== d.maxX || l.minY !== l.maxY) {
4478
+ const m = JSON.stringify(f) + JSON.stringify(u), g = (w = this.ctx.focusCell) == null ? void 0 : w.getSpanInfo();
4479
+ x = (g && JSON.stringify(g.xArr) + JSON.stringify(g.yArr)) === m;
4208
4480
  }
4209
4481
  return {
4210
4482
  xArr: f,
@@ -4223,15 +4495,15 @@ class Re {
4223
4495
  if (this.ctx.mousedown && this.ctx.focusCellHeader) {
4224
4496
  const { colIndex: a } = this.ctx.focusCellHeader;
4225
4497
  if (this.ctx.clearSelector(), t.colIndex >= a) {
4226
- const l = [a, t.colIndex + t.colspan - 1], h = [o, r];
4227
- this.setSelector(l, h);
4498
+ const c = [a, t.colIndex + t.colspan - 1], l = [o, r];
4499
+ this.setSelector(c, l);
4228
4500
  } else {
4229
- const l = [t.colIndex, a], h = [o, r];
4230
- this.setSelector(l, h);
4501
+ const c = [t.colIndex, a], l = [o, r];
4502
+ this.setSelector(c, l);
4231
4503
  }
4232
4504
  } else {
4233
- const a = [t.colIndex, t.colIndex + t.colspan - 1], l = [o, r];
4234
- this.setSelector(a, l);
4505
+ const a = [t.colIndex, t.colIndex + t.colspan - 1], c = [o, r];
4506
+ this.setSelector(a, c);
4235
4507
  }
4236
4508
  }
4237
4509
  selectAll() {
@@ -4245,8 +4517,8 @@ class Re {
4245
4517
  SELECTOR_AREA_MIN_Y: o,
4246
4518
  SELECTOR_AREA_MAX_Y: r,
4247
4519
  SELECTOR_AREA_MAX_X_OFFSET: a,
4248
- SELECTOR_AREA_MAX_Y_OFFSET: l
4249
- } = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - l, x = [h, d], w = [f, u];
4520
+ SELECTOR_AREA_MAX_Y_OFFSET: c
4521
+ } = this.ctx.config, l = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - c, x = [l, d], w = [f, u];
4250
4522
  this.setSelector(x, w);
4251
4523
  }
4252
4524
  }
@@ -4256,17 +4528,17 @@ class Re {
4256
4528
  const { SELECTOR_AREA_MIN_X: i, SELECTOR_AREA_MAX_X: s, SELECTOR_AREA_MAX_X_OFFSET: o } = this.ctx.config, r = s || this.ctx.maxColIndex - o, a = i;
4257
4529
  if (e) {
4258
4530
  this.ctx.setFocusCell(t);
4259
- const l = [a, r], h = [t.rowIndex, t.rowIndex];
4260
- this.setSelector(l, h);
4531
+ const c = [a, r], l = [t.rowIndex, t.rowIndex];
4532
+ this.setSelector(c, l);
4261
4533
  }
4262
4534
  if (this.ctx.focusCell && this.ctx.mousedown) {
4263
- const { rowIndex: l } = this.ctx.focusCell;
4264
- if (t.rowIndex >= l) {
4265
- const h = [a, r], d = [l, t.rowIndex];
4266
- this.setSelector(h, d);
4535
+ const { rowIndex: c } = this.ctx.focusCell;
4536
+ if (t.rowIndex >= c) {
4537
+ const l = [a, r], d = [c, t.rowIndex];
4538
+ this.setSelector(l, d);
4267
4539
  } else {
4268
- const h = [a, r], d = [t.rowIndex, l];
4269
- this.setSelector(h, d);
4540
+ const l = [a, r], d = [t.rowIndex, c];
4541
+ this.setSelector(l, d);
4270
4542
  }
4271
4543
  }
4272
4544
  }
@@ -4275,7 +4547,7 @@ class Re {
4275
4547
  return;
4276
4548
  const { mousedown: t, focusCell: e, hoverCell: i } = this.ctx;
4277
4549
  if (t && e && i) {
4278
- const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), a = Math.max(i.colIndex, o), l = Math.min(i.rowIndex, s), h = Math.max(i.rowIndex, s), d = [r, a], f = [l, h];
4550
+ const { rowIndex: s, colIndex: o } = e, r = Math.min(i.colIndex, o), a = Math.max(i.colIndex, o), c = Math.min(i.rowIndex, s), l = Math.max(i.rowIndex, s), d = [r, a], f = [c, l];
4279
4551
  this.setSelector(d, f);
4280
4552
  }
4281
4553
  }
@@ -4285,7 +4557,7 @@ class Re {
4285
4557
  if (this.ctx.selector.enable = !0, i && t) {
4286
4558
  if (this.ctx.config.ENABLE_SELECTOR_SINGLE)
4287
4559
  return;
4288
- const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: a } = e, l = Math.min(r, s), h = Math.max(r, s), d = Math.min(a, o), f = Math.max(a, o), u = [l, h], x = [d, f];
4560
+ const { colIndex: s, rowIndex: o } = i, { colIndex: r, rowIndex: a } = e, c = Math.min(r, s), l = Math.max(r, s), d = Math.min(a, o), f = Math.max(a, o), u = [c, l], x = [d, f];
4289
4561
  this.setSelector(u, x);
4290
4562
  } else {
4291
4563
  this.ctx.emit("cellSelectedClick", e);
@@ -4338,7 +4610,7 @@ class Re {
4338
4610
  return;
4339
4611
  t = a.data;
4340
4612
  }
4341
- const o = ae(t);
4613
+ const o = le(t);
4342
4614
  navigator.clipboard ? navigator.clipboard.writeText(o).then(() => {
4343
4615
  this.ctx.selector.xArrCopy = this.ctx.selector.xArr.slice(), this.ctx.selector.yArrCopy = this.ctx.selector.yArr.slice(), this.ctx.emit("copyChange", {
4344
4616
  xArr: this.ctx.selector.xArrCopy,
@@ -4350,9 +4622,9 @@ class Re {
4350
4622
  clearSelectedData(t, e, i = !1, s = null) {
4351
4623
  let o = [];
4352
4624
  const r = /* @__PURE__ */ new Set();
4353
- for (let l = 0; l <= e[1] - e[0]; l++)
4354
- for (let h = 0; h <= t[1] - t[0]; h++) {
4355
- const d = l + e[0], f = h + t[0], u = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
4625
+ for (let c = 0; c <= e[1] - e[0]; c++)
4626
+ for (let l = 0; l <= t[1] - t[0]; l++) {
4627
+ const d = c + e[0], f = l + t[0], u = this.ctx.database.getItemValueForRowIndexAndColIndex(d, f);
4356
4628
  if (u) {
4357
4629
  const { rowKey: x, key: w } = u;
4358
4630
  this.ctx.database.getReadonly(x, w) || (r.add(x), o.push({
@@ -4370,8 +4642,8 @@ class Re {
4370
4642
  return o;
4371
4643
  this.ctx.database.batchSetItemValue(o, !0);
4372
4644
  let a = [];
4373
- return r.forEach((l) => {
4374
- a.push(this.ctx.database.getRowDataItemForRowKey(l));
4645
+ return r.forEach((c) => {
4646
+ a.push(this.ctx.database.getRowDataItemForRowKey(c));
4375
4647
  }), this.ctx.emit("clearSelectedDataChange", o, a), o;
4376
4648
  }
4377
4649
  paste() {
@@ -4383,39 +4655,39 @@ class Re {
4383
4655
  if (this.ctx.selector.enable && t) {
4384
4656
  const e = this.ctx.selector.yArr[0], i = this.ctx.selector.xArr[0], s = /* @__PURE__ */ new Set();
4385
4657
  navigator.clipboard.readText().then(async (o) => {
4386
- let r = ne(o);
4387
- const a = [i, i + r[0].length - 1], l = [e, e + r.length - 1], [h, d] = l, [f, u] = a, x = d - this.ctx.maxRowIndex, w = u - this.ctx.maxColIndex;
4658
+ let r = ce(o);
4659
+ const a = [i, i + r[0].length - 1], c = [e, e + r.length - 1], [l, d] = c, [f, u] = a, x = d - this.ctx.maxRowIndex, w = u - this.ctx.maxColIndex;
4388
4660
  (x > 0 || w > 0) && this.ctx.emit("onPastedDataOverflow", {
4389
4661
  maxY: d,
4390
4662
  maxX: u,
4391
- minY: h,
4663
+ minY: l,
4392
4664
  minX: f,
4393
4665
  overflowRowCount: x,
4394
4666
  overflowColCount: w,
4395
4667
  textArr: r
4396
4668
  });
4397
- const E = r.length === 1 && r[0].length === 1;
4398
- if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !E) {
4399
- const m = {
4669
+ const m = r.length === 1 && r[0].length === 1;
4670
+ if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, c) && !m) {
4671
+ const p = {
4400
4672
  code: "ERR_MERGED_CELLS_PASTE",
4401
4673
  message: "Merged cells cannot span paste data"
4402
4674
  };
4403
- this.ctx.hasEvent("error") ? this.ctx.emit("error", m) : alert(m.message);
4675
+ this.ctx.hasEvent("error") ? this.ctx.emit("error", p) : alert(p.message);
4404
4676
  return;
4405
4677
  }
4406
4678
  let g = [];
4407
- for (let m = 0; m <= r.length - 1; m++) {
4408
- const b = r[m].length;
4679
+ for (let p = 0; p <= r.length - 1; p++) {
4680
+ const b = r[p].length;
4409
4681
  for (let C = 0; C <= b - 1; C++) {
4410
- const I = m + e, _ = C + i, T = r[m][C], v = this.ctx.database.getItemValueForRowIndexAndColIndex(
4411
- I,
4412
- _
4682
+ const R = p + e, v = C + i, T = r[p][C], S = this.ctx.database.getItemValueForRowIndexAndColIndex(
4683
+ R,
4684
+ v
4413
4685
  );
4414
- if (v) {
4415
- const { rowKey: R, key: S } = v;
4416
- this.ctx.database.getReadonly(R, S) || (s.add(R), g.push({
4417
- rowKey: R,
4418
- key: S,
4686
+ if (S) {
4687
+ const { rowKey: I, key: _ } = S;
4688
+ this.ctx.database.getReadonly(I, _) || (s.add(I), g.push({
4689
+ rowKey: I,
4690
+ key: _,
4419
4691
  value: T,
4420
4692
  row: {}
4421
4693
  //内部有设置
@@ -4424,34 +4696,34 @@ class Re {
4424
4696
  }
4425
4697
  }
4426
4698
  if (this.isCut) {
4427
- const m = this.clearSelectedData(
4699
+ const p = this.clearSelectedData(
4428
4700
  this.ctx.selector.xArrCopy,
4429
4701
  this.ctx.selector.yArrCopy,
4430
4702
  !0
4431
4703
  // 忽略设置,只返回数据,用于cut,实现历史回退需要返回两次问题
4432
4704
  ), b = g.map((C) => `${C.rowKey}-${C.key}`);
4433
- m.forEach((C) => {
4705
+ p.forEach((C) => {
4434
4706
  b.includes(`${C.rowKey}-${C.key}`) || g.unshift(C);
4435
4707
  }), this.isCut = !1;
4436
4708
  }
4437
4709
  if (!g.length)
4438
4710
  return;
4439
- const { BEFORE_PASTE_DATA_METHOD: p } = this.ctx.config;
4440
- if (typeof p == "function") {
4441
- const m = p, b = g.map((C) => ({
4711
+ const { BEFORE_PASTE_DATA_METHOD: E } = this.ctx.config;
4712
+ if (typeof E == "function") {
4713
+ const p = E, b = g.map((C) => ({
4442
4714
  rowKey: C.rowKey,
4443
4715
  key: C.key,
4444
4716
  value: C.value,
4445
4717
  oldValue: this.ctx.database.getItemValue(C.rowKey, C.key),
4446
4718
  row: this.ctx.database.getRowDataItemForRowKey(C.rowKey)
4447
4719
  }));
4448
- if (g = await m(b, a, l, r), g && !g.length)
4720
+ if (g = await p(b, a, c, r), g && !g.length)
4449
4721
  return;
4450
4722
  }
4451
4723
  this.clearCopyLine(), this.ctx.batchSetItemValueByEditor(g, !0);
4452
4724
  let y = [];
4453
- s.forEach((m) => {
4454
- y.push(this.ctx.database.getRowDataItemForRowKey(m));
4725
+ s.forEach((p) => {
4726
+ y.push(this.ctx.database.getRowDataItemForRowKey(p));
4455
4727
  }), this.ctx.emit("pasteChange", g, y);
4456
4728
  }).catch((o) => {
4457
4729
  console.error("Failed to get the clipboard content:", o);
@@ -4468,7 +4740,7 @@ class Re {
4468
4740
  if (!e)
4469
4741
  return;
4470
4742
  let { colIndex: i = 0, rowIndex: s = 0 } = e;
4471
- const o = 0, r = 0, a = this.ctx.maxColIndex, l = this.ctx.maxRowIndex;
4743
+ const o = 0, r = 0, a = this.ctx.maxColIndex, c = this.ctx.maxRowIndex;
4472
4744
  switch (t) {
4473
4745
  case "LEFT":
4474
4746
  i > o && i--;
@@ -4480,11 +4752,11 @@ class Re {
4480
4752
  i < a && i++;
4481
4753
  break;
4482
4754
  case "BOTTOM":
4483
- s < l && s++;
4755
+ s < c && s++;
4484
4756
  break;
4485
4757
  }
4486
- const h = [i, i], d = [s, s], f = this.getCell(s, i);
4487
- f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(h, d), this.adjustBoundaryPosition(), this.ctx.emit("moveFocus", f), this.ctx.emit("draw")));
4758
+ const l = [i, i], d = [s, s], f = this.getCell(s, i);
4759
+ f && (f.operation || this.isInSettingRange(f.rowIndex, f.colIndex) && (this.ctx.setFocusCell(f), this.setSelector(l, d), this.adjustBoundaryPosition(), this.ctx.emit("moveFocus", f), this.ctx.emit("draw")));
4488
4760
  }
4489
4761
  stopAdjustPosition() {
4490
4762
  this.adjustPositionX = "", this.adjustPositionY = "", this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerY && (clearInterval(this.timerY), this.timerY = 0);
@@ -4497,9 +4769,9 @@ class Re {
4497
4769
  SELECTOR_AREA_MIN_Y: o,
4498
4770
  SELECTOR_AREA_MAX_Y: r,
4499
4771
  SELECTOR_AREA_MAX_X_OFFSET: a,
4500
- SELECTOR_AREA_MAX_Y_OFFSET: l
4501
- } = this.ctx.config, h = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - l;
4502
- return !(e < h || e > d || t < f || t > u);
4772
+ SELECTOR_AREA_MAX_Y_OFFSET: c
4773
+ } = this.ctx.config, l = i, d = s || this.ctx.maxColIndex - a, f = o, u = r || this.ctx.maxRowIndex - c;
4774
+ return !(e < l || e > d || t < f || t > u);
4503
4775
  }
4504
4776
  /**
4505
4777
  * 调整滚动条位置,让到达边界时自动滚动
@@ -4512,8 +4784,8 @@ class Re {
4512
4784
  let a = 10 * (s === "left" ? -1 : 1);
4513
4785
  this.timerX && (clearInterval(this.timerX), this.timerX = 0), this.timerX = setInterval(() => {
4514
4786
  a *= 1.5;
4515
- const { scrollX: l } = this.ctx, h = l + a;
4516
- (h < 0 || h > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(h);
4787
+ const { scrollX: c } = this.ctx, l = c + a;
4788
+ (l < 0 || l > this.ctx.body.width) && (clearInterval(this.timerX), this.timerX = 0), this.ctx.setScrollX(l);
4517
4789
  }, 100);
4518
4790
  }
4519
4791
  if (o && this.adjustPositionY !== o) {
@@ -4521,8 +4793,8 @@ class Re {
4521
4793
  let a = 10 * (o === "top" ? -1 : 1);
4522
4794
  this.timerY && (clearInterval(this.timerY), this.timerY = 0), this.timerY = setInterval(() => {
4523
4795
  a *= 1.5;
4524
- const { scrollY: l } = this.ctx, h = l + a;
4525
- (h < 0 || h > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(h);
4796
+ const { scrollY: c } = this.ctx, l = c + a;
4797
+ (l < 0 || l > this.ctx.body.height) && (clearInterval(this.timerY), this.timerY = 0), this.ctx.setScrollY(l);
4526
4798
  }, 100);
4527
4799
  }
4528
4800
  }
@@ -4538,28 +4810,28 @@ class Re {
4538
4810
  fixedLeftWidth: o,
4539
4811
  header: r,
4540
4812
  footer: a,
4541
- body: l,
4542
- scrollX: h,
4813
+ body: c,
4814
+ scrollX: l,
4543
4815
  scrollY: d,
4544
4816
  config: { SCROLLER_TRACK_SIZE: f, FOOTER_FIXED: u, FOOTER_POSITION: x, ENABLE_MERGE_CELL_LINK: w }
4545
4817
  } = this.ctx;
4546
4818
  if (!i)
4547
4819
  return;
4548
4820
  w && this.ctx.onlyMergeCell && i.updateSpanInfo();
4549
- const { drawX: E, drawY: g, width: p, height: y, fixed: m } = i, b = o - E + 1, C = i.drawX + p - (e - s) + 1;
4550
- let I = r.height - g, _ = y;
4551
- _ > l.visibleHeight && (_ = l.visibleHeight);
4821
+ const { drawX: m, drawY: g, width: E, height: y, fixed: p } = i, b = o - m + 1, C = i.drawX + E - (e - s) + 1;
4822
+ let R = r.height - g, v = y;
4823
+ v > c.visibleHeight && (v = c.visibleHeight);
4552
4824
  let T = 0;
4553
- u && (x === "top" ? I = r.height + a.height - g : T = a.visibleHeight);
4554
- const v = g + _ - (t - T - f);
4555
- let R = h, S = d;
4556
- C > 0 && !m ? R = Math.floor(h + C) : b > 0 && !m && (R = Math.floor(h - b)), I > 0 ? S = Math.floor(d - I) : v > 0 && (S = Math.floor(d + v)), (Math.abs(h - R) > 2 || Math.abs(d - S) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(R, S), this.ctx.emit("adjustBoundaryPosition", i));
4825
+ u && (x === "top" ? R = r.height + a.height - g : T = a.visibleHeight);
4826
+ const S = g + v - (t - T - f);
4827
+ let I = l, _ = d;
4828
+ C > 0 && !p ? I = Math.floor(l + C) : b > 0 && !p && (I = Math.floor(l - b)), R > 0 ? _ = Math.floor(d - R) : S > 0 && (_ = Math.floor(d + S)), (Math.abs(l - I) > 2 || Math.abs(d - _) > 2) && (this.ctx.adjustPositioning = !0, this.ctx.setScroll(I, _), this.ctx.emit("adjustBoundaryPosition", i));
4557
4829
  }
4558
4830
  destroy() {
4559
4831
  this.timerX && (clearTimeout(this.timerX), this.timerX = 0), this.timerY && (clearTimeout(this.timerY), this.timerY = 0);
4560
4832
  }
4561
4833
  }
4562
- class Ie {
4834
+ class Oe {
4563
4835
  constructor(t) {
4564
4836
  n(this, "ctx");
4565
4837
  n(this, "maxColRowCell");
@@ -4569,7 +4841,7 @@ class Ie {
4569
4841
  this.ctx.on("mousemove", (t) => {
4570
4842
  if (this.ctx.stageElement.style.cursor === "crosshair" && (this.ctx.stageElement.style.cursor = "default"), this.ctx.editing || !this.ctx.focusCell || !this.maxColRowCell)
4571
4843
  return;
4572
- const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: a, width: l, height: h } = this.maxColRowCell, d = 6, f = s === this.ctx.maxColIndex || o === this.ctx.maxRowIndex ? 0 : 2, u = r + l - d + f, x = a + h - d + f;
4844
+ const { offsetX: e, offsetY: i } = this.ctx.getOffset(t), { colIndex: s, rowIndex: o, drawX: r, drawY: a, width: c, height: l } = this.maxColRowCell, d = 6, f = s === this.ctx.maxColIndex || o === this.ctx.maxRowIndex ? 0 : 2, u = r + c - d + f, x = a + l - d + f;
4573
4845
  e > u && i > x && e < u + d && i < x + d && (this.ctx.stageElement.style.cursor = "crosshair");
4574
4846
  }), this.ctx.on("cellMouseenter", (t) => {
4575
4847
  const { xArr: e, yArr: i } = this.ctx.selector, s = e[1], o = i[1], { colIndex: r, rowIndex: a } = t;
@@ -4602,29 +4874,29 @@ class Ie {
4602
4874
  return;
4603
4875
  let r = t, a = e;
4604
4876
  if (!o) {
4605
- const [l] = a;
4606
- a = [l, l];
4877
+ const [c] = a;
4878
+ a = [c, c];
4607
4879
  }
4608
4880
  if (!s) {
4609
- const [l] = r;
4610
- r = [l, l];
4881
+ const [c] = r;
4882
+ r = [c, c];
4611
4883
  }
4612
4884
  if (JSON.stringify(this.ctx.autofill.xArr) !== JSON.stringify(r) || JSON.stringify(this.ctx.autofill.yArr) !== JSON.stringify(a)) {
4613
4885
  const {
4614
- SELECTOR_AREA_MIN_X: l,
4615
- SELECTOR_AREA_MAX_X: h,
4886
+ SELECTOR_AREA_MIN_X: c,
4887
+ SELECTOR_AREA_MAX_X: l,
4616
4888
  SELECTOR_AREA_MIN_Y: d,
4617
4889
  SELECTOR_AREA_MAX_Y: f,
4618
4890
  SELECTOR_AREA_MAX_X_OFFSET: u,
4619
4891
  SELECTOR_AREA_MAX_Y_OFFSET: x
4620
- } = this.ctx.config, w = l, E = h || this.ctx.maxColIndex - u, g = d, p = f || this.ctx.maxRowIndex - x;
4621
- let [y, m] = r, [b, C] = a;
4892
+ } = this.ctx.config, w = c, m = l || this.ctx.maxColIndex - u, g = d, E = f || this.ctx.maxRowIndex - x;
4893
+ let [y, p] = r, [b, C] = a;
4622
4894
  if (y < w || b < g)
4623
4895
  return;
4624
- r = [Math.max(w, y), Math.min(E, m)], a = [Math.max(g, b), Math.min(p, C)];
4625
- const { BEFORE_SET_AUTOFILL_METHOD: I } = this.ctx.config;
4626
- if (typeof I == "function") {
4627
- const T = I({
4896
+ r = [Math.max(w, y), Math.min(m, p)], a = [Math.max(g, b), Math.min(E, C)];
4897
+ const { BEFORE_SET_AUTOFILL_METHOD: R } = this.ctx.config;
4898
+ if (typeof R == "function") {
4899
+ const T = R({
4628
4900
  focusCell: this.ctx.focusCell,
4629
4901
  xArr: r,
4630
4902
  yArr: a
@@ -4643,11 +4915,11 @@ class Ie {
4643
4915
  const t = /* @__PURE__ */ new Set(), e = this.ctx.getSelectedData(), i = /* @__PURE__ */ new Map();
4644
4916
  for (let x = 0; x <= e.yArr[1] - e.yArr[0]; x++)
4645
4917
  for (let w = 0; w <= e.xArr[1] - e.xArr[0]; w++) {
4646
- const E = x + e.yArr[0], g = w + e.xArr[0];
4647
- i.set(`${E}-${g}`, !0);
4918
+ const m = x + e.yArr[0], g = w + e.xArr[0];
4919
+ i.set(`${m}-${g}`, !0);
4648
4920
  }
4649
- const { value: s } = e, o = s[0].length, r = s.length, a = this.ctx.autofill.xArr, l = this.ctx.autofill.yArr, h = o === 1 && r === 1;
4650
- if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, l) && !h) {
4921
+ const { value: s } = e, o = s[0].length, r = s.length, a = this.ctx.autofill.xArr, c = this.ctx.autofill.yArr, l = o === 1 && r === 1;
4922
+ if (this.ctx.config.ENABLE_MERGE_CELL_LINK && this.ctx.database.hasMergeCell(a, c) && !l) {
4651
4923
  const x = {
4652
4924
  code: "ERR_MERGED_CELLS_AUTOFILL",
4653
4925
  message: "Merged cells cannot span autofill data"
@@ -4656,15 +4928,15 @@ class Ie {
4656
4928
  return;
4657
4929
  }
4658
4930
  let d = [];
4659
- for (let x = 0; x <= l[1] - l[0]; x++)
4931
+ for (let x = 0; x <= c[1] - c[0]; x++)
4660
4932
  for (let w = 0; w <= a[1] - a[0]; w++) {
4661
- const E = w + a[0], g = x + l[0], p = s[x % r][w % o], y = this.ctx.database.getItemValueForRowIndexAndColIndex(g, E), m = `${g}-${E}`;
4662
- if (y && !i.has(m)) {
4933
+ const m = w + a[0], g = x + c[0], E = s[x % r][w % o], y = this.ctx.database.getItemValueForRowIndexAndColIndex(g, m), p = `${g}-${m}`;
4934
+ if (y && !i.has(p)) {
4663
4935
  const { rowKey: b, key: C } = y;
4664
4936
  this.ctx.database.getReadonly(b, C) || (t.add(b), d.push({
4665
4937
  rowKey: b,
4666
4938
  key: C,
4667
- value: p,
4939
+ value: E,
4668
4940
  row: {}
4669
4941
  }));
4670
4942
  }
@@ -4674,14 +4946,14 @@ class Ie {
4674
4946
  this.ctx.selector.xArr = this.ctx.autofill.xArr, this.ctx.selector.yArr = this.ctx.autofill.yArr;
4675
4947
  const { BEFORE_AUTOFILL_DATA_METHOD: f } = this.ctx.config;
4676
4948
  if (typeof f == "function") {
4677
- const x = f, w = d.map((E) => ({
4678
- rowKey: E.rowKey,
4679
- key: E.key,
4680
- value: E.value,
4681
- oldValue: this.ctx.database.getItemValue(E.rowKey, E.key),
4682
- row: this.ctx.database.getRowDataItemForRowKey(E.rowKey)
4949
+ const x = f, w = d.map((m) => ({
4950
+ rowKey: m.rowKey,
4951
+ key: m.key,
4952
+ value: m.value,
4953
+ oldValue: this.ctx.database.getItemValue(m.rowKey, m.key),
4954
+ row: this.ctx.database.getRowDataItemForRowKey(m.rowKey)
4683
4955
  }));
4684
- if (d = await x(w, a, l), d && !d.length)
4956
+ if (d = await x(w, a, c), d && !d.length)
4685
4957
  return;
4686
4958
  }
4687
4959
  this.ctx.batchSetItemValueByEditor(d, !0);
@@ -4702,101 +4974,101 @@ class Ie {
4702
4974
  destroy() {
4703
4975
  }
4704
4976
  }
4705
- const q = Math.min, G = Math.max, st = Math.round, B = (c) => ({
4706
- x: c,
4707
- y: c
4708
- }), ve = {
4977
+ const j = Math.min, $ = Math.max, it = Math.round, Y = (h) => ({
4978
+ x: h,
4979
+ y: h
4980
+ }), Le = {
4709
4981
  left: "right",
4710
4982
  right: "left",
4711
4983
  bottom: "top",
4712
4984
  top: "bottom"
4713
- }, _e = {
4985
+ }, Me = {
4714
4986
  start: "end",
4715
4987
  end: "start"
4716
4988
  };
4717
- function dt(c, t, e) {
4718
- return G(c, q(t, e));
4989
+ function ht(h, t, e) {
4990
+ return $(h, j(t, e));
4719
4991
  }
4720
- function Q(c, t) {
4721
- return typeof c == "function" ? c(t) : c;
4992
+ function J(h, t) {
4993
+ return typeof h == "function" ? h(t) : h;
4722
4994
  }
4723
- function z(c) {
4724
- return c.split("-")[0];
4995
+ function z(h) {
4996
+ return h.split("-")[0];
4725
4997
  }
4726
- function tt(c) {
4727
- return c.split("-")[1];
4998
+ function Q(h) {
4999
+ return h.split("-")[1];
4728
5000
  }
4729
- function Bt(c) {
4730
- return c === "x" ? "y" : "x";
5001
+ function Kt(h) {
5002
+ return h === "x" ? "y" : "x";
4731
5003
  }
4732
- function ut(c) {
4733
- return c === "y" ? "height" : "width";
5004
+ function gt(h) {
5005
+ return h === "y" ? "height" : "width";
4734
5006
  }
4735
- const Se = /* @__PURE__ */ new Set(["top", "bottom"]);
4736
- function V(c) {
4737
- return Se.has(z(c)) ? "y" : "x";
5007
+ const Ae = /* @__PURE__ */ new Set(["top", "bottom"]);
5008
+ function V(h) {
5009
+ return Ae.has(z(h)) ? "y" : "x";
4738
5010
  }
4739
- function gt(c) {
4740
- return Bt(V(c));
5011
+ function wt(h) {
5012
+ return Kt(V(h));
4741
5013
  }
4742
- function Te(c, t, e) {
5014
+ function He(h, t, e) {
4743
5015
  e === void 0 && (e = !1);
4744
- const i = tt(c), s = gt(c), o = ut(s);
5016
+ const i = Q(h), s = wt(h), o = gt(s);
4745
5017
  let r = s === "x" ? i === (e ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
4746
- return t.reference[o] > t.floating[o] && (r = ot(r)), [r, ot(r)];
5018
+ return t.reference[o] > t.floating[o] && (r = st(r)), [r, st(r)];
4747
5019
  }
4748
- function Oe(c) {
4749
- const t = ot(c);
4750
- return [ft(c), t, ft(t)];
5020
+ function De(h) {
5021
+ const t = st(h);
5022
+ return [dt(h), t, dt(t)];
4751
5023
  }
4752
- function ft(c) {
4753
- return c.replace(/start|end/g, (t) => _e[t]);
5024
+ function dt(h) {
5025
+ return h.replace(/start|end/g, (t) => Me[t]);
4754
5026
  }
4755
- const It = ["left", "right"], vt = ["right", "left"], Le = ["top", "bottom"], Ae = ["bottom", "top"];
4756
- function Me(c, t, e) {
4757
- switch (c) {
5027
+ const vt = ["left", "right"], _t = ["right", "left"], Ne = ["top", "bottom"], ke = ["bottom", "top"];
5028
+ function Xe(h, t, e) {
5029
+ switch (h) {
4758
5030
  case "top":
4759
5031
  case "bottom":
4760
- return e ? t ? vt : It : t ? It : vt;
5032
+ return e ? t ? _t : vt : t ? vt : _t;
4761
5033
  case "left":
4762
5034
  case "right":
4763
- return t ? Le : Ae;
5035
+ return t ? Ne : ke;
4764
5036
  default:
4765
5037
  return [];
4766
5038
  }
4767
5039
  }
4768
- function He(c, t, e, i) {
4769
- const s = tt(c);
4770
- let o = Me(z(c), e === "start", i);
4771
- return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(ft)))), o;
5040
+ function Ye(h, t, e, i) {
5041
+ const s = Q(h);
5042
+ let o = Xe(z(h), e === "start", i);
5043
+ return s && (o = o.map((r) => r + "-" + s), t && (o = o.concat(o.map(dt)))), o;
4772
5044
  }
4773
- function ot(c) {
4774
- return c.replace(/left|right|bottom|top/g, (t) => ve[t]);
5045
+ function st(h) {
5046
+ return h.replace(/left|right|bottom|top/g, (t) => Le[t]);
4775
5047
  }
4776
- function De(c) {
5048
+ function Be(h) {
4777
5049
  return {
4778
5050
  top: 0,
4779
5051
  right: 0,
4780
5052
  bottom: 0,
4781
5053
  left: 0,
4782
- ...c
5054
+ ...h
4783
5055
  };
4784
5056
  }
4785
- function Kt(c) {
4786
- return typeof c != "number" ? De(c) : {
4787
- top: c,
4788
- right: c,
4789
- bottom: c,
4790
- left: c
5057
+ function Wt(h) {
5058
+ return typeof h != "number" ? Be(h) : {
5059
+ top: h,
5060
+ right: h,
5061
+ bottom: h,
5062
+ left: h
4791
5063
  };
4792
5064
  }
4793
- function rt(c) {
5065
+ function ot(h) {
4794
5066
  const {
4795
5067
  x: t,
4796
5068
  y: e,
4797
5069
  width: i,
4798
5070
  height: s
4799
- } = c;
5071
+ } = h;
4800
5072
  return {
4801
5073
  width: i,
4802
5074
  height: s,
@@ -4808,14 +5080,14 @@ function rt(c) {
4808
5080
  y: e
4809
5081
  };
4810
5082
  }
4811
- function _t(c, t, e) {
5083
+ function Tt(h, t, e) {
4812
5084
  let {
4813
5085
  reference: i,
4814
5086
  floating: s
4815
- } = c;
4816
- const o = V(t), r = gt(t), a = ut(r), l = z(t), h = o === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, u = i[a] / 2 - s[a] / 2;
5087
+ } = h;
5088
+ const o = V(t), r = wt(t), a = gt(r), c = z(t), l = o === "y", d = i.x + i.width / 2 - s.width / 2, f = i.y + i.height / 2 - s.height / 2, u = i[a] / 2 - s[a] / 2;
4817
5089
  let x;
4818
- switch (l) {
5090
+ switch (c) {
4819
5091
  case "top":
4820
5092
  x = {
4821
5093
  x: d,
@@ -4846,68 +5118,68 @@ function _t(c, t, e) {
4846
5118
  y: i.y
4847
5119
  };
4848
5120
  }
4849
- switch (tt(t)) {
5121
+ switch (Q(t)) {
4850
5122
  case "start":
4851
- x[r] -= u * (e && h ? -1 : 1);
5123
+ x[r] -= u * (e && l ? -1 : 1);
4852
5124
  break;
4853
5125
  case "end":
4854
- x[r] += u * (e && h ? -1 : 1);
5126
+ x[r] += u * (e && l ? -1 : 1);
4855
5127
  break;
4856
5128
  }
4857
5129
  return x;
4858
5130
  }
4859
- const ke = async (c, t, e) => {
5131
+ const Ke = async (h, t, e) => {
4860
5132
  const {
4861
5133
  placement: i = "bottom",
4862
5134
  strategy: s = "absolute",
4863
5135
  middleware: o = [],
4864
5136
  platform: r
4865
- } = e, a = o.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(t));
4866
- let h = await r.getElementRects({
4867
- reference: c,
5137
+ } = e, a = o.filter(Boolean), c = await (r.isRTL == null ? void 0 : r.isRTL(t));
5138
+ let l = await r.getElementRects({
5139
+ reference: h,
4868
5140
  floating: t,
4869
5141
  strategy: s
4870
5142
  }), {
4871
5143
  x: d,
4872
5144
  y: f
4873
- } = _t(h, i, l), u = i, x = {}, w = 0;
4874
- for (let E = 0; E < a.length; E++) {
5145
+ } = Tt(l, i, c), u = i, x = {}, w = 0;
5146
+ for (let m = 0; m < a.length; m++) {
4875
5147
  const {
4876
5148
  name: g,
4877
- fn: p
4878
- } = a[E], {
5149
+ fn: E
5150
+ } = a[m], {
4879
5151
  x: y,
4880
- y: m,
5152
+ y: p,
4881
5153
  data: b,
4882
5154
  reset: C
4883
- } = await p({
5155
+ } = await E({
4884
5156
  x: d,
4885
5157
  y: f,
4886
5158
  initialPlacement: i,
4887
5159
  placement: u,
4888
5160
  strategy: s,
4889
5161
  middlewareData: x,
4890
- rects: h,
5162
+ rects: l,
4891
5163
  platform: r,
4892
5164
  elements: {
4893
- reference: c,
5165
+ reference: h,
4894
5166
  floating: t
4895
5167
  }
4896
5168
  });
4897
- d = y ?? d, f = m ?? f, x = {
5169
+ d = y ?? d, f = p ?? f, x = {
4898
5170
  ...x,
4899
5171
  [g]: {
4900
5172
  ...x[g],
4901
5173
  ...b
4902
5174
  }
4903
- }, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (h = C.rects === !0 ? await r.getElementRects({
4904
- reference: c,
5175
+ }, C && w <= 50 && (w++, typeof C == "object" && (C.placement && (u = C.placement), C.rects && (l = C.rects === !0 ? await r.getElementRects({
5176
+ reference: h,
4905
5177
  floating: t,
4906
5178
  strategy: s
4907
5179
  }) : C.rects), {
4908
5180
  x: d,
4909
5181
  y: f
4910
- } = _t(h, u, l)), E = -1);
5182
+ } = Tt(l, u, c)), m = -1);
4911
5183
  }
4912
5184
  return {
4913
5185
  x: d,
@@ -4917,7 +5189,7 @@ const ke = async (c, t, e) => {
4917
5189
  middlewareData: x
4918
5190
  };
4919
5191
  };
4920
- async function Yt(c, t) {
5192
+ async function Ft(h, t) {
4921
5193
  var e;
4922
5194
  t === void 0 && (t = {});
4923
5195
  const {
@@ -4926,45 +5198,45 @@ async function Yt(c, t) {
4926
5198
  platform: o,
4927
5199
  rects: r,
4928
5200
  elements: a,
4929
- strategy: l
4930
- } = c, {
4931
- boundary: h = "clippingAncestors",
5201
+ strategy: c
5202
+ } = h, {
5203
+ boundary: l = "clippingAncestors",
4932
5204
  rootBoundary: d = "viewport",
4933
5205
  elementContext: f = "floating",
4934
5206
  altBoundary: u = !1,
4935
5207
  padding: x = 0
4936
- } = Q(t, c), w = Kt(x), g = a[u ? f === "floating" ? "reference" : "floating" : f], p = rt(await o.getClippingRect({
5208
+ } = J(t, h), w = Wt(x), g = a[u ? f === "floating" ? "reference" : "floating" : f], E = ot(await o.getClippingRect({
4937
5209
  element: (e = await (o.isElement == null ? void 0 : o.isElement(g))) == null || e ? g : g.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(a.floating)),
4938
- boundary: h,
5210
+ boundary: l,
4939
5211
  rootBoundary: d,
4940
- strategy: l
5212
+ strategy: c
4941
5213
  })), y = f === "floating" ? {
4942
5214
  x: i,
4943
5215
  y: s,
4944
5216
  width: r.floating.width,
4945
5217
  height: r.floating.height
4946
- } : r.reference, m = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), b = await (o.isElement == null ? void 0 : o.isElement(m)) ? await (o.getScale == null ? void 0 : o.getScale(m)) || {
5218
+ } : r.reference, p = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(a.floating)), b = await (o.isElement == null ? void 0 : o.isElement(p)) ? await (o.getScale == null ? void 0 : o.getScale(p)) || {
4947
5219
  x: 1,
4948
5220
  y: 1
4949
5221
  } : {
4950
5222
  x: 1,
4951
5223
  y: 1
4952
- }, C = rt(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
5224
+ }, C = ot(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
4953
5225
  elements: a,
4954
5226
  rect: y,
4955
- offsetParent: m,
4956
- strategy: l
5227
+ offsetParent: p,
5228
+ strategy: c
4957
5229
  }) : y);
4958
5230
  return {
4959
- top: (p.top - C.top + w.top) / b.y,
4960
- bottom: (C.bottom - p.bottom + w.bottom) / b.y,
4961
- left: (p.left - C.left + w.left) / b.x,
4962
- right: (C.right - p.right + w.right) / b.x
5231
+ top: (E.top - C.top + w.top) / b.y,
5232
+ bottom: (C.bottom - E.bottom + w.bottom) / b.y,
5233
+ left: (E.left - C.left + w.left) / b.x,
5234
+ right: (C.right - E.right + w.right) / b.x
4963
5235
  };
4964
5236
  }
4965
- const Xe = (c) => ({
5237
+ const We = (h) => ({
4966
5238
  name: "arrow",
4967
- options: c,
5239
+ options: h,
4968
5240
  async fn(t) {
4969
5241
  const {
4970
5242
  x: e,
@@ -4973,36 +5245,36 @@ const Xe = (c) => ({
4973
5245
  rects: o,
4974
5246
  platform: r,
4975
5247
  elements: a,
4976
- middlewareData: l
5248
+ middlewareData: c
4977
5249
  } = t, {
4978
- element: h,
5250
+ element: l,
4979
5251
  padding: d = 0
4980
- } = Q(c, t) || {};
4981
- if (h == null)
5252
+ } = J(h, t) || {};
5253
+ if (l == null)
4982
5254
  return {};
4983
- const f = Kt(d), u = {
5255
+ const f = Wt(d), u = {
4984
5256
  x: e,
4985
5257
  y: i
4986
- }, x = gt(s), w = ut(x), E = await r.getDimensions(h), g = x === "y", p = g ? "top" : "left", y = g ? "bottom" : "right", m = g ? "clientHeight" : "clientWidth", b = o.reference[w] + o.reference[x] - u[x] - o.floating[w], C = u[x] - o.reference[x], I = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(h));
4987
- let _ = I ? I[m] : 0;
4988
- (!_ || !await (r.isElement == null ? void 0 : r.isElement(I))) && (_ = a.floating[m] || o.floating[w]);
4989
- const T = b / 2 - C / 2, v = _ / 2 - E[w] / 2 - 1, R = q(f[p], v), S = q(f[y], v), O = R, M = _ - E[w] - S, L = _ / 2 - E[w] / 2 + T, H = dt(O, L, M), Y = !l.arrow && tt(s) != null && L !== H && o.reference[w] / 2 - (L < O ? R : S) - E[w] / 2 < 0, D = Y ? L < O ? L - O : L - M : 0;
5258
+ }, x = wt(s), w = gt(x), m = await r.getDimensions(l), g = x === "y", E = g ? "top" : "left", y = g ? "bottom" : "right", p = g ? "clientHeight" : "clientWidth", b = o.reference[w] + o.reference[x] - u[x] - o.floating[w], C = u[x] - o.reference[x], R = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(l));
5259
+ let v = R ? R[p] : 0;
5260
+ (!v || !await (r.isElement == null ? void 0 : r.isElement(R))) && (v = a.floating[p] || o.floating[w]);
5261
+ const T = b / 2 - C / 2, S = v / 2 - m[w] / 2 - 1, I = j(f[E], S), _ = j(f[y], S), O = I, A = v - m[w] - _, L = v / 2 - m[w] / 2 + T, H = ht(O, L, A), K = !c.arrow && Q(s) != null && L !== H && o.reference[w] / 2 - (L < O ? I : _) - m[w] / 2 < 0, D = K ? L < O ? L - O : L - A : 0;
4990
5262
  return {
4991
5263
  [x]: u[x] + D,
4992
5264
  data: {
4993
5265
  [x]: H,
4994
5266
  centerOffset: L - H - D,
4995
- ...Y && {
5267
+ ...K && {
4996
5268
  alignmentOffset: D
4997
5269
  }
4998
5270
  },
4999
- reset: Y
5271
+ reset: K
5000
5272
  };
5001
5273
  }
5002
- }), Ne = function(c) {
5003
- return c === void 0 && (c = {}), {
5274
+ }), Fe = function(h) {
5275
+ return h === void 0 && (h = {}), {
5004
5276
  name: "flip",
5005
- options: c,
5277
+ options: h,
5006
5278
  async fn(t) {
5007
5279
  var e, i;
5008
5280
  const {
@@ -5010,83 +5282,83 @@ const Xe = (c) => ({
5010
5282
  middlewareData: o,
5011
5283
  rects: r,
5012
5284
  initialPlacement: a,
5013
- platform: l,
5014
- elements: h
5285
+ platform: c,
5286
+ elements: l
5015
5287
  } = t, {
5016
5288
  mainAxis: d = !0,
5017
5289
  crossAxis: f = !0,
5018
5290
  fallbackPlacements: u,
5019
5291
  fallbackStrategy: x = "bestFit",
5020
5292
  fallbackAxisSideDirection: w = "none",
5021
- flipAlignment: E = !0,
5293
+ flipAlignment: m = !0,
5022
5294
  ...g
5023
- } = Q(c, t);
5295
+ } = J(h, t);
5024
5296
  if ((e = o.arrow) != null && e.alignmentOffset)
5025
5297
  return {};
5026
- const p = z(s), y = V(a), m = z(a) === a, b = await (l.isRTL == null ? void 0 : l.isRTL(h.floating)), C = u || (m || !E ? [ot(a)] : Oe(a)), I = w !== "none";
5027
- !u && I && C.push(...He(a, E, w, b));
5028
- const _ = [a, ...C], T = await Yt(t, g), v = [];
5029
- let R = ((i = o.flip) == null ? void 0 : i.overflows) || [];
5030
- if (d && v.push(T[p]), f) {
5031
- const L = Te(s, r, b);
5032
- v.push(T[L[0]], T[L[1]]);
5298
+ const E = z(s), y = V(a), p = z(a) === a, b = await (c.isRTL == null ? void 0 : c.isRTL(l.floating)), C = u || (p || !m ? [st(a)] : De(a)), R = w !== "none";
5299
+ !u && R && C.push(...Ye(a, m, w, b));
5300
+ const v = [a, ...C], T = await Ft(t, g), S = [];
5301
+ let I = ((i = o.flip) == null ? void 0 : i.overflows) || [];
5302
+ if (d && S.push(T[E]), f) {
5303
+ const L = He(s, r, b);
5304
+ S.push(T[L[0]], T[L[1]]);
5033
5305
  }
5034
- if (R = [...R, {
5306
+ if (I = [...I, {
5035
5307
  placement: s,
5036
- overflows: v
5037
- }], !v.every((L) => L <= 0)) {
5038
- var S, O;
5039
- const L = (((S = o.flip) == null ? void 0 : S.index) || 0) + 1, H = _[L];
5308
+ overflows: S
5309
+ }], !S.every((L) => L <= 0)) {
5310
+ var _, O;
5311
+ const L = (((_ = o.flip) == null ? void 0 : _.index) || 0) + 1, H = v[L];
5040
5312
  if (H && (!(f === "alignment" ? y !== V(H) : !1) || // We leave the current main axis only if every placement on that axis
5041
5313
  // overflows the main axis.
5042
- R.every((k) => V(k.placement) === y ? k.overflows[0] > 0 : !0)))
5314
+ I.every((N) => V(N.placement) === y ? N.overflows[0] > 0 : !0)))
5043
5315
  return {
5044
5316
  data: {
5045
5317
  index: L,
5046
- overflows: R
5318
+ overflows: I
5047
5319
  },
5048
5320
  reset: {
5049
5321
  placement: H
5050
5322
  }
5051
5323
  };
5052
- let Y = (O = R.filter((D) => D.overflows[0] <= 0).sort((D, k) => D.overflows[1] - k.overflows[1])[0]) == null ? void 0 : O.placement;
5053
- if (!Y)
5324
+ let K = (O = I.filter((D) => D.overflows[0] <= 0).sort((D, N) => D.overflows[1] - N.overflows[1])[0]) == null ? void 0 : O.placement;
5325
+ if (!K)
5054
5326
  switch (x) {
5055
5327
  case "bestFit": {
5056
- var M;
5057
- const D = (M = R.filter((k) => {
5058
- if (I) {
5059
- const W = V(k.placement);
5060
- return W === y || // Create a bias to the `y` side axis due to horizontal
5328
+ var A;
5329
+ const D = (A = I.filter((N) => {
5330
+ if (R) {
5331
+ const F = V(N.placement);
5332
+ return F === y || // Create a bias to the `y` side axis due to horizontal
5061
5333
  // reading directions favoring greater width.
5062
- W === "y";
5334
+ F === "y";
5063
5335
  }
5064
5336
  return !0;
5065
- }).map((k) => [k.placement, k.overflows.filter((W) => W > 0).reduce((W, te) => W + te, 0)]).sort((k, W) => k[1] - W[1])[0]) == null ? void 0 : M[0];
5066
- D && (Y = D);
5337
+ }).map((N) => [N.placement, N.overflows.filter((F) => F > 0).reduce((F, ie) => F + ie, 0)]).sort((N, F) => N[1] - F[1])[0]) == null ? void 0 : A[0];
5338
+ D && (K = D);
5067
5339
  break;
5068
5340
  }
5069
5341
  case "initialPlacement":
5070
- Y = a;
5342
+ K = a;
5071
5343
  break;
5072
5344
  }
5073
- if (s !== Y)
5345
+ if (s !== K)
5074
5346
  return {
5075
5347
  reset: {
5076
- placement: Y
5348
+ placement: K
5077
5349
  }
5078
5350
  };
5079
5351
  }
5080
5352
  return {};
5081
5353
  }
5082
5354
  };
5083
- }, Be = /* @__PURE__ */ new Set(["left", "top"]);
5084
- async function Ke(c, t) {
5355
+ }, Ve = /* @__PURE__ */ new Set(["left", "top"]);
5356
+ async function Pe(h, t) {
5085
5357
  const {
5086
5358
  placement: e,
5087
5359
  platform: i,
5088
5360
  elements: s
5089
- } = c, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), a = tt(e), l = V(e) === "y", h = Be.has(r) ? -1 : 1, d = o && l ? -1 : 1, f = Q(t, c);
5361
+ } = h, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r = z(e), a = Q(e), c = V(e) === "y", l = Ve.has(r) ? -1 : 1, d = o && c ? -1 : 1, f = J(t, h);
5090
5362
  let {
5091
5363
  mainAxis: u,
5092
5364
  crossAxis: x,
@@ -5100,18 +5372,18 @@ async function Ke(c, t) {
5100
5372
  crossAxis: f.crossAxis || 0,
5101
5373
  alignmentAxis: f.alignmentAxis
5102
5374
  };
5103
- return a && typeof w == "number" && (x = a === "end" ? w * -1 : w), l ? {
5375
+ return a && typeof w == "number" && (x = a === "end" ? w * -1 : w), c ? {
5104
5376
  x: x * d,
5105
- y: u * h
5377
+ y: u * l
5106
5378
  } : {
5107
- x: u * h,
5379
+ x: u * l,
5108
5380
  y: x * d
5109
5381
  };
5110
5382
  }
5111
- const Ye = function(c) {
5112
- return c === void 0 && (c = 0), {
5383
+ const ze = function(h) {
5384
+ return h === void 0 && (h = 0), {
5113
5385
  name: "offset",
5114
- options: c,
5386
+ options: h,
5115
5387
  async fn(t) {
5116
5388
  var e, i;
5117
5389
  const {
@@ -5119,21 +5391,21 @@ const Ye = function(c) {
5119
5391
  y: o,
5120
5392
  placement: r,
5121
5393
  middlewareData: a
5122
- } = t, l = await Ke(t, c);
5394
+ } = t, c = await Pe(t, h);
5123
5395
  return r === ((e = a.offset) == null ? void 0 : e.placement) && (i = a.arrow) != null && i.alignmentOffset ? {} : {
5124
- x: s + l.x,
5125
- y: o + l.y,
5396
+ x: s + c.x,
5397
+ y: o + c.y,
5126
5398
  data: {
5127
- ...l,
5399
+ ...c,
5128
5400
  placement: r
5129
5401
  }
5130
5402
  };
5131
5403
  }
5132
5404
  };
5133
- }, Fe = function(c) {
5134
- return c === void 0 && (c = {}), {
5405
+ }, $e = function(h) {
5406
+ return h === void 0 && (h = {}), {
5135
5407
  name: "shift",
5136
- options: c,
5408
+ options: h,
5137
5409
  async fn(t) {
5138
5410
  const {
5139
5411
  x: e,
@@ -5145,39 +5417,39 @@ const Ye = function(c) {
5145
5417
  limiter: a = {
5146
5418
  fn: (g) => {
5147
5419
  let {
5148
- x: p,
5420
+ x: E,
5149
5421
  y
5150
5422
  } = g;
5151
5423
  return {
5152
- x: p,
5424
+ x: E,
5153
5425
  y
5154
5426
  };
5155
5427
  }
5156
5428
  },
5157
- ...l
5158
- } = Q(c, t), h = {
5429
+ ...c
5430
+ } = J(h, t), l = {
5159
5431
  x: e,
5160
5432
  y: i
5161
- }, d = await Yt(t, l), f = V(z(s)), u = Bt(f);
5162
- let x = h[u], w = h[f];
5433
+ }, d = await Ft(t, c), f = V(z(s)), u = Kt(f);
5434
+ let x = l[u], w = l[f];
5163
5435
  if (o) {
5164
- const g = u === "y" ? "top" : "left", p = u === "y" ? "bottom" : "right", y = x + d[g], m = x - d[p];
5165
- x = dt(y, x, m);
5436
+ const g = u === "y" ? "top" : "left", E = u === "y" ? "bottom" : "right", y = x + d[g], p = x - d[E];
5437
+ x = ht(y, x, p);
5166
5438
  }
5167
5439
  if (r) {
5168
- const g = f === "y" ? "top" : "left", p = f === "y" ? "bottom" : "right", y = w + d[g], m = w - d[p];
5169
- w = dt(y, w, m);
5440
+ const g = f === "y" ? "top" : "left", E = f === "y" ? "bottom" : "right", y = w + d[g], p = w - d[E];
5441
+ w = ht(y, w, p);
5170
5442
  }
5171
- const E = a.fn({
5443
+ const m = a.fn({
5172
5444
  ...t,
5173
5445
  [u]: x,
5174
5446
  [f]: w
5175
5447
  });
5176
5448
  return {
5177
- ...E,
5449
+ ...m,
5178
5450
  data: {
5179
- x: E.x - e,
5180
- y: E.y - i,
5451
+ x: m.x - e,
5452
+ y: m.y - i,
5181
5453
  enabled: {
5182
5454
  [u]: o,
5183
5455
  [f]: r
@@ -5187,67 +5459,67 @@ const Ye = function(c) {
5187
5459
  }
5188
5460
  };
5189
5461
  };
5190
- function nt() {
5462
+ function rt() {
5191
5463
  return typeof window < "u";
5192
5464
  }
5193
- function Z(c) {
5194
- return Ft(c) ? (c.nodeName || "").toLowerCase() : "#document";
5465
+ function Z(h) {
5466
+ return Vt(h) ? (h.nodeName || "").toLowerCase() : "#document";
5195
5467
  }
5196
- function A(c) {
5468
+ function M(h) {
5197
5469
  var t;
5198
- return (c == null || (t = c.ownerDocument) == null ? void 0 : t.defaultView) || window;
5470
+ return (h == null || (t = h.ownerDocument) == null ? void 0 : t.defaultView) || window;
5199
5471
  }
5200
- function F(c) {
5472
+ function W(h) {
5201
5473
  var t;
5202
- return (t = (Ft(c) ? c.ownerDocument : c.document) || window.document) == null ? void 0 : t.documentElement;
5474
+ return (t = (Vt(h) ? h.ownerDocument : h.document) || window.document) == null ? void 0 : t.documentElement;
5203
5475
  }
5204
- function Ft(c) {
5205
- return nt() ? c instanceof Node || c instanceof A(c).Node : !1;
5476
+ function Vt(h) {
5477
+ return rt() ? h instanceof Node || h instanceof M(h).Node : !1;
5206
5478
  }
5207
- function X(c) {
5208
- return nt() ? c instanceof Element || c instanceof A(c).Element : !1;
5479
+ function k(h) {
5480
+ return rt() ? h instanceof Element || h instanceof M(h).Element : !1;
5209
5481
  }
5210
- function K(c) {
5211
- return nt() ? c instanceof HTMLElement || c instanceof A(c).HTMLElement : !1;
5482
+ function B(h) {
5483
+ return rt() ? h instanceof HTMLElement || h instanceof M(h).HTMLElement : !1;
5212
5484
  }
5213
- function St(c) {
5214
- return !nt() || typeof ShadowRoot > "u" ? !1 : c instanceof ShadowRoot || c instanceof A(c).ShadowRoot;
5485
+ function Ot(h) {
5486
+ return !rt() || typeof ShadowRoot > "u" ? !1 : h instanceof ShadowRoot || h instanceof M(h).ShadowRoot;
5215
5487
  }
5216
- const We = /* @__PURE__ */ new Set(["inline", "contents"]);
5217
- function et(c) {
5488
+ const Ge = /* @__PURE__ */ new Set(["inline", "contents"]);
5489
+ function tt(h) {
5218
5490
  const {
5219
5491
  overflow: t,
5220
5492
  overflowX: e,
5221
5493
  overflowY: i,
5222
5494
  display: s
5223
- } = N(c);
5224
- return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !We.has(s);
5495
+ } = X(h);
5496
+ return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !Ge.has(s);
5225
5497
  }
5226
- const Ve = /* @__PURE__ */ new Set(["table", "td", "th"]);
5227
- function Pe(c) {
5228
- return Ve.has(Z(c));
5498
+ const Ue = /* @__PURE__ */ new Set(["table", "td", "th"]);
5499
+ function Ze(h) {
5500
+ return Ue.has(Z(h));
5229
5501
  }
5230
- const ze = [":popover-open", ":modal"];
5231
- function at(c) {
5232
- return ze.some((t) => {
5502
+ const je = [":popover-open", ":modal"];
5503
+ function nt(h) {
5504
+ return je.some((t) => {
5233
5505
  try {
5234
- return c.matches(t);
5506
+ return h.matches(t);
5235
5507
  } catch {
5236
5508
  return !1;
5237
5509
  }
5238
5510
  });
5239
5511
  }
5240
- const $e = ["transform", "translate", "scale", "rotate", "perspective"], Ge = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Ue = ["paint", "layout", "strict", "content"];
5241
- function wt(c) {
5242
- const t = Et(), e = X(c) ? N(c) : c;
5243
- return $e.some((i) => e[i] ? e[i] !== "none" : !1) || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || Ge.some((i) => (e.willChange || "").includes(i)) || Ue.some((i) => (e.contain || "").includes(i));
5512
+ const qe = ["transform", "translate", "scale", "rotate", "perspective"], Je = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Qe = ["paint", "layout", "strict", "content"];
5513
+ function mt(h) {
5514
+ const t = Et(), e = k(h) ? X(h) : h;
5515
+ return qe.some((i) => e[i] ? e[i] !== "none" : !1) || (e.containerType ? e.containerType !== "normal" : !1) || !t && (e.backdropFilter ? e.backdropFilter !== "none" : !1) || !t && (e.filter ? e.filter !== "none" : !1) || Je.some((i) => (e.willChange || "").includes(i)) || Qe.some((i) => (e.contain || "").includes(i));
5244
5516
  }
5245
- function je(c) {
5246
- let t = P(c);
5247
- for (; K(t) && !j(t); ) {
5248
- if (wt(t))
5517
+ function ti(h) {
5518
+ let t = P(h);
5519
+ for (; B(t) && !U(t); ) {
5520
+ if (mt(t))
5249
5521
  return t;
5250
- if (at(t))
5522
+ if (nt(t))
5251
5523
  return null;
5252
5524
  t = P(t);
5253
5525
  }
@@ -5256,199 +5528,199 @@ function je(c) {
5256
5528
  function Et() {
5257
5529
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
5258
5530
  }
5259
- const Ze = /* @__PURE__ */ new Set(["html", "body", "#document"]);
5260
- function j(c) {
5261
- return Ze.has(Z(c));
5531
+ const ei = /* @__PURE__ */ new Set(["html", "body", "#document"]);
5532
+ function U(h) {
5533
+ return ei.has(Z(h));
5262
5534
  }
5263
- function N(c) {
5264
- return A(c).getComputedStyle(c);
5535
+ function X(h) {
5536
+ return M(h).getComputedStyle(h);
5265
5537
  }
5266
- function lt(c) {
5267
- return X(c) ? {
5268
- scrollLeft: c.scrollLeft,
5269
- scrollTop: c.scrollTop
5538
+ function at(h) {
5539
+ return k(h) ? {
5540
+ scrollLeft: h.scrollLeft,
5541
+ scrollTop: h.scrollTop
5270
5542
  } : {
5271
- scrollLeft: c.scrollX,
5272
- scrollTop: c.scrollY
5543
+ scrollLeft: h.scrollX,
5544
+ scrollTop: h.scrollY
5273
5545
  };
5274
5546
  }
5275
- function P(c) {
5276
- if (Z(c) === "html")
5277
- return c;
5547
+ function P(h) {
5548
+ if (Z(h) === "html")
5549
+ return h;
5278
5550
  const t = (
5279
5551
  // Step into the shadow DOM of the parent of a slotted node.
5280
- c.assignedSlot || // DOM Element detected.
5281
- c.parentNode || // ShadowRoot detected.
5282
- St(c) && c.host || // Fallback.
5283
- F(c)
5552
+ h.assignedSlot || // DOM Element detected.
5553
+ h.parentNode || // ShadowRoot detected.
5554
+ Ot(h) && h.host || // Fallback.
5555
+ W(h)
5284
5556
  );
5285
- return St(t) ? t.host : t;
5557
+ return Ot(t) ? t.host : t;
5286
5558
  }
5287
- function Wt(c) {
5288
- const t = P(c);
5289
- return j(t) ? c.ownerDocument ? c.ownerDocument.body : c.body : K(t) && et(t) ? t : Wt(t);
5559
+ function Pt(h) {
5560
+ const t = P(h);
5561
+ return U(t) ? h.ownerDocument ? h.ownerDocument.body : h.body : B(t) && tt(t) ? t : Pt(t);
5290
5562
  }
5291
- function Vt(c, t, e) {
5563
+ function zt(h, t, e) {
5292
5564
  var i;
5293
5565
  t === void 0 && (t = []);
5294
- const s = Wt(c), o = s === ((i = c.ownerDocument) == null ? void 0 : i.body), r = A(s);
5295
- return o ? (xt(r), t.concat(r, r.visualViewport || [], et(s) ? s : [], [])) : t.concat(s, Vt(s, []));
5566
+ const s = Pt(h), o = s === ((i = h.ownerDocument) == null ? void 0 : i.body), r = M(s);
5567
+ return o ? (ft(r), t.concat(r, r.visualViewport || [], tt(s) ? s : [], [])) : t.concat(s, zt(s, []));
5296
5568
  }
5297
- function xt(c) {
5298
- return c.parent && Object.getPrototypeOf(c.parent) ? c.frameElement : null;
5569
+ function ft(h) {
5570
+ return h.parent && Object.getPrototypeOf(h.parent) ? h.frameElement : null;
5299
5571
  }
5300
- function Pt(c) {
5301
- const t = N(c);
5572
+ function $t(h) {
5573
+ const t = X(h);
5302
5574
  let e = parseFloat(t.width) || 0, i = parseFloat(t.height) || 0;
5303
- const s = K(c), o = s ? c.offsetWidth : e, r = s ? c.offsetHeight : i, a = st(e) !== o || st(i) !== r;
5575
+ const s = B(h), o = s ? h.offsetWidth : e, r = s ? h.offsetHeight : i, a = it(e) !== o || it(i) !== r;
5304
5576
  return a && (e = o, i = r), {
5305
5577
  width: e,
5306
5578
  height: i,
5307
5579
  $: a
5308
5580
  };
5309
5581
  }
5310
- function zt(c) {
5311
- return X(c) ? c : c.contextElement;
5582
+ function Gt(h) {
5583
+ return k(h) ? h : h.contextElement;
5312
5584
  }
5313
- function U(c) {
5314
- const t = zt(c);
5315
- if (!K(t))
5316
- return B(1);
5585
+ function G(h) {
5586
+ const t = Gt(h);
5587
+ if (!B(t))
5588
+ return Y(1);
5317
5589
  const e = t.getBoundingClientRect(), {
5318
5590
  width: i,
5319
5591
  height: s,
5320
5592
  $: o
5321
- } = Pt(t);
5322
- let r = (o ? st(e.width) : e.width) / i, a = (o ? st(e.height) : e.height) / s;
5593
+ } = $t(t);
5594
+ let r = (o ? it(e.width) : e.width) / i, a = (o ? it(e.height) : e.height) / s;
5323
5595
  return (!r || !Number.isFinite(r)) && (r = 1), (!a || !Number.isFinite(a)) && (a = 1), {
5324
5596
  x: r,
5325
5597
  y: a
5326
5598
  };
5327
5599
  }
5328
- const qe = /* @__PURE__ */ B(0);
5329
- function $t(c) {
5330
- const t = A(c);
5331
- return !Et() || !t.visualViewport ? qe : {
5600
+ const ii = /* @__PURE__ */ Y(0);
5601
+ function Ut(h) {
5602
+ const t = M(h);
5603
+ return !Et() || !t.visualViewport ? ii : {
5332
5604
  x: t.visualViewport.offsetLeft,
5333
5605
  y: t.visualViewport.offsetTop
5334
5606
  };
5335
5607
  }
5336
- function Je(c, t, e) {
5337
- return t === void 0 && (t = !1), !e || t && e !== A(c) ? !1 : t;
5608
+ function si(h, t, e) {
5609
+ return t === void 0 && (t = !1), !e || t && e !== M(h) ? !1 : t;
5338
5610
  }
5339
- function J(c, t, e, i) {
5611
+ function q(h, t, e, i) {
5340
5612
  t === void 0 && (t = !1), e === void 0 && (e = !1);
5341
- const s = c.getBoundingClientRect(), o = zt(c);
5342
- let r = B(1);
5343
- t && (i ? X(i) && (r = U(i)) : r = U(c));
5344
- const a = Je(o, e, i) ? $t(o) : B(0);
5345
- let l = (s.left + a.x) / r.x, h = (s.top + a.y) / r.y, d = s.width / r.x, f = s.height / r.y;
5613
+ const s = h.getBoundingClientRect(), o = Gt(h);
5614
+ let r = Y(1);
5615
+ t && (i ? k(i) && (r = G(i)) : r = G(h));
5616
+ const a = si(o, e, i) ? Ut(o) : Y(0);
5617
+ let c = (s.left + a.x) / r.x, l = (s.top + a.y) / r.y, d = s.width / r.x, f = s.height / r.y;
5346
5618
  if (o) {
5347
- const u = A(o), x = i && X(i) ? A(i) : i;
5348
- let w = u, E = xt(w);
5349
- for (; E && i && x !== w; ) {
5350
- const g = U(E), p = E.getBoundingClientRect(), y = N(E), m = p.left + (E.clientLeft + parseFloat(y.paddingLeft)) * g.x, b = p.top + (E.clientTop + parseFloat(y.paddingTop)) * g.y;
5351
- l *= g.x, h *= g.y, d *= g.x, f *= g.y, l += m, h += b, w = A(E), E = xt(w);
5619
+ const u = M(o), x = i && k(i) ? M(i) : i;
5620
+ let w = u, m = ft(w);
5621
+ for (; m && i && x !== w; ) {
5622
+ const g = G(m), E = m.getBoundingClientRect(), y = X(m), p = E.left + (m.clientLeft + parseFloat(y.paddingLeft)) * g.x, b = E.top + (m.clientTop + parseFloat(y.paddingTop)) * g.y;
5623
+ c *= g.x, l *= g.y, d *= g.x, f *= g.y, c += p, l += b, w = M(m), m = ft(w);
5352
5624
  }
5353
5625
  }
5354
- return rt({
5626
+ return ot({
5355
5627
  width: d,
5356
5628
  height: f,
5357
- x: l,
5358
- y: h
5629
+ x: c,
5630
+ y: l
5359
5631
  });
5360
5632
  }
5361
- function pt(c, t) {
5362
- const e = lt(c).scrollLeft;
5363
- return t ? t.left + e : J(F(c)).left + e;
5633
+ function pt(h, t) {
5634
+ const e = at(h).scrollLeft;
5635
+ return t ? t.left + e : q(W(h)).left + e;
5364
5636
  }
5365
- function Gt(c, t, e) {
5637
+ function Zt(h, t, e) {
5366
5638
  e === void 0 && (e = !1);
5367
- const i = c.getBoundingClientRect(), s = i.left + t.scrollLeft - (e ? 0 : (
5639
+ const i = h.getBoundingClientRect(), s = i.left + t.scrollLeft - (e ? 0 : (
5368
5640
  // RTL <body> scrollbar.
5369
- pt(c, i)
5641
+ pt(h, i)
5370
5642
  )), o = i.top + t.scrollTop;
5371
5643
  return {
5372
5644
  x: s,
5373
5645
  y: o
5374
5646
  };
5375
5647
  }
5376
- function Qe(c) {
5648
+ function oi(h) {
5377
5649
  let {
5378
5650
  elements: t,
5379
5651
  rect: e,
5380
5652
  offsetParent: i,
5381
5653
  strategy: s
5382
- } = c;
5383
- const o = s === "fixed", r = F(i), a = t ? at(t.floating) : !1;
5654
+ } = h;
5655
+ const o = s === "fixed", r = W(i), a = t ? nt(t.floating) : !1;
5384
5656
  if (i === r || a && o)
5385
5657
  return e;
5386
- let l = {
5658
+ let c = {
5387
5659
  scrollLeft: 0,
5388
5660
  scrollTop: 0
5389
- }, h = B(1);
5390
- const d = B(0), f = K(i);
5391
- if ((f || !f && !o) && ((Z(i) !== "body" || et(r)) && (l = lt(i)), K(i))) {
5392
- const x = J(i);
5393
- h = U(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
5661
+ }, l = Y(1);
5662
+ const d = Y(0), f = B(i);
5663
+ if ((f || !f && !o) && ((Z(i) !== "body" || tt(r)) && (c = at(i)), B(i))) {
5664
+ const x = q(i);
5665
+ l = G(i), d.x = x.x + i.clientLeft, d.y = x.y + i.clientTop;
5394
5666
  }
5395
- const u = r && !f && !o ? Gt(r, l, !0) : B(0);
5667
+ const u = r && !f && !o ? Zt(r, c, !0) : Y(0);
5396
5668
  return {
5397
- width: e.width * h.x,
5398
- height: e.height * h.y,
5399
- x: e.x * h.x - l.scrollLeft * h.x + d.x + u.x,
5400
- y: e.y * h.y - l.scrollTop * h.y + d.y + u.y
5669
+ width: e.width * l.x,
5670
+ height: e.height * l.y,
5671
+ x: e.x * l.x - c.scrollLeft * l.x + d.x + u.x,
5672
+ y: e.y * l.y - c.scrollTop * l.y + d.y + u.y
5401
5673
  };
5402
5674
  }
5403
- function ti(c) {
5404
- return Array.from(c.getClientRects());
5675
+ function ri(h) {
5676
+ return Array.from(h.getClientRects());
5405
5677
  }
5406
- function ei(c) {
5407
- const t = F(c), e = lt(c), i = c.ownerDocument.body, s = G(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = G(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
5408
- let r = -e.scrollLeft + pt(c);
5678
+ function ni(h) {
5679
+ const t = W(h), e = at(h), i = h.ownerDocument.body, s = $(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth), o = $(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight);
5680
+ let r = -e.scrollLeft + pt(h);
5409
5681
  const a = -e.scrollTop;
5410
- return N(i).direction === "rtl" && (r += G(t.clientWidth, i.clientWidth) - s), {
5682
+ return X(i).direction === "rtl" && (r += $(t.clientWidth, i.clientWidth) - s), {
5411
5683
  width: s,
5412
5684
  height: o,
5413
5685
  x: r,
5414
5686
  y: a
5415
5687
  };
5416
5688
  }
5417
- function ii(c, t) {
5418
- const e = A(c), i = F(c), s = e.visualViewport;
5419
- let o = i.clientWidth, r = i.clientHeight, a = 0, l = 0;
5689
+ function ai(h, t) {
5690
+ const e = M(h), i = W(h), s = e.visualViewport;
5691
+ let o = i.clientWidth, r = i.clientHeight, a = 0, c = 0;
5420
5692
  if (s) {
5421
5693
  o = s.width, r = s.height;
5422
- const h = Et();
5423
- (!h || h && t === "fixed") && (a = s.offsetLeft, l = s.offsetTop);
5694
+ const l = Et();
5695
+ (!l || l && t === "fixed") && (a = s.offsetLeft, c = s.offsetTop);
5424
5696
  }
5425
5697
  return {
5426
5698
  width: o,
5427
5699
  height: r,
5428
5700
  x: a,
5429
- y: l
5701
+ y: c
5430
5702
  };
5431
5703
  }
5432
- const si = /* @__PURE__ */ new Set(["absolute", "fixed"]);
5433
- function oi(c, t) {
5434
- const e = J(c, !0, t === "fixed"), i = e.top + c.clientTop, s = e.left + c.clientLeft, o = K(c) ? U(c) : B(1), r = c.clientWidth * o.x, a = c.clientHeight * o.y, l = s * o.x, h = i * o.y;
5704
+ const ci = /* @__PURE__ */ new Set(["absolute", "fixed"]);
5705
+ function li(h, t) {
5706
+ const e = q(h, !0, t === "fixed"), i = e.top + h.clientTop, s = e.left + h.clientLeft, o = B(h) ? G(h) : Y(1), r = h.clientWidth * o.x, a = h.clientHeight * o.y, c = s * o.x, l = i * o.y;
5435
5707
  return {
5436
5708
  width: r,
5437
5709
  height: a,
5438
- x: l,
5439
- y: h
5710
+ x: c,
5711
+ y: l
5440
5712
  };
5441
5713
  }
5442
- function Tt(c, t, e) {
5714
+ function Lt(h, t, e) {
5443
5715
  let i;
5444
5716
  if (t === "viewport")
5445
- i = ii(c, e);
5717
+ i = ai(h, e);
5446
5718
  else if (t === "document")
5447
- i = ei(F(c));
5448
- else if (X(t))
5449
- i = oi(t, e);
5719
+ i = ni(W(h));
5720
+ else if (k(t))
5721
+ i = li(t, e);
5450
5722
  else {
5451
- const s = $t(c);
5723
+ const s = Ut(h);
5452
5724
  i = {
5453
5725
  x: t.x - s.x,
5454
5726
  y: t.y - s.y,
@@ -5456,70 +5728,70 @@ function Tt(c, t, e) {
5456
5728
  height: t.height
5457
5729
  };
5458
5730
  }
5459
- return rt(i);
5731
+ return ot(i);
5460
5732
  }
5461
- function Ut(c, t) {
5462
- const e = P(c);
5463
- return e === t || !X(e) || j(e) ? !1 : N(e).position === "fixed" || Ut(e, t);
5733
+ function jt(h, t) {
5734
+ const e = P(h);
5735
+ return e === t || !k(e) || U(e) ? !1 : X(e).position === "fixed" || jt(e, t);
5464
5736
  }
5465
- function ri(c, t) {
5466
- const e = t.get(c);
5737
+ function hi(h, t) {
5738
+ const e = t.get(h);
5467
5739
  if (e)
5468
5740
  return e;
5469
- let i = Vt(c, []).filter((a) => X(a) && Z(a) !== "body"), s = null;
5470
- const o = N(c).position === "fixed";
5471
- let r = o ? P(c) : c;
5472
- for (; X(r) && !j(r); ) {
5473
- const a = N(r), l = wt(r);
5474
- !l && a.position === "fixed" && (s = null), (o ? !l && !s : !l && a.position === "static" && !!s && si.has(s.position) || et(r) && !l && Ut(c, r)) ? i = i.filter((d) => d !== r) : s = a, r = P(r);
5475
- }
5476
- return t.set(c, i), i;
5741
+ let i = zt(h, []).filter((a) => k(a) && Z(a) !== "body"), s = null;
5742
+ const o = X(h).position === "fixed";
5743
+ let r = o ? P(h) : h;
5744
+ for (; k(r) && !U(r); ) {
5745
+ const a = X(r), c = mt(r);
5746
+ !c && a.position === "fixed" && (s = null), (o ? !c && !s : !c && a.position === "static" && !!s && ci.has(s.position) || tt(r) && !c && jt(h, r)) ? i = i.filter((d) => d !== r) : s = a, r = P(r);
5747
+ }
5748
+ return t.set(h, i), i;
5477
5749
  }
5478
- function ni(c) {
5750
+ function di(h) {
5479
5751
  let {
5480
5752
  element: t,
5481
5753
  boundary: e,
5482
5754
  rootBoundary: i,
5483
5755
  strategy: s
5484
- } = c;
5485
- const r = [...e === "clippingAncestors" ? at(t) ? [] : ri(t, this._c) : [].concat(e), i], a = r[0], l = r.reduce((h, d) => {
5486
- const f = Tt(t, d, s);
5487
- return h.top = G(f.top, h.top), h.right = q(f.right, h.right), h.bottom = q(f.bottom, h.bottom), h.left = G(f.left, h.left), h;
5488
- }, Tt(t, a, s));
5756
+ } = h;
5757
+ const r = [...e === "clippingAncestors" ? nt(t) ? [] : hi(t, this._c) : [].concat(e), i], a = r[0], c = r.reduce((l, d) => {
5758
+ const f = Lt(t, d, s);
5759
+ return l.top = $(f.top, l.top), l.right = j(f.right, l.right), l.bottom = j(f.bottom, l.bottom), l.left = $(f.left, l.left), l;
5760
+ }, Lt(t, a, s));
5489
5761
  return {
5490
- width: l.right - l.left,
5491
- height: l.bottom - l.top,
5492
- x: l.left,
5493
- y: l.top
5762
+ width: c.right - c.left,
5763
+ height: c.bottom - c.top,
5764
+ x: c.left,
5765
+ y: c.top
5494
5766
  };
5495
5767
  }
5496
- function ai(c) {
5768
+ function fi(h) {
5497
5769
  const {
5498
5770
  width: t,
5499
5771
  height: e
5500
- } = Pt(c);
5772
+ } = $t(h);
5501
5773
  return {
5502
5774
  width: t,
5503
5775
  height: e
5504
5776
  };
5505
5777
  }
5506
- function li(c, t, e) {
5507
- const i = K(t), s = F(t), o = e === "fixed", r = J(c, !0, o, t);
5778
+ function xi(h, t, e) {
5779
+ const i = B(t), s = W(t), o = e === "fixed", r = q(h, !0, o, t);
5508
5780
  let a = {
5509
5781
  scrollLeft: 0,
5510
5782
  scrollTop: 0
5511
5783
  };
5512
- const l = B(0);
5513
- function h() {
5514
- l.x = pt(s);
5784
+ const c = Y(0);
5785
+ function l() {
5786
+ c.x = pt(s);
5515
5787
  }
5516
5788
  if (i || !i && !o)
5517
- if ((Z(t) !== "body" || et(s)) && (a = lt(t)), i) {
5518
- const x = J(t, !0, o, t);
5519
- l.x = x.x + t.clientLeft, l.y = x.y + t.clientTop;
5520
- } else s && h();
5521
- o && !i && s && h();
5522
- const d = s && !i && !o ? Gt(s, a) : B(0), f = r.left + a.scrollLeft - l.x - d.x, u = r.top + a.scrollTop - l.y - d.y;
5789
+ if ((Z(t) !== "body" || tt(s)) && (a = at(t)), i) {
5790
+ const x = q(t, !0, o, t);
5791
+ c.x = x.x + t.clientLeft, c.y = x.y + t.clientTop;
5792
+ } else s && l();
5793
+ o && !i && s && l();
5794
+ const d = s && !i && !o ? Zt(s, a) : Y(0), f = r.left + a.scrollLeft - c.x - d.x, u = r.top + a.scrollTop - c.y - d.y;
5523
5795
  return {
5524
5796
  x: f,
5525
5797
  y: u,
@@ -5527,39 +5799,39 @@ function li(c, t, e) {
5527
5799
  height: r.height
5528
5800
  };
5529
5801
  }
5530
- function ht(c) {
5531
- return N(c).position === "static";
5802
+ function ct(h) {
5803
+ return X(h).position === "static";
5532
5804
  }
5533
- function Ot(c, t) {
5534
- if (!K(c) || N(c).position === "fixed")
5805
+ function Mt(h, t) {
5806
+ if (!B(h) || X(h).position === "fixed")
5535
5807
  return null;
5536
5808
  if (t)
5537
- return t(c);
5538
- let e = c.offsetParent;
5539
- return F(c) === e && (e = e.ownerDocument.body), e;
5809
+ return t(h);
5810
+ let e = h.offsetParent;
5811
+ return W(h) === e && (e = e.ownerDocument.body), e;
5540
5812
  }
5541
- function jt(c, t) {
5542
- const e = A(c);
5543
- if (at(c))
5813
+ function qt(h, t) {
5814
+ const e = M(h);
5815
+ if (nt(h))
5544
5816
  return e;
5545
- if (!K(c)) {
5546
- let s = P(c);
5547
- for (; s && !j(s); ) {
5548
- if (X(s) && !ht(s))
5817
+ if (!B(h)) {
5818
+ let s = P(h);
5819
+ for (; s && !U(s); ) {
5820
+ if (k(s) && !ct(s))
5549
5821
  return s;
5550
5822
  s = P(s);
5551
5823
  }
5552
5824
  return e;
5553
5825
  }
5554
- let i = Ot(c, t);
5555
- for (; i && Pe(i) && ht(i); )
5556
- i = Ot(i, t);
5557
- return i && j(i) && ht(i) && !wt(i) ? e : i || je(c) || e;
5826
+ let i = Mt(h, t);
5827
+ for (; i && Ze(i) && ct(i); )
5828
+ i = Mt(i, t);
5829
+ return i && U(i) && ct(i) && !mt(i) ? e : i || ti(h) || e;
5558
5830
  }
5559
- const hi = async function(c) {
5560
- const t = this.getOffsetParent || jt, e = this.getDimensions, i = await e(c.floating);
5831
+ const ui = async function(h) {
5832
+ const t = this.getOffsetParent || qt, e = this.getDimensions, i = await e(h.floating);
5561
5833
  return {
5562
- reference: li(c.reference, await t(c.floating), c.strategy),
5834
+ reference: xi(h.reference, await t(h.floating), h.strategy),
5563
5835
  floating: {
5564
5836
  x: 0,
5565
5837
  y: 0,
@@ -5568,34 +5840,34 @@ const hi = async function(c) {
5568
5840
  }
5569
5841
  };
5570
5842
  };
5571
- function ci(c) {
5572
- return N(c).direction === "rtl";
5843
+ function gi(h) {
5844
+ return X(h).direction === "rtl";
5573
5845
  }
5574
- const di = {
5575
- convertOffsetParentRelativeRectToViewportRelativeRect: Qe,
5576
- getDocumentElement: F,
5577
- getClippingRect: ni,
5578
- getOffsetParent: jt,
5579
- getElementRects: hi,
5580
- getClientRects: ti,
5581
- getDimensions: ai,
5582
- getScale: U,
5583
- isElement: X,
5584
- isRTL: ci
5585
- }, Zt = Ye, qt = Fe, Jt = Ne, fi = Xe, Qt = (c, t, e) => {
5846
+ const wi = {
5847
+ convertOffsetParentRelativeRectToViewportRelativeRect: oi,
5848
+ getDocumentElement: W,
5849
+ getClippingRect: di,
5850
+ getOffsetParent: qt,
5851
+ getElementRects: ui,
5852
+ getClientRects: ri,
5853
+ getDimensions: fi,
5854
+ getScale: G,
5855
+ isElement: k,
5856
+ isRTL: gi
5857
+ }, Jt = ze, Qt = $e, te = Fe, mi = We, ee = (h, t, e) => {
5586
5858
  const i = /* @__PURE__ */ new Map(), s = {
5587
- platform: di,
5859
+ platform: wi,
5588
5860
  ...e
5589
5861
  }, o = {
5590
5862
  ...s.platform,
5591
5863
  _c: i
5592
5864
  };
5593
- return ke(c, t, {
5865
+ return Ke(h, t, {
5594
5866
  ...s,
5595
5867
  platform: o
5596
5868
  });
5597
5869
  };
5598
- let xi = class {
5870
+ let Ei = class {
5599
5871
  constructor(t) {
5600
5872
  n(this, "ctx");
5601
5873
  n(this, "enable", !1);
@@ -5616,7 +5888,7 @@ let xi = class {
5616
5888
  borderRadius: "4px",
5617
5889
  fontSize: "12px",
5618
5890
  ...o
5619
- }, l = {
5891
+ }, c = {
5620
5892
  position: "absolute",
5621
5893
  width: "10px",
5622
5894
  height: "10px",
@@ -5625,7 +5897,7 @@ let xi = class {
5625
5897
  transform: "rotate(45deg)",
5626
5898
  zIndex: a.zIndex
5627
5899
  };
5628
- Object.assign(this.arrowEl.style, l), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
5900
+ Object.assign(this.arrowEl.style, c), Object.assign(this.floatingEl.style, a), this.floatingEl.appendChild(this.contentEl), this.floatingEl.appendChild(this.arrowEl), this.ctx.containerElement.appendChild(this.floatingEl), this.init();
5629
5901
  }
5630
5902
  init() {
5631
5903
  this.floatingEl.addEventListener("mouseleave", () => {
@@ -5657,7 +5929,7 @@ let xi = class {
5657
5929
  return;
5658
5930
  this.enable = !0, this.contentEl.style.maxWidth = `${t.overflowTooltipMaxWidth || 500}px`, this.contentEl.style.minWidth = "100px", this.contentEl.style.width = "100%", this.contentEl.style.display = "inline-block", this.contentEl.style.wordBreak = "break-all", this.contentEl.style.lineHeight = "1.5", this.contentEl.innerText = e;
5659
5931
  const s = t.drawX + i.x, o = t.drawY + i.y;
5660
- Qt({
5932
+ ee({
5661
5933
  getBoundingClientRect() {
5662
5934
  return {
5663
5935
  width: t.visibleWidth,
@@ -5672,12 +5944,12 @@ let xi = class {
5672
5944
  }
5673
5945
  }, this.floatingEl, {
5674
5946
  placement: t.overflowTooltipPlacement,
5675
- middleware: [qt(), Jt(), Zt(6), fi({ element: this.arrowEl })]
5947
+ middleware: [Qt(), te(), Jt(6), mi({ element: this.arrowEl })]
5676
5948
  }).then((a) => {
5677
- const { x: l, y: h, placement: d, middlewareData: f } = a;
5949
+ const { x: c, y: l, placement: d, middlewareData: f } = a;
5678
5950
  if (Object.assign(this.floatingEl.style, {
5679
- top: `${h}px`,
5680
- left: `${l}px`
5951
+ top: `${l}px`,
5952
+ left: `${c}px`
5681
5953
  }), f.arrow) {
5682
5954
  const u = f.arrow;
5683
5955
  ["left", "left-start", "left-end"].includes(d) ? Object.assign(this.arrowEl.style, {
@@ -5711,7 +5983,7 @@ let xi = class {
5711
5983
  this.contentEl.remove(), this.arrowEl.remove(), this.floatingEl.remove();
5712
5984
  }
5713
5985
  };
5714
- class ui {
5986
+ class pi {
5715
5987
  constructor(t) {
5716
5988
  n(this, "editorEl");
5717
5989
  n(this, "inputEl");
@@ -5742,15 +6014,15 @@ class ui {
5742
6014
  return;
5743
6015
  if (t.code === "Escape" && this.ctx.editing) {
5744
6016
  this.cancel = !0;
5745
- const { focusCell: l } = this.ctx;
5746
- l && (this.ctx.emit("setSelectorCell", l), this.cellTarget = l), this.doneEdit();
6017
+ const { focusCell: c } = this.ctx;
6018
+ c && (this.ctx.emit("setSelectorCell", c), this.cellTarget = c), this.doneEdit();
5747
6019
  return;
5748
6020
  }
5749
6021
  if ((t.altKey || t.metaKey) && t.code === "Enter" && this.ctx.editing && this.inputEl) {
5750
6022
  t.preventDefault();
5751
- const l = this.inputEl.selectionStart, h = this.inputEl.value.substring(0, l), d = this.inputEl.value.substring(l);
5752
- this.inputEl.value = h + `
5753
- ` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = l + 1, this.autoSize();
6023
+ const c = this.inputEl.selectionStart, l = this.inputEl.value.substring(0, c), d = this.inputEl.value.substring(c);
6024
+ this.inputEl.value = l + `
6025
+ ` + d, this.inputEl.selectionStart = this.inputEl.selectionEnd = c + 1, this.autoSize();
5754
6026
  return;
5755
6027
  }
5756
6028
  if (t.code === "Tab" && this.ctx.editing) {
@@ -5830,8 +6102,8 @@ class ui {
5830
6102
  });
5831
6103
  }
5832
6104
  isInSelectorRange(t, e) {
5833
- const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, l] = s;
5834
- return !(e < o || e > r || t < a || t > l);
6105
+ const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, c] = s;
6106
+ return !(e < o || e > r || t < a || t > c);
5835
6107
  }
5836
6108
  initTextEditor() {
5837
6109
  this.inputEl = document.createElement("textarea"), this.inputEl.setAttribute("rows", "1"), this.inputEl.addEventListener("input", this.autoSize.bind(this)), this.inputEl.addEventListener("blur", () => {
@@ -5853,15 +6125,15 @@ class ui {
5853
6125
  startEditByInput(t, e = !1) {
5854
6126
  const i = e ? null : t.getValue(), { editorType: s } = t;
5855
6127
  t.update(), this.ctx.config.ENABLE_MERGE_CELL_LINK && t.updateSpanInfo();
5856
- let { height: o, width: r, drawY: a, drawX: l } = t;
5857
- this.drawX = l, this.drawY = a;
6128
+ let { height: o, width: r, drawY: a, drawX: c } = t;
6129
+ this.drawX = c, this.drawY = a;
5858
6130
  const {
5859
- config: { CELL_PADDING: h },
6131
+ config: { CELL_PADDING: l },
5860
6132
  header: d
5861
6133
  } = this.ctx;
5862
6134
  let f = this.ctx.body.visibleHeight;
5863
6135
  if (o > f && (o = f), this.editorEl.style.display = "inline-block", this.editorEl.style.left = `${this.drawX - 1}px`, this.editorEl.style.top = `${this.drawY - 1}px`, this.editorEl.style.bottom = "auto", this.editorEl.style.maxHeight = `${f}px`, s === "text") {
5864
- this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${h}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus({ preventScroll: !0 });
6136
+ this.inputEl.style.display = "block", this.inputEl.style.minWidth = `${r - 1}px`, this.inputEl.style.minHeight = `${o - 1}px`, this.inputEl.style.maxHeight = `${f}px`, this.inputEl.style.width = `${r - 1}px`, this.inputEl.style.height = "auto", this.inputEl.style.padding = `${l}px`, i !== null && (this.inputEl.value = i), this.inputEl.focus({ preventScroll: !0 });
5865
6137
  const u = this.inputEl.value.length;
5866
6138
  this.inputEl.setSelectionRange(u, u);
5867
6139
  } else
@@ -5885,22 +6157,22 @@ class ui {
5885
6157
  const { rowKey: o, key: r, editorType: a } = i;
5886
6158
  if (a === "none")
5887
6159
  return;
5888
- const l = this.ctx.database.getReadonly(o, r);
5889
- i && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
6160
+ const c = this.ctx.database.getReadonly(o, r);
6161
+ i && !c && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = i, this.startEditByInput(this.cellTarget, t), this.ctx.emit("startEdit", this.cellTarget));
5890
6162
  }
5891
6163
  editCell(t, e) {
5892
- const i = this.ctx.body.renderRows.find((h) => h.rowIndex === t);
6164
+ const i = this.ctx.body.renderRows.find((l) => l.rowIndex === t);
5893
6165
  if (!i)
5894
6166
  return;
5895
- const s = i.cells.find((h) => h.colIndex === e);
6167
+ const s = i.cells.find((l) => l.colIndex === e);
5896
6168
  if (!s)
5897
6169
  return;
5898
6170
  this.ctx.emit("setSelectorCell", s);
5899
6171
  const o = this.ctx.focusCell;
5900
6172
  if (!o || ["index", "index-selection", "selection"].includes(o.type) || this.enable)
5901
6173
  return;
5902
- const { rowKey: r, key: a } = o, l = this.ctx.database.getReadonly(r, a);
5903
- o && !l && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
6174
+ const { rowKey: r, key: a } = o, c = this.ctx.database.getReadonly(r, a);
6175
+ o && !c && (this.enable = !0, this.ctx.editing = !0, this.cellTarget = o, this.startEditByInput(this.cellTarget), this.ctx.emit("startEdit", this.cellTarget));
5904
6176
  }
5905
6177
  doneEdit() {
5906
6178
  this.enable && (this.doneEditByInput(), this.ctx.emit("doneEdit", this.cellTarget), this.enable = !1, this.ctx.editing = !1, this.ctx.containerElement.focus({ preventScroll: !0 }), this.editorEl.style.display = "none", this.ctx.emit("drawView"));
@@ -5913,31 +6185,31 @@ class ui {
5913
6185
  (t = this.editorEl) == null || t.remove();
5914
6186
  }
5915
6187
  }
5916
- class gi {
6188
+ class yi {
5917
6189
  constructor(t) {
5918
6190
  n(this, "ctx");
5919
6191
  n(this, "emptyEl");
5920
6192
  this.ctx = t;
5921
6193
  const { EMPTY_TEXT: e, EMPTY_CUSTOM_STYLE: i } = this.ctx.config;
5922
6194
  this.ctx.emptyElement ? this.emptyEl = this.ctx.emptyElement : (this.emptyEl = document.createElement("div"), this.emptyEl.innerText = e), this.emptyEl.className = "e-virt-table-empty", this.emptyEl.style.display = "none", this.ctx.containerElement.appendChild(this.emptyEl), this.ctx.on("emptyChange", ({ type: s, headerHeight: o, bodyHeight: r, footerHeight: a }) => {
5923
- const l = o + (r + a) / 2, h = {
6195
+ const c = o + (r + a) / 2, l = {
5924
6196
  display: s === "empty" ? "block" : "none",
5925
6197
  position: "absolute",
5926
6198
  fontSize: "14px",
5927
6199
  color: "#666",
5928
6200
  left: "50%",
5929
- top: `${l}px`,
6201
+ top: `${c}px`,
5930
6202
  transform: "translate(-50%, -50%)",
5931
6203
  ...i
5932
6204
  };
5933
- Object.assign(this.emptyEl.style, h);
6205
+ Object.assign(this.emptyEl.style, l);
5934
6206
  });
5935
6207
  }
5936
6208
  destroy() {
5937
6209
  this.emptyEl.remove();
5938
6210
  }
5939
6211
  }
5940
- class wi {
6212
+ class Ci {
5941
6213
  constructor(t) {
5942
6214
  n(this, "ctx");
5943
6215
  this.ctx = t;
@@ -5966,9 +6238,9 @@ class wi {
5966
6238
  fixedRightWidth: e,
5967
6239
  config: { SCROLLER_TRACK_SIZE: i, CSS_PREFIX: s }
5968
6240
  } = this.ctx, { visibleWidth: o, visibleHeight: r, renderCellHeaders: a } = this.ctx.header;
5969
- let l = [], h = [], d = [];
6241
+ let c = [], l = [], d = [];
5970
6242
  a.forEach((g) => {
5971
- g.render && (g.fixed === "left" ? h.push(g) : g.fixed === "right" ? d.push(g) : l.push(g));
6243
+ g.render && (g.fixed === "left" ? l.push(g) : g.fixed === "right" ? d.push(g) : c.push(g));
5972
6244
  });
5973
6245
  const f = e - i, u = {
5974
6246
  key: "left",
@@ -5980,7 +6252,7 @@ class wi {
5980
6252
  width: `${t}px`,
5981
6253
  height: `${r}px`
5982
6254
  },
5983
- cells: h
6255
+ cells: l
5984
6256
  }, x = {
5985
6257
  key: "center",
5986
6258
  style: {
@@ -5991,7 +6263,7 @@ class wi {
5991
6263
  width: `${o - t - f + 1}px`,
5992
6264
  height: `${r}px`
5993
6265
  },
5994
- cells: l
6266
+ cells: c
5995
6267
  }, w = {
5996
6268
  key: "right",
5997
6269
  style: {
@@ -6020,15 +6292,15 @@ class wi {
6020
6292
  const t = [], e = [], i = [];
6021
6293
  let s = this.ctx.body.renderRows;
6022
6294
  this.ctx.config.FOOTER_FIXED || (s = s.concat(this.ctx.footer.renderRows)), s.forEach((g) => {
6023
- g.cells.forEach((p) => {
6024
- p.cellType === "footer" && (p.render = p.renderFooter), p.render && (p.fixed === "left" ? e.push(p) : p.fixed === "right" ? i.push(p) : t.push(p));
6295
+ g.cells.forEach((E) => {
6296
+ E.cellType === "footer" && (E.render = E.renderFooter), E.render && (E.fixed === "left" ? e.push(E) : E.fixed === "right" ? i.push(E) : t.push(E));
6025
6297
  });
6026
6298
  });
6027
6299
  const {
6028
6300
  fixedLeftWidth: o,
6029
6301
  fixedRightWidth: r,
6030
- config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: l }
6031
- } = this.ctx, { visibleWidth: h, visibleHeight: d } = this.ctx.body, f = r - a, u = {
6302
+ config: { SCROLLER_TRACK_SIZE: a, CSS_PREFIX: c }
6303
+ } = this.ctx, { visibleWidth: l, visibleHeight: d } = this.ctx.body, f = r - a, u = {
6032
6304
  key: "left",
6033
6305
  style: {
6034
6306
  position: "absolute",
@@ -6046,7 +6318,7 @@ class wi {
6046
6318
  top: `${0.5}px`,
6047
6319
  left: `${o - 0.5}px`,
6048
6320
  overflow: "hidden",
6049
- width: `${h - o - f}px`,
6321
+ width: `${l - o - f}px`,
6050
6322
  height: `${d}px`
6051
6323
  },
6052
6324
  cells: t
@@ -6064,11 +6336,11 @@ class wi {
6064
6336
  };
6065
6337
  return {
6066
6338
  type: "body",
6067
- class: `${l}-overlayer-body`,
6339
+ class: `${c}-overlayer-body`,
6068
6340
  style: {
6069
6341
  position: "relative",
6070
6342
  overflow: "hidden",
6071
- width: `${h}px`,
6343
+ width: `${l}px`,
6072
6344
  height: `${d}px`
6073
6345
  },
6074
6346
  views: [u, x, w]
@@ -6076,8 +6348,8 @@ class wi {
6076
6348
  }
6077
6349
  getFooter() {
6078
6350
  const t = [], e = [], i = [];
6079
- this.ctx.footer.renderRows.forEach((E) => {
6080
- E.cells.forEach((g) => {
6351
+ this.ctx.footer.renderRows.forEach((m) => {
6352
+ m.cells.forEach((g) => {
6081
6353
  g.cellType === "footer" && g.renderFooter && (g.render = g.renderFooter, g.fixed === "left" ? e.push(g) : g.fixed === "right" ? i.push(g) : t.push(g));
6082
6354
  });
6083
6355
  });
@@ -6085,7 +6357,7 @@ class wi {
6085
6357
  fixedLeftWidth: s,
6086
6358
  fixedRightWidth: o,
6087
6359
  config: { SCROLLER_TRACK_SIZE: r, CSS_PREFIX: a }
6088
- } = this.ctx, { visibleWidth: l, visibleHeight: h } = this.ctx.footer, d = o - r, f = {
6360
+ } = this.ctx, { visibleWidth: c, visibleHeight: l } = this.ctx.footer, d = o - r, f = {
6089
6361
  key: "left",
6090
6362
  style: {
6091
6363
  position: "absolute",
@@ -6093,7 +6365,7 @@ class wi {
6093
6365
  left: `${0.5}px`,
6094
6366
  overflow: "hidden",
6095
6367
  width: `${s}px`,
6096
- height: `${h}px`
6368
+ height: `${l}px`
6097
6369
  },
6098
6370
  cells: e
6099
6371
  }, u = {
@@ -6103,8 +6375,8 @@ class wi {
6103
6375
  top: `${0.5}px`,
6104
6376
  left: `${s - 0.5}px`,
6105
6377
  overflow: "hidden",
6106
- width: `${l - s - d}px`,
6107
- height: `${h}px`
6378
+ width: `${c - s - d}px`,
6379
+ height: `${l}px`
6108
6380
  },
6109
6381
  cells: t
6110
6382
  }, x = {
@@ -6115,7 +6387,7 @@ class wi {
6115
6387
  right: `${0.5}px`,
6116
6388
  overflow: "hidden",
6117
6389
  width: `${d}px`,
6118
- height: `${h}px`
6390
+ height: `${l}px`
6119
6391
  },
6120
6392
  cells: i
6121
6393
  };
@@ -6125,14 +6397,14 @@ class wi {
6125
6397
  style: {
6126
6398
  position: "relative",
6127
6399
  overflow: "hidden",
6128
- width: `${l}px`,
6129
- height: `${h}px`
6400
+ width: `${c}px`,
6401
+ height: `${l}px`
6130
6402
  },
6131
6403
  views: [f, u, x]
6132
6404
  };
6133
6405
  }
6134
6406
  }
6135
- class Ei {
6407
+ class bi {
6136
6408
  constructor(t) {
6137
6409
  n(this, "ctx");
6138
6410
  n(this, "contextMenuEl");
@@ -6143,8 +6415,8 @@ class Ei {
6143
6415
  this.ctx.on("cellContextMenuClick", (t, e) => {
6144
6416
  if (!this.ctx.config.ENABLE_CONTEXT_MENU) return;
6145
6417
  e.preventDefault();
6146
- const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, l] = s, { rowIndex: h, colIndex: d } = t;
6147
- h >= a && h <= l && d >= o && d <= r || this.ctx.emit("setSelectorCell", t, e);
6418
+ const { xArr: i, yArr: s } = this.ctx.selector, [o, r] = i, [a, c] = s, { rowIndex: l, colIndex: d } = t;
6419
+ l >= a && l <= c && d >= o && d <= r || this.ctx.emit("setSelectorCell", t, e);
6148
6420
  const u = {
6149
6421
  getBoundingClientRect: () => ({
6150
6422
  width: 0,
@@ -6158,9 +6430,9 @@ class Ei {
6158
6430
  }),
6159
6431
  contextElement: document.body
6160
6432
  };
6161
- Qt(u, this.contextMenuEl, {
6433
+ ee(u, this.contextMenuEl, {
6162
6434
  placement: "right-start",
6163
- middleware: [Zt(), qt(), Jt()]
6435
+ middleware: [Jt(), Qt(), te()]
6164
6436
  }).then(({ x, y: w }) => {
6165
6437
  this.show(x, w);
6166
6438
  });
@@ -6218,7 +6490,7 @@ class Ei {
6218
6490
  this.contextMenuEl.remove();
6219
6491
  }
6220
6492
  }
6221
- class yi {
6493
+ class Si {
6222
6494
  constructor(t, e) {
6223
6495
  n(this, "options");
6224
6496
  n(this, "scroller");
@@ -6241,7 +6513,7 @@ class yi {
6241
6513
  o,
6242
6514
  r
6243
6515
  );
6244
- this.ctx = new pe(a, this.options), this.header = new ye(this.ctx), this.footer = new be(this.ctx), this.body = new Ce(this.ctx), this.scroller = new me(this.ctx), this.selector = new Re(this.ctx), this.autofill = new Ie(this.ctx), this.tooltip = new xi(this.ctx), this.empty = new gi(this.ctx), this.editor = new ui(this.ctx), this.overlayer = new wi(this.ctx), this.contextMenu = new Ei(this.ctx), this.ctx.on("draw", () => {
6516
+ this.ctx = new Ie(a, this.options), this.header = new Se(this.ctx), this.footer = new _e(this.ctx), this.body = new ve(this.ctx), this.scroller = new Re(this.ctx), this.selector = new Te(this.ctx), this.autofill = new Oe(this.ctx), this.tooltip = new Ei(this.ctx), this.empty = new yi(this.ctx), this.editor = new pi(this.ctx), this.overlayer = new Ci(this.ctx), this.contextMenu = new bi(this.ctx), this.ctx.on("draw", () => {
6245
6517
  this.draw();
6246
6518
  }), this.ctx.on("drawView", () => {
6247
6519
  this.draw(!0);
@@ -6249,17 +6521,17 @@ class yi {
6249
6521
  }
6250
6522
  createContainer(t, e, i, s, o) {
6251
6523
  t.className = "e-virt-table-container";
6252
- const r = document.createElement("div"), a = document.createElement("canvas"), l = e || document.createElement("div");
6253
- r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas", l.className = "e-virt-table-overlayer";
6254
- const h = i || document.createElement("div");
6255
- h.className = "e-virt-table-editor";
6524
+ const r = document.createElement("div"), a = document.createElement("canvas"), c = e || document.createElement("div");
6525
+ r.className = "e-virt-table-stage", t.tabIndex = 0, a.className = "e-virt-table-canvas", c.className = "e-virt-table-overlayer";
6526
+ const l = i || document.createElement("div");
6527
+ l.className = "e-virt-table-editor";
6256
6528
  const d = s, f = o;
6257
- return r.appendChild(a), r.appendChild(l), t.appendChild(r), {
6529
+ return r.appendChild(a), r.appendChild(c), t.appendChild(r), {
6258
6530
  containerElement: t,
6259
6531
  stageElement: r,
6260
6532
  canvasElement: a,
6261
- overlayerElement: l,
6262
- editorElement: h,
6533
+ overlayerElement: c,
6534
+ editorElement: l,
6263
6535
  emptyElement: d,
6264
6536
  contextMenuElement: f
6265
6537
  };
@@ -6346,15 +6618,15 @@ class yi {
6346
6618
  return new Promise(async (i, s) => {
6347
6619
  let o = [];
6348
6620
  for (let r = 0; r < t.length; r++) {
6349
- const { rowKey: a, key: l } = t[r], h = await this.ctx.database.getValidator(a, l);
6350
- Array.isArray(h) && h.length && o.push(h);
6621
+ const { rowKey: a, key: c } = t[r], l = await this.ctx.database.getValidator(a, c);
6622
+ Array.isArray(l) && l.length && o.push(l);
6351
6623
  }
6352
6624
  if (o.length) {
6353
6625
  if (s(o), e) {
6354
6626
  const [r] = o;
6355
6627
  if (Array.isArray(r) && r.length) {
6356
- const [a] = r, { rowKey: l, key: h } = a;
6357
- this.scrollToRowkey(l), this.scrollToColkey(h);
6628
+ const [a] = r, { rowKey: c, key: l } = a;
6629
+ this.scrollToRowkey(c), this.scrollToColkey(l);
6358
6630
  }
6359
6631
  }
6360
6632
  this.ctx.emit("draw");
@@ -6371,12 +6643,12 @@ class yi {
6371
6643
  if (t && Array.isArray(s) && s.length) {
6372
6644
  const [o] = s;
6373
6645
  if (Array.isArray(o) && o.length) {
6374
- const [r] = o, { rowKey: a, key: l } = r, h = this.ctx.database.getRowForRowKey(a);
6375
- if (h) {
6376
- const { parentRowKeys: d = [] } = h;
6646
+ const [r] = o, { rowKey: a, key: c } = r, l = this.ctx.database.getRowForRowKey(a);
6647
+ if (l) {
6648
+ const { parentRowKeys: d = [] } = l;
6377
6649
  d && d.length && this.setExpandRowKeys(d, !0);
6378
6650
  }
6379
- this.scrollToRowkey(a), this.scrollToColkey(l);
6651
+ this.scrollToRowkey(a), this.scrollToColkey(c);
6380
6652
  }
6381
6653
  }
6382
6654
  i(s);
@@ -6401,7 +6673,7 @@ class yi {
6401
6673
  let o = [];
6402
6674
  for (let r = 0; r < i.length; r++)
6403
6675
  for (let a = 0; a < s.length; a++) {
6404
- const l = this.ctx.database.getRowKeyByItem(i[r]), d = s[a].key, f = await this.ctx.database.getValidator(l, d);
6676
+ const c = this.ctx.database.getRowKeyByItem(i[r]), d = s[a].key, f = await this.ctx.database.getValidator(c, d);
6405
6677
  Array.isArray(f) && f.length && o.push(f);
6406
6678
  }
6407
6679
  o.length ? (e(o), this.ctx.emit("draw")) : (t([]), this.ctx.emit("draw"));
@@ -6476,15 +6748,18 @@ class yi {
6476
6748
  getCellValueByIndex(t, e) {
6477
6749
  return this.ctx.database.getItemValueForRowIndexAndColIndex(t, e);
6478
6750
  }
6751
+ clearSort() {
6752
+ this.ctx.database.clearSort();
6753
+ }
6479
6754
  contextMenuHide() {
6480
6755
  this.contextMenu.hide();
6481
6756
  }
6482
6757
  getUtils() {
6483
6758
  return {
6484
- mergeColCell: he,
6485
- mergeRowCell: le,
6486
- getSpanArrByRow: Dt,
6487
- getSpanObjByColumn: kt
6759
+ mergeColCell: de,
6760
+ mergeRowCell: he,
6761
+ getSpanArrByRow: kt,
6762
+ getSpanObjByColumn: Xt
6488
6763
  };
6489
6764
  }
6490
6765
  getColumnByKey(t) {
@@ -6499,6 +6774,6 @@ class yi {
6499
6774
  }
6500
6775
  }
6501
6776
  export {
6502
- yi as default
6777
+ Si as default
6503
6778
  };
6504
6779
  //# sourceMappingURL=index.es.js.map