@magic-xpa/cli 4.1100.0-dev4110.171 → 4.1100.0-dev4110.181
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/index.d.ts +1 -1
- package/index.js +4 -4
- package/package.json +1 -1
- package/src/public_api.d.ts +3 -3
- package/src/public_api.js +6 -6
- package/src/schematics/magic-utils/Util.d.ts +6 -6
- package/src/schematics/magic-utils/Util.js +26 -26
- package/src/schematics/magic-utils/config.d.ts +12 -12
- package/src/schematics/magic-utils/config.js +56 -56
- package/src/schematics/magic-utils/env.d.ts +23 -23
- package/src/schematics/magic-utils/env.js +39 -39
- package/src/schematics/magic-utils/env.js.map +1 -1
- package/src/schematics/magic-utils/env.ts +5 -5
- package/src/schematics/magic-utils/manifest.d.ts +11 -11
- package/src/schematics/magic-utils/manifest.js +40 -40
- package/src/schematics/magic-utils/manifest.js.map +1 -1
- package/src/schematics/magic-utils/metadata.class.d.ts +51 -51
- package/src/schematics/magic-utils/metadata.class.js +124 -124
- package/src/schematics/magic-utils/metadata.class.js.map +1 -1
- package/src/schematics/magic-utils/process-json.d.ts +2 -2
- package/src/schematics/magic-utils/process-json.js +158 -158
- package/src/schematics/magic-utils/process-json.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-control.rule.d.ts +5 -5
- package/src/schematics/magic-utils/rules/build-control.rule.js +74 -74
- package/src/schematics/magic-utils/rules/build-control.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-view.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/build-view.rule.js +83 -83
- package/src/schematics/magic-utils/rules/component-list.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/component-list.rule.js +317 -317
- package/src/schematics/magic-utils/rules/component-list.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/generate.rule.d.ts +5 -5
- package/src/schematics/magic-utils/rules/generate.rule.js +54 -54
- package/src/schematics/magic-utils/rules/generate.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-add-modules.rule.d.ts +12 -12
- package/src/schematics/magic-utils/rules/init-add-modules.rule.js +296 -296
- package/src/schematics/magic-utils/rules/init-add-modules.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-gen-components.rule.d.ts +4 -4
- package/src/schematics/magic-utils/rules/init-gen-components.rule.js +66 -66
- package/src/schematics/magic-utils/rules/init-gen-components.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js +18 -18
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/load-views-gen.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/load-views-gen.rule.js +29 -29
- package/src/schematics/magic-utils/rules/magic-option.scheme.d.ts +22 -22
- package/src/schematics/magic-utils/rules/magic-option.scheme.js +2 -2
- package/src/schematics/magic-utils/utils.d.ts +12 -12
- package/src/schematics/magic-utils/utils.js +117 -117
- package/src/schematics/magic-utils/utils.js.map +1 -1
- package/src/schematics/mg-Install-prerequisites/index.d.ts +3 -3
- package/src/schematics/mg-Install-prerequisites/index.js +25 -25
- package/src/schematics/mg-Install-prerequisites/index.js.map +1 -1
- package/src/schematics/mg-add/files/src/app/magic/magic.gen.lib.module.ts +19 -19
- package/src/schematics/mg-add/index.d.ts +3 -3
- package/src/schematics/mg-add/index.js +151 -151
- package/src/schematics/mg-add/index.js.map +1 -1
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.d.ts +2 -2
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.js +11 -11
- package/src/schematics/mg-add-tasks/index.d.ts +3 -3
- package/src/schematics/mg-add-tasks/index.js +30 -30
- package/src/schematics/mg-delete-files/index.d.ts +3 -3
- package/src/schematics/mg-delete-files/index.js +13 -13
- package/src/schematics/mg-gen-module/index.d.ts +3 -3
- package/src/schematics/mg-gen-module/index.js +15 -15
- package/src/schematics/mg-generate/index.d.ts +3 -3
- package/src/schematics/mg-generate/index.js +13 -13
- package/src/schematics/mg-generate-component/index.d.ts +3 -3
- package/src/schematics/mg-generate-component/index.js +35 -35
- package/src/schematics/mg-generate-component/index.js.map +1 -1
- package/src/schematics/mg-install/index.d.ts +3 -3
- package/src/schematics/mg-install/index.js +30 -30
- package/src/schematics/mg-install/index.js.map +1 -1
- package/src/schematics/mg-routes/index.d.ts +6 -6
- package/src/schematics/mg-routes/index.js +63 -63
- package/src/schematics/mg-routes/index.js.map +1 -1
- package/src/schematics/mg-single-control/index.d.ts +3 -3
- package/src/schematics/mg-single-control/index.js +29 -29
- package/src/schematics/utils/ast.d.ts +21 -21
- package/src/schematics/utils/ast.js +91 -91
- package/src/schematics/utils/ast.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils.d.ts +87 -87
- package/src/schematics/utils/devkit-utils/ast-utils.js +490 -490
- package/src/schematics/utils/devkit-utils/ast-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils_old.d.ts +68 -68
- package/src/schematics/utils/devkit-utils/ast-utils_old.js +420 -420
- package/src/schematics/utils/devkit-utils/ast-utils_old.js.map +1 -1
- package/src/schematics/utils/devkit-utils/change.d.ts +66 -66
- package/src/schematics/utils/devkit-utils/change.js +94 -94
- package/src/schematics/utils/devkit-utils/change.js.map +1 -1
- package/src/schematics/utils/devkit-utils/component.d.ts +2 -2
- package/src/schematics/utils/devkit-utils/component.js +97 -97
- package/src/schematics/utils/devkit-utils/component.js.map +1 -1
- package/src/schematics/utils/devkit-utils/config.d.ts +78 -78
- package/src/schematics/utils/devkit-utils/config.js +52 -52
- package/src/schematics/utils/devkit-utils/config.js.map +1 -1
- package/src/schematics/utils/devkit-utils/find-module.d.ts +28 -28
- package/src/schematics/utils/devkit-utils/find-module.js +93 -93
- package/src/schematics/utils/devkit-utils/find-module.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ng-ast-utils.d.ts +5 -5
- package/src/schematics/utils/devkit-utils/ng-ast-utils.js +74 -74
- package/src/schematics/utils/devkit-utils/ng-ast-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/parse-name.d.ts +13 -13
- package/src/schematics/utils/devkit-utils/parse-name.js +20 -20
- package/src/schematics/utils/devkit-utils/route-utils.d.ts +20 -20
- package/src/schematics/utils/devkit-utils/route-utils.js +134 -134
- package/src/schematics/utils/devkit-utils/route-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/validation.d.ts +1 -1
- package/src/schematics/utils/devkit-utils/validation.js +18 -18
- package/src/schematics/utils/devkit-utils/validation.js.map +1 -1
- package/src/schematics/utils/html.d.ts +18 -18
- package/src/schematics/utils/html.js +60 -60
- package/src/schematics/utils/html.js.map +1 -1
- package/src/schematics/utils/lib-versions.d.ts +3 -3
- package/src/schematics/utils/lib-versions.js +6 -6
- package/src/schematics/utils/package.d.ts +5 -5
- package/src/schematics/utils/package.js +21 -21
- package/src/schematics/utils/package.js.map +1 -1
- package/src/schematics/utils/testing.d.ts +5 -5
- package/src/schematics/utils/testing.js +27 -27
- package/src/schematics/utils/testing.js.map +1 -1
- package/src/schematics/utils/testing.ts +2 -2
- package/src/types/enums/Enums.d.ts +1646 -1646
- package/src/types/enums/Enums.js +1862 -1862
- package/src/types/enums/Enums.js.map +1 -1
- package/src/types/enums/generated-file-types.enum.d.ts +6 -6
- package/src/types/enums/generated-file-types.enum.js +10 -10
- package/src/types/enums/generated-file-types.enum.js.map +1 -1
- package/src/types/enums/horizontal-alignments.enum.d.ts +5 -5
- package/src/types/enums/horizontal-alignments.enum.js +9 -9
- package/src/types/enums/horizontal-alignments.enum.js.map +1 -1
- package/src/types/enums/themes.enum.d.ts +6 -6
- package/src/types/enums/themes.enum.js +10 -10
- package/src/types/enums/themes.enum.js.map +1 -1
- package/src/types/index.d.ts +7 -7
- package/src/types/index.js +10 -10
- package/src/types/interfaces/app.d.ts +53 -53
- package/src/types/interfaces/app.js +9 -9
- package/src/types/interfaces/control.d.ts +82 -82
- package/src/types/interfaces/control.js +2 -2
- package/src/types/interfaces/env.interface.d.ts +19 -19
- package/src/types/interfaces/env.interface.js +10 -10
- package/src/types/interfaces/template.config.d.ts +8 -8
- package/src/types/interfaces/template.config.js +2 -2
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processJson = void 0;
|
|
4
|
-
const Util_1 = require("./Util");
|
|
5
|
-
const util_1 = require("util");
|
|
6
|
-
const Enums_1 = require("../../../src/types/enums/Enums");
|
|
7
|
-
// mapping for properties which are implemented using a class
|
|
8
|
-
const Map = {
|
|
9
|
-
style: [
|
|
10
|
-
{
|
|
11
|
-
name: 'font',
|
|
12
|
-
suffix: 'mgFont'
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: 'focus_color',
|
|
16
|
-
suffix: 'mgFocusColor'
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: 'border_color',
|
|
20
|
-
suffix: 'mgBorderColor'
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: 'border',
|
|
24
|
-
options: {
|
|
25
|
-
"false": 'hidden_border'
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'border_style',
|
|
30
|
-
options: {
|
|
31
|
-
"1": 'twod_border',
|
|
32
|
-
"2": 'threed_border',
|
|
33
|
-
"3": 'threedsunken_border',
|
|
34
|
-
"4": 'windows_border',
|
|
35
|
-
"5": 'windows_border',
|
|
36
|
-
"6": 'emboss_border',
|
|
37
|
-
"7": 'hidden_border'
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: 'multiline_edit',
|
|
42
|
-
options: {
|
|
43
|
-
"true": 'multiline',
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
props: [],
|
|
48
|
-
hint: []
|
|
49
|
-
};
|
|
50
|
-
//////////////////////////////////////////////////////////////////
|
|
51
|
-
// process the views' json, find the classes used for each control
|
|
52
|
-
//////////////////////////////////////////////////////////////////
|
|
53
|
-
function processJson(appJson) {
|
|
54
|
-
const views$ = Object.assign([], appJson.views);
|
|
55
|
-
appJson.views.length = 0;
|
|
56
|
-
// loop on all views
|
|
57
|
-
views$.forEach(view$ => {
|
|
58
|
-
if (view$) {
|
|
59
|
-
(0, Util_1.LogLn)(`[>] Processing JSON file for component ${view$.props.id}`);
|
|
60
|
-
processControl(view$);
|
|
61
|
-
appJson.views.push(view$);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
return appJson;
|
|
65
|
-
}
|
|
66
|
-
exports.processJson = processJson;
|
|
67
|
-
function CalcClassForControl(control, controlClasses) {
|
|
68
|
-
if (control.controlType != Enums_1.MgControlType.CTRL_TYPE_TABPAGE) {
|
|
69
|
-
if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_BUTTON && control.props.button_style === Enums_1.CtrlButtonTypeGui.Image) {
|
|
70
|
-
controlClasses.push("button_image_background_size");
|
|
71
|
-
}
|
|
72
|
-
if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_LABEL) {
|
|
73
|
-
controlClasses.push("lable_overflow");
|
|
74
|
-
}
|
|
75
|
-
if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_COLUMN) {
|
|
76
|
-
controlClasses.push("table_row");
|
|
77
|
-
}
|
|
78
|
-
if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_TABLE) {
|
|
79
|
-
if (control.props.scroll_bar) {
|
|
80
|
-
controlClasses.push("table_scrollBar");
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_TABLE || control.controlType === Enums_1.MgControlType.CTRL_TYPE_GROUP) {
|
|
84
|
-
controlClasses.push("container_border");
|
|
85
|
-
}
|
|
86
|
-
// if (control.children) {
|
|
87
|
-
// control.children.forEach((ctrl$: Control) => {
|
|
88
|
-
// CalcClassForControl(ctrl$, controlClasses)
|
|
89
|
-
// });
|
|
90
|
-
// }
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
94
|
-
// for each special chars we will add "\" before the special char.
|
|
95
|
-
// For example : control name "Blabla?" the class name will be "Blabla\?"
|
|
96
|
-
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
97
|
-
function getControlClassNameInCss(controlNameStr) {
|
|
98
|
-
var controlName = controlNameStr;
|
|
99
|
-
//The following chars are created problem in css = ["!" "," "+", ":", ",", "~", ";", "\"" "{" "}" ">" " "];
|
|
100
|
-
//TODO:need to be check with Rotem let specialCharsForRotem = ["!"];
|
|
101
|
-
// replace all special chars
|
|
102
|
-
let specialCharsWork = ["\\", "#", "$", "%", "&", "(", ")", "*", "-", ".", "/", "<", "=", "?", "@", "[", "]", "^", "`", "|"];
|
|
103
|
-
for (let i = 0; i < specialCharsWork.length; i++) {
|
|
104
|
-
controlName = controlName.split(specialCharsWork[i]).join("\\" + specialCharsWork[i]);
|
|
105
|
-
}
|
|
106
|
-
return controlName;
|
|
107
|
-
}
|
|
108
|
-
//////////////////////////////////////////////////////////////////
|
|
109
|
-
// recursively process the controls' properties, find the classes used for the control
|
|
110
|
-
//////////////////////////////////////////////////////////////////
|
|
111
|
-
function processControl(control) {
|
|
112
|
-
const categoryNames = Object.keys(Map);
|
|
113
|
-
//LogLn(">> Generating CSS class list for \"" + control.props.id + "\"");
|
|
114
|
-
const controlClasses = [];
|
|
115
|
-
// use the control's id as a class
|
|
116
|
-
//control["class_name_in_css"] = getControlClassNameInCss(control.props.id);
|
|
117
|
-
//controlClasses.push(control.props.id + "Props");
|
|
118
|
-
CalcClassForControl(control, controlClasses);
|
|
119
|
-
// loop on all item names from the "Map" object
|
|
120
|
-
categoryNames.forEach((catName) => {
|
|
121
|
-
let catRuleArray = Map[catName];
|
|
122
|
-
catRuleArray.forEach((rule, i) => {
|
|
123
|
-
let ruleSet$;
|
|
124
|
-
if (control[catName]) {
|
|
125
|
-
ruleSet$ = control[catName][rule.name];
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if ((0, util_1.isNullOrUndefined)(ruleSet$))
|
|
131
|
-
return;
|
|
132
|
-
// ... or turn on the has-expession flag
|
|
133
|
-
if (!(0, util_1.isNullOrUndefined)(ruleSet$.has_exp) && ruleSet$.has_exp) {
|
|
134
|
-
control.hasClassExpression = true;
|
|
135
|
-
}
|
|
136
|
-
// find and keep the class name...
|
|
137
|
-
else {
|
|
138
|
-
if (Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['options']) {
|
|
139
|
-
if (!(0, util_1.isNullOrUndefined)(Map[catName][i]['options'][String(ruleSet$)]))
|
|
140
|
-
controlClasses.push(Map[catName][i]['options'][String(ruleSet$)]);
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
controlClasses.push(Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['suffix'] + ruleSet$);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
control.classes = controlClasses.join(' ');
|
|
148
|
-
});
|
|
149
|
-
//LogLn("generated classes \"" + control.classes + "\"");
|
|
150
|
-
// go over control's children
|
|
151
|
-
if (control.children) {
|
|
152
|
-
//LogLn("processing child controls...");
|
|
153
|
-
control.children.forEach((ctrl$) => {
|
|
154
|
-
processControl(ctrl$);
|
|
155
|
-
});
|
|
156
|
-
//LogLn("...children processing done")
|
|
157
|
-
}
|
|
158
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processJson = void 0;
|
|
4
|
+
const Util_1 = require("./Util");
|
|
5
|
+
const util_1 = require("util");
|
|
6
|
+
const Enums_1 = require("../../../src/types/enums/Enums");
|
|
7
|
+
// mapping for properties which are implemented using a class
|
|
8
|
+
const Map = {
|
|
9
|
+
style: [
|
|
10
|
+
{
|
|
11
|
+
name: 'font',
|
|
12
|
+
suffix: 'mgFont'
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'focus_color',
|
|
16
|
+
suffix: 'mgFocusColor'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'border_color',
|
|
20
|
+
suffix: 'mgBorderColor'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'border',
|
|
24
|
+
options: {
|
|
25
|
+
"false": 'hidden_border'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'border_style',
|
|
30
|
+
options: {
|
|
31
|
+
"1": 'twod_border',
|
|
32
|
+
"2": 'threed_border',
|
|
33
|
+
"3": 'threedsunken_border',
|
|
34
|
+
"4": 'windows_border',
|
|
35
|
+
"5": 'windows_border',
|
|
36
|
+
"6": 'emboss_border',
|
|
37
|
+
"7": 'hidden_border'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'multiline_edit',
|
|
42
|
+
options: {
|
|
43
|
+
"true": 'multiline',
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
props: [],
|
|
48
|
+
hint: []
|
|
49
|
+
};
|
|
50
|
+
//////////////////////////////////////////////////////////////////
|
|
51
|
+
// process the views' json, find the classes used for each control
|
|
52
|
+
//////////////////////////////////////////////////////////////////
|
|
53
|
+
function processJson(appJson) {
|
|
54
|
+
const views$ = Object.assign([], appJson.views);
|
|
55
|
+
appJson.views.length = 0;
|
|
56
|
+
// loop on all views
|
|
57
|
+
views$.forEach(view$ => {
|
|
58
|
+
if (view$) {
|
|
59
|
+
(0, Util_1.LogLn)(`[>] Processing JSON file for component ${view$.props.id}`);
|
|
60
|
+
processControl(view$);
|
|
61
|
+
appJson.views.push(view$);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return appJson;
|
|
65
|
+
}
|
|
66
|
+
exports.processJson = processJson;
|
|
67
|
+
function CalcClassForControl(control, controlClasses) {
|
|
68
|
+
if (control.controlType != Enums_1.MgControlType.CTRL_TYPE_TABPAGE) {
|
|
69
|
+
if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_BUTTON && control.props.button_style === Enums_1.CtrlButtonTypeGui.Image) {
|
|
70
|
+
controlClasses.push("button_image_background_size");
|
|
71
|
+
}
|
|
72
|
+
if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_LABEL) {
|
|
73
|
+
controlClasses.push("lable_overflow");
|
|
74
|
+
}
|
|
75
|
+
if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_COLUMN) {
|
|
76
|
+
controlClasses.push("table_row");
|
|
77
|
+
}
|
|
78
|
+
if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_TABLE) {
|
|
79
|
+
if (control.props.scroll_bar) {
|
|
80
|
+
controlClasses.push("table_scrollBar");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (control.controlType === Enums_1.MgControlType.CTRL_TYPE_TABLE || control.controlType === Enums_1.MgControlType.CTRL_TYPE_GROUP) {
|
|
84
|
+
controlClasses.push("container_border");
|
|
85
|
+
}
|
|
86
|
+
// if (control.children) {
|
|
87
|
+
// control.children.forEach((ctrl$: Control) => {
|
|
88
|
+
// CalcClassForControl(ctrl$, controlClasses)
|
|
89
|
+
// });
|
|
90
|
+
// }
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
94
|
+
// for each special chars we will add "\" before the special char.
|
|
95
|
+
// For example : control name "Blabla?" the class name will be "Blabla\?"
|
|
96
|
+
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
97
|
+
function getControlClassNameInCss(controlNameStr) {
|
|
98
|
+
var controlName = controlNameStr;
|
|
99
|
+
//The following chars are created problem in css = ["!" "," "+", ":", ",", "~", ";", "\"" "{" "}" ">" " "];
|
|
100
|
+
//TODO:need to be check with Rotem let specialCharsForRotem = ["!"];
|
|
101
|
+
// replace all special chars
|
|
102
|
+
let specialCharsWork = ["\\", "#", "$", "%", "&", "(", ")", "*", "-", ".", "/", "<", "=", "?", "@", "[", "]", "^", "`", "|"];
|
|
103
|
+
for (let i = 0; i < specialCharsWork.length; i++) {
|
|
104
|
+
controlName = controlName.split(specialCharsWork[i]).join("\\" + specialCharsWork[i]);
|
|
105
|
+
}
|
|
106
|
+
return controlName;
|
|
107
|
+
}
|
|
108
|
+
//////////////////////////////////////////////////////////////////
|
|
109
|
+
// recursively process the controls' properties, find the classes used for the control
|
|
110
|
+
//////////////////////////////////////////////////////////////////
|
|
111
|
+
function processControl(control) {
|
|
112
|
+
const categoryNames = Object.keys(Map);
|
|
113
|
+
//LogLn(">> Generating CSS class list for \"" + control.props.id + "\"");
|
|
114
|
+
const controlClasses = [];
|
|
115
|
+
// use the control's id as a class
|
|
116
|
+
//control["class_name_in_css"] = getControlClassNameInCss(control.props.id);
|
|
117
|
+
//controlClasses.push(control.props.id + "Props");
|
|
118
|
+
CalcClassForControl(control, controlClasses);
|
|
119
|
+
// loop on all item names from the "Map" object
|
|
120
|
+
categoryNames.forEach((catName) => {
|
|
121
|
+
let catRuleArray = Map[catName];
|
|
122
|
+
catRuleArray.forEach((rule, i) => {
|
|
123
|
+
let ruleSet$;
|
|
124
|
+
if (control[catName]) {
|
|
125
|
+
ruleSet$ = control[catName][rule.name];
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if ((0, util_1.isNullOrUndefined)(ruleSet$))
|
|
131
|
+
return;
|
|
132
|
+
// ... or turn on the has-expession flag
|
|
133
|
+
if (!(0, util_1.isNullOrUndefined)(ruleSet$.has_exp) && ruleSet$.has_exp) {
|
|
134
|
+
control.hasClassExpression = true;
|
|
135
|
+
}
|
|
136
|
+
// find and keep the class name...
|
|
137
|
+
else {
|
|
138
|
+
if (Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['options']) {
|
|
139
|
+
if (!(0, util_1.isNullOrUndefined)(Map[catName][i]['options'][String(ruleSet$)]))
|
|
140
|
+
controlClasses.push(Map[catName][i]['options'][String(ruleSet$)]);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
controlClasses.push(Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['suffix'] + ruleSet$);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
control.classes = controlClasses.join(' ');
|
|
148
|
+
});
|
|
149
|
+
//LogLn("generated classes \"" + control.classes + "\"");
|
|
150
|
+
// go over control's children
|
|
151
|
+
if (control.children) {
|
|
152
|
+
//LogLn("processing child controls...");
|
|
153
|
+
control.children.forEach((ctrl$) => {
|
|
154
|
+
processControl(ctrl$);
|
|
155
|
+
});
|
|
156
|
+
//LogLn("...children processing done")
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
159
|
//# sourceMappingURL=process-json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-json.js","sourceRoot":"","sources":["process-json.ts"],"names":[],"mappings":";;;AACA,iCAA+C;AAC/C,+BAAyC;AACzC,0DAAkF;AAElF,6DAA6D;AAC7D,MAAM,GAAG,GAAqG;IAC1G,KAAK,EAAE;QACH;YACI,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE,cAAc;SACzB;QAED;YACI,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,eAAe;SAC1B;QACD;YACI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACL,OAAO,EAAE,eAAe;aAC3B;SACJ;QACD;YACI,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE;gBACL,GAAG,EAAE,aAAa;gBAClB,GAAG,EAAE,eAAe;gBACpB,GAAG,EAAE,qBAAqB;gBAC1B,GAAG,EAAE,gBAAgB;gBACrB,GAAG,EAAE,gBAAgB;gBACrB,GAAG,EAAE,eAAe;gBAC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c,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;iBACzE;qBACI;oBACD,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC;iBACnH;aACJ;QAEL,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,yDAAyD;IAEzD,6BAA6B;IAC7B,IAAI,OAAO,CAAC,QAAQ,EAAE;QAClB,wCAAwC;QACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAc,EAAE,EAAE;YACxC,cAAc,CAAC,KAAK,CAAC,CAAA;QACzB,CAAC,CAAC,CAAC;QACH,sCAAsC;KACzC;AAEL,CAAC","sourcesContent":["import {AppJson, View,Control} from '../../types/index';\r\nimport {LogLn,} from \"./Util\";\r\nimport { isNullOrUndefined } from \"util\";\r\nimport { MgControlType, CtrlButtonTypeGui } from \"../../../src/types/enums/Enums\";\r\n\r\n// mapping for properties which are implemented using a class\r\nconst Map: { [category: string]: { name: string, suffix?: string, options?: { [val: string]: string } }[] } = {\r\n style: [\r\n {\r\n name: 'font',\r\n suffix: 'mgFont'\r\n },\r\n {\r\n name: 'focus_color',\r\n suffix: 'mgFocusColor'\r\n },\r\n\r\n {\r\n name: 'border_color',\r\n suffix: 'mgBorderColor'\r\n },\r\n {\r\n name: 'border',\r\n options: {\r\n \"false\": 'hidden_border'\r\n }\r\n },\r\n {\r\n name: 'border_style',\r\n options: {\r\n \"1\": 'twod_border',\r\n \"2\": 'threed_border',\r\n \"3\": 'threedsunken_border',\r\n \"4\": 'windows_border',\r\n \"5\": 'windows_border',\r\n \"6\": 'emboss_border',\r\n \"7\": 'hidden_border'\r\n }\r\n },\r\n {\r\n name: 'multiline_edit',\r\n options: {\r\n \"true\": 'multiline',\r\n\r\n }\r\n }\r\n ],\r\n props: [],\r\n hint: []\r\n};\r\n\r\n//////////////////////////////////////////////////////////////////\r\n// process the views' json, find the classes used for each control\r\n//////////////////////////////////////////////////////////////////\r\nexport function processJson(appJson: AppJson) :AppJson {\r\n\r\n const views$: View[] = Object.assign([], appJson.views);\r\n appJson.views.length = 0;\r\n\r\n // loop on all views\r\n views$.forEach( view$ => {\r\n if(view$){\r\n LogLn(`[>] Processing JSON file for component ${view$.props.id}`);\r\n processControl(view$);\r\n appJson.views.push(view$);\r\n }\r\n });\r\n return appJson;\r\n}\r\n\r\nfunction CalcClassForControl(control: Control, controlClasses: string[] ){\r\n if (control.controlType != MgControlType.CTRL_TYPE_TABPAGE){\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_BUTTON && control.props.button_style === CtrlButtonTypeGui.Image) {\r\n controlClasses.push(\"button_image_background_size\");\r\n }\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_LABEL) {\r\n controlClasses.push(\"lable_overflow\");\r\n }\r\n\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_COLUMN ) {\r\n controlClasses.push(\"table_row\");\r\n }\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_TABLE){\r\n\r\n if (control.props.scroll_bar) {\r\n controlClasses.push(\"table_scrollBar\");\r\n }\r\n }\r\n\r\n if(control.controlType === MgControlType.CTRL_TYPE_TABLE || control.controlType === MgControlType.CTRL_TYPE_GROUP) {\r\n controlClasses.push(\"container_border\");\r\n }\r\n\r\n // if (control.children) {\r\n // control.children.forEach((ctrl$: Control) => {\r\n // CalcClassForControl(ctrl$, controlClasses)\r\n // });\r\n // }\r\n }\r\n}\r\n///////////////////////////////////////////////////////////////////////////////////////////////////\r\n// for each special chars we will add \"\\\" before the special char.\r\n// For example : control name \"Blabla?\" the class name will be \"Blabla\\?\"\r\n///////////////////////////////////////////////////////////////////////////////////////////////////\r\nfunction getControlClassNameInCss(controlNameStr: string): string {\r\n var controlName = controlNameStr;\r\n\r\n //The following chars are created problem in css = [\"!\" \",\" \"+\", \":\", \",\", \"~\", \";\", \"\\\"\" \"{\" \"}\" \">\" \" \"];\r\n //TODO:need to be check with Rotem let specialCharsForRotem = [\"!\"];\r\n\r\n // replace all special chars\r\n let specialCharsWork = [\"\\\\\", \"#\", \"$\", \"%\", \"&\", \"(\", \")\", \"*\", \"-\", \".\", \"/\", \"<\", \"=\", \"?\", \"@\", \"[\", \"]\", \"^\", \"`\", \"|\"];\r\n for (let i = 0; i < specialCharsWork.length; i++) {\r\n controlName = controlName.split(specialCharsWork[i]).join(\"\\\\\" + specialCharsWork[i]);\r\n }\r\n\r\n return controlName;\r\n}\r\n\r\n//////////////////////////////////////////////////////////////////\r\n// recursively process the controls' properties, find the classes used for the control\r\n//////////////////////////////////////////////////////////////////\r\nfunction processControl(control: Control) {\r\n\r\n const categoryNames: string[] = Object.keys(Map);\r\n\r\n //LogLn(\">> Generating CSS class list for \\\"\" + control.props.id + \"\\\"\");\r\n\r\n const controlClasses: string[] = [];\r\n\r\n // use the control's id as a class\r\n //control[\"class_name_in_css\"] = getControlClassNameInCss(control.props.id);\r\n //controlClasses.push(control.props.id + \"Props\");\r\n CalcClassForControl(control, controlClasses);\r\n\r\n // loop on all item names from the \"Map\" object\r\n categoryNames.forEach((catName) => {\r\n let catRuleArray: { name: string, suffix?: string, options?: { [val: string]: string } }[] = Map[catName];\r\n\r\n catRuleArray.forEach((rule, i) => {\r\n\r\n let ruleSet$;\r\n if (control[catName]) {\r\n ruleSet$ = control[catName][rule.name];\r\n }\r\n else {\r\n return;\r\n }\r\n if (isNullOrUndefined(ruleSet$)) return;\r\n\r\n // ... or turn on the has-expession flag\r\n if (!isNullOrUndefined(ruleSet$.has_exp) && ruleSet$.has_exp) {\r\n control.hasClassExpression = true;\r\n }\r\n // find and keep the class name...\r\n else {\r\n if (Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['options']) {\r\n if (!isNullOrUndefined(Map[catName][i]['options'][String(ruleSet$)]))\r\n controlClasses.push(Map[catName][i]['options'][String(ruleSet$)]);\r\n }\r\n else {\r\n controlClasses.push(Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['suffix'] + ruleSet$);\r\n }\r\n }\r\n\r\n });\r\n\r\n control.classes = controlClasses.join(' ');\r\n });\r\n\r\n //LogLn(\"generated classes \\\"\" + control.classes + \"\\\"\");\r\n\r\n // go over control's children\r\n if (control.children) {\r\n //LogLn(\"processing child controls...\");\r\n control.children.forEach((ctrl$: Control) => {\r\n processControl(ctrl$)\r\n });\r\n //LogLn(\"...children processing done\")\r\n }\r\n\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"process-json.js","sourceRoot":"","sources":["process-json.ts"],"names":[],"mappings":";;;AACA,iCAA+C;AAC/C,+BAAyC;AACzC,0DAAkF;AAElF,6DAA6D;AAC7D,MAAM,GAAG,GAAqG;IAC1G,KAAK,EAAE;QACH;YACI,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,QAAQ;SACnB;QACD;YACI,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE,cAAc;SACzB;QAED;YACI,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,eAAe;SAC1B;QACD;YACI,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACL,OAAO,EAAE,eAAe;aAC3B;SACJ;QACD;YACI,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE;gBACL,GAAG,EAAE,aAAa;gBAClB,GAAG,EAAE,eAAe;gBACpB,GAAG,EAAE,qBAAqB;gBAC1B,GAAG,EAAE,gBAAgB;gBACrB,GAAG,EAAE,gBAAgB;gBACrB,GAAG,EAAE,eAAe;gB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E,CAAC;oBACnF,IAAI,CAAC,IAAA,wBAAiB,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;wBAChE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBAC1E,CAAC;qBACI,CAAC;oBACF,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC;gBACpH,CAAC;YACL,CAAC;QAEL,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,yDAAyD;IAEzD,6BAA6B;IAC7B,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACnB,wCAAwC;QACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAc,EAAE,EAAE;YACxC,cAAc,CAAC,KAAK,CAAC,CAAA;QACzB,CAAC,CAAC,CAAC;QACH,sCAAsC;IAC1C,CAAC;AAEL,CAAC","sourcesContent":["import {AppJson, View,Control} from '../../types/index';\r\nimport {LogLn,} from \"./Util\";\r\nimport { isNullOrUndefined } from \"util\";\r\nimport { MgControlType, CtrlButtonTypeGui } from \"../../../src/types/enums/Enums\";\r\n\r\n// mapping for properties which are implemented using a class\r\nconst Map: { [category: string]: { name: string, suffix?: string, options?: { [val: string]: string } }[] } = {\r\n style: [\r\n {\r\n name: 'font',\r\n suffix: 'mgFont'\r\n },\r\n {\r\n name: 'focus_color',\r\n suffix: 'mgFocusColor'\r\n },\r\n\r\n {\r\n name: 'border_color',\r\n suffix: 'mgBorderColor'\r\n },\r\n {\r\n name: 'border',\r\n options: {\r\n \"false\": 'hidden_border'\r\n }\r\n },\r\n {\r\n name: 'border_style',\r\n options: {\r\n \"1\": 'twod_border',\r\n \"2\": 'threed_border',\r\n \"3\": 'threedsunken_border',\r\n \"4\": 'windows_border',\r\n \"5\": 'windows_border',\r\n \"6\": 'emboss_border',\r\n \"7\": 'hidden_border'\r\n }\r\n },\r\n {\r\n name: 'multiline_edit',\r\n options: {\r\n \"true\": 'multiline',\r\n\r\n }\r\n }\r\n ],\r\n props: [],\r\n hint: []\r\n};\r\n\r\n//////////////////////////////////////////////////////////////////\r\n// process the views' json, find the classes used for each control\r\n//////////////////////////////////////////////////////////////////\r\nexport function processJson(appJson: AppJson) :AppJson {\r\n\r\n const views$: View[] = Object.assign([], appJson.views);\r\n appJson.views.length = 0;\r\n\r\n // loop on all views\r\n views$.forEach( view$ => {\r\n if(view$){\r\n LogLn(`[>] Processing JSON file for component ${view$.props.id}`);\r\n processControl(view$);\r\n appJson.views.push(view$);\r\n }\r\n });\r\n return appJson;\r\n}\r\n\r\nfunction CalcClassForControl(control: Control, controlClasses: string[] ){\r\n if (control.controlType != MgControlType.CTRL_TYPE_TABPAGE){\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_BUTTON && control.props.button_style === CtrlButtonTypeGui.Image) {\r\n controlClasses.push(\"button_image_background_size\");\r\n }\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_LABEL) {\r\n controlClasses.push(\"lable_overflow\");\r\n }\r\n\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_COLUMN ) {\r\n controlClasses.push(\"table_row\");\r\n }\r\n\r\n if (control.controlType === MgControlType.CTRL_TYPE_TABLE){\r\n\r\n if (control.props.scroll_bar) {\r\n controlClasses.push(\"table_scrollBar\");\r\n }\r\n }\r\n\r\n if(control.controlType === MgControlType.CTRL_TYPE_TABLE || control.controlType === MgControlType.CTRL_TYPE_GROUP) {\r\n controlClasses.push(\"container_border\");\r\n }\r\n\r\n // if (control.children) {\r\n // control.children.forEach((ctrl$: Control) => {\r\n // CalcClassForControl(ctrl$, controlClasses)\r\n // });\r\n // }\r\n }\r\n}\r\n///////////////////////////////////////////////////////////////////////////////////////////////////\r\n// for each special chars we will add \"\\\" before the special char.\r\n// For example : control name \"Blabla?\" the class name will be \"Blabla\\?\"\r\n///////////////////////////////////////////////////////////////////////////////////////////////////\r\nfunction getControlClassNameInCss(controlNameStr: string): string {\r\n var controlName = controlNameStr;\r\n\r\n //The following chars are created problem in css = [\"!\" \",\" \"+\", \":\", \",\", \"~\", \";\", \"\\\"\" \"{\" \"}\" \">\" \" \"];\r\n //TODO:need to be check with Rotem let specialCharsForRotem = [\"!\"];\r\n\r\n // replace all special chars\r\n let specialCharsWork = [\"\\\\\", \"#\", \"$\", \"%\", \"&\", \"(\", \")\", \"*\", \"-\", \".\", \"/\", \"<\", \"=\", \"?\", \"@\", \"[\", \"]\", \"^\", \"`\", \"|\"];\r\n for (let i = 0; i < specialCharsWork.length; i++) {\r\n controlName = controlName.split(specialCharsWork[i]).join(\"\\\\\" + specialCharsWork[i]);\r\n }\r\n\r\n return controlName;\r\n}\r\n\r\n//////////////////////////////////////////////////////////////////\r\n// recursively process the controls' properties, find the classes used for the control\r\n//////////////////////////////////////////////////////////////////\r\nfunction processControl(control: Control) {\r\n\r\n const categoryNames: string[] = Object.keys(Map);\r\n\r\n //LogLn(\">> Generating CSS class list for \\\"\" + control.props.id + \"\\\"\");\r\n\r\n const controlClasses: string[] = [];\r\n\r\n // use the control's id as a class\r\n //control[\"class_name_in_css\"] = getControlClassNameInCss(control.props.id);\r\n //controlClasses.push(control.props.id + \"Props\");\r\n CalcClassForControl(control, controlClasses);\r\n\r\n // loop on all item names from the \"Map\" object\r\n categoryNames.forEach((catName) => {\r\n let catRuleArray: { name: string, suffix?: string, options?: { [val: string]: string } }[] = Map[catName];\r\n\r\n catRuleArray.forEach((rule, i) => {\r\n\r\n let ruleSet$;\r\n if (control[catName]) {\r\n ruleSet$ = control[catName][rule.name];\r\n }\r\n else {\r\n return;\r\n }\r\n if (isNullOrUndefined(ruleSet$)) return;\r\n\r\n // ... or turn on the has-expession flag\r\n if (!isNullOrUndefined(ruleSet$.has_exp) && ruleSet$.has_exp) {\r\n control.hasClassExpression = true;\r\n }\r\n // find and keep the class name...\r\n else {\r\n if (Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['options']) {\r\n if (!isNullOrUndefined(Map[catName][i]['options'][String(ruleSet$)]))\r\n controlClasses.push(Map[catName][i]['options'][String(ruleSet$)]);\r\n }\r\n else {\r\n controlClasses.push(Map[catName] && Map[catName][i] && Map[catName][i] && Map[catName][i]['suffix'] + ruleSet$);\r\n }\r\n }\r\n\r\n });\r\n\r\n control.classes = controlClasses.join(' ');\r\n });\r\n\r\n //LogLn(\"generated classes \\\"\" + control.classes + \"\\\"\");\r\n\r\n // go over control's children\r\n if (control.children) {\r\n //LogLn(\"processing child controls...\");\r\n control.children.forEach((ctrl$: Control) => {\r\n processControl(ctrl$)\r\n });\r\n //LogLn(\"...children processing done\")\r\n }\r\n\r\n}\r\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MagicOptionScheme } from "./magic-option.scheme";
|
|
2
|
-
import { Rule } from "@angular-devkit/schematics";
|
|
3
|
-
import { TemplateConfig } from "../../../types/index";
|
|
4
|
-
export declare function buildControl(options: MagicOptionScheme, module_name: string): Rule;
|
|
5
|
-
export declare function generate(file: TemplateConfig, options: MagicOptionScheme): Rule;
|
|
1
|
+
import { MagicOptionScheme } from "./magic-option.scheme";
|
|
2
|
+
import { Rule } from "@angular-devkit/schematics";
|
|
3
|
+
import { TemplateConfig } from "../../../types/index";
|
|
4
|
+
export declare function buildControl(options: MagicOptionScheme, module_name: string): Rule;
|
|
5
|
+
export declare function generate(file: TemplateConfig, options: MagicOptionScheme): Rule;
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generate = exports.buildControl = void 0;
|
|
4
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const index_1 = require("../../../types/index");
|
|
6
|
-
const Util_1 = require("../Util");
|
|
7
|
-
const env_1 = require("../env");
|
|
8
|
-
const EJS = require("ejs");
|
|
9
|
-
const Util_2 = require("../Util");
|
|
10
|
-
const jsbeautify = require("js-beautify");
|
|
11
|
-
const generate_rule_1 = require("./generate.rule");
|
|
12
|
-
const htmlBeautify = jsbeautify.html;
|
|
13
|
-
//
|
|
14
|
-
// build the HTML of a single control
|
|
15
|
-
//
|
|
16
|
-
function buildControl(options, module_name) {
|
|
17
|
-
return (host, context) => {
|
|
18
|
-
const metadata = env_1.env.metadata;
|
|
19
|
-
const view = env_1.env.app.views[0];
|
|
20
|
-
let rules = [];
|
|
21
|
-
const viewId = view.props.id;
|
|
22
|
-
const dest = metadata.paths.getDestPathForComponent(module_name, view.props.component_path);
|
|
23
|
-
const data = {
|
|
24
|
-
MgControlType: index_1.MgControlType,
|
|
25
|
-
theme: metadata.theme,
|
|
26
|
-
CtrlButtonTypeGui: index_1.CtrlButtonTypeGui,
|
|
27
|
-
SideType: index_1.SideType,
|
|
28
|
-
StorageAttributeType: index_1.StorageAttributeType,
|
|
29
|
-
TableWebStyle: index_1.TableWebStyle,
|
|
30
|
-
RowEditingTypes: index_1.RowEditingTypes,
|
|
31
|
-
WindowType: index_1.WindowType,
|
|
32
|
-
WindowPosition: index_1.WindowPosition,
|
|
33
|
-
Util: Util_1.Util,
|
|
34
|
-
child: view,
|
|
35
|
-
ctrl: view,
|
|
36
|
-
app: env_1.env.app,
|
|
37
|
-
magicConfig: metadata.config,
|
|
38
|
-
};
|
|
39
|
-
const componentFiles = [
|
|
40
|
-
{
|
|
41
|
-
type: index_1.GeneratedFileTypes.HTML,
|
|
42
|
-
template: './templates/themes/control.ejs',
|
|
43
|
-
destination: dest,
|
|
44
|
-
name: `${viewId}.component.html`,
|
|
45
|
-
data: data
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
componentFiles.forEach(templateConfig => {
|
|
49
|
-
rules.push(generate(templateConfig, options));
|
|
50
|
-
});
|
|
51
|
-
return (0, schematics_1.chain)(rules)(host, context);
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
exports.buildControl = buildControl;
|
|
55
|
-
//
|
|
56
|
-
// Call EJS to generate HTML and write the result to stdout
|
|
57
|
-
//
|
|
58
|
-
function generate(file, options) {
|
|
59
|
-
return (host, context) => {
|
|
60
|
-
EJS.renderFile(`${env_1.MAGIC_CLI_FOLDER}/${file.template}`, file.data, {}, (err, output) => {
|
|
61
|
-
try {
|
|
62
|
-
output = (0, generate_rule_1.createGenFuncs)(output, file.type);
|
|
63
|
-
}
|
|
64
|
-
catch (err) {
|
|
65
|
-
(0, Util_2.logErr)(output);
|
|
66
|
-
(0, Util_2.logErr)(err);
|
|
67
|
-
}
|
|
68
|
-
// send the output directly to the stdout, so the calling app will get it
|
|
69
|
-
console.log(output);
|
|
70
|
-
});
|
|
71
|
-
return host;
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
exports.generate = generate;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generate = exports.buildControl = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const index_1 = require("../../../types/index");
|
|
6
|
+
const Util_1 = require("../Util");
|
|
7
|
+
const env_1 = require("../env");
|
|
8
|
+
const EJS = require("ejs");
|
|
9
|
+
const Util_2 = require("../Util");
|
|
10
|
+
const jsbeautify = require("js-beautify");
|
|
11
|
+
const generate_rule_1 = require("./generate.rule");
|
|
12
|
+
const htmlBeautify = jsbeautify.html;
|
|
13
|
+
//
|
|
14
|
+
// build the HTML of a single control
|
|
15
|
+
//
|
|
16
|
+
function buildControl(options, module_name) {
|
|
17
|
+
return (host, context) => {
|
|
18
|
+
const metadata = env_1.env.metadata;
|
|
19
|
+
const view = env_1.env.app.views[0];
|
|
20
|
+
let rules = [];
|
|
21
|
+
const viewId = view.props.id;
|
|
22
|
+
const dest = metadata.paths.getDestPathForComponent(module_name, view.props.component_path);
|
|
23
|
+
const data = {
|
|
24
|
+
MgControlType: index_1.MgControlType,
|
|
25
|
+
theme: metadata.theme,
|
|
26
|
+
CtrlButtonTypeGui: index_1.CtrlButtonTypeGui,
|
|
27
|
+
SideType: index_1.SideType,
|
|
28
|
+
StorageAttributeType: index_1.StorageAttributeType,
|
|
29
|
+
TableWebStyle: index_1.TableWebStyle,
|
|
30
|
+
RowEditingTypes: index_1.RowEditingTypes,
|
|
31
|
+
WindowType: index_1.WindowType,
|
|
32
|
+
WindowPosition: index_1.WindowPosition,
|
|
33
|
+
Util: Util_1.Util,
|
|
34
|
+
child: view,
|
|
35
|
+
ctrl: view,
|
|
36
|
+
app: env_1.env.app,
|
|
37
|
+
magicConfig: metadata.config,
|
|
38
|
+
};
|
|
39
|
+
const componentFiles = [
|
|
40
|
+
{
|
|
41
|
+
type: index_1.GeneratedFileTypes.HTML,
|
|
42
|
+
template: './templates/themes/control.ejs',
|
|
43
|
+
destination: dest,
|
|
44
|
+
name: `${viewId}.component.html`,
|
|
45
|
+
data: data
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
componentFiles.forEach(templateConfig => {
|
|
49
|
+
rules.push(generate(templateConfig, options));
|
|
50
|
+
});
|
|
51
|
+
return (0, schematics_1.chain)(rules)(host, context);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.buildControl = buildControl;
|
|
55
|
+
//
|
|
56
|
+
// Call EJS to generate HTML and write the result to stdout
|
|
57
|
+
//
|
|
58
|
+
function generate(file, options) {
|
|
59
|
+
return (host, context) => {
|
|
60
|
+
EJS.renderFile(`${env_1.MAGIC_CLI_FOLDER}/${file.template}`, file.data, {}, (err, output) => {
|
|
61
|
+
try {
|
|
62
|
+
output = (0, generate_rule_1.createGenFuncs)(output, file.type);
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
(0, Util_2.logErr)(output);
|
|
66
|
+
(0, Util_2.logErr)(err);
|
|
67
|
+
}
|
|
68
|
+
// send the output directly to the stdout, so the calling app will get it
|
|
69
|
+
console.log(output);
|
|
70
|
+
});
|
|
71
|
+
return host;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
exports.generate = generate;
|
|
75
75
|
//# sourceMappingURL=build-control.rule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-control.rule.js","sourceRoot":"","sources":["build-control.rule.ts"],"names":[],"mappings":";;;AACA,2DAAiF;AACjF,gDAW8B;AAC9B,kCAA+B;AAC/B,gCAA2D;AAC3D,2BAA2B;AAC3B,kCAAsC;AACtC,0CAA0C;AAC1C,mDAAiD;AAEjD,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC;AAErC,EAAE;AACF,qCAAqC;AACrC,EAAE;AACF,SAAgB,YAAY,CAAC,OAAyB,EAAE,WAAkB;IACxE,OAAO,CAAC,IAAS,EAAE,OAAyB,EAAC,EAAE;QAC7C,MAAM,QAAQ,GAAG,SAAG,CAAC,QAAQ,CAAC;QAC9B,MAAM,IAAI,GAAM,SAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,KAAK,GAAU,EAAE,CAAC;QAEpB,MAAM,MAAM,GAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAO,QAAQ,CAAC,KAAK,CAAC,uBAAuB,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAChG,MAAM,IAAI,GAAO;YACf,aAAa,EAAO,qBAAa;YACjC,KAAK,EAAe,QAAQ,CAAC,KA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gBAChC,IAAI,EAAE,IAAI;aACX;SACF,CAAC;QACF,cAAc,CAAC,OAAO,CAAE,cAAc,CAAC,EAAE;YACvC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;QAEL,OAAO,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC,IAAI,EAAC,OAAO,CAAC,CAAC;IACpC,CAAC,CAAA;AACH,CAAC;AAvCD,oCAuCC;AAED,EAAE;AACF,2DAA2D;AAC3D,EAAE;AACF,SAAgB,QAAQ,CAAC,IAAoB,EAAC,OAAyB;IACrE,OAAO,CAAC,IAAS,EAAE,OAAyB,EAAE,EAAE;QAC9C,GAAG,CAAC,UAAU,CACZ,GAAG,sBAAgB,IAAI,IAAI,CAAC,QAAQ,EAAE,EACtC,IAAI,CAAC,IAAI,EACT,EAAE,EACF,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACd,IAAI,CAAC;gBACH,MAAM,GAAG,IAAA,8BAAc,EAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7C,CAAC;YACD,OAAO,GAAG,EAAE,CAAC;gBACX,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC;gBACf,IAAA,aAAM,EAAC,GAAG,CAAC,CAAC;YACd,CAAC;YACD,yEAAyE;YACzE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QACL,OAAO,IAAI,CAAC;IACd,CAAC,CAAA;AACH,CAAC;AAnBD,4BAmBC","sourcesContent":["import { MagicOptionScheme } from \"./magic-option.scheme\";\r\nimport { chain, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\r\nimport {\r\n CtrlButtonTypeGui,\r\n GeneratedFileTypes,\r\n MgControlType,\r\n SideType,\r\n StorageAttributeType,\r\n TableWebStyle,\r\n RowEditingTypes,\r\n TemplateConfig,\r\n WindowPosition,\r\n WindowType\r\n} from \"../../../types/index\";\r\nimport { Util } from \"../Util\";\r\nimport { env, GEN_FOLDER, MAGIC_CLI_FOLDER } from \"../env\";\r\nimport * as EJS from 'ejs';\r\nimport { logErr, Log } from \"../Util\";\r\nimport * as jsbeautify from 'js-beautify';\r\nimport { createGenFuncs } from \"./generate.rule\";\r\n\r\nconst htmlBeautify = jsbeautify.html;\r\n\r\n//\r\n// build the HTML of a single control\r\n//\r\nexport function buildControl(options:MagicOptionScheme, module_name:string) : Rule {\r\n return (host:Tree, context: SchematicContext)=>{\r\n const metadata = env.metadata;\r\n const view = env.app.views[0];\r\n let rules:Rule[] = [];\r\n\r\n const viewId = view.props.id;\r\n const dest = metadata.paths.getDestPathForComponent(module_name, view.props.component_path);\r\n const data = {\r\n MgControlType : MgControlType,\r\n theme : metadata.theme,\r\n CtrlButtonTypeGui : CtrlButtonTypeGui,\r\n SideType : SideType,\r\n StorageAttributeType: StorageAttributeType,\r\n TableWebStyle : TableWebStyle,\r\n RowEditingTypes : RowEditingTypes,\r\n WindowType : WindowType,\r\n WindowPosition : WindowPosition,\r\n Util : Util,\r\n child : view,\r\n ctrl : view,\r\n app : env.app,\r\n magicConfig : metadata.config,\r\n };\r\n const componentFiles: TemplateConfig[] = [\r\n {\r\n type: GeneratedFileTypes.HTML,\r\n template: './templates/themes/control.ejs',\r\n destination: dest,\r\n name: `${viewId}.component.html`,\r\n data: data\r\n },\r\n ];\r\n componentFiles.forEach( templateConfig => {\r\n rules.push(generate(templateConfig, options));\r\n });\r\n\r\n return chain(rules)(host,context);\r\n }\r\n}\r\n\r\n//\r\n// Call EJS to generate HTML and write the result to stdout\r\n//\r\nexport function generate(file: TemplateConfig,options:MagicOptionScheme) :Rule{\r\n return (host:Tree, context: SchematicContext) => {\r\n EJS.renderFile(\r\n `${MAGIC_CLI_FOLDER}/${file.template}`,\r\n file.data,\r\n {},\r\n (err, output) => {\r\n try {\r\n output = createGenFuncs(output, file.type);\r\n }\r\n catch (err) {\r\n logErr(output);\r\n logErr(err);\r\n }\r\n // send the output directly to the stdout, so the calling app will get it\r\n console.log(output);\r\n });\r\n return host;\r\n }\r\n}\r\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { MagicOptionScheme } from "./magic-option.scheme";
|
|
2
|
-
import { Rule } from "@angular-devkit/schematics";
|
|
3
|
-
export declare function buildViews(options: MagicOptionScheme, module_name: string): Rule;
|
|
1
|
+
import { MagicOptionScheme } from "./magic-option.scheme";
|
|
2
|
+
import { Rule } from "@angular-devkit/schematics";
|
|
3
|
+
export declare function buildViews(options: MagicOptionScheme, module_name: string): Rule;
|