@etsoo/react 1.4.27 → 1.4.28
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.
|
@@ -153,8 +153,7 @@ export function ResponsibleContainer(props) {
|
|
|
153
153
|
? undefined
|
|
154
154
|
: containerBoxSx(showDataGrid) },
|
|
155
155
|
React.createElement(Stack, null,
|
|
156
|
-
React.createElement(Box, { ref: dimensions[0][0], sx: searchBoxSx }, searchBar),
|
|
157
|
-
list),
|
|
156
|
+
React.createElement(Box, { ref: dimensions[0][0], sx: searchBoxSx }, searchBar)),
|
|
158
157
|
pullToRefresh && pullContainer && (React.createElement(PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: () => { var _a; return (_a = state.ref) === null || _a === void 0 ? void 0 : _a.reset(); }, shouldPullToRefresh: () => {
|
|
159
158
|
const container = document.querySelector(pullContainer);
|
|
160
159
|
return !(container === null || container === void 0 ? void 0 : container.scrollTop);
|
package/lib/mu/SearchBar.js
CHANGED
|
@@ -52,6 +52,7 @@ const setChildState = (child, enabled) => {
|
|
|
52
52
|
* @returns Component
|
|
53
53
|
*/
|
|
54
54
|
export function SearchBar(props) {
|
|
55
|
+
var _a;
|
|
55
56
|
// Destruct
|
|
56
57
|
const { className, fields, innerHeight = 40, onSubmit } = props;
|
|
57
58
|
// Labels
|
|
@@ -65,10 +66,14 @@ export function SearchBar(props) {
|
|
|
65
66
|
const [open, updateOpen] = React.useState(false);
|
|
66
67
|
// State
|
|
67
68
|
const state = React.useRef({}).current;
|
|
69
|
+
const lastMaxWidth = (_a = state.lastMaxWidth) !== null && _a !== void 0 ? _a : 9999;
|
|
68
70
|
// Watch container
|
|
69
71
|
const { dimensions } = useDimensions(1, (target, rect) => {
|
|
70
72
|
// Same logic from resetButtonRef
|
|
71
|
-
if (rect.width ===
|
|
73
|
+
if (rect.width === lastMaxWidth ||
|
|
74
|
+
(index != null &&
|
|
75
|
+
index >= fields.length &&
|
|
76
|
+
rect.width > lastMaxWidth))
|
|
72
77
|
return false;
|
|
73
78
|
// Len
|
|
74
79
|
const len = target.children.length;
|
|
@@ -96,7 +101,8 @@ export function SearchBar(props) {
|
|
|
96
101
|
return;
|
|
97
102
|
// Container width
|
|
98
103
|
let maxWidth = containerRect.width;
|
|
99
|
-
if (maxWidth ===
|
|
104
|
+
if (maxWidth === lastMaxWidth ||
|
|
105
|
+
(index != null && index >= fields.length && maxWidth > lastMaxWidth)) {
|
|
100
106
|
return;
|
|
101
107
|
}
|
|
102
108
|
state.lastMaxWidth = maxWidth;
|
package/package.json
CHANGED
package/src/mu/SearchBar.tsx
CHANGED
|
@@ -106,11 +106,18 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
106
106
|
submitSeed?: number;
|
|
107
107
|
lastMaxWidth?: number;
|
|
108
108
|
}>({}).current;
|
|
109
|
+
const lastMaxWidth = state.lastMaxWidth ?? 9999;
|
|
109
110
|
|
|
110
111
|
// Watch container
|
|
111
112
|
const { dimensions } = useDimensions(1, (target, rect) => {
|
|
112
113
|
// Same logic from resetButtonRef
|
|
113
|
-
if (
|
|
114
|
+
if (
|
|
115
|
+
rect.width === lastMaxWidth ||
|
|
116
|
+
(index != null &&
|
|
117
|
+
index >= fields.length &&
|
|
118
|
+
rect.width > lastMaxWidth)
|
|
119
|
+
)
|
|
120
|
+
return false;
|
|
114
121
|
|
|
115
122
|
// Len
|
|
116
123
|
const len = target.children.length;
|
|
@@ -143,7 +150,10 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
143
150
|
|
|
144
151
|
// Container width
|
|
145
152
|
let maxWidth = containerRect.width;
|
|
146
|
-
if (
|
|
153
|
+
if (
|
|
154
|
+
maxWidth === lastMaxWidth ||
|
|
155
|
+
(index != null && index >= fields.length && maxWidth > lastMaxWidth)
|
|
156
|
+
) {
|
|
147
157
|
return;
|
|
148
158
|
}
|
|
149
159
|
state.lastMaxWidth = maxWidth;
|