@wq/form-web 3.0.0-alpha.0 → 3.0.0-alpha.1

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.
@@ -18,19 +18,25 @@ const DeleteFormFallback = {
18
18
  ...createFallbackComponents(["View", "HorizontalView"], "@wq/material"),
19
19
  },
20
20
  };
21
- function DeleteForm({ action }) {
21
+ function DeleteForm({ action, onSubmit, submitOptions }) {
22
22
  const { Form, SubmitButton, View, HorizontalView } = useComponents(),
23
23
  message = useMessage("CONFIRM_DELETE");
24
- function confirmSubmit() {
25
- return window.confirm(message);
24
+ function confirmSubmit(options) {
25
+ if (window.confirm(message)) {
26
+ if (onSubmit) {
27
+ return onSubmit(options);
28
+ } else {
29
+ console.error("No onSubmit handler provided to DeleteForm");
30
+ }
31
+ }
26
32
  }
27
33
  return /*#__PURE__*/ React.createElement(
28
34
  Form,
29
35
  {
30
36
  action: action,
31
37
  method: "DELETE",
32
- backgroundSync: false,
33
38
  onSubmit: confirmSubmit,
39
+ submitOptions: submitOptions,
34
40
  },
35
41
  /*#__PURE__*/ React.createElement(
36
42
  HorizontalView,
@@ -50,6 +56,8 @@ function DeleteForm({ action }) {
50
56
  }
51
57
  DeleteForm.propTypes = {
52
58
  action: PropTypes.string,
59
+ onSubmit: PropTypes.func.isRequired,
60
+ submitOptions: PropTypes.object,
53
61
  };
54
62
  export default withWQ(DeleteForm, {
55
63
  fallback: DeleteFormFallback,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wq/form-web",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-alpha.1",
4
4
  "description": "Web bindings for @wq/form",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "homepage": "https://form.wq.io/@wq/form-web",
31
31
  "dependencies": {
32
- "@wq/form-common": "^3.0.0-alpha.0",
32
+ "@wq/form-common": "^3.0.0-alpha.2",
33
33
  "@wq/react": "^3.0.0-alpha.0"
34
34
  },
35
35
  "peerDependencies": {
@@ -20,20 +20,26 @@ const DeleteFormFallback = {
20
20
  },
21
21
  };
22
22
 
23
- function DeleteForm({ action }) {
23
+ function DeleteForm({ action, onSubmit, submitOptions }) {
24
24
  const { Form, SubmitButton, View, HorizontalView } = useComponents(),
25
25
  message = useMessage("CONFIRM_DELETE");
26
26
 
27
- function confirmSubmit() {
28
- return window.confirm(message);
27
+ function confirmSubmit(options) {
28
+ if (window.confirm(message)) {
29
+ if (onSubmit) {
30
+ return onSubmit(options);
31
+ } else {
32
+ console.error("No onSubmit handler provided to DeleteForm");
33
+ }
34
+ }
29
35
  }
30
36
 
31
37
  return (
32
38
  <Form
33
39
  action={action}
34
40
  method="DELETE"
35
- backgroundSync={false}
36
41
  onSubmit={confirmSubmit}
42
+ submitOptions={submitOptions}
37
43
  >
38
44
  <HorizontalView>
39
45
  <View />
@@ -47,6 +53,8 @@ function DeleteForm({ action }) {
47
53
 
48
54
  DeleteForm.propTypes = {
49
55
  action: PropTypes.string,
56
+ onSubmit: PropTypes.func.isRequired,
57
+ submitOptions: PropTypes.object,
50
58
  };
51
59
 
52
60
  export default withWQ(DeleteForm, { fallback: DeleteFormFallback });