@knovator/pagecreator-admin 0.5.5 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -67,10 +67,10 @@ var functionBindNative = !fails$l(function () {
67
67
 
68
68
  var NATIVE_BIND$3 = functionBindNative;
69
69
 
70
- var call$j = Function.prototype.call;
70
+ var call$i = Function.prototype.call;
71
71
 
72
- var functionCall = NATIVE_BIND$3 ? call$j.bind(call$j) : function () {
73
- return call$j.apply(call$j, arguments);
72
+ var functionCall = NATIVE_BIND$3 ? call$i.bind(call$i) : function () {
73
+ return call$i.apply(call$i, arguments);
74
74
  };
75
75
 
76
76
  var objectPropertyIsEnumerable = {};
@@ -101,22 +101,22 @@ var createPropertyDescriptor$3 = function (bitmap, value) {
101
101
  var NATIVE_BIND$2 = functionBindNative;
102
102
 
103
103
  var FunctionPrototype$2 = Function.prototype;
104
- var call$i = FunctionPrototype$2.call;
105
- var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$i, call$i);
104
+ var call$h = FunctionPrototype$2.call;
105
+ var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$h, call$h);
106
106
 
107
107
  var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
108
108
  return function () {
109
- return call$i.apply(fn, arguments);
109
+ return call$h.apply(fn, arguments);
110
110
  };
111
111
  };
112
112
 
113
113
  var uncurryThis$l = functionUncurryThis;
114
114
 
115
- var toString$9 = uncurryThis$l({}.toString);
115
+ var toString$8 = uncurryThis$l({}.toString);
116
116
  var stringSlice$4 = uncurryThis$l(''.slice);
117
117
 
118
118
  var classofRaw$2 = function (it) {
119
- return stringSlice$4(toString$9(it), 8, -1);
119
+ return stringSlice$4(toString$8(it), 8, -1);
120
120
  };
121
121
 
122
122
  var uncurryThis$k = functionUncurryThis;
@@ -137,27 +137,27 @@ var indexedObject = fails$k(function () {
137
137
 
138
138
  // we can't use just `it == null` since of `document.all` special case
139
139
  // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
140
- var isNullOrUndefined$6 = function (it) {
140
+ var isNullOrUndefined$5 = function (it) {
141
141
  return it === null || it === undefined;
142
142
  };
143
143
 
144
- var isNullOrUndefined$5 = isNullOrUndefined$6;
144
+ var isNullOrUndefined$4 = isNullOrUndefined$5;
145
145
 
146
146
  var $TypeError$f = TypeError;
147
147
 
148
148
  // `RequireObjectCoercible` abstract operation
149
149
  // https://tc39.es/ecma262/#sec-requireobjectcoercible
150
- var requireObjectCoercible$7 = function (it) {
151
- if (isNullOrUndefined$5(it)) throw $TypeError$f("Can't call method on " + it);
150
+ var requireObjectCoercible$6 = function (it) {
151
+ if (isNullOrUndefined$4(it)) throw $TypeError$f("Can't call method on " + it);
152
152
  return it;
153
153
  };
154
154
 
155
155
  // toObject with fallback for non-array-like ES3 strings
156
156
  var IndexedObject$2 = indexedObject;
157
- var requireObjectCoercible$6 = requireObjectCoercible$7;
157
+ var requireObjectCoercible$5 = requireObjectCoercible$6;
158
158
 
159
159
  var toIndexedObject$5 = function (it) {
160
- return IndexedObject$2(requireObjectCoercible$6(it));
160
+ return IndexedObject$2(requireObjectCoercible$5(it));
161
161
  };
162
162
 
163
163
  var documentAll$2 = typeof document == 'object' && document.all;
@@ -299,16 +299,16 @@ var aCallable$8 = function (argument) {
299
299
  };
300
300
 
301
301
  var aCallable$7 = aCallable$8;
302
- var isNullOrUndefined$4 = isNullOrUndefined$6;
302
+ var isNullOrUndefined$3 = isNullOrUndefined$5;
303
303
 
304
304
  // `GetMethod` abstract operation
305
305
  // https://tc39.es/ecma262/#sec-getmethod
306
- var getMethod$5 = function (V, P) {
306
+ var getMethod$4 = function (V, P) {
307
307
  var func = V[P];
308
- return isNullOrUndefined$4(func) ? undefined : aCallable$7(func);
308
+ return isNullOrUndefined$3(func) ? undefined : aCallable$7(func);
309
309
  };
310
310
 
311
- var call$h = functionCall;
311
+ var call$g = functionCall;
312
312
  var isCallable$h = isCallable$m;
313
313
  var isObject$9 = isObject$a;
314
314
 
@@ -318,9 +318,9 @@ var $TypeError$d = TypeError;
318
318
  // https://tc39.es/ecma262/#sec-ordinarytoprimitive
319
319
  var ordinaryToPrimitive$1 = function (input, pref) {
320
320
  var fn, val;
321
- if (pref === 'string' && isCallable$h(fn = input.toString) && !isObject$9(val = call$h(fn, input))) return val;
322
- if (isCallable$h(fn = input.valueOf) && !isObject$9(val = call$h(fn, input))) return val;
323
- if (pref !== 'string' && isCallable$h(fn = input.toString) && !isObject$9(val = call$h(fn, input))) return val;
321
+ if (pref === 'string' && isCallable$h(fn = input.toString) && !isObject$9(val = call$g(fn, input))) return val;
322
+ if (isCallable$h(fn = input.valueOf) && !isObject$9(val = call$g(fn, input))) return val;
323
+ if (pref !== 'string' && isCallable$h(fn = input.toString) && !isObject$9(val = call$g(fn, input))) return val;
324
324
  throw $TypeError$d("Can't convert object to primitive value");
325
325
  };
326
326
 
@@ -359,14 +359,14 @@ var store$2 = sharedStore;
359
359
  source: 'https://github.com/zloirock/core-js'
360
360
  });
361
361
 
362
- var requireObjectCoercible$5 = requireObjectCoercible$7;
362
+ var requireObjectCoercible$4 = requireObjectCoercible$6;
363
363
 
364
364
  var $Object$2 = Object;
365
365
 
366
366
  // `ToObject` abstract operation
367
367
  // https://tc39.es/ecma262/#sec-toobject
368
368
  var toObject$5 = function (argument) {
369
- return $Object$2(requireObjectCoercible$5(argument));
369
+ return $Object$2(requireObjectCoercible$4(argument));
370
370
  };
371
371
 
372
372
  var uncurryThis$i = functionUncurryThis;
@@ -385,10 +385,10 @@ var uncurryThis$h = functionUncurryThis;
385
385
 
386
386
  var id = 0;
387
387
  var postfix = Math.random();
388
- var toString$8 = uncurryThis$h(1.0.toString);
388
+ var toString$7 = uncurryThis$h(1.0.toString);
389
389
 
390
390
  var uid$2 = function (key) {
391
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$8(++id + postfix, 36);
391
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$7(++id + postfix, 36);
392
392
  };
393
393
 
394
394
  var global$i = global$n;
@@ -416,10 +416,10 @@ var wellKnownSymbol$i = function (name) {
416
416
  } return WellKnownSymbolsStore[name];
417
417
  };
418
418
 
419
- var call$g = functionCall;
419
+ var call$f = functionCall;
420
420
  var isObject$8 = isObject$a;
421
421
  var isSymbol$1 = isSymbol$2;
422
- var getMethod$4 = getMethod$5;
422
+ var getMethod$3 = getMethod$4;
423
423
  var ordinaryToPrimitive = ordinaryToPrimitive$1;
424
424
  var wellKnownSymbol$h = wellKnownSymbol$i;
425
425
 
@@ -430,11 +430,11 @@ var TO_PRIMITIVE = wellKnownSymbol$h('toPrimitive');
430
430
  // https://tc39.es/ecma262/#sec-toprimitive
431
431
  var toPrimitive$1 = function (input, pref) {
432
432
  if (!isObject$8(input) || isSymbol$1(input)) return input;
433
- var exoticToPrim = getMethod$4(input, TO_PRIMITIVE);
433
+ var exoticToPrim = getMethod$3(input, TO_PRIMITIVE);
434
434
  var result;
435
435
  if (exoticToPrim) {
436
436
  if (pref === undefined) pref = 'default';
437
- result = call$g(exoticToPrim, input, pref);
437
+ result = call$f(exoticToPrim, input, pref);
438
438
  if (!isObject$8(result) || isSymbol$1(result)) return result;
439
439
  throw $TypeError$c("Can't convert object to primitive value");
440
440
  }
@@ -476,7 +476,7 @@ var ie8DomDefine = !DESCRIPTORS$a && !fails$i(function () {
476
476
  });
477
477
 
478
478
  var DESCRIPTORS$9 = descriptors;
479
- var call$f = functionCall;
479
+ var call$e = functionCall;
480
480
  var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
481
481
  var createPropertyDescriptor$2 = createPropertyDescriptor$3;
482
482
  var toIndexedObject$4 = toIndexedObject$5;
@@ -495,7 +495,7 @@ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$9 ? $getOwnPropertyDescriptor$1 :
495
495
  if (IE8_DOM_DEFINE$1) try {
496
496
  return $getOwnPropertyDescriptor$1(O, P);
497
497
  } catch (error) { /* empty */ }
498
- if (hasOwn$9(O, P)) return createPropertyDescriptor$2(!call$f(propertyIsEnumerableModule$1.f, O, P), O[P]);
498
+ if (hasOwn$9(O, P)) return createPropertyDescriptor$2(!call$e(propertyIsEnumerableModule$1.f, O, P), O[P]);
499
499
  };
500
500
 
501
501
  var objectDefineProperty = {};
@@ -519,7 +519,7 @@ var $String$2 = String;
519
519
  var $TypeError$b = TypeError;
520
520
 
521
521
  // `Assert: Type(argument) is Object`
522
- var anObject$f = function (argument) {
522
+ var anObject$e = function (argument) {
523
523
  if (isObject$6(argument)) return argument;
524
524
  throw $TypeError$b($String$2(argument) + ' is not an object');
525
525
  };
@@ -527,7 +527,7 @@ var anObject$f = function (argument) {
527
527
  var DESCRIPTORS$7 = descriptors;
528
528
  var IE8_DOM_DEFINE = ie8DomDefine;
529
529
  var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
530
- var anObject$e = anObject$f;
530
+ var anObject$d = anObject$e;
531
531
  var toPropertyKey = toPropertyKey$2;
532
532
 
533
533
  var $TypeError$a = TypeError;
@@ -542,9 +542,9 @@ var WRITABLE = 'writable';
542
542
  // `Object.defineProperty` method
543
543
  // https://tc39.es/ecma262/#sec-object.defineproperty
544
544
  objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
545
- anObject$e(O);
545
+ anObject$d(O);
546
546
  P = toPropertyKey(P);
547
- anObject$e(Attributes);
547
+ anObject$d(Attributes);
548
548
  if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
549
549
  var current = $getOwnPropertyDescriptor(O, P);
550
550
  if (current && current[WRITABLE]) {
@@ -557,9 +557,9 @@ objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function de
557
557
  }
558
558
  } return $defineProperty(O, P, Attributes);
559
559
  } : $defineProperty : function defineProperty(O, P, Attributes) {
560
- anObject$e(O);
560
+ anObject$d(O);
561
561
  P = toPropertyKey(P);
562
- anObject$e(Attributes);
562
+ anObject$d(Attributes);
563
563
  if (IE8_DOM_DEFINE) try {
564
564
  return $defineProperty(O, P, Attributes);
565
565
  } catch (error) { /* empty */ }
@@ -921,13 +921,13 @@ var getBuiltIn$5 = getBuiltIn$8;
921
921
  var uncurryThis$e = functionUncurryThis;
922
922
  var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
923
923
  var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
924
- var anObject$d = anObject$f;
924
+ var anObject$c = anObject$e;
925
925
 
926
926
  var concat$2 = uncurryThis$e([].concat);
927
927
 
928
928
  // all object keys, includes non-enumerable and symbols
929
929
  var ownKeys$1 = getBuiltIn$5('Reflect', 'ownKeys') || function ownKeys(it) {
930
- var keys = getOwnPropertyNamesModule.f(anObject$d(it));
930
+ var keys = getOwnPropertyNamesModule.f(anObject$c(it));
931
931
  var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
932
932
  return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys;
933
933
  };
@@ -1039,7 +1039,7 @@ var objectKeys$2 = Object.keys || function keys(O) {
1039
1039
 
1040
1040
  var DESCRIPTORS$3 = descriptors;
1041
1041
  var uncurryThis$d = functionUncurryThis;
1042
- var call$e = functionCall;
1042
+ var call$d = functionCall;
1043
1043
  var fails$e = fails$n;
1044
1044
  var objectKeys$1 = objectKeys$2;
1045
1045
  var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
@@ -1089,7 +1089,7 @@ var objectAssign = !$assign || fails$e(function () {
1089
1089
  var key;
1090
1090
  while (length > j) {
1091
1091
  key = keys[j++];
1092
- if (!DESCRIPTORS$3 || call$e(propertyIsEnumerable, S, key)) T[key] = S[key];
1092
+ if (!DESCRIPTORS$3 || call$d(propertyIsEnumerable, S, key)) T[key] = S[key];
1093
1093
  }
1094
1094
  } return T;
1095
1095
  } : $assign;
@@ -1109,7 +1109,7 @@ var objectDefineProperties = {};
1109
1109
  var DESCRIPTORS$2 = descriptors;
1110
1110
  var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1111
1111
  var definePropertyModule$1 = objectDefineProperty;
1112
- var anObject$c = anObject$f;
1112
+ var anObject$b = anObject$e;
1113
1113
  var toIndexedObject$1 = toIndexedObject$5;
1114
1114
  var objectKeys = objectKeys$2;
1115
1115
 
@@ -1117,7 +1117,7 @@ var objectKeys = objectKeys$2;
1117
1117
  // https://tc39.es/ecma262/#sec-object.defineproperties
1118
1118
  // eslint-disable-next-line es/no-object-defineproperties -- safe
1119
1119
  objectDefineProperties.f = DESCRIPTORS$2 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1120
- anObject$c(O);
1120
+ anObject$b(O);
1121
1121
  var props = toIndexedObject$1(Properties);
1122
1122
  var keys = objectKeys(Properties);
1123
1123
  var length = keys.length;
@@ -1133,7 +1133,7 @@ var html$2 = getBuiltIn$4('document', 'documentElement');
1133
1133
 
1134
1134
  /* global ActiveXObject -- old IE, WSH */
1135
1135
 
1136
- var anObject$b = anObject$f;
1136
+ var anObject$a = anObject$e;
1137
1137
  var definePropertiesModule = objectDefineProperties;
1138
1138
  var enumBugKeys = enumBugKeys$3;
1139
1139
  var hiddenKeys = hiddenKeys$4;
@@ -1207,7 +1207,7 @@ hiddenKeys[IE_PROTO$1] = true;
1207
1207
  var objectCreate = Object.create || function create(O, Properties) {
1208
1208
  var result;
1209
1209
  if (O !== null) {
1210
- EmptyConstructor[PROTOTYPE] = anObject$b(O);
1210
+ EmptyConstructor[PROTOTYPE] = anObject$a(O);
1211
1211
  result = new EmptyConstructor();
1212
1212
  EmptyConstructor[PROTOTYPE] = null;
1213
1213
  // add "__proto__" for Object.getPrototypeOf polyfill
@@ -1358,7 +1358,7 @@ var aPossiblePrototype$1 = function (argument) {
1358
1358
  /* eslint-disable no-proto -- safe */
1359
1359
 
1360
1360
  var uncurryThis$c = functionUncurryThis;
1361
- var anObject$a = anObject$f;
1361
+ var anObject$9 = anObject$e;
1362
1362
  var aPossiblePrototype = aPossiblePrototype$1;
1363
1363
 
1364
1364
  // `Object.setPrototypeOf` method
@@ -1376,7 +1376,7 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
1376
1376
  CORRECT_SETTER = test instanceof Array;
1377
1377
  } catch (error) { /* empty */ }
1378
1378
  return function setPrototypeOf(O, proto) {
1379
- anObject$a(O);
1379
+ anObject$9(O);
1380
1380
  aPossiblePrototype(proto);
1381
1381
  if (CORRECT_SETTER) setter(O, proto);
1382
1382
  else O.__proto__ = proto;
@@ -1385,7 +1385,7 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
1385
1385
  }() : undefined);
1386
1386
 
1387
1387
  var $$d = _export;
1388
- var call$d = functionCall;
1388
+ var call$c = functionCall;
1389
1389
  var FunctionName = functionName;
1390
1390
  var isCallable$8 = isCallable$m;
1391
1391
  var createIteratorConstructor = iteratorCreateConstructor;
@@ -1454,7 +1454,7 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
1454
1454
  createNonEnumerableProperty$2(IterablePrototype, 'name', VALUES);
1455
1455
  } else {
1456
1456
  INCORRECT_VALUES_NAME = true;
1457
- defaultIterator = function values() { return call$d(nativeIterator, this); };
1457
+ defaultIterator = function values() { return call$c(nativeIterator, this); };
1458
1458
  }
1459
1459
  }
1460
1460
 
@@ -1738,7 +1738,8 @@ const TRANSLATION_PAIRS_WIDGET = {
1738
1738
  'widget.tabletPerRowRequired': 'Tablet Per Row is required',
1739
1739
  'widget.mobilePerRowRequired': 'Mobile Per Row is required',
1740
1740
  'widget.tabDeleteTitle': 'Are you sure you want to delete this tab?',
1741
- 'widget.widgetTitleInfo': 'HTML is supported'
1741
+ 'widget.widgetTitleInfo': 'HTML is supported',
1742
+ 'widget.minPerRow': 'Value must be greater than zero'
1742
1743
  };
1743
1744
  const TRANSLATION_PAIRS_ITEM = {
1744
1745
  'item.title': 'Title',
@@ -1847,17 +1848,17 @@ var classof$5 = classof$6;
1847
1848
 
1848
1849
  var $String = String;
1849
1850
 
1850
- var toString$7 = function (argument) {
1851
+ var toString$6 = function (argument) {
1851
1852
  if (classof$5(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1852
1853
  return $String(argument);
1853
1854
  };
1854
1855
 
1855
- var anObject$9 = anObject$f;
1856
+ var anObject$8 = anObject$e;
1856
1857
 
1857
1858
  // `RegExp.prototype.flags` getter implementation
1858
1859
  // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1859
1860
  var regexpFlags$1 = function () {
1860
- var that = anObject$9(this);
1861
+ var that = anObject$8(this);
1861
1862
  var result = '';
1862
1863
  if (that.hasIndices) result += 'd';
1863
1864
  if (that.global) result += 'g';
@@ -1926,9 +1927,9 @@ var regexpUnsupportedNcg = fails$9(function () {
1926
1927
 
1927
1928
  /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
1928
1929
  /* eslint-disable regexp/no-useless-quantifier -- testing */
1929
- var call$c = functionCall;
1930
+ var call$b = functionCall;
1930
1931
  var uncurryThis$b = functionUncurryThis;
1931
- var toString$6 = toString$7;
1932
+ var toString$5 = toString$6;
1932
1933
  var regexpFlags = regexpFlags$1;
1933
1934
  var stickyHelpers = regexpStickyHelpers;
1934
1935
  var shared = shared$4.exports;
@@ -1948,8 +1949,8 @@ var stringSlice$3 = uncurryThis$b(''.slice);
1948
1949
  var UPDATES_LAST_INDEX_WRONG = (function () {
1949
1950
  var re1 = /a/;
1950
1951
  var re2 = /b*/g;
1951
- call$c(nativeExec, re1, 'a');
1952
- call$c(nativeExec, re2, 'a');
1952
+ call$b(nativeExec, re1, 'a');
1953
+ call$b(nativeExec, re2, 'a');
1953
1954
  return re1.lastIndex !== 0 || re2.lastIndex !== 0;
1954
1955
  })();
1955
1956
 
@@ -1964,20 +1965,20 @@ if (PATCH) {
1964
1965
  patchedExec = function exec(string) {
1965
1966
  var re = this;
1966
1967
  var state = getInternalState(re);
1967
- var str = toString$6(string);
1968
+ var str = toString$5(string);
1968
1969
  var raw = state.raw;
1969
1970
  var result, reCopy, lastIndex, match, i, object, group;
1970
1971
 
1971
1972
  if (raw) {
1972
1973
  raw.lastIndex = re.lastIndex;
1973
- result = call$c(patchedExec, raw, str);
1974
+ result = call$b(patchedExec, raw, str);
1974
1975
  re.lastIndex = raw.lastIndex;
1975
1976
  return result;
1976
1977
  }
1977
1978
 
1978
1979
  var groups = state.groups;
1979
1980
  var sticky = UNSUPPORTED_Y && re.sticky;
1980
- var flags = call$c(regexpFlags, re);
1981
+ var flags = call$b(regexpFlags, re);
1981
1982
  var source = re.source;
1982
1983
  var charsAdded = 0;
1983
1984
  var strCopy = str;
@@ -2005,7 +2006,7 @@ if (PATCH) {
2005
2006
  }
2006
2007
  if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
2007
2008
 
2008
- match = call$c(nativeExec, sticky ? reCopy : re, strCopy);
2009
+ match = call$b(nativeExec, sticky ? reCopy : re, strCopy);
2009
2010
 
2010
2011
  if (sticky) {
2011
2012
  if (match) {
@@ -2020,7 +2021,7 @@ if (PATCH) {
2020
2021
  if (NPCG_INCLUDED && match && match.length > 1) {
2021
2022
  // Fix browsers whose `exec` methods don't consistently return `undefined`
2022
2023
  // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
2023
- call$c(nativeReplace, match[0], reCopy, function () {
2024
+ call$b(nativeReplace, match[0], reCopy, function () {
2024
2025
  for (i = 1; i < arguments.length - 2; i++) {
2025
2026
  if (arguments[i] === undefined) match[i] = undefined;
2026
2027
  }
@@ -2054,11 +2055,11 @@ var NATIVE_BIND$1 = functionBindNative;
2054
2055
 
2055
2056
  var FunctionPrototype = Function.prototype;
2056
2057
  var apply$2 = FunctionPrototype.apply;
2057
- var call$b = FunctionPrototype.call;
2058
+ var call$a = FunctionPrototype.call;
2058
2059
 
2059
2060
  // eslint-disable-next-line es/no-reflect -- safe
2060
- var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$b.bind(apply$2) : function () {
2061
- return call$b.apply(apply$2, arguments);
2061
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND$1 ? call$a.bind(apply$2) : function () {
2062
+ return call$a.apply(apply$2, arguments);
2062
2063
  });
2063
2064
 
2064
2065
  var classofRaw = classofRaw$2;
@@ -2147,8 +2148,8 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
2147
2148
 
2148
2149
  var uncurryThis$8 = functionUncurryThis;
2149
2150
  var toIntegerOrInfinity$1 = toIntegerOrInfinity$4;
2150
- var toString$5 = toString$7;
2151
- var requireObjectCoercible$4 = requireObjectCoercible$7;
2151
+ var toString$4 = toString$6;
2152
+ var requireObjectCoercible$3 = requireObjectCoercible$6;
2152
2153
 
2153
2154
  var charAt$2 = uncurryThis$8(''.charAt);
2154
2155
  var charCodeAt = uncurryThis$8(''.charCodeAt);
@@ -2156,7 +2157,7 @@ var stringSlice$2 = uncurryThis$8(''.slice);
2156
2157
 
2157
2158
  var createMethod$2 = function (CONVERT_TO_STRING) {
2158
2159
  return function ($this, pos) {
2159
- var S = toString$5(requireObjectCoercible$4($this));
2160
+ var S = toString$4(requireObjectCoercible$3($this));
2160
2161
  var position = toIntegerOrInfinity$1(pos);
2161
2162
  var size = S.length;
2162
2163
  var first, second;
@@ -2235,8 +2236,8 @@ var getSubstitution$1 = function (matched, str, position, captures, namedCapture
2235
2236
  });
2236
2237
  };
2237
2238
 
2238
- var call$a = functionCall;
2239
- var anObject$8 = anObject$f;
2239
+ var call$9 = functionCall;
2240
+ var anObject$7 = anObject$e;
2240
2241
  var isCallable$6 = isCallable$m;
2241
2242
  var classof$4 = classofRaw$2;
2242
2243
  var regexpExec = regexpExec$2;
@@ -2248,30 +2249,30 @@ var $TypeError$8 = TypeError;
2248
2249
  var regexpExecAbstract = function (R, S) {
2249
2250
  var exec = R.exec;
2250
2251
  if (isCallable$6(exec)) {
2251
- var result = call$a(exec, R, S);
2252
- if (result !== null) anObject$8(result);
2252
+ var result = call$9(exec, R, S);
2253
+ if (result !== null) anObject$7(result);
2253
2254
  return result;
2254
2255
  }
2255
- if (classof$4(R) === 'RegExp') return call$a(regexpExec, R, S);
2256
+ if (classof$4(R) === 'RegExp') return call$9(regexpExec, R, S);
2256
2257
  throw $TypeError$8('RegExp#exec called on incompatible receiver');
2257
2258
  };
2258
2259
 
2259
2260
  var apply$1 = functionApply;
2260
- var call$9 = functionCall;
2261
+ var call$8 = functionCall;
2261
2262
  var uncurryThis$6 = functionUncurryThis;
2262
- var fixRegExpWellKnownSymbolLogic$1 = fixRegexpWellKnownSymbolLogic;
2263
+ var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
2263
2264
  var fails$7 = fails$n;
2264
- var anObject$7 = anObject$f;
2265
+ var anObject$6 = anObject$e;
2265
2266
  var isCallable$5 = isCallable$m;
2266
- var isNullOrUndefined$3 = isNullOrUndefined$6;
2267
+ var isNullOrUndefined$2 = isNullOrUndefined$5;
2267
2268
  var toIntegerOrInfinity = toIntegerOrInfinity$4;
2268
2269
  var toLength = toLength$2;
2269
- var toString$4 = toString$7;
2270
- var requireObjectCoercible$3 = requireObjectCoercible$7;
2270
+ var toString$3 = toString$6;
2271
+ var requireObjectCoercible$2 = requireObjectCoercible$6;
2271
2272
  var advanceStringIndex = advanceStringIndex$1;
2272
- var getMethod$3 = getMethod$5;
2273
+ var getMethod$2 = getMethod$4;
2273
2274
  var getSubstitution = getSubstitution$1;
2274
- var regExpExec$1 = regexpExecAbstract;
2275
+ var regExpExec = regexpExecAbstract;
2275
2276
  var wellKnownSymbol$8 = wellKnownSymbol$i;
2276
2277
 
2277
2278
  var REPLACE = wellKnownSymbol$8('replace');
@@ -2313,24 +2314,24 @@ var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$7(function () {
2313
2314
  });
2314
2315
 
2315
2316
  // @@replace logic
2316
- fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCallNative) {
2317
+ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
2317
2318
  var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
2318
2319
 
2319
2320
  return [
2320
2321
  // `String.prototype.replace` method
2321
2322
  // https://tc39.es/ecma262/#sec-string.prototype.replace
2322
2323
  function replace(searchValue, replaceValue) {
2323
- var O = requireObjectCoercible$3(this);
2324
- var replacer = isNullOrUndefined$3(searchValue) ? undefined : getMethod$3(searchValue, REPLACE);
2324
+ var O = requireObjectCoercible$2(this);
2325
+ var replacer = isNullOrUndefined$2(searchValue) ? undefined : getMethod$2(searchValue, REPLACE);
2325
2326
  return replacer
2326
- ? call$9(replacer, searchValue, O, replaceValue)
2327
- : call$9(nativeReplace, toString$4(O), searchValue, replaceValue);
2327
+ ? call$8(replacer, searchValue, O, replaceValue)
2328
+ : call$8(nativeReplace, toString$3(O), searchValue, replaceValue);
2328
2329
  },
2329
2330
  // `RegExp.prototype[@@replace]` method
2330
2331
  // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
2331
2332
  function (string, replaceValue) {
2332
- var rx = anObject$7(this);
2333
- var S = toString$4(string);
2333
+ var rx = anObject$6(this);
2334
+ var S = toString$3(string);
2334
2335
 
2335
2336
  if (
2336
2337
  typeof replaceValue == 'string' &&
@@ -2342,7 +2343,7 @@ fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCall
2342
2343
  }
2343
2344
 
2344
2345
  var functionalReplace = isCallable$5(replaceValue);
2345
- if (!functionalReplace) replaceValue = toString$4(replaceValue);
2346
+ if (!functionalReplace) replaceValue = toString$3(replaceValue);
2346
2347
 
2347
2348
  var global = rx.global;
2348
2349
  if (global) {
@@ -2351,13 +2352,13 @@ fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCall
2351
2352
  }
2352
2353
  var results = [];
2353
2354
  while (true) {
2354
- var result = regExpExec$1(rx, S);
2355
+ var result = regExpExec(rx, S);
2355
2356
  if (result === null) break;
2356
2357
 
2357
2358
  push(results, result);
2358
2359
  if (!global) break;
2359
2360
 
2360
- var matchStr = toString$4(result[0]);
2361
+ var matchStr = toString$3(result[0]);
2361
2362
  if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
2362
2363
  }
2363
2364
 
@@ -2366,7 +2367,7 @@ fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCall
2366
2367
  for (var i = 0; i < results.length; i++) {
2367
2368
  result = results[i];
2368
2369
 
2369
- var matched = toString$4(result[0]);
2370
+ var matched = toString$3(result[0]);
2370
2371
  var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
2371
2372
  var captures = [];
2372
2373
  // NOTE: This is equivalent to
@@ -2379,7 +2380,7 @@ fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCall
2379
2380
  if (functionalReplace) {
2380
2381
  var replacerArgs = concat([matched], captures, position, S);
2381
2382
  if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
2382
- var replacement = toString$4(apply$1(replaceValue, undefined, replacerArgs));
2383
+ var replacement = toString$3(apply$1(replaceValue, undefined, replacerArgs));
2383
2384
  } else {
2384
2385
  replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
2385
2386
  }
@@ -2419,8 +2420,8 @@ var whitespaces$3 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u200
2419
2420
  '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
2420
2421
 
2421
2422
  var uncurryThis$5 = functionUncurryThis;
2422
- var requireObjectCoercible$2 = requireObjectCoercible$7;
2423
- var toString$3 = toString$7;
2423
+ var requireObjectCoercible$1 = requireObjectCoercible$6;
2424
+ var toString$2 = toString$6;
2424
2425
  var whitespaces$2 = whitespaces$3;
2425
2426
 
2426
2427
  var replace = uncurryThis$5(''.replace);
@@ -2431,7 +2432,7 @@ var rtrim = RegExp(whitespace + whitespace + '*$');
2431
2432
  // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
2432
2433
  var createMethod$1 = function (TYPE) {
2433
2434
  return function ($this) {
2434
- var string = toString$3(requireObjectCoercible$2($this));
2435
+ var string = toString$2(requireObjectCoercible$1($this));
2435
2436
  if (TYPE & 1) string = replace(string, ltrim, '');
2436
2437
  if (TYPE & 2) string = replace(string, rtrim, '');
2437
2438
  return string;
@@ -2531,7 +2532,7 @@ const build_path = (...args) => {
2531
2532
  var global$9 = global$n;
2532
2533
  var fails$4 = fails$n;
2533
2534
  var uncurryThis$4 = functionUncurryThis;
2534
- var toString$2 = toString$7;
2535
+ var toString$1 = toString$6;
2535
2536
  var trim = stringTrim.trim;
2536
2537
  var whitespaces = whitespaces$3;
2537
2538
 
@@ -2547,7 +2548,7 @@ var FORCED = $parseInt$1(whitespaces + '08') !== 8 || $parseInt$1(whitespaces +
2547
2548
  // `parseInt` method
2548
2549
  // https://tc39.es/ecma262/#sec-parseint-string-radix
2549
2550
  var numberParseInt = FORCED ? function parseInt(string, radix) {
2550
- var S = trim(toString$2(string));
2551
+ var S = trim(toString$1(string));
2551
2552
  return $parseInt$1(S, (radix >>> 0) || (exec$1(hex, S) ? 16 : 10));
2552
2553
  } : $parseInt$1;
2553
2554
 
@@ -2561,90 +2562,34 @@ $$9({ target: 'Number', stat: true, forced: Number.parseInt != parseInt$1 }, {
2561
2562
  parseInt: parseInt$1
2562
2563
  });
2563
2564
 
2564
- // `SameValue` abstract operation
2565
- // https://tc39.es/ecma262/#sec-samevalue
2566
- // eslint-disable-next-line es/no-object-is -- safe
2567
- var sameValue$1 = Object.is || function is(x, y) {
2568
- // eslint-disable-next-line no-self-compare -- NaN check
2569
- return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
2570
- };
2571
-
2572
- var call$8 = functionCall;
2573
- var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
2574
- var anObject$6 = anObject$f;
2575
- var isNullOrUndefined$2 = isNullOrUndefined$6;
2576
- var requireObjectCoercible$1 = requireObjectCoercible$7;
2577
- var sameValue = sameValue$1;
2578
- var toString$1 = toString$7;
2579
- var getMethod$2 = getMethod$5;
2580
- var regExpExec = regexpExecAbstract;
2581
-
2582
- // @@search logic
2583
- fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) {
2584
- return [
2585
- // `String.prototype.search` method
2586
- // https://tc39.es/ecma262/#sec-string.prototype.search
2587
- function search(regexp) {
2588
- var O = requireObjectCoercible$1(this);
2589
- var searcher = isNullOrUndefined$2(regexp) ? undefined : getMethod$2(regexp, SEARCH);
2590
- return searcher ? call$8(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString$1(O));
2591
- },
2592
- // `RegExp.prototype[@@search]` method
2593
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@search
2594
- function (string) {
2595
- var rx = anObject$6(this);
2596
- var S = toString$1(string);
2597
- var res = maybeCallNative(nativeSearch, rx, S);
2598
-
2599
- if (res.done) return res.value;
2600
-
2601
- var previousLastIndex = rx.lastIndex;
2602
- if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
2603
- var result = regExpExec(rx, S);
2604
- if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
2605
- return result === null ? -1 : result.index;
2606
- }
2607
- ];
2608
- });
2609
-
2610
2565
  const usePagination = ({
2611
2566
  defaultLimit
2612
2567
  }) => {
2613
- const defaultApiPayload = {
2614
- search: "",
2615
- offset: DEFAULT_OFFSET_PAYLOAD,
2616
- limit: defaultLimit || DEFAULT_LIMIT
2617
- };
2618
- const [filter, setFilter] = React.useState(defaultApiPayload);
2619
- const [currentPage, setCurrentPage] = React.useState(DEFAULT_CURRENT_PAGE);
2568
+ const offsetRef = React.useRef(DEFAULT_OFFSET_PAYLOAD);
2569
+ const limitRef = React.useRef(defaultLimit || DEFAULT_LIMIT);
2570
+ const currentPageRef = React.useRef(DEFAULT_CURRENT_PAGE);
2571
+ const searchRef = React.useRef('');
2620
2572
  const setPageSize = value => {
2621
- setFilter(Object.assign(Object.assign({}, filter), {
2622
- limit: Number.parseInt(String(value), DECIMAL_REDIX),
2623
- offset: DEFAULT_OFFSET_PAYLOAD
2624
- }));
2625
- setCurrentPage(DEFAULT_CURRENT_PAGE);
2573
+ limitRef.current = Number.parseInt(String(value), DECIMAL_REDIX);
2574
+ offsetRef.current = DEFAULT_OFFSET_PAYLOAD;
2575
+ currentPageRef.current = DEFAULT_CURRENT_PAGE;
2626
2576
  };
2627
2577
  const changeSearch = value => {
2628
- setFilter(draft => {
2629
- draft.search = value;
2630
- return draft;
2631
- });
2578
+ searchRef.current = value;
2632
2579
  };
2633
2580
  const changeCurrentPage = value => {
2634
- setFilter(Object.assign(Object.assign({}, filter), {
2635
- offset: Math.max(value - 1, 1) * filter.limit
2636
- }));
2637
- setCurrentPage(value);
2581
+ currentPageRef.current = value;
2582
+ offsetRef.current = value * limitRef.current;
2638
2583
  };
2639
2584
  return {
2640
- pageSize: filter.limit,
2585
+ pageSize: limitRef.current,
2586
+ currentPageRef,
2587
+ limitRef,
2588
+ offsetRef,
2589
+ searchRef,
2641
2590
  setPageSize,
2642
- currentPage,
2643
2591
  changeSearch,
2644
- filter,
2645
- setCurrentPage: changeCurrentPage,
2646
- defaultApiPayload,
2647
- setFilter
2592
+ setCurrentPage: changeCurrentPage
2648
2593
  };
2649
2594
  };
2650
2595
 
@@ -2804,9 +2749,12 @@ const usePage = ({
2804
2749
  const {
2805
2750
  setPageSize,
2806
2751
  pageSize,
2807
- currentPage,
2752
+ currentPageRef,
2808
2753
  setCurrentPage,
2809
- filter
2754
+ offsetRef,
2755
+ limitRef,
2756
+ searchRef,
2757
+ changeSearch
2810
2758
  } = usePagination({
2811
2759
  defaultLimit
2812
2760
  });
@@ -2819,7 +2767,7 @@ const usePage = ({
2819
2767
  }
2820
2768
  onError(code, 'error', data === null || data === void 0 ? void 0 : data.message);
2821
2769
  }, [onError, onLogout]);
2822
- const getWidgets = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
2770
+ const getWidgets = React.useCallback(callback => __awaiter(void 0, void 0, void 0, function* () {
2823
2771
  try {
2824
2772
  setWidgetsLoading(true);
2825
2773
  const api = getApiType({
@@ -2846,6 +2794,7 @@ const usePage = ({
2846
2794
  value: item['_id'] || item['id']
2847
2795
  };
2848
2796
  });
2797
+ if (typeof callback === 'function') callback(widgetsData);
2849
2798
  return setWidgets(widgetsData);
2850
2799
  }
2851
2800
  setWidgetsLoading(false);
@@ -2870,9 +2819,9 @@ const usePage = ({
2870
2819
  data: {
2871
2820
  search,
2872
2821
  options: {
2873
- offset: filter.offset,
2874
- limit: filter.limit,
2875
- page: currentPage
2822
+ offset: offsetRef.current,
2823
+ limit: limitRef.current,
2824
+ page: currentPageRef.current
2876
2825
  }
2877
2826
  }
2878
2827
  });
@@ -2886,7 +2835,7 @@ const usePage = ({
2886
2835
  } catch (error) {
2887
2836
  setLoading(false);
2888
2837
  }
2889
- }), [baseUrl, currentPage, filter.limit, filter.offset, handleError, pageRoutesPrefix, routes, token]);
2838
+ }), [baseUrl, currentPageRef, limitRef, offsetRef, handleError, pageRoutesPrefix, routes, token]);
2890
2839
  const onPageFormSubmit = data => __awaiter(void 0, void 0, void 0, function* () {
2891
2840
  setLoading(true);
2892
2841
  const code = formState === 'ADD' ? CALLBACK_CODES.CREATE : CALLBACK_CODES.UPDATE;
@@ -2970,10 +2919,7 @@ const usePage = ({
2970
2919
  const onChangeFormState = (state, data) => {
2971
2920
  setItemData(data || null);
2972
2921
  setFormState(state);
2973
- if (state === 'UPDATE' && (data === null || data === void 0 ? void 0 : data.widgets)) {
2974
- setSelectedWidgets(data.widgets.map(widgetId => widgets.find(widget => widget['value'] === widgetId)).filter(widget => widget));
2975
- // setSelectedWidgets(widgets.filter((widget) => data.widgets.includes(widget.value)));
2976
- } else {
2922
+ if (state === 'UPDATE' && (data === null || data === void 0 ? void 0 : data.widgets)) ; else {
2977
2923
  setSelectedWidgets([]);
2978
2924
  }
2979
2925
  };
@@ -2985,27 +2931,33 @@ const usePage = ({
2985
2931
  return temporaryData;
2986
2932
  });
2987
2933
  };
2934
+ const changeCurrentPage = page => {
2935
+ setCurrentPage(page);
2936
+ getPages(searchRef.current);
2937
+ };
2988
2938
  React.useEffect(() => {
2989
2939
  if (_canList) getPages();
2990
- getWidgets();
2991
2940
  // eslint-disable-next-line react-hooks/exhaustive-deps
2992
- }, [pageSize, currentPage, _canList]);
2941
+ }, [pageSize, _canList]);
2993
2942
  return {
2994
2943
  list,
2995
2944
  getPages,
2996
2945
  loading,
2997
2946
  setLoading,
2998
2947
  // Pagination
2948
+ searchText: searchRef.current,
2949
+ changeSearch,
2999
2950
  pageSize,
3000
2951
  totalPages,
3001
- currentPage,
2952
+ currentPage: currentPageRef.current,
3002
2953
  totalRecords,
3003
- setCurrentPage,
2954
+ setCurrentPage: changeCurrentPage,
3004
2955
  setPageSize,
3005
2956
  // Form
3006
2957
  widgets,
3007
2958
  itemData,
3008
2959
  formState,
2960
+ getWidgets,
3009
2961
  onCloseForm,
3010
2962
  widgetsLoading,
3011
2963
  selectedWidgets,
@@ -3021,12 +2973,15 @@ const PageContext = /*#__PURE__*/React.createContext(null);
3021
2973
  const PageContextProvider = ({
3022
2974
  t: _t = key => Object.assign({}, TRANSLATION_PAIRS_COMMON)[key],
3023
2975
  // Form
2976
+ searchText: _searchText = '',
2977
+ changeSearch: _changeSearch = () => {},
3024
2978
  list: _list = [],
3025
2979
  widgets: _widgets = [],
3026
2980
  formState: _formState = '',
3027
2981
  closeForm: _closeForm = () => {},
3028
2982
  getPages: _getPages = () => {},
3029
2983
  loading: _loading = false,
2984
+ getWidgets: _getWidgets = () => {},
3030
2985
  onChangeFormState: _onChangeFormState = () => {},
3031
2986
  onPageFormSubmit: _onPageFormSubmit = () => {},
3032
2987
  canAdd: _canAdd = false,
@@ -3056,10 +3011,13 @@ const PageContextProvider = ({
3056
3011
  t: _t,
3057
3012
  // Form
3058
3013
  list: _list,
3014
+ searchText: _searchText,
3015
+ changeSearch: _changeSearch,
3059
3016
  widgets: _widgets,
3060
3017
  closeForm: _closeForm,
3061
3018
  formState: _formState,
3062
3019
  loading: _loading,
3020
+ getWidgets: _getWidgets,
3063
3021
  onChangeFormState: _onChangeFormState,
3064
3022
  canAdd: _canAdd,
3065
3023
  canUpdate: _canUpdate,
@@ -3522,17 +3480,19 @@ var Input = Object.assign(Input$1, {
3522
3480
 
3523
3481
  const PageSearch = () => {
3524
3482
  const {
3525
- getPages,
3526
3483
  t,
3527
- canList
3484
+ canList,
3485
+ changeSearch,
3486
+ setCurrentPage
3528
3487
  } = usePageState();
3529
3488
  const callerRef = React.useRef(null);
3530
3489
  const [search, setSearch] = React.useState('');
3531
3490
  const onChangeSearch = str => {
3532
3491
  setSearch(str);
3492
+ changeSearch(str);
3533
3493
  if (callerRef.current) clearTimeout(callerRef.current);
3534
3494
  callerRef.current = setTimeout(() => {
3535
- getPages(str);
3495
+ setCurrentPage(1);
3536
3496
  }, 300);
3537
3497
  };
3538
3498
  return /*#__PURE__*/React__default["default"].createElement(Input, {
@@ -3559,8 +3519,8 @@ var regexpGetFlags = function (R) {
3559
3519
 
3560
3520
  var PROPER_FUNCTION_NAME = functionName.PROPER;
3561
3521
  var defineBuiltIn$2 = defineBuiltIn$7;
3562
- var anObject$5 = anObject$f;
3563
- var $toString = toString$7;
3522
+ var anObject$5 = anObject$e;
3523
+ var $toString = toString$6;
3564
3524
  var fails$3 = fails$n;
3565
3525
  var getRegExpFlags = regexpGetFlags;
3566
3526
 
@@ -4042,6 +4002,7 @@ const PageForm = ({
4042
4002
  selectedWidgets,
4043
4003
  setSelectedWidgets,
4044
4004
  widgets,
4005
+ getWidgets,
4045
4006
  onChangeWidgetSequence,
4046
4007
  canAdd,
4047
4008
  canUpdate
@@ -4055,6 +4016,12 @@ const PageForm = ({
4055
4016
  event.target.value = changeToCode(event.target.value);
4056
4017
  return event;
4057
4018
  }
4019
+ function loadOptions(value, callback) {
4020
+ getWidgets(widgetsData => {
4021
+ if (callback) callback(widgetsData);
4022
+ if (formState === 'UPDATE' && data) setSelectedWidgets(data.widgets.map(widgetId => widgetsData.find(widget => widget['value'] === widgetId)).filter(widget => widget));
4023
+ });
4024
+ }
4058
4025
  // Widget Form Functions
4059
4026
  const onDragEnd = result => {
4060
4027
  const {
@@ -4092,6 +4059,7 @@ const PageForm = ({
4092
4059
  options: widgets,
4093
4060
  selectedOptions: selectedWidgets,
4094
4061
  isMulti: true,
4062
+ loadOptions: loadOptions,
4095
4063
  onChange: widgets => setSelectedWidgets(widgets)
4096
4064
  }];
4097
4065
  if (!canAdd && !canUpdate) return null;
@@ -4181,26 +4149,21 @@ const Pagination = ({
4181
4149
  previousContent,
4182
4150
  nextContent
4183
4151
  }) => {
4184
- const [localCurrentPage, setLocalCurrentPage] = React.useState(currentPage);
4185
- const updatePagination = () => {
4186
- let newValue = localCurrentPage;
4187
- if (newValue) {
4152
+ const updatePagination = newValue => {
4153
+ if (newValue && typeof newValue === 'number') {
4188
4154
  if (newValue <= 0) {
4189
4155
  newValue = 1;
4190
4156
  } else if (newValue > totalPages) {
4191
4157
  newValue = totalPages;
4192
4158
  }
4193
4159
  setCurrentPage(newValue);
4194
- setLocalCurrentPage(newValue);
4195
4160
  }
4196
4161
  };
4197
4162
  const onPaginationButtonClick = dir => {
4198
4163
  if (dir === 'next') {
4199
- setCurrentPage(currentPage + 1);
4200
- setLocalCurrentPage(localCurrentPage + 1);
4164
+ updatePagination(currentPage + 1);
4201
4165
  } else {
4202
- setCurrentPage(currentPage - 1);
4203
- setLocalCurrentPage(localCurrentPage - 1);
4166
+ updatePagination(currentPage - 1);
4204
4167
  }
4205
4168
  };
4206
4169
  return /*#__PURE__*/React__default["default"].createElement("nav", {
@@ -4218,7 +4181,7 @@ const Pagination = ({
4218
4181
  size: "xs",
4219
4182
  type: "secondary",
4220
4183
  className: "khb_pagination-previous",
4221
- disabled: currentPage - 1 === 0,
4184
+ disabled: currentPage - 1 <= 0,
4222
4185
  onClick: () => onPaginationButtonClick('previous')
4223
4186
  }, previousContent || /*#__PURE__*/React__default["default"].createElement(ChevronLeft, {
4224
4187
  srText: "Previous"
@@ -4229,15 +4192,14 @@ const Pagination = ({
4229
4192
  size: "xs",
4230
4193
  type: "number",
4231
4194
  id: "page",
4232
- value: localCurrentPage,
4233
- onChange: e => setLocalCurrentPage(Number(e.target.value)),
4234
- onBlur: updatePagination,
4195
+ value: currentPage,
4196
+ onChange: e => updatePagination(Number(e.target.value)),
4235
4197
  disabled: !totalRecords
4236
4198
  }), ' ', "/ ", totalPages), /*#__PURE__*/React__default["default"].createElement(Button, {
4237
4199
  size: "xs",
4238
4200
  type: "secondary",
4239
4201
  className: "khb_pagination-next",
4240
- disabled: currentPage === totalPages || !totalRecords,
4202
+ disabled: currentPage >= totalPages,
4241
4203
  onClick: () => onPaginationButtonClick('next')
4242
4204
  }, nextContent || /*#__PURE__*/React__default["default"].createElement(ChevronRight, {
4243
4205
  srText: "Next"
@@ -4510,8 +4472,11 @@ const Page = ({
4510
4472
  currentPage,
4511
4473
  pageSize,
4512
4474
  itemData,
4475
+ searchText,
4476
+ changeSearch,
4513
4477
  setCurrentPage,
4514
4478
  formState,
4479
+ getWidgets,
4515
4480
  onChangeFormState,
4516
4481
  onPageFormSubmit,
4517
4482
  onCloseForm,
@@ -4529,6 +4494,8 @@ const Page = ({
4529
4494
  t: derivedT,
4530
4495
  loader: loader,
4531
4496
  list: list,
4497
+ searchText: searchText,
4498
+ changeSearch: changeSearch,
4532
4499
  widgets: widgets,
4533
4500
  data: itemData,
4534
4501
  loading: loading,
@@ -4537,6 +4504,7 @@ const Page = ({
4537
4504
  currentPage: currentPage,
4538
4505
  onChangeFormState: onChangeFormState,
4539
4506
  pageSize: pageSize,
4507
+ getWidgets: getWidgets,
4540
4508
  setCurrentPage: setCurrentPage,
4541
4509
  onPageFormSubmit: onPageFormSubmit,
4542
4510
  selectedWidgets: selectedWidgets,
@@ -4614,11 +4582,14 @@ const useWidget = ({
4614
4582
  itemsRoutesPrefix
4615
4583
  } = useProviderState();
4616
4584
  const {
4585
+ changeSearch,
4617
4586
  setPageSize,
4618
4587
  pageSize,
4619
- currentPage,
4588
+ limitRef,
4589
+ currentPageRef,
4620
4590
  setCurrentPage,
4621
- filter
4591
+ offsetRef,
4592
+ searchRef
4622
4593
  } = usePagination({
4623
4594
  defaultLimit
4624
4595
  });
@@ -4649,9 +4620,9 @@ const useWidget = ({
4649
4620
  data: {
4650
4621
  search,
4651
4622
  options: {
4652
- offset: filter.offset,
4653
- limit: filter.limit,
4654
- page: currentPage
4623
+ offset: offsetRef.current,
4624
+ limit: limitRef.current,
4625
+ page: currentPageRef.current
4655
4626
  }
4656
4627
  }
4657
4628
  });
@@ -4665,7 +4636,7 @@ const useWidget = ({
4665
4636
  } catch (error) {
4666
4637
  setLoading(false);
4667
4638
  }
4668
- }), [baseUrl, currentPage, filter.limit, filter.offset, handleError, routes, token, widgetRoutesPrefix]);
4639
+ }), [baseUrl, currentPageRef, limitRef, offsetRef, handleError, routes, token, widgetRoutesPrefix]);
4669
4640
  const getItems = React.useCallback(id => __awaiter(void 0, void 0, void 0, function* () {
4670
4641
  try {
4671
4642
  setItemsLoading(true);
@@ -5013,21 +4984,26 @@ const useWidget = ({
5013
4984
  onError(CALLBACK_CODES.IMAGE_REMOVE, INTERNAL_ERROR_CODE, error.message);
5014
4985
  }
5015
4986
  });
4987
+ const changeCurrentPage = page => {
4988
+ setCurrentPage(page);
4989
+ getWidgets(searchRef.current);
4990
+ };
5016
4991
  React.useEffect(() => {
5017
4992
  if (_canList) getWidgets();
5018
4993
  // eslint-disable-next-line react-hooks/exhaustive-deps
5019
- }, [pageSize, currentPage, _canList]);
4994
+ }, [_canList]);
5020
4995
  return {
5021
4996
  list,
5022
4997
  getWidgets,
5023
4998
  loading,
5024
4999
  setLoading,
5025
5000
  // Pagination
5001
+ searchText: searchRef.current,
5026
5002
  pageSize,
5027
5003
  totalPages,
5028
- currentPage,
5004
+ currentPage: currentPageRef.current,
5029
5005
  totalRecords,
5030
- setCurrentPage,
5006
+ setCurrentPage: changeCurrentPage,
5031
5007
  setPageSize,
5032
5008
  // Form
5033
5009
  formState,
@@ -5042,6 +5018,7 @@ const useWidget = ({
5042
5018
  onImageRemove,
5043
5019
  itemsTypes,
5044
5020
  widgetTypes,
5021
+ changeSearch,
5045
5022
  collectionDataLoading,
5046
5023
  getCollectionData,
5047
5024
  collectionData,
@@ -5144,9 +5121,9 @@ var aConstructor$1 = function (argument) {
5144
5121
  throw $TypeError$5(tryToString$2(argument) + ' is not a constructor');
5145
5122
  };
5146
5123
 
5147
- var anObject$4 = anObject$f;
5124
+ var anObject$4 = anObject$e;
5148
5125
  var aConstructor = aConstructor$1;
5149
- var isNullOrUndefined$1 = isNullOrUndefined$6;
5126
+ var isNullOrUndefined$1 = isNullOrUndefined$5;
5150
5127
  var wellKnownSymbol$6 = wellKnownSymbol$i;
5151
5128
 
5152
5129
  var SPECIES$1 = wellKnownSymbol$6('species');
@@ -5823,8 +5800,8 @@ var isArrayIteratorMethod$1 = function (it) {
5823
5800
  };
5824
5801
 
5825
5802
  var classof$1 = classof$6;
5826
- var getMethod$1 = getMethod$5;
5827
- var isNullOrUndefined = isNullOrUndefined$6;
5803
+ var getMethod$1 = getMethod$4;
5804
+ var isNullOrUndefined = isNullOrUndefined$5;
5828
5805
  var Iterators = iterators;
5829
5806
  var wellKnownSymbol$3 = wellKnownSymbol$i;
5830
5807
 
@@ -5838,7 +5815,7 @@ var getIteratorMethod$2 = function (it) {
5838
5815
 
5839
5816
  var call$5 = functionCall;
5840
5817
  var aCallable$2 = aCallable$8;
5841
- var anObject$3 = anObject$f;
5818
+ var anObject$3 = anObject$e;
5842
5819
  var tryToString$1 = tryToString$4;
5843
5820
  var getIteratorMethod$1 = getIteratorMethod$2;
5844
5821
 
@@ -5851,8 +5828,8 @@ var getIterator$1 = function (argument, usingIterator) {
5851
5828
  };
5852
5829
 
5853
5830
  var call$4 = functionCall;
5854
- var anObject$2 = anObject$f;
5855
- var getMethod = getMethod$5;
5831
+ var anObject$2 = anObject$e;
5832
+ var getMethod = getMethod$4;
5856
5833
 
5857
5834
  var iteratorClose$1 = function (iterator, kind, value) {
5858
5835
  var innerResult, innerError;
@@ -5876,7 +5853,7 @@ var iteratorClose$1 = function (iterator, kind, value) {
5876
5853
 
5877
5854
  var bind = functionBindContext;
5878
5855
  var call$3 = functionCall;
5879
- var anObject$1 = anObject$f;
5856
+ var anObject$1 = anObject$e;
5880
5857
  var tryToString = tryToString$4;
5881
5858
  var isArrayIteratorMethod = isArrayIteratorMethod$1;
5882
5859
  var lengthOfArrayLike = lengthOfArrayLike$3;
@@ -6095,7 +6072,7 @@ $$2({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
6095
6072
  }
6096
6073
  });
6097
6074
 
6098
- var anObject = anObject$f;
6075
+ var anObject = anObject$e;
6099
6076
  var isObject$1 = isObject$a;
6100
6077
  var newPromiseCapability = newPromiseCapability$2;
6101
6078
 
@@ -6128,6 +6105,8 @@ const WidgetContextProvider = ({
6128
6105
  t: _t = () => '',
6129
6106
  // Form
6130
6107
  list: _list = [],
6108
+ searchText: _searchText = '',
6109
+ changeSearch: _changeSearch = () => {},
6131
6110
  formState: _formState = '',
6132
6111
  closeForm: _closeForm = () => {},
6133
6112
  loading: _loading = false,
@@ -6180,6 +6159,8 @@ const WidgetContextProvider = ({
6180
6159
  closeForm: _closeForm,
6181
6160
  formState: _formState,
6182
6161
  loading: _loading,
6162
+ searchText: _searchText,
6163
+ changeSearch: _changeSearch,
6183
6164
  onChangeFormState: _onChangeFormState,
6184
6165
  onWidgetFormSubmit: _onWidgetFormSubmit,
6185
6166
  updateData: _updateData,
@@ -6341,8 +6322,8 @@ var correctIsRegexpLogic = function (METHOD_NAME) {
6341
6322
  var $ = _export;
6342
6323
  var uncurryThis = functionUncurryThis;
6343
6324
  var notARegExp = notARegexp;
6344
- var requireObjectCoercible = requireObjectCoercible$7;
6345
- var toString = toString$7;
6325
+ var requireObjectCoercible = requireObjectCoercible$6;
6326
+ var toString = toString$6;
6346
6327
  var correctIsRegExpLogic = correctIsRegexpLogic;
6347
6328
 
6348
6329
  var stringIndexOf = uncurryThis(''.indexOf);
@@ -7111,7 +7092,11 @@ const WidgetForm = ({
7111
7092
  placeholder: t('widget.webPerRowPlaceholder'),
7112
7093
  wrapperClassName: 'khb_grid-item-1of3 khb_padding-right-1',
7113
7094
  validations: {
7114
- required: t('widget.webPerRowRequired')
7095
+ required: t('widget.webPerRowRequired'),
7096
+ min: {
7097
+ value: 1,
7098
+ message: t('widget.minPerRow')
7099
+ }
7115
7100
  }
7116
7101
  }, {
7117
7102
  label: t('widget.tabletPerRow'),
@@ -7121,7 +7106,11 @@ const WidgetForm = ({
7121
7106
  placeholder: t('widget.tabletPerRowPlaceholder'),
7122
7107
  wrapperClassName: 'khb_grid-item-1of3 khb_padding-left-1',
7123
7108
  validations: {
7124
- required: t('widget.tabletPerRowRequired')
7109
+ required: t('widget.tabletPerRowRequired'),
7110
+ min: {
7111
+ value: 1,
7112
+ message: t('widget.minPerRow')
7113
+ }
7125
7114
  }
7126
7115
  }, {
7127
7116
  label: t('widget.mobilePerRow'),
@@ -7131,7 +7120,11 @@ const WidgetForm = ({
7131
7120
  placeholder: t('widget.mobilePerRowPlaceholder'),
7132
7121
  wrapperClassName: 'khb_grid-item-1of3 khb_padding-right-1 khb_padding-left-1',
7133
7122
  validations: {
7134
- required: t('widget.mobilePerRowRequired')
7123
+ required: t('widget.mobilePerRowRequired'),
7124
+ min: {
7125
+ value: 1,
7126
+ message: t('widget.minPerRow')
7127
+ }
7135
7128
  }
7136
7129
  }, {
7137
7130
  label: selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.label,
@@ -7321,22 +7314,24 @@ const WidgetPagination = () => {
7321
7314
 
7322
7315
  const WidgetSearch = () => {
7323
7316
  const {
7324
- getWidgets,
7317
+ changeSearch,
7325
7318
  t,
7326
- canList
7319
+ canList,
7320
+ setCurrentPage
7327
7321
  } = useWidgetState();
7328
7322
  const callerRef = React.useRef(null);
7329
- const [search, setSearch] = React.useState('');
7323
+ const [searchVal, setSearchVal] = React.useState();
7330
7324
  const onChangeSearch = str => {
7331
- setSearch(str);
7325
+ setSearchVal(str);
7326
+ changeSearch(str);
7332
7327
  if (callerRef.current) clearTimeout(callerRef.current);
7333
7328
  callerRef.current = setTimeout(() => {
7334
- getWidgets(str);
7329
+ setCurrentPage(1);
7335
7330
  }, 300);
7336
7331
  };
7337
7332
  return /*#__PURE__*/React__default["default"].createElement(Input, {
7338
7333
  type: "search",
7339
- value: search,
7334
+ value: searchVal,
7340
7335
  disabled: !canList,
7341
7336
  onChange: e => onChangeSearch(e.target.value),
7342
7337
  placeholder: t('widget.searchPlaceholder')
@@ -7413,6 +7408,8 @@ const Widget = ({
7413
7408
  const {
7414
7409
  list,
7415
7410
  loading,
7411
+ searchText,
7412
+ changeSearch,
7416
7413
  onChangeFormState,
7417
7414
  formState,
7418
7415
  onCloseForm,
@@ -7450,6 +7447,8 @@ const Widget = ({
7450
7447
  list: list,
7451
7448
  onChangeFormState: onChangeFormState,
7452
7449
  t: derivedT,
7450
+ searchText: searchText,
7451
+ changeSearch: changeSearch,
7453
7452
  loader: loader,
7454
7453
  onWidgetFormSubmit: onWidgetFormSubmit,
7455
7454
  data: itemData,