@etsoo/materialui 1.6.25 → 1.6.27
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/SearchBar.js
CHANGED
|
@@ -201,8 +201,7 @@ function SearchBar(props) {
|
|
|
201
201
|
const handleForm = (event) => {
|
|
202
202
|
if (checkFormEvent(event))
|
|
203
203
|
return;
|
|
204
|
-
|
|
205
|
-
state.form = event.currentTarget;
|
|
204
|
+
state.form = event.currentTarget;
|
|
206
205
|
delayed.call();
|
|
207
206
|
};
|
|
208
207
|
// Handle more button click
|
|
@@ -213,15 +212,15 @@ function SearchBar(props) {
|
|
|
213
212
|
const moreFormChange = (event) => {
|
|
214
213
|
if (checkFormEvent(event))
|
|
215
214
|
return;
|
|
216
|
-
|
|
217
|
-
state.moreForm = event.currentTarget;
|
|
215
|
+
state.moreForm = event.currentTarget;
|
|
218
216
|
delayed.call();
|
|
219
217
|
};
|
|
220
218
|
// Submit at once
|
|
221
219
|
const handleSubmitInstant = (reset = false) => {
|
|
222
220
|
// Prepare data
|
|
223
221
|
const data = new FormData(state.form);
|
|
224
|
-
|
|
222
|
+
// Check 'hasMoreItems' to make sure the 'moreForm' is rendered by purpose
|
|
223
|
+
if (hasMoreItems && state.moreForm != null) {
|
|
225
224
|
shared_1.DomUtils.mergeFormData(data, new FormData(state.moreForm));
|
|
226
225
|
}
|
|
227
226
|
onSubmit(data, reset);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { SubmitEventHandler } from "react";
|
|
2
2
|
import { CommonPageProps } from "./CommonPage";
|
|
3
3
|
import type { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
|
|
4
4
|
/**
|
|
@@ -12,7 +12,7 @@ export interface EditPageProps extends Omit<CommonPageProps, "onSubmit"> {
|
|
|
12
12
|
/**
|
|
13
13
|
* On form submit
|
|
14
14
|
*/
|
|
15
|
-
onSubmit?:
|
|
15
|
+
onSubmit?: SubmitEventHandler<HTMLFormElement>;
|
|
16
16
|
/**
|
|
17
17
|
* On delete callback
|
|
18
18
|
*/
|
package/lib/mjs/SearchBar.js
CHANGED
|
@@ -195,8 +195,7 @@ export function SearchBar(props) {
|
|
|
195
195
|
const handleForm = (event) => {
|
|
196
196
|
if (checkFormEvent(event))
|
|
197
197
|
return;
|
|
198
|
-
|
|
199
|
-
state.form = event.currentTarget;
|
|
198
|
+
state.form = event.currentTarget;
|
|
200
199
|
delayed.call();
|
|
201
200
|
};
|
|
202
201
|
// Handle more button click
|
|
@@ -207,15 +206,15 @@ export function SearchBar(props) {
|
|
|
207
206
|
const moreFormChange = (event) => {
|
|
208
207
|
if (checkFormEvent(event))
|
|
209
208
|
return;
|
|
210
|
-
|
|
211
|
-
state.moreForm = event.currentTarget;
|
|
209
|
+
state.moreForm = event.currentTarget;
|
|
212
210
|
delayed.call();
|
|
213
211
|
};
|
|
214
212
|
// Submit at once
|
|
215
213
|
const handleSubmitInstant = (reset = false) => {
|
|
216
214
|
// Prepare data
|
|
217
215
|
const data = new FormData(state.form);
|
|
218
|
-
|
|
216
|
+
// Check 'hasMoreItems' to make sure the 'moreForm' is rendered by purpose
|
|
217
|
+
if (hasMoreItems && state.moreForm != null) {
|
|
219
218
|
DomUtils.mergeFormData(data, new FormData(state.moreForm));
|
|
220
219
|
}
|
|
221
220
|
onSubmit(data, reset);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { SubmitEventHandler } from "react";
|
|
2
2
|
import { CommonPageProps } from "./CommonPage";
|
|
3
3
|
import type { OperationMessageHandlerAll } from "../messages/OperationMessageHandler";
|
|
4
4
|
/**
|
|
@@ -12,7 +12,7 @@ export interface EditPageProps extends Omit<CommonPageProps, "onSubmit"> {
|
|
|
12
12
|
/**
|
|
13
13
|
* On form submit
|
|
14
14
|
*/
|
|
15
|
-
onSubmit?:
|
|
15
|
+
onSubmit?: SubmitEventHandler<HTMLFormElement>;
|
|
16
16
|
/**
|
|
17
17
|
* On delete callback
|
|
18
18
|
*/
|
package/package.json
CHANGED
package/src/SearchBar.tsx
CHANGED
|
@@ -100,7 +100,7 @@ const setChildState = (child: Element, enabled: boolean) => {
|
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
function checkFormEvent(event: React.
|
|
103
|
+
function checkFormEvent(event: React.ChangeEvent<HTMLFormElement>) {
|
|
104
104
|
if (event.nativeEvent.cancelable && !event.nativeEvent.composed) return true;
|
|
105
105
|
|
|
106
106
|
if (
|
|
@@ -291,10 +291,10 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
291
291
|
const hasMoreItems = moreItems.length > 0;
|
|
292
292
|
|
|
293
293
|
// Handle main form
|
|
294
|
-
const handleForm = (event: React.
|
|
294
|
+
const handleForm = (event: React.ChangeEvent<HTMLFormElement>) => {
|
|
295
295
|
if (checkFormEvent(event)) return;
|
|
296
296
|
|
|
297
|
-
|
|
297
|
+
state.form = event.currentTarget;
|
|
298
298
|
|
|
299
299
|
delayed.call();
|
|
300
300
|
};
|
|
@@ -305,10 +305,10 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
305
305
|
};
|
|
306
306
|
|
|
307
307
|
// More form change
|
|
308
|
-
const moreFormChange = (event: React.
|
|
308
|
+
const moreFormChange = (event: React.ChangeEvent<HTMLFormElement>) => {
|
|
309
309
|
if (checkFormEvent(event)) return;
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
state.moreForm = event.currentTarget;
|
|
312
312
|
|
|
313
313
|
delayed.call();
|
|
314
314
|
};
|
|
@@ -317,7 +317,9 @@ export function SearchBar(props: SearchBarProps) {
|
|
|
317
317
|
const handleSubmitInstant = (reset: boolean = false) => {
|
|
318
318
|
// Prepare data
|
|
319
319
|
const data = new FormData(state.form);
|
|
320
|
-
|
|
320
|
+
|
|
321
|
+
// Check 'hasMoreItems' to make sure the 'moreForm' is rendered by purpose
|
|
322
|
+
if (hasMoreItems && state.moreForm != null) {
|
|
321
323
|
DomUtils.mergeFormData(data, new FormData(state.moreForm));
|
|
322
324
|
}
|
|
323
325
|
|
package/src/pages/EditPage.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { SubmitEventHandler } from "react";
|
|
2
2
|
import { MUGlobal } from "../MUGlobal";
|
|
3
3
|
import { CommonPage, CommonPageProps } from "./CommonPage";
|
|
4
4
|
import SaveIcon from "@mui/icons-material/Save";
|
|
@@ -22,7 +22,7 @@ export interface EditPageProps extends Omit<CommonPageProps, "onSubmit"> {
|
|
|
22
22
|
/**
|
|
23
23
|
* On form submit
|
|
24
24
|
*/
|
|
25
|
-
onSubmit?:
|
|
25
|
+
onSubmit?: SubmitEventHandler<HTMLFormElement>;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* On delete callback
|