@apia/util 0.3.6 → 1.0.1
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/cleanDist.json +1 -1
- package/dist/index.d.ts +285 -17
- package/dist/index.js +618 -155
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import FileSaver from 'file-saver';
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import React__default, { useRef,
|
|
8
|
+
import React__default, { useRef, useCallback, useEffect, useState, useMemo, createContext, useContext } from 'react';
|
|
9
9
|
import { isFunction as isFunction$1, uniqueId } from 'lodash-es';
|
|
10
10
|
import { jsx } from 'react/jsx-runtime';
|
|
11
11
|
import xml2js from 'xml2js';
|
|
@@ -661,15 +661,15 @@ function isChild(element, checkParent) {
|
|
|
661
661
|
return !!getSpecificParent(element, checkParent);
|
|
662
662
|
}
|
|
663
663
|
|
|
664
|
-
var __accessCheck$
|
|
664
|
+
var __accessCheck$7 = (obj, member, msg) => {
|
|
665
665
|
if (!member.has(obj))
|
|
666
666
|
throw TypeError("Cannot " + msg);
|
|
667
667
|
};
|
|
668
|
-
var __privateGet$
|
|
669
|
-
__accessCheck$
|
|
668
|
+
var __privateGet$7 = (obj, member, getter) => {
|
|
669
|
+
__accessCheck$7(obj, member, "read from private field");
|
|
670
670
|
return getter ? getter.call(obj) : member.get(obj);
|
|
671
671
|
};
|
|
672
|
-
var __privateAdd$
|
|
672
|
+
var __privateAdd$7 = (obj, member, value) => {
|
|
673
673
|
if (member.has(obj))
|
|
674
674
|
throw TypeError("Cannot add the same private member more than once");
|
|
675
675
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
@@ -678,7 +678,7 @@ var _parameters;
|
|
|
678
678
|
class Url {
|
|
679
679
|
constructor(baseUrl, defaultAllowMultiple = true) {
|
|
680
680
|
this.defaultAllowMultiple = defaultAllowMultiple;
|
|
681
|
-
__privateAdd$
|
|
681
|
+
__privateAdd$7(this, _parameters, {});
|
|
682
682
|
const [base, query] = baseUrl.split("?");
|
|
683
683
|
this.base = base;
|
|
684
684
|
query == null ? void 0 : query.split("&").forEach((current) => {
|
|
@@ -688,9 +688,9 @@ class Url {
|
|
|
688
688
|
}
|
|
689
689
|
addParameter(name, value, allowMultiple) {
|
|
690
690
|
if (allowMultiple === void 0 && !this.defaultAllowMultiple || allowMultiple === false)
|
|
691
|
-
__privateGet$
|
|
691
|
+
__privateGet$7(this, _parameters)[name] = String(value);
|
|
692
692
|
else
|
|
693
|
-
__privateGet$
|
|
693
|
+
__privateGet$7(this, _parameters)[name] = __privateGet$7(this, _parameters)[name] ? [...arrayOrArray(__privateGet$7(this, _parameters)[name]), String(value)] : [String(value)];
|
|
694
694
|
}
|
|
695
695
|
addParameters(parameters) {
|
|
696
696
|
parameters.forEach(
|
|
@@ -698,10 +698,10 @@ class Url {
|
|
|
698
698
|
);
|
|
699
699
|
}
|
|
700
700
|
getParameter(name) {
|
|
701
|
-
return __privateGet$
|
|
701
|
+
return __privateGet$7(this, _parameters)[name];
|
|
702
702
|
}
|
|
703
703
|
toString() {
|
|
704
|
-
const parametersArray = Object.entries(__privateGet$
|
|
704
|
+
const parametersArray = Object.entries(__privateGet$7(this, _parameters));
|
|
705
705
|
return `${this.base}${parametersArray.length > 0 ? `?${parametersArray.map(
|
|
706
706
|
([name, value]) => Array.isArray(value) ? value.map((current) => `${name}=${current}`).join("&") : `${name}=${String(value)}`
|
|
707
707
|
).join("&")}` : ""}`;
|
|
@@ -733,15 +733,15 @@ function enableChildrenFocus(parent) {
|
|
|
733
733
|
});
|
|
734
734
|
}
|
|
735
735
|
|
|
736
|
-
var __accessCheck$
|
|
736
|
+
var __accessCheck$6 = (obj, member, msg) => {
|
|
737
737
|
if (!member.has(obj))
|
|
738
738
|
throw TypeError("Cannot " + msg);
|
|
739
739
|
};
|
|
740
|
-
var __privateGet$
|
|
741
|
-
__accessCheck$
|
|
740
|
+
var __privateGet$6 = (obj, member, getter) => {
|
|
741
|
+
__accessCheck$6(obj, member, "read from private field");
|
|
742
742
|
return getter ? getter.call(obj) : member.get(obj);
|
|
743
743
|
};
|
|
744
|
-
var __privateAdd$
|
|
744
|
+
var __privateAdd$6 = (obj, member, value) => {
|
|
745
745
|
if (member.has(obj))
|
|
746
746
|
throw TypeError("Cannot add the same private member more than once");
|
|
747
747
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
@@ -775,38 +775,38 @@ function eventEmitterBaseFunction() {
|
|
|
775
775
|
}
|
|
776
776
|
class EventEmitter {
|
|
777
777
|
constructor() {
|
|
778
|
-
__privateAdd$
|
|
778
|
+
__privateAdd$6(this, _emitter$1, eventEmitterBaseFunction());
|
|
779
779
|
}
|
|
780
780
|
on(eventName, fn) {
|
|
781
|
-
__privateGet$
|
|
781
|
+
__privateGet$6(this, _emitter$1).on(eventName, fn);
|
|
782
782
|
return () => {
|
|
783
|
-
__privateGet$
|
|
783
|
+
__privateGet$6(this, _emitter$1).off(eventName, fn);
|
|
784
784
|
};
|
|
785
785
|
}
|
|
786
786
|
off(eventName, fn) {
|
|
787
|
-
__privateGet$
|
|
787
|
+
__privateGet$6(this, _emitter$1).off(eventName, fn);
|
|
788
788
|
}
|
|
789
789
|
emit(eventName, params) {
|
|
790
|
-
__privateGet$
|
|
790
|
+
__privateGet$6(this, _emitter$1).emit(eventName, params);
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
793
|
_emitter$1 = new WeakMap();
|
|
794
794
|
|
|
795
|
-
var __accessCheck$
|
|
795
|
+
var __accessCheck$5 = (obj, member, msg) => {
|
|
796
796
|
if (!member.has(obj))
|
|
797
797
|
throw TypeError("Cannot " + msg);
|
|
798
798
|
};
|
|
799
|
-
var __privateGet$
|
|
800
|
-
__accessCheck$
|
|
799
|
+
var __privateGet$5 = (obj, member, getter) => {
|
|
800
|
+
__accessCheck$5(obj, member, "read from private field");
|
|
801
801
|
return getter ? getter.call(obj) : member.get(obj);
|
|
802
802
|
};
|
|
803
|
-
var __privateAdd$
|
|
803
|
+
var __privateAdd$5 = (obj, member, value) => {
|
|
804
804
|
if (member.has(obj))
|
|
805
805
|
throw TypeError("Cannot add the same private member more than once");
|
|
806
806
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
807
807
|
};
|
|
808
808
|
var __privateMethod$2 = (obj, member, method) => {
|
|
809
|
-
__accessCheck$
|
|
809
|
+
__accessCheck$5(obj, member, "access private method");
|
|
810
810
|
return method;
|
|
811
811
|
};
|
|
812
812
|
var _emitter, _getEventName, getEventName_fn;
|
|
@@ -839,46 +839,47 @@ function eventEmitter() {
|
|
|
839
839
|
class HashedEventEmitter {
|
|
840
840
|
constructor(hashMethod) {
|
|
841
841
|
this.hashMethod = hashMethod;
|
|
842
|
-
__privateAdd$
|
|
843
|
-
__privateAdd$
|
|
842
|
+
__privateAdd$5(this, _getEventName);
|
|
843
|
+
__privateAdd$5(this, _emitter, eventEmitter());
|
|
844
844
|
}
|
|
845
845
|
on(hash, eventName, fn) {
|
|
846
846
|
const actualEventName = __privateMethod$2(this, _getEventName, getEventName_fn).call(this, hash, eventName);
|
|
847
|
-
__privateGet$
|
|
847
|
+
__privateGet$5(this, _emitter).on(actualEventName, fn);
|
|
848
848
|
return () => {
|
|
849
|
-
__privateGet$
|
|
849
|
+
__privateGet$5(this, _emitter).off(actualEventName, fn);
|
|
850
850
|
};
|
|
851
851
|
}
|
|
852
852
|
off(hash, eventName, fn) {
|
|
853
853
|
const actualEventName = __privateMethod$2(this, _getEventName, getEventName_fn).call(this, hash, eventName);
|
|
854
|
-
__privateGet$
|
|
854
|
+
__privateGet$5(this, _emitter).off(actualEventName, fn);
|
|
855
855
|
}
|
|
856
856
|
emit(hash, eventName, params) {
|
|
857
857
|
const actualEventName = __privateMethod$2(this, _getEventName, getEventName_fn).call(this, hash, eventName);
|
|
858
|
-
__privateGet$
|
|
858
|
+
__privateGet$5(this, _emitter).emit(actualEventName, params);
|
|
859
|
+
__privateGet$5(this, _emitter).emit(eventName, params);
|
|
859
860
|
}
|
|
860
861
|
}
|
|
861
862
|
_emitter = new WeakMap();
|
|
862
863
|
_getEventName = new WeakSet();
|
|
863
864
|
getEventName_fn = function(hash, eventName) {
|
|
864
|
-
return `${this.hashMethod(hash)}_${eventName}`;
|
|
865
|
+
return hash === "*" ? eventName : `${this.hashMethod(hash)}_${eventName}`;
|
|
865
866
|
};
|
|
866
867
|
|
|
867
|
-
var __accessCheck$
|
|
868
|
+
var __accessCheck$4 = (obj, member, msg) => {
|
|
868
869
|
if (!member.has(obj))
|
|
869
870
|
throw TypeError("Cannot " + msg);
|
|
870
871
|
};
|
|
871
|
-
var __privateGet$
|
|
872
|
-
__accessCheck$
|
|
872
|
+
var __privateGet$4 = (obj, member, getter) => {
|
|
873
|
+
__accessCheck$4(obj, member, "read from private field");
|
|
873
874
|
return getter ? getter.call(obj) : member.get(obj);
|
|
874
875
|
};
|
|
875
|
-
var __privateAdd$
|
|
876
|
+
var __privateAdd$4 = (obj, member, value) => {
|
|
876
877
|
if (member.has(obj))
|
|
877
878
|
throw TypeError("Cannot add the same private member more than once");
|
|
878
879
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
879
880
|
};
|
|
880
|
-
var __privateSet$
|
|
881
|
-
__accessCheck$
|
|
881
|
+
var __privateSet$4 = (obj, member, value, setter) => {
|
|
882
|
+
__accessCheck$4(obj, member, "write to private field");
|
|
882
883
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
883
884
|
return value;
|
|
884
885
|
};
|
|
@@ -886,34 +887,34 @@ var _value;
|
|
|
886
887
|
class WithEventsValue extends EventEmitter {
|
|
887
888
|
constructor(value) {
|
|
888
889
|
super();
|
|
889
|
-
__privateAdd$
|
|
890
|
-
__privateSet$
|
|
890
|
+
__privateAdd$4(this, _value, void 0);
|
|
891
|
+
__privateSet$4(this, _value, value);
|
|
891
892
|
}
|
|
892
893
|
get value() {
|
|
893
|
-
return __privateGet$
|
|
894
|
+
return __privateGet$4(this, _value);
|
|
894
895
|
}
|
|
895
896
|
set value(value) {
|
|
896
|
-
__privateSet$
|
|
897
|
+
__privateSet$4(this, _value, value);
|
|
897
898
|
this.emit("update", value);
|
|
898
899
|
}
|
|
899
900
|
}
|
|
900
901
|
_value = new WeakMap();
|
|
901
902
|
|
|
902
|
-
var __accessCheck$
|
|
903
|
+
var __accessCheck$3 = (obj, member, msg) => {
|
|
903
904
|
if (!member.has(obj))
|
|
904
905
|
throw TypeError("Cannot " + msg);
|
|
905
906
|
};
|
|
906
|
-
var __privateGet$
|
|
907
|
-
__accessCheck$
|
|
907
|
+
var __privateGet$3 = (obj, member, getter) => {
|
|
908
|
+
__accessCheck$3(obj, member, "read from private field");
|
|
908
909
|
return getter ? getter.call(obj) : member.get(obj);
|
|
909
910
|
};
|
|
910
|
-
var __privateAdd$
|
|
911
|
+
var __privateAdd$3 = (obj, member, value) => {
|
|
911
912
|
if (member.has(obj))
|
|
912
913
|
throw TypeError("Cannot add the same private member more than once");
|
|
913
914
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
914
915
|
};
|
|
915
|
-
var __privateSet$
|
|
916
|
-
__accessCheck$
|
|
916
|
+
var __privateSet$3 = (obj, member, value, setter) => {
|
|
917
|
+
__accessCheck$3(obj, member, "write to private field");
|
|
917
918
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
918
919
|
return value;
|
|
919
920
|
};
|
|
@@ -922,7 +923,7 @@ const historySize = 50;
|
|
|
922
923
|
const globalFocus = new (_a$2 = class {
|
|
923
924
|
constructor() {
|
|
924
925
|
this.focused = [];
|
|
925
|
-
__privateAdd$
|
|
926
|
+
__privateAdd$3(this, _onFocusCallbacks, []);
|
|
926
927
|
debugDispatcher.on(
|
|
927
928
|
"focusHistory",
|
|
928
929
|
() => {
|
|
@@ -932,12 +933,12 @@ const globalFocus = new (_a$2 = class {
|
|
|
932
933
|
);
|
|
933
934
|
}
|
|
934
935
|
offFocus(cb) {
|
|
935
|
-
__privateSet$
|
|
936
|
+
__privateSet$3(this, _onFocusCallbacks, __privateGet$3(this, _onFocusCallbacks).filter(
|
|
936
937
|
(current) => current !== cb
|
|
937
938
|
));
|
|
938
939
|
}
|
|
939
940
|
onFocus(cb) {
|
|
940
|
-
__privateGet$
|
|
941
|
+
__privateGet$3(this, _onFocusCallbacks).push(cb);
|
|
941
942
|
return () => {
|
|
942
943
|
this.offFocus(cb);
|
|
943
944
|
};
|
|
@@ -954,7 +955,7 @@ const globalFocus = new (_a$2 = class {
|
|
|
954
955
|
if (this.focused.length > historySize) {
|
|
955
956
|
this.focused = this.focused.splice(0, historySize);
|
|
956
957
|
}
|
|
957
|
-
__privateGet$
|
|
958
|
+
__privateGet$3(this, _onFocusCallbacks).forEach((cb) => cb());
|
|
958
959
|
}
|
|
959
960
|
get list() {
|
|
960
961
|
return [...this.focused];
|
|
@@ -981,90 +982,526 @@ const globalFocus = new (_a$2 = class {
|
|
|
981
982
|
}
|
|
982
983
|
}, _onFocusCallbacks = new WeakMap(), _a$2)();
|
|
983
984
|
|
|
984
|
-
var __accessCheck$
|
|
985
|
+
var __accessCheck$2 = (obj, member, msg) => {
|
|
985
986
|
if (!member.has(obj))
|
|
986
987
|
throw TypeError("Cannot " + msg);
|
|
987
988
|
};
|
|
988
|
-
var __privateGet$
|
|
989
|
-
__accessCheck$
|
|
989
|
+
var __privateGet$2 = (obj, member, getter) => {
|
|
990
|
+
__accessCheck$2(obj, member, "read from private field");
|
|
990
991
|
return getter ? getter.call(obj) : member.get(obj);
|
|
991
992
|
};
|
|
992
|
-
var __privateAdd$
|
|
993
|
+
var __privateAdd$2 = (obj, member, value) => {
|
|
993
994
|
if (member.has(obj))
|
|
994
995
|
throw TypeError("Cannot add the same private member more than once");
|
|
995
996
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
996
997
|
};
|
|
997
|
-
var __privateSet$
|
|
998
|
-
__accessCheck$
|
|
998
|
+
var __privateSet$2 = (obj, member, value, setter) => {
|
|
999
|
+
__accessCheck$2(obj, member, "write to private field");
|
|
999
1000
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
1000
1001
|
return value;
|
|
1001
1002
|
};
|
|
1002
1003
|
var __privateMethod$1 = (obj, member, method) => {
|
|
1003
|
-
__accessCheck$
|
|
1004
|
+
__accessCheck$2(obj, member, "access private method");
|
|
1004
1005
|
return method;
|
|
1005
1006
|
};
|
|
1006
1007
|
var _hasReleasedFirstTime, _wasReleasedFirstTime, _isForced, _locks, _shoutLockState, shoutLockState_fn, _a$1;
|
|
1007
1008
|
const screenLocker = new (_a$1 = class extends EventEmitter {
|
|
1008
1009
|
constructor() {
|
|
1009
1010
|
super();
|
|
1010
|
-
__privateAdd$
|
|
1011
|
-
__privateAdd$
|
|
1012
|
-
__privateAdd$
|
|
1013
|
-
__privateAdd$
|
|
1014
|
-
__privateAdd$
|
|
1011
|
+
__privateAdd$2(this, _shoutLockState);
|
|
1012
|
+
__privateAdd$2(this, _hasReleasedFirstTime, false);
|
|
1013
|
+
__privateAdd$2(this, _wasReleasedFirstTime, false);
|
|
1014
|
+
__privateAdd$2(this, _isForced, false);
|
|
1015
|
+
__privateAdd$2(this, _locks, {
|
|
1015
1016
|
common: false
|
|
1016
1017
|
});
|
|
1017
1018
|
this.emit("ready");
|
|
1018
1019
|
}
|
|
1019
1020
|
get hasReleasedFirstTime() {
|
|
1020
|
-
return __privateGet$
|
|
1021
|
+
return __privateGet$2(this, _hasReleasedFirstTime);
|
|
1021
1022
|
}
|
|
1022
1023
|
get isForced() {
|
|
1023
|
-
return __privateGet$
|
|
1024
|
+
return __privateGet$2(this, _isForced);
|
|
1024
1025
|
}
|
|
1025
1026
|
/**
|
|
1026
1027
|
* Permite saber si un bloqueo determinado está activo o si la clase tiene
|
|
1027
1028
|
* forceLock activo.
|
|
1028
1029
|
*/
|
|
1029
1030
|
isLocked(lockName = "common") {
|
|
1030
|
-
return __privateGet$
|
|
1031
|
+
return __privateGet$2(this, _locks)[lockName] || __privateGet$2(this, _isForced);
|
|
1031
1032
|
}
|
|
1032
1033
|
lock(lockName = "common") {
|
|
1033
|
-
__privateGet$
|
|
1034
|
+
__privateGet$2(this, _locks)[lockName] = true;
|
|
1034
1035
|
__privateMethod$1(this, _shoutLockState, shoutLockState_fn).call(this, lockName);
|
|
1035
1036
|
}
|
|
1036
1037
|
unlock(lockName = "common") {
|
|
1037
1038
|
if (lockName === "common")
|
|
1038
|
-
__privateSet$
|
|
1039
|
-
__privateGet$
|
|
1039
|
+
__privateSet$2(this, _hasReleasedFirstTime, true);
|
|
1040
|
+
__privateGet$2(this, _locks)[lockName] = false;
|
|
1040
1041
|
__privateMethod$1(this, _shoutLockState, shoutLockState_fn).call(this, lockName);
|
|
1041
1042
|
}
|
|
1042
1043
|
force() {
|
|
1043
|
-
__privateSet$
|
|
1044
|
+
__privateSet$2(this, _isForced, true);
|
|
1044
1045
|
__privateMethod$1(this, _shoutLockState, shoutLockState_fn).call(this);
|
|
1045
1046
|
}
|
|
1046
1047
|
releaseForced() {
|
|
1047
|
-
__privateSet$
|
|
1048
|
+
__privateSet$2(this, _isForced, false);
|
|
1048
1049
|
__privateMethod$1(this, _shoutLockState, shoutLockState_fn).call(this);
|
|
1049
1050
|
}
|
|
1050
1051
|
}, _hasReleasedFirstTime = new WeakMap(), _wasReleasedFirstTime = new WeakMap(), _isForced = new WeakMap(), _locks = new WeakMap(), _shoutLockState = new WeakSet(), shoutLockState_fn = function(lockName) {
|
|
1051
|
-
if (__privateGet$
|
|
1052
|
+
if (__privateGet$2(this, _isForced) || lockName === void 0) {
|
|
1052
1053
|
this.emit("forcedStateChange", {
|
|
1053
|
-
isForced: __privateGet$
|
|
1054
|
-
hasReleasedFirstTime: __privateGet$
|
|
1054
|
+
isForced: __privateGet$2(this, _isForced),
|
|
1055
|
+
hasReleasedFirstTime: __privateGet$2(this, _hasReleasedFirstTime)
|
|
1055
1056
|
});
|
|
1056
1057
|
} else {
|
|
1057
|
-
if (lockName === "common" && !__privateGet$
|
|
1058
|
+
if (lockName === "common" && !__privateGet$2(this, _wasReleasedFirstTime) && __privateGet$2(this, _hasReleasedFirstTime)) {
|
|
1058
1059
|
this.emit("releaseForFirstTime");
|
|
1059
1060
|
}
|
|
1060
1061
|
this.emit("lockStateChange", {
|
|
1061
1062
|
lockName,
|
|
1062
|
-
hasReleasedFirstTime: __privateGet$
|
|
1063
|
-
isLocked: __privateGet$
|
|
1063
|
+
hasReleasedFirstTime: __privateGet$2(this, _hasReleasedFirstTime),
|
|
1064
|
+
isLocked: __privateGet$2(this, _locks)[lockName]
|
|
1064
1065
|
});
|
|
1065
1066
|
}
|
|
1066
1067
|
}, _a$1)();
|
|
1067
1068
|
|
|
1069
|
+
function useCombinedRefs(...refs) {
|
|
1070
|
+
const [targetRef, setTargetRef] = React.useState();
|
|
1071
|
+
React.useEffect(() => {
|
|
1072
|
+
refs.forEach((ref) => {
|
|
1073
|
+
if (!ref)
|
|
1074
|
+
return;
|
|
1075
|
+
if (typeof ref === "function") {
|
|
1076
|
+
ref(targetRef);
|
|
1077
|
+
} else {
|
|
1078
|
+
ref.current = targetRef;
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1081
|
+
}, [refs, targetRef]);
|
|
1082
|
+
return setTargetRef;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
const useDebouncedCallback = (callback, { runWhenTriggered, timeout } = { runWhenTriggered: false, timeout: 200 }) => {
|
|
1086
|
+
const timeoutRef = useRef(-1);
|
|
1087
|
+
return useCallback(
|
|
1088
|
+
(...params) => {
|
|
1089
|
+
if (runWhenTriggered)
|
|
1090
|
+
callback(...params);
|
|
1091
|
+
clearTimeout(timeoutRef.current);
|
|
1092
|
+
timeoutRef.current = setTimeout(
|
|
1093
|
+
() => callback(...params),
|
|
1094
|
+
timeout
|
|
1095
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1096
|
+
);
|
|
1097
|
+
},
|
|
1098
|
+
[callback, runWhenTriggered, timeout]
|
|
1099
|
+
);
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
function useLatest(value) {
|
|
1103
|
+
const ref = useRef(value);
|
|
1104
|
+
ref.current = value;
|
|
1105
|
+
return ref;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
function useMount(effect) {
|
|
1109
|
+
const hasRun = useRef(false);
|
|
1110
|
+
useEffect(() => {
|
|
1111
|
+
if (!hasRun.current) {
|
|
1112
|
+
hasRun.current = true;
|
|
1113
|
+
return effect();
|
|
1114
|
+
}
|
|
1115
|
+
}, []);
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
function useUnmount(unmountCallback) {
|
|
1119
|
+
useEffect(() => {
|
|
1120
|
+
return unmountCallback;
|
|
1121
|
+
}, []);
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
function usePrevious(value) {
|
|
1125
|
+
const previousValue = useRef(void 0);
|
|
1126
|
+
const currentValue = useRef(void 0);
|
|
1127
|
+
previousValue.current = currentValue.current;
|
|
1128
|
+
currentValue.current = value;
|
|
1129
|
+
return previousValue;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
function useStateRef(initialState) {
|
|
1133
|
+
const [state, setState] = useState(initialState);
|
|
1134
|
+
const stateRef = useRef(state);
|
|
1135
|
+
stateRef.current = state;
|
|
1136
|
+
return [state, setState, stateRef];
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
function useUpdateEffect(effect, deps) {
|
|
1140
|
+
const hasRunnedForFirstTime = useRef(false);
|
|
1141
|
+
useEffect(() => {
|
|
1142
|
+
if (hasRunnedForFirstTime.current) {
|
|
1143
|
+
return effect();
|
|
1144
|
+
}
|
|
1145
|
+
hasRunnedForFirstTime.current = true;
|
|
1146
|
+
return () => {
|
|
1147
|
+
};
|
|
1148
|
+
}, deps);
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
function shallowEqual(a, b) {
|
|
1152
|
+
if (typeof a !== typeof b)
|
|
1153
|
+
return false;
|
|
1154
|
+
if (typeof a === "object" && a && typeof b === "object" && b) {
|
|
1155
|
+
const aKeys = Object.keys(a);
|
|
1156
|
+
const bKeys = Object.keys(b);
|
|
1157
|
+
if (aKeys.length !== bKeys.length)
|
|
1158
|
+
return false;
|
|
1159
|
+
for (let i = 0; i < aKeys.length; i++) {
|
|
1160
|
+
if (a[aKeys[i]] !== b[bKeys[i]])
|
|
1161
|
+
return false;
|
|
1162
|
+
}
|
|
1163
|
+
} else {
|
|
1164
|
+
if (a !== b)
|
|
1165
|
+
return false;
|
|
1166
|
+
}
|
|
1167
|
+
return true;
|
|
1168
|
+
}
|
|
1169
|
+
function shallowCompareArrays(a, b) {
|
|
1170
|
+
if (a.length !== b.length)
|
|
1171
|
+
return false;
|
|
1172
|
+
for (let i = 0; i < a.length; i++) {
|
|
1173
|
+
const differ = shallowEqual(a, b);
|
|
1174
|
+
if (!differ)
|
|
1175
|
+
return false;
|
|
1176
|
+
}
|
|
1177
|
+
return true;
|
|
1178
|
+
}
|
|
1179
|
+
function useShallowMemo(creator, deps) {
|
|
1180
|
+
var _a;
|
|
1181
|
+
const value = useRef(creator());
|
|
1182
|
+
const previousDeps = usePrevious(deps);
|
|
1183
|
+
if (!shallowEqual((_a = previousDeps.current) != null ? _a : [], deps)) {
|
|
1184
|
+
value.current = creator();
|
|
1185
|
+
}
|
|
1186
|
+
return value.current;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
var __defProp$6 = Object.defineProperty;
|
|
1190
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1191
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1192
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1193
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1194
|
+
var __spreadValues$6 = (a, b) => {
|
|
1195
|
+
for (var prop in b || (b = {}))
|
|
1196
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
1197
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1198
|
+
if (__getOwnPropSymbols$6)
|
|
1199
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1200
|
+
if (__propIsEnum$6.call(b, prop))
|
|
1201
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1202
|
+
}
|
|
1203
|
+
return a;
|
|
1204
|
+
};
|
|
1205
|
+
var __accessCheck$1 = (obj, member, msg) => {
|
|
1206
|
+
if (!member.has(obj))
|
|
1207
|
+
throw TypeError("Cannot " + msg);
|
|
1208
|
+
};
|
|
1209
|
+
var __privateGet$1 = (obj, member, getter) => {
|
|
1210
|
+
__accessCheck$1(obj, member, "read from private field");
|
|
1211
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
1212
|
+
};
|
|
1213
|
+
var __privateAdd$1 = (obj, member, value) => {
|
|
1214
|
+
if (member.has(obj))
|
|
1215
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
1216
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
1217
|
+
};
|
|
1218
|
+
var __privateSet$1 = (obj, member, value, setter) => {
|
|
1219
|
+
__accessCheck$1(obj, member, "write to private field");
|
|
1220
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
1221
|
+
return value;
|
|
1222
|
+
};
|
|
1223
|
+
var _onUpdateCbs;
|
|
1224
|
+
function upper(s) {
|
|
1225
|
+
return `${s.charAt(0).toUpperCase()}${s.slice(1)}`;
|
|
1226
|
+
}
|
|
1227
|
+
function isUpdater(props) {
|
|
1228
|
+
return typeof props === "function";
|
|
1229
|
+
}
|
|
1230
|
+
class BasicStoredElement {
|
|
1231
|
+
constructor(props) {
|
|
1232
|
+
__privateAdd$1(this, _onUpdateCbs, []);
|
|
1233
|
+
this.props = {};
|
|
1234
|
+
this.shoutUpdates = () => {
|
|
1235
|
+
__privateGet$1(this, _onUpdateCbs).forEach((current) => current());
|
|
1236
|
+
};
|
|
1237
|
+
this.useProps = () => {
|
|
1238
|
+
const [props, setState] = useState(this.props);
|
|
1239
|
+
useMount(() => {
|
|
1240
|
+
setState(__spreadValues$6({}, this.props));
|
|
1241
|
+
return this.onUpdate(() => {
|
|
1242
|
+
setState(__spreadValues$6({}, this.props));
|
|
1243
|
+
});
|
|
1244
|
+
});
|
|
1245
|
+
return props;
|
|
1246
|
+
};
|
|
1247
|
+
this.props = props;
|
|
1248
|
+
}
|
|
1249
|
+
onUpdate(cb) {
|
|
1250
|
+
__privateGet$1(this, _onUpdateCbs).push(cb);
|
|
1251
|
+
return () => {
|
|
1252
|
+
__privateSet$1(this, _onUpdateCbs, __privateGet$1(this, _onUpdateCbs).filter((current) => current !== cb));
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
update(newProps) {
|
|
1256
|
+
const actualNewProps = isUpdater(newProps) ? newProps(this.props) : newProps;
|
|
1257
|
+
this.props = __spreadValues$6(__spreadValues$6({}, this.props), actualNewProps);
|
|
1258
|
+
this.shoutUpdates();
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
_onUpdateCbs = new WeakMap();
|
|
1262
|
+
class People extends BasicStoredElement {
|
|
1263
|
+
getId() {
|
|
1264
|
+
return this.props.name;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
const r = makeStatefulStore({
|
|
1268
|
+
people: People.prototype
|
|
1269
|
+
});
|
|
1270
|
+
r.actions.addPeople;
|
|
1271
|
+
r.actions.emptyPeople;
|
|
1272
|
+
r.actions.removePeople;
|
|
1273
|
+
r.hooks.usePeople;
|
|
1274
|
+
r.hooks.usePeopleById;
|
|
1275
|
+
r.hooks.usePeopleList;
|
|
1276
|
+
r.on.changePeople;
|
|
1277
|
+
r.on.changePeopleAmmount;
|
|
1278
|
+
r.on.changePeopleElement;
|
|
1279
|
+
r.state.getPeople;
|
|
1280
|
+
r.state.getPeopleState;
|
|
1281
|
+
r.state.updatePeople;
|
|
1282
|
+
function makeStatefulStore(entries, initialStates) {
|
|
1283
|
+
const hookUseState = {};
|
|
1284
|
+
const hookUseList = {};
|
|
1285
|
+
const hookUseStateById = {};
|
|
1286
|
+
const suscribeById = {};
|
|
1287
|
+
const suscribeToList = {};
|
|
1288
|
+
const suscribeToListCount = {};
|
|
1289
|
+
const addActions = {};
|
|
1290
|
+
const emptyActions = {};
|
|
1291
|
+
const removeActions = {};
|
|
1292
|
+
const getItemActions = {};
|
|
1293
|
+
const getStateActions = {};
|
|
1294
|
+
const updateItemActions = {};
|
|
1295
|
+
Object.keys(entries).forEach((name) => {
|
|
1296
|
+
const initialStateKey = `${upper(name)}State`;
|
|
1297
|
+
let store = {};
|
|
1298
|
+
const initialState = initialStates == null ? void 0 : initialStates[initialStateKey];
|
|
1299
|
+
initialState == null ? void 0 : initialState.forEach((current) => {
|
|
1300
|
+
store[current.getId()] = current;
|
|
1301
|
+
});
|
|
1302
|
+
let listStateChangeHandlers = [];
|
|
1303
|
+
function shoutListStateChange() {
|
|
1304
|
+
listStateChangeHandlers.forEach((current) => current());
|
|
1305
|
+
}
|
|
1306
|
+
const elementChangeHandlers = {};
|
|
1307
|
+
function shoutListElementChange(id) {
|
|
1308
|
+
var _a;
|
|
1309
|
+
(_a = elementChangeHandlers[id]) == null ? void 0 : _a.forEach((current) => current());
|
|
1310
|
+
}
|
|
1311
|
+
let listCountChangeHandlers = [];
|
|
1312
|
+
function shoutListCountChange() {
|
|
1313
|
+
listCountChangeHandlers.forEach((current) => current());
|
|
1314
|
+
}
|
|
1315
|
+
const onUpdateElementSuscriptions = {};
|
|
1316
|
+
const addKey = `add${upper(name)}`;
|
|
1317
|
+
addActions[addKey] = (newElement) => {
|
|
1318
|
+
let elId = newElement.getId();
|
|
1319
|
+
let lastProps = __spreadValues$6({}, newElement.props);
|
|
1320
|
+
store[elId] = newElement;
|
|
1321
|
+
const suscription = newElement.onUpdate(() => {
|
|
1322
|
+
const id = newElement.getId();
|
|
1323
|
+
if (id !== elId) {
|
|
1324
|
+
if (store[id]) {
|
|
1325
|
+
newElement.update(lastProps);
|
|
1326
|
+
throw new Error(
|
|
1327
|
+
`Cannot set new id ${id} because it already exists`
|
|
1328
|
+
);
|
|
1329
|
+
}
|
|
1330
|
+
delete store[elId];
|
|
1331
|
+
store[id] = newElement;
|
|
1332
|
+
elId = id;
|
|
1333
|
+
lastProps = newElement.props;
|
|
1334
|
+
}
|
|
1335
|
+
shoutListElementChange(id);
|
|
1336
|
+
shoutListStateChange();
|
|
1337
|
+
});
|
|
1338
|
+
onUpdateElementSuscriptions[newElement.getId()] = suscription;
|
|
1339
|
+
shoutListStateChange();
|
|
1340
|
+
shoutListCountChange();
|
|
1341
|
+
shoutListElementChange(elId);
|
|
1342
|
+
};
|
|
1343
|
+
const emptyKey = `empty${upper(name)}`;
|
|
1344
|
+
emptyActions[emptyKey] = () => {
|
|
1345
|
+
Object.values(onUpdateElementSuscriptions).forEach(
|
|
1346
|
+
(current) => current()
|
|
1347
|
+
);
|
|
1348
|
+
store = {};
|
|
1349
|
+
shoutListCountChange();
|
|
1350
|
+
shoutListStateChange();
|
|
1351
|
+
Object.keys(elementChangeHandlers).forEach(
|
|
1352
|
+
(current) => shoutListElementChange(current)
|
|
1353
|
+
);
|
|
1354
|
+
};
|
|
1355
|
+
const removeKey = `remove${upper(name)}`;
|
|
1356
|
+
removeActions[removeKey] = (id) => {
|
|
1357
|
+
var _a;
|
|
1358
|
+
(_a = onUpdateElementSuscriptions[id]) == null ? void 0 : _a.call(onUpdateElementSuscriptions);
|
|
1359
|
+
delete store[id];
|
|
1360
|
+
shoutListCountChange();
|
|
1361
|
+
shoutListStateChange();
|
|
1362
|
+
shoutListElementChange(id);
|
|
1363
|
+
};
|
|
1364
|
+
const getStateKey = `get${upper(name)}State`;
|
|
1365
|
+
getStateActions[getStateKey] = () => {
|
|
1366
|
+
return Object.values(store);
|
|
1367
|
+
};
|
|
1368
|
+
const getState = getStateActions[getStateKey];
|
|
1369
|
+
const getItemKey = `get${upper(name)}`;
|
|
1370
|
+
getItemActions[getItemKey] = (id) => {
|
|
1371
|
+
return store[id];
|
|
1372
|
+
};
|
|
1373
|
+
const updateItemKey = `update${upper(name)}`;
|
|
1374
|
+
updateItemActions[updateItemKey] = (id, newProps) => {
|
|
1375
|
+
store[id].update(newProps);
|
|
1376
|
+
};
|
|
1377
|
+
const hookUseStateKey = `use${upper(name)}`;
|
|
1378
|
+
hookUseState[hookUseStateKey] = () => {
|
|
1379
|
+
const [state2, setState] = useState(getState());
|
|
1380
|
+
useMount(() => {
|
|
1381
|
+
setState(getState());
|
|
1382
|
+
const eventHandler = () => {
|
|
1383
|
+
setState(getState());
|
|
1384
|
+
};
|
|
1385
|
+
listStateChangeHandlers.push(eventHandler);
|
|
1386
|
+
return () => {
|
|
1387
|
+
listStateChangeHandlers = listStateChangeHandlers.filter(
|
|
1388
|
+
(current) => current !== eventHandler
|
|
1389
|
+
);
|
|
1390
|
+
};
|
|
1391
|
+
});
|
|
1392
|
+
return state2;
|
|
1393
|
+
};
|
|
1394
|
+
const hookUseListKey = `use${upper(name)}List`;
|
|
1395
|
+
hookUseList[hookUseListKey] = () => {
|
|
1396
|
+
const [state2, setState] = useState(getState());
|
|
1397
|
+
useMount(() => {
|
|
1398
|
+
setState(getState());
|
|
1399
|
+
const eventHandler = () => {
|
|
1400
|
+
setState(getState());
|
|
1401
|
+
};
|
|
1402
|
+
listCountChangeHandlers.push(eventHandler);
|
|
1403
|
+
return () => {
|
|
1404
|
+
listCountChangeHandlers = listCountChangeHandlers.filter(
|
|
1405
|
+
(current) => current !== eventHandler
|
|
1406
|
+
);
|
|
1407
|
+
};
|
|
1408
|
+
});
|
|
1409
|
+
return state2;
|
|
1410
|
+
};
|
|
1411
|
+
const hookUseStateByIdKey = `use${upper(
|
|
1412
|
+
name
|
|
1413
|
+
)}ById`;
|
|
1414
|
+
hookUseStateById[hookUseStateByIdKey] = (id) => {
|
|
1415
|
+
const [state2, setState] = useState({ obj: store[id] });
|
|
1416
|
+
useMount(() => {
|
|
1417
|
+
setState({ obj: store[id] });
|
|
1418
|
+
const eventHandler = () => {
|
|
1419
|
+
setState({ obj: store[id] });
|
|
1420
|
+
};
|
|
1421
|
+
if (!elementChangeHandlers[id])
|
|
1422
|
+
elementChangeHandlers[id] = [];
|
|
1423
|
+
elementChangeHandlers[id].push(eventHandler);
|
|
1424
|
+
return () => {
|
|
1425
|
+
elementChangeHandlers[id] = elementChangeHandlers[id].filter(
|
|
1426
|
+
(current) => current !== eventHandler
|
|
1427
|
+
);
|
|
1428
|
+
};
|
|
1429
|
+
});
|
|
1430
|
+
return state2.obj;
|
|
1431
|
+
};
|
|
1432
|
+
const onChangeElementKey = `change${upper(
|
|
1433
|
+
name
|
|
1434
|
+
)}Element`;
|
|
1435
|
+
suscribeById[onChangeElementKey] = (id, cb) => {
|
|
1436
|
+
if (!elementChangeHandlers[id])
|
|
1437
|
+
elementChangeHandlers[id] = [];
|
|
1438
|
+
const innerCb = () => {
|
|
1439
|
+
cb(store[id]);
|
|
1440
|
+
};
|
|
1441
|
+
elementChangeHandlers[id].push(innerCb);
|
|
1442
|
+
return () => {
|
|
1443
|
+
elementChangeHandlers[id] = elementChangeHandlers[id].filter(
|
|
1444
|
+
(current) => current !== innerCb
|
|
1445
|
+
);
|
|
1446
|
+
};
|
|
1447
|
+
};
|
|
1448
|
+
const onChangeListKey = `change${upper(
|
|
1449
|
+
name
|
|
1450
|
+
)}`;
|
|
1451
|
+
suscribeToList[onChangeListKey] = (cb) => {
|
|
1452
|
+
const innerCb = () => {
|
|
1453
|
+
cb(getState());
|
|
1454
|
+
};
|
|
1455
|
+
listStateChangeHandlers.push(innerCb);
|
|
1456
|
+
return () => {
|
|
1457
|
+
listStateChangeHandlers = listStateChangeHandlers.filter(
|
|
1458
|
+
(current) => current !== innerCb
|
|
1459
|
+
);
|
|
1460
|
+
};
|
|
1461
|
+
};
|
|
1462
|
+
const onChangeListCountKey = `change${upper(
|
|
1463
|
+
name
|
|
1464
|
+
)}Ammount`;
|
|
1465
|
+
suscribeToListCount[onChangeListCountKey] = (cb) => {
|
|
1466
|
+
const innerCb = () => {
|
|
1467
|
+
cb(getState());
|
|
1468
|
+
};
|
|
1469
|
+
listCountChangeHandlers.push(innerCb);
|
|
1470
|
+
return () => {
|
|
1471
|
+
listCountChangeHandlers = listCountChangeHandlers.filter(
|
|
1472
|
+
(current) => current !== innerCb
|
|
1473
|
+
);
|
|
1474
|
+
};
|
|
1475
|
+
};
|
|
1476
|
+
});
|
|
1477
|
+
const actions = Object.assign(
|
|
1478
|
+
{},
|
|
1479
|
+
addActions,
|
|
1480
|
+
removeActions,
|
|
1481
|
+
emptyActions
|
|
1482
|
+
);
|
|
1483
|
+
const hooks = Object.assign({}, hookUseState, hookUseStateById, hookUseList);
|
|
1484
|
+
const on = Object.assign(
|
|
1485
|
+
{},
|
|
1486
|
+
suscribeById,
|
|
1487
|
+
suscribeToList,
|
|
1488
|
+
suscribeToListCount
|
|
1489
|
+
);
|
|
1490
|
+
const state = Object.assign(
|
|
1491
|
+
{},
|
|
1492
|
+
getStateActions,
|
|
1493
|
+
getItemActions,
|
|
1494
|
+
updateItemActions
|
|
1495
|
+
);
|
|
1496
|
+
return Object.assign(
|
|
1497
|
+
{},
|
|
1498
|
+
{ hooks },
|
|
1499
|
+
{ actions },
|
|
1500
|
+
{ state },
|
|
1501
|
+
{ on }
|
|
1502
|
+
);
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1068
1505
|
const persistentStorage = new Proxy(
|
|
1069
1506
|
{
|
|
1070
1507
|
remove(prop) {
|
|
@@ -1439,86 +1876,112 @@ const focus = new (_a = class {
|
|
|
1439
1876
|
});
|
|
1440
1877
|
}, _a)(document.getElementById("root"));
|
|
1441
1878
|
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1879
|
+
var __defProp$5 = Object.defineProperty;
|
|
1880
|
+
var __defProps$3 = Object.defineProperties;
|
|
1881
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1882
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1883
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1884
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1885
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1886
|
+
var __spreadValues$5 = (a, b) => {
|
|
1887
|
+
for (var prop in b || (b = {}))
|
|
1888
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
1889
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
1890
|
+
if (__getOwnPropSymbols$5)
|
|
1891
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1892
|
+
if (__propIsEnum$5.call(b, prop))
|
|
1893
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
1894
|
+
}
|
|
1895
|
+
return a;
|
|
1896
|
+
};
|
|
1897
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1898
|
+
class History extends EventEmitter {
|
|
1899
|
+
constructor(onCloseWindow, configuration = { maxLength: 100 }) {
|
|
1900
|
+
super();
|
|
1901
|
+
this.configuration = configuration;
|
|
1902
|
+
this.autocloseTimeout = -1;
|
|
1903
|
+
this.currentStep = 0;
|
|
1904
|
+
this.content = [];
|
|
1905
|
+
this.enabled = true;
|
|
1906
|
+
this._isOpen = false;
|
|
1907
|
+
this.timeoutMs = 350;
|
|
1908
|
+
this.closeWindow = () => {
|
|
1909
|
+
if (this._isOpen) {
|
|
1910
|
+
this.onCloseWindow(this.push.bind(this));
|
|
1911
|
+
this._isOpen = false;
|
|
1452
1912
|
}
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1913
|
+
};
|
|
1914
|
+
this.getEvent = () => {
|
|
1915
|
+
const stepCount = this.content.length - 1;
|
|
1916
|
+
const event = {
|
|
1917
|
+
content: this.content[this.currentStep],
|
|
1918
|
+
currentStep: this.currentStep,
|
|
1919
|
+
stepCount,
|
|
1920
|
+
hasNext: this.currentStep < stepCount,
|
|
1921
|
+
hasPrevious: this.currentStep >= 0
|
|
1922
|
+
};
|
|
1923
|
+
return event;
|
|
1924
|
+
};
|
|
1925
|
+
this.push = (el) => {
|
|
1926
|
+
this.content = [...this.content.slice(0, this.currentStep + 1), el];
|
|
1927
|
+
this.content = this.content.slice(
|
|
1928
|
+
Math.max(0, this.content.length - this.configuration.maxLength)
|
|
1469
1929
|
);
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
);
|
|
1473
|
-
};
|
|
1474
|
-
|
|
1475
|
-
function useLatest(value) {
|
|
1476
|
-
const ref = useRef(value);
|
|
1477
|
-
ref.current = value;
|
|
1478
|
-
return ref;
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
function useMount(effect) {
|
|
1482
|
-
const hasRun = useRef(false);
|
|
1483
|
-
useEffect(() => {
|
|
1484
|
-
if (!hasRun.current) {
|
|
1485
|
-
hasRun.current = true;
|
|
1486
|
-
return effect();
|
|
1487
|
-
}
|
|
1488
|
-
}, []);
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
function useUnmount(unmountCallback) {
|
|
1492
|
-
useEffect(() => {
|
|
1493
|
-
return unmountCallback;
|
|
1494
|
-
}, []);
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
function usePrevious(value) {
|
|
1498
|
-
const previousValue = useRef(void 0);
|
|
1499
|
-
const currentValue = useRef(void 0);
|
|
1500
|
-
previousValue.current = currentValue.current;
|
|
1501
|
-
currentValue.current = value;
|
|
1502
|
-
return previousValue;
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
function useStateRef(initialState) {
|
|
1506
|
-
const [state, setState] = useState(initialState);
|
|
1507
|
-
const stateRef = useRef(state);
|
|
1508
|
-
stateRef.current = state;
|
|
1509
|
-
return [state, setState, stateRef];
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
function useUpdateEffect(effect, deps) {
|
|
1513
|
-
const hasRunnedForFirstTime = useRef(false);
|
|
1514
|
-
useEffect(() => {
|
|
1515
|
-
if (hasRunnedForFirstTime.current) {
|
|
1516
|
-
return effect();
|
|
1517
|
-
}
|
|
1518
|
-
hasRunnedForFirstTime.current = true;
|
|
1519
|
-
return () => {
|
|
1930
|
+
this.currentStep = this.content.length - 1;
|
|
1931
|
+
this.shoutStepChange(true);
|
|
1520
1932
|
};
|
|
1521
|
-
|
|
1933
|
+
this.shoutStepChange = (fromPush) => {
|
|
1934
|
+
try {
|
|
1935
|
+
this.emit("stepChange", __spreadProps$3(__spreadValues$5({}, this.getEvent()), { fromPush }));
|
|
1936
|
+
} catch (e) {
|
|
1937
|
+
console.error(e);
|
|
1938
|
+
}
|
|
1939
|
+
};
|
|
1940
|
+
this.hooks = {
|
|
1941
|
+
useCountChange: (onChange) => {
|
|
1942
|
+
useMount(() => {
|
|
1943
|
+
onChange(this.getEvent());
|
|
1944
|
+
this.on("stepChange", () => {
|
|
1945
|
+
onChange(this.getEvent());
|
|
1946
|
+
});
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
};
|
|
1950
|
+
this.back = () => {
|
|
1951
|
+
if (this.currentStep >= 0) {
|
|
1952
|
+
this.currentStep -= 1;
|
|
1953
|
+
this.shoutStepChange();
|
|
1954
|
+
}
|
|
1955
|
+
};
|
|
1956
|
+
this.disable = () => {
|
|
1957
|
+
this.enabled = false;
|
|
1958
|
+
};
|
|
1959
|
+
this.enable = () => {
|
|
1960
|
+
this.enabled = true;
|
|
1961
|
+
};
|
|
1962
|
+
this.forward = () => {
|
|
1963
|
+
if (this.currentStep < this.content.length - 1) {
|
|
1964
|
+
this.currentStep += 1;
|
|
1965
|
+
this.shoutStepChange();
|
|
1966
|
+
}
|
|
1967
|
+
};
|
|
1968
|
+
this.openWindow = () => {
|
|
1969
|
+
if (!this.enabled)
|
|
1970
|
+
return;
|
|
1971
|
+
this._isOpen = true;
|
|
1972
|
+
clearTimeout(this.autocloseTimeout);
|
|
1973
|
+
this.autocloseTimeout = setTimeout(() => {
|
|
1974
|
+
this.closeWindow();
|
|
1975
|
+
}, this.timeoutMs);
|
|
1976
|
+
};
|
|
1977
|
+
this.updateConfig = (newConfiguration) => {
|
|
1978
|
+
this.configuration = __spreadValues$5(__spreadValues$5({}, this.configuration), newConfiguration);
|
|
1979
|
+
};
|
|
1980
|
+
this.onCloseWindow = onCloseWindow;
|
|
1981
|
+
}
|
|
1982
|
+
get isOpen() {
|
|
1983
|
+
return this._isOpen;
|
|
1984
|
+
}
|
|
1522
1985
|
}
|
|
1523
1986
|
|
|
1524
1987
|
const ImperativeComponentContext = createContext(
|
|
@@ -2193,4 +2656,4 @@ const parseXmlAsync = (xml) => __async(void 0, null, function* () {
|
|
|
2193
2656
|
return result;
|
|
2194
2657
|
});
|
|
2195
2658
|
|
|
2196
|
-
export { EventEmitter, HashedEventEmitter, PropsSelectorUndefinedObject, PropsStore, Url, WithEventsValue, addBoundary, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, cantFocusSelector, customEvents, dateToApiaFormat, debugDispatcher, decrypt, disableChildrenFocus, downloadUrl, enableChildrenFocus, enableDebugDispatcher, encrypt, eventEmitterBaseFunction, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, getDateFormat, getFocusSelector, getIndex, getLabel, getSpecificParent, getValueByPath, globalFocus, isChild, isDebugDispatcherEnabled, isPropsConfigurationObject, makeImperativeComponent, makeSingleImperativeComponent, noNaN, notificationsSelector, parseAsSize, parseXmlAsync, persistentStorage, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shortcutController, toBoolean, ucfirst, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useLatest, useLocalStorage, useMount, usePanAndZoom, usePrevious, usePropsSelector, useStateRef, useUnmount, useUpdateEffect };
|
|
2659
|
+
export { BasicStoredElement, EventEmitter, HashedEventEmitter, History, PropsSelectorUndefinedObject, PropsStore, Url, WithEventsValue, addBoundary, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, cantFocusSelector, customEvents, dateToApiaFormat, debugDispatcher, decrypt, disableChildrenFocus, downloadUrl, enableChildrenFocus, enableDebugDispatcher, encrypt, eventEmitterBaseFunction, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, getDateFormat, getFocusSelector, getIndex, getLabel, getSpecificParent, getValueByPath, globalFocus, isChild, isDebugDispatcherEnabled, isPropsConfigurationObject, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, parseAsSize, parseXmlAsync, persistentStorage, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useLatest, useLocalStorage, useMount, usePanAndZoom, usePrevious, usePropsSelector, useShallowMemo, useStateRef, useUnmount, useUpdateEffect };
|