1 line
73 KiB
JSON
1 line
73 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _regeneratorRuntime from \"@babel/runtime/helpers/esm/regeneratorRuntime\";\nimport _asyncToGenerator from \"@babel/runtime/helpers/esm/asyncToGenerator\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nvar _excluded = [\"name\"];\nimport toChildrenArray from \"rc-util/es/Children/toArray\";\nimport isEqual from \"rc-util/es/isEqual\";\nimport warning from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport FieldContext, { HOOK_MARK } from \"./FieldContext\";\nimport ListContext from \"./ListContext\";\nimport { toArray } from \"./utils/typeUtil\";\nimport { validateRules } from \"./utils/validateUtil\";\nimport { containsNamePath, defaultGetValueFromEvent, getNamePath, getValue } from \"./utils/valueUtil\";\nvar EMPTY_ERRORS = [];\nfunction requireUpdate(shouldUpdate, prev, next, prevValue, nextValue, info) {\n if (typeof shouldUpdate === 'function') {\n return shouldUpdate(prev, next, 'source' in info ? {\n source: info.source\n } : {});\n }\n return prevValue !== nextValue;\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style\n// We use Class instead of Hooks here since it will cost much code by using Hooks.\nvar Field = /*#__PURE__*/function (_React$Component) {\n _inherits(Field, _React$Component);\n var _super = _createSuper(Field);\n // ============================== Subscriptions ==============================\n function Field(props) {\n var _this;\n _classCallCheck(this, Field);\n _this = _super.call(this, props);\n\n // Register on init\n _defineProperty(_assertThisInitialized(_this), \"state\", {\n resetCount: 0\n });\n _defineProperty(_assertThisInitialized(_this), \"cancelRegisterFunc\", null);\n _defineProperty(_assertThisInitialized(_this), \"mounted\", false);\n /**\n * Follow state should not management in State since it will async update by React.\n * This makes first render of form can not get correct state value.\n */\n _defineProperty(_assertThisInitialized(_this), \"touched\", false);\n /**\n * Mark when touched & validated. Currently only used for `dependencies`.\n * Note that we do not think field with `initialValue` is dirty\n * but this will be by `isFieldDirty` func.\n */\n _defineProperty(_assertThisInitialized(_this), \"dirty\", false);\n _defineProperty(_assertThisInitialized(_this), \"validatePromise\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"prevValidating\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"errors\", EMPTY_ERRORS);\n _defineProperty(_assertThisInitialized(_this), \"warnings\", EMPTY_ERRORS);\n _defineProperty(_assertThisInitialized(_this), \"cancelRegister\", function () {\n var _this$props = _this.props,\n preserve = _this$props.preserve,\n isListField = _this$props.isListField,\n name = _this$props.name;\n if (_this.cancelRegisterFunc) {\n _this.cancelRegisterFunc(isListField, preserve, getNamePath(name));\n }\n _this.cancelRegisterFunc = null;\n });\n // ================================== Utils ==================================\n _defineProperty(_assertThisInitialized(_this), \"getNamePath\", function () {\n var _this$props2 = _this.props,\n name = _this$props2.name,\n fieldContext = _this$props
|