@opengeoweb/workspace 4.22.0 → 4.22.1
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/index.js +491 -133
- package/package.json +13 -13
- package/src/lib/components/WorkspaceDetail/WorkspaceDetailError.stories.d.ts +3 -1
- package/src/lib/components/WorkspacePresetsFormDialog/WorkspacePresetsFormDialog.d.ts +4 -2
- package/src/lib/store/store.d.ts +1 -1
- package/src/lib/store/viewPresets/reducer.d.ts +20 -20
- package/src/lib/store/viewPresetsList/reducer.d.ts +1 -1
- package/src/lib/store/workspace/reducer.d.ts +12 -12
- package/src/lib/store/workspace/selectors.d.ts +11 -11
- package/src/lib/store/workspace/utils.d.ts +1 -1
- package/src/lib/store/workspaceList/reducer.d.ts +15 -13
- package/src/lib/store/workspaceList/sagas.d.ts +15 -0
- package/src/lib/store/workspaceList/types.d.ts +10 -4
package/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { SyncGroups, syncGroupActions, layerActions, mapActions, uiActions, mapTypes, genericSelectors, routerActions, snackbarActions, mapSelectors, SnackbarWrapperConnect, coreModuleConfig, syncGroupsSelectors, uiSelectors } from '@opengeoweb/core';
|
|
2
2
|
import { createApiInstance, createNonAuthApiInstance, getApi, createFakeApiInstance, ApiProvider, useApiContext } from '@opengeoweb/api';
|
|
3
3
|
import { getLeaves, MosaicContext, getAndAssertNodeAtPathExists, createBalancedTreeFromLeaves, MosaicWindow, MosaicWithoutDragDropContext } from 'react-mosaic-component';
|
|
4
|
+
import { isAxiosError, getAxiosErrorMessage, withEggs, useConfirmationDialog, CustomIconButton, AlertBanner, CustomTooltip, SearchHighlight, ToggleMenu, ToolContainer, CustomToggleButton, ConfirmationServiceProvider, ConfirmationDialog } from '@opengeoweb/shared';
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import React__default, { createContext, useContext, useDebugValue, useLayoutEffect, useEffect, useMemo, memo, useRef, useCallback, forwardRef, createElement, Fragment } from 'react';
|
|
6
7
|
import { ThemeWrapper, lightTheme, Menu, SplitVertical, SplitHorizontal, Expand, UnExpand, Close, Delete, Preset, PresetWorkspace, PresetTiles, WebAssetOff, Clear, Search } from '@opengeoweb/theme';
|
|
7
8
|
import { unstable_batchedUpdates } from 'react-dom';
|
|
8
|
-
import { withEggs, useConfirmationDialog, CustomIconButton, AlertBanner, CustomTooltip, SearchHighlight, ToggleMenu, ToolContainer, CustomToggleButton, ConfirmationServiceProvider, ConfirmationDialog, isAxiosError, getAxiosErrorMessage } from '@opengeoweb/shared';
|
|
9
9
|
import { timeSeriesModuleConfig } from '@opengeoweb/timeseries';
|
|
10
10
|
import { jsx } from 'react/jsx-runtime';
|
|
11
11
|
import { useTheme as useTheme$2, LinearProgress, Typography, ListItem, ListItemButton, ListItemIcon, ListItemText, Grid, Box as Box$2, List, Backdrop, Menu as Menu$1, ListSubheader, MenuItem, Chip, Stack, debounce as debounce$1, TextField, InputAdornment, Tabs } from '@mui/material';
|
|
12
12
|
import 'react-mosaic-component/react-mosaic-component.css';
|
|
13
13
|
import { ReactHookFormTextField, ReactHookFormHiddenInput, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
14
14
|
|
|
15
|
-
function n$5(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r$5(n){return !!n&&!!n[Q]}function t$5(n){return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!n.constructor[L]||s(n)||v$4(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v$4(n)?3:0}function u$3(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a(n,r){return 2===o(n)?n.get(r):n[r]}function f$3(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?(n.delete(r),n.add(t)):n[r]=t;}function c$3(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v$4(n){return q$5&&n instanceof Set}function p$5(n){return n.o||n.t}function l$4(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d$3(n,e){return void 0===e&&(e=!1),y$2(n)||r$5(n)||!t$5(n)?n:(o(n)>1&&(n.set=n.add=n.clear=n.delete=h$5),Object.freeze(n),e&&i(n,(function(n,r){return d$3(r,!0)}),!0),n)}function h$5(){n$5(2);}function y$2(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b$3(r){var t=tn[r];return t||n$5(18,r),t}function m$4(n,r){tn[n]||(tn[n]=r);}function _(){return "production"===process.env.NODE_ENV||U||n$5(0),U}function j(n,r){r&&(b$3("Patches"),n.u=[],n.s=[],n.v=r);}function O(n){g$3(n),n.p.forEach(S),n.p=null;}function g$3(n){n===U&&(U=n.l);}function w$3(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.O=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.g||b$3("ES5").S(e,r,o),o?(i[Q].P&&(O(e),n$5(4)),t$5(r)&&(r=M(e,r),e.l||x$2(e,r)),e.u&&b$3("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),O(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y$2(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A$2(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x$2(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l$4(e.k):e.o;i(3===e.i?new Set(o):o,(function(r,i){return A$2(n,e,o,r,i,t)})),x$2(n,o,!1),t&&n.u&&b$3("Patches").R(e,t,n.u,n.s);}return e.o}function A$2(e,i,o,a,c,s){if("production"!==process.env.NODE_ENV&&c===o&&n$5(5),r$5(c)){var v=M(e,c,s&&i&&3!==i.i&&!u$3(i.D,a)?s.concat(a):void 0);if(f$3(o,a,v),!r$5(v))return;e.m=!1;}if(t$5(c)&&!y$2(c)){if(!e.h.F&&e._<1)return;M(e,c),i&&i.A.l||x$2(e,c);}}function x$2(n,r,t){void 0===t&&(t=!1),n.h.F&&n.m&&d$3(r,t);}function z$2(n,r){var t=n[Q];return (t?p$5(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k$4(n){n.P||(n.P=!0,n.l&&k$4(n.l));}function E(n){n.o||(n.o=l$4(n.t));}function R(n,r,t){var e=s(r)?b$3("MapSet").N(r,t):v$4(r)?b$3("MapSet").T(r,t):n.g?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,D:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b$3("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function D(e){return r$5(e)||n$5(22,e),function n(r){if(!t$5(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b$3("ES5").K(u)))return u.t;u.I=!0,e=F(r,c),u.I=!1;}else e=F(r,c);return i(e,(function(r,t){u&&a(u.t,r)===t||f$3(e,r,n(t));})),3===c?new Set(e):e}(e)}function F(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l$4(n)}function N(){function t(n,r){var t=s[n];return t?t.enumerable=r:s[n]=t={configurable:!0,enumerable:r,get:function(){var r=this[Q];return "production"!==process.env.NODE_ENV&&f(r),en.get(r,n)},set:function(r){var t=this[Q];"production"!==process.env.NODE_ENV&&f(t),en.set(t,n,r);}},t}function e(n){for(var r=n.length-1;r>=0;r--){var t=n[r][Q];if(!t.P)switch(t.i){case 5:a(t)&&k$4(t);break;case 4:o(t)&&k$4(t);}}}function o(n){for(var r=n.t,t=n.k,e=nn(t),i=e.length-1;i>=0;i--){var o=e[i];if(o!==Q){var a=r[o];if(void 0===a&&!u$3(r,o))return !0;var f=t[o],s=f&&f[Q];if(s?s.t!==a:!c$3(f,a))return !0}}var v=!!r[Q];return e.length!==nn(r).length+(v?0:1)}function a(n){var r=n.k;if(r.length!==n.t.length)return !0;var t=Object.getOwnPropertyDescriptor(r,r.length-1);if(t&&!t.get)return !0;for(var e=0;e<r.length;e++)if(!r.hasOwnProperty(e))return !0;return !1}function f(r){r.O&&n$5(3,JSON.stringify(p$5(r)));}var s={};m$4("ES5",{J:function(n,r){var e=Array.isArray(n),i=function(n,r){if(n){for(var e=Array(r.length),i=0;i<r.length;i++)Object.defineProperty(e,""+i,t(i,!0));return e}var o=rn(r);delete o[Q];for(var u=nn(o),a=0;a<u.length;a++){var f=u[a];o[f]=t(f,n||!!o[f].enumerable);}return Object.create(Object.getPrototypeOf(r),o)}(e,n),o={i:e?5:4,A:r?r.A:_(),P:!1,I:!1,D:{},l:r,t:n,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,Q,{value:o,writable:!0}),i},S:function(n,t,o){o?r$5(t)&&t[Q].A===n&&e(n.p):(n.u&&function n(r){if(r&&"object"==typeof r){var t=r[Q];if(t){var e=t.t,o=t.k,f=t.D,c=t.i;if(4===c)i(o,(function(r){r!==Q&&(void 0!==e[r]||u$3(e,r)?f[r]||n(o[r]):(f[r]=!0,k$4(t)));})),i(e,(function(n){void 0!==o[n]||u$3(o,n)||(f[n]=!1,k$4(t));}));else if(5===c){if(a(t)&&(k$4(t),f.length=!0),o.length<e.length)for(var s=o.length;s<e.length;s++)f[s]=!1;else for(var v=e.length;v<o.length;v++)f[v]=!0;for(var p=Math.min(o.length,e.length),l=0;l<p;l++)o.hasOwnProperty(l)||(f[l]=!0),void 0===f[l]&&n(o[l]);}}}}(n.p[0]),e(n.p));},K:function(n){return 4===n.i?o(n):a(n)}});}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q$5="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p$5(n);if(!u$3(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t$5(i)?i:i===z$2(n.t,r)?(E(n),n.o[r]=R(n.A.h,i,n)):i},has:function(n,r){return r in p$5(n)},ownKeys:function(n){return Reflect.ownKeys(p$5(n))},set:function(n,r,t){var e=I(p$5(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z$2(p$5(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.D[r]=!1,!0;if(c$3(t,i)&&(void 0!==t||u$3(n.t,r)))return !0;E(n),k$4(n);}return n.o[r]===t&&"number"!=typeof t&&(void 0!==t||r in n.o)||(n.o[r]=t,n.D[r]=!0,!0)},deleteProperty:function(n,r){return void 0!==z$2(n.t,r)||r in n.t?(n.D[r]=!1,E(n),k$4(n)):delete n.D[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p$5(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n$5(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n$5(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n$5(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n$5(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.g=B,this.F=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n$5(6),void 0!==o&&"function"!=typeof o&&n$5(7),t$5(r)){var c=w$3(e),s=R(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?O(c):g$3(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw O(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.F&&d$3(f,!0),o){var p=[],l=[];b$3("Patches").M(r,f,p,l),o(p,l);}return f}n$5(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t$5(e)||n$5(8),r$5(e)&&(e=D(e));var i=w$3(this),o=R(this,e,void 0);return o[Q].C=!0,g$3(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n$5(9),e.I&&n$5(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.F=n;},i.setUseProxies=function(r){r&&!B&&n$5(20),this.g=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b$3("Patches").$;return r$5(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);var createNextState3 = fn;
|
|
15
|
+
function n$5(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r$5(n){return !!n&&!!n[Q]}function t$5(n){var r;return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!(null===(r=n.constructor)||void 0===r?void 0:r[L])||s(n)||v$4(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v$4(n)?3:0}function u$3(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a(n,r){return 2===o(n)?n.get(r):n[r]}function f$3(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?n.add(t):n[r]=t;}function c$3(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v$4(n){return q$5&&n instanceof Set}function p$5(n){return n.o||n.t}function l$4(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d$3(n,e){return void 0===e&&(e=!1),y$2(n)||r$5(n)||!t$5(n)||(o(n)>1&&(n.set=n.add=n.clear=n.delete=h$5),Object.freeze(n),e&&i(n,(function(n,r){return d$3(r,!0)}),!0)),n}function h$5(){n$5(2);}function y$2(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b$3(r){var t=tn[r];return t||n$5(18,r),t}function m$4(n,r){tn[n]||(tn[n]=r);}function _(){return "production"===process.env.NODE_ENV||U||n$5(0),U}function j(n,r){r&&(b$3("Patches"),n.u=[],n.s=[],n.v=r);}function g$3(n){O(n),n.p.forEach(S),n.p=null;}function O(n){n===U&&(U=n.l);}function w$3(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.g=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.O||b$3("ES5").S(e,r,o),o?(i[Q].P&&(g$3(e),n$5(4)),t$5(r)&&(r=M(e,r),e.l||x$2(e,r)),e.u&&b$3("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),g$3(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y$2(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A$2(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x$2(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l$4(e.k):e.o,u=o,a=!1;3===e.i&&(u=new Set(o),o.clear(),a=!0),i(u,(function(r,i){return A$2(n,e,o,r,i,t,a)})),x$2(n,o,!1),t&&n.u&&b$3("Patches").N(e,t,n.u,n.s);}return e.o}function A$2(e,i,o,a,c,s,v){if("production"!==process.env.NODE_ENV&&c===o&&n$5(5),r$5(c)){var p=M(e,c,s&&i&&3!==i.i&&!u$3(i.R,a)?s.concat(a):void 0);if(f$3(o,a,p),!r$5(p))return;e.m=!1;}else v&&o.add(c);if(t$5(c)&&!y$2(c)){if(!e.h.D&&e._<1)return;M(e,c),i&&i.A.l||x$2(e,c);}}function x$2(n,r,t){void 0===t&&(t=!1),!n.l&&n.h.D&&n.m&&d$3(r,t);}function z$2(n,r){var t=n[Q];return (t?p$5(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k$4(n){n.P||(n.P=!0,n.l&&k$4(n.l));}function E(n){n.o||(n.o=l$4(n.t));}function N(n,r,t){var e=s(r)?b$3("MapSet").F(r,t):v$4(r)?b$3("MapSet").T(r,t):n.O?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b$3("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function R(e){return r$5(e)||n$5(22,e),function n(r){if(!t$5(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b$3("ES5").K(u)))return u.t;u.I=!0,e=D(r,c),u.I=!1;}else e=D(r,c);return i(e,(function(r,t){u&&a(u.t,r)===t||f$3(e,r,n(t));})),3===c?new Set(e):e}(e)}function D(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l$4(n)}function F(){function t(n,r){var t=s[n];return t?t.enumerable=r:s[n]=t={configurable:!0,enumerable:r,get:function(){var r=this[Q];return "production"!==process.env.NODE_ENV&&f(r),en.get(r,n)},set:function(r){var t=this[Q];"production"!==process.env.NODE_ENV&&f(t),en.set(t,n,r);}},t}function e(n){for(var r=n.length-1;r>=0;r--){var t=n[r][Q];if(!t.P)switch(t.i){case 5:a(t)&&k$4(t);break;case 4:o(t)&&k$4(t);}}}function o(n){for(var r=n.t,t=n.k,e=nn(t),i=e.length-1;i>=0;i--){var o=e[i];if(o!==Q){var a=r[o];if(void 0===a&&!u$3(r,o))return !0;var f=t[o],s=f&&f[Q];if(s?s.t!==a:!c$3(f,a))return !0}}var v=!!r[Q];return e.length!==nn(r).length+(v?0:1)}function a(n){var r=n.k;if(r.length!==n.t.length)return !0;var t=Object.getOwnPropertyDescriptor(r,r.length-1);if(t&&!t.get)return !0;for(var e=0;e<r.length;e++)if(!r.hasOwnProperty(e))return !0;return !1}function f(r){r.g&&n$5(3,JSON.stringify(p$5(r)));}var s={};m$4("ES5",{J:function(n,r){var e=Array.isArray(n),i=function(n,r){if(n){for(var e=Array(r.length),i=0;i<r.length;i++)Object.defineProperty(e,""+i,t(i,!0));return e}var o=rn(r);delete o[Q];for(var u=nn(o),a=0;a<u.length;a++){var f=u[a];o[f]=t(f,n||!!o[f].enumerable);}return Object.create(Object.getPrototypeOf(r),o)}(e,n),o={i:e?5:4,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:i,o:null,g:!1,C:!1};return Object.defineProperty(i,Q,{value:o,writable:!0}),i},S:function(n,t,o){o?r$5(t)&&t[Q].A===n&&e(n.p):(n.u&&function n(r){if(r&&"object"==typeof r){var t=r[Q];if(t){var e=t.t,o=t.k,f=t.R,c=t.i;if(4===c)i(o,(function(r){r!==Q&&(void 0!==e[r]||u$3(e,r)?f[r]||n(o[r]):(f[r]=!0,k$4(t)));})),i(e,(function(n){void 0!==o[n]||u$3(o,n)||(f[n]=!1,k$4(t));}));else if(5===c){if(a(t)&&(k$4(t),f.length=!0),o.length<e.length)for(var s=o.length;s<e.length;s++)f[s]=!1;else for(var v=e.length;v<o.length;v++)f[v]=!0;for(var p=Math.min(o.length,e.length),l=0;l<p;l++)o.hasOwnProperty(l)||(f[l]=!0),void 0===f[l]&&n(o[l]);}}}}(n.p[0]),e(n.p));},K:function(n){return 4===n.i?o(n):a(n)}});}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q$5="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p$5(n);if(!u$3(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t$5(i)?i:i===z$2(n.t,r)?(E(n),n.o[r]=N(n.A.h,i,n)):i},has:function(n,r){return r in p$5(n)},ownKeys:function(n){return Reflect.ownKeys(p$5(n))},set:function(n,r,t){var e=I(p$5(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z$2(p$5(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.R[r]=!1,!0;if(c$3(t,i)&&(void 0!==t||u$3(n.t,r)))return !0;E(n),k$4(n);}return n.o[r]===t&&(void 0!==t||r in n.o)||Number.isNaN(t)&&Number.isNaN(n.o[r])||(n.o[r]=t,n.R[r]=!0),!0},deleteProperty:function(n,r){return void 0!==z$2(n.t,r)||r in n.t?(n.R[r]=!1,E(n),k$4(n)):delete n.R[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p$5(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n$5(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n$5(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n$5(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n$5(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.O=B,this.D=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n$5(6),void 0!==o&&"function"!=typeof o&&n$5(7),t$5(r)){var c=w$3(e),s=N(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?g$3(c):O(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw g$3(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.D&&d$3(f,!0),o){var p=[],l=[];b$3("Patches").M(r,f,p,l),o(p,l);}return f}n$5(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t$5(e)||n$5(8),r$5(e)&&(e=R(e));var i=w$3(this),o=N(this,e,void 0);return o[Q].C=!0,O(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n$5(9),e.I&&n$5(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.D=n;},i.setUseProxies=function(r){r&&!B&&n$5(20),this.O=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b$3("Patches").$;return r$5(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);var createNextState3 = fn;
|
|
16
16
|
|
|
17
17
|
// Cache implementation based on Erik Rasmussen's `lru-memoize`:
|
|
18
18
|
// https://github.com/erikras/lru-memoize
|
|
@@ -222,13 +222,13 @@ function createSelectorCreator(memoize) {
|
|
|
222
222
|
|
|
223
223
|
var finalMemoizeOptions = Array.isArray(memoizeOptions) ? memoizeOptions : [memoizeOptions];
|
|
224
224
|
var dependencies = getDependencies(funcs);
|
|
225
|
-
var memoizedResultFunc = memoize.apply(void 0, [function () {
|
|
225
|
+
var memoizedResultFunc = memoize.apply(void 0, [function recomputationWrapper() {
|
|
226
226
|
_recomputations++; // apply arguments instead of spreading for performance.
|
|
227
227
|
|
|
228
228
|
return resultFunc.apply(null, arguments);
|
|
229
229
|
}].concat(finalMemoizeOptions)); // If a selector is called with the exact same arguments we don't need to traverse our dependencies again.
|
|
230
230
|
|
|
231
|
-
var selector = memoize(function () {
|
|
231
|
+
var selector = memoize(function dependenciesChecker() {
|
|
232
232
|
var params = [];
|
|
233
233
|
var length = dependencies.length;
|
|
234
234
|
|
|
@@ -279,7 +279,7 @@ var __extends = (undefined && undefined.__extends) || (function () {
|
|
|
279
279
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
280
280
|
};
|
|
281
281
|
})();
|
|
282
|
-
(undefined && undefined.__generator) || function (thisArg, body) {
|
|
282
|
+
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
283
283
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
284
284
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
285
285
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
@@ -312,6 +312,8 @@ var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from
|
|
|
312
312
|
return to;
|
|
313
313
|
};
|
|
314
314
|
var __defProp = Object.defineProperty;
|
|
315
|
+
var __defProps = Object.defineProperties;
|
|
316
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
315
317
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
316
318
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
317
319
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -328,6 +330,29 @@ var __spreadValues = function (a, b) {
|
|
|
328
330
|
}
|
|
329
331
|
return a;
|
|
330
332
|
};
|
|
333
|
+
var __spreadProps = function (a, b) { return __defProps(a, __getOwnPropDescs(b)); };
|
|
334
|
+
var __async = function (__this, __arguments, generator) {
|
|
335
|
+
return new Promise(function (resolve, reject) {
|
|
336
|
+
var fulfilled = function (value) {
|
|
337
|
+
try {
|
|
338
|
+
step(generator.next(value));
|
|
339
|
+
}
|
|
340
|
+
catch (e) {
|
|
341
|
+
reject(e);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
var rejected = function (value) {
|
|
345
|
+
try {
|
|
346
|
+
step(generator.throw(value));
|
|
347
|
+
}
|
|
348
|
+
catch (e) {
|
|
349
|
+
reject(e);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
var step = function (x) { return x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); };
|
|
353
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
354
|
+
});
|
|
355
|
+
};
|
|
331
356
|
var createDraftSafeSelector = function () {
|
|
332
357
|
var args = [];
|
|
333
358
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -339,7 +364,7 @@ var createDraftSafeSelector = function () {
|
|
|
339
364
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
340
365
|
rest[_i - 1] = arguments[_i];
|
|
341
366
|
}
|
|
342
|
-
return selector.apply(void 0, __spreadArray([r$5(value) ?
|
|
367
|
+
return selector.apply(void 0, __spreadArray([r$5(value) ? R(value) : value], rest));
|
|
343
368
|
};
|
|
344
369
|
return wrappedSelector;
|
|
345
370
|
};
|
|
@@ -393,6 +418,43 @@ function isPlainObject$2(value) {
|
|
|
393
418
|
};
|
|
394
419
|
return MiddlewareArray;
|
|
395
420
|
})(Array));
|
|
421
|
+
/** @class */ ((function (_super) {
|
|
422
|
+
__extends(EnhancerArray, _super);
|
|
423
|
+
function EnhancerArray() {
|
|
424
|
+
var args = [];
|
|
425
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
426
|
+
args[_i] = arguments[_i];
|
|
427
|
+
}
|
|
428
|
+
var _this = _super.apply(this, args) || this;
|
|
429
|
+
Object.setPrototypeOf(_this, EnhancerArray.prototype);
|
|
430
|
+
return _this;
|
|
431
|
+
}
|
|
432
|
+
Object.defineProperty(EnhancerArray, Symbol.species, {
|
|
433
|
+
get: function () {
|
|
434
|
+
return EnhancerArray;
|
|
435
|
+
},
|
|
436
|
+
enumerable: false,
|
|
437
|
+
configurable: true
|
|
438
|
+
});
|
|
439
|
+
EnhancerArray.prototype.concat = function () {
|
|
440
|
+
var arr = [];
|
|
441
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
442
|
+
arr[_i] = arguments[_i];
|
|
443
|
+
}
|
|
444
|
+
return _super.prototype.concat.apply(this, arr);
|
|
445
|
+
};
|
|
446
|
+
EnhancerArray.prototype.prepend = function () {
|
|
447
|
+
var arr = [];
|
|
448
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
449
|
+
arr[_i] = arguments[_i];
|
|
450
|
+
}
|
|
451
|
+
if (arr.length === 1 && Array.isArray(arr[0])) {
|
|
452
|
+
return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr[0].concat(this))))();
|
|
453
|
+
}
|
|
454
|
+
return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr.concat(this))))();
|
|
455
|
+
};
|
|
456
|
+
return EnhancerArray;
|
|
457
|
+
})(Array));
|
|
396
458
|
function freezeDraftable(val) {
|
|
397
459
|
return t$5(val) ? createNextState3(val, function () {
|
|
398
460
|
}) : val;
|
|
@@ -425,8 +487,11 @@ function createAction(type, prepareAction) {
|
|
|
425
487
|
actionCreator.match = function (action) { return action.type === type; };
|
|
426
488
|
return actionCreator;
|
|
427
489
|
}
|
|
490
|
+
function isAction(action) {
|
|
491
|
+
return isPlainObject$2(action) && "type" in action;
|
|
492
|
+
}
|
|
428
493
|
function isFSA(action) {
|
|
429
|
-
return
|
|
494
|
+
return isAction(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey);
|
|
430
495
|
}
|
|
431
496
|
function isValidKey(key) {
|
|
432
497
|
return ["type", "payload", "error", "meta"].indexOf(key) > -1;
|
|
@@ -479,8 +544,17 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
479
544
|
function isStateFunction(x) {
|
|
480
545
|
return typeof x === "function";
|
|
481
546
|
}
|
|
547
|
+
var hasWarnedAboutObjectNotation = false;
|
|
482
548
|
function createReducer(initialState, mapOrBuilderCallback, actionMatchers, defaultCaseReducer) {
|
|
483
549
|
if (actionMatchers === void 0) { actionMatchers = []; }
|
|
550
|
+
if (process.env.NODE_ENV !== "production") {
|
|
551
|
+
if (typeof mapOrBuilderCallback === "object") {
|
|
552
|
+
if (!hasWarnedAboutObjectNotation) {
|
|
553
|
+
hasWarnedAboutObjectNotation = true;
|
|
554
|
+
console.warn("The object notation for `createReducer` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
484
558
|
var _c = typeof mapOrBuilderCallback === "function" ? executeReducerBuilderCallback(mapOrBuilderCallback) : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer], actionsMap = _c[0], finalActionMatchers = _c[1], finalDefaultCaseReducer = _c[2];
|
|
485
559
|
var getInitialState;
|
|
486
560
|
if (isStateFunction(initialState)) {
|
|
@@ -509,14 +583,14 @@ function createReducer(initialState, mapOrBuilderCallback, actionMatchers, defau
|
|
|
509
583
|
if (r$5(previousState)) {
|
|
510
584
|
var draft = previousState;
|
|
511
585
|
var result = caseReducer(draft, action);
|
|
512
|
-
if (
|
|
586
|
+
if (result === void 0) {
|
|
513
587
|
return previousState;
|
|
514
588
|
}
|
|
515
589
|
return result;
|
|
516
590
|
}
|
|
517
591
|
else if (!t$5(previousState)) {
|
|
518
592
|
var result = caseReducer(previousState, action);
|
|
519
|
-
if (
|
|
593
|
+
if (result === void 0) {
|
|
520
594
|
if (previousState === null) {
|
|
521
595
|
return previousState;
|
|
522
596
|
}
|
|
@@ -537,6 +611,7 @@ function createReducer(initialState, mapOrBuilderCallback, actionMatchers, defau
|
|
|
537
611
|
return reducer;
|
|
538
612
|
}
|
|
539
613
|
// src/createSlice.ts
|
|
614
|
+
var hasWarnedAboutObjectNotation2 = false;
|
|
540
615
|
function getType2(slice, actionKey) {
|
|
541
616
|
return slice + "/" + actionKey;
|
|
542
617
|
}
|
|
@@ -573,9 +648,28 @@ function createSlice(options) {
|
|
|
573
648
|
actionCreators[reducerName] = prepareCallback ? createAction(type, prepareCallback) : createAction(type);
|
|
574
649
|
});
|
|
575
650
|
function buildReducer() {
|
|
651
|
+
if (process.env.NODE_ENV !== "production") {
|
|
652
|
+
if (typeof options.extraReducers === "object") {
|
|
653
|
+
if (!hasWarnedAboutObjectNotation2) {
|
|
654
|
+
hasWarnedAboutObjectNotation2 = true;
|
|
655
|
+
console.warn("The object notation for `createSlice.extraReducers` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
576
659
|
var _c = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers], _d = _c[0], extraReducers = _d === void 0 ? {} : _d, _e = _c[1], actionMatchers = _e === void 0 ? [] : _e, _f = _c[2], defaultCaseReducer = _f === void 0 ? void 0 : _f;
|
|
577
660
|
var finalCaseReducers = __spreadValues(__spreadValues({}, extraReducers), sliceCaseReducersByType);
|
|
578
|
-
return createReducer(initialState,
|
|
661
|
+
return createReducer(initialState, function (builder) {
|
|
662
|
+
for (var key in finalCaseReducers) {
|
|
663
|
+
builder.addCase(key, finalCaseReducers[key]);
|
|
664
|
+
}
|
|
665
|
+
for (var _i = 0, actionMatchers_1 = actionMatchers; _i < actionMatchers_1.length; _i++) {
|
|
666
|
+
var m = actionMatchers_1[_i];
|
|
667
|
+
builder.addMatcher(m.matcher, m.reducer);
|
|
668
|
+
}
|
|
669
|
+
if (defaultCaseReducer) {
|
|
670
|
+
builder.addDefaultCase(defaultCaseReducer);
|
|
671
|
+
}
|
|
672
|
+
});
|
|
579
673
|
}
|
|
580
674
|
var _reducer;
|
|
581
675
|
return {
|
|
@@ -784,7 +878,7 @@ function createUnsortedStateAdapter(selectId) {
|
|
|
784
878
|
if (didMutateEntities) {
|
|
785
879
|
var didMutateIds = updates.filter(function (update) { return takeNewKey(newKeys, update, state); }).length > 0;
|
|
786
880
|
if (didMutateIds) {
|
|
787
|
-
state.ids = state.
|
|
881
|
+
state.ids = Object.keys(state.entities);
|
|
788
882
|
}
|
|
789
883
|
}
|
|
790
884
|
}
|
|
@@ -927,12 +1021,228 @@ function createEntityAdapter(options) {
|
|
|
927
1021
|
sortComparer: sortComparer
|
|
928
1022
|
}, stateFactory), selectorsFactory), stateAdapter);
|
|
929
1023
|
}
|
|
1024
|
+
// src/nanoid.ts
|
|
1025
|
+
var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
|
|
1026
|
+
var nanoid = function (size) {
|
|
1027
|
+
if (size === void 0) { size = 21; }
|
|
1028
|
+
var id = "";
|
|
1029
|
+
var i = size;
|
|
1030
|
+
while (i--) {
|
|
1031
|
+
id += urlAlphabet[Math.random() * 64 | 0];
|
|
1032
|
+
}
|
|
1033
|
+
return id;
|
|
1034
|
+
};
|
|
1035
|
+
// src/createAsyncThunk.ts
|
|
1036
|
+
var commonProperties = [
|
|
1037
|
+
"name",
|
|
1038
|
+
"message",
|
|
1039
|
+
"stack",
|
|
1040
|
+
"code"
|
|
1041
|
+
];
|
|
1042
|
+
var RejectWithValue = /** @class */ (function () {
|
|
1043
|
+
function RejectWithValue(payload, meta) {
|
|
1044
|
+
this.payload = payload;
|
|
1045
|
+
this.meta = meta;
|
|
1046
|
+
}
|
|
1047
|
+
return RejectWithValue;
|
|
1048
|
+
}());
|
|
1049
|
+
var FulfillWithMeta = /** @class */ (function () {
|
|
1050
|
+
function FulfillWithMeta(payload, meta) {
|
|
1051
|
+
this.payload = payload;
|
|
1052
|
+
this.meta = meta;
|
|
1053
|
+
}
|
|
1054
|
+
return FulfillWithMeta;
|
|
1055
|
+
}());
|
|
1056
|
+
var miniSerializeError = function (value) {
|
|
1057
|
+
if (typeof value === "object" && value !== null) {
|
|
1058
|
+
var simpleError = {};
|
|
1059
|
+
for (var _i = 0, commonProperties_1 = commonProperties; _i < commonProperties_1.length; _i++) {
|
|
1060
|
+
var property = commonProperties_1[_i];
|
|
1061
|
+
if (typeof value[property] === "string") {
|
|
1062
|
+
simpleError[property] = value[property];
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
return simpleError;
|
|
1066
|
+
}
|
|
1067
|
+
return { message: String(value) };
|
|
1068
|
+
};
|
|
1069
|
+
((function () {
|
|
1070
|
+
function createAsyncThunk2(typePrefix, payloadCreator, options) {
|
|
1071
|
+
var fulfilled = createAction(typePrefix + "/fulfilled", function (payload, requestId, arg, meta) { return ({
|
|
1072
|
+
payload: payload,
|
|
1073
|
+
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
1074
|
+
arg: arg,
|
|
1075
|
+
requestId: requestId,
|
|
1076
|
+
requestStatus: "fulfilled"
|
|
1077
|
+
})
|
|
1078
|
+
}); });
|
|
1079
|
+
var pending = createAction(typePrefix + "/pending", function (requestId, arg, meta) { return ({
|
|
1080
|
+
payload: void 0,
|
|
1081
|
+
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
1082
|
+
arg: arg,
|
|
1083
|
+
requestId: requestId,
|
|
1084
|
+
requestStatus: "pending"
|
|
1085
|
+
})
|
|
1086
|
+
}); });
|
|
1087
|
+
var rejected = createAction(typePrefix + "/rejected", function (error, requestId, arg, payload, meta) { return ({
|
|
1088
|
+
payload: payload,
|
|
1089
|
+
error: (options && options.serializeError || miniSerializeError)(error || "Rejected"),
|
|
1090
|
+
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
1091
|
+
arg: arg,
|
|
1092
|
+
requestId: requestId,
|
|
1093
|
+
rejectedWithValue: !!payload,
|
|
1094
|
+
requestStatus: "rejected",
|
|
1095
|
+
aborted: (error == null ? void 0 : error.name) === "AbortError",
|
|
1096
|
+
condition: (error == null ? void 0 : error.name) === "ConditionError"
|
|
1097
|
+
})
|
|
1098
|
+
}); });
|
|
1099
|
+
var displayedWarning = false;
|
|
1100
|
+
var AC = typeof AbortController !== "undefined" ? AbortController : /** @class */ (function () {
|
|
1101
|
+
function class_1() {
|
|
1102
|
+
this.signal = {
|
|
1103
|
+
aborted: false,
|
|
1104
|
+
addEventListener: function () {
|
|
1105
|
+
},
|
|
1106
|
+
dispatchEvent: function () {
|
|
1107
|
+
return false;
|
|
1108
|
+
},
|
|
1109
|
+
onabort: function () {
|
|
1110
|
+
},
|
|
1111
|
+
removeEventListener: function () {
|
|
1112
|
+
},
|
|
1113
|
+
reason: void 0,
|
|
1114
|
+
throwIfAborted: function () {
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
class_1.prototype.abort = function () {
|
|
1119
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1120
|
+
if (!displayedWarning) {
|
|
1121
|
+
displayedWarning = true;
|
|
1122
|
+
console.info("This platform does not implement AbortController. \nIf you want to use the AbortController to react to `abort` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'.");
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
};
|
|
1126
|
+
return class_1;
|
|
1127
|
+
}());
|
|
1128
|
+
function actionCreator(arg) {
|
|
1129
|
+
return function (dispatch, getState, extra) {
|
|
1130
|
+
var requestId = (options == null ? void 0 : options.idGenerator) ? options.idGenerator(arg) : nanoid();
|
|
1131
|
+
var abortController = new AC();
|
|
1132
|
+
var abortReason;
|
|
1133
|
+
function abort(reason) {
|
|
1134
|
+
abortReason = reason;
|
|
1135
|
+
abortController.abort();
|
|
1136
|
+
}
|
|
1137
|
+
var promise2 = function () {
|
|
1138
|
+
return __async(this, null, function () {
|
|
1139
|
+
var _a, _b, finalAction, conditionResult, abortedPromise, err_1, skipDispatch;
|
|
1140
|
+
return __generator(this, function (_c) {
|
|
1141
|
+
switch (_c.label) {
|
|
1142
|
+
case 0:
|
|
1143
|
+
_c.trys.push([0, 4, , 5]);
|
|
1144
|
+
conditionResult = (_a = options == null ? void 0 : options.condition) == null ? void 0 : _a.call(options, arg, { getState: getState, extra: extra });
|
|
1145
|
+
if (!isThenable(conditionResult)) return [3 /*break*/, 2];
|
|
1146
|
+
return [4 /*yield*/, conditionResult];
|
|
1147
|
+
case 1:
|
|
1148
|
+
conditionResult = _c.sent();
|
|
1149
|
+
_c.label = 2;
|
|
1150
|
+
case 2:
|
|
1151
|
+
if (conditionResult === false || abortController.signal.aborted) {
|
|
1152
|
+
throw {
|
|
1153
|
+
name: "ConditionError",
|
|
1154
|
+
message: "Aborted due to condition callback returning false."
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
abortedPromise = new Promise(function (_, reject) { return abortController.signal.addEventListener("abort", function () { return reject({
|
|
1158
|
+
name: "AbortError",
|
|
1159
|
+
message: abortReason || "Aborted"
|
|
1160
|
+
}); }); });
|
|
1161
|
+
dispatch(pending(requestId, arg, (_b = options == null ? void 0 : options.getPendingMeta) == null ? void 0 : _b.call(options, { requestId: requestId, arg: arg }, { getState: getState, extra: extra })));
|
|
1162
|
+
return [4 /*yield*/, Promise.race([
|
|
1163
|
+
abortedPromise,
|
|
1164
|
+
Promise.resolve(payloadCreator(arg, {
|
|
1165
|
+
dispatch: dispatch,
|
|
1166
|
+
getState: getState,
|
|
1167
|
+
extra: extra,
|
|
1168
|
+
requestId: requestId,
|
|
1169
|
+
signal: abortController.signal,
|
|
1170
|
+
abort: abort,
|
|
1171
|
+
rejectWithValue: function (value, meta) {
|
|
1172
|
+
return new RejectWithValue(value, meta);
|
|
1173
|
+
},
|
|
1174
|
+
fulfillWithValue: function (value, meta) {
|
|
1175
|
+
return new FulfillWithMeta(value, meta);
|
|
1176
|
+
}
|
|
1177
|
+
})).then(function (result) {
|
|
1178
|
+
if (result instanceof RejectWithValue) {
|
|
1179
|
+
throw result;
|
|
1180
|
+
}
|
|
1181
|
+
if (result instanceof FulfillWithMeta) {
|
|
1182
|
+
return fulfilled(result.payload, requestId, arg, result.meta);
|
|
1183
|
+
}
|
|
1184
|
+
return fulfilled(result, requestId, arg);
|
|
1185
|
+
})
|
|
1186
|
+
])];
|
|
1187
|
+
case 3:
|
|
1188
|
+
finalAction = _c.sent();
|
|
1189
|
+
return [3 /*break*/, 5];
|
|
1190
|
+
case 4:
|
|
1191
|
+
err_1 = _c.sent();
|
|
1192
|
+
finalAction = err_1 instanceof RejectWithValue ? rejected(null, requestId, arg, err_1.payload, err_1.meta) : rejected(err_1, requestId, arg);
|
|
1193
|
+
return [3 /*break*/, 5];
|
|
1194
|
+
case 5:
|
|
1195
|
+
skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition;
|
|
1196
|
+
if (!skipDispatch) {
|
|
1197
|
+
dispatch(finalAction);
|
|
1198
|
+
}
|
|
1199
|
+
return [2 /*return*/, finalAction];
|
|
1200
|
+
}
|
|
1201
|
+
});
|
|
1202
|
+
});
|
|
1203
|
+
}();
|
|
1204
|
+
return Object.assign(promise2, {
|
|
1205
|
+
abort: abort,
|
|
1206
|
+
requestId: requestId,
|
|
1207
|
+
arg: arg,
|
|
1208
|
+
unwrap: function () {
|
|
1209
|
+
return promise2.then(unwrapResult);
|
|
1210
|
+
}
|
|
1211
|
+
});
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
return Object.assign(actionCreator, {
|
|
1215
|
+
pending: pending,
|
|
1216
|
+
rejected: rejected,
|
|
1217
|
+
fulfilled: fulfilled,
|
|
1218
|
+
typePrefix: typePrefix
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
createAsyncThunk2.withTypes = function () { return createAsyncThunk2; };
|
|
1222
|
+
return createAsyncThunk2;
|
|
1223
|
+
}))();
|
|
1224
|
+
function unwrapResult(action) {
|
|
1225
|
+
if (action.meta && action.meta.rejectedWithValue) {
|
|
1226
|
+
throw action.payload;
|
|
1227
|
+
}
|
|
1228
|
+
if (action.error) {
|
|
1229
|
+
throw action.error;
|
|
1230
|
+
}
|
|
1231
|
+
return action.payload;
|
|
1232
|
+
}
|
|
1233
|
+
function isThenable(value) {
|
|
1234
|
+
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
1235
|
+
}
|
|
930
1236
|
var alm = "listenerMiddleware";
|
|
931
1237
|
createAction(alm + "/add");
|
|
932
1238
|
createAction(alm + "/removeAll");
|
|
933
1239
|
createAction(alm + "/remove");
|
|
1240
|
+
var promise;
|
|
1241
|
+
typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : globalThis) : function (cb) { return (promise || (promise = Promise.resolve())).then(cb).catch(function (err) { return setTimeout(function () {
|
|
1242
|
+
throw err;
|
|
1243
|
+
}, 0); }); };
|
|
934
1244
|
// src/index.ts
|
|
935
|
-
|
|
1245
|
+
F();
|
|
936
1246
|
|
|
937
1247
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
938
1248
|
|
|
@@ -18242,17 +18552,31 @@ var slice$4 = createSlice({
|
|
|
18242
18552
|
draft.error = error;
|
|
18243
18553
|
},
|
|
18244
18554
|
openWorkspaceActionDialogOptions: function openWorkspaceActionDialogOptions(draft, action) {
|
|
18245
|
-
draft.workspaceActionDialog = action.payload
|
|
18555
|
+
draft.workspaceActionDialog = Object.assign(Object.assign({}, action.payload), {
|
|
18556
|
+
error: undefined,
|
|
18557
|
+
isFetching: false
|
|
18558
|
+
});
|
|
18559
|
+
},
|
|
18560
|
+
submitFormWorkspaceActionDialogOptions: function submitFormWorkspaceActionDialogOptions(draft,
|
|
18561
|
+
// eslint-disable-next-line no-unused-vars
|
|
18562
|
+
action) {
|
|
18563
|
+
draft.workspaceActionDialog.error = undefined;
|
|
18564
|
+
draft.workspaceActionDialog.isFetching = true;
|
|
18246
18565
|
},
|
|
18247
18566
|
closeWorkspaceActionDialogOptions: function closeWorkspaceActionDialogOptions(draft) {
|
|
18248
18567
|
delete draft.workspaceActionDialog;
|
|
18249
18568
|
},
|
|
18250
18569
|
// action is intercepted in mapPresets/sagas
|
|
18251
|
-
onSuccessWorkspacePresetAction: function onSuccessWorkspacePresetAction(
|
|
18570
|
+
onSuccessWorkspacePresetAction: function onSuccessWorkspacePresetAction(draft,
|
|
18252
18571
|
// eslint-disable-next-line no-unused-vars
|
|
18253
|
-
|
|
18254
|
-
|
|
18255
|
-
|
|
18572
|
+
action) {
|
|
18573
|
+
delete draft.workspaceActionDialog;
|
|
18574
|
+
},
|
|
18575
|
+
onErrorWorkspacePresetAction: function onErrorWorkspacePresetAction(draft, action) {
|
|
18576
|
+
var error = action.payload.error;
|
|
18577
|
+
draft.workspaceActionDialog.isFetching = false;
|
|
18578
|
+
draft.workspaceActionDialog.error = error;
|
|
18579
|
+
},
|
|
18256
18580
|
toggleWorkspaceDialog: function toggleWorkspaceDialog(draft, action) {
|
|
18257
18581
|
var isListDialogOpen = action.payload.isWorkspaceListDialogOpen;
|
|
18258
18582
|
draft.isWorkspaceListDialogOpen = isListDialogOpen;
|
|
@@ -18902,9 +19226,9 @@ var makeListOfViewIds = function makeListOfViewIds(mNode) {
|
|
|
18902
19226
|
return getLeaves(mNode);
|
|
18903
19227
|
};
|
|
18904
19228
|
var getErrorMessage = function getErrorMessage(error) {
|
|
18905
|
-
var _a;
|
|
19229
|
+
var _a, _b;
|
|
18906
19230
|
var prefix = error.message;
|
|
18907
|
-
var suffix = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data.message;
|
|
19231
|
+
var suffix = (_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message;
|
|
18908
19232
|
return suffix ? "".concat(prefix, ": ").concat(suffix) : prefix;
|
|
18909
19233
|
};
|
|
18910
19234
|
|
|
@@ -19810,6 +20134,7 @@ function take(patternOrChannel, multicastPattern) {
|
|
|
19810
20134
|
|
|
19811
20135
|
if (pattern(patternOrChannel)) {
|
|
19812
20136
|
if (notUndef(multicastPattern)) {
|
|
20137
|
+
/* eslint-disable no-console */
|
|
19813
20138
|
console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types");
|
|
19814
20139
|
}
|
|
19815
20140
|
|
|
@@ -19827,6 +20152,7 @@ function take(patternOrChannel, multicastPattern) {
|
|
|
19827
20152
|
|
|
19828
20153
|
if (channel(patternOrChannel)) {
|
|
19829
20154
|
if (notUndef(multicastPattern)) {
|
|
20155
|
+
/* eslint-disable no-console */
|
|
19830
20156
|
console.warn("take(channel) takes one argument but two were provided. Second argument is ignored.");
|
|
19831
20157
|
}
|
|
19832
20158
|
|
|
@@ -20926,7 +21252,7 @@ var workspacePresetsListFullContent = [
|
|
|
20926
21252
|
{
|
|
20927
21253
|
id: "radarView",
|
|
20928
21254
|
title: "Radar",
|
|
20929
|
-
scope: "
|
|
21255
|
+
scope: "user",
|
|
20930
21256
|
abstract: "",
|
|
20931
21257
|
viewType: "singleWindow",
|
|
20932
21258
|
views: [
|
|
@@ -22954,6 +23280,12 @@ var getWorkspaceListSearchQuery = function getWorkspaceListSearchQuery(store) {
|
|
|
22954
23280
|
};
|
|
22955
23281
|
|
|
22956
23282
|
var _marked$1 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$1);
|
|
23283
|
+
var emptyWorkspaceBEData = Object.assign(Object.assign({}, emptyMapWorkspace), {
|
|
23284
|
+
views: [{
|
|
23285
|
+
mosaicNodeId: '1_screen',
|
|
23286
|
+
viewPresetId: 'emptyMap'
|
|
23287
|
+
}]
|
|
23288
|
+
});
|
|
22957
23289
|
function fetchWorkspaceListSaga(_ref) {
|
|
22958
23290
|
var workspaceFilterParams = _ref.payload;
|
|
22959
23291
|
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -23052,18 +23384,117 @@ function onSuccessWorkspacePresetsActionSaga(_ref2) {
|
|
|
23052
23384
|
}, _callee2);
|
|
23053
23385
|
})();
|
|
23054
23386
|
}
|
|
23387
|
+
function submitFormWorkspaceDialogSaga(_ref3) {
|
|
23388
|
+
var payload = _ref3.payload;
|
|
23389
|
+
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
23390
|
+
var workspaceApi, presetId, presetAction, data, newId, isNewWorkspace, _ref4, presetToDuplicate, fullPreset, _newId, message;
|
|
23391
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
23392
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
23393
|
+
case 0:
|
|
23394
|
+
_context3.next = 2;
|
|
23395
|
+
return call(getWorkspaceApi);
|
|
23396
|
+
case 2:
|
|
23397
|
+
workspaceApi = _context3.sent;
|
|
23398
|
+
_context3.prev = 3;
|
|
23399
|
+
presetId = payload.presetId, presetAction = payload.presetAction, data = payload.data; // save as
|
|
23400
|
+
if (!(presetAction === WorkspacePresetAction.SAVE_AS)) {
|
|
23401
|
+
_context3.next = 11;
|
|
23402
|
+
break;
|
|
23403
|
+
}
|
|
23404
|
+
_context3.next = 8;
|
|
23405
|
+
return call(workspaceApi.saveWorkspacePresetAs, data);
|
|
23406
|
+
case 8:
|
|
23407
|
+
newId = _context3.sent;
|
|
23408
|
+
_context3.next = 11;
|
|
23409
|
+
return put(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
23410
|
+
workspaceId: newId,
|
|
23411
|
+
action: presetAction,
|
|
23412
|
+
title: data.title
|
|
23413
|
+
}));
|
|
23414
|
+
case 11:
|
|
23415
|
+
if (!(presetAction === WorkspacePresetAction.DUPLICATE)) {
|
|
23416
|
+
_context3.next = 28;
|
|
23417
|
+
break;
|
|
23418
|
+
}
|
|
23419
|
+
isNewWorkspace = presetId === emptyMapWorkspace.id;
|
|
23420
|
+
if (!isNewWorkspace) {
|
|
23421
|
+
_context3.next = 17;
|
|
23422
|
+
break;
|
|
23423
|
+
}
|
|
23424
|
+
_context3.t0 = {
|
|
23425
|
+
data: emptyWorkspaceBEData
|
|
23426
|
+
};
|
|
23427
|
+
_context3.next = 20;
|
|
23428
|
+
break;
|
|
23429
|
+
case 17:
|
|
23430
|
+
_context3.next = 19;
|
|
23431
|
+
return call(workspaceApi.getWorkspacePreset, presetId);
|
|
23432
|
+
case 19:
|
|
23433
|
+
_context3.t0 = _context3.sent;
|
|
23434
|
+
case 20:
|
|
23435
|
+
_ref4 = _context3.t0;
|
|
23436
|
+
presetToDuplicate = _ref4.data;
|
|
23437
|
+
fullPreset = Object.assign(Object.assign({}, presetToDuplicate), data);
|
|
23438
|
+
_context3.next = 25;
|
|
23439
|
+
return call(workspaceApi.saveWorkspacePresetAs, fullPreset);
|
|
23440
|
+
case 25:
|
|
23441
|
+
_newId = _context3.sent;
|
|
23442
|
+
_context3.next = 28;
|
|
23443
|
+
return put(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
23444
|
+
workspaceId: _newId,
|
|
23445
|
+
action: presetAction,
|
|
23446
|
+
title: data.title
|
|
23447
|
+
}));
|
|
23448
|
+
case 28:
|
|
23449
|
+
if (!(presetAction === WorkspacePresetAction.DELETE)) {
|
|
23450
|
+
_context3.next = 33;
|
|
23451
|
+
break;
|
|
23452
|
+
}
|
|
23453
|
+
_context3.next = 31;
|
|
23454
|
+
return call(workspaceApi.deleteWorkspacePreset, presetId);
|
|
23455
|
+
case 31:
|
|
23456
|
+
_context3.next = 33;
|
|
23457
|
+
return put(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
23458
|
+
workspaceId: presetId,
|
|
23459
|
+
action: presetAction,
|
|
23460
|
+
title: data.title
|
|
23461
|
+
}));
|
|
23462
|
+
case 33:
|
|
23463
|
+
_context3.next = 40;
|
|
23464
|
+
break;
|
|
23465
|
+
case 35:
|
|
23466
|
+
_context3.prev = 35;
|
|
23467
|
+
_context3.t1 = _context3["catch"](3);
|
|
23468
|
+
message = isAxiosError(_context3.t1) ? getAxiosErrorMessage(_context3.t1) : _context3.t1.message;
|
|
23469
|
+
_context3.next = 40;
|
|
23470
|
+
return put(workspaceListActions.onErrorWorkspacePresetAction({
|
|
23471
|
+
error: {
|
|
23472
|
+
type: WorkspaceListErrorType.GENERIC,
|
|
23473
|
+
message: message
|
|
23474
|
+
}
|
|
23475
|
+
}));
|
|
23476
|
+
case 40:
|
|
23477
|
+
case "end":
|
|
23478
|
+
return _context3.stop();
|
|
23479
|
+
}
|
|
23480
|
+
}, _callee3, null, [[3, 35]]);
|
|
23481
|
+
})();
|
|
23482
|
+
}
|
|
23055
23483
|
function rootSaga$1() {
|
|
23056
|
-
return _regeneratorRuntime().wrap(function rootSaga$(
|
|
23057
|
-
while (1) switch (
|
|
23484
|
+
return _regeneratorRuntime().wrap(function rootSaga$(_context4) {
|
|
23485
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
23058
23486
|
case 0:
|
|
23059
|
-
|
|
23487
|
+
_context4.next = 2;
|
|
23060
23488
|
return takeLeading$1(workspaceListActions.fetchWorkspaceList.type, fetchWorkspaceListSaga);
|
|
23061
23489
|
case 2:
|
|
23062
|
-
|
|
23490
|
+
_context4.next = 4;
|
|
23063
23491
|
return takeLatest$1(workspaceListActions.onSuccessWorkspacePresetAction, onSuccessWorkspacePresetsActionSaga);
|
|
23064
23492
|
case 4:
|
|
23493
|
+
_context4.next = 6;
|
|
23494
|
+
return takeLatest$1(workspaceListActions.submitFormWorkspaceActionDialogOptions, submitFormWorkspaceDialogSaga);
|
|
23495
|
+
case 6:
|
|
23065
23496
|
case "end":
|
|
23066
|
-
return
|
|
23497
|
+
return _context4.stop();
|
|
23067
23498
|
}
|
|
23068
23499
|
}, _marked$1);
|
|
23069
23500
|
}
|
|
@@ -36039,14 +36470,22 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
36039
36470
|
})));
|
|
36040
36471
|
};
|
|
36041
36472
|
|
|
36042
|
-
|
|
36043
|
-
|
|
36044
|
-
|
|
36045
|
-
|
|
36046
|
-
|
|
36047
|
-
|
|
36048
|
-
|
|
36049
|
-
|
|
36473
|
+
/* *
|
|
36474
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
36475
|
+
* you may not use this file except in compliance with the License.
|
|
36476
|
+
* You may obtain a copy of the License at
|
|
36477
|
+
*
|
|
36478
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
36479
|
+
*
|
|
36480
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
36481
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
36482
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
36483
|
+
* See the License for the specific language governing permissions and
|
|
36484
|
+
* limitations under the License.
|
|
36485
|
+
*
|
|
36486
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
36487
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
36488
|
+
* */
|
|
36050
36489
|
var getDialogTitle = function getDialogTitle(action) {
|
|
36051
36490
|
switch (action) {
|
|
36052
36491
|
case WorkspacePresetAction.DELETE:
|
|
@@ -36081,104 +36520,18 @@ var WorkspacePresetsFormDialog = function WorkspacePresetsFormDialog(_ref) {
|
|
|
36081
36520
|
action = _ref.action,
|
|
36082
36521
|
presetId = _ref.presetId,
|
|
36083
36522
|
formValues = _ref.formValues,
|
|
36084
|
-
|
|
36085
|
-
|
|
36523
|
+
onClose = _ref.onClose,
|
|
36524
|
+
onFormSubmit = _ref.onFormSubmit,
|
|
36525
|
+
_ref$isLoading = _ref.isLoading,
|
|
36526
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
36527
|
+
error = _ref.error;
|
|
36086
36528
|
var _useFormContext = useFormContext(),
|
|
36087
36529
|
handleFormSubmit = _useFormContext.handleSubmit,
|
|
36088
36530
|
reset = _useFormContext.reset;
|
|
36089
|
-
var _useApiContext = useApiContext(),
|
|
36090
|
-
api = _useApiContext.api;
|
|
36091
|
-
var _React$useState = React__default.useState(),
|
|
36092
|
-
_React$useState2 = _slicedToArray$2(_React$useState, 2),
|
|
36093
|
-
error = _React$useState2[0],
|
|
36094
|
-
setError = _React$useState2[1];
|
|
36095
|
-
var _React$useState3 = React__default.useState(false),
|
|
36096
|
-
_React$useState4 = _slicedToArray$2(_React$useState3, 2),
|
|
36097
|
-
isLoading = _React$useState4[0],
|
|
36098
|
-
setIsLoading = _React$useState4[1];
|
|
36099
|
-
React__default.useEffect(function () {
|
|
36100
|
-
if (!isOpen) {
|
|
36101
|
-
setError(null);
|
|
36102
|
-
}
|
|
36103
|
-
}, [isOpen]);
|
|
36104
36531
|
React__default.useEffect(function () {
|
|
36105
36532
|
reset(formValues);
|
|
36106
36533
|
}, [formValues, reset]);
|
|
36107
36534
|
var confirmLabel = getConfirmLabel$1(action);
|
|
36108
|
-
var onFormSubmit = function onFormSubmit(newFormValues) {
|
|
36109
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
36110
|
-
var fullPreset, newId, isNewWorkspace, _ref2, presetToDuplicate, _fullPreset, _newId, message;
|
|
36111
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
36112
|
-
while (1) switch (_context.prev = _context.next) {
|
|
36113
|
-
case 0:
|
|
36114
|
-
_context.prev = 0;
|
|
36115
|
-
setError(null);
|
|
36116
|
-
setIsLoading(true);
|
|
36117
|
-
_context.t0 = action;
|
|
36118
|
-
_context.next = _context.t0 === WorkspacePresetAction.SAVE_AS ? 6 : _context.t0 === WorkspacePresetAction.DUPLICATE ? 14 : _context.t0 === WorkspacePresetAction.DELETE ? 32 : 38;
|
|
36119
|
-
break;
|
|
36120
|
-
case 6:
|
|
36121
|
-
newFormValues.id, fullPreset = __rest(newFormValues, ["id"]);
|
|
36122
|
-
_context.next = 9;
|
|
36123
|
-
return api.saveWorkspacePresetAs(fullPreset);
|
|
36124
|
-
case 9:
|
|
36125
|
-
newId = _context.sent;
|
|
36126
|
-
setIsLoading(false);
|
|
36127
|
-
onClose();
|
|
36128
|
-
onSuccess(action, newId, newFormValues.title);
|
|
36129
|
-
return _context.abrupt("break", 39);
|
|
36130
|
-
case 14:
|
|
36131
|
-
isNewWorkspace = presetId === emptyMapWorkspace.id;
|
|
36132
|
-
if (!isNewWorkspace) {
|
|
36133
|
-
_context.next = 19;
|
|
36134
|
-
break;
|
|
36135
|
-
}
|
|
36136
|
-
_context.t1 = emptyWorkspaceBEData;
|
|
36137
|
-
_context.next = 22;
|
|
36138
|
-
break;
|
|
36139
|
-
case 19:
|
|
36140
|
-
_context.next = 21;
|
|
36141
|
-
return api.getWorkspacePreset(presetId);
|
|
36142
|
-
case 21:
|
|
36143
|
-
_context.t1 = _context.sent;
|
|
36144
|
-
case 22:
|
|
36145
|
-
_ref2 = _context.t1;
|
|
36146
|
-
presetToDuplicate = _ref2.data;
|
|
36147
|
-
_fullPreset = Object.assign(Object.assign({}, presetToDuplicate), newFormValues);
|
|
36148
|
-
_context.next = 27;
|
|
36149
|
-
return api.saveWorkspacePresetAs(_fullPreset);
|
|
36150
|
-
case 27:
|
|
36151
|
-
_newId = _context.sent;
|
|
36152
|
-
setIsLoading(false);
|
|
36153
|
-
onClose();
|
|
36154
|
-
onSuccess(action, _newId, newFormValues.title);
|
|
36155
|
-
return _context.abrupt("break", 39);
|
|
36156
|
-
case 32:
|
|
36157
|
-
_context.next = 34;
|
|
36158
|
-
return api.deleteWorkspacePreset(presetId);
|
|
36159
|
-
case 34:
|
|
36160
|
-
setIsLoading(false);
|
|
36161
|
-
onClose();
|
|
36162
|
-
onSuccess(action, presetId, newFormValues.title);
|
|
36163
|
-
return _context.abrupt("break", 39);
|
|
36164
|
-
case 38:
|
|
36165
|
-
return _context.abrupt("break", 39);
|
|
36166
|
-
case 39:
|
|
36167
|
-
_context.next = 46;
|
|
36168
|
-
break;
|
|
36169
|
-
case 41:
|
|
36170
|
-
_context.prev = 41;
|
|
36171
|
-
_context.t2 = _context["catch"](0);
|
|
36172
|
-
setIsLoading(false);
|
|
36173
|
-
message = isAxiosError(_context.t2) ? getAxiosErrorMessage(_context.t2) : _context.t2.message;
|
|
36174
|
-
setError(message);
|
|
36175
|
-
case 46:
|
|
36176
|
-
case "end":
|
|
36177
|
-
return _context.stop();
|
|
36178
|
-
}
|
|
36179
|
-
}, _callee, null, [[0, 41]]);
|
|
36180
|
-
}));
|
|
36181
|
-
};
|
|
36182
36535
|
var onSubmit = function onSubmit() {
|
|
36183
36536
|
handleFormSubmit(function (newFormValues) {
|
|
36184
36537
|
var title = newFormValues.title,
|
|
@@ -36190,7 +36543,7 @@ var WorkspacePresetsFormDialog = function WorkspacePresetsFormDialog(_ref) {
|
|
|
36190
36543
|
title: trimmedTitle,
|
|
36191
36544
|
"abstract": trimmedAbstract
|
|
36192
36545
|
});
|
|
36193
|
-
onFormSubmit(parsedFormValues);
|
|
36546
|
+
onFormSubmit(action, presetId, parsedFormValues);
|
|
36194
36547
|
})();
|
|
36195
36548
|
};
|
|
36196
36549
|
return /*#__PURE__*/React__default.createElement(ConfirmationDialog, {
|
|
@@ -36223,6 +36576,7 @@ var WorkspacePresetsFormDialogWrapper = function WorkspacePresetsFormDialogWrapp
|
|
|
36223
36576
|
|
|
36224
36577
|
var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
36225
36578
|
var workspaceId = _ref.workspaceId;
|
|
36579
|
+
var _a;
|
|
36226
36580
|
var dispatch = useDispatch();
|
|
36227
36581
|
var title = useSelector(function (store) {
|
|
36228
36582
|
return getSelectedWorkspaceTitle(store);
|
|
@@ -36233,16 +36587,18 @@ var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
|
36233
36587
|
var closeWorkspaceActionDialog = React.useCallback(function () {
|
|
36234
36588
|
dispatch(workspaceListActions.closeWorkspaceActionDialogOptions());
|
|
36235
36589
|
}, [dispatch]);
|
|
36236
|
-
var
|
|
36237
|
-
dispatch(workspaceListActions.
|
|
36238
|
-
|
|
36239
|
-
|
|
36240
|
-
|
|
36590
|
+
var onSubmitForm = function onSubmitForm(presetAction, presetId, data) {
|
|
36591
|
+
dispatch(workspaceListActions.submitFormWorkspaceActionDialogOptions({
|
|
36592
|
+
presetAction: presetAction,
|
|
36593
|
+
presetId: presetId,
|
|
36594
|
+
data: data
|
|
36241
36595
|
}));
|
|
36242
|
-
}
|
|
36596
|
+
};
|
|
36243
36597
|
var presetId = _typeof$2(dialogDetails) === 'object' && dialogDetails.presetId;
|
|
36244
36598
|
var action = _typeof$2(dialogDetails) === 'object' && dialogDetails.action;
|
|
36245
36599
|
var formValues = _typeof$2(dialogDetails) === 'object' && dialogDetails.formValues;
|
|
36600
|
+
var isFetching = _typeof$2(dialogDetails) === 'object' && dialogDetails.isFetching || false;
|
|
36601
|
+
var error = _typeof$2(dialogDetails) === 'object' && ((_a = dialogDetails.error) === null || _a === void 0 ? void 0 : _a.message);
|
|
36246
36602
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(WorkspaceTab, {
|
|
36247
36603
|
activeTab: true,
|
|
36248
36604
|
title: title,
|
|
@@ -36250,10 +36606,12 @@ var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
|
36250
36606
|
}), Boolean(dialogDetails) && /*#__PURE__*/React.createElement(WorkspacePresetsFormDialogWrapper, {
|
|
36251
36607
|
isOpen: Boolean(dialogDetails),
|
|
36252
36608
|
onClose: closeWorkspaceActionDialog,
|
|
36253
|
-
onSuccess: onSuccesWorkspaceDialogAction,
|
|
36254
36609
|
presetId: presetId,
|
|
36255
36610
|
action: action,
|
|
36256
|
-
formValues: formValues
|
|
36611
|
+
formValues: formValues,
|
|
36612
|
+
onFormSubmit: onSubmitForm,
|
|
36613
|
+
isLoading: isFetching,
|
|
36614
|
+
error: error
|
|
36257
36615
|
}));
|
|
36258
36616
|
};
|
|
36259
36617
|
|