@juv/codego-react-ui 3.2.0 → 3.2.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.cjs +42 -40
- package/dist/index.global.js +42 -40
- package/dist/index.js +42 -40
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -6583,7 +6583,6 @@ function DGEditModal({
|
|
|
6583
6583
|
onSuccess,
|
|
6584
6584
|
notif
|
|
6585
6585
|
}) {
|
|
6586
|
-
const { toast } = useToast();
|
|
6587
6586
|
const [form, setForm] = React28.useState(() => {
|
|
6588
6587
|
const init = {};
|
|
6589
6588
|
fields.forEach((f) => {
|
|
@@ -6600,15 +6599,14 @@ function DGEditModal({
|
|
|
6600
6599
|
setError(null);
|
|
6601
6600
|
try {
|
|
6602
6601
|
await import_axios3.default.put(`${baseUrl}/${itemId}/update`, form);
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6602
|
+
const updated = { ...item, ...form };
|
|
6603
|
+
if (notif && (notif.type ?? "toast") === "notification") {
|
|
6604
|
+
setBanner(true);
|
|
6605
|
+
onSuccess?.(updated);
|
|
6606
|
+
} else {
|
|
6607
|
+
onSuccess?.(updated);
|
|
6608
|
+
onClose();
|
|
6609
6609
|
}
|
|
6610
|
-
onSuccess?.({ ...item, ...form });
|
|
6611
|
-
onClose();
|
|
6612
6610
|
} catch (err) {
|
|
6613
6611
|
setError(err?.response?.data?.message ?? err.message ?? "Update failed");
|
|
6614
6612
|
} finally {
|
|
@@ -6660,7 +6658,6 @@ function DGDeleteModal({
|
|
|
6660
6658
|
onSuccess,
|
|
6661
6659
|
notif
|
|
6662
6660
|
}) {
|
|
6663
|
-
const { toast } = useToast();
|
|
6664
6661
|
const [loading, setLoading] = React28.useState(false);
|
|
6665
6662
|
const [error, setError] = React28.useState(null);
|
|
6666
6663
|
const handleDelete = async () => {
|
|
@@ -6668,11 +6665,6 @@ function DGDeleteModal({
|
|
|
6668
6665
|
setError(null);
|
|
6669
6666
|
try {
|
|
6670
6667
|
await import_axios3.default.delete(`${baseUrl}/${itemId}/delete`);
|
|
6671
|
-
if (notif) {
|
|
6672
|
-
if ((notif.type ?? "toast") === "toast") {
|
|
6673
|
-
toast({ variant: notif.deleteVariant ?? "success", title: notif.deleteTitle ?? "Record deleted", description: notif.deleteBody, position: notif.toastPosition });
|
|
6674
|
-
}
|
|
6675
|
-
}
|
|
6676
6668
|
onSuccess?.(item);
|
|
6677
6669
|
onClose();
|
|
6678
6670
|
} catch (err) {
|
|
@@ -6717,6 +6709,7 @@ function DataGrid({
|
|
|
6717
6709
|
defaultActions,
|
|
6718
6710
|
serverPagination
|
|
6719
6711
|
}) {
|
|
6712
|
+
const { toast } = useToast();
|
|
6720
6713
|
const [sortKey, setSortKey] = React28.useState(null);
|
|
6721
6714
|
const [sortDir, setSortDir] = React28.useState(null);
|
|
6722
6715
|
const [filters, setFilters] = React28.useState({});
|
|
@@ -7040,6 +7033,10 @@ function DataGrid({
|
|
|
7040
7033
|
onSuccess: (updated) => {
|
|
7041
7034
|
setTableData((prev) => prev.map((r) => String(r[actionIdKey]) === String(updated[actionIdKey]) ? updated : r));
|
|
7042
7035
|
defaultActions.onSuccess?.("edit", updated);
|
|
7036
|
+
const notif = defaultActions.onSuccessNotif;
|
|
7037
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
7038
|
+
toast({ variant: notif.editVariant ?? "success", title: notif.editTitle ?? "Record updated", description: notif.editBody, position: notif.toastPosition });
|
|
7039
|
+
}
|
|
7043
7040
|
}
|
|
7044
7041
|
}
|
|
7045
7042
|
),
|
|
@@ -7054,6 +7051,10 @@ function DataGrid({
|
|
|
7054
7051
|
onSuccess: (deleted) => {
|
|
7055
7052
|
setTableData((prev) => prev.filter((r) => String(r[actionIdKey]) !== String(deleted[actionIdKey])));
|
|
7056
7053
|
defaultActions.onSuccess?.("delete", deleted);
|
|
7054
|
+
const notif = defaultActions.onSuccessNotif;
|
|
7055
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
7056
|
+
toast({ variant: notif.deleteVariant ?? "success", title: notif.deleteTitle ?? "Record deleted", description: notif.deleteBody, position: notif.toastPosition });
|
|
7057
|
+
}
|
|
7057
7058
|
}
|
|
7058
7059
|
}
|
|
7059
7060
|
)
|
|
@@ -10987,7 +10988,6 @@ function EditModal({
|
|
|
10987
10988
|
onSuccess,
|
|
10988
10989
|
notif
|
|
10989
10990
|
}) {
|
|
10990
|
-
const { toast } = useToast();
|
|
10991
10991
|
const [form, setForm] = React46.useState(() => {
|
|
10992
10992
|
const init = {};
|
|
10993
10993
|
fields.forEach((f) => {
|
|
@@ -11004,20 +11004,14 @@ function EditModal({
|
|
|
11004
11004
|
setError(null);
|
|
11005
11005
|
try {
|
|
11006
11006
|
await import_axios4.default.put(`${baseUrl}/${itemId}/update`, form);
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
});
|
|
11015
|
-
} else {
|
|
11016
|
-
setBanner(true);
|
|
11017
|
-
}
|
|
11007
|
+
const updated = { ...item, ...form };
|
|
11008
|
+
if (notif && (notif.type ?? "toast") === "notification") {
|
|
11009
|
+
setBanner(true);
|
|
11010
|
+
onSuccess?.(updated);
|
|
11011
|
+
} else {
|
|
11012
|
+
onSuccess?.(updated);
|
|
11013
|
+
onClose();
|
|
11018
11014
|
}
|
|
11019
|
-
onSuccess?.({ ...item, ...form });
|
|
11020
|
-
onClose();
|
|
11021
11015
|
} catch (err) {
|
|
11022
11016
|
setError(err?.response?.data?.message ?? err.message ?? "Update failed");
|
|
11023
11017
|
} finally {
|
|
@@ -11076,7 +11070,6 @@ function DeleteModal({
|
|
|
11076
11070
|
onSuccess,
|
|
11077
11071
|
notif
|
|
11078
11072
|
}) {
|
|
11079
|
-
const { toast } = useToast();
|
|
11080
11073
|
const [loading, setLoading] = React46.useState(false);
|
|
11081
11074
|
const [error, setError] = React46.useState(null);
|
|
11082
11075
|
const handleDelete = async () => {
|
|
@@ -11084,16 +11077,6 @@ function DeleteModal({
|
|
|
11084
11077
|
setError(null);
|
|
11085
11078
|
try {
|
|
11086
11079
|
await import_axios4.default.delete(`${baseUrl}/${itemId}/delete`);
|
|
11087
|
-
if (notif) {
|
|
11088
|
-
if ((notif.type ?? "toast") === "toast") {
|
|
11089
|
-
toast({
|
|
11090
|
-
variant: notif.deleteVariant ?? "success",
|
|
11091
|
-
title: notif.deleteTitle ?? "Record deleted",
|
|
11092
|
-
description: notif.deleteBody,
|
|
11093
|
-
position: notif.toastPosition
|
|
11094
|
-
});
|
|
11095
|
-
}
|
|
11096
|
-
}
|
|
11097
11080
|
onSuccess?.(item);
|
|
11098
11081
|
onClose();
|
|
11099
11082
|
} catch (err) {
|
|
@@ -11179,6 +11162,7 @@ function Table({
|
|
|
11179
11162
|
serverPagination,
|
|
11180
11163
|
className
|
|
11181
11164
|
}) {
|
|
11165
|
+
const { toast } = useToast();
|
|
11182
11166
|
const [search, setSearch] = React46.useState("");
|
|
11183
11167
|
const [currentPage, setCurrentPage] = React46.useState(1);
|
|
11184
11168
|
const [selectedIds, setSelectedIds] = React46.useState([]);
|
|
@@ -11600,6 +11584,15 @@ function Table({
|
|
|
11600
11584
|
(prev) => prev.map((r) => String(r[actionIdKey]) === String(updated[actionIdKey]) ? updated : r)
|
|
11601
11585
|
);
|
|
11602
11586
|
defaultActions.onSuccess?.("edit", updated);
|
|
11587
|
+
const notif = defaultActions.onSuccessNotif;
|
|
11588
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
11589
|
+
toast({
|
|
11590
|
+
variant: notif.editVariant ?? "success",
|
|
11591
|
+
title: notif.editTitle ?? "Record updated",
|
|
11592
|
+
description: notif.editBody,
|
|
11593
|
+
position: notif.toastPosition
|
|
11594
|
+
});
|
|
11595
|
+
}
|
|
11603
11596
|
}
|
|
11604
11597
|
}
|
|
11605
11598
|
),
|
|
@@ -11616,6 +11609,15 @@ function Table({
|
|
|
11616
11609
|
(prev) => prev.filter((r) => String(r[actionIdKey]) !== String(deleted[actionIdKey]))
|
|
11617
11610
|
);
|
|
11618
11611
|
defaultActions.onSuccess?.("delete", deleted);
|
|
11612
|
+
const notif = defaultActions.onSuccessNotif;
|
|
11613
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
11614
|
+
toast({
|
|
11615
|
+
variant: notif.deleteVariant ?? "success",
|
|
11616
|
+
title: notif.deleteTitle ?? "Record deleted",
|
|
11617
|
+
description: notif.deleteBody,
|
|
11618
|
+
position: notif.toastPosition
|
|
11619
|
+
});
|
|
11620
|
+
}
|
|
11619
11621
|
}
|
|
11620
11622
|
}
|
|
11621
11623
|
)
|
package/dist/index.global.js
CHANGED
|
@@ -69731,7 +69731,6 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69731
69731
|
onSuccess,
|
|
69732
69732
|
notif
|
|
69733
69733
|
}) {
|
|
69734
|
-
const { toast } = useToast();
|
|
69735
69734
|
const [form, setForm] = React28.useState(() => {
|
|
69736
69735
|
const init = {};
|
|
69737
69736
|
fields.forEach((f) => {
|
|
@@ -69748,15 +69747,14 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69748
69747
|
setError(null);
|
|
69749
69748
|
try {
|
|
69750
69749
|
await axios_default.put(`${baseUrl}/${itemId}/update`, form);
|
|
69751
|
-
|
|
69752
|
-
|
|
69753
|
-
|
|
69754
|
-
|
|
69755
|
-
|
|
69756
|
-
|
|
69750
|
+
const updated = { ...item, ...form };
|
|
69751
|
+
if (notif && (notif.type ?? "toast") === "notification") {
|
|
69752
|
+
setBanner(true);
|
|
69753
|
+
onSuccess?.(updated);
|
|
69754
|
+
} else {
|
|
69755
|
+
onSuccess?.(updated);
|
|
69756
|
+
onClose();
|
|
69757
69757
|
}
|
|
69758
|
-
onSuccess?.({ ...item, ...form });
|
|
69759
|
-
onClose();
|
|
69760
69758
|
} catch (err) {
|
|
69761
69759
|
setError(err?.response?.data?.message ?? err.message ?? "Update failed");
|
|
69762
69760
|
} finally {
|
|
@@ -69808,7 +69806,6 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69808
69806
|
onSuccess,
|
|
69809
69807
|
notif
|
|
69810
69808
|
}) {
|
|
69811
|
-
const { toast } = useToast();
|
|
69812
69809
|
const [loading, setLoading] = React28.useState(false);
|
|
69813
69810
|
const [error, setError] = React28.useState(null);
|
|
69814
69811
|
const handleDelete = async () => {
|
|
@@ -69816,11 +69813,6 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69816
69813
|
setError(null);
|
|
69817
69814
|
try {
|
|
69818
69815
|
await axios_default.delete(`${baseUrl}/${itemId}/delete`);
|
|
69819
|
-
if (notif) {
|
|
69820
|
-
if ((notif.type ?? "toast") === "toast") {
|
|
69821
|
-
toast({ variant: notif.deleteVariant ?? "success", title: notif.deleteTitle ?? "Record deleted", description: notif.deleteBody, position: notif.toastPosition });
|
|
69822
|
-
}
|
|
69823
|
-
}
|
|
69824
69816
|
onSuccess?.(item);
|
|
69825
69817
|
onClose();
|
|
69826
69818
|
} catch (err) {
|
|
@@ -69865,6 +69857,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69865
69857
|
defaultActions,
|
|
69866
69858
|
serverPagination
|
|
69867
69859
|
}) {
|
|
69860
|
+
const { toast } = useToast();
|
|
69868
69861
|
const [sortKey, setSortKey] = React28.useState(null);
|
|
69869
69862
|
const [sortDir, setSortDir] = React28.useState(null);
|
|
69870
69863
|
const [filters, setFilters] = React28.useState({});
|
|
@@ -70188,6 +70181,10 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70188
70181
|
onSuccess: (updated) => {
|
|
70189
70182
|
setTableData((prev) => prev.map((r2) => String(r2[actionIdKey]) === String(updated[actionIdKey]) ? updated : r2));
|
|
70190
70183
|
defaultActions.onSuccess?.("edit", updated);
|
|
70184
|
+
const notif = defaultActions.onSuccessNotif;
|
|
70185
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
70186
|
+
toast({ variant: notif.editVariant ?? "success", title: notif.editTitle ?? "Record updated", description: notif.editBody, position: notif.toastPosition });
|
|
70187
|
+
}
|
|
70191
70188
|
}
|
|
70192
70189
|
}
|
|
70193
70190
|
),
|
|
@@ -70202,6 +70199,10 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70202
70199
|
onSuccess: (deleted) => {
|
|
70203
70200
|
setTableData((prev) => prev.filter((r2) => String(r2[actionIdKey]) !== String(deleted[actionIdKey])));
|
|
70204
70201
|
defaultActions.onSuccess?.("delete", deleted);
|
|
70202
|
+
const notif = defaultActions.onSuccessNotif;
|
|
70203
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
70204
|
+
toast({ variant: notif.deleteVariant ?? "success", title: notif.deleteTitle ?? "Record deleted", description: notif.deleteBody, position: notif.toastPosition });
|
|
70205
|
+
}
|
|
70205
70206
|
}
|
|
70206
70207
|
}
|
|
70207
70208
|
)
|
|
@@ -74547,7 +74548,6 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
74547
74548
|
onSuccess,
|
|
74548
74549
|
notif
|
|
74549
74550
|
}) {
|
|
74550
|
-
const { toast } = useToast();
|
|
74551
74551
|
const [form, setForm] = React48.useState(() => {
|
|
74552
74552
|
const init = {};
|
|
74553
74553
|
fields.forEach((f) => {
|
|
@@ -74564,20 +74564,14 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
74564
74564
|
setError(null);
|
|
74565
74565
|
try {
|
|
74566
74566
|
await axios_default.put(`${baseUrl}/${itemId}/update`, form);
|
|
74567
|
-
|
|
74568
|
-
|
|
74569
|
-
|
|
74570
|
-
|
|
74571
|
-
|
|
74572
|
-
|
|
74573
|
-
|
|
74574
|
-
});
|
|
74575
|
-
} else {
|
|
74576
|
-
setBanner(true);
|
|
74577
|
-
}
|
|
74567
|
+
const updated = { ...item, ...form };
|
|
74568
|
+
if (notif && (notif.type ?? "toast") === "notification") {
|
|
74569
|
+
setBanner(true);
|
|
74570
|
+
onSuccess?.(updated);
|
|
74571
|
+
} else {
|
|
74572
|
+
onSuccess?.(updated);
|
|
74573
|
+
onClose();
|
|
74578
74574
|
}
|
|
74579
|
-
onSuccess?.({ ...item, ...form });
|
|
74580
|
-
onClose();
|
|
74581
74575
|
} catch (err) {
|
|
74582
74576
|
setError(err?.response?.data?.message ?? err.message ?? "Update failed");
|
|
74583
74577
|
} finally {
|
|
@@ -74636,7 +74630,6 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
74636
74630
|
onSuccess,
|
|
74637
74631
|
notif
|
|
74638
74632
|
}) {
|
|
74639
|
-
const { toast } = useToast();
|
|
74640
74633
|
const [loading, setLoading] = React48.useState(false);
|
|
74641
74634
|
const [error, setError] = React48.useState(null);
|
|
74642
74635
|
const handleDelete = async () => {
|
|
@@ -74644,16 +74637,6 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
74644
74637
|
setError(null);
|
|
74645
74638
|
try {
|
|
74646
74639
|
await axios_default.delete(`${baseUrl}/${itemId}/delete`);
|
|
74647
|
-
if (notif) {
|
|
74648
|
-
if ((notif.type ?? "toast") === "toast") {
|
|
74649
|
-
toast({
|
|
74650
|
-
variant: notif.deleteVariant ?? "success",
|
|
74651
|
-
title: notif.deleteTitle ?? "Record deleted",
|
|
74652
|
-
description: notif.deleteBody,
|
|
74653
|
-
position: notif.toastPosition
|
|
74654
|
-
});
|
|
74655
|
-
}
|
|
74656
|
-
}
|
|
74657
74640
|
onSuccess?.(item);
|
|
74658
74641
|
onClose();
|
|
74659
74642
|
} catch (err) {
|
|
@@ -74739,6 +74722,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
74739
74722
|
serverPagination,
|
|
74740
74723
|
className
|
|
74741
74724
|
}) {
|
|
74725
|
+
const { toast } = useToast();
|
|
74742
74726
|
const [search, setSearch] = React48.useState("");
|
|
74743
74727
|
const [currentPage, setCurrentPage] = React48.useState(1);
|
|
74744
74728
|
const [selectedIds, setSelectedIds] = React48.useState([]);
|
|
@@ -75160,6 +75144,15 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
75160
75144
|
(prev) => prev.map((r2) => String(r2[actionIdKey]) === String(updated[actionIdKey]) ? updated : r2)
|
|
75161
75145
|
);
|
|
75162
75146
|
defaultActions.onSuccess?.("edit", updated);
|
|
75147
|
+
const notif = defaultActions.onSuccessNotif;
|
|
75148
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
75149
|
+
toast({
|
|
75150
|
+
variant: notif.editVariant ?? "success",
|
|
75151
|
+
title: notif.editTitle ?? "Record updated",
|
|
75152
|
+
description: notif.editBody,
|
|
75153
|
+
position: notif.toastPosition
|
|
75154
|
+
});
|
|
75155
|
+
}
|
|
75163
75156
|
}
|
|
75164
75157
|
}
|
|
75165
75158
|
),
|
|
@@ -75176,6 +75169,15 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
75176
75169
|
(prev) => prev.filter((r2) => String(r2[actionIdKey]) !== String(deleted[actionIdKey]))
|
|
75177
75170
|
);
|
|
75178
75171
|
defaultActions.onSuccess?.("delete", deleted);
|
|
75172
|
+
const notif = defaultActions.onSuccessNotif;
|
|
75173
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
75174
|
+
toast({
|
|
75175
|
+
variant: notif.deleteVariant ?? "success",
|
|
75176
|
+
title: notif.deleteTitle ?? "Record deleted",
|
|
75177
|
+
description: notif.deleteBody,
|
|
75178
|
+
position: notif.toastPosition
|
|
75179
|
+
});
|
|
75180
|
+
}
|
|
75179
75181
|
}
|
|
75180
75182
|
}
|
|
75181
75183
|
)
|
package/dist/index.js
CHANGED
|
@@ -6465,7 +6465,6 @@ function DGEditModal({
|
|
|
6465
6465
|
onSuccess,
|
|
6466
6466
|
notif
|
|
6467
6467
|
}) {
|
|
6468
|
-
const { toast } = useToast();
|
|
6469
6468
|
const [form, setForm] = React28.useState(() => {
|
|
6470
6469
|
const init = {};
|
|
6471
6470
|
fields.forEach((f) => {
|
|
@@ -6482,15 +6481,14 @@ function DGEditModal({
|
|
|
6482
6481
|
setError(null);
|
|
6483
6482
|
try {
|
|
6484
6483
|
await axios3.put(`${baseUrl}/${itemId}/update`, form);
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6484
|
+
const updated = { ...item, ...form };
|
|
6485
|
+
if (notif && (notif.type ?? "toast") === "notification") {
|
|
6486
|
+
setBanner(true);
|
|
6487
|
+
onSuccess?.(updated);
|
|
6488
|
+
} else {
|
|
6489
|
+
onSuccess?.(updated);
|
|
6490
|
+
onClose();
|
|
6491
6491
|
}
|
|
6492
|
-
onSuccess?.({ ...item, ...form });
|
|
6493
|
-
onClose();
|
|
6494
6492
|
} catch (err) {
|
|
6495
6493
|
setError(err?.response?.data?.message ?? err.message ?? "Update failed");
|
|
6496
6494
|
} finally {
|
|
@@ -6542,7 +6540,6 @@ function DGDeleteModal({
|
|
|
6542
6540
|
onSuccess,
|
|
6543
6541
|
notif
|
|
6544
6542
|
}) {
|
|
6545
|
-
const { toast } = useToast();
|
|
6546
6543
|
const [loading, setLoading] = React28.useState(false);
|
|
6547
6544
|
const [error, setError] = React28.useState(null);
|
|
6548
6545
|
const handleDelete = async () => {
|
|
@@ -6550,11 +6547,6 @@ function DGDeleteModal({
|
|
|
6550
6547
|
setError(null);
|
|
6551
6548
|
try {
|
|
6552
6549
|
await axios3.delete(`${baseUrl}/${itemId}/delete`);
|
|
6553
|
-
if (notif) {
|
|
6554
|
-
if ((notif.type ?? "toast") === "toast") {
|
|
6555
|
-
toast({ variant: notif.deleteVariant ?? "success", title: notif.deleteTitle ?? "Record deleted", description: notif.deleteBody, position: notif.toastPosition });
|
|
6556
|
-
}
|
|
6557
|
-
}
|
|
6558
6550
|
onSuccess?.(item);
|
|
6559
6551
|
onClose();
|
|
6560
6552
|
} catch (err) {
|
|
@@ -6599,6 +6591,7 @@ function DataGrid({
|
|
|
6599
6591
|
defaultActions,
|
|
6600
6592
|
serverPagination
|
|
6601
6593
|
}) {
|
|
6594
|
+
const { toast } = useToast();
|
|
6602
6595
|
const [sortKey, setSortKey] = React28.useState(null);
|
|
6603
6596
|
const [sortDir, setSortDir] = React28.useState(null);
|
|
6604
6597
|
const [filters, setFilters] = React28.useState({});
|
|
@@ -6922,6 +6915,10 @@ function DataGrid({
|
|
|
6922
6915
|
onSuccess: (updated) => {
|
|
6923
6916
|
setTableData((prev) => prev.map((r) => String(r[actionIdKey]) === String(updated[actionIdKey]) ? updated : r));
|
|
6924
6917
|
defaultActions.onSuccess?.("edit", updated);
|
|
6918
|
+
const notif = defaultActions.onSuccessNotif;
|
|
6919
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
6920
|
+
toast({ variant: notif.editVariant ?? "success", title: notif.editTitle ?? "Record updated", description: notif.editBody, position: notif.toastPosition });
|
|
6921
|
+
}
|
|
6925
6922
|
}
|
|
6926
6923
|
}
|
|
6927
6924
|
),
|
|
@@ -6936,6 +6933,10 @@ function DataGrid({
|
|
|
6936
6933
|
onSuccess: (deleted) => {
|
|
6937
6934
|
setTableData((prev) => prev.filter((r) => String(r[actionIdKey]) !== String(deleted[actionIdKey])));
|
|
6938
6935
|
defaultActions.onSuccess?.("delete", deleted);
|
|
6936
|
+
const notif = defaultActions.onSuccessNotif;
|
|
6937
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
6938
|
+
toast({ variant: notif.deleteVariant ?? "success", title: notif.deleteTitle ?? "Record deleted", description: notif.deleteBody, position: notif.toastPosition });
|
|
6939
|
+
}
|
|
6939
6940
|
}
|
|
6940
6941
|
}
|
|
6941
6942
|
)
|
|
@@ -10869,7 +10870,6 @@ function EditModal({
|
|
|
10869
10870
|
onSuccess,
|
|
10870
10871
|
notif
|
|
10871
10872
|
}) {
|
|
10872
|
-
const { toast } = useToast();
|
|
10873
10873
|
const [form, setForm] = React46.useState(() => {
|
|
10874
10874
|
const init = {};
|
|
10875
10875
|
fields.forEach((f) => {
|
|
@@ -10886,20 +10886,14 @@ function EditModal({
|
|
|
10886
10886
|
setError(null);
|
|
10887
10887
|
try {
|
|
10888
10888
|
await axios4.put(`${baseUrl}/${itemId}/update`, form);
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
});
|
|
10897
|
-
} else {
|
|
10898
|
-
setBanner(true);
|
|
10899
|
-
}
|
|
10889
|
+
const updated = { ...item, ...form };
|
|
10890
|
+
if (notif && (notif.type ?? "toast") === "notification") {
|
|
10891
|
+
setBanner(true);
|
|
10892
|
+
onSuccess?.(updated);
|
|
10893
|
+
} else {
|
|
10894
|
+
onSuccess?.(updated);
|
|
10895
|
+
onClose();
|
|
10900
10896
|
}
|
|
10901
|
-
onSuccess?.({ ...item, ...form });
|
|
10902
|
-
onClose();
|
|
10903
10897
|
} catch (err) {
|
|
10904
10898
|
setError(err?.response?.data?.message ?? err.message ?? "Update failed");
|
|
10905
10899
|
} finally {
|
|
@@ -10958,7 +10952,6 @@ function DeleteModal({
|
|
|
10958
10952
|
onSuccess,
|
|
10959
10953
|
notif
|
|
10960
10954
|
}) {
|
|
10961
|
-
const { toast } = useToast();
|
|
10962
10955
|
const [loading, setLoading] = React46.useState(false);
|
|
10963
10956
|
const [error, setError] = React46.useState(null);
|
|
10964
10957
|
const handleDelete = async () => {
|
|
@@ -10966,16 +10959,6 @@ function DeleteModal({
|
|
|
10966
10959
|
setError(null);
|
|
10967
10960
|
try {
|
|
10968
10961
|
await axios4.delete(`${baseUrl}/${itemId}/delete`);
|
|
10969
|
-
if (notif) {
|
|
10970
|
-
if ((notif.type ?? "toast") === "toast") {
|
|
10971
|
-
toast({
|
|
10972
|
-
variant: notif.deleteVariant ?? "success",
|
|
10973
|
-
title: notif.deleteTitle ?? "Record deleted",
|
|
10974
|
-
description: notif.deleteBody,
|
|
10975
|
-
position: notif.toastPosition
|
|
10976
|
-
});
|
|
10977
|
-
}
|
|
10978
|
-
}
|
|
10979
10962
|
onSuccess?.(item);
|
|
10980
10963
|
onClose();
|
|
10981
10964
|
} catch (err) {
|
|
@@ -11061,6 +11044,7 @@ function Table({
|
|
|
11061
11044
|
serverPagination,
|
|
11062
11045
|
className
|
|
11063
11046
|
}) {
|
|
11047
|
+
const { toast } = useToast();
|
|
11064
11048
|
const [search, setSearch] = React46.useState("");
|
|
11065
11049
|
const [currentPage, setCurrentPage] = React46.useState(1);
|
|
11066
11050
|
const [selectedIds, setSelectedIds] = React46.useState([]);
|
|
@@ -11482,6 +11466,15 @@ function Table({
|
|
|
11482
11466
|
(prev) => prev.map((r) => String(r[actionIdKey]) === String(updated[actionIdKey]) ? updated : r)
|
|
11483
11467
|
);
|
|
11484
11468
|
defaultActions.onSuccess?.("edit", updated);
|
|
11469
|
+
const notif = defaultActions.onSuccessNotif;
|
|
11470
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
11471
|
+
toast({
|
|
11472
|
+
variant: notif.editVariant ?? "success",
|
|
11473
|
+
title: notif.editTitle ?? "Record updated",
|
|
11474
|
+
description: notif.editBody,
|
|
11475
|
+
position: notif.toastPosition
|
|
11476
|
+
});
|
|
11477
|
+
}
|
|
11485
11478
|
}
|
|
11486
11479
|
}
|
|
11487
11480
|
),
|
|
@@ -11498,6 +11491,15 @@ function Table({
|
|
|
11498
11491
|
(prev) => prev.filter((r) => String(r[actionIdKey]) !== String(deleted[actionIdKey]))
|
|
11499
11492
|
);
|
|
11500
11493
|
defaultActions.onSuccess?.("delete", deleted);
|
|
11494
|
+
const notif = defaultActions.onSuccessNotif;
|
|
11495
|
+
if (notif && (notif.type ?? "toast") === "toast") {
|
|
11496
|
+
toast({
|
|
11497
|
+
variant: notif.deleteVariant ?? "success",
|
|
11498
|
+
title: notif.deleteTitle ?? "Record deleted",
|
|
11499
|
+
description: notif.deleteBody,
|
|
11500
|
+
position: notif.toastPosition
|
|
11501
|
+
});
|
|
11502
|
+
}
|
|
11501
11503
|
}
|
|
11502
11504
|
}
|
|
11503
11505
|
)
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"registry": "https://registry.npmjs.org/",
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "3.2.
|
|
7
|
+
"version": "3.2.2",
|
|
8
8
|
"description": "Reusable React UI components",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"main": "dist/index.js",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"react-dom": ">=18"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
+
"@juv/codego-react-ui": "^3.2.0",
|
|
30
31
|
"@tailwindcss/vite": "^4.1.14",
|
|
31
32
|
"@types/leaflet": "^1.9.21",
|
|
32
33
|
"@types/leaflet.markercluster": "^1.5.6",
|