@cloudtower/eagle 0.29.6 → 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.
@@ -7,26 +7,43 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
7
 
8
8
  var React__default = /*#__PURE__*/_interopDefault(React);
9
9
 
10
- const TableSkeleton = props => {
10
+ const DynamicTableSkeleton = props => {
11
+ var _a;
11
12
  const {
12
- rows: _rowLength,
13
+ rowsCount: _rowsCount,
13
14
  scrollY = false,
14
15
  headerHeight = 48,
15
16
  itemHeight: _itemHeight
16
17
  } = props;
17
18
  const sizes = useElementsSize({
18
- loading: ".ant-table-container .ant-table-content .ant-table-tbody",
19
- scrollYLoading: ".ant-table-container .ant-table-tbody"
19
+ loading: ".ant-table-container .ant-table-content .ant-table-tbody:not(:has(.ant-empty))",
20
+ scrollYLoading: ".ant-table-container .ant-table-tbody:not(:has(.ant-empty))"
20
21
  }, {});
22
+ const containerHeight = (_a = sizes[scrollY ? "scrollYLoading" : "loading"].height) != null ? _a : 0;
21
23
  const itemSizes = useElementsSize({
22
- loading: ".ant-table-container .ant-table-content .ant-table-tbody > tr:not(:first-child)",
23
- scrollYLoading: ".ant-table-container .ant-table-tbody > tr:not(:first-child)"
24
+ loading: ".ant-table-container .ant-table-content .ant-table-tbody > tr:not(:first-child):not(:has(.ant-empty))",
25
+ scrollYLoading: ".ant-table-container .ant-table-tbody > tr:not(:first-child):not(:has(.ant-empty))"
24
26
  }, {});
25
- const itemHeight = (_itemHeight != null ? _itemHeight : itemSizes[scrollY ? "scrollYLoading" : "loading"].height) || 40;
26
- const rowLength = (_rowLength != null ? _rowLength : Math.ceil(sizes[scrollY ? "scrollYLoading" : "loading"].height / itemHeight)) || 20;
27
- const rows = Array.from({
28
- length: rowLength
29
- }, (r, i) => i);
27
+ const dynamicItemHeight = itemSizes[scrollY ? "scrollYLoading" : "loading"].height;
28
+ const defaultItemHeight = 40;
29
+ const itemHeight = (_itemHeight != null ? _itemHeight : dynamicItemHeight) || defaultItemHeight;
30
+ const rowsCount = (_rowsCount != null ? _rowsCount : Math.ceil(containerHeight / itemHeight)) || 50;
31
+ return /* @__PURE__ */React__default.default.createElement(TableSkeleton, {
32
+ rowsCount,
33
+ itemHeight,
34
+ headerHeight
35
+ });
36
+ };
37
+ const TableLoadingStyle = "E_t1g36k2w";
38
+ const TableSkeleton = props => {
39
+ const {
40
+ rowsCount = 50,
41
+ headerHeight = 48,
42
+ itemHeight
43
+ } = props;
44
+ const rows = React.useMemo(() => Array.from({
45
+ length: rowsCount
46
+ }, (r, i) => i), [rowsCount]);
30
47
  return /* @__PURE__ */React__default.default.createElement("div", {
31
48
  className: `${TableLoadingStyle} table-loading`
32
49
  }, /* @__PURE__ */React__default.default.createElement("div", {
@@ -58,6 +75,6 @@ const TableSkeleton = props => {
58
75
  className: "td-loading"
59
76
  }))));
60
77
  };
61
- const TableLoadingStyle = "E_t1g36k2w";
62
78
 
79
+ exports.DynamicTableSkeleton = DynamicTableSkeleton;
63
80
  exports.TableSkeleton = TableSkeleton;
@@ -37,7 +37,8 @@ var __spreadValues = (a, b) => {
37
37
  };
38
38
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
39
39
  const TableContainerStyle = "E_tc97u5y";
40
- const tableStyleCover = "E_tfzf37v";
40
+ const emptyTableStyle = "E_efzf37v";
41
+ const tableStyleCover = "E_t1fisho6";
41
42
  const Table = props => {
42
43
  var _a;
43
44
  const {
@@ -54,7 +55,8 @@ const Table = props => {
54
55
  rowSelection,
55
56
  empty,
56
57
  tableLayout = "fixed",
57
- initLoading,
58
+ // FIXME Should be removed at 0.30.x
59
+ initLoading = false,
58
60
  rowKey,
59
61
  wrapper,
60
62
  pagination,
@@ -97,11 +99,11 @@ const Table = props => {
97
99
  return /* @__PURE__ */React__default.default.createElement("div", {
98
100
  className: core.cx(TableContainerStyle, "table-container", !hasScrollBard && "no-scroll-bar")
99
101
  }, /* @__PURE__ */React__default.default.createElement(antd.Table, {
100
- className: cs__default.default(tableStyleCover, !(dataSource == null ? void 0 : dataSource.length) && "empty-table", initLoading && "table-init-loading", rowSelection && "has-selection"),
102
+ className: cs__default.default(tableStyleCover, !(dataSource == null ? void 0 : dataSource.length) && emptyTableStyle, rowSelection && "has-selection"),
101
103
  bordered,
102
104
  loading: {
103
- spinning: loading,
104
- indicator: /* @__PURE__ */React__default.default.createElement(TableSkeleton.TableSkeleton, __spreadValues({
105
+ spinning: loading || initLoading,
106
+ indicator: /* @__PURE__ */React__default.default.createElement(TableSkeleton.DynamicTableSkeleton, __spreadValues({
105
107
  scrollY: !!((_a = props.scroll) == null ? void 0 : _a.y)
106
108
  }, skeletonProps))
107
109
  },
@@ -139,6 +141,8 @@ exports.ColumnTitle = TableWidget.ColumnTitle;
139
141
  exports.EmptyRowMenu = TableWidget.EmptyRowMenu;
140
142
  exports.KitTableContext = TableWidget.KitTableContext;
141
143
  exports.TableLoading = TableWidget.TableLoading;
144
+ exports.DynamicTableSkeleton = TableSkeleton.DynamicTableSkeleton;
142
145
  exports.TableSkeleton = TableSkeleton.TableSkeleton;
143
146
  exports.default = Table$1;
147
+ exports.emptyTableStyle = emptyTableStyle;
144
148
  exports.tableStyleCover = tableStyleCover;
package/dist/cjs/index.js CHANGED
@@ -366,6 +366,7 @@ exports.StatusPresetColors = index$U.StatusPresetColors;
366
366
  exports.Steps = index$V;
367
367
  exports.Switch = index$W;
368
368
  exports.Table = index$X.default;
369
+ exports.emptyTableStyle = index$X.emptyTableStyle;
369
370
  exports.tableStyleCover = index$X.tableStyleCover;
370
371
  exports.TableForm = index$Y.default;
371
372
  exports.Tag = index$Z.default;
@@ -470,6 +471,7 @@ exports.WarningAlert = index$1a.WarningAlert;
470
471
  exports.WizardBody = index$1a.WizardBody;
471
472
  exports.radioStyle = index$1a.radioStyle;
472
473
  exports.useTableBodyHasScrollBar = common.useTableBodyHasScrollBar;
474
+ exports.DynamicTableSkeleton = TableSkeleton.DynamicTableSkeleton;
473
475
  exports.TableSkeleton = TableSkeleton.TableSkeleton;
474
476
  exports.ColumnTitle = TableWidget.ColumnTitle;
475
477
  exports.EmptyRowMenu = TableWidget.EmptyRowMenu;