@sustaina/shared-ui 1.9.4 → 1.9.6
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.d.mts +24 -20
- package/dist/index.d.ts +24 -20
- package/dist/index.js +32 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3678,7 +3678,7 @@ var StatusContentSlot = ({
|
|
|
3678
3678
|
content
|
|
3679
3679
|
] });
|
|
3680
3680
|
};
|
|
3681
|
-
var StatusContentSlot_default = StatusContentSlot;
|
|
3681
|
+
var StatusContentSlot_default = React6__default.memo(StatusContentSlot);
|
|
3682
3682
|
var stateOptions = [
|
|
3683
3683
|
"columnFilters",
|
|
3684
3684
|
"globalFilter",
|
|
@@ -3895,6 +3895,7 @@ var DataTable = ({
|
|
|
3895
3895
|
rowSelection,
|
|
3896
3896
|
rowExpansion,
|
|
3897
3897
|
scrollFetch,
|
|
3898
|
+
activeStatusContent,
|
|
3898
3899
|
statusContent,
|
|
3899
3900
|
rowIdKey,
|
|
3900
3901
|
childrenKey,
|
|
@@ -4010,6 +4011,31 @@ var DataTable = ({
|
|
|
4010
4011
|
);
|
|
4011
4012
|
return { isSomeColumnsFilterable: isSomeColumnsFilterable2, filterableColumns: mergedColumns };
|
|
4012
4013
|
}, [centerVisibleLeafColumns, leftVisibleLeftColumns, rightVisibleLeafColumns]);
|
|
4014
|
+
const autoStatusKey = useMemo(() => {
|
|
4015
|
+
if (isInitialLoading) return "initialLoading";
|
|
4016
|
+
if (isTableEmpty) return "emptyData";
|
|
4017
|
+
if (isTableEmptyAfterFiltering) return "emptyFilteredData";
|
|
4018
|
+
if (scrollFetch?.enabled && !isFiltering && !isInitialLoading) {
|
|
4019
|
+
if (scrollFetch.isFetchingMore) return "fetchingMore";
|
|
4020
|
+
if (scrollFetch.hasMore === false && !scrollFetch.isFetchingMore) return "noMoreData";
|
|
4021
|
+
}
|
|
4022
|
+
return null;
|
|
4023
|
+
}, [
|
|
4024
|
+
isInitialLoading,
|
|
4025
|
+
isFiltering,
|
|
4026
|
+
isTableEmpty,
|
|
4027
|
+
isTableEmptyAfterFiltering,
|
|
4028
|
+
scrollFetch?.enabled,
|
|
4029
|
+
scrollFetch?.hasMore,
|
|
4030
|
+
scrollFetch?.isFetchingMore
|
|
4031
|
+
]);
|
|
4032
|
+
const activeStatusContentComputed = useMemo(() => {
|
|
4033
|
+
if (!activeStatusContent) return autoStatusKey;
|
|
4034
|
+
if (typeof activeStatusContent === "function") {
|
|
4035
|
+
return activeStatusContent({ defaultComputedValue: autoStatusKey });
|
|
4036
|
+
}
|
|
4037
|
+
return activeStatusContent;
|
|
4038
|
+
}, [activeStatusContent, autoStatusKey]);
|
|
4013
4039
|
const fetchMoreOnScrollReached = useCallback(
|
|
4014
4040
|
(containerRefElement) => {
|
|
4015
4041
|
if (!scrollFetch?.enabled || !containerRefElement || scrollFetch?.isFetchingMore || !scrollFetch?.hasMore || !scrollFetch?.fetchMore) {
|
|
@@ -4058,7 +4084,7 @@ var DataTable = ({
|
|
|
4058
4084
|
),
|
|
4059
4085
|
onScroll: (e) => fetchMoreOnScrollReached(e.currentTarget),
|
|
4060
4086
|
children: [
|
|
4061
|
-
|
|
4087
|
+
activeStatusContentComputed === "initialLoading" ? /* @__PURE__ */ jsx(
|
|
4062
4088
|
StatusContentSlot_default,
|
|
4063
4089
|
{
|
|
4064
4090
|
content: statusContent?.initialLoading?.content ?? "Loading...",
|
|
@@ -4069,7 +4095,7 @@ var DataTable = ({
|
|
|
4069
4095
|
},
|
|
4070
4096
|
defaultIcon: /* @__PURE__ */ jsx(Spinner, { size: 48 })
|
|
4071
4097
|
}
|
|
4072
|
-
) :
|
|
4098
|
+
) : activeStatusContentComputed === "emptyData" ? /* @__PURE__ */ jsx(
|
|
4073
4099
|
StatusContentSlot_default,
|
|
4074
4100
|
{
|
|
4075
4101
|
content: statusContent?.emptyData?.content ?? "There's nothing here yet.",
|
|
@@ -4218,7 +4244,7 @@ var DataTable = ({
|
|
|
4218
4244
|
);
|
|
4219
4245
|
}) })
|
|
4220
4246
|
] }),
|
|
4221
|
-
|
|
4247
|
+
activeStatusContentComputed === "emptyFilteredData" && /* @__PURE__ */ jsx(
|
|
4222
4248
|
StatusContentSlot_default,
|
|
4223
4249
|
{
|
|
4224
4250
|
content: statusContent?.emptyFilteredData?.content ?? "No records found. Please try a different search.",
|
|
@@ -4230,7 +4256,7 @@ var DataTable = ({
|
|
|
4230
4256
|
defaultIcon: /* @__PURE__ */ jsx(empty_data_default, { className: "text-[128px]" })
|
|
4231
4257
|
}
|
|
4232
4258
|
),
|
|
4233
|
-
|
|
4259
|
+
activeStatusContentComputed === "fetchingMore" && /* @__PURE__ */ jsx(
|
|
4234
4260
|
StatusContentSlot_default,
|
|
4235
4261
|
{
|
|
4236
4262
|
content: statusContent?.fetchingMore?.content ?? "Loading more...",
|
|
@@ -4240,7 +4266,7 @@ var DataTable = ({
|
|
|
4240
4266
|
}
|
|
4241
4267
|
}
|
|
4242
4268
|
),
|
|
4243
|
-
|
|
4269
|
+
activeStatusContentComputed === "noMoreData" && /* @__PURE__ */ jsx(
|
|
4244
4270
|
StatusContentSlot_default,
|
|
4245
4271
|
{
|
|
4246
4272
|
content: statusContent?.noMoreData?.content,
|