@juv/codego-react-ui 3.2.7 → 3.3.0
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 +46 -11
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.global.js +46 -11
- package/dist/index.js +46 -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: [
|
|
@@ -6801,6 +6819,7 @@ function DeleteModal({
|
|
|
6801
6819
|
{
|
|
6802
6820
|
title: "Confirm Delete",
|
|
6803
6821
|
onClose,
|
|
6822
|
+
width: "lg",
|
|
6804
6823
|
footer: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
6805
6824
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "outline", size: "sm", onClick: onClose, disabled: loading, children: "Cancel" }),
|
|
6806
6825
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Button, { variant: "danger", size: "sm", onClick: handleDelete, disabled: loading, children: [
|
|
@@ -6820,17 +6839,19 @@ function ActionBtn({
|
|
|
6820
6839
|
defaultIcon,
|
|
6821
6840
|
defaultLabel,
|
|
6822
6841
|
defaultVariant,
|
|
6842
|
+
defaultSize,
|
|
6823
6843
|
onClick
|
|
6824
6844
|
}) {
|
|
6825
6845
|
const mode = cfg?.displayMode ?? "icon";
|
|
6826
6846
|
const icon = cfg?.icon ?? defaultIcon;
|
|
6827
6847
|
const label = cfg?.label ?? defaultLabel;
|
|
6848
|
+
const buttonSize = cfg?.size ?? defaultSize ?? "xs";
|
|
6828
6849
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6829
6850
|
Button,
|
|
6830
6851
|
{
|
|
6831
6852
|
type: "button",
|
|
6832
6853
|
title: label,
|
|
6833
|
-
size:
|
|
6854
|
+
size: buttonSize,
|
|
6834
6855
|
variant: cfg?.variant ?? defaultVariant,
|
|
6835
6856
|
rounded: cfg?.rounded ?? "lg",
|
|
6836
6857
|
gradientFrom: cfg?.gradientFrom,
|
|
@@ -6939,6 +6960,7 @@ function Table({
|
|
|
6939
6960
|
defaultIcon: extra.icon,
|
|
6940
6961
|
defaultLabel: extra.label ?? extra.key,
|
|
6941
6962
|
defaultVariant: extra.variant ?? "outline",
|
|
6963
|
+
defaultSize: defaultActions.actionsSize,
|
|
6942
6964
|
onClick: () => extra.onClick(item)
|
|
6943
6965
|
},
|
|
6944
6966
|
extra.key
|
|
@@ -7278,6 +7300,7 @@ function Table({
|
|
|
7278
7300
|
{
|
|
7279
7301
|
item: viewItem,
|
|
7280
7302
|
fields: viewFields,
|
|
7303
|
+
width: defaultActions.modalWidth,
|
|
7281
7304
|
onClose: () => setViewItem(null)
|
|
7282
7305
|
}
|
|
7283
7306
|
),
|
|
@@ -7290,6 +7313,7 @@ function Table({
|
|
|
7290
7313
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
7291
7314
|
notif: defaultActions.onSuccessNotif,
|
|
7292
7315
|
grid: defaultActions.editFormGrid,
|
|
7316
|
+
width: defaultActions.modalWidth,
|
|
7293
7317
|
onClose: () => setEditItem(null),
|
|
7294
7318
|
onSuccess: (updated) => {
|
|
7295
7319
|
setTableData(
|
|
@@ -7410,17 +7434,19 @@ function ActionBtn2({
|
|
|
7410
7434
|
defaultIcon,
|
|
7411
7435
|
defaultLabel,
|
|
7412
7436
|
defaultVariant,
|
|
7437
|
+
defaultSize,
|
|
7413
7438
|
onClick
|
|
7414
7439
|
}) {
|
|
7415
7440
|
const mode = cfg?.displayMode ?? "icon";
|
|
7416
7441
|
const icon = cfg?.icon ?? defaultIcon;
|
|
7417
7442
|
const label = cfg?.label ?? defaultLabel;
|
|
7443
|
+
const buttonSize = cfg?.size ?? defaultSize ?? "xs";
|
|
7418
7444
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7419
7445
|
Button,
|
|
7420
7446
|
{
|
|
7421
7447
|
type: "button",
|
|
7422
7448
|
title: label,
|
|
7423
|
-
size:
|
|
7449
|
+
size: buttonSize,
|
|
7424
7450
|
variant: cfg?.variant ?? defaultVariant,
|
|
7425
7451
|
rounded: cfg?.rounded ?? "lg",
|
|
7426
7452
|
gradientFrom: cfg?.gradientFrom,
|
|
@@ -7439,7 +7465,7 @@ function ActionBtn2({
|
|
|
7439
7465
|
}
|
|
7440
7466
|
);
|
|
7441
7467
|
}
|
|
7442
|
-
function DGModalShell({ title, onClose, children, footer }) {
|
|
7468
|
+
function DGModalShell({ title, onClose, children, footer, width = "lg" }) {
|
|
7443
7469
|
return (0, import_react_dom3.createPortal)(
|
|
7444
7470
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7445
7471
|
"div",
|
|
@@ -7449,7 +7475,7 @@ function DGModalShell({ title, onClose, children, footer }) {
|
|
|
7449
7475
|
onMouseDown: (e) => {
|
|
7450
7476
|
if (e.target === e.currentTarget) onClose();
|
|
7451
7477
|
},
|
|
7452
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className:
|
|
7478
|
+
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
7479
|
/* @__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
7480
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h2", { className: "text-base font-semibold", children: title }),
|
|
7455
7481
|
/* @__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 +7558,13 @@ function DGFieldRenderer({ field, value, onChange }) {
|
|
|
7532
7558
|
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
7559
|
}
|
|
7534
7560
|
}
|
|
7535
|
-
function DGViewModal({ item, fields, onClose }) {
|
|
7561
|
+
function DGViewModal({ item, fields, onClose, width }) {
|
|
7536
7562
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7537
7563
|
DGModalShell,
|
|
7538
7564
|
{
|
|
7539
7565
|
title: "View Details",
|
|
7540
7566
|
onClose,
|
|
7567
|
+
width,
|
|
7541
7568
|
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
7569
|
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
7570
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
|
|
@@ -7555,7 +7582,8 @@ function DGEditModal({
|
|
|
7555
7582
|
onClose,
|
|
7556
7583
|
onSuccess,
|
|
7557
7584
|
notif,
|
|
7558
|
-
grid
|
|
7585
|
+
grid,
|
|
7586
|
+
width
|
|
7559
7587
|
}) {
|
|
7560
7588
|
const [form, setForm] = React29.useState(() => {
|
|
7561
7589
|
const init = {};
|
|
@@ -7603,6 +7631,7 @@ function DGEditModal({
|
|
|
7603
7631
|
{
|
|
7604
7632
|
title: "Edit Record",
|
|
7605
7633
|
onClose,
|
|
7634
|
+
width,
|
|
7606
7635
|
footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
7607
7636
|
/* @__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
7637
|
/* @__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: [
|
|
@@ -7662,6 +7691,7 @@ function DGDeleteModal({
|
|
|
7662
7691
|
{
|
|
7663
7692
|
title: "Confirm Delete",
|
|
7664
7693
|
onClose,
|
|
7694
|
+
width: "lg",
|
|
7665
7695
|
footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
7666
7696
|
/* @__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
7697
|
/* @__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: [
|
|
@@ -7782,6 +7812,7 @@ function DataGrid({
|
|
|
7782
7812
|
defaultIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.Eye, { className: "h-3.5 w-3.5" }),
|
|
7783
7813
|
defaultLabel: "View",
|
|
7784
7814
|
defaultVariant: "outline",
|
|
7815
|
+
defaultSize: defaultActions.actionsSize,
|
|
7785
7816
|
onClick: () => setViewItem(row)
|
|
7786
7817
|
}
|
|
7787
7818
|
),
|
|
@@ -7792,6 +7823,7 @@ function DataGrid({
|
|
|
7792
7823
|
defaultIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.Pencil, { className: "h-3.5 w-3.5" }),
|
|
7793
7824
|
defaultLabel: "Edit",
|
|
7794
7825
|
defaultVariant: "outline",
|
|
7826
|
+
defaultSize: defaultActions.actionsSize,
|
|
7795
7827
|
onClick: () => setEditItem(row)
|
|
7796
7828
|
}
|
|
7797
7829
|
),
|
|
@@ -7802,6 +7834,7 @@ function DataGrid({
|
|
|
7802
7834
|
defaultIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.Trash, { className: "h-3.5 w-3.5" }),
|
|
7803
7835
|
defaultLabel: "Delete",
|
|
7804
7836
|
defaultVariant: "danger",
|
|
7837
|
+
defaultSize: defaultActions.actionsSize,
|
|
7805
7838
|
onClick: () => setDeleteItem(row)
|
|
7806
7839
|
}
|
|
7807
7840
|
),
|
|
@@ -7812,6 +7845,7 @@ function DataGrid({
|
|
|
7812
7845
|
defaultIcon: extra.icon,
|
|
7813
7846
|
defaultLabel: extra.label ?? extra.key,
|
|
7814
7847
|
defaultVariant: extra.variant ?? "outline",
|
|
7848
|
+
defaultSize: defaultActions.actionsSize,
|
|
7815
7849
|
onClick: () => extra.onClick(row)
|
|
7816
7850
|
},
|
|
7817
7851
|
extra.key
|
|
@@ -8016,7 +8050,7 @@ function DataGrid({
|
|
|
8016
8050
|
] })
|
|
8017
8051
|
] });
|
|
8018
8052
|
})(),
|
|
8019
|
-
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
|
|
8053
|
+
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DGViewModal, { item: viewItem, fields: viewFields, width: defaultActions.modalWidth, onClose: () => setViewItem(null) }),
|
|
8020
8054
|
defaultActions && editItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8021
8055
|
DGEditModal,
|
|
8022
8056
|
{
|
|
@@ -8026,6 +8060,7 @@ function DataGrid({
|
|
|
8026
8060
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
8027
8061
|
notif: defaultActions.onSuccessNotif,
|
|
8028
8062
|
grid: defaultActions.editFormGrid,
|
|
8063
|
+
width: defaultActions.modalWidth,
|
|
8029
8064
|
onClose: () => setEditItem(null),
|
|
8030
8065
|
onSuccess: (updated) => {
|
|
8031
8066
|
setTableData((prev) => prev.map((r) => String(r[actionIdKey]) === String(updated[actionIdKey]) ? updated : r));
|
package/dist/index.d.cts
CHANGED
|
@@ -345,6 +345,10 @@ 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
|
+
/** Size of the View / Edit / Delete / extra action buttons. Default "xs". */
|
|
349
|
+
actionsSize?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
350
|
+
/** Width of the Edit/View/Delete modal. Default "lg". */
|
|
351
|
+
modalWidth?: ModalWidth;
|
|
348
352
|
/** Called after a successful edit or delete so the parent can refresh data. */
|
|
349
353
|
onSuccess?: (action: "edit" | "delete", item: T) => void;
|
|
350
354
|
/** Show a toast or notification banner on successful edit/delete */
|
|
@@ -378,6 +382,21 @@ interface ActionSuccessNotif {
|
|
|
378
382
|
/** Extra action element rendered inside the notification */
|
|
379
383
|
action?: React.ReactNode;
|
|
380
384
|
}
|
|
385
|
+
declare const MODAL_WIDTH: {
|
|
386
|
+
readonly sm: "max-w-sm";
|
|
387
|
+
readonly md: "max-w-md";
|
|
388
|
+
readonly lg: "max-w-lg";
|
|
389
|
+
readonly xl: "max-w-xl";
|
|
390
|
+
readonly '2xl': "max-w-2xl";
|
|
391
|
+
readonly '3xl': "max-w-3xl";
|
|
392
|
+
readonly '4xl': "max-w-4xl";
|
|
393
|
+
readonly '5xl': "max-w-5xl";
|
|
394
|
+
readonly '6xl': "max-w-6xl";
|
|
395
|
+
readonly '7xl': "max-w-7xl";
|
|
396
|
+
readonly screen: "max-w-screen-xl";
|
|
397
|
+
readonly full: "max-w-full";
|
|
398
|
+
};
|
|
399
|
+
type ModalWidth = keyof typeof MODAL_WIDTH;
|
|
381
400
|
interface Column<T> {
|
|
382
401
|
key: keyof T | string;
|
|
383
402
|
title: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -345,6 +345,10 @@ 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
|
+
/** Size of the View / Edit / Delete / extra action buttons. Default "xs". */
|
|
349
|
+
actionsSize?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
350
|
+
/** Width of the Edit/View/Delete modal. Default "lg". */
|
|
351
|
+
modalWidth?: ModalWidth;
|
|
348
352
|
/** Called after a successful edit or delete so the parent can refresh data. */
|
|
349
353
|
onSuccess?: (action: "edit" | "delete", item: T) => void;
|
|
350
354
|
/** Show a toast or notification banner on successful edit/delete */
|
|
@@ -378,6 +382,21 @@ interface ActionSuccessNotif {
|
|
|
378
382
|
/** Extra action element rendered inside the notification */
|
|
379
383
|
action?: React.ReactNode;
|
|
380
384
|
}
|
|
385
|
+
declare const MODAL_WIDTH: {
|
|
386
|
+
readonly sm: "max-w-sm";
|
|
387
|
+
readonly md: "max-w-md";
|
|
388
|
+
readonly lg: "max-w-lg";
|
|
389
|
+
readonly xl: "max-w-xl";
|
|
390
|
+
readonly '2xl': "max-w-2xl";
|
|
391
|
+
readonly '3xl': "max-w-3xl";
|
|
392
|
+
readonly '4xl': "max-w-4xl";
|
|
393
|
+
readonly '5xl': "max-w-5xl";
|
|
394
|
+
readonly '6xl': "max-w-6xl";
|
|
395
|
+
readonly '7xl': "max-w-7xl";
|
|
396
|
+
readonly screen: "max-w-screen-xl";
|
|
397
|
+
readonly full: "max-w-full";
|
|
398
|
+
};
|
|
399
|
+
type ModalWidth = keyof typeof MODAL_WIDTH;
|
|
381
400
|
interface Column<T> {
|
|
382
401
|
key: keyof T | string;
|
|
383
402
|
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: [
|
|
@@ -69947,6 +69965,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69947
69965
|
{
|
|
69948
69966
|
title: "Confirm Delete",
|
|
69949
69967
|
onClose,
|
|
69968
|
+
width: "lg",
|
|
69950
69969
|
footer: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
69951
69970
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "outline", size: "sm", onClick: onClose, disabled: loading, children: "Cancel" }),
|
|
69952
69971
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Button, { variant: "danger", size: "sm", onClick: handleDelete, disabled: loading, children: [
|
|
@@ -69966,17 +69985,19 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
69966
69985
|
defaultIcon,
|
|
69967
69986
|
defaultLabel,
|
|
69968
69987
|
defaultVariant,
|
|
69988
|
+
defaultSize,
|
|
69969
69989
|
onClick
|
|
69970
69990
|
}) {
|
|
69971
69991
|
const mode = cfg?.displayMode ?? "icon";
|
|
69972
69992
|
const icon = cfg?.icon ?? defaultIcon;
|
|
69973
69993
|
const label = cfg?.label ?? defaultLabel;
|
|
69994
|
+
const buttonSize = cfg?.size ?? defaultSize ?? "xs";
|
|
69974
69995
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
69975
69996
|
Button,
|
|
69976
69997
|
{
|
|
69977
69998
|
type: "button",
|
|
69978
69999
|
title: label,
|
|
69979
|
-
size:
|
|
70000
|
+
size: buttonSize,
|
|
69980
70001
|
variant: cfg?.variant ?? defaultVariant,
|
|
69981
70002
|
rounded: cfg?.rounded ?? "lg",
|
|
69982
70003
|
gradientFrom: cfg?.gradientFrom,
|
|
@@ -70085,6 +70106,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70085
70106
|
defaultIcon: extra.icon,
|
|
70086
70107
|
defaultLabel: extra.label ?? extra.key,
|
|
70087
70108
|
defaultVariant: extra.variant ?? "outline",
|
|
70109
|
+
defaultSize: defaultActions.actionsSize,
|
|
70088
70110
|
onClick: () => extra.onClick(item)
|
|
70089
70111
|
},
|
|
70090
70112
|
extra.key
|
|
@@ -70424,6 +70446,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70424
70446
|
{
|
|
70425
70447
|
item: viewItem,
|
|
70426
70448
|
fields: viewFields,
|
|
70449
|
+
width: defaultActions.modalWidth,
|
|
70427
70450
|
onClose: () => setViewItem(null)
|
|
70428
70451
|
}
|
|
70429
70452
|
),
|
|
@@ -70436,6 +70459,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70436
70459
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
70437
70460
|
notif: defaultActions.onSuccessNotif,
|
|
70438
70461
|
grid: defaultActions.editFormGrid,
|
|
70462
|
+
width: defaultActions.modalWidth,
|
|
70439
70463
|
onClose: () => setEditItem(null),
|
|
70440
70464
|
onSuccess: (updated) => {
|
|
70441
70465
|
setTableData(
|
|
@@ -70556,17 +70580,19 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70556
70580
|
defaultIcon,
|
|
70557
70581
|
defaultLabel,
|
|
70558
70582
|
defaultVariant,
|
|
70583
|
+
defaultSize,
|
|
70559
70584
|
onClick
|
|
70560
70585
|
}) {
|
|
70561
70586
|
const mode = cfg?.displayMode ?? "icon";
|
|
70562
70587
|
const icon = cfg?.icon ?? defaultIcon;
|
|
70563
70588
|
const label = cfg?.label ?? defaultLabel;
|
|
70589
|
+
const buttonSize = cfg?.size ?? defaultSize ?? "xs";
|
|
70564
70590
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
70565
70591
|
Button,
|
|
70566
70592
|
{
|
|
70567
70593
|
type: "button",
|
|
70568
70594
|
title: label,
|
|
70569
|
-
size:
|
|
70595
|
+
size: buttonSize,
|
|
70570
70596
|
variant: cfg?.variant ?? defaultVariant,
|
|
70571
70597
|
rounded: cfg?.rounded ?? "lg",
|
|
70572
70598
|
gradientFrom: cfg?.gradientFrom,
|
|
@@ -70585,7 +70611,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70585
70611
|
}
|
|
70586
70612
|
);
|
|
70587
70613
|
}
|
|
70588
|
-
function DGModalShell({ title, onClose, children, footer }) {
|
|
70614
|
+
function DGModalShell({ title, onClose, children, footer, width = "lg" }) {
|
|
70589
70615
|
return (0, import_react_dom3.createPortal)(
|
|
70590
70616
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
70591
70617
|
"div",
|
|
@@ -70595,7 +70621,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70595
70621
|
onMouseDown: (e) => {
|
|
70596
70622
|
if (e.target === e.currentTarget) onClose();
|
|
70597
70623
|
},
|
|
70598
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className:
|
|
70624
|
+
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
70625
|
/* @__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
70626
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h2", { className: "text-base font-semibold", children: title }),
|
|
70601
70627
|
/* @__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 +70704,13 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70678
70704
|
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
70705
|
}
|
|
70680
70706
|
}
|
|
70681
|
-
function DGViewModal({ item, fields, onClose }) {
|
|
70707
|
+
function DGViewModal({ item, fields, onClose, width }) {
|
|
70682
70708
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
70683
70709
|
DGModalShell,
|
|
70684
70710
|
{
|
|
70685
70711
|
title: "View Details",
|
|
70686
70712
|
onClose,
|
|
70713
|
+
width,
|
|
70687
70714
|
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
70715
|
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
70716
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
|
|
@@ -70701,7 +70728,8 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70701
70728
|
onClose,
|
|
70702
70729
|
onSuccess,
|
|
70703
70730
|
notif,
|
|
70704
|
-
grid
|
|
70731
|
+
grid,
|
|
70732
|
+
width
|
|
70705
70733
|
}) {
|
|
70706
70734
|
const [form, setForm] = React29.useState(() => {
|
|
70707
70735
|
const init = {};
|
|
@@ -70749,6 +70777,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70749
70777
|
{
|
|
70750
70778
|
title: "Edit Record",
|
|
70751
70779
|
onClose,
|
|
70780
|
+
width,
|
|
70752
70781
|
footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
70753
70782
|
/* @__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
70783
|
/* @__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: [
|
|
@@ -70808,6 +70837,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70808
70837
|
{
|
|
70809
70838
|
title: "Confirm Delete",
|
|
70810
70839
|
onClose,
|
|
70840
|
+
width: "lg",
|
|
70811
70841
|
footer: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
70812
70842
|
/* @__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
70843
|
/* @__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: [
|
|
@@ -70928,6 +70958,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70928
70958
|
defaultIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Eye, { className: "h-3.5 w-3.5" }),
|
|
70929
70959
|
defaultLabel: "View",
|
|
70930
70960
|
defaultVariant: "outline",
|
|
70961
|
+
defaultSize: defaultActions.actionsSize,
|
|
70931
70962
|
onClick: () => setViewItem(row)
|
|
70932
70963
|
}
|
|
70933
70964
|
),
|
|
@@ -70938,6 +70969,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70938
70969
|
defaultIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Pencil, { className: "h-3.5 w-3.5" }),
|
|
70939
70970
|
defaultLabel: "Edit",
|
|
70940
70971
|
defaultVariant: "outline",
|
|
70972
|
+
defaultSize: defaultActions.actionsSize,
|
|
70941
70973
|
onClick: () => setEditItem(row)
|
|
70942
70974
|
}
|
|
70943
70975
|
),
|
|
@@ -70948,6 +70980,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70948
70980
|
defaultIcon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Trash, { className: "h-3.5 w-3.5" }),
|
|
70949
70981
|
defaultLabel: "Delete",
|
|
70950
70982
|
defaultVariant: "danger",
|
|
70983
|
+
defaultSize: defaultActions.actionsSize,
|
|
70951
70984
|
onClick: () => setDeleteItem(row)
|
|
70952
70985
|
}
|
|
70953
70986
|
),
|
|
@@ -70958,6 +70991,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
70958
70991
|
defaultIcon: extra.icon,
|
|
70959
70992
|
defaultLabel: extra.label ?? extra.key,
|
|
70960
70993
|
defaultVariant: extra.variant ?? "outline",
|
|
70994
|
+
defaultSize: defaultActions.actionsSize,
|
|
70961
70995
|
onClick: () => extra.onClick(row)
|
|
70962
70996
|
},
|
|
70963
70997
|
extra.key
|
|
@@ -71162,7 +71196,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
71162
71196
|
] })
|
|
71163
71197
|
] });
|
|
71164
71198
|
})(),
|
|
71165
|
-
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
|
|
71199
|
+
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DGViewModal, { item: viewItem, fields: viewFields, width: defaultActions.modalWidth, onClose: () => setViewItem(null) }),
|
|
71166
71200
|
defaultActions && editItem && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
71167
71201
|
DGEditModal,
|
|
71168
71202
|
{
|
|
@@ -71172,6 +71206,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
71172
71206
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
71173
71207
|
notif: defaultActions.onSuccessNotif,
|
|
71174
71208
|
grid: defaultActions.editFormGrid,
|
|
71209
|
+
width: defaultActions.modalWidth,
|
|
71175
71210
|
onClose: () => setEditItem(null),
|
|
71176
71211
|
onSuccess: (updated) => {
|
|
71177
71212
|
setTableData((prev) => prev.map((r2) => String(r2[actionIdKey]) === String(updated[actionIdKey]) ? updated : r2));
|
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: [
|
|
@@ -6683,6 +6701,7 @@ function DeleteModal({
|
|
|
6683
6701
|
{
|
|
6684
6702
|
title: "Confirm Delete",
|
|
6685
6703
|
onClose,
|
|
6704
|
+
width: "lg",
|
|
6686
6705
|
footer: /* @__PURE__ */ jsxs30(Fragment11, { children: [
|
|
6687
6706
|
/* @__PURE__ */ jsx32(Button, { variant: "outline", size: "sm", onClick: onClose, disabled: loading, children: "Cancel" }),
|
|
6688
6707
|
/* @__PURE__ */ jsxs30(Button, { variant: "danger", size: "sm", onClick: handleDelete, disabled: loading, children: [
|
|
@@ -6702,17 +6721,19 @@ function ActionBtn({
|
|
|
6702
6721
|
defaultIcon,
|
|
6703
6722
|
defaultLabel,
|
|
6704
6723
|
defaultVariant,
|
|
6724
|
+
defaultSize,
|
|
6705
6725
|
onClick
|
|
6706
6726
|
}) {
|
|
6707
6727
|
const mode = cfg?.displayMode ?? "icon";
|
|
6708
6728
|
const icon = cfg?.icon ?? defaultIcon;
|
|
6709
6729
|
const label = cfg?.label ?? defaultLabel;
|
|
6730
|
+
const buttonSize = cfg?.size ?? defaultSize ?? "xs";
|
|
6710
6731
|
return /* @__PURE__ */ jsx32(
|
|
6711
6732
|
Button,
|
|
6712
6733
|
{
|
|
6713
6734
|
type: "button",
|
|
6714
6735
|
title: label,
|
|
6715
|
-
size:
|
|
6736
|
+
size: buttonSize,
|
|
6716
6737
|
variant: cfg?.variant ?? defaultVariant,
|
|
6717
6738
|
rounded: cfg?.rounded ?? "lg",
|
|
6718
6739
|
gradientFrom: cfg?.gradientFrom,
|
|
@@ -6821,6 +6842,7 @@ function Table({
|
|
|
6821
6842
|
defaultIcon: extra.icon,
|
|
6822
6843
|
defaultLabel: extra.label ?? extra.key,
|
|
6823
6844
|
defaultVariant: extra.variant ?? "outline",
|
|
6845
|
+
defaultSize: defaultActions.actionsSize,
|
|
6824
6846
|
onClick: () => extra.onClick(item)
|
|
6825
6847
|
},
|
|
6826
6848
|
extra.key
|
|
@@ -7160,6 +7182,7 @@ function Table({
|
|
|
7160
7182
|
{
|
|
7161
7183
|
item: viewItem,
|
|
7162
7184
|
fields: viewFields,
|
|
7185
|
+
width: defaultActions.modalWidth,
|
|
7163
7186
|
onClose: () => setViewItem(null)
|
|
7164
7187
|
}
|
|
7165
7188
|
),
|
|
@@ -7172,6 +7195,7 @@ function Table({
|
|
|
7172
7195
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
7173
7196
|
notif: defaultActions.onSuccessNotif,
|
|
7174
7197
|
grid: defaultActions.editFormGrid,
|
|
7198
|
+
width: defaultActions.modalWidth,
|
|
7175
7199
|
onClose: () => setEditItem(null),
|
|
7176
7200
|
onSuccess: (updated) => {
|
|
7177
7201
|
setTableData(
|
|
@@ -7292,17 +7316,19 @@ function ActionBtn2({
|
|
|
7292
7316
|
defaultIcon,
|
|
7293
7317
|
defaultLabel,
|
|
7294
7318
|
defaultVariant,
|
|
7319
|
+
defaultSize,
|
|
7295
7320
|
onClick
|
|
7296
7321
|
}) {
|
|
7297
7322
|
const mode = cfg?.displayMode ?? "icon";
|
|
7298
7323
|
const icon = cfg?.icon ?? defaultIcon;
|
|
7299
7324
|
const label = cfg?.label ?? defaultLabel;
|
|
7325
|
+
const buttonSize = cfg?.size ?? defaultSize ?? "xs";
|
|
7300
7326
|
return /* @__PURE__ */ jsx33(
|
|
7301
7327
|
Button,
|
|
7302
7328
|
{
|
|
7303
7329
|
type: "button",
|
|
7304
7330
|
title: label,
|
|
7305
|
-
size:
|
|
7331
|
+
size: buttonSize,
|
|
7306
7332
|
variant: cfg?.variant ?? defaultVariant,
|
|
7307
7333
|
rounded: cfg?.rounded ?? "lg",
|
|
7308
7334
|
gradientFrom: cfg?.gradientFrom,
|
|
@@ -7321,7 +7347,7 @@ function ActionBtn2({
|
|
|
7321
7347
|
}
|
|
7322
7348
|
);
|
|
7323
7349
|
}
|
|
7324
|
-
function DGModalShell({ title, onClose, children, footer }) {
|
|
7350
|
+
function DGModalShell({ title, onClose, children, footer, width = "lg" }) {
|
|
7325
7351
|
return createPortal4(
|
|
7326
7352
|
/* @__PURE__ */ jsx33(
|
|
7327
7353
|
"div",
|
|
@@ -7331,7 +7357,7 @@ function DGModalShell({ title, onClose, children, footer }) {
|
|
|
7331
7357
|
onMouseDown: (e) => {
|
|
7332
7358
|
if (e.target === e.currentTarget) onClose();
|
|
7333
7359
|
},
|
|
7334
|
-
children: /* @__PURE__ */ jsxs31("div", { className:
|
|
7360
|
+
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
7361
|
/* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between px-6 py-4 border-b border-border shrink-0", children: [
|
|
7336
7362
|
/* @__PURE__ */ jsx33("h2", { className: "text-base font-semibold", children: title }),
|
|
7337
7363
|
/* @__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 +7440,13 @@ function DGFieldRenderer({ field, value, onChange }) {
|
|
|
7414
7440
|
return /* @__PURE__ */ jsx33(Input, { inputType: field.inputType ?? "text", value: value ?? "", onChange: (e) => onChange(e.target.value), placeholder: field.placeholder ?? field.label });
|
|
7415
7441
|
}
|
|
7416
7442
|
}
|
|
7417
|
-
function DGViewModal({ item, fields, onClose }) {
|
|
7443
|
+
function DGViewModal({ item, fields, onClose, width }) {
|
|
7418
7444
|
return /* @__PURE__ */ jsx33(
|
|
7419
7445
|
DGModalShell,
|
|
7420
7446
|
{
|
|
7421
7447
|
title: "View Details",
|
|
7422
7448
|
onClose,
|
|
7449
|
+
width,
|
|
7423
7450
|
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
7451
|
children: /* @__PURE__ */ jsx33("div", { className: "space-y-3", children: fields.map((f) => /* @__PURE__ */ jsxs31("div", { children: [
|
|
7425
7452
|
/* @__PURE__ */ jsx33("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
|
|
@@ -7437,7 +7464,8 @@ function DGEditModal({
|
|
|
7437
7464
|
onClose,
|
|
7438
7465
|
onSuccess,
|
|
7439
7466
|
notif,
|
|
7440
|
-
grid
|
|
7467
|
+
grid,
|
|
7468
|
+
width
|
|
7441
7469
|
}) {
|
|
7442
7470
|
const [form, setForm] = React29.useState(() => {
|
|
7443
7471
|
const init = {};
|
|
@@ -7485,6 +7513,7 @@ function DGEditModal({
|
|
|
7485
7513
|
{
|
|
7486
7514
|
title: "Edit Record",
|
|
7487
7515
|
onClose,
|
|
7516
|
+
width,
|
|
7488
7517
|
footer: /* @__PURE__ */ jsxs31(Fragment12, { children: [
|
|
7489
7518
|
/* @__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
7519
|
/* @__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: [
|
|
@@ -7544,6 +7573,7 @@ function DGDeleteModal({
|
|
|
7544
7573
|
{
|
|
7545
7574
|
title: "Confirm Delete",
|
|
7546
7575
|
onClose,
|
|
7576
|
+
width: "lg",
|
|
7547
7577
|
footer: /* @__PURE__ */ jsxs31(Fragment12, { children: [
|
|
7548
7578
|
/* @__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
7579
|
/* @__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: [
|
|
@@ -7664,6 +7694,7 @@ function DataGrid({
|
|
|
7664
7694
|
defaultIcon: /* @__PURE__ */ jsx33(Eye3, { className: "h-3.5 w-3.5" }),
|
|
7665
7695
|
defaultLabel: "View",
|
|
7666
7696
|
defaultVariant: "outline",
|
|
7697
|
+
defaultSize: defaultActions.actionsSize,
|
|
7667
7698
|
onClick: () => setViewItem(row)
|
|
7668
7699
|
}
|
|
7669
7700
|
),
|
|
@@ -7674,6 +7705,7 @@ function DataGrid({
|
|
|
7674
7705
|
defaultIcon: /* @__PURE__ */ jsx33(Pencil3, { className: "h-3.5 w-3.5" }),
|
|
7675
7706
|
defaultLabel: "Edit",
|
|
7676
7707
|
defaultVariant: "outline",
|
|
7708
|
+
defaultSize: defaultActions.actionsSize,
|
|
7677
7709
|
onClick: () => setEditItem(row)
|
|
7678
7710
|
}
|
|
7679
7711
|
),
|
|
@@ -7684,6 +7716,7 @@ function DataGrid({
|
|
|
7684
7716
|
defaultIcon: /* @__PURE__ */ jsx33(Trash4, { className: "h-3.5 w-3.5" }),
|
|
7685
7717
|
defaultLabel: "Delete",
|
|
7686
7718
|
defaultVariant: "danger",
|
|
7719
|
+
defaultSize: defaultActions.actionsSize,
|
|
7687
7720
|
onClick: () => setDeleteItem(row)
|
|
7688
7721
|
}
|
|
7689
7722
|
),
|
|
@@ -7694,6 +7727,7 @@ function DataGrid({
|
|
|
7694
7727
|
defaultIcon: extra.icon,
|
|
7695
7728
|
defaultLabel: extra.label ?? extra.key,
|
|
7696
7729
|
defaultVariant: extra.variant ?? "outline",
|
|
7730
|
+
defaultSize: defaultActions.actionsSize,
|
|
7697
7731
|
onClick: () => extra.onClick(row)
|
|
7698
7732
|
},
|
|
7699
7733
|
extra.key
|
|
@@ -7898,7 +7932,7 @@ function DataGrid({
|
|
|
7898
7932
|
] })
|
|
7899
7933
|
] });
|
|
7900
7934
|
})(),
|
|
7901
|
-
defaultActions && viewItem && /* @__PURE__ */ jsx33(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
|
|
7935
|
+
defaultActions && viewItem && /* @__PURE__ */ jsx33(DGViewModal, { item: viewItem, fields: viewFields, width: defaultActions.modalWidth, onClose: () => setViewItem(null) }),
|
|
7902
7936
|
defaultActions && editItem && /* @__PURE__ */ jsx33(
|
|
7903
7937
|
DGEditModal,
|
|
7904
7938
|
{
|
|
@@ -7908,6 +7942,7 @@ function DataGrid({
|
|
|
7908
7942
|
itemId: String(editItem[actionIdKey] ?? ""),
|
|
7909
7943
|
notif: defaultActions.onSuccessNotif,
|
|
7910
7944
|
grid: defaultActions.editFormGrid,
|
|
7945
|
+
width: defaultActions.modalWidth,
|
|
7911
7946
|
onClose: () => setEditItem(null),
|
|
7912
7947
|
onSuccess: (updated) => {
|
|
7913
7948
|
setTableData((prev) => prev.map((r) => String(r[actionIdKey]) === String(updated[actionIdKey]) ? updated : r));
|