@juv/codego-react-ui 3.2.7 → 3.2.8
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 +41 -11
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.global.js +41 -11
- package/dist/index.js +41 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6471,7 +6471,21 @@ function useServerTable({ url, params, encrypt, key, decryptPayloadLog, columnOv
|
|
|
6471
6471
|
reload: () => setTick((t) => t + 1)
|
|
6472
6472
|
};
|
|
6473
6473
|
}
|
|
6474
|
-
|
|
6474
|
+
var MODAL_WIDTH = {
|
|
6475
|
+
sm: "max-w-sm",
|
|
6476
|
+
md: "max-w-md",
|
|
6477
|
+
lg: "max-w-lg",
|
|
6478
|
+
xl: "max-w-xl",
|
|
6479
|
+
"2xl": "max-w-2xl",
|
|
6480
|
+
"3xl": "max-w-3xl",
|
|
6481
|
+
"4xl": "max-w-4xl",
|
|
6482
|
+
"5xl": "max-w-5xl",
|
|
6483
|
+
"6xl": "max-w-6xl",
|
|
6484
|
+
"7xl": "max-w-7xl",
|
|
6485
|
+
screen: "max-w-screen-xl",
|
|
6486
|
+
full: "max-w-full"
|
|
6487
|
+
};
|
|
6488
|
+
function ModalShell({ title, onClose, children, footer, width = "lg" }) {
|
|
6475
6489
|
return (0, import_react_dom2.createPortal)(
|
|
6476
6490
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6477
6491
|
"div",
|
|
@@ -6481,7 +6495,7 @@ function ModalShell({ title, onClose, children, footer }) {
|
|
|
6481
6495
|
onMouseDown: (e) => {
|
|
6482
6496
|
if (e.target === e.currentTarget) onClose();
|
|
6483
6497
|
},
|
|
6484
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className:
|
|
6498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `relative w-full ${MODAL_WIDTH[width]} rounded-2xl border border-border bg-card shadow-2xl flex flex-col max-h-[90vh]`, children: [
|
|
6485
6499
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between px-6 py-4 border-b border-border shrink-0", children: [
|
|
6486
6500
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h2", { className: "text-base font-semibold", children: title }),
|
|
6487
6501
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { onClick: onClose, className: "text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_lucide_react17.X, { className: "h-4 w-4" }) })
|
|
@@ -6645,13 +6659,15 @@ function FieldRenderer({ field, value, onChange }) {
|
|
|
6645
6659
|
function ViewModal({
|
|
6646
6660
|
item,
|
|
6647
6661
|
fields,
|
|
6648
|
-
onClose
|
|
6662
|
+
onClose,
|
|
6663
|
+
width
|
|
6649
6664
|
}) {
|
|
6650
6665
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6651
6666
|
ModalShell,
|
|
6652
6667
|
{
|
|
6653
6668
|
title: "View Details",
|
|
6654
6669
|
onClose,
|
|
6670
|
+
width,
|
|
6655
6671
|
footer: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "outline", size: "sm", onClick: onClose, children: "Close" }),
|
|
6656
6672
|
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "space-y-3", children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
6657
6673
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
|
|
@@ -6669,7 +6685,8 @@ function EditModal({
|
|
|
6669
6685
|
onClose,
|
|
6670
6686
|
onSuccess,
|
|
6671
6687
|
notif,
|
|
6672
|
-
grid
|
|
6688
|
+
grid,
|
|
6689
|
+
width
|
|
6673
6690
|
}) {
|
|
6674
6691
|
const [form, setForm] = React28.useState(() => {
|
|
6675
6692
|
const init = {};
|
|
@@ -6717,6 +6734,7 @@ function EditModal({
|
|
|
6717
6734
|
{
|
|
6718
6735
|
title: "Edit Record",
|
|
6719
6736
|
onClose,
|
|
6737
|
+
width,
|
|
6720
6738
|
footer: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6721
6739
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "outline", size: "sm", onClick: onClose, disabled: loading, children: "Cancel" }),
|
|
6722
6740
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Button, { size: "sm", onClick: handleSubmit, disabled: loading, children: [
|
|
@@ -6779,7 +6797,8 @@ function DeleteModal({
|
|
|
6779
6797
|
itemId,
|
|
6780
6798
|
onClose,
|
|
6781
6799
|
onSuccess,
|
|
6782
|
-
notif
|
|
6800
|
+
notif,
|
|
6801
|
+
width
|
|
6783
6802
|
}) {
|
|
6784
6803
|
const [loading, setLoading] = React28.useState(false);
|
|
6785
6804
|
const [error, setError] = React28.useState(null);
|
|
@@ -6801,6 +6820,7 @@ function DeleteModal({
|
|
|
6801
6820
|
{
|
|
6802
6821
|
title: "Confirm Delete",
|
|
6803
6822
|
onClose,
|
|
6823
|
+
width,
|
|
6804
6824
|
footer: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6805
6825
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "outline", size: "sm", onClick: onClose, disabled: loading, children: "Cancel" }),
|
|
6806
6826
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Button, { variant: "danger", size: "sm", onClick: handleDelete, disabled: loading, children: [
|
|
@@ -7278,6 +7298,7 @@ function Table({
|
|
|
7278
7298
|
{
|
|
7279
7299
|
item: viewItem,
|
|
7280
7300
|
fields: viewFields,
|
|
7301
|
+
width: defaultActions.modalWidth,
|
|
7281
7302
|
onClose: () => setViewItem(null)
|
|
7282
7303
|
}
|
|
7283
7304
|
),
|
|
@@ -7290,6 +7311,7 @@ function Table({
|
|
|
7290
7311
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
7291
7312
|
notif: defaultActions.onSuccessNotif,
|
|
7292
7313
|
grid: defaultActions.editFormGrid,
|
|
7314
|
+
width: defaultActions.modalWidth,
|
|
7293
7315
|
onClose: () => setEditItem(null),
|
|
7294
7316
|
onSuccess: (updated) => {
|
|
7295
7317
|
setTableData(
|
|
@@ -7315,6 +7337,7 @@ function Table({
|
|
|
7315
7337
|
baseUrl: defaultActions.baseUrl,
|
|
7316
7338
|
itemId: String(deleteItem[actionIdKey] ?? ""),
|
|
7317
7339
|
notif: defaultActions.onSuccessNotif,
|
|
7340
|
+
width: defaultActions.modalWidth,
|
|
7318
7341
|
onClose: () => setDeleteItem(null),
|
|
7319
7342
|
onSuccess: (deleted) => {
|
|
7320
7343
|
setTableData(
|
|
@@ -7439,7 +7462,7 @@ function ActionBtn2({
|
|
|
7439
7462
|
}
|
|
7440
7463
|
);
|
|
7441
7464
|
}
|
|
7442
|
-
function DGModalShell({ title, onClose, children, footer }) {
|
|
7465
|
+
function DGModalShell({ title, onClose, children, footer, width = "lg" }) {
|
|
7443
7466
|
return (0, import_react_dom3.createPortal)(
|
|
7444
7467
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7445
7468
|
"div",
|
|
@@ -7449,7 +7472,7 @@ function DGModalShell({ title, onClose, children, footer }) {
|
|
|
7449
7472
|
onMouseDown: (e) => {
|
|
7450
7473
|
if (e.target === e.currentTarget) onClose();
|
|
7451
7474
|
},
|
|
7452
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className:
|
|
7475
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `relative w-full ${MODAL_WIDTH[width]} rounded-2xl border border-border bg-card shadow-2xl flex flex-col max-h-[90vh]`, children: [
|
|
7453
7476
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between px-6 py-4 border-b border-border shrink-0", children: [
|
|
7454
7477
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h2", { className: "text-base font-semibold", children: title }),
|
|
7455
7478
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { onClick: onClose, className: "text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.X, { className: "h-4 w-4" }) })
|
|
@@ -7532,12 +7555,13 @@ function DGFieldRenderer({ field, value, onChange }) {
|
|
|
7532
7555
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Input, { inputType: field.inputType ?? "text", value: value ?? "", onChange: (e) => onChange(e.target.value), placeholder: field.placeholder ?? field.label });
|
|
7533
7556
|
}
|
|
7534
7557
|
}
|
|
7535
|
-
function DGViewModal({ item, fields, onClose }) {
|
|
7558
|
+
function DGViewModal({ item, fields, onClose, width }) {
|
|
7536
7559
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7537
7560
|
DGModalShell,
|
|
7538
7561
|
{
|
|
7539
7562
|
title: "View Details",
|
|
7540
7563
|
onClose,
|
|
7564
|
+
width,
|
|
7541
7565
|
footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { onClick: onClose, className: "px-4 py-1.5 text-sm rounded-xl border border-border hover:bg-accent transition-colors", children: "Close" }),
|
|
7542
7566
|
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "space-y-3", children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
7543
7567
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
|
|
@@ -7555,7 +7579,8 @@ function DGEditModal({
|
|
|
7555
7579
|
onClose,
|
|
7556
7580
|
onSuccess,
|
|
7557
7581
|
notif,
|
|
7558
|
-
grid
|
|
7582
|
+
grid,
|
|
7583
|
+
width
|
|
7559
7584
|
}) {
|
|
7560
7585
|
const [form, setForm] = React29.useState(() => {
|
|
7561
7586
|
const init = {};
|
|
@@ -7603,6 +7628,7 @@ function DGEditModal({
|
|
|
7603
7628
|
{
|
|
7604
7629
|
title: "Edit Record",
|
|
7605
7630
|
onClose,
|
|
7631
|
+
width,
|
|
7606
7632
|
footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
7607
7633
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { onClick: onClose, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl border border-border hover:bg-accent transition-colors", children: "Cancel" }),
|
|
7608
7634
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("button", { onClick: handleSubmit, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl bg-primary text-primary-foreground hover:bg-primary-hover transition-colors flex items-center gap-1.5", children: [
|
|
@@ -7640,7 +7666,8 @@ function DGDeleteModal({
|
|
|
7640
7666
|
itemId,
|
|
7641
7667
|
onClose,
|
|
7642
7668
|
onSuccess,
|
|
7643
|
-
notif
|
|
7669
|
+
notif,
|
|
7670
|
+
width
|
|
7644
7671
|
}) {
|
|
7645
7672
|
const [loading, setLoading] = React29.useState(false);
|
|
7646
7673
|
const [error, setError] = React29.useState(null);
|
|
@@ -7662,6 +7689,7 @@ function DGDeleteModal({
|
|
|
7662
7689
|
{
|
|
7663
7690
|
title: "Confirm Delete",
|
|
7664
7691
|
onClose,
|
|
7692
|
+
width,
|
|
7665
7693
|
footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
7666
7694
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { onClick: onClose, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl border border-border hover:bg-accent transition-colors", children: "Cancel" }),
|
|
7667
7695
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("button", { onClick: handleDelete, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl bg-danger text-danger-foreground hover:bg-danger-hover transition-colors flex items-center gap-1.5", children: [
|
|
@@ -8016,7 +8044,7 @@ function DataGrid({
|
|
|
8016
8044
|
] })
|
|
8017
8045
|
] });
|
|
8018
8046
|
})(),
|
|
8019
|
-
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
|
|
8047
|
+
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DGViewModal, { item: viewItem, fields: viewFields, width: defaultActions.modalWidth, onClose: () => setViewItem(null) }),
|
|
8020
8048
|
defaultActions && editItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8021
8049
|
DGEditModal,
|
|
8022
8050
|
{
|
|
@@ -8026,6 +8054,7 @@ function DataGrid({
|
|
|
8026
8054
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
8027
8055
|
notif: defaultActions.onSuccessNotif,
|
|
8028
8056
|
grid: defaultActions.editFormGrid,
|
|
8057
|
+
width: defaultActions.modalWidth,
|
|
8029
8058
|
onClose: () => setEditItem(null),
|
|
8030
8059
|
onSuccess: (updated) => {
|
|
8031
8060
|
setTableData((prev) => prev.map((r) => String(r[actionIdKey]) === String(updated[actionIdKey]) ? updated : r));
|
|
@@ -8044,6 +8073,7 @@ function DataGrid({
|
|
|
8044
8073
|
baseUrl: defaultActions.baseUrl,
|
|
8045
8074
|
itemId: String(deleteItem[actionIdKey] ?? ""),
|
|
8046
8075
|
notif: defaultActions.onSuccessNotif,
|
|
8076
|
+
width: defaultActions.modalWidth,
|
|
8047
8077
|
onClose: () => setDeleteItem(null),
|
|
8048
8078
|
onSuccess: (deleted) => {
|
|
8049
8079
|
setTableData((prev) => prev.filter((r) => String(r[actionIdKey]) !== String(deleted[actionIdKey])));
|
package/dist/index.d.cts
CHANGED
|
@@ -345,6 +345,8 @@ interface DefaultActionsConfig<T> {
|
|
|
345
345
|
viewForm?: ActionField[];
|
|
346
346
|
/** Grid columns for the edit form layout (e.g. 2 = two-column grid). Default single column. */
|
|
347
347
|
editFormGrid?: number;
|
|
348
|
+
/** Width of the Edit/View/Delete modal. Default "lg". */
|
|
349
|
+
modalWidth?: ModalWidth;
|
|
348
350
|
/** Called after a successful edit or delete so the parent can refresh data. */
|
|
349
351
|
onSuccess?: (action: "edit" | "delete", item: T) => void;
|
|
350
352
|
/** Show a toast or notification banner on successful edit/delete */
|
|
@@ -378,6 +380,21 @@ interface ActionSuccessNotif {
|
|
|
378
380
|
/** Extra action element rendered inside the notification */
|
|
379
381
|
action?: React.ReactNode;
|
|
380
382
|
}
|
|
383
|
+
declare const MODAL_WIDTH: {
|
|
384
|
+
readonly sm: "max-w-sm";
|
|
385
|
+
readonly md: "max-w-md";
|
|
386
|
+
readonly lg: "max-w-lg";
|
|
387
|
+
readonly xl: "max-w-xl";
|
|
388
|
+
readonly '2xl': "max-w-2xl";
|
|
389
|
+
readonly '3xl': "max-w-3xl";
|
|
390
|
+
readonly '4xl': "max-w-4xl";
|
|
391
|
+
readonly '5xl': "max-w-5xl";
|
|
392
|
+
readonly '6xl': "max-w-6xl";
|
|
393
|
+
readonly '7xl': "max-w-7xl";
|
|
394
|
+
readonly screen: "max-w-screen-xl";
|
|
395
|
+
readonly full: "max-w-full";
|
|
396
|
+
};
|
|
397
|
+
type ModalWidth = keyof typeof MODAL_WIDTH;
|
|
381
398
|
interface Column<T> {
|
|
382
399
|
key: keyof T | string;
|
|
383
400
|
title: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -345,6 +345,8 @@ interface DefaultActionsConfig<T> {
|
|
|
345
345
|
viewForm?: ActionField[];
|
|
346
346
|
/** Grid columns for the edit form layout (e.g. 2 = two-column grid). Default single column. */
|
|
347
347
|
editFormGrid?: number;
|
|
348
|
+
/** Width of the Edit/View/Delete modal. Default "lg". */
|
|
349
|
+
modalWidth?: ModalWidth;
|
|
348
350
|
/** Called after a successful edit or delete so the parent can refresh data. */
|
|
349
351
|
onSuccess?: (action: "edit" | "delete", item: T) => void;
|
|
350
352
|
/** Show a toast or notification banner on successful edit/delete */
|
|
@@ -378,6 +380,21 @@ interface ActionSuccessNotif {
|
|
|
378
380
|
/** Extra action element rendered inside the notification */
|
|
379
381
|
action?: React.ReactNode;
|
|
380
382
|
}
|
|
383
|
+
declare const MODAL_WIDTH: {
|
|
384
|
+
readonly sm: "max-w-sm";
|
|
385
|
+
readonly md: "max-w-md";
|
|
386
|
+
readonly lg: "max-w-lg";
|
|
387
|
+
readonly xl: "max-w-xl";
|
|
388
|
+
readonly '2xl': "max-w-2xl";
|
|
389
|
+
readonly '3xl': "max-w-3xl";
|
|
390
|
+
readonly '4xl': "max-w-4xl";
|
|
391
|
+
readonly '5xl': "max-w-5xl";
|
|
392
|
+
readonly '6xl': "max-w-6xl";
|
|
393
|
+
readonly '7xl': "max-w-7xl";
|
|
394
|
+
readonly screen: "max-w-screen-xl";
|
|
395
|
+
readonly full: "max-w-full";
|
|
396
|
+
};
|
|
397
|
+
type ModalWidth = keyof typeof MODAL_WIDTH;
|
|
381
398
|
interface Column<T> {
|
|
382
399
|
key: keyof T | string;
|
|
383
400
|
title: string;
|
package/dist/index.global.js
CHANGED
|
@@ -69617,7 +69617,21 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69617
69617
|
reload: () => setTick((t) => t + 1)
|
|
69618
69618
|
};
|
|
69619
69619
|
}
|
|
69620
|
-
|
|
69620
|
+
var MODAL_WIDTH = {
|
|
69621
|
+
sm: "max-w-sm",
|
|
69622
|
+
md: "max-w-md",
|
|
69623
|
+
lg: "max-w-lg",
|
|
69624
|
+
xl: "max-w-xl",
|
|
69625
|
+
"2xl": "max-w-2xl",
|
|
69626
|
+
"3xl": "max-w-3xl",
|
|
69627
|
+
"4xl": "max-w-4xl",
|
|
69628
|
+
"5xl": "max-w-5xl",
|
|
69629
|
+
"6xl": "max-w-6xl",
|
|
69630
|
+
"7xl": "max-w-7xl",
|
|
69631
|
+
screen: "max-w-screen-xl",
|
|
69632
|
+
full: "max-w-full"
|
|
69633
|
+
};
|
|
69634
|
+
function ModalShell({ title, onClose, children, footer, width = "lg" }) {
|
|
69621
69635
|
return (0, import_react_dom2.createPortal)(
|
|
69622
69636
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
69623
69637
|
"div",
|
|
@@ -69627,7 +69641,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69627
69641
|
onMouseDown: (e) => {
|
|
69628
69642
|
if (e.target === e.currentTarget) onClose();
|
|
69629
69643
|
},
|
|
69630
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className:
|
|
69644
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `relative w-full ${MODAL_WIDTH[width]} rounded-2xl border border-border bg-card shadow-2xl flex flex-col max-h-[90vh]`, children: [
|
|
69631
69645
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between px-6 py-4 border-b border-border shrink-0", children: [
|
|
69632
69646
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h2", { className: "text-base font-semibold", children: title }),
|
|
69633
69647
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { onClick: onClose, className: "text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(X, { className: "h-4 w-4" }) })
|
|
@@ -69791,13 +69805,15 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69791
69805
|
function ViewModal({
|
|
69792
69806
|
item,
|
|
69793
69807
|
fields,
|
|
69794
|
-
onClose
|
|
69808
|
+
onClose,
|
|
69809
|
+
width
|
|
69795
69810
|
}) {
|
|
69796
69811
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
69797
69812
|
ModalShell,
|
|
69798
69813
|
{
|
|
69799
69814
|
title: "View Details",
|
|
69800
69815
|
onClose,
|
|
69816
|
+
width,
|
|
69801
69817
|
footer: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "outline", size: "sm", onClick: onClose, children: "Close" }),
|
|
69802
69818
|
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "space-y-3", children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
69803
69819
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
|
|
@@ -69815,7 +69831,8 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69815
69831
|
onClose,
|
|
69816
69832
|
onSuccess,
|
|
69817
69833
|
notif,
|
|
69818
|
-
grid
|
|
69834
|
+
grid,
|
|
69835
|
+
width
|
|
69819
69836
|
}) {
|
|
69820
69837
|
const [form, setForm] = React28.useState(() => {
|
|
69821
69838
|
const init = {};
|
|
@@ -69863,6 +69880,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69863
69880
|
{
|
|
69864
69881
|
title: "Edit Record",
|
|
69865
69882
|
onClose,
|
|
69883
|
+
width,
|
|
69866
69884
|
footer: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
69867
69885
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "outline", size: "sm", onClick: onClose, disabled: loading, children: "Cancel" }),
|
|
69868
69886
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Button, { size: "sm", onClick: handleSubmit, disabled: loading, children: [
|
|
@@ -69925,7 +69943,8 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69925
69943
|
itemId,
|
|
69926
69944
|
onClose,
|
|
69927
69945
|
onSuccess,
|
|
69928
|
-
notif
|
|
69946
|
+
notif,
|
|
69947
|
+
width
|
|
69929
69948
|
}) {
|
|
69930
69949
|
const [loading, setLoading] = React28.useState(false);
|
|
69931
69950
|
const [error, setError] = React28.useState(null);
|
|
@@ -69947,6 +69966,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69947
69966
|
{
|
|
69948
69967
|
title: "Confirm Delete",
|
|
69949
69968
|
onClose,
|
|
69969
|
+
width,
|
|
69950
69970
|
footer: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
69951
69971
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "outline", size: "sm", onClick: onClose, disabled: loading, children: "Cancel" }),
|
|
69952
69972
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Button, { variant: "danger", size: "sm", onClick: handleDelete, disabled: loading, children: [
|
|
@@ -70424,6 +70444,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70424
70444
|
{
|
|
70425
70445
|
item: viewItem,
|
|
70426
70446
|
fields: viewFields,
|
|
70447
|
+
width: defaultActions.modalWidth,
|
|
70427
70448
|
onClose: () => setViewItem(null)
|
|
70428
70449
|
}
|
|
70429
70450
|
),
|
|
@@ -70436,6 +70457,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70436
70457
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
70437
70458
|
notif: defaultActions.onSuccessNotif,
|
|
70438
70459
|
grid: defaultActions.editFormGrid,
|
|
70460
|
+
width: defaultActions.modalWidth,
|
|
70439
70461
|
onClose: () => setEditItem(null),
|
|
70440
70462
|
onSuccess: (updated) => {
|
|
70441
70463
|
setTableData(
|
|
@@ -70461,6 +70483,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70461
70483
|
baseUrl: defaultActions.baseUrl,
|
|
70462
70484
|
itemId: String(deleteItem[actionIdKey] ?? ""),
|
|
70463
70485
|
notif: defaultActions.onSuccessNotif,
|
|
70486
|
+
width: defaultActions.modalWidth,
|
|
70464
70487
|
onClose: () => setDeleteItem(null),
|
|
70465
70488
|
onSuccess: (deleted) => {
|
|
70466
70489
|
setTableData(
|
|
@@ -70585,7 +70608,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70585
70608
|
}
|
|
70586
70609
|
);
|
|
70587
70610
|
}
|
|
70588
|
-
function DGModalShell({ title, onClose, children, footer }) {
|
|
70611
|
+
function DGModalShell({ title, onClose, children, footer, width = "lg" }) {
|
|
70589
70612
|
return (0, import_react_dom3.createPortal)(
|
|
70590
70613
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
70591
70614
|
"div",
|
|
@@ -70595,7 +70618,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70595
70618
|
onMouseDown: (e) => {
|
|
70596
70619
|
if (e.target === e.currentTarget) onClose();
|
|
70597
70620
|
},
|
|
70598
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className:
|
|
70621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `relative w-full ${MODAL_WIDTH[width]} rounded-2xl border border-border bg-card shadow-2xl flex flex-col max-h-[90vh]`, children: [
|
|
70599
70622
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between px-6 py-4 border-b border-border shrink-0", children: [
|
|
70600
70623
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h2", { className: "text-base font-semibold", children: title }),
|
|
70601
70624
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { onClick: onClose, className: "text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(X, { className: "h-4 w-4" }) })
|
|
@@ -70678,12 +70701,13 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70678
70701
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Input, { inputType: field.inputType ?? "text", value: value ?? "", onChange: (e) => onChange(e.target.value), placeholder: field.placeholder ?? field.label });
|
|
70679
70702
|
}
|
|
70680
70703
|
}
|
|
70681
|
-
function DGViewModal({ item, fields, onClose }) {
|
|
70704
|
+
function DGViewModal({ item, fields, onClose, width }) {
|
|
70682
70705
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
70683
70706
|
DGModalShell,
|
|
70684
70707
|
{
|
|
70685
70708
|
title: "View Details",
|
|
70686
70709
|
onClose,
|
|
70710
|
+
width,
|
|
70687
70711
|
footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { onClick: onClose, className: "px-4 py-1.5 text-sm rounded-xl border border-border hover:bg-accent transition-colors", children: "Close" }),
|
|
70688
70712
|
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "space-y-3", children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { children: [
|
|
70689
70713
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
|
|
@@ -70701,7 +70725,8 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70701
70725
|
onClose,
|
|
70702
70726
|
onSuccess,
|
|
70703
70727
|
notif,
|
|
70704
|
-
grid
|
|
70728
|
+
grid,
|
|
70729
|
+
width
|
|
70705
70730
|
}) {
|
|
70706
70731
|
const [form, setForm] = React29.useState(() => {
|
|
70707
70732
|
const init = {};
|
|
@@ -70749,6 +70774,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70749
70774
|
{
|
|
70750
70775
|
title: "Edit Record",
|
|
70751
70776
|
onClose,
|
|
70777
|
+
width,
|
|
70752
70778
|
footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
70753
70779
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { onClick: onClose, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl border border-border hover:bg-accent transition-colors", children: "Cancel" }),
|
|
70754
70780
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("button", { onClick: handleSubmit, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl bg-primary text-primary-foreground hover:bg-primary-hover transition-colors flex items-center gap-1.5", children: [
|
|
@@ -70786,7 +70812,8 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70786
70812
|
itemId,
|
|
70787
70813
|
onClose,
|
|
70788
70814
|
onSuccess,
|
|
70789
|
-
notif
|
|
70815
|
+
notif,
|
|
70816
|
+
width
|
|
70790
70817
|
}) {
|
|
70791
70818
|
const [loading, setLoading] = React29.useState(false);
|
|
70792
70819
|
const [error, setError] = React29.useState(null);
|
|
@@ -70808,6 +70835,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70808
70835
|
{
|
|
70809
70836
|
title: "Confirm Delete",
|
|
70810
70837
|
onClose,
|
|
70838
|
+
width,
|
|
70811
70839
|
footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
70812
70840
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { onClick: onClose, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl border border-border hover:bg-accent transition-colors", children: "Cancel" }),
|
|
70813
70841
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("button", { onClick: handleDelete, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl bg-danger text-danger-foreground hover:bg-danger-hover transition-colors flex items-center gap-1.5", children: [
|
|
@@ -71162,7 +71190,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
71162
71190
|
] })
|
|
71163
71191
|
] });
|
|
71164
71192
|
})(),
|
|
71165
|
-
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
|
|
71193
|
+
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DGViewModal, { item: viewItem, fields: viewFields, width: defaultActions.modalWidth, onClose: () => setViewItem(null) }),
|
|
71166
71194
|
defaultActions && editItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
71167
71195
|
DGEditModal,
|
|
71168
71196
|
{
|
|
@@ -71172,6 +71200,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
71172
71200
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
71173
71201
|
notif: defaultActions.onSuccessNotif,
|
|
71174
71202
|
grid: defaultActions.editFormGrid,
|
|
71203
|
+
width: defaultActions.modalWidth,
|
|
71175
71204
|
onClose: () => setEditItem(null),
|
|
71176
71205
|
onSuccess: (updated) => {
|
|
71177
71206
|
setTableData((prev) => prev.map((r2) => String(r2[actionIdKey]) === String(updated[actionIdKey]) ? updated : r2));
|
|
@@ -71190,6 +71219,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
71190
71219
|
baseUrl: defaultActions.baseUrl,
|
|
71191
71220
|
itemId: String(deleteItem[actionIdKey] ?? ""),
|
|
71192
71221
|
notif: defaultActions.onSuccessNotif,
|
|
71222
|
+
width: defaultActions.modalWidth,
|
|
71193
71223
|
onClose: () => setDeleteItem(null),
|
|
71194
71224
|
onSuccess: (deleted) => {
|
|
71195
71225
|
setTableData((prev) => prev.filter((r2) => String(r2[actionIdKey]) !== String(deleted[actionIdKey])));
|
package/dist/index.js
CHANGED
|
@@ -6353,7 +6353,21 @@ function useServerTable({ url, params, encrypt, key, decryptPayloadLog, columnOv
|
|
|
6353
6353
|
reload: () => setTick((t) => t + 1)
|
|
6354
6354
|
};
|
|
6355
6355
|
}
|
|
6356
|
-
|
|
6356
|
+
var MODAL_WIDTH = {
|
|
6357
|
+
sm: "max-w-sm",
|
|
6358
|
+
md: "max-w-md",
|
|
6359
|
+
lg: "max-w-lg",
|
|
6360
|
+
xl: "max-w-xl",
|
|
6361
|
+
"2xl": "max-w-2xl",
|
|
6362
|
+
"3xl": "max-w-3xl",
|
|
6363
|
+
"4xl": "max-w-4xl",
|
|
6364
|
+
"5xl": "max-w-5xl",
|
|
6365
|
+
"6xl": "max-w-6xl",
|
|
6366
|
+
"7xl": "max-w-7xl",
|
|
6367
|
+
screen: "max-w-screen-xl",
|
|
6368
|
+
full: "max-w-full"
|
|
6369
|
+
};
|
|
6370
|
+
function ModalShell({ title, onClose, children, footer, width = "lg" }) {
|
|
6357
6371
|
return createPortal3(
|
|
6358
6372
|
/* @__PURE__ */ jsx32(
|
|
6359
6373
|
"div",
|
|
@@ -6363,7 +6377,7 @@ function ModalShell({ title, onClose, children, footer }) {
|
|
|
6363
6377
|
onMouseDown: (e) => {
|
|
6364
6378
|
if (e.target === e.currentTarget) onClose();
|
|
6365
6379
|
},
|
|
6366
|
-
children: /* @__PURE__ */ jsxs30("div", { className:
|
|
6380
|
+
children: /* @__PURE__ */ jsxs30("div", { className: `relative w-full ${MODAL_WIDTH[width]} rounded-2xl border border-border bg-card shadow-2xl flex flex-col max-h-[90vh]`, children: [
|
|
6367
6381
|
/* @__PURE__ */ jsxs30("div", { className: "flex items-center justify-between px-6 py-4 border-b border-border shrink-0", children: [
|
|
6368
6382
|
/* @__PURE__ */ jsx32("h2", { className: "text-base font-semibold", children: title }),
|
|
6369
6383
|
/* @__PURE__ */ jsx32("button", { onClick: onClose, className: "text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ jsx32(X9, { className: "h-4 w-4" }) })
|
|
@@ -6527,13 +6541,15 @@ function FieldRenderer({ field, value, onChange }) {
|
|
|
6527
6541
|
function ViewModal({
|
|
6528
6542
|
item,
|
|
6529
6543
|
fields,
|
|
6530
|
-
onClose
|
|
6544
|
+
onClose,
|
|
6545
|
+
width
|
|
6531
6546
|
}) {
|
|
6532
6547
|
return /* @__PURE__ */ jsx32(
|
|
6533
6548
|
ModalShell,
|
|
6534
6549
|
{
|
|
6535
6550
|
title: "View Details",
|
|
6536
6551
|
onClose,
|
|
6552
|
+
width,
|
|
6537
6553
|
footer: /* @__PURE__ */ jsx32(Button, { variant: "outline", size: "sm", onClick: onClose, children: "Close" }),
|
|
6538
6554
|
children: /* @__PURE__ */ jsx32("div", { className: "space-y-3", children: fields.map((f) => /* @__PURE__ */ jsxs30("div", { children: [
|
|
6539
6555
|
/* @__PURE__ */ jsx32("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
|
|
@@ -6551,7 +6567,8 @@ function EditModal({
|
|
|
6551
6567
|
onClose,
|
|
6552
6568
|
onSuccess,
|
|
6553
6569
|
notif,
|
|
6554
|
-
grid
|
|
6570
|
+
grid,
|
|
6571
|
+
width
|
|
6555
6572
|
}) {
|
|
6556
6573
|
const [form, setForm] = React28.useState(() => {
|
|
6557
6574
|
const init = {};
|
|
@@ -6599,6 +6616,7 @@ function EditModal({
|
|
|
6599
6616
|
{
|
|
6600
6617
|
title: "Edit Record",
|
|
6601
6618
|
onClose,
|
|
6619
|
+
width,
|
|
6602
6620
|
footer: /* @__PURE__ */ jsxs30(Fragment11, { children: [
|
|
6603
6621
|
/* @__PURE__ */ jsx32(Button, { variant: "outline", size: "sm", onClick: onClose, disabled: loading, children: "Cancel" }),
|
|
6604
6622
|
/* @__PURE__ */ jsxs30(Button, { size: "sm", onClick: handleSubmit, disabled: loading, children: [
|
|
@@ -6661,7 +6679,8 @@ function DeleteModal({
|
|
|
6661
6679
|
itemId,
|
|
6662
6680
|
onClose,
|
|
6663
6681
|
onSuccess,
|
|
6664
|
-
notif
|
|
6682
|
+
notif,
|
|
6683
|
+
width
|
|
6665
6684
|
}) {
|
|
6666
6685
|
const [loading, setLoading] = React28.useState(false);
|
|
6667
6686
|
const [error, setError] = React28.useState(null);
|
|
@@ -6683,6 +6702,7 @@ function DeleteModal({
|
|
|
6683
6702
|
{
|
|
6684
6703
|
title: "Confirm Delete",
|
|
6685
6704
|
onClose,
|
|
6705
|
+
width,
|
|
6686
6706
|
footer: /* @__PURE__ */ jsxs30(Fragment11, { children: [
|
|
6687
6707
|
/* @__PURE__ */ jsx32(Button, { variant: "outline", size: "sm", onClick: onClose, disabled: loading, children: "Cancel" }),
|
|
6688
6708
|
/* @__PURE__ */ jsxs30(Button, { variant: "danger", size: "sm", onClick: handleDelete, disabled: loading, children: [
|
|
@@ -7160,6 +7180,7 @@ function Table({
|
|
|
7160
7180
|
{
|
|
7161
7181
|
item: viewItem,
|
|
7162
7182
|
fields: viewFields,
|
|
7183
|
+
width: defaultActions.modalWidth,
|
|
7163
7184
|
onClose: () => setViewItem(null)
|
|
7164
7185
|
}
|
|
7165
7186
|
),
|
|
@@ -7172,6 +7193,7 @@ function Table({
|
|
|
7172
7193
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
7173
7194
|
notif: defaultActions.onSuccessNotif,
|
|
7174
7195
|
grid: defaultActions.editFormGrid,
|
|
7196
|
+
width: defaultActions.modalWidth,
|
|
7175
7197
|
onClose: () => setEditItem(null),
|
|
7176
7198
|
onSuccess: (updated) => {
|
|
7177
7199
|
setTableData(
|
|
@@ -7197,6 +7219,7 @@ function Table({
|
|
|
7197
7219
|
baseUrl: defaultActions.baseUrl,
|
|
7198
7220
|
itemId: String(deleteItem[actionIdKey] ?? ""),
|
|
7199
7221
|
notif: defaultActions.onSuccessNotif,
|
|
7222
|
+
width: defaultActions.modalWidth,
|
|
7200
7223
|
onClose: () => setDeleteItem(null),
|
|
7201
7224
|
onSuccess: (deleted) => {
|
|
7202
7225
|
setTableData(
|
|
@@ -7321,7 +7344,7 @@ function ActionBtn2({
|
|
|
7321
7344
|
}
|
|
7322
7345
|
);
|
|
7323
7346
|
}
|
|
7324
|
-
function DGModalShell({ title, onClose, children, footer }) {
|
|
7347
|
+
function DGModalShell({ title, onClose, children, footer, width = "lg" }) {
|
|
7325
7348
|
return createPortal4(
|
|
7326
7349
|
/* @__PURE__ */ jsx33(
|
|
7327
7350
|
"div",
|
|
@@ -7331,7 +7354,7 @@ function DGModalShell({ title, onClose, children, footer }) {
|
|
|
7331
7354
|
onMouseDown: (e) => {
|
|
7332
7355
|
if (e.target === e.currentTarget) onClose();
|
|
7333
7356
|
},
|
|
7334
|
-
children: /* @__PURE__ */ jsxs31("div", { className:
|
|
7357
|
+
children: /* @__PURE__ */ jsxs31("div", { className: `relative w-full ${MODAL_WIDTH[width]} rounded-2xl border border-border bg-card shadow-2xl flex flex-col max-h-[90vh]`, children: [
|
|
7335
7358
|
/* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between px-6 py-4 border-b border-border shrink-0", children: [
|
|
7336
7359
|
/* @__PURE__ */ jsx33("h2", { className: "text-base font-semibold", children: title }),
|
|
7337
7360
|
/* @__PURE__ */ jsx33("button", { onClick: onClose, className: "text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ jsx33(X10, { className: "h-4 w-4" }) })
|
|
@@ -7414,12 +7437,13 @@ function DGFieldRenderer({ field, value, onChange }) {
|
|
|
7414
7437
|
return /* @__PURE__ */ jsx33(Input, { inputType: field.inputType ?? "text", value: value ?? "", onChange: (e) => onChange(e.target.value), placeholder: field.placeholder ?? field.label });
|
|
7415
7438
|
}
|
|
7416
7439
|
}
|
|
7417
|
-
function DGViewModal({ item, fields, onClose }) {
|
|
7440
|
+
function DGViewModal({ item, fields, onClose, width }) {
|
|
7418
7441
|
return /* @__PURE__ */ jsx33(
|
|
7419
7442
|
DGModalShell,
|
|
7420
7443
|
{
|
|
7421
7444
|
title: "View Details",
|
|
7422
7445
|
onClose,
|
|
7446
|
+
width,
|
|
7423
7447
|
footer: /* @__PURE__ */ jsx33("button", { onClick: onClose, className: "px-4 py-1.5 text-sm rounded-xl border border-border hover:bg-accent transition-colors", children: "Close" }),
|
|
7424
7448
|
children: /* @__PURE__ */ jsx33("div", { className: "space-y-3", children: fields.map((f) => /* @__PURE__ */ jsxs31("div", { children: [
|
|
7425
7449
|
/* @__PURE__ */ jsx33("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
|
|
@@ -7437,7 +7461,8 @@ function DGEditModal({
|
|
|
7437
7461
|
onClose,
|
|
7438
7462
|
onSuccess,
|
|
7439
7463
|
notif,
|
|
7440
|
-
grid
|
|
7464
|
+
grid,
|
|
7465
|
+
width
|
|
7441
7466
|
}) {
|
|
7442
7467
|
const [form, setForm] = React29.useState(() => {
|
|
7443
7468
|
const init = {};
|
|
@@ -7485,6 +7510,7 @@ function DGEditModal({
|
|
|
7485
7510
|
{
|
|
7486
7511
|
title: "Edit Record",
|
|
7487
7512
|
onClose,
|
|
7513
|
+
width,
|
|
7488
7514
|
footer: /* @__PURE__ */ jsxs31(Fragment12, { children: [
|
|
7489
7515
|
/* @__PURE__ */ jsx33("button", { onClick: onClose, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl border border-border hover:bg-accent transition-colors", children: "Cancel" }),
|
|
7490
7516
|
/* @__PURE__ */ jsxs31("button", { onClick: handleSubmit, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl bg-primary text-primary-foreground hover:bg-primary-hover transition-colors flex items-center gap-1.5", children: [
|
|
@@ -7522,7 +7548,8 @@ function DGDeleteModal({
|
|
|
7522
7548
|
itemId,
|
|
7523
7549
|
onClose,
|
|
7524
7550
|
onSuccess,
|
|
7525
|
-
notif
|
|
7551
|
+
notif,
|
|
7552
|
+
width
|
|
7526
7553
|
}) {
|
|
7527
7554
|
const [loading, setLoading] = React29.useState(false);
|
|
7528
7555
|
const [error, setError] = React29.useState(null);
|
|
@@ -7544,6 +7571,7 @@ function DGDeleteModal({
|
|
|
7544
7571
|
{
|
|
7545
7572
|
title: "Confirm Delete",
|
|
7546
7573
|
onClose,
|
|
7574
|
+
width,
|
|
7547
7575
|
footer: /* @__PURE__ */ jsxs31(Fragment12, { children: [
|
|
7548
7576
|
/* @__PURE__ */ jsx33("button", { onClick: onClose, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl border border-border hover:bg-accent transition-colors", children: "Cancel" }),
|
|
7549
7577
|
/* @__PURE__ */ jsxs31("button", { onClick: handleDelete, disabled: loading, className: "px-4 py-1.5 text-sm rounded-xl bg-danger text-danger-foreground hover:bg-danger-hover transition-colors flex items-center gap-1.5", children: [
|
|
@@ -7898,7 +7926,7 @@ function DataGrid({
|
|
|
7898
7926
|
] })
|
|
7899
7927
|
] });
|
|
7900
7928
|
})(),
|
|
7901
|
-
defaultActions && viewItem && /* @__PURE__ */ jsx33(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
|
|
7929
|
+
defaultActions && viewItem && /* @__PURE__ */ jsx33(DGViewModal, { item: viewItem, fields: viewFields, width: defaultActions.modalWidth, onClose: () => setViewItem(null) }),
|
|
7902
7930
|
defaultActions && editItem && /* @__PURE__ */ jsx33(
|
|
7903
7931
|
DGEditModal,
|
|
7904
7932
|
{
|
|
@@ -7908,6 +7936,7 @@ function DataGrid({
|
|
|
7908
7936
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
7909
7937
|
notif: defaultActions.onSuccessNotif,
|
|
7910
7938
|
grid: defaultActions.editFormGrid,
|
|
7939
|
+
width: defaultActions.modalWidth,
|
|
7911
7940
|
onClose: () => setEditItem(null),
|
|
7912
7941
|
onSuccess: (updated) => {
|
|
7913
7942
|
setTableData((prev) => prev.map((r) => String(r[actionIdKey]) === String(updated[actionIdKey]) ? updated : r));
|
|
@@ -7926,6 +7955,7 @@ function DataGrid({
|
|
|
7926
7955
|
baseUrl: defaultActions.baseUrl,
|
|
7927
7956
|
itemId: String(deleteItem[actionIdKey] ?? ""),
|
|
7928
7957
|
notif: defaultActions.onSuccessNotif,
|
|
7958
|
+
width: defaultActions.modalWidth,
|
|
7929
7959
|
onClose: () => setDeleteItem(null),
|
|
7930
7960
|
onSuccess: (deleted) => {
|
|
7931
7961
|
setTableData((prev) => prev.filter((r) => String(r[actionIdKey]) !== String(deleted[actionIdKey])));
|