From 1f0236d7e89d0e1ad407a5cbe958bc340707414b Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 15 Jan 2018 15:53:20 +0800 Subject: [PATCH] sqleditor supportParam --- demo/js/base/editor/demo.sql_editor.js | 1 + dist/base.js | 7 ++++--- dist/bundle.js | 7 ++++--- dist/demo.js | 1 + dist/fineui.js | 7 ++++--- src/base/sql/editor.sql.js | 7 ++++--- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/demo/js/base/editor/demo.sql_editor.js b/demo/js/base/editor/demo.sql_editor.js index 8be6fdf80..5a708adb0 100644 --- a/demo/js/base/editor/demo.sql_editor.js +++ b/demo/js/base/editor/demo.sql_editor.js @@ -9,6 +9,7 @@ Demo.SQLEditor = BI.inherit(BI.Widget, { var self = this; this.formula = BI.createWidget({ type : 'bi.sql_editor', + supportParam: true, width : 300, height : 200, value : "select * from DEMO_CONTRACT where 合同类型 = ${长期协议} and 购买数量 = sum([1,2,3,4])" diff --git a/dist/base.js b/dist/base.js index b3c12851c..c616285d2 100644 --- a/dist/base.js +++ b/dist/base.js @@ -21077,7 +21077,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, { value: "", lineHeight: 2, showHint: true, - supportFunction: false + supportFunction: false, + supportParam: false }); }, _init: function () { @@ -21201,14 +21202,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, { }, setValue: function (v) { - var self = this, result; + var self = this, result, o = this.options; this.refresh(); self.editor.setValue(""); result = this._analyzeContent(v || ""); BI.each(result, function (i, item) { var fieldRegx = /\$[\{][^\}]*[\}]/; var str = item.match(fieldRegx); - if (BI.isNotEmptyArray(str)) { + if (BI.isNotEmptyArray(str) && o.supportParam) { self.insertParam(str[0].substring(2, item.length - 1)); } else { self.insertString(item); diff --git a/dist/bundle.js b/dist/bundle.js index 07b85ca46..fa54ab575 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -46855,7 +46855,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, { value: "", lineHeight: 2, showHint: true, - supportFunction: false + supportFunction: false, + supportParam: false }); }, _init: function () { @@ -46979,14 +46980,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, { }, setValue: function (v) { - var self = this, result; + var self = this, result, o = this.options; this.refresh(); self.editor.setValue(""); result = this._analyzeContent(v || ""); BI.each(result, function (i, item) { var fieldRegx = /\$[\{][^\}]*[\}]/; var str = item.match(fieldRegx); - if (BI.isNotEmptyArray(str)) { + if (BI.isNotEmptyArray(str) && o.supportParam) { self.insertParam(str[0].substring(2, item.length - 1)); } else { self.insertString(item); diff --git a/dist/demo.js b/dist/demo.js index 9e088bdd5..0ddcded72 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -843,6 +843,7 @@ Demo.SQLEditor = BI.inherit(BI.Widget, { var self = this; this.formula = BI.createWidget({ type : 'bi.sql_editor', + supportParam: true, width : 300, height : 200, value : "select * from DEMO_CONTRACT where 合同类型 = ${长期协议} and 购买数量 = sum([1,2,3,4])" diff --git a/dist/fineui.js b/dist/fineui.js index 307efcfdb..fe12250fc 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -48549,7 +48549,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, { value: "", lineHeight: 2, showHint: true, - supportFunction: false + supportFunction: false, + supportParam: false }); }, _init: function () { @@ -48673,14 +48674,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, { }, setValue: function (v) { - var self = this, result; + var self = this, result, o = this.options; this.refresh(); self.editor.setValue(""); result = this._analyzeContent(v || ""); BI.each(result, function (i, item) { var fieldRegx = /\$[\{][^\}]*[\}]/; var str = item.match(fieldRegx); - if (BI.isNotEmptyArray(str)) { + if (BI.isNotEmptyArray(str) && o.supportParam) { self.insertParam(str[0].substring(2, item.length - 1)); } else { self.insertString(item); diff --git a/src/base/sql/editor.sql.js b/src/base/sql/editor.sql.js index f4c4815de..1870c4a18 100644 --- a/src/base/sql/editor.sql.js +++ b/src/base/sql/editor.sql.js @@ -8,7 +8,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, { value: "", lineHeight: 2, showHint: true, - supportFunction: false + supportFunction: false, + supportParam: false }); }, _init: function () { @@ -132,14 +133,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, { }, setValue: function (v) { - var self = this, result; + var self = this, result, o = this.options; this.refresh(); self.editor.setValue(""); result = this._analyzeContent(v || ""); BI.each(result, function (i, item) { var fieldRegx = /\$[\{][^\}]*[\}]/; var str = item.match(fieldRegx); - if (BI.isNotEmptyArray(str)) { + if (BI.isNotEmptyArray(str) && o.supportParam) { self.insertParam(str[0].substring(2, item.length - 1)); } else { self.insertString(item);