diff --git a/src/case/combo/textvaluedownlistcombo/combo.textvaluedownlist.js b/src/case/combo/textvaluedownlistcombo/combo.textvaluedownlist.js deleted file mode 100644 index 734395889..000000000 --- a/src/case/combo/textvaluedownlistcombo/combo.textvaluedownlist.js +++ /dev/null @@ -1,100 +0,0 @@ -/** - * @class BI.TextValueDownListCombo - * @extend BI.Widget - */ -BI.TextValueDownListCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.TextValueDownListCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-text-value-down-list-combo", - height: 24, - attributes: { - tabIndex: 0 - } - }); - }, - - _init: function () { - BI.TextValueDownListCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - - this._createValueMap(); - - var value; - if(BI.isNotNull(o.value)) { - value = this._digest(o.value); - } - this.trigger = BI.createWidget({ - type: "bi.down_list_select_text_trigger", - cls: "text-value-down-list-trigger", - height: o.height, - items: o.items, - text: o.text, - value: value - }); - - this.combo = BI.createWidget({ - type: "bi.down_list_combo", - element: this, - chooseType: BI.Selection.Single, - adjustLength: 2, - height: o.height, - el: this.trigger, - value: BI.isNull(value) ? [] : [value], - items: BI.deepClone(o.items) - }); - - this.combo.on(BI.DownListCombo.EVENT_CHANGE, function () { - var currentVal = self.combo.getValue()[0].value; - if (currentVal !== self.value) { - self.setValue(currentVal); - self.fireEvent(BI.TextValueDownListCombo.EVENT_CHANGE); - } - }); - - this.combo.on(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, function () { - var currentVal = self.combo.getValue()[0].childValue; - if (currentVal !== self.value) { - self.setValue(currentVal); - self.fireEvent(BI.TextValueDownListCombo.EVENT_CHANGE); - } - }); - }, - - _createValueMap: function () { - var self = this; - this.valueMap = {}; - BI.each(BI.flatten(this.options.items), function (idx, item) { - if (BI.has(item, "el")) { - BI.each(item.children, function (id, it) { - self.valueMap[it.value] = {value: item.el.value, childValue: it.value}; - }); - } else { - self.valueMap[item.value] = {value: item.value}; - } - }); - }, - - _digest: function (v) { - this.value = v; - return this.valueMap[v]; - }, - - setValue: function (v) { - v = this._digest(v); - this.combo.setValue([v]); - this.trigger.setValue(v); - }, - - getValue: function () { - var v = this.combo.getValue()[0]; - return [v.childValue || v.value]; - }, - - populate: function (items) { - this.options.items = BI.flatten(items); - this.combo.populate(items); - this._createValueMap(); - } -}); -BI.TextValueDownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.text_value_down_list_combo", BI.TextValueDownListCombo); \ No newline at end of file diff --git a/src/case/combo/textvaluedownlistcombo/trigger.textvaluedownlist.js b/src/case/combo/textvaluedownlistcombo/trigger.textvaluedownlist.js deleted file mode 100644 index b335ce5c1..000000000 --- a/src/case/combo/textvaluedownlistcombo/trigger.textvaluedownlist.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * 选择字段trigger, downlist专用 - * 显示形式为 父亲值(儿子值) - * - * @class BI.DownListSelectTextTrigger - * @extends BI.Trigger - */ -BI.DownListSelectTextTrigger = BI.inherit(BI.Trigger, { - - _defaultConfig: function () { - return BI.extend(BI.DownListSelectTextTrigger.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-down-list-select-text-trigger", - height: 24, - text: "" - }); - }, - - _init: function () { - BI.DownListSelectTextTrigger.superclass._init.apply(this, arguments); - var o = this.options; - this.trigger = BI.createWidget({ - type: "bi.select_text_trigger", - element: this, - height: o.height, - items: this._formatItemArray(o.items), - text: o.text, - value: BI.isNull(o.value) ? "" : o.value.childValue || o.value.value - }); - }, - - _formatItemArray: function () { - var sourceArray = BI.flatten(BI.deepClone(this.options.items)); - var targetArray = []; - BI.each(sourceArray, function (idx, item) { - if(BI.has(item, "el")) { - BI.each(item.children, function (id, it) { - it.text = item.el.text + "(" + it.text + ")"; - }); - targetArray = BI.concat(targetArray, item.children); - }else{ - targetArray.push(item); - } - }); - return targetArray; - }, - - setValue: function (vals) { - this.trigger.setValue(vals.childValue || vals.value); - }, - - populate: function (items) { - this.trigger.populate(this._formatItemArray(items)); - } -}); -BI.shortcut("bi.down_list_select_text_trigger", BI.DownListSelectTextTrigger); \ No newline at end of file