mushroom-cli 1.1.0 → 1.1.2
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/.vscode/settings.json +3 -0
- package/README.md +91 -91
- package/check-update.js +9 -9
- package/common.js +237 -236
- package/config.js +475 -445
- package/docs/doc-mt.js +526 -421
- package/docs/docs.html +5380 -5129
- package/docs/mt-dom-1.0.js +1398 -1268
- package/docs/mt.extension.js +199 -174
- package/gen/gen-api-docs.js +157 -125
- package/gen/gen-csharp.js +1687 -1414
- package/gen/gen-db-docs.js +238 -222
- package/gen/gen-js-driver-tarball.js +119 -101
- package/gen/gen-js-driver.js +154 -133
- package/gen/gen-ts-driver.js +482 -451
- package/gen.js +146 -120
- package/help.js +51 -55
- package/init/init-json.js +110 -106
- package/init/init-netcore.js +37 -32
- package/init.js +27 -28
- package/master-file/master-file.js +254 -234
- package/mr.js +80 -78
- package/package.json +27 -27
- package/update/tsCode.js +90 -20
- package/update.js +24 -24
package/docs/mt.extension.js
CHANGED
|
@@ -1,174 +1,199 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
1
|
+
(function () {
|
|
2
|
+
var urls = {};
|
|
3
|
+
function loadFile(url, successCallback, errorCallback) {
|
|
4
|
+
if (url in urls) {
|
|
5
|
+
var args = urls[url];
|
|
6
|
+
args.cached = true;
|
|
7
|
+
setTimeout(successCallback, 1, args);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
var xhr = new XMLHttpRequest();
|
|
11
|
+
xhr.onreadystatechange = function () {
|
|
12
|
+
if (this.readyState !== 4) return;
|
|
13
|
+
if (this.status < 200 || this.status >= 300) {
|
|
14
|
+
if (typeof this.debugMode === "function" && this.debugMode())
|
|
15
|
+
console.error("Unable to load: " + url);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
var args = { content: this.responseText };
|
|
19
|
+
urls[url] = args;
|
|
20
|
+
if (typeof successCallback === "function") successCallback(args);
|
|
21
|
+
};
|
|
22
|
+
xhr.onerror = function () {
|
|
23
|
+
if (typeof this.debugMode === "function" && this.debugMode())
|
|
24
|
+
console.error("Error occurred when loading: " + url);
|
|
25
|
+
if (typeof errorCallback === "function") errorCallback();
|
|
26
|
+
};
|
|
27
|
+
xhr.onabort = function () {
|
|
28
|
+
if (typeof this.debugMode === "function" && this.debugMode())
|
|
29
|
+
console.error("Connection aborted: " + url);
|
|
30
|
+
if (typeof errorCallback === "function") errorCallback();
|
|
31
|
+
};
|
|
32
|
+
xhr.ontimeout = function () {
|
|
33
|
+
if (typeof this.debugMode === "function" && this.debugMode())
|
|
34
|
+
console.error("Connection timeout: " + url);
|
|
35
|
+
if (typeof errorCallback === "function") errorCallback();
|
|
36
|
+
};
|
|
37
|
+
xhr.open("GET", url, true);
|
|
38
|
+
xhr.send(null);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
mt.modules = {};
|
|
42
|
+
mt.bindModule = function (module, dom, data, session) {
|
|
43
|
+
if (!module || !dom) return;
|
|
44
|
+
|
|
45
|
+
loadFile(
|
|
46
|
+
"/modules/" + module + "/" + module + "-view.html",
|
|
47
|
+
function (response) {
|
|
48
|
+
dom.innerHTML =
|
|
49
|
+
"<link rel='stylesheet' href='/modules/" +
|
|
50
|
+
module +
|
|
51
|
+
"/" +
|
|
52
|
+
module +
|
|
53
|
+
"-style.min.css' />" +
|
|
54
|
+
response.content;
|
|
55
|
+
loadFile(
|
|
56
|
+
"/modules/" + module + "/" + module + "-script.js",
|
|
57
|
+
function (resp) {
|
|
58
|
+
if (!resp.content) return;
|
|
59
|
+
|
|
60
|
+
if (!resp.cached) {
|
|
61
|
+
try {
|
|
62
|
+
eval(resp.content);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
throw "Invalid module script";
|
|
65
|
+
}
|
|
66
|
+
if (!mt.modules[module]) throw "Invalid module script";
|
|
67
|
+
if (typeof mt.modules[module].init === "function")
|
|
68
|
+
mt.modules[module].init();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var config = mt.modules[module];
|
|
72
|
+
|
|
73
|
+
var args = {
|
|
74
|
+
dom: dom,
|
|
75
|
+
data: data,
|
|
76
|
+
fnPool: config.fn,
|
|
77
|
+
session: session,
|
|
78
|
+
};
|
|
79
|
+
if (typeof config.prebinding === "function") {
|
|
80
|
+
config.prebinding(args);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
mt.bindDom(dom, args.data, args.fnPool, session);
|
|
84
|
+
|
|
85
|
+
if (typeof config.load === "function") {
|
|
86
|
+
args.dom = dom;
|
|
87
|
+
args.session = session;
|
|
88
|
+
config.load(args);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
function () {
|
|
92
|
+
mt.bindDom(dom, data, null, session);
|
|
93
|
+
},
|
|
94
|
+
);
|
|
95
|
+
},
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
//#region mt-link
|
|
100
|
+
if (mt["default"] === undefined) mt["default"] = {};
|
|
101
|
+
if (mt["default"].mtLink === undefined) mt["default"].mtLink = {};
|
|
102
|
+
// cho phép mở rộng được về sau: ví dụ thay thế bằng custom dialog
|
|
103
|
+
mt["default"].mtLink.itemClickHandler = function (dom, message, callback) {
|
|
104
|
+
if (confirm(message)) callback(dom);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
function mtLinkHandler(dom) {
|
|
108
|
+
mt.bindModule(
|
|
109
|
+
dom.__mtLinkConfig.module,
|
|
110
|
+
document.getElementById("page-wrapper"),
|
|
111
|
+
dom.__mtLinkConfig.params,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function mtLinkClicked(e) {
|
|
116
|
+
if (this.__mtLinkConfig.confirm)
|
|
117
|
+
mt["default"].mtLink.itemClickHandler(
|
|
118
|
+
this,
|
|
119
|
+
this.__mtLinkConfig.confirm,
|
|
120
|
+
mtLinkHandler,
|
|
121
|
+
);
|
|
122
|
+
else mtLinkHandler(this);
|
|
123
|
+
|
|
124
|
+
e = e || window.event;
|
|
125
|
+
e.stopPropagation();
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
e.cancelBubble = true;
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
mt.registerDomFeature("mtLink", function (arg) {
|
|
132
|
+
if (arg.dom.nodeName !== "A") {
|
|
133
|
+
arg.dom.dataset.mtLinkError = "mtLink feature only affects <a> tag";
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!arg.config.module) {
|
|
138
|
+
arg.dom.dataset.mtLinkError = "mtLink feature: missing module";
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
arg.dom.__mtLinkConfig = mt.fnUtils.mergeData({
|
|
143
|
+
mask: arg.config,
|
|
144
|
+
data: arg.data,
|
|
145
|
+
session: arg.session,
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
if (!arg.dom.href) arg.dom.href = "javascript:void(0)";
|
|
149
|
+
|
|
150
|
+
mt.fnUtils.addEventListener(arg.dom, "click", mtLinkClicked, false);
|
|
151
|
+
|
|
152
|
+
delete arg.dom.dataset.mtLink;
|
|
153
|
+
});
|
|
154
|
+
//#endregion
|
|
155
|
+
|
|
156
|
+
//#region mt-module
|
|
157
|
+
mt.registerDomFeature("mtModule", function (arg) {
|
|
158
|
+
if (!arg.config.module) {
|
|
159
|
+
arg.dom.dataset.mtModuleError = "mtModule feature: missing module";
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
var params = mt.fnUtils.mergeData({
|
|
164
|
+
mask: arg.config.params,
|
|
165
|
+
data: arg.data,
|
|
166
|
+
session: arg.session,
|
|
167
|
+
});
|
|
168
|
+
mt.bindModule(arg.config.module, arg.dom, params, arg.session);
|
|
169
|
+
arg.mediator.skipInner = true;
|
|
170
|
+
|
|
171
|
+
delete arg.dom.dataset.mtModule;
|
|
172
|
+
});
|
|
173
|
+
//#endregion
|
|
174
|
+
|
|
175
|
+
//#region mt-inline-module
|
|
176
|
+
mt.inlineModuleTemplates = {};
|
|
177
|
+
mt.registerDomFeature("mtInlineModule", function (arg) {
|
|
178
|
+
var config = mt.fnUtils.mergeData({
|
|
179
|
+
mask: arg.config,
|
|
180
|
+
data: arg.data,
|
|
181
|
+
session: arg.session,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
if (!config.module) {
|
|
185
|
+
arg.dom.dataset.mtInlineModuleError =
|
|
186
|
+
"mtInlineModule feature: missing module";
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
arg.dom.innerHTML = mt.inlineModuleTemplates[config.module] || "";
|
|
191
|
+
|
|
192
|
+
delete arg.dom.dataset.mtInlineModule;
|
|
193
|
+
|
|
194
|
+
mt.bindDom(arg.dom, config.params);
|
|
195
|
+
|
|
196
|
+
arg.mediator.skipInner = true;
|
|
197
|
+
});
|
|
198
|
+
//#endregion
|
|
199
|
+
})();
|