@bigbinary/neeto-molecules 1.1.39 → 1.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Sidebar.js +2 -4
- package/dist/Sidebar.js.map +1 -1
- package/dist/Taxonomy.js +1656 -103
- package/dist/Taxonomy.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +11 -1
package/dist/Taxonomy.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import React, { useRef, useState } from 'react';
|
|
2
|
-
import { t } from 'i18next';
|
|
1
|
+
import React, { forwardRef, useRef, useState } from 'react';
|
|
2
|
+
import { t as t$1 } from 'i18next';
|
|
3
|
+
import { isNotEmpty, noop, isNotPresent, capitalize } from '@bigbinary/neeto-cist';
|
|
3
4
|
import { globalProps, taxonomies } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
4
5
|
import { withTitle } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
6
|
+
import { Typography, Dropdown as Dropdown$1, Button, Tooltip, Pane, Toastr, Table, Alert, NoData } from '@bigbinary/neetoui';
|
|
7
|
+
import { not, mergeRight, toPairs, fromPairs, keys, pick, prop } from 'ramda';
|
|
8
|
+
import { useTranslation, Trans } from 'react-i18next';
|
|
9
|
+
import classnames from 'classnames';
|
|
10
|
+
import Search from '@bigbinary/neeto-molecules/Search';
|
|
11
|
+
import { Link } from 'react-router-dom';
|
|
12
|
+
import { MenuHorizontal, Column, Download, Filter, MenuVertical } from '@bigbinary/neeto-icons';
|
|
13
|
+
import ManageColumns from '@bigbinary/neeto-molecules/Columns';
|
|
14
|
+
import { Filters } from '@bigbinary/neeto-filters-frontend';
|
|
10
15
|
import { Form, Input, ActionBlock } from '@bigbinary/neetoui/formik';
|
|
11
|
-
import { useTranslation } from 'react-i18next';
|
|
12
16
|
import * as yup from 'yup';
|
|
13
17
|
import { useMutation } from 'react-query';
|
|
14
18
|
import axios from 'axios';
|
|
15
19
|
import { BASE_API_V1_URL } from '@bigbinary/neeto-commons-frontend/constants';
|
|
16
|
-
import { capitalize } from '@bigbinary/neeto-cist';
|
|
17
|
-
import { MenuVertical, MenuHorizontal } from '@bigbinary/neeto-icons';
|
|
18
20
|
|
|
19
21
|
function _arrayWithHoles(arr) {
|
|
20
22
|
if (Array.isArray(arr)) return arr;
|
|
@@ -71,63 +73,1315 @@ function _slicedToArray(arr, i) {
|
|
|
71
73
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
var
|
|
75
|
-
var VALIDATION_SCHEMA = yup.object().shape({
|
|
76
|
-
singularLabel: yup.string().trim().required(t("neetoMolecules.taxonomy.editPane.validations.singularLabelRequired")),
|
|
77
|
-
pluralLabel: yup.string().trim().required(t("neetoMolecules.taxonomy.editPane.validations.pluralLabelRequired"))
|
|
78
|
-
});
|
|
76
|
+
var propTypes = {exports: {}};
|
|
79
77
|
|
|
80
|
-
var
|
|
81
|
-
var keyName = _ref.keyName,
|
|
82
|
-
payload = _ref.payload;
|
|
83
|
-
return axios.patch("".concat(BASE_API_V1_URL, "/taxonomies/").concat(keyName), payload);
|
|
84
|
-
};
|
|
85
|
-
var bulkDestroy = function bulkDestroy(payload) {
|
|
86
|
-
return axios["delete"]("".concat(BASE_API_V1_URL, "/taxonomies/bulk_destroy"), {
|
|
87
|
-
data: payload
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
var taxonomiesApi = {
|
|
91
|
-
update: update,
|
|
92
|
-
bulkDestroy: bulkDestroy
|
|
93
|
-
};
|
|
78
|
+
var reactIs = {exports: {}};
|
|
94
79
|
|
|
95
|
-
var
|
|
96
|
-
return useMutation(taxonomiesApi.update, options);
|
|
97
|
-
};
|
|
98
|
-
var useBulkDestroyTaxonomies = function useBulkDestroyTaxonomies(options) {
|
|
99
|
-
return useMutation(taxonomiesApi.bulkDestroy, options);
|
|
100
|
-
};
|
|
80
|
+
var reactIs_production_min = {};
|
|
101
81
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
82
|
+
/** @license React v16.13.1
|
|
83
|
+
* react-is.production.min.js
|
|
84
|
+
*
|
|
85
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
86
|
+
*
|
|
87
|
+
* This source code is licensed under the MIT license found in the
|
|
88
|
+
* LICENSE file in the root directory of this source tree.
|
|
89
|
+
*/
|
|
90
|
+
|
|
91
|
+
var hasRequiredReactIs_production_min;
|
|
92
|
+
|
|
93
|
+
function requireReactIs_production_min () {
|
|
94
|
+
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
95
|
+
hasRequiredReactIs_production_min = 1;
|
|
96
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
97
|
+
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
98
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
|
|
99
|
+
reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
|
|
100
|
+
reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
|
|
101
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof 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)};reactIs_production_min.typeOf=z;
|
|
102
|
+
return reactIs_production_min;
|
|
113
103
|
}
|
|
114
104
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
105
|
+
var reactIs_development = {};
|
|
106
|
+
|
|
107
|
+
/** @license React v16.13.1
|
|
108
|
+
* react-is.development.js
|
|
109
|
+
*
|
|
110
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
111
|
+
*
|
|
112
|
+
* This source code is licensed under the MIT license found in the
|
|
113
|
+
* LICENSE file in the root directory of this source tree.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
var hasRequiredReactIs_development;
|
|
117
|
+
|
|
118
|
+
function requireReactIs_development () {
|
|
119
|
+
if (hasRequiredReactIs_development) return reactIs_development;
|
|
120
|
+
hasRequiredReactIs_development = 1;
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
if (process.env.NODE_ENV !== "production") {
|
|
125
|
+
(function() {
|
|
126
|
+
|
|
127
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
128
|
+
// nor polyfill, then a plain number is used for performance.
|
|
129
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
130
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
131
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
132
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
133
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
134
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
135
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
136
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
137
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
138
|
+
|
|
139
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
140
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
141
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
142
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
143
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
144
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
145
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
146
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
147
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
148
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
149
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
150
|
+
|
|
151
|
+
function isValidElementType(type) {
|
|
152
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
153
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function typeOf(object) {
|
|
157
|
+
if (typeof object === 'object' && object !== null) {
|
|
158
|
+
var $$typeof = object.$$typeof;
|
|
159
|
+
|
|
160
|
+
switch ($$typeof) {
|
|
161
|
+
case REACT_ELEMENT_TYPE:
|
|
162
|
+
var type = object.type;
|
|
163
|
+
|
|
164
|
+
switch (type) {
|
|
165
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
166
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
167
|
+
case REACT_FRAGMENT_TYPE:
|
|
168
|
+
case REACT_PROFILER_TYPE:
|
|
169
|
+
case REACT_STRICT_MODE_TYPE:
|
|
170
|
+
case REACT_SUSPENSE_TYPE:
|
|
171
|
+
return type;
|
|
172
|
+
|
|
173
|
+
default:
|
|
174
|
+
var $$typeofType = type && type.$$typeof;
|
|
175
|
+
|
|
176
|
+
switch ($$typeofType) {
|
|
177
|
+
case REACT_CONTEXT_TYPE:
|
|
178
|
+
case REACT_FORWARD_REF_TYPE:
|
|
179
|
+
case REACT_LAZY_TYPE:
|
|
180
|
+
case REACT_MEMO_TYPE:
|
|
181
|
+
case REACT_PROVIDER_TYPE:
|
|
182
|
+
return $$typeofType;
|
|
183
|
+
|
|
184
|
+
default:
|
|
185
|
+
return $$typeof;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
case REACT_PORTAL_TYPE:
|
|
191
|
+
return $$typeof;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return undefined;
|
|
196
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
197
|
+
|
|
198
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
199
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
200
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
201
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
202
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
203
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
204
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
205
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
206
|
+
var Memo = REACT_MEMO_TYPE;
|
|
207
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
208
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
209
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
210
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
211
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
212
|
+
|
|
213
|
+
function isAsyncMode(object) {
|
|
214
|
+
{
|
|
215
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
216
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
217
|
+
|
|
218
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
223
|
+
}
|
|
224
|
+
function isConcurrentMode(object) {
|
|
225
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
226
|
+
}
|
|
227
|
+
function isContextConsumer(object) {
|
|
228
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
229
|
+
}
|
|
230
|
+
function isContextProvider(object) {
|
|
231
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
232
|
+
}
|
|
233
|
+
function isElement(object) {
|
|
234
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
235
|
+
}
|
|
236
|
+
function isForwardRef(object) {
|
|
237
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
238
|
+
}
|
|
239
|
+
function isFragment(object) {
|
|
240
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
241
|
+
}
|
|
242
|
+
function isLazy(object) {
|
|
243
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
244
|
+
}
|
|
245
|
+
function isMemo(object) {
|
|
246
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
247
|
+
}
|
|
248
|
+
function isPortal(object) {
|
|
249
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
250
|
+
}
|
|
251
|
+
function isProfiler(object) {
|
|
252
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
253
|
+
}
|
|
254
|
+
function isStrictMode(object) {
|
|
255
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
256
|
+
}
|
|
257
|
+
function isSuspense(object) {
|
|
258
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
reactIs_development.AsyncMode = AsyncMode;
|
|
262
|
+
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
263
|
+
reactIs_development.ContextConsumer = ContextConsumer;
|
|
264
|
+
reactIs_development.ContextProvider = ContextProvider;
|
|
265
|
+
reactIs_development.Element = Element;
|
|
266
|
+
reactIs_development.ForwardRef = ForwardRef;
|
|
267
|
+
reactIs_development.Fragment = Fragment;
|
|
268
|
+
reactIs_development.Lazy = Lazy;
|
|
269
|
+
reactIs_development.Memo = Memo;
|
|
270
|
+
reactIs_development.Portal = Portal;
|
|
271
|
+
reactIs_development.Profiler = Profiler;
|
|
272
|
+
reactIs_development.StrictMode = StrictMode;
|
|
273
|
+
reactIs_development.Suspense = Suspense;
|
|
274
|
+
reactIs_development.isAsyncMode = isAsyncMode;
|
|
275
|
+
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
276
|
+
reactIs_development.isContextConsumer = isContextConsumer;
|
|
277
|
+
reactIs_development.isContextProvider = isContextProvider;
|
|
278
|
+
reactIs_development.isElement = isElement;
|
|
279
|
+
reactIs_development.isForwardRef = isForwardRef;
|
|
280
|
+
reactIs_development.isFragment = isFragment;
|
|
281
|
+
reactIs_development.isLazy = isLazy;
|
|
282
|
+
reactIs_development.isMemo = isMemo;
|
|
283
|
+
reactIs_development.isPortal = isPortal;
|
|
284
|
+
reactIs_development.isProfiler = isProfiler;
|
|
285
|
+
reactIs_development.isStrictMode = isStrictMode;
|
|
286
|
+
reactIs_development.isSuspense = isSuspense;
|
|
287
|
+
reactIs_development.isValidElementType = isValidElementType;
|
|
288
|
+
reactIs_development.typeOf = typeOf;
|
|
289
|
+
})();
|
|
290
|
+
}
|
|
291
|
+
return reactIs_development;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
var hasRequiredReactIs;
|
|
295
|
+
|
|
296
|
+
function requireReactIs () {
|
|
297
|
+
if (hasRequiredReactIs) return reactIs.exports;
|
|
298
|
+
hasRequiredReactIs = 1;
|
|
299
|
+
(function (module) {
|
|
300
|
+
|
|
301
|
+
if (process.env.NODE_ENV === 'production') {
|
|
302
|
+
module.exports = requireReactIs_production_min();
|
|
303
|
+
} else {
|
|
304
|
+
module.exports = requireReactIs_development();
|
|
305
|
+
}
|
|
306
|
+
} (reactIs));
|
|
307
|
+
return reactIs.exports;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/*
|
|
311
|
+
object-assign
|
|
312
|
+
(c) Sindre Sorhus
|
|
313
|
+
@license MIT
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
var objectAssign;
|
|
317
|
+
var hasRequiredObjectAssign;
|
|
318
|
+
|
|
319
|
+
function requireObjectAssign () {
|
|
320
|
+
if (hasRequiredObjectAssign) return objectAssign;
|
|
321
|
+
hasRequiredObjectAssign = 1;
|
|
322
|
+
/* eslint-disable no-unused-vars */
|
|
323
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
324
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
325
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
326
|
+
|
|
327
|
+
function toObject(val) {
|
|
328
|
+
if (val === null || val === undefined) {
|
|
329
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return Object(val);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function shouldUseNative() {
|
|
336
|
+
try {
|
|
337
|
+
if (!Object.assign) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
342
|
+
|
|
343
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
344
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
345
|
+
test1[5] = 'de';
|
|
346
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
351
|
+
var test2 = {};
|
|
352
|
+
for (var i = 0; i < 10; i++) {
|
|
353
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
354
|
+
}
|
|
355
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
356
|
+
return test2[n];
|
|
357
|
+
});
|
|
358
|
+
if (order2.join('') !== '0123456789') {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
363
|
+
var test3 = {};
|
|
364
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
365
|
+
test3[letter] = letter;
|
|
366
|
+
});
|
|
367
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
368
|
+
'abcdefghijklmnopqrst') {
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return true;
|
|
373
|
+
} catch (err) {
|
|
374
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
380
|
+
var from;
|
|
381
|
+
var to = toObject(target);
|
|
382
|
+
var symbols;
|
|
383
|
+
|
|
384
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
385
|
+
from = Object(arguments[s]);
|
|
386
|
+
|
|
387
|
+
for (var key in from) {
|
|
388
|
+
if (hasOwnProperty.call(from, key)) {
|
|
389
|
+
to[key] = from[key];
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
if (getOwnPropertySymbols) {
|
|
394
|
+
symbols = getOwnPropertySymbols(from);
|
|
395
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
396
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
397
|
+
to[symbols[i]] = from[symbols[i]];
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return to;
|
|
404
|
+
};
|
|
405
|
+
return objectAssign;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
410
|
+
*
|
|
411
|
+
* This source code is licensed under the MIT license found in the
|
|
412
|
+
* LICENSE file in the root directory of this source tree.
|
|
413
|
+
*/
|
|
414
|
+
|
|
415
|
+
var ReactPropTypesSecret_1;
|
|
416
|
+
var hasRequiredReactPropTypesSecret;
|
|
417
|
+
|
|
418
|
+
function requireReactPropTypesSecret () {
|
|
419
|
+
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
420
|
+
hasRequiredReactPropTypesSecret = 1;
|
|
421
|
+
|
|
422
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
423
|
+
|
|
424
|
+
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
425
|
+
return ReactPropTypesSecret_1;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
var has;
|
|
429
|
+
var hasRequiredHas;
|
|
430
|
+
|
|
431
|
+
function requireHas () {
|
|
432
|
+
if (hasRequiredHas) return has;
|
|
433
|
+
hasRequiredHas = 1;
|
|
434
|
+
has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
435
|
+
return has;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
440
|
+
*
|
|
441
|
+
* This source code is licensed under the MIT license found in the
|
|
442
|
+
* LICENSE file in the root directory of this source tree.
|
|
443
|
+
*/
|
|
444
|
+
|
|
445
|
+
var checkPropTypes_1;
|
|
446
|
+
var hasRequiredCheckPropTypes;
|
|
447
|
+
|
|
448
|
+
function requireCheckPropTypes () {
|
|
449
|
+
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
|
|
450
|
+
hasRequiredCheckPropTypes = 1;
|
|
451
|
+
|
|
452
|
+
var printWarning = function() {};
|
|
453
|
+
|
|
454
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
455
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
456
|
+
var loggedTypeFailures = {};
|
|
457
|
+
var has = requireHas();
|
|
458
|
+
|
|
459
|
+
printWarning = function(text) {
|
|
460
|
+
var message = 'Warning: ' + text;
|
|
461
|
+
if (typeof console !== 'undefined') {
|
|
462
|
+
console.error(message);
|
|
463
|
+
}
|
|
464
|
+
try {
|
|
465
|
+
// --- Welcome to debugging React ---
|
|
466
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
467
|
+
// to find the callsite that caused this warning to fire.
|
|
468
|
+
throw new Error(message);
|
|
469
|
+
} catch (x) { /**/ }
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Assert that the values match with the type specs.
|
|
475
|
+
* Error messages are memorized and will only be shown once.
|
|
476
|
+
*
|
|
477
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
478
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
479
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
480
|
+
* @param {string} componentName Name of the component for error messages.
|
|
481
|
+
* @param {?Function} getStack Returns the component stack.
|
|
482
|
+
* @private
|
|
483
|
+
*/
|
|
484
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
485
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
486
|
+
for (var typeSpecName in typeSpecs) {
|
|
487
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
488
|
+
var error;
|
|
489
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
490
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
491
|
+
// After these have been cleaned up, we'll let them throw.
|
|
492
|
+
try {
|
|
493
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
494
|
+
// behavior as without this statement except with a better message.
|
|
495
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
496
|
+
var err = Error(
|
|
497
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
498
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
499
|
+
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
500
|
+
);
|
|
501
|
+
err.name = 'Invariant Violation';
|
|
502
|
+
throw err;
|
|
503
|
+
}
|
|
504
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
505
|
+
} catch (ex) {
|
|
506
|
+
error = ex;
|
|
507
|
+
}
|
|
508
|
+
if (error && !(error instanceof Error)) {
|
|
509
|
+
printWarning(
|
|
510
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
511
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
512
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
513
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
514
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
515
|
+
'shape all require an argument).'
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
519
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
520
|
+
// same error.
|
|
521
|
+
loggedTypeFailures[error.message] = true;
|
|
522
|
+
|
|
523
|
+
var stack = getStack ? getStack() : '';
|
|
524
|
+
|
|
525
|
+
printWarning(
|
|
526
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Resets warning cache when testing.
|
|
536
|
+
*
|
|
537
|
+
* @private
|
|
538
|
+
*/
|
|
539
|
+
checkPropTypes.resetWarningCache = function() {
|
|
540
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
541
|
+
loggedTypeFailures = {};
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
checkPropTypes_1 = checkPropTypes;
|
|
546
|
+
return checkPropTypes_1;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
551
|
+
*
|
|
552
|
+
* This source code is licensed under the MIT license found in the
|
|
553
|
+
* LICENSE file in the root directory of this source tree.
|
|
554
|
+
*/
|
|
555
|
+
|
|
556
|
+
var factoryWithTypeCheckers;
|
|
557
|
+
var hasRequiredFactoryWithTypeCheckers;
|
|
558
|
+
|
|
559
|
+
function requireFactoryWithTypeCheckers () {
|
|
560
|
+
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
|
|
561
|
+
hasRequiredFactoryWithTypeCheckers = 1;
|
|
562
|
+
|
|
563
|
+
var ReactIs = requireReactIs();
|
|
564
|
+
var assign = requireObjectAssign();
|
|
565
|
+
|
|
566
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
567
|
+
var has = requireHas();
|
|
568
|
+
var checkPropTypes = requireCheckPropTypes();
|
|
569
|
+
|
|
570
|
+
var printWarning = function() {};
|
|
571
|
+
|
|
572
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
573
|
+
printWarning = function(text) {
|
|
574
|
+
var message = 'Warning: ' + text;
|
|
575
|
+
if (typeof console !== 'undefined') {
|
|
576
|
+
console.error(message);
|
|
577
|
+
}
|
|
578
|
+
try {
|
|
579
|
+
// --- Welcome to debugging React ---
|
|
580
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
581
|
+
// to find the callsite that caused this warning to fire.
|
|
582
|
+
throw new Error(message);
|
|
583
|
+
} catch (x) {}
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
function emptyFunctionThatReturnsNull() {
|
|
588
|
+
return null;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
592
|
+
/* global Symbol */
|
|
593
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
594
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Returns the iterator method function contained on the iterable object.
|
|
598
|
+
*
|
|
599
|
+
* Be sure to invoke the function with the iterable as context:
|
|
600
|
+
*
|
|
601
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
|
602
|
+
* if (iteratorFn) {
|
|
603
|
+
* var iterator = iteratorFn.call(myIterable);
|
|
604
|
+
* ...
|
|
605
|
+
* }
|
|
606
|
+
*
|
|
607
|
+
* @param {?object} maybeIterable
|
|
608
|
+
* @return {?function}
|
|
609
|
+
*/
|
|
610
|
+
function getIteratorFn(maybeIterable) {
|
|
611
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
612
|
+
if (typeof iteratorFn === 'function') {
|
|
613
|
+
return iteratorFn;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Collection of methods that allow declaration and validation of props that are
|
|
619
|
+
* supplied to React components. Example usage:
|
|
620
|
+
*
|
|
621
|
+
* var Props = require('ReactPropTypes');
|
|
622
|
+
* var MyArticle = React.createClass({
|
|
623
|
+
* propTypes: {
|
|
624
|
+
* // An optional string prop named "description".
|
|
625
|
+
* description: Props.string,
|
|
626
|
+
*
|
|
627
|
+
* // A required enum prop named "category".
|
|
628
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
629
|
+
*
|
|
630
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
|
631
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
|
632
|
+
* },
|
|
633
|
+
* render: function() { ... }
|
|
634
|
+
* });
|
|
635
|
+
*
|
|
636
|
+
* A more formal specification of how these methods are used:
|
|
637
|
+
*
|
|
638
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
639
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
640
|
+
*
|
|
641
|
+
* Each and every declaration produces a function with the same signature. This
|
|
642
|
+
* allows the creation of custom validation functions. For example:
|
|
643
|
+
*
|
|
644
|
+
* var MyLink = React.createClass({
|
|
645
|
+
* propTypes: {
|
|
646
|
+
* // An optional string or URI prop named "href".
|
|
647
|
+
* href: function(props, propName, componentName) {
|
|
648
|
+
* var propValue = props[propName];
|
|
649
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
|
650
|
+
* !(propValue instanceof URI)) {
|
|
651
|
+
* return new Error(
|
|
652
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
653
|
+
* componentName
|
|
654
|
+
* );
|
|
655
|
+
* }
|
|
656
|
+
* }
|
|
657
|
+
* },
|
|
658
|
+
* render: function() {...}
|
|
659
|
+
* });
|
|
660
|
+
*
|
|
661
|
+
* @internal
|
|
662
|
+
*/
|
|
663
|
+
|
|
664
|
+
var ANONYMOUS = '<<anonymous>>';
|
|
665
|
+
|
|
666
|
+
// Important!
|
|
667
|
+
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
668
|
+
var ReactPropTypes = {
|
|
669
|
+
array: createPrimitiveTypeChecker('array'),
|
|
670
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
|
671
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
|
672
|
+
func: createPrimitiveTypeChecker('function'),
|
|
673
|
+
number: createPrimitiveTypeChecker('number'),
|
|
674
|
+
object: createPrimitiveTypeChecker('object'),
|
|
675
|
+
string: createPrimitiveTypeChecker('string'),
|
|
676
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
|
677
|
+
|
|
678
|
+
any: createAnyTypeChecker(),
|
|
679
|
+
arrayOf: createArrayOfTypeChecker,
|
|
680
|
+
element: createElementTypeChecker(),
|
|
681
|
+
elementType: createElementTypeTypeChecker(),
|
|
682
|
+
instanceOf: createInstanceTypeChecker,
|
|
683
|
+
node: createNodeChecker(),
|
|
684
|
+
objectOf: createObjectOfTypeChecker,
|
|
685
|
+
oneOf: createEnumTypeChecker,
|
|
686
|
+
oneOfType: createUnionTypeChecker,
|
|
687
|
+
shape: createShapeTypeChecker,
|
|
688
|
+
exact: createStrictShapeTypeChecker,
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
693
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
694
|
+
*/
|
|
695
|
+
/*eslint-disable no-self-compare*/
|
|
696
|
+
function is(x, y) {
|
|
697
|
+
// SameValue algorithm
|
|
698
|
+
if (x === y) {
|
|
699
|
+
// Steps 1-5, 7-10
|
|
700
|
+
// Steps 6.b-6.e: +0 != -0
|
|
701
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
702
|
+
} else {
|
|
703
|
+
// Step 6.a: NaN == NaN
|
|
704
|
+
return x !== x && y !== y;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
/*eslint-enable no-self-compare*/
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* We use an Error-like object for backward compatibility as people may call
|
|
711
|
+
* PropTypes directly and inspect their output. However, we don't use real
|
|
712
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
713
|
+
* is prohibitively expensive if they are created too often, such as what
|
|
714
|
+
* happens in oneOfType() for any type before the one that matched.
|
|
715
|
+
*/
|
|
716
|
+
function PropTypeError(message, data) {
|
|
717
|
+
this.message = message;
|
|
718
|
+
this.data = data && typeof data === 'object' ? data: {};
|
|
719
|
+
this.stack = '';
|
|
720
|
+
}
|
|
721
|
+
// Make `instanceof Error` still work for returned errors.
|
|
722
|
+
PropTypeError.prototype = Error.prototype;
|
|
723
|
+
|
|
724
|
+
function createChainableTypeChecker(validate) {
|
|
725
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
726
|
+
var manualPropTypeCallCache = {};
|
|
727
|
+
var manualPropTypeWarningCount = 0;
|
|
728
|
+
}
|
|
729
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
730
|
+
componentName = componentName || ANONYMOUS;
|
|
731
|
+
propFullName = propFullName || propName;
|
|
732
|
+
|
|
733
|
+
if (secret !== ReactPropTypesSecret) {
|
|
734
|
+
if (throwOnDirectAccess) {
|
|
735
|
+
// New behavior only for users of `prop-types` package
|
|
736
|
+
var err = new Error(
|
|
737
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
738
|
+
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
739
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
740
|
+
);
|
|
741
|
+
err.name = 'Invariant Violation';
|
|
742
|
+
throw err;
|
|
743
|
+
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
744
|
+
// Old behavior for people using React.PropTypes
|
|
745
|
+
var cacheKey = componentName + ':' + propName;
|
|
746
|
+
if (
|
|
747
|
+
!manualPropTypeCallCache[cacheKey] &&
|
|
748
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
749
|
+
manualPropTypeWarningCount < 3
|
|
750
|
+
) {
|
|
751
|
+
printWarning(
|
|
752
|
+
'You are manually calling a React.PropTypes validation ' +
|
|
753
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
754
|
+
'and will throw in the standalone `prop-types` package. ' +
|
|
755
|
+
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
756
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
757
|
+
);
|
|
758
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
759
|
+
manualPropTypeWarningCount++;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
if (props[propName] == null) {
|
|
764
|
+
if (isRequired) {
|
|
765
|
+
if (props[propName] === null) {
|
|
766
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
767
|
+
}
|
|
768
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
769
|
+
}
|
|
770
|
+
return null;
|
|
771
|
+
} else {
|
|
772
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
777
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
778
|
+
|
|
779
|
+
return chainedCheckType;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
783
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
784
|
+
var propValue = props[propName];
|
|
785
|
+
var propType = getPropType(propValue);
|
|
786
|
+
if (propType !== expectedType) {
|
|
787
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
788
|
+
// check, but we can offer a more precise error message here rather than
|
|
789
|
+
// 'of type `object`'.
|
|
790
|
+
var preciseType = getPreciseType(propValue);
|
|
791
|
+
|
|
792
|
+
return new PropTypeError(
|
|
793
|
+
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
794
|
+
{expectedType: expectedType}
|
|
795
|
+
);
|
|
796
|
+
}
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
return createChainableTypeChecker(validate);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
function createAnyTypeChecker() {
|
|
803
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
807
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
808
|
+
if (typeof typeChecker !== 'function') {
|
|
809
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
810
|
+
}
|
|
811
|
+
var propValue = props[propName];
|
|
812
|
+
if (!Array.isArray(propValue)) {
|
|
813
|
+
var propType = getPropType(propValue);
|
|
814
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
815
|
+
}
|
|
816
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
817
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
|
818
|
+
if (error instanceof Error) {
|
|
819
|
+
return error;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
return null;
|
|
823
|
+
}
|
|
824
|
+
return createChainableTypeChecker(validate);
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
function createElementTypeChecker() {
|
|
828
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
829
|
+
var propValue = props[propName];
|
|
830
|
+
if (!isValidElement(propValue)) {
|
|
831
|
+
var propType = getPropType(propValue);
|
|
832
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
833
|
+
}
|
|
834
|
+
return null;
|
|
835
|
+
}
|
|
836
|
+
return createChainableTypeChecker(validate);
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
function createElementTypeTypeChecker() {
|
|
840
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
841
|
+
var propValue = props[propName];
|
|
842
|
+
if (!ReactIs.isValidElementType(propValue)) {
|
|
843
|
+
var propType = getPropType(propValue);
|
|
844
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
845
|
+
}
|
|
846
|
+
return null;
|
|
847
|
+
}
|
|
848
|
+
return createChainableTypeChecker(validate);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
852
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
853
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
854
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
855
|
+
var actualClassName = getClassName(props[propName]);
|
|
856
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
857
|
+
}
|
|
858
|
+
return null;
|
|
859
|
+
}
|
|
860
|
+
return createChainableTypeChecker(validate);
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
function createEnumTypeChecker(expectedValues) {
|
|
864
|
+
if (!Array.isArray(expectedValues)) {
|
|
865
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
866
|
+
if (arguments.length > 1) {
|
|
867
|
+
printWarning(
|
|
868
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
869
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
870
|
+
);
|
|
871
|
+
} else {
|
|
872
|
+
printWarning('Invalid argument supplied to oneOf, expected an array.');
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
return emptyFunctionThatReturnsNull;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
879
|
+
var propValue = props[propName];
|
|
880
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
881
|
+
if (is(propValue, expectedValues[i])) {
|
|
882
|
+
return null;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
887
|
+
var type = getPreciseType(value);
|
|
888
|
+
if (type === 'symbol') {
|
|
889
|
+
return String(value);
|
|
890
|
+
}
|
|
891
|
+
return value;
|
|
892
|
+
});
|
|
893
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
894
|
+
}
|
|
895
|
+
return createChainableTypeChecker(validate);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
899
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
900
|
+
if (typeof typeChecker !== 'function') {
|
|
901
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
902
|
+
}
|
|
903
|
+
var propValue = props[propName];
|
|
904
|
+
var propType = getPropType(propValue);
|
|
905
|
+
if (propType !== 'object') {
|
|
906
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
907
|
+
}
|
|
908
|
+
for (var key in propValue) {
|
|
909
|
+
if (has(propValue, key)) {
|
|
910
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
911
|
+
if (error instanceof Error) {
|
|
912
|
+
return error;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
return null;
|
|
917
|
+
}
|
|
918
|
+
return createChainableTypeChecker(validate);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
922
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
923
|
+
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
924
|
+
return emptyFunctionThatReturnsNull;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
928
|
+
var checker = arrayOfTypeCheckers[i];
|
|
929
|
+
if (typeof checker !== 'function') {
|
|
930
|
+
printWarning(
|
|
931
|
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
932
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
933
|
+
);
|
|
934
|
+
return emptyFunctionThatReturnsNull;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
939
|
+
var expectedTypes = [];
|
|
940
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
941
|
+
var checker = arrayOfTypeCheckers[i];
|
|
942
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
943
|
+
if (checkerResult == null) {
|
|
944
|
+
return null;
|
|
945
|
+
}
|
|
946
|
+
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
947
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
951
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
952
|
+
}
|
|
953
|
+
return createChainableTypeChecker(validate);
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
function createNodeChecker() {
|
|
957
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
958
|
+
if (!isNode(props[propName])) {
|
|
959
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
960
|
+
}
|
|
961
|
+
return null;
|
|
962
|
+
}
|
|
963
|
+
return createChainableTypeChecker(validate);
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
967
|
+
return new PropTypeError(
|
|
968
|
+
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
969
|
+
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
970
|
+
);
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
974
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
975
|
+
var propValue = props[propName];
|
|
976
|
+
var propType = getPropType(propValue);
|
|
977
|
+
if (propType !== 'object') {
|
|
978
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
979
|
+
}
|
|
980
|
+
for (var key in shapeTypes) {
|
|
981
|
+
var checker = shapeTypes[key];
|
|
982
|
+
if (typeof checker !== 'function') {
|
|
983
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
984
|
+
}
|
|
985
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
986
|
+
if (error) {
|
|
987
|
+
return error;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
return null;
|
|
991
|
+
}
|
|
992
|
+
return createChainableTypeChecker(validate);
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
996
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
997
|
+
var propValue = props[propName];
|
|
998
|
+
var propType = getPropType(propValue);
|
|
999
|
+
if (propType !== 'object') {
|
|
1000
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1001
|
+
}
|
|
1002
|
+
// We need to check all keys in case some are required but missing from props.
|
|
1003
|
+
var allKeys = assign({}, props[propName], shapeTypes);
|
|
1004
|
+
for (var key in allKeys) {
|
|
1005
|
+
var checker = shapeTypes[key];
|
|
1006
|
+
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
1007
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1008
|
+
}
|
|
1009
|
+
if (!checker) {
|
|
1010
|
+
return new PropTypeError(
|
|
1011
|
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
1012
|
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
1013
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
1014
|
+
);
|
|
1015
|
+
}
|
|
1016
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
|
1017
|
+
if (error) {
|
|
1018
|
+
return error;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
return null;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
return createChainableTypeChecker(validate);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
function isNode(propValue) {
|
|
1028
|
+
switch (typeof propValue) {
|
|
1029
|
+
case 'number':
|
|
1030
|
+
case 'string':
|
|
1031
|
+
case 'undefined':
|
|
1032
|
+
return true;
|
|
1033
|
+
case 'boolean':
|
|
1034
|
+
return !propValue;
|
|
1035
|
+
case 'object':
|
|
1036
|
+
if (Array.isArray(propValue)) {
|
|
1037
|
+
return propValue.every(isNode);
|
|
1038
|
+
}
|
|
1039
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
1040
|
+
return true;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
1044
|
+
if (iteratorFn) {
|
|
1045
|
+
var iterator = iteratorFn.call(propValue);
|
|
1046
|
+
var step;
|
|
1047
|
+
if (iteratorFn !== propValue.entries) {
|
|
1048
|
+
while (!(step = iterator.next()).done) {
|
|
1049
|
+
if (!isNode(step.value)) {
|
|
1050
|
+
return false;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
} else {
|
|
1054
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
1055
|
+
while (!(step = iterator.next()).done) {
|
|
1056
|
+
var entry = step.value;
|
|
1057
|
+
if (entry) {
|
|
1058
|
+
if (!isNode(entry[1])) {
|
|
1059
|
+
return false;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
} else {
|
|
1065
|
+
return false;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
return true;
|
|
1069
|
+
default:
|
|
1070
|
+
return false;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
function isSymbol(propType, propValue) {
|
|
1075
|
+
// Native Symbol.
|
|
1076
|
+
if (propType === 'symbol') {
|
|
1077
|
+
return true;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
// falsy value can't be a Symbol
|
|
1081
|
+
if (!propValue) {
|
|
1082
|
+
return false;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1086
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1087
|
+
return true;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1091
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1092
|
+
return true;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
return false;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1099
|
+
function getPropType(propValue) {
|
|
1100
|
+
var propType = typeof propValue;
|
|
1101
|
+
if (Array.isArray(propValue)) {
|
|
1102
|
+
return 'array';
|
|
1103
|
+
}
|
|
1104
|
+
if (propValue instanceof RegExp) {
|
|
1105
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1106
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1107
|
+
// passes PropTypes.object.
|
|
1108
|
+
return 'object';
|
|
1109
|
+
}
|
|
1110
|
+
if (isSymbol(propType, propValue)) {
|
|
1111
|
+
return 'symbol';
|
|
1112
|
+
}
|
|
1113
|
+
return propType;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
1117
|
+
// See `createPrimitiveTypeChecker`.
|
|
1118
|
+
function getPreciseType(propValue) {
|
|
1119
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1120
|
+
return '' + propValue;
|
|
1121
|
+
}
|
|
1122
|
+
var propType = getPropType(propValue);
|
|
1123
|
+
if (propType === 'object') {
|
|
1124
|
+
if (propValue instanceof Date) {
|
|
1125
|
+
return 'date';
|
|
1126
|
+
} else if (propValue instanceof RegExp) {
|
|
1127
|
+
return 'regexp';
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
return propType;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
1134
|
+
// For example, "undefined" or "of type array"
|
|
1135
|
+
function getPostfixForTypeWarning(value) {
|
|
1136
|
+
var type = getPreciseType(value);
|
|
1137
|
+
switch (type) {
|
|
1138
|
+
case 'array':
|
|
1139
|
+
case 'object':
|
|
1140
|
+
return 'an ' + type;
|
|
1141
|
+
case 'boolean':
|
|
1142
|
+
case 'date':
|
|
1143
|
+
case 'regexp':
|
|
1144
|
+
return 'a ' + type;
|
|
1145
|
+
default:
|
|
1146
|
+
return type;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
// Returns class name of the object, if any.
|
|
1151
|
+
function getClassName(propValue) {
|
|
1152
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1153
|
+
return ANONYMOUS;
|
|
1154
|
+
}
|
|
1155
|
+
return propValue.constructor.name;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
1159
|
+
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
1160
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1161
|
+
|
|
1162
|
+
return ReactPropTypes;
|
|
1163
|
+
};
|
|
1164
|
+
return factoryWithTypeCheckers;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1169
|
+
*
|
|
1170
|
+
* This source code is licensed under the MIT license found in the
|
|
1171
|
+
* LICENSE file in the root directory of this source tree.
|
|
1172
|
+
*/
|
|
1173
|
+
|
|
1174
|
+
var factoryWithThrowingShims;
|
|
1175
|
+
var hasRequiredFactoryWithThrowingShims;
|
|
1176
|
+
|
|
1177
|
+
function requireFactoryWithThrowingShims () {
|
|
1178
|
+
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
1179
|
+
hasRequiredFactoryWithThrowingShims = 1;
|
|
1180
|
+
|
|
1181
|
+
var ReactPropTypesSecret = requireReactPropTypesSecret();
|
|
1182
|
+
|
|
1183
|
+
function emptyFunction() {}
|
|
1184
|
+
function emptyFunctionWithReset() {}
|
|
1185
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1186
|
+
|
|
1187
|
+
factoryWithThrowingShims = function() {
|
|
1188
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1189
|
+
if (secret === ReactPropTypesSecret) {
|
|
1190
|
+
// It is still safe when called from React.
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
var err = new Error(
|
|
1194
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1195
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
1196
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
1197
|
+
);
|
|
1198
|
+
err.name = 'Invariant Violation';
|
|
1199
|
+
throw err;
|
|
1200
|
+
} shim.isRequired = shim;
|
|
1201
|
+
function getShim() {
|
|
1202
|
+
return shim;
|
|
1203
|
+
} // Important!
|
|
1204
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1205
|
+
var ReactPropTypes = {
|
|
1206
|
+
array: shim,
|
|
1207
|
+
bigint: shim,
|
|
1208
|
+
bool: shim,
|
|
1209
|
+
func: shim,
|
|
1210
|
+
number: shim,
|
|
1211
|
+
object: shim,
|
|
1212
|
+
string: shim,
|
|
1213
|
+
symbol: shim,
|
|
1214
|
+
|
|
1215
|
+
any: shim,
|
|
1216
|
+
arrayOf: getShim,
|
|
1217
|
+
element: shim,
|
|
1218
|
+
elementType: shim,
|
|
1219
|
+
instanceOf: getShim,
|
|
1220
|
+
node: shim,
|
|
1221
|
+
objectOf: getShim,
|
|
1222
|
+
oneOf: getShim,
|
|
1223
|
+
oneOfType: getShim,
|
|
1224
|
+
shape: getShim,
|
|
1225
|
+
exact: getShim,
|
|
1226
|
+
|
|
1227
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1228
|
+
resetWarningCache: emptyFunction
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1232
|
+
|
|
1233
|
+
return ReactPropTypes;
|
|
1234
|
+
};
|
|
1235
|
+
return factoryWithThrowingShims;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1240
|
+
*
|
|
1241
|
+
* This source code is licensed under the MIT license found in the
|
|
1242
|
+
* LICENSE file in the root directory of this source tree.
|
|
1243
|
+
*/
|
|
1244
|
+
|
|
1245
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1246
|
+
var ReactIs = requireReactIs();
|
|
1247
|
+
|
|
1248
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1249
|
+
// http://fb.me/prop-types-in-prod
|
|
1250
|
+
var throwOnDirectAccess = true;
|
|
1251
|
+
propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
1252
|
+
} else {
|
|
1253
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1254
|
+
// http://fb.me/prop-types-in-prod
|
|
1255
|
+
propTypes.exports = requireFactoryWithThrowingShims()();
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
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}}
|
|
1259
|
+
|
|
1260
|
+
var css$2 = ".neeto-molecules-container{align-items:flex-start;display:flex;flex-direction:column;flex-grow:1;height:100vh;justify-content:flex-start;overflow-y:auto;padding:0 40px!important}.neeto-molecules-container--header-fixed{padding:0!important}.neeto-molecules-container--header-fixed>.neeto-molecules-header,.neeto-molecules-container--header-fixed>.neeto-molecules-scrollable,.neeto-molecules-container--header-fixed>.neeto-molecules-subheader{padding-left:40px!important;padding-right:40px!important}";
|
|
1261
|
+
n(css$2,{});
|
|
1262
|
+
|
|
1263
|
+
var Container = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
1264
|
+
var _ref$isHeaderFixed = _ref.isHeaderFixed,
|
|
1265
|
+
isHeaderFixed = _ref$isHeaderFixed === void 0 ? false : _ref$isHeaderFixed,
|
|
1266
|
+
children = _ref.children;
|
|
1267
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1268
|
+
ref: ref,
|
|
1269
|
+
className: classnames("neeto-molecules-container", {
|
|
1270
|
+
"neeto-molecules-container--header-fixed": isHeaderFixed
|
|
1271
|
+
})
|
|
1272
|
+
}, children);
|
|
1273
|
+
});
|
|
1274
|
+
Container.displayName = "Container";
|
|
1275
|
+
Container.propTypes = {
|
|
1276
|
+
/**
|
|
1277
|
+
* Decides whether the `Header` component should be stickied at the top on scroll.
|
|
1278
|
+
*/
|
|
1279
|
+
isHeaderFixed: propTypes.exports.bool
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1282
|
+
function _extends() {
|
|
1283
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1284
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1285
|
+
var source = arguments[i];
|
|
1286
|
+
for (var key in source) {
|
|
1287
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1288
|
+
target[key] = source[key];
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
126
1291
|
}
|
|
127
|
-
|
|
128
|
-
|
|
1292
|
+
return target;
|
|
1293
|
+
};
|
|
1294
|
+
return _extends.apply(this, arguments);
|
|
129
1295
|
}
|
|
130
1296
|
|
|
1297
|
+
var css$1 = ":root{--neeto-molecules-main-header-height:98px;--neeto-molecules-main-header-with-breadcrumbs-height:170px}.neeto-molecules-header{align-items:flex-start!important;background:rgb(var(--neeto-ui-white));display:flex;flex-direction:row;justify-content:space-between;min-height:98px;min-height:var(--neeto-molecules-main-header-height);padding:40px 0 24px!important;width:100%}.neeto-molecules-header .neeto-molecules-header__toggle-menubar-btn{margin-right:8px}.neeto-molecules-header .neeto-molecules-header__left{align-items:flex-start!important;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start}.neeto-molecules-header .neeto-molecules-header__left-data-wrap{display:flex;flex-wrap:wrap}.neeto-molecules-header .neeto-molecules-header__page-title{align-items:center;display:flex;flex-direction:row;gap:12px;margin-top:-16px;width:100%}.neeto-molecules-header .neeto-molecules-header__page-title h2{font-size:40px;line-height:var(--neeto-ui-leading-tight)}.neeto-molecules-header .neeto-molecules-header__breadcrumbs-wrap{display:flex;margin:0 0 40px}.neeto-molecules-header .neeto-molecules-header__breadcrumb{align-items:center;display:flex;flex-direction:row;justify-content:flex-start;line-height:1}.neeto-molecules-header .neeto-molecules-header__breadcrumb a{text-decoration:none;transition:all .3s ease-in-out}.neeto-molecules-header .neeto-molecules-header__breadcrumb a:focus-visible{border-radius:var(--neeto-ui-rounded-sm);outline:3px solid rgba(var(--neeto-ui-primary-500),50%)}.neeto-molecules-header .neeto-molecules-header__breadcrumb-separator{font-size:12px;line-height:16px;margin:0 12px!important}.neeto-molecules-header .neeto-molecules-header__right{align-items:center;display:flex;flex-direction:row;justify-content:flex-end}.neeto-molecules-header--has-breadcrumbs{min-height:170px;min-height:var(--neeto-molecules-main-header-with-breadcrumbs-height)}.neeto-molecules-header--has-breadcrumbs .neeto-molecules-header__page-title{margin-top:0}.neeto-molecules-header--nano,.neeto-molecules-header--small{flex-shrink:0;min-height:0}.neeto-molecules-header--nano .neeto-molecules-header__breadcrumbs-wrap,.neeto-molecules-header--small .neeto-molecules-header__breadcrumbs-wrap{margin:0 0 16px}.neeto-molecules-header--small .neeto-molecules-header__page-title{margin-top:-4px}.neeto-molecules-header--small .neeto-molecules-header__page-title h2{font-size:32px}.neeto-molecules-header--nano .neeto-molecules-header__page-title{margin-top:0}.neeto-molecules-header--nano .neeto-molecules-header__page-title h2{font-size:24px}";
|
|
1298
|
+
n(css$1,{});
|
|
1299
|
+
|
|
1300
|
+
var Breadcrumbs = function Breadcrumbs(_ref) {
|
|
1301
|
+
var breadcrumbs = _ref.breadcrumbs;
|
|
1302
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1303
|
+
className: "neeto-molecules-header__breadcrumbs-wrap"
|
|
1304
|
+
}, breadcrumbs.map(function (_ref2, index) {
|
|
1305
|
+
var text = _ref2.text,
|
|
1306
|
+
_ref2$link = _ref2.link,
|
|
1307
|
+
link = _ref2$link === void 0 ? "#" : _ref2$link;
|
|
1308
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1309
|
+
className: "neeto-molecules-header__breadcrumb",
|
|
1310
|
+
"data-cy": "header-breadcrumb",
|
|
1311
|
+
key: index
|
|
1312
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
1313
|
+
to: link
|
|
1314
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
1315
|
+
className: "neeto-ui-text-gray-700 hover:neeto-ui-text-gray-800 neeto-molecules-header__breadcrumb-link",
|
|
1316
|
+
component: "span",
|
|
1317
|
+
"data-cy": text,
|
|
1318
|
+
"data-test-id": text,
|
|
1319
|
+
style: "body2",
|
|
1320
|
+
weight: "normal"
|
|
1321
|
+
}, text)), index !== breadcrumbs.length - 1 && /*#__PURE__*/React.createElement("span", {
|
|
1322
|
+
className: "neeto-molecules-header__breadcrumb-separator neeto-ui-text-black"
|
|
1323
|
+
}, "/"));
|
|
1324
|
+
}));
|
|
1325
|
+
};
|
|
1326
|
+
var Breadcrumbs$1 = /*#__PURE__*/React.memo(Breadcrumbs);
|
|
1327
|
+
|
|
1328
|
+
var SIZES = {
|
|
1329
|
+
nano: "nano",
|
|
1330
|
+
small: "small",
|
|
1331
|
+
large: "large"
|
|
1332
|
+
};
|
|
1333
|
+
|
|
1334
|
+
var Dropdown = function Dropdown(props) {
|
|
1335
|
+
return /*#__PURE__*/React.createElement(Dropdown$1, _extends({
|
|
1336
|
+
buttonStyle: "text",
|
|
1337
|
+
icon: MenuHorizontal,
|
|
1338
|
+
position: "bottom-end"
|
|
1339
|
+
}, props));
|
|
1340
|
+
};
|
|
1341
|
+
|
|
1342
|
+
var Header = function Header(_ref) {
|
|
1343
|
+
var title = _ref.title,
|
|
1344
|
+
searchProps = _ref.searchProps,
|
|
1345
|
+
_ref$className = _ref.className,
|
|
1346
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
1347
|
+
actionBlock = _ref.actionBlock,
|
|
1348
|
+
_ref$breadcrumbs = _ref.breadcrumbs,
|
|
1349
|
+
breadcrumbs = _ref$breadcrumbs === void 0 ? [] : _ref$breadcrumbs,
|
|
1350
|
+
_ref$renderDropdown = _ref.renderDropdown,
|
|
1351
|
+
renderDropdown = _ref$renderDropdown === void 0 ? noop : _ref$renderDropdown,
|
|
1352
|
+
_ref$size = _ref.size,
|
|
1353
|
+
size = _ref$size === void 0 ? "large" : _ref$size,
|
|
1354
|
+
_ref$dataTestid = _ref["data-testid"],
|
|
1355
|
+
dataTestId = _ref$dataTestid === void 0 ? "neeto-molecules-header" : _ref$dataTestid;
|
|
1356
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1357
|
+
"data-testid": dataTestId,
|
|
1358
|
+
className: classnames(["neeto-molecules-header", {
|
|
1359
|
+
"neeto-molecules-header--has-breadcrumbs": isNotEmpty(breadcrumbs),
|
|
1360
|
+
"neeto-molecules-header--large": size === SIZES.large,
|
|
1361
|
+
"neeto-molecules-header--small": size === SIZES.small,
|
|
1362
|
+
"neeto-molecules-header--nano": size === SIZES.nano
|
|
1363
|
+
}, className])
|
|
1364
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1365
|
+
className: "neeto-molecules-header__left"
|
|
1366
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1367
|
+
className: "neeto-molecules-header__left-data-wrap"
|
|
1368
|
+
}, isNotEmpty(breadcrumbs) && /*#__PURE__*/React.createElement(Breadcrumbs$1, {
|
|
1369
|
+
breadcrumbs: breadcrumbs
|
|
1370
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
1371
|
+
className: "neeto-molecules-header__page-title"
|
|
1372
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
1373
|
+
"data-cy": "main-header",
|
|
1374
|
+
"data-test-id": "main-header",
|
|
1375
|
+
lineHeight: "tight",
|
|
1376
|
+
style: "h2",
|
|
1377
|
+
weight: "semibold"
|
|
1378
|
+
}, title), renderDropdown(Dropdown)))), /*#__PURE__*/React.createElement("div", {
|
|
1379
|
+
className: "neeto-ui-gap-3 neeto-molecules-header__right"
|
|
1380
|
+
}, searchProps && /*#__PURE__*/React.createElement(Search, _extends({
|
|
1381
|
+
className: classnames(["neeto-molecules-header__search-input", searchProps.className])
|
|
1382
|
+
}, searchProps)), actionBlock));
|
|
1383
|
+
};
|
|
1384
|
+
|
|
131
1385
|
function _typeof(obj) {
|
|
132
1386
|
"@babel/helpers - typeof";
|
|
133
1387
|
|
|
@@ -169,19 +1423,210 @@ function _defineProperty(obj, key, value) {
|
|
|
169
1423
|
return obj;
|
|
170
1424
|
}
|
|
171
1425
|
|
|
172
|
-
function
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
1426
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
1427
|
+
if (source == null) return {};
|
|
1428
|
+
var target = {};
|
|
1429
|
+
var sourceKeys = Object.keys(source);
|
|
1430
|
+
var key, i;
|
|
1431
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
1432
|
+
key = sourceKeys[i];
|
|
1433
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
1434
|
+
target[key] = source[key];
|
|
1435
|
+
}
|
|
1436
|
+
return target;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
function _objectWithoutProperties(source, excluded) {
|
|
1440
|
+
if (source == null) return {};
|
|
1441
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
1442
|
+
var key, i;
|
|
1443
|
+
if (Object.getOwnPropertySymbols) {
|
|
1444
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
1445
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
1446
|
+
key = sourceSymbolKeys[i];
|
|
1447
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
1448
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
1449
|
+
target[key] = source[key];
|
|
181
1450
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
1451
|
+
}
|
|
1452
|
+
return target;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
var _excluded$4 = ["buttonProps"];
|
|
1456
|
+
function ownKeys$3(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; }
|
|
1457
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1458
|
+
var Columns = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
1459
|
+
var _ref$buttonProps = _ref.buttonProps,
|
|
1460
|
+
buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
|
|
1461
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
1462
|
+
var _useTranslation = useTranslation(),
|
|
1463
|
+
t = _useTranslation.t;
|
|
1464
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1465
|
+
className: "neeto-molecules-subheader__columns"
|
|
1466
|
+
}, /*#__PURE__*/React.createElement(ManageColumns, _extends({
|
|
1467
|
+
buttonProps: _objectSpread$3({
|
|
1468
|
+
icon: Column,
|
|
1469
|
+
label: null,
|
|
1470
|
+
tooltipProps: {
|
|
1471
|
+
content: t("neetoMolecules.columns.columns"),
|
|
1472
|
+
position: "bottom"
|
|
1473
|
+
},
|
|
1474
|
+
"data-testid": "columns-button",
|
|
1475
|
+
"data-cy": "columns-dropdown-button"
|
|
1476
|
+
}, buttonProps)
|
|
1477
|
+
}, _objectSpread$3(_objectSpread$3({}, props), {}, {
|
|
1478
|
+
ref: ref
|
|
1479
|
+
}))));
|
|
1480
|
+
});
|
|
1481
|
+
Columns.displayName = "Columns";
|
|
1482
|
+
|
|
1483
|
+
var DownloadButton = function DownloadButton(_ref) {
|
|
1484
|
+
var count = _ref.count,
|
|
1485
|
+
onClick = _ref.onClick,
|
|
1486
|
+
_ref$dataCy = _ref["data-cy"],
|
|
1487
|
+
dataCy = _ref$dataCy === void 0 ? "download-button" : _ref$dataCy;
|
|
1488
|
+
var _useTranslation = useTranslation(),
|
|
1489
|
+
t = _useTranslation.t;
|
|
1490
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1491
|
+
className: "neeto-molecules-subheader__download"
|
|
1492
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
1493
|
+
"data-cy": dataCy,
|
|
1494
|
+
"data-testid": "download-button",
|
|
1495
|
+
icon: Download,
|
|
1496
|
+
style: "text",
|
|
1497
|
+
tooltipProps: {
|
|
1498
|
+
content: t("neetoMolecules.common.download"),
|
|
1499
|
+
position: "bottom"
|
|
1500
|
+
},
|
|
1501
|
+
onClick: onClick
|
|
1502
|
+
}), count && /*#__PURE__*/React.createElement("span", {
|
|
1503
|
+
className: "neeto-molecules-subheader__download-count"
|
|
1504
|
+
}, count));
|
|
1505
|
+
};
|
|
1506
|
+
|
|
1507
|
+
var _excluded$3 = ["buttonProps"];
|
|
1508
|
+
function ownKeys$2(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; }
|
|
1509
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1510
|
+
var FilterButton = function FilterButton(_ref) {
|
|
1511
|
+
var buttonProps = _ref.buttonProps,
|
|
1512
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
1513
|
+
var _useTranslation = useTranslation(),
|
|
1514
|
+
t = _useTranslation.t;
|
|
1515
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1516
|
+
className: "neeto-molecules-subheader__filter"
|
|
1517
|
+
}, /*#__PURE__*/React.createElement(Filters, _extends({
|
|
1518
|
+
buttonProps: _objectSpread$2({
|
|
1519
|
+
"data-testid": "filter-button",
|
|
1520
|
+
icon: Filter,
|
|
1521
|
+
style: "text",
|
|
1522
|
+
tooltipProps: {
|
|
1523
|
+
content: t("neetoMolecules.common.filter"),
|
|
1524
|
+
position: "bottom"
|
|
1525
|
+
},
|
|
1526
|
+
label: null
|
|
1527
|
+
}, buttonProps)
|
|
1528
|
+
}, props)));
|
|
1529
|
+
};
|
|
1530
|
+
|
|
1531
|
+
var RightBlock = function RightBlock(_ref) {
|
|
1532
|
+
var downloadButtonProps = _ref.downloadButtonProps,
|
|
1533
|
+
columnsButtonProps = _ref.columnsButtonProps,
|
|
1534
|
+
filterProps = _ref.filterProps,
|
|
1535
|
+
dataProps = _ref.dataProps;
|
|
1536
|
+
var showIcons = isNotPresent(dataProps === null || dataProps === void 0 ? void 0 : dataProps.totalCount) ? true : (dataProps === null || dataProps === void 0 ? void 0 : dataProps.totalCount) > 0;
|
|
1537
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1538
|
+
"data-testid": "subheader-rightblock-buttons-container",
|
|
1539
|
+
className: classnames("neeto-molecules-subheader__right-actions", {
|
|
1540
|
+
hidden: not(showIcons)
|
|
1541
|
+
})
|
|
1542
|
+
}, downloadButtonProps && /*#__PURE__*/React.createElement(DownloadButton, downloadButtonProps), columnsButtonProps && /*#__PURE__*/React.createElement(Columns, columnsButtonProps), filterProps && /*#__PURE__*/React.createElement(FilterButton, filterProps));
|
|
1543
|
+
};
|
|
1544
|
+
|
|
1545
|
+
var css = ":root{--neeto-molecules-sub-header-height:37px;--neeto-molecules-sub-header-bottom-margin:20px}.neeto-molecules-subheader{align-items:center;background-color:rgb(var(--neeto-ui-white));display:flex;flex-direction:row;justify-content:space-between;margin-bottom:20px;margin-bottom:var(--neeto-molecules-sub-header-bottom-margin);min-height:37px;min-height:var(--neeto-molecules-sub-header-height);width:100%}.neeto-molecules-subheader .neeto-molecules-subheader__left-wrapper{display:flex;flex-grow:1}.neeto-molecules-subheader .neeto-molecules-subheader__left-wrapper .neeto-molecules-subheader__left{align-items:center;display:flex;flex-direction:row;justify-content:flex-start}.neeto-molecules-subheader .neeto-molecules-subheader__left-wrapper .neeto-molecules-subheader__left .neeto-molecules-input__prefix{color:rgb(var(--neeto-ui-gray-400))}.neeto-molecules-subheader .neeto-molecules-subheader__right{align-items:center;display:flex;flex-direction:row;gap:12px;justify-content:flex-end}.neeto-molecules-subheader .neeto-molecules-subheader__right-actions{align-items:center;display:flex;flex-direction:row;gap:8px;justify-content:flex-end}.neeto-molecules-subheader .neeto-molecules-subheader__right-actions>:not([hidden])~:not([hidden]){border-left:thin solid rgb(var(--neeto-ui-gray-300));padding-left:8px}.neeto-molecules-subheader__download{position:relative}.neeto-molecules-subheader__download-count{align-items:center;background-color:rgb(var(--neeto-ui-primary-500));border-radius:var(--neeto-ui-rounded-full);color:rgb(var(--neeto-ui-white));display:inline-flex;font-size:10px;justify-content:center;min-height:16px;min-width:16px;position:absolute;right:-2px;text-align:center;top:-2px;z-index:1}";
|
|
1546
|
+
n(css,{});
|
|
1547
|
+
|
|
1548
|
+
var SubHeader = function SubHeader(_ref) {
|
|
1549
|
+
var _ref$className = _ref.className,
|
|
1550
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
1551
|
+
leftActionBlock = _ref.leftActionBlock,
|
|
1552
|
+
rightActionBlock = _ref.rightActionBlock,
|
|
1553
|
+
_ref$dataCy = _ref["data-cy"],
|
|
1554
|
+
dataCy = _ref$dataCy === void 0 ? "subheader" : _ref$dataCy;
|
|
1555
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1556
|
+
className: classnames(["neeto-molecules-subheader", className]),
|
|
1557
|
+
"data-cy": dataCy,
|
|
1558
|
+
"data-testid": "subheader"
|
|
1559
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1560
|
+
className: "neeto-molecules-subheader__left-wrapper",
|
|
1561
|
+
"data-cy": "subheader-left-wrapper"
|
|
1562
|
+
}, leftActionBlock && /*#__PURE__*/React.createElement("div", {
|
|
1563
|
+
className: "neeto-molecules-subheader__left",
|
|
1564
|
+
"data-cy": "subheader-left"
|
|
1565
|
+
}, leftActionBlock)), rightActionBlock && /*#__PURE__*/React.createElement("div", {
|
|
1566
|
+
className: "neeto-molecules-subheader__right",
|
|
1567
|
+
"data-cy": "subheader-right"
|
|
1568
|
+
}, rightActionBlock));
|
|
1569
|
+
};
|
|
1570
|
+
SubHeader.RightBlock = RightBlock;
|
|
1571
|
+
|
|
1572
|
+
var TableWrapper = function TableWrapper(_ref) {
|
|
1573
|
+
var children = _ref.children,
|
|
1574
|
+
_ref$className = _ref.className,
|
|
1575
|
+
className = _ref$className === void 0 ? "" : _ref$className,
|
|
1576
|
+
_ref$hasPagination = _ref.hasPagination,
|
|
1577
|
+
hasPagination = _ref$hasPagination === void 0 ? false : _ref$hasPagination;
|
|
1578
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1579
|
+
"data-testid": "table-wrapper",
|
|
1580
|
+
className: classnames("flex min-h-0 w-full flex-grow flex-col pb-6", className)
|
|
1581
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1582
|
+
className: classnames("min-h-0 flex-grow", {
|
|
1583
|
+
"pb-11": hasPagination
|
|
1584
|
+
})
|
|
1585
|
+
}, children));
|
|
1586
|
+
};
|
|
1587
|
+
|
|
1588
|
+
var LABEL_REJECT_CHARS_REGEX = /[^a-zA-Z\d\s_-]+/;
|
|
1589
|
+
var VALIDATION_SCHEMA = yup.object().shape({
|
|
1590
|
+
singularLabel: yup.string().trim().required(t$1("neetoMolecules.taxonomy.editPane.validations.singularLabelRequired")),
|
|
1591
|
+
pluralLabel: yup.string().trim().required(t$1("neetoMolecules.taxonomy.editPane.validations.pluralLabelRequired"))
|
|
1592
|
+
});
|
|
1593
|
+
|
|
1594
|
+
var update = function update(_ref) {
|
|
1595
|
+
var keyName = _ref.keyName,
|
|
1596
|
+
payload = _ref.payload;
|
|
1597
|
+
return axios.patch("".concat(BASE_API_V1_URL, "/taxonomies/").concat(keyName), payload);
|
|
1598
|
+
};
|
|
1599
|
+
var bulkDestroy = function bulkDestroy(payload) {
|
|
1600
|
+
return axios["delete"]("".concat(BASE_API_V1_URL, "/taxonomies/bulk_destroy"), {
|
|
1601
|
+
data: payload
|
|
1602
|
+
});
|
|
1603
|
+
};
|
|
1604
|
+
var taxonomiesApi = {
|
|
1605
|
+
update: update,
|
|
1606
|
+
bulkDestroy: bulkDestroy
|
|
1607
|
+
};
|
|
1608
|
+
|
|
1609
|
+
var useUpdateTaxonomy = function useUpdateTaxonomy(options) {
|
|
1610
|
+
return useMutation(taxonomiesApi.update, options);
|
|
1611
|
+
};
|
|
1612
|
+
var useBulkDestroyTaxonomies = function useBulkDestroyTaxonomies(options) {
|
|
1613
|
+
return useMutation(taxonomiesApi.bulkDestroy, options);
|
|
1614
|
+
};
|
|
1615
|
+
|
|
1616
|
+
function _arrayWithoutHoles(arr) {
|
|
1617
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
function _iterableToArray(iter) {
|
|
1621
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
function _nonIterableSpread() {
|
|
1625
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
function _toConsumableArray(arr) {
|
|
1629
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
185
1630
|
}
|
|
186
1631
|
|
|
187
1632
|
var MENU_ITEM_TYPES = {
|
|
@@ -195,13 +1640,13 @@ var DEFAULT_TOOLTIP_PROPS = {
|
|
|
195
1640
|
|
|
196
1641
|
var _excluded$2 = ["label", "key"],
|
|
197
1642
|
_excluded2 = ["isVisible", "key"];
|
|
198
|
-
var MenuItem$1 = Dropdown.MenuItem,
|
|
199
|
-
Menu$1 = Dropdown.Menu;
|
|
1643
|
+
var MenuItem$1 = Dropdown$1.MenuItem,
|
|
1644
|
+
Menu$1 = Dropdown$1.Menu;
|
|
200
1645
|
var Submenu = function Submenu(_ref) {
|
|
201
1646
|
var label = _ref.label,
|
|
202
1647
|
key = _ref.key,
|
|
203
1648
|
menuItemProps = _objectWithoutProperties(_ref, _excluded$2);
|
|
204
|
-
return /*#__PURE__*/React.createElement(Dropdown, _extends({
|
|
1649
|
+
return /*#__PURE__*/React.createElement(Dropdown$1, _extends({
|
|
205
1650
|
customTarget: /*#__PURE__*/React.createElement(MenuItem$1.Button, null, label),
|
|
206
1651
|
key: key,
|
|
207
1652
|
position: "left",
|
|
@@ -221,8 +1666,8 @@ var Submenu = function Submenu(_ref) {
|
|
|
221
1666
|
var _excluded$1 = ["onClick", "label", "type", "hasSubItems"];
|
|
222
1667
|
function ownKeys$1(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; }
|
|
223
1668
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
224
|
-
var MenuItem = Dropdown.MenuItem,
|
|
225
|
-
Divider = Dropdown.Divider;
|
|
1669
|
+
var MenuItem = Dropdown$1.MenuItem,
|
|
1670
|
+
Divider = Dropdown$1.Divider;
|
|
226
1671
|
var MoreDropdownMenuItem = function MoreDropdownMenuItem(_ref) {
|
|
227
1672
|
var onClick = _ref.onClick,
|
|
228
1673
|
label = _ref.label,
|
|
@@ -247,7 +1692,7 @@ var MoreDropdownMenuItem = function MoreDropdownMenuItem(_ref) {
|
|
|
247
1692
|
var _excluded = ["isVisible", "key"];
|
|
248
1693
|
function ownKeys(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; }
|
|
249
1694
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
250
|
-
var Menu = Dropdown.Menu;
|
|
1695
|
+
var Menu = Dropdown$1.Menu;
|
|
251
1696
|
var MoreDropdown = function MoreDropdown(_ref) {
|
|
252
1697
|
var _ref$dropdownButtonPr = _ref.dropdownButtonProps,
|
|
253
1698
|
dropdownButtonProps = _ref$dropdownButtonPr === void 0 ? {} : _ref$dropdownButtonPr,
|
|
@@ -274,7 +1719,7 @@ var MoreDropdown = function MoreDropdown(_ref) {
|
|
|
274
1719
|
style: "text"
|
|
275
1720
|
}, dropdownButtonProps))));
|
|
276
1721
|
}
|
|
277
|
-
return /*#__PURE__*/React.createElement(Dropdown, _extends({
|
|
1722
|
+
return /*#__PURE__*/React.createElement(Dropdown$1, _extends({
|
|
278
1723
|
autoWidth: true,
|
|
279
1724
|
className: "flex",
|
|
280
1725
|
disabled: isDisabled,
|
|
@@ -310,43 +1755,66 @@ var formatDataForTable = function formatDataForTable(taxonomies) {
|
|
|
310
1755
|
};
|
|
311
1756
|
});
|
|
312
1757
|
};
|
|
313
|
-
var getColumnData = function getColumnData(handleEdit) {
|
|
1758
|
+
var getColumnData = function getColumnData(handleEdit, setCurrentKeys, setIsResetModalOpen) {
|
|
314
1759
|
return [{
|
|
315
|
-
title: t("neetoMolecules.taxonomy.defaultLabel"),
|
|
1760
|
+
title: t$1("neetoMolecules.taxonomy.defaultLabel"),
|
|
316
1761
|
dataIndex: "default",
|
|
317
1762
|
key: "defaultLabel",
|
|
318
1763
|
width: 400,
|
|
319
1764
|
render: function render(_, values) {
|
|
320
1765
|
var menuItems = [{
|
|
321
1766
|
key: "edit",
|
|
322
|
-
label: t("neetoMolecules.common.actions.edit"),
|
|
1767
|
+
label: t$1("neetoMolecules.common.actions.edit"),
|
|
323
1768
|
onClick: function onClick() {
|
|
324
1769
|
return handleEdit(values);
|
|
325
1770
|
}
|
|
1771
|
+
}, {
|
|
1772
|
+
key: "reset",
|
|
1773
|
+
label: t$1("neetoMolecules.common.actions.resetToDefaults"),
|
|
1774
|
+
onClick: function onClick() {
|
|
1775
|
+
setCurrentKeys([values.keyName]);
|
|
1776
|
+
setIsResetModalOpen(true);
|
|
1777
|
+
}
|
|
326
1778
|
}];
|
|
327
1779
|
return /*#__PURE__*/React.createElement("div", {
|
|
328
1780
|
className: "flex items-center justify-between gap-x-3"
|
|
329
1781
|
}, /*#__PURE__*/React.createElement(Typography, {
|
|
330
1782
|
style: "body2"
|
|
331
|
-
}, t("taxonomyDefaultLabels.".concat(values.keyName, ".singular"))), /*#__PURE__*/React.createElement(MoreDropdown, {
|
|
1783
|
+
}, t$1("taxonomyDefaultLabels.".concat(values.keyName, ".singular"))), /*#__PURE__*/React.createElement(MoreDropdown, {
|
|
332
1784
|
dropdownProps: {
|
|
333
1785
|
strategy: "fixed"
|
|
334
1786
|
},
|
|
1787
|
+
dropdownButtonProps: {
|
|
1788
|
+
"data-testid": "nui-dropdown-icon-".concat(values.keyName)
|
|
1789
|
+
},
|
|
335
1790
|
menuItems: menuItems
|
|
336
1791
|
}));
|
|
337
1792
|
}
|
|
338
1793
|
}, {
|
|
339
|
-
title: t("neetoMolecules.taxonomy.singularLabel"),
|
|
1794
|
+
title: t$1("neetoMolecules.taxonomy.singularLabel"),
|
|
340
1795
|
dataIndex: "singularLabel",
|
|
341
1796
|
key: "singularLabel",
|
|
342
1797
|
width: 300
|
|
343
1798
|
}, {
|
|
344
|
-
title: t("neetoMolecules.taxonomy.pluralLabel"),
|
|
1799
|
+
title: t$1("neetoMolecules.taxonomy.pluralLabel"),
|
|
345
1800
|
dataIndex: "pluralLabel",
|
|
346
1801
|
key: "pluralLabel",
|
|
347
1802
|
width: 300
|
|
348
1803
|
}];
|
|
349
1804
|
};
|
|
1805
|
+
var getFilteredTaxonomies = function getFilteredTaxonomies(matchString, taxonomies) {
|
|
1806
|
+
var filteredArray = toPairs(taxonomies).filter(function (_ref3) {
|
|
1807
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
1808
|
+
key = _ref4[0],
|
|
1809
|
+
value = _ref4[1];
|
|
1810
|
+
var defaultLabel = t$1("taxonomyDefaultLabels.".concat(key, ".singular"));
|
|
1811
|
+
var valuesToSearch = [defaultLabel].concat(_toConsumableArray(Object.values(value)));
|
|
1812
|
+
return valuesToSearch.some(function (str) {
|
|
1813
|
+
return str.toLowerCase().includes(matchString.toLowerCase());
|
|
1814
|
+
});
|
|
1815
|
+
});
|
|
1816
|
+
return fromPairs(filteredArray);
|
|
1817
|
+
};
|
|
350
1818
|
|
|
351
1819
|
var EditPane = function EditPane(_ref) {
|
|
352
1820
|
var initialValues = _ref.initialValues,
|
|
@@ -388,7 +1856,8 @@ var EditPane = function EditPane(_ref) {
|
|
|
388
1856
|
return /*#__PURE__*/React.createElement(Pane, {
|
|
389
1857
|
initialFocusRef: initialFocusRef,
|
|
390
1858
|
isOpen: isOpen,
|
|
391
|
-
onClose: onClose
|
|
1859
|
+
onClose: onClose,
|
|
1860
|
+
"data-testid": "taxonomy-edit-pane"
|
|
392
1861
|
}, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(Typography, {
|
|
393
1862
|
style: "h2",
|
|
394
1863
|
weight: "semibold"
|
|
@@ -406,6 +1875,7 @@ var EditPane = function EditPane(_ref) {
|
|
|
406
1875
|
required: true,
|
|
407
1876
|
className: "w-full",
|
|
408
1877
|
"data-cy": "taxonomy-singular-input-field",
|
|
1878
|
+
"data-testid": "taxonomy-singular-input-field",
|
|
409
1879
|
label: t("neetoMolecules.taxonomy.singularLabel"),
|
|
410
1880
|
name: "singularLabel",
|
|
411
1881
|
ref: initialFocusRef,
|
|
@@ -414,6 +1884,7 @@ var EditPane = function EditPane(_ref) {
|
|
|
414
1884
|
required: true,
|
|
415
1885
|
className: "w-full",
|
|
416
1886
|
"data-cy": "taxonomy-plural-input-field",
|
|
1887
|
+
"data-testid": "taxonomy-plural-input-field",
|
|
417
1888
|
label: t("neetoMolecules.taxonomy.pluralLabel"),
|
|
418
1889
|
name: "pluralLabel",
|
|
419
1890
|
rejectCharsRegex: LABEL_REJECT_CHARS_REGEX
|
|
@@ -426,6 +1897,47 @@ var EditPane = function EditPane(_ref) {
|
|
|
426
1897
|
}))));
|
|
427
1898
|
};
|
|
428
1899
|
|
|
1900
|
+
var LeftActionBlock = function LeftActionBlock(_ref) {
|
|
1901
|
+
var selectedCount = _ref.selectedCount,
|
|
1902
|
+
totalCount = _ref.totalCount,
|
|
1903
|
+
setIsResetModalOpen = _ref.setIsResetModalOpen,
|
|
1904
|
+
setCurrentKeys = _ref.setCurrentKeys,
|
|
1905
|
+
selectedRowIds = _ref.selectedRowIds;
|
|
1906
|
+
var Menu = Dropdown$1.Menu,
|
|
1907
|
+
MenuItem = Dropdown$1.MenuItem;
|
|
1908
|
+
return !!totalCount && /*#__PURE__*/React.createElement(React.Fragment, null, selectedCount > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
1909
|
+
className: "mr-4 font-semibold",
|
|
1910
|
+
component: "h4",
|
|
1911
|
+
"data-cy": "item-count"
|
|
1912
|
+
}, /*#__PURE__*/React.createElement(Trans, {
|
|
1913
|
+
i18nKey: "neetoMolecules.taxonomy.actionBlock.selectedTaxonomy",
|
|
1914
|
+
values: {
|
|
1915
|
+
count: selectedCount,
|
|
1916
|
+
totalCount: totalCount
|
|
1917
|
+
},
|
|
1918
|
+
components: {
|
|
1919
|
+
span: /*#__PURE__*/React.createElement("span", {
|
|
1920
|
+
className: "neeto-ui-text-gray-600"
|
|
1921
|
+
})
|
|
1922
|
+
}
|
|
1923
|
+
})), /*#__PURE__*/React.createElement(Dropdown$1, {
|
|
1924
|
+
buttonStyle: "secondary",
|
|
1925
|
+
label: t$1("neetoMolecules.taxonomy.actionBlock.takeAction")
|
|
1926
|
+
}, /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(MenuItem.Button, {
|
|
1927
|
+
style: "secondary",
|
|
1928
|
+
onClick: function onClick() {
|
|
1929
|
+
setCurrentKeys(selectedRowIds);
|
|
1930
|
+
setIsResetModalOpen(true);
|
|
1931
|
+
}
|
|
1932
|
+
}, t$1("neetoMolecules.common.actions.resetToDefaults"))))) : /*#__PURE__*/React.createElement(Typography, {
|
|
1933
|
+
className: "mr-4 font-semibold",
|
|
1934
|
+
component: "h4",
|
|
1935
|
+
"data-cy": "item-count"
|
|
1936
|
+
}, t$1("neetoMolecules.taxonomy.actionBlock.taxonomyWithCount", {
|
|
1937
|
+
count: totalCount
|
|
1938
|
+
})));
|
|
1939
|
+
};
|
|
1940
|
+
|
|
429
1941
|
var Taxonomy = function Taxonomy(_ref) {
|
|
430
1942
|
var breadcrumbs = _ref.breadcrumbs;
|
|
431
1943
|
var _useState = useState(false),
|
|
@@ -440,13 +1952,32 @@ var Taxonomy = function Taxonomy(_ref) {
|
|
|
440
1952
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
441
1953
|
initialValues = _useState6[0],
|
|
442
1954
|
setInitialValues = _useState6[1];
|
|
1955
|
+
var _useState7 = useState([]),
|
|
1956
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
1957
|
+
selectedRowIds = _useState8[0],
|
|
1958
|
+
setSelectedRowIds = _useState8[1];
|
|
1959
|
+
var _useState9 = useState(""),
|
|
1960
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
1961
|
+
searchString = _useState10[0],
|
|
1962
|
+
setSearchString = _useState10[1];
|
|
1963
|
+
var _useState11 = useState([]),
|
|
1964
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
1965
|
+
currentKeys = _useState12[0],
|
|
1966
|
+
setCurrentKeys = _useState12[1];
|
|
443
1967
|
var _useBulkDestroyTaxono = useBulkDestroyTaxonomies(),
|
|
444
1968
|
bulkDestroyTaxonomies = _useBulkDestroyTaxono.mutate;
|
|
445
1969
|
var hostTaxonomyKeys = keys(globalProps.taxonomies);
|
|
446
1970
|
var hostTaxonomies = pick(hostTaxonomyKeys, taxonomies);
|
|
1971
|
+
var _useState13 = useState(hostTaxonomies),
|
|
1972
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
1973
|
+
filteredTaxonomies = _useState14[0],
|
|
1974
|
+
setFilteredTaxonomies = _useState14[1];
|
|
1975
|
+
var handleRowSelect = function handleRowSelect(ids) {
|
|
1976
|
+
return setSelectedRowIds(ids);
|
|
1977
|
+
};
|
|
447
1978
|
var handleDelete = function handleDelete() {
|
|
448
1979
|
var payload = {
|
|
449
|
-
keyNames:
|
|
1980
|
+
keyNames: currentKeys
|
|
450
1981
|
};
|
|
451
1982
|
var options = {
|
|
452
1983
|
onSuccess: function onSuccess() {
|
|
@@ -462,28 +1993,40 @@ var Taxonomy = function Taxonomy(_ref) {
|
|
|
462
1993
|
setInitialValues(values);
|
|
463
1994
|
setIsEditTaxonomyPaneOpen(true);
|
|
464
1995
|
};
|
|
1996
|
+
var handleSearch = function handleSearch(event) {
|
|
1997
|
+
setSearchString(event.target.value);
|
|
1998
|
+
var newTaxonomies = getFilteredTaxonomies(event.target.value, hostTaxonomies);
|
|
1999
|
+
setFilteredTaxonomies(newTaxonomies);
|
|
2000
|
+
};
|
|
465
2001
|
return /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Header, {
|
|
466
2002
|
breadcrumbs: breadcrumbs,
|
|
467
|
-
title: t("neetoMolecules.taxonomy.title"),
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
2003
|
+
title: t$1("neetoMolecules.taxonomy.title"),
|
|
2004
|
+
searchProps: {
|
|
2005
|
+
onChange: handleSearch,
|
|
2006
|
+
value: searchString,
|
|
2007
|
+
placeholder: t$1("neetoMolecules.taxonomy.searchTaxonomy")
|
|
2008
|
+
}
|
|
2009
|
+
}), /*#__PURE__*/React.createElement(SubHeader, {
|
|
2010
|
+
leftActionBlock: /*#__PURE__*/React.createElement(LeftActionBlock, {
|
|
2011
|
+
selectedRowIds: selectedRowIds,
|
|
2012
|
+
setCurrentKeys: setCurrentKeys,
|
|
2013
|
+
setIsResetModalOpen: setIsResetModalOpen,
|
|
2014
|
+
selectedCount: selectedRowIds.length,
|
|
2015
|
+
totalCount: Object.entries(filteredTaxonomies).length
|
|
475
2016
|
})
|
|
476
|
-
}), /*#__PURE__*/React.createElement(TableWrapper, null, /*#__PURE__*/React.createElement(Table, {
|
|
2017
|
+
}), isNotEmpty(filteredTaxonomies) ? /*#__PURE__*/React.createElement(TableWrapper, null, /*#__PURE__*/React.createElement(Table, {
|
|
477
2018
|
fixedHeight: true,
|
|
2019
|
+
rowSelection: true,
|
|
478
2020
|
allowRowClick: false,
|
|
479
|
-
|
|
480
|
-
rowData: formatDataForTable(hostTaxonomies),
|
|
2021
|
+
rowData: formatDataForTable(filteredTaxonomies),
|
|
481
2022
|
rowKey: prop("keyName"),
|
|
482
|
-
rowSelection: false,
|
|
483
2023
|
scroll: {
|
|
484
2024
|
x: 0
|
|
485
2025
|
},
|
|
486
|
-
|
|
2026
|
+
selectedRowKeys: selectedRowIds,
|
|
2027
|
+
tableLayout: "fixed",
|
|
2028
|
+
columnData: getColumnData(handleEdit, setCurrentKeys, setIsResetModalOpen),
|
|
2029
|
+
onRowSelect: handleRowSelect
|
|
487
2030
|
}), /*#__PURE__*/React.createElement(EditPane, {
|
|
488
2031
|
initialValues: initialValues,
|
|
489
2032
|
isOpen: isEditTaxonomyPaneOpen,
|
|
@@ -492,16 +2035,26 @@ var Taxonomy = function Taxonomy(_ref) {
|
|
|
492
2035
|
}
|
|
493
2036
|
}), /*#__PURE__*/React.createElement(Alert, {
|
|
494
2037
|
isOpen: isResetModalOpen,
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
2038
|
+
submitButtonLabel: t$1("neetoMolecules.common.actions.proceed"),
|
|
2039
|
+
title: t$1("neetoMolecules.taxonomy.resetAlert.title"),
|
|
2040
|
+
message: /*#__PURE__*/React.createElement(Trans, {
|
|
2041
|
+
i18nKey: "neetoMolecules.taxonomy.resetAlert.message",
|
|
2042
|
+
values: {
|
|
2043
|
+
count: currentKeys.length,
|
|
2044
|
+
what: t$1("taxonomyDefaultLabels.".concat(currentKeys[0], ".singular"))
|
|
2045
|
+
}
|
|
2046
|
+
}),
|
|
498
2047
|
onClose: function onClose() {
|
|
499
2048
|
return setIsResetModalOpen(false);
|
|
500
2049
|
},
|
|
501
2050
|
onSubmit: handleDelete
|
|
2051
|
+
})) : /*#__PURE__*/React.createElement("div", {
|
|
2052
|
+
className: "flex h-full w-full items-center justify-center"
|
|
2053
|
+
}, /*#__PURE__*/React.createElement(NoData, {
|
|
2054
|
+
title: t$1("neetoMolecules.taxonomy.noData")
|
|
502
2055
|
})));
|
|
503
2056
|
};
|
|
504
|
-
var index = withTitle(Taxonomy, t("neetoMolecules.taxonomy.browserTitle"));
|
|
2057
|
+
var index = withTitle(Taxonomy, t$1("neetoMolecules.taxonomy.browserTitle"));
|
|
505
2058
|
|
|
506
2059
|
export { index as default };
|
|
507
2060
|
//# sourceMappingURL=Taxonomy.js.map
|