revdev-components 0.99.0 → 0.101.0

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.
@@ -0,0 +1 @@
1
+ export declare const CONSOLE_COLOR = "background:rgb(28, 46, 82); color:rgb(231, 231, 231)";
@@ -13,5 +13,6 @@ export interface AppFormProps<T = any> {
13
13
  form?: FormInstance;
14
14
  onValid?: (valid: boolean) => void;
15
15
  initialValues?: Partial<T>;
16
+ debug?: boolean;
16
17
  }
17
- export declare function AppForm<T = any>({ form: propForm, children, className, onFinish, onValuesChange, onFieldsChange, onValid, initialValues, }: AppFormProps<T>): React.ReactElement<AppFormProps<T>>;
18
+ export declare function AppForm<T = any>({ form: propForm, children, className, onFinish, onValuesChange, onFieldsChange, onValid, initialValues, debug, }: AppFormProps<T>): React.ReactElement<AppFormProps<T>>;
@@ -1 +1,2 @@
1
1
  export declare function useFormValues<TValues extends object>(): [Partial<TValues>, (value: Partial<TValues>, all: TValues) => void];
2
+ export declare function useFormValid(): [boolean, (newValid: boolean) => void];
package/build/index.js CHANGED
@@ -4710,12 +4710,14 @@ var SocialIcon = function (props) {
4710
4710
 
4711
4711
  var s$s = {"root":"index-module_root__gtTIa","action":"index-module_action__pOSde"};
4712
4712
 
4713
+ var CONSOLE_COLOR = "background:rgb(28, 46, 82); color:rgb(231, 231, 231)";
4714
+
4713
4715
  function useForm(form) {
4714
4716
  var newForm = antd.Form.useForm()[0];
4715
4717
  return form ? form : newForm;
4716
4718
  }
4717
4719
  function AppForm(_a) {
4718
- var propForm = _a.form, children = _a.children, className = _a.className, onFinish = _a.onFinish, onValuesChange = _a.onValuesChange, onFieldsChange = _a.onFieldsChange, onValid = _a.onValid, initialValues = _a.initialValues;
4720
+ var propForm = _a.form, children = _a.children, className = _a.className, onFinish = _a.onFinish, onValuesChange = _a.onValuesChange, onFieldsChange = _a.onFieldsChange, onValid = _a.onValid, initialValues = _a.initialValues, debug = _a.debug;
4719
4721
  var form = useForm(propForm);
4720
4722
  var _b = React.useState(false), valid = _b[0], setValid = _b[1];
4721
4723
  var values = antd.Form.useWatch([], form);
@@ -4726,8 +4728,14 @@ function AppForm(_a) {
4726
4728
  .catch(function () { return setValid(false); });
4727
4729
  }, [form, values]);
4728
4730
  React.useEffect(function () {
4731
+ if (debug) {
4732
+ console.info("%cform", CONSOLE_COLOR, "valid", valid);
4733
+ }
4729
4734
  onValid === null || onValid === void 0 ? void 0 : onValid(valid);
4730
4735
  }, [onValid, valid]);
4736
+ React.useEffect(function () {
4737
+ console.info("%cform", CONSOLE_COLOR, "values", values);
4738
+ }, [values]);
4731
4739
  return (React.createElement(antd.Form, { form: form, onFinish: onFinish, className: classNames(s$s.root, className), layout: "vertical", onValuesChange: onValuesChange, onFieldsChange: onFieldsChange, initialValues: initialValues }, typeof children === "function" ? children({ valid: valid }) : children));
4732
4740
  }
4733
4741
 
@@ -4856,6 +4864,13 @@ function useFormValues() {
4856
4864
  }, []);
4857
4865
  return [values, handleChange];
4858
4866
  }
4867
+ function useFormValid() {
4868
+ var _a = React.useState(false), valid = _a[0], setValid = _a[1];
4869
+ var handleValid = React.useCallback(function (newValid) {
4870
+ setValid(newValid);
4871
+ }, []);
4872
+ return [valid, handleValid];
4873
+ }
4859
4874
 
4860
4875
  function useDidMount() {
4861
4876
  var _a = React.useState(false), mount = _a[0], setMount = _a[1];
@@ -5457,6 +5472,7 @@ exports.TextAreaField = TextAreaField;
5457
5472
  exports.useAppFormRules = useAppFormRules;
5458
5473
  exports.useDebounceEffect = useDebounceEffect;
5459
5474
  exports.useDidMount = useDidMount;
5475
+ exports.useFormValid = useFormValid;
5460
5476
  exports.useFormValues = useFormValues;
5461
5477
  exports.useLineProps = useLineProps;
5462
5478
  exports.usePrevious = usePrevious;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revdev-components",
3
- "version": "0.99.0",
3
+ "version": "0.101.0",
4
4
  "main": "build/index.js",
5
5
  "module": "build/index.esm.js",
6
6
  "scripts": {