1 line
99 KiB
JSON
1 line
99 KiB
JSON
|
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nvar _excluded = [\"name\"];\nimport { merge } from \"rc-util/es/utils/set\";\nimport warning from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport { HOOK_MARK } from \"./FieldContext\";\nimport { allPromiseFinish } from \"./utils/asyncUtil\";\nimport { defaultValidateMessages } from \"./utils/messages\";\nimport NameMap from \"./utils/NameMap\";\nimport { cloneByNamePathList, containsNamePath, getNamePath, getValue, matchNamePath, setValue } from \"./utils/valueUtil\";\nexport var FormStore = /*#__PURE__*/_createClass(function FormStore(forceRootUpdate) {\n var _this = this;\n _classCallCheck(this, FormStore);\n _defineProperty(this, \"formHooked\", false);\n _defineProperty(this, \"forceRootUpdate\", void 0);\n _defineProperty(this, \"subscribable\", true);\n _defineProperty(this, \"store\", {});\n _defineProperty(this, \"fieldEntities\", []);\n _defineProperty(this, \"initialValues\", {});\n _defineProperty(this, \"callbacks\", {});\n _defineProperty(this, \"validateMessages\", null);\n _defineProperty(this, \"preserve\", null);\n _defineProperty(this, \"lastValidatePromise\", null);\n _defineProperty(this, \"getForm\", function () {\n return {\n getFieldValue: _this.getFieldValue,\n getFieldsValue: _this.getFieldsValue,\n getFieldError: _this.getFieldError,\n getFieldWarning: _this.getFieldWarning,\n getFieldsError: _this.getFieldsError,\n isFieldsTouched: _this.isFieldsTouched,\n isFieldTouched: _this.isFieldTouched,\n isFieldValidating: _this.isFieldValidating,\n isFieldsValidating: _this.isFieldsValidating,\n resetFields: _this.resetFields,\n setFields: _this.setFields,\n setFieldValue: _this.setFieldValue,\n setFieldsValue: _this.setFieldsValue,\n validateFields: _this.validateFields,\n submit: _this.submit,\n _init: true,\n getInternalHooks: _this.getInternalHooks\n };\n });\n // ======================== Internal Hooks ========================\n _defineProperty(this, \"getInternalHooks\", function (key) {\n if (key === HOOK_MARK) {\n _this.formHooked = true;\n return {\n dispatch: _this.dispatch,\n initEntityValue: _this.initEntityValue,\n registerField: _this.registerField,\n useSubscribe: _this.useSubscribe,\n setInitialValues: _this.setInitialValues,\n destroyForm: _this.destroyForm,\n setCallbacks: _this.setCallbacks,\n setValidateMessages: _this.setValidateMessages,\n getFields: _this.getFields,\n setPreserve: _this.setPreserve,\n getInitialValue: _this.getInitialValue,\n registerWatch: _this.registerWatch\n };\n }\n warning(false, '`getInternalHooks` is internal usage. Should not call directly.');\n return null;\n });\n _defineProperty(this, \"useSubscribe\", function (subscribable) {\n _this.subscribable = subscribable;\n });\n /**\n * Record prev Form unmount fieldEntities which config preserve false.\n * This need to be refill with initialValues instead of store value.\n */\n _defineProperty(this, \"prevWithoutPreserves\", null);\n /**\n * First time `setInitialValues` should update store with initial value\n */\n _defineProperty(this, \"setInitialValues\", function (initialValues, init) {\n _this.initialValues = initialValues || {};\n if (init) {\n var _this$prevWithoutPres;\n var nextStore = merge(initialValues, _this.store
|