@deepnoid/ui 0.1.30 → 0.1.32
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/.turbo/turbo-build.log +135 -135
- package/dist/chunk-62X5AX5B.mjs +297 -0
- package/dist/{chunk-VCVQMPC7.mjs → chunk-AIIMJZ7L.mjs} +69 -39
- package/dist/{chunk-NKH3OF6I.mjs → chunk-BCMVEGJG.mjs} +1 -1
- package/dist/{chunk-QM4ZSQYX.mjs → chunk-CVQM3T2X.mjs} +1 -1
- package/dist/{chunk-272FMLIL.mjs → chunk-IEJRE6LT.mjs} +7 -4
- package/dist/{chunk-CEZQCD6Z.mjs → chunk-LWRK5TPZ.mjs} +12 -11
- package/dist/{chunk-GLMM253Q.mjs → chunk-P67LLF3G.mjs} +5 -5
- package/dist/components/fileUpload/fileUpload.js +62 -39
- package/dist/components/fileUpload/fileUpload.mjs +2 -2
- package/dist/components/fileUpload/index.js +62 -39
- package/dist/components/fileUpload/index.mjs +2 -2
- package/dist/components/input/index.js +62 -39
- package/dist/components/input/index.mjs +1 -1
- package/dist/components/input/input.d.mts +21 -14
- package/dist/components/input/input.d.ts +21 -14
- package/dist/components/input/input.js +62 -39
- package/dist/components/input/input.mjs +1 -1
- package/dist/components/pagination/index.js +62 -39
- package/dist/components/pagination/index.mjs +2 -2
- package/dist/components/pagination/pagination.js +62 -39
- package/dist/components/pagination/pagination.mjs +2 -2
- package/dist/components/select/index.js +7 -4
- package/dist/components/select/index.mjs +1 -1
- package/dist/components/select/select.d.mts +9 -0
- package/dist/components/select/select.d.ts +9 -0
- package/dist/components/select/select.js +7 -4
- package/dist/components/select/select.mjs +1 -1
- package/dist/components/table/index.js +77 -53
- package/dist/components/table/index.mjs +4 -4
- package/dist/components/table/table-body.js +12 -11
- package/dist/components/table/table-body.mjs +1 -1
- package/dist/components/table/table.d.mts +2 -1
- package/dist/components/table/table.d.ts +2 -1
- package/dist/components/table/table.js +77 -53
- package/dist/components/table/table.mjs +4 -4
- package/dist/components/textarea/index.js +255 -138
- package/dist/components/textarea/index.mjs +2 -1
- package/dist/components/textarea/textarea.d.mts +157 -150
- package/dist/components/textarea/textarea.d.ts +157 -150
- package/dist/components/textarea/textarea.js +255 -138
- package/dist/components/textarea/textarea.mjs +2 -1
- package/dist/index.js +299 -195
- package/dist/index.mjs +7 -7
- package/package.json +1 -1
- package/dist/chunk-BKE6QF6W.mjs +0 -209
|
@@ -737,11 +737,12 @@ var TableBody = ({
|
|
|
737
737
|
classNames,
|
|
738
738
|
className
|
|
739
739
|
}) => {
|
|
740
|
-
const getCellStyle = (
|
|
741
|
-
width:
|
|
742
|
-
minWidth:
|
|
743
|
-
maxWidth:
|
|
744
|
-
height:
|
|
740
|
+
const getCellStyle = (column) => ({
|
|
741
|
+
width: column.width ? `${column.width}px` : void 0,
|
|
742
|
+
minWidth: column.minWidth ? `${column.minWidth}px` : void 0,
|
|
743
|
+
maxWidth: column.maxWidth ? `${column.maxWidth}px` : void 0,
|
|
744
|
+
height: column.height ? `${column.height}px` : void 0,
|
|
745
|
+
textAlign: column.align || "center"
|
|
745
746
|
});
|
|
746
747
|
const renderTdSkeleton = (key) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: slots.td({ class: classNames == null ? void 0 : classNames.td }), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" }) }, key);
|
|
747
748
|
const renderCheckboxCell = (rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -758,16 +759,16 @@ var TableBody = ({
|
|
|
758
759
|
] }, `skeleton-${rowIndex}`);
|
|
759
760
|
const renderEmptyRow = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { colSpan: columns.length + (rowCheckbox ? 1 : 0), className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), children: emptyContent }) });
|
|
760
761
|
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), onClick: () => onRowClick == null ? void 0 : onRowClick(row), children: [
|
|
761
|
-
columns.map((
|
|
762
|
+
columns.map((column, colIdx) => {
|
|
762
763
|
var _a;
|
|
763
|
-
const value = row[
|
|
764
|
-
const formattedValue = ((_a =
|
|
765
|
-
const content =
|
|
764
|
+
const value = row[column.field];
|
|
765
|
+
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
766
|
+
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
766
767
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
767
768
|
"td",
|
|
768
769
|
{
|
|
769
|
-
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }),
|
|
770
|
-
style: getCellStyle(
|
|
770
|
+
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), column.className),
|
|
771
|
+
style: getCellStyle(column),
|
|
771
772
|
children: content
|
|
772
773
|
},
|
|
773
774
|
`${rowIndex}-${colIdx}`
|
|
@@ -813,7 +814,7 @@ var usePagination = ({ currentPage, totalPage, groupSize, handleChangePage }) =>
|
|
|
813
814
|
var usePagination_default = usePagination;
|
|
814
815
|
|
|
815
816
|
// src/components/input/input.tsx
|
|
816
|
-
var import_react3 =
|
|
817
|
+
var import_react3 = require("react");
|
|
817
818
|
|
|
818
819
|
// src/components/icon/template.tsx
|
|
819
820
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -4805,19 +4806,22 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
4805
4806
|
const slots = (0, import_react3.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
4806
4807
|
const getContentProps = (0, import_react3.useCallback)(
|
|
4807
4808
|
() => ({
|
|
4808
|
-
className:
|
|
4809
|
+
className: clsx(
|
|
4810
|
+
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
4811
|
+
inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
|
|
4812
|
+
),
|
|
4809
4813
|
size: originalProps.size
|
|
4810
4814
|
}),
|
|
4811
4815
|
[slots, classNames, originalProps.size]
|
|
4812
4816
|
);
|
|
4813
4817
|
const renderStartContent = () => {
|
|
4814
|
-
if (import_react3.
|
|
4818
|
+
if ((0, import_react3.isValidElement)(startContent)) {
|
|
4815
4819
|
const existingProps = startContent.props;
|
|
4816
4820
|
const mergedProps = {
|
|
4817
4821
|
...getContentProps(),
|
|
4818
4822
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
4819
4823
|
};
|
|
4820
|
-
return import_react3.
|
|
4824
|
+
return (0, import_react3.cloneElement)(startContent, mergedProps);
|
|
4821
4825
|
} else {
|
|
4822
4826
|
const contentProps = getContentProps();
|
|
4823
4827
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ...contentProps, children: startContent });
|
|
@@ -4836,13 +4840,13 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
4836
4840
|
}
|
|
4837
4841
|
);
|
|
4838
4842
|
const renderContentWithIcon = () => {
|
|
4839
|
-
if (import_react3.
|
|
4843
|
+
if ((0, import_react3.isValidElement)(endContent)) {
|
|
4840
4844
|
const existingProps = endContent.props;
|
|
4841
4845
|
const mergedProps = {
|
|
4842
4846
|
...getContentProps(),
|
|
4843
4847
|
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
4844
4848
|
};
|
|
4845
|
-
return import_react3.
|
|
4849
|
+
return (0, import_react3.cloneElement)(endContent, mergedProps);
|
|
4846
4850
|
} else if (errorMessage) {
|
|
4847
4851
|
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
4848
4852
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
|
|
@@ -4877,20 +4881,17 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
4877
4881
|
{
|
|
4878
4882
|
className: clsx(
|
|
4879
4883
|
slots.inputWrapper({ class: classNames == null ? void 0 : classNames.inputWrapper }),
|
|
4880
|
-
inputProps.readOnly ? slots.
|
|
4884
|
+
inputProps.readOnly ? slots.readonlyWrapper({ class: classNames == null ? void 0 : classNames.readonlyWrapper }) : ""
|
|
4881
4885
|
),
|
|
4882
4886
|
children: [
|
|
4883
4887
|
startContent && renderStartContent(),
|
|
4884
4888
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4885
4889
|
"input",
|
|
4886
4890
|
{
|
|
4887
|
-
...inputProps,
|
|
4888
4891
|
ref: ref || inputRef,
|
|
4892
|
+
...inputProps,
|
|
4889
4893
|
readOnly: props.readOnly,
|
|
4890
|
-
className: clsx(
|
|
4891
|
-
slots.input({ class: classNames == null ? void 0 : classNames.input }),
|
|
4892
|
-
inputProps.readOnly ? "!text-body-foreground placeholder:!text-body-foreground" : ""
|
|
4893
|
-
),
|
|
4894
|
+
className: clsx(slots.input({ class: classNames == null ? void 0 : classNames.input })),
|
|
4894
4895
|
size: 0
|
|
4895
4896
|
}
|
|
4896
4897
|
),
|
|
@@ -4898,7 +4899,16 @@ var Input = (0, import_react3.forwardRef)((originalProps, ref) => {
|
|
|
4898
4899
|
]
|
|
4899
4900
|
}
|
|
4900
4901
|
),
|
|
4901
|
-
helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4902
|
+
helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4903
|
+
"p",
|
|
4904
|
+
{
|
|
4905
|
+
className: clsx(
|
|
4906
|
+
slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }),
|
|
4907
|
+
inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
|
|
4908
|
+
),
|
|
4909
|
+
children: helperMessage
|
|
4910
|
+
}
|
|
4911
|
+
),
|
|
4902
4912
|
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
|
|
4903
4913
|
] })
|
|
4904
4914
|
]
|
|
@@ -4910,12 +4920,12 @@ var input_default = Input;
|
|
|
4910
4920
|
var inputStyle = tv(
|
|
4911
4921
|
{
|
|
4912
4922
|
slots: {
|
|
4913
|
-
base: ["group/input", "flex select-none"],
|
|
4923
|
+
base: ["group/input", "flex", "select-none"],
|
|
4914
4924
|
vertical: ["flex-col"],
|
|
4915
4925
|
horizon: ["flex-row", "gap-0"],
|
|
4916
4926
|
label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
|
|
4917
4927
|
innerWrapper: ["flex", "flex-col"],
|
|
4918
|
-
inputWrapper: ["flex", "items-center", "duration-200", "group-has-[p.error]/input
|
|
4928
|
+
inputWrapper: ["flex", "items-center", "duration-200", "group-has-[p.error]/input:!bg-danger-soft"],
|
|
4919
4929
|
input: [
|
|
4920
4930
|
"w-full",
|
|
4921
4931
|
"h-full",
|
|
@@ -4924,8 +4934,8 @@ var inputStyle = tv(
|
|
|
4924
4934
|
"placeholder:text-neutral-main",
|
|
4925
4935
|
"outline-none",
|
|
4926
4936
|
"focus:ring-0",
|
|
4927
|
-
"group-has-[:hover]/input
|
|
4928
|
-
"group-has-[:hover]/input:placeholder
|
|
4937
|
+
"group-has-[:hover]/input:!text-neutral-dark",
|
|
4938
|
+
"group-has-[:hover]/input:placeholder:!text-neutral-dark",
|
|
4929
4939
|
"group-has-[:focus]/input:text-neutral-dark",
|
|
4930
4940
|
"group-has-[:focus]/input:placeholder:text-neutral-dark",
|
|
4931
4941
|
"group-has-[p.error]/input:text-danger-main",
|
|
@@ -4941,13 +4951,22 @@ var inputStyle = tv(
|
|
|
4941
4951
|
],
|
|
4942
4952
|
helperMessage: ["text-neutral-main", "group-has-[:hover]/input:text-neutral-dark"],
|
|
4943
4953
|
errorMessage: ["text-danger-main"],
|
|
4944
|
-
|
|
4954
|
+
readonlyWrapper: [
|
|
4955
|
+
"pointer-events-none",
|
|
4956
|
+
"!text-body-foreground",
|
|
4957
|
+
"placeholder:!text-body-foreground",
|
|
4958
|
+
"group-has-[p.error]/input:!text-danger-main",
|
|
4959
|
+
"group-has-[p.error]/input:placeholder:!text-danger-main",
|
|
4960
|
+
"[&>input]:!text-body-foreground",
|
|
4961
|
+
"[&>input]:placeholder:!text-body-foreground"
|
|
4962
|
+
],
|
|
4963
|
+
readonly: []
|
|
4945
4964
|
},
|
|
4946
4965
|
variants: {
|
|
4947
4966
|
variant: {
|
|
4948
4967
|
solid: {
|
|
4949
4968
|
inputWrapper: ["border-transparent", "bg-trans-soft"],
|
|
4950
|
-
|
|
4969
|
+
readonlyWrapper: ["!bg-trans-light"]
|
|
4951
4970
|
},
|
|
4952
4971
|
outline: {
|
|
4953
4972
|
inputWrapper: [
|
|
@@ -4956,7 +4975,7 @@ var inputStyle = tv(
|
|
|
4956
4975
|
"group-has-[:focus]/input:bg-body-background",
|
|
4957
4976
|
"group-has-[p.error]/input:border-danger-main"
|
|
4958
4977
|
],
|
|
4959
|
-
|
|
4978
|
+
readonlyWrapper: ["!bg-trans-soft"]
|
|
4960
4979
|
},
|
|
4961
4980
|
underline: {
|
|
4962
4981
|
inputWrapper: [
|
|
@@ -4966,30 +4985,31 @@ var inputStyle = tv(
|
|
|
4966
4985
|
"group-has-[:focus]/input:bg-body-background",
|
|
4967
4986
|
"group-has-[p.error]/input:border-danger-main"
|
|
4968
4987
|
],
|
|
4969
|
-
|
|
4988
|
+
readonlyWrapper: ["!bg-trans-soft"]
|
|
4970
4989
|
}
|
|
4971
4990
|
},
|
|
4972
4991
|
color: {
|
|
4973
4992
|
primary: {
|
|
4974
4993
|
content: [
|
|
4975
|
-
"group-has-[:focus]/input
|
|
4976
|
-
"
|
|
4994
|
+
"group-has-[:focus]/input:!text-primary-main",
|
|
4995
|
+
"group-has-[p.error]:not(input:focus):hover/input:!text-primary-main"
|
|
4977
4996
|
],
|
|
4978
4997
|
helperMessage: [
|
|
4979
|
-
"group-has-[:focus]/input
|
|
4980
|
-
"group-has-[:focus:hover]/input
|
|
4981
|
-
"group-has-[:focus]/input:hover
|
|
4982
|
-
]
|
|
4998
|
+
"group-has-[:focus]/input:!text-primary-main",
|
|
4999
|
+
"group-has-[:focus:hover]/input:!text-primary-main",
|
|
5000
|
+
"group-has-[:focus]/input:hover:!text-primary-main"
|
|
5001
|
+
],
|
|
5002
|
+
readonly: ["!text-primary-main"]
|
|
4983
5003
|
},
|
|
4984
5004
|
secondary: {
|
|
4985
5005
|
content: [
|
|
4986
|
-
"group-has-[:focus]/input
|
|
4987
|
-
"
|
|
5006
|
+
"group-has-[:focus]/input:!text-secondary-main",
|
|
5007
|
+
"group-has-[p.error]:not(input:focus):hover/input:!text-secondary-main"
|
|
4988
5008
|
],
|
|
4989
5009
|
helperMessage: [
|
|
4990
|
-
"group-has-[:focus]/input
|
|
4991
|
-
"group-has-[:focus:hover]/input
|
|
4992
|
-
"group-has-[:focus]/input:hover
|
|
5010
|
+
"group-has-[:focus]/input:!text-secondary-main",
|
|
5011
|
+
"group-has-[:focus:hover]/input:!text-secondary-main",
|
|
5012
|
+
"group-has-[:focus]/input:hover:!text-secondary-main"
|
|
4993
5013
|
]
|
|
4994
5014
|
}
|
|
4995
5015
|
},
|
|
@@ -5040,14 +5060,14 @@ var inputStyle = tv(
|
|
|
5040
5060
|
},
|
|
5041
5061
|
disabled: {
|
|
5042
5062
|
true: {
|
|
5043
|
-
inputWrapper: ["!bg-neutral-soft", "pointer-events-none", "
|
|
5063
|
+
inputWrapper: ["!bg-neutral-soft", "pointer-events-none", "group-has-[p.error]/input:!text-danger-light"],
|
|
5044
5064
|
input: [
|
|
5045
|
-
"text-neutral-light",
|
|
5046
|
-
"placeholder
|
|
5047
|
-
"group-has-[p.error]/input
|
|
5048
|
-
"group-has-[p.error]/input:placeholder
|
|
5065
|
+
"!text-neutral-light",
|
|
5066
|
+
"placeholder:!text-neutral-light",
|
|
5067
|
+
"group-has-[p.error]/input:!text-danger-light",
|
|
5068
|
+
"group-has-[p.error]/input:placeholder:!text-danger-light"
|
|
5049
5069
|
],
|
|
5050
|
-
content: ["text-neutral-light", "group-has-[p.error]/input:text-danger-light"],
|
|
5070
|
+
content: ["!text-neutral-light", "group-has-[p.error]/input:text-danger-light"],
|
|
5051
5071
|
helperMessage: ["!text-neutral-light"],
|
|
5052
5072
|
errorMessage: ["!text-danger-light"]
|
|
5053
5073
|
}
|
|
@@ -5114,7 +5134,11 @@ var inputStyle = tv(
|
|
|
5114
5134
|
disabled: true,
|
|
5115
5135
|
variant: ["outline", "underline"],
|
|
5116
5136
|
class: {
|
|
5117
|
-
inputWrapper: ["!bg-body-background", "group-has-[p.error]/input
|
|
5137
|
+
inputWrapper: ["!bg-body-background", "group-has-[p.error]/input:!border-danger-light"],
|
|
5138
|
+
content: [
|
|
5139
|
+
"group-has-[p.error]/input:!text-danger-light",
|
|
5140
|
+
"group-has-[p.error]/input:placeholder:!text-danger-light"
|
|
5141
|
+
]
|
|
5118
5142
|
}
|
|
5119
5143
|
}
|
|
5120
5144
|
],
|
|
@@ -5435,7 +5459,7 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
5435
5459
|
columns,
|
|
5436
5460
|
rowCheckbox = false,
|
|
5437
5461
|
onRowClick,
|
|
5438
|
-
totalData,
|
|
5462
|
+
totalData = 0,
|
|
5439
5463
|
pagination,
|
|
5440
5464
|
onPageChange,
|
|
5441
5465
|
emptyContent,
|
|
@@ -5445,8 +5469,8 @@ var Table = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
|
5445
5469
|
size,
|
|
5446
5470
|
skeletonRow
|
|
5447
5471
|
} = { ...props, ...variantProps };
|
|
5448
|
-
const { page = 1, perPage =
|
|
5449
|
-
const showPagination = pagination &&
|
|
5472
|
+
const { page = 1, perPage = 15 } = pagination || {};
|
|
5473
|
+
const showPagination = pagination && totalData > 0 && !isLoading;
|
|
5450
5474
|
const [checkedRows, setCheckedRows] = (0, import_react5.useState)(/* @__PURE__ */ new Set());
|
|
5451
5475
|
const divRef = (0, import_react5.useRef)(null);
|
|
5452
5476
|
(0, import_react5.useImperativeHandle)(
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
import "../../chunk-DX3KXNP6.mjs";
|
|
3
3
|
import {
|
|
4
4
|
table_default
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-P67LLF3G.mjs";
|
|
6
6
|
import {
|
|
7
7
|
definition_table_default
|
|
8
8
|
} from "../../chunk-6TIIBU7J.mjs";
|
|
9
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-LWRK5TPZ.mjs";
|
|
10
10
|
import "../../chunk-P7YYNA6L.mjs";
|
|
11
11
|
import "../../chunk-DQRAFUDA.mjs";
|
|
12
12
|
import "../../chunk-M37VBNB3.mjs";
|
|
13
13
|
import "../../chunk-MZ76AA76.mjs";
|
|
14
14
|
import "../../chunk-6PN3DGOE.mjs";
|
|
15
15
|
import "../../chunk-7B7LRG5J.mjs";
|
|
16
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-CVQM3T2X.mjs";
|
|
17
17
|
import "../../chunk-F3HENRVM.mjs";
|
|
18
18
|
import "../../chunk-2GCSFWHD.mjs";
|
|
19
|
-
import "../../chunk-
|
|
19
|
+
import "../../chunk-AIIMJZ7L.mjs";
|
|
20
20
|
import "../../chunk-QZ3LVYJW.mjs";
|
|
21
21
|
import "../../chunk-D6QI3DJG.mjs";
|
|
22
22
|
import "../../chunk-ZYIIXWVY.mjs";
|
|
@@ -679,11 +679,12 @@ var TableBody = ({
|
|
|
679
679
|
classNames,
|
|
680
680
|
className
|
|
681
681
|
}) => {
|
|
682
|
-
const getCellStyle = (
|
|
683
|
-
width:
|
|
684
|
-
minWidth:
|
|
685
|
-
maxWidth:
|
|
686
|
-
height:
|
|
682
|
+
const getCellStyle = (column) => ({
|
|
683
|
+
width: column.width ? `${column.width}px` : void 0,
|
|
684
|
+
minWidth: column.minWidth ? `${column.minWidth}px` : void 0,
|
|
685
|
+
maxWidth: column.maxWidth ? `${column.maxWidth}px` : void 0,
|
|
686
|
+
height: column.height ? `${column.height}px` : void 0,
|
|
687
|
+
textAlign: column.align || "center"
|
|
687
688
|
});
|
|
688
689
|
const renderTdSkeleton = (key) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { className: slots.td({ class: classNames == null ? void 0 : classNames.td }), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" }) }, key);
|
|
689
690
|
const renderCheckboxCell = (rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -700,16 +701,16 @@ var TableBody = ({
|
|
|
700
701
|
] }, `skeleton-${rowIndex}`);
|
|
701
702
|
const renderEmptyRow = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { colSpan: columns.length + (rowCheckbox ? 1 : 0), className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), children: emptyContent }) });
|
|
702
703
|
const renderDataRow = (row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), onClick: () => onRowClick == null ? void 0 : onRowClick(row), children: [
|
|
703
|
-
columns.map((
|
|
704
|
+
columns.map((column, colIdx) => {
|
|
704
705
|
var _a;
|
|
705
|
-
const value = row[
|
|
706
|
-
const formattedValue = ((_a =
|
|
707
|
-
const content =
|
|
706
|
+
const value = row[column.field];
|
|
707
|
+
const formattedValue = ((_a = column.valueFormatter) == null ? void 0 : _a.call(column, { value, field: column.field })) || value;
|
|
708
|
+
const content = column.renderCell ? column.renderCell({ id: row.id, field: column.field, value, formattedValue, row }) : formattedValue;
|
|
708
709
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
709
710
|
"td",
|
|
710
711
|
{
|
|
711
|
-
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }),
|
|
712
|
-
style: getCellStyle(
|
|
712
|
+
className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), column.className),
|
|
713
|
+
style: getCellStyle(column),
|
|
713
714
|
children: content
|
|
714
715
|
},
|
|
715
716
|
`${rowIndex}-${colIdx}`
|
|
@@ -206,10 +206,11 @@ type ValueFormatterParams<V = any> = {
|
|
|
206
206
|
value: V;
|
|
207
207
|
};
|
|
208
208
|
type TableRow<R extends RowValue = RowValue> = R;
|
|
209
|
+
type Align = "center" | "left" | "right";
|
|
209
210
|
type TableColumn<R extends RowValue = RowValue, V = any, F = V> = {
|
|
210
211
|
field: string;
|
|
211
212
|
headerName?: string | ReactElement;
|
|
212
|
-
align?:
|
|
213
|
+
align?: Align;
|
|
213
214
|
width?: number;
|
|
214
215
|
minWidth?: number;
|
|
215
216
|
maxWidth?: number;
|
|
@@ -206,10 +206,11 @@ type ValueFormatterParams<V = any> = {
|
|
|
206
206
|
value: V;
|
|
207
207
|
};
|
|
208
208
|
type TableRow<R extends RowValue = RowValue> = R;
|
|
209
|
+
type Align = "center" | "left" | "right";
|
|
209
210
|
type TableColumn<R extends RowValue = RowValue, V = any, F = V> = {
|
|
210
211
|
field: string;
|
|
211
212
|
headerName?: string | ReactElement;
|
|
212
|
-
align?:
|
|
213
|
+
align?: Align;
|
|
213
214
|
width?: number;
|
|
214
215
|
minWidth?: number;
|
|
215
216
|
maxWidth?: number;
|