@kissflow/lowcode-client-sdk 1.0.0-beta.5 → 1.0.2-beta.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.
@@ -1,808 +0,0 @@
1
- /******/ var __webpack_modules__ = ({
2
-
3
- /***/ "./src/app.ts":
4
- /*!********************!*\
5
- !*** ./src/app.ts ***!
6
- \********************/
7
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
8
-
9
-
10
- var __extends = (this && this.__extends) || (function () {
11
- var extendStatics = function (d, b) {
12
- extendStatics = Object.setPrototypeOf ||
13
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
14
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
15
- return extendStatics(d, b);
16
- };
17
- return function (d, b) {
18
- if (typeof b !== "function" && b !== null)
19
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
20
- extendStatics(d, b);
21
- function __() { this.constructor = d; }
22
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
23
- };
24
- })();
25
- Object.defineProperty(exports, "__esModule", ({ value: true }));
26
- exports.Application = void 0;
27
- var base_1 = __webpack_require__(/*! ./base */ "./src/base.ts");
28
- var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts");
29
- var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
30
- var Application = /** @class */ (function (_super) {
31
- __extends(Application, _super);
32
- function Application(props) {
33
- var _this = _super.call(this, {}) || this;
34
- _this.page = new page_1.Page({});
35
- return _this;
36
- }
37
- Application.prototype.getVariable = function (key) {
38
- return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_APP_VARIABLE, {
39
- key: key
40
- });
41
- };
42
- Application.prototype.setVariable = function (key, value) {
43
- return this._postMessageAsync(constants_1.LISTENER_CMDS.SET_APP_VARIABLE, {
44
- key: key,
45
- value: value
46
- });
47
- };
48
- Application.prototype.openPage = function (pageId, pageParams) {
49
- return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.OPEN_PAGE, {
50
- pageId: pageId,
51
- pageParams: pageParams
52
- });
53
- };
54
- return Application;
55
- }(base_1.BaseSDK));
56
- exports.Application = Application;
57
-
58
-
59
- /***/ }),
60
-
61
- /***/ "./src/base.ts":
62
- /*!*********************!*\
63
- !*** ./src/base.ts ***!
64
- \*********************/
65
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
66
-
67
-
68
- var __assign = (this && this.__assign) || function () {
69
- __assign = Object.assign || function(t) {
70
- for (var s, i = 1, n = arguments.length; i < n; i++) {
71
- s = arguments[i];
72
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
73
- t[p] = s[p];
74
- }
75
- return t;
76
- };
77
- return __assign.apply(this, arguments);
78
- };
79
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
80
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
81
- return new (P || (P = Promise))(function (resolve, reject) {
82
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
83
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
84
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
85
- step((generator = generator.apply(thisArg, _arguments || [])).next());
86
- });
87
- };
88
- var __generator = (this && this.__generator) || function (thisArg, body) {
89
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
90
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
91
- function verb(n) { return function (v) { return step([n, v]); }; }
92
- function step(op) {
93
- if (f) throw new TypeError("Generator is already executing.");
94
- while (_) try {
95
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
96
- if (y = 0, t) op = [op[0] & 2, t.value];
97
- switch (op[0]) {
98
- case 0: case 1: t = op; break;
99
- case 4: _.label++; return { value: op[1], done: false };
100
- case 5: _.label++; y = op[1]; op = [0]; continue;
101
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
102
- default:
103
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
104
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
105
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
106
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
107
- if (t[2]) _.ops.pop();
108
- _.trys.pop(); continue;
109
- }
110
- op = body.call(thisArg, _);
111
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
112
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
113
- }
114
- };
115
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
116
- if (kind === "m") throw new TypeError("Private method is not writable");
117
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
118
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
119
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
120
- };
121
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
122
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
123
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
124
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
125
- };
126
- var _BaseSDK_instances, _BaseSDK_listeners, _BaseSDK_eventListeners, _BaseSDK_addListener, _BaseSDK_appendEventListeners, _BaseSDK_checkEvents, _BaseSDK_onMessage;
127
- Object.defineProperty(exports, "__esModule", ({ value: true }));
128
- exports.BaseSDK = void 0;
129
- var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
130
- var nanoid = (__webpack_require__(/*! nanoid */ "./node_modules/nanoid/index.dev.js").nanoid);
131
- function generateId(prefix) {
132
- if (prefix === void 0) { prefix = "lcncsdk"; }
133
- return "".concat(prefix, "-").concat(nanoid());
134
- }
135
- function postMessage(args) {
136
- console.log("SDK : @postMessage ", args);
137
- if (self.parent && self.parent !== self) {
138
- self.parent.postMessage(args, "*");
139
- }
140
- else {
141
- self.postMessage(args);
142
- }
143
- }
144
- var BaseSDK = /** @class */ (function () {
145
- function BaseSDK(props) {
146
- _BaseSDK_instances.add(this);
147
- _BaseSDK_listeners.set(this, void 0);
148
- _BaseSDK_eventListeners.set(this, void 0);
149
- console.log("SDK : Initializing ", props);
150
- __classPrivateFieldSet(this, _BaseSDK_listeners, {}, "f");
151
- __classPrivateFieldSet(this, _BaseSDK_eventListeners, {}, "f");
152
- self.addEventListener("message", __classPrivateFieldGet(this, _BaseSDK_instances, "m", _BaseSDK_onMessage).bind(this), false);
153
- }
154
- BaseSDK.prototype._postMessageAsync = function (command, args, hasCallBack, callBack) {
155
- var _this = this;
156
- return new Promise(function (resolve, reject) {
157
- var _id = generateId(command.toLowerCase());
158
- postMessage(__assign({ _id: _id, command: command }, args));
159
- __classPrivateFieldGet(_this, _BaseSDK_instances, "m", _BaseSDK_addListener).call(_this, _id, function (data) { return __awaiter(_this, void 0, void 0, function () {
160
- return __generator(this, function (_a) {
161
- switch (_a.label) {
162
- case 0:
163
- if (!data.errorMessage) return [3 /*break*/, 1];
164
- reject(data);
165
- return [3 /*break*/, 4];
166
- case 1:
167
- if (!(hasCallBack && callBack)) return [3 /*break*/, 3];
168
- return [4 /*yield*/, callBack(data)];
169
- case 2:
170
- data = _a.sent();
171
- _a.label = 3;
172
- case 3:
173
- resolve(data);
174
- _a.label = 4;
175
- case 4: return [2 /*return*/];
176
- }
177
- });
178
- }); });
179
- });
180
- };
181
- BaseSDK.prototype._postMessage = function (command, func, args) {
182
- if (args === void 0) { args = {}; }
183
- var _id = generateId(command.toLowerCase());
184
- postMessage(__assign({ _id: _id, command: command }, args));
185
- __classPrivateFieldGet(this, _BaseSDK_instances, "m", _BaseSDK_addListener).call(this, _id, function (data) { return func(data); });
186
- };
187
- BaseSDK.prototype._registerEventListener = function (_id, eventType, callback) {
188
- __classPrivateFieldGet(this, _BaseSDK_instances, "m", _BaseSDK_appendEventListeners).call(this, _id, eventType, callback);
189
- };
190
- return BaseSDK;
191
- }());
192
- exports.BaseSDK = BaseSDK;
193
- _BaseSDK_listeners = new WeakMap(), _BaseSDK_eventListeners = new WeakMap(), _BaseSDK_instances = new WeakSet(), _BaseSDK_addListener = function _BaseSDK_addListener(_id, callback) {
194
- __classPrivateFieldGet(this, _BaseSDK_listeners, "f")[_id] = __classPrivateFieldGet(this, _BaseSDK_listeners, "f")[_id] || [];
195
- __classPrivateFieldGet(this, _BaseSDK_listeners, "f")[_id].push(callback);
196
- }, _BaseSDK_appendEventListeners = function _BaseSDK_appendEventListeners(_id, eventType, callback) {
197
- if (!__classPrivateFieldGet(this, _BaseSDK_eventListeners, "f")[_id]) {
198
- __classPrivateFieldGet(this, _BaseSDK_eventListeners, "f")[_id] = {};
199
- }
200
- __classPrivateFieldGet(this, _BaseSDK_eventListeners, "f")[_id][eventType] = callback;
201
- }, _BaseSDK_checkEvents = function _BaseSDK_checkEvents(data) {
202
- var _id = data._id, eventType = data.eventType, eventParams = data.eventParams;
203
- if (!_id || !eventType)
204
- return;
205
- var eventListener = __classPrivateFieldGet(this, _BaseSDK_eventListeners, "f")[_id] || {};
206
- if (eventListener[eventType]) {
207
- eventListener[eventType](eventParams || {});
208
- }
209
- }, _BaseSDK_onMessage = function _BaseSDK_onMessage(event) {
210
- if (event.origin !== self.location.origin) {
211
- console.log("SDK : @onMessage ", event);
212
- var data_1 = event.data;
213
- if (data_1.isEvent) {
214
- return __classPrivateFieldGet(this, _BaseSDK_instances, "m", _BaseSDK_checkEvents).call(this, data_1);
215
- }
216
- var _req_1 = (data_1 === null || data_1 === void 0 ? void 0 : data_1._req) || {};
217
- var listeners = __classPrivateFieldGet(this, _BaseSDK_listeners, "f")[_req_1 === null || _req_1 === void 0 ? void 0 : _req_1._id] || [];
218
- if (listeners) {
219
- listeners.forEach(function (listener) {
220
- try {
221
- if (data_1.resp) {
222
- if (Object.keys(data_1.resp).length === 1 &&
223
- _req_1.command !== constants_1.LISTENER_CMDS.API) {
224
- listener(Object.values(data_1.resp)[0]);
225
- }
226
- else {
227
- listener(data_1.resp);
228
- }
229
- }
230
- }
231
- catch (err) {
232
- console.error("Message callback error: ", err);
233
- }
234
- });
235
- }
236
- }
237
- };
238
-
239
-
240
- /***/ }),
241
-
242
- /***/ "./src/client.ts":
243
- /*!***********************!*\
244
- !*** ./src/client.ts ***!
245
- \***********************/
246
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
247
-
248
-
249
- var __extends = (this && this.__extends) || (function () {
250
- var extendStatics = function (d, b) {
251
- extendStatics = Object.setPrototypeOf ||
252
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
253
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
254
- return extendStatics(d, b);
255
- };
256
- return function (d, b) {
257
- if (typeof b !== "function" && b !== null)
258
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
259
- extendStatics(d, b);
260
- function __() { this.constructor = d; }
261
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
262
- };
263
- })();
264
- Object.defineProperty(exports, "__esModule", ({ value: true }));
265
- exports.Client = void 0;
266
- var base_1 = __webpack_require__(/*! ./base */ "./src/base.ts");
267
- var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
268
- var Client = /** @class */ (function (_super) {
269
- __extends(Client, _super);
270
- function Client() {
271
- return _super !== null && _super.apply(this, arguments) || this;
272
- }
273
- Client.prototype.showInfo = function (message) {
274
- return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.MESSAGE, { message: message });
275
- };
276
- Client.prototype.showConfirm = function (args) {
277
- return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.CONFIRM, {
278
- data: {
279
- title: args.title,
280
- content: args.content,
281
- okText: args.okText || "Ok",
282
- cancelText: args.cancelText || "Cancel"
283
- }
284
- });
285
- };
286
- Client.prototype.redirect = function (url) {
287
- return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.REDIRECT, { url: url });
288
- };
289
- return Client;
290
- }(base_1.BaseSDK));
291
- exports.Client = Client;
292
-
293
-
294
- /***/ }),
295
-
296
- /***/ "./src/component.ts":
297
- /*!**************************!*\
298
- !*** ./src/component.ts ***!
299
- \**************************/
300
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
301
-
302
-
303
- var __extends = (this && this.__extends) || (function () {
304
- var extendStatics = function (d, b) {
305
- extendStatics = Object.setPrototypeOf ||
306
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
307
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
308
- return extendStatics(d, b);
309
- };
310
- return function (d, b) {
311
- if (typeof b !== "function" && b !== null)
312
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
313
- extendStatics(d, b);
314
- function __() { this.constructor = d; }
315
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
316
- };
317
- })();
318
- Object.defineProperty(exports, "__esModule", ({ value: true }));
319
- exports.Component = void 0;
320
- var base_1 = __webpack_require__(/*! ./base */ "./src/base.ts");
321
- var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
322
- var Component = /** @class */ (function (_super) {
323
- __extends(Component, _super);
324
- function Component(id) {
325
- var _this = _super.call(this, {}) || this;
326
- _this.id = id;
327
- return _this;
328
- }
329
- Component.prototype.refresh = function () {
330
- return this._postMessageAsync(constants_1.LISTENER_CMDS.COMPONENT_REFRESH, {
331
- id: this.id
332
- });
333
- };
334
- return Component;
335
- }(base_1.BaseSDK));
336
- exports.Component = Component;
337
-
338
-
339
- /***/ }),
340
-
341
- /***/ "./src/constants.ts":
342
- /*!**************************!*\
343
- !*** ./src/constants.ts ***!
344
- \**************************/
345
- /***/ ((__unused_webpack_module, exports) => {
346
-
347
-
348
- Object.defineProperty(exports, "__esModule", ({ value: true }));
349
- exports.EVENT_TYPES = exports.LISTENER_CMDS = void 0;
350
- exports.LISTENER_CMDS = {
351
- API: "API",
352
- PARAMS: "PARAMS",
353
- GET_CONTEXT: "GET_CONTEXT",
354
- RETURN: "RETURN",
355
- //Forms SDK Functions
356
- GET_FORM_FIELD: "GET_FORM_FIELD",
357
- UPDATE_FORM: "UPDATE_FORM",
358
- ADD_TABLE_ROW: "ADD_TABLE_ROW",
359
- //Client SDK functions
360
- MESSAGE: "MESSAGE",
361
- CONFIRM: "CONFIRM",
362
- ALERT: "ALERT",
363
- REDIRECT: "REDIRECT",
364
- OPEN_PAGE: "OPEN_PAGE",
365
- //Formatter SDK Functions
366
- FORMAT_DATE: "FORMAT_DATE",
367
- FORMAT_DATE_TIME: "FORMAT_DATE_TIME",
368
- FORMAT_NUMBER: "FORMAT_NUMBER",
369
- FORMAT_CURRENCY: "FORMAT_CURRENCY",
370
- FORMAT_BOOLEAN: "FORMAT_BOOLEAN",
371
- //Application SDK functions
372
- GET_APP_VARIABLE: "GET_APP_VARIABLE",
373
- SET_APP_VARIABLE: "SET_APP_VARIABLE",
374
- //Application page sdk functions
375
- GET_PAGE_VARIABLE: "GET_PAGE_VARIABLE",
376
- SET_PAGE_VARIABLE: "SET_PAGE_VARIABLE",
377
- GET_PAGE_PARAMS: "GET_PAGE_PARAMS",
378
- OPEN_POPUP_PAGE: "OPEN_POPUP_PAGE",
379
- PAGE_ON_CLOSE: "PAGE_ON_CLOSE",
380
- COMPONENT_REFRESH: "COMPONENT_REFRESH"
381
- };
382
- exports.EVENT_TYPES = {
383
- ON_CLOSE: "onClose",
384
- ON_CHANGE: "onChange",
385
- ON_LOAD: "onLoad",
386
- };
387
-
388
-
389
- /***/ }),
390
-
391
- /***/ "./src/form.ts":
392
- /*!*********************!*\
393
- !*** ./src/form.ts ***!
394
- \*********************/
395
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
396
-
397
-
398
- var __extends = (this && this.__extends) || (function () {
399
- var extendStatics = function (d, b) {
400
- extendStatics = Object.setPrototypeOf ||
401
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
402
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
403
- return extendStatics(d, b);
404
- };
405
- return function (d, b) {
406
- if (typeof b !== "function" && b !== null)
407
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
408
- extendStatics(d, b);
409
- function __() { this.constructor = d; }
410
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
411
- };
412
- })();
413
- Object.defineProperty(exports, "__esModule", ({ value: true }));
414
- exports.Form = void 0;
415
- var base_1 = __webpack_require__(/*! ./base */ "./src/base.ts");
416
- var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
417
- var Form = /** @class */ (function (_super) {
418
- __extends(Form, _super);
419
- function Form() {
420
- return _super !== null && _super.apply(this, arguments) || this;
421
- }
422
- Form.prototype.getField = function (fieldId) {
423
- return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_FORM_FIELD, {
424
- fieldId: fieldId
425
- });
426
- };
427
- Form.prototype.updateField = function (args) {
428
- return this._postMessageAsync(constants_1.LISTENER_CMDS.UPDATE_FORM, {
429
- data: args
430
- });
431
- };
432
- Form.prototype.addTableRow = function (tableId, rowObject) {
433
- return this._postMessageAsync(constants_1.LISTENER_CMDS.ADD_TABLE_ROW, {
434
- tableId: tableId,
435
- rowObject: rowObject
436
- });
437
- };
438
- return Form;
439
- }(base_1.BaseSDK));
440
- exports.Form = Form;
441
-
442
-
443
- /***/ }),
444
-
445
- /***/ "./src/formatter.ts":
446
- /*!**************************!*\
447
- !*** ./src/formatter.ts ***!
448
- \**************************/
449
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
450
-
451
-
452
- var __extends = (this && this.__extends) || (function () {
453
- var extendStatics = function (d, b) {
454
- extendStatics = Object.setPrototypeOf ||
455
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
456
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
457
- return extendStatics(d, b);
458
- };
459
- return function (d, b) {
460
- if (typeof b !== "function" && b !== null)
461
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
462
- extendStatics(d, b);
463
- function __() { this.constructor = d; }
464
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
465
- };
466
- })();
467
- Object.defineProperty(exports, "__esModule", ({ value: true }));
468
- exports.Formatter = void 0;
469
- var base_1 = __webpack_require__(/*! ./base */ "./src/base.ts");
470
- var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
471
- var Formatter = /** @class */ (function (_super) {
472
- __extends(Formatter, _super);
473
- function Formatter() {
474
- return _super !== null && _super.apply(this, arguments) || this;
475
- }
476
- Formatter.prototype.toKfDate = function (date) {
477
- return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_DATE, {
478
- date: date,
479
- });
480
- };
481
- Formatter.prototype.toKfDateTime = function (date) {
482
- return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_DATE_TIME, {
483
- date: date,
484
- });
485
- };
486
- Formatter.prototype.toKfNumber = function (value) {
487
- return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_NUMBER, {
488
- value: value,
489
- });
490
- };
491
- Formatter.prototype.toKfCurrency = function (value, currencyCode) {
492
- return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_CURRENCY, {
493
- value: value,
494
- currencyCode: currencyCode,
495
- });
496
- };
497
- Formatter.prototype.toBoolean = function (value) {
498
- return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_BOOLEAN, {
499
- value: value
500
- });
501
- };
502
- return Formatter;
503
- }(base_1.BaseSDK));
504
- exports.Formatter = Formatter;
505
-
506
-
507
- /***/ }),
508
-
509
- /***/ "./src/lowcode.sdk.ts":
510
- /*!****************************!*\
511
- !*** ./src/lowcode.sdk.ts ***!
512
- \****************************/
513
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
514
-
515
-
516
- var __extends = (this && this.__extends) || (function () {
517
- var extendStatics = function (d, b) {
518
- extendStatics = Object.setPrototypeOf ||
519
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
520
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
521
- return extendStatics(d, b);
522
- };
523
- return function (d, b) {
524
- if (typeof b !== "function" && b !== null)
525
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
526
- extendStatics(d, b);
527
- function __() { this.constructor = d; }
528
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
529
- };
530
- })();
531
- Object.defineProperty(exports, "__esModule", ({ value: true }));
532
- exports.LowcodeSDK = void 0;
533
- var base_1 = __webpack_require__(/*! ./base */ "./src/base.ts");
534
- var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
535
- var form_1 = __webpack_require__(/*! ./form */ "./src/form.ts");
536
- var client_1 = __webpack_require__(/*! ./client */ "./src/client.ts");
537
- var formatter_1 = __webpack_require__(/*! ./formatter */ "./src/formatter.ts");
538
- var app_1 = __webpack_require__(/*! ./app */ "./src/app.ts");
539
- var component_1 = __webpack_require__(/*! ./component */ "./src/component.ts");
540
- var LowcodeSDK = /** @class */ (function (_super) {
541
- __extends(LowcodeSDK, _super);
542
- function LowcodeSDK(props) {
543
- var _this = _super.call(this, {}) || this;
544
- _this.currentForm = new form_1.Form({});
545
- _this.client = new client_1.Client({});
546
- _this.formatter = new formatter_1.Formatter({});
547
- _this.app = new app_1.Application({});
548
- return _this;
549
- }
550
- LowcodeSDK.prototype.api = function (url, args) {
551
- if (args === void 0) { args = {}; }
552
- return this._postMessageAsync(constants_1.LISTENER_CMDS.API, { url: url, args: args });
553
- };
554
- LowcodeSDK.prototype.watchParams = function (func) {
555
- this._postMessage(constants_1.LISTENER_CMDS.PARAMS, func);
556
- };
557
- LowcodeSDK.prototype.getContext = function () {
558
- return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_CONTEXT, {});
559
- };
560
- LowcodeSDK.prototype.getComponent = function (componentId) {
561
- return new component_1.Component(componentId);
562
- };
563
- return LowcodeSDK;
564
- }(base_1.BaseSDK));
565
- exports.LowcodeSDK = LowcodeSDK;
566
- function initSDK(config) {
567
- if (config === void 0) { config = {}; }
568
- return new LowcodeSDK(config);
569
- }
570
- exports["default"] = initSDK;
571
-
572
-
573
- /***/ }),
574
-
575
- /***/ "./src/page.ts":
576
- /*!*********************!*\
577
- !*** ./src/page.ts ***!
578
- \*********************/
579
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
580
-
581
-
582
- var __extends = (this && this.__extends) || (function () {
583
- var extendStatics = function (d, b) {
584
- extendStatics = Object.setPrototypeOf ||
585
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
586
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
587
- return extendStatics(d, b);
588
- };
589
- return function (d, b) {
590
- if (typeof b !== "function" && b !== null)
591
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
592
- extendStatics(d, b);
593
- function __() { this.constructor = d; }
594
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
595
- };
596
- })();
597
- Object.defineProperty(exports, "__esModule", ({ value: true }));
598
- exports.Page = void 0;
599
- var base_1 = __webpack_require__(/*! ./base */ "./src/base.ts");
600
- var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
601
- var Page = /** @class */ (function (_super) {
602
- __extends(Page, _super);
603
- function Page(pageId) {
604
- var _this = _super.call(this, {}) || this;
605
- _this._id = pageId;
606
- return _this;
607
- }
608
- Page.prototype.getParameter = function (key) {
609
- return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_PAGE_PARAMS, {
610
- key: key
611
- });
612
- };
613
- Page.prototype.getVariable = function (key) {
614
- return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_PAGE_VARIABLE, {
615
- key: key
616
- });
617
- };
618
- Page.prototype.setVariable = function (key, value) {
619
- return this._postMessageAsync(constants_1.LISTENER_CMDS.SET_PAGE_VARIABLE, {
620
- key: key,
621
- value: value
622
- });
623
- };
624
- Page.prototype.openPopup = function (pageId, inputParams, popupProperties) {
625
- var payload = {
626
- pageId: pageId,
627
- inputParams: inputParams,
628
- popupProperties: {
629
- width: popupProperties.w,
630
- height: popupProperties.h
631
- }
632
- };
633
- return this._postMessageAsync(constants_1.LISTENER_CMDS.OPEN_POPUP_PAGE, payload, true, function () {
634
- return new Page(pageId);
635
- });
636
- };
637
- Page.prototype.onClose = function (callback) {
638
- this._registerEventListener(this._id, constants_1.EVENT_TYPES.ON_CLOSE, callback);
639
- };
640
- return Page;
641
- }(base_1.BaseSDK));
642
- exports.Page = Page;
643
-
644
-
645
- /***/ }),
646
-
647
- /***/ "./node_modules/nanoid/index.dev.js":
648
- /*!******************************************!*\
649
- !*** ./node_modules/nanoid/index.dev.js ***!
650
- \******************************************/
651
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
652
-
653
- __webpack_require__.r(__webpack_exports__);
654
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
655
- /* harmony export */ "nanoid": () => (/* binding */ nanoid),
656
- /* harmony export */ "customAlphabet": () => (/* binding */ customAlphabet),
657
- /* harmony export */ "customRandom": () => (/* binding */ customRandom),
658
- /* harmony export */ "urlAlphabet": () => (/* reexport safe */ _url_alphabet_index_js__WEBPACK_IMPORTED_MODULE_0__.urlAlphabet),
659
- /* harmony export */ "random": () => (/* binding */ random)
660
- /* harmony export */ });
661
- /* harmony import */ var _url_alphabet_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./url-alphabet/index.js */ "./node_modules/nanoid/url-alphabet/index.js");
662
-
663
- if (true) {
664
- if (
665
- typeof navigator !== 'undefined' &&
666
- navigator.product === 'ReactNative' &&
667
- typeof crypto === 'undefined'
668
- ) {
669
- throw new Error(
670
- 'React Native does not have a built-in secure random generator. ' +
671
- 'If you don’t need unpredictable IDs use `nanoid/non-secure`. ' +
672
- 'For secure IDs, import `react-native-get-random-values` ' +
673
- 'before Nano ID.'
674
- )
675
- }
676
- if (typeof msCrypto !== 'undefined' && typeof crypto === 'undefined') {
677
- throw new Error(
678
- 'Import file with `if (!window.crypto) window.crypto = window.msCrypto`' +
679
- ' before importing Nano ID to fix IE 11 support'
680
- )
681
- }
682
- if (typeof crypto === 'undefined') {
683
- throw new Error(
684
- 'Your browser does not have secure random generator. ' +
685
- 'If you don’t need unpredictable IDs, you can use nanoid/non-secure.'
686
- )
687
- }
688
- }
689
- let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))
690
- let customRandom = (alphabet, size, getRandom) => {
691
- let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
692
- let step = -~((1.6 * mask * size) / alphabet.length)
693
- return () => {
694
- let id = ''
695
- while (true) {
696
- let bytes = getRandom(step)
697
- let j = step
698
- while (j--) {
699
- id += alphabet[bytes[j] & mask] || ''
700
- if (id.length === size) return id
701
- }
702
- }
703
- }
704
- }
705
- let customAlphabet = (alphabet, size) => customRandom(alphabet, size, random)
706
- let nanoid = (size = 21) => {
707
- let id = ''
708
- let bytes = crypto.getRandomValues(new Uint8Array(size))
709
- while (size--) {
710
- let byte = bytes[size] & 63
711
- if (byte < 36) {
712
- id += byte.toString(36)
713
- } else if (byte < 62) {
714
- id += (byte - 26).toString(36).toUpperCase()
715
- } else if (byte < 63) {
716
- id += '_'
717
- } else {
718
- id += '-'
719
- }
720
- }
721
- return id
722
- }
723
-
724
-
725
-
726
- /***/ }),
727
-
728
- /***/ "./node_modules/nanoid/url-alphabet/index.js":
729
- /*!***************************************************!*\
730
- !*** ./node_modules/nanoid/url-alphabet/index.js ***!
731
- \***************************************************/
732
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
733
-
734
- __webpack_require__.r(__webpack_exports__);
735
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
736
- /* harmony export */ "urlAlphabet": () => (/* binding */ urlAlphabet)
737
- /* harmony export */ });
738
- let urlAlphabet =
739
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
740
-
741
-
742
-
743
- /***/ })
744
-
745
- /******/ });
746
- /************************************************************************/
747
- /******/ // The module cache
748
- /******/ var __webpack_module_cache__ = {};
749
- /******/
750
- /******/ // The require function
751
- /******/ function __webpack_require__(moduleId) {
752
- /******/ // Check if module is in cache
753
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
754
- /******/ if (cachedModule !== undefined) {
755
- /******/ return cachedModule.exports;
756
- /******/ }
757
- /******/ // Create a new module (and put it into the cache)
758
- /******/ var module = __webpack_module_cache__[moduleId] = {
759
- /******/ // no module.id needed
760
- /******/ // no module.loaded needed
761
- /******/ exports: {}
762
- /******/ };
763
- /******/
764
- /******/ // Execute the module function
765
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
766
- /******/
767
- /******/ // Return the exports of the module
768
- /******/ return module.exports;
769
- /******/ }
770
- /******/
771
- /************************************************************************/
772
- /******/ /* webpack/runtime/define property getters */
773
- /******/ (() => {
774
- /******/ // define getter functions for harmony exports
775
- /******/ __webpack_require__.d = (exports, definition) => {
776
- /******/ for(var key in definition) {
777
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
778
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
779
- /******/ }
780
- /******/ }
781
- /******/ };
782
- /******/ })();
783
- /******/
784
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
785
- /******/ (() => {
786
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
787
- /******/ })();
788
- /******/
789
- /******/ /* webpack/runtime/make namespace object */
790
- /******/ (() => {
791
- /******/ // define __esModule on exports
792
- /******/ __webpack_require__.r = (exports) => {
793
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
794
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
795
- /******/ }
796
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
797
- /******/ };
798
- /******/ })();
799
- /******/
800
- /************************************************************************/
801
- /******/
802
- /******/ // startup
803
- /******/ // Load entry module and return exports
804
- /******/ // This entry module is referenced by other modules so it can't be inlined
805
- /******/ var __webpack_exports__ = __webpack_require__("./src/lowcode.sdk.ts");
806
- /******/
807
-
808
- //# sourceMappingURL=kflowcode.sdk.mjs.map