Browse Source

codeeditor

es6
guy 8 years ago
parent
commit
e676619b12
  1. 6
      bi/base.css
  2. 19
      bi/base.js
  3. 2
      bi/widget.js
  4. 6
      docs/base.css
  5. 19
      docs/base.js
  6. 2
      docs/widget.js
  7. 19
      src/base/single/editor/editor.code.js
  8. 2
      src/component/treevaluechooser/abstract.treevaluechooser.js
  9. 6
      src/css/base/formula/codemirror.css
  10. 9
      src/less/base/formula/codemirror.less

6
bi/base.css

@ -129,12 +129,6 @@
cursor: text; cursor: text;
width: 100%; width: 100%;
height: 100%; height: 100%;
color: #1a1a1a;
background-color: #ffffff;
}
.bi-theme-dark .CodeMirror {
color: #ffffff;
background-color: #242640;
} }
/* PADDING */ /* PADDING */
.CodeMirror-lines { .CodeMirror-lines {

19
bi/base.js

@ -17706,7 +17706,7 @@ BI.shortcut("bi.text_node", BI.TextNode);/**
BI.CodeEditor = BI.inherit(BI.Single, { BI.CodeEditor = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function () {
return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), { return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-code-editor', baseCls: 'bi-code-editor bi-card',
value: '', value: '',
watermark: "" watermark: ""
}); });
@ -17780,12 +17780,12 @@ BI.CodeEditor = BI.inherit(BI.Single, {
this.editor.setOption("readOnly", b === true ? false : "nocursor") this.editor.setOption("readOnly", b === true ? false : "nocursor")
}, },
insertParam: function(param){ insertParam: function (param) {
var from = this.editor.getCursor(); var from = this.editor.getCursor();
this.editor.replaceSelection(param); this.editor.replaceSelection(param);
var to = this.editor.getCursor(); var to = this.editor.getCursor();
var options = {className: 'param', atomic: true}; var options = {className: 'param', atomic: true};
if(BI.isNotNull(param.match(/^<!.*!>$/))){ if (BI.isNotNull(param.match(/^<!.*!>$/))) {
options.className = 'error-param'; options.className = 'error-param';
} }
this.editor.markText(from, to, options); this.editor.markText(from, to, options);
@ -17793,7 +17793,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
this.editor.focus(); this.editor.focus();
}, },
insertString: function(str){ insertString: function (str) {
this.editor.replaceSelection(str); this.editor.replaceSelection(str);
this.editor.focus(); this.editor.focus();
}, },
@ -17837,7 +17837,16 @@ BI.CodeEditor = BI.inherit(BI.Single, {
}) })
}, },
refresh: function(){ setStyle: function (style) {
this.style = style;
this.element.css(style);
},
getStyle: function () {
return this.style;
},
refresh: function () {
var self = this; var self = this;
BI.nextTick(function () { BI.nextTick(function () {
self.editor.refresh(); self.editor.refresh();

2
bi/widget.js

@ -17319,7 +17319,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var node = self._getTreeNode(parentValues, k); var node = self._getTreeNode(parentValues, k);
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(node.value); newParents.push(node.value);
createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents)); createOneJson(node, node.parent && node.parent.id, getCount(selected[k], newParents));
doCheck(newParents, node, selected[k]); doCheck(newParents, node, selected[k]);
}) })
} }

6
docs/base.css

@ -129,12 +129,6 @@
cursor: text; cursor: text;
width: 100%; width: 100%;
height: 100%; height: 100%;
color: #1a1a1a;
background-color: #ffffff;
}
.bi-theme-dark .CodeMirror {
color: #ffffff;
background-color: #242640;
} }
/* PADDING */ /* PADDING */
.CodeMirror-lines { .CodeMirror-lines {

19
docs/base.js

@ -17706,7 +17706,7 @@ BI.shortcut("bi.text_node", BI.TextNode);/**
BI.CodeEditor = BI.inherit(BI.Single, { BI.CodeEditor = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function () {
return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), { return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-code-editor', baseCls: 'bi-code-editor bi-card',
value: '', value: '',
watermark: "" watermark: ""
}); });
@ -17780,12 +17780,12 @@ BI.CodeEditor = BI.inherit(BI.Single, {
this.editor.setOption("readOnly", b === true ? false : "nocursor") this.editor.setOption("readOnly", b === true ? false : "nocursor")
}, },
insertParam: function(param){ insertParam: function (param) {
var from = this.editor.getCursor(); var from = this.editor.getCursor();
this.editor.replaceSelection(param); this.editor.replaceSelection(param);
var to = this.editor.getCursor(); var to = this.editor.getCursor();
var options = {className: 'param', atomic: true}; var options = {className: 'param', atomic: true};
if(BI.isNotNull(param.match(/^<!.*!>$/))){ if (BI.isNotNull(param.match(/^<!.*!>$/))) {
options.className = 'error-param'; options.className = 'error-param';
} }
this.editor.markText(from, to, options); this.editor.markText(from, to, options);
@ -17793,7 +17793,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
this.editor.focus(); this.editor.focus();
}, },
insertString: function(str){ insertString: function (str) {
this.editor.replaceSelection(str); this.editor.replaceSelection(str);
this.editor.focus(); this.editor.focus();
}, },
@ -17837,7 +17837,16 @@ BI.CodeEditor = BI.inherit(BI.Single, {
}) })
}, },
refresh: function(){ setStyle: function (style) {
this.style = style;
this.element.css(style);
},
getStyle: function () {
return this.style;
},
refresh: function () {
var self = this; var self = this;
BI.nextTick(function () { BI.nextTick(function () {
self.editor.refresh(); self.editor.refresh();

2
docs/widget.js

@ -17319,7 +17319,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var node = self._getTreeNode(parentValues, k); var node = self._getTreeNode(parentValues, k);
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(node.value); newParents.push(node.value);
createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents)); createOneJson(node, node.parent && node.parent.id, getCount(selected[k], newParents));
doCheck(newParents, node, selected[k]); doCheck(newParents, node, selected[k]);
}) })
} }

19
src/base/single/editor/editor.code.js

@ -7,7 +7,7 @@
BI.CodeEditor = BI.inherit(BI.Single, { BI.CodeEditor = BI.inherit(BI.Single, {
_defaultConfig: function () { _defaultConfig: function () {
return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), { return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-code-editor', baseCls: 'bi-code-editor bi-card',
value: '', value: '',
watermark: "" watermark: ""
}); });
@ -81,12 +81,12 @@ BI.CodeEditor = BI.inherit(BI.Single, {
this.editor.setOption("readOnly", b === true ? false : "nocursor") this.editor.setOption("readOnly", b === true ? false : "nocursor")
}, },
insertParam: function(param){ insertParam: function (param) {
var from = this.editor.getCursor(); var from = this.editor.getCursor();
this.editor.replaceSelection(param); this.editor.replaceSelection(param);
var to = this.editor.getCursor(); var to = this.editor.getCursor();
var options = {className: 'param', atomic: true}; var options = {className: 'param', atomic: true};
if(BI.isNotNull(param.match(/^<!.*!>$/))){ if (BI.isNotNull(param.match(/^<!.*!>$/))) {
options.className = 'error-param'; options.className = 'error-param';
} }
this.editor.markText(from, to, options); this.editor.markText(from, to, options);
@ -94,7 +94,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
this.editor.focus(); this.editor.focus();
}, },
insertString: function(str){ insertString: function (str) {
this.editor.replaceSelection(str); this.editor.replaceSelection(str);
this.editor.focus(); this.editor.focus();
}, },
@ -138,7 +138,16 @@ BI.CodeEditor = BI.inherit(BI.Single, {
}) })
}, },
refresh: function(){ setStyle: function (style) {
this.style = style;
this.element.css(style);
},
getStyle: function () {
return this.style;
},
refresh: function () {
var self = this; var self = this;
BI.nextTick(function () { BI.nextTick(function () {
self.editor.refresh(); self.editor.refresh();

2
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -80,7 +80,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
var node = self._getTreeNode(parentValues, k); var node = self._getTreeNode(parentValues, k);
var newParents = BI.clone(parentValues); var newParents = BI.clone(parentValues);
newParents.push(node.value); newParents.push(node.value);
createOneJson(node, BI.last(parentValues), getCount(selected[k], newParents)); createOneJson(node, node.parent && node.parent.id, getCount(selected[k], newParents));
doCheck(newParents, node, selected[k]); doCheck(newParents, node, selected[k]);
}) })
} }

6
src/css/base/formula/codemirror.css

@ -8,12 +8,6 @@
cursor: text; cursor: text;
width: 100%; width: 100%;
height: 100%; height: 100%;
color: #1a1a1a;
background-color: #ffffff;
}
.bi-theme-dark .CodeMirror {
color: #ffffff;
background-color: #242640;
} }
/* PADDING */ /* PADDING */
.CodeMirror-lines { .CodeMirror-lines {

9
src/less/base/formula/codemirror.less

@ -8,15 +8,6 @@
cursor: text; cursor: text;
// .border-radius(4px); // .border-radius(4px);
.size(100%, 100%); .size(100%, 100%);
color: @color-bi-text-black;
background-color: @color-bi-background-default;
}
.bi-theme-dark {
.CodeMirror {
color: @color-bi-text;
background-color: @color-bi-background-default-theme-dark;
}
} }
/* PADDING */ /* PADDING */

Loading…
Cancel
Save