@teamix/pro 1.5.48-beta.3 → 1.5.53
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.
- package/dist/pro.js +1395 -140
- package/dist/pro.min.js +1 -1
- package/es/form/Components/FormItem2/index.js +5 -15
- package/es/form/ProForm/index.d.ts +2 -2
- package/es/form/ProForm/index.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/page-header/index.js +2 -2
- package/es/table/components/Cell/index.d.ts +5 -2
- package/es/table/components/Cell/index.js +3 -1
- package/es/table/index.js +8 -3
- package/lib/form/Components/FormItem2/index.js +5 -15
- package/lib/form/ProForm/index.d.ts +2 -2
- package/lib/form/ProForm/index.js +1 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/page-header/index.js +1 -1
- package/lib/table/components/Cell/index.d.ts +5 -2
- package/lib/table/components/Cell/index.js +3 -1
- package/lib/table/index.js +7 -2
- package/package.json +1 -1
- package/es/utils/aspect.d.ts +0 -2
- package/es/utils/aspect.js +0 -63
- package/lib/utils/aspect.d.ts +0 -2
- package/lib/utils/aspect.js +0 -70
package/dist/pro.js
CHANGED
|
@@ -97504,6 +97504,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
97504
97504
|
/* harmony export */ "useGetState": () => (/* reexport safe */ ahooks__WEBPACK_IMPORTED_MODULE_0__.$k),
|
|
97505
97505
|
/* harmony export */ "useHistoryTravel": () => (/* reexport safe */ ahooks__WEBPACK_IMPORTED_MODULE_0__.Xm),
|
|
97506
97506
|
/* harmony export */ "useHover": () => (/* reexport safe */ ahooks__WEBPACK_IMPORTED_MODULE_0__.XI),
|
|
97507
|
+
/* harmony export */ "useInRouter": () => (/* reexport safe */ _useInRouter__WEBPACK_IMPORTED_MODULE_3__.k),
|
|
97507
97508
|
/* harmony export */ "useInViewport": () => (/* reexport safe */ ahooks__WEBPACK_IMPORTED_MODULE_0__.NM),
|
|
97508
97509
|
/* harmony export */ "useInfiniteScroll": () => (/* reexport safe */ ahooks__WEBPACK_IMPORTED_MODULE_0__.MQ),
|
|
97509
97510
|
/* harmony export */ "useInterval": () => (/* reexport safe */ ahooks__WEBPACK_IMPORTED_MODULE_0__.Yz),
|
|
@@ -97555,10 +97556,38 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
97555
97556
|
/* harmony import */ var ahooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(96395);
|
|
97556
97557
|
/* harmony import */ var _useResponsiveProps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26134);
|
|
97557
97558
|
/* harmony import */ var _useUrlState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(13914);
|
|
97559
|
+
/* harmony import */ var _useInRouter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(54747);
|
|
97560
|
+
|
|
97558
97561
|
|
|
97559
97562
|
|
|
97560
97563
|
|
|
97561
97564
|
|
|
97565
|
+
/***/ }),
|
|
97566
|
+
|
|
97567
|
+
/***/ 54747:
|
|
97568
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
97569
|
+
|
|
97570
|
+
"use strict";
|
|
97571
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
97572
|
+
/* harmony export */ "k": () => (/* binding */ useInRouter)
|
|
97573
|
+
/* harmony export */ });
|
|
97574
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59787);
|
|
97575
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
97576
|
+
/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(18944);
|
|
97577
|
+
/* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_router__WEBPACK_IMPORTED_MODULE_1__);
|
|
97578
|
+
|
|
97579
|
+
|
|
97580
|
+
function useInRouter() {
|
|
97581
|
+
// @ts-ignore
|
|
97582
|
+
if (react_router__WEBPACK_IMPORTED_MODULE_1__.useInRouterContext) {
|
|
97583
|
+
// @ts-ignore
|
|
97584
|
+
return react_router__WEBPACK_IMPORTED_MODULE_1__.useInRouterContext();
|
|
97585
|
+
} else {
|
|
97586
|
+
// @ts-ignore
|
|
97587
|
+
return !!react__WEBPACK_IMPORTED_MODULE_0___default().useContext(react_router__WEBPACK_IMPORTED_MODULE_1__.__RouterContext);
|
|
97588
|
+
}
|
|
97589
|
+
}
|
|
97590
|
+
|
|
97562
97591
|
/***/ }),
|
|
97563
97592
|
|
|
97564
97593
|
/***/ 26134:
|
|
@@ -97713,7 +97742,13 @@ var useUrlState = function useUrlState(initialState, options) {
|
|
|
97713
97742
|
stringifyOptions = _ref.stringifyOptions;
|
|
97714
97743
|
var mergedParseOptions = _extends({}, baseParseConfig, parseOptions);
|
|
97715
97744
|
var mergedStringifyOptions = _extends({}, baseStringifyConfig, stringifyOptions);
|
|
97716
|
-
var location
|
|
97745
|
+
var location;
|
|
97746
|
+
try {
|
|
97747
|
+
location = react_router__WEBPACK_IMPORTED_MODULE_2__.useLocation();
|
|
97748
|
+
} catch (e) {
|
|
97749
|
+
console.error("useUrlState: You need to wrap your component with a <Router> component from 'react-router'.", 'This error is probably because they somehow have 2 versions of the router loaded. Check as-lib,', 'note that react-all-with-polyfill.min.js already includes react-router-dom.');
|
|
97750
|
+
throw e;
|
|
97751
|
+
}
|
|
97717
97752
|
|
|
97718
97753
|
// @ts-ignore react-router v5
|
|
97719
97754
|
var history = react_router__WEBPACK_IMPORTED_MODULE_2__.useHistory == null ? void 0 : react_router__WEBPACK_IMPORTED_MODULE_2__.useHistory();
|
|
@@ -100352,26 +100387,16 @@ var BaseItem = function BaseItem(props) {
|
|
|
100352
100387
|
}
|
|
100353
100388
|
var prefixCls = (0,_builtins___WEBPACK_IMPORTED_MODULE_2__/* .usePrefixCls */ .F8)('formily-item', props);
|
|
100354
100389
|
var prefix = (0,_builtins___WEBPACK_IMPORTED_MODULE_2__/* .usePrefixCls */ .F8)();
|
|
100355
|
-
var
|
|
100356
|
-
if (feedbackLayout === 'popover') {
|
|
100357
|
-
visibleProp = {
|
|
100358
|
-
visible: !!feedbackText
|
|
100359
|
-
};
|
|
100360
|
-
} else {
|
|
100361
|
-
if (!feedbackText) {
|
|
100362
|
-
visibleProp = {
|
|
100363
|
-
visible: false
|
|
100364
|
-
};
|
|
100365
|
-
}
|
|
100366
|
-
}
|
|
100367
|
-
var formatChildren = (feedbackLayout === 'popover' || feedbackLayout === 'hover-popover') && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_alicloudfe_components__WEBPACK_IMPORTED_MODULE_6__.Balloon, _extends({
|
|
100390
|
+
var formatChildren = (feedbackLayout === 'popover' || feedbackLayout === 'hover-popover') && !!feedbackText ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_alicloudfe_components__WEBPACK_IMPORTED_MODULE_6__.Balloon, _extends({
|
|
100368
100391
|
needAdjust: true,
|
|
100369
100392
|
align: "t",
|
|
100370
100393
|
closable: false,
|
|
100371
100394
|
trigger: children
|
|
100372
|
-
},
|
|
100395
|
+
}, feedbackLayout === 'popover' ? {
|
|
100396
|
+
visible: !!feedbackText
|
|
100397
|
+
} : {}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
100373
100398
|
className: classnames__WEBPACK_IMPORTED_MODULE_1___default()((_cls = {}, _cls[prefixCls + "-" + feedbackStatus + "-help"] = !!feedbackStatus, _cls[prefixCls + "-help"] = true, _cls))
|
|
100374
|
-
}, ICON_MAP[feedbackStatus != null ? feedbackStatus : ''], " ", feedbackText));
|
|
100399
|
+
}, ICON_MAP[feedbackStatus != null ? feedbackStatus : ''], " ", feedbackText)) : children;
|
|
100375
100400
|
var gridStyles = {};
|
|
100376
100401
|
var getOverflowTooltip = function getOverflowTooltip() {
|
|
100377
100402
|
if (overflow) {
|
|
@@ -103082,7 +103107,6 @@ var customComponent = function customComponent(component) {
|
|
|
103082
103107
|
/* harmony import */ var _locales_validate__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(67315);
|
|
103083
103108
|
/* harmony import */ var _Components_FormItem2__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(54778);
|
|
103084
103109
|
/* harmony import */ var _Components_SelectTable2__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(71661);
|
|
103085
|
-
/* harmony import */ var _utils_aspect__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(32598);
|
|
103086
103110
|
var _excluded = ["form", "initialValues", "initialRequest", "scope", "context", "components", "onChange", "onChangeType", "onSubmit", "onSubmitFailed", "onInitialComplete", "className", "validateFirst", "schema", "children"];
|
|
103087
103111
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
103088
103112
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -103105,7 +103129,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
103105
103129
|
|
|
103106
103130
|
|
|
103107
103131
|
|
|
103108
|
-
|
|
103109
103132
|
|
|
103110
103133
|
(0,_formily_core__WEBPACK_IMPORTED_MODULE_2__.registerValidateLocale)(_locales_validate__WEBPACK_IMPORTED_MODULE_16__/* ["default"] */ .Z);
|
|
103111
103134
|
var formilyComponents = {
|
|
@@ -103236,7 +103259,7 @@ ProForm.defaultProps = {
|
|
|
103236
103259
|
breakpoints: true,
|
|
103237
103260
|
labelAlign: 'left'
|
|
103238
103261
|
};
|
|
103239
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (
|
|
103262
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ProForm);
|
|
103240
103263
|
|
|
103241
103264
|
/***/ }),
|
|
103242
103265
|
|
|
@@ -105415,6 +105438,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105415
105438
|
/* harmony export */ "CardContainer": () => (/* reexport safe */ _card__WEBPACK_IMPORTED_MODULE_1__._L),
|
|
105416
105439
|
/* harmony export */ "ComponentConfiguratorMap": () => (/* reexport safe */ _nocode__WEBPACK_IMPORTED_MODULE_14__.ComponentConfiguratorMap),
|
|
105417
105440
|
/* harmony export */ "DEFAULT_LANG": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.Hj),
|
|
105441
|
+
/* harmony export */ "DeepModifier": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.fU),
|
|
105418
105442
|
/* harmony export */ "EditableContainer": () => (/* reexport safe */ _page_container__WEBPACK_IMPORTED_MODULE_6__.OP),
|
|
105419
105443
|
/* harmony export */ "Ellipsis": () => (/* reexport safe */ _field__WEBPACK_IMPORTED_MODULE_2__.mH),
|
|
105420
105444
|
/* harmony export */ "EmptyContent": () => (/* reexport safe */ _field__WEBPACK_IMPORTED_MODULE_2__.z1),
|
|
@@ -105469,6 +105493,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105469
105493
|
/* harmony export */ "REGION_ID_SHORT": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.Ye),
|
|
105470
105494
|
/* harmony export */ "RESOURCE_GROUP_ID": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.BV),
|
|
105471
105495
|
/* harmony export */ "RESOURCE_GROUP_ID_SHORT": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.Vy),
|
|
105496
|
+
/* harmony export */ "SafeDeepModifier": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.jr),
|
|
105497
|
+
/* harmony export */ "SafeForkResult": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.uJ),
|
|
105472
105498
|
/* harmony export */ "Section": () => (/* reexport safe */ _page_container__WEBPACK_IMPORTED_MODULE_6__.$0),
|
|
105473
105499
|
/* harmony export */ "SimpleFilter": () => (/* reexport safe */ _form__WEBPACK_IMPORTED_MODULE_3__.aT),
|
|
105474
105500
|
/* harmony export */ "TERRITORY": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.jQ),
|
|
@@ -105607,6 +105633,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105607
105633
|
/* harmony export */ "ruleCreator": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.r$),
|
|
105608
105634
|
/* harmony export */ "runInterval": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.Zp),
|
|
105609
105635
|
/* harmony export */ "safeDecodeURIComponent": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.eC),
|
|
105636
|
+
/* harmony export */ "safeDeepFork": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.IA),
|
|
105637
|
+
/* harmony export */ "safeDeepModify": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.O6),
|
|
105610
105638
|
/* harmony export */ "safeJsonParse": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.D6),
|
|
105611
105639
|
/* harmony export */ "safeJsonStringify": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.u4),
|
|
105612
105640
|
/* harmony export */ "setCookie": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.S$),
|
|
@@ -105642,9 +105670,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
105642
105670
|
/* harmony export */ "useForm": () => (/* reexport safe */ _form__WEBPACK_IMPORTED_MODULE_3__.cI),
|
|
105643
105671
|
/* harmony export */ "usePageContainer": () => (/* reexport safe */ _page_container__WEBPACK_IMPORTED_MODULE_6__.Oy),
|
|
105644
105672
|
/* harmony export */ "usePrefixCls": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.F8),
|
|
105645
|
-
/* harmony export */ "useReactHistory": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.xg),
|
|
105646
105673
|
/* harmony export */ "useRealHistory": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.iw),
|
|
105647
105674
|
/* harmony export */ "useRequest": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.QT),
|
|
105675
|
+
/* harmony export */ "useRouterHistory": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.k0),
|
|
105648
105676
|
/* harmony export */ "utils": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_10__.ZP),
|
|
105649
105677
|
/* harmony export */ "version": () => (/* binding */ version)
|
|
105650
105678
|
/* harmony export */ });
|
|
@@ -105705,7 +105733,7 @@ if (!((_window = window) != null && _window.TEAMIXPRO_WITHOUT_ICON)) {
|
|
|
105705
105733
|
|
|
105706
105734
|
|
|
105707
105735
|
|
|
105708
|
-
var version = '1.5.
|
|
105736
|
+
var version = '1.5.52';
|
|
105709
105737
|
|
|
105710
105738
|
// By TeamixTest
|
|
105711
105739
|
window.postMessage({
|
|
@@ -108623,7 +108651,7 @@ var ProPageHeader = function ProPageHeader(props) {
|
|
|
108623
108651
|
style = props.style,
|
|
108624
108652
|
tabs = props.tabs,
|
|
108625
108653
|
others = _objectWithoutPropertiesLoose(props, _excluded3);
|
|
108626
|
-
var history = (0,_teamix_utils__WEBPACK_IMPORTED_MODULE_1__.
|
|
108654
|
+
var history = (0,_teamix_utils__WEBPACK_IMPORTED_MODULE_1__.useRouterHistory)();
|
|
108627
108655
|
var backgroundImage = image ? "url('" + image + "')" : undefined;
|
|
108628
108656
|
var showList = function showList(list) {
|
|
108629
108657
|
var _list$actions;
|
|
@@ -110816,7 +110844,7 @@ var equalColumns = function equalColumns(prevProps, nextProps) {
|
|
|
110816
110844
|
}
|
|
110817
110845
|
|
|
110818
110846
|
// 如果不是 string 类型,全部刷新
|
|
110819
|
-
if (!
|
|
110847
|
+
if (!_.isString(nextValue)) {
|
|
110820
110848
|
return false;
|
|
110821
110849
|
}
|
|
110822
110850
|
if (preValue === nextValue) {
|
|
@@ -110824,7 +110852,10 @@ var equalColumns = function equalColumns(prevProps, nextProps) {
|
|
|
110824
110852
|
}
|
|
110825
110853
|
return false;
|
|
110826
110854
|
};
|
|
110827
|
-
|
|
110855
|
+
|
|
110856
|
+
// export default React.memo(Cell, equalColumns);
|
|
110857
|
+
// 根据 columns 命中缓存策略有较多漏洞,暂时不使用 memo 优化。
|
|
110858
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Cell);
|
|
110828
110859
|
|
|
110829
110860
|
/***/ }),
|
|
110830
110861
|
|
|
@@ -112909,7 +112940,7 @@ var ToolBar = function ToolBar(props) {
|
|
|
112909
112940
|
/* harmony import */ var _teamix_hooks__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(42341);
|
|
112910
112941
|
/* harmony import */ var _utils_util__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(49618);
|
|
112911
112942
|
/* harmony import */ var _utils_processColumns__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(90807);
|
|
112912
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestConfig", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "autoRefreshProps", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "autoWidth", "fixedTableBody", "isTree", "toolBarAutoWidth", "data-teamix-spm", "switchCardView", "cardViewProps", "defaultView", "emptyProps", "bindUrlProps", "
|
|
112943
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "afterDataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestConfig", "requestWhenMount", "showPagination", "pageSizeList", "responsivePaginationType", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "autoRefreshProps", "customRequest", "filterColumnType", "defaultFilterParams", "reserveSelectedRecords", "size", "disableSelectAll", "context", "autoWidth", "fixedTableBody", "isTree", "toolBarAutoWidth", "data-teamix-spm", "switchCardView", "cardViewProps", "defaultView", "emptyProps", "bindUrlProps", "autoRedirect", "useMaxData"],
|
|
112913
112944
|
_excluded2 = ["onChange", "onPageSizeChange"];
|
|
112914
112945
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
112915
112946
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -113031,11 +113062,16 @@ var ProTable = function ProTable(props) {
|
|
|
113031
113062
|
defaultView = _props$defaultView === void 0 ? 'table' : _props$defaultView,
|
|
113032
113063
|
emptyProps = props.emptyProps,
|
|
113033
113064
|
bindUrlProps = props.bindUrlProps,
|
|
113034
|
-
bindUrl = props.bindUrl,
|
|
113035
113065
|
_props$autoRedirect = props.autoRedirect,
|
|
113036
113066
|
autoRedirect = _props$autoRedirect === void 0 ? true : _props$autoRedirect,
|
|
113037
113067
|
useMaxData = props.useMaxData,
|
|
113038
113068
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
113069
|
+
var bindUrl = props.bindUrl;
|
|
113070
|
+
var inRouter = (0,_teamix_hooks__WEBPACK_IMPORTED_MODULE_16__.useInRouter)();
|
|
113071
|
+
if (bindUrl && !inRouter) {
|
|
113072
|
+
console.warn('bindUrl 功能必须在正确的 Router 组件环境内使用。已自动关闭');
|
|
113073
|
+
bindUrl = false;
|
|
113074
|
+
}
|
|
113039
113075
|
var targetPageKey = pageKey || globalPageKey;
|
|
113040
113076
|
var targetPageSizeKey = pageSizeKey || globalPageSizeKey;
|
|
113041
113077
|
var targetFormatSort = formatSort || globalFormatSort;
|
|
@@ -116067,62 +116103,6 @@ var ProTimeline = function ProTimeline(props) {
|
|
|
116067
116103
|
ProTimeline.Item = _ProTimeLineItem__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z;
|
|
116068
116104
|
|
|
116069
116105
|
|
|
116070
|
-
/***/ }),
|
|
116071
|
-
|
|
116072
|
-
/***/ 32598:
|
|
116073
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
116074
|
-
|
|
116075
|
-
"use strict";
|
|
116076
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
116077
|
-
/* harmony export */ "b": () => (/* binding */ ProComponentAspect)
|
|
116078
|
-
/* harmony export */ });
|
|
116079
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59787);
|
|
116080
|
-
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
116081
|
-
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|
116082
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
116083
|
-
|
|
116084
|
-
function ProComponentAspect(WrapComponent, componentName) {
|
|
116085
|
-
return /*#__PURE__*/function (_React$Component) {
|
|
116086
|
-
_inheritsLoose(ProComponent, _React$Component);
|
|
116087
|
-
function ProComponent() {
|
|
116088
|
-
var _this;
|
|
116089
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
116090
|
-
args[_key] = arguments[_key];
|
|
116091
|
-
}
|
|
116092
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
116093
|
-
_this.state = {
|
|
116094
|
-
name: 'alien'
|
|
116095
|
-
};
|
|
116096
|
-
return _this;
|
|
116097
|
-
}
|
|
116098
|
-
var _proto = ProComponent.prototype;
|
|
116099
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
116100
|
-
// @ts-ignore
|
|
116101
|
-
if (!!window.ProComponentBeforeAspect) {
|
|
116102
|
-
// @ts-ignore
|
|
116103
|
-
if (window.ProComponentBeforeAspectDebugger) {
|
|
116104
|
-
console.log('HOC', componentName);
|
|
116105
|
-
console.log('Props', this.props);
|
|
116106
|
-
}
|
|
116107
|
-
}
|
|
116108
|
-
};
|
|
116109
|
-
_proto.render = function render() {
|
|
116110
|
-
// @ts-ignore
|
|
116111
|
-
if (window.ProComponentBeforeAspect) {
|
|
116112
|
-
// @ts-ignore
|
|
116113
|
-
var _props = window.ProComponentBeforeAspect == null ? void 0 : window.ProComponentBeforeAspect(componentName, this.props);
|
|
116114
|
-
// @ts-ignore
|
|
116115
|
-
if (window.ProComponentBeforeAspectDebugger) {
|
|
116116
|
-
console.log('NewProps', _props);
|
|
116117
|
-
}
|
|
116118
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(WrapComponent, _props);
|
|
116119
|
-
}
|
|
116120
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(WrapComponent, this.props);
|
|
116121
|
-
};
|
|
116122
|
-
return ProComponent;
|
|
116123
|
-
}((react__WEBPACK_IMPORTED_MODULE_0___default().Component));
|
|
116124
|
-
}
|
|
116125
|
-
|
|
116126
116106
|
/***/ }),
|
|
116127
116107
|
|
|
116128
116108
|
/***/ 28570:
|
|
@@ -116165,6 +116145,7 @@ function ProComponentAspect(WrapComponent, componentName) {
|
|
|
116165
116145
|
/* harmony export */ "Hj": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.DEFAULT_LANG),
|
|
116166
116146
|
/* harmony export */ "Hl": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.updateGlobalConfig),
|
|
116167
116147
|
/* harmony export */ "Hw": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.CURRENT_REGION_ID),
|
|
116148
|
+
/* harmony export */ "IA": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.safeDeepFork),
|
|
116168
116149
|
/* harmony export */ "Iz": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.isPresetBackgroundColor),
|
|
116169
116150
|
/* harmony export */ "J1": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.setTerritory),
|
|
116170
116151
|
/* harmony export */ "JB": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.setHistory),
|
|
@@ -116182,6 +116163,7 @@ function ProComponentAspect(WrapComponent, componentName) {
|
|
|
116182
116163
|
/* harmony export */ "Mk": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.recordAppLoadedTime),
|
|
116183
116164
|
/* harmony export */ "Mn": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.registerCustomContext),
|
|
116184
116165
|
/* harmony export */ "Nx": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.mapKeyValue),
|
|
116166
|
+
/* harmony export */ "O6": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.safeDeepModify),
|
|
116185
116167
|
/* harmony export */ "OW": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.generateIncreasingLabel),
|
|
116186
116168
|
/* harmony export */ "Oh": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.stringifyQuery),
|
|
116187
116169
|
/* harmony export */ "Oz": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.brandColorInfo),
|
|
@@ -116234,6 +116216,7 @@ function ProComponentAspect(WrapComponent, componentName) {
|
|
|
116234
116216
|
/* harmony export */ "eC": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.safeDecodeURIComponent),
|
|
116235
116217
|
/* harmony export */ "ej": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.getCookie),
|
|
116236
116218
|
/* harmony export */ "fK": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.flattenTree),
|
|
116219
|
+
/* harmony export */ "fU": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.DeepModifier),
|
|
116237
116220
|
/* harmony export */ "fb": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.isUsable),
|
|
116238
116221
|
/* harmony export */ "g1": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.CURRENT_ROLE_ID),
|
|
116239
116222
|
/* harmony export */ "h2": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.getBorderColorClassName),
|
|
@@ -116247,6 +116230,8 @@ function ProComponentAspect(WrapComponent, componentName) {
|
|
|
116247
116230
|
/* harmony export */ "jM": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.getBackgroundColorClassName),
|
|
116248
116231
|
/* harmony export */ "jQ": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.TERRITORY),
|
|
116249
116232
|
/* harmony export */ "jq": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.REGION_ID),
|
|
116233
|
+
/* harmony export */ "jr": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.SafeDeepModifier),
|
|
116234
|
+
/* harmony export */ "k0": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.useRouterHistory),
|
|
116250
116235
|
/* harmony export */ "k6": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.setFeatureGetter),
|
|
116251
116236
|
/* harmony export */ "kB": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.readableNumber),
|
|
116252
116237
|
/* harmony export */ "kR": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.readableBytes),
|
|
@@ -116276,6 +116261,7 @@ function ProComponentAspect(WrapComponent, componentName) {
|
|
|
116276
116261
|
/* harmony export */ "t_": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.setSessionStorage),
|
|
116277
116262
|
/* harmony export */ "u4": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.safeJsonStringify),
|
|
116278
116263
|
/* harmony export */ "uD": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.isWeakSet),
|
|
116264
|
+
/* harmony export */ "uJ": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.SafeForkResult),
|
|
116279
116265
|
/* harmony export */ "vZ": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.isReactElement),
|
|
116280
116266
|
/* harmony export */ "vc": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.dateFormat),
|
|
116281
116267
|
/* harmony export */ "vm": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.ALIYUN_THEME),
|
|
@@ -116287,7 +116273,6 @@ function ProComponentAspect(WrapComponent, componentName) {
|
|
|
116287
116273
|
/* harmony export */ "wz": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.autoWidthBySpace),
|
|
116288
116274
|
/* harmony export */ "xL": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.getSourceLocale),
|
|
116289
116275
|
/* harmony export */ "xZ": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.INTERNET_DOMAIN),
|
|
116290
|
-
/* harmony export */ "xg": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.useReactHistory),
|
|
116291
116276
|
/* harmony export */ "yD": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.setLocalStorage),
|
|
116292
116277
|
/* harmony export */ "yI": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.cls),
|
|
116293
116278
|
/* harmony export */ "yn": () => (/* reexport safe */ _teamix_utils__WEBPACK_IMPORTED_MODULE_0__.isWeakMap),
|
|
@@ -116641,12 +116626,14 @@ function getFoldDateFormat(date, type) {
|
|
|
116641
116626
|
/* harmony export */ "H6": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.H6),
|
|
116642
116627
|
/* harmony export */ "HG": () => (/* reexport safe */ _validator__WEBPACK_IMPORTED_MODULE_8__.HG),
|
|
116643
116628
|
/* harmony export */ "Hf": () => (/* reexport safe */ _date__WEBPACK_IMPORTED_MODULE_0__.Hf),
|
|
116629
|
+
/* harmony export */ "IA": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.IA),
|
|
116644
116630
|
/* harmony export */ "JB": () => (/* reexport safe */ _path__WEBPACK_IMPORTED_MODULE_4__.JB),
|
|
116645
116631
|
/* harmony export */ "JY": () => (/* reexport safe */ _type__WEBPACK_IMPORTED_MODULE_7__.JY),
|
|
116646
116632
|
/* harmony export */ "Kj": () => (/* reexport safe */ _type__WEBPACK_IMPORTED_MODULE_7__.Kj),
|
|
116647
116633
|
/* harmony export */ "LF": () => (/* reexport safe */ _request__WEBPACK_IMPORTED_MODULE_5__.LF),
|
|
116648
116634
|
/* harmony export */ "LQ": () => (/* reexport safe */ _type__WEBPACK_IMPORTED_MODULE_7__.LQ),
|
|
116649
116635
|
/* harmony export */ "Nx": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.Nx),
|
|
116636
|
+
/* harmony export */ "O6": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.O6),
|
|
116650
116637
|
/* harmony export */ "Oh": () => (/* reexport safe */ _path__WEBPACK_IMPORTED_MODULE_4__.Oh),
|
|
116651
116638
|
/* harmony export */ "QT": () => (/* reexport safe */ _request__WEBPACK_IMPORTED_MODULE_5__.QT),
|
|
116652
116639
|
/* harmony export */ "RH": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.RH),
|
|
@@ -116675,12 +116662,15 @@ function getFoldDateFormat(date, type) {
|
|
|
116675
116662
|
/* harmony export */ "e9": () => (/* reexport safe */ _type__WEBPACK_IMPORTED_MODULE_7__.e9),
|
|
116676
116663
|
/* harmony export */ "ej": () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_6__.ej),
|
|
116677
116664
|
/* harmony export */ "fK": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.fK),
|
|
116665
|
+
/* harmony export */ "fU": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.fU),
|
|
116678
116666
|
/* harmony export */ "fb": () => (/* reexport safe */ _type__WEBPACK_IMPORTED_MODULE_7__.fb),
|
|
116679
116667
|
/* harmony export */ "h6": () => (/* reexport safe */ _validator__WEBPACK_IMPORTED_MODULE_8__.h6),
|
|
116680
116668
|
/* harmony export */ "hF": () => (/* reexport safe */ _intelligent__WEBPACK_IMPORTED_MODULE_1__.h),
|
|
116681
116669
|
/* harmony export */ "hS": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.hS),
|
|
116682
116670
|
/* harmony export */ "iF": () => (/* reexport safe */ _path__WEBPACK_IMPORTED_MODULE_4__.iF),
|
|
116683
116671
|
/* harmony export */ "iw": () => (/* reexport safe */ _useRealHistory__WEBPACK_IMPORTED_MODULE_9__.i),
|
|
116672
|
+
/* harmony export */ "jr": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.jr),
|
|
116673
|
+
/* harmony export */ "k0": () => (/* reexport safe */ _useRouterHistory__WEBPACK_IMPORTED_MODULE_10__.k),
|
|
116684
116674
|
/* harmony export */ "mB": () => (/* reexport safe */ _path__WEBPACK_IMPORTED_MODULE_4__.mB),
|
|
116685
116675
|
/* harmony export */ "mh": () => (/* reexport safe */ _date__WEBPACK_IMPORTED_MODULE_0__.mh),
|
|
116686
116676
|
/* harmony export */ "oD": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.oD),
|
|
@@ -116694,10 +116684,10 @@ function getFoldDateFormat(date, type) {
|
|
|
116694
116684
|
/* harmony export */ "tV": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.tV),
|
|
116695
116685
|
/* harmony export */ "t_": () => (/* reexport safe */ _store__WEBPACK_IMPORTED_MODULE_6__.t_),
|
|
116696
116686
|
/* harmony export */ "uD": () => (/* reexport safe */ _type__WEBPACK_IMPORTED_MODULE_7__.uD),
|
|
116687
|
+
/* harmony export */ "uJ": () => (/* reexport safe */ _lib__WEBPACK_IMPORTED_MODULE_2__.uJ),
|
|
116697
116688
|
/* harmony export */ "vZ": () => (/* reexport safe */ _type__WEBPACK_IMPORTED_MODULE_7__.vZ),
|
|
116698
116689
|
/* harmony export */ "vc": () => (/* reexport safe */ _date__WEBPACK_IMPORTED_MODULE_0__.vc),
|
|
116699
116690
|
/* harmony export */ "wz": () => (/* reexport safe */ _intelligent__WEBPACK_IMPORTED_MODULE_1__.w),
|
|
116700
|
-
/* harmony export */ "xg": () => (/* reexport safe */ _useReactHistory__WEBPACK_IMPORTED_MODULE_10__.R),
|
|
116701
116691
|
/* harmony export */ "yn": () => (/* reexport safe */ _type__WEBPACK_IMPORTED_MODULE_7__.yn)
|
|
116702
116692
|
/* harmony export */ });
|
|
116703
116693
|
/* harmony import */ var _date__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(97144);
|
|
@@ -116710,7 +116700,7 @@ function getFoldDateFormat(date, type) {
|
|
|
116710
116700
|
/* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(64015);
|
|
116711
116701
|
/* harmony import */ var _validator__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(58726);
|
|
116712
116702
|
/* harmony import */ var _useRealHistory__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(20109);
|
|
116713
|
-
/* harmony import */ var
|
|
116703
|
+
/* harmony import */ var _useRouterHistory__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(45001);
|
|
116714
116704
|
|
|
116715
116705
|
|
|
116716
116706
|
|
|
@@ -117199,7 +117189,9 @@ var getValueByValue = function getValueByValue(array, inputValue, keyMap) {
|
|
|
117199
117189
|
/* harmony export */ "Cc": () => (/* reexport safe */ _getValidValues__WEBPACK_IMPORTED_MODULE_2__.Z),
|
|
117200
117190
|
/* harmony export */ "Ef": () => (/* reexport safe */ _tree__WEBPACK_IMPORTED_MODULE_6__.Ef),
|
|
117201
117191
|
/* harmony export */ "H6": () => (/* reexport safe */ _pickProps__WEBPACK_IMPORTED_MODULE_10__.Z),
|
|
117192
|
+
/* harmony export */ "IA": () => (/* reexport safe */ _safeDeepFork__WEBPACK_IMPORTED_MODULE_12__.Z),
|
|
117202
117193
|
/* harmony export */ "Nx": () => (/* reexport safe */ _mapKeyValue__WEBPACK_IMPORTED_MODULE_5__.N),
|
|
117194
|
+
/* harmony export */ "O6": () => (/* reexport safe */ _safeDeepModify__WEBPACK_IMPORTED_MODULE_11__.Z),
|
|
117203
117195
|
/* harmony export */ "RH": () => (/* reexport safe */ _deepMerge__WEBPACK_IMPORTED_MODULE_8__.Z),
|
|
117204
117196
|
/* harmony export */ "Sz": () => (/* reexport safe */ _tree__WEBPACK_IMPORTED_MODULE_6__.Sz),
|
|
117205
117197
|
/* harmony export */ "TQ": () => (/* reexport safe */ _tree__WEBPACK_IMPORTED_MODULE_6__.TQ),
|
|
@@ -117208,9 +117200,12 @@ var getValueByValue = function getValueByValue(array, inputValue, keyMap) {
|
|
|
117208
117200
|
/* harmony export */ "_": () => (/* reexport default from dynamic */ lodash__WEBPACK_IMPORTED_MODULE_0___default.a),
|
|
117209
117201
|
/* harmony export */ "cd": () => (/* reexport safe */ _getTargetValue__WEBPACK_IMPORTED_MODULE_3__.ZP),
|
|
117210
117202
|
/* harmony export */ "fK": () => (/* reexport safe */ _tree__WEBPACK_IMPORTED_MODULE_6__.fK),
|
|
117203
|
+
/* harmony export */ "fU": () => (/* reexport safe */ _safeDeepFork__WEBPACK_IMPORTED_MODULE_12__.DeepModifier),
|
|
117211
117204
|
/* harmony export */ "hS": () => (/* reexport safe */ _getDeepValue__WEBPACK_IMPORTED_MODULE_9__.Z),
|
|
117205
|
+
/* harmony export */ "jr": () => (/* reexport safe */ _safeDeepFork__WEBPACK_IMPORTED_MODULE_12__.SafeDeepModifier),
|
|
117212
117206
|
/* harmony export */ "oD": () => (/* reexport safe */ _tree__WEBPACK_IMPORTED_MODULE_6__.oD),
|
|
117213
|
-
/* harmony export */ "tV": () => (/* reexport safe */ _test__WEBPACK_IMPORTED_MODULE_7__.t)
|
|
117207
|
+
/* harmony export */ "tV": () => (/* reexport safe */ _test__WEBPACK_IMPORTED_MODULE_7__.t),
|
|
117208
|
+
/* harmony export */ "uJ": () => (/* reexport safe */ _safeDeepFork__WEBPACK_IMPORTED_MODULE_12__.SafeForkResult)
|
|
117214
117209
|
/* harmony export */ });
|
|
117215
117210
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51554);
|
|
117216
117211
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -117225,6 +117220,10 @@ var getValueByValue = function getValueByValue(array, inputValue, keyMap) {
|
|
|
117225
117220
|
/* harmony import */ var _tree__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(58286);
|
|
117226
117221
|
/* harmony import */ var _test__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(16583);
|
|
117227
117222
|
/* harmony import */ var _pickProps__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(26113);
|
|
117223
|
+
/* harmony import */ var _safeDeepModify__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(22504);
|
|
117224
|
+
/* harmony import */ var _safeDeepFork__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(91368);
|
|
117225
|
+
|
|
117226
|
+
|
|
117228
117227
|
|
|
117229
117228
|
|
|
117230
117229
|
|
|
@@ -117338,6 +117337,79 @@ function pickProps(holdProps, props) {
|
|
|
117338
117337
|
|
|
117339
117338
|
/***/ }),
|
|
117340
117339
|
|
|
117340
|
+
/***/ 91368:
|
|
117341
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
117342
|
+
|
|
117343
|
+
"use strict";
|
|
117344
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
117345
|
+
/* harmony export */ "Z": () => (/* binding */ safeDeepFork)
|
|
117346
|
+
/* harmony export */ });
|
|
117347
|
+
/* harmony import */ var immer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(93513);
|
|
117348
|
+
|
|
117349
|
+
/**
|
|
117350
|
+
* @param origObj 原始对象
|
|
117351
|
+
* @returns 一个对象,包含 get 和 set 两个方法。get 方法返回修改过的新对象(不保证和原对象不相等),set 方法接受一个 modifier 函数:该函数的参数是一个 draft 对象,可以直接修改 draft 对象。set 方法也返回经过修改的新的对象。原始对象始终不变。注意,你不应当储存或修改 get() 的返回值。
|
|
117352
|
+
* @example
|
|
117353
|
+
* const obj = { a: { b: 0 } };
|
|
117354
|
+
* const { get: getX, set: setX } = safeDeepFork(obj);
|
|
117355
|
+
* setX(d => { d.a.b = 1 });
|
|
117356
|
+
* console.log(obj.a.b); // 0
|
|
117357
|
+
* console.log(getX().a.b); // 1
|
|
117358
|
+
*/
|
|
117359
|
+
function safeDeepFork(origObj) {
|
|
117360
|
+
var newObj = (0,immer__WEBPACK_IMPORTED_MODULE_0__/* .produce */ .Uy)(origObj, function (draft) {
|
|
117361
|
+
return draft;
|
|
117362
|
+
});
|
|
117363
|
+
var set = function set(modifier) {
|
|
117364
|
+
var safeModifier = function safeModifier(draft) {
|
|
117365
|
+
modifier(draft);
|
|
117366
|
+
// returns undefined to prevent immer from getting confused
|
|
117367
|
+
};
|
|
117368
|
+
|
|
117369
|
+
newObj = (0,immer__WEBPACK_IMPORTED_MODULE_0__/* .produce */ .Uy)(newObj, safeModifier);
|
|
117370
|
+
return newObj;
|
|
117371
|
+
};
|
|
117372
|
+
return {
|
|
117373
|
+
// 使用显式的 get 函数而非隐式的 getter,避免有人闲的没事改 getter 返回值然后撞上 bug
|
|
117374
|
+
get: function get() {
|
|
117375
|
+
return newObj;
|
|
117376
|
+
},
|
|
117377
|
+
set: set
|
|
117378
|
+
};
|
|
117379
|
+
}
|
|
117380
|
+
|
|
117381
|
+
/***/ }),
|
|
117382
|
+
|
|
117383
|
+
/***/ 22504:
|
|
117384
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
117385
|
+
|
|
117386
|
+
"use strict";
|
|
117387
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
117388
|
+
/* harmony export */ "Z": () => (/* binding */ safeDeepModify)
|
|
117389
|
+
/* harmony export */ });
|
|
117390
|
+
/* harmony import */ var immer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(93513);
|
|
117391
|
+
|
|
117392
|
+
|
|
117393
|
+
/**
|
|
117394
|
+
* @param modifier 传入一个函数,函数的参数是一个 draft 对象,可以直接修改 draft 对象
|
|
117395
|
+
* @returns 返回一个经过 modifier 修改的新的对象(frozen),原对象不变;如果没有传入 modifier,则返回原对象
|
|
117396
|
+
* @example
|
|
117397
|
+
* const obj = { a: { b: 0 } };
|
|
117398
|
+
* const newObj = safeDeepModify(obj, (draftObj) => { draftObj.a.b = 1; });
|
|
117399
|
+
* assert(obj.a.b === 0);
|
|
117400
|
+
* assert(newObj.a.b === 1);
|
|
117401
|
+
*/
|
|
117402
|
+
function safeDeepModify(obj, modifier) {
|
|
117403
|
+
if (modifier) {
|
|
117404
|
+
return (0,immer__WEBPACK_IMPORTED_MODULE_0__/* .produce */ .Uy)(obj, modifier);
|
|
117405
|
+
}
|
|
117406
|
+
return (0,immer__WEBPACK_IMPORTED_MODULE_0__/* .produce */ .Uy)(obj, function (draft) {
|
|
117407
|
+
return draft;
|
|
117408
|
+
});
|
|
117409
|
+
}
|
|
117410
|
+
|
|
117411
|
+
/***/ }),
|
|
117412
|
+
|
|
117341
117413
|
/***/ 8408:
|
|
117342
117414
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
117343
117415
|
|
|
@@ -118265,12 +118337,50 @@ var isUsable = function isUsable(val) {
|
|
|
118265
118337
|
|
|
118266
118338
|
/***/ }),
|
|
118267
118339
|
|
|
118268
|
-
/***/
|
|
118340
|
+
/***/ 20109:
|
|
118341
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
118342
|
+
|
|
118343
|
+
"use strict";
|
|
118344
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
118345
|
+
/* harmony export */ "i": () => (/* binding */ useRealHistory)
|
|
118346
|
+
/* harmony export */ });
|
|
118347
|
+
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18944);
|
|
118348
|
+
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_router_dom__WEBPACK_IMPORTED_MODULE_0__);
|
|
118349
|
+
/* harmony import */ var _path_link__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4353);
|
|
118350
|
+
// 兼容 react-router-dom v5&v6,拿到真正的 history
|
|
118351
|
+
// v6 版本没有 useHistory
|
|
118352
|
+
|
|
118353
|
+
|
|
118354
|
+
var hasWarned = false;
|
|
118355
|
+
|
|
118356
|
+
/**
|
|
118357
|
+
* 在 as-layout-app 环境下,这个函数会通过 getHistory 获取到微前端服务外面的那个 history。
|
|
118358
|
+
* 请使用 useRouterHistory 来获取微前端服务 React Router 内部使用的 history
|
|
118359
|
+
*/
|
|
118360
|
+
var useRealHistory = function useRealHistory() {
|
|
118361
|
+
var history = (0,_path_link__WEBPACK_IMPORTED_MODULE_1__/* .getHistory */ .s1)();
|
|
118362
|
+
if (history === window.history) {
|
|
118363
|
+
// 说明没有全局设置 history
|
|
118364
|
+
if (react_router_dom__WEBPACK_IMPORTED_MODULE_0__.useHistory) {
|
|
118365
|
+
history = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_0__.useHistory)();
|
|
118366
|
+
}
|
|
118367
|
+
}
|
|
118368
|
+
if (!history && !hasWarned) {
|
|
118369
|
+
// 说明是 react-router-dom v6
|
|
118370
|
+
hasWarned = true;
|
|
118371
|
+
console.warn('useRealHistory: Neither useHistory nor window.history is available. Please check if you are using react-router-dom v6. Consider using useRouterHistory instead.');
|
|
118372
|
+
}
|
|
118373
|
+
return history;
|
|
118374
|
+
};
|
|
118375
|
+
|
|
118376
|
+
/***/ }),
|
|
118377
|
+
|
|
118378
|
+
/***/ 45001:
|
|
118269
118379
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
118270
118380
|
|
|
118271
118381
|
"use strict";
|
|
118272
118382
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
118273
|
-
/* harmony export */ "
|
|
118383
|
+
/* harmony export */ "k": () => (/* binding */ useRouterHistory)
|
|
118274
118384
|
/* harmony export */ });
|
|
118275
118385
|
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18944);
|
|
118276
118386
|
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_router_dom__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -118283,27 +118393,26 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
118283
118393
|
|
|
118284
118394
|
|
|
118285
118395
|
/**
|
|
118286
|
-
*
|
|
118396
|
+
* 获取当前 Router 内部使用的 history,兼容 v5 v6。注意 basename 属性仅仅在 react-router-dom v6 下才有。
|
|
118287
118397
|
*/
|
|
118288
|
-
var
|
|
118398
|
+
var useRouterHistory = function useRouterHistory() {
|
|
118289
118399
|
// 因为是要去拿 React 内部的 history,所以这里无视全局的那个 history(也就是 as-layout-app 设置的那个 history)
|
|
118290
118400
|
if (react_router_dom__WEBPACK_IMPORTED_MODULE_0__.useHistory) {
|
|
118291
|
-
// 说明是 react-router-dom v5
|
|
118401
|
+
// 说明是 react-router-dom v5。unsafe 是因为只有 v5 才有这个 API
|
|
118292
118402
|
return (0,react_router_dom__WEBPACK_IMPORTED_MODULE_0__.useHistory)();
|
|
118293
118403
|
} else {
|
|
118404
|
+
var _useContext, _useContext2;
|
|
118294
118405
|
// 说明是 react-router-dom v6 --> history v5
|
|
118295
|
-
|
|
118296
|
-
var _useContext = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(
|
|
118406
|
+
var _ref = (_useContext = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(
|
|
118297
118407
|
// @ts-ignore react-router v6
|
|
118298
|
-
react_router_dom__WEBPACK_IMPORTED_MODULE_0__.UNSAFE_LocationContext),
|
|
118299
|
-
_location =
|
|
118300
|
-
|
|
118301
|
-
var _useContext2 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(
|
|
118408
|
+
react_router_dom__WEBPACK_IMPORTED_MODULE_0__.UNSAFE_LocationContext)) != null ? _useContext : {},
|
|
118409
|
+
_location = _ref.location;
|
|
118410
|
+
var _ref2 = (_useContext2 = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(
|
|
118302
118411
|
// @ts-ignore react-router v6
|
|
118303
|
-
react_router_dom__WEBPACK_IMPORTED_MODULE_0__.UNSAFE_NavigationContext),
|
|
118304
|
-
basename =
|
|
118305
|
-
navigator =
|
|
118306
|
-
return _extends({}, _location, navigator, {
|
|
118412
|
+
react_router_dom__WEBPACK_IMPORTED_MODULE_0__.UNSAFE_NavigationContext)) != null ? _useContext2 : {},
|
|
118413
|
+
basename = _ref2.basename,
|
|
118414
|
+
navigator = _ref2.navigator;
|
|
118415
|
+
return _location === undefined || navigator === undefined ? undefined : _extends({}, _location, navigator, {
|
|
118307
118416
|
basename: basename,
|
|
118308
118417
|
goBack: function goBack() {
|
|
118309
118418
|
return navigator.back();
|
|
@@ -118325,42 +118434,6 @@ var useReactHistory = function useReactHistory() {
|
|
|
118325
118434
|
|
|
118326
118435
|
/***/ }),
|
|
118327
118436
|
|
|
118328
|
-
/***/ 20109:
|
|
118329
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
118330
|
-
|
|
118331
|
-
"use strict";
|
|
118332
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
118333
|
-
/* harmony export */ "i": () => (/* binding */ useRealHistory)
|
|
118334
|
-
/* harmony export */ });
|
|
118335
|
-
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18944);
|
|
118336
|
-
/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_router_dom__WEBPACK_IMPORTED_MODULE_0__);
|
|
118337
|
-
/* harmony import */ var _path_link__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4353);
|
|
118338
|
-
// 兼容 react-router-dom v5&v6,拿到真正的 history
|
|
118339
|
-
// v6 版本没有 useHistory
|
|
118340
|
-
|
|
118341
|
-
|
|
118342
|
-
|
|
118343
|
-
/**
|
|
118344
|
-
* 在 as-layout-app 环境下,这个函数会通过 getHistory 获取到微前端服务外面的那个 history。
|
|
118345
|
-
* 请使用 useReactHistory 来获取微前端服务 React 内部使用的 history
|
|
118346
|
-
*/
|
|
118347
|
-
var useRealHistory = function useRealHistory() {
|
|
118348
|
-
var history = (0,_path_link__WEBPACK_IMPORTED_MODULE_1__/* .getHistory */ .s1)();
|
|
118349
|
-
if (history === window.history) {
|
|
118350
|
-
// 说明没有全局设置 history
|
|
118351
|
-
if (react_router_dom__WEBPACK_IMPORTED_MODULE_0__.useHistory) {
|
|
118352
|
-
history = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_0__.useHistory)();
|
|
118353
|
-
}
|
|
118354
|
-
}
|
|
118355
|
-
if (!history) {
|
|
118356
|
-
// 说明是 react-router-dom v6
|
|
118357
|
-
console.error('useRealHistory: Neither useHistory nor window.history is available. Please check if you are using react-router-dom v6. Consider using useReactHistory instead.');
|
|
118358
|
-
}
|
|
118359
|
-
return history;
|
|
118360
|
-
};
|
|
118361
|
-
|
|
118362
|
-
/***/ }),
|
|
118363
|
-
|
|
118364
118437
|
/***/ 58726:
|
|
118365
118438
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
118366
118439
|
|
|
@@ -118596,6 +118669,7 @@ var ruleCreator = function ruleCreator(regexConfig) {
|
|
|
118596
118669
|
/* harmony export */ });
|
|
118597
118670
|
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(68029);
|
|
118598
118671
|
/* harmony import */ var _console__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(446);
|
|
118672
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
118599
118673
|
|
|
118600
118674
|
|
|
118601
118675
|
var GLOBAL_CONFIG = {
|
|
@@ -118650,7 +118724,7 @@ function updateGlobalConfig(key, value) {
|
|
|
118650
118724
|
}
|
|
118651
118725
|
default:
|
|
118652
118726
|
{
|
|
118653
|
-
GLOBAL_CONFIG[key] = value;
|
|
118727
|
+
GLOBAL_CONFIG[key] = _extends({}, GLOBAL_CONFIG[key], value);
|
|
118654
118728
|
}
|
|
118655
118729
|
}
|
|
118656
118730
|
}
|
|
@@ -121571,6 +121645,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
121571
121645
|
/* harmony export */ "CURRENT_REGION_ID": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.Hw),
|
|
121572
121646
|
/* harmony export */ "CURRENT_ROLE_ID": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.g1),
|
|
121573
121647
|
/* harmony export */ "DEFAULT_LANG": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.Hj),
|
|
121648
|
+
/* harmony export */ "DeepModifier": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.fU),
|
|
121574
121649
|
/* harmony export */ "HEADER_CSRF_TOKEN": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.wx),
|
|
121575
121650
|
/* harmony export */ "HEADER_ORGANIZATION": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.rt),
|
|
121576
121651
|
/* harmony export */ "HEADER_REGION": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.oc),
|
|
@@ -121583,6 +121658,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
121583
121658
|
/* harmony export */ "REGION_ID_SHORT": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.Ye),
|
|
121584
121659
|
/* harmony export */ "RESOURCE_GROUP_ID": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.BV),
|
|
121585
121660
|
/* harmony export */ "RESOURCE_GROUP_ID_SHORT": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.Vy),
|
|
121661
|
+
/* harmony export */ "SafeDeepModifier": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.jr),
|
|
121662
|
+
/* harmony export */ "SafeForkResult": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.uJ),
|
|
121586
121663
|
/* harmony export */ "TERRITORY": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.jQ),
|
|
121587
121664
|
/* harmony export */ "_": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__._),
|
|
121588
121665
|
/* harmony export */ "autoWidthBySpace": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.wz),
|
|
@@ -121692,6 +121769,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
121692
121769
|
/* harmony export */ "ruleCreator": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.r$),
|
|
121693
121770
|
/* harmony export */ "runInterval": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.Zp),
|
|
121694
121771
|
/* harmony export */ "safeDecodeURIComponent": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.eC),
|
|
121772
|
+
/* harmony export */ "safeDeepFork": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.IA),
|
|
121773
|
+
/* harmony export */ "safeDeepModify": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.O6),
|
|
121695
121774
|
/* harmony export */ "safeJsonParse": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.D6),
|
|
121696
121775
|
/* harmony export */ "safeJsonStringify": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.u4),
|
|
121697
121776
|
/* harmony export */ "setCookie": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.S$),
|
|
@@ -121722,9 +121801,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
121722
121801
|
/* harmony export */ "urlParamsInterceptor": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.M5),
|
|
121723
121802
|
/* harmony export */ "useFeatureRule": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.wr),
|
|
121724
121803
|
/* harmony export */ "usePrefixCls": () => (/* reexport safe */ _console__WEBPACK_IMPORTED_MODULE_2__.F8),
|
|
121725
|
-
/* harmony export */ "useReactHistory": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.xg),
|
|
121726
121804
|
/* harmony export */ "useRealHistory": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.iw),
|
|
121727
|
-
/* harmony export */ "useRequest": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.QT)
|
|
121805
|
+
/* harmony export */ "useRequest": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.QT),
|
|
121806
|
+
/* harmony export */ "useRouterHistory": () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_0__.k0)
|
|
121728
121807
|
/* harmony export */ });
|
|
121729
121808
|
/* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(68029);
|
|
121730
121809
|
/* harmony import */ var _biz__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(52691);
|
|
@@ -122520,6 +122599,1182 @@ function dequal(foo, bar) {
|
|
|
122520
122599
|
}
|
|
122521
122600
|
|
|
122522
122601
|
|
|
122602
|
+
/***/ }),
|
|
122603
|
+
|
|
122604
|
+
/***/ 93513:
|
|
122605
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
122606
|
+
|
|
122607
|
+
"use strict";
|
|
122608
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
122609
|
+
/* harmony export */ "Uy": () => (/* binding */ produce)
|
|
122610
|
+
/* harmony export */ });
|
|
122611
|
+
/* unused harmony exports Immer, applyPatches, castDraft, castImmutable, createDraft, current, enableMapSet, enablePatches, finishDraft, freeze, immerable, isDraft, isDraftable, nothing, original, produceWithPatches, setAutoFreeze, setUseStrictShallowCopy */
|
|
122612
|
+
// src/utils/env.ts
|
|
122613
|
+
var NOTHING = Symbol.for("immer-nothing");
|
|
122614
|
+
var DRAFTABLE = Symbol.for("immer-draftable");
|
|
122615
|
+
var DRAFT_STATE = Symbol.for("immer-state");
|
|
122616
|
+
|
|
122617
|
+
// src/utils/errors.ts
|
|
122618
|
+
var errors = false ? 0 : [];
|
|
122619
|
+
function die(error, ...args) {
|
|
122620
|
+
if (false) {}
|
|
122621
|
+
throw new Error(
|
|
122622
|
+
`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
|
|
122623
|
+
);
|
|
122624
|
+
}
|
|
122625
|
+
|
|
122626
|
+
// src/utils/common.ts
|
|
122627
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
122628
|
+
function isDraft(value) {
|
|
122629
|
+
return !!value && !!value[DRAFT_STATE];
|
|
122630
|
+
}
|
|
122631
|
+
function isDraftable(value) {
|
|
122632
|
+
if (!value)
|
|
122633
|
+
return false;
|
|
122634
|
+
return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value);
|
|
122635
|
+
}
|
|
122636
|
+
var objectCtorString = Object.prototype.constructor.toString();
|
|
122637
|
+
function isPlainObject(value) {
|
|
122638
|
+
if (!value || typeof value !== "object")
|
|
122639
|
+
return false;
|
|
122640
|
+
const proto = getPrototypeOf(value);
|
|
122641
|
+
if (proto === null) {
|
|
122642
|
+
return true;
|
|
122643
|
+
}
|
|
122644
|
+
const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
122645
|
+
if (Ctor === Object)
|
|
122646
|
+
return true;
|
|
122647
|
+
return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString;
|
|
122648
|
+
}
|
|
122649
|
+
function original(value) {
|
|
122650
|
+
if (!isDraft(value))
|
|
122651
|
+
die(15, value);
|
|
122652
|
+
return value[DRAFT_STATE].base_;
|
|
122653
|
+
}
|
|
122654
|
+
function each(obj, iter) {
|
|
122655
|
+
if (getArchtype(obj) === 0 /* Object */) {
|
|
122656
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
122657
|
+
iter(key, value, obj);
|
|
122658
|
+
});
|
|
122659
|
+
} else {
|
|
122660
|
+
obj.forEach((entry, index) => iter(index, entry, obj));
|
|
122661
|
+
}
|
|
122662
|
+
}
|
|
122663
|
+
function getArchtype(thing) {
|
|
122664
|
+
const state = thing[DRAFT_STATE];
|
|
122665
|
+
return state ? state.type_ : Array.isArray(thing) ? 1 /* Array */ : isMap(thing) ? 2 /* Map */ : isSet(thing) ? 3 /* Set */ : 0 /* Object */;
|
|
122666
|
+
}
|
|
122667
|
+
function has(thing, prop) {
|
|
122668
|
+
return getArchtype(thing) === 2 /* Map */ ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
|
|
122669
|
+
}
|
|
122670
|
+
function get(thing, prop) {
|
|
122671
|
+
return getArchtype(thing) === 2 /* Map */ ? thing.get(prop) : thing[prop];
|
|
122672
|
+
}
|
|
122673
|
+
function set(thing, propOrOldValue, value) {
|
|
122674
|
+
const t = getArchtype(thing);
|
|
122675
|
+
if (t === 2 /* Map */)
|
|
122676
|
+
thing.set(propOrOldValue, value);
|
|
122677
|
+
else if (t === 3 /* Set */) {
|
|
122678
|
+
thing.add(value);
|
|
122679
|
+
} else
|
|
122680
|
+
thing[propOrOldValue] = value;
|
|
122681
|
+
}
|
|
122682
|
+
function is(x, y) {
|
|
122683
|
+
if (x === y) {
|
|
122684
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
122685
|
+
} else {
|
|
122686
|
+
return x !== x && y !== y;
|
|
122687
|
+
}
|
|
122688
|
+
}
|
|
122689
|
+
function isMap(target) {
|
|
122690
|
+
return target instanceof Map;
|
|
122691
|
+
}
|
|
122692
|
+
function isSet(target) {
|
|
122693
|
+
return target instanceof Set;
|
|
122694
|
+
}
|
|
122695
|
+
function latest(state) {
|
|
122696
|
+
return state.copy_ || state.base_;
|
|
122697
|
+
}
|
|
122698
|
+
function shallowCopy(base, strict) {
|
|
122699
|
+
if (isMap(base)) {
|
|
122700
|
+
return new Map(base);
|
|
122701
|
+
}
|
|
122702
|
+
if (isSet(base)) {
|
|
122703
|
+
return new Set(base);
|
|
122704
|
+
}
|
|
122705
|
+
if (Array.isArray(base))
|
|
122706
|
+
return Array.prototype.slice.call(base);
|
|
122707
|
+
if (!strict && isPlainObject(base)) {
|
|
122708
|
+
if (!getPrototypeOf(base)) {
|
|
122709
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
122710
|
+
return Object.assign(obj, base);
|
|
122711
|
+
}
|
|
122712
|
+
return { ...base };
|
|
122713
|
+
}
|
|
122714
|
+
const descriptors = Object.getOwnPropertyDescriptors(base);
|
|
122715
|
+
delete descriptors[DRAFT_STATE];
|
|
122716
|
+
let keys = Reflect.ownKeys(descriptors);
|
|
122717
|
+
for (let i = 0; i < keys.length; i++) {
|
|
122718
|
+
const key = keys[i];
|
|
122719
|
+
const desc = descriptors[key];
|
|
122720
|
+
if (desc.writable === false) {
|
|
122721
|
+
desc.writable = true;
|
|
122722
|
+
desc.configurable = true;
|
|
122723
|
+
}
|
|
122724
|
+
if (desc.get || desc.set)
|
|
122725
|
+
descriptors[key] = {
|
|
122726
|
+
configurable: true,
|
|
122727
|
+
writable: true,
|
|
122728
|
+
// could live with !!desc.set as well here...
|
|
122729
|
+
enumerable: desc.enumerable,
|
|
122730
|
+
value: base[key]
|
|
122731
|
+
};
|
|
122732
|
+
}
|
|
122733
|
+
return Object.create(getPrototypeOf(base), descriptors);
|
|
122734
|
+
}
|
|
122735
|
+
function freeze(obj, deep = false) {
|
|
122736
|
+
if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))
|
|
122737
|
+
return obj;
|
|
122738
|
+
if (getArchtype(obj) > 1) {
|
|
122739
|
+
obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections;
|
|
122740
|
+
}
|
|
122741
|
+
Object.freeze(obj);
|
|
122742
|
+
if (deep)
|
|
122743
|
+
each(obj, (_key, value) => freeze(value, true), true);
|
|
122744
|
+
return obj;
|
|
122745
|
+
}
|
|
122746
|
+
function dontMutateFrozenCollections() {
|
|
122747
|
+
die(2);
|
|
122748
|
+
}
|
|
122749
|
+
function isFrozen(obj) {
|
|
122750
|
+
return Object.isFrozen(obj);
|
|
122751
|
+
}
|
|
122752
|
+
|
|
122753
|
+
// src/utils/plugins.ts
|
|
122754
|
+
var plugins = {};
|
|
122755
|
+
function getPlugin(pluginKey) {
|
|
122756
|
+
const plugin = plugins[pluginKey];
|
|
122757
|
+
if (!plugin) {
|
|
122758
|
+
die(0, pluginKey);
|
|
122759
|
+
}
|
|
122760
|
+
return plugin;
|
|
122761
|
+
}
|
|
122762
|
+
function loadPlugin(pluginKey, implementation) {
|
|
122763
|
+
if (!plugins[pluginKey])
|
|
122764
|
+
plugins[pluginKey] = implementation;
|
|
122765
|
+
}
|
|
122766
|
+
|
|
122767
|
+
// src/core/scope.ts
|
|
122768
|
+
var currentScope;
|
|
122769
|
+
function getCurrentScope() {
|
|
122770
|
+
return currentScope;
|
|
122771
|
+
}
|
|
122772
|
+
function createScope(parent_, immer_) {
|
|
122773
|
+
return {
|
|
122774
|
+
drafts_: [],
|
|
122775
|
+
parent_,
|
|
122776
|
+
immer_,
|
|
122777
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
122778
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
122779
|
+
canAutoFreeze_: true,
|
|
122780
|
+
unfinalizedDrafts_: 0
|
|
122781
|
+
};
|
|
122782
|
+
}
|
|
122783
|
+
function usePatchesInScope(scope, patchListener) {
|
|
122784
|
+
if (patchListener) {
|
|
122785
|
+
getPlugin("Patches");
|
|
122786
|
+
scope.patches_ = [];
|
|
122787
|
+
scope.inversePatches_ = [];
|
|
122788
|
+
scope.patchListener_ = patchListener;
|
|
122789
|
+
}
|
|
122790
|
+
}
|
|
122791
|
+
function revokeScope(scope) {
|
|
122792
|
+
leaveScope(scope);
|
|
122793
|
+
scope.drafts_.forEach(revokeDraft);
|
|
122794
|
+
scope.drafts_ = null;
|
|
122795
|
+
}
|
|
122796
|
+
function leaveScope(scope) {
|
|
122797
|
+
if (scope === currentScope) {
|
|
122798
|
+
currentScope = scope.parent_;
|
|
122799
|
+
}
|
|
122800
|
+
}
|
|
122801
|
+
function enterScope(immer2) {
|
|
122802
|
+
return currentScope = createScope(currentScope, immer2);
|
|
122803
|
+
}
|
|
122804
|
+
function revokeDraft(draft) {
|
|
122805
|
+
const state = draft[DRAFT_STATE];
|
|
122806
|
+
if (state.type_ === 0 /* Object */ || state.type_ === 1 /* Array */)
|
|
122807
|
+
state.revoke_();
|
|
122808
|
+
else
|
|
122809
|
+
state.revoked_ = true;
|
|
122810
|
+
}
|
|
122811
|
+
|
|
122812
|
+
// src/core/finalize.ts
|
|
122813
|
+
function processResult(result, scope) {
|
|
122814
|
+
scope.unfinalizedDrafts_ = scope.drafts_.length;
|
|
122815
|
+
const baseDraft = scope.drafts_[0];
|
|
122816
|
+
const isReplaced = result !== void 0 && result !== baseDraft;
|
|
122817
|
+
if (isReplaced) {
|
|
122818
|
+
if (baseDraft[DRAFT_STATE].modified_) {
|
|
122819
|
+
revokeScope(scope);
|
|
122820
|
+
die(4);
|
|
122821
|
+
}
|
|
122822
|
+
if (isDraftable(result)) {
|
|
122823
|
+
result = finalize(scope, result);
|
|
122824
|
+
if (!scope.parent_)
|
|
122825
|
+
maybeFreeze(scope, result);
|
|
122826
|
+
}
|
|
122827
|
+
if (scope.patches_) {
|
|
122828
|
+
getPlugin("Patches").generateReplacementPatches_(
|
|
122829
|
+
baseDraft[DRAFT_STATE].base_,
|
|
122830
|
+
result,
|
|
122831
|
+
scope.patches_,
|
|
122832
|
+
scope.inversePatches_
|
|
122833
|
+
);
|
|
122834
|
+
}
|
|
122835
|
+
} else {
|
|
122836
|
+
result = finalize(scope, baseDraft, []);
|
|
122837
|
+
}
|
|
122838
|
+
revokeScope(scope);
|
|
122839
|
+
if (scope.patches_) {
|
|
122840
|
+
scope.patchListener_(scope.patches_, scope.inversePatches_);
|
|
122841
|
+
}
|
|
122842
|
+
return result !== NOTHING ? result : void 0;
|
|
122843
|
+
}
|
|
122844
|
+
function finalize(rootScope, value, path) {
|
|
122845
|
+
if (isFrozen(value))
|
|
122846
|
+
return value;
|
|
122847
|
+
const state = value[DRAFT_STATE];
|
|
122848
|
+
if (!state) {
|
|
122849
|
+
each(
|
|
122850
|
+
value,
|
|
122851
|
+
(key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path),
|
|
122852
|
+
true
|
|
122853
|
+
// See #590, don't recurse into non-enumerable of non drafted objects
|
|
122854
|
+
);
|
|
122855
|
+
return value;
|
|
122856
|
+
}
|
|
122857
|
+
if (state.scope_ !== rootScope)
|
|
122858
|
+
return value;
|
|
122859
|
+
if (!state.modified_) {
|
|
122860
|
+
maybeFreeze(rootScope, state.base_, true);
|
|
122861
|
+
return state.base_;
|
|
122862
|
+
}
|
|
122863
|
+
if (!state.finalized_) {
|
|
122864
|
+
state.finalized_ = true;
|
|
122865
|
+
state.scope_.unfinalizedDrafts_--;
|
|
122866
|
+
const result = state.copy_;
|
|
122867
|
+
let resultEach = result;
|
|
122868
|
+
let isSet2 = false;
|
|
122869
|
+
if (state.type_ === 3 /* Set */) {
|
|
122870
|
+
resultEach = new Set(result);
|
|
122871
|
+
result.clear();
|
|
122872
|
+
isSet2 = true;
|
|
122873
|
+
}
|
|
122874
|
+
each(
|
|
122875
|
+
resultEach,
|
|
122876
|
+
(key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2)
|
|
122877
|
+
);
|
|
122878
|
+
maybeFreeze(rootScope, result, false);
|
|
122879
|
+
if (path && rootScope.patches_) {
|
|
122880
|
+
getPlugin("Patches").generatePatches_(
|
|
122881
|
+
state,
|
|
122882
|
+
path,
|
|
122883
|
+
rootScope.patches_,
|
|
122884
|
+
rootScope.inversePatches_
|
|
122885
|
+
);
|
|
122886
|
+
}
|
|
122887
|
+
}
|
|
122888
|
+
return state.copy_;
|
|
122889
|
+
}
|
|
122890
|
+
function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
|
|
122891
|
+
if (false)
|
|
122892
|
+
{}
|
|
122893
|
+
if (isDraft(childValue)) {
|
|
122894
|
+
const path = rootPath && parentState && parentState.type_ !== 3 /* Set */ && // Set objects are atomic since they have no keys.
|
|
122895
|
+
!has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
|
|
122896
|
+
const res = finalize(rootScope, childValue, path);
|
|
122897
|
+
set(targetObject, prop, res);
|
|
122898
|
+
if (isDraft(res)) {
|
|
122899
|
+
rootScope.canAutoFreeze_ = false;
|
|
122900
|
+
} else
|
|
122901
|
+
return;
|
|
122902
|
+
} else if (targetIsSet) {
|
|
122903
|
+
targetObject.add(childValue);
|
|
122904
|
+
}
|
|
122905
|
+
if (isDraftable(childValue) && !isFrozen(childValue)) {
|
|
122906
|
+
if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
|
|
122907
|
+
return;
|
|
122908
|
+
}
|
|
122909
|
+
finalize(rootScope, childValue);
|
|
122910
|
+
if (!parentState || !parentState.scope_.parent_)
|
|
122911
|
+
maybeFreeze(rootScope, childValue);
|
|
122912
|
+
}
|
|
122913
|
+
}
|
|
122914
|
+
function maybeFreeze(scope, value, deep = false) {
|
|
122915
|
+
if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
|
|
122916
|
+
freeze(value, deep);
|
|
122917
|
+
}
|
|
122918
|
+
}
|
|
122919
|
+
|
|
122920
|
+
// src/core/proxy.ts
|
|
122921
|
+
function createProxyProxy(base, parent) {
|
|
122922
|
+
const isArray = Array.isArray(base);
|
|
122923
|
+
const state = {
|
|
122924
|
+
type_: isArray ? 1 /* Array */ : 0 /* Object */,
|
|
122925
|
+
// Track which produce call this is associated with.
|
|
122926
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
122927
|
+
// True for both shallow and deep changes.
|
|
122928
|
+
modified_: false,
|
|
122929
|
+
// Used during finalization.
|
|
122930
|
+
finalized_: false,
|
|
122931
|
+
// Track which properties have been assigned (true) or deleted (false).
|
|
122932
|
+
assigned_: {},
|
|
122933
|
+
// The parent draft state.
|
|
122934
|
+
parent_: parent,
|
|
122935
|
+
// The base state.
|
|
122936
|
+
base_: base,
|
|
122937
|
+
// The base proxy.
|
|
122938
|
+
draft_: null,
|
|
122939
|
+
// set below
|
|
122940
|
+
// The base copy with any updated values.
|
|
122941
|
+
copy_: null,
|
|
122942
|
+
// Called by the `produce` function.
|
|
122943
|
+
revoke_: null,
|
|
122944
|
+
isManual_: false
|
|
122945
|
+
};
|
|
122946
|
+
let target = state;
|
|
122947
|
+
let traps = objectTraps;
|
|
122948
|
+
if (isArray) {
|
|
122949
|
+
target = [state];
|
|
122950
|
+
traps = arrayTraps;
|
|
122951
|
+
}
|
|
122952
|
+
const { revoke, proxy } = Proxy.revocable(target, traps);
|
|
122953
|
+
state.draft_ = proxy;
|
|
122954
|
+
state.revoke_ = revoke;
|
|
122955
|
+
return proxy;
|
|
122956
|
+
}
|
|
122957
|
+
var objectTraps = {
|
|
122958
|
+
get(state, prop) {
|
|
122959
|
+
if (prop === DRAFT_STATE)
|
|
122960
|
+
return state;
|
|
122961
|
+
const source = latest(state);
|
|
122962
|
+
if (!has(source, prop)) {
|
|
122963
|
+
return readPropFromProto(state, source, prop);
|
|
122964
|
+
}
|
|
122965
|
+
const value = source[prop];
|
|
122966
|
+
if (state.finalized_ || !isDraftable(value)) {
|
|
122967
|
+
return value;
|
|
122968
|
+
}
|
|
122969
|
+
if (value === peek(state.base_, prop)) {
|
|
122970
|
+
prepareCopy(state);
|
|
122971
|
+
return state.copy_[prop] = createProxy(value, state);
|
|
122972
|
+
}
|
|
122973
|
+
return value;
|
|
122974
|
+
},
|
|
122975
|
+
has(state, prop) {
|
|
122976
|
+
return prop in latest(state);
|
|
122977
|
+
},
|
|
122978
|
+
ownKeys(state) {
|
|
122979
|
+
return Reflect.ownKeys(latest(state));
|
|
122980
|
+
},
|
|
122981
|
+
set(state, prop, value) {
|
|
122982
|
+
const desc = getDescriptorFromProto(latest(state), prop);
|
|
122983
|
+
if (desc?.set) {
|
|
122984
|
+
desc.set.call(state.draft_, value);
|
|
122985
|
+
return true;
|
|
122986
|
+
}
|
|
122987
|
+
if (!state.modified_) {
|
|
122988
|
+
const current2 = peek(latest(state), prop);
|
|
122989
|
+
const currentState = current2?.[DRAFT_STATE];
|
|
122990
|
+
if (currentState && currentState.base_ === value) {
|
|
122991
|
+
state.copy_[prop] = value;
|
|
122992
|
+
state.assigned_[prop] = false;
|
|
122993
|
+
return true;
|
|
122994
|
+
}
|
|
122995
|
+
if (is(value, current2) && (value !== void 0 || has(state.base_, prop)))
|
|
122996
|
+
return true;
|
|
122997
|
+
prepareCopy(state);
|
|
122998
|
+
markChanged(state);
|
|
122999
|
+
}
|
|
123000
|
+
if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'
|
|
123001
|
+
(value !== void 0 || prop in state.copy_) || // special case: NaN
|
|
123002
|
+
Number.isNaN(value) && Number.isNaN(state.copy_[prop]))
|
|
123003
|
+
return true;
|
|
123004
|
+
state.copy_[prop] = value;
|
|
123005
|
+
state.assigned_[prop] = true;
|
|
123006
|
+
return true;
|
|
123007
|
+
},
|
|
123008
|
+
deleteProperty(state, prop) {
|
|
123009
|
+
if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
|
|
123010
|
+
state.assigned_[prop] = false;
|
|
123011
|
+
prepareCopy(state);
|
|
123012
|
+
markChanged(state);
|
|
123013
|
+
} else {
|
|
123014
|
+
delete state.assigned_[prop];
|
|
123015
|
+
}
|
|
123016
|
+
if (state.copy_) {
|
|
123017
|
+
delete state.copy_[prop];
|
|
123018
|
+
}
|
|
123019
|
+
return true;
|
|
123020
|
+
},
|
|
123021
|
+
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
123022
|
+
// the same guarantee in ES5 mode.
|
|
123023
|
+
getOwnPropertyDescriptor(state, prop) {
|
|
123024
|
+
const owner = latest(state);
|
|
123025
|
+
const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
123026
|
+
if (!desc)
|
|
123027
|
+
return desc;
|
|
123028
|
+
return {
|
|
123029
|
+
writable: true,
|
|
123030
|
+
configurable: state.type_ !== 1 /* Array */ || prop !== "length",
|
|
123031
|
+
enumerable: desc.enumerable,
|
|
123032
|
+
value: owner[prop]
|
|
123033
|
+
};
|
|
123034
|
+
},
|
|
123035
|
+
defineProperty() {
|
|
123036
|
+
die(11);
|
|
123037
|
+
},
|
|
123038
|
+
getPrototypeOf(state) {
|
|
123039
|
+
return getPrototypeOf(state.base_);
|
|
123040
|
+
},
|
|
123041
|
+
setPrototypeOf() {
|
|
123042
|
+
die(12);
|
|
123043
|
+
}
|
|
123044
|
+
};
|
|
123045
|
+
var arrayTraps = {};
|
|
123046
|
+
each(objectTraps, (key, fn) => {
|
|
123047
|
+
arrayTraps[key] = function() {
|
|
123048
|
+
arguments[0] = arguments[0][0];
|
|
123049
|
+
return fn.apply(this, arguments);
|
|
123050
|
+
};
|
|
123051
|
+
});
|
|
123052
|
+
arrayTraps.deleteProperty = function(state, prop) {
|
|
123053
|
+
if (false)
|
|
123054
|
+
{}
|
|
123055
|
+
return arrayTraps.set.call(this, state, prop, void 0);
|
|
123056
|
+
};
|
|
123057
|
+
arrayTraps.set = function(state, prop, value) {
|
|
123058
|
+
if (false)
|
|
123059
|
+
{}
|
|
123060
|
+
return objectTraps.set.call(this, state[0], prop, value, state[0]);
|
|
123061
|
+
};
|
|
123062
|
+
function peek(draft, prop) {
|
|
123063
|
+
const state = draft[DRAFT_STATE];
|
|
123064
|
+
const source = state ? latest(state) : draft;
|
|
123065
|
+
return source[prop];
|
|
123066
|
+
}
|
|
123067
|
+
function readPropFromProto(state, source, prop) {
|
|
123068
|
+
const desc = getDescriptorFromProto(source, prop);
|
|
123069
|
+
return desc ? `value` in desc ? desc.value : (
|
|
123070
|
+
// This is a very special case, if the prop is a getter defined by the
|
|
123071
|
+
// prototype, we should invoke it with the draft as context!
|
|
123072
|
+
desc.get?.call(state.draft_)
|
|
123073
|
+
) : void 0;
|
|
123074
|
+
}
|
|
123075
|
+
function getDescriptorFromProto(source, prop) {
|
|
123076
|
+
if (!(prop in source))
|
|
123077
|
+
return void 0;
|
|
123078
|
+
let proto = getPrototypeOf(source);
|
|
123079
|
+
while (proto) {
|
|
123080
|
+
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
123081
|
+
if (desc)
|
|
123082
|
+
return desc;
|
|
123083
|
+
proto = getPrototypeOf(proto);
|
|
123084
|
+
}
|
|
123085
|
+
return void 0;
|
|
123086
|
+
}
|
|
123087
|
+
function markChanged(state) {
|
|
123088
|
+
if (!state.modified_) {
|
|
123089
|
+
state.modified_ = true;
|
|
123090
|
+
if (state.parent_) {
|
|
123091
|
+
markChanged(state.parent_);
|
|
123092
|
+
}
|
|
123093
|
+
}
|
|
123094
|
+
}
|
|
123095
|
+
function prepareCopy(state) {
|
|
123096
|
+
if (!state.copy_) {
|
|
123097
|
+
state.copy_ = shallowCopy(
|
|
123098
|
+
state.base_,
|
|
123099
|
+
state.scope_.immer_.useStrictShallowCopy_
|
|
123100
|
+
);
|
|
123101
|
+
}
|
|
123102
|
+
}
|
|
123103
|
+
|
|
123104
|
+
// src/core/immerClass.ts
|
|
123105
|
+
var Immer2 = class {
|
|
123106
|
+
constructor(config) {
|
|
123107
|
+
this.autoFreeze_ = true;
|
|
123108
|
+
this.useStrictShallowCopy_ = false;
|
|
123109
|
+
/**
|
|
123110
|
+
* The `produce` function takes a value and a "recipe function" (whose
|
|
123111
|
+
* return value often depends on the base state). The recipe function is
|
|
123112
|
+
* free to mutate its first argument however it wants. All mutations are
|
|
123113
|
+
* only ever applied to a __copy__ of the base state.
|
|
123114
|
+
*
|
|
123115
|
+
* Pass only a function to create a "curried producer" which relieves you
|
|
123116
|
+
* from passing the recipe function every time.
|
|
123117
|
+
*
|
|
123118
|
+
* Only plain objects and arrays are made mutable. All other objects are
|
|
123119
|
+
* considered uncopyable.
|
|
123120
|
+
*
|
|
123121
|
+
* Note: This function is __bound__ to its `Immer` instance.
|
|
123122
|
+
*
|
|
123123
|
+
* @param {any} base - the initial state
|
|
123124
|
+
* @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified
|
|
123125
|
+
* @param {Function} patchListener - optional function that will be called with all the patches produced here
|
|
123126
|
+
* @returns {any} a new state, or the initial state if nothing was modified
|
|
123127
|
+
*/
|
|
123128
|
+
this.produce = (base, recipe, patchListener) => {
|
|
123129
|
+
if (typeof base === "function" && typeof recipe !== "function") {
|
|
123130
|
+
const defaultBase = recipe;
|
|
123131
|
+
recipe = base;
|
|
123132
|
+
const self = this;
|
|
123133
|
+
return function curriedProduce(base2 = defaultBase, ...args) {
|
|
123134
|
+
return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
|
|
123135
|
+
};
|
|
123136
|
+
}
|
|
123137
|
+
if (typeof recipe !== "function")
|
|
123138
|
+
die(6);
|
|
123139
|
+
if (patchListener !== void 0 && typeof patchListener !== "function")
|
|
123140
|
+
die(7);
|
|
123141
|
+
let result;
|
|
123142
|
+
if (isDraftable(base)) {
|
|
123143
|
+
const scope = enterScope(this);
|
|
123144
|
+
const proxy = createProxy(base, void 0);
|
|
123145
|
+
let hasError = true;
|
|
123146
|
+
try {
|
|
123147
|
+
result = recipe(proxy);
|
|
123148
|
+
hasError = false;
|
|
123149
|
+
} finally {
|
|
123150
|
+
if (hasError)
|
|
123151
|
+
revokeScope(scope);
|
|
123152
|
+
else
|
|
123153
|
+
leaveScope(scope);
|
|
123154
|
+
}
|
|
123155
|
+
usePatchesInScope(scope, patchListener);
|
|
123156
|
+
return processResult(result, scope);
|
|
123157
|
+
} else if (!base || typeof base !== "object") {
|
|
123158
|
+
result = recipe(base);
|
|
123159
|
+
if (result === void 0)
|
|
123160
|
+
result = base;
|
|
123161
|
+
if (result === NOTHING)
|
|
123162
|
+
result = void 0;
|
|
123163
|
+
if (this.autoFreeze_)
|
|
123164
|
+
freeze(result, true);
|
|
123165
|
+
if (patchListener) {
|
|
123166
|
+
const p = [];
|
|
123167
|
+
const ip = [];
|
|
123168
|
+
getPlugin("Patches").generateReplacementPatches_(base, result, p, ip);
|
|
123169
|
+
patchListener(p, ip);
|
|
123170
|
+
}
|
|
123171
|
+
return result;
|
|
123172
|
+
} else
|
|
123173
|
+
die(1, base);
|
|
123174
|
+
};
|
|
123175
|
+
this.produceWithPatches = (base, recipe) => {
|
|
123176
|
+
if (typeof base === "function") {
|
|
123177
|
+
return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
|
|
123178
|
+
}
|
|
123179
|
+
let patches, inversePatches;
|
|
123180
|
+
const result = this.produce(base, recipe, (p, ip) => {
|
|
123181
|
+
patches = p;
|
|
123182
|
+
inversePatches = ip;
|
|
123183
|
+
});
|
|
123184
|
+
return [result, patches, inversePatches];
|
|
123185
|
+
};
|
|
123186
|
+
if (typeof config?.autoFreeze === "boolean")
|
|
123187
|
+
this.setAutoFreeze(config.autoFreeze);
|
|
123188
|
+
if (typeof config?.useStrictShallowCopy === "boolean")
|
|
123189
|
+
this.setUseStrictShallowCopy(config.useStrictShallowCopy);
|
|
123190
|
+
}
|
|
123191
|
+
createDraft(base) {
|
|
123192
|
+
if (!isDraftable(base))
|
|
123193
|
+
die(8);
|
|
123194
|
+
if (isDraft(base))
|
|
123195
|
+
base = current(base);
|
|
123196
|
+
const scope = enterScope(this);
|
|
123197
|
+
const proxy = createProxy(base, void 0);
|
|
123198
|
+
proxy[DRAFT_STATE].isManual_ = true;
|
|
123199
|
+
leaveScope(scope);
|
|
123200
|
+
return proxy;
|
|
123201
|
+
}
|
|
123202
|
+
finishDraft(draft, patchListener) {
|
|
123203
|
+
const state = draft && draft[DRAFT_STATE];
|
|
123204
|
+
if (!state || !state.isManual_)
|
|
123205
|
+
die(9);
|
|
123206
|
+
const { scope_: scope } = state;
|
|
123207
|
+
usePatchesInScope(scope, patchListener);
|
|
123208
|
+
return processResult(void 0, scope);
|
|
123209
|
+
}
|
|
123210
|
+
/**
|
|
123211
|
+
* Pass true to automatically freeze all copies created by Immer.
|
|
123212
|
+
*
|
|
123213
|
+
* By default, auto-freezing is enabled.
|
|
123214
|
+
*/
|
|
123215
|
+
setAutoFreeze(value) {
|
|
123216
|
+
this.autoFreeze_ = value;
|
|
123217
|
+
}
|
|
123218
|
+
/**
|
|
123219
|
+
* Pass true to enable strict shallow copy.
|
|
123220
|
+
*
|
|
123221
|
+
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
|
|
123222
|
+
*/
|
|
123223
|
+
setUseStrictShallowCopy(value) {
|
|
123224
|
+
this.useStrictShallowCopy_ = value;
|
|
123225
|
+
}
|
|
123226
|
+
applyPatches(base, patches) {
|
|
123227
|
+
let i;
|
|
123228
|
+
for (i = patches.length - 1; i >= 0; i--) {
|
|
123229
|
+
const patch = patches[i];
|
|
123230
|
+
if (patch.path.length === 0 && patch.op === "replace") {
|
|
123231
|
+
base = patch.value;
|
|
123232
|
+
break;
|
|
123233
|
+
}
|
|
123234
|
+
}
|
|
123235
|
+
if (i > -1) {
|
|
123236
|
+
patches = patches.slice(i + 1);
|
|
123237
|
+
}
|
|
123238
|
+
const applyPatchesImpl = getPlugin("Patches").applyPatches_;
|
|
123239
|
+
if (isDraft(base)) {
|
|
123240
|
+
return applyPatchesImpl(base, patches);
|
|
123241
|
+
}
|
|
123242
|
+
return this.produce(
|
|
123243
|
+
base,
|
|
123244
|
+
(draft) => applyPatchesImpl(draft, patches)
|
|
123245
|
+
);
|
|
123246
|
+
}
|
|
123247
|
+
};
|
|
123248
|
+
function createProxy(value, parent) {
|
|
123249
|
+
const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
|
|
123250
|
+
const scope = parent ? parent.scope_ : getCurrentScope();
|
|
123251
|
+
scope.drafts_.push(draft);
|
|
123252
|
+
return draft;
|
|
123253
|
+
}
|
|
123254
|
+
|
|
123255
|
+
// src/core/current.ts
|
|
123256
|
+
function current(value) {
|
|
123257
|
+
if (!isDraft(value))
|
|
123258
|
+
die(10, value);
|
|
123259
|
+
return currentImpl(value);
|
|
123260
|
+
}
|
|
123261
|
+
function currentImpl(value) {
|
|
123262
|
+
if (!isDraftable(value) || isFrozen(value))
|
|
123263
|
+
return value;
|
|
123264
|
+
const state = value[DRAFT_STATE];
|
|
123265
|
+
let copy;
|
|
123266
|
+
if (state) {
|
|
123267
|
+
if (!state.modified_)
|
|
123268
|
+
return state.base_;
|
|
123269
|
+
state.finalized_ = true;
|
|
123270
|
+
copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
|
|
123271
|
+
} else {
|
|
123272
|
+
copy = shallowCopy(value, true);
|
|
123273
|
+
}
|
|
123274
|
+
each(copy, (key, childValue) => {
|
|
123275
|
+
set(copy, key, currentImpl(childValue));
|
|
123276
|
+
});
|
|
123277
|
+
if (state) {
|
|
123278
|
+
state.finalized_ = false;
|
|
123279
|
+
}
|
|
123280
|
+
return copy;
|
|
123281
|
+
}
|
|
123282
|
+
|
|
123283
|
+
// src/plugins/patches.ts
|
|
123284
|
+
function enablePatches() {
|
|
123285
|
+
const errorOffset = 16;
|
|
123286
|
+
if (false) {}
|
|
123287
|
+
const REPLACE = "replace";
|
|
123288
|
+
const ADD = "add";
|
|
123289
|
+
const REMOVE = "remove";
|
|
123290
|
+
function generatePatches_(state, basePath, patches, inversePatches) {
|
|
123291
|
+
switch (state.type_) {
|
|
123292
|
+
case 0 /* Object */:
|
|
123293
|
+
case 2 /* Map */:
|
|
123294
|
+
return generatePatchesFromAssigned(
|
|
123295
|
+
state,
|
|
123296
|
+
basePath,
|
|
123297
|
+
patches,
|
|
123298
|
+
inversePatches
|
|
123299
|
+
);
|
|
123300
|
+
case 1 /* Array */:
|
|
123301
|
+
return generateArrayPatches(state, basePath, patches, inversePatches);
|
|
123302
|
+
case 3 /* Set */:
|
|
123303
|
+
return generateSetPatches(
|
|
123304
|
+
state,
|
|
123305
|
+
basePath,
|
|
123306
|
+
patches,
|
|
123307
|
+
inversePatches
|
|
123308
|
+
);
|
|
123309
|
+
}
|
|
123310
|
+
}
|
|
123311
|
+
function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
123312
|
+
let { base_, assigned_ } = state;
|
|
123313
|
+
let copy_ = state.copy_;
|
|
123314
|
+
if (copy_.length < base_.length) {
|
|
123315
|
+
;
|
|
123316
|
+
[base_, copy_] = [copy_, base_];
|
|
123317
|
+
[patches, inversePatches] = [inversePatches, patches];
|
|
123318
|
+
}
|
|
123319
|
+
for (let i = 0; i < base_.length; i++) {
|
|
123320
|
+
if (assigned_[i] && copy_[i] !== base_[i]) {
|
|
123321
|
+
const path = basePath.concat([i]);
|
|
123322
|
+
patches.push({
|
|
123323
|
+
op: REPLACE,
|
|
123324
|
+
path,
|
|
123325
|
+
// Need to maybe clone it, as it can in fact be the original value
|
|
123326
|
+
// due to the base/copy inversion at the start of this function
|
|
123327
|
+
value: clonePatchValueIfNeeded(copy_[i])
|
|
123328
|
+
});
|
|
123329
|
+
inversePatches.push({
|
|
123330
|
+
op: REPLACE,
|
|
123331
|
+
path,
|
|
123332
|
+
value: clonePatchValueIfNeeded(base_[i])
|
|
123333
|
+
});
|
|
123334
|
+
}
|
|
123335
|
+
}
|
|
123336
|
+
for (let i = base_.length; i < copy_.length; i++) {
|
|
123337
|
+
const path = basePath.concat([i]);
|
|
123338
|
+
patches.push({
|
|
123339
|
+
op: ADD,
|
|
123340
|
+
path,
|
|
123341
|
+
// Need to maybe clone it, as it can in fact be the original value
|
|
123342
|
+
// due to the base/copy inversion at the start of this function
|
|
123343
|
+
value: clonePatchValueIfNeeded(copy_[i])
|
|
123344
|
+
});
|
|
123345
|
+
}
|
|
123346
|
+
for (let i = copy_.length - 1; base_.length <= i; --i) {
|
|
123347
|
+
const path = basePath.concat([i]);
|
|
123348
|
+
inversePatches.push({
|
|
123349
|
+
op: REMOVE,
|
|
123350
|
+
path
|
|
123351
|
+
});
|
|
123352
|
+
}
|
|
123353
|
+
}
|
|
123354
|
+
function generatePatchesFromAssigned(state, basePath, patches, inversePatches) {
|
|
123355
|
+
const { base_, copy_ } = state;
|
|
123356
|
+
each(state.assigned_, (key, assignedValue) => {
|
|
123357
|
+
const origValue = get(base_, key);
|
|
123358
|
+
const value = get(copy_, key);
|
|
123359
|
+
const op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD;
|
|
123360
|
+
if (origValue === value && op === REPLACE)
|
|
123361
|
+
return;
|
|
123362
|
+
const path = basePath.concat(key);
|
|
123363
|
+
patches.push(op === REMOVE ? { op, path } : { op, path, value });
|
|
123364
|
+
inversePatches.push(
|
|
123365
|
+
op === ADD ? { op: REMOVE, path } : op === REMOVE ? { op: ADD, path, value: clonePatchValueIfNeeded(origValue) } : { op: REPLACE, path, value: clonePatchValueIfNeeded(origValue) }
|
|
123366
|
+
);
|
|
123367
|
+
});
|
|
123368
|
+
}
|
|
123369
|
+
function generateSetPatches(state, basePath, patches, inversePatches) {
|
|
123370
|
+
let { base_, copy_ } = state;
|
|
123371
|
+
let i = 0;
|
|
123372
|
+
base_.forEach((value) => {
|
|
123373
|
+
if (!copy_.has(value)) {
|
|
123374
|
+
const path = basePath.concat([i]);
|
|
123375
|
+
patches.push({
|
|
123376
|
+
op: REMOVE,
|
|
123377
|
+
path,
|
|
123378
|
+
value
|
|
123379
|
+
});
|
|
123380
|
+
inversePatches.unshift({
|
|
123381
|
+
op: ADD,
|
|
123382
|
+
path,
|
|
123383
|
+
value
|
|
123384
|
+
});
|
|
123385
|
+
}
|
|
123386
|
+
i++;
|
|
123387
|
+
});
|
|
123388
|
+
i = 0;
|
|
123389
|
+
copy_.forEach((value) => {
|
|
123390
|
+
if (!base_.has(value)) {
|
|
123391
|
+
const path = basePath.concat([i]);
|
|
123392
|
+
patches.push({
|
|
123393
|
+
op: ADD,
|
|
123394
|
+
path,
|
|
123395
|
+
value
|
|
123396
|
+
});
|
|
123397
|
+
inversePatches.unshift({
|
|
123398
|
+
op: REMOVE,
|
|
123399
|
+
path,
|
|
123400
|
+
value
|
|
123401
|
+
});
|
|
123402
|
+
}
|
|
123403
|
+
i++;
|
|
123404
|
+
});
|
|
123405
|
+
}
|
|
123406
|
+
function generateReplacementPatches_(baseValue, replacement, patches, inversePatches) {
|
|
123407
|
+
patches.push({
|
|
123408
|
+
op: REPLACE,
|
|
123409
|
+
path: [],
|
|
123410
|
+
value: replacement === NOTHING ? void 0 : replacement
|
|
123411
|
+
});
|
|
123412
|
+
inversePatches.push({
|
|
123413
|
+
op: REPLACE,
|
|
123414
|
+
path: [],
|
|
123415
|
+
value: baseValue
|
|
123416
|
+
});
|
|
123417
|
+
}
|
|
123418
|
+
function applyPatches_(draft, patches) {
|
|
123419
|
+
patches.forEach((patch) => {
|
|
123420
|
+
const { path, op } = patch;
|
|
123421
|
+
let base = draft;
|
|
123422
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
123423
|
+
const parentType = getArchtype(base);
|
|
123424
|
+
let p = path[i];
|
|
123425
|
+
if (typeof p !== "string" && typeof p !== "number") {
|
|
123426
|
+
p = "" + p;
|
|
123427
|
+
}
|
|
123428
|
+
if ((parentType === 0 /* Object */ || parentType === 1 /* Array */) && (p === "__proto__" || p === "constructor"))
|
|
123429
|
+
die(errorOffset + 3);
|
|
123430
|
+
if (typeof base === "function" && p === "prototype")
|
|
123431
|
+
die(errorOffset + 3);
|
|
123432
|
+
base = get(base, p);
|
|
123433
|
+
if (typeof base !== "object")
|
|
123434
|
+
die(errorOffset + 2, path.join("/"));
|
|
123435
|
+
}
|
|
123436
|
+
const type = getArchtype(base);
|
|
123437
|
+
const value = deepClonePatchValue(patch.value);
|
|
123438
|
+
const key = path[path.length - 1];
|
|
123439
|
+
switch (op) {
|
|
123440
|
+
case REPLACE:
|
|
123441
|
+
switch (type) {
|
|
123442
|
+
case 2 /* Map */:
|
|
123443
|
+
return base.set(key, value);
|
|
123444
|
+
case 3 /* Set */:
|
|
123445
|
+
die(errorOffset);
|
|
123446
|
+
default:
|
|
123447
|
+
return base[key] = value;
|
|
123448
|
+
}
|
|
123449
|
+
case ADD:
|
|
123450
|
+
switch (type) {
|
|
123451
|
+
case 1 /* Array */:
|
|
123452
|
+
return key === "-" ? base.push(value) : base.splice(key, 0, value);
|
|
123453
|
+
case 2 /* Map */:
|
|
123454
|
+
return base.set(key, value);
|
|
123455
|
+
case 3 /* Set */:
|
|
123456
|
+
return base.add(value);
|
|
123457
|
+
default:
|
|
123458
|
+
return base[key] = value;
|
|
123459
|
+
}
|
|
123460
|
+
case REMOVE:
|
|
123461
|
+
switch (type) {
|
|
123462
|
+
case 1 /* Array */:
|
|
123463
|
+
return base.splice(key, 1);
|
|
123464
|
+
case 2 /* Map */:
|
|
123465
|
+
return base.delete(key);
|
|
123466
|
+
case 3 /* Set */:
|
|
123467
|
+
return base.delete(patch.value);
|
|
123468
|
+
default:
|
|
123469
|
+
return delete base[key];
|
|
123470
|
+
}
|
|
123471
|
+
default:
|
|
123472
|
+
die(errorOffset + 1, op);
|
|
123473
|
+
}
|
|
123474
|
+
});
|
|
123475
|
+
return draft;
|
|
123476
|
+
}
|
|
123477
|
+
function deepClonePatchValue(obj) {
|
|
123478
|
+
if (!isDraftable(obj))
|
|
123479
|
+
return obj;
|
|
123480
|
+
if (Array.isArray(obj))
|
|
123481
|
+
return obj.map(deepClonePatchValue);
|
|
123482
|
+
if (isMap(obj))
|
|
123483
|
+
return new Map(
|
|
123484
|
+
Array.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])
|
|
123485
|
+
);
|
|
123486
|
+
if (isSet(obj))
|
|
123487
|
+
return new Set(Array.from(obj).map(deepClonePatchValue));
|
|
123488
|
+
const cloned = Object.create(getPrototypeOf(obj));
|
|
123489
|
+
for (const key in obj)
|
|
123490
|
+
cloned[key] = deepClonePatchValue(obj[key]);
|
|
123491
|
+
if (has(obj, DRAFTABLE))
|
|
123492
|
+
cloned[DRAFTABLE] = obj[DRAFTABLE];
|
|
123493
|
+
return cloned;
|
|
123494
|
+
}
|
|
123495
|
+
function clonePatchValueIfNeeded(obj) {
|
|
123496
|
+
if (isDraft(obj)) {
|
|
123497
|
+
return deepClonePatchValue(obj);
|
|
123498
|
+
} else
|
|
123499
|
+
return obj;
|
|
123500
|
+
}
|
|
123501
|
+
loadPlugin("Patches", {
|
|
123502
|
+
applyPatches_,
|
|
123503
|
+
generatePatches_,
|
|
123504
|
+
generateReplacementPatches_
|
|
123505
|
+
});
|
|
123506
|
+
}
|
|
123507
|
+
|
|
123508
|
+
// src/plugins/mapset.ts
|
|
123509
|
+
function enableMapSet() {
|
|
123510
|
+
class DraftMap extends Map {
|
|
123511
|
+
constructor(target, parent) {
|
|
123512
|
+
super();
|
|
123513
|
+
this[DRAFT_STATE] = {
|
|
123514
|
+
type_: 2 /* Map */,
|
|
123515
|
+
parent_: parent,
|
|
123516
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
123517
|
+
modified_: false,
|
|
123518
|
+
finalized_: false,
|
|
123519
|
+
copy_: void 0,
|
|
123520
|
+
assigned_: void 0,
|
|
123521
|
+
base_: target,
|
|
123522
|
+
draft_: this,
|
|
123523
|
+
isManual_: false,
|
|
123524
|
+
revoked_: false
|
|
123525
|
+
};
|
|
123526
|
+
}
|
|
123527
|
+
get size() {
|
|
123528
|
+
return latest(this[DRAFT_STATE]).size;
|
|
123529
|
+
}
|
|
123530
|
+
has(key) {
|
|
123531
|
+
return latest(this[DRAFT_STATE]).has(key);
|
|
123532
|
+
}
|
|
123533
|
+
set(key, value) {
|
|
123534
|
+
const state = this[DRAFT_STATE];
|
|
123535
|
+
assertUnrevoked(state);
|
|
123536
|
+
if (!latest(state).has(key) || latest(state).get(key) !== value) {
|
|
123537
|
+
prepareMapCopy(state);
|
|
123538
|
+
markChanged(state);
|
|
123539
|
+
state.assigned_.set(key, true);
|
|
123540
|
+
state.copy_.set(key, value);
|
|
123541
|
+
state.assigned_.set(key, true);
|
|
123542
|
+
}
|
|
123543
|
+
return this;
|
|
123544
|
+
}
|
|
123545
|
+
delete(key) {
|
|
123546
|
+
if (!this.has(key)) {
|
|
123547
|
+
return false;
|
|
123548
|
+
}
|
|
123549
|
+
const state = this[DRAFT_STATE];
|
|
123550
|
+
assertUnrevoked(state);
|
|
123551
|
+
prepareMapCopy(state);
|
|
123552
|
+
markChanged(state);
|
|
123553
|
+
if (state.base_.has(key)) {
|
|
123554
|
+
state.assigned_.set(key, false);
|
|
123555
|
+
} else {
|
|
123556
|
+
state.assigned_.delete(key);
|
|
123557
|
+
}
|
|
123558
|
+
state.copy_.delete(key);
|
|
123559
|
+
return true;
|
|
123560
|
+
}
|
|
123561
|
+
clear() {
|
|
123562
|
+
const state = this[DRAFT_STATE];
|
|
123563
|
+
assertUnrevoked(state);
|
|
123564
|
+
if (latest(state).size) {
|
|
123565
|
+
prepareMapCopy(state);
|
|
123566
|
+
markChanged(state);
|
|
123567
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
123568
|
+
each(state.base_, (key) => {
|
|
123569
|
+
state.assigned_.set(key, false);
|
|
123570
|
+
});
|
|
123571
|
+
state.copy_.clear();
|
|
123572
|
+
}
|
|
123573
|
+
}
|
|
123574
|
+
forEach(cb, thisArg) {
|
|
123575
|
+
const state = this[DRAFT_STATE];
|
|
123576
|
+
latest(state).forEach((_value, key, _map) => {
|
|
123577
|
+
cb.call(thisArg, this.get(key), key, this);
|
|
123578
|
+
});
|
|
123579
|
+
}
|
|
123580
|
+
get(key) {
|
|
123581
|
+
const state = this[DRAFT_STATE];
|
|
123582
|
+
assertUnrevoked(state);
|
|
123583
|
+
const value = latest(state).get(key);
|
|
123584
|
+
if (state.finalized_ || !isDraftable(value)) {
|
|
123585
|
+
return value;
|
|
123586
|
+
}
|
|
123587
|
+
if (value !== state.base_.get(key)) {
|
|
123588
|
+
return value;
|
|
123589
|
+
}
|
|
123590
|
+
const draft = createProxy(value, state);
|
|
123591
|
+
prepareMapCopy(state);
|
|
123592
|
+
state.copy_.set(key, draft);
|
|
123593
|
+
return draft;
|
|
123594
|
+
}
|
|
123595
|
+
keys() {
|
|
123596
|
+
return latest(this[DRAFT_STATE]).keys();
|
|
123597
|
+
}
|
|
123598
|
+
values() {
|
|
123599
|
+
const iterator = this.keys();
|
|
123600
|
+
return {
|
|
123601
|
+
[Symbol.iterator]: () => this.values(),
|
|
123602
|
+
next: () => {
|
|
123603
|
+
const r = iterator.next();
|
|
123604
|
+
if (r.done)
|
|
123605
|
+
return r;
|
|
123606
|
+
const value = this.get(r.value);
|
|
123607
|
+
return {
|
|
123608
|
+
done: false,
|
|
123609
|
+
value
|
|
123610
|
+
};
|
|
123611
|
+
}
|
|
123612
|
+
};
|
|
123613
|
+
}
|
|
123614
|
+
entries() {
|
|
123615
|
+
const iterator = this.keys();
|
|
123616
|
+
return {
|
|
123617
|
+
[Symbol.iterator]: () => this.entries(),
|
|
123618
|
+
next: () => {
|
|
123619
|
+
const r = iterator.next();
|
|
123620
|
+
if (r.done)
|
|
123621
|
+
return r;
|
|
123622
|
+
const value = this.get(r.value);
|
|
123623
|
+
return {
|
|
123624
|
+
done: false,
|
|
123625
|
+
value: [r.value, value]
|
|
123626
|
+
};
|
|
123627
|
+
}
|
|
123628
|
+
};
|
|
123629
|
+
}
|
|
123630
|
+
[(DRAFT_STATE, Symbol.iterator)]() {
|
|
123631
|
+
return this.entries();
|
|
123632
|
+
}
|
|
123633
|
+
}
|
|
123634
|
+
function proxyMap_(target, parent) {
|
|
123635
|
+
return new DraftMap(target, parent);
|
|
123636
|
+
}
|
|
123637
|
+
function prepareMapCopy(state) {
|
|
123638
|
+
if (!state.copy_) {
|
|
123639
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
123640
|
+
state.copy_ = new Map(state.base_);
|
|
123641
|
+
}
|
|
123642
|
+
}
|
|
123643
|
+
class DraftSet extends Set {
|
|
123644
|
+
constructor(target, parent) {
|
|
123645
|
+
super();
|
|
123646
|
+
this[DRAFT_STATE] = {
|
|
123647
|
+
type_: 3 /* Set */,
|
|
123648
|
+
parent_: parent,
|
|
123649
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
123650
|
+
modified_: false,
|
|
123651
|
+
finalized_: false,
|
|
123652
|
+
copy_: void 0,
|
|
123653
|
+
base_: target,
|
|
123654
|
+
draft_: this,
|
|
123655
|
+
drafts_: /* @__PURE__ */ new Map(),
|
|
123656
|
+
revoked_: false,
|
|
123657
|
+
isManual_: false
|
|
123658
|
+
};
|
|
123659
|
+
}
|
|
123660
|
+
get size() {
|
|
123661
|
+
return latest(this[DRAFT_STATE]).size;
|
|
123662
|
+
}
|
|
123663
|
+
has(value) {
|
|
123664
|
+
const state = this[DRAFT_STATE];
|
|
123665
|
+
assertUnrevoked(state);
|
|
123666
|
+
if (!state.copy_) {
|
|
123667
|
+
return state.base_.has(value);
|
|
123668
|
+
}
|
|
123669
|
+
if (state.copy_.has(value))
|
|
123670
|
+
return true;
|
|
123671
|
+
if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))
|
|
123672
|
+
return true;
|
|
123673
|
+
return false;
|
|
123674
|
+
}
|
|
123675
|
+
add(value) {
|
|
123676
|
+
const state = this[DRAFT_STATE];
|
|
123677
|
+
assertUnrevoked(state);
|
|
123678
|
+
if (!this.has(value)) {
|
|
123679
|
+
prepareSetCopy(state);
|
|
123680
|
+
markChanged(state);
|
|
123681
|
+
state.copy_.add(value);
|
|
123682
|
+
}
|
|
123683
|
+
return this;
|
|
123684
|
+
}
|
|
123685
|
+
delete(value) {
|
|
123686
|
+
if (!this.has(value)) {
|
|
123687
|
+
return false;
|
|
123688
|
+
}
|
|
123689
|
+
const state = this[DRAFT_STATE];
|
|
123690
|
+
assertUnrevoked(state);
|
|
123691
|
+
prepareSetCopy(state);
|
|
123692
|
+
markChanged(state);
|
|
123693
|
+
return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : (
|
|
123694
|
+
/* istanbul ignore next */
|
|
123695
|
+
false
|
|
123696
|
+
));
|
|
123697
|
+
}
|
|
123698
|
+
clear() {
|
|
123699
|
+
const state = this[DRAFT_STATE];
|
|
123700
|
+
assertUnrevoked(state);
|
|
123701
|
+
if (latest(state).size) {
|
|
123702
|
+
prepareSetCopy(state);
|
|
123703
|
+
markChanged(state);
|
|
123704
|
+
state.copy_.clear();
|
|
123705
|
+
}
|
|
123706
|
+
}
|
|
123707
|
+
values() {
|
|
123708
|
+
const state = this[DRAFT_STATE];
|
|
123709
|
+
assertUnrevoked(state);
|
|
123710
|
+
prepareSetCopy(state);
|
|
123711
|
+
return state.copy_.values();
|
|
123712
|
+
}
|
|
123713
|
+
entries() {
|
|
123714
|
+
const state = this[DRAFT_STATE];
|
|
123715
|
+
assertUnrevoked(state);
|
|
123716
|
+
prepareSetCopy(state);
|
|
123717
|
+
return state.copy_.entries();
|
|
123718
|
+
}
|
|
123719
|
+
keys() {
|
|
123720
|
+
return this.values();
|
|
123721
|
+
}
|
|
123722
|
+
[(DRAFT_STATE, Symbol.iterator)]() {
|
|
123723
|
+
return this.values();
|
|
123724
|
+
}
|
|
123725
|
+
forEach(cb, thisArg) {
|
|
123726
|
+
const iterator = this.values();
|
|
123727
|
+
let result = iterator.next();
|
|
123728
|
+
while (!result.done) {
|
|
123729
|
+
cb.call(thisArg, result.value, result.value, this);
|
|
123730
|
+
result = iterator.next();
|
|
123731
|
+
}
|
|
123732
|
+
}
|
|
123733
|
+
}
|
|
123734
|
+
function proxySet_(target, parent) {
|
|
123735
|
+
return new DraftSet(target, parent);
|
|
123736
|
+
}
|
|
123737
|
+
function prepareSetCopy(state) {
|
|
123738
|
+
if (!state.copy_) {
|
|
123739
|
+
state.copy_ = /* @__PURE__ */ new Set();
|
|
123740
|
+
state.base_.forEach((value) => {
|
|
123741
|
+
if (isDraftable(value)) {
|
|
123742
|
+
const draft = createProxy(value, state);
|
|
123743
|
+
state.drafts_.set(value, draft);
|
|
123744
|
+
state.copy_.add(draft);
|
|
123745
|
+
} else {
|
|
123746
|
+
state.copy_.add(value);
|
|
123747
|
+
}
|
|
123748
|
+
});
|
|
123749
|
+
}
|
|
123750
|
+
}
|
|
123751
|
+
function assertUnrevoked(state) {
|
|
123752
|
+
if (state.revoked_)
|
|
123753
|
+
die(3, JSON.stringify(latest(state)));
|
|
123754
|
+
}
|
|
123755
|
+
loadPlugin("MapSet", { proxyMap_, proxySet_ });
|
|
123756
|
+
}
|
|
123757
|
+
|
|
123758
|
+
// src/immer.ts
|
|
123759
|
+
var immer = new Immer2();
|
|
123760
|
+
var produce = immer.produce;
|
|
123761
|
+
var produceWithPatches = immer.produceWithPatches.bind(
|
|
123762
|
+
immer
|
|
123763
|
+
);
|
|
123764
|
+
var setAutoFreeze = immer.setAutoFreeze.bind(immer);
|
|
123765
|
+
var setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer);
|
|
123766
|
+
var applyPatches = immer.applyPatches.bind(immer);
|
|
123767
|
+
var createDraft = immer.createDraft.bind(immer);
|
|
123768
|
+
var finishDraft = immer.finishDraft.bind(immer);
|
|
123769
|
+
function castDraft(value) {
|
|
123770
|
+
return value;
|
|
123771
|
+
}
|
|
123772
|
+
function castImmutable(value) {
|
|
123773
|
+
return value;
|
|
123774
|
+
}
|
|
123775
|
+
|
|
123776
|
+
//# sourceMappingURL=immer.mjs.map
|
|
123777
|
+
|
|
122523
123778
|
/***/ }),
|
|
122524
123779
|
|
|
122525
123780
|
/***/ 97582:
|