@updog/data-editor-wc 0.1.1 → 0.1.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/index.d.ts +1 -0
- package/index.js +26 -20
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -375,6 +375,7 @@ declare var export_default = {
|
|
|
375
375
|
invalidEmail: "Invalid email address",
|
|
376
376
|
invalidDate: "Invalid date",
|
|
377
377
|
endDateBeforeStart: "End date must be after start date",
|
|
378
|
+
valueMustBeUnique: "Value must be unique",
|
|
378
379
|
},
|
|
379
380
|
license: {
|
|
380
381
|
loading: "Loading data editor",
|
package/index.js
CHANGED
|
@@ -8347,7 +8347,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
8347
8347
|
invalidNumber: "Invalid number",
|
|
8348
8348
|
invalidEmail: "Invalid email address",
|
|
8349
8349
|
invalidDate: "Invalid date",
|
|
8350
|
-
endDateBeforeStart: "End date must be after start date"
|
|
8350
|
+
endDateBeforeStart: "End date must be after start date",
|
|
8351
|
+
valueMustBeUnique: "Value must be unique"
|
|
8351
8352
|
},
|
|
8352
8353
|
license: {
|
|
8353
8354
|
loading: "Loading data editor",
|
|
@@ -21128,9 +21129,10 @@ var pd = {
|
|
|
21128
21129
|
columns;
|
|
21129
21130
|
skipUniqueness;
|
|
21130
21131
|
errorHandler;
|
|
21132
|
+
uniqueMessage;
|
|
21131
21133
|
uniqueIndex = /* @__PURE__ */ new Map();
|
|
21132
|
-
constructor(e, t, n) {
|
|
21133
|
-
this.store = e, this.columns = t, this.skipUniqueness = e.isServer(), this.errorHandler = n ?? null;
|
|
21134
|
+
constructor(e, t, n, r = "Value must be unique") {
|
|
21135
|
+
this.store = e, this.columns = t, this.skipUniqueness = e.isServer(), this.errorHandler = n ?? null, this.uniqueMessage = r;
|
|
21134
21136
|
}
|
|
21135
21137
|
getValidators(e) {
|
|
21136
21138
|
return e.validate ? Array.isArray(e.validate) ? e.validate : [e.validate] : [];
|
|
@@ -21150,16 +21152,16 @@ var pd = {
|
|
|
21150
21152
|
return null;
|
|
21151
21153
|
}
|
|
21152
21154
|
getUniquenessError(e, t, n) {
|
|
21153
|
-
return t == null || t === "" || !this.indexHasDuplicate(e, t, n) ? null : {
|
|
21155
|
+
return t == null || t === "" || !this.indexHasDuplicate(e.id, t, n) ? null : {
|
|
21154
21156
|
level: "error",
|
|
21155
|
-
message:
|
|
21157
|
+
message: this.uniqueMessage
|
|
21156
21158
|
};
|
|
21157
21159
|
}
|
|
21158
21160
|
getCellError(e, t, n, r) {
|
|
21159
21161
|
let i = n[t.id], a = this.getCustomError(t, i, n);
|
|
21160
21162
|
if (a) return [a];
|
|
21161
21163
|
if (r && t.unique) {
|
|
21162
|
-
let n = this.getUniquenessError(t
|
|
21164
|
+
let n = this.getUniquenessError(t, i, e);
|
|
21163
21165
|
if (n) return [n];
|
|
21164
21166
|
}
|
|
21165
21167
|
return null;
|
|
@@ -21213,7 +21215,7 @@ var pd = {
|
|
|
21213
21215
|
if (this.skipUniqueness) return;
|
|
21214
21216
|
let e = {
|
|
21215
21217
|
level: "error",
|
|
21216
|
-
message:
|
|
21218
|
+
message: this.uniqueMessage
|
|
21217
21219
|
}, t = 0;
|
|
21218
21220
|
for (let [n, r] of this.uniqueIndex) for (let [, i] of r) if (i.size > 1) for (let r of i) this.store.getCellValidation(r, n) || this.store.setCellValidation(r, n, [e]), t++, t % 5e4 == 0 && await new Promise((e) => setTimeout(e, 0));
|
|
21219
21221
|
this.store.notify(), this.store.syncWorkerFlags();
|
|
@@ -21546,12 +21548,16 @@ function Cd(e, t) {
|
|
|
21546
21548
|
//#endregion
|
|
21547
21549
|
//#region src/context/useValidation.tsx
|
|
21548
21550
|
function wd(e, t, n, r) {
|
|
21549
|
-
let i = (0, _.useMemo)(() => new hd(e, t, e.errorHandler
|
|
21550
|
-
|
|
21551
|
-
|
|
21552
|
-
|
|
21553
|
-
|
|
21554
|
-
|
|
21551
|
+
let { t: i } = k(), a = i("dataEditor.validation.valueMustBeUnique"), o = (0, _.useMemo)(() => new hd(e, t, e.errorHandler, a), [
|
|
21552
|
+
e,
|
|
21553
|
+
t,
|
|
21554
|
+
a
|
|
21555
|
+
]), s = (0, _.useRef)(o);
|
|
21556
|
+
s.current = o, (0, _.useEffect)(() => {
|
|
21557
|
+
e.setValidator(o);
|
|
21558
|
+
}, [e, o]);
|
|
21559
|
+
let c = (0, _.useMemo)(() => {
|
|
21560
|
+
if (e.isClient()) return new dd(e, o, t, e.errorHandler);
|
|
21555
21561
|
if (n) {
|
|
21556
21562
|
let i = new md(e, t, n, {
|
|
21557
21563
|
getFilters: () => e.server.filters,
|
|
@@ -21563,21 +21569,21 @@ function wd(e, t, n, r) {
|
|
|
21563
21569
|
return new ud();
|
|
21564
21570
|
}, [
|
|
21565
21571
|
e,
|
|
21566
|
-
|
|
21572
|
+
o,
|
|
21567
21573
|
t,
|
|
21568
21574
|
n,
|
|
21569
21575
|
r
|
|
21570
21576
|
]);
|
|
21571
21577
|
return (0, _.useEffect)(() => () => {
|
|
21578
|
+
c.destroy();
|
|
21579
|
+
}, [c]), (0, _.useEffect)(() => () => {
|
|
21572
21580
|
o.destroy();
|
|
21573
21581
|
}, [o]), (0, _.useEffect)(() => () => {
|
|
21574
|
-
i.destroy();
|
|
21575
|
-
}, [i]), (0, _.useEffect)(() => () => {
|
|
21576
21582
|
e.destroy();
|
|
21577
21583
|
}, [e]), {
|
|
21578
|
-
validator:
|
|
21579
|
-
validatorRef:
|
|
21580
|
-
findReplace:
|
|
21584
|
+
validator: o,
|
|
21585
|
+
validatorRef: s,
|
|
21586
|
+
findReplace: c
|
|
21581
21587
|
};
|
|
21582
21588
|
}
|
|
21583
21589
|
//#endregion
|
|
@@ -39541,7 +39547,7 @@ var AN = ({ text: e, onSelect: t }) => /* @__PURE__ */ (0, E.jsx)(tt, {
|
|
|
39541
39547
|
onClick: (0, _.useCallback)(() => {
|
|
39542
39548
|
t(e);
|
|
39543
39549
|
}, [e, t]),
|
|
39544
|
-
startIcon: /* @__PURE__ */ (0, E.jsx)(H, {}),
|
|
39550
|
+
startIcon: /* @__PURE__ */ (0, E.jsx)(H, { className: "rtl-mirror" }),
|
|
39545
39551
|
children: e
|
|
39546
39552
|
}), jN = "1.375rem", MN = () => {
|
|
39547
39553
|
let { t: e } = k(), { emptyTitle: t, suggestionsCount: n, suggestionsPhase: r, suggestions: i, onSelectSuggestion: a } = kN();
|
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.2",
|
|
4
4
|
"description": "Web Component wrapper for @updog/data-editor. Framework-agnostic, zero dependencies.",
|
|
5
5
|
"author": "Mikhail Kutateladze <admin@updog.tech>",
|
|
6
6
|
"homepage": "https://updog.tech",
|