diff --git a/demo/js/widget/timeinterval/demo.time_interval.js b/demo/js/widget/timeinterval/demo.time_interval.js index 249584ef9..68c46e1a7 100644 --- a/demo/js/widget/timeinterval/demo.time_interval.js +++ b/demo/js/widget/timeinterval/demo.time_interval.js @@ -71,6 +71,31 @@ Demo.TimeInterval = BI.inherit(BI.Widget, { BI.Msg.toast(JSON.stringify(self.interval.getValue())); }, width: 300 + }, { + type: "bi.time_periods", + value: { + start: { + hour: 7, + minute: 23, + second: 14 + }, + end: { + hour: 23, + minute: 34, + second: 32 + } + }, + ref: function (_ref) { + self.periods = _ref; + }, + width: 180 + }, { + type: "bi.button", + text: "getValue", + handler: function () { + BI.Msg.toast(JSON.stringify(self.periods.getValue())); + }, + width: 300 }], vgap: 20 }; diff --git a/demo/version.js b/demo/version.js index e73fb38b6..724f8321c 100644 --- a/demo/version.js +++ b/demo/version.js @@ -170,5 +170,6 @@ BI.i18n = { "BI-Basic_Font_Color": "文字颜色", "BI-Basic_Background_Color": "背景色", "BI-Basic_Underline": "下划线", - "BI-Basic_No_Select": "不选" + "BI-Basic_No_Select": "不选", + "BI-Basic_Now": "此刻" }; \ No newline at end of file diff --git a/dist/bundle.css b/dist/bundle.css index 41827a95c..1122909cb 100644 --- a/dist/bundle.css +++ b/dist/bundle.css @@ -4716,6 +4716,17 @@ textarea::-webkit-scrollbar-thumb:hover { content: "\e733"; color: inherit; } +.time-font .b-font { + *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = ''); +} +.time-font .b-font:before { + content: "\e6b1"; + color: inherit; +} +.time-font.disabled .b-font:before { + content: "\e6b1"; + color: inherit; +} .date-change-h-font .b-font { *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = ''); } diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 66fa7b76b..a739346b3 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -78272,7 +78272,295 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { }); -BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);/** +BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { + BI.TimePopup = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-date-time-popup", + height: 68 + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.vtape", + items: [{ + el: { + type: "bi.center_adapt", + cls: "bi-split-top", + items: [{ + type: "bi.dynamic_date_time_select", + value: o.value, + ref: function (_ref) { + self.timeSelect = _ref; + } + }] + }, + hgap: 10, + height: 44 + }, { + el: { + type: "bi.grid", + items: [[{ + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Clears"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-split-left bi-split-right bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Now"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_NOW_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_OK"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_OK_EVENT_CHANGE); + } + }] + }]] + }, + height: 24 + }] + }; + }, + + setValue: function (v) { + var value = v; + if (BI.isNull(value)) { + var date = BI.getDate(); + this.timeSelect.setValue({ + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }); + } else { + this.timeSelect.setValue({ + hour: value.hour, + minute: value.minute, + second: value.second + }); + } + }, + + getValue: function () { + return this.timeSelect.getValue(); + } + }); + BI.TimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; + BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; + BI.TimePopup.BUTTON_NOW_EVENT_CHANGE = "BUTTON_NOW_EVENT_CHANGE"; + BI.TimePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; + BI.shortcut("bi.time_popup", BI.TimePopup); +})();/** + * 时间选择 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimeCombo = BI.inherit(BI.Single, { + constants: { + popupHeight: 80, + popupWidth: 240, + comboAdjustHeight: 1, + border: 1 + }, + props: { + baseCls: "bi-time-combo bi-border bi-border-radius", + width: 80, + height: 22 + }, + + render: function () { + var self = this, opts = this.options; + + this.storeValue = opts.value; + + var popup = { + type: "bi.time_popup", + value: opts.value, + listeners: [{ + eventName: BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE, + action: function () { + self.setValue(); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CANCEL); + } + }, { + eventName: BI.TimePopup.BUTTON_OK_EVENT_CHANGE, + action: function () { + self.setValue(self.popup.getValue()); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }, { + eventName: BI.TimePopup.BUTTON_NOW_EVENT_CHANGE, + action: function () { + self._setNowTime(); + } + }], + ref: function (_ref) { + self.popup = _ref; + } + }; + return { + type: "bi.htape", + items: [{ + type: "bi.absolute", + items: [{ + el: { + type: "bi.combo", + container: opts.container, + toggle: false, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: { + type: "bi.time_trigger", + value: opts.value, + ref: function (_ref) { + self.trigger = _ref; + } + }, + adjustLength: this.constants.comboAdjustHeight, + popup: { + el: popup, + width: this.constants.popupWidth, + stopPropagation: false + }, + hideChecker: function (e) { + return self.triggerBtn.element.find(e.target).length === 0; + }, + listeners: [{ + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.popup.setValue(self.storeValue); + self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW); + } + }], + ref: function (_ref) { + self.combo = _ref; + } + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + cls: "bi-trigger-icon-button time-font icon-size-16", + width: 22, + height: 22, + listeners: [{ + eventName: BI.IconButton.EVENT_CHANGE, + action: function () { + if (self.combo.isViewVisible()) { + // self.combo.hideView(); + } else { + self.combo.showView(); + } + } + }], + ref: function (_ref) { + self.triggerBtn = _ref; + } + }, + top: 0, + right: 0 + }] + }] + }; + }, + + setValue: function (v) { + this.storeValue = v; + this.trigger.setValue(v); + }, + getValue: function () { + return this.storeValue; + }, + + hidePopupView: function () { + this.combo.hideView(); + }, + + _setNowTime: function () { + var date = BI.getDate(); + var nowTome = { + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }; + this.setValue(nowTome); + this.hidePopupView(); + this.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }); + + BI.TimeCombo.EVENT_CANCEL = "EVENT_CANCEL"; + BI.TimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; + BI.TimeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; + BI.shortcut("bi.time_combo", BI.TimeCombo); +})();!(function () { + BI.TimeTrigger = BI.inherit(BI.Trigger, { + props: { + extraCls: "bi-time-trigger", + height: 22, + width: 80, + value: {} + }, + render: function () { + var self = this, o = this.options; + return { + type: "bi.htape", + items: [{ + el: { + type: "bi.label", + textAlign: "left", + height: o.height, + width: o.width, + text: this._formatValue(o.value), + ref: function (_ref) { + self.text = _ref; + } + }, + hgap: 4 + }] + }; + }, + + setValue: function (v) { + this.text.setText(this._formatValue(v)); + }, + + _formatValue: function (v) { + var now = BI.getDate(); + return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), "%H:%M:%S") : BI.i18nText("BI-Basic_Unrestricted"); + } + + }); + BI.shortcut("bi.time_trigger", BI.TimeTrigger); +})();/** * Created by Baron on 2015/10/19. */ BI.DateInterval = BI.inherit(BI.Single, { @@ -78631,6 +78919,124 @@ BI.TimeInterval.EVENT_VALID = "EVENT_VALID"; BI.TimeInterval.EVENT_ERROR = "EVENT_ERROR"; BI.TimeInterval.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.time_interval", BI.TimeInterval);/** + * 时间区间 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimePeriods = BI.inherit(BI.Single, { + constants: { + height: 24, + width: 24, + lgap: 15, + offset: 0 + }, + props: { + extraCls: "bi-time-interval", + value: {} + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.absolute", + height: this.constants.height, + items: [{ + el: { + type: "bi.horizontal_auto", + items: [{ + type: "bi.label", + height: this.constants.height, + width: this.constants.width, + text: "-", + ref: function (_ref) { + self.label = _ref; + } + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.center", + height: this.constants.height, + items: [{ + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.left = _ref; + } + }, this._createCombo(o.value.start)), + left: this.constants.offset, + right: this.constants.width / 2, + top: 0, + bottom: 0 + }] + }, { + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.right = _ref; + } + }, this._createCombo(o.value.end)), + left: this.constants.width / 2, + right: this.constants.offset, + top: 0, + bottom: 0 + }] + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }] + }; + }, + + _createCombo: function (v) { + var self = this; + return { + type: "bi.time_combo", + value: v, + listeners: [{ + eventName: BI.TimeCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.left.hidePopupView(); + self.right.hidePopupView(); + } + }, { + eventName: BI.TimeCombo.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CHANGE); + } + }, { + eventName: BI.TimeCombo.EVENT_CONFIRM, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CONFIRM); + } + }] + }; + }, + + setValue: function (date) { + date = date || {}; + this.left.setValue(date.start); + this.right.setValue(date.end); + }, + getValue: function () { + return {start: this.left.getValue(), end: this.right.getValue()}; + } + }); + BI.TimePeriods.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimePeriods.EVENT_CHANGE = "EVENT_CHANGE"; + BI.shortcut("bi.time_periods", BI.TimePeriods); +})();/** * 年份展示面板 * * Created by GUY on 2015/9/2. diff --git a/dist/bundle.js b/dist/bundle.js index 1d52cf001..9f9304b99 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -78676,7 +78676,295 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { }); -BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);/** +BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { + BI.TimePopup = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-date-time-popup", + height: 68 + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.vtape", + items: [{ + el: { + type: "bi.center_adapt", + cls: "bi-split-top", + items: [{ + type: "bi.dynamic_date_time_select", + value: o.value, + ref: function (_ref) { + self.timeSelect = _ref; + } + }] + }, + hgap: 10, + height: 44 + }, { + el: { + type: "bi.grid", + items: [[{ + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Clears"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-split-left bi-split-right bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Now"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_NOW_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_OK"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_OK_EVENT_CHANGE); + } + }] + }]] + }, + height: 24 + }] + }; + }, + + setValue: function (v) { + var value = v; + if (BI.isNull(value)) { + var date = BI.getDate(); + this.timeSelect.setValue({ + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }); + } else { + this.timeSelect.setValue({ + hour: value.hour, + minute: value.minute, + second: value.second + }); + } + }, + + getValue: function () { + return this.timeSelect.getValue(); + } + }); + BI.TimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; + BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; + BI.TimePopup.BUTTON_NOW_EVENT_CHANGE = "BUTTON_NOW_EVENT_CHANGE"; + BI.TimePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; + BI.shortcut("bi.time_popup", BI.TimePopup); +})();/** + * 时间选择 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimeCombo = BI.inherit(BI.Single, { + constants: { + popupHeight: 80, + popupWidth: 240, + comboAdjustHeight: 1, + border: 1 + }, + props: { + baseCls: "bi-time-combo bi-border bi-border-radius", + width: 80, + height: 22 + }, + + render: function () { + var self = this, opts = this.options; + + this.storeValue = opts.value; + + var popup = { + type: "bi.time_popup", + value: opts.value, + listeners: [{ + eventName: BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE, + action: function () { + self.setValue(); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CANCEL); + } + }, { + eventName: BI.TimePopup.BUTTON_OK_EVENT_CHANGE, + action: function () { + self.setValue(self.popup.getValue()); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }, { + eventName: BI.TimePopup.BUTTON_NOW_EVENT_CHANGE, + action: function () { + self._setNowTime(); + } + }], + ref: function (_ref) { + self.popup = _ref; + } + }; + return { + type: "bi.htape", + items: [{ + type: "bi.absolute", + items: [{ + el: { + type: "bi.combo", + container: opts.container, + toggle: false, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: { + type: "bi.time_trigger", + value: opts.value, + ref: function (_ref) { + self.trigger = _ref; + } + }, + adjustLength: this.constants.comboAdjustHeight, + popup: { + el: popup, + width: this.constants.popupWidth, + stopPropagation: false + }, + hideChecker: function (e) { + return self.triggerBtn.element.find(e.target).length === 0; + }, + listeners: [{ + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.popup.setValue(self.storeValue); + self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW); + } + }], + ref: function (_ref) { + self.combo = _ref; + } + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + cls: "bi-trigger-icon-button time-font icon-size-16", + width: 22, + height: 22, + listeners: [{ + eventName: BI.IconButton.EVENT_CHANGE, + action: function () { + if (self.combo.isViewVisible()) { + // self.combo.hideView(); + } else { + self.combo.showView(); + } + } + }], + ref: function (_ref) { + self.triggerBtn = _ref; + } + }, + top: 0, + right: 0 + }] + }] + }; + }, + + setValue: function (v) { + this.storeValue = v; + this.trigger.setValue(v); + }, + getValue: function () { + return this.storeValue; + }, + + hidePopupView: function () { + this.combo.hideView(); + }, + + _setNowTime: function () { + var date = BI.getDate(); + var nowTome = { + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }; + this.setValue(nowTome); + this.hidePopupView(); + this.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }); + + BI.TimeCombo.EVENT_CANCEL = "EVENT_CANCEL"; + BI.TimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; + BI.TimeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; + BI.shortcut("bi.time_combo", BI.TimeCombo); +})();!(function () { + BI.TimeTrigger = BI.inherit(BI.Trigger, { + props: { + extraCls: "bi-time-trigger", + height: 22, + width: 80, + value: {} + }, + render: function () { + var self = this, o = this.options; + return { + type: "bi.htape", + items: [{ + el: { + type: "bi.label", + textAlign: "left", + height: o.height, + width: o.width, + text: this._formatValue(o.value), + ref: function (_ref) { + self.text = _ref; + } + }, + hgap: 4 + }] + }; + }, + + setValue: function (v) { + this.text.setText(this._formatValue(v)); + }, + + _formatValue: function (v) { + var now = BI.getDate(); + return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), "%H:%M:%S") : BI.i18nText("BI-Basic_Unrestricted"); + } + + }); + BI.shortcut("bi.time_trigger", BI.TimeTrigger); +})();/** * Created by Baron on 2015/10/19. */ BI.DateInterval = BI.inherit(BI.Single, { @@ -79035,6 +79323,124 @@ BI.TimeInterval.EVENT_VALID = "EVENT_VALID"; BI.TimeInterval.EVENT_ERROR = "EVENT_ERROR"; BI.TimeInterval.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.time_interval", BI.TimeInterval);/** + * 时间区间 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimePeriods = BI.inherit(BI.Single, { + constants: { + height: 24, + width: 24, + lgap: 15, + offset: 0 + }, + props: { + extraCls: "bi-time-interval", + value: {} + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.absolute", + height: this.constants.height, + items: [{ + el: { + type: "bi.horizontal_auto", + items: [{ + type: "bi.label", + height: this.constants.height, + width: this.constants.width, + text: "-", + ref: function (_ref) { + self.label = _ref; + } + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.center", + height: this.constants.height, + items: [{ + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.left = _ref; + } + }, this._createCombo(o.value.start)), + left: this.constants.offset, + right: this.constants.width / 2, + top: 0, + bottom: 0 + }] + }, { + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.right = _ref; + } + }, this._createCombo(o.value.end)), + left: this.constants.width / 2, + right: this.constants.offset, + top: 0, + bottom: 0 + }] + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }] + }; + }, + + _createCombo: function (v) { + var self = this; + return { + type: "bi.time_combo", + value: v, + listeners: [{ + eventName: BI.TimeCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.left.hidePopupView(); + self.right.hidePopupView(); + } + }, { + eventName: BI.TimeCombo.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CHANGE); + } + }, { + eventName: BI.TimeCombo.EVENT_CONFIRM, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CONFIRM); + } + }] + }; + }, + + setValue: function (date) { + date = date || {}; + this.left.setValue(date.start); + this.right.setValue(date.end); + }, + getValue: function () { + return {start: this.left.getValue(), end: this.right.getValue()}; + } + }); + BI.TimePeriods.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimePeriods.EVENT_CHANGE = "EVENT_CHANGE"; + BI.shortcut("bi.time_periods", BI.TimePeriods); +})();/** * 年份展示面板 * * Created by GUY on 2015/9/2. diff --git a/dist/config.js b/dist/config.js index e73fb38b6..724f8321c 100644 --- a/dist/config.js +++ b/dist/config.js @@ -170,5 +170,6 @@ BI.i18n = { "BI-Basic_Font_Color": "文字颜色", "BI-Basic_Background_Color": "背景色", "BI-Basic_Underline": "下划线", - "BI-Basic_No_Select": "不选" + "BI-Basic_No_Select": "不选", + "BI-Basic_Now": "此刻" }; \ No newline at end of file diff --git a/dist/demo.js b/dist/demo.js index d037643d4..74347d72b 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -9985,6 +9985,31 @@ Demo.TimeInterval = BI.inherit(BI.Widget, { BI.Msg.toast(JSON.stringify(self.interval.getValue())); }, width: 300 + }, { + type: "bi.time_periods", + value: { + start: { + hour: 7, + minute: 23, + second: 14 + }, + end: { + hour: 23, + minute: 34, + second: 32 + } + }, + ref: function (_ref) { + self.periods = _ref; + }, + width: 180 + }, { + type: "bi.button", + text: "getValue", + handler: function () { + BI.Msg.toast(JSON.stringify(self.periods.getValue())); + }, + width: 300 }], vgap: 20 }; diff --git a/dist/fineui.css b/dist/fineui.css index 1aeaa09d9..7631c207a 100644 --- a/dist/fineui.css +++ b/dist/fineui.css @@ -4716,6 +4716,17 @@ textarea::-webkit-scrollbar-thumb:hover { content: "\e733"; color: inherit; } +.time-font .b-font { + *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = ''); +} +.time-font .b-font:before { + content: "\e6b1"; + color: inherit; +} +.time-font.disabled .b-font:before { + content: "\e6b1"; + color: inherit; +} .date-change-h-font .b-font { *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = ''); } diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index d1838f6be..ee5ce01e1 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -78517,7 +78517,295 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { }); -BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);/** +BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { + BI.TimePopup = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-date-time-popup", + height: 68 + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.vtape", + items: [{ + el: { + type: "bi.center_adapt", + cls: "bi-split-top", + items: [{ + type: "bi.dynamic_date_time_select", + value: o.value, + ref: function (_ref) { + self.timeSelect = _ref; + } + }] + }, + hgap: 10, + height: 44 + }, { + el: { + type: "bi.grid", + items: [[{ + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Clears"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-split-left bi-split-right bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Now"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_NOW_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_OK"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_OK_EVENT_CHANGE); + } + }] + }]] + }, + height: 24 + }] + }; + }, + + setValue: function (v) { + var value = v; + if (BI.isNull(value)) { + var date = BI.getDate(); + this.timeSelect.setValue({ + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }); + } else { + this.timeSelect.setValue({ + hour: value.hour, + minute: value.minute, + second: value.second + }); + } + }, + + getValue: function () { + return this.timeSelect.getValue(); + } + }); + BI.TimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; + BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; + BI.TimePopup.BUTTON_NOW_EVENT_CHANGE = "BUTTON_NOW_EVENT_CHANGE"; + BI.TimePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; + BI.shortcut("bi.time_popup", BI.TimePopup); +})();/** + * 时间选择 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimeCombo = BI.inherit(BI.Single, { + constants: { + popupHeight: 80, + popupWidth: 240, + comboAdjustHeight: 1, + border: 1 + }, + props: { + baseCls: "bi-time-combo bi-border bi-border-radius", + width: 80, + height: 22 + }, + + render: function () { + var self = this, opts = this.options; + + this.storeValue = opts.value; + + var popup = { + type: "bi.time_popup", + value: opts.value, + listeners: [{ + eventName: BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE, + action: function () { + self.setValue(); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CANCEL); + } + }, { + eventName: BI.TimePopup.BUTTON_OK_EVENT_CHANGE, + action: function () { + self.setValue(self.popup.getValue()); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }, { + eventName: BI.TimePopup.BUTTON_NOW_EVENT_CHANGE, + action: function () { + self._setNowTime(); + } + }], + ref: function (_ref) { + self.popup = _ref; + } + }; + return { + type: "bi.htape", + items: [{ + type: "bi.absolute", + items: [{ + el: { + type: "bi.combo", + container: opts.container, + toggle: false, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: { + type: "bi.time_trigger", + value: opts.value, + ref: function (_ref) { + self.trigger = _ref; + } + }, + adjustLength: this.constants.comboAdjustHeight, + popup: { + el: popup, + width: this.constants.popupWidth, + stopPropagation: false + }, + hideChecker: function (e) { + return self.triggerBtn.element.find(e.target).length === 0; + }, + listeners: [{ + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.popup.setValue(self.storeValue); + self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW); + } + }], + ref: function (_ref) { + self.combo = _ref; + } + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + cls: "bi-trigger-icon-button time-font icon-size-16", + width: 22, + height: 22, + listeners: [{ + eventName: BI.IconButton.EVENT_CHANGE, + action: function () { + if (self.combo.isViewVisible()) { + // self.combo.hideView(); + } else { + self.combo.showView(); + } + } + }], + ref: function (_ref) { + self.triggerBtn = _ref; + } + }, + top: 0, + right: 0 + }] + }] + }; + }, + + setValue: function (v) { + this.storeValue = v; + this.trigger.setValue(v); + }, + getValue: function () { + return this.storeValue; + }, + + hidePopupView: function () { + this.combo.hideView(); + }, + + _setNowTime: function () { + var date = BI.getDate(); + var nowTome = { + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }; + this.setValue(nowTome); + this.hidePopupView(); + this.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }); + + BI.TimeCombo.EVENT_CANCEL = "EVENT_CANCEL"; + BI.TimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; + BI.TimeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; + BI.shortcut("bi.time_combo", BI.TimeCombo); +})();!(function () { + BI.TimeTrigger = BI.inherit(BI.Trigger, { + props: { + extraCls: "bi-time-trigger", + height: 22, + width: 80, + value: {} + }, + render: function () { + var self = this, o = this.options; + return { + type: "bi.htape", + items: [{ + el: { + type: "bi.label", + textAlign: "left", + height: o.height, + width: o.width, + text: this._formatValue(o.value), + ref: function (_ref) { + self.text = _ref; + } + }, + hgap: 4 + }] + }; + }, + + setValue: function (v) { + this.text.setText(this._formatValue(v)); + }, + + _formatValue: function (v) { + var now = BI.getDate(); + return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), "%H:%M:%S") : BI.i18nText("BI-Basic_Unrestricted"); + } + + }); + BI.shortcut("bi.time_trigger", BI.TimeTrigger); +})();/** * Created by Baron on 2015/10/19. */ BI.DateInterval = BI.inherit(BI.Single, { @@ -78876,6 +79164,124 @@ BI.TimeInterval.EVENT_VALID = "EVENT_VALID"; BI.TimeInterval.EVENT_ERROR = "EVENT_ERROR"; BI.TimeInterval.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.time_interval", BI.TimeInterval);/** + * 时间区间 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimePeriods = BI.inherit(BI.Single, { + constants: { + height: 24, + width: 24, + lgap: 15, + offset: 0 + }, + props: { + extraCls: "bi-time-interval", + value: {} + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.absolute", + height: this.constants.height, + items: [{ + el: { + type: "bi.horizontal_auto", + items: [{ + type: "bi.label", + height: this.constants.height, + width: this.constants.width, + text: "-", + ref: function (_ref) { + self.label = _ref; + } + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.center", + height: this.constants.height, + items: [{ + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.left = _ref; + } + }, this._createCombo(o.value.start)), + left: this.constants.offset, + right: this.constants.width / 2, + top: 0, + bottom: 0 + }] + }, { + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.right = _ref; + } + }, this._createCombo(o.value.end)), + left: this.constants.width / 2, + right: this.constants.offset, + top: 0, + bottom: 0 + }] + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }] + }; + }, + + _createCombo: function (v) { + var self = this; + return { + type: "bi.time_combo", + value: v, + listeners: [{ + eventName: BI.TimeCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.left.hidePopupView(); + self.right.hidePopupView(); + } + }, { + eventName: BI.TimeCombo.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CHANGE); + } + }, { + eventName: BI.TimeCombo.EVENT_CONFIRM, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CONFIRM); + } + }] + }; + }, + + setValue: function (date) { + date = date || {}; + this.left.setValue(date.start); + this.right.setValue(date.end); + }, + getValue: function () { + return {start: this.left.getValue(), end: this.right.getValue()}; + } + }); + BI.TimePeriods.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimePeriods.EVENT_CHANGE = "EVENT_CHANGE"; + BI.shortcut("bi.time_periods", BI.TimePeriods); +})();/** * 年份展示面板 * * Created by GUY on 2015/9/2. diff --git a/dist/fineui.js b/dist/fineui.js index e515ea6ed..352e0ebbd 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -78921,7 +78921,295 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { }); -BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);/** +BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { + BI.TimePopup = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-date-time-popup", + height: 68 + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.vtape", + items: [{ + el: { + type: "bi.center_adapt", + cls: "bi-split-top", + items: [{ + type: "bi.dynamic_date_time_select", + value: o.value, + ref: function (_ref) { + self.timeSelect = _ref; + } + }] + }, + hgap: 10, + height: 44 + }, { + el: { + type: "bi.grid", + items: [[{ + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Clears"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-split-left bi-split-right bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Now"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_NOW_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_OK"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_OK_EVENT_CHANGE); + } + }] + }]] + }, + height: 24 + }] + }; + }, + + setValue: function (v) { + var value = v; + if (BI.isNull(value)) { + var date = BI.getDate(); + this.timeSelect.setValue({ + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }); + } else { + this.timeSelect.setValue({ + hour: value.hour, + minute: value.minute, + second: value.second + }); + } + }, + + getValue: function () { + return this.timeSelect.getValue(); + } + }); + BI.TimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; + BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; + BI.TimePopup.BUTTON_NOW_EVENT_CHANGE = "BUTTON_NOW_EVENT_CHANGE"; + BI.TimePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; + BI.shortcut("bi.time_popup", BI.TimePopup); +})();/** + * 时间选择 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimeCombo = BI.inherit(BI.Single, { + constants: { + popupHeight: 80, + popupWidth: 240, + comboAdjustHeight: 1, + border: 1 + }, + props: { + baseCls: "bi-time-combo bi-border bi-border-radius", + width: 80, + height: 22 + }, + + render: function () { + var self = this, opts = this.options; + + this.storeValue = opts.value; + + var popup = { + type: "bi.time_popup", + value: opts.value, + listeners: [{ + eventName: BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE, + action: function () { + self.setValue(); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CANCEL); + } + }, { + eventName: BI.TimePopup.BUTTON_OK_EVENT_CHANGE, + action: function () { + self.setValue(self.popup.getValue()); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }, { + eventName: BI.TimePopup.BUTTON_NOW_EVENT_CHANGE, + action: function () { + self._setNowTime(); + } + }], + ref: function (_ref) { + self.popup = _ref; + } + }; + return { + type: "bi.htape", + items: [{ + type: "bi.absolute", + items: [{ + el: { + type: "bi.combo", + container: opts.container, + toggle: false, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: { + type: "bi.time_trigger", + value: opts.value, + ref: function (_ref) { + self.trigger = _ref; + } + }, + adjustLength: this.constants.comboAdjustHeight, + popup: { + el: popup, + width: this.constants.popupWidth, + stopPropagation: false + }, + hideChecker: function (e) { + return self.triggerBtn.element.find(e.target).length === 0; + }, + listeners: [{ + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.popup.setValue(self.storeValue); + self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW); + } + }], + ref: function (_ref) { + self.combo = _ref; + } + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + cls: "bi-trigger-icon-button time-font icon-size-16", + width: 22, + height: 22, + listeners: [{ + eventName: BI.IconButton.EVENT_CHANGE, + action: function () { + if (self.combo.isViewVisible()) { + // self.combo.hideView(); + } else { + self.combo.showView(); + } + } + }], + ref: function (_ref) { + self.triggerBtn = _ref; + } + }, + top: 0, + right: 0 + }] + }] + }; + }, + + setValue: function (v) { + this.storeValue = v; + this.trigger.setValue(v); + }, + getValue: function () { + return this.storeValue; + }, + + hidePopupView: function () { + this.combo.hideView(); + }, + + _setNowTime: function () { + var date = BI.getDate(); + var nowTome = { + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }; + this.setValue(nowTome); + this.hidePopupView(); + this.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }); + + BI.TimeCombo.EVENT_CANCEL = "EVENT_CANCEL"; + BI.TimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; + BI.TimeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; + BI.shortcut("bi.time_combo", BI.TimeCombo); +})();!(function () { + BI.TimeTrigger = BI.inherit(BI.Trigger, { + props: { + extraCls: "bi-time-trigger", + height: 22, + width: 80, + value: {} + }, + render: function () { + var self = this, o = this.options; + return { + type: "bi.htape", + items: [{ + el: { + type: "bi.label", + textAlign: "left", + height: o.height, + width: o.width, + text: this._formatValue(o.value), + ref: function (_ref) { + self.text = _ref; + } + }, + hgap: 4 + }] + }; + }, + + setValue: function (v) { + this.text.setText(this._formatValue(v)); + }, + + _formatValue: function (v) { + var now = BI.getDate(); + return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), "%H:%M:%S") : BI.i18nText("BI-Basic_Unrestricted"); + } + + }); + BI.shortcut("bi.time_trigger", BI.TimeTrigger); +})();/** * Created by Baron on 2015/10/19. */ BI.DateInterval = BI.inherit(BI.Single, { @@ -79280,6 +79568,124 @@ BI.TimeInterval.EVENT_VALID = "EVENT_VALID"; BI.TimeInterval.EVENT_ERROR = "EVENT_ERROR"; BI.TimeInterval.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.time_interval", BI.TimeInterval);/** + * 时间区间 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimePeriods = BI.inherit(BI.Single, { + constants: { + height: 24, + width: 24, + lgap: 15, + offset: 0 + }, + props: { + extraCls: "bi-time-interval", + value: {} + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.absolute", + height: this.constants.height, + items: [{ + el: { + type: "bi.horizontal_auto", + items: [{ + type: "bi.label", + height: this.constants.height, + width: this.constants.width, + text: "-", + ref: function (_ref) { + self.label = _ref; + } + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.center", + height: this.constants.height, + items: [{ + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.left = _ref; + } + }, this._createCombo(o.value.start)), + left: this.constants.offset, + right: this.constants.width / 2, + top: 0, + bottom: 0 + }] + }, { + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.right = _ref; + } + }, this._createCombo(o.value.end)), + left: this.constants.width / 2, + right: this.constants.offset, + top: 0, + bottom: 0 + }] + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }] + }; + }, + + _createCombo: function (v) { + var self = this; + return { + type: "bi.time_combo", + value: v, + listeners: [{ + eventName: BI.TimeCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.left.hidePopupView(); + self.right.hidePopupView(); + } + }, { + eventName: BI.TimeCombo.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CHANGE); + } + }, { + eventName: BI.TimeCombo.EVENT_CONFIRM, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CONFIRM); + } + }] + }; + }, + + setValue: function (date) { + date = date || {}; + this.left.setValue(date.start); + this.right.setValue(date.end); + }, + getValue: function () { + return {start: this.left.getValue(), end: this.right.getValue()}; + } + }); + BI.TimePeriods.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimePeriods.EVENT_CHANGE = "EVENT_CHANGE"; + BI.shortcut("bi.time_periods", BI.TimePeriods); +})();/** * 年份展示面板 * * Created by GUY on 2015/9/2. diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 86f63f43d..9b3ad8dec 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -61716,7 +61716,295 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { }); -BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);/** +BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { + BI.TimePopup = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-date-time-popup", + height: 68 + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.vtape", + items: [{ + el: { + type: "bi.center_adapt", + cls: "bi-split-top", + items: [{ + type: "bi.dynamic_date_time_select", + value: o.value, + ref: function (_ref) { + self.timeSelect = _ref; + } + }] + }, + hgap: 10, + height: 44 + }, { + el: { + type: "bi.grid", + items: [[{ + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Clears"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-split-left bi-split-right bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Now"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_NOW_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_OK"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_OK_EVENT_CHANGE); + } + }] + }]] + }, + height: 24 + }] + }; + }, + + setValue: function (v) { + var value = v; + if (BI.isNull(value)) { + var date = BI.getDate(); + this.timeSelect.setValue({ + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }); + } else { + this.timeSelect.setValue({ + hour: value.hour, + minute: value.minute, + second: value.second + }); + } + }, + + getValue: function () { + return this.timeSelect.getValue(); + } + }); + BI.TimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; + BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; + BI.TimePopup.BUTTON_NOW_EVENT_CHANGE = "BUTTON_NOW_EVENT_CHANGE"; + BI.TimePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; + BI.shortcut("bi.time_popup", BI.TimePopup); +})();/** + * 时间选择 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimeCombo = BI.inherit(BI.Single, { + constants: { + popupHeight: 80, + popupWidth: 240, + comboAdjustHeight: 1, + border: 1 + }, + props: { + baseCls: "bi-time-combo bi-border bi-border-radius", + width: 80, + height: 22 + }, + + render: function () { + var self = this, opts = this.options; + + this.storeValue = opts.value; + + var popup = { + type: "bi.time_popup", + value: opts.value, + listeners: [{ + eventName: BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE, + action: function () { + self.setValue(); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CANCEL); + } + }, { + eventName: BI.TimePopup.BUTTON_OK_EVENT_CHANGE, + action: function () { + self.setValue(self.popup.getValue()); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }, { + eventName: BI.TimePopup.BUTTON_NOW_EVENT_CHANGE, + action: function () { + self._setNowTime(); + } + }], + ref: function (_ref) { + self.popup = _ref; + } + }; + return { + type: "bi.htape", + items: [{ + type: "bi.absolute", + items: [{ + el: { + type: "bi.combo", + container: opts.container, + toggle: false, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: { + type: "bi.time_trigger", + value: opts.value, + ref: function (_ref) { + self.trigger = _ref; + } + }, + adjustLength: this.constants.comboAdjustHeight, + popup: { + el: popup, + width: this.constants.popupWidth, + stopPropagation: false + }, + hideChecker: function (e) { + return self.triggerBtn.element.find(e.target).length === 0; + }, + listeners: [{ + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.popup.setValue(self.storeValue); + self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW); + } + }], + ref: function (_ref) { + self.combo = _ref; + } + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + cls: "bi-trigger-icon-button time-font icon-size-16", + width: 22, + height: 22, + listeners: [{ + eventName: BI.IconButton.EVENT_CHANGE, + action: function () { + if (self.combo.isViewVisible()) { + // self.combo.hideView(); + } else { + self.combo.showView(); + } + } + }], + ref: function (_ref) { + self.triggerBtn = _ref; + } + }, + top: 0, + right: 0 + }] + }] + }; + }, + + setValue: function (v) { + this.storeValue = v; + this.trigger.setValue(v); + }, + getValue: function () { + return this.storeValue; + }, + + hidePopupView: function () { + this.combo.hideView(); + }, + + _setNowTime: function () { + var date = BI.getDate(); + var nowTome = { + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }; + this.setValue(nowTome); + this.hidePopupView(); + this.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }); + + BI.TimeCombo.EVENT_CANCEL = "EVENT_CANCEL"; + BI.TimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; + BI.TimeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; + BI.shortcut("bi.time_combo", BI.TimeCombo); +})();!(function () { + BI.TimeTrigger = BI.inherit(BI.Trigger, { + props: { + extraCls: "bi-time-trigger", + height: 22, + width: 80, + value: {} + }, + render: function () { + var self = this, o = this.options; + return { + type: "bi.htape", + items: [{ + el: { + type: "bi.label", + textAlign: "left", + height: o.height, + width: o.width, + text: this._formatValue(o.value), + ref: function (_ref) { + self.text = _ref; + } + }, + hgap: 4 + }] + }; + }, + + setValue: function (v) { + this.text.setText(this._formatValue(v)); + }, + + _formatValue: function (v) { + var now = BI.getDate(); + return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), "%H:%M:%S") : BI.i18nText("BI-Basic_Unrestricted"); + } + + }); + BI.shortcut("bi.time_trigger", BI.TimeTrigger); +})();/** * Created by Baron on 2015/10/19. */ BI.DateInterval = BI.inherit(BI.Single, { @@ -62075,6 +62363,124 @@ BI.TimeInterval.EVENT_VALID = "EVENT_VALID"; BI.TimeInterval.EVENT_ERROR = "EVENT_ERROR"; BI.TimeInterval.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.time_interval", BI.TimeInterval);/** + * 时间区间 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimePeriods = BI.inherit(BI.Single, { + constants: { + height: 24, + width: 24, + lgap: 15, + offset: 0 + }, + props: { + extraCls: "bi-time-interval", + value: {} + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.absolute", + height: this.constants.height, + items: [{ + el: { + type: "bi.horizontal_auto", + items: [{ + type: "bi.label", + height: this.constants.height, + width: this.constants.width, + text: "-", + ref: function (_ref) { + self.label = _ref; + } + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.center", + height: this.constants.height, + items: [{ + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.left = _ref; + } + }, this._createCombo(o.value.start)), + left: this.constants.offset, + right: this.constants.width / 2, + top: 0, + bottom: 0 + }] + }, { + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.right = _ref; + } + }, this._createCombo(o.value.end)), + left: this.constants.width / 2, + right: this.constants.offset, + top: 0, + bottom: 0 + }] + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }] + }; + }, + + _createCombo: function (v) { + var self = this; + return { + type: "bi.time_combo", + value: v, + listeners: [{ + eventName: BI.TimeCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.left.hidePopupView(); + self.right.hidePopupView(); + } + }, { + eventName: BI.TimeCombo.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CHANGE); + } + }, { + eventName: BI.TimeCombo.EVENT_CONFIRM, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CONFIRM); + } + }] + }; + }, + + setValue: function (date) { + date = date || {}; + this.left.setValue(date.start); + this.right.setValue(date.end); + }, + getValue: function () { + return {start: this.left.getValue(), end: this.right.getValue()}; + } + }); + BI.TimePeriods.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimePeriods.EVENT_CHANGE = "EVENT_CHANGE"; + BI.shortcut("bi.time_periods", BI.TimePeriods); +})();/** * 年份展示面板 * * Created by GUY on 2015/9/2. @@ -66329,5 +66735,6 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () { "BI-Basic_Font_Color": "文字颜色", "BI-Basic_Background_Color": "背景色", "BI-Basic_Underline": "下划线", - "BI-Basic_No_Select": "不选" + "BI-Basic_No_Select": "不选", + "BI-Basic_Now": "此刻" };BI.resourceURL = "file?path=/com/fr/web/ui/resource"; \ No newline at end of file diff --git a/dist/resource.css b/dist/resource.css index 66e37f45a..cd94bb1b5 100644 --- a/dist/resource.css +++ b/dist/resource.css @@ -555,6 +555,17 @@ textarea::-webkit-scrollbar-thumb:hover { content: "\e733"; color: inherit; } +.time-font .b-font { + *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = ''); +} +.time-font .b-font:before { + content: "\e6b1"; + color: inherit; +} +.time-font.disabled .b-font:before { + content: "\e6b1"; + color: inherit; +} .date-change-h-font .b-font { *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = ''); } diff --git a/dist/widget.js b/dist/widget.js index eb2a8e207..cc9ecd89e 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -19231,7 +19231,295 @@ BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { }); -BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);/** +BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () { + BI.TimePopup = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-date-time-popup", + height: 68 + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.vtape", + items: [{ + el: { + type: "bi.center_adapt", + cls: "bi-split-top", + items: [{ + type: "bi.dynamic_date_time_select", + value: o.value, + ref: function (_ref) { + self.timeSelect = _ref; + } + }] + }, + hgap: 10, + height: 44 + }, { + el: { + type: "bi.grid", + items: [[{ + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Clears"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-split-left bi-split-right bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Now"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_NOW_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_OK"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_OK_EVENT_CHANGE); + } + }] + }]] + }, + height: 24 + }] + }; + }, + + setValue: function (v) { + var value = v; + if (BI.isNull(value)) { + var date = BI.getDate(); + this.timeSelect.setValue({ + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }); + } else { + this.timeSelect.setValue({ + hour: value.hour, + minute: value.minute, + second: value.second + }); + } + }, + + getValue: function () { + return this.timeSelect.getValue(); + } + }); + BI.TimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; + BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; + BI.TimePopup.BUTTON_NOW_EVENT_CHANGE = "BUTTON_NOW_EVENT_CHANGE"; + BI.TimePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; + BI.shortcut("bi.time_popup", BI.TimePopup); +})();/** + * 时间选择 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimeCombo = BI.inherit(BI.Single, { + constants: { + popupHeight: 80, + popupWidth: 240, + comboAdjustHeight: 1, + border: 1 + }, + props: { + baseCls: "bi-time-combo bi-border bi-border-radius", + width: 80, + height: 22 + }, + + render: function () { + var self = this, opts = this.options; + + this.storeValue = opts.value; + + var popup = { + type: "bi.time_popup", + value: opts.value, + listeners: [{ + eventName: BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE, + action: function () { + self.setValue(); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CANCEL); + } + }, { + eventName: BI.TimePopup.BUTTON_OK_EVENT_CHANGE, + action: function () { + self.setValue(self.popup.getValue()); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }, { + eventName: BI.TimePopup.BUTTON_NOW_EVENT_CHANGE, + action: function () { + self._setNowTime(); + } + }], + ref: function (_ref) { + self.popup = _ref; + } + }; + return { + type: "bi.htape", + items: [{ + type: "bi.absolute", + items: [{ + el: { + type: "bi.combo", + container: opts.container, + toggle: false, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: { + type: "bi.time_trigger", + value: opts.value, + ref: function (_ref) { + self.trigger = _ref; + } + }, + adjustLength: this.constants.comboAdjustHeight, + popup: { + el: popup, + width: this.constants.popupWidth, + stopPropagation: false + }, + hideChecker: function (e) { + return self.triggerBtn.element.find(e.target).length === 0; + }, + listeners: [{ + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.popup.setValue(self.storeValue); + self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW); + } + }], + ref: function (_ref) { + self.combo = _ref; + } + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + cls: "bi-trigger-icon-button time-font icon-size-16", + width: 22, + height: 22, + listeners: [{ + eventName: BI.IconButton.EVENT_CHANGE, + action: function () { + if (self.combo.isViewVisible()) { + // self.combo.hideView(); + } else { + self.combo.showView(); + } + } + }], + ref: function (_ref) { + self.triggerBtn = _ref; + } + }, + top: 0, + right: 0 + }] + }] + }; + }, + + setValue: function (v) { + this.storeValue = v; + this.trigger.setValue(v); + }, + getValue: function () { + return this.storeValue; + }, + + hidePopupView: function () { + this.combo.hideView(); + }, + + _setNowTime: function () { + var date = BI.getDate(); + var nowTome = { + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }; + this.setValue(nowTome); + this.hidePopupView(); + this.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }); + + BI.TimeCombo.EVENT_CANCEL = "EVENT_CANCEL"; + BI.TimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; + BI.TimeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; + BI.shortcut("bi.time_combo", BI.TimeCombo); +})();!(function () { + BI.TimeTrigger = BI.inherit(BI.Trigger, { + props: { + extraCls: "bi-time-trigger", + height: 22, + width: 80, + value: {} + }, + render: function () { + var self = this, o = this.options; + return { + type: "bi.htape", + items: [{ + el: { + type: "bi.label", + textAlign: "left", + height: o.height, + width: o.width, + text: this._formatValue(o.value), + ref: function (_ref) { + self.text = _ref; + } + }, + hgap: 4 + }] + }; + }, + + setValue: function (v) { + this.text.setText(this._formatValue(v)); + }, + + _formatValue: function (v) { + var now = BI.getDate(); + return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), "%H:%M:%S") : BI.i18nText("BI-Basic_Unrestricted"); + } + + }); + BI.shortcut("bi.time_trigger", BI.TimeTrigger); +})();/** * Created by Baron on 2015/10/19. */ BI.DateInterval = BI.inherit(BI.Single, { @@ -19590,6 +19878,124 @@ BI.TimeInterval.EVENT_VALID = "EVENT_VALID"; BI.TimeInterval.EVENT_ERROR = "EVENT_ERROR"; BI.TimeInterval.EVENT_CHANGE = "EVENT_CHANGE"; BI.shortcut("bi.time_interval", BI.TimeInterval);/** + * 时间区间 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimePeriods = BI.inherit(BI.Single, { + constants: { + height: 24, + width: 24, + lgap: 15, + offset: 0 + }, + props: { + extraCls: "bi-time-interval", + value: {} + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.absolute", + height: this.constants.height, + items: [{ + el: { + type: "bi.horizontal_auto", + items: [{ + type: "bi.label", + height: this.constants.height, + width: this.constants.width, + text: "-", + ref: function (_ref) { + self.label = _ref; + } + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.center", + height: this.constants.height, + items: [{ + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.left = _ref; + } + }, this._createCombo(o.value.start)), + left: this.constants.offset, + right: this.constants.width / 2, + top: 0, + bottom: 0 + }] + }, { + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.right = _ref; + } + }, this._createCombo(o.value.end)), + left: this.constants.width / 2, + right: this.constants.offset, + top: 0, + bottom: 0 + }] + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }] + }; + }, + + _createCombo: function (v) { + var self = this; + return { + type: "bi.time_combo", + value: v, + listeners: [{ + eventName: BI.TimeCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.left.hidePopupView(); + self.right.hidePopupView(); + } + }, { + eventName: BI.TimeCombo.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CHANGE); + } + }, { + eventName: BI.TimeCombo.EVENT_CONFIRM, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CONFIRM); + } + }] + }; + }, + + setValue: function (date) { + date = date || {}; + this.left.setValue(date.start); + this.right.setValue(date.end); + }, + getValue: function () { + return {start: this.left.getValue(), end: this.right.getValue()}; + } + }); + BI.TimePeriods.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimePeriods.EVENT_CHANGE = "EVENT_CHANGE"; + BI.shortcut("bi.time_periods", BI.TimePeriods); +})();/** * 年份展示面板 * * Created by GUY on 2015/9/2. diff --git a/public/css/font.css b/public/css/font.css index dd4bf86a4..5ed1cf368 100644 --- a/public/css/font.css +++ b/public/css/font.css @@ -140,6 +140,17 @@ content: "\e733"; color: inherit; } +.time-font .b-font { + *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = ''); +} +.time-font .b-font:before { + content: "\e6b1"; + color: inherit; +} +.time-font.disabled .b-font:before { + content: "\e6b1"; + color: inherit; +} .date-change-h-font .b-font { *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = ''); } diff --git a/src/less/lib/font.less b/src/less/lib/font.less index 18b149bfb..77e826e1c 100644 --- a/src/less/lib/font.less +++ b/src/less/lib/font.less @@ -4,6 +4,7 @@ @font-search: "e6dc"; @font-date: "e733"; +@font-time: "e6b1"; @font-right-triangle: "e70c"; @font-copy: "e6bd"; @font-check-mark: "e6cf"; diff --git a/src/less/resource/font.less b/src/less/resource/font.less index 6b29c97bd..b789868b0 100644 --- a/src/less/resource/font.less +++ b/src/less/resource/font.less @@ -32,6 +32,7 @@ .font(search-font, @font-search); .font(date-font, @font-date); +.font(time-font, @font-time); .font-hover(date-change-h-font, @font-change); //子菜单选中 diff --git a/src/widget/time/datetime.popup.js b/src/widget/time/datetime.popup.js new file mode 100644 index 000000000..97c741c8a --- /dev/null +++ b/src/widget/time/datetime.popup.js @@ -0,0 +1,99 @@ +!(function () { + BI.TimePopup = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-date-time-popup", + height: 68 + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.vtape", + items: [{ + el: { + type: "bi.center_adapt", + cls: "bi-split-top", + items: [{ + type: "bi.dynamic_date_time_select", + value: o.value, + ref: function (_ref) { + self.timeSelect = _ref; + } + }] + }, + hgap: 10, + height: 44 + }, { + el: { + type: "bi.grid", + items: [[{ + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Clears"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-split-left bi-split-right bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_Now"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_NOW_EVENT_CHANGE); + } + }] + }, { + type: "bi.text_button", + forceCenter: true, + cls: "bi-high-light bi-split-top", + shadow: true, + text: BI.i18nText("BI-Basic_OK"), + listeners: [{ + eventName: BI.TextButton.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePopup.BUTTON_OK_EVENT_CHANGE); + } + }] + }]] + }, + height: 24 + }] + }; + }, + + setValue: function (v) { + var value = v; + if (BI.isNull(value)) { + var date = BI.getDate(); + this.timeSelect.setValue({ + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }); + } else { + this.timeSelect.setValue({ + hour: value.hour, + minute: value.minute, + second: value.second + }); + } + }, + + getValue: function () { + return this.timeSelect.getValue(); + } + }); + BI.TimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; + BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; + BI.TimePopup.BUTTON_NOW_EVENT_CHANGE = "BUTTON_NOW_EVENT_CHANGE"; + BI.TimePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; + BI.shortcut("bi.time_popup", BI.TimePopup); +})(); \ No newline at end of file diff --git a/src/widget/time/time.combo.js b/src/widget/time/time.combo.js new file mode 100644 index 000000000..50f8f26c1 --- /dev/null +++ b/src/widget/time/time.combo.js @@ -0,0 +1,152 @@ +/** + * 时间选择 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimeCombo = BI.inherit(BI.Single, { + constants: { + popupHeight: 80, + popupWidth: 240, + comboAdjustHeight: 1, + border: 1 + }, + props: { + baseCls: "bi-time-combo bi-border bi-border-radius", + width: 80, + height: 22 + }, + + render: function () { + var self = this, opts = this.options; + + this.storeValue = opts.value; + + var popup = { + type: "bi.time_popup", + value: opts.value, + listeners: [{ + eventName: BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE, + action: function () { + self.setValue(); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CANCEL); + } + }, { + eventName: BI.TimePopup.BUTTON_OK_EVENT_CHANGE, + action: function () { + self.setValue(self.popup.getValue()); + self.hidePopupView(); + self.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }, { + eventName: BI.TimePopup.BUTTON_NOW_EVENT_CHANGE, + action: function () { + self._setNowTime(); + } + }], + ref: function (_ref) { + self.popup = _ref; + } + }; + return { + type: "bi.htape", + items: [{ + type: "bi.absolute", + items: [{ + el: { + type: "bi.combo", + container: opts.container, + toggle: false, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: { + type: "bi.time_trigger", + value: opts.value, + ref: function (_ref) { + self.trigger = _ref; + } + }, + adjustLength: this.constants.comboAdjustHeight, + popup: { + el: popup, + width: this.constants.popupWidth, + stopPropagation: false + }, + hideChecker: function (e) { + return self.triggerBtn.element.find(e.target).length === 0; + }, + listeners: [{ + eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.popup.setValue(self.storeValue); + self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW); + } + }], + ref: function (_ref) { + self.combo = _ref; + } + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.icon_button", + cls: "bi-trigger-icon-button time-font icon-size-16", + width: 22, + height: 22, + listeners: [{ + eventName: BI.IconButton.EVENT_CHANGE, + action: function () { + if (self.combo.isViewVisible()) { + // self.combo.hideView(); + } else { + self.combo.showView(); + } + } + }], + ref: function (_ref) { + self.triggerBtn = _ref; + } + }, + top: 0, + right: 0 + }] + }] + }; + }, + + setValue: function (v) { + this.storeValue = v; + this.trigger.setValue(v); + }, + getValue: function () { + return this.storeValue; + }, + + hidePopupView: function () { + this.combo.hideView(); + }, + + _setNowTime: function () { + var date = BI.getDate(); + var nowTome = { + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }; + this.setValue(nowTome); + this.hidePopupView(); + this.fireEvent(BI.TimeCombo.EVENT_CONFIRM); + } + }); + + BI.TimeCombo.EVENT_CANCEL = "EVENT_CANCEL"; + BI.TimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; + BI.TimeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; + BI.shortcut("bi.time_combo", BI.TimeCombo); +})(); \ No newline at end of file diff --git a/src/widget/time/time.trigger.js b/src/widget/time/time.trigger.js new file mode 100644 index 000000000..27c4917b4 --- /dev/null +++ b/src/widget/time/time.trigger.js @@ -0,0 +1,40 @@ +!(function () { + BI.TimeTrigger = BI.inherit(BI.Trigger, { + props: { + extraCls: "bi-time-trigger", + height: 22, + width: 80, + value: {} + }, + render: function () { + var self = this, o = this.options; + return { + type: "bi.htape", + items: [{ + el: { + type: "bi.label", + textAlign: "left", + height: o.height, + width: o.width, + text: this._formatValue(o.value), + ref: function (_ref) { + self.text = _ref; + } + }, + hgap: 4 + }] + }; + }, + + setValue: function (v) { + this.text.setText(this._formatValue(v)); + }, + + _formatValue: function (v) { + var now = BI.getDate(); + return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), "%H:%M:%S") : BI.i18nText("BI-Basic_Unrestricted"); + } + + }); + BI.shortcut("bi.time_trigger", BI.TimeTrigger); +})(); \ No newline at end of file diff --git a/src/widget/timeinterval/timeperiods.js b/src/widget/timeinterval/timeperiods.js new file mode 100644 index 000000000..bc4acd12d --- /dev/null +++ b/src/widget/timeinterval/timeperiods.js @@ -0,0 +1,119 @@ +/** + * 时间区间 + * qcc + * 2019/2/28 + */ + +!(function () { + BI.TimePeriods = BI.inherit(BI.Single, { + constants: { + height: 24, + width: 24, + lgap: 15, + offset: 0 + }, + props: { + extraCls: "bi-time-interval", + value: {} + }, + render: function () { + var self = this, o = this.options; + + return { + type: "bi.absolute", + height: this.constants.height, + items: [{ + el: { + type: "bi.horizontal_auto", + items: [{ + type: "bi.label", + height: this.constants.height, + width: this.constants.width, + text: "-", + ref: function (_ref) { + self.label = _ref; + } + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: { + type: "bi.center", + height: this.constants.height, + items: [{ + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.left = _ref; + } + }, this._createCombo(o.value.start)), + left: this.constants.offset, + right: this.constants.width / 2, + top: 0, + bottom: 0 + }] + }, { + type: "bi.absolute", + items: [{ + el: BI.extend({ + ref: function (_ref) { + self.right = _ref; + } + }, this._createCombo(o.value.end)), + left: this.constants.width / 2, + right: this.constants.offset, + top: 0, + bottom: 0 + }] + }] + }, + top: 0, + left: 0, + right: 0, + bottom: 0 + }] + }; + }, + + _createCombo: function (v) { + var self = this; + return { + type: "bi.time_combo", + value: v, + listeners: [{ + eventName: BI.TimeCombo.EVENT_BEFORE_POPUPVIEW, + action: function () { + self.left.hidePopupView(); + self.right.hidePopupView(); + } + }, { + eventName: BI.TimeCombo.EVENT_CHANGE, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CHANGE); + } + }, { + eventName: BI.TimeCombo.EVENT_CONFIRM, + action: function () { + self.fireEvent(BI.TimePeriods.EVENT_CONFIRM); + } + }] + }; + }, + + setValue: function (date) { + date = date || {}; + this.left.setValue(date.start); + this.right.setValue(date.end); + }, + getValue: function () { + return {start: this.left.getValue(), end: this.right.getValue()}; + } + }); + BI.TimePeriods.EVENT_CONFIRM = "EVENT_CONFIRM"; + BI.TimePeriods.EVENT_CHANGE = "EVENT_CHANGE"; + BI.shortcut("bi.time_periods", BI.TimePeriods); +})(); \ No newline at end of file diff --git a/ui/css/font.css b/ui/css/font.css index 17a314471..977a99dc1 100644 --- a/ui/css/font.css +++ b/ui/css/font.css @@ -140,6 +140,17 @@ content: "\e733"; color: inherit; } +.time-font .b-font { + *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = ''); +} +.time-font .b-font:before { + content: "\e6b1"; + color: inherit; +} +.time-font.disabled .b-font:before { + content: "\e6b1"; + color: inherit; +} .date-change-h-font .b-font { *zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = ''); } diff --git a/ui/js/fineui.i18n.js b/ui/js/fineui.i18n.js index 887b15e41..47503440a 100644 --- a/ui/js/fineui.i18n.js +++ b/ui/js/fineui.i18n.js @@ -169,5 +169,6 @@ BI.i18n = { "BI-Basic_Font_Color": "文字颜色", "BI-Basic_Background_Color": "背景色", "BI-Basic_Underline": "下划线", - "BI-Basic_No_Select": "不选" + "BI-Basic_No_Select": "不选", + "BI-Basic_Now": "此刻" }; \ No newline at end of file