Browse Source

Merge pull request #7 in ~GUY/fineui from ~WINDY/fineui:2.0 to 2.0

* commit '7a9ec0dcabc56ace4cdd68dbd6a10d50e74c336b':
  update
es6
windy 8 years ago
parent
commit
8188e0f44b
  1. 3
      Gruntfile.js
  2. 2
      demo/config.js
  3. 39
      demo/js/component/demo.treevaluechooser.js
  4. 29
      demo/js/component/demo.valuechooser.js
  5. 15
      demo/js/config/component.js
  6. 14
      demo/js/widget/demo.multiselecttree.js
  7. 58
      dist/base.css
  8. 40
      dist/base.js
  9. 14
      dist/case.js
  10. 621
      dist/core.js
  11. 0
      dist/farbtastic/marker.png
  12. 0
      dist/farbtastic/mask.png
  13. 0
      dist/farbtastic/wheel.png
  14. 728
      dist/widget.js
  15. 0
      dist/ztree/img/line_conn.gif
  16. 0
      dist/ztree/img/loading.gif
  17. 0
      dist/ztree/img/zTreeStandard.gif
  18. 0
      dist/ztree/img/zTreeStandard.png
  19. 4
      src/base/farbtastic/farbtastic.js
  20. 2
      src/base/foundation/bi.message.js
  21. 16
      src/base/single/input/file.js
  22. 2
      src/base/tree/synctree.js
  23. 16
      src/base/tree/treeview.js
  24. 10
      src/case/logintimeout/login.timeout.js
  25. 4
      src/case/zclip/zclip.js
  26. 599
      src/component/combo.treevaluechooser.js
  27. 127
      src/component/combo.valuechooser.js
  28. 591
      src/core/alias.js
  29. 23
      src/core/base.js
  30. 2
      src/core/func/function.js
  31. 2
      src/core/model.js
  32. 2
      src/core/utils/load.js
  33. 6
      src/css/base/third/farbtastic/farbtastic.css
  34. 50
      src/css/base/third/ztree/zTreeStyle.css
  35. 2
      src/css/base/view/popupview.css
  36. 6
      src/less/base/third/farbtastic/farbtastic.less
  37. 46
      src/less/base/third/ztree/zTreeStyle.less
  38. 2
      src/less/base/view/popupview.less
  39. 2
      src/widget/image/uploadimage.js

3
Gruntfile.js

@ -62,7 +62,8 @@ module.exports = function (grunt) {
src: [
'src/widget/paramsettingcombo/popup.param.js',
'src/widget/sequencetable/treenumber.sequencetable.js',
'src/widget/**/*.js'
'src/widget/**/*.js',
'src/component/**/*.js'
],
dest: "dist/widget.js"
},

2
demo/config.js

@ -1 +1 @@
Demo.CONFIG = Demo.LAYOUT_CONFIG.concat(Demo.BASE_CONFIG).concat(Demo.CASE_CONFIG).concat(Demo.WIDGET_CONFIG);
Demo.CONFIG = Demo.LAYOUT_CONFIG.concat(Demo.BASE_CONFIG).concat(Demo.CASE_CONFIG).concat(Demo.WIDGET_CONFIG).concat(Demo.COMPONENT_CONFIG);

39
demo/js/component/demo.treevaluechooser.js

@ -0,0 +1,39 @@
Demo.TreeValueChooser = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-tree-value-chooser"
},
render: function () {
var tree = [];
for (var i = 0; i < 21; i++) {
tree.push({
value: i + "",
text: i + "",
id: i + "",
pId: null
});
for (var j = 0; j < 9; j++) {
tree.push({
value: i + "-" + j,
text: j + "",
id: i + "-" + j,
pId: i + ""
})
}
}
var widget = BI.createWidget({
type: "bi.tree_value_chooser_combo",
items: tree,
itemsCreator: function (op, callback) {
callback(tree);
}
});
return {
type: "bi.vertical",
hgap: 200,
vgap: 10,
items: [widget]
};
}
});
$.shortcut("demo.tree_value_chooser", Demo.TreeValueChooser);

29
demo/js/component/demo.valuechooser.js

File diff suppressed because one or more lines are too long

15
demo/js/config/component.js

@ -0,0 +1,15 @@
/**
* Created by User on 2017/3/22.
*/
Demo.COMPONENT_CONFIG = [{
id: 15,
text: "部件"
}, {
pId: 15,
text: "bi.value_chooser_combo",
value: "demo.value_chooser_combo"
}, {
pId: 15,
text: "bi.tree_value_chooser_combo",
value: "demo.tree_value_chooser"
}];

14
demo/js/widget/demo.multiselecttree.js

@ -1,14 +0,0 @@
/**
* Created by User on 2017/3/22.
*/
Demo.MultiSelectTree = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-multi-select-tree"
},
render: function () {
return {
type: "bi.vertical",
}
}
});
$.shortcut("demo.multi_select_tree", Demo.MultiSelectTree);

58
dist/base.css vendored

@ -1344,19 +1344,19 @@ li.CodeMirror-hint-active {
height: 101px;
}
.farbtastic .wheel {
background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/wheel.png) no-repeat;
background: url(farbtastic/wheel.png) no-repeat;
width: 195px;
height: 195px;
}
.farbtastic .overlay {
background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/mask.png) no-repeat;
background: url(farbtastic/mask.png) no-repeat;
}
.farbtastic .marker {
width: 17px;
height: 17px;
margin: -8px 0 0 -8px;
overflow: hidden;
background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/marker.png) no-repeat;
background: url(farbtastic/marker.png) no-repeat;
}
/* required styles */
.leaflet-pane,
@ -1880,7 +1880,7 @@ website: http://code.google.com/p/jquerytree/
padding: 0 0 0 18px;
}
.ztree li ul.line {
background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-1.png) 0 0 repeat-y;
background: url(icon/tree-vertical-line-1.png) 0 0 repeat-y;
}
.ztree li a {
padding: 1px 3px 0 0;
@ -1935,8 +1935,8 @@ website: http://code.google.com/p/jquerytree/
background-color: transparent;
background-repeat: no-repeat;
background-attachment: scroll;
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png");
*background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif");
background-image: url("ztree/img/zTreeStandard.png");
*background-image: url("ztree/img/zTreeStandard.gif");
}
.ztree li span.button.chk {
width: 16px;
@ -1945,31 +1945,31 @@ website: http://code.google.com/p/jquerytree/
cursor: auto;
}
.ztree li span.button.chk.checkbox_false_full {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png");
background-image: url("icon/check-box-normal.png");
}
.ztree li span.button.chk.checkbox_false_full_focus {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png");
background-image: url("icon/check-box-normal.png");
}
.ztree li span.button.chk.checkbox_false_part {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image: url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_false_part_focus {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image: url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_false_disable {
background-position: 0 -56px;
}
.ztree li span.button.chk.checkbox_true_full {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png");
background-image: url("icon/check-box-active.png");
}
.ztree li span.button.chk.checkbox_true_full_focus {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png");
background-image: url("icon/check-box-active.png");
}
.ztree li span.button.chk.checkbox_true_part {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image: url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_true_part_focus {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image: url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_true_disable {
background-position: -14px -56px;
@ -2009,28 +2009,28 @@ website: http://code.google.com/p/jquerytree/
height: 25px;
}
.ztree li span.button.root_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-1.png");
background-image: url("icon/tree-expand-1.png");
}
.ztree li span.button.root_close {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-1.png");
background-image: url("icon/tree-collapse-1.png");
}
.ztree li span.button.roots_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-2.png");
background-image: url("icon/tree-expand-2.png");
}
.ztree li span.button.roots_close {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-2.png");
background-image: url("icon/tree-collapse-2.png");
}
.ztree li span.button.center_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-3.png");
background-image: url("icon/tree-expand-3.png");
}
.ztree li span.button.center_close {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-3.png");
background-image: url("icon/tree-collapse-3.png");
}
.ztree li span.button.bottom_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-4.png");
background-image: url("icon/tree-expand-4.png");
}
.ztree li span.button.bottom_close {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-4.png");
background-image: url("icon/tree-collapse-4.png");
}
.ztree li span.button.noline_open {
background-position: -92px -72px;
@ -2042,13 +2042,13 @@ website: http://code.google.com/p/jquerytree/
background: none;
}
.ztree li span.button.roots_docu {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-2.png");
background-image: url("icon/tree-vertical-line-2.png");
}
.ztree li span.button.center_docu {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-3.png");
background-image: url("icon/tree-vertical-line-3.png");
}
.ztree li span.button.bottom_docu {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-4.png");
background-image: url("icon/tree-vertical-line-4.png");
}
.ztree li span.button.noline_docu {
background: none;
@ -2086,7 +2086,7 @@ website: http://code.google.com/p/jquerytree/
.ztree li span.button.ico_loading {
width: 0px;
margin-right: 2px;
background: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif") no-repeat scroll 0 0 transparent;
background: url("ztree/img/loading.gif") no-repeat scroll 0 0 transparent;
vertical-align: top;
*vertical-align: middle;
}
@ -2107,8 +2107,8 @@ span.tmpzTreeMove_arrow {
background-repeat: no-repeat;
background-attachment: scroll;
background-position: -110px -80px;
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png");
*background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif");
background-image: url("ztree/img/zTreeStandard.png");
*background-image: url("ztree/img/zTreeStandard.gif");
}
ul.ztree.zTreeDragUL {
margin: 0;
@ -2260,7 +2260,7 @@ ul.ztree.zTreeDragUL {
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/**********FR.BIListView*************/
/**********BI.BIListView*************/
.bi-list-view {
position: fixed !important;
overflow-y: visible !important;

40
dist/base.js vendored

@ -21851,9 +21851,9 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
_init: function () {
BI.TreeView.superclass._init.apply(this, arguments);
FR.$defaultImport('/com/fr/bi/web/js/third/ztree/jquery.ztree.core-3.5.js', 'js');
FR.$defaultImport('/com/fr/bi/web/js/third/ztree/jquery.ztree.excheck-3.5.js', 'js');
FR.$defaultImport('/com/fr/bi/web/css/base/third/ztree/zTreeStyle.css', 'css');
this._stop = false;
this.container = BI.createWidget();
@ -21908,7 +21908,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
enable: true,
url: getUrl,
autoParam: ["id", "name"],
otherParam: FR.cjkEncodeDO(paras)
otherParam: BI.cjkEncodeDO(paras)
},
check: {
enable: true
@ -21950,10 +21950,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
treeNode.times = treeNode.times || 1;
var param = "id=" + treeNode.id
+ "&times=" + (treeNode.times++)
+ "&parent_values= " + window.encodeURIComponent(FR.jsonEncode(parentNode))
+ "&check_state=" + window.encodeURIComponent(FR.jsonEncode(treeNode.getCheckStatus()));
+ "&parent_values= " + window.encodeURIComponent(BI.jsonEncode(parentNode))
+ "&check_state=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus()));
return FR.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param;
return BI.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param;
}
function beforeExpand(treeId, treeNode) {
@ -22002,7 +22002,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
function ajaxGetNodes(treeNode, reloadType) {
var zTree = self.nodes;
if (reloadType == "refresh") {
//treeNode.icon = FR.servletURL +"?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif";
//treeNode.icon = BI.servletURL +"?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif";
zTree.updateNode(treeNode);
}
zTree.reAsyncChildNodes(treeNode, reloadType, true);
@ -22362,7 +22362,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
var setting = {
async: {
enable: false,
otherParam: FR.cjkEncodeDO(paras)
otherParam: BI.cjkEncodeDO(paras)
},
check: {
enable: true
@ -25091,8 +25091,8 @@ BI.Farbtastic = BI.inherit(BI.Widget, {
_init: function () {
BI.Farbtastic.superclass._init.apply(this, arguments);
var self = this;
FR.$defaultImport('/com/fr/bi/web/js/third/farbtastic.js', 'js');
FR.$defaultImport('/com/fr/bi/web/css/base/third/farbtastic/farbtastic.css', 'css');
this.farbtastic = $.farbtastic(this.element, function (v) {
self.fireEvent(BI.Farbtastic.EVENT_CHANGE, self.getValue(), self);
@ -34693,7 +34693,7 @@ $.extend(BI, {
this._show(true, title, message, callback);
},
prompt: function (title, message, value, callback, min_width) {
FR.Msg.prompt(title, message, value, callback, min_width);
BI.Msg.prompt(title, message, value, callback, min_width);
},
toast: function (message, level, context) {
context = context || $("body");
@ -38815,7 +38815,7 @@ $.shortcut("bi.checkbox", BI.Checkbox);/**
var multipart = function (boundary, name, file) {
return "--".concat(
boundary, CRLF,
'Content-Disposition: form-data; name="', name, '"; filename="', FR.cjkEncode(file.fileName), '"', CRLF,
'Content-Disposition: form-data; name="', name, '"; filename="', BI.cjkEncode(file.fileName), '"', CRLF,
"Content-Type: application/octet-stream", CRLF,
CRLF,
file.getAsBinary(), CRLF,
@ -38884,7 +38884,7 @@ $.shortcut("bi.checkbox", BI.Checkbox);/**
},
false
);
xhr.open("post", handler.url + '&filename=' + FR.cjkEncode(handler.file.fileName), true);
xhr.open("post", handler.url + '&filename=' + BI.cjkEncode(handler.file.fileName), true);
if (!xhr.upload) {
var rpe = {loaded: 0, total: handler.file.fileSize || handler.file.size, simulation: true};
rpe.interval = setInterval(function () {
@ -38915,8 +38915,8 @@ $.shortcut("bi.checkbox", BI.Checkbox);/**
upload.onprogress(rpe);
if (199 < xhr.status && xhr.status < 400) {
upload["onload"]({});
var attachO = FR.jsonDecode(xhr.responseText);
attachO.filename = FR.cjkDecode(handler.file.fileName);
var attachO = BI.jsonDecode(xhr.responseText);
attachO.filename = BI.cjkDecode(handler.file.fileName);
if (handler.file.type.indexOf('image') != -1) {
attachO.attach_type = "image";
}
@ -38932,7 +38932,7 @@ $.shortcut("bi.checkbox", BI.Checkbox);/**
xhr.onreadystatechange = function () {
switch (xhr.readyState) {
case 4:
var attachO = FR.jsonDecode(xhr.responseText);
var attachO = BI.jsonDecode(xhr.responseText);
if (handler.file.type.indexOf('image') != -1) {
attachO.attach_type = "image";
}
@ -38982,13 +38982,13 @@ $.shortcut("bi.checkbox", BI.Checkbox);/**
//rpe.loaded = rpe.total;
try {
var responseText = (iframe.contentWindow.document || iframe.contentWindow.contentDocument).body.innerHTML;
var attachO = FR.jsonDecode(responseText);
var attachO = BI.jsonDecode(responseText);
if (handler.file.type.indexOf('image') != -1) {
attachO.attach_type = "image";
}
//attachO.fileSize = responseText.length;
attachO.filename = FR.cjkDecode(handler.file.fileName);
attachO.filename = BI.cjkDecode(handler.file.fileName);
if (handler.maxlength == 1) {
handler.attach_array[0] = attachO;
} else {
@ -39205,7 +39205,7 @@ $.shortcut("bi.checkbox", BI.Checkbox);/**
// enable again the submit button/element
}, 1000);
};
_wrap.url = o.url ? o.url : FR.servletURL
_wrap.url = o.url ? o.url : BI.servletURL
+ '?op=fr_attach&cmd=ah_upload';
_wrap.fileType = o.accept; //文件类型限制
_wrap.attach_array = [];

14
dist/case.js vendored

@ -5622,9 +5622,9 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, {
}
//反正是登录直接用FR的登录了
FR.ajax({
url: FR.servletURL + '?op=fs_load&cmd=login',
data: FR.cjkEncodeDO({
BI.ajax({
url: BI.servletURL + '?op=fs_load&cmd=login',
data: BI.cjkEncodeDO({
fr_username: encodeURIComponent(userNameInput.getValue()),
fr_password: encodeURIComponent(passwordInput.getValue()),
fr_remember: self.keepLoginState.isSelected()
@ -5639,7 +5639,7 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, {
self._showMes(userNameMask, BI.i18nText("BI-Authentication_Failed"));
return;
}
var signResult = FR.jsonDecode(res.responseText);
var signResult = BI.jsonDecode(res.responseText);
if (signResult.fail) {
//用户名和密码不匹配
self._showMes(userNameMask, BI.i18nText("BI-Username_Password_Not_Correct"));
@ -5663,7 +5663,7 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, {
type: "bi.center_adapt",
items: [{
type: "bi.img",
src: FR.servletURL + (logo ?
src: BI.servletURL + (logo ?
'?op=fr_attach&cmd=ah_image&id=' + logo + '&isAdjust=false' :
'?op=resource&resource=/com/fr/bi/web/images/login/bi_logo.png'),
width: 120,
@ -9322,10 +9322,10 @@ BI.ZeroClip = BI.inherit(BI.BasicButton, {
_init: function () {
BI.ZeroClip.superclass._init.apply(this, arguments);
var self = this, o = this.options;
FR.$defaultImport('/com/fr/bi/web/js/third/jquery.zclip.js', 'js');
BI.nextTick(function () {
self.element.zclip({
path: FR.servletURL + "?op=resource&resource=/com/fr/bi/web/resources/ZeroClipboard.swf",
path: BI.servletURL + "?op=resource&resource=/com/fr/bi/web/resources/ZeroClipboard.swf",
copy: o.copy,
beforeCopy: o.beforeCopy,
afterCopy: o.afterCopy

621
dist/core.js vendored

@ -13778,10 +13778,6 @@ if (!window.BI) {
return BI.isString(str) && BI.isEmpty(str);
},
contentFormat: function () {
return FR.contentFormat.apply(FR, arguments);
},
/**
* 对字符串进行加密 {@link #decrypt}
* @static
@ -13975,7 +13971,12 @@ if (!window.BI) {
}
timeoutToast.addReq(option);
FR.ajax({
option.data = BI.cjkEncodeDO(option.data);
$.ajax({
url: option.url,
type: "POST",
data: option.data,
@ -14030,10 +14031,10 @@ if (!window.BI) {
loading.showError();
} else if (status === "success" && BI.isFunction(option.success)) {
option.success(FR.jsonDecode(res.responseText));
option.success(BI.jsonDecode(res.responseText));
}
if (BI.isFunction(option.complete)) {
option.complete(FR.jsonDecode(res.responseText), status);
option.complete(BI.jsonDecode(res.responseText), status);
}
}
});
@ -14045,7 +14046,7 @@ if (!window.BI) {
function encodeBIParam(data) {
for (var key in data) {
if (_.isObject(data[key])) {
data[key] = window.encodeURIComponent(FR.jsonEncode(data[key]));
data[key] = window.encodeURIComponent(BI.jsonEncode(data[key]));
} else {
data[key] = window.encodeURIComponent(data[key]);
}
@ -14056,7 +14057,7 @@ if (!window.BI) {
for (var key in data) {
data[key] = window.decodeURIComponent(data[key]);
if (_.isObject(data[key])) {
data[key] = FR.jsonDecode(data[key]);
data[key] = BI.jsonDecode(data[key]);
}
}
}
@ -14079,7 +14080,7 @@ if (!window.BI) {
if (op === "fr_bi_dezi" || op === "fr_bi_configure") {
data.sessionID = Data.SharingPool.get("sessionID");
}
var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
var url = BI.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
return (BI.ajax)({
url: url,
type: 'POST',
@ -14115,7 +14116,7 @@ if (!window.BI) {
if (op === "fr_bi_dezi") {
data.sessionID = Data.SharingPool.get("sessionID");
}
var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
var url = BI.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
var result = {};
(BI.ajax)({
url: url,
@ -15050,7 +15051,7 @@ BI.Widget = BI.inherit(BI.OB, {
},
urlRoot: function () {
return FR.servletURL;
return BI.servletURL;
},
parse: function (data) {
@ -17480,7 +17481,7 @@ $.extend(BI, {
type: null,
must: false
}, options);
config.url = FR.servletURL + '?op=' + config.op + '&resource=' + config.path;
config.url = BI.servletURL + '?op=' + config.op + '&resource=' + config.path;
this.$import(config.url, config.type,config.must);
},
$import: function () {
@ -19640,7 +19641,597 @@ BI.PopoverSection = BI.inherit(BI.Widget, {
}
});
BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";/**
BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";BI.cjkEncode = function (text) {
// alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的)
if (typeof text !== 'string') {
return text;
}
var newText = "";
for (var i = 0; i < text.length; i++) {
var code = text.charCodeAt(i);
if (code >= 128 || code === 91 || code === 93) {//91 is "[", 93 is "]".
newText += "[" + code.toString(16) + "]";
} else {
newText += text.charAt(i);
}
}
return newText
};
BI.cjkEncodeDO = function (o) {
if (BI.isPlainObject(o)) {
var result = {};
$.each(o, function (k, v) {
if (!(typeof v == "string")) {
v = BI.jsonEncode(v);
}
//wei:bug 43338,如果key是中文,cjkencode后o的长度就加了1,ie9以下版本死循环,所以新建对象result。
k = BI.cjkEncode(k);
result[k] = BI.cjkEncode(v);
});
return result;
}
return o;
};
BI.jsonEncode = function (o) {
//james:这个Encode是抄的EXT的
var useHasOwn = {}.hasOwnProperty ? true : false;
// crashes Safari in some instances
//var validRE = /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/;
var m = {
"\b": '\\b',
"\t": '\\t',
"\n": '\\n',
"\f": '\\f',
"\r": '\\r',
'"': '\\"',
"\\": '\\\\'
};
var encodeString = function (s) {
if (/["\\\x00-\x1f]/.test(s)) {
return '"' + s.replace(/([\x00-\x1f\\"])/g, function (a, b) {
var c = m[b];
if (c) {
return c;
}
c = b.charCodeAt();
return "\\u00" +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
}) + '"';
}
return '"' + s + '"';
};
var encodeArray = function (o) {
var a = ["["], b, i, l = o.length, v;
for (i = 0; i < l; i += 1) {
v = o[i];
switch (typeof v) {
case "undefined":
case "function":
case "unknown":
break;
default:
if (b) {
a.push(',');
}
a.push(v === null ? "null" : BI.jsonEncode(v));
b = true;
}
}
a.push("]");
return a.join("");
};
if (typeof o == "undefined" || o === null) {
return "null";
} else if (BI.isArray(o)) {
return encodeArray(o);
} else if (o instanceof Date) {
/*
* alex:原来只是把年月日时分秒简单地拼成一个String,无法decode
* 现在这么处理就可以decode了,但是JS.jsonDecode和Java.JSONObject也要跟着改一下
*/
return BI.jsonEncode({
__time__: o.getTime()
})
} else if (typeof o == "string") {
return encodeString(o);
} else if (typeof o == "number") {
return isFinite(o) ? String(o) : "null";
} else if (typeof o == "boolean") {
return String(o);
} else if (BI.isFunction(o)) {
return String(o);
} else {
var a = ["{"], b, i, v;
for (i in o) {
if (!useHasOwn || o.hasOwnProperty(i)) {
v = o[i];
switch (typeof v) {
case "undefined":
case "unknown":
break;
default:
if (b) {
a.push(',');
}
a.push(BI.jsonEncode(i), ":",
v === null ? "null" : BI.jsonEncode(v));
b = true;
}
}
}
a.push("}");
return a.join("");
}
};
BI.contentFormat = function (cv, fmt) {
if (BI.isEmpty(cv)) {
//原值为空,返回空字符
return '';
}
var text = cv.toString();
if (BI.isEmpty(fmt)) {
//格式为空,返回原字符
return text;
}
if (fmt.match(/^T/)) {
//T - 文本格式
return text;
} else if (fmt.match(/^D/)) {
//D - 日期(时间)格式
if (!(cv instanceof Date)) {
if (typeof cv === 'number') {
//毫秒数类型
cv = new Date(cv);
} else {
//字符串类型,如yyyyMMdd、MMddyyyy等这样无分隔符的结构
cv = Date.parseDate(cv + "", Date.patterns.ISO8601Long);
}
}
if (!BI.isNull(cv)) {
var needTrim = fmt.match(/^DT/);
text = BI.date2Str(cv, fmt.substring(needTrim ? 2 : 1));
}
} else if (fmt.match(/E/)) {
//科学计数格式
text = BI._eFormat(text, fmt);
} else {
//数字格式
text = BI._numberFormat(text, fmt);
}
//¤ - 货币格式
text = text.replace(/¤/g, '¥');
return text;
};
/**
* 把日期对象按照指定格式转化成字符串
*
* @example
* var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800');
* var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12
*
* @class BI.date2Str
* @param date 日期
* @param format 日期格式
* @returns {String}
*/
date2Str = function (date, format) {
if (!date) {
return '';
}
// O(len(format))
var len = format.length, result = '';
if (len > 0) {
var flagch = format.charAt(0), start = 0, str = flagch;
for (var i = 1; i < len; i++) {
var ch = format.charAt(i);
if (flagch !== ch) {
result += compileJFmt({
'char': flagch,
'str': str,
'len': i - start
}, date);
flagch = ch;
start = i;
str = flagch;
} else {
str += ch;
}
}
result += compileJFmt({
'char': flagch,
'str': str,
'len': len - start
}, date);
}
return result;
function compileJFmt(jfmt, date) {
var str = jfmt.str, len = jfmt.len, ch = jfmt['char'];
switch (ch) {
case 'E': //星期
str = Date._DN[date.getDay()];
break;
case 'y': //年
if (len <= 3) {
str = (date.getFullYear() + '').slice(2, 4);
} else {
str = date.getFullYear();
}
break;
case 'M': //月
if (len > 2) {
str = Date._MN[date.getMonth()];
} else if (len < 2) {
str = date.getMonth() + 1;
} else {
str = String.leftPad(date.getMonth() + 1 + '', 2, '0');
}
break;
case 'd': //日
if (len > 1) {
str = String.leftPad(date.getDate() + '', 2, '0');
} else {
str = date.getDate();
}
break;
case 'h': //时(12)
var hour = date.getHours() % 12;
if (hour === 0) {
hour = 12;
}
if (len > 1) {
str = String.leftPad(hour + '', 2, '0');
} else {
str = hour;
}
break;
case 'H': //时(24)
if (len > 1) {
str = String.leftPad(date.getHours() + '', 2, '0');
} else {
str = date.getHours();
}
break;
case 'm':
if (len > 1) {
str = String.leftPad(date.getMinutes() + '', 2, '0');
} else {
str = date.getMinutes();
}
break;
case 's':
if (len > 1) {
str = String.leftPad(date.getSeconds() + '', 2, '0');
} else {
str = date.getSeconds();
}
break;
case 'a':
str = date.getHours() < 12 ? 'am' : 'pm';
break;
case 'z':
str = date.getTimezone();
break;
default:
str = jfmt.str;
break;
}
return str;
}
};
/**
* 数字格式
*/
BI._numberFormat = function (text, format) {
var text = text + '';
//数字格式,区分正负数
var numMod = format.indexOf(';');
if (numMod > -1) {
if (text >= 0) {
return BI._numberFormat(text + "", format.substring(0, numMod));
} else {
return BI._numberFormat((-text) + "", format.substr(numMod + 1));
}
}
var tp = text.split('.'), fp = format.split('.'),
tleft = tp[0] || '', fleft = fp[0] || '',
tright = tp[1] || '', fright = fp[1] || '';
//百分比,千分比的小数点移位处理
if (/[%‰]$/.test(format)) {
var paddingZero = /[%]$/.test(format) ? '00' : '000';
tright += paddingZero;
tleft += tright.substr(0, paddingZero.length);
tleft = tleft.replace(/^0+/gi, '');
tright = tright.substr(paddingZero.length).replace(/0+$/gi, '');
}
var right = BI._dealWithRight(tright, fright);
if (right.leftPlus) {
//小数点后有进位
tleft = parseInt(tleft) + 1 + '';
tleft = isNaN(tleft) ? '1' : tleft;
}
right = right.num;
var left = BI._dealWithLeft(tleft, fleft);
if (!(/[0-9]/.test(left))) {
left = left + '0';
}
if (!(/[0-9]/.test(right))) {
return left + right;
} else {
return left + '.' + right;
}
};
/**
* 处理小数点右边小数部分
* @param tright 右边内容
* @param fright 右边格式
* @returns {JSON} 返回处理结果和整数部分是否需要进位
* @private
*/
BI._dealWithRight = function (tright, fright) {
var right = '', j = 0, i = 0;
for (var len = fright.length; i < len; i++) {
var ch = fright.charAt(i);
var c = tright.charAt(j);
switch (ch) {
case '0':
if (BI.isEmpty(c)) {
c = '0';
}
right += c;
j++;
break;
case '#':
right += c;
j++;
break;
default :
right += ch;
break;
}
}
var rll = tright.substr(j);
var result = {};
if (!BI.isEmpty(rll) && rll.charAt(0) > 4) {
//有多余字符,需要四舍五入
result.leftPlus = true;
var numReg = right.match(/^[0-9]+/);
if (numReg) {
var num = numReg[0];
var orilen = num.length;
var newnum = BI.parseINT(num) + 1 + '';
//进位到整数部分
if (newnum.length > orilen) {
newnum = newnum.substr(1);
} else {
newnum = BI.leftPad(newnum, orilen, '0');
result.leftPlus = false;
}
right = right.replace(/^[0-9]+/, newnum);
}
}
result.num = right;
return result;
};
BI.parseINT = function (str) {
return parseInt(str, 10);
};
BI.leftPad = function (val, size, ch) {
var result = String(val);
if (!ch) {
ch = " ";
}
while (result.length < size) {
result = ch + result;
}
return result.toString();
};
/**
* 处理小数点左边整数部分
* @param tleft 左边内容
* @param fleft 左边格式
* @returns {string} 返回处理结果
* @private
*/
BI._dealWithLeft = function (tleft, fleft) {
var left = '';
var j = tleft.length - 1;
var combo = -1, last = -1;
var i = fleft.length - 1;
for (; i >= 0; i--) {
var ch = fleft.charAt(i);
var c = tleft.charAt(j);
switch (ch) {
case '0':
if (BI.isEmpty(c)) {
c = '0';
}
last = -1;
left = c + left;
j--;
break;
case '#':
last = i;
left = c + left;
j--;
break;
case ',':
if (!BI.isEmpty(c)) {
//计算一个,分隔区间的长度
var com = fleft.match(/,[#0]+/);
if (com) {
combo = com[0].length - 1;
}
left = ',' + left;
}
break;
default :
left = ch + left;
break;
}
}
if (last > -1) {
//处理剩余字符
var tll = tleft.substr(0, j + 1);
left = left.substr(0, last) + tll + left.substr(last);
}
if (combo > 0) {
//处理,分隔区间
var res = left.match(/[0-9]+,/);
if (res) {
res = res[0];
var newstr = '', n = res.length - 1 - combo;
for (; n >= 0; n = n - combo) {
newstr = res.substr(n, combo) + ',' + newstr;
}
var lres = res.substr(0, n + combo);
if (!BI.isEmpty(lres)) {
newstr = lres + ',' + newstr;
}
}
left = left.replace(/[0-9]+,/, newstr);
}
return left;
};
BI.object2Number = function (value) {
if (value == null) {
return 0;
}
if (typeof value == 'number') {
return value;
} else {
var str = value + "";
if (str.indexOf(".") === -1) {
return parseInt(str);
} else {
return parseFloat(str);
}
}
};
BI.object2Date = function (obj) {
if (obj == null) {
return new Date();
}
if (obj instanceof Date) {
return obj;
} else if (typeof obj == 'number') {
return new Date(obj);
} else {
var str = obj + "";
str = str.replace(/-/g, '/');
var dt = new Date(str);
if (!BI.isInvalidDate(dt)) {
return dt;
}
return new Date();
}
};
BI.isArray = function (a) {
return Object.prototype.toString.call(a) == '[object Array]';
};
BI.object2Time = function (obj) {
if (obj == null) {
return new Date();
}
if (obj instanceof Date) {
return obj;
} else {
var str = obj + "";
str = str.replace(/-/g, '/');
var dt = new Date(str);
if (!BI.isInvalidDate(dt)) {
return dt;
}
if (str.indexOf('/') === -1 && str.indexOf(':') !== -1) {
dt = new Date("1970/01/01 " + str);
if (!BI.isInvalidDate(dt)) {
return dt;
}
}
dt = BI.str2Date(str, "HH:mm:ss");
if (!BI.isInvalidDate(dt)) {
return dt;
}
return new Date();
}
};
// 判断是否是无效的日期
BI.isInvalidDate = function (date) {
return date == "Invalid Date" || date == "NaN";
};
/**
* 科学计数格式
*/
BI._eFormat = function (text, fmt) {
var e = fmt.indexOf("E");
var eleft = fmt.substr(0, e), eright = fmt.substr(e + 1);
if (/^[0\.-]+$/.test(text)) {
text = BI._numberFormat(0.0, eleft) + 'E' + BI._numberFormat(0, eright)
} else {
var isNegative = text < 0;
if (isNegative) {
text = text.substr(1);
}
var elvl = (eleft.split('.')[0] || '').length;
var point = text.indexOf(".");
if (point < 0) {
point = text.length;
}
var i = 0; //第一个不为0的数的位置
text = text.replace('.', '');
for (var len = text.length; i < len; i++) {
var ech = text.charAt(i);
if (ech <= '9' && ech >= '1') {
break;
}
}
var right = point - i - elvl;
var left = text.substr(i, elvl);
var dis = i + elvl - text.length;
if (dis > 0) {
//末位补全0
for (var k = 0; k < dis; k++) {
left += '0';
}
} else {
left += '.' + text.substr(i + elvl);
}
left = left.replace(/^[0]+/, '');
if (right < 0 && eright.indexOf('-') < 0) {
eright += ';-' + eright;
}
text = BI._numberFormat(left, eleft) + 'E' + BI._numberFormat(right, eright);
if (isNegative) {
text = '-' + text;
}
}
return text;
};/**
* guy
*
* @class BI.HighlightBehavior
@ -21823,7 +22414,7 @@ $(function () {
},
getCompleteImageUrl: function (url) {
return FR.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url;
return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url;
}
});

0
src/less/base/third/farbtastic/marker.png → dist/farbtastic/marker.png vendored

Before

Width:  |  Height:  |  Size: 652 B

After

Width:  |  Height:  |  Size: 652 B

0
src/less/base/third/farbtastic/mask.png → dist/farbtastic/mask.png vendored

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

0
src/less/base/third/farbtastic/wheel.png → dist/farbtastic/wheel.png vendored

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

728
dist/widget.js vendored

@ -12981,7 +12981,7 @@ BI.UploadImage = BI.inherit(BI.Widget, {
BI.extend(BI.UploadImage, {
getImageSrc: function (src) {
return FR.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + src;
return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + src;
}
});
@ -30143,4 +30143,728 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, {
}
});
BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
$.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);
$.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);/**
* 简单的复选下拉树控件, 适用于数据量少的情况
*
* Created by GUY on 2015/10/29.
* @class BI.TreeValueChooserCombo
* @extends BI.Widget
*/
BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
_const: {
perPage: 10
},
_defaultConfig: function () {
return BI.extend(BI.TreeValueChooserCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-tree-value-chooser-combo",
width: 200,
height: 30,
items: null,
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.TreeValueChooserCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (BI.isNotNull(o.items)) {
this._initData(o.items);
}
this.combo = BI.createWidget({
type: 'bi.multi_tree_combo',
element: this.element,
itemsCreator: BI.bind(this._itemsCreator, this),
width: o.width,
height: o.height
});
this.combo.on(BI.MultiTreeCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.TreeValueChooserCombo.EVENT_CONFIRM);
});
},
_initData: function (items) {
this.items = items;
var nodes = BI.Tree.transformToTreeFormat(items);
this.tree = new BI.Tree();
this.tree.initTree(nodes);
this._initMap();
this._initFloors();
},
_initMap: function () {
var map = this.map = {};
BI.each(this.items, function (i, item) {
map[item.value] = item;
});
},
_initFloors: function () {
this.floors = -1;
var root = this.tree.getRoot();
while (root) {
this.floors++;
root = root.getChildren()[0];
}
},
_itemsCreator: function (options, callback) {
var self = this, o = this.options;
if (!this.items) {
o.itemsCreator({}, function (items) {
self._initData(items);
call();
});
} else {
call();
}
function call() {
switch (options.type) {
case BI.TreeView.REQ_TYPE_INIT_DATA:
self._reqInitTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_ADJUST_DATA:
self._reqAdjustTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA:
self._reqSelectedTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_SELECTED_DATA:
self._reqDisplayTreeNode(options, callback);
break;
default :
self._reqTreeNode(options, callback);
break;
}
}
},
_reqDisplayTreeNode: function (op, callback) {
var self = this;
var result = [];
var selected_values = op.selected_values;
if (selected_values == null || BI.isEmpty(selected_values)) {
callback({});
return;
}
doCheck(0, [], selected_values);
callback({
items: result
});
function doCheck(floor, parent_values, selected) {
if (floor >= self.floors) {
return;
}
if (selected == null || BI.isEmpty(selected)) {
var children = self._getChildren(parent_values);
BI.each(children, function (i, child) {
var newParents = BI.clone(parent_values);
newParents.push(child.value);
var llen = self._getChildCount(newParents);
createOneJson(child, llen);
doCheck(floor + 1, newParents, {});
});
return;
}
BI.each(selected, function (k) {
var node = self._getNode(k);
var newParents = BI.clone(parent_values);
newParents.push(node.value);
createOneJson(node, getCount(selected[k], newParents));
doCheck(floor + 1, newParents, selected[k]);
})
}
function getCount(jo, parent_values) {
if (jo == null) {
return 0;
}
if (BI.isEmpty(jo)) {
return self._getChildCount(parent_values);
}
return BI.size(jo);
}
function createOneJson(node, llen) {
result.push({
id: node.id,
pId: node.pId,
text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""),
value: node.value,
open: true
});
}
},
_reqSelectedTreeNode: function (op, callback) {
var self = this;
var selected_values = op.selected_values;
var not_selected_value = op.not_selected_value || {};
var keyword = op.keyword || "";
var parent_values = op.parent_values || [];
if (selected_values == null || BI.isEmpty(selected_values)) {
callback({});
return;
}
dealWithSelectedValues(selected_values);
callback(selected_values);
function dealWithSelectedValues(selected_values) {
var p = BI.clone(parent_values);
p.push(not_selected_value);
if (isChild(selected_values, p)) {
var result = [];
var finded = search(parent_values.length + 1, parent_values, not_selected_value, result);
if (finded === true) {
var next = selected_values;
BI.each(p, function (i, v) {
var t = next[v];
if (t == null) {
if (BI.isEmpty(next)) {
var split = p.slice(0, i);
var expanded = self._getChildren(split);
BI.each(expanded, function (m, child) {
if (i === p.length - 1 && child.value === not_selected_value) {
return true;
}
next[child.value] = {};
});
next = next[v];
} else {
next = {};
next[v] = {};
}
} else {
next = t;
}
});
if (result.length > 0) {
BI.each(result, function (i, strs) {
self._buildTree(selected_values, strs);
})
}
}
}
}
function search(deep, parents, current, result) {
var newParents = BI.clone(parents);
newParents.push(current);
if (self._isMatch(current, keyword)) {
return true;
}
if (deep >= self.floors) {
return false;
}
var children = self._getChildren(newParents);
var notSearch = [];
var can = false;
BI.each(children, function (i, child) {
if (search(deep + 1, newParents, child.value, result)) {
can = true;
} else {
notSearch.push(child.value);
}
});
if (can === true) {
BI.each(notSearch, function (i, v) {
var next = BI.clone(newParents);
next.push(v);
result.push(next);
});
}
return can;
}
function isChild(selected_values, parents) {
var t = selected_values;
for (var i = 0; i < parents.length; i++) {
var v = parents[i];
if (!BI.has(t, v)) {
return false;
}
t = t[v];
if (t == null || BI.isEmpty(t)) {
return true;
}
}
return true;
}
},
_reqAdjustTreeNode: function (op, callback) {
var self = this;
var result = [];
var selected_values = op.selected_values;
if (selected_values == null || BI.isEmpty(selected_values)) {
callback({});
return;
}
BI.each(selected_values, function (k, v) {
result.push([k]);
});
dealWithSelectedValues(selected_values, []);
var jo = {};
BI.each(result, function (i, strs) {
self._buildTree(jo, strs);
});
callback(jo);
function dealWithSelectedValues(selected, parents) {
if (selected == null || BI.isEmpty(selected)) {
return true;
}
var can = true;
BI.each(selected, function (k, v) {
var p = BI.clone(parents);
p.push(k);
if (!dealWithSelectedValues(selected[k], p)) {
BI.each(selected[k], function (nk, nv) {
var t = BI.clone(p);
t.push(nk);
result.push(t);
});
can = false;
}
});
return can && isAllSelected(selected, parents);
}
function isAllSelected(selected, parents) {
return BI.isEmpty(selected) || self._getChildCount(parents) === BI.size(selected);
}
},
_reqInitTreeNode: function (op, callback) {
var self = this;
var result = [];
var keyword = op.keyword || "";
var selected_values = op.selected_values;
var last_search_value = op.last_search_value || "";
var output = search();
BI.nextTick(function () {
callback({
hasNext: output.length > self._const.perPage,
items: result,
last_search_value: BI.last(output)
})
});
function search() {
var children = self._getChildren([]);
var start = children.length;
if (last_search_value !== "") {
for (var j = 0, len = start; j < len; j++) {
if (children[j].value === last_search_value) {
start = j + 1;
break;
}
}
} else {
start = 0;
}
var output = [];
for (var i = start, len = children.length; i < len; i++) {
if (output.length < self._const.perPage) {
var find = nodeSearch(1, [], children[i].value, false, result);
} else if (output.length === self._const.perPage) {
var find = nodeSearch(1, [], children[i].value, false, []);
}
if (find[0] === true) {
output.push(children[i].value);
}
if (output.length > self._const.perPage) {
break;
}
}
return output;
}
function nodeSearch(deep, parent_values, current, isAllSelect, result) {
if (self._isMatch(current, keyword)) {
var checked = isAllSelect || isSelected(parent_values, current);
createOneJson(parent_values, current, false, checked, !isAllSelect && isHalf(parent_values, current), true, result);
return [true, checked];
}
if (deep >= self.floors) {
return [false, false];
}
var newParents = BI.clone(parent_values);
newParents.push(current);
var children = self._getChildren(newParents);
var can = false, checked = false;
var isCurAllSelected = isAllSelect || isAllSelected(parent_values, current);
BI.each(children, function (i, child) {
var state = nodeSearch(deep + 1, newParents, child.value, isCurAllSelected, result);
if (state[1] === true) {
checked = true;
}
if (state[0] === true) {
can = true;
}
});
if (can === true) {
checked = isCurAllSelected || (isSelected(parent_values, current) && checked);
createOneJson(parent_values, current, true, checked, false, false, result);
}
return [can, checked];
}
function createOneJson(parent_values, value, isOpen, checked, half, flag, result) {
var node = self.map[value];
result.push({
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
title: node.title,
isParent: parent_values.length + 1 < self.floors,
open: isOpen,
checked: checked,
halfCheck: half,
flag: flag
});
}
function isHalf(parent_values, value) {
var find = findSelectedObj(parent_values);
if (find == null) {
return null;
}
return BI.any(find, function (v, ob) {
if (v === value) {
if (ob != null && !BI.isEmpty(ob)) {
return true;
}
}
});
}
function isAllSelected(parent_values, value) {
var find = findSelectedObj(parent_values);
if (find == null) {
return null;
}
return BI.any(find, function (v, ob) {
if (v === value) {
if (ob != null && BI.isEmpty(ob)) {
return true;
}
}
});
}
function isSelected(parent_values, value) {
var find = findSelectedObj(parent_values);
if (find == null) {
return false;
}
return BI.any(find, function (v) {
if (v === value) {
return true;
}
});
}
function findSelectedObj(parent_values) {
var find = selected_values;
if (find == null) {
return null;
}
BI.every(parent_values, function (i, v) {
find = find[v];
if (find == null) {
return false;
}
return true;
});
return find;
}
},
_reqTreeNode: function (op, callback) {
var self = this;
var result = [];
var times = op.times;
var check_state = op.check_state || {};
var parent_values = op.parent_values || [];
var selected_values = op.selected_values;
var valueMap = {};
if (judgeState(parent_values, selected_values, check_state)) {
valueMap = dealWidthSelectedValue(parent_values, selected_values);
}
var nodes = this._getChildren(parent_values);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parent_values, valueMap, check_state);
result.push({
id: nodes[i].id,
pId: nodes[i].pId,
value: nodes[i].value,
text: nodes[i].text,
times: 1,
isParent: parent_values.length + 1 < this.floors,
checked: state[0],
halfCheck: state[1]
})
}
BI.nextTick(function () {
callback({
items: result,
hasNext: nodes.length > times * self._const.perPage
});
});
function judgeState(parent_values, selected_value, check_state) {
var checked = check_state.checked, half = check_state.half;
if (parent_values.length > 0 && !checked) {
return false;
}
return (parent_values.length === 0 || (checked && half) && !BI.isEmpty(selected_value));
}
function dealWidthSelectedValue(parent_values, selected_values) {
var valueMap = {};
BI.each(parent_values, function (i, v) {
selected_values = selected_values[v];
});
BI.each(selected_values, function (value, obj) {
if (BI.isNull(obj)) {
valueMap[value] = [0, 0];
return;
}
if (BI.isEmpty(obj)) {
valueMap[value] = [2, 0];
return;
}
var nextNames = {};
BI.each(obj, function (t, o) {
if (BI.isNull(o) || BI.isEmpty(o)) {
nextNames[t] = true;
}
});
valueMap[value] = [1, BI.size(nextNames)];
});
return valueMap;
}
function getCheckState(current, parent_values, valueMap, check_state) {
var checked = check_state.checked, half = check_state.half;
var hasChild = parent_values.length + 1 < self.floors;
var tempCheck = false, halfCheck = false;
if (BI.has(valueMap, current)) {
//可能是半选
if (valueMap[current][0] === 1) {
var values = BI.clone(parent_values);
values.push(current);
if (hasChild && self._getChildCount(values) != valueMap[current][1]) {
halfCheck = true;
}
} else if (valueMap[current][0] === 2) {
tempCheck = true;
}
}
var check;
if (!checked && !halfCheck && !tempCheck) {
check = BI.has(valueMap, current);
} else {
check = ((tempCheck || checked) && !half) || BI.has(valueMap, current);
}
return [check, halfCheck];
}
},
_buildTree: function (jo, values) {
var t = jo;
BI.each(values, function (i, v) {
if (!BI.has(t, v)) {
t[v] = {};
}
t = t[v];
});
},
_isMatch: function (value, keyword) {
var finded = BI.Func.getSearchResult([value], keyword);
return finded.finded.length > 0 || finded.matched.length > 0;
},
_getNode: function (v) {
return this.tree.search(v, "value");
},
_getChildren: function (parent_values) {
if (parent_values.length > 0) {
var value = BI.last(parent_values);
var parent = this.tree.search(value, "value");
} else {
var parent = this.tree.getRoot();
}
return parent.getChildren();
},
_getChildCount: function (parent_values) {
return this._getChildren(parent_values).length;
},
setValue: function (v) {
this.combo.setValue(v);
},
getValue: function () {
return this.combo.getValue();
},
populate: function () {
this.combo.populate.apply(this, arguments);
}
});
BI.TreeValueChooserCombo.EVENT_CONFIRM = "TreeValueChooserCombo.EVENT_CONFIRM";
$.shortcut('bi.tree_value_chooser_combo', BI.TreeValueChooserCombo);/**
* 简单的复选下拉框控件, 适用于数据量少的情况
* 封装了字段处理逻辑
*
* Created by GUY on 2015/10/29.
* @class BI.ValueChooserCombo
* @extends BI.Widget
*/
BI.ValueChooserCombo = BI.inherit(BI.Widget, {
_const: {
perPage: 10
},
_defaultConfig: function () {
return BI.extend(BI.ValueChooserCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-value-chooser-combo",
width: 200,
height: 30,
items: null,
itemsCreator: BI.emptyFn,
cache: true
});
},
_init: function () {
BI.ValueChooserCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (BI.isNotNull(o.items)) {
this.items = o.items;
}
this.combo = BI.createWidget({
type: 'bi.multi_select_combo',
element: this.element,
itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: function (v) {
var text = v;
if (BI.isNotNull(self.items)) {
BI.some(self.items, function (i, item) {
if (item.value === v) {
text = item.text;
return true;
}
});
}
return text;
},
width: o.width,
height: o.height
});
this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.ValueChooserCombo.EVENT_CONFIRM);
});
},
_getItemsByTimes: function (items, times) {
var res = [];
for (var i = (times - 1) * this._const.perPage; items[i] && i < times * this._const.perPage; i++) {
res.push(items[i]);
}
return res;
},
_hasNextByTimes: function (items, times) {
return times * this._const.perPage < items.length;
},
_itemsCreator: function (options, callback) {
var self = this, o = this.options;
if (!o.cache || !this.items) {
o.itemsCreator({}, function (items) {
self.items = items;
call(items);
});
} else {
call(this.items);
}
function call(items) {
var keywords = (options.keywords || []).slice();
if (options.keyword) {
keywords.push(options.keyword);
}
BI.each(keywords, function (i, kw) {
var search = BI.Func.getSearchResult(items, kw);
items = search.matched.concat(search.finded);
});
if (options.selected_values) {//过滤
var filter = BI.makeObject(options.selected_values, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});
}
if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) {
callback({
items: items
});
return;
}
if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) {
callback({count: items.length});
return;
}
callback({
items: self._getItemsByTimes(items, options.times),
hasNext: self._hasNextByTimes(items, options.times)
});
}
},
setValue: function (v) {
this.combo.setValue(v);
},
getValue: function () {
var val = this.combo.getValue() || {};
return {
type: val.type,
value: val.value
}
},
populate: function () {
this.combo.populate.apply(this, arguments);
}
});
BI.ValueChooserCombo.EVENT_CONFIRM = "ValueChooserCombo.EVENT_CONFIRM";
$.shortcut('bi.value_chooser_combo', BI.ValueChooserCombo);

0
src/less/base/third/ztree/img/line_conn.gif → dist/ztree/img/line_conn.gif vendored

Before

Width:  |  Height:  |  Size: 45 B

After

Width:  |  Height:  |  Size: 45 B

0
src/less/base/third/ztree/img/loading.gif → dist/ztree/img/loading.gif vendored

Before

Width:  |  Height:  |  Size: 381 B

After

Width:  |  Height:  |  Size: 381 B

0
src/less/base/third/ztree/img/zTreeStandard.gif → dist/ztree/img/zTreeStandard.gif vendored

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

0
src/less/base/third/ztree/img/zTreeStandard.png → dist/ztree/img/zTreeStandard.png vendored

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

4
src/base/farbtastic/farbtastic.js

@ -18,8 +18,8 @@ BI.Farbtastic = BI.inherit(BI.Widget, {
_init: function () {
BI.Farbtastic.superclass._init.apply(this, arguments);
var self = this;
FR.$defaultImport('/com/fr/bi/web/js/third/farbtastic.js', 'js');
FR.$defaultImport('/com/fr/bi/web/css/base/third/farbtastic/farbtastic.css', 'css');
this.farbtastic = $.farbtastic(this.element, function (v) {
self.fireEvent(BI.Farbtastic.EVENT_CHANGE, self.getValue(), self);

2
src/base/foundation/bi.message.js

@ -16,7 +16,7 @@ $.extend(BI, {
this._show(true, title, message, callback);
},
prompt: function (title, message, value, callback, min_width) {
FR.Msg.prompt(title, message, value, callback, min_width);
BI.Msg.prompt(title, message, value, callback, min_width);
},
toast: function (message, level, context) {
context = context || $("body");

16
src/base/single/input/file.js

@ -84,7 +84,7 @@
var multipart = function (boundary, name, file) {
return "--".concat(
boundary, CRLF,
'Content-Disposition: form-data; name="', name, '"; filename="', FR.cjkEncode(file.fileName), '"', CRLF,
'Content-Disposition: form-data; name="', name, '"; filename="', BI.cjkEncode(file.fileName), '"', CRLF,
"Content-Type: application/octet-stream", CRLF,
CRLF,
file.getAsBinary(), CRLF,
@ -153,7 +153,7 @@
},
false
);
xhr.open("post", handler.url + '&filename=' + FR.cjkEncode(handler.file.fileName), true);
xhr.open("post", handler.url + '&filename=' + BI.cjkEncode(handler.file.fileName), true);
if (!xhr.upload) {
var rpe = {loaded: 0, total: handler.file.fileSize || handler.file.size, simulation: true};
rpe.interval = setInterval(function () {
@ -184,8 +184,8 @@
upload.onprogress(rpe);
if (199 < xhr.status && xhr.status < 400) {
upload["onload"]({});
var attachO = FR.jsonDecode(xhr.responseText);
attachO.filename = FR.cjkDecode(handler.file.fileName);
var attachO = BI.jsonDecode(xhr.responseText);
attachO.filename = BI.cjkDecode(handler.file.fileName);
if (handler.file.type.indexOf('image') != -1) {
attachO.attach_type = "image";
}
@ -201,7 +201,7 @@
xhr.onreadystatechange = function () {
switch (xhr.readyState) {
case 4:
var attachO = FR.jsonDecode(xhr.responseText);
var attachO = BI.jsonDecode(xhr.responseText);
if (handler.file.type.indexOf('image') != -1) {
attachO.attach_type = "image";
}
@ -251,13 +251,13 @@
//rpe.loaded = rpe.total;
try {
var responseText = (iframe.contentWindow.document || iframe.contentWindow.contentDocument).body.innerHTML;
var attachO = FR.jsonDecode(responseText);
var attachO = BI.jsonDecode(responseText);
if (handler.file.type.indexOf('image') != -1) {
attachO.attach_type = "image";
}
//attachO.fileSize = responseText.length;
attachO.filename = FR.cjkDecode(handler.file.fileName);
attachO.filename = BI.cjkDecode(handler.file.fileName);
if (handler.maxlength == 1) {
handler.attach_array[0] = attachO;
} else {
@ -474,7 +474,7 @@
// enable again the submit button/element
}, 1000);
};
_wrap.url = o.url ? o.url : FR.servletURL
_wrap.url = o.url ? o.url : BI.servletURL
+ '?op=fr_attach&cmd=ah_upload';
_wrap.fileType = o.accept; //文件类型限制
_wrap.attach_array = [];

2
src/base/tree/synctree.js

@ -19,7 +19,7 @@ BI.SyncTree = BI.inherit(BI.TreeView, {
var setting = {
async: {
enable: false,
otherParam: FR.cjkEncodeDO(paras)
otherParam: BI.cjkEncodeDO(paras)
},
check: {
enable: true

16
src/base/tree/treeview.js

@ -14,9 +14,9 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
_init: function () {
BI.TreeView.superclass._init.apply(this, arguments);
FR.$defaultImport('/com/fr/bi/web/js/third/ztree/jquery.ztree.core-3.5.js', 'js');
FR.$defaultImport('/com/fr/bi/web/js/third/ztree/jquery.ztree.excheck-3.5.js', 'js');
FR.$defaultImport('/com/fr/bi/web/css/base/third/ztree/zTreeStyle.css', 'css');
this._stop = false;
this.container = BI.createWidget();
@ -71,7 +71,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
enable: true,
url: getUrl,
autoParam: ["id", "name"],
otherParam: FR.cjkEncodeDO(paras)
otherParam: BI.cjkEncodeDO(paras)
},
check: {
enable: true
@ -113,10 +113,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
treeNode.times = treeNode.times || 1;
var param = "id=" + treeNode.id
+ "&times=" + (treeNode.times++)
+ "&parent_values= " + window.encodeURIComponent(FR.jsonEncode(parentNode))
+ "&check_state=" + window.encodeURIComponent(FR.jsonEncode(treeNode.getCheckStatus()));
+ "&parent_values= " + window.encodeURIComponent(BI.jsonEncode(parentNode))
+ "&check_state=" + window.encodeURIComponent(BI.jsonEncode(treeNode.getCheckStatus()));
return FR.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param;
return BI.servletURL + '?op=' + self.options.op + '&cmd=' + self.options.cmd + "&" + param;
}
function beforeExpand(treeId, treeNode) {
@ -165,7 +165,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
function ajaxGetNodes(treeNode, reloadType) {
var zTree = self.nodes;
if (reloadType == "refresh") {
//treeNode.icon = FR.servletURL +"?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif";
//treeNode.icon = BI.servletURL +"?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif";
zTree.updateNode(treeNode);
}
zTree.reAsyncChildNodes(treeNode, reloadType, true);

10
src/case/logintimeout/login.timeout.js

@ -130,9 +130,9 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, {
}
//反正是登录直接用FR的登录了
FR.ajax({
url: FR.servletURL + '?op=fs_load&cmd=login',
data: FR.cjkEncodeDO({
BI.ajax({
url: BI.servletURL + '?op=fs_load&cmd=login',
data: BI.cjkEncodeDO({
fr_username: encodeURIComponent(userNameInput.getValue()),
fr_password: encodeURIComponent(passwordInput.getValue()),
fr_remember: self.keepLoginState.isSelected()
@ -147,7 +147,7 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, {
self._showMes(userNameMask, BI.i18nText("BI-Authentication_Failed"));
return;
}
var signResult = FR.jsonDecode(res.responseText);
var signResult = BI.jsonDecode(res.responseText);
if (signResult.fail) {
//用户名和密码不匹配
self._showMes(userNameMask, BI.i18nText("BI-Username_Password_Not_Correct"));
@ -171,7 +171,7 @@ BI.LoginTimeOut = BI.inherit(BI.BarPopoverSection, {
type: "bi.center_adapt",
items: [{
type: "bi.img",
src: FR.servletURL + (logo ?
src: BI.servletURL + (logo ?
'?op=fr_attach&cmd=ah_image&id=' + logo + '&isAdjust=false' :
'?op=resource&resource=/com/fr/bi/web/images/login/bi_logo.png'),
width: 120,

4
src/case/zclip/zclip.js

@ -16,10 +16,10 @@ BI.ZeroClip = BI.inherit(BI.BasicButton, {
_init: function () {
BI.ZeroClip.superclass._init.apply(this, arguments);
var self = this, o = this.options;
FR.$defaultImport('/com/fr/bi/web/js/third/jquery.zclip.js', 'js');
BI.nextTick(function () {
self.element.zclip({
path: FR.servletURL + "?op=resource&resource=/com/fr/bi/web/resources/ZeroClipboard.swf",
path: BI.servletURL + "?op=resource&resource=/com/fr/bi/web/resources/ZeroClipboard.swf",
copy: o.copy,
beforeCopy: o.beforeCopy,
afterCopy: o.afterCopy

599
src/component/combo.treevaluechooser.js

@ -0,0 +1,599 @@
/**
* 简单的复选下拉树控件, 适用于数据量少的情况
*
* Created by GUY on 2015/10/29.
* @class BI.TreeValueChooserCombo
* @extends BI.Widget
*/
BI.TreeValueChooserCombo = BI.inherit(BI.Widget, {
_const: {
perPage: 10
},
_defaultConfig: function () {
return BI.extend(BI.TreeValueChooserCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-tree-value-chooser-combo",
width: 200,
height: 30,
items: null,
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.TreeValueChooserCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (BI.isNotNull(o.items)) {
this._initData(o.items);
}
this.combo = BI.createWidget({
type: 'bi.multi_tree_combo',
element: this.element,
itemsCreator: BI.bind(this._itemsCreator, this),
width: o.width,
height: o.height
});
this.combo.on(BI.MultiTreeCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.TreeValueChooserCombo.EVENT_CONFIRM);
});
},
_initData: function (items) {
this.items = items;
var nodes = BI.Tree.transformToTreeFormat(items);
this.tree = new BI.Tree();
this.tree.initTree(nodes);
this._initMap();
this._initFloors();
},
_initMap: function () {
var map = this.map = {};
BI.each(this.items, function (i, item) {
map[item.value] = item;
});
},
_initFloors: function () {
this.floors = -1;
var root = this.tree.getRoot();
while (root) {
this.floors++;
root = root.getChildren()[0];
}
},
_itemsCreator: function (options, callback) {
var self = this, o = this.options;
if (!this.items) {
o.itemsCreator({}, function (items) {
self._initData(items);
call();
});
} else {
call();
}
function call() {
switch (options.type) {
case BI.TreeView.REQ_TYPE_INIT_DATA:
self._reqInitTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_ADJUST_DATA:
self._reqAdjustTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_CALCULATE_SELECT_DATA:
self._reqSelectedTreeNode(options, callback);
break;
case BI.TreeView.REQ_TYPE_SELECTED_DATA:
self._reqDisplayTreeNode(options, callback);
break;
default :
self._reqTreeNode(options, callback);
break;
}
}
},
_reqDisplayTreeNode: function (op, callback) {
var self = this;
var result = [];
var selected_values = op.selected_values;
if (selected_values == null || BI.isEmpty(selected_values)) {
callback({});
return;
}
doCheck(0, [], selected_values);
callback({
items: result
});
function doCheck(floor, parent_values, selected) {
if (floor >= self.floors) {
return;
}
if (selected == null || BI.isEmpty(selected)) {
var children = self._getChildren(parent_values);
BI.each(children, function (i, child) {
var newParents = BI.clone(parent_values);
newParents.push(child.value);
var llen = self._getChildCount(newParents);
createOneJson(child, llen);
doCheck(floor + 1, newParents, {});
});
return;
}
BI.each(selected, function (k) {
var node = self._getNode(k);
var newParents = BI.clone(parent_values);
newParents.push(node.value);
createOneJson(node, getCount(selected[k], newParents));
doCheck(floor + 1, newParents, selected[k]);
})
}
function getCount(jo, parent_values) {
if (jo == null) {
return 0;
}
if (BI.isEmpty(jo)) {
return self._getChildCount(parent_values);
}
return BI.size(jo);
}
function createOneJson(node, llen) {
result.push({
id: node.id,
pId: node.pId,
text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""),
value: node.value,
open: true
});
}
},
_reqSelectedTreeNode: function (op, callback) {
var self = this;
var selected_values = op.selected_values;
var not_selected_value = op.not_selected_value || {};
var keyword = op.keyword || "";
var parent_values = op.parent_values || [];
if (selected_values == null || BI.isEmpty(selected_values)) {
callback({});
return;
}
dealWithSelectedValues(selected_values);
callback(selected_values);
function dealWithSelectedValues(selected_values) {
var p = BI.clone(parent_values);
p.push(not_selected_value);
if (isChild(selected_values, p)) {
var result = [];
var finded = search(parent_values.length + 1, parent_values, not_selected_value, result);
if (finded === true) {
var next = selected_values;
BI.each(p, function (i, v) {
var t = next[v];
if (t == null) {
if (BI.isEmpty(next)) {
var split = p.slice(0, i);
var expanded = self._getChildren(split);
BI.each(expanded, function (m, child) {
if (i === p.length - 1 && child.value === not_selected_value) {
return true;
}
next[child.value] = {};
});
next = next[v];
} else {
next = {};
next[v] = {};
}
} else {
next = t;
}
});
if (result.length > 0) {
BI.each(result, function (i, strs) {
self._buildTree(selected_values, strs);
})
}
}
}
}
function search(deep, parents, current, result) {
var newParents = BI.clone(parents);
newParents.push(current);
if (self._isMatch(current, keyword)) {
return true;
}
if (deep >= self.floors) {
return false;
}
var children = self._getChildren(newParents);
var notSearch = [];
var can = false;
BI.each(children, function (i, child) {
if (search(deep + 1, newParents, child.value, result)) {
can = true;
} else {
notSearch.push(child.value);
}
});
if (can === true) {
BI.each(notSearch, function (i, v) {
var next = BI.clone(newParents);
next.push(v);
result.push(next);
});
}
return can;
}
function isChild(selected_values, parents) {
var t = selected_values;
for (var i = 0; i < parents.length; i++) {
var v = parents[i];
if (!BI.has(t, v)) {
return false;
}
t = t[v];
if (t == null || BI.isEmpty(t)) {
return true;
}
}
return true;
}
},
_reqAdjustTreeNode: function (op, callback) {
var self = this;
var result = [];
var selected_values = op.selected_values;
if (selected_values == null || BI.isEmpty(selected_values)) {
callback({});
return;
}
BI.each(selected_values, function (k, v) {
result.push([k]);
});
dealWithSelectedValues(selected_values, []);
var jo = {};
BI.each(result, function (i, strs) {
self._buildTree(jo, strs);
});
callback(jo);
function dealWithSelectedValues(selected, parents) {
if (selected == null || BI.isEmpty(selected)) {
return true;
}
var can = true;
BI.each(selected, function (k, v) {
var p = BI.clone(parents);
p.push(k);
if (!dealWithSelectedValues(selected[k], p)) {
BI.each(selected[k], function (nk, nv) {
var t = BI.clone(p);
t.push(nk);
result.push(t);
});
can = false;
}
});
return can && isAllSelected(selected, parents);
}
function isAllSelected(selected, parents) {
return BI.isEmpty(selected) || self._getChildCount(parents) === BI.size(selected);
}
},
_reqInitTreeNode: function (op, callback) {
var self = this;
var result = [];
var keyword = op.keyword || "";
var selected_values = op.selected_values;
var last_search_value = op.last_search_value || "";
var output = search();
BI.nextTick(function () {
callback({
hasNext: output.length > self._const.perPage,
items: result,
last_search_value: BI.last(output)
})
});
function search() {
var children = self._getChildren([]);
var start = children.length;
if (last_search_value !== "") {
for (var j = 0, len = start; j < len; j++) {
if (children[j].value === last_search_value) {
start = j + 1;
break;
}
}
} else {
start = 0;
}
var output = [];
for (var i = start, len = children.length; i < len; i++) {
if (output.length < self._const.perPage) {
var find = nodeSearch(1, [], children[i].value, false, result);
} else if (output.length === self._const.perPage) {
var find = nodeSearch(1, [], children[i].value, false, []);
}
if (find[0] === true) {
output.push(children[i].value);
}
if (output.length > self._const.perPage) {
break;
}
}
return output;
}
function nodeSearch(deep, parent_values, current, isAllSelect, result) {
if (self._isMatch(current, keyword)) {
var checked = isAllSelect || isSelected(parent_values, current);
createOneJson(parent_values, current, false, checked, !isAllSelect && isHalf(parent_values, current), true, result);
return [true, checked];
}
if (deep >= self.floors) {
return [false, false];
}
var newParents = BI.clone(parent_values);
newParents.push(current);
var children = self._getChildren(newParents);
var can = false, checked = false;
var isCurAllSelected = isAllSelect || isAllSelected(parent_values, current);
BI.each(children, function (i, child) {
var state = nodeSearch(deep + 1, newParents, child.value, isCurAllSelected, result);
if (state[1] === true) {
checked = true;
}
if (state[0] === true) {
can = true;
}
});
if (can === true) {
checked = isCurAllSelected || (isSelected(parent_values, current) && checked);
createOneJson(parent_values, current, true, checked, false, false, result);
}
return [can, checked];
}
function createOneJson(parent_values, value, isOpen, checked, half, flag, result) {
var node = self.map[value];
result.push({
id: node.id,
pId: node.pId,
text: node.text,
value: node.value,
title: node.title,
isParent: parent_values.length + 1 < self.floors,
open: isOpen,
checked: checked,
halfCheck: half,
flag: flag
});
}
function isHalf(parent_values, value) {
var find = findSelectedObj(parent_values);
if (find == null) {
return null;
}
return BI.any(find, function (v, ob) {
if (v === value) {
if (ob != null && !BI.isEmpty(ob)) {
return true;
}
}
});
}
function isAllSelected(parent_values, value) {
var find = findSelectedObj(parent_values);
if (find == null) {
return null;
}
return BI.any(find, function (v, ob) {
if (v === value) {
if (ob != null && BI.isEmpty(ob)) {
return true;
}
}
});
}
function isSelected(parent_values, value) {
var find = findSelectedObj(parent_values);
if (find == null) {
return false;
}
return BI.any(find, function (v) {
if (v === value) {
return true;
}
});
}
function findSelectedObj(parent_values) {
var find = selected_values;
if (find == null) {
return null;
}
BI.every(parent_values, function (i, v) {
find = find[v];
if (find == null) {
return false;
}
return true;
});
return find;
}
},
_reqTreeNode: function (op, callback) {
var self = this;
var result = [];
var times = op.times;
var check_state = op.check_state || {};
var parent_values = op.parent_values || [];
var selected_values = op.selected_values;
var valueMap = {};
if (judgeState(parent_values, selected_values, check_state)) {
valueMap = dealWidthSelectedValue(parent_values, selected_values);
}
var nodes = this._getChildren(parent_values);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parent_values, valueMap, check_state);
result.push({
id: nodes[i].id,
pId: nodes[i].pId,
value: nodes[i].value,
text: nodes[i].text,
times: 1,
isParent: parent_values.length + 1 < this.floors,
checked: state[0],
halfCheck: state[1]
})
}
BI.nextTick(function () {
callback({
items: result,
hasNext: nodes.length > times * self._const.perPage
});
});
function judgeState(parent_values, selected_value, check_state) {
var checked = check_state.checked, half = check_state.half;
if (parent_values.length > 0 && !checked) {
return false;
}
return (parent_values.length === 0 || (checked && half) && !BI.isEmpty(selected_value));
}
function dealWidthSelectedValue(parent_values, selected_values) {
var valueMap = {};
BI.each(parent_values, function (i, v) {
selected_values = selected_values[v];
});
BI.each(selected_values, function (value, obj) {
if (BI.isNull(obj)) {
valueMap[value] = [0, 0];
return;
}
if (BI.isEmpty(obj)) {
valueMap[value] = [2, 0];
return;
}
var nextNames = {};
BI.each(obj, function (t, o) {
if (BI.isNull(o) || BI.isEmpty(o)) {
nextNames[t] = true;
}
});
valueMap[value] = [1, BI.size(nextNames)];
});
return valueMap;
}
function getCheckState(current, parent_values, valueMap, check_state) {
var checked = check_state.checked, half = check_state.half;
var hasChild = parent_values.length + 1 < self.floors;
var tempCheck = false, halfCheck = false;
if (BI.has(valueMap, current)) {
//可能是半选
if (valueMap[current][0] === 1) {
var values = BI.clone(parent_values);
values.push(current);
if (hasChild && self._getChildCount(values) != valueMap[current][1]) {
halfCheck = true;
}
} else if (valueMap[current][0] === 2) {
tempCheck = true;
}
}
var check;
if (!checked && !halfCheck && !tempCheck) {
check = BI.has(valueMap, current);
} else {
check = ((tempCheck || checked) && !half) || BI.has(valueMap, current);
}
return [check, halfCheck];
}
},
_buildTree: function (jo, values) {
var t = jo;
BI.each(values, function (i, v) {
if (!BI.has(t, v)) {
t[v] = {};
}
t = t[v];
});
},
_isMatch: function (value, keyword) {
var finded = BI.Func.getSearchResult([value], keyword);
return finded.finded.length > 0 || finded.matched.length > 0;
},
_getNode: function (v) {
return this.tree.search(v, "value");
},
_getChildren: function (parent_values) {
if (parent_values.length > 0) {
var value = BI.last(parent_values);
var parent = this.tree.search(value, "value");
} else {
var parent = this.tree.getRoot();
}
return parent.getChildren();
},
_getChildCount: function (parent_values) {
return this._getChildren(parent_values).length;
},
setValue: function (v) {
this.combo.setValue(v);
},
getValue: function () {
return this.combo.getValue();
},
populate: function () {
this.combo.populate.apply(this, arguments);
}
});
BI.TreeValueChooserCombo.EVENT_CONFIRM = "TreeValueChooserCombo.EVENT_CONFIRM";
$.shortcut('bi.tree_value_chooser_combo', BI.TreeValueChooserCombo);

127
src/component/combo.valuechooser.js

@ -0,0 +1,127 @@
/**
* 简单的复选下拉框控件, 适用于数据量少的情况
* 封装了字段处理逻辑
*
* Created by GUY on 2015/10/29.
* @class BI.ValueChooserCombo
* @extends BI.Widget
*/
BI.ValueChooserCombo = BI.inherit(BI.Widget, {
_const: {
perPage: 10
},
_defaultConfig: function () {
return BI.extend(BI.ValueChooserCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-value-chooser-combo",
width: 200,
height: 30,
items: null,
itemsCreator: BI.emptyFn,
cache: true
});
},
_init: function () {
BI.ValueChooserCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (BI.isNotNull(o.items)) {
this.items = o.items;
}
this.combo = BI.createWidget({
type: 'bi.multi_select_combo',
element: this.element,
itemsCreator: BI.bind(this._itemsCreator, this),
valueFormatter: function (v) {
var text = v;
if (BI.isNotNull(self.items)) {
BI.some(self.items, function (i, item) {
if (item.value === v) {
text = item.text;
return true;
}
});
}
return text;
},
width: o.width,
height: o.height
});
this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () {
self.fireEvent(BI.ValueChooserCombo.EVENT_CONFIRM);
});
},
_getItemsByTimes: function (items, times) {
var res = [];
for (var i = (times - 1) * this._const.perPage; items[i] && i < times * this._const.perPage; i++) {
res.push(items[i]);
}
return res;
},
_hasNextByTimes: function (items, times) {
return times * this._const.perPage < items.length;
},
_itemsCreator: function (options, callback) {
var self = this, o = this.options;
if (!o.cache || !this.items) {
o.itemsCreator({}, function (items) {
self.items = items;
call(items);
});
} else {
call(this.items);
}
function call(items) {
var keywords = (options.keywords || []).slice();
if (options.keyword) {
keywords.push(options.keyword);
}
BI.each(keywords, function (i, kw) {
var search = BI.Func.getSearchResult(items, kw);
items = search.matched.concat(search.finded);
});
if (options.selected_values) {//过滤
var filter = BI.makeObject(options.selected_values, true);
items = BI.filter(items, function (i, ob) {
return !filter[ob.value];
});
}
if (options.type == BI.MultiSelectCombo.REQ_GET_ALL_DATA) {
callback({
items: items
});
return;
}
if (options.type == BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) {
callback({count: items.length});
return;
}
callback({
items: self._getItemsByTimes(items, options.times),
hasNext: self._hasNextByTimes(items, options.times)
});
}
},
setValue: function (v) {
this.combo.setValue(v);
},
getValue: function () {
var val = this.combo.getValue() || {};
return {
type: val.type,
value: val.value
}
},
populate: function () {
this.combo.populate.apply(this, arguments);
}
});
BI.ValueChooserCombo.EVENT_CONFIRM = "ValueChooserCombo.EVENT_CONFIRM";
$.shortcut('bi.value_chooser_combo', BI.ValueChooserCombo);

591
src/core/alias.js

@ -0,0 +1,591 @@
BI.cjkEncode = function (text) {
// alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的)
if (typeof text !== 'string') {
return text;
}
var newText = "";
for (var i = 0; i < text.length; i++) {
var code = text.charCodeAt(i);
if (code >= 128 || code === 91 || code === 93) {//91 is "[", 93 is "]".
newText += "[" + code.toString(16) + "]";
} else {
newText += text.charAt(i);
}
}
return newText
};
BI.cjkEncodeDO = function (o) {
if (BI.isPlainObject(o)) {
var result = {};
$.each(o, function (k, v) {
if (!(typeof v == "string")) {
v = BI.jsonEncode(v);
}
//wei:bug 43338,如果key是中文,cjkencode后o的长度就加了1,ie9以下版本死循环,所以新建对象result。
k = BI.cjkEncode(k);
result[k] = BI.cjkEncode(v);
});
return result;
}
return o;
};
BI.jsonEncode = function (o) {
//james:这个Encode是抄的EXT的
var useHasOwn = {}.hasOwnProperty ? true : false;
// crashes Safari in some instances
//var validRE = /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/;
var m = {
"\b": '\\b',
"\t": '\\t',
"\n": '\\n',
"\f": '\\f',
"\r": '\\r',
'"': '\\"',
"\\": '\\\\'
};
var encodeString = function (s) {
if (/["\\\x00-\x1f]/.test(s)) {
return '"' + s.replace(/([\x00-\x1f\\"])/g, function (a, b) {
var c = m[b];
if (c) {
return c;
}
c = b.charCodeAt();
return "\\u00" +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
}) + '"';
}
return '"' + s + '"';
};
var encodeArray = function (o) {
var a = ["["], b, i, l = o.length, v;
for (i = 0; i < l; i += 1) {
v = o[i];
switch (typeof v) {
case "undefined":
case "function":
case "unknown":
break;
default:
if (b) {
a.push(',');
}
a.push(v === null ? "null" : BI.jsonEncode(v));
b = true;
}
}
a.push("]");
return a.join("");
};
if (typeof o == "undefined" || o === null) {
return "null";
} else if (BI.isArray(o)) {
return encodeArray(o);
} else if (o instanceof Date) {
/*
* alex:原来只是把年月日时分秒简单地拼成一个String,无法decode
* 现在这么处理就可以decode了,但是JS.jsonDecode和Java.JSONObject也要跟着改一下
*/
return BI.jsonEncode({
__time__: o.getTime()
})
} else if (typeof o == "string") {
return encodeString(o);
} else if (typeof o == "number") {
return isFinite(o) ? String(o) : "null";
} else if (typeof o == "boolean") {
return String(o);
} else if (BI.isFunction(o)) {
return String(o);
} else {
var a = ["{"], b, i, v;
for (i in o) {
if (!useHasOwn || o.hasOwnProperty(i)) {
v = o[i];
switch (typeof v) {
case "undefined":
case "unknown":
break;
default:
if (b) {
a.push(',');
}
a.push(BI.jsonEncode(i), ":",
v === null ? "null" : BI.jsonEncode(v));
b = true;
}
}
}
a.push("}");
return a.join("");
}
};
BI.contentFormat = function (cv, fmt) {
if (BI.isEmpty(cv)) {
//原值为空,返回空字符
return '';
}
var text = cv.toString();
if (BI.isEmpty(fmt)) {
//格式为空,返回原字符
return text;
}
if (fmt.match(/^T/)) {
//T - 文本格式
return text;
} else if (fmt.match(/^D/)) {
//D - 日期(时间)格式
if (!(cv instanceof Date)) {
if (typeof cv === 'number') {
//毫秒数类型
cv = new Date(cv);
} else {
//字符串类型,如yyyyMMdd、MMddyyyy等这样无分隔符的结构
cv = Date.parseDate(cv + "", Date.patterns.ISO8601Long);
}
}
if (!BI.isNull(cv)) {
var needTrim = fmt.match(/^DT/);
text = BI.date2Str(cv, fmt.substring(needTrim ? 2 : 1));
}
} else if (fmt.match(/E/)) {
//科学计数格式
text = BI._eFormat(text, fmt);
} else {
//数字格式
text = BI._numberFormat(text, fmt);
}
//¤ - 货币格式
text = text.replace(/¤/g, '¥');
return text;
};
/**
* 把日期对象按照指定格式转化成字符串
*
* @example
* var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800');
* var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12
*
* @class BI.date2Str
* @param date 日期
* @param format 日期格式
* @returns {String}
*/
date2Str = function (date, format) {
if (!date) {
return '';
}
// O(len(format))
var len = format.length, result = '';
if (len > 0) {
var flagch = format.charAt(0), start = 0, str = flagch;
for (var i = 1; i < len; i++) {
var ch = format.charAt(i);
if (flagch !== ch) {
result += compileJFmt({
'char': flagch,
'str': str,
'len': i - start
}, date);
flagch = ch;
start = i;
str = flagch;
} else {
str += ch;
}
}
result += compileJFmt({
'char': flagch,
'str': str,
'len': len - start
}, date);
}
return result;
function compileJFmt(jfmt, date) {
var str = jfmt.str, len = jfmt.len, ch = jfmt['char'];
switch (ch) {
case 'E': //星期
str = Date._DN[date.getDay()];
break;
case 'y': //年
if (len <= 3) {
str = (date.getFullYear() + '').slice(2, 4);
} else {
str = date.getFullYear();
}
break;
case 'M': //月
if (len > 2) {
str = Date._MN[date.getMonth()];
} else if (len < 2) {
str = date.getMonth() + 1;
} else {
str = String.leftPad(date.getMonth() + 1 + '', 2, '0');
}
break;
case 'd': //日
if (len > 1) {
str = String.leftPad(date.getDate() + '', 2, '0');
} else {
str = date.getDate();
}
break;
case 'h': //时(12)
var hour = date.getHours() % 12;
if (hour === 0) {
hour = 12;
}
if (len > 1) {
str = String.leftPad(hour + '', 2, '0');
} else {
str = hour;
}
break;
case 'H': //时(24)
if (len > 1) {
str = String.leftPad(date.getHours() + '', 2, '0');
} else {
str = date.getHours();
}
break;
case 'm':
if (len > 1) {
str = String.leftPad(date.getMinutes() + '', 2, '0');
} else {
str = date.getMinutes();
}
break;
case 's':
if (len > 1) {
str = String.leftPad(date.getSeconds() + '', 2, '0');
} else {
str = date.getSeconds();
}
break;
case 'a':
str = date.getHours() < 12 ? 'am' : 'pm';
break;
case 'z':
str = date.getTimezone();
break;
default:
str = jfmt.str;
break;
}
return str;
}
};
/**
* 数字格式
*/
BI._numberFormat = function (text, format) {
var text = text + '';
//数字格式,区分正负数
var numMod = format.indexOf(';');
if (numMod > -1) {
if (text >= 0) {
return BI._numberFormat(text + "", format.substring(0, numMod));
} else {
return BI._numberFormat((-text) + "", format.substr(numMod + 1));
}
}
var tp = text.split('.'), fp = format.split('.'),
tleft = tp[0] || '', fleft = fp[0] || '',
tright = tp[1] || '', fright = fp[1] || '';
//百分比,千分比的小数点移位处理
if (/[%‰]$/.test(format)) {
var paddingZero = /[%]$/.test(format) ? '00' : '000';
tright += paddingZero;
tleft += tright.substr(0, paddingZero.length);
tleft = tleft.replace(/^0+/gi, '');
tright = tright.substr(paddingZero.length).replace(/0+$/gi, '');
}
var right = BI._dealWithRight(tright, fright);
if (right.leftPlus) {
//小数点后有进位
tleft = parseInt(tleft) + 1 + '';
tleft = isNaN(tleft) ? '1' : tleft;
}
right = right.num;
var left = BI._dealWithLeft(tleft, fleft);
if (!(/[0-9]/.test(left))) {
left = left + '0';
}
if (!(/[0-9]/.test(right))) {
return left + right;
} else {
return left + '.' + right;
}
};
/**
* 处理小数点右边小数部分
* @param tright 右边内容
* @param fright 右边格式
* @returns {JSON} 返回处理结果和整数部分是否需要进位
* @private
*/
BI._dealWithRight = function (tright, fright) {
var right = '', j = 0, i = 0;
for (var len = fright.length; i < len; i++) {
var ch = fright.charAt(i);
var c = tright.charAt(j);
switch (ch) {
case '0':
if (BI.isEmpty(c)) {
c = '0';
}
right += c;
j++;
break;
case '#':
right += c;
j++;
break;
default :
right += ch;
break;
}
}
var rll = tright.substr(j);
var result = {};
if (!BI.isEmpty(rll) && rll.charAt(0) > 4) {
//有多余字符,需要四舍五入
result.leftPlus = true;
var numReg = right.match(/^[0-9]+/);
if (numReg) {
var num = numReg[0];
var orilen = num.length;
var newnum = BI.parseINT(num) + 1 + '';
//进位到整数部分
if (newnum.length > orilen) {
newnum = newnum.substr(1);
} else {
newnum = BI.leftPad(newnum, orilen, '0');
result.leftPlus = false;
}
right = right.replace(/^[0-9]+/, newnum);
}
}
result.num = right;
return result;
};
BI.parseINT = function (str) {
return parseInt(str, 10);
};
BI.leftPad = function (val, size, ch) {
var result = String(val);
if (!ch) {
ch = " ";
}
while (result.length < size) {
result = ch + result;
}
return result.toString();
};
/**
* 处理小数点左边整数部分
* @param tleft 左边内容
* @param fleft 左边格式
* @returns {string} 返回处理结果
* @private
*/
BI._dealWithLeft = function (tleft, fleft) {
var left = '';
var j = tleft.length - 1;
var combo = -1, last = -1;
var i = fleft.length - 1;
for (; i >= 0; i--) {
var ch = fleft.charAt(i);
var c = tleft.charAt(j);
switch (ch) {
case '0':
if (BI.isEmpty(c)) {
c = '0';
}
last = -1;
left = c + left;
j--;
break;
case '#':
last = i;
left = c + left;
j--;
break;
case ',':
if (!BI.isEmpty(c)) {
//计算一个,分隔区间的长度
var com = fleft.match(/,[#0]+/);
if (com) {
combo = com[0].length - 1;
}
left = ',' + left;
}
break;
default :
left = ch + left;
break;
}
}
if (last > -1) {
//处理剩余字符
var tll = tleft.substr(0, j + 1);
left = left.substr(0, last) + tll + left.substr(last);
}
if (combo > 0) {
//处理,分隔区间
var res = left.match(/[0-9]+,/);
if (res) {
res = res[0];
var newstr = '', n = res.length - 1 - combo;
for (; n >= 0; n = n - combo) {
newstr = res.substr(n, combo) + ',' + newstr;
}
var lres = res.substr(0, n + combo);
if (!BI.isEmpty(lres)) {
newstr = lres + ',' + newstr;
}
}
left = left.replace(/[0-9]+,/, newstr);
}
return left;
};
BI.object2Number = function (value) {
if (value == null) {
return 0;
}
if (typeof value == 'number') {
return value;
} else {
var str = value + "";
if (str.indexOf(".") === -1) {
return parseInt(str);
} else {
return parseFloat(str);
}
}
};
BI.object2Date = function (obj) {
if (obj == null) {
return new Date();
}
if (obj instanceof Date) {
return obj;
} else if (typeof obj == 'number') {
return new Date(obj);
} else {
var str = obj + "";
str = str.replace(/-/g, '/');
var dt = new Date(str);
if (!BI.isInvalidDate(dt)) {
return dt;
}
return new Date();
}
};
BI.isArray = function (a) {
return Object.prototype.toString.call(a) == '[object Array]';
};
BI.object2Time = function (obj) {
if (obj == null) {
return new Date();
}
if (obj instanceof Date) {
return obj;
} else {
var str = obj + "";
str = str.replace(/-/g, '/');
var dt = new Date(str);
if (!BI.isInvalidDate(dt)) {
return dt;
}
if (str.indexOf('/') === -1 && str.indexOf(':') !== -1) {
dt = new Date("1970/01/01 " + str);
if (!BI.isInvalidDate(dt)) {
return dt;
}
}
dt = BI.str2Date(str, "HH:mm:ss");
if (!BI.isInvalidDate(dt)) {
return dt;
}
return new Date();
}
};
// 判断是否是无效的日期
BI.isInvalidDate = function (date) {
return date == "Invalid Date" || date == "NaN";
};
/**
* 科学计数格式
*/
BI._eFormat = function (text, fmt) {
var e = fmt.indexOf("E");
var eleft = fmt.substr(0, e), eright = fmt.substr(e + 1);
if (/^[0\.-]+$/.test(text)) {
text = BI._numberFormat(0.0, eleft) + 'E' + BI._numberFormat(0, eright)
} else {
var isNegative = text < 0;
if (isNegative) {
text = text.substr(1);
}
var elvl = (eleft.split('.')[0] || '').length;
var point = text.indexOf(".");
if (point < 0) {
point = text.length;
}
var i = 0; //第一个不为0的数的位置
text = text.replace('.', '');
for (var len = text.length; i < len; i++) {
var ech = text.charAt(i);
if (ech <= '9' && ech >= '1') {
break;
}
}
var right = point - i - elvl;
var left = text.substr(i, elvl);
var dis = i + elvl - text.length;
if (dis > 0) {
//末位补全0
for (var k = 0; k < dis; k++) {
left += '0';
}
} else {
left += '.' + text.substr(i + elvl);
}
left = left.replace(/^[0]+/, '');
if (right < 0 && eright.indexOf('-') < 0) {
eright += ';-' + eright;
}
text = BI._numberFormat(left, eleft) + 'E' + BI._numberFormat(right, eright);
if (isNegative) {
text = '-' + text;
}
}
return text;
};

23
src/core/base.js

@ -905,10 +905,6 @@ if (!window.BI) {
return BI.isString(str) && BI.isEmpty(str);
},
contentFormat: function () {
return FR.contentFormat.apply(FR, arguments);
},
/**
* 对字符串进行加密 {@link #decrypt}
* @static
@ -1102,7 +1098,12 @@ if (!window.BI) {
}
timeoutToast.addReq(option);
FR.ajax({
option.data = BI.cjkEncodeDO(option.data);
$.ajax({
url: option.url,
type: "POST",
data: option.data,
@ -1157,10 +1158,10 @@ if (!window.BI) {
loading.showError();
} else if (status === "success" && BI.isFunction(option.success)) {
option.success(FR.jsonDecode(res.responseText));
option.success(BI.jsonDecode(res.responseText));
}
if (BI.isFunction(option.complete)) {
option.complete(FR.jsonDecode(res.responseText), status);
option.complete(BI.jsonDecode(res.responseText), status);
}
}
});
@ -1172,7 +1173,7 @@ if (!window.BI) {
function encodeBIParam(data) {
for (var key in data) {
if (_.isObject(data[key])) {
data[key] = window.encodeURIComponent(FR.jsonEncode(data[key]));
data[key] = window.encodeURIComponent(BI.jsonEncode(data[key]));
} else {
data[key] = window.encodeURIComponent(data[key]);
}
@ -1183,7 +1184,7 @@ if (!window.BI) {
for (var key in data) {
data[key] = window.decodeURIComponent(data[key]);
if (_.isObject(data[key])) {
data[key] = FR.jsonDecode(data[key]);
data[key] = BI.jsonDecode(data[key]);
}
}
}
@ -1206,7 +1207,7 @@ if (!window.BI) {
if (op === "fr_bi_dezi" || op === "fr_bi_configure") {
data.sessionID = Data.SharingPool.get("sessionID");
}
var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
var url = BI.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
return (BI.ajax)({
url: url,
type: 'POST',
@ -1242,7 +1243,7 @@ if (!window.BI) {
if (op === "fr_bi_dezi") {
data.sessionID = Data.SharingPool.get("sessionID");
}
var url = FR.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
var url = BI.servletURL + '?op=' + op + '&cmd=' + cmd + "&_=" + Math.random();
var result = {};
(BI.ajax)({
url: url,

2
src/core/func/function.js

@ -121,7 +121,7 @@ $(function () {
},
getCompleteImageUrl: function (url) {
return FR.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url;
return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + url;
}
});

2
src/core/model.js

@ -377,7 +377,7 @@ BI.Model = BI.inherit(BI.M, {
},
urlRoot: function () {
return FR.servletURL;
return BI.servletURL;
},
parse: function (data) {

2
src/core/utils/load.js

@ -8,7 +8,7 @@ $.extend(BI, {
type: null,
must: false
}, options);
config.url = FR.servletURL + '?op=' + config.op + '&resource=' + config.path;
config.url = BI.servletURL + '?op=' + config.op + '&resource=' + config.path;
this.$import(config.url, config.type,config.must);
},
$import: function () {

6
src/css/base/third/farbtastic/farbtastic.css

@ -36,17 +36,17 @@
height: 101px;
}
.farbtastic .wheel {
background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/wheel.png) no-repeat;
background: url(farbtastic/wheel.png) no-repeat;
width: 195px;
height: 195px;
}
.farbtastic .overlay {
background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/mask.png) no-repeat;
background: url(farbtastic/mask.png) no-repeat;
}
.farbtastic .marker {
width: 17px;
height: 17px;
margin: -8px 0 0 -8px;
overflow: hidden;
background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/marker.png) no-repeat;
background: url(farbtastic/marker.png) no-repeat;
}

50
src/css/base/third/ztree/zTreeStyle.css

@ -29,7 +29,7 @@ website: http://code.google.com/p/jquerytree/
padding: 0 0 0 18px;
}
.ztree li ul.line {
background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-1.png) 0 0 repeat-y;
background: url(icon/tree-vertical-line-1.png) 0 0 repeat-y;
}
.ztree li a {
padding: 1px 3px 0 0;
@ -84,8 +84,8 @@ website: http://code.google.com/p/jquerytree/
background-color: transparent;
background-repeat: no-repeat;
background-attachment: scroll;
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png");
*background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif");
background-image: url("ztree/img/zTreeStandard.png");
*background-image: url("ztree/img/zTreeStandard.gif");
}
.ztree li span.button.chk {
width: 16px;
@ -94,31 +94,31 @@ website: http://code.google.com/p/jquerytree/
cursor: auto;
}
.ztree li span.button.chk.checkbox_false_full {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png");
background-image: url("icon/check-box-normal.png");
}
.ztree li span.button.chk.checkbox_false_full_focus {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png");
background-image: url("icon/check-box-normal.png");
}
.ztree li span.button.chk.checkbox_false_part {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image: url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_false_part_focus {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image: url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_false_disable {
background-position: 0 -56px;
}
.ztree li span.button.chk.checkbox_true_full {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png");
background-image: url("icon/check-box-active.png");
}
.ztree li span.button.chk.checkbox_true_full_focus {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png");
background-image: url("icon/check-box-active.png");
}
.ztree li span.button.chk.checkbox_true_part {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image: url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_true_part_focus {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image: url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_true_disable {
background-position: -14px -56px;
@ -158,28 +158,28 @@ website: http://code.google.com/p/jquerytree/
height: 25px;
}
.ztree li span.button.root_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-1.png");
background-image: url("icon/tree-expand-1.png");
}
.ztree li span.button.root_close {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-1.png");
background-image: url("icon/tree-collapse-1.png");
}
.ztree li span.button.roots_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-2.png");
background-image: url("icon/tree-expand-2.png");
}
.ztree li span.button.roots_close {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-2.png");
background-image: url("icon/tree-collapse-2.png");
}
.ztree li span.button.center_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-3.png");
background-image: url("icon/tree-expand-3.png");
}
.ztree li span.button.center_close {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-3.png");
background-image: url("icon/tree-collapse-3.png");
}
.ztree li span.button.bottom_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-4.png");
background-image: url("icon/tree-expand-4.png");
}
.ztree li span.button.bottom_close {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-4.png");
background-image: url("icon/tree-collapse-4.png");
}
.ztree li span.button.noline_open {
background-position: -92px -72px;
@ -191,13 +191,13 @@ website: http://code.google.com/p/jquerytree/
background: none;
}
.ztree li span.button.roots_docu {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-2.png");
background-image: url("icon/tree-vertical-line-2.png");
}
.ztree li span.button.center_docu {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-3.png");
background-image: url("icon/tree-vertical-line-3.png");
}
.ztree li span.button.bottom_docu {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-4.png");
background-image: url("icon/tree-vertical-line-4.png");
}
.ztree li span.button.noline_docu {
background: none;
@ -235,7 +235,7 @@ website: http://code.google.com/p/jquerytree/
.ztree li span.button.ico_loading {
width: 0px;
margin-right: 2px;
background: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif") no-repeat scroll 0 0 transparent;
background: url("ztree/img/loading.gif") no-repeat scroll 0 0 transparent;
vertical-align: top;
*vertical-align: middle;
}
@ -256,8 +256,8 @@ span.tmpzTreeMove_arrow {
background-repeat: no-repeat;
background-attachment: scroll;
background-position: -110px -80px;
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png");
*background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif");
background-image: url("ztree/img/zTreeStandard.png");
*background-image: url("ztree/img/zTreeStandard.gif");
}
ul.ztree.zTreeDragUL {
margin: 0;

2
src/css/base/view/popupview.css

@ -1,7 +1,7 @@
/****添加计算宽度的--运算符直接需要space****/
/****** common color(常用颜色,可用于普遍场景) *****/
/**** custom color(自定义颜色,用于特定场景) ****/
/**********FR.BIListView*************/
/**********BI.BIListView*************/
.bi-list-view {
position: fixed !important;
overflow-y: visible !important;

6
src/less/base/third/farbtastic/farbtastic.less

@ -34,18 +34,18 @@
height: 101px;
}
.farbtastic .wheel {
background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/wheel.png) no-repeat;
background: url(farbtastic/wheel.png) no-repeat;
width: 195px;
height: 195px;
}
.farbtastic .overlay {
background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/mask.png) no-repeat;
background: url(farbtastic/mask.png) no-repeat;
}
.farbtastic .marker {
width: 17px;
height: 17px;
margin: -8px 0 0 -8px;
overflow: hidden;
background: url(${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/farbtastic/marker.png) no-repeat;
background: url(farbtastic/marker.png) no-repeat;
}

46
src/less/base/third/ztree/zTreeStyle.less

@ -12,7 +12,7 @@ website: http://code.google.com/p/jquerytree/
.ztree {margin:0; padding:5px; }
.ztree li{padding:0; margin:0; list-style:none; line-height:14px; text-align:left; white-space:nowrap; outline:0}
.ztree li ul{ margin:0; padding:0 0 0 18px}
.ztree li ul.line{ background:url(${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-1.png) 0 0 repeat-y;}
.ztree li ul.line{ background:url(icon/tree-vertical-line-1.png) 0 0 repeat-y;}
.ztree li a {padding:1px 3px 0 0; margin:0; cursor:pointer; height:24px; background-color: transparent;
text-decoration:none; vertical-align:top; display: inline-block}
@ -28,33 +28,33 @@ website: http://code.google.com/p/jquerytree/
.ztree li span.button {line-height:0; margin:0; width:16px; height:16px; display: inline-block; vertical-align:middle;
border:0 none; cursor: pointer;outline:none;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png"); *background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif")}
background-image:url("ztree/img/zTreeStandard.png"); *background-image:url("ztree/img/zTreeStandard.gif")}
.ztree li span.button.chk {width:16px; height:16px; margin:0 3px 0 0; cursor: auto}
.ztree li span.button.chk.checkbox_false_full {
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png");
background-image:url("icon/check-box-normal.png");
}
.ztree li span.button.chk.checkbox_false_full_focus {
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-normal.png");
background-image:url("icon/check-box-normal.png");
}
.ztree li span.button.chk.checkbox_false_part {
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image:url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_false_part_focus {
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image:url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_false_disable {background-position:0 -56px}
.ztree li span.button.chk.checkbox_true_full {
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png");
background-image:url("icon/check-box-active.png");
}
.ztree li span.button.chk.checkbox_true_full_focus {
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/check-box-active.png");
background-image:url("icon/check-box-active.png");
}
.ztree li span.button.chk.checkbox_true_part {
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image:url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_true_part_focus {
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/half_selected.png");
background-image:url("icon/half_selected.png");
}
.ztree li span.button.chk.checkbox_true_disable {background-position:-14px -56px}
.ztree li span.button.chk.radio_false_full {background-position:-28px 0}
@ -70,40 +70,40 @@ website: http://code.google.com/p/jquerytree/
.ztree li span.button.switch {width:25px; height:25px}
.ztree li span.button.root_open{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-1.png");
background-image:url("icon/tree-expand-1.png");
}
.ztree li span.button.root_close{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-1.png");
background-image:url("icon/tree-collapse-1.png");
}
.ztree li span.button.roots_open{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-2.png");
background-image:url("icon/tree-expand-2.png");
}
.ztree li span.button.roots_close{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-2.png");
background-image:url("icon/tree-collapse-2.png");
}
.ztree li span.button.center_open{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-3.png");
background-image:url("icon/tree-expand-3.png");
}
.ztree li span.button.center_close{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-3.png");
background-image:url("icon/tree-collapse-3.png");
}
.ztree li span.button.bottom_open{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-expand-4.png");
background-image:url("icon/tree-expand-4.png");
}
.ztree li span.button.bottom_close{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-collapse-4.png");
background-image:url("icon/tree-collapse-4.png");
}
.ztree li span.button.noline_open{background-position:-92px -72px}
.ztree li span.button.noline_close{background-position:-74px -72px}
.ztree li span.button.root_docu{ background:none;}
.ztree li span.button.roots_docu{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-2.png");
background-image:url("icon/tree-vertical-line-2.png");
}
.ztree li span.button.center_docu{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-3.png");
background-image:url("icon/tree-vertical-line-3.png");
}
.ztree li span.button.bottom_docu{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-4.png");
background-image:url("icon/tree-vertical-line-4.png");
}
.ztree li span.button.noline_docu{ background:none;}
@ -113,13 +113,13 @@ website: http://code.google.com/p/jquerytree/
.ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico_loading{width: 0px;margin-right:2px; background:url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/loading.gif") no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico_loading{width: 0px;margin-right:2px; background:url("ztree/img/loading.gif") no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
span.tmpzTreeMove_arrow {width:16px; height:16px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
background-position:-110px -80px; background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.png"); *background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/css/base/third/ztree/img/zTreeStandard.gif")}
background-position:-110px -80px; background-image:url("ztree/img/zTreeStandard.png"); *background-image:url("ztree/img/zTreeStandard.gif")}
ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
.zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}

2
src/less/base/view/popupview.less

@ -1,7 +1,7 @@
@import "../../bibase";
/**********FR.BIListView*************/
/**********BI.BIListView*************/
.bi-list-view {
position: fixed !important;
overflow-y: visible !important;

2
src/widget/image/uploadimage.js

@ -268,7 +268,7 @@ BI.UploadImage = BI.inherit(BI.Widget, {
BI.extend(BI.UploadImage, {
getImageSrc: function (src) {
return FR.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + src;
return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + src;
}
});

Loading…
Cancel
Save