open-grid 1.3.0 → 1.4.0
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/CHANGELOG.md +40 -0
- package/README.ja.md +462 -0
- package/README.md +52 -18
- package/README.zh.md +455 -0
- package/dist/{OpenGrid-B7m7ei7f.cjs → OpenGrid-BOtTt5aI.cjs} +2 -2
- package/dist/{OpenGrid-CeUdO_fM.js → OpenGrid-sI_vdHQw.js} +2 -2
- package/dist/Registry-CPJYOqCn.js +74 -0
- package/dist/Registry-D74ZmdDz.cjs +71 -0
- package/dist/index-B3fKi43v.js +481 -0
- package/dist/{index-JjfWY3Bt.cjs → index-D1l3XFCM.cjs} +92 -160
- package/dist/open-grid-react.cjs +1 -1
- package/dist/open-grid-react.js +1 -1
- package/dist/open-grid-vue.cjs +1 -1
- package/dist/open-grid-vue.js +1 -1
- package/dist/open-grid.cjs +31 -31
- package/dist/open-grid.js +86 -82
- package/dist/types/core/FilterSelect.d.ts +290 -33
- package/dist/types/core/GridShuttle.d.ts +177 -25
- package/dist/types/core/IconRegistry.d.ts +263 -37
- package/dist/types/core/OpenGrid.d.ts +2815 -373
- package/dist/types/core/OrgChart.d.ts +269 -31
- package/dist/types/core/SkinRegistry.d.ts +341 -43
- package/dist/types/core/XmlConverter.d.ts +424 -43
- package/dist/types/core/chart/types.d.ts +1076 -113
- package/dist/types/core/extension/Registry.d.ts +389 -51
- package/dist/types/core/extension/reserved.d.ts +34 -5
- package/dist/types/core/i18n/LocaleRegistry.d.ts +0 -0
- package/dist/types/core/i18n/types.d.ts +660 -78
- package/dist/types/core/types.d.ts +3791 -373
- package/dist/types/index.d.ts +226 -17
- package/package.json +3 -1
- package/dist/index-DrCPRuYi.js +0 -548
package/dist/index-DrCPRuYi.js
DELETED
|
@@ -1,548 +0,0 @@
|
|
|
1
|
-
import { p as re, c as _ } from "./OpenGrid-CeUdO_fM.js";
|
|
2
|
-
function B(e) {
|
|
3
|
-
return !!e && typeof e.ref == "string";
|
|
4
|
-
}
|
|
5
|
-
const M = 1;
|
|
6
|
-
function ie(e, t) {
|
|
7
|
-
return JSON.stringify(e) === JSON.stringify(t);
|
|
8
|
-
}
|
|
9
|
-
function oe(e) {
|
|
10
|
-
const t = (e == null ? void 0 : e.primary) ?? "#1976d2", n = (e == null ? void 0 : e.graphite) ?? "#3a3f45";
|
|
11
|
-
return { rampFrom: (r) => r === "primary" ? t : n };
|
|
12
|
-
}
|
|
13
|
-
function se(e) {
|
|
14
|
-
const t = [];
|
|
15
|
-
for (const n of e) {
|
|
16
|
-
const r = typeof n == "number" ? n : typeof n == "string" && n.trim() !== "" ? Number(n) : NaN;
|
|
17
|
-
Number.isFinite(r) && t.push(r);
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
}
|
|
21
|
-
function ae(e) {
|
|
22
|
-
const t = se(e), n = t.length;
|
|
23
|
-
if (n === 0) return { count: 0, distinct: 0 };
|
|
24
|
-
const r = [...t].sort((m, g) => m - g), o = r[0], i = r[n - 1], a = t.reduce((m, g) => m + g, 0) / n, c = t.reduce((m, g) => m + (g - a) ** 2, 0) / n, l = Math.sqrt(c), f = /* @__PURE__ */ new Map();
|
|
25
|
-
for (const m of t) f.set(m, (f.get(m) ?? 0) + 1);
|
|
26
|
-
const d = f.size;
|
|
27
|
-
return { min: o, max: i, avg: a, stddev: l, count: n, distinct: d, rankOf: (m) => {
|
|
28
|
-
let g = 0;
|
|
29
|
-
for (const w of t) w > m && g++;
|
|
30
|
-
return g + 1;
|
|
31
|
-
}, rankAscOf: (m) => {
|
|
32
|
-
let g = 0;
|
|
33
|
-
for (const w of t) w < m && g++;
|
|
34
|
-
return g + 1;
|
|
35
|
-
}, percentileOf: (m) => {
|
|
36
|
-
let g = 0;
|
|
37
|
-
for (const w of t) w <= m && g++;
|
|
38
|
-
return g / n;
|
|
39
|
-
}, countOf: (m) => f.get(m) ?? 0 };
|
|
40
|
-
}
|
|
41
|
-
function q(e) {
|
|
42
|
-
const t = {};
|
|
43
|
-
return e.min !== void 0 && (t.min = e.min), e.max !== void 0 && (t.max = e.max), e.avg !== void 0 && (t.avg = e.avg), e.stddev !== void 0 && (t.stddev = e.stddev), e.count !== void 0 && (t.count = e.count), e.distinct !== void 0 && (t.distinct = e.distinct), t;
|
|
44
|
-
}
|
|
45
|
-
const ce = ["og:", "og-"];
|
|
46
|
-
function ue(e) {
|
|
47
|
-
return ce.some((t) => e.startsWith(t));
|
|
48
|
-
}
|
|
49
|
-
function z(e) {
|
|
50
|
-
const t = e.lastIndexOf("@"), n = t >= 0 ? e.slice(t + 1) : e;
|
|
51
|
-
return n.split(".")[0] ?? n;
|
|
52
|
-
}
|
|
53
|
-
function le(e, t) {
|
|
54
|
-
return z(e) === z(t);
|
|
55
|
-
}
|
|
56
|
-
function de(e, t, n, r, o) {
|
|
57
|
-
const i = { key: e, value: t, origin: n, priority: r.priority ?? 0, seq: o };
|
|
58
|
-
return r.pluginId !== void 0 && (i.pluginId = r.pluginId), r.spiVersion !== void 0 && (i.spiVersion = r.spiVersion), r.deprecated !== void 0 && (i.deprecated = r.deprecated), i;
|
|
59
|
-
}
|
|
60
|
-
class S {
|
|
61
|
-
constructor(t = {}) {
|
|
62
|
-
this._map = /* @__PURE__ */ new Map(), this._seq = 0, this._disposed = false, this._warned = /* @__PURE__ */ new Set(), this._cfg = t;
|
|
63
|
-
}
|
|
64
|
-
_warn(t, n) {
|
|
65
|
-
const r = `[OpenGrid] ${n}`, o = `${t}::${n}`;
|
|
66
|
-
return this._warned.has(o) || (this._warned.add(o), (this._cfg.onWarn ?? ((s) => {
|
|
67
|
-
typeof console < "u" && console.warn(s);
|
|
68
|
-
}))(r)), r;
|
|
69
|
-
}
|
|
70
|
-
register(t, n, r = {}) {
|
|
71
|
-
if (this._disposed) return { ok: false, action: "rejected", reason: "disposed" };
|
|
72
|
-
if (typeof t != "string" || t.length === 0) return { ok: false, action: "rejected", reason: "invalid-key" };
|
|
73
|
-
const o = r.origin ?? "user";
|
|
74
|
-
if (ue(t) && o !== "builtin") return { ok: false, action: "rejected", reason: "reserved-namespace", warning: this._warn(t, `reserved namespace: '${t}' 는 og:* 코어 예약 대역입니다(origin:'builtin' 만 점유).`) };
|
|
75
|
-
if (this._cfg.spi && r.spiVersion !== void 0 && !le(this._cfg.spi.version, r.spiVersion)) return { ok: false, action: "rejected", reason: "spi-mismatch", warning: this._warn(t, `SPI major 불일치: '${t}' 선언 ${r.spiVersion}, 코어 ${this._cfg.spi.name}@${this._cfg.spi.version}.`) };
|
|
76
|
-
const i = this._map.get(t);
|
|
77
|
-
return i && !this._resolveConflict(i, r) ? { ok: false, action: "kept", reason: "protected-builtin", warning: this._warn(t, `'${t}' 는 ${i.origin === "builtin" ? "내장(built-in) 보호" : "override 미지정"} — 덮으려면 { override:true }.`) } : (this._map.set(t, de(t, n, o, r, this._seq++)), { ok: true, action: i ? "replaced" : "added" });
|
|
78
|
-
}
|
|
79
|
-
_resolveConflict(t, n) {
|
|
80
|
-
return t.origin === "builtin" && n.override !== true ? false : this._cfg.duplicatePolicy === "explicit-override" ? n.override === true : true;
|
|
81
|
-
}
|
|
82
|
-
get(t) {
|
|
83
|
-
var _a;
|
|
84
|
-
return (_a = this._map.get(t)) == null ? void 0 : _a.value;
|
|
85
|
-
}
|
|
86
|
-
require(t, n) {
|
|
87
|
-
const r = this.get(t);
|
|
88
|
-
if (r !== void 0) return r;
|
|
89
|
-
if (n !== void 0) return n;
|
|
90
|
-
if (this._cfg.placeholder) return this._cfg.placeholder(t);
|
|
91
|
-
}
|
|
92
|
-
has(t) {
|
|
93
|
-
return this._map.has(t);
|
|
94
|
-
}
|
|
95
|
-
list() {
|
|
96
|
-
return [...this._map.keys()];
|
|
97
|
-
}
|
|
98
|
-
entries() {
|
|
99
|
-
return [...this._map.values()];
|
|
100
|
-
}
|
|
101
|
-
unregister(t) {
|
|
102
|
-
return this._map.delete(t);
|
|
103
|
-
}
|
|
104
|
-
disposePlugin(t) {
|
|
105
|
-
let n = 0;
|
|
106
|
-
for (const [r, o] of this._map) o.pluginId === t && (this._map.delete(r), n++);
|
|
107
|
-
return n;
|
|
108
|
-
}
|
|
109
|
-
dispose() {
|
|
110
|
-
this._map.clear(), this._warned.clear(), this._disposed = true;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function b(e) {
|
|
114
|
-
return typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
|
|
115
|
-
}
|
|
116
|
-
const h = 864e5;
|
|
117
|
-
function k(e) {
|
|
118
|
-
const t = new Date(e);
|
|
119
|
-
return new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
|
|
120
|
-
}
|
|
121
|
-
function W(e) {
|
|
122
|
-
const t = k(e), n = new Date(t).getDay();
|
|
123
|
-
return t - n * h;
|
|
124
|
-
}
|
|
125
|
-
const fe = { needs: [], test(e, t) {
|
|
126
|
-
const n = b(t.value);
|
|
127
|
-
if (!Number.isFinite(n)) return false;
|
|
128
|
-
switch (e.op) {
|
|
129
|
-
case ">":
|
|
130
|
-
return n > e.a;
|
|
131
|
-
case ">=":
|
|
132
|
-
return n >= e.a;
|
|
133
|
-
case "<":
|
|
134
|
-
return n < e.a;
|
|
135
|
-
case "<=":
|
|
136
|
-
return n <= e.a;
|
|
137
|
-
case "=":
|
|
138
|
-
return n === e.a;
|
|
139
|
-
case "!=":
|
|
140
|
-
return n !== e.a;
|
|
141
|
-
case "between":
|
|
142
|
-
return e.b !== void 0 && n >= Math.min(e.a, e.b) && n <= Math.max(e.a, e.b);
|
|
143
|
-
default:
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
} }, pe = { needs: [], test(e, t) {
|
|
147
|
-
const n = t.value == null ? "" : String(t.value);
|
|
148
|
-
return e.ci === false ? n.includes(e.text) : n.toLowerCase().includes(e.text.toLowerCase());
|
|
149
|
-
} }, me = { needs: [], test(e, t, n, r) {
|
|
150
|
-
const o = t.value, i = o instanceof Date ? o.getTime() : typeof o == "number" ? o : Date.parse(String(o));
|
|
151
|
-
if (!Number.isFinite(i)) return false;
|
|
152
|
-
const s = r.now, a = k(s);
|
|
153
|
-
switch (e.rel) {
|
|
154
|
-
case "today":
|
|
155
|
-
return k(i) === a;
|
|
156
|
-
case "yesterday":
|
|
157
|
-
return k(i) === a - h;
|
|
158
|
-
case "tomorrow":
|
|
159
|
-
return k(i) === a + h;
|
|
160
|
-
case "thisWeek": {
|
|
161
|
-
const c = W(s);
|
|
162
|
-
return i >= c && i < c + 7 * h;
|
|
163
|
-
}
|
|
164
|
-
case "lastWeek": {
|
|
165
|
-
const c = W(s) - 7 * h;
|
|
166
|
-
return i >= c && i < c + 7 * h;
|
|
167
|
-
}
|
|
168
|
-
case "thisMonth": {
|
|
169
|
-
const c = new Date(s);
|
|
170
|
-
return new Date(i).getFullYear() === c.getFullYear() && new Date(i).getMonth() === c.getMonth();
|
|
171
|
-
}
|
|
172
|
-
case "lastMonth": {
|
|
173
|
-
const c = new Date(s.valueOf()), l = new Date(c.getFullYear(), c.getMonth() - 1, 1);
|
|
174
|
-
return new Date(i).getFullYear() === l.getFullYear() && new Date(i).getMonth() === l.getMonth();
|
|
175
|
-
}
|
|
176
|
-
case "next7d":
|
|
177
|
-
return i >= a && i < a + 7 * h;
|
|
178
|
-
case "last7d":
|
|
179
|
-
return i < a + h && i >= a - 6 * h;
|
|
180
|
-
default:
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
} }, ge = { needs: ["rank"], test(e, t, n) {
|
|
184
|
-
const r = b(t.value);
|
|
185
|
-
return Number.isFinite(r) ? e.bottom ? n.rankAscOf ? n.rankAscOf(r) <= e.n : false : n.rankOf ? n.rankOf(r) <= e.n : false : false;
|
|
186
|
-
} }, he = { needs: ["percentile"], test(e, t, n) {
|
|
187
|
-
const r = b(t.value);
|
|
188
|
-
if (!Number.isFinite(r) || !n.percentileOf) return false;
|
|
189
|
-
const o = n.percentileOf(r);
|
|
190
|
-
return e.bottom ? o <= e.pct / 100 : o >= 1 - e.pct / 100;
|
|
191
|
-
} }, ve = { needs: ["avg"], test(e, t, n) {
|
|
192
|
-
const r = b(t.value);
|
|
193
|
-
return !Number.isFinite(r) || n.avg === void 0 ? false : e.below ? r < n.avg : r > n.avg;
|
|
194
|
-
} }, be = { needs: ["avg", "stddev"], test(e, t, n) {
|
|
195
|
-
const r = b(t.value);
|
|
196
|
-
if (!Number.isFinite(r) || n.avg === void 0 || n.stddev === void 0) return false;
|
|
197
|
-
const o = Math.abs(r - n.avg), i = e.k * n.stddev;
|
|
198
|
-
return e.outside === false ? o <= i : o >= i;
|
|
199
|
-
} }, ye = { needs: ["cardinality"], test(e, t, n) {
|
|
200
|
-
const r = b(t.value);
|
|
201
|
-
if (!Number.isFinite(r) || !n.countOf) return false;
|
|
202
|
-
const o = n.countOf(r);
|
|
203
|
-
return e.unique ? o === 1 : o > 1;
|
|
204
|
-
} }, we = { needs: [], test() {
|
|
205
|
-
return false;
|
|
206
|
-
} }, Y = Object.freeze({ compare: fe, textContains: pe, dateOccurring: me, topN: ge, topNpct: he, aboveAvg: ve, stdBand: be, duplicate: ye, custom: we });
|
|
207
|
-
function j() {
|
|
208
|
-
const e = new S({ spi: { name: "CFPredicate", version: "1" } });
|
|
209
|
-
for (const [t, n] of Object.entries(Y)) e.register(t, n, { origin: "builtin" });
|
|
210
|
-
return e;
|
|
211
|
-
}
|
|
212
|
-
function L(e, t) {
|
|
213
|
-
const n = e.scope;
|
|
214
|
-
return !(n.columnId !== t.columnId || n.range && (t.rowIndex < n.range.startRow || t.rowIndex >= n.range.endRow) || n.rowState && n.rowState !== t.rowState);
|
|
215
|
-
}
|
|
216
|
-
function ke(e) {
|
|
217
|
-
return [...e].sort((t, n) => t.priority - n.priority || (t.id < n.id ? -1 : t.id > n.id ? 1 : 0));
|
|
218
|
-
}
|
|
219
|
-
function Ie(e) {
|
|
220
|
-
return typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : NaN;
|
|
221
|
-
}
|
|
222
|
-
function y(e) {
|
|
223
|
-
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
224
|
-
}
|
|
225
|
-
function U(e, t, n) {
|
|
226
|
-
const r = Ie(t), o = Number.isFinite(r), i = !o || r === 0 ? 0 : r > 0 ? 1 : -1, s = n.min ?? 0, a = n.max ?? 0;
|
|
227
|
-
if (e.kind === "bar") {
|
|
228
|
-
if (!o) return { sign: 0 };
|
|
229
|
-
const c = e.axis ?? "zero";
|
|
230
|
-
let l, f = false;
|
|
231
|
-
if (c === "zero") {
|
|
232
|
-
const d = Math.max(Math.abs(s), Math.abs(a)) || 1, u = Math.abs(r) / d;
|
|
233
|
-
l = y(u), e.clamp && u > 1 && (f = true);
|
|
234
|
-
} else {
|
|
235
|
-
const d = a - s || 1, u = (r - s) / d;
|
|
236
|
-
l = y(u), e.clamp && (u < 0 || u > 1) && (f = true);
|
|
237
|
-
}
|
|
238
|
-
return { ratio: l, sign: i, value: r, clamped: f };
|
|
239
|
-
}
|
|
240
|
-
if (e.kind === "scale") {
|
|
241
|
-
if (!o) return { sign: 0 };
|
|
242
|
-
const c = e.mode ?? "discrete";
|
|
243
|
-
let l;
|
|
244
|
-
if (e.diverging) {
|
|
245
|
-
const u = e.midpoint === "zero" ? 0 : e.midpoint === "mean" ? n.avg ?? (s + a) / 2 : typeof e.midpoint == "number" ? e.midpoint : 0;
|
|
246
|
-
if (r <= u) {
|
|
247
|
-
const p = u - s || 1;
|
|
248
|
-
l = 0.5 * y((r - s) / p);
|
|
249
|
-
} else {
|
|
250
|
-
const p = a - u || 1;
|
|
251
|
-
l = 0.5 + 0.5 * y((r - u) / p);
|
|
252
|
-
}
|
|
253
|
-
} else {
|
|
254
|
-
const u = a - s || 1;
|
|
255
|
-
l = y((r - s) / u);
|
|
256
|
-
}
|
|
257
|
-
if (c === "continuous") return { ratio: l, sign: i, value: r };
|
|
258
|
-
const f = e.diverging ? Math.max(3, Math.min(5, e.bands ?? 3)) : Math.max(2, Math.min(5, e.bands ?? 3)), d = Math.min(f - 1, Math.floor(l * f));
|
|
259
|
-
return { ratio: l, bandIndex: d, bandCount: f, sign: i, value: r };
|
|
260
|
-
}
|
|
261
|
-
if (e.kind === "icon") {
|
|
262
|
-
if (!o) return { sign: 0 };
|
|
263
|
-
const c = e.steps ?? 3, l = a - s || 1, f = y((r - s) / l);
|
|
264
|
-
let d = Math.min(c - 1, Math.floor(f * c));
|
|
265
|
-
return e.reverse && (d = c - 1 - d), { bandIndex: d, bandCount: c, ratio: f, sign: i, value: r };
|
|
266
|
-
}
|
|
267
|
-
return o ? { sign: i, value: r } : { sign: i };
|
|
268
|
-
}
|
|
269
|
-
function _e(e, t) {
|
|
270
|
-
return e.get(t);
|
|
271
|
-
}
|
|
272
|
-
class G {
|
|
273
|
-
constructor(t) {
|
|
274
|
-
this.ruleTypes = t;
|
|
275
|
-
}
|
|
276
|
-
evaluate(t, n, r, o) {
|
|
277
|
-
const i = ke(t.filter((u) => L(u, n)));
|
|
278
|
-
let s;
|
|
279
|
-
const a = [], c = [];
|
|
280
|
-
let l;
|
|
281
|
-
for (const u of i) {
|
|
282
|
-
const p = _e(this.ruleTypes, u.when.type);
|
|
283
|
-
if (!p) continue;
|
|
284
|
-
let v = false;
|
|
285
|
-
try {
|
|
286
|
-
v = p.test(u.when, n, r, o);
|
|
287
|
-
} catch {
|
|
288
|
-
v = false;
|
|
289
|
-
}
|
|
290
|
-
if (!v) continue;
|
|
291
|
-
const V = U(u.encode, n.value, r), m = { ruleId: u.id, conditionType: u.when.type, threshold: Me(u), inputValue: n.value, statsUsed: q(r), priority: u.priority, wonOver: [] }, g = { ruleId: u.id, fired: true, encode: u.encode, datum: V, ...u.style !== void 0 ? { styleRef: u.style } : {}, lineage: m };
|
|
292
|
-
if (u.encode.kind === "bar" || u.encode.kind === "scale" ? (s && c.push(s.ruleId), s = g) : a.push(g), u.stopIfTrue) {
|
|
293
|
-
l = u.id;
|
|
294
|
-
break;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
s && c.length && (s = { ...s, lineage: { ...s.lineage, wonOver: [...c] } });
|
|
298
|
-
const f = s ?? a[0], d = { decorators: a };
|
|
299
|
-
return s && (d.background = s), f && (d.winner = f), l !== void 0 && (d.stoppedAt = l), d;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
function Me(e) {
|
|
303
|
-
const { type: t, ...n } = e.when;
|
|
304
|
-
return n;
|
|
305
|
-
}
|
|
306
|
-
const $ = "#f4f5f6";
|
|
307
|
-
function D(e) {
|
|
308
|
-
const t = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
|
|
309
|
-
return `#${t(e.r)}${t(e.g)}${t(e.b)}`;
|
|
310
|
-
}
|
|
311
|
-
function x(e, t, n) {
|
|
312
|
-
const r = n < 0 ? 0 : n > 1 ? 1 : n;
|
|
313
|
-
return { r: e.r + (t.r - e.r) * r, g: e.g + (t.g - e.g) * r, b: e.b + (t.b - e.b) * r };
|
|
314
|
-
}
|
|
315
|
-
function C(e) {
|
|
316
|
-
return re(e) ?? { r: 58, g: 63, b: 69 };
|
|
317
|
-
}
|
|
318
|
-
function xe(e) {
|
|
319
|
-
return x({ r: 255, g: 255, b: 255 }, e, 0.08);
|
|
320
|
-
}
|
|
321
|
-
function R(e, t) {
|
|
322
|
-
const n = C(e);
|
|
323
|
-
return D(x(xe(n), n, t));
|
|
324
|
-
}
|
|
325
|
-
function A(e, t) {
|
|
326
|
-
const n = Math.max(2, Math.min(5, Math.floor(t))), r = [];
|
|
327
|
-
for (let o = 0; o < n; o++) r.push(R(e, n === 1 ? 0 : o / (n - 1)));
|
|
328
|
-
return r;
|
|
329
|
-
}
|
|
330
|
-
function E(e, t, n, r = $) {
|
|
331
|
-
const o = C(r);
|
|
332
|
-
return n <= 0.5 ? D(x(C(e), o, n / 0.5)) : D(x(o, C(t), (n - 0.5) / 0.5));
|
|
333
|
-
}
|
|
334
|
-
function H(e, t, n, r = $) {
|
|
335
|
-
const o = Math.max(3, Math.min(5, Math.floor(n))), i = [];
|
|
336
|
-
for (let s = 0; s < o; s++) i.push(E(e, t, o === 1 ? 0.5 : s / (o - 1), r));
|
|
337
|
-
return i;
|
|
338
|
-
}
|
|
339
|
-
const P = 4.5, F = "#111111", N = "#ffffff";
|
|
340
|
-
class J {
|
|
341
|
-
pickInk(t) {
|
|
342
|
-
const n = _(F, t), r = _(N, t), o = r >= n, i = o ? N : F, s = o ? r : n;
|
|
343
|
-
return s >= P ? { color: i, ratio: s } : { color: i, outline: true, outlineColor: o ? F : N, ratio: s };
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
function Ce(e) {
|
|
347
|
-
return Math.max(_(F, e), _(N, e)) >= P;
|
|
348
|
-
}
|
|
349
|
-
const K = new J(), T = "#111111";
|
|
350
|
-
function O(e) {
|
|
351
|
-
return e === void 0 || !Number.isFinite(e) ? "—" : Number.isInteger(e) ? String(e) : String(Math.round(e * 1e3) / 1e3);
|
|
352
|
-
}
|
|
353
|
-
function X(e) {
|
|
354
|
-
return e === void 0 ? "—" : `${Math.round(e * 100)}%`;
|
|
355
|
-
}
|
|
356
|
-
class Q {
|
|
357
|
-
constructor() {
|
|
358
|
-
this.kind = "bar";
|
|
359
|
-
}
|
|
360
|
-
encode(t, n, r) {
|
|
361
|
-
const o = t.encode, i = t.datum;
|
|
362
|
-
if (i.value === void 0) return { layer: "background", inkColor: T, ariaSummary: "값 없음" };
|
|
363
|
-
const s = o.seed ?? (i.sign === -1 ? "graphite" : "primary"), a = n.rampFrom(s), l = (o.axis ?? "zero") === "zero" && i.sign === -1 ? "right" : "left", f = K.pickInk(a), d = i.ratio ?? 0, u = i.clamped ? " (범위 초과·클램프)" : "", p = o.log ? " (log)" : "", v = `값 ${O(i.value)}, 막대 ${X(d)}${i.sign === -1 ? " 음수" : ""}${u}${p}`;
|
|
364
|
-
return { layer: "background", fill: { color: a, from: l, ratio: d }, inkColor: f.color, ...f.outline ? { inkOutline: true } : {}, ...i.clamped ? { clamped: true } : {}, ariaSummary: v };
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
class Z {
|
|
368
|
-
constructor() {
|
|
369
|
-
this.kind = "scale";
|
|
370
|
-
}
|
|
371
|
-
encode(t, n, r) {
|
|
372
|
-
const o = t.encode, i = t.datum;
|
|
373
|
-
if (i.value === void 0) return { layer: "background", inkColor: T, ariaSummary: "값 없음" };
|
|
374
|
-
const s = o.mode ?? "discrete";
|
|
375
|
-
let a, c = "";
|
|
376
|
-
if (o.diverging) {
|
|
377
|
-
const d = n.rampFrom("graphite"), u = n.rampFrom("primary");
|
|
378
|
-
if (s === "continuous") a = E(d, u, i.ratio ?? 0.5);
|
|
379
|
-
else {
|
|
380
|
-
const p = H(d, u, i.bandCount ?? 3);
|
|
381
|
-
a = p[i.bandIndex ?? 0] ?? p[0], c = ` (구간 ${(i.bandIndex ?? 0) + 1}/${i.bandCount ?? p.length})`;
|
|
382
|
-
}
|
|
383
|
-
} else {
|
|
384
|
-
const d = o.seed ?? "graphite", u = n.rampFrom(d);
|
|
385
|
-
if (s === "continuous") a = R(u, i.ratio ?? 0);
|
|
386
|
-
else {
|
|
387
|
-
const p = A(u, i.bandCount ?? 3);
|
|
388
|
-
a = p[i.bandIndex ?? 0] ?? p[0], c = ` (구간 ${(i.bandIndex ?? 0) + 1}/${i.bandCount ?? p.length})`;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
const l = K.pickInk(a), f = `값 ${O(i.value)}, 히트맵 ${X(i.ratio)}${c}`;
|
|
392
|
-
return { layer: "background", fill: { color: a, ratio: i.ratio ?? 0 }, inkColor: l.color, ...l.outline ? { inkOutline: true } : {}, ariaSummary: f };
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
function Fe(e, t) {
|
|
396
|
-
return t <= 1 ? "circle" : e <= 0 ? "triangleDown" : e >= t - 1 ? "triangleUp" : "circle";
|
|
397
|
-
}
|
|
398
|
-
class ee {
|
|
399
|
-
constructor() {
|
|
400
|
-
this.kind = "icon";
|
|
401
|
-
}
|
|
402
|
-
encode(t, n, r) {
|
|
403
|
-
const o = t.encode, i = t.datum;
|
|
404
|
-
if (i.value === void 0) return { layer: "decorator", inkColor: T, ariaSummary: "값 없음" };
|
|
405
|
-
const s = i.bandCount ?? o.steps ?? 3, a = i.bandIndex ?? 0, c = Fe(a, s), l = A(n.rampFrom("graphite"), Math.max(2, s)), f = l[Math.min(l.length - 1, a)] ?? l[0], d = `cf-icon-${a}-of-${s}`, u = a <= 0 ? "하위" : a >= s - 1 ? "상위" : "중간", p = `값 ${O(i.value)}, ${u} 구간 ${a + 1}/${s} (${c})`;
|
|
406
|
-
return { layer: "decorator", glyph: { role: d, tint: f, shape: c }, inkColor: f, ariaSummary: p };
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
class te {
|
|
410
|
-
constructor() {
|
|
411
|
-
this.kind = "sparkline";
|
|
412
|
-
}
|
|
413
|
-
encode(t, n, r) {
|
|
414
|
-
const o = t.encode, i = t.datum;
|
|
415
|
-
return { layer: "decorator", inkColor: "#111111", ariaSummary: `인셀 ${o.chart ?? "line"} 스파크, 값 ${O(i.value)}` };
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
function ne() {
|
|
419
|
-
const e = new S({ spi: { name: "CFEncoder", version: "1" } });
|
|
420
|
-
return e.register("bar", new Q(), { origin: "builtin" }), e.register("scale", new Z(), { origin: "builtin" }), e.register("icon", new ee(), { origin: "builtin" }), e.register("sparkline", new te(), { origin: "builtin" }), e;
|
|
421
|
-
}
|
|
422
|
-
function Ne() {
|
|
423
|
-
return new S({ spi: { name: "CFNamedStyle", version: "1" } });
|
|
424
|
-
}
|
|
425
|
-
function I(e) {
|
|
426
|
-
return typeof e == "object" && e !== null;
|
|
427
|
-
}
|
|
428
|
-
class Oe {
|
|
429
|
-
load(t, n) {
|
|
430
|
-
const r = [], o = [], i = Array.isArray(t) ? t : I(t) && Array.isArray(t.rules) ? t.rules : [];
|
|
431
|
-
for (const s of i) {
|
|
432
|
-
if (!I(s)) {
|
|
433
|
-
o.push({ ruleId: "?", reason: "malformed", detail: "not an object" });
|
|
434
|
-
continue;
|
|
435
|
-
}
|
|
436
|
-
const a = typeof s.id == "string" ? s.id : "?", c = s.when, l = s.encode, f = s.scope;
|
|
437
|
-
if (typeof s.v == "number" && s.v > M) {
|
|
438
|
-
o.push({ ruleId: a, reason: "future-version", detail: `v${s.v} > ${M}` });
|
|
439
|
-
continue;
|
|
440
|
-
}
|
|
441
|
-
if (!I(c) || typeof c.type != "string" || !I(l) || typeof l.kind != "string" || !I(f) || typeof f.columnId != "string") {
|
|
442
|
-
o.push({ ruleId: a, reason: "malformed", detail: "missing when/encode/scope" });
|
|
443
|
-
continue;
|
|
444
|
-
}
|
|
445
|
-
if (!n.types.has(c.type)) {
|
|
446
|
-
o.push({ ruleId: a, reason: "unknown-condition", detail: String(c.type) });
|
|
447
|
-
continue;
|
|
448
|
-
}
|
|
449
|
-
if (!n.encoders.has(l.kind)) {
|
|
450
|
-
o.push({ ruleId: a, reason: "unknown-encoder", detail: String(l.kind) });
|
|
451
|
-
continue;
|
|
452
|
-
}
|
|
453
|
-
const d = s.style;
|
|
454
|
-
if (B(d) && !n.styles.has(d.ref)) {
|
|
455
|
-
o.push({ ruleId: a, reason: "unknown-style", detail: d.ref });
|
|
456
|
-
continue;
|
|
457
|
-
}
|
|
458
|
-
r.push(s);
|
|
459
|
-
}
|
|
460
|
-
return { rules: r, skipped: o };
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
function Se(e) {
|
|
464
|
-
return JSON.stringify({ v: M, rules: e });
|
|
465
|
-
}
|
|
466
|
-
class $e {
|
|
467
|
-
constructor(t = []) {
|
|
468
|
-
this.byColumn = /* @__PURE__ */ new Map(), this.all = [];
|
|
469
|
-
for (const n of t) this.add(n);
|
|
470
|
-
}
|
|
471
|
-
add(t) {
|
|
472
|
-
this.all.push(t);
|
|
473
|
-
const n = this.byColumn.get(t.scope.columnId) ?? [];
|
|
474
|
-
n.push(t), this.byColumn.set(t.scope.columnId, n);
|
|
475
|
-
}
|
|
476
|
-
rulesFor(t) {
|
|
477
|
-
return this.byColumn.get(t) ?? [];
|
|
478
|
-
}
|
|
479
|
-
list() {
|
|
480
|
-
return this.all;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
class De {
|
|
484
|
-
constructor(t, n = ne(), r = j(), o) {
|
|
485
|
-
this.rules = t, this.encoders = n, this.ruleTypes = r, this.evaluator = o ?? new G(r);
|
|
486
|
-
}
|
|
487
|
-
get lineage() {
|
|
488
|
-
return this;
|
|
489
|
-
}
|
|
490
|
-
paintFor(t, n, r, o, i) {
|
|
491
|
-
const s = this.evaluator.evaluate(this.rules.rulesFor(t.columnId), t, n, i), a = [];
|
|
492
|
-
if (s.background) {
|
|
493
|
-
const c = this.encoders.get(s.background.encode.kind);
|
|
494
|
-
c && a.push(c.encode(s.background, r, o));
|
|
495
|
-
}
|
|
496
|
-
for (const c of s.decorators) {
|
|
497
|
-
const l = this.encoders.get(c.encode.kind);
|
|
498
|
-
l && a.push(l.encode(c, r, o));
|
|
499
|
-
}
|
|
500
|
-
return a;
|
|
501
|
-
}
|
|
502
|
-
statsNeedsFor(t) {
|
|
503
|
-
const n = /* @__PURE__ */ new Set();
|
|
504
|
-
for (const r of this.rules.rulesFor(t)) {
|
|
505
|
-
const o = this.ruleTypes.get(r.when.type);
|
|
506
|
-
if (o) for (const i of o.needs) n.add(i);
|
|
507
|
-
}
|
|
508
|
-
return [...n].sort();
|
|
509
|
-
}
|
|
510
|
-
explain(t, n, r, o) {
|
|
511
|
-
const i = this.evaluator.evaluate(n, t, r, o), s = [];
|
|
512
|
-
i.background && s.push(i.background.lineage);
|
|
513
|
-
for (const a of i.decorators) s.push(a.lineage);
|
|
514
|
-
return s.sort((a, c) => a.priority - c.priority);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
export {
|
|
518
|
-
P as AA_BODY,
|
|
519
|
-
Y as BUILTIN_PREDICATES,
|
|
520
|
-
Q as BarEncoder,
|
|
521
|
-
De as CFEngine,
|
|
522
|
-
$e as CFRuleStore,
|
|
523
|
-
M as CF_SCHEMA_VERSION,
|
|
524
|
-
G as DefaultCFEvaluator,
|
|
525
|
-
Oe as DefaultCFRuleLoader,
|
|
526
|
-
J as DefaultInkResolver,
|
|
527
|
-
ee as IconEncoder,
|
|
528
|
-
$ as NEUTRAL_MIDPOINT,
|
|
529
|
-
Z as ScaleEncoder,
|
|
530
|
-
te as SparklineEncoder,
|
|
531
|
-
ie as cfRuleEquals,
|
|
532
|
-
ae as computeColumnStats,
|
|
533
|
-
U as computeDatum,
|
|
534
|
-
ne as createEncoderRegistry,
|
|
535
|
-
Ne as createNamedStyleRegistry,
|
|
536
|
-
j as createRuleTypeRegistry,
|
|
537
|
-
H as divergingBands,
|
|
538
|
-
E as divergingColor,
|
|
539
|
-
B as isStyleRef,
|
|
540
|
-
Ce as passesInkGate,
|
|
541
|
-
L as scopeMatches,
|
|
542
|
-
A as sequentialBands,
|
|
543
|
-
R as sequentialColor,
|
|
544
|
-
Se as serializeRules,
|
|
545
|
-
q as snapshotStats,
|
|
546
|
-
oe as staticAppearanceView
|
|
547
|
-
};
|
|
548
|
-
//# sourceMappingURL=index-DrCPRuYi.js.map
|