@cloudtower/eagle 0.29.7 → 0.29.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.
@@ -1,26 +1,43 @@
1
- import React__default from 'react';
1
+ import React__default, { useMemo } from 'react';
2
2
  import useElementsSize from '../../hooks/useElementsSize.js';
3
3
 
4
- const TableSkeleton = props => {
4
+ const DynamicTableSkeleton = props => {
5
+ var _a;
5
6
  const {
6
- rows: _rowLength,
7
+ rowsCount: _rowsCount,
7
8
  scrollY = false,
8
9
  headerHeight = 48,
9
10
  itemHeight: _itemHeight
10
11
  } = props;
11
12
  const sizes = useElementsSize({
12
- loading: ".ant-table-container .ant-table-content .ant-table-tbody",
13
- scrollYLoading: ".ant-table-container .ant-table-tbody"
13
+ loading: ".ant-table-container .ant-table-content .ant-table-tbody:not(:has(.ant-empty))",
14
+ scrollYLoading: ".ant-table-container .ant-table-tbody:not(:has(.ant-empty))"
14
15
  }, {});
16
+ const containerHeight = (_a = sizes[scrollY ? "scrollYLoading" : "loading"].height) != null ? _a : 0;
15
17
  const itemSizes = useElementsSize({
16
- loading: ".ant-table-container .ant-table-content .ant-table-tbody > tr:not(:first-child)",
17
- scrollYLoading: ".ant-table-container .ant-table-tbody > tr:not(:first-child)"
18
+ loading: ".ant-table-container .ant-table-content .ant-table-tbody > tr:not(:first-child):not(:has(.ant-empty))",
19
+ scrollYLoading: ".ant-table-container .ant-table-tbody > tr:not(:first-child):not(:has(.ant-empty))"
18
20
  }, {});
19
- const itemHeight = (_itemHeight != null ? _itemHeight : itemSizes[scrollY ? "scrollYLoading" : "loading"].height) || 40;
20
- const rowLength = (_rowLength != null ? _rowLength : Math.ceil(sizes[scrollY ? "scrollYLoading" : "loading"].height / itemHeight)) || 20;
21
- const rows = Array.from({
22
- length: rowLength
23
- }, (r, i) => i);
21
+ const dynamicItemHeight = itemSizes[scrollY ? "scrollYLoading" : "loading"].height;
22
+ const defaultItemHeight = 40;
23
+ const itemHeight = (_itemHeight != null ? _itemHeight : dynamicItemHeight) || defaultItemHeight;
24
+ const rowsCount = (_rowsCount != null ? _rowsCount : Math.ceil(containerHeight / itemHeight)) || 50;
25
+ return /* @__PURE__ */React__default.createElement(TableSkeleton, {
26
+ rowsCount,
27
+ itemHeight,
28
+ headerHeight
29
+ });
30
+ };
31
+ const TableLoadingStyle = "E_t1g36k2w";
32
+ const TableSkeleton = props => {
33
+ const {
34
+ rowsCount = 50,
35
+ headerHeight = 48,
36
+ itemHeight
37
+ } = props;
38
+ const rows = useMemo(() => Array.from({
39
+ length: rowsCount
40
+ }, (r, i) => i), [rowsCount]);
24
41
  return /* @__PURE__ */React__default.createElement("div", {
25
42
  className: `${TableLoadingStyle} table-loading`
26
43
  }, /* @__PURE__ */React__default.createElement("div", {
@@ -52,6 +69,5 @@ const TableSkeleton = props => {
52
69
  className: "td-loading"
53
70
  }))));
54
71
  };
55
- const TableLoadingStyle = "E_t1g36k2w";
56
72
 
57
- export { TableSkeleton };
73
+ export { DynamicTableSkeleton, TableSkeleton };
@@ -6,7 +6,8 @@ import { Table as Table$2 } from 'antd';
6
6
  import cs from 'classnames';
7
7
  import { isNil } from 'lodash';
8
8
  import React__default, { useRef, useMemo } from 'react';
9
- import { TableSkeleton } from './TableSkeleton.js';
9
+ import { DynamicTableSkeleton } from './TableSkeleton.js';
10
+ export { TableSkeleton } from './TableSkeleton.js';
10
11
 
11
12
  var __defProp = Object.defineProperty;
12
13
  var __defProps = Object.defineProperties;
@@ -29,7 +30,8 @@ var __spreadValues = (a, b) => {
29
30
  };
30
31
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
31
32
  const TableContainerStyle = "E_tc97u5y";
32
- const tableStyleCover = "E_tfzf37v";
33
+ const emptyTableStyle = "E_efzf37v";
34
+ const tableStyleCover = "E_t1fisho6";
33
35
  const Table = props => {
34
36
  var _a;
35
37
  const {
@@ -90,11 +92,11 @@ const Table = props => {
90
92
  return /* @__PURE__ */React__default.createElement("div", {
91
93
  className: cx(TableContainerStyle, "table-container", !hasScrollBard && "no-scroll-bar")
92
94
  }, /* @__PURE__ */React__default.createElement(Table$2, {
93
- className: cs(tableStyleCover, !(dataSource == null ? void 0 : dataSource.length) && "empty-table", rowSelection && "has-selection"),
95
+ className: cs(tableStyleCover, !(dataSource == null ? void 0 : dataSource.length) && emptyTableStyle, rowSelection && "has-selection"),
94
96
  bordered,
95
97
  loading: {
96
98
  spinning: loading || initLoading,
97
- indicator: /* @__PURE__ */React__default.createElement(TableSkeleton, __spreadValues({
99
+ indicator: /* @__PURE__ */React__default.createElement(DynamicTableSkeleton, __spreadValues({
98
100
  scrollY: !!((_a = props.scroll) == null ? void 0 : _a.y)
99
101
  }, skeletonProps))
100
102
  },
@@ -127,4 +129,4 @@ const Table = props => {
127
129
  };
128
130
  var Table$1 = Table;
129
131
 
130
- export { ColumnTitle, TableSkeleton, Table$1 as default, tableStyleCover, useTableBodyHasScrollBar };
132
+ export { ColumnTitle, DynamicTableSkeleton, Table$1 as default, emptyTableStyle, tableStyleCover, useTableBodyHasScrollBar };
package/dist/esm/index.js CHANGED
@@ -63,7 +63,7 @@ export { default as Speed } from './core/Speed/index.js';
63
63
  export { default as StatusCapsule, StatusIcon, StatusPresetColors } from './core/StatusCapsule/index.js';
64
64
  export { default as Steps } from './core/Steps/index.js';
65
65
  export { default as Switch } from './core/Switch/index.js';
66
- export { default as Table, tableStyleCover } from './core/Table/index.js';
66
+ export { default as Table, emptyTableStyle, tableStyleCover } from './core/Table/index.js';
67
67
  export { default as TableForm } from './core/TableForm/index.js';
68
68
  export { default as Tag, TagPresetColors } from './core/Tag/index.js';
69
69
  export { default as TextArea } from './core/TextArea/index.js';
@@ -97,7 +97,7 @@ export { SidebarMenu } from './core/SidebarMenu/SidebarMenu.js';
97
97
  export { CircleProgress } from './core/StepProgress/index.js';
98
98
  export { CannotOperationInfo, CommonContent, ContentWrapper, Desc, Description, Divider, Dot, ErrorSpan, ExpandArrow, FieldTitle, FormField, FormItemDiv, FormSectionTitle, FormWrapper, FullView, HorizontalWizardModalCompactStyle, HorizontalWizardModalLooseStyle, InfoAlert, InputStyle, KitInputStyle, LeftEndInputStyle, LeftEndSelectStyle, LightDesc, LoadingWrapper, ModalBody, ModalWrapper, NameTag, NormalAlert, NoticeAlert, OperationWraper, RadioDesc, RightEndInputStyle, RightEndSelectStyle, SelectOptionDisabledText, TagSpan, TertiaryText, WarningAlert, WizardBody, radioStyle } from './core/Styled/index.js';
99
99
  export { useTableBodyHasScrollBar } from './core/Table/common.js';
100
- export { TableSkeleton } from './core/Table/TableSkeleton.js';
100
+ export { DynamicTableSkeleton, TableSkeleton } from './core/Table/TableSkeleton.js';
101
101
  export { ColumnTitle, EmptyRowMenu, KitTableContext, TableLoading } from './core/Table/TableWidget.js';
102
102
  export { ValidateTriggerType } from './core/TableForm/types.js';
103
103
  export { Typo } from './core/Typo/index.js';