@ixon-cdk/iframe-adapter 1.2.0 → 1.3.0-next.0
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.js +150 -0
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -14,6 +14,18 @@ const EVENTS = {
|
|
|
14
14
|
ResourceDataClientRender: `${EVENT_NS}rdc:render`,
|
|
15
15
|
ResourceDataClientRenderResult: `${EVENT_NS}rdc:renderresult`,
|
|
16
16
|
|
|
17
|
+
// ActionBottomSheet
|
|
18
|
+
OpenActionBottomSheet: `${EVENT_NS}openactionbottomsheet`,
|
|
19
|
+
OpenActionBottomSheetResult: `${EVENT_NS}openactionbottomsheetresult`,
|
|
20
|
+
|
|
21
|
+
// Dialogs
|
|
22
|
+
OpenAlertDialog: `${EVENT_NS}openalertdialog`,
|
|
23
|
+
OpenAlertDialogResult: `${EVENT_NS}openalertdialogresult`,
|
|
24
|
+
OpenConfirmDialog: `${EVENT_NS}openconfirmdialog`,
|
|
25
|
+
OpenConfirmDialogResult: `${EVENT_NS}openconfirmdialogresult`,
|
|
26
|
+
OpenFormDialog: `${EVENT_NS}openformdialog`,
|
|
27
|
+
OpenFormDialogResult: `${EVENT_NS}openformdialogresult`,
|
|
28
|
+
|
|
17
29
|
// VPN
|
|
18
30
|
ShowVpnStatusDetails: `${EVENT_NS}showvpnstatusdetails`,
|
|
19
31
|
ToggleVpn: `${EVENT_NS}togglevpn`,
|
|
@@ -132,6 +144,102 @@ class ComponentContext {
|
|
|
132
144
|
);
|
|
133
145
|
}
|
|
134
146
|
|
|
147
|
+
openActionBottomSheet(options) {
|
|
148
|
+
return new Promise(resolve => {
|
|
149
|
+
window.addEventListener(
|
|
150
|
+
'message',
|
|
151
|
+
_actionBottomSheetResultHandler,
|
|
152
|
+
false,
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
window.parent.postMessage(
|
|
156
|
+
{ type: EVENTS.OpenActionBottomSheet, payload: { options } },
|
|
157
|
+
'*',
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
function _actionBottomSheetResultHandler(event) {
|
|
161
|
+
if (event.source !== window.parent) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (event.data.type === EVENTS.OpenActionBottomSheetResult) {
|
|
166
|
+
window.removeEventListener(
|
|
167
|
+
'message',
|
|
168
|
+
_actionBottomSheetResultHandler,
|
|
169
|
+
false,
|
|
170
|
+
);
|
|
171
|
+
resolve(event.data.payload.result);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
openAlertDialog(options) {
|
|
178
|
+
return new Promise(resolve => {
|
|
179
|
+
window.addEventListener('message', _dialogResultHandler, false);
|
|
180
|
+
|
|
181
|
+
window.parent.postMessage(
|
|
182
|
+
{ type: EVENTS.OpenAlertDialog, payload: { options } },
|
|
183
|
+
'*',
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
function _dialogResultHandler(event) {
|
|
187
|
+
if (event.source !== window.parent) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (event.data.type === EVENTS.OpenAlertDialogResult) {
|
|
192
|
+
window.removeEventListener('message', _dialogResultHandler, false);
|
|
193
|
+
resolve(event.data.payload.result);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
openConfirmDialog(options) {
|
|
200
|
+
return new Promise(resolve => {
|
|
201
|
+
window.addEventListener('message', _dialogResultHandler, false);
|
|
202
|
+
|
|
203
|
+
window.parent.postMessage(
|
|
204
|
+
{ type: EVENTS.OpenConfirmDialog, payload: { options } },
|
|
205
|
+
'*',
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
function _dialogResultHandler(event) {
|
|
209
|
+
if (event.source !== window.parent) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (event.data.type === EVENTS.OpenConfirmDialogResult) {
|
|
214
|
+
window.removeEventListener('message', _dialogResultHandler, false);
|
|
215
|
+
resolve(event.data.payload.result);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
openFormDialog(options) {
|
|
222
|
+
return new Promise(resolve => {
|
|
223
|
+
window.addEventListener('message', _dialogResultHandler, false);
|
|
224
|
+
|
|
225
|
+
window.parent.postMessage(
|
|
226
|
+
{ type: EVENTS.OpenFormDialog, payload: { options } },
|
|
227
|
+
'*',
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
function _dialogResultHandler(event) {
|
|
231
|
+
if (event.source !== window.parent) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (event.data.type === EVENTS.OpenFormDialogResult) {
|
|
236
|
+
window.removeEventListener('message', _dialogResultHandler, false);
|
|
237
|
+
resolve(event.data.payload.result);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
135
243
|
saveAsFile() {
|
|
136
244
|
throw new NotImplementedError();
|
|
137
245
|
}
|
|
@@ -425,6 +533,48 @@ export function connect({ iframe, context }) {
|
|
|
425
533
|
break;
|
|
426
534
|
}
|
|
427
535
|
|
|
536
|
+
/**
|
|
537
|
+
* ActionBottomSheet
|
|
538
|
+
*/
|
|
539
|
+
case EVENTS.OpenActionBottomSheet:
|
|
540
|
+
context
|
|
541
|
+
.openActionBottomSheet(event.data.payload.options)
|
|
542
|
+
.then(result => {
|
|
543
|
+
iframe.contentWindow.postMessage(
|
|
544
|
+
{ type: EVENTS.OpenActionBottomSheetResult, payload: { result } },
|
|
545
|
+
'*',
|
|
546
|
+
);
|
|
547
|
+
});
|
|
548
|
+
break;
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Dialogs
|
|
552
|
+
*/
|
|
553
|
+
case EVENTS.OpenAlertDialog:
|
|
554
|
+
context.openAlertDialog(event.data.payload.options).then(result => {
|
|
555
|
+
iframe.contentWindow.postMessage(
|
|
556
|
+
{ type: EVENTS.OpenAlertDialogResult, payload: { result } },
|
|
557
|
+
'*',
|
|
558
|
+
);
|
|
559
|
+
});
|
|
560
|
+
break;
|
|
561
|
+
case EVENTS.OpenConfirmDialog:
|
|
562
|
+
context.openConfirmDialog(event.data.payload.options).then(result => {
|
|
563
|
+
iframe.contentWindow.postMessage(
|
|
564
|
+
{ type: EVENTS.OpenConfirmDialogResult, payload: { result } },
|
|
565
|
+
'*',
|
|
566
|
+
);
|
|
567
|
+
});
|
|
568
|
+
break;
|
|
569
|
+
case EVENTS.OpenFormDialog:
|
|
570
|
+
context.openFormDialog(event.data.payload.options).then(result => {
|
|
571
|
+
iframe.contentWindow.postMessage(
|
|
572
|
+
{ type: EVENTS.OpenFormDialogResult, payload: { result } },
|
|
573
|
+
'*',
|
|
574
|
+
);
|
|
575
|
+
});
|
|
576
|
+
break;
|
|
577
|
+
|
|
428
578
|
/**
|
|
429
579
|
* VPN
|
|
430
580
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixon-cdk/iframe-adapter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-next.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "",
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
"index.d.ts"
|
|
11
11
|
],
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@ixon-cdk/types": "^1.
|
|
13
|
+
"@ixon-cdk/types": "^1.3.0-next.0"
|
|
14
14
|
}
|
|
15
15
|
}
|