Browse Source

删掉 BICst相关

es6
guy 8 years ago
parent
commit
dbb076f817
  1. 1
      demo/js/component/demo.treevaluechooser.js
  2. 45070
      dist/base.js
  3. 9337
      dist/case.js
  4. 29119
      dist/core.js
  5. 30870
      dist/widget.js
  6. 1
      src/base/layer/layer.floatbox.js
  7. 2
      src/base/tree/treeview.js
  8. 7
      src/case/loader/loader.lazy.js
  9. 7
      src/core/proto/array.js
  10. 464
      src/data/constant/biconst.js
  11. 6
      src/widget/arrangement/arrangement.js
  12. 59
      src/widget/copy2group/button.add.copy2group.js
  13. 153
      src/widget/copy2group/combo.copy2group.js
  14. 85
      src/widget/copy2group/toolbar.copy2group.js
  15. 61
      src/widget/date/calendar/combo.month.date.js
  16. 66
      src/widget/date/calendar/combo.year.date.js
  17. 127
      src/widget/date/calendar/picker.date.js
  18. 96
      src/widget/date/calendar/popup.calendar.date.js
  19. 70
      src/widget/date/calendar/trigger.triangle.date.js
  20. 59
      src/widget/date/combo.date.js
  21. 269
      src/widget/date/trigger.date.js
  22. 49
      src/widget/filterpane/abstract.item.filter.js
  23. 79
      src/widget/filterpane/expander.filter.js
  24. 181
      src/widget/filterpane/filter.js
  25. 219
      src/widget/filterpane/operation.filter.js
  26. 60
      src/widget/filterpane/pane.filter.js
  27. 66
      src/widget/formula/group.symbol.js
  28. 343
      src/widget/formula/insert.formula.js
  29. 97
      src/widget/formula/item.button.text.treeleaf.js
  30. 175
      src/widget/formula/pane.function.js
  31. 26
      src/widget/formula/pane.searcher.function.js
  32. 110
      src/widget/formula/tree.fieldname.js
  33. 170
      src/widget/formula/tree.function.js
  34. 77
      src/widget/image/button/href/image.button.href.js
  35. 55
      src/widget/image/button/size/image.button.size.combo.js
  36. 71
      src/widget/image/button/size/image.button.size.js
  37. 66
      src/widget/image/button/size/radio/image.button.size.radio.js
  38. 277
      src/widget/image/uploadimage.js
  39. 136
      src/widget/listlabel/group.item.listlabel.js
  40. 160
      src/widget/listlabel/listlabel.js
  41. 160
      src/widget/multidate/abstract.multidate.datepane.js
  42. 259
      src/widget/multidate/multidate.combo.js
  43. 45
      src/widget/multidate/multidate.day.js
  44. 51
      src/widget/multidate/multidate.month.js
  45. 313
      src/widget/multidate/multidate.popup.js
  46. 51
      src/widget/multidate/multidate.quarter.js
  47. 134
      src/widget/multidate/multidate.segment.js
  48. 41
      src/widget/multidate/multidate.week.js
  49. 49
      src/widget/multidate/multidate.year.js
  50. 95
      src/widget/paramsettingcombo/datecombo/combo.param.date.js
  51. 52
      src/widget/paramsettingcombo/datecombo/popup.param.date.js
  52. 95
      src/widget/paramsettingcombo/dateintervalcombo/combo.param.dateinterval.js
  53. 52
      src/widget/paramsettingcombo/dateintervalcombo/popup.param.dateinterval.js
  54. 131
      src/widget/paramsettingcombo/param0.date.item.js
  55. 187
      src/widget/paramsettingcombo/param1.date.item.js
  56. 187
      src/widget/paramsettingcombo/param2.date.item.js
  57. 131
      src/widget/paramsettingcombo/param3.date.item.js
  58. 134
      src/widget/paramsettingcombo/popup.param.js
  59. 46
      src/widget/paramsettingcombo/rangevaluecombo/rangevaluecombo.js
  60. 99
      src/widget/paramsettingcombo/yearcombo/combo.param.year.js
  61. 105
      src/widget/paramsettingcombo/yearcombo/param.year.item.js
  62. 86
      src/widget/paramsettingcombo/yearmonthcombo/combo.param.yearmonth.js
  63. 31
      src/widget/paramsettingcombo/yearmonthcombo/popup.param.yearmonth.js
  64. 87
      src/widget/paramsettingcombo/yearseasoncombo/combo.param.yearseason.js
  65. 31
      src/widget/paramsettingcombo/yearseasoncombo/popup.param.yearseason.js
  66. 129
      src/widget/selectdata/searcher/searcher.selectdata.js
  67. 100
      src/widget/selectdata/searchpane/result.search.selectdata.js
  68. 114
      src/widget/selectdata/searchpane/segment.search.selectdata.js
  69. 99
      src/widget/selectdata/switcher/switcher.selectdata.js
  70. 93
      src/widget/selectdata/tree/expander.selectdata.js
  71. 129
      src/widget/selectdata/tree/loader.selectdata.js
  72. 111
      src/widget/selectdata/tree/node/node.level.js
  73. 105
      src/widget/selectdata/tree/node/node.level1.date.js
  74. 105
      src/widget/selectdata/tree/node/node.level2.date.js
  75. 91
      src/widget/selectdata/tree/tree.selectdata.js
  76. 154
      src/widget/selectdata/tree/treeitem/item.level.js
  77. 61
      src/widget/sortabletable/sortabletable.dashline.horizontal.js
  78. 60
      src/widget/sortabletable/sortabletable.dashline.vertical.js
  79. 46
      src/widget/sortabletable/sortabletable.drag.button.js
  80. 366
      src/widget/sortabletable/sortabletable.js
  81. 111
      src/widget/uploadfile/progress.uploadfile.js

1
demo/js/component/demo.treevaluechooser.js

@ -23,6 +23,7 @@ Demo.TreeValueChooser = BI.inherit(BI.Widget, {
}
var widget = BI.createWidget({
type: "bi.tree_value_chooser_combo",
width: 300,
items: tree,
itemsCreator: function (op, callback) {
callback(tree);

45070
dist/base.js vendored

File diff suppressed because it is too large Load Diff

9337
dist/case.js vendored

File diff suppressed because it is too large Load Diff

29119
dist/core.js vendored

File diff suppressed because it is too large Load Diff

30870
dist/widget.js vendored

File diff suppressed because it is too large Load Diff

1
src/base/layer/layer.floatbox.js

@ -20,7 +20,6 @@ BI.FloatBox = BI.inherit(BI.Widget, {
this._center = BI.createWidget();
this._north = BI.createWidget();
this.element.draggable({
cursor: BICst.cursorUrl,
handle: ".bi-message-title",
drag: function (e, ui) {
var W = $("body").width(), H = $("body").height();

2
src/base/tree/treeview.js

@ -361,7 +361,7 @@ BI.TreeView = BI.inherit(BI.Pane, {
};
var op = BI.extend({}, o.paras, {
times: 1,
type: BICst.TREE.TREE_REQ_TYPE.INIT_DATA
type: BI.TreeView.REQ_TYPE_INIT_DATA
});
o.itemsCreator(op, function (res) {

7
src/case/loader/loader.lazy.js

@ -2,6 +2,9 @@
* Created by roy on 15/11/6.
*/
BI.LazyLoader = BI.inherit(BI.Widget, {
_const: {
PAGE: 100
},
_defaultConfig: function () {
return BI.extend(BI.LazyLoader.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-lazy-loader",
@ -33,9 +36,9 @@ BI.LazyLoader = BI.inherit(BI.Widget, {
},
_getNextItems: function (options) {
var self = this, o = this.options;
var lastNum = o.items.length - BICst.PAGE_COUNT * (options.times - 1);
var lastNum = o.items.length - this._const.PAGE * (options.times - 1);
var lastItems = BI.last(o.items, lastNum);
var nextItems = BI.first(lastItems, BICst.PAGE_COUNT);
var nextItems = BI.first(lastItems, this._const.PAGE);
return nextItems;
},

7
src/core/proto/array.js

@ -59,13 +59,6 @@ $.extend(Array.prototype, {
* Created by wang on 15/6/23.
*/
!function () {
_.each(['contains', 'indexOf', 'lastIndexOf'], function (name) {
Array.prototype[name] = function () {
var arr = _.toArray(arguments);
arr.unshift(this);
return BI[name].apply(this, arr);
};
});
Array.prototype.pushArray = function (array) {
for (var i = 0; i < array.length; i++) {
this.push(array[i]);

464
src/data/constant/biconst.js

@ -1,464 +0,0 @@
BICst.HISTORY_VERSION = {};
BICst.HISTORY_VERSION.VERSION_4_0 = 4.0;
BICst.HISTORY_VERSION.VERSION_4_1 = 4.01;
BICst.REPORT_AUTH = {};
BICst.REPORT_AUTH.NONE = 0;
BICst.REPORT_AUTH.EDIT = 1;
BICst.REPORT_AUTH.VIEW = 2;
BICst.TARGET_STYLE = {};
BICst.TARGET_STYLE.ICON_STYLE = {};
BICst.TARGET_STYLE.ICON_STYLE.NONE = 1;
BICst.TARGET_STYLE.ICON_STYLE.POINT = 2;
BICst.TARGET_STYLE.ICON_STYLE.ARROW = 3;
BICst.TARGET_STYLE.NUM_LEVEL = {};
BICst.TARGET_STYLE.NUM_LEVEL.NORMAL = 1;
BICst.TARGET_STYLE.NUM_LEVEL.TEN_THOUSAND = 2;
BICst.TARGET_STYLE.NUM_LEVEL.MILLION = 3;
BICst.TARGET_STYLE.NUM_LEVEL.YI = 4;
BICst.TARGET_STYLE.NUM_LEVEL.PERCENT = 5;
BICst.TARGET_STYLE.FORMAT = {};
BICst.TARGET_STYLE.FORMAT.NORMAL = -1;
BICst.TARGET_STYLE.FORMAT.ZERO2POINT = 0;
BICst.TARGET_STYLE.FORMAT.ONE2POINT = 1;
BICst.TARGET_STYLE.FORMAT.TWO2POINT = 2;
BICst.MULTI_PATH_STATUS = {};
BICst.MULTI_PATH_STATUS.NEED_GENERATE_CUBE = 0;
BICst.MULTI_PATH_STATUS.NOT_NEED_GENERATE_CUBE = 1;
BICst.CUSTOM_GROUP = {};
BICst.CUSTOM_GROUP.UNGROUP2OTHER = {};
BICst.CUSTOM_GROUP.UNGROUP2OTHER.NOTSELECTED = 0;
BICst.CUSTOM_GROUP.UNGROUP2OTHER.SELECTED = 1;
BICst.REPORT_STATUS = {};
BICst.REPORT_STATUS.APPLYING = 1;
BICst.REPORT_STATUS.HANGOUT = 2;
BICst.REPORT_STATUS.NORMAL = 3;
BICst.FIELD_ID = {};
BICst.FIELD_ID.HEAD = "81c48028-1401-11e6-a148-3e1d05defe78";
BICst.TREE_LABEL = {};
BICst.TREE_LABEL.TREE_LABEL_ITEM_COUNT_NUM = 40;
BICst.TREE = {};
BICst.TREE.TREE_REQ_TYPE = {};
BICst.TREE.TREE_REQ_TYPE.INIT_DATA = 0;
BICst.TREE.TREE_REQ_TYPE.SEARCH_DATA = 1;
BICst.TREE.TREE_REQ_TYPE.SELECTED_DATA = 3;
BICst.TREE.TREE_REQ_TYPE.ADJUST_DATA = 2;
BICst.TREE.TREE_REQ_TYPE.DISPLAY_DATA = 4;
BICst.TREE.TREE_ITEM_COUNT_PER_PAGE = 100;
BICst.BUSINESS_TABLE_TYPE = {};
BICst.BUSINESS_TABLE_TYPE.NORMAL = 0;
BICst.EXPANDER_TYPE = {};
BICst.EXPANDER_TYPE.NONE = false;
BICst.EXPANDER_TYPE.ALL = true;
BICst.SORT = {};
BICst.SORT.ASC = 0;
BICst.SORT.DESC = 1;
BICst.SORT.CUSTOM = 2;
BICst.SORT.NONE = 3;
BICst.SORT.NUMBER_ASC = 4;
BICst.SORT.NUMBER_DESC = 5;
BICst.TABLE_PAGE_OPERATOR = {};
BICst.TABLE_PAGE_OPERATOR.ALL_PAGE = -1;
BICst.TABLE_PAGE_OPERATOR.REFRESH = 0;
BICst.TABLE_PAGE_OPERATOR.COLUMN_PRE = 1;
BICst.TABLE_PAGE_OPERATOR.COLUMN_NEXT = 2;
BICst.TABLE_PAGE_OPERATOR.ROW_PRE = 3;
BICst.TABLE_PAGE_OPERATOR.ROW_NEXT = 4;
BICst.TABLE_PAGE_OPERATOR.EXPAND = 5;
BICst.TABLE_PAGE = {};
BICst.TABLE_PAGE.VERTICAL_PRE = 0;
BICst.TABLE_PAGE.VERTICAL_NEXT = 1;
BICst.TABLE_PAGE.HORIZON_PRE = 2;
BICst.TABLE_PAGE.HORIZON_NEXT = 3;
BICst.TABLE_PAGE.TOTAL_PAGE = 4;
BICst.TABLE_WIDGET = {};
BICst.TABLE_WIDGET.GROUP_TYPE = 1;
BICst.TABLE_WIDGET.CROSS_TYPE = 2;
BICst.TABLE_WIDGET.COMPLEX_TYPE = 3;
BICst.REGION = {};
BICst.REGION.DIMENSION1 = "10000";
BICst.REGION.DIMENSION2 = "20000";
BICst.REGION.TARGET1 = "30000";
BICst.REGION.TARGET2 = "40000";
BICst.REGION.TARGET3 = "50000";
BICst.EXPORT = {};
BICst.EXPORT.EXCEL = 1;
BICst.EXPORT.PDF = 2;
BICst.WIDGET = {};
BICst.WIDGET.TABLE = 1;
BICst.WIDGET.CROSS_TABLE = 2;
BICst.WIDGET.COMPLEX_TABLE = 3;
BICst.WIDGET.DETAIL = 4;
BICst.WIDGET.AXIS = 5;
BICst.WIDGET.ACCUMULATE_AXIS = 6;
BICst.WIDGET.PERCENT_ACCUMULATE_AXIS = 7;
BICst.WIDGET.COMPARE_AXIS = 8;
BICst.WIDGET.FALL_AXIS = 9;
BICst.WIDGET.BAR = 10;
BICst.WIDGET.ACCUMULATE_BAR = 11;
BICst.WIDGET.COMPARE_BAR = 12;
BICst.WIDGET.LINE = 13;
BICst.WIDGET.AREA = 14;
BICst.WIDGET.ACCUMULATE_AREA = 15;
BICst.WIDGET.PERCENT_ACCUMULATE_AREA = 16;
BICst.WIDGET.COMPARE_AREA = 17;
BICst.WIDGET.RANGE_AREA = 18;
BICst.WIDGET.COMBINE_CHART = 19;
BICst.WIDGET.MULTI_AXIS_COMBINE_CHART = 20;
BICst.WIDGET.PIE = 21;
BICst.WIDGET.DONUT = 22;
BICst.WIDGET.MAP = 23;
BICst.WIDGET.GIS_MAP = 24;
BICst.WIDGET.DASHBOARD = 25;
BICst.WIDGET.BUBBLE = 26;
BICst.WIDGET.FORCE_BUBBLE = 27;
BICst.WIDGET.SCATTER = 28;
BICst.WIDGET.RADAR = 29;
BICst.WIDGET.ACCUMULATE_RADAR = 30;
BICst.WIDGET.FUNNEL = 31;
BICst.WIDGET.RECT_TREE = 39;
BICst.WIDGET.MULTI_PIE = 40;
BICst.WIDGET.HEAT_MAP = 65;
BICst.WIDGET.PARETO = 66;
BICst.WIDGET.STRING = 32;
BICst.WIDGET.NUMBER = 33;
BICst.WIDGET.TREE = 34;
BICst.WIDGET.SINGLE_SLIDER = 35;
BICst.WIDGET.INTERVAL_SLIDER = 36;
BICst.WIDGET.LIST_LABEL = 37;
BICst.WIDGET.TREE_LABEL = 38;
BICst.WIDGET.STRING_LIST = 59;
BICst.WIDGET.TREE_LIST = 60;
BICst.WIDGET.DATE_PANE = 61;
BICst.WIDGET.DATE = 48;
BICst.WIDGET.YEAR = 49;
BICst.WIDGET.QUARTER = 50;
BICst.WIDGET.MONTH = 51;
BICst.WIDGET.YMD = 52;
BICst.WIDGET.QUERY = 53;
BICst.WIDGET.RESET = 54;
BICst.WIDGET.CONTENT = 55;
BICst.WIDGET.IMAGE = 56;
BICst.WIDGET.WEB = 57;
BICst.WIDGET.GENERAL_QUERY = 58;
BICst.WIDGET.TABLE_SHOW = 64;
BICst.WIDGET.NONE = -1;
BICst.TARGET_TYPE = {};
BICst.TARGET_TYPE.CAL_POSITION = {};
BICst.TARGET_TYPE.CAL_POSITION.ALL = 0;
BICst.TARGET_TYPE.CAL_POSITION.INGROUP = 1;
BICst.TARGET_TYPE.CAL_VALUE = {};
BICst.TARGET_TYPE.CAL_VALUE.PERIOD_TYPE = {};
BICst.TARGET_TYPE.CAL_VALUE.PERIOD_TYPE.VALUE = 0;
BICst.TARGET_TYPE.CAL_VALUE.PERIOD_TYPE.RATE = 1;
BICst.TARGET_TYPE.CAL_VALUE.SUMMARY_TYPE = {};
BICst.TARGET_TYPE.CAL_VALUE.SUMMARY_TYPE.SUM = 0;
BICst.TARGET_TYPE.CAL_VALUE.SUMMARY_TYPE.MAX = 1;
BICst.TARGET_TYPE.CAL_VALUE.SUMMARY_TYPE.MIN = 2;
BICst.TARGET_TYPE.CAL_VALUE.SUMMARY_TYPE.AVG = 3;
BICst.TARGET_TYPE.CAL_VALUE.RANK_TPYE = {};
BICst.TARGET_TYPE.CAL_VALUE.RANK_TPYE.ASC = 0;
BICst.TARGET_TYPE.CAL_VALUE.RANK_TPYE.DESC = 1;
BICst.TARGET_TYPE.CAL_VALUE.SUM_OF_ALL = 0;
BICst.TARGET_TYPE.CAL_VALUE.PERIOD = 1;
BICst.TARGET_TYPE.CAL_VALUE.SUM_OF_ABOVE = 2;
BICst.TARGET_TYPE.CAL_VALUE.RANK = 3;
BICst.TARGET_TYPE.CAL = {};
BICst.TARGET_TYPE.CAL.FORMULA = 0;
BICst.TARGET_TYPE.CAL.CONFIGURATION = 1;
BICst.TARGET_TYPE.STRING = 1;
BICst.TARGET_TYPE.NUMBER = 2;
BICst.TARGET_TYPE.DATE = 3;
BICst.TARGET_TYPE.COUNTER = 4;
BICst.TARGET_TYPE.FORMULA = 5;
BICst.TARGET_TYPE.YEAR_ON_YEAR_RATE = 6;
BICst.TARGET_TYPE.MONTH_ON_MONTH_RATE = 7;
BICst.TARGET_TYPE.YEAR_ON_YEAR_VALUE = 8;
BICst.TARGET_TYPE.MONTH_ON_MONTH_VALUE = 9;
BICst.TARGET_TYPE.SUM_OF_ABOVE = 10;
BICst.TARGET_TYPE.SUM_OF_ABOVE_IN_GROUP = 11;
BICst.TARGET_TYPE.SUM_OF_ALL = 12;
BICst.TARGET_TYPE.SUM_OF_ALL_IN_GROUP = 13;
BICst.TARGET_TYPE.RANK = 14;
BICst.TARGET_TYPE.RANK_IN_GROUP = 15;
BICst.DIMENSION_FILTER_DATE = {};
BICst.DIMENSION_FILTER_DATE.BELONG_VALUE = 98;
BICst.DIMENSION_FILTER_DATE.NOT_BELONG_VALUE = 99;
BICst.DIMENSION_FILTER_DATE.IS_NULL = 100;
BICst.DIMENSION_FILTER_DATE.NOT_NULL = 101;
BICst.DIMENSION_FILTER_DATE.TOP_N = 102;
BICst.DIMENSION_FILTER_DATE.BOTTOM_N = 103;
BICst.DIMENSION_FILTER_DATE.CONTAIN = 104;
BICst.DIMENSION_FILTER_DATE.NOT_CONTAIN = 105;
BICst.DIMENSION_FILTER_DATE.BEGIN_WITH = 106;
BICst.DIMENSION_FILTER_DATE.END_WITH = 107;
BICst.FILTER_TYPE = {};
BICst.FILTER_TYPE.AND = 80;
BICst.FILTER_TYPE.OR = 81;
BICst.FILTER_TYPE.FORMULA = 82;
BICst.FILTER_TYPE.EMPTY_FORMULA = 90;
BICst.FILTER_TYPE.EMPTY_CONDITION = 91;
BICst.FILTER_TYPE.NUMBER_SUM = 83;
BICst.FILTER_TYPE.NUMBER_AVG = 84;
BICst.FILTER_TYPE.NUMBER_MAX = 85;
BICst.FILTER_TYPE.NUMBER_MIN = 86;
BICst.FILTER_TYPE.NUMBER_COUNT = 87;
BICst.FILTER_TYPE.TREE_FILTER = 88;
BICst.FILTER_TYPE.COLUMNFILTER = 89;
BICst.FILTER_TYPE.DIMENSION_TARGET_VALUE_FILTER = 96;
BICst.FILTER_TYPE.DIMENSION_SELF_FILTER = 97;
BICst.FILTER_DATE = {};
BICst.FILTER_DATE.BELONG_DATE_RANGE = 64;
BICst.FILTER_DATE.BELONG_WIDGET_VALUE = 65;
BICst.FILTER_DATE.NOT_BELONG_DATE_RANGE = 66;
BICst.FILTER_DATE.NOT_BELONG_WIDGET_VALUE = 67;
BICst.FILTER_DATE.MORE_THAN = 68;
BICst.FILTER_DATE.LESS_THAN = 69;
BICst.FILTER_DATE.EQUAL_TO = 70;
BICst.FILTER_DATE.NOT_EQUAL_TO = 71;
BICst.FILTER_DATE.IS_NULL = 72;
BICst.FILTER_DATE.NOT_NULL = 73;
BICst.FILTER_DATE.EARLY_THAN = 74;
BICst.FILTER_DATE.LATER_THAN = 75;
BICst.FILTER_DATE.CONTAINS = 76;
BICst.FILTER_DATE.CONTAINS_DAY = 77;
BICst.FILTER_DATE.DAY_EQUAL_TO = 78;
BICst.FILTER_DATE.DAY_NOT_EQUAL_TO = 79;
BICst.TARGET_FILTER_NUMBER = {};
BICst.TARGET_FILTER_NUMBER.EQUAL_TO = 48;
BICst.TARGET_FILTER_NUMBER.NOT_EQUAL_TO = 49;
BICst.TARGET_FILTER_NUMBER.BELONG_VALUE = 50;
BICst.TARGET_FILTER_NUMBER.BELONG_USER = 51;
BICst.TARGET_FILTER_NUMBER.NOT_BELONG_VALUE = 52;
BICst.TARGET_FILTER_NUMBER.NOT_BELONG_USER = 53;
BICst.TARGET_FILTER_NUMBER.IS_NULL = 54;
BICst.TARGET_FILTER_NUMBER.NOT_NULL = 55;
BICst.TARGET_FILTER_NUMBER.CONTAINS = 56;
BICst.TARGET_FILTER_NUMBER.NOT_CONTAINS = 57;
BICst.TARGET_FILTER_NUMBER.LARGE_THAN_CAL_LINE = 58;
BICst.TARGET_FILTER_NUMBER.LARGE_OR_EQUAL_CAL_LINE = 59;
BICst.TARGET_FILTER_NUMBER.SMALL_THAN_CAL_LINE = 60;
BICst.TARGET_FILTER_NUMBER.SMALL_OR_EQUAL_CAL_LINE = 61;
BICst.TARGET_FILTER_NUMBER.TOP_N = 62;
BICst.TARGET_FILTER_NUMBER.BOTTOM_N = 63;
BICst.TARGET_FILTER_STRING = {};
BICst.TARGET_FILTER_STRING.BELONG_VALUE = 32;
BICst.TARGET_FILTER_STRING.BELONG_USER = 33;
BICst.TARGET_FILTER_STRING.NOT_BELONG_VALUE = 34;
BICst.TARGET_FILTER_STRING.NOT_BELONG_USER = 35;
BICst.TARGET_FILTER_STRING.CONTAIN = 36;
BICst.TARGET_FILTER_STRING.NOT_CONTAIN = 37;
BICst.TARGET_FILTER_STRING.IS_NULL = 38;
BICst.TARGET_FILTER_STRING.NOT_NULL = 39;
BICst.TARGET_FILTER_STRING.BEGIN_WITH = 40;
BICst.TARGET_FILTER_STRING.END_WITH = 41;
BICst.TARGET_FILTER_STRING.NOT_BEGIN_WITH = 42;
BICst.TARGET_FILTER_STRING.NOT_END_WITH = 43;
BICst.TARGET_FILTER_STRING.VAGUE_CONTAIN = 46;
BICst.TARGET_FILTER_STRING.NOT_VAGUE_CONTAIN = 47;
BICst.DIMENSION_FILTER_NUMBER = {};
BICst.DIMENSION_FILTER_NUMBER.BELONG_VALUE = 16;
BICst.DIMENSION_FILTER_NUMBER.BELONG_USER = 17;
BICst.DIMENSION_FILTER_NUMBER.NOT_BELONG_VALUE = 18;
BICst.DIMENSION_FILTER_NUMBER.NOT_BELONG_USER = 19;
BICst.DIMENSION_FILTER_NUMBER.MORE_THAN_AVG = 20;
BICst.DIMENSION_FILTER_NUMBER.LESS_THAN_AVG = 21;
BICst.DIMENSION_FILTER_NUMBER.IS_NULL = 22;
BICst.DIMENSION_FILTER_NUMBER.NOT_NULL = 23;
BICst.DIMENSION_FILTER_NUMBER.TOP_N = 24;
BICst.DIMENSION_FILTER_NUMBER.BOTTOM_N = 25;
BICst.DIMENSION_FILTER_STRING = {};
BICst.DIMENSION_FILTER_STRING.BELONG_VALUE = 0;
BICst.DIMENSION_FILTER_STRING.BELONG_USER = 1;
BICst.DIMENSION_FILTER_STRING.NOT_BELONG_VALUE = 2;
BICst.DIMENSION_FILTER_STRING.NOT_BELONG_USER = 3;
BICst.DIMENSION_FILTER_STRING.CONTAIN = 4;
BICst.DIMENSION_FILTER_STRING.NOT_CONTAIN = 5;
BICst.DIMENSION_FILTER_STRING.IS_NULL = 6;
BICst.DIMENSION_FILTER_STRING.NOT_NULL = 7;
BICst.DIMENSION_FILTER_STRING.BEGIN_WITH = 8;
BICst.DIMENSION_FILTER_STRING.END_WITH = 9;
BICst.DIMENSION_FILTER_STRING.TOP_N = 10;
BICst.DIMENSION_FILTER_STRING.BOTTOM_N = 11;
BICst.DIMENSION_FILTER_STRING.NOT_BEGIN_WITH = 12;
BICst.DIMENSION_FILTER_STRING.NOT_END_WITH = 13;
BICst.DIMENSION_FILTER_STRING.VAGUE_CONTAIN = 14;
BICst.DIMENSION_FILTER_STRING.NOT_VAGUE_CONTAIN = 15;
BICst.GROUP = {};
BICst.GROUP.NO_GROUP = 0;
BICst.GROUP.AUTO_GROUP = 3;
BICst.GROUP.CUSTOM_GROUP = 4;
BICst.GROUP.CUSTOM_NUMBER_GROUP = 5;
BICst.GROUP.Y = 6;
BICst.GROUP.S = 7;
BICst.GROUP.M = 8;
BICst.GROUP.W = 9;
BICst.GROUP.YMD = 10;
BICst.GROUP.YD = 11;
BICst.GROUP.MD = 12;
BICst.GROUP.YMDHMS = 13;
BICst.GROUP.ID_GROUP = 14;
BICst.GROUP.HOUR = 15;
BICst.GROUP.MINUTE = 16;
BICst.GROUP.SECOND = 17;
BICst.GROUP.WEEK_COUNT = 18;
BICst.GROUP.D = 19;
BICst.GROUP.YM = 20;
BICst.GROUP.YW = 21;
BICst.GROUP.YMDH = 22;
BICst.GROUP.YMDHM = 23;
BICst.GROUP.YS = 24;
BICst.SUMMARY_TYPE = {};
BICst.SUMMARY_TYPE.SUM = 0;
BICst.SUMMARY_TYPE.MAX = 1;
BICst.SUMMARY_TYPE.MIN = 2;
BICst.SUMMARY_TYPE.AVG = 3;
BICst.SUMMARY_TYPE.COUNT = 4;
BICst.SUMMARY_TYPE.APPEND = 5;
BICst.SUMMARY_TYPE.RECORD_COUNT = 6;
BICst.BI_REPORT = {};
BICst.BI_REPORT.NULL = 0;
BICst.BI_REPORT.SUBMITED = 1;
BICst.BI_REPORT.PUBLISHED = 2;
BICst.VERSION = "4.0.2";
BICst.SYSTEM_TIME = "__system_time-3e1d05defe78__";
BICst.ETL_ADD_COLUMN_TYPE = {};
BICst.ETL_ADD_COLUMN_TYPE.FORMULA = "formula";
BICst.ETL_ADD_COLUMN_TYPE.DATE_DIFF = "date_diff";
BICst.ETL_ADD_COLUMN_TYPE.DATE_YEAR = "date_year";
BICst.ETL_ADD_COLUMN_TYPE.DATE_SEASON = "date_season";
BICst.ETL_ADD_COLUMN_TYPE.DATE_MONTH = "date_month";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_CPP = "expr_same_period";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_LP = "expr_last_period";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_CPP_PERCENT = "expr_same_period_percent";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_LP_PERCENT = "expr_last_period_percent";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_SUM = "expr_sum";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_ACC = "expr_acc";
BICst.ETL_ADD_COLUMN_TYPE.EXPR_RANK = "expr_rank";
BICst.ETL_ADD_COLUMN_TYPE.GROUP = "group_value";
BICst.ETL_ADD_COLUMN_TYPE.SINGLE_VALUE = "single_value";
BICst.ETL_ADD_COLUMN_TYPE.VALUE_CONVERT = "value_convert";
BICst.JSON_KEYS = {};
BICst.JSON_KEYS.STATISTIC_ELEMENT = "_src";
BICst.JSON_KEYS.FILED_MAX_VALUE = "max";
BICst.JSON_KEYS.FIELD_MIN_VALUE = "min";
BICst.JSON_KEYS.FILTER_VALUE = "filter_value";
BICst.JSON_KEYS.FILTER_CONDITION = "condition";
BICst.JSON_KEYS.FILTER_AND_OR = "andor";
BICst.JSON_KEYS.FILTER_TYPE = "filter_type";
BICst.JSON_KEYS.FIELD_ID = "field_id";
BICst.JSON_KEYS.FIELD_TYPE = "field_type";
BICst.JSON_KEYS.FIELD_VALUE = "field_value";
BICst.JSON_KEYS.FIELD_NAME = "field_name";
BICst.JSON_KEYS.TYPE = "type";
BICst.JSON_KEYS.VALUE = "value";
BICst.JSON_KEYS.EXPANDER = "expander";
BICst.JSON_KEYS.EXPANDER_X = "x";
BICst.JSON_KEYS.EXPANDER_Y = "y";
BICst.JSON_KEYS.CLICKEDVALUE = "clickedvalue";
BICst.JSON_KEYS.SETTTINGS = "settings";
BICst.JSON_KEYS.ID = "id";
BICst.JSON_KEYS.TABLES = "tables";
BICst.JSON_KEYS.TABLE = "table";
BICst.JSON_KEYS.FIELDS = "fields";
BICst.JSON_KEYS.FIELD = "field";
BICst.JSON_KEYS.ETL_TYPE = "etl_type";
BICst.JSON_KEYS.ETL_VALUE = "etl_value";
BICst.JSON_KEYS.TABLE_TYPE = "table_type";
BICst.JSON_KEYS.HAS_NEXT = "hasNext";
BICst.JSON_KEYS.CONNECTION_NAME = "connection_name";
BICst.JSON_KEYS.TABLE_NAME = "table_name";
BICst.JSON_KEYS.TRAN_NAME = "tran_name";
BICst.JSON_KEYS.TABLE_TRAN_NAME = "table_tran_name";
BICst.JSON_KEYS.FIELD_TRAN_NAME = "field_tran_name";
BICst.JSON_KEYS.GROUP_NAME = "group_name";
BICst.JSON_KEYS.PACKAGE_NAME = "package_name";
BICst.JSON_KEYS.RELATIONS = "relations";
BICst.JSON_KEYS.TRANSLATIONS = "translations";
BICst.JSON_KEYS.UPDATESETTING = "update_setting";
BICst.JSON_KEYS.PACKAGE_ID = "package_id";
BICst.JSON_KEYS.CONNECTION_SET = "connectionSet";
BICst.JSON_KEYS.PRIMARY_KEY_MAP = "primKeyMap";
BICst.JSON_KEYS.FOREIGN_KEY_MAP = "foreignKeyMap";
BICst.DATA_CONFIG_DESIGN = {};
BICst.DATA_CONFIG_DESIGN.NO = 0;
BICst.DATA_CONFIG_DESIGN.YES = 1;
BICst.DATA_CONFIG_AUTHORITY = {};
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_MANAGER = {};
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_MANAGER.NODE = "__package_manager_node__";
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_MANAGER.PAGE = "__package_manager_page__";
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_MANAGER.SERVER_CONNECTION = "__package_server_connection__";
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_MANAGER.DATA_CONNECTION = "__package_data_connection__";
BICst.DATA_CONFIG_AUTHORITY.DATA_CONNECTION = {};
BICst.DATA_CONFIG_AUTHORITY.DATA_CONNECTION.NODE = "__data_connection_node__";
BICst.DATA_CONFIG_AUTHORITY.DATA_CONNECTION.PAGE = "__data_connection_page__";
BICst.DATA_CONFIG_AUTHORITY.MULTI_PATH_SETTING = "__multi_path_setting__";
BICst.DATA_CONFIG_AUTHORITY.PACKAGE_AUTHORITY = "__package_authority__";
BICst.DATA_CONFIG_AUTHORITY.FINE_INDEX_UPDATE = "__fine_index_update__";
BICst.GLOBAL_UPDATE_TYPE = {};
BICst.GLOBAL_UPDATE_TYPE.PART_UPDATE = "_part_update_";
BICst.GLOBAL_UPDATE_TYPE.COMPLETE_UPDATE = "_complete_update_";
BICst.GLOBAL_UPDATE_TYPE.META_UPDATE = "_meta_update_";
BICst.CUBE_UPDATE_TYPE = {};
BICst.CUBE_UPDATE_TYPE.GLOBAL_UPDATE = "__global_update__";
BICst.CUBE_UPDATE_TYPE.SINGLETABLE_UPDATE = "__singleTable_update__";
BICst.SINGLE_TABLE_UPDATE = {};
BICst.SINGLE_TABLE_UPDATE.TOGETHER = 0;
BICst.SINGLE_TABLE_UPDATE.NEVER = 1;
BICst.SINGLE_TABLE_UPDATE_TYPE = {};
BICst.SINGLE_TABLE_UPDATE_TYPE.ALL = 0;
BICst.SINGLE_TABLE_UPDATE_TYPE.PART = 1;
BICst.SINGLE_TABLE_UPDATE_TYPE.NEVER = 2;
BICst.UPDATE_FREQUENCY = {};
BICst.UPDATE_FREQUENCY.EVER_DAY = 0;
BICst.UPDATE_FREQUENCY.EVER_SUNDAY = 1;
BICst.UPDATE_FREQUENCY.EVER_MONDAY = 2;
BICst.UPDATE_FREQUENCY.EVER_TUESDAY = 3;
BICst.UPDATE_FREQUENCY.EVER_WEDNESDAY = 4;
BICst.UPDATE_FREQUENCY.EVER_THURSDAY = 5;
BICst.UPDATE_FREQUENCY.EVER_FRIDAY = 6;
BICst.UPDATE_FREQUENCY.EVER_SATURDAY = 7;
BICst.UPDATE_FREQUENCY.EVER_MONTH = 10;
BICst.REQ_DATA_TYPE = {};
BICst.REQ_DATA_TYPE.REQ_GET_ALL_DATA = -1;
BICst.REQ_DATA_TYPE.REQ_GET_DATA_LENGTH = 0;
BICst.TRANS_TYPE = {};
BICst.TRANS_TYPE.READ_FROM_DB = "db";
BICst.TRANS_TYPE.READ_FROM_TABLEDATA = "tabledata";
BICst.TRANS_TYPE.CHOOSE = "choose";
BICst.CONNECTION = {};
BICst.CONNECTION.ETL_CONNECTION = "__FR_BI_ETL__";
BICst.CONNECTION.SERVER_CONNECTION = "__FR_BI_SERVER__";
BICst.CONNECTION.SQL_CONNECTION = "__FR_BI_SQL__";
BICst.CONNECTION.EXCEL_CONNECTION = "__FR_BI_EXCEL__";
BICst.COLUMN = {};
BICst.COLUMN.NUMBER = 32;
BICst.COLUMN.STRING = 16;
BICst.COLUMN.DATE = 48;
BICst.COLUMN.COUNTER = 64;
BICst.COLUMN.ROW = 80;
BICst.CLASS = {};
BICst.CLASS.INTEGER = 0;
BICst.CLASS.LONG = 1;
BICst.CLASS.DOUBLE = 2;
BICst.CLASS.FLOAT = 3;
BICst.CLASS.DATE = 4;
BICst.CLASS.STRING = 5;
BICst.CLASS.BOOLEAN = 6;
BICst.CLASS.TIMESTAMP = 7;
BICst.CLASS.DECIMAL = 8;
BICst.CLASS.TIME = 9;
BICst.CLASS.BYTE = 10;
BICst.CLASS.ROW = 16;
BICst.SYSTEM_USER_NAME = "__system_user_name__";
BICst.LAST_UPDATE_TIME = "__last_update_time__";
BICst.CURRENT_UPDATE_TIME = "__current_update_time__";
BICst.FUNCTION = {};
BICst.FUNCTION.TEXT = 1;
BICst.FUNCTION.MATH = 2;
BICst.FUNCTION.DATE = 3;
BICst.FUNCTION.ARRAY = 4;
BICst.FUNCTION.LOGIC = 5;
BICst.FUNCTION.OTHER = 6;

6
src/widget/arrangement/arrangement.js

@ -2885,9 +2885,9 @@ BI.extend(BI.Arrangement, {
PORTION: 24,
GRID_HEIGHT: 50,
LAYOUT_TYPE: {
ADAPTIVE: BICst.DASHBOARD_LAYOUT_ADAPT,
FREE: BICst.DASHBOARD_LAYOUT_FREE,
GRID: BICst.DASHBOARD_LAYOUT_GRID
ADAPTIVE: 0,
FREE: 1,
GRID: 2
}
});
$.shortcut('bi.arrangement', BI.Arrangement);

59
src/widget/copy2group/button.add.copy2group.js

@ -1,59 +0,0 @@
/**
* 新建并选中某个分组按钮
*
* Created by GUY on 2015/9/25.
* @class BI.Copy2GroupAddButton
* @extends BI.BasicButton
*/
BI.Copy2GroupAddButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
var conf = BI.Copy2GroupAddButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + ' bi-copy2group-add-button',
shadow: true,
isShadowShowingOnSelected: true,
height: 30
})
},
_init: function () {
BI.Copy2GroupAddButton.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.text = BI.createWidget({
type: "bi.label",
textAlign: "left",
text: BI.i18nText("BI-Create_And_Select") + "\"江苏\"",
height: o.height
})
BI.createWidget({
type: "bi.htape",
element: this,
items: [{
el: {
type: "bi.icon_button",
cls: "move2group-add-font"
},
width: 30
}, {
el: this.text
}]
})
},
setValue: function (v) {
this.text.setValue(BI.i18nText("BI-Create_And_Select") + "\"" + v + "\"");
this.setTitle(BI.i18nText("BI-Create_And_Select") + "\"" + v + "\"", {
container: "body"
});
},
doClick: function () {
BI.Copy2GroupAddButton.superclass.doClick.apply(this, arguments);
if (this.isValid()) {
this.fireEvent(BI.Copy2GroupAddButton.EVENT_CHANGE);
}
}
});
BI.Copy2GroupAddButton.EVENT_CHANGE = "Copy2GroupAddButton.EVENT_CHANGE";
$.shortcut('bi.copy2group_add_button', BI.Copy2GroupAddButton);

153
src/widget/copy2group/combo.copy2group.js

@ -1,153 +0,0 @@
/**
* 复制到分组下拉框
*
* Created by GUY on 2015/9/25.
* @class BI.Copy2GroupCombo
* @extends BI.Widget
*/
BI.Copy2GroupCombo = BI.inherit(BI.Single, {
_defaultConfig: function () {
var conf = BI.Copy2GroupCombo.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-copy2group-combo",
height: 30,
tipType: "warning",
items: []
});
},
_init: function () {
BI.Copy2GroupCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.button",
text: BI.i18nText("BI-Copy_To_Group"),
height: o.height
});
this.tools = BI.createWidget({
type: "bi.copy2group_bar"
});
this.tools.on(BI.Copy2GroupBar.EVENT_START, function () {
self.combo.adjustHeight();
self.searcher.adjustHeight();
});
this.tools.on(BI.Copy2GroupBar.EVENT_EMPTY, function () {
self.combo.adjustHeight();
});
this.tools.on(BI.Copy2GroupBar.EVENT_CLICK_BUTTON, function () {
self.fireEvent(BI.Copy2GroupCombo.EVENT_CLICK_BUTTON);
self.searcher.stopSearch();
});
this.tools.on(BI.Copy2GroupBar.EVENT_CHANGE, function () {
this.setButtonVisible(!self.searcher.hasMatched());
self.combo.adjustHeight();
self.searcher.adjustHeight();
});
this.popup = this._createPopup(this.options.items);
this.searcher = BI.createWidget({
type: "bi.searcher",
el: this.tools,
chooseType: BI.Selection.Multi,
adapter: this.popup
});
this.searcher.on(BI.Searcher.EVENT_CHANGE, function () {
});
this.multipopup = BI.createWidget({
type: "bi.multi_popup_view",
width: 200,
stopPropagation: false,
el: this.popup,
tool: this.searcher
});
this.combo = BI.createWidget({
type: "bi.combo",
isNeedAdjustWidth: false,
element: this,
el: this.trigger,
popup: this.multipopup
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.fireEvent(BI.Copy2GroupCombo.EVENT_BEFORE_POPUPVIEW);
});
this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
self.searcher.stopSearch();
});
this.multipopup.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, function (value) {
switch (value) {
case 0 :
self.fireEvent(BI.Copy2GroupCombo.EVENT_CONFIRM);
self.combo.hideView();
break;
default :
break;
}
});
},
_createItems: function (items) {
return BI.createItems(items, {
type: "bi.multi_select_item",
height: 25,
handler: function (v) {
}
})
},
_createPopup: function (items, opt) {
return BI.createWidget(BI.extend({
type: "bi.button_group",
items: this._createItems(items),
chooseType: 1,
layouts: [{
type: "bi.vertical"
}]
}, opt));
},
scrollToBottom: function () {
var self = this;
BI.delay(function () {
self.popup.element.scrollTop(BI.MAX);
}, 30);
},
populate: function (items) {
this.options.items = items;
this.combo.populate(this._createItems(items));
},
setValue: function (v) {
this.combo.setValue(v);
this.searcher.setValue(v);
},
setEnable: function (enable) {
this.combo.setEnable.apply(this.combo, arguments);
},
getTargetValue: function () {
return this.tools.getValue();
},
getValue: function () {
return this.searcher.getValue();
}
});
BI.Copy2GroupCombo.EVENT_BEFORE_POPUPVIEW = "Copy2GroupCombo.EVENT_BEFORE_POPUPVIEW";
BI.Copy2GroupCombo.EVENT_CHANGE = "Copy2GroupCombo.EVENT_CHANGE";
BI.Copy2GroupCombo.EVENT_CONFIRM = "Copy2GroupCombo.EVENT_CONFIRM";
BI.Copy2GroupCombo.EVENT_CLICK_BUTTON = "Copy2GroupCombo.EVENT_CLICK_BUTTON";
$.shortcut('bi.copy2group_combo', BI.Copy2GroupCombo);

85
src/widget/copy2group/toolbar.copy2group.js

@ -1,85 +0,0 @@
/**
* guy
* 复选导航条
* Created by GUY on 2015/9/25.
* @class BI.Copy2GroupBar
* @extends BI.Widget
*/
BI.Copy2GroupBar = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.Copy2GroupBar.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-copy2group-bar"
})
},
_init: function () {
BI.Copy2GroupBar.superclass._init.apply(this, arguments);
var self = this;
this.search = BI.createWidget({
type: "bi.text_editor",
watermark: BI.i18nText("BI-Search_And_Create_Group"),
allowBlank: true
});
this.search.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.search.on(BI.TextEditor.EVENT_CHANGE, function () {
self.button.setValue(this.getValue());
if(this.getValue() !== "") {
self.fireEvent(BI.Copy2GroupBar.EVENT_CHANGE);
}
});
this.search.on(BI.TextEditor.EVENT_EMPTY, function () {
self.button.invisible();
self.fireEvent(BI.Copy2GroupBar.EVENT_EMPTY);
});
this.search.on(BI.TextEditor.EVENT_START, function () {
self.button.visible();
self.fireEvent(BI.Copy2GroupBar.EVENT_START);
});
this.button = BI.createWidget({
type: "bi.copy2group_add_button"
});
this.button.on(BI.Copy2GroupAddButton.EVENT_CHANGE, function () {
self.fireEvent(BI.Copy2GroupBar.EVENT_CLICK_BUTTON);
});
BI.createWidget({
type: "bi.vertical",
element: this,
vgap: 5,
hgap: 5,
items: [this.search, this.button]
});
this.button.invisible();
},
blur: function(){
this.search.blur();
},
setButtonVisible: function (b) {
this.button.setVisible(b);
},
getValue: function () {
return this.search.getValue();
},
setValue: function (v) {
this.search.setValue(v);
this.button.setValue(v);
}
});
BI.Copy2GroupBar.EVENT_CHANGE = "Copy2GroupBar.EVENT_CHANGE";
BI.Copy2GroupBar.EVENT_START = "Copy2GroupBar.EVENT_START";
BI.Copy2GroupBar.EVENT_EMPTY = "Copy2GroupBar.EVENT_EMPTY";
BI.Copy2GroupBar.EVENT_CLICK_BUTTON = "Copy2GroupBar.EVENT_CLICK_BUTTON";
$.shortcut("bi.copy2group_bar", BI.Copy2GroupBar);

61
src/widget/date/calendar/combo.month.date.js

@ -1,61 +0,0 @@
/**
* 日期控件中的月份下拉框
*
* Created by GUY on 2015/9/7.
* @class BI.MonthDateCombo
* @extends BI.Trigger
*/
BI.MonthDateCombo = BI.inherit(BI.Trigger, {
_defaultConfig: function() {
return BI.extend( BI.MonthDateCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-month-combo",
height: 25
});
},
_init: function() {
BI.MonthDateCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.date_triangle_trigger"
});
this.popup = BI.createWidget({
type: "bi.month_popup"
});
this.popup.on(BI.YearPopup.EVENT_CHANGE, function(){
self.setValue(self.popup.getValue());
})
this.combo = BI.createWidget({
type: "bi.combo",
offsetStyle: "center",
element: this,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
popup: {
minWidth: 85,
stopPropagation: false,
el: this.popup
}
})
this.combo.on(BI.Combo.EVENT_CHANGE, function(){
self.combo.hideView();
self.fireEvent(BI.MonthDateCombo.EVENT_CHANGE);
});
},
setValue: function(v){
this.trigger.setValue(v + 1);
this.popup.setValue(v);
},
getValue: function(){
return this.popup.getValue();
}
});
BI.MonthDateCombo.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.month_date_combo', BI.MonthDateCombo);

66
src/widget/date/calendar/combo.year.date.js

@ -1,66 +0,0 @@
/**
* 年份下拉框
*
* Created by GUY on 2015/9/7.
* @class BI.YearDateCombo
* @extends BI.Trigger
*/
BI.YearDateCombo = BI.inherit(BI.Trigger, {
_defaultConfig: function() {
return BI.extend( BI.YearDateCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-combo",
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
height: 25
});
},
_init: function() {
BI.YearDateCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.date_triangle_trigger"
});
this.popup = BI.createWidget({
type: "bi.year_popup",
min: o.min,
max: o.max
});
this.popup.on(BI.YearPopup.EVENT_CHANGE, function(){
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.YearDateCombo.EVENT_CHANGE);
})
this.combo = BI.createWidget({
type: "bi.combo",
offsetStyle: "center",
element: this,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
popup: {
minWidth: 85,
stopPropagation: false,
el: this.popup
}
})
this.combo.on(BI.Combo.EVENT_CHANGE, function(){
self.fireEvent(BI.YearDateCombo.EVENT_CHANGE);
})
},
setValue: function(v){
this.trigger.setValue(v);
this.popup.setValue(v);
},
getValue: function(){
return this.popup.getValue();
}
});
BI.YearDateCombo.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.year_date_combo', BI.YearDateCombo);

127
src/widget/date/calendar/picker.date.js

@ -1,127 +0,0 @@
/**
* Created by GUY on 2015/9/7.
* @class BI.DatePicker
* @extends BI.Widget
*/
BI.DatePicker = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.DatePicker.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-date-picker",
height: 25,
min: '1900-01-01', //最小日期
max: '2099-12-31' //最大日期
})
},
_init: function () {
BI.DatePicker.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this._year = new Date().getFullYear();
this._month = new Date().getMonth();
this.left = BI.createWidget({
type: "bi.icon_button",
cls: "pre-page-h-font",
width: 25,
height: 25
});
this.left.on(BI.IconButton.EVENT_CHANGE, function () {
if (self._month === 0) {
self.setValue({
year: self.year.getValue() - 1,
month: 11
})
} else {
self.setValue({
year: self.year.getValue(),
month: self.month.getValue() - 1
})
}
self.fireEvent(BI.DatePicker.EVENT_CHANGE);
});
this.right = BI.createWidget({
type: "bi.icon_button",
cls: "next-page-h-font",
width: 25,
height: 25
});
this.right.on(BI.IconButton.EVENT_CHANGE, function () {
if (self._month === 11) {
self.setValue({
year: self.year.getValue() + 1,
month: 0
})
} else {
self.setValue({
year: self.year.getValue(),
month: self.month.getValue() + 1
})
}
self.fireEvent(BI.DatePicker.EVENT_CHANGE);
});
this.year = BI.createWidget({
type: "bi.year_date_combo",
min: o.min,
max: o.max
});
this.year.on(BI.YearDateCombo.EVENT_CHANGE, function () {
self.setValue({
year: self.year.getValue(),
month: self.month.getValue()
});
self.fireEvent(BI.DatePicker.EVENT_CHANGE);
})
this.month = BI.createWidget({
type: "bi.month_date_combo"
});
this.month.on(BI.MonthDateCombo.EVENT_CHANGE, function () {
self.setValue({
year: self.year.getValue(),
month: self.month.getValue()
});
self.fireEvent(BI.DatePicker.EVENT_CHANGE);
});
BI.createWidget({
type: "bi.htape",
element: this,
items: [{
el: this.left,
width: 25
}, {
type: "bi.center_adapt",
items: [{
type: "bi.horizontal",
width: 100,
items: [this.year, this.month]
}]
}, {
el: this.right,
width: 25
}]
})
this.setValue({
year: this._year,
month: this._month
})
},
setValue: function (ob) {
this._year = ob.year;
this._month = ob.month;
this.year.setValue(ob.year);
this.month.setValue(ob.month);
},
getValue: function () {
return {
year: this.year.getValue(),
month: this.month.getValue()
}
}
});
BI.DatePicker.EVENT_CHANGE = "EVENT_CHANGE"
$.shortcut("bi.date_picker", BI.DatePicker);

96
src/widget/date/calendar/popup.calendar.date.js

@ -1,96 +0,0 @@
/**
* Created by GUY on 2015/9/7.
* @class BI.DateCalendarPopup
* @extends BI.Widget
*/
BI.DateCalendarPopup = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.DateCalendarPopup.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-date-calendar-popup",
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
selectedTime: null
})
},
_createNav: function (v) {
var date = BI.Calendar.getDateJSONByPage(v);
var calendar = BI.createWidget({
type: "bi.calendar",
logic: {
dynamic: true
},
min: this.options.min,
max: this.options.max,
year: date.year,
month: date.month,
day: this.selectedTime.day
});
return calendar;
},
_init: function () {
BI.DateCalendarPopup.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.today = new Date();
this._year = this.today.getFullYear();
this._month = this.today.getMonth();
this._day = this.today.getDate();
this.selectedTime = o.selectedTime || {
year: this._year,
month: this._month,
day: this._day
};
this.datePicker = BI.createWidget({
type: "bi.date_picker",
min: o.min,
max: o.max
});
this.calendar = BI.createWidget({
direction: "top",
element: this,
logic: {
dynamic: true
},
type: "bi.navigation",
tab: this.datePicker,
cardCreator: BI.bind(this._createNav, this),
afterCardCreated: function () {
},
afterCardShow: function () {
this.setValue(self.selectedTime);
}
});
this.datePicker.on(BI.DatePicker.EVENT_CHANGE, function () {
self.selectedTime = self.datePicker.getValue();
self.selectedTime.day = 1;
self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime));
});
this.calendar.on(BI.Navigation.EVENT_CHANGE, function () {
self.selectedTime = self.calendar.getValue();
self.setValue(self.selectedTime);
self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE);
});
},
setValue: function (timeOb) {
this.datePicker.setValue(timeOb);
this.calendar.setSelect(BI.Calendar.getPageByDateJSON(timeOb));
this.calendar.setValue(timeOb);
this.selectedTime = timeOb;
},
getValue: function () {
return this.selectedTime;
}
});
BI.DateCalendarPopup.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.date_calendar_popup", BI.DateCalendarPopup);

70
src/widget/date/calendar/trigger.triangle.date.js

@ -1,70 +0,0 @@
/**
* 日期控件中的年份或月份trigger
*
* Created by GUY on 2015/9/7.
* @class BI.DateTriangleTrigger
* @extends BI.Trigger
*/
BI.DateTriangleTrigger = BI.inherit(BI.Trigger, {
_const: {
height: 25,
iconWidth: 16,
iconHeight: 13
},
_defaultConfig: function() {
return BI.extend( BI.DateTriangleTrigger.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-date-triangle-trigger pull-down-ha-font cursor-pointer",
height: 25
});
},
_init: function() {
BI.DateTriangleTrigger.superclass._init.apply(this, arguments);
var o = this.options, c = this._const;
this.text = BI.createWidget({
type: "bi.label",
cls: "list-item-text",
textAlign: "right",
text: o.text,
value: o.value,
height: c.height
})
this.icon = BI.createWidget({
type: "bi.icon",
width: c.iconWidth,
height: c.iconHeight
});
BI.createWidget({
type: "bi.center_adapt",
element: this,
items: [{
type: "bi.center_adapt",
width: 50,
height: c.height,
items: [this.text, this.icon]
}]
})
},
setValue: function(v){
this.text.setValue(v);
},
getValue: function(){
return this.text.getValue();
},
setText: function(v){
this.text.setText(v);
},
getText: function(){
return this.item.getText();
},
getKey: function(){
}
});
$.shortcut('bi.date_triangle_trigger', BI.DateTriangleTrigger);

59
src/widget/date/combo.date.js

@ -1,59 +0,0 @@
/**
* 日期下拉框
*
* Created by GUY on 2015/9/7.
* @class BI.DateCombo
* @extends BI.Widget
*/
BI.DateCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.DateCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-date-combo",
height: 30
});
},
_init: function () {
BI.DateCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.date_trigger"
});
this.trigger.on(BI.DateTrigger.EVENT_TRIGGER_CLICK, function () {
self.combo.toggle();
});
this.popup = BI.createWidget({
type: "bi.date_calendar_popup"
});
this.popup.on(BI.DateCalendarPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
});
this.combo = BI.createWidget({
type: "bi.combo",
toggle: false,
element: this,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
popup: {
width: 270,
el: this.popup,
stopPropagation: false
}
})
},
setValue: function (v) {
this.trigger.setValue(v);
this.popup.setValue(v);
},
getValue: function () {
return this.popup.getValue();
}
});
$.shortcut('bi.date_combo', BI.DateCombo);

269
src/widget/date/trigger.date.js

@ -1,269 +0,0 @@
BI.DateTrigger = BI.inherit(BI.Trigger, {
_const: {
hgap: 4,
vgap: 2,
triggerWidth: 30,
watermark: BI.i18nText("BI-Unrestricted"),
yearLength: 4,
yearMonthLength: 7
},
_defaultConfig: function () {
return BI.extend(BI.DateTrigger.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-date-trigger",
min: '1900-01-01', //最小日期
max: '2099-12-31', //最大日期
height: 25
});
},
_init: function () {
BI.DateTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options, c = this._const;
this.editor = BI.createWidget({
type: "bi.sign_editor",
height: o.height,
validationChecker: function (v) {
var date = v.match(/\d+/g);
self._autoAppend(v, date);
return self._dateCheck(v) && Date.checkLegal(v) && self._checkVoid({
year: date[0],
month: date[1],
day: date[2]
});
},
quitChecker: function () {
return false;
},
hgap: c.hgap,
vgap: c.vgap,
allowBlank: true,
watermark: c.watermark,
errorText: function () {
if (self.editor.isEditing()) {
return BI.i18nText("BI-Date_Trigger_Error_Text");
}
return BI.i18nText("BI-Year_Trigger_Invalid_Text");
}
});
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function () {
self.fireEvent(BI.DateTrigger.EVENT_KEY_DOWN)
});
this.editor.on(BI.SignEditor.EVENT_FOCUS, function () {
self.fireEvent(BI.DateTrigger.EVENT_FOCUS);
});
this.editor.on(BI.SignEditor.EVENT_VALID, function () {
self.fireEvent(BI.DateTrigger.EVENT_VALID);
});
this.editor.on(BI.SignEditor.EVENT_ERROR, function () {
self.fireEvent(BI.DateTrigger.EVENT_ERROR);
});
this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () {
var value = self.editor.getValue();
if (BI.isNotNull(value)) {
self.editor.setState(value);
}
if (BI.isNotEmptyString(value)) {
var date = value.split("-");
self.store_value = {
type: BICst.MULTI_DATE_CALENDAR,
value:{
year: date[0] | 0,
month: date[1] - 1,
day: date[2] | 0
}
};
}
self.fireEvent(BI.DateTrigger.EVENT_CONFIRM);
});
this.editor.on(BI.SignEditor.EVENT_SPACE, function () {
if (self.editor.isValid()) {
self.editor.blur();
}
});
this.editor.on(BI.SignEditor.EVENT_START, function () {
self.fireEvent(BI.DateTrigger.EVENT_START);
});
this.editor.on(BI.SignEditor.EVENT_STOP, function () {
self.fireEvent(BI.DateTrigger.EVENT_STOP);
});
this.editor.on(BI.SignEditor.EVENT_CHANGE, function () {
self.fireEvent(BI.DateTrigger.EVENT_CHANGE);
});
BI.createWidget({
type: "bi.htape",
element: this,
items: [{
el: BI.createWidget(),
width: 30
}, {
el: this.editor
}]
})
},
_dateCheck: function (date) {
return Date.parseDateTime(date, "%Y-%x-%d").print("%Y-%x-%d") == date || Date.parseDateTime(date, "%Y-%X-%d").print("%Y-%X-%d") == date || Date.parseDateTime(date, "%Y-%x-%e").print("%Y-%x-%e") == date || Date.parseDateTime(date, "%Y-%X-%e").print("%Y-%X-%e") == date;
},
_checkVoid: function (obj) {
return !Date.checkVoid(obj.year, obj.month, obj.day, this.options.min, this.options.max)[0];
},
_autoAppend: function (v, dateObj) {
var self = this;
var date = Date.parseDateTime(v, "%Y-%X-%d").print("%Y-%X-%d");
var yearCheck = function (v) {
return Date.parseDateTime(v, "%Y").print("%Y") == v && date >= self.options.min && date <= self.options.max;
};
var monthCheck = function (v) {
return Date.parseDateTime(v, "%Y-%X").print("%Y-%X") == v && date >= self.options.min && date <= self.options.max;
};
if (BI.isNotNull(dateObj) && Date.checkLegal(v)) {
switch (v.length) {
case this._const.yearLength:
if (yearCheck(v)) {
this.editor.setValue(v + "-");
}
break;
case this._const.yearMonthLength:
if (monthCheck(v)) {
this.editor.setValue(v + "-");
}
break;
}
}
},
setValue: function (v) {
var type, value, self = this;
var date = new Date();
this.store_value = v;
if (BI.isNotNull(v)) {
type = v.type || BICst.MULTI_DATE_CALENDAR; value = v.value;
if(BI.isNull(value)){
value = v;
}
}
var _setInnerValue = function (date, text) {
var dateStr = date.print("%Y-%x-%e");
self.editor.setState(dateStr);
self.editor.setValue(dateStr);
self.setTitle(text + ":" + dateStr);
};
switch (type) {
case BICst.MULTI_DATE_YEAR_PREV:
var text = value + BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_YEAR_PREV];
date = new Date((date.getFullYear() - 1 * value), date.getMonth(), date.getDate());
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_YEAR_AFTER:
var text = value + BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_YEAR_AFTER];
date = new Date((date.getFullYear() + 1 * value), date.getMonth(), date.getDate());
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_YEAR_BEGIN:
var text = BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_YEAR_BEGIN];
date = new Date(date.getFullYear(), 0, 1);
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_YEAR_END:
var text = BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_YEAR_END];
date = new Date(date.getFullYear(), 11, 31);
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_QUARTER_PREV:
var text = value + BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_QUARTER_PREV];
date = new Date().getBeforeMulQuarter(value);
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_QUARTER_AFTER:
var text = value + BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_QUARTER_AFTER];
date = new Date().getAfterMulQuarter(value);
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_QUARTER_BEGIN:
var text = BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_QUARTER_BEGIN];
date = new Date().getQuarterStartDate();
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_QUARTER_END:
var text = BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_QUARTER_END];
date = new Date().getQuarterEndDate();
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_MONTH_PREV:
var text = value + BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_MONTH_PREV];
date = new Date().getBeforeMultiMonth(value);
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_MONTH_AFTER:
var text = value + BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_MONTH_AFTER];
date = new Date().getAfterMultiMonth(value);
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_MONTH_BEGIN:
var text = BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_MONTH_BEGIN];
date = new Date(date.getFullYear(), date.getMonth(), 1);
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_MONTH_END:
var text = BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_MONTH_END];
date = new Date(date.getFullYear(), date.getMonth(), (date.getLastDateOfMonth()).getDate());
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_WEEK_PREV:
var text = value + BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_WEEK_PREV];
date = date.getOffsetDate(-7 * value);
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_WEEK_AFTER:
var text = value + BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_WEEK_AFTER];
date = date.getOffsetDate(7 * value);
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_DAY_PREV:
var text = value + BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_DAY_PREV];
date = date.getOffsetDate(-1 * value);
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_DAY_AFTER:
var text = value + BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_DAY_AFTER];
date = date.getOffsetDate(1 * value);
_setInnerValue(date, text);
break;
case BICst.MULTI_DATE_DAY_TODAY:
var text = BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_DAY_TODAY];
date = new Date();
_setInnerValue(date, text);
break;
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
this.editor.setState("");
this.editor.setValue("");
this.setTitle("");
} else {
var dateStr = value.year + "-" + (value.month + 1) + "-" + value.day;
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
this.setTitle(dateStr);
}
break;
}
},
getKey: function () {
return this.editor.getValue();
},
getValue: function () {
return this.store_value;
}
});
BI.DateTrigger.EVENT_FOCUS = "EVENT_FOCUS";
BI.DateTrigger.EVENT_START = "EVENT_START";
BI.DateTrigger.EVENT_STOP = "EVENT_STOP";
BI.DateTrigger.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.DateTrigger.EVENT_CHANGE = "EVENT_CHANGE";
BI.DateTrigger.EVENT_VALID = "EVENT_VALID";
BI.DateTrigger.EVENT_ERROR = "EVENT_ERROR";
BI.DateTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK";
BI.DateTrigger.EVENT_KEY_DOWN = "EVENT_KEY_DOWN";
$.shortcut("bi.date_trigger", BI.DateTrigger);

49
src/widget/filterpane/abstract.item.filter.js

@ -1,49 +0,0 @@
/**
* 过滤条件抽象类
*
* @class BI.AbstractFilterItem
* @extend BI.Widget
*/
BI.AbstractFilterItem = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.AbstractFilterItem.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-filter-item"
})
},
_init: function () {
BI.AbstractFilterItem.superclass._init.apply(this, arguments);
},
isSelectedCondition: function () {
return this.emptyItem && this.emptyItem.isVisible();
},
setSelectedCondition: function (b) {
if (!!b) {
if (!this.emptyItem) {
this.emptyItem = BI.createWidget({
type: "bi.absolute",
height: 40,
cls: "filter-item-empty-item",
items: [{
el: {
type: "bi.center_adapt",
cls: "empty-filter-item-leaf"
}
}],
hgap: 10,
vgap: 5
});
BI.createWidget({
type: "bi.vertical",
element: this,
items: [this.emptyItem],
scrolly: false
});
}
}
this.emptyItem && this.emptyItem.setVisible(b);
}
});

79
src/widget/filterpane/expander.filter.js

@ -1,79 +0,0 @@
/**
* @class BI.FilterExpander
* @extend BI.AbstractFilterItem
* 过滤树的一个expander节点
*/
BI.FilterExpander = BI.inherit(BI.AbstractFilterItem, {
_constant: {
EXPANDER_WIDTH: 20
},
_defaultConfig: function () {
var conf = BI.FilterExpander.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-filter-expander",
el: {},
popup: {}
})
},
_init: function () {
BI.FilterExpander.superclass._init.apply(this, arguments);
this._initExpander();
this._initConditionsView();
BI.createWidget({
type: "bi.horizontal_adapt",
element: this,
items: [this.expander, this.conditionsView]
});
},
_initExpander: function () {
var self = this, o = this.options;
var value = o.value, text = "";
if (value === BICst.FILTER_TYPE.AND) {
text = BI.i18nText("BI-Basic_And");
} else {
text = BI.i18nText("BI-Basic_Or");
}
this.expander = BI.createWidget({
type: "bi.text_button",
cls: "condition-and-or",
text: text,
value: value,
id: o.id,
width: this._constant.EXPANDER_WIDTH,
height: "100%"
});
this.expander.on(BI.Controller.EVENT_CHANGE, function (type) {
arguments[2] = self;
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
},
_initConditionsView: function () {
var self = this, popup = this.options.popup;
this.conditionsView = BI.createWidget(popup);
this.conditionsView.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
},
getValue: function () {
return {
type: this.expander.getValue(),
value: this.conditionsView.getValue(),
id: this.options.id
};
},
setValue: function () {
},
populate: function (items) {
this.conditionsView.populate.apply(this.conditionsView, arguments);
}
});
$.shortcut("bi.filter_expander", BI.FilterExpander);

181
src/widget/filterpane/filter.js

@ -1,181 +0,0 @@
/**
* 过滤
*
* Created by GUY on 2015/11/20.
* @class BI.Filter
* @extend BI.Widget
*/
BI.Filter = BI.inherit(BI.Widget, {
constants: {
FIELD_TYPE_NUMBER: 1,
FIELD_TYPE_STRING: 0,
FIELD_TYPE_DATE: 2
},
_defaultConfig: function () {
return BI.extend(BI.Filter.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-filter",
expander: {},
items: [],
el: {},
itemCreator: BI.empty
})
},
_init: function () {
BI.Filter.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.filter = BI.createWidget(o.el,{
type: "bi.filter_operation",
expander: o.expander,
items: o.items,
element: this
});
this.filter.on(BI.FilterOperation.EVENT_OPERATION, function (type) {
switch (type) {
case BICst.FILTER_OPERATION_CONDITION:
case BICst.FILTER_OPERATION_CONDITION_AND:
self._addAndOrCondition(BICst.FILTER_TYPE.EMPTY_CONDITION);
break;
case BICst.FILTER_OPERATION_CONDITION_OR:
self._addAndOrCondition(BICst.FILTER_TYPE.EMPTY_CONDITION, 1);
break;
case BICst.FILTER_OPERATION_FORMULA:
case BICst.FILTER_OPERATION_FORMULA_AND:
self._addAndOrCondition(BICst.FILTER_TYPE.EMPTY_FORMULA);
break;
case BICst.FILTER_OPERATION_FORMULA_OR:
self._addAndOrCondition(BICst.FILTER_TYPE.EMPTY_FORMULA, 1);
break;
}
});
this.filter.on(BI.FilterOperation.EVENT_DESTROY_ITEM, function (id) {
self._removeCondition(id);
});
this.tree = new BI.Tree();
this.tree.initTree(o.items);
},
_removeCondition: function (id) {
var finded = this.tree.search(id);
if (BI.isNotNull(finded)) {
var parent = finded.getParent();
parent.removeChild(id);
if (parent.getChildrenLength() <= 1) {
var prev = parent.getParent();
if (BI.isNotNull(prev)) {
var index = prev.getChildIndex(parent.id);
prev.removeChildByIndex(index);
if (parent.getChildrenLength() === 1) {
prev.addChild(parent.getFirstChild(), index);
}
}
}
this._populate(this.tree.toJSONWithNode());
this.fireEvent(BI.Filter.EVENT_CHANGE);
}
},
_createEmptyNode: function (type) {
var node = new BI.Node(BI.UUID());
node.set("data", {
value: type
});
return node;
},
_insertAndOrCondition: function (id, formulaOrField, type) {
var ANDOR = ["AND", "OR"];
type || (type = 0);
var finded = this.tree.search(id);
if (BI.isNotNull(finded)) {
var data = finded.get("data");
var parent = finded.getParent();
var index = parent.getChildIndex(finded.id);
var pdata = parent.get("data") || {};
var node = this._createEmptyNode(formulaOrField);
if (data.value === BICst.FILTER_TYPE[ANDOR[type]]) {
this.tree.addNode(finded, node);
return;
}
if (data.value === BICst.FILTER_TYPE[ANDOR[1 - type]]) {
if (pdata.value === BICst.FILTER_TYPE[ANDOR[type]]) {
parent.addChild(node, index + 1);
return;
}
}
if ((data.value === BICst.FILTER_TYPE[ANDOR[1 - type]] && pdata.value !== BICst.FILTER_TYPE[ANDOR[type]])
|| pdata.value === BICst.FILTER_TYPE[ANDOR[1 - type]]
|| (pdata.value !== BICst.FILTER_TYPE.AND && pdata.value !== BICst.FILTER_TYPE.OR)) {
var andor = new BI.Node(BI.UUID());
andor.set("data", {
value: BICst.FILTER_TYPE[ANDOR[type]],
children: [finded.get("data"), node.get("data")]
});
parent.removeChildByIndex(index);
parent.addChild(andor, index);
andor.addChild(finded);
andor.addChild(node);
return;
}
parent.addChild(node, index + 1);
}
},
_addAndOrCondition: function (formulaOrField, type) {
var ANDOR = ["AND", "OR"];
type || (type = 0);
var o = this.options;
var currentSelectItem = this.filter.getCurrentSelectItem();
if (BI.isNotNull(currentSelectItem)) {
var id = currentSelectItem.attr("id");
this._insertAndOrCondition(id, formulaOrField, type);
} else {
var node = this._createEmptyNode(formulaOrField);
var root = this.tree.getRoot();
var child = root.getLastChild();
if (BI.isNotNull(child)) {
var data = child.get("data");
if (data.value === BICst.FILTER_TYPE[ANDOR[type]]) {
this.tree.addNode(child, node);
} else {
var andor = new BI.Node(BI.UUID());
andor.set("data", {
value: BICst.FILTER_TYPE[ANDOR[type]],
children: [child.get("data"), node.get("data")]
});
root.removeChild(child.id);
this.tree.addNode(andor);
this.tree.addNode(andor, child);
this.tree.addNode(andor, node);
}
} else {
this.tree.addNode(node);
}
}
this._populate(this.tree.toJSONWithNode());
this.fireEvent(BI.Filter.EVENT_CHANGE);
},
_populate: function (items) {
var self = this, o = this.options;
o.items = items;
ArrayUtils.traversal(items, function (i, item) {
o.itemCreator(item);
});
this.filter.populate.apply(this.filter, [items]);
},
populate: function (conditions) {
this.tree.initTree(conditions);
this._populate(this.tree.toJSONWithNode());
},
getValue: function () {
return this.filter.getValue();
}
});
BI.Filter.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.filter", BI.Filter);

219
src/widget/filterpane/operation.filter.js

@ -1,219 +0,0 @@
/**
* 过滤条件
*
* Created by GUY on 2015/9/25.
* @class BI.FilterOperation
* @extend BI.Widget
*/
BI.FilterOperation = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.FilterOperation.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-filter-operation",
expander: {},
items: [],
selections: [BICst.FILTER_OPERATION_CONDITION, BICst.FILTER_OPERATION_FORMULA],
itemsCreator: BI.emptyFn
})
},
_defaultState: function () {
if (BI.isNotNull(this.currentSelected)) {
this.currentSelected.setSelectedCondition(false);
}
this.buttonComboTab.setSelect(BI.FilterOperation.OPERATION_ADD_CONDITION);
},
_init: function () {
BI.FilterOperation.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.currentSelected = null;
this.filter = BI.createWidget({
type: "bi.filter_pane",
expander: o.expander,
items: o.items,
itemsCreator: o.itemsCreator
});
this.filter.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) {
if (BI.isNotNull(self.currentSelected) && self.currentSelected === obj) {
obj.setSelectedCondition(!obj.isSelectedCondition());
} else {
if (BI.isNotNull(self.currentSelected)) {
self.currentSelected.setSelectedCondition(false);
}
self.currentSelected = obj;
obj.setSelectedCondition(true);
}
if (self.currentSelected.isSelectedCondition()) {
self.buttonComboTab.setSelect(BI.FilterOperation.OPERATION_ADD_ANDOR_CONDITION);
} else {
self.buttonComboTab.setSelect(BI.FilterOperation.OPERATION_ADD_CONDITION);
}
}
if (type === BI.Events.DESTROY) {
if (self.currentSelected === obj) {
self.currentSelected = null;
self.buttonComboTab.setSelect(BI.FilterOperation.OPERATION_ADD_CONDITION);
}
self.fireEvent(BI.FilterOperation.EVENT_DESTROY_ITEM, value, obj);
}
});
this.filter.on(BI.FilterPane.EVENT_CHANGE, function () {
self.fireEvent(BI.FilterOperation.EVENT_CHANGE, arguments);
});
var operation = this._buildOperationTab();
BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: operation,
height: 40
}, {
el: {
type: "bi.absolute",
scrollable: true,
items: [{
el: {
type: "bi.left",
items: [
this.filter
]
},
top: 0,
right: 2,
bottom: 0,
left: 0
}]
}
}]
})
},
_buildOperationTab: function () {
this.buttonComboTab = BI.createWidget({
type: "bi.tab",
tab: null,
cardCreator: BI.bind(this._createTabs, this)
});
this.buttonComboTab.setSelect(BI.FilterOperation.OPERATION_ADD_CONDITION);
return this.buttonComboTab;
},
_createTabs: function (v) {
var self = this;
switch (v) {
case BI.FilterOperation.OPERATION_ADD_CONDITION:
var btnGroup = BI.createWidget({
type: "bi.button_group",
items: BI.createItems(self._createButtons(), {
type: "bi.button",
forceNotSelected: true,
level: "ignore",
height: 25
}),
chooseType: BI.ButtonGroup.CHOOSE_TYPE_DEFAULT,
layouts: [{
type: "bi.right",
hgap: 10,
vgap: 5
}]
});
btnGroup.on(BI.ButtonGroup.EVENT_CHANGE, function (value, obj) {
self.fireEvent(BI.FilterOperation.EVENT_OPERATION, obj.getValue());
self._defaultState();
});
return btnGroup;
case BI.FilterOperation.OPERATION_ADD_ANDOR_CONDITION:
var btnGroup = BI.createWidget({
type: "bi.button_group",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_DEFAULT,
items: self._createCombos(),
layouts: [{
type: "bi.right",
hgap: 10,
vgap: 5
}]
});
return btnGroup;
}
},
_createButtons: function(){
var buttons = [];
BI.each(this.options.selections, function(i, type){
switch (type){
case BICst.FILTER_OPERATION_FORMULA:
buttons.push({
text: BI.i18nText("BI-Add_Formula"),
value: BICst.FILTER_OPERATION_FORMULA
});
break;
case BICst.FILTER_OPERATION_CONDITION:
buttons.push({
text: BI.i18nText("BI-Add_Condition"),
value: BICst.FILTER_OPERATION_CONDITION
});
break;
}
});
return buttons;
},
_createCombos: function () {
var self = this, combos = [];
BI.each(this.options.selections, function(i, type){
var text = "", items = [];
switch (type) {
case BICst.FILTER_OPERATION_FORMULA:
text = BI.i18nText("BI-Add_Formula");
items = BICst.FILTER_ADD_FORMULA_COMBO;
break;
case BICst.FILTER_OPERATION_CONDITION:
text = BI.i18nText("BI-Add_Condition");
items = BICst.FILTER_ADD_CONDITION_COMBO;
break;
}
var addCombo = BI.createWidget({
type: "bi.static_combo",
text: text,
width: 90,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_NONE,
items: BI.createItems(items, {
type: "bi.single_select_item",
height: 25
})
});
addCombo.on(BI.Combo.EVENT_CHANGE, function (value, obj) {
self.fireEvent(BI.FilterOperation.EVENT_OPERATION, obj.getValue());
self._defaultState();
});
combos.push(addCombo);
});
return combos;
},
getCurrentSelectItem: function () {
if (BI.isNotNull(this.currentSelected) && this.currentSelected.isSelectedCondition()) {
return this.currentSelected;
}
},
populate: function (items) {
this.filter.populate.apply(this.filter, arguments);
},
getValue: function () {
return this.filter.getValue();
}
});
BI.extend(BI.FilterOperation, {
OPERATION_ADD_CONDITION: 0,
OPERATION_ADD_ANDOR_CONDITION: 1
});
BI.FilterOperation.EVENT_OPERATION = "EVENT_OPERATION";
BI.FilterOperation.EVENT_CHANGE = "EVENT_CHANGE";
BI.FilterOperation.EVENT_DESTROY_ITEM = "BI.FilterOperation.EVENT_DESTROY_ITEM";
$.shortcut("bi.filter_operation", BI.FilterOperation);

60
src/widget/filterpane/pane.filter.js

@ -1,60 +0,0 @@
/**
* @class BI.FilterPane
* @extend BI.Widget
* 过滤面板
*/
BI.FilterPane = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.FilterPane.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-filter-pane",
expander: {},
items: [],
itemsCreator: BI.emptyFn
})
},
_init: function () {
BI.FilterPane.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.tree = BI.createWidget({
type: "bi.custom_tree",
element: this,
expander: BI.extend({
type: "bi.filter_expander",
el: {},
popup: {
type: "bi.custom_tree"
}
}, o.expander),
el: {
type: "bi.button_map",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_DEFAULT,
layouts: [{
type: "bi.vertical",
scrolly: false
}]
}
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.FilterPane.EVENT_CHANGE, [].slice.call(arguments, 1));
}
});
if (BI.isNotEmptyArray(o.items)) {
this.populate(o.items);
}
},
populate: function (items) {
this.tree.populate.apply(this.tree, arguments);
},
getValue: function () {
return this.tree.getValue();
}
});
BI.FilterPane.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.filter_pane", BI.FilterPane);

66
src/widget/formula/group.symbol.js

@ -1,66 +0,0 @@
/**
* Created by roy on 15/9/29.
*/
/**
* Created by roy on 15/9/1.
*/
BI.SymbolGroup = BI.inherit(BI.Widget, {
constants: {
hgap: 7.5,
textWidth: 14,
textHeight: 17
},
_defaultConfig: function () {
return BI.extend(BI.SymbolGroup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-formula-symbol-group"
})
},
_init: function () {
BI.SymbolGroup.superclass._init.apply(this, arguments)
var self = this, c = this.constants;
var items = [{
text: "+",
value: "+"
}, {
text: "-",
value: "-"
}, {
text: "*",
value: "*"
}, {
text: "/",
value: "/"
}, {
text: "(",
value: "("
}, {
text: ")",
value: ")"
}];
this.symbolgroup = BI.createWidget({
type: "bi.button_group",
element: self,
chooseType:-1,
items: BI.createItems(items, {
type: "bi.text_button",
forceNotSelected: true,
once: false,
textWidth: c.textWidth,
textHeight: c.textHeight,
cls: "symbol-button"
}),
layouts: [{
type: "bi.left_vertical_adapt",
hgap: c.hgap
}]
});
this.symbolgroup.on(BI.ButtonGroup.EVENT_CHANGE,function(v){
self.fireEvent(BI.SymbolGroup.EVENT_CHANGE,v)
})
}
});
BI.SymbolGroup.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.symbol_group", BI.SymbolGroup);

343
src/widget/formula/insert.formula.js

@ -1,343 +0,0 @@
/**
* Created by roy on 15/9/9.
*/
//0更多函数为展开状态,1为函数框展开,显示返回状态
BI.FormulaInsert = BI.inherit(BI.Widget, {
constants: {
right_set_off: -322,
height: 30,
width: 160,
right: 10,
button_bottom: 5,
pane_bottom: -1,
retract: 1,
more_function: 0,
functionTypes: ["MATH", "DATETIME", "ARRAY", "TEXT", "LOGIC", "OTHER"],
abandonFunctions: ["ACOS", "ACOSH", "ASIN", "ASINH", "ATAN", "ATAN2", "ATANH", "BITNOT", "BITOPERATION", "CHAR", "CLASS", "CODE", "COMBIN", "CORREL", "COS", "COSH", "DATETONUMBER", "DEGREES", "GETKEY", "GETUSERDEPARTMENTS", "GETUSERJOBTITLES", "NVL", "ODD", "PI", "POWER", "PRODUCT", "PROPER", "RADIANS", "REGEXP", "REVERSE", "RemoteIP", "SIN", "SINH", "STARTWITH", "TAN", "TANH", "TESTCONNECTION", "TESTMACANDUUID", "TOBINARY", "TOHEX", "TOOCTAL", "TOIMAGE"]
},
_defaultConfig: function () {
var conf = BI.FormulaInsert.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-formula-insert",
fieldItems: []
})
},
_init: function () {
BI.FormulaInsert.superclass._init.apply(this, arguments);
var self = this, o = this.options, c = this.constants;
self.validation = "valid";
this.formulatree = BI.createWidget({
type: "bi.formula_field_tree",
cls: "bi-formula-field-pane",
items: o.fieldItems
});
this.formulatree.on(BI.FormulaFieldTree.EVENT_CHANGE, function () {
var v = self.formulatree.getValue();
self.formulaedit.insertField(self.fieldValueTextMap[v[0]]);
});
this.symbolgroup = BI.createWidget({
type: "bi.symbol_group",
height: c.height,
cls: "symbol-group-column"
});
this.symbolgroup.on(BI.SymbolGroup.EVENT_CHANGE, function (v) {
self.formulaedit.insertOperator(v);
});
this.formulaedit = BI.createWidget({
type: "bi.formula",
tipType: "warning",
watermark: BI.i18nText("BI-Formula_Water_Mark")
});
this.formulaedit.on(BI.FormulaEditor.EVENT_CHANGE, function () {
if (BI.Func.checkFormulaValidation(self.formulaedit.getCheckString())) {
self.validation = "valid";
BI.Bubbles.hide(self.getName() + "invalid");
} else {
BI.Bubbles.show(self.getName() + "invalid", BI.i18nText("BI-Formula_Valid"), self, {
offsetStyle: "center"
});
self.validation = "invalid"
}
self.fireEvent(BI.FormulaInsert.EVENT_CHANGE);
});
this.formulaedit.on(BI.FormulaEditor.EVENT_BLUR, function () {
BI.Bubbles.hide(self.getName() + "invalid");
if (!self.checkValidation()) {
self.formulaedit.setTitle(BI.i18nText("BI-Formula_Valid"), {belowMouse: true});
}
});
this.formulaedit.on(BI.FormulaEditor.EVENT_FOCUS, function () {
self.formulaedit.setTitle("");
if (!self.checkValidation()) {
BI.Bubbles.show(self.getName() + "invalid", BI.i18nText("BI-Formula_Valid"), self, {offsetStyle: "center"});
}
});
this.editorpane = BI.createWidget({
type: "bi.vtape",
items: [
{
height: "fill",
el: self.formulaedit
}, {
height: c.height,
el: self.symbolgroup
}
]
});
this.functionbutton = BI.createWidget({
type: "bi.text_button",
text: BI.i18nText("BI-Formula_More_Function"),
value: c.more_function,
cls: "more-function-button"
});
this.functionpane = BI.createWidget({
type: "bi.function_pane",
items: self._createFunctionItems(),
});
this.functionCombo = BI.createWidget({
type: "bi.combo",
isNeedAdjustWidth: false,
el: this.functionbutton,
direction: "right,top",
adjustYOffset: -16,
adjustXOffset: 10,
hideChecker: function () {
return false;
},
popup: {
el: self.functionpane,
width: 372
},
width: 65
});
BI.createWidget({
element: this,
type: "bi.htape",
items: [
{
width: c.width,
el: self.formulatree
},
{
el: self.editorpane
}
],
height: o.height,
width: o.width
});
BI.createWidget({
element: this,
type: "bi.absolute",
items: [
{
el: self.functionCombo,
right: c.right,
bottom: c.button_bottom
}
]
});
self.formulaedit.element.droppable({
accept: ".bi-tree-text-leaf-item",
drop: function (event, ui) {
var value = ui.helper.attr("text");
self.formulaedit.insertField(value);
}
});
this.functionCombo.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () {
self.functionbutton.setText(BI.i18nText("BI-Formula_Retract"))
});
this.functionCombo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
self.functionbutton.setText(BI.i18nText("BI-Formula_More_Function"))
});
this.functionpane.on(BI.FunctionPane.EVENT_INSET, function (v) {
if (BI.isNotEmptyString(v)) {
self.formulaedit.insertFunction(v);
}
});
this.populate(o.fieldItems);
},
_isFunction: function (str) {
var self = this, o = this.options, result = false;
BI.each(o.functionItems, function (i, item) {
var text = item.text.toLowerCase();
var lowerString = str.toLowerCase();
if (text === lowerString) {
result = true
}
});
return result;
},
_analyzeContent: function (v) {
var regx = /\$[\{][^\}]*[\}]|\w*\w|\$\{[^\$\(\)\+\-\*\/)\$,]*\w\}|\$\{[^\$\(\)\+\-\*\/]*\w\}|\$\{[^\$\(\)\+\-\*\/]*[\u4e00-\u9fa5]\}|\w|(.)|\n/g;
return v.match(regx);
},
_getFunctionType: function (functionType) {
switch (functionType) {
case "MATH":
return BICst.FUNCTION.MATH;
case "TEXT":
return BICst.FUNCTION.TEXT;
case "DATETIME":
return BICst.FUNCTION.DATE;
case "ARRAY":
return BICst.FUNCTION.ARRAY;
case "LOGIC":
return BICst.FUNCTION.LOGIC;
case "OTHER":
return BICst.FUNCTION.OTHER;
}
},
_createFunctionItems: function () {
var self = this;
var functionObjs = FormulaJSONs;
var functionItems = [];
BI.each(functionObjs, function (i, functionObj) {
if (self.constants.functionTypes.contains(functionObj.type) && !self.constants.abandonFunctions.contains(functionObj.name)) {
var item = {};
item.text = functionObj.name;
item.value = functionObj.name;
item.fieldType = self._getFunctionType(functionObj.type);
item.description = functionObj.def;
item.title = functionObj.def;
functionItems.push(item);
}
});
this.options.functionItems = functionItems;
return functionItems;
},
_createFieldTextValueMap: function (fieldItems) {
var fieldMap = {};
BI.each(fieldItems, function(idx, typeItems){
BI.each(typeItems, function (i, fieldItem) {
fieldMap[fieldItem.text] = fieldItem.value;
});
})
return fieldMap;
},
_createFieldValueTextMap: function (fieldItems) {
var fieldMap = {};
BI.each(fieldItems, function (idx, typeItems) {
BI.each(typeItems, function (i, fieldItem) {
fieldMap[fieldItem.value] = fieldItem.text;
})
});
return fieldMap;
},
_bindDragEvent: function () {
var self = this;
BI.each(self.formulatree.getAllLeaves(), function (i, node) {
node.element.draggable({
cursorAt: {top: 5, left: 5},
helper: function () {
var hint = BI.createWidget({
type: "bi.helper",
value: node.getValue(),
text: self.fieldValueTextMap[node.getValue()]
});
BI.createWidget({
element: self,
type: "bi.default",
items: [hint]
});
hint.element.attr({text: self.fieldValueTextMap[node.getValue()]});
return hint.element;
}
})
});
},
checkValidation: function () {
return this.validation === "valid";
},
refresh: function () {
this.formulaedit.refresh();
},
setValue: function (v) {
var self = this, result;
self.formulaedit.refresh();
self.formulaedit.setValue("");
result = this._analyzeContent(v || "");
BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(fieldRegx);
if (BI.isNotEmptyArray(str)) {
self.formulaedit.insertField(self.fieldValueTextMap[str[0].substring(2, item.length - 1)]);
} else if (self._isFunction(item)) {
self.formulaedit.setFunction(item);
} else {
self.formulaedit.insertString(item);
}
})
},
getFormulaString: function () {
return this.formulaedit.getFormulaString();
},
getUsedFields: function () {
return this.formulaedit.getUsedFields();
},
getValue: function () {
return this.formulaedit.getValue();
},
populate: function (fieldItems) {
this.options.fieldItems = fieldItems;
this.fieldTextValueMap = this._createFieldTextValueMap(fieldItems);
this.fieldValueTextMap = this._createFieldValueTextMap(fieldItems);
this.formulaedit.setFieldTextValueMap(this.fieldTextValueMap);
this.formulatree.populate(fieldItems);
this._bindDragEvent();
}
});
BI.FormulaInsert.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.formula_insert", BI.FormulaInsert);

97
src/widget/formula/item.button.text.treeleaf.js

@ -1,97 +0,0 @@
BI.ButtonTextTreeLeafItem = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.ButtonTextTreeLeafItem.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-button-text-tree-item ",
id: "",
pId: "",
height: 25,
hgap: 0,
lgap: 0,
rgap: 0
})
},
_init: function () {
BI.ButtonTextTreeLeafItem.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.text = BI.createWidget({
type: "bi.label",
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap,
lgap: o.lgap,
rgap: o.hgap,
text: o.text,
value: o.value,
py: o.py
});
this.button = BI.createWidget({
type: "bi.text_button",
height: 25,
stopEvent:true,
value: BI.i18nText("BI-Formula_Insert"),
cls: "formula-function-insert-button"
});
this.button.on(BI.TextButton.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.ADD, self.text.getText());
});
this.button.invisible();
this.leaf = BI.createWidget({
type: "bi.htape",
element: this,
items: [{
el: this.button,
width: 30
}, {
el: this.text
}],
hgap: o.hgap
})
this.element.hover(function () {
self.button.visible();
}, function () {
if (!self.isSelected()) {
self.button.invisible();
}
})
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doHighLight: function () {
this.text.doHighLight.apply(this.text, arguments);
},
unHighLight: function () {
this.text.unHighLight.apply(this.text, arguments);
},
setSelected: function (b) {
BI.ButtonTextTreeLeafItem.superclass.setSelected.apply(this, arguments);
if (BI.isNotNull(b) && b === true) {
this.button.visible();
} else {
this.button.invisible();
}
},
getId: function () {
return this.options.id;
},
getPId: function () {
return this.options.pId;
}
});
$.shortcut("bi.button_text_tree_leaf_item", BI.ButtonTextTreeLeafItem);

175
src/widget/formula/pane.function.js

@ -1,175 +0,0 @@
/**
* Created by roy on 15/9/14.
*/
BI.FunctionPane = BI.inherit(BI.Widget, {
constants: {
search_height: 20,
height: 200,
width: 370,
column_size_editor: 170,
column_size_right: 200,
row_size: 30,
hgap: 10,
vgap: 10,
hgap_offset: 5
},
_defaultConfig: function () {
var conf = BI.FunctionPane.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: "bi-formula-function-pane",
width: 320,
height: 200,
items: []
})
},
_init: function () {
BI.FunctionPane.superclass._init.apply(this, arguments);
var self = this, o = this.options, c = this.constants;
this.desLabel = BI.createWidget({
type: "bi.label",
textAlign: "left",
whiteSpace: "normal",
textWidth: 180
});
this.searchFunctionTree = BI.createWidget({
type: "bi.function_tree",
cls: "style-top",
redmark: function (val, ob) {
return true
}
});
this.functiontree = BI.createWidget({
type: "bi.function_tree",
cls: "style-top",
items: o.items
});
this.searcher = BI.createWidget({
type: "bi.searcher",
adapter: this.functiontree,
isAutoSearch: false,
onSearch: function (op, populate) {
var keyword = op.keyword.toLowerCase();
var resultArray = [];
BI.each(o.items, function (i, item) {
if (item.value.toLowerCase().indexOf(keyword) > -1 && !BI.isEmptyString(keyword)) {
resultArray.push(item);
}
});
populate(resultArray, keyword);
},
el: {
type: "bi.small_search_editor"
},
popup: {
type: "bi.function_searcher_pane",
searcher: self.searchFunctionTree
},
height: 25,
width: 160
});
this.functionLabel = BI.createWidget({
type: "bi.label"
});
BI.createWidget({
element: this,
type: "bi.window",
width: c.width,
cls: "style-out",
columns: 2,
rows: 2,
columnSize: [c.column_size_editor, c.column_size_right],
rowSize: [c.row_size, 'fill'],
items: [
[
{
el: {
type: "bi.center_adapt",
hgap: c.hgap_offset,
items: [
{
el: self.searcher
}
]
}
},
{
el: {
type: "bi.center_adapt",
cls: "style-left",
items: [
{
type: "bi.left",
hgap: c.hgap,
items: [
{
el: self.functionLabel
}
]
}
]
}
}
], [
{
el: self.functiontree
},
{
el: {
type: "bi.absolute",
cls: "style-inner",
items: [
{
el: self.desLabel,
left: c.hgap,
right: c.hgap,
top: c.hgap,
bottom: c.hgap
}
]
}
}
]
]
});
self.functiontree.on(BI.FunctionTree.FUNCTION_INSERT, function (value) {
self.fireEvent(BI.FunctionPane.EVENT_INSET, value)
});
self.functiontree.on(BI.FunctionTree.EVENT_DESCRIPTION_CHANGE, function (v) {
self.desLabel.setText(v);
});
self.functiontree.on(BI.FunctionTree.EVENT_CHANGE, function (v) {
self.functionLabel.setText(v);
});
self.searchFunctionTree.on(BI.FunctionTree.FUNCTION_INSERT, function (value) {
self.fireEvent(BI.FunctionPane.EVENT_INSET, value)
});
self.searchFunctionTree.on(BI.FunctionTree.EVENT_DESCRIPTION_CHANGE, function (v) {
self.desLabel.setText(v);
});
self.searchFunctionTree.on(BI.FunctionTree.EVENT_CHANGE, function (v) {
self.functionLabel.setText(v);
});
}
});
BI.FunctionPane.EVENT_INSET = "EVENT_INSET";
$.shortcut("bi.function_pane", BI.FunctionPane);

26
src/widget/formula/pane.searcher.function.js

@ -1,26 +0,0 @@
/**
* Created by roy on 16/1/21.
*/
BI.FunctionSearcherPane = BI.inherit(BI.SearcherView, {
_defaultConfig: function () {
var conf = BI.FunctionSearcherPane.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-function-searcher-pane"
})
},
_init: function () {
BI.FunctionSearcherPane.superclass._init.apply(this, arguments);
},
populate: function (searchResult, keyword) {
searchResult || (searchResult = []);
this.spliter.setVisible(false);
this.searcher.populate(searchResult, keyword);
this.searcher.expandAll();
this.searcher.doBehavior(keyword);
},
});
$.shortcut("bi.function_searcher_pane", BI.FunctionSearcherPane);

110
src/widget/formula/tree.fieldname.js

@ -1,110 +0,0 @@
BI.FormulaFieldTree = BI.inherit(BI.Widget, {
_const: {
leafGap: 40
},
_defaultConfig: function () {
return BI.extend(BI.FormulaFieldTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-formula-field-tree",
chooseType: 0,
items: []
});
},
_init: function () {
BI.FormulaFieldTree.superclass._init.apply(this, arguments);
this.populate(this.options.items);
},
_getFieldNum: function (map, fieldtype) {
if (BI.isNotNull(map[fieldtype])) {
return map[fieldtype].length
} else {
return 0
}
},
populate: function (items) {
var o = this.options, c = this._const, self = this;
this.empty();
var map = {};
BI.each(items, function (i, typeItem) {
BI.each(typeItem, function (i, item) {
if (!map[item.fieldType]) {
map[item.fieldType] = [];
}
map[item.fieldType].push(item);
})
});
var nodes = [{
id: BICst.COLUMN.NUMBER,
type: "bi.triangle_group_node",
text: BI.i18nText("BI-Formula_Numberic_Field") + "(" + self._getFieldNum(map,BICst.COLUMN.NUMBER) + ")",
value: BICst.COLUMN.NUMBER,
isParent: true,
open: items.length === 1
}];
if(items.length > 1){
nodes.push({
id: BICst.COLUMN.STRING,
type: "bi.triangle_group_node",
text: BI.i18nText("BI-Formula_Text_Field") + "(" + self._getFieldNum(map, BICst.COLUMN.STRING) + ")",
value: BICst.COLUMN.STRING,
isParent: true,
open: false
});
}
if(items.length > 2){
nodes.push({
id: BICst.COLUMN.DATE,
type: "bi.triangle_group_node",
text: BI.i18nText("BI-Formula_Time_Field") + "(" + self._getFieldNum(map, BICst.COLUMN.DATE) + ")",
value: BICst.COLUMN.DATE,
isParent: true,
open: false
});
}
BI.each(items, function(idx, typeItems){
BI.each(typeItems, function (i, item) {
nodes.push(BI.extend({
id: BI.UUID(),
pId: item.fieldType
}, item, {
type: "bi.tree_text_leaf_item",
cls: "tree-text-leaf-item-draggable",
textAlign: "left",
lgap: c.leafGap
}))
});
});
this.fieldtree = BI.createWidget({
type: "bi.level_tree",
element: this,
chooseType: o.chooseType,
expander: {
isDefaultInit: true
},
items: nodes
});
this.fieldtree.on(BI.LevelTree.EVENT_CHANGE, function () {
self.fireEvent(BI.FormulaFieldTree.EVENT_CHANGE);
self.fieldtree.setValue();
})
},
getValue: function () {
return this.fieldtree.getValue();
},
setValue: function (v) {
this.fieldtree.setValue(v);
},
getAllLeaves: function () {
return this.fieldtree.getAllLeaves()
}
});
BI.FormulaFieldTree.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.formula_field_tree", BI.FormulaFieldTree);

170
src/widget/formula/tree.function.js

@ -1,170 +0,0 @@
/**
* Created by roy on 15/9/14.
*/
BI.FunctionTree = BI.inherit(BI.Widget, {
_const: {
leafGap: 10,
nodeTypes: [BICst.FUNCTION.MATH, BICst.FUNCTION.ARRAY, BICst.FUNCTION.DATE, BICst.FUNCTION.LOGIC, BICst.FUNCTION.OTHER, BICst.FUNCTION.TEXT]
},
_defaultConfig: function () {
return BI.extend(BI.FunctionTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-formula-function-tree",
chooseType: 0,
items: [],
redmark: BI.emptyFn
});
},
_init: function () {
BI.FunctionTree.superclass._init.apply(this, arguments);
this.populate(this.options.items);
},
_getFieldNum: function (map, fieldtype) {
if (BI.isNotNull(map[fieldtype])) {
return map[fieldtype].length
} else {
return 0
}
},
populate: function (items) {
var o = this.options, c = this._const, self = this;
this.empty();
var map = {};
o.items = items;
BI.each(items, function (i, item) {
if (!map[item.fieldType]) {
map[item.fieldType] = [];
}
map[item.fieldType].push(item);
});
this.nodes = [
{
id: BICst.FUNCTION.MATH,
type: "bi.triangle_group_node",
text: BI.i18nText("BI-Formula_Numberic_Function") + "(" + self._getFieldNum(map, BICst.FUNCTION.MATH) + ")",
value: BICst.FUNCTION.MATH,
isParent: true,
open: false
}, {
id: BICst.FUNCTION.TEXT,
type: "bi.triangle_group_node",
text: BI.i18nText("BI-Formula_Text_Function") + "(" + self._getFieldNum(map, BICst.FUNCTION.TEXT) + ")",
value: BICst.FUNCTION.TEXT,
isParent: true,
open: false
}, {
id: BICst.FUNCTION.DATE,
type: "bi.triangle_group_node",
text: BI.i18nText("BI-Formula_Time_Function") + "(" + self._getFieldNum(map, BICst.FUNCTION.DATE) + ")",
value: BICst.FUNCTION.DATE,
isParent: true,
open: false
}, {
id: BICst.FUNCTION.ARRAY,
type: "bi.triangle_group_node",
text: BI.i18nText("BI-Formula_Array_Function") + "(" + self._getFieldNum(map, BICst.FUNCTION.ARRAY) + ")",
value: BICst.FUNCTION.ARRAY,
isParent: true,
open: false
}, {
id: BICst.FUNCTION.LOGIC,
type: "bi.triangle_group_node",
text: BI.i18nText("BI-Formula_Logic_Function") + "(" + self._getFieldNum(map, BICst.FUNCTION.LOGIC) + ")",
value: BICst.FUNCTION.LOGIC,
isParent: true,
open: false
}, {
id: BICst.FUNCTION.OTHER,
type: "bi.triangle_group_node",
text: BI.i18nText("BI-Formula_Other_Function") + "(" + self._getFieldNum(map, BICst.FUNCTION.OTHER) + ")",
value: BICst.FUNCTION.OTHER,
isParent: true,
open: false
}
];
BI.each(items, function (i, item) {
self.nodes.push(BI.extend({
id: BI.UUID(),
pId: item.fieldType
}, item, {
type: "bi.button_text_tree_leaf_item",
textAlign: "left",
lgap: c.leafGap
}))
});
this.fieldtree = BI.createWidget({
type: "bi.level_tree",
element: this,
items: self.nodes,
el: {
behaviors: {
"redmark": o.redmark
}
}
});
this.fieldtree.on(BI.Controller.EVENT_CHANGE, function (type, value) {
if (type === BI.Events.ADD) {
self.fireEvent(BI.FunctionTree.FUNCTION_INSERT, value);
}
});
this.fieldtree.on(BI.LevelTree.EVENT_CHANGE, function () {
self.fireEvent(BI.FunctionTree.EVENT_CHANGE, self.getValue());
self.fireEvent(BI.FunctionTree.EVENT_DESCRIPTION_CHANGE, self._getDescription(self.getValue(), o.items))
self.fieldtree.setValue(self.getValue());
})
},
getValue: function () {
return this.fieldtree.getValue();
},
setValue: function (v) {
this.fieldtree.setValue(v);
},
doBehavior: function () {
this.fieldtree.doBehavior.apply(this.fieldtree, arguments)
},
getNodeByValue: function (v) {
return this.fieldtree.getNodeByValue(v)
},
setTriggerExpand: function (v) {
var node = this.fieldtree.getNodeById(v);
node.showView();
},
setTriggerCollapse: function (v) {
var node = this.fieldtree.getNodeById(v);
node.hideView();
},
expandAll: function () {
var self = this;
BI.each(self._const.nodeTypes, function (i, id) {
self.setTriggerExpand(id);
})
},
_getDescription: function (v, items) {
var description = "";
BI.each(items, function (i, item) {
if (item.value === v[0]) {
description = item.description;
}
});
return description
},
getAllLeaves: function () {
return this.fieldtree.getAllLeaves()
}
});
BI.FunctionTree.EVENT_CHANGE = "EVENT_CHANGE";
BI.FunctionTree.EVENT_DESCRIPTION_CHANGE = "EVENT_DESCRIPTION_CHANGE";
BI.FunctionTree.FUNCTION_INSERT = "FUNCTION_INSERT";
$.shortcut("bi.function_tree", BI.FunctionTree);

77
src/widget/image/button/href/image.button.href.js

@ -1,77 +0,0 @@
/**
* Created by GameJian on 2016/1/28.
*/
BI.ImageButtonHref = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.ImageButtonHref.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-image-button-href",
title: BI.i18nText("BI-Add_Href")
})
},
_init: function () {
BI.ImageButtonHref.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.icon_button",
cls: "img-href-font",
title: o.title,
height: 24,
width: 24
});
this.input = BI.createWidget({
type: "bi.clear_editor",
watermark: BI.i18nText("BI-Input_Href"),
width: 255,
height: 30
});
this.input.on(BI.ClearEditor.EVENT_CONFIRM, function () {
self.combo.hideView();
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
direction: "bottom,left",
adjustYOffset: 3,
el: this.trigger,
popup: {
el: this.input,
stopPropagation: false,
minWidth: 255
}
});
this.combo.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () {
self.input.focus()
});
this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () {
self.fireEvent(BI.ImageButtonHref.EVENT_CHANGE, arguments)
})
},
isSelected: function(){
return this.combo.isViewVisible();
},
showView: function(){
this.combo.showView();
},
hideView: function () {
this.combo.hideView();
},
getValue: function () {
return this.input.getValue();
},
setValue: function (url) {
this.input.setValue(url)
}
});
BI.ImageButtonHref.EVENT_CHANGE = "BI.ImageButtonHref.EVENT_CHANGE";
$.shortcut("bi.image_button_href", BI.ImageButtonHref);

55
src/widget/image/button/size/image.button.size.combo.js

@ -1,55 +0,0 @@
/**
* 图片尺寸控件
* Created by GameJian on 2016/1/28.
*/
BI.ImageButtonSizeCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.ImageButtonSizeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-image-button-size-combo",
title: BI.i18nText("BI-Image_Size")
})
},
_init: function () {
BI.ImageButtonSizeCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.icon_button",
cls: "img-size-font",
title: o.title,
width: 24,
height: 24
});
this.sizeChooser = BI.createWidget({
type: "bi.image_button_size"
});
this.sizeChooser.on(BI.ImageButtonSize.EVENT_CHANGE, function(){
self.fireEvent(BI.ImageButtonSizeCombo.EVENT_CHANGE,arguments)
});
this.combo = BI.createWidget({
type: "bi.combo",
element: this,
isNeedAdjustWidth: false,
direction: "top",
adjustYOffset: 3,
offsetStyle: "right",
el: this.trigger,
popup: {
el: this.sizeChooser,
stopPropagation: false
}
});
},
setValue: function (v) {
this.sizeChooser.setValue(v);
},
getValue: function () {
return this.sizeChooser.getValue();
}
});
BI.ImageButtonSizeCombo.EVENT_CHANGE = "ImageButtonSizeCombo.EVENT_CHANGE";
$.shortcut("bi.image_button_size_combo", BI.ImageButtonSizeCombo);

71
src/widget/image/button/size/image.button.size.js

@ -1,71 +0,0 @@
/**
* 单选框
* Created by GameJian on 2016/1/28.
*/
BI.ImageButtonSize = BI.inherit(BI.Widget, {
_defaultConfig: function(){
return BI.extend(BI.ImageButtonSize.superclass._defaultConfig.apply(this, arguments),{
baseCls: "bi-image-button-size",
width: 230,
height: 30
})
},
_init:function() {
BI.ImageButtonSize.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.sizeChooser = BI.createWidget({
type: "bi.button_group",
scrollable: false,
items: BI.createItems([{
text: BI.i18nText("BI-Original_Size"),
cls: "image-button-size-button-group",
width: 55,
selected: true,
value: BICst.IMAGE_RESIZE_MODE.ORIGINAL
},{
text: BI.i18nText("BI-Equal_Size_Adapt"),
cls: "image-button-size-button-group",
width: 67,
value: BICst.IMAGE_RESIZE_MODE.EQUAL
},{
text: BI.i18nText("BI-Widget_Size_Adapt"),
cls: "image-button-size-button-group",
width: 67,
value: BICst.IMAGE_RESIZE_MODE.STRETCH
}],{
type: "bi.image_button_size_radio"
}),
layouts: [{
type: "bi.left",
hgap: 5
}]
});
this.sizeChooser.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.sizeChooser.on(BI.ButtonGroup.EVENT_CHANGE, function () {
self.fireEvent(BI.ImageButtonSize.EVENT_CHANGE, arguments);
});
BI.createWidget({
type: "bi.left",
element: this,
items: [this.sizeChooser],
hgap: 5
});
this.getValue()
},
getValue: function () {
return this.sizeChooser.getValue()[0]
},
setValue: function (v) {
this.sizeChooser.setValue(v)
}
});
BI.ImageButtonSize.EVENT_CHANGE = "BI.ImageButtonSize.EVENT_CHANGE";
$.shortcut("bi.image_button_size" , BI.ImageButtonSize);

66
src/widget/image/button/size/radio/image.button.size.radio.js

@ -1,66 +0,0 @@
/**
* 单选框
* Created by GameJian on 2016/1/28.
*/
BI.ImageButtonSizeRadio = BI.inherit(BI.BasicButton, {
_defaultConfig: function(){
return BI.extend(BI.ImageButtonSizeRadio.superclass._defaultConfig.apply(this, arguments),{
width: 65,
height: 30,
text: "",
selected: false
})
},
_init:function() {
BI.ImageButtonSizeRadio.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.radio = BI.createWidget({
type: "bi.radio",
selected: o.selected
});
this.label = BI.createWidget({
type: "bi.label",
textAlign: "left",
lgap: 5,
rgap: 0,
textHeight: o.height,
height: o.height,
text: o.text
});
this.radio.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(!self.isSelected());
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
BI.createWidget({
element: this,
type: "bi.absolute",
items: [{
el: this.radio,
left: 0,
top: 8.5
},{
el: this.label,
left: 13
}]
});
},
doClick: function () {
BI.ImageButtonSizeRadio.superclass.doClick.apply(this, arguments);
this.radio.setSelected(this.isSelected());
},
setSelected: function (v) {
BI.ImageButtonSizeRadio.superclass.setSelected.apply(this, arguments);
this.radio.setSelected(v);
}
});
$.shortcut("bi.image_button_size_radio" , BI.ImageButtonSizeRadio);

277
src/widget/image/uploadimage.js

@ -1,277 +0,0 @@
/**
* 图片组件
* Created by GameJian on 2016/1/26.
*/
BI.UploadImage = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.UploadImage.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-upload-image"
})
},
_init: function () {
BI.UploadImage.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.label = BI.createWidget({
type: "bi.text_button",
trigger: "dblclick",
cls: "upload-image-text-button-label",
whiteSpace: "normal",
text: BI.i18nText("BI-DoubleClick_To_Upload_Image")
});
this.file = BI.createWidget({
type: "bi.multifile_editor",
accept: "*.jpg;*.png;*.gif;*.bmp;*.jpeg;",
maxSize: 1024 * 1024 * 100,
title: BI.i18nText("BI-Upload_Image")
});
this.img = BI.createWidget({
type: "bi.image_button",
invalid: true,
width: "100%",
height: "100%"
});
this.label.on(BI.TextButton.EVENT_CHANGE, function () {
if (self.isValid()) {
self.file.select();
}
});
this.file.on(BI.MultifileEditor.EVENT_CHANGE, function (data) {
this.upload();
});
//直接把图片保存到resource目录下面
this.file.on(BI.MultifileEditor.EVENT_UPLOADED, function () {
var files = this.getValue();
var file = files[files.length - 1];
var attachId = file.attach_id, fileName = file.filename;
var imageId = attachId + "_" + fileName;
BI.requestAsync("fr_bi_base", "save_upload_image", {
attach_id: attachId
}, function (res) {
self.img.setValue(imageId);
self.img.setSrc(BI.UploadImage.getImageSrc(imageId));
self._check();
self._setSize("auto", "auto");
self.fireEvent(BI.UploadImage.EVENT_CHANGE, imageId);
})
});
this.uploadWrapper = BI.createWidget({
type: "bi.absolute",
items: [{
el: {
type: "bi.icon_button",
cls: "upload-image-icon-button img-upload-font",
width: 24,
height: 24
},
top: 0,
right: 0,
bottom: 0,
left: 0
}, {
el: this.file,
top: 0,
right: 0,
bottom: 0,
left: 0
}],
width: 24,
height: 24
});
this.del = BI.createWidget({
type: "bi.bubble_combo",
el: {
type: "bi.icon_button",
cls: "upload-image-icon-button img-shutdown-font",
title: BI.i18nText("BI-Basic_Delete"),
height: 24,
width: 24
},
popup: {
type: "bi.bubble_bar_popup_view",
buttons: [{
value: BI.i18nText(BI.i18nText("BI-Basic_Sure")),
handler: function () {
self.fireEvent(BI.UploadImage.EVENT_DESTROY);
}
}, {
value: BI.i18nText("BI-Basic_Cancel"),
level: "ignore",
handler: function () {
self.del.hideView();
}
}],
el: {
type: "bi.vertical_adapt",
items: [{
type: "bi.label",
text: BI.i18nText("BI-Sure_Delete_Current_Component"),
cls: "upload-image-delete-label",
textAlign: "left",
width: 300
}],
width: 300,
height: 100,
hgap: 20
},
maxHeight: 140,
minWidth: 340
},
invisible: true,
stopPropagation: true
});
this.size = BI.createWidget({
type: "bi.image_button_size_combo",
cls: "upload-image-icon-button"
});
this.size.on(BI.ImageButtonSizeCombo.EVENT_CHANGE, function () {
self._sizeChange(self.size.getValue());
self.fireEvent(BI.UploadImage.EVENT_CHANGE, arguments)
});
this.href = BI.createWidget({
type: "bi.image_button_href",
cls: "upload-image-icon-button"
});
this.href.on(BI.ImageButtonHref.EVENT_CHANGE, function () {
if (BI.isNotEmptyString(self.href.getValue())) {
self.img.setValid(true)
} else {
self.img.setValid(false)
}
self.fireEvent(BI.UploadImage.EVENT_CHANGE, arguments)
});
this.img.on(BI.ImageButton.EVENT_CHANGE, function () {
window.open(BI.Func.formatAddress(self.href.getValue()));
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.absolute",
scrollable: false,
items: [{
el: this.img
}]
},
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: this.label,
left: 10,
right: 10,
top: 10,
bottom: 10
}, {
el: this.del,
right: 4,
top: 8
}, {
el: this.href,
right: 36,
top: 8
}, {
el: this.size,
right: 68,
top: 8
}, {
el: this.uploadWrapper,
right: 100,
top: 8
}]
});
this.setToolbarVisible(false);
this.img.invisible();
},
_check: function () {
var f = BI.isNotEmptyString(this.img.getValue());
this.label.setVisible(!f);
this.img.visible(f);
},
_setSize: function (w, h) {
this.img.setImageWidth(w);
this.img.setImageHeight(h)
},
_sizeChange: function (size) {
var self = this, o = this.options;
switch (size) {
case BICst.IMAGE_RESIZE_MODE.ORIGINAL:
self._setSize("auto", "auto");
break;
case BICst.IMAGE_RESIZE_MODE.EQUAL:
self._setSize("auto", "auto");
var width = this.img.getImageWidth(), height = this.img.getImageHeight();
var W = this.element.width(), H = this.element.height();
if (W / H > width / height) {
self._setSize("auto", "100%");
} else {
self._setSize("100%", "auto");
}
break;
case BICst.IMAGE_RESIZE_MODE.STRETCH:
self._setSize("100%", "100%");
break;
default :
self._setSize("auto", "auto");
}
},
setToolbarVisible: function (v) {
this.uploadWrapper.setVisible(v);
this.size.setVisible(v);
this.href.setVisible(v);
this.del.setVisible(v);
},
getValue: function () {
return {href: this.href.getValue(), size: this.size.getValue(), src: this.img.getValue()}
},
setValue: function (v) {
var self = this;
v || (v = {});
if (BI.isNotEmptyString(v.href)) {
self.img.setValid(true)
}
this.href.setValue(v.href);
this.size.setValue(v.size);
this.img.setValue(v.src);
if (BI.isNotEmptyString(v.src)) {
this.img.setSrc(BI.UploadImage.getImageSrc(v.src));
}
this._check();
this._sizeChange(v.size)
},
resize: function () {
this._sizeChange(this.size.getValue());
}
});
BI.extend(BI.UploadImage, {
getImageSrc: function (src) {
return BI.servletURL + "?op=fr_bi&cmd=get_uploaded_image&image_id=" + src;
}
});
BI.UploadImage.EVENT_DESTROY = "EVENT_DESTROY";
BI.UploadImage.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.upload_image", BI.UploadImage);

136
src/widget/listlabel/group.item.listlabel.js

@ -1,136 +0,0 @@
/**
* Created by fay on 2016/9/14.
*/
BI.ListLabelItemGroup = BI.inherit(BI.ButtonGroup, {
_defaultConfig: function () {
return BI.extend(BI.ListLabelItemGroup.superclass._defaultConfig.apply(this, arguments), {
chooseType: BI.Selection.Multi
});
},
_init: function () {
BI.ListLabelItemGroup.superclass._init.apply(this, arguments);
this.otherValues = [];
if (BI.isEmptyArray(this.getValue())) {
BI.each(this.buttons, function (idx, button) {
if (button.getValue() === BICst.LIST_LABEL_TYPE.ALL) {
button.setSelected(true);
}
});
}
this._checkBtnStyle();
},
_createBtns: function (items) {
var o = this.options;
return BI.createWidgets(BI.createItems(items, {
type: "bi.text_button",
cls: "list-label-button"
}));
},
_btnsCreator: function (items) {
var self = this, args = Array.prototype.slice.call(arguments), o = this.options;
var buttons = this._createBtns(items);
args[0] = buttons;
BI.each(this.behaviors, function (i, behavior) {
behavior.doBehavior.apply(behavior, args);
});
BI.each(buttons, function (i, btn) {
btn.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (type === BI.Events.CLICK) {
switch (o.chooseType) {
case BI.ButtonGroup.CHOOSE_TYPE_MULTI:
if (btn.getValue() === BICst.LIST_LABEL_TYPE.ALL) {
self.setValue([BICst.LIST_LABEL_TYPE.ALL]);
} else {
self._checkBtnState();
}
self._checkBtnStyle();
break;
case BI.ButtonGroup.CHOOSE_TYPE_SINGLE:
self.setValue(btn.getValue());
break;
case BI.ButtonGroup.CHOOSE_TYPE_NONE:
self.setValue([]);
break;
}
self.fireEvent(BI.ButtonGroup.EVENT_CHANGE, value, obj);
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
btn.on(BI.Events.DESTROY, function () {
BI.remove(self.buttons, btn);
});
});
return buttons;
},
_checkBtnState: function () {
if (BI.isEmptyArray(this.getValue()) && BI.isEmptyArray(this.otherValues)) {
this.buttons[0].setSelected(true);
this.fireEvent(BI.ButtonGroup.EVENT_CHANGE, this.buttons[0].getValue(), this.buttons[0]);
} else if (this.getValue().length === 1 && BI.isEqual(this.getValue()[0], BICst.LIST_LABEL_TYPE.ALL)) {
this.buttons[0].setSelected(true);
}
else {
this.buttons[0].setSelected(false);
}
},
_checkBtnStyle: function () {
BI.each(this.buttons, function (idx, btn) {
if (btn.isSelected()) {
btn.doHighLight();
} else {
btn.unHighLight();
}
});
},
removeAllItems: function () {
var indexes = [];
for (var i = 1; i < this.buttons.length; i++) {
indexes.push(i);
}
this.removeItemAt(indexes);
},
setValue: function (v) {
var self = this;
v = BI.isArray(v) ? v : [v];
BI.each(this.buttons, function (i, item) {
if (BI.deepContains(v, item.getValue())) {
item.setSelected && item.setSelected(true);
} else {
item.setSelected && item.setSelected(false);
}
});
var currentValues = this.getValue();
this.otherValues = [];
BI.each(v, function (idx, value) {
if (currentValues.indexOf(value) === -1) {
self.otherValues.push(value);
}
});
this._checkBtnState();
this._checkBtnStyle();
},
getValue: function () {
var v = [];
BI.each(this.buttons, function (i, item) {
if (item.isEnabled() && item.isSelected && item.isSelected()) {
v.push(item.getValue());
}
});
v = v.concat(this.otherValues || []);
return v;
}
});
$.shortcut('bi.list_label_item_group', BI.ListLabelItemGroup);

160
src/widget/listlabel/listlabel.js

@ -1,160 +0,0 @@
/**
* 文本标签
*
* Created by fay on 2016/9/11.
*/
BI.ListLabel = BI.inherit(BI.Widget, {
_constant: {
MAX_COLUMN_SIZE: 40,
DEFAULT_LABEL_GAP: 15,
DEFAULT_RIGHT_GAP: 10
},
_defaultConfig: function () {
return BI.extend(BI.ListLabel.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-list-label",
title: BI.i18nText("BI-List_Label_Con"),
showTitle: true,
items: [],
height: 40
})
},
_init: function () {
BI.ListLabel.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.items = BI.clone(o.items);
this.items.unshift({
text: BI.i18nText("BI-Basic_Nolimited"),
value: BICst.LIST_LABEL_TYPE.ALL
});
this.title = BI.createWidget({
type: "bi.label",
text: o.title + BI.i18nText("BI-Basic_Colon"),
title: o.title,
height: o.height
});
this.container = BI.createWidget({
type: "bi.list_label_item_group",
items: BI.createItems(this.items.slice(0, this._constant.MAX_COLUMN_SIZE), {
type: "bi.text_button",
height: o.height,
rgap: this._constant.DEFAULT_RIGHT_GAP
}),
layouts: [{
type: "bi.inline_vertical_adapt",
rgap: this._constant.DEFAULT_LABEL_GAP,
height: o.height
}]
});
this.container.on(BI.ButtonGroup.EVENT_CHANGE, function (value) {
self.fireEvent(BI.ListLabel.EVENT_CHANGE, value);
});
this.minTip = BI.createWidget({
type: "bi.label",
text: BI.i18nText("BI-No_Selected_Value"),
disabled: true,
height: o.height
});
this.maxTip = BI.createWidget({
type: "bi.label",
text: BI.i18nText("BI-Max_Show_40_Labels"),
disabled: true,
height: o.height
});
this.checkTipsState(o.items);
this.right = BI.createWidget({
type: "bi.horizontal",
items: [this.container, this.minTip, this.maxTip],
height: o.height
});
o.showTitle ? BI.createWidget({
type: "bi.absolute",
items: [{
el: this.title,
left:0,
right:0,
top:0,
bottom:0,
width: 60
}, {
el: this.right,
left: 65,
right:0,
top:0,
bottom:0
}],
element: this
}) : BI.createWidget({
type: "bi.horizontal",
items: [this.right],
element: this
});
},
addItems: function (v) {
this.checkTipsState(v);
this.container.addItems(v.slice(0, this._constant.MAX_COLUMN_SIZE - 1));
},
checkTipsState: function (v) {
if (BI.isEmptyArray(v)) {
this.minTip.setVisible(true);
this.container.setVisible(false);
} else {
this.minTip.setVisible(false);
this.container.setVisible(true);
}
if (v.length >= this._constant.MAX_COLUMN_SIZE) {
this.maxTip.setVisible(true);
} else {
this.maxTip.setVisible(false);
}
},
removeAllItems: function () {
this.container.removeAllItems();
},
getSelectedButtons: function () {
return this.container.isVisible() ? this.container.getSelectedButtons() : [];
},
getAllButtons: function () {
return this.container.getAllButtons();
},
setTitle: function (title) {
this.title.setText(title + BI.i18nText("BI-Basic_Colon"));
this.title.setTitle(title);
},
setItems: function (items) {
this.removeAllItems();
this.addItems(BI.createItems(items, {
type: "bi.text_button",
height: this.options.height,
rgap: this._constant.DEFAULT_RIGHT_GAP
}));
},
populate: function (v) {
this.setTitle(v.title || BI.i18nText("BI-List_Label_Con"));
this.setItems(v.items || []);
},
setValue: function (v) {
this.container.setValue(v);
},
getValue: function () {
return this.container.getValue();
}
});
BI.ListLabel.EVENT_CHANGE = 'BI.ListLabel.EVENT_CHANGE';
$.shortcut('bi.list_label', BI.ListLabel);

160
src/widget/multidate/abstract.multidate.datepane.js

@ -1,160 +0,0 @@
(function ($) {
/**
* 普通控件
*
* @class BI.MultiDateCard
* @extends BI.Widget
* @abstract
*/
BI.MultiDateCard = BI.inherit(BI.Widget, {
constants: {
lgap: 80,
itemHeight: 35,
defaultEditorValue: "1"
},
_defaultConfig: function () {
return $.extend(BI.MultiDateCard.superclass._defaultConfig.apply(this, arguments), {});
},
dateConfig: function () {
},
defaultSelectedItem: function () {
},
_init: function () {
BI.MultiDateCard.superclass._init.apply(this, arguments);
var self = this, opts = this.options;
this.label = BI.createWidget({
type: 'bi.label',
height: this.constants.itemHeight,
textAlign: "left",
text: BI.i18nText("BI-Multi_Date_Relative_Current_Time"),
cls: 'bi-multidate-inner-label'
});
this.radioGroup = BI.createWidget({
type: "bi.button_group",
chooseType: 0,
items: BI.createItems(this.dateConfig(), {
type: 'bi.multidate_segment',
height: this.constants.itemHeight
}),
layouts: [{
type: "bi.vertical"
}]
});
this.radioGroup.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CONFIRM) {
self.fireEvent(BI.MultiDateCard.EVENT_CHANGE);
}
});
this.radioGroup.on(BI.ButtonGroup.EVENT_CHANGE, function () {
self.setValue(self.getValue());
self.fireEvent(BI.MultiDateCard.EVENT_CHANGE);
});
BI.createWidget({
element: this,
type: 'bi.center_adapt',
lgap: this.constants.lgap,
items: [{
type: 'bi.vertical',
items: [this.label, this.radioGroup]
}]
});
},
getValue: function () {
var button = this.radioGroup.getSelectedButtons()[0];
var type = button.getValue(), value = button.getInputValue();
return {
type: type,
value: value
}
},
_isTypeAvaliable: function (type) {
var res = false;
BI.find(this.dateConfig(), function (i, item) {
if (item.value === type) {
res = true;
return true;
}
});
return res;
},
setValue: function (v) {
var self = this;
if (BI.isNotNull(v) && this._isTypeAvaliable(v.type)) {
this.radioGroup.setValue(v.type);
BI.each(this.radioGroup.getAllButtons(), function (i, button) {
if (button.isEditorExist() === true && button.isSelected()) {
button.setInputValue(v.value);
button.setEnable(true);
} else {
button.setInputValue(self.constants.defaultEditorValue);
button.setEnable(false);
}
});
} else {
this.radioGroup.setValue(this.defaultSelectedItem());
BI.each(this.radioGroup.getAllButtons(), function (i, button) {
button.setInputValue(self.constants.defaultEditorValue);
if (button.isEditorExist() === true && button.isSelected()) {
button.setEnable(true);
} else {
button.setEnable(false);
}
});
}
},
getCalculationValue: function () {
var valueObject = this.getValue();
var type = valueObject.type, value = valueObject.value;
switch (type) {
case BICst.MULTI_DATE_DAY_PREV:
return new Date().getOffsetDate(-1 * value);
case BICst.MULTI_DATE_DAY_AFTER:
return new Date().getOffsetDate(value);
case BICst.MULTI_DATE_DAY_TODAY:
return new Date();
case BICst.MULTI_DATE_MONTH_PREV:
return new Date().getBeforeMultiMonth(value);
case BICst.MULTI_DATE_MONTH_AFTER:
return new Date().getAfterMultiMonth(value);
case BICst.MULTI_DATE_MONTH_BEGIN:
return new Date(new Date().getFullYear(), new Date().getMonth(), 1);
case BICst.MULTI_DATE_MONTH_END:
return new Date(new Date().getFullYear(), new Date().getMonth(), (new Date().getLastDateOfMonth()).getDate());
case BICst.MULTI_DATE_QUARTER_PREV:
return new Date().getBeforeMulQuarter(value);
case BICst.MULTI_DATE_QUARTER_AFTER:
return new Date().getAfterMulQuarter(value);
case BICst.MULTI_DATE_QUARTER_BEGIN:
return new Date().getQuarterStartDate();
case BICst.MULTI_DATE_QUARTER_END:
return new Date().getQuarterEndDate();
case BICst.MULTI_DATE_WEEK_PREV:
return new Date().getOffsetDate(-7 * value);
case BICst.MULTI_DATE_WEEK_AFTER:
return new Date().getOffsetDate(7 * value);
case BICst.MULTI_DATE_YEAR_PREV:
return new Date((new Date().getFullYear() - 1 * value), new Date().getMonth(), new Date().getDate());
case BICst.MULTI_DATE_YEAR_AFTER:
return new Date((new Date().getFullYear() + 1 * value), new Date().getMonth(), new Date().getDate());
case BICst.MULTI_DATE_YEAR_BEGIN:
return new Date(new Date().getFullYear(), 0, 1);
case BICst.MULTI_DATE_YEAR_END:
return new Date(new Date().getFullYear(), 11, 31);
}
}
});
BI.MultiDateCard.EVENT_CHANGE = "EVENT_CHANGE";
})(jQuery);

259
src/widget/multidate/multidate.combo.js

@ -1,259 +0,0 @@
BICst.MULTI_DATE_YMD_CARD = 1;
BICst.MULTI_DATE_YEAR_CARD = 2;
BICst.MULTI_DATE_QUARTER_CARD = 3;
BICst.MULTI_DATE_MONTH_CARD = 4;
BICst.MULTI_DATE_WEEK_CARD = 5;
BICst.MULTI_DATE_DAY_CARD = 6;
BICst.MULTI_DATE_SEGMENT_NUM = {};
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_YEAR_PREV] = BI.i18nText("BI-Multi_Date_Year_Prev");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_YEAR_AFTER] = BI.i18nText("BI-Multi_Date_Year_Next");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_YEAR_BEGIN] = BI.i18nText("BI-Multi_Date_Year_Begin");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_YEAR_END] = BI.i18nText("BI-Multi_Date_Year_End");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_QUARTER_PREV] = BI.i18nText("BI-Multi_Date_Quarter_Prev");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_QUARTER_AFTER] = BI.i18nText("BI-Multi_Date_Quarter_Next");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_QUARTER_BEGIN] = BI.i18nText("BI-Multi_Date_Quarter_Begin");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_QUARTER_END] = BI.i18nText("BI-Multi_Date_Quarter_End");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_MONTH_PREV] = BI.i18nText("BI-Multi_Date_Month_Prev");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_MONTH_AFTER] = BI.i18nText("BI-Multi_Date_Month_Next");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_MONTH_BEGIN] = BI.i18nText("BI-Multi_Date_Month_Begin");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_MONTH_END] = BI.i18nText("BI-Multi_Date_Month_End");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_WEEK_PREV] = BI.i18nText("BI-Multi_Date_Week_Prev");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_WEEK_AFTER] = BI.i18nText("BI-Multi_Date_Week_Next");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_DAY_PREV] = BI.i18nText("BI-Multi_Date_Day_Prev");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_DAY_AFTER] = BI.i18nText("BI-Multi_Date_Day_Next");
BICst.MULTI_DATE_SEGMENT_NUM[BICst.MULTI_DATE_DAY_TODAY] = BI.i18nText("BI-Multi_Date_Today");
(function ($) {
/**
* 日期控件
* @class BI.MultiDateCombo
* @extends BI.Widget
*/
BI.MultiDateCombo = BI.inherit(BI.Single, {
constants: {
popupHeight: 259,
popupWidth: 270,
comboAdjustHeight: 1,
border: 1,
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
},
_defaultConfig: function () {
return BI.extend(BI.MultiDateCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-combo',
height: 24
});
},
_init: function () {
BI.MultiDateCombo.superclass._init.apply(this, arguments);
var self = this, opts = this.options;
this.storeTriggerValue = "";
var date = new Date();
this.storeValue = null;
this.trigger = BI.createWidget({
type: 'bi.date_trigger',
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE
});
this.trigger.on(BI.DateTrigger.EVENT_KEY_DOWN, function(){
if(self.combo.isViewVisible()){
self.combo.hideView();
}
});
this.trigger.on(BI.DateTrigger.EVENT_STOP, function(){
if(!self.combo.isViewVisible()){
self.combo.showView();
}
});
this.trigger.on(BI.DateTrigger.EVENT_TRIGGER_CLICK, function(){
self.combo.toggle();
});
this.trigger.on(BI.DateTrigger.EVENT_FOCUS, function () {
self.storeTriggerValue = self.trigger.getKey();
if(!self.combo.isViewVisible()){
self.combo.showView();
}
self.fireEvent(BI.MultiDateCombo.EVENT_FOCUS);
});
this.trigger.on(BI.DateTrigger.EVENT_ERROR, function () {
self.storeValue = {
year: date.getFullYear(),
month: date.getMonth()
};
self.popup.setValue();
self.fireEvent(BI.MultiDateCombo.EVENT_ERROR);
});
this.trigger.on(BI.DateTrigger.EVENT_VALID, function () {
self.fireEvent(BI.MultiDateCombo.EVENT_VALID);
});
this.trigger.on(BI.DateTrigger.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiDateCombo.EVENT_CHANGE);
});
this.trigger.on(BI.DateTrigger.EVENT_CONFIRM, function () {
if(self.combo.isViewVisible()) {
return;
}
var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
} else if (BI.isEmptyString(dateObj)) {
self.storeValue = null;
self.trigger.setValue();
}
self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM);
});
this.popup = BI.createWidget({
type: "bi.multidate_popup",
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE
});
this.popup.on(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE, function () {
self.setValue();
self.combo.hideView();
self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM);
});
this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE, function () {
var date = new Date();
self.setValue({
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate()
});
self.combo.hideView();
self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM);
});
this.popup.on(BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM);
});
this.popup.on(BI.MultiDatePopup.CALENDAR_EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.combo.hideView();
//self.fireEvent(BI.MultiDateCombo.EVENT_CHANGE);
self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM);
});
this.combo = BI.createWidget({
type: 'bi.combo',
toggle: false,
isNeedAdjustHeight: false,
isNeedAdjustWidth: false,
el: this.trigger,
adjustLength: this.constants.comboAdjustHeight,
popup: {
el: this.popup,
maxHeight: this.constants.popupHeight,
width: this.constants.popupWidth,
stopPropagation: false
}
});
this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.popup.setValue(self.storeValue);
self.fireEvent(BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW);
});
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
cls: "bi-trigger-date-button chart-date-normal-font",
width: 30,
height: 23
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.changeIcon = BI.createWidget({
type: "bi.icon_button",
cls: "bi-trigger-date-change widget-date-h-change-font",
width: 30,
height: 23,
invisible: true
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
top: 0,
left: 0,
right: 0,
bottom: 0
}, {
el: triggerBtn,
top: 0,
left: 0
}, {
el: this.changeIcon,
top: 0,
right: 0
}]
})
},
_checkDynamicValue: function(v){
var type = null;
if (BI.isNotNull(v)) {
type = v.type
}
switch (type){
case BICst.MULTI_DATE_YEAR_PREV:
case BICst.MULTI_DATE_YEAR_AFTER:
case BICst.MULTI_DATE_YEAR_BEGIN:
case BICst.MULTI_DATE_YEAR_END:
case BICst.MULTI_DATE_QUARTER_PREV:
case BICst.MULTI_DATE_QUARTER_AFTER:
case BICst.MULTI_DATE_QUARTER_BEGIN:
case BICst.MULTI_DATE_QUARTER_END:
case BICst.MULTI_DATE_MONTH_PREV:
case BICst.MULTI_DATE_MONTH_AFTER:
case BICst.MULTI_DATE_MONTH_BEGIN:
case BICst.MULTI_DATE_MONTH_END:
case BICst.MULTI_DATE_WEEK_PREV:
case BICst.MULTI_DATE_WEEK_AFTER:
case BICst.MULTI_DATE_DAY_PREV:
case BICst.MULTI_DATE_DAY_AFTER:
case BICst.MULTI_DATE_DAY_TODAY:
this.changeIcon.setVisible(true);
break;
default:
this.changeIcon.setVisible(false);
break;
}
},
setValue: function (v) {
this.storeValue = v;
this.popup.setValue(v);
this.trigger.setValue(v);
this._checkDynamicValue(v)
},
getValue: function () {
return this.storeValue;
},
getKey: function(){
return this.trigger.getKey();
},
hidePopupView: function () {
this.combo.hideView();
}
});
$.shortcut('bi.multidate_combo', BI.MultiDateCombo);
BI.MultiDateCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.MultiDateCombo.EVENT_FOCUS = "EVENT_FOCUS";
BI.MultiDateCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiDateCombo.EVENT_VALID = "EVENT_VALID";
BI.MultiDateCombo.EVENT_ERROR = "EVENT_ERROR";
BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW = "BI.MultiDateCombo.EVENT_BEFORE_POPUPVIEW";
})(jQuery);

45
src/widget/multidate/multidate.day.js

@ -1,45 +0,0 @@
(function ($) {
/**
* 普通控件
*
* @class BI.DayCard
* @extends BI.MultiDateCard
*/
BI.DayCard = BI.inherit(BI.MultiDateCard, {
_defaultConfig: function () {
return $.extend(BI.DayCard.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-daycard'
});
},
_init: function () {
BI.DayCard.superclass._init.apply(this, arguments);
},
dateConfig: function(){
return [{
isEditorExist: true,
selected: true,
text: BI.i18nText("BI-Multi_Date_Day_Prev"),
value: BICst.MULTI_DATE_DAY_PREV
},
{
isEditorExist: true,
text: BI.i18nText("BI-Multi_Date_Day_Next"),
value: BICst.MULTI_DATE_DAY_AFTER
},
{
isEditorExist: false,
value: BICst.MULTI_DATE_DAY_TODAY,
text: BI.i18nText("BI-Multi_Date_Today")
}];
},
defaultSelectedItem: function(){
return BICst.MULTI_DATE_DAY_PREV
}
});
BI.DayCard.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.daycard', BI.DayCard);
})(jQuery);

51
src/widget/multidate/multidate.month.js

@ -1,51 +0,0 @@
;
(function ($) {
/**
* 普通控件
*
* @class BI.MonthCard
* @extends BI.MultiDateCard
*/
BI.MonthCard = BI.inherit(BI.MultiDateCard, {
_defaultConfig: function () {
return $.extend(BI.MonthCard.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-monthcard'
});
},
_init: function () {
BI.MonthCard.superclass._init.apply(this, arguments);
},
dateConfig: function(){
return [{
selected: true,
isEditorExist: true,
value: BICst.MULTI_DATE_MONTH_PREV,
text: BI.i18nText("BI-Multi_Date_Month_Prev")
},
{
isEditorExist: true,
value: BICst.MULTI_DATE_MONTH_AFTER,
text: BI.i18nText("BI-Multi_Date_Month_Next")
},
{
value: BICst.MULTI_DATE_MONTH_BEGIN,
isEditorExist: false,
text: BI.i18nText("BI-Multi_Date_Month_Begin")
},
{
value: BICst.MULTI_DATE_MONTH_END,
isEditorExist: false,
text: BI.i18nText("BI-Multi_Date_Month_End")
}];
},
defaultSelectedItem: function(){
return BICst.MULTI_DATE_MONTH_PREV;
}
});
BI.MonthCard.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.monthcard', BI.MonthCard);
})(jQuery);

313
src/widget/multidate/multidate.popup.js

@ -1,313 +0,0 @@
(function ($) {
/**
* 日期控件
* @class BI.MultiDatePopup
* @extends BI.Widget
*/
BI.MultiDatePopup = BI.inherit(BI.Widget, {
constants: {
tabHeight: 30,
tabWidth: 42,
titleHeight: 27,
itemHeight: 30,
triggerHeight: 24,
buttonWidth: 90,
buttonHeight: 25,
cardHeight: 229,
cardWidth: 270,
popupHeight: 259,
popupWidth: 270,
comboAdjustHeight: 1,
ymdWidth: 58,
lgap: 2,
border: 1
},
_defaultConfig: function () {
return BI.extend(BI.MultiDatePopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-popup',
width: 268,
height: 260
});
},
_init: function () {
BI.MultiDatePopup.superclass._init.apply(this, arguments);
var self = this, opts = this.options;
this.storeValue = "";
this.textButton = BI.createWidget({
type: 'bi.text_button',
forceCenter: true,
cls: 'bi-multidate-popup-label',
shadow: true,
text: BI.i18nText("BI-Multi_Date_Today")
});
this.textButton.on(BI.TextButton.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE);
});
this.clearButton = BI.createWidget({
type: "bi.text_button",
forceCenter: true,
cls: 'bi-multidate-popup-button',
shadow: true,
text: BI.i18nText("BI-Basic_Clear")
});
this.clearButton.on(BI.TextButton.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE);
});
this.okButton = BI.createWidget({
type: "bi.text_button",
forceCenter: true,
cls: 'bi-multidate-popup-button',
shadow: true,
text: BI.i18nText("BI-Basic_OK")
});
this.okButton.on(BI.TextButton.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE);
});
this.dateTab = BI.createWidget({
type: 'bi.tab',
tab: {
cls: "bi-multidate-popup-tab",
height: this.constants.tabHeight,
items: BI.createItems([{
text: BI.i18nText("BI-Multi_Date_YMD"),
value: BICst.MULTI_DATE_YMD_CARD,
width: this.constants.ymdWidth
}, {
text: BI.i18nText("BI-Multi_Date_Year"),
value: BICst.MULTI_DATE_YEAR_CARD
}, {
text: BI.i18nText("BI-Multi_Date_Quarter"),
value: BICst.MULTI_DATE_QUARTER_CARD
}, {
text: BI.i18nText("BI-Multi_Date_Month"),
value: BICst.MULTI_DATE_MONTH_CARD
}, {
text: BI.i18nText("BI-Multi_Date_Week"),
value: BICst.MULTI_DATE_WEEK_CARD
}, {
text: BI.i18nText("BI-Multi_Date_Day"),
value: BICst.MULTI_DATE_DAY_CARD
}], {
width: this.constants.tabWidth,
textAlign: "center",
height: this.constants.itemHeight,
cls: 'bi-multidate-popup-item'
}),
layouts: [{
type: 'bi.left'
}]
},
cardCreator: function (v) {
switch (v) {
case BICst.MULTI_DATE_YMD_CARD:
self.ymd = BI.createWidget({
type: "bi.date_calendar_popup",
min: self.options.min,
max: self.options.max
});
self.ymd.on(BI.DateCalendarPopup.EVENT_CHANGE, function () {
self.fireEvent(BI.MultiDatePopup.CALENDAR_EVENT_CHANGE);
});
return self.ymd;
case BICst.MULTI_DATE_YEAR_CARD:
self.year = BI.createWidget({
type: "bi.yearcard"
});
self.year.on(BI.MultiDateCard.EVENT_CHANGE, function (v) {
self._setInnerValue(self.year, v);
});
return self.year;
case BICst.MULTI_DATE_QUARTER_CARD:
self.quarter = BI.createWidget({
type: 'bi.quartercard'
});
self.quarter.on(BI.MultiDateCard.EVENT_CHANGE, function (v) {
self._setInnerValue(self.quarter, v);
});
return self.quarter;
case BICst.MULTI_DATE_MONTH_CARD:
self.month = BI.createWidget({
type: 'bi.monthcard'
});
self.month.on(BI.MultiDateCard.EVENT_CHANGE, function (v) {
self._setInnerValue(self.month, v);
});
return self.month;
case BICst.MULTI_DATE_WEEK_CARD:
self.week = BI.createWidget({
type: 'bi.weekcard'
});
self.week.on(BI.MultiDateCard.EVENT_CHANGE, function (v) {
self._setInnerValue(self.week, v);
});
return self.week;
case BICst.MULTI_DATE_DAY_CARD:
self.day = BI.createWidget({
type: 'bi.daycard'
});
self.day.on(BI.MultiDateCard.EVENT_CHANGE, function (v) {
self._setInnerValue(self.day, v);
});
return self.day;
}
}
});
this.dateTab.setSelect(BICst.MULTI_DATE_YMD_CARD);
this.cur = BICst.MULTI_DATE_YMD_CARD;
this.dateTab.on(BI.Tab.EVENT_CHANGE, function () {
var v = self.dateTab.getSelect();
switch (v) {
case BICst.MULTI_DATE_YMD_CARD:
var date = this.getTab(self.cur).getCalculationValue();
self.ymd.setValue({
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate()
});
self._setInnerValue(self.ymd);
break;
case BICst.MULTI_DATE_YEAR_CARD:
self.year.setValue(self.storeValue);
self._setInnerValue(self.year);
break;
case BICst.MULTI_DATE_QUARTER_CARD:
self.quarter.setValue(self.storeValue);
self._setInnerValue(self.quarter);
break;
case BICst.MULTI_DATE_MONTH_CARD:
self.month.setValue(self.storeValue);
self._setInnerValue(self.month);
break;
case BICst.MULTI_DATE_WEEK_CARD:
self.week.setValue(self.storeValue);
self._setInnerValue(self.week);
break;
case BICst.MULTI_DATE_DAY_CARD:
self.day.setValue(self.storeValue);
self._setInnerValue(self.day);
break;
}
self.cur = v;
});
this.dateButton = BI.createWidget({
type: "bi.grid",
items: [[this.clearButton, this.textButton, this.okButton]]
});
BI.createWidget({
element: this,
type: "bi.vtape",
items: [{
el: this.dateTab
}, {
el: this.dateButton,
height: 30
}]
});
},
_setInnerValue: function (obj) {
if (this.dateTab.getSelect() === BICst.MULTI_DATE_YMD_CARD) {
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
this.textButton.setEnable(true);
} else {
var date = obj.getCalculationValue();
date = date.print("%Y-%x-%e");
this.textButton.setValue(date);
this.textButton.setEnable(false);
}
},
setValue: function (v) {
this.storeValue = v;
var self = this, date;
var type, value;
if (BI.isNotNull(v)) {
type = v.type || BICst.MULTI_DATE_CALENDAR; value = v.value;
if(BI.isNull(value)){
value = v;
}
}
switch (type) {
case BICst.MULTI_DATE_YEAR_PREV:
case BICst.MULTI_DATE_YEAR_AFTER:
case BICst.MULTI_DATE_YEAR_BEGIN:
case BICst.MULTI_DATE_YEAR_END:
this.dateTab.setSelect(BICst.MULTI_DATE_YEAR_CARD);
this.year.setValue({type: type, value: value});
this.cur = BICst.MULTI_DATE_YEAR_CARD;
self._setInnerValue(this.year);
break;
case BICst.MULTI_DATE_QUARTER_PREV:
case BICst.MULTI_DATE_QUARTER_AFTER:
case BICst.MULTI_DATE_QUARTER_BEGIN:
case BICst.MULTI_DATE_QUARTER_END:
this.dateTab.setSelect(BICst.MULTI_DATE_QUARTER_CARD);
this.cur = BICst.MULTI_DATE_QUARTER_CARD;
this.quarter.setValue({type: type, value: value});
self._setInnerValue(this.quarter);
break;
case BICst.MULTI_DATE_MONTH_PREV:
case BICst.MULTI_DATE_MONTH_AFTER:
case BICst.MULTI_DATE_MONTH_BEGIN:
case BICst.MULTI_DATE_MONTH_END:
this.dateTab.setSelect(BICst.MULTI_DATE_MONTH_CARD);
this.cur = BICst.MULTI_DATE_MONTH_CARD;
this.month.setValue({type: type, value: value});
self._setInnerValue(this.month);
break;
case BICst.MULTI_DATE_WEEK_PREV:
case BICst.MULTI_DATE_WEEK_AFTER:
this.dateTab.setSelect(BICst.MULTI_DATE_WEEK_CARD);
this.cur = BICst.MULTI_DATE_WEEK_CARD;
this.week.setValue({type: type, value: value});
self._setInnerValue(this.week);
break;
case BICst.MULTI_DATE_DAY_PREV:
case BICst.MULTI_DATE_DAY_AFTER:
case BICst.MULTI_DATE_DAY_TODAY:
this.dateTab.setSelect(BICst.MULTI_DATE_DAY_CARD);
this.cur = BICst.MULTI_DATE_DAY_CARD;
this.day.setValue({type: type, value: value});
self._setInnerValue(this.day);
break;
default:
if (BI.isNull(value) || BI.isEmptyObject(value)) {
var date = new Date();
this.dateTab.setSelect(BICst.MULTI_DATE_YMD_CARD);
this.ymd.setValue({
year: date.getFullYear(),
month: date.getMonth(),
day: date.getDate()
});
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
} else {
this.dateTab.setSelect(BICst.MULTI_DATE_YMD_CARD);
this.ymd.setValue(value);
this.textButton.setValue(BI.i18nText("BI-Multi_Date_Today"));
}
this.textButton.setEnable(true);
break;
}
},
getValue: function () {
var tab = this.dateTab.getSelect();
switch (tab) {
case BICst.MULTI_DATE_YMD_CARD:
return this.ymd.getValue();
case BICst.MULTI_DATE_YEAR_CARD:
return this.year.getValue();
case BICst.MULTI_DATE_QUARTER_CARD:
return this.quarter.getValue();
case BICst.MULTI_DATE_MONTH_CARD:
return this.month.getValue();
case BICst.MULTI_DATE_WEEK_CARD:
return this.week.getValue();
case BICst.MULTI_DATE_DAY_CARD:
return this.day.getValue();
}
}
});
BI.MultiDatePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE";
BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE = "BUTTON_lABEL_EVENT_CHANGE";
BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE";
BI.MultiDatePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE";
$.shortcut('bi.multidate_popup', BI.MultiDatePopup);
})(jQuery);

51
src/widget/multidate/multidate.quarter.js

@ -1,51 +0,0 @@
(function ($) {
/**
* 普通控件
*
* @class BI.QuarterCard
* @extends BI.MultiDateCard
*/
BI.QuarterCard = BI.inherit(BI.MultiDateCard, {
_defaultConfig: function () {
return $.extend(BI.QuarterCard.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-quartercard'
});
},
_init: function () {
BI.QuarterCard.superclass._init.apply(this, arguments);
},
dateConfig: function(){
return [{
selected: true,
value: BICst.MULTI_DATE_QUARTER_PREV,
isEditorExist: true,
text: BI.i18nText("BI-Multi_Date_Quarter_Prev")
},
{
value: BICst.MULTI_DATE_QUARTER_AFTER,
isEditorExist: true,
text: BI.i18nText("BI-Multi_Date_Quarter_Next")
},
{
value: BICst.MULTI_DATE_QUARTER_BEGIN,
isEditorExist: false,
text: BI.i18nText("BI-Multi_Date_Quarter_Begin")
},
{
value: BICst.MULTI_DATE_QUARTER_END,
isEditorExist: false,
text: BI.i18nText("BI-Multi_Date_Quarter_End")
}]
},
defaultSelectedItem: function(){
return BICst.MULTI_DATE_QUARTER_PREV;
}
});
BI.QuarterCard.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.quartercard', BI.QuarterCard);
})(jQuery);

134
src/widget/multidate/multidate.segment.js

@ -1,134 +0,0 @@
(function ($) {
/**
* 普通控件
*
* @class BI.MultiDateSegment
* @extends BI.Single
*/
BI.MultiDateSegment = BI.inherit(BI.Single, {
constants: {
itemHeight: 24,
maxGap: 15,
minGap: 10,
textWidth: 30,
defaultEditorValue: "1"
},
_defaultConfig: function () {
return $.extend(BI.MultiDateSegment.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-segment',
text: "",
width: 130,
height: 30,
isEditorExist: true,
selected: false,
defaultEditorValue: "1"
});
},
_init: function () {
BI.MultiDateSegment.superclass._init.apply(this, arguments);
var self = this, opts = this.options;
this.radio = BI.createWidget({
type: "bi.radio",
selected: opts.selected
});
this.radio.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.textEditor = BI.createWidget({
type: 'bi.text_editor',
value: this.constants.defaultEditorValue,
title:this.constants.defaultEditorValue,
cls: 'bi-multidate-editor',
width: this.constants.textWidth,
height: this.constants.itemHeight
});
this.textEditor.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.textEditor.on(BI.TextEditor.EVENT_CONFIRM, function () {
this.setTitle(this.getValue());
});
this.text = BI.createWidget({
type: "bi.label",
textAlign: "left",
cls: 'bi-multidate-normal-label',
text: opts.text,
height: this.constants.itemHeight
});
this._createSegment();
},
_createSegment: function () {
if (this.options.isEditorExist === true) {
return BI.createWidget({
element: this,
type: 'bi.left',
items: [{
el: {
type: "bi.center_adapt",
items: [this.radio],
height: this.constants.itemHeight
},
lgap: 0
},
{
el: {
type: "bi.center_adapt",
items: [this.textEditor],
widgetName: 'textEditor'
},
lgap: this.constants.maxGap
},
{
el: this.text,
lgap: this.constants.minGap
}]
});
}
return BI.createWidget({
element: this,
type: 'bi.left',
items: [{
el: {
type: "bi.center_adapt",
items: [this.radio],
height: this.constants.itemHeight
},
lgap: 0
},
{
el: this.text,
lgap: this.constants.maxGap
}]
})
},
setSelected: function (v) {
if (BI.isNotNull(this.radio)) {
this.radio.setSelected(v);
}
},
isSelected: function () {
return this.radio.isSelected();
},
getValue: function () {
return this.options.value;
},
getInputValue: function () {
return this.textEditor.getValue() | 0;
},
setInputValue: function (v) {
this.textEditor.setValue(v);
},
isEditorExist: function () {
return this.options.isEditorExist;
},
setEnable: function (b) {
BI.Editor.superclass.setEnable.apply(this, arguments);
this.textEditor && this.textEditor.setEnable(b);
}
});
BI.MultiDateSegment.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.multidate_segment', BI.MultiDateSegment);
})(jQuery);

41
src/widget/multidate/multidate.week.js

@ -1,41 +0,0 @@
;
(function ($) {
/**
* 普通控件
*
* @class BI.WeekCard
* @extends BI.MultiDateCard
*/
BI.WeekCard = BI.inherit(BI.MultiDateCard, {
_defaultConfig: function () {
return $.extend(BI.WeekCard.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-weekcard'
});
},
_init: function () {
BI.WeekCard.superclass._init.apply(this, arguments);
},
dateConfig: function(){
return [{
selected: true,
isEditorExist: true,
text: BI.i18nText("BI-Multi_Date_Week_Prev"),
value: BICst.MULTI_DATE_WEEK_PREV
},
{
isEditorExist: true,
text: BI.i18nText("BI-Multi_Date_Week_Next"),
value: BICst.MULTI_DATE_WEEK_AFTER
}];
},
defaultSelectedItem: function(){
return BICst.MULTI_DATE_WEEK_PREV;
}
});
BI.WeekCard.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.weekcard', BI.WeekCard);
})(jQuery);

49
src/widget/multidate/multidate.year.js

@ -1,49 +0,0 @@
(function ($) {
/**
* 普通控件
*
* @class BI.YearCard
* @extends BI.MultiDateCard
*/
BI.YearCard = BI.inherit(BI.MultiDateCard, {
_defaultConfig: function () {
return $.extend(BI.YearCard.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-multidate-yearcard'
});
},
_init: function () {
BI.YearCard.superclass._init.apply(this, arguments);
},
dateConfig: function(){
return [{
selected: true,
isEditorExist: true,
text: BI.i18nText("BI-Multi_Date_Year_Prev"),
value: BICst.MULTI_DATE_YEAR_PREV
},
{
isEditorExist: true,
text: BI.i18nText("BI-Multi_Date_Year_Next"),
value: BICst.MULTI_DATE_YEAR_AFTER
},
{
isEditorExist: false,
value: BICst.MULTI_DATE_YEAR_BEGIN,
text: BI.i18nText("BI-Multi_Date_Year_Begin")
},
{
isEditorExist: false,
value: BICst.MULTI_DATE_YEAR_END,
text: BI.i18nText("BI-Multi_Date_Year_End")
}]
},
defaultSelectedItem: function(){
return BICst.MULTI_DATE_YEAR_PREV;
}
});
BI.YearCard.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.yearcard', BI.YearCard);
})(jQuery);

95
src/widget/paramsettingcombo/datecombo/combo.param.date.js

@ -1,95 +0,0 @@
/**
* @class BI.DateParamCombo
* @extend BI.Widget
* combo : text + icon, popup : text
* 参见场景dashboard布局方式选择
*/
BI.DateParamCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.DateParamCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-date-param-combo",
width: 130,
height: 30
})
},
_init: function () {
BI.DateParamCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.text_trigger",
cls: "param-trigger",
height: o.height - 2
});
this.popup = BI.createWidget({
type: "bi.date_param_popup_view",
maxHeight: 300
});
this.popup.on(BI.ParamPopupView.EVENT_CONFIRM, function(){
self.DateParamCombo.hideView();
});
this.DateParamCombo = BI.createWidget({
type: "bi.combo",
element: this,
adjustLength: 2,
el: this.trigger,
popup: this.popup
});
this.DateParamCombo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
self.setValue(self.getValue());
self.fireEvent(BI.DateParamCombo.EVENT_CONFIRM);
});
this.DateParamCombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.setValue(self.getValue());
});
},
_getShowTextByValue: function(v){
v = v || {};
var value = v.value;
var midText = (value.foffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) +
BI.i18nText("BI-Basic_De") + (value.soffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) + value.svalue;
switch (v.type) {
case BICst.YEAR:
return value.fvalue + BI.i18nText("BI-Year") +
(value.foffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) +
BI.i18nText("BI-Basic_De") + BI.i18nText("BI-Year_Fen");
case BICst.YEAR_QUARTER:
return value.fvalue + BI.i18nText("BI-Year") + midText + BI.i18nText("BI-Quarter_De");
case BICst.YEAR_MONTH:
return value.fvalue + BI.i18nText("BI-Year") + midText + BI.i18nText("BI-Month_De");
case BICst.YEAR_WEEK:
return value.fvalue + BI.i18nText("BI-Year") + midText + BI.i18nText("BI-Week_De");
case BICst.YEAR_DAY:
return value.fvalue + BI.i18nText("BI-Year") + midText + BI.i18nText("BI-Day_De");
case BICst.MONTH_WEEK:
return value.fvalue + BI.i18nText("BI-Basic_Month") + midText + BI.i18nText("BI-Week_De");
case BICst.MONTH_DAY:
return value.fvalue + BI.i18nText("BI-Basic_Month") + midText + BI.i18nText("BI-Day_De");
}
},
setValue: function (v) {
this.DateParamCombo.setValue(v);
this.trigger.setValue(this._getShowTextByValue(v));
},
setEnable: function (v) {
BI.DateParamCombo.superclass.setEnable.apply(this, arguments);
this.DateParamCombo.setEnable(v);
},
getValue: function () {
return this.DateParamCombo.getValue();
},
getCalculationValue: function(){
return this.popup.getCalculationValue();
}
});
BI.DateParamCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
$.shortcut("bi.date_param_combo", BI.DateParamCombo);

52
src/widget/paramsettingcombo/datecombo/popup.param.date.js

@ -1,52 +0,0 @@
/**
* 普通控件
*
* @class BI.DateParamPopupView
* @extends BI.ParamPopupView
*/
BI.DateParamPopupView = BI.inherit(BI.ParamPopupView, {
_defaultConfig: function () {
return BI.extend(BI.DateParamPopupView.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-date-param-popup'
});
},
_init: function () {
BI.DateParamPopupView.superclass._init.apply(this, arguments);
},
dateConfig: function () {
return [{
type: "bi.param3_date_item",
value: BICst.YEAR,
selected: true
}, {
type: "bi.param1_date_item",
value: BI.Param1DateItem.YEAR_QUARTER,
disabled: true
}, {
type: "bi.param1_date_item",
value: BI.Param1DateItem.YEAR_MONTH,
disabled: true
}, {
type: "bi.param1_date_item",
value: BI.Param1DateItem.YEAR_WEEK,
disabled: true
}, {
type: "bi.param1_date_item",
value: BI.Param1DateItem.YEAR_DAY,
disabled: true
}, {
type: "bi.param1_date_item",
value: BI.Param1DateItem.MONTH_WEEK,
disabled: true
}, {
type: "bi.param1_date_item",
value: BI.Param1DateItem.MONTH_DAY,
disabled: true
}]
}
});
BI.DateParamPopupView.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.date_param_popup_view', BI.DateParamPopupView);

95
src/widget/paramsettingcombo/dateintervalcombo/combo.param.dateinterval.js

@ -1,95 +0,0 @@
/**
* @class BI.DateIntervalParamCombo
* @extend BI.Widget
* combo : text + icon, popup : text
* 参见场景dashboard布局方式选择
*/
BI.DateIntervalParamCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.DateIntervalParamCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-date-interval-param-combo",
width: 130,
height: 30
})
},
_init: function () {
BI.DateIntervalParamCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.text_trigger",
cls: "param-trigger",
height: o.height - 2
});
this.popup = BI.createWidget({
type: "bi.date_interval_param_popup_view",
maxHeight: 300
});
this.popup.on(BI.ParamPopupView.EVENT_CONFIRM, function(){
self.DateIntervalParamCombo.hideView();
});
this.DateIntervalParamCombo = BI.createWidget({
type: "bi.combo",
element: this,
adjustLength: 2,
el: this.trigger,
popup: this.popup
});
this.DateIntervalParamCombo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
self.setValue(self.getValue());
self.fireEvent(BI.DateIntervalParamCombo.EVENT_CONFIRM);
});
this.DateIntervalParamCombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.setValue(self.getValue());
});
},
_getShowTextByValue: function(v){
v = v || {};
var value = v.value;
var midText = (value.foffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) +
BI.i18nText("BI-Basic_De") + (value.soffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) + value.svalue;
switch (v.type) {
case BICst.YEAR:
return value.fvalue + BI.i18nText("BI-Year") +
(value.foffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) +
BI.i18nText("BI-Basic_De") + BI.i18nText("BI-Year_Fen");
case BICst.YEAR_QUARTER:
return value.fvalue + BI.i18nText("BI-Year") + midText + BI.i18nText("BI-Basic_Quarter");
case BICst.YEAR_MONTH:
return value.fvalue + BI.i18nText("BI-Year") + midText + BI.i18nText("BI-Month_Fen");
case BICst.YEAR_WEEK:
return value.fvalue + BI.i18nText("BI-Year") + midText + BI.i18nText("BI-Week");
case BICst.YEAR_DAY:
return value.fvalue + BI.i18nText("BI-Year") + midText + BI.i18nText("BI-Day_De");
case BICst.MONTH_WEEK:
return value.fvalue + BI.i18nText("BI-Basic_Month") + midText + BI.i18nText("BI-Week");
case BICst.MONTH_DAY:
return value.fvalue + BI.i18nText("BI-Basic_Month") + midText + BI.i18nText("BI-Day_De");
}
},
setValue: function (v) {
this.DateIntervalParamCombo.setValue(v);
this.trigger.setValue(this._getShowTextByValue(v));
},
setEnable: function (v) {
BI.DateIntervalParamCombo.superclass.setEnable.apply(this, arguments);
this.DateIntervalParamCombo.setEnable(v);
},
getValue: function () {
return this.DateIntervalParamCombo.getValue();
},
getCalculationValue: function(){
return this.popup.getCalculationValue();
}
});
BI.DateIntervalParamCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
$.shortcut("bi.date_interval_param_combo", BI.DateIntervalParamCombo);

52
src/widget/paramsettingcombo/dateintervalcombo/popup.param.dateinterval.js

@ -1,52 +0,0 @@
/**
* 普通控件
*
* @class BI.DateIntervalParamPopupView
* @extends BI.ParamPopupView
*/
BI.DateIntervalParamPopupView = BI.inherit(BI.ParamPopupView, {
_defaultConfig: function () {
return BI.extend(BI.DateIntervalParamPopupView.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-date-interval-param-popup'
});
},
_init: function () {
BI.DateIntervalParamPopupView.superclass._init.apply(this, arguments);
},
dateConfig: function () {
return [{
type: "bi.param0_date_item",
value: BICst.YEAR,
selected: true
}, {
type: "bi.param2_date_item",
value: BI.Param2DateItem.YEAR_QUARTER,
disabled: true
}, {
type: "bi.param2_date_item",
value: BI.Param2DateItem.YEAR_MONTH,
disabled: true
}, {
type: "bi.param2_date_item",
value: BI.Param2DateItem.YEAR_WEEK,
disabled: true
}, {
type: "bi.param2_date_item",
value: BI.Param2DateItem.YEAR_DAY,
disabled: true
}, {
type: "bi.param2_date_item",
value: BI.Param2DateItem.MONTH_WEEK,
disabled: true
}, {
type: "bi.param2_date_item",
value: BI.Param2DateItem.MONTH_DAY,
disabled: true
}]
}
});
BI.DateIntervalParamPopupView.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.date_interval_param_popup_view', BI.DateIntervalParamPopupView);

131
src/widget/paramsettingcombo/param0.date.item.js

@ -1,131 +0,0 @@
/**
* 普通控件
*
* @class BI.Param0DateItem
* @extends BI.Single
*/
BI.Param0DateItem = BI.inherit(BI.Single, {
constants: {
itemHeight: 20,
itemWidth: 20,
textWidth: 40,
comboWidth: 45
},
_defaultConfig: function () {
return BI.extend(BI.Param0DateItem.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-param0-date-item',
width: 310,
height: 20,
selected: false,
defaultEditorValue: "0"
});
},
_init: function () {
BI.Param0DateItem.superclass._init.apply(this, arguments);
var self = this, opts = this.options;
this.radio = BI.createWidget({
type: "bi.radio",
selected: opts.selected
});
this.radio.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.firstEditor = BI.createWidget({
type: 'bi.small_text_editor',
value: opts.defaultEditorValue,
validationChecker: function(v){
return BI.isNaturalNumber(v);
},
errorText: BI.i18nText("BI-Please_Input_Integer"),
width: this.constants.textWidth,
height: this.constants.itemHeight
});
this.firstEditor.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.firstCombo = BI.createWidget({
type: "bi.small_text_value_combo",
width: this.constants.comboWidth,
height: this.constants.itemHeight,
items: BICst.BEFORE_AFTER_COMBO
});
this.firstCombo.setValue(0);
BI.createWidget({
type: 'bi.inline',
element: this,
items: [{
type: "bi.center_adapt",
items: [this.radio],
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, this.firstEditor, {
type: "bi.label",
textAlign: "center",
cls: 'param-label',
text: BI.i18nText("BI-Year"),
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, this.firstCombo, {
type: "bi.label",
textAlign: "center",
cls: 'param-label',
text: BI.i18nText("BI-Basic_De"),
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, {
type: "bi.label",
textAlign: "left",
cls: 'param-label',
text: BI.i18nText("BI-Year_Fen"),
height: this.constants.itemHeight,
lgap: 5
}]
});
},
_assertValue: function(v){
var o = this.options;
v = v || {};
v.fvalue = v.fvalue || o.defaultEditorValue;
v.foffset = v.foffset || 0;
return v;
},
setSelected: function (v) {
this.radio.setSelected(!!v);
},
isSelected: function () {
return this.radio.isSelected();
},
getInputValue: function () {
return {
fvalue: this.firstEditor.getValue() || 0,
foffset: this.firstCombo.getValue()[0]
};
},
setInputValue: function (v) {
v = this._assertValue(v);
this.firstEditor.setValue(v.fvalue);
this.firstCombo.setValue([v.foffset]);
},
getValue: function(){
return BICst.YEAR;
},
setEnable: function (b) {
this.firstEditor.setEnable(!!b);
this.firstCombo.setEnable(!!b);
}
});
BI.Param0DateItem.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.param0_date_item', BI.Param0DateItem);

187
src/widget/paramsettingcombo/param1.date.item.js

@ -1,187 +0,0 @@
/**
* 普通控件
*
* @class BI.Param1DateItem
* @extends BI.Single
*/
BI.Param1DateItem = BI.inherit(BI.Single, {
constants: {
itemHeight: 20,
itemWidth: 20,
textWidth: 40,
comboWidth: 45
},
_defaultConfig: function () {
return BI.extend(BI.Param1DateItem.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-param1-date-item',
value: BI.Param1DateItem.YEAR_DAY,
width: 310,
height: 20,
selected: false,
defaultEditorValue: "0"
});
},
_init: function () {
BI.Param1DateItem.superclass._init.apply(this, arguments);
var self = this, opts = this.options;
this.radio = BI.createWidget({
type: "bi.radio",
selected: opts.selected
});
this.radio.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.firstEditor = BI.createWidget({
type: 'bi.small_text_editor',
value: opts.defaultEditorValue,
validationChecker: function(v){
return BI.isNaturalNumber(v);
},
errorText: BI.i18nText("BI-Please_Input_Integer"),
width: this.constants.textWidth,
height: this.constants.itemHeight
});
this.firstEditor.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.secondEditor = BI.createWidget({
type: 'bi.small_text_editor',
value: opts.defaultEditorValue,
validationChecker: function(v){
return BI.isNaturalNumber(v);
},
errorText: BI.i18nText("BI-Please_Input_Integer"),
width: this.constants.textWidth,
height: this.constants.itemHeight
});
this.secondEditor.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.firstCombo = BI.createWidget({
type: "bi.small_text_value_combo",
width: this.constants.comboWidth,
height: this.constants.itemHeight,
items: BICst.BEFORE_AFTER_COMBO
});
this.secondCombo = BI.createWidget({
type: "bi.small_text_value_combo",
width: this.constants.comboWidth,
height: this.constants.itemHeight,
items: BICst.BEFORE_AFTER_COMBO
});
this.firstCombo.setValue(0);
this.secondCombo.setValue(0);
var textJson = this._getTextByDateType();
BI.createWidget({
type: 'bi.inline',
element: this,
items: [{
type: "bi.center_adapt",
items: [this.radio],
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, this.firstEditor, {
type: "bi.label",
textAlign: "center",
cls: 'param-label',
text: textJson.ftext,
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, this.firstCombo, {
type: "bi.label",
textAlign: "center",
cls: 'param-label',
text: BI.i18nText("BI-Basic_De"),
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, {
el: this.secondCombo,
rgap: 5
}, this.secondEditor, {
type: "bi.label",
textAlign: "left",
cls: 'param-label',
text: textJson.stext,
height: this.constants.itemHeight,
lgap: 5
}]
});
},
_getTextByDateType: function(){
switch (this.options.value) {
case BI.Param1DateItem.MONTH_WEEK:
return {ftext: BI.i18nText("BI-Basic_Month"), stext: BI.i18nText("BI-Week_De")};
case BI.Param1DateItem.MONTH_DAY:
return {ftext: BI.i18nText("BI-Basic_Month"), stext: BI.i18nText("BI-Day_De")};
case BI.Param1DateItem.YEAR_MONTH:
return {ftext: BI.i18nText("BI-Year"), stext: BI.i18nText("BI-Month_De")};
case BI.Param1DateItem.YEAR_DAY:
return {ftext: BI.i18nText("BI-Year"), stext: BI.i18nText("BI-Day_De")};
case BI.Param1DateItem.YEAR_QUARTER:
return {ftext: BI.i18nText("BI-Year"), stext: BI.i18nText("BI-Quarter_De")};
case BI.Param1DateItem.YEAR_WEEK:
return {ftext: BI.i18nText("BI-Year"), stext: BI.i18nText("BI-Week_De")};
}
},
_assertValue: function(v){
var o = this.options;
v = v || {};
v.fvalue = v.fvalue || o.defaultEditorValue;
v.foffset = v.foffset || 0;
v.svalue = v.svalue || o.defaultEditorValue;
v.soffset = v.soffset || 0;
return v;
},
setSelected: function (v) {
this.radio.setSelected(!!v);
},
isSelected: function () {
return this.radio.isSelected();
},
getValue: function () {
return this.options.value;
},
getInputValue: function(){
return {
fvalue: this.firstEditor.getValue() || 0,
foffset: this.firstCombo.getValue()[0],
svalue: this.secondEditor.getValue() || 0,
soffset: this.secondCombo.getValue()[0]
};
},
setInputValue: function (v) {
v = this._assertValue(v);
this.firstEditor.setValue(v.fvalue);
this.firstCombo.setValue([v.foffset]);
this.secondEditor.setValue(v.svalue);
this.secondCombo.setValue([v.soffset]);
},
setEnable: function (b) {
this.firstEditor.setEnable(!!b);
this.secondEditor.setEnable(!!b);
this.firstCombo.setEnable(!!b);
this.secondCombo.setEnable(!!b);
}
});
BI.Param1DateItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.extend(BI.Param1DateItem , {
YEAR_QUARTER: BICst.YEAR_QUARTER,
YEAR_MONTH: BICst.YEAR_MONTH,
YEAR_WEEK: BICst.YEAR_WEEK,
YEAR_DAY: BICst.YEAR_DAY,
MONTH_WEEK: BICst.MONTH_WEEK,
MONTH_DAY: BICst.MONTH_DAY
});
$.shortcut('bi.param1_date_item', BI.Param1DateItem);

187
src/widget/paramsettingcombo/param2.date.item.js

@ -1,187 +0,0 @@
/**
* 普通控件
*
* @class BI.Param2DateItem
* @extends BI.Single
*/
BI.Param2DateItem = BI.inherit(BI.Single, {
constants: {
itemHeight: 20,
itemWidth: 20,
textWidth: 40,
comboWidth: 45
},
_defaultConfig: function () {
return BI.extend(BI.Param2DateItem.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-param2-date-item',
value: BI.Param2DateItem.YEAR_DAY,
width: 310,
height: 20,
selected: false,
defaultEditorValue: "0"
});
},
_init: function () {
BI.Param2DateItem.superclass._init.apply(this, arguments);
var self = this, opts = this.options;
this.radio = BI.createWidget({
type: "bi.radio",
selected: opts.selected
});
this.radio.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.firstEditor = BI.createWidget({
type: 'bi.small_text_editor',
value: opts.defaultEditorValue,
validationChecker: function(v){
return BI.isNaturalNumber(v);
},
errorText: BI.i18nText("BI-Please_Input_Integer"),
width: this.constants.textWidth,
height: this.constants.itemHeight
});
this.firstEditor.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.secondEditor = BI.createWidget({
type: 'bi.small_text_editor',
value: opts.defaultEditorValue,
validationChecker: function(v){
return BI.isNaturalNumber(v);
},
errorText: BI.i18nText("BI-Please_Input_Integer"),
width: this.constants.textWidth,
height: this.constants.itemHeight
});
this.secondEditor.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.firstCombo = BI.createWidget({
type: "bi.small_text_value_combo",
width: this.constants.comboWidth,
height: this.constants.itemHeight,
items: BICst.BEFORE_AFTER_COMBO
});
this.secondCombo = BI.createWidget({
type: "bi.small_text_value_combo",
width: this.constants.comboWidth,
height: this.constants.itemHeight,
items: BICst.BEFORE_AFTER_COMBO
});
this.firstCombo.setValue(0);
this.secondCombo.setValue(0);
var textJson = this._getTextByDateType();
BI.createWidget({
type: 'bi.inline',
element: this,
items: [{
type: "bi.center_adapt",
items: [this.radio],
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, this.firstEditor, {
type: "bi.label",
textAlign: "center",
cls: 'param-label',
text: textJson.ftext,
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, this.firstCombo, {
type: "bi.label",
textAlign: "center",
cls: 'param-label',
text: BI.i18nText("BI-Basic_De"),
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, {
el: this.secondCombo,
rgap: 5
}, this.secondEditor, {
type: "bi.label",
textAlign: "left",
cls: 'param-label',
text: textJson.stext,
height: this.constants.itemHeight,
lgap: 5
}]
});
},
_getTextByDateType: function(){
switch (this.options.value) {
case BI.Param2DateItem.MONTH_WEEK:
return {ftext: BI.i18nText("BI-Basic_Month"), stext: BI.i18nText("BI-Week_Of_Week")};
case BI.Param2DateItem.MONTH_DAY:
return {ftext: BI.i18nText("BI-Basic_Month"), stext: BI.i18nText("BI-Day_De")};
case BI.Param2DateItem.YEAR_MONTH:
return {ftext: BI.i18nText("BI-Year"), stext: BI.i18nText("BI-Month_De_Month")};
case BI.Param2DateItem.YEAR_DAY:
return {ftext: BI.i18nText("BI-Year"), stext: BI.i18nText("BI-Day_De")};
case BI.Param2DateItem.YEAR_QUARTER:
return {ftext: BI.i18nText("BI-Year"), stext: BI.i18nText("BI-Quarter_Of_Quarter")};
case BI.Param2DateItem.YEAR_WEEK:
return {ftext: BI.i18nText("BI-Year"), stext: BI.i18nText("BI-Week_Of_Week")};
}
},
_assertValue: function(v){
var o = this.options;
v = v || {};
v.fvalue = v.fvalue || o.defaultEditorValue;
v.foffset = v.foffset || 0;
v.svalue = v.svalue || o.defaultEditorValue;
v.soffset = v.soffset || 0;
return v;
},
setSelected: function (v) {
this.radio.setSelected(!!v);
},
isSelected: function () {
return this.radio.isSelected();
},
getValue: function () {
return this.options.value;
},
getInputValue: function(){
return {
fvalue: this.firstEditor.getValue() || 0,
foffset: this.firstCombo.getValue()[0],
svalue: this.secondEditor.getValue() || 0,
soffset: this.secondCombo.getValue()[0]
};
},
setInputValue: function (v) {
v = this._assertValue(v);
this.firstEditor.setValue(v.fvalue);
this.firstCombo.setValue([v.foffset]);
this.secondEditor.setValue(v.svalue);
this.secondCombo.setValue([v.soffset]);
},
setEnable: function (b) {
this.firstEditor.setEnable(!!b);
this.secondEditor.setEnable(!!b);
this.firstCombo.setEnable(!!b);
this.secondCombo.setEnable(!!b);
}
});
BI.Param2DateItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.extend(BI.Param2DateItem , {
YEAR_QUARTER: BICst.YEAR_QUARTER,
YEAR_MONTH: BICst.YEAR_MONTH,
YEAR_WEEK: BICst.YEAR_WEEK,
YEAR_DAY: BICst.YEAR_DAY,
MONTH_WEEK: BICst.MONTH_WEEK,
MONTH_DAY: BICst.MONTH_DAY
});
$.shortcut('bi.param2_date_item', BI.Param2DateItem);

131
src/widget/paramsettingcombo/param3.date.item.js

@ -1,131 +0,0 @@
/**
* 普通控件
*
* @class BI.Param3DateItem
* @extends BI.Single
*/
BI.Param3DateItem = BI.inherit(BI.Single, {
constants: {
itemHeight: 20,
itemWidth: 20,
textWidth: 40,
comboWidth: 45
},
_defaultConfig: function () {
return BI.extend(BI.Param3DateItem.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-param3-date-item',
width: 310,
height: 20,
selected: false,
defaultEditorValue: "0"
});
},
_init: function () {
BI.Param3DateItem.superclass._init.apply(this, arguments);
var self = this, opts = this.options;
this.radio = BI.createWidget({
type: "bi.radio",
selected: opts.selected
});
this.radio.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.firstEditor = BI.createWidget({
type: 'bi.small_text_editor',
value: opts.defaultEditorValue,
validationChecker: function(v){
return BI.isNaturalNumber(v);
},
errorText: BI.i18nText("BI-Please_Input_Integer"),
width: this.constants.textWidth,
height: this.constants.itemHeight
});
this.firstEditor.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.firstCombo = BI.createWidget({
type: "bi.small_text_value_combo",
width: this.constants.comboWidth,
height: this.constants.itemHeight,
items: BICst.BEFORE_AFTER_COMBO
});
this.firstCombo.setValue(0);
BI.createWidget({
type: 'bi.inline',
element: this,
items: [{
type: "bi.center_adapt",
items: [this.radio],
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, this.firstEditor, {
type: "bi.label",
textAlign: "center",
cls: 'param-label',
text: BI.i18nText("BI-Year"),
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, this.firstCombo, {
type: "bi.label",
textAlign: "center",
cls: 'param-label',
text: BI.i18nText("BI-Basic_De"),
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, {
type: "bi.label",
textAlign: "left",
cls: 'param-label',
text: BI.i18nText("BI-Multi_Date_Year_Begin"),
height: this.constants.itemHeight,
lgap: 5
}]
});
},
_assertValue: function(v){
var o = this.options;
v = v || {};
v.fvalue = v.fvalue || o.defaultEditorValue;
v.foffset = v.foffset || 0;
return v;
},
setSelected: function (v) {
this.radio.setSelected(!!v);
},
isSelected: function () {
return this.radio.isSelected();
},
getInputValue: function () {
return {
fvalue: this.firstEditor.getValue() || 0,
foffset: this.firstCombo.getValue()[0]
};
},
setInputValue: function (v) {
v = this._assertValue(v);
this.firstEditor.setValue(v.fvalue);
this.firstCombo.setValue([v.foffset]);
},
getValue: function(){
return BICst.YEAR;
},
setEnable: function (b) {
this.firstEditor.setEnable(!!b);
this.firstCombo.setEnable(!!b);
}
});
BI.Param3DateItem.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.param3_date_item', BI.Param3DateItem);

134
src/widget/paramsettingcombo/popup.param.js

@ -1,134 +0,0 @@
/**
* 普通控件
*
* @class BI.ParamPopupView
* @extends BI.Widget
* @abstract
*/
BI.ParamPopupView = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.ParamPopupView.superclass._defaultConfig.apply(this, arguments), {});
},
dateConfig: function(){
},
_init: function () {
BI.ParamPopupView.superclass._init.apply(this, arguments);
var self = this;
this.radioGroup = BI.createWidget({
type: "bi.button_group",
chooseType: 0,
items: this.dateConfig(),
layouts: [{
type: "bi.vertical",
items: [{
type: "bi.vertical",
vgap: 5
}],
vgap: 5,
hgap: 5
}]
});
this.radioGroup.on(BI.ButtonGroup.EVENT_CHANGE, function () {
self.setValue(self.getValue());
self.fireEvent(BI.ParamPopupView.EVENT_CHANGE);
});
this.popup = BI.createWidget({
type: 'bi.multi_popup_view',
element: this,
el: this.radioGroup,
minWidth: 310,
stopPropagation: false
});
this.popup.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, function () {
self.fireEvent(BI.ParamPopupView.EVENT_CONFIRM);
});
},
setValue: function (v) {
this.radioGroup.setValue(v.type);
BI.each(this.radioGroup.getAllButtons(), function (i, button) {
if (button.isSelected()) {
button.setEnable(true);
button.setInputValue(v.value);
} else {
button.setEnable(false);
}
});
},
getValue: function () {
var button = this.radioGroup.getSelectedButtons()[0];
var type = button.getValue(), value = button.getInputValue();
return {
type: type,
value: value
}
},
getCalculationValue: function () {
var valueObject = this.getValue();
var type = valueObject.type, value = valueObject.value;
var fPrevOrAfter = value.foffset === 0 ? -1 : 1;
var sPrevOrAfter = value.soffset === 0 ? -1 : 1;
var start, end;
start = end = new Date();
var ydate = new Date((new Date().getFullYear() + fPrevOrAfter * value.fvalue), new Date().getMonth(), new Date().getDate());
switch (type) {
case BICst.YEAR:
start = new Date((new Date().getFullYear() + fPrevOrAfter * value.fvalue), 0, 1);
end = new Date(start.getFullYear(), 11, 31);
break;
case BICst.YEAR_QUARTER:
ydate = new Date().getOffsetQuarter(ydate, sPrevOrAfter * value.svalue);
start = ydate.getQuarterStartDate();
end = ydate.getQuarterEndDate();
break;
case BICst.YEAR_MONTH:
ydate = new Date().getOffsetMonth(ydate, sPrevOrAfter * value.svalue);
start = new Date(ydate.getFullYear(), ydate.getMonth(), 1);
end = new Date(ydate.getFullYear(), ydate.getMonth(), (ydate.getLastDateOfMonth()).getDate());
break;
case BICst.YEAR_WEEK:
start = ydate.getOffsetDate(sPrevOrAfter * 7 * value.svalue);
end = start.getOffsetDate(7);
break;
case BICst.YEAR_DAY:
start = ydate.getOffsetDate(sPrevOrAfter * value.svalue);
end = start.getOffsetDate(1);
break;
case BICst.MONTH_WEEK:
var mdate = new Date().getOffsetMonth(new Date(), fPrevOrAfter * value.fvalue);
start = mdate.getOffsetDate(sPrevOrAfter * 7 * value.svalue);
end = start.getOffsetDate(7);
break;
case BICst.MONTH_DAY:
var mdate = new Date().getOffsetMonth(new Date(), fPrevOrAfter * value.fvalue);
start = mdate.getOffsetDate(sPrevOrAfter * value.svalue);
end = start.getOffsetDate(1);
break;
}
return {
start: start,
end: end
};
},
resetWidth: function(w){
this.popup.resetWidth(w);
},
resetHeight: function(h){
this.popup.resetHeight(h);
}
});
BI.ParamPopupView.EVENT_CHANGE = "EVENT_CHANGE";
BI.ParamPopupView.EVENT_CONFIRM = "EVENT_CONFIRM";
$.shortcut("bi.param_popup_view", BI.ParamPopupView);

46
src/widget/paramsettingcombo/rangevaluecombo/rangevaluecombo.js

@ -1,46 +0,0 @@
/**
* @class BI.RangeValueCombo
* @extend BI.Widget
*/
BI.RangeValueCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.RangeValueCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-range-value-combo",
width: 100,
height: 30
})
},
_init: function () {
BI.RangeValueCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.dateRangeCombo = BI.createWidget({
type: "bi.text_value_combo",
height: o.height,
width: o.width,
items: BICst.Date_Range_FILTER_COMBO
});
this.dateRangeCombo.on(BI.TextValueCombo.EVENT_CHANGE, function(){
self.fireEvent(BI.RangeValueCombo.EVENT_CHANGE);
});
BI.createWidget({
type: "bi.default",
element: this,
items: [this.dateRangeCombo]
});
},
setValue: function (v) {
v = v || {};
this.dateRangeCombo.setValue(v.type);
},
getValue: function () {
return {
type: this.dateRangeCombo.getValue()[0]
};
}
});
BI.RangeValueCombo.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.range_value_combo", BI.RangeValueCombo);

99
src/widget/paramsettingcombo/yearcombo/combo.param.year.js

@ -1,99 +0,0 @@
/**
* @class BI.YearParamCombo
* @extend BI.Widget
* combo : text + icon, popup : text
* 参见场景dashboard布局方式选择
*/
BI.YearParamCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearParamCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-param-combo",
width: 130,
height: 30
})
},
_init: function () {
BI.YearParamCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.text_trigger",
cls: "param-trigger",
height: o.height - 2
});
this.popup = BI.createWidget({
type: 'bi.multi_popup_view',
el: {
type: "bi.button_tree",
chooseType: BI.Selection.None,
items: [{
type: "bi.year_param_item"
}],
layouts: [{
type: "bi.vertical",
vgap: 5,
hgap: 5
}]
},
minWidth: 310,
maxHeight: 300,
stopPropagation: false
});
this.popup.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, function () {
self.YearParamCombo.hideView();
});
this.YearParamCombo = BI.createWidget({
type: "bi.combo",
element: this,
adjustLength: 2,
el: this.trigger,
popup: this.popup
});
this.YearParamCombo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
self.setValue(self.getValue());
self.fireEvent(BI.YearParamCombo.EVENT_CONFIRM);
});
this.YearParamCombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.setValue(self.getValue());
});
},
_getShowTextByValue: function(v){
v = v || {};
return v.fvalue + BI.i18nText("BI-Year") +
(v.foffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) +
BI.i18nText("BI-Basic_De") + BI.i18nText("BI-Year_Fen");
},
getCalculationValue: function () {
var value = this.YearParamCombo.getValue()[0];
var fPrevOrAfter = value.foffset === 0 ? -1 : 1;
var start = new Date((new Date().getFullYear() + fPrevOrAfter * value.fvalue), 0, 1);
var end = new Date(start.getFullYear(), 11, 31);
return {
start: start,
end: end
};
},
setValue: function (v) {
v = v || {};
this.YearParamCombo.setValue(v.value);
this.trigger.setValue(this._getShowTextByValue(v.value));
},
getValue: function () {
return {
type: BICst.YEAR,
value: this.YearParamCombo.getValue()[0]
}
}
});
BI.YearParamCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
$.shortcut("bi.year_param_combo", BI.YearParamCombo);

105
src/widget/paramsettingcombo/yearcombo/param.year.item.js

@ -1,105 +0,0 @@
/**
* 普通控件
*
* @class BI.YearParamItem
* @extends BI.Single
*/
BI.YearParamItem = BI.inherit(BI.Single, {
constants: {
itemHeight: 20,
itemWidth: 20,
textWidth: 40,
comboWidth: 45
},
_defaultConfig: function () {
return BI.extend(BI.YearParamItem.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-year-param-item',
width: 310,
height: 20,
defaultEditorValue: "0"
});
},
_init: function () {
BI.YearParamItem.superclass._init.apply(this, arguments);
var self = this, opts = this.options;
this.firstEditor = BI.createWidget({
type: 'bi.small_text_editor',
value: opts.defaultEditorValue,
validationChecker: function(v){
return BI.isNaturalNumber(v);
},
errorText: BI.i18nText("BI-Please_Input_Integer"),
width: this.constants.textWidth,
height: this.constants.itemHeight
});
this.firstEditor.on(BI.Controller.EVENT_CHANGE, function (v) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.firstCombo = BI.createWidget({
type: "bi.small_text_value_combo",
width: this.constants.comboWidth,
height: this.constants.itemHeight,
items: BICst.BEFORE_AFTER_COMBO
});
this.firstCombo.setValue(0);
BI.createWidget({
type: 'bi.inline',
element: this,
items: [this.firstEditor, {
type: "bi.label",
textAlign: "center",
cls: 'param-label',
text: BI.i18nText("BI-Year"),
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, this.firstCombo, {
type: "bi.label",
textAlign: "center",
cls: 'param-label',
text: BI.i18nText("BI-Basic_De"),
width: this.constants.itemWidth,
height: this.constants.itemHeight
}, {
type: "bi.label",
textAlign: "left",
cls: 'param-label',
text: BI.i18nText("BI-Year_Fen"),
height: this.constants.itemHeight,
lgap: 5
}]
});
},
_assertValue: function(v){
var o = this.options;
if(BI.isArray(v)){
v = v[0];
}
v = v || {};
v.fvalue = v.fvalue || o.defaultEditorValue;
v.foffset = v.foffset || 0;
return v;
},
setValue: function (v) {
v = this._assertValue(v);
this.firstEditor.setValue(v.fvalue);
this.firstCombo.setValue([v.foffset]);
},
getValue: function(){
return {
fvalue: this.firstEditor.getValue() || 0,
foffset: this.firstCombo.getValue()[0]
};
}
});
BI.YearParamItem.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.year_param_item', BI.YearParamItem);

86
src/widget/paramsettingcombo/yearmonthcombo/combo.param.yearmonth.js

@ -1,86 +0,0 @@
/**
* @class BI.YearMonthParamCombo
* @extend BI.Widget
* combo : text + icon, popup : text
* 参见场景dashboard布局方式选择
*/
BI.YearMonthParamCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearMonthParamCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-month-param-combo",
width: 130,
height: 30
})
},
_init: function () {
BI.YearMonthParamCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.text_trigger",
cls: "param-trigger",
height: o.height - 2
});
this.popup = BI.createWidget({
type: "bi.year_month_param_popup_view",
maxHeight: 300
});
this.popup.on(BI.ParamPopupView.EVENT_CONFIRM, function(){
self.YearMonthParamCombo.hideView();
});
this.YearMonthParamCombo = BI.createWidget({
type: "bi.combo",
element: this,
adjustLength: 2,
el: this.trigger,
popup: this.popup
});
this.YearMonthParamCombo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
self.setValue(self.getValue());
self.fireEvent(BI.YearMonthParamCombo.EVENT_CONFIRM);
});
this.YearMonthParamCombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.setValue(self.getValue());
});
},
_getShowTextByValue: function(v){
v = v || {};
var value = v.value;
var midText = (value.foffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) +
BI.i18nText("BI-Basic_De") + (value.soffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) + value.svalue;
switch (v.type) {
case BICst.YEAR:
return value.fvalue + BI.i18nText("BI-Year") +
(value.foffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) +
BI.i18nText("BI-Basic_De") + BI.i18nText("BI-Year_Fen");
case BICst.YEAR_MONTH:
return value.fvalue + BI.i18nText("BI-Year") + midText + BI.i18nText("BI-Month_De");
}
},
setValue: function (v) {
this.YearMonthParamCombo.setValue(v);
this.trigger.setValue(this._getShowTextByValue(v));
},
setEnable: function (v) {
BI.YearMonthParamCombo.superclass.setEnable.apply(this, arguments);
this.YearMonthParamCombo.setEnable(v);
},
getValue: function () {
return this.YearMonthParamCombo.getValue();
},
getCalculationValue: function(){
return this.popup.getCalculationValue();
}
});
BI.YearMonthParamCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
$.shortcut("bi.year_month_param_combo", BI.YearMonthParamCombo);

31
src/widget/paramsettingcombo/yearmonthcombo/popup.param.yearmonth.js

@ -1,31 +0,0 @@
/**
* 普通控件
*
* @class BI.YearMonthParamPopupView
* @extends BI.ParamPopupView
*/
BI.YearMonthParamPopupView = BI.inherit(BI.ParamPopupView, {
_defaultConfig: function () {
return BI.extend(BI.YearMonthParamPopupView.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-year-month-param-popup'
});
},
_init: function () {
BI.YearMonthParamPopupView.superclass._init.apply(this, arguments);
},
dateConfig: function () {
return [{
type: "bi.param0_date_item",
selected: true
}, {
type: "bi.param2_date_item",
value: BI.Param2DateItem.YEAR_MONTH,
disabled: true
}]
}
});
BI.YearMonthParamPopupView.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.year_month_param_popup_view', BI.YearMonthParamPopupView);

87
src/widget/paramsettingcombo/yearseasoncombo/combo.param.yearseason.js

@ -1,87 +0,0 @@
/**
* @class BI.YearSeasonParamCombo
* @extend BI.Widget
* combo : text + icon, popup : text
* 参见场景dashboard布局方式选择
*/
BI.YearSeasonParamCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.YearSeasonParamCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-year-season-param-combo",
width: 130,
height: 30
})
},
_init: function () {
BI.YearSeasonParamCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.text_trigger",
cls: "param-trigger",
height: o.height - 2
});
this.popup = BI.createWidget({
type: "bi.year_season_param_popup_view",
maxHeight: 300
});
this.popup.on(BI.ParamPopupView.EVENT_CONFIRM, function(){
self.YearSeasonParamCombo.hideView();
});
this.YearSeasonParamCombo = BI.createWidget({
type: "bi.combo",
element: this,
adjustLength: 2,
el: this.trigger,
popup: this.popup
});
this.YearSeasonParamCombo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () {
self.setValue(self.getValue());
self.fireEvent(BI.YearSeasonParamCombo.EVENT_CONFIRM);
});
this.YearSeasonParamCombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () {
self.setValue(self.getValue());
});
},
_getShowTextByValue: function(v){
v = v || {};
var value = v.value;
var midText = (value.foffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) +
BI.i18nText("BI-Basic_De") + (value.soffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) + value.svalue;
switch (v.type) {
case BICst.YEAR:
return value.fvalue + BI.i18nText("BI-Year") +
(value.foffset === 0 ? BI.i18nText("BI-Qian_First") : BI.i18nText("BI-Hou_Last")) +
BI.i18nText("BI-Basic_De") + BI.i18nText("BI-Year_Fen");
case BICst.YEAR_QUARTER:
return value.fvalue + BI.i18nText("BI-Year") + midText + BI.i18nText("BI-Quarter_De");
}
},
setValue: function (v) {
this.YearSeasonParamCombo.setValue(v);
this.trigger.setValue(this._getShowTextByValue(v));
},
setEnable: function (v) {
BI.YearSeasonParamCombo.superclass.setEnable.apply(this, arguments);
this.YearSeasonParamCombo.setEnable(v);
},
getValue: function () {
return this.YearSeasonParamCombo.getValue();
//return BI.extend(this.popup.getCalculationValue(), this.YearSeasonParamCombo.getValue());
},
getCalculationValue: function(){
return this.popup.getCalculationValue();
}
});
BI.YearSeasonParamCombo.EVENT_CONFIRM = "EVENT_CONFIRM";
$.shortcut("bi.year_season_param_combo", BI.YearSeasonParamCombo);

31
src/widget/paramsettingcombo/yearseasoncombo/popup.param.yearseason.js

@ -1,31 +0,0 @@
/**
* 普通控件
*
* @class BI.YearSeasonParamPopupView
* @extends BI.ParamPopupView
*/
BI.YearSeasonParamPopupView = BI.inherit(BI.ParamPopupView, {
_defaultConfig: function () {
return BI.extend(BI.YearSeasonParamPopupView.superclass._defaultConfig.apply(this, arguments), {
baseCls: 'bi-year-season-param-popup'
});
},
_init: function () {
BI.YearSeasonParamPopupView.superclass._init.apply(this, arguments);
},
dateConfig: function () {
return [{
type: "bi.param0_date_item",
selected: true
}, {
type: "bi.param1_date_item",
value: BI.Param1DateItem.YEAR_QUARTER,
disabled: true
}]
}
});
BI.YearSeasonParamPopupView.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.year_season_param_popup_view', BI.YearSeasonParamPopupView);

129
src/widget/selectdata/searcher/searcher.selectdata.js

@ -1,129 +0,0 @@
/**
* 完成搜索功能模块
*
* Created by GUY on 2015/9/16.
* @class BI.SelectDataSearcher
* @extends BI.Widget
*/
BI.SelectDataSearcher = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SelectDataSearcher.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-data-searcher",
packages: [],
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.SelectDataSearcher.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.packagePane = BI.createWidget({
type: "bi.select_data_switcher",
packages: o.packages,
itemsCreator: function (op) {
op.packageId = self.getPackageId();
if (!op.packageId) {
return;
}
o.itemsCreator.apply(self, arguments);
}
});
this.packagePane.on(BI.SelectDataSwitcher.EVENT_CHANGE, function () {
self.fireEvent(BI.SelectDataSearcher.EVENT_CLICK_PACKAGE, arguments);
});
this.packagePane.on(BI.SelectDataSwitcher.EVENT_CLICK_ITEM, function () {
self.fireEvent(BI.SelectDataSearcher.EVENT_CLICK_ITEM, arguments);
});
this.searcherPane = BI.createWidget({
type: "bi.select_data_search_result_pane",
itemsCreator: function (op) {
op.packageId = self.getPackageId();
if (!op.packageId) {
return;
}
o.itemsCreator.apply(self, arguments);
}
});
this.searcherPane.on(BI.SelectDataSearchResultPane.EVENT_SEARCH_TYPE_CHANGE, function () {
self.searcher.doSearch();
});
this.searcherPane.on(BI.SelectDataSearchResultPane.EVENT_CHANGE, function () {
self.fireEvent(BI.SelectDataSearcher.EVENT_CLICK_ITEM, arguments);
});
this.searcher = BI.createWidget({
type: "bi.searcher",
el: {
type: "bi.small_search_editor"
},
isAutoSearch: false, //是否自动搜索
isAutoSync: false,
onSearch: function (op, populate) {
o.itemsCreator(BI.extend(op, {
packageId: self.getPackageId(),
searchType: self.searcherPane.getSegmentValue()
}), function (searchResult, matchResult) {
populate(searchResult, matchResult, op.keyword);
})
},
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
popup: this.searcherPane,
adapter: this.packagePane
});
BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: {
type: "bi.absolute",
items: [{
el: this.searcher,
left: 10,
right: 10,
top: 10
}]
},
height: 45
}, this.packagePane]
})
},
setEnable: function (v) {
BI.SelectDataSearcher.superclass.setEnable.apply(this, arguments);
this.packagePane.setEnable(v)
},
setPackage: function (pId) {
this.packagePane.setPackage(pId);
},
getPackageId: function () {
return this.packagePane.getPackageId();
},
setValue: function (v) {
},
getValue: function () {
return this.searcher.getValue();
},
populatePackages: function (packages) {
this.options.packages = packages;
this.packagePane.populatePackages(packages);
this.searcher.stopSearch();
this.populate();
},
populate: function () {
this.packagePane.populate.apply(this.packagePane, arguments);
}
});
BI.SelectDataSearcher.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.SelectDataSearcher.EVENT_CLICK_PACKAGE = "EVENT_CLICK_PACKAGE";
$.shortcut('bi.select_data_searcher', BI.SelectDataSearcher);

100
src/widget/selectdata/searchpane/result.search.selectdata.js

@ -1,100 +0,0 @@
/**
* 搜索结果面板
*
* Created by GUY on 2015/9/16.
* @class BI.SelectDataSearchResultPane
* @extends BI.Widget
*/
BI.SelectDataSearchResultPane = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SelectDataSearchResultPane.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-data-search-result-pane bi-searcher-view",
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.SelectDataSearchResultPane.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.segment = BI.createWidget({
type: "bi.select_data_search_segment",
cls: "search-result-toolbar"
});
this.segment.on(BI.SelectDataSearchSegment.EVENT_CHANGE, function () {
self.fireEvent(BI.SelectDataSearchResultPane.EVENT_SEARCH_TYPE_CHANGE);
});
this.resultPane = BI.createWidget({
type: "bi.searcher_view",
matcher: {
type: "bi.select_data_tree",
itemsCreator: o.itemsCreator
},
searcher: {
type: "bi.select_data_tree",
itemsCreator: o.itemsCreator
}
});
this.resultPane.on(BI.SearcherView.EVENT_CHANGE, function () {
self.fireEvent(BI.SelectDataSearchResultPane.EVENT_CHANGE, arguments);
});
BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: this.segment,
height: 60
}, {
type: "bi.border",
cls: "search-result-line",
height: 2
}, {
type: "bi.border",
cls: "search-result-line",
height: 1
}, {
type: "bi.absolute",
items: [{
el: this.resultPane,
left: 0,
right: 0,
top: 0,
bottom: 0
}]
}]
});
},
startSearch: function () {
},
stopSearch: function () {
},
empty: function () {
this.resultPane.empty();
},
populate: function (searchResult, matchResult, keyword) {
this.resultPane.populate.apply(this.resultPane, arguments);
},
setValue: function (v) {
},
getSegmentValue: function () {
return this.segment.getValue();
},
getValue: function () {
return this.resultPane.getValue();
}
});
BI.SelectDataSearchResultPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.SelectDataSearchResultPane.EVENT_SEARCH_TYPE_CHANGE = "EVENT_SEARCH_TYPE_CHANGE";
$.shortcut('bi.select_data_search_result_pane', BI.SelectDataSearchResultPane);

114
src/widget/selectdata/searchpane/segment.search.selectdata.js

@ -1,114 +0,0 @@
/**
* search面板选项栏
*
* Created by GUY on 2015/9/16.
* @class BI.SelectDataSearchSegment
* @extends BI.Widget
*/
BI.SelectDataSearchSegment = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SelectDataSearchSegment.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-data-search-segment",
height: 60
});
},
//创建所有数据和业务包选项
_createSectionTab: function () {
var self = this;
this.pack = BI.createWidget({
type: "bi.line_segment_button",
height: 24,
selected: true,
text: BI.i18nText("BI-Current_Package"),
value: BI.SelectDataSearchSegment.SECTION_PACKAGE
});
this.all = BI.createWidget({
type: "bi.line_segment_button",
height: 24,
text: BI.i18nText("BI-All_Data"),
value: BI.SelectDataSearchSegment.SECTION_ALL
});
this.button_group = BI.createWidget({
type: "bi.line_segment",
height: 25,
items: [this.all, this.pack]
});
this.button_group.on(BI.ButtonGroup.EVENT_CHANGE, function () {
self.fireEvent(BI.SelectDataSearchSegment.EVENT_CHANGE);
});
return this.button_group;
},
_createSegmet: function () {
var self = this;
this.segment = BI.createWidget({
type: "bi.segment",
height: 20,
cls: "search-segment-field-table",
items: [{
text: BI.i18nText("BI-Basic_Field"),
selected: true,
value: BI.SelectDataSearchSegment.SECTION_FIELD
}, {
text: BI.i18nText("BI-Basic_Table"),
value: BI.SelectDataSearchSegment.SECTION_TABLE
}]
});
this.segment.on(BI.Segment.EVENT_CHANGE, function () {
self.fireEvent(BI.SelectDataSearchSegment.EVENT_CHANGE);
});
return this.segment;
},
_init: function () {
BI.SelectDataSearchSegment.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.vertical",
element: this,
items: [this._createSectionTab(), {
type: "bi.absolute",
height: 35,
items: [{
el: this._createSegmet(),
top: 10,
right: 10,
left: 10,
bottom: 5
}]
}]
});
},
setValue: function (v) {
var self = this;
BI.each([BI.SelectDataSearchSegment.SECTION_ALL,
BI.SelectDataSearchSegment.SECTION_PACKAGE], function (i, key) {
if (key & v) {
self.button_group.setValue(key & v);
}
});
BI.each([BI.SelectDataSearchSegment.SECTION_FIELD,
BI.SelectDataSearchSegment.SECTION_TABLE], function (i, key) {
if (key & v) {
self.segment.setValue(key & v);
}
});
},
getValue: function () {
return this.button_group.getValue()[0] | this.segment.getValue()[0]
}
});
BI.extend(BI.SelectDataSearchSegment, {
SECTION_ALL: 0x1,
SECTION_PACKAGE: 0x10,
SECTION_FIELD: 0x100,
SECTION_TABLE: 0x1000
});
BI.SelectDataSearchSegment.EVENT_CHANGE = "SelectDataSearchSegment.EVENT_CHANGE";
$.shortcut('bi.select_data_search_segment', BI.SelectDataSearchSegment);

99
src/widget/selectdata/switcher/switcher.selectdata.js

@ -1,99 +0,0 @@
/**
* 切换业务包
*
* Created by GUY on 2015/9/16.
* @class BI.SelectDataSwitcher
* @extends BI.Widget
*/
BI.SelectDataSwitcher = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SelectDataSwitcher.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-data-switcher",
packages: [],
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.SelectDataSwitcher.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.combo = BI.createWidget({
type: "bi.single_tree_combo",
height: 25,
items: o.packages
});
this.combo.on(BI.SingleTreeCombo.EVENT_CHANGE, function () {
self.tree.populate();
self.fireEvent(BI.SelectDataSwitcher.EVENT_CHANGE, arguments);
});
this.tree = BI.createWidget({
type: "bi.select_data_tree",
itemsCreator: function () {
var args = Array.prototype.slice.call(arguments, 0);
args[0].packageId = self.getPackageId();
o.itemsCreator.apply(self, args);
}
});
this.tree.on(BI.SelectDataTree.EVENT_CHANGE, function () {
self.fireEvent(BI.SelectDataSwitcher.EVENT_CLICK_ITEM, arguments);
});
BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: {
type: "bi.absolute",
hgap: 10,
items: [{
el: this.combo
}]
},
height: 30
}, {
el: this.tree
}]
});
},
setEnable: function (v) {
BI.SelectDataSwitcher.superclass.setEnable.apply(this, arguments);
this.tree.setEnable(v)
},
setPackage: function (pId) {
this.combo.setValue([pId]);
this.tree.populate();
},
getPackageId: function () {
return this.combo.getValue()[0];
},
setValue: function (v) {
this.tree.setValue(v);
},
getValue: function () {
return this.tree.getValue();
},
populate: function () {
this.tree.populate.apply(this.tree, arguments);
},
populatePackages: function (pacakges) {
this.options.packages = pacakges;
var pId = this.getPackageId();
this.combo.populate(pacakges);
if (BI.isKey(pId)) {
this.combo.setValue(pId);
}
}
});
BI.SelectDataSwitcher.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.SelectDataSwitcher.EVENT_CHANGE = "SelectDataSwitcher.EVENT_CHANGE";
$.shortcut('bi.select_data_switcher', BI.SelectDataSwitcher);

93
src/widget/selectdata/tree/expander.selectdata.js

@ -1,93 +0,0 @@
/**
* 字段列表展开Expander
*
* Created by GUY on 2015/9/14.
* @class BI.SelectDataExpander
* @extends BI.Widget
*/
BI.SelectDataExpander = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SelectDataExpander.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-data-expander",
el: {},
popup: {
items: [],
itemsCreator: BI.emptyFn
}
});
},
_init: function () {
BI.SelectDataExpander.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget(o.el);
this.expander = BI.createWidget({
type: "bi.expander",
element: this,
isDefaultInit: false,
el: this.trigger,
popup: BI.extend({
type: "bi.select_data_loader"
}, o.popup)
});
this.expander.on(BI.Controller.EVENT_CHANGE, function (type) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.expander.on(BI.Expander.EVENT_EXPAND, function(){
});
this.expander.on(BI.Expander.EVENT_COLLAPSE, function(){
this.getView().hideView();
});
this.expander.on(BI.Expander.EVENT_AFTER_INIT, function () {
this.getView().populate();
});
this.expander.on(BI.Expander.EVENT_CHANGE, function () {
self.trigger.setValue(this.getValue());
});
},
setEnable: function (v) {
BI.SelectDataExpander.superclass.setEnable.apply(this, arguments)
this.expander.setEnable(v);
this.trigger.setEnable(v)
},
doBehavior: function () {
this.trigger.doRedMark.apply(this.trigger, arguments);
this.expander.doBehavior.apply(this.expander, arguments);
},
setValue: function (v) {
this.expander.setValue(v);
},
getValue: function () {
return this.expander.getValue();
},
showView: function(b){
this.expander.showView();
},
hideView: function(){
this.expander.hideView();
},
isExpanded: function () {
return this.expander.isExpanded();
},
getAllLeaves: function () {
return this.expander.getAllLeaves();
},
getNodeById: function (id) {
return this.expander.getNodeById(id);
},
getNodeByValue: function (value) {
return this.expander.getNodeByValue(value);
}
});
$.shortcut("bi.select_data_expander", BI.SelectDataExpander);

129
src/widget/selectdata/tree/loader.selectdata.js

@ -1,129 +0,0 @@
/**
* 字段列表
*
* Created by GUY on 2015/9/14.
* @class BI.SelectDataLoader
* @extends BI.Widget
*/
BI.SelectDataLoader = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SelectDataLoader.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-data-loader",
items: [],
el: {},
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.SelectDataLoader.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.loader = BI.createWidget({
type: "bi.loader",
isDefaultInit: false,
element: this,
items: o.items,
itemsCreator: o.itemsCreator,
el: BI.extend({
type: "bi.button_tree",
behaviors: {
redmark: function () {
return true;
}
},
chooseType: BI.Selection.Multi,
layouts: [{
type: "bi.vertical",
hgap: 0,
vgap: 0
}]
}, o.el)
});
this.loader.on(BI.Controller.EVENT_CHANGE, function (type, val, ob) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
if (ob.isSelected()) {
var index = this.getIndexByValue(val);
if (index > -1) {
var alls = this.getAllButtons();
if (index - 1 >= 0) {
if (BI.isNotNull(alls[index - 1]) && BI.isFunction(alls[index - 1].isSelected)
&& alls[index - 1].isSelected()) {
alls[index - 1].setBottomLineVisible();
ob.setTopLineVisible();
}
}
if (index + 1 <= alls.length - 1) {
if (BI.isNotNull(alls[index + 1]) && BI.isFunction(alls[index + 1].isSelected)
&& alls[index + 1].isSelected()) {
alls[index + 1].setTopLineVisible();
ob.setBottomLineVisible();
}
}
}
} else {
var index = this.getIndexByValue(val);
if (index > -1) {
var alls = this.getAllButtons();
if (index - 1 >= 0) {
if (BI.isNotNull(alls[index - 1]) && BI.isFunction(alls[index - 1].isSelected)
&& alls[index - 1].isSelected()) {
alls[index - 1].setBottomLineInVisible();
}
}
if (index + 1 <= alls.length - 1) {
if (BI.isNotNull(alls[index + 1]) && BI.isFunction(alls[index + 1].isSelected)
&& alls[index + 1].isSelected()) {
alls[index + 1].setTopLineInVisible();
}
}
}
}
self.fireEvent(BI.SelectDataLoader.EVENT_CHANGE);
}
})
},
setEnable: function (v) {
BI.SelectDataLoader.superclass.setEnable.apply(this, arguments);
this.loader.setEnable(v)
},
doBehavior: function () {
this.loader.doBehavior.apply(this.loader, arguments);
},
populate: function () {
this.loader.populate.apply(this.loader, arguments);
},
getAllButtons: function(){
return this.loader.getAllButtons();
},
showView: function(b){
BI.each(this.loader.getAllButtons(),function(i, button){
button.showView && button.showView(b);
})
},
hideView: function(b){
BI.each(this.loader.getAllButtons(),function(i, button){
button.hideView && button.hideView(b);
})
},
setValue: function (v) {
this.loader.setValue(v);
},
getValue: function () {
return this.loader.getValue();
},
empty: function () {
this.loader.empty();
}
});
BI.SelectDataLoader.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.select_data_loader", BI.SelectDataLoader);

111
src/widget/selectdata/tree/node/node.level.js

@ -1,111 +0,0 @@
/**
* Created by GUY on 2015/9/6.
* @class BI.SelectDataLevelNode
* @extends BI.NodeButton
*/
BI.SelectDataLevelNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
return BI.extend(BI.SelectDataLevelNode.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-select-data-level0-node bi-list-item",
id: "",
pId: "",
layer: 0,
open: false,
height: 25
})
},
_init: function () {
var title = this.options.title;
var warningTitle = this.options.warningTitle;
this.options.title = "";
this.options.warningTitle = "";
BI.SelectDataLevelNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.tree_group_node_checkbox"
});
this.text = BI.createWidget({
type: "bi.label",
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
title: title,
warningTitle: warningTitle,
disabled: o.disabled,
py: o.py
});
this.tip = BI.createWidget({
type: "bi.label",
cls: "select-data-selected-count-label",
whiteSpace: "nowrap",
width: 25,
height: o.height
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected());
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
BI.createWidget({
type: "bi.htape",
element: this,
items: [{
el: {
type: "bi.layout"
},
width: o.layer * 20
}, {
width: 23,
el: this.checkbox
}, {
el: this.text
}, {
width: 25,
el: this.tip
}]
})
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doClick: function () {
BI.SelectDataLevelNode.superclass.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isOpened());
},
setOpened: function (v) {
BI.SelectDataLevelNode.superclass.setOpened.apply(this, arguments);
this.checkbox.setSelected(v);
},
setValue: function (items) {
BI.SelectDataLevelNode.superclass.setValue.apply(this, arguments);
if (BI.isEmpty(items)) {
this.tip.setText("");
} else {
this.tip.setText("(" + items.length + ")");
}
this.tip.setTitle(items.toString());
},
setEnable: function (b) {
BI.SelectDataLevelNode.superclass.setEnable.apply(this, arguments);
this.checkbox.setEnable(b);
this.text.setEnable(b);
}
});
$.shortcut("bi.select_data_level_node", BI.SelectDataLevelNode);

105
src/widget/selectdata/tree/node/node.level1.date.js

@ -1,105 +0,0 @@
/**
* Created by GUY on 2015/9/15.
* @class BI.SelectDataLevel1DateNode
* @extends BI.NodeButton
*/
BI.SelectDataLevel1DateNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
return BI.extend(BI.SelectDataLevel1DateNode.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-select-data-level1-date-node bi-list-item",
id: "",
pId: "",
layer: 1,
open: false,
height: 25
})
},
_getFieldClass: function (type) {
switch (type) {
case BICst.COLUMN.STRING:
return "select-data-field-string-group-font";
case BICst.COLUMN.NUMBER:
return "select-data-field-number-group-font";
case BICst.COLUMN.DATE:
return "select-data-field-date-group-font";
case BICst.COLUMN.COUNTER:
return "select-data-field-number-group-font";
default:
return "select-data-field-date-group-font";
}
},
_init: function () {
BI.SelectDataLevel1DateNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.button = BI.createWidget({
type: "bi.icon_text_item",
cls: this._getFieldClass(o.fieldType),
text: o.text,
value: o.value,
keyword: o.keyword,
height: o.height,
textLgap: 10,
textRgap: 5
});
this.checkbox = BI.createWidget({
type: "bi.tree_group_node_checkbox"
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected());
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.button.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
BI.createWidget({
type: "bi.htape",
element: this,
items: [{
el: {
type: "bi.layout"
},
width: o.layer * 20
}, {
el: this.button
}, {
el: this.checkbox,
width: 25
}]
})
},
doRedMark: function () {
this.button.doRedMark.apply(this.button, arguments);
},
unRedMark: function () {
this.button.unRedMark.apply(this.button, arguments);
},
doClick: function () {
BI.SelectDataLevel1DateNode.superclass.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isOpened());
},
setOpened: function (v) {
BI.SelectDataLevel1DateNode.superclass.setOpened.apply(this, arguments);
this.checkbox.setSelected(v);
},
setValue: function (items) {
BI.SelectDataLevel1DateNode.superclass.setValue.apply(this, arguments);
},
setEnable: function (b) {
BI.SelectDataLevel1DateNode.superclass.setEnable.apply(this, arguments);
this.checkbox.setEnable(b);
}
});
$.shortcut("bi.select_data_level1_date_node", BI.SelectDataLevel1DateNode);

105
src/widget/selectdata/tree/node/node.level2.date.js

@ -1,105 +0,0 @@
/**
* Created by GUY on 2015/9/15.
* @class BI.SelectDataLevel2DateNode
* @extends BI.NodeButton
*/
BI.SelectDataLevel2DateNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
return BI.extend(BI.SelectDataLevel2DateNode.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-select-data-level2-date-node bi-list-item",
id: "",
pId: "",
layer: 2,
open: false,
height: 25
})
},
_getFieldClass: function (type) {
switch (type) {
case BICst.COLUMN.STRING:
return "select-data-field-string-group-font";
case BICst.COLUMN.NUMBER:
return "select-data-field-number-group-font";
case BICst.COLUMN.DATE:
return "select-data-field-date-group-font";
case BICst.COLUMN.COUNTER:
return "select-data-field-number-group-font";
default:
return "select-data-field-date-group-font";
}
},
_init: function () {
BI.SelectDataLevel2DateNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.button = BI.createWidget({
type: "bi.icon_text_item",
cls: this._getFieldClass(o.fieldType),
text: o.text,
value: o.value,
keyword: o.keyword,
height: o.height,
textLgap: 10,
textRgap: 5
});
this.checkbox = BI.createWidget({
type: "bi.tree_group_node_checkbox"
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected());
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.button.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
BI.createWidget({
type: "bi.htape",
element: this,
items: [{
el: {
type: "bi.layout"
},
width: o.layer * 20
}, {
el: this.button
}, {
el: this.checkbox,
width: 25
}]
})
},
doRedMark: function () {
this.button.doRedMark.apply(this.button, arguments);
},
unRedMark: function () {
this.button.unRedMark.apply(this.button, arguments);
},
doClick: function () {
BI.SelectDataLevel2DateNode.superclass.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isOpened());
},
setOpened: function (v) {
BI.SelectDataLevel2DateNode.superclass.setOpened.apply(this, arguments);
this.checkbox.setSelected(v);
},
setValue: function (items) {
BI.SelectDataLevel2DateNode.superclass.setValue.apply(this, arguments);
},
setEnable: function (b) {
BI.SelectDataLevel2DateNode.superclass.setEnable.apply(this, arguments);
this.checkbox.setEnable(b);
}
});
$.shortcut("bi.select_data_level2_date_node", BI.SelectDataLevel2DateNode);

91
src/widget/selectdata/tree/tree.selectdata.js

@ -1,91 +0,0 @@
/**
* 字段列表展开Expander
*
* Created by GUY on 2015/9/14.
* @class BI.SelectDataTree
* @extends BI.Widget
*/
BI.SelectDataTree = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SelectDataTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-select-data-tree",
el: {},
expander: {},
items: [],
itemsCreator: BI.emptyFn
});
},
_init: function () {
BI.SelectDataTree.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.tree = BI.createWidget({
type: "bi.custom_tree",
element: this,
expander: BI.extend({
type: "bi.select_data_expander",
el: {},
popup: {
type: "bi.select_data_tree"
}
}, o.expander),
items: o.items,
itemsCreator: o.itemsCreator,
el: BI.extend({
type: "bi.select_data_loader"
}, o.el)
});
this.tree.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.tree.on(BI.CustomTree.EVENT_CHANGE, function () {
self.fireEvent(BI.SelectDataTree.EVENT_CHANGE, arguments);
})
},
setEnable: function (v) {
BI.SelectDataTree.superclass.setEnable.apply(this, arguments);
this.tree.setEnable(v)
},
showView: function(b){
BI.each(this.tree.getAllButtons(),function(i, button){
button.showView && button.showView(b);
})
},
hideView: function(b){
BI.each(this.tree.getAllButtons(),function(i, button){
button.hideView && button.hideView(b);
})
},
getAllButtons: function(){
return this.tree.getAllButtons();
},
doBehavior: function () {
this.tree.doBehavior.apply(this.tree, arguments);
},
empty: function () {
},
populate: function (items) {
this.tree.populate.apply(this.tree, arguments);
},
setValue: function (v) {
this.tree.setValue(v);
},
getValue: function () {
//这里需要去重,因为很有可能expander中保存了之前的value值
return BI.uniq(this.tree.getValue());
}
});
BI.SelectDataTree.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut("bi.select_data_tree", BI.SelectDataTree);

154
src/widget/selectdata/tree/treeitem/item.level.js

@ -1,154 +0,0 @@
/**
* Created by GUY on 2015/9/6.
* @class BI.SelectDataLevelItem
* @extends BI.Single
*/
BI.SelectDataLevelItem = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.SelectDataLevelItem.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-select-data-level0-item",
height: 25,
hgap: 0,
layer: 1,
fieldType: BICst.COLUMN.STRING,
lgap: 0,
rgap: 0
})
},
_getFieldClass: function (type) {
switch (type) {
case BICst.COLUMN.STRING:
return "select-data-field-string-font";
case BICst.COLUMN.NUMBER:
return "select-data-field-number-font";
case BICst.COLUMN.DATE:
return "select-data-field-date-font";
case BICst.COLUMN.COUNTER:
return "select-data-field-number-font";
default:
return "select-data-field-number-font";
}
},
_init: function () {
BI.SelectDataLevelItem.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.button = BI.createWidget({
type: "bi.blank_icon_text_item",
trigger: "mousedown",
cls: "select-data-level0-item-button " + this._getFieldClass(o.fieldType),
blankWidth: o.layer * 20,
text: o.text,
value: o.value,
keyword: o.keyword,
height: 25,
textLgap: 10,
textRgap: 5
});
this.button.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected());
}
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CLICK, self.getValue(), self);
});
this.topLine = BI.createWidget({
type: "bi.layout",
height: 0,
cls: "select-data-top-line"
});
this.bottomLine = BI.createWidget({
type: "bi.layout",
height: 0,
cls: "select-data-bottom-line"
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.topLine,
top: 0,
left: o.lgap,
right: o.rgap
}, {
el: this.bottomLine,
bottom: 0,
left: o.lgap,
right: o.rgap
}, {
el: this.button,
top: 0,
left: o.lgap,
right: o.rgap
}]
});
this.topLine.invisible();
this.bottomLine.invisible();
},
setEnable: function (v) {
BI.SelectDataLevelItem.superclass.setEnable.apply(this, arguments)
this.button.setEnable(v);
try {
this.button.element.draggable(v ? "enable" : "disable");
} catch (e) {
}
if (!v) {
this.setSelected(false);
}
},
isSelected: function () {
return this.button.isSelected();
},
setSelected: function (b) {
this.button.setSelected(b);
if (!b) {
this.topLine.invisible();
this.bottomLine.invisible();
this.element.removeClass("select-data-item-top");
this.element.removeClass("select-data-item-bottom");
}
},
setTopLineVisible: function () {
this.topLine.visible();
this.element.addClass("select-data-item-top");
},
setTopLineInVisible: function () {
this.topLine.invisible();
this.element.removeClass("select-data-item-top");
},
setBottomLineVisible: function () {
this.bottomLine.visible();
this.element.addClass("select-data-item-bottom");
},
setBottomLineInVisible: function () {
this.bottomLine.invisible();
this.element.removeClass("select-data-item-bottom");
},
doRedMark: function () {
this.button.doRedMark.apply(this.button, arguments);
},
unRedMark: function () {
this.button.unRedMark.apply(this.button, arguments);
},
doHighLight: function () {
this.button.doHighLight.apply(this.button, arguments);
},
unHighLight: function () {
this.button.unHighLight.apply(this.button, arguments);
}
});
$.shortcut("bi.select_data_level_item", BI.SelectDataLevelItem);

61
src/widget/sortabletable/sortabletable.dashline.horizontal.js

@ -1,61 +0,0 @@
BI.HorizontalDashLine = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.HorizontalDashLine.superclass._defaultConfig.apply(this, arguments), {
baseCls:"bi-svg-line-horizontal",
gap:5,
line:8,
stroke: "#009de3",
fill:"white",
height:3,
width:200
})
},
_init: function () {
BI.HorizontalDashLine.superclass._init.apply(this, arguments);
var o = this.options;
this.svg = BI.createWidget({
type:"bi.svg",
element: this,
height: o.height,
width: o.width
})
this.setMove()
},
setLength : function (w) {
if(w === this.options.width){
return;
}
BI.HorizontalDashLine.superclass.setWidth.apply(this, arguments);
var o = this.options;
this.setMove()
},
setMove:function() {
var o = this.options;
this.svg.clear();
this.svg.path(this._createPath(0)).attr({
stroke: o.stroke,
fill: o.fill
})
},
_createPath : function (startPos) {
var o = this.options;
var path ="";
for(var j = 0; j < o.height; j++) {
for(var i = startPos - o.line; i < o.width; i+= o.line) {
path +="M" + (i + j)+ ","+ j
path +="L" + (i + j + o.line) + "," + j
i+= o.gap
}
}
return path;
}
})
$.shortcut("bi.horizontal_dash_line", BI.HorizontalDashLine);

60
src/widget/sortabletable/sortabletable.dashline.vertical.js

@ -1,60 +0,0 @@
BI.VerticalDashLine = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.VerticalDashLine.superclass._defaultConfig.apply(this, arguments), {
baseCls:"bi-svg-line-vertical",
gap:5,
line:8,
stroke: "#009de3",
fill:"white",
height:200,
width:3
})
},
_init: function () {
BI.VerticalDashLine.superclass._init.apply(this, arguments);
var o = this.options;
this.svg = BI.createWidget({
type:"bi.svg",
element: this,
height: o.height,
width: o.width
})
this.setMove()
},
setLength : function (w) {
if(w === this.options.height){
return;
}
BI.VerticalDashLine.superclass.setHeight.apply(this, arguments);
this.setMove()
},
setMove:function() {
var o = this.options;
this.svg.clear();
this.svg.path(this._createPath(0)).attr({
stroke: o.stroke,
fill: o.fill
})
},
_createPath : function (startPos) {
var o = this.options;
var path ="";
for(var j = 0; j < o.width; j++) {
for(var i = startPos - o.line; i < o.height; i+= o.line) {
path +="M"+ j + "," + (i + j)
path +="L" + j + "," + (i + j + o.line)
i+= o.gap
}
}
return path;
}
})
$.shortcut("bi.vertical_dash_line", BI.VerticalDashLine);

46
src/widget/sortabletable/sortabletable.drag.button.js

@ -1,46 +0,0 @@
BI.TriangleDragButton = BI.inherit(BI.Widget, {
_defaultConfig: function() {
return BI.extend(BI.TriangleDragButton.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-triangle-drag-button",
height : 30,
width : 30,
lineCount:6,
stroke: "#009de3",
fill:"white",
drag : null
})
},
_init : function() {
BI.TriangleDragButton.superclass._init.apply(this, arguments);
var o = this.options;
var svg = BI.createWidget({
type:"bi.svg",
element: this,
height: o.height,
width: o.width
})
var path = "";
var h_step = o.height/ o.lineCount;
var w_step = o.width/ o.lineCount;
for(var i = 0; i < o.lineCount; i++){
path +="M0," +(h_step * (i + 1));
path +="L" + (w_step * (i + 1)) +",0"
}
svg.path(path).attr({
stroke: o.stroke,
fill: o.fill
})
this.reInitDrag();
},
reInitDrag : function () {
var o = this.options;
if(BI.isNotNull(o.drag)) {
this.element.draggable(o.drag)
}
}
});
$.shortcut("bi.triangle_drag_button", BI.TriangleDragButton);

366
src/widget/sortabletable/sortabletable.js

@ -1,366 +0,0 @@
/**
* 可以交换列位置的表格
*
* @class BI.SortableTable
* @extends BI.Widget
*/
BI.SortableTable = BI.inherit(BI.Widget, {
_const: {
perColumnSize: 100,
dragButtonWidth: 24,
dragButtonHeight: 24,
lineCount: 6,
lineWidth: 3
},
_defaultConfig: function () {
return BI.extend(BI.SortableTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-sortable-table",
headerRowSize: 30,
footerRowSize: 25,
rowSize: 25,
sortable: true,
header: [],
items: [] //二维数组
});
},
_init: function () {
BI.SortableTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.insertLine = [];
this.table = BI.createWidget({
type: "bi.table_view",
isNeedResize: false,
isResizeAdapt: false,
columnSize: [],
headerRowSize: o.headerRowSize,
footerRowSize: o.footerRowSize,
rowSize: o.rowSize,
regionColumnSize: false,
header: o.header,
items: o.items
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () {
if(o.sortable === true){
self._initDrag();
self._createDashedLines();
self._createInsertLine();
}
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () {
if(o.sortable === true){
self._createDashedLines();
self._createInsertLine();
}
self.fireEvent(BI.Table.EVENT_TABLE_RESIZE, arguments);
});
this.table.element.mousemove(function(e){
BI.each(self.dragHelpers, function(idx, dragHelper){
var visible = (idx === self._getMouseInColumnIndex(e));
dragHelper.setVisible(visible);
BI.each(self.dragHelpersLines[idx], function(id, line){
line.setVisible(visible);
})
})
})
this.table.element.hover(function(e){
}, function(e){
BI.each(self.dragHelpers, function(idx, dragHelper){
dragHelper.setVisible(false);
BI.each(self.dragHelpersLines[idx], function(id, line){
line.setVisible(false);
})
})
});
this.element.droppable({
accept: ".drag-header",
drop: function (e, ui) {
var absolutePosition = ui.position.left + self.table.getRightHorizontalScroll() + (e.pageX - ui.helper.offset().left);
var dropPosition = self._getColumnsLeftBorderDistance();
var insertIndex = self._getNearIndexFromArray(dropPosition, absolutePosition)
//这个insertIndex是包含原元素的index
//调整item顺序,重新populate
var flag = self._exchangeItemsAndHeaderPosition(ui.helper.data("index"), insertIndex)
if(flag === true){
BI.nextTick(function(){
self.populate(o.items, o.header);
});
self.fireEvent(BI.SortableTable.EVENT_CHANGE, ui.helper.data("index"), insertIndex);
}
}
});
BI.createWidget({
type: "bi.vertical",
scrollx: false,
element: this,
items: [this.table]
});
},
/**
* 插入到对应列的辅助线
* @private
*/
_createInsertLine: function(){
var self = this;
var dropPosition = this._getColumnsLeftBorderDistance();
var height = this.table.getClientRegionRowSize()[0];
var lineObj = {
type: "bi.layout",
cls: "insert-help-line",
invisible: true
};
this.insertLine = [BI.createWidget(lineObj)];
var hearders = this.table.getColumns().header[0];
BI.each(hearders, function(idx, header){
var line = BI.createWidget(BI.extend(lineObj));
self.insertLine.push(line);
});
BI.createWidget({
type: "bi.absolute",
element: this.table.element,
items: BI.map(self.insertLine, function(idx, line){
if(idx === self.insertLine.length - 1){
return {
el: line,
top: 0,
height: height,
right: 0
}
}
return {
el: line,
top: 0,
height: height,
left: dropPosition[idx]
}
})
})
},
_createDashedLines: function(){
var self = this, c = this._const, o = this.options;
var RowsSize = this.table.getClientRegionRowSize();
var columnsSizes = this.table.getCalculateColumnSize();
var dropPosition = this._getColumnsLeftBorderDistance();
var len = this.table.getCalculateRegionColumnSize()[0];
this.dragHelpersLines = [];
BI.each(this.table.getColumns().header[0], function(idx, header){
self.dragHelpersLines.push([BI.createWidget({
type:"bi.horizontal_dash_line", //上
width: columnsSizes[idx],
height: c.lineWidth,
invisible: true
}),BI.createWidget({
type:"bi.vertical_dash_line", //右
width: c.lineWidth,
height: RowsSize[0],
invisible: true
}),BI.createWidget({
type:"bi.horizontal_dash_line", //下
width: columnsSizes[idx],
height: c.lineWidth,
invisible: true
}),BI.createWidget({ //左
type:"bi.vertical_dash_line",
width: c.lineWidth,
height: RowsSize[0],
invisible: true
})]);
});
var length = this.dragHelpersLines.length;
BI.createWidget({
type: "bi.absolute",
element: self.table,
items: BI.flatten(BI.map(this.dragHelpersLines, function(idx, children){
return BI.map(children, function(id, child){
var baseObj = {
el: child,
width: id % 2 === 0 ? columnsSizes[idx] : c.lineWidth,
height: id % 2 === 0 ? c.lineWidth : RowsSize[0]
}
if(id === 0 || id === children.length - 1){ //上和左
return BI.extend({
top: 0,
left: dropPosition[idx],
}, baseObj)
}else{
return BI.extend({ //右和下
bottom: 0,
right: idx === length - 1 ? 0 : len - dropPosition[idx + 1],
}, baseObj)
}
});
}))
})
},
_initDrag: function(){
var self = this, c = this._const, o = this.options;
this.dragHelpers = [];
BI.each(this.table.getColumns().header[0], function(idx, header){
var dragButton = BI.createWidget({
type: "bi.triangle_drag_button",
cls: "drag-header",
width: c.dragButtonWidth,
height: c.dragButtonHeight,
lineCount: c.lineCount,
invisible: true
});
BI.createWidget({
type: "bi.absolute",
element: header,
items: [{
el: dragButton,
top: 0,
left: 0
}]
})
dragButton.element.draggable({
axis: "x", //拖拽路径
revert: false,
cursor: BICst.cursorUrl,
cursorAt: {left: 5, top: 5},
containment: self.element, //约束拖拽区域
drag: function(e, ui){
self._showInsertHelpLine(e, ui);
},
stop: function(){
BI.each(self.insertLine, function(idx, line){
line.setVisible(false);
})
},
helper: function () {
var RowsSize = self.table.getClientRegionRowSize();
var columnsSizes = self.table.getCalculateColumnSize();
var clone = BI.createWidget({
type: "bi.layout",
cls: "sortable_table_drag_clone",
data: {index: BI.parseInt(idx)},
width: columnsSizes[idx],
height: RowsSize[0]
})
clone.element.appendTo(self.element);
return clone.element;
}
})
self.dragHelpers.push(dragButton);
});
},
_getMouseInColumnIndex: function(e){
var dropPosition = this._getColumnsLeftBorderDistance();
var columnsSizes = this.table.getCalculateColumnSize();
var tableHeight = this.table.getClientRegionRowSize()[0];
var tableOffsetLeft = e.pageX - this.table.element.offset().left;
var tableOffsetTop = this.table.element.offset().top;
return BI.find(BI.makeArray(dropPosition.length, null), function(idx){
return !(tableOffsetLeft < dropPosition[idx] || tableOffsetLeft > dropPosition[idx] + columnsSizes[idx]
|| e.pageY < tableOffsetTop || e.pageY >= tableOffsetTop + tableHeight);
})
},
_getColumnsLeftBorderDistance: function(){
var dropPosition = [];
var columnSizes = this.table.getCalculateColumnSize();
BI.each(columnSizes, function(idx, columnSize){
if(idx === 0){
dropPosition.push(0)
}else{
//+ 1边框偏移值
dropPosition.push(dropPosition[idx - 1] + columnSizes[idx - 1] + 1)
}
});
return dropPosition;
},
_showInsertHelpLine: function(e, ui){
var absolutePosition = ui.position.left + this.table.getRightHorizontalScroll() + (e.pageX - ui.helper.offset().left);
var dropPosition = this._getColumnsLeftBorderDistance();
var insertIndex = this._getNearIndexFromArray(dropPosition, absolutePosition);
BI.each(this.insertLine, function(idx, line){
line.setVisible(insertIndex === idx);
})
BI.each(this.dragHelpers, function(idx, helper){
helper.setVisible(false);
})
},
_exchangeItemsAndHeaderPosition: function (sourceIndex, targetIndex) {
var o = this.options;
if(sourceIndex === targetIndex){
return false;
}
var header = BI.unzip(o.header);
var items = BI.unzip(o.items);
var sourceHeader = header[sourceIndex];
var sourceitems = items[sourceIndex];
header.splice(targetIndex, 0, sourceHeader);
items.splice(targetIndex, 0, sourceitems);
var deleteIndex = (sourceIndex < targetIndex) ? sourceIndex : sourceIndex + 1;
BI.removeAt(header, deleteIndex);
BI.removeAt(items, deleteIndex);
o.header = BI.unzip(header);
o.items = BI.unzip(items);
return true;
},
_getNearIndexFromArray: function (array, v) {
var self = this;
var index = 0;
BI.some(array, function (idx, item) {
if (idx === array.length - 1) {
index = idx;
//如果是最后一列,且鼠标位置超出最后一列的中间位置,表示插入到最后
var len = self.table.getCalculateRegionColumnSize()[0];
var columnSizes = self.table.getCalculateColumnSize();
if(v > len - columnSizes[idx] / 2){
index++;
}
} else {
if (v < array[idx + 1]) {
var avg = (item + array[idx + 1]) / 2;
index = v < avg ? idx : idx + 1;
return true;
}
}
})
return index;
},
getColumns: function(){
return this.table.getColumns();
},
setSortable: function(sortable){
this.options.sortable = sortable;
},
populate: function (items, headers) {
var self = this, o = this.options;
o.header = headers;
o.items = items;
self.table.populate(o.items, o.header);
},
destroy: function () {
this.table.destroy();
BI.SortableTable.superclass.destroy.apply(this, arguments);
}
});
BI.SortableTable.EVENT_CHANGE = "EVENT_CHANGE";
$.shortcut('bi.sortable_table', BI.SortableTable);

111
src/widget/uploadfile/progress.uploadfile.js

@ -1,111 +0,0 @@
/**
* Created by Young's on 2016/4/21.
*/
BI.UploadFileWithProgress = BI.inherit(BI.Widget, {
_constants: {
UPLOAD_PROGRESS: "__upload_progress__"
},
_defaultConfig: function () {
return BI.extend(BI.UploadFileWithProgress.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-upload-file-with-progress",
progressEL: BICst.BODY_ELEMENT,
multiple: false,
maxSize: 1024 * 1024,
accept: "",
url: ""
})
},
_init: function () {
BI.UploadFileWithProgress.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.file = BI.createWidget({
type: "bi.multifile_editor",
width: "100%",
height: "100%",
name: o.name,
url: o.url,
multiple: o.multiple,
accept: o.accept,
maxSize: o.maxSize
});
this.file.on(BI.MultifileEditor.EVENT_CHANGE, function () {
self.fireEvent(BI.UploadFileWithProgress.EVENT_CHANGE, arguments);
});
this.file.on(BI.MultifileEditor.EVENT_UPLOADSTART, function () {
self.progressBar = BI.createWidget({
type: "bi.progress_bar",
width: 300
});
BI.createWidget({
type: "bi.center_adapt",
element: BI.Layers.create(self._constants.UPLOAD_PROGRESS, self.options.progressEL),
items: [self.progressBar],
width: "100%",
height: "100%"
});
BI.Layers.show(self._constants.UPLOAD_PROGRESS);
self.fireEvent(BI.UploadFileWithProgress.EVENT_UPLOADSTART, arguments);
});
this.file.on(BI.MultifileEditor.EVENT_ERROR, function () {
BI.Layers.remove(self._constants.UPLOAD_PROGRESS);
self.fireEvent(BI.UploadFileWithProgress.EVENT_ERROR, arguments);
});
this.file.on(BI.MultifileEditor.EVENT_PROGRESS, function (data) {
var process = Math.ceil(data.loaded / data.total * 100);
self.progressBar.setValue(process > 100 ? 100 : process);
self.fireEvent(BI.UploadFileWithProgress.EVENT_PROGRESS, arguments);
});
this.file.on(BI.MultifileEditor.EVENT_UPLOADED, function () {
BI.Layers.remove(self._constants.UPLOAD_PROGRESS);
self.fireEvent(BI.UploadFileWithProgress.EVENT_UPLOADED, arguments);
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.adaptive",
scrollable: false,
items: [this.file]
},
top: 0,
right: 0,
left: 0,
bottom: 0
}]
});
},
select: function () {
this.file.select();
},
getValue: function () {
return this.file.getValue();
},
upload: function () {
this.file.upload();
},
reset: function () {
this.file.reset();
},
setEnable: function (enable) {
BI.MultiFile.superclass.setEnable.apply(this, arguments);
this.file.setEnable(enable);
}
});
BI.UploadFileWithProgress.EVENT_CHANGE = "EVENT_CHANGE";
BI.UploadFileWithProgress.EVENT_UPLOADSTART = "EVENT_UPLOADSTART";
BI.UploadFileWithProgress.EVENT_ERROR = "EVENT_ERROR";
BI.UploadFileWithProgress.EVENT_PROGRESS = "EVENT_PROGRESS";
BI.UploadFileWithProgress.EVENT_UPLOADED = "EVENT_UPLOADED";
$.shortcut("bi.upload_file_with_progress", BI.UploadFileWithProgress);
Loading…
Cancel
Save