@cloudtower/eagle 0.32.52 → 0.32.54

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.
@@ -63,28 +63,37 @@ const SearchInput = props => {
63
63
  nextIcon,
64
64
  clearIcon,
65
65
  width,
66
- searchIcon
66
+ searchIcon,
67
+ current: externalCurrent
67
68
  } = _a,
68
- restProps = __objRest(_a, ["onChange", "debounceWait", "total", "onSearchNext", "onSearchPrev", "prefixHoverIcon", "nextHoverIcon", "clearHoverIcon", "prefixIcon", "nextIcon", "clearIcon", "width", "searchIcon"]);
69
- const [current, setCurrent] = React.useState(0);
69
+ restProps = __objRest(_a, ["onChange", "debounceWait", "total", "onSearchNext", "onSearchPrev", "prefixHoverIcon", "nextHoverIcon", "clearHoverIcon", "prefixIcon", "nextIcon", "clearIcon", "width", "searchIcon", "current"]);
70
+ const [internalCurrent, setInternalCurrent] = React.useState(0);
70
71
  const [value, setValue] = React.useState(props.value || "");
71
72
  const {
72
73
  t
73
74
  } = useParrotTranslation();
74
75
  const onSearch = ___default.default.debounce(onChange, debounceWait);
75
76
  const isNoMatch = total === 0;
77
+ const current = externalCurrent !== void 0 ? externalCurrent : internalCurrent;
78
+ const setCurrent = React.useCallback(newCurrent => {
79
+ if (externalCurrent === void 0) {
80
+ setInternalCurrent(newCurrent);
81
+ }
82
+ }, [externalCurrent]);
76
83
  const next = React.useCallback(() => {
77
84
  if (total) {
78
- onSearchNext == null ? void 0 : onSearchNext(value, current);
79
- setCurrent(current + 1 > total ? 1 : current + 1);
85
+ const nextCurrent = current + 1 > total ? 1 : current + 1;
86
+ onSearchNext == null ? void 0 : onSearchNext(value, nextCurrent);
87
+ setCurrent(nextCurrent);
80
88
  }
81
- }, [onSearchNext, current, total, value]);
89
+ }, [onSearchNext, current, total, value, setCurrent]);
82
90
  const prev = React.useCallback(() => {
83
91
  if (total) {
84
- onSearchPrev == null ? void 0 : onSearchPrev(value, current);
85
- setCurrent(current - 1 < 1 ? total : current - 1);
92
+ const prevCurrent = current - 1 < 1 ? total : current - 1;
93
+ onSearchPrev == null ? void 0 : onSearchPrev(value, prevCurrent);
94
+ setCurrent(prevCurrent);
86
95
  }
87
- }, [onSearchPrev, current, total, value]);
96
+ }, [onSearchPrev, current, total, value, setCurrent]);
88
97
  const suffix = onSearchNext && onSearchPrev && value ? /* @__PURE__ */React__default.default.createElement(React__default.default.Fragment, null, typeof total === "number" ? /* @__PURE__ */React__default.default.createElement("span", {
89
98
  className: core.cx(index.Typo.Label.l4_regular, "counter-text", CountTextStyle)
90
99
  }, current, "/", total) : null, /* @__PURE__ */React__default.default.createElement("span", {
@@ -127,8 +136,10 @@ const SearchInput = props => {
127
136
  setValue(props.value || "");
128
137
  }, [props.value]);
129
138
  React.useEffect(() => {
130
- setCurrent(total ? 1 : 0);
131
- }, [value, total]);
139
+ if (externalCurrent === void 0) {
140
+ setCurrent(total ? 1 : 0);
141
+ }
142
+ }, [value, total, externalCurrent, setCurrent]);
132
143
  return /* @__PURE__ */React__default.default.createElement(index$3, __spreadProps(__spreadValues({
133
144
  style: {
134
145
  width: width != null ? width : 276
@@ -59,7 +59,8 @@ const Table = props => {
59
59
  wrapper,
60
60
  pagination,
61
61
  onRow,
62
- skeletonProps
62
+ skeletonProps,
63
+ expandable
63
64
  } = props;
64
65
  const orderRef = React.useRef(null);
65
66
  const hasScrollBard = common.useTableBodyHasScrollBar(wrapper, _dataSource);
@@ -127,7 +128,8 @@ const Table = props => {
127
128
  rowSelection: rowSelection && __spreadProps(__spreadValues({}, rowSelection), {
128
129
  columnWidth: 32
129
130
  }),
130
- showSorterTooltip: false
131
+ showSorterTooltip: false,
132
+ expandable
131
133
  }));
132
134
  };
133
135
  var Table$1 = Table;