@omnia/velcron 7.0.380-dev
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 +6 -0
- package/actions/ActionResults.d.ts +4 -0
- package/actions/ActionResults.js +14 -0
- package/actions/Alert.d.ts +2 -0
- package/actions/Alert.js +12 -0
- package/actions/Array.d.ts +3 -0
- package/actions/Array.js +22 -0
- package/actions/Debounce.d.ts +2 -0
- package/actions/Debounce.js +43 -0
- package/actions/Delay.d.ts +2 -0
- package/actions/Delay.js +14 -0
- package/actions/Http.d.ts +2 -0
- package/actions/Http.js +15 -0
- package/actions/IActionHandler.d.ts +5 -0
- package/actions/IActionHandler.js +2 -0
- package/actions/Log.d.ts +2 -0
- package/actions/Log.js +10 -0
- package/actions/MsGraph.d.ts +2 -0
- package/actions/MsGraph.js +16 -0
- package/actions/MsSharePoint.d.ts +2 -0
- package/actions/MsSharePoint.js +17 -0
- package/actions/index.d.ts +10 -0
- package/actions/index.js +13 -0
- package/index.d.ts +3 -0
- package/index.js +6 -0
- package/models/Enums.d.ts +53 -0
- package/models/Enums.js +66 -0
- package/models/VelcronDefinitions.d.ts +213 -0
- package/models/VelcronDefinitions.js +2 -0
- package/models/VelcronDescriptors.d.ts +34 -0
- package/models/VelcronDescriptors.js +2 -0
- package/models/VelcronEvents.d.ts +16 -0
- package/models/VelcronEvents.js +2 -0
- package/models/VelcronTypes.d.ts +10 -0
- package/models/VelcronTypes.js +2 -0
- package/models/ViewModelAndContext.d.ts +4 -0
- package/models/ViewModelAndContext.js +2 -0
- package/models/index.d.ts +6 -0
- package/models/index.js +9 -0
- package/package.json +27 -0
- package/parser/TextValue.d.ts +4 -0
- package/parser/TextValue.js +9 -0
- package/parser/VelcronActions.d.ts +36 -0
- package/parser/VelcronActions.js +445 -0
- package/parser/VelcronConstants.d.ts +28 -0
- package/parser/VelcronConstants.js +31 -0
- package/parser/VelcronData.d.ts +39 -0
- package/parser/VelcronData.js +628 -0
- package/parser/VelcronLogger.d.ts +6 -0
- package/parser/VelcronLogger.js +18 -0
- package/parser/VelcronRenderers.d.ts +10 -0
- package/parser/VelcronRenderers.js +114 -0
- package/parser/VelcronStyles.d.ts +8 -0
- package/parser/VelcronStyles.js +121 -0
- package/parser/index.d.ts +7 -0
- package/parser/index.js +10 -0
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkipSetValue = exports.CancelProcedingActions = void 0;
|
|
4
|
+
//When this class is returned as the value of action promise
|
|
5
|
+
//we will stop executing actions after.
|
|
6
|
+
class CancelProcedingActions {
|
|
7
|
+
}
|
|
8
|
+
exports.CancelProcedingActions = CancelProcedingActions;
|
|
9
|
+
//Actions can set this as the promise response
|
|
10
|
+
//to indicate that they have controled the set operation
|
|
11
|
+
//in the action. e.g @arrayAppend sets the values
|
|
12
|
+
class SkipSetValue {
|
|
13
|
+
}
|
|
14
|
+
exports.SkipSetValue = SkipSetValue;
|
package/actions/Alert.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.alerter = void 0;
|
|
4
|
+
exports.alerter = {
|
|
5
|
+
name: "@alert",
|
|
6
|
+
action: (action, value, nisse) => {
|
|
7
|
+
//value = VelcronData.dataBind(action, value)
|
|
8
|
+
//alert(value + nisse ? nisse : 'nullsiu');
|
|
9
|
+
alert(`${value}`);
|
|
10
|
+
return Promise.resolve(null);
|
|
11
|
+
}
|
|
12
|
+
};
|
package/actions/Array.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayTake = exports.arrayAppend = void 0;
|
|
4
|
+
const VelcronData_1 = require("../parser/VelcronData");
|
|
5
|
+
const ActionResults_1 = require("./ActionResults");
|
|
6
|
+
exports.arrayAppend = {
|
|
7
|
+
name: "@array.append",
|
|
8
|
+
action: (action, arrayToAppend) => {
|
|
9
|
+
const existingArray = VelcronData_1.VelcronData.getOrSetObjectByPathUsingRenderContext(action, action.path);
|
|
10
|
+
existingArray.push(...arrayToAppend);
|
|
11
|
+
return Promise.resolve(new ActionResults_1.SkipSetValue());
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
exports.arrayTake = {
|
|
15
|
+
name: "@array.take",
|
|
16
|
+
action: (action, arr, takeTemplate) => {
|
|
17
|
+
takeTemplate = VelcronData_1.VelcronData.dataBind(action, takeTemplate);
|
|
18
|
+
const take = parseInt(takeTemplate);
|
|
19
|
+
arr = arr.slice(0, take);
|
|
20
|
+
return Promise.resolve(arr);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.debounce = void 0;
|
|
4
|
+
const VelcronData_1 = require("../parser/VelcronData");
|
|
5
|
+
const ActionResults_1 = require("./ActionResults");
|
|
6
|
+
const debounces = {};
|
|
7
|
+
exports.debounce = {
|
|
8
|
+
name: "@debounce",
|
|
9
|
+
action: (action, value) => {
|
|
10
|
+
//TODO Try catch
|
|
11
|
+
value = VelcronData_1.VelcronData.dataBind(action, value);
|
|
12
|
+
const bounceDelayTime = parseInt(value);
|
|
13
|
+
if (!debounces[action.id]) {
|
|
14
|
+
debounces[action.id] = debounceInternal(() => { Promise.resolve(); }, bounceDelayTime);
|
|
15
|
+
}
|
|
16
|
+
return debounces[action.id]();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function debounceInternal(inner, ms = 0) {
|
|
20
|
+
let timer;
|
|
21
|
+
let resolves = [];
|
|
22
|
+
return function (...args) {
|
|
23
|
+
// Run the function after a certain amount of time
|
|
24
|
+
clearTimeout(timer);
|
|
25
|
+
timer = setTimeout(() => {
|
|
26
|
+
// Get the result of the inner function, then apply it to the resolve function of
|
|
27
|
+
// each promise that has been created since the last time the inner function was run
|
|
28
|
+
const result = inner(...args);
|
|
29
|
+
let count = 1;
|
|
30
|
+
resolves.forEach((resolvable) => {
|
|
31
|
+
if (count === resolves.length) {
|
|
32
|
+
resolvable.resolve(null);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
resolvable.resolve(new ActionResults_1.CancelProcedingActions());
|
|
36
|
+
}
|
|
37
|
+
count++;
|
|
38
|
+
});
|
|
39
|
+
resolves = [];
|
|
40
|
+
}, ms);
|
|
41
|
+
return new Promise((resolve, reject) => resolves.push({ resolve: resolve, reject: reject }));
|
|
42
|
+
};
|
|
43
|
+
}
|
package/actions/Delay.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.delay = void 0;
|
|
4
|
+
const VelcronData_1 = require("../parser/VelcronData");
|
|
5
|
+
exports.delay = {
|
|
6
|
+
name: "@delay",
|
|
7
|
+
action: (action, value) => {
|
|
8
|
+
value = VelcronData_1.VelcronData.dataBind(action, value);
|
|
9
|
+
const delayTime = parseInt(value);
|
|
10
|
+
return new Promise(function (resolve) {
|
|
11
|
+
setTimeout(resolve.bind(null, null), delayTime);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
package/actions/Http.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.httpGet = void 0;
|
|
4
|
+
const VelcronData_1 = require("../parser/VelcronData");
|
|
5
|
+
exports.httpGet = {
|
|
6
|
+
name: "@http.get",
|
|
7
|
+
action: (action, value) => {
|
|
8
|
+
return new Promise(function (resolve) {
|
|
9
|
+
value = VelcronData_1.VelcronData.dataBind(action, value);
|
|
10
|
+
fetch(value)
|
|
11
|
+
.then(response => response.json())
|
|
12
|
+
.then(json => resolve(json));
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
package/actions/Log.d.ts
ADDED
package/actions/Log.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.msGraphGet = void 0;
|
|
4
|
+
const VelcronData_1 = require("../parser/VelcronData");
|
|
5
|
+
exports.msGraphGet = {
|
|
6
|
+
name: "@msgraph.get",
|
|
7
|
+
action: (action, value) => {
|
|
8
|
+
return new Promise(async function (resolve) {
|
|
9
|
+
//TODO Make it typed!
|
|
10
|
+
const client = await window.omniaScriptApi.m365.graphClient;
|
|
11
|
+
value = VelcronData_1.VelcronData.dataBind(action, value);
|
|
12
|
+
const res = await client.get(value);
|
|
13
|
+
resolve(res.data);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.msSp = void 0;
|
|
4
|
+
const VelcronData_1 = require("../parser/VelcronData");
|
|
5
|
+
//TODO This should be pluggable from sharepoint package
|
|
6
|
+
exports.msSp = {
|
|
7
|
+
name: "@mssp.get",
|
|
8
|
+
action: (action, value) => {
|
|
9
|
+
return new Promise(async function (resolve) {
|
|
10
|
+
//TODO Make it typed!
|
|
11
|
+
const client = await window.omniaScriptApi.spfx.sharepointClient;
|
|
12
|
+
value = VelcronData_1.VelcronData.dataBind(action, value);
|
|
13
|
+
const res = await client.get(value);
|
|
14
|
+
resolve(res.data);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./IActionHandler";
|
|
2
|
+
export * from "./Delay";
|
|
3
|
+
export * from "./Http";
|
|
4
|
+
export * from "./Debounce";
|
|
5
|
+
export * from "./ActionResults";
|
|
6
|
+
export * from "./Array";
|
|
7
|
+
export * from "./Alert";
|
|
8
|
+
export * from "./Log";
|
|
9
|
+
export * from "./MsGraph";
|
|
10
|
+
export * from "./MsSharePoint";
|
package/actions/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./IActionHandler"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./Delay"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./Http"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./Debounce"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./ActionResults"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./Array"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./Alert"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./Log"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./MsGraph"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./MsSharePoint"), exports);
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./models"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./parser"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./actions"), exports);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare enum AssignOperators {
|
|
2
|
+
equals = "=",
|
|
3
|
+
plusEquals = "+=",
|
|
4
|
+
equalsPlus = "=+",
|
|
5
|
+
equalsQuestion = "=?",
|
|
6
|
+
plusPlus = "++",
|
|
7
|
+
minusMinus = "--",
|
|
8
|
+
equalsExclamation = "=!"
|
|
9
|
+
}
|
|
10
|
+
export declare enum VelcronActionTypes {
|
|
11
|
+
getOrSetValue = 0,
|
|
12
|
+
promise = 1,
|
|
13
|
+
condition = 2,
|
|
14
|
+
returnsValue = 3
|
|
15
|
+
}
|
|
16
|
+
export declare enum VelcronIconTypes {
|
|
17
|
+
fontAwesome = "fa"
|
|
18
|
+
}
|
|
19
|
+
export declare enum VelcronSectionColumnWidthTypes {
|
|
20
|
+
stretch = "stretch",
|
|
21
|
+
auto = "auto"
|
|
22
|
+
}
|
|
23
|
+
export declare enum VelcronHorizontalAlignments {
|
|
24
|
+
left = "left",
|
|
25
|
+
center = "center",
|
|
26
|
+
right = "right"
|
|
27
|
+
}
|
|
28
|
+
export declare enum VerticalAlignments {
|
|
29
|
+
top = "top",
|
|
30
|
+
center = "center",
|
|
31
|
+
bottom = "bottom"
|
|
32
|
+
}
|
|
33
|
+
export declare enum VelcronDescriptorTypes {
|
|
34
|
+
component = 0,
|
|
35
|
+
subComponent = 1,
|
|
36
|
+
appData = 2,
|
|
37
|
+
dataMember = 3
|
|
38
|
+
}
|
|
39
|
+
export declare enum VelcronComponentPropertyEditors {
|
|
40
|
+
text = 0,
|
|
41
|
+
colorPicker = 1,
|
|
42
|
+
slider = 2
|
|
43
|
+
}
|
|
44
|
+
export declare enum VelcronDataTypes {
|
|
45
|
+
unknown = "unknown",
|
|
46
|
+
object = "object",
|
|
47
|
+
text = "text",
|
|
48
|
+
number = "number",
|
|
49
|
+
boolean = "boolean",
|
|
50
|
+
array = "array",
|
|
51
|
+
componentArray = "componentArray",
|
|
52
|
+
bind = "bind"
|
|
53
|
+
}
|
package/models/Enums.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronDataTypes = exports.VelcronComponentPropertyEditors = exports.VelcronDescriptorTypes = exports.VerticalAlignments = exports.VelcronHorizontalAlignments = exports.VelcronSectionColumnWidthTypes = exports.VelcronIconTypes = exports.VelcronActionTypes = exports.AssignOperators = void 0;
|
|
4
|
+
var AssignOperators;
|
|
5
|
+
(function (AssignOperators) {
|
|
6
|
+
AssignOperators["equals"] = "=";
|
|
7
|
+
AssignOperators["plusEquals"] = "+=";
|
|
8
|
+
AssignOperators["equalsPlus"] = "=+";
|
|
9
|
+
AssignOperators["equalsQuestion"] = "=?";
|
|
10
|
+
AssignOperators["plusPlus"] = "++";
|
|
11
|
+
AssignOperators["minusMinus"] = "--";
|
|
12
|
+
AssignOperators["equalsExclamation"] = "=!";
|
|
13
|
+
})(AssignOperators = exports.AssignOperators || (exports.AssignOperators = {}));
|
|
14
|
+
var VelcronActionTypes;
|
|
15
|
+
(function (VelcronActionTypes) {
|
|
16
|
+
VelcronActionTypes[VelcronActionTypes["getOrSetValue"] = 0] = "getOrSetValue";
|
|
17
|
+
VelcronActionTypes[VelcronActionTypes["promise"] = 1] = "promise";
|
|
18
|
+
VelcronActionTypes[VelcronActionTypes["condition"] = 2] = "condition";
|
|
19
|
+
VelcronActionTypes[VelcronActionTypes["returnsValue"] = 3] = "returnsValue";
|
|
20
|
+
})(VelcronActionTypes = exports.VelcronActionTypes || (exports.VelcronActionTypes = {}));
|
|
21
|
+
var VelcronIconTypes;
|
|
22
|
+
(function (VelcronIconTypes) {
|
|
23
|
+
VelcronIconTypes["fontAwesome"] = "fa";
|
|
24
|
+
})(VelcronIconTypes = exports.VelcronIconTypes || (exports.VelcronIconTypes = {}));
|
|
25
|
+
var VelcronSectionColumnWidthTypes;
|
|
26
|
+
(function (VelcronSectionColumnWidthTypes) {
|
|
27
|
+
VelcronSectionColumnWidthTypes["stretch"] = "stretch";
|
|
28
|
+
VelcronSectionColumnWidthTypes["auto"] = "auto";
|
|
29
|
+
})(VelcronSectionColumnWidthTypes = exports.VelcronSectionColumnWidthTypes || (exports.VelcronSectionColumnWidthTypes = {}));
|
|
30
|
+
var VelcronHorizontalAlignments;
|
|
31
|
+
(function (VelcronHorizontalAlignments) {
|
|
32
|
+
VelcronHorizontalAlignments["left"] = "left";
|
|
33
|
+
VelcronHorizontalAlignments["center"] = "center";
|
|
34
|
+
VelcronHorizontalAlignments["right"] = "right";
|
|
35
|
+
})(VelcronHorizontalAlignments = exports.VelcronHorizontalAlignments || (exports.VelcronHorizontalAlignments = {}));
|
|
36
|
+
var VerticalAlignments;
|
|
37
|
+
(function (VerticalAlignments) {
|
|
38
|
+
VerticalAlignments["top"] = "top";
|
|
39
|
+
VerticalAlignments["center"] = "center";
|
|
40
|
+
VerticalAlignments["bottom"] = "bottom";
|
|
41
|
+
})(VerticalAlignments = exports.VerticalAlignments || (exports.VerticalAlignments = {}));
|
|
42
|
+
var VelcronDescriptorTypes;
|
|
43
|
+
(function (VelcronDescriptorTypes) {
|
|
44
|
+
VelcronDescriptorTypes[VelcronDescriptorTypes["component"] = 0] = "component";
|
|
45
|
+
VelcronDescriptorTypes[VelcronDescriptorTypes["subComponent"] = 1] = "subComponent";
|
|
46
|
+
VelcronDescriptorTypes[VelcronDescriptorTypes["appData"] = 2] = "appData";
|
|
47
|
+
VelcronDescriptorTypes[VelcronDescriptorTypes["dataMember"] = 3] = "dataMember";
|
|
48
|
+
})(VelcronDescriptorTypes = exports.VelcronDescriptorTypes || (exports.VelcronDescriptorTypes = {}));
|
|
49
|
+
var VelcronComponentPropertyEditors;
|
|
50
|
+
(function (VelcronComponentPropertyEditors) {
|
|
51
|
+
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["text"] = 0] = "text";
|
|
52
|
+
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["colorPicker"] = 1] = "colorPicker";
|
|
53
|
+
VelcronComponentPropertyEditors[VelcronComponentPropertyEditors["slider"] = 2] = "slider";
|
|
54
|
+
})(VelcronComponentPropertyEditors = exports.VelcronComponentPropertyEditors || (exports.VelcronComponentPropertyEditors = {}));
|
|
55
|
+
var VelcronDataTypes;
|
|
56
|
+
(function (VelcronDataTypes) {
|
|
57
|
+
//Unknown = null
|
|
58
|
+
VelcronDataTypes["unknown"] = "unknown";
|
|
59
|
+
VelcronDataTypes["object"] = "object";
|
|
60
|
+
VelcronDataTypes["text"] = "text";
|
|
61
|
+
VelcronDataTypes["number"] = "number";
|
|
62
|
+
VelcronDataTypes["boolean"] = "boolean";
|
|
63
|
+
VelcronDataTypes["array"] = "array";
|
|
64
|
+
VelcronDataTypes["componentArray"] = "componentArray";
|
|
65
|
+
VelcronDataTypes["bind"] = "bind";
|
|
66
|
+
})(VelcronDataTypes = exports.VelcronDataTypes || (exports.VelcronDataTypes = {}));
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { VelcronComponentDescriptor } from "./VelcronDescriptors";
|
|
2
|
+
import { VelcronEvent, VelcronOnChangedEvent, VelcronOnClosedEvent, VelcronOnCloseRequestedEvent, VelcronOnLoadEvent, VelcronOnPressEvent } from "./VelcronEvents";
|
|
3
|
+
import { VelcroncomponentArrayType, VelcronPrimitiveType } from "./VelcronTypes";
|
|
4
|
+
import { AssignOperators, VelcronHorizontalAlignments, VelcronIconTypes, VelcronActionTypes, VelcronSectionColumnWidthTypes, VerticalAlignments } from "./Enums";
|
|
5
|
+
export interface ResolvedComponentRenderer {
|
|
6
|
+
component: any;
|
|
7
|
+
definition: VelcronDefinition;
|
|
8
|
+
customComponent: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface BuiltInComponentRenderers {
|
|
11
|
+
"View": any;
|
|
12
|
+
"Card": any;
|
|
13
|
+
"Text": any;
|
|
14
|
+
"Image": any;
|
|
15
|
+
"Button": any;
|
|
16
|
+
"TextInput": any;
|
|
17
|
+
"ProgressCircle": any;
|
|
18
|
+
"WebView": any;
|
|
19
|
+
"CustomComponent": any;
|
|
20
|
+
"Dialog": any;
|
|
21
|
+
"Section": any;
|
|
22
|
+
"Icon": any;
|
|
23
|
+
}
|
|
24
|
+
export declare type DynamicViewModel = object;
|
|
25
|
+
export interface OnItemRenderedHookResult {
|
|
26
|
+
cssClass: Object;
|
|
27
|
+
}
|
|
28
|
+
export interface VelcronRenderContext {
|
|
29
|
+
id?: string;
|
|
30
|
+
rootContext: DynamicViewModel;
|
|
31
|
+
currentContext: DynamicViewModel;
|
|
32
|
+
actions?: {
|
|
33
|
+
[name: string]: [];
|
|
34
|
+
};
|
|
35
|
+
components?: Array<VelcronCustomComponentDefinition>;
|
|
36
|
+
properties?: {
|
|
37
|
+
[name: string]: VelcronPrimitiveType | VelcroncomponentArrayType;
|
|
38
|
+
};
|
|
39
|
+
computed?: {
|
|
40
|
+
[name: string]: [];
|
|
41
|
+
};
|
|
42
|
+
parent?: VelcronRenderContext;
|
|
43
|
+
hooks?: VelcronRenderContextHooks;
|
|
44
|
+
}
|
|
45
|
+
export interface VelcronRenderContextHooks {
|
|
46
|
+
dialogVisibilityChanged?: ((visible: boolean) => void);
|
|
47
|
+
onItemSelected?: ((item: VelcronDefinition) => void);
|
|
48
|
+
onItemRendered?: ((item: VelcronDefinition) => OnItemRenderedHookResult);
|
|
49
|
+
}
|
|
50
|
+
export interface VelcronAction extends VelcronRenderContext {
|
|
51
|
+
type: VelcronActionTypes;
|
|
52
|
+
}
|
|
53
|
+
export interface VelcronActionGetOrSetValue extends VelcronAction {
|
|
54
|
+
value?: unknown;
|
|
55
|
+
path: string;
|
|
56
|
+
id: string;
|
|
57
|
+
assignOperator?: AssignOperators;
|
|
58
|
+
}
|
|
59
|
+
export interface VelcronActionWithAutoAwait extends VelcronActionGetOrSetValue {
|
|
60
|
+
nowait: boolean;
|
|
61
|
+
action: string;
|
|
62
|
+
}
|
|
63
|
+
export interface VelcronActionWithCondition extends VelcronActionWithAutoAwait {
|
|
64
|
+
condition: string;
|
|
65
|
+
trueAction: VelcronAction;
|
|
66
|
+
falseAction: VelcronAction;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Velcron definition base
|
|
70
|
+
*/
|
|
71
|
+
export interface VelcronDefinitionBase {
|
|
72
|
+
/**
|
|
73
|
+
* The component type
|
|
74
|
+
*/
|
|
75
|
+
type: string;
|
|
76
|
+
/**
|
|
77
|
+
* Custom friendly name of the definition
|
|
78
|
+
*/
|
|
79
|
+
name?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Used for render cache if not specified we auto set it.
|
|
82
|
+
*/
|
|
83
|
+
key?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface VelcronDefinition extends VelcronDefinitionBase {
|
|
86
|
+
body?: Array<VelcronDefinition>;
|
|
87
|
+
style?: VelcronStyling;
|
|
88
|
+
foreach?: string;
|
|
89
|
+
if?: string;
|
|
90
|
+
events?: VelcronEvent;
|
|
91
|
+
}
|
|
92
|
+
export interface VelcronStyling {
|
|
93
|
+
margin?: number;
|
|
94
|
+
marginTop?: number;
|
|
95
|
+
marginRight?: number;
|
|
96
|
+
marginBottom?: number;
|
|
97
|
+
marginLeft?: number;
|
|
98
|
+
padding?: number;
|
|
99
|
+
paddingTop?: number;
|
|
100
|
+
paddingRight?: number;
|
|
101
|
+
paddingBottom?: number;
|
|
102
|
+
paddingLeft?: number;
|
|
103
|
+
height?: number | string;
|
|
104
|
+
width?: number | string;
|
|
105
|
+
}
|
|
106
|
+
export interface VelcronCardStyling extends VelcronStyling {
|
|
107
|
+
elevation: number;
|
|
108
|
+
}
|
|
109
|
+
export interface VelcronSpacing {
|
|
110
|
+
top: number;
|
|
111
|
+
right: number;
|
|
112
|
+
bottom: number;
|
|
113
|
+
left: number;
|
|
114
|
+
}
|
|
115
|
+
export interface VelcronIcon {
|
|
116
|
+
type: VelcronIconTypes;
|
|
117
|
+
name: string;
|
|
118
|
+
}
|
|
119
|
+
export interface VelcronAppDefinition extends VelcronDefinitionBase {
|
|
120
|
+
type: "App";
|
|
121
|
+
body?: Array<VelcronDefinition>;
|
|
122
|
+
events?: VelcronOnLoadEvent & VelcronOnPressEvent;
|
|
123
|
+
actions?: {
|
|
124
|
+
[name: string]: [];
|
|
125
|
+
};
|
|
126
|
+
components?: Array<VelcronCustomComponentDefinition>;
|
|
127
|
+
state?: DynamicViewModel;
|
|
128
|
+
computed?: {
|
|
129
|
+
[name: string]: [];
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export interface VelcronComponentDefinition extends VelcronDefinition {
|
|
133
|
+
type: string;
|
|
134
|
+
events: VelcronOnPressEvent;
|
|
135
|
+
}
|
|
136
|
+
/*** Built-in Components *********************************************************************/
|
|
137
|
+
export interface VelcronViewDefinition extends VelcronDefinition {
|
|
138
|
+
type: "View";
|
|
139
|
+
style?: VelcronStyling;
|
|
140
|
+
events?: VelcronOnPressEvent;
|
|
141
|
+
}
|
|
142
|
+
export interface VelcronCardDefinition extends VelcronDefinition {
|
|
143
|
+
type: "Card";
|
|
144
|
+
style?: VelcronCardStyling;
|
|
145
|
+
footer?: Array<VelcronDefinition>;
|
|
146
|
+
events?: VelcronOnPressEvent;
|
|
147
|
+
}
|
|
148
|
+
export interface VelcronTextDefinition extends VelcronDefinition {
|
|
149
|
+
type: "Text";
|
|
150
|
+
text: string;
|
|
151
|
+
color?: string;
|
|
152
|
+
size?: number;
|
|
153
|
+
events?: VelcronOnPressEvent;
|
|
154
|
+
}
|
|
155
|
+
export interface VelcronImageDefinition extends VelcronDefinition {
|
|
156
|
+
type: "Image";
|
|
157
|
+
source: string;
|
|
158
|
+
events?: VelcronOnPressEvent;
|
|
159
|
+
}
|
|
160
|
+
export interface VelcronButtonDefinition extends VelcronDefinition {
|
|
161
|
+
type: "Button";
|
|
162
|
+
text: string;
|
|
163
|
+
icon: VelcronIcon;
|
|
164
|
+
events?: VelcronOnPressEvent;
|
|
165
|
+
}
|
|
166
|
+
export interface VelcronTextInputDefinition extends VelcronDefinition {
|
|
167
|
+
type: "TextInput";
|
|
168
|
+
label?: string;
|
|
169
|
+
bind: string;
|
|
170
|
+
initialValue?: string;
|
|
171
|
+
events: VelcronOnChangedEvent;
|
|
172
|
+
}
|
|
173
|
+
export interface VelcronProgressCircleDefinition extends VelcronDefinition {
|
|
174
|
+
type: "ProgressCircle";
|
|
175
|
+
events?: VelcronOnPressEvent;
|
|
176
|
+
}
|
|
177
|
+
export interface VelcronWebViewDefinition extends VelcronDefinition {
|
|
178
|
+
type: "WebView";
|
|
179
|
+
source: string;
|
|
180
|
+
}
|
|
181
|
+
export interface VelcronDialogDefinition extends VelcronDefinition {
|
|
182
|
+
type: "Dialog";
|
|
183
|
+
title: string;
|
|
184
|
+
visible: string;
|
|
185
|
+
events?: VelcronOnCloseRequestedEvent & VelcronOnClosedEvent;
|
|
186
|
+
}
|
|
187
|
+
export interface VelcronIconDefinition extends VelcronDefinition {
|
|
188
|
+
type: "Icon";
|
|
189
|
+
icon: string;
|
|
190
|
+
color: string;
|
|
191
|
+
size?: number;
|
|
192
|
+
events?: VelcronOnPressEvent;
|
|
193
|
+
}
|
|
194
|
+
export interface VelcronSectionDefinition extends VelcronDefinition {
|
|
195
|
+
type: "Section";
|
|
196
|
+
columns: Array<VelcronSectionColumn>;
|
|
197
|
+
columnStyle?: object;
|
|
198
|
+
}
|
|
199
|
+
export interface VelcronSectionColumn extends VelcronDefinition {
|
|
200
|
+
body: Array<VelcronDefinition>;
|
|
201
|
+
horizontalAlignment?: VelcronHorizontalAlignments;
|
|
202
|
+
verticalAlignment?: VerticalAlignments;
|
|
203
|
+
width?: "auto" | "stretch" | number | string;
|
|
204
|
+
}
|
|
205
|
+
export interface VelcronSectionColumnWidth {
|
|
206
|
+
type: VelcronSectionColumnWidthTypes;
|
|
207
|
+
}
|
|
208
|
+
/*** Custom Components ***********************************************************************/
|
|
209
|
+
export declare type VelcronCustomComponentDefinition = VelcronComponentDescriptor & VelcronComponentDefinition;
|
|
210
|
+
export declare type VelcronRenderProps<TDefinition> = {
|
|
211
|
+
definition: TDefinition;
|
|
212
|
+
renderContext: VelcronRenderContext;
|
|
213
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { VelcronComponentPropertyEditors, VelcronDescriptorTypes, VelcronDataTypes } from "./Enums";
|
|
2
|
+
import { VelcroncomponentArrayType, VelcronPrimitiveType } from "./VelcronTypes";
|
|
3
|
+
export interface VelcronDescriptor {
|
|
4
|
+
descriptorType: VelcronDescriptorTypes;
|
|
5
|
+
icon: string;
|
|
6
|
+
}
|
|
7
|
+
export interface VelcronComponentDescriptor extends VelcronDescriptor {
|
|
8
|
+
descriptorType: VelcronDescriptorTypes.component;
|
|
9
|
+
type: string;
|
|
10
|
+
icon: string;
|
|
11
|
+
properties?: Array<VelcronComponentPropertyDescriptor | VelcronComponentArrayPropertyDescriptor>;
|
|
12
|
+
events?: Array<VelcronComponentEventDescriptor>;
|
|
13
|
+
}
|
|
14
|
+
export interface VelcronSubComponentDescriptor extends VelcronDescriptor {
|
|
15
|
+
descriptorType: VelcronDescriptorTypes.subComponent;
|
|
16
|
+
type: string;
|
|
17
|
+
icon: string;
|
|
18
|
+
properties?: Array<VelcronComponentPropertyDescriptor | VelcronComponentArrayPropertyDescriptor>;
|
|
19
|
+
events?: Array<VelcronComponentEventDescriptor>;
|
|
20
|
+
}
|
|
21
|
+
export interface VelcronComponentPropertyDescriptor {
|
|
22
|
+
name: string;
|
|
23
|
+
type: VelcronDataTypes;
|
|
24
|
+
editor?: VelcronComponentPropertyEditors;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
defaultValue?: VelcronPrimitiveType | VelcroncomponentArrayType;
|
|
27
|
+
}
|
|
28
|
+
export interface VelcronComponentArrayPropertyDescriptor extends VelcronComponentPropertyDescriptor {
|
|
29
|
+
type: VelcronDataTypes.componentArray;
|
|
30
|
+
subComponent: VelcronSubComponentDescriptor;
|
|
31
|
+
}
|
|
32
|
+
export interface VelcronComponentEventDescriptor {
|
|
33
|
+
name: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare type VelcronOnPressEvent = {
|
|
2
|
+
onPress?: Array<string>;
|
|
3
|
+
};
|
|
4
|
+
export declare type VelcronOnLoadEvent = {
|
|
5
|
+
onLoaded?: Array<string>;
|
|
6
|
+
};
|
|
7
|
+
export declare type VelcronOnChangedEvent = {
|
|
8
|
+
onChanged?: Array<string>;
|
|
9
|
+
};
|
|
10
|
+
export declare type VelcronOnCloseRequestedEvent = {
|
|
11
|
+
onCloseRequested?: Array<string>;
|
|
12
|
+
};
|
|
13
|
+
export declare type VelcronOnClosedEvent = {
|
|
14
|
+
onClosed?: Array<string>;
|
|
15
|
+
};
|
|
16
|
+
export declare type VelcronEvent = {};
|