@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.js
CHANGED
|
@@ -1,2273 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { useFormikContext, Formik, Form, useField, FieldArray, ErrorMessage } from 'formik';
|
|
6
|
-
import { findBy, noop
|
|
7
|
-
import { ActionBlock, Textarea, MultiEmailInput, Input as Input$2, Select as Select$1, Radio } from '@bigbinary/neetoui/formik';
|
|
8
|
-
import { t as t$1 } from 'i18next';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
function _objectDestructuringEmpty(obj) {
|
|
21
|
-
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function _setPrototypeOf$1(o, p) {
|
|
25
|
-
_setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
26
|
-
o.__proto__ = p;
|
|
27
|
-
return o;
|
|
28
|
-
};
|
|
29
|
-
return _setPrototypeOf$1(o, p);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _inheritsLoose$1(subClass, superClass) {
|
|
33
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
34
|
-
subClass.prototype.constructor = subClass;
|
|
35
|
-
_setPrototypeOf$1(subClass, superClass);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var propTypes = {exports: {}};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
42
|
-
*
|
|
43
|
-
* This source code is licensed under the MIT license found in the
|
|
44
|
-
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/
|
|
46
|
-
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
47
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
51
|
-
*
|
|
52
|
-
* This source code is licensed under the MIT license found in the
|
|
53
|
-
* LICENSE file in the root directory of this source tree.
|
|
54
|
-
*/
|
|
55
|
-
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
56
|
-
function emptyFunction() {}
|
|
57
|
-
function emptyFunctionWithReset() {}
|
|
58
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
59
|
-
var factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
60
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
61
|
-
if (secret === ReactPropTypesSecret) {
|
|
62
|
-
// It is still safe when called from React.
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
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');
|
|
66
|
-
err.name = 'Invariant Violation';
|
|
67
|
-
throw err;
|
|
68
|
-
}
|
|
69
|
-
shim.isRequired = shim;
|
|
70
|
-
function getShim() {
|
|
71
|
-
return shim;
|
|
72
|
-
}
|
|
73
|
-
// Important!
|
|
74
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
75
|
-
var ReactPropTypes = {
|
|
76
|
-
array: shim,
|
|
77
|
-
bigint: shim,
|
|
78
|
-
bool: shim,
|
|
79
|
-
func: shim,
|
|
80
|
-
number: shim,
|
|
81
|
-
object: shim,
|
|
82
|
-
string: shim,
|
|
83
|
-
symbol: shim,
|
|
84
|
-
any: shim,
|
|
85
|
-
arrayOf: getShim,
|
|
86
|
-
element: shim,
|
|
87
|
-
elementType: shim,
|
|
88
|
-
instanceOf: getShim,
|
|
89
|
-
node: shim,
|
|
90
|
-
objectOf: getShim,
|
|
91
|
-
oneOf: getShim,
|
|
92
|
-
oneOfType: getShim,
|
|
93
|
-
shape: getShim,
|
|
94
|
-
exact: getShim,
|
|
95
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
96
|
-
resetWarningCache: emptyFunction
|
|
97
|
-
};
|
|
98
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
99
|
-
return ReactPropTypes;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
104
|
-
*
|
|
105
|
-
* This source code is licensed under the MIT license found in the
|
|
106
|
-
* LICENSE file in the root directory of this source tree.
|
|
107
|
-
*/
|
|
108
|
-
{
|
|
109
|
-
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
110
|
-
// http://fb.me/prop-types-in-prod
|
|
111
|
-
propTypes.exports = factoryWithThrowingShims();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function _extends$1() {
|
|
115
|
-
_extends$1 = Object.assign || function (target) {
|
|
116
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
117
|
-
var source = arguments[i];
|
|
118
|
-
for (var key in source) {
|
|
119
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
120
|
-
target[key] = source[key];
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return target;
|
|
125
|
-
};
|
|
126
|
-
return _extends$1.apply(this, arguments);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function isAbsolute(pathname) {
|
|
130
|
-
return pathname.charAt(0) === '/';
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// About 1.5x faster than the two-arg version of Array#splice()
|
|
134
|
-
function spliceOne(list, index) {
|
|
135
|
-
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
|
|
136
|
-
list[i] = list[k];
|
|
137
|
-
}
|
|
138
|
-
list.pop();
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// This implementation is based heavily on node's url.parse
|
|
142
|
-
function resolvePathname(to, from) {
|
|
143
|
-
if (from === undefined) from = '';
|
|
144
|
-
var toParts = to && to.split('/') || [];
|
|
145
|
-
var fromParts = from && from.split('/') || [];
|
|
146
|
-
var isToAbs = to && isAbsolute(to);
|
|
147
|
-
var isFromAbs = from && isAbsolute(from);
|
|
148
|
-
var mustEndAbs = isToAbs || isFromAbs;
|
|
149
|
-
if (to && isAbsolute(to)) {
|
|
150
|
-
// to is absolute
|
|
151
|
-
fromParts = toParts;
|
|
152
|
-
} else if (toParts.length) {
|
|
153
|
-
// to is relative, drop the filename
|
|
154
|
-
fromParts.pop();
|
|
155
|
-
fromParts = fromParts.concat(toParts);
|
|
156
|
-
}
|
|
157
|
-
if (!fromParts.length) return '/';
|
|
158
|
-
var hasTrailingSlash;
|
|
159
|
-
if (fromParts.length) {
|
|
160
|
-
var last = fromParts[fromParts.length - 1];
|
|
161
|
-
hasTrailingSlash = last === '.' || last === '..' || last === '';
|
|
162
|
-
} else {
|
|
163
|
-
hasTrailingSlash = false;
|
|
164
|
-
}
|
|
165
|
-
var up = 0;
|
|
166
|
-
for (var i = fromParts.length; i >= 0; i--) {
|
|
167
|
-
var part = fromParts[i];
|
|
168
|
-
if (part === '.') {
|
|
169
|
-
spliceOne(fromParts, i);
|
|
170
|
-
} else if (part === '..') {
|
|
171
|
-
spliceOne(fromParts, i);
|
|
172
|
-
up++;
|
|
173
|
-
} else if (up) {
|
|
174
|
-
spliceOne(fromParts, i);
|
|
175
|
-
up--;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (!mustEndAbs) for (; up--; up) {
|
|
179
|
-
fromParts.unshift('..');
|
|
180
|
-
}
|
|
181
|
-
if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift('');
|
|
182
|
-
var result = fromParts.join('/');
|
|
183
|
-
if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
|
|
184
|
-
return result;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function _typeof$1(obj) {
|
|
188
|
-
"@babel/helpers - typeof";
|
|
189
|
-
|
|
190
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
191
|
-
return typeof obj;
|
|
192
|
-
} : function (obj) {
|
|
193
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
194
|
-
}, _typeof$1(obj);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
var prefix = 'Invariant failed';
|
|
198
|
-
function invariant(condition, message) {
|
|
199
|
-
if (condition) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
{
|
|
203
|
-
throw new Error(prefix);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function addLeadingSlash$1(path) {
|
|
208
|
-
return path.charAt(0) === '/' ? path : '/' + path;
|
|
209
|
-
}
|
|
210
|
-
function stripLeadingSlash(path) {
|
|
211
|
-
return path.charAt(0) === '/' ? path.substr(1) : path;
|
|
212
|
-
}
|
|
213
|
-
function hasBasename(path, prefix) {
|
|
214
|
-
return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
|
|
215
|
-
}
|
|
216
|
-
function stripBasename$1(path, prefix) {
|
|
217
|
-
return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
|
|
218
|
-
}
|
|
219
|
-
function stripTrailingSlash(path) {
|
|
220
|
-
return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
|
|
221
|
-
}
|
|
222
|
-
function parsePath(path) {
|
|
223
|
-
var pathname = path || '/';
|
|
224
|
-
var search = '';
|
|
225
|
-
var hash = '';
|
|
226
|
-
var hashIndex = pathname.indexOf('#');
|
|
227
|
-
if (hashIndex !== -1) {
|
|
228
|
-
hash = pathname.substr(hashIndex);
|
|
229
|
-
pathname = pathname.substr(0, hashIndex);
|
|
230
|
-
}
|
|
231
|
-
var searchIndex = pathname.indexOf('?');
|
|
232
|
-
if (searchIndex !== -1) {
|
|
233
|
-
search = pathname.substr(searchIndex);
|
|
234
|
-
pathname = pathname.substr(0, searchIndex);
|
|
235
|
-
}
|
|
236
|
-
return {
|
|
237
|
-
pathname: pathname,
|
|
238
|
-
search: search === '?' ? '' : search,
|
|
239
|
-
hash: hash === '#' ? '' : hash
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
function createPath(location) {
|
|
243
|
-
var pathname = location.pathname,
|
|
244
|
-
search = location.search,
|
|
245
|
-
hash = location.hash;
|
|
246
|
-
var path = pathname || '/';
|
|
247
|
-
if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
|
|
248
|
-
if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
|
|
249
|
-
return path;
|
|
250
|
-
}
|
|
251
|
-
function createLocation(path, state, key, currentLocation) {
|
|
252
|
-
var location;
|
|
253
|
-
if (typeof path === 'string') {
|
|
254
|
-
// Two-arg form: push(path, state)
|
|
255
|
-
location = parsePath(path);
|
|
256
|
-
location.state = state;
|
|
257
|
-
} else {
|
|
258
|
-
// One-arg form: push(location)
|
|
259
|
-
location = _extends$1({}, path);
|
|
260
|
-
if (location.pathname === undefined) location.pathname = '';
|
|
261
|
-
if (location.search) {
|
|
262
|
-
if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
|
|
263
|
-
} else {
|
|
264
|
-
location.search = '';
|
|
265
|
-
}
|
|
266
|
-
if (location.hash) {
|
|
267
|
-
if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
|
|
268
|
-
} else {
|
|
269
|
-
location.hash = '';
|
|
270
|
-
}
|
|
271
|
-
if (state !== undefined && location.state === undefined) location.state = state;
|
|
272
|
-
}
|
|
273
|
-
try {
|
|
274
|
-
location.pathname = decodeURI(location.pathname);
|
|
275
|
-
} catch (e) {
|
|
276
|
-
if (e instanceof URIError) {
|
|
277
|
-
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
|
|
278
|
-
} else {
|
|
279
|
-
throw e;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
if (key) location.key = key;
|
|
283
|
-
if (currentLocation) {
|
|
284
|
-
// Resolve incomplete/relative pathname relative to current location.
|
|
285
|
-
if (!location.pathname) {
|
|
286
|
-
location.pathname = currentLocation.pathname;
|
|
287
|
-
} else if (location.pathname.charAt(0) !== '/') {
|
|
288
|
-
location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
|
|
289
|
-
}
|
|
290
|
-
} else {
|
|
291
|
-
// When there is no prior location and pathname is empty, set it to /
|
|
292
|
-
if (!location.pathname) {
|
|
293
|
-
location.pathname = '/';
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return location;
|
|
297
|
-
}
|
|
298
|
-
function createTransitionManager() {
|
|
299
|
-
var prompt = null;
|
|
300
|
-
function setPrompt(nextPrompt) {
|
|
301
|
-
prompt = nextPrompt;
|
|
302
|
-
return function () {
|
|
303
|
-
if (prompt === nextPrompt) prompt = null;
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
function confirmTransitionTo(location, action, getUserConfirmation, callback) {
|
|
307
|
-
// TODO: If another transition starts while we're still confirming
|
|
308
|
-
// the previous one, we may end up in a weird state. Figure out the
|
|
309
|
-
// best way to handle this.
|
|
310
|
-
if (prompt != null) {
|
|
311
|
-
var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
|
|
312
|
-
if (typeof result === 'string') {
|
|
313
|
-
if (typeof getUserConfirmation === 'function') {
|
|
314
|
-
getUserConfirmation(result, callback);
|
|
315
|
-
} else {
|
|
316
|
-
callback(true);
|
|
317
|
-
}
|
|
318
|
-
} else {
|
|
319
|
-
// Return false from a transition hook to cancel the transition.
|
|
320
|
-
callback(result !== false);
|
|
321
|
-
}
|
|
322
|
-
} else {
|
|
323
|
-
callback(true);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
var listeners = [];
|
|
327
|
-
function appendListener(fn) {
|
|
328
|
-
var isActive = true;
|
|
329
|
-
function listener() {
|
|
330
|
-
if (isActive) fn.apply(void 0, arguments);
|
|
331
|
-
}
|
|
332
|
-
listeners.push(listener);
|
|
333
|
-
return function () {
|
|
334
|
-
isActive = false;
|
|
335
|
-
listeners = listeners.filter(function (item) {
|
|
336
|
-
return item !== listener;
|
|
337
|
-
});
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
function notifyListeners() {
|
|
341
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
342
|
-
args[_key] = arguments[_key];
|
|
343
|
-
}
|
|
344
|
-
listeners.forEach(function (listener) {
|
|
345
|
-
return listener.apply(void 0, args);
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
return {
|
|
349
|
-
setPrompt: setPrompt,
|
|
350
|
-
confirmTransitionTo: confirmTransitionTo,
|
|
351
|
-
appendListener: appendListener,
|
|
352
|
-
notifyListeners: notifyListeners
|
|
353
|
-
};
|
|
354
|
-
}
|
|
355
|
-
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
356
|
-
function getConfirmation(message, callback) {
|
|
357
|
-
callback(window.confirm(message)); // eslint-disable-line no-alert
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
|
|
361
|
-
*
|
|
362
|
-
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
|
|
363
|
-
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
|
|
364
|
-
* changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
|
|
365
|
-
*/
|
|
366
|
-
|
|
367
|
-
function supportsHistory() {
|
|
368
|
-
var ua = window.navigator.userAgent;
|
|
369
|
-
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;
|
|
370
|
-
return window.history && 'pushState' in window.history;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Returns true if browser fires popstate on hash change.
|
|
374
|
-
* IE10 and IE11 do not.
|
|
375
|
-
*/
|
|
376
|
-
|
|
377
|
-
function supportsPopStateOnHashChange() {
|
|
378
|
-
return window.navigator.userAgent.indexOf('Trident') === -1;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Returns false if using go(n) with hash history causes a full page reload.
|
|
382
|
-
*/
|
|
383
|
-
|
|
384
|
-
function supportsGoWithoutReloadUsingHash() {
|
|
385
|
-
return window.navigator.userAgent.indexOf('Firefox') === -1;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Returns true if a given popstate event is an extraneous WebKit event.
|
|
389
|
-
* Accounts for the fact that Chrome on iOS fires real popstate events
|
|
390
|
-
* containing undefined state when pressing the back button.
|
|
391
|
-
*/
|
|
392
|
-
|
|
393
|
-
function isExtraneousPopstateEvent(event) {
|
|
394
|
-
return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
|
|
395
|
-
}
|
|
396
|
-
var PopStateEvent = 'popstate';
|
|
397
|
-
var HashChangeEvent = 'hashchange';
|
|
398
|
-
function getHistoryState() {
|
|
399
|
-
try {
|
|
400
|
-
return window.history.state || {};
|
|
401
|
-
} catch (e) {
|
|
402
|
-
// IE 11 sometimes throws when accessing window.history.state
|
|
403
|
-
// See https://github.com/ReactTraining/history/pull/289
|
|
404
|
-
return {};
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* Creates a history object that uses the HTML5 history API including
|
|
409
|
-
* pushState, replaceState, and the popstate event.
|
|
410
|
-
*/
|
|
411
|
-
|
|
412
|
-
function createBrowserHistory(props) {
|
|
413
|
-
if (props === void 0) {
|
|
414
|
-
props = {};
|
|
415
|
-
}
|
|
416
|
-
!canUseDOM ? invariant(false) : void 0;
|
|
417
|
-
var globalHistory = window.history;
|
|
418
|
-
var canUseHistory = supportsHistory();
|
|
419
|
-
var needsHashChangeListener = !supportsPopStateOnHashChange();
|
|
420
|
-
var _props = props,
|
|
421
|
-
_props$forceRefresh = _props.forceRefresh,
|
|
422
|
-
forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
|
|
423
|
-
_props$getUserConfirm = _props.getUserConfirmation,
|
|
424
|
-
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
|
|
425
|
-
_props$keyLength = _props.keyLength,
|
|
426
|
-
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
|
427
|
-
var basename = props.basename ? stripTrailingSlash(addLeadingSlash$1(props.basename)) : '';
|
|
428
|
-
function getDOMLocation(historyState) {
|
|
429
|
-
var _ref = historyState || {},
|
|
430
|
-
key = _ref.key,
|
|
431
|
-
state = _ref.state;
|
|
432
|
-
var _window$location = window.location,
|
|
433
|
-
pathname = _window$location.pathname,
|
|
434
|
-
search = _window$location.search,
|
|
435
|
-
hash = _window$location.hash;
|
|
436
|
-
var path = pathname + search + hash;
|
|
437
|
-
if (basename) path = stripBasename$1(path, basename);
|
|
438
|
-
return createLocation(path, state, key);
|
|
439
|
-
}
|
|
440
|
-
function createKey() {
|
|
441
|
-
return Math.random().toString(36).substr(2, keyLength);
|
|
442
|
-
}
|
|
443
|
-
var transitionManager = createTransitionManager();
|
|
444
|
-
function setState(nextState) {
|
|
445
|
-
_extends$1(history, nextState);
|
|
446
|
-
history.length = globalHistory.length;
|
|
447
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
448
|
-
}
|
|
449
|
-
function handlePopState(event) {
|
|
450
|
-
// Ignore extraneous popstate events in WebKit.
|
|
451
|
-
if (isExtraneousPopstateEvent(event)) return;
|
|
452
|
-
handlePop(getDOMLocation(event.state));
|
|
453
|
-
}
|
|
454
|
-
function handleHashChange() {
|
|
455
|
-
handlePop(getDOMLocation(getHistoryState()));
|
|
456
|
-
}
|
|
457
|
-
var forceNextPop = false;
|
|
458
|
-
function handlePop(location) {
|
|
459
|
-
if (forceNextPop) {
|
|
460
|
-
forceNextPop = false;
|
|
461
|
-
setState();
|
|
462
|
-
} else {
|
|
463
|
-
var action = 'POP';
|
|
464
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
465
|
-
if (ok) {
|
|
466
|
-
setState({
|
|
467
|
-
action: action,
|
|
468
|
-
location: location
|
|
469
|
-
});
|
|
470
|
-
} else {
|
|
471
|
-
revertPop(location);
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
function revertPop(fromLocation) {
|
|
477
|
-
var toLocation = history.location; // TODO: We could probably make this more reliable by
|
|
478
|
-
// keeping a list of keys we've seen in sessionStorage.
|
|
479
|
-
// Instead, we just default to 0 for keys we don't know.
|
|
480
|
-
|
|
481
|
-
var toIndex = allKeys.indexOf(toLocation.key);
|
|
482
|
-
if (toIndex === -1) toIndex = 0;
|
|
483
|
-
var fromIndex = allKeys.indexOf(fromLocation.key);
|
|
484
|
-
if (fromIndex === -1) fromIndex = 0;
|
|
485
|
-
var delta = toIndex - fromIndex;
|
|
486
|
-
if (delta) {
|
|
487
|
-
forceNextPop = true;
|
|
488
|
-
go(delta);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
var initialLocation = getDOMLocation(getHistoryState());
|
|
492
|
-
var allKeys = [initialLocation.key]; // Public interface
|
|
493
|
-
|
|
494
|
-
function createHref(location) {
|
|
495
|
-
return basename + createPath(location);
|
|
496
|
-
}
|
|
497
|
-
function push(path, state) {
|
|
498
|
-
var action = 'PUSH';
|
|
499
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
500
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
501
|
-
if (!ok) return;
|
|
502
|
-
var href = createHref(location);
|
|
503
|
-
var key = location.key,
|
|
504
|
-
state = location.state;
|
|
505
|
-
if (canUseHistory) {
|
|
506
|
-
globalHistory.pushState({
|
|
507
|
-
key: key,
|
|
508
|
-
state: state
|
|
509
|
-
}, null, href);
|
|
510
|
-
if (forceRefresh) {
|
|
511
|
-
window.location.href = href;
|
|
512
|
-
} else {
|
|
513
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
514
|
-
var nextKeys = allKeys.slice(0, prevIndex + 1);
|
|
515
|
-
nextKeys.push(location.key);
|
|
516
|
-
allKeys = nextKeys;
|
|
517
|
-
setState({
|
|
518
|
-
action: action,
|
|
519
|
-
location: location
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
} else {
|
|
523
|
-
window.location.href = href;
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
function replace(path, state) {
|
|
528
|
-
var action = 'REPLACE';
|
|
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.replaceState({
|
|
537
|
-
key: key,
|
|
538
|
-
state: state
|
|
539
|
-
}, null, href);
|
|
540
|
-
if (forceRefresh) {
|
|
541
|
-
window.location.replace(href);
|
|
542
|
-
} else {
|
|
543
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
544
|
-
if (prevIndex !== -1) allKeys[prevIndex] = location.key;
|
|
545
|
-
setState({
|
|
546
|
-
action: action,
|
|
547
|
-
location: location
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
} else {
|
|
551
|
-
window.location.replace(href);
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
function go(n) {
|
|
556
|
-
globalHistory.go(n);
|
|
557
|
-
}
|
|
558
|
-
function goBack() {
|
|
559
|
-
go(-1);
|
|
560
|
-
}
|
|
561
|
-
function goForward() {
|
|
562
|
-
go(1);
|
|
563
|
-
}
|
|
564
|
-
var listenerCount = 0;
|
|
565
|
-
function checkDOMListeners(delta) {
|
|
566
|
-
listenerCount += delta;
|
|
567
|
-
if (listenerCount === 1 && delta === 1) {
|
|
568
|
-
window.addEventListener(PopStateEvent, handlePopState);
|
|
569
|
-
if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
|
|
570
|
-
} else if (listenerCount === 0) {
|
|
571
|
-
window.removeEventListener(PopStateEvent, handlePopState);
|
|
572
|
-
if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
var isBlocked = false;
|
|
576
|
-
function block(prompt) {
|
|
577
|
-
if (prompt === void 0) {
|
|
578
|
-
prompt = false;
|
|
579
|
-
}
|
|
580
|
-
var unblock = transitionManager.setPrompt(prompt);
|
|
581
|
-
if (!isBlocked) {
|
|
582
|
-
checkDOMListeners(1);
|
|
583
|
-
isBlocked = true;
|
|
584
|
-
}
|
|
585
|
-
return function () {
|
|
586
|
-
if (isBlocked) {
|
|
587
|
-
isBlocked = false;
|
|
588
|
-
checkDOMListeners(-1);
|
|
589
|
-
}
|
|
590
|
-
return unblock();
|
|
591
|
-
};
|
|
592
|
-
}
|
|
593
|
-
function listen(listener) {
|
|
594
|
-
var unlisten = transitionManager.appendListener(listener);
|
|
595
|
-
checkDOMListeners(1);
|
|
596
|
-
return function () {
|
|
597
|
-
checkDOMListeners(-1);
|
|
598
|
-
unlisten();
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
var history = {
|
|
602
|
-
length: globalHistory.length,
|
|
603
|
-
action: 'POP',
|
|
604
|
-
location: initialLocation,
|
|
605
|
-
createHref: createHref,
|
|
606
|
-
push: push,
|
|
607
|
-
replace: replace,
|
|
608
|
-
go: go,
|
|
609
|
-
goBack: goBack,
|
|
610
|
-
goForward: goForward,
|
|
611
|
-
block: block,
|
|
612
|
-
listen: listen
|
|
613
|
-
};
|
|
614
|
-
return history;
|
|
615
|
-
}
|
|
616
|
-
var HashChangeEvent$1 = 'hashchange';
|
|
617
|
-
var HashPathCoders = {
|
|
618
|
-
hashbang: {
|
|
619
|
-
encodePath: function encodePath(path) {
|
|
620
|
-
return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path);
|
|
621
|
-
},
|
|
622
|
-
decodePath: function decodePath(path) {
|
|
623
|
-
return path.charAt(0) === '!' ? path.substr(1) : path;
|
|
624
|
-
}
|
|
625
|
-
},
|
|
626
|
-
noslash: {
|
|
627
|
-
encodePath: stripLeadingSlash,
|
|
628
|
-
decodePath: addLeadingSlash$1
|
|
629
|
-
},
|
|
630
|
-
slash: {
|
|
631
|
-
encodePath: addLeadingSlash$1,
|
|
632
|
-
decodePath: addLeadingSlash$1
|
|
633
|
-
}
|
|
634
|
-
};
|
|
635
|
-
function stripHash(url) {
|
|
636
|
-
var hashIndex = url.indexOf('#');
|
|
637
|
-
return hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
638
|
-
}
|
|
639
|
-
function getHashPath() {
|
|
640
|
-
// We can't use window.location.hash here because it's not
|
|
641
|
-
// consistent across browsers - Firefox will pre-decode it!
|
|
642
|
-
var href = window.location.href;
|
|
643
|
-
var hashIndex = href.indexOf('#');
|
|
644
|
-
return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
|
|
645
|
-
}
|
|
646
|
-
function pushHashPath(path) {
|
|
647
|
-
window.location.hash = path;
|
|
648
|
-
}
|
|
649
|
-
function replaceHashPath(path) {
|
|
650
|
-
window.location.replace(stripHash(window.location.href) + '#' + path);
|
|
651
|
-
}
|
|
652
|
-
function createHashHistory(props) {
|
|
653
|
-
if (props === void 0) {
|
|
654
|
-
props = {};
|
|
655
|
-
}
|
|
656
|
-
!canUseDOM ? invariant(false) : void 0;
|
|
657
|
-
var globalHistory = window.history;
|
|
658
|
-
supportsGoWithoutReloadUsingHash();
|
|
659
|
-
var _props = props,
|
|
660
|
-
_props$getUserConfirm = _props.getUserConfirmation,
|
|
661
|
-
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
|
|
662
|
-
_props$hashType = _props.hashType,
|
|
663
|
-
hashType = _props$hashType === void 0 ? 'slash' : _props$hashType;
|
|
664
|
-
var basename = props.basename ? stripTrailingSlash(addLeadingSlash$1(props.basename)) : '';
|
|
665
|
-
var _HashPathCoders$hashT = HashPathCoders[hashType],
|
|
666
|
-
encodePath = _HashPathCoders$hashT.encodePath,
|
|
667
|
-
decodePath = _HashPathCoders$hashT.decodePath;
|
|
668
|
-
function getDOMLocation() {
|
|
669
|
-
var path = decodePath(getHashPath());
|
|
670
|
-
if (basename) path = stripBasename$1(path, basename);
|
|
671
|
-
return createLocation(path);
|
|
672
|
-
}
|
|
673
|
-
var transitionManager = createTransitionManager();
|
|
674
|
-
function setState(nextState) {
|
|
675
|
-
_extends$1(history, nextState);
|
|
676
|
-
history.length = globalHistory.length;
|
|
677
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
678
|
-
}
|
|
679
|
-
var forceNextPop = false;
|
|
680
|
-
var ignorePath = null;
|
|
681
|
-
function locationsAreEqual$$1(a, b) {
|
|
682
|
-
return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash;
|
|
683
|
-
}
|
|
684
|
-
function handleHashChange() {
|
|
685
|
-
var path = getHashPath();
|
|
686
|
-
var encodedPath = encodePath(path);
|
|
687
|
-
if (path !== encodedPath) {
|
|
688
|
-
// Ensure we always have a properly-encoded hash.
|
|
689
|
-
replaceHashPath(encodedPath);
|
|
690
|
-
} else {
|
|
691
|
-
var location = getDOMLocation();
|
|
692
|
-
var prevLocation = history.location;
|
|
693
|
-
if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change.
|
|
694
|
-
|
|
695
|
-
if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace.
|
|
696
|
-
|
|
697
|
-
ignorePath = null;
|
|
698
|
-
handlePop(location);
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
function handlePop(location) {
|
|
702
|
-
if (forceNextPop) {
|
|
703
|
-
forceNextPop = false;
|
|
704
|
-
setState();
|
|
705
|
-
} else {
|
|
706
|
-
var action = 'POP';
|
|
707
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
708
|
-
if (ok) {
|
|
709
|
-
setState({
|
|
710
|
-
action: action,
|
|
711
|
-
location: location
|
|
712
|
-
});
|
|
713
|
-
} else {
|
|
714
|
-
revertPop(location);
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
function revertPop(fromLocation) {
|
|
720
|
-
var toLocation = history.location; // TODO: We could probably make this more reliable by
|
|
721
|
-
// keeping a list of paths we've seen in sessionStorage.
|
|
722
|
-
// Instead, we just default to 0 for paths we don't know.
|
|
723
|
-
|
|
724
|
-
var toIndex = allPaths.lastIndexOf(createPath(toLocation));
|
|
725
|
-
if (toIndex === -1) toIndex = 0;
|
|
726
|
-
var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
|
|
727
|
-
if (fromIndex === -1) fromIndex = 0;
|
|
728
|
-
var delta = toIndex - fromIndex;
|
|
729
|
-
if (delta) {
|
|
730
|
-
forceNextPop = true;
|
|
731
|
-
go(delta);
|
|
732
|
-
}
|
|
733
|
-
} // Ensure the hash is encoded properly before doing anything else.
|
|
734
|
-
|
|
735
|
-
var path = getHashPath();
|
|
736
|
-
var encodedPath = encodePath(path);
|
|
737
|
-
if (path !== encodedPath) replaceHashPath(encodedPath);
|
|
738
|
-
var initialLocation = getDOMLocation();
|
|
739
|
-
var allPaths = [createPath(initialLocation)]; // Public interface
|
|
740
|
-
|
|
741
|
-
function createHref(location) {
|
|
742
|
-
var baseTag = document.querySelector('base');
|
|
743
|
-
var href = '';
|
|
744
|
-
if (baseTag && baseTag.getAttribute('href')) {
|
|
745
|
-
href = stripHash(window.location.href);
|
|
746
|
-
}
|
|
747
|
-
return href + '#' + encodePath(basename + createPath(location));
|
|
748
|
-
}
|
|
749
|
-
function push(path, state) {
|
|
750
|
-
var action = 'PUSH';
|
|
751
|
-
var location = createLocation(path, undefined, undefined, history.location);
|
|
752
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
753
|
-
if (!ok) return;
|
|
754
|
-
var path = createPath(location);
|
|
755
|
-
var encodedPath = encodePath(basename + path);
|
|
756
|
-
var hashChanged = getHashPath() !== encodedPath;
|
|
757
|
-
if (hashChanged) {
|
|
758
|
-
// We cannot tell if a hashchange was caused by a PUSH, so we'd
|
|
759
|
-
// rather setState here and ignore the hashchange. The caveat here
|
|
760
|
-
// is that other hash histories in the page will consider it a POP.
|
|
761
|
-
ignorePath = path;
|
|
762
|
-
pushHashPath(encodedPath);
|
|
763
|
-
var prevIndex = allPaths.lastIndexOf(createPath(history.location));
|
|
764
|
-
var nextPaths = allPaths.slice(0, prevIndex + 1);
|
|
765
|
-
nextPaths.push(path);
|
|
766
|
-
allPaths = nextPaths;
|
|
767
|
-
setState({
|
|
768
|
-
action: action,
|
|
769
|
-
location: location
|
|
770
|
-
});
|
|
771
|
-
} else {
|
|
772
|
-
setState();
|
|
773
|
-
}
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
function replace(path, state) {
|
|
777
|
-
var action = 'REPLACE';
|
|
778
|
-
var location = createLocation(path, undefined, undefined, history.location);
|
|
779
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
780
|
-
if (!ok) return;
|
|
781
|
-
var path = createPath(location);
|
|
782
|
-
var encodedPath = encodePath(basename + path);
|
|
783
|
-
var hashChanged = getHashPath() !== encodedPath;
|
|
784
|
-
if (hashChanged) {
|
|
785
|
-
// We cannot tell if a hashchange was caused by a REPLACE, so we'd
|
|
786
|
-
// rather setState here and ignore the hashchange. The caveat here
|
|
787
|
-
// is that other hash histories in the page will consider it a POP.
|
|
788
|
-
ignorePath = path;
|
|
789
|
-
replaceHashPath(encodedPath);
|
|
790
|
-
}
|
|
791
|
-
var prevIndex = allPaths.indexOf(createPath(history.location));
|
|
792
|
-
if (prevIndex !== -1) allPaths[prevIndex] = path;
|
|
793
|
-
setState({
|
|
794
|
-
action: action,
|
|
795
|
-
location: location
|
|
796
|
-
});
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
function go(n) {
|
|
800
|
-
globalHistory.go(n);
|
|
801
|
-
}
|
|
802
|
-
function goBack() {
|
|
803
|
-
go(-1);
|
|
804
|
-
}
|
|
805
|
-
function goForward() {
|
|
806
|
-
go(1);
|
|
807
|
-
}
|
|
808
|
-
var listenerCount = 0;
|
|
809
|
-
function checkDOMListeners(delta) {
|
|
810
|
-
listenerCount += delta;
|
|
811
|
-
if (listenerCount === 1 && delta === 1) {
|
|
812
|
-
window.addEventListener(HashChangeEvent$1, handleHashChange);
|
|
813
|
-
} else if (listenerCount === 0) {
|
|
814
|
-
window.removeEventListener(HashChangeEvent$1, handleHashChange);
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
var isBlocked = false;
|
|
818
|
-
function block(prompt) {
|
|
819
|
-
if (prompt === void 0) {
|
|
820
|
-
prompt = false;
|
|
821
|
-
}
|
|
822
|
-
var unblock = transitionManager.setPrompt(prompt);
|
|
823
|
-
if (!isBlocked) {
|
|
824
|
-
checkDOMListeners(1);
|
|
825
|
-
isBlocked = true;
|
|
826
|
-
}
|
|
827
|
-
return function () {
|
|
828
|
-
if (isBlocked) {
|
|
829
|
-
isBlocked = false;
|
|
830
|
-
checkDOMListeners(-1);
|
|
831
|
-
}
|
|
832
|
-
return unblock();
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
|
-
function listen(listener) {
|
|
836
|
-
var unlisten = transitionManager.appendListener(listener);
|
|
837
|
-
checkDOMListeners(1);
|
|
838
|
-
return function () {
|
|
839
|
-
checkDOMListeners(-1);
|
|
840
|
-
unlisten();
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
var history = {
|
|
844
|
-
length: globalHistory.length,
|
|
845
|
-
action: 'POP',
|
|
846
|
-
location: initialLocation,
|
|
847
|
-
createHref: createHref,
|
|
848
|
-
push: push,
|
|
849
|
-
replace: replace,
|
|
850
|
-
go: go,
|
|
851
|
-
goBack: goBack,
|
|
852
|
-
goForward: goForward,
|
|
853
|
-
block: block,
|
|
854
|
-
listen: listen
|
|
855
|
-
};
|
|
856
|
-
return history;
|
|
857
|
-
}
|
|
858
|
-
function clamp(n, lowerBound, upperBound) {
|
|
859
|
-
return Math.min(Math.max(n, lowerBound), upperBound);
|
|
860
|
-
}
|
|
861
|
-
/**
|
|
862
|
-
* Creates a history object that stores locations in memory.
|
|
863
|
-
*/
|
|
864
|
-
|
|
865
|
-
function createMemoryHistory(props) {
|
|
866
|
-
if (props === void 0) {
|
|
867
|
-
props = {};
|
|
868
|
-
}
|
|
869
|
-
var _props = props,
|
|
870
|
-
getUserConfirmation = _props.getUserConfirmation,
|
|
871
|
-
_props$initialEntries = _props.initialEntries,
|
|
872
|
-
initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries,
|
|
873
|
-
_props$initialIndex = _props.initialIndex,
|
|
874
|
-
initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex,
|
|
875
|
-
_props$keyLength = _props.keyLength,
|
|
876
|
-
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
|
877
|
-
var transitionManager = createTransitionManager();
|
|
878
|
-
function setState(nextState) {
|
|
879
|
-
_extends$1(history, nextState);
|
|
880
|
-
history.length = history.entries.length;
|
|
881
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
882
|
-
}
|
|
883
|
-
function createKey() {
|
|
884
|
-
return Math.random().toString(36).substr(2, keyLength);
|
|
885
|
-
}
|
|
886
|
-
var index = clamp(initialIndex, 0, initialEntries.length - 1);
|
|
887
|
-
var entries = initialEntries.map(function (entry) {
|
|
888
|
-
return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey());
|
|
889
|
-
}); // Public interface
|
|
890
|
-
|
|
891
|
-
var createHref = createPath;
|
|
892
|
-
function push(path, state) {
|
|
893
|
-
var action = 'PUSH';
|
|
894
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
895
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
896
|
-
if (!ok) return;
|
|
897
|
-
var prevIndex = history.index;
|
|
898
|
-
var nextIndex = prevIndex + 1;
|
|
899
|
-
var nextEntries = history.entries.slice(0);
|
|
900
|
-
if (nextEntries.length > nextIndex) {
|
|
901
|
-
nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location);
|
|
902
|
-
} else {
|
|
903
|
-
nextEntries.push(location);
|
|
904
|
-
}
|
|
905
|
-
setState({
|
|
906
|
-
action: action,
|
|
907
|
-
location: location,
|
|
908
|
-
index: nextIndex,
|
|
909
|
-
entries: nextEntries
|
|
910
|
-
});
|
|
911
|
-
});
|
|
912
|
-
}
|
|
913
|
-
function replace(path, state) {
|
|
914
|
-
var action = 'REPLACE';
|
|
915
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
916
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
917
|
-
if (!ok) return;
|
|
918
|
-
history.entries[history.index] = location;
|
|
919
|
-
setState({
|
|
920
|
-
action: action,
|
|
921
|
-
location: location
|
|
922
|
-
});
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
function go(n) {
|
|
926
|
-
var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);
|
|
927
|
-
var action = 'POP';
|
|
928
|
-
var location = history.entries[nextIndex];
|
|
929
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
930
|
-
if (ok) {
|
|
931
|
-
setState({
|
|
932
|
-
action: action,
|
|
933
|
-
location: location,
|
|
934
|
-
index: nextIndex
|
|
935
|
-
});
|
|
936
|
-
} else {
|
|
937
|
-
// Mimic the behavior of DOM histories by
|
|
938
|
-
// causing a render after a cancelled POP.
|
|
939
|
-
setState();
|
|
940
|
-
}
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
function goBack() {
|
|
944
|
-
go(-1);
|
|
945
|
-
}
|
|
946
|
-
function goForward() {
|
|
947
|
-
go(1);
|
|
948
|
-
}
|
|
949
|
-
function canGo(n) {
|
|
950
|
-
var nextIndex = history.index + n;
|
|
951
|
-
return nextIndex >= 0 && nextIndex < history.entries.length;
|
|
952
|
-
}
|
|
953
|
-
function block(prompt) {
|
|
954
|
-
if (prompt === void 0) {
|
|
955
|
-
prompt = false;
|
|
956
|
-
}
|
|
957
|
-
return transitionManager.setPrompt(prompt);
|
|
958
|
-
}
|
|
959
|
-
function listen(listener) {
|
|
960
|
-
return transitionManager.appendListener(listener);
|
|
961
|
-
}
|
|
962
|
-
var history = {
|
|
963
|
-
length: entries.length,
|
|
964
|
-
action: 'POP',
|
|
965
|
-
location: entries[index],
|
|
966
|
-
index: index,
|
|
967
|
-
entries: entries,
|
|
968
|
-
createHref: createHref,
|
|
969
|
-
push: push,
|
|
970
|
-
replace: replace,
|
|
971
|
-
go: go,
|
|
972
|
-
goBack: goBack,
|
|
973
|
-
goForward: goForward,
|
|
974
|
-
canGo: canGo,
|
|
975
|
-
block: block,
|
|
976
|
-
listen: listen
|
|
977
|
-
};
|
|
978
|
-
return history;
|
|
979
|
-
}
|
|
980
|
-
|
|
981
|
-
function _setPrototypeOf(o, p) {
|
|
982
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
983
|
-
o.__proto__ = p;
|
|
984
|
-
return o;
|
|
985
|
-
};
|
|
986
|
-
return _setPrototypeOf(o, p);
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
function _inheritsLoose(subClass, superClass) {
|
|
990
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
991
|
-
subClass.prototype.constructor = subClass;
|
|
992
|
-
_setPrototypeOf(subClass, superClass);
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
var MAX_SIGNED_31_BIT_INT = 1073741823;
|
|
996
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
|
|
997
|
-
function getUniqueId() {
|
|
998
|
-
var key = '__global_unique_id__';
|
|
999
|
-
return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1;
|
|
1000
|
-
}
|
|
1001
|
-
function objectIs(x, y) {
|
|
1002
|
-
if (x === y) {
|
|
1003
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
1004
|
-
} else {
|
|
1005
|
-
return x !== x && y !== y;
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
function createEventEmitter(value) {
|
|
1009
|
-
var handlers = [];
|
|
1010
|
-
return {
|
|
1011
|
-
on: function on(handler) {
|
|
1012
|
-
handlers.push(handler);
|
|
1013
|
-
},
|
|
1014
|
-
off: function off(handler) {
|
|
1015
|
-
handlers = handlers.filter(function (h) {
|
|
1016
|
-
return h !== handler;
|
|
1017
|
-
});
|
|
1018
|
-
},
|
|
1019
|
-
get: function get() {
|
|
1020
|
-
return value;
|
|
1021
|
-
},
|
|
1022
|
-
set: function set(newValue, changedBits) {
|
|
1023
|
-
value = newValue;
|
|
1024
|
-
handlers.forEach(function (handler) {
|
|
1025
|
-
return handler(value, changedBits);
|
|
1026
|
-
});
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
}
|
|
1030
|
-
function onlyChild(children) {
|
|
1031
|
-
return Array.isArray(children) ? children[0] : children;
|
|
1032
|
-
}
|
|
1033
|
-
function createReactContext(defaultValue, calculateChangedBits) {
|
|
1034
|
-
var _Provider$childContex, _Consumer$contextType;
|
|
1035
|
-
var contextProp = '__create-react-context-' + getUniqueId() + '__';
|
|
1036
|
-
var Provider = /*#__PURE__*/function (_Component) {
|
|
1037
|
-
_inheritsLoose(Provider, _Component);
|
|
1038
|
-
function Provider() {
|
|
1039
|
-
var _this;
|
|
1040
|
-
_this = _Component.apply(this, arguments) || this;
|
|
1041
|
-
_this.emitter = createEventEmitter(_this.props.value);
|
|
1042
|
-
return _this;
|
|
1043
|
-
}
|
|
1044
|
-
var _proto = Provider.prototype;
|
|
1045
|
-
_proto.getChildContext = function getChildContext() {
|
|
1046
|
-
var _ref;
|
|
1047
|
-
return _ref = {}, _ref[contextProp] = this.emitter, _ref;
|
|
1048
|
-
};
|
|
1049
|
-
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1050
|
-
if (this.props.value !== nextProps.value) {
|
|
1051
|
-
var oldValue = this.props.value;
|
|
1052
|
-
var newValue = nextProps.value;
|
|
1053
|
-
var changedBits;
|
|
1054
|
-
if (objectIs(oldValue, newValue)) {
|
|
1055
|
-
changedBits = 0;
|
|
1056
|
-
} else {
|
|
1057
|
-
changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
|
|
1058
|
-
changedBits |= 0;
|
|
1059
|
-
if (changedBits !== 0) {
|
|
1060
|
-
this.emitter.set(nextProps.value, changedBits);
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
};
|
|
1065
|
-
_proto.render = function render() {
|
|
1066
|
-
return this.props.children;
|
|
1067
|
-
};
|
|
1068
|
-
return Provider;
|
|
1069
|
-
}(Component);
|
|
1070
|
-
Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = propTypes.exports.object.isRequired, _Provider$childContex);
|
|
1071
|
-
var Consumer = /*#__PURE__*/function (_Component2) {
|
|
1072
|
-
_inheritsLoose(Consumer, _Component2);
|
|
1073
|
-
function Consumer() {
|
|
1074
|
-
var _this2;
|
|
1075
|
-
_this2 = _Component2.apply(this, arguments) || this;
|
|
1076
|
-
_this2.state = {
|
|
1077
|
-
value: _this2.getValue()
|
|
1078
|
-
};
|
|
1079
|
-
_this2.onUpdate = function (newValue, changedBits) {
|
|
1080
|
-
var observedBits = _this2.observedBits | 0;
|
|
1081
|
-
if ((observedBits & changedBits) !== 0) {
|
|
1082
|
-
_this2.setState({
|
|
1083
|
-
value: _this2.getValue()
|
|
1084
|
-
});
|
|
1085
|
-
}
|
|
1086
|
-
};
|
|
1087
|
-
return _this2;
|
|
1088
|
-
}
|
|
1089
|
-
var _proto2 = Consumer.prototype;
|
|
1090
|
-
_proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1091
|
-
var observedBits = nextProps.observedBits;
|
|
1092
|
-
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
|
|
1093
|
-
};
|
|
1094
|
-
_proto2.componentDidMount = function componentDidMount() {
|
|
1095
|
-
if (this.context[contextProp]) {
|
|
1096
|
-
this.context[contextProp].on(this.onUpdate);
|
|
1097
|
-
}
|
|
1098
|
-
var observedBits = this.props.observedBits;
|
|
1099
|
-
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
|
|
1100
|
-
};
|
|
1101
|
-
_proto2.componentWillUnmount = function componentWillUnmount() {
|
|
1102
|
-
if (this.context[contextProp]) {
|
|
1103
|
-
this.context[contextProp].off(this.onUpdate);
|
|
1104
|
-
}
|
|
1105
|
-
};
|
|
1106
|
-
_proto2.getValue = function getValue() {
|
|
1107
|
-
if (this.context[contextProp]) {
|
|
1108
|
-
return this.context[contextProp].get();
|
|
1109
|
-
} else {
|
|
1110
|
-
return defaultValue;
|
|
1111
|
-
}
|
|
1112
|
-
};
|
|
1113
|
-
_proto2.render = function render() {
|
|
1114
|
-
return onlyChild(this.props.children)(this.state.value);
|
|
1115
|
-
};
|
|
1116
|
-
return Consumer;
|
|
1117
|
-
}(Component);
|
|
1118
|
-
Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = propTypes.exports.object, _Consumer$contextType);
|
|
1119
|
-
return {
|
|
1120
|
-
Provider: Provider,
|
|
1121
|
-
Consumer: Consumer
|
|
1122
|
-
};
|
|
1123
|
-
}
|
|
1124
|
-
var index = React.createContext || createReactContext;
|
|
1125
|
-
|
|
1126
|
-
function _extends() {
|
|
1127
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1128
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1129
|
-
var source = arguments[i];
|
|
1130
|
-
for (var key in source) {
|
|
1131
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1132
|
-
target[key] = source[key];
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
return target;
|
|
1137
|
-
};
|
|
1138
|
-
return _extends.apply(this, arguments);
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
var pathToRegexp$1 = {exports: {}};
|
|
1142
|
-
|
|
1143
|
-
var isarray$1 = Array.isArray || function (arr) {
|
|
1144
|
-
return Object.prototype.toString.call(arr) == '[object Array]';
|
|
1145
|
-
};
|
|
1146
|
-
|
|
1147
|
-
var isarray = isarray$1;
|
|
1148
|
-
|
|
1149
|
-
/**
|
|
1150
|
-
* Expose `pathToRegexp`.
|
|
1151
|
-
*/
|
|
1152
|
-
pathToRegexp$1.exports = pathToRegexp;
|
|
1153
|
-
pathToRegexp$1.exports.parse = parse;
|
|
1154
|
-
pathToRegexp$1.exports.compile = compile;
|
|
1155
|
-
pathToRegexp$1.exports.tokensToFunction = tokensToFunction;
|
|
1156
|
-
pathToRegexp$1.exports.tokensToRegExp = tokensToRegExp;
|
|
1157
|
-
|
|
1158
|
-
/**
|
|
1159
|
-
* The main path matching regexp utility.
|
|
1160
|
-
*
|
|
1161
|
-
* @type {RegExp}
|
|
1162
|
-
*/
|
|
1163
|
-
var PATH_REGEXP = new RegExp([
|
|
1164
|
-
// Match escaped characters that would otherwise appear in future matches.
|
|
1165
|
-
// This allows the user to escape special characters that won't transform.
|
|
1166
|
-
'(\\\\.)',
|
|
1167
|
-
// Match Express-style parameters and un-named parameters with a prefix
|
|
1168
|
-
// and optional suffixes. Matches appear as:
|
|
1169
|
-
//
|
|
1170
|
-
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
|
|
1171
|
-
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
|
|
1172
|
-
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
|
|
1173
|
-
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'].join('|'), 'g');
|
|
1174
|
-
|
|
1175
|
-
/**
|
|
1176
|
-
* Parse a string for the raw tokens.
|
|
1177
|
-
*
|
|
1178
|
-
* @param {string} str
|
|
1179
|
-
* @param {Object=} options
|
|
1180
|
-
* @return {!Array}
|
|
1181
|
-
*/
|
|
1182
|
-
function parse(str, options) {
|
|
1183
|
-
var tokens = [];
|
|
1184
|
-
var key = 0;
|
|
1185
|
-
var index = 0;
|
|
1186
|
-
var path = '';
|
|
1187
|
-
var defaultDelimiter = options && options.delimiter || '/';
|
|
1188
|
-
var res;
|
|
1189
|
-
while ((res = PATH_REGEXP.exec(str)) != null) {
|
|
1190
|
-
var m = res[0];
|
|
1191
|
-
var escaped = res[1];
|
|
1192
|
-
var offset = res.index;
|
|
1193
|
-
path += str.slice(index, offset);
|
|
1194
|
-
index = offset + m.length;
|
|
1195
|
-
|
|
1196
|
-
// Ignore already escaped sequences.
|
|
1197
|
-
if (escaped) {
|
|
1198
|
-
path += escaped[1];
|
|
1199
|
-
continue;
|
|
1200
|
-
}
|
|
1201
|
-
var next = str[index];
|
|
1202
|
-
var prefix = res[2];
|
|
1203
|
-
var name = res[3];
|
|
1204
|
-
var capture = res[4];
|
|
1205
|
-
var group = res[5];
|
|
1206
|
-
var modifier = res[6];
|
|
1207
|
-
var asterisk = res[7];
|
|
1208
|
-
|
|
1209
|
-
// Push the current path onto the tokens.
|
|
1210
|
-
if (path) {
|
|
1211
|
-
tokens.push(path);
|
|
1212
|
-
path = '';
|
|
1213
|
-
}
|
|
1214
|
-
var partial = prefix != null && next != null && next !== prefix;
|
|
1215
|
-
var repeat = modifier === '+' || modifier === '*';
|
|
1216
|
-
var optional = modifier === '?' || modifier === '*';
|
|
1217
|
-
var delimiter = res[2] || defaultDelimiter;
|
|
1218
|
-
var pattern = capture || group;
|
|
1219
|
-
tokens.push({
|
|
1220
|
-
name: name || key++,
|
|
1221
|
-
prefix: prefix || '',
|
|
1222
|
-
delimiter: delimiter,
|
|
1223
|
-
optional: optional,
|
|
1224
|
-
repeat: repeat,
|
|
1225
|
-
partial: partial,
|
|
1226
|
-
asterisk: !!asterisk,
|
|
1227
|
-
pattern: pattern ? escapeGroup(pattern) : asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?'
|
|
1228
|
-
});
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
// Match any characters still remaining.
|
|
1232
|
-
if (index < str.length) {
|
|
1233
|
-
path += str.substr(index);
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
// If the path exists, push it onto the end.
|
|
1237
|
-
if (path) {
|
|
1238
|
-
tokens.push(path);
|
|
1239
|
-
}
|
|
1240
|
-
return tokens;
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
/**
|
|
1244
|
-
* Compile a string to a template function for the path.
|
|
1245
|
-
*
|
|
1246
|
-
* @param {string} str
|
|
1247
|
-
* @param {Object=} options
|
|
1248
|
-
* @return {!function(Object=, Object=)}
|
|
1249
|
-
*/
|
|
1250
|
-
function compile(str, options) {
|
|
1251
|
-
return tokensToFunction(parse(str, options), options);
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
/**
|
|
1255
|
-
* Prettier encoding of URI path segments.
|
|
1256
|
-
*
|
|
1257
|
-
* @param {string}
|
|
1258
|
-
* @return {string}
|
|
1259
|
-
*/
|
|
1260
|
-
function encodeURIComponentPretty(str) {
|
|
1261
|
-
return encodeURI(str).replace(/[\/?#]/g, function (c) {
|
|
1262
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
1263
|
-
});
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
/**
|
|
1267
|
-
* Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
|
|
1268
|
-
*
|
|
1269
|
-
* @param {string}
|
|
1270
|
-
* @return {string}
|
|
1271
|
-
*/
|
|
1272
|
-
function encodeAsterisk(str) {
|
|
1273
|
-
return encodeURI(str).replace(/[?#]/g, function (c) {
|
|
1274
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
1275
|
-
});
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
/**
|
|
1279
|
-
* Expose a method for transforming tokens into the path function.
|
|
1280
|
-
*/
|
|
1281
|
-
function tokensToFunction(tokens, options) {
|
|
1282
|
-
// Compile all the tokens into regexps.
|
|
1283
|
-
var matches = new Array(tokens.length);
|
|
1284
|
-
|
|
1285
|
-
// Compile all the patterns before compilation.
|
|
1286
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1287
|
-
if (_typeof$1(tokens[i]) === 'object') {
|
|
1288
|
-
matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options));
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
return function (obj, opts) {
|
|
1292
|
-
var path = '';
|
|
1293
|
-
var data = obj || {};
|
|
1294
|
-
var options = opts || {};
|
|
1295
|
-
var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
|
|
1296
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1297
|
-
var token = tokens[i];
|
|
1298
|
-
if (typeof token === 'string') {
|
|
1299
|
-
path += token;
|
|
1300
|
-
continue;
|
|
1301
|
-
}
|
|
1302
|
-
var value = data[token.name];
|
|
1303
|
-
var segment;
|
|
1304
|
-
if (value == null) {
|
|
1305
|
-
if (token.optional) {
|
|
1306
|
-
// Prepend partial segment prefixes.
|
|
1307
|
-
if (token.partial) {
|
|
1308
|
-
path += token.prefix;
|
|
1309
|
-
}
|
|
1310
|
-
continue;
|
|
1311
|
-
} else {
|
|
1312
|
-
throw new TypeError('Expected "' + token.name + '" to be defined');
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
if (isarray(value)) {
|
|
1316
|
-
if (!token.repeat) {
|
|
1317
|
-
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`');
|
|
1318
|
-
}
|
|
1319
|
-
if (value.length === 0) {
|
|
1320
|
-
if (token.optional) {
|
|
1321
|
-
continue;
|
|
1322
|
-
} else {
|
|
1323
|
-
throw new TypeError('Expected "' + token.name + '" to not be empty');
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
for (var j = 0; j < value.length; j++) {
|
|
1327
|
-
segment = encode(value[j]);
|
|
1328
|
-
if (!matches[i].test(segment)) {
|
|
1329
|
-
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`');
|
|
1330
|
-
}
|
|
1331
|
-
path += (j === 0 ? token.prefix : token.delimiter) + segment;
|
|
1332
|
-
}
|
|
1333
|
-
continue;
|
|
1334
|
-
}
|
|
1335
|
-
segment = token.asterisk ? encodeAsterisk(value) : encode(value);
|
|
1336
|
-
if (!matches[i].test(segment)) {
|
|
1337
|
-
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"');
|
|
1338
|
-
}
|
|
1339
|
-
path += token.prefix + segment;
|
|
1340
|
-
}
|
|
1341
|
-
return path;
|
|
1342
|
-
};
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
/**
|
|
1346
|
-
* Escape a regular expression string.
|
|
1347
|
-
*
|
|
1348
|
-
* @param {string} str
|
|
1349
|
-
* @return {string}
|
|
1350
|
-
*/
|
|
1351
|
-
function escapeString(str) {
|
|
1352
|
-
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1');
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
/**
|
|
1356
|
-
* Escape the capturing group by escaping special characters and meaning.
|
|
1357
|
-
*
|
|
1358
|
-
* @param {string} group
|
|
1359
|
-
* @return {string}
|
|
1360
|
-
*/
|
|
1361
|
-
function escapeGroup(group) {
|
|
1362
|
-
return group.replace(/([=!:$\/()])/g, '\\$1');
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
/**
|
|
1366
|
-
* Attach the keys as a property of the regexp.
|
|
1367
|
-
*
|
|
1368
|
-
* @param {!RegExp} re
|
|
1369
|
-
* @param {Array} keys
|
|
1370
|
-
* @return {!RegExp}
|
|
1371
|
-
*/
|
|
1372
|
-
function attachKeys(re, keys) {
|
|
1373
|
-
re.keys = keys;
|
|
1374
|
-
return re;
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
/**
|
|
1378
|
-
* Get the flags for a regexp from the options.
|
|
1379
|
-
*
|
|
1380
|
-
* @param {Object} options
|
|
1381
|
-
* @return {string}
|
|
1382
|
-
*/
|
|
1383
|
-
function flags(options) {
|
|
1384
|
-
return options && options.sensitive ? '' : 'i';
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
/**
|
|
1388
|
-
* Pull out keys from a regexp.
|
|
1389
|
-
*
|
|
1390
|
-
* @param {!RegExp} path
|
|
1391
|
-
* @param {!Array} keys
|
|
1392
|
-
* @return {!RegExp}
|
|
1393
|
-
*/
|
|
1394
|
-
function regexpToRegexp(path, keys) {
|
|
1395
|
-
// Use a negative lookahead to match only capturing groups.
|
|
1396
|
-
var groups = path.source.match(/\((?!\?)/g);
|
|
1397
|
-
if (groups) {
|
|
1398
|
-
for (var i = 0; i < groups.length; i++) {
|
|
1399
|
-
keys.push({
|
|
1400
|
-
name: i,
|
|
1401
|
-
prefix: null,
|
|
1402
|
-
delimiter: null,
|
|
1403
|
-
optional: false,
|
|
1404
|
-
repeat: false,
|
|
1405
|
-
partial: false,
|
|
1406
|
-
asterisk: false,
|
|
1407
|
-
pattern: null
|
|
1408
|
-
});
|
|
1409
|
-
}
|
|
1410
|
-
}
|
|
1411
|
-
return attachKeys(path, keys);
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
/**
|
|
1415
|
-
* Transform an array into a regexp.
|
|
1416
|
-
*
|
|
1417
|
-
* @param {!Array} path
|
|
1418
|
-
* @param {Array} keys
|
|
1419
|
-
* @param {!Object} options
|
|
1420
|
-
* @return {!RegExp}
|
|
1421
|
-
*/
|
|
1422
|
-
function arrayToRegexp(path, keys, options) {
|
|
1423
|
-
var parts = [];
|
|
1424
|
-
for (var i = 0; i < path.length; i++) {
|
|
1425
|
-
parts.push(pathToRegexp(path[i], keys, options).source);
|
|
1426
|
-
}
|
|
1427
|
-
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
|
|
1428
|
-
return attachKeys(regexp, keys);
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
/**
|
|
1432
|
-
* Create a path regexp from string input.
|
|
1433
|
-
*
|
|
1434
|
-
* @param {string} path
|
|
1435
|
-
* @param {!Array} keys
|
|
1436
|
-
* @param {!Object} options
|
|
1437
|
-
* @return {!RegExp}
|
|
1438
|
-
*/
|
|
1439
|
-
function stringToRegexp(path, keys, options) {
|
|
1440
|
-
return tokensToRegExp(parse(path, options), keys, options);
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
/**
|
|
1444
|
-
* Expose a function for taking tokens and returning a RegExp.
|
|
1445
|
-
*
|
|
1446
|
-
* @param {!Array} tokens
|
|
1447
|
-
* @param {(Array|Object)=} keys
|
|
1448
|
-
* @param {Object=} options
|
|
1449
|
-
* @return {!RegExp}
|
|
1450
|
-
*/
|
|
1451
|
-
function tokensToRegExp(tokens, keys, options) {
|
|
1452
|
-
if (!isarray(keys)) {
|
|
1453
|
-
options = /** @type {!Object} */keys || options;
|
|
1454
|
-
keys = [];
|
|
1455
|
-
}
|
|
1456
|
-
options = options || {};
|
|
1457
|
-
var strict = options.strict;
|
|
1458
|
-
var end = options.end !== false;
|
|
1459
|
-
var route = '';
|
|
1460
|
-
|
|
1461
|
-
// Iterate over the tokens and create our regexp string.
|
|
1462
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1463
|
-
var token = tokens[i];
|
|
1464
|
-
if (typeof token === 'string') {
|
|
1465
|
-
route += escapeString(token);
|
|
1466
|
-
} else {
|
|
1467
|
-
var prefix = escapeString(token.prefix);
|
|
1468
|
-
var capture = '(?:' + token.pattern + ')';
|
|
1469
|
-
keys.push(token);
|
|
1470
|
-
if (token.repeat) {
|
|
1471
|
-
capture += '(?:' + prefix + capture + ')*';
|
|
1472
|
-
}
|
|
1473
|
-
if (token.optional) {
|
|
1474
|
-
if (!token.partial) {
|
|
1475
|
-
capture = '(?:' + prefix + '(' + capture + '))?';
|
|
1476
|
-
} else {
|
|
1477
|
-
capture = prefix + '(' + capture + ')?';
|
|
1478
|
-
}
|
|
1479
|
-
} else {
|
|
1480
|
-
capture = prefix + '(' + capture + ')';
|
|
1481
|
-
}
|
|
1482
|
-
route += capture;
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
var delimiter = escapeString(options.delimiter || '/');
|
|
1486
|
-
var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
|
|
1487
|
-
|
|
1488
|
-
// In non-strict mode we allow a slash at the end of match. If the path to
|
|
1489
|
-
// match already ends with a slash, we remove it for consistency. The slash
|
|
1490
|
-
// is valid at the end of a path match, not in the middle. This is important
|
|
1491
|
-
// in non-ending mode, where "/test/" shouldn't match "/test//route".
|
|
1492
|
-
if (!strict) {
|
|
1493
|
-
route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
|
|
1494
|
-
}
|
|
1495
|
-
if (end) {
|
|
1496
|
-
route += '$';
|
|
1497
|
-
} else {
|
|
1498
|
-
// In non-ending mode, we need the capturing groups to match as much as
|
|
1499
|
-
// possible by using a positive lookahead to the end or next path segment.
|
|
1500
|
-
route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
|
|
1501
|
-
}
|
|
1502
|
-
return attachKeys(new RegExp('^' + route, flags(options)), keys);
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
/**
|
|
1506
|
-
* Normalize the given path string, returning a regular expression.
|
|
1507
|
-
*
|
|
1508
|
-
* An empty array can be passed in for the keys, which will hold the
|
|
1509
|
-
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
|
|
1510
|
-
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
|
|
1511
|
-
*
|
|
1512
|
-
* @param {(string|RegExp|Array)} path
|
|
1513
|
-
* @param {(Array|Object)=} keys
|
|
1514
|
-
* @param {Object=} options
|
|
1515
|
-
* @return {!RegExp}
|
|
1516
|
-
*/
|
|
1517
|
-
function pathToRegexp(path, keys, options) {
|
|
1518
|
-
if (!isarray(keys)) {
|
|
1519
|
-
options = /** @type {!Object} */keys || options;
|
|
1520
|
-
keys = [];
|
|
1521
|
-
}
|
|
1522
|
-
options = options || {};
|
|
1523
|
-
if (path instanceof RegExp) {
|
|
1524
|
-
return regexpToRegexp(path, /** @type {!Array} */keys);
|
|
1525
|
-
}
|
|
1526
|
-
if (isarray(path)) {
|
|
1527
|
-
return arrayToRegexp( /** @type {!Array} */path, /** @type {!Array} */keys, options);
|
|
1528
|
-
}
|
|
1529
|
-
return stringToRegexp( /** @type {string} */path, /** @type {!Array} */keys, options);
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
var reactIs$1 = {exports: {}};
|
|
1533
|
-
|
|
1534
|
-
var reactIs_production_min = {};
|
|
1535
|
-
|
|
1536
|
-
var b = "function" === typeof Symbol && Symbol["for"],
|
|
1537
|
-
c = b ? Symbol["for"]("react.element") : 60103,
|
|
1538
|
-
d = b ? Symbol["for"]("react.portal") : 60106,
|
|
1539
|
-
e = b ? Symbol["for"]("react.fragment") : 60107,
|
|
1540
|
-
f = b ? Symbol["for"]("react.strict_mode") : 60108,
|
|
1541
|
-
g = b ? Symbol["for"]("react.profiler") : 60114,
|
|
1542
|
-
h = b ? Symbol["for"]("react.provider") : 60109,
|
|
1543
|
-
k = b ? Symbol["for"]("react.context") : 60110,
|
|
1544
|
-
l = b ? Symbol["for"]("react.async_mode") : 60111,
|
|
1545
|
-
m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
|
|
1546
|
-
n = b ? Symbol["for"]("react.forward_ref") : 60112,
|
|
1547
|
-
p = b ? Symbol["for"]("react.suspense") : 60113,
|
|
1548
|
-
q = b ? Symbol["for"]("react.suspense_list") : 60120,
|
|
1549
|
-
r = b ? Symbol["for"]("react.memo") : 60115,
|
|
1550
|
-
t = b ? Symbol["for"]("react.lazy") : 60116,
|
|
1551
|
-
v = b ? Symbol["for"]("react.block") : 60121,
|
|
1552
|
-
w = b ? Symbol["for"]("react.fundamental") : 60117,
|
|
1553
|
-
x = b ? Symbol["for"]("react.responder") : 60118,
|
|
1554
|
-
y = b ? Symbol["for"]("react.scope") : 60119;
|
|
1555
|
-
function z(a) {
|
|
1556
|
-
if ("object" === _typeof$1(a) && null !== a) {
|
|
1557
|
-
var u = a.$$typeof;
|
|
1558
|
-
switch (u) {
|
|
1559
|
-
case c:
|
|
1560
|
-
switch (a = a.type, a) {
|
|
1561
|
-
case l:
|
|
1562
|
-
case m:
|
|
1563
|
-
case e:
|
|
1564
|
-
case g:
|
|
1565
|
-
case f:
|
|
1566
|
-
case p:
|
|
1567
|
-
return a;
|
|
1568
|
-
default:
|
|
1569
|
-
switch (a = a && a.$$typeof, a) {
|
|
1570
|
-
case k:
|
|
1571
|
-
case n:
|
|
1572
|
-
case t:
|
|
1573
|
-
case r:
|
|
1574
|
-
case h:
|
|
1575
|
-
return a;
|
|
1576
|
-
default:
|
|
1577
|
-
return u;
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
case d:
|
|
1581
|
-
return u;
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
function A(a) {
|
|
1586
|
-
return z(a) === m;
|
|
1587
|
-
}
|
|
1588
|
-
reactIs_production_min.AsyncMode = l;
|
|
1589
|
-
reactIs_production_min.ConcurrentMode = m;
|
|
1590
|
-
reactIs_production_min.ContextConsumer = k;
|
|
1591
|
-
reactIs_production_min.ContextProvider = h;
|
|
1592
|
-
reactIs_production_min.Element = c;
|
|
1593
|
-
reactIs_production_min.ForwardRef = n;
|
|
1594
|
-
reactIs_production_min.Fragment = e;
|
|
1595
|
-
reactIs_production_min.Lazy = t;
|
|
1596
|
-
reactIs_production_min.Memo = r;
|
|
1597
|
-
reactIs_production_min.Portal = d;
|
|
1598
|
-
reactIs_production_min.Profiler = g;
|
|
1599
|
-
reactIs_production_min.StrictMode = f;
|
|
1600
|
-
reactIs_production_min.Suspense = p;
|
|
1601
|
-
reactIs_production_min.isAsyncMode = function (a) {
|
|
1602
|
-
return A(a) || z(a) === l;
|
|
1603
|
-
};
|
|
1604
|
-
reactIs_production_min.isConcurrentMode = A;
|
|
1605
|
-
reactIs_production_min.isContextConsumer = function (a) {
|
|
1606
|
-
return z(a) === k;
|
|
1607
|
-
};
|
|
1608
|
-
reactIs_production_min.isContextProvider = function (a) {
|
|
1609
|
-
return z(a) === h;
|
|
1610
|
-
};
|
|
1611
|
-
reactIs_production_min.isElement = function (a) {
|
|
1612
|
-
return "object" === _typeof$1(a) && null !== a && a.$$typeof === c;
|
|
1613
|
-
};
|
|
1614
|
-
reactIs_production_min.isForwardRef = function (a) {
|
|
1615
|
-
return z(a) === n;
|
|
1616
|
-
};
|
|
1617
|
-
reactIs_production_min.isFragment = function (a) {
|
|
1618
|
-
return z(a) === e;
|
|
1619
|
-
};
|
|
1620
|
-
reactIs_production_min.isLazy = function (a) {
|
|
1621
|
-
return z(a) === t;
|
|
1622
|
-
};
|
|
1623
|
-
reactIs_production_min.isMemo = function (a) {
|
|
1624
|
-
return z(a) === r;
|
|
1625
|
-
};
|
|
1626
|
-
reactIs_production_min.isPortal = function (a) {
|
|
1627
|
-
return z(a) === d;
|
|
1628
|
-
};
|
|
1629
|
-
reactIs_production_min.isProfiler = function (a) {
|
|
1630
|
-
return z(a) === g;
|
|
1631
|
-
};
|
|
1632
|
-
reactIs_production_min.isStrictMode = function (a) {
|
|
1633
|
-
return z(a) === f;
|
|
1634
|
-
};
|
|
1635
|
-
reactIs_production_min.isSuspense = function (a) {
|
|
1636
|
-
return z(a) === p;
|
|
1637
|
-
};
|
|
1638
|
-
reactIs_production_min.isValidElementType = function (a) {
|
|
1639
|
-
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);
|
|
1640
|
-
};
|
|
1641
|
-
reactIs_production_min.typeOf = z;
|
|
1642
|
-
|
|
1643
|
-
(function (module) {
|
|
1644
|
-
|
|
1645
|
-
{
|
|
1646
|
-
module.exports = reactIs_production_min;
|
|
1647
|
-
}
|
|
1648
|
-
})(reactIs$1);
|
|
1649
|
-
|
|
1650
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
1651
|
-
if (source == null) return {};
|
|
1652
|
-
var target = {};
|
|
1653
|
-
var sourceKeys = Object.keys(source);
|
|
1654
|
-
var key, i;
|
|
1655
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
1656
|
-
key = sourceKeys[i];
|
|
1657
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1658
|
-
target[key] = source[key];
|
|
1659
|
-
}
|
|
1660
|
-
return target;
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
var reactIs = reactIs$1.exports;
|
|
1664
|
-
var FORWARD_REF_STATICS = {
|
|
1665
|
-
'$$typeof': true,
|
|
1666
|
-
render: true,
|
|
1667
|
-
defaultProps: true,
|
|
1668
|
-
displayName: true,
|
|
1669
|
-
propTypes: true
|
|
1670
|
-
};
|
|
1671
|
-
var MEMO_STATICS = {
|
|
1672
|
-
'$$typeof': true,
|
|
1673
|
-
compare: true,
|
|
1674
|
-
defaultProps: true,
|
|
1675
|
-
displayName: true,
|
|
1676
|
-
propTypes: true,
|
|
1677
|
-
type: true
|
|
1678
|
-
};
|
|
1679
|
-
var TYPE_STATICS = {};
|
|
1680
|
-
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
1681
|
-
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
|
|
1682
|
-
|
|
1683
|
-
// TODO: Replace with React.createContext once we can assume React 16+
|
|
1684
|
-
|
|
1685
|
-
var createNamedContext = function createNamedContext(name) {
|
|
1686
|
-
var context = index();
|
|
1687
|
-
context.displayName = name;
|
|
1688
|
-
return context;
|
|
1689
|
-
};
|
|
1690
|
-
var historyContext = /*#__PURE__*/createNamedContext("Router-History");
|
|
1691
|
-
var context = /*#__PURE__*/createNamedContext("Router");
|
|
1692
|
-
|
|
1693
|
-
/**
|
|
1694
|
-
* The public API for putting history on context.
|
|
1695
|
-
*/
|
|
1696
|
-
|
|
1697
|
-
var Router = /*#__PURE__*/function (_React$Component) {
|
|
1698
|
-
_inheritsLoose$1(Router, _React$Component);
|
|
1699
|
-
Router.computeRootMatch = function computeRootMatch(pathname) {
|
|
1700
|
-
return {
|
|
1701
|
-
path: "/",
|
|
1702
|
-
url: "/",
|
|
1703
|
-
params: {},
|
|
1704
|
-
isExact: pathname === "/"
|
|
1705
|
-
};
|
|
1706
|
-
};
|
|
1707
|
-
function Router(props) {
|
|
1708
|
-
var _this;
|
|
1709
|
-
_this = _React$Component.call(this, props) || this;
|
|
1710
|
-
_this.state = {
|
|
1711
|
-
location: props.history.location
|
|
1712
|
-
}; // This is a bit of a hack. We have to start listening for location
|
|
1713
|
-
// changes here in the constructor in case there are any <Redirect>s
|
|
1714
|
-
// on the initial render. If there are, they will replace/push when
|
|
1715
|
-
// they mount and since cDM fires in children before parents, we may
|
|
1716
|
-
// get a new location before the <Router> is mounted.
|
|
1717
|
-
|
|
1718
|
-
_this._isMounted = false;
|
|
1719
|
-
_this._pendingLocation = null;
|
|
1720
|
-
if (!props.staticContext) {
|
|
1721
|
-
_this.unlisten = props.history.listen(function (location) {
|
|
1722
|
-
_this._pendingLocation = location;
|
|
1723
|
-
});
|
|
1724
|
-
}
|
|
1725
|
-
return _this;
|
|
1726
|
-
}
|
|
1727
|
-
var _proto = Router.prototype;
|
|
1728
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
1729
|
-
var _this2 = this;
|
|
1730
|
-
this._isMounted = true;
|
|
1731
|
-
if (this.unlisten) {
|
|
1732
|
-
// Any pre-mount location changes have been captured at
|
|
1733
|
-
// this point, so unregister the listener.
|
|
1734
|
-
this.unlisten();
|
|
1735
|
-
}
|
|
1736
|
-
if (!this.props.staticContext) {
|
|
1737
|
-
this.unlisten = this.props.history.listen(function (location) {
|
|
1738
|
-
if (_this2._isMounted) {
|
|
1739
|
-
_this2.setState({
|
|
1740
|
-
location: location
|
|
1741
|
-
});
|
|
1742
|
-
}
|
|
1743
|
-
});
|
|
1744
|
-
}
|
|
1745
|
-
if (this._pendingLocation) {
|
|
1746
|
-
this.setState({
|
|
1747
|
-
location: this._pendingLocation
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1750
|
-
};
|
|
1751
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1752
|
-
if (this.unlisten) {
|
|
1753
|
-
this.unlisten();
|
|
1754
|
-
this._isMounted = false;
|
|
1755
|
-
this._pendingLocation = null;
|
|
1756
|
-
}
|
|
1757
|
-
};
|
|
1758
|
-
_proto.render = function render() {
|
|
1759
|
-
return /*#__PURE__*/React.createElement(context.Provider, {
|
|
1760
|
-
value: {
|
|
1761
|
-
history: this.props.history,
|
|
1762
|
-
location: this.state.location,
|
|
1763
|
-
match: Router.computeRootMatch(this.state.location.pathname),
|
|
1764
|
-
staticContext: this.props.staticContext
|
|
1765
|
-
}
|
|
1766
|
-
}, /*#__PURE__*/React.createElement(historyContext.Provider, {
|
|
1767
|
-
children: this.props.children || null,
|
|
1768
|
-
value: this.props.history
|
|
1769
|
-
}));
|
|
1770
|
-
};
|
|
1771
|
-
return Router;
|
|
1772
|
-
}(React.Component);
|
|
1773
|
-
|
|
1774
|
-
/**
|
|
1775
|
-
* The public API for a <Router> that stores location in memory.
|
|
1776
|
-
*/
|
|
1777
|
-
|
|
1778
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1779
|
-
_inheritsLoose$1(MemoryRouter, _React$Component);
|
|
1780
|
-
function MemoryRouter() {
|
|
1781
|
-
var _this;
|
|
1782
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1783
|
-
args[_key] = arguments[_key];
|
|
1784
|
-
}
|
|
1785
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
1786
|
-
_this.history = createMemoryHistory(_this.props);
|
|
1787
|
-
return _this;
|
|
1788
|
-
}
|
|
1789
|
-
var _proto = MemoryRouter.prototype;
|
|
1790
|
-
_proto.render = function render() {
|
|
1791
|
-
return /*#__PURE__*/React.createElement(Router, {
|
|
1792
|
-
history: this.history,
|
|
1793
|
-
children: this.props.children
|
|
1794
|
-
});
|
|
1795
|
-
};
|
|
1796
|
-
return MemoryRouter;
|
|
1797
|
-
})(React.Component);
|
|
1798
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1799
|
-
_inheritsLoose$1(Lifecycle, _React$Component);
|
|
1800
|
-
function Lifecycle() {
|
|
1801
|
-
return _React$Component.apply(this, arguments) || this;
|
|
1802
|
-
}
|
|
1803
|
-
var _proto = Lifecycle.prototype;
|
|
1804
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
1805
|
-
if (this.props.onMount) this.props.onMount.call(this, this);
|
|
1806
|
-
};
|
|
1807
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
1808
|
-
if (this.props.onUpdate) this.props.onUpdate.call(this, this, prevProps);
|
|
1809
|
-
};
|
|
1810
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1811
|
-
if (this.props.onUnmount) this.props.onUnmount.call(this, this);
|
|
1812
|
-
};
|
|
1813
|
-
_proto.render = function render() {
|
|
1814
|
-
return null;
|
|
1815
|
-
};
|
|
1816
|
-
return Lifecycle;
|
|
1817
|
-
})(React.Component);
|
|
1818
|
-
var cache$1 = {};
|
|
1819
|
-
var cacheLimit$1 = 10000;
|
|
1820
|
-
var cacheCount$1 = 0;
|
|
1821
|
-
function compilePath$1(path, options) {
|
|
1822
|
-
var cacheKey = "" + options.end + options.strict + options.sensitive;
|
|
1823
|
-
var pathCache = cache$1[cacheKey] || (cache$1[cacheKey] = {});
|
|
1824
|
-
if (pathCache[path]) return pathCache[path];
|
|
1825
|
-
var keys = [];
|
|
1826
|
-
var regexp = pathToRegexp$1.exports(path, keys, options);
|
|
1827
|
-
var result = {
|
|
1828
|
-
regexp: regexp,
|
|
1829
|
-
keys: keys
|
|
1830
|
-
};
|
|
1831
|
-
if (cacheCount$1 < cacheLimit$1) {
|
|
1832
|
-
pathCache[path] = result;
|
|
1833
|
-
cacheCount$1++;
|
|
1834
|
-
}
|
|
1835
|
-
return result;
|
|
1836
|
-
}
|
|
1837
|
-
/**
|
|
1838
|
-
* Public API for matching a URL pathname to a path.
|
|
1839
|
-
*/
|
|
1840
|
-
|
|
1841
|
-
function matchPath(pathname, options) {
|
|
1842
|
-
if (options === void 0) {
|
|
1843
|
-
options = {};
|
|
1844
|
-
}
|
|
1845
|
-
if (typeof options === "string" || Array.isArray(options)) {
|
|
1846
|
-
options = {
|
|
1847
|
-
path: options
|
|
1848
|
-
};
|
|
1849
|
-
}
|
|
1850
|
-
var _options = options,
|
|
1851
|
-
path = _options.path,
|
|
1852
|
-
_options$exact = _options.exact,
|
|
1853
|
-
exact = _options$exact === void 0 ? false : _options$exact,
|
|
1854
|
-
_options$strict = _options.strict,
|
|
1855
|
-
strict = _options$strict === void 0 ? false : _options$strict,
|
|
1856
|
-
_options$sensitive = _options.sensitive,
|
|
1857
|
-
sensitive = _options$sensitive === void 0 ? false : _options$sensitive;
|
|
1858
|
-
var paths = [].concat(path);
|
|
1859
|
-
return paths.reduce(function (matched, path) {
|
|
1860
|
-
if (!path && path !== "") return null;
|
|
1861
|
-
if (matched) return matched;
|
|
1862
|
-
var _compilePath = compilePath$1(path, {
|
|
1863
|
-
end: exact,
|
|
1864
|
-
strict: strict,
|
|
1865
|
-
sensitive: sensitive
|
|
1866
|
-
}),
|
|
1867
|
-
regexp = _compilePath.regexp,
|
|
1868
|
-
keys = _compilePath.keys;
|
|
1869
|
-
var match = regexp.exec(pathname);
|
|
1870
|
-
if (!match) return null;
|
|
1871
|
-
var url = match[0],
|
|
1872
|
-
values = match.slice(1);
|
|
1873
|
-
var isExact = pathname === url;
|
|
1874
|
-
if (exact && !isExact) return null;
|
|
1875
|
-
return {
|
|
1876
|
-
path: path,
|
|
1877
|
-
// the path used to match
|
|
1878
|
-
url: path === "/" && url === "" ? "/" : url,
|
|
1879
|
-
// the matched portion of the URL
|
|
1880
|
-
isExact: isExact,
|
|
1881
|
-
// whether or not we matched exactly
|
|
1882
|
-
params: keys.reduce(function (memo, key, index) {
|
|
1883
|
-
memo[key.name] = values[index];
|
|
1884
|
-
return memo;
|
|
1885
|
-
}, {})
|
|
1886
|
-
};
|
|
1887
|
-
}, null);
|
|
1888
|
-
}
|
|
1889
|
-
function isEmptyChildren(children) {
|
|
1890
|
-
return React.Children.count(children) === 0;
|
|
1891
|
-
}
|
|
1892
|
-
/**
|
|
1893
|
-
* The public API for matching a single path and rendering.
|
|
1894
|
-
*/
|
|
1895
|
-
|
|
1896
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1897
|
-
_inheritsLoose$1(Route, _React$Component);
|
|
1898
|
-
function Route() {
|
|
1899
|
-
return _React$Component.apply(this, arguments) || this;
|
|
1900
|
-
}
|
|
1901
|
-
var _proto = Route.prototype;
|
|
1902
|
-
_proto.render = function render() {
|
|
1903
|
-
var _this = this;
|
|
1904
|
-
return /*#__PURE__*/React.createElement(context.Consumer, null, function (context$1) {
|
|
1905
|
-
!context$1 ? invariant(false) : void 0;
|
|
1906
|
-
var location = _this.props.location || context$1.location;
|
|
1907
|
-
var match = _this.props.computedMatch ? _this.props.computedMatch // <Switch> already computed the match for us
|
|
1908
|
-
: _this.props.path ? matchPath(location.pathname, _this.props) : context$1.match;
|
|
1909
|
-
var props = _extends({}, context$1, {
|
|
1910
|
-
location: location,
|
|
1911
|
-
match: match
|
|
1912
|
-
});
|
|
1913
|
-
var _this$props = _this.props,
|
|
1914
|
-
children = _this$props.children,
|
|
1915
|
-
component = _this$props.component,
|
|
1916
|
-
render = _this$props.render; // Preact uses an empty array as children by
|
|
1917
|
-
// default, so use null if that's the case.
|
|
1918
|
-
|
|
1919
|
-
if (Array.isArray(children) && isEmptyChildren(children)) {
|
|
1920
|
-
children = null;
|
|
1921
|
-
}
|
|
1922
|
-
return /*#__PURE__*/React.createElement(context.Provider, {
|
|
1923
|
-
value: props
|
|
1924
|
-
}, props.match ? children ? typeof children === "function" ? children(props) : children : component ? /*#__PURE__*/React.createElement(component, props) : render ? render(props) : null : typeof children === "function" ? children(props) : null);
|
|
1925
|
-
});
|
|
1926
|
-
};
|
|
1927
|
-
return Route;
|
|
1928
|
-
})(React.Component);
|
|
1929
|
-
function addLeadingSlash(path) {
|
|
1930
|
-
return path.charAt(0) === "/" ? path : "/" + path;
|
|
1931
|
-
}
|
|
1932
|
-
function addBasename(basename, location) {
|
|
1933
|
-
if (!basename) return location;
|
|
1934
|
-
return _extends({}, location, {
|
|
1935
|
-
pathname: addLeadingSlash(basename) + location.pathname
|
|
1936
|
-
});
|
|
1937
|
-
}
|
|
1938
|
-
function stripBasename(basename, location) {
|
|
1939
|
-
if (!basename) return location;
|
|
1940
|
-
var base = addLeadingSlash(basename);
|
|
1941
|
-
if (location.pathname.indexOf(base) !== 0) return location;
|
|
1942
|
-
return _extends({}, location, {
|
|
1943
|
-
pathname: location.pathname.substr(base.length)
|
|
1944
|
-
});
|
|
1945
|
-
}
|
|
1946
|
-
function createURL(location) {
|
|
1947
|
-
return typeof location === "string" ? location : createPath(location);
|
|
1948
|
-
}
|
|
1949
|
-
function staticHandler(methodName) {
|
|
1950
|
-
return function () {
|
|
1951
|
-
invariant(false);
|
|
1952
|
-
};
|
|
1953
|
-
}
|
|
1954
|
-
function noop() {}
|
|
1955
|
-
/**
|
|
1956
|
-
* The public top-level API for a "static" <Router>, so-called because it
|
|
1957
|
-
* can't actually change the current location. Instead, it just records
|
|
1958
|
-
* location changes in a context object. Useful mainly in testing and
|
|
1959
|
-
* server-rendering scenarios.
|
|
1960
|
-
*/
|
|
1961
|
-
|
|
1962
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1963
|
-
_inheritsLoose$1(StaticRouter, _React$Component);
|
|
1964
|
-
function StaticRouter() {
|
|
1965
|
-
var _this;
|
|
1966
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1967
|
-
args[_key] = arguments[_key];
|
|
1968
|
-
}
|
|
1969
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
1970
|
-
_this.handlePush = function (location) {
|
|
1971
|
-
return _this.navigateTo(location, "PUSH");
|
|
1972
|
-
};
|
|
1973
|
-
_this.handleReplace = function (location) {
|
|
1974
|
-
return _this.navigateTo(location, "REPLACE");
|
|
1975
|
-
};
|
|
1976
|
-
_this.handleListen = function () {
|
|
1977
|
-
return noop;
|
|
1978
|
-
};
|
|
1979
|
-
_this.handleBlock = function () {
|
|
1980
|
-
return noop;
|
|
1981
|
-
};
|
|
1982
|
-
return _this;
|
|
1983
|
-
}
|
|
1984
|
-
var _proto = StaticRouter.prototype;
|
|
1985
|
-
_proto.navigateTo = function navigateTo(location, action) {
|
|
1986
|
-
var _this$props = this.props,
|
|
1987
|
-
_this$props$basename = _this$props.basename,
|
|
1988
|
-
basename = _this$props$basename === void 0 ? "" : _this$props$basename,
|
|
1989
|
-
_this$props$context = _this$props.context,
|
|
1990
|
-
context = _this$props$context === void 0 ? {} : _this$props$context;
|
|
1991
|
-
context.action = action;
|
|
1992
|
-
context.location = addBasename(basename, createLocation(location));
|
|
1993
|
-
context.url = createURL(context.location);
|
|
1994
|
-
};
|
|
1995
|
-
_proto.render = function render() {
|
|
1996
|
-
var _this$props2 = this.props,
|
|
1997
|
-
_this$props2$basename = _this$props2.basename,
|
|
1998
|
-
basename = _this$props2$basename === void 0 ? "" : _this$props2$basename,
|
|
1999
|
-
_this$props2$context = _this$props2.context,
|
|
2000
|
-
context = _this$props2$context === void 0 ? {} : _this$props2$context,
|
|
2001
|
-
_this$props2$location = _this$props2.location,
|
|
2002
|
-
location = _this$props2$location === void 0 ? "/" : _this$props2$location,
|
|
2003
|
-
rest = _objectWithoutPropertiesLoose(_this$props2, ["basename", "context", "location"]);
|
|
2004
|
-
var history = {
|
|
2005
|
-
createHref: function createHref(path) {
|
|
2006
|
-
return addLeadingSlash(basename + createURL(path));
|
|
2007
|
-
},
|
|
2008
|
-
action: "POP",
|
|
2009
|
-
location: stripBasename(basename, createLocation(location)),
|
|
2010
|
-
push: this.handlePush,
|
|
2011
|
-
replace: this.handleReplace,
|
|
2012
|
-
go: staticHandler(),
|
|
2013
|
-
goBack: staticHandler(),
|
|
2014
|
-
goForward: staticHandler(),
|
|
2015
|
-
listen: this.handleListen,
|
|
2016
|
-
block: this.handleBlock
|
|
2017
|
-
};
|
|
2018
|
-
return /*#__PURE__*/React.createElement(Router, _extends({}, rest, {
|
|
2019
|
-
history: history,
|
|
2020
|
-
staticContext: context
|
|
2021
|
-
}));
|
|
2022
|
-
};
|
|
2023
|
-
return StaticRouter;
|
|
2024
|
-
})(React.Component);
|
|
2025
|
-
|
|
2026
|
-
/**
|
|
2027
|
-
* The public API for rendering the first <Route> that matches.
|
|
2028
|
-
*/
|
|
2029
|
-
|
|
2030
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
2031
|
-
_inheritsLoose$1(Switch, _React$Component);
|
|
2032
|
-
function Switch() {
|
|
2033
|
-
return _React$Component.apply(this, arguments) || this;
|
|
2034
|
-
}
|
|
2035
|
-
var _proto = Switch.prototype;
|
|
2036
|
-
_proto.render = function render() {
|
|
2037
|
-
var _this = this;
|
|
2038
|
-
return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
|
|
2039
|
-
!context ? invariant(false) : void 0;
|
|
2040
|
-
var location = _this.props.location || context.location;
|
|
2041
|
-
var element, match; // We use React.Children.forEach instead of React.Children.toArray().find()
|
|
2042
|
-
// here because toArray adds keys to all child elements and we do not want
|
|
2043
|
-
// to trigger an unmount/remount for two <Route>s that render the same
|
|
2044
|
-
// component at different URLs.
|
|
2045
|
-
|
|
2046
|
-
React.Children.forEach(_this.props.children, function (child) {
|
|
2047
|
-
if (match == null && /*#__PURE__*/React.isValidElement(child)) {
|
|
2048
|
-
element = child;
|
|
2049
|
-
var path = child.props.path || child.props.from;
|
|
2050
|
-
match = path ? matchPath(location.pathname, _extends({}, child.props, {
|
|
2051
|
-
path: path
|
|
2052
|
-
})) : context.match;
|
|
2053
|
-
}
|
|
2054
|
-
});
|
|
2055
|
-
return match ? /*#__PURE__*/React.cloneElement(element, {
|
|
2056
|
-
location: location,
|
|
2057
|
-
computedMatch: match
|
|
2058
|
-
}) : null;
|
|
2059
|
-
});
|
|
2060
|
-
};
|
|
2061
|
-
return Switch;
|
|
2062
|
-
})(React.Component);
|
|
2063
|
-
React.useContext;
|
|
2064
|
-
|
|
2065
|
-
/**
|
|
2066
|
-
* The public API for a <Router> that uses HTML5 history.
|
|
2067
|
-
*/
|
|
2068
|
-
|
|
2069
|
-
var BrowserRouter = /*#__PURE__*/function (_React$Component) {
|
|
2070
|
-
_inheritsLoose$1(BrowserRouter, _React$Component);
|
|
2071
|
-
function BrowserRouter() {
|
|
2072
|
-
var _this;
|
|
2073
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2074
|
-
args[_key] = arguments[_key];
|
|
2075
|
-
}
|
|
2076
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
2077
|
-
_this.history = createBrowserHistory(_this.props);
|
|
2078
|
-
return _this;
|
|
2079
|
-
}
|
|
2080
|
-
var _proto = BrowserRouter.prototype;
|
|
2081
|
-
_proto.render = function render() {
|
|
2082
|
-
return /*#__PURE__*/React.createElement(Router, {
|
|
2083
|
-
history: this.history,
|
|
2084
|
-
children: this.props.children
|
|
2085
|
-
});
|
|
2086
|
-
};
|
|
2087
|
-
return BrowserRouter;
|
|
2088
|
-
}(React.Component);
|
|
2089
|
-
|
|
2090
|
-
/**
|
|
2091
|
-
* The public API for a <Router> that uses window.location.hash.
|
|
2092
|
-
*/
|
|
1
|
+
import React, { useRef, useEffect, useMemo, useState, memo } from 'react';
|
|
2
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
3
|
+
import { shallow } from 'zustand/shallow';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { useFormikContext, Formik, Form, useField, FieldArray, ErrorMessage } from 'formik';
|
|
6
|
+
import { findBy, noop, isNotEmpty, toLabelAndValue, removeBy } from '@bigbinary/neeto-cist';
|
|
7
|
+
import { ActionBlock, Textarea, MultiEmailInput, Input as Input$2, Select as Select$1, Radio } from '@bigbinary/neetoui/formik';
|
|
8
|
+
import { t as t$1 } from 'i18next';
|
|
9
|
+
import * as yup from 'yup';
|
|
10
|
+
import { isEditorEmpty, FormikEditor } from '@bigbinary/neeto-editor';
|
|
11
|
+
import { withImmutableActions, useDebounce, useHotKeys } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
12
|
+
import { create } from 'zustand';
|
|
13
|
+
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
14
|
+
import { Typography, Button, Pane, DatePicker, Dropdown as Dropdown$1, Input as Input$1, Checkbox, Select, Label } from '@bigbinary/neetoui';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { Down, Up, Check, Search, Close, Delete, Plus, Refresh, Eye } from '@bigbinary/neeto-icons';
|
|
17
|
+
import { pluck, isNotNil, assocPath, toLower, isEmpty, isNil, without, append, pipe, partition } from 'ramda';
|
|
18
|
+
import { joinHyphenCase } from '@bigbinary/neeto-commons-frontend/utils';
|
|
2093
19
|
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
function HashRouter() {
|
|
2097
|
-
var _this;
|
|
2098
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2099
|
-
args[_key] = arguments[_key];
|
|
2100
|
-
}
|
|
2101
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
2102
|
-
_this.history = createHashHistory(_this.props);
|
|
2103
|
-
return _this;
|
|
2104
|
-
}
|
|
2105
|
-
var _proto = HashRouter.prototype;
|
|
2106
|
-
_proto.render = function render() {
|
|
2107
|
-
return /*#__PURE__*/React.createElement(Router, {
|
|
2108
|
-
history: this.history,
|
|
2109
|
-
children: this.props.children
|
|
2110
|
-
});
|
|
2111
|
-
};
|
|
2112
|
-
return HashRouter;
|
|
2113
|
-
})(React.Component);
|
|
2114
|
-
var resolveToLocation = function resolveToLocation(to, currentLocation) {
|
|
2115
|
-
return typeof to === "function" ? to(currentLocation) : to;
|
|
2116
|
-
};
|
|
2117
|
-
var normalizeToLocation = function normalizeToLocation(to, currentLocation) {
|
|
2118
|
-
return typeof to === "string" ? createLocation(to, null, null, currentLocation) : to;
|
|
2119
|
-
};
|
|
2120
|
-
var forwardRefShim = function forwardRefShim(C) {
|
|
2121
|
-
return C;
|
|
2122
|
-
};
|
|
2123
|
-
var forwardRef = React.forwardRef;
|
|
2124
|
-
if (typeof forwardRef === "undefined") {
|
|
2125
|
-
forwardRef = forwardRefShim;
|
|
2126
|
-
}
|
|
2127
|
-
function isModifiedEvent(event) {
|
|
2128
|
-
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
20
|
+
function _objectDestructuringEmpty(obj) {
|
|
21
|
+
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
2129
22
|
}
|
|
2130
|
-
var LinkAnchor = forwardRef(function (_ref, forwardedRef) {
|
|
2131
|
-
var innerRef = _ref.innerRef,
|
|
2132
|
-
navigate = _ref.navigate,
|
|
2133
|
-
_onClick = _ref.onClick,
|
|
2134
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["innerRef", "navigate", "onClick"]);
|
|
2135
|
-
var target = rest.target;
|
|
2136
|
-
var props = _extends({}, rest, {
|
|
2137
|
-
onClick: function onClick(event) {
|
|
2138
|
-
try {
|
|
2139
|
-
if (_onClick) _onClick(event);
|
|
2140
|
-
} catch (ex) {
|
|
2141
|
-
event.preventDefault();
|
|
2142
|
-
throw ex;
|
|
2143
|
-
}
|
|
2144
|
-
if (!event.defaultPrevented &&
|
|
2145
|
-
// onClick prevented default
|
|
2146
|
-
event.button === 0 && (
|
|
2147
|
-
// ignore everything but left clicks
|
|
2148
|
-
!target || target === "_self") &&
|
|
2149
|
-
// let browser handle "target=_blank" etc.
|
|
2150
|
-
!isModifiedEvent(event) // ignore clicks with modifier keys
|
|
2151
|
-
) {
|
|
2152
|
-
event.preventDefault();
|
|
2153
|
-
navigate();
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2156
|
-
}); // React 15 compat
|
|
2157
|
-
|
|
2158
|
-
if (forwardRefShim !== forwardRef) {
|
|
2159
|
-
props.ref = forwardedRef || innerRef;
|
|
2160
|
-
} else {
|
|
2161
|
-
props.ref = innerRef;
|
|
2162
|
-
}
|
|
2163
|
-
/* eslint-disable-next-line jsx-a11y/anchor-has-content */
|
|
2164
|
-
|
|
2165
|
-
return /*#__PURE__*/React.createElement("a", props);
|
|
2166
|
-
});
|
|
2167
|
-
/**
|
|
2168
|
-
* The public API for rendering a history-aware <a>.
|
|
2169
|
-
*/
|
|
2170
23
|
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
component = _ref2$component === void 0 ? LinkAnchor : _ref2$component,
|
|
2174
|
-
replace = _ref2.replace,
|
|
2175
|
-
to = _ref2.to,
|
|
2176
|
-
innerRef = _ref2.innerRef,
|
|
2177
|
-
rest = _objectWithoutPropertiesLoose(_ref2, ["component", "replace", "to", "innerRef"]);
|
|
2178
|
-
return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
|
|
2179
|
-
!context ? invariant(false) : void 0;
|
|
2180
|
-
var history = context.history;
|
|
2181
|
-
var location = normalizeToLocation(resolveToLocation(to, context.location), context.location);
|
|
2182
|
-
var href = location ? history.createHref(location) : "";
|
|
2183
|
-
var props = _extends({}, rest, {
|
|
2184
|
-
href: href,
|
|
2185
|
-
navigate: function navigate() {
|
|
2186
|
-
var location = resolveToLocation(to, context.location);
|
|
2187
|
-
var isDuplicateNavigation = createPath(context.location) === createPath(normalizeToLocation(location));
|
|
2188
|
-
var method = replace || isDuplicateNavigation ? history.replace : history.push;
|
|
2189
|
-
method(location);
|
|
2190
|
-
}
|
|
2191
|
-
}); // React 15 compat
|
|
24
|
+
function _typeof$1(obj) {
|
|
25
|
+
"@babel/helpers - typeof";
|
|
2192
26
|
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
return /*#__PURE__*/React.createElement(component, props);
|
|
2199
|
-
});
|
|
2200
|
-
});
|
|
2201
|
-
var forwardRefShim$1 = function forwardRefShim(C) {
|
|
2202
|
-
return C;
|
|
2203
|
-
};
|
|
2204
|
-
var forwardRef$1 = React.forwardRef;
|
|
2205
|
-
if (typeof forwardRef$1 === "undefined") {
|
|
2206
|
-
forwardRef$1 = forwardRefShim$1;
|
|
2207
|
-
}
|
|
2208
|
-
function joinClassnames() {
|
|
2209
|
-
for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2210
|
-
classnames[_key] = arguments[_key];
|
|
2211
|
-
}
|
|
2212
|
-
return classnames.filter(function (i) {
|
|
2213
|
-
return i;
|
|
2214
|
-
}).join(" ");
|
|
27
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
28
|
+
return typeof obj;
|
|
29
|
+
} : function (obj) {
|
|
30
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
31
|
+
}, _typeof$1(obj);
|
|
2215
32
|
}
|
|
2216
|
-
/**
|
|
2217
|
-
* A <Link> wrapper that knows if it's "active" or not.
|
|
2218
|
-
*/
|
|
2219
|
-
|
|
2220
|
-
forwardRef$1(function (_ref, forwardedRef) {
|
|
2221
|
-
var _ref$ariaCurrent = _ref["aria-current"],
|
|
2222
|
-
ariaCurrent = _ref$ariaCurrent === void 0 ? "page" : _ref$ariaCurrent,
|
|
2223
|
-
_ref$activeClassName = _ref.activeClassName,
|
|
2224
|
-
activeClassName = _ref$activeClassName === void 0 ? "active" : _ref$activeClassName,
|
|
2225
|
-
activeStyle = _ref.activeStyle,
|
|
2226
|
-
classNameProp = _ref.className,
|
|
2227
|
-
exact = _ref.exact,
|
|
2228
|
-
isActiveProp = _ref.isActive,
|
|
2229
|
-
locationProp = _ref.location,
|
|
2230
|
-
sensitive = _ref.sensitive,
|
|
2231
|
-
strict = _ref.strict,
|
|
2232
|
-
styleProp = _ref.style,
|
|
2233
|
-
to = _ref.to,
|
|
2234
|
-
innerRef = _ref.innerRef,
|
|
2235
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "sensitive", "strict", "style", "to", "innerRef"]);
|
|
2236
|
-
return /*#__PURE__*/React.createElement(context.Consumer, null, function (context) {
|
|
2237
|
-
!context ? invariant(false) : void 0;
|
|
2238
|
-
var currentLocation = locationProp || context.location;
|
|
2239
|
-
var toLocation = normalizeToLocation(resolveToLocation(to, currentLocation), currentLocation);
|
|
2240
|
-
var path = toLocation.pathname; // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
|
|
2241
|
-
|
|
2242
|
-
var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
|
2243
|
-
var match = escapedPath ? matchPath(currentLocation.pathname, {
|
|
2244
|
-
path: escapedPath,
|
|
2245
|
-
exact: exact,
|
|
2246
|
-
sensitive: sensitive,
|
|
2247
|
-
strict: strict
|
|
2248
|
-
}) : null;
|
|
2249
|
-
var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
|
|
2250
|
-
var className = typeof classNameProp === "function" ? classNameProp(isActive) : classNameProp;
|
|
2251
|
-
var style = typeof styleProp === "function" ? styleProp(isActive) : styleProp;
|
|
2252
|
-
if (isActive) {
|
|
2253
|
-
className = joinClassnames(className, activeClassName);
|
|
2254
|
-
style = _extends({}, style, activeStyle);
|
|
2255
|
-
}
|
|
2256
|
-
var props = _extends({
|
|
2257
|
-
"aria-current": isActive && ariaCurrent || null,
|
|
2258
|
-
className: className,
|
|
2259
|
-
style: style,
|
|
2260
|
-
to: toLocation
|
|
2261
|
-
}, rest); // React 15 compat
|
|
2262
|
-
|
|
2263
|
-
if (forwardRefShim$1 !== forwardRef$1) {
|
|
2264
|
-
props.ref = forwardedRef || innerRef;
|
|
2265
|
-
} else {
|
|
2266
|
-
props.innerRef = innerRef;
|
|
2267
|
-
}
|
|
2268
|
-
return /*#__PURE__*/React.createElement(Link, props);
|
|
2269
|
-
});
|
|
2270
|
-
});
|
|
2271
33
|
|
|
2272
34
|
function _toPrimitive(input, hint) {
|
|
2273
35
|
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
@@ -2300,6 +62,19 @@ function _defineProperty(obj, key, value) {
|
|
|
2300
62
|
return obj;
|
|
2301
63
|
}
|
|
2302
64
|
|
|
65
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
66
|
+
if (source == null) return {};
|
|
67
|
+
var target = {};
|
|
68
|
+
var sourceKeys = Object.keys(source);
|
|
69
|
+
var key, i;
|
|
70
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
71
|
+
key = sourceKeys[i];
|
|
72
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
73
|
+
target[key] = source[key];
|
|
74
|
+
}
|
|
75
|
+
return target;
|
|
76
|
+
}
|
|
77
|
+
|
|
2303
78
|
function _objectWithoutProperties(source, excluded) {
|
|
2304
79
|
if (source == null) return {};
|
|
2305
80
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
@@ -2316,389 +91,106 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
2316
91
|
return target;
|
|
2317
92
|
}
|
|
2318
93
|
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
} catch (error) {
|
|
2324
|
-
reject(error);
|
|
2325
|
-
return;
|
|
2326
|
-
}
|
|
2327
|
-
if (info.done) {
|
|
2328
|
-
resolve(value);
|
|
2329
|
-
} else {
|
|
2330
|
-
Promise.resolve(value).then(_next, _throw);
|
|
2331
|
-
}
|
|
2332
|
-
}
|
|
2333
|
-
function _asyncToGenerator(fn) {
|
|
2334
|
-
return function () {
|
|
2335
|
-
var self = this,
|
|
2336
|
-
args = arguments;
|
|
2337
|
-
return new Promise(function (resolve, reject) {
|
|
2338
|
-
var gen = fn.apply(self, args);
|
|
2339
|
-
function _next(value) {
|
|
2340
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2341
|
-
}
|
|
2342
|
-
function _throw(err) {
|
|
2343
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2344
|
-
}
|
|
2345
|
-
_next(undefined);
|
|
2346
|
-
});
|
|
2347
|
-
};
|
|
94
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
95
|
+
|
|
96
|
+
function getDefaultExportFromCjs (x) {
|
|
97
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2348
98
|
}
|
|
2349
99
|
|
|
2350
|
-
var
|
|
100
|
+
var propTypes = {exports: {}};
|
|
2351
101
|
|
|
2352
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
104
|
+
*
|
|
105
|
+
* This source code is licensed under the MIT license found in the
|
|
106
|
+
* LICENSE file in the root directory of this source tree.
|
|
107
|
+
*/
|
|
2353
108
|
|
|
2354
|
-
|
|
2355
|
-
function _typeof(obj) {
|
|
2356
|
-
"@babel/helpers - typeof";
|
|
2357
|
-
|
|
2358
|
-
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
2359
|
-
return typeof obj;
|
|
2360
|
-
} : function (obj) {
|
|
2361
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2362
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
2363
|
-
}
|
|
2364
|
-
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
2365
|
-
})(_typeof);
|
|
109
|
+
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
2366
110
|
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
hasOwn = Op.hasOwnProperty,
|
|
2378
|
-
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
2379
|
-
obj[key] = desc.value;
|
|
2380
|
-
},
|
|
2381
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
2382
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
2383
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
2384
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
2385
|
-
function define(obj, key, value) {
|
|
2386
|
-
return Object.defineProperty(obj, key, {
|
|
2387
|
-
value: value,
|
|
2388
|
-
enumerable: !0,
|
|
2389
|
-
configurable: !0,
|
|
2390
|
-
writable: !0
|
|
2391
|
-
}), obj[key];
|
|
2392
|
-
}
|
|
2393
|
-
try {
|
|
2394
|
-
define({}, "");
|
|
2395
|
-
} catch (err) {
|
|
2396
|
-
define = function define(obj, key, value) {
|
|
2397
|
-
return obj[key] = value;
|
|
2398
|
-
};
|
|
2399
|
-
}
|
|
2400
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
2401
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
2402
|
-
generator = Object.create(protoGenerator.prototype),
|
|
2403
|
-
context = new Context(tryLocsList || []);
|
|
2404
|
-
return defineProperty(generator, "_invoke", {
|
|
2405
|
-
value: makeInvokeMethod(innerFn, self, context)
|
|
2406
|
-
}), generator;
|
|
2407
|
-
}
|
|
2408
|
-
function tryCatch(fn, obj, arg) {
|
|
2409
|
-
try {
|
|
2410
|
-
return {
|
|
2411
|
-
type: "normal",
|
|
2412
|
-
arg: fn.call(obj, arg)
|
|
2413
|
-
};
|
|
2414
|
-
} catch (err) {
|
|
2415
|
-
return {
|
|
2416
|
-
type: "throw",
|
|
2417
|
-
arg: err
|
|
2418
|
-
};
|
|
2419
|
-
}
|
|
2420
|
-
}
|
|
2421
|
-
exports.wrap = wrap;
|
|
2422
|
-
var ContinueSentinel = {};
|
|
2423
|
-
function Generator() {}
|
|
2424
|
-
function GeneratorFunction() {}
|
|
2425
|
-
function GeneratorFunctionPrototype() {}
|
|
2426
|
-
var IteratorPrototype = {};
|
|
2427
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
2428
|
-
return this;
|
|
2429
|
-
});
|
|
2430
|
-
var getProto = Object.getPrototypeOf,
|
|
2431
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
2432
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
2433
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
2434
|
-
function defineIteratorMethods(prototype) {
|
|
2435
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
2436
|
-
define(prototype, method, function (arg) {
|
|
2437
|
-
return this._invoke(method, arg);
|
|
2438
|
-
});
|
|
2439
|
-
});
|
|
2440
|
-
}
|
|
2441
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
2442
|
-
function invoke(method, arg, resolve, reject) {
|
|
2443
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
2444
|
-
if ("throw" !== record.type) {
|
|
2445
|
-
var result = record.arg,
|
|
2446
|
-
value = result.value;
|
|
2447
|
-
return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
2448
|
-
invoke("next", value, resolve, reject);
|
|
2449
|
-
}, function (err) {
|
|
2450
|
-
invoke("throw", err, resolve, reject);
|
|
2451
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
2452
|
-
result.value = unwrapped, resolve(result);
|
|
2453
|
-
}, function (error) {
|
|
2454
|
-
return invoke("throw", error, resolve, reject);
|
|
2455
|
-
});
|
|
2456
|
-
}
|
|
2457
|
-
reject(record.arg);
|
|
2458
|
-
}
|
|
2459
|
-
var previousPromise;
|
|
2460
|
-
defineProperty(this, "_invoke", {
|
|
2461
|
-
value: function value(method, arg) {
|
|
2462
|
-
function callInvokeWithMethodAndArg() {
|
|
2463
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
2464
|
-
invoke(method, arg, resolve, reject);
|
|
2465
|
-
});
|
|
2466
|
-
}
|
|
2467
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
2468
|
-
}
|
|
2469
|
-
});
|
|
2470
|
-
}
|
|
2471
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
2472
|
-
var state = "suspendedStart";
|
|
2473
|
-
return function (method, arg) {
|
|
2474
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
2475
|
-
if ("completed" === state) {
|
|
2476
|
-
if ("throw" === method) throw arg;
|
|
2477
|
-
return doneResult();
|
|
2478
|
-
}
|
|
2479
|
-
for (context.method = method, context.arg = arg;;) {
|
|
2480
|
-
var delegate = context.delegate;
|
|
2481
|
-
if (delegate) {
|
|
2482
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
2483
|
-
if (delegateResult) {
|
|
2484
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
2485
|
-
return delegateResult;
|
|
2486
|
-
}
|
|
2487
|
-
}
|
|
2488
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
2489
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
2490
|
-
context.dispatchException(context.arg);
|
|
2491
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
2492
|
-
state = "executing";
|
|
2493
|
-
var record = tryCatch(innerFn, self, context);
|
|
2494
|
-
if ("normal" === record.type) {
|
|
2495
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
2496
|
-
return {
|
|
2497
|
-
value: record.arg,
|
|
2498
|
-
done: context.done
|
|
2499
|
-
};
|
|
2500
|
-
}
|
|
2501
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
2502
|
-
}
|
|
2503
|
-
};
|
|
2504
|
-
}
|
|
2505
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
2506
|
-
var methodName = context.method,
|
|
2507
|
-
method = delegate.iterator[methodName];
|
|
2508
|
-
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;
|
|
2509
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
2510
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
2511
|
-
var info = record.arg;
|
|
2512
|
-
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);
|
|
2513
|
-
}
|
|
2514
|
-
function pushTryEntry(locs) {
|
|
2515
|
-
var entry = {
|
|
2516
|
-
tryLoc: locs[0]
|
|
2517
|
-
};
|
|
2518
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
2519
|
-
}
|
|
2520
|
-
function resetTryEntry(entry) {
|
|
2521
|
-
var record = entry.completion || {};
|
|
2522
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
2523
|
-
}
|
|
2524
|
-
function Context(tryLocsList) {
|
|
2525
|
-
this.tryEntries = [{
|
|
2526
|
-
tryLoc: "root"
|
|
2527
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
2528
|
-
}
|
|
2529
|
-
function values(iterable) {
|
|
2530
|
-
if (iterable) {
|
|
2531
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
2532
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
2533
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
2534
|
-
if (!isNaN(iterable.length)) {
|
|
2535
|
-
var i = -1,
|
|
2536
|
-
next = function next() {
|
|
2537
|
-
for (; ++i < iterable.length;) {
|
|
2538
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
2539
|
-
}
|
|
2540
|
-
return next.value = undefined, next.done = !0, next;
|
|
2541
|
-
};
|
|
2542
|
-
return next.next = next;
|
|
2543
|
-
}
|
|
2544
|
-
}
|
|
2545
|
-
return {
|
|
2546
|
-
next: doneResult
|
|
2547
|
-
};
|
|
2548
|
-
}
|
|
2549
|
-
function doneResult() {
|
|
2550
|
-
return {
|
|
2551
|
-
value: undefined,
|
|
2552
|
-
done: !0
|
|
2553
|
-
};
|
|
2554
|
-
}
|
|
2555
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
2556
|
-
value: GeneratorFunctionPrototype,
|
|
2557
|
-
configurable: !0
|
|
2558
|
-
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
2559
|
-
value: GeneratorFunction,
|
|
2560
|
-
configurable: !0
|
|
2561
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
2562
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
2563
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
2564
|
-
}, exports.mark = function (genFun) {
|
|
2565
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
2566
|
-
}, exports.awrap = function (arg) {
|
|
2567
|
-
return {
|
|
2568
|
-
__await: arg
|
|
2569
|
-
};
|
|
2570
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
2571
|
-
return this;
|
|
2572
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
2573
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
2574
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
2575
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
2576
|
-
return result.done ? result.value : iter.next();
|
|
2577
|
-
});
|
|
2578
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
2579
|
-
return this;
|
|
2580
|
-
}), define(Gp, "toString", function () {
|
|
2581
|
-
return "[object Generator]";
|
|
2582
|
-
}), exports.keys = function (val) {
|
|
2583
|
-
var object = Object(val),
|
|
2584
|
-
keys = [];
|
|
2585
|
-
for (var key in object) {
|
|
2586
|
-
keys.push(key);
|
|
2587
|
-
}
|
|
2588
|
-
return keys.reverse(), function next() {
|
|
2589
|
-
for (; keys.length;) {
|
|
2590
|
-
var key = keys.pop();
|
|
2591
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
2592
|
-
}
|
|
2593
|
-
return next.done = !0, next;
|
|
2594
|
-
};
|
|
2595
|
-
}, exports.values = values, Context.prototype = {
|
|
2596
|
-
constructor: Context,
|
|
2597
|
-
reset: function reset(skipTempReset) {
|
|
2598
|
-
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) {
|
|
2599
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
2600
|
-
}
|
|
2601
|
-
},
|
|
2602
|
-
stop: function stop() {
|
|
2603
|
-
this.done = !0;
|
|
2604
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
2605
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
2606
|
-
return this.rval;
|
|
2607
|
-
},
|
|
2608
|
-
dispatchException: function dispatchException(exception) {
|
|
2609
|
-
if (this.done) throw exception;
|
|
2610
|
-
var context = this;
|
|
2611
|
-
function handle(loc, caught) {
|
|
2612
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
2613
|
-
}
|
|
2614
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2615
|
-
var entry = this.tryEntries[i],
|
|
2616
|
-
record = entry.completion;
|
|
2617
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
2618
|
-
if (entry.tryLoc <= this.prev) {
|
|
2619
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
2620
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
2621
|
-
if (hasCatch && hasFinally) {
|
|
2622
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
2623
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
2624
|
-
} else if (hasCatch) {
|
|
2625
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
2626
|
-
} else {
|
|
2627
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
2628
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
2629
|
-
}
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
},
|
|
2633
|
-
abrupt: function abrupt(type, arg) {
|
|
2634
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2635
|
-
var entry = this.tryEntries[i];
|
|
2636
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
2637
|
-
var finallyEntry = entry;
|
|
2638
|
-
break;
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
2642
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
2643
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
2644
|
-
},
|
|
2645
|
-
complete: function complete(record, afterLoc) {
|
|
2646
|
-
if ("throw" === record.type) throw record.arg;
|
|
2647
|
-
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;
|
|
2648
|
-
},
|
|
2649
|
-
finish: function finish(finallyLoc) {
|
|
2650
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2651
|
-
var entry = this.tryEntries[i];
|
|
2652
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
2653
|
-
}
|
|
2654
|
-
},
|
|
2655
|
-
"catch": function _catch(tryLoc) {
|
|
2656
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2657
|
-
var entry = this.tryEntries[i];
|
|
2658
|
-
if (entry.tryLoc === tryLoc) {
|
|
2659
|
-
var record = entry.completion;
|
|
2660
|
-
if ("throw" === record.type) {
|
|
2661
|
-
var thrown = record.arg;
|
|
2662
|
-
resetTryEntry(entry);
|
|
2663
|
-
}
|
|
2664
|
-
return thrown;
|
|
2665
|
-
}
|
|
2666
|
-
}
|
|
2667
|
-
throw new Error("illegal catch attempt");
|
|
2668
|
-
},
|
|
2669
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
2670
|
-
return this.delegate = {
|
|
2671
|
-
iterator: values(iterable),
|
|
2672
|
-
resultName: resultName,
|
|
2673
|
-
nextLoc: nextLoc
|
|
2674
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
2675
|
-
}
|
|
2676
|
-
}, exports;
|
|
2677
|
-
}
|
|
2678
|
-
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
2679
|
-
})(regeneratorRuntime$1);
|
|
111
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
115
|
+
*
|
|
116
|
+
* This source code is licensed under the MIT license found in the
|
|
117
|
+
* LICENSE file in the root directory of this source tree.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
2680
121
|
|
|
2681
|
-
|
|
122
|
+
function emptyFunction() {}
|
|
123
|
+
function emptyFunctionWithReset() {}
|
|
124
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
2682
125
|
|
|
2683
|
-
var
|
|
2684
|
-
|
|
126
|
+
var factoryWithThrowingShims = function() {
|
|
127
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
128
|
+
if (secret === ReactPropTypesSecret) {
|
|
129
|
+
// It is still safe when called from React.
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
var err = new Error(
|
|
133
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
134
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
135
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
136
|
+
);
|
|
137
|
+
err.name = 'Invariant Violation';
|
|
138
|
+
throw err;
|
|
139
|
+
} shim.isRequired = shim;
|
|
140
|
+
function getShim() {
|
|
141
|
+
return shim;
|
|
142
|
+
} // Important!
|
|
143
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
144
|
+
var ReactPropTypes = {
|
|
145
|
+
array: shim,
|
|
146
|
+
bigint: shim,
|
|
147
|
+
bool: shim,
|
|
148
|
+
func: shim,
|
|
149
|
+
number: shim,
|
|
150
|
+
object: shim,
|
|
151
|
+
string: shim,
|
|
152
|
+
symbol: shim,
|
|
2685
153
|
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
154
|
+
any: shim,
|
|
155
|
+
arrayOf: getShim,
|
|
156
|
+
element: shim,
|
|
157
|
+
elementType: shim,
|
|
158
|
+
instanceOf: getShim,
|
|
159
|
+
node: shim,
|
|
160
|
+
objectOf: getShim,
|
|
161
|
+
oneOf: getShim,
|
|
162
|
+
oneOfType: getShim,
|
|
163
|
+
shape: getShim,
|
|
164
|
+
exact: getShim,
|
|
165
|
+
|
|
166
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
167
|
+
resetWarningCache: emptyFunction
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
171
|
+
|
|
172
|
+
return ReactPropTypes;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
177
|
+
*
|
|
178
|
+
* This source code is licensed under the MIT license found in the
|
|
179
|
+
* LICENSE file in the root directory of this source tree.
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
{
|
|
183
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
184
|
+
// http://fb.me/prop-types-in-prod
|
|
185
|
+
propTypes.exports = factoryWithThrowingShims();
|
|
2695
186
|
}
|
|
2696
187
|
|
|
188
|
+
var propTypesExports = propTypes.exports;
|
|
189
|
+
var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
|
190
|
+
|
|
2697
191
|
function _arrayLikeToArray(arr, len) {
|
|
2698
192
|
if (len == null || len > arr.length) len = arr.length;
|
|
2699
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
2700
|
-
arr2[i] = arr[i];
|
|
2701
|
-
}
|
|
193
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
2702
194
|
return arr2;
|
|
2703
195
|
}
|
|
2704
196
|
|
|
@@ -2926,7 +418,7 @@ var getConditionsSchema = function getConditionsSchema(element) {
|
|
|
2926
418
|
}))
|
|
2927
419
|
});
|
|
2928
420
|
};
|
|
2929
|
-
var getActionsSchema = function getActionsSchema(element) {
|
|
421
|
+
var getActionsSchema = function getActionsSchema(element, customData) {
|
|
2930
422
|
var actionOptions = element.actionOptions,
|
|
2931
423
|
_element$componentPro5 = element.componentProps,
|
|
2932
424
|
componentProps = _element$componentPro5 === void 0 ? {} : _element$componentPro5;
|
|
@@ -2991,7 +483,7 @@ var getActionsSchema = function getActionsSchema(element) {
|
|
|
2991
483
|
value: yup.string().required(t$1("neetoRules.validations.required.body"))
|
|
2992
484
|
});
|
|
2993
485
|
} else if (selectedAction !== null && selectedAction !== void 0 && selectedAction.component) {
|
|
2994
|
-
return selectedAction.validation;
|
|
486
|
+
return typeof selectedAction.validation === "function" ? selectedAction.validation(customData) : selectedAction.validation;
|
|
2995
487
|
}
|
|
2996
488
|
return schema;
|
|
2997
489
|
})
|
|
@@ -3009,14 +501,14 @@ var getSchemaForArray = function getSchemaForArray(element) {
|
|
|
3009
501
|
then: yup.array().min(1, t$1("neetoRules.validations.atLeastOneValue")).required(t$1("neetoRules.validations.atLeastOneValue"))
|
|
3010
502
|
});
|
|
3011
503
|
};
|
|
3012
|
-
var getSchemaForElement = function getSchemaForElement(element) {
|
|
3013
|
-
return VALIDATION_SCHEMA[element.type](element);
|
|
504
|
+
var getSchemaForElement = function getSchemaForElement(element, customData) {
|
|
505
|
+
return VALIDATION_SCHEMA[element.type](element, customData);
|
|
3014
506
|
};
|
|
3015
|
-
var getValidationSchema = function getValidationSchema(data) {
|
|
507
|
+
var getValidationSchema = function getValidationSchema(data, customData) {
|
|
3016
508
|
var fieldKeys = Object.keys(data);
|
|
3017
509
|
var schema = fieldKeys.reduce(function (acc, key) {
|
|
3018
510
|
return _objectSpread$6(_objectSpread$6({}, acc), {}, _defineProperty({}, key, yup.object({
|
|
3019
|
-
value: getSchemaForElement(data[key])
|
|
511
|
+
value: getSchemaForElement(data[key], customData)
|
|
3020
512
|
})));
|
|
3021
513
|
}, {});
|
|
3022
514
|
return yup.object(schema);
|
|
@@ -3041,7 +533,7 @@ var POSITIVE_NUMBER_REGEX = /^[0-9]+$/;
|
|
|
3041
533
|
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; }
|
|
3042
534
|
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; }
|
|
3043
535
|
var buildPayload = function buildPayload(data, values) {
|
|
3044
|
-
|
|
536
|
+
return Object.keys(data).reduce(function (acc, key) {
|
|
3045
537
|
var fieldValue = values[key].value;
|
|
3046
538
|
if (Array.isArray(fieldValue)) {
|
|
3047
539
|
var _values$key;
|
|
@@ -3058,7 +550,6 @@ var buildPayload = function buildPayload(data, values) {
|
|
|
3058
550
|
}
|
|
3059
551
|
return _objectSpread$5(_objectSpread$5({}, acc), {}, _defineProperty({}, key, fieldValue));
|
|
3060
552
|
}, {});
|
|
3061
|
-
return payload;
|
|
3062
553
|
};
|
|
3063
554
|
var formatData = function formatData(data) {
|
|
3064
555
|
return Object.keys(data).reduce(function (acc, key) {
|
|
@@ -3075,6 +566,14 @@ var formatData = function formatData(data) {
|
|
|
3075
566
|
}, {});
|
|
3076
567
|
};
|
|
3077
568
|
|
|
569
|
+
/** @type {import("neetocommons/react-utils").ZustandStoreHook} */
|
|
570
|
+
var useCustomDataStore = create(withImmutableActions(function (set) {
|
|
571
|
+
return {
|
|
572
|
+
customData: {},
|
|
573
|
+
setCustomDataState: set
|
|
574
|
+
};
|
|
575
|
+
}));
|
|
576
|
+
|
|
3078
577
|
var transformObjectToDotNotation = function transformObjectToDotNotation(obj) {
|
|
3079
578
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
3080
579
|
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
@@ -3134,43 +633,33 @@ var NeetoRules$2 = function NeetoRules(_ref) {
|
|
|
3134
633
|
children = _ref.children,
|
|
3135
634
|
className = _ref.className,
|
|
3136
635
|
_ref$handleSubmit = _ref.handleSubmit,
|
|
3137
|
-
handleSubmit = _ref$handleSubmit === void 0 ? noop
|
|
636
|
+
handleSubmit = _ref$handleSubmit === void 0 ? noop : _ref$handleSubmit,
|
|
3138
637
|
_ref$handleCancel = _ref.handleCancel,
|
|
3139
|
-
handleCancel = _ref$handleCancel === void 0 ? noop
|
|
638
|
+
handleCancel = _ref$handleCancel === void 0 ? noop : _ref$handleCancel;
|
|
3140
639
|
var formRef = useRef(null);
|
|
3141
|
-
var submitForm =
|
|
3142
|
-
var
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
while (1) {
|
|
3146
|
-
switch (_context.prev = _context.next) {
|
|
3147
|
-
case 0:
|
|
3148
|
-
payload = buildPayload(data, values);
|
|
3149
|
-
handleSubmit(payload, formikBag);
|
|
3150
|
-
case 2:
|
|
3151
|
-
case "end":
|
|
3152
|
-
return _context.stop();
|
|
3153
|
-
}
|
|
3154
|
-
}
|
|
3155
|
-
}, _callee);
|
|
3156
|
-
}));
|
|
3157
|
-
return function submitForm(_x, _x2) {
|
|
3158
|
-
return _ref2.apply(this, arguments);
|
|
3159
|
-
};
|
|
3160
|
-
}();
|
|
640
|
+
var submitForm = function submitForm(values, formikBag) {
|
|
641
|
+
var payload = buildPayload(data, values);
|
|
642
|
+
handleSubmit(payload, formikBag);
|
|
643
|
+
};
|
|
3161
644
|
var initialValues = useMemo(function () {
|
|
3162
645
|
return formatData(data);
|
|
3163
646
|
}, [data]);
|
|
647
|
+
var _useCustomDataStore = useCustomDataStore(function (store) {
|
|
648
|
+
return {
|
|
649
|
+
customData: store["customData"]
|
|
650
|
+
};
|
|
651
|
+
}, shallow),
|
|
652
|
+
customData = _useCustomDataStore.customData;
|
|
3164
653
|
return /*#__PURE__*/React.createElement(Formik, {
|
|
3165
|
-
enableReinitialize: true,
|
|
3166
654
|
initialValues: initialValues,
|
|
3167
|
-
|
|
655
|
+
enableReinitialize: true,
|
|
656
|
+
validationSchema: getValidationSchema(data, customData),
|
|
3168
657
|
onSubmit: submitForm
|
|
3169
|
-
}, function (
|
|
3170
|
-
var isSubmitting =
|
|
3171
|
-
dirty =
|
|
3172
|
-
values =
|
|
3173
|
-
fromikBag = _objectWithoutProperties(
|
|
658
|
+
}, function (_ref2) {
|
|
659
|
+
var isSubmitting = _ref2.isSubmitting,
|
|
660
|
+
dirty = _ref2.dirty,
|
|
661
|
+
values = _ref2.values,
|
|
662
|
+
fromikBag = _objectWithoutProperties(_ref2, _excluded$9);
|
|
3174
663
|
return /*#__PURE__*/React.createElement(Form, {
|
|
3175
664
|
className: classNames(["w-full space-y-6 px-24", className]),
|
|
3176
665
|
ref: formRef
|
|
@@ -3199,9 +688,9 @@ var NeetoRules$2 = function NeetoRules(_ref) {
|
|
|
3199
688
|
});
|
|
3200
689
|
};
|
|
3201
690
|
NeetoRules$2.prototype = {
|
|
3202
|
-
data:
|
|
3203
|
-
handleSubmit:
|
|
3204
|
-
className:
|
|
691
|
+
data: PropTypes.object,
|
|
692
|
+
handleSubmit: PropTypes.func,
|
|
693
|
+
className: PropTypes.string
|
|
3205
694
|
};
|
|
3206
695
|
|
|
3207
696
|
var Main = function Main(_ref) {
|
|
@@ -3209,6 +698,11 @@ var Main = function Main(_ref) {
|
|
|
3209
698
|
return /*#__PURE__*/React.createElement(NeetoRules$2, rest);
|
|
3210
699
|
};
|
|
3211
700
|
|
|
701
|
+
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}}
|
|
702
|
+
|
|
703
|
+
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== */";
|
|
704
|
+
n(css,{});
|
|
705
|
+
|
|
3212
706
|
var NeetoRules$1 = function NeetoRules(_ref) {
|
|
3213
707
|
var rest = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
3214
708
|
return /*#__PURE__*/React.createElement(BrowserRouter, null, /*#__PURE__*/React.createElement(Main, rest));
|
|
@@ -3232,9 +726,7 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
3232
726
|
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
3233
727
|
if (Object(_i) !== _i) return;
|
|
3234
728
|
_n = !1;
|
|
3235
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
3236
|
-
;
|
|
3237
|
-
}
|
|
729
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
3238
730
|
} catch (err) {
|
|
3239
731
|
_d = !0, _e = err;
|
|
3240
732
|
} finally {
|
|
@@ -3287,10 +779,10 @@ var MultiSelectValues = function MultiSelectValues(_ref) {
|
|
|
3287
779
|
};
|
|
3288
780
|
|
|
3289
781
|
var getEntityDisplayValue = function getEntityDisplayValue(entitiy, entitiyOption) {
|
|
3290
|
-
var _findBy
|
|
782
|
+
var _findBy;
|
|
3291
783
|
return (_findBy = findBy({
|
|
3292
784
|
value: entitiy.metadata.value
|
|
3293
|
-
}, entitiyOption.dropdownOptions)) === null || _findBy === void 0
|
|
785
|
+
}, entitiyOption.dropdownOptions)) === null || _findBy === void 0 || (_findBy = _findBy.label) === null || _findBy === void 0 ? void 0 : _findBy.toLowerCase();
|
|
3294
786
|
};
|
|
3295
787
|
|
|
3296
788
|
var ActionsDetail = function ActionsDetail(_ref) {
|
|
@@ -3322,10 +814,10 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
3322
814
|
return action.metadata.value.includes(value);
|
|
3323
815
|
}));
|
|
3324
816
|
return /*#__PURE__*/React.createElement(MultiSelectValues, {
|
|
817
|
+
values: values,
|
|
3325
818
|
separator: t("neetoRules.common.and", {
|
|
3326
819
|
what: ""
|
|
3327
|
-
})
|
|
3328
|
-
values: values
|
|
820
|
+
})
|
|
3329
821
|
});
|
|
3330
822
|
}
|
|
3331
823
|
return null;
|
|
@@ -3356,9 +848,9 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
3356
848
|
className: "mt-3 w-full"
|
|
3357
849
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
3358
850
|
icon: !viewMore ? Down : Up,
|
|
3359
|
-
label: !viewMore ? t("neetoRules.common.viewMore") : t("neetoRules.common.viewLess"),
|
|
3360
851
|
size: "small",
|
|
3361
852
|
style: "link",
|
|
853
|
+
label: !viewMore ? t("neetoRules.common.viewMore") : t("neetoRules.common.viewLess"),
|
|
3362
854
|
onClick: function onClick() {
|
|
3363
855
|
return setViewMore(function (prevState) {
|
|
3364
856
|
return !prevState;
|
|
@@ -3389,8 +881,8 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
3389
881
|
return condition.metadata.values.includes(value);
|
|
3390
882
|
}));
|
|
3391
883
|
return /*#__PURE__*/React.createElement(MultiSelectValues, {
|
|
3392
|
-
|
|
3393
|
-
|
|
884
|
+
values: values,
|
|
885
|
+
separator: t$1("neetoRules.common.or")
|
|
3394
886
|
});
|
|
3395
887
|
}
|
|
3396
888
|
if (conditionOption.type === "dropdown") {
|
|
@@ -3490,7 +982,7 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
3490
982
|
className: "neeto-ui-text-gray-800",
|
|
3491
983
|
style: "h5",
|
|
3492
984
|
weight: "semibold"
|
|
3493
|
-
}, currentPerformer === null || currentPerformer === void 0
|
|
985
|
+
}, currentPerformer === null || currentPerformer === void 0 || (_currentPerformer$lab = currentPerformer.label) === null || _currentPerformer$lab === void 0 ? void 0 : _currentPerformer$lab.toLowerCase())), /*#__PURE__*/React.createElement(ConditionsDetail, {
|
|
3494
986
|
conditionOptions: conditions.conditionOptions,
|
|
3495
987
|
conditionVerbs: conditions.verbs,
|
|
3496
988
|
conditions: allConditions
|
|
@@ -3498,9 +990,9 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
3498
990
|
className: "mt-3 w-full"
|
|
3499
991
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
3500
992
|
icon: !viewMore ? Down : Up,
|
|
3501
|
-
label: !viewMore ? t$1("neetoRules.common.viewMore") : t$1("neetoRules.common.viewLess"),
|
|
3502
993
|
size: "small",
|
|
3503
994
|
style: "link",
|
|
995
|
+
label: !viewMore ? t$1("neetoRules.common.viewMore") : t$1("neetoRules.common.viewLess"),
|
|
3504
996
|
onClick: function onClick() {
|
|
3505
997
|
return setViewMore(function (prevState) {
|
|
3506
998
|
return !prevState;
|
|
@@ -3598,7 +1090,7 @@ var useOnButtonPressed = function useOnButtonPressed(ref, handler) {
|
|
|
3598
1090
|
var DEFAULT_LONG_TEXT_ROWS = 8;
|
|
3599
1091
|
|
|
3600
1092
|
var LongTextField = function LongTextField(_ref) {
|
|
3601
|
-
var _errors$actions,
|
|
1093
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
3602
1094
|
var name = _ref.name,
|
|
3603
1095
|
_ref$value = _ref.value,
|
|
3604
1096
|
value = _ref$value === void 0 ? "" : _ref$value,
|
|
@@ -3620,8 +1112,8 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3620
1112
|
useOnButtonPressed(initialFocusRef, function () {
|
|
3621
1113
|
return setShowPane(false);
|
|
3622
1114
|
});
|
|
3623
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3624
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1115
|
+
var isValid = errors.actions && 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]) && 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]);
|
|
1116
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || defaultSeparator;
|
|
3625
1117
|
var label = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder) || defaultLabel;
|
|
3626
1118
|
var rows = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.rows) || DEFAULT_LONG_TEXT_ROWS;
|
|
3627
1119
|
return /*#__PURE__*/React.createElement(React.Fragment, null, separator && /*#__PURE__*/React.createElement(Typography, {
|
|
@@ -3655,11 +1147,11 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3655
1147
|
style: "h3",
|
|
3656
1148
|
weight: "semibold"
|
|
3657
1149
|
}, label)), /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement(Textarea, {
|
|
3658
|
-
required: true,
|
|
3659
|
-
className: "w-full",
|
|
3660
1150
|
name: name,
|
|
3661
1151
|
rows: rows,
|
|
3662
|
-
value: value
|
|
1152
|
+
value: value,
|
|
1153
|
+
required: true,
|
|
1154
|
+
className: "w-full"
|
|
3663
1155
|
})), /*#__PURE__*/React.createElement(Pane.Footer, {
|
|
3664
1156
|
className: "flex items-center space-x-2"
|
|
3665
1157
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -3678,7 +1170,7 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3678
1170
|
};
|
|
3679
1171
|
|
|
3680
1172
|
var CustomAction = function CustomAction(_ref) {
|
|
3681
|
-
var _errors$actions,
|
|
1173
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
3682
1174
|
var ActionComponent = _ref.ActionComponent,
|
|
3683
1175
|
name = _ref.name,
|
|
3684
1176
|
action = _ref.action,
|
|
@@ -3695,8 +1187,8 @@ var CustomAction = function CustomAction(_ref) {
|
|
|
3695
1187
|
useOnButtonPressed(initialFocusRef, function () {
|
|
3696
1188
|
return setShowPane(false);
|
|
3697
1189
|
});
|
|
3698
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3699
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1190
|
+
var isValid = errors.actions && 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]) && 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]);
|
|
1191
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.as");
|
|
3700
1192
|
var defaultLabel = selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder;
|
|
3701
1193
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
3702
1194
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
@@ -3745,8 +1237,19 @@ var CustomAction = function CustomAction(_ref) {
|
|
|
3745
1237
|
}))));
|
|
3746
1238
|
};
|
|
3747
1239
|
|
|
1240
|
+
var dayjs_min = {exports: {}};
|
|
1241
|
+
|
|
1242
|
+
dayjs_min.exports;
|
|
1243
|
+
|
|
1244
|
+
(function (module, exports) {
|
|
1245
|
+
!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}));
|
|
1246
|
+
} (dayjs_min, dayjs_min.exports));
|
|
1247
|
+
|
|
1248
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
1249
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
1250
|
+
|
|
3748
1251
|
var DateField$1 = function DateField(_ref) {
|
|
3749
|
-
var _actions$value$index$, _selectedField$separa, _errors$actions,
|
|
1252
|
+
var _actions$value$index$, _selectedField$separa, _errors$actions, _touched$actions;
|
|
3750
1253
|
var name = _ref.name,
|
|
3751
1254
|
index = _ref.index,
|
|
3752
1255
|
selectedField = _ref.selectedField;
|
|
@@ -3762,8 +1265,8 @@ var DateField$1 = function DateField(_ref) {
|
|
|
3762
1265
|
setShowInput = _useState2[1];
|
|
3763
1266
|
var valueTerm = (_actions$value$index$ = actions.value[index].metadata) === null || _actions$value$index$ === void 0 ? void 0 : _actions$value$index$.value;
|
|
3764
1267
|
var label = valueTerm || t$1("neetoRules.form.selectDate").toLowerCase();
|
|
3765
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
3766
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
1268
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.to");
|
|
1269
|
+
var isValid = errors.actions && 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]) && 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]);
|
|
3767
1270
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !selectedField.hideSeparator && /*#__PURE__*/React.createElement(Typography, {
|
|
3768
1271
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
3769
1272
|
"data-cy": "action-dropdown-seperator-text",
|
|
@@ -3816,14 +1319,13 @@ var getActionOptions = function getActionOptions(currentAction, selectedActions)
|
|
|
3816
1319
|
};
|
|
3817
1320
|
var buildEmailValues = function buildEmailValues(emails) {
|
|
3818
1321
|
var emailRegex = EMAIL_REGEX;
|
|
3819
|
-
|
|
1322
|
+
return emails.map(function (email) {
|
|
3820
1323
|
return typeof email === "string" ? {
|
|
3821
1324
|
label: email,
|
|
3822
1325
|
value: email,
|
|
3823
1326
|
valid: emailRegex.test(email)
|
|
3824
1327
|
} : email;
|
|
3825
1328
|
});
|
|
3826
|
-
return formattedEmails;
|
|
3827
1329
|
};
|
|
3828
1330
|
var getDetailsByValue = function getDetailsByValue(value, options) {
|
|
3829
1331
|
return options.find(function (option) {
|
|
@@ -3853,7 +1355,7 @@ var getSlackChannelErrors = function getSlackChannelErrors(slackChannels, action
|
|
|
3853
1355
|
if (action !== null && action !== void 0 && (_action$metadata = action.metadata) !== null && _action$metadata !== void 0 && _action$metadata.value) {
|
|
3854
1356
|
var selectedOption = opts.find(function (op) {
|
|
3855
1357
|
var _action$metadata2;
|
|
3856
|
-
return (op === null || op === void 0 ? void 0 : op.value) === (action === null || action === void 0
|
|
1358
|
+
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);
|
|
3857
1359
|
});
|
|
3858
1360
|
if (!selectedOption) {
|
|
3859
1361
|
return {
|
|
@@ -3870,7 +1372,7 @@ var getSlackChannelErrors = function getSlackChannelErrors(slackChannels, action
|
|
|
3870
1372
|
var Menu$9 = Dropdown$1.Menu,
|
|
3871
1373
|
MenuItem$9 = Dropdown$1.MenuItem;
|
|
3872
1374
|
var DropdownField$1 = function DropdownField(_ref) {
|
|
3873
|
-
var _actions$value$index$, _actions$value$index, _errors$actions,
|
|
1375
|
+
var _actions$value$index$, _actions$value$index, _errors$actions, _touched$actions, _selectedField$separa, _defaultSelectedOptio;
|
|
3874
1376
|
var dropdownOptions = _ref.dropdownOptions,
|
|
3875
1377
|
name = _ref.name,
|
|
3876
1378
|
index = _ref.index,
|
|
@@ -3898,8 +1400,8 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
3898
1400
|
setSearchTerm = _useState6[1];
|
|
3899
1401
|
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);
|
|
3900
1402
|
var searchedOptions = getSearchedOptions$3(dropdownOptions, searchTerm);
|
|
3901
|
-
var isValueSelected = defaultSelectedOption.label === defaultLabel && errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3902
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1403
|
+
var isValueSelected = defaultSelectedOption.label === defaultLabel && errors.actions && 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]) && 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]);
|
|
1404
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.to");
|
|
3903
1405
|
var handleClose = function handleClose() {
|
|
3904
1406
|
setIsActive(false);
|
|
3905
1407
|
setSearchTerm("");
|
|
@@ -3952,7 +1454,7 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
3952
1454
|
return !prevState;
|
|
3953
1455
|
});
|
|
3954
1456
|
}
|
|
3955
|
-
}, defaultSelectedOption === null || defaultSelectedOption === void 0
|
|
1457
|
+
}, defaultSelectedOption === null || defaultSelectedOption === void 0 || (_defaultSelectedOptio = defaultSelectedOption.label) === null || _defaultSelectedOptio === void 0 ? void 0 : _defaultSelectedOptio.toLowerCase()),
|
|
3956
1458
|
onClose: handleClose
|
|
3957
1459
|
}, /*#__PURE__*/React.createElement(Menu$9, {
|
|
3958
1460
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -4008,14 +1510,14 @@ var EditorAction = function EditorAction(_ref) {
|
|
|
4008
1510
|
setFieldValue(name, editorData);
|
|
4009
1511
|
}, [debouncedValue]);
|
|
4010
1512
|
return /*#__PURE__*/React.createElement(FormikEditor, {
|
|
1513
|
+
label: label,
|
|
1514
|
+
name: name,
|
|
1515
|
+
variables: variables,
|
|
4011
1516
|
autoFocus: true,
|
|
4012
1517
|
hideSlashCommands: true,
|
|
4013
1518
|
addons: EDITOR_ADDONS,
|
|
4014
1519
|
className: "w-full",
|
|
4015
1520
|
"data-cy": "neeto-editor",
|
|
4016
|
-
label: label,
|
|
4017
|
-
name: name,
|
|
4018
|
-
variables: variables,
|
|
4019
1521
|
onChange: function onChange(value) {
|
|
4020
1522
|
return setEditorData(value);
|
|
4021
1523
|
}
|
|
@@ -4033,8 +1535,8 @@ var EmailIdFields = function EmailIdFields(_ref) {
|
|
|
4033
1535
|
return /*#__PURE__*/React.createElement("div", {
|
|
4034
1536
|
className: "mb-4"
|
|
4035
1537
|
}, /*#__PURE__*/React.createElement(MultiEmailInput, {
|
|
4036
|
-
label: t$1("neetoRules.common.emailIds"),
|
|
4037
1538
|
name: name,
|
|
1539
|
+
label: t$1("neetoRules.common.emailIds"),
|
|
4038
1540
|
placeholder: t$1("neetoRules.placeholders.emailField"),
|
|
4039
1541
|
ref: initialFocusRef,
|
|
4040
1542
|
value: formattedEmails,
|
|
@@ -4047,6 +1549,21 @@ var EmailIdFields = function EmailIdFields(_ref) {
|
|
|
4047
1549
|
}));
|
|
4048
1550
|
};
|
|
4049
1551
|
|
|
1552
|
+
function _extends() {
|
|
1553
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1554
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1555
|
+
var source = arguments[i];
|
|
1556
|
+
for (var key in source) {
|
|
1557
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1558
|
+
target[key] = source[key];
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
return target;
|
|
1563
|
+
};
|
|
1564
|
+
return _extends.apply(this, arguments);
|
|
1565
|
+
}
|
|
1566
|
+
|
|
4050
1567
|
var useDebouncedUpdate = function useDebouncedUpdate(value, setValue) {
|
|
4051
1568
|
var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;
|
|
4052
1569
|
var _useState = useState(value),
|
|
@@ -4089,7 +1606,7 @@ var InputField$2 = function InputField(_ref) {
|
|
|
4089
1606
|
};
|
|
4090
1607
|
|
|
4091
1608
|
var EmailFields = function EmailFields(_ref) {
|
|
4092
|
-
var _errors$actions,
|
|
1609
|
+
var _errors$actions, _touched$actions, _selectedField$separa, _action$metadata;
|
|
4093
1610
|
var _ref$isEmailIdField = _ref.isEmailIdField,
|
|
4094
1611
|
isEmailIdField = _ref$isEmailIdField === void 0 ? false : _ref$isEmailIdField,
|
|
4095
1612
|
name = _ref.name,
|
|
@@ -4109,8 +1626,8 @@ var EmailFields = function EmailFields(_ref) {
|
|
|
4109
1626
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4110
1627
|
return setShowPane(false);
|
|
4111
1628
|
});
|
|
4112
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4113
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1629
|
+
var isValid = errors.actions && 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]) && 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]);
|
|
1630
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.as");
|
|
4114
1631
|
var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.emailPlaceholder) || t$1("neetoRules.common.email");
|
|
4115
1632
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
4116
1633
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
@@ -4192,15 +1709,14 @@ var useCloseInputField = function useCloseInputField(ref, showInput, handler) {
|
|
|
4192
1709
|
};
|
|
4193
1710
|
};
|
|
4194
1711
|
useEffect(function () {
|
|
4195
|
-
if (showInput)
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
}
|
|
1712
|
+
if (!showInput) return;
|
|
1713
|
+
ref.current.focus();
|
|
1714
|
+
buttonPressed();
|
|
4199
1715
|
}, [showInput]);
|
|
4200
1716
|
};
|
|
4201
1717
|
|
|
4202
1718
|
var Input = function Input(_ref) {
|
|
4203
|
-
var _action$metadata, _selectedField$separa, _errors$actions,
|
|
1719
|
+
var _action$metadata, _selectedField$separa, _errors$actions, _touched$actions;
|
|
4204
1720
|
var name = _ref.name,
|
|
4205
1721
|
index = _ref.index,
|
|
4206
1722
|
selectedField = _ref.selectedField;
|
|
@@ -4219,8 +1735,8 @@ var Input = function Input(_ref) {
|
|
|
4219
1735
|
var action = actions.value[index];
|
|
4220
1736
|
var valueTerm = (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.value;
|
|
4221
1737
|
var label = valueTerm && isNotEmpty(valueTerm === null || valueTerm === void 0 ? void 0 : valueTerm.trim()) ? valueTerm : t$1("neetoRules.form.addValue");
|
|
4222
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
4223
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
1738
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.to");
|
|
1739
|
+
var isValid = errors.actions && 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]) && 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]);
|
|
4224
1740
|
useEffect(function () {
|
|
4225
1741
|
setShowInput(false);
|
|
4226
1742
|
}, [action.name]);
|
|
@@ -4344,9 +1860,9 @@ var InlineInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
4344
1860
|
tooltipProps: LIST_FIELD_TOOLTIP_PROPS.save,
|
|
4345
1861
|
onClick: onSubmit
|
|
4346
1862
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
1863
|
+
ref: ref,
|
|
4347
1864
|
"data-cy": "inline-input-cancel-button",
|
|
4348
1865
|
icon: Close,
|
|
4349
|
-
ref: ref,
|
|
4350
1866
|
style: "text",
|
|
4351
1867
|
tooltipProps: LIST_FIELD_TOOLTIP_PROPS.cancel,
|
|
4352
1868
|
onClick: handleCancel
|
|
@@ -4356,7 +1872,7 @@ var InlineInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
4356
1872
|
InlineInput.displayName = "InlineInput";
|
|
4357
1873
|
|
|
4358
1874
|
var ListField = function ListField(_ref) {
|
|
4359
|
-
var _errors$actions,
|
|
1875
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
4360
1876
|
var name = _ref.name,
|
|
4361
1877
|
_ref$values = _ref.values,
|
|
4362
1878
|
values = _ref$values === void 0 ? [] : _ref$values,
|
|
@@ -4377,8 +1893,8 @@ var ListField = function ListField(_ref) {
|
|
|
4377
1893
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4378
1894
|
return setShowPane(false);
|
|
4379
1895
|
});
|
|
4380
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4381
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1896
|
+
var isValid = errors.actions && 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]) && 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]);
|
|
1897
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.to");
|
|
4382
1898
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
4383
1899
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
4384
1900
|
"data-cy": "list-action-separator-text",
|
|
@@ -4416,7 +1932,7 @@ var ListField = function ListField(_ref) {
|
|
|
4416
1932
|
}, function (arrayHelper) {
|
|
4417
1933
|
return /*#__PURE__*/React.createElement(React.Fragment, null, values.map(function (item, index) {
|
|
4418
1934
|
return /*#__PURE__*/React.createElement("div", {
|
|
4419
|
-
className: "flex flex-wrap justify-between border border-dashed
|
|
1935
|
+
className: "neeto-ui-bg-white flex flex-wrap justify-between border border-dashed px-2 py-1",
|
|
4420
1936
|
key: "".concat(item, ".").concat(index)
|
|
4421
1937
|
}, /*#__PURE__*/React.createElement(Typography, {
|
|
4422
1938
|
className: "w-4/5 overflow-x-auto",
|
|
@@ -4433,8 +1949,8 @@ var ListField = function ListField(_ref) {
|
|
|
4433
1949
|
}
|
|
4434
1950
|
}));
|
|
4435
1951
|
}), /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
4436
|
-
|
|
4437
|
-
|
|
1952
|
+
name: name,
|
|
1953
|
+
className: "w-full"
|
|
4438
1954
|
}, function (message) {
|
|
4439
1955
|
return /*#__PURE__*/React.createElement(Typography, {
|
|
4440
1956
|
className: "neeto-ui-text-error-500 neeto-ui-text-gray-700 mt-1",
|
|
@@ -4479,7 +1995,7 @@ var ListField = function ListField(_ref) {
|
|
|
4479
1995
|
var Menu$8 = Dropdown$1.Menu,
|
|
4480
1996
|
MenuItem$8 = Dropdown$1.MenuItem;
|
|
4481
1997
|
var MultiSelect$1 = function MultiSelect(_ref) {
|
|
4482
|
-
var _selectedField$placeh, _selectedField$separa, _errors$actions,
|
|
1998
|
+
var _selectedField$placeh, _selectedField$separa, _errors$actions, _touched$actions;
|
|
4483
1999
|
var _ref$values = _ref.values,
|
|
4484
2000
|
values = _ref$values === void 0 ? [] : _ref$values,
|
|
4485
2001
|
_ref$dropDownOptions = _ref.dropDownOptions,
|
|
@@ -4506,10 +2022,10 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4506
2022
|
});
|
|
4507
2023
|
}, [values, dropDownOptions]);
|
|
4508
2024
|
var selectedOptions = getSelectedOptions(allOptions);
|
|
4509
|
-
var defaultLabel = (selectedField === null || selectedField === void 0
|
|
2025
|
+
var defaultLabel = (selectedField === null || selectedField === void 0 || (_selectedField$placeh = selectedField.placeholder) === null || _selectedField$placeh === void 0 ? void 0 : _selectedField$placeh.toLowerCase()) || t$1("neetoRules.form.selectValues").toLowerCase();
|
|
4510
2026
|
var searchedOptions = getSearchedOptions$3(dropDownOptions, searchTerm);
|
|
4511
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
4512
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
2027
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.to");
|
|
2028
|
+
var isValid = errors.actions && 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]) && 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]);
|
|
4513
2029
|
var handleSelectOption = function handleSelectOption(option) {
|
|
4514
2030
|
var options = values.includes(option.value) ? without([option.value], values) : append(option.value, values);
|
|
4515
2031
|
setFieldValue(name, options);
|
|
@@ -4535,7 +2051,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4535
2051
|
className: "flex flex-wrap",
|
|
4536
2052
|
key: idx
|
|
4537
2053
|
}, !!idx && /*#__PURE__*/React.createElement(Typography, {
|
|
4538
|
-
className: "neeto-ui-text-gray-700
|
|
2054
|
+
className: "neeto-ui-text-gray-700 mr-1 mt-1",
|
|
4539
2055
|
style: "h5",
|
|
4540
2056
|
weight: "normal",
|
|
4541
2057
|
onClick: function onClick(e) {
|
|
@@ -4547,7 +2063,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4547
2063
|
"data-cy": "multi-select-action-button",
|
|
4548
2064
|
style: "h5",
|
|
4549
2065
|
weight: "semibold",
|
|
4550
|
-
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800
|
|
2066
|
+
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mr-1 mt-1 cursor-pointer underline", {
|
|
4551
2067
|
"neeto-ui-text-primary-800": activeOption === (option === null || option === void 0 ? void 0 : option.value)
|
|
4552
2068
|
}),
|
|
4553
2069
|
onClick: function onClick() {
|
|
@@ -4601,7 +2117,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4601
2117
|
};
|
|
4602
2118
|
|
|
4603
2119
|
var NoteField = function NoteField(_ref) {
|
|
4604
|
-
var _errors$actions,
|
|
2120
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
4605
2121
|
var name = _ref.name,
|
|
4606
2122
|
_ref$value = _ref.value,
|
|
4607
2123
|
value = _ref$value === void 0 ? "" : _ref$value,
|
|
@@ -4618,8 +2134,8 @@ var NoteField = function NoteField(_ref) {
|
|
|
4618
2134
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4619
2135
|
return setShowPane(false);
|
|
4620
2136
|
});
|
|
4621
|
-
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4622
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
2137
|
+
var isValid = errors.actions && 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]) && 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]);
|
|
2138
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || t$1("neetoRules.common.as");
|
|
4623
2139
|
var variables = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.variables) || [];
|
|
4624
2140
|
var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder) || t$1("neetoRules.form.note");
|
|
4625
2141
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
@@ -4684,55 +2200,55 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4684
2200
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.emailToIds) {
|
|
4685
2201
|
var _action$metadata;
|
|
4686
2202
|
return /*#__PURE__*/React.createElement(EmailFields, {
|
|
4687
|
-
isEmailIdField: true,
|
|
4688
2203
|
action: action,
|
|
4689
|
-
emails: (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.emails,
|
|
4690
2204
|
index: index,
|
|
4691
|
-
key: name,
|
|
4692
2205
|
name: name,
|
|
4693
|
-
selectedField: selectedField
|
|
2206
|
+
selectedField: selectedField,
|
|
2207
|
+
isEmailIdField: true,
|
|
2208
|
+
emails: (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.emails,
|
|
2209
|
+
key: name
|
|
4694
2210
|
});
|
|
4695
2211
|
}
|
|
4696
2212
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.email) {
|
|
4697
2213
|
return /*#__PURE__*/React.createElement(EmailFields, {
|
|
4698
2214
|
action: action,
|
|
4699
2215
|
index: index,
|
|
4700
|
-
key: name,
|
|
4701
2216
|
name: name,
|
|
4702
|
-
selectedField: selectedField
|
|
2217
|
+
selectedField: selectedField,
|
|
2218
|
+
key: name
|
|
4703
2219
|
});
|
|
4704
2220
|
}
|
|
4705
2221
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.emailTo) {
|
|
4706
2222
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownField$1, {
|
|
4707
|
-
dropdownOptions: options,
|
|
4708
2223
|
index: index,
|
|
2224
|
+
selectedField: selectedField,
|
|
2225
|
+
dropdownOptions: options,
|
|
4709
2226
|
key: "".concat(name, ".value"),
|
|
4710
|
-
name: "".concat(name, ".value")
|
|
4711
|
-
selectedField: selectedField
|
|
2227
|
+
name: "".concat(name, ".value")
|
|
4712
2228
|
}), /*#__PURE__*/React.createElement(EmailFields, {
|
|
4713
2229
|
action: action,
|
|
4714
2230
|
index: index,
|
|
4715
|
-
key: name,
|
|
4716
2231
|
name: name,
|
|
4717
|
-
selectedField: selectedField
|
|
2232
|
+
selectedField: selectedField,
|
|
2233
|
+
key: name
|
|
4718
2234
|
}));
|
|
4719
2235
|
}
|
|
4720
2236
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.dropdown) {
|
|
4721
2237
|
return /*#__PURE__*/React.createElement(DropdownField$1, {
|
|
4722
|
-
dropdownOptions: options,
|
|
4723
2238
|
index: index,
|
|
2239
|
+
selectedField: selectedField,
|
|
2240
|
+
dropdownOptions: options,
|
|
4724
2241
|
key: name,
|
|
4725
|
-
name: "".concat(name, ".value")
|
|
4726
|
-
selectedField: selectedField
|
|
2242
|
+
name: "".concat(name, ".value")
|
|
4727
2243
|
});
|
|
4728
2244
|
}
|
|
4729
2245
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.note) {
|
|
4730
2246
|
var _action$metadata2;
|
|
4731
2247
|
return /*#__PURE__*/React.createElement(NoteField, {
|
|
4732
2248
|
index: index,
|
|
2249
|
+
selectedField: selectedField,
|
|
4733
2250
|
key: name,
|
|
4734
2251
|
name: "".concat(name, ".value"),
|
|
4735
|
-
selectedField: selectedField,
|
|
4736
2252
|
value: (_action$metadata2 = action.metadata) === null || _action$metadata2 === void 0 ? void 0 : _action$metadata2.value
|
|
4737
2253
|
});
|
|
4738
2254
|
}
|
|
@@ -4740,20 +2256,20 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4740
2256
|
var _action$metadata3;
|
|
4741
2257
|
return /*#__PURE__*/React.createElement(ListField, {
|
|
4742
2258
|
index: index,
|
|
2259
|
+
selectedField: selectedField,
|
|
4743
2260
|
key: name,
|
|
4744
2261
|
name: "".concat(name, ".value"),
|
|
4745
|
-
selectedField: selectedField,
|
|
4746
2262
|
values: (_action$metadata3 = action.metadata) === null || _action$metadata3 === void 0 ? void 0 : _action$metadata3.value
|
|
4747
2263
|
});
|
|
4748
2264
|
}
|
|
4749
2265
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.multiSelect) {
|
|
4750
2266
|
var _action$metadata4;
|
|
4751
2267
|
return /*#__PURE__*/React.createElement(MultiSelect$1, {
|
|
4752
|
-
dropDownOptions: options,
|
|
4753
2268
|
index: index,
|
|
2269
|
+
selectedField: selectedField,
|
|
2270
|
+
dropDownOptions: options,
|
|
4754
2271
|
key: name,
|
|
4755
2272
|
name: "".concat(name, ".value"),
|
|
4756
|
-
selectedField: selectedField,
|
|
4757
2273
|
values: (_action$metadata4 = action.metadata) === null || _action$metadata4 === void 0 ? void 0 : _action$metadata4.value
|
|
4758
2274
|
});
|
|
4759
2275
|
}
|
|
@@ -4774,12 +2290,12 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4774
2290
|
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) {
|
|
4775
2291
|
var _action$metadata5;
|
|
4776
2292
|
return /*#__PURE__*/React.createElement(LongTextField, {
|
|
2293
|
+
index: index,
|
|
2294
|
+
selectedField: selectedField,
|
|
4777
2295
|
defaultLabel: t("neetoRules.labels.body"),
|
|
4778
2296
|
defaultSeparator: t("neetoRules.common.as"),
|
|
4779
|
-
index: index,
|
|
4780
2297
|
key: name,
|
|
4781
2298
|
name: "".concat(name, ".value"),
|
|
4782
|
-
selectedField: selectedField,
|
|
4783
2299
|
value: (_action$metadata5 = action.metadata) === null || _action$metadata5 === void 0 ? void 0 : _action$metadata5.value
|
|
4784
2300
|
});
|
|
4785
2301
|
}
|
|
@@ -4800,7 +2316,7 @@ var ActionSubItem = /*#__PURE__*/memo(ActionSubItems);
|
|
|
4800
2316
|
var Menu$7 = Dropdown$1.Menu,
|
|
4801
2317
|
MenuItem$7 = Dropdown$1.MenuItem;
|
|
4802
2318
|
var ActionItem = function ActionItem(_ref) {
|
|
4803
|
-
var _errors$actions,
|
|
2319
|
+
var _errors$actions, _touched$actions, _selectedOption$label;
|
|
4804
2320
|
var name = _ref.name,
|
|
4805
2321
|
action = _ref.action,
|
|
4806
2322
|
index = _ref.index,
|
|
@@ -4839,7 +2355,7 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4839
2355
|
return getFieldDetails$1(action.name, actionOptions);
|
|
4840
2356
|
}, [action, actionOptions]);
|
|
4841
2357
|
var searchedOptions = getSearchedOptions$3(actionOptions, searchTerm);
|
|
4842
|
-
var isActionSelected = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) === t$1("neetoRules.form.doThis") && errors.actions && touched.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
2358
|
+
var isActionSelected = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) === t$1("neetoRules.form.doThis") && errors.actions && touched.actions && 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]) && 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]);
|
|
4843
2359
|
var handleSelectOption = function handleSelectOption(option) {
|
|
4844
2360
|
setFieldValue("".concat(name, ".name"), option.value);
|
|
4845
2361
|
setFieldValue("".concat(name, ".metadata"), {});
|
|
@@ -4899,7 +2415,7 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4899
2415
|
return !prevState;
|
|
4900
2416
|
});
|
|
4901
2417
|
}
|
|
4902
|
-
}, selectedOption === null || selectedOption === void 0
|
|
2418
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
4903
2419
|
onClose: handleClose
|
|
4904
2420
|
}, /*#__PURE__*/React.createElement(Menu$7, {
|
|
4905
2421
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -4934,9 +2450,9 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4934
2450
|
}, t$1("neetoRules.common.noOptions")))), /*#__PURE__*/React.createElement(ActionSubItem, {
|
|
4935
2451
|
action: action,
|
|
4936
2452
|
index: index,
|
|
2453
|
+
selectedField: selectedField,
|
|
4937
2454
|
name: "".concat(name, ".metadata"),
|
|
4938
|
-
options: getSelectedFieldOptions()
|
|
4939
|
-
selectedField: selectedField
|
|
2455
|
+
options: getSelectedFieldOptions()
|
|
4940
2456
|
}));
|
|
4941
2457
|
};
|
|
4942
2458
|
var ActionItem$1 = /*#__PURE__*/memo(ActionItem);
|
|
@@ -4964,7 +2480,7 @@ var Actions = function Actions(_ref) {
|
|
|
4964
2480
|
_ref$showAddButton = _ref.showAddButton,
|
|
4965
2481
|
showAddButton = _ref$showAddButton === void 0 ? true : _ref$showAddButton,
|
|
4966
2482
|
_ref$handleSlackChann = _ref.handleSlackChannelRefresh,
|
|
4967
|
-
handleSlackChannelRefresh = _ref$handleSlackChann === void 0 ? noop
|
|
2483
|
+
handleSlackChannelRefresh = _ref$handleSlackChann === void 0 ? noop : _ref$handleSlackChann;
|
|
4968
2484
|
var _useFormikContext = useFormikContext(),
|
|
4969
2485
|
values = _useFormikContext.values,
|
|
4970
2486
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
@@ -4997,10 +2513,10 @@ var Actions = function Actions(_ref) {
|
|
|
4997
2513
|
action: action,
|
|
4998
2514
|
elementProps: elementProps,
|
|
4999
2515
|
index: index,
|
|
5000
|
-
|
|
5001
|
-
parentName: name,
|
|
2516
|
+
onSelectAction: onSelectAction,
|
|
5002
2517
|
selectedActionOptions: selectedActionOptions,
|
|
5003
|
-
|
|
2518
|
+
name: "".concat(name, ".value.").concat(index),
|
|
2519
|
+
parentName: name
|
|
5004
2520
|
}), /*#__PURE__*/React.createElement("div", {
|
|
5005
2521
|
className: "-mx-1 flex flex-wrap"
|
|
5006
2522
|
}, handleSlackChannelRefresh && action.name === "message_to_slack" && /*#__PURE__*/React.createElement(Button, {
|
|
@@ -5066,13 +2582,12 @@ var getSearchedOptions$2 = function getSearchedOptions(dropDownOptions, searchTe
|
|
|
5066
2582
|
});
|
|
5067
2583
|
};
|
|
5068
2584
|
var getAllOptions = function getAllOptions(options) {
|
|
5069
|
-
|
|
2585
|
+
return Array.isArray(options) ? options.map(function (option) {
|
|
5070
2586
|
return {
|
|
5071
2587
|
label: option,
|
|
5072
2588
|
value: option
|
|
5073
2589
|
};
|
|
5074
2590
|
}) : [];
|
|
5075
|
-
return allOptions;
|
|
5076
2591
|
};
|
|
5077
2592
|
|
|
5078
2593
|
var Menu$6 = Dropdown$1.Menu,
|
|
@@ -5131,7 +2646,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
5131
2646
|
return !prevState;
|
|
5132
2647
|
});
|
|
5133
2648
|
}
|
|
5134
|
-
}, selectedOption === null || selectedOption === void 0
|
|
2649
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
5135
2650
|
onClose: handleClose
|
|
5136
2651
|
}, /*#__PURE__*/React.createElement(Menu$6, {
|
|
5137
2652
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -5174,7 +2689,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
5174
2689
|
var Menu$5 = Dropdown$1.Menu,
|
|
5175
2690
|
MenuItem$5 = Dropdown$1.MenuItem;
|
|
5176
2691
|
var Dropdown = function Dropdown(_ref) {
|
|
5177
|
-
var _conditions$value$ind, _errors$conditions,
|
|
2692
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions, _defaultSelectedOptio;
|
|
5178
2693
|
var name = _ref.name,
|
|
5179
2694
|
options = _ref.options,
|
|
5180
2695
|
index = _ref.index;
|
|
@@ -5201,7 +2716,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5201
2716
|
setSearchTerm = _useState6[1];
|
|
5202
2717
|
var defaultValue = (_conditions$value$ind = conditions.value[index].metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.value;
|
|
5203
2718
|
var searchedOptions = getSearchedOptions$2(options, searchTerm);
|
|
5204
|
-
var isValueSelected = (defaultSelectedOption === null || defaultSelectedOption === void 0 ? void 0 : defaultSelectedOption.label) === defaultLabel && errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
2719
|
+
var isValueSelected = (defaultSelectedOption === null || defaultSelectedOption === void 0 ? void 0 : defaultSelectedOption.label) === defaultLabel && errors.conditions && 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]) && 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]);
|
|
5205
2720
|
var handleClose = function handleClose() {
|
|
5206
2721
|
setIsActive(false);
|
|
5207
2722
|
setSearchTerm("");
|
|
@@ -5248,7 +2763,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5248
2763
|
return !prevState;
|
|
5249
2764
|
});
|
|
5250
2765
|
}
|
|
5251
|
-
}, defaultSelectedOption === null || defaultSelectedOption === void 0
|
|
2766
|
+
}, defaultSelectedOption === null || defaultSelectedOption === void 0 || (_defaultSelectedOptio = defaultSelectedOption.label) === null || _defaultSelectedOptio === void 0 ? void 0 : _defaultSelectedOptio.toLowerCase()),
|
|
5252
2767
|
onClose: handleClose
|
|
5253
2768
|
}, /*#__PURE__*/React.createElement(Menu$5, {
|
|
5254
2769
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -5287,7 +2802,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5287
2802
|
};
|
|
5288
2803
|
|
|
5289
2804
|
var InputField$1 = function InputField(_ref) {
|
|
5290
|
-
var _condition$metadata,
|
|
2805
|
+
var _condition$metadata, _errors$conditions, _touched$conditions;
|
|
5291
2806
|
var name = _ref.name,
|
|
5292
2807
|
index = _ref.index,
|
|
5293
2808
|
placeholder = _ref.placeholder;
|
|
@@ -5304,9 +2819,9 @@ var InputField$1 = function InputField(_ref) {
|
|
|
5304
2819
|
return setShowInput(false);
|
|
5305
2820
|
});
|
|
5306
2821
|
var condition = conditions.value[index];
|
|
5307
|
-
var valueTerm = (_condition$metadata = condition.metadata) === null || _condition$metadata === void 0
|
|
2822
|
+
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();
|
|
5308
2823
|
var label = valueTerm && valueTerm !== null && valueTerm !== void 0 && valueTerm.trim().length ? valueTerm : t$1("neetoRules.form.addValue");
|
|
5309
|
-
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
2824
|
+
var isValid = errors.conditions && 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]) && 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]);
|
|
5310
2825
|
useEffect(function () {
|
|
5311
2826
|
setShowInput(false);
|
|
5312
2827
|
}, [condition.verb]);
|
|
@@ -5340,7 +2855,7 @@ var InputField$1 = function InputField(_ref) {
|
|
|
5340
2855
|
var Menu$4 = Dropdown$1.Menu,
|
|
5341
2856
|
MenuItem$4 = Dropdown$1.MenuItem;
|
|
5342
2857
|
var MultiSelect = function MultiSelect(_ref) {
|
|
5343
|
-
var _conditions$value$ind,
|
|
2858
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5344
2859
|
var name = _ref.name,
|
|
5345
2860
|
dropDownOptions = _ref.dropDownOptions,
|
|
5346
2861
|
index = _ref.index;
|
|
@@ -5358,14 +2873,14 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5358
2873
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
5359
2874
|
searchTerm = _useState4[0],
|
|
5360
2875
|
setSearchTerm = _useState4[1];
|
|
5361
|
-
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0
|
|
2876
|
+
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;
|
|
5362
2877
|
var selectedOptions = values || [];
|
|
5363
2878
|
var defaultLabel = t$1("neetoRules.form.selectValues");
|
|
5364
2879
|
var options = dropDownOptions === null || dropDownOptions === void 0 ? void 0 : dropDownOptions.filter(function (option) {
|
|
5365
2880
|
return selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.includes(option.value);
|
|
5366
2881
|
});
|
|
5367
2882
|
var searchedOptions = getSearchedOptions$2(dropDownOptions, searchTerm);
|
|
5368
|
-
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
2883
|
+
var isValid = errors.conditions && 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]) && 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]);
|
|
5369
2884
|
var handleMultiSelectOption = function handleMultiSelectOption(value) {
|
|
5370
2885
|
var options = selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.includes(value) ? without([value], selectedOptions) : append(value, selectedOptions);
|
|
5371
2886
|
setFieldValue(name, options);
|
|
@@ -5386,21 +2901,21 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5386
2901
|
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
5387
2902
|
key: idx
|
|
5388
2903
|
}, !!idx && /*#__PURE__*/React.createElement(Typography, {
|
|
5389
|
-
className: "neeto-ui-text-gray-700
|
|
2904
|
+
className: "neeto-ui-text-gray-700 mr-1 mt-1",
|
|
5390
2905
|
style: "h5",
|
|
5391
2906
|
weight: "normal"
|
|
5392
2907
|
}, t$1("neetoRules.common.or")), /*#__PURE__*/React.createElement(Typography, {
|
|
5393
2908
|
"data-cy": "condition-value-multi-select-field",
|
|
5394
2909
|
style: "h5",
|
|
5395
2910
|
weight: "semibold",
|
|
5396
|
-
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800
|
|
2911
|
+
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mr-1 mt-1 cursor-pointer underline", {
|
|
5397
2912
|
"neeto-ui-text-primary-800": activeOption === option.value
|
|
5398
2913
|
}),
|
|
5399
2914
|
onClick: function onClick() {
|
|
5400
2915
|
setTouched(assocPath(["conditions", "value", index], true, touched));
|
|
5401
2916
|
setActiveOption(activeOption ? null : option.value);
|
|
5402
2917
|
}
|
|
5403
|
-
}, option === null || option === void 0
|
|
2918
|
+
}, option === null || option === void 0 || (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.toLowerCase()));
|
|
5404
2919
|
})) : /*#__PURE__*/React.createElement(Typography, {
|
|
5405
2920
|
"data-cy": "condition-value-multi-select-field",
|
|
5406
2921
|
style: "h5",
|
|
@@ -5449,7 +2964,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5449
2964
|
|
|
5450
2965
|
var _excluded$6 = ["name", "index"];
|
|
5451
2966
|
var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
5452
|
-
var _conditions$value$ind,
|
|
2967
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5453
2968
|
var name = _ref.name,
|
|
5454
2969
|
index = _ref.index,
|
|
5455
2970
|
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
@@ -5467,10 +2982,10 @@ var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
|
5467
2982
|
useOnButtonPressed(initialFocusRef, function () {
|
|
5468
2983
|
return setShowPane(false);
|
|
5469
2984
|
});
|
|
5470
|
-
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0
|
|
2985
|
+
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;
|
|
5471
2986
|
var allOptions = getAllOptions(values);
|
|
5472
2987
|
var defaultLabel = t$1("neetoRules.form.selectValues");
|
|
5473
|
-
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
2988
|
+
var isValid = errors.conditions && 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]) && 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]);
|
|
5474
2989
|
return /*#__PURE__*/React.createElement(React.Fragment, null, isEmpty(allOptions) && /*#__PURE__*/React.createElement(Typography, {
|
|
5475
2990
|
"data-cy": "condition-value-multi-select-create-button",
|
|
5476
2991
|
style: "h5",
|
|
@@ -5542,8 +3057,388 @@ var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
|
5542
3057
|
}))));
|
|
5543
3058
|
};
|
|
5544
3059
|
|
|
3060
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3061
|
+
try {
|
|
3062
|
+
var info = gen[key](arg);
|
|
3063
|
+
var value = info.value;
|
|
3064
|
+
} catch (error) {
|
|
3065
|
+
reject(error);
|
|
3066
|
+
return;
|
|
3067
|
+
}
|
|
3068
|
+
if (info.done) {
|
|
3069
|
+
resolve(value);
|
|
3070
|
+
} else {
|
|
3071
|
+
Promise.resolve(value).then(_next, _throw);
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
function _asyncToGenerator(fn) {
|
|
3075
|
+
return function () {
|
|
3076
|
+
var self = this,
|
|
3077
|
+
args = arguments;
|
|
3078
|
+
return new Promise(function (resolve, reject) {
|
|
3079
|
+
var gen = fn.apply(self, args);
|
|
3080
|
+
function _next(value) {
|
|
3081
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
3082
|
+
}
|
|
3083
|
+
function _throw(err) {
|
|
3084
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
3085
|
+
}
|
|
3086
|
+
_next(undefined);
|
|
3087
|
+
});
|
|
3088
|
+
};
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
var regeneratorRuntime$1 = {exports: {}};
|
|
3092
|
+
|
|
3093
|
+
var _typeof = {exports: {}};
|
|
3094
|
+
|
|
3095
|
+
_typeof.exports;
|
|
3096
|
+
|
|
3097
|
+
(function (module) {
|
|
3098
|
+
function _typeof(obj) {
|
|
3099
|
+
"@babel/helpers - typeof";
|
|
3100
|
+
|
|
3101
|
+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
3102
|
+
return typeof obj;
|
|
3103
|
+
} : function (obj) {
|
|
3104
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
3105
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
3106
|
+
}
|
|
3107
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3108
|
+
} (_typeof));
|
|
3109
|
+
|
|
3110
|
+
var _typeofExports = _typeof.exports;
|
|
3111
|
+
|
|
3112
|
+
regeneratorRuntime$1.exports;
|
|
3113
|
+
|
|
3114
|
+
(function (module) {
|
|
3115
|
+
var _typeof = _typeofExports["default"];
|
|
3116
|
+
function _regeneratorRuntime() {
|
|
3117
|
+
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
3118
|
+
return exports;
|
|
3119
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3120
|
+
var exports = {},
|
|
3121
|
+
Op = Object.prototype,
|
|
3122
|
+
hasOwn = Op.hasOwnProperty,
|
|
3123
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
3124
|
+
obj[key] = desc.value;
|
|
3125
|
+
},
|
|
3126
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
3127
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
3128
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
3129
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
3130
|
+
function define(obj, key, value) {
|
|
3131
|
+
return Object.defineProperty(obj, key, {
|
|
3132
|
+
value: value,
|
|
3133
|
+
enumerable: !0,
|
|
3134
|
+
configurable: !0,
|
|
3135
|
+
writable: !0
|
|
3136
|
+
}), obj[key];
|
|
3137
|
+
}
|
|
3138
|
+
try {
|
|
3139
|
+
define({}, "");
|
|
3140
|
+
} catch (err) {
|
|
3141
|
+
define = function define(obj, key, value) {
|
|
3142
|
+
return obj[key] = value;
|
|
3143
|
+
};
|
|
3144
|
+
}
|
|
3145
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
3146
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
3147
|
+
generator = Object.create(protoGenerator.prototype),
|
|
3148
|
+
context = new Context(tryLocsList || []);
|
|
3149
|
+
return defineProperty(generator, "_invoke", {
|
|
3150
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
3151
|
+
}), generator;
|
|
3152
|
+
}
|
|
3153
|
+
function tryCatch(fn, obj, arg) {
|
|
3154
|
+
try {
|
|
3155
|
+
return {
|
|
3156
|
+
type: "normal",
|
|
3157
|
+
arg: fn.call(obj, arg)
|
|
3158
|
+
};
|
|
3159
|
+
} catch (err) {
|
|
3160
|
+
return {
|
|
3161
|
+
type: "throw",
|
|
3162
|
+
arg: err
|
|
3163
|
+
};
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
exports.wrap = wrap;
|
|
3167
|
+
var ContinueSentinel = {};
|
|
3168
|
+
function Generator() {}
|
|
3169
|
+
function GeneratorFunction() {}
|
|
3170
|
+
function GeneratorFunctionPrototype() {}
|
|
3171
|
+
var IteratorPrototype = {};
|
|
3172
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
3173
|
+
return this;
|
|
3174
|
+
});
|
|
3175
|
+
var getProto = Object.getPrototypeOf,
|
|
3176
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
3177
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
3178
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
3179
|
+
function defineIteratorMethods(prototype) {
|
|
3180
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
3181
|
+
define(prototype, method, function (arg) {
|
|
3182
|
+
return this._invoke(method, arg);
|
|
3183
|
+
});
|
|
3184
|
+
});
|
|
3185
|
+
}
|
|
3186
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
3187
|
+
function invoke(method, arg, resolve, reject) {
|
|
3188
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
3189
|
+
if ("throw" !== record.type) {
|
|
3190
|
+
var result = record.arg,
|
|
3191
|
+
value = result.value;
|
|
3192
|
+
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
3193
|
+
invoke("next", value, resolve, reject);
|
|
3194
|
+
}, function (err) {
|
|
3195
|
+
invoke("throw", err, resolve, reject);
|
|
3196
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
3197
|
+
result.value = unwrapped, resolve(result);
|
|
3198
|
+
}, function (error) {
|
|
3199
|
+
return invoke("throw", error, resolve, reject);
|
|
3200
|
+
});
|
|
3201
|
+
}
|
|
3202
|
+
reject(record.arg);
|
|
3203
|
+
}
|
|
3204
|
+
var previousPromise;
|
|
3205
|
+
defineProperty(this, "_invoke", {
|
|
3206
|
+
value: function value(method, arg) {
|
|
3207
|
+
function callInvokeWithMethodAndArg() {
|
|
3208
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
3209
|
+
invoke(method, arg, resolve, reject);
|
|
3210
|
+
});
|
|
3211
|
+
}
|
|
3212
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
3213
|
+
}
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3216
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
3217
|
+
var state = "suspendedStart";
|
|
3218
|
+
return function (method, arg) {
|
|
3219
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
3220
|
+
if ("completed" === state) {
|
|
3221
|
+
if ("throw" === method) throw arg;
|
|
3222
|
+
return doneResult();
|
|
3223
|
+
}
|
|
3224
|
+
for (context.method = method, context.arg = arg;;) {
|
|
3225
|
+
var delegate = context.delegate;
|
|
3226
|
+
if (delegate) {
|
|
3227
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
3228
|
+
if (delegateResult) {
|
|
3229
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
3230
|
+
return delegateResult;
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
3234
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
3235
|
+
context.dispatchException(context.arg);
|
|
3236
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
3237
|
+
state = "executing";
|
|
3238
|
+
var record = tryCatch(innerFn, self, context);
|
|
3239
|
+
if ("normal" === record.type) {
|
|
3240
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
3241
|
+
return {
|
|
3242
|
+
value: record.arg,
|
|
3243
|
+
done: context.done
|
|
3244
|
+
};
|
|
3245
|
+
}
|
|
3246
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
3247
|
+
}
|
|
3248
|
+
};
|
|
3249
|
+
}
|
|
3250
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
3251
|
+
var methodName = context.method,
|
|
3252
|
+
method = delegate.iterator[methodName];
|
|
3253
|
+
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;
|
|
3254
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
3255
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
3256
|
+
var info = record.arg;
|
|
3257
|
+
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);
|
|
3258
|
+
}
|
|
3259
|
+
function pushTryEntry(locs) {
|
|
3260
|
+
var entry = {
|
|
3261
|
+
tryLoc: locs[0]
|
|
3262
|
+
};
|
|
3263
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
3264
|
+
}
|
|
3265
|
+
function resetTryEntry(entry) {
|
|
3266
|
+
var record = entry.completion || {};
|
|
3267
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
3268
|
+
}
|
|
3269
|
+
function Context(tryLocsList) {
|
|
3270
|
+
this.tryEntries = [{
|
|
3271
|
+
tryLoc: "root"
|
|
3272
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
3273
|
+
}
|
|
3274
|
+
function values(iterable) {
|
|
3275
|
+
if (iterable) {
|
|
3276
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
3277
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
3278
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
3279
|
+
if (!isNaN(iterable.length)) {
|
|
3280
|
+
var i = -1,
|
|
3281
|
+
next = function next() {
|
|
3282
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
3283
|
+
return next.value = undefined, next.done = !0, next;
|
|
3284
|
+
};
|
|
3285
|
+
return next.next = next;
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
return {
|
|
3289
|
+
next: doneResult
|
|
3290
|
+
};
|
|
3291
|
+
}
|
|
3292
|
+
function doneResult() {
|
|
3293
|
+
return {
|
|
3294
|
+
value: undefined,
|
|
3295
|
+
done: !0
|
|
3296
|
+
};
|
|
3297
|
+
}
|
|
3298
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
3299
|
+
value: GeneratorFunctionPrototype,
|
|
3300
|
+
configurable: !0
|
|
3301
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
3302
|
+
value: GeneratorFunction,
|
|
3303
|
+
configurable: !0
|
|
3304
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
3305
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
3306
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
3307
|
+
}, exports.mark = function (genFun) {
|
|
3308
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
3309
|
+
}, exports.awrap = function (arg) {
|
|
3310
|
+
return {
|
|
3311
|
+
__await: arg
|
|
3312
|
+
};
|
|
3313
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
3314
|
+
return this;
|
|
3315
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
3316
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
3317
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
3318
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
3319
|
+
return result.done ? result.value : iter.next();
|
|
3320
|
+
});
|
|
3321
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
3322
|
+
return this;
|
|
3323
|
+
}), define(Gp, "toString", function () {
|
|
3324
|
+
return "[object Generator]";
|
|
3325
|
+
}), exports.keys = function (val) {
|
|
3326
|
+
var object = Object(val),
|
|
3327
|
+
keys = [];
|
|
3328
|
+
for (var key in object) keys.push(key);
|
|
3329
|
+
return keys.reverse(), function next() {
|
|
3330
|
+
for (; keys.length;) {
|
|
3331
|
+
var key = keys.pop();
|
|
3332
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
3333
|
+
}
|
|
3334
|
+
return next.done = !0, next;
|
|
3335
|
+
};
|
|
3336
|
+
}, exports.values = values, Context.prototype = {
|
|
3337
|
+
constructor: Context,
|
|
3338
|
+
reset: function reset(skipTempReset) {
|
|
3339
|
+
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);
|
|
3340
|
+
},
|
|
3341
|
+
stop: function stop() {
|
|
3342
|
+
this.done = !0;
|
|
3343
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
3344
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
3345
|
+
return this.rval;
|
|
3346
|
+
},
|
|
3347
|
+
dispatchException: function dispatchException(exception) {
|
|
3348
|
+
if (this.done) throw exception;
|
|
3349
|
+
var context = this;
|
|
3350
|
+
function handle(loc, caught) {
|
|
3351
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
3352
|
+
}
|
|
3353
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3354
|
+
var entry = this.tryEntries[i],
|
|
3355
|
+
record = entry.completion;
|
|
3356
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
3357
|
+
if (entry.tryLoc <= this.prev) {
|
|
3358
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
3359
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
3360
|
+
if (hasCatch && hasFinally) {
|
|
3361
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
3362
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
3363
|
+
} else if (hasCatch) {
|
|
3364
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
3365
|
+
} else {
|
|
3366
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
3367
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
},
|
|
3372
|
+
abrupt: function abrupt(type, arg) {
|
|
3373
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3374
|
+
var entry = this.tryEntries[i];
|
|
3375
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
3376
|
+
var finallyEntry = entry;
|
|
3377
|
+
break;
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
3381
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
3382
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
3383
|
+
},
|
|
3384
|
+
complete: function complete(record, afterLoc) {
|
|
3385
|
+
if ("throw" === record.type) throw record.arg;
|
|
3386
|
+
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;
|
|
3387
|
+
},
|
|
3388
|
+
finish: function finish(finallyLoc) {
|
|
3389
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3390
|
+
var entry = this.tryEntries[i];
|
|
3391
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
3392
|
+
}
|
|
3393
|
+
},
|
|
3394
|
+
"catch": function _catch(tryLoc) {
|
|
3395
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3396
|
+
var entry = this.tryEntries[i];
|
|
3397
|
+
if (entry.tryLoc === tryLoc) {
|
|
3398
|
+
var record = entry.completion;
|
|
3399
|
+
if ("throw" === record.type) {
|
|
3400
|
+
var thrown = record.arg;
|
|
3401
|
+
resetTryEntry(entry);
|
|
3402
|
+
}
|
|
3403
|
+
return thrown;
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
throw new Error("illegal catch attempt");
|
|
3407
|
+
},
|
|
3408
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
3409
|
+
return this.delegate = {
|
|
3410
|
+
iterator: values(iterable),
|
|
3411
|
+
resultName: resultName,
|
|
3412
|
+
nextLoc: nextLoc
|
|
3413
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
3414
|
+
}
|
|
3415
|
+
}, exports;
|
|
3416
|
+
}
|
|
3417
|
+
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3418
|
+
} (regeneratorRuntime$1));
|
|
3419
|
+
|
|
3420
|
+
var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
|
|
3421
|
+
|
|
3422
|
+
// TODO(Babel 8): Remove this file.
|
|
3423
|
+
|
|
3424
|
+
var runtime = regeneratorRuntimeExports();
|
|
3425
|
+
var regenerator = runtime;
|
|
3426
|
+
|
|
3427
|
+
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
3428
|
+
try {
|
|
3429
|
+
regeneratorRuntime = runtime;
|
|
3430
|
+
} catch (accidentalStrictMode) {
|
|
3431
|
+
if (typeof globalThis === "object") {
|
|
3432
|
+
globalThis.regeneratorRuntime = runtime;
|
|
3433
|
+
} else {
|
|
3434
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
|
|
3438
|
+
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
3439
|
+
|
|
5545
3440
|
var DateField = function DateField(_ref) {
|
|
5546
|
-
var _conditions$value$ind, _errors$conditions,
|
|
3441
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5547
3442
|
var name = _ref.name,
|
|
5548
3443
|
index = _ref.index,
|
|
5549
3444
|
conditionName = _ref.conditionName;
|
|
@@ -5560,30 +3455,28 @@ var DateField = function DateField(_ref) {
|
|
|
5560
3455
|
setShowInput = _useState2[1];
|
|
5561
3456
|
var valueTerm = (_conditions$value$ind = conditions.value[index].metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.value;
|
|
5562
3457
|
var label = valueTerm || t$1("neetoRules.form.selectDate").toLowerCase();
|
|
5563
|
-
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3458
|
+
var isValid = errors.conditions && 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]) && 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]);
|
|
5564
3459
|
var handleValidate = /*#__PURE__*/function () {
|
|
5565
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
5566
|
-
return
|
|
5567
|
-
while (1) {
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
if (isEmpty(errors)) {
|
|
5572
|
-
_context.next = 4;
|
|
5573
|
-
break;
|
|
5574
|
-
}
|
|
3460
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
3461
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
3462
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3463
|
+
case 0:
|
|
3464
|
+
_context.prev = 0;
|
|
3465
|
+
if (isEmpty(errors)) {
|
|
5575
3466
|
_context.next = 4;
|
|
5576
|
-
return validateField(conditionName);
|
|
5577
|
-
case 4:
|
|
5578
|
-
_context.next = 8;
|
|
5579
3467
|
break;
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
3468
|
+
}
|
|
3469
|
+
_context.next = 4;
|
|
3470
|
+
return validateField(conditionName);
|
|
3471
|
+
case 4:
|
|
3472
|
+
_context.next = 8;
|
|
3473
|
+
break;
|
|
3474
|
+
case 6:
|
|
3475
|
+
_context.prev = 6;
|
|
3476
|
+
_context.t0 = _context["catch"](0);
|
|
3477
|
+
case 8:
|
|
3478
|
+
case "end":
|
|
3479
|
+
return _context.stop();
|
|
5587
3480
|
}
|
|
5588
3481
|
}, _callee, null, [[0, 6]]);
|
|
5589
3482
|
}));
|
|
@@ -5645,8 +3538,8 @@ var ValueField = function ValueField(_ref) {
|
|
|
5645
3538
|
if (INPUT_FIELD_TYPES.includes(fieldType)) {
|
|
5646
3539
|
return /*#__PURE__*/React.createElement(InputField$1, {
|
|
5647
3540
|
conditionName: conditionName,
|
|
5648
|
-
"data-cy": "condition-value-".concat(fieldType, "-field"),
|
|
5649
3541
|
index: index,
|
|
3542
|
+
"data-cy": "condition-value-".concat(fieldType, "-field"),
|
|
5650
3543
|
name: "".concat(name, ".value"),
|
|
5651
3544
|
placeholder: t("neetoRules.common.value")
|
|
5652
3545
|
});
|
|
@@ -5654,8 +3547,8 @@ var ValueField = function ValueField(_ref) {
|
|
|
5654
3547
|
if (fieldType === CONDITION_VALUE_TYPES.textarea) {
|
|
5655
3548
|
var _condition$metadata;
|
|
5656
3549
|
return /*#__PURE__*/React.createElement(LongTextField, {
|
|
5657
|
-
defaultLabel: t("neetoRules.labels.text"),
|
|
5658
3550
|
index: index,
|
|
3551
|
+
defaultLabel: t("neetoRules.labels.text"),
|
|
5659
3552
|
name: "".concat(name, ".value"),
|
|
5660
3553
|
value: (_condition$metadata = condition.metadata) === null || _condition$metadata === void 0 ? void 0 : _condition$metadata.value
|
|
5661
3554
|
});
|
|
@@ -5663,23 +3556,23 @@ var ValueField = function ValueField(_ref) {
|
|
|
5663
3556
|
if (fieldType === CONDITION_VALUE_TYPES.dropdown) {
|
|
5664
3557
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
5665
3558
|
index: index,
|
|
5666
|
-
|
|
5667
|
-
|
|
3559
|
+
options: options,
|
|
3560
|
+
name: "".concat(name, ".value")
|
|
5668
3561
|
});
|
|
5669
3562
|
}
|
|
5670
3563
|
if (fieldType === CONDITION_VALUE_TYPES.multiSelect) {
|
|
5671
3564
|
return /*#__PURE__*/React.createElement(MultiSelect, {
|
|
5672
|
-
dropDownOptions: options,
|
|
5673
3565
|
index: index,
|
|
3566
|
+
dropDownOptions: options,
|
|
5674
3567
|
name: "".concat(name, ".values")
|
|
5675
3568
|
});
|
|
5676
3569
|
}
|
|
5677
3570
|
if (fieldType === CONDITION_VALUE_TYPES.multiSelectCreate) {
|
|
5678
3571
|
return /*#__PURE__*/React.createElement(MultiSelectCreate, {
|
|
5679
|
-
isCreateable: true,
|
|
5680
3572
|
index: index,
|
|
5681
|
-
name: "".concat(name, ".values"),
|
|
5682
3573
|
options: options,
|
|
3574
|
+
isCreateable: true,
|
|
3575
|
+
name: "".concat(name, ".values"),
|
|
5683
3576
|
placeholder: t("neetoRules.placeholders.multiSelect")
|
|
5684
3577
|
});
|
|
5685
3578
|
}
|
|
@@ -5744,22 +3637,22 @@ var ConditionItem = function ConditionItem(_ref) {
|
|
|
5744
3637
|
style: "h5",
|
|
5745
3638
|
weight: "normal"
|
|
5746
3639
|
}, defaultLabel), /*#__PURE__*/React.createElement(DropdownField, {
|
|
3640
|
+
index: index,
|
|
5747
3641
|
fieldType: "field",
|
|
5748
3642
|
handleSelect: handleFieldChange,
|
|
5749
|
-
index: index,
|
|
5750
3643
|
options: conditionOptions,
|
|
5751
3644
|
placeholder: t("neetoRules.form.selectField")
|
|
5752
3645
|
}), /*#__PURE__*/React.createElement(DropdownField, {
|
|
3646
|
+
index: index,
|
|
5753
3647
|
fieldType: "verb",
|
|
5754
3648
|
handleSelect: handleVerbChange,
|
|
5755
|
-
index: index,
|
|
5756
3649
|
options: verbOptions,
|
|
5757
3650
|
placeholder: t("neetoRules.form.selectVerb")
|
|
5758
3651
|
}), /*#__PURE__*/React.createElement(ValueField, {
|
|
5759
3652
|
condition: condition,
|
|
3653
|
+
index: index,
|
|
5760
3654
|
conditionName: name,
|
|
5761
3655
|
field: selectedField,
|
|
5762
|
-
index: index,
|
|
5763
3656
|
name: "".concat(name, ".metadata"),
|
|
5764
3657
|
options: getSelectedFieldOptions()
|
|
5765
3658
|
}));
|
|
@@ -5805,7 +3698,7 @@ var Conditions = function Conditions(_ref) {
|
|
|
5805
3698
|
var _elementProps$conditi;
|
|
5806
3699
|
arrayHelpers.push({
|
|
5807
3700
|
field: elementProps === null || elementProps === void 0 ? void 0 : elementProps.conditionOptions[0].value,
|
|
5808
|
-
verb: elementProps === null || elementProps === void 0
|
|
3701
|
+
verb: elementProps === null || elementProps === void 0 || (_elementProps$conditi = elementProps.conditionOptions[0]) === null || _elementProps$conditi === void 0 ? void 0 : _elementProps$conditi.allowMatching[0],
|
|
5809
3702
|
joinType: logicOperation,
|
|
5810
3703
|
metadata: {}
|
|
5811
3704
|
});
|
|
@@ -5846,10 +3739,10 @@ var Conditions = function Conditions(_ref) {
|
|
|
5846
3739
|
elementProps: elementProps,
|
|
5847
3740
|
index: index,
|
|
5848
3741
|
isWithEvents: isWithEvents,
|
|
5849
|
-
|
|
5850
|
-
name: "".concat(name, ".value.").concat(index),
|
|
3742
|
+
onSelectCondition: onSelectCondition,
|
|
5851
3743
|
selectedConditionOptions: selectedConditionOptions,
|
|
5852
|
-
|
|
3744
|
+
key: index,
|
|
3745
|
+
name: "".concat(name, ".value.").concat(index)
|
|
5853
3746
|
})), /*#__PURE__*/React.createElement("div", {
|
|
5854
3747
|
className: "flex"
|
|
5855
3748
|
}, index === conditions.length - 1 && /*#__PURE__*/React.createElement(Button, {
|
|
@@ -6008,7 +3901,7 @@ var Performer$1 = function Performer(_ref) {
|
|
|
6008
3901
|
return !prevState;
|
|
6009
3902
|
});
|
|
6010
3903
|
}
|
|
6011
|
-
}, selectedOption === null || selectedOption === void 0
|
|
3904
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
6012
3905
|
onClose: handleClose
|
|
6013
3906
|
}, /*#__PURE__*/React.createElement(Menu$3, {
|
|
6014
3907
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -6172,7 +4065,7 @@ var Events$1 = function Events(_ref) {
|
|
|
6172
4065
|
onClick: function onClick() {
|
|
6173
4066
|
return setActiveOption(activeOption ? null : event.value);
|
|
6174
4067
|
}
|
|
6175
|
-
}, event === null || event === void 0
|
|
4068
|
+
}, event === null || event === void 0 || (_event$label = event.label) === null || _event$label === void 0 ? void 0 : _event$label.toLowerCase()));
|
|
6176
4069
|
})) : /*#__PURE__*/React.createElement(Typography, {
|
|
6177
4070
|
"data-cy": "condition-value-multi-select-field",
|
|
6178
4071
|
style: "h5",
|
|
@@ -6242,7 +4135,7 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6242
4135
|
var _conditionProps$condi;
|
|
6243
4136
|
setFieldValue("".concat(conditionsName, ".value"), [{
|
|
6244
4137
|
field: conditionProps === null || conditionProps === void 0 ? void 0 : conditionProps.conditionOptions[0].value,
|
|
6245
|
-
verb: conditionProps === null || conditionProps === void 0
|
|
4138
|
+
verb: conditionProps === null || conditionProps === void 0 || (_conditionProps$condi = conditionProps.conditionOptions[0]) === null || _conditionProps$condi === void 0 ? void 0 : _conditionProps$condi.allowMatching[0],
|
|
6246
4139
|
joinType: OPERATORS.or,
|
|
6247
4140
|
metadata: {}
|
|
6248
4141
|
}]);
|
|
@@ -6258,8 +4151,8 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6258
4151
|
}, /*#__PURE__*/React.createElement(Events$1, {
|
|
6259
4152
|
data: data,
|
|
6260
4153
|
name: name,
|
|
6261
|
-
|
|
6262
|
-
|
|
4154
|
+
onSelectEvent: onSelectEvent,
|
|
4155
|
+
performerName: performerName
|
|
6263
4156
|
})), showAddButton && /*#__PURE__*/React.createElement(Button, {
|
|
6264
4157
|
"data-cy": "add-condition-button",
|
|
6265
4158
|
"data-test-id": "automation-rules-add-events-button",
|
|
@@ -6274,8 +4167,8 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6274
4167
|
})), !showAddButton && /*#__PURE__*/React.createElement("div", {
|
|
6275
4168
|
className: "mt-3"
|
|
6276
4169
|
}, /*#__PURE__*/React.createElement(Conditions, _extends({
|
|
6277
|
-
isWithEvents: true,
|
|
6278
4170
|
data: data,
|
|
4171
|
+
isWithEvents: true,
|
|
6279
4172
|
name: conditionsName
|
|
6280
4173
|
}, config)))));
|
|
6281
4174
|
};
|
|
@@ -6478,7 +4371,7 @@ var Performer = function Performer(_ref) {
|
|
|
6478
4371
|
return !prevState;
|
|
6479
4372
|
});
|
|
6480
4373
|
}
|
|
6481
|
-
}, selectedOption === null || selectedOption === void 0
|
|
4374
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
6482
4375
|
onClose: handleClose
|
|
6483
4376
|
}, /*#__PURE__*/React.createElement(Menu, {
|
|
6484
4377
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -6539,10 +4432,9 @@ var Events = function Events(_ref) {
|
|
|
6539
4432
|
arrayHelpers.remove(index);
|
|
6540
4433
|
};
|
|
6541
4434
|
var popEvent = function popEvent(arrayHelpers) {
|
|
6542
|
-
if (isNotEmpty(arrayHelpers) && isNotEmpty(events))
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
}
|
|
4435
|
+
if (!(isNotEmpty(arrayHelpers) && isNotEmpty(events))) return;
|
|
4436
|
+
var eventIdx = events.length - 1;
|
|
4437
|
+
_removeEvent(eventIdx, events[eventIdx], arrayHelpers);
|
|
6546
4438
|
};
|
|
6547
4439
|
var handleAddEvent = function handleAddEvent(arrayHelpers) {
|
|
6548
4440
|
return arrayHelpers.push({
|
|
@@ -6583,7 +4475,7 @@ var Events = function Events(_ref) {
|
|
|
6583
4475
|
return /*#__PURE__*/React.createElement("div", {
|
|
6584
4476
|
className: "flex justify-between"
|
|
6585
4477
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6586
|
-
className: classNames("flex flex-wrap gap-
|
|
4478
|
+
className: classNames("flex flex-wrap gap-x-2 gap-y-2", {
|
|
6587
4479
|
"max-w-2xl": showAddButton
|
|
6588
4480
|
})
|
|
6589
4481
|
}, showMessage && /*#__PURE__*/React.createElement(Typography, {
|
|
@@ -6606,12 +4498,12 @@ var Events = function Events(_ref) {
|
|
|
6606
4498
|
}, t$1("neetoRules.common.or")), /*#__PURE__*/React.createElement(EventItem, {
|
|
6607
4499
|
elementProps: elementProps,
|
|
6608
4500
|
event: event,
|
|
4501
|
+
onSelectEvent: onSelectEvent,
|
|
6609
4502
|
name: "".concat(name, ".value.").concat(index, ".name"),
|
|
6610
4503
|
parentName: name,
|
|
6611
4504
|
removeEvent: function removeEvent() {
|
|
6612
4505
|
return _removeEvent(index, event, arrayHelpers);
|
|
6613
|
-
}
|
|
6614
|
-
onSelectEvent: onSelectEvent
|
|
4506
|
+
}
|
|
6615
4507
|
}));
|
|
6616
4508
|
}), !showMessage && /*#__PURE__*/React.createElement(Performer, {
|
|
6617
4509
|
data: data,
|
|
@@ -6716,9 +4608,9 @@ var RadioField = function RadioField(_ref) {
|
|
|
6716
4608
|
var label = _ref2.label,
|
|
6717
4609
|
value = _ref2.value;
|
|
6718
4610
|
return /*#__PURE__*/React.createElement(Radio.Item, {
|
|
6719
|
-
key: index,
|
|
6720
4611
|
label: label,
|
|
6721
|
-
value: value
|
|
4612
|
+
value: value,
|
|
4613
|
+
key: index
|
|
6722
4614
|
});
|
|
6723
4615
|
})));
|
|
6724
4616
|
};
|
|
@@ -6789,5 +4681,5 @@ NeetoRules.Card = Card;
|
|
|
6789
4681
|
NeetoRules.MultiSelectField = MultiSelectField;
|
|
6790
4682
|
NeetoRules.EventConditions = EventConditions;
|
|
6791
4683
|
|
|
6792
|
-
export { NeetoRules as NeetoRulesForm, RulePreview, NeetoRules$1 as default };
|
|
4684
|
+
export { NeetoRules as NeetoRulesForm, RulePreview, NeetoRules$1 as default, useCustomDataStore };
|
|
6793
4685
|
//# sourceMappingURL=index.js.map
|