(function ($) { /*if ("undefined" == typeof IsPopEnableSelfInput) { IsPopEnableSelfInput = false; } */ function onUnselect(target, record) { var opts = getOptions(target); opts.onUnselect.call("", record); $("#TB_" + opts.KeyOfEn).val($(target).mtags("getText")); } function appendSignalNode(target, data) { var opts = getOptions(target); var containerSpan = $(target).find(".ccflow-input-span-container-span"); var valueField = opts.valueField; var textField = opts.textField; if (!contains(target, data, valueField)) { var tag = $(''); tag.data(data); tag.html(data[textField] + ''); containerSpan.append(tag); tag.delegate("i", "click", function (e) { var record = $(this).parent().data(); $(this).parent().remove(); opts.onUnselect.call("", record); $("#TB_" + opts.KeyOfEn).val($(target).mtags("getText")); }); } } function append(target, datas, remove) { var opts = getOptions(target); var container; if (opts.IsEnter == false) container = $(target).find(".ccflow-input-span-container"); else container = $(target).find(".ccflow-input-span-container-span"); if (remove) { container.children("span").remove(); } var valueField = opts.valueField; var textField = opts.textField; for (var i = 0; i < datas.length; i++) { var data = datas[i]; if (!contains(target, data, valueField)) { var tag = $(''); tag.data(data); tag.html(data[textField] + ''); container.append(tag); tag.delegate("i", "click", function (e) { var record = $(this).parent().data(); $(this).parent().remove(); opts.onUnselect.call("", record); $("#TB_" + opts.KeyOfEn).val($(target).mtags("getText")); }); } } } function loadData(target, datas) { append(target, datas, true); } function clear(target) { if (opts.IsEnter == false) $(target).find(".ccflow-input-span-container span").remove(); else $(target).find(".ccflow-input-span-container-span span").remove(); } function setValues(target, values) { append(target, datas); } function getText(target) { var opts = getOptions(target); var textField = opts.textField; var text = []; if (opts.IsEnter == false) $(target).find(".ccflow-input-span-container span").each(function () { text.push($(this).data()[textField]); }); else $(target).find(".ccflow-input-span-container-span span").each(function () { text.push($(this).data()[textField]); }); return text.join(","); } function getValue(target) { var opts = getOptions(target); var valueField = opts.valueField; var text = []; if (opts.IsEnter == false) $(target).find(".ccflow-input-span-container span").each(function () { text.push($(this).data()[valueField]); }); else $(target).find(".ccflow-input-span-container-span span").each(function () { text.push($(this).data()[valueField]); }); return text.join(","); } function getOptions(target) { return $.data(target, "mtags").options; } function contains(target, data, valueField) { var flag = false; var opts = getOptions(target); if (opts.IsEnter == false) $(target).find(".ccflow-input-span-container span").each(function () { if (data[valueField] == $(this).data()[valueField]) { flag = true; return; } }); else $(target).find(".ccflow-input-span-container-span span").each(function () { if (data[valueField] == $(this).data()[valueField]) { flag = true; return; } }); return flag; } function create(target) { var opts = getOptions(target); var html = ""; if (opts.IsEnter == true) { html += '