@kissflow/lowcode-client-sdk 1.0.4-beta.1 → 1.0.6-beta
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/README.md +190 -66
- package/dist/kfsdk.es.js +379 -0
- package/dist/kfsdk.umd.js +1 -0
- package/dist/kfworkersdk.es.js +470 -0
- package/package.json +52 -39
- package/SDK_IN_INTEGRATION.md +0 -78
- package/custom.build.js +0 -99
- package/dist/app.js +0 -48
- package/dist/base.js +0 -170
- package/dist/client.js +0 -44
- package/dist/component.js +0 -45
- package/dist/constants.js +0 -48
- package/dist/form.js +0 -126
- package/dist/formatter.js +0 -54
- package/dist/global.types.d.ts +0 -68
- package/dist/index.d.ts +0 -161
- package/dist/index.html +0 -23
- package/dist/index.js +0 -7
- package/dist/kflowcode.sdk.js +0 -922
- package/dist/kflowcode.sdk.js.map +0 -1
- package/dist/kflowcode.sdk.module.js +0 -922
- package/dist/kflowcode.sdk.module.js.map +0 -1
- package/dist/lowcode.sdk.js +0 -56
- package/dist/page.js +0 -63
- package/id +0 -55
- package/index.html +0 -23
- package/src/app.ts +0 -31
- package/src/base.ts +0 -108
- package/src/client.ts +0 -28
- package/src/component.ts +0 -25
- package/src/constants.ts +0 -53
- package/src/form.ts +0 -131
- package/src/formatter.ts +0 -35
- package/src/index.ts +0 -7
- package/src/lowcode.sdk.ts +0 -44
- package/src/page.ts +0 -43
- package/test/lcnc-handler.js +0 -45
- package/test/mock/api.js +0 -16
- package/test/mock/id.js +0 -55
- package/tsconfig.json +0 -7
- package/tsconfig.types.json +0 -18
- package/webpack.config.js +0 -62
package/custom.build.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
const tsFileStruct = require("ts-file-parser");
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
let classMappings = {
|
|
4
|
-
Page: { name: "Page" },
|
|
5
|
-
Application: { name: "Application" },
|
|
6
|
-
Client: { name: "Client" },
|
|
7
|
-
Component: { name: "Component" },
|
|
8
|
-
Form: { name: "Form" },
|
|
9
|
-
Table: { name: "Table" },
|
|
10
|
-
TableForm: { name: "TableForm" },
|
|
11
|
-
Formatter: { name: "Formatter" },
|
|
12
|
-
LowcodeSDK: { name: "kf", staticDeclarations: true }
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const exec = require("child_process").exec;
|
|
16
|
-
runCommand("webpack", () => {
|
|
17
|
-
runCommand("tsc", () => {
|
|
18
|
-
runCommand("tsc -p tsconfig.types.json", transfromTypings);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
function runCommand(command, callBack = null) {
|
|
23
|
-
const execCmd = exec(command, () => {
|
|
24
|
-
callBack && callBack();
|
|
25
|
-
});
|
|
26
|
-
execCmd.stdout.on("data", (data) => {
|
|
27
|
-
console.log(data);
|
|
28
|
-
});
|
|
29
|
-
execCmd.stderr.on("data", (data) => {
|
|
30
|
-
console.error(data);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function transfromTypings() {
|
|
35
|
-
const filePath = "./dist/index.d.ts";
|
|
36
|
-
let srcFile = fs.readFileSync(filePath).toString();
|
|
37
|
-
let srcCode = tsFileStruct.parseStruct(srcFile, {}, filePath);
|
|
38
|
-
|
|
39
|
-
let allClasses = srcCode.classes;
|
|
40
|
-
let func = "";
|
|
41
|
-
let toWrite = ``;
|
|
42
|
-
|
|
43
|
-
for (let i = 0; i < allClasses.length; i++) {
|
|
44
|
-
if (Object.keys(classMappings).includes(allClasses[i].name)) {
|
|
45
|
-
let _class = allClasses[i];
|
|
46
|
-
toWrite += `\ndeclare class ${
|
|
47
|
-
classMappings[_class.name].name
|
|
48
|
-
} { \n`;
|
|
49
|
-
|
|
50
|
-
// fields on Class
|
|
51
|
-
for (let i = 0; i < _class.fields.length; i++) {
|
|
52
|
-
// if (_class.fields[i].type.modulePath) {
|
|
53
|
-
let className = "";
|
|
54
|
-
if (!_class.fields[i].type) {
|
|
55
|
-
continue
|
|
56
|
-
} else if(_class.fields[i].type.options) {
|
|
57
|
-
// TODO: currently we add only the first typechecking
|
|
58
|
-
className = _class.fields[i].type.options[0].typeName;
|
|
59
|
-
|
|
60
|
-
// TODO: need to handle when there are multiple type
|
|
61
|
-
// let options = _class.fields[i].type.options
|
|
62
|
-
// for (let j = 0; j < options.length; j++) {
|
|
63
|
-
// className += options[j].typeName;
|
|
64
|
-
// if (j < options.length - 1) {
|
|
65
|
-
// className += " | ";
|
|
66
|
-
// }
|
|
67
|
-
// }
|
|
68
|
-
} else {
|
|
69
|
-
className = _class.fields[i].type.typeName;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
let fieldName = _class.fields[i].name;
|
|
73
|
-
// console.log(_class.fields[i]);
|
|
74
|
-
toWrite += `\t${
|
|
75
|
-
classMappings[_class.name].staticDeclarations
|
|
76
|
-
? "static "
|
|
77
|
-
: ""
|
|
78
|
-
}${fieldName}: ${className} \n`;
|
|
79
|
-
// }
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
//methods of Class
|
|
83
|
-
for (j = 0; j < _class.methods.length; j++) {
|
|
84
|
-
func = _class.methods[j].text.trim().split("\n\t").join(" ");
|
|
85
|
-
toWrite += `\t${func} \n`;
|
|
86
|
-
// if (
|
|
87
|
-
// typeof _class.methods[j].returnType === "object" &&
|
|
88
|
-
// method.returnType.modulePath
|
|
89
|
-
// ) {
|
|
90
|
-
// childClasses.push(method.returnType.typeName);
|
|
91
|
-
// }
|
|
92
|
-
}
|
|
93
|
-
toWrite += `}`;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
fs.writeFile("./dist/global.types.d.ts", toWrite, function (err) {
|
|
97
|
-
if (err) return console.log(err);
|
|
98
|
-
});
|
|
99
|
-
}
|
package/dist/app.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
exports.__esModule = true;
|
|
18
|
-
exports.Application = void 0;
|
|
19
|
-
var base_1 = require("./base");
|
|
20
|
-
var page_1 = require("./page");
|
|
21
|
-
var constants_1 = require("./constants");
|
|
22
|
-
var Application = /** @class */ (function (_super) {
|
|
23
|
-
__extends(Application, _super);
|
|
24
|
-
function Application(props) {
|
|
25
|
-
var _this = _super.call(this, {}) || this;
|
|
26
|
-
_this.page = new page_1.Page({});
|
|
27
|
-
return _this;
|
|
28
|
-
}
|
|
29
|
-
Application.prototype.getVariable = function (key) {
|
|
30
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_APP_VARIABLE, {
|
|
31
|
-
key: key
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Application.prototype.setVariable = function (key, value) {
|
|
35
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.SET_APP_VARIABLE, {
|
|
36
|
-
key: key,
|
|
37
|
-
value: value
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
Application.prototype.openPage = function (pageId, pageParams) {
|
|
41
|
-
return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.OPEN_PAGE, {
|
|
42
|
-
pageId: pageId,
|
|
43
|
-
pageParams: pageParams
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
return Application;
|
|
47
|
-
}(base_1.BaseSDK));
|
|
48
|
-
exports.Application = Application;
|
package/dist/base.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
50
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
51
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
52
|
-
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");
|
|
53
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
54
|
-
};
|
|
55
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
56
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
57
|
-
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");
|
|
58
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
59
|
-
};
|
|
60
|
-
var _BaseSDK_instances, _BaseSDK_listeners, _BaseSDK_eventListeners, _BaseSDK_addListener, _BaseSDK_appendEventListeners, _BaseSDK_checkEvents, _BaseSDK_onMessage;
|
|
61
|
-
exports.__esModule = true;
|
|
62
|
-
exports.BaseSDK = void 0;
|
|
63
|
-
var constants_1 = require("./constants");
|
|
64
|
-
var nanoid = require("nanoid").nanoid;
|
|
65
|
-
function generateId(prefix) {
|
|
66
|
-
if (prefix === void 0) { prefix = "lcncsdk"; }
|
|
67
|
-
return "".concat(prefix, "-").concat(nanoid());
|
|
68
|
-
}
|
|
69
|
-
function postMessage(args) {
|
|
70
|
-
console.log("SDK : @postMessage ", args);
|
|
71
|
-
if (self.parent && self.parent !== self) {
|
|
72
|
-
self.parent.postMessage(args, "*");
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
self.postMessage(args);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
var BaseSDK = /** @class */ (function () {
|
|
79
|
-
function BaseSDK(props) {
|
|
80
|
-
_BaseSDK_instances.add(this);
|
|
81
|
-
_BaseSDK_listeners.set(this, void 0);
|
|
82
|
-
_BaseSDK_eventListeners.set(this, void 0);
|
|
83
|
-
console.log("SDK : Initializing ", props);
|
|
84
|
-
__classPrivateFieldSet(this, _BaseSDK_listeners, {}, "f");
|
|
85
|
-
__classPrivateFieldSet(this, _BaseSDK_eventListeners, {}, "f");
|
|
86
|
-
self.addEventListener("message", __classPrivateFieldGet(this, _BaseSDK_instances, "m", _BaseSDK_onMessage).bind(this), false);
|
|
87
|
-
}
|
|
88
|
-
BaseSDK.prototype._postMessageAsync = function (command, args, hasCallBack, callBack) {
|
|
89
|
-
var _this = this;
|
|
90
|
-
return new Promise(function (resolve, reject) {
|
|
91
|
-
var _id = generateId(command.toLowerCase());
|
|
92
|
-
postMessage(__assign({ _id: _id, command: command }, args));
|
|
93
|
-
__classPrivateFieldGet(_this, _BaseSDK_instances, "m", _BaseSDK_addListener).call(_this, _id, function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
94
|
-
return __generator(this, function (_a) {
|
|
95
|
-
switch (_a.label) {
|
|
96
|
-
case 0:
|
|
97
|
-
if (!data.errorMessage) return [3 /*break*/, 1];
|
|
98
|
-
reject(data);
|
|
99
|
-
return [3 /*break*/, 4];
|
|
100
|
-
case 1:
|
|
101
|
-
if (!(hasCallBack && callBack)) return [3 /*break*/, 3];
|
|
102
|
-
return [4 /*yield*/, callBack(data)];
|
|
103
|
-
case 2:
|
|
104
|
-
data = _a.sent();
|
|
105
|
-
_a.label = 3;
|
|
106
|
-
case 3:
|
|
107
|
-
resolve(data);
|
|
108
|
-
_a.label = 4;
|
|
109
|
-
case 4: return [2 /*return*/];
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}); });
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
BaseSDK.prototype._postMessage = function (command, func, args) {
|
|
116
|
-
if (args === void 0) { args = {}; }
|
|
117
|
-
var _id = generateId(command.toLowerCase());
|
|
118
|
-
postMessage(__assign({ _id: _id, command: command }, args));
|
|
119
|
-
__classPrivateFieldGet(this, _BaseSDK_instances, "m", _BaseSDK_addListener).call(this, _id, function (data) { return func(data); });
|
|
120
|
-
};
|
|
121
|
-
BaseSDK.prototype._registerEventListener = function (_id, eventType, callback) {
|
|
122
|
-
__classPrivateFieldGet(this, _BaseSDK_instances, "m", _BaseSDK_appendEventListeners).call(this, _id, eventType, callback);
|
|
123
|
-
};
|
|
124
|
-
return BaseSDK;
|
|
125
|
-
}());
|
|
126
|
-
exports.BaseSDK = BaseSDK;
|
|
127
|
-
_BaseSDK_listeners = new WeakMap(), _BaseSDK_eventListeners = new WeakMap(), _BaseSDK_instances = new WeakSet(), _BaseSDK_addListener = function _BaseSDK_addListener(_id, callback) {
|
|
128
|
-
__classPrivateFieldGet(this, _BaseSDK_listeners, "f")[_id] = __classPrivateFieldGet(this, _BaseSDK_listeners, "f")[_id] || [];
|
|
129
|
-
__classPrivateFieldGet(this, _BaseSDK_listeners, "f")[_id].push(callback);
|
|
130
|
-
}, _BaseSDK_appendEventListeners = function _BaseSDK_appendEventListeners(_id, eventType, callback) {
|
|
131
|
-
if (!__classPrivateFieldGet(this, _BaseSDK_eventListeners, "f")[_id]) {
|
|
132
|
-
__classPrivateFieldGet(this, _BaseSDK_eventListeners, "f")[_id] = {};
|
|
133
|
-
}
|
|
134
|
-
__classPrivateFieldGet(this, _BaseSDK_eventListeners, "f")[_id][eventType] = callback;
|
|
135
|
-
}, _BaseSDK_checkEvents = function _BaseSDK_checkEvents(data) {
|
|
136
|
-
var _id = data._id, eventType = data.eventType, eventParams = data.eventParams;
|
|
137
|
-
if (!_id || !eventType)
|
|
138
|
-
return;
|
|
139
|
-
var eventListener = __classPrivateFieldGet(this, _BaseSDK_eventListeners, "f")[_id] || {};
|
|
140
|
-
if (eventListener[eventType]) {
|
|
141
|
-
eventListener[eventType](eventParams || {});
|
|
142
|
-
}
|
|
143
|
-
}, _BaseSDK_onMessage = function _BaseSDK_onMessage(event) {
|
|
144
|
-
if (event.origin !== self.location.origin) {
|
|
145
|
-
console.log("SDK : @onMessage ", event);
|
|
146
|
-
var data_1 = event.data;
|
|
147
|
-
if (data_1.isEvent) {
|
|
148
|
-
return __classPrivateFieldGet(this, _BaseSDK_instances, "m", _BaseSDK_checkEvents).call(this, data_1);
|
|
149
|
-
}
|
|
150
|
-
var _req_1 = (data_1 === null || data_1 === void 0 ? void 0 : data_1._req) || {};
|
|
151
|
-
var listeners = __classPrivateFieldGet(this, _BaseSDK_listeners, "f")[_req_1 === null || _req_1 === void 0 ? void 0 : _req_1._id] || [];
|
|
152
|
-
if (listeners) {
|
|
153
|
-
listeners.forEach(function (listener) {
|
|
154
|
-
try {
|
|
155
|
-
if (data_1.resp &&
|
|
156
|
-
Object.keys(data_1.resp).length === 1 &&
|
|
157
|
-
_req_1.command !== constants_1.LISTENER_CMDS.API) {
|
|
158
|
-
listener(Object.values(data_1.resp)[0]);
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
listener(data_1.resp);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
catch (err) {
|
|
165
|
-
console.error("Message callback error: ", err);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
};
|
package/dist/client.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
exports.__esModule = true;
|
|
18
|
-
exports.Client = void 0;
|
|
19
|
-
var base_1 = require("./base");
|
|
20
|
-
var constants_1 = require("./constants");
|
|
21
|
-
var Client = /** @class */ (function (_super) {
|
|
22
|
-
__extends(Client, _super);
|
|
23
|
-
function Client() {
|
|
24
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
25
|
-
}
|
|
26
|
-
Client.prototype.showInfo = function (message) {
|
|
27
|
-
return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.MESSAGE, { message: message });
|
|
28
|
-
};
|
|
29
|
-
Client.prototype.showConfirm = function (args) {
|
|
30
|
-
return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.CONFIRM, {
|
|
31
|
-
data: {
|
|
32
|
-
title: args.title,
|
|
33
|
-
content: args.content,
|
|
34
|
-
okText: args.okText || "Ok",
|
|
35
|
-
cancelText: args.cancelText || "Cancel"
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
Client.prototype.redirect = function (url) {
|
|
40
|
-
return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.REDIRECT, { url: url });
|
|
41
|
-
};
|
|
42
|
-
return Client;
|
|
43
|
-
}(base_1.BaseSDK));
|
|
44
|
-
exports.Client = Client;
|
package/dist/component.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
exports.__esModule = true;
|
|
18
|
-
exports.Component = void 0;
|
|
19
|
-
var base_1 = require("./base");
|
|
20
|
-
var constants_1 = require("./constants");
|
|
21
|
-
var Component = /** @class */ (function (_super) {
|
|
22
|
-
__extends(Component, _super);
|
|
23
|
-
function Component(id) {
|
|
24
|
-
var _this = _super.call(this, {}) || this;
|
|
25
|
-
_this.id = id;
|
|
26
|
-
return _this;
|
|
27
|
-
}
|
|
28
|
-
Component.prototype.refresh = function () {
|
|
29
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.COMPONENT_REFRESH, {
|
|
30
|
-
id: this.id
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
Component.prototype.show = function () {
|
|
34
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.COMPONENT_SHOW, {
|
|
35
|
-
id: this.id
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
Component.prototype.hide = function () {
|
|
39
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.COMPONENT_HIDE, {
|
|
40
|
-
id: this.id
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
return Component;
|
|
44
|
-
}(base_1.BaseSDK));
|
|
45
|
-
exports.Component = Component;
|
package/dist/constants.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.EVENT_TYPES = exports.LISTENER_CMDS = void 0;
|
|
4
|
-
exports.LISTENER_CMDS = {
|
|
5
|
-
API: "API",
|
|
6
|
-
PARAMS: "PARAMS",
|
|
7
|
-
GET_CONTEXT: "GET_CONTEXT",
|
|
8
|
-
RETURN: "RETURN",
|
|
9
|
-
//Forms SDK Functions
|
|
10
|
-
GET_FORM_FIELD: "GET_FORM_FIELD",
|
|
11
|
-
UPDATE_FORM: "UPDATE_FORM",
|
|
12
|
-
GET_TABLE: "GET_TABLE",
|
|
13
|
-
GET_TABLE_ROW: "GET_TABLE_ROW",
|
|
14
|
-
ADD_TABLE_ROW: "ADD_TABLE_ROW",
|
|
15
|
-
DELETE_TABLE_ROW: "DELETE_TABLE_ROW",
|
|
16
|
-
TO_JSON: "TO_JSON",
|
|
17
|
-
GET_TABLE_ROWS: "GET_TABLE_ROWS",
|
|
18
|
-
//Client SDK functions
|
|
19
|
-
MESSAGE: "MESSAGE",
|
|
20
|
-
CONFIRM: "CONFIRM",
|
|
21
|
-
ALERT: "ALERT",
|
|
22
|
-
REDIRECT: "REDIRECT",
|
|
23
|
-
OPEN_PAGE: "OPEN_PAGE",
|
|
24
|
-
//Formatter SDK Functions
|
|
25
|
-
FORMAT_DATE: "FORMAT_DATE",
|
|
26
|
-
FORMAT_DATE_TIME: "FORMAT_DATE_TIME",
|
|
27
|
-
FORMAT_NUMBER: "FORMAT_NUMBER",
|
|
28
|
-
FORMAT_CURRENCY: "FORMAT_CURRENCY",
|
|
29
|
-
FORMAT_BOOLEAN: "FORMAT_BOOLEAN",
|
|
30
|
-
//Application SDK functions
|
|
31
|
-
GET_APP_VARIABLE: "GET_APP_VARIABLE",
|
|
32
|
-
SET_APP_VARIABLE: "SET_APP_VARIABLE",
|
|
33
|
-
//Application page sdk functions
|
|
34
|
-
GET_PAGE_VARIABLE: "GET_PAGE_VARIABLE",
|
|
35
|
-
SET_PAGE_VARIABLE: "SET_PAGE_VARIABLE",
|
|
36
|
-
GET_PAGE_PARAMS: "GET_PAGE_PARAMS",
|
|
37
|
-
OPEN_POPUP_PAGE: "OPEN_POPUP_PAGE",
|
|
38
|
-
PAGE_ON_CLOSE: "PAGE_ON_CLOSE",
|
|
39
|
-
CLOSE_POPUP: "CLOSE_POPUP",
|
|
40
|
-
COMPONENT_REFRESH: "COMPONENT_REFRESH",
|
|
41
|
-
COMPONENT_SHOW: "COMPONENT_SHOW",
|
|
42
|
-
COMPONENT_HIDE: "COMPONENT_HIDE"
|
|
43
|
-
};
|
|
44
|
-
exports.EVENT_TYPES = {
|
|
45
|
-
ON_CLOSE: "onClose",
|
|
46
|
-
ON_CHANGE: "onChange",
|
|
47
|
-
ON_LOAD: "onLoad"
|
|
48
|
-
};
|
package/dist/form.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
exports.__esModule = true;
|
|
18
|
-
exports.TableForm = exports.Form = void 0;
|
|
19
|
-
var base_1 = require("./base");
|
|
20
|
-
var constants_1 = require("./constants");
|
|
21
|
-
var Form = /** @class */ (function (_super) {
|
|
22
|
-
__extends(Form, _super);
|
|
23
|
-
function Form(instanceId) {
|
|
24
|
-
var _this = _super.call(this, {}) || this;
|
|
25
|
-
_this.instanceId = instanceId;
|
|
26
|
-
return _this;
|
|
27
|
-
}
|
|
28
|
-
Form.prototype.toJSON = function () {
|
|
29
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.TO_JSON, {
|
|
30
|
-
instanceId: this.instanceId
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
Form.prototype.getField = function (fieldId) {
|
|
34
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_FORM_FIELD, {
|
|
35
|
-
instanceId: this.instanceId,
|
|
36
|
-
fieldId: fieldId
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
Form.prototype.updateField = function (args) {
|
|
40
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.UPDATE_FORM, {
|
|
41
|
-
data: args
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
Form.prototype.getTable = function (tableId) {
|
|
45
|
-
return new Table(this.instanceId, tableId);
|
|
46
|
-
};
|
|
47
|
-
return Form;
|
|
48
|
-
}(base_1.BaseSDK));
|
|
49
|
-
exports.Form = Form;
|
|
50
|
-
var Table = /** @class */ (function (_super) {
|
|
51
|
-
__extends(Table, _super);
|
|
52
|
-
function Table(instanceId, tableId) {
|
|
53
|
-
var _this = _super.call(this, {}) || this;
|
|
54
|
-
_this.tableId = tableId;
|
|
55
|
-
_this.instanceId = instanceId;
|
|
56
|
-
return _this;
|
|
57
|
-
}
|
|
58
|
-
// list of obj of rows
|
|
59
|
-
Table.prototype.toJSON = function () {
|
|
60
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.TO_JSON, {
|
|
61
|
-
tableId: this.tableId
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
Table.prototype.getRows = function () {
|
|
65
|
-
var _this = this;
|
|
66
|
-
// list of TableForm class
|
|
67
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_TABLE_ROWS, { tableId: this.tableId }, true, // has callBack
|
|
68
|
-
function (data) {
|
|
69
|
-
console.log(data);
|
|
70
|
-
return data.map(function (row) { return new TableForm(_this.instanceId, _this.tableId, row.id); });
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
Table.prototype.getRow = function (rowId) {
|
|
74
|
-
return new TableForm(this.instanceId, this.tableId, rowId);
|
|
75
|
-
};
|
|
76
|
-
Table.prototype.addRow = function (rowObject) {
|
|
77
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.ADD_TABLE_ROW, {
|
|
78
|
-
tableId: this.tableId,
|
|
79
|
-
rowObject: rowObject
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
Table.prototype.deleteRow = function (rowId) {
|
|
83
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.DELETE_TABLE_ROW, {
|
|
84
|
-
tableId: this.tableId,
|
|
85
|
-
rowId: rowId
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
return Table;
|
|
89
|
-
}(base_1.BaseSDK));
|
|
90
|
-
var TableForm = /** @class */ (function (_super) {
|
|
91
|
-
__extends(TableForm, _super);
|
|
92
|
-
function TableForm(instanceId, tableId, rowId) {
|
|
93
|
-
var _this = _super.call(this, {}) || this;
|
|
94
|
-
_this.instanceId = instanceId;
|
|
95
|
-
_this.tableId = tableId;
|
|
96
|
-
_this.rowId = rowId;
|
|
97
|
-
return _this;
|
|
98
|
-
}
|
|
99
|
-
TableForm.prototype.getParent = function () {
|
|
100
|
-
return new Form(this.instanceId);
|
|
101
|
-
};
|
|
102
|
-
TableForm.prototype.toJSON = function () {
|
|
103
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.TO_JSON, {
|
|
104
|
-
tableId: this.tableId,
|
|
105
|
-
rowId: this.rowId
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
TableForm.prototype.getField = function (fieldId) {
|
|
109
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_FORM_FIELD, {
|
|
110
|
-
instanceId: this.instanceId,
|
|
111
|
-
tableId: this.tableId,
|
|
112
|
-
rowId: this.rowId,
|
|
113
|
-
fieldId: fieldId
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
TableForm.prototype.updateField = function (args) {
|
|
117
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.UPDATE_FORM, {
|
|
118
|
-
instanceId: this.instanceId,
|
|
119
|
-
tableId: this.tableId,
|
|
120
|
-
rowId: this.rowId,
|
|
121
|
-
data: args
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
return TableForm;
|
|
125
|
-
}(base_1.BaseSDK));
|
|
126
|
-
exports.TableForm = TableForm;
|
package/dist/formatter.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
exports.__esModule = true;
|
|
18
|
-
exports.Formatter = void 0;
|
|
19
|
-
var base_1 = require("./base");
|
|
20
|
-
var constants_1 = require("./constants");
|
|
21
|
-
var Formatter = /** @class */ (function (_super) {
|
|
22
|
-
__extends(Formatter, _super);
|
|
23
|
-
function Formatter() {
|
|
24
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
25
|
-
}
|
|
26
|
-
Formatter.prototype.toDate = function (date) {
|
|
27
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_DATE, {
|
|
28
|
-
date: date
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
Formatter.prototype.toDateTime = function (date) {
|
|
32
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_DATE_TIME, {
|
|
33
|
-
date: date
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
Formatter.prototype.toNumber = function (value) {
|
|
37
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_NUMBER, {
|
|
38
|
-
value: value
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
Formatter.prototype.toCurrency = function (value, currencyCode) {
|
|
42
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_CURRENCY, {
|
|
43
|
-
value: value,
|
|
44
|
-
currencyCode: currencyCode
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
Formatter.prototype.toBoolean = function (value) {
|
|
48
|
-
return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_BOOLEAN, {
|
|
49
|
-
value: value
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
return Formatter;
|
|
53
|
-
}(base_1.BaseSDK));
|
|
54
|
-
exports.Formatter = Formatter;
|