@opengeoweb/workspace 6.0.3 → 6.1.0
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.esm.js +1769 -817
- package/package.json +13 -11
- package/src/lib/components/MapPresetsFormDialog/MapPresetsFormDialog.stories.d.ts +8 -0
- package/src/lib/components/ViewPresetMenu/{ViewPresetMenuListConnect.stories.d.ts → ViewPresetMenu.stories.d.ts} +2 -2
- package/src/lib/components/WorkspaceFilter/WorkspaceFilter.d.ts +3 -2
- package/src/lib/components/WorkspaceMenu/WorkspaceMenu.d.ts +0 -2
- package/src/lib/components/WorkspaceMenu/WorkspaceMenu.stories.d.ts +0 -14
- package/src/lib/components/WorkspaceMenu/utils.d.ts +5 -0
- package/src/lib/components/WorkspaceMenu/utils.spec.d.ts +1 -0
- package/src/lib/components/WorkspacePresetsFormDialog/WorkspacePresetsFormDialog.d.ts +1 -0
- package/src/lib/components/WorkspaceSelectList/WorkspaceSelectList.d.ts +3 -1
- package/src/lib/components/WorkspaceSelectList/WorkspaceSelectListRow.d.ts +1 -0
- package/src/lib/components/WorkspaceTab/WorkspaceTabConnect.integration.spec.d.ts +1 -0
- package/src/lib/store/viewPresets/types.d.ts +1 -1
- package/src/lib/store/viewPresets/utils.d.ts +1 -0
- package/src/lib/store/workspace/selectors.d.ts +3 -15
- package/src/lib/store/workspaceList/types.d.ts +2 -1
- package/src/lib/components/WorkspaceSelectList/WorkspaceSelectList.stories.d.ts +0 -19
package/index.esm.js
CHANGED
|
@@ -3,19 +3,401 @@ import { createApiInstance, createNonAuthApiInstance, getApi, createFakeApiInsta
|
|
|
3
3
|
import { getLeaves, MosaicContext, getAndAssertNodeAtPathExists, createBalancedTreeFromLeaves, MosaicWindow, MosaicWithoutDragDropContext } from 'react-mosaic-component';
|
|
4
4
|
import { isAxiosError, getAxiosErrorMessage, withEggs, useConfirmationDialog, CustomIconButton, AlertBanner, CustomTooltip, SearchHighlight, ToggleMenu, usePrevious, ToolContainer, CustomToggleButton, ConfirmationServiceProvider, ConfirmationDialog } from '@opengeoweb/shared';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import React__default, { useContext, useRef, useCallback, useDebugValue, createContext, memo, useEffect, forwardRef } from 'react';
|
|
6
|
+
import React__default, { useContext, useRef, useCallback, useDebugValue, createContext, memo, useEffect, createElement, PureComponent, forwardRef } from 'react';
|
|
7
7
|
import { ThemeWrapper, lightTheme, Menu, SplitVertical, SplitHorizontal, Expand, UnExpand, Close, Delete, Preset, PresetWorkspace, PresetTiles, Search, Clear, WebAssetOff } from '@opengeoweb/theme';
|
|
8
8
|
import { unstable_batchedUpdates } from 'react-dom';
|
|
9
9
|
import { SnackbarWrapperConnect } from '@opengeoweb/core';
|
|
10
10
|
import { timeSeriesModuleConfig } from '@opengeoweb/timeseries';
|
|
11
11
|
import { AuthenticationProvider, useAuthenticationContext } from '@opengeoweb/authentication';
|
|
12
12
|
import { jsx } from 'react/jsx-runtime';
|
|
13
|
-
import { useTheme as useTheme$2, LinearProgress, Typography, ListItem, ListItemButton, ListItemIcon, ListItemText, Grid,
|
|
13
|
+
import { useTheme as useTheme$2, LinearProgress, Typography, ListItem, ListItemButton, ListItemIcon, ListItemText, Grid, Chip, Stack, debounce as debounce$1, TextField, InputAdornment, Box as Box$2, Backdrop, Menu as Menu$1, ListSubheader, MenuItem, Tabs } from '@mui/material';
|
|
14
14
|
import 'react-mosaic-component/react-mosaic-component.css';
|
|
15
15
|
import { ReactHookFormTextField, ReactHookFormHiddenInput, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
16
16
|
|
|
17
17
|
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;
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
|
|
21
|
+
*
|
|
22
|
+
* Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
|
|
23
|
+
* during build.
|
|
24
|
+
* @param {number} code
|
|
25
|
+
*/
|
|
26
|
+
function formatProdErrorMessage(code) {
|
|
27
|
+
return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. ';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Inlined version of the `symbol-observable` polyfill
|
|
31
|
+
var $$observable = (function () {
|
|
32
|
+
return typeof Symbol === 'function' && Symbol.observable || '@@observable';
|
|
33
|
+
})();
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* These are private action types reserved by Redux.
|
|
37
|
+
* For any unknown actions, you must return the current state.
|
|
38
|
+
* If the current state is undefined, you must return the initial state.
|
|
39
|
+
* Do not reference these action types directly in your code.
|
|
40
|
+
*/
|
|
41
|
+
var randomString = function randomString() {
|
|
42
|
+
return Math.random().toString(36).substring(7).split('').join('.');
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var ActionTypes = {
|
|
46
|
+
INIT: "@@redux/INIT" + randomString(),
|
|
47
|
+
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
48
|
+
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
49
|
+
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {any} obj The object to inspect.
|
|
55
|
+
* @returns {boolean} True if the argument appears to be a plain object.
|
|
56
|
+
*/
|
|
57
|
+
function isPlainObject$2(obj) {
|
|
58
|
+
if (typeof obj !== 'object' || obj === null) return false;
|
|
59
|
+
var proto = obj;
|
|
60
|
+
|
|
61
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
62
|
+
proto = Object.getPrototypeOf(proto);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return Object.getPrototypeOf(obj) === proto;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
|
|
69
|
+
function miniKindOf(val) {
|
|
70
|
+
if (val === void 0) return 'undefined';
|
|
71
|
+
if (val === null) return 'null';
|
|
72
|
+
var type = typeof val;
|
|
73
|
+
|
|
74
|
+
switch (type) {
|
|
75
|
+
case 'boolean':
|
|
76
|
+
case 'string':
|
|
77
|
+
case 'number':
|
|
78
|
+
case 'symbol':
|
|
79
|
+
case 'function':
|
|
80
|
+
{
|
|
81
|
+
return type;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (Array.isArray(val)) return 'array';
|
|
86
|
+
if (isDate(val)) return 'date';
|
|
87
|
+
if (isError(val)) return 'error';
|
|
88
|
+
var constructorName = ctorName(val);
|
|
89
|
+
|
|
90
|
+
switch (constructorName) {
|
|
91
|
+
case 'Symbol':
|
|
92
|
+
case 'Promise':
|
|
93
|
+
case 'WeakMap':
|
|
94
|
+
case 'WeakSet':
|
|
95
|
+
case 'Map':
|
|
96
|
+
case 'Set':
|
|
97
|
+
return constructorName;
|
|
98
|
+
} // other
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function ctorName(val) {
|
|
105
|
+
return typeof val.constructor === 'function' ? val.constructor.name : null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function isError(val) {
|
|
109
|
+
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isDate(val) {
|
|
113
|
+
if (val instanceof Date) return true;
|
|
114
|
+
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function kindOf(val) {
|
|
118
|
+
var typeOfVal = typeof val;
|
|
119
|
+
|
|
120
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
121
|
+
typeOfVal = miniKindOf(val);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return typeOfVal;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @deprecated
|
|
129
|
+
*
|
|
130
|
+
* **We recommend using the `configureStore` method
|
|
131
|
+
* of the `@reduxjs/toolkit` package**, which replaces `createStore`.
|
|
132
|
+
*
|
|
133
|
+
* Redux Toolkit is our recommended approach for writing Redux logic today,
|
|
134
|
+
* including store setup, reducers, data fetching, and more.
|
|
135
|
+
*
|
|
136
|
+
* **For more details, please read this Redux docs page:**
|
|
137
|
+
* **https://redux.js.org/introduction/why-rtk-is-redux-today**
|
|
138
|
+
*
|
|
139
|
+
* `configureStore` from Redux Toolkit is an improved version of `createStore` that
|
|
140
|
+
* simplifies setup and helps avoid common bugs.
|
|
141
|
+
*
|
|
142
|
+
* You should not be using the `redux` core package by itself today, except for learning purposes.
|
|
143
|
+
* The `createStore` method from the core `redux` package will not be removed, but we encourage
|
|
144
|
+
* all users to migrate to using Redux Toolkit for all Redux code.
|
|
145
|
+
*
|
|
146
|
+
* If you want to use `createStore` without this visual deprecation warning, use
|
|
147
|
+
* the `legacy_createStore` import instead:
|
|
148
|
+
*
|
|
149
|
+
* `import { legacy_createStore as createStore} from 'redux'`
|
|
150
|
+
*
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
function createStore(reducer, preloadedState, enhancer) {
|
|
154
|
+
var _ref2;
|
|
155
|
+
|
|
156
|
+
if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
|
|
157
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
|
161
|
+
enhancer = preloadedState;
|
|
162
|
+
preloadedState = undefined;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (typeof enhancer !== 'undefined') {
|
|
166
|
+
if (typeof enhancer !== 'function') {
|
|
167
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(1) : "Expected the enhancer to be a function. Instead, received: '" + kindOf(enhancer) + "'");
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return enhancer(createStore)(reducer, preloadedState);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (typeof reducer !== 'function') {
|
|
174
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(2) : "Expected the root reducer to be a function. Instead, received: '" + kindOf(reducer) + "'");
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
var currentReducer = reducer;
|
|
178
|
+
var currentState = preloadedState;
|
|
179
|
+
var currentListeners = [];
|
|
180
|
+
var nextListeners = currentListeners;
|
|
181
|
+
var isDispatching = false;
|
|
182
|
+
/**
|
|
183
|
+
* This makes a shallow copy of currentListeners so we can use
|
|
184
|
+
* nextListeners as a temporary list while dispatching.
|
|
185
|
+
*
|
|
186
|
+
* This prevents any bugs around consumers calling
|
|
187
|
+
* subscribe/unsubscribe in the middle of a dispatch.
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
function ensureCanMutateNextListeners() {
|
|
191
|
+
if (nextListeners === currentListeners) {
|
|
192
|
+
nextListeners = currentListeners.slice();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Reads the state tree managed by the store.
|
|
197
|
+
*
|
|
198
|
+
* @returns {any} The current state tree of your application.
|
|
199
|
+
*/
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
function getState() {
|
|
203
|
+
if (isDispatching) {
|
|
204
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(3) : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return currentState;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Adds a change listener. It will be called any time an action is dispatched,
|
|
211
|
+
* and some part of the state tree may potentially have changed. You may then
|
|
212
|
+
* call `getState()` to read the current state tree inside the callback.
|
|
213
|
+
*
|
|
214
|
+
* You may call `dispatch()` from a change listener, with the following
|
|
215
|
+
* caveats:
|
|
216
|
+
*
|
|
217
|
+
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
|
|
218
|
+
* If you subscribe or unsubscribe while the listeners are being invoked, this
|
|
219
|
+
* will not have any effect on the `dispatch()` that is currently in progress.
|
|
220
|
+
* However, the next `dispatch()` call, whether nested or not, will use a more
|
|
221
|
+
* recent snapshot of the subscription list.
|
|
222
|
+
*
|
|
223
|
+
* 2. The listener should not expect to see all state changes, as the state
|
|
224
|
+
* might have been updated multiple times during a nested `dispatch()` before
|
|
225
|
+
* the listener is called. It is, however, guaranteed that all subscribers
|
|
226
|
+
* registered before the `dispatch()` started will be called with the latest
|
|
227
|
+
* state by the time it exits.
|
|
228
|
+
*
|
|
229
|
+
* @param {Function} listener A callback to be invoked on every dispatch.
|
|
230
|
+
* @returns {Function} A function to remove this change listener.
|
|
231
|
+
*/
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
function subscribe(listener) {
|
|
235
|
+
if (typeof listener !== 'function') {
|
|
236
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(4) : "Expected the listener to be a function. Instead, received: '" + kindOf(listener) + "'");
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (isDispatching) {
|
|
240
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(5) : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
var isSubscribed = true;
|
|
244
|
+
ensureCanMutateNextListeners();
|
|
245
|
+
nextListeners.push(listener);
|
|
246
|
+
return function unsubscribe() {
|
|
247
|
+
if (!isSubscribed) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (isDispatching) {
|
|
252
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(6) : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
isSubscribed = false;
|
|
256
|
+
ensureCanMutateNextListeners();
|
|
257
|
+
var index = nextListeners.indexOf(listener);
|
|
258
|
+
nextListeners.splice(index, 1);
|
|
259
|
+
currentListeners = null;
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Dispatches an action. It is the only way to trigger a state change.
|
|
264
|
+
*
|
|
265
|
+
* The `reducer` function, used to create the store, will be called with the
|
|
266
|
+
* current state tree and the given `action`. Its return value will
|
|
267
|
+
* be considered the **next** state of the tree, and the change listeners
|
|
268
|
+
* will be notified.
|
|
269
|
+
*
|
|
270
|
+
* The base implementation only supports plain object actions. If you want to
|
|
271
|
+
* dispatch a Promise, an Observable, a thunk, or something else, you need to
|
|
272
|
+
* wrap your store creating function into the corresponding middleware. For
|
|
273
|
+
* example, see the documentation for the `redux-thunk` package. Even the
|
|
274
|
+
* middleware will eventually dispatch plain object actions using this method.
|
|
275
|
+
*
|
|
276
|
+
* @param {Object} action A plain object representing “what changed”. It is
|
|
277
|
+
* a good idea to keep actions serializable so you can record and replay user
|
|
278
|
+
* sessions, or use the time travelling `redux-devtools`. An action must have
|
|
279
|
+
* a `type` property which may not be `undefined`. It is a good idea to use
|
|
280
|
+
* string constants for action types.
|
|
281
|
+
*
|
|
282
|
+
* @returns {Object} For convenience, the same action object you dispatched.
|
|
283
|
+
*
|
|
284
|
+
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
|
285
|
+
* return something else (for example, a Promise you can await).
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
function dispatch(action) {
|
|
290
|
+
if (!isPlainObject$2(action)) {
|
|
291
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(7) : "Actions must be plain objects. Instead, the actual type was: '" + kindOf(action) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (typeof action.type === 'undefined') {
|
|
295
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (isDispatching) {
|
|
299
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(9) : 'Reducers may not dispatch actions.');
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
try {
|
|
303
|
+
isDispatching = true;
|
|
304
|
+
currentState = currentReducer(currentState, action);
|
|
305
|
+
} finally {
|
|
306
|
+
isDispatching = false;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
var listeners = currentListeners = nextListeners;
|
|
310
|
+
|
|
311
|
+
for (var i = 0; i < listeners.length; i++) {
|
|
312
|
+
var listener = listeners[i];
|
|
313
|
+
listener();
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return action;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Replaces the reducer currently used by the store to calculate the state.
|
|
320
|
+
*
|
|
321
|
+
* You might need this if your app implements code splitting and you want to
|
|
322
|
+
* load some of the reducers dynamically. You might also need this if you
|
|
323
|
+
* implement a hot reloading mechanism for Redux.
|
|
324
|
+
*
|
|
325
|
+
* @param {Function} nextReducer The reducer for the store to use instead.
|
|
326
|
+
* @returns {void}
|
|
327
|
+
*/
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
function replaceReducer(nextReducer) {
|
|
331
|
+
if (typeof nextReducer !== 'function') {
|
|
332
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(10) : "Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer));
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
|
|
336
|
+
// Any reducers that existed in both the new and old rootReducer
|
|
337
|
+
// will receive the previous state. This effectively populates
|
|
338
|
+
// the new state tree with any relevant data from the old one.
|
|
339
|
+
|
|
340
|
+
dispatch({
|
|
341
|
+
type: ActionTypes.REPLACE
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Interoperability point for observable/reactive libraries.
|
|
346
|
+
* @returns {observable} A minimal observable of state changes.
|
|
347
|
+
* For more information, see the observable proposal:
|
|
348
|
+
* https://github.com/tc39/proposal-observable
|
|
349
|
+
*/
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
function observable() {
|
|
353
|
+
var _ref;
|
|
354
|
+
|
|
355
|
+
var outerSubscribe = subscribe;
|
|
356
|
+
return _ref = {
|
|
357
|
+
/**
|
|
358
|
+
* The minimal observable subscription method.
|
|
359
|
+
* @param {Object} observer Any object that can be used as an observer.
|
|
360
|
+
* The observer object should have a `next` method.
|
|
361
|
+
* @returns {subscription} An object with an `unsubscribe` method that can
|
|
362
|
+
* be used to unsubscribe the observable from the store, and prevent further
|
|
363
|
+
* emission of values from the observable.
|
|
364
|
+
*/
|
|
365
|
+
subscribe: function subscribe(observer) {
|
|
366
|
+
if (typeof observer !== 'object' || observer === null) {
|
|
367
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'");
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function observeState() {
|
|
371
|
+
if (observer.next) {
|
|
372
|
+
observer.next(getState());
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
observeState();
|
|
377
|
+
var unsubscribe = outerSubscribe(observeState);
|
|
378
|
+
return {
|
|
379
|
+
unsubscribe: unsubscribe
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
}, _ref[$$observable] = function () {
|
|
383
|
+
return this;
|
|
384
|
+
}, _ref;
|
|
385
|
+
} // When a store is created, an "INIT" action is dispatched so that every
|
|
386
|
+
// reducer returns their initial state. This effectively populates
|
|
387
|
+
// the initial state tree.
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
dispatch({
|
|
391
|
+
type: ActionTypes.INIT
|
|
392
|
+
});
|
|
393
|
+
return _ref2 = {
|
|
394
|
+
dispatch: dispatch,
|
|
395
|
+
subscribe: subscribe,
|
|
396
|
+
getState: getState,
|
|
397
|
+
replaceReducer: replaceReducer
|
|
398
|
+
}, _ref2[$$observable] = observable, _ref2;
|
|
399
|
+
}
|
|
400
|
+
|
|
19
401
|
// Cache implementation based on Erik Rasmussen's `lru-memoize`:
|
|
20
402
|
// https://github.com/erikras/lru-memoize
|
|
21
403
|
var NOT_FOUND = 'NOT_FOUND';
|
|
@@ -371,7 +753,7 @@ var createDraftSafeSelector = function () {
|
|
|
371
753
|
return wrappedSelector;
|
|
372
754
|
};
|
|
373
755
|
// src/isPlainObject.ts
|
|
374
|
-
function isPlainObject$
|
|
756
|
+
function isPlainObject$1(value) {
|
|
375
757
|
if (typeof value !== "object" || value === null)
|
|
376
758
|
return false;
|
|
377
759
|
var proto = Object.getPrototypeOf(value);
|
|
@@ -490,7 +872,7 @@ function createAction(type, prepareAction) {
|
|
|
490
872
|
return actionCreator;
|
|
491
873
|
}
|
|
492
874
|
function isAction(action) {
|
|
493
|
-
return isPlainObject$
|
|
875
|
+
return isPlainObject$1(action) && "type" in action;
|
|
494
876
|
}
|
|
495
877
|
function isFSA(action) {
|
|
496
878
|
return isAction(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey);
|
|
@@ -19563,9 +19945,204 @@ var PresetAction;
|
|
|
19563
19945
|
PresetAction["SAVE"] = "Save";
|
|
19564
19946
|
PresetAction["SAVE_AS"] = "Save as";
|
|
19565
19947
|
PresetAction["SHARE"] = "Share";
|
|
19566
|
-
PresetAction["
|
|
19948
|
+
PresetAction["EDIT"] = "Edit";
|
|
19567
19949
|
})(PresetAction || (PresetAction = {}));
|
|
19568
19950
|
|
|
19951
|
+
/* *
|
|
19952
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
19953
|
+
* you may not use this file except in compliance with the License.
|
|
19954
|
+
* You may obtain a copy of the License at
|
|
19955
|
+
*
|
|
19956
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19957
|
+
*
|
|
19958
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19959
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19960
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19961
|
+
* See the License for the specific language governing permissions and
|
|
19962
|
+
* limitations under the License.
|
|
19963
|
+
*
|
|
19964
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
19965
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
19966
|
+
* */
|
|
19967
|
+
var getCleanSearchQuery = function getCleanSearchQuery(searchQuery) {
|
|
19968
|
+
return searchQuery.trim().split(/\s+/).join();
|
|
19969
|
+
};
|
|
19970
|
+
|
|
19971
|
+
/* *
|
|
19972
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
19973
|
+
* you may not use this file except in compliance with the License.
|
|
19974
|
+
* You may obtain a copy of the License at
|
|
19975
|
+
*
|
|
19976
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19977
|
+
*
|
|
19978
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19979
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19980
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19981
|
+
* See the License for the specific language governing permissions and
|
|
19982
|
+
* limitations under the License.
|
|
19983
|
+
*
|
|
19984
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
19985
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
19986
|
+
* */
|
|
19987
|
+
var MAPPRESET_ACTIVE_TITLE = 'New map preset';
|
|
19988
|
+
var MAPPRESET_DIALOG_TITLE_SAVE_AS = 'Save map preset as';
|
|
19989
|
+
var MAPPRESET_DIALOG_TITLE_DELETE = 'Delete map preset';
|
|
19990
|
+
var MAPPRESET_DIALOG_TITLE_EDIT = 'Edit map preset';
|
|
19991
|
+
var getSnackbarMessage$1 = function getSnackbarMessage(action, title) {
|
|
19992
|
+
// Trim and add quotes
|
|
19993
|
+
var trimmedTitle = "\"".concat(title.trim(), "\"");
|
|
19994
|
+
switch (action) {
|
|
19995
|
+
case PresetAction.DELETE:
|
|
19996
|
+
return "Map preset ".concat(trimmedTitle, " successfully deleted");
|
|
19997
|
+
case PresetAction.SAVE_AS:
|
|
19998
|
+
return "New map preset ".concat(trimmedTitle, " successfully saved");
|
|
19999
|
+
case PresetAction.EDIT:
|
|
20000
|
+
return "Map preset ".concat(trimmedTitle, " successfully edited");
|
|
20001
|
+
default:
|
|
20002
|
+
return "Map preset ".concat(trimmedTitle, " successfully saved");
|
|
20003
|
+
}
|
|
20004
|
+
};
|
|
20005
|
+
var getPresetsApi = function getPresetsApi() {
|
|
20006
|
+
return getApi(API_NAME);
|
|
20007
|
+
};
|
|
20008
|
+
var emptyMapViewPreset = {
|
|
20009
|
+
componentType: 'Map',
|
|
20010
|
+
keywords: '',
|
|
20011
|
+
scope: 'user',
|
|
20012
|
+
title: '',
|
|
20013
|
+
initialProps: {
|
|
20014
|
+
mapPreset: {}
|
|
20015
|
+
}
|
|
20016
|
+
};
|
|
20017
|
+
// Returns object of applied user filters such as scope/search etc
|
|
20018
|
+
// If all filter chips are selected, an empty string is returned for that filter which is interpreted in the BE as "return all" _
|
|
20019
|
+
var constructFilterParams$1 = function constructFilterParams(filters, searchQuery) {
|
|
20020
|
+
// get filters
|
|
20021
|
+
var isAllSelectedForFilters = filters.every(function (filter) {
|
|
20022
|
+
return filter.isSelected;
|
|
20023
|
+
});
|
|
20024
|
+
// If all filters are selected, ensure we return nothing for scope
|
|
20025
|
+
var _ref = isAllSelectedForFilters ? {
|
|
20026
|
+
scope: []
|
|
20027
|
+
} : filters.reduce(function (filterList, filter) {
|
|
20028
|
+
if (filter.isSelected && filter.type === 'scope') {
|
|
20029
|
+
return Object.assign(Object.assign({}, filter), {
|
|
20030
|
+
scope: filterList.scope.concat(filter.id)
|
|
20031
|
+
});
|
|
20032
|
+
}
|
|
20033
|
+
return filterList;
|
|
20034
|
+
}, {
|
|
20035
|
+
scope: []
|
|
20036
|
+
}),
|
|
20037
|
+
scope = _ref.scope;
|
|
20038
|
+
// get search
|
|
20039
|
+
var search = getCleanSearchQuery(searchQuery);
|
|
20040
|
+
return Object.assign(Object.assign({}, scope.length && {
|
|
20041
|
+
scope: scope.toString()
|
|
20042
|
+
}), search.length && {
|
|
20043
|
+
search: search
|
|
20044
|
+
});
|
|
20045
|
+
};
|
|
20046
|
+
|
|
20047
|
+
/* *
|
|
20048
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
20049
|
+
* you may not use this file except in compliance with the License.
|
|
20050
|
+
* You may obtain a copy of the License at
|
|
20051
|
+
*
|
|
20052
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
20053
|
+
*
|
|
20054
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
20055
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20056
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20057
|
+
* See the License for the specific language governing permissions and
|
|
20058
|
+
* limitations under the License.
|
|
20059
|
+
*
|
|
20060
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
20061
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
20062
|
+
* */
|
|
20063
|
+
var getSnackbarMessage = function getSnackbarMessage(action, title) {
|
|
20064
|
+
// Trim and add quotes
|
|
20065
|
+
var trimmedTitle = "\"".concat(title.trim(), "\"");
|
|
20066
|
+
switch (action) {
|
|
20067
|
+
case WorkspacePresetAction.SAVE_ALL:
|
|
20068
|
+
return "Workspace ".concat(trimmedTitle, " and underlying viewpresets successfully saved");
|
|
20069
|
+
case WorkspacePresetAction.DELETE:
|
|
20070
|
+
return "Workspace ".concat(trimmedTitle, " successfully deleted");
|
|
20071
|
+
case WorkspacePresetAction.DUPLICATE:
|
|
20072
|
+
return "Workspace ".concat(trimmedTitle, " successfully saved");
|
|
20073
|
+
case WorkspacePresetAction.EDIT:
|
|
20074
|
+
return "Workspace ".concat(trimmedTitle, " successfully edited");
|
|
20075
|
+
default:
|
|
20076
|
+
return "Workspace ".concat(trimmedTitle, " successfully saved");
|
|
20077
|
+
}
|
|
20078
|
+
};
|
|
20079
|
+
var emptyMapWorkspace = {
|
|
20080
|
+
title: 'New workspace',
|
|
20081
|
+
scope: 'system',
|
|
20082
|
+
"abstract": '',
|
|
20083
|
+
views: {
|
|
20084
|
+
allIds: ['1_screen'],
|
|
20085
|
+
byId: {
|
|
20086
|
+
'1_screen': {
|
|
20087
|
+
title: MAPPRESET_ACTIVE_TITLE,
|
|
20088
|
+
componentType: 'Map',
|
|
20089
|
+
initialProps: {
|
|
20090
|
+
mapPreset: {
|
|
20091
|
+
layers: [],
|
|
20092
|
+
proj: {
|
|
20093
|
+
bbox: {
|
|
20094
|
+
left: 58703.6377,
|
|
20095
|
+
bottom: 6408480.4514,
|
|
20096
|
+
right: 3967387.5161,
|
|
20097
|
+
top: 11520588.9031
|
|
20098
|
+
},
|
|
20099
|
+
srs: 'EPSG:3857'
|
|
20100
|
+
},
|
|
20101
|
+
shouldShowLayerManager: true,
|
|
20102
|
+
dockedLayerManagerSize: 'sizeSmall'
|
|
20103
|
+
},
|
|
20104
|
+
syncGroupsIds: []
|
|
20105
|
+
}
|
|
20106
|
+
}
|
|
20107
|
+
}
|
|
20108
|
+
},
|
|
20109
|
+
mosaicNode: '1_screen',
|
|
20110
|
+
viewType: 'singleWindow'
|
|
20111
|
+
};
|
|
20112
|
+
var constructFilterParams = function constructFilterParams(filters, searchQuery) {
|
|
20113
|
+
// get filters
|
|
20114
|
+
var _filters$reduce = filters.reduce(function (filterList, filter) {
|
|
20115
|
+
if (filter.isSelected && filter.type === 'scope') {
|
|
20116
|
+
return Object.assign(Object.assign({}, filter), {
|
|
20117
|
+
scope: filterList.scope.concat(filter.id)
|
|
20118
|
+
});
|
|
20119
|
+
}
|
|
20120
|
+
return filterList;
|
|
20121
|
+
}, {
|
|
20122
|
+
scope: []
|
|
20123
|
+
}),
|
|
20124
|
+
scope = _filters$reduce.scope;
|
|
20125
|
+
// get search
|
|
20126
|
+
var search = getCleanSearchQuery(searchQuery);
|
|
20127
|
+
return Object.assign(Object.assign({}, scope.length && {
|
|
20128
|
+
scope: scope.toString()
|
|
20129
|
+
}), search.length && {
|
|
20130
|
+
search: search
|
|
20131
|
+
});
|
|
20132
|
+
};
|
|
20133
|
+
// TODO: better to use a lib for this. Currently this is only used in workspace 'save all', and will probably be replaced by a backend solution
|
|
20134
|
+
// https://stackoverflow.com/questions/6248666/how-to-generate-short-uid-like-ax4j9z-in-js
|
|
20135
|
+
var generateUID = function generateUID() {
|
|
20136
|
+
var firstPart = Math.random() * 46656 || 0;
|
|
20137
|
+
var secondPart = Math.random() * 46656 || 0;
|
|
20138
|
+
var firstPartCombined = "000".concat(firstPart.toString(36)).slice(-3);
|
|
20139
|
+
var secondPartCombined = "000".concat(secondPart.toString(36)).slice(-3);
|
|
20140
|
+
return firstPartCombined + secondPartCombined;
|
|
20141
|
+
};
|
|
20142
|
+
var getGeneratedViewPresetTitle = function getGeneratedViewPresetTitle(workspaceTitle, uid) {
|
|
20143
|
+
return "".concat(workspaceTitle, " - viewpreset ").concat(uid);
|
|
20144
|
+
};
|
|
20145
|
+
|
|
19569
20146
|
/* *
|
|
19570
20147
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
19571
20148
|
* you may not use this file except in compliance with the License.
|
|
@@ -19751,6 +20328,19 @@ var slice$2 = createSlice({
|
|
|
19751
20328
|
if (action.payload.action === WorkspacePresetAction.SAVE) {
|
|
19752
20329
|
draft.hasChanges = false;
|
|
19753
20330
|
}
|
|
20331
|
+
if (action.payload.action === WorkspacePresetAction.EDIT) {
|
|
20332
|
+
draft.title = action.payload.title;
|
|
20333
|
+
draft["abstract"] = action.payload["abstract"];
|
|
20334
|
+
}
|
|
20335
|
+
// If current selected workspace is deleted
|
|
20336
|
+
// Remove the id, rename to empty workspace and set it has changes
|
|
20337
|
+
if (action.payload.action === WorkspacePresetAction.DELETE && action.payload.workspaceId === draft.id) {
|
|
20338
|
+
delete draft.id;
|
|
20339
|
+
draft.title = emptyMapWorkspace.title;
|
|
20340
|
+
draft["abstract"] = emptyMapWorkspace["abstract"];
|
|
20341
|
+
draft.scope = emptyMapWorkspace.scope;
|
|
20342
|
+
draft.hasChanges = true;
|
|
20343
|
+
}
|
|
19754
20344
|
}).addCase(viewPresetActions.fetchedViewPreset, function (draft, action) {
|
|
19755
20345
|
var _action$payload3 = action.payload,
|
|
19756
20346
|
panelId = _action$payload3.panelId,
|
|
@@ -19876,99 +20466,6 @@ var getViewPresetListFilterResultsForView = createSelector(getViewPresetById, fu
|
|
|
19876
20466
|
return Object.values(filteredResults.entities);
|
|
19877
20467
|
});
|
|
19878
20468
|
|
|
19879
|
-
/* *
|
|
19880
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
19881
|
-
* you may not use this file except in compliance with the License.
|
|
19882
|
-
* You may obtain a copy of the License at
|
|
19883
|
-
*
|
|
19884
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19885
|
-
*
|
|
19886
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19887
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19888
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19889
|
-
* See the License for the specific language governing permissions and
|
|
19890
|
-
* limitations under the License.
|
|
19891
|
-
*
|
|
19892
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
19893
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
19894
|
-
* */
|
|
19895
|
-
var getCleanSearchQuery = function getCleanSearchQuery(searchQuery) {
|
|
19896
|
-
return searchQuery.trim().split(/\s+/).join();
|
|
19897
|
-
};
|
|
19898
|
-
|
|
19899
|
-
/* *
|
|
19900
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
19901
|
-
* you may not use this file except in compliance with the License.
|
|
19902
|
-
* You may obtain a copy of the License at
|
|
19903
|
-
*
|
|
19904
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19905
|
-
*
|
|
19906
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
19907
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19908
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19909
|
-
* See the License for the specific language governing permissions and
|
|
19910
|
-
* limitations under the License.
|
|
19911
|
-
*
|
|
19912
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
19913
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
19914
|
-
* */
|
|
19915
|
-
var MAPPRESET_ACTIVE_TITLE = 'New map preset';
|
|
19916
|
-
var MAPPRESET_DIALOG_TITLE_SAVE_AS = 'Save map preset as';
|
|
19917
|
-
var MAPPRESET_DIALOG_TITLE_DELETE = 'Delete map preset';
|
|
19918
|
-
var getSnackbarMessage$1 = function getSnackbarMessage(action, title) {
|
|
19919
|
-
// Trim and add quotes
|
|
19920
|
-
var trimmedTitle = "\"".concat(title.trim(), "\"");
|
|
19921
|
-
switch (action) {
|
|
19922
|
-
case PresetAction.DELETE:
|
|
19923
|
-
return "Map preset ".concat(trimmedTitle, " successfully deleted");
|
|
19924
|
-
case PresetAction.SAVE_AS:
|
|
19925
|
-
return "New map preset ".concat(trimmedTitle, " successfully saved");
|
|
19926
|
-
default:
|
|
19927
|
-
return "Map preset ".concat(trimmedTitle, " successfully saved");
|
|
19928
|
-
}
|
|
19929
|
-
};
|
|
19930
|
-
var getPresetsApi = function getPresetsApi() {
|
|
19931
|
-
return getApi(API_NAME);
|
|
19932
|
-
};
|
|
19933
|
-
var emptyMapViewPreset = {
|
|
19934
|
-
componentType: 'Map',
|
|
19935
|
-
keywords: '',
|
|
19936
|
-
scope: 'user',
|
|
19937
|
-
title: '',
|
|
19938
|
-
initialProps: {
|
|
19939
|
-
mapPreset: {}
|
|
19940
|
-
}
|
|
19941
|
-
};
|
|
19942
|
-
// Returns object of applied user filters such as scope/search etc
|
|
19943
|
-
// If all filter chips are selected, an empty string is returned for that filter which is interpreted in the BE as "return all" _
|
|
19944
|
-
var constructFilterParams$1 = function constructFilterParams(filters, searchQuery) {
|
|
19945
|
-
// get filters
|
|
19946
|
-
var isAllSelectedForFilters = filters.every(function (filter) {
|
|
19947
|
-
return filter.isSelected;
|
|
19948
|
-
});
|
|
19949
|
-
// If all filters are selected, ensure we return nothing for scope
|
|
19950
|
-
var _ref = isAllSelectedForFilters ? {
|
|
19951
|
-
scope: []
|
|
19952
|
-
} : filters.reduce(function (filterList, filter) {
|
|
19953
|
-
if (filter.isSelected && filter.type === 'scope') {
|
|
19954
|
-
return Object.assign(Object.assign({}, filter), {
|
|
19955
|
-
scope: filterList.scope.concat(filter.id)
|
|
19956
|
-
});
|
|
19957
|
-
}
|
|
19958
|
-
return filterList;
|
|
19959
|
-
}, {
|
|
19960
|
-
scope: []
|
|
19961
|
-
}),
|
|
19962
|
-
scope = _ref.scope;
|
|
19963
|
-
// get search
|
|
19964
|
-
var search = getCleanSearchQuery(searchQuery);
|
|
19965
|
-
return Object.assign(Object.assign({}, scope.length && {
|
|
19966
|
-
scope: scope.toString()
|
|
19967
|
-
}), search.length && {
|
|
19968
|
-
search: search
|
|
19969
|
-
});
|
|
19970
|
-
};
|
|
19971
|
-
|
|
19972
20469
|
/* *
|
|
19973
20470
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
19974
20471
|
* you may not use this file except in compliance with the License.
|
|
@@ -20104,6 +20601,10 @@ var getWorkspaceData = createSelector(getWorkspaceState, getViewPresetsStore, ge
|
|
|
20104
20601
|
"abstract": store["abstract"],
|
|
20105
20602
|
mosaicNode: store.mosaicNode
|
|
20106
20603
|
};
|
|
20604
|
+
}, {
|
|
20605
|
+
memoizeOptions: {
|
|
20606
|
+
resultEqualityCheck: lodash.exports.isEqual
|
|
20607
|
+
}
|
|
20107
20608
|
});
|
|
20108
20609
|
var getViewPresetToSendToBackend = createSelector(getViewById, mapSelectors.getMapPreset, syncGroupsSelectors.getAllTargetGroupsForSource, function (workspaceView, mapPreset, syncGroupsIds) {
|
|
20109
20610
|
var title = (workspaceView === null || workspaceView === void 0 ? void 0 : workspaceView.title) || MAPPRESET_ACTIVE_TITLE;
|
|
@@ -20923,7 +21424,7 @@ var workspacePresetsList = [
|
|
|
20923
21424
|
title: "Radar",
|
|
20924
21425
|
date: "2022-06-01T12:34:27.787184",
|
|
20925
21426
|
scope: "user",
|
|
20926
|
-
abstract: "",
|
|
21427
|
+
abstract: "Some abstract",
|
|
20927
21428
|
viewType: "singleWindow"
|
|
20928
21429
|
},
|
|
20929
21430
|
{
|
|
@@ -23318,103 +23819,6 @@ var WorkspaceListErrorType;
|
|
|
23318
23819
|
WorkspaceListErrorType["GENERIC"] = "GENERIC";
|
|
23319
23820
|
})(WorkspaceListErrorType || (WorkspaceListErrorType = {}));
|
|
23320
23821
|
|
|
23321
|
-
/* *
|
|
23322
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
23323
|
-
* you may not use this file except in compliance with the License.
|
|
23324
|
-
* You may obtain a copy of the License at
|
|
23325
|
-
*
|
|
23326
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
23327
|
-
*
|
|
23328
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
23329
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
23330
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23331
|
-
* See the License for the specific language governing permissions and
|
|
23332
|
-
* limitations under the License.
|
|
23333
|
-
*
|
|
23334
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
23335
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
23336
|
-
* */
|
|
23337
|
-
var getSnackbarMessage = function getSnackbarMessage(action, title) {
|
|
23338
|
-
// Trim and add quotes
|
|
23339
|
-
var trimmedTitle = "\"".concat(title.trim(), "\"");
|
|
23340
|
-
switch (action) {
|
|
23341
|
-
case WorkspacePresetAction.SAVE_ALL:
|
|
23342
|
-
return "Workspace ".concat(trimmedTitle, " and underlying viewpresets successfully saved");
|
|
23343
|
-
case WorkspacePresetAction.DELETE:
|
|
23344
|
-
return "Workspace ".concat(trimmedTitle, " successfully deleted");
|
|
23345
|
-
case WorkspacePresetAction.DUPLICATE:
|
|
23346
|
-
return "Workspace ".concat(trimmedTitle, " successfully saved");
|
|
23347
|
-
default:
|
|
23348
|
-
return "Workspace ".concat(trimmedTitle, " successfully saved");
|
|
23349
|
-
}
|
|
23350
|
-
};
|
|
23351
|
-
var emptyMapWorkspace = {
|
|
23352
|
-
title: 'New workspace',
|
|
23353
|
-
scope: 'system',
|
|
23354
|
-
"abstract": '',
|
|
23355
|
-
views: {
|
|
23356
|
-
allIds: ['1_screen'],
|
|
23357
|
-
byId: {
|
|
23358
|
-
'1_screen': {
|
|
23359
|
-
title: MAPPRESET_ACTIVE_TITLE,
|
|
23360
|
-
componentType: 'Map',
|
|
23361
|
-
initialProps: {
|
|
23362
|
-
mapPreset: {
|
|
23363
|
-
layers: [],
|
|
23364
|
-
proj: {
|
|
23365
|
-
bbox: {
|
|
23366
|
-
left: 58703.6377,
|
|
23367
|
-
bottom: 6408480.4514,
|
|
23368
|
-
right: 3967387.5161,
|
|
23369
|
-
top: 11520588.9031
|
|
23370
|
-
},
|
|
23371
|
-
srs: 'EPSG:3857'
|
|
23372
|
-
},
|
|
23373
|
-
shouldShowLayerManager: true,
|
|
23374
|
-
dockedLayerManagerSize: 'sizeSmall'
|
|
23375
|
-
},
|
|
23376
|
-
syncGroupsIds: []
|
|
23377
|
-
}
|
|
23378
|
-
}
|
|
23379
|
-
}
|
|
23380
|
-
},
|
|
23381
|
-
mosaicNode: '1_screen',
|
|
23382
|
-
viewType: 'singleWindow'
|
|
23383
|
-
};
|
|
23384
|
-
var constructFilterParams = function constructFilterParams(filters, searchQuery) {
|
|
23385
|
-
// get filters
|
|
23386
|
-
var _filters$reduce = filters.reduce(function (filterList, filter) {
|
|
23387
|
-
if (filter.isSelected && filter.type === 'scope') {
|
|
23388
|
-
return Object.assign(Object.assign({}, filter), {
|
|
23389
|
-
scope: filterList.scope.concat(filter.id)
|
|
23390
|
-
});
|
|
23391
|
-
}
|
|
23392
|
-
return filterList;
|
|
23393
|
-
}, {
|
|
23394
|
-
scope: []
|
|
23395
|
-
}),
|
|
23396
|
-
scope = _filters$reduce.scope;
|
|
23397
|
-
// get search
|
|
23398
|
-
var search = getCleanSearchQuery(searchQuery);
|
|
23399
|
-
return Object.assign(Object.assign({}, scope.length && {
|
|
23400
|
-
scope: scope.toString()
|
|
23401
|
-
}), search.length && {
|
|
23402
|
-
search: search
|
|
23403
|
-
});
|
|
23404
|
-
};
|
|
23405
|
-
// TODO: better to use a lib for this. Currently this is only used in workspace 'save all', and will probably be replaced by a backend solution
|
|
23406
|
-
// https://stackoverflow.com/questions/6248666/how-to-generate-short-uid-like-ax4j9z-in-js
|
|
23407
|
-
var generateUID = function generateUID() {
|
|
23408
|
-
var firstPart = Math.random() * 46656 || 0;
|
|
23409
|
-
var secondPart = Math.random() * 46656 || 0;
|
|
23410
|
-
var firstPartCombined = "000".concat(firstPart.toString(36)).slice(-3);
|
|
23411
|
-
var secondPartCombined = "000".concat(secondPart.toString(36)).slice(-3);
|
|
23412
|
-
return firstPartCombined + secondPartCombined;
|
|
23413
|
-
};
|
|
23414
|
-
var getGeneratedViewPresetTitle = function getGeneratedViewPresetTitle(workspaceTitle, uid) {
|
|
23415
|
-
return "".concat(workspaceTitle, " - viewpreset ").concat(uid);
|
|
23416
|
-
};
|
|
23417
|
-
|
|
23418
23822
|
/* *
|
|
23419
23823
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
23420
23824
|
* you may not use this file except in compliance with the License.
|
|
@@ -23521,7 +23925,7 @@ function fetchWorkspaceListSaga(_ref) {
|
|
|
23521
23925
|
function onSuccessWorkspacePresetsActionSaga(_ref2) {
|
|
23522
23926
|
var payload = _ref2.payload;
|
|
23523
23927
|
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
23524
|
-
var action, workspaceId, title,
|
|
23928
|
+
var action, workspaceId, title, workspaceFilters, searchQuery;
|
|
23525
23929
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
23526
23930
|
while (1) switch (_context2.prev = _context2.next) {
|
|
23527
23931
|
case 0:
|
|
@@ -23531,44 +23935,35 @@ function onSuccessWorkspacePresetsActionSaga(_ref2) {
|
|
|
23531
23935
|
message: getSnackbarMessage(action, title)
|
|
23532
23936
|
}));
|
|
23533
23937
|
case 3:
|
|
23534
|
-
|
|
23535
|
-
|
|
23536
|
-
case 5:
|
|
23537
|
-
selectedWorkspace = _context2.sent;
|
|
23538
|
-
if (!(action === WorkspacePresetAction.DELETE && workspaceId === (selectedWorkspace === null || selectedWorkspace === void 0 ? void 0 : selectedWorkspace.id))) {
|
|
23539
|
-
_context2.next = 11;
|
|
23938
|
+
if (!(action === WorkspacePresetAction.DELETE && payload.currentActiveWorkspaceId && workspaceId === payload.currentActiveWorkspaceId)) {
|
|
23939
|
+
_context2.next = 6;
|
|
23540
23940
|
break;
|
|
23541
23941
|
}
|
|
23542
|
-
_context2.next =
|
|
23942
|
+
_context2.next = 6;
|
|
23543
23943
|
return put(routerActions.navigateToUrl({
|
|
23544
23944
|
url: getWorkspaceRouteUrl()
|
|
23545
23945
|
}));
|
|
23546
|
-
case
|
|
23547
|
-
_context2.next = 11;
|
|
23548
|
-
return put(workspaceActions.changePreset({
|
|
23549
|
-
workspacePreset: emptyMapWorkspace
|
|
23550
|
-
}));
|
|
23551
|
-
case 11:
|
|
23946
|
+
case 6:
|
|
23552
23947
|
if (!(action === WorkspacePresetAction.SAVE_AS)) {
|
|
23553
|
-
_context2.next =
|
|
23948
|
+
_context2.next = 9;
|
|
23554
23949
|
break;
|
|
23555
23950
|
}
|
|
23556
|
-
_context2.next =
|
|
23951
|
+
_context2.next = 9;
|
|
23557
23952
|
return put(routerActions.navigateToUrl({
|
|
23558
23953
|
url: getWorkspaceRouteUrl(workspaceId)
|
|
23559
23954
|
}));
|
|
23560
|
-
case
|
|
23561
|
-
_context2.next =
|
|
23955
|
+
case 9:
|
|
23956
|
+
_context2.next = 11;
|
|
23562
23957
|
return select(getWorkspaceListFilters);
|
|
23563
|
-
case
|
|
23958
|
+
case 11:
|
|
23564
23959
|
workspaceFilters = _context2.sent;
|
|
23565
|
-
_context2.next =
|
|
23960
|
+
_context2.next = 14;
|
|
23566
23961
|
return select(getWorkspaceListSearchQuery);
|
|
23567
|
-
case
|
|
23962
|
+
case 14:
|
|
23568
23963
|
searchQuery = _context2.sent;
|
|
23569
|
-
_context2.next =
|
|
23964
|
+
_context2.next = 17;
|
|
23570
23965
|
return call(fetchWorkspaceListSaga, workspaceListActions.fetchWorkspaceList(constructFilterParams(workspaceFilters, searchQuery)));
|
|
23571
|
-
case
|
|
23966
|
+
case 17:
|
|
23572
23967
|
case "end":
|
|
23573
23968
|
return _context2.stop();
|
|
23574
23969
|
}
|
|
@@ -23658,7 +24053,7 @@ function saveAllViewPresetSaga(viewPresetEntity, workspaceTitle) {
|
|
|
23658
24053
|
function submitFormWorkspaceDialogSaga(_ref3) {
|
|
23659
24054
|
var payload = _ref3.payload;
|
|
23660
24055
|
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
23661
|
-
var workspaceApi, presetId, presetAction, data, newId, isNewWorkspace, _ref4, presetToDuplicate, fullPreset, _newId, workspace, isNew, workspaceId, views, savedViewPresetResult, errorMessage, workspaceData, newWorkspace, message;
|
|
24056
|
+
var workspaceApi, presetId, presetAction, data, newId, isNewWorkspace, _ref4, presetToDuplicate, fullPreset, _newId, selectedWorkspace, _yield$call2, originalData, workspaceDataNewTitle, workspace, isNew, workspaceId, views, savedViewPresetResult, errorMessage, workspaceData, newWorkspace, message;
|
|
23662
24057
|
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
|
23663
24058
|
while (1) switch (_context4.prev = _context4.next) {
|
|
23664
24059
|
case 0:
|
|
@@ -23718,65 +24113,94 @@ function submitFormWorkspaceDialogSaga(_ref3) {
|
|
|
23718
24113
|
}));
|
|
23719
24114
|
case 28:
|
|
23720
24115
|
if (!(presetAction === WorkspacePresetAction.DELETE)) {
|
|
23721
|
-
_context4.next =
|
|
24116
|
+
_context4.next = 36;
|
|
23722
24117
|
break;
|
|
23723
24118
|
}
|
|
23724
24119
|
_context4.next = 31;
|
|
23725
24120
|
return call(workspaceApi.deleteWorkspacePreset, presetId);
|
|
23726
24121
|
case 31:
|
|
23727
24122
|
_context4.next = 33;
|
|
24123
|
+
return select(getWorkspaceState);
|
|
24124
|
+
case 33:
|
|
24125
|
+
selectedWorkspace = _context4.sent;
|
|
24126
|
+
_context4.next = 36;
|
|
23728
24127
|
return put(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
23729
24128
|
workspaceId: presetId,
|
|
23730
24129
|
action: presetAction,
|
|
23731
|
-
title: data.title
|
|
24130
|
+
title: data.title,
|
|
24131
|
+
currentActiveWorkspaceId: selectedWorkspace.id
|
|
23732
24132
|
}));
|
|
23733
|
-
case
|
|
24133
|
+
case 36:
|
|
24134
|
+
if (!(presetAction === WorkspacePresetAction.EDIT)) {
|
|
24135
|
+
_context4.next = 46;
|
|
24136
|
+
break;
|
|
24137
|
+
}
|
|
24138
|
+
_context4.next = 39;
|
|
24139
|
+
return call(workspaceApi.getWorkspacePreset, presetId);
|
|
24140
|
+
case 39:
|
|
24141
|
+
_yield$call2 = _context4.sent;
|
|
24142
|
+
originalData = _yield$call2.data;
|
|
24143
|
+
workspaceDataNewTitle = Object.assign(Object.assign({}, originalData), {
|
|
24144
|
+
title: data.title,
|
|
24145
|
+
"abstract": data["abstract"]
|
|
24146
|
+
});
|
|
24147
|
+
_context4.next = 44;
|
|
24148
|
+
return call(workspaceApi.saveWorkspacePreset, presetId, workspaceDataNewTitle);
|
|
24149
|
+
case 44:
|
|
24150
|
+
_context4.next = 46;
|
|
24151
|
+
return put(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
24152
|
+
workspaceId: presetId,
|
|
24153
|
+
action: presetAction,
|
|
24154
|
+
title: data.title,
|
|
24155
|
+
"abstract": data["abstract"]
|
|
24156
|
+
}));
|
|
24157
|
+
case 46:
|
|
23734
24158
|
if (!(presetAction === WorkspacePresetAction.SAVE_ALL)) {
|
|
23735
|
-
_context4.next =
|
|
24159
|
+
_context4.next = 79;
|
|
23736
24160
|
break;
|
|
23737
24161
|
}
|
|
23738
|
-
_context4.next =
|
|
24162
|
+
_context4.next = 49;
|
|
23739
24163
|
return select(getWorkspaceState);
|
|
23740
|
-
case
|
|
24164
|
+
case 49:
|
|
23741
24165
|
workspace = _context4.sent;
|
|
23742
24166
|
// first save a new workspace to make sure we have an unique title
|
|
23743
24167
|
isNew = !workspace.scope || workspace.scope === 'system';
|
|
23744
24168
|
if (!isNew) {
|
|
23745
|
-
_context4.next =
|
|
24169
|
+
_context4.next = 57;
|
|
23746
24170
|
break;
|
|
23747
24171
|
}
|
|
23748
|
-
_context4.next =
|
|
24172
|
+
_context4.next = 54;
|
|
23749
24173
|
return call(workspaceApi.saveWorkspacePresetAs, data);
|
|
23750
|
-
case
|
|
24174
|
+
case 54:
|
|
23751
24175
|
_context4.t1 = _context4.sent;
|
|
23752
|
-
_context4.next =
|
|
24176
|
+
_context4.next = 58;
|
|
23753
24177
|
break;
|
|
23754
|
-
case
|
|
24178
|
+
case 57:
|
|
23755
24179
|
_context4.t1 = data.id;
|
|
23756
|
-
case
|
|
24180
|
+
case 58:
|
|
23757
24181
|
workspaceId = _context4.t1;
|
|
23758
|
-
_context4.next =
|
|
24182
|
+
_context4.next = 61;
|
|
23759
24183
|
return select(getViewPresets);
|
|
23760
|
-
case
|
|
24184
|
+
case 61:
|
|
23761
24185
|
views = _context4.sent;
|
|
23762
|
-
_context4.next =
|
|
24186
|
+
_context4.next = 64;
|
|
23763
24187
|
return all(views.map(function (view) {
|
|
23764
24188
|
return call(saveAllViewPresetSaga, view, data.title);
|
|
23765
24189
|
}));
|
|
23766
|
-
case
|
|
24190
|
+
case 64:
|
|
23767
24191
|
savedViewPresetResult = _context4.sent;
|
|
23768
24192
|
errorMessage = savedViewPresetResult.find(function (viewPresetResult) {
|
|
23769
24193
|
return typeof viewPresetResult === 'string';
|
|
23770
24194
|
});
|
|
23771
24195
|
if (!errorMessage) {
|
|
23772
|
-
_context4.next =
|
|
24196
|
+
_context4.next = 68;
|
|
23773
24197
|
break;
|
|
23774
24198
|
}
|
|
23775
24199
|
throw new Error(errorMessage);
|
|
23776
|
-
case
|
|
23777
|
-
_context4.next =
|
|
24200
|
+
case 68:
|
|
24201
|
+
_context4.next = 70;
|
|
23778
24202
|
return select(getWorkspaceData);
|
|
23779
|
-
case
|
|
24203
|
+
case 70:
|
|
23780
24204
|
workspaceData = _context4.sent;
|
|
23781
24205
|
newWorkspace = Object.assign(Object.assign({}, workspaceData), {
|
|
23782
24206
|
id: workspaceId,
|
|
@@ -23784,44 +24208,44 @@ function submitFormWorkspaceDialogSaga(_ref3) {
|
|
|
23784
24208
|
title: data.title,
|
|
23785
24209
|
"abstract": data["abstract"]
|
|
23786
24210
|
});
|
|
23787
|
-
_context4.next =
|
|
24211
|
+
_context4.next = 74;
|
|
23788
24212
|
return call(workspaceApi.saveWorkspacePreset, workspaceId, newWorkspace);
|
|
23789
|
-
case
|
|
23790
|
-
_context4.next =
|
|
24213
|
+
case 74:
|
|
24214
|
+
_context4.next = 76;
|
|
23791
24215
|
return put(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
23792
24216
|
action: WorkspacePresetAction.SAVE_ALL,
|
|
23793
24217
|
workspaceId: workspaceId,
|
|
23794
24218
|
title: newWorkspace.title,
|
|
23795
24219
|
"abstract": newWorkspace["abstract"]
|
|
23796
24220
|
}));
|
|
23797
|
-
case
|
|
24221
|
+
case 76:
|
|
23798
24222
|
if (!isNew) {
|
|
23799
|
-
_context4.next =
|
|
24223
|
+
_context4.next = 79;
|
|
23800
24224
|
break;
|
|
23801
24225
|
}
|
|
23802
|
-
_context4.next =
|
|
24226
|
+
_context4.next = 79;
|
|
23803
24227
|
return put(routerActions.navigateToUrl({
|
|
23804
24228
|
url: getWorkspaceRouteUrl(workspaceId)
|
|
23805
24229
|
}));
|
|
23806
|
-
case
|
|
23807
|
-
_context4.next =
|
|
24230
|
+
case 79:
|
|
24231
|
+
_context4.next = 86;
|
|
23808
24232
|
break;
|
|
23809
|
-
case
|
|
23810
|
-
_context4.prev =
|
|
24233
|
+
case 81:
|
|
24234
|
+
_context4.prev = 81;
|
|
23811
24235
|
_context4.t2 = _context4["catch"](3);
|
|
23812
24236
|
message = isAxiosError(_context4.t2) ? getAxiosErrorMessage(_context4.t2) : _context4.t2.message;
|
|
23813
|
-
_context4.next =
|
|
24237
|
+
_context4.next = 86;
|
|
23814
24238
|
return put(workspaceListActions.onErrorWorkspacePresetAction({
|
|
23815
24239
|
error: {
|
|
23816
24240
|
type: WorkspaceListErrorType.GENERIC,
|
|
23817
24241
|
message: message
|
|
23818
24242
|
}
|
|
23819
24243
|
}));
|
|
23820
|
-
case
|
|
24244
|
+
case 86:
|
|
23821
24245
|
case "end":
|
|
23822
24246
|
return _context4.stop();
|
|
23823
24247
|
}
|
|
23824
|
-
}, _callee3, null, [[3,
|
|
24248
|
+
}, _callee3, null, [[3, 81]]);
|
|
23825
24249
|
})();
|
|
23826
24250
|
}
|
|
23827
24251
|
function rootSaga$1() {
|
|
@@ -24078,32 +24502,36 @@ function onSuccessViewPresetActionSaga(_ref4) {
|
|
|
24078
24502
|
filterParams: constructFilterParams$1(viewPresetFilters, viewPresetSearchQuery)
|
|
24079
24503
|
}));
|
|
24080
24504
|
case 18:
|
|
24081
|
-
|
|
24505
|
+
if (!(action !== PresetAction.EDIT)) {
|
|
24506
|
+
_context5.next = 21;
|
|
24507
|
+
break;
|
|
24508
|
+
}
|
|
24509
|
+
_context5.next = 21;
|
|
24082
24510
|
return put(viewPresetActions.setViewPresetHasChanges({
|
|
24083
24511
|
panelId: panelId,
|
|
24084
24512
|
hasChanges: false
|
|
24085
24513
|
}));
|
|
24086
|
-
case
|
|
24514
|
+
case 21:
|
|
24087
24515
|
if (!(action === PresetAction.SAVE_AS && viewPresetId)) {
|
|
24088
|
-
_context5.next =
|
|
24516
|
+
_context5.next = 24;
|
|
24089
24517
|
break;
|
|
24090
24518
|
}
|
|
24091
|
-
_context5.next =
|
|
24519
|
+
_context5.next = 24;
|
|
24092
24520
|
return put(viewPresetActions.setActiveViewPresetId({
|
|
24093
24521
|
panelId: panelId,
|
|
24094
24522
|
viewPresetId: viewPresetId
|
|
24095
24523
|
}));
|
|
24096
|
-
case
|
|
24097
|
-
_context5.next =
|
|
24524
|
+
case 24:
|
|
24525
|
+
_context5.next = 28;
|
|
24098
24526
|
break;
|
|
24099
|
-
case
|
|
24100
|
-
_context5.prev =
|
|
24527
|
+
case 26:
|
|
24528
|
+
_context5.prev = 26;
|
|
24101
24529
|
_context5.t0 = _context5["catch"](1);
|
|
24102
|
-
case
|
|
24530
|
+
case 28:
|
|
24103
24531
|
case "end":
|
|
24104
24532
|
return _context5.stop();
|
|
24105
24533
|
}
|
|
24106
|
-
}, _callee4, null, [[1,
|
|
24534
|
+
}, _callee4, null, [[1, 26]]);
|
|
24107
24535
|
})();
|
|
24108
24536
|
}
|
|
24109
24537
|
function rootSaga() {
|
|
@@ -27429,422 +27857,6 @@ var DragDropManagerImpl = /*#__PURE__*/function () {
|
|
|
27429
27857
|
return DragDropManagerImpl;
|
|
27430
27858
|
}();
|
|
27431
27859
|
|
|
27432
|
-
/**
|
|
27433
|
-
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
|
|
27434
|
-
*
|
|
27435
|
-
* Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
|
|
27436
|
-
* during build.
|
|
27437
|
-
* @param {number} code
|
|
27438
|
-
*/
|
|
27439
|
-
function formatProdErrorMessage(code) {
|
|
27440
|
-
return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. ';
|
|
27441
|
-
}
|
|
27442
|
-
|
|
27443
|
-
// Inlined version of the `symbol-observable` polyfill
|
|
27444
|
-
var $$observable = (function () {
|
|
27445
|
-
return typeof Symbol === 'function' && Symbol.observable || '@@observable';
|
|
27446
|
-
})();
|
|
27447
|
-
|
|
27448
|
-
/**
|
|
27449
|
-
* These are private action types reserved by Redux.
|
|
27450
|
-
* For any unknown actions, you must return the current state.
|
|
27451
|
-
* If the current state is undefined, you must return the initial state.
|
|
27452
|
-
* Do not reference these action types directly in your code.
|
|
27453
|
-
*/
|
|
27454
|
-
var randomString = function randomString() {
|
|
27455
|
-
return Math.random().toString(36).substring(7).split('').join('.');
|
|
27456
|
-
};
|
|
27457
|
-
|
|
27458
|
-
var ActionTypes = {
|
|
27459
|
-
INIT: "@@redux/INIT" + randomString(),
|
|
27460
|
-
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
27461
|
-
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
27462
|
-
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
27463
|
-
}
|
|
27464
|
-
};
|
|
27465
|
-
|
|
27466
|
-
/**
|
|
27467
|
-
* @param {any} obj The object to inspect.
|
|
27468
|
-
* @returns {boolean} True if the argument appears to be a plain object.
|
|
27469
|
-
*/
|
|
27470
|
-
function isPlainObject$1(obj) {
|
|
27471
|
-
if (typeof obj !== 'object' || obj === null) return false;
|
|
27472
|
-
var proto = obj;
|
|
27473
|
-
|
|
27474
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
27475
|
-
proto = Object.getPrototypeOf(proto);
|
|
27476
|
-
}
|
|
27477
|
-
|
|
27478
|
-
return Object.getPrototypeOf(obj) === proto;
|
|
27479
|
-
}
|
|
27480
|
-
|
|
27481
|
-
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
|
|
27482
|
-
function miniKindOf(val) {
|
|
27483
|
-
if (val === void 0) return 'undefined';
|
|
27484
|
-
if (val === null) return 'null';
|
|
27485
|
-
var type = typeof val;
|
|
27486
|
-
|
|
27487
|
-
switch (type) {
|
|
27488
|
-
case 'boolean':
|
|
27489
|
-
case 'string':
|
|
27490
|
-
case 'number':
|
|
27491
|
-
case 'symbol':
|
|
27492
|
-
case 'function':
|
|
27493
|
-
{
|
|
27494
|
-
return type;
|
|
27495
|
-
}
|
|
27496
|
-
}
|
|
27497
|
-
|
|
27498
|
-
if (Array.isArray(val)) return 'array';
|
|
27499
|
-
if (isDate(val)) return 'date';
|
|
27500
|
-
if (isError(val)) return 'error';
|
|
27501
|
-
var constructorName = ctorName(val);
|
|
27502
|
-
|
|
27503
|
-
switch (constructorName) {
|
|
27504
|
-
case 'Symbol':
|
|
27505
|
-
case 'Promise':
|
|
27506
|
-
case 'WeakMap':
|
|
27507
|
-
case 'WeakSet':
|
|
27508
|
-
case 'Map':
|
|
27509
|
-
case 'Set':
|
|
27510
|
-
return constructorName;
|
|
27511
|
-
} // other
|
|
27512
|
-
|
|
27513
|
-
|
|
27514
|
-
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
|
|
27515
|
-
}
|
|
27516
|
-
|
|
27517
|
-
function ctorName(val) {
|
|
27518
|
-
return typeof val.constructor === 'function' ? val.constructor.name : null;
|
|
27519
|
-
}
|
|
27520
|
-
|
|
27521
|
-
function isError(val) {
|
|
27522
|
-
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
|
|
27523
|
-
}
|
|
27524
|
-
|
|
27525
|
-
function isDate(val) {
|
|
27526
|
-
if (val instanceof Date) return true;
|
|
27527
|
-
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
|
|
27528
|
-
}
|
|
27529
|
-
|
|
27530
|
-
function kindOf(val) {
|
|
27531
|
-
var typeOfVal = typeof val;
|
|
27532
|
-
|
|
27533
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
27534
|
-
typeOfVal = miniKindOf(val);
|
|
27535
|
-
}
|
|
27536
|
-
|
|
27537
|
-
return typeOfVal;
|
|
27538
|
-
}
|
|
27539
|
-
|
|
27540
|
-
/**
|
|
27541
|
-
* @deprecated
|
|
27542
|
-
*
|
|
27543
|
-
* **We recommend using the `configureStore` method
|
|
27544
|
-
* of the `@reduxjs/toolkit` package**, which replaces `createStore`.
|
|
27545
|
-
*
|
|
27546
|
-
* Redux Toolkit is our recommended approach for writing Redux logic today,
|
|
27547
|
-
* including store setup, reducers, data fetching, and more.
|
|
27548
|
-
*
|
|
27549
|
-
* **For more details, please read this Redux docs page:**
|
|
27550
|
-
* **https://redux.js.org/introduction/why-rtk-is-redux-today**
|
|
27551
|
-
*
|
|
27552
|
-
* `configureStore` from Redux Toolkit is an improved version of `createStore` that
|
|
27553
|
-
* simplifies setup and helps avoid common bugs.
|
|
27554
|
-
*
|
|
27555
|
-
* You should not be using the `redux` core package by itself today, except for learning purposes.
|
|
27556
|
-
* The `createStore` method from the core `redux` package will not be removed, but we encourage
|
|
27557
|
-
* all users to migrate to using Redux Toolkit for all Redux code.
|
|
27558
|
-
*
|
|
27559
|
-
* If you want to use `createStore` without this visual deprecation warning, use
|
|
27560
|
-
* the `legacy_createStore` import instead:
|
|
27561
|
-
*
|
|
27562
|
-
* `import { legacy_createStore as createStore} from 'redux'`
|
|
27563
|
-
*
|
|
27564
|
-
*/
|
|
27565
|
-
|
|
27566
|
-
function createStore(reducer, preloadedState, enhancer) {
|
|
27567
|
-
var _ref2;
|
|
27568
|
-
|
|
27569
|
-
if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
|
|
27570
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');
|
|
27571
|
-
}
|
|
27572
|
-
|
|
27573
|
-
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
|
27574
|
-
enhancer = preloadedState;
|
|
27575
|
-
preloadedState = undefined;
|
|
27576
|
-
}
|
|
27577
|
-
|
|
27578
|
-
if (typeof enhancer !== 'undefined') {
|
|
27579
|
-
if (typeof enhancer !== 'function') {
|
|
27580
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(1) : "Expected the enhancer to be a function. Instead, received: '" + kindOf(enhancer) + "'");
|
|
27581
|
-
}
|
|
27582
|
-
|
|
27583
|
-
return enhancer(createStore)(reducer, preloadedState);
|
|
27584
|
-
}
|
|
27585
|
-
|
|
27586
|
-
if (typeof reducer !== 'function') {
|
|
27587
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(2) : "Expected the root reducer to be a function. Instead, received: '" + kindOf(reducer) + "'");
|
|
27588
|
-
}
|
|
27589
|
-
|
|
27590
|
-
var currentReducer = reducer;
|
|
27591
|
-
var currentState = preloadedState;
|
|
27592
|
-
var currentListeners = [];
|
|
27593
|
-
var nextListeners = currentListeners;
|
|
27594
|
-
var isDispatching = false;
|
|
27595
|
-
/**
|
|
27596
|
-
* This makes a shallow copy of currentListeners so we can use
|
|
27597
|
-
* nextListeners as a temporary list while dispatching.
|
|
27598
|
-
*
|
|
27599
|
-
* This prevents any bugs around consumers calling
|
|
27600
|
-
* subscribe/unsubscribe in the middle of a dispatch.
|
|
27601
|
-
*/
|
|
27602
|
-
|
|
27603
|
-
function ensureCanMutateNextListeners() {
|
|
27604
|
-
if (nextListeners === currentListeners) {
|
|
27605
|
-
nextListeners = currentListeners.slice();
|
|
27606
|
-
}
|
|
27607
|
-
}
|
|
27608
|
-
/**
|
|
27609
|
-
* Reads the state tree managed by the store.
|
|
27610
|
-
*
|
|
27611
|
-
* @returns {any} The current state tree of your application.
|
|
27612
|
-
*/
|
|
27613
|
-
|
|
27614
|
-
|
|
27615
|
-
function getState() {
|
|
27616
|
-
if (isDispatching) {
|
|
27617
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(3) : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
|
|
27618
|
-
}
|
|
27619
|
-
|
|
27620
|
-
return currentState;
|
|
27621
|
-
}
|
|
27622
|
-
/**
|
|
27623
|
-
* Adds a change listener. It will be called any time an action is dispatched,
|
|
27624
|
-
* and some part of the state tree may potentially have changed. You may then
|
|
27625
|
-
* call `getState()` to read the current state tree inside the callback.
|
|
27626
|
-
*
|
|
27627
|
-
* You may call `dispatch()` from a change listener, with the following
|
|
27628
|
-
* caveats:
|
|
27629
|
-
*
|
|
27630
|
-
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
|
|
27631
|
-
* If you subscribe or unsubscribe while the listeners are being invoked, this
|
|
27632
|
-
* will not have any effect on the `dispatch()` that is currently in progress.
|
|
27633
|
-
* However, the next `dispatch()` call, whether nested or not, will use a more
|
|
27634
|
-
* recent snapshot of the subscription list.
|
|
27635
|
-
*
|
|
27636
|
-
* 2. The listener should not expect to see all state changes, as the state
|
|
27637
|
-
* might have been updated multiple times during a nested `dispatch()` before
|
|
27638
|
-
* the listener is called. It is, however, guaranteed that all subscribers
|
|
27639
|
-
* registered before the `dispatch()` started will be called with the latest
|
|
27640
|
-
* state by the time it exits.
|
|
27641
|
-
*
|
|
27642
|
-
* @param {Function} listener A callback to be invoked on every dispatch.
|
|
27643
|
-
* @returns {Function} A function to remove this change listener.
|
|
27644
|
-
*/
|
|
27645
|
-
|
|
27646
|
-
|
|
27647
|
-
function subscribe(listener) {
|
|
27648
|
-
if (typeof listener !== 'function') {
|
|
27649
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(4) : "Expected the listener to be a function. Instead, received: '" + kindOf(listener) + "'");
|
|
27650
|
-
}
|
|
27651
|
-
|
|
27652
|
-
if (isDispatching) {
|
|
27653
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(5) : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
|
|
27654
|
-
}
|
|
27655
|
-
|
|
27656
|
-
var isSubscribed = true;
|
|
27657
|
-
ensureCanMutateNextListeners();
|
|
27658
|
-
nextListeners.push(listener);
|
|
27659
|
-
return function unsubscribe() {
|
|
27660
|
-
if (!isSubscribed) {
|
|
27661
|
-
return;
|
|
27662
|
-
}
|
|
27663
|
-
|
|
27664
|
-
if (isDispatching) {
|
|
27665
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(6) : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
|
|
27666
|
-
}
|
|
27667
|
-
|
|
27668
|
-
isSubscribed = false;
|
|
27669
|
-
ensureCanMutateNextListeners();
|
|
27670
|
-
var index = nextListeners.indexOf(listener);
|
|
27671
|
-
nextListeners.splice(index, 1);
|
|
27672
|
-
currentListeners = null;
|
|
27673
|
-
};
|
|
27674
|
-
}
|
|
27675
|
-
/**
|
|
27676
|
-
* Dispatches an action. It is the only way to trigger a state change.
|
|
27677
|
-
*
|
|
27678
|
-
* The `reducer` function, used to create the store, will be called with the
|
|
27679
|
-
* current state tree and the given `action`. Its return value will
|
|
27680
|
-
* be considered the **next** state of the tree, and the change listeners
|
|
27681
|
-
* will be notified.
|
|
27682
|
-
*
|
|
27683
|
-
* The base implementation only supports plain object actions. If you want to
|
|
27684
|
-
* dispatch a Promise, an Observable, a thunk, or something else, you need to
|
|
27685
|
-
* wrap your store creating function into the corresponding middleware. For
|
|
27686
|
-
* example, see the documentation for the `redux-thunk` package. Even the
|
|
27687
|
-
* middleware will eventually dispatch plain object actions using this method.
|
|
27688
|
-
*
|
|
27689
|
-
* @param {Object} action A plain object representing “what changed”. It is
|
|
27690
|
-
* a good idea to keep actions serializable so you can record and replay user
|
|
27691
|
-
* sessions, or use the time travelling `redux-devtools`. An action must have
|
|
27692
|
-
* a `type` property which may not be `undefined`. It is a good idea to use
|
|
27693
|
-
* string constants for action types.
|
|
27694
|
-
*
|
|
27695
|
-
* @returns {Object} For convenience, the same action object you dispatched.
|
|
27696
|
-
*
|
|
27697
|
-
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
|
27698
|
-
* return something else (for example, a Promise you can await).
|
|
27699
|
-
*/
|
|
27700
|
-
|
|
27701
|
-
|
|
27702
|
-
function dispatch(action) {
|
|
27703
|
-
if (!isPlainObject$1(action)) {
|
|
27704
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(7) : "Actions must be plain objects. Instead, the actual type was: '" + kindOf(action) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");
|
|
27705
|
-
}
|
|
27706
|
-
|
|
27707
|
-
if (typeof action.type === 'undefined') {
|
|
27708
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
|
|
27709
|
-
}
|
|
27710
|
-
|
|
27711
|
-
if (isDispatching) {
|
|
27712
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(9) : 'Reducers may not dispatch actions.');
|
|
27713
|
-
}
|
|
27714
|
-
|
|
27715
|
-
try {
|
|
27716
|
-
isDispatching = true;
|
|
27717
|
-
currentState = currentReducer(currentState, action);
|
|
27718
|
-
} finally {
|
|
27719
|
-
isDispatching = false;
|
|
27720
|
-
}
|
|
27721
|
-
|
|
27722
|
-
var listeners = currentListeners = nextListeners;
|
|
27723
|
-
|
|
27724
|
-
for (var i = 0; i < listeners.length; i++) {
|
|
27725
|
-
var listener = listeners[i];
|
|
27726
|
-
listener();
|
|
27727
|
-
}
|
|
27728
|
-
|
|
27729
|
-
return action;
|
|
27730
|
-
}
|
|
27731
|
-
/**
|
|
27732
|
-
* Replaces the reducer currently used by the store to calculate the state.
|
|
27733
|
-
*
|
|
27734
|
-
* You might need this if your app implements code splitting and you want to
|
|
27735
|
-
* load some of the reducers dynamically. You might also need this if you
|
|
27736
|
-
* implement a hot reloading mechanism for Redux.
|
|
27737
|
-
*
|
|
27738
|
-
* @param {Function} nextReducer The reducer for the store to use instead.
|
|
27739
|
-
* @returns {void}
|
|
27740
|
-
*/
|
|
27741
|
-
|
|
27742
|
-
|
|
27743
|
-
function replaceReducer(nextReducer) {
|
|
27744
|
-
if (typeof nextReducer !== 'function') {
|
|
27745
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(10) : "Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer));
|
|
27746
|
-
}
|
|
27747
|
-
|
|
27748
|
-
currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
|
|
27749
|
-
// Any reducers that existed in both the new and old rootReducer
|
|
27750
|
-
// will receive the previous state. This effectively populates
|
|
27751
|
-
// the new state tree with any relevant data from the old one.
|
|
27752
|
-
|
|
27753
|
-
dispatch({
|
|
27754
|
-
type: ActionTypes.REPLACE
|
|
27755
|
-
});
|
|
27756
|
-
}
|
|
27757
|
-
/**
|
|
27758
|
-
* Interoperability point for observable/reactive libraries.
|
|
27759
|
-
* @returns {observable} A minimal observable of state changes.
|
|
27760
|
-
* For more information, see the observable proposal:
|
|
27761
|
-
* https://github.com/tc39/proposal-observable
|
|
27762
|
-
*/
|
|
27763
|
-
|
|
27764
|
-
|
|
27765
|
-
function observable() {
|
|
27766
|
-
var _ref;
|
|
27767
|
-
|
|
27768
|
-
var outerSubscribe = subscribe;
|
|
27769
|
-
return _ref = {
|
|
27770
|
-
/**
|
|
27771
|
-
* The minimal observable subscription method.
|
|
27772
|
-
* @param {Object} observer Any object that can be used as an observer.
|
|
27773
|
-
* The observer object should have a `next` method.
|
|
27774
|
-
* @returns {subscription} An object with an `unsubscribe` method that can
|
|
27775
|
-
* be used to unsubscribe the observable from the store, and prevent further
|
|
27776
|
-
* emission of values from the observable.
|
|
27777
|
-
*/
|
|
27778
|
-
subscribe: function subscribe(observer) {
|
|
27779
|
-
if (typeof observer !== 'object' || observer === null) {
|
|
27780
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'");
|
|
27781
|
-
}
|
|
27782
|
-
|
|
27783
|
-
function observeState() {
|
|
27784
|
-
if (observer.next) {
|
|
27785
|
-
observer.next(getState());
|
|
27786
|
-
}
|
|
27787
|
-
}
|
|
27788
|
-
|
|
27789
|
-
observeState();
|
|
27790
|
-
var unsubscribe = outerSubscribe(observeState);
|
|
27791
|
-
return {
|
|
27792
|
-
unsubscribe: unsubscribe
|
|
27793
|
-
};
|
|
27794
|
-
}
|
|
27795
|
-
}, _ref[$$observable] = function () {
|
|
27796
|
-
return this;
|
|
27797
|
-
}, _ref;
|
|
27798
|
-
} // When a store is created, an "INIT" action is dispatched so that every
|
|
27799
|
-
// reducer returns their initial state. This effectively populates
|
|
27800
|
-
// the initial state tree.
|
|
27801
|
-
|
|
27802
|
-
|
|
27803
|
-
dispatch({
|
|
27804
|
-
type: ActionTypes.INIT
|
|
27805
|
-
});
|
|
27806
|
-
return _ref2 = {
|
|
27807
|
-
dispatch: dispatch,
|
|
27808
|
-
subscribe: subscribe,
|
|
27809
|
-
getState: getState,
|
|
27810
|
-
replaceReducer: replaceReducer
|
|
27811
|
-
}, _ref2[$$observable] = observable, _ref2;
|
|
27812
|
-
}
|
|
27813
|
-
|
|
27814
|
-
/**
|
|
27815
|
-
* Prints a warning in the console if it exists.
|
|
27816
|
-
*
|
|
27817
|
-
* @param {String} message The warning message.
|
|
27818
|
-
* @returns {void}
|
|
27819
|
-
*/
|
|
27820
|
-
function warning(message) {
|
|
27821
|
-
/* eslint-disable no-console */
|
|
27822
|
-
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
|
27823
|
-
console.error(message);
|
|
27824
|
-
}
|
|
27825
|
-
/* eslint-enable no-console */
|
|
27826
|
-
|
|
27827
|
-
|
|
27828
|
-
try {
|
|
27829
|
-
// This error was thrown as a convenience so that if you enable
|
|
27830
|
-
// "break on all exceptions" in your console,
|
|
27831
|
-
// it would pause the execution at this line.
|
|
27832
|
-
throw new Error(message);
|
|
27833
|
-
} catch (e) {} // eslint-disable-line no-empty
|
|
27834
|
-
|
|
27835
|
-
}
|
|
27836
|
-
|
|
27837
|
-
/*
|
|
27838
|
-
* This is a dummy function to check if the function name has been altered by minification.
|
|
27839
|
-
* If the function has been minified and NODE_ENV !== 'production', warn the user.
|
|
27840
|
-
*/
|
|
27841
|
-
|
|
27842
|
-
function isCrushed() {}
|
|
27843
|
-
|
|
27844
|
-
if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
|
|
27845
|
-
warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
|
|
27846
|
-
}
|
|
27847
|
-
|
|
27848
27860
|
var strictEquality = function strictEquality(a, b) {
|
|
27849
27861
|
return a === b;
|
|
27850
27862
|
};
|
|
@@ -31691,22 +31703,799 @@ var getFilteredViewPresetListForView = createSelector(getViewPresetsList, getVie
|
|
|
31691
31703
|
};
|
|
31692
31704
|
});
|
|
31693
31705
|
|
|
31694
|
-
|
|
31695
|
-
|
|
31696
|
-
|
|
31697
|
-
|
|
31698
|
-
|
|
31699
|
-
|
|
31700
|
-
|
|
31701
|
-
|
|
31702
|
-
|
|
31703
|
-
|
|
31704
|
-
|
|
31705
|
-
|
|
31706
|
-
|
|
31707
|
-
|
|
31708
|
-
|
|
31709
|
-
|
|
31706
|
+
function _assertThisInitialized(self) {
|
|
31707
|
+
if (self === void 0) {
|
|
31708
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
31709
|
+
}
|
|
31710
|
+
return self;
|
|
31711
|
+
}
|
|
31712
|
+
|
|
31713
|
+
function _setPrototypeOf(o, p) {
|
|
31714
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
31715
|
+
o.__proto__ = p;
|
|
31716
|
+
return o;
|
|
31717
|
+
};
|
|
31718
|
+
return _setPrototypeOf(o, p);
|
|
31719
|
+
}
|
|
31720
|
+
|
|
31721
|
+
function _inheritsLoose(subClass, superClass) {
|
|
31722
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
31723
|
+
subClass.prototype.constructor = subClass;
|
|
31724
|
+
_setPrototypeOf(subClass, superClass);
|
|
31725
|
+
}
|
|
31726
|
+
|
|
31727
|
+
var safeIsNaN = Number.isNaN ||
|
|
31728
|
+
function ponyfill(value) {
|
|
31729
|
+
return typeof value === 'number' && value !== value;
|
|
31730
|
+
};
|
|
31731
|
+
function isEqual(first, second) {
|
|
31732
|
+
if (first === second) {
|
|
31733
|
+
return true;
|
|
31734
|
+
}
|
|
31735
|
+
if (safeIsNaN(first) && safeIsNaN(second)) {
|
|
31736
|
+
return true;
|
|
31737
|
+
}
|
|
31738
|
+
return false;
|
|
31739
|
+
}
|
|
31740
|
+
function areInputsEqual(newInputs, lastInputs) {
|
|
31741
|
+
if (newInputs.length !== lastInputs.length) {
|
|
31742
|
+
return false;
|
|
31743
|
+
}
|
|
31744
|
+
for (var i = 0; i < newInputs.length; i++) {
|
|
31745
|
+
if (!isEqual(newInputs[i], lastInputs[i])) {
|
|
31746
|
+
return false;
|
|
31747
|
+
}
|
|
31748
|
+
}
|
|
31749
|
+
return true;
|
|
31750
|
+
}
|
|
31751
|
+
|
|
31752
|
+
function memoizeOne(resultFn, isEqual) {
|
|
31753
|
+
if (isEqual === void 0) { isEqual = areInputsEqual; }
|
|
31754
|
+
var lastThis;
|
|
31755
|
+
var lastArgs = [];
|
|
31756
|
+
var lastResult;
|
|
31757
|
+
var calledOnce = false;
|
|
31758
|
+
function memoized() {
|
|
31759
|
+
var newArgs = [];
|
|
31760
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
31761
|
+
newArgs[_i] = arguments[_i];
|
|
31762
|
+
}
|
|
31763
|
+
if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
|
|
31764
|
+
return lastResult;
|
|
31765
|
+
}
|
|
31766
|
+
lastResult = resultFn.apply(this, newArgs);
|
|
31767
|
+
calledOnce = true;
|
|
31768
|
+
lastThis = this;
|
|
31769
|
+
lastArgs = newArgs;
|
|
31770
|
+
return lastResult;
|
|
31771
|
+
}
|
|
31772
|
+
return memoized;
|
|
31773
|
+
}
|
|
31774
|
+
|
|
31775
|
+
// Animation frame based implementation of setTimeout.
|
|
31776
|
+
// Inspired by Joe Lambert, https://gist.github.com/joelambert/1002116#file-requesttimeout-js
|
|
31777
|
+
var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
|
|
31778
|
+
var now = hasNativePerformanceNow ? function () {
|
|
31779
|
+
return performance.now();
|
|
31780
|
+
} : function () {
|
|
31781
|
+
return Date.now();
|
|
31782
|
+
};
|
|
31783
|
+
function cancelTimeout(timeoutID) {
|
|
31784
|
+
cancelAnimationFrame(timeoutID.id);
|
|
31785
|
+
}
|
|
31786
|
+
function requestTimeout(callback, delay) {
|
|
31787
|
+
var start = now();
|
|
31788
|
+
|
|
31789
|
+
function tick() {
|
|
31790
|
+
if (now() - start >= delay) {
|
|
31791
|
+
callback.call(null);
|
|
31792
|
+
} else {
|
|
31793
|
+
timeoutID.id = requestAnimationFrame(tick);
|
|
31794
|
+
}
|
|
31795
|
+
}
|
|
31796
|
+
|
|
31797
|
+
var timeoutID = {
|
|
31798
|
+
id: requestAnimationFrame(tick)
|
|
31799
|
+
};
|
|
31800
|
+
return timeoutID;
|
|
31801
|
+
}
|
|
31802
|
+
|
|
31803
|
+
var size = -1; // This utility copied from "dom-helpers" package.
|
|
31804
|
+
|
|
31805
|
+
function getScrollbarSize(recalculate) {
|
|
31806
|
+
if (recalculate === void 0) {
|
|
31807
|
+
recalculate = false;
|
|
31808
|
+
}
|
|
31809
|
+
|
|
31810
|
+
if (size === -1 || recalculate) {
|
|
31811
|
+
var div = document.createElement('div');
|
|
31812
|
+
var style = div.style;
|
|
31813
|
+
style.width = '50px';
|
|
31814
|
+
style.height = '50px';
|
|
31815
|
+
style.overflow = 'scroll';
|
|
31816
|
+
document.body.appendChild(div);
|
|
31817
|
+
size = div.offsetWidth - div.clientWidth;
|
|
31818
|
+
document.body.removeChild(div);
|
|
31819
|
+
}
|
|
31820
|
+
|
|
31821
|
+
return size;
|
|
31822
|
+
}
|
|
31823
|
+
var cachedRTLResult = null; // TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
|
|
31824
|
+
// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).
|
|
31825
|
+
// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.
|
|
31826
|
+
// The safest way to check this is to intentionally set a negative offset,
|
|
31827
|
+
// and then verify that the subsequent "scroll" event matches the negative offset.
|
|
31828
|
+
// If it does not match, then we can assume a non-standard RTL scroll implementation.
|
|
31829
|
+
|
|
31830
|
+
function getRTLOffsetType(recalculate) {
|
|
31831
|
+
if (recalculate === void 0) {
|
|
31832
|
+
recalculate = false;
|
|
31833
|
+
}
|
|
31834
|
+
|
|
31835
|
+
if (cachedRTLResult === null || recalculate) {
|
|
31836
|
+
var outerDiv = document.createElement('div');
|
|
31837
|
+
var outerStyle = outerDiv.style;
|
|
31838
|
+
outerStyle.width = '50px';
|
|
31839
|
+
outerStyle.height = '50px';
|
|
31840
|
+
outerStyle.overflow = 'scroll';
|
|
31841
|
+
outerStyle.direction = 'rtl';
|
|
31842
|
+
var innerDiv = document.createElement('div');
|
|
31843
|
+
var innerStyle = innerDiv.style;
|
|
31844
|
+
innerStyle.width = '100px';
|
|
31845
|
+
innerStyle.height = '100px';
|
|
31846
|
+
outerDiv.appendChild(innerDiv);
|
|
31847
|
+
document.body.appendChild(outerDiv);
|
|
31848
|
+
|
|
31849
|
+
if (outerDiv.scrollLeft > 0) {
|
|
31850
|
+
cachedRTLResult = 'positive-descending';
|
|
31851
|
+
} else {
|
|
31852
|
+
outerDiv.scrollLeft = 1;
|
|
31853
|
+
|
|
31854
|
+
if (outerDiv.scrollLeft === 0) {
|
|
31855
|
+
cachedRTLResult = 'negative';
|
|
31856
|
+
} else {
|
|
31857
|
+
cachedRTLResult = 'positive-ascending';
|
|
31858
|
+
}
|
|
31859
|
+
}
|
|
31860
|
+
|
|
31861
|
+
document.body.removeChild(outerDiv);
|
|
31862
|
+
return cachedRTLResult;
|
|
31863
|
+
}
|
|
31864
|
+
|
|
31865
|
+
return cachedRTLResult;
|
|
31866
|
+
}
|
|
31867
|
+
|
|
31868
|
+
if (process.env.NODE_ENV !== 'production') ;
|
|
31869
|
+
|
|
31870
|
+
var IS_SCROLLING_DEBOUNCE_INTERVAL$1 = 150;
|
|
31871
|
+
|
|
31872
|
+
var defaultItemKey$1 = function defaultItemKey(index, data) {
|
|
31873
|
+
return index;
|
|
31874
|
+
}; // In DEV mode, this Set helps us only log a warning once per component instance.
|
|
31875
|
+
// This avoids spamming the console every time a render happens.
|
|
31876
|
+
|
|
31877
|
+
|
|
31878
|
+
var devWarningsDirection = null;
|
|
31879
|
+
var devWarningsTagName$1 = null;
|
|
31880
|
+
|
|
31881
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
31882
|
+
if (typeof window !== 'undefined' && typeof window.WeakSet !== 'undefined') {
|
|
31883
|
+
devWarningsDirection = /*#__PURE__*/new WeakSet();
|
|
31884
|
+
devWarningsTagName$1 = /*#__PURE__*/new WeakSet();
|
|
31885
|
+
}
|
|
31886
|
+
}
|
|
31887
|
+
|
|
31888
|
+
function createListComponent(_ref) {
|
|
31889
|
+
var _class;
|
|
31890
|
+
|
|
31891
|
+
var getItemOffset = _ref.getItemOffset,
|
|
31892
|
+
getEstimatedTotalSize = _ref.getEstimatedTotalSize,
|
|
31893
|
+
getItemSize = _ref.getItemSize,
|
|
31894
|
+
getOffsetForIndexAndAlignment = _ref.getOffsetForIndexAndAlignment,
|
|
31895
|
+
getStartIndexForOffset = _ref.getStartIndexForOffset,
|
|
31896
|
+
getStopIndexForStartIndex = _ref.getStopIndexForStartIndex,
|
|
31897
|
+
initInstanceProps = _ref.initInstanceProps,
|
|
31898
|
+
shouldResetStyleCacheOnItemSizeChange = _ref.shouldResetStyleCacheOnItemSizeChange,
|
|
31899
|
+
validateProps = _ref.validateProps;
|
|
31900
|
+
return _class = /*#__PURE__*/function (_PureComponent) {
|
|
31901
|
+
_inheritsLoose(List, _PureComponent);
|
|
31902
|
+
|
|
31903
|
+
// Always use explicit constructor for React components.
|
|
31904
|
+
// It produces less code after transpilation. (#26)
|
|
31905
|
+
// eslint-disable-next-line no-useless-constructor
|
|
31906
|
+
function List(props) {
|
|
31907
|
+
var _this;
|
|
31908
|
+
|
|
31909
|
+
_this = _PureComponent.call(this, props) || this;
|
|
31910
|
+
_this._instanceProps = initInstanceProps(_this.props, _assertThisInitialized(_this));
|
|
31911
|
+
_this._outerRef = void 0;
|
|
31912
|
+
_this._resetIsScrollingTimeoutId = null;
|
|
31913
|
+
_this.state = {
|
|
31914
|
+
instance: _assertThisInitialized(_this),
|
|
31915
|
+
isScrolling: false,
|
|
31916
|
+
scrollDirection: 'forward',
|
|
31917
|
+
scrollOffset: typeof _this.props.initialScrollOffset === 'number' ? _this.props.initialScrollOffset : 0,
|
|
31918
|
+
scrollUpdateWasRequested: false
|
|
31919
|
+
};
|
|
31920
|
+
_this._callOnItemsRendered = void 0;
|
|
31921
|
+
_this._callOnItemsRendered = memoizeOne(function (overscanStartIndex, overscanStopIndex, visibleStartIndex, visibleStopIndex) {
|
|
31922
|
+
return _this.props.onItemsRendered({
|
|
31923
|
+
overscanStartIndex: overscanStartIndex,
|
|
31924
|
+
overscanStopIndex: overscanStopIndex,
|
|
31925
|
+
visibleStartIndex: visibleStartIndex,
|
|
31926
|
+
visibleStopIndex: visibleStopIndex
|
|
31927
|
+
});
|
|
31928
|
+
});
|
|
31929
|
+
_this._callOnScroll = void 0;
|
|
31930
|
+
_this._callOnScroll = memoizeOne(function (scrollDirection, scrollOffset, scrollUpdateWasRequested) {
|
|
31931
|
+
return _this.props.onScroll({
|
|
31932
|
+
scrollDirection: scrollDirection,
|
|
31933
|
+
scrollOffset: scrollOffset,
|
|
31934
|
+
scrollUpdateWasRequested: scrollUpdateWasRequested
|
|
31935
|
+
});
|
|
31936
|
+
});
|
|
31937
|
+
_this._getItemStyle = void 0;
|
|
31938
|
+
|
|
31939
|
+
_this._getItemStyle = function (index) {
|
|
31940
|
+
var _this$props = _this.props,
|
|
31941
|
+
direction = _this$props.direction,
|
|
31942
|
+
itemSize = _this$props.itemSize,
|
|
31943
|
+
layout = _this$props.layout;
|
|
31944
|
+
|
|
31945
|
+
var itemStyleCache = _this._getItemStyleCache(shouldResetStyleCacheOnItemSizeChange && itemSize, shouldResetStyleCacheOnItemSizeChange && layout, shouldResetStyleCacheOnItemSizeChange && direction);
|
|
31946
|
+
|
|
31947
|
+
var style;
|
|
31948
|
+
|
|
31949
|
+
if (itemStyleCache.hasOwnProperty(index)) {
|
|
31950
|
+
style = itemStyleCache[index];
|
|
31951
|
+
} else {
|
|
31952
|
+
var _offset = getItemOffset(_this.props, index, _this._instanceProps);
|
|
31953
|
+
|
|
31954
|
+
var size = getItemSize(_this.props, index, _this._instanceProps); // TODO Deprecate direction "horizontal"
|
|
31955
|
+
|
|
31956
|
+
var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
|
|
31957
|
+
var isRtl = direction === 'rtl';
|
|
31958
|
+
var offsetHorizontal = isHorizontal ? _offset : 0;
|
|
31959
|
+
itemStyleCache[index] = style = {
|
|
31960
|
+
position: 'absolute',
|
|
31961
|
+
left: isRtl ? undefined : offsetHorizontal,
|
|
31962
|
+
right: isRtl ? offsetHorizontal : undefined,
|
|
31963
|
+
top: !isHorizontal ? _offset : 0,
|
|
31964
|
+
height: !isHorizontal ? size : '100%',
|
|
31965
|
+
width: isHorizontal ? size : '100%'
|
|
31966
|
+
};
|
|
31967
|
+
}
|
|
31968
|
+
|
|
31969
|
+
return style;
|
|
31970
|
+
};
|
|
31971
|
+
|
|
31972
|
+
_this._getItemStyleCache = void 0;
|
|
31973
|
+
_this._getItemStyleCache = memoizeOne(function (_, __, ___) {
|
|
31974
|
+
return {};
|
|
31975
|
+
});
|
|
31976
|
+
|
|
31977
|
+
_this._onScrollHorizontal = function (event) {
|
|
31978
|
+
var _event$currentTarget = event.currentTarget,
|
|
31979
|
+
clientWidth = _event$currentTarget.clientWidth,
|
|
31980
|
+
scrollLeft = _event$currentTarget.scrollLeft,
|
|
31981
|
+
scrollWidth = _event$currentTarget.scrollWidth;
|
|
31982
|
+
|
|
31983
|
+
_this.setState(function (prevState) {
|
|
31984
|
+
if (prevState.scrollOffset === scrollLeft) {
|
|
31985
|
+
// Scroll position may have been updated by cDM/cDU,
|
|
31986
|
+
// In which case we don't need to trigger another render,
|
|
31987
|
+
// And we don't want to update state.isScrolling.
|
|
31988
|
+
return null;
|
|
31989
|
+
}
|
|
31990
|
+
|
|
31991
|
+
var direction = _this.props.direction;
|
|
31992
|
+
var scrollOffset = scrollLeft;
|
|
31993
|
+
|
|
31994
|
+
if (direction === 'rtl') {
|
|
31995
|
+
// TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
|
|
31996
|
+
// This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
|
|
31997
|
+
// It's also easier for this component if we convert offsets to the same format as they would be in for ltr.
|
|
31998
|
+
// So the simplest solution is to determine which browser behavior we're dealing with, and convert based on it.
|
|
31999
|
+
switch (getRTLOffsetType()) {
|
|
32000
|
+
case 'negative':
|
|
32001
|
+
scrollOffset = -scrollLeft;
|
|
32002
|
+
break;
|
|
32003
|
+
|
|
32004
|
+
case 'positive-descending':
|
|
32005
|
+
scrollOffset = scrollWidth - clientWidth - scrollLeft;
|
|
32006
|
+
break;
|
|
32007
|
+
}
|
|
32008
|
+
} // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.
|
|
32009
|
+
|
|
32010
|
+
|
|
32011
|
+
scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
|
|
32012
|
+
return {
|
|
32013
|
+
isScrolling: true,
|
|
32014
|
+
scrollDirection: prevState.scrollOffset < scrollLeft ? 'forward' : 'backward',
|
|
32015
|
+
scrollOffset: scrollOffset,
|
|
32016
|
+
scrollUpdateWasRequested: false
|
|
32017
|
+
};
|
|
32018
|
+
}, _this._resetIsScrollingDebounced);
|
|
32019
|
+
};
|
|
32020
|
+
|
|
32021
|
+
_this._onScrollVertical = function (event) {
|
|
32022
|
+
var _event$currentTarget2 = event.currentTarget,
|
|
32023
|
+
clientHeight = _event$currentTarget2.clientHeight,
|
|
32024
|
+
scrollHeight = _event$currentTarget2.scrollHeight,
|
|
32025
|
+
scrollTop = _event$currentTarget2.scrollTop;
|
|
32026
|
+
|
|
32027
|
+
_this.setState(function (prevState) {
|
|
32028
|
+
if (prevState.scrollOffset === scrollTop) {
|
|
32029
|
+
// Scroll position may have been updated by cDM/cDU,
|
|
32030
|
+
// In which case we don't need to trigger another render,
|
|
32031
|
+
// And we don't want to update state.isScrolling.
|
|
32032
|
+
return null;
|
|
32033
|
+
} // Prevent Safari's elastic scrolling from causing visual shaking when scrolling past bounds.
|
|
32034
|
+
|
|
32035
|
+
|
|
32036
|
+
var scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
|
|
32037
|
+
return {
|
|
32038
|
+
isScrolling: true,
|
|
32039
|
+
scrollDirection: prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',
|
|
32040
|
+
scrollOffset: scrollOffset,
|
|
32041
|
+
scrollUpdateWasRequested: false
|
|
32042
|
+
};
|
|
32043
|
+
}, _this._resetIsScrollingDebounced);
|
|
32044
|
+
};
|
|
32045
|
+
|
|
32046
|
+
_this._outerRefSetter = function (ref) {
|
|
32047
|
+
var outerRef = _this.props.outerRef;
|
|
32048
|
+
_this._outerRef = ref;
|
|
32049
|
+
|
|
32050
|
+
if (typeof outerRef === 'function') {
|
|
32051
|
+
outerRef(ref);
|
|
32052
|
+
} else if (outerRef != null && typeof outerRef === 'object' && outerRef.hasOwnProperty('current')) {
|
|
32053
|
+
outerRef.current = ref;
|
|
32054
|
+
}
|
|
32055
|
+
};
|
|
32056
|
+
|
|
32057
|
+
_this._resetIsScrollingDebounced = function () {
|
|
32058
|
+
if (_this._resetIsScrollingTimeoutId !== null) {
|
|
32059
|
+
cancelTimeout(_this._resetIsScrollingTimeoutId);
|
|
32060
|
+
}
|
|
32061
|
+
|
|
32062
|
+
_this._resetIsScrollingTimeoutId = requestTimeout(_this._resetIsScrolling, IS_SCROLLING_DEBOUNCE_INTERVAL$1);
|
|
32063
|
+
};
|
|
32064
|
+
|
|
32065
|
+
_this._resetIsScrolling = function () {
|
|
32066
|
+
_this._resetIsScrollingTimeoutId = null;
|
|
32067
|
+
|
|
32068
|
+
_this.setState({
|
|
32069
|
+
isScrolling: false
|
|
32070
|
+
}, function () {
|
|
32071
|
+
// Clear style cache after state update has been committed.
|
|
32072
|
+
// This way we don't break pure sCU for items that don't use isScrolling param.
|
|
32073
|
+
_this._getItemStyleCache(-1, null);
|
|
32074
|
+
});
|
|
32075
|
+
};
|
|
32076
|
+
|
|
32077
|
+
return _this;
|
|
32078
|
+
}
|
|
32079
|
+
|
|
32080
|
+
List.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
|
|
32081
|
+
validateSharedProps$1(nextProps, prevState);
|
|
32082
|
+
validateProps(nextProps);
|
|
32083
|
+
return null;
|
|
32084
|
+
};
|
|
32085
|
+
|
|
32086
|
+
var _proto = List.prototype;
|
|
32087
|
+
|
|
32088
|
+
_proto.scrollTo = function scrollTo(scrollOffset) {
|
|
32089
|
+
scrollOffset = Math.max(0, scrollOffset);
|
|
32090
|
+
this.setState(function (prevState) {
|
|
32091
|
+
if (prevState.scrollOffset === scrollOffset) {
|
|
32092
|
+
return null;
|
|
32093
|
+
}
|
|
32094
|
+
|
|
32095
|
+
return {
|
|
32096
|
+
scrollDirection: prevState.scrollOffset < scrollOffset ? 'forward' : 'backward',
|
|
32097
|
+
scrollOffset: scrollOffset,
|
|
32098
|
+
scrollUpdateWasRequested: true
|
|
32099
|
+
};
|
|
32100
|
+
}, this._resetIsScrollingDebounced);
|
|
32101
|
+
};
|
|
32102
|
+
|
|
32103
|
+
_proto.scrollToItem = function scrollToItem(index, align) {
|
|
32104
|
+
if (align === void 0) {
|
|
32105
|
+
align = 'auto';
|
|
32106
|
+
}
|
|
32107
|
+
|
|
32108
|
+
var _this$props2 = this.props,
|
|
32109
|
+
itemCount = _this$props2.itemCount,
|
|
32110
|
+
layout = _this$props2.layout;
|
|
32111
|
+
var scrollOffset = this.state.scrollOffset;
|
|
32112
|
+
index = Math.max(0, Math.min(index, itemCount - 1)); // The scrollbar size should be considered when scrolling an item into view, to ensure it's fully visible.
|
|
32113
|
+
// But we only need to account for its size when it's actually visible.
|
|
32114
|
+
// This is an edge case for lists; normally they only scroll in the dominant direction.
|
|
32115
|
+
|
|
32116
|
+
var scrollbarSize = 0;
|
|
32117
|
+
|
|
32118
|
+
if (this._outerRef) {
|
|
32119
|
+
var outerRef = this._outerRef;
|
|
32120
|
+
|
|
32121
|
+
if (layout === 'vertical') {
|
|
32122
|
+
scrollbarSize = outerRef.scrollWidth > outerRef.clientWidth ? getScrollbarSize() : 0;
|
|
32123
|
+
} else {
|
|
32124
|
+
scrollbarSize = outerRef.scrollHeight > outerRef.clientHeight ? getScrollbarSize() : 0;
|
|
32125
|
+
}
|
|
32126
|
+
}
|
|
32127
|
+
|
|
32128
|
+
this.scrollTo(getOffsetForIndexAndAlignment(this.props, index, align, scrollOffset, this._instanceProps, scrollbarSize));
|
|
32129
|
+
};
|
|
32130
|
+
|
|
32131
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
32132
|
+
var _this$props3 = this.props,
|
|
32133
|
+
direction = _this$props3.direction,
|
|
32134
|
+
initialScrollOffset = _this$props3.initialScrollOffset,
|
|
32135
|
+
layout = _this$props3.layout;
|
|
32136
|
+
|
|
32137
|
+
if (typeof initialScrollOffset === 'number' && this._outerRef != null) {
|
|
32138
|
+
var outerRef = this._outerRef; // TODO Deprecate direction "horizontal"
|
|
32139
|
+
|
|
32140
|
+
if (direction === 'horizontal' || layout === 'horizontal') {
|
|
32141
|
+
outerRef.scrollLeft = initialScrollOffset;
|
|
32142
|
+
} else {
|
|
32143
|
+
outerRef.scrollTop = initialScrollOffset;
|
|
32144
|
+
}
|
|
32145
|
+
}
|
|
32146
|
+
|
|
32147
|
+
this._callPropsCallbacks();
|
|
32148
|
+
};
|
|
32149
|
+
|
|
32150
|
+
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
32151
|
+
var _this$props4 = this.props,
|
|
32152
|
+
direction = _this$props4.direction,
|
|
32153
|
+
layout = _this$props4.layout;
|
|
32154
|
+
var _this$state = this.state,
|
|
32155
|
+
scrollOffset = _this$state.scrollOffset,
|
|
32156
|
+
scrollUpdateWasRequested = _this$state.scrollUpdateWasRequested;
|
|
32157
|
+
|
|
32158
|
+
if (scrollUpdateWasRequested && this._outerRef != null) {
|
|
32159
|
+
var outerRef = this._outerRef; // TODO Deprecate direction "horizontal"
|
|
32160
|
+
|
|
32161
|
+
if (direction === 'horizontal' || layout === 'horizontal') {
|
|
32162
|
+
if (direction === 'rtl') {
|
|
32163
|
+
// TRICKY According to the spec, scrollLeft should be negative for RTL aligned elements.
|
|
32164
|
+
// This is not the case for all browsers though (e.g. Chrome reports values as positive, measured relative to the left).
|
|
32165
|
+
// So we need to determine which browser behavior we're dealing with, and mimic it.
|
|
32166
|
+
switch (getRTLOffsetType()) {
|
|
32167
|
+
case 'negative':
|
|
32168
|
+
outerRef.scrollLeft = -scrollOffset;
|
|
32169
|
+
break;
|
|
32170
|
+
|
|
32171
|
+
case 'positive-ascending':
|
|
32172
|
+
outerRef.scrollLeft = scrollOffset;
|
|
32173
|
+
break;
|
|
32174
|
+
|
|
32175
|
+
default:
|
|
32176
|
+
var clientWidth = outerRef.clientWidth,
|
|
32177
|
+
scrollWidth = outerRef.scrollWidth;
|
|
32178
|
+
outerRef.scrollLeft = scrollWidth - clientWidth - scrollOffset;
|
|
32179
|
+
break;
|
|
32180
|
+
}
|
|
32181
|
+
} else {
|
|
32182
|
+
outerRef.scrollLeft = scrollOffset;
|
|
32183
|
+
}
|
|
32184
|
+
} else {
|
|
32185
|
+
outerRef.scrollTop = scrollOffset;
|
|
32186
|
+
}
|
|
32187
|
+
}
|
|
32188
|
+
|
|
32189
|
+
this._callPropsCallbacks();
|
|
32190
|
+
};
|
|
32191
|
+
|
|
32192
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
32193
|
+
if (this._resetIsScrollingTimeoutId !== null) {
|
|
32194
|
+
cancelTimeout(this._resetIsScrollingTimeoutId);
|
|
32195
|
+
}
|
|
32196
|
+
};
|
|
32197
|
+
|
|
32198
|
+
_proto.render = function render() {
|
|
32199
|
+
var _this$props5 = this.props,
|
|
32200
|
+
children = _this$props5.children,
|
|
32201
|
+
className = _this$props5.className,
|
|
32202
|
+
direction = _this$props5.direction,
|
|
32203
|
+
height = _this$props5.height,
|
|
32204
|
+
innerRef = _this$props5.innerRef,
|
|
32205
|
+
innerElementType = _this$props5.innerElementType,
|
|
32206
|
+
innerTagName = _this$props5.innerTagName,
|
|
32207
|
+
itemCount = _this$props5.itemCount,
|
|
32208
|
+
itemData = _this$props5.itemData,
|
|
32209
|
+
_this$props5$itemKey = _this$props5.itemKey,
|
|
32210
|
+
itemKey = _this$props5$itemKey === void 0 ? defaultItemKey$1 : _this$props5$itemKey,
|
|
32211
|
+
layout = _this$props5.layout,
|
|
32212
|
+
outerElementType = _this$props5.outerElementType,
|
|
32213
|
+
outerTagName = _this$props5.outerTagName,
|
|
32214
|
+
style = _this$props5.style,
|
|
32215
|
+
useIsScrolling = _this$props5.useIsScrolling,
|
|
32216
|
+
width = _this$props5.width;
|
|
32217
|
+
var isScrolling = this.state.isScrolling; // TODO Deprecate direction "horizontal"
|
|
32218
|
+
|
|
32219
|
+
var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
|
|
32220
|
+
var onScroll = isHorizontal ? this._onScrollHorizontal : this._onScrollVertical;
|
|
32221
|
+
|
|
32222
|
+
var _this$_getRangeToRend = this._getRangeToRender(),
|
|
32223
|
+
startIndex = _this$_getRangeToRend[0],
|
|
32224
|
+
stopIndex = _this$_getRangeToRend[1];
|
|
32225
|
+
|
|
32226
|
+
var items = [];
|
|
32227
|
+
|
|
32228
|
+
if (itemCount > 0) {
|
|
32229
|
+
for (var _index = startIndex; _index <= stopIndex; _index++) {
|
|
32230
|
+
items.push(createElement(children, {
|
|
32231
|
+
data: itemData,
|
|
32232
|
+
key: itemKey(_index, itemData),
|
|
32233
|
+
index: _index,
|
|
32234
|
+
isScrolling: useIsScrolling ? isScrolling : undefined,
|
|
32235
|
+
style: this._getItemStyle(_index)
|
|
32236
|
+
}));
|
|
32237
|
+
}
|
|
32238
|
+
} // Read this value AFTER items have been created,
|
|
32239
|
+
// So their actual sizes (if variable) are taken into consideration.
|
|
32240
|
+
|
|
32241
|
+
|
|
32242
|
+
var estimatedTotalSize = getEstimatedTotalSize(this.props, this._instanceProps);
|
|
32243
|
+
return createElement(outerElementType || outerTagName || 'div', {
|
|
32244
|
+
className: className,
|
|
32245
|
+
onScroll: onScroll,
|
|
32246
|
+
ref: this._outerRefSetter,
|
|
32247
|
+
style: _extends$1({
|
|
32248
|
+
position: 'relative',
|
|
32249
|
+
height: height,
|
|
32250
|
+
width: width,
|
|
32251
|
+
overflow: 'auto',
|
|
32252
|
+
WebkitOverflowScrolling: 'touch',
|
|
32253
|
+
willChange: 'transform',
|
|
32254
|
+
direction: direction
|
|
32255
|
+
}, style)
|
|
32256
|
+
}, createElement(innerElementType || innerTagName || 'div', {
|
|
32257
|
+
children: items,
|
|
32258
|
+
ref: innerRef,
|
|
32259
|
+
style: {
|
|
32260
|
+
height: isHorizontal ? '100%' : estimatedTotalSize,
|
|
32261
|
+
pointerEvents: isScrolling ? 'none' : undefined,
|
|
32262
|
+
width: isHorizontal ? estimatedTotalSize : '100%'
|
|
32263
|
+
}
|
|
32264
|
+
}));
|
|
32265
|
+
};
|
|
32266
|
+
|
|
32267
|
+
_proto._callPropsCallbacks = function _callPropsCallbacks() {
|
|
32268
|
+
if (typeof this.props.onItemsRendered === 'function') {
|
|
32269
|
+
var itemCount = this.props.itemCount;
|
|
32270
|
+
|
|
32271
|
+
if (itemCount > 0) {
|
|
32272
|
+
var _this$_getRangeToRend2 = this._getRangeToRender(),
|
|
32273
|
+
_overscanStartIndex = _this$_getRangeToRend2[0],
|
|
32274
|
+
_overscanStopIndex = _this$_getRangeToRend2[1],
|
|
32275
|
+
_visibleStartIndex = _this$_getRangeToRend2[2],
|
|
32276
|
+
_visibleStopIndex = _this$_getRangeToRend2[3];
|
|
32277
|
+
|
|
32278
|
+
this._callOnItemsRendered(_overscanStartIndex, _overscanStopIndex, _visibleStartIndex, _visibleStopIndex);
|
|
32279
|
+
}
|
|
32280
|
+
}
|
|
32281
|
+
|
|
32282
|
+
if (typeof this.props.onScroll === 'function') {
|
|
32283
|
+
var _this$state2 = this.state,
|
|
32284
|
+
_scrollDirection = _this$state2.scrollDirection,
|
|
32285
|
+
_scrollOffset = _this$state2.scrollOffset,
|
|
32286
|
+
_scrollUpdateWasRequested = _this$state2.scrollUpdateWasRequested;
|
|
32287
|
+
|
|
32288
|
+
this._callOnScroll(_scrollDirection, _scrollOffset, _scrollUpdateWasRequested);
|
|
32289
|
+
}
|
|
32290
|
+
} // Lazily create and cache item styles while scrolling,
|
|
32291
|
+
// So that pure component sCU will prevent re-renders.
|
|
32292
|
+
// We maintain this cache, and pass a style prop rather than index,
|
|
32293
|
+
// So that List can clear cached styles and force item re-render if necessary.
|
|
32294
|
+
;
|
|
32295
|
+
|
|
32296
|
+
_proto._getRangeToRender = function _getRangeToRender() {
|
|
32297
|
+
var _this$props6 = this.props,
|
|
32298
|
+
itemCount = _this$props6.itemCount,
|
|
32299
|
+
overscanCount = _this$props6.overscanCount;
|
|
32300
|
+
var _this$state3 = this.state,
|
|
32301
|
+
isScrolling = _this$state3.isScrolling,
|
|
32302
|
+
scrollDirection = _this$state3.scrollDirection,
|
|
32303
|
+
scrollOffset = _this$state3.scrollOffset;
|
|
32304
|
+
|
|
32305
|
+
if (itemCount === 0) {
|
|
32306
|
+
return [0, 0, 0, 0];
|
|
32307
|
+
}
|
|
32308
|
+
|
|
32309
|
+
var startIndex = getStartIndexForOffset(this.props, scrollOffset, this._instanceProps);
|
|
32310
|
+
var stopIndex = getStopIndexForStartIndex(this.props, startIndex, scrollOffset, this._instanceProps); // Overscan by one item in each direction so that tab/focus works.
|
|
32311
|
+
// If there isn't at least one extra item, tab loops back around.
|
|
32312
|
+
|
|
32313
|
+
var overscanBackward = !isScrolling || scrollDirection === 'backward' ? Math.max(1, overscanCount) : 1;
|
|
32314
|
+
var overscanForward = !isScrolling || scrollDirection === 'forward' ? Math.max(1, overscanCount) : 1;
|
|
32315
|
+
return [Math.max(0, startIndex - overscanBackward), Math.max(0, Math.min(itemCount - 1, stopIndex + overscanForward)), startIndex, stopIndex];
|
|
32316
|
+
};
|
|
32317
|
+
|
|
32318
|
+
return List;
|
|
32319
|
+
}(PureComponent), _class.defaultProps = {
|
|
32320
|
+
direction: 'ltr',
|
|
32321
|
+
itemData: undefined,
|
|
32322
|
+
layout: 'vertical',
|
|
32323
|
+
overscanCount: 2,
|
|
32324
|
+
useIsScrolling: false
|
|
32325
|
+
}, _class;
|
|
32326
|
+
} // NOTE: I considered further wrapping individual items with a pure ListItem component.
|
|
32327
|
+
// This would avoid ever calling the render function for the same index more than once,
|
|
32328
|
+
// But it would also add the overhead of a lot of components/fibers.
|
|
32329
|
+
// I assume people already do this (render function returning a class component),
|
|
32330
|
+
// So my doing it would just unnecessarily double the wrappers.
|
|
32331
|
+
|
|
32332
|
+
var validateSharedProps$1 = function validateSharedProps(_ref2, _ref3) {
|
|
32333
|
+
var children = _ref2.children,
|
|
32334
|
+
direction = _ref2.direction,
|
|
32335
|
+
height = _ref2.height,
|
|
32336
|
+
layout = _ref2.layout,
|
|
32337
|
+
innerTagName = _ref2.innerTagName,
|
|
32338
|
+
outerTagName = _ref2.outerTagName,
|
|
32339
|
+
width = _ref2.width;
|
|
32340
|
+
var instance = _ref3.instance;
|
|
32341
|
+
|
|
32342
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
32343
|
+
if (innerTagName != null || outerTagName != null) {
|
|
32344
|
+
if (devWarningsTagName$1 && !devWarningsTagName$1.has(instance)) {
|
|
32345
|
+
devWarningsTagName$1.add(instance);
|
|
32346
|
+
console.warn('The innerTagName and outerTagName props have been deprecated. ' + 'Please use the innerElementType and outerElementType props instead.');
|
|
32347
|
+
}
|
|
32348
|
+
} // TODO Deprecate direction "horizontal"
|
|
32349
|
+
|
|
32350
|
+
|
|
32351
|
+
var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
|
|
32352
|
+
|
|
32353
|
+
switch (direction) {
|
|
32354
|
+
case 'horizontal':
|
|
32355
|
+
case 'vertical':
|
|
32356
|
+
if (devWarningsDirection && !devWarningsDirection.has(instance)) {
|
|
32357
|
+
devWarningsDirection.add(instance);
|
|
32358
|
+
console.warn('The direction prop should be either "ltr" (default) or "rtl". ' + 'Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.');
|
|
32359
|
+
}
|
|
32360
|
+
|
|
32361
|
+
break;
|
|
32362
|
+
|
|
32363
|
+
case 'ltr':
|
|
32364
|
+
case 'rtl':
|
|
32365
|
+
// Valid values
|
|
32366
|
+
break;
|
|
32367
|
+
|
|
32368
|
+
default:
|
|
32369
|
+
throw Error('An invalid "direction" prop has been specified. ' + 'Value should be either "ltr" or "rtl". ' + ("\"" + direction + "\" was specified."));
|
|
32370
|
+
}
|
|
32371
|
+
|
|
32372
|
+
switch (layout) {
|
|
32373
|
+
case 'horizontal':
|
|
32374
|
+
case 'vertical':
|
|
32375
|
+
// Valid values
|
|
32376
|
+
break;
|
|
32377
|
+
|
|
32378
|
+
default:
|
|
32379
|
+
throw Error('An invalid "layout" prop has been specified. ' + 'Value should be either "horizontal" or "vertical". ' + ("\"" + layout + "\" was specified."));
|
|
32380
|
+
}
|
|
32381
|
+
|
|
32382
|
+
if (children == null) {
|
|
32383
|
+
throw Error('An invalid "children" prop has been specified. ' + 'Value should be a React component. ' + ("\"" + (children === null ? 'null' : typeof children) + "\" was specified."));
|
|
32384
|
+
}
|
|
32385
|
+
|
|
32386
|
+
if (isHorizontal && typeof width !== 'number') {
|
|
32387
|
+
throw Error('An invalid "width" prop has been specified. ' + 'Horizontal lists must specify a number for width. ' + ("\"" + (width === null ? 'null' : typeof width) + "\" was specified."));
|
|
32388
|
+
} else if (!isHorizontal && typeof height !== 'number') {
|
|
32389
|
+
throw Error('An invalid "height" prop has been specified. ' + 'Vertical lists must specify a number for height. ' + ("\"" + (height === null ? 'null' : typeof height) + "\" was specified."));
|
|
32390
|
+
}
|
|
32391
|
+
}
|
|
32392
|
+
};
|
|
32393
|
+
|
|
32394
|
+
var FixedSizeList = /*#__PURE__*/createListComponent({
|
|
32395
|
+
getItemOffset: function getItemOffset(_ref, index) {
|
|
32396
|
+
var itemSize = _ref.itemSize;
|
|
32397
|
+
return index * itemSize;
|
|
32398
|
+
},
|
|
32399
|
+
getItemSize: function getItemSize(_ref2, index) {
|
|
32400
|
+
var itemSize = _ref2.itemSize;
|
|
32401
|
+
return itemSize;
|
|
32402
|
+
},
|
|
32403
|
+
getEstimatedTotalSize: function getEstimatedTotalSize(_ref3) {
|
|
32404
|
+
var itemCount = _ref3.itemCount,
|
|
32405
|
+
itemSize = _ref3.itemSize;
|
|
32406
|
+
return itemSize * itemCount;
|
|
32407
|
+
},
|
|
32408
|
+
getOffsetForIndexAndAlignment: function getOffsetForIndexAndAlignment(_ref4, index, align, scrollOffset, instanceProps, scrollbarSize) {
|
|
32409
|
+
var direction = _ref4.direction,
|
|
32410
|
+
height = _ref4.height,
|
|
32411
|
+
itemCount = _ref4.itemCount,
|
|
32412
|
+
itemSize = _ref4.itemSize,
|
|
32413
|
+
layout = _ref4.layout,
|
|
32414
|
+
width = _ref4.width;
|
|
32415
|
+
// TODO Deprecate direction "horizontal"
|
|
32416
|
+
var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
|
|
32417
|
+
var size = isHorizontal ? width : height;
|
|
32418
|
+
var lastItemOffset = Math.max(0, itemCount * itemSize - size);
|
|
32419
|
+
var maxOffset = Math.min(lastItemOffset, index * itemSize);
|
|
32420
|
+
var minOffset = Math.max(0, index * itemSize - size + itemSize + scrollbarSize);
|
|
32421
|
+
|
|
32422
|
+
if (align === 'smart') {
|
|
32423
|
+
if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
|
|
32424
|
+
align = 'auto';
|
|
32425
|
+
} else {
|
|
32426
|
+
align = 'center';
|
|
32427
|
+
}
|
|
32428
|
+
}
|
|
32429
|
+
|
|
32430
|
+
switch (align) {
|
|
32431
|
+
case 'start':
|
|
32432
|
+
return maxOffset;
|
|
32433
|
+
|
|
32434
|
+
case 'end':
|
|
32435
|
+
return minOffset;
|
|
32436
|
+
|
|
32437
|
+
case 'center':
|
|
32438
|
+
{
|
|
32439
|
+
// "Centered" offset is usually the average of the min and max.
|
|
32440
|
+
// But near the edges of the list, this doesn't hold true.
|
|
32441
|
+
var middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
|
|
32442
|
+
|
|
32443
|
+
if (middleOffset < Math.ceil(size / 2)) {
|
|
32444
|
+
return 0; // near the beginning
|
|
32445
|
+
} else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
|
|
32446
|
+
return lastItemOffset; // near the end
|
|
32447
|
+
} else {
|
|
32448
|
+
return middleOffset;
|
|
32449
|
+
}
|
|
32450
|
+
}
|
|
32451
|
+
|
|
32452
|
+
case 'auto':
|
|
32453
|
+
default:
|
|
32454
|
+
if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
|
|
32455
|
+
return scrollOffset;
|
|
32456
|
+
} else if (scrollOffset < minOffset) {
|
|
32457
|
+
return minOffset;
|
|
32458
|
+
} else {
|
|
32459
|
+
return maxOffset;
|
|
32460
|
+
}
|
|
32461
|
+
|
|
32462
|
+
}
|
|
32463
|
+
},
|
|
32464
|
+
getStartIndexForOffset: function getStartIndexForOffset(_ref5, offset) {
|
|
32465
|
+
var itemCount = _ref5.itemCount,
|
|
32466
|
+
itemSize = _ref5.itemSize;
|
|
32467
|
+
return Math.max(0, Math.min(itemCount - 1, Math.floor(offset / itemSize)));
|
|
32468
|
+
},
|
|
32469
|
+
getStopIndexForStartIndex: function getStopIndexForStartIndex(_ref6, startIndex, scrollOffset) {
|
|
32470
|
+
var direction = _ref6.direction,
|
|
32471
|
+
height = _ref6.height,
|
|
32472
|
+
itemCount = _ref6.itemCount,
|
|
32473
|
+
itemSize = _ref6.itemSize,
|
|
32474
|
+
layout = _ref6.layout,
|
|
32475
|
+
width = _ref6.width;
|
|
32476
|
+
// TODO Deprecate direction "horizontal"
|
|
32477
|
+
var isHorizontal = direction === 'horizontal' || layout === 'horizontal';
|
|
32478
|
+
var offset = startIndex * itemSize;
|
|
32479
|
+
var size = isHorizontal ? width : height;
|
|
32480
|
+
var numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
|
|
32481
|
+
return Math.max(0, Math.min(itemCount - 1, startIndex + numVisibleItems - 1 // -1 is because stop index is inclusive
|
|
32482
|
+
));
|
|
32483
|
+
},
|
|
32484
|
+
initInstanceProps: function initInstanceProps(props) {// Noop
|
|
32485
|
+
},
|
|
32486
|
+
shouldResetStyleCacheOnItemSizeChange: true,
|
|
32487
|
+
validateProps: function validateProps(_ref7) {
|
|
32488
|
+
var itemSize = _ref7.itemSize;
|
|
32489
|
+
|
|
32490
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
32491
|
+
if (typeof itemSize !== 'number') {
|
|
32492
|
+
throw Error('An invalid "itemSize" prop has been specified. ' + 'Value should be a number. ' + ("\"" + (itemSize === null ? 'null' : typeof itemSize) + "\" was specified."));
|
|
32493
|
+
}
|
|
32494
|
+
}
|
|
32495
|
+
}
|
|
32496
|
+
});
|
|
32497
|
+
|
|
32498
|
+
var WORKSPACE_SELECT_LIST_ROW_HEIGHT = 46;
|
|
31710
32499
|
var getPresetIcon = function getPresetIcon(preset) {
|
|
31711
32500
|
switch (preset.viewType) {
|
|
31712
32501
|
case 'tiledWindow':
|
|
@@ -31740,12 +32529,17 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
31740
32529
|
var onDuplicate = function onDuplicate() {
|
|
31741
32530
|
onClickWorkspacePresetOption(workspacePreset.id, WorkspacePresetAction.DUPLICATE, workspacePreset);
|
|
31742
32531
|
};
|
|
31743
|
-
|
|
31744
|
-
|
|
31745
|
-
|
|
31746
|
-
|
|
31747
|
-
|
|
31748
|
-
|
|
32532
|
+
var onEdit = function onEdit() {
|
|
32533
|
+
onClickWorkspacePresetOption(workspacePreset.id, WorkspacePresetAction.EDIT, workspacePreset);
|
|
32534
|
+
};
|
|
32535
|
+
var editTitle = testIdPrefix === 'viewpreset' ? 'Edit (name)' : 'Edit (name and abstract)';
|
|
32536
|
+
var menuItems = [{
|
|
32537
|
+
text: 'Duplicate',
|
|
32538
|
+
action: onDuplicate
|
|
32539
|
+
}].concat(_toConsumableArray$1(workspacePreset.scope === 'user' ? [{
|
|
32540
|
+
text: editTitle,
|
|
32541
|
+
action: onEdit
|
|
32542
|
+
}] : []));
|
|
31749
32543
|
return /*#__PURE__*/React__default.createElement(ListItem, {
|
|
31750
32544
|
disablePadding: true,
|
|
31751
32545
|
sx: {
|
|
@@ -31774,7 +32568,8 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
31774
32568
|
onClickPreset(workspacePreset.id);
|
|
31775
32569
|
},
|
|
31776
32570
|
sx: {
|
|
31777
|
-
padding: 1
|
|
32571
|
+
padding: 1,
|
|
32572
|
+
height: "".concat(WORKSPACE_SELECT_LIST_ROW_HEIGHT, "px")
|
|
31778
32573
|
}
|
|
31779
32574
|
}, /*#__PURE__*/React__default.createElement(ListItemIcon, null, getPresetIcon(workspacePreset)), /*#__PURE__*/React__default.createElement(CustomTooltip, {
|
|
31780
32575
|
title: workspacePreset.title
|
|
@@ -31800,15 +32595,7 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
31800
32595
|
}, /*#__PURE__*/React__default.createElement(ToggleMenu, {
|
|
31801
32596
|
buttonTestId: "".concat(testIdPrefix, "-listOptionsButton"),
|
|
31802
32597
|
menuPosition: "right",
|
|
31803
|
-
menuItems:
|
|
31804
|
-
text: 'Duplicate',
|
|
31805
|
-
action: onDuplicate
|
|
31806
|
-
}
|
|
31807
|
-
// {
|
|
31808
|
-
// text: 'Edit (name & meta)',
|
|
31809
|
-
// action: onEdit,
|
|
31810
|
-
// },
|
|
31811
|
-
],
|
|
32598
|
+
menuItems: menuItems,
|
|
31812
32599
|
menuTitle: "Options",
|
|
31813
32600
|
isDefaultOpen: isOptionsMenuOpen
|
|
31814
32601
|
}), workspacePreset.scope === 'user' && /*#__PURE__*/React__default.createElement(CustomIconButton, {
|
|
@@ -31825,68 +32612,38 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
31825
32612
|
}, /*#__PURE__*/React__default.createElement(Delete, null))))));
|
|
31826
32613
|
};
|
|
31827
32614
|
|
|
31828
|
-
|
|
31829
|
-
|
|
31830
|
-
|
|
31831
|
-
|
|
31832
|
-
|
|
31833
|
-
|
|
31834
|
-
|
|
31835
|
-
|
|
31836
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
31837
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
31838
|
-
* See the License for the specific language governing permissions and
|
|
31839
|
-
* limitations under the License.
|
|
31840
|
-
*
|
|
31841
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
31842
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
31843
|
-
* */
|
|
31844
|
-
var emptyWorkspaceListItem = {
|
|
31845
|
-
id: emptyMapWorkspace.id,
|
|
31846
|
-
title: emptyMapWorkspace.title,
|
|
31847
|
-
scope: emptyMapWorkspace.scope,
|
|
31848
|
-
viewType: emptyMapWorkspace.viewType,
|
|
31849
|
-
"abstract": emptyMapWorkspace["abstract"]
|
|
32615
|
+
var getHeight = function getHeight(element) {
|
|
32616
|
+
if (!element) {
|
|
32617
|
+
return null;
|
|
32618
|
+
}
|
|
32619
|
+
var style = getComputedStyle(element);
|
|
32620
|
+
var marginTop = style.marginTop ? parseInt(style.marginTop, 10) : 0;
|
|
32621
|
+
var marginBottom = style.marginTop ? parseInt(style.marginBottom, 10) : 0;
|
|
32622
|
+
return element.offsetHeight + marginTop + marginBottom;
|
|
31850
32623
|
};
|
|
31851
|
-
|
|
31852
|
-
|
|
31853
|
-
|
|
31854
|
-
|
|
31855
|
-
|
|
31856
|
-
|
|
31857
|
-
|
|
31858
|
-
|
|
31859
|
-
|
|
31860
|
-
|
|
31861
|
-
|
|
31862
|
-
|
|
31863
|
-
|
|
31864
|
-
|
|
31865
|
-
}, /*#__PURE__*/React.createElement(Box$2, {
|
|
31866
|
-
sx: {
|
|
31867
|
-
marginBottom: '4px',
|
|
31868
|
-
fontSize: '12px'
|
|
31869
|
-
}
|
|
31870
|
-
}, workspacePresets.length, " results"), /*#__PURE__*/React.createElement(List, null, !hideNewWorkspace && /*#__PURE__*/React.createElement(WorkspaceSelectListRow, {
|
|
31871
|
-
key: newPreset.id,
|
|
31872
|
-
workspacePreset: newPreset,
|
|
31873
|
-
onClickPreset: onClickPreset,
|
|
31874
|
-
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
31875
|
-
isSelected: currentSelectedId === '' || currentSelectedId === undefined,
|
|
31876
|
-
isEditable: isLoggedIn,
|
|
31877
|
-
testIdPrefix: testIdPrefix
|
|
31878
|
-
}), workspacePresets.map(function (preset) {
|
|
31879
|
-
return /*#__PURE__*/React.createElement(WorkspaceSelectListRow, {
|
|
31880
|
-
key: preset.id,
|
|
31881
|
-
workspacePreset: preset,
|
|
31882
|
-
onClickPreset: onClickPreset,
|
|
31883
|
-
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
31884
|
-
isEditable: isLoggedIn,
|
|
31885
|
-
searchQuery: searchQuery,
|
|
31886
|
-
isSelected: currentSelectedId === preset.id,
|
|
31887
|
-
testIdPrefix: testIdPrefix
|
|
32624
|
+
// Gets element height incl padding, border and margins
|
|
32625
|
+
var useGetElementHeight = function useGetElementHeight(ref, defaultHeight) {
|
|
32626
|
+
var _React$useState = React__default.useState(defaultHeight),
|
|
32627
|
+
_React$useState2 = _slicedToArray$2(_React$useState, 2),
|
|
32628
|
+
height = _React$useState2[0],
|
|
32629
|
+
setHeight = _React$useState2[1];
|
|
32630
|
+
React__default.useLayoutEffect(function () {
|
|
32631
|
+
var element = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
32632
|
+
if (element) {
|
|
32633
|
+
setHeight(element.offsetHeight);
|
|
32634
|
+
}
|
|
32635
|
+
var observer = new ResizeObserver(function () {
|
|
32636
|
+
var height = getHeight(element);
|
|
32637
|
+
height && setHeight(height);
|
|
31888
32638
|
});
|
|
31889
|
-
|
|
32639
|
+
observer.observe(element);
|
|
32640
|
+
return function () {
|
|
32641
|
+
observer.disconnect();
|
|
32642
|
+
};
|
|
32643
|
+
}, [ref]);
|
|
32644
|
+
return {
|
|
32645
|
+
height: height
|
|
32646
|
+
};
|
|
31890
32647
|
};
|
|
31891
32648
|
|
|
31892
32649
|
/* *
|
|
@@ -32060,30 +32817,150 @@ var SearchField = function SearchField(_ref3) {
|
|
|
32060
32817
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
32061
32818
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
32062
32819
|
* */
|
|
32063
|
-
var
|
|
32820
|
+
var DEFAULT_FILTER_HEIGHT = 85;
|
|
32821
|
+
var WorkspaceFilter = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
32064
32822
|
var filters = _ref.filters,
|
|
32065
32823
|
_ref$onClickFilterChi = _ref.onClickFilterChip,
|
|
32066
32824
|
onClickFilterChip = _ref$onClickFilterChi === void 0 ? function () {} : _ref$onClickFilterChi,
|
|
32067
32825
|
_ref$onSearch = _ref.onSearch,
|
|
32068
32826
|
onSearch = _ref$onSearch === void 0 ? function () {} : _ref$onSearch,
|
|
32069
32827
|
isAllSelected = _ref.isAllSelected,
|
|
32070
|
-
searchQuery = _ref.searchQuery
|
|
32071
|
-
|
|
32072
|
-
|
|
32073
|
-
return /*#__PURE__*/React.createElement(Stack, {
|
|
32074
|
-
spacing: 1,
|
|
32828
|
+
searchQuery = _ref.searchQuery;
|
|
32829
|
+
return /*#__PURE__*/React.createElement(Box$2, {
|
|
32830
|
+
ref: ref,
|
|
32075
32831
|
sx: {
|
|
32076
32832
|
marginBottom: '8px'
|
|
32077
32833
|
}
|
|
32078
|
-
},
|
|
32834
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
32835
|
+
spacing: 1
|
|
32836
|
+
}, /*#__PURE__*/React.createElement(SearchField, {
|
|
32079
32837
|
value: searchQuery,
|
|
32080
32838
|
valueChanged: onSearch
|
|
32081
32839
|
}), /*#__PURE__*/React.createElement(FilterList, {
|
|
32082
32840
|
filters: filters,
|
|
32083
32841
|
onChipClick: onClickFilterChip,
|
|
32084
32842
|
isAllSelected: isAllSelected
|
|
32085
|
-
}));
|
|
32843
|
+
})));
|
|
32844
|
+
});
|
|
32845
|
+
|
|
32846
|
+
var emptyWorkspaceListItem = {
|
|
32847
|
+
id: emptyMapWorkspace.id,
|
|
32848
|
+
title: emptyMapWorkspace.title,
|
|
32849
|
+
scope: emptyMapWorkspace.scope,
|
|
32850
|
+
viewType: emptyMapWorkspace.viewType,
|
|
32851
|
+
"abstract": emptyMapWorkspace["abstract"]
|
|
32086
32852
|
};
|
|
32853
|
+
var DEFAULT_DIALOG_HEIGHT = 900;
|
|
32854
|
+
var MIN_HEIGHT_SCROLLABLE_LIST = 88; // Slightly less than 2 rows
|
|
32855
|
+
var LIST_PADDING_TOP = 8;
|
|
32856
|
+
var DEFAULT_PARENT_PADDING = 8;
|
|
32857
|
+
var DEFAULT_RESULTS_HEIGHT = 22;
|
|
32858
|
+
var useGetRequiredHeights = function useGetRequiredHeights(ref) {
|
|
32859
|
+
// Used to store the height of the list dialog content
|
|
32860
|
+
var _React$useState = React.useState(DEFAULT_DIALOG_HEIGHT),
|
|
32861
|
+
_React$useState2 = _slicedToArray$2(_React$useState, 2),
|
|
32862
|
+
dialogHeight = _React$useState2[0],
|
|
32863
|
+
setDialogHeight = _React$useState2[1];
|
|
32864
|
+
// Used to store the padding height surrounding the list and the filters
|
|
32865
|
+
var _React$useState3 = React.useState(DEFAULT_PARENT_PADDING),
|
|
32866
|
+
_React$useState4 = _slicedToArray$2(_React$useState3, 2),
|
|
32867
|
+
parentPaddingHeight = _React$useState4[0],
|
|
32868
|
+
setParentPaddingHeight = _React$useState4[1];
|
|
32869
|
+
// Obtain the height of the results div
|
|
32870
|
+
var resultsRef = React.useRef(null);
|
|
32871
|
+
var _useGetElementHeight = useGetElementHeight(resultsRef, DEFAULT_RESULTS_HEIGHT),
|
|
32872
|
+
resultsHeight = _useGetElementHeight.height;
|
|
32873
|
+
// Obtain the height of the filters and search
|
|
32874
|
+
var _useGetElementHeight2 = useGetElementHeight(ref, DEFAULT_FILTER_HEIGHT),
|
|
32875
|
+
filterHeight = _useGetElementHeight2.height;
|
|
32876
|
+
// Obtain the height of of the list dialog content
|
|
32877
|
+
React.useLayoutEffect(function () {
|
|
32878
|
+
var _a, _b, _c, _d;
|
|
32879
|
+
var dialogElement = (_d = (_c = (_b = (_a = resultsRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.parentElement) === null || _d === void 0 ? void 0 : _d.parentElement;
|
|
32880
|
+
setDialogHeight(dialogElement.offsetHeight);
|
|
32881
|
+
var observer = new ResizeObserver(function () {
|
|
32882
|
+
var height = getHeight(dialogElement);
|
|
32883
|
+
height && setDialogHeight(height);
|
|
32884
|
+
});
|
|
32885
|
+
observer.observe(dialogElement);
|
|
32886
|
+
return function () {
|
|
32887
|
+
observer.disconnect();
|
|
32888
|
+
};
|
|
32889
|
+
}, [resultsRef]);
|
|
32890
|
+
// Obtain the padding height surrounding the list and the filters
|
|
32891
|
+
React.useEffect(function () {
|
|
32892
|
+
var _a, _b;
|
|
32893
|
+
var parentElement = (_b = (_a = resultsRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement;
|
|
32894
|
+
var style = getComputedStyle(parentElement);
|
|
32895
|
+
var paddingTop = parseInt(style.paddingTop, 10);
|
|
32896
|
+
paddingTop && setParentPaddingHeight(paddingTop);
|
|
32897
|
+
}, []);
|
|
32898
|
+
var heightOtherElements = filterHeight + resultsHeight + LIST_PADDING_TOP + 2 * parentPaddingHeight;
|
|
32899
|
+
// row height = height + margin
|
|
32900
|
+
var rowHeight = WORKSPACE_SELECT_LIST_ROW_HEIGHT + 4;
|
|
32901
|
+
var availableSpaceForList = dialogHeight - heightOtherElements;
|
|
32902
|
+
var listHeight = availableSpaceForList && availableSpaceForList < MIN_HEIGHT_SCROLLABLE_LIST ? MIN_HEIGHT_SCROLLABLE_LIST : availableSpaceForList;
|
|
32903
|
+
return {
|
|
32904
|
+
resultsRef: resultsRef,
|
|
32905
|
+
rowHeight: rowHeight,
|
|
32906
|
+
listHeight: listHeight
|
|
32907
|
+
};
|
|
32908
|
+
};
|
|
32909
|
+
var WorkspaceSelectList = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
32910
|
+
var workspacePresets = _ref.workspacePresets,
|
|
32911
|
+
currentSelectedId = _ref.currentSelectedId,
|
|
32912
|
+
onClickPreset = _ref.onClickPreset,
|
|
32913
|
+
onClickWorkspacePresetOption = _ref.onClickWorkspacePresetOption,
|
|
32914
|
+
hideNewWorkspace = _ref.hideNewWorkspace,
|
|
32915
|
+
isLoggedIn = _ref.isLoggedIn,
|
|
32916
|
+
searchQuery = _ref.searchQuery,
|
|
32917
|
+
_ref$newPreset = _ref.newPreset,
|
|
32918
|
+
newPreset = _ref$newPreset === void 0 ? emptyWorkspaceListItem : _ref$newPreset,
|
|
32919
|
+
_ref$testIdPrefix = _ref.testIdPrefix,
|
|
32920
|
+
testIdPrefix = _ref$testIdPrefix === void 0 ? 'workspace' : _ref$testIdPrefix;
|
|
32921
|
+
var _useGetRequiredHeight = useGetRequiredHeights(ref),
|
|
32922
|
+
resultsRef = _useGetRequiredHeight.resultsRef,
|
|
32923
|
+
rowHeight = _useGetRequiredHeight.rowHeight,
|
|
32924
|
+
listHeight = _useGetRequiredHeight.listHeight;
|
|
32925
|
+
// Height of other elements in dialog besides the list:
|
|
32926
|
+
// filter, results text , padding list top and 2x padding around dialog children (top & bottom)
|
|
32927
|
+
var items = !hideNewWorkspace ? [newPreset].concat(_toConsumableArray$1(workspacePresets)) : workspacePresets;
|
|
32928
|
+
// console.log(filterHeight, resultsHeight, parentPaddingHeight);
|
|
32929
|
+
return /*#__PURE__*/React.createElement(Box$2, {
|
|
32930
|
+
"data-testid": "".concat(testIdPrefix, "-selectList")
|
|
32931
|
+
}, /*#__PURE__*/React.createElement(Box$2, {
|
|
32932
|
+
ref: resultsRef,
|
|
32933
|
+
sx: {
|
|
32934
|
+
marginBottom: '4px',
|
|
32935
|
+
fontSize: '12px'
|
|
32936
|
+
}
|
|
32937
|
+
}, workspacePresets.length, " results"), /*#__PURE__*/React.createElement(Box$2, {
|
|
32938
|
+
sx: {
|
|
32939
|
+
paddingTop: "".concat(LIST_PADDING_TOP, "px")
|
|
32940
|
+
}
|
|
32941
|
+
}, /*#__PURE__*/React.createElement(FixedSizeList, {
|
|
32942
|
+
height: listHeight,
|
|
32943
|
+
itemCount: items.length,
|
|
32944
|
+
itemSize: rowHeight,
|
|
32945
|
+
width: "100%"
|
|
32946
|
+
}, function (_ref2) {
|
|
32947
|
+
var index = _ref2.index,
|
|
32948
|
+
style = _ref2.style;
|
|
32949
|
+
var preset = items[index];
|
|
32950
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
32951
|
+
style: style,
|
|
32952
|
+
key: preset.id || 'emptyPreset'
|
|
32953
|
+
}, /*#__PURE__*/React.createElement(WorkspaceSelectListRow, {
|
|
32954
|
+
workspacePreset: preset,
|
|
32955
|
+
onClickPreset: onClickPreset,
|
|
32956
|
+
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
32957
|
+
isEditable: isLoggedIn,
|
|
32958
|
+
searchQuery: searchQuery,
|
|
32959
|
+
isSelected: currentSelectedId === preset.id || currentSelectedId === '' && preset.id === undefined,
|
|
32960
|
+
testIdPrefix: testIdPrefix
|
|
32961
|
+
}));
|
|
32962
|
+
})));
|
|
32963
|
+
});
|
|
32087
32964
|
|
|
32088
32965
|
/* *
|
|
32089
32966
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -32105,6 +32982,7 @@ var ERROR_TITLE = 'View presets not available';
|
|
|
32105
32982
|
var ERROR_RETRY = 'Try again';
|
|
32106
32983
|
var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
32107
32984
|
var panelId = _ref.panelId;
|
|
32985
|
+
var filterRef = React.useRef(null);
|
|
32108
32986
|
var viewPresets = useSelector(function (store) {
|
|
32109
32987
|
return getFilteredViewPresetListForView(store, panelId);
|
|
32110
32988
|
});
|
|
@@ -32123,7 +33001,9 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
32123
33001
|
});
|
|
32124
33002
|
var lastViewPresetListSearchQuery = usePrevious(viewPresetListSearchQuery);
|
|
32125
33003
|
var relatedSyncGroupIds = useSelector(function (store) {
|
|
32126
|
-
return syncGroupsSelectors.getAllTargetGroupsForSource(store,
|
|
33004
|
+
return syncGroupsSelectors.getAllTargetGroupsForSource(store, {
|
|
33005
|
+
sourceId: panelId
|
|
33006
|
+
});
|
|
32127
33007
|
});
|
|
32128
33008
|
var errorViewPresetsList = useSelector(function (store) {
|
|
32129
33009
|
return getViewPresetListError(store, panelId);
|
|
@@ -32178,9 +33058,20 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
32178
33058
|
});
|
|
32179
33059
|
break;
|
|
32180
33060
|
}
|
|
32181
|
-
|
|
32182
|
-
|
|
32183
|
-
|
|
33061
|
+
case WorkspacePresetAction.EDIT:
|
|
33062
|
+
{
|
|
33063
|
+
var presetTitle = (preset === null || preset === void 0 ? void 0 : preset.title) || '';
|
|
33064
|
+
openViewPresetsDialog({
|
|
33065
|
+
title: MAPPRESET_DIALOG_TITLE_EDIT,
|
|
33066
|
+
action: PresetAction.EDIT,
|
|
33067
|
+
panelId: panelId,
|
|
33068
|
+
viewPresetId: presetId,
|
|
33069
|
+
formValues: {
|
|
33070
|
+
title: presetTitle
|
|
33071
|
+
}
|
|
33072
|
+
});
|
|
33073
|
+
break;
|
|
33074
|
+
}
|
|
32184
33075
|
// case WorkspacePresetAction.SAVE: {
|
|
32185
33076
|
// break;
|
|
32186
33077
|
// }
|
|
@@ -32230,7 +33121,9 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
32230
33121
|
return filter.isSelected;
|
|
32231
33122
|
});
|
|
32232
33123
|
var shouldHideNewWorkspace = !isAllSelectedForFilters || viewPresetListSearchQuery.length > 0;
|
|
32233
|
-
return /*#__PURE__*/React.createElement(
|
|
33124
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
33125
|
+
"data-testid": "viewpreset-selectlist-connect"
|
|
33126
|
+
}, isViewPresetsListFetching && /*#__PURE__*/React.createElement(LinearProgress, {
|
|
32234
33127
|
"data-testid": "loading-bar",
|
|
32235
33128
|
color: "secondary",
|
|
32236
33129
|
sx: {
|
|
@@ -32253,7 +33146,8 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
32253
33146
|
onClickFilterChip: onClickFilterChip,
|
|
32254
33147
|
isAllSelected: isAllSelectedForFilters,
|
|
32255
33148
|
searchQuery: viewPresetListSearchQuery,
|
|
32256
|
-
onSearch: onSearchFilter
|
|
33149
|
+
onSearch: onSearchFilter,
|
|
33150
|
+
ref: filterRef
|
|
32257
33151
|
}), /*#__PURE__*/React.createElement(WorkspaceSelectList, {
|
|
32258
33152
|
workspacePresets: viewPresets,
|
|
32259
33153
|
currentSelectedId: activeViewPresetId || undefined,
|
|
@@ -32266,7 +33160,8 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
32266
33160
|
isLoggedIn: isLoggedIn,
|
|
32267
33161
|
hideNewWorkspace: shouldHideNewWorkspace,
|
|
32268
33162
|
searchQuery: viewPresetListSearchQuery,
|
|
32269
|
-
testIdPrefix: "viewpreset"
|
|
33163
|
+
testIdPrefix: "viewpreset",
|
|
33164
|
+
ref: filterRef
|
|
32270
33165
|
})));
|
|
32271
33166
|
};
|
|
32272
33167
|
|
|
@@ -32295,8 +33190,7 @@ var ViewPresetMenu = function ViewPresetMenu(_ref) {
|
|
|
32295
33190
|
var toolContainer = /*#__PURE__*/React__default.createElement(ToolContainer, {
|
|
32296
33191
|
style: {
|
|
32297
33192
|
width: 320,
|
|
32298
|
-
|
|
32299
|
-
height: 'auto',
|
|
33193
|
+
height: 'calc(100% - 80px)',
|
|
32300
33194
|
position: 'absolute',
|
|
32301
33195
|
top: '16px'
|
|
32302
33196
|
},
|
|
@@ -32353,6 +33247,7 @@ var WorkspaceOptions = function WorkspaceOptions(_ref) {
|
|
|
32353
33247
|
setAnchorEl(document.getElementById(id));
|
|
32354
33248
|
}
|
|
32355
33249
|
}, [isDefaultOpen, id]);
|
|
33250
|
+
var editTitle = id === 'viewpreset-options-toolbutton' ? 'Edit (name)' : 'Edit (name and abstract)';
|
|
32356
33251
|
var options = [{
|
|
32357
33252
|
title: 'Save',
|
|
32358
33253
|
callback: handleSave
|
|
@@ -32363,7 +33258,7 @@ var WorkspaceOptions = function WorkspaceOptions(_ref) {
|
|
|
32363
33258
|
title: 'Save (incl. viewpresets)',
|
|
32364
33259
|
callback: handleSaveAll
|
|
32365
33260
|
}] : []), [{
|
|
32366
|
-
title:
|
|
33261
|
+
title: editTitle,
|
|
32367
33262
|
callback: handleEdit
|
|
32368
33263
|
}, {
|
|
32369
33264
|
title: 'Delete',
|
|
@@ -32551,6 +33446,22 @@ var WorkspaceViewTitleConnect = function WorkspaceViewTitleConnect(_ref) {
|
|
|
32551
33446
|
}
|
|
32552
33447
|
});
|
|
32553
33448
|
};
|
|
33449
|
+
var onEdit = function onEdit() {
|
|
33450
|
+
var formTitle = activeMapPresetId ? title : '';
|
|
33451
|
+
openViewPresetsDialog({
|
|
33452
|
+
title: MAPPRESET_DIALOG_TITLE_EDIT,
|
|
33453
|
+
action: PresetAction.EDIT,
|
|
33454
|
+
panelId: panelId,
|
|
33455
|
+
viewPresetId: activeMapPresetId,
|
|
33456
|
+
formValues: {
|
|
33457
|
+
title: formTitle,
|
|
33458
|
+
initialProps: {
|
|
33459
|
+
mapPreset: currentMapPreset,
|
|
33460
|
+
syncGroupsIds: relatedSyncGroupIds
|
|
33461
|
+
}
|
|
33462
|
+
}
|
|
33463
|
+
});
|
|
33464
|
+
};
|
|
32554
33465
|
var isNewActive = activeMapPresetId === '';
|
|
32555
33466
|
var title = (workspaceView === null || workspaceView === void 0 ? void 0 : workspaceView.title) || MAPPRESET_ACTIVE_TITLE;
|
|
32556
33467
|
var viewScope = workspaceView === null || workspaceView === void 0 ? void 0 : workspaceView.scope;
|
|
@@ -32562,6 +33473,7 @@ var WorkspaceViewTitleConnect = function WorkspaceViewTitleConnect(_ref) {
|
|
|
32562
33473
|
handleSave: viewScope === 'user' ? onSave : undefined,
|
|
32563
33474
|
handleDelete: viewScope === 'user' ? onDelete : undefined,
|
|
32564
33475
|
handleSaveAs: onSaveAs,
|
|
33476
|
+
handleEdit: viewScope === 'user' ? onEdit : undefined,
|
|
32565
33477
|
id: "viewpreset-options-toolbutton"
|
|
32566
33478
|
});
|
|
32567
33479
|
};
|
|
@@ -36497,6 +37409,7 @@ var Box$1 = Box;
|
|
|
36497
37409
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
36498
37410
|
* */
|
|
36499
37411
|
var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
37412
|
+
var filterRef = React.useRef(null);
|
|
36500
37413
|
var currentView = useSelector(function (store) {
|
|
36501
37414
|
return getWorkspaceState(store);
|
|
36502
37415
|
});
|
|
@@ -36596,9 +37509,19 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
|
36596
37509
|
});
|
|
36597
37510
|
break;
|
|
36598
37511
|
}
|
|
36599
|
-
|
|
36600
|
-
|
|
36601
|
-
|
|
37512
|
+
case WorkspacePresetAction.EDIT:
|
|
37513
|
+
{
|
|
37514
|
+
setWorkspaceActionDialogOptions({
|
|
37515
|
+
action: workspaceAction,
|
|
37516
|
+
presetId: presetId,
|
|
37517
|
+
formValues: {
|
|
37518
|
+
title: presetTitle,
|
|
37519
|
+
"abstract": affectedPreset["abstract"],
|
|
37520
|
+
scope: 'user'
|
|
37521
|
+
}
|
|
37522
|
+
});
|
|
37523
|
+
break;
|
|
37524
|
+
}
|
|
36602
37525
|
// case WorkspacePresetAction.SAVE: {
|
|
36603
37526
|
// break;
|
|
36604
37527
|
// }
|
|
@@ -36645,12 +37568,17 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
|
36645
37568
|
return fetchWorkspaceList();
|
|
36646
37569
|
}
|
|
36647
37570
|
}
|
|
36648
|
-
}))),
|
|
37571
|
+
}))), /*#__PURE__*/React.createElement(Box$2, {
|
|
37572
|
+
sx: {
|
|
37573
|
+
padding: 1
|
|
37574
|
+
}
|
|
37575
|
+
}, !error && /*#__PURE__*/React.createElement(WorkspaceFilter, {
|
|
36649
37576
|
filters: workspaceListFilters,
|
|
36650
37577
|
onClickFilterChip: onClickFilterChip,
|
|
36651
37578
|
isAllSelected: isAllSelected,
|
|
36652
37579
|
searchQuery: workspaceSearchQuery,
|
|
36653
|
-
onSearch: searchFilter
|
|
37580
|
+
onSearch: searchFilter,
|
|
37581
|
+
ref: filterRef
|
|
36654
37582
|
}), /*#__PURE__*/React.createElement(WorkspaceSelectList, {
|
|
36655
37583
|
workspacePresets: workspacePresets,
|
|
36656
37584
|
currentSelectedId: currentView.id || '',
|
|
@@ -36658,8 +37586,9 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
|
36658
37586
|
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
36659
37587
|
hideNewWorkspace: shouldHideNewWorkspace,
|
|
36660
37588
|
isLoggedIn: isLoggedIn,
|
|
36661
|
-
searchQuery: workspaceSearchQuery
|
|
36662
|
-
|
|
37589
|
+
searchQuery: workspaceSearchQuery,
|
|
37590
|
+
ref: filterRef
|
|
37591
|
+
})));
|
|
36663
37592
|
};
|
|
36664
37593
|
|
|
36665
37594
|
/* *
|
|
@@ -36683,12 +37612,10 @@ var WorkspaceMenu = function WorkspaceMenu(_ref) {
|
|
|
36683
37612
|
_ref$hideBackdrop = _ref.hideBackdrop,
|
|
36684
37613
|
hideBackdrop = _ref$hideBackdrop === void 0 ? false : _ref$hideBackdrop,
|
|
36685
37614
|
closeMenu = _ref.closeMenu;
|
|
36686
|
-
_ref.filter;
|
|
36687
37615
|
var toolContainer = /*#__PURE__*/React__default.createElement(ToolContainer, {
|
|
36688
37616
|
style: {
|
|
36689
37617
|
width: 320,
|
|
36690
|
-
|
|
36691
|
-
height: 'auto',
|
|
37618
|
+
height: 'calc(100vh - 88px)',
|
|
36692
37619
|
position: 'absolute',
|
|
36693
37620
|
top: '16px'
|
|
36694
37621
|
},
|
|
@@ -36697,11 +37624,7 @@ var WorkspaceMenu = function WorkspaceMenu(_ref) {
|
|
|
36697
37624
|
onClick: function onClick(event) {
|
|
36698
37625
|
event.stopPropagation();
|
|
36699
37626
|
}
|
|
36700
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
36701
|
-
sx: {
|
|
36702
|
-
padding: 1
|
|
36703
|
-
}
|
|
36704
|
-
}, /*#__PURE__*/React__default.createElement(WorkspaceSelectListConnect, null)));
|
|
37627
|
+
}, /*#__PURE__*/React__default.createElement(WorkspaceSelectListConnect, null));
|
|
36705
37628
|
return /*#__PURE__*/React__default.createElement("div", null, hideBackdrop ?
|
|
36706
37629
|
// Enable hiding backdrop from snapshot tests
|
|
36707
37630
|
toolContainer : /*#__PURE__*/React__default.createElement(Backdrop, {
|
|
@@ -36884,6 +37807,13 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
36884
37807
|
workspace: workspaceData
|
|
36885
37808
|
}));
|
|
36886
37809
|
}, [dispatch, workspaceData]);
|
|
37810
|
+
var onEdit = function onEdit() {
|
|
37811
|
+
setWorkspaceActionDialogOptions({
|
|
37812
|
+
action: WorkspacePresetAction.EDIT,
|
|
37813
|
+
presetId: workspaceId,
|
|
37814
|
+
formValues: Object.assign({}, workspaceData)
|
|
37815
|
+
});
|
|
37816
|
+
};
|
|
36887
37817
|
var fullTitle = getTitle(title, hasChanges, workspaceId);
|
|
36888
37818
|
return /*#__PURE__*/React.createElement(WorkspaceOptions, {
|
|
36889
37819
|
hasChanges: hasChanges,
|
|
@@ -36893,6 +37823,7 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
36893
37823
|
handleSaveAs: onSaveAs,
|
|
36894
37824
|
handleSaveAll: onSaveAll,
|
|
36895
37825
|
handleSave: workspaceScope === 'user' ? onSave : undefined,
|
|
37826
|
+
handleEdit: workspaceScope === 'user' ? onEdit : undefined,
|
|
36896
37827
|
isDisabled: !viewIds.length || !isLoggedIn
|
|
36897
37828
|
});
|
|
36898
37829
|
};
|
|
@@ -37019,7 +37950,7 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
37019
37950
|
event.preventDefault();
|
|
37020
37951
|
onSubmit();
|
|
37021
37952
|
};
|
|
37022
|
-
var hasFormInput = action === WorkspacePresetAction.DUPLICATE || action === WorkspacePresetAction.SAVE_AS || action === WorkspacePresetAction.SAVE_ALL;
|
|
37953
|
+
var hasFormInput = action === WorkspacePresetAction.DUPLICATE || action === WorkspacePresetAction.SAVE_AS || action === WorkspacePresetAction.SAVE_ALL || action === WorkspacePresetAction.EDIT;
|
|
37023
37954
|
// disable form inputs for 'Save (incl. viewpresets)' existing workspace preset
|
|
37024
37955
|
var isDisabled = action === WorkspacePresetAction.SAVE_ALL && formValues.id !== undefined && formValues.id !== '' && formValues.scope === 'user';
|
|
37025
37956
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, Boolean(error) && /*#__PURE__*/React__default.createElement(Box$2, {
|
|
@@ -37095,6 +38026,7 @@ var DIALOG_TITLE_DELETE = 'Delete workspace';
|
|
|
37095
38026
|
var DIALOG_TITLE_DUPLICATE = 'Duplicate';
|
|
37096
38027
|
var DIALOG_BUTTON_SAVE = 'Save';
|
|
37097
38028
|
var DIALOG_BUTTON_DELETE = 'Delete';
|
|
38029
|
+
var DIALOG_BUTTON_EDIT = 'Edit (name and abstract)';
|
|
37098
38030
|
var getDialogTitle = function getDialogTitle(action) {
|
|
37099
38031
|
switch (action) {
|
|
37100
38032
|
case WorkspacePresetAction.DELETE:
|
|
@@ -37109,6 +38041,10 @@ var getDialogTitle = function getDialogTitle(action) {
|
|
|
37109
38041
|
{
|
|
37110
38042
|
return DIALOG_TITLE_SAVE_ALL;
|
|
37111
38043
|
}
|
|
38044
|
+
case WorkspacePresetAction.EDIT:
|
|
38045
|
+
{
|
|
38046
|
+
return DIALOG_BUTTON_EDIT;
|
|
38047
|
+
}
|
|
37112
38048
|
default:
|
|
37113
38049
|
{
|
|
37114
38050
|
return DIALOG_TITLE_SAVE_AS;
|
|
@@ -37312,7 +38248,7 @@ var MapPresetsForm = function MapPresetsForm(_ref) {
|
|
|
37312
38248
|
}
|
|
37313
38249
|
}, /*#__PURE__*/React__default.createElement(AlertBanner, {
|
|
37314
38250
|
title: error
|
|
37315
|
-
})), action === PresetAction.SAVE_AS && /*#__PURE__*/React__default.createElement("form", {
|
|
38251
|
+
})), (action === PresetAction.SAVE_AS || action === PresetAction.EDIT) && /*#__PURE__*/React__default.createElement("form", {
|
|
37316
38252
|
"data-testid": "map-preset-form",
|
|
37317
38253
|
onSubmit: onSubmitForm
|
|
37318
38254
|
}, /*#__PURE__*/React__default.createElement(ReactHookFormTextField, {
|
|
@@ -37388,7 +38324,7 @@ var MapPresetsFormDialog = function MapPresetsFormDialog(_ref) {
|
|
|
37388
38324
|
var confirmLabel = getConfirmLabel(action);
|
|
37389
38325
|
var onFormSubmit = function onFormSubmit(newFormValues) {
|
|
37390
38326
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
37391
|
-
var newId, message;
|
|
38327
|
+
var newId, _yield$api$getViewPre, originalViewPreset, viewPresetEdited, message;
|
|
37392
38328
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
37393
38329
|
while (1) switch (_context.prev = _context.next) {
|
|
37394
38330
|
case 0:
|
|
@@ -37396,7 +38332,7 @@ var MapPresetsFormDialog = function MapPresetsFormDialog(_ref) {
|
|
|
37396
38332
|
setError(null);
|
|
37397
38333
|
setIsLoading(true);
|
|
37398
38334
|
_context.t0 = action;
|
|
37399
|
-
_context.next = _context.t0 === PresetAction.SAVE_AS ? 6 : _context.t0 === PresetAction.DELETE ? 13 : 19;
|
|
38335
|
+
_context.next = _context.t0 === PresetAction.SAVE_AS ? 6 : _context.t0 === PresetAction.DELETE ? 13 : _context.t0 === PresetAction.EDIT ? 19 : 30;
|
|
37400
38336
|
break;
|
|
37401
38337
|
case 6:
|
|
37402
38338
|
_context.next = 8;
|
|
@@ -37406,7 +38342,7 @@ var MapPresetsFormDialog = function MapPresetsFormDialog(_ref) {
|
|
|
37406
38342
|
setIsLoading(false);
|
|
37407
38343
|
onClose();
|
|
37408
38344
|
onSuccess(action, newId, newFormValues.title);
|
|
37409
|
-
return _context.abrupt("break",
|
|
38345
|
+
return _context.abrupt("break", 31);
|
|
37410
38346
|
case 13:
|
|
37411
38347
|
_context.next = 15;
|
|
37412
38348
|
return api.deleteViewPreset(viewPresetId);
|
|
@@ -37414,23 +38350,39 @@ var MapPresetsFormDialog = function MapPresetsFormDialog(_ref) {
|
|
|
37414
38350
|
setIsLoading(false);
|
|
37415
38351
|
onClose();
|
|
37416
38352
|
onSuccess(action, viewPresetId, newFormValues.title);
|
|
37417
|
-
return _context.abrupt("break",
|
|
38353
|
+
return _context.abrupt("break", 31);
|
|
37418
38354
|
case 19:
|
|
37419
|
-
|
|
37420
|
-
|
|
37421
|
-
|
|
38355
|
+
_context.next = 21;
|
|
38356
|
+
return api.getViewPreset(viewPresetId);
|
|
38357
|
+
case 21:
|
|
38358
|
+
_yield$api$getViewPre = _context.sent;
|
|
38359
|
+
originalViewPreset = _yield$api$getViewPre.data;
|
|
38360
|
+
viewPresetEdited = Object.assign(Object.assign({}, originalViewPreset), {
|
|
38361
|
+
title: newFormValues.title
|
|
38362
|
+
});
|
|
38363
|
+
_context.next = 26;
|
|
38364
|
+
return api.saveViewPreset(viewPresetId, viewPresetEdited);
|
|
38365
|
+
case 26:
|
|
38366
|
+
setIsLoading(false);
|
|
38367
|
+
onClose();
|
|
38368
|
+
onSuccess(action, viewPresetId, newFormValues.title);
|
|
38369
|
+
return _context.abrupt("break", 31);
|
|
38370
|
+
case 30:
|
|
38371
|
+
return _context.abrupt("break", 31);
|
|
38372
|
+
case 31:
|
|
38373
|
+
_context.next = 38;
|
|
37422
38374
|
break;
|
|
37423
|
-
case
|
|
37424
|
-
_context.prev =
|
|
38375
|
+
case 33:
|
|
38376
|
+
_context.prev = 33;
|
|
37425
38377
|
_context.t1 = _context["catch"](0);
|
|
37426
38378
|
setIsLoading(false);
|
|
37427
38379
|
message = isAxiosError(_context.t1) ? getAxiosErrorMessage(_context.t1) : _context.t1.message;
|
|
37428
38380
|
setError(message);
|
|
37429
|
-
case
|
|
38381
|
+
case 38:
|
|
37430
38382
|
case "end":
|
|
37431
38383
|
return _context.stop();
|
|
37432
38384
|
}
|
|
37433
|
-
}, _callee, null, [[0,
|
|
38385
|
+
}, _callee, null, [[0, 33]]);
|
|
37434
38386
|
}));
|
|
37435
38387
|
};
|
|
37436
38388
|
var onSubmit = function onSubmit() {
|