@svgrid/grid-wc 2.0.1 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -25
- package/README.md +110 -90
- package/dist/GridMenus-CdOznO0T.js +417 -0
- package/dist/SvDateTimePicker-Duf-XIOa.js +2011 -0
- package/dist/SvGridChart-EY7OOxv6.js +1192 -0
- package/dist/SvGridChartPanel-Co6RTvAr.js +576 -0
- package/dist/SvGridChartView-BOOZMn2C.js +50 -0
- package/dist/SvGridDropdown-N9LVZsIs.js +251 -0
- package/dist/chart-CSZhFIR9.js +1212 -0
- package/dist/client-DOa609yZ.js +3036 -0
- package/dist/conditional-formatting-Dz-bxLJ2.js +265 -0
- package/dist/dismissable-DvhBKm3q.js +41 -0
- package/dist/editor-contract-peBDxir_.js +22 -0
- package/dist/export-format-DsOZUiL3.js +160 -0
- package/dist/fill-patterns-BWj5Zuhp.js +650 -0
- package/dist/popover-WsGlvtQv.js +69 -0
- package/dist/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist/sv-grid-element.js +7392 -16192
- package/package.json +8 -4
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
//#region ../grid/dist/sv-grid-scrollbar.js
|
|
2
|
+
var e = 16, t = 280, n = 50, r = "http://www.w3.org/2000/svg";
|
|
3
|
+
function i() {
|
|
4
|
+
let e = document.createElementNS(r, "svg");
|
|
5
|
+
e.setAttribute("viewBox", "0 0 24 24"), e.setAttribute("fill", "none"), e.setAttribute("stroke", "currentColor"), e.setAttribute("stroke-width", "3"), e.setAttribute("stroke-linecap", "round"), e.setAttribute("stroke-linejoin", "round");
|
|
6
|
+
let t = document.createElementNS(r, "path");
|
|
7
|
+
return t.setAttribute("d", "M6 9l6 6 6-6"), e.appendChild(t), e;
|
|
8
|
+
}
|
|
9
|
+
var a = `
|
|
10
|
+
:host {
|
|
11
|
+
display: flex;
|
|
12
|
+
user-select: none;
|
|
13
|
+
background: var(--sg-scrollbar-bg, #eef2f8);
|
|
14
|
+
/* The 1px separator is drawn on the INNER edge only (the edge facing
|
|
15
|
+
the grid body) via the orientation rules below. A full inset box
|
|
16
|
+
here doubled up with the grid's own frame border on the outer edge,
|
|
17
|
+
reading as a 2px border - most visible in dense-gridline themes
|
|
18
|
+
like Excel, which should show a single 1px line. */
|
|
19
|
+
/* Start hidden + non-interactive - viewport/content sizes are 0 until
|
|
20
|
+
after the first layout pass, so without this default the scrollbar
|
|
21
|
+
paints visible for one frame and then JS hides it on mount. That
|
|
22
|
+
flicker is what shows up as a "flashing horizontal scrollbar"
|
|
23
|
+
every time a demo first renders. updateGeometry() switches us to
|
|
24
|
+
opacity 1 the moment the grid genuinely has overflow. */
|
|
25
|
+
opacity: 0;
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
transition: opacity 120ms ease;
|
|
28
|
+
}
|
|
29
|
+
:host([orientation="vertical"]) {
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
width: ${e}px;
|
|
32
|
+
/* LTR: vertical scrollbar sits at the right, inner edge is the left. */
|
|
33
|
+
box-shadow: inset 1px 0 0 0 var(--sg-scrollbar-border, rgba(15, 23, 42, 0.04));
|
|
34
|
+
}
|
|
35
|
+
:host([orientation="vertical"]:dir(rtl)) {
|
|
36
|
+
/* RTL flips the scrollbar to the left, so the inner edge is the right. */
|
|
37
|
+
box-shadow: inset -1px 0 0 0 var(--sg-scrollbar-border, rgba(15, 23, 42, 0.04));
|
|
38
|
+
}
|
|
39
|
+
:host([orientation="horizontal"]) {
|
|
40
|
+
flex-direction: row;
|
|
41
|
+
height: ${e}px;
|
|
42
|
+
/* Horizontal scrollbar sits at the bottom, inner edge is the top. */
|
|
43
|
+
box-shadow: inset 0 1px 0 0 var(--sg-scrollbar-border, rgba(15, 23, 42, 0.04));
|
|
44
|
+
}
|
|
45
|
+
.arrow {
|
|
46
|
+
flex: none;
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
width: ${e}px;
|
|
51
|
+
height: ${e}px;
|
|
52
|
+
margin: 0;
|
|
53
|
+
padding: 0;
|
|
54
|
+
border: 0;
|
|
55
|
+
border-radius: 3px;
|
|
56
|
+
background: transparent;
|
|
57
|
+
color: var(--sg-scrollbar-arrow, #64748b);
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
transition: background-color 100ms ease, color 100ms ease;
|
|
60
|
+
}
|
|
61
|
+
.arrow:hover {
|
|
62
|
+
background: var(--sg-scrollbar-arrow-hover-bg, #dde4ee);
|
|
63
|
+
color: var(--sg-scrollbar-arrow-hover, #1f2937);
|
|
64
|
+
}
|
|
65
|
+
.arrow:active {
|
|
66
|
+
background: var(--sg-scrollbar-arrow-active-bg, #c7d1df);
|
|
67
|
+
color: var(--sg-scrollbar-arrow-active, #0f172a);
|
|
68
|
+
}
|
|
69
|
+
.arrow:disabled {
|
|
70
|
+
color: var(--sg-scrollbar-arrow-disabled, #cbd5e1);
|
|
71
|
+
cursor: default;
|
|
72
|
+
}
|
|
73
|
+
.arrow:disabled:hover {
|
|
74
|
+
background: transparent;
|
|
75
|
+
}
|
|
76
|
+
.arrow svg {
|
|
77
|
+
width: 10px;
|
|
78
|
+
height: 10px;
|
|
79
|
+
display: block;
|
|
80
|
+
}
|
|
81
|
+
:host([orientation="vertical"]) .arrow-start svg {
|
|
82
|
+
transform: rotate(180deg);
|
|
83
|
+
}
|
|
84
|
+
:host([orientation="horizontal"]) .arrow-start svg {
|
|
85
|
+
transform: rotate(90deg);
|
|
86
|
+
}
|
|
87
|
+
:host([orientation="horizontal"]) .arrow-end svg {
|
|
88
|
+
transform: rotate(-90deg);
|
|
89
|
+
}
|
|
90
|
+
.track {
|
|
91
|
+
position: relative;
|
|
92
|
+
flex: 1 1 0;
|
|
93
|
+
min-width: 0;
|
|
94
|
+
min-height: 0;
|
|
95
|
+
}
|
|
96
|
+
.thumb {
|
|
97
|
+
position: absolute;
|
|
98
|
+
border-radius: var(--sg-scrollbar-thumb-radius, 6px);
|
|
99
|
+
background: var(--sg-scrollbar-thumb, #b1bccd);
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
transition: background-color 100ms ease;
|
|
102
|
+
}
|
|
103
|
+
.thumb:hover {
|
|
104
|
+
background: var(--sg-scrollbar-thumb-hover, #8693a7);
|
|
105
|
+
}
|
|
106
|
+
.thumb:active {
|
|
107
|
+
background: var(--sg-scrollbar-thumb-active, #64748b);
|
|
108
|
+
}
|
|
109
|
+
:host([orientation="vertical"]) .thumb {
|
|
110
|
+
left: 3px;
|
|
111
|
+
right: 3px;
|
|
112
|
+
}
|
|
113
|
+
:host([orientation="horizontal"]) .thumb {
|
|
114
|
+
top: 3px;
|
|
115
|
+
bottom: 3px;
|
|
116
|
+
}
|
|
117
|
+
`, o = typeof HTMLElement < "u" ? HTMLElement : class {}, s = class extends o {
|
|
118
|
+
constructor() {
|
|
119
|
+
super(...arguments), this.dragging = !1, this.dragStart = 0, this.valueStart = 0, this.holdTimer = null, this.resizeObserver = null, this.resizeFrame = 0, this.onArrowStartPointerDown = (e) => {
|
|
120
|
+
e.preventDefault(), this.startHold(-1);
|
|
121
|
+
}, this.onArrowEndPointerDown = (e) => {
|
|
122
|
+
e.preventDefault(), this.startHold(1);
|
|
123
|
+
}, this.stopHold = () => {
|
|
124
|
+
this.holdTimer !== null && (clearTimeout(this.holdTimer), clearInterval(this.holdTimer), this.holdTimer = null);
|
|
125
|
+
}, this.onThumbPointerDown = (e) => {
|
|
126
|
+
e.preventDefault(), this.dragging = !0, this.dragStart = this.orientation === "vertical" ? e.clientY : e.clientX, this.valueStart = this.value, document.addEventListener("pointermove", this.onPointerMove), document.addEventListener("pointerup", this.onPointerUp);
|
|
127
|
+
}, this.onTrackPointerDown = (e) => {
|
|
128
|
+
if (e.target === this.thumb) return;
|
|
129
|
+
let t = this.track.getBoundingClientRect(), n = this.orientation === "vertical" ? e.clientY - t.top : e.clientX - t.left, r = this.orientation === "vertical" ? t.height : t.width, i = this.computeThumbSize(r), a = Math.max(r - i, 1), o = Math.min(Math.max(n - i / 2, 0), a);
|
|
130
|
+
this.emitScroll(o / a * this.maxValue);
|
|
131
|
+
}, this.onPointerMove = (e) => {
|
|
132
|
+
if (!this.dragging) return;
|
|
133
|
+
let t = (this.orientation === "vertical" ? e.clientY : e.clientX) - this.dragStart, n = this.track.getBoundingClientRect(), r = this.orientation === "vertical" ? n.height : n.width, i = this.computeThumbSize(r), a = Math.max(r - i, 1);
|
|
134
|
+
this.emitScroll(this.valueStart + t / a * this.maxValue);
|
|
135
|
+
}, this.onPointerUp = () => {
|
|
136
|
+
this.dragging = !1, document.removeEventListener("pointermove", this.onPointerMove), document.removeEventListener("pointerup", this.onPointerUp);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
static get observedAttributes() {
|
|
140
|
+
return [
|
|
141
|
+
"orientation",
|
|
142
|
+
"viewport-size",
|
|
143
|
+
"content-size",
|
|
144
|
+
"value",
|
|
145
|
+
"step"
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
connectedCallback() {
|
|
149
|
+
if (this.shadowRoot) return;
|
|
150
|
+
let e = this.attachShadow({ mode: "open" }), t = document.createElement("style");
|
|
151
|
+
t.textContent = a, this.startArrow = this.createArrow("start"), this.endArrow = this.createArrow("end"), this.track = document.createElement("div"), this.track.className = "track", this.thumb = document.createElement("div"), this.thumb.className = "thumb", this.track.appendChild(this.thumb), e.append(t, this.startArrow, this.track, this.endArrow), this.thumb.addEventListener("pointerdown", this.onThumbPointerDown), this.track.addEventListener("pointerdown", this.onTrackPointerDown), this.startArrow.addEventListener("pointerdown", this.onArrowStartPointerDown), this.endArrow.addEventListener("pointerdown", this.onArrowEndPointerDown);
|
|
152
|
+
for (let e of [this.startArrow, this.endArrow]) e.addEventListener("pointerup", this.stopHold), e.addEventListener("pointerleave", this.stopHold), e.addEventListener("pointercancel", this.stopHold);
|
|
153
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
154
|
+
this.resizeFrame ||= requestAnimationFrame(() => {
|
|
155
|
+
this.resizeFrame = 0, this.render();
|
|
156
|
+
});
|
|
157
|
+
}), this.resizeObserver.observe(this), this.render();
|
|
158
|
+
}
|
|
159
|
+
disconnectedCallback() {
|
|
160
|
+
this.stopHold(), this.resizeFrame && cancelAnimationFrame(this.resizeFrame), this.resizeFrame = 0, this.resizeObserver?.disconnect(), this.resizeObserver = null, document.removeEventListener("pointermove", this.onPointerMove), document.removeEventListener("pointerup", this.onPointerUp);
|
|
161
|
+
}
|
|
162
|
+
attributeChangedCallback() {
|
|
163
|
+
this.render();
|
|
164
|
+
}
|
|
165
|
+
get orientation() {
|
|
166
|
+
return this.getAttribute("orientation") === "horizontal" ? "horizontal" : "vertical";
|
|
167
|
+
}
|
|
168
|
+
get viewportSize() {
|
|
169
|
+
return Number(this.getAttribute("viewport-size") || "0");
|
|
170
|
+
}
|
|
171
|
+
get contentSize() {
|
|
172
|
+
return Number(this.getAttribute("content-size") || "0");
|
|
173
|
+
}
|
|
174
|
+
get value() {
|
|
175
|
+
return Number(this.getAttribute("value") || "0");
|
|
176
|
+
}
|
|
177
|
+
get step() {
|
|
178
|
+
let e = Number(this.getAttribute("step") || "40");
|
|
179
|
+
return e > 0 ? e : 40;
|
|
180
|
+
}
|
|
181
|
+
get maxValue() {
|
|
182
|
+
return Math.max(this.contentSize - this.viewportSize, 0);
|
|
183
|
+
}
|
|
184
|
+
getTrackLength() {
|
|
185
|
+
let t = this.track.getBoundingClientRect(), n = this.orientation === "vertical" ? t.height : t.width;
|
|
186
|
+
return n > 0 ? n : Math.max(this.viewportSize - e * 2, 1);
|
|
187
|
+
}
|
|
188
|
+
computeThumbSize(e) {
|
|
189
|
+
if (this.contentSize <= 0 || this.viewportSize <= 0 || e <= 0) return 0;
|
|
190
|
+
let t = Math.min(this.viewportSize / this.contentSize, 1);
|
|
191
|
+
return Math.max(20, t * e);
|
|
192
|
+
}
|
|
193
|
+
createArrow(e) {
|
|
194
|
+
let t = document.createElement("button");
|
|
195
|
+
return t.type = "button", t.className = `arrow arrow-${e}`, t.setAttribute("aria-label", e === "start" ? "Scroll back" : "Scroll forward"), t.appendChild(i()), t;
|
|
196
|
+
}
|
|
197
|
+
startHold(e) {
|
|
198
|
+
this.stopHold();
|
|
199
|
+
let r = () => this.emitScroll(this.value + e * this.step);
|
|
200
|
+
r(), this.holdTimer = setTimeout(() => {
|
|
201
|
+
this.holdTimer = setInterval(r, n);
|
|
202
|
+
}, t);
|
|
203
|
+
}
|
|
204
|
+
emitScroll(e) {
|
|
205
|
+
let t = Math.min(Math.max(e, 0), this.maxValue);
|
|
206
|
+
this.dispatchEvent(new CustomEvent("scroll-change", {
|
|
207
|
+
detail: { value: t },
|
|
208
|
+
bubbles: !0,
|
|
209
|
+
composed: !0
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
render() {
|
|
213
|
+
if (!this.shadowRoot) return;
|
|
214
|
+
let e = this.viewportSize, t = this.contentSize <= e || e <= 0;
|
|
215
|
+
this.style.opacity = t ? "0" : "1", this.style.pointerEvents = t ? "none" : "auto";
|
|
216
|
+
let n = this.getTrackLength(), r = this.computeThumbSize(n), i = this.maxValue, a = (i > 0 ? this.value / i : 0) * Math.max(n - r, 0);
|
|
217
|
+
this.orientation === "vertical" ? (this.thumb.style.height = `${r}px`, this.thumb.style.transform = `translateY(${a}px)`) : (this.thumb.style.width = `${r}px`, this.thumb.style.transform = `translateX(${a}px)`), this.startArrow.disabled = t || this.value <= 0, this.endArrow.disabled = t || this.value >= i;
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
typeof window < "u" && !customElements.get("sv-grid-scrollbar") && customElements.define("sv-grid-scrollbar", s);
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region ../grid/dist/render-component.js
|
|
223
|
+
var c = class {
|
|
224
|
+
constructor(e, t) {
|
|
225
|
+
this.component = e, this.props = t;
|
|
226
|
+
}
|
|
227
|
+
}, l = class {
|
|
228
|
+
constructor(e, t) {
|
|
229
|
+
this.snippet = e, this.params = t;
|
|
230
|
+
}
|
|
231
|
+
}, u = {
|
|
232
|
+
width: 88,
|
|
233
|
+
height: 22,
|
|
234
|
+
color: "var(--sg-accent, #2563eb)",
|
|
235
|
+
negativeColor: "#ef4444",
|
|
236
|
+
lineWidth: 1.5
|
|
237
|
+
};
|
|
238
|
+
function d(e) {
|
|
239
|
+
return Array.isArray(e) ? e.map((e) => Number(e)).filter((e) => Number.isFinite(e)) : typeof e == "string" && e.trim() ? e.split(/[,\s]+/).map((e) => Number(e)).filter((e) => Number.isFinite(e)) : [];
|
|
240
|
+
}
|
|
241
|
+
function f(e, t = {}) {
|
|
242
|
+
if (!e.length) return null;
|
|
243
|
+
let n = t.width ?? u.width, r = t.height ?? u.height, i = t.type ?? "line", a = t.color ?? u.color, o = t.negativeColor ?? u.negativeColor, s = t.lineWidth ?? u.lineWidth, c = Math.ceil(s) + 1, l = Math.max(1, n - c * 2), d = Math.max(1, r - c * 2), f = {
|
|
244
|
+
width: n,
|
|
245
|
+
height: r,
|
|
246
|
+
type: i,
|
|
247
|
+
color: a,
|
|
248
|
+
negativeColor: o,
|
|
249
|
+
lineWidth: s
|
|
250
|
+
};
|
|
251
|
+
if (i === "winloss") {
|
|
252
|
+
let t = e.length, n = t > 1 ? Math.min(2, l / t / 3) : 0, i = l / t, a = Math.max(1, i - n), o = r / 2, s = d / 2, u = e.map((e, t) => {
|
|
253
|
+
let n = c + t * i + (i - a) / 2;
|
|
254
|
+
return e > 0 ? {
|
|
255
|
+
x: n,
|
|
256
|
+
y: o - s,
|
|
257
|
+
w: a,
|
|
258
|
+
h: s,
|
|
259
|
+
negative: !1
|
|
260
|
+
} : e < 0 ? {
|
|
261
|
+
x: n,
|
|
262
|
+
y: o,
|
|
263
|
+
w: a,
|
|
264
|
+
h: s,
|
|
265
|
+
negative: !0
|
|
266
|
+
} : {
|
|
267
|
+
x: n,
|
|
268
|
+
y: o - 1,
|
|
269
|
+
w: a,
|
|
270
|
+
h: 2,
|
|
271
|
+
negative: !1
|
|
272
|
+
};
|
|
273
|
+
});
|
|
274
|
+
return {
|
|
275
|
+
...f,
|
|
276
|
+
linePath: "",
|
|
277
|
+
areaPath: "",
|
|
278
|
+
bars: u,
|
|
279
|
+
lastPoint: null
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
let m = t.min ?? Math.min(...e), h = t.max ?? Math.max(...e), g = h - m || 1;
|
|
283
|
+
if (i === "bar") {
|
|
284
|
+
let t = e.length, n = t > 1 ? Math.min(2, l / t / 3) : 0, r = l / t, i = Math.max(1, r - n), a = m < 0 && h > 0 ? 0 : m, o = c + d - (a - m) / g * d, s = e.map((e, t) => {
|
|
285
|
+
let n = c + t * r + (r - i) / 2, s = c + d - (e - m) / g * d;
|
|
286
|
+
return {
|
|
287
|
+
x: n,
|
|
288
|
+
y: Math.min(s, o),
|
|
289
|
+
w: i,
|
|
290
|
+
h: Math.max(1, Math.abs(s - o)),
|
|
291
|
+
negative: e < a
|
|
292
|
+
};
|
|
293
|
+
});
|
|
294
|
+
return {
|
|
295
|
+
...f,
|
|
296
|
+
linePath: "",
|
|
297
|
+
areaPath: "",
|
|
298
|
+
bars: s,
|
|
299
|
+
lastPoint: null
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
let _ = e.length, v = _ > 1 ? l / (_ - 1) : 0, y = e.map((e, t) => ({
|
|
303
|
+
x: _ === 1 ? c + l / 2 : c + t * v,
|
|
304
|
+
y: c + d - (e - m) / g * d
|
|
305
|
+
})), b = _ === 1 ? `M${p(y[0].x - 1)},${p(y[0].y)} L${p(y[0].x + 1)},${p(y[0].y)}` : y.map((e, t) => `${t === 0 ? "M" : "L"}${p(e.x)},${p(e.y)}`).join(" "), x = y[0], S = y[y.length - 1], C = c + d, w = i === "area" ? `${b} L${p(S.x)},${p(C)} L${p(x.x)},${p(C)} Z` : "";
|
|
306
|
+
return {
|
|
307
|
+
...f,
|
|
308
|
+
linePath: b,
|
|
309
|
+
areaPath: w,
|
|
310
|
+
bars: [],
|
|
311
|
+
lastPoint: t.lastPoint === !1 ? null : {
|
|
312
|
+
x: S.x,
|
|
313
|
+
y: S.y
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function p(e) {
|
|
318
|
+
return Math.round(e * 100) / 100;
|
|
319
|
+
}
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region ../grid/dist/SvGrid.helpers.js
|
|
322
|
+
function m(e) {
|
|
323
|
+
let t = "";
|
|
324
|
+
return e.color && (t += `color:${e.color};`), e.fontWeight != null && (t += `font-weight:${e.fontWeight};`), t;
|
|
325
|
+
}
|
|
326
|
+
function h(e) {
|
|
327
|
+
return Number.isInteger(e) ? e.toLocaleString() : e.toLocaleString(void 0, { maximumFractionDigits: 2 });
|
|
328
|
+
}
|
|
329
|
+
function g(e, t) {
|
|
330
|
+
return `${e}:${t}`;
|
|
331
|
+
}
|
|
332
|
+
function _(e) {
|
|
333
|
+
if (!e) return "";
|
|
334
|
+
if (typeof e == "string") return e;
|
|
335
|
+
if (Array.isArray(e)) return e.filter(Boolean).join(" ");
|
|
336
|
+
if (typeof e == "object") {
|
|
337
|
+
let t = [];
|
|
338
|
+
for (let [n, r] of Object.entries(e)) r && t.push(n);
|
|
339
|
+
return t.join(" ");
|
|
340
|
+
}
|
|
341
|
+
return "";
|
|
342
|
+
}
|
|
343
|
+
function v(e) {
|
|
344
|
+
if (e == null || e === "") return "";
|
|
345
|
+
if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}$/.test(e)) return e;
|
|
346
|
+
let t = e instanceof Date ? e : new Date(e);
|
|
347
|
+
return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
|
|
348
|
+
}
|
|
349
|
+
function y(e) {
|
|
350
|
+
if (e == null || e === "") return "";
|
|
351
|
+
if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(e)) return e;
|
|
352
|
+
let t = e instanceof Date ? e : new Date(e);
|
|
353
|
+
return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 16);
|
|
354
|
+
}
|
|
355
|
+
function b(e) {
|
|
356
|
+
return String(e).replace(/-native$/, "");
|
|
357
|
+
}
|
|
358
|
+
function x(e) {
|
|
359
|
+
if (e instanceof Date) return e;
|
|
360
|
+
if (typeof e == "string") {
|
|
361
|
+
let t = e.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?/);
|
|
362
|
+
if (t) {
|
|
363
|
+
let e = /* @__PURE__ */ new Date();
|
|
364
|
+
return e.setHours(Math.min(23, +t[1]), Math.min(59, +t[2]), t[3] ? +t[3] : 0, 0), e;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
function S(e) {
|
|
370
|
+
return e ? `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}` : null;
|
|
371
|
+
}
|
|
372
|
+
function C(e, t) {
|
|
373
|
+
let n = b(e);
|
|
374
|
+
return n === "date" ? v(t) : n === "datetime" ? y(t) : String(t ?? "");
|
|
375
|
+
}
|
|
376
|
+
function w(e) {
|
|
377
|
+
let t = b(e);
|
|
378
|
+
return t === "number" ? "number" : t === "date" ? "date" : t === "datetime" ? "datetime-local" : t === "time" ? "time" : t === "password" ? "password" : t === "color" ? "color" : "text";
|
|
379
|
+
}
|
|
380
|
+
function T(e) {
|
|
381
|
+
return e == null || e === "" ? [] : Array.isArray(e) ? e.filter((e) => e != null && e !== "") : [e];
|
|
382
|
+
}
|
|
383
|
+
function E(e, t) {
|
|
384
|
+
let n = e.find((e) => e.value === t || String(e.value) === String(t));
|
|
385
|
+
return n ? n.label : String(t ?? "");
|
|
386
|
+
}
|
|
387
|
+
function D(e, t) {
|
|
388
|
+
return e.find((e) => e.value === t || String(e.value) === String(t))?.color;
|
|
389
|
+
}
|
|
390
|
+
function O(e) {
|
|
391
|
+
return e ? `background: color-mix(in srgb, ${e} 22%, transparent);border-color: color-mix(in srgb, ${e} 45%, transparent);color: color-mix(in srgb, ${e} 80%, var(--sg-fg, #0f172a));` : "";
|
|
392
|
+
}
|
|
393
|
+
function k(e) {
|
|
394
|
+
let t = b(e);
|
|
395
|
+
return t === "number" ? "sv-grid-cell-editor sv-grid-cell-editor-number" : t === "date" ? "sv-grid-cell-editor sv-grid-cell-editor-date" : t === "datetime" ? "sv-grid-cell-editor sv-grid-cell-editor-datetime" : t === "color" ? "sv-grid-cell-editor sv-grid-cell-editor-color" : "sv-grid-cell-editor";
|
|
396
|
+
}
|
|
397
|
+
function A(e) {
|
|
398
|
+
if (e == null || e === "") return null;
|
|
399
|
+
let t = e instanceof Date ? e : new Date(e);
|
|
400
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
401
|
+
}
|
|
402
|
+
function j(e, t) {
|
|
403
|
+
return Math.max(8, Math.min(e, window.innerWidth - t - 8));
|
|
404
|
+
}
|
|
405
|
+
function M(e) {
|
|
406
|
+
return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/"/g, "\\\"");
|
|
407
|
+
}
|
|
408
|
+
function N(e, t) {
|
|
409
|
+
if (e == null || e === "") return NaN;
|
|
410
|
+
if (t) {
|
|
411
|
+
let t = (e instanceof Date ? e : new Date(String(e))).getTime();
|
|
412
|
+
return Number.isFinite(t) ? t : NaN;
|
|
413
|
+
}
|
|
414
|
+
let n = typeof e == "number" ? e : Number(e);
|
|
415
|
+
return Number.isFinite(n) ? n : NaN;
|
|
416
|
+
}
|
|
417
|
+
function P(e) {
|
|
418
|
+
let t = Math.abs(e), n = t >= 1e3 ? 0 : t >= 100 ? 1 : t >= 1 ? 2 : 4;
|
|
419
|
+
return e.toLocaleString(void 0, { maximumFractionDigits: n });
|
|
420
|
+
}
|
|
421
|
+
function F(e) {
|
|
422
|
+
return new Date(e).toLocaleDateString(void 0, {
|
|
423
|
+
year: "numeric",
|
|
424
|
+
month: "short",
|
|
425
|
+
day: "numeric"
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region ../grid/dist/filtering/excel-filters.js
|
|
430
|
+
var I = /[̀-ͯ]/g;
|
|
431
|
+
function L(e, t) {
|
|
432
|
+
if (!e) return "";
|
|
433
|
+
let n = e.normalize("NFD").replace(I, "");
|
|
434
|
+
return t ? n.toLocaleLowerCase(t) : n.toLowerCase();
|
|
435
|
+
}
|
|
436
|
+
function R(e) {
|
|
437
|
+
return String(e ?? "").split(/[\n,]/).map((e) => e.trim()).filter((e) => e.length > 0);
|
|
438
|
+
}
|
|
439
|
+
function z(e) {
|
|
440
|
+
return e.map((e) => e.trim()).filter((e) => e.length > 0).join("\n");
|
|
441
|
+
}
|
|
442
|
+
function B(e, t, n) {
|
|
443
|
+
let r = String(e ?? ""), i = L(r, n?.locale), a = L(String(t.value ?? ""), n?.locale);
|
|
444
|
+
switch (t.operator) {
|
|
445
|
+
case "contains": return i.includes(a);
|
|
446
|
+
case "notContains": return a === "" || !i.includes(a);
|
|
447
|
+
case "equals": return i === a;
|
|
448
|
+
case "notEquals": return a === "" || i !== a;
|
|
449
|
+
case "startsWith": return i.startsWith(a);
|
|
450
|
+
case "endsWith": return i.endsWith(a);
|
|
451
|
+
case "regex": {
|
|
452
|
+
let e = String(t.value ?? "");
|
|
453
|
+
if (!e) return !0;
|
|
454
|
+
try {
|
|
455
|
+
return new RegExp(e, "i").test(r);
|
|
456
|
+
} catch {
|
|
457
|
+
return !1;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
case "in":
|
|
461
|
+
case "notIn": {
|
|
462
|
+
let e = R(t.value);
|
|
463
|
+
if (e.length === 0) return !0;
|
|
464
|
+
let r = e.some((e) => L(e, n?.locale) === i);
|
|
465
|
+
return t.operator === "in" ? r : !r;
|
|
466
|
+
}
|
|
467
|
+
case "greaterThan": {
|
|
468
|
+
let n = Number(e), r = Number(t.value);
|
|
469
|
+
return Number.isFinite(n) && Number.isFinite(r) ? n > r : String(e ?? "") > String(t.value ?? "");
|
|
470
|
+
}
|
|
471
|
+
case "lessThan": {
|
|
472
|
+
let n = Number(e), r = Number(t.value);
|
|
473
|
+
return Number.isFinite(n) && Number.isFinite(r) ? n < r : String(e ?? "") < String(t.value ?? "");
|
|
474
|
+
}
|
|
475
|
+
case "between": {
|
|
476
|
+
let n = t.value == null ? 0 : Number(t.value), r = t.valueTo == null ? 0 : Number(t.valueTo), i = Number(e ?? 0);
|
|
477
|
+
if (Number.isFinite(i) && Number.isFinite(n) && Number.isFinite(r)) return i >= n && i <= r;
|
|
478
|
+
let a = String(e ?? ""), o = String(t.value ?? ""), s = String(t.valueTo ?? "");
|
|
479
|
+
return a >= o && a <= s;
|
|
480
|
+
}
|
|
481
|
+
case "isBlank": return r.trim().length === 0;
|
|
482
|
+
case "isNotBlank": return r.trim().length > 0;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region ../grid/dist/keyboard.js
|
|
487
|
+
function V(e) {
|
|
488
|
+
return e.ctrlKey && e.key === "Home" ? "gridStart" : e.ctrlKey && e.key === "End" ? "gridEnd" : e.key === "ArrowLeft" ? "moveLeft" : e.key === "ArrowRight" ? "moveRight" : e.key === "ArrowUp" ? "moveUp" : e.key === "ArrowDown" ? "moveDown" : e.key === "Home" ? "rowStart" : e.key === "End" ? "rowEnd" : e.key === "PageUp" ? "pageUp" : e.key === "PageDown" ? "pageDown" : e.key === "Enter" ? e.shiftKey ? "moveUp" : "moveDown" : e.key === "Tab" ? e.shiftKey ? "tabPrev" : "tabNext" : e.key === "F2" || e.key === " " ? "activate" : e.key === "Delete" ? "clearCells" : "noop";
|
|
489
|
+
}
|
|
490
|
+
function H(e, t, n) {
|
|
491
|
+
let r = n.pageSize ?? 10, i = e.rowIndex, a = e.colIndex;
|
|
492
|
+
return t === "moveLeft" && --a, t === "moveRight" && (a += 1), t === "moveUp" && --i, t === "moveDown" && (i += 1), t === "tabNext" && (a += 1, a > n.maxCol && (a = 0, i += 1)), t === "tabPrev" && (--a, a < 0 && (a = n.maxCol, --i)), t === "rowStart" && (a = 0), t === "rowEnd" && (a = n.maxCol), t === "gridStart" && (i = 0, a = 0), t === "gridEnd" && (i = n.maxRow, a = n.maxCol), t === "pageUp" && (i -= r), t === "pageDown" && (i += r), i = Math.min(Math.max(i, 0), Math.max(n.maxRow, 0)), a = Math.min(Math.max(a, 0), Math.max(n.maxCol, 0)), {
|
|
493
|
+
rowIndex: i,
|
|
494
|
+
colIndex: a,
|
|
495
|
+
cellId: e.cellId
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region ../grid/dist/fill-patterns.js
|
|
500
|
+
var U = [
|
|
501
|
+
[
|
|
502
|
+
"Sunday",
|
|
503
|
+
"Monday",
|
|
504
|
+
"Tuesday",
|
|
505
|
+
"Wednesday",
|
|
506
|
+
"Thursday",
|
|
507
|
+
"Friday",
|
|
508
|
+
"Saturday"
|
|
509
|
+
],
|
|
510
|
+
[
|
|
511
|
+
"Sun",
|
|
512
|
+
"Mon",
|
|
513
|
+
"Tue",
|
|
514
|
+
"Wed",
|
|
515
|
+
"Thu",
|
|
516
|
+
"Fri",
|
|
517
|
+
"Sat"
|
|
518
|
+
],
|
|
519
|
+
[
|
|
520
|
+
"January",
|
|
521
|
+
"February",
|
|
522
|
+
"March",
|
|
523
|
+
"April",
|
|
524
|
+
"May",
|
|
525
|
+
"June",
|
|
526
|
+
"July",
|
|
527
|
+
"August",
|
|
528
|
+
"September",
|
|
529
|
+
"October",
|
|
530
|
+
"November",
|
|
531
|
+
"December"
|
|
532
|
+
],
|
|
533
|
+
[
|
|
534
|
+
"Jan",
|
|
535
|
+
"Feb",
|
|
536
|
+
"Mar",
|
|
537
|
+
"Apr",
|
|
538
|
+
"May",
|
|
539
|
+
"Jun",
|
|
540
|
+
"Jul",
|
|
541
|
+
"Aug",
|
|
542
|
+
"Sep",
|
|
543
|
+
"Oct",
|
|
544
|
+
"Nov",
|
|
545
|
+
"Dec"
|
|
546
|
+
],
|
|
547
|
+
[
|
|
548
|
+
"Q1",
|
|
549
|
+
"Q2",
|
|
550
|
+
"Q3",
|
|
551
|
+
"Q4"
|
|
552
|
+
]
|
|
553
|
+
];
|
|
554
|
+
function W(e, t) {
|
|
555
|
+
if (!t) return e;
|
|
556
|
+
if (t === t.toUpperCase() && t !== t.toLowerCase()) return e.toUpperCase();
|
|
557
|
+
if (t === t.toLowerCase() && t !== t.toUpperCase()) return e.toLowerCase();
|
|
558
|
+
let n = t[0];
|
|
559
|
+
return n && n === n.toUpperCase() && t.slice(1) === t.slice(1).toLowerCase() ? e[0].toUpperCase() + e.slice(1).toLowerCase() : e;
|
|
560
|
+
}
|
|
561
|
+
function G(e) {
|
|
562
|
+
let t = e.map((e) => e.toLowerCase());
|
|
563
|
+
outer: for (let e of U) {
|
|
564
|
+
let n = e.map((e) => e.toLowerCase()), r = [];
|
|
565
|
+
for (let e of t) {
|
|
566
|
+
let t = n.indexOf(e);
|
|
567
|
+
if (t < 0) continue outer;
|
|
568
|
+
r.push(t);
|
|
569
|
+
}
|
|
570
|
+
return {
|
|
571
|
+
sequence: e,
|
|
572
|
+
indices: r
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
return null;
|
|
576
|
+
}
|
|
577
|
+
function K(e, t, n, r) {
|
|
578
|
+
let i = e.sequence.length, a = e.indices[e.indices.length - 1], o = t[t.length - 1], s = [];
|
|
579
|
+
for (let t = 0; t < r; t += 1) {
|
|
580
|
+
let r = ((a + n * (t + 1)) % i + i) % i;
|
|
581
|
+
s.push(W(e.sequence[r], o));
|
|
582
|
+
}
|
|
583
|
+
return s;
|
|
584
|
+
}
|
|
585
|
+
function q(e) {
|
|
586
|
+
let t = [], n = /^(.*?)(\d+)(.*)$/;
|
|
587
|
+
for (let r of e) {
|
|
588
|
+
let e = r.match(n);
|
|
589
|
+
if (!e) return null;
|
|
590
|
+
t.push({
|
|
591
|
+
prefix: e[1] ?? "",
|
|
592
|
+
numStr: e[2] ?? "",
|
|
593
|
+
suffix: e[3] ?? ""
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
let r = t[0].prefix, i = t[0].suffix;
|
|
597
|
+
for (let e of t) if (e.prefix !== r || e.suffix !== i) return null;
|
|
598
|
+
let a = t[0].numStr, o = a.length, s = a.length > 1 && a[0] === "0" && a !== "0" ? "0" : "";
|
|
599
|
+
return {
|
|
600
|
+
prefix: r,
|
|
601
|
+
suffix: i,
|
|
602
|
+
numbers: t.map((e) => Number(e.numStr)),
|
|
603
|
+
numberFormat: {
|
|
604
|
+
width: o,
|
|
605
|
+
padChar: s
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
function J(e, t) {
|
|
610
|
+
let n = String(e);
|
|
611
|
+
return !t.padChar || n.length >= t.width ? n : n.padStart(t.width, t.padChar);
|
|
612
|
+
}
|
|
613
|
+
function Y(e) {
|
|
614
|
+
if (e.length < 2) return null;
|
|
615
|
+
let t = e[1] - e[0];
|
|
616
|
+
for (let n = 2; n < e.length; n += 1) if (e[n] - e[n - 1] !== t) return null;
|
|
617
|
+
return t;
|
|
618
|
+
}
|
|
619
|
+
function X(e, t) {
|
|
620
|
+
if (e.length === 0 || t <= 0) return [];
|
|
621
|
+
let n = e.map((e) => Number(e));
|
|
622
|
+
if (e.every((e) => e !== null && e !== "" && e !== void 0) && n.every((e) => Number.isFinite(e)) && e.length >= 2) {
|
|
623
|
+
let e = Y(n);
|
|
624
|
+
if (e !== null) {
|
|
625
|
+
let r = n[n.length - 1];
|
|
626
|
+
return Array.from({ length: t }, (t, n) => r + e * (n + 1));
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
let r = e.every((e) => typeof e == "string");
|
|
630
|
+
if (r && e.length >= 1) {
|
|
631
|
+
let n = e, r = G(n);
|
|
632
|
+
if (r) return K(r, n, n.length >= 2 ? Y(r.indices) ?? 1 : 1, t);
|
|
633
|
+
}
|
|
634
|
+
if (r && e.length >= 1) {
|
|
635
|
+
let n = q(e);
|
|
636
|
+
if (n) {
|
|
637
|
+
let e = n.numbers.length >= 2 ? Y(n.numbers) ?? 1 : 1, r = n.numbers[n.numbers.length - 1];
|
|
638
|
+
return Array.from({ length: t }, (t, i) => {
|
|
639
|
+
let a = r + e * (i + 1);
|
|
640
|
+
return n.prefix + J(a, n.numberFormat) + n.suffix;
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return Array.from({ length: t }, (t, n) => Z(e[n % e.length]));
|
|
645
|
+
}
|
|
646
|
+
function Z(e) {
|
|
647
|
+
return Array.isArray(e) ? e.slice() : e && typeof e == "object" && e.constructor === Object ? { ...e } : e;
|
|
648
|
+
}
|
|
649
|
+
//#endregion
|
|
650
|
+
export { l as A, N as C, f as D, T as E, d as O, E as S, x as T, g as _, z as a, w as b, A as c, O as d, M as f, P as g, F as h, B as i, c as k, m as l, h as m, V as n, L as o, S as p, H as r, R as s, X as t, j as u, C as v, _ as w, D as x, k as y };
|