@etsoo/materialui 1.6.23 → 1.6.25

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/FabBox.js CHANGED
@@ -9,7 +9,7 @@ const Box_1 = __importDefault(require("@mui/material/Box"));
9
9
  const Paper_1 = __importDefault(require("@mui/material/Paper"));
10
10
  const styles_1 = require("@mui/material/styles");
11
11
  const react_1 = __importDefault(require("react"));
12
- const initOpactiy = 0.15;
12
+ const initOpactiy = 0.25;
13
13
  /**
14
14
  * Fabs container box
15
15
  * @param props Props
@@ -89,8 +89,9 @@ function ResponsibleContainer(props) {
89
89
  if (lastRect != null &&
90
90
  state.mounted !== true &&
91
91
  Math.abs(rect.width - lastRect.width) <= 32 &&
92
- Math.abs(rect.height - lastRect.height) <= 32)
92
+ Math.abs(rect.height - lastRect.height) <= 32) {
93
93
  return true;
94
+ }
94
95
  // Hold the new rect
95
96
  state.rect = rect;
96
97
  return false;
@@ -133,20 +134,15 @@ function ResponsibleContainer(props) {
133
134
  return ((0, jsx_runtime_1.jsx)(Box_1.default, { className: "ListBox", sx: { height: heightLocal }, children: (0, jsx_runtime_1.jsx)(ScrollerListEx_1.ScrollerListEx, { autoLoad: !hasFields, cacheKey: cacheKey, cacheMinutes: cacheMinutes, height: heightLocal, loadData: localLoadData, mRef: mRefs, onClick: (event, data) => quickAction && react_2.ReactUtils.isSafeClick(event) && quickAction(data), rowHeight: getRowHeight(false), ...listProps }) }));
134
135
  })();
135
136
  const searchBar = react_1.default.useMemo(() => {
136
- if (!hasFields ||
137
- showDataGrid == null ||
138
- rect?.width == null ||
139
- rect.width < 20)
137
+ if (!hasFields || rect?.width == null || rect.width < 20)
140
138
  return;
141
139
  const f = typeof fields == "function" ? fields(searchData) : fields;
142
140
  return ((0, jsx_runtime_1.jsx)(SearchBar_1.SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, width: rect.width, top: searchBarTop }));
143
141
  }, [showDataGrid, hasFields, searchBarHeight, rect?.width]);
144
142
  // Pull container
145
- const pullContainer = showDataGrid == null
146
- ? undefined
147
- : showDataGrid
148
- ? ".DataGridEx-Body"
149
- : ".ScrollerListEx-Body";
143
+ const pullContainer = showDataGrid
144
+ ? ".DataGridEx-Body"
145
+ : ".ScrollerListEx-Body";
150
146
  // Layout
151
147
  return ((0, jsx_runtime_1.jsxs)(Box_1.default, { sx: containerBoxSx == null
152
148
  ? undefined
@@ -3,6 +3,10 @@ import React from "react";
3
3
  * Search bar props
4
4
  */
5
5
  export interface SearchBarProps {
6
+ /**
7
+ * Auto submit delay miliseconds, default is 100ms
8
+ */
9
+ autoSubmitDelay?: number;
6
10
  /**
7
11
  * Style class name
8
12
  */
@@ -80,7 +80,7 @@ function checkFormEvent(event) {
80
80
  */
81
81
  function SearchBar(props) {
82
82
  // Destruct
83
- const { className, fields, onSubmit, itemGap = 6, itemWidth = 160, top, width } = props;
83
+ const { autoSubmitDelay = 100, className, fields, onSubmit, itemGap = 6, itemWidth = 160, top, width } = props;
84
84
  // Labels
85
85
  const labels = Labels_1.Labels.CommonPage;
86
86
  // Menu index
@@ -93,8 +93,9 @@ function SearchBar(props) {
93
93
  const { dimensions } = (0, react_2.useDimensions)(1, (target, rect) => {
94
94
  // Same logic from resetButtonRefe);
95
95
  if (rect.width === state.lastMaxWidth ||
96
- (!state.hasMore && rect.width > state.lastMaxWidth))
96
+ (!state.hasMore && rect.width > state.lastMaxWidth)) {
97
97
  return false;
98
+ }
98
99
  // Len
99
100
  const len = target.children.length;
100
101
  for (let i = 0; i < len; i++) {
@@ -238,11 +239,13 @@ function SearchBar(props) {
238
239
  };
239
240
  react_1.default.useEffect(() => {
240
241
  // Delayed way
241
- delayed.call(100);
242
+ if (autoSubmitDelay > 0) {
243
+ delayed.call(autoSubmitDelay);
244
+ }
242
245
  return () => {
243
246
  delayed.clear();
244
247
  };
245
- }, [className]);
248
+ }, [autoSubmitDelay]);
246
249
  // Layout
247
250
  return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)("form", { id: "SearchBarForm", className: className, onChange: handleForm, ref: (form) => {
248
251
  if (form)
package/lib/mjs/FabBox.js CHANGED
@@ -3,7 +3,7 @@ import Box from "@mui/material/Box";
3
3
  import Paper from "@mui/material/Paper";
4
4
  import { useTheme } from "@mui/material/styles";
5
5
  import React from "react";
6
- const initOpactiy = 0.15;
6
+ const initOpactiy = 0.25;
7
7
  /**
8
8
  * Fabs container box
9
9
  * @param props Props
@@ -83,8 +83,9 @@ export function ResponsibleContainer(props) {
83
83
  if (lastRect != null &&
84
84
  state.mounted !== true &&
85
85
  Math.abs(rect.width - lastRect.width) <= 32 &&
86
- Math.abs(rect.height - lastRect.height) <= 32)
86
+ Math.abs(rect.height - lastRect.height) <= 32) {
87
87
  return true;
88
+ }
88
89
  // Hold the new rect
89
90
  state.rect = rect;
90
91
  return false;
@@ -127,20 +128,15 @@ export function ResponsibleContainer(props) {
127
128
  return (_jsx(Box, { className: "ListBox", sx: { height: heightLocal }, children: _jsx(ScrollerListEx, { autoLoad: !hasFields, cacheKey: cacheKey, cacheMinutes: cacheMinutes, height: heightLocal, loadData: localLoadData, mRef: mRefs, onClick: (event, data) => quickAction && ReactUtils.isSafeClick(event) && quickAction(data), rowHeight: getRowHeight(false), ...listProps }) }));
128
129
  })();
129
130
  const searchBar = React.useMemo(() => {
130
- if (!hasFields ||
131
- showDataGrid == null ||
132
- rect?.width == null ||
133
- rect.width < 20)
131
+ if (!hasFields || rect?.width == null || rect.width < 20)
134
132
  return;
135
133
  const f = typeof fields == "function" ? fields(searchData) : fields;
136
134
  return (_jsx(SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}`, width: rect.width, top: searchBarTop }));
137
135
  }, [showDataGrid, hasFields, searchBarHeight, rect?.width]);
138
136
  // Pull container
139
- const pullContainer = showDataGrid == null
140
- ? undefined
141
- : showDataGrid
142
- ? ".DataGridEx-Body"
143
- : ".ScrollerListEx-Body";
137
+ const pullContainer = showDataGrid
138
+ ? ".DataGridEx-Body"
139
+ : ".ScrollerListEx-Body";
144
140
  // Layout
145
141
  return (_jsxs(Box, { sx: containerBoxSx == null
146
142
  ? undefined
@@ -3,6 +3,10 @@ import React from "react";
3
3
  * Search bar props
4
4
  */
5
5
  export interface SearchBarProps {
6
+ /**
7
+ * Auto submit delay miliseconds, default is 100ms
8
+ */
9
+ autoSubmitDelay?: number;
6
10
  /**
7
11
  * Style class name
8
12
  */
@@ -74,7 +74,7 @@ function checkFormEvent(event) {
74
74
  */
75
75
  export function SearchBar(props) {
76
76
  // Destruct
77
- const { className, fields, onSubmit, itemGap = 6, itemWidth = 160, top, width } = props;
77
+ const { autoSubmitDelay = 100, className, fields, onSubmit, itemGap = 6, itemWidth = 160, top, width } = props;
78
78
  // Labels
79
79
  const labels = Labels.CommonPage;
80
80
  // Menu index
@@ -87,8 +87,9 @@ export function SearchBar(props) {
87
87
  const { dimensions } = useDimensions(1, (target, rect) => {
88
88
  // Same logic from resetButtonRefe);
89
89
  if (rect.width === state.lastMaxWidth ||
90
- (!state.hasMore && rect.width > state.lastMaxWidth))
90
+ (!state.hasMore && rect.width > state.lastMaxWidth)) {
91
91
  return false;
92
+ }
92
93
  // Len
93
94
  const len = target.children.length;
94
95
  for (let i = 0; i < len; i++) {
@@ -232,11 +233,13 @@ export function SearchBar(props) {
232
233
  };
233
234
  React.useEffect(() => {
234
235
  // Delayed way
235
- delayed.call(100);
236
+ if (autoSubmitDelay > 0) {
237
+ delayed.call(autoSubmitDelay);
238
+ }
236
239
  return () => {
237
240
  delayed.clear();
238
241
  };
239
- }, [className]);
242
+ }, [autoSubmitDelay]);
240
243
  // Layout
241
244
  return (_jsxs(React.Fragment, { children: [_jsx("form", { id: "SearchBarForm", className: className, onChange: handleForm, ref: (form) => {
242
245
  if (form)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.6.23",
3
+ "version": "1.6.25",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -41,7 +41,7 @@
41
41
  "@emotion/styled": "^11.14.1",
42
42
  "@etsoo/appscript": "^1.6.56",
43
43
  "@etsoo/notificationbase": "^1.1.66",
44
- "@etsoo/react": "^1.8.78",
44
+ "@etsoo/react": "^1.8.80",
45
45
  "@etsoo/shared": "^1.2.80",
46
46
  "@mui/icons-material": "^7.3.9",
47
47
  "@mui/material": "^7.3.9",
package/src/FabBox.tsx CHANGED
@@ -4,7 +4,7 @@ import { useTheme } from "@mui/material/styles";
4
4
  import React from "react";
5
5
 
6
6
  type SharedProps = keyof BoxProps & keyof PaperProps;
7
- const initOpactiy = 0.15;
7
+ const initOpactiy = 0.25;
8
8
 
9
9
  /**
10
10
  * Fabs container box props
@@ -275,8 +275,9 @@ export function ResponsibleContainer<T extends object, F>(
275
275
  state.mounted !== true &&
276
276
  Math.abs(rect.width - lastRect.width) <= 32 &&
277
277
  Math.abs(rect.height - lastRect.height) <= 32
278
- )
278
+ ) {
279
279
  return true;
280
+ }
280
281
 
281
282
  // Hold the new rect
282
283
  state.rect = rect;
@@ -373,13 +374,7 @@ export function ResponsibleContainer<T extends object, F>(
373
374
  })();
374
375
 
375
376
  const searchBar = React.useMemo(() => {
376
- if (
377
- !hasFields ||
378
- showDataGrid == null ||
379
- rect?.width == null ||
380
- rect.width < 20
381
- )
382
- return;
377
+ if (!hasFields || rect?.width == null || rect.width < 20) return;
383
378
 
384
379
  const f = typeof fields == "function" ? fields(searchData) : fields;
385
380
 
@@ -395,12 +390,9 @@ export function ResponsibleContainer<T extends object, F>(
395
390
  }, [showDataGrid, hasFields, searchBarHeight, rect?.width]);
396
391
 
397
392
  // Pull container
398
- const pullContainer =
399
- showDataGrid == null
400
- ? undefined
401
- : showDataGrid
402
- ? ".DataGridEx-Body"
403
- : ".ScrollerListEx-Body";
393
+ const pullContainer = showDataGrid
394
+ ? ".DataGridEx-Body"
395
+ : ".ScrollerListEx-Body";
404
396
 
405
397
  // Layout
406
398
  return (
package/src/SearchBar.tsx CHANGED
@@ -13,6 +13,11 @@ import Toolbar from "@mui/material/Toolbar";
13
13
  * Search bar props
14
14
  */
15
15
  export interface SearchBarProps {
16
+ /**
17
+ * Auto submit delay miliseconds, default is 100ms
18
+ */
19
+ autoSubmitDelay?: number;
20
+
16
21
  /**
17
22
  * Style class name
18
23
  */
@@ -123,6 +128,7 @@ function checkFormEvent(event: React.FormEvent<HTMLFormElement>) {
123
128
  export function SearchBar(props: SearchBarProps) {
124
129
  // Destruct
125
130
  const {
131
+ autoSubmitDelay = 100,
126
132
  className,
127
133
  fields,
128
134
  onSubmit,
@@ -157,8 +163,9 @@ export function SearchBar(props: SearchBarProps) {
157
163
  if (
158
164
  rect.width === state.lastMaxWidth ||
159
165
  (!state.hasMore && rect.width > state.lastMaxWidth)
160
- )
166
+ ) {
161
167
  return false;
168
+ }
162
169
 
163
170
  // Len
164
171
  const len = target.children.length;
@@ -331,12 +338,14 @@ export function SearchBar(props: SearchBarProps) {
331
338
 
332
339
  React.useEffect(() => {
333
340
  // Delayed way
334
- delayed.call(100);
341
+ if (autoSubmitDelay > 0) {
342
+ delayed.call(autoSubmitDelay);
343
+ }
335
344
 
336
345
  return () => {
337
346
  delayed.clear();
338
347
  };
339
- }, [className]);
348
+ }, [autoSubmitDelay]);
340
349
 
341
350
  // Layout
342
351
  return (