@cloudtower/eagle 0.31.6 → 0.31.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.
@@ -22,7 +22,7 @@ const AffixColumnHeaderCell = ({ data, column, onChange, onBlur }) => {
22
22
  },
23
23
  [prefix, onChange]
24
24
  );
25
- return /* @__PURE__ */ React__default.createElement(Space, null, !column.disablePrefix ? /* @__PURE__ */ React__default.createElement(
25
+ return /* @__PURE__ */ React__default.createElement(Space, { style: { marginTop: "4px" } }, !column.disablePrefix ? /* @__PURE__ */ React__default.createElement(
26
26
  Input,
27
27
  {
28
28
  value: prefix,
@@ -8,7 +8,7 @@ const CheckboxColumnHeaderCell = ({ onChange }) => {
8
8
  },
9
9
  [onChange]
10
10
  );
11
- return /* @__PURE__ */ React__default.createElement(Checkbox, { onChange: _onChange });
11
+ return /* @__PURE__ */ React__default.createElement(Checkbox, { style: { marginTop: "4px" }, onChange: _onChange });
12
12
  };
13
13
  const CheckboxColumnBodyCell = ({ data, column, index, onChange }) => {
14
14
  const value = data[index][column.key] === void 0 ? column.defaultValue : data[index][column.key];
@@ -68,6 +68,7 @@ const InputColumnHeaderCell = ({ disabled, column, onChange, onBlur, onVisibleCh
68
68
  return /* @__PURE__ */ React__default.createElement(
69
69
  CustomInput,
70
70
  {
71
+ style: { marginTop: "4px" },
71
72
  type: column.type,
72
73
  placeholder: column.placeholder,
73
74
  disabled,
@@ -5,6 +5,7 @@ import { TitleStyle } from './style.js';
5
5
  import { increaseLastNumber } from './utils.js';
6
6
  import { Typo } from '../Typo/index.js';
7
7
  import React__default, { useState, useCallback } from 'react';
8
+ import OverflowTooltip from '../../coreX/OverflowTooltip/index.js';
8
9
 
9
10
  var __defProp = Object.defineProperty;
10
11
  var __defProps = Object.defineProperties;
@@ -44,7 +45,7 @@ const BatchInputListHeaderCell = (props) => {
44
45
  },
45
46
  [onChange, data, column]
46
47
  );
47
- const _onBlur = useCallback(() => {
48
+ const headerOnBlur = useCallback(() => {
48
49
  onBlur == null ? void 0 : onBlur(column.key, errMsg);
49
50
  }, [column.key, onBlur, errMsg]);
50
51
  const renderDefaultComponent = () => {
@@ -56,16 +57,42 @@ const BatchInputListHeaderCell = (props) => {
56
57
  __spreadProps(__spreadValues({}, props), {
57
58
  column,
58
59
  onChange: headerOnChange,
59
- onBlur: _onBlur
60
+ onBlur: headerOnBlur
60
61
  })
61
62
  );
62
63
  };
63
- const renderCell = () => column.render ? column.render({
64
- isHeader: true,
65
- disabled,
66
- onChange: headerOnChange,
67
- onBlur: _onBlur
68
- }) : renderDefaultComponent();
64
+ const renderTitle = () => {
65
+ const titleContent = typeof column.title === "string" ? /* @__PURE__ */ React__default.createElement(OverflowTooltip, { tooltip: column.title, content: column.title }) : column.title;
66
+ return /* @__PURE__ */ React__default.createElement("p", { className: cx(Typo.Label.l3_bold_title, TitleStyle) }, titleContent);
67
+ };
68
+ const renderSubTitle = () => {
69
+ if (column.subTitleRender) {
70
+ return column.subTitleRender({
71
+ isHeader: true,
72
+ disabled,
73
+ onChange: headerOnChange,
74
+ onBlur: headerOnBlur
75
+ });
76
+ }
77
+ if (disableBatchFilling) {
78
+ return null;
79
+ }
80
+ return /* @__PURE__ */ React__default.createElement(
81
+ FormItem,
82
+ {
83
+ validateStatus: typeof errMsg === "string" && errMsg ? "error" : "",
84
+ message: errMsg || void 0
85
+ },
86
+ // if the render prop is provided, use it to render the subTitle
87
+ // otherwise, render the default component
88
+ column.render ? column.render({
89
+ isHeader: true,
90
+ disabled,
91
+ onChange: headerOnChange,
92
+ onBlur: headerOnBlur
93
+ }) : renderDefaultComponent()
94
+ );
95
+ };
69
96
  return /* @__PURE__ */ React__default.createElement(
70
97
  "div",
71
98
  {
@@ -76,15 +103,8 @@ const BatchInputListHeaderCell = (props) => {
76
103
  visibility: column.hidden ? "hidden" : "visible"
77
104
  }
78
105
  },
79
- /* @__PURE__ */ React__default.createElement("p", { className: cx(Typo.Label.l3_bold_title, TitleStyle) }, column.title),
80
- disableBatchFilling ? null : /* @__PURE__ */ React__default.createElement(
81
- FormItem,
82
- {
83
- validateStatus: typeof errMsg === "string" && errMsg ? "error" : "",
84
- message: errMsg || void 0
85
- },
86
- renderCell()
87
- )
106
+ renderTitle(),
107
+ renderSubTitle()
88
108
  );
89
109
  };
90
110
 
@@ -2,9 +2,8 @@ import AddRowButton from './AddRowButton.js';
2
2
  import { TableFormWrapper, DraggableHandleWrapper } from './style.js';
3
3
  import TableFormBodyRows from './TableFormBodyRows.js';
4
4
  import { BatchInputListHeaderCell } from './TableFormHeaderCell.js';
5
- import { genEmptyRow } from './utils.js';
6
5
  import { List } from 'antd';
7
- import React__default, { useState, useCallback, useLayoutEffect, useImperativeHandle, useMemo } from 'react';
6
+ import React__default, { useState, useCallback, useImperativeHandle, useMemo } from 'react';
8
7
 
9
8
  var __defProp = Object.defineProperty;
10
9
  var __defProps = Object.defineProperties;
@@ -25,7 +24,6 @@ var __spreadValues = (a, b) => {
25
24
  return a;
26
25
  };
27
26
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28
- const DEFAULT_ROW_COUNT = 3;
29
27
  const TableForm = React__default.forwardRef(
30
28
  (props, ref) => {
31
29
  var _a, _b;
@@ -48,7 +46,8 @@ const TableForm = React__default.forwardRef(
48
46
  onBodyChange,
49
47
  onBodyBlur,
50
48
  row,
51
- errors
49
+ errors,
50
+ hideEmptyTable
52
51
  } = props;
53
52
  const [data, setData] = useState(defaultData || []);
54
53
  const [passwordVisible, setPasswordVisible] = useState(false);
@@ -64,13 +63,6 @@ const TableForm = React__default.forwardRef(
64
63
  },
65
64
  [onBodyChange]
66
65
  );
67
- useLayoutEffect(() => {
68
- if (!defaultData) {
69
- updateData(
70
- [...Array(DEFAULT_ROW_COUNT)].map(() => genEmptyRow(columns))
71
- );
72
- }
73
- }, [columns, defaultData, updateData]);
74
66
  const handleBatchChange = useCallback(
75
67
  (newData, columnKey, shouldUpdateData) => {
76
68
  setLatestData(newData);
@@ -134,9 +126,10 @@ const TableForm = React__default.forwardRef(
134
126
  } : void 0,
135
127
  [maxHeight]
136
128
  );
137
- return /* @__PURE__ */ React__default.createElement("div", { className }, /* @__PURE__ */ React__default.createElement(
129
+ return /* @__PURE__ */ React__default.createElement("div", { className }, hideEmptyTable && data.length < 1 ? null : /* @__PURE__ */ React__default.createElement(
138
130
  TableFormWrapper,
139
131
  {
132
+ "data-testid": "eagle-table-form-wrapper",
140
133
  className: `table-form row-split-by-${rowSplitType}`,
141
134
  style: tableFormWrapperStyle
142
135
  },