Browse Source

sqleditor supportParam

es6
windy 7 years ago
parent
commit
1f0236d7e8
  1. 1
      demo/js/base/editor/demo.sql_editor.js
  2. 7
      dist/base.js
  3. 7
      dist/bundle.js
  4. 1
      dist/demo.js
  5. 7
      dist/fineui.js
  6. 7
      src/base/sql/editor.sql.js

1
demo/js/base/editor/demo.sql_editor.js

@ -9,6 +9,7 @@ Demo.SQLEditor = BI.inherit(BI.Widget, {
var self = this; var self = this;
this.formula = BI.createWidget({ this.formula = BI.createWidget({
type : 'bi.sql_editor', type : 'bi.sql_editor',
supportParam: true,
width : 300, width : 300,
height : 200, height : 200,
value : "select * from DEMO_CONTRACT where 合同类型 = ${长期协议} and 购买数量 = sum([1,2,3,4])" value : "select * from DEMO_CONTRACT where 合同类型 = ${长期协议} and 购买数量 = sum([1,2,3,4])"

7
dist/base.js vendored

@ -21077,7 +21077,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
value: "", value: "",
lineHeight: 2, lineHeight: 2,
showHint: true, showHint: true,
supportFunction: false supportFunction: false,
supportParam: false
}); });
}, },
_init: function () { _init: function () {
@ -21201,14 +21202,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
var self = this, result; var self = this, result, o = this.options;
this.refresh(); this.refresh();
self.editor.setValue(""); self.editor.setValue("");
result = this._analyzeContent(v || ""); result = this._analyzeContent(v || "");
BI.each(result, function (i, item) { BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/; var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(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)); self.insertParam(str[0].substring(2, item.length - 1));
} else { } else {
self.insertString(item); self.insertString(item);

7
dist/bundle.js vendored

@ -46855,7 +46855,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
value: "", value: "",
lineHeight: 2, lineHeight: 2,
showHint: true, showHint: true,
supportFunction: false supportFunction: false,
supportParam: false
}); });
}, },
_init: function () { _init: function () {
@ -46979,14 +46980,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
var self = this, result; var self = this, result, o = this.options;
this.refresh(); this.refresh();
self.editor.setValue(""); self.editor.setValue("");
result = this._analyzeContent(v || ""); result = this._analyzeContent(v || "");
BI.each(result, function (i, item) { BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/; var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(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)); self.insertParam(str[0].substring(2, item.length - 1));
} else { } else {
self.insertString(item); self.insertString(item);

1
dist/demo.js vendored

@ -843,6 +843,7 @@ Demo.SQLEditor = BI.inherit(BI.Widget, {
var self = this; var self = this;
this.formula = BI.createWidget({ this.formula = BI.createWidget({
type : 'bi.sql_editor', type : 'bi.sql_editor',
supportParam: true,
width : 300, width : 300,
height : 200, height : 200,
value : "select * from DEMO_CONTRACT where 合同类型 = ${长期协议} and 购买数量 = sum([1,2,3,4])" value : "select * from DEMO_CONTRACT where 合同类型 = ${长期协议} and 购买数量 = sum([1,2,3,4])"

7
dist/fineui.js vendored

@ -48549,7 +48549,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
value: "", value: "",
lineHeight: 2, lineHeight: 2,
showHint: true, showHint: true,
supportFunction: false supportFunction: false,
supportParam: false
}); });
}, },
_init: function () { _init: function () {
@ -48673,14 +48674,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
var self = this, result; var self = this, result, o = this.options;
this.refresh(); this.refresh();
self.editor.setValue(""); self.editor.setValue("");
result = this._analyzeContent(v || ""); result = this._analyzeContent(v || "");
BI.each(result, function (i, item) { BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/; var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(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)); self.insertParam(str[0].substring(2, item.length - 1));
} else { } else {
self.insertString(item); self.insertString(item);

7
src/base/sql/editor.sql.js

@ -8,7 +8,8 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
value: "", value: "",
lineHeight: 2, lineHeight: 2,
showHint: true, showHint: true,
supportFunction: false supportFunction: false,
supportParam: false
}); });
}, },
_init: function () { _init: function () {
@ -132,14 +133,14 @@ BI.SQLEditor = BI.inherit(BI.Widget, {
}, },
setValue: function (v) { setValue: function (v) {
var self = this, result; var self = this, result, o = this.options;
this.refresh(); this.refresh();
self.editor.setValue(""); self.editor.setValue("");
result = this._analyzeContent(v || ""); result = this._analyzeContent(v || "");
BI.each(result, function (i, item) { BI.each(result, function (i, item) {
var fieldRegx = /\$[\{][^\}]*[\}]/; var fieldRegx = /\$[\{][^\}]*[\}]/;
var str = item.match(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)); self.insertParam(str[0].substring(2, item.length - 1));
} else { } else {
self.insertString(item); self.insertString(item);

Loading…
Cancel
Save