dazscript-framework 0.1.14 → 0.1.16
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 +365 -93
- package/babel.config.js +33 -33
- package/dist/babel/trace-babel-plugin.js +243 -243
- package/dist/babel/trace-log-babel-plugin.js +164 -164
- package/dist/scripts/install-generator.js +185 -185
- package/package.json +72 -70
- package/src/common/dz-dump.ts +120 -120
- package/src/common/log.ts +56 -57
- package/src/common/trace.ts +26 -26
- package/src/core/action-decorator.ts +15 -15
- package/src/core/base-script.ts +30 -30
- package/src/core/custom-action.ts +11 -11
- package/src/core/global.ts +4 -4
- package/src/dialog/basic-dialog.ts +40 -32
- package/src/dialog/builders/button-builder.ts +52 -52
- package/src/dialog/builders/checkbox-builder.ts +29 -29
- package/src/dialog/builders/color-picker-builder.ts +36 -0
- package/src/dialog/builders/combo-box-builder.ts +38 -35
- package/src/dialog/builders/combo-edit-builder.ts +35 -35
- package/src/dialog/builders/dialog-builder.ts +49 -49
- package/src/dialog/builders/groupbox-builder.ts +121 -73
- package/src/dialog/builders/label-builder.ts +33 -29
- package/src/dialog/builders/layout-builder.ts +59 -59
- package/src/dialog/builders/line-edit-builder.ts +124 -119
- package/src/dialog/builders/list-box-builder.ts +103 -0
- package/src/dialog/builders/list-view-builder.ts +396 -328
- package/src/dialog/builders/node-selection-builder.ts +55 -55
- package/src/dialog/builders/path-combo-box-builder.ts +24 -24
- package/src/dialog/builders/popup-menu-builder.ts +46 -46
- package/src/dialog/builders/radio-builder.ts +42 -42
- package/src/dialog/builders/slider-builder.ts +40 -0
- package/src/dialog/builders/splitter-builder.ts +88 -88
- package/src/dialog/builders/tab-builder.ts +120 -106
- package/src/dialog/builders/widget-builder.ts +136 -124
- package/src/dialog/builders/widgets-builder.ts +140 -125
- package/src/dialog/input-dialog.ts +30 -27
- package/src/dialog/input-validator.ts +8 -8
- package/src/dialog/selection-dialog.ts +47 -0
- package/src/dialog/shared.ts +8 -8
- package/src/helpers/action-helper.ts +214 -81
- package/src/helpers/array-helper.ts +170 -145
- package/src/helpers/camera-helper.ts +12 -12
- package/src/helpers/custom-action-helper.ts +176 -176
- package/src/helpers/directory-helper.ts +14 -0
- package/src/helpers/file-helper.ts +90 -90
- package/src/helpers/http-helper.ts +186 -0
- package/src/helpers/input-helper.ts +18 -18
- package/src/helpers/list-view-helper.ts +105 -89
- package/src/helpers/menu-helper.ts +28 -28
- package/src/helpers/message-box-helper.ts +25 -15
- package/src/helpers/node-helper.ts +461 -236
- package/src/helpers/number-helper.ts +10 -10
- package/src/helpers/numeric-property-helper.ts +91 -91
- package/src/helpers/object-helper.ts +2 -2
- package/src/helpers/pane-helper.ts +28 -20
- package/src/helpers/progress-helper.ts +51 -33
- package/src/helpers/property-helper.ts +61 -52
- package/src/helpers/record-helper.ts +16 -16
- package/src/helpers/scene-helper.ts +144 -95
- package/src/helpers/script-helper.ts +15 -15
- package/src/helpers/skeleton-helper.ts +26 -26
- package/src/helpers/splitter-helper.ts +8 -8
- package/src/helpers/string-helper.ts +39 -31
- package/src/helpers/surface-helper.ts +5 -5
- package/src/helpers/undo-helper.ts +8 -7
- package/src/helpers/viewport-helper.ts +21 -8
- package/src/lib/delayed.ts +38 -38
- package/src/lib/dictionary.ts +3 -0
- package/src/lib/frame-keys.ts +67 -67
- package/src/lib/guid.ts +2 -2
- package/src/lib/menu-item.ts +10 -9
- package/src/lib/observable.ts +147 -94
- package/src/lib/set.ts +50 -25
- package/src/lib/settings.ts +112 -104
- package/src/lib/tree-node.ts +149 -145
- package/src/samples/config.ts +2 -2
- package/src/samples/hello-world.dsa.ts +12 -12
- package/src/samples/sample-dialog.dsa.ts +51 -51
- package/src/samples/sample-dialog.ts +48 -48
- package/src/shared/set-keyboard-shortcut.ts +146 -102
- package/tsconfig.json +116 -116
- package/webpack.config.js +70 -70
package/src/common/dz-dump.ts
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
import { any } from '@dsf/helpers/array-helper';
|
|
2
|
-
import { contains, count, remove } from '@dsf/helpers/string-helper';
|
|
3
|
-
|
|
4
|
-
function isUpperCase(myString: string) {
|
|
5
|
-
return (myString === myString.toUpperCase());
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
var lines = [];
|
|
9
|
-
function processLine(x: string): void {
|
|
10
|
-
x = remove(x, "*");
|
|
11
|
-
x = x.replace("const ", "");
|
|
12
|
-
x = x.replace(/\(([a-zA-Z0-9]*),/, "(#{arg}:$1,");
|
|
13
|
-
x = x.replace(/,([a-zA-Z0-9]*)\)/, ", #{arg}:$1)");
|
|
14
|
-
x = x.replace(/,([a-zA-Z0-9]\w*)/g, ", #{arg}:$1");
|
|
15
|
-
while (contains(x, "#{arg}")) {
|
|
16
|
-
var n = count(x, "#{arg}") - 1;
|
|
17
|
-
x = x.replace(new RegExp('#{arg}(?!.*#{arg})'), `p${n}`);
|
|
18
|
-
}
|
|
19
|
-
x = x.replace(/(int|float)/g, "number");
|
|
20
|
-
x = x.replace(/(bool)/g, "boolean");
|
|
21
|
-
x = x.replace(/(QString)/g, "string");
|
|
22
|
-
x = x.replace(/(QPonumber)/g, "number");
|
|
23
|
-
x = x.replace(/\((\w*\))/, "(p0:$1");
|
|
24
|
-
x = x.replace(/\((\w*\))/, "(p0:$1");
|
|
25
|
-
x = x.replace("p0:)", ")");
|
|
26
|
-
lines.push(" " + x + ": any;");
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// Keep track of classes avoiding duplicates
|
|
30
|
-
var classesFound = {};
|
|
31
|
-
|
|
32
|
-
export function dz_dump(obj: any) {
|
|
33
|
-
if (!obj || obj === null) {
|
|
34
|
-
print('null object');
|
|
35
|
-
App.flushLogBuffer()
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var className = null;
|
|
40
|
-
var enumerations = [];
|
|
41
|
-
var properties = [];
|
|
42
|
-
var functions = [];
|
|
43
|
-
var signals = [];
|
|
44
|
-
|
|
45
|
-
// is DAZ object?
|
|
46
|
-
if (obj["className"]) {
|
|
47
|
-
className = obj.className();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// already seen? leave
|
|
51
|
-
if (classesFound[className]) return;
|
|
52
|
-
|
|
53
|
-
for (var name in obj) {
|
|
54
|
-
var o = obj[name];
|
|
55
|
-
if (typeof o == "function") {
|
|
56
|
-
if (any(["Changed", "Requested", "Renamed", "Clicked", "Pressed"], x => contains(name, x)))
|
|
57
|
-
signals.push(name);
|
|
58
|
-
else
|
|
59
|
-
functions.push(name);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
if (isUpperCase(name[0]))
|
|
63
|
-
enumerations.push(name);
|
|
64
|
-
else
|
|
65
|
-
properties.push(name);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
properties.sort();
|
|
69
|
-
functions.sort();
|
|
70
|
-
signals.sort();
|
|
71
|
-
|
|
72
|
-
lines.push("");
|
|
73
|
-
lines.push("/**");
|
|
74
|
-
lines.push(" * class " + className);
|
|
75
|
-
lines.push(" */");
|
|
76
|
-
lines.push("declare class " + className + " {");
|
|
77
|
-
|
|
78
|
-
if (enumerations.length > 0) {
|
|
79
|
-
lines.push("");
|
|
80
|
-
lines.push(" //#region Enumerations");
|
|
81
|
-
enumerations.forEach(function (x) {
|
|
82
|
-
lines.push(" static " + x + ": " + typeof obj[x] + "; // " + (obj[x]));
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
lines.push(" //#endregion");
|
|
86
|
-
lines.push("");
|
|
87
|
-
lines.push(" // Properties");
|
|
88
|
-
|
|
89
|
-
properties.forEach(function (x) {
|
|
90
|
-
lines.push(" " + x + ": " + typeof obj[x] + "; // " + (obj[x]));
|
|
91
|
-
});
|
|
92
|
-
lines.push("");
|
|
93
|
-
lines.push(" // Methods");
|
|
94
|
-
|
|
95
|
-
// Process LineFunctions
|
|
96
|
-
functions.forEach(processLine);
|
|
97
|
-
|
|
98
|
-
// Process Signals
|
|
99
|
-
if (signals.length > 0) {
|
|
100
|
-
lines.push("");
|
|
101
|
-
lines.push(" // Signals");
|
|
102
|
-
signals.forEach(processLine);
|
|
103
|
-
}
|
|
104
|
-
lines.push("}");
|
|
105
|
-
|
|
106
|
-
classesFound[className] = lines.join('\r\n');
|
|
107
|
-
|
|
108
|
-
// output classes found
|
|
109
|
-
for (var name in classesFound) {
|
|
110
|
-
print(classesFound[name]);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// =======================================
|
|
116
|
-
// =======================================
|
|
117
|
-
// =======================================
|
|
118
|
-
//dump(new DzERCLink());
|
|
119
|
-
// =======================================
|
|
120
|
-
// =======================================
|
|
1
|
+
import { any } from '@dsf/helpers/array-helper';
|
|
2
|
+
import { contains, count, remove } from '@dsf/helpers/string-helper';
|
|
3
|
+
|
|
4
|
+
function isUpperCase(myString: string) {
|
|
5
|
+
return (myString === myString.toUpperCase());
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
var lines = [];
|
|
9
|
+
function processLine(x: string): void {
|
|
10
|
+
x = remove(x, "*");
|
|
11
|
+
x = x.replace("const ", "");
|
|
12
|
+
x = x.replace(/\(([a-zA-Z0-9]*),/, "(#{arg}:$1,");
|
|
13
|
+
x = x.replace(/,([a-zA-Z0-9]*)\)/, ", #{arg}:$1)");
|
|
14
|
+
x = x.replace(/,([a-zA-Z0-9]\w*)/g, ", #{arg}:$1");
|
|
15
|
+
while (contains(x, "#{arg}")) {
|
|
16
|
+
var n = count(x, "#{arg}") - 1;
|
|
17
|
+
x = x.replace(new RegExp('#{arg}(?!.*#{arg})'), `p${n}`);
|
|
18
|
+
}
|
|
19
|
+
x = x.replace(/(int|float)/g, "number");
|
|
20
|
+
x = x.replace(/(bool)/g, "boolean");
|
|
21
|
+
x = x.replace(/(QString)/g, "string");
|
|
22
|
+
x = x.replace(/(QPonumber)/g, "number");
|
|
23
|
+
x = x.replace(/\((\w*\))/, "(p0:$1");
|
|
24
|
+
x = x.replace(/\((\w*\))/, "(p0:$1");
|
|
25
|
+
x = x.replace("p0:)", ")");
|
|
26
|
+
lines.push(" " + x + ": any;");
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// Keep track of classes avoiding duplicates
|
|
30
|
+
var classesFound = {};
|
|
31
|
+
|
|
32
|
+
export default function dz_dump(obj: any): void {
|
|
33
|
+
if (!obj || obj === null) {
|
|
34
|
+
print('null object');
|
|
35
|
+
App.flushLogBuffer()
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var className = null;
|
|
40
|
+
var enumerations = [];
|
|
41
|
+
var properties = [];
|
|
42
|
+
var functions = [];
|
|
43
|
+
var signals = [];
|
|
44
|
+
|
|
45
|
+
// is DAZ object?
|
|
46
|
+
if (obj["className"]) {
|
|
47
|
+
className = obj.className();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// already seen? leave
|
|
51
|
+
if (classesFound[className]) return;
|
|
52
|
+
|
|
53
|
+
for (var name in obj) {
|
|
54
|
+
var o = obj[name];
|
|
55
|
+
if (typeof o == "function") {
|
|
56
|
+
if (any(["Changed", "Requested", "Renamed", "Clicked", "Pressed"], x => contains(name, x)))
|
|
57
|
+
signals.push(name);
|
|
58
|
+
else
|
|
59
|
+
functions.push(name);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (isUpperCase(name[0]))
|
|
63
|
+
enumerations.push(name);
|
|
64
|
+
else
|
|
65
|
+
properties.push(name);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
properties.sort();
|
|
69
|
+
functions.sort();
|
|
70
|
+
signals.sort();
|
|
71
|
+
|
|
72
|
+
lines.push("");
|
|
73
|
+
lines.push("/**");
|
|
74
|
+
lines.push(" * class " + className);
|
|
75
|
+
lines.push(" */");
|
|
76
|
+
lines.push("declare class " + className + " {");
|
|
77
|
+
|
|
78
|
+
if (enumerations.length > 0) {
|
|
79
|
+
lines.push("");
|
|
80
|
+
lines.push(" //#region Enumerations");
|
|
81
|
+
enumerations.forEach(function (x) {
|
|
82
|
+
lines.push(" static " + x + ": " + typeof obj[x] + "; // " + (obj[x]));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
lines.push(" //#endregion");
|
|
86
|
+
lines.push("");
|
|
87
|
+
lines.push(" // Properties");
|
|
88
|
+
|
|
89
|
+
properties.forEach(function (x) {
|
|
90
|
+
lines.push(" " + x + ": " + typeof obj[x] + "; // " + (obj[x]));
|
|
91
|
+
});
|
|
92
|
+
lines.push("");
|
|
93
|
+
lines.push(" // Methods");
|
|
94
|
+
|
|
95
|
+
// Process LineFunctions
|
|
96
|
+
functions.forEach(processLine);
|
|
97
|
+
|
|
98
|
+
// Process Signals
|
|
99
|
+
if (signals.length > 0) {
|
|
100
|
+
lines.push("");
|
|
101
|
+
lines.push(" // Signals");
|
|
102
|
+
signals.forEach(processLine);
|
|
103
|
+
}
|
|
104
|
+
lines.push("}");
|
|
105
|
+
|
|
106
|
+
classesFound[className] = lines.join('\r\n');
|
|
107
|
+
|
|
108
|
+
// output classes found
|
|
109
|
+
for (var name in classesFound) {
|
|
110
|
+
print(classesFound[name]);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// =======================================
|
|
116
|
+
// =======================================
|
|
117
|
+
// =======================================
|
|
118
|
+
//dump(new DzERCLink());
|
|
119
|
+
// =======================================
|
|
120
|
+
// =======================================
|
|
121
121
|
// =======================================
|
package/src/common/log.ts
CHANGED
|
@@ -1,57 +1,56 @@
|
|
|
1
|
-
import * as global from '@dsf/core/global'
|
|
2
|
-
|
|
3
|
-
export const debug = (message: any) => {
|
|
4
|
-
App.debug(format(message))
|
|
5
|
-
App.flushLogBuffer()
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const info = (message: any) => {
|
|
9
|
-
global.app.log(format(message))
|
|
10
|
-
App.flushLogBuffer()
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const error = (message: any) => {
|
|
14
|
-
App.warning(format(message, "ERROR"))
|
|
15
|
-
App.flushLogBuffer()
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const warn = (message: any) => {
|
|
19
|
-
App.warning(message)
|
|
20
|
-
App.flushLogBuffer()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const trace = (message: any) => {
|
|
24
|
-
App.debug(format(message, "TRACE"))
|
|
25
|
-
App.flushLogBuffer()
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const status = (message: any, log: boolean = true) => {
|
|
29
|
-
App.statusLine(message, log)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Log the error and raise an exception
|
|
34
|
-
* @param err
|
|
35
|
-
*/
|
|
36
|
-
export const raise = (err: string) => {
|
|
37
|
-
error(err)
|
|
38
|
-
throw Error(err)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const dump = (obj: any) => {
|
|
42
|
-
App.debug(`[DUMP]\r\n${JSON.stringify(obj, null, 2)}`)
|
|
43
|
-
App.flushLogBuffer()
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
import * as global from '@dsf/core/global'
|
|
2
|
+
|
|
3
|
+
export const debug = (message: any) => {
|
|
4
|
+
App.debug(format(message))
|
|
5
|
+
App.flushLogBuffer()
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const info = (message: any) => {
|
|
9
|
+
global.app.log(format(message))
|
|
10
|
+
App.flushLogBuffer()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const error = (message: any) => {
|
|
14
|
+
App.warning(format(message, "ERROR"))
|
|
15
|
+
App.flushLogBuffer()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const warn = (message: any) => {
|
|
19
|
+
App.warning(message)
|
|
20
|
+
App.flushLogBuffer()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const trace = (message: any) => {
|
|
24
|
+
App.debug(format(message, "TRACE"))
|
|
25
|
+
App.flushLogBuffer()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const status = (message: any, log: boolean = true) => {
|
|
29
|
+
App.statusLine(message, log)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Log the error and raise an exception
|
|
34
|
+
* @param err
|
|
35
|
+
*/
|
|
36
|
+
export const raise = (err: string) => {
|
|
37
|
+
error(err)
|
|
38
|
+
throw Error(err)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const dump = (obj: any) => {
|
|
42
|
+
App.debug(`[DUMP]\r\n${JSON.stringify(obj, null, 2)}`)
|
|
43
|
+
App.flushLogBuffer()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const format = (message: string, level?: 'ERROR' | 'TRACE' | 'DUMP' | 'INFO') => {
|
|
47
|
+
if (message == null) {
|
|
48
|
+
return ''
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let text = message
|
|
52
|
+
|
|
53
|
+
if (level) text = `[${level}] ${text}`
|
|
54
|
+
return text
|
|
55
|
+
}
|
|
56
|
+
|
package/src/common/trace.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { app } from '@dsf/core/global';
|
|
2
|
-
|
|
3
|
-
export function trace(enabled: boolean = true) {
|
|
4
|
-
return function (target: any, key?: string, descriptor?: PropertyDescriptor) {
|
|
5
|
-
if (key !== undefined && descriptor !== undefined) {
|
|
6
|
-
// Applied to a method
|
|
7
|
-
if (!enabled)
|
|
8
|
-
return descriptor
|
|
9
|
-
|
|
10
|
-
const originalMethod = descriptor.value;
|
|
11
|
-
descriptor.value = function (...args: any[]) {
|
|
12
|
-
app.debug(`[TRACE] Entering method: ${key}`);
|
|
13
|
-
app.flushLogBuffer()
|
|
14
|
-
const result = originalMethod.apply(this, args);
|
|
15
|
-
app.debug(`[TRACE] Exiting method: ${key}`);
|
|
16
|
-
app.flushLogBuffer()
|
|
17
|
-
return result;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return descriptor;
|
|
21
|
-
} else if (key === undefined && descriptor === undefined) {
|
|
22
|
-
// Applied to a class
|
|
23
|
-
return target;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
import { app } from '@dsf/core/global';
|
|
2
|
+
|
|
3
|
+
export function trace(enabled: boolean = true) {
|
|
4
|
+
return function (target: any, key?: string, descriptor?: PropertyDescriptor) {
|
|
5
|
+
if (key !== undefined && descriptor !== undefined) {
|
|
6
|
+
// Applied to a method
|
|
7
|
+
if (!enabled)
|
|
8
|
+
return descriptor
|
|
9
|
+
|
|
10
|
+
const originalMethod = descriptor.value;
|
|
11
|
+
descriptor.value = function (...args: any[]) {
|
|
12
|
+
app.debug(`[TRACE] Entering method: ${key}`);
|
|
13
|
+
app.flushLogBuffer()
|
|
14
|
+
const result = originalMethod.apply(this, args);
|
|
15
|
+
app.debug(`[TRACE] Exiting method: ${key}`);
|
|
16
|
+
app.flushLogBuffer()
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return descriptor;
|
|
21
|
+
} else if (key === undefined && descriptor === undefined) {
|
|
22
|
+
// Applied to a class
|
|
23
|
+
return target;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
class CustomActionDefinition {
|
|
2
|
-
text?: string
|
|
3
|
-
description?: string
|
|
4
|
-
icon?: string
|
|
5
|
-
menuPath?: string | boolean
|
|
6
|
-
toolbar?: string
|
|
7
|
-
sort?: number
|
|
8
|
-
group?: string
|
|
9
|
-
shortcut?: string
|
|
10
|
-
bundle?: string | boolean
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const action = (action?: CustomActionDefinition) => {
|
|
14
|
-
return (target: Function) => {
|
|
15
|
-
}
|
|
1
|
+
class CustomActionDefinition {
|
|
2
|
+
text?: string
|
|
3
|
+
description?: string
|
|
4
|
+
icon?: string
|
|
5
|
+
menuPath?: string | boolean
|
|
6
|
+
toolbar?: string
|
|
7
|
+
sort?: number
|
|
8
|
+
group?: string
|
|
9
|
+
shortcut?: string
|
|
10
|
+
bundle?: string | boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const action = (action?: CustomActionDefinition) => {
|
|
14
|
+
return (target: Function) => {
|
|
15
|
+
}
|
|
16
16
|
}
|
package/src/core/base-script.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { debug, error, raise } from '@dsf/common/log';
|
|
2
|
-
import { acceptUndo } from '@dsf/helpers/undo-helper';
|
|
3
|
-
|
|
4
|
-
export abstract class BaseScript {
|
|
5
|
-
protected readonly scriptName: string
|
|
6
|
-
protected anounceExecution: boolean = true
|
|
7
|
-
|
|
8
|
-
constructor() {
|
|
9
|
-
this.scriptName = (<any>this.constructor).name;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
protected abstract run(): void
|
|
13
|
-
|
|
14
|
-
exec() {
|
|
15
|
-
if (this.anounceExecution) {
|
|
16
|
-
debug(`=== Running script "${this.scriptName}" ===`)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
this.run()
|
|
21
|
-
} catch (err) {
|
|
22
|
-
error(`There was an error while running the script "${this.scriptName}"`)
|
|
23
|
-
raise(err)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
protected acceptUndo(callback: () => void) {
|
|
28
|
-
acceptUndo(this.scriptName, callback);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
import { debug, error, raise } from '@dsf/common/log';
|
|
2
|
+
import { acceptUndo } from '@dsf/helpers/undo-helper';
|
|
3
|
+
|
|
4
|
+
export abstract class BaseScript {
|
|
5
|
+
protected readonly scriptName: string
|
|
6
|
+
protected anounceExecution: boolean = true
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
this.scriptName = (<any>this.constructor).name;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
protected abstract run(): void
|
|
13
|
+
|
|
14
|
+
exec() {
|
|
15
|
+
if (this.anounceExecution) {
|
|
16
|
+
debug(`=== Running script "${this.scriptName}" ===`)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
this.run()
|
|
21
|
+
} catch (err) {
|
|
22
|
+
error(`There was an error while running the script "${this.scriptName}"`)
|
|
23
|
+
raise(err)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
protected acceptUndo(callback: () => void) {
|
|
28
|
+
acceptUndo(this.scriptName, callback);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export class CustomAction {
|
|
2
|
-
name
|
|
3
|
-
text
|
|
4
|
-
description
|
|
5
|
-
filePath
|
|
6
|
-
menuPath
|
|
7
|
-
icon?: string
|
|
8
|
-
toolbar?: string
|
|
9
|
-
sort?: number
|
|
10
|
-
group?: string
|
|
11
|
-
shortcut?: string
|
|
1
|
+
export class CustomAction {
|
|
2
|
+
name?: string | null
|
|
3
|
+
text?: string | null
|
|
4
|
+
description?: string | null
|
|
5
|
+
filePath?: string | null
|
|
6
|
+
menuPath?: string | null
|
|
7
|
+
icon?: string | null
|
|
8
|
+
toolbar?: string | null
|
|
9
|
+
sort?: number | null
|
|
10
|
+
group?: string | null
|
|
11
|
+
shortcut?: string | null
|
|
12
12
|
}
|
package/src/core/global.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const app = App
|
|
2
|
-
export const scene = Scene
|
|
3
|
-
export const mainWindow = MainWindow
|
|
4
|
-
export const sceneHelper = new DzSceneHelper()
|
|
1
|
+
export const app = App
|
|
2
|
+
export const scene = Scene
|
|
3
|
+
export const mainWindow = MainWindow
|
|
4
|
+
export const sceneHelper = new DzSceneHelper()
|
|
5
5
|
export const arrayHelper = new DzArrayHelper()
|
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
import { DialogBuilder } from '@dsf/dialog/builders/dialog-builder';
|
|
2
|
-
|
|
3
|
-
export abstract class BasicDialog {
|
|
4
|
-
protected dialog: DzBasicDialog
|
|
5
|
-
protected readonly builder: DialogBuilder
|
|
6
|
-
|
|
7
|
-
protected get add(): DialogBuilder {
|
|
8
|
-
return this.builder
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
constructor(name: string, id?: string) {
|
|
12
|
-
this.builder = new DialogBuilder(name, id)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
protected abstract build(): void
|
|
16
|
-
|
|
17
|
-
protected init() {
|
|
18
|
-
this.builder.build(() => {
|
|
19
|
-
this.dialog = this.builder.context.dialog
|
|
20
|
-
this.build()
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
run(): boolean {
|
|
25
|
-
this.init()
|
|
26
|
-
return this.dialog.exec()
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
-
}
|
|
32
|
-
|
|
1
|
+
import { DialogBuilder } from '@dsf/dialog/builders/dialog-builder';
|
|
2
|
+
|
|
3
|
+
export abstract class BasicDialog {
|
|
4
|
+
protected dialog: DzBasicDialog
|
|
5
|
+
protected readonly builder: DialogBuilder
|
|
6
|
+
|
|
7
|
+
protected get add(): DialogBuilder {
|
|
8
|
+
return this.builder
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
constructor(name: string, id?: string) {
|
|
12
|
+
this.builder = new DialogBuilder(name, id)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
protected abstract build(): void
|
|
16
|
+
|
|
17
|
+
protected init() {
|
|
18
|
+
this.builder.build(() => {
|
|
19
|
+
this.dialog = this.builder.context.dialog
|
|
20
|
+
this.build()
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
run(): boolean {
|
|
25
|
+
this.init()
|
|
26
|
+
return this.dialog.exec()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
ok(): boolean {
|
|
30
|
+
return this.run() === true
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
cancel(): boolean {
|
|
34
|
+
return this.run() === false
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
close() {
|
|
38
|
+
this.dialog.close()
|
|
39
|
+
}
|
|
40
|
+
}
|