@etsoo/materialui 1.6.42 → 1.6.43
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.
- package/lib/cjs/DataGridEx.js +1 -1
- package/lib/cjs/ResponsibleContainer.js +5 -4
- package/lib/cjs/SearchBar.d.ts +1 -1
- package/lib/cjs/SearchBar.js +4 -4
- package/lib/mjs/DataGridEx.js +1 -1
- package/lib/mjs/ResponsibleContainer.js +5 -4
- package/lib/mjs/SearchBar.d.ts +1 -1
- package/lib/mjs/SearchBar.js +4 -4
- package/package.json +1 -1
- package/src/DataGridEx.tsx +1 -1
- package/src/ResponsibleContainer.tsx +5 -3
- package/src/SearchBar.tsx +12 -5
package/lib/cjs/DataGridEx.js
CHANGED
|
@@ -135,7 +135,7 @@ function DataGridEx(props) {
|
|
|
135
135
|
alignItems: "center",
|
|
136
136
|
borderTop: thinBorder,
|
|
137
137
|
marginTop: "1px",
|
|
138
|
-
|
|
138
|
+
minWidth: widthCalculator.total,
|
|
139
139
|
height: bottomHeight - 1
|
|
140
140
|
}, children: columns.map((column, index) => {
|
|
141
141
|
// Destruct
|
|
@@ -73,8 +73,9 @@ function ResponsibleContainer(props) {
|
|
|
73
73
|
// Search data
|
|
74
74
|
const searchData = (0, react_2.useSearchParamsWithCache)(cacheKey);
|
|
75
75
|
// On submit callback
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
// Current UI may be rendered but the search bar rerendered with new data, check init to avoid reset and load new data
|
|
77
|
+
const onSubmit = (data, _reset, init) => {
|
|
78
|
+
if (data == null || state.ref == null || (state.mounted && init))
|
|
78
79
|
return;
|
|
79
80
|
state.ref.reset({ data });
|
|
80
81
|
};
|
|
@@ -137,8 +138,8 @@ function ResponsibleContainer(props) {
|
|
|
137
138
|
if (!hasFields || rect?.width == null || rect.width < 20)
|
|
138
139
|
return;
|
|
139
140
|
const f = typeof fields == "function" ? fields(searchData) : fields;
|
|
140
|
-
return ((0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, width: rect.width, top: searchBarTop }));
|
|
141
|
-
}, [showDataGrid, hasFields, searchBarHeight, rect?.width]);
|
|
141
|
+
return ((0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, width: rect.width, top: searchBarTop, autoSubmitDelay: rest.autoLoad === false ? 0 : undefined }));
|
|
142
|
+
}, [showDataGrid, hasFields, searchBarHeight, rect?.width, rest.autoLoad]);
|
|
142
143
|
// Pull container
|
|
143
144
|
const pullContainer = showDataGrid
|
|
144
145
|
? ".DataGridEx-Body"
|
package/lib/cjs/SearchBar.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface SearchBarProps {
|
|
|
26
26
|
/**
|
|
27
27
|
* On submit callback
|
|
28
28
|
*/
|
|
29
|
-
onSubmit: (data: FormData, reset: boolean) => void | PromiseLike<void>;
|
|
29
|
+
onSubmit: (data: FormData, reset: boolean, init: boolean) => void | PromiseLike<void>;
|
|
30
30
|
/**
|
|
31
31
|
* Top position, true means Toolbar's height
|
|
32
32
|
*/
|
package/lib/cjs/SearchBar.js
CHANGED
|
@@ -216,13 +216,13 @@ function SearchBar(props) {
|
|
|
216
216
|
delayed.call();
|
|
217
217
|
};
|
|
218
218
|
// Submit at once
|
|
219
|
-
const handleSubmitInstant = (reset = false) => {
|
|
219
|
+
const handleSubmitInstant = (reset = false, init = false) => {
|
|
220
220
|
// Prepare data
|
|
221
221
|
const data = new FormData(state.form);
|
|
222
222
|
if (state.moreForm != null) {
|
|
223
223
|
shared_1.DomUtils.mergeFormData(data, new FormData(state.moreForm));
|
|
224
224
|
}
|
|
225
|
-
onSubmit(data, reset);
|
|
225
|
+
onSubmit(data, reset, init);
|
|
226
226
|
};
|
|
227
227
|
const delayed = (0, react_2.useDelayedExecutor)(handleSubmitInstant, 480);
|
|
228
228
|
// Reset
|
|
@@ -237,8 +237,8 @@ function SearchBar(props) {
|
|
|
237
237
|
};
|
|
238
238
|
react_1.default.useEffect(() => {
|
|
239
239
|
// Delayed way
|
|
240
|
-
if (autoSubmitDelay >
|
|
241
|
-
delayed.call(autoSubmitDelay);
|
|
240
|
+
if (autoSubmitDelay > 10) {
|
|
241
|
+
delayed.call(autoSubmitDelay, false, true);
|
|
242
242
|
}
|
|
243
243
|
return () => {
|
|
244
244
|
delayed.clear();
|
package/lib/mjs/DataGridEx.js
CHANGED
|
@@ -128,7 +128,7 @@ export function DataGridEx(props) {
|
|
|
128
128
|
alignItems: "center",
|
|
129
129
|
borderTop: thinBorder,
|
|
130
130
|
marginTop: "1px",
|
|
131
|
-
|
|
131
|
+
minWidth: widthCalculator.total,
|
|
132
132
|
height: bottomHeight - 1
|
|
133
133
|
}, children: columns.map((column, index) => {
|
|
134
134
|
// Destruct
|
|
@@ -67,8 +67,9 @@ export function ResponsibleContainer(props) {
|
|
|
67
67
|
// Search data
|
|
68
68
|
const searchData = useSearchParamsWithCache(cacheKey);
|
|
69
69
|
// On submit callback
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
// Current UI may be rendered but the search bar rerendered with new data, check init to avoid reset and load new data
|
|
71
|
+
const onSubmit = (data, _reset, init) => {
|
|
72
|
+
if (data == null || state.ref == null || (state.mounted && init))
|
|
72
73
|
return;
|
|
73
74
|
state.ref.reset({ data });
|
|
74
75
|
};
|
|
@@ -131,8 +132,8 @@ export function ResponsibleContainer(props) {
|
|
|
131
132
|
if (!hasFields || rect?.width == null || rect.width < 20)
|
|
132
133
|
return;
|
|
133
134
|
const f = typeof fields == "function" ? fields(searchData) : fields;
|
|
134
|
-
return (_jsx(SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, width: rect.width, top: searchBarTop }));
|
|
135
|
-
}, [showDataGrid, hasFields, searchBarHeight, rect?.width]);
|
|
135
|
+
return (_jsx(SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, width: rect.width, top: searchBarTop, autoSubmitDelay: rest.autoLoad === false ? 0 : undefined }));
|
|
136
|
+
}, [showDataGrid, hasFields, searchBarHeight, rect?.width, rest.autoLoad]);
|
|
136
137
|
// Pull container
|
|
137
138
|
const pullContainer = showDataGrid
|
|
138
139
|
? ".DataGridEx-Body"
|
package/lib/mjs/SearchBar.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface SearchBarProps {
|
|
|
26
26
|
/**
|
|
27
27
|
* On submit callback
|
|
28
28
|
*/
|
|
29
|
-
onSubmit: (data: FormData, reset: boolean) => void | PromiseLike<void>;
|
|
29
|
+
onSubmit: (data: FormData, reset: boolean, init: boolean) => void | PromiseLike<void>;
|
|
30
30
|
/**
|
|
31
31
|
* Top position, true means Toolbar's height
|
|
32
32
|
*/
|
package/lib/mjs/SearchBar.js
CHANGED
|
@@ -210,13 +210,13 @@ export function SearchBar(props) {
|
|
|
210
210
|
delayed.call();
|
|
211
211
|
};
|
|
212
212
|
// Submit at once
|
|
213
|
-
const handleSubmitInstant = (reset = false) => {
|
|
213
|
+
const handleSubmitInstant = (reset = false, init = false) => {
|
|
214
214
|
// Prepare data
|
|
215
215
|
const data = new FormData(state.form);
|
|
216
216
|
if (state.moreForm != null) {
|
|
217
217
|
DomUtils.mergeFormData(data, new FormData(state.moreForm));
|
|
218
218
|
}
|
|
219
|
-
onSubmit(data, reset);
|
|
219
|
+
onSubmit(data, reset, init);
|
|
220
220
|
};
|
|
221
221
|
const delayed = useDelayedExecutor(handleSubmitInstant, 480);
|
|
222
222
|
// Reset
|
|
@@ -231,8 +231,8 @@ export function SearchBar(props) {
|
|
|
231
231
|
};
|
|
232
232
|
React.useEffect(() => {
|
|
233
233
|
// Delayed way
|
|
234
|
-
if (autoSubmitDelay >
|
|
235
|
-
delayed.call(autoSubmitDelay);
|
|
234
|
+
if (autoSubmitDelay > 10) {
|
|
235
|
+
delayed.call(autoSubmitDelay, false, true);
|
|
236
236
|
}
|
|
237
237
|
return () => {
|
|
238
238
|
delayed.clear();
|
package/package.json
CHANGED
package/src/DataGridEx.tsx
CHANGED
|
@@ -339,7 +339,7 @@ export function DataGridEx<T extends object>(props: DataGridExProps<T>) {
|
|
|
339
339
|
alignItems: "center",
|
|
340
340
|
borderTop: thinBorder,
|
|
341
341
|
marginTop: "1px",
|
|
342
|
-
|
|
342
|
+
minWidth: widthCalculator.total,
|
|
343
343
|
height: bottomHeight - 1
|
|
344
344
|
}}
|
|
345
345
|
>
|
|
@@ -252,8 +252,9 @@ export function ResponsibleContainer<T extends object, F>(
|
|
|
252
252
|
const searchData = useSearchParamsWithCache(cacheKey);
|
|
253
253
|
|
|
254
254
|
// On submit callback
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
// Current UI may be rendered but the search bar rerendered with new data, check init to avoid reset and load new data
|
|
256
|
+
const onSubmit = (data: FormData, _reset: boolean, init: boolean) => {
|
|
257
|
+
if (data == null || state.ref == null || (state.mounted && init)) return;
|
|
257
258
|
state.ref.reset({ data });
|
|
258
259
|
};
|
|
259
260
|
|
|
@@ -385,9 +386,10 @@ export function ResponsibleContainer<T extends object, F>(
|
|
|
385
386
|
className={`searchBar${showDataGrid ? "Grid" : "List"}`}
|
|
386
387
|
width={rect.width}
|
|
387
388
|
top={searchBarTop}
|
|
389
|
+
autoSubmitDelay={rest.autoLoad === false ? 0 : undefined}
|
|
388
390
|
/>
|
|
389
391
|
);
|
|
390
|
-
}, [showDataGrid, hasFields, searchBarHeight, rect?.width]);
|
|
392
|
+
}, [showDataGrid, hasFields, searchBarHeight, rect?.width, rest.autoLoad]);
|
|
391
393
|
|
|
392
394
|
// Pull container
|
|
393
395
|
const pullContainer = showDataGrid
|
package/src/SearchBar.tsx
CHANGED
|
@@ -41,7 +41,11 @@ export interface SearchBarProps {
|
|
|
41
41
|
/**
|
|
42
42
|
* On submit callback
|
|
43
43
|
*/
|
|
44
|
-
onSubmit: (
|
|
44
|
+
onSubmit: (
|
|
45
|
+
data: FormData,
|
|
46
|
+
reset: boolean,
|
|
47
|
+
init: boolean
|
|
48
|
+
) => void | PromiseLike<void>;
|
|
45
49
|
|
|
46
50
|
/**
|
|
47
51
|
* Top position, true means Toolbar's height
|
|
@@ -314,7 +318,10 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
314
318
|
};
|
|
315
319
|
|
|
316
320
|
// Submit at once
|
|
317
|
-
const handleSubmitInstant = (
|
|
321
|
+
const handleSubmitInstant = (
|
|
322
|
+
reset: boolean = false,
|
|
323
|
+
init: boolean = false
|
|
324
|
+
) => {
|
|
318
325
|
// Prepare data
|
|
319
326
|
const data = new FormData(state.form);
|
|
320
327
|
|
|
@@ -322,7 +329,7 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
322
329
|
DomUtils.mergeFormData(data, new FormData(state.moreForm));
|
|
323
330
|
}
|
|
324
331
|
|
|
325
|
-
onSubmit(data, reset);
|
|
332
|
+
onSubmit(data, reset, init);
|
|
326
333
|
};
|
|
327
334
|
|
|
328
335
|
const delayed = useDelayedExecutor(handleSubmitInstant, 480);
|
|
@@ -339,8 +346,8 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
339
346
|
|
|
340
347
|
React.useEffect(() => {
|
|
341
348
|
// Delayed way
|
|
342
|
-
if (autoSubmitDelay >
|
|
343
|
-
delayed.call(autoSubmitDelay);
|
|
349
|
+
if (autoSubmitDelay > 10) {
|
|
350
|
+
delayed.call(autoSubmitDelay, false, true);
|
|
344
351
|
}
|
|
345
352
|
|
|
346
353
|
return () => {
|