crabatool 1.0.415 → 1.0.417
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/lib/utils.js +1 -1
- package/package.json +1 -1
- package/tool/client.js +72 -25
- package/tool/compress.js +9 -5
package/lib/utils.js
CHANGED
|
@@ -535,7 +535,7 @@ class Utils {
|
|
|
535
535
|
var content = fs.readFileSync(htmlPath).toString();
|
|
536
536
|
content = content.replaceAll('${modName}', config.modName);
|
|
537
537
|
|
|
538
|
-
res.setHeader('Content-Type', 'text/html; charset=utf-8'); //
|
|
538
|
+
res.setHeader('Content-Type', 'text/html; charset=utf-8'); // 当做文本输出,才能显示到浏览器
|
|
539
539
|
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
|
|
540
540
|
res.setHeader('Pragma', 'no-cache');
|
|
541
541
|
res.setHeader('Expires', '0');
|
package/package.json
CHANGED
package/tool/client.js
CHANGED
|
@@ -34,38 +34,85 @@
|
|
|
34
34
|
|
|
35
35
|
$addHandler(window, 'focus', function() {
|
|
36
36
|
//$common.alert('浏览器被激活');
|
|
37
|
-
if (files.length
|
|
38
|
-
|
|
39
|
-
var mainPanel = $common.getMainPanel();
|
|
40
|
-
if (!mainPanel || files.includes('js/craba.min.js') || files.includes('js/crabaEx.min.js') || files.includes('js/agency.js') || files.includes('skins/craba.min.css')) {
|
|
41
|
-
window.location.reload();
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
37
|
+
if (files.length <= 0)
|
|
38
|
+
return;
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
40
|
+
// 更新了平台 全部刷新
|
|
41
|
+
var mainPanel = $common.getMainPanel();
|
|
42
|
+
if (!mainPanel || files.includes('js/craba.min.js') || files.includes('js/crabaEx.min.js') || files.includes('js/agency.js')) {
|
|
43
|
+
window.location.reload();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
52
46
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
console.log('文件变动:', files);
|
|
48
|
+
$app.isHotRefresh = true;
|
|
49
|
+
$craba._mods.def = new Date().getTime(); // 重置版本号,防止浏览器缓存
|
|
50
|
+
|
|
51
|
+
var cssLinks = [];
|
|
52
|
+
var gspxLinks = [];
|
|
53
|
+
var jsLinks = [];
|
|
54
|
+
var loadedJs = $jsLoader._getLoadedScripts();
|
|
55
|
+
files.forEach(function(filePath) {
|
|
56
|
+
// 没有加载过的js,不需要刷新
|
|
57
|
+
var index = loadedJs.findIndex(function(ls) {
|
|
58
|
+
return ls.includes(filePath);
|
|
59
|
+
});
|
|
60
|
+
if (index > -1) {
|
|
61
|
+
Array.removeAt(loadedJs, index);
|
|
62
|
+
jsLinks.push(filePath);
|
|
63
|
+
} else if (filePath.includes('.css')) {
|
|
64
|
+
cssLinks.push(filePath);
|
|
65
|
+
} else if (filePath.includes('.gspx')) {
|
|
66
|
+
gspxLinks.push(filePath);
|
|
56
67
|
}
|
|
68
|
+
});
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
$
|
|
61
|
-
$
|
|
70
|
+
// 1. 热更新css
|
|
71
|
+
cssLinks.forEach(function(url) {
|
|
72
|
+
var style = $skin._checkStyle('null', url);
|
|
73
|
+
if (style) $removeNode(style); // 删除老的css
|
|
74
|
+
});
|
|
75
|
+
var cssCount = cssLinks.length;
|
|
76
|
+
// 加载新的css
|
|
77
|
+
$skin.loadCss(cssLinks);
|
|
78
|
+
// 仅有css,不用刷新页面
|
|
79
|
+
if (cssCount == files.length) {
|
|
80
|
+
delete $app.isHotRefresh;
|
|
81
|
+
files = [];
|
|
82
|
+
$common.showOk('css热更新成功');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
62
85
|
|
|
63
|
-
|
|
64
|
-
|
|
86
|
+
// 3. 热更新gspx
|
|
87
|
+
//$typeCaches = {}; // 重置
|
|
88
|
+
$app.gspxCacheList = {}; // 重置缓存
|
|
89
|
+
$app.closeLoadingForm();
|
|
90
|
+
$app.closeAlert();
|
|
91
|
+
|
|
92
|
+
var activeForm = mainPanel.get_activeForm();
|
|
93
|
+
if (!activeForm._firstAction) {
|
|
94
|
+
var action = activeForm._firstAction = activeForm.get_action();
|
|
95
|
+
action._parentAction = action.get_parent(); // 弹窗是动态获取的没有手动关联过
|
|
96
|
+
}
|
|
65
97
|
|
|
66
|
-
|
|
98
|
+
// 先释放页面和action类型
|
|
99
|
+
activeForm.destroyContent();
|
|
67
100
|
|
|
68
|
-
|
|
101
|
+
// 2. 热更新js
|
|
102
|
+
if (jsLinks.length > 0) {
|
|
103
|
+
$common.loadScript({
|
|
104
|
+
srcs: jsLinks,
|
|
105
|
+
loadedFun: function() {
|
|
106
|
+
delete $app.isHotRefresh;
|
|
107
|
+
activeForm.refresh(activeForm.get_url());
|
|
108
|
+
$common.showOk('js热更新成功');
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
delete $app.isHotRefresh;
|
|
113
|
+
activeForm.refresh(activeForm.get_url());
|
|
69
114
|
}
|
|
115
|
+
files = []; // 重置
|
|
116
|
+
$common.showOk('gspx热更新成功');
|
|
70
117
|
});
|
|
71
118
|
})();
|
package/tool/compress.js
CHANGED
|
@@ -81,16 +81,20 @@ function doCompress() {
|
|
|
81
81
|
compressCrabaJs(inNames, 'agency.js', updateAgencyVersion);
|
|
82
82
|
|
|
83
83
|
// craba.min.js
|
|
84
|
-
inNames = ['type.js', 'craba.js', 'common.js', 'es6.js', 'controls.js', 'required.js', 'drag.js', '
|
|
84
|
+
inNames = ['type.js', 'craba.js', 'common.js', 'es6.js', 'controls.js', 'required.js', 'drag.js', 'crabaEx.js', 'crabaFC.js', 'crabaMS.js'];
|
|
85
85
|
compressCrabaJs(inNames, 'craba.min.js', updateCrabaVersion);
|
|
86
86
|
|
|
87
87
|
// crabaEx.min.js
|
|
88
|
-
inNames = ['grid.js', 'controlsEx.js', '
|
|
88
|
+
inNames = ['grid.js', 'controlsEx.js', 'biz.js'];
|
|
89
89
|
compressCrabaJs(inNames, 'crabaEx.min.js');
|
|
90
90
|
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
// 其他独立的大组件
|
|
92
|
+
compressCrabaJs(['listView.js'], 'listView.js');
|
|
93
|
+
compressCrabaJs(['workflow.js'], 'workflow.js');
|
|
94
|
+
compressCrabaJs(['dress.js'], 'dress.js');
|
|
95
|
+
compressCrabaJs(['htmlEditor.js'], 'htmlEditor.js');
|
|
96
|
+
compressCrabaJs(['print.js'], 'print.js');
|
|
97
|
+
compressCrabaJs(['treeView.js'], 'treeView.js');
|
|
94
98
|
|
|
95
99
|
|
|
96
100
|
// echarts
|