@sheinx/base 3.5.7-beta.2 → 3.5.7-beta.3

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.
@@ -3,7 +3,7 @@ export interface FormFooterContextValue {
3
3
  setFormStats: (disabled?: 'disabled' | 'pending') => void;
4
4
  setFormInfo: (info: {
5
5
  submit: () => void;
6
- }) => void;
6
+ }) => boolean;
7
7
  deleteFormInfo: () => void;
8
8
  formStats: 'disabled' | 'pending' | undefined;
9
9
  func: {
@@ -1 +1 @@
1
- {"version":3,"file":"form-footer-context.d.ts","sourceRoot":"","sources":["form-footer-context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAEpF,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1D,WAAW,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;IACpD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IAC9C,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,IAAI,CAAC;KACpB,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,8CAAqD,CAAC;AAEpF,eAAO,MAAM,kBAAkB,UAAW;IAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;CAAE,gBA2BtE,CAAC;AAEF,eAAO,MAAM,aAAa,qCAGzB,CAAC"}
1
+ {"version":3,"file":"form-footer-context.d.ts","sourceRoot":"","sources":["form-footer-context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAEpF,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1D,WAAW,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,OAAO,CAAC;IACvD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IAC9C,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,IAAI,CAAC;KACpB,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,8CAAqD,CAAC;AAEpF,eAAO,MAAM,kBAAkB,UAAW;IAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;CAAE,gBA6BtE,CAAC;AAEF,eAAO,MAAM,aAAa,qCAGzB,CAAC"}
@@ -32,7 +32,9 @@ var FormFooterProvider = exports.FormFooterProvider = function FormFooterProvide
32
32
  if (!context.hasSubmit) {
33
33
  context.submit = info.submit;
34
34
  context.hasSubmit = true;
35
+ return true;
35
36
  }
37
+ return false;
36
38
  });
37
39
  var deleteFormInfo = (0, _hooks.usePersistFn)(function () {
38
40
  context.hasSubmit = false;
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["form.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,QAAA,MAAM,IAAI,4DAmHT,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["form.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,QAAA,MAAM,IAAI,4DA0HT,CAAC;AAEF,eAAe,IAAI,CAAC"}
package/cjs/form/form.js CHANGED
@@ -85,6 +85,10 @@ var Form = function Form(props) {
85
85
  props.setForm(formRefObj);
86
86
  }
87
87
  }, [formRefObj]);
88
+ var _React$useRef = _react.default.useRef({
89
+ bindindModalFormContextSuccess: false
90
+ }),
91
+ context = _React$useRef.current;
88
92
  var handleFormModalInfo = function handleFormModalInfo() {
89
93
  var status = undefined;
90
94
  if (props.disabled) {
@@ -97,13 +101,16 @@ var Form = function Form(props) {
97
101
  modalFormContext === null || modalFormContext === void 0 || modalFormContext.setFormStats(status);
98
102
  }
99
103
  if (props.onSubmit) {
100
- modalFormContext === null || modalFormContext === void 0 || modalFormContext.setFormInfo(formRefObj);
104
+ var ok = modalFormContext === null || modalFormContext === void 0 ? void 0 : modalFormContext.setFormInfo(formRefObj);
105
+ context.bindindModalFormContextSuccess = !!ok;
101
106
  }
102
107
  };
103
108
  (0, _react.useEffect)(function () {
104
109
  handleFormModalInfo();
105
110
  return function () {
106
- modalFormContext === null || modalFormContext === void 0 || modalFormContext.deleteFormInfo();
111
+ if (context.bindindModalFormContextSuccess) {
112
+ modalFormContext === null || modalFormContext === void 0 || modalFormContext.deleteFormInfo();
113
+ }
107
114
  };
108
115
  }, [props.disabled, props.pending]);
109
116
  var rootClass = (0, _classnames.default)([formClasses === null || formClasses === void 0 ? void 0 : formClasses.rootClass, formClasses === null || formClasses === void 0 ? void 0 : formClasses.wrapper, className, props.inline && (formClasses === null || formClasses === void 0 ? void 0 : formClasses.wrapperInline)]);
@@ -3,7 +3,7 @@ export interface FormFooterContextValue {
3
3
  setFormStats: (disabled?: 'disabled' | 'pending') => void;
4
4
  setFormInfo: (info: {
5
5
  submit: () => void;
6
- }) => void;
6
+ }) => boolean;
7
7
  deleteFormInfo: () => void;
8
8
  formStats: 'disabled' | 'pending' | undefined;
9
9
  func: {
@@ -1 +1 @@
1
- {"version":3,"file":"form-footer-context.d.ts","sourceRoot":"","sources":["form-footer-context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAEpF,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1D,WAAW,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;IACpD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IAC9C,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,IAAI,CAAC;KACpB,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,8CAAqD,CAAC;AAEpF,eAAO,MAAM,kBAAkB,UAAW;IAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;CAAE,gBA2BtE,CAAC;AAEF,eAAO,MAAM,aAAa,qCAGzB,CAAC"}
1
+ {"version":3,"file":"form-footer-context.d.ts","sourceRoot":"","sources":["form-footer-context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA+D,MAAM,OAAO,CAAC;AAEpF,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1D,WAAW,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,OAAO,CAAC;IACvD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IAC9C,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,IAAI,CAAC;KACpB,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,8CAAqD,CAAC;AAEpF,eAAO,MAAM,kBAAkB,UAAW;IAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;CAAE,gBA6BtE,CAAC;AAEF,eAAO,MAAM,aAAa,qCAGzB,CAAC"}
@@ -24,7 +24,9 @@ export var FormFooterProvider = function FormFooterProvider(props) {
24
24
  if (!context.hasSubmit) {
25
25
  context.submit = info.submit;
26
26
  context.hasSubmit = true;
27
+ return true;
27
28
  }
29
+ return false;
28
30
  });
29
31
  var deleteFormInfo = usePersistFn(function () {
30
32
  context.hasSubmit = false;
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["form.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,QAAA,MAAM,IAAI,4DAmHT,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["form.tsx"],"names":[],"mappings":";AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,QAAA,MAAM,IAAI,4DA0HT,CAAC;AAEF,eAAe,IAAI,CAAC"}
package/esm/form/form.js CHANGED
@@ -76,6 +76,10 @@ var Form = function Form(props) {
76
76
  props.setForm(formRefObj);
77
77
  }
78
78
  }, [formRefObj]);
79
+ var _React$useRef = React.useRef({
80
+ bindindModalFormContextSuccess: false
81
+ }),
82
+ context = _React$useRef.current;
79
83
  var handleFormModalInfo = function handleFormModalInfo() {
80
84
  var status = undefined;
81
85
  if (props.disabled) {
@@ -88,13 +92,16 @@ var Form = function Form(props) {
88
92
  modalFormContext === null || modalFormContext === void 0 || modalFormContext.setFormStats(status);
89
93
  }
90
94
  if (props.onSubmit) {
91
- modalFormContext === null || modalFormContext === void 0 || modalFormContext.setFormInfo(formRefObj);
95
+ var ok = modalFormContext === null || modalFormContext === void 0 ? void 0 : modalFormContext.setFormInfo(formRefObj);
96
+ context.bindindModalFormContextSuccess = !!ok;
92
97
  }
93
98
  };
94
99
  useEffect(function () {
95
100
  handleFormModalInfo();
96
101
  return function () {
97
- modalFormContext === null || modalFormContext === void 0 || modalFormContext.deleteFormInfo();
102
+ if (context.bindindModalFormContextSuccess) {
103
+ modalFormContext === null || modalFormContext === void 0 || modalFormContext.deleteFormInfo();
104
+ }
98
105
  };
99
106
  }, [props.disabled, props.pending]);
100
107
  var rootClass = classNames([formClasses === null || formClasses === void 0 ? void 0 : formClasses.rootClass, formClasses === null || formClasses === void 0 ? void 0 : formClasses.wrapper, className, props.inline && (formClasses === null || formClasses === void 0 ? void 0 : formClasses.wrapperInline)]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/base",
3
- "version": "3.5.7-beta.2",
3
+ "version": "3.5.7-beta.3",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "module": "./esm/index.js",
11
11
  "typings": "./cjs/index.d.ts",
12
12
  "dependencies": {
13
- "@sheinx/hooks": "3.5.7-beta.2",
13
+ "@sheinx/hooks": "3.5.7-beta.3",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.1.3-alpha.0"