1 line
10 KiB
JSON
1 line
10 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport { ConfigContext } from '../../config-provider';\nimport defaultLocale from '../../locale/en_US';\nimport useLocale from '../../locale/useLocale';\nimport ConfirmDialog from '../ConfirmDialog';\nconst HookModal = (_a, ref) => {\n var _b;\n var {\n afterClose: hookAfterClose,\n config\n } = _a,\n restProps = __rest(_a, [\"afterClose\", \"config\"]);\n const [open, setOpen] = React.useState(true);\n const [innerConfig, setInnerConfig] = React.useState(config);\n const {\n direction,\n getPrefixCls\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls('modal');\n const rootPrefixCls = getPrefixCls();\n const afterClose = () => {\n var _a;\n hookAfterClose();\n (_a = innerConfig.afterClose) === null || _a === void 0 ? void 0 : _a.call(innerConfig);\n };\n const close = function () {\n var _a;\n setOpen(false);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n const triggerCancel = args.some(param => param === null || param === void 0 ? void 0 : param.triggerCancel);\n if (triggerCancel) {\n var _a2;\n (_a = innerConfig.onCancel) === null || _a === void 0 ? void 0 : (_a2 = _a).call.apply(_a2, [innerConfig, () => {}].concat(_toConsumableArray(args.slice(1))));\n }\n };\n React.useImperativeHandle(ref, () => ({\n destroy: close,\n update: newConfig => {\n setInnerConfig(originConfig => Object.assign(Object.assign({}, originConfig), newConfig));\n }\n }));\n const mergedOkCancel = (_b = innerConfig.okCancel) !== null && _b !== void 0 ? _b : innerConfig.type === 'confirm';\n const [contextLocale] = useLocale('Modal', defaultLocale.Modal);\n return /*#__PURE__*/React.createElement(ConfirmDialog, Object.assign({\n prefixCls: prefixCls,\n rootPrefixCls: rootPrefixCls\n }, innerConfig, {\n close: close,\n open: open,\n afterClose: afterClose,\n okText: innerConfig.okText || (mergedOkCancel ? contextLocale === null || contextLocale === void 0 ? void 0 : contextLocale.okText : contextLocale === null || contextLocale === void 0 ? void 0 : contextLocale.justOkText),\n direction: innerConfig.direction || direction,\n cancelText: innerConfig.cancelText || (contextLocale === null || contextLocale === void 0 ? void 0 : contextLocale.cancelText)\n }, restProps));\n};\nexport default /*#__PURE__*/React.forwardRef(HookModal);","map":{"version":3,"names":["_toConsumableArray","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","ConfigContext","defaultLocale","useLocale","ConfirmDialog","HookModal","_a","ref","_b","afterClose","hookAfterClose","config","restProps","open","setOpen","useState","innerConfig","setInnerConfig","direction","getPrefixCls","useContext","prefixCls","rootPrefixCls","close","_len","arguments","args","Array","_key","triggerCancel","some","param","_a2","onCancel","apply","concat","slice","useImperativeHandle","destroy","update","newConfig","originConfig","assign","mergedOkCancel","okCancel","type","contextLocale","Modal","createElement","okText","justOkText","cancelText","forwardRef"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/modal/useModal/HookModal.js"],"sourcesContent":["\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nvar __rest = thi
|