chayns-api 1.0.0 → 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/dist/cjs/bootstrap.js +11 -0
- package/dist/cjs/calls/abstractApiListener.js +40 -0
- package/dist/cjs/calls/apiEventListener.js +40 -0
- package/dist/cjs/calls/dialogs/alert.js +2 -0
- package/dist/cjs/calls/dialogs/chaynsDialog.js +8 -2
- package/dist/cjs/calls/dialogs/close.js +2 -0
- package/dist/cjs/calls/dialogs/communication.js +16 -1
- package/dist/cjs/calls/dialogs/confirm.js +4 -0
- package/dist/cjs/calls/dialogs/date.js +53 -36
- package/dist/cjs/calls/dialogs/dropUpAlert.js +3 -0
- package/dist/cjs/calls/dialogs/fileSelect.js +10 -0
- package/dist/cjs/calls/dialogs/iFrame.js +8 -0
- package/dist/cjs/calls/dialogs/index.js +27 -0
- package/dist/cjs/calls/dialogs/input.js +6 -0
- package/dist/cjs/calls/dialogs/mediaSelect.js +7 -0
- package/dist/cjs/calls/dialogs/open.js +2 -0
- package/dist/cjs/calls/dialogs/select.js +9 -0
- package/dist/cjs/calls/dialogs/signature.js +5 -0
- package/dist/cjs/calls/dialogs/toast.js +3 -0
- package/dist/cjs/calls/dialogs/utils/callback.js +2 -0
- package/dist/cjs/calls/dialogs/utils/is.js +4 -0
- package/dist/cjs/calls/getUserInfo.js +11 -0
- package/dist/cjs/calls/index.js +155 -3
- package/dist/cjs/calls/sendMessage.js +26 -0
- package/dist/cjs/calls/setVisibilityChangeListener.js +1 -0
- package/dist/cjs/calls/visibilityChangeListener.js +12 -1
- package/dist/cjs/calls/windowMetricsListener.js +18 -0
- package/dist/cjs/components/App.js +32 -0
- package/dist/cjs/components/App.spec.js +16 -0
- package/dist/cjs/components/Button.js +32 -0
- package/dist/cjs/components/ChaynsContext.js +4 -2
- package/dist/cjs/components/ChaynsProvider.js +28 -6
- package/dist/cjs/components/ChaynsProviderExposed.js +16 -0
- package/dist/cjs/components/TestProvider.js +236 -0
- package/dist/cjs/components/Title.js +162 -0
- package/dist/cjs/components/WaitUntil.js +5 -0
- package/dist/cjs/components/withCompatMode.js +16 -1
- package/dist/cjs/functions/addApiListener.js +37 -0
- package/dist/cjs/functions/addGeoLocationListener.js +26 -0
- package/dist/cjs/functions/addScrollListener.js +26 -0
- package/dist/cjs/functions/addWindowMetricsListener.js +37 -0
- package/dist/cjs/helper/apiListenerHelper.js +9 -0
- package/dist/cjs/helper/cssLoader.js +28 -0
- package/dist/cjs/hooks/addGeoLocationListener.js +26 -0
- package/dist/cjs/hooks/addScrollListener.js +26 -0
- package/dist/cjs/hooks/addWindowMetricsListener.js +37 -0
- package/dist/cjs/hooks/geoLocation.js +48 -0
- package/dist/cjs/hooks/geoLocationListener.js +11 -2
- package/dist/cjs/hooks/index.js +16 -0
- package/dist/cjs/hooks/scrollListener.js +23 -4
- package/dist/cjs/hooks/useAccessToken.js +5 -0
- package/dist/cjs/hooks/useAddGeoLocationListener.js +26 -0
- package/dist/cjs/hooks/useAddScrollListener.js +48 -0
- package/dist/cjs/hooks/useAddWindowMetricsListener.js +45 -0
- package/dist/cjs/hooks/useAdddScrollListener.js +26 -0
- package/dist/cjs/hooks/useCurrentPage.js +4 -0
- package/dist/cjs/hooks/useCustomData.js +4 -0
- package/dist/cjs/hooks/useDevice.js +4 -0
- package/dist/cjs/hooks/useEnvironment.js +4 -0
- package/dist/cjs/hooks/useFunctions.js +4 -0
- package/dist/cjs/hooks/useIsAdminMode.js +5 -0
- package/dist/cjs/hooks/useLanguage.js +4 -0
- package/dist/cjs/hooks/usePages.js +12 -0
- package/dist/cjs/hooks/useParameters.js +4 -0
- package/dist/cjs/hooks/useSite.js +4 -0
- package/dist/cjs/hooks/useUser.js +4 -0
- package/dist/cjs/hooks/useValues.js +4 -0
- package/dist/cjs/hooks/windowMetrics.js +45 -0
- package/dist/cjs/hooks/windowMetricsListener.js +12 -2
- package/dist/cjs/host/ChaynsHost.js +12 -0
- package/dist/cjs/host/{module/PagemakerFrame.js → HostIframe.js} +75 -23
- package/dist/cjs/host/ModuleHost.js +11 -0
- package/dist/cjs/host/iframe/HostIframe.js +30 -23
- package/dist/cjs/host/iframe/utils/useUpdateData.js +3 -0
- package/dist/cjs/host/module/ModuleHost.js +13 -3
- package/dist/cjs/host/module/utils/loadComponent.js +18 -1
- package/dist/cjs/host/module/utils/useDynamicScript.js +18 -0
- package/dist/cjs/host/module/utils.js +25 -0
- package/dist/cjs/index.example.js +7 -0
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/index2.js +64 -0
- package/dist/cjs/types/DynamicImport.d.js +5 -0
- package/dist/cjs/types/IChaynsReact.js +47 -0
- package/dist/cjs/types/chayns-components.d.js +1 -0
- package/dist/cjs/types/chayns-logger.d.js +1 -0
- package/dist/cjs/types/chayns.d.js +1 -0
- package/dist/cjs/types/tobit-websocket-service-client.d.js +1 -0
- package/dist/cjs/types/toolkit-types.d.js +1 -0
- package/dist/cjs/util/appCall.js +4 -1
- package/dist/cjs/util/deviceHelper.js +17 -2
- package/dist/cjs/util/heightHelper.js +9 -0
- package/dist/cjs/util/postIframeForm.js +5 -0
- package/dist/cjs/util/useFunctionsContext.js +16 -0
- package/dist/cjs/util/useIsAdminMode.js +18 -0
- package/dist/cjs/util/useUser.js +16 -0
- package/dist/cjs/wrapper/AppWrapper.js +144 -119
- package/dist/cjs/wrapper/FrameWrapper.js +248 -215
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +27 -2
- package/dist/cjs/wrapper/SsrWrapper.js +8 -0
- package/dist/esm/bootstrap.js +4 -0
- package/dist/esm/calls/dialogs/alert.js +4 -4
- package/dist/esm/calls/dialogs/chaynsDialog.js +11 -7
- package/dist/esm/calls/dialogs/communication.js +26 -15
- package/dist/esm/calls/dialogs/confirm.js +8 -5
- package/dist/esm/calls/dialogs/date.js +94 -85
- package/dist/esm/calls/dialogs/dropUpAlert.js +1 -1
- package/dist/esm/calls/dialogs/fileSelect.js +62 -23
- package/dist/esm/calls/dialogs/iFrame.js +10 -7
- package/dist/esm/calls/dialogs/input.js +5 -2
- package/dist/esm/calls/dialogs/mediaSelect.js +55 -18
- package/dist/esm/calls/dialogs/open.js +2 -2
- package/dist/esm/calls/dialogs/select.js +9 -5
- package/dist/esm/calls/dialogs/signature.js +2 -0
- package/dist/esm/calls/dialogs/toast.js +11 -6
- package/dist/esm/calls/dialogs/utils/callback.js +5 -3
- package/dist/esm/calls/dialogs/utils/is.js +3 -1
- package/dist/esm/calls/getUserInfo.js +92 -32
- package/dist/esm/calls/index.js +276 -124
- package/dist/esm/calls/sendMessage.js +221 -91
- package/dist/esm/calls/visibilityChangeListener.js +15 -10
- package/dist/esm/components/App.js +35 -0
- package/dist/esm/components/App.spec.js +9 -0
- package/dist/esm/components/Button.js +34 -0
- package/dist/esm/components/ChaynsContext.js +3 -3
- package/dist/esm/components/ChaynsProvider.js +86 -45
- package/dist/esm/components/ChaynsProviderExposed.js +3 -0
- package/dist/esm/components/TestProvider.js +308 -0
- package/dist/esm/components/Title.js +210 -0
- package/dist/esm/components/WaitUntil.js +86 -21
- package/dist/esm/components/withCompatMode.js +77 -35
- package/dist/esm/helper/apiListenerHelper.js +15 -10
- package/dist/esm/helper/cssLoader.js +21 -0
- package/dist/esm/hooks/geoLocationListener.js +46 -20
- package/dist/esm/hooks/scrollListener.js +86 -50
- package/dist/esm/hooks/useAccessToken.js +28 -6
- package/dist/esm/hooks/useAddGeoLocationListener.js +18 -0
- package/dist/esm/hooks/useAddScrollListener.js +18 -0
- package/dist/esm/hooks/useAddWindowMetricsListener.js +18 -0
- package/dist/esm/hooks/useCurrentPage.js +6 -2
- package/dist/esm/hooks/useCustomData.js +6 -2
- package/dist/esm/hooks/useDevice.js +6 -1
- package/dist/esm/hooks/useEnvironment.js +6 -1
- package/dist/esm/hooks/useFunctions.js +5 -2
- package/dist/esm/hooks/useIsAdminMode.js +6 -2
- package/dist/esm/hooks/useLanguage.js +6 -1
- package/dist/esm/hooks/usePages.js +27 -14
- package/dist/esm/hooks/useParameters.js +6 -1
- package/dist/esm/hooks/useSite.js +6 -1
- package/dist/esm/hooks/useUser.js +6 -1
- package/dist/esm/hooks/useValues.js +5 -2
- package/dist/esm/hooks/windowMetricsListener.js +44 -18
- package/dist/esm/host/ChaynsHost.js +30 -21
- package/dist/esm/host/HostIframe.js +153 -0
- package/dist/esm/host/iframe/HostIframe.js +142 -86
- package/dist/esm/host/iframe/utils/useUpdateData.js +6 -4
- package/dist/esm/host/module/ModuleHost.js +49 -42
- package/dist/esm/host/module/utils/loadComponent.js +85 -47
- package/dist/esm/host/module/utils/useDynamicScript.js +74 -27
- package/dist/esm/index.example.js +1 -0
- package/dist/esm/index2.js +5 -0
- package/dist/esm/types/DynamicImport.d.js +1 -0
- package/dist/esm/types/IChaynsReact.js +61 -14
- package/dist/esm/types/chayns-components.d.js +0 -0
- package/dist/esm/types/chayns-logger.d.js +0 -0
- package/dist/esm/types/chayns.d.js +0 -0
- package/dist/esm/types/tobit-websocket-service-client.d.js +0 -0
- package/dist/esm/types/toolkit-types.d.js +0 -0
- package/dist/esm/util/appCall.js +4 -2
- package/dist/esm/util/deviceHelper.js +33 -11
- package/dist/esm/util/heightHelper.js +13 -10
- package/dist/esm/util/postIframeForm.js +57 -25
- package/dist/esm/util/useIsAdminMode.js +9 -0
- package/dist/esm/util/useUser.js +7 -0
- package/dist/esm/wrapper/AppWrapper.js +762 -179
- package/dist/esm/wrapper/FrameWrapper.js +1509 -258
- package/dist/esm/wrapper/ModuleFederationWrapper.js +284 -47
- package/dist/esm/wrapper/SsrWrapper.js +65 -19
- package/dist/types/bootstrap.d.ts +1 -0
- package/dist/types/calls/dialogs/confirm.d.ts +1 -1
- package/dist/types/calls/dialogs/date.d.ts +4 -4
- package/dist/types/calls/dialogs/dropUpAlert.d.ts +1 -1
- package/dist/types/calls/dialogs/fileSelect.d.ts +1 -1
- package/dist/types/calls/dialogs/iFrame.d.ts +1 -1
- package/dist/types/calls/dialogs/input.d.ts +1 -1
- package/dist/types/calls/dialogs/mediaSelect.d.ts +1 -1
- package/dist/types/calls/dialogs/signature.d.ts +1 -1
- package/dist/types/components/App.d.ts +5 -0
- package/dist/types/components/Button.d.ts +8 -0
- package/dist/types/components/ChaynsProvider.d.ts +1 -1
- package/dist/types/components/ChaynsProviderExposed.d.ts +13 -0
- package/dist/types/components/Title.d.ts +3 -0
- package/dist/types/components/WaitUntil.d.ts +1 -1
- package/dist/types/components/withCompatMode.d.ts +1 -1
- package/dist/types/hooks/useAccessToken.d.ts +1 -1
- package/dist/types/host/ChaynsHost.d.ts +2 -1
- package/dist/types/host/{module/PagemakerFrame.d.ts → HostIframe.d.ts} +5 -7
- package/dist/types/host/iframe/HostIframe.d.ts +1 -1
- package/dist/types/host/module/ModuleHost.d.ts +2 -2
- package/dist/types/index.example.d.ts +0 -0
- package/dist/types/types/IChaynsReact.d.ts +14 -14
- package/package.json +1 -1
- package/dist/cjs/calls/dialogs/utils/environment.js +0 -10
- package/dist/esm/calls/dialogs/utils/environment.js +0 -3
- package/dist/esm/host/module/PagemakerFrame.js +0 -97
- package/dist/types/calls/dialogs/utils/environment.d.ts +0 -3
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = _interopRequireDefault(require("react"));
|
|
4
|
+
|
|
5
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
6
|
+
|
|
7
|
+
var _App = _interopRequireDefault(require("./components/App"));
|
|
8
|
+
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
|
|
11
|
+
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_App.default, null), document.querySelector('#root'));
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
|
|
10
|
+
class ApiEventListener {
|
|
11
|
+
constructor() {
|
|
12
|
+
_defineProperty(this, "counter", 0);
|
|
13
|
+
|
|
14
|
+
_defineProperty(this, "listenerMapping", {});
|
|
15
|
+
|
|
16
|
+
_defineProperty(this, "addEventListener", callback => {
|
|
17
|
+
if (Object.keys(this.listenerMapping).length === 0) {
|
|
18
|
+
this.initializeListener();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const id = ++this.counter;
|
|
22
|
+
this.listenerMapping[id] = callback;
|
|
23
|
+
return Promise.resolve(id);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
_defineProperty(this, "removeEventListener", id => {
|
|
27
|
+
delete this.listenerMapping[id];
|
|
28
|
+
|
|
29
|
+
if (Object.keys(this.listenerMapping).length === 0) {
|
|
30
|
+
this.cleanupListener();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return Promise.resolve();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var _default = ApiEventListener;
|
|
40
|
+
exports.default = _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
|
|
10
|
+
class ApiEventListener {
|
|
11
|
+
constructor() {
|
|
12
|
+
_defineProperty(this, "counter", 0);
|
|
13
|
+
|
|
14
|
+
_defineProperty(this, "listenerMapping", {});
|
|
15
|
+
|
|
16
|
+
_defineProperty(this, "addEventListener", callback => {
|
|
17
|
+
if (Object.keys(this.listenerMapping).length === 0) {
|
|
18
|
+
this.initializeListener();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const id = ++this.counter;
|
|
22
|
+
this.listenerMapping[id] = callback;
|
|
23
|
+
return Promise.resolve(id);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
_defineProperty(this, "removeEventListener", id => {
|
|
27
|
+
delete this.listenerMapping[id];
|
|
28
|
+
|
|
29
|
+
if (Object.keys(this.listenerMapping).length === 0) {
|
|
30
|
+
this.cleanupListener();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return Promise.resolve();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var _default = ApiEventListener;
|
|
40
|
+
exports.default = _default;
|
|
@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.buttonType = exports.buttonText = void 0;
|
|
7
7
|
exports.chaynsDialog = chaynsDialog;
|
|
8
8
|
exports.dialogAction = void 0;
|
|
9
|
+
|
|
9
10
|
var _open = require("./open");
|
|
11
|
+
|
|
10
12
|
var _callback = require("./utils/callback");
|
|
13
|
+
|
|
11
14
|
const buttonText = {
|
|
12
15
|
'YES': {
|
|
13
16
|
'de': 'Ja',
|
|
@@ -47,13 +50,16 @@ const dialogAction = {
|
|
|
47
50
|
'IFRAME': 191
|
|
48
51
|
};
|
|
49
52
|
exports.dialogAction = dialogAction;
|
|
53
|
+
|
|
50
54
|
function chaynsDialog(config) {
|
|
51
55
|
const callbackName = 'chaynsDialog';
|
|
52
56
|
config.callback = (0, _callback.getCallbackName)(callbackName);
|
|
57
|
+
|
|
53
58
|
if (config.dialog) {
|
|
54
|
-
config.dialog.callType = dialogAction.ALERT_CONFIRM;
|
|
55
|
-
|
|
59
|
+
config.dialog.callType = dialogAction.ALERT_CONFIRM; // @ts-ignore
|
|
60
|
+
|
|
56
61
|
return (0, _open.open)(config.dialog).then(data => Promise.resolve(data.selection ? data : data.buttonType));
|
|
57
62
|
}
|
|
63
|
+
|
|
58
64
|
return "unsupported";
|
|
59
65
|
}
|
|
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.addDialogDataListener = addDialogDataListener;
|
|
7
7
|
exports.removeDialogDataListener = removeDialogDataListener;
|
|
8
8
|
exports.sendData = sendData;
|
|
9
|
+
|
|
9
10
|
var _index = require("../index");
|
|
10
|
-
// @ts-nocheck
|
|
11
11
|
|
|
12
|
+
// @ts-nocheck
|
|
12
13
|
function sendData(data, isApiEvent) {
|
|
13
14
|
return (0, _index.invokeDialogCall)({
|
|
14
15
|
action: 218,
|
|
@@ -18,17 +19,22 @@ function sendData(data, isApiEvent) {
|
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
}
|
|
22
|
+
|
|
21
23
|
const listeners = [];
|
|
22
24
|
const apiListeners = [];
|
|
25
|
+
|
|
23
26
|
function _dialogDataListener(e = {}) {
|
|
24
27
|
if (!e.data || !e.data.action && typeof e.data !== 'string') {
|
|
25
28
|
return;
|
|
26
29
|
}
|
|
30
|
+
|
|
27
31
|
const messageObj = e.data.action ? e.data : JSON.parse(e.data.match(/(\{(?:.*)\})/)[0]);
|
|
32
|
+
|
|
28
33
|
if (messageObj.action === 218) {
|
|
29
34
|
const {
|
|
30
35
|
data
|
|
31
36
|
} = messageObj.value;
|
|
37
|
+
|
|
32
38
|
if (messageObj.value.isApiEvent) {
|
|
33
39
|
apiListeners.forEach(listener => {
|
|
34
40
|
listener(data);
|
|
@@ -40,32 +46,41 @@ function _dialogDataListener(e = {}) {
|
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
48
|
}
|
|
49
|
+
|
|
43
50
|
function addDialogDataListener(callback, getApiEvents = false) {
|
|
44
51
|
if (listeners.length === 0 || apiListeners.length === 0) {
|
|
45
52
|
window.addEventListener('message', _dialogDataListener);
|
|
46
53
|
}
|
|
54
|
+
|
|
47
55
|
if (getApiEvents) {
|
|
48
56
|
apiListeners.push(callback);
|
|
49
57
|
} else {
|
|
50
58
|
listeners.push(callback);
|
|
51
59
|
}
|
|
60
|
+
|
|
52
61
|
return true;
|
|
53
62
|
}
|
|
63
|
+
|
|
54
64
|
function removeDialogDataListener(callback, getApiEvents = false) {
|
|
55
65
|
let index;
|
|
66
|
+
|
|
56
67
|
if (getApiEvents) {
|
|
57
68
|
index = apiListeners.indexOf(callback);
|
|
69
|
+
|
|
58
70
|
if (index !== -1) {
|
|
59
71
|
apiListeners.splice(index, 1);
|
|
60
72
|
}
|
|
61
73
|
} else {
|
|
62
74
|
index = listeners.indexOf(callback);
|
|
75
|
+
|
|
63
76
|
if (index !== -1) {
|
|
64
77
|
listeners.splice(index, 1);
|
|
65
78
|
}
|
|
66
79
|
}
|
|
80
|
+
|
|
67
81
|
if (listeners.length === 0 && apiListeners.length === 0) {
|
|
68
82
|
window.removeEventListener('message', _dialogDataListener);
|
|
69
83
|
}
|
|
84
|
+
|
|
70
85
|
return index !== -1;
|
|
71
86
|
}
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.confirm = confirm;
|
|
7
|
+
|
|
7
8
|
var _chaynsDialog = require("./chaynsDialog");
|
|
9
|
+
|
|
8
10
|
function confirm(title = '', message = '', config = {}) {
|
|
9
11
|
// backward compatibility
|
|
10
12
|
if (Array.isArray(config)) {
|
|
@@ -12,6 +14,7 @@ function confirm(title = '', message = '', config = {}) {
|
|
|
12
14
|
'buttons': config
|
|
13
15
|
};
|
|
14
16
|
}
|
|
17
|
+
|
|
15
18
|
if (!config.buttons || !Array.isArray(config.buttons)) {
|
|
16
19
|
config.buttons = [{
|
|
17
20
|
'text': _chaynsDialog.buttonText.YES,
|
|
@@ -21,6 +24,7 @@ function confirm(title = '', message = '', config = {}) {
|
|
|
21
24
|
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
22
25
|
}];
|
|
23
26
|
}
|
|
27
|
+
|
|
24
28
|
return (0, _chaynsDialog.chaynsDialog)({
|
|
25
29
|
'dialog': {
|
|
26
30
|
title,
|
|
@@ -6,32 +6,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.advancedDate = advancedDate;
|
|
7
7
|
exports.date = date;
|
|
8
8
|
exports.dateType = void 0;
|
|
9
|
+
|
|
9
10
|
var _chaynsDialog = require("./chaynsDialog");
|
|
11
|
+
|
|
10
12
|
var _is = require("./utils/is");
|
|
13
|
+
|
|
11
14
|
var _open = require("./open");
|
|
15
|
+
|
|
12
16
|
var _index = require("../index");
|
|
17
|
+
|
|
13
18
|
function date(config = {}) {
|
|
14
19
|
let {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// This will fix the iOS problem with not preselectedDate without user interaction. That it return the wrog time.
|
|
20
|
+
preSelect,
|
|
21
|
+
minDate,
|
|
22
|
+
maxDate,
|
|
23
|
+
title,
|
|
24
|
+
message,
|
|
25
|
+
minuteInterval,
|
|
26
|
+
autoSelectDate
|
|
27
|
+
} = config,
|
|
28
|
+
type = config.dateType || dateType.DATE; // This will fix the iOS problem with not preselectedDate without user interaction. That it return the wrog time.
|
|
29
|
+
|
|
26
30
|
const {
|
|
27
31
|
os,
|
|
28
32
|
app
|
|
29
33
|
} = (0, _index.getDevice)();
|
|
34
|
+
|
|
30
35
|
if (minuteInterval && minuteInterval > 1 && os === 'iOS' && app) {
|
|
31
36
|
preSelect = roundInterval(preSelect, minuteInterval);
|
|
32
37
|
} else {
|
|
33
38
|
preSelect = validateValue(preSelect);
|
|
34
39
|
}
|
|
40
|
+
|
|
35
41
|
minDate = validateValue(minDate);
|
|
36
42
|
maxDate = validateValue(maxDate);
|
|
37
43
|
let buttons = [];
|
|
@@ -55,30 +61,31 @@ function date(config = {}) {
|
|
|
55
61
|
return Promise.resolve(data.selectedDate);
|
|
56
62
|
});
|
|
57
63
|
}
|
|
64
|
+
|
|
58
65
|
function advancedDate(config = {}) {
|
|
59
66
|
let {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
preSelect,
|
|
68
|
+
minDate,
|
|
69
|
+
maxDate,
|
|
70
|
+
title,
|
|
71
|
+
message,
|
|
72
|
+
minuteInterval,
|
|
73
|
+
buttons,
|
|
74
|
+
multiselect,
|
|
75
|
+
disabledDates,
|
|
76
|
+
textBlocks,
|
|
77
|
+
monthSelect,
|
|
78
|
+
yearSelect,
|
|
79
|
+
interval,
|
|
80
|
+
maxInterval,
|
|
81
|
+
minInterval,
|
|
82
|
+
disabledIntervals,
|
|
83
|
+
disabledWeekDayIntervals,
|
|
84
|
+
getLocalTime,
|
|
85
|
+
autoSelectDate
|
|
86
|
+
} = config,
|
|
87
|
+
// minInterval and maxInterval in minutes
|
|
88
|
+
type = config.dateType || dateType.DATE;
|
|
82
89
|
minDate = validateValue(minDate);
|
|
83
90
|
maxDate = validateValue(maxDate);
|
|
84
91
|
const {
|
|
@@ -86,6 +93,7 @@ function advancedDate(config = {}) {
|
|
|
86
93
|
app
|
|
87
94
|
} = (0, _index.getDevice)();
|
|
88
95
|
if (!preSelect) preSelect = {};
|
|
96
|
+
|
|
89
97
|
if (Array.isArray(preSelect)) {
|
|
90
98
|
preSelect = preSelect.map(p => validateValue(p));
|
|
91
99
|
} else if ((0, _is.isObject)(preSelect)) {
|
|
@@ -105,15 +113,18 @@ function advancedDate(config = {}) {
|
|
|
105
113
|
preSelect = validateValue(preSelect);
|
|
106
114
|
}
|
|
107
115
|
}
|
|
116
|
+
|
|
108
117
|
if (Array.isArray(disabledDates)) {
|
|
109
118
|
disabledDates = disabledDates.map(d => validateValue(d));
|
|
110
119
|
}
|
|
120
|
+
|
|
111
121
|
if (!buttons || !Array.isArray(buttons)) {
|
|
112
122
|
buttons = [{
|
|
113
123
|
'text': _chaynsDialog.buttonText.OK,
|
|
114
124
|
'buttonType': _chaynsDialog.buttonType.POSITIVE
|
|
115
125
|
}];
|
|
116
126
|
}
|
|
127
|
+
|
|
117
128
|
return (0, _open.open)({
|
|
118
129
|
'callType': _chaynsDialog.dialogAction.ADVANCED_DATE,
|
|
119
130
|
type,
|
|
@@ -141,7 +152,6 @@ function advancedDate(config = {}) {
|
|
|
141
152
|
return Promise.resolve(data);
|
|
142
153
|
});
|
|
143
154
|
}
|
|
144
|
-
|
|
145
155
|
/**
|
|
146
156
|
* @typedef {number} dateDialogType
|
|
147
157
|
*/
|
|
@@ -155,22 +165,28 @@ function advancedDate(config = {}) {
|
|
|
155
165
|
* @enum {dateDialogType}
|
|
156
166
|
* @type {{DATE: number, TIME: number, DATE_TIME: number}}
|
|
157
167
|
*/
|
|
168
|
+
|
|
169
|
+
|
|
158
170
|
const dateType = {
|
|
159
171
|
'DATE': 1,
|
|
160
172
|
'TIME': 2,
|
|
161
173
|
'DATE_TIME': 3
|
|
162
174
|
};
|
|
163
175
|
exports.dateType = dateType;
|
|
176
|
+
|
|
164
177
|
function validateValue(value) {
|
|
165
178
|
if (!(0, _is.isNumber)(value)) {
|
|
166
179
|
if ((0, _is.isDate)(value)) {
|
|
167
180
|
// TODO: Find out whats the purpose of parsing to int
|
|
168
181
|
return parseInt(value.getTime() / 1000 + "", 10);
|
|
169
182
|
}
|
|
183
|
+
|
|
170
184
|
return undefined;
|
|
171
185
|
}
|
|
186
|
+
|
|
172
187
|
return value;
|
|
173
188
|
}
|
|
189
|
+
|
|
174
190
|
function roundInterval(preDate = new Date(), interval) {
|
|
175
191
|
if (!(0, _is.isDate)(preDate)) {
|
|
176
192
|
if ((0, _is.isNumber)(preDate)) {
|
|
@@ -179,9 +195,10 @@ function roundInterval(preDate = new Date(), interval) {
|
|
|
179
195
|
return -1;
|
|
180
196
|
}
|
|
181
197
|
}
|
|
198
|
+
|
|
182
199
|
let minutes = preDate.getMinutes();
|
|
183
200
|
preDate.setMinutes(minutes - minutes % interval);
|
|
184
|
-
preDate.setSeconds(0);
|
|
185
|
-
|
|
201
|
+
preDate.setSeconds(0); // TODO: Why?
|
|
202
|
+
|
|
186
203
|
return parseInt(preDate.getTime() / 1000 + "", 10);
|
|
187
204
|
}
|
|
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.dropUpAlert = dropUpAlert;
|
|
7
|
+
|
|
7
8
|
var _open = require("./open");
|
|
9
|
+
|
|
8
10
|
var _chaynsDialog = require("./chaynsDialog");
|
|
11
|
+
|
|
9
12
|
function dropUpAlert(dialog = {}) {
|
|
10
13
|
dialog.callType = _chaynsDialog.dialogAction.DROP_UP_ALERT;
|
|
11
14
|
return (0, _open.open)(dialog);
|
|
@@ -5,9 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.fileSelect = fileSelect;
|
|
7
7
|
exports.fileType = void 0;
|
|
8
|
+
|
|
8
9
|
var _chaynsDialog = require("./chaynsDialog");
|
|
10
|
+
|
|
9
11
|
var _open = require("./open");
|
|
12
|
+
|
|
10
13
|
var _index = require("../index");
|
|
14
|
+
|
|
11
15
|
const fileType = {
|
|
12
16
|
'IMAGE': 'image',
|
|
13
17
|
'VIDEO': 'video',
|
|
@@ -15,25 +19,31 @@ const fileType = {
|
|
|
15
19
|
'DOCUMENT': ['application/x-latex', 'application/x-tex', 'text/', 'application/json', 'application/pdf', 'application/msword', 'application/msexcel', 'application/mspowerpoint', 'application/vnd.ms-word', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument', 'application/vnd.oasis.opendocument']
|
|
16
20
|
};
|
|
17
21
|
exports.fileType = fileType;
|
|
22
|
+
|
|
18
23
|
async function fileSelect(dialog = {}) {
|
|
19
24
|
if (!dialog.buttons || !Array.isArray(dialog.buttons)) {
|
|
20
25
|
dialog.buttons = [];
|
|
26
|
+
|
|
21
27
|
if (dialog.multiselect || dialog.directory) {
|
|
22
28
|
dialog.buttons.push({
|
|
23
29
|
'text': _chaynsDialog.buttonText.OK,
|
|
24
30
|
'buttonType': _chaynsDialog.buttonType.POSITIVE
|
|
25
31
|
});
|
|
26
32
|
}
|
|
33
|
+
|
|
27
34
|
dialog.buttons.push({
|
|
28
35
|
'text': _chaynsDialog.buttonText.CANCEL,
|
|
29
36
|
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
30
37
|
});
|
|
31
38
|
}
|
|
39
|
+
|
|
32
40
|
dialog.callType = _chaynsDialog.dialogAction.FILE_SELECT;
|
|
33
41
|
const user = (0, _index.getUser)();
|
|
42
|
+
|
|
34
43
|
if (!user) {
|
|
35
44
|
return (0, _index.login)();
|
|
36
45
|
}
|
|
46
|
+
|
|
37
47
|
dialog.chaynsToken = (await (0, _index.getAccessToken)()).accessToken;
|
|
38
48
|
return (0, _open.open)(dialog);
|
|
39
49
|
}
|
|
@@ -5,10 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports._chaynsCallResponder = _chaynsCallResponder;
|
|
7
7
|
exports.iFrame = iFrame;
|
|
8
|
+
|
|
8
9
|
var _chaynsDialog = require("./chaynsDialog");
|
|
10
|
+
|
|
9
11
|
var _open = require("./open");
|
|
12
|
+
|
|
10
13
|
var _communication = require("./communication");
|
|
14
|
+
|
|
11
15
|
var _index = require("../index");
|
|
16
|
+
|
|
12
17
|
function iFrame(dialog = {
|
|
13
18
|
url: ""
|
|
14
19
|
}) {
|
|
@@ -21,6 +26,7 @@ function iFrame(dialog = {
|
|
|
21
26
|
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
22
27
|
}];
|
|
23
28
|
}
|
|
29
|
+
|
|
24
30
|
dialog.tappIframeName = window.name;
|
|
25
31
|
dialog.callType = _chaynsDialog.dialogAction.IFRAME;
|
|
26
32
|
const site = (0, _index.getSite)();
|
|
@@ -28,9 +34,11 @@ function iFrame(dialog = {
|
|
|
28
34
|
(0, _communication.addDialogDataListener)(_chaynsCallResponder, true);
|
|
29
35
|
return (0, _open.open)(dialog);
|
|
30
36
|
}
|
|
37
|
+
|
|
31
38
|
function _chaynsCallResponder(obj) {
|
|
32
39
|
if (obj.call.value.callback) {
|
|
33
40
|
const call = JSON.parse(JSON.stringify(obj)); // deep copy
|
|
41
|
+
|
|
34
42
|
(0, _index.invokeDialogCall)(obj).then(result => {
|
|
35
43
|
(0, _communication.sendData)({
|
|
36
44
|
result,
|
|
@@ -19,8 +19,11 @@ Object.defineProperty(exports, "buttonType", {
|
|
|
19
19
|
return _chaynsDialog.buttonType;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
+
|
|
22
23
|
var _chaynsDialog = require("./chaynsDialog");
|
|
24
|
+
|
|
23
25
|
var _alert = require("./alert");
|
|
26
|
+
|
|
24
27
|
Object.keys(_alert).forEach(function (key) {
|
|
25
28
|
if (key === "default" || key === "__esModule") return;
|
|
26
29
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -32,7 +35,9 @@ Object.keys(_alert).forEach(function (key) {
|
|
|
32
35
|
}
|
|
33
36
|
});
|
|
34
37
|
});
|
|
38
|
+
|
|
35
39
|
var _confirm = require("./confirm");
|
|
40
|
+
|
|
36
41
|
Object.keys(_confirm).forEach(function (key) {
|
|
37
42
|
if (key === "default" || key === "__esModule") return;
|
|
38
43
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -44,7 +49,9 @@ Object.keys(_confirm).forEach(function (key) {
|
|
|
44
49
|
}
|
|
45
50
|
});
|
|
46
51
|
});
|
|
52
|
+
|
|
47
53
|
var _select = require("./select");
|
|
54
|
+
|
|
48
55
|
Object.keys(_select).forEach(function (key) {
|
|
49
56
|
if (key === "default" || key === "__esModule") return;
|
|
50
57
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -56,7 +63,9 @@ Object.keys(_select).forEach(function (key) {
|
|
|
56
63
|
}
|
|
57
64
|
});
|
|
58
65
|
});
|
|
66
|
+
|
|
59
67
|
var _date = require("./date");
|
|
68
|
+
|
|
60
69
|
Object.keys(_date).forEach(function (key) {
|
|
61
70
|
if (key === "default" || key === "__esModule") return;
|
|
62
71
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -68,7 +77,9 @@ Object.keys(_date).forEach(function (key) {
|
|
|
68
77
|
}
|
|
69
78
|
});
|
|
70
79
|
});
|
|
80
|
+
|
|
71
81
|
var _input = require("./input");
|
|
82
|
+
|
|
72
83
|
Object.keys(_input).forEach(function (key) {
|
|
73
84
|
if (key === "default" || key === "__esModule") return;
|
|
74
85
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -80,7 +91,9 @@ Object.keys(_input).forEach(function (key) {
|
|
|
80
91
|
}
|
|
81
92
|
});
|
|
82
93
|
});
|
|
94
|
+
|
|
83
95
|
var _close = require("./close");
|
|
96
|
+
|
|
84
97
|
Object.keys(_close).forEach(function (key) {
|
|
85
98
|
if (key === "default" || key === "__esModule") return;
|
|
86
99
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -92,7 +105,9 @@ Object.keys(_close).forEach(function (key) {
|
|
|
92
105
|
}
|
|
93
106
|
});
|
|
94
107
|
});
|
|
108
|
+
|
|
95
109
|
var _dropUpAlert = require("./dropUpAlert");
|
|
110
|
+
|
|
96
111
|
Object.keys(_dropUpAlert).forEach(function (key) {
|
|
97
112
|
if (key === "default" || key === "__esModule") return;
|
|
98
113
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -104,7 +119,9 @@ Object.keys(_dropUpAlert).forEach(function (key) {
|
|
|
104
119
|
}
|
|
105
120
|
});
|
|
106
121
|
});
|
|
122
|
+
|
|
107
123
|
var _iFrame = require("./iFrame");
|
|
124
|
+
|
|
108
125
|
Object.keys(_iFrame).forEach(function (key) {
|
|
109
126
|
if (key === "default" || key === "__esModule") return;
|
|
110
127
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -116,7 +133,9 @@ Object.keys(_iFrame).forEach(function (key) {
|
|
|
116
133
|
}
|
|
117
134
|
});
|
|
118
135
|
});
|
|
136
|
+
|
|
119
137
|
var _mediaSelect = require("./mediaSelect");
|
|
138
|
+
|
|
120
139
|
Object.keys(_mediaSelect).forEach(function (key) {
|
|
121
140
|
if (key === "default" || key === "__esModule") return;
|
|
122
141
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -128,7 +147,9 @@ Object.keys(_mediaSelect).forEach(function (key) {
|
|
|
128
147
|
}
|
|
129
148
|
});
|
|
130
149
|
});
|
|
150
|
+
|
|
131
151
|
var _fileSelect = require("./fileSelect");
|
|
152
|
+
|
|
132
153
|
Object.keys(_fileSelect).forEach(function (key) {
|
|
133
154
|
if (key === "default" || key === "__esModule") return;
|
|
134
155
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -140,7 +161,9 @@ Object.keys(_fileSelect).forEach(function (key) {
|
|
|
140
161
|
}
|
|
141
162
|
});
|
|
142
163
|
});
|
|
164
|
+
|
|
143
165
|
var _communication = require("./communication");
|
|
166
|
+
|
|
144
167
|
Object.keys(_communication).forEach(function (key) {
|
|
145
168
|
if (key === "default" || key === "__esModule") return;
|
|
146
169
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -152,7 +175,9 @@ Object.keys(_communication).forEach(function (key) {
|
|
|
152
175
|
}
|
|
153
176
|
});
|
|
154
177
|
});
|
|
178
|
+
|
|
155
179
|
var _toast = require("./toast");
|
|
180
|
+
|
|
156
181
|
Object.keys(_toast).forEach(function (key) {
|
|
157
182
|
if (key === "default" || key === "__esModule") return;
|
|
158
183
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -164,7 +189,9 @@ Object.keys(_toast).forEach(function (key) {
|
|
|
164
189
|
}
|
|
165
190
|
});
|
|
166
191
|
});
|
|
192
|
+
|
|
167
193
|
var _signature = require("./signature");
|
|
194
|
+
|
|
168
195
|
Object.keys(_signature).forEach(function (key) {
|
|
169
196
|
if (key === "default" || key === "__esModule") return;
|
|
170
197
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -5,8 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.input = input;
|
|
7
7
|
exports.inputType = void 0;
|
|
8
|
+
|
|
8
9
|
var _chaynsDialog = require("./chaynsDialog");
|
|
10
|
+
|
|
9
11
|
var _open = require("./open");
|
|
12
|
+
|
|
10
13
|
function input(dialog = {}) {
|
|
11
14
|
if (!dialog.buttons || !Array.isArray(dialog.buttons)) {
|
|
12
15
|
dialog.buttons = [{
|
|
@@ -17,12 +20,15 @@ function input(dialog = {}) {
|
|
|
17
20
|
'buttonType': _chaynsDialog.buttonType.NEGATIVE
|
|
18
21
|
}];
|
|
19
22
|
}
|
|
23
|
+
|
|
20
24
|
if (dialog.formatter) {
|
|
21
25
|
dialog.formatter = dialog.formatter.toString();
|
|
22
26
|
}
|
|
27
|
+
|
|
23
28
|
dialog.callType = _chaynsDialog.dialogAction.INPUT;
|
|
24
29
|
return (0, _open.open)(dialog);
|
|
25
30
|
}
|
|
31
|
+
|
|
26
32
|
const inputType = {
|
|
27
33
|
'DEFAULT': 0,
|
|
28
34
|
'PASSWORD': 1,
|