@kissflow/lowcode-client-sdk 1.0.2-beta.7 → 1.0.3
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 +156 -17
- package/dist/base.js +7 -8
- package/dist/form.js +4 -6
- package/dist/formatter.js +4 -4
- package/dist/global.types.d.ts +12 -16
- package/dist/index.d.ts +17 -21
- package/dist/index.html +1 -1
- package/dist/kflowcode.sdk.js +19 -22
- package/dist/kflowcode.sdk.js.map +1 -1
- package/dist/kflowcode.sdk.module.js +19 -22
- package/dist/kflowcode.sdk.module.js.map +1 -1
- package/dist/lowcode.sdk.js +0 -4
- package/dist/page.js +4 -0
- package/package.json +1 -1
- package/src/base.ts +9 -10
- package/src/form.ts +5 -12
- package/src/formatter.ts +4 -4
- package/src/lowcode.sdk.ts +0 -3
- package/src/page.ts +4 -0
package/src/form.ts
CHANGED
|
@@ -3,11 +3,9 @@ import { LISTENER_CMDS } from "./constants";
|
|
|
3
3
|
|
|
4
4
|
export class Form extends BaseSDK {
|
|
5
5
|
private instanceId: string;
|
|
6
|
-
id: string;
|
|
7
6
|
constructor(instanceId: string) {
|
|
8
7
|
super({});
|
|
9
8
|
this.instanceId = instanceId;
|
|
10
|
-
this.id = instanceId;
|
|
11
9
|
}
|
|
12
10
|
toJSON() {
|
|
13
11
|
return this._postMessageAsync(
|
|
@@ -36,13 +34,11 @@ export class Form extends BaseSDK {
|
|
|
36
34
|
class Table extends BaseSDK {
|
|
37
35
|
private tableId: string;
|
|
38
36
|
private instanceId: string;
|
|
39
|
-
id: string;
|
|
40
37
|
|
|
41
38
|
constructor(instanceId: string,tableId: string) {
|
|
42
39
|
super({});
|
|
43
40
|
this.tableId = tableId;
|
|
44
41
|
this.instanceId = instanceId
|
|
45
|
-
this.id = tableId;
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
// list of obj of rows
|
|
@@ -91,24 +87,21 @@ export class TableForm extends BaseSDK {
|
|
|
91
87
|
private instanceId: string;
|
|
92
88
|
private tableId: string;
|
|
93
89
|
private rowId: string;
|
|
94
|
-
id: string
|
|
95
|
-
table: Table;
|
|
96
|
-
parent: Form;
|
|
97
90
|
|
|
98
91
|
constructor(instanceId: string, tableId: string, rowId: string) {
|
|
99
92
|
super({});
|
|
100
93
|
this.instanceId = instanceId;
|
|
101
94
|
this.tableId = tableId;
|
|
102
95
|
this.rowId = rowId;
|
|
103
|
-
this.id = rowId;
|
|
104
|
-
this.parent = new Form(instanceId);
|
|
105
|
-
this.table = new Table(instanceId, tableId);
|
|
106
96
|
}
|
|
107
97
|
|
|
108
|
-
|
|
98
|
+
getParent() {
|
|
99
|
+
return new Form(this.instanceId);
|
|
100
|
+
}
|
|
101
|
+
|
|
109
102
|
toJSON() {
|
|
110
103
|
return this._postMessageAsync(
|
|
111
|
-
LISTENER_CMDS.
|
|
104
|
+
LISTENER_CMDS.TO_JSON,
|
|
112
105
|
{
|
|
113
106
|
tableId: this.tableId,
|
|
114
107
|
rowId: this.rowId
|
package/src/formatter.ts
CHANGED
|
@@ -2,25 +2,25 @@ import { BaseSDK } from "./base";
|
|
|
2
2
|
import { LISTENER_CMDS } from "./constants";
|
|
3
3
|
|
|
4
4
|
export class Formatter extends BaseSDK {
|
|
5
|
-
|
|
5
|
+
toDate(date: string) {
|
|
6
6
|
return this._postMessageAsync(LISTENER_CMDS.FORMAT_DATE, {
|
|
7
7
|
date,
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
toDateTime(date: string) {
|
|
12
12
|
return this._postMessageAsync(LISTENER_CMDS.FORMAT_DATE_TIME, {
|
|
13
13
|
date,
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
toNumber(value: string) {
|
|
18
18
|
return this._postMessageAsync(LISTENER_CMDS.FORMAT_NUMBER, {
|
|
19
19
|
value,
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
toCurrency(value: string, currencyCode: string) {
|
|
24
24
|
return this._postMessageAsync(LISTENER_CMDS.FORMAT_CURRENCY, {
|
|
25
25
|
value,
|
|
26
26
|
currencyCode,
|
package/src/lowcode.sdk.ts
CHANGED
|
@@ -35,9 +35,6 @@ class LowcodeSDK extends BaseSDK {
|
|
|
35
35
|
getContext(): string | object {
|
|
36
36
|
return this._postMessageAsync(LISTENER_CMDS.GET_CONTEXT, {});
|
|
37
37
|
}
|
|
38
|
-
getComponent(componentId: string): Component {
|
|
39
|
-
return new Component(componentId);
|
|
40
|
-
}
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
function initSDK(config: any = {}): LowcodeSDK {
|
package/src/page.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Component } from './component';
|
|
1
2
|
import { BaseSDK } from "./base";
|
|
2
3
|
import { LISTENER_CMDS, EVENT_TYPES } from "./constants";
|
|
3
4
|
|
|
@@ -45,6 +46,9 @@ export class Page extends BaseSDK {
|
|
|
45
46
|
}
|
|
46
47
|
);
|
|
47
48
|
}
|
|
49
|
+
getComponent(componentId: string): Component {
|
|
50
|
+
return new Component(componentId);
|
|
51
|
+
}
|
|
48
52
|
onClose(callback: Function) {
|
|
49
53
|
this._registerEventListener(this._id, EVENT_TYPES.ON_CLOSE, callback);
|
|
50
54
|
}
|