@updog/data-editor-wc 0.1.44 → 0.1.45
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/index.d.ts +8 -2
- package/index.js +152 -81
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1306,14 +1306,20 @@ type DataEditorBaseProps<TRow extends DataEditorRow = DataEditorRow> = {
|
|
|
1306
1306
|
*/
|
|
1307
1307
|
onValueMatch?: (valuesToMatch: Record<string, ValueMatchInput>) => ValueMatchOutput | Promise<ValueMatchOutput>;
|
|
1308
1308
|
/**
|
|
1309
|
-
* Extra synonyms
|
|
1310
|
-
*
|
|
1309
|
+
* Extra synonyms layered on top of the built-ins for both column matching
|
|
1310
|
+
* (header vs column) and value matching (imported value vs select option).
|
|
1311
|
+
* Each key is the canonical target (a column ID/title, or a select option
|
|
1312
|
+
* value); the array lists aliases the matching engine should treat as
|
|
1313
|
+
* equivalent. Merged with the built-ins as a union per key.
|
|
1311
1314
|
*
|
|
1312
1315
|
* @example
|
|
1313
1316
|
* ```ts
|
|
1314
1317
|
* synonyms={{
|
|
1318
|
+
* // column aliases
|
|
1315
1319
|
* productSku: ["sku", "article_no", "item_code"],
|
|
1316
1320
|
* firstName: ["first", "given_name", "fname"],
|
|
1321
|
+
* // value aliases (e.g. for a "status" select)
|
|
1322
|
+
* Active: ["live", "enabled"],
|
|
1317
1323
|
* }}
|
|
1318
1324
|
* ```
|
|
1319
1325
|
*/
|
package/index.js
CHANGED
|
@@ -45610,77 +45610,7 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
45610
45610
|
]
|
|
45611
45611
|
})]
|
|
45612
45612
|
});
|
|
45613
|
-
}, Sj =
|
|
45614
|
-
let n = new Set(wj(e)), r = new Set(wj(t));
|
|
45615
|
-
if (n.size === 0 || r.size === 0) return 0;
|
|
45616
|
-
let i = 0;
|
|
45617
|
-
for (let e of n) r.has(e) && i++;
|
|
45618
|
-
return i / Math.max(n.size, r.size);
|
|
45619
|
-
}, Ej = (e, t) => {
|
|
45620
|
-
if (e.length === 0) return t.length;
|
|
45621
|
-
if (t.length === 0) return e.length;
|
|
45622
|
-
e.length > t.length && ([e, t] = [t, e]);
|
|
45623
|
-
let n = e.length, r = t.length, i = Array(n + 1);
|
|
45624
|
-
for (let e = 0; e <= n; e++) i[e] = e;
|
|
45625
|
-
for (let a = 1; a <= r; a++) {
|
|
45626
|
-
let r = i[0];
|
|
45627
|
-
i[0] = a;
|
|
45628
|
-
for (let o = 1; o <= n; o++) {
|
|
45629
|
-
let n = e[o - 1] === t[a - 1] ? 0 : 1, s = i[o];
|
|
45630
|
-
i[o] = Math.min(i[o] + 1, i[o - 1] + 1, r + n), r = s;
|
|
45631
|
-
}
|
|
45632
|
-
}
|
|
45633
|
-
return i[n];
|
|
45634
|
-
}, Dj = (e) => e <= 4 ? 1 : e <= 8 ? 2 : e <= 15 ? 3 : 4, Oj = (e, t) => {
|
|
45635
|
-
let n = Math.max(e.length, t.length);
|
|
45636
|
-
if (n === 0) return !0;
|
|
45637
|
-
let r = Dj(n);
|
|
45638
|
-
return Ej(e, t) <= r;
|
|
45639
|
-
}, kj = (e, t) => {
|
|
45640
|
-
let n = Cj(e), r = Cj(t);
|
|
45641
|
-
return (n.length <= r.length ? n : r).length < 4 ? !1 : n.includes(r) || r.includes(n);
|
|
45642
|
-
}, Aj = (e, t, n) => {
|
|
45643
|
-
let r = Cj(e), i = Cj(t);
|
|
45644
|
-
for (let [e, t] of Object.entries(n)) {
|
|
45645
|
-
let n = [e, ...t], a = n.includes(r), o = n.includes(i);
|
|
45646
|
-
if (a && o) return !0;
|
|
45647
|
-
}
|
|
45648
|
-
return !1;
|
|
45649
|
-
}, jj = (e, t, n) => {
|
|
45650
|
-
let r = Cj(e), i = Cj(t);
|
|
45651
|
-
if (r === i) return 100;
|
|
45652
|
-
if (n && Aj(e, t, n)) return 90;
|
|
45653
|
-
if (kj(e, t)) return 80;
|
|
45654
|
-
let a = Tj(e, t);
|
|
45655
|
-
return a >= .5 ? 70 : Oj(r, i) ? 65 : a > 0 ? Math.round(a * 60) : 0;
|
|
45656
|
-
}, Mj = (e, t, n, r) => {
|
|
45657
|
-
let i = jj(e, t, r), a = jj(e, n, r);
|
|
45658
|
-
return Math.max(i, a);
|
|
45659
|
-
}, Nj = (e, t, n = Sj) => {
|
|
45660
|
-
let r, i = 0;
|
|
45661
|
-
for (let n of t) {
|
|
45662
|
-
let t = jj(e, n);
|
|
45663
|
-
t > i && (i = t, r = n);
|
|
45664
|
-
}
|
|
45665
|
-
return i >= n ? r : void 0;
|
|
45666
|
-
}, Pj = (e) => {
|
|
45667
|
-
let t = {};
|
|
45668
|
-
for (let [n, { importedValues: r, options: i }] of Object.entries(e)) {
|
|
45669
|
-
let e = {};
|
|
45670
|
-
for (let t of r) e[t] = Nj(t, i);
|
|
45671
|
-
t[n] = e;
|
|
45672
|
-
}
|
|
45673
|
-
return t;
|
|
45674
|
-
}, Fj = async (e, t) => {
|
|
45675
|
-
if (!t) return Pj(e);
|
|
45676
|
-
let n = await t(e), r = {};
|
|
45677
|
-
for (let [t, { importedValues: i, options: a }] of Object.entries(e)) {
|
|
45678
|
-
let e = n[t], o = {};
|
|
45679
|
-
for (let t of i) e && t in e ? o[t] = e[t] ?? void 0 : o[t] = Nj(t, a);
|
|
45680
|
-
r[t] = o;
|
|
45681
|
-
}
|
|
45682
|
-
return r;
|
|
45683
|
-
}, Ij = "action:create", Lj = {
|
|
45613
|
+
}, Sj = {
|
|
45684
45614
|
prefix: ["salutation", "honorific"],
|
|
45685
45615
|
firstname: [
|
|
45686
45616
|
"fname",
|
|
@@ -45876,7 +45806,9 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
45876
45806
|
"supervisor",
|
|
45877
45807
|
"linemanager",
|
|
45878
45808
|
"reportingmanager",
|
|
45879
|
-
"managername"
|
|
45809
|
+
"managername",
|
|
45810
|
+
"mgr",
|
|
45811
|
+
"mngr"
|
|
45880
45812
|
],
|
|
45881
45813
|
managerid: [
|
|
45882
45814
|
"supervisorid",
|
|
@@ -46207,8 +46139,76 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
46207
46139
|
"languagespoken",
|
|
46208
46140
|
"nativelanguage",
|
|
46209
46141
|
"languageproficiency"
|
|
46210
|
-
]
|
|
46211
|
-
|
|
46142
|
+
],
|
|
46143
|
+
male: [
|
|
46144
|
+
"m",
|
|
46145
|
+
"man",
|
|
46146
|
+
"boy"
|
|
46147
|
+
],
|
|
46148
|
+
female: [
|
|
46149
|
+
"f",
|
|
46150
|
+
"woman",
|
|
46151
|
+
"girl"
|
|
46152
|
+
],
|
|
46153
|
+
other: [
|
|
46154
|
+
"nonbinary",
|
|
46155
|
+
"nb",
|
|
46156
|
+
"diverse",
|
|
46157
|
+
"prefernottosay"
|
|
46158
|
+
],
|
|
46159
|
+
junior: [
|
|
46160
|
+
"jr",
|
|
46161
|
+
"jun",
|
|
46162
|
+
"entry",
|
|
46163
|
+
"entrylevel",
|
|
46164
|
+
"grad",
|
|
46165
|
+
"graduate"
|
|
46166
|
+
],
|
|
46167
|
+
midlevel: [
|
|
46168
|
+
"mid",
|
|
46169
|
+
"intermediate",
|
|
46170
|
+
"middle"
|
|
46171
|
+
],
|
|
46172
|
+
senior: ["sr", "sen"],
|
|
46173
|
+
associate: ["assoc", "asc"],
|
|
46174
|
+
principal: ["princ", "principle"],
|
|
46175
|
+
lead: [
|
|
46176
|
+
"teamlead",
|
|
46177
|
+
"techlead",
|
|
46178
|
+
"tl"
|
|
46179
|
+
],
|
|
46180
|
+
director: ["dir"],
|
|
46181
|
+
executive: ["exec"],
|
|
46182
|
+
intern: ["internship", "trainee"],
|
|
46183
|
+
fulltime: ["ft", "full"],
|
|
46184
|
+
parttime: ["pt", "part"],
|
|
46185
|
+
contract: [
|
|
46186
|
+
"contractor",
|
|
46187
|
+
"contractual",
|
|
46188
|
+
"freelance",
|
|
46189
|
+
"freelancer"
|
|
46190
|
+
],
|
|
46191
|
+
temporary: ["temp"],
|
|
46192
|
+
permanent: ["perm"],
|
|
46193
|
+
active: ["enabled", "current"],
|
|
46194
|
+
inactive: [
|
|
46195
|
+
"disabled",
|
|
46196
|
+
"terminated",
|
|
46197
|
+
"former"
|
|
46198
|
+
],
|
|
46199
|
+
onleave: ["leave"],
|
|
46200
|
+
pending: ["awaiting"],
|
|
46201
|
+
single: ["unmarried"],
|
|
46202
|
+
married: ["wed"],
|
|
46203
|
+
divorced: ["div"],
|
|
46204
|
+
widowed: ["widow", "widower"],
|
|
46205
|
+
low: ["lo"],
|
|
46206
|
+
medium: ["med"],
|
|
46207
|
+
high: ["hi"],
|
|
46208
|
+
critical: ["crit", "urgent"],
|
|
46209
|
+
yes: ["y", "true"],
|
|
46210
|
+
no: ["n", "false"]
|
|
46211
|
+
}, Cj = (e, t) => {
|
|
46212
46212
|
if (!t) return e;
|
|
46213
46213
|
let n = { ...e };
|
|
46214
46214
|
for (let [e, r] of Object.entries(t)) if (e in n) {
|
|
@@ -46217,7 +46217,77 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
46217
46217
|
n[e] = [...t];
|
|
46218
46218
|
} else n[e] = r;
|
|
46219
46219
|
return n;
|
|
46220
|
-
},
|
|
46220
|
+
}, wj = 60, Tj = (e) => e.toLowerCase().replace(/[\s_\-.]+/g, "").trim(), Ej = (e) => e.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[\s_\-.]+/g, " ").toLowerCase().split(" ").filter(Boolean), Dj = (e, t) => {
|
|
46221
|
+
let n = new Set(Ej(e)), r = new Set(Ej(t));
|
|
46222
|
+
if (n.size === 0 || r.size === 0) return 0;
|
|
46223
|
+
let i = 0;
|
|
46224
|
+
for (let e of n) r.has(e) && i++;
|
|
46225
|
+
return i / Math.max(n.size, r.size);
|
|
46226
|
+
}, Oj = (e, t) => {
|
|
46227
|
+
if (e.length === 0) return t.length;
|
|
46228
|
+
if (t.length === 0) return e.length;
|
|
46229
|
+
e.length > t.length && ([e, t] = [t, e]);
|
|
46230
|
+
let n = e.length, r = t.length, i = Array(n + 1);
|
|
46231
|
+
for (let e = 0; e <= n; e++) i[e] = e;
|
|
46232
|
+
for (let a = 1; a <= r; a++) {
|
|
46233
|
+
let r = i[0];
|
|
46234
|
+
i[0] = a;
|
|
46235
|
+
for (let o = 1; o <= n; o++) {
|
|
46236
|
+
let n = e[o - 1] === t[a - 1] ? 0 : 1, s = i[o];
|
|
46237
|
+
i[o] = Math.min(i[o] + 1, i[o - 1] + 1, r + n), r = s;
|
|
46238
|
+
}
|
|
46239
|
+
}
|
|
46240
|
+
return i[n];
|
|
46241
|
+
}, kj = (e) => e <= 4 ? 1 : e <= 8 ? 2 : e <= 15 ? 3 : 4, Aj = (e, t) => {
|
|
46242
|
+
let n = Math.max(e.length, t.length);
|
|
46243
|
+
if (n === 0) return !0;
|
|
46244
|
+
let r = kj(n);
|
|
46245
|
+
return Oj(e, t) <= r;
|
|
46246
|
+
}, jj = (e, t) => {
|
|
46247
|
+
let n = Tj(e), r = Tj(t);
|
|
46248
|
+
return (n.length <= r.length ? n : r).length < 4 ? !1 : n.includes(r) || r.includes(n);
|
|
46249
|
+
}, Mj = (e, t, n) => {
|
|
46250
|
+
let r = Tj(e), i = Tj(t);
|
|
46251
|
+
for (let [e, t] of Object.entries(n)) {
|
|
46252
|
+
let n = [e, ...t], a = n.includes(r), o = n.includes(i);
|
|
46253
|
+
if (a && o) return !0;
|
|
46254
|
+
}
|
|
46255
|
+
return !1;
|
|
46256
|
+
}, Nj = (e, t, n) => {
|
|
46257
|
+
let r = Tj(e), i = Tj(t);
|
|
46258
|
+
if (r === i) return 100;
|
|
46259
|
+
if (n && Mj(e, t, n)) return 90;
|
|
46260
|
+
if (jj(e, t)) return 80;
|
|
46261
|
+
let a = Dj(e, t);
|
|
46262
|
+
return a >= .5 ? 70 : Aj(r, i) ? 65 : a > 0 ? Math.round(a * 60) : 0;
|
|
46263
|
+
}, Pj = (e, t, n, r) => {
|
|
46264
|
+
let i = Nj(e, t, r), a = Nj(e, n, r);
|
|
46265
|
+
return Math.max(i, a);
|
|
46266
|
+
}, Fj = (e, t, n = Sj, r = wj) => {
|
|
46267
|
+
let i, a = 0;
|
|
46268
|
+
for (let r of t) {
|
|
46269
|
+
let t = Nj(e, r, n);
|
|
46270
|
+
t > a && (a = t, i = r);
|
|
46271
|
+
}
|
|
46272
|
+
return a >= r ? i : void 0;
|
|
46273
|
+
}, Ij = (e, t) => {
|
|
46274
|
+
let n = Cj(Sj, t), r = {};
|
|
46275
|
+
for (let [t, { importedValues: i, options: a }] of Object.entries(e)) {
|
|
46276
|
+
let e = {};
|
|
46277
|
+
for (let t of i) e[t] = Fj(t, a, n);
|
|
46278
|
+
r[t] = e;
|
|
46279
|
+
}
|
|
46280
|
+
return r;
|
|
46281
|
+
}, Lj = async (e, t, n) => {
|
|
46282
|
+
if (!t) return Ij(e, n);
|
|
46283
|
+
let r = Cj(Sj, n), i = await t(e), a = {};
|
|
46284
|
+
for (let [t, { importedValues: n, options: o }] of Object.entries(e)) {
|
|
46285
|
+
let e = i[t], s = {};
|
|
46286
|
+
for (let t of n) e && t in e ? s[t] = e[t] ?? void 0 : s[t] = Fj(t, o, r);
|
|
46287
|
+
a[t] = s;
|
|
46288
|
+
}
|
|
46289
|
+
return a;
|
|
46290
|
+
}, Rj = "action:create", zj = (e, t, n) => Pj(e, t.id, t.title, n), Bj = (e, t, n, r, i = 60) => {
|
|
46221
46291
|
let a = null, o = 0;
|
|
46222
46292
|
for (let i of t) {
|
|
46223
46293
|
if (n.has(i.id)) continue;
|
|
@@ -46237,13 +46307,13 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
46237
46307
|
...s
|
|
46238
46308
|
};
|
|
46239
46309
|
}, Hj = (e, t, n) => {
|
|
46240
|
-
let r =
|
|
46310
|
+
let r = Cj(Sj, n), i = {}, a = /* @__PURE__ */ new Set();
|
|
46241
46311
|
for (let n of e) {
|
|
46242
|
-
let e =
|
|
46312
|
+
let e = Tj(n);
|
|
46243
46313
|
for (let r of t) {
|
|
46244
46314
|
let t = r.id;
|
|
46245
46315
|
if (a.has(t)) continue;
|
|
46246
|
-
let o =
|
|
46316
|
+
let o = Tj(t), s = Tj(r.title);
|
|
46247
46317
|
if (e === o || e === s) {
|
|
46248
46318
|
i[n] = t, a.add(t);
|
|
46249
46319
|
break;
|
|
@@ -46368,7 +46438,7 @@ var sj = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, O.jsx)(at, {
|
|
|
46368
46438
|
id: `${r}_d`,
|
|
46369
46439
|
type: "divider"
|
|
46370
46440
|
}, {
|
|
46371
|
-
id:
|
|
46441
|
+
id: Rj,
|
|
46372
46442
|
text: a,
|
|
46373
46443
|
icon: /* @__PURE__ */ (0, O.jsx)(Ae, { size: "1rem" })
|
|
46374
46444
|
}), [r, c];
|
|
@@ -47458,14 +47528,15 @@ function PM() {
|
|
|
47458
47528
|
return;
|
|
47459
47529
|
}
|
|
47460
47530
|
let t = ++Ne.current;
|
|
47461
|
-
|
|
47531
|
+
Lj(e, c, l).then((e) => {
|
|
47462
47532
|
Ne.current === t && Me(e);
|
|
47463
47533
|
});
|
|
47464
47534
|
}, [
|
|
47465
47535
|
_,
|
|
47466
47536
|
b,
|
|
47467
47537
|
n,
|
|
47468
|
-
c
|
|
47538
|
+
c,
|
|
47539
|
+
l
|
|
47469
47540
|
]);
|
|
47470
47541
|
let Pe = (0, y.useMemo)(() => {
|
|
47471
47542
|
let e = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updog/data-editor-wc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
4
4
|
"description": "Client-side CSV importer and spreadsheet editor as a Web Component. Drop into Vue, Angular, Svelte, or vanilla JS. Import CSV, Excel, JSON; edit 1M+ rows entirely in the browser.",
|
|
5
5
|
"author": "Mikhail Kutateladze <admin@updog.tech>",
|
|
6
6
|
"homepage": "https://updog.tech",
|