intrasheets 6.0.1 → 6.0.2
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.js +1 -1
- package/dist/index.mjs +369 -363
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -77,11 +77,11 @@ const Ua = {
|
|
|
77
77
|
}, d = function(c) {
|
|
78
78
|
let h = [], y = "", T = !1;
|
|
79
79
|
const u = function() {
|
|
80
|
-
let
|
|
81
|
-
|
|
80
|
+
let D = y.trim();
|
|
81
|
+
D && h.push(D), y = "";
|
|
82
82
|
};
|
|
83
|
-
for (let
|
|
84
|
-
let B = c[
|
|
83
|
+
for (let D = 0; D < c.length; D++) {
|
|
84
|
+
let B = c[D];
|
|
85
85
|
B === "'" && (T = !T), !T && B === "," ? u() : y += B;
|
|
86
86
|
}
|
|
87
87
|
return u(), h;
|
|
@@ -94,16 +94,16 @@ const Ua = {
|
|
|
94
94
|
let T = "", u = y[0].indexOf("!");
|
|
95
95
|
if (u !== -1 && (T = y[0].substring(0, u + 1), c.getWorksheetInstanceByName(y[0].substring(0, u).replace(/'/g, "")) !== c))
|
|
96
96
|
return null;
|
|
97
|
-
let
|
|
97
|
+
let D = [];
|
|
98
98
|
for (let B = 0; B < y.length; B++) {
|
|
99
99
|
let H = c.getCoordsFromRange(y[B]);
|
|
100
100
|
if (isNaN(H[0]) || isNaN(H[1]) || isNaN(H[2]) || isNaN(H[3]))
|
|
101
101
|
return null;
|
|
102
|
-
|
|
102
|
+
D.push([Math.min(H[0], H[2]), Math.min(H[1], H[3]), Math.max(H[0], H[2]), Math.max(H[1], H[3])]);
|
|
103
103
|
}
|
|
104
104
|
return {
|
|
105
105
|
prefix: T,
|
|
106
|
-
rects:
|
|
106
|
+
rects: D
|
|
107
107
|
};
|
|
108
108
|
}, g = function(c) {
|
|
109
109
|
let h = c[0][0], y = c[0][1];
|
|
@@ -116,8 +116,8 @@ const Ua = {
|
|
|
116
116
|
let y = [], T = c.config.validations;
|
|
117
117
|
if (T)
|
|
118
118
|
for (let u = 0; u < T.length; u++) {
|
|
119
|
-
let
|
|
120
|
-
|
|
119
|
+
let D = T[u];
|
|
120
|
+
D && Object.keys(D).length && (D.action === "format" || D.action === "dataBar" || D.action === "colorScale") && y.push({ index: u, rule: D });
|
|
121
121
|
}
|
|
122
122
|
return y;
|
|
123
123
|
}, h.setRule = function(y, T) {
|
|
@@ -126,8 +126,8 @@ const Ua = {
|
|
|
126
126
|
let B = h.getRules().find((H) => H.rule.action === T.action && String(H.rule.range).toUpperCase() === String(T.range).toUpperCase());
|
|
127
127
|
B && (u = B.index);
|
|
128
128
|
}
|
|
129
|
-
let
|
|
130
|
-
return typeof u < "u" && (
|
|
129
|
+
let D = { value: l(T) };
|
|
130
|
+
return typeof u < "u" && (D.index = u), y.setValidations([D]);
|
|
131
131
|
}, h.removeRule = function(y, T) {
|
|
132
132
|
return y.resetValidations([T]);
|
|
133
133
|
}, h.clearRules = function(y) {
|
|
@@ -138,8 +138,8 @@ const Ua = {
|
|
|
138
138
|
if (!Array.isArray(T) || !T.length)
|
|
139
139
|
return !1;
|
|
140
140
|
let u = [];
|
|
141
|
-
return h.getRules().forEach(function(
|
|
142
|
-
let B =
|
|
141
|
+
return h.getRules().forEach(function(D) {
|
|
142
|
+
let B = D.rule, H = i(y, B.range);
|
|
143
143
|
if (!H)
|
|
144
144
|
return;
|
|
145
145
|
let I = H.rects.slice();
|
|
@@ -153,7 +153,7 @@ const Ua = {
|
|
|
153
153
|
}))
|
|
154
154
|
return;
|
|
155
155
|
if (!I.length) {
|
|
156
|
-
u.push({ index:
|
|
156
|
+
u.push({ index: D.index, value: null });
|
|
157
157
|
return;
|
|
158
158
|
}
|
|
159
159
|
let P = B.type === "formula" && Array.isArray(B.value) && typeof B.value[0] == "string";
|
|
@@ -165,7 +165,7 @@ const Ua = {
|
|
|
165
165
|
let G = g(H.rects), M = g(I), K = M[0] - G[0], W = M[1] - G[1];
|
|
166
166
|
(K || W) && (j.value[0] = s().shiftFormula(j.value[0], K, W));
|
|
167
167
|
}
|
|
168
|
-
u.push({ index:
|
|
168
|
+
u.push({ index: D.index, value: j });
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
171
|
I.forEach(function(j, G) {
|
|
@@ -174,7 +174,7 @@ const Ua = {
|
|
|
174
174
|
let K = j[0] - H.rects[0][0], W = j[1] - H.rects[0][1];
|
|
175
175
|
(K || W) && (M.value[0] = s().shiftFormula(M.value[0], K, W));
|
|
176
176
|
}
|
|
177
|
-
u.push(G === 0 ? { index:
|
|
177
|
+
u.push(G === 0 ? { index: D.index, value: M } : { value: M });
|
|
178
178
|
});
|
|
179
179
|
}), u.length ? (y.setValidations(u), !0) : !1;
|
|
180
180
|
}, h.presets = t, h.criteria = n, h.dataBars = r, h.colorScales = a, h;
|
|
@@ -251,8 +251,8 @@ if (!Ga && typeof it == "function")
|
|
|
251
251
|
let y = document.createElement("select"), T = document.createElement("option");
|
|
252
252
|
T.innerText = t("(Do not import)"), T.value = "", y.appendChild(T);
|
|
253
253
|
for (let u = 0; u < i.worksheet.options.columns.length; u++) {
|
|
254
|
-
let
|
|
255
|
-
|
|
254
|
+
let D = i.worksheet.options.columns[u].title || "";
|
|
255
|
+
D.trim() || (D = i.worksheet.helpers.getColumnName(u)), T = document.createElement("option"), T.value = u, T.innerText = D, y.appendChild(T), T.innerText.match(new RegExp(p[f], "gi")) && T.setAttribute("selected", "selected");
|
|
256
256
|
}
|
|
257
257
|
h.appendChild(y), c.appendChild(h), i.tbody.appendChild(c);
|
|
258
258
|
}
|
|
@@ -351,13 +351,13 @@ if (!Ye && typeof it == "function")
|
|
|
351
351
|
if (t(y) || y.indexOf("!") !== -1)
|
|
352
352
|
r(h, y);
|
|
353
353
|
else {
|
|
354
|
-
let T = p.config.definedNames || {}, u = Object.keys(T).find((
|
|
354
|
+
let T = p.config.definedNames || {}, u = Object.keys(T).find((D) => D.toUpperCase() === y);
|
|
355
355
|
if (u) {
|
|
356
|
-
let
|
|
357
|
-
r(h,
|
|
356
|
+
let D = typeof T[u] == "string" ? T[u] : T[u].value;
|
|
357
|
+
r(h, D);
|
|
358
358
|
} else if (n(y)) {
|
|
359
|
-
let
|
|
360
|
-
|
|
359
|
+
let D = h.getRange();
|
|
360
|
+
D && h.setDefinedNames([{ index: y, value: D }]);
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
f.blur();
|
|
@@ -372,7 +372,7 @@ if (!Ye && typeof it == "function")
|
|
|
372
372
|
h.contains(B.target) || y();
|
|
373
373
|
}, u = function(B) {
|
|
374
374
|
B.key === "Escape" && y();
|
|
375
|
-
},
|
|
375
|
+
}, D = function() {
|
|
376
376
|
let B = p.config.definedNames || {}, H = Object.keys(B).sort();
|
|
377
377
|
if (h.innerHTML = "", !H.length) {
|
|
378
378
|
let I = a("div", "xl-namebox-item xl-disabled", "No defined names");
|
|
@@ -390,7 +390,7 @@ if (!Ye && typeof it == "function")
|
|
|
390
390
|
c.addEventListener("mousedown", function(B) {
|
|
391
391
|
B.target.closest && B.target.closest(".jss_bar_cursor") && (B.preventDefault(), B.stopPropagation());
|
|
392
392
|
}, !0), c.addEventListener("click", function(B) {
|
|
393
|
-
B.target.closest && B.target.closest(".jss_bar_cursor") && (B.preventDefault(), B.stopPropagation(), h.hidden ?
|
|
393
|
+
B.target.closest && B.target.closest(".jss_bar_cursor") && (B.preventDefault(), B.stopPropagation(), h.hidden ? D() : y());
|
|
394
394
|
}, !0);
|
|
395
395
|
}, d = function(p, f) {
|
|
396
396
|
let c = f.querySelector(".jss_bar");
|
|
@@ -403,13 +403,13 @@ if (!Ye && typeof it == "function")
|
|
|
403
403
|
T.title = "Cancel";
|
|
404
404
|
let u = a("div", "xl-fx-btn xl-disabled", l("check"));
|
|
405
405
|
u.title = "Enter", h.title = "Insert Function", c.insertBefore(a("div", "xl-fbar-sep"), h), c.insertBefore(a("span", "material-symbols-outlined xl-icon xl-fbar-dots", "more_vert"), h), c.insertBefore(T, h), c.insertBefore(u, h), c.insertBefore(a("div", "xl-fbar-sep"), y);
|
|
406
|
-
let
|
|
406
|
+
let D = function(B) {
|
|
407
407
|
T.classList.toggle("xl-disabled", !B), u.classList.toggle("xl-disabled", !B);
|
|
408
408
|
};
|
|
409
409
|
y.addEventListener("focus", function() {
|
|
410
|
-
|
|
410
|
+
D(!0);
|
|
411
411
|
}), y.addEventListener("blur", function() {
|
|
412
|
-
|
|
412
|
+
D(!1);
|
|
413
413
|
}), T.addEventListener("mousedown", function(B) {
|
|
414
414
|
B.preventDefault(), T.classList.contains("xl-disabled") || s(y, "Escape", 27);
|
|
415
415
|
}), u.addEventListener("mousedown", function(B) {
|
|
@@ -2456,14 +2456,14 @@ const pt = function(e) {
|
|
|
2456
2456
|
return u = "" + u, u.length === 1 && (u = "0" + u), u;
|
|
2457
2457
|
}, s = function(u) {
|
|
2458
2458
|
typeof u == "string" && (u = /* @__PURE__ */ new Date(u + " GMT+0"));
|
|
2459
|
-
let
|
|
2460
|
-
return
|
|
2459
|
+
let D = u.getTime();
|
|
2460
|
+
return D >= r && (D += a), D -= n, D / a;
|
|
2461
2461
|
}, m = function(u) {
|
|
2462
2462
|
if (u == null || u === "")
|
|
2463
2463
|
return "";
|
|
2464
|
-
let
|
|
2464
|
+
let D = u - Math.floor(u), B = Math.round(D * 86400), H = Math.floor(B / 3600), I = Math.floor(B % 3600 / 60), P = B % 60;
|
|
2465
2465
|
return l(H) + ":" + l(I) + ":" + l(P);
|
|
2466
|
-
}, b = function(u,
|
|
2466
|
+
}, b = function(u, D, B) {
|
|
2467
2467
|
let H = document.createElement("div");
|
|
2468
2468
|
H.className = "jdv-overlay";
|
|
2469
2469
|
let I = document.createElement("div");
|
|
@@ -2482,7 +2482,7 @@ const pt = function(e) {
|
|
|
2482
2482
|
K.className = "jdv-dialog-footer";
|
|
2483
2483
|
let W = document.createElement("button");
|
|
2484
2484
|
if (W.type = "button", W.className = "jdv-btn jdv-btn-primary", W.textContent = t("OK"), W.onclick = function() {
|
|
2485
|
-
P(),
|
|
2485
|
+
P(), D && D();
|
|
2486
2486
|
}, K.appendChild(W), B) {
|
|
2487
2487
|
let ne = document.createElement("button");
|
|
2488
2488
|
ne.type = "button", ne.className = "jdv-btn", ne.textContent = t("Cancel"), ne.onclick = P, K.appendChild(ne);
|
|
@@ -2490,8 +2490,8 @@ const pt = function(e) {
|
|
|
2490
2490
|
I.appendChild(G), I.appendChild(M), I.appendChild(K), H.appendChild(I), document.body.appendChild(H), W.focus();
|
|
2491
2491
|
}, d = function(u) {
|
|
2492
2492
|
b(u);
|
|
2493
|
-
}, i = function(u,
|
|
2494
|
-
b(u,
|
|
2493
|
+
}, i = function(u, D) {
|
|
2494
|
+
b(u, D, !0);
|
|
2495
2495
|
}, g = [
|
|
2496
2496
|
{ value: "between", text: t("between") },
|
|
2497
2497
|
{ value: "not between", text: t("not between") },
|
|
@@ -2524,7 +2524,7 @@ const pt = function(e) {
|
|
|
2524
2524
|
{ value: "textLength", text: t("Text length") },
|
|
2525
2525
|
{ value: "custom", text: t("Custom") }
|
|
2526
2526
|
], u.criterias = g;
|
|
2527
|
-
const
|
|
2527
|
+
const D = function(I) {
|
|
2528
2528
|
let P = [], j = "", G = !1;
|
|
2529
2529
|
const M = function() {
|
|
2530
2530
|
let K = j.trim();
|
|
@@ -2537,7 +2537,7 @@ const pt = function(e) {
|
|
|
2537
2537
|
return M(), P;
|
|
2538
2538
|
}, B = function(I, P) {
|
|
2539
2539
|
let j = e.helpers.verifyWorksheetName(P);
|
|
2540
|
-
return
|
|
2540
|
+
return D(I).map(function(G) {
|
|
2541
2541
|
return G.indexOf("!") === -1 ? j + "!" + G : G;
|
|
2542
2542
|
}).join(",");
|
|
2543
2543
|
}, H = function() {
|
|
@@ -2805,12 +2805,12 @@ const pt = function(e) {
|
|
|
2805
2805
|
</div>
|
|
2806
2806
|
</div>`;
|
|
2807
2807
|
}, y = function(u) {
|
|
2808
|
-
let
|
|
2808
|
+
let D = {};
|
|
2809
2809
|
gt.set("dataValidations:close", function() {
|
|
2810
|
-
|
|
2811
|
-
}),
|
|
2812
|
-
|
|
2813
|
-
},
|
|
2810
|
+
D.modal && D.modal.close();
|
|
2811
|
+
}), D.closed = function() {
|
|
2812
|
+
D.form && D.form.cancelPicker();
|
|
2813
|
+
}, D.open = function(I) {
|
|
2814
2814
|
let P = I.getHighlighted && I.getHighlighted();
|
|
2815
2815
|
if (!P || !P.length) {
|
|
2816
2816
|
let v = I.getSelection && I.getSelection();
|
|
@@ -2820,9 +2820,9 @@ const pt = function(e) {
|
|
|
2820
2820
|
}
|
|
2821
2821
|
let j = I.parent.config.validations || [], G = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), K = 0;
|
|
2822
2822
|
for (let v = 0; v < P.length; v++) {
|
|
2823
|
-
let
|
|
2824
|
-
for (let x =
|
|
2825
|
-
for (let R =
|
|
2823
|
+
let w = P[v];
|
|
2824
|
+
for (let x = w[1]; x <= w[3]; x++)
|
|
2825
|
+
for (let R = w[0]; R <= w[2]; R++) {
|
|
2826
2826
|
K++;
|
|
2827
2827
|
let _ = I.loadValidations(R, x);
|
|
2828
2828
|
if (_)
|
|
@@ -2836,12 +2836,12 @@ const pt = function(e) {
|
|
|
2836
2836
|
}
|
|
2837
2837
|
}
|
|
2838
2838
|
let W = Array.from(G), ne = ma() || I.getRange();
|
|
2839
|
-
const ge = function(v,
|
|
2840
|
-
|
|
2839
|
+
const ge = function(v, w, x, R) {
|
|
2840
|
+
D.form.instance = I, D.form.load(v, w, x, R), D.modal.open();
|
|
2841
2841
|
};
|
|
2842
2842
|
if (W.length === 1) {
|
|
2843
|
-
let v = W[0][0],
|
|
2844
|
-
x && c(
|
|
2843
|
+
let v = W[0][0], w = W[0][1], x = M.get(v) === K;
|
|
2844
|
+
x && c(w) ? ge(v, w, w.range, []) : x ? i(t("The existing validation cannot be edited here. Do you want to replace it with a new one?"), function() {
|
|
2845
2845
|
ge(null, null, ne, [v]);
|
|
2846
2846
|
}) : i(t("The current validation applies to only part of the selection. Do you want to replace it with a new validation for the whole selection?"), function() {
|
|
2847
2847
|
ge(null, null, ne, [v]);
|
|
@@ -2858,14 +2858,14 @@ const pt = function(e) {
|
|
|
2858
2858
|
<Form :ref="self.form" />
|
|
2859
2859
|
</div>
|
|
2860
2860
|
</lm-modal>`;
|
|
2861
|
-
return gt.element(I,
|
|
2861
|
+
return gt.element(I, D, { Form: h });
|
|
2862
2862
|
};
|
|
2863
2863
|
let H = document.createElement("div");
|
|
2864
|
-
return u.tools.append(H), gt.render(B, H),
|
|
2864
|
+
return u.tools.append(H), gt.render(B, H), D;
|
|
2865
2865
|
}, T = function() {
|
|
2866
2866
|
return !0;
|
|
2867
2867
|
};
|
|
2868
|
-
return T.oninit = function(u,
|
|
2868
|
+
return T.oninit = function(u, D) {
|
|
2869
2869
|
u.setPlugins({
|
|
2870
2870
|
dataValidations: y
|
|
2871
2871
|
});
|
|
@@ -3049,37 +3049,37 @@ const Cr = function(e, t) {
|
|
|
3049
3049
|
{ value: "uniquedup", text: t("Format only unique or duplicate values") },
|
|
3050
3050
|
{ value: "formula", text: t("Use a formula to determine which cells to format") }
|
|
3051
3051
|
], d = function(v) {
|
|
3052
|
-
let
|
|
3052
|
+
let w = [], x = "", R = !1;
|
|
3053
3053
|
const _ = function() {
|
|
3054
3054
|
let L = x.trim();
|
|
3055
|
-
L &&
|
|
3055
|
+
L && w.push(L), x = "";
|
|
3056
3056
|
};
|
|
3057
3057
|
for (let L = 0; L < v.length; L++) {
|
|
3058
3058
|
let A = v[L];
|
|
3059
3059
|
A === "'" && (R = !R), !R && A === "," ? _() : x += A;
|
|
3060
3060
|
}
|
|
3061
|
-
return _(),
|
|
3062
|
-
}, i = function(v,
|
|
3063
|
-
let x = e.helpers.verifyWorksheetName(
|
|
3061
|
+
return _(), w;
|
|
3062
|
+
}, i = function(v, w) {
|
|
3063
|
+
let x = e.helpers.verifyWorksheetName(w);
|
|
3064
3064
|
return d(v).map(function(R) {
|
|
3065
3065
|
return R.indexOf("!") === -1 ? x + "!" + R : R;
|
|
3066
3066
|
}).join(",");
|
|
3067
3067
|
}, g = function(v) {
|
|
3068
3068
|
if (!v || typeof e.helpers.getCoordsFromRange != "function")
|
|
3069
3069
|
return null;
|
|
3070
|
-
let
|
|
3070
|
+
let w = null, x = null, R = d(v);
|
|
3071
3071
|
for (let _ = 0; _ < R.length; _++) {
|
|
3072
3072
|
let L = e.helpers.getCoordsFromRange(R[_].toUpperCase());
|
|
3073
3073
|
if (!L || L.length < 4 || L.some((J) => typeof J != "number" || isNaN(J)))
|
|
3074
3074
|
return null;
|
|
3075
3075
|
let A = Math.min(L[0], L[2]), V = Math.min(L[1], L[3]);
|
|
3076
|
-
(
|
|
3076
|
+
(w === null || A < w) && (w = A), (x === null || V < x) && (x = V);
|
|
3077
3077
|
}
|
|
3078
|
-
return
|
|
3079
|
-
}, p = function(v,
|
|
3078
|
+
return w === null ? null : [w, x];
|
|
3079
|
+
}, p = function(v, w, x) {
|
|
3080
3080
|
if (typeof v != "string" || v.charAt(0) !== "=" || typeof e.helpers.shiftFormula != "function")
|
|
3081
3081
|
return v;
|
|
3082
|
-
let R = g(
|
|
3082
|
+
let R = g(w), _ = g(x);
|
|
3083
3083
|
if (!R || !_)
|
|
3084
3084
|
return v;
|
|
3085
3085
|
let L = _[0] - R[0], A = _[1] - R[1];
|
|
@@ -3089,46 +3089,46 @@ const Cr = function(e, t) {
|
|
|
3089
3089
|
return t("Data Bar");
|
|
3090
3090
|
if (v.action === "colorScale")
|
|
3091
3091
|
return t("Graded Color Scale");
|
|
3092
|
-
let
|
|
3093
|
-
return v.type === "number" ? t("Cell Value") + " " + (v.criteria || "") + " " +
|
|
3094
|
-
}, c = function(v,
|
|
3092
|
+
let w = Array.isArray(v.value) ? v.value : [];
|
|
3093
|
+
return v.type === "number" ? t("Cell Value") + " " + (v.criteria || "") + " " + w.join(" " + t("and") + " ") : v.type === "text" ? t("Cell Value") + " " + (v.criteria || "") + ' "' + (w[0] || "") + '"' : v.type === "empty" ? t("Blanks") : v.type === "notEmpty" ? t("No Blanks") : v.type === "top" || v.type === "bottom" ? (v.type === "top" ? t("Top") : t("Bottom")) + " " + (w[0] || 10) + (v.criteria === "percent" ? "%" : "") : v.type === "aboveAverage" ? t(v.criteria === "equal" ? "Equal to or Above Average" : "Above Average") : v.type === "belowAverage" ? t(v.criteria === "equal" ? "Equal to or Below Average" : "Below Average") : v.type === "duplicate" ? t("Duplicate Values") : v.type === "unique" ? t("Unique Values") : v.type === "formula" ? t("Formula") + ": " + (w[0] || "") : v.type || "";
|
|
3094
|
+
}, c = function(v, w, x) {
|
|
3095
3095
|
let R = o("select", "xl-input jcf-select");
|
|
3096
3096
|
return v.forEach(function(_) {
|
|
3097
3097
|
let L = o("option", null, _.text);
|
|
3098
3098
|
L.value = _.value, R.appendChild(L);
|
|
3099
|
-
}), R.value = typeof
|
|
3099
|
+
}), R.value = typeof w > "u" || w === null ? "" : w, R.onchange = function() {
|
|
3100
3100
|
x(R.value);
|
|
3101
3101
|
}, R;
|
|
3102
|
-
}, h = function(v,
|
|
3102
|
+
}, h = function(v, w) {
|
|
3103
3103
|
let x = o("input", "xl-input");
|
|
3104
3104
|
return x.type = "number", x.value = typeof v > "u" || v === null ? "" : v, x.onchange = function() {
|
|
3105
|
-
|
|
3105
|
+
w(x.value);
|
|
3106
3106
|
}, x;
|
|
3107
|
-
}, y = function(v,
|
|
3107
|
+
}, y = function(v, w) {
|
|
3108
3108
|
let x = o("input", "xl-input");
|
|
3109
3109
|
return x.type = "text", x.value = v || "", x.onchange = function() {
|
|
3110
|
-
|
|
3110
|
+
w(x.value);
|
|
3111
3111
|
}, x;
|
|
3112
|
-
}, T = function(v,
|
|
3113
|
-
let x = jn(v,
|
|
3112
|
+
}, T = function(v, w) {
|
|
3113
|
+
let x = jn(v, w);
|
|
3114
3114
|
return x.classList.add("jcf-color"), x;
|
|
3115
|
-
}, u = function(v,
|
|
3116
|
-
return jn(v, x, { noColor:
|
|
3117
|
-
},
|
|
3115
|
+
}, u = function(v, w, x) {
|
|
3116
|
+
return jn(v, x, { noColor: w });
|
|
3117
|
+
}, D = function(v, w, x) {
|
|
3118
3118
|
let R = o("input");
|
|
3119
|
-
return R.type = "checkbox", R.checked = !!
|
|
3119
|
+
return R.type = "checkbox", R.checked = !!w, R.onchange = function() {
|
|
3120
3120
|
x(R.checked);
|
|
3121
3121
|
}, o("label", "xl-check", [R, o("span", null, v)]);
|
|
3122
|
-
}, B = function(v,
|
|
3122
|
+
}, B = function(v, w, x, R, _) {
|
|
3123
3123
|
let L = o("input");
|
|
3124
3124
|
return L.type = "radio", L.name = v, L.value = x, L.checked = R === x, L.onchange = function() {
|
|
3125
3125
|
L.checked && _(x);
|
|
3126
|
-
}, o("label", "xl-check", [L, o("span", null,
|
|
3126
|
+
}, o("label", "xl-check", [L, o("span", null, w)]);
|
|
3127
3127
|
}, H = function(v) {
|
|
3128
3128
|
return o("div", "jcf-grid-head", v);
|
|
3129
3129
|
}, I = function(v) {
|
|
3130
3130
|
return o("div", "jcf-grid-label", v);
|
|
3131
|
-
}, P = function(v,
|
|
3131
|
+
}, P = function(v, w) {
|
|
3132
3132
|
let x = Object.assign({}, v), R = o("div", null), _;
|
|
3133
3133
|
const L = function() {
|
|
3134
3134
|
let F = _.style;
|
|
@@ -3151,10 +3151,10 @@ const Cr = function(e, t) {
|
|
|
3151
3151
|
u(x.background, t("No Fill"), A("background"))
|
|
3152
3152
|
]);
|
|
3153
3153
|
V.appendChild(J), V.appendChild(o("div", "jcf-check-row", [
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3154
|
+
D(t("Bold"), x.bold, A("bold")),
|
|
3155
|
+
D(t("Italic"), x.italic, A("italic")),
|
|
3156
|
+
D(t("Underline"), x.underline, A("underline")),
|
|
3157
|
+
D(t("Strikethrough"), x.strike, A("strike"))
|
|
3158
3158
|
])), R.appendChild(V);
|
|
3159
3159
|
let ee = o("fieldset", "jcf-fieldset");
|
|
3160
3160
|
ee.appendChild(o("legend", null, t("Border")));
|
|
@@ -3171,10 +3171,10 @@ const Cr = function(e, t) {
|
|
|
3171
3171
|
te
|
|
3172
3172
|
]));
|
|
3173
3173
|
let ae = o("div", "jcf-check-row", [
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3174
|
+
D(t("Top"), x.borderTop, A("borderTop")),
|
|
3175
|
+
D(t("Right"), x.borderRight, A("borderRight")),
|
|
3176
|
+
D(t("Bottom"), x.borderBottom, A("borderBottom")),
|
|
3177
|
+
D(t("Left"), x.borderLeft, A("borderLeft"))
|
|
3178
3178
|
]);
|
|
3179
3179
|
ee.appendChild(ae), R.appendChild(ee), _ = o("div", "jcf-sample", t("AaBbCc")), R.appendChild(o("label", "xl-label", t("Preview") + ":")), R.appendChild(_);
|
|
3180
3180
|
const N = function() {
|
|
@@ -3187,11 +3187,11 @@ const Cr = function(e, t) {
|
|
|
3187
3187
|
};
|
|
3188
3188
|
L(), N(), xt(de(t("Format Cells"), R, [
|
|
3189
3189
|
{ label: t("OK"), primary: !0, onclick: function() {
|
|
3190
|
-
|
|
3190
|
+
w(x);
|
|
3191
3191
|
} },
|
|
3192
3192
|
{ label: t("Cancel") }
|
|
3193
3193
|
]));
|
|
3194
|
-
}, j = function(v,
|
|
3194
|
+
}, j = function(v, w) {
|
|
3195
3195
|
let x = Object.assign({}, v), R = o("div", null);
|
|
3196
3196
|
const _ = function(ae) {
|
|
3197
3197
|
return function(N) {
|
|
@@ -3226,15 +3226,15 @@ const Cr = function(e, t) {
|
|
|
3226
3226
|
};
|
|
3227
3227
|
te(), xt(de(t("Negative Value and Axis Settings"), R, [
|
|
3228
3228
|
{ label: t("OK"), primary: !0, onclick: function() {
|
|
3229
|
-
|
|
3229
|
+
w(x);
|
|
3230
3230
|
} },
|
|
3231
3231
|
{ label: t("Cancel") }
|
|
3232
3232
|
]));
|
|
3233
|
-
}, G = function(v,
|
|
3233
|
+
}, G = function(v, w, x) {
|
|
3234
3234
|
let R = {
|
|
3235
3235
|
// A config index, or the provisional key the manager gives a
|
|
3236
3236
|
// rule it has not written yet
|
|
3237
|
-
index:
|
|
3237
|
+
index: w !== null && typeof w < "u" ? w : null,
|
|
3238
3238
|
range: v || "",
|
|
3239
3239
|
stopIfTrue: !1,
|
|
3240
3240
|
ruleType: "scale",
|
|
@@ -3322,18 +3322,18 @@ const Cr = function(e, t) {
|
|
|
3322
3322
|
}
|
|
3323
3323
|
}
|
|
3324
3324
|
return R;
|
|
3325
|
-
}, M = function(v,
|
|
3326
|
-
let x = v[
|
|
3325
|
+
}, M = function(v, w) {
|
|
3326
|
+
let x = v[w + "Type"];
|
|
3327
3327
|
if (!x)
|
|
3328
3328
|
return null;
|
|
3329
3329
|
if (x === "extent")
|
|
3330
3330
|
return { type: "extent" };
|
|
3331
|
-
let R = parseFloat(v[
|
|
3331
|
+
let R = parseFloat(v[w + "Value"]);
|
|
3332
3332
|
return isNaN(R) ? !1 : { type: x, value: R };
|
|
3333
|
-
}, K = function(v,
|
|
3333
|
+
}, K = function(v, w) {
|
|
3334
3334
|
if (!v.range)
|
|
3335
3335
|
return n(t("The range is mandatory")), null;
|
|
3336
|
-
let x = { range: i(v.range,
|
|
3336
|
+
let x = { range: i(v.range, w) };
|
|
3337
3337
|
if (v.ruleType === "scale") {
|
|
3338
3338
|
x.type = "notEmpty";
|
|
3339
3339
|
let A = {}, V = v.scaleStyle === "dataBar" ? [["min", "dbMin"], ["max", "dbMax"]] : v.scaleStyle === "3" ? [["min", "csMin"], ["mid", "csMid"], ["max", "csMax"]] : [["min", "csMin"], ["max", "csMax"]];
|
|
@@ -3394,8 +3394,8 @@ const Cr = function(e, t) {
|
|
|
3394
3394
|
});
|
|
3395
3395
|
}
|
|
3396
3396
|
return x.format = _, v.stopIfTrue && (x.stopIfTrue = !0), x;
|
|
3397
|
-
}, W = function(v,
|
|
3398
|
-
let A = G(ma() || v.getRange(),
|
|
3397
|
+
}, W = function(v, w, x, R, _, L) {
|
|
3398
|
+
let A = G(ma() || v.getRange(), w, x);
|
|
3399
3399
|
_ && Object.assign(A, _);
|
|
3400
3400
|
let V = o("div", null), J = {}, ee = {}, X = {}, te = null;
|
|
3401
3401
|
const ae = function(re) {
|
|
@@ -3421,19 +3421,19 @@ const Cr = function(e, t) {
|
|
|
3421
3421
|
], A.scaleStyle, ae("scaleStyle"))));
|
|
3422
3422
|
let $ = o("div", "jcf-grid jcf-grid-points");
|
|
3423
3423
|
ee.scaleGrid = $;
|
|
3424
|
-
let
|
|
3424
|
+
let C = [];
|
|
3425
3425
|
const E = function(re, ue) {
|
|
3426
3426
|
$.appendChild(I(re)), ue.forEach(function(Me) {
|
|
3427
3427
|
$.appendChild(Me);
|
|
3428
3428
|
});
|
|
3429
3429
|
};
|
|
3430
|
-
let
|
|
3431
|
-
|
|
3430
|
+
let O = H(t("MidPoint"));
|
|
3431
|
+
C.push(O), E("", [H(t("Minimum")), O, H(t("Maximum"))]);
|
|
3432
3432
|
const U = function(re, ue) {
|
|
3433
3433
|
return c([{ value: "", text: ue }].concat(l), A[re + "Type"], ae(re + "Type"));
|
|
3434
3434
|
};
|
|
3435
3435
|
let q = o("div", null, c(l, A.csMidType, ae("csMidType")));
|
|
3436
|
-
|
|
3436
|
+
C.push(q), E(t("Type") + ":", [
|
|
3437
3437
|
o("div", null, U("csMin", t("Lowest Value"))),
|
|
3438
3438
|
q,
|
|
3439
3439
|
o("div", null, U("csMax", t("Highest Value")))
|
|
@@ -3443,19 +3443,19 @@ const Cr = function(e, t) {
|
|
|
3443
3443
|
return Me.setAttribute("data-value-of", re), ue && Me.setAttribute("data-placeholder", ue), Me;
|
|
3444
3444
|
};
|
|
3445
3445
|
let oe = z("csMin", "(" + t("Lowest Value") + ")"), ce = z("csMid"), Ae = z("csMax", "(" + t("Highest Value") + ")"), Ee = o("div", null, ce);
|
|
3446
|
-
|
|
3446
|
+
C.push(Ee), E(t("Value") + ":", [
|
|
3447
3447
|
o("div", null, oe),
|
|
3448
3448
|
Ee,
|
|
3449
3449
|
o("div", null, Ae)
|
|
3450
3450
|
]);
|
|
3451
3451
|
let Ne = o("div", null, T(A.midColor, ae("midColor")));
|
|
3452
|
-
|
|
3452
|
+
C.push(Ne), E(t("Color") + ":", [
|
|
3453
3453
|
o("div", null, T(A.minColor, ae("minColor"))),
|
|
3454
3454
|
Ne,
|
|
3455
3455
|
o("div", null, T(A.maxColor, ae("maxColor")))
|
|
3456
3456
|
]), X.scale = o("div", "jcf-scale-sample"), E(t("Preview"), [o("div", "jcf-grid-span", X.scale)]), Y.appendChild($);
|
|
3457
3457
|
let be = o("div", null);
|
|
3458
|
-
ee.bar = be, be.appendChild(
|
|
3458
|
+
ee.bar = be, be.appendChild(D(t("Show Bar Only"), A.barOnly, ae("barOnly")));
|
|
3459
3459
|
let ve = o("div", "jcf-grid jcf-grid-bar");
|
|
3460
3460
|
ve.appendChild(I("")), ve.appendChild(H(t("Minimum"))), ve.appendChild(H(t("Maximum"))), ve.appendChild(I(t("Type") + ":"));
|
|
3461
3461
|
const we = function(re, ue) {
|
|
@@ -3523,7 +3523,7 @@ const Cr = function(e, t) {
|
|
|
3523
3523
|
J.rank = It, It.appendChild(o("div", "jcf-caption", t("Format values ranked in the") + ":")), It.appendChild(o("div", "jcf-sentence", [
|
|
3524
3524
|
c([{ value: "top", text: t("Top") }, { value: "bottom", text: t("Bottom") }], A.rankType, ae("rankType")),
|
|
3525
3525
|
h(A.rankValue, ae("rankValue")),
|
|
3526
|
-
|
|
3526
|
+
D(t("% of the selected range"), A.rankPercent, ae("rankPercent"))
|
|
3527
3527
|
])), F.appendChild(It);
|
|
3528
3528
|
let Ot = o("div", null);
|
|
3529
3529
|
J.average = Ot, Ot.appendChild(o("label", "xl-label", t("Format values that are") + ":")), Ot.appendChild(o("div", "jcf-style-row", c([
|
|
@@ -3576,7 +3576,7 @@ const Cr = function(e, t) {
|
|
|
3576
3576
|
ee[Se] && (ee[Se].style.display = Me[Se] ? "" : "none");
|
|
3577
3577
|
});
|
|
3578
3578
|
let yt = A.scaleStyle === "3";
|
|
3579
|
-
$.setAttribute("data-mid", yt),
|
|
3579
|
+
$.setAttribute("data-mid", yt), C.forEach(function(Se) {
|
|
3580
3580
|
Se.style.display = yt ? "" : "none";
|
|
3581
3581
|
}), [
|
|
3582
3582
|
["csMin", oe],
|
|
@@ -3603,7 +3603,7 @@ const Cr = function(e, t) {
|
|
|
3603
3603
|
});
|
|
3604
3604
|
};
|
|
3605
3605
|
ft();
|
|
3606
|
-
let Fa = xt(de(t(
|
|
3606
|
+
let Fa = xt(de(t(w === null ? "New Formatting Rule" : "Edit Formatting Rule"), V, [
|
|
3607
3607
|
{ label: t("OK"), primary: !0, onclick: function() {
|
|
3608
3608
|
te && (A.formulaExpr = te.textContent);
|
|
3609
3609
|
let re = K(A, v.getWorksheetName());
|
|
@@ -3623,13 +3623,13 @@ const Cr = function(e, t) {
|
|
|
3623
3623
|
]));
|
|
3624
3624
|
return St(Fa);
|
|
3625
3625
|
}, ne = function(v) {
|
|
3626
|
-
const
|
|
3627
|
-
|
|
3626
|
+
const w = {};
|
|
3627
|
+
w.scope = "selection";
|
|
3628
3628
|
const x = function(E) {
|
|
3629
|
-
let
|
|
3630
|
-
return
|
|
3631
|
-
}, R = function(E,
|
|
3632
|
-
let U = Math.min(
|
|
3629
|
+
let O = E ? E.indexOf("!") : -1;
|
|
3630
|
+
return O === -1 ? null : w.instance.getWorksheetInstanceByName(E.substring(0, O)) || !1;
|
|
3631
|
+
}, R = function(E, O) {
|
|
3632
|
+
let U = Math.min(O[0], O[2]), q = Math.max(O[0], O[2]), z = Math.min(O[1], O[3]), oe = Math.max(O[1], O[3]);
|
|
3633
3633
|
const ce = function(Ae, Ee) {
|
|
3634
3634
|
return typeof Ae == "number" && !isNaN(Ae) ? Ae : Ee;
|
|
3635
3635
|
};
|
|
@@ -3641,68 +3641,68 @@ const Cr = function(e, t) {
|
|
|
3641
3641
|
return Math.min(Ne, ve) <= q && Math.max(Ne, ve) >= U && Math.min(be, we) <= oe && Math.max(be, we) >= z;
|
|
3642
3642
|
});
|
|
3643
3643
|
}, _ = function() {
|
|
3644
|
-
let E =
|
|
3645
|
-
if (
|
|
3644
|
+
let E = w.instance, O = null;
|
|
3645
|
+
if (w.scope === "selection" && (O = E.getSelection && E.getSelection(), !O || !O.length))
|
|
3646
3646
|
return [];
|
|
3647
3647
|
let U = [];
|
|
3648
3648
|
return A().forEach(function(q) {
|
|
3649
|
-
let z =
|
|
3650
|
-
r(z) && (
|
|
3649
|
+
let z = w.draft.get(q);
|
|
3650
|
+
r(z) && (O && !R(z.range, O) || U.push({ index: q, rule: z }));
|
|
3651
3651
|
}), U;
|
|
3652
3652
|
}, L = function(E) {
|
|
3653
3653
|
return typeof E == "string";
|
|
3654
3654
|
}, A = function() {
|
|
3655
|
-
let E =
|
|
3656
|
-
const
|
|
3655
|
+
let E = w.draft ? Array.from(w.draft.keys()) : [];
|
|
3656
|
+
const O = function(U) {
|
|
3657
3657
|
return L(U) ? Number.MAX_SAFE_INTEGER / 2 + parseInt(U.substring(1)) : U;
|
|
3658
3658
|
};
|
|
3659
3659
|
return E.sort(function(U, q) {
|
|
3660
|
-
return
|
|
3660
|
+
return O(U) - O(q);
|
|
3661
3661
|
});
|
|
3662
|
-
}, V = function(E,
|
|
3663
|
-
if (
|
|
3664
|
-
let U =
|
|
3662
|
+
}, V = function(E, O) {
|
|
3663
|
+
if (O.action === "dataBar") {
|
|
3664
|
+
let U = O.format && O.format.color || a.barColor;
|
|
3665
3665
|
E.style.backgroundImage = "linear-gradient(to right, " + U + " 60%, transparent 60%)";
|
|
3666
|
-
} else if (
|
|
3667
|
-
let U =
|
|
3666
|
+
} else if (O.action === "colorScale") {
|
|
3667
|
+
let U = O.format && O.format.colors || ["#F8696B", "#FFEB84", "#63BE7B"];
|
|
3668
3668
|
E.style.background = "linear-gradient(to right, " + U.join(", ") + ")";
|
|
3669
|
-
} else if (
|
|
3670
|
-
let U =
|
|
3669
|
+
} else if (O.format) {
|
|
3670
|
+
let U = O.format;
|
|
3671
3671
|
E.style.color = U.color || "", E.style.backgroundColor = U["background-color"] || "", E.style.fontWeight = U["font-weight"] || "", E.style.fontStyle = U["font-style"] || "", E.style.textDecoration = U["text-decoration"] || "", E.style.border = U.border || "";
|
|
3672
3672
|
}
|
|
3673
|
-
}, J = function(E,
|
|
3674
|
-
let q = E[
|
|
3673
|
+
}, J = function(E, O, U) {
|
|
3674
|
+
let q = E[O + U];
|
|
3675
3675
|
if (!q)
|
|
3676
3676
|
return;
|
|
3677
|
-
let z =
|
|
3678
|
-
z.set(E[
|
|
3677
|
+
let z = w.draft, oe = z.get(E[O].index);
|
|
3678
|
+
z.set(E[O].index, z.get(q.index)), z.set(q.index, oe), X();
|
|
3679
3679
|
}, ee = function() {
|
|
3680
|
-
|
|
3680
|
+
w.listed = _().map(function(E) {
|
|
3681
3681
|
return E.index;
|
|
3682
3682
|
});
|
|
3683
3683
|
}, X = function() {
|
|
3684
|
-
|
|
3684
|
+
w.list && te(w.list);
|
|
3685
3685
|
}, te = function(E) {
|
|
3686
3686
|
E.innerHTML = "";
|
|
3687
|
-
let
|
|
3687
|
+
let O = [], U = w.listed || [];
|
|
3688
3688
|
A().forEach(function(q) {
|
|
3689
|
-
let z =
|
|
3690
|
-
U.indexOf(q) !== -1 && r(z) &&
|
|
3691
|
-
}),
|
|
3689
|
+
let z = w.draft.get(q);
|
|
3690
|
+
U.indexOf(q) !== -1 && r(z) && O.push({ index: q, rule: z });
|
|
3691
|
+
}), O.forEach(function(q, z) {
|
|
3692
3692
|
let oe = q.rule, ce = o("div", "jcf-rule-row"), Ae = o("div", "jcf-rule-desc", f(oe));
|
|
3693
3693
|
Ae.title = t("Edit the rule"), Ae.onclick = function() {
|
|
3694
|
-
|
|
3694
|
+
w.editRule(q.index, oe);
|
|
3695
3695
|
}, ce.appendChild(Ae);
|
|
3696
3696
|
let Ee = o("div", "jcf-preview", t("AaBbCc"));
|
|
3697
3697
|
V(Ee, oe), ce.appendChild(Ee);
|
|
3698
3698
|
const Ne = function(ye) {
|
|
3699
|
-
let Ce =
|
|
3699
|
+
let Ce = w.draft && w.draft.get(q.index);
|
|
3700
3700
|
if (Ce) {
|
|
3701
3701
|
if (ye = (ye || "").trim(), !ye) {
|
|
3702
3702
|
be.textContent = Ce.range || "";
|
|
3703
3703
|
return;
|
|
3704
3704
|
}
|
|
3705
|
-
if (ye = i(ye,
|
|
3705
|
+
if (ye = i(ye, w.instance.getWorksheetName()), ye === Ce.range) {
|
|
3706
3706
|
be.textContent = ye;
|
|
3707
3707
|
return;
|
|
3708
3708
|
}
|
|
@@ -3711,7 +3711,7 @@ const Cr = function(e, t) {
|
|
|
3711
3711
|
};
|
|
3712
3712
|
let be = pt({
|
|
3713
3713
|
element: o("div", "xl-input jcf-rule-range"),
|
|
3714
|
-
instance:
|
|
3714
|
+
instance: w.instance,
|
|
3715
3715
|
initial: oe.range || "",
|
|
3716
3716
|
worksheetName: !0,
|
|
3717
3717
|
multiple: !0,
|
|
@@ -3732,62 +3732,62 @@ const Cr = function(e, t) {
|
|
|
3732
3732
|
return st.title = Ce, st.onclick = Le, st;
|
|
3733
3733
|
};
|
|
3734
3734
|
we.appendChild(Fe("arrow_upward", t("Move up"), function() {
|
|
3735
|
-
J(
|
|
3735
|
+
J(O, z, -1);
|
|
3736
3736
|
})), we.appendChild(Fe("arrow_downward", t("Move down"), function() {
|
|
3737
|
-
J(
|
|
3737
|
+
J(O, z, 1);
|
|
3738
3738
|
})), we.appendChild(Fe("delete", t("Delete rule"), function() {
|
|
3739
|
-
|
|
3739
|
+
w.draft.set(q.index, null), X();
|
|
3740
3740
|
})), ce.appendChild(we), E.appendChild(ce);
|
|
3741
|
-
}),
|
|
3741
|
+
}), O.length || E.appendChild(o("div", "jcf-empty", w.scope === "worksheet" ? t("No rules on this worksheet") : t("No rules found for this selection")));
|
|
3742
3742
|
}, ae = function(E) {
|
|
3743
3743
|
if (!E || typeof E != "object" || !Object.keys(E).length)
|
|
3744
3744
|
return null;
|
|
3745
|
-
let
|
|
3745
|
+
let O = {};
|
|
3746
3746
|
return Object.keys(E).forEach(function(U) {
|
|
3747
|
-
U !== "record" && (
|
|
3748
|
-
}),
|
|
3747
|
+
U !== "record" && (O[U] = JSON.parse(JSON.stringify(E[U])));
|
|
3748
|
+
}), O;
|
|
3749
3749
|
}, N = function() {
|
|
3750
|
-
let E =
|
|
3750
|
+
let E = w.instance.parent.config.validations || [], O = /* @__PURE__ */ new Map();
|
|
3751
3751
|
for (let U = 0; U < E.length; U++) {
|
|
3752
3752
|
let q = E[U];
|
|
3753
3753
|
if (!r(q))
|
|
3754
3754
|
continue;
|
|
3755
3755
|
let z = x(q.range);
|
|
3756
|
-
z !== null && z !==
|
|
3756
|
+
z !== null && z !== w.instance || O.set(U, ae(q));
|
|
3757
3757
|
}
|
|
3758
|
-
return
|
|
3758
|
+
return O;
|
|
3759
3759
|
}, F = function() {
|
|
3760
|
-
|
|
3760
|
+
w.draft = N(), w.created = 0, w.listed = null;
|
|
3761
3761
|
}, Y = function() {
|
|
3762
|
-
let E =
|
|
3762
|
+
let E = w.draft;
|
|
3763
3763
|
if (!E)
|
|
3764
3764
|
return;
|
|
3765
|
-
let
|
|
3765
|
+
let O = N(), U = [];
|
|
3766
3766
|
A().forEach(function(q) {
|
|
3767
3767
|
let z = E.get(q) || null;
|
|
3768
3768
|
if (L(q))
|
|
3769
3769
|
z && U.push({ value: ae(z) });
|
|
3770
3770
|
else {
|
|
3771
|
-
let oe =
|
|
3771
|
+
let oe = O.get(q) || null;
|
|
3772
3772
|
JSON.stringify(z) !== JSON.stringify(oe) && U.push({ index: q, value: z ? ae(z) : null });
|
|
3773
3773
|
}
|
|
3774
|
-
}), U.length &&
|
|
3774
|
+
}), U.length && w.instance.setValidations(U), w.draft = N(), w.created = 0;
|
|
3775
3775
|
};
|
|
3776
|
-
|
|
3777
|
-
|
|
3776
|
+
w.open = function(E) {
|
|
3777
|
+
w.instance = E, w.window ? C() : w.draft || F(), $(E);
|
|
3778
3778
|
};
|
|
3779
3779
|
const $ = function(E) {
|
|
3780
|
-
|
|
3781
|
-
let
|
|
3780
|
+
w.instance = E;
|
|
3781
|
+
let O = o("div", "jcf"), U = o("div", "jcf-list"), q = o("button", "xl-btn", t("New Rule") + "...");
|
|
3782
3782
|
q.type = "button", q.onclick = function() {
|
|
3783
|
-
|
|
3784
|
-
},
|
|
3783
|
+
w.editRule(null, null);
|
|
3784
|
+
}, O.appendChild(o("div", "jcf-toolbar", [
|
|
3785
3785
|
o("label", "jcf-grid-label", t("Show formatting rules for") + ":"),
|
|
3786
3786
|
c([
|
|
3787
3787
|
{ value: "selection", text: t("Current Selection") },
|
|
3788
3788
|
{ value: "worksheet", text: t("This Worksheet") }
|
|
3789
|
-
],
|
|
3790
|
-
|
|
3789
|
+
], w.scope, function(oe) {
|
|
3790
|
+
w.scope = oe, ee(), te(U);
|
|
3791
3791
|
}),
|
|
3792
3792
|
q
|
|
3793
3793
|
]));
|
|
@@ -3801,7 +3801,7 @@ const Cr = function(e, t) {
|
|
|
3801
3801
|
]),
|
|
3802
3802
|
U
|
|
3803
3803
|
]);
|
|
3804
|
-
return
|
|
3804
|
+
return O.appendChild(z), w.list = U, w.listed || ee(), te(U), w.window = St(de(t("Conditional Formatting Rules Manager"), O, [
|
|
3805
3805
|
{ label: t("OK"), primary: !0, onclick: function() {
|
|
3806
3806
|
Y();
|
|
3807
3807
|
} },
|
|
@@ -3809,33 +3809,33 @@ const Cr = function(e, t) {
|
|
|
3809
3809
|
{ label: t("Apply"), onclick: function() {
|
|
3810
3810
|
return Y(), ee(), X(), !1;
|
|
3811
3811
|
} }
|
|
3812
|
-
])),
|
|
3813
|
-
|
|
3814
|
-
},
|
|
3815
|
-
},
|
|
3816
|
-
let E =
|
|
3817
|
-
E && (
|
|
3818
|
-
|
|
3812
|
+
])), w.window.onclose = function() {
|
|
3813
|
+
w.list = null, w.window = null, w.draft = null;
|
|
3814
|
+
}, w.window;
|
|
3815
|
+
}, C = function() {
|
|
3816
|
+
let E = w.window;
|
|
3817
|
+
E && (w.window = null, E.onclose = function() {
|
|
3818
|
+
w.list = null;
|
|
3819
3819
|
}, E.close());
|
|
3820
3820
|
};
|
|
3821
|
-
return
|
|
3822
|
-
let q =
|
|
3823
|
-
|
|
3821
|
+
return w.editRule = function(E, O, U) {
|
|
3822
|
+
let q = w.instance;
|
|
3823
|
+
C(), W(q, E, O, function() {
|
|
3824
3824
|
$(q);
|
|
3825
3825
|
}, U, function(z, oe) {
|
|
3826
|
-
if (
|
|
3827
|
-
let ce = "+" +
|
|
3828
|
-
|
|
3826
|
+
if (w.draft || (F(), ee()), oe === null || typeof oe > "u") {
|
|
3827
|
+
let ce = "+" + w.created++;
|
|
3828
|
+
w.draft.set(ce, z), w.listed && w.listed.push(ce);
|
|
3829
3829
|
} else
|
|
3830
|
-
|
|
3830
|
+
w.draft.set(oe, z);
|
|
3831
3831
|
});
|
|
3832
|
-
},
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
},
|
|
3836
|
-
},
|
|
3837
|
-
E === "onselection" && (
|
|
3838
|
-
},
|
|
3832
|
+
}, w.newRule = function(E, O) {
|
|
3833
|
+
w.instance = E, W(E, null, null, function() {
|
|
3834
|
+
w.open(E);
|
|
3835
|
+
}, O);
|
|
3836
|
+
}, w.onevent = function(E, O) {
|
|
3837
|
+
E === "onselection" && (w.instance = O);
|
|
3838
|
+
}, w;
|
|
3839
3839
|
}, ge = function() {
|
|
3840
3840
|
return !0;
|
|
3841
3841
|
};
|
|
@@ -3859,8 +3859,8 @@ const Cr = function(e, t) {
|
|
|
3859
3859
|
return "date";
|
|
3860
3860
|
if (y === "checkbox" || y === "radio" || y === "dropdown" || y === "autocomplete" || y === "text" || y === "html" || y === "color" || y === "image" || y === "notes")
|
|
3861
3861
|
return "text";
|
|
3862
|
-
let T = 0, u = 0,
|
|
3863
|
-
for (let B = 0; B <
|
|
3862
|
+
let T = 0, u = 0, D = Math.min(f.rows.length, 50);
|
|
3863
|
+
for (let B = 0; B < D; B++) {
|
|
3864
3864
|
let H = f.getValueFromCoords(c, B);
|
|
3865
3865
|
H === null || typeof H > "u" || H === "" || (typeof H == "number" || typeof H == "string" && H.trim() !== "" && Number.isFinite(Number(H)) ? T++ : u++);
|
|
3866
3866
|
}
|
|
@@ -3873,8 +3873,8 @@ const Cr = function(e, t) {
|
|
|
3873
3873
|
let c = f.cols.length, h = 0, y = c - 1, T = f.getSelection && f.getSelection();
|
|
3874
3874
|
T && T.length && T[0] !== T[2] && (h = Math.max(0, Math.min(T[0], T[2])), y = Math.min(c - 1, Math.max(T[0], T[2])));
|
|
3875
3875
|
let u = [];
|
|
3876
|
-
for (let
|
|
3877
|
-
u.push(
|
|
3876
|
+
for (let D = h; D <= y; D++)
|
|
3877
|
+
u.push(D);
|
|
3878
3878
|
return u;
|
|
3879
3879
|
}, s = function(f, c) {
|
|
3880
3880
|
return c.map(function(h) {
|
|
@@ -3898,10 +3898,10 @@ const Cr = function(e, t) {
|
|
|
3898
3898
|
}, d = function(f, c) {
|
|
3899
3899
|
let h = f.controls && f.controls.sortBy;
|
|
3900
3900
|
if (Array.isArray(h) && h.length) {
|
|
3901
|
-
let u = h.filter(function(
|
|
3902
|
-
return
|
|
3903
|
-
}).map(function(
|
|
3904
|
-
return { column:
|
|
3901
|
+
let u = h.filter(function(D) {
|
|
3902
|
+
return D && c.indexOf(D.column) !== -1;
|
|
3903
|
+
}).map(function(D) {
|
|
3904
|
+
return { column: D.column, direction: D.direction ? 1 : 0 };
|
|
3905
3905
|
});
|
|
3906
3906
|
if (u.length)
|
|
3907
3907
|
return u;
|
|
@@ -3909,32 +3909,32 @@ const Cr = function(e, t) {
|
|
|
3909
3909
|
let y = c[0], T = f.getSelection && f.getSelection();
|
|
3910
3910
|
return T && T.length && c.indexOf(Math.min(T[0], T[2])) !== -1 && (y = Math.min(T[0], T[2])), [{ column: y, direction: 0 }];
|
|
3911
3911
|
}, i = function(f, c) {
|
|
3912
|
-
let h = l(f), y = d(f, h), T = 0, u = s(f, h),
|
|
3912
|
+
let h = l(f), y = d(f, h), T = 0, u = s(f, h), D = [];
|
|
3913
3913
|
const B = function(L) {
|
|
3914
|
-
return
|
|
3914
|
+
return D[L] || (D[L] = r(f, L)), D[L];
|
|
3915
3915
|
};
|
|
3916
3916
|
let H = o("div", "jcs"), I, P, j, G, M, K = o("div", "jcs-toolbar", [
|
|
3917
3917
|
I = b(e("Add Level"), "add", function() {
|
|
3918
3918
|
let L = y.map((V) => V.column), A = h.find((V) => L.indexOf(V) === -1);
|
|
3919
|
-
typeof A > "u" || (y.push({ column: A, direction: 0 }), T = y.length - 1,
|
|
3919
|
+
typeof A > "u" || (y.push({ column: A, direction: 0 }), T = y.length - 1, w());
|
|
3920
3920
|
}),
|
|
3921
3921
|
P = b(e("Delete Level"), "close", function() {
|
|
3922
|
-
y.length > 1 && (y.splice(T, 1), T = Math.min(T, y.length - 1),
|
|
3922
|
+
y.length > 1 && (y.splice(T, 1), T = Math.min(T, y.length - 1), w());
|
|
3923
3923
|
}),
|
|
3924
3924
|
j = b(e("Copy Level"), "content_copy", function() {
|
|
3925
3925
|
let L = y[T];
|
|
3926
|
-
y.splice(T + 1, 0, { column: L.column, direction: L.direction }), T = T + 1,
|
|
3926
|
+
y.splice(T + 1, 0, { column: L.column, direction: L.direction }), T = T + 1, w();
|
|
3927
3927
|
}),
|
|
3928
3928
|
G = b("", "arrow_upward", function() {
|
|
3929
3929
|
if (T > 0) {
|
|
3930
3930
|
let L = y.splice(T, 1)[0];
|
|
3931
|
-
y.splice(T - 1, 0, L), T--,
|
|
3931
|
+
y.splice(T - 1, 0, L), T--, w();
|
|
3932
3932
|
}
|
|
3933
3933
|
}),
|
|
3934
3934
|
M = b("", "arrow_downward", function() {
|
|
3935
3935
|
if (T < y.length - 1) {
|
|
3936
3936
|
let L = y.splice(T, 1)[0];
|
|
3937
|
-
y.splice(T + 1, 0, L), T++,
|
|
3937
|
+
y.splice(T + 1, 0, L), T++, w();
|
|
3938
3938
|
}
|
|
3939
3939
|
})
|
|
3940
3940
|
]);
|
|
@@ -3946,11 +3946,11 @@ const Cr = function(e, t) {
|
|
|
3946
3946
|
H.appendChild(o("div", "jcs-table", [W, ne]));
|
|
3947
3947
|
let ge = f.options.freezeRows ? Math.min(f.options.freezeRows.length, f.rows.length) : 0, v = e(ge === 1 ? "The frozen row stays in place" : "The frozen rows stay in place");
|
|
3948
3948
|
H.appendChild(o("div", "jcs-note", ge ? v : e("Every row of the worksheet is sorted")));
|
|
3949
|
-
const
|
|
3949
|
+
const w = function() {
|
|
3950
3950
|
ne.innerHTML = "", y.forEach(function(L, A) {
|
|
3951
3951
|
let V = o("div", "jcs-level" + (A === T ? " jcs-selected" : ""));
|
|
3952
3952
|
V.appendChild(o("span", "jcs-label", e(A === 0 ? "Sort by" : "Then by"))), V.appendChild(m(u, L.column, function(ee) {
|
|
3953
|
-
L.column = parseInt(ee),
|
|
3953
|
+
L.column = parseInt(ee), w();
|
|
3954
3954
|
}));
|
|
3955
3955
|
let J = a[B(L.column)];
|
|
3956
3956
|
V.appendChild(m([
|
|
@@ -3967,14 +3967,14 @@ const Cr = function(e, t) {
|
|
|
3967
3967
|
}, x = function() {
|
|
3968
3968
|
P.disabled = y.length <= 1, I.disabled = y.length >= h.length, j.disabled = y.length >= h.length, G.disabled = T <= 0, M.disabled = T >= y.length - 1;
|
|
3969
3969
|
};
|
|
3970
|
-
|
|
3970
|
+
w();
|
|
3971
3971
|
let R = de(e("Sort"), H, [
|
|
3972
3972
|
{ label: e("OK"), primary: !0, onclick: function() {
|
|
3973
3973
|
let L = [];
|
|
3974
3974
|
for (let A = 0; A < y.length; A++) {
|
|
3975
3975
|
let V = y[A].column;
|
|
3976
3976
|
if (L[V])
|
|
3977
|
-
return t(e("Column {0} is being sorted by values more than once. Delete the duplicate sort levels and try again.").replace("{0}", Ct(V))), T = A,
|
|
3977
|
+
return t(e("Column {0} is being sorted by values more than once. Delete the duplicate sort levels and try again.").replace("{0}", Ct(V))), T = A, w(), !1;
|
|
3978
3978
|
L[V] = !0;
|
|
3979
3979
|
}
|
|
3980
3980
|
f.orderBy(y.map(function(A) {
|
|
@@ -4020,11 +4020,11 @@ const Cr = function(e, t) {
|
|
|
4020
4020
|
const p = o("input", "xl-input jfr-input");
|
|
4021
4021
|
p.type = "text";
|
|
4022
4022
|
const f = o("select", "xl-input jfr-input jfr-select");
|
|
4023
|
-
[["current", t("Sheet")], ["all", t("Workbook")]].forEach(function(
|
|
4024
|
-
let E = o("option", null,
|
|
4025
|
-
E.value =
|
|
4023
|
+
[["current", t("Sheet")], ["all", t("Workbook")]].forEach(function(C) {
|
|
4024
|
+
let E = o("option", null, C[1]);
|
|
4025
|
+
E.value = C[0], f.appendChild(E);
|
|
4026
4026
|
});
|
|
4027
|
-
const c = l(t("Match case")), h = l(t("Match entire cell contents")), y = l(t("Look in formulas")), T = l(t("Replace cells hidden by a filter"), "jfr-replace-only"), u = o("div", "jfr-message"),
|
|
4027
|
+
const c = l(t("Match case")), h = l(t("Match entire cell contents")), y = l(t("Look in formulas")), T = l(t("Replace cells hidden by a filter"), "jfr-replace-only"), u = o("div", "jfr-message"), D = s(t("Replace All"), "jfr-replace-only", function() {
|
|
4028
4028
|
i.replaceAll();
|
|
4029
4029
|
}), B = s(t("Replace"), "jfr-replace-only", function() {
|
|
4030
4030
|
i.replace();
|
|
@@ -4034,14 +4034,14 @@ const Cr = function(e, t) {
|
|
|
4034
4034
|
i.findNext();
|
|
4035
4035
|
}), P = s(t("Close"), null, function() {
|
|
4036
4036
|
i.close();
|
|
4037
|
-
}), j = function(
|
|
4038
|
-
let
|
|
4039
|
-
return
|
|
4040
|
-
i.setTab(
|
|
4041
|
-
},
|
|
4042
|
-
}, G = j("find", t("Find")), M = j("replace", t("Replace")), K = function(
|
|
4043
|
-
return o("div", "jfr-row" + (
|
|
4044
|
-
o("label", "jfr-label",
|
|
4037
|
+
}), j = function(C, E) {
|
|
4038
|
+
let O = o("div", "jfr-tab", E);
|
|
4039
|
+
return O.setAttribute("data-tab", C), O.onclick = function() {
|
|
4040
|
+
i.setTab(C), g.focus();
|
|
4041
|
+
}, O;
|
|
4042
|
+
}, G = j("find", t("Find")), M = j("replace", t("Replace")), K = function(C, E, O) {
|
|
4043
|
+
return o("div", "jfr-row" + (O ? " " + O : ""), [
|
|
4044
|
+
o("label", "jfr-label", C + ":"),
|
|
4045
4045
|
E
|
|
4046
4046
|
]);
|
|
4047
4047
|
}, W = o("div", "xl-dialog jfr-window jss_object"), ne = o("div", "xl-dialog-header", o("span", null, t("Find and Replace"))), ge = o("span", "xl-dialog-close", "✕");
|
|
@@ -4056,7 +4056,7 @@ const Cr = function(e, t) {
|
|
|
4056
4056
|
o("div", "jfr-checks", [c.element, h.element, y.element, T.element])
|
|
4057
4057
|
]),
|
|
4058
4058
|
u
|
|
4059
|
-
])), W.appendChild(o("div", "xl-dialog-footer", [
|
|
4059
|
+
])), W.appendChild(o("div", "xl-dialog-footer", [D, B, H, I, P])), xt({ element: W }), i.element = W;
|
|
4060
4060
|
const v = function() {
|
|
4061
4061
|
return {
|
|
4062
4062
|
findInput: g.value,
|
|
@@ -4065,81 +4065,81 @@ const Cr = function(e, t) {
|
|
|
4065
4065
|
isInsideFormulas: y.input.checked,
|
|
4066
4066
|
scope: f.value
|
|
4067
4067
|
};
|
|
4068
|
-
},
|
|
4069
|
-
let
|
|
4070
|
-
H.disabled =
|
|
4068
|
+
}, w = function() {
|
|
4069
|
+
let C = !g.value;
|
|
4070
|
+
H.disabled = C, I.disabled = C, D.disabled = C, B.disabled = i.searchIsCurrent() ? i.currentFilter.disabled : !0;
|
|
4071
4071
|
};
|
|
4072
|
-
g.addEventListener("input",
|
|
4073
|
-
|
|
4074
|
-
}), W.addEventListener("keydown", function(
|
|
4075
|
-
|
|
4072
|
+
g.addEventListener("input", w), f.addEventListener("change", w), [c, h, y].forEach(function(C) {
|
|
4073
|
+
C.input.addEventListener("change", w);
|
|
4074
|
+
}), W.addEventListener("keydown", function(C) {
|
|
4075
|
+
C.key === "Enter" && (C.target === g || C.target === p) ? (C.preventDefault(), i.findNext()) : C.key === "Tab" && !C.altKey && !C.ctrlKey && (!C.shiftKey && C.target === P ? (C.preventDefault(), g.focus()) : C.shiftKey && C.target === g && (C.preventDefault(), P.focus()));
|
|
4076
4076
|
});
|
|
4077
|
-
const x = function(
|
|
4078
|
-
|
|
4077
|
+
const x = function(C) {
|
|
4078
|
+
C.key === "Escape" && i.close();
|
|
4079
4079
|
};
|
|
4080
|
-
i.setTab = function(
|
|
4081
|
-
i.tab =
|
|
4080
|
+
i.setTab = function(C) {
|
|
4081
|
+
i.tab = C === "replace" ? "replace" : "find", W.classList.toggle("jfr-mode-replace", i.tab === "replace"), G.classList.toggle("jfr-selected", i.tab === "find"), M.classList.toggle("jfr-selected", i.tab === "replace");
|
|
4082
4082
|
}, i.isOpen = function() {
|
|
4083
4083
|
return W.parentNode === document.body;
|
|
4084
4084
|
};
|
|
4085
4085
|
const R = function() {
|
|
4086
|
-
let
|
|
4087
|
-
return
|
|
4086
|
+
let C = e.current;
|
|
4087
|
+
return C && C.parent === d ? C : i.worksheet;
|
|
4088
4088
|
};
|
|
4089
|
-
i.open = function(
|
|
4090
|
-
i.worksheet =
|
|
4089
|
+
i.open = function(C, E) {
|
|
4090
|
+
i.worksheet = C && C.parent === d ? C : R(), i.setTab(E), i.isOpen() || (document.body.appendChild(W), document.addEventListener("keydown", x), W.style.left = Math.max(0, Math.round((window.innerWidth - W.offsetWidth) / 2)) + "px", W.style.top = Math.max(0, Math.round((window.innerHeight - W.offsetHeight) / 3)) + "px"), w(), g.focus();
|
|
4091
4091
|
}, i.close = function() {
|
|
4092
4092
|
i.isOpen() && (W.remove(), document.removeEventListener("keydown", x));
|
|
4093
4093
|
};
|
|
4094
|
-
const _ = function(
|
|
4095
|
-
return (typeof E > "u" || E === null) && (E = ""), E = E.toString(), i.currentFilter.isCaseSensitive || (E = E.toLowerCase()), i.currentFilter.isMatchAll ? E ===
|
|
4096
|
-
}, L = function(
|
|
4097
|
-
let q = E.getValueFromCoords(U,
|
|
4098
|
-
if (i.currentFilter.isInsideFormulas && n(q) && _(
|
|
4094
|
+
const _ = function(C, E) {
|
|
4095
|
+
return (typeof E > "u" || E === null) && (E = ""), E = E.toString(), i.currentFilter.isCaseSensitive || (E = E.toLowerCase()), i.currentFilter.isMatchAll ? E === C : E.includes(C);
|
|
4096
|
+
}, L = function(C, E, O, U) {
|
|
4097
|
+
let q = E.getValueFromCoords(U, O, !1);
|
|
4098
|
+
if (i.currentFilter.isInsideFormulas && n(q) && _(C, q))
|
|
4099
4099
|
return {
|
|
4100
4100
|
worksheet: E,
|
|
4101
|
-
coords: [
|
|
4101
|
+
coords: [O, U],
|
|
4102
4102
|
insideFormula: !0
|
|
4103
4103
|
};
|
|
4104
|
-
if (!n(q) && _(
|
|
4104
|
+
if (!n(q) && _(C, q))
|
|
4105
4105
|
return {
|
|
4106
4106
|
worksheet: E,
|
|
4107
|
-
coords: [
|
|
4107
|
+
coords: [O, U],
|
|
4108
4108
|
raw: !0
|
|
4109
4109
|
};
|
|
4110
|
-
let z = E.getValueFromCoords(U,
|
|
4111
|
-
return _(
|
|
4110
|
+
let z = E.getValueFromCoords(U, O, !0);
|
|
4111
|
+
return _(C, z) ? {
|
|
4112
4112
|
worksheet: E,
|
|
4113
|
-
coords: [
|
|
4113
|
+
coords: [O, U]
|
|
4114
4114
|
} : null;
|
|
4115
|
-
}, A = function(
|
|
4115
|
+
}, A = function(C, E) {
|
|
4116
4116
|
var U;
|
|
4117
|
-
let
|
|
4118
|
-
if (
|
|
4119
|
-
if (!
|
|
4117
|
+
let O = (U = C.getCellRowObject(E[0])) == null ? void 0 : U[E[1]];
|
|
4118
|
+
if (O) {
|
|
4119
|
+
if (!O.element || !O.element.offsetHeight || O.element.offsetWidth + O.element.offsetLeft > C.content.offsetWidth || O.element.offsetHeight + O.element.offsetTop > C.offsetHeight)
|
|
4120
4120
|
return !1;
|
|
4121
4121
|
} else
|
|
4122
4122
|
return !1;
|
|
4123
4123
|
return !0;
|
|
4124
|
-
}, V = function(
|
|
4125
|
-
|
|
4126
|
-
}, J = function(
|
|
4124
|
+
}, V = function(C, E) {
|
|
4125
|
+
C.openWorksheet(), A(C, E) || (C.options.pagination && C.page(Math.trunc(E[0] / C.options.pagination)), C.goto(E[0], E[1])), C.updateSelectionFromCoords(E[1], E[0], E[1], E[0], !1);
|
|
4126
|
+
}, J = function(C) {
|
|
4127
4127
|
const E = function() {
|
|
4128
4128
|
i.isOpen() && !W.contains(document.activeElement) && g.focus();
|
|
4129
4129
|
};
|
|
4130
|
-
V(
|
|
4131
|
-
}, ee = function(
|
|
4132
|
-
if (i.currentPromise !==
|
|
4130
|
+
V(C.worksheet, C.coords), E(), setTimeout(E, 0);
|
|
4131
|
+
}, ee = function(C, E, O, U) {
|
|
4132
|
+
if (i.currentPromise !== C)
|
|
4133
4133
|
return !1;
|
|
4134
4134
|
if (i.currentMatch) {
|
|
4135
4135
|
const q = E.findIndex((z) => i.currentMatch.worksheet === z.worksheet && i.currentMatch.coords[0] === z.coords[0] && i.currentMatch.coords[1] === z.coords[1]);
|
|
4136
4136
|
q >= 0 && (i.resultPosition += q, i.currentMatch = null);
|
|
4137
4137
|
}
|
|
4138
|
-
return U.noMatchesFound && E.length > 0 && (U.noMatchesFound = !1, typeof
|
|
4139
|
-
}, X = async function(
|
|
4138
|
+
return U.noMatchesFound && E.length > 0 && (U.noMatchesFound = !1, typeof O == "function" && O(E[0])), !0;
|
|
4139
|
+
}, X = async function(C) {
|
|
4140
4140
|
return new Promise((E) => {
|
|
4141
|
-
const
|
|
4142
|
-
i.results =
|
|
4141
|
+
const O = [];
|
|
4142
|
+
i.results = O;
|
|
4143
4143
|
let U = 0, q = 0, z = { noMatchesFound: !0 }, oe = i.currentFilter.findInput;
|
|
4144
4144
|
i.currentFilter.isCaseSensitive || (oe = oe.toLowerCase());
|
|
4145
4145
|
const ce = i.worksheet, Ae = ce.options.data, Ne = ce.records.length, be = (ve) => {
|
|
@@ -4149,27 +4149,27 @@ const Cr = function(e, t) {
|
|
|
4149
4149
|
const ye = Ae[U], Ce = Math.max(((Fe = ce.cols) == null ? void 0 : Fe.length) || 0, ye && ye.length || 0);
|
|
4150
4150
|
for (; q < Ce; ) {
|
|
4151
4151
|
let Le = L(oe, ce, U, q);
|
|
4152
|
-
if (Le &&
|
|
4152
|
+
if (Le && O.push(Le), q++, we + r < +/* @__PURE__ */ new Date())
|
|
4153
4153
|
break;
|
|
4154
4154
|
}
|
|
4155
4155
|
if (we + r < +/* @__PURE__ */ new Date())
|
|
4156
4156
|
break;
|
|
4157
4157
|
q = 0, U++;
|
|
4158
4158
|
}
|
|
4159
|
-
if (!ee(ve,
|
|
4159
|
+
if (!ee(ve, O, C, z))
|
|
4160
4160
|
return E();
|
|
4161
4161
|
if (U < Ne)
|
|
4162
4162
|
return setTimeout(() => {
|
|
4163
4163
|
be(ve);
|
|
4164
4164
|
}, a);
|
|
4165
|
-
E(
|
|
4165
|
+
E(O);
|
|
4166
4166
|
};
|
|
4167
4167
|
i.currentPromise++, be(i.currentPromise);
|
|
4168
4168
|
});
|
|
4169
|
-
}, te = async function(
|
|
4169
|
+
}, te = async function(C) {
|
|
4170
4170
|
return new Promise((E) => {
|
|
4171
|
-
const
|
|
4172
|
-
i.results =
|
|
4171
|
+
const O = [];
|
|
4172
|
+
i.results = O;
|
|
4173
4173
|
let U = 0, q = 0, z = 0, oe = { noMatchesFound: !0 }, ce = i.currentFilter.findInput;
|
|
4174
4174
|
i.currentFilter.isCaseSensitive || (ce = ce.toLowerCase());
|
|
4175
4175
|
const Ae = i.worksheet.parent.worksheets, Ee = (Ne) => {
|
|
@@ -4181,7 +4181,7 @@ const Cr = function(e, t) {
|
|
|
4181
4181
|
const Le = Fe[U], st = Math.max(((ve = we.cols) == null ? void 0 : ve.length) || 0, Le && Le.length || 0);
|
|
4182
4182
|
for (; q < st; ) {
|
|
4183
4183
|
let lt = L(ce, we, U, q);
|
|
4184
|
-
if (lt &&
|
|
4184
|
+
if (lt && O.push(lt), q++, be + r < +/* @__PURE__ */ new Date())
|
|
4185
4185
|
break;
|
|
4186
4186
|
}
|
|
4187
4187
|
if (be + r < +/* @__PURE__ */ new Date())
|
|
@@ -4192,31 +4192,31 @@ const Cr = function(e, t) {
|
|
|
4192
4192
|
break;
|
|
4193
4193
|
U = 0, z++;
|
|
4194
4194
|
}
|
|
4195
|
-
if (!ee(Ne,
|
|
4195
|
+
if (!ee(Ne, O, C, oe))
|
|
4196
4196
|
return E();
|
|
4197
4197
|
if (z < Ae.length)
|
|
4198
4198
|
return setTimeout(() => {
|
|
4199
4199
|
Ee(Ne);
|
|
4200
4200
|
}, a);
|
|
4201
|
-
E(
|
|
4201
|
+
E(O);
|
|
4202
4202
|
};
|
|
4203
4203
|
i.currentPromise++, Ee(i.currentPromise);
|
|
4204
4204
|
});
|
|
4205
4205
|
};
|
|
4206
|
-
i.search = function(
|
|
4206
|
+
i.search = function(C) {
|
|
4207
4207
|
i.worksheet = R(), i.currentFilter = v(), i.currentFilter.worksheet = i.worksheet, i.currentFilter.disabled = !0, i.isFulfilled = !1, u.textContent = "";
|
|
4208
|
-
const E =
|
|
4209
|
-
J(q), i.currentFilter.disabled = !1,
|
|
4210
|
-
},
|
|
4211
|
-
U.result =
|
|
4212
|
-
q && (i.isFulfilled = !0, q.length || (u.textContent = t("We couldn't find what you were looking for.")), U.disabled = !q.length,
|
|
4208
|
+
const E = C ? void 0 : function(q) {
|
|
4209
|
+
J(q), i.currentFilter.disabled = !1, w();
|
|
4210
|
+
}, O = i.currentFilter.scope === "all" ? te : X, U = i.currentFilter;
|
|
4211
|
+
U.result = O(E), U.result.then((q) => {
|
|
4212
|
+
q && (i.isFulfilled = !0, q.length || (u.textContent = t("We couldn't find what you were looking for.")), U.disabled = !q.length, w());
|
|
4213
4213
|
});
|
|
4214
4214
|
}, i.searchIsCurrent = function() {
|
|
4215
|
-
let
|
|
4216
|
-
if (!
|
|
4215
|
+
let C = i.currentFilter;
|
|
4216
|
+
if (!C)
|
|
4217
4217
|
return !1;
|
|
4218
4218
|
let E = v();
|
|
4219
|
-
return
|
|
4219
|
+
return C.findInput === E.findInput && C.isCaseSensitive === E.isCaseSensitive && C.isMatchAll === E.isMatchAll && C.isInsideFormulas === E.isInsideFormulas && C.scope === E.scope && (E.scope === "all" || C.worksheet === R());
|
|
4220
4220
|
};
|
|
4221
4221
|
const ae = function() {
|
|
4222
4222
|
g.value !== "" && (i.resultPosition = 0, i.search(!1));
|
|
@@ -4224,82 +4224,82 @@ const Cr = function(e, t) {
|
|
|
4224
4224
|
if (i.resultPosition === 0 && !i.isFulfilled)
|
|
4225
4225
|
return;
|
|
4226
4226
|
i.resultPosition--, i.resultPosition < 0 && (i.resultPosition += i.results.length);
|
|
4227
|
-
let
|
|
4228
|
-
|
|
4227
|
+
let C = i.results[i.resultPosition];
|
|
4228
|
+
C && J(C);
|
|
4229
4229
|
}, F = function() {
|
|
4230
4230
|
if (i.resultPosition++, i.resultPosition + 1 >= i.results.length && !i.isFulfilled)
|
|
4231
4231
|
return;
|
|
4232
4232
|
i.resultPosition %= i.results.length;
|
|
4233
|
-
let
|
|
4234
|
-
|
|
4233
|
+
let C = i.results[i.resultPosition];
|
|
4234
|
+
C && J(C);
|
|
4235
4235
|
};
|
|
4236
4236
|
i.findNext = function() {
|
|
4237
4237
|
g.focus(), i.searchIsCurrent() ? i.currentFilter.disabled || F() : ae();
|
|
4238
4238
|
}, i.findPrevious = function() {
|
|
4239
4239
|
g.focus(), i.searchIsCurrent() ? i.currentFilter.disabled || N() : ae();
|
|
4240
4240
|
};
|
|
4241
|
-
const Y = function(
|
|
4242
|
-
let
|
|
4243
|
-
|
|
4244
|
-
let U = p.value, q =
|
|
4241
|
+
const Y = function(C, E) {
|
|
4242
|
+
let O = C.worksheet.getValueFromCoords(C.coords[1], C.coords[0], !(C.insideFormula || C.raw));
|
|
4243
|
+
O = O.toString();
|
|
4244
|
+
let U = p.value, q = O;
|
|
4245
4245
|
i.currentFilter.isCaseSensitive || (q = q.toLowerCase());
|
|
4246
4246
|
let z = 0, oe = q.indexOf(E);
|
|
4247
4247
|
for (; oe >= 0; )
|
|
4248
|
-
|
|
4248
|
+
O = O.slice(0, oe + z) + U + O.slice(oe + E.length + z), oe = q.indexOf(
|
|
4249
4249
|
E,
|
|
4250
4250
|
oe + E.length
|
|
4251
4251
|
), z += U.length - E.length;
|
|
4252
|
-
return
|
|
4252
|
+
return O;
|
|
4253
4253
|
}, $ = function() {
|
|
4254
|
-
let
|
|
4255
|
-
return i.currentFilter.isCaseSensitive || (
|
|
4254
|
+
let C = i.currentFilter.findInput;
|
|
4255
|
+
return i.currentFilter.isCaseSensitive || (C = C.toLowerCase()), C;
|
|
4256
4256
|
};
|
|
4257
4257
|
return i.replace = function() {
|
|
4258
4258
|
if (g.focus(), !i.searchIsCurrent() || i.currentFilter.disabled)
|
|
4259
4259
|
return;
|
|
4260
|
-
let
|
|
4261
|
-
if (!
|
|
4260
|
+
let C = i.results[i.resultPosition];
|
|
4261
|
+
if (!C)
|
|
4262
4262
|
return;
|
|
4263
|
-
i.ignore = !0,
|
|
4264
|
-
y:
|
|
4265
|
-
x:
|
|
4266
|
-
value: Y(
|
|
4263
|
+
i.ignore = !0, C.worksheet.setValue([{
|
|
4264
|
+
y: C.coords[0],
|
|
4265
|
+
x: C.coords[1],
|
|
4266
|
+
value: Y(C, $())
|
|
4267
4267
|
}]), i.ignore = !1;
|
|
4268
4268
|
let E = i.resultPosition;
|
|
4269
4269
|
i.results.splice(E, 1), i.resultPosition--, F();
|
|
4270
4270
|
}, i.replaceAll = function() {
|
|
4271
|
-
g.focus(), i.searchIsCurrent() || i.search(!0), i.currentFilter.result.then((
|
|
4272
|
-
if (!
|
|
4271
|
+
g.focus(), i.searchIsCurrent() || i.search(!0), i.currentFilter.result.then((C) => {
|
|
4272
|
+
if (!C || !C.length)
|
|
4273
4273
|
return;
|
|
4274
4274
|
let E = [...new Set(
|
|
4275
|
-
|
|
4276
|
-
)],
|
|
4275
|
+
C.map(({ worksheet: q }) => q)
|
|
4276
|
+
)], O = $();
|
|
4277
4277
|
i.ignore = !0;
|
|
4278
4278
|
let U = 0;
|
|
4279
4279
|
E.forEach((q) => {
|
|
4280
4280
|
const z = q.results || void 0;
|
|
4281
|
-
let oe =
|
|
4281
|
+
let oe = C.filter((ce) => ce.worksheet === q);
|
|
4282
4282
|
!T.input.checked && typeof z < "u" && (oe = oe.filter(
|
|
4283
4283
|
(ce) => z.includes(ce.coords[0])
|
|
4284
4284
|
)), U += oe.length, q.setValue(
|
|
4285
4285
|
oe.map((ce) => ({
|
|
4286
4286
|
y: ce.coords[0],
|
|
4287
4287
|
x: ce.coords[1],
|
|
4288
|
-
value: Y(ce,
|
|
4288
|
+
value: Y(ce, O)
|
|
4289
4289
|
}))
|
|
4290
4290
|
);
|
|
4291
4291
|
}), i.ignore = !1, u.textContent = t("All done. We made {0} replacements.").replace("{0}", U);
|
|
4292
4292
|
}), i.results = [], i.resultPosition = 0;
|
|
4293
|
-
}, i.onevent = function(
|
|
4294
|
-
(
|
|
4295
|
-
}, document.addEventListener("keydown", function(
|
|
4296
|
-
if (!
|
|
4293
|
+
}, i.onevent = function(C) {
|
|
4294
|
+
(C === "onafterchanges" || C === "onredo" || C === "onundo") && (i.ignore || i.results && i.currentFilter && i.currentFilter.findInput && (i.currentMatch = i.results[i.resultPosition], i.resultPosition = 0, i.search(!0)));
|
|
4295
|
+
}, document.addEventListener("keydown", function(C) {
|
|
4296
|
+
if (!C.ctrlKey || C.shiftKey || C.altKey || C.metaKey || C.key !== "h" && C.key !== "H")
|
|
4297
4297
|
return;
|
|
4298
|
-
let E =
|
|
4298
|
+
let E = C.target;
|
|
4299
4299
|
if (E && (E.tagName === "INPUT" || E.tagName === "TEXTAREA" || E.isContentEditable))
|
|
4300
4300
|
return;
|
|
4301
|
-
let
|
|
4302
|
-
!
|
|
4301
|
+
let O = e.current;
|
|
4302
|
+
!O || O.parent !== d || O.edition || (C.preventDefault(), i.open(O, "replace"));
|
|
4303
4303
|
}, !0), i.setTab("find"), i;
|
|
4304
4304
|
}, b = function(d) {
|
|
4305
4305
|
d || e.current && (d = e.current), d && d.parent.plugins && d.parent.plugins.findReplace && d.parent.plugins.findReplace.open(d, "find");
|
|
@@ -4369,11 +4369,11 @@ formify(document.getElementById('formify'), {
|
|
|
4369
4369
|
let y = m(h), T = [], u = h.options.columns || [];
|
|
4370
4370
|
for (let X = 0; X < u.length; X++)
|
|
4371
4371
|
T.push(h.getHeader(X));
|
|
4372
|
-
let
|
|
4372
|
+
let D = T.map(function(X, te) {
|
|
4373
4373
|
return l(X, y.columns.indexOf("" + te) !== -1);
|
|
4374
|
-
}), B = o("div", "xl-check-grid jfm-columns",
|
|
4374
|
+
}), B = o("div", "xl-check-grid jfm-columns", D.map((X) => X.element));
|
|
4375
4375
|
const H = function(X) {
|
|
4376
|
-
|
|
4376
|
+
D.forEach(function(te) {
|
|
4377
4377
|
te.input.checked = X;
|
|
4378
4378
|
}), K();
|
|
4379
4379
|
};
|
|
@@ -4386,12 +4386,12 @@ formify(document.getElementById('formify'), {
|
|
|
4386
4386
|
H(!1);
|
|
4387
4387
|
};
|
|
4388
4388
|
let j = o("span", "jfm-count"), G = o("div", "jfm-columns-actions", [j, I, P]), M = o("fieldset", "xl-fieldset", [o("legend", null, t("Visible columns")), G, B]);
|
|
4389
|
-
|
|
4389
|
+
D.length || B.appendChild(o("div", "xl-note", t("This worksheet has no columns")));
|
|
4390
4390
|
const K = function() {
|
|
4391
|
-
let X =
|
|
4392
|
-
j.textContent = X ? t("{0} of {1} selected").replace("{0}", X).replace("{1}",
|
|
4391
|
+
let X = D.filter((te) => te.input.checked).length;
|
|
4392
|
+
j.textContent = X ? t("{0} of {1} selected").replace("{0}", X).replace("{1}", D.length) : t("No column selected");
|
|
4393
4393
|
};
|
|
4394
|
-
|
|
4394
|
+
D.forEach(function(X) {
|
|
4395
4395
|
X.input.addEventListener("change", K);
|
|
4396
4396
|
}), K();
|
|
4397
4397
|
let W = o("input", "xl-input");
|
|
@@ -4402,16 +4402,16 @@ formify(document.getElementById('formify'), {
|
|
|
4402
4402
|
M,
|
|
4403
4403
|
s(t("Instructions"), W),
|
|
4404
4404
|
s(t("Thank you message"), ne)
|
|
4405
|
-
]), v = o("div", "jfm-panel jfm-preview"),
|
|
4406
|
-
if (!
|
|
4405
|
+
]), v = o("div", "jfm-panel jfm-preview"), w = b(h), x = o("div", "jfm-panel");
|
|
4406
|
+
if (!w)
|
|
4407
4407
|
x.appendChild(o("div", "xl-note", t("The form can be shared once the document is saved on a server")));
|
|
4408
4408
|
else if (!h.options.formify || typeof h.options.formify != "object")
|
|
4409
4409
|
x.appendChild(o("div", "xl-note", t("Save the configuration to share the form")));
|
|
4410
4410
|
else {
|
|
4411
4411
|
let X = o("input", "xl-input");
|
|
4412
|
-
X.type = "text", X.readOnly = !0, X.value =
|
|
4412
|
+
X.type = "text", X.readOnly = !0, X.value = w;
|
|
4413
4413
|
let te = o("textarea", "xl-input xl-textarea jfm-code");
|
|
4414
|
-
te.readOnly = !0, te.value = d(
|
|
4414
|
+
te.readOnly = !0, te.value = d(w), x.appendChild(s(t("Public link"), X)), x.appendChild(s(t("Embeddable code"), te)), [X, te].forEach(function(ae) {
|
|
4415
4415
|
ae.addEventListener("focus", function() {
|
|
4416
4416
|
ae.select();
|
|
4417
4417
|
});
|
|
@@ -4419,7 +4419,7 @@ formify(document.getElementById('formify'), {
|
|
|
4419
4419
|
}
|
|
4420
4420
|
const R = function() {
|
|
4421
4421
|
let X = [];
|
|
4422
|
-
return
|
|
4422
|
+
return D.forEach(function(te, ae) {
|
|
4423
4423
|
te.input.checked && X.push("" + ae);
|
|
4424
4424
|
}), {
|
|
4425
4425
|
columns: X,
|
|
@@ -4431,8 +4431,8 @@ formify(document.getElementById('formify'), {
|
|
|
4431
4431
|
let X = i(h, R());
|
|
4432
4432
|
X.onbeforesave = function(N, F) {
|
|
4433
4433
|
let Y = Object.keys(F), $ = [];
|
|
4434
|
-
for (let
|
|
4435
|
-
$.push(F[Y[
|
|
4434
|
+
for (let C = 0; C < Y.length; C++)
|
|
4435
|
+
$.push(F[Y[C]]);
|
|
4436
4436
|
return h.insertRow([{ data: $ }]), h.goto(h.rows.length - 1), N.form.reset(), typeof jSuites < "u" && jSuites.notification && jSuites.notification({ message: t("Successfully saved") }), !1;
|
|
4437
4437
|
};
|
|
4438
4438
|
let te = o("div", "jss_object");
|
|
@@ -16764,7 +16764,7 @@ REGEXTEST('Hello', 'hello', 1) returns TRUE`,
|
|
|
16764
16764
|
P = "";
|
|
16765
16765
|
}
|
|
16766
16766
|
s.innerHTML = "Formula result = <b></b>", s.querySelector("b").textContent = P;
|
|
16767
|
-
},
|
|
16767
|
+
}, D = o("div", "xl-fn-args"), B = function(I, P, j, G) {
|
|
16768
16768
|
let M = pt({ instance: n.w, formula: !0, equal: !1, onchange: u });
|
|
16769
16769
|
ie(M, "input", u), ie(M, "focus", function() {
|
|
16770
16770
|
l.textContent = I + ": " + P;
|
|
@@ -16772,7 +16772,7 @@ REGEXTEST('Hello', 'hello', 1) returns TRUE`,
|
|
|
16772
16772
|
let K = o("label", "xl-label" + (j ? " xl-fn-optional" : ""), null);
|
|
16773
16773
|
K.textContent = I;
|
|
16774
16774
|
let W = o("div", null, [K, M]);
|
|
16775
|
-
return G ? (r.splice(f, 0, M), f++,
|
|
16775
|
+
return G ? (r.splice(f, 0, M), f++, D.insertBefore(W, c)) : (r.push(M), D.appendChild(W), r.length - 1 === g && (c = W)), M;
|
|
16776
16776
|
};
|
|
16777
16777
|
if (i.forEach((I) => B(Ut(I), I.comment, _r(e, I))), h = r.slice(Math.max(0, g - d.length), g), t && t.length) {
|
|
16778
16778
|
for (; b && h.length && r.length < t.length && r.length + d.length <= 255; )
|
|
@@ -16783,7 +16783,7 @@ REGEXTEST('Hello', 'hello', 1) returns TRUE`,
|
|
|
16783
16783
|
}
|
|
16784
16784
|
let H = o("div", "xl-fn-body", [
|
|
16785
16785
|
o("div", "xl-fn-syntax", "<b></b>"),
|
|
16786
|
-
|
|
16786
|
+
D,
|
|
16787
16787
|
e.params.length ? null : o("div", "xl-fn-hint", "This function takes no arguments."),
|
|
16788
16788
|
l,
|
|
16789
16789
|
s
|
|
@@ -18040,14 +18040,14 @@ REGEXTEST('Hello', 'hello', 1) returns TRUE`,
|
|
|
18040
18040
|
a.textBaseline = "middle";
|
|
18041
18041
|
for (let p = 0; p < i.length - 1; p++)
|
|
18042
18042
|
for (let f = 0; f < d.length - 1; f++) {
|
|
18043
|
-
let c = e.getValueFromCoords(f, p, !0), h = po(e.getStyle(e.helpers.getCellNameFromCoords(f, p))), y = d[f], T = i[p], u = d[f + 1] - y,
|
|
18044
|
-
if (h["background-color"] && (a.fillStyle = h["background-color"], a.fillRect(y, T, u,
|
|
18043
|
+
let c = e.getValueFromCoords(f, p, !0), h = po(e.getStyle(e.helpers.getCellNameFromCoords(f, p))), y = d[f], T = i[p], u = d[f + 1] - y, D = i[p + 1] - T;
|
|
18044
|
+
if (h["background-color"] && (a.fillStyle = h["background-color"], a.fillRect(y, T, u, D)), c !== null && typeof c < "u" && c !== "") {
|
|
18045
18045
|
let B = String(c), H = /bold|[6-9]00/.test(h["font-weight"] || "") ? "bold " : "";
|
|
18046
18046
|
a.font = H + g + "px sans-serif", a.fillStyle = h.color || "#333";
|
|
18047
18047
|
let I = typeof c == "number" || /^-?\d+([.,]\d+)?%?$/.test(B);
|
|
18048
|
-
a.textAlign = h["text-align"] || (I ? "right" : "left"), a.save(), a.beginPath(), a.rect(y, T, u,
|
|
18048
|
+
a.textAlign = h["text-align"] || (I ? "right" : "left"), a.save(), a.beginPath(), a.rect(y, T, u, D), a.clip();
|
|
18049
18049
|
let P = 1, j = a.textAlign === "right" ? y + u - P : a.textAlign === "center" ? y + u / 2 : y + P;
|
|
18050
|
-
a.fillText(B, j, T +
|
|
18050
|
+
a.fillText(B, j, T + D / 2), a.restore();
|
|
18051
18051
|
}
|
|
18052
18052
|
}
|
|
18053
18053
|
a.strokeStyle = "#e3e3e3", a.lineWidth = 0.5, a.beginPath(), d.forEach(function(p) {
|
|
@@ -18326,8 +18326,8 @@ REGEXTEST('Hello', 'hello', 1) returns TRUE`,
|
|
|
18326
18326
|
h.title = "Attach a file";
|
|
18327
18327
|
const y = o("input");
|
|
18328
18328
|
y.type = "file", y.multiple = !0, y.accept = "image/*,.pdf,.csv,.xls,.xlsx", y.style.display = "none";
|
|
18329
|
-
const T = o("div", "xl-chat-submit", he("arrow_upward")), u = o("div", "xl-chat-toolbar", [h, y, o("div", "xl-chat-spacer"), T]),
|
|
18330
|
-
a.appendChild(d), a.appendChild(p), a.appendChild(i), a.appendChild(
|
|
18329
|
+
const T = o("div", "xl-chat-submit", he("arrow_upward")), u = o("div", "xl-chat-toolbar", [h, y, o("div", "xl-chat-spacer"), T]), D = o("div", "xl-chat-bottom", [f, c, u]);
|
|
18330
|
+
a.appendChild(d), a.appendChild(p), a.appendChild(i), a.appendChild(D);
|
|
18331
18331
|
const B = function(N) {
|
|
18332
18332
|
let F = o("div", "xl-chat-toast", N);
|
|
18333
18333
|
a.appendChild(F), setTimeout(function() {
|
|
@@ -18384,8 +18384,8 @@ REGEXTEST('Hello', 'hello', 1) returns TRUE`,
|
|
|
18384
18384
|
};
|
|
18385
18385
|
let $ = o("div", null, he("save"));
|
|
18386
18386
|
$.title = "Insert as a new worksheet", $.onclick = function() {
|
|
18387
|
-
let
|
|
18388
|
-
k.active.createWorksheet(
|
|
18387
|
+
let C = k.jss.helpers.createFromTable(N);
|
|
18388
|
+
k.active.createWorksheet(C), B("Worksheet created");
|
|
18389
18389
|
}, F.appendChild(Y), F.appendChild($), N.insertAdjacentElement("afterend", F);
|
|
18390
18390
|
}, ge = function(N) {
|
|
18391
18391
|
N.el.innerHTML = Ao.render(N.message || ""), Array.from(N.el.querySelectorAll("table")).forEach(ne);
|
|
@@ -18393,13 +18393,13 @@ REGEXTEST('Hello', 'hello', 1) returns TRUE`,
|
|
|
18393
18393
|
let F = o("div", "xl-chat-message");
|
|
18394
18394
|
if (N.mine && (F.dataset.mine = "true"), N.files && N.files.length) {
|
|
18395
18395
|
let $ = o("div", "xl-chat-files");
|
|
18396
|
-
N.files.forEach(function(
|
|
18397
|
-
$.appendChild(j(
|
|
18396
|
+
N.files.forEach(function(C) {
|
|
18397
|
+
$.appendChild(j(C));
|
|
18398
18398
|
}), F.appendChild($);
|
|
18399
18399
|
}
|
|
18400
18400
|
let Y = o("div", "xl-chat-body");
|
|
18401
18401
|
N.el = o("div", "xl-chat-text"), Y.appendChild(N.el), F.appendChild(Y), ge(N), e.push(N), i.appendChild(F);
|
|
18402
|
-
},
|
|
18402
|
+
}, w = function(N) {
|
|
18403
18403
|
let F = e[e.length - 1];
|
|
18404
18404
|
F && (F.message = N, ge(F));
|
|
18405
18405
|
}, x = function(N) {
|
|
@@ -18417,26 +18417,26 @@ REGEXTEST('Hello', 'hello', 1) returns TRUE`,
|
|
|
18417
18417
|
let F = [], Y = {};
|
|
18418
18418
|
N.forEach(function($) {
|
|
18419
18419
|
if ($.role === "user" || $.role === "assistant") {
|
|
18420
|
-
let
|
|
18421
|
-
if ($.role === "assistant" && Y.role === "assistant" && (
|
|
18420
|
+
let C = { role: $.role, message: "" };
|
|
18421
|
+
if ($.role === "assistant" && Y.role === "assistant" && (C = Y), $.content) {
|
|
18422
18422
|
let E = "";
|
|
18423
|
-
Array.isArray($.content) ? $.content.forEach(function(
|
|
18424
|
-
|
|
18425
|
-
}) : E = $.content, E && (
|
|
18423
|
+
Array.isArray($.content) ? $.content.forEach(function(O) {
|
|
18424
|
+
O.text && (E += O.text);
|
|
18425
|
+
}) : E = $.content, E && (C.message += E);
|
|
18426
18426
|
}
|
|
18427
|
-
$.files && $.files.length && (
|
|
18427
|
+
$.files && $.files.length && (C.files = $.files), $.role === "user" && (C.mine = !0), C.message && C !== Y && (F.push(C), Y = C);
|
|
18428
18428
|
}
|
|
18429
18429
|
}), x(F);
|
|
18430
18430
|
}).catch(function() {
|
|
18431
18431
|
});
|
|
18432
18432
|
}, _ = function() {
|
|
18433
|
-
p.style.display = "none", i.style.display = "",
|
|
18433
|
+
p.style.display = "none", i.style.display = "", D.style.display = "", m.classList.remove("selected");
|
|
18434
18434
|
}, L = function(N) {
|
|
18435
18435
|
n = N, _(), x([]), R(), c.focus();
|
|
18436
18436
|
}, A = function() {
|
|
18437
18437
|
n = cn(), I = [], G(), _(), x([]), c.focus();
|
|
18438
18438
|
}, V = function() {
|
|
18439
|
-
p.innerHTML = "", p.style.display = "", i.style.display = "none",
|
|
18439
|
+
p.innerHTML = "", p.style.display = "", i.style.display = "none", D.style.display = "none", m.classList.add("selected");
|
|
18440
18440
|
let N = o("div", "xl-chat-sessions-hint", "Loading...");
|
|
18441
18441
|
p.appendChild(N), fetch(Bt() + "/api/" + Vt() + "/prompt?list=1", {
|
|
18442
18442
|
headers: qe()
|
|
@@ -18451,17 +18451,17 @@ REGEXTEST('Hello', 'hello', 1) returns TRUE`,
|
|
|
18451
18451
|
}
|
|
18452
18452
|
let Y = n;
|
|
18453
18453
|
F.forEach(function($) {
|
|
18454
|
-
let
|
|
18455
|
-
|
|
18454
|
+
let C = o("div", "xl-chat-session-title");
|
|
18455
|
+
C.textContent = $.title || "New chat";
|
|
18456
18456
|
let E = o("div", "xl-chat-session-info", [
|
|
18457
|
-
|
|
18457
|
+
C,
|
|
18458
18458
|
o("div", "xl-chat-session-date", new Date($.updated).toLocaleString())
|
|
18459
|
-
]),
|
|
18460
|
-
|
|
18461
|
-
let U = o("div", "xl-chat-session" + ($.id === Y ? " selected" : ""), [E,
|
|
18459
|
+
]), O = o("div", "xl-chat-session-delete", he("delete"));
|
|
18460
|
+
O.title = "Delete";
|
|
18461
|
+
let U = o("div", "xl-chat-session" + ($.id === Y ? " selected" : ""), [E, O]);
|
|
18462
18462
|
U.onclick = function() {
|
|
18463
18463
|
L($.id);
|
|
18464
|
-
},
|
|
18464
|
+
}, O.onclick = function(q) {
|
|
18465
18465
|
q.stopPropagation(), confirm("Delete this conversation?") && fetch(Bt() + "/api/" + Vt() + "/prompt?session=" + $.id, {
|
|
18466
18466
|
method: "DELETE",
|
|
18467
18467
|
headers: qe()
|
|
@@ -18482,17 +18482,23 @@ REGEXTEST('Hello', 'hello', 1) returns TRUE`,
|
|
|
18482
18482
|
headers: qe(),
|
|
18483
18483
|
body: F
|
|
18484
18484
|
});
|
|
18485
|
-
if (!$.ok)
|
|
18485
|
+
if (!$.ok) {
|
|
18486
|
+
let O = $.status === 429 ? await $.text() : "";
|
|
18487
|
+
if (O) {
|
|
18488
|
+
Y = O, w(Y);
|
|
18489
|
+
return;
|
|
18490
|
+
}
|
|
18486
18491
|
throw new Error("API responded with status " + $.status);
|
|
18487
|
-
|
|
18492
|
+
}
|
|
18493
|
+
const C = $.body.getReader(), E = new TextDecoder();
|
|
18488
18494
|
for (; ; ) {
|
|
18489
|
-
const { done:
|
|
18490
|
-
if (
|
|
18495
|
+
const { done: O, value: U } = await C.read();
|
|
18496
|
+
if (O)
|
|
18491
18497
|
break;
|
|
18492
|
-
Y += E.decode(U, { stream: !0 }),
|
|
18498
|
+
Y += E.decode(U, { stream: !0 }), w(Y), r && H();
|
|
18493
18499
|
}
|
|
18494
18500
|
} catch {
|
|
18495
|
-
Y ||
|
|
18501
|
+
Y || w("Unable to reach the AI service. Make sure the Intrasheets server is running and reload the page.");
|
|
18496
18502
|
} finally {
|
|
18497
18503
|
t = !1, i.classList.remove("loader"), H(!0);
|
|
18498
18504
|
}
|
|
@@ -18522,13 +18528,13 @@ REGEXTEST('Hello', 'hello', 1) returns TRUE`,
|
|
|
18522
18528
|
});
|
|
18523
18529
|
let X = 0;
|
|
18524
18530
|
ie(a, "dragenter", function(N) {
|
|
18525
|
-
N.preventDefault(), X++,
|
|
18531
|
+
N.preventDefault(), X++, D.classList.add("xl-chat-dropping");
|
|
18526
18532
|
}), ie(a, "dragover", function(N) {
|
|
18527
18533
|
N.preventDefault();
|
|
18528
18534
|
}), ie(a, "dragleave", function() {
|
|
18529
|
-
X--, X <= 0 && (X = 0,
|
|
18535
|
+
X--, X <= 0 && (X = 0, D.classList.remove("xl-chat-dropping"));
|
|
18530
18536
|
}), ie(a, "drop", function(N) {
|
|
18531
|
-
N.preventDefault(), X = 0,
|
|
18537
|
+
N.preventDefault(), X = 0, D.classList.remove("xl-chat-dropping"), N.dataTransfer && N.dataTransfer.files.length && (W(N.dataTransfer.files), c.focus());
|
|
18532
18538
|
}), ie(c, "keydown", function(N) {
|
|
18533
18539
|
N.key === "Enter" && !N.shiftKey && (N.preventDefault(), ee());
|
|
18534
18540
|
}), ie(c, "input", function() {
|
|
@@ -18652,7 +18658,7 @@ const Uo = function(e, t, n) {
|
|
|
18652
18658
|
T || (T = !0, requestAnimationFrame(function() {
|
|
18653
18659
|
T = !1, ke.track(), B.refresh(), I.update(), H.update(), l.classList.toggle("xl-disabled", !_t.canUndo()), s.classList.toggle("xl-disabled", !_t.canRedo());
|
|
18654
18660
|
}));
|
|
18655
|
-
},
|
|
18661
|
+
}, D = go(e), B = no(g, D.open), H = co(y), I = {
|
|
18656
18662
|
update: function() {
|
|
18657
18663
|
},
|
|
18658
18664
|
insertFunction: function(M) {
|
|
@@ -18707,7 +18713,7 @@ const Uo = function(e, t, n) {
|
|
|
18707
18713
|
if (Q.refuseSortFilter("Sort", ne))
|
|
18708
18714
|
return !1;
|
|
18709
18715
|
},
|
|
18710
|
-
onselection: function(ne, ge, v,
|
|
18716
|
+
onselection: function(ne, ge, v, w, x, R) {
|
|
18711
18717
|
k.active = ne, k.painter !== null && typeof MouseEvent < "u" && R instanceof MouseEvent && (k.painterPending = !0), u();
|
|
18712
18718
|
},
|
|
18713
18719
|
onopenworksheet: function(ne) {
|