@knovator/pagecreator-admin 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +7119 -0
- package/index.css +590 -51
- package/index.js +163 -308
- package/package.json +8 -7
- package/index.d.ts +0 -5
- package/lib/api/index.d.ts +0 -10
- package/lib/api/list.d.ts +0 -48
- package/lib/components/Page/AddButton/AddButton.d.ts +0 -3
- package/lib/components/Page/AddButton/index.d.ts +0 -2
- package/lib/components/Page/Form/PageForm.d.ts +0 -4
- package/lib/components/Page/Form/index.d.ts +0 -2
- package/lib/components/Page/Page/Page.d.ts +0 -13
- package/lib/components/Page/Page/index.d.ts +0 -2
- package/lib/components/Page/PageFormActions/PageFormActions.d.ts +0 -4
- package/lib/components/Page/PageFormActions/index.d.ts +0 -2
- package/lib/components/Page/PageFormWrapper/PageFormWrapper.d.ts +0 -4
- package/lib/components/Page/PageFormWrapper/index.d.ts +0 -2
- package/lib/components/Page/Pagination/PagePagination.d.ts +0 -3
- package/lib/components/Page/Pagination/index.d.ts +0 -2
- package/lib/components/Page/Search/PageSearch.d.ts +0 -3
- package/lib/components/Page/Search/index.d.ts +0 -2
- package/lib/components/Page/Table/PageTable.d.ts +0 -3
- package/lib/components/Page/Table/index.d.ts +0 -2
- package/lib/components/Page/index.d.ts +0 -2
- package/lib/components/Widget/AddButton/AddButton.d.ts +0 -3
- package/lib/components/Widget/AddButton/index.d.ts +0 -2
- package/lib/components/Widget/Form/ItemsAccordian.d.ts +0 -4
- package/lib/components/Widget/Form/WidgetForm.d.ts +0 -4
- package/lib/components/Widget/Form/index.d.ts +0 -2
- package/lib/components/Widget/Pagination/WidgetPagination.d.ts +0 -3
- package/lib/components/Widget/Pagination/index.d.ts +0 -2
- package/lib/components/Widget/Search/WidgetSearch.d.ts +0 -3
- package/lib/components/Widget/Search/index.d.ts +0 -2
- package/lib/components/Widget/Table/WidgetTable.d.ts +0 -3
- package/lib/components/Widget/Table/index.d.ts +0 -2
- package/lib/components/Widget/Widget/Widget.d.ts +0 -13
- package/lib/components/Widget/Widget/index.d.ts +0 -2
- package/lib/components/Widget/WidgetFormActions/WidgetFormActions.d.ts +0 -4
- package/lib/components/Widget/WidgetFormActions/index.d.ts +0 -2
- package/lib/components/Widget/WidgetFormWrapper/WidgetFormWrapper.d.ts +0 -4
- package/lib/components/Widget/WidgetFormWrapper/index.d.ts +0 -2
- package/lib/components/Widget/index.d.ts +0 -2
- package/lib/components/common/Accordian/Accordian.d.ts +0 -13
- package/lib/components/common/Accordian/index.d.ts +0 -2
- package/lib/components/common/Button/Button.d.ts +0 -4
- package/lib/components/common/Button/index.d.ts +0 -2
- package/lib/components/common/DNDItemsList/DNDItemsList.d.ts +0 -4
- package/lib/components/common/DNDItemsList/index.d.ts +0 -2
- package/lib/components/common/DeleteModal/DeleteModal.d.ts +0 -4
- package/lib/components/common/DeleteModal/index.d.ts +0 -2
- package/lib/components/common/Drawer/Drawer.d.ts +0 -9
- package/lib/components/common/Drawer/index.d.ts +0 -2
- package/lib/components/common/Form/Form.d.ts +0 -15
- package/lib/components/common/Form/SimpleForm.d.ts +0 -17
- package/lib/components/common/Form/index.d.ts +0 -4
- package/lib/components/common/FormActions/FormActions.d.ts +0 -10
- package/lib/components/common/FormActions/index.d.ts +0 -2
- package/lib/components/common/ImageUpload/ImageUpload.d.ts +0 -4
- package/lib/components/common/ImageUpload/index.d.ts +0 -2
- package/lib/components/common/Input/Checkbox.d.ts +0 -4
- package/lib/components/common/Input/Input.d.ts +0 -4
- package/lib/components/common/Input/ReactSelect.d.ts +0 -4
- package/lib/components/common/Input/Select.d.ts +0 -4
- package/lib/components/common/Input/SrcSet.d.ts +0 -4
- package/lib/components/common/Input/index.d.ts +0 -12
- package/lib/components/common/Modal/Modal.d.ts +0 -8
- package/lib/components/common/Modal/index.d.ts +0 -2
- package/lib/components/common/Pagination/Pagination.d.ts +0 -4
- package/lib/components/common/Pagination/index.d.ts +0 -2
- package/lib/components/common/Table/Table.d.ts +0 -4
- package/lib/components/common/Table/index.d.ts +0 -2
- package/lib/components/common/Toggle/Toggle.d.ts +0 -4
- package/lib/components/common/Toggle/index.d.ts +0 -2
- package/lib/constants/common.d.ts +0 -105
- package/lib/context/PageContext.d.ts +0 -7
- package/lib/context/ProviderContext.d.ts +0 -5
- package/lib/context/WidgetContext.d.ts +0 -7
- package/lib/helper/utils.d.ts +0 -11
- package/lib/hooks/usePage.d.ts +0 -39
- package/lib/hooks/usePagination.d.ts +0 -27
- package/lib/hooks/useWidget.d.ts +0 -49
- package/lib/icons/chevronDown.d.ts +0 -4
- package/lib/icons/chevronLeft.d.ts +0 -4
- package/lib/icons/chevronRight.d.ts +0 -4
- package/lib/icons/chevronUp.d.ts +0 -4
- package/lib/icons/close.d.ts +0 -4
- package/lib/icons/pencil.d.ts +0 -4
- package/lib/icons/plus.d.ts +0 -4
- package/lib/icons/trash.d.ts +0 -4
- package/lib/types/api.d.ts +0 -34
- package/lib/types/common.d.ts +0 -25
- package/lib/types/components.d.ts +0 -255
- package/lib/types/context.d.ts +0 -96
- package/lib/types/index.d.ts +0 -4
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var check = function (it) {
|
|
|
15
15
|
|
|
16
16
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
17
17
|
var global$n =
|
|
18
|
-
// eslint-disable-next-line es
|
|
18
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
|
19
19
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
20
20
|
check(typeof window == 'object' && window) ||
|
|
21
21
|
// eslint-disable-next-line no-restricted-globals -- safe
|
|
@@ -38,14 +38,14 @@ var fails$m = fails$n;
|
|
|
38
38
|
|
|
39
39
|
// Detect IE8's incomplete defineProperty implementation
|
|
40
40
|
var descriptors = !fails$m(function () {
|
|
41
|
-
// eslint-disable-next-line es
|
|
41
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
42
42
|
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
var fails$l = fails$n;
|
|
46
46
|
|
|
47
47
|
var functionBindNative = !fails$l(function () {
|
|
48
|
-
// eslint-disable-next-line es
|
|
48
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
49
49
|
var test = (function () { /* empty */ }).bind();
|
|
50
50
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
51
51
|
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
@@ -62,7 +62,7 @@ var functionCall = NATIVE_BIND$3 ? call$j.bind(call$j) : function () {
|
|
|
62
62
|
var objectPropertyIsEnumerable = {};
|
|
63
63
|
|
|
64
64
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
65
|
-
// eslint-disable-next-line es
|
|
65
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
66
66
|
var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
|
|
67
67
|
|
|
68
68
|
// Nashorn ~ JDK8 bug
|
|
@@ -87,14 +87,11 @@ var createPropertyDescriptor$3 = function (bitmap, value) {
|
|
|
87
87
|
var NATIVE_BIND$2 = functionBindNative;
|
|
88
88
|
|
|
89
89
|
var FunctionPrototype$2 = Function.prototype;
|
|
90
|
-
var bind$5 = FunctionPrototype$2.bind;
|
|
91
90
|
var call$i = FunctionPrototype$2.call;
|
|
92
|
-
var
|
|
91
|
+
var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$i, call$i);
|
|
93
92
|
|
|
94
|
-
var functionUncurryThis = NATIVE_BIND$2 ? function (fn) {
|
|
95
|
-
return
|
|
96
|
-
} : function (fn) {
|
|
97
|
-
return fn && function () {
|
|
93
|
+
var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
|
|
94
|
+
return function () {
|
|
98
95
|
return call$i.apply(fn, arguments);
|
|
99
96
|
};
|
|
100
97
|
};
|
|
@@ -104,13 +101,13 @@ var uncurryThis$k = functionUncurryThis;
|
|
|
104
101
|
var toString$8 = uncurryThis$k({}.toString);
|
|
105
102
|
var stringSlice$4 = uncurryThis$k(''.slice);
|
|
106
103
|
|
|
107
|
-
var classofRaw$
|
|
104
|
+
var classofRaw$2 = function (it) {
|
|
108
105
|
return stringSlice$4(toString$8(it), 8, -1);
|
|
109
106
|
};
|
|
110
107
|
|
|
111
108
|
var uncurryThis$j = functionUncurryThis;
|
|
112
109
|
var fails$k = fails$n;
|
|
113
|
-
var classof$6 = classofRaw$
|
|
110
|
+
var classof$6 = classofRaw$2;
|
|
114
111
|
|
|
115
112
|
var $Object$4 = Object;
|
|
116
113
|
var split = uncurryThis$j(''.split);
|
|
@@ -149,20 +146,34 @@ var toIndexedObject$5 = function (it) {
|
|
|
149
146
|
return IndexedObject$2(requireObjectCoercible$5(it));
|
|
150
147
|
};
|
|
151
148
|
|
|
149
|
+
var documentAll$2 = typeof document == 'object' && document.all;
|
|
150
|
+
|
|
151
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
152
|
+
var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
|
|
153
|
+
|
|
154
|
+
var documentAll_1 = {
|
|
155
|
+
all: documentAll$2,
|
|
156
|
+
IS_HTMLDDA: IS_HTMLDDA
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var $documentAll$1 = documentAll_1;
|
|
160
|
+
|
|
161
|
+
var documentAll$1 = $documentAll$1.all;
|
|
162
|
+
|
|
152
163
|
// `IsCallable` abstract operation
|
|
153
164
|
// https://tc39.es/ecma262/#sec-iscallable
|
|
154
|
-
var isCallable$m = function (argument) {
|
|
165
|
+
var isCallable$m = $documentAll$1.IS_HTMLDDA ? function (argument) {
|
|
166
|
+
return typeof argument == 'function' || argument === documentAll$1;
|
|
167
|
+
} : function (argument) {
|
|
155
168
|
return typeof argument == 'function';
|
|
156
169
|
};
|
|
157
170
|
|
|
158
171
|
var isCallable$l = isCallable$m;
|
|
172
|
+
var $documentAll = documentAll_1;
|
|
159
173
|
|
|
160
|
-
var documentAll =
|
|
174
|
+
var documentAll = $documentAll.all;
|
|
161
175
|
|
|
162
|
-
|
|
163
|
-
var SPECIAL_DOCUMENT_ALL = typeof documentAll == 'undefined' && documentAll !== undefined;
|
|
164
|
-
|
|
165
|
-
var isObject$9 = SPECIAL_DOCUMENT_ALL ? function (it) {
|
|
176
|
+
var isObject$9 = $documentAll.IS_HTMLDDA ? function (it) {
|
|
166
177
|
return typeof it == 'object' ? it !== null : isCallable$l(it) || it === documentAll;
|
|
167
178
|
} : function (it) {
|
|
168
179
|
return typeof it == 'object' ? it !== null : isCallable$l(it);
|
|
@@ -215,12 +226,12 @@ if (!version && userAgent$3) {
|
|
|
215
226
|
|
|
216
227
|
var engineV8Version = version;
|
|
217
228
|
|
|
218
|
-
/* eslint-disable es
|
|
229
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
219
230
|
|
|
220
231
|
var V8_VERSION$1 = engineV8Version;
|
|
221
232
|
var fails$j = fails$n;
|
|
222
233
|
|
|
223
|
-
// eslint-disable-next-line es
|
|
234
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
224
235
|
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$j(function () {
|
|
225
236
|
var symbol = Symbol();
|
|
226
237
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
@@ -230,7 +241,7 @@ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$j(func
|
|
|
230
241
|
!Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
|
|
231
242
|
});
|
|
232
243
|
|
|
233
|
-
/* eslint-disable es
|
|
244
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
234
245
|
|
|
235
246
|
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
|
|
236
247
|
|
|
@@ -303,7 +314,7 @@ var shared$4 = {exports: {}};
|
|
|
303
314
|
|
|
304
315
|
var global$k = global$n;
|
|
305
316
|
|
|
306
|
-
// eslint-disable-next-line es
|
|
317
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
307
318
|
var defineProperty$5 = Object.defineProperty;
|
|
308
319
|
|
|
309
320
|
var defineGlobalProperty$3 = function (key, value) {
|
|
@@ -327,10 +338,10 @@ var store$2 = sharedStore;
|
|
|
327
338
|
(shared$4.exports = function (key, value) {
|
|
328
339
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
329
340
|
})('versions', []).push({
|
|
330
|
-
version: '3.
|
|
341
|
+
version: '3.26.1',
|
|
331
342
|
mode: 'global',
|
|
332
343
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
333
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
344
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE',
|
|
334
345
|
source: 'https://github.com/zloirock/core-js'
|
|
335
346
|
});
|
|
336
347
|
|
|
@@ -351,7 +362,7 @@ var hasOwnProperty = uncurryThis$h({}.hasOwnProperty);
|
|
|
351
362
|
|
|
352
363
|
// `HasOwnProperty` abstract operation
|
|
353
364
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
354
|
-
// eslint-disable-next-line es
|
|
365
|
+
// eslint-disable-next-line es/no-object-hasown -- safe
|
|
355
366
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
356
367
|
return hasOwnProperty(toObject$4(it), key);
|
|
357
368
|
};
|
|
@@ -444,7 +455,7 @@ var createElement$1 = documentCreateElement$2;
|
|
|
444
455
|
|
|
445
456
|
// Thanks to IE8 for its funny defineProperty
|
|
446
457
|
var ie8DomDefine = !DESCRIPTORS$a && !fails$i(function () {
|
|
447
|
-
// eslint-disable-next-line es
|
|
458
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
448
459
|
return Object.defineProperty(createElement$1('div'), 'a', {
|
|
449
460
|
get: function () { return 7; }
|
|
450
461
|
}).a != 7;
|
|
@@ -459,7 +470,7 @@ var toPropertyKey$1 = toPropertyKey$2;
|
|
|
459
470
|
var hasOwn$9 = hasOwnProperty_1;
|
|
460
471
|
var IE8_DOM_DEFINE$1 = ie8DomDefine;
|
|
461
472
|
|
|
462
|
-
// eslint-disable-next-line es
|
|
473
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
463
474
|
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
464
475
|
|
|
465
476
|
// `Object.getOwnPropertyDescriptor` method
|
|
@@ -481,7 +492,7 @@ var fails$h = fails$n;
|
|
|
481
492
|
// V8 ~ Chrome 36-
|
|
482
493
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
483
494
|
var v8PrototypeDefineBug = DESCRIPTORS$8 && fails$h(function () {
|
|
484
|
-
// eslint-disable-next-line es
|
|
495
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
485
496
|
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
486
497
|
value: 42,
|
|
487
498
|
writable: false
|
|
@@ -506,9 +517,9 @@ var anObject$e = anObject$f;
|
|
|
506
517
|
var toPropertyKey = toPropertyKey$2;
|
|
507
518
|
|
|
508
519
|
var $TypeError$9 = TypeError;
|
|
509
|
-
// eslint-disable-next-line es
|
|
520
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
510
521
|
var $defineProperty = Object.defineProperty;
|
|
511
|
-
// eslint-disable-next-line es
|
|
522
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
512
523
|
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
513
524
|
var ENUMERABLE = 'enumerable';
|
|
514
525
|
var CONFIGURABLE$1 = 'configurable';
|
|
@@ -560,7 +571,7 @@ var DESCRIPTORS$5 = descriptors;
|
|
|
560
571
|
var hasOwn$8 = hasOwnProperty_1;
|
|
561
572
|
|
|
562
573
|
var FunctionPrototype$1 = Function.prototype;
|
|
563
|
-
// eslint-disable-next-line es
|
|
574
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
564
575
|
var getDescriptor = DESCRIPTORS$5 && Object.getOwnPropertyDescriptor;
|
|
565
576
|
|
|
566
577
|
var EXISTS = hasOwn$8(FunctionPrototype$1, 'name');
|
|
@@ -609,7 +620,6 @@ var hiddenKeys$4 = {};
|
|
|
609
620
|
|
|
610
621
|
var NATIVE_WEAK_MAP = weakMapBasicDetection;
|
|
611
622
|
var global$f = global$n;
|
|
612
|
-
var uncurryThis$e = functionUncurryThis;
|
|
613
623
|
var isObject$4 = isObject$9;
|
|
614
624
|
var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
|
|
615
625
|
var hasOwn$7 = hasOwnProperty_1;
|
|
@@ -637,20 +647,22 @@ var getterFor = function (TYPE) {
|
|
|
637
647
|
|
|
638
648
|
if (NATIVE_WEAK_MAP || shared$1.state) {
|
|
639
649
|
var store = shared$1.state || (shared$1.state = new WeakMap());
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
650
|
+
/* eslint-disable no-self-assign -- prototype methods protection */
|
|
651
|
+
store.get = store.get;
|
|
652
|
+
store.has = store.has;
|
|
653
|
+
store.set = store.set;
|
|
654
|
+
/* eslint-enable no-self-assign -- prototype methods protection */
|
|
643
655
|
set$1 = function (it, metadata) {
|
|
644
|
-
if (
|
|
656
|
+
if (store.has(it)) throw TypeError$2(OBJECT_ALREADY_INITIALIZED);
|
|
645
657
|
metadata.facade = it;
|
|
646
|
-
|
|
658
|
+
store.set(it, metadata);
|
|
647
659
|
return metadata;
|
|
648
660
|
};
|
|
649
661
|
get = function (it) {
|
|
650
|
-
return
|
|
662
|
+
return store.get(it) || {};
|
|
651
663
|
};
|
|
652
664
|
has = function (it) {
|
|
653
|
-
return
|
|
665
|
+
return store.has(it);
|
|
654
666
|
};
|
|
655
667
|
} else {
|
|
656
668
|
var STATE = sharedKey$2('state');
|
|
@@ -687,7 +699,7 @@ var InternalStateModule$2 = internalState;
|
|
|
687
699
|
|
|
688
700
|
var enforceInternalState = InternalStateModule$2.enforce;
|
|
689
701
|
var getInternalState$2 = InternalStateModule$2.get;
|
|
690
|
-
// eslint-disable-next-line es
|
|
702
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
691
703
|
var defineProperty$4 = Object.defineProperty;
|
|
692
704
|
|
|
693
705
|
var CONFIGURABLE_LENGTH = DESCRIPTORS$4 && !fails$g(function () {
|
|
@@ -762,7 +774,7 @@ var floor$1 = Math.floor;
|
|
|
762
774
|
|
|
763
775
|
// `Math.trunc` method
|
|
764
776
|
// https://tc39.es/ecma262/#sec-math.trunc
|
|
765
|
-
// eslint-disable-next-line es
|
|
777
|
+
// eslint-disable-next-line es/no-math-trunc -- safe
|
|
766
778
|
var mathTrunc = Math.trunc || function trunc(x) {
|
|
767
779
|
var n = +x;
|
|
768
780
|
return (n > 0 ? floor$1 : ceil)(n);
|
|
@@ -842,13 +854,13 @@ var arrayIncludes = {
|
|
|
842
854
|
indexOf: createMethod$3(false)
|
|
843
855
|
};
|
|
844
856
|
|
|
845
|
-
var uncurryThis$
|
|
857
|
+
var uncurryThis$e = functionUncurryThis;
|
|
846
858
|
var hasOwn$5 = hasOwnProperty_1;
|
|
847
859
|
var toIndexedObject$2 = toIndexedObject$5;
|
|
848
860
|
var indexOf$1 = arrayIncludes.indexOf;
|
|
849
861
|
var hiddenKeys$2 = hiddenKeys$4;
|
|
850
862
|
|
|
851
|
-
var push$1 = uncurryThis$
|
|
863
|
+
var push$1 = uncurryThis$e([].push);
|
|
852
864
|
|
|
853
865
|
var objectKeysInternal = function (object, names) {
|
|
854
866
|
var O = toIndexedObject$2(object);
|
|
@@ -881,23 +893,23 @@ var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
|
|
|
881
893
|
|
|
882
894
|
// `Object.getOwnPropertyNames` method
|
|
883
895
|
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
884
|
-
// eslint-disable-next-line es
|
|
896
|
+
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
885
897
|
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
886
898
|
return internalObjectKeys$1(O, hiddenKeys$1);
|
|
887
899
|
};
|
|
888
900
|
|
|
889
901
|
var objectGetOwnPropertySymbols = {};
|
|
890
902
|
|
|
891
|
-
// eslint-disable-next-line es
|
|
903
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
892
904
|
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
|
|
893
905
|
|
|
894
906
|
var getBuiltIn$5 = getBuiltIn$8;
|
|
895
|
-
var uncurryThis$
|
|
907
|
+
var uncurryThis$d = functionUncurryThis;
|
|
896
908
|
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
|
|
897
909
|
var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
|
|
898
910
|
var anObject$d = anObject$f;
|
|
899
911
|
|
|
900
|
-
var concat$2 = uncurryThis$
|
|
912
|
+
var concat$2 = uncurryThis$d([].concat);
|
|
901
913
|
|
|
902
914
|
// all object keys, includes non-enumerable and symbols
|
|
903
915
|
var ownKeys$1 = getBuiltIn$5('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
@@ -1006,13 +1018,13 @@ var enumBugKeys$1 = enumBugKeys$3;
|
|
|
1006
1018
|
|
|
1007
1019
|
// `Object.keys` method
|
|
1008
1020
|
// https://tc39.es/ecma262/#sec-object.keys
|
|
1009
|
-
// eslint-disable-next-line es
|
|
1021
|
+
// eslint-disable-next-line es/no-object-keys -- safe
|
|
1010
1022
|
var objectKeys$2 = Object.keys || function keys(O) {
|
|
1011
1023
|
return internalObjectKeys(O, enumBugKeys$1);
|
|
1012
1024
|
};
|
|
1013
1025
|
|
|
1014
1026
|
var DESCRIPTORS$3 = descriptors;
|
|
1015
|
-
var uncurryThis$
|
|
1027
|
+
var uncurryThis$c = functionUncurryThis;
|
|
1016
1028
|
var call$e = functionCall;
|
|
1017
1029
|
var fails$e = fails$n;
|
|
1018
1030
|
var objectKeys$1 = objectKeys$2;
|
|
@@ -1021,11 +1033,11 @@ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
|
|
|
1021
1033
|
var toObject$3 = toObject$5;
|
|
1022
1034
|
var IndexedObject$1 = indexedObject;
|
|
1023
1035
|
|
|
1024
|
-
// eslint-disable-next-line es
|
|
1036
|
+
// eslint-disable-next-line es/no-object-assign -- safe
|
|
1025
1037
|
var $assign = Object.assign;
|
|
1026
|
-
// eslint-disable-next-line es
|
|
1038
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
1027
1039
|
var defineProperty$3 = Object.defineProperty;
|
|
1028
|
-
var concat$1 = uncurryThis$
|
|
1040
|
+
var concat$1 = uncurryThis$c([].concat);
|
|
1029
1041
|
|
|
1030
1042
|
// `Object.assign` method
|
|
1031
1043
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
@@ -1043,7 +1055,7 @@ var objectAssign = !$assign || fails$e(function () {
|
|
|
1043
1055
|
// should work with symbols and should have deterministic property order (V8 bug)
|
|
1044
1056
|
var A = {};
|
|
1045
1057
|
var B = {};
|
|
1046
|
-
// eslint-disable-next-line es
|
|
1058
|
+
// eslint-disable-next-line es/no-symbol -- safe
|
|
1047
1059
|
var symbol = Symbol();
|
|
1048
1060
|
var alphabet = 'abcdefghijklmnopqrst';
|
|
1049
1061
|
A[symbol] = 7;
|
|
@@ -1073,7 +1085,7 @@ var assign = objectAssign;
|
|
|
1073
1085
|
|
|
1074
1086
|
// `Object.assign` method
|
|
1075
1087
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
1076
|
-
// eslint-disable-next-line es
|
|
1088
|
+
// eslint-disable-next-line es/no-object-assign -- required for testing
|
|
1077
1089
|
$$d({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
|
|
1078
1090
|
assign: assign
|
|
1079
1091
|
});
|
|
@@ -1089,7 +1101,7 @@ var objectKeys = objectKeys$2;
|
|
|
1089
1101
|
|
|
1090
1102
|
// `Object.defineProperties` method
|
|
1091
1103
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
1092
|
-
// eslint-disable-next-line es
|
|
1104
|
+
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
1093
1105
|
objectDefineProperties.f = DESCRIPTORS$2 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
1094
1106
|
anObject$c(O);
|
|
1095
1107
|
var props = toIndexedObject$1(Properties);
|
|
@@ -1177,7 +1189,7 @@ hiddenKeys[IE_PROTO$1] = true;
|
|
|
1177
1189
|
|
|
1178
1190
|
// `Object.create` method
|
|
1179
1191
|
// https://tc39.es/ecma262/#sec-object.create
|
|
1180
|
-
// eslint-disable-next-line es
|
|
1192
|
+
// eslint-disable-next-line es/no-object-create -- safe
|
|
1181
1193
|
var objectCreate = Object.create || function create(O, Properties) {
|
|
1182
1194
|
var result;
|
|
1183
1195
|
if (O !== null) {
|
|
@@ -1218,7 +1230,7 @@ var fails$d = fails$n;
|
|
|
1218
1230
|
var correctPrototypeGetter = !fails$d(function () {
|
|
1219
1231
|
function F() { /* empty */ }
|
|
1220
1232
|
F.prototype.constructor = null;
|
|
1221
|
-
// eslint-disable-next-line es
|
|
1233
|
+
// eslint-disable-next-line es/no-object-getprototypeof -- required for testing
|
|
1222
1234
|
return Object.getPrototypeOf(new F()) !== F.prototype;
|
|
1223
1235
|
});
|
|
1224
1236
|
|
|
@@ -1234,7 +1246,7 @@ var ObjectPrototype = $Object$1.prototype;
|
|
|
1234
1246
|
|
|
1235
1247
|
// `Object.getPrototypeOf` method
|
|
1236
1248
|
// https://tc39.es/ecma262/#sec-object.getprototypeof
|
|
1237
|
-
// eslint-disable-next-line es
|
|
1249
|
+
// eslint-disable-next-line es/no-object-getprototypeof -- safe
|
|
1238
1250
|
var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
|
|
1239
1251
|
var object = toObject$2(O);
|
|
1240
1252
|
if (hasOwn$3(object, IE_PROTO)) return object[IE_PROTO];
|
|
@@ -1258,7 +1270,7 @@ var BUGGY_SAFARI_ITERATORS$1 = false;
|
|
|
1258
1270
|
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
|
|
1259
1271
|
var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
|
1260
1272
|
|
|
1261
|
-
/* eslint-disable es
|
|
1273
|
+
/* eslint-disable es/no-array-prototype-keys -- safe */
|
|
1262
1274
|
if ([].keys) {
|
|
1263
1275
|
arrayIterator = [].keys();
|
|
1264
1276
|
// Safari 8 has buggy iterators w/o `next`
|
|
@@ -1331,21 +1343,21 @@ var aPossiblePrototype$1 = function (argument) {
|
|
|
1331
1343
|
|
|
1332
1344
|
/* eslint-disable no-proto -- safe */
|
|
1333
1345
|
|
|
1334
|
-
var uncurryThis$
|
|
1346
|
+
var uncurryThis$b = functionUncurryThis;
|
|
1335
1347
|
var anObject$a = anObject$f;
|
|
1336
1348
|
var aPossiblePrototype = aPossiblePrototype$1;
|
|
1337
1349
|
|
|
1338
1350
|
// `Object.setPrototypeOf` method
|
|
1339
1351
|
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
|
1340
1352
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
1341
|
-
// eslint-disable-next-line es
|
|
1353
|
+
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
|
1342
1354
|
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
1343
1355
|
var CORRECT_SETTER = false;
|
|
1344
1356
|
var test = {};
|
|
1345
1357
|
var setter;
|
|
1346
1358
|
try {
|
|
1347
|
-
// eslint-disable-next-line es
|
|
1348
|
-
setter = uncurryThis$
|
|
1359
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
1360
|
+
setter = uncurryThis$b(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
1349
1361
|
setter(test, []);
|
|
1350
1362
|
CORRECT_SETTER = test instanceof Array;
|
|
1351
1363
|
} catch (error) { /* empty */ }
|
|
@@ -1455,12 +1467,19 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
|
|
|
1455
1467
|
return methods;
|
|
1456
1468
|
};
|
|
1457
1469
|
|
|
1470
|
+
// `CreateIterResultObject` abstract operation
|
|
1471
|
+
// https://tc39.es/ecma262/#sec-createiterresultobject
|
|
1472
|
+
var createIterResultObject$1 = function (value, done) {
|
|
1473
|
+
return { value: value, done: done };
|
|
1474
|
+
};
|
|
1475
|
+
|
|
1458
1476
|
var toIndexedObject = toIndexedObject$5;
|
|
1459
1477
|
var addToUnscopables$1 = addToUnscopables$2;
|
|
1460
1478
|
var Iterators$2 = iterators;
|
|
1461
1479
|
var InternalStateModule$1 = internalState;
|
|
1462
1480
|
var defineProperty = objectDefineProperty.f;
|
|
1463
1481
|
var defineIterator = iteratorDefine;
|
|
1482
|
+
var createIterResultObject = createIterResultObject$1;
|
|
1464
1483
|
var DESCRIPTORS$1 = descriptors;
|
|
1465
1484
|
|
|
1466
1485
|
var ARRAY_ITERATOR = 'Array Iterator';
|
|
@@ -1493,11 +1512,11 @@ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind)
|
|
|
1493
1512
|
var index = state.index++;
|
|
1494
1513
|
if (!target || index >= target.length) {
|
|
1495
1514
|
state.target = undefined;
|
|
1496
|
-
return
|
|
1515
|
+
return createIterResultObject(undefined, true);
|
|
1497
1516
|
}
|
|
1498
|
-
if (kind == 'keys') return
|
|
1499
|
-
if (kind == 'values') return
|
|
1500
|
-
return
|
|
1517
|
+
if (kind == 'keys') return createIterResultObject(index, false);
|
|
1518
|
+
if (kind == 'values') return createIterResultObject(target[index], false);
|
|
1519
|
+
return createIterResultObject([index, target[index]], false);
|
|
1501
1520
|
}, 'values');
|
|
1502
1521
|
|
|
1503
1522
|
// argumentsList[@@iterator] is %ArrayProto_values%
|
|
@@ -1630,7 +1649,6 @@ const INTERNAL_ERROR_CODE = 'INTERNAL_ERROR';
|
|
|
1630
1649
|
const DEFAULT_LIMIT = 10;
|
|
1631
1650
|
const PAGE_LIMITS = [10, 20, 30];
|
|
1632
1651
|
var CALLBACK_CODES;
|
|
1633
|
-
|
|
1634
1652
|
(function (CALLBACK_CODES) {
|
|
1635
1653
|
CALLBACK_CODES["GET_ALL"] = "GET_ALL";
|
|
1636
1654
|
CALLBACK_CODES["GET_SINGLE"] = "GET_SINGLE";
|
|
@@ -1642,7 +1660,6 @@ var CALLBACK_CODES;
|
|
|
1642
1660
|
CALLBACK_CODES["IMAGE_REMOVE"] = "IMAGE_REMOVE";
|
|
1643
1661
|
CALLBACK_CODES["INTERNAL"] = "INTERNAL";
|
|
1644
1662
|
})(CALLBACK_CODES || (CALLBACK_CODES = {}));
|
|
1645
|
-
|
|
1646
1663
|
const DEFAULT_PERMISSIONS = {
|
|
1647
1664
|
list: true,
|
|
1648
1665
|
add: true,
|
|
@@ -1733,7 +1750,6 @@ const TRANSLATION_PAIRS_PAGE = {
|
|
|
1733
1750
|
|
|
1734
1751
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
1735
1752
|
const ProviderContext = /*#__PURE__*/createContext(null);
|
|
1736
|
-
|
|
1737
1753
|
const Provider = ({
|
|
1738
1754
|
children,
|
|
1739
1755
|
baseUrl,
|
|
@@ -1760,7 +1776,6 @@ const Provider = ({
|
|
|
1760
1776
|
}
|
|
1761
1777
|
}, children);
|
|
1762
1778
|
};
|
|
1763
|
-
|
|
1764
1779
|
function useProviderState() {
|
|
1765
1780
|
const context = useContext(ProviderContext);
|
|
1766
1781
|
if (!context) throw new Error('Provider Context must be used within ProviderContext.Provider');
|
|
@@ -1778,14 +1793,14 @@ var toStringTagSupport = String(test) === '[object z]';
|
|
|
1778
1793
|
|
|
1779
1794
|
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
1780
1795
|
var isCallable$7 = isCallable$m;
|
|
1781
|
-
var classofRaw = classofRaw$
|
|
1796
|
+
var classofRaw$1 = classofRaw$2;
|
|
1782
1797
|
var wellKnownSymbol$8 = wellKnownSymbol$g;
|
|
1783
1798
|
|
|
1784
1799
|
var TO_STRING_TAG = wellKnownSymbol$8('toStringTag');
|
|
1785
1800
|
var $Object = Object;
|
|
1786
1801
|
|
|
1787
1802
|
// ES3 wrong here
|
|
1788
|
-
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
|
1803
|
+
var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) == 'Arguments';
|
|
1789
1804
|
|
|
1790
1805
|
// fallback for IE11 Script Access Denied error
|
|
1791
1806
|
var tryGet = function (it, key) {
|
|
@@ -1795,15 +1810,15 @@ var tryGet = function (it, key) {
|
|
|
1795
1810
|
};
|
|
1796
1811
|
|
|
1797
1812
|
// getting tag from ES6+ `Object.prototype.toString`
|
|
1798
|
-
var classof$5 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
|
|
1813
|
+
var classof$5 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
|
|
1799
1814
|
var O, tag, result;
|
|
1800
1815
|
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
1801
1816
|
// @@toStringTag case
|
|
1802
1817
|
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
1803
1818
|
// builtinTag case
|
|
1804
|
-
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
1819
|
+
: CORRECT_ARGUMENTS ? classofRaw$1(O)
|
|
1805
1820
|
// ES3 arguments fallback
|
|
1806
|
-
: (result = classofRaw(O)) == 'Object' && isCallable$7(O.callee) ? 'Arguments' : result;
|
|
1821
|
+
: (result = classofRaw$1(O)) == 'Object' && isCallable$7(O.callee) ? 'Arguments' : result;
|
|
1807
1822
|
};
|
|
1808
1823
|
|
|
1809
1824
|
var classof$4 = classof$5;
|
|
@@ -1890,7 +1905,7 @@ var regexpUnsupportedNcg = fails$9(function () {
|
|
|
1890
1905
|
/* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
|
|
1891
1906
|
/* eslint-disable regexp/no-useless-quantifier -- testing */
|
|
1892
1907
|
var call$c = functionCall;
|
|
1893
|
-
var uncurryThis$
|
|
1908
|
+
var uncurryThis$a = functionUncurryThis;
|
|
1894
1909
|
var toString$5 = toString$6;
|
|
1895
1910
|
var regexpFlags = regexpFlags$1;
|
|
1896
1911
|
var stickyHelpers = regexpStickyHelpers;
|
|
@@ -1903,10 +1918,10 @@ var UNSUPPORTED_NCG = regexpUnsupportedNcg;
|
|
|
1903
1918
|
var nativeReplace = shared('native-string-replace', String.prototype.replace);
|
|
1904
1919
|
var nativeExec = RegExp.prototype.exec;
|
|
1905
1920
|
var patchedExec = nativeExec;
|
|
1906
|
-
var charAt$3 = uncurryThis$
|
|
1907
|
-
var indexOf = uncurryThis$
|
|
1908
|
-
var replace$2 = uncurryThis$
|
|
1909
|
-
var stringSlice$3 = uncurryThis$
|
|
1921
|
+
var charAt$3 = uncurryThis$a(''.charAt);
|
|
1922
|
+
var indexOf = uncurryThis$a(''.indexOf);
|
|
1923
|
+
var replace$2 = uncurryThis$a(''.replace);
|
|
1924
|
+
var stringSlice$3 = uncurryThis$a(''.slice);
|
|
1910
1925
|
|
|
1911
1926
|
var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
1912
1927
|
var re1 = /a/;
|
|
@@ -2019,14 +2034,24 @@ var FunctionPrototype = Function.prototype;
|
|
|
2019
2034
|
var apply$2 = FunctionPrototype.apply;
|
|
2020
2035
|
var call$b = FunctionPrototype.call;
|
|
2021
2036
|
|
|
2022
|
-
// eslint-disable-next-line es
|
|
2037
|
+
// eslint-disable-next-line es/no-reflect -- safe
|
|
2023
2038
|
var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$b.bind(apply$2) : function () {
|
|
2024
2039
|
return call$b.apply(apply$2, arguments);
|
|
2025
2040
|
});
|
|
2026
2041
|
|
|
2042
|
+
var classofRaw = classofRaw$2;
|
|
2043
|
+
var uncurryThis$9 = functionUncurryThis;
|
|
2044
|
+
|
|
2045
|
+
var functionUncurryThisClause = function (fn) {
|
|
2046
|
+
// Nashorn bug:
|
|
2047
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
2048
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
2049
|
+
if (classofRaw(fn) === 'Function') return uncurryThis$9(fn);
|
|
2050
|
+
};
|
|
2051
|
+
|
|
2027
2052
|
// TODO: Remove from `core-js@4` since it's moved to entry points
|
|
2028
2053
|
|
|
2029
|
-
var uncurryThis$8 =
|
|
2054
|
+
var uncurryThis$8 = functionUncurryThisClause;
|
|
2030
2055
|
var defineBuiltIn$3 = defineBuiltIn$7;
|
|
2031
2056
|
var regexpExec$1 = regexpExec$2;
|
|
2032
2057
|
var fails$8 = fails$n;
|
|
@@ -2191,7 +2216,7 @@ var getSubstitution$1 = function (matched, str, position, captures, namedCapture
|
|
|
2191
2216
|
var call$a = functionCall;
|
|
2192
2217
|
var anObject$8 = anObject$f;
|
|
2193
2218
|
var isCallable$6 = isCallable$m;
|
|
2194
|
-
var classof$3 = classofRaw$
|
|
2219
|
+
var classof$3 = classofRaw$2;
|
|
2195
2220
|
var regexpExec = regexpExec$2;
|
|
2196
2221
|
|
|
2197
2222
|
var $TypeError$7 = TypeError;
|
|
@@ -2440,27 +2465,22 @@ const dataGatter = data => {
|
|
|
2440
2465
|
};
|
|
2441
2466
|
const capitalizeFirstLetter = (string = '') => {
|
|
2442
2467
|
var _a;
|
|
2443
|
-
|
|
2444
2468
|
return `${(_a = string === null || string === void 0 ? void 0 : string.charAt(0)) === null || _a === void 0 ? void 0 : _a.toUpperCase()}${string === null || string === void 0 ? void 0 : string.slice(1)}`;
|
|
2445
2469
|
};
|
|
2446
2470
|
const changeToCode = (string = '') => {
|
|
2447
2471
|
var _a, _b;
|
|
2448
|
-
|
|
2449
2472
|
return (_b = (_a = string.replace(/[^\s\w]/gi, '')) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === null || _b === void 0 ? void 0 : _b.replace(/ /g, '_');
|
|
2450
2473
|
};
|
|
2451
2474
|
const isObject$2 = data => {
|
|
2452
2475
|
var _a;
|
|
2453
|
-
|
|
2454
2476
|
return ((_a = data === null || data === void 0 ? void 0 : data.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Object';
|
|
2455
2477
|
};
|
|
2456
2478
|
const isString = data => {
|
|
2457
2479
|
var _a;
|
|
2458
|
-
|
|
2459
2480
|
return ((_a = data === null || data === void 0 ? void 0 : data.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'String';
|
|
2460
2481
|
};
|
|
2461
2482
|
const isArray = data => {
|
|
2462
2483
|
var _a;
|
|
2463
|
-
|
|
2464
2484
|
return ((_a = data === null || data === void 0 ? void 0 : data.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Array';
|
|
2465
2485
|
};
|
|
2466
2486
|
const isEmpty = data => {
|
|
@@ -2514,14 +2534,14 @@ var parseInt$1 = numberParseInt;
|
|
|
2514
2534
|
|
|
2515
2535
|
// `Number.parseInt` method
|
|
2516
2536
|
// https://tc39.es/ecma262/#sec-number.parseint
|
|
2517
|
-
// eslint-disable-next-line es
|
|
2537
|
+
// eslint-disable-next-line es/no-number-parseint -- required for testing
|
|
2518
2538
|
$$8({ target: 'Number', stat: true, forced: Number.parseInt != parseInt$1 }, {
|
|
2519
2539
|
parseInt: parseInt$1
|
|
2520
2540
|
});
|
|
2521
2541
|
|
|
2522
2542
|
// `SameValue` abstract operation
|
|
2523
2543
|
// https://tc39.es/ecma262/#sec-samevalue
|
|
2524
|
-
// eslint-disable-next-line es
|
|
2544
|
+
// eslint-disable-next-line es/no-object-is -- safe
|
|
2525
2545
|
var sameValue$1 = Object.is || function is(x, y) {
|
|
2526
2546
|
// eslint-disable-next-line no-self-compare -- NaN check
|
|
2527
2547
|
return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
|
|
@@ -2575,7 +2595,6 @@ const usePagination = ({
|
|
|
2575
2595
|
};
|
|
2576
2596
|
const [filter, setFilter] = useState(defaultApiPayload);
|
|
2577
2597
|
const [currentPage, setCurrentPage] = useState(DEFAULT_CURRENT_PAGE);
|
|
2578
|
-
|
|
2579
2598
|
const setPageSize = value => {
|
|
2580
2599
|
setFilter(Object.assign(Object.assign({}, filter), {
|
|
2581
2600
|
limit: Number.parseInt(String(value), DECIMAL_REDIX),
|
|
@@ -2583,21 +2602,18 @@ const usePagination = ({
|
|
|
2583
2602
|
}));
|
|
2584
2603
|
setCurrentPage(DEFAULT_CURRENT_PAGE);
|
|
2585
2604
|
};
|
|
2586
|
-
|
|
2587
2605
|
const changeSearch = value => {
|
|
2588
2606
|
setFilter(draft => {
|
|
2589
2607
|
draft.search = value;
|
|
2590
2608
|
return draft;
|
|
2591
2609
|
});
|
|
2592
2610
|
};
|
|
2593
|
-
|
|
2594
2611
|
const changeCurrentPage = value => {
|
|
2595
2612
|
setFilter(Object.assign(Object.assign({}, filter), {
|
|
2596
2613
|
offset: Math.max(value - 1, 1) * filter.limit
|
|
2597
2614
|
}));
|
|
2598
2615
|
setCurrentPage(value);
|
|
2599
2616
|
};
|
|
2600
|
-
|
|
2601
2617
|
return {
|
|
2602
2618
|
pageSize: filter.limit,
|
|
2603
2619
|
setPageSize,
|
|
@@ -2688,7 +2704,6 @@ const apiList = {
|
|
|
2688
2704
|
const handleError = error => {
|
|
2689
2705
|
console.log(error);
|
|
2690
2706
|
};
|
|
2691
|
-
|
|
2692
2707
|
const commonApi = ({
|
|
2693
2708
|
data,
|
|
2694
2709
|
config,
|
|
@@ -2699,11 +2714,9 @@ const commonApi = ({
|
|
|
2699
2714
|
onError: _onError = handleError
|
|
2700
2715
|
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2701
2716
|
let apiToken = token;
|
|
2702
|
-
|
|
2703
2717
|
if (typeof token === 'function') {
|
|
2704
2718
|
apiToken = yield token();
|
|
2705
2719
|
}
|
|
2706
|
-
|
|
2707
2720
|
setAPIConfig({
|
|
2708
2721
|
baseUrl,
|
|
2709
2722
|
tokenPrefix: 'jwt',
|
|
@@ -2720,7 +2733,6 @@ const commonApi = ({
|
|
|
2720
2733
|
});
|
|
2721
2734
|
return response;
|
|
2722
2735
|
});
|
|
2723
|
-
|
|
2724
2736
|
const getApiType = ({
|
|
2725
2737
|
routes,
|
|
2726
2738
|
action,
|
|
@@ -2728,7 +2740,6 @@ const getApiType = ({
|
|
|
2728
2740
|
id
|
|
2729
2741
|
}) => {
|
|
2730
2742
|
let route;
|
|
2731
|
-
|
|
2732
2743
|
if (routes && typeof routes[action] === 'function') {
|
|
2733
2744
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2734
2745
|
route = routes[action]({
|
|
@@ -2741,7 +2752,6 @@ const getApiType = ({
|
|
|
2741
2752
|
id
|
|
2742
2753
|
});
|
|
2743
2754
|
}
|
|
2744
|
-
|
|
2745
2755
|
return route;
|
|
2746
2756
|
};
|
|
2747
2757
|
|
|
@@ -2781,11 +2791,9 @@ const usePage = ({
|
|
|
2781
2791
|
const {
|
|
2782
2792
|
data = {}
|
|
2783
2793
|
} = (error === null || error === void 0 ? void 0 : error.response) || {};
|
|
2784
|
-
|
|
2785
2794
|
if ((data === null || data === void 0 ? void 0 : data.code) === 'UNAUTHENTICATED') {
|
|
2786
2795
|
onLogout();
|
|
2787
2796
|
}
|
|
2788
|
-
|
|
2789
2797
|
onError(code, 'error', data === null || data === void 0 ? void 0 : data.message);
|
|
2790
2798
|
}, [onError, onLogout]);
|
|
2791
2799
|
const getWidgets = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -2807,7 +2815,6 @@ const usePage = ({
|
|
|
2807
2815
|
isActive: true
|
|
2808
2816
|
}
|
|
2809
2817
|
});
|
|
2810
|
-
|
|
2811
2818
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
2812
2819
|
let widgetsData = paginationDataGatter(response);
|
|
2813
2820
|
widgetsData = widgetsData.map(item => {
|
|
@@ -2818,7 +2825,6 @@ const usePage = ({
|
|
|
2818
2825
|
});
|
|
2819
2826
|
return setWidgets(widgetsData);
|
|
2820
2827
|
}
|
|
2821
|
-
|
|
2822
2828
|
setWidgetsLoading(false);
|
|
2823
2829
|
} catch (error) {
|
|
2824
2830
|
setWidgetsLoading(false);
|
|
@@ -2847,24 +2853,20 @@ const usePage = ({
|
|
|
2847
2853
|
}
|
|
2848
2854
|
}
|
|
2849
2855
|
});
|
|
2850
|
-
|
|
2851
2856
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
2852
2857
|
setLoading(false);
|
|
2853
2858
|
setTotalPages(response.data.totalPages);
|
|
2854
2859
|
setTotalRecords(response.data.totalDocs);
|
|
2855
2860
|
return setList(paginationDataGatter(response));
|
|
2856
2861
|
}
|
|
2857
|
-
|
|
2858
2862
|
setLoading(false);
|
|
2859
2863
|
} catch (error) {
|
|
2860
2864
|
setLoading(false);
|
|
2861
2865
|
}
|
|
2862
2866
|
}), [baseUrl, currentPage, filter.limit, filter.offset, handleError, pageRoutesPrefix, routes, token]);
|
|
2863
|
-
|
|
2864
2867
|
const onPageFormSubmit = data => __awaiter(void 0, void 0, void 0, function* () {
|
|
2865
2868
|
setLoading(true);
|
|
2866
2869
|
const code = formState === 'ADD' ? CALLBACK_CODES.CREATE : CALLBACK_CODES.UPDATE;
|
|
2867
|
-
|
|
2868
2870
|
try {
|
|
2869
2871
|
const api = getApiType({
|
|
2870
2872
|
routes,
|
|
@@ -2880,7 +2882,6 @@ const usePage = ({
|
|
|
2880
2882
|
method: api.method,
|
|
2881
2883
|
onError: handleError(code)
|
|
2882
2884
|
});
|
|
2883
|
-
|
|
2884
2885
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
2885
2886
|
setLoading(false);
|
|
2886
2887
|
onSuccess(code, response === null || response === void 0 ? void 0 : response.code, response === null || response === void 0 ? void 0 : response.message);
|
|
@@ -2895,16 +2896,13 @@ const usePage = ({
|
|
|
2895
2896
|
onError(code, INTERNAL_ERROR_CODE, error.message);
|
|
2896
2897
|
}
|
|
2897
2898
|
});
|
|
2898
|
-
|
|
2899
2899
|
const onCloseForm = () => {
|
|
2900
2900
|
setFormState(undefined);
|
|
2901
2901
|
setItemData(null);
|
|
2902
2902
|
};
|
|
2903
|
-
|
|
2904
2903
|
const onCofirmDeletePage = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
2905
2904
|
try {
|
|
2906
2905
|
let proceed = true;
|
|
2907
|
-
|
|
2908
2906
|
if (typeof preConfirmDelete === 'function') {
|
|
2909
2907
|
try {
|
|
2910
2908
|
proceed = yield preConfirmDelete({
|
|
@@ -2914,7 +2912,6 @@ const usePage = ({
|
|
|
2914
2912
|
proceed = false;
|
|
2915
2913
|
}
|
|
2916
2914
|
}
|
|
2917
|
-
|
|
2918
2915
|
if (proceed) {
|
|
2919
2916
|
setLoading(true);
|
|
2920
2917
|
const api = getApiType({
|
|
@@ -2930,7 +2927,6 @@ const usePage = ({
|
|
|
2930
2927
|
url: api.url,
|
|
2931
2928
|
onError: handleError(CALLBACK_CODES.DELETE)
|
|
2932
2929
|
});
|
|
2933
|
-
|
|
2934
2930
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
2935
2931
|
setLoading(false);
|
|
2936
2932
|
onSuccess(CALLBACK_CODES.DELETE, response === null || response === void 0 ? void 0 : response.code, response === null || response === void 0 ? void 0 : response.message);
|
|
@@ -2938,7 +2934,6 @@ const usePage = ({
|
|
|
2938
2934
|
onCloseForm();
|
|
2939
2935
|
return;
|
|
2940
2936
|
}
|
|
2941
|
-
|
|
2942
2937
|
setLoading(false);
|
|
2943
2938
|
onError(CALLBACK_CODES.DELETE, response === null || response === void 0 ? void 0 : response.code, response === null || response === void 0 ? void 0 : response.message);
|
|
2944
2939
|
onCloseForm();
|
|
@@ -2949,18 +2944,16 @@ const usePage = ({
|
|
|
2949
2944
|
onCloseForm();
|
|
2950
2945
|
}
|
|
2951
2946
|
});
|
|
2952
|
-
|
|
2953
2947
|
const onChangeFormState = (state, data) => {
|
|
2954
2948
|
setItemData(data || null);
|
|
2955
2949
|
setFormState(state);
|
|
2956
|
-
|
|
2957
2950
|
if (state === 'UPDATE' && (data === null || data === void 0 ? void 0 : data.widgets)) {
|
|
2958
|
-
setSelectedWidgets(data.widgets.map(widgetId => widgets.find(widget => widget['value'] === widgetId)));
|
|
2951
|
+
setSelectedWidgets(data.widgets.map(widgetId => widgets.find(widget => widget['value'] === widgetId)));
|
|
2952
|
+
// setSelectedWidgets(widgets.filter((widget) => data.widgets.includes(widget.value)));
|
|
2959
2953
|
} else {
|
|
2960
2954
|
setSelectedWidgets([]);
|
|
2961
2955
|
}
|
|
2962
2956
|
};
|
|
2963
|
-
|
|
2964
2957
|
const onChangeWidgetSequence = (sourceIndex, destinationIndex) => {
|
|
2965
2958
|
setSelectedWidgets(listData => {
|
|
2966
2959
|
const temporaryData = [...listData];
|
|
@@ -2969,10 +2962,10 @@ const usePage = ({
|
|
|
2969
2962
|
return temporaryData;
|
|
2970
2963
|
});
|
|
2971
2964
|
};
|
|
2972
|
-
|
|
2973
2965
|
useEffect(() => {
|
|
2974
2966
|
getPages();
|
|
2975
|
-
getWidgets();
|
|
2967
|
+
getWidgets();
|
|
2968
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2976
2969
|
}, [pageSize, currentPage]);
|
|
2977
2970
|
return {
|
|
2978
2971
|
list,
|
|
@@ -3002,7 +2995,6 @@ const usePage = ({
|
|
|
3002
2995
|
};
|
|
3003
2996
|
|
|
3004
2997
|
const PageContext = /*#__PURE__*/createContext(null);
|
|
3005
|
-
|
|
3006
2998
|
const PageContextProvider = ({
|
|
3007
2999
|
t: _t = key => Object.assign({}, TRANSLATION_PAIRS_COMMON)[key],
|
|
3008
3000
|
// Form
|
|
@@ -3070,7 +3062,6 @@ const PageContextProvider = ({
|
|
|
3070
3062
|
}
|
|
3071
3063
|
}, children);
|
|
3072
3064
|
};
|
|
3073
|
-
|
|
3074
3065
|
function usePageState() {
|
|
3075
3066
|
const context = useContext(PageContext);
|
|
3076
3067
|
if (!context) throw new Error('Page Context must be used within PageContext.Provider');
|
|
@@ -3148,7 +3139,6 @@ const Table = ({
|
|
|
3148
3139
|
key: index
|
|
3149
3140
|
}, item[dataKey.dataKey]);
|
|
3150
3141
|
};
|
|
3151
|
-
|
|
3152
3142
|
return /*#__PURE__*/React.createElement("div", {
|
|
3153
3143
|
className: `khb_table-container`,
|
|
3154
3144
|
"data-testid": "table"
|
|
@@ -3195,11 +3185,8 @@ const PageTable = () => {
|
|
|
3195
3185
|
canUpdate,
|
|
3196
3186
|
canDelete
|
|
3197
3187
|
} = usePageState();
|
|
3198
|
-
|
|
3199
3188
|
const onUpdateClick = item => onChangeFormState('UPDATE', item);
|
|
3200
|
-
|
|
3201
3189
|
const onDeleteClick = item => onChangeFormState('DELETE', item);
|
|
3202
|
-
|
|
3203
3190
|
if (Array.isArray(list) && canList) {
|
|
3204
3191
|
return /*#__PURE__*/React.createElement(Table, {
|
|
3205
3192
|
data: list,
|
|
@@ -3219,7 +3206,6 @@ const PageTable = () => {
|
|
|
3219
3206
|
}
|
|
3220
3207
|
});
|
|
3221
3208
|
}
|
|
3222
|
-
|
|
3223
3209
|
return null;
|
|
3224
3210
|
};
|
|
3225
3211
|
|
|
@@ -3413,7 +3399,6 @@ const SrcSetInput = ({
|
|
|
3413
3399
|
disabled: _disabled = false
|
|
3414
3400
|
}) => {
|
|
3415
3401
|
var _a, _b;
|
|
3416
|
-
|
|
3417
3402
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", Object.assign({
|
|
3418
3403
|
className: classNames('khb_input', `khb_input-${size}`, className),
|
|
3419
3404
|
type: 'number',
|
|
@@ -3427,7 +3412,6 @@ const SrcSetInput = ({
|
|
|
3427
3412
|
className: "khb_input-error"
|
|
3428
3413
|
}, (_b = (_a = errors[index]) === null || _a === void 0 ? void 0 : _a[inputKey]) === null || _b === void 0 ? void 0 : _b['message']));
|
|
3429
3414
|
};
|
|
3430
|
-
|
|
3431
3415
|
const SrcSet = ({
|
|
3432
3416
|
label,
|
|
3433
3417
|
size: _size = 'base',
|
|
@@ -3528,7 +3512,6 @@ const PageSearch = () => {
|
|
|
3528
3512
|
} = usePageState();
|
|
3529
3513
|
const callerRef = useRef(null);
|
|
3530
3514
|
const [search, setSearch] = useState("");
|
|
3531
|
-
|
|
3532
3515
|
const onChangeSearch = str => {
|
|
3533
3516
|
setSearch(str);
|
|
3534
3517
|
if (callerRef.current) clearTimeout(callerRef.current);
|
|
@@ -3536,7 +3519,6 @@ const PageSearch = () => {
|
|
|
3536
3519
|
getPages(str);
|
|
3537
3520
|
}, 300);
|
|
3538
3521
|
};
|
|
3539
|
-
|
|
3540
3522
|
return /*#__PURE__*/React.createElement(Input, {
|
|
3541
3523
|
type: "search",
|
|
3542
3524
|
value: search,
|
|
@@ -3637,7 +3619,7 @@ var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
|
|
|
3637
3619
|
});
|
|
3638
3620
|
};
|
|
3639
3621
|
|
|
3640
|
-
var classof$2 = classofRaw$
|
|
3622
|
+
var classof$2 = classofRaw$2;
|
|
3641
3623
|
var global$8 = global$n;
|
|
3642
3624
|
|
|
3643
3625
|
var engineIsNode = classof$2(global$8.process) == 'process';
|
|
@@ -3691,24 +3673,25 @@ const Form = /*#__PURE__*/forwardRef(({
|
|
|
3691
3673
|
control,
|
|
3692
3674
|
setError,
|
|
3693
3675
|
watch
|
|
3694
|
-
} = useForm();
|
|
3695
|
-
|
|
3676
|
+
} = useForm();
|
|
3677
|
+
// setting update data in form
|
|
3696
3678
|
useEffect(() => {
|
|
3697
3679
|
if (!isEmpty(data)) {
|
|
3698
3680
|
reset(data);
|
|
3699
3681
|
}
|
|
3700
|
-
}, [data, reset]);
|
|
3701
|
-
|
|
3682
|
+
}, [data, reset]);
|
|
3683
|
+
// setting subscriber if watcher is provided
|
|
3702
3684
|
useEffect(() => {
|
|
3703
3685
|
if (watcher) {
|
|
3704
3686
|
const subscription = watch((value, {
|
|
3705
3687
|
name,
|
|
3706
3688
|
type
|
|
3707
3689
|
}) => watcher(value, name, type));
|
|
3708
|
-
return () => subscription.unsubscribe();
|
|
3690
|
+
return () => subscription.unsubscribe();
|
|
3691
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3709
3692
|
} else return () => {};
|
|
3710
|
-
}, [watch, watcher]);
|
|
3711
|
-
|
|
3693
|
+
}, [watch, watcher]);
|
|
3694
|
+
// setting values if updates are provided
|
|
3712
3695
|
useEffect(() => {
|
|
3713
3696
|
if (updates) {
|
|
3714
3697
|
Object.keys(updates).forEach(key => {
|
|
@@ -3716,13 +3699,10 @@ const Form = /*#__PURE__*/forwardRef(({
|
|
|
3716
3699
|
});
|
|
3717
3700
|
}
|
|
3718
3701
|
}, [setValue, updates]);
|
|
3719
|
-
|
|
3720
3702
|
const inputRenderer = schema => {
|
|
3721
3703
|
var _a, _b, _c, _d, _e, _f;
|
|
3722
|
-
|
|
3723
3704
|
let input;
|
|
3724
3705
|
if (typeof schema.show !== 'undefined' && !schema.show) return null;
|
|
3725
|
-
|
|
3726
3706
|
if (schema.type) {
|
|
3727
3707
|
switch (schema.type) {
|
|
3728
3708
|
case 'ReactSelect':
|
|
@@ -3748,7 +3728,6 @@ const Form = /*#__PURE__*/forwardRef(({
|
|
|
3748
3728
|
formatOptionLabel: schema.formatOptionLabel
|
|
3749
3729
|
});
|
|
3750
3730
|
break;
|
|
3751
|
-
|
|
3752
3731
|
case 'checkbox':
|
|
3753
3732
|
input = /*#__PURE__*/React.createElement(Input.Checkbox, {
|
|
3754
3733
|
error: (_d = (_c = errors[schema.accessor]) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
@@ -3760,7 +3739,6 @@ const Form = /*#__PURE__*/forwardRef(({
|
|
|
3760
3739
|
wrapperClassName: schema.wrapperClassName
|
|
3761
3740
|
});
|
|
3762
3741
|
break;
|
|
3763
|
-
|
|
3764
3742
|
case 'select':
|
|
3765
3743
|
input = /*#__PURE__*/React.createElement(Controller, {
|
|
3766
3744
|
control: control,
|
|
@@ -3769,7 +3747,6 @@ const Form = /*#__PURE__*/forwardRef(({
|
|
|
3769
3747
|
field
|
|
3770
3748
|
}) => {
|
|
3771
3749
|
var _a, _b;
|
|
3772
|
-
|
|
3773
3750
|
return /*#__PURE__*/React.createElement(Input.Select, {
|
|
3774
3751
|
options: schema.options,
|
|
3775
3752
|
label: schema.label,
|
|
@@ -3784,7 +3761,6 @@ const Form = /*#__PURE__*/forwardRef(({
|
|
|
3784
3761
|
}
|
|
3785
3762
|
});
|
|
3786
3763
|
break;
|
|
3787
|
-
|
|
3788
3764
|
case 'srcset':
|
|
3789
3765
|
input = /*#__PURE__*/React.createElement(Input.SrcSet, {
|
|
3790
3766
|
control: control,
|
|
@@ -3795,7 +3771,6 @@ const Form = /*#__PURE__*/forwardRef(({
|
|
|
3795
3771
|
disabled: _isUpdating && typeof schema.editable !== 'undefined' && !schema.editable || !_enable
|
|
3796
3772
|
});
|
|
3797
3773
|
break;
|
|
3798
|
-
|
|
3799
3774
|
case 'text':
|
|
3800
3775
|
case 'number':
|
|
3801
3776
|
case 'url':
|
|
@@ -3826,9 +3801,8 @@ const Form = /*#__PURE__*/forwardRef(({
|
|
|
3826
3801
|
render: ({
|
|
3827
3802
|
field
|
|
3828
3803
|
}) => {
|
|
3829
|
-
var _a, _b;
|
|
3830
|
-
|
|
3831
|
-
|
|
3804
|
+
var _a, _b;
|
|
3805
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3832
3806
|
return schema.Input({
|
|
3833
3807
|
field,
|
|
3834
3808
|
error: (_b = (_a = errors[schema.accessor]) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
@@ -3841,27 +3815,22 @@ const Form = /*#__PURE__*/forwardRef(({
|
|
|
3841
3815
|
}
|
|
3842
3816
|
}));
|
|
3843
3817
|
} else throw new Error(`Please provide Input or type prop to render input Labeled ${schema.label}`);
|
|
3844
|
-
|
|
3845
3818
|
return input;
|
|
3846
3819
|
};
|
|
3847
|
-
|
|
3848
3820
|
const onFormSubmit = e => __awaiter(void 0, void 0, void 0, function* () {
|
|
3849
3821
|
e.preventDefault();
|
|
3850
3822
|
handleSubmit(data => {
|
|
3851
3823
|
const formattedData = schema.reduce((values, schemaItem) => {
|
|
3852
3824
|
// Do not add field if editing is disabled for it
|
|
3853
3825
|
if (_isUpdating && typeof schemaItem.editable !== 'undefined' && !schemaItem.editable) return values;
|
|
3854
|
-
|
|
3855
3826
|
if (schemaItem.type === 'number') {
|
|
3856
3827
|
values[schemaItem.accessor] = data[schemaItem.accessor] === '' ? null : parseInt(data[schemaItem.accessor]);
|
|
3857
3828
|
} else values[schemaItem.accessor] = data[schemaItem.accessor];
|
|
3858
|
-
|
|
3859
3829
|
return values;
|
|
3860
3830
|
}, {});
|
|
3861
3831
|
onSubmit(formattedData);
|
|
3862
3832
|
})();
|
|
3863
3833
|
});
|
|
3864
|
-
|
|
3865
3834
|
return /*#__PURE__*/React.createElement("form", {
|
|
3866
3835
|
onSubmit: onFormSubmit,
|
|
3867
3836
|
ref: ref,
|
|
@@ -3885,10 +3854,8 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
|
|
|
3885
3854
|
}, ref) => {
|
|
3886
3855
|
const inputRenderer = schema => {
|
|
3887
3856
|
var _a, _b, _c, _d, _e, _f;
|
|
3888
|
-
|
|
3889
3857
|
let input;
|
|
3890
3858
|
if (typeof schema.show !== 'undefined' && !schema.show) return null;
|
|
3891
|
-
|
|
3892
3859
|
if (schema.type) {
|
|
3893
3860
|
switch (schema.type) {
|
|
3894
3861
|
case 'ReactSelect':
|
|
@@ -3915,7 +3882,6 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
|
|
|
3915
3882
|
listCode: schema.listCode
|
|
3916
3883
|
});
|
|
3917
3884
|
break;
|
|
3918
|
-
|
|
3919
3885
|
case 'checkbox':
|
|
3920
3886
|
input = /*#__PURE__*/React.createElement(Input.Checkbox, {
|
|
3921
3887
|
error: (_d = (_c = errors[schema.accessor]) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
@@ -3927,7 +3893,6 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
|
|
|
3927
3893
|
wrapperClassName: schema.wrapperClassName
|
|
3928
3894
|
});
|
|
3929
3895
|
break;
|
|
3930
|
-
|
|
3931
3896
|
case 'select':
|
|
3932
3897
|
input = /*#__PURE__*/React.createElement(Controller, {
|
|
3933
3898
|
control: control,
|
|
@@ -3936,7 +3901,6 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
|
|
|
3936
3901
|
field
|
|
3937
3902
|
}) => {
|
|
3938
3903
|
var _a, _b;
|
|
3939
|
-
|
|
3940
3904
|
return /*#__PURE__*/React.createElement(Input.Select, {
|
|
3941
3905
|
options: schema.options,
|
|
3942
3906
|
label: schema.label,
|
|
@@ -3952,7 +3916,6 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
|
|
|
3952
3916
|
}
|
|
3953
3917
|
});
|
|
3954
3918
|
break;
|
|
3955
|
-
|
|
3956
3919
|
case 'text':
|
|
3957
3920
|
case 'number':
|
|
3958
3921
|
case 'url':
|
|
@@ -3983,9 +3946,8 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
|
|
|
3983
3946
|
render: ({
|
|
3984
3947
|
field
|
|
3985
3948
|
}) => {
|
|
3986
|
-
var _a, _b;
|
|
3987
|
-
|
|
3988
|
-
|
|
3949
|
+
var _a, _b;
|
|
3950
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
3989
3951
|
return schema.Input({
|
|
3990
3952
|
field,
|
|
3991
3953
|
error: (_b = (_a = errors[schema.accessor]) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
@@ -3998,27 +3960,22 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
|
|
|
3998
3960
|
}
|
|
3999
3961
|
}));
|
|
4000
3962
|
} else throw new Error(`Please provide Input or type prop to render input Labeled ${schema.label}`);
|
|
4001
|
-
|
|
4002
3963
|
return input;
|
|
4003
3964
|
};
|
|
4004
|
-
|
|
4005
3965
|
const onFormSubmit = e => __awaiter(void 0, void 0, void 0, function* () {
|
|
4006
3966
|
e.preventDefault();
|
|
4007
3967
|
handleSubmit(data => {
|
|
4008
3968
|
const formattedData = schema.reduce((values, schemaItem) => {
|
|
4009
3969
|
// Do not add field if editing is disabled for it
|
|
4010
3970
|
if (_isUpdating && typeof schemaItem.editable !== 'undefined' && !schemaItem.editable) return values;
|
|
4011
|
-
|
|
4012
3971
|
if (schemaItem.type === 'number') {
|
|
4013
3972
|
values[schemaItem.accessor] = data[schemaItem.accessor] === '' ? null : parseInt(data[schemaItem.accessor]);
|
|
4014
3973
|
} else values[schemaItem.accessor] = data[schemaItem.accessor];
|
|
4015
|
-
|
|
4016
3974
|
return values;
|
|
4017
3975
|
}, {});
|
|
4018
3976
|
onSubmit(formattedData);
|
|
4019
3977
|
})();
|
|
4020
3978
|
});
|
|
4021
|
-
|
|
4022
3979
|
return /*#__PURE__*/React.createElement("form", {
|
|
4023
3980
|
onSubmit: onFormSubmit,
|
|
4024
3981
|
ref: ref,
|
|
@@ -4068,28 +4025,25 @@ const PageForm = ({
|
|
|
4068
4025
|
onChangeWidgetSequence,
|
|
4069
4026
|
canAdd,
|
|
4070
4027
|
canUpdate
|
|
4071
|
-
} = usePageState();
|
|
4072
|
-
|
|
4028
|
+
} = usePageState();
|
|
4029
|
+
// Form Utility Functions
|
|
4073
4030
|
function handleCapitalize(event) {
|
|
4074
4031
|
event.target.value = capitalizeFirstLetter(event.target.value);
|
|
4075
4032
|
return event;
|
|
4076
4033
|
}
|
|
4077
|
-
|
|
4078
4034
|
function handleCode(event) {
|
|
4079
4035
|
event.target.value = changeToCode(event.target.value);
|
|
4080
4036
|
return event;
|
|
4081
|
-
}
|
|
4082
|
-
|
|
4083
|
-
|
|
4037
|
+
}
|
|
4038
|
+
// Widget Form Functions
|
|
4084
4039
|
const onDragEnd = result => {
|
|
4085
4040
|
const {
|
|
4086
4041
|
destination,
|
|
4087
4042
|
source
|
|
4088
4043
|
} = result;
|
|
4089
4044
|
if (destination) onChangeWidgetSequence(source.index, destination.index);
|
|
4090
|
-
};
|
|
4091
|
-
|
|
4092
|
-
|
|
4045
|
+
};
|
|
4046
|
+
// Schemas
|
|
4093
4047
|
const pageFormSchema = [{
|
|
4094
4048
|
label: `${t('page.name')}`,
|
|
4095
4049
|
required: true,
|
|
@@ -4191,22 +4145,18 @@ const Pagination = ({
|
|
|
4191
4145
|
ofText: _ofText = TRANSLATION_PAIRS_COMMON.of
|
|
4192
4146
|
}) => {
|
|
4193
4147
|
const [localCurrentPage, setLocalCurrentPage] = useState(currentPage);
|
|
4194
|
-
|
|
4195
4148
|
const updatePagination = () => {
|
|
4196
4149
|
let newValue = localCurrentPage;
|
|
4197
|
-
|
|
4198
4150
|
if (newValue) {
|
|
4199
4151
|
if (newValue <= 0) {
|
|
4200
4152
|
newValue = 1;
|
|
4201
4153
|
} else if (newValue > totalPages) {
|
|
4202
4154
|
newValue = totalPages;
|
|
4203
4155
|
}
|
|
4204
|
-
|
|
4205
4156
|
setCurrentPage(newValue);
|
|
4206
4157
|
setLocalCurrentPage(newValue);
|
|
4207
4158
|
}
|
|
4208
4159
|
};
|
|
4209
|
-
|
|
4210
4160
|
const onPaginationButtonClick = dir => {
|
|
4211
4161
|
if (dir === 'next') {
|
|
4212
4162
|
setCurrentPage(currentPage + 1);
|
|
@@ -4216,7 +4166,6 @@ const Pagination = ({
|
|
|
4216
4166
|
setLocalCurrentPage(localCurrentPage - 1);
|
|
4217
4167
|
}
|
|
4218
4168
|
};
|
|
4219
|
-
|
|
4220
4169
|
return /*#__PURE__*/React.createElement("nav", {
|
|
4221
4170
|
className: "khb_pagination",
|
|
4222
4171
|
"aria-label": "Table navigation"
|
|
@@ -4457,24 +4406,20 @@ const PageFormActions = ({
|
|
|
4457
4406
|
canUpdate,
|
|
4458
4407
|
t
|
|
4459
4408
|
} = usePageState();
|
|
4460
|
-
|
|
4461
4409
|
const onSubmitClick = e => {
|
|
4462
4410
|
var _a;
|
|
4463
|
-
|
|
4464
4411
|
if (!formRef) {
|
|
4465
4412
|
return onError(CALLBACK_CODES.INTERNAL, 'error', `formRef is required to submit the form!`);
|
|
4466
4413
|
} else if (!formRef.current) {
|
|
4467
4414
|
return onError(CALLBACK_CODES.INTERNAL, 'error', `formRef is empty, make sure it's passed as 'ref' prop to the form!`);
|
|
4468
|
-
}
|
|
4469
|
-
|
|
4470
|
-
|
|
4415
|
+
}
|
|
4416
|
+
// formRef is provided
|
|
4471
4417
|
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
4472
4418
|
(_a = formRef.current) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new Event('submit', {
|
|
4473
4419
|
cancelable: true,
|
|
4474
4420
|
bubbles: true
|
|
4475
4421
|
}));
|
|
4476
4422
|
};
|
|
4477
|
-
|
|
4478
4423
|
if (!canAdd && !canUpdate) return null;
|
|
4479
4424
|
return /*#__PURE__*/React.createElement(FormActions, {
|
|
4480
4425
|
loading: loading,
|
|
@@ -4573,7 +4518,6 @@ const Page = ({
|
|
|
4573
4518
|
onConfirmDelete: onCofirmDeletePage
|
|
4574
4519
|
}));
|
|
4575
4520
|
};
|
|
4576
|
-
|
|
4577
4521
|
Page.Table = PageTable;
|
|
4578
4522
|
Page.Search = PageSearch;
|
|
4579
4523
|
Page.Form = PageForm;
|
|
@@ -4624,14 +4568,12 @@ const useWidget = ({
|
|
|
4624
4568
|
const {
|
|
4625
4569
|
data = {}
|
|
4626
4570
|
} = (error === null || error === void 0 ? void 0 : error.response) || {};
|
|
4627
|
-
|
|
4628
4571
|
if ((data === null || data === void 0 ? void 0 : data.code) === 'UNAUTHENTICATED') {
|
|
4629
4572
|
onLogout();
|
|
4630
4573
|
}
|
|
4631
|
-
|
|
4632
4574
|
onError(code, 'error', data === null || data === void 0 ? void 0 : data.message);
|
|
4633
|
-
}, [onError, onLogout]);
|
|
4634
|
-
|
|
4575
|
+
}, [onError, onLogout]);
|
|
4576
|
+
// List operations
|
|
4635
4577
|
const getWidgets = useCallback(search => __awaiter(void 0, void 0, void 0, function* () {
|
|
4636
4578
|
try {
|
|
4637
4579
|
setLoading(true);
|
|
@@ -4655,14 +4597,12 @@ const useWidget = ({
|
|
|
4655
4597
|
}
|
|
4656
4598
|
}
|
|
4657
4599
|
});
|
|
4658
|
-
|
|
4659
4600
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
4660
4601
|
setLoading(false);
|
|
4661
4602
|
setTotalPages(response.data.totalPages);
|
|
4662
4603
|
setTotalRecords(response.data.totalDocs);
|
|
4663
4604
|
return setList(paginationDataGatter(response));
|
|
4664
4605
|
}
|
|
4665
|
-
|
|
4666
4606
|
setLoading(false);
|
|
4667
4607
|
} catch (error) {
|
|
4668
4608
|
setLoading(false);
|
|
@@ -4684,7 +4624,6 @@ const useWidget = ({
|
|
|
4684
4624
|
url: api.url,
|
|
4685
4625
|
onError: handleError(CALLBACK_CODES.GET_ALL)
|
|
4686
4626
|
});
|
|
4687
|
-
|
|
4688
4627
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
4689
4628
|
setItemsLoading(false);
|
|
4690
4629
|
const itemsResponse = dataGatter(response).reduce((acc, itemItem) => {
|
|
@@ -4696,13 +4635,11 @@ const useWidget = ({
|
|
|
4696
4635
|
});
|
|
4697
4636
|
return setItemsList(itemsResponse);
|
|
4698
4637
|
}
|
|
4699
|
-
|
|
4700
4638
|
setItemsLoading(false);
|
|
4701
4639
|
} catch (error) {
|
|
4702
4640
|
setItemsLoading(false);
|
|
4703
4641
|
}
|
|
4704
4642
|
}), [baseUrl, handleError, routes, itemsRoutesPrefix, token]);
|
|
4705
|
-
|
|
4706
4643
|
const onDeleteItem = id => __awaiter(void 0, void 0, void 0, function* () {
|
|
4707
4644
|
try {
|
|
4708
4645
|
setItemsLoading(true);
|
|
@@ -4719,14 +4656,12 @@ const useWidget = ({
|
|
|
4719
4656
|
url: api.url,
|
|
4720
4657
|
onError: handleError(CALLBACK_CODES.DELETE)
|
|
4721
4658
|
});
|
|
4722
|
-
|
|
4723
4659
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
4724
4660
|
setItemsLoading(false);
|
|
4725
4661
|
onSuccess(CALLBACK_CODES.DELETE, response === null || response === void 0 ? void 0 : response.code, response === null || response === void 0 ? void 0 : response.message);
|
|
4726
4662
|
if (itemData) getItems(itemData['_id']);
|
|
4727
4663
|
return;
|
|
4728
4664
|
}
|
|
4729
|
-
|
|
4730
4665
|
setItemsLoading(false);
|
|
4731
4666
|
onError(CALLBACK_CODES.DELETE, response === null || response === void 0 ? void 0 : response.code, response === null || response === void 0 ? void 0 : response.message);
|
|
4732
4667
|
} catch (error) {
|
|
@@ -4734,11 +4669,9 @@ const useWidget = ({
|
|
|
4734
4669
|
onError(CALLBACK_CODES.DELETE, INTERNAL_ERROR_CODE, error.message);
|
|
4735
4670
|
}
|
|
4736
4671
|
});
|
|
4737
|
-
|
|
4738
4672
|
const onCofirmDeleteWidget = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
4739
4673
|
try {
|
|
4740
4674
|
let proceed = true;
|
|
4741
|
-
|
|
4742
4675
|
if (typeof preConfirmDelete === 'function' && itemData) {
|
|
4743
4676
|
try {
|
|
4744
4677
|
proceed = yield preConfirmDelete({
|
|
@@ -4748,7 +4681,6 @@ const useWidget = ({
|
|
|
4748
4681
|
proceed = false;
|
|
4749
4682
|
}
|
|
4750
4683
|
}
|
|
4751
|
-
|
|
4752
4684
|
if (proceed) {
|
|
4753
4685
|
setLoading(true);
|
|
4754
4686
|
const api = getApiType({
|
|
@@ -4764,7 +4696,6 @@ const useWidget = ({
|
|
|
4764
4696
|
url: api.url,
|
|
4765
4697
|
onError: handleError(CALLBACK_CODES.DELETE)
|
|
4766
4698
|
});
|
|
4767
|
-
|
|
4768
4699
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
4769
4700
|
setLoading(false);
|
|
4770
4701
|
onSuccess(CALLBACK_CODES.DELETE, response === null || response === void 0 ? void 0 : response.code, response === null || response === void 0 ? void 0 : response.message);
|
|
@@ -4772,7 +4703,6 @@ const useWidget = ({
|
|
|
4772
4703
|
onCloseForm();
|
|
4773
4704
|
return;
|
|
4774
4705
|
}
|
|
4775
|
-
|
|
4776
4706
|
setLoading(false);
|
|
4777
4707
|
onError(CALLBACK_CODES.DELETE, response === null || response === void 0 ? void 0 : response.code, response === null || response === void 0 ? void 0 : response.message);
|
|
4778
4708
|
onCloseForm();
|
|
@@ -4783,7 +4713,6 @@ const useWidget = ({
|
|
|
4783
4713
|
onCloseForm();
|
|
4784
4714
|
}
|
|
4785
4715
|
});
|
|
4786
|
-
|
|
4787
4716
|
const onPartialUpdateWidget = (data, id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4788
4717
|
try {
|
|
4789
4718
|
const api = getApiType({
|
|
@@ -4800,7 +4729,6 @@ const useWidget = ({
|
|
|
4800
4729
|
method: api.method,
|
|
4801
4730
|
onError: handleError(CALLBACK_CODES.PARTIAL_UPDATE)
|
|
4802
4731
|
});
|
|
4803
|
-
|
|
4804
4732
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
4805
4733
|
setList(oldListData => oldListData.map(item => item['_id'] === id ? response.data : item));
|
|
4806
4734
|
} else {
|
|
@@ -4810,7 +4738,6 @@ const useWidget = ({
|
|
|
4810
4738
|
onError(CALLBACK_CODES.PARTIAL_UPDATE, INTERNAL_ERROR_CODE, error.message);
|
|
4811
4739
|
}
|
|
4812
4740
|
});
|
|
4813
|
-
|
|
4814
4741
|
const getWidgetsTypes = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
4815
4742
|
if ((itemsTypes === null || itemsTypes === void 0 ? void 0 : itemsTypes.length) > 0) return;
|
|
4816
4743
|
setLoading(true);
|
|
@@ -4826,15 +4753,12 @@ const useWidget = ({
|
|
|
4826
4753
|
url: api.url,
|
|
4827
4754
|
onError: handleError(CALLBACK_CODES.GET_ALL)
|
|
4828
4755
|
});
|
|
4829
|
-
|
|
4830
4756
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
4831
4757
|
setLoading(false);
|
|
4832
4758
|
return setItemsTypes(dataGatter(response));
|
|
4833
4759
|
}
|
|
4834
|
-
|
|
4835
4760
|
setLoading(false);
|
|
4836
4761
|
});
|
|
4837
|
-
|
|
4838
4762
|
const getWidgetTypes = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
4839
4763
|
if ((widgetTypes === null || widgetTypes === void 0 ? void 0 : widgetTypes.length) > 0) return;
|
|
4840
4764
|
setLoading(true);
|
|
@@ -4850,15 +4774,12 @@ const useWidget = ({
|
|
|
4850
4774
|
url: api.url,
|
|
4851
4775
|
onError: handleError(CALLBACK_CODES.GET_ALL)
|
|
4852
4776
|
});
|
|
4853
|
-
|
|
4854
4777
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
4855
4778
|
setLoading(false);
|
|
4856
4779
|
return setWidgetTypes(dataGatter(response));
|
|
4857
4780
|
}
|
|
4858
|
-
|
|
4859
4781
|
setLoading(false);
|
|
4860
4782
|
});
|
|
4861
|
-
|
|
4862
4783
|
const getCollectionData = (collectionName, search) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4863
4784
|
setCollectionDataLoading(true);
|
|
4864
4785
|
const api = getApiType({
|
|
@@ -4878,16 +4799,13 @@ const useWidget = ({
|
|
|
4878
4799
|
collectionName
|
|
4879
4800
|
}
|
|
4880
4801
|
});
|
|
4881
|
-
|
|
4882
4802
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
4883
4803
|
setCollectionDataLoading(false);
|
|
4884
4804
|
return setCollectionData(paginationDataGatter(response));
|
|
4885
4805
|
}
|
|
4886
|
-
|
|
4887
4806
|
setCollectionDataLoading(false);
|
|
4888
|
-
});
|
|
4889
|
-
|
|
4890
|
-
|
|
4807
|
+
});
|
|
4808
|
+
// Form operations
|
|
4891
4809
|
const onWidgetFormSubmit = data => __awaiter(void 0, void 0, void 0, function* () {
|
|
4892
4810
|
try {
|
|
4893
4811
|
setLoading(true);
|
|
@@ -4906,7 +4824,6 @@ const useWidget = ({
|
|
|
4906
4824
|
method: api.method,
|
|
4907
4825
|
onError: handleError(code)
|
|
4908
4826
|
});
|
|
4909
|
-
|
|
4910
4827
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
4911
4828
|
setLoading(false);
|
|
4912
4829
|
onSuccess(code, response === null || response === void 0 ? void 0 : response.code, response === null || response === void 0 ? void 0 : response.message);
|
|
@@ -4918,22 +4835,19 @@ const useWidget = ({
|
|
|
4918
4835
|
onError(CALLBACK_CODES.UPDATE, INTERNAL_ERROR_CODE, error.message);
|
|
4919
4836
|
}
|
|
4920
4837
|
});
|
|
4921
|
-
|
|
4922
4838
|
const onCloseForm = () => {
|
|
4923
4839
|
setFormState(undefined);
|
|
4924
4840
|
setItemData(null);
|
|
4925
4841
|
};
|
|
4926
|
-
|
|
4927
4842
|
const onChangeFormState = (state, data) => {
|
|
4928
4843
|
setItemData(data || null);
|
|
4929
|
-
setFormState(state);
|
|
4930
|
-
|
|
4844
|
+
setFormState(state);
|
|
4845
|
+
// fetch ItemsTypes & WidgetTypes if needed
|
|
4931
4846
|
if (state === 'ADD' || state === 'UPDATE') {
|
|
4932
4847
|
getWidgetsTypes();
|
|
4933
4848
|
getWidgetTypes();
|
|
4934
|
-
}
|
|
4935
|
-
|
|
4936
|
-
|
|
4849
|
+
}
|
|
4850
|
+
// get Item data if widget is updating
|
|
4937
4851
|
if (state === 'UPDATE' && data) {
|
|
4938
4852
|
if (data['itemsType'] !== 'Image' && data['collectionName']) getCollectionData(data['collectionName']);else getItems(data['_id']);
|
|
4939
4853
|
} else if (state === 'ADD') {
|
|
@@ -4944,11 +4858,9 @@ const useWidget = ({
|
|
|
4944
4858
|
});
|
|
4945
4859
|
}
|
|
4946
4860
|
};
|
|
4947
|
-
|
|
4948
4861
|
const onItemFormSubmit = (state, data, updateId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4949
4862
|
setItemsLoading(true);
|
|
4950
4863
|
const code = state === 'ADD' ? CALLBACK_CODES.CREATE : CALLBACK_CODES.UPDATE;
|
|
4951
|
-
|
|
4952
4864
|
try {
|
|
4953
4865
|
const api = getApiType({
|
|
4954
4866
|
routes,
|
|
@@ -4964,7 +4876,6 @@ const useWidget = ({
|
|
|
4964
4876
|
method: api.method,
|
|
4965
4877
|
onError: handleError(code)
|
|
4966
4878
|
});
|
|
4967
|
-
|
|
4968
4879
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
4969
4880
|
setItemsLoading(false);
|
|
4970
4881
|
onSuccess(code, response === null || response === void 0 ? void 0 : response.code, response === null || response === void 0 ? void 0 : response.message);
|
|
@@ -4977,9 +4888,8 @@ const useWidget = ({
|
|
|
4977
4888
|
setItemsLoading(false);
|
|
4978
4889
|
onError(code, INTERNAL_ERROR_CODE, error.message);
|
|
4979
4890
|
}
|
|
4980
|
-
});
|
|
4981
|
-
|
|
4982
|
-
|
|
4891
|
+
});
|
|
4892
|
+
// Image Upload operations
|
|
4983
4893
|
const onImageUpload = file => __awaiter(void 0, void 0, void 0, function* () {
|
|
4984
4894
|
try {
|
|
4985
4895
|
const payload = new FormData();
|
|
@@ -5001,7 +4911,6 @@ const useWidget = ({
|
|
|
5001
4911
|
},
|
|
5002
4912
|
onError: handleError(CALLBACK_CODES.IMAGE_UPLOAD)
|
|
5003
4913
|
});
|
|
5004
|
-
|
|
5005
4914
|
if (response.code === 'SUCCESS') {
|
|
5006
4915
|
const responseData = (response === null || response === void 0 ? void 0 : response.data[0]) || (response === null || response === void 0 ? void 0 : response.data);
|
|
5007
4916
|
return {
|
|
@@ -5014,7 +4923,6 @@ const useWidget = ({
|
|
|
5014
4923
|
onError(CALLBACK_CODES.IMAGE_REMOVE, INTERNAL_ERROR_CODE, error.message);
|
|
5015
4924
|
}
|
|
5016
4925
|
});
|
|
5017
|
-
|
|
5018
4926
|
const onImageRemove = id => __awaiter(void 0, void 0, void 0, function* () {
|
|
5019
4927
|
try {
|
|
5020
4928
|
const api = getApiType({
|
|
@@ -5030,7 +4938,6 @@ const useWidget = ({
|
|
|
5030
4938
|
url: api.url,
|
|
5031
4939
|
onError: handleError(CALLBACK_CODES.IMAGE_REMOVE)
|
|
5032
4940
|
});
|
|
5033
|
-
|
|
5034
4941
|
if ((response === null || response === void 0 ? void 0 : response.code) === 'SUCCESS') {
|
|
5035
4942
|
onSuccess(CALLBACK_CODES.IMAGE_REMOVE, response.code, response.message);
|
|
5036
4943
|
} else {
|
|
@@ -5040,9 +4947,9 @@ const useWidget = ({
|
|
|
5040
4947
|
onError(CALLBACK_CODES.IMAGE_REMOVE, INTERNAL_ERROR_CODE, error.message);
|
|
5041
4948
|
}
|
|
5042
4949
|
});
|
|
5043
|
-
|
|
5044
4950
|
useEffect(() => {
|
|
5045
|
-
getWidgets();
|
|
4951
|
+
getWidgets();
|
|
4952
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5046
4953
|
}, [pageSize, currentPage]);
|
|
5047
4954
|
return {
|
|
5048
4955
|
list,
|
|
@@ -5186,7 +5093,7 @@ var speciesConstructor$1 = function (O, defaultConstructor) {
|
|
|
5186
5093
|
return C === undefined || isNullOrUndefined$1(S = anObject$4(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
|
|
5187
5094
|
};
|
|
5188
5095
|
|
|
5189
|
-
var uncurryThis$1 =
|
|
5096
|
+
var uncurryThis$1 = functionUncurryThisClause;
|
|
5190
5097
|
var aCallable$5 = aCallable$8;
|
|
5191
5098
|
var NATIVE_BIND = functionBindNative;
|
|
5192
5099
|
|
|
@@ -5238,11 +5145,11 @@ var String$1 = global$7.String;
|
|
|
5238
5145
|
var counter = 0;
|
|
5239
5146
|
var queue$1 = {};
|
|
5240
5147
|
var ONREADYSTATECHANGE = 'onreadystatechange';
|
|
5241
|
-
var location, defer, channel, port;
|
|
5148
|
+
var $location, defer, channel, port;
|
|
5242
5149
|
|
|
5243
5150
|
try {
|
|
5244
5151
|
// Deno throws a ReferenceError on `location` access without `--location` flag
|
|
5245
|
-
location = global$7.location;
|
|
5152
|
+
$location = global$7.location;
|
|
5246
5153
|
} catch (error) { /* empty */ }
|
|
5247
5154
|
|
|
5248
5155
|
var run = function (id) {
|
|
@@ -5265,7 +5172,7 @@ var listener = function (event) {
|
|
|
5265
5172
|
|
|
5266
5173
|
var post = function (id) {
|
|
5267
5174
|
// old engines have not location.origin
|
|
5268
|
-
global$7.postMessage(String$1(id), location.protocol + '//' + location.host);
|
|
5175
|
+
global$7.postMessage(String$1(id), $location.protocol + '//' + $location.host);
|
|
5269
5176
|
};
|
|
5270
5177
|
|
|
5271
5178
|
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
|
|
@@ -5306,7 +5213,7 @@ if (!set || !clear) {
|
|
|
5306
5213
|
global$7.addEventListener &&
|
|
5307
5214
|
isCallable$3(global$7.postMessage) &&
|
|
5308
5215
|
!global$7.importScripts &&
|
|
5309
|
-
location && location.protocol !== 'file:' &&
|
|
5216
|
+
$location && $location.protocol !== 'file:' &&
|
|
5310
5217
|
!fails(post)
|
|
5311
5218
|
) {
|
|
5312
5219
|
defer = post;
|
|
@@ -5988,7 +5895,7 @@ try {
|
|
|
5988
5895
|
iteratorWithReturn[ITERATOR] = function () {
|
|
5989
5896
|
return this;
|
|
5990
5897
|
};
|
|
5991
|
-
// eslint-disable-next-line es
|
|
5898
|
+
// eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
|
|
5992
5899
|
Array.from(iteratorWithReturn, function () { throw 2; });
|
|
5993
5900
|
} catch (error) { /* empty */ }
|
|
5994
5901
|
|
|
@@ -6151,7 +6058,6 @@ $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
|
6151
6058
|
});
|
|
6152
6059
|
|
|
6153
6060
|
const WidgetContext = /*#__PURE__*/createContext(null);
|
|
6154
|
-
|
|
6155
6061
|
const WidgetContextProvider = ({
|
|
6156
6062
|
t: _t = () => '',
|
|
6157
6063
|
// Form
|
|
@@ -6247,7 +6153,6 @@ const WidgetContextProvider = ({
|
|
|
6247
6153
|
}
|
|
6248
6154
|
}, children);
|
|
6249
6155
|
};
|
|
6250
|
-
|
|
6251
6156
|
function useWidgetState() {
|
|
6252
6157
|
const context = useContext(WidgetContext);
|
|
6253
6158
|
if (!context) throw new Error('Widget Context must be used within WidgetContext.Provider');
|
|
@@ -6291,11 +6196,8 @@ const WidgetTable = () => {
|
|
|
6291
6196
|
[key]: value
|
|
6292
6197
|
}, item['_id']);
|
|
6293
6198
|
}, [onPartialUpdateWidget]);
|
|
6294
|
-
|
|
6295
6199
|
const onUpdateClick = item => onChangeFormState('UPDATE', item);
|
|
6296
|
-
|
|
6297
6200
|
const onDeleteClick = item => onChangeFormState('DELETE', item);
|
|
6298
|
-
|
|
6299
6201
|
if (!canList) return null;
|
|
6300
6202
|
return /*#__PURE__*/React.createElement(Table, {
|
|
6301
6203
|
data: list,
|
|
@@ -6353,17 +6255,13 @@ const ImageUpload = ({
|
|
|
6353
6255
|
maxSize,
|
|
6354
6256
|
onDrop: (acceptedFiles, rejectedFiles) => __awaiter(void 0, void 0, void 0, function* () {
|
|
6355
6257
|
var _a, _b, _c;
|
|
6356
|
-
|
|
6357
6258
|
try {
|
|
6358
6259
|
onError('');
|
|
6359
|
-
|
|
6360
6260
|
if ((acceptedFiles === null || acceptedFiles === void 0 ? void 0 : acceptedFiles.length) > 0) {
|
|
6361
6261
|
const regex = /\.(png|jpeg|jpg|webp|svg)$/gi;
|
|
6362
6262
|
const files = acceptedFiles.filter(file => regex.test(file.name));
|
|
6363
|
-
|
|
6364
6263
|
if (files[0]) {
|
|
6365
6264
|
const response = yield onImageUpload(files[0]);
|
|
6366
|
-
|
|
6367
6265
|
if (response) {
|
|
6368
6266
|
setImg(response.fileUrl);
|
|
6369
6267
|
setImgId(response.fileId);
|
|
@@ -6377,10 +6275,8 @@ const ImageUpload = ({
|
|
|
6377
6275
|
}
|
|
6378
6276
|
})
|
|
6379
6277
|
});
|
|
6380
|
-
|
|
6381
6278
|
const onRemoveFile = event => __awaiter(void 0, void 0, void 0, function* () {
|
|
6382
6279
|
event.preventDefault();
|
|
6383
|
-
|
|
6384
6280
|
try {
|
|
6385
6281
|
if (onImageRemove && _imgId) yield onImageRemove(typeof _imgId === 'string' ? _imgId : _imgId['_id']);
|
|
6386
6282
|
setImgId(null);
|
|
@@ -6389,13 +6285,11 @@ const ImageUpload = ({
|
|
|
6389
6285
|
onError(error.message);
|
|
6390
6286
|
}
|
|
6391
6287
|
});
|
|
6392
|
-
|
|
6393
6288
|
useEffect(() => {
|
|
6394
6289
|
if (_imgId && typeof _imgId === 'object') {
|
|
6395
6290
|
setImg(build_path(baseUrl, _imgId['uri']));
|
|
6396
6291
|
}
|
|
6397
6292
|
}, [baseUrl, _imgId]);
|
|
6398
|
-
|
|
6399
6293
|
const showImage = fileUrl => {
|
|
6400
6294
|
return /*#__PURE__*/React.createElement("div", {
|
|
6401
6295
|
className: "khb_img-wrapper"
|
|
@@ -6408,7 +6302,6 @@ const ImageUpload = ({
|
|
|
6408
6302
|
className: "khb_img-wrapper-del"
|
|
6409
6303
|
}, /*#__PURE__*/React.createElement(Close, null)));
|
|
6410
6304
|
};
|
|
6411
|
-
|
|
6412
6305
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
6413
6306
|
className: "khb_img-upload-wrapper-1"
|
|
6414
6307
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -6423,7 +6316,6 @@ const ImageUpload = ({
|
|
|
6423
6316
|
className: "khb_input-error"
|
|
6424
6317
|
}, error));
|
|
6425
6318
|
};
|
|
6426
|
-
|
|
6427
6319
|
var ImageUpload$1 = /*#__PURE__*/React.memo(ImageUpload);
|
|
6428
6320
|
|
|
6429
6321
|
const ChevronDown = ({
|
|
@@ -6521,35 +6413,28 @@ const ItemsAccordian = ({
|
|
|
6521
6413
|
setItemsShow(itemsData.map(() => false));
|
|
6522
6414
|
}
|
|
6523
6415
|
}, [itemsData]);
|
|
6524
|
-
|
|
6525
6416
|
const onItemFormSubmitClick = index => {
|
|
6526
6417
|
var _a;
|
|
6527
|
-
|
|
6528
6418
|
(_a = formRefs.current[index]) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new Event('submit', {
|
|
6529
6419
|
cancelable: true,
|
|
6530
6420
|
bubbles: true
|
|
6531
6421
|
}));
|
|
6532
6422
|
};
|
|
6533
|
-
|
|
6534
6423
|
const onItemFormSubmit = (index, formData) => {
|
|
6535
6424
|
var _a;
|
|
6536
|
-
|
|
6537
6425
|
const state = index === editingItemIndex && data[index] ? 'UPDATE' : 'ADD';
|
|
6538
6426
|
const finalData = Object.assign(Object.assign({}, formData), {
|
|
6539
6427
|
widgetId,
|
|
6540
6428
|
itemType,
|
|
6541
6429
|
sequence: index
|
|
6542
6430
|
});
|
|
6543
|
-
|
|
6544
6431
|
if (finalData['img'] && finalData['img']['_id']) {
|
|
6545
6432
|
const id = finalData['img']['_id'];
|
|
6546
6433
|
finalData['img'] = id;
|
|
6547
6434
|
}
|
|
6548
|
-
|
|
6549
6435
|
onDataSubmit(state, finalData, state === 'UPDATE' ? (_a = data[index]) === null || _a === void 0 ? void 0 : _a['_id'] : undefined);
|
|
6550
6436
|
setEditingItemIndex(undefined);
|
|
6551
6437
|
};
|
|
6552
|
-
|
|
6553
6438
|
const onItemsToggleClick = (index, status) => {
|
|
6554
6439
|
const newItemsShow = [...itemsShow];
|
|
6555
6440
|
const newStatus = typeof status === 'undefined' ? !newItemsShow[index] : status;
|
|
@@ -6557,14 +6442,12 @@ const ItemsAccordian = ({
|
|
|
6557
6442
|
newItemsShow[index] = newStatus;
|
|
6558
6443
|
setItemsShow(newItemsShow);
|
|
6559
6444
|
};
|
|
6560
|
-
|
|
6561
6445
|
const onItemRemoveClick = index => {
|
|
6562
6446
|
const newItemsShow = [...itemsShow];
|
|
6563
6447
|
newItemsShow.splice(index, 1);
|
|
6564
6448
|
setItemsShow(newItemsShow);
|
|
6565
6449
|
formRefs.current.splice(index, 1);
|
|
6566
6450
|
};
|
|
6567
|
-
|
|
6568
6451
|
const onItemAddClick = () => {
|
|
6569
6452
|
const newItemsShow = [...itemsShow];
|
|
6570
6453
|
newItemsShow.push(false);
|
|
@@ -6572,28 +6455,22 @@ const ItemsAccordian = ({
|
|
|
6572
6455
|
formRefs.current.push(null);
|
|
6573
6456
|
onItemsToggleClick(newItemsShow.length - 1);
|
|
6574
6457
|
};
|
|
6575
|
-
|
|
6576
6458
|
const onItemEditClick = index => {
|
|
6577
6459
|
setEditingItemIndex(index);
|
|
6578
6460
|
};
|
|
6579
|
-
|
|
6580
6461
|
const onItemCancelClick = index => {
|
|
6581
6462
|
if (!data[index]) {
|
|
6582
6463
|
onItemRemoveClick(index);
|
|
6583
6464
|
} else {
|
|
6584
6465
|
setEditingItemIndex(undefined);
|
|
6585
6466
|
}
|
|
6586
|
-
|
|
6587
6467
|
onItemsToggleClick(index, false);
|
|
6588
6468
|
};
|
|
6589
|
-
|
|
6590
6469
|
const onDeleteClick = index => {
|
|
6591
6470
|
var _a;
|
|
6592
|
-
|
|
6593
6471
|
onDelete((_a = data[index]) === null || _a === void 0 ? void 0 : _a['_id']);
|
|
6594
6472
|
onItemRemoveClick(index);
|
|
6595
6473
|
};
|
|
6596
|
-
|
|
6597
6474
|
return /*#__PURE__*/React.createElement(Accordian, {
|
|
6598
6475
|
open: show,
|
|
6599
6476
|
onToggle: () => toggleShow(!show),
|
|
@@ -6688,20 +6565,17 @@ const WidgetForm = ({
|
|
|
6688
6565
|
const [selectedItemsType, setSelectedItemsType] = useState();
|
|
6689
6566
|
useEffect(() => {
|
|
6690
6567
|
var _a;
|
|
6691
|
-
|
|
6692
6568
|
if (data && formState === 'UPDATE') {
|
|
6693
6569
|
if ((data === null || data === void 0 ? void 0 : data.widgetType) === 'Carousel') {
|
|
6694
6570
|
setShowAutoPlay(true);
|
|
6695
6571
|
} else {
|
|
6696
6572
|
setShowAutoPlay(false);
|
|
6697
6573
|
}
|
|
6698
|
-
|
|
6699
6574
|
if ((data === null || data === void 0 ? void 0 : data.itemsType) === 'Image') {
|
|
6700
6575
|
setItemsEnabled(true);
|
|
6701
6576
|
} else {
|
|
6702
6577
|
setItemsEnabled(false);
|
|
6703
6578
|
}
|
|
6704
|
-
|
|
6705
6579
|
if ((data === null || data === void 0 ? void 0 : data.collectionItems) && (data === null || data === void 0 ? void 0 : data.collectionItems.length) > 0 && collectionData && collectionData.length > 0) {
|
|
6706
6580
|
let item;
|
|
6707
6581
|
setSelectedCollectionItems(((_a = data === null || data === void 0 ? void 0 : data.collectionItems) === null || _a === void 0 ? void 0 : _a.map(itemId => {
|
|
@@ -6714,7 +6588,6 @@ const WidgetForm = ({
|
|
|
6714
6588
|
} else {
|
|
6715
6589
|
setSelectedCollectionItems([]);
|
|
6716
6590
|
}
|
|
6717
|
-
|
|
6718
6591
|
if ((data === null || data === void 0 ? void 0 : data.collectionName) !== 'Image' && itemsTypes && itemsTypes.length > 0) {
|
|
6719
6592
|
setSelectedItemsType(itemsTypes.find(item => item.value === (data === null || data === void 0 ? void 0 : data.collectionName)));
|
|
6720
6593
|
}
|
|
@@ -6731,26 +6604,22 @@ const WidgetForm = ({
|
|
|
6731
6604
|
reset(data);
|
|
6732
6605
|
}
|
|
6733
6606
|
}, [data, reset]);
|
|
6734
|
-
|
|
6735
6607
|
const onChangeSearch = str => {
|
|
6736
6608
|
if (callerRef.current) clearTimeout(callerRef.current);
|
|
6737
6609
|
callerRef.current = setTimeout(() => {
|
|
6738
6610
|
if (selectedItemsType) getCollectionData(selectedItemsType.value, str);
|
|
6739
6611
|
}, 300);
|
|
6740
|
-
};
|
|
6741
|
-
|
|
6742
|
-
|
|
6612
|
+
};
|
|
6613
|
+
// Form Utility Functions
|
|
6743
6614
|
function handleCapitalize(event) {
|
|
6744
6615
|
event.target.value = capitalizeFirstLetter(event.target.value);
|
|
6745
6616
|
return event;
|
|
6746
6617
|
}
|
|
6747
|
-
|
|
6748
6618
|
function handleCode(event) {
|
|
6749
6619
|
event.target.value = changeToCode(event.target.value);
|
|
6750
6620
|
return event;
|
|
6751
|
-
}
|
|
6752
|
-
|
|
6753
|
-
|
|
6621
|
+
}
|
|
6622
|
+
// Widget Form Functions
|
|
6754
6623
|
const onWidgetFormInputChange = useCallback((value, name) => {
|
|
6755
6624
|
if (name === 'widgetType') {
|
|
6756
6625
|
if (value['widgetType'] === 'Carousel') setShowAutoPlay(true);else setShowAutoPlay(false);
|
|
@@ -6766,27 +6635,21 @@ const WidgetForm = ({
|
|
|
6766
6635
|
}
|
|
6767
6636
|
}
|
|
6768
6637
|
}, [getCollectionData, itemsTypes]);
|
|
6769
|
-
|
|
6770
6638
|
const onFormSubmit = data => {
|
|
6771
6639
|
const formData = Object.assign({}, data);
|
|
6772
|
-
|
|
6773
6640
|
if (selectedItemsType && formState === 'ADD') {
|
|
6774
6641
|
formData['collectionName'] = selectedItemsType.value;
|
|
6775
6642
|
}
|
|
6776
|
-
|
|
6777
6643
|
if (Array.isArray(selectedCollectionItems) && selectedCollectionItems.length > 0) {
|
|
6778
6644
|
formData['collectionItems'] = selectedCollectionItems.map(item => item.value);
|
|
6779
6645
|
}
|
|
6780
|
-
|
|
6781
6646
|
onWidgetFormSubmit(formData);
|
|
6782
6647
|
};
|
|
6783
|
-
|
|
6784
6648
|
const onCollectionIndexChange = result => {
|
|
6785
6649
|
const {
|
|
6786
6650
|
destination,
|
|
6787
6651
|
source
|
|
6788
6652
|
} = result;
|
|
6789
|
-
|
|
6790
6653
|
if (destination) {
|
|
6791
6654
|
setSelectedCollectionItems(listData => {
|
|
6792
6655
|
const temporaryData = [...listData];
|
|
@@ -6796,14 +6659,13 @@ const WidgetForm = ({
|
|
|
6796
6659
|
});
|
|
6797
6660
|
}
|
|
6798
6661
|
};
|
|
6799
|
-
|
|
6800
6662
|
useEffect(() => {
|
|
6801
6663
|
const subscription = watch((value, {
|
|
6802
6664
|
name
|
|
6803
6665
|
}) => onWidgetFormInputChange(value, name));
|
|
6804
6666
|
return () => subscription.unsubscribe();
|
|
6805
|
-
}, [watch, onWidgetFormInputChange]);
|
|
6806
|
-
|
|
6667
|
+
}, [watch, onWidgetFormInputChange]);
|
|
6668
|
+
// Schemas
|
|
6807
6669
|
const widgetFormSchema = [{
|
|
6808
6670
|
label: `${t('widget.name')}`,
|
|
6809
6671
|
required: true,
|
|
@@ -7043,7 +6905,7 @@ const WidgetPagination = () => {
|
|
|
7043
6905
|
pageSize,
|
|
7044
6906
|
setCurrentPage
|
|
7045
6907
|
} = useWidgetState();
|
|
7046
|
-
return
|
|
6908
|
+
return /*#__PURE__*/React.createElement(Pagination, {
|
|
7047
6909
|
ofText: t('of'),
|
|
7048
6910
|
pageText: t('page'),
|
|
7049
6911
|
showingText: t('showing'),
|
|
@@ -7062,7 +6924,6 @@ const WidgetSearch = () => {
|
|
|
7062
6924
|
} = useWidgetState();
|
|
7063
6925
|
const callerRef = useRef(null);
|
|
7064
6926
|
const [search, setSearch] = useState('');
|
|
7065
|
-
|
|
7066
6927
|
const onChangeSearch = str => {
|
|
7067
6928
|
setSearch(str);
|
|
7068
6929
|
if (callerRef.current) clearTimeout(callerRef.current);
|
|
@@ -7070,7 +6931,6 @@ const WidgetSearch = () => {
|
|
|
7070
6931
|
getWidgets(str);
|
|
7071
6932
|
}, 300);
|
|
7072
6933
|
};
|
|
7073
|
-
|
|
7074
6934
|
return /*#__PURE__*/React.createElement(Input, {
|
|
7075
6935
|
type: "search",
|
|
7076
6936
|
value: search,
|
|
@@ -7092,24 +6952,20 @@ const WidgetFormActions = ({
|
|
|
7092
6952
|
canUpdate,
|
|
7093
6953
|
t
|
|
7094
6954
|
} = useWidgetState();
|
|
7095
|
-
|
|
7096
6955
|
const onSubmitClick = e => {
|
|
7097
6956
|
var _a;
|
|
7098
|
-
|
|
7099
6957
|
if (!formRef) {
|
|
7100
6958
|
return onError(CALLBACK_CODES.INTERNAL, 'error', `formRef is required to submit the form!`);
|
|
7101
6959
|
} else if (!formRef.current) {
|
|
7102
6960
|
return onError(CALLBACK_CODES.INTERNAL, 'error', `formRef is empty, make sure it's passed as 'ref' prop to the form!`);
|
|
7103
|
-
}
|
|
7104
|
-
|
|
7105
|
-
|
|
6961
|
+
}
|
|
6962
|
+
// formRef is provided
|
|
7106
6963
|
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
7107
6964
|
(_a = formRef.current) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new Event('submit', {
|
|
7108
6965
|
cancelable: true,
|
|
7109
6966
|
bubbles: true
|
|
7110
6967
|
}));
|
|
7111
6968
|
};
|
|
7112
|
-
|
|
7113
6969
|
if (!canAdd && !canUpdate) return null;
|
|
7114
6970
|
return /*#__PURE__*/React.createElement(FormActions, {
|
|
7115
6971
|
loading: loading,
|
|
@@ -7238,7 +7094,6 @@ const Widget = ({
|
|
|
7238
7094
|
onConfirmDelete: onCofirmDeleteWidget
|
|
7239
7095
|
}));
|
|
7240
7096
|
};
|
|
7241
|
-
|
|
7242
7097
|
Widget.Table = WidgetTable;
|
|
7243
7098
|
Widget.Form = WidgetForm;
|
|
7244
7099
|
Widget.AddButton = AddButton;
|