trotl-table 1.0.78 → 1.0.79
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/Table.cjs.js +23 -1
- package/dist/Table.cjs.js.map +1 -1
- package/dist/Table.esm.js +23 -1
- package/dist/Table.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/Table.esm.js
CHANGED
|
@@ -9655,6 +9655,7 @@ function TableInner({
|
|
|
9655
9655
|
customColumns = [],
|
|
9656
9656
|
groupDefaultOpen = false,
|
|
9657
9657
|
showIcons = true,
|
|
9658
|
+
timeoutLoading = 5,
|
|
9658
9659
|
t
|
|
9659
9660
|
}) {
|
|
9660
9661
|
let translate;
|
|
@@ -10227,6 +10228,20 @@ function TableInner({
|
|
|
10227
10228
|
return map;
|
|
10228
10229
|
}, [sortedGroupedData, groupKey]);
|
|
10229
10230
|
const [tableDataFlat, setTableDataFlat] = useState([]);
|
|
10231
|
+
const [loadingTimeoutReached, setLoadingTimeoutReached] = useState(false);
|
|
10232
|
+
useEffect(() => {
|
|
10233
|
+
if (tableDataFlat.length > 0) {
|
|
10234
|
+
setLoadingTimeoutReached(false);
|
|
10235
|
+
return undefined;
|
|
10236
|
+
}
|
|
10237
|
+
const timeoutSeconds = Number(timeoutLoading) && Number(timeoutLoading) >= 0 ? Number(timeoutLoading) : 5;
|
|
10238
|
+
const timerId = window.setTimeout(() => {
|
|
10239
|
+
setLoadingTimeoutReached(true);
|
|
10240
|
+
}, timeoutSeconds * 1000);
|
|
10241
|
+
return () => {
|
|
10242
|
+
window.clearTimeout(timerId);
|
|
10243
|
+
};
|
|
10244
|
+
}, [tableDataFlat.length, timeoutLoading]);
|
|
10230
10245
|
const flattened = useMemo(() => {
|
|
10231
10246
|
const items = [];
|
|
10232
10247
|
// Use the sortedGroupedData here so the flattened list reflects current sorting and filtering
|
|
@@ -11160,7 +11175,14 @@ function TableInner({
|
|
|
11160
11175
|
}, "\u2699\uFE0F") : translate("action")))), /*#__PURE__*/React__default.createElement("div", {
|
|
11161
11176
|
className: "main-table",
|
|
11162
11177
|
ref: listRef
|
|
11163
|
-
}, tableDataFlat.length === 0 ? /*#__PURE__*/React__default.createElement(DotsLoading, null) : /*#__PURE__*/React__default.createElement(
|
|
11178
|
+
}, tableDataFlat.length === 0 && !loadingTimeoutReached ? /*#__PURE__*/React__default.createElement(DotsLoading, null) : tableDataFlat.length === 0 && loadingTimeoutReached ? /*#__PURE__*/React__default.createElement("div", {
|
|
11179
|
+
className: "table-empty",
|
|
11180
|
+
style: {
|
|
11181
|
+
padding: 24,
|
|
11182
|
+
textAlign: 'center',
|
|
11183
|
+
color: '#666'
|
|
11184
|
+
}
|
|
11185
|
+
}, translate("noData")) : /*#__PURE__*/React__default.createElement(AutoSizer, null, ({
|
|
11164
11186
|
height,
|
|
11165
11187
|
width
|
|
11166
11188
|
}) => /*#__PURE__*/React__default.createElement(List, {
|