@kissflow/lowcode-client-sdk 1.0.0-beta.3 → 1.0.0-beta.4

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 CHANGED
@@ -16,9 +16,7 @@ const kf = KFLowcodeSDK();
16
16
  SDK can also be loaded directly into HTML by adding:
17
17
 
18
18
  ```html
19
- <script type="module" async
20
- src="https://cdn.jsdelivr.net/npm/@kissflow/lcnc-sdk-js@1/dist/kflowcode.sdk.module.js"
21
- ></script>
19
+ <script type="module" async src="https://cdn.jsdelivr.net/npm/@kissflow/lcnc-sdk-js@1/dist/kflowcode.sdk.module.js"></script>
22
20
  ```
23
21
 
24
22
  > Note specifying script type as "module" is must. Then SDK can be initialized anywhere by declaring:
@@ -61,16 +59,6 @@ kf.client.showConfirm({ title, content });
61
59
  ```js
62
60
  kf.client.redirect(url);
63
61
  ```
64
- ##### Open a page in lowcode application
65
- > Note: Page Input parameters are optional.
66
- ```js
67
- let pageInputParameters = {
68
- param1: value,
69
- param2: value
70
- };
71
- kf.client.openPage(pageId, pageInputParameters);
72
- ```
73
-
74
62
  ---
75
63
  ### 3) Component Functions
76
64
  #### Refresh a component
@@ -94,6 +82,15 @@ await kf.app.setVariable({
94
82
  variableId_2: 3345
95
83
  });
96
84
  ```
85
+ ##### Open a page
86
+ > Note: Page Input parameters are optional.
87
+ ```js
88
+ let pageInputParameters = {
89
+ param1: value,
90
+ param2: value
91
+ };
92
+ kf.app.openPage(pageId, pageInputParameters);
93
+ ```
97
94
  ##### Get values of page input parameters
98
95
  ```js
99
96
  let value = await kf.app.page.getParameter();
package/custom.build.js CHANGED
@@ -12,7 +12,9 @@ let classMappings = {
12
12
 
13
13
  const exec = require("child_process").exec;
14
14
  runCommand("webpack", () => {
15
- runCommand("tsc", transfromTypings);
15
+ runCommand("tsc", () => {
16
+ runCommand("tsc -p tsconfig.types.json", transfromTypings);
17
+ });
16
18
  });
17
19
 
18
20
  function runCommand(command, callBack = null) {
package/dist/app.js ADDED
@@ -0,0 +1,48 @@
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 ADDED
@@ -0,0 +1,171 @@
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 ADDED
@@ -0,0 +1,44 @@
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;
@@ -0,0 +1,35 @@
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;
@@ -0,0 +1,40 @@
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 ADDED
@@ -0,0 +1,44 @@
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;
@@ -0,0 +1,54 @@
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;
package/dist/index.html CHANGED
@@ -14,10 +14,10 @@
14
14
  <iframe id="component2" src="http://localhost:3000" width="500px" height="500px">
15
15
  <p>Your browser does not support iframes.</p>
16
16
  </iframe>
17
- <script defer src="kflowcode.sdk.js"></script></body>
17
+ <script defer src="kflowcode.sdk.mjs"></script></body>
18
18
  <script type="module">
19
19
  import MockAPI from './test/mock/api.js';
20
20
  import LCNCHandler from './test/lcnc-handler.js';
21
21
  LCNCHandler();
22
22
  </script>
23
- </html></html>
23
+ </html>
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ var lowcode_sdk_1 = require("./lowcode.sdk");
4
+ if (typeof _BUILD !== "undefined" && _BUILD) {
5
+ self.kf = lowcode_sdk_1["default"];
6
+ }
7
+ exports["default"] = lowcode_sdk_1["default"];