@etsoo/materialui 1.6.40 → 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.
Files changed (112) hide show
  1. package/__tests__/SwitchAnt.tsx +6 -7
  2. package/lib/cjs/ButtonPopupCheckbox.js +8 -3
  3. package/lib/cjs/ButtonPopupRadio.js +6 -2
  4. package/lib/cjs/ComboBox.js +7 -5
  5. package/lib/cjs/ComboBoxMultiple.js +5 -3
  6. package/lib/cjs/DataGridEx.js +25 -6
  7. package/lib/cjs/DataSteps.js +21 -11
  8. package/lib/cjs/FileUploadButton.js +5 -1
  9. package/lib/cjs/FlexBox.d.ts +2 -2
  10. package/lib/cjs/FlexBox.js +3 -2
  11. package/lib/cjs/InputField.js +3 -4
  12. package/lib/cjs/MoreFab.js +1 -1
  13. package/lib/cjs/NotifierMU.js +12 -5
  14. package/lib/cjs/OptionGroup.js +1 -1
  15. package/lib/cjs/OptionGroupFlag.js +1 -1
  16. package/lib/cjs/QuickList.js +3 -3
  17. package/lib/cjs/ResponsibleContainer.js +9 -5
  18. package/lib/cjs/SearchBar.d.ts +1 -1
  19. package/lib/cjs/SearchBar.js +13 -6
  20. package/lib/cjs/SearchField.js +8 -9
  21. package/lib/cjs/SwitchAnt.js +2 -2
  22. package/lib/cjs/SwitchField.js +1 -1
  23. package/lib/cjs/TextFieldEx.js +6 -11
  24. package/lib/cjs/Tiplist.js +2 -2
  25. package/lib/cjs/TiplistPro.js +1 -1
  26. package/lib/cjs/TwoFieldInput.d.ts +1 -1
  27. package/lib/cjs/TwoFieldInput.js +12 -7
  28. package/lib/cjs/UserAvatarEditor.js +2 -2
  29. package/lib/cjs/ViewContainer.js +2 -2
  30. package/lib/cjs/custom/CustomAttributeArea.js +2 -2
  31. package/lib/cjs/custom/CustomFieldViewer.js +3 -2
  32. package/lib/cjs/custom/CustomFieldWindow.js +2 -1
  33. package/lib/cjs/custom/FieldJson.js +1 -1
  34. package/lib/cjs/custom/FieldTexarea.js +1 -1
  35. package/lib/cjs/index.d.ts +1 -0
  36. package/lib/cjs/index.js +7 -0
  37. package/lib/cjs/pages/EditPage.js +3 -1
  38. package/lib/cjs/pages/ViewPage.js +8 -2
  39. package/lib/mjs/ButtonPopupCheckbox.js +8 -3
  40. package/lib/mjs/ButtonPopupRadio.js +6 -2
  41. package/lib/mjs/ComboBox.js +7 -5
  42. package/lib/mjs/ComboBoxMultiple.js +5 -3
  43. package/lib/mjs/DataGridEx.js +25 -6
  44. package/lib/mjs/DataSteps.js +21 -11
  45. package/lib/mjs/FileUploadButton.js +5 -1
  46. package/lib/mjs/FlexBox.d.ts +2 -2
  47. package/lib/mjs/FlexBox.js +3 -2
  48. package/lib/mjs/InputField.js +3 -4
  49. package/lib/mjs/MoreFab.js +1 -1
  50. package/lib/mjs/NotifierMU.js +12 -5
  51. package/lib/mjs/OptionGroup.js +1 -1
  52. package/lib/mjs/OptionGroupFlag.js +1 -1
  53. package/lib/mjs/QuickList.js +3 -3
  54. package/lib/mjs/ResponsibleContainer.js +9 -5
  55. package/lib/mjs/SearchBar.d.ts +1 -1
  56. package/lib/mjs/SearchBar.js +13 -6
  57. package/lib/mjs/SearchField.js +8 -9
  58. package/lib/mjs/SwitchAnt.js +2 -2
  59. package/lib/mjs/SwitchField.js +1 -1
  60. package/lib/mjs/TextFieldEx.js +6 -11
  61. package/lib/mjs/Tiplist.js +2 -2
  62. package/lib/mjs/TiplistPro.js +1 -1
  63. package/lib/mjs/TwoFieldInput.d.ts +1 -1
  64. package/lib/mjs/TwoFieldInput.js +12 -7
  65. package/lib/mjs/UserAvatarEditor.js +2 -2
  66. package/lib/mjs/ViewContainer.js +2 -2
  67. package/lib/mjs/custom/CustomAttributeArea.js +2 -2
  68. package/lib/mjs/custom/CustomFieldViewer.js +3 -2
  69. package/lib/mjs/custom/CustomFieldWindow.js +2 -1
  70. package/lib/mjs/custom/FieldJson.js +1 -1
  71. package/lib/mjs/custom/FieldTexarea.js +1 -1
  72. package/lib/mjs/index.d.ts +1 -0
  73. package/lib/mjs/index.js +2 -0
  74. package/lib/mjs/pages/EditPage.js +3 -1
  75. package/lib/mjs/pages/ViewPage.js +8 -2
  76. package/package.json +8 -8
  77. package/src/ButtonPopupCheckbox.tsx +10 -8
  78. package/src/ButtonPopupRadio.tsx +8 -6
  79. package/src/ComboBox.tsx +7 -5
  80. package/src/ComboBoxMultiple.tsx +5 -3
  81. package/src/ComboBoxPro.tsx +1 -1
  82. package/src/CultureDataTable.tsx +1 -1
  83. package/src/DataGridEx.tsx +27 -20
  84. package/src/DataSteps.tsx +27 -22
  85. package/src/FileUploadButton.tsx +6 -5
  86. package/src/FlexBox.tsx +7 -7
  87. package/src/InputField.tsx +2 -5
  88. package/src/MoreFab.tsx +8 -8
  89. package/src/NotifierMU.tsx +12 -12
  90. package/src/NumberInputField.tsx +1 -0
  91. package/src/OptionGroup.tsx +3 -5
  92. package/src/OptionGroupFlag.tsx +3 -5
  93. package/src/QuickList.tsx +4 -4
  94. package/src/ResponsibleContainer.tsx +8 -6
  95. package/src/SearchBar.tsx +19 -12
  96. package/src/SearchField.tsx +8 -14
  97. package/src/SwitchAnt.tsx +2 -2
  98. package/src/SwitchField.tsx +1 -3
  99. package/src/TextFieldEx.tsx +32 -36
  100. package/src/Tiplist.tsx +2 -2
  101. package/src/TiplistPro.tsx +2 -2
  102. package/src/TwoFieldInput.tsx +33 -31
  103. package/src/UserAvatarEditor.tsx +2 -3
  104. package/src/ViewContainer.tsx +6 -2
  105. package/src/custom/CustomAttributeArea.tsx +3 -3
  106. package/src/custom/CustomFieldViewer.tsx +8 -3
  107. package/src/custom/CustomFieldWindow.tsx +4 -4
  108. package/src/custom/FieldJson.tsx +3 -3
  109. package/src/custom/FieldTexarea.tsx +1 -1
  110. package/src/index.ts +3 -0
  111. package/src/pages/EditPage.tsx +4 -5
  112. package/src/pages/ViewPage.tsx +11 -8
@@ -1,21 +1,20 @@
1
- import { screen, render } from "@testing-library/react";
2
- import React, { act } from "react";
1
+ import { fireEvent, render, screen } from "@testing-library/react";
2
+ import { act } from "react";
3
3
  import { SwitchAnt } from "../src/SwitchAnt";
4
+ import { NumberFieldInput } from "@base-ui/react/number-field";
4
5
 
5
6
  it("SwitchAnt Tests", () => {
6
- const onChange = vi.fn((event: React.ChangeEvent<HTMLInputElement>) =>
7
- expect(event.target.checked).toBeTruthy()
8
- );
7
+ const onChange = vi.fn();
9
8
 
10
9
  // Render component
11
10
  act(() => {
12
11
  render(<SwitchAnt startLabel="No" endLabel="Yes" onChange={onChange} />);
13
12
  });
14
13
 
15
- const yes = screen.getByText("Yes");
14
+ const control = screen.getByRole("switch");
16
15
 
17
16
  act(() => {
18
- yes.click();
17
+ fireEvent.click(control);
19
18
  });
20
19
 
21
20
  expect(onChange).toHaveBeenCalled();
@@ -40,19 +40,24 @@ function ButtonPopupList(props) {
40
40
  // Set selected ids
41
41
  setSelectedIdsHandler([...value]);
42
42
  }, [value]);
43
- return ((0, jsx_runtime_1.jsxs)(FlexBox_1.VBox, { gap: 2, children: [(0, jsx_runtime_1.jsx)(DnDSortableList_1.DnDSortableList, { component: Grid_1.default, componentProps: { container: true, spacing: 0 }, items: items, labelField: labelField, onChange: (items) => {
43
+ return ((0, jsx_runtime_1.jsxs)(FlexBox_1.VBox, { spacing: 2, children: [(0, jsx_runtime_1.jsx)(DnDSortableList_1.DnDSortableList, { component: Grid_1.default, componentProps: { container: true, spacing: 0 }, items: items, labelField: labelField, onChange: (items) => {
44
44
  const ids = items
45
45
  .filter((item) => tempSelectedIds.current.includes(item.id))
46
46
  .map((item) => item.id);
47
47
  onValueChange(ids);
48
- }, itemRenderer: (item, style, { sortable: { index }, ref, handleRef }) => ((0, jsx_runtime_1.jsxs)(Grid_1.default, { size: itemSize, display: "flex", justifyContent: "flex-start", alignItems: "center", gap: 1, ref: ref, style: style, children: [(0, jsx_runtime_1.jsx)(IconButton_1.default, { style: { cursor: "move" }, size: "small", title: labels?.dragIndicator, ref: handleRef, children: (0, jsx_runtime_1.jsx)(DragIndicator_1.default, {}) }), (0, jsx_runtime_1.jsx)(FormControlLabel_1.default, { control: (0, jsx_runtime_1.jsx)(Checkbox_1.default, { name: "item", value: item.id, checked: selectedIds.includes(item.id), onChange: (e) => {
48
+ }, itemRenderer: (item, style, { sortable: { index }, ref, handleRef }) => ((0, jsx_runtime_1.jsxs)(Grid_1.default, { size: itemSize, spacing: 1, ref: ref, style: {
49
+ display: "flex",
50
+ alignItems: "center",
51
+ justifyContent: "flex-start",
52
+ ...style
53
+ }, children: [(0, jsx_runtime_1.jsx)(IconButton_1.default, { style: { cursor: "move" }, size: "small", title: labels?.dragIndicator, ref: handleRef, children: (0, jsx_runtime_1.jsx)(DragIndicator_1.default, {}) }), (0, jsx_runtime_1.jsx)(FormControlLabel_1.default, { control: (0, jsx_runtime_1.jsx)(Checkbox_1.default, { name: "item", value: item.id, checked: selectedIds.includes(item.id), onChange: (e) => {
49
54
  const checked = e.target.checked;
50
55
  const newIds = [
51
56
  ...selectedIds.toggleItem(item.id, checked)
52
57
  ];
53
58
  setSelectedIdsHandler(newIds);
54
59
  onValueChange(newIds);
55
- } }), label: `${index + 1}. ${labelFormatter(item)}` })] })), mRef: dndRef }), onAdd && ((0, jsx_runtime_1.jsxs)(FlexBox_1.HBox, { gap: 1, children: [(0, jsx_runtime_1.jsx)(TextField_1.default, { variant: "outlined", label: labels?.more, fullWidth: true, inputRef: inputRef }), (0, jsx_runtime_1.jsx)(Button_1.default, { sx: { width: "120px" }, variant: "contained", startIcon: (0, jsx_runtime_1.jsx)(Add_1.default, {}), size: "small", onClick: async () => {
60
+ } }), label: `${index + 1}. ${labelFormatter(item)}` })] })), mRef: dndRef }), onAdd && ((0, jsx_runtime_1.jsxs)(FlexBox_1.HBox, { spacing: 1, children: [(0, jsx_runtime_1.jsx)(TextField_1.default, { variant: "outlined", label: labels?.more, fullWidth: true, inputRef: inputRef }), (0, jsx_runtime_1.jsx)(Button_1.default, { sx: { width: "120px" }, variant: "contained", startIcon: (0, jsx_runtime_1.jsx)(Add_1.default, {}), size: "small", onClick: async () => {
56
61
  if (inputRef.current == null)
57
62
  return;
58
63
  const input = inputRef.current.value.trim();
@@ -29,7 +29,7 @@ function ButtonPopupList(props) {
29
29
  react_1.default.useEffect(() => {
30
30
  setCurrentValue(value);
31
31
  }, [value]);
32
- return ((0, jsx_runtime_1.jsxs)(FlexBox_1.VBox, { gap: 2, children: [(0, jsx_runtime_1.jsx)(RadioGroup_1.default, { value: currentValue ?? "", name: "radio-buttons-group", onChange: (e, v) => {
32
+ return ((0, jsx_runtime_1.jsxs)(FlexBox_1.VBox, { spacing: 2, children: [(0, jsx_runtime_1.jsx)(RadioGroup_1.default, { value: currentValue ?? "", name: "radio-buttons-group", onChange: (e, v) => {
33
33
  const checked = e.target.checked;
34
34
  const value = checked
35
35
  ? typeof items[0].id === "number"
@@ -38,7 +38,11 @@ function ButtonPopupList(props) {
38
38
  : undefined;
39
39
  setCurrentValue(value);
40
40
  onValueChange(value);
41
- }, children: (0, jsx_runtime_1.jsx)(Grid_1.default, { container: true, spacing: 0, children: items.map((item) => ((0, jsx_runtime_1.jsx)(Grid_1.default, { size: itemSize, display: "flex", justifyContent: "flex-start", alignItems: "center", gap: 1, children: (0, jsx_runtime_1.jsx)(FormControlLabel_1.default, { control: (0, jsx_runtime_1.jsx)(Radio_1.default, { value: item.id }), label: `${labelFormatter(item)}` }) }, item.id))) }) }), onAdd && ((0, jsx_runtime_1.jsxs)(FlexBox_1.HBox, { gap: 1, children: [(0, jsx_runtime_1.jsx)(TextField_1.default, { variant: "outlined", label: labels?.more, fullWidth: true, inputRef: inputRef }), (0, jsx_runtime_1.jsx)(Button_1.default, { sx: { width: "120px" }, variant: "contained", startIcon: (0, jsx_runtime_1.jsx)(Add_1.default, {}), size: "small", onClick: async () => {
41
+ }, children: (0, jsx_runtime_1.jsx)(Grid_1.default, { container: true, spacing: 0, children: items.map((item) => ((0, jsx_runtime_1.jsx)(Grid_1.default, { size: itemSize, sx: {
42
+ display: "flex",
43
+ alignItems: "center",
44
+ justifyContent: "flex-start"
45
+ }, spacing: 1, children: (0, jsx_runtime_1.jsx)(FormControlLabel_1.default, { control: (0, jsx_runtime_1.jsx)(Radio_1.default, { value: item.id }), label: `${labelFormatter(item)}` }) }, item.id))) }) }), onAdd && ((0, jsx_runtime_1.jsxs)(FlexBox_1.HBox, { spacing: 1, children: [(0, jsx_runtime_1.jsx)(TextField_1.default, { variant: "outlined", label: labels?.more, fullWidth: true, inputRef: inputRef }), (0, jsx_runtime_1.jsx)(Button_1.default, { sx: { width: "120px" }, variant: "contained", startIcon: (0, jsx_runtime_1.jsx)(Add_1.default, {}), size: "small", onClick: async () => {
42
46
  if (inputRef.current == null)
43
47
  return;
44
48
  const input = inputRef.current.value.trim();
@@ -48,7 +48,7 @@ function ComboBox(props) {
48
48
  // Local default value
49
49
  const localValue = idValue != null
50
50
  ? localOptions.find((o) => o[idField] === idValue)
51
- : defaultValue ?? value;
51
+ : (defaultValue ?? value);
52
52
  // State
53
53
  // null for controlled
54
54
  const [stateValue, setStateValue] = react_1.default.useState(null);
@@ -65,9 +65,9 @@ function ComboBox(props) {
65
65
  if (readOnly != null) {
66
66
  Object.assign(params, { readOnly });
67
67
  }
68
- Object.assign(params.inputProps, { "data-reset": inputReset });
68
+ Object.assign(params.slotProps.htmlInput, { "data-reset": inputReset });
69
69
  if (dataReadonly) {
70
- params.inputProps.onKeyDown = (event) => {
70
+ params.slotProps.htmlInput.onKeyDown = (event) => {
71
71
  if (shared_1.Keyboard.isTypingContent(event.key)) {
72
72
  event.preventDefault();
73
73
  }
@@ -75,7 +75,9 @@ function ComboBox(props) {
75
75
  }
76
76
  // https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
77
77
  // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
78
- Object.assign(params.inputProps, { autoComplete: inputAutoComplete });
78
+ Object.assign(params.slotProps.htmlInput, {
79
+ autoComplete: inputAutoComplete
80
+ });
79
81
  return params;
80
82
  };
81
83
  const getValue = (value) => {
@@ -124,7 +126,7 @@ function ComboBox(props) {
124
126
  };
125
127
  }, []);
126
128
  // Layout
127
- return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange, disabled: disabled }), (0, jsx_runtime_1.jsxs)(Stack_1.default, { gap: 0.5, direction: "row", width: "100%", children: [(0, jsx_runtime_1.jsx)(Autocomplete_1.default, { value: stateValue, disabled: disabled, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
129
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange, disabled: disabled }), (0, jsx_runtime_1.jsxs)(Stack_1.default, { spacing: 0.5, direction: "row", children: [(0, jsx_runtime_1.jsx)(Autocomplete_1.default, { value: stateValue, disabled: disabled, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
128
130
  // Set value
129
131
  setInputValue(value);
130
132
  // Custom
@@ -63,9 +63,9 @@ function ComboBoxMultiple(props) {
63
63
  if (readOnly != null) {
64
64
  Object.assign(params, { readOnly });
65
65
  }
66
- Object.assign(params.inputProps, { "data-reset": inputReset });
66
+ Object.assign(params.slotProps.htmlInput, { "data-reset": inputReset });
67
67
  if (dataReadonly) {
68
- params.inputProps.onKeyDown = (event) => {
68
+ params.slotProps.htmlInput.onKeyDown = (event) => {
69
69
  if (shared_1.Keyboard.isTypingContent(event.key)) {
70
70
  event.preventDefault();
71
71
  }
@@ -73,7 +73,9 @@ function ComboBoxMultiple(props) {
73
73
  }
74
74
  // https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
75
75
  // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
76
- Object.assign(params.inputProps, { autoComplete: inputAutoComplete });
76
+ Object.assign(params.slotProps.htmlInput, {
77
+ autoComplete: inputAutoComplete
78
+ });
77
79
  return params;
78
80
  };
79
81
  const getValue = (value) => {
@@ -88,7 +88,14 @@ function DataGridEx(props) {
88
88
  const theme = (0, styles_1.useTheme)();
89
89
  const defaultHeaderRenderer = (states) => {
90
90
  const { orderBy } = states.queryPaging;
91
- return ((0, jsx_runtime_1.jsx)(Box_1.default, { className: "DataGridEx-Header", display: "flex", alignItems: "center", borderBottom: boldBorder, fontWeight: 500, minWidth: widthCalculator.total, height: headerHeight, children: columns.map((column, index) => {
91
+ return ((0, jsx_runtime_1.jsx)(Box_1.default, { className: "DataGridEx-Header", sx: {
92
+ display: "flex",
93
+ alignItems: "center",
94
+ borderBottom: boldBorder,
95
+ fontWeight: 500,
96
+ minWidth: widthCalculator.total,
97
+ height: headerHeight
98
+ }, children: columns.map((column, index) => {
92
99
  // Destruct
93
100
  const { align, field, header, headerCellRenderer, sortable, sortAsc = true, type } = column;
94
101
  // Header text
@@ -116,11 +123,21 @@ function DataGridEx(props) {
116
123
  else {
117
124
  sortLabel = headerText;
118
125
  }
119
- return ((0, jsx_runtime_1.jsx)(Box_1.default, { textAlign: (0, react_1.GridAlignGet)(align, type), width: columnWidth(index), children: (0, jsx_runtime_1.jsx)(Box_1.default, { className: "DataGridEx-Cell", onMouseEnter: handleMouseEnter, ...cellProps, children: sortLabel }) }, field ?? index.toString()));
126
+ return ((0, jsx_runtime_1.jsx)(Box_1.default, { sx: {
127
+ textAlign: (0, react_1.GridAlignGet)(align, type),
128
+ width: columnWidth(index)
129
+ }, children: (0, jsx_runtime_1.jsx)(Box_1.default, { className: "DataGridEx-Cell", onMouseEnter: handleMouseEnter, ...cellProps, children: sortLabel }) }, field ?? index.toString()));
120
130
  }) }));
121
131
  };
122
132
  function defaultFooterRenderer(rows, states) {
123
- return ((0, jsx_runtime_1.jsx)(Box_1.default, { className: "DataGridEx-Footer", display: "flex", alignItems: "center", borderTop: thinBorder, marginTop: "1px", minWidth: widthCalculator.total, height: bottomHeight - 1, children: columns.map((column, index) => {
133
+ return ((0, jsx_runtime_1.jsx)(Box_1.default, { className: "DataGridEx-Footer", sx: {
134
+ display: "flex",
135
+ alignItems: "center",
136
+ borderTop: thinBorder,
137
+ marginTop: "1px",
138
+ minWidth: widthCalculator.total,
139
+ height: bottomHeight - 1
140
+ }, children: columns.map((column, index) => {
124
141
  // Destruct
125
142
  const { align, field, type } = column;
126
143
  // Cell props
@@ -135,7 +152,10 @@ function DataGridEx(props) {
135
152
  checkable
136
153
  })
137
154
  : undefined;
138
- return ((0, jsx_runtime_1.jsx)(Box_1.default, { textAlign: (0, react_1.GridAlignGet)(align, type), width: columnWidth(index), children: (0, jsx_runtime_1.jsx)(Box_1.default, { className: "DataGridEx-Cell", onMouseEnter: handleMouseEnter, ...cellProps, children: cell }) }, "bottom-" + (field ?? index.toString())));
155
+ return ((0, jsx_runtime_1.jsx)(Box_1.default, { sx: {
156
+ textAlign: (0, react_1.GridAlignGet)(align, type),
157
+ width: columnWidth(index)
158
+ }, children: (0, jsx_runtime_1.jsx)(Box_1.default, { className: "DataGridEx-Cell", onMouseEnter: handleMouseEnter, ...cellProps, children: cell }) }, "bottom-" + (field ?? index.toString())));
139
159
  }) }));
140
160
  }
141
161
  // Destruct
@@ -294,8 +314,7 @@ function DataGridEx(props) {
294
314
  : cellBoxStyle;
295
315
  const cellProps = {
296
316
  className: "DataGridEx-Cell",
297
- textAlign: (0, react_1.GridAlignGet)(align, type),
298
- sx: { ...boxStyle }
317
+ sx: { textAlign: (0, react_1.GridAlignGet)(align, type), ...boxStyle }
299
318
  };
300
319
  const child = cellRenderer({
301
320
  data,
@@ -29,9 +29,8 @@ function DataSteps(props) {
29
29
  // Labels
30
30
  const labels = app.getLabels("close", "nextStep", "previousStep", "submit");
31
31
  // Destruct
32
- const { InputLabelProps = {}, jsonValue, valueFormatter = (_data) => "...", onValueChange, steps, value = "", ...rest } = props;
33
- // Shrink
34
- InputLabelProps.shrink ??= MUGlobal_1.MUGlobal.searchFieldShrink;
32
+ const { jsonValue, valueFormatter = (_data) => "...", onValueChange, steps, value = "", slotProps, ...rest } = props;
33
+ const { input, htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
35
34
  // Current index
36
35
  const indexRef = react_1.default.useRef(-1);
37
36
  // Current Json data
@@ -47,7 +46,12 @@ function DataSteps(props) {
47
46
  const [{ callback, ...rest }, more] = steps(index, jsonRef.current);
48
47
  app.showInputDialog({
49
48
  ...rest,
50
- buttons: (n, callback) => ((0, jsx_runtime_1.jsxs)(FlexBox_1.HBox, { paddingLeft: 2, paddingRight: 2, paddingBottom: 2, gap: 2, justifyContent: "space-between", children: [index === 0 ? ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: "outlined", startIcon: (0, jsx_runtime_1.jsx)(Close_1.default, {}), onClick: () => n.dismiss(), children: labels.close })) : ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: "outlined", startIcon: (0, jsx_runtime_1.jsx)(NavigateBefore_1.default, {}), onClick: () => {
49
+ buttons: (n, callback) => ((0, jsx_runtime_1.jsxs)(FlexBox_1.HBox, { spacing: 2, sx: {
50
+ justifyContent: "space-between",
51
+ paddingLeft: 2,
52
+ paddingRight: 2,
53
+ paddingBottom: 2
54
+ }, children: [index === 0 ? ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: "outlined", startIcon: (0, jsx_runtime_1.jsx)(Close_1.default, {}), onClick: () => n.dismiss(), children: labels.close })) : ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: "outlined", startIcon: (0, jsx_runtime_1.jsx)(NavigateBefore_1.default, {}), onClick: () => {
51
55
  n.dismiss();
52
56
  showStep(indexRef.current - 1);
53
57
  }, children: labels.previousStep })), more ? ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: "contained", startIcon: (0, jsx_runtime_1.jsx)(NavigateNext_1.default, {}), onClick: async (event) => {
@@ -81,13 +85,19 @@ function DataSteps(props) {
81
85
  react_1.default.useEffect(() => {
82
86
  setLocalValue(valueFormatter(jsonRef.current));
83
87
  }, [valueFormatter]);
84
- return ((0, jsx_runtime_1.jsx)(TextField_1.default, { autoComplete: "off", InputLabelProps: InputLabelProps, inputProps: { style: { cursor: "pointer" } }, InputProps: {
85
- onKeyDown: (event) => {
86
- if (event.key === "Tab")
87
- return;
88
- cancelInput(event);
88
+ return ((0, jsx_runtime_1.jsx)(TextField_1.default, { autoComplete: "off", slotProps: {
89
+ input: {
90
+ onKeyDown: (event) => {
91
+ if (event.key === "Tab")
92
+ return;
93
+ cancelInput(event);
94
+ },
95
+ onPaste: cancelInput,
96
+ endAdornment: ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, { position: "end", children: (0, jsx_runtime_1.jsx)(IconButton_1.default, { edge: "end", size: "small", children: (0, jsx_runtime_1.jsx)(Start_1.default, {}) }) })),
97
+ ...input
89
98
  },
90
- onPaste: cancelInput,
91
- endAdornment: ((0, jsx_runtime_1.jsx)(InputAdornment_1.default, { position: "end", children: (0, jsx_runtime_1.jsx)(IconButton_1.default, { edge: "end", size: "small", children: (0, jsx_runtime_1.jsx)(Start_1.default, {}) }) }))
99
+ htmlInput: { style: { cursor: "pointer" }, ...htmlInput },
100
+ inputLabel: { shrink: MUGlobal_1.MUGlobal.searchFieldShrink, ...inputLabel },
101
+ ...restSlotProps
92
102
  }, onClick: () => showStep(0), value: localValue, ...rest }));
93
103
  }
@@ -51,7 +51,11 @@ function FileUploadButton(props) {
51
51
  onUploadFiles(files);
52
52
  };
53
53
  // Layout
54
- return ((0, jsx_runtime_1.jsxs)(FlexBox_1.HBox, { alignItems: "center", flexWrap: "wrap", border: (theme) => dragOver ? "1px dashed " + theme.palette.warning.main : undefined, spacing: 0.5, ...(dropFilesLabel == null
54
+ return ((0, jsx_runtime_1.jsxs)(FlexBox_1.HBox, { sx: {
55
+ alignItems: "center",
56
+ flexWrap: "wrap",
57
+ border: (theme) => dragOver ? "1px dashed " + theme.palette.warning.main : undefined
58
+ }, spacing: 0.5, ...(dropFilesLabel == null
55
59
  ? undefined
56
60
  : {
57
61
  onDrop: handleDrop,
@@ -4,7 +4,7 @@ import { StackProps } from "@mui/material/Stack";
4
4
  * @param props Props
5
5
  * @returns Component
6
6
  */
7
- export declare function HBox(props: Omit<StackProps, "ref">): import("react/jsx-runtime").JSX.Element;
7
+ export declare function HBox(props: Omit<StackProps, "ref" | "direction">): import("react/jsx-runtime").JSX.Element;
8
8
  /**
9
9
  * Horizonal box with list items
10
10
  * @param props Props
@@ -16,4 +16,4 @@ export declare function HBoxList(props: Omit<StackProps, "direction">): import("
16
16
  * @param props Props
17
17
  * @returns Component
18
18
  */
19
- export declare function VBox(props: Omit<StackProps, "ref">): import("react/jsx-runtime").JSX.Element;
19
+ export declare function VBox(props: Omit<StackProps, "ref" | "direction">): import("react/jsx-runtime").JSX.Element;
@@ -14,7 +14,7 @@ const Stack_1 = __importDefault(require("@mui/material/Stack"));
14
14
  * @returns Component
15
15
  */
16
16
  function HBox(props) {
17
- return (0, jsx_runtime_1.jsx)(Stack_1.default, { direction: "row", width: "100%", ...props });
17
+ return (0, jsx_runtime_1.jsx)(Stack_1.default, { direction: "row", ...props });
18
18
  }
19
19
  /**
20
20
  * Horizonal box with list items
@@ -22,7 +22,8 @@ function HBox(props) {
22
22
  * @returns Component
23
23
  */
24
24
  function HBoxList(props) {
25
- return ((0, jsx_runtime_1.jsx)(Stack_1.default, { spacing: 1, gap: 1, direction: "row", flexWrap: "wrap", width: "100%", ...props }));
25
+ const { sx, ...rest } = props;
26
+ return ((0, jsx_runtime_1.jsx)(Stack_1.default, { spacing: 1, direction: "row", sx: { flexWrap: "wrap", ...sx }, ...rest }));
26
27
  }
27
28
  /**
28
29
  * Vertial box
@@ -16,7 +16,7 @@ const TextField_1 = __importDefault(require("@mui/material/TextField"));
16
16
  */
17
17
  function InputField(props) {
18
18
  // Destruct
19
- const { InputProps = {}, inputProps = {}, slotProps, onChange, onChangeDelay, changeDelay = onChangeDelay ? [480] : undefined, readOnly, size = MUGlobal_1.MUGlobal.inputFieldSize, variant = MUGlobal_1.MUGlobal.inputFieldVariant, ...rest } = props;
19
+ const { slotProps, onChange, onChangeDelay, changeDelay = onChangeDelay ? [480] : undefined, readOnly, size = MUGlobal_1.MUGlobal.inputFieldSize, variant = MUGlobal_1.MUGlobal.inputFieldVariant, ...rest } = props;
20
20
  // Slot props
21
21
  const { htmlInput, input, inputLabel, ...restSlotProps } = slotProps ?? {};
22
22
  const isMounted = react_2.default.useRef(true);
@@ -50,10 +50,9 @@ function InputField(props) {
50
50
  return ((0, jsx_runtime_1.jsx)(TextField_1.default, { slotProps: {
51
51
  htmlInput: {
52
52
  ["data-min-chars"]: changeDelay?.[1],
53
- ...htmlInput,
54
- ...inputProps
53
+ ...htmlInput
55
54
  },
56
- input: { readOnly, ...input, ...InputProps },
55
+ input: { readOnly, ...input },
57
56
  inputLabel: {
58
57
  shrink: MUGlobal_1.MUGlobal.inputFieldShrink,
59
58
  ...inputLabel
@@ -86,7 +86,7 @@ function MoreFab(props) {
86
86
  const hasIcon = actionsLocal.some((action) => action.icon != null);
87
87
  // Main
88
88
  const main = iconButton ? ((0, jsx_runtime_1.jsx)(IconButton_1.default, { color: color, size: size, title: title, onClick: handleClick, children: icon })) : ((0, jsx_runtime_1.jsx)(Fab_1.default, { color: color, size: size, title: title, onClick: handleClick, children: icon }));
89
- return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [main, (0, jsx_runtime_1.jsx)(Menu_1.default, { disableScrollLock: true, anchorEl: anchorEl, anchorOrigin: anchorOrigin, keepMounted: true, transformOrigin: transformOrigin, open: open, onClose: handleClose, PaperProps: PaperProps, children: actionsLocal.map(({ label, icon, action }, index) => label === "-" ? ((0, jsx_runtime_1.jsx)(Divider_1.default, {}, index)) : ((0, jsx_runtime_1.jsxs)(MenuItem_1.default, { ...(typeof action === "string"
89
+ return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [main, (0, jsx_runtime_1.jsx)(Menu_1.default, { disableScrollLock: true, anchorEl: anchorEl, anchorOrigin: anchorOrigin, keepMounted: true, transformOrigin: transformOrigin, open: open, onClose: handleClose, slotProps: { paper: PaperProps }, children: actionsLocal.map(({ label, icon, action }, index) => label === "-" ? ((0, jsx_runtime_1.jsx)(Divider_1.default, {}, index)) : ((0, jsx_runtime_1.jsxs)(MenuItem_1.default, { ...(typeof action === "string"
90
90
  ? action.includes("://")
91
91
  ? {
92
92
  component: "a",
@@ -183,7 +183,7 @@ class NotificationMU extends react_2.NotificationReact {
183
183
  this.dismiss();
184
184
  return true;
185
185
  };
186
- return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent_1.DraggablePaperComponent : undefined, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [(0, jsx_runtime_1.jsxs)(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [(0, jsx_runtime_1.jsx)(Info_1.default, { color: "primary" }), (0, jsx_runtime_1.jsx)("span", { className: "dialogTitle", children: title }), closable && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, { ...inputProps, children: [content, (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "caption", display: "block", ref: errorRef, color: "error" })] }), (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: buttons ? (buttons(this, handleSubmit)) : ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [cancelButton && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "secondary", onClick: () => {
186
+ return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, { open: this.open, PaperComponent: draggable ? DraggablePaperComponent_1.DraggablePaperComponent : undefined, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [(0, jsx_runtime_1.jsxs)(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [(0, jsx_runtime_1.jsx)(Info_1.default, { color: "primary" }), (0, jsx_runtime_1.jsx)("span", { className: "dialogTitle", children: title }), closable && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, { ...inputProps, children: [content, (0, jsx_runtime_1.jsx)(Typography_1.default, { component: "div", variant: "caption", ref: errorRef, color: "error" })] }), (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: buttons ? (buttons(this, handleSubmit)) : ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [cancelButton && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "secondary", onClick: () => {
187
187
  if (this.onReturn)
188
188
  this.onReturn(undefined);
189
189
  this.dismiss();
@@ -269,7 +269,7 @@ class NotificationMU extends react_2.NotificationReact {
269
269
  return false;
270
270
  }
271
271
  }
272
- }, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [(0, jsx_runtime_1.jsxs)(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [(0, jsx_runtime_1.jsx)(Info_1.default, { color: "primary" }), (0, jsx_runtime_1.jsx)("span", { className: "dialogTitle", children: title }), closable && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, { dividers: true, children: [typeof this.content === "string" ? ((0, jsx_runtime_1.jsx)(DialogContentText_1.default, { children: this.content })) : (this.content), localInputs, (0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "caption", display: "block", ref: errorRef, color: "error" })] }), (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: buttons ? (buttons(this, handleSubmit)) : ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [cancelButton && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "secondary", onClick: () => {
272
+ }, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, scroll: "paper", ...options, children: [(0, jsx_runtime_1.jsxs)(IconDialogTitle, { draggable: draggable, className: draggable ? "dialog-title draggable-dialog-title" : "dialog-title", children: [(0, jsx_runtime_1.jsx)(Info_1.default, { color: "primary" }), (0, jsx_runtime_1.jsx)("span", { className: "dialogTitle", children: title }), closable && ((0, jsx_runtime_1.jsx)(IconButton_1.default, { className: "MuiDialogContent-root-close-button", size: "small", onClick: () => this.returnValue("CLOSE"), children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }))] }), (0, jsx_runtime_1.jsxs)(DialogContent_1.default, { dividers: true, children: [typeof this.content === "string" ? ((0, jsx_runtime_1.jsx)(DialogContentText_1.default, { children: this.content })) : (this.content), localInputs, (0, jsx_runtime_1.jsx)(Typography_1.default, { component: "div", variant: "caption", ref: errorRef, color: "error" })] }), (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: buttons ? (buttons(this, handleSubmit)) : ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [cancelButton && ((0, jsx_runtime_1.jsx)(Button_1.default, { color: "secondary", onClick: () => {
273
273
  if (this.onReturn)
274
274
  this.onReturn(undefined);
275
275
  this.dismiss();
@@ -299,11 +299,15 @@ class NotificationMU extends react_2.NotificationReact {
299
299
  return ((0, jsx_runtime_1.jsx)(Backdrop_1.default, { className: className, sx: {
300
300
  color: "#fff",
301
301
  zIndex: (theme) => theme.zIndex.modal + 1
302
- }, open: this.open, ...options, children: (0, jsx_runtime_1.jsxs)(Box_1.default, { display: "flex", flexDirection: "column", flexWrap: "nowrap", alignItems: "center", sx: {
302
+ }, open: this.open, ...options, children: (0, jsx_runtime_1.jsxs)(Box_1.default, { sx: {
303
+ display: "flex",
304
+ flexDirection: "column",
305
+ flexWrap: "nowrap",
306
+ alignItems: "center",
303
307
  "& > :not(style) + :not(style)": {
304
308
  marginTop: (theme) => theme.spacing(1)
305
309
  }
306
- }, children: [(0, jsx_runtime_1.jsx)(CircularProgress_1.default, { ...setupProps }), content && ((0, jsx_runtime_1.jsx)(Box_1.default, { maxWidth: maxWidth === false ? undefined : maxWidth, children: content }))] }) }, this.id));
310
+ }, children: [(0, jsx_runtime_1.jsx)(CircularProgress_1.default, { ...setupProps }), content && ((0, jsx_runtime_1.jsx)(Box_1.default, { sx: { maxWidth: maxWidth === false ? undefined : maxWidth }, children: content }))] }) }, this.id));
307
311
  }
308
312
  /**
309
313
  * Render method
@@ -421,7 +425,10 @@ class NotifierMU extends react_2.NotifierReact {
421
425
  // Use SnackBar for layout
422
426
  return ((0, jsx_runtime_1.jsx)(Snackbar_1.default, { anchorOrigin: NotifierMU.getOrigin(align), className: className, sx: align === notificationbase_1.NotificationAlign.Center
423
427
  ? { position: "fixed", top: "50%!important" }
424
- : undefined, open: true, children: (0, jsx_runtime_1.jsx)(Box_1.default, { display: "flex", flexDirection: "column", flexWrap: "nowrap", sx: {
428
+ : undefined, open: true, children: (0, jsx_runtime_1.jsx)(Box_1.default, { sx: {
429
+ display: "flex",
430
+ flexDirection: "column",
431
+ flexWrap: "nowrap",
425
432
  "& > :not(style) + :not(style)": {
426
433
  marginTop: (theme) => theme.spacing(1)
427
434
  }
@@ -112,5 +112,5 @@ function OptionGroup(props) {
112
112
  "& input": {
113
113
  display: "none"
114
114
  }
115
- } })) : ((0, jsx_runtime_1.jsx)(Box_1.default, { paddingLeft: 2, paddingY: "7px", children: group }))] }), helperText && ((0, jsx_runtime_1.jsx)(FormHelperText_1.default, { sx: { marginLeft: 2, marginRight: 2 }, children: helperText }))] }));
115
+ } })) : ((0, jsx_runtime_1.jsx)(Box_1.default, { sx: { paddingLeft: 2, paddingY: "7px" }, children: group }))] }), helperText && ((0, jsx_runtime_1.jsx)(FormHelperText_1.default, { sx: { marginLeft: 2, marginRight: 2 }, children: helperText }))] }));
116
116
  }
@@ -94,5 +94,5 @@ function OptionGroupFlag(props) {
94
94
  "& input": {
95
95
  display: "none"
96
96
  }
97
- } })) : ((0, jsx_runtime_1.jsx)(Box_1.default, { paddingLeft: 2, paddingY: "7px", children: group }))] }), helperText && ((0, jsx_runtime_1.jsx)(FormHelperText_1.default, { sx: { marginLeft: 2, marginRight: 2 }, children: helperText }))] }));
97
+ } })) : ((0, jsx_runtime_1.jsx)(Box_1.default, { sx: { paddingLeft: 2, paddingY: "7px" }, children: group }))] }), helperText && ((0, jsx_runtime_1.jsx)(FormHelperText_1.default, { sx: { marginLeft: 2, marginRight: 2 }, children: helperText }))] }));
98
98
  }
@@ -24,7 +24,7 @@ function QuickList(props) {
24
24
  // Global app
25
25
  const app = (0, ReactApp_1.useAppContext)();
26
26
  // Destruct
27
- const { buttonProps = {}, label, inputProps, itemLabel = shared_1.DataTypes.getListItemLabel, itemRenderer = (item) => itemLabel(item), itemProps, loadData, noMatchesLabel = app?.get("noMatches"), gap = 1, height = "480px", onItemClick, ...rest } = props;
27
+ const { buttonProps = {}, label, inputProps, itemLabel = shared_1.DataTypes.getListItemLabel, itemRenderer = (item) => itemLabel(item), itemProps, loadData, noMatchesLabel = app?.get("noMatches"), spacing = 1, onItemClick, sx, ...rest } = props;
28
28
  const { onClick, ...buttonRest } = buttonProps;
29
29
  // States
30
30
  const [loading, setLoading] = react_1.default.useState(false);
@@ -40,12 +40,12 @@ function QuickList(props) {
40
40
  loadDataLocal();
41
41
  }, []);
42
42
  // Layout
43
- return ((0, jsx_runtime_1.jsxs)(FlexBox_1.VBox, { gap: gap, height: height, ...rest, children: [(0, jsx_runtime_1.jsx)(InputField_1.InputField, { label: label, onChangeDelay: (event) => {
43
+ return ((0, jsx_runtime_1.jsxs)(FlexBox_1.VBox, { spacing: spacing, sx: { height: "480px", ...sx }, ...rest, children: [(0, jsx_runtime_1.jsx)(InputField_1.InputField, { label: label, onChangeDelay: (event) => {
44
44
  // Stop bubble
45
45
  event.preventDefault();
46
46
  event.stopPropagation();
47
47
  loadDataLocal(event.target.value);
48
- }, fullWidth: true, ...inputProps }), loading ? ((0, jsx_runtime_1.jsx)(LinearProgress_1.default, {})) : items.length === 0 ? ((0, jsx_runtime_1.jsx)(Typography_1.default, { textAlign: "center", children: noMatchesLabel })) : ((0, jsx_runtime_1.jsx)(List_1.default, { children: items.map((item) => ((0, jsx_runtime_1.jsx)(ListItem_1.default, { disablePadding: true, ...itemProps, children: (0, jsx_runtime_1.jsx)(ListItemButton_1.default, { onClick: (event) => {
48
+ }, fullWidth: true, ...inputProps }), loading ? ((0, jsx_runtime_1.jsx)(LinearProgress_1.default, {})) : items.length === 0 ? ((0, jsx_runtime_1.jsx)(Typography_1.default, { align: "center", children: noMatchesLabel })) : ((0, jsx_runtime_1.jsx)(List_1.default, { children: items.map((item) => ((0, jsx_runtime_1.jsx)(ListItem_1.default, { disablePadding: true, ...itemProps, children: (0, jsx_runtime_1.jsx)(ListItemButton_1.default, { onClick: (event) => {
49
49
  if (onClick)
50
50
  onClick(event);
51
51
  if (!event.defaultPrevented && onItemClick)
@@ -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
- const onSubmit = (data, _reset) => {
77
- if (data == null || state.ref == null)
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"
@@ -147,8 +148,11 @@ function ResponsibleContainer(props) {
147
148
  return ((0, jsx_runtime_1.jsxs)(Box_1.default, { sx: containerBoxSx == null
148
149
  ? undefined
149
150
  : containerBoxSx(paddings, hasFields, showDataGrid), children: [(0, jsx_runtime_1.jsxs)(Stack_1.default, { children: [(0, jsx_runtime_1.jsx)(Box_1.default, { ref: dimensions[0][0], className: "SearchBox", sx: {
151
+ marginBottom: hasFields
152
+ ? `${searchBarBottom}px!important`
153
+ : undefined,
150
154
  height: hasFields ? searchBarHeight : 0
151
- }, marginBottom: hasFields ? `${searchBarBottom}px!important` : undefined, children: searchBar }), list] }), pullToRefresh && pullContainer && list != null && ((0, jsx_runtime_1.jsx)(PullToRefreshUI_1.PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: () => state.ref?.reset(), shouldPullToRefresh: () => {
155
+ }, children: searchBar }), list] }), pullToRefresh && pullContainer && list != null && ((0, jsx_runtime_1.jsx)(PullToRefreshUI_1.PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: () => state.ref?.reset(), shouldPullToRefresh: () => {
152
156
  const container = document.querySelector(pullContainer);
153
157
  return !container?.scrollTop;
154
158
  } }))] }));
@@ -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
  */
@@ -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 > 0) {
241
- delayed.call(autoSubmitDelay);
240
+ if (autoSubmitDelay > 10) {
241
+ delayed.call(autoSubmitDelay, false, true);
242
242
  }
243
243
  return () => {
244
244
  delayed.clear();
@@ -248,7 +248,12 @@ function SearchBar(props) {
248
248
  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) => {
249
249
  if (form)
250
250
  state.form = form;
251
- }, children: (0, jsx_runtime_1.jsxs)(Stack_1.default, { ref: dimensions[0][0], className: "SearchBarContainer", justifyContent: "center", alignItems: "center", direction: "row", spacing: `${itemGap}px`, width: width, overflow: "hidden", paddingTop: "6px", sx: {
251
+ }, children: (0, jsx_runtime_1.jsxs)(Stack_1.default, { ref: dimensions[0][0], className: "SearchBarContainer", direction: "row", spacing: `${itemGap}px`, sx: {
252
+ alignItems: "center",
253
+ justifyContent: "center",
254
+ width,
255
+ overflow: "hidden",
256
+ paddingTop: "6px",
252
257
  "& > :not(style)": {
253
258
  flexBasis: "auto",
254
259
  flexGrow: 0,
@@ -271,7 +276,9 @@ function SearchBar(props) {
271
276
  }, open: open, onClose: () => updateOpen(false), children: [top === true && (0, jsx_runtime_1.jsx)(Toolbar_1.default, {}), (0, jsx_runtime_1.jsx)("form", { onChange: moreFormChange, ref: (form) => {
272
277
  if (form)
273
278
  state.moreForm = form;
274
- }, children: (0, jsx_runtime_1.jsx)(Stack_1.default, { direction: "column", alignItems: "stretch", spacing: 2, padding: 2, sx: {
279
+ }, children: (0, jsx_runtime_1.jsx)(Stack_1.default, { direction: "column", spacing: 2, sx: {
280
+ padding: 2,
281
+ alignItems: "stretch",
275
282
  "& > :not(style)": {
276
283
  minWidth: "100px"
277
284
  }
@@ -16,14 +16,8 @@ const TextField_1 = __importDefault(require("@mui/material/TextField"));
16
16
  */
17
17
  function SearchField(props) {
18
18
  // Destruct
19
- const { changeDelay, InputLabelProps = {}, InputProps = {}, inputProps = {}, onChange, readOnly, size = MUGlobal_1.MUGlobal.searchFieldSize, variant = MUGlobal_1.MUGlobal.searchFieldVariant, minChars = 0, ...rest } = props;
20
- // Shrink
21
- InputLabelProps.shrink ??= MUGlobal_1.MUGlobal.searchFieldShrink;
22
- // Read only
23
- if (readOnly != null)
24
- InputProps.readOnly = readOnly;
25
- // Min characters
26
- inputProps["data-min-chars"] = minChars;
19
+ const { changeDelay, onChange, readOnly, size = MUGlobal_1.MUGlobal.searchFieldSize, variant = MUGlobal_1.MUGlobal.searchFieldVariant, minChars = 0, slotProps, ...rest } = props;
20
+ const { input, inputLabel, htmlInput, ...restSlotProps } = slotProps ?? {};
27
21
  const isMounted = react_2.default.useRef(true);
28
22
  const delayed = onChange != null && changeDelay != null && changeDelay >= 1
29
23
  ? (0, react_1.useDelayedExecutor)(onChange, changeDelay)
@@ -52,5 +46,10 @@ function SearchField(props) {
52
46
  };
53
47
  }, []);
54
48
  // Layout
55
- return ((0, jsx_runtime_1.jsx)(TextField_1.default, { InputLabelProps: InputLabelProps, InputProps: InputProps, inputProps: inputProps, onChange: onChangeEx, size: size, variant: variant, ...rest }));
49
+ return ((0, jsx_runtime_1.jsx)(TextField_1.default, { onChange: onChangeEx, size: size, variant: variant, slotProps: {
50
+ input: { readOnly, ...input },
51
+ inputLabel: { shrink: MUGlobal_1.MUGlobal.searchFieldShrink, ...inputLabel },
52
+ htmlInput: { ["data-min-chars"]: minChars, ...htmlInput },
53
+ ...restSlotProps
54
+ }, ...rest }));
56
55
  }
@@ -37,12 +37,12 @@ function SwitchAnt(props) {
37
37
  setControlChecked(checked);
38
38
  };
39
39
  // Layout
40
- return ((0, jsx_runtime_1.jsxs)(Stack_1.default, { direction: "row", spacing: 1, alignItems: "center", children: [(0, jsx_runtime_1.jsx)(Typography_1.default, { onClick: () => controlChecked && ref.current?.click(), sx: {
40
+ return ((0, jsx_runtime_1.jsxs)(Stack_1.default, { direction: "row", spacing: 1, sx: { alignItems: "center" }, children: [(0, jsx_runtime_1.jsx)(Typography_1.default, { onClick: () => controlChecked && ref.current?.click(), sx: {
41
41
  cursor: "pointer",
42
42
  color: controlChecked
43
43
  ? undefined
44
44
  : (theme) => activeColor ?? theme.palette.warning.main
45
- }, children: startLabel }), (0, jsx_runtime_1.jsx)(Switch_1.default, { checked: controlChecked, inputRef: ref, value: value, onChange: onChangeLocal, ...rest }), (0, jsx_runtime_1.jsx)(Typography_1.default, { onClick: () => !controlChecked && ref.current?.click(), sx: {
45
+ }, children: startLabel }), (0, jsx_runtime_1.jsx)(Switch_1.default, { checked: controlChecked, ref: ref, value: value, onChange: onChangeLocal, ...rest }), (0, jsx_runtime_1.jsx)(Typography_1.default, { onClick: () => !controlChecked && ref.current?.click(), sx: {
46
46
  cursor: "pointer",
47
47
  color: controlChecked
48
48
  ? (theme) => activeColor ?? theme.palette.warning.main
@@ -35,5 +35,5 @@ function SwitchField(props) {
35
35
  "& input": {
36
36
  display: "none"
37
37
  }
38
- } })) : ((0, jsx_runtime_1.jsx)(Box_1.default, { paddingLeft: 2, paddingY: "7px", children: group }))] }), helperText && (0, jsx_runtime_1.jsx)(FormHelperText_1.default, { children: helperText })] }));
38
+ } })) : ((0, jsx_runtime_1.jsx)(Box_1.default, { sx: { paddingLeft: 2, paddingY: "7px" }, children: group }))] }), helperText && (0, jsx_runtime_1.jsx)(FormHelperText_1.default, { children: helperText })] }));
39
39
  }