@updog/data-editor 0.1.1 → 0.1.3
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
|
@@ -377,6 +377,7 @@ declare var export_default = {
|
|
|
377
377
|
invalidEmail: "Invalid email address",
|
|
378
378
|
invalidDate: "Invalid date",
|
|
379
379
|
endDateBeforeStart: "End date must be after start date",
|
|
380
|
+
valueMustBeUnique: "Value must be unique",
|
|
380
381
|
},
|
|
381
382
|
license: {
|
|
382
383
|
loading: "Loading data editor",
|
package/index.js
CHANGED
|
@@ -356,7 +356,8 @@ var Gr = {
|
|
|
356
356
|
invalidNumber: "Invalid number",
|
|
357
357
|
invalidEmail: "Invalid email address",
|
|
358
358
|
invalidDate: "Invalid date",
|
|
359
|
-
endDateBeforeStart: "End date must be after start date"
|
|
359
|
+
endDateBeforeStart: "End date must be after start date",
|
|
360
|
+
valueMustBeUnique: "Value must be unique"
|
|
360
361
|
},
|
|
361
362
|
license: {
|
|
362
363
|
loading: "Loading data editor",
|
|
@@ -9080,9 +9081,10 @@ var Ic = {
|
|
|
9080
9081
|
columns;
|
|
9081
9082
|
skipUniqueness;
|
|
9082
9083
|
errorHandler;
|
|
9084
|
+
uniqueMessage;
|
|
9083
9085
|
uniqueIndex = /* @__PURE__ */ new Map();
|
|
9084
|
-
constructor(e, t, n) {
|
|
9085
|
-
this.store = e, this.columns = t, this.skipUniqueness = e.isServer(), this.errorHandler = n ?? null;
|
|
9086
|
+
constructor(e, t, n, r = "Value must be unique") {
|
|
9087
|
+
this.store = e, this.columns = t, this.skipUniqueness = e.isServer(), this.errorHandler = n ?? null, this.uniqueMessage = r;
|
|
9086
9088
|
}
|
|
9087
9089
|
getValidators(e) {
|
|
9088
9090
|
return e.validate ? Array.isArray(e.validate) ? e.validate : [e.validate] : [];
|
|
@@ -9102,16 +9104,16 @@ var Ic = {
|
|
|
9102
9104
|
return null;
|
|
9103
9105
|
}
|
|
9104
9106
|
getUniquenessError(e, t, n) {
|
|
9105
|
-
return t == null || t === "" || !this.indexHasDuplicate(e, t, n) ? null : {
|
|
9107
|
+
return t == null || t === "" || !this.indexHasDuplicate(e.id, t, n) ? null : {
|
|
9106
9108
|
level: "error",
|
|
9107
|
-
message:
|
|
9109
|
+
message: this.uniqueMessage
|
|
9108
9110
|
};
|
|
9109
9111
|
}
|
|
9110
9112
|
getCellError(e, t, n, r) {
|
|
9111
9113
|
let i = n[t.id], a = this.getCustomError(t, i, n);
|
|
9112
9114
|
if (a) return [a];
|
|
9113
9115
|
if (r && t.unique) {
|
|
9114
|
-
let n = this.getUniquenessError(t
|
|
9116
|
+
let n = this.getUniquenessError(t, i, e);
|
|
9115
9117
|
if (n) return [n];
|
|
9116
9118
|
}
|
|
9117
9119
|
return null;
|
|
@@ -9165,7 +9167,7 @@ var Ic = {
|
|
|
9165
9167
|
if (this.skipUniqueness) return;
|
|
9166
9168
|
let e = {
|
|
9167
9169
|
level: "error",
|
|
9168
|
-
message:
|
|
9170
|
+
message: this.uniqueMessage
|
|
9169
9171
|
}, t = 0;
|
|
9170
9172
|
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));
|
|
9171
9173
|
this.store.notify(), this.store.syncWorkerFlags();
|
|
@@ -9498,12 +9500,16 @@ function Kc(e, t) {
|
|
|
9498
9500
|
//#endregion
|
|
9499
9501
|
//#region src/context/useValidation.tsx
|
|
9500
9502
|
function qc(e, t, n, r) {
|
|
9501
|
-
let i = v(() => new Rc(e, t, e.errorHandler
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9503
|
+
let { t: i } = q(), a = i("dataEditor.validation.valueMustBeUnique"), o = v(() => new Rc(e, t, e.errorHandler, a), [
|
|
9504
|
+
e,
|
|
9505
|
+
t,
|
|
9506
|
+
a
|
|
9507
|
+
]), s = y(o);
|
|
9508
|
+
s.current = o, m(() => {
|
|
9509
|
+
e.setValidator(o);
|
|
9510
|
+
}, [e, o]);
|
|
9511
|
+
let c = v(() => {
|
|
9512
|
+
if (e.isClient()) return new Pc(e, o, t, e.errorHandler);
|
|
9507
9513
|
if (n) {
|
|
9508
9514
|
let i = new Lc(e, t, n, {
|
|
9509
9515
|
getFilters: () => e.server.filters,
|
|
@@ -9515,21 +9521,21 @@ function qc(e, t, n, r) {
|
|
|
9515
9521
|
return new Nc();
|
|
9516
9522
|
}, [
|
|
9517
9523
|
e,
|
|
9518
|
-
|
|
9524
|
+
o,
|
|
9519
9525
|
t,
|
|
9520
9526
|
n,
|
|
9521
9527
|
r
|
|
9522
9528
|
]);
|
|
9523
9529
|
return m(() => () => {
|
|
9530
|
+
c.destroy();
|
|
9531
|
+
}, [c]), m(() => () => {
|
|
9524
9532
|
o.destroy();
|
|
9525
9533
|
}, [o]), m(() => () => {
|
|
9526
|
-
i.destroy();
|
|
9527
|
-
}, [i]), m(() => () => {
|
|
9528
9534
|
e.destroy();
|
|
9529
9535
|
}, [e]), {
|
|
9530
|
-
validator:
|
|
9531
|
-
validatorRef:
|
|
9532
|
-
findReplace:
|
|
9536
|
+
validator: o,
|
|
9537
|
+
validatorRef: s,
|
|
9538
|
+
findReplace: c
|
|
9533
9539
|
};
|
|
9534
9540
|
}
|
|
9535
9541
|
//#endregion
|
|
@@ -22618,7 +22624,7 @@ var dC = ({ text: e, onSelect: t }) => /* @__PURE__ */ C(Y, {
|
|
|
22618
22624
|
onClick: f(() => {
|
|
22619
22625
|
t(e);
|
|
22620
22626
|
}, [e, t]),
|
|
22621
|
-
startIcon: /* @__PURE__ */ C(A, {}),
|
|
22627
|
+
startIcon: /* @__PURE__ */ C(A, { className: "rtl-mirror" }),
|
|
22622
22628
|
children: e
|
|
22623
22629
|
}), fC = "1.375rem", pC = () => {
|
|
22624
22630
|
let { t: e } = q(), { emptyTitle: t, suggestionsCount: n, suggestionsPhase: r, suggestions: i, onSelectSuggestion: a } = uC();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updog/data-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Enterprise-grade spreadsheet editor SDK for React. Edit large datasets with validation, undo/redo, CSV/XLSX import, and multi-source merging.",
|
|
5
5
|
"author": "Mikhail Kutateladze <admin@updog.tech>",
|
|
6
6
|
"homepage": "https://updog.tech",
|