@bigbinary/neeto-rules-frontend 0.3.5 → 0.3.7
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/README.md +12 -458
- package/dist/index.cjs.js +738 -2846
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +729 -2837
- package/dist/index.js.map +1 -1
- package/package.json +140 -113
- package/types.d.ts +72 -0
- package/dist/main.css +0 -2
- package/dist/main.css.map +0 -1
- /package/{src → app/javascript/src}/translations/en.json +0 -0
- /package/{src → app/javascript/src}/translations/fr.json +0 -0
- /package/{src → app/javascript/src}/translations/index.js +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
import "./main.css";
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
4
|
|
|
7
5
|
var React = require('react');
|
|
6
|
+
var reactRouterDom = require('react-router-dom');
|
|
7
|
+
var shallow = require('zustand/shallow');
|
|
8
8
|
var classNames = require('classnames');
|
|
9
9
|
var formik = require('formik');
|
|
10
10
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
11
11
|
var formik$1 = require('@bigbinary/neetoui/formik');
|
|
12
12
|
var i18next = require('i18next');
|
|
13
|
-
var neetoEditor = require('@bigbinary/neeto-editor');
|
|
14
13
|
var yup = require('yup');
|
|
14
|
+
var neetoEditor = require('@bigbinary/neeto-editor');
|
|
15
|
+
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
16
|
+
var zustand = require('zustand');
|
|
15
17
|
var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
|
|
16
18
|
var neetoui = require('@bigbinary/neetoui');
|
|
17
19
|
var reactI18next = require('react-i18next');
|
|
18
20
|
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
19
21
|
var ramda = require('ramda');
|
|
20
22
|
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
21
|
-
var dayjs = require('dayjs');
|
|
22
|
-
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
23
23
|
|
|
24
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
25
|
|
|
@@ -45,175 +45,11 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
45
45
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
46
46
|
var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
|
|
47
47
|
var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
|
|
48
|
-
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
49
48
|
|
|
50
49
|
function _objectDestructuringEmpty(obj) {
|
|
51
50
|
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
function _setPrototypeOf$1(o, p) {
|
|
55
|
-
_setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
56
|
-
o.__proto__ = p;
|
|
57
|
-
return o;
|
|
58
|
-
};
|
|
59
|
-
return _setPrototypeOf$1(o, p);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function _inheritsLoose$1(subClass, superClass) {
|
|
63
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
64
|
-
subClass.prototype.constructor = subClass;
|
|
65
|
-
_setPrototypeOf$1(subClass, superClass);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
var propTypes = {exports: {}};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the MIT license found in the
|
|
74
|
-
* LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/
|
|
76
|
-
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
77
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
81
|
-
*
|
|
82
|
-
* This source code is licensed under the MIT license found in the
|
|
83
|
-
* LICENSE file in the root directory of this source tree.
|
|
84
|
-
*/
|
|
85
|
-
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
86
|
-
function emptyFunction() {}
|
|
87
|
-
function emptyFunctionWithReset() {}
|
|
88
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
89
|
-
var factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
90
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
91
|
-
if (secret === ReactPropTypesSecret) {
|
|
92
|
-
// It is still safe when called from React.
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
|
96
|
-
err.name = 'Invariant Violation';
|
|
97
|
-
throw err;
|
|
98
|
-
}
|
|
99
|
-
shim.isRequired = shim;
|
|
100
|
-
function getShim() {
|
|
101
|
-
return shim;
|
|
102
|
-
}
|
|
103
|
-
// Important!
|
|
104
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
105
|
-
var ReactPropTypes = {
|
|
106
|
-
array: shim,
|
|
107
|
-
bigint: shim,
|
|
108
|
-
bool: shim,
|
|
109
|
-
func: shim,
|
|
110
|
-
number: shim,
|
|
111
|
-
object: shim,
|
|
112
|
-
string: shim,
|
|
113
|
-
symbol: shim,
|
|
114
|
-
any: shim,
|
|
115
|
-
arrayOf: getShim,
|
|
116
|
-
element: shim,
|
|
117
|
-
elementType: shim,
|
|
118
|
-
instanceOf: getShim,
|
|
119
|
-
node: shim,
|
|
120
|
-
objectOf: getShim,
|
|
121
|
-
oneOf: getShim,
|
|
122
|
-
oneOfType: getShim,
|
|
123
|
-
shape: getShim,
|
|
124
|
-
exact: getShim,
|
|
125
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
126
|
-
resetWarningCache: emptyFunction
|
|
127
|
-
};
|
|
128
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
129
|
-
return ReactPropTypes;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
134
|
-
*
|
|
135
|
-
* This source code is licensed under the MIT license found in the
|
|
136
|
-
* LICENSE file in the root directory of this source tree.
|
|
137
|
-
*/
|
|
138
|
-
{
|
|
139
|
-
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
140
|
-
// http://fb.me/prop-types-in-prod
|
|
141
|
-
propTypes.exports = factoryWithThrowingShims();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function _extends$1() {
|
|
145
|
-
_extends$1 = Object.assign || function (target) {
|
|
146
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
147
|
-
var source = arguments[i];
|
|
148
|
-
for (var key in source) {
|
|
149
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
150
|
-
target[key] = source[key];
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return target;
|
|
155
|
-
};
|
|
156
|
-
return _extends$1.apply(this, arguments);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function isAbsolute(pathname) {
|
|
160
|
-
return pathname.charAt(0) === '/';
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// About 1.5x faster than the two-arg version of Array#splice()
|
|
164
|
-
function spliceOne(list, index) {
|
|
165
|
-
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
|
|
166
|
-
list[i] = list[k];
|
|
167
|
-
}
|
|
168
|
-
list.pop();
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// This implementation is based heavily on node's url.parse
|
|
172
|
-
function resolvePathname(to, from) {
|
|
173
|
-
if (from === undefined) from = '';
|
|
174
|
-
var toParts = to && to.split('/') || [];
|
|
175
|
-
var fromParts = from && from.split('/') || [];
|
|
176
|
-
var isToAbs = to && isAbsolute(to);
|
|
177
|
-
var isFromAbs = from && isAbsolute(from);
|
|
178
|
-
var mustEndAbs = isToAbs || isFromAbs;
|
|
179
|
-
if (to && isAbsolute(to)) {
|
|
180
|
-
// to is absolute
|
|
181
|
-
fromParts = toParts;
|
|
182
|
-
} else if (toParts.length) {
|
|
183
|
-
// to is relative, drop the filename
|
|
184
|
-
fromParts.pop();
|
|
185
|
-
fromParts = fromParts.concat(toParts);
|
|
186
|
-
}
|
|
187
|
-
if (!fromParts.length) return '/';
|
|
188
|
-
var hasTrailingSlash;
|
|
189
|
-
if (fromParts.length) {
|
|
190
|
-
var last = fromParts[fromParts.length - 1];
|
|
191
|
-
hasTrailingSlash = last === '.' || last === '..' || last === '';
|
|
192
|
-
} else {
|
|
193
|
-
hasTrailingSlash = false;
|
|
194
|
-
}
|
|
195
|
-
var up = 0;
|
|
196
|
-
for (var i = fromParts.length; i >= 0; i--) {
|
|
197
|
-
var part = fromParts[i];
|
|
198
|
-
if (part === '.') {
|
|
199
|
-
spliceOne(fromParts, i);
|
|
200
|
-
} else if (part === '..') {
|
|
201
|
-
spliceOne(fromParts, i);
|
|
202
|
-
up++;
|
|
203
|
-
} else if (up) {
|
|
204
|
-
spliceOne(fromParts, i);
|
|
205
|
-
up--;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
if (!mustEndAbs) for (; up--; up) {
|
|
209
|
-
fromParts.unshift('..');
|
|
210
|
-
}
|
|
211
|
-
if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift('');
|
|
212
|
-
var result = fromParts.join('/');
|
|
213
|
-
if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
|
|
214
|
-
return result;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
53
|
function _typeof$1(obj) {
|
|
218
54
|
"@babel/helpers - typeof";
|
|
219
55
|
|
|
@@ -224,2511 +60,166 @@ function _typeof$1(obj) {
|
|
|
224
60
|
}, _typeof$1(obj);
|
|
225
61
|
}
|
|
226
62
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
throw new
|
|
63
|
+
function _toPrimitive(input, hint) {
|
|
64
|
+
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
65
|
+
var prim = input[Symbol.toPrimitive];
|
|
66
|
+
if (prim !== undefined) {
|
|
67
|
+
var res = prim.call(input, hint || "default");
|
|
68
|
+
if (_typeof$1(res) !== "object") return res;
|
|
69
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
234
70
|
}
|
|
71
|
+
return (hint === "string" ? String : Number)(input);
|
|
235
72
|
}
|
|
236
73
|
|
|
237
|
-
function
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
function stripLeadingSlash(path) {
|
|
241
|
-
return path.charAt(0) === '/' ? path.substr(1) : path;
|
|
242
|
-
}
|
|
243
|
-
function hasBasename(path, prefix) {
|
|
244
|
-
return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
|
|
245
|
-
}
|
|
246
|
-
function stripBasename$1(path, prefix) {
|
|
247
|
-
return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
|
|
248
|
-
}
|
|
249
|
-
function stripTrailingSlash(path) {
|
|
250
|
-
return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
|
|
251
|
-
}
|
|
252
|
-
function parsePath(path) {
|
|
253
|
-
var pathname = path || '/';
|
|
254
|
-
var search = '';
|
|
255
|
-
var hash = '';
|
|
256
|
-
var hashIndex = pathname.indexOf('#');
|
|
257
|
-
if (hashIndex !== -1) {
|
|
258
|
-
hash = pathname.substr(hashIndex);
|
|
259
|
-
pathname = pathname.substr(0, hashIndex);
|
|
260
|
-
}
|
|
261
|
-
var searchIndex = pathname.indexOf('?');
|
|
262
|
-
if (searchIndex !== -1) {
|
|
263
|
-
search = pathname.substr(searchIndex);
|
|
264
|
-
pathname = pathname.substr(0, searchIndex);
|
|
265
|
-
}
|
|
266
|
-
return {
|
|
267
|
-
pathname: pathname,
|
|
268
|
-
search: search === '?' ? '' : search,
|
|
269
|
-
hash: hash === '#' ? '' : hash
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
function createPath(location) {
|
|
273
|
-
var pathname = location.pathname,
|
|
274
|
-
search = location.search,
|
|
275
|
-
hash = location.hash;
|
|
276
|
-
var path = pathname || '/';
|
|
277
|
-
if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
|
|
278
|
-
if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
|
|
279
|
-
return path;
|
|
74
|
+
function _toPropertyKey(arg) {
|
|
75
|
+
var key = _toPrimitive(arg, "string");
|
|
76
|
+
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
280
77
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if (location.search) {
|
|
292
|
-
if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
|
|
293
|
-
} else {
|
|
294
|
-
location.search = '';
|
|
295
|
-
}
|
|
296
|
-
if (location.hash) {
|
|
297
|
-
if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
|
|
298
|
-
} else {
|
|
299
|
-
location.hash = '';
|
|
300
|
-
}
|
|
301
|
-
if (state !== undefined && location.state === undefined) location.state = state;
|
|
302
|
-
}
|
|
303
|
-
try {
|
|
304
|
-
location.pathname = decodeURI(location.pathname);
|
|
305
|
-
} catch (e) {
|
|
306
|
-
if (e instanceof URIError) {
|
|
307
|
-
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
|
|
308
|
-
} else {
|
|
309
|
-
throw e;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
if (key) location.key = key;
|
|
313
|
-
if (currentLocation) {
|
|
314
|
-
// Resolve incomplete/relative pathname relative to current location.
|
|
315
|
-
if (!location.pathname) {
|
|
316
|
-
location.pathname = currentLocation.pathname;
|
|
317
|
-
} else if (location.pathname.charAt(0) !== '/') {
|
|
318
|
-
location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
|
|
319
|
-
}
|
|
78
|
+
|
|
79
|
+
function _defineProperty(obj, key, value) {
|
|
80
|
+
key = _toPropertyKey(key);
|
|
81
|
+
if (key in obj) {
|
|
82
|
+
Object.defineProperty(obj, key, {
|
|
83
|
+
value: value,
|
|
84
|
+
enumerable: true,
|
|
85
|
+
configurable: true,
|
|
86
|
+
writable: true
|
|
87
|
+
});
|
|
320
88
|
} else {
|
|
321
|
-
|
|
322
|
-
if (!location.pathname) {
|
|
323
|
-
location.pathname = '/';
|
|
324
|
-
}
|
|
89
|
+
obj[key] = value;
|
|
325
90
|
}
|
|
326
|
-
return
|
|
91
|
+
return obj;
|
|
327
92
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
// the previous one, we may end up in a weird state. Figure out the
|
|
339
|
-
// best way to handle this.
|
|
340
|
-
if (prompt != null) {
|
|
341
|
-
var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
|
|
342
|
-
if (typeof result === 'string') {
|
|
343
|
-
if (typeof getUserConfirmation === 'function') {
|
|
344
|
-
getUserConfirmation(result, callback);
|
|
345
|
-
} else {
|
|
346
|
-
callback(true);
|
|
347
|
-
}
|
|
348
|
-
} else {
|
|
349
|
-
// Return false from a transition hook to cancel the transition.
|
|
350
|
-
callback(result !== false);
|
|
351
|
-
}
|
|
352
|
-
} else {
|
|
353
|
-
callback(true);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
var listeners = [];
|
|
357
|
-
function appendListener(fn) {
|
|
358
|
-
var isActive = true;
|
|
359
|
-
function listener() {
|
|
360
|
-
if (isActive) fn.apply(void 0, arguments);
|
|
361
|
-
}
|
|
362
|
-
listeners.push(listener);
|
|
363
|
-
return function () {
|
|
364
|
-
isActive = false;
|
|
365
|
-
listeners = listeners.filter(function (item) {
|
|
366
|
-
return item !== listener;
|
|
367
|
-
});
|
|
368
|
-
};
|
|
93
|
+
|
|
94
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
95
|
+
if (source == null) return {};
|
|
96
|
+
var target = {};
|
|
97
|
+
var sourceKeys = Object.keys(source);
|
|
98
|
+
var key, i;
|
|
99
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
100
|
+
key = sourceKeys[i];
|
|
101
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
102
|
+
target[key] = source[key];
|
|
369
103
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
104
|
+
return target;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function _objectWithoutProperties(source, excluded) {
|
|
108
|
+
if (source == null) return {};
|
|
109
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
110
|
+
var key, i;
|
|
111
|
+
if (Object.getOwnPropertySymbols) {
|
|
112
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
113
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
114
|
+
key = sourceSymbolKeys[i];
|
|
115
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
116
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
117
|
+
target[key] = source[key];
|
|
373
118
|
}
|
|
374
|
-
listeners.forEach(function (listener) {
|
|
375
|
-
return listener.apply(void 0, args);
|
|
376
|
-
});
|
|
377
119
|
}
|
|
378
|
-
return
|
|
379
|
-
setPrompt: setPrompt,
|
|
380
|
-
confirmTransitionTo: confirmTransitionTo,
|
|
381
|
-
appendListener: appendListener,
|
|
382
|
-
notifyListeners: notifyListeners
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
386
|
-
function getConfirmation(message, callback) {
|
|
387
|
-
callback(window.confirm(message)); // eslint-disable-line no-alert
|
|
120
|
+
return target;
|
|
388
121
|
}
|
|
389
|
-
/**
|
|
390
|
-
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
|
|
391
|
-
*
|
|
392
|
-
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
|
|
393
|
-
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
|
|
394
|
-
* changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
|
|
395
|
-
*/
|
|
396
122
|
|
|
397
|
-
|
|
398
|
-
var ua = window.navigator.userAgent;
|
|
399
|
-
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
|
|
400
|
-
return window.history && 'pushState' in window.history;
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Returns true if browser fires popstate on hash change.
|
|
404
|
-
* IE10 and IE11 do not.
|
|
405
|
-
*/
|
|
123
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
406
124
|
|
|
407
|
-
function
|
|
408
|
-
|
|
125
|
+
function getDefaultExportFromCjs (x) {
|
|
126
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
409
127
|
}
|
|
410
|
-
/**
|
|
411
|
-
* Returns false if using go(n) with hash history causes a full page reload.
|
|
412
|
-
*/
|
|
413
128
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
129
|
+
var propTypes = {exports: {}};
|
|
130
|
+
|
|
417
131
|
/**
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
132
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the MIT license found in the
|
|
135
|
+
* LICENSE file in the root directory of this source tree.
|
|
421
136
|
*/
|
|
422
137
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
var HashChangeEvent = 'hashchange';
|
|
428
|
-
function getHistoryState() {
|
|
429
|
-
try {
|
|
430
|
-
return window.history.state || {};
|
|
431
|
-
} catch (e) {
|
|
432
|
-
// IE 11 sometimes throws when accessing window.history.state
|
|
433
|
-
// See https://github.com/ReactTraining/history/pull/289
|
|
434
|
-
return {};
|
|
435
|
-
}
|
|
436
|
-
}
|
|
138
|
+
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
139
|
+
|
|
140
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
141
|
+
|
|
437
142
|
/**
|
|
438
|
-
*
|
|
439
|
-
*
|
|
143
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
144
|
+
*
|
|
145
|
+
* This source code is licensed under the MIT license found in the
|
|
146
|
+
* LICENSE file in the root directory of this source tree.
|
|
440
147
|
*/
|
|
441
148
|
|
|
442
|
-
|
|
443
|
-
if (props === void 0) {
|
|
444
|
-
props = {};
|
|
445
|
-
}
|
|
446
|
-
!canUseDOM ? invariant(false) : void 0;
|
|
447
|
-
var globalHistory = window.history;
|
|
448
|
-
var canUseHistory = supportsHistory();
|
|
449
|
-
var needsHashChangeListener = !supportsPopStateOnHashChange();
|
|
450
|
-
var _props = props,
|
|
451
|
-
_props$forceRefresh = _props.forceRefresh,
|
|
452
|
-
forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
|
|
453
|
-
_props$getUserConfirm = _props.getUserConfirmation,
|
|
454
|
-
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
|
|
455
|
-
_props$keyLength = _props.keyLength,
|
|
456
|
-
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
|
457
|
-
var basename = props.basename ? stripTrailingSlash(addLeadingSlash$1(props.basename)) : '';
|
|
458
|
-
function getDOMLocation(historyState) {
|
|
459
|
-
var _ref = historyState || {},
|
|
460
|
-
key = _ref.key,
|
|
461
|
-
state = _ref.state;
|
|
462
|
-
var _window$location = window.location,
|
|
463
|
-
pathname = _window$location.pathname,
|
|
464
|
-
search = _window$location.search,
|
|
465
|
-
hash = _window$location.hash;
|
|
466
|
-
var path = pathname + search + hash;
|
|
467
|
-
if (basename) path = stripBasename$1(path, basename);
|
|
468
|
-
return createLocation(path, state, key);
|
|
469
|
-
}
|
|
470
|
-
function createKey() {
|
|
471
|
-
return Math.random().toString(36).substr(2, keyLength);
|
|
472
|
-
}
|
|
473
|
-
var transitionManager = createTransitionManager();
|
|
474
|
-
function setState(nextState) {
|
|
475
|
-
_extends$1(history, nextState);
|
|
476
|
-
history.length = globalHistory.length;
|
|
477
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
478
|
-
}
|
|
479
|
-
function handlePopState(event) {
|
|
480
|
-
// Ignore extraneous popstate events in WebKit.
|
|
481
|
-
if (isExtraneousPopstateEvent(event)) return;
|
|
482
|
-
handlePop(getDOMLocation(event.state));
|
|
483
|
-
}
|
|
484
|
-
function handleHashChange() {
|
|
485
|
-
handlePop(getDOMLocation(getHistoryState()));
|
|
486
|
-
}
|
|
487
|
-
var forceNextPop = false;
|
|
488
|
-
function handlePop(location) {
|
|
489
|
-
if (forceNextPop) {
|
|
490
|
-
forceNextPop = false;
|
|
491
|
-
setState();
|
|
492
|
-
} else {
|
|
493
|
-
var action = 'POP';
|
|
494
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
495
|
-
if (ok) {
|
|
496
|
-
setState({
|
|
497
|
-
action: action,
|
|
498
|
-
location: location
|
|
499
|
-
});
|
|
500
|
-
} else {
|
|
501
|
-
revertPop(location);
|
|
502
|
-
}
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
function revertPop(fromLocation) {
|
|
507
|
-
var toLocation = history.location; // TODO: We could probably make this more reliable by
|
|
508
|
-
// keeping a list of keys we've seen in sessionStorage.
|
|
509
|
-
// Instead, we just default to 0 for keys we don't know.
|
|
510
|
-
|
|
511
|
-
var toIndex = allKeys.indexOf(toLocation.key);
|
|
512
|
-
if (toIndex === -1) toIndex = 0;
|
|
513
|
-
var fromIndex = allKeys.indexOf(fromLocation.key);
|
|
514
|
-
if (fromIndex === -1) fromIndex = 0;
|
|
515
|
-
var delta = toIndex - fromIndex;
|
|
516
|
-
if (delta) {
|
|
517
|
-
forceNextPop = true;
|
|
518
|
-
go(delta);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
var initialLocation = getDOMLocation(getHistoryState());
|
|
522
|
-
var allKeys = [initialLocation.key]; // Public interface
|
|
523
|
-
|
|
524
|
-
function createHref(location) {
|
|
525
|
-
return basename + createPath(location);
|
|
526
|
-
}
|
|
527
|
-
function push(path, state) {
|
|
528
|
-
var action = 'PUSH';
|
|
529
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
530
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
531
|
-
if (!ok) return;
|
|
532
|
-
var href = createHref(location);
|
|
533
|
-
var key = location.key,
|
|
534
|
-
state = location.state;
|
|
535
|
-
if (canUseHistory) {
|
|
536
|
-
globalHistory.pushState({
|
|
537
|
-
key: key,
|
|
538
|
-
state: state
|
|
539
|
-
}, null, href);
|
|
540
|
-
if (forceRefresh) {
|
|
541
|
-
window.location.href = href;
|
|
542
|
-
} else {
|
|
543
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
544
|
-
var nextKeys = allKeys.slice(0, prevIndex + 1);
|
|
545
|
-
nextKeys.push(location.key);
|
|
546
|
-
allKeys = nextKeys;
|
|
547
|
-
setState({
|
|
548
|
-
action: action,
|
|
549
|
-
location: location
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
} else {
|
|
553
|
-
window.location.href = href;
|
|
554
|
-
}
|
|
555
|
-
});
|
|
556
|
-
}
|
|
557
|
-
function replace(path, state) {
|
|
558
|
-
var action = 'REPLACE';
|
|
559
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
560
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
561
|
-
if (!ok) return;
|
|
562
|
-
var href = createHref(location);
|
|
563
|
-
var key = location.key,
|
|
564
|
-
state = location.state;
|
|
565
|
-
if (canUseHistory) {
|
|
566
|
-
globalHistory.replaceState({
|
|
567
|
-
key: key,
|
|
568
|
-
state: state
|
|
569
|
-
}, null, href);
|
|
570
|
-
if (forceRefresh) {
|
|
571
|
-
window.location.replace(href);
|
|
572
|
-
} else {
|
|
573
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
574
|
-
if (prevIndex !== -1) allKeys[prevIndex] = location.key;
|
|
575
|
-
setState({
|
|
576
|
-
action: action,
|
|
577
|
-
location: location
|
|
578
|
-
});
|
|
579
|
-
}
|
|
580
|
-
} else {
|
|
581
|
-
window.location.replace(href);
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
function go(n) {
|
|
586
|
-
globalHistory.go(n);
|
|
587
|
-
}
|
|
588
|
-
function goBack() {
|
|
589
|
-
go(-1);
|
|
590
|
-
}
|
|
591
|
-
function goForward() {
|
|
592
|
-
go(1);
|
|
593
|
-
}
|
|
594
|
-
var listenerCount = 0;
|
|
595
|
-
function checkDOMListeners(delta) {
|
|
596
|
-
listenerCount += delta;
|
|
597
|
-
if (listenerCount === 1 && delta === 1) {
|
|
598
|
-
window.addEventListener(PopStateEvent, handlePopState);
|
|
599
|
-
if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
|
|
600
|
-
} else if (listenerCount === 0) {
|
|
601
|
-
window.removeEventListener(PopStateEvent, handlePopState);
|
|
602
|
-
if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
var isBlocked = false;
|
|
606
|
-
function block(prompt) {
|
|
607
|
-
if (prompt === void 0) {
|
|
608
|
-
prompt = false;
|
|
609
|
-
}
|
|
610
|
-
var unblock = transitionManager.setPrompt(prompt);
|
|
611
|
-
if (!isBlocked) {
|
|
612
|
-
checkDOMListeners(1);
|
|
613
|
-
isBlocked = true;
|
|
614
|
-
}
|
|
615
|
-
return function () {
|
|
616
|
-
if (isBlocked) {
|
|
617
|
-
isBlocked = false;
|
|
618
|
-
checkDOMListeners(-1);
|
|
619
|
-
}
|
|
620
|
-
return unblock();
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
function listen(listener) {
|
|
624
|
-
var unlisten = transitionManager.appendListener(listener);
|
|
625
|
-
checkDOMListeners(1);
|
|
626
|
-
return function () {
|
|
627
|
-
checkDOMListeners(-1);
|
|
628
|
-
unlisten();
|
|
629
|
-
};
|
|
630
|
-
}
|
|
631
|
-
var history = {
|
|
632
|
-
length: globalHistory.length,
|
|
633
|
-
action: 'POP',
|
|
634
|
-
location: initialLocation,
|
|
635
|
-
createHref: createHref,
|
|
636
|
-
push: push,
|
|
637
|
-
replace: replace,
|
|
638
|
-
go: go,
|
|
639
|
-
goBack: goBack,
|
|
640
|
-
goForward: goForward,
|
|
641
|
-
block: block,
|
|
642
|
-
listen: listen
|
|
643
|
-
};
|
|
644
|
-
return history;
|
|
645
|
-
}
|
|
646
|
-
var HashChangeEvent$1 = 'hashchange';
|
|
647
|
-
var HashPathCoders = {
|
|
648
|
-
hashbang: {
|
|
649
|
-
encodePath: function encodePath(path) {
|
|
650
|
-
return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path);
|
|
651
|
-
},
|
|
652
|
-
decodePath: function decodePath(path) {
|
|
653
|
-
return path.charAt(0) === '!' ? path.substr(1) : path;
|
|
654
|
-
}
|
|
655
|
-
},
|
|
656
|
-
noslash: {
|
|
657
|
-
encodePath: stripLeadingSlash,
|
|
658
|
-
decodePath: addLeadingSlash$1
|
|
659
|
-
},
|
|
660
|
-
slash: {
|
|
661
|
-
encodePath: addLeadingSlash$1,
|
|
662
|
-
decodePath: addLeadingSlash$1
|
|
663
|
-
}
|
|
664
|
-
};
|
|
665
|
-
function stripHash(url) {
|
|
666
|
-
var hashIndex = url.indexOf('#');
|
|
667
|
-
return hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
668
|
-
}
|
|
669
|
-
function getHashPath() {
|
|
670
|
-
// We can't use window.location.hash here because it's not
|
|
671
|
-
// consistent across browsers - Firefox will pre-decode it!
|
|
672
|
-
var href = window.location.href;
|
|
673
|
-
var hashIndex = href.indexOf('#');
|
|
674
|
-
return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
|
|
675
|
-
}
|
|
676
|
-
function pushHashPath(path) {
|
|
677
|
-
window.location.hash = path;
|
|
678
|
-
}
|
|
679
|
-
function replaceHashPath(path) {
|
|
680
|
-
window.location.replace(stripHash(window.location.href) + '#' + path);
|
|
681
|
-
}
|
|
682
|
-
function createHashHistory(props) {
|
|
683
|
-
if (props === void 0) {
|
|
684
|
-
props = {};
|
|
685
|
-
}
|
|
686
|
-
!canUseDOM ? invariant(false) : void 0;
|
|
687
|
-
var globalHistory = window.history;
|
|
688
|
-
supportsGoWithoutReloadUsingHash();
|
|
689
|
-
var _props = props,
|
|
690
|
-
_props$getUserConfirm = _props.getUserConfirmation,
|
|
691
|
-
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
|
|
692
|
-
_props$hashType = _props.hashType,
|
|
693
|
-
hashType = _props$hashType === void 0 ? 'slash' : _props$hashType;
|
|
694
|
-
var basename = props.basename ? stripTrailingSlash(addLeadingSlash$1(props.basename)) : '';
|
|
695
|
-
var _HashPathCoders$hashT = HashPathCoders[hashType],
|
|
696
|
-
encodePath = _HashPathCoders$hashT.encodePath,
|
|
697
|
-
decodePath = _HashPathCoders$hashT.decodePath;
|
|
698
|
-
function getDOMLocation() {
|
|
699
|
-
var path = decodePath(getHashPath());
|
|
700
|
-
if (basename) path = stripBasename$1(path, basename);
|
|
701
|
-
return createLocation(path);
|
|
702
|
-
}
|
|
703
|
-
var transitionManager = createTransitionManager();
|
|
704
|
-
function setState(nextState) {
|
|
705
|
-
_extends$1(history, nextState);
|
|
706
|
-
history.length = globalHistory.length;
|
|
707
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
708
|
-
}
|
|
709
|
-
var forceNextPop = false;
|
|
710
|
-
var ignorePath = null;
|
|
711
|
-
function locationsAreEqual$$1(a, b) {
|
|
712
|
-
return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash;
|
|
713
|
-
}
|
|
714
|
-
function handleHashChange() {
|
|
715
|
-
var path = getHashPath();
|
|
716
|
-
var encodedPath = encodePath(path);
|
|
717
|
-
if (path !== encodedPath) {
|
|
718
|
-
// Ensure we always have a properly-encoded hash.
|
|
719
|
-
replaceHashPath(encodedPath);
|
|
720
|
-
} else {
|
|
721
|
-
var location = getDOMLocation();
|
|
722
|
-
var prevLocation = history.location;
|
|
723
|
-
if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change.
|
|
724
|
-
|
|
725
|
-
if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace.
|
|
726
|
-
|
|
727
|
-
ignorePath = null;
|
|
728
|
-
handlePop(location);
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
function handlePop(location) {
|
|
732
|
-
if (forceNextPop) {
|
|
733
|
-
forceNextPop = false;
|
|
734
|
-
setState();
|
|
735
|
-
} else {
|
|
736
|
-
var action = 'POP';
|
|
737
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
738
|
-
if (ok) {
|
|
739
|
-
setState({
|
|
740
|
-
action: action,
|
|
741
|
-
location: location
|
|
742
|
-
});
|
|
743
|
-
} else {
|
|
744
|
-
revertPop(location);
|
|
745
|
-
}
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
function revertPop(fromLocation) {
|
|
750
|
-
var toLocation = history.location; // TODO: We could probably make this more reliable by
|
|
751
|
-
// keeping a list of paths we've seen in sessionStorage.
|
|
752
|
-
// Instead, we just default to 0 for paths we don't know.
|
|
753
|
-
|
|
754
|
-
var toIndex = allPaths.lastIndexOf(createPath(toLocation));
|
|
755
|
-
if (toIndex === -1) toIndex = 0;
|
|
756
|
-
var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
|
|
757
|
-
if (fromIndex === -1) fromIndex = 0;
|
|
758
|
-
var delta = toIndex - fromIndex;
|
|
759
|
-
if (delta) {
|
|
760
|
-
forceNextPop = true;
|
|
761
|
-
go(delta);
|
|
762
|
-
}
|
|
763
|
-
} // Ensure the hash is encoded properly before doing anything else.
|
|
764
|
-
|
|
765
|
-
var path = getHashPath();
|
|
766
|
-
var encodedPath = encodePath(path);
|
|
767
|
-
if (path !== encodedPath) replaceHashPath(encodedPath);
|
|
768
|
-
var initialLocation = getDOMLocation();
|
|
769
|
-
var allPaths = [createPath(initialLocation)]; // Public interface
|
|
770
|
-
|
|
771
|
-
function createHref(location) {
|
|
772
|
-
var baseTag = document.querySelector('base');
|
|
773
|
-
var href = '';
|
|
774
|
-
if (baseTag && baseTag.getAttribute('href')) {
|
|
775
|
-
href = stripHash(window.location.href);
|
|
776
|
-
}
|
|
777
|
-
return href + '#' + encodePath(basename + createPath(location));
|
|
778
|
-
}
|
|
779
|
-
function push(path, state) {
|
|
780
|
-
var action = 'PUSH';
|
|
781
|
-
var location = createLocation(path, undefined, undefined, history.location);
|
|
782
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
783
|
-
if (!ok) return;
|
|
784
|
-
var path = createPath(location);
|
|
785
|
-
var encodedPath = encodePath(basename + path);
|
|
786
|
-
var hashChanged = getHashPath() !== encodedPath;
|
|
787
|
-
if (hashChanged) {
|
|
788
|
-
// We cannot tell if a hashchange was caused by a PUSH, so we'd
|
|
789
|
-
// rather setState here and ignore the hashchange. The caveat here
|
|
790
|
-
// is that other hash histories in the page will consider it a POP.
|
|
791
|
-
ignorePath = path;
|
|
792
|
-
pushHashPath(encodedPath);
|
|
793
|
-
var prevIndex = allPaths.lastIndexOf(createPath(history.location));
|
|
794
|
-
var nextPaths = allPaths.slice(0, prevIndex + 1);
|
|
795
|
-
nextPaths.push(path);
|
|
796
|
-
allPaths = nextPaths;
|
|
797
|
-
setState({
|
|
798
|
-
action: action,
|
|
799
|
-
location: location
|
|
800
|
-
});
|
|
801
|
-
} else {
|
|
802
|
-
setState();
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
function replace(path, state) {
|
|
807
|
-
var action = 'REPLACE';
|
|
808
|
-
var location = createLocation(path, undefined, undefined, history.location);
|
|
809
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
810
|
-
if (!ok) return;
|
|
811
|
-
var path = createPath(location);
|
|
812
|
-
var encodedPath = encodePath(basename + path);
|
|
813
|
-
var hashChanged = getHashPath() !== encodedPath;
|
|
814
|
-
if (hashChanged) {
|
|
815
|
-
// We cannot tell if a hashchange was caused by a REPLACE, so we'd
|
|
816
|
-
// rather setState here and ignore the hashchange. The caveat here
|
|
817
|
-
// is that other hash histories in the page will consider it a POP.
|
|
818
|
-
ignorePath = path;
|
|
819
|
-
replaceHashPath(encodedPath);
|
|
820
|
-
}
|
|
821
|
-
var prevIndex = allPaths.indexOf(createPath(history.location));
|
|
822
|
-
if (prevIndex !== -1) allPaths[prevIndex] = path;
|
|
823
|
-
setState({
|
|
824
|
-
action: action,
|
|
825
|
-
location: location
|
|
826
|
-
});
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
function go(n) {
|
|
830
|
-
globalHistory.go(n);
|
|
831
|
-
}
|
|
832
|
-
function goBack() {
|
|
833
|
-
go(-1);
|
|
834
|
-
}
|
|
835
|
-
function goForward() {
|
|
836
|
-
go(1);
|
|
837
|
-
}
|
|
838
|
-
var listenerCount = 0;
|
|
839
|
-
function checkDOMListeners(delta) {
|
|
840
|
-
listenerCount += delta;
|
|
841
|
-
if (listenerCount === 1 && delta === 1) {
|
|
842
|
-
window.addEventListener(HashChangeEvent$1, handleHashChange);
|
|
843
|
-
} else if (listenerCount === 0) {
|
|
844
|
-
window.removeEventListener(HashChangeEvent$1, handleHashChange);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
var isBlocked = false;
|
|
848
|
-
function block(prompt) {
|
|
849
|
-
if (prompt === void 0) {
|
|
850
|
-
prompt = false;
|
|
851
|
-
}
|
|
852
|
-
var unblock = transitionManager.setPrompt(prompt);
|
|
853
|
-
if (!isBlocked) {
|
|
854
|
-
checkDOMListeners(1);
|
|
855
|
-
isBlocked = true;
|
|
856
|
-
}
|
|
857
|
-
return function () {
|
|
858
|
-
if (isBlocked) {
|
|
859
|
-
isBlocked = false;
|
|
860
|
-
checkDOMListeners(-1);
|
|
861
|
-
}
|
|
862
|
-
return unblock();
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
function listen(listener) {
|
|
866
|
-
var unlisten = transitionManager.appendListener(listener);
|
|
867
|
-
checkDOMListeners(1);
|
|
868
|
-
return function () {
|
|
869
|
-
checkDOMListeners(-1);
|
|
870
|
-
unlisten();
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
var history = {
|
|
874
|
-
length: globalHistory.length,
|
|
875
|
-
action: 'POP',
|
|
876
|
-
location: initialLocation,
|
|
877
|
-
createHref: createHref,
|
|
878
|
-
push: push,
|
|
879
|
-
replace: replace,
|
|
880
|
-
go: go,
|
|
881
|
-
goBack: goBack,
|
|
882
|
-
goForward: goForward,
|
|
883
|
-
block: block,
|
|
884
|
-
listen: listen
|
|
885
|
-
};
|
|
886
|
-
return history;
|
|
887
|
-
}
|
|
888
|
-
function clamp(n, lowerBound, upperBound) {
|
|
889
|
-
return Math.min(Math.max(n, lowerBound), upperBound);
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* Creates a history object that stores locations in memory.
|
|
893
|
-
*/
|
|
894
|
-
|
|
895
|
-
function createMemoryHistory(props) {
|
|
896
|
-
if (props === void 0) {
|
|
897
|
-
props = {};
|
|
898
|
-
}
|
|
899
|
-
var _props = props,
|
|
900
|
-
getUserConfirmation = _props.getUserConfirmation,
|
|
901
|
-
_props$initialEntries = _props.initialEntries,
|
|
902
|
-
initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries,
|
|
903
|
-
_props$initialIndex = _props.initialIndex,
|
|
904
|
-
initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex,
|
|
905
|
-
_props$keyLength = _props.keyLength,
|
|
906
|
-
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
|
907
|
-
var transitionManager = createTransitionManager();
|
|
908
|
-
function setState(nextState) {
|
|
909
|
-
_extends$1(history, nextState);
|
|
910
|
-
history.length = history.entries.length;
|
|
911
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
912
|
-
}
|
|
913
|
-
function createKey() {
|
|
914
|
-
return Math.random().toString(36).substr(2, keyLength);
|
|
915
|
-
}
|
|
916
|
-
var index = clamp(initialIndex, 0, initialEntries.length - 1);
|
|
917
|
-
var entries = initialEntries.map(function (entry) {
|
|
918
|
-
return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey());
|
|
919
|
-
}); // Public interface
|
|
920
|
-
|
|
921
|
-
var createHref = createPath;
|
|
922
|
-
function push(path, state) {
|
|
923
|
-
var action = 'PUSH';
|
|
924
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
925
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
926
|
-
if (!ok) return;
|
|
927
|
-
var prevIndex = history.index;
|
|
928
|
-
var nextIndex = prevIndex + 1;
|
|
929
|
-
var nextEntries = history.entries.slice(0);
|
|
930
|
-
if (nextEntries.length > nextIndex) {
|
|
931
|
-
nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location);
|
|
932
|
-
} else {
|
|
933
|
-
nextEntries.push(location);
|
|
934
|
-
}
|
|
935
|
-
setState({
|
|
936
|
-
action: action,
|
|
937
|
-
location: location,
|
|
938
|
-
index: nextIndex,
|
|
939
|
-
entries: nextEntries
|
|
940
|
-
});
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
function replace(path, state) {
|
|
944
|
-
var action = 'REPLACE';
|
|
945
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
946
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
947
|
-
if (!ok) return;
|
|
948
|
-
history.entries[history.index] = location;
|
|
949
|
-
setState({
|
|
950
|
-
action: action,
|
|
951
|
-
location: location
|
|
952
|
-
});
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
function go(n) {
|
|
956
|
-
var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);
|
|
957
|
-
var action = 'POP';
|
|
958
|
-
var location = history.entries[nextIndex];
|
|
959
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
960
|
-
if (ok) {
|
|
961
|
-
setState({
|
|
962
|
-
action: action,
|
|
963
|
-
location: location,
|
|
964
|
-
index: nextIndex
|
|
965
|
-
});
|
|
966
|
-
} else {
|
|
967
|
-
// Mimic the behavior of DOM histories by
|
|
968
|
-
// causing a render after a cancelled POP.
|
|
969
|
-
setState();
|
|
970
|
-
}
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
|
-
function goBack() {
|
|
974
|
-
go(-1);
|
|
975
|
-
}
|
|
976
|
-
function goForward() {
|
|
977
|
-
go(1);
|
|
978
|
-
}
|
|
979
|
-
function canGo(n) {
|
|
980
|
-
var nextIndex = history.index + n;
|
|
981
|
-
return nextIndex >= 0 && nextIndex < history.entries.length;
|
|
982
|
-
}
|
|
983
|
-
function block(prompt) {
|
|
984
|
-
if (prompt === void 0) {
|
|
985
|
-
prompt = false;
|
|
986
|
-
}
|
|
987
|
-
return transitionManager.setPrompt(prompt);
|
|
988
|
-
}
|
|
989
|
-
function listen(listener) {
|
|
990
|
-
return transitionManager.appendListener(listener);
|
|
991
|
-
}
|
|
992
|
-
var history = {
|
|
993
|
-
length: entries.length,
|
|
994
|
-
action: 'POP',
|
|
995
|
-
location: entries[index],
|
|
996
|
-
index: index,
|
|
997
|
-
entries: entries,
|
|
998
|
-
createHref: createHref,
|
|
999
|
-
push: push,
|
|
1000
|
-
replace: replace,
|
|
1001
|
-
go: go,
|
|
1002
|
-
goBack: goBack,
|
|
1003
|
-
goForward: goForward,
|
|
1004
|
-
canGo: canGo,
|
|
1005
|
-
block: block,
|
|
1006
|
-
listen: listen
|
|
1007
|
-
};
|
|
1008
|
-
return history;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
function _setPrototypeOf(o, p) {
|
|
1012
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
1013
|
-
o.__proto__ = p;
|
|
1014
|
-
return o;
|
|
1015
|
-
};
|
|
1016
|
-
return _setPrototypeOf(o, p);
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
function _inheritsLoose(subClass, superClass) {
|
|
1020
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
1021
|
-
subClass.prototype.constructor = subClass;
|
|
1022
|
-
_setPrototypeOf(subClass, superClass);
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
var MAX_SIGNED_31_BIT_INT = 1073741823;
|
|
1026
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
|
|
1027
|
-
function getUniqueId() {
|
|
1028
|
-
var key = '__global_unique_id__';
|
|
1029
|
-
return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1;
|
|
1030
|
-
}
|
|
1031
|
-
function objectIs(x, y) {
|
|
1032
|
-
if (x === y) {
|
|
1033
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
1034
|
-
} else {
|
|
1035
|
-
return x !== x && y !== y;
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
function createEventEmitter(value) {
|
|
1039
|
-
var handlers = [];
|
|
1040
|
-
return {
|
|
1041
|
-
on: function on(handler) {
|
|
1042
|
-
handlers.push(handler);
|
|
1043
|
-
},
|
|
1044
|
-
off: function off(handler) {
|
|
1045
|
-
handlers = handlers.filter(function (h) {
|
|
1046
|
-
return h !== handler;
|
|
1047
|
-
});
|
|
1048
|
-
},
|
|
1049
|
-
get: function get() {
|
|
1050
|
-
return value;
|
|
1051
|
-
},
|
|
1052
|
-
set: function set(newValue, changedBits) {
|
|
1053
|
-
value = newValue;
|
|
1054
|
-
handlers.forEach(function (handler) {
|
|
1055
|
-
return handler(value, changedBits);
|
|
1056
|
-
});
|
|
1057
|
-
}
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
function onlyChild(children) {
|
|
1061
|
-
return Array.isArray(children) ? children[0] : children;
|
|
1062
|
-
}
|
|
1063
|
-
function createReactContext(defaultValue, calculateChangedBits) {
|
|
1064
|
-
var _Provider$childContex, _Consumer$contextType;
|
|
1065
|
-
var contextProp = '__create-react-context-' + getUniqueId() + '__';
|
|
1066
|
-
var Provider = /*#__PURE__*/function (_Component) {
|
|
1067
|
-
_inheritsLoose(Provider, _Component);
|
|
1068
|
-
function Provider() {
|
|
1069
|
-
var _this;
|
|
1070
|
-
_this = _Component.apply(this, arguments) || this;
|
|
1071
|
-
_this.emitter = createEventEmitter(_this.props.value);
|
|
1072
|
-
return _this;
|
|
1073
|
-
}
|
|
1074
|
-
var _proto = Provider.prototype;
|
|
1075
|
-
_proto.getChildContext = function getChildContext() {
|
|
1076
|
-
var _ref;
|
|
1077
|
-
return _ref = {}, _ref[contextProp] = this.emitter, _ref;
|
|
1078
|
-
};
|
|
1079
|
-
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1080
|
-
if (this.props.value !== nextProps.value) {
|
|
1081
|
-
var oldValue = this.props.value;
|
|
1082
|
-
var newValue = nextProps.value;
|
|
1083
|
-
var changedBits;
|
|
1084
|
-
if (objectIs(oldValue, newValue)) {
|
|
1085
|
-
changedBits = 0;
|
|
1086
|
-
} else {
|
|
1087
|
-
changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
|
|
1088
|
-
changedBits |= 0;
|
|
1089
|
-
if (changedBits !== 0) {
|
|
1090
|
-
this.emitter.set(nextProps.value, changedBits);
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
_proto.render = function render() {
|
|
1096
|
-
return this.props.children;
|
|
1097
|
-
};
|
|
1098
|
-
return Provider;
|
|
1099
|
-
}(React.Component);
|
|
1100
|
-
Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = propTypes.exports.object.isRequired, _Provider$childContex);
|
|
1101
|
-
var Consumer = /*#__PURE__*/function (_Component2) {
|
|
1102
|
-
_inheritsLoose(Consumer, _Component2);
|
|
1103
|
-
function Consumer() {
|
|
1104
|
-
var _this2;
|
|
1105
|
-
_this2 = _Component2.apply(this, arguments) || this;
|
|
1106
|
-
_this2.state = {
|
|
1107
|
-
value: _this2.getValue()
|
|
1108
|
-
};
|
|
1109
|
-
_this2.onUpdate = function (newValue, changedBits) {
|
|
1110
|
-
var observedBits = _this2.observedBits | 0;
|
|
1111
|
-
if ((observedBits & changedBits) !== 0) {
|
|
1112
|
-
_this2.setState({
|
|
1113
|
-
value: _this2.getValue()
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
};
|
|
1117
|
-
return _this2;
|
|
1118
|
-
}
|
|
1119
|
-
var _proto2 = Consumer.prototype;
|
|
1120
|
-
_proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1121
|
-
var observedBits = nextProps.observedBits;
|
|
1122
|
-
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
|
|
1123
|
-
};
|
|
1124
|
-
_proto2.componentDidMount = function componentDidMount() {
|
|
1125
|
-
if (this.context[contextProp]) {
|
|
1126
|
-
this.context[contextProp].on(this.onUpdate);
|
|
1127
|
-
}
|
|
1128
|
-
var observedBits = this.props.observedBits;
|
|
1129
|
-
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
|
|
1130
|
-
};
|
|
1131
|
-
_proto2.componentWillUnmount = function componentWillUnmount() {
|
|
1132
|
-
if (this.context[contextProp]) {
|
|
1133
|
-
this.context[contextProp].off(this.onUpdate);
|
|
1134
|
-
}
|
|
1135
|
-
};
|
|
1136
|
-
_proto2.getValue = function getValue() {
|
|
1137
|
-
if (this.context[contextProp]) {
|
|
1138
|
-
return this.context[contextProp].get();
|
|
1139
|
-
} else {
|
|
1140
|
-
return defaultValue;
|
|
1141
|
-
}
|
|
1142
|
-
};
|
|
1143
|
-
_proto2.render = function render() {
|
|
1144
|
-
return onlyChild(this.props.children)(this.state.value);
|
|
1145
|
-
};
|
|
1146
|
-
return Consumer;
|
|
1147
|
-
}(React.Component);
|
|
1148
|
-
Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = propTypes.exports.object, _Consumer$contextType);
|
|
1149
|
-
return {
|
|
1150
|
-
Provider: Provider,
|
|
1151
|
-
Consumer: Consumer
|
|
1152
|
-
};
|
|
1153
|
-
}
|
|
1154
|
-
var index = React__default["default"].createContext || createReactContext;
|
|
1155
|
-
|
|
1156
|
-
function _extends() {
|
|
1157
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1158
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1159
|
-
var source = arguments[i];
|
|
1160
|
-
for (var key in source) {
|
|
1161
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1162
|
-
target[key] = source[key];
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
return target;
|
|
1167
|
-
};
|
|
1168
|
-
return _extends.apply(this, arguments);
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
var pathToRegexp$1 = {exports: {}};
|
|
1172
|
-
|
|
1173
|
-
var isarray$1 = Array.isArray || function (arr) {
|
|
1174
|
-
return Object.prototype.toString.call(arr) == '[object Array]';
|
|
1175
|
-
};
|
|
1176
|
-
|
|
1177
|
-
var isarray = isarray$1;
|
|
1178
|
-
|
|
1179
|
-
/**
|
|
1180
|
-
* Expose `pathToRegexp`.
|
|
1181
|
-
*/
|
|
1182
|
-
pathToRegexp$1.exports = pathToRegexp;
|
|
1183
|
-
pathToRegexp$1.exports.parse = parse;
|
|
1184
|
-
pathToRegexp$1.exports.compile = compile;
|
|
1185
|
-
pathToRegexp$1.exports.tokensToFunction = tokensToFunction;
|
|
1186
|
-
pathToRegexp$1.exports.tokensToRegExp = tokensToRegExp;
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
* The main path matching regexp utility.
|
|
1190
|
-
*
|
|
1191
|
-
* @type {RegExp}
|
|
1192
|
-
*/
|
|
1193
|
-
var PATH_REGEXP = new RegExp([
|
|
1194
|
-
// Match escaped characters that would otherwise appear in future matches.
|
|
1195
|
-
// This allows the user to escape special characters that won't transform.
|
|
1196
|
-
'(\\\\.)',
|
|
1197
|
-
// Match Express-style parameters and un-named parameters with a prefix
|
|
1198
|
-
// and optional suffixes. Matches appear as:
|
|
1199
|
-
//
|
|
1200
|
-
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
|
|
1201
|
-
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
|
|
1202
|
-
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
|
|
1203
|
-
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'].join('|'), 'g');
|
|
1204
|
-
|
|
1205
|
-
/**
|
|
1206
|
-
* Parse a string for the raw tokens.
|
|
1207
|
-
*
|
|
1208
|
-
* @param {string} str
|
|
1209
|
-
* @param {Object=} options
|
|
1210
|
-
* @return {!Array}
|
|
1211
|
-
*/
|
|
1212
|
-
function parse(str, options) {
|
|
1213
|
-
var tokens = [];
|
|
1214
|
-
var key = 0;
|
|
1215
|
-
var index = 0;
|
|
1216
|
-
var path = '';
|
|
1217
|
-
var defaultDelimiter = options && options.delimiter || '/';
|
|
1218
|
-
var res;
|
|
1219
|
-
while ((res = PATH_REGEXP.exec(str)) != null) {
|
|
1220
|
-
var m = res[0];
|
|
1221
|
-
var escaped = res[1];
|
|
1222
|
-
var offset = res.index;
|
|
1223
|
-
path += str.slice(index, offset);
|
|
1224
|
-
index = offset + m.length;
|
|
1225
|
-
|
|
1226
|
-
// Ignore already escaped sequences.
|
|
1227
|
-
if (escaped) {
|
|
1228
|
-
path += escaped[1];
|
|
1229
|
-
continue;
|
|
1230
|
-
}
|
|
1231
|
-
var next = str[index];
|
|
1232
|
-
var prefix = res[2];
|
|
1233
|
-
var name = res[3];
|
|
1234
|
-
var capture = res[4];
|
|
1235
|
-
var group = res[5];
|
|
1236
|
-
var modifier = res[6];
|
|
1237
|
-
var asterisk = res[7];
|
|
1238
|
-
|
|
1239
|
-
// Push the current path onto the tokens.
|
|
1240
|
-
if (path) {
|
|
1241
|
-
tokens.push(path);
|
|
1242
|
-
path = '';
|
|
1243
|
-
}
|
|
1244
|
-
var partial = prefix != null && next != null && next !== prefix;
|
|
1245
|
-
var repeat = modifier === '+' || modifier === '*';
|
|
1246
|
-
var optional = modifier === '?' || modifier === '*';
|
|
1247
|
-
var delimiter = res[2] || defaultDelimiter;
|
|
1248
|
-
var pattern = capture || group;
|
|
1249
|
-
tokens.push({
|
|
1250
|
-
name: name || key++,
|
|
1251
|
-
prefix: prefix || '',
|
|
1252
|
-
delimiter: delimiter,
|
|
1253
|
-
optional: optional,
|
|
1254
|
-
repeat: repeat,
|
|
1255
|
-
partial: partial,
|
|
1256
|
-
asterisk: !!asterisk,
|
|
1257
|
-
pattern: pattern ? escapeGroup(pattern) : asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?'
|
|
1258
|
-
});
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
// Match any characters still remaining.
|
|
1262
|
-
if (index < str.length) {
|
|
1263
|
-
path += str.substr(index);
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
// If the path exists, push it onto the end.
|
|
1267
|
-
if (path) {
|
|
1268
|
-
tokens.push(path);
|
|
1269
|
-
}
|
|
1270
|
-
return tokens;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
/**
|
|
1274
|
-
* Compile a string to a template function for the path.
|
|
1275
|
-
*
|
|
1276
|
-
* @param {string} str
|
|
1277
|
-
* @param {Object=} options
|
|
1278
|
-
* @return {!function(Object=, Object=)}
|
|
1279
|
-
*/
|
|
1280
|
-
function compile(str, options) {
|
|
1281
|
-
return tokensToFunction(parse(str, options), options);
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
/**
|
|
1285
|
-
* Prettier encoding of URI path segments.
|
|
1286
|
-
*
|
|
1287
|
-
* @param {string}
|
|
1288
|
-
* @return {string}
|
|
1289
|
-
*/
|
|
1290
|
-
function encodeURIComponentPretty(str) {
|
|
1291
|
-
return encodeURI(str).replace(/[\/?#]/g, function (c) {
|
|
1292
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
1293
|
-
});
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
/**
|
|
1297
|
-
* Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
|
|
1298
|
-
*
|
|
1299
|
-
* @param {string}
|
|
1300
|
-
* @return {string}
|
|
1301
|
-
*/
|
|
1302
|
-
function encodeAsterisk(str) {
|
|
1303
|
-
return encodeURI(str).replace(/[?#]/g, function (c) {
|
|
1304
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
/**
|
|
1309
|
-
* Expose a method for transforming tokens into the path function.
|
|
1310
|
-
*/
|
|
1311
|
-
function tokensToFunction(tokens, options) {
|
|
1312
|
-
// Compile all the tokens into regexps.
|
|
1313
|
-
var matches = new Array(tokens.length);
|
|
1314
|
-
|
|
1315
|
-
// Compile all the patterns before compilation.
|
|
1316
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1317
|
-
if (_typeof$1(tokens[i]) === 'object') {
|
|
1318
|
-
matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options));
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
return function (obj, opts) {
|
|
1322
|
-
var path = '';
|
|
1323
|
-
var data = obj || {};
|
|
1324
|
-
var options = opts || {};
|
|
1325
|
-
var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
|
|
1326
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1327
|
-
var token = tokens[i];
|
|
1328
|
-
if (typeof token === 'string') {
|
|
1329
|
-
path += token;
|
|
1330
|
-
continue;
|
|
1331
|
-
}
|
|
1332
|
-
var value = data[token.name];
|
|
1333
|
-
var segment;
|
|
1334
|
-
if (value == null) {
|
|
1335
|
-
if (token.optional) {
|
|
1336
|
-
// Prepend partial segment prefixes.
|
|
1337
|
-
if (token.partial) {
|
|
1338
|
-
path += token.prefix;
|
|
1339
|
-
}
|
|
1340
|
-
continue;
|
|
1341
|
-
} else {
|
|
1342
|
-
throw new TypeError('Expected "' + token.name + '" to be defined');
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
if (isarray(value)) {
|
|
1346
|
-
if (!token.repeat) {
|
|
1347
|
-
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`');
|
|
1348
|
-
}
|
|
1349
|
-
if (value.length === 0) {
|
|
1350
|
-
if (token.optional) {
|
|
1351
|
-
continue;
|
|
1352
|
-
} else {
|
|
1353
|
-
throw new TypeError('Expected "' + token.name + '" to not be empty');
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
for (var j = 0; j < value.length; j++) {
|
|
1357
|
-
segment = encode(value[j]);
|
|
1358
|
-
if (!matches[i].test(segment)) {
|
|
1359
|
-
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`');
|
|
1360
|
-
}
|
|
1361
|
-
path += (j === 0 ? token.prefix : token.delimiter) + segment;
|
|
1362
|
-
}
|
|
1363
|
-
continue;
|
|
1364
|
-
}
|
|
1365
|
-
segment = token.asterisk ? encodeAsterisk(value) : encode(value);
|
|
1366
|
-
if (!matches[i].test(segment)) {
|
|
1367
|
-
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"');
|
|
1368
|
-
}
|
|
1369
|
-
path += token.prefix + segment;
|
|
1370
|
-
}
|
|
1371
|
-
return path;
|
|
1372
|
-
};
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
/**
|
|
1376
|
-
* Escape a regular expression string.
|
|
1377
|
-
*
|
|
1378
|
-
* @param {string} str
|
|
1379
|
-
* @return {string}
|
|
1380
|
-
*/
|
|
1381
|
-
function escapeString(str) {
|
|
1382
|
-
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1');
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
/**
|
|
1386
|
-
* Escape the capturing group by escaping special characters and meaning.
|
|
1387
|
-
*
|
|
1388
|
-
* @param {string} group
|
|
1389
|
-
* @return {string}
|
|
1390
|
-
*/
|
|
1391
|
-
function escapeGroup(group) {
|
|
1392
|
-
return group.replace(/([=!:$\/()])/g, '\\$1');
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
/**
|
|
1396
|
-
* Attach the keys as a property of the regexp.
|
|
1397
|
-
*
|
|
1398
|
-
* @param {!RegExp} re
|
|
1399
|
-
* @param {Array} keys
|
|
1400
|
-
* @return {!RegExp}
|
|
1401
|
-
*/
|
|
1402
|
-
function attachKeys(re, keys) {
|
|
1403
|
-
re.keys = keys;
|
|
1404
|
-
return re;
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
/**
|
|
1408
|
-
* Get the flags for a regexp from the options.
|
|
1409
|
-
*
|
|
1410
|
-
* @param {Object} options
|
|
1411
|
-
* @return {string}
|
|
1412
|
-
*/
|
|
1413
|
-
function flags(options) {
|
|
1414
|
-
return options && options.sensitive ? '' : 'i';
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
/**
|
|
1418
|
-
* Pull out keys from a regexp.
|
|
1419
|
-
*
|
|
1420
|
-
* @param {!RegExp} path
|
|
1421
|
-
* @param {!Array} keys
|
|
1422
|
-
* @return {!RegExp}
|
|
1423
|
-
*/
|
|
1424
|
-
function regexpToRegexp(path, keys) {
|
|
1425
|
-
// Use a negative lookahead to match only capturing groups.
|
|
1426
|
-
var groups = path.source.match(/\((?!\?)/g);
|
|
1427
|
-
if (groups) {
|
|
1428
|
-
for (var i = 0; i < groups.length; i++) {
|
|
1429
|
-
keys.push({
|
|
1430
|
-
name: i,
|
|
1431
|
-
prefix: null,
|
|
1432
|
-
delimiter: null,
|
|
1433
|
-
optional: false,
|
|
1434
|
-
repeat: false,
|
|
1435
|
-
partial: false,
|
|
1436
|
-
asterisk: false,
|
|
1437
|
-
pattern: null
|
|
1438
|
-
});
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
return attachKeys(path, keys);
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
/**
|
|
1445
|
-
* Transform an array into a regexp.
|
|
1446
|
-
*
|
|
1447
|
-
* @param {!Array} path
|
|
1448
|
-
* @param {Array} keys
|
|
1449
|
-
* @param {!Object} options
|
|
1450
|
-
* @return {!RegExp}
|
|
1451
|
-
*/
|
|
1452
|
-
function arrayToRegexp(path, keys, options) {
|
|
1453
|
-
var parts = [];
|
|
1454
|
-
for (var i = 0; i < path.length; i++) {
|
|
1455
|
-
parts.push(pathToRegexp(path[i], keys, options).source);
|
|
1456
|
-
}
|
|
1457
|
-
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
|
|
1458
|
-
return attachKeys(regexp, keys);
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
/**
|
|
1462
|
-
* Create a path regexp from string input.
|
|
1463
|
-
*
|
|
1464
|
-
* @param {string} path
|
|
1465
|
-
* @param {!Array} keys
|
|
1466
|
-
* @param {!Object} options
|
|
1467
|
-
* @return {!RegExp}
|
|
1468
|
-
*/
|
|
1469
|
-
function stringToRegexp(path, keys, options) {
|
|
1470
|
-
return tokensToRegExp(parse(path, options), keys, options);
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
/**
|
|
1474
|
-
* Expose a function for taking tokens and returning a RegExp.
|
|
1475
|
-
*
|
|
1476
|
-
* @param {!Array} tokens
|
|
1477
|
-
* @param {(Array|Object)=} keys
|
|
1478
|
-
* @param {Object=} options
|
|
1479
|
-
* @return {!RegExp}
|
|
1480
|
-
*/
|
|
1481
|
-
function tokensToRegExp(tokens, keys, options) {
|
|
1482
|
-
if (!isarray(keys)) {
|
|
1483
|
-
options = /** @type {!Object} */keys || options;
|
|
1484
|
-
keys = [];
|
|
1485
|
-
}
|
|
1486
|
-
options = options || {};
|
|
1487
|
-
var strict = options.strict;
|
|
1488
|
-
var end = options.end !== false;
|
|
1489
|
-
var route = '';
|
|
1490
|
-
|
|
1491
|
-
// Iterate over the tokens and create our regexp string.
|
|
1492
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1493
|
-
var token = tokens[i];
|
|
1494
|
-
if (typeof token === 'string') {
|
|
1495
|
-
route += escapeString(token);
|
|
1496
|
-
} else {
|
|
1497
|
-
var prefix = escapeString(token.prefix);
|
|
1498
|
-
var capture = '(?:' + token.pattern + ')';
|
|
1499
|
-
keys.push(token);
|
|
1500
|
-
if (token.repeat) {
|
|
1501
|
-
capture += '(?:' + prefix + capture + ')*';
|
|
1502
|
-
}
|
|
1503
|
-
if (token.optional) {
|
|
1504
|
-
if (!token.partial) {
|
|
1505
|
-
capture = '(?:' + prefix + '(' + capture + '))?';
|
|
1506
|
-
} else {
|
|
1507
|
-
capture = prefix + '(' + capture + ')?';
|
|
1508
|
-
}
|
|
1509
|
-
} else {
|
|
1510
|
-
capture = prefix + '(' + capture + ')';
|
|
1511
|
-
}
|
|
1512
|
-
route += capture;
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
var delimiter = escapeString(options.delimiter || '/');
|
|
1516
|
-
var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
|
|
1517
|
-
|
|
1518
|
-
// In non-strict mode we allow a slash at the end of match. If the path to
|
|
1519
|
-
// match already ends with a slash, we remove it for consistency. The slash
|
|
1520
|
-
// is valid at the end of a path match, not in the middle. This is important
|
|
1521
|
-
// in non-ending mode, where "/test/" shouldn't match "/test//route".
|
|
1522
|
-
if (!strict) {
|
|
1523
|
-
route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
|
|
1524
|
-
}
|
|
1525
|
-
if (end) {
|
|
1526
|
-
route += '$';
|
|
1527
|
-
} else {
|
|
1528
|
-
// In non-ending mode, we need the capturing groups to match as much as
|
|
1529
|
-
// possible by using a positive lookahead to the end or next path segment.
|
|
1530
|
-
route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
|
|
1531
|
-
}
|
|
1532
|
-
return attachKeys(new RegExp('^' + route, flags(options)), keys);
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
/**
|
|
1536
|
-
* Normalize the given path string, returning a regular expression.
|
|
1537
|
-
*
|
|
1538
|
-
* An empty array can be passed in for the keys, which will hold the
|
|
1539
|
-
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
|
|
1540
|
-
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
|
|
1541
|
-
*
|
|
1542
|
-
* @param {(string|RegExp|Array)} path
|
|
1543
|
-
* @param {(Array|Object)=} keys
|
|
1544
|
-
* @param {Object=} options
|
|
1545
|
-
* @return {!RegExp}
|
|
1546
|
-
*/
|
|
1547
|
-
function pathToRegexp(path, keys, options) {
|
|
1548
|
-
if (!isarray(keys)) {
|
|
1549
|
-
options = /** @type {!Object} */keys || options;
|
|
1550
|
-
keys = [];
|
|
1551
|
-
}
|
|
1552
|
-
options = options || {};
|
|
1553
|
-
if (path instanceof RegExp) {
|
|
1554
|
-
return regexpToRegexp(path, /** @type {!Array} */keys);
|
|
1555
|
-
}
|
|
1556
|
-
if (isarray(path)) {
|
|
1557
|
-
return arrayToRegexp( /** @type {!Array} */path, /** @type {!Array} */keys, options);
|
|
1558
|
-
}
|
|
1559
|
-
return stringToRegexp( /** @type {string} */path, /** @type {!Array} */keys, options);
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
var reactIs$1 = {exports: {}};
|
|
1563
|
-
|
|
1564
|
-
var reactIs_production_min = {};
|
|
1565
|
-
|
|
1566
|
-
var b = "function" === typeof Symbol && Symbol["for"],
|
|
1567
|
-
c = b ? Symbol["for"]("react.element") : 60103,
|
|
1568
|
-
d = b ? Symbol["for"]("react.portal") : 60106,
|
|
1569
|
-
e = b ? Symbol["for"]("react.fragment") : 60107,
|
|
1570
|
-
f = b ? Symbol["for"]("react.strict_mode") : 60108,
|
|
1571
|
-
g = b ? Symbol["for"]("react.profiler") : 60114,
|
|
1572
|
-
h = b ? Symbol["for"]("react.provider") : 60109,
|
|
1573
|
-
k = b ? Symbol["for"]("react.context") : 60110,
|
|
1574
|
-
l = b ? Symbol["for"]("react.async_mode") : 60111,
|
|
1575
|
-
m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
|
|
1576
|
-
n = b ? Symbol["for"]("react.forward_ref") : 60112,
|
|
1577
|
-
p = b ? Symbol["for"]("react.suspense") : 60113,
|
|
1578
|
-
q = b ? Symbol["for"]("react.suspense_list") : 60120,
|
|
1579
|
-
r = b ? Symbol["for"]("react.memo") : 60115,
|
|
1580
|
-
t = b ? Symbol["for"]("react.lazy") : 60116,
|
|
1581
|
-
v = b ? Symbol["for"]("react.block") : 60121,
|
|
1582
|
-
w = b ? Symbol["for"]("react.fundamental") : 60117,
|
|
1583
|
-
x = b ? Symbol["for"]("react.responder") : 60118,
|
|
1584
|
-
y = b ? Symbol["for"]("react.scope") : 60119;
|
|
1585
|
-
function z(a) {
|
|
1586
|
-
if ("object" === _typeof$1(a) && null !== a) {
|
|
1587
|
-
var u = a.$$typeof;
|
|
1588
|
-
switch (u) {
|
|
1589
|
-
case c:
|
|
1590
|
-
switch (a = a.type, a) {
|
|
1591
|
-
case l:
|
|
1592
|
-
case m:
|
|
1593
|
-
case e:
|
|
1594
|
-
case g:
|
|
1595
|
-
case f:
|
|
1596
|
-
case p:
|
|
1597
|
-
return a;
|
|
1598
|
-
default:
|
|
1599
|
-
switch (a = a && a.$$typeof, a) {
|
|
1600
|
-
case k:
|
|
1601
|
-
case n:
|
|
1602
|
-
case t:
|
|
1603
|
-
case r:
|
|
1604
|
-
case h:
|
|
1605
|
-
return a;
|
|
1606
|
-
default:
|
|
1607
|
-
return u;
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
case d:
|
|
1611
|
-
return u;
|
|
1612
|
-
}
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
function A(a) {
|
|
1616
|
-
return z(a) === m;
|
|
1617
|
-
}
|
|
1618
|
-
reactIs_production_min.AsyncMode = l;
|
|
1619
|
-
reactIs_production_min.ConcurrentMode = m;
|
|
1620
|
-
reactIs_production_min.ContextConsumer = k;
|
|
1621
|
-
reactIs_production_min.ContextProvider = h;
|
|
1622
|
-
reactIs_production_min.Element = c;
|
|
1623
|
-
reactIs_production_min.ForwardRef = n;
|
|
1624
|
-
reactIs_production_min.Fragment = e;
|
|
1625
|
-
reactIs_production_min.Lazy = t;
|
|
1626
|
-
reactIs_production_min.Memo = r;
|
|
1627
|
-
reactIs_production_min.Portal = d;
|
|
1628
|
-
reactIs_production_min.Profiler = g;
|
|
1629
|
-
reactIs_production_min.StrictMode = f;
|
|
1630
|
-
reactIs_production_min.Suspense = p;
|
|
1631
|
-
reactIs_production_min.isAsyncMode = function (a) {
|
|
1632
|
-
return A(a) || z(a) === l;
|
|
1633
|
-
};
|
|
1634
|
-
reactIs_production_min.isConcurrentMode = A;
|
|
1635
|
-
reactIs_production_min.isContextConsumer = function (a) {
|
|
1636
|
-
return z(a) === k;
|
|
1637
|
-
};
|
|
1638
|
-
reactIs_production_min.isContextProvider = function (a) {
|
|
1639
|
-
return z(a) === h;
|
|
1640
|
-
};
|
|
1641
|
-
reactIs_production_min.isElement = function (a) {
|
|
1642
|
-
return "object" === _typeof$1(a) && null !== a && a.$$typeof === c;
|
|
1643
|
-
};
|
|
1644
|
-
reactIs_production_min.isForwardRef = function (a) {
|
|
1645
|
-
return z(a) === n;
|
|
1646
|
-
};
|
|
1647
|
-
reactIs_production_min.isFragment = function (a) {
|
|
1648
|
-
return z(a) === e;
|
|
1649
|
-
};
|
|
1650
|
-
reactIs_production_min.isLazy = function (a) {
|
|
1651
|
-
return z(a) === t;
|
|
1652
|
-
};
|
|
1653
|
-
reactIs_production_min.isMemo = function (a) {
|
|
1654
|
-
return z(a) === r;
|
|
1655
|
-
};
|
|
1656
|
-
reactIs_production_min.isPortal = function (a) {
|
|
1657
|
-
return z(a) === d;
|
|
1658
|
-
};
|
|
1659
|
-
reactIs_production_min.isProfiler = function (a) {
|
|
1660
|
-
return z(a) === g;
|
|
1661
|
-
};
|
|
1662
|
-
reactIs_production_min.isStrictMode = function (a) {
|
|
1663
|
-
return z(a) === f;
|
|
1664
|
-
};
|
|
1665
|
-
reactIs_production_min.isSuspense = function (a) {
|
|
1666
|
-
return z(a) === p;
|
|
1667
|
-
};
|
|
1668
|
-
reactIs_production_min.isValidElementType = function (a) {
|
|
1669
|
-
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof$1(a) && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
1670
|
-
};
|
|
1671
|
-
reactIs_production_min.typeOf = z;
|
|
1672
|
-
|
|
1673
|
-
(function (module) {
|
|
1674
|
-
|
|
1675
|
-
{
|
|
1676
|
-
module.exports = reactIs_production_min;
|
|
1677
|
-
}
|
|
1678
|
-
})(reactIs$1);
|
|
1679
|
-
|
|
1680
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
1681
|
-
if (source == null) return {};
|
|
1682
|
-
var target = {};
|
|
1683
|
-
var sourceKeys = Object.keys(source);
|
|
1684
|
-
var key, i;
|
|
1685
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
1686
|
-
key = sourceKeys[i];
|
|
1687
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1688
|
-
target[key] = source[key];
|
|
1689
|
-
}
|
|
1690
|
-
return target;
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
var reactIs = reactIs$1.exports;
|
|
1694
|
-
var FORWARD_REF_STATICS = {
|
|
1695
|
-
'$$typeof': true,
|
|
1696
|
-
render: true,
|
|
1697
|
-
defaultProps: true,
|
|
1698
|
-
displayName: true,
|
|
1699
|
-
propTypes: true
|
|
1700
|
-
};
|
|
1701
|
-
var MEMO_STATICS = {
|
|
1702
|
-
'$$typeof': true,
|
|
1703
|
-
compare: true,
|
|
1704
|
-
defaultProps: true,
|
|
1705
|
-
displayName: true,
|
|
1706
|
-
propTypes: true,
|
|
1707
|
-
type: true
|
|
1708
|
-
};
|
|
1709
|
-
var TYPE_STATICS = {};
|
|
1710
|
-
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
1711
|
-
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
|
|
1712
|
-
|
|
1713
|
-
// TODO: Replace with React.createContext once we can assume React 16+
|
|
1714
|
-
|
|
1715
|
-
var createNamedContext = function createNamedContext(name) {
|
|
1716
|
-
var context = index();
|
|
1717
|
-
context.displayName = name;
|
|
1718
|
-
return context;
|
|
1719
|
-
};
|
|
1720
|
-
var historyContext = /*#__PURE__*/createNamedContext("Router-History");
|
|
1721
|
-
var context = /*#__PURE__*/createNamedContext("Router");
|
|
1722
|
-
|
|
1723
|
-
/**
|
|
1724
|
-
* The public API for putting history on context.
|
|
1725
|
-
*/
|
|
1726
|
-
|
|
1727
|
-
var Router = /*#__PURE__*/function (_React$Component) {
|
|
1728
|
-
_inheritsLoose$1(Router, _React$Component);
|
|
1729
|
-
Router.computeRootMatch = function computeRootMatch(pathname) {
|
|
1730
|
-
return {
|
|
1731
|
-
path: "/",
|
|
1732
|
-
url: "/",
|
|
1733
|
-
params: {},
|
|
1734
|
-
isExact: pathname === "/"
|
|
1735
|
-
};
|
|
1736
|
-
};
|
|
1737
|
-
function Router(props) {
|
|
1738
|
-
var _this;
|
|
1739
|
-
_this = _React$Component.call(this, props) || this;
|
|
1740
|
-
_this.state = {
|
|
1741
|
-
location: props.history.location
|
|
1742
|
-
}; // This is a bit of a hack. We have to start listening for location
|
|
1743
|
-
// changes here in the constructor in case there are any <Redirect>s
|
|
1744
|
-
// on the initial render. If there are, they will replace/push when
|
|
1745
|
-
// they mount and since cDM fires in children before parents, we may
|
|
1746
|
-
// get a new location before the <Router> is mounted.
|
|
1747
|
-
|
|
1748
|
-
_this._isMounted = false;
|
|
1749
|
-
_this._pendingLocation = null;
|
|
1750
|
-
if (!props.staticContext) {
|
|
1751
|
-
_this.unlisten = props.history.listen(function (location) {
|
|
1752
|
-
_this._pendingLocation = location;
|
|
1753
|
-
});
|
|
1754
|
-
}
|
|
1755
|
-
return _this;
|
|
1756
|
-
}
|
|
1757
|
-
var _proto = Router.prototype;
|
|
1758
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
1759
|
-
var _this2 = this;
|
|
1760
|
-
this._isMounted = true;
|
|
1761
|
-
if (this.unlisten) {
|
|
1762
|
-
// Any pre-mount location changes have been captured at
|
|
1763
|
-
// this point, so unregister the listener.
|
|
1764
|
-
this.unlisten();
|
|
1765
|
-
}
|
|
1766
|
-
if (!this.props.staticContext) {
|
|
1767
|
-
this.unlisten = this.props.history.listen(function (location) {
|
|
1768
|
-
if (_this2._isMounted) {
|
|
1769
|
-
_this2.setState({
|
|
1770
|
-
location: location
|
|
1771
|
-
});
|
|
1772
|
-
}
|
|
1773
|
-
});
|
|
1774
|
-
}
|
|
1775
|
-
if (this._pendingLocation) {
|
|
1776
|
-
this.setState({
|
|
1777
|
-
location: this._pendingLocation
|
|
1778
|
-
});
|
|
1779
|
-
}
|
|
1780
|
-
};
|
|
1781
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1782
|
-
if (this.unlisten) {
|
|
1783
|
-
this.unlisten();
|
|
1784
|
-
this._isMounted = false;
|
|
1785
|
-
this._pendingLocation = null;
|
|
1786
|
-
}
|
|
1787
|
-
};
|
|
1788
|
-
_proto.render = function render() {
|
|
1789
|
-
return /*#__PURE__*/React__default["default"].createElement(context.Provider, {
|
|
1790
|
-
value: {
|
|
1791
|
-
history: this.props.history,
|
|
1792
|
-
location: this.state.location,
|
|
1793
|
-
match: Router.computeRootMatch(this.state.location.pathname),
|
|
1794
|
-
staticContext: this.props.staticContext
|
|
1795
|
-
}
|
|
1796
|
-
}, /*#__PURE__*/React__default["default"].createElement(historyContext.Provider, {
|
|
1797
|
-
children: this.props.children || null,
|
|
1798
|
-
value: this.props.history
|
|
1799
|
-
}));
|
|
1800
|
-
};
|
|
1801
|
-
return Router;
|
|
1802
|
-
}(React__default["default"].Component);
|
|
1803
|
-
|
|
1804
|
-
/**
|
|
1805
|
-
* The public API for a <Router> that stores location in memory.
|
|
1806
|
-
*/
|
|
1807
|
-
|
|
1808
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1809
|
-
_inheritsLoose$1(MemoryRouter, _React$Component);
|
|
1810
|
-
function MemoryRouter() {
|
|
1811
|
-
var _this;
|
|
1812
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1813
|
-
args[_key] = arguments[_key];
|
|
1814
|
-
}
|
|
1815
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
1816
|
-
_this.history = createMemoryHistory(_this.props);
|
|
1817
|
-
return _this;
|
|
1818
|
-
}
|
|
1819
|
-
var _proto = MemoryRouter.prototype;
|
|
1820
|
-
_proto.render = function render() {
|
|
1821
|
-
return /*#__PURE__*/React__default["default"].createElement(Router, {
|
|
1822
|
-
history: this.history,
|
|
1823
|
-
children: this.props.children
|
|
1824
|
-
});
|
|
1825
|
-
};
|
|
1826
|
-
return MemoryRouter;
|
|
1827
|
-
})(React__default["default"].Component);
|
|
1828
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1829
|
-
_inheritsLoose$1(Lifecycle, _React$Component);
|
|
1830
|
-
function Lifecycle() {
|
|
1831
|
-
return _React$Component.apply(this, arguments) || this;
|
|
1832
|
-
}
|
|
1833
|
-
var _proto = Lifecycle.prototype;
|
|
1834
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
1835
|
-
if (this.props.onMount) this.props.onMount.call(this, this);
|
|
1836
|
-
};
|
|
1837
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
1838
|
-
if (this.props.onUpdate) this.props.onUpdate.call(this, this, prevProps);
|
|
1839
|
-
};
|
|
1840
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1841
|
-
if (this.props.onUnmount) this.props.onUnmount.call(this, this);
|
|
1842
|
-
};
|
|
1843
|
-
_proto.render = function render() {
|
|
1844
|
-
return null;
|
|
1845
|
-
};
|
|
1846
|
-
return Lifecycle;
|
|
1847
|
-
})(React__default["default"].Component);
|
|
1848
|
-
var cache$1 = {};
|
|
1849
|
-
var cacheLimit$1 = 10000;
|
|
1850
|
-
var cacheCount$1 = 0;
|
|
1851
|
-
function compilePath$1(path, options) {
|
|
1852
|
-
var cacheKey = "" + options.end + options.strict + options.sensitive;
|
|
1853
|
-
var pathCache = cache$1[cacheKey] || (cache$1[cacheKey] = {});
|
|
1854
|
-
if (pathCache[path]) return pathCache[path];
|
|
1855
|
-
var keys = [];
|
|
1856
|
-
var regexp = pathToRegexp$1.exports(path, keys, options);
|
|
1857
|
-
var result = {
|
|
1858
|
-
regexp: regexp,
|
|
1859
|
-
keys: keys
|
|
1860
|
-
};
|
|
1861
|
-
if (cacheCount$1 < cacheLimit$1) {
|
|
1862
|
-
pathCache[path] = result;
|
|
1863
|
-
cacheCount$1++;
|
|
1864
|
-
}
|
|
1865
|
-
return result;
|
|
1866
|
-
}
|
|
1867
|
-
/**
|
|
1868
|
-
* Public API for matching a URL pathname to a path.
|
|
1869
|
-
*/
|
|
1870
|
-
|
|
1871
|
-
function matchPath(pathname, options) {
|
|
1872
|
-
if (options === void 0) {
|
|
1873
|
-
options = {};
|
|
1874
|
-
}
|
|
1875
|
-
if (typeof options === "string" || Array.isArray(options)) {
|
|
1876
|
-
options = {
|
|
1877
|
-
path: options
|
|
1878
|
-
};
|
|
1879
|
-
}
|
|
1880
|
-
var _options = options,
|
|
1881
|
-
path = _options.path,
|
|
1882
|
-
_options$exact = _options.exact,
|
|
1883
|
-
exact = _options$exact === void 0 ? false : _options$exact,
|
|
1884
|
-
_options$strict = _options.strict,
|
|
1885
|
-
strict = _options$strict === void 0 ? false : _options$strict,
|
|
1886
|
-
_options$sensitive = _options.sensitive,
|
|
1887
|
-
sensitive = _options$sensitive === void 0 ? false : _options$sensitive;
|
|
1888
|
-
var paths = [].concat(path);
|
|
1889
|
-
return paths.reduce(function (matched, path) {
|
|
1890
|
-
if (!path && path !== "") return null;
|
|
1891
|
-
if (matched) return matched;
|
|
1892
|
-
var _compilePath = compilePath$1(path, {
|
|
1893
|
-
end: exact,
|
|
1894
|
-
strict: strict,
|
|
1895
|
-
sensitive: sensitive
|
|
1896
|
-
}),
|
|
1897
|
-
regexp = _compilePath.regexp,
|
|
1898
|
-
keys = _compilePath.keys;
|
|
1899
|
-
var match = regexp.exec(pathname);
|
|
1900
|
-
if (!match) return null;
|
|
1901
|
-
var url = match[0],
|
|
1902
|
-
values = match.slice(1);
|
|
1903
|
-
var isExact = pathname === url;
|
|
1904
|
-
if (exact && !isExact) return null;
|
|
1905
|
-
return {
|
|
1906
|
-
path: path,
|
|
1907
|
-
// the path used to match
|
|
1908
|
-
url: path === "/" && url === "" ? "/" : url,
|
|
1909
|
-
// the matched portion of the URL
|
|
1910
|
-
isExact: isExact,
|
|
1911
|
-
// whether or not we matched exactly
|
|
1912
|
-
params: keys.reduce(function (memo, key, index) {
|
|
1913
|
-
memo[key.name] = values[index];
|
|
1914
|
-
return memo;
|
|
1915
|
-
}, {})
|
|
1916
|
-
};
|
|
1917
|
-
}, null);
|
|
1918
|
-
}
|
|
1919
|
-
function isEmptyChildren(children) {
|
|
1920
|
-
return React__default["default"].Children.count(children) === 0;
|
|
1921
|
-
}
|
|
1922
|
-
/**
|
|
1923
|
-
* The public API for matching a single path and rendering.
|
|
1924
|
-
*/
|
|
1925
|
-
|
|
1926
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1927
|
-
_inheritsLoose$1(Route, _React$Component);
|
|
1928
|
-
function Route() {
|
|
1929
|
-
return _React$Component.apply(this, arguments) || this;
|
|
1930
|
-
}
|
|
1931
|
-
var _proto = Route.prototype;
|
|
1932
|
-
_proto.render = function render() {
|
|
1933
|
-
var _this = this;
|
|
1934
|
-
return /*#__PURE__*/React__default["default"].createElement(context.Consumer, null, function (context$1) {
|
|
1935
|
-
!context$1 ? invariant(false) : void 0;
|
|
1936
|
-
var location = _this.props.location || context$1.location;
|
|
1937
|
-
var match = _this.props.computedMatch ? _this.props.computedMatch // <Switch> already computed the match for us
|
|
1938
|
-
: _this.props.path ? matchPath(location.pathname, _this.props) : context$1.match;
|
|
1939
|
-
var props = _extends({}, context$1, {
|
|
1940
|
-
location: location,
|
|
1941
|
-
match: match
|
|
1942
|
-
});
|
|
1943
|
-
var _this$props = _this.props,
|
|
1944
|
-
children = _this$props.children,
|
|
1945
|
-
component = _this$props.component,
|
|
1946
|
-
render = _this$props.render; // Preact uses an empty array as children by
|
|
1947
|
-
// default, so use null if that's the case.
|
|
1948
|
-
|
|
1949
|
-
if (Array.isArray(children) && isEmptyChildren(children)) {
|
|
1950
|
-
children = null;
|
|
1951
|
-
}
|
|
1952
|
-
return /*#__PURE__*/React__default["default"].createElement(context.Provider, {
|
|
1953
|
-
value: props
|
|
1954
|
-
}, props.match ? children ? typeof children === "function" ? children(props) : children : component ? /*#__PURE__*/React__default["default"].createElement(component, props) : render ? render(props) : null : typeof children === "function" ? children(props) : null);
|
|
1955
|
-
});
|
|
1956
|
-
};
|
|
1957
|
-
return Route;
|
|
1958
|
-
})(React__default["default"].Component);
|
|
1959
|
-
function addLeadingSlash(path) {
|
|
1960
|
-
return path.charAt(0) === "/" ? path : "/" + path;
|
|
1961
|
-
}
|
|
1962
|
-
function addBasename(basename, location) {
|
|
1963
|
-
if (!basename) return location;
|
|
1964
|
-
return _extends({}, location, {
|
|
1965
|
-
pathname: addLeadingSlash(basename) + location.pathname
|
|
1966
|
-
});
|
|
1967
|
-
}
|
|
1968
|
-
function stripBasename(basename, location) {
|
|
1969
|
-
if (!basename) return location;
|
|
1970
|
-
var base = addLeadingSlash(basename);
|
|
1971
|
-
if (location.pathname.indexOf(base) !== 0) return location;
|
|
1972
|
-
return _extends({}, location, {
|
|
1973
|
-
pathname: location.pathname.substr(base.length)
|
|
1974
|
-
});
|
|
1975
|
-
}
|
|
1976
|
-
function createURL(location) {
|
|
1977
|
-
return typeof location === "string" ? location : createPath(location);
|
|
1978
|
-
}
|
|
1979
|
-
function staticHandler(methodName) {
|
|
1980
|
-
return function () {
|
|
1981
|
-
invariant(false);
|
|
1982
|
-
};
|
|
1983
|
-
}
|
|
1984
|
-
function noop() {}
|
|
1985
|
-
/**
|
|
1986
|
-
* The public top-level API for a "static" <Router>, so-called because it
|
|
1987
|
-
* can't actually change the current location. Instead, it just records
|
|
1988
|
-
* location changes in a context object. Useful mainly in testing and
|
|
1989
|
-
* server-rendering scenarios.
|
|
1990
|
-
*/
|
|
1991
|
-
|
|
1992
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1993
|
-
_inheritsLoose$1(StaticRouter, _React$Component);
|
|
1994
|
-
function StaticRouter() {
|
|
1995
|
-
var _this;
|
|
1996
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1997
|
-
args[_key] = arguments[_key];
|
|
1998
|
-
}
|
|
1999
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
2000
|
-
_this.handlePush = function (location) {
|
|
2001
|
-
return _this.navigateTo(location, "PUSH");
|
|
2002
|
-
};
|
|
2003
|
-
_this.handleReplace = function (location) {
|
|
2004
|
-
return _this.navigateTo(location, "REPLACE");
|
|
2005
|
-
};
|
|
2006
|
-
_this.handleListen = function () {
|
|
2007
|
-
return noop;
|
|
2008
|
-
};
|
|
2009
|
-
_this.handleBlock = function () {
|
|
2010
|
-
return noop;
|
|
2011
|
-
};
|
|
2012
|
-
return _this;
|
|
2013
|
-
}
|
|
2014
|
-
var _proto = StaticRouter.prototype;
|
|
2015
|
-
_proto.navigateTo = function navigateTo(location, action) {
|
|
2016
|
-
var _this$props = this.props,
|
|
2017
|
-
_this$props$basename = _this$props.basename,
|
|
2018
|
-
basename = _this$props$basename === void 0 ? "" : _this$props$basename,
|
|
2019
|
-
_this$props$context = _this$props.context,
|
|
2020
|
-
context = _this$props$context === void 0 ? {} : _this$props$context;
|
|
2021
|
-
context.action = action;
|
|
2022
|
-
context.location = addBasename(basename, createLocation(location));
|
|
2023
|
-
context.url = createURL(context.location);
|
|
2024
|
-
};
|
|
2025
|
-
_proto.render = function render() {
|
|
2026
|
-
var _this$props2 = this.props,
|
|
2027
|
-
_this$props2$basename = _this$props2.basename,
|
|
2028
|
-
basename = _this$props2$basename === void 0 ? "" : _this$props2$basename,
|
|
2029
|
-
_this$props2$context = _this$props2.context,
|
|
2030
|
-
context = _this$props2$context === void 0 ? {} : _this$props2$context,
|
|
2031
|
-
_this$props2$location = _this$props2.location,
|
|
2032
|
-
location = _this$props2$location === void 0 ? "/" : _this$props2$location,
|
|
2033
|
-
rest = _objectWithoutPropertiesLoose(_this$props2, ["basename", "context", "location"]);
|
|
2034
|
-
var history = {
|
|
2035
|
-
createHref: function createHref(path) {
|
|
2036
|
-
return addLeadingSlash(basename + createURL(path));
|
|
2037
|
-
},
|
|
2038
|
-
action: "POP",
|
|
2039
|
-
location: stripBasename(basename, createLocation(location)),
|
|
2040
|
-
push: this.handlePush,
|
|
2041
|
-
replace: this.handleReplace,
|
|
2042
|
-
go: staticHandler(),
|
|
2043
|
-
goBack: staticHandler(),
|
|
2044
|
-
goForward: staticHandler(),
|
|
2045
|
-
listen: this.handleListen,
|
|
2046
|
-
block: this.handleBlock
|
|
2047
|
-
};
|
|
2048
|
-
return /*#__PURE__*/React__default["default"].createElement(Router, _extends({}, rest, {
|
|
2049
|
-
history: history,
|
|
2050
|
-
staticContext: context
|
|
2051
|
-
}));
|
|
2052
|
-
};
|
|
2053
|
-
return StaticRouter;
|
|
2054
|
-
})(React__default["default"].Component);
|
|
2055
|
-
|
|
2056
|
-
/**
|
|
2057
|
-
* The public API for rendering the first <Route> that matches.
|
|
2058
|
-
*/
|
|
2059
|
-
|
|
2060
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
2061
|
-
_inheritsLoose$1(Switch, _React$Component);
|
|
2062
|
-
function Switch() {
|
|
2063
|
-
return _React$Component.apply(this, arguments) || this;
|
|
2064
|
-
}
|
|
2065
|
-
var _proto = Switch.prototype;
|
|
2066
|
-
_proto.render = function render() {
|
|
2067
|
-
var _this = this;
|
|
2068
|
-
return /*#__PURE__*/React__default["default"].createElement(context.Consumer, null, function (context) {
|
|
2069
|
-
!context ? invariant(false) : void 0;
|
|
2070
|
-
var location = _this.props.location || context.location;
|
|
2071
|
-
var element, match; // We use React.Children.forEach instead of React.Children.toArray().find()
|
|
2072
|
-
// here because toArray adds keys to all child elements and we do not want
|
|
2073
|
-
// to trigger an unmount/remount for two <Route>s that render the same
|
|
2074
|
-
// component at different URLs.
|
|
2075
|
-
|
|
2076
|
-
React__default["default"].Children.forEach(_this.props.children, function (child) {
|
|
2077
|
-
if (match == null && /*#__PURE__*/React__default["default"].isValidElement(child)) {
|
|
2078
|
-
element = child;
|
|
2079
|
-
var path = child.props.path || child.props.from;
|
|
2080
|
-
match = path ? matchPath(location.pathname, _extends({}, child.props, {
|
|
2081
|
-
path: path
|
|
2082
|
-
})) : context.match;
|
|
2083
|
-
}
|
|
2084
|
-
});
|
|
2085
|
-
return match ? /*#__PURE__*/React__default["default"].cloneElement(element, {
|
|
2086
|
-
location: location,
|
|
2087
|
-
computedMatch: match
|
|
2088
|
-
}) : null;
|
|
2089
|
-
});
|
|
2090
|
-
};
|
|
2091
|
-
return Switch;
|
|
2092
|
-
})(React__default["default"].Component);
|
|
2093
|
-
React__default["default"].useContext;
|
|
2094
|
-
|
|
2095
|
-
/**
|
|
2096
|
-
* The public API for a <Router> that uses HTML5 history.
|
|
2097
|
-
*/
|
|
2098
|
-
|
|
2099
|
-
var BrowserRouter = /*#__PURE__*/function (_React$Component) {
|
|
2100
|
-
_inheritsLoose$1(BrowserRouter, _React$Component);
|
|
2101
|
-
function BrowserRouter() {
|
|
2102
|
-
var _this;
|
|
2103
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2104
|
-
args[_key] = arguments[_key];
|
|
2105
|
-
}
|
|
2106
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
2107
|
-
_this.history = createBrowserHistory(_this.props);
|
|
2108
|
-
return _this;
|
|
2109
|
-
}
|
|
2110
|
-
var _proto = BrowserRouter.prototype;
|
|
2111
|
-
_proto.render = function render() {
|
|
2112
|
-
return /*#__PURE__*/React__default["default"].createElement(Router, {
|
|
2113
|
-
history: this.history,
|
|
2114
|
-
children: this.props.children
|
|
2115
|
-
});
|
|
2116
|
-
};
|
|
2117
|
-
return BrowserRouter;
|
|
2118
|
-
}(React__default["default"].Component);
|
|
2119
|
-
|
|
2120
|
-
/**
|
|
2121
|
-
* The public API for a <Router> that uses window.location.hash.
|
|
2122
|
-
*/
|
|
2123
|
-
|
|
2124
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
2125
|
-
_inheritsLoose$1(HashRouter, _React$Component);
|
|
2126
|
-
function HashRouter() {
|
|
2127
|
-
var _this;
|
|
2128
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2129
|
-
args[_key] = arguments[_key];
|
|
2130
|
-
}
|
|
2131
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
2132
|
-
_this.history = createHashHistory(_this.props);
|
|
2133
|
-
return _this;
|
|
2134
|
-
}
|
|
2135
|
-
var _proto = HashRouter.prototype;
|
|
2136
|
-
_proto.render = function render() {
|
|
2137
|
-
return /*#__PURE__*/React__default["default"].createElement(Router, {
|
|
2138
|
-
history: this.history,
|
|
2139
|
-
children: this.props.children
|
|
2140
|
-
});
|
|
2141
|
-
};
|
|
2142
|
-
return HashRouter;
|
|
2143
|
-
})(React__default["default"].Component);
|
|
2144
|
-
var resolveToLocation = function resolveToLocation(to, currentLocation) {
|
|
2145
|
-
return typeof to === "function" ? to(currentLocation) : to;
|
|
2146
|
-
};
|
|
2147
|
-
var normalizeToLocation = function normalizeToLocation(to, currentLocation) {
|
|
2148
|
-
return typeof to === "string" ? createLocation(to, null, null, currentLocation) : to;
|
|
2149
|
-
};
|
|
2150
|
-
var forwardRefShim = function forwardRefShim(C) {
|
|
2151
|
-
return C;
|
|
2152
|
-
};
|
|
2153
|
-
var forwardRef = React__default["default"].forwardRef;
|
|
2154
|
-
if (typeof forwardRef === "undefined") {
|
|
2155
|
-
forwardRef = forwardRefShim;
|
|
2156
|
-
}
|
|
2157
|
-
function isModifiedEvent(event) {
|
|
2158
|
-
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
2159
|
-
}
|
|
2160
|
-
var LinkAnchor = forwardRef(function (_ref, forwardedRef) {
|
|
2161
|
-
var innerRef = _ref.innerRef,
|
|
2162
|
-
navigate = _ref.navigate,
|
|
2163
|
-
_onClick = _ref.onClick,
|
|
2164
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["innerRef", "navigate", "onClick"]);
|
|
2165
|
-
var target = rest.target;
|
|
2166
|
-
var props = _extends({}, rest, {
|
|
2167
|
-
onClick: function onClick(event) {
|
|
2168
|
-
try {
|
|
2169
|
-
if (_onClick) _onClick(event);
|
|
2170
|
-
} catch (ex) {
|
|
2171
|
-
event.preventDefault();
|
|
2172
|
-
throw ex;
|
|
2173
|
-
}
|
|
2174
|
-
if (!event.defaultPrevented &&
|
|
2175
|
-
// onClick prevented default
|
|
2176
|
-
event.button === 0 && (
|
|
2177
|
-
// ignore everything but left clicks
|
|
2178
|
-
!target || target === "_self") &&
|
|
2179
|
-
// let browser handle "target=_blank" etc.
|
|
2180
|
-
!isModifiedEvent(event) // ignore clicks with modifier keys
|
|
2181
|
-
) {
|
|
2182
|
-
event.preventDefault();
|
|
2183
|
-
navigate();
|
|
2184
|
-
}
|
|
2185
|
-
}
|
|
2186
|
-
}); // React 15 compat
|
|
2187
|
-
|
|
2188
|
-
if (forwardRefShim !== forwardRef) {
|
|
2189
|
-
props.ref = forwardedRef || innerRef;
|
|
2190
|
-
} else {
|
|
2191
|
-
props.ref = innerRef;
|
|
2192
|
-
}
|
|
2193
|
-
/* eslint-disable-next-line jsx-a11y/anchor-has-content */
|
|
2194
|
-
|
|
2195
|
-
return /*#__PURE__*/React__default["default"].createElement("a", props);
|
|
2196
|
-
});
|
|
2197
|
-
/**
|
|
2198
|
-
* The public API for rendering a history-aware <a>.
|
|
2199
|
-
*/
|
|
2200
|
-
|
|
2201
|
-
var Link = forwardRef(function (_ref2, forwardedRef) {
|
|
2202
|
-
var _ref2$component = _ref2.component,
|
|
2203
|
-
component = _ref2$component === void 0 ? LinkAnchor : _ref2$component,
|
|
2204
|
-
replace = _ref2.replace,
|
|
2205
|
-
to = _ref2.to,
|
|
2206
|
-
innerRef = _ref2.innerRef,
|
|
2207
|
-
rest = _objectWithoutPropertiesLoose(_ref2, ["component", "replace", "to", "innerRef"]);
|
|
2208
|
-
return /*#__PURE__*/React__default["default"].createElement(context.Consumer, null, function (context) {
|
|
2209
|
-
!context ? invariant(false) : void 0;
|
|
2210
|
-
var history = context.history;
|
|
2211
|
-
var location = normalizeToLocation(resolveToLocation(to, context.location), context.location);
|
|
2212
|
-
var href = location ? history.createHref(location) : "";
|
|
2213
|
-
var props = _extends({}, rest, {
|
|
2214
|
-
href: href,
|
|
2215
|
-
navigate: function navigate() {
|
|
2216
|
-
var location = resolveToLocation(to, context.location);
|
|
2217
|
-
var isDuplicateNavigation = createPath(context.location) === createPath(normalizeToLocation(location));
|
|
2218
|
-
var method = replace || isDuplicateNavigation ? history.replace : history.push;
|
|
2219
|
-
method(location);
|
|
2220
|
-
}
|
|
2221
|
-
}); // React 15 compat
|
|
2222
|
-
|
|
2223
|
-
if (forwardRefShim !== forwardRef) {
|
|
2224
|
-
props.ref = forwardedRef || innerRef;
|
|
2225
|
-
} else {
|
|
2226
|
-
props.innerRef = innerRef;
|
|
2227
|
-
}
|
|
2228
|
-
return /*#__PURE__*/React__default["default"].createElement(component, props);
|
|
2229
|
-
});
|
|
2230
|
-
});
|
|
2231
|
-
var forwardRefShim$1 = function forwardRefShim(C) {
|
|
2232
|
-
return C;
|
|
2233
|
-
};
|
|
2234
|
-
var forwardRef$1 = React__default["default"].forwardRef;
|
|
2235
|
-
if (typeof forwardRef$1 === "undefined") {
|
|
2236
|
-
forwardRef$1 = forwardRefShim$1;
|
|
2237
|
-
}
|
|
2238
|
-
function joinClassnames() {
|
|
2239
|
-
for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2240
|
-
classnames[_key] = arguments[_key];
|
|
2241
|
-
}
|
|
2242
|
-
return classnames.filter(function (i) {
|
|
2243
|
-
return i;
|
|
2244
|
-
}).join(" ");
|
|
2245
|
-
}
|
|
2246
|
-
/**
|
|
2247
|
-
* A <Link> wrapper that knows if it's "active" or not.
|
|
2248
|
-
*/
|
|
2249
|
-
|
|
2250
|
-
forwardRef$1(function (_ref, forwardedRef) {
|
|
2251
|
-
var _ref$ariaCurrent = _ref["aria-current"],
|
|
2252
|
-
ariaCurrent = _ref$ariaCurrent === void 0 ? "page" : _ref$ariaCurrent,
|
|
2253
|
-
_ref$activeClassName = _ref.activeClassName,
|
|
2254
|
-
activeClassName = _ref$activeClassName === void 0 ? "active" : _ref$activeClassName,
|
|
2255
|
-
activeStyle = _ref.activeStyle,
|
|
2256
|
-
classNameProp = _ref.className,
|
|
2257
|
-
exact = _ref.exact,
|
|
2258
|
-
isActiveProp = _ref.isActive,
|
|
2259
|
-
locationProp = _ref.location,
|
|
2260
|
-
sensitive = _ref.sensitive,
|
|
2261
|
-
strict = _ref.strict,
|
|
2262
|
-
styleProp = _ref.style,
|
|
2263
|
-
to = _ref.to,
|
|
2264
|
-
innerRef = _ref.innerRef,
|
|
2265
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "sensitive", "strict", "style", "to", "innerRef"]);
|
|
2266
|
-
return /*#__PURE__*/React__default["default"].createElement(context.Consumer, null, function (context) {
|
|
2267
|
-
!context ? invariant(false) : void 0;
|
|
2268
|
-
var currentLocation = locationProp || context.location;
|
|
2269
|
-
var toLocation = normalizeToLocation(resolveToLocation(to, currentLocation), currentLocation);
|
|
2270
|
-
var path = toLocation.pathname; // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
|
|
2271
|
-
|
|
2272
|
-
var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
|
2273
|
-
var match = escapedPath ? matchPath(currentLocation.pathname, {
|
|
2274
|
-
path: escapedPath,
|
|
2275
|
-
exact: exact,
|
|
2276
|
-
sensitive: sensitive,
|
|
2277
|
-
strict: strict
|
|
2278
|
-
}) : null;
|
|
2279
|
-
var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
|
|
2280
|
-
var className = typeof classNameProp === "function" ? classNameProp(isActive) : classNameProp;
|
|
2281
|
-
var style = typeof styleProp === "function" ? styleProp(isActive) : styleProp;
|
|
2282
|
-
if (isActive) {
|
|
2283
|
-
className = joinClassnames(className, activeClassName);
|
|
2284
|
-
style = _extends({}, style, activeStyle);
|
|
2285
|
-
}
|
|
2286
|
-
var props = _extends({
|
|
2287
|
-
"aria-current": isActive && ariaCurrent || null,
|
|
2288
|
-
className: className,
|
|
2289
|
-
style: style,
|
|
2290
|
-
to: toLocation
|
|
2291
|
-
}, rest); // React 15 compat
|
|
2292
|
-
|
|
2293
|
-
if (forwardRefShim$1 !== forwardRef$1) {
|
|
2294
|
-
props.ref = forwardedRef || innerRef;
|
|
2295
|
-
} else {
|
|
2296
|
-
props.innerRef = innerRef;
|
|
2297
|
-
}
|
|
2298
|
-
return /*#__PURE__*/React__default["default"].createElement(Link, props);
|
|
2299
|
-
});
|
|
2300
|
-
});
|
|
2301
|
-
|
|
2302
|
-
function _toPrimitive(input, hint) {
|
|
2303
|
-
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
2304
|
-
var prim = input[Symbol.toPrimitive];
|
|
2305
|
-
if (prim !== undefined) {
|
|
2306
|
-
var res = prim.call(input, hint || "default");
|
|
2307
|
-
if (_typeof$1(res) !== "object") return res;
|
|
2308
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2309
|
-
}
|
|
2310
|
-
return (hint === "string" ? String : Number)(input);
|
|
2311
|
-
}
|
|
2312
|
-
|
|
2313
|
-
function _toPropertyKey(arg) {
|
|
2314
|
-
var key = _toPrimitive(arg, "string");
|
|
2315
|
-
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
function _defineProperty(obj, key, value) {
|
|
2319
|
-
key = _toPropertyKey(key);
|
|
2320
|
-
if (key in obj) {
|
|
2321
|
-
Object.defineProperty(obj, key, {
|
|
2322
|
-
value: value,
|
|
2323
|
-
enumerable: true,
|
|
2324
|
-
configurable: true,
|
|
2325
|
-
writable: true
|
|
2326
|
-
});
|
|
2327
|
-
} else {
|
|
2328
|
-
obj[key] = value;
|
|
2329
|
-
}
|
|
2330
|
-
return obj;
|
|
2331
|
-
}
|
|
2332
|
-
|
|
2333
|
-
function _objectWithoutProperties(source, excluded) {
|
|
2334
|
-
if (source == null) return {};
|
|
2335
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
2336
|
-
var key, i;
|
|
2337
|
-
if (Object.getOwnPropertySymbols) {
|
|
2338
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
2339
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
2340
|
-
key = sourceSymbolKeys[i];
|
|
2341
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
2342
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
2343
|
-
target[key] = source[key];
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
return target;
|
|
2347
|
-
}
|
|
2348
|
-
|
|
2349
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2350
|
-
try {
|
|
2351
|
-
var info = gen[key](arg);
|
|
2352
|
-
var value = info.value;
|
|
2353
|
-
} catch (error) {
|
|
2354
|
-
reject(error);
|
|
2355
|
-
return;
|
|
2356
|
-
}
|
|
2357
|
-
if (info.done) {
|
|
2358
|
-
resolve(value);
|
|
2359
|
-
} else {
|
|
2360
|
-
Promise.resolve(value).then(_next, _throw);
|
|
2361
|
-
}
|
|
2362
|
-
}
|
|
2363
|
-
function _asyncToGenerator(fn) {
|
|
2364
|
-
return function () {
|
|
2365
|
-
var self = this,
|
|
2366
|
-
args = arguments;
|
|
2367
|
-
return new Promise(function (resolve, reject) {
|
|
2368
|
-
var gen = fn.apply(self, args);
|
|
2369
|
-
function _next(value) {
|
|
2370
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2371
|
-
}
|
|
2372
|
-
function _throw(err) {
|
|
2373
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2374
|
-
}
|
|
2375
|
-
_next(undefined);
|
|
2376
|
-
});
|
|
2377
|
-
};
|
|
2378
|
-
}
|
|
2379
|
-
|
|
2380
|
-
var regeneratorRuntime$1 = {exports: {}};
|
|
2381
|
-
|
|
2382
|
-
var _typeof = {exports: {}};
|
|
2383
|
-
|
|
2384
|
-
(function (module) {
|
|
2385
|
-
function _typeof(obj) {
|
|
2386
|
-
"@babel/helpers - typeof";
|
|
2387
|
-
|
|
2388
|
-
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
2389
|
-
return typeof obj;
|
|
2390
|
-
} : function (obj) {
|
|
2391
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2392
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
2393
|
-
}
|
|
2394
|
-
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
2395
|
-
})(_typeof);
|
|
2396
|
-
|
|
2397
|
-
(function (module) {
|
|
2398
|
-
var _typeof$1 = _typeof.exports["default"];
|
|
2399
|
-
function _regeneratorRuntime() {
|
|
2400
|
-
|
|
2401
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
2402
|
-
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
2403
|
-
return exports;
|
|
2404
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
2405
|
-
var exports = {},
|
|
2406
|
-
Op = Object.prototype,
|
|
2407
|
-
hasOwn = Op.hasOwnProperty,
|
|
2408
|
-
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
2409
|
-
obj[key] = desc.value;
|
|
2410
|
-
},
|
|
2411
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
2412
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
2413
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
2414
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
2415
|
-
function define(obj, key, value) {
|
|
2416
|
-
return Object.defineProperty(obj, key, {
|
|
2417
|
-
value: value,
|
|
2418
|
-
enumerable: !0,
|
|
2419
|
-
configurable: !0,
|
|
2420
|
-
writable: !0
|
|
2421
|
-
}), obj[key];
|
|
2422
|
-
}
|
|
2423
|
-
try {
|
|
2424
|
-
define({}, "");
|
|
2425
|
-
} catch (err) {
|
|
2426
|
-
define = function define(obj, key, value) {
|
|
2427
|
-
return obj[key] = value;
|
|
2428
|
-
};
|
|
2429
|
-
}
|
|
2430
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
2431
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
2432
|
-
generator = Object.create(protoGenerator.prototype),
|
|
2433
|
-
context = new Context(tryLocsList || []);
|
|
2434
|
-
return defineProperty(generator, "_invoke", {
|
|
2435
|
-
value: makeInvokeMethod(innerFn, self, context)
|
|
2436
|
-
}), generator;
|
|
2437
|
-
}
|
|
2438
|
-
function tryCatch(fn, obj, arg) {
|
|
2439
|
-
try {
|
|
2440
|
-
return {
|
|
2441
|
-
type: "normal",
|
|
2442
|
-
arg: fn.call(obj, arg)
|
|
2443
|
-
};
|
|
2444
|
-
} catch (err) {
|
|
2445
|
-
return {
|
|
2446
|
-
type: "throw",
|
|
2447
|
-
arg: err
|
|
2448
|
-
};
|
|
2449
|
-
}
|
|
2450
|
-
}
|
|
2451
|
-
exports.wrap = wrap;
|
|
2452
|
-
var ContinueSentinel = {};
|
|
2453
|
-
function Generator() {}
|
|
2454
|
-
function GeneratorFunction() {}
|
|
2455
|
-
function GeneratorFunctionPrototype() {}
|
|
2456
|
-
var IteratorPrototype = {};
|
|
2457
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
2458
|
-
return this;
|
|
2459
|
-
});
|
|
2460
|
-
var getProto = Object.getPrototypeOf,
|
|
2461
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
2462
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
2463
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
2464
|
-
function defineIteratorMethods(prototype) {
|
|
2465
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
2466
|
-
define(prototype, method, function (arg) {
|
|
2467
|
-
return this._invoke(method, arg);
|
|
2468
|
-
});
|
|
2469
|
-
});
|
|
2470
|
-
}
|
|
2471
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
2472
|
-
function invoke(method, arg, resolve, reject) {
|
|
2473
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
2474
|
-
if ("throw" !== record.type) {
|
|
2475
|
-
var result = record.arg,
|
|
2476
|
-
value = result.value;
|
|
2477
|
-
return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
2478
|
-
invoke("next", value, resolve, reject);
|
|
2479
|
-
}, function (err) {
|
|
2480
|
-
invoke("throw", err, resolve, reject);
|
|
2481
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
2482
|
-
result.value = unwrapped, resolve(result);
|
|
2483
|
-
}, function (error) {
|
|
2484
|
-
return invoke("throw", error, resolve, reject);
|
|
2485
|
-
});
|
|
2486
|
-
}
|
|
2487
|
-
reject(record.arg);
|
|
2488
|
-
}
|
|
2489
|
-
var previousPromise;
|
|
2490
|
-
defineProperty(this, "_invoke", {
|
|
2491
|
-
value: function value(method, arg) {
|
|
2492
|
-
function callInvokeWithMethodAndArg() {
|
|
2493
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
2494
|
-
invoke(method, arg, resolve, reject);
|
|
2495
|
-
});
|
|
2496
|
-
}
|
|
2497
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
2498
|
-
}
|
|
2499
|
-
});
|
|
2500
|
-
}
|
|
2501
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
2502
|
-
var state = "suspendedStart";
|
|
2503
|
-
return function (method, arg) {
|
|
2504
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
2505
|
-
if ("completed" === state) {
|
|
2506
|
-
if ("throw" === method) throw arg;
|
|
2507
|
-
return doneResult();
|
|
2508
|
-
}
|
|
2509
|
-
for (context.method = method, context.arg = arg;;) {
|
|
2510
|
-
var delegate = context.delegate;
|
|
2511
|
-
if (delegate) {
|
|
2512
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
2513
|
-
if (delegateResult) {
|
|
2514
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
2515
|
-
return delegateResult;
|
|
2516
|
-
}
|
|
2517
|
-
}
|
|
2518
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
2519
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
2520
|
-
context.dispatchException(context.arg);
|
|
2521
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
2522
|
-
state = "executing";
|
|
2523
|
-
var record = tryCatch(innerFn, self, context);
|
|
2524
|
-
if ("normal" === record.type) {
|
|
2525
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
2526
|
-
return {
|
|
2527
|
-
value: record.arg,
|
|
2528
|
-
done: context.done
|
|
2529
|
-
};
|
|
2530
|
-
}
|
|
2531
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
2532
|
-
}
|
|
2533
|
-
};
|
|
2534
|
-
}
|
|
2535
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
2536
|
-
var methodName = context.method,
|
|
2537
|
-
method = delegate.iterator[methodName];
|
|
2538
|
-
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
2539
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
2540
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
2541
|
-
var info = record.arg;
|
|
2542
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
2543
|
-
}
|
|
2544
|
-
function pushTryEntry(locs) {
|
|
2545
|
-
var entry = {
|
|
2546
|
-
tryLoc: locs[0]
|
|
2547
|
-
};
|
|
2548
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
2549
|
-
}
|
|
2550
|
-
function resetTryEntry(entry) {
|
|
2551
|
-
var record = entry.completion || {};
|
|
2552
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
2553
|
-
}
|
|
2554
|
-
function Context(tryLocsList) {
|
|
2555
|
-
this.tryEntries = [{
|
|
2556
|
-
tryLoc: "root"
|
|
2557
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
2558
|
-
}
|
|
2559
|
-
function values(iterable) {
|
|
2560
|
-
if (iterable) {
|
|
2561
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
2562
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
2563
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
2564
|
-
if (!isNaN(iterable.length)) {
|
|
2565
|
-
var i = -1,
|
|
2566
|
-
next = function next() {
|
|
2567
|
-
for (; ++i < iterable.length;) {
|
|
2568
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
2569
|
-
}
|
|
2570
|
-
return next.value = undefined, next.done = !0, next;
|
|
2571
|
-
};
|
|
2572
|
-
return next.next = next;
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
return {
|
|
2576
|
-
next: doneResult
|
|
2577
|
-
};
|
|
2578
|
-
}
|
|
2579
|
-
function doneResult() {
|
|
2580
|
-
return {
|
|
2581
|
-
value: undefined,
|
|
2582
|
-
done: !0
|
|
2583
|
-
};
|
|
2584
|
-
}
|
|
2585
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
2586
|
-
value: GeneratorFunctionPrototype,
|
|
2587
|
-
configurable: !0
|
|
2588
|
-
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
2589
|
-
value: GeneratorFunction,
|
|
2590
|
-
configurable: !0
|
|
2591
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
2592
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
2593
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
2594
|
-
}, exports.mark = function (genFun) {
|
|
2595
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
2596
|
-
}, exports.awrap = function (arg) {
|
|
2597
|
-
return {
|
|
2598
|
-
__await: arg
|
|
2599
|
-
};
|
|
2600
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
2601
|
-
return this;
|
|
2602
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
2603
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
2604
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
2605
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
2606
|
-
return result.done ? result.value : iter.next();
|
|
2607
|
-
});
|
|
2608
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
2609
|
-
return this;
|
|
2610
|
-
}), define(Gp, "toString", function () {
|
|
2611
|
-
return "[object Generator]";
|
|
2612
|
-
}), exports.keys = function (val) {
|
|
2613
|
-
var object = Object(val),
|
|
2614
|
-
keys = [];
|
|
2615
|
-
for (var key in object) {
|
|
2616
|
-
keys.push(key);
|
|
2617
|
-
}
|
|
2618
|
-
return keys.reverse(), function next() {
|
|
2619
|
-
for (; keys.length;) {
|
|
2620
|
-
var key = keys.pop();
|
|
2621
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
2622
|
-
}
|
|
2623
|
-
return next.done = !0, next;
|
|
2624
|
-
};
|
|
2625
|
-
}, exports.values = values, Context.prototype = {
|
|
2626
|
-
constructor: Context,
|
|
2627
|
-
reset: function reset(skipTempReset) {
|
|
2628
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
|
|
2629
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
2630
|
-
}
|
|
2631
|
-
},
|
|
2632
|
-
stop: function stop() {
|
|
2633
|
-
this.done = !0;
|
|
2634
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
2635
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
2636
|
-
return this.rval;
|
|
2637
|
-
},
|
|
2638
|
-
dispatchException: function dispatchException(exception) {
|
|
2639
|
-
if (this.done) throw exception;
|
|
2640
|
-
var context = this;
|
|
2641
|
-
function handle(loc, caught) {
|
|
2642
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
2643
|
-
}
|
|
2644
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2645
|
-
var entry = this.tryEntries[i],
|
|
2646
|
-
record = entry.completion;
|
|
2647
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
2648
|
-
if (entry.tryLoc <= this.prev) {
|
|
2649
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
2650
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
2651
|
-
if (hasCatch && hasFinally) {
|
|
2652
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
2653
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
2654
|
-
} else if (hasCatch) {
|
|
2655
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
2656
|
-
} else {
|
|
2657
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
2658
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
2659
|
-
}
|
|
2660
|
-
}
|
|
2661
|
-
}
|
|
2662
|
-
},
|
|
2663
|
-
abrupt: function abrupt(type, arg) {
|
|
2664
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2665
|
-
var entry = this.tryEntries[i];
|
|
2666
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
2667
|
-
var finallyEntry = entry;
|
|
2668
|
-
break;
|
|
2669
|
-
}
|
|
2670
|
-
}
|
|
2671
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
2672
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
2673
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
2674
|
-
},
|
|
2675
|
-
complete: function complete(record, afterLoc) {
|
|
2676
|
-
if ("throw" === record.type) throw record.arg;
|
|
2677
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
2678
|
-
},
|
|
2679
|
-
finish: function finish(finallyLoc) {
|
|
2680
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2681
|
-
var entry = this.tryEntries[i];
|
|
2682
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
2683
|
-
}
|
|
2684
|
-
},
|
|
2685
|
-
"catch": function _catch(tryLoc) {
|
|
2686
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2687
|
-
var entry = this.tryEntries[i];
|
|
2688
|
-
if (entry.tryLoc === tryLoc) {
|
|
2689
|
-
var record = entry.completion;
|
|
2690
|
-
if ("throw" === record.type) {
|
|
2691
|
-
var thrown = record.arg;
|
|
2692
|
-
resetTryEntry(entry);
|
|
2693
|
-
}
|
|
2694
|
-
return thrown;
|
|
2695
|
-
}
|
|
2696
|
-
}
|
|
2697
|
-
throw new Error("illegal catch attempt");
|
|
2698
|
-
},
|
|
2699
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
2700
|
-
return this.delegate = {
|
|
2701
|
-
iterator: values(iterable),
|
|
2702
|
-
resultName: resultName,
|
|
2703
|
-
nextLoc: nextLoc
|
|
2704
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
2705
|
-
}
|
|
2706
|
-
}, exports;
|
|
2707
|
-
}
|
|
2708
|
-
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
2709
|
-
})(regeneratorRuntime$1);
|
|
149
|
+
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
2710
150
|
|
|
2711
|
-
|
|
151
|
+
function emptyFunction() {}
|
|
152
|
+
function emptyFunctionWithReset() {}
|
|
153
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
2712
154
|
|
|
2713
|
-
var
|
|
2714
|
-
|
|
155
|
+
var factoryWithThrowingShims = function() {
|
|
156
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
157
|
+
if (secret === ReactPropTypesSecret) {
|
|
158
|
+
// It is still safe when called from React.
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
var err = new Error(
|
|
162
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
163
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
164
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
165
|
+
);
|
|
166
|
+
err.name = 'Invariant Violation';
|
|
167
|
+
throw err;
|
|
168
|
+
} shim.isRequired = shim;
|
|
169
|
+
function getShim() {
|
|
170
|
+
return shim;
|
|
171
|
+
} // Important!
|
|
172
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
173
|
+
var ReactPropTypes = {
|
|
174
|
+
array: shim,
|
|
175
|
+
bigint: shim,
|
|
176
|
+
bool: shim,
|
|
177
|
+
func: shim,
|
|
178
|
+
number: shim,
|
|
179
|
+
object: shim,
|
|
180
|
+
string: shim,
|
|
181
|
+
symbol: shim,
|
|
2715
182
|
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
183
|
+
any: shim,
|
|
184
|
+
arrayOf: getShim,
|
|
185
|
+
element: shim,
|
|
186
|
+
elementType: shim,
|
|
187
|
+
instanceOf: getShim,
|
|
188
|
+
node: shim,
|
|
189
|
+
objectOf: getShim,
|
|
190
|
+
oneOf: getShim,
|
|
191
|
+
oneOfType: getShim,
|
|
192
|
+
shape: getShim,
|
|
193
|
+
exact: getShim,
|
|
194
|
+
|
|
195
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
196
|
+
resetWarningCache: emptyFunction
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
200
|
+
|
|
201
|
+
return ReactPropTypes;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
206
|
+
*
|
|
207
|
+
* This source code is licensed under the MIT license found in the
|
|
208
|
+
* LICENSE file in the root directory of this source tree.
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
{
|
|
212
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
213
|
+
// http://fb.me/prop-types-in-prod
|
|
214
|
+
propTypes.exports = factoryWithThrowingShims();
|
|
2725
215
|
}
|
|
2726
216
|
|
|
217
|
+
var propTypesExports = propTypes.exports;
|
|
218
|
+
var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
|
219
|
+
|
|
2727
220
|
function _arrayLikeToArray(arr, len) {
|
|
2728
221
|
if (len == null || len > arr.length) len = arr.length;
|
|
2729
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
2730
|
-
arr2[i] = arr[i];
|
|
2731
|
-
}
|
|
222
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
2732
223
|
return arr2;
|
|
2733
224
|
}
|
|
2734
225
|
|
|
@@ -2956,7 +447,7 @@ var getConditionsSchema = function getConditionsSchema(element) {
|
|
|
2956
447
|
}))
|
|
2957
448
|
});
|
|
2958
449
|
};
|
|
2959
|
-
var getActionsSchema = function getActionsSchema(element) {
|
|
450
|
+
var getActionsSchema = function getActionsSchema(element, customData) {
|
|
2960
451
|
var actionOptions = element.actionOptions,
|
|
2961
452
|
_element$componentPro5 = element.componentProps,
|
|
2962
453
|
componentProps = _element$componentPro5 === void 0 ? {} : _element$componentPro5;
|
|
@@ -3021,7 +512,7 @@ var getActionsSchema = function getActionsSchema(element) {
|
|
|
3021
512
|
value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.body"))
|
|
3022
513
|
});
|
|
3023
514
|
} else if (selectedAction !== null && selectedAction !== void 0 && selectedAction.component) {
|
|
3024
|
-
return selectedAction.validation;
|
|
515
|
+
return typeof selectedAction.validation === "function" ? selectedAction.validation(customData) : selectedAction.validation;
|
|
3025
516
|
}
|
|
3026
517
|
return schema;
|
|
3027
518
|
})
|
|
@@ -3039,14 +530,14 @@ var getSchemaForArray = function getSchemaForArray(element) {
|
|
|
3039
530
|
then: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
|
|
3040
531
|
});
|
|
3041
532
|
};
|
|
3042
|
-
var getSchemaForElement = function getSchemaForElement(element) {
|
|
3043
|
-
return VALIDATION_SCHEMA[element.type](element);
|
|
533
|
+
var getSchemaForElement = function getSchemaForElement(element, customData) {
|
|
534
|
+
return VALIDATION_SCHEMA[element.type](element, customData);
|
|
3044
535
|
};
|
|
3045
|
-
var getValidationSchema = function getValidationSchema(data) {
|
|
536
|
+
var getValidationSchema = function getValidationSchema(data, customData) {
|
|
3046
537
|
var fieldKeys = Object.keys(data);
|
|
3047
538
|
var schema = fieldKeys.reduce(function (acc, key) {
|
|
3048
539
|
return _objectSpread$6(_objectSpread$6({}, acc), {}, _defineProperty({}, key, yup__namespace.object({
|
|
3049
|
-
value: getSchemaForElement(data[key])
|
|
540
|
+
value: getSchemaForElement(data[key], customData)
|
|
3050
541
|
})));
|
|
3051
542
|
}, {});
|
|
3052
543
|
return yup__namespace.object(schema);
|
|
@@ -3071,7 +562,7 @@ var POSITIVE_NUMBER_REGEX = /^[0-9]+$/;
|
|
|
3071
562
|
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3072
563
|
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3073
564
|
var buildPayload = function buildPayload(data, values) {
|
|
3074
|
-
|
|
565
|
+
return Object.keys(data).reduce(function (acc, key) {
|
|
3075
566
|
var fieldValue = values[key].value;
|
|
3076
567
|
if (Array.isArray(fieldValue)) {
|
|
3077
568
|
var _values$key;
|
|
@@ -3088,7 +579,6 @@ var buildPayload = function buildPayload(data, values) {
|
|
|
3088
579
|
}
|
|
3089
580
|
return _objectSpread$5(_objectSpread$5({}, acc), {}, _defineProperty({}, key, fieldValue));
|
|
3090
581
|
}, {});
|
|
3091
|
-
return payload;
|
|
3092
582
|
};
|
|
3093
583
|
var formatData = function formatData(data) {
|
|
3094
584
|
return Object.keys(data).reduce(function (acc, key) {
|
|
@@ -3105,6 +595,14 @@ var formatData = function formatData(data) {
|
|
|
3105
595
|
}, {});
|
|
3106
596
|
};
|
|
3107
597
|
|
|
598
|
+
/** @type {import("neetocommons/react-utils").ZustandStoreHook} */
|
|
599
|
+
var useCustomDataStore = zustand.create(reactUtils.withImmutableActions(function (set) {
|
|
600
|
+
return {
|
|
601
|
+
customData: {},
|
|
602
|
+
setCustomDataState: set
|
|
603
|
+
};
|
|
604
|
+
}));
|
|
605
|
+
|
|
3108
606
|
var transformObjectToDotNotation = function transformObjectToDotNotation(obj) {
|
|
3109
607
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
3110
608
|
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
@@ -3168,39 +666,29 @@ var NeetoRules$2 = function NeetoRules(_ref) {
|
|
|
3168
666
|
_ref$handleCancel = _ref.handleCancel,
|
|
3169
667
|
handleCancel = _ref$handleCancel === void 0 ? neetoCist.noop : _ref$handleCancel;
|
|
3170
668
|
var formRef = React.useRef(null);
|
|
3171
|
-
var submitForm =
|
|
3172
|
-
var
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
while (1) {
|
|
3176
|
-
switch (_context.prev = _context.next) {
|
|
3177
|
-
case 0:
|
|
3178
|
-
payload = buildPayload(data, values);
|
|
3179
|
-
handleSubmit(payload, formikBag);
|
|
3180
|
-
case 2:
|
|
3181
|
-
case "end":
|
|
3182
|
-
return _context.stop();
|
|
3183
|
-
}
|
|
3184
|
-
}
|
|
3185
|
-
}, _callee);
|
|
3186
|
-
}));
|
|
3187
|
-
return function submitForm(_x, _x2) {
|
|
3188
|
-
return _ref2.apply(this, arguments);
|
|
3189
|
-
};
|
|
3190
|
-
}();
|
|
669
|
+
var submitForm = function submitForm(values, formikBag) {
|
|
670
|
+
var payload = buildPayload(data, values);
|
|
671
|
+
handleSubmit(payload, formikBag);
|
|
672
|
+
};
|
|
3191
673
|
var initialValues = React.useMemo(function () {
|
|
3192
674
|
return formatData(data);
|
|
3193
675
|
}, [data]);
|
|
676
|
+
var _useCustomDataStore = useCustomDataStore(function (store) {
|
|
677
|
+
return {
|
|
678
|
+
customData: store["customData"]
|
|
679
|
+
};
|
|
680
|
+
}, shallow.shallow),
|
|
681
|
+
customData = _useCustomDataStore.customData;
|
|
3194
682
|
return /*#__PURE__*/React__default["default"].createElement(formik.Formik, {
|
|
3195
|
-
enableReinitialize: true,
|
|
3196
683
|
initialValues: initialValues,
|
|
3197
|
-
|
|
684
|
+
enableReinitialize: true,
|
|
685
|
+
validationSchema: getValidationSchema(data, customData),
|
|
3198
686
|
onSubmit: submitForm
|
|
3199
|
-
}, function (
|
|
3200
|
-
var isSubmitting =
|
|
3201
|
-
dirty =
|
|
3202
|
-
values =
|
|
3203
|
-
fromikBag = _objectWithoutProperties(
|
|
687
|
+
}, function (_ref2) {
|
|
688
|
+
var isSubmitting = _ref2.isSubmitting,
|
|
689
|
+
dirty = _ref2.dirty,
|
|
690
|
+
values = _ref2.values,
|
|
691
|
+
fromikBag = _objectWithoutProperties(_ref2, _excluded$9);
|
|
3204
692
|
return /*#__PURE__*/React__default["default"].createElement(formik.Form, {
|
|
3205
693
|
className: classNames__default["default"](["w-full space-y-6 px-24", className]),
|
|
3206
694
|
ref: formRef
|
|
@@ -3229,9 +717,9 @@ var NeetoRules$2 = function NeetoRules(_ref) {
|
|
|
3229
717
|
});
|
|
3230
718
|
};
|
|
3231
719
|
NeetoRules$2.prototype = {
|
|
3232
|
-
data:
|
|
3233
|
-
handleSubmit:
|
|
3234
|
-
className:
|
|
720
|
+
data: PropTypes.object,
|
|
721
|
+
handleSubmit: PropTypes.func,
|
|
722
|
+
className: PropTypes.string
|
|
3235
723
|
};
|
|
3236
724
|
|
|
3237
725
|
var Main = function Main(_ref) {
|
|
@@ -3239,9 +727,14 @@ var Main = function Main(_ref) {
|
|
|
3239
727
|
return /*#__PURE__*/React__default["default"].createElement(NeetoRules$2, rest);
|
|
3240
728
|
};
|
|
3241
729
|
|
|
730
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
731
|
+
|
|
732
|
+
var css = ".neeto-filters-error-boundary{align-items:center;background-color:rgb(var(--neeto-ui-gray-100));border-radius:var(--neeto-ui-rounded-sm);display:flex;gap:16px;margin-bottom:12px;padding:8px 20px}.neeto-filters-error-boundary p{color:rgb(var(--neeto-ui-gray-800))}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9jb21wb25lbnRzL19lcnJvci1ib3VuZGFyeS5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3JjL3N0eWxlc2hlZXRzL21haW4uc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSw4QkFJRSxrQkFBQSxDQUdBLDhDQUFBLENBREEsd0NBQUEsQ0FIQSxZQUFBLENBRUEsUUFBQSxDQUhBLGtCQUFBLENBREEsZ0JDT0YsQ0RDRSxnQ0FDRSxtQ0NDSiIsInNvdXJjZXNDb250ZW50IjpbIi5uZWV0by1maWx0ZXJzLWVycm9yLWJvdW5kYXJ5IHtcbiAgcGFkZGluZzogOHB4IDIwcHg7XG4gIG1hcmdpbi1ib3R0b206IDEycHg7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGdhcDogMTZweDtcbiAgYm9yZGVyLXJhZGl1czogdmFyKC0tbmVldG8tdWktcm91bmRlZC1zbSk7XG4gIGJhY2tncm91bmQtY29sb3I6IHJnYih2YXIoLS1uZWV0by11aS1ncmF5LTEwMCkpO1xuXG4gIHAge1xuICAgIGNvbG9yOiByZ2IodmFyKC0tbmVldG8tdWktZ3JheS04MDApKTtcbiAgfVxufVxuIiwiLm5lZXRvLWZpbHRlcnMtZXJyb3ItYm91bmRhcnkge1xuICBwYWRkaW5nOiA4cHggMjBweDtcbiAgbWFyZ2luLWJvdHRvbTogMTJweDtcbiAgZGlzcGxheTogZmxleDtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgZ2FwOiAxNnB4O1xuICBib3JkZXItcmFkaXVzOiB2YXIoLS1uZWV0by11aS1yb3VuZGVkLXNtKTtcbiAgYmFja2dyb3VuZC1jb2xvcjogcmdiKHZhcigtLW5lZXRvLXVpLWdyYXktMTAwKSk7XG59XG4ubmVldG8tZmlsdGVycy1lcnJvci1ib3VuZGFyeSBwIHtcbiAgY29sb3I6IHJnYih2YXIoLS1uZWV0by11aS1ncmF5LTgwMCkpO1xufSJdfQ== */";
|
|
733
|
+
n(css,{});
|
|
734
|
+
|
|
3242
735
|
var NeetoRules$1 = function NeetoRules(_ref) {
|
|
3243
736
|
var rest = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
3244
|
-
return /*#__PURE__*/React__default["default"].createElement(BrowserRouter, null, /*#__PURE__*/React__default["default"].createElement(Main, rest));
|
|
737
|
+
return /*#__PURE__*/React__default["default"].createElement(reactRouterDom.BrowserRouter, null, /*#__PURE__*/React__default["default"].createElement(Main, rest));
|
|
3245
738
|
};
|
|
3246
739
|
|
|
3247
740
|
function _arrayWithHoles(arr) {
|
|
@@ -3262,9 +755,7 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
3262
755
|
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
3263
756
|
if (Object(_i) !== _i) return;
|
|
3264
757
|
_n = !1;
|
|
3265
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
3266
|
-
;
|
|
3267
|
-
}
|
|
758
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
3268
759
|
} catch (err) {
|
|
3269
760
|
_d = !0, _e = err;
|
|
3270
761
|
} finally {
|
|
@@ -3317,10 +808,10 @@ var MultiSelectValues = function MultiSelectValues(_ref) {
|
|
|
3317
808
|
};
|
|
3318
809
|
|
|
3319
810
|
var getEntityDisplayValue = function getEntityDisplayValue(entitiy, entitiyOption) {
|
|
3320
|
-
var _findBy
|
|
811
|
+
var _findBy;
|
|
3321
812
|
return (_findBy = neetoCist.findBy({
|
|
3322
813
|
value: entitiy.metadata.value
|
|
3323
|
-
}, entitiyOption.dropdownOptions)) === null || _findBy === void 0
|
|
814
|
+
}, entitiyOption.dropdownOptions)) === null || _findBy === void 0 || (_findBy = _findBy.label) === null || _findBy === void 0 ? void 0 : _findBy.toLowerCase();
|
|
3324
815
|
};
|
|
3325
816
|
|
|
3326
817
|
var ActionsDetail = function ActionsDetail(_ref) {
|
|
@@ -3352,10 +843,10 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
3352
843
|
return action.metadata.value.includes(value);
|
|
3353
844
|
}));
|
|
3354
845
|
return /*#__PURE__*/React__default["default"].createElement(MultiSelectValues, {
|
|
846
|
+
values: values,
|
|
3355
847
|
separator: t("neetoRules.common.and", {
|
|
3356
848
|
what: ""
|
|
3357
|
-
})
|
|
3358
|
-
values: values
|
|
849
|
+
})
|
|
3359
850
|
});
|
|
3360
851
|
}
|
|
3361
852
|
return null;
|
|
@@ -3386,9 +877,9 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
3386
877
|
className: "mt-3 w-full"
|
|
3387
878
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
3388
879
|
icon: !viewMore ? neetoIcons.Down : neetoIcons.Up,
|
|
3389
|
-
label: !viewMore ? t("neetoRules.common.viewMore") : t("neetoRules.common.viewLess"),
|
|
3390
880
|
size: "small",
|
|
3391
881
|
style: "link",
|
|
882
|
+
label: !viewMore ? t("neetoRules.common.viewMore") : t("neetoRules.common.viewLess"),
|
|
3392
883
|
onClick: function onClick() {
|
|
3393
884
|
return setViewMore(function (prevState) {
|
|
3394
885
|
return !prevState;
|
|
@@ -3419,8 +910,8 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
3419
910
|
return condition.metadata.values.includes(value);
|
|
3420
911
|
}));
|
|
3421
912
|
return /*#__PURE__*/React__default["default"].createElement(MultiSelectValues, {
|
|
3422
|
-
|
|
3423
|
-
|
|
913
|
+
values: values,
|
|
914
|
+
separator: i18next.t("neetoRules.common.or")
|
|
3424
915
|
});
|
|
3425
916
|
}
|
|
3426
917
|
if (conditionOption.type === "dropdown") {
|
|
@@ -3520,7 +1011,7 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
3520
1011
|
className: "neeto-ui-text-gray-800",
|
|
3521
1012
|
style: "h5",
|
|
3522
1013
|
weight: "semibold"
|
|
3523
|
-
}, currentPerformer === null || currentPerformer === void 0
|
|
1014
|
+
}, currentPerformer === null || currentPerformer === void 0 || (_currentPerformer$lab = currentPerformer.label) === null || _currentPerformer$lab === void 0 ? void 0 : _currentPerformer$lab.toLowerCase())), /*#__PURE__*/React__default["default"].createElement(ConditionsDetail, {
|
|
3524
1015
|
conditionOptions: conditions.conditionOptions,
|
|
3525
1016
|
conditionVerbs: conditions.verbs,
|
|
3526
1017
|
conditions: allConditions
|
|
@@ -3528,9 +1019,9 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
3528
1019
|
className: "mt-3 w-full"
|
|
3529
1020
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
3530
1021
|
icon: !viewMore ? neetoIcons.Down : neetoIcons.Up,
|
|
3531
|
-
label: !viewMore ? i18next.t("neetoRules.common.viewMore") : i18next.t("neetoRules.common.viewLess"),
|
|
3532
1022
|
size: "small",
|
|
3533
1023
|
style: "link",
|
|
1024
|
+
label: !viewMore ? i18next.t("neetoRules.common.viewMore") : i18next.t("neetoRules.common.viewLess"),
|
|
3534
1025
|
onClick: function onClick() {
|
|
3535
1026
|
return setViewMore(function (prevState) {
|
|
3536
1027
|
return !prevState;
|
|
@@ -3628,7 +1119,7 @@ var useOnButtonPressed = function useOnButtonPressed(ref, handler) {
|
|
|
3628
1119
|
var DEFAULT_LONG_TEXT_ROWS = 8;
|
|
3629
1120
|
|
|
3630
1121
|
var LongTextField = function LongTextField(_ref) {
|
|
3631
|
-
var _errors$actions,
|
|
1122
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
3632
1123
|
var name = _ref.name,
|
|
3633
1124
|
_ref$value = _ref.value,
|
|
3634
1125
|
value = _ref$value === void 0 ? "" : _ref$value,
|
|
@@ -3650,8 +1141,8 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3650
1141
|
useOnButtonPressed(initialFocusRef, function () {
|
|
3651
1142
|
return setShowPane(false);
|
|
3652
1143
|
});
|
|
3653
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3654
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1144
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1145
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || defaultSeparator;
|
|
3655
1146
|
var label = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder) || defaultLabel;
|
|
3656
1147
|
var rows = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.rows) || DEFAULT_LONG_TEXT_ROWS;
|
|
3657
1148
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, separator && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
@@ -3685,11 +1176,11 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3685
1176
|
style: "h3",
|
|
3686
1177
|
weight: "semibold"
|
|
3687
1178
|
}, label)), /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Body, null, /*#__PURE__*/React__default["default"].createElement(formik$1.Textarea, {
|
|
3688
|
-
required: true,
|
|
3689
|
-
className: "w-full",
|
|
3690
1179
|
name: name,
|
|
3691
1180
|
rows: rows,
|
|
3692
|
-
value: value
|
|
1181
|
+
value: value,
|
|
1182
|
+
required: true,
|
|
1183
|
+
className: "w-full"
|
|
3693
1184
|
})), /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Footer, {
|
|
3694
1185
|
className: "flex items-center space-x-2"
|
|
3695
1186
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
@@ -3708,7 +1199,7 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3708
1199
|
};
|
|
3709
1200
|
|
|
3710
1201
|
var CustomAction = function CustomAction(_ref) {
|
|
3711
|
-
var _errors$actions,
|
|
1202
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
3712
1203
|
var ActionComponent = _ref.ActionComponent,
|
|
3713
1204
|
name = _ref.name,
|
|
3714
1205
|
action = _ref.action,
|
|
@@ -3725,8 +1216,8 @@ var CustomAction = function CustomAction(_ref) {
|
|
|
3725
1216
|
useOnButtonPressed(initialFocusRef, function () {
|
|
3726
1217
|
return setShowPane(false);
|
|
3727
1218
|
});
|
|
3728
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3729
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1219
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1220
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.as");
|
|
3730
1221
|
var defaultLabel = selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder;
|
|
3731
1222
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
3732
1223
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
@@ -3775,8 +1266,19 @@ var CustomAction = function CustomAction(_ref) {
|
|
|
3775
1266
|
}))));
|
|
3776
1267
|
};
|
|
3777
1268
|
|
|
1269
|
+
var dayjs_min = {exports: {}};
|
|
1270
|
+
|
|
1271
|
+
dayjs_min.exports;
|
|
1272
|
+
|
|
1273
|
+
(function (module, exports) {
|
|
1274
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof b},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new b(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var b=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,f=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=O.p(f),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return O.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return O.s(e.$y,4,"0");case"M":return a+1;case"MM":return O.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return O.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return O.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return O.s(u,2,"0");case"s":return String(e.$s);case"ss":return O.s(e.$s,2,"0");case"SSS":return O.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=O.p(d),m=w(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return O.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:O.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),_=b.prototype;return w.prototype=_,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){_[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,b,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
|
|
1275
|
+
} (dayjs_min, dayjs_min.exports));
|
|
1276
|
+
|
|
1277
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
1278
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
1279
|
+
|
|
3778
1280
|
var DateField$1 = function DateField(_ref) {
|
|
3779
|
-
var _actions$value$index$, _selectedField$separa, _errors$actions,
|
|
1281
|
+
var _actions$value$index$, _selectedField$separa, _errors$actions, _touched$actions;
|
|
3780
1282
|
var name = _ref.name,
|
|
3781
1283
|
index = _ref.index,
|
|
3782
1284
|
selectedField = _ref.selectedField;
|
|
@@ -3792,8 +1294,8 @@ var DateField$1 = function DateField(_ref) {
|
|
|
3792
1294
|
setShowInput = _useState2[1];
|
|
3793
1295
|
var valueTerm = (_actions$value$index$ = actions.value[index].metadata) === null || _actions$value$index$ === void 0 ? void 0 : _actions$value$index$.value;
|
|
3794
1296
|
var label = valueTerm || i18next.t("neetoRules.form.selectDate").toLowerCase();
|
|
3795
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
3796
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
1297
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.to");
|
|
1298
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
3797
1299
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !selectedField.hideSeparator && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
3798
1300
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
3799
1301
|
"data-cy": "action-dropdown-seperator-text",
|
|
@@ -3805,7 +1307,7 @@ var DateField$1 = function DateField(_ref) {
|
|
|
3805
1307
|
name: "".concat(name, ".value"),
|
|
3806
1308
|
type: "date",
|
|
3807
1309
|
onChange: function onChange(date) {
|
|
3808
|
-
return setFieldValue("".concat(name, ".value"), date ?
|
|
1310
|
+
return setFieldValue("".concat(name, ".value"), date ? dayjs(date).format("YYYY-MM-DD") : "");
|
|
3809
1311
|
}
|
|
3810
1312
|
}), /*#__PURE__*/React__default["default"].createElement(neetoIcons.Check, {
|
|
3811
1313
|
className: "cursor-pointer",
|
|
@@ -3846,14 +1348,13 @@ var getActionOptions = function getActionOptions(currentAction, selectedActions)
|
|
|
3846
1348
|
};
|
|
3847
1349
|
var buildEmailValues = function buildEmailValues(emails) {
|
|
3848
1350
|
var emailRegex = EMAIL_REGEX;
|
|
3849
|
-
|
|
1351
|
+
return emails.map(function (email) {
|
|
3850
1352
|
return typeof email === "string" ? {
|
|
3851
1353
|
label: email,
|
|
3852
1354
|
value: email,
|
|
3853
1355
|
valid: emailRegex.test(email)
|
|
3854
1356
|
} : email;
|
|
3855
1357
|
});
|
|
3856
|
-
return formattedEmails;
|
|
3857
1358
|
};
|
|
3858
1359
|
var getDetailsByValue = function getDetailsByValue(value, options) {
|
|
3859
1360
|
return options.find(function (option) {
|
|
@@ -3883,7 +1384,7 @@ var getSlackChannelErrors = function getSlackChannelErrors(slackChannels, action
|
|
|
3883
1384
|
if (action !== null && action !== void 0 && (_action$metadata = action.metadata) !== null && _action$metadata !== void 0 && _action$metadata.value) {
|
|
3884
1385
|
var selectedOption = opts.find(function (op) {
|
|
3885
1386
|
var _action$metadata2;
|
|
3886
|
-
return (op === null || op === void 0 ? void 0 : op.value) === (action === null || action === void 0
|
|
1387
|
+
return (op === null || op === void 0 ? void 0 : op.value) === (action === null || action === void 0 || (_action$metadata2 = action.metadata) === null || _action$metadata2 === void 0 ? void 0 : _action$metadata2.value);
|
|
3887
1388
|
});
|
|
3888
1389
|
if (!selectedOption) {
|
|
3889
1390
|
return {
|
|
@@ -3900,7 +1401,7 @@ var getSlackChannelErrors = function getSlackChannelErrors(slackChannels, action
|
|
|
3900
1401
|
var Menu$9 = neetoui.Dropdown.Menu,
|
|
3901
1402
|
MenuItem$9 = neetoui.Dropdown.MenuItem;
|
|
3902
1403
|
var DropdownField$1 = function DropdownField(_ref) {
|
|
3903
|
-
var _actions$value$index$, _actions$value$index, _errors$actions,
|
|
1404
|
+
var _actions$value$index$, _actions$value$index, _errors$actions, _touched$actions, _selectedField$separa, _defaultSelectedOptio;
|
|
3904
1405
|
var dropdownOptions = _ref.dropdownOptions,
|
|
3905
1406
|
name = _ref.name,
|
|
3906
1407
|
index = _ref.index,
|
|
@@ -3928,8 +1429,8 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
3928
1429
|
setSearchTerm = _useState6[1];
|
|
3929
1430
|
var defaultValue = ((_actions$value$index$ = actions.value[index].metadata) === null || _actions$value$index$ === void 0 ? void 0 : _actions$value$index$.value) || ((_actions$value$index = actions.value[index]) === null || _actions$value$index === void 0 ? void 0 : _actions$value$index.value);
|
|
3930
1431
|
var searchedOptions = getSearchedOptions$3(dropdownOptions, searchTerm);
|
|
3931
|
-
var isValueSelected = defaultSelectedOption.label === defaultLabel && errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3932
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1432
|
+
var isValueSelected = defaultSelectedOption.label === defaultLabel && errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1433
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.to");
|
|
3933
1434
|
var handleClose = function handleClose() {
|
|
3934
1435
|
setIsActive(false);
|
|
3935
1436
|
setSearchTerm("");
|
|
@@ -3982,7 +1483,7 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
3982
1483
|
return !prevState;
|
|
3983
1484
|
});
|
|
3984
1485
|
}
|
|
3985
|
-
}, defaultSelectedOption === null || defaultSelectedOption === void 0
|
|
1486
|
+
}, defaultSelectedOption === null || defaultSelectedOption === void 0 || (_defaultSelectedOptio = defaultSelectedOption.label) === null || _defaultSelectedOptio === void 0 ? void 0 : _defaultSelectedOptio.toLowerCase()),
|
|
3986
1487
|
onClose: handleClose
|
|
3987
1488
|
}, /*#__PURE__*/React__default["default"].createElement(Menu$9, {
|
|
3988
1489
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -4038,14 +1539,14 @@ var EditorAction = function EditorAction(_ref) {
|
|
|
4038
1539
|
setFieldValue(name, editorData);
|
|
4039
1540
|
}, [debouncedValue]);
|
|
4040
1541
|
return /*#__PURE__*/React__default["default"].createElement(neetoEditor.FormikEditor, {
|
|
1542
|
+
label: label,
|
|
1543
|
+
name: name,
|
|
1544
|
+
variables: variables,
|
|
4041
1545
|
autoFocus: true,
|
|
4042
1546
|
hideSlashCommands: true,
|
|
4043
1547
|
addons: EDITOR_ADDONS,
|
|
4044
1548
|
className: "w-full",
|
|
4045
1549
|
"data-cy": "neeto-editor",
|
|
4046
|
-
label: label,
|
|
4047
|
-
name: name,
|
|
4048
|
-
variables: variables,
|
|
4049
1550
|
onChange: function onChange(value) {
|
|
4050
1551
|
return setEditorData(value);
|
|
4051
1552
|
}
|
|
@@ -4063,8 +1564,8 @@ var EmailIdFields = function EmailIdFields(_ref) {
|
|
|
4063
1564
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4064
1565
|
className: "mb-4"
|
|
4065
1566
|
}, /*#__PURE__*/React__default["default"].createElement(formik$1.MultiEmailInput, {
|
|
4066
|
-
label: i18next.t("neetoRules.common.emailIds"),
|
|
4067
1567
|
name: name,
|
|
1568
|
+
label: i18next.t("neetoRules.common.emailIds"),
|
|
4068
1569
|
placeholder: i18next.t("neetoRules.placeholders.emailField"),
|
|
4069
1570
|
ref: initialFocusRef,
|
|
4070
1571
|
value: formattedEmails,
|
|
@@ -4077,6 +1578,21 @@ var EmailIdFields = function EmailIdFields(_ref) {
|
|
|
4077
1578
|
}));
|
|
4078
1579
|
};
|
|
4079
1580
|
|
|
1581
|
+
function _extends() {
|
|
1582
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1583
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1584
|
+
var source = arguments[i];
|
|
1585
|
+
for (var key in source) {
|
|
1586
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1587
|
+
target[key] = source[key];
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
return target;
|
|
1592
|
+
};
|
|
1593
|
+
return _extends.apply(this, arguments);
|
|
1594
|
+
}
|
|
1595
|
+
|
|
4080
1596
|
var useDebouncedUpdate = function useDebouncedUpdate(value, setValue) {
|
|
4081
1597
|
var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;
|
|
4082
1598
|
var _useState = React.useState(value),
|
|
@@ -4119,7 +1635,7 @@ var InputField$2 = function InputField(_ref) {
|
|
|
4119
1635
|
};
|
|
4120
1636
|
|
|
4121
1637
|
var EmailFields = function EmailFields(_ref) {
|
|
4122
|
-
var _errors$actions,
|
|
1638
|
+
var _errors$actions, _touched$actions, _selectedField$separa, _action$metadata;
|
|
4123
1639
|
var _ref$isEmailIdField = _ref.isEmailIdField,
|
|
4124
1640
|
isEmailIdField = _ref$isEmailIdField === void 0 ? false : _ref$isEmailIdField,
|
|
4125
1641
|
name = _ref.name,
|
|
@@ -4139,8 +1655,8 @@ var EmailFields = function EmailFields(_ref) {
|
|
|
4139
1655
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4140
1656
|
return setShowPane(false);
|
|
4141
1657
|
});
|
|
4142
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4143
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1658
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1659
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.as");
|
|
4144
1660
|
var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.emailPlaceholder) || i18next.t("neetoRules.common.email");
|
|
4145
1661
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
4146
1662
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
@@ -4222,15 +1738,14 @@ var useCloseInputField = function useCloseInputField(ref, showInput, handler) {
|
|
|
4222
1738
|
};
|
|
4223
1739
|
};
|
|
4224
1740
|
React.useEffect(function () {
|
|
4225
|
-
if (showInput)
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
}
|
|
1741
|
+
if (!showInput) return;
|
|
1742
|
+
ref.current.focus();
|
|
1743
|
+
buttonPressed();
|
|
4229
1744
|
}, [showInput]);
|
|
4230
1745
|
};
|
|
4231
1746
|
|
|
4232
1747
|
var Input = function Input(_ref) {
|
|
4233
|
-
var _action$metadata, _selectedField$separa, _errors$actions,
|
|
1748
|
+
var _action$metadata, _selectedField$separa, _errors$actions, _touched$actions;
|
|
4234
1749
|
var name = _ref.name,
|
|
4235
1750
|
index = _ref.index,
|
|
4236
1751
|
selectedField = _ref.selectedField;
|
|
@@ -4249,8 +1764,8 @@ var Input = function Input(_ref) {
|
|
|
4249
1764
|
var action = actions.value[index];
|
|
4250
1765
|
var valueTerm = (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.value;
|
|
4251
1766
|
var label = valueTerm && neetoCist.isNotEmpty(valueTerm === null || valueTerm === void 0 ? void 0 : valueTerm.trim()) ? valueTerm : i18next.t("neetoRules.form.addValue");
|
|
4252
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
4253
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
1767
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.to");
|
|
1768
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
4254
1769
|
React.useEffect(function () {
|
|
4255
1770
|
setShowInput(false);
|
|
4256
1771
|
}, [action.name]);
|
|
@@ -4374,9 +1889,9 @@ var InlineInput = /*#__PURE__*/React__default["default"].forwardRef(function (pr
|
|
|
4374
1889
|
tooltipProps: LIST_FIELD_TOOLTIP_PROPS.save,
|
|
4375
1890
|
onClick: onSubmit
|
|
4376
1891
|
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
1892
|
+
ref: ref,
|
|
4377
1893
|
"data-cy": "inline-input-cancel-button",
|
|
4378
1894
|
icon: neetoIcons.Close,
|
|
4379
|
-
ref: ref,
|
|
4380
1895
|
style: "text",
|
|
4381
1896
|
tooltipProps: LIST_FIELD_TOOLTIP_PROPS.cancel,
|
|
4382
1897
|
onClick: handleCancel
|
|
@@ -4386,7 +1901,7 @@ var InlineInput = /*#__PURE__*/React__default["default"].forwardRef(function (pr
|
|
|
4386
1901
|
InlineInput.displayName = "InlineInput";
|
|
4387
1902
|
|
|
4388
1903
|
var ListField = function ListField(_ref) {
|
|
4389
|
-
var _errors$actions,
|
|
1904
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
4390
1905
|
var name = _ref.name,
|
|
4391
1906
|
_ref$values = _ref.values,
|
|
4392
1907
|
values = _ref$values === void 0 ? [] : _ref$values,
|
|
@@ -4407,8 +1922,8 @@ var ListField = function ListField(_ref) {
|
|
|
4407
1922
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4408
1923
|
return setShowPane(false);
|
|
4409
1924
|
});
|
|
4410
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4411
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1925
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1926
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.to");
|
|
4412
1927
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
4413
1928
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
4414
1929
|
"data-cy": "list-action-separator-text",
|
|
@@ -4446,7 +1961,7 @@ var ListField = function ListField(_ref) {
|
|
|
4446
1961
|
}, function (arrayHelper) {
|
|
4447
1962
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, values.map(function (item, index) {
|
|
4448
1963
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4449
|
-
className: "flex flex-wrap justify-between border border-dashed
|
|
1964
|
+
className: "neeto-ui-bg-white flex flex-wrap justify-between border border-dashed px-2 py-1",
|
|
4450
1965
|
key: "".concat(item, ".").concat(index)
|
|
4451
1966
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
4452
1967
|
className: "w-4/5 overflow-x-auto",
|
|
@@ -4463,8 +1978,8 @@ var ListField = function ListField(_ref) {
|
|
|
4463
1978
|
}
|
|
4464
1979
|
}));
|
|
4465
1980
|
}), /*#__PURE__*/React__default["default"].createElement(formik.ErrorMessage, {
|
|
4466
|
-
|
|
4467
|
-
|
|
1981
|
+
name: name,
|
|
1982
|
+
className: "w-full"
|
|
4468
1983
|
}, function (message) {
|
|
4469
1984
|
return /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
4470
1985
|
className: "neeto-ui-text-error-500 neeto-ui-text-gray-700 mt-1",
|
|
@@ -4509,7 +2024,7 @@ var ListField = function ListField(_ref) {
|
|
|
4509
2024
|
var Menu$8 = neetoui.Dropdown.Menu,
|
|
4510
2025
|
MenuItem$8 = neetoui.Dropdown.MenuItem;
|
|
4511
2026
|
var MultiSelect$1 = function MultiSelect(_ref) {
|
|
4512
|
-
var _selectedField$placeh, _selectedField$separa, _errors$actions,
|
|
2027
|
+
var _selectedField$placeh, _selectedField$separa, _errors$actions, _touched$actions;
|
|
4513
2028
|
var _ref$values = _ref.values,
|
|
4514
2029
|
values = _ref$values === void 0 ? [] : _ref$values,
|
|
4515
2030
|
_ref$dropDownOptions = _ref.dropDownOptions,
|
|
@@ -4536,10 +2051,10 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4536
2051
|
});
|
|
4537
2052
|
}, [values, dropDownOptions]);
|
|
4538
2053
|
var selectedOptions = getSelectedOptions(allOptions);
|
|
4539
|
-
var defaultLabel = (selectedField === null || selectedField === void 0
|
|
2054
|
+
var defaultLabel = (selectedField === null || selectedField === void 0 || (_selectedField$placeh = selectedField.placeholder) === null || _selectedField$placeh === void 0 ? void 0 : _selectedField$placeh.toLowerCase()) || i18next.t("neetoRules.form.selectValues").toLowerCase();
|
|
4540
2055
|
var searchedOptions = getSearchedOptions$3(dropDownOptions, searchTerm);
|
|
4541
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
4542
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
2056
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.to");
|
|
2057
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
4543
2058
|
var handleSelectOption = function handleSelectOption(option) {
|
|
4544
2059
|
var options = values.includes(option.value) ? ramda.without([option.value], values) : ramda.append(option.value, values);
|
|
4545
2060
|
setFieldValue(name, options);
|
|
@@ -4565,7 +2080,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4565
2080
|
className: "flex flex-wrap",
|
|
4566
2081
|
key: idx
|
|
4567
2082
|
}, !!idx && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
4568
|
-
className: "neeto-ui-text-gray-700
|
|
2083
|
+
className: "neeto-ui-text-gray-700 mr-1 mt-1",
|
|
4569
2084
|
style: "h5",
|
|
4570
2085
|
weight: "normal",
|
|
4571
2086
|
onClick: function onClick(e) {
|
|
@@ -4577,7 +2092,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4577
2092
|
"data-cy": "multi-select-action-button",
|
|
4578
2093
|
style: "h5",
|
|
4579
2094
|
weight: "semibold",
|
|
4580
|
-
className: classNames__default["default"]("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800
|
|
2095
|
+
className: classNames__default["default"]("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mr-1 mt-1 cursor-pointer underline", {
|
|
4581
2096
|
"neeto-ui-text-primary-800": activeOption === (option === null || option === void 0 ? void 0 : option.value)
|
|
4582
2097
|
}),
|
|
4583
2098
|
onClick: function onClick() {
|
|
@@ -4631,7 +2146,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4631
2146
|
};
|
|
4632
2147
|
|
|
4633
2148
|
var NoteField = function NoteField(_ref) {
|
|
4634
|
-
var _errors$actions,
|
|
2149
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
4635
2150
|
var name = _ref.name,
|
|
4636
2151
|
_ref$value = _ref.value,
|
|
4637
2152
|
value = _ref$value === void 0 ? "" : _ref$value,
|
|
@@ -4648,8 +2163,8 @@ var NoteField = function NoteField(_ref) {
|
|
|
4648
2163
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4649
2164
|
return setShowPane(false);
|
|
4650
2165
|
});
|
|
4651
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4652
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
2166
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
2167
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.as");
|
|
4653
2168
|
var variables = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.variables) || [];
|
|
4654
2169
|
var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder) || i18next.t("neetoRules.form.note");
|
|
4655
2170
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
@@ -4714,55 +2229,55 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4714
2229
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.emailToIds) {
|
|
4715
2230
|
var _action$metadata;
|
|
4716
2231
|
return /*#__PURE__*/React__default["default"].createElement(EmailFields, {
|
|
4717
|
-
isEmailIdField: true,
|
|
4718
2232
|
action: action,
|
|
4719
|
-
emails: (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.emails,
|
|
4720
2233
|
index: index,
|
|
4721
|
-
key: name,
|
|
4722
2234
|
name: name,
|
|
4723
|
-
selectedField: selectedField
|
|
2235
|
+
selectedField: selectedField,
|
|
2236
|
+
isEmailIdField: true,
|
|
2237
|
+
emails: (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.emails,
|
|
2238
|
+
key: name
|
|
4724
2239
|
});
|
|
4725
2240
|
}
|
|
4726
2241
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.email) {
|
|
4727
2242
|
return /*#__PURE__*/React__default["default"].createElement(EmailFields, {
|
|
4728
2243
|
action: action,
|
|
4729
2244
|
index: index,
|
|
4730
|
-
key: name,
|
|
4731
2245
|
name: name,
|
|
4732
|
-
selectedField: selectedField
|
|
2246
|
+
selectedField: selectedField,
|
|
2247
|
+
key: name
|
|
4733
2248
|
});
|
|
4734
2249
|
}
|
|
4735
2250
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.emailTo) {
|
|
4736
2251
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(DropdownField$1, {
|
|
4737
|
-
dropdownOptions: options,
|
|
4738
2252
|
index: index,
|
|
2253
|
+
selectedField: selectedField,
|
|
2254
|
+
dropdownOptions: options,
|
|
4739
2255
|
key: "".concat(name, ".value"),
|
|
4740
|
-
name: "".concat(name, ".value")
|
|
4741
|
-
selectedField: selectedField
|
|
2256
|
+
name: "".concat(name, ".value")
|
|
4742
2257
|
}), /*#__PURE__*/React__default["default"].createElement(EmailFields, {
|
|
4743
2258
|
action: action,
|
|
4744
2259
|
index: index,
|
|
4745
|
-
key: name,
|
|
4746
2260
|
name: name,
|
|
4747
|
-
selectedField: selectedField
|
|
2261
|
+
selectedField: selectedField,
|
|
2262
|
+
key: name
|
|
4748
2263
|
}));
|
|
4749
2264
|
}
|
|
4750
2265
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.dropdown) {
|
|
4751
2266
|
return /*#__PURE__*/React__default["default"].createElement(DropdownField$1, {
|
|
4752
|
-
dropdownOptions: options,
|
|
4753
2267
|
index: index,
|
|
2268
|
+
selectedField: selectedField,
|
|
2269
|
+
dropdownOptions: options,
|
|
4754
2270
|
key: name,
|
|
4755
|
-
name: "".concat(name, ".value")
|
|
4756
|
-
selectedField: selectedField
|
|
2271
|
+
name: "".concat(name, ".value")
|
|
4757
2272
|
});
|
|
4758
2273
|
}
|
|
4759
2274
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.note) {
|
|
4760
2275
|
var _action$metadata2;
|
|
4761
2276
|
return /*#__PURE__*/React__default["default"].createElement(NoteField, {
|
|
4762
2277
|
index: index,
|
|
2278
|
+
selectedField: selectedField,
|
|
4763
2279
|
key: name,
|
|
4764
2280
|
name: "".concat(name, ".value"),
|
|
4765
|
-
selectedField: selectedField,
|
|
4766
2281
|
value: (_action$metadata2 = action.metadata) === null || _action$metadata2 === void 0 ? void 0 : _action$metadata2.value
|
|
4767
2282
|
});
|
|
4768
2283
|
}
|
|
@@ -4770,20 +2285,20 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4770
2285
|
var _action$metadata3;
|
|
4771
2286
|
return /*#__PURE__*/React__default["default"].createElement(ListField, {
|
|
4772
2287
|
index: index,
|
|
2288
|
+
selectedField: selectedField,
|
|
4773
2289
|
key: name,
|
|
4774
2290
|
name: "".concat(name, ".value"),
|
|
4775
|
-
selectedField: selectedField,
|
|
4776
2291
|
values: (_action$metadata3 = action.metadata) === null || _action$metadata3 === void 0 ? void 0 : _action$metadata3.value
|
|
4777
2292
|
});
|
|
4778
2293
|
}
|
|
4779
2294
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.multiSelect) {
|
|
4780
2295
|
var _action$metadata4;
|
|
4781
2296
|
return /*#__PURE__*/React__default["default"].createElement(MultiSelect$1, {
|
|
4782
|
-
dropDownOptions: options,
|
|
4783
2297
|
index: index,
|
|
2298
|
+
selectedField: selectedField,
|
|
2299
|
+
dropDownOptions: options,
|
|
4784
2300
|
key: name,
|
|
4785
2301
|
name: "".concat(name, ".value"),
|
|
4786
|
-
selectedField: selectedField,
|
|
4787
2302
|
values: (_action$metadata4 = action.metadata) === null || _action$metadata4 === void 0 ? void 0 : _action$metadata4.value
|
|
4788
2303
|
});
|
|
4789
2304
|
}
|
|
@@ -4804,12 +2319,12 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4804
2319
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.longText || (selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.textarea) {
|
|
4805
2320
|
var _action$metadata5;
|
|
4806
2321
|
return /*#__PURE__*/React__default["default"].createElement(LongTextField, {
|
|
2322
|
+
index: index,
|
|
2323
|
+
selectedField: selectedField,
|
|
4807
2324
|
defaultLabel: t("neetoRules.labels.body"),
|
|
4808
2325
|
defaultSeparator: t("neetoRules.common.as"),
|
|
4809
|
-
index: index,
|
|
4810
2326
|
key: name,
|
|
4811
2327
|
name: "".concat(name, ".value"),
|
|
4812
|
-
selectedField: selectedField,
|
|
4813
2328
|
value: (_action$metadata5 = action.metadata) === null || _action$metadata5 === void 0 ? void 0 : _action$metadata5.value
|
|
4814
2329
|
});
|
|
4815
2330
|
}
|
|
@@ -4830,7 +2345,7 @@ var ActionSubItem = /*#__PURE__*/React.memo(ActionSubItems);
|
|
|
4830
2345
|
var Menu$7 = neetoui.Dropdown.Menu,
|
|
4831
2346
|
MenuItem$7 = neetoui.Dropdown.MenuItem;
|
|
4832
2347
|
var ActionItem = function ActionItem(_ref) {
|
|
4833
|
-
var _errors$actions,
|
|
2348
|
+
var _errors$actions, _touched$actions, _selectedOption$label;
|
|
4834
2349
|
var name = _ref.name,
|
|
4835
2350
|
action = _ref.action,
|
|
4836
2351
|
index = _ref.index,
|
|
@@ -4869,7 +2384,7 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4869
2384
|
return getFieldDetails$1(action.name, actionOptions);
|
|
4870
2385
|
}, [action, actionOptions]);
|
|
4871
2386
|
var searchedOptions = getSearchedOptions$3(actionOptions, searchTerm);
|
|
4872
|
-
var isActionSelected = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) === i18next.t("neetoRules.form.doThis") && errors.actions && touched.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
2387
|
+
var isActionSelected = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) === i18next.t("neetoRules.form.doThis") && errors.actions && touched.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
4873
2388
|
var handleSelectOption = function handleSelectOption(option) {
|
|
4874
2389
|
setFieldValue("".concat(name, ".name"), option.value);
|
|
4875
2390
|
setFieldValue("".concat(name, ".metadata"), {});
|
|
@@ -4929,7 +2444,7 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4929
2444
|
return !prevState;
|
|
4930
2445
|
});
|
|
4931
2446
|
}
|
|
4932
|
-
}, selectedOption === null || selectedOption === void 0
|
|
2447
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
4933
2448
|
onClose: handleClose
|
|
4934
2449
|
}, /*#__PURE__*/React__default["default"].createElement(Menu$7, {
|
|
4935
2450
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -4964,9 +2479,9 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4964
2479
|
}, i18next.t("neetoRules.common.noOptions")))), /*#__PURE__*/React__default["default"].createElement(ActionSubItem, {
|
|
4965
2480
|
action: action,
|
|
4966
2481
|
index: index,
|
|
2482
|
+
selectedField: selectedField,
|
|
4967
2483
|
name: "".concat(name, ".metadata"),
|
|
4968
|
-
options: getSelectedFieldOptions()
|
|
4969
|
-
selectedField: selectedField
|
|
2484
|
+
options: getSelectedFieldOptions()
|
|
4970
2485
|
}));
|
|
4971
2486
|
};
|
|
4972
2487
|
var ActionItem$1 = /*#__PURE__*/React.memo(ActionItem);
|
|
@@ -5027,10 +2542,10 @@ var Actions = function Actions(_ref) {
|
|
|
5027
2542
|
action: action,
|
|
5028
2543
|
elementProps: elementProps,
|
|
5029
2544
|
index: index,
|
|
5030
|
-
|
|
5031
|
-
parentName: name,
|
|
2545
|
+
onSelectAction: onSelectAction,
|
|
5032
2546
|
selectedActionOptions: selectedActionOptions,
|
|
5033
|
-
|
|
2547
|
+
name: "".concat(name, ".value.").concat(index),
|
|
2548
|
+
parentName: name
|
|
5034
2549
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5035
2550
|
className: "-mx-1 flex flex-wrap"
|
|
5036
2551
|
}, handleSlackChannelRefresh && action.name === "message_to_slack" && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
@@ -5096,13 +2611,12 @@ var getSearchedOptions$2 = function getSearchedOptions(dropDownOptions, searchTe
|
|
|
5096
2611
|
});
|
|
5097
2612
|
};
|
|
5098
2613
|
var getAllOptions = function getAllOptions(options) {
|
|
5099
|
-
|
|
2614
|
+
return Array.isArray(options) ? options.map(function (option) {
|
|
5100
2615
|
return {
|
|
5101
2616
|
label: option,
|
|
5102
2617
|
value: option
|
|
5103
2618
|
};
|
|
5104
2619
|
}) : [];
|
|
5105
|
-
return allOptions;
|
|
5106
2620
|
};
|
|
5107
2621
|
|
|
5108
2622
|
var Menu$6 = neetoui.Dropdown.Menu,
|
|
@@ -5161,7 +2675,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
5161
2675
|
return !prevState;
|
|
5162
2676
|
});
|
|
5163
2677
|
}
|
|
5164
|
-
}, selectedOption === null || selectedOption === void 0
|
|
2678
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
5165
2679
|
onClose: handleClose
|
|
5166
2680
|
}, /*#__PURE__*/React__default["default"].createElement(Menu$6, {
|
|
5167
2681
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -5204,7 +2718,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
5204
2718
|
var Menu$5 = neetoui.Dropdown.Menu,
|
|
5205
2719
|
MenuItem$5 = neetoui.Dropdown.MenuItem;
|
|
5206
2720
|
var Dropdown = function Dropdown(_ref) {
|
|
5207
|
-
var _conditions$value$ind, _errors$conditions,
|
|
2721
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions, _defaultSelectedOptio;
|
|
5208
2722
|
var name = _ref.name,
|
|
5209
2723
|
options = _ref.options,
|
|
5210
2724
|
index = _ref.index;
|
|
@@ -5231,7 +2745,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5231
2745
|
setSearchTerm = _useState6[1];
|
|
5232
2746
|
var defaultValue = (_conditions$value$ind = conditions.value[index].metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.value;
|
|
5233
2747
|
var searchedOptions = getSearchedOptions$2(options, searchTerm);
|
|
5234
|
-
var isValueSelected = (defaultSelectedOption === null || defaultSelectedOption === void 0 ? void 0 : defaultSelectedOption.label) === defaultLabel && errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
2748
|
+
var isValueSelected = (defaultSelectedOption === null || defaultSelectedOption === void 0 ? void 0 : defaultSelectedOption.label) === defaultLabel && errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && ramda.isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
5235
2749
|
var handleClose = function handleClose() {
|
|
5236
2750
|
setIsActive(false);
|
|
5237
2751
|
setSearchTerm("");
|
|
@@ -5278,7 +2792,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5278
2792
|
return !prevState;
|
|
5279
2793
|
});
|
|
5280
2794
|
}
|
|
5281
|
-
}, defaultSelectedOption === null || defaultSelectedOption === void 0
|
|
2795
|
+
}, defaultSelectedOption === null || defaultSelectedOption === void 0 || (_defaultSelectedOptio = defaultSelectedOption.label) === null || _defaultSelectedOptio === void 0 ? void 0 : _defaultSelectedOptio.toLowerCase()),
|
|
5282
2796
|
onClose: handleClose
|
|
5283
2797
|
}, /*#__PURE__*/React__default["default"].createElement(Menu$5, {
|
|
5284
2798
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -5317,7 +2831,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5317
2831
|
};
|
|
5318
2832
|
|
|
5319
2833
|
var InputField$1 = function InputField(_ref) {
|
|
5320
|
-
var _condition$metadata,
|
|
2834
|
+
var _condition$metadata, _errors$conditions, _touched$conditions;
|
|
5321
2835
|
var name = _ref.name,
|
|
5322
2836
|
index = _ref.index,
|
|
5323
2837
|
placeholder = _ref.placeholder;
|
|
@@ -5334,9 +2848,9 @@ var InputField$1 = function InputField(_ref) {
|
|
|
5334
2848
|
return setShowInput(false);
|
|
5335
2849
|
});
|
|
5336
2850
|
var condition = conditions.value[index];
|
|
5337
|
-
var valueTerm = (_condition$metadata = condition.metadata) === null || _condition$metadata === void 0
|
|
2851
|
+
var valueTerm = (_condition$metadata = condition.metadata) === null || _condition$metadata === void 0 || (_condition$metadata = _condition$metadata.value) === null || _condition$metadata === void 0 ? void 0 : _condition$metadata.toString();
|
|
5338
2852
|
var label = valueTerm && valueTerm !== null && valueTerm !== void 0 && valueTerm.trim().length ? valueTerm : i18next.t("neetoRules.form.addValue");
|
|
5339
|
-
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
2853
|
+
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && ramda.isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
5340
2854
|
React.useEffect(function () {
|
|
5341
2855
|
setShowInput(false);
|
|
5342
2856
|
}, [condition.verb]);
|
|
@@ -5370,7 +2884,7 @@ var InputField$1 = function InputField(_ref) {
|
|
|
5370
2884
|
var Menu$4 = neetoui.Dropdown.Menu,
|
|
5371
2885
|
MenuItem$4 = neetoui.Dropdown.MenuItem;
|
|
5372
2886
|
var MultiSelect = function MultiSelect(_ref) {
|
|
5373
|
-
var _conditions$value$ind,
|
|
2887
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5374
2888
|
var name = _ref.name,
|
|
5375
2889
|
dropDownOptions = _ref.dropDownOptions,
|
|
5376
2890
|
index = _ref.index;
|
|
@@ -5388,14 +2902,14 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5388
2902
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
5389
2903
|
searchTerm = _useState4[0],
|
|
5390
2904
|
setSearchTerm = _useState4[1];
|
|
5391
|
-
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0
|
|
2905
|
+
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0 || (_conditions$value$ind = _conditions$value$ind.metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.values;
|
|
5392
2906
|
var selectedOptions = values || [];
|
|
5393
2907
|
var defaultLabel = i18next.t("neetoRules.form.selectValues");
|
|
5394
2908
|
var options = dropDownOptions === null || dropDownOptions === void 0 ? void 0 : dropDownOptions.filter(function (option) {
|
|
5395
2909
|
return selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.includes(option.value);
|
|
5396
2910
|
});
|
|
5397
2911
|
var searchedOptions = getSearchedOptions$2(dropDownOptions, searchTerm);
|
|
5398
|
-
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
2912
|
+
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && ramda.isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
5399
2913
|
var handleMultiSelectOption = function handleMultiSelectOption(value) {
|
|
5400
2914
|
var options = selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.includes(value) ? ramda.without([value], selectedOptions) : ramda.append(value, selectedOptions);
|
|
5401
2915
|
setFieldValue(name, options);
|
|
@@ -5416,21 +2930,21 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5416
2930
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
5417
2931
|
key: idx
|
|
5418
2932
|
}, !!idx && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
5419
|
-
className: "neeto-ui-text-gray-700
|
|
2933
|
+
className: "neeto-ui-text-gray-700 mr-1 mt-1",
|
|
5420
2934
|
style: "h5",
|
|
5421
2935
|
weight: "normal"
|
|
5422
2936
|
}, i18next.t("neetoRules.common.or")), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
5423
2937
|
"data-cy": "condition-value-multi-select-field",
|
|
5424
2938
|
style: "h5",
|
|
5425
2939
|
weight: "semibold",
|
|
5426
|
-
className: classNames__default["default"]("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800
|
|
2940
|
+
className: classNames__default["default"]("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mr-1 mt-1 cursor-pointer underline", {
|
|
5427
2941
|
"neeto-ui-text-primary-800": activeOption === option.value
|
|
5428
2942
|
}),
|
|
5429
2943
|
onClick: function onClick() {
|
|
5430
2944
|
setTouched(ramda.assocPath(["conditions", "value", index], true, touched));
|
|
5431
2945
|
setActiveOption(activeOption ? null : option.value);
|
|
5432
2946
|
}
|
|
5433
|
-
}, option === null || option === void 0
|
|
2947
|
+
}, option === null || option === void 0 || (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.toLowerCase()));
|
|
5434
2948
|
})) : /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
5435
2949
|
"data-cy": "condition-value-multi-select-field",
|
|
5436
2950
|
style: "h5",
|
|
@@ -5479,7 +2993,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5479
2993
|
|
|
5480
2994
|
var _excluded$6 = ["name", "index"];
|
|
5481
2995
|
var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
5482
|
-
var _conditions$value$ind,
|
|
2996
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5483
2997
|
var name = _ref.name,
|
|
5484
2998
|
index = _ref.index,
|
|
5485
2999
|
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
@@ -5497,10 +3011,10 @@ var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
|
5497
3011
|
useOnButtonPressed(initialFocusRef, function () {
|
|
5498
3012
|
return setShowPane(false);
|
|
5499
3013
|
});
|
|
5500
|
-
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0
|
|
3014
|
+
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0 || (_conditions$value$ind = _conditions$value$ind.metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.values;
|
|
5501
3015
|
var allOptions = getAllOptions(values);
|
|
5502
3016
|
var defaultLabel = i18next.t("neetoRules.form.selectValues");
|
|
5503
|
-
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3017
|
+
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && ramda.isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
5504
3018
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, ramda.isEmpty(allOptions) && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
5505
3019
|
"data-cy": "condition-value-multi-select-create-button",
|
|
5506
3020
|
style: "h5",
|
|
@@ -5572,8 +3086,388 @@ var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
|
5572
3086
|
}))));
|
|
5573
3087
|
};
|
|
5574
3088
|
|
|
3089
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3090
|
+
try {
|
|
3091
|
+
var info = gen[key](arg);
|
|
3092
|
+
var value = info.value;
|
|
3093
|
+
} catch (error) {
|
|
3094
|
+
reject(error);
|
|
3095
|
+
return;
|
|
3096
|
+
}
|
|
3097
|
+
if (info.done) {
|
|
3098
|
+
resolve(value);
|
|
3099
|
+
} else {
|
|
3100
|
+
Promise.resolve(value).then(_next, _throw);
|
|
3101
|
+
}
|
|
3102
|
+
}
|
|
3103
|
+
function _asyncToGenerator(fn) {
|
|
3104
|
+
return function () {
|
|
3105
|
+
var self = this,
|
|
3106
|
+
args = arguments;
|
|
3107
|
+
return new Promise(function (resolve, reject) {
|
|
3108
|
+
var gen = fn.apply(self, args);
|
|
3109
|
+
function _next(value) {
|
|
3110
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
3111
|
+
}
|
|
3112
|
+
function _throw(err) {
|
|
3113
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
3114
|
+
}
|
|
3115
|
+
_next(undefined);
|
|
3116
|
+
});
|
|
3117
|
+
};
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
var regeneratorRuntime$1 = {exports: {}};
|
|
3121
|
+
|
|
3122
|
+
var _typeof = {exports: {}};
|
|
3123
|
+
|
|
3124
|
+
_typeof.exports;
|
|
3125
|
+
|
|
3126
|
+
(function (module) {
|
|
3127
|
+
function _typeof(obj) {
|
|
3128
|
+
"@babel/helpers - typeof";
|
|
3129
|
+
|
|
3130
|
+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
3131
|
+
return typeof obj;
|
|
3132
|
+
} : function (obj) {
|
|
3133
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
3134
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
3135
|
+
}
|
|
3136
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3137
|
+
} (_typeof));
|
|
3138
|
+
|
|
3139
|
+
var _typeofExports = _typeof.exports;
|
|
3140
|
+
|
|
3141
|
+
regeneratorRuntime$1.exports;
|
|
3142
|
+
|
|
3143
|
+
(function (module) {
|
|
3144
|
+
var _typeof = _typeofExports["default"];
|
|
3145
|
+
function _regeneratorRuntime() {
|
|
3146
|
+
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
3147
|
+
return exports;
|
|
3148
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3149
|
+
var exports = {},
|
|
3150
|
+
Op = Object.prototype,
|
|
3151
|
+
hasOwn = Op.hasOwnProperty,
|
|
3152
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
3153
|
+
obj[key] = desc.value;
|
|
3154
|
+
},
|
|
3155
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
3156
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
3157
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
3158
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
3159
|
+
function define(obj, key, value) {
|
|
3160
|
+
return Object.defineProperty(obj, key, {
|
|
3161
|
+
value: value,
|
|
3162
|
+
enumerable: !0,
|
|
3163
|
+
configurable: !0,
|
|
3164
|
+
writable: !0
|
|
3165
|
+
}), obj[key];
|
|
3166
|
+
}
|
|
3167
|
+
try {
|
|
3168
|
+
define({}, "");
|
|
3169
|
+
} catch (err) {
|
|
3170
|
+
define = function define(obj, key, value) {
|
|
3171
|
+
return obj[key] = value;
|
|
3172
|
+
};
|
|
3173
|
+
}
|
|
3174
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
3175
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
3176
|
+
generator = Object.create(protoGenerator.prototype),
|
|
3177
|
+
context = new Context(tryLocsList || []);
|
|
3178
|
+
return defineProperty(generator, "_invoke", {
|
|
3179
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
3180
|
+
}), generator;
|
|
3181
|
+
}
|
|
3182
|
+
function tryCatch(fn, obj, arg) {
|
|
3183
|
+
try {
|
|
3184
|
+
return {
|
|
3185
|
+
type: "normal",
|
|
3186
|
+
arg: fn.call(obj, arg)
|
|
3187
|
+
};
|
|
3188
|
+
} catch (err) {
|
|
3189
|
+
return {
|
|
3190
|
+
type: "throw",
|
|
3191
|
+
arg: err
|
|
3192
|
+
};
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
exports.wrap = wrap;
|
|
3196
|
+
var ContinueSentinel = {};
|
|
3197
|
+
function Generator() {}
|
|
3198
|
+
function GeneratorFunction() {}
|
|
3199
|
+
function GeneratorFunctionPrototype() {}
|
|
3200
|
+
var IteratorPrototype = {};
|
|
3201
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
3202
|
+
return this;
|
|
3203
|
+
});
|
|
3204
|
+
var getProto = Object.getPrototypeOf,
|
|
3205
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
3206
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
3207
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
3208
|
+
function defineIteratorMethods(prototype) {
|
|
3209
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
3210
|
+
define(prototype, method, function (arg) {
|
|
3211
|
+
return this._invoke(method, arg);
|
|
3212
|
+
});
|
|
3213
|
+
});
|
|
3214
|
+
}
|
|
3215
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
3216
|
+
function invoke(method, arg, resolve, reject) {
|
|
3217
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
3218
|
+
if ("throw" !== record.type) {
|
|
3219
|
+
var result = record.arg,
|
|
3220
|
+
value = result.value;
|
|
3221
|
+
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
3222
|
+
invoke("next", value, resolve, reject);
|
|
3223
|
+
}, function (err) {
|
|
3224
|
+
invoke("throw", err, resolve, reject);
|
|
3225
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
3226
|
+
result.value = unwrapped, resolve(result);
|
|
3227
|
+
}, function (error) {
|
|
3228
|
+
return invoke("throw", error, resolve, reject);
|
|
3229
|
+
});
|
|
3230
|
+
}
|
|
3231
|
+
reject(record.arg);
|
|
3232
|
+
}
|
|
3233
|
+
var previousPromise;
|
|
3234
|
+
defineProperty(this, "_invoke", {
|
|
3235
|
+
value: function value(method, arg) {
|
|
3236
|
+
function callInvokeWithMethodAndArg() {
|
|
3237
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
3238
|
+
invoke(method, arg, resolve, reject);
|
|
3239
|
+
});
|
|
3240
|
+
}
|
|
3241
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
3242
|
+
}
|
|
3243
|
+
});
|
|
3244
|
+
}
|
|
3245
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
3246
|
+
var state = "suspendedStart";
|
|
3247
|
+
return function (method, arg) {
|
|
3248
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
3249
|
+
if ("completed" === state) {
|
|
3250
|
+
if ("throw" === method) throw arg;
|
|
3251
|
+
return doneResult();
|
|
3252
|
+
}
|
|
3253
|
+
for (context.method = method, context.arg = arg;;) {
|
|
3254
|
+
var delegate = context.delegate;
|
|
3255
|
+
if (delegate) {
|
|
3256
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
3257
|
+
if (delegateResult) {
|
|
3258
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
3259
|
+
return delegateResult;
|
|
3260
|
+
}
|
|
3261
|
+
}
|
|
3262
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
3263
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
3264
|
+
context.dispatchException(context.arg);
|
|
3265
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
3266
|
+
state = "executing";
|
|
3267
|
+
var record = tryCatch(innerFn, self, context);
|
|
3268
|
+
if ("normal" === record.type) {
|
|
3269
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
3270
|
+
return {
|
|
3271
|
+
value: record.arg,
|
|
3272
|
+
done: context.done
|
|
3273
|
+
};
|
|
3274
|
+
}
|
|
3275
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
3276
|
+
}
|
|
3277
|
+
};
|
|
3278
|
+
}
|
|
3279
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
3280
|
+
var methodName = context.method,
|
|
3281
|
+
method = delegate.iterator[methodName];
|
|
3282
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
3283
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
3284
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
3285
|
+
var info = record.arg;
|
|
3286
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
3287
|
+
}
|
|
3288
|
+
function pushTryEntry(locs) {
|
|
3289
|
+
var entry = {
|
|
3290
|
+
tryLoc: locs[0]
|
|
3291
|
+
};
|
|
3292
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
3293
|
+
}
|
|
3294
|
+
function resetTryEntry(entry) {
|
|
3295
|
+
var record = entry.completion || {};
|
|
3296
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
3297
|
+
}
|
|
3298
|
+
function Context(tryLocsList) {
|
|
3299
|
+
this.tryEntries = [{
|
|
3300
|
+
tryLoc: "root"
|
|
3301
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
3302
|
+
}
|
|
3303
|
+
function values(iterable) {
|
|
3304
|
+
if (iterable) {
|
|
3305
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
3306
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
3307
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
3308
|
+
if (!isNaN(iterable.length)) {
|
|
3309
|
+
var i = -1,
|
|
3310
|
+
next = function next() {
|
|
3311
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
3312
|
+
return next.value = undefined, next.done = !0, next;
|
|
3313
|
+
};
|
|
3314
|
+
return next.next = next;
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
return {
|
|
3318
|
+
next: doneResult
|
|
3319
|
+
};
|
|
3320
|
+
}
|
|
3321
|
+
function doneResult() {
|
|
3322
|
+
return {
|
|
3323
|
+
value: undefined,
|
|
3324
|
+
done: !0
|
|
3325
|
+
};
|
|
3326
|
+
}
|
|
3327
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
3328
|
+
value: GeneratorFunctionPrototype,
|
|
3329
|
+
configurable: !0
|
|
3330
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
3331
|
+
value: GeneratorFunction,
|
|
3332
|
+
configurable: !0
|
|
3333
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
3334
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
3335
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
3336
|
+
}, exports.mark = function (genFun) {
|
|
3337
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
3338
|
+
}, exports.awrap = function (arg) {
|
|
3339
|
+
return {
|
|
3340
|
+
__await: arg
|
|
3341
|
+
};
|
|
3342
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
3343
|
+
return this;
|
|
3344
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
3345
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
3346
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
3347
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
3348
|
+
return result.done ? result.value : iter.next();
|
|
3349
|
+
});
|
|
3350
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
3351
|
+
return this;
|
|
3352
|
+
}), define(Gp, "toString", function () {
|
|
3353
|
+
return "[object Generator]";
|
|
3354
|
+
}), exports.keys = function (val) {
|
|
3355
|
+
var object = Object(val),
|
|
3356
|
+
keys = [];
|
|
3357
|
+
for (var key in object) keys.push(key);
|
|
3358
|
+
return keys.reverse(), function next() {
|
|
3359
|
+
for (; keys.length;) {
|
|
3360
|
+
var key = keys.pop();
|
|
3361
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
3362
|
+
}
|
|
3363
|
+
return next.done = !0, next;
|
|
3364
|
+
};
|
|
3365
|
+
}, exports.values = values, Context.prototype = {
|
|
3366
|
+
constructor: Context,
|
|
3367
|
+
reset: function reset(skipTempReset) {
|
|
3368
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
3369
|
+
},
|
|
3370
|
+
stop: function stop() {
|
|
3371
|
+
this.done = !0;
|
|
3372
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
3373
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
3374
|
+
return this.rval;
|
|
3375
|
+
},
|
|
3376
|
+
dispatchException: function dispatchException(exception) {
|
|
3377
|
+
if (this.done) throw exception;
|
|
3378
|
+
var context = this;
|
|
3379
|
+
function handle(loc, caught) {
|
|
3380
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
3381
|
+
}
|
|
3382
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3383
|
+
var entry = this.tryEntries[i],
|
|
3384
|
+
record = entry.completion;
|
|
3385
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
3386
|
+
if (entry.tryLoc <= this.prev) {
|
|
3387
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
3388
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
3389
|
+
if (hasCatch && hasFinally) {
|
|
3390
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
3391
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
3392
|
+
} else if (hasCatch) {
|
|
3393
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
3394
|
+
} else {
|
|
3395
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
3396
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3399
|
+
}
|
|
3400
|
+
},
|
|
3401
|
+
abrupt: function abrupt(type, arg) {
|
|
3402
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3403
|
+
var entry = this.tryEntries[i];
|
|
3404
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
3405
|
+
var finallyEntry = entry;
|
|
3406
|
+
break;
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
3410
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
3411
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
3412
|
+
},
|
|
3413
|
+
complete: function complete(record, afterLoc) {
|
|
3414
|
+
if ("throw" === record.type) throw record.arg;
|
|
3415
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
3416
|
+
},
|
|
3417
|
+
finish: function finish(finallyLoc) {
|
|
3418
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3419
|
+
var entry = this.tryEntries[i];
|
|
3420
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
3421
|
+
}
|
|
3422
|
+
},
|
|
3423
|
+
"catch": function _catch(tryLoc) {
|
|
3424
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3425
|
+
var entry = this.tryEntries[i];
|
|
3426
|
+
if (entry.tryLoc === tryLoc) {
|
|
3427
|
+
var record = entry.completion;
|
|
3428
|
+
if ("throw" === record.type) {
|
|
3429
|
+
var thrown = record.arg;
|
|
3430
|
+
resetTryEntry(entry);
|
|
3431
|
+
}
|
|
3432
|
+
return thrown;
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
throw new Error("illegal catch attempt");
|
|
3436
|
+
},
|
|
3437
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
3438
|
+
return this.delegate = {
|
|
3439
|
+
iterator: values(iterable),
|
|
3440
|
+
resultName: resultName,
|
|
3441
|
+
nextLoc: nextLoc
|
|
3442
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
3443
|
+
}
|
|
3444
|
+
}, exports;
|
|
3445
|
+
}
|
|
3446
|
+
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3447
|
+
} (regeneratorRuntime$1));
|
|
3448
|
+
|
|
3449
|
+
var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
|
|
3450
|
+
|
|
3451
|
+
// TODO(Babel 8): Remove this file.
|
|
3452
|
+
|
|
3453
|
+
var runtime = regeneratorRuntimeExports();
|
|
3454
|
+
var regenerator = runtime;
|
|
3455
|
+
|
|
3456
|
+
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
3457
|
+
try {
|
|
3458
|
+
regeneratorRuntime = runtime;
|
|
3459
|
+
} catch (accidentalStrictMode) {
|
|
3460
|
+
if (typeof globalThis === "object") {
|
|
3461
|
+
globalThis.regeneratorRuntime = runtime;
|
|
3462
|
+
} else {
|
|
3463
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
|
|
3467
|
+
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
3468
|
+
|
|
5575
3469
|
var DateField = function DateField(_ref) {
|
|
5576
|
-
var _conditions$value$ind, _errors$conditions,
|
|
3470
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5577
3471
|
var name = _ref.name,
|
|
5578
3472
|
index = _ref.index,
|
|
5579
3473
|
conditionName = _ref.conditionName;
|
|
@@ -5590,30 +3484,28 @@ var DateField = function DateField(_ref) {
|
|
|
5590
3484
|
setShowInput = _useState2[1];
|
|
5591
3485
|
var valueTerm = (_conditions$value$ind = conditions.value[index].metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.value;
|
|
5592
3486
|
var label = valueTerm || i18next.t("neetoRules.form.selectDate").toLowerCase();
|
|
5593
|
-
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3487
|
+
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && ramda.isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
5594
3488
|
var handleValidate = /*#__PURE__*/function () {
|
|
5595
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
5596
|
-
return
|
|
5597
|
-
while (1) {
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
if (ramda.isEmpty(errors)) {
|
|
5602
|
-
_context.next = 4;
|
|
5603
|
-
break;
|
|
5604
|
-
}
|
|
3489
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
3490
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
3491
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3492
|
+
case 0:
|
|
3493
|
+
_context.prev = 0;
|
|
3494
|
+
if (ramda.isEmpty(errors)) {
|
|
5605
3495
|
_context.next = 4;
|
|
5606
|
-
return validateField(conditionName);
|
|
5607
|
-
case 4:
|
|
5608
|
-
_context.next = 8;
|
|
5609
3496
|
break;
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
3497
|
+
}
|
|
3498
|
+
_context.next = 4;
|
|
3499
|
+
return validateField(conditionName);
|
|
3500
|
+
case 4:
|
|
3501
|
+
_context.next = 8;
|
|
3502
|
+
break;
|
|
3503
|
+
case 6:
|
|
3504
|
+
_context.prev = 6;
|
|
3505
|
+
_context.t0 = _context["catch"](0);
|
|
3506
|
+
case 8:
|
|
3507
|
+
case "end":
|
|
3508
|
+
return _context.stop();
|
|
5617
3509
|
}
|
|
5618
3510
|
}, _callee, null, [[0, 6]]);
|
|
5619
3511
|
}));
|
|
@@ -5622,7 +3514,7 @@ var DateField = function DateField(_ref) {
|
|
|
5622
3514
|
};
|
|
5623
3515
|
}();
|
|
5624
3516
|
var handleOnChange = function handleOnChange(date) {
|
|
5625
|
-
setFieldValue("".concat(name, ".value"), date ?
|
|
3517
|
+
setFieldValue("".concat(name, ".value"), date ? dayjs(date).format("YYYY-MM-DD") : "");
|
|
5626
3518
|
handleValidate();
|
|
5627
3519
|
};
|
|
5628
3520
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, showInput ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.DatePicker, {
|
|
@@ -5675,8 +3567,8 @@ var ValueField = function ValueField(_ref) {
|
|
|
5675
3567
|
if (INPUT_FIELD_TYPES.includes(fieldType)) {
|
|
5676
3568
|
return /*#__PURE__*/React__default["default"].createElement(InputField$1, {
|
|
5677
3569
|
conditionName: conditionName,
|
|
5678
|
-
"data-cy": "condition-value-".concat(fieldType, "-field"),
|
|
5679
3570
|
index: index,
|
|
3571
|
+
"data-cy": "condition-value-".concat(fieldType, "-field"),
|
|
5680
3572
|
name: "".concat(name, ".value"),
|
|
5681
3573
|
placeholder: t("neetoRules.common.value")
|
|
5682
3574
|
});
|
|
@@ -5684,8 +3576,8 @@ var ValueField = function ValueField(_ref) {
|
|
|
5684
3576
|
if (fieldType === CONDITION_VALUE_TYPES.textarea) {
|
|
5685
3577
|
var _condition$metadata;
|
|
5686
3578
|
return /*#__PURE__*/React__default["default"].createElement(LongTextField, {
|
|
5687
|
-
defaultLabel: t("neetoRules.labels.text"),
|
|
5688
3579
|
index: index,
|
|
3580
|
+
defaultLabel: t("neetoRules.labels.text"),
|
|
5689
3581
|
name: "".concat(name, ".value"),
|
|
5690
3582
|
value: (_condition$metadata = condition.metadata) === null || _condition$metadata === void 0 ? void 0 : _condition$metadata.value
|
|
5691
3583
|
});
|
|
@@ -5693,23 +3585,23 @@ var ValueField = function ValueField(_ref) {
|
|
|
5693
3585
|
if (fieldType === CONDITION_VALUE_TYPES.dropdown) {
|
|
5694
3586
|
return /*#__PURE__*/React__default["default"].createElement(Dropdown, {
|
|
5695
3587
|
index: index,
|
|
5696
|
-
|
|
5697
|
-
|
|
3588
|
+
options: options,
|
|
3589
|
+
name: "".concat(name, ".value")
|
|
5698
3590
|
});
|
|
5699
3591
|
}
|
|
5700
3592
|
if (fieldType === CONDITION_VALUE_TYPES.multiSelect) {
|
|
5701
3593
|
return /*#__PURE__*/React__default["default"].createElement(MultiSelect, {
|
|
5702
|
-
dropDownOptions: options,
|
|
5703
3594
|
index: index,
|
|
3595
|
+
dropDownOptions: options,
|
|
5704
3596
|
name: "".concat(name, ".values")
|
|
5705
3597
|
});
|
|
5706
3598
|
}
|
|
5707
3599
|
if (fieldType === CONDITION_VALUE_TYPES.multiSelectCreate) {
|
|
5708
3600
|
return /*#__PURE__*/React__default["default"].createElement(MultiSelectCreate, {
|
|
5709
|
-
isCreateable: true,
|
|
5710
3601
|
index: index,
|
|
5711
|
-
name: "".concat(name, ".values"),
|
|
5712
3602
|
options: options,
|
|
3603
|
+
isCreateable: true,
|
|
3604
|
+
name: "".concat(name, ".values"),
|
|
5713
3605
|
placeholder: t("neetoRules.placeholders.multiSelect")
|
|
5714
3606
|
});
|
|
5715
3607
|
}
|
|
@@ -5774,22 +3666,22 @@ var ConditionItem = function ConditionItem(_ref) {
|
|
|
5774
3666
|
style: "h5",
|
|
5775
3667
|
weight: "normal"
|
|
5776
3668
|
}, defaultLabel), /*#__PURE__*/React__default["default"].createElement(DropdownField, {
|
|
3669
|
+
index: index,
|
|
5777
3670
|
fieldType: "field",
|
|
5778
3671
|
handleSelect: handleFieldChange,
|
|
5779
|
-
index: index,
|
|
5780
3672
|
options: conditionOptions,
|
|
5781
3673
|
placeholder: t("neetoRules.form.selectField")
|
|
5782
3674
|
}), /*#__PURE__*/React__default["default"].createElement(DropdownField, {
|
|
3675
|
+
index: index,
|
|
5783
3676
|
fieldType: "verb",
|
|
5784
3677
|
handleSelect: handleVerbChange,
|
|
5785
|
-
index: index,
|
|
5786
3678
|
options: verbOptions,
|
|
5787
3679
|
placeholder: t("neetoRules.form.selectVerb")
|
|
5788
3680
|
}), /*#__PURE__*/React__default["default"].createElement(ValueField, {
|
|
5789
3681
|
condition: condition,
|
|
3682
|
+
index: index,
|
|
5790
3683
|
conditionName: name,
|
|
5791
3684
|
field: selectedField,
|
|
5792
|
-
index: index,
|
|
5793
3685
|
name: "".concat(name, ".metadata"),
|
|
5794
3686
|
options: getSelectedFieldOptions()
|
|
5795
3687
|
}));
|
|
@@ -5835,7 +3727,7 @@ var Conditions = function Conditions(_ref) {
|
|
|
5835
3727
|
var _elementProps$conditi;
|
|
5836
3728
|
arrayHelpers.push({
|
|
5837
3729
|
field: elementProps === null || elementProps === void 0 ? void 0 : elementProps.conditionOptions[0].value,
|
|
5838
|
-
verb: elementProps === null || elementProps === void 0
|
|
3730
|
+
verb: elementProps === null || elementProps === void 0 || (_elementProps$conditi = elementProps.conditionOptions[0]) === null || _elementProps$conditi === void 0 ? void 0 : _elementProps$conditi.allowMatching[0],
|
|
5839
3731
|
joinType: logicOperation,
|
|
5840
3732
|
metadata: {}
|
|
5841
3733
|
});
|
|
@@ -5876,10 +3768,10 @@ var Conditions = function Conditions(_ref) {
|
|
|
5876
3768
|
elementProps: elementProps,
|
|
5877
3769
|
index: index,
|
|
5878
3770
|
isWithEvents: isWithEvents,
|
|
5879
|
-
|
|
5880
|
-
name: "".concat(name, ".value.").concat(index),
|
|
3771
|
+
onSelectCondition: onSelectCondition,
|
|
5881
3772
|
selectedConditionOptions: selectedConditionOptions,
|
|
5882
|
-
|
|
3773
|
+
key: index,
|
|
3774
|
+
name: "".concat(name, ".value.").concat(index)
|
|
5883
3775
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5884
3776
|
className: "flex"
|
|
5885
3777
|
}, index === conditions.length - 1 && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
@@ -6038,7 +3930,7 @@ var Performer$1 = function Performer(_ref) {
|
|
|
6038
3930
|
return !prevState;
|
|
6039
3931
|
});
|
|
6040
3932
|
}
|
|
6041
|
-
}, selectedOption === null || selectedOption === void 0
|
|
3933
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
6042
3934
|
onClose: handleClose
|
|
6043
3935
|
}, /*#__PURE__*/React__default["default"].createElement(Menu$3, {
|
|
6044
3936
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -6202,7 +4094,7 @@ var Events$1 = function Events(_ref) {
|
|
|
6202
4094
|
onClick: function onClick() {
|
|
6203
4095
|
return setActiveOption(activeOption ? null : event.value);
|
|
6204
4096
|
}
|
|
6205
|
-
}, event === null || event === void 0
|
|
4097
|
+
}, event === null || event === void 0 || (_event$label = event.label) === null || _event$label === void 0 ? void 0 : _event$label.toLowerCase()));
|
|
6206
4098
|
})) : /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
6207
4099
|
"data-cy": "condition-value-multi-select-field",
|
|
6208
4100
|
style: "h5",
|
|
@@ -6272,7 +4164,7 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6272
4164
|
var _conditionProps$condi;
|
|
6273
4165
|
setFieldValue("".concat(conditionsName, ".value"), [{
|
|
6274
4166
|
field: conditionProps === null || conditionProps === void 0 ? void 0 : conditionProps.conditionOptions[0].value,
|
|
6275
|
-
verb: conditionProps === null || conditionProps === void 0
|
|
4167
|
+
verb: conditionProps === null || conditionProps === void 0 || (_conditionProps$condi = conditionProps.conditionOptions[0]) === null || _conditionProps$condi === void 0 ? void 0 : _conditionProps$condi.allowMatching[0],
|
|
6276
4168
|
joinType: OPERATORS.or,
|
|
6277
4169
|
metadata: {}
|
|
6278
4170
|
}]);
|
|
@@ -6288,8 +4180,8 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6288
4180
|
}, /*#__PURE__*/React__default["default"].createElement(Events$1, {
|
|
6289
4181
|
data: data,
|
|
6290
4182
|
name: name,
|
|
6291
|
-
|
|
6292
|
-
|
|
4183
|
+
onSelectEvent: onSelectEvent,
|
|
4184
|
+
performerName: performerName
|
|
6293
4185
|
})), showAddButton && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
6294
4186
|
"data-cy": "add-condition-button",
|
|
6295
4187
|
"data-test-id": "automation-rules-add-events-button",
|
|
@@ -6304,8 +4196,8 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6304
4196
|
})), !showAddButton && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6305
4197
|
className: "mt-3"
|
|
6306
4198
|
}, /*#__PURE__*/React__default["default"].createElement(Conditions, _extends({
|
|
6307
|
-
isWithEvents: true,
|
|
6308
4199
|
data: data,
|
|
4200
|
+
isWithEvents: true,
|
|
6309
4201
|
name: conditionsName
|
|
6310
4202
|
}, config)))));
|
|
6311
4203
|
};
|
|
@@ -6508,7 +4400,7 @@ var Performer = function Performer(_ref) {
|
|
|
6508
4400
|
return !prevState;
|
|
6509
4401
|
});
|
|
6510
4402
|
}
|
|
6511
|
-
}, selectedOption === null || selectedOption === void 0
|
|
4403
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
6512
4404
|
onClose: handleClose
|
|
6513
4405
|
}, /*#__PURE__*/React__default["default"].createElement(Menu, {
|
|
6514
4406
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -6569,10 +4461,9 @@ var Events = function Events(_ref) {
|
|
|
6569
4461
|
arrayHelpers.remove(index);
|
|
6570
4462
|
};
|
|
6571
4463
|
var popEvent = function popEvent(arrayHelpers) {
|
|
6572
|
-
if (neetoCist.isNotEmpty(arrayHelpers) && neetoCist.isNotEmpty(events))
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
}
|
|
4464
|
+
if (!(neetoCist.isNotEmpty(arrayHelpers) && neetoCist.isNotEmpty(events))) return;
|
|
4465
|
+
var eventIdx = events.length - 1;
|
|
4466
|
+
_removeEvent(eventIdx, events[eventIdx], arrayHelpers);
|
|
6576
4467
|
};
|
|
6577
4468
|
var handleAddEvent = function handleAddEvent(arrayHelpers) {
|
|
6578
4469
|
return arrayHelpers.push({
|
|
@@ -6613,7 +4504,7 @@ var Events = function Events(_ref) {
|
|
|
6613
4504
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6614
4505
|
className: "flex justify-between"
|
|
6615
4506
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6616
|
-
className: classNames__default["default"]("flex flex-wrap gap-
|
|
4507
|
+
className: classNames__default["default"]("flex flex-wrap gap-x-2 gap-y-2", {
|
|
6617
4508
|
"max-w-2xl": showAddButton
|
|
6618
4509
|
})
|
|
6619
4510
|
}, showMessage && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
@@ -6636,12 +4527,12 @@ var Events = function Events(_ref) {
|
|
|
6636
4527
|
}, i18next.t("neetoRules.common.or")), /*#__PURE__*/React__default["default"].createElement(EventItem, {
|
|
6637
4528
|
elementProps: elementProps,
|
|
6638
4529
|
event: event,
|
|
4530
|
+
onSelectEvent: onSelectEvent,
|
|
6639
4531
|
name: "".concat(name, ".value.").concat(index, ".name"),
|
|
6640
4532
|
parentName: name,
|
|
6641
4533
|
removeEvent: function removeEvent() {
|
|
6642
4534
|
return _removeEvent(index, event, arrayHelpers);
|
|
6643
|
-
}
|
|
6644
|
-
onSelectEvent: onSelectEvent
|
|
4535
|
+
}
|
|
6645
4536
|
}));
|
|
6646
4537
|
}), !showMessage && /*#__PURE__*/React__default["default"].createElement(Performer, {
|
|
6647
4538
|
data: data,
|
|
@@ -6746,9 +4637,9 @@ var RadioField = function RadioField(_ref) {
|
|
|
6746
4637
|
var label = _ref2.label,
|
|
6747
4638
|
value = _ref2.value;
|
|
6748
4639
|
return /*#__PURE__*/React__default["default"].createElement(formik$1.Radio.Item, {
|
|
6749
|
-
key: index,
|
|
6750
4640
|
label: label,
|
|
6751
|
-
value: value
|
|
4641
|
+
value: value,
|
|
4642
|
+
key: index
|
|
6752
4643
|
});
|
|
6753
4644
|
})));
|
|
6754
4645
|
};
|
|
@@ -6822,4 +4713,5 @@ NeetoRules.EventConditions = EventConditions;
|
|
|
6822
4713
|
exports.NeetoRulesForm = NeetoRules;
|
|
6823
4714
|
exports.RulePreview = RulePreview;
|
|
6824
4715
|
exports["default"] = NeetoRules$1;
|
|
4716
|
+
exports.useCustomDataStore = useCustomDataStore;
|
|
6825
4717
|
//# sourceMappingURL=index.cjs.js.map
|