@kissflow/lowcode-client-sdk 1.0.1 → 1.0.2-1.beta.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.
Files changed (48) hide show
  1. package/README.md +392 -95
  2. package/dist/index.d.ts +263 -76
  3. package/dist/kf.lowcodeworkersdk.es.js +665 -0
  4. package/dist/kf.nocodeworkersdk.es.js +455 -0
  5. package/dist/kfsdk.es.js +483 -0
  6. package/dist/kfsdk.umd.js +1 -0
  7. package/dist/lowcode.d.ts +319 -0
  8. package/dist/lowcode.types.d.ts +106 -0
  9. package/dist/nocode.d.ts +316 -0
  10. package/dist/nocode.types.d.ts +65 -0
  11. package/dist/snippets.json +193 -0
  12. package/dist/worker.js +40 -0
  13. package/package.json +44 -39
  14. package/custom.build.js +0 -79
  15. package/dist/app.js +0 -48
  16. package/dist/base.js +0 -171
  17. package/dist/client.js +0 -44
  18. package/dist/component.js +0 -35
  19. package/dist/constants.js +0 -40
  20. package/dist/form.js +0 -44
  21. package/dist/formatter.js +0 -54
  22. package/dist/global.types.d.ts +0 -54
  23. package/dist/index.html +0 -23
  24. package/dist/index.js +0 -7
  25. package/dist/kflowcode.sdk.js +0 -822
  26. package/dist/kflowcode.sdk.js.map +0 -1
  27. package/dist/kflowcode.sdk.module.js +0 -808
  28. package/dist/kflowcode.sdk.module.js.map +0 -1
  29. package/dist/lowcode.sdk.js +0 -56
  30. package/dist/page.js +0 -62
  31. package/id +0 -55
  32. package/index.html +0 -23
  33. package/src/app.ts +0 -31
  34. package/src/base.ts +0 -109
  35. package/src/client.ts +0 -28
  36. package/src/component.ts +0 -15
  37. package/src/constants.ts +0 -45
  38. package/src/form.ts +0 -21
  39. package/src/formatter.ts +0 -35
  40. package/src/index.ts +0 -7
  41. package/src/lowcode.sdk.ts +0 -41
  42. package/src/page.ts +0 -51
  43. package/test/lcnc-handler.js +0 -45
  44. package/test/mock/api.js +0 -16
  45. package/test/mock/id.js +0 -55
  46. package/tsconfig.json +0 -7
  47. package/tsconfig.types.json +0 -18
  48. package/webpack.config.js +0 -63
package/package.json CHANGED
@@ -1,40 +1,45 @@
1
1
  {
2
- "name": "@kissflow/lowcode-client-sdk",
3
- "version": "1.0.1",
4
- "description": "JavaScript SDK for developing over the Kissflow lowcode platform",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "scripts": {
8
- "start": "npm run server",
9
- "server": "http-server .",
10
- "customBuild": "node custom.build.js",
11
- "build": "npm run customBuild",
12
- "build:watch": "webpack --watch",
13
- "prepare": "npm run build",
14
- "serve": "webpack serve"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/kissflow/lcnc-sdk-js.git"
19
- },
20
- "keywords": [],
21
- "author": "Vivek Madurai<vivek@kissflow.com>",
22
- "license": "MIT",
23
- "bugs": {
24
- "url": "https://github.com/kissflow/lcnc-sdk-js/issues"
25
- },
26
- "homepage": "https://github.com/kissflow/lcnc-sdk-js#readme",
27
- "devDependencies": {
28
- "html-webpack-plugin": "^5.3.1",
29
- "http-server": "^0.12.3",
30
- "ts-loader": "^9.2.5",
31
- "typescript": "^4.3.5",
32
- "webpack": "^5.52.1",
33
- "webpack-cli": "^4.8.0",
34
- "webpack-dev-server": "^3.11.2"
35
- },
36
- "dependencies": {
37
- "nanoid": "^3.1.30",
38
- "ts-file-parser": "0.0.21"
39
- }
40
- }
2
+ "name": "@kissflow/lowcode-client-sdk",
3
+ "version": "1.0.21.beta.1",
4
+ "description": "JavaScript SDK for developing over the Kissflow lowcode platform",
5
+ "types": "dist/index.d.ts",
6
+ "files": [
7
+ "dist/"
8
+ ],
9
+ "main": "./dist/kfsdk.umd.js",
10
+ "module": "./dist/kfsdk.es.js",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/kfsdk.es.js",
14
+ "require": "./dist/kfsdk.umd.js"
15
+ },
16
+ "./lowcode": {
17
+ "import": "./dist/kf.lowcodeworkersdk.es.js"
18
+ }
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/kissflow/lcnc-sdk-js.git"
23
+ },
24
+ "keywords": [],
25
+ "author": "Vivek Madurai<vivek@kissflow.com>",
26
+ "license": "MIT",
27
+ "bugs": {
28
+ "url": "https://github.com/kissflow/lcnc-sdk-js/issues"
29
+ },
30
+ "homepage": "https://github.com/kissflow/lcnc-sdk-js#readme",
31
+ "devDependencies": {
32
+ "ts-file-parser": "0.0.21",
33
+ "typescript": "^4.3.5",
34
+ "vite": "^2.9.8"
35
+ },
36
+ "dependencies": {
37
+ "nanoid": "^3.1.30"
38
+ },
39
+ "scripts": {
40
+ "start": "vite serve",
41
+ "customBuild": "node custom.build.mjs",
42
+ "build": "pnpm run customBuild",
43
+ "serve": "http-server -p 8080"
44
+ }
45
+ }
package/custom.build.js DELETED
@@ -1,79 +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
- Formatter: { name: "Formatter" },
10
- LowcodeSDK: { name: "kf", staticDeclarations: true }
11
- };
12
-
13
- const exec = require("child_process").exec;
14
- runCommand("webpack", () => {
15
- runCommand("tsc", () => {
16
- runCommand("tsc -p tsconfig.types.json", transfromTypings);
17
- });
18
- });
19
-
20
- function runCommand(command, callBack = null) {
21
- const execCmd = exec(command, () => {
22
- callBack && callBack();
23
- });
24
- execCmd.stdout.on("data", (data) => {
25
- console.log(data);
26
- });
27
- execCmd.stderr.on("data", (data) => {
28
- console.error(data);
29
- });
30
- }
31
-
32
- function transfromTypings() {
33
- const filePath = "./dist/index.d.ts";
34
- let srcFile = fs.readFileSync(filePath).toString();
35
- let srcCode = tsFileStruct.parseStruct(srcFile, {}, filePath);
36
-
37
- let allClasses = srcCode.classes;
38
- let func = "";
39
- let toWrite = ``;
40
-
41
- for (let i = 0; i < allClasses.length; i++) {
42
- if (Object.keys(classMappings).includes(allClasses[i].name)) {
43
- let _class = allClasses[i];
44
- toWrite += `\ndeclare class ${
45
- classMappings[_class.name].name
46
- } { \n`;
47
-
48
- // fields on Class
49
- for (let i = 0; i < _class.fields.length; i++) {
50
- // if (_class.fields[i].type.modulePath) {
51
- let className = _class.fields[i].type.typeName;
52
- let fieldName = _class.fields[i].name;
53
- // console.log(_class.fields[i]);
54
- toWrite += `\t${
55
- classMappings[_class.name].staticDeclarations
56
- ? "static "
57
- : ""
58
- }${fieldName}: ${className} \n`;
59
- // }
60
- }
61
-
62
- //methods of Class
63
- for (j = 0; j < _class.methods.length; j++) {
64
- func = _class.methods[j].text.trim().split("\n\t").join(" ");
65
- toWrite += `\t${func} \n`;
66
- // if (
67
- // typeof _class.methods[j].returnType === "object" &&
68
- // method.returnType.modulePath
69
- // ) {
70
- // childClasses.push(method.returnType.typeName);
71
- // }
72
- }
73
- toWrite += `}`;
74
- }
75
- }
76
- fs.writeFile("./dist/global.types.d.ts", toWrite, function (err) {
77
- if (err) return console.log(err);
78
- });
79
- }
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,171 +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
- if (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
- }
165
- catch (err) {
166
- console.error("Message callback error: ", err);
167
- }
168
- });
169
- }
170
- }
171
- };
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,35 +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
- return Component;
34
- }(base_1.BaseSDK));
35
- exports.Component = Component;
package/dist/constants.js DELETED
@@ -1,40 +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
- ADD_TABLE_ROW: "ADD_TABLE_ROW",
13
- //Client SDK functions
14
- MESSAGE: "MESSAGE",
15
- CONFIRM: "CONFIRM",
16
- ALERT: "ALERT",
17
- REDIRECT: "REDIRECT",
18
- OPEN_PAGE: "OPEN_PAGE",
19
- //Formatter SDK Functions
20
- FORMAT_DATE: "FORMAT_DATE",
21
- FORMAT_DATE_TIME: "FORMAT_DATE_TIME",
22
- FORMAT_NUMBER: "FORMAT_NUMBER",
23
- FORMAT_CURRENCY: "FORMAT_CURRENCY",
24
- FORMAT_BOOLEAN: "FORMAT_BOOLEAN",
25
- //Application SDK functions
26
- GET_APP_VARIABLE: "GET_APP_VARIABLE",
27
- SET_APP_VARIABLE: "SET_APP_VARIABLE",
28
- //Application page sdk functions
29
- GET_PAGE_VARIABLE: "GET_PAGE_VARIABLE",
30
- SET_PAGE_VARIABLE: "SET_PAGE_VARIABLE",
31
- GET_PAGE_PARAMS: "GET_PAGE_PARAMS",
32
- OPEN_POPUP_PAGE: "OPEN_POPUP_PAGE",
33
- PAGE_ON_CLOSE: "PAGE_ON_CLOSE",
34
- COMPONENT_REFRESH: "COMPONENT_REFRESH"
35
- };
36
- exports.EVENT_TYPES = {
37
- ON_CLOSE: "onClose",
38
- ON_CHANGE: "onChange",
39
- ON_LOAD: "onLoad"
40
- };
package/dist/form.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.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() {
24
- return _super !== null && _super.apply(this, arguments) || this;
25
- }
26
- Form.prototype.getField = function (fieldId) {
27
- return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_FORM_FIELD, {
28
- fieldId: fieldId
29
- });
30
- };
31
- Form.prototype.updateField = function (args) {
32
- return this._postMessageAsync(constants_1.LISTENER_CMDS.UPDATE_FORM, {
33
- data: args
34
- });
35
- };
36
- Form.prototype.addTableRow = function (tableId, rowObject) {
37
- return this._postMessageAsync(constants_1.LISTENER_CMDS.ADD_TABLE_ROW, {
38
- tableId: tableId,
39
- rowObject: rowObject
40
- });
41
- };
42
- return Form;
43
- }(base_1.BaseSDK));
44
- exports.Form = Form;
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.toKfDate = function (date) {
27
- return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_DATE, {
28
- date: date
29
- });
30
- };
31
- Formatter.prototype.toKfDateTime = function (date) {
32
- return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_DATE_TIME, {
33
- date: date
34
- });
35
- };
36
- Formatter.prototype.toKfNumber = function (value) {
37
- return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_NUMBER, {
38
- value: value
39
- });
40
- };
41
- Formatter.prototype.toKfCurrency = 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;
@@ -1,54 +0,0 @@
1
-
2
- declare class Page {
3
- _id: string
4
- getParameter(key: string): string | object;
5
- getVariable(key: string): string | object;
6
- setVariable(key: string, value: any): string | object;
7
- openPopup(pageId: string, inputParams: object, popupProperties: {
8
- w: number;
9
- h: number;
10
- }): string | object;
11
- onClose(callback: Function): void;
12
- }
13
- declare class Application {
14
- page: Page
15
- getVariable(key: string): string | object;
16
- setVariable(key: string | object, value: any): string | object;
17
- openPage(pageId: string, pageParams: object): string | object;
18
- }
19
- declare class Client {
20
- showInfo(message: string): string | object;
21
- showConfirm(args: {
22
- title: string;
23
- content: string;
24
- okText: string;
25
- cancelText: string;
26
- }): string | object;
27
- redirect(url: string): string | object;
28
- }
29
- declare class Component {
30
- id: string
31
- refresh(): string | object;
32
- }
33
- declare class Form {
34
- getField(fieldId: string): string | object;
35
- updateField(args: object): string | object;
36
- addTableRow(tableId: string, rowObject: object): string | object;
37
- }
38
- declare class Formatter {
39
- toKfDate(date: string): string | object;
40
- toKfDateTime(date: string): string | object;
41
- toKfNumber(value: string): string | object;
42
- toKfCurrency(value: string, currencyCode: string): string | object;
43
- toBoolean(value: string): string | object;
44
- }
45
- declare class kf {
46
- static currentForm: Form
47
- static client: Client
48
- static formatter: Formatter
49
- static app: Application
50
- api(url: string, args?: {}): string | object;
51
- watchParams(func: (data: any) => any): void;
52
- getContext(): string | object;
53
- getComponent(componentId: string): Component;
54
- }