imp
6 years ago
129 changed files with 39911 additions and 137548 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,135 +0,0 @@
|
||||
/** |
||||
* canvas绘图 |
||||
* |
||||
* Created by GUY on 2015/11/18. |
||||
* @class BI.Canvas |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.Canvas = BI.inherit(BI.Widget, { |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.Canvas.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-canvas" |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.Canvas.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
var canvas = document.createElement("canvas"); |
||||
if (!document.createElement("canvas").getContext) { |
||||
canvas = window.G_vmlCanvasManager.initElement(canvas); |
||||
} |
||||
this.element.append(canvas); |
||||
canvas.width = o.width; |
||||
canvas.height = o.height; |
||||
$(canvas).width("100%"); |
||||
$(canvas).height("100%"); |
||||
this.canvas = canvas; |
||||
this._queue = []; |
||||
}, |
||||
|
||||
mounted: function () { |
||||
this.stroke(); |
||||
}, |
||||
|
||||
_getContext: function () { |
||||
if (!this.ctx) { |
||||
this.ctx = this.canvas.getContext("2d"); |
||||
} |
||||
return this.ctx; |
||||
}, |
||||
|
||||
_attr: function (key, value) { |
||||
var self = this; |
||||
if (BI.isNull(key)) { |
||||
return; |
||||
} |
||||
if (BI.isObject(key)) { |
||||
BI.each(key, function (k, v) { |
||||
self._queue.push({ k: k, v: v }); |
||||
}); |
||||
return; |
||||
} |
||||
this._queue.push({ k: key, v: value }); |
||||
}, |
||||
|
||||
_line: function (x0, y0) { |
||||
var self = this; |
||||
var args = [].slice.call(arguments, 2); |
||||
if (BI.isOdd(args.length)) { |
||||
this._attr(BI.last(args)); |
||||
args = BI.initial(args); |
||||
} |
||||
this._attr("moveTo", [x0, y0]); |
||||
var odd = BI.filter(args, function (i) { |
||||
return i % 2 === 0; |
||||
}); |
||||
var even = BI.filter(args, function (i) { |
||||
return i % 2 !== 0; |
||||
}); |
||||
args = BI.zip(odd, even); |
||||
BI.each(args, function (i, point) { |
||||
self._attr("lineTo", point); |
||||
}); |
||||
}, |
||||
|
||||
line: function (x0, y0, x1, y1) { |
||||
this._line.apply(this, arguments); |
||||
this._attr("stroke", []); |
||||
}, |
||||
|
||||
rect: function (x, y, w, h, color) { |
||||
this._attr("fillStyle", color); |
||||
this._attr("fillRect", [x, y, w, h]); |
||||
}, |
||||
|
||||
circle: function (x, y, radius, color) { |
||||
this._attr({ |
||||
fillStyle: color, |
||||
beginPath: [], |
||||
arc: [x, y, radius, 0, Math.PI * 2, true], |
||||
closePath: [], |
||||
fill: [] |
||||
}); |
||||
}, |
||||
|
||||
hollow: function () { |
||||
this._attr("beginPath", []); |
||||
this._line.apply(this, arguments); |
||||
this._attr("closePath", []); |
||||
this._attr("stroke", []); |
||||
}, |
||||
|
||||
solid: function () { |
||||
this.hollow.apply(this, arguments); |
||||
this._attr("fill", []); |
||||
}, |
||||
|
||||
gradient: function (x0, y0, x1, y1, start, end) { |
||||
var grd = this._getContext().createLinearGradient(x0, y0, x1, y1); |
||||
grd.addColorStop(0, start); |
||||
grd.addColorStop(1, end); |
||||
return grd; |
||||
}, |
||||
|
||||
reset: function () { |
||||
this._getContext().clearRect(0, 0, this.canvas.width, this.canvas.height); |
||||
}, |
||||
|
||||
stroke: function () { |
||||
var ctx = this._getContext(); |
||||
if(!ctx) { |
||||
return false; |
||||
} |
||||
BI.each(this._queue, function (i, q) { |
||||
if (BI.isFunction(ctx[q.k])) { |
||||
ctx[q.k].apply(ctx, q.v); |
||||
} else { |
||||
ctx[q.k] = q.v; |
||||
} |
||||
}); |
||||
this._queue = []; |
||||
} |
||||
}); |
||||
BI.shortcut("bi.canvas", BI.Canvas); |
File diff suppressed because it is too large
Load Diff
@ -1,88 +0,0 @@
|
||||
(function (mod) { |
||||
mod(CodeMirror); |
||||
})(function (CodeMirror) { |
||||
var Pos = CodeMirror.Pos; |
||||
|
||||
function forEach (arr, f) { |
||||
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); |
||||
} |
||||
|
||||
function arrayContains (arr, item) { |
||||
if (!Array.prototype.indexOf) { |
||||
var i = arr.length; |
||||
while (i--) { |
||||
if (arr[i] === item) { |
||||
return true; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
return arr.indexOf(item) != -1; |
||||
} |
||||
|
||||
function scriptHint (editor, keywords, getToken, options) { |
||||
// Find the token at the cursor
|
||||
var cur = editor.getCursor(), token = getToken(editor, cur); |
||||
if (/\b(?:string)\b/.test(token.type)) { |
||||
return; |
||||
} |
||||
token.state = CodeMirror.innerMode(editor.getMode(), token.state).state; |
||||
|
||||
if (!/^[\w$_]*$/.test(token.string)) { |
||||
token = { |
||||
start: cur.ch, end: cur.ch, string: "", state: token.state, |
||||
type: token.string == "." ? "property" : null |
||||
}; |
||||
} else if (token.end > cur.ch) { |
||||
token.end = cur.ch; |
||||
token.string = token.string.slice(0, cur.ch - token.start); |
||||
} |
||||
|
||||
var tprop = token; |
||||
// If it is a property, find out what it is a property of.
|
||||
while (tprop.type == "property") { |
||||
tprop = getToken(editor, Pos(cur.line, tprop.start)); |
||||
if (tprop.string != ".") return; |
||||
tprop = getToken(editor, Pos(cur.line, tprop.start)); |
||||
if (!context) var context = []; |
||||
context.push(tprop); |
||||
} |
||||
return { |
||||
list: getCompletions(token, context, keywords, options), |
||||
from: Pos(cur.line, token.start), |
||||
to: Pos(cur.line, token.end) |
||||
}; |
||||
} |
||||
|
||||
function getFormulaKeywords () { |
||||
return BI.FormulaCollections; |
||||
} |
||||
|
||||
function formulaHint (editor, options) { |
||||
return scriptHint(editor, getFormulaKeywords(), |
||||
function (e, cur) { |
||||
return e.getTokenAt(cur); |
||||
}, |
||||
options); |
||||
} |
||||
CodeMirror.registerHelper("hint", "formula", formulaHint); |
||||
|
||||
function getCompletions (token, context, keywords, options) { |
||||
var found = [], start = token.string; |
||||
if (!start) { |
||||
return found; |
||||
} |
||||
function maybeAdd (str) { |
||||
if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) { |
||||
found.push(str); |
||||
} |
||||
} |
||||
|
||||
if (context && context.length) { |
||||
context.pop(); |
||||
} else { |
||||
forEach(keywords, maybeAdd); |
||||
} |
||||
return found; |
||||
} |
||||
}); |
@ -1,84 +0,0 @@
|
||||
(function (mod) { |
||||
mod(CodeMirror); |
||||
})(function (CodeMirror) { |
||||
"use strict"; |
||||
|
||||
CodeMirror.defineMode("formula", function () { |
||||
function wordObj (words) { |
||||
var o = {}; |
||||
for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true; |
||||
return o; |
||||
} |
||||
|
||||
var atoms = wordObj(["false", "true"]); |
||||
var keywords = wordObj(BI.FormulaCollections); |
||||
|
||||
function tokenBase (stream, state) { |
||||
if (stream.eatSpace()) { |
||||
return null; |
||||
} |
||||
var ch = stream.next(); |
||||
|
||||
if (ch === "\"" || ch === "'") { |
||||
nextUntilUnescaped(stream, ch); |
||||
return "string"; |
||||
} |
||||
if (ch === "\u200b") { |
||||
nextUntilUnescaped(stream, ch); |
||||
return "field"; |
||||
} |
||||
if (/[\[\],\(\)]/.test(ch)) { |
||||
return "bracket"; |
||||
} |
||||
|
||||
// richie:暂时不需要解析操作符号
|
||||
// if (/[+\-*\/=<>!&|]/.test(ch)) {
|
||||
// return 'operator';
|
||||
// }
|
||||
// if (/\d|\d./.test(ch)) {
|
||||
// stream.eatWhile(/\d|\./);
|
||||
// if (stream.eol() || !/\w/.test(stream.peek())) {
|
||||
// return 'number';
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
stream.eatWhile(/[\w-]/); |
||||
var word = stream.current(); |
||||
if (atoms.hasOwnProperty(word)) { |
||||
return "atom"; |
||||
} |
||||
if (keywords.hasOwnProperty(word)) { |
||||
return "keyword"; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
function nextUntilUnescaped (stream, end) { |
||||
var escaped = false, next; |
||||
while ((next = stream.next()) != null) { |
||||
if (next === end && !escaped) { |
||||
return false; |
||||
} |
||||
escaped = !escaped && next === "\\"; |
||||
} |
||||
return escaped; |
||||
} |
||||
|
||||
function tokenize (stream, state) { |
||||
return (state.tokens[0] || tokenBase)(stream, state); |
||||
} |
||||
|
||||
return { |
||||
startState: function () { |
||||
return {tokens: []}; |
||||
}, |
||||
token: function (stream, state) { |
||||
return tokenize(stream, state); |
||||
}, |
||||
fold: "brace" |
||||
}; |
||||
}); |
||||
CodeMirror.defineMIME("text/fx-formula", "formula"); |
||||
}); |
@ -1,434 +0,0 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function (mod) { |
||||
mod(CodeMirror); |
||||
})(function (CodeMirror) { |
||||
"use strict"; |
||||
|
||||
var HINT_ELEMENT_CLASS = "CodeMirror-hint"; |
||||
var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active"; |
||||
|
||||
// This is the old interface, kept around for now to stay
|
||||
// backwards-compatible.
|
||||
CodeMirror.showHint = function (cm, getHints, options) { |
||||
if (!getHints) return cm.showHint(options); |
||||
if (options && options.async) getHints.async = true; |
||||
var newOpts = {hint: getHints}; |
||||
if (options) for (var prop in options) newOpts[prop] = options[prop]; |
||||
return cm.showHint(newOpts); |
||||
}; |
||||
|
||||
CodeMirror.defineExtension("showHint", function (options) { |
||||
// We want a single cursor position.
|
||||
if (this.listSelections().length > 1 || this.somethingSelected()) return; |
||||
|
||||
if (this.state.completionActive) this.state.completionActive.close(); |
||||
var completion = this.state.completionActive = new Completion(this, options); |
||||
if (!completion.options.hint) return; |
||||
|
||||
CodeMirror.signal(this, "startCompletion", this); |
||||
completion.update(true); |
||||
}); |
||||
|
||||
function Completion (cm, options) { |
||||
this.cm = cm; |
||||
this.options = this.buildOptions(options); |
||||
this.widget = null; |
||||
this.debounce = 0; |
||||
this.tick = 0; |
||||
this.startPos = this.cm.getCursor(); |
||||
this.startLen = this.cm.getLine(this.startPos.line).length; |
||||
|
||||
var self = this; |
||||
cm.on("cursorActivity", this.activityFunc = function () { |
||||
self.cursorActivity(); |
||||
}); |
||||
} |
||||
|
||||
var requestAnimationFrame = window.requestAnimationFrame || function (fn) { |
||||
return setTimeout(fn, 1000 / 60); |
||||
}; |
||||
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout; |
||||
|
||||
Completion.prototype = { |
||||
close: function () { |
||||
if (!this.active()) return; |
||||
this.cm.state.completionActive = null; |
||||
this.tick = null; |
||||
this.cm.off("cursorActivity", this.activityFunc); |
||||
|
||||
if (this.widget && this.data) CodeMirror.signal(this.data, "close"); |
||||
if (this.widget) this.widget.close(); |
||||
CodeMirror.signal(this.cm, "endCompletion", this.cm); |
||||
}, |
||||
|
||||
active: function () { |
||||
return this.cm.state.completionActive == this; |
||||
}, |
||||
|
||||
pick: function (data, i) { |
||||
var completion = data.list[i]; |
||||
if (completion.hint) completion.hint(this.cm, data, completion); |
||||
else { |
||||
this.cm.replaceRange(getText(completion), completion.from || data.from, |
||||
completion.to || data.to, "complete"); |
||||
if(completion.isKeyword === true) { |
||||
}else{ |
||||
var to = this.cm.getCursor(); |
||||
this.cm.markText(completion.from || data.from, to, {className: "#function", atomic: true}); |
||||
this.cm.replaceSelection("() "); |
||||
to = this.cm.getCursor(); |
||||
to.ch = to.ch - 2; |
||||
this.cm.setCursor(to); |
||||
this.cm.focus(); |
||||
} |
||||
} |
||||
CodeMirror.signal(data, "pick", completion); |
||||
this.close(); |
||||
}, |
||||
|
||||
cursorActivity: function () { |
||||
if (this.debounce) { |
||||
cancelAnimationFrame(this.debounce); |
||||
this.debounce = 0; |
||||
} |
||||
|
||||
var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line); |
||||
if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch || |
||||
pos.ch < this.startPos.ch || this.cm.somethingSelected() || |
||||
(pos.ch && this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) { |
||||
this.close(); |
||||
} else { |
||||
var self = this; |
||||
this.debounce = requestAnimationFrame(function () { |
||||
self.update(); |
||||
}); |
||||
if (this.widget) this.widget.disable(); |
||||
} |
||||
}, |
||||
|
||||
update: function (first) { |
||||
if (this.tick == null) return; |
||||
if (this.data) CodeMirror.signal(this.data, "update"); |
||||
if (!this.options.hint.async) { |
||||
this.finishUpdate(this.options.hint(this.cm, this.options), first); |
||||
} else { |
||||
var myTick = ++this.tick, self = this; |
||||
this.options.hint(this.cm, function (data) { |
||||
if (self.tick == myTick) self.finishUpdate(data, first); |
||||
}, this.options); |
||||
} |
||||
}, |
||||
|
||||
finishUpdate: function (data, first) { |
||||
this.data = data; |
||||
|
||||
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle); |
||||
if (this.widget) this.widget.close(); |
||||
if (data && data.list.length) { |
||||
if (picked && data.list.length == 1) { |
||||
this.pick(data, 0); |
||||
} else { |
||||
this.widget = new Widget(this, data); |
||||
CodeMirror.signal(data, "shown"); |
||||
} |
||||
} |
||||
}, |
||||
|
||||
buildOptions: function (options) { |
||||
var editor = this.cm.options.hintOptions; |
||||
var out = {}; |
||||
for (var prop in defaultOptions) out[prop] = defaultOptions[prop]; |
||||
if (editor) { |
||||
for (var prop in editor) {if (editor[prop] !== undefined) out[prop] = editor[prop];} |
||||
} |
||||
if (options) { |
||||
for (var prop in options) {if (options[prop] !== undefined) out[prop] = options[prop];} |
||||
} |
||||
return out; |
||||
} |
||||
}; |
||||
|
||||
function getText (completion) { |
||||
if (typeof completion === "string") return completion; |
||||
return completion.text; |
||||
} |
||||
|
||||
function buildKeyMap (completion, handle) { |
||||
var baseMap = { |
||||
Up: function () { |
||||
handle.moveFocus(-1); |
||||
}, |
||||
Down: function () { |
||||
handle.moveFocus(1); |
||||
}, |
||||
PageUp: function () { |
||||
handle.moveFocus(-handle.menuSize() + 1, true); |
||||
}, |
||||
PageDown: function () { |
||||
handle.moveFocus(handle.menuSize() - 1, true); |
||||
}, |
||||
Home: function () { |
||||
handle.setFocus(0); |
||||
}, |
||||
End: function () { |
||||
handle.setFocus(handle.length - 1); |
||||
}, |
||||
Enter: handle.pick, |
||||
Tab: handle.pick, |
||||
Esc: handle.close |
||||
}; |
||||
var custom = completion.options.customKeys; |
||||
var ourMap = custom ? {} : baseMap; |
||||
|
||||
function addBinding (key, val) { |
||||
var bound; |
||||
if (typeof val !== "string") { |
||||
bound = function (cm) { |
||||
return val(cm, handle); |
||||
}; |
||||
} |
||||
// This mechanism is deprecated
|
||||
else if (baseMap.hasOwnProperty(val)) {bound = baseMap[val];} else {bound = val;} |
||||
ourMap[key] = bound; |
||||
} |
||||
|
||||
if (custom) { |
||||
for (var key in custom) { |
||||
if (custom.hasOwnProperty(key)) {addBinding(key, custom[key]);} |
||||
} |
||||
} |
||||
var extra = completion.options.extraKeys; |
||||
if (extra) { |
||||
for (var key in extra) { |
||||
if (extra.hasOwnProperty(key)) {addBinding(key, extra[key]);} |
||||
} |
||||
} |
||||
return ourMap; |
||||
} |
||||
|
||||
function getHintElement (hintsElement, el) { |
||||
while (el && el != hintsElement) { |
||||
if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el; |
||||
el = el.parentNode; |
||||
} |
||||
} |
||||
|
||||
function Widget (completion, data) { |
||||
this.completion = completion; |
||||
this.data = data; |
||||
this.picked = false; |
||||
var widget = this, cm = completion.cm; |
||||
|
||||
var hints = this.hints = document.createElement("ul"); |
||||
hints.className = "CodeMirror-hints"; |
||||
this.selectedHint = data.selectedHint || 0; |
||||
|
||||
var completions = data.list; |
||||
for (var i = 0; i < completions.length; ++i) { |
||||
var elt = hints.appendChild(document.createElement("li")), cur = completions[i]; |
||||
var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS); |
||||
if (cur.className != null) className = cur.className + " " + className; |
||||
elt.className = className; |
||||
if (cur.render) cur.render(elt, data, cur); |
||||
else elt.appendChild(document.createTextNode(cur.displayText || getText(cur))); |
||||
elt.hintId = i; |
||||
} |
||||
|
||||
var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null); |
||||
var left = pos.left, top = pos.bottom, below = true; |
||||
hints.style.left = left + "px"; |
||||
hints.style.top = top + "px"; |
||||
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
|
||||
var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth); |
||||
var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight); |
||||
(completion.options.container || document.body).appendChild(hints); |
||||
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH; |
||||
if (overlapY > 0) { |
||||
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top); |
||||
if (curTop - height > 0) { // Fits above cursor
|
||||
hints.style.top = (top = pos.top - height) + "px"; |
||||
below = false; |
||||
} else if (height > winH) { |
||||
hints.style.height = (winH - 5) + "px"; |
||||
hints.style.top = (top = pos.bottom - box.top) + "px"; |
||||
var cursor = cm.getCursor(); |
||||
if (data.from.ch != cursor.ch) { |
||||
pos = cm.cursorCoords(cursor); |
||||
hints.style.left = (left = pos.left) + "px"; |
||||
box = hints.getBoundingClientRect(); |
||||
} |
||||
} |
||||
} |
||||
var overlapX = box.right - winW; |
||||
if (overlapX > 0) { |
||||
if (box.right - box.left > winW) { |
||||
hints.style.width = (winW - 5) + "px"; |
||||
overlapX -= (box.right - box.left) - winW; |
||||
} |
||||
hints.style.left = (left = pos.left - overlapX) + "px"; |
||||
} |
||||
|
||||
cm.addKeyMap(this.keyMap = buildKeyMap(completion, { |
||||
moveFocus: function (n, avoidWrap) { |
||||
widget.changeActive(widget.selectedHint + n, avoidWrap); |
||||
}, |
||||
setFocus: function (n) { |
||||
widget.changeActive(n); |
||||
}, |
||||
menuSize: function () { |
||||
return widget.screenAmount(); |
||||
}, |
||||
length: completions.length, |
||||
close: function () { |
||||
completion.close(); |
||||
}, |
||||
pick: function () { |
||||
widget.pick(); |
||||
}, |
||||
data: data |
||||
})); |
||||
|
||||
if (completion.options.closeOnUnfocus) { |
||||
var closingOnBlur; |
||||
cm.on("blur", this.onBlur = function () { |
||||
closingOnBlur = setTimeout(function () { |
||||
completion.close(); |
||||
}, 100); |
||||
}); |
||||
cm.on("focus", this.onFocus = function () { |
||||
clearTimeout(closingOnBlur); |
||||
}); |
||||
} |
||||
|
||||
var startScroll = cm.getScrollInfo(); |
||||
cm.on("scroll", this.onScroll = function () { |
||||
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect(); |
||||
var newTop = top + startScroll.top - curScroll.top; |
||||
var point = newTop - (window.pageYOffset || (document.documentElement || document.body).scrollTop); |
||||
if (!below) point += hints.offsetHeight; |
||||
if (point <= editor.top || point >= editor.bottom) return completion.close(); |
||||
hints.style.top = newTop + "px"; |
||||
hints.style.left = (left + startScroll.left - curScroll.left) + "px"; |
||||
}); |
||||
|
||||
CodeMirror.on(hints, "dblclick", function (e) { |
||||
var t = getHintElement(hints, e.target || e.srcElement); |
||||
if (t && t.hintId != null) { |
||||
widget.changeActive(t.hintId); |
||||
widget.pick(); |
||||
} |
||||
}); |
||||
|
||||
CodeMirror.on(hints, "click", function (e) { |
||||
var t = getHintElement(hints, e.target || e.srcElement); |
||||
if (t && t.hintId != null) { |
||||
widget.changeActive(t.hintId); |
||||
if (completion.options.completeOnSingleClick) widget.pick(); |
||||
} |
||||
}); |
||||
|
||||
CodeMirror.on(hints, "mousedown", function () { |
||||
setTimeout(function () { |
||||
cm.focus(); |
||||
}, 20); |
||||
}); |
||||
|
||||
CodeMirror.signal(data, "select", completions[0], hints.firstChild); |
||||
return true; |
||||
} |
||||
|
||||
Widget.prototype = { |
||||
close: function () { |
||||
if (this.completion.widget != this) return; |
||||
this.completion.widget = null; |
||||
this.hints.parentNode.removeChild(this.hints); |
||||
this.completion.cm.removeKeyMap(this.keyMap); |
||||
|
||||
var cm = this.completion.cm; |
||||
if (this.completion.options.closeOnUnfocus) { |
||||
cm.off("blur", this.onBlur); |
||||
cm.off("focus", this.onFocus); |
||||
} |
||||
cm.off("scroll", this.onScroll); |
||||
}, |
||||
|
||||
disable: function () { |
||||
this.completion.cm.removeKeyMap(this.keyMap); |
||||
var widget = this; |
||||
this.keyMap = { |
||||
Enter: function () { |
||||
widget.picked = true; |
||||
} |
||||
}; |
||||
this.completion.cm.addKeyMap(this.keyMap); |
||||
}, |
||||
|
||||
pick: function () { |
||||
this.completion.pick(this.data, this.selectedHint); |
||||
}, |
||||
|
||||
changeActive: function (i, avoidWrap) { |
||||
if (i >= this.data.list.length) {i = avoidWrap ? this.data.list.length - 1 : 0;} else if (i < 0) {i = avoidWrap ? 0 : this.data.list.length - 1;} |
||||
if (this.selectedHint == i) return; |
||||
var node = this.hints.childNodes[this.selectedHint]; |
||||
node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, ""); |
||||
node = this.hints.childNodes[this.selectedHint = i]; |
||||
node.className += " " + ACTIVE_HINT_ELEMENT_CLASS; |
||||
if (node.offsetTop < this.hints.scrollTop) {this.hints.scrollTop = node.offsetTop - 3;} else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight) {this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;} |
||||
CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node); |
||||
}, |
||||
|
||||
screenAmount: function () { |
||||
return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1; |
||||
} |
||||
}; |
||||
|
||||
CodeMirror.registerHelper("hint", "auto", function (cm, options) { |
||||
var helpers = cm.getHelpers(cm.getCursor(), "hint"), words; |
||||
if (helpers.length) { |
||||
for (var i = 0; i < helpers.length; i++) { |
||||
var cur = helpers[i](cm, options); |
||||
if (cur && cur.list.length) return cur; |
||||
} |
||||
} else if (words = cm.getHelper(cm.getCursor(), "hintWords")) { |
||||
if (words) return CodeMirror.hint.fromList(cm, {words: words}); |
||||
} else if (CodeMirror.hint.anyword) { |
||||
return CodeMirror.hint.anyword(cm, options); |
||||
} |
||||
}); |
||||
|
||||
CodeMirror.registerHelper("hint", "fromList", function (cm, options) { |
||||
var cur = cm.getCursor(), token = cm.getTokenAt(cur); |
||||
var found = []; |
||||
for (var i = 0; i < options.words.length; i++) { |
||||
var word = options.words[i]; |
||||
if (word.slice(0, token.string.length) == token.string) {found.push(word);} |
||||
} |
||||
|
||||
if (found.length) { |
||||
return { |
||||
list: found, |
||||
from: CodeMirror.Pos(cur.line, token.start), |
||||
to: CodeMirror.Pos(cur.line, token.end) |
||||
}; |
||||
} |
||||
}); |
||||
|
||||
CodeMirror.commands.autocomplete = CodeMirror.showHint; |
||||
|
||||
var defaultOptions = { |
||||
hint: CodeMirror.hint.auto, |
||||
completeSingle: true, |
||||
alignWithWord: true, |
||||
closeCharacters: /[\s()\[\]{};:>,]/, |
||||
closeOnUnfocus: true, |
||||
completeOnSingleClick: true, |
||||
container: null, |
||||
customKeys: null, |
||||
extraKeys: null |
||||
}; |
||||
|
||||
CodeMirror.defineOption("hintOptions", null); |
||||
}); |
@ -1,4 +0,0 @@
|
||||
/** |
||||
* Created by User on 2017/3/21. |
||||
*/ |
||||
BI.FormulaCollections = ["abs", "ABS", "acos", "ACOS", "acosh", "ACOSH", "add2array", "ADD2ARRAY", "and", "AND", "array", "ARRAY", "asin", "ASIN", "asinh", "ASINH", "atan", "ATAN", "atan2", "ATAN2", "atanh", "ATANH", "average", "AVERAGE", "bitnot", "BITNOT", "bitoperation", "BITOPERATION", "ceiling", "CEILING", "char", "CHAR", "circular", "CIRCULAR", "class", "CLASS", "cnmoney", "CNMONEY", "code", "CODE", "col", "COL", "colcount", "COLCOUNT", "colname", "COLNAME", "combin", "COMBIN", "concatenate", "CONCATENATE", "correl", "CORREL", "cos", "COS", "cosh", "COSH", "count", "COUNT", "crosslayertotal", "CROSSLAYERTOTAL", "date", "DATE", "datedelta", "DATEDELTA", "datedif", "DATEDIF", "dateinmonth", "DATEINMONTH", "dateinquarter", "DATEINQUARTER", "dateinweek", "DATEINWEEK", "dateinyear", "DATEINYEAR", "datesubdate", "DATESUBDATE", "datetime", "DATETIME", "datetonumber", "DATETONUMBER", "day", "DAY", "days360", "DAYS360", "daysofmonth", "DAYSOFMONTH", "daysofquarter", "DAYSOFQUARTER", "daysofyear", "DAYSOFYEAR", "dayvalue", "DAYVALUE", "decimal", "DECIMAL", "decode", "DECODE", "degrees", "DEGREES", "encode", "ENCODE", "endwith", "ENDWITH", "enmoney", "ENMONEY", "ennumber", "ENNUMBER", "eval", "EVAL", "even", "EVEN", "exact", "EXACT", "exp", "EXP", "fact", "FACT", "fields", "FIELDS", "filename", "FILENAME", "filesize", "FILESIZE", "filetype", "FILETYPE", "find", "FIND", "floor", "FLOOR", "format", "FORMAT", "getuserdepartments", "GETUSERDEPARTMENTS", "getuserjobtitles", "GETUSERJOBTITLES", "greparray", "GREPARRAY", "hierarchy", "HIERARCHY", "hour", "HOUR", "i18n", "I18N", "if", "IF", "inarray", "INARRAY", "index", "INDEX", "indexof", "INDEXOF", "indexofarray", "INDEXOFARRAY", "int", "INT", "isnull", "ISNULL", "joinarray", "JOINARRAY", "jvm", "JVM", "layertotal", "LAYERTOTAL", "left", "LEFT", "len", "LEN", "let", "LET", "ln", "LN", "log", "LOG", "log10", "LOG10", "lower", "LOWER", "lunar", "LUNAR", "map", "MAP", "maparray", "MAPARRAY", "max", "MAX", "median", "MEDIAN", "mid", "MID", "min", "MIN", "minute", "MINUTE", "mod", "MOD", "mom", "MOM", "month", "MONTH", "monthdelta", "MONTHDELTA", "now", "NOW", "numto", "NUMTO", "nvl", "NVL", "odd", "ODD", "or", "OR", "pi", "PI", "power", "POWER", "product", "PRODUCT", "promotion", "PROMOTION", "proper", "PROPER", "proportion", "PROPORTION", "radians", "RADIANS", "rand", "RAND", "randbetween", "RANDBETWEEN", "range", "RANGE", "rank", "RANK", "records", "RECORDS", "regexp", "REGEXP", "removearray", "REMOVEARRAY", "repeat", "REPEAT", "replace", "REPLACE", "reverse", "REVERSE", "reversearray", "REVERSEARRAY", "right", "RIGHT", "round", "ROUND", "round5", "ROUND5", "rounddown", "ROUNDDOWN", "roundup", "ROUNDUP", "row", "ROW", "rowcount", "ROWCOUNT", "second", "SECOND", "seq", "SEQ", "sign", "SIGN", "sin", "SIN", "sinh", "SINH", "slicearray", "SLICEARRAY", "sort", "SORT", "sortarray", "SORTARRAY", "split", "SPLIT", "sql", "SQL", "sqrt", "SQRT", "startwith", "STARTWITH", "stdev", "STDEV", "substitute", "SUBSTITUTE", "sum", "SUM", "sumsq", "SUMSQ", "switch", "SWITCH", "tabledatafields", "TABLEDATAFIELDS", "tabledatas", "TABLEDATAS", "tables", "TABLES", "tan", "TAN", "tanh", "TANH", "time", "TIME", "tobigdecimal", "TOBIGDECIMAL", "tobinary", "TOBINARY", "todate", "TODATE", "today", "TODAY", "todouble", "TODOUBLE", "tohex", "TOHEX", "toimage", "TOIMAGE", "tointeger", "TOINTEGER", "tooctal", "TOOCTAL", "totext", "TOTEXT", "treelayer", "TREELAYER", "trim", "TRIM", "trunc", "TRUNC", "uniquearray", "UNIQUEARRAY", "upper", "UPPER", "uuid", "UUID", "value", "VALUE", "webimage", "WEBIMAGE", "week", "WEEK", "weekdate", "WEEKDATE", "weekday", "WEEKDAY", "weightedaverage", "WEIGHTEDAVERAGE", "year", "YEAR", "yeardelta", "YEARDELTA"]; |
@ -1,274 +0,0 @@
|
||||
/** |
||||
* 公式编辑控件 |
||||
* @class BI.FormulaEditor |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.FormulaEditor = BI.inherit(BI.Single, { |
||||
_defaultConfig: function () { |
||||
return $.extend(BI.FormulaEditor.superclass._defaultConfig.apply(), { |
||||
baseCls: "bi-formula-editor", |
||||
watermark: "", |
||||
value: "", |
||||
fieldTextValueMap: {}, |
||||
showHint: true, |
||||
lineHeight: 2, |
||||
paramFormatter: function (v) { |
||||
return v; |
||||
} |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.FormulaEditor.superclass._init.apply(this, arguments); |
||||
var o = this.options, self = this; |
||||
this.editor = CodeMirror(this.element[0], { |
||||
textWrapping: true, |
||||
lineWrapping: true, |
||||
lineNumbers: false, |
||||
mode: "formula", |
||||
// 解决插入字段由括号或其他特殊字符包围时分裂的bug
|
||||
specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/ |
||||
}); |
||||
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height"); |
||||
this.editor.on("change", function (cm, change) { |
||||
self._checkWaterMark(); |
||||
if (o.showHint) { |
||||
CodeMirror.showHint(cm, CodeMirror.formulaHint, {completeSingle: false}); |
||||
} |
||||
BI.nextTick(function () { |
||||
self.fireEvent(BI.FormulaEditor.EVENT_CHANGE); |
||||
}); |
||||
}); |
||||
|
||||
this.editor.on("focus", function () { |
||||
self._checkWaterMark(); |
||||
self.fireEvent(BI.FormulaEditor.EVENT_FOCUS); |
||||
}); |
||||
|
||||
this.editor.on("blur", function () { |
||||
self.fireEvent(BI.FormulaEditor.EVENT_BLUR); |
||||
}); |
||||
|
||||
this.editor.on("keyup", function (cm, keyboard) { |
||||
self.fireEvent(BI.FormulaEditor.EVENT_KEY_UP, keyboard.key); |
||||
}); |
||||
|
||||
if (BI.isKey(this.options.watermark)) { |
||||
var self = this; |
||||
this.watermark = BI.createWidget({ |
||||
type: "bi.label", |
||||
cls: "bi-water-mark", |
||||
text: this.options.watermark, |
||||
whiteSpace: "nowrap", |
||||
textAlign: "left" |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.absolute", |
||||
element: self, |
||||
items: [{ |
||||
el: self.watermark, |
||||
left: 0, |
||||
top: 0 |
||||
}] |
||||
}); |
||||
|
||||
this.watermark.element.bind( |
||||
"mousedown", function (e) { |
||||
self.insertString(""); |
||||
self.editor.focus(); |
||||
e.stopEvent(); |
||||
} |
||||
); |
||||
this.watermark.element.bind("click", function (e) { |
||||
self.editor.focus(); |
||||
e.stopEvent(); |
||||
}); |
||||
this.watermark.element.css({ |
||||
position: "absolute", |
||||
left: 3, |
||||
right: 3, |
||||
top: 6, |
||||
bottom: 0 |
||||
}); |
||||
} |
||||
|
||||
}, |
||||
|
||||
mounted: function () { |
||||
var o = this.options; |
||||
if(BI.isNotNull(o.value)) { |
||||
this.setValue(o.value); |
||||
} |
||||
}, |
||||
|
||||
_checkWaterMark: function () { |
||||
var o = this.options; |
||||
if (!this.disabledWaterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { |
||||
this.watermark && this.watermark.visible(); |
||||
} else { |
||||
this.watermark && this.watermark.invisible(); |
||||
} |
||||
}, |
||||
|
||||
disableWaterMark: function () { |
||||
this.disabledWaterMark = true; |
||||
this._checkWaterMark(); |
||||
}, |
||||
|
||||
focus: function () { |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
/** |
||||
* 添加字段 |
||||
* @param fieldId |
||||
* @param force, 判断是否强制不标红 |
||||
*/ |
||||
insertField: function (fieldId, force) { |
||||
var value = fieldId; |
||||
var fieldFormattedName = this.options.paramFormatter(fieldId) || "undefined"; |
||||
var from = this.editor.getCursor(); |
||||
// 解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
|
||||
var showName = fieldFormattedName.replaceAll("^<!.*!>$", function (str) { |
||||
return str.substring(2, str.length - 2); |
||||
}); |
||||
this.editor.replaceSelection("\u200b" + showName + "\u200b"); |
||||
var to = this.editor.getCursor(); |
||||
var className = "fieldName"; |
||||
if (BI.isNotNull(fieldFormattedName.match("^<!.*!>$")) && !force) { |
||||
className = "error-field"; |
||||
} |
||||
this.editor.markText(from, to, {className: className, atomic: true, startStyle: "start", endStyle: "end", value: value, replacedWith: $("<span class='" + className + " start end' />").text(showName)[0]}); |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
insertFunction: function (fn) { |
||||
var from = this.editor.getCursor(); |
||||
this.editor.replaceSelection(fn); |
||||
var to = this.editor.getCursor(); |
||||
this.editor.markText(from, to, {className: "#function", atomic: true}); |
||||
this.editor.replaceSelection("() "); |
||||
to = this.editor.getCursor(); |
||||
to.ch = to.ch - 2; |
||||
this.editor.setCursor(to); |
||||
this.editor.focus(); |
||||
}, |
||||
insertOperator: function (op) { |
||||
var from = this.editor.getCursor(); |
||||
this.editor.replaceSelection(op); |
||||
var to = this.editor.getCursor(); |
||||
this.editor.markText(from, to, {className: "%operator", atomic: true}); |
||||
this.editor.replaceSelection(" "); |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
setFunction: function (v) { |
||||
var from = this.editor.getCursor(); |
||||
this.editor.replaceSelection(v); |
||||
var to = this.editor.getCursor(); |
||||
this.editor.markText(from, to, {className: "#function", atomic: true}); |
||||
}, |
||||
|
||||
insertString: function (str) { |
||||
this.editor.replaceSelection(str); |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
getFormulaString: function () { |
||||
return this.editor.getValue(); |
||||
}, |
||||
|
||||
getUsedFields: function () { |
||||
var fieldMap = this.options.fieldTextValueMap; |
||||
var fields = []; |
||||
this.editor.getValue(true, function (line) { |
||||
var value = line.text; |
||||
_.forEach(line.markedSpans, function (i, ms) { |
||||
switch (i.marker.className) { |
||||
case "fieldName": |
||||
case "error-field": |
||||
// 因为插入字段的时候首尾加了不可见字符,所以首尾缩进一个字符
|
||||
var dId = i.marker.value; |
||||
if (!fields.contains(dId)) { |
||||
fields.push(dId); |
||||
} |
||||
|
||||
} |
||||
}); |
||||
}); |
||||
return fields; |
||||
}, |
||||
|
||||
getCheckString: function () { |
||||
return this.editor.getValue(true, function (line) { |
||||
var rawText = line.text, value = line.text, num = 0; |
||||
value.text = rawText; |
||||
var markedSpans = _.clone(line.markedSpans) || []; |
||||
markedSpans.sort(function (a, b) { |
||||
return a.from > b.from; |
||||
}); |
||||
|
||||
_.forEach(markedSpans, function (i, ms) { |
||||
|
||||
switch (i.marker.className) { |
||||
case "fieldName": |
||||
case "error-field": |
||||
var fieldNameLength = i.to - i.from; |
||||
value = value.substr(0, i.from + num) + "$a" + value.substr(i.to + num, value.length); |
||||
num = num + 2 - fieldNameLength; |
||||
break; |
||||
} |
||||
|
||||
}); |
||||
return value; |
||||
}); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
var fieldMap = this.options.fieldTextValueMap; |
||||
var v = this.editor.getValue("\n", function (line) { |
||||
var rawText = line.text, value = line.text, num = 0; |
||||
value.text = rawText; |
||||
var markedSpans = _.clone(line.markedSpans) || []; |
||||
markedSpans.sort(function (a, b) { |
||||
return a.from > b.from; |
||||
}); |
||||
|
||||
_.forEach(markedSpans, function (i, ms) { |
||||
switch (i.marker.className) { |
||||
case "fieldName": |
||||
case "error-field": |
||||
var fieldNameLength = i.to - i.from; |
||||
var start = i.from + num + 1; |
||||
var end = fieldNameLength - 2; |
||||
var fieldId = i.marker.value; |
||||
value = value.substr(0, i.from + num) + "$\{" + fieldId + "\}" + value.substr(i.to + num, value.length); |
||||
num += fieldId.length - fieldNameLength + 3; |
||||
break; |
||||
} |
||||
}); |
||||
return value; |
||||
}); |
||||
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1"); |
||||
}, |
||||
|
||||
setValue: function (value) { |
||||
this.editor.setValue(value); |
||||
}, |
||||
|
||||
setFieldTextValueMap: function (fieldTextValueMap) { |
||||
this.options.fieldTextValueMap = fieldTextValueMap; |
||||
}, |
||||
|
||||
refresh: function () { |
||||
var self = this; |
||||
BI.nextTick(function () { |
||||
self.editor.refresh(); |
||||
}); |
||||
} |
||||
|
||||
}); |
||||
BI.FormulaEditor.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.FormulaEditor.EVENT_BLUR = "EVENT_BLUR"; |
||||
BI.FormulaEditor.EVENT_FOCUS = "EVENT_FOCUS"; |
||||
BI.FormulaEditor.EVENT_KEY_UP = "EVENT_KEY_UP"; |
||||
BI.shortcut("bi.formula_editor", BI.FormulaEditor); |
@ -1,218 +0,0 @@
|
||||
/** |
||||
* |
||||
* Created by GUY on 2016/1/15. |
||||
* @class BI.CodeEditor |
||||
* @extends BI.Single |
||||
*/ |
||||
BI.CodeEditor = BI.inherit(BI.Single, { |
||||
_defaultConfig: function () { |
||||
return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), { |
||||
baseCls: "bi-code-editor", |
||||
value: "", |
||||
watermark: "", |
||||
lineHeight: 2, |
||||
readOnly: false, |
||||
lineNumbers: false, |
||||
paramMatch: true, // 用来判断是否需要在代码中匹配参数,默认为true, R语言是不需要匹配参数
|
||||
// 参数显示值构造函数
|
||||
paramFormatter: function (v) { |
||||
return v; |
||||
} |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.CodeEditor.superclass._init.apply(this, arguments); |
||||
var o = this.options, self = this; |
||||
var conf = { |
||||
textWrapping: true, |
||||
lineWrapping: true, |
||||
lineNumbers: o.lineNumbers, |
||||
readOnly: o.readOnly, |
||||
// 解决插入字段由括号或其他特殊字符包围时分裂的bug
|
||||
specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/ |
||||
}; |
||||
o.readOnly && (conf.cursorBlinkRate = -1); |
||||
this.editor = CodeMirror(this.element[0], conf); |
||||
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height"); |
||||
this.editor.on("change", function (cm, change) { |
||||
BI.nextTick(function () { |
||||
self.fireEvent(BI.CodeEditor.EVENT_CHANGE); |
||||
}); |
||||
}); |
||||
|
||||
this.editor.on("focus", function () { |
||||
self.watermark.setVisible(false); |
||||
self.fireEvent(BI.CodeEditor.EVENT_FOCUS); |
||||
}); |
||||
|
||||
this.editor.on("blur", function () { |
||||
self.watermark.setVisible(BI.isEmptyString(self.getValue())); |
||||
self.fireEvent(BI.CodeEditor.EVENT_BLUR); |
||||
}); |
||||
|
||||
// this.editor.on("mousedown", function (cm, e) {
|
||||
// //IE下mousedown之后会触发blur,所以nextTick后再做focus
|
||||
// BI.nextTick(function () {
|
||||
// self.fireEvent(BI.CodeEditor.EVENT_FOCUS);
|
||||
// });
|
||||
// //e.stopPropagation();
|
||||
// });
|
||||
|
||||
// this.editor.on("blur", function () {
|
||||
// self.editor.execCommand("goLineEnd");
|
||||
// });
|
||||
|
||||
// 水印
|
||||
this.watermark = BI.createWidget({ |
||||
type: "bi.label", |
||||
text: o.watermark, |
||||
cls: "bi-water-mark", |
||||
whiteSpace: "nowrap", |
||||
textAlign: "left" |
||||
}); |
||||
this.watermark.element.bind( |
||||
"mousedown", function (e) { |
||||
self.insertString(""); |
||||
self.editor.focus(); |
||||
e.stopEvent(); |
||||
} |
||||
); |
||||
this.watermark.element.bind("click", function (e) { |
||||
self.editor.focus(); |
||||
e.stopEvent(); |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.absolute", |
||||
element: this, |
||||
items: [{ |
||||
el: this.watermark, |
||||
top: 0, |
||||
left: o.lineNumbers ? 30 + 5 : 5 |
||||
}] |
||||
}); |
||||
}, |
||||
|
||||
mounted: function () { |
||||
var o = this.options; |
||||
if (BI.isNumber(o.value) || BI.isString(o.value)) { |
||||
this.setValue(o.value); |
||||
} |
||||
|
||||
if (BI.isNotNull(o.style)) { |
||||
this.setStyle(o.style); |
||||
} |
||||
}, |
||||
|
||||
_setEnable: function (b) { |
||||
BI.CodeEditor.superclass._setEnable.apply(this, arguments); |
||||
this.editor.setOption("readOnly", b === true ? false : "nocursor"); |
||||
}, |
||||
|
||||
_checkWaterMark: function () { |
||||
var o = this.options; |
||||
if (BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { |
||||
this.watermark && this.watermark.visible(); |
||||
} else { |
||||
this.watermark && this.watermark.invisible(); |
||||
} |
||||
}, |
||||
|
||||
insertParam: function (param) { |
||||
var value = param; |
||||
param = this.options.paramFormatter(param); |
||||
var from = this.editor.getCursor(); |
||||
// 解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
|
||||
this.editor.replaceSelection("\u200b" + param + "\u200b"); |
||||
var to = this.editor.getCursor(); |
||||
var className = "param"; |
||||
if (BI.isNotNull(param.match(/^<!.*!>$/))) { |
||||
className = "error-param"; |
||||
} |
||||
var options = {className: className, atomic: true, replacedWith: $("<span class='" + className + " start end' />").text(param)[0]}; |
||||
options.value = value; |
||||
this.editor.markText(from, to, options); |
||||
this.editor.replaceSelection(" "); |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
insertString: function (str) { |
||||
this.editor.replaceSelection(str); |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.editor.getValue("\n", function (line) { |
||||
var rawText = line.text, value = line.text, num = 0; |
||||
value.text = rawText; |
||||
// 根据插入位置不同,line.markedSpan可能是乱序的
|
||||
_.forEach(_.sortBy(line.markedSpans, "from"), function (i, ms) { |
||||
switch (i.marker.className) { |
||||
case "param": |
||||
case "error-param": |
||||
var fieldNameLength = i.to - i.from; |
||||
value = value.substr(0, i.from + num) + "$\{" + i.marker.value + "\}" + value.substr(i.to + num, value.length); |
||||
// 加上${}的偏移
|
||||
num += 3; |
||||
// 加上实际值和显示值的长度差的偏移
|
||||
num += (i.marker.value.length - fieldNameLength); |
||||
break; |
||||
} |
||||
}); |
||||
return value; |
||||
}); |
||||
}, |
||||
|
||||
_analyzeContent: function (v) { |
||||
var regx = /\$[\{][^\}]*[\}]|[^\$\{]*[^\$\{]|\$[^\{]*[^\$\{]/g; |
||||
return v.match(regx); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
var self = this, o = this.options, result; |
||||
this.refresh(); |
||||
self.editor.setValue(""); |
||||
if(o.paramMatch) { |
||||
result = this._analyzeContent(v || ""); |
||||
BI.each(result, function (i, item) { |
||||
var fieldRegx = /\$[\{][^\}]*[\}]/; |
||||
var str = item.match(fieldRegx); |
||||
if (BI.isNotEmptyArray(str)) { |
||||
self.insertParam(str[0].substring(2, item.length - 1)); |
||||
} else { |
||||
self.insertString(item); |
||||
} |
||||
}); |
||||
}else { |
||||
self.editor.setValue(v); |
||||
} |
||||
this._checkWaterMark(); |
||||
}, |
||||
|
||||
focus: function () { |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
blur: function () { |
||||
this.editor.getInputField().blur(); |
||||
}, |
||||
|
||||
setStyle: function (style) { |
||||
this.style = style; |
||||
this.element.css(style); |
||||
}, |
||||
|
||||
getStyle: function () { |
||||
return this.style; |
||||
}, |
||||
|
||||
refresh: function () { |
||||
var self = this; |
||||
BI.nextTick(function () { |
||||
self.editor.refresh(); |
||||
}); |
||||
} |
||||
}); |
||||
BI.CodeEditor.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.CodeEditor.EVENT_BLUR = "EVENT_BLUR"; |
||||
BI.CodeEditor.EVENT_FOCUS = "EVENT_FOCUS"; |
||||
BI.shortcut("bi.code_editor", BI.CodeEditor); |
@ -1,303 +0,0 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function (mod) { |
||||
mod(CodeMirror); |
||||
})(function (CodeMirror) { |
||||
|
||||
var tables; |
||||
var defaultTable; |
||||
var keywords; |
||||
var identifierQuote; |
||||
var CONS = { |
||||
QUERY_DIV: ";", |
||||
ALIAS_KEYWORD: "AS" |
||||
}; |
||||
var Pos = CodeMirror.Pos, cmpPos = CodeMirror.cmpPos; |
||||
|
||||
function isArray (val) { return Object.prototype.toString.call(val) == "[object Array]"; } |
||||
|
||||
function getKeywords (editor) { |
||||
var mode = editor.doc.modeOption; |
||||
if (mode === "sql") mode = "text/x-sql"; |
||||
return CodeMirror.resolveMode(mode).keywords; |
||||
} |
||||
|
||||
function getIdentifierQuote (editor) { |
||||
var mode = editor.doc.modeOption; |
||||
if (mode === "sql") mode = "text/x-sql"; |
||||
return CodeMirror.resolveMode(mode).identifierQuote || "`"; |
||||
} |
||||
|
||||
function getText (item) { |
||||
return typeof item === "string" ? item : item.text; |
||||
} |
||||
|
||||
function wrapTable (name, value) { |
||||
if (isArray(value)) value = {columns: value}; |
||||
if (!value.text) value.text = name; |
||||
return value; |
||||
} |
||||
|
||||
function parseTables (input) { |
||||
var result = {}; |
||||
if (isArray(input)) { |
||||
for (var i = input.length - 1; i >= 0; i--) { |
||||
var item = input[i]; |
||||
result[getText(item).toUpperCase()] = wrapTable(getText(item), item); |
||||
} |
||||
} else if (input) { |
||||
for (var name in input) {result[name.toUpperCase()] = wrapTable(name, input[name]);} |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
function getTable (name) { |
||||
return tables[name.toUpperCase()]; |
||||
} |
||||
|
||||
function shallowClone (object) { |
||||
var result = {}; |
||||
for (var key in object) { |
||||
if (object.hasOwnProperty(key)) {result[key] = object[key];} |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
function match (string, word) { |
||||
if (BI.isNotEmptyString(string) && word.length !== string.length) { |
||||
var len = string.length; |
||||
var sub = getText(word).substr(0, len); |
||||
return string.toUpperCase() === sub.toUpperCase(); |
||||
} |
||||
} |
||||
|
||||
function addMatches (result, search, wordlist, formatter) { |
||||
if (isArray(wordlist)) { |
||||
for (var i = 0; i < wordlist.length; i++) {if (match(search, wordlist[i])) result.push(formatter(wordlist[i], i));} |
||||
} else { |
||||
for (var word in wordlist) { |
||||
if (wordlist.hasOwnProperty(word)) { |
||||
var val = wordlist[word]; |
||||
if (!val || val === true) {val = word;} else {val = val.displayText ? {text: val.text, displayText: val.displayText} : val.text;} |
||||
if (match(search, val)) result.push(formatter(val, -1)); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
function cleanName (name) { |
||||
// Get rid name from identifierQuote and preceding dot(.)
|
||||
if (name.charAt(0) == ".") { |
||||
name = name.substr(1); |
||||
} |
||||
// replace doublicated identifierQuotes with single identifierQuotes
|
||||
// and remove single identifierQuotes
|
||||
var nameParts = name.split(identifierQuote + identifierQuote); |
||||
for (var i = 0; i < nameParts.length; i++) {nameParts[i] = nameParts[i].replace(new RegExp(identifierQuote, "g"), "");} |
||||
return nameParts.join(identifierQuote); |
||||
} |
||||
|
||||
function insertIdentifierQuotes (name) { |
||||
var nameParts = getText(name).split("."); |
||||
for (var i = 0; i < nameParts.length; i++) { |
||||
nameParts[i] = identifierQuote + |
||||
// doublicate identifierQuotes
|
||||
nameParts[i].replace(new RegExp(identifierQuote, "g"), identifierQuote + identifierQuote) + |
||||
identifierQuote; |
||||
} |
||||
var escaped = nameParts.join("."); |
||||
if (typeof name === "string") return escaped; |
||||
name = shallowClone(name); |
||||
name.text = escaped; |
||||
return name; |
||||
} |
||||
|
||||
function nameCompletion (cur, token, result, editor) { |
||||
// Try to complete table, column names and return start position of completion
|
||||
var useIdentifierQuotes = false; |
||||
var nameParts = []; |
||||
var start = token.start; |
||||
var cont = true; |
||||
while (cont) { |
||||
cont = (token.string.charAt(0) == "."); |
||||
useIdentifierQuotes = useIdentifierQuotes || (token.string.charAt(0) == identifierQuote); |
||||
|
||||
start = token.start; |
||||
nameParts.unshift(cleanName(token.string)); |
||||
|
||||
token = editor.getTokenAt(Pos(cur.line, token.start)); |
||||
if (token.string == ".") { |
||||
cont = true; |
||||
token = editor.getTokenAt(Pos(cur.line, token.start)); |
||||
} |
||||
} |
||||
|
||||
// Try to complete table names
|
||||
var string = nameParts.join("."); |
||||
addMatches(result, string, tables, function (w) { |
||||
return useIdentifierQuotes ? insertIdentifierQuotes(w) : w; |
||||
}); |
||||
|
||||
// Try to complete columns from defaultTable
|
||||
addMatches(result, string, defaultTable, function (w) { |
||||
return useIdentifierQuotes ? insertIdentifierQuotes(w) : w; |
||||
}); |
||||
|
||||
// Try to complete columns
|
||||
string = nameParts.pop(); |
||||
var table = nameParts.join("."); |
||||
|
||||
var alias = false; |
||||
var aliasTable = table; |
||||
// Check if table is available. If not, find table by Alias
|
||||
if (!getTable(table)) { |
||||
var oldTable = table; |
||||
table = findTableByAlias(table, editor); |
||||
if (table !== oldTable) alias = true; |
||||
} |
||||
|
||||
var columns = getTable(table); |
||||
if (columns && columns.columns) {columns = columns.columns;} |
||||
|
||||
if (columns) { |
||||
addMatches(result, string, columns, function (w) { |
||||
var tableInsert = table; |
||||
if (alias == true) tableInsert = aliasTable; |
||||
if (typeof w === "string") { |
||||
w = tableInsert + "." + w; |
||||
} else { |
||||
w = shallowClone(w); |
||||
w.text = tableInsert + "." + w.text; |
||||
} |
||||
return useIdentifierQuotes ? insertIdentifierQuotes(w) : w; |
||||
}); |
||||
} |
||||
|
||||
return start; |
||||
} |
||||
|
||||
function eachWord (lineText, f) { |
||||
var words = lineText.split(/\s+/); |
||||
for (var i = 0; i < words.length; i++) {if (words[i]) f(words[i].replace(/[,;]/g, ""));} |
||||
} |
||||
|
||||
function findTableByAlias (alias, editor) { |
||||
var doc = editor.doc; |
||||
var fullQuery = doc.getValue(); |
||||
var aliasUpperCase = alias.toUpperCase(); |
||||
var previousWord = ""; |
||||
var table = ""; |
||||
var separator = []; |
||||
var validRange = { |
||||
start: Pos(0, 0), |
||||
end: Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).length) |
||||
}; |
||||
|
||||
// add separator
|
||||
var indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV); |
||||
while(indexOfSeparator != -1) { |
||||
separator.push(doc.posFromIndex(indexOfSeparator)); |
||||
indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV, indexOfSeparator + 1); |
||||
} |
||||
separator.unshift(Pos(0, 0)); |
||||
separator.push(Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).text.length)); |
||||
|
||||
// find valid range
|
||||
var prevItem = null; |
||||
var current = editor.getCursor(); |
||||
for (var i = 0; i < separator.length; i++) { |
||||
if ((prevItem == null || cmpPos(current, prevItem) > 0) && cmpPos(current, separator[i]) <= 0) { |
||||
validRange = {start: prevItem, end: separator[i]}; |
||||
break; |
||||
} |
||||
prevItem = separator[i]; |
||||
} |
||||
|
||||
var query = doc.getRange(validRange.start, validRange.end, false); |
||||
|
||||
for (var i = 0; i < query.length; i++) { |
||||
var lineText = query[i]; |
||||
eachWord(lineText, function (word) { |
||||
var wordUpperCase = word.toUpperCase(); |
||||
if (wordUpperCase === aliasUpperCase && getTable(previousWord)) {table = previousWord;} |
||||
if (wordUpperCase !== CONS.ALIAS_KEYWORD) {previousWord = word;} |
||||
}); |
||||
if (table) break; |
||||
} |
||||
return table; |
||||
} |
||||
|
||||
CodeMirror.registerHelper("hint", "sql", function (editor, options) { |
||||
tables = parseTables(options && options.tables); |
||||
var defaultTableName = options && options.defaultTable; |
||||
var disableKeywords = options && options.disableKeywords; |
||||
defaultTable = defaultTableName && getTable(defaultTableName); |
||||
keywords = getKeywords(editor); |
||||
var keywordsCount = BI.size(keywords); |
||||
var functions = []; |
||||
var cur = editor.getCursor(); |
||||
var token = editor.getTokenAt(cur); |
||||
if(options.supportFunction){ |
||||
BI.each(BI.FormulaCollections, function (idx, formula) { |
||||
if(formula.lastIndexOf(token.string, 0) == 0 && !BI.contains(functions, formula)) { |
||||
functions.push(formula); |
||||
} |
||||
}); |
||||
keywords = BI.concat(BI.keys(keywords), functions); |
||||
} |
||||
identifierQuote = getIdentifierQuote(editor); |
||||
|
||||
if (defaultTableName && !defaultTable) {defaultTable = findTableByAlias(defaultTableName, editor);} |
||||
|
||||
defaultTable = defaultTable || []; |
||||
|
||||
if (defaultTable.columns) {defaultTable = defaultTable.columns;} |
||||
|
||||
var result = []; |
||||
var start, end, search; |
||||
if (token.end > cur.ch) { |
||||
token.end = cur.ch; |
||||
token.string = token.string.slice(0, cur.ch - token.start); |
||||
} |
||||
|
||||
if (token.string.match(/^[.`"\w@]\w*$/)) { |
||||
search = token.string; |
||||
start = token.start; |
||||
end = token.end; |
||||
} else { |
||||
start = end = cur.ch; |
||||
search = ""; |
||||
} |
||||
if (search.charAt(0) == "." || search.charAt(0) == identifierQuote) { |
||||
start = nameCompletion(cur, token, result, editor); |
||||
} else { |
||||
addMatches(result, search, tables, function (w) {return w;}); |
||||
addMatches(result, search, defaultTable, function (w) {return w;}); |
||||
if (!disableKeywords) { |
||||
addMatches(result, search, keywords, function (w, i) { |
||||
var isKeyword = i < keywordsCount; |
||||
return { |
||||
isKeyword: isKeyword, |
||||
text: w |
||||
// description: desc[w] || "SQL关键字",
|
||||
// className: isKeyword ? "sql-keyword" : "sql-fr-function",
|
||||
// render: function (Element, self, data) {
|
||||
// var label = BI.createWidget({
|
||||
// type: "bi.label",
|
||||
// element: Element,
|
||||
// text: data.displayText || getText(data)
|
||||
// });
|
||||
// label.setTitle(data.description, {
|
||||
// container: "body"
|
||||
|
||||
// });
|
||||
// }
|
||||
}; |
||||
}); |
||||
} |
||||
} |
||||
|
||||
return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)}; |
||||
}); |
||||
}); |
@ -1,305 +0,0 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function (mod) { |
||||
mod(CodeMirror); |
||||
})(function (CodeMirror) { |
||||
"use strict"; |
||||
|
||||
CodeMirror.defineMode("sql", function (config, parserConfig) { |
||||
"use strict"; |
||||
|
||||
var client = parserConfig.client || {}, |
||||
atoms = parserConfig.atoms || {"false": true, "true": true, "null": true}, |
||||
builtin = parserConfig.builtin || {}, |
||||
keywords = parserConfig.keywords || {}, |
||||
operatorChars = parserConfig.operatorChars || /^[*+\-%<>!=&|~^]/, |
||||
support = parserConfig.support || {}, |
||||
hooks = parserConfig.hooks || {}, |
||||
dateSQL = parserConfig.dateSQL || {date: true, time: true, timestamp: true}, |
||||
functions = parserConfig.functions || {}; |
||||
|
||||
function tokenBase (stream, state) { |
||||
var ch = stream.next(); |
||||
|
||||
// call hooks from the mime type
|
||||
if (hooks[ch]) { |
||||
var result = hooks[ch](stream, state); |
||||
if (result !== false) return result; |
||||
} |
||||
|
||||
if (support.hexNumber && |
||||
((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/)) |
||||
|| (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]+'/))) { |
||||
// hex
|
||||
// ref: http://dev.mysql.com/doc/refman/5.5/en/hexadecimal-literals.html
|
||||
return "number"; |
||||
} else if (support.binaryNumber && |
||||
(((ch == "b" || ch == "B") && stream.match(/^'[01]+'/)) |
||||
|| (ch == "0" && stream.match(/^b[01]+/)))) { |
||||
// bitstring
|
||||
// ref: http://dev.mysql.com/doc/refman/5.5/en/bit-field-literals.html
|
||||
return "number"; |
||||
} else if (ch.charCodeAt(0) > 47 && ch.charCodeAt(0) < 58) { |
||||
// numbers
|
||||
// ref: http://dev.mysql.com/doc/refman/5.5/en/number-literals.html
|
||||
stream.match(/^[0-9]*(\.[0-9]+)?([eE][-+]?[0-9]+)?/); |
||||
support.decimallessFloat && stream.match(/^\.(?!\.)/); |
||||
return "number"; |
||||
} else if (ch == "?" && (stream.eatSpace() || stream.eol() || stream.eat(";"))) { |
||||
// placeholders
|
||||
return "variable-3"; |
||||
} else if (ch == "'" || (ch == "\"" && support.doubleQuote)) { |
||||
// strings
|
||||
// ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
|
||||
state.tokenize = tokenLiteral(ch); |
||||
return state.tokenize(stream, state); |
||||
} else if ((((support.nCharCast && (ch == "n" || ch == "N")) |
||||
|| (support.charsetCast && ch == "_" && stream.match(/[a-z][a-z0-9]*/i))) |
||||
&& (stream.peek() == "'" || stream.peek() == "\""))) { |
||||
// charset casting: _utf8'str', N'str', n'str'
|
||||
// ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
|
||||
return "keyword"; |
||||
} else if (/^[\(\),\;\[\]]/.test(ch)) { |
||||
// no highlighting
|
||||
return null; |
||||
} else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) { |
||||
// 1-line comment
|
||||
stream.skipToEnd(); |
||||
return "comment"; |
||||
} else if ((support.commentHash && ch == "#") |
||||
|| (ch == "-" && stream.eat("-") && (!support.commentSpaceRequired || stream.eat(" ")))) { |
||||
// 1-line comments
|
||||
// ref: https://kb.askmonty.org/en/comment-syntax/
|
||||
stream.skipToEnd(); |
||||
return "comment"; |
||||
} else if (ch == "/" && stream.eat("*")) { |
||||
// multi-line comments
|
||||
// ref: https://kb.askmonty.org/en/comment-syntax/
|
||||
state.tokenize = tokenComment(1); |
||||
return state.tokenize(stream, state); |
||||
} else if (ch == ".") { |
||||
// .1 for 0.1
|
||||
if (support.zerolessFloat && stream.match(/^(?:\d+(?:e[+-]?\d+)?)/i)) {return "number";} |
||||
if (stream.match(/^\.+/)) {return null;} |
||||
// .table_name (ODBC)
|
||||
// // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html
|
||||
if (support.ODBCdotTable && stream.match(/^[\w\d_]+/)) {return "variable-2";} |
||||
} else if (operatorChars.test(ch)) { |
||||
// operators
|
||||
stream.eatWhile(operatorChars); |
||||
return null; |
||||
} else if (ch == "{" && |
||||
(stream.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/) || stream.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))) { |
||||
// dates (weird ODBC syntax)
|
||||
// ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html
|
||||
return "number"; |
||||
} else { |
||||
stream.eatWhile(/^[_\w\d]/); |
||||
var word = stream.current().toLowerCase(); |
||||
// dates (standard SQL syntax)
|
||||
// ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html
|
||||
if (dateSQL.hasOwnProperty(word) && (stream.match(/^( )+'[^']*'/) || stream.match(/^( )+"[^"]*"/))) {return "number";} |
||||
if (atoms.hasOwnProperty(word)) return "atom"; |
||||
if (builtin.hasOwnProperty(word)) return "builtin"; |
||||
if (functions.hasOwnProperty(word) && stream.peek() === "(") return "function"; |
||||
if (keywords.hasOwnProperty(word)) return "keyword"; |
||||
if (client.hasOwnProperty(word)) return "string-2"; |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
// 'string', with char specified in quote escaped by '\'
|
||||
function tokenLiteral (quote) { |
||||
return function (stream, state) { |
||||
var escaped = false, ch; |
||||
while ((ch = stream.next()) != null) { |
||||
if (ch == quote && !escaped) { |
||||
state.tokenize = tokenBase; |
||||
break; |
||||
} |
||||
escaped = !escaped && ch == "\\"; |
||||
} |
||||
return "string"; |
||||
}; |
||||
} |
||||
function tokenComment (depth) { |
||||
return function (stream, state) { |
||||
var m = stream.match(/^.*?(\/\*|\*\/)/); |
||||
if (!m) stream.skipToEnd(); |
||||
else if (m[1] == "/*") state.tokenize = tokenComment(depth + 1); |
||||
else if (depth > 1) state.tokenize = tokenComment(depth - 1); |
||||
else state.tokenize = tokenBase; |
||||
return "comment"; |
||||
}; |
||||
} |
||||
|
||||
function pushContext (stream, state, type) { |
||||
state.context = { |
||||
prev: state.context, |
||||
indent: stream.indentation(), |
||||
col: stream.column(), |
||||
type: type |
||||
}; |
||||
} |
||||
|
||||
function popContext (state) { |
||||
state.indent = state.context.indent; |
||||
state.context = state.context.prev; |
||||
} |
||||
|
||||
return { |
||||
startState: function () { |
||||
return {tokenize: tokenBase, context: null}; |
||||
}, |
||||
|
||||
token: function (stream, state) { |
||||
if (stream.sol()) { |
||||
if (state.context && state.context.align == null) {state.context.align = false;} |
||||
} |
||||
if (state.tokenize == tokenBase && stream.eatSpace()) return null; |
||||
|
||||
var style = state.tokenize(stream, state); |
||||
if (style == "comment") return style; |
||||
|
||||
if (state.context && state.context.align == null) {state.context.align = true;} |
||||
|
||||
var tok = stream.current(); |
||||
if (tok == "(") {pushContext(stream, state, ")");} else if (tok == "[") {pushContext(stream, state, "]");} else if (state.context && state.context.type == tok) {popContext(state);} |
||||
return style; |
||||
}, |
||||
|
||||
indent: function (state, textAfter) { |
||||
var cx = state.context; |
||||
if (!cx) return CodeMirror.Pass; |
||||
var closing = textAfter.charAt(0) == cx.type; |
||||
if (cx.align) return cx.col + (closing ? 0 : 1); |
||||
return cx.indent + (closing ? 0 : config.indentUnit); |
||||
}, |
||||
|
||||
blockCommentStart: "/*", |
||||
blockCommentEnd: "*/", |
||||
lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : "--" |
||||
}; |
||||
}); |
||||
|
||||
(function () { |
||||
"use strict"; |
||||
|
||||
// `identifier`
|
||||
function hookIdentifier (stream) { |
||||
// MySQL/MariaDB identifiers
|
||||
// ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html
|
||||
var ch; |
||||
while ((ch = stream.next()) != null) { |
||||
if (ch == "`" && !stream.eat("`")) return "variable-2"; |
||||
} |
||||
stream.backUp(stream.current().length - 1); |
||||
return stream.eatWhile(/\w/) ? "variable-2" : null; |
||||
} |
||||
|
||||
// "identifier"
|
||||
function hookIdentifierDoublequote (stream) { |
||||
// Standard SQL /SQLite identifiers
|
||||
// ref: http://web.archive.org/web/20160813185132/http://savage.net.au/SQL/sql-99.bnf.html#delimited%20identifier
|
||||
// ref: http://sqlite.org/lang_keywords.html
|
||||
var ch; |
||||
while ((ch = stream.next()) != null) { |
||||
if (ch == "\"" && !stream.eat("\"")) return "variable-2"; |
||||
} |
||||
stream.backUp(stream.current().length - 1); |
||||
return stream.eatWhile(/\w/) ? "variable-2" : null; |
||||
} |
||||
|
||||
// variable token
|
||||
function hookVar (stream) { |
||||
// variables
|
||||
// @@prefix.varName @varName
|
||||
// varName can be quoted with ` or ' or "
|
||||
// ref: http://dev.mysql.com/doc/refman/5.5/en/user-variables.html
|
||||
if (stream.eat("@")) { |
||||
stream.match(/^session\./); |
||||
stream.match(/^local\./); |
||||
stream.match(/^global\./); |
||||
} |
||||
|
||||
if (stream.eat("'")) { |
||||
stream.match(/^.*'/); |
||||
return "variable-2"; |
||||
} else if (stream.eat("\"")) { |
||||
stream.match(/^.*"/); |
||||
return "variable-2"; |
||||
} else if (stream.eat("`")) { |
||||
stream.match(/^.*`/); |
||||
return "variable-2"; |
||||
} else if (stream.match(/^[0-9a-zA-Z$\.\_]+/)) { |
||||
return "variable-2"; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
// short client keyword token
|
||||
function hookClient (stream) { |
||||
// \N means NULL
|
||||
// ref: http://dev.mysql.com/doc/refman/5.5/en/null-values.html
|
||||
if (stream.eat("N")) { |
||||
return "atom"; |
||||
} |
||||
// \g, etc
|
||||
// ref: http://dev.mysql.com/doc/refman/5.5/en/mysql-commands.html
|
||||
return stream.match(/^[a-zA-Z.#!?]/) ? "variable-2" : null; |
||||
} |
||||
|
||||
// these keywords are used by all SQL dialects (however, a mode can still overwrite it)
|
||||
var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit "; |
||||
|
||||
// turn a space-separated list into an array
|
||||
function set (str) { |
||||
var obj = {}, words = str.split(" "); |
||||
for (var i = 0; i < words.length; ++i) obj[words[i]] = true; |
||||
return obj; |
||||
} |
||||
|
||||
// A generic SQL Mode. It's not a standard, it just try to support what is generally supported
|
||||
CodeMirror.defineMIME("text/x-sql", { |
||||
name: "sql", |
||||
keywords: set(sqlKeywords + "begin"), |
||||
builtin: set("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"), |
||||
atoms: set("false true null unknown"), |
||||
operatorChars: /^[*+\-%<>!=]/, |
||||
dateSQL: set("date time timestamp"), |
||||
support: set("ODBCdotTable doubleQuote binaryNumber hexNumber"), |
||||
functions: BI.makeObject(BI.FormulaCollections, true) |
||||
}); |
||||
}()); |
||||
|
||||
}); |
||||
|
||||
/* |
||||
How Properties of Mime Types are used by SQL Mode |
||||
================================================= |
||||
|
||||
keywords: |
||||
A list of keywords you want to be highlighted. |
||||
builtin: |
||||
A list of builtin types you want to be highlighted (if you want types to be of class "builtin" instead of "keyword"). |
||||
operatorChars: |
||||
All characters that must be handled as operators. |
||||
client: |
||||
Commands parsed and executed by the client (not the server). |
||||
support: |
||||
A list of supported syntaxes which are not common, but are supported by more than 1 DBMS. |
||||
* ODBCdotTable: .tableName |
||||
* zerolessFloat: .1 |
||||
* doubleQuote |
||||
* nCharCast: N'string' |
||||
* charsetCast: _utf8'string' |
||||
* commentHash: use # char for comments |
||||
* commentSlashSlash: use // for comments
|
||||
* commentSpaceRequired: require a space after -- for comments |
||||
atoms: |
||||
Keywords that must be highlighted as atoms,. Some DBMS's support more atoms than others: |
||||
UNKNOWN, INFINITY, UNDERFLOW, NaN... |
||||
dateSQL: |
||||
Used for date/time SQL standard syntax, because not all DBMS's support same temporal types. |
||||
*/ |
@ -1,160 +0,0 @@
|
||||
/** |
||||
* Created by Windy on 2017/12/15. |
||||
*/ |
||||
BI.SQLEditor = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), { |
||||
baseCls: "bi-sql-editor", |
||||
value: "", |
||||
lineHeight: 2, |
||||
showHint: true, |
||||
supportFunction: false, |
||||
supportParam: false |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.CodeEditor.superclass._init.apply(this, arguments); |
||||
var o = this.options, self = this; |
||||
this.editor = CodeMirror(this.element[0], { |
||||
mode: "text/x-sql", |
||||
textWrapping: true, |
||||
lineWrapping: true, |
||||
lineNumbers: false |
||||
}); |
||||
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height"); |
||||
|
||||
this.editor.on("change", function (cm, change) { |
||||
self._checkWaterMark(); |
||||
if (o.showHint) { |
||||
CodeMirror.showHint(cm, CodeMirror.sqlHint, { |
||||
completeSingle: false, |
||||
supportFunction: o.supportFunction |
||||
}); |
||||
} |
||||
BI.nextTick(function () { |
||||
self.fireEvent(BI.FormulaEditor.EVENT_CHANGE); |
||||
}); |
||||
}); |
||||
|
||||
this.editor.on("focus", function () { |
||||
self._checkWaterMark(); |
||||
self.fireEvent(BI.FormulaEditor.EVENT_FOCUS); |
||||
}); |
||||
|
||||
this.editor.on("blur", function () { |
||||
self.fireEvent(BI.FormulaEditor.EVENT_BLUR); |
||||
}); |
||||
|
||||
// 水印
|
||||
this.watermark = BI.createWidget({ |
||||
type: "bi.label", |
||||
text: BI.i18nText("BI-Please_Enter_SQL"), |
||||
cls: "bi-water-mark", |
||||
whiteSpace: "nowrap", |
||||
textAlign: "left" |
||||
}); |
||||
this.watermark.element.bind( |
||||
"mousedown", function (e) { |
||||
self.insertString(""); |
||||
self.editor.focus(); |
||||
e.stopEvent(); |
||||
} |
||||
); |
||||
this.watermark.element.bind("click", function (e) { |
||||
self.editor.focus(); |
||||
e.stopEvent(); |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.absolute", |
||||
element: this, |
||||
items: [{ |
||||
el: this.watermark, |
||||
top: 0, |
||||
left: 5 |
||||
}] |
||||
}); |
||||
if (BI.isKey(o.value)) { |
||||
BI.nextTick(function () { |
||||
self.setValue(o.value); |
||||
}); |
||||
} |
||||
}, |
||||
|
||||
insertString: function (str) { |
||||
this.editor.replaceSelection(str); |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
insertParam: function (param) { |
||||
var value = param; |
||||
var from = this.editor.getCursor(); |
||||
this.editor.replaceSelection(param); |
||||
var to = this.editor.getCursor(); |
||||
var options = {className: "param", atomic: true, replacedWith: $("<span class='param start end' />").text(param)[0]}; |
||||
options.value = value; |
||||
this.editor.markText(from, to, options); |
||||
this.editor.replaceSelection(" "); |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
_checkWaterMark: function () { |
||||
var o = this.options; |
||||
if (!this.disabledWaterMark && BI.isEmptyString(this.editor.getValue()) && BI.isKey(o.watermark)) { |
||||
this.watermark && this.watermark.visible(); |
||||
} else { |
||||
this.watermark && this.watermark.invisible(); |
||||
} |
||||
}, |
||||
|
||||
_analyzeContent: function (v) { |
||||
var regx = /\$[\{][^\}]*[\}]|[^\$\{]*[^\$\{]/g; |
||||
return v.match(regx); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
var v = this.editor.getValue("\n", function (line) { |
||||
var rawText = line.text, value = line.text, num = 0; |
||||
value.text = rawText; |
||||
_.forEach(_.sortBy(line.markedSpans, "from"), function (i, ms) { |
||||
switch (i.marker.className) { |
||||
case "param": |
||||
case "error-param": |
||||
var fieldNameLength = i.to - i.from; |
||||
value = value.substr(0, i.from + num) + "$\{" + i.marker.value + "\}" + value.substr(i.to + num, value.length); |
||||
// 加上${}的偏移
|
||||
num += 3; |
||||
// 加上实际值和显示值的长度差的偏移
|
||||
num += (i.marker.value.length - fieldNameLength); |
||||
break; |
||||
} |
||||
}); |
||||
return value; |
||||
}); |
||||
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1"); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
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) && o.supportParam) { |
||||
self.insertParam(str[0].substring(2, item.length - 1)); |
||||
} else { |
||||
self.insertString(item); |
||||
} |
||||
}); |
||||
this._checkWaterMark(); |
||||
}, |
||||
|
||||
refresh: function () { |
||||
var self = this; |
||||
BI.nextTick(function () { |
||||
self.editor.refresh(); |
||||
}); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.sql_editor", BI.SQLEditor); |
@ -1,107 +0,0 @@
|
||||
/** |
||||
* svg绘图 |
||||
* |
||||
* Created by GUY on 2015/12/3. |
||||
* @class BI.Svg |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.Svg = BI.inherit(BI.Widget, { |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.Svg.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-svg" |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.Svg.superclass._init.apply(this, arguments); |
||||
this.paper = Raphael(this.element[0]); |
||||
|
||||
this.element.css("overflow", "hidden"); |
||||
$(this.paper.canvas).width("100%").height("100%").css({left: "0", top: "0"}).appendTo(this.element); |
||||
|
||||
this.top = this.paper.top; |
||||
this.bottom = this.paper.bottom; |
||||
this.customAttributes = this.paper.customAttributes; |
||||
this.ca = this.paper.ca; |
||||
this.raphael = this.paper.raphael; |
||||
}, |
||||
|
||||
add: function () { |
||||
return this.paper.add.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
path: function () { |
||||
return this.paper.path.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
image: function () { |
||||
return this.paper.image.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
rect: function () { |
||||
return this.paper.rect.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
circle: function () { |
||||
return this.paper.circle.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
ellipse: function () { |
||||
return this.paper.ellipse.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
text: function () { |
||||
return this.paper.text.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
print: function () { |
||||
return this.paper.print.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
|
||||
setStart: function () { |
||||
return this.paper.setStart.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
setFinish: function () { |
||||
return this.paper.setFinish.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
setSize: function () { |
||||
return this.paper.setSize.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
setViewBox: function () { |
||||
return this.paper.setViewBox.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
|
||||
getById: function () { |
||||
return this.paper.getById.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
getElementByPoint: function () { |
||||
return this.paper.getElementByPoint.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
getElementsByPoint: function () { |
||||
return this.paper.getElementsByPoint.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
getFont: function () { |
||||
return this.paper.getFont.apply(this.paper, arguments); |
||||
}, |
||||
|
||||
|
||||
set: function () { |
||||
return this.paper.set.apply(this.paper, arguments); |
||||
}, |
||||
remove: function () { |
||||
return this.paper.remove.apply(this.paper, arguments); |
||||
}, |
||||
clear: function () { |
||||
return this.paper.clear.apply(this.paper, arguments); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.svg", BI.Svg); |
@ -1,92 +0,0 @@
|
||||
/** |
||||
* 绘制一些较复杂的canvas |
||||
* |
||||
* Created by GUY on 2015/11/24. |
||||
* @class BI.ComplexCanvas |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.ComplexCanvas = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.ComplexCanvas.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-complex-canvas" |
||||
}); |
||||
}, |
||||
|
||||
|
||||
_init: function () { |
||||
BI.ComplexCanvas.superclass._init.apply(this, arguments); |
||||
var o = this.options; |
||||
this.canvas = BI.createWidget({ |
||||
type: "bi.canvas", |
||||
element: this, |
||||
width: o.width, |
||||
height: o.height |
||||
}); |
||||
}, |
||||
|
||||
// 绘制树枝节点
|
||||
branch: function (x0, y0, x1, y1, x2, y2) { |
||||
var self = this, args = [].slice.call(arguments); |
||||
if (args.length <= 5) { |
||||
return this.canvas.line.apply(this.canvas, arguments); |
||||
} |
||||
var options; |
||||
if (BI.isOdd(args.length)) { |
||||
options = BI.last(args); |
||||
args = BI.initial(args); |
||||
} |
||||
args = [].slice.call(args, 2); |
||||
var odd = BI.filter(args, function (i) { |
||||
return i % 2 === 0; |
||||
}); |
||||
var even = BI.filter(args, function (i) { |
||||
return i % 2 !== 0; |
||||
}); |
||||
options || (options = {}); |
||||
var offset = options.offset || 20; |
||||
if ((y0 > y1 && y0 > y2) || (y0 < y1 && y0 < y2)) { |
||||
if (y0 > y1 && y0 > y2) { |
||||
var y = Math.max.apply(this, even) + offset; |
||||
} else { |
||||
var y = Math.min.apply(this, even) - offset; |
||||
} |
||||
var minx = Math.min.apply(this, odd); |
||||
var minix = BI.indexOf(odd, minx); |
||||
var maxx = Math.max.apply(this, odd); |
||||
var maxix = BI.indexOf(odd, maxx); |
||||
this.canvas.line(minx, even[minix], minx, y, maxx, y, maxx, even[maxix], options); |
||||
BI.each(odd, function (i, dot) { |
||||
if (i !== maxix && i !== minix) { |
||||
self.canvas.line(dot, even[i], dot, y, options); |
||||
} |
||||
}); |
||||
this.canvas.line(x0, y, x0, y0, options); |
||||
return; |
||||
} |
||||
if ((x0 > x1 && x0 > x2) || (x0 < x1 && x0 < x2)) { |
||||
if (x0 > x1 && x0 > x2) { |
||||
var x = Math.max.apply(this, odd) + offset; |
||||
} else { |
||||
var x = Math.min.apply(this, odd) - offset; |
||||
} |
||||
var miny = Math.min.apply(this, even); |
||||
var miniy = BI.indexOf(even, miny); |
||||
var maxy = Math.max.apply(this, even); |
||||
var maxiy = BI.indexOf(even, maxy); |
||||
this.canvas.line(odd[miniy], miny, x, miny, x, maxy, odd[maxiy], maxy, options); |
||||
BI.each(even, function (i, dot) { |
||||
if (i !== miniy && i !== maxiy) { |
||||
self.canvas.line(odd[i], dot, x, dot, options); |
||||
} |
||||
}); |
||||
this.canvas.line(x, y0, x0, y0, options); |
||||
return; |
||||
} |
||||
}, |
||||
|
||||
stroke: function (callback) { |
||||
this.canvas.stroke(callback); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("bi.complex_canvas", BI.ComplexCanvas); |
@ -1,78 +0,0 @@
|
||||
/** |
||||
* Created by Young's on 2016/4/28. |
||||
*/ |
||||
BI.EditorIconCheckCombo = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.EditorIconCheckCombo.superclass._defaultConfig.apply(this, arguments), { |
||||
baseClass: "bi-check-editor-combo", |
||||
width: 100, |
||||
height: 24, |
||||
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, |
||||
validationChecker: BI.emptyFn, |
||||
quitChecker: BI.emptyFn, |
||||
allowBlank: true, |
||||
watermark: "", |
||||
errorText: "" |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.EditorIconCheckCombo.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.trigger = BI.createWidget({ |
||||
type: "bi.editor_trigger", |
||||
items: o.items, |
||||
height: o.height, |
||||
validationChecker: o.validationChecker, |
||||
quitChecker: o.quitChecker, |
||||
allowBlank: o.allowBlank, |
||||
watermark: o.watermark, |
||||
errorText: o.errorText, |
||||
value: o.value |
||||
}); |
||||
this.trigger.on(BI.EditorTrigger.EVENT_CHANGE, function () { |
||||
self.popup.setValue(this.getValue()); |
||||
self.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE); |
||||
}); |
||||
this.popup = BI.createWidget({ |
||||
type: "bi.text_value_check_combo_popup", |
||||
chooseType: o.chooseType, |
||||
items: o.items, |
||||
value: o.value |
||||
}); |
||||
this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { |
||||
self.setValue(self.popup.getValue()); |
||||
self.editorIconCheckCombo.hideView(); |
||||
self.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE); |
||||
}); |
||||
this.popup.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.editorIconCheckCombo = BI.createWidget({ |
||||
type: "bi.combo", |
||||
container: o.container, |
||||
element: this, |
||||
adjustLength: 2, |
||||
el: this.trigger, |
||||
popup: { |
||||
el: this.popup, |
||||
maxHeight: 300 |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.editorIconCheckCombo.setValue(v); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.trigger.getValue(); |
||||
}, |
||||
|
||||
populate: function (items) { |
||||
this.options.items = items; |
||||
this.editorIconCheckCombo.populate(items); |
||||
} |
||||
}); |
||||
BI.EditorIconCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.editor_icon_check_combo", BI.EditorIconCheckCombo); |
@ -1,73 +0,0 @@
|
||||
/** |
||||
* 单选combo |
||||
* |
||||
* @class BI.StaticCombo |
||||
* @extend BI.Widget |
||||
*/ |
||||
BI.StaticCombo = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.StaticCombo.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-static-combo", |
||||
height: 24, |
||||
text: "", |
||||
el: {}, |
||||
items: [], |
||||
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, |
||||
attributes: { |
||||
tabIndex: 0 |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.StaticCombo.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.trigger = BI.createWidget({ |
||||
type: "bi.text_trigger", |
||||
cls: "bi-border static-text-trigger", |
||||
items: o.items, |
||||
height: o.height, |
||||
text: o.text, |
||||
readonly: true |
||||
}); |
||||
this.popup = BI.createWidget({ |
||||
type: "bi.text_value_combo_popup", |
||||
textAlign: o.textAlign, |
||||
chooseType: o.chooseType, |
||||
items: o.items, |
||||
value: o.value |
||||
}); |
||||
this.popup.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { |
||||
self.combo.hideView(); |
||||
self.fireEvent(BI.StaticCombo.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.combo = BI.createWidget({ |
||||
type: "bi.combo", |
||||
element: this, |
||||
adjustLength: 2, |
||||
container: o.container, |
||||
el: this.trigger, |
||||
popup: { |
||||
el: this.popup |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
populate: function (items) { |
||||
this.combo.populate(items); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.popup.setValue(v); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
var value = this.popup.getValue(); |
||||
return BI.isNull(value) ? [] : (BI.isArray(value) ? value : [value]); |
||||
} |
||||
}); |
||||
BI.StaticCombo.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.static_combo", BI.StaticCombo); |
@ -1,267 +0,0 @@
|
||||
/** |
||||
* Created by User on 2017/7/28. |
||||
*/ |
||||
BI.SignInitialEditor = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
var conf = BI.SignInitialEditor.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
baseCls: (conf.baseCls || "") + " bi-sign-initial-editor", |
||||
hgap: 4, |
||||
vgap: 2, |
||||
lgap: 0, |
||||
rgap: 0, |
||||
tgap: 0, |
||||
bgap: 0, |
||||
validationChecker: BI.emptyFn, |
||||
quitChecker: BI.emptyFn, |
||||
allowBlank: true, |
||||
watermark: "", |
||||
errorText: "", |
||||
value: "", |
||||
text: "", |
||||
height: 24 |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.SignInitialEditor.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.editor = BI.createWidget({ |
||||
type: "bi.editor", |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
vgap: o.vgap, |
||||
lgap: o.lgap, |
||||
rgap: o.rgap, |
||||
tgap: o.tgap, |
||||
bgap: o.bgap, |
||||
value: o.value, |
||||
validationChecker: o.validationChecker, |
||||
quitChecker: o.quitChecker, |
||||
allowBlank: o.allowBlank, |
||||
watermark: o.watermark, |
||||
errorText: o.errorText |
||||
}); |
||||
this.text = BI.createWidget({ |
||||
type: "bi.text_button", |
||||
cls: "sign-editor-text", |
||||
title: o.title, |
||||
warningTitle: o.warningTitle, |
||||
tipType: o.tipType, |
||||
textAlign: "left", |
||||
height: o.height, |
||||
hgap: 4, |
||||
handler: function () { |
||||
self._showInput(); |
||||
self.editor.focus(); |
||||
self.editor.selectAll(); |
||||
} |
||||
}); |
||||
this.text.on(BI.TextButton.EVENT_CHANGE, function () { |
||||
BI.nextTick(function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_CLICK_LABEL); |
||||
}); |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.absolute", |
||||
element: this, |
||||
items: [{ |
||||
el: this.text, |
||||
left: 0, |
||||
right: 0, |
||||
top: 0, |
||||
bottom: 0 |
||||
}] |
||||
}); |
||||
this.editor.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_FOCUS, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_FOCUS, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_BLUR, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_BLUR, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_CLICK, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_CLICK, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_KEY_DOWN, arguments); |
||||
}); |
||||
|
||||
this.editor.on(BI.Editor.EVENT_VALID, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_VALID, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_CONFIRM, function () { |
||||
self._showHint(); |
||||
self._checkText(); |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_CONFIRM, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_START, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_START, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_PAUSE, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_PAUSE, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_STOP, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_STOP, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_SPACE, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_SPACE, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_ERROR, function () { |
||||
self._checkText(); |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_ERROR, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_ENTER, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_ENTER, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_RESTRICT, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_RESTRICT, arguments); |
||||
}); |
||||
this.editor.on(BI.Editor.EVENT_EMPTY, function () { |
||||
self.fireEvent(BI.SignInitialEditor.EVENT_EMPTY, arguments); |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.vertical", |
||||
scrolly: false, |
||||
element: this, |
||||
items: [this.editor] |
||||
}); |
||||
this._showHint(); |
||||
self._checkText(); |
||||
}, |
||||
|
||||
_checkText: function () { |
||||
var o = this.options; |
||||
BI.nextTick(BI.bind(function () { |
||||
if (this.editor.getValue() === "") { |
||||
this.text.setValue(o.watermark || ""); |
||||
this.text.element.addClass("bi-water-mark"); |
||||
} else { |
||||
var v = this.editor.getValue(); |
||||
v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; |
||||
this.text.setValue(v); |
||||
this.text.element.removeClass("bi-water-mark"); |
||||
} |
||||
}, this)); |
||||
}, |
||||
|
||||
_showInput: function () { |
||||
this.editor.visible(); |
||||
this.text.invisible(); |
||||
}, |
||||
|
||||
_showHint: function () { |
||||
this.editor.invisible(); |
||||
this.text.visible(); |
||||
}, |
||||
|
||||
setTitle: function (title) { |
||||
this.text.setTitle(title); |
||||
}, |
||||
|
||||
setWarningTitle: function (title) { |
||||
this.text.setWarningTitle(title); |
||||
}, |
||||
|
||||
focus: function () { |
||||
this._showInput(); |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
blur: function () { |
||||
this.editor.blur(); |
||||
this._showHint(); |
||||
this._checkText(); |
||||
}, |
||||
|
||||
doRedMark: function () { |
||||
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { |
||||
return; |
||||
} |
||||
this.text.doRedMark.apply(this.text, arguments); |
||||
}, |
||||
|
||||
unRedMark: function () { |
||||
this.text.unRedMark.apply(this.text, arguments); |
||||
}, |
||||
|
||||
doHighLight: function () { |
||||
if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { |
||||
return; |
||||
} |
||||
this.text.doHighLight.apply(this.text, arguments); |
||||
}, |
||||
|
||||
unHighLight: function () { |
||||
this.text.unHighLight.apply(this.text, arguments); |
||||
}, |
||||
|
||||
isValid: function () { |
||||
return this.editor.isValid(); |
||||
}, |
||||
|
||||
setErrorText: function (text) { |
||||
this.editor.setErrorText(text); |
||||
}, |
||||
|
||||
getErrorText: function () { |
||||
return this.editor.getErrorText(); |
||||
}, |
||||
|
||||
isEditing: function () { |
||||
return this.editor.isEditing(); |
||||
}, |
||||
|
||||
getLastValidValue: function () { |
||||
return this.editor.getLastValidValue(); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
var o = this.options; |
||||
this.editor.setValue(v.value); |
||||
o.text = v.text || o.text; |
||||
this._checkText(); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return { |
||||
value: this.editor.getValue(), |
||||
text: this.options.text |
||||
}; |
||||
}, |
||||
|
||||
getState: function () { |
||||
return this.text.getValue(); |
||||
}, |
||||
|
||||
setState: function (v) { |
||||
var o = this.options; |
||||
this._showHint(); |
||||
v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; |
||||
this.text.setValue(v); |
||||
} |
||||
}); |
||||
BI.SignInitialEditor.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.SignInitialEditor.EVENT_FOCUS = "EVENT_FOCUS"; |
||||
BI.SignInitialEditor.EVENT_BLUR = "EVENT_BLUR"; |
||||
BI.SignInitialEditor.EVENT_CLICK = "EVENT_CLICK"; |
||||
BI.SignInitialEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; |
||||
BI.SignInitialEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; |
||||
|
||||
BI.SignInitialEditor.EVENT_START = "EVENT_START"; |
||||
BI.SignInitialEditor.EVENT_PAUSE = "EVENT_PAUSE"; |
||||
BI.SignInitialEditor.EVENT_STOP = "EVENT_STOP"; |
||||
BI.SignInitialEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
BI.SignInitialEditor.EVENT_VALID = "EVENT_VALID"; |
||||
BI.SignInitialEditor.EVENT_ERROR = "EVENT_ERROR"; |
||||
BI.SignInitialEditor.EVENT_ENTER = "EVENT_ENTER"; |
||||
BI.SignInitialEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; |
||||
BI.SignInitialEditor.EVENT_SPACE = "EVENT_SPACE"; |
||||
BI.SignInitialEditor.EVENT_EMPTY = "EVENT_EMPTY"; |
||||
|
||||
BI.shortcut("bi.sign_initial_editor", BI.SignInitialEditor); |
@ -1,54 +0,0 @@
|
||||
BI.LinearSegmentButton = BI.inherit(BI.BasicButton, { |
||||
|
||||
props: { |
||||
extraCls: "bi-line-segment-button bi-list-item-effect", |
||||
once: true, |
||||
readonly: true, |
||||
hgap: 10, |
||||
height: 25 |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
|
||||
return [{ |
||||
type: "bi.label", |
||||
text: o.text, |
||||
height: o.height, |
||||
value: o.value, |
||||
hgap: o.hgap, |
||||
ref: function () { |
||||
self.text = this; |
||||
} |
||||
}, { |
||||
type: "bi.absolute", |
||||
items: [{ |
||||
el: { |
||||
type: "bi.layout", |
||||
cls: "line-segment-button-line", |
||||
height: 2, |
||||
ref: function () { |
||||
self.line = this; |
||||
} |
||||
}, |
||||
left: 0, |
||||
right: 0, |
||||
bottom: 0 |
||||
}] |
||||
}]; |
||||
}, |
||||
|
||||
setSelected: function (v) { |
||||
BI.LinearSegmentButton.superclass.setSelected.apply(this, arguments); |
||||
if (v) { |
||||
this.line.element.addClass("bi-high-light-background"); |
||||
} else { |
||||
this.line.element.removeClass("bi-high-light-background"); |
||||
} |
||||
}, |
||||
|
||||
setText: function (text) { |
||||
this.text.setText(text); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.linear_segment_button", BI.LinearSegmentButton); |
@ -1,50 +0,0 @@
|
||||
BI.LinearSegment = BI.inherit(BI.Widget, { |
||||
|
||||
props: { |
||||
baseCls: "bi-linear-segment bi-border-bottom", |
||||
items: [], |
||||
height: 29 |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
return { |
||||
type: "bi.button_group", |
||||
items: BI.createItems(o.items, { |
||||
type: "bi.linear_segment_button", |
||||
height: o.height - 1 |
||||
}), |
||||
layout: [{ |
||||
type: "bi.center" |
||||
}], |
||||
listeners: [{ |
||||
eventName: "__EVENT_CHANGE__", |
||||
action: function () { |
||||
self.fireEvent("__EVENT_CHANGE__", arguments); |
||||
} |
||||
}, { |
||||
eventName: "EVENT_CHANGE", |
||||
action: function () { |
||||
self.fireEvent("EVENT_CHANGE"); |
||||
} |
||||
}], |
||||
ref: function () { |
||||
self.buttonGroup = this; |
||||
} |
||||
}; |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.buttonGroup.setValue(v); |
||||
}, |
||||
|
||||
setEnabledValue: function (v) { |
||||
this.buttonGroup.setEnabledValue(v); |
||||
}, |
||||
|
||||
|
||||
getValue: function () { |
||||
return this.buttonGroup.getValue(); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.linear_segment", BI.LinearSegment); |
@ -1,96 +0,0 @@
|
||||
/** |
||||
* |
||||
* Created by GUY on 2017/09/18. |
||||
* @class BI.TextToolbar |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.RichEditorAction = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorAction.superclass._defaultConfig.apply(this, arguments), { |
||||
width: 20, |
||||
height: 20, |
||||
command: "", |
||||
used: true |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorAction.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
o.editor.on(BI.NicEditor.EVENT_SELECTED, function (e) { |
||||
if (o.used === true) { |
||||
self.setEnable(true); |
||||
self.checkNodes(e.target); |
||||
self.key(e); |
||||
} |
||||
}); |
||||
// o.editor.on(BI.NicEditor.EVENT_BLUR, function () {
|
||||
// self.setEnable(false);
|
||||
// });
|
||||
// o.editor.on(BI.NicEditor.EVENT_KEYDOWN, BI.bind(this.keydown, this));
|
||||
// if (o.used === false) {
|
||||
// this.setEnable(false);
|
||||
// }
|
||||
}, |
||||
|
||||
checkNodes: function (e) { |
||||
if (!e) { |
||||
return false; |
||||
} |
||||
var elm = e; |
||||
do { |
||||
if (this.options.tags && this.options.tags.contains(elm.nodeName)) { |
||||
this.activate(); |
||||
return true; |
||||
} |
||||
} while (elm = elm.parentNode && elm.className && elm.className.indexOf("bi-nic-editor") >= -1); |
||||
elm = e; |
||||
while (elm.nodeType == 3) { |
||||
elm = elm.parentNode; |
||||
} |
||||
if (this.options.css) { |
||||
for (var itm in this.options.css) { |
||||
if (this.options.css[itm] == null) { |
||||
this.activate($(elm).css(itm)); |
||||
return true; |
||||
} |
||||
if ($(elm).css(itm) == this.options.css[itm]) { |
||||
this.activate(); |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
this.deactivate(); |
||||
return false; |
||||
}, |
||||
|
||||
start: function () { |
||||
|
||||
}, |
||||
|
||||
key: function () { |
||||
|
||||
}, |
||||
|
||||
keydown: function () { |
||||
}, |
||||
|
||||
hideIf: function (e) { |
||||
|
||||
}, |
||||
|
||||
activate: function () { |
||||
}, |
||||
|
||||
deactivate: function () { |
||||
}, |
||||
|
||||
doCommand: function (args) { |
||||
// 执行命令前先恢复选区
|
||||
this.options.editor.instance.restoreRng(); |
||||
|
||||
if (this.options.command) { |
||||
this.options.editor.nicCommand(this.options.command, args); |
||||
} |
||||
} |
||||
}); |
@ -1,169 +0,0 @@
|
||||
/** |
||||
* |
||||
* Created by GUY on 2017/09/18. |
||||
* @class BI.RichEditorParamAction |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorParamAction.superclass._defaultConfig.apply(this, arguments), { |
||||
paramFormatter: function (v) { |
||||
return v; |
||||
} |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorParamAction.superclass._init.apply(this, arguments); |
||||
}, |
||||
|
||||
// _createBlankNode: function () {
|
||||
// return $("<span>").html(" ");
|
||||
// },
|
||||
|
||||
// _addBlank: function ($param) {
|
||||
// var o = this.options;
|
||||
// var instance = o.editor.selectedInstance;
|
||||
// var next = $param.next();
|
||||
// if (next.length === 0) {
|
||||
// var nextNode = this._createBlankNode();
|
||||
// $param.after(nextNode);
|
||||
// instance.setFocus(nextNode[0]);
|
||||
// } else {
|
||||
// instance.setFocus(next[0]);
|
||||
// }
|
||||
// },
|
||||
//
|
||||
// _get$Sel: function () {
|
||||
// var o = this.options;
|
||||
// var instance = o.editor.selectedInstance;
|
||||
// var sel = $(instance.selElm());
|
||||
// return sel;
|
||||
// },
|
||||
|
||||
addParam: function (param) { |
||||
var o = this.options; |
||||
var instance = o.editor.instance; |
||||
var image = new Image(); |
||||
var name = o.paramFormatter(param); |
||||
var attrs = BI.DOM.getImage(name); |
||||
image.src = attrs.src; |
||||
image.alt = param; |
||||
$(image).addClass("rich-editor-param"); |
||||
$(image).attr("style", attrs.style); |
||||
$(image).attr("name", name); |
||||
instance.insertHTML($("<div>").append(image).html()); |
||||
// var sel = this._get$Sel();
|
||||
// var wrapper = o.editor.instance.getElm().element;
|
||||
// if (wrapper.find(sel).length <= 0) {
|
||||
// wrapper.append(image);
|
||||
// } else {
|
||||
// sel.after(image);
|
||||
// }
|
||||
// this._addBlank($(image));
|
||||
} |
||||
}); |
||||
|
||||
// /**
|
||||
// *
|
||||
// * Created by GUY on 2017/09/18.
|
||||
// * @class BI.RichEditorParamAction
|
||||
// * @extends BI.Widget
|
||||
// */
|
||||
// BI.RichEditorParamAction = BI.inherit(BI.RichEditorAction, {
|
||||
// _defaultConfig: function () {
|
||||
// return BI.extend(BI.RichEditorParamAction.superclass._defaultConfig.apply(this, arguments), {});
|
||||
// },
|
||||
//
|
||||
// _init: function () {
|
||||
// BI.RichEditorParamAction.superclass._init.apply(this, arguments);
|
||||
// },
|
||||
//
|
||||
// _isParam: function (sel) {
|
||||
// return sel.attr("data-type") === "param";
|
||||
// },
|
||||
//
|
||||
// _createBlankNode: function () {
|
||||
// return $("<span>").html(" ");
|
||||
// },
|
||||
//
|
||||
// _addBlank: function ($param) {
|
||||
// var o = this.options;
|
||||
// var instance = o.editor.selectedInstance;
|
||||
// var next = $param.next();
|
||||
// if (next.length === 0 || this._isParam(next)) {
|
||||
// var preNode = this._createBlankNode();
|
||||
// var nextNode = this._createBlankNode();
|
||||
// $param.before(preNode);
|
||||
// $param.after(nextNode);
|
||||
// instance.setFocus(nextNode[0]);
|
||||
// } else {
|
||||
// instance.setFocus(next[0]);
|
||||
// }
|
||||
// },
|
||||
//
|
||||
// _get$Sel: function () {
|
||||
// var o = this.options;
|
||||
// var instance = o.editor.selectedInstance;
|
||||
// var sel = $(instance.selElm());
|
||||
// if (sel[0].nodeType === 3 && this._isParam(sel.parent())) {
|
||||
// sel = sel.parent();
|
||||
// }
|
||||
// return sel;
|
||||
// },
|
||||
//
|
||||
// addParam: function (param) {
|
||||
// var o = this.options;
|
||||
// var sel = this._get$Sel();
|
||||
// var $param = $("<span>").attr({
|
||||
// "data-type": "param",
|
||||
// "data-value": param
|
||||
// }).css({
|
||||
// color: "white",
|
||||
// backgroundColor: "#009de3",
|
||||
// padding: "0 5px"
|
||||
// }).text(param).keydown(function (e) {
|
||||
// if (e.keyCode === BI.KeyCode.BACKSPACE || e.keyCode === BI.KeyCode.DELETE) {
|
||||
// $param.destroy();
|
||||
// }
|
||||
// e.stopEvent();
|
||||
// return false;
|
||||
// });
|
||||
// var wrapper = o.editor.instance.getElm().element;
|
||||
// if (wrapper.find(sel).length <= 0) {
|
||||
// wrapper.append($param);
|
||||
// } else {
|
||||
// sel.after($param);
|
||||
// }
|
||||
// this._addBlank($param);
|
||||
// },
|
||||
//
|
||||
// keydown: function (e) {
|
||||
// var o = this.options;
|
||||
// var sel = this._get$Sel();
|
||||
// if (e.keyCode === 229) {// 中文输入法
|
||||
// if (this._isParam(sel)) {
|
||||
// this._addBlank(sel);
|
||||
// e.stopEvent();
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// if (BI.Key[e.keyCode] || e.keyCode === BI.KeyCode.TAB || e.keyCode === BI.KeyCode.ENTER || e.keyCode === BI.KeyCode.SPACE) {
|
||||
// if (this._isParam(sel)) {
|
||||
// e.stopEvent();
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// if (e.keyCode === BI.KeyCode.BACKSPACE || e.keyCode === BI.KeyCode.DELETE) {
|
||||
// if (this._isParam(sel)) {
|
||||
// sel.destroy();
|
||||
// e.preventDefault();
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
//
|
||||
// key: function (e) {
|
||||
// }
|
||||
// });
|
||||
|
@ -1,65 +0,0 @@
|
||||
/** |
||||
* 颜色选择 |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorTextToolbar |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorTextToolbar.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-rich-editor-text-toolbar", |
||||
buttons: [ |
||||
{type: "bi.rich_editor_font_chooser"}, |
||||
{type: "bi.rich_editor_size_chooser"}, |
||||
{type: "bi.rich_editor_bold_button"}, |
||||
{type: "bi.rich_editor_italic_button"}, |
||||
{type: "bi.rich_editor_underline_button"}, |
||||
{type: "bi.rich_editor_color_chooser"}, |
||||
{type: "bi.rich_editor_background_color_chooser"}, |
||||
{type: "bi.rich_editor_align_left_button"}, |
||||
{type: "bi.rich_editor_align_center_button"}, |
||||
{type: "bi.rich_editor_align_right_button"}, |
||||
{type: "bi.rich_editor_param_button"} |
||||
], |
||||
height: 34 |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorTextToolbar.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
var buttons = BI.createWidgets(BI.map(o.buttons, function (i, btn) { |
||||
return BI.extend(btn, { |
||||
editor: o.editor |
||||
}); |
||||
})); |
||||
BI.createWidget({ |
||||
type: "bi.left", |
||||
element: this, |
||||
items: buttons, |
||||
hgap: 3, |
||||
vgap: 6 |
||||
}); |
||||
}, |
||||
|
||||
mounted: function () { |
||||
var self = this; |
||||
if (BI.isIE9Below()) {// IE8下必须要设置unselectable才能不blur输入框
|
||||
this.element.mousedown(function () { |
||||
self._noSelect(self.element[0]); |
||||
}); |
||||
this._noSelect(this.element[0]); |
||||
} |
||||
}, |
||||
|
||||
_noSelect: function (element) { |
||||
if (element.setAttribute && element.nodeName.toLowerCase() != "input" && element.nodeName.toLowerCase() != "textarea") { |
||||
element.setAttribute("unselectable", "on"); |
||||
} |
||||
for (var i = 0; i < element.childNodes.length; i++) { |
||||
this._noSelect(element.childNodes[i]); |
||||
} |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar); |
@ -1,461 +0,0 @@
|
||||
/** |
||||
* 富文本编辑器 |
||||
* |
||||
* Created by GUY on 2017/9/15. |
||||
* @class BI.NicEditor |
||||
* @extends BI.Widget |
||||
*/ |
||||
!(function () { |
||||
function isIE11Below () { |
||||
if (!BI.isIE()) { |
||||
return false; |
||||
} |
||||
return BI.getIEVersion() < 11; |
||||
} |
||||
BI.NicEditor = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.NicEditor.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-nic-editor" |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.NicEditor.superclass._init.apply(this, arguments); |
||||
var o = this.options; |
||||
$(document).bind("mousedown." + this.getName(), BI.bind(this.selectCheck, this)); |
||||
BI.createWidget({ |
||||
type: "bi.vertical", |
||||
element: this, |
||||
items: [this.instance = this.addInstance()] |
||||
}); |
||||
}, |
||||
|
||||
addInstance: function () { |
||||
var o = this.options; |
||||
var conf = { |
||||
ne: this, |
||||
height: o.height, |
||||
maxHeight: o.maxHeight ? o.maxHeight : null, |
||||
readOnly: o.readOnly |
||||
}; |
||||
if (this.element[0].contentEditable || !!window.opera) { |
||||
var newInstance = new nicEditorInstance(conf); |
||||
} else { |
||||
console.error("不支持此浏览器"); |
||||
} |
||||
return newInstance; |
||||
}, |
||||
|
||||
insertElem: function ($elem) { |
||||
if (this.selectedInstance) { |
||||
this.selectedInstance.insertElem($elem); |
||||
} |
||||
}, |
||||
|
||||
insertHTML: function (html) { |
||||
if (this.selectedInstance) { |
||||
this.selectedInstance.insertHTML(html); |
||||
} |
||||
}, |
||||
|
||||
nicCommand: function (cmd, args) { |
||||
if (this.selectedInstance) { |
||||
this.selectedInstance.nicCommand(cmd, args); |
||||
} |
||||
}, |
||||
|
||||
selectCheck: function (e) { |
||||
var t = e.target; |
||||
var self = this; |
||||
var found = false; |
||||
do { |
||||
if (t.nodeName !== "svg" && t.className && t.className.indexOf && t.className.indexOf(prefix) != -1) { |
||||
return; |
||||
// return false;
|
||||
} |
||||
if (this.instance.checkToolbar(t)) { |
||||
this.instance.saveRng(); |
||||
// 如果是点击在toolbar内恢复选取(IE中出现的问题)
|
||||
BI.defer(function () { |
||||
self.instance.restoreRng(); |
||||
}); |
||||
return; |
||||
} |
||||
} while (t = t.parentNode); |
||||
this.fireEvent("blur", t); |
||||
this.lastSelectedInstance = this.selectedInstance || this.lastSelectedInstance; |
||||
this.selectedInstance = null; |
||||
// return false;
|
||||
}, |
||||
|
||||
focus: function () { |
||||
this.instance.focus(); |
||||
}, |
||||
|
||||
bindToolbar: function (toolbar) { |
||||
this.instance.bindToolbar(toolbar); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
v = v || ( isIE11Below() ? "" : "<br>"); |
||||
v = v.startWith("<p") ? v : "<p>" + v + "</p>"; |
||||
this.instance.setContent(v); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.instance.getContent(); |
||||
}, |
||||
|
||||
getContentHeight: function () { |
||||
return this.instance.getContentHeight(); |
||||
}, |
||||
|
||||
getInstance: function () { |
||||
return this.instance; |
||||
}, |
||||
|
||||
destroyed: function () { |
||||
$(document).unbind("mousedown." + this.getName()); |
||||
} |
||||
}); |
||||
BI.NicEditor.EVENT_SELECTED = "selected"; |
||||
BI.NicEditor.EVENT_BLUR = "blur"; |
||||
BI.NicEditor.EVENT_FOCUS = "focus"; |
||||
BI.NicEditor.EVENT_KEYDOWN = "keydown"; |
||||
BI.NicEditor.EVENT_KEYUP = "keyup"; |
||||
BI.shortcut("bi.nic_editor", BI.NicEditor); |
||||
|
||||
var prefix = "niceditor-"; |
||||
|
||||
var nicEditorInstance = BI.inherit(BI.Layout, { |
||||
isSelected: false, |
||||
_init: function () { |
||||
nicEditorInstance.superclass._init.apply(this, arguments); |
||||
var o = this.options; |
||||
var initValue = o.value || "<br>"; |
||||
initValue = initValue.startWith("<p>") ? initValue : "<p>" + initValue + "</p>"; |
||||
this.ne = this.options.ne; |
||||
this.elm = BI.createWidget({ |
||||
type: "bi.layout", |
||||
width: o.width - 8, |
||||
scrollable: false |
||||
}); |
||||
this.elm.element.css({ |
||||
minHeight: BI.isNumber(o.height) ? (o.height - 8) + "px" : o.height, |
||||
outline: "none", |
||||
padding: "0 10px", |
||||
wordWrap: "break-word" |
||||
}).html(initValue); |
||||
|
||||
if(o.readOnly) { |
||||
this.elm.element.attr("contentEditable", false); |
||||
this.elm.element.css("word-break", "break-all"); |
||||
} |
||||
|
||||
this.element.css("maxHeight", (o.maxHeight) ? o.maxHeight + "px" : null); |
||||
|
||||
this.e = BI.createWidget({ |
||||
type: "bi.layout", |
||||
invisible: true, |
||||
tagName: "textarea" |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.default", |
||||
element: this, |
||||
scrolly: true, |
||||
items: [this.elm, this.e] |
||||
}); |
||||
|
||||
this.ne.on("blur", BI.bind(this.blur, this)); |
||||
|
||||
this.start(); |
||||
this.blur(); |
||||
}, |
||||
|
||||
start: function () { |
||||
this.elm.element.attr("contentEditable", this.options.readOnly !== true); |
||||
if (this.getContent() == "") { |
||||
// this.setContent("<br />");
|
||||
} |
||||
this.instanceDoc = document.defaultView; |
||||
this.elm.element.on("mousedown", BI.bind(this.selected, this)); |
||||
this.elm.element.on("keydown", BI.bind(this.keyDown, this)); |
||||
this.elm.element.on("focus", BI.bind(this.selected, this)); |
||||
this.elm.element.on("blur", BI.bind(this.blur, this)); |
||||
this.elm.element.on("keyup", BI.bind(this.selected, this)); |
||||
this.ne.fireEvent("add"); |
||||
}, |
||||
|
||||
getSel: function () { |
||||
return (window.getSelection) ? window.getSelection() : document.selection; |
||||
}, |
||||
|
||||
getRng: function () { |
||||
var s = this.getSel(); |
||||
if (!s || s.rangeCount === 0) { |
||||
return; |
||||
} |
||||
return (s.rangeCount > 0) ? s.getRangeAt(0) : s.createRange(); |
||||
}, |
||||
|
||||
selRng: function (rng, s) { |
||||
if (window.getSelection) { |
||||
s.removeAllRanges(); |
||||
s.addRange(rng); |
||||
} else { |
||||
rng.select(); |
||||
} |
||||
}, |
||||
|
||||
selElm: function () { |
||||
var r = this.getRng(); |
||||
if (!r) { |
||||
return; |
||||
} |
||||
if (r.startContainer) { |
||||
var contain = r.startContainer; |
||||
if (r.cloneContents().childNodes.length == 1) { |
||||
for (var i = 0; i < contain.childNodes.length; i++) { |
||||
var rng = contain.childNodes[i].ownerDocument.createRange(); |
||||
rng.selectNode(contain.childNodes[i]); |
||||
if (r.compareBoundaryPoints(Range.START_TO_START, rng) != 1 && |
||||
r.compareBoundaryPoints(Range.END_TO_END, rng) != -1) { |
||||
return contain.childNodes[i]; |
||||
} |
||||
} |
||||
} |
||||
return contain; |
||||
} |
||||
return (this.getSel().type == "Control") ? r.item(0) : r.parentElement(); |
||||
|
||||
}, |
||||
|
||||
saveRng: function () { |
||||
var range = this.getRng(); |
||||
if (!this._isChildOf(this.getSelectionContainerElem(range), this.element[0])) { |
||||
return; |
||||
} |
||||
this.savedRange = range; |
||||
this.savedSel = this.getSel(); |
||||
}, |
||||
|
||||
getSelectionContainerElem: function (range) { |
||||
if (range) { |
||||
var elem = range.commonAncestorContainer; |
||||
return elem.nodeType === 1 ? elem : elem.parentNode; |
||||
} |
||||
}, |
||||
|
||||
setFocus: function (el) { |
||||
try { |
||||
el.focus(); |
||||
} catch (e) { |
||||
|
||||
} |
||||
if (!window.getSelection) { |
||||
var rng; |
||||
try { |
||||
el.focus(); |
||||
} catch (e) { |
||||
|
||||
} |
||||
rng = document.selection.createRange(); |
||||
rng.moveStart("character", -el.innerText.length); |
||||
var text = rng.text; |
||||
for (var i = 0; i < el.innerText.length; i++) { |
||||
if (el.innerText.substring(0, i + 1) == text.substring(text.length - i - 1, text.length)) { |
||||
result = i + 1; |
||||
} |
||||
} |
||||
} else { |
||||
var range = document.createRange(); |
||||
range.selectNodeContents(el); |
||||
range.collapse(false); |
||||
var sel = window.getSelection(); |
||||
sel.removeAllRanges(); |
||||
sel.addRange(range); |
||||
} |
||||
}, |
||||
|
||||
restoreRng: function () { |
||||
if (this.savedRange) { |
||||
this.selRng(this.savedRange, this.savedSel); |
||||
} |
||||
}, |
||||
|
||||
restoreRngAndClearRange: function () { |
||||
if (this.savedRange) { |
||||
this.savedRange.setStart(this.savedRange.endContainer, this.savedRange.endOffset); |
||||
this.selRng(this.savedRange, this.savedSel); |
||||
} |
||||
}, |
||||
|
||||
keyDown: function (e, t) { |
||||
if (e.keyCode === 8) { |
||||
var html = this.elm.element.html().toLowerCase().trim(); |
||||
if (html === "<p><br></p>" || html === "<p></p>") { |
||||
e.preventDefault() |
||||
return; |
||||
} |
||||
} |
||||
this.ne.fireEvent("keydown", e); |
||||
}, |
||||
|
||||
selected: function (e) { |
||||
var t = e.target; |
||||
if (!t && !(t = this.selElm())) { |
||||
t = this.selElm(); |
||||
} |
||||
if (!e.ctrlKey) { |
||||
var selInstance = this.ne.selectedInstance; |
||||
if (selInstance != this) { |
||||
if (selInstance) { |
||||
this.ne.fireEvent("blur", e); |
||||
} |
||||
this.ne.selectedInstance = this; |
||||
this.ne.fireEvent("focus", e); |
||||
} |
||||
this.ne.fireEvent("selected", e); |
||||
this.isFocused = true; |
||||
this.elm.element.addClass(prefix + "selected"); |
||||
} |
||||
this.ne.fireEvent("keyup", e); |
||||
|
||||
if (e.keyCode !== 8) { |
||||
return; |
||||
} |
||||
var newLine; |
||||
var html = this.elm.element.html().toLowerCase().trim(); |
||||
if (!html || html === '<br>') { |
||||
newLine = $(this._getNewLine()); |
||||
this.elm.element.html(''); |
||||
this.elm.element.append(newLine); |
||||
this.setFocus(newLine[0]); |
||||
} |
||||
// return false;
|
||||
}, |
||||
|
||||
focus: function () { |
||||
this.setFocus(this.elm.element[0]); |
||||
this.nicCommand("selectAll"); |
||||
}, |
||||
|
||||
blur: function () { |
||||
this.isFocused = false; |
||||
this.elm.element.removeClass(prefix + "selected"); |
||||
}, |
||||
|
||||
saveContent: function () { |
||||
this.ne.fireEvent("save"); |
||||
this.e.element.value(this.getContent()); |
||||
}, |
||||
|
||||
getElm: function () { |
||||
return this.elm; |
||||
}, |
||||
|
||||
getContent: function () { |
||||
this.content = this.getElm().element.html(); |
||||
this.ne.fireEvent("get"); |
||||
return this.content; |
||||
}, |
||||
|
||||
getContentHeight: function () { |
||||
return this.elm.element.height(); |
||||
}, |
||||
|
||||
setContent: function (e) { |
||||
this.content = e; |
||||
this.ne.fireEvent("set"); |
||||
this.elm.element.html(this.content); |
||||
}, |
||||
|
||||
insertElem: function ($elem) { |
||||
var range = this.getRng(); |
||||
|
||||
if (range.insertNode) { |
||||
range.deleteContents(); |
||||
range.insertNode($elem); |
||||
} |
||||
}, |
||||
|
||||
insertHTML: function (html) { |
||||
var range = this.savedRange || this.getRng(); |
||||
|
||||
try { |
||||
// w3c
|
||||
if (document.queryCommandState("insertHTML")) { |
||||
this.nicCommand("insertHTML", html); |
||||
} else { |
||||
throw new Error("Does not support this command"); |
||||
} |
||||
} catch(e) { |
||||
if (range.insertNode) { |
||||
// IE
|
||||
range.deleteContents(); |
||||
range.insertNode($(html)[0]); |
||||
} else if (range.pasteHTML) { |
||||
// IE <= 10
|
||||
range.pasteHTML(html); |
||||
} |
||||
} |
||||
}, |
||||
|
||||
bindToolbar: function (toolbar) { |
||||
this.toolbar = toolbar; |
||||
}, |
||||
|
||||
checkToolbar: function (element) { |
||||
return this.toolbar && this.toolbar.element[0] === element; |
||||
}, |
||||
|
||||
nicCommand: function (cmd, args) { |
||||
document.execCommand(cmd, false, args); |
||||
}, |
||||
|
||||
initSelection: function (newLine) { |
||||
var newLineHtml = this._getNewLine(); |
||||
var el = this.elm.element; |
||||
var children = el.children(); |
||||
if (!children.length) { |
||||
// 如果编辑器区域无内容,添加一个空行,重新设置选区
|
||||
el.append(newLineHtml); |
||||
this.initSelection(); |
||||
return; |
||||
} |
||||
|
||||
var last = children.last(); |
||||
|
||||
if (newLine) { |
||||
// 新增一个空行
|
||||
var html = last.html().toLowerCase(); |
||||
var nodeName = last.nodeName; |
||||
if ((html !== "<br>" && html !== "<br\/>") || nodeName !== "P") { |
||||
// 最后一个元素不是空行,添加一个空行,重新设置选区
|
||||
el.append(newLineHtml); |
||||
this.initSelection(); |
||||
return; |
||||
} |
||||
} |
||||
|
||||
this.setFocus(last[0]); |
||||
}, |
||||
|
||||
_getNewLine: function () { |
||||
return isIE11Below() ? "<p></p>" : "<p><br></p>"; |
||||
}, |
||||
|
||||
_isChildOf: function(child, parent) { |
||||
var parentNode; |
||||
if(child && parent) { |
||||
parentNode = child.parentNode; |
||||
while(parentNode) { |
||||
if(parent === parentNode) { |
||||
return true; |
||||
} |
||||
parentNode = parentNode.parentNode; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
}); |
||||
}()); |
@ -1,54 +0,0 @@
|
||||
/** |
||||
* 颜色选择trigger |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorBackgroundChooserTrigger |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.RichEditorBackgroundChooserTrigger = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
var conf = BI.RichEditorBackgroundChooserTrigger.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
width: 20, |
||||
height: 20 |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorBackgroundChooserTrigger.superclass._init.apply(this, arguments); |
||||
this.font = BI.createWidget({ |
||||
type: "bi.icon_button", |
||||
element: this, |
||||
title: BI.i18nText("BI-Basic_Background_Color"), |
||||
cls: "text-background-font" |
||||
}); |
||||
|
||||
// this.underline = BI.createWidget({
|
||||
// type: "bi.icon_button",
|
||||
// cls: "text-color-underline-font"
|
||||
// });
|
||||
|
||||
// BI.createWidget({
|
||||
// type: "bi.absolute",
|
||||
// element: this,
|
||||
// items: [{
|
||||
// el: this.font,
|
||||
// top: 2,
|
||||
// left: 2
|
||||
// }, {
|
||||
// el: this.underline,
|
||||
// top: 7,
|
||||
// left: 2
|
||||
// }]
|
||||
// });
|
||||
}, |
||||
|
||||
setValue: function (color) { |
||||
this.font.element.css("color", color); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.font.element.css("color"); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_background_color_chooser_trigger", BI.RichEditorBackgroundChooserTrigger); |
@ -1,38 +0,0 @@
|
||||
/** |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorAlignCenterButton |
||||
* @extends BI.RichEditorAction |
||||
*/ |
||||
BI.RichEditorAlignCenterButton = BI.inherit(BI.RichEditorAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorAlignCenterButton.superclass._defaultConfig.apply(this, arguments), { |
||||
width: 20, |
||||
height: 20, |
||||
command: "justifycenter" |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorAlignCenterButton.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.align = BI.createWidget({ |
||||
type: "bi.icon_button", |
||||
element: this, |
||||
forceNotSelected: true, |
||||
title: BI.i18nText("BI-Word_Align_Center"), |
||||
height: 20, |
||||
width: 20, |
||||
cls: "text-toolbar-button bi-list-item-active text-align-center-font" |
||||
}); |
||||
this.align.on(BI.IconButton.EVENT_CHANGE, function () { |
||||
self.doCommand(); |
||||
}); |
||||
}, |
||||
activate: function () { |
||||
}, |
||||
|
||||
deactivate: function () { |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_align_center_button", BI.RichEditorAlignCenterButton); |
@ -1,38 +0,0 @@
|
||||
/** |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorAlignLeftButton |
||||
* @extends BI.RichEditorAction |
||||
*/ |
||||
BI.RichEditorAlignLeftButton = BI.inherit(BI.RichEditorAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorAlignLeftButton.superclass._defaultConfig.apply(this, arguments), { |
||||
width: 20, |
||||
height: 20, |
||||
command: "justifyleft" |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorAlignLeftButton.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.align = BI.createWidget({ |
||||
type: "bi.icon_button", |
||||
element: this, |
||||
forceNotSelected: true, |
||||
title: BI.i18nText("BI-Word_Align_Left"), |
||||
height: 20, |
||||
width: 20, |
||||
cls: "text-toolbar-button bi-list-item-active text-align-left-font" |
||||
}); |
||||
this.align.on(BI.IconButton.EVENT_CHANGE, function () { |
||||
self.doCommand(); |
||||
}); |
||||
}, |
||||
activate: function () { |
||||
}, |
||||
|
||||
deactivate: function () { |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_align_left_button", BI.RichEditorAlignLeftButton); |
@ -1,38 +0,0 @@
|
||||
/** |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorAlignRightButton |
||||
* @extends BI.RichEditorAction |
||||
*/ |
||||
BI.RichEditorAlignRightButton = BI.inherit(BI.RichEditorAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorAlignRightButton.superclass._defaultConfig.apply(this, arguments), { |
||||
width: 20, |
||||
height: 20, |
||||
command: "justifyright" |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorAlignRightButton.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.align = BI.createWidget({ |
||||
type: "bi.icon_button", |
||||
element: this, |
||||
forceNotSelected: true, |
||||
title: BI.i18nText("BI-Word_Align_Right"), |
||||
height: 20, |
||||
width: 20, |
||||
cls: "text-toolbar-button bi-list-item-active text-align-right-font" |
||||
}); |
||||
this.align.on(BI.IconButton.EVENT_CHANGE, function () { |
||||
self.doCommand(); |
||||
}); |
||||
}, |
||||
activate: function () { |
||||
}, |
||||
|
||||
deactivate: function () { |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_align_right_button", BI.RichEditorAlignRightButton); |
@ -1,57 +0,0 @@
|
||||
/** |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorBoldButton |
||||
* @extends BI.RichEditorAction |
||||
*/ |
||||
BI.RichEditorBoldButton = BI.inherit(BI.RichEditorAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorBoldButton.superclass._defaultConfig.apply(this, arguments), { |
||||
width: 20, |
||||
height: 20, |
||||
command: "Bold", |
||||
tags: ["B", "STRONG"], |
||||
css: {fontWeight: "bold"} |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorBoldButton.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.bold = BI.createWidget({ |
||||
type: "bi.icon_button", |
||||
element: this, |
||||
title: BI.i18nText("BI-Basic_Bold"), |
||||
height: 20, |
||||
width: 20, |
||||
cls: "text-toolbar-button bi-list-item-active text-bold-font" |
||||
}); |
||||
this.bold.on(BI.IconButton.EVENT_CHANGE, function () { |
||||
self.doCommand(); |
||||
}); |
||||
}, |
||||
|
||||
checkNodes: function (e) { |
||||
var self = this; |
||||
try { |
||||
BI.defer(function() { |
||||
if(document.queryCommandState("bold") ) { |
||||
self.activate(); |
||||
} else { |
||||
self.deactivate(); |
||||
} |
||||
}); |
||||
} catch (error) { |
||||
BI.RichEditorBoldButton.superclass.checkNodes(e); |
||||
} |
||||
}, |
||||
|
||||
activate: function () { |
||||
this.bold.setSelected(true); |
||||
}, |
||||
|
||||
deactivate: function () { |
||||
this.bold.setSelected(false); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_bold_button", BI.RichEditorBoldButton); |
@ -1,57 +0,0 @@
|
||||
/** |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorItalicButton |
||||
* @extends BI.RichEditorAction |
||||
*/ |
||||
BI.RichEditorItalicButton = BI.inherit(BI.RichEditorAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorItalicButton.superclass._defaultConfig.apply(this, arguments), { |
||||
width: 20, |
||||
height: 20, |
||||
command: "Italic", |
||||
tags: ["EM", "I"], |
||||
css: {fontStyle: "italic"} |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorItalicButton.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.italic = BI.createWidget({ |
||||
type: "bi.icon_button", |
||||
element: this, |
||||
title: BI.i18nText("BI-Basic_Italic"), |
||||
height: 20, |
||||
width: 20, |
||||
cls: "text-toolbar-button bi-list-item-active text-italic-font" |
||||
}); |
||||
this.italic.on(BI.IconButton.EVENT_CHANGE, function () { |
||||
self.doCommand(); |
||||
}); |
||||
}, |
||||
|
||||
checkNodes: function (e) { |
||||
var self = this; |
||||
try { |
||||
BI.defer(function() { |
||||
if(document.queryCommandState("italic") ) { |
||||
self.activate(); |
||||
} else { |
||||
self.deactivate(); |
||||
} |
||||
}); |
||||
} catch (error) { |
||||
BI.RichEditorBoldButton.superclass.checkNodes(e); |
||||
} |
||||
}, |
||||
|
||||
activate: function () { |
||||
this.italic.setSelected(true); |
||||
}, |
||||
|
||||
deactivate: function () { |
||||
this.italic.setSelected(false); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_italic_button", BI.RichEditorItalicButton); |
@ -1,37 +0,0 @@
|
||||
/** |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorParamButton |
||||
* @extends BI.RichEditorParamAction |
||||
*/ |
||||
BI.RichEditorParamButton = BI.inherit(BI.RichEditorParamAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorParamButton.superclass._defaultConfig.apply(this, arguments), { |
||||
width: 20, |
||||
height: 20 |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorParamButton.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.param = BI.createWidget({ |
||||
type: "bi.button", |
||||
element: this, |
||||
level: "ignore", |
||||
minWidth: 0, |
||||
text: BI.i18nText("BI-Formula_Insert"), |
||||
height: 20, |
||||
width: 30 |
||||
}); |
||||
this.param.on(BI.Button.EVENT_CHANGE, function () { |
||||
self.addParam("参数"); |
||||
}); |
||||
}, |
||||
activate: function () { |
||||
}, |
||||
|
||||
deactivate: function () { |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_param_button", BI.RichEditorParamButton); |
@ -1,57 +0,0 @@
|
||||
/** |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorItalicButton |
||||
* @extends BI.RichEditorAction |
||||
*/ |
||||
BI.RichEditorUnderlineButton = BI.inherit(BI.RichEditorAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorUnderlineButton.superclass._defaultConfig.apply(this, arguments), { |
||||
width: 20, |
||||
height: 20, |
||||
command: "Underline", |
||||
tags: ["U"], |
||||
css: {textDecoration: "underline"} |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorUnderlineButton.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.underline = BI.createWidget({ |
||||
type: "bi.icon_button", |
||||
element: this, |
||||
title: BI.i18nText("BI-Basic_Underline"), |
||||
height: 20, |
||||
width: 20, |
||||
cls: "text-toolbar-button bi-list-item-active text-underline-font" |
||||
}); |
||||
this.underline.on(BI.IconButton.EVENT_CHANGE, function () { |
||||
self.doCommand(); |
||||
}); |
||||
}, |
||||
|
||||
checkNodes: function (e) { |
||||
var self = this; |
||||
try { |
||||
BI.defer(function() { |
||||
if(document.queryCommandState("underline") ) { |
||||
self.activate(); |
||||
} else { |
||||
self.deactivate(); |
||||
} |
||||
}); |
||||
} catch (error) { |
||||
BI.RichEditorBoldButton.superclass.checkNodes(e); |
||||
} |
||||
}, |
||||
|
||||
activate: function () { |
||||
this.underline.setSelected(true); |
||||
}, |
||||
|
||||
deactivate: function () { |
||||
this.underline.setSelected(false); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_underline_button", BI.RichEditorUnderlineButton); |
@ -1,54 +0,0 @@
|
||||
/** |
||||
* 颜色选择trigger |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorColorChooserTrigger |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.RichEditorColorChooserTrigger = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
var conf = BI.RichEditorColorChooserTrigger.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
width: 20, |
||||
height: 20 |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorColorChooserTrigger.superclass._init.apply(this, arguments); |
||||
this.font = BI.createWidget({ |
||||
type: "bi.icon_button", |
||||
element: this, |
||||
title: BI.i18nText("BI-Basic_Font_Color"), |
||||
cls: "text-color-font" |
||||
}); |
||||
|
||||
// this.underline = BI.createWidget({
|
||||
// type: "bi.icon_button",
|
||||
// cls: "text-color-underline-font"
|
||||
// });
|
||||
|
||||
// BI.createWidget({
|
||||
// type: "bi.absolute",
|
||||
// element: this,
|
||||
// items: [{
|
||||
// el: this.font,
|
||||
// top: 2,
|
||||
// left: 2
|
||||
// }, {
|
||||
// el: this.underline,
|
||||
// top: 7,
|
||||
// left: 2
|
||||
// }]
|
||||
// });
|
||||
}, |
||||
|
||||
setValue: function (color) { |
||||
this.font.element.css("color", color); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.font.element.css("color"); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_color_chooser_trigger", BI.RichEditorColorChooserTrigger); |
@ -1,46 +0,0 @@
|
||||
/** |
||||
* 颜色选择 |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorBackgroundColorChooser |
||||
* @extends BI.RichEditorAction |
||||
*/ |
||||
BI.RichEditorBackgroundColorChooser = BI.inherit(BI.RichEditorAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorBackgroundColorChooser.superclass._defaultConfig.apply(this, arguments), { |
||||
width: 20, |
||||
height: 20 |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorBackgroundColorChooser.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.colorchooser = BI.createWidget({ |
||||
type: "bi.color_chooser", |
||||
container: null, |
||||
element: this, |
||||
width: o.width, |
||||
height: o.height, |
||||
el: { |
||||
type: "bi.rich_editor_background_color_chooser_trigger", |
||||
title: BI.i18nText("BI-Widget_Background_Colour"), |
||||
cls: "text-toolbar-button" |
||||
} |
||||
}); |
||||
this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { |
||||
var backgroundColor = this.getValue(); |
||||
self.fireEvent("EVENT_CHANGE", backgroundColor); |
||||
}); |
||||
}, |
||||
|
||||
hideIf: function (e) { |
||||
if(!this.colorchooser.element.find(e.target).length > 0) { |
||||
this.colorchooser.hideView(); |
||||
} |
||||
}, |
||||
|
||||
deactivate: function () { |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_background_color_chooser", BI.RichEditorBackgroundColorChooser); |
@ -1,61 +0,0 @@
|
||||
/** |
||||
* 颜色选择 |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorColorChooser |
||||
* @extends BI.RichEditorAction |
||||
*/ |
||||
BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorColorChooser.superclass._defaultConfig.apply(this, arguments), { |
||||
width: 20, |
||||
height: 20, |
||||
command: "foreColor", |
||||
css: {color: null} |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorColorChooser.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.colorchooser = BI.createWidget({ |
||||
type: "bi.color_chooser", |
||||
container: null, |
||||
element: this, |
||||
width: o.width, |
||||
height: o.height, |
||||
el: { |
||||
type: "bi.rich_editor_color_chooser_trigger", |
||||
title: BI.i18nText("BI-Font_Colour"), |
||||
cls: "text-toolbar-button" |
||||
} |
||||
}); |
||||
this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { |
||||
var value = this.getValue(); |
||||
// 用span代替font
|
||||
if(BI.isIE() && BI.getIEVersion() < 11) { |
||||
self.doCommand(this.getValue()); |
||||
} else { |
||||
document.execCommand('styleWithCSS', null, true); |
||||
self.doCommand(this.getValue() || "inherit"); |
||||
document.execCommand('styleWithCSS', null, false); |
||||
} |
||||
}); |
||||
|
||||
}, |
||||
|
||||
hideIf: function (e) { |
||||
if (!this.colorchooser.element.find(e.target).length > 0) { |
||||
this.colorchooser.hideView(); |
||||
} |
||||
}, |
||||
|
||||
activate: function (rgb) { |
||||
this.colorchooser.setValue(BI.DOM.rgb2hex(rgb)); |
||||
}, |
||||
|
||||
deactivate: function () { |
||||
this.colorchooser.setValue(""); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_color_chooser", BI.RichEditorColorChooser); |
@ -1,67 +0,0 @@
|
||||
BI.RichEditorFontChooser = BI.inherit(BI.RichEditorAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditorFontChooser.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-rich-editor-font-chooser bi-border bi-card", |
||||
command: "FontName", |
||||
width: 100, |
||||
height: 24 |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.RichEditorSizeChooser.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.trigger = BI.createWidget({ |
||||
type: "bi.text_trigger", |
||||
readonly: true, |
||||
height: o.height, |
||||
triggerWidth: 16, |
||||
text: BI.i18nText("BI-Font_Family") |
||||
}); |
||||
|
||||
this.combo = BI.createWidget({ |
||||
type: "bi.combo", |
||||
container: null, |
||||
element: this, |
||||
el: this.trigger, |
||||
adjustLength: 1, |
||||
popup: { |
||||
minWidth: 70, |
||||
el: { |
||||
type: "bi.button_group", |
||||
items: BI.createItems([{ |
||||
value: "MicrosoftYaHei", |
||||
text: BI.i18nText("BI-Microsoft_YaHei") |
||||
}, { |
||||
value: "PingFangSC-Light", |
||||
text: BI.i18nText("BI-Apple_Light") |
||||
}, { |
||||
value: "ArialMT", |
||||
text: "Arial" |
||||
}, { |
||||
value: "Verdana", |
||||
text: "Verdana" |
||||
}], { |
||||
type: "bi.single_select_item" |
||||
}), |
||||
layouts: [{ |
||||
type: "bi.vertical" |
||||
}] |
||||
} |
||||
} |
||||
}); |
||||
this.combo.on(BI.Combo.EVENT_CHANGE, function () { |
||||
var val = this.getValue()[0]; |
||||
self.doCommand(val); |
||||
this.hideView(); |
||||
this.setValue([]); |
||||
}); |
||||
}, |
||||
|
||||
hideIf: function (e) { |
||||
if(!this.combo.element.find(e.target).length > 0) { |
||||
this.combo.hideView(); |
||||
} |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_font_chooser", BI.RichEditorFontChooser); |
@ -1,166 +0,0 @@
|
||||
/** |
||||
* 字体大小选择 |
||||
* |
||||
* Created by GUY on 2015/11/26. |
||||
* @class BI.RichEditorSizeChooser |
||||
* @extends BI.RichEditorAction |
||||
*/ |
||||
BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, { |
||||
_defaultConfig: function () { |
||||
return BI.extend( |
||||
BI.RichEditorSizeChooser.superclass._defaultConfig.apply( |
||||
this, |
||||
arguments |
||||
), |
||||
{ |
||||
baseCls: "bi-rich-editor-size-chooser bi-border bi-card", |
||||
command: "FontSize", |
||||
width: 50, |
||||
height: 24 |
||||
} |
||||
); |
||||
}, |
||||
|
||||
_items: [ |
||||
{ |
||||
value: 12, |
||||
text: 12 |
||||
}, |
||||
{ |
||||
value: 13, |
||||
text: 13 |
||||
}, |
||||
{ |
||||
value: 14, |
||||
text: 14 |
||||
}, |
||||
{ |
||||
value: 16, |
||||
text: 16 |
||||
}, |
||||
{ |
||||
value: 18, |
||||
text: 18 |
||||
}, |
||||
{ |
||||
value: 20, |
||||
text: 20 |
||||
}, |
||||
{ |
||||
value: 22, |
||||
text: 22 |
||||
}, |
||||
{ |
||||
value: 24, |
||||
text: 24 |
||||
}, |
||||
{ |
||||
value: 26, |
||||
text: 26 |
||||
}, |
||||
{ |
||||
value: 28, |
||||
text: 28 |
||||
}, |
||||
{ |
||||
value: 30, |
||||
text: 30 |
||||
}, |
||||
{ |
||||
value: 32, |
||||
text: 32 |
||||
}, |
||||
{ |
||||
value: 34, |
||||
text: 34 |
||||
}, |
||||
{ |
||||
value: 36, |
||||
text: 36 |
||||
}, |
||||
{ |
||||
value: 38, |
||||
text: 38 |
||||
}, |
||||
{ |
||||
value: 40, |
||||
text: 40 |
||||
}, |
||||
{ |
||||
value: 64, |
||||
text: 64 |
||||
}, |
||||
{ |
||||
value: 128, |
||||
text: 128 |
||||
} |
||||
], |
||||
|
||||
_init: function () { |
||||
BI.RichEditorSizeChooser.superclass._init.apply(this, arguments); |
||||
var self = this, |
||||
o = this.options; |
||||
this.trigger = BI.createWidget({ |
||||
type: "bi.text_trigger", |
||||
readonly: true, |
||||
height: o.height, |
||||
triggerWidth: 16, |
||||
text: BI.i18nText("BI-Font_Size") |
||||
}); |
||||
|
||||
this.combo = BI.createWidget({ |
||||
type: "bi.combo", |
||||
container: null, |
||||
element: this, |
||||
el: this.trigger, |
||||
adjustLength: 1, |
||||
popup: { |
||||
maxWidth: 70, |
||||
minWidth: 70, |
||||
el: { |
||||
type: "bi.button_group", |
||||
items: BI.createItems(this._items, { |
||||
type: "bi.single_select_item" |
||||
}), |
||||
layouts: [ |
||||
{ |
||||
type: "bi.vertical" |
||||
} |
||||
] |
||||
} |
||||
} |
||||
}); |
||||
this.combo.on(BI.Combo.EVENT_CHANGE, function () { |
||||
var val = this.getValue()[0]; |
||||
self.doAction(val); |
||||
this.hideView(); |
||||
this.setValue([]); |
||||
}); |
||||
}, |
||||
|
||||
hideIf: function (e) { |
||||
if (!this.combo.element.find(e.target).length > 0) { |
||||
this.combo.hideView(); |
||||
} |
||||
}, |
||||
|
||||
doAction: function (fontSize) { |
||||
var editor = this.options.editor.instance; |
||||
var range = editor.getRng(); |
||||
var commonSize = 7; |
||||
if (!range.collapsed) { |
||||
this.doCommand(commonSize); |
||||
BI.each(document.getElementsByTagName("font"), function (idx, el) { |
||||
if ( |
||||
BI.contains($(el).parents(), editor.element[0]) && |
||||
el["size"] == commonSize |
||||
) { |
||||
$(el) |
||||
.removeAttr("size") |
||||
.css("font-size", fontSize + "px"); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser); |
@ -1,118 +0,0 @@
|
||||
/** |
||||
* 富文本编辑器 |
||||
* |
||||
* Created by GUY on 2017/9/15. |
||||
* @class BI.RichEditor |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.RichEditor = BI.inherit(BI.Widget, { |
||||
|
||||
props: { |
||||
baseCls: "bi-rich-editor bi-textarea", |
||||
toolbar: {}, |
||||
readOnly: false |
||||
}, |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.RichEditor.superclass._defaultConfig.apply(this, arguments), { |
||||
adjustLength: 1, |
||||
adjustXOffset: 0, |
||||
adjustYOffset: 0 |
||||
}); |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
var editor = { |
||||
type: "bi.nic_editor", |
||||
width: o.width, |
||||
height: o.height, |
||||
readOnly: o.readOnly, |
||||
ref: function () { |
||||
self.editor = this; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.NicEditor.EVENT_BLUR, |
||||
action: function () { |
||||
self.fireEvent(BI.RichEditor.EVENT_CONFIRM); |
||||
} |
||||
}, { |
||||
eventName: BI.NicEditor.EVENT_FOCUS, |
||||
action: function () { |
||||
if (!o.readOnly && !self.combo.isViewVisible()) { |
||||
self.combo.showView(); |
||||
} |
||||
self.fireEvent(BI.RichEditor.EVENT_FOCUS); |
||||
} |
||||
}] |
||||
}; |
||||
if(o.readOnly) { |
||||
return editor; |
||||
} |
||||
this.editor = BI.createWidget(editor); |
||||
return { |
||||
type: "bi.combo", |
||||
container: o.container, |
||||
toggle: false, |
||||
trigger: "click", |
||||
direction: "top,right", |
||||
isNeedAdjustWidth: false, |
||||
isNeedAdjustHeight: false, |
||||
adjustLength: o.adjustLength, |
||||
adjustXOffset: o.adjustXOffset, |
||||
adjustYOffset: o.adjustYOffset, |
||||
ref: function () { |
||||
self.combo = this; |
||||
}, |
||||
el: this.editor, |
||||
popup: { |
||||
el: BI.extend({ |
||||
type: "bi.rich_editor_text_toolbar", |
||||
editor: this.editor, |
||||
ref: function (_ref) { |
||||
self.toolbar = _ref; |
||||
} |
||||
}, o.toolbar), |
||||
height: 34, |
||||
stopPropagation: true, |
||||
stopEvent: true |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW, |
||||
action: function () { |
||||
self.fireEvent(BI.RichEditor.EVENT_AFTER_HIDEVIEW); |
||||
} |
||||
}] |
||||
}; |
||||
}, |
||||
|
||||
mounted: function () { |
||||
var o = this.options; |
||||
if(BI.isNull(o.value)) { |
||||
this.editor.setValue(o.value); |
||||
} |
||||
if(o.toolbar) { |
||||
this.editor.bindToolbar(this.toolbar); |
||||
} |
||||
}, |
||||
|
||||
focus: function () { |
||||
this.editor.focus(); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.editor.setValue(v); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.editor.getValue(); |
||||
}, |
||||
|
||||
getContentHeight: function () { |
||||
return this.editor.getContentHeight(); |
||||
} |
||||
}); |
||||
BI.RichEditor.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; |
||||
BI.RichEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
BI.RichEditor.EVENT_FOCUS = "EVENT_FOCUS"; |
||||
BI.shortcut("bi.rich_editor", BI.RichEditor); |
@ -1,479 +0,0 @@
|
||||
/* BASICS */ |
||||
.CodeMirror { |
||||
/* Set height, width, borders, and global font properties here */ |
||||
font-family: monospace; |
||||
cursor: text; |
||||
width: 100%; |
||||
height: 100%; |
||||
} |
||||
/* PADDING */ |
||||
.CodeMirror-lines { |
||||
padding: 4px 0; |
||||
/* Vertical padding around content */ |
||||
} |
||||
.CodeMirror pre { |
||||
padding: 0 4px; |
||||
/* Horizontal padding of content */ |
||||
} |
||||
.CodeMirror-scrollbar-filler, |
||||
.CodeMirror-gutter-filler { |
||||
background-color: white; |
||||
/* The little square between H and V scrollbars */ |
||||
} |
||||
/* GUTTER */ |
||||
.CodeMirror-gutters { |
||||
background-color: #F2F4F7; |
||||
white-space: nowrap; |
||||
} |
||||
.CodeMirror-linenumber { |
||||
padding: 0 3px 0 5px; |
||||
min-width: 20px; |
||||
text-align: right; |
||||
color: #999; |
||||
white-space: nowrap; |
||||
} |
||||
.CodeMirror-guttermarker { |
||||
color: black; |
||||
} |
||||
.CodeMirror-guttermarker-subtle { |
||||
color: #999; |
||||
} |
||||
/* CURSOR */ |
||||
.CodeMirror div.CodeMirror-cursor { |
||||
border-left: 1px solid #232e40; |
||||
} |
||||
.bi-theme-dark .CodeMirror div.CodeMirror-cursor { |
||||
border-left: 1px solid #ffffff; |
||||
} |
||||
/* Shown when moving in bi-directional text */ |
||||
.CodeMirror div.CodeMirror-secondarycursor { |
||||
border-left: 1px solid silver; |
||||
} |
||||
.CodeMirror.cm-fat-cursor div.CodeMirror-cursor { |
||||
width: auto; |
||||
border: 0; |
||||
background: #7e7; |
||||
} |
||||
.CodeMirror.cm-fat-cursor div.CodeMirror-cursors { |
||||
z-index: 1; |
||||
} |
||||
.cm-animate-fat-cursor { |
||||
width: auto; |
||||
border: 0; |
||||
-webkit-animation: blink 1.06s steps(1) infinite; |
||||
-moz-animation: blink 1.06s steps(1) infinite; |
||||
animation: blink 1.06s steps(1) infinite; |
||||
} |
||||
@-moz-keyframes blink { |
||||
0% { |
||||
background: #7e7; |
||||
} |
||||
50% { |
||||
background: none; |
||||
} |
||||
100% { |
||||
background: #7e7; |
||||
} |
||||
} |
||||
@-webkit-keyframes blink { |
||||
0% { |
||||
background: #7e7; |
||||
} |
||||
50% { |
||||
background: none; |
||||
} |
||||
100% { |
||||
background: #7e7; |
||||
} |
||||
} |
||||
@keyframes blink { |
||||
0% { |
||||
background: #7e7; |
||||
} |
||||
50% { |
||||
background: none; |
||||
} |
||||
100% { |
||||
background: #7e7; |
||||
} |
||||
} |
||||
/* Can style cursor different in overwrite (non-insert) mode */ |
||||
.cm-tab { |
||||
display: inline-block; |
||||
text-decoration: inherit; |
||||
} |
||||
.CodeMirror-ruler { |
||||
border-left: 1px solid #ccc; |
||||
position: absolute; |
||||
} |
||||
/* DEFAULT THEME */ |
||||
.cm-s-default .cm-header { |
||||
color: blue; |
||||
} |
||||
.cm-s-default .cm-quote { |
||||
color: #090; |
||||
} |
||||
.cm-negative { |
||||
color: #d44; |
||||
} |
||||
.cm-positive { |
||||
color: #292; |
||||
} |
||||
.cm-header, |
||||
.cm-strong { |
||||
font-weight: bold; |
||||
} |
||||
.cm-em { |
||||
font-style: italic; |
||||
} |
||||
.cm-link { |
||||
text-decoration: underline; |
||||
} |
||||
.cm-strikethrough { |
||||
text-decoration: line-through; |
||||
} |
||||
.cm-s-default .cm-atom { |
||||
color: #219; |
||||
} |
||||
.cm-s-default .cm-number { |
||||
color: #164; |
||||
} |
||||
.cm-s-default .cm-def { |
||||
color: #00f; |
||||
} |
||||
.cm-s-default .cm-variable-2 { |
||||
color: #05a; |
||||
} |
||||
.cm-s-default .cm-variable-3 { |
||||
color: #085; |
||||
} |
||||
.cm-s-default .cm-comment { |
||||
color: #a50; |
||||
} |
||||
.cm-s-default .cm-string { |
||||
color: #a11; |
||||
} |
||||
.cm-s-default .cm-string-2 { |
||||
color: #f50; |
||||
} |
||||
.cm-s-default .cm-meta { |
||||
color: #555; |
||||
} |
||||
.cm-s-default .cm-qualifier { |
||||
color: #555; |
||||
} |
||||
.cm-s-default .cm-builtin { |
||||
color: #30a; |
||||
} |
||||
.cm-s-default .cm-bracket { |
||||
color: #997; |
||||
} |
||||
.cm-s-default .cm-tag { |
||||
color: #170; |
||||
} |
||||
.cm-s-default .cm-attribute { |
||||
color: #00c; |
||||
} |
||||
.cm-s-default .cm-hr { |
||||
color: #999; |
||||
} |
||||
.cm-s-default .cm-link { |
||||
color: #00c; |
||||
} |
||||
.cm-s-default span[class*="fieldName"] { |
||||
display: inline-block; |
||||
color: white; |
||||
background: #3685f2; |
||||
padding: 0 5px; |
||||
margin: 1px 1px; |
||||
} |
||||
.cm-s-default span[class*="start"] { |
||||
-webkit-border-radius: 3px 0px 0px 3px; |
||||
-moz-border-radius: 3px 0px 0px 3px; |
||||
border-radius: 3px 0px 0px 3px; |
||||
margin-left: 3px; |
||||
} |
||||
.cm-s-default span[class*="end"] { |
||||
-webkit-border-radius: 0px 3px 3px 0px; |
||||
-moz-border-radius: 0px 3px 3px 0px; |
||||
border-radius: 0px 3px 3px 0px; |
||||
margin-right: 3px; |
||||
} |
||||
.cm-s-default span[class*="start end"] { |
||||
-webkit-border-radius: 3px; |
||||
-moz-border-radius: 3px; |
||||
border-radius: 3px; |
||||
} |
||||
.cm-s-default span[class*="#"] { |
||||
color: #3685f2; |
||||
} |
||||
.cm-s-default .cm-error { |
||||
color: #f00; |
||||
} |
||||
.cm-invalidchar { |
||||
color: #f00; |
||||
} |
||||
.CodeMirror-composing { |
||||
border-bottom: 2px solid; |
||||
} |
||||
/* Default styles for common addons */ |
||||
div.CodeMirror span.CodeMirror-matchingbracket { |
||||
color: #0f0; |
||||
} |
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket { |
||||
color: #f22; |
||||
} |
||||
.CodeMirror-matchingtag { |
||||
background: rgba(255, 150, 0, 0.3); |
||||
} |
||||
.CodeMirror-activeline-background { |
||||
background: #e8f2ff; |
||||
} |
||||
/* STOP */ |
||||
/* The rest of this file contains styles related to the mechanics of |
||||
the editor. You probably shouldn't touch them. */ |
||||
.CodeMirror { |
||||
position: relative; |
||||
overflow: hidden; |
||||
} |
||||
.CodeMirror-scroll { |
||||
overflow: scroll !important; |
||||
/* Things will break if this is overridden */ |
||||
/* 30px is the magic margin used to hide the element's real scrollbars */ |
||||
/* See overflow: hidden in .CodeMirror */ |
||||
margin-bottom: -30px; |
||||
margin-right: -30px; |
||||
padding-bottom: 30px; |
||||
height: 100%; |
||||
outline: none; |
||||
/* Prevent dragging from highlighting the element */ |
||||
position: relative; |
||||
} |
||||
.CodeMirror-sizer { |
||||
position: relative; |
||||
border-right: 30px solid transparent; |
||||
} |
||||
/* The fake, visible scrollbars. Used to force redraw during scrolling |
||||
before actuall scrolling happens, thus preventing shaking and |
||||
flickering artifacts. */ |
||||
.CodeMirror-vscrollbar, |
||||
.CodeMirror-hscrollbar, |
||||
.CodeMirror-scrollbar-filler, |
||||
.CodeMirror-gutter-filler { |
||||
position: absolute; |
||||
z-index: 6; |
||||
display: none; |
||||
} |
||||
.CodeMirror-vscrollbar { |
||||
right: 0; |
||||
top: 0; |
||||
overflow-x: hidden; |
||||
overflow-y: scroll; |
||||
} |
||||
.CodeMirror-hscrollbar { |
||||
bottom: 0; |
||||
left: 0; |
||||
overflow-y: hidden; |
||||
overflow-x: scroll; |
||||
} |
||||
.CodeMirror-scrollbar-filler { |
||||
right: 0; |
||||
bottom: 0; |
||||
} |
||||
.CodeMirror-gutter-filler { |
||||
left: 0; |
||||
bottom: 0; |
||||
} |
||||
.CodeMirror-gutters { |
||||
position: absolute; |
||||
left: 0; |
||||
top: 0; |
||||
z-index: 3; |
||||
} |
||||
.CodeMirror-gutter { |
||||
white-space: normal; |
||||
height: 100%; |
||||
display: inline-block; |
||||
margin-bottom: -30px; |
||||
/* Hack to make IE7 behave */ |
||||
*zoom: 1; |
||||
*display: inline; |
||||
} |
||||
.CodeMirror-gutter-wrapper { |
||||
position: absolute; |
||||
z-index: 4; |
||||
height: 100%; |
||||
} |
||||
.CodeMirror-gutter-elt { |
||||
position: absolute; |
||||
cursor: default; |
||||
z-index: 4; |
||||
} |
||||
.CodeMirror-gutter-wrapper { |
||||
-webkit-user-select: none; |
||||
-moz-user-select: none; |
||||
user-select: none; |
||||
} |
||||
.CodeMirror-lines { |
||||
cursor: text; |
||||
min-height: 1px; |
||||
/* prevents collapsing before first draw */ |
||||
} |
||||
.CodeMirror pre { |
||||
/* Reset some styles that the rest of the page might have set */ |
||||
-moz-border-radius: 0; |
||||
-webkit-border-radius: 0; |
||||
border-radius: 0; |
||||
border-width: 0; |
||||
background: transparent; |
||||
font-family: inherit; |
||||
font-size: inherit; |
||||
margin: 0; |
||||
white-space: pre; |
||||
word-wrap: normal; |
||||
color: inherit; |
||||
z-index: 2; |
||||
position: relative; |
||||
overflow: visible; |
||||
-webkit-tap-highlight-color: transparent; |
||||
} |
||||
.codemirror-high-line-height { |
||||
line-height: 2; |
||||
} |
||||
.codemirror-low-line-height { |
||||
line-height: 1.4; |
||||
} |
||||
.CodeMirror-wrap pre { |
||||
word-wrap: break-word; |
||||
white-space: pre-wrap; |
||||
word-break: normal; |
||||
} |
||||
.CodeMirror-linebackground { |
||||
position: absolute; |
||||
left: 0; |
||||
right: 0; |
||||
top: 0; |
||||
bottom: 0; |
||||
z-index: 0; |
||||
} |
||||
.CodeMirror-linewidget { |
||||
position: relative; |
||||
z-index: 2; |
||||
overflow: auto; |
||||
} |
||||
.CodeMirror-code { |
||||
outline: none; |
||||
} |
||||
/* Force content-box sizing for the elements where we expect it */ |
||||
.CodeMirror-scroll, |
||||
.CodeMirror-sizer, |
||||
.CodeMirror-gutter, |
||||
.CodeMirror-gutters, |
||||
.CodeMirror-linenumber { |
||||
-moz-box-sizing: content-box; |
||||
box-sizing: content-box; |
||||
} |
||||
.CodeMirror-measure { |
||||
position: absolute; |
||||
width: 100%; |
||||
height: 0; |
||||
overflow: hidden; |
||||
visibility: hidden; |
||||
} |
||||
.CodeMirror-measure pre { |
||||
position: static; |
||||
} |
||||
.CodeMirror div.CodeMirror-cursor { |
||||
position: absolute; |
||||
border-right: none; |
||||
width: 0; |
||||
} |
||||
div.CodeMirror-cursors { |
||||
visibility: hidden; |
||||
position: relative; |
||||
z-index: 3; |
||||
} |
||||
.CodeMirror-focused div.CodeMirror-cursors { |
||||
visibility: visible; |
||||
} |
||||
.CodeMirror-selected { |
||||
background: #d9d9d9; |
||||
} |
||||
.CodeMirror-focused .CodeMirror-selected { |
||||
background: #3685F2; |
||||
} |
||||
.CodeMirror-crosshair { |
||||
cursor: crosshair; |
||||
} |
||||
.CodeMirror-line::selection, |
||||
.CodeMirror-line > span::selection, |
||||
.CodeMirror-line > span > span::selection { |
||||
background: #d7d4f0; |
||||
} |
||||
.CodeMirror-line::-moz-selection, |
||||
.CodeMirror-line > span::-moz-selection, |
||||
.CodeMirror-line > span > span::-moz-selection { |
||||
background: #d7d4f0; |
||||
} |
||||
.cm-searching { |
||||
background: #ffa; |
||||
background: rgba(255, 255, 0, 0.4); |
||||
} |
||||
/* IE7 hack to prevent it from returning funny offsetTops on the spans */ |
||||
.CodeMirror span { |
||||
*vertical-align: text-bottom; |
||||
} |
||||
/* Used to force a border model for a node */ |
||||
.cm-force-border { |
||||
padding-right: .1px; |
||||
} |
||||
@media print { |
||||
/* Hide the cursor when printing */ |
||||
.CodeMirror div.CodeMirror-cursors { |
||||
visibility: hidden; |
||||
} |
||||
} |
||||
/* See issue #2901 */ |
||||
.cm-tab-wrap-hack:after { |
||||
content: ''; |
||||
} |
||||
/* Help users use markselection to safely style text background */ |
||||
span.CodeMirror-selectedtext { |
||||
background: none; |
||||
} |
||||
/*addon: show-hint*/ |
||||
.CodeMirror-hints { |
||||
position: absolute; |
||||
z-index: 10000; |
||||
overflow: hidden; |
||||
list-style: none; |
||||
margin: 0; |
||||
padding: 2px; |
||||
-webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2); |
||||
-moz-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2); |
||||
box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2); |
||||
border-radius: 3px; |
||||
border: 1px solid silver; |
||||
background: white; |
||||
font-size: 90%; |
||||
font-family: monospace; |
||||
max-height: 20em; |
||||
overflow-y: auto; |
||||
} |
||||
.CodeMirror-hint { |
||||
margin: 0; |
||||
padding: 0 4px; |
||||
border-radius: 2px; |
||||
max-width: 19em; |
||||
overflow: hidden; |
||||
white-space: pre; |
||||
color: black; |
||||
cursor: pointer; |
||||
} |
||||
.CodeMirror-hints { |
||||
z-index: 1000000000; |
||||
} |
||||
li.CodeMirror-hint-active { |
||||
background: #08f; |
||||
color: white; |
||||
} |
@ -1,7 +0,0 @@
|
||||
.bi-formula-editor .error-field { |
||||
display: inline-block; |
||||
background: #ff4949; |
||||
color: #ffffff; |
||||
padding: 0 5px; |
||||
margin: 1px 1px; |
||||
} |
@ -1,8 +0,0 @@
|
||||
.bi-nic-editor { |
||||
-webkit-user-select: text; |
||||
-khtml-user-select: text; |
||||
-moz-user-select: text; |
||||
-ms-user-select: text; |
||||
-o-user-select: text; |
||||
user-select: text; |
||||
} |
@ -1,5 +0,0 @@
|
||||
.bi-rich-editor .rich-editor-param { |
||||
-webkit-border-radius: 12px; |
||||
-moz-border-radius: 12px; |
||||
border-radius: 12px; |
||||
} |
@ -1,3 +0,0 @@
|
||||
.bi-rich-editor-text-toolbar .text-toolbar-button { |
||||
font-size: 16px; |
||||
} |
@ -1,25 +0,0 @@
|
||||
.bi-sql-editor .cm-s-default span[class*="#"] { |
||||
color: #3685f2; |
||||
} |
||||
.bi-sql-editor .cm-s-default .cm-keyword { |
||||
color: #3685f2; |
||||
} |
||||
.bi-sql-editor .cm-s-default .cm-function { |
||||
color: #3685f2; |
||||
} |
||||
.bi-sql-editor .param { |
||||
color: #ffffff; |
||||
padding: 0 5px; |
||||
margin: 1px 1px; |
||||
-webkit-border-radius: 2px; |
||||
-moz-border-radius: 2px; |
||||
border-radius: 2px; |
||||
background: #3685f2; |
||||
display: inline-block; |
||||
} |
||||
.CodeMirror-hints .sql-fr-function { |
||||
color: #3685f2; |
||||
} |
||||
.CodeMirror-hints .sql-keyword { |
||||
color: #3685f2; |
||||
} |
@ -1,4 +0,0 @@
|
||||
.bi-date-calendar-popup .navigation-header { |
||||
padding-left: 10px; |
||||
padding-right: 10px; |
||||
} |
@ -1,14 +0,0 @@
|
||||
.bi-file-manager-nav-button .file-manager-nav-button-text { |
||||
max-width: 200px; |
||||
} |
||||
.bi-file-manager-nav-button .file-manager-nav-button-text.active { |
||||
background-color: #f7f8fa; |
||||
color: #999999; |
||||
} |
||||
.bi-file-manager-nav-button .file-manager-nav-button-triangle { |
||||
z-index: 1; |
||||
} |
||||
.bi-theme-dark .bi-file-manager-nav-button .file-manager-nav-button-text.active { |
||||
background-color: #191B2B; |
||||
color: #999999; |
||||
} |
@ -1,31 +0,0 @@
|
||||
.bi-multidate-combo { |
||||
-webkit-border-radius: 2px; |
||||
-moz-border-radius: 2px; |
||||
border-radius: 2px; |
||||
} |
||||
|
||||
|
||||
|
||||
.bi-multidate-popup .multidate-popup-label { |
||||
color: #3685f2; |
||||
font-size: 14px; |
||||
} |
||||
.bi-multidate-popup .multidate-popup-item:active, |
||||
.bi-multidate-popup .multidate-popup-item.active { |
||||
background-color: #3685f2; |
||||
color: #ffffff; |
||||
-webkit-border-radius: 2px 2px 0 0; |
||||
-moz-border-radius: 2px 2px 0 0; |
||||
border-radius: 2px 2px 0 0; |
||||
} |
||||
.bi-multidate-popup .multidate-popup-button { |
||||
color: #3685f2; |
||||
font-size: 14px; |
||||
} |
||||
|
||||
|
||||
.bi-multidate-segment .bi-multidate-editor { |
||||
font-size: 14px; |
||||
} |
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
.bi-page-table-cell { |
||||
-webkit-user-select: text; |
||||
-khtml-user-select: text; |
||||
-moz-user-select: text; |
||||
-ms-user-select: text; |
||||
-o-user-select: text; |
||||
user-select: text; |
||||
} |
||||
|
@ -1,23 +0,0 @@
|
||||
.bi-sequence-table-dynamic-number .sequence-table-title-cell { |
||||
overflow: hidden; |
||||
overflow-x: hidden; |
||||
overflow-y: hidden; |
||||
-webkit-box-sizing: border-box; |
||||
/*Safari3.2+*/ |
||||
-moz-box-sizing: border-box; |
||||
/*Firefox3.5+*/ |
||||
-ms-box-sizing: border-box; |
||||
/*IE8*/ |
||||
box-sizing: border-box; |
||||
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ |
||||
} |
||||
.bi-sequence-table-dynamic-number .sequence-table-number-cell { |
||||
-webkit-box-sizing: border-box; |
||||
/*Safari3.2+*/ |
||||
-moz-box-sizing: border-box; |
||||
/*Firefox3.5+*/ |
||||
-ms-box-sizing: border-box; |
||||
/*IE8*/ |
||||
box-sizing: border-box; |
||||
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ |
||||
} |
@ -1,23 +0,0 @@
|
||||
.bi-sequence-table-list-number .sequence-table-title-cell { |
||||
overflow: hidden; |
||||
overflow-x: hidden; |
||||
overflow-y: hidden; |
||||
-webkit-box-sizing: border-box; |
||||
/*Safari3.2+*/ |
||||
-moz-box-sizing: border-box; |
||||
/*Firefox3.5+*/ |
||||
-ms-box-sizing: border-box; |
||||
/*IE8*/ |
||||
box-sizing: border-box; |
||||
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ |
||||
} |
||||
.bi-sequence-table-list-number .sequence-table-number-cell { |
||||
-webkit-box-sizing: border-box; |
||||
/*Safari3.2+*/ |
||||
-moz-box-sizing: border-box; |
||||
/*Firefox3.5+*/ |
||||
-ms-box-sizing: border-box; |
||||
/*IE8*/ |
||||
box-sizing: border-box; |
||||
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ |
||||
} |
@ -1,23 +0,0 @@
|
||||
.bi-sequence-table-tree-number .sequence-table-title-cell { |
||||
overflow: hidden; |
||||
overflow-x: hidden; |
||||
overflow-y: hidden; |
||||
-webkit-box-sizing: border-box; |
||||
/*Safari3.2+*/ |
||||
-moz-box-sizing: border-box; |
||||
/*Firefox3.5+*/ |
||||
-ms-box-sizing: border-box; |
||||
/*IE8*/ |
||||
box-sizing: border-box; |
||||
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ |
||||
} |
||||
.bi-sequence-table-tree-number .sequence-table-number-cell { |
||||
-webkit-box-sizing: border-box; |
||||
/*Safari3.2+*/ |
||||
-moz-box-sizing: border-box; |
||||
/*Firefox3.5+*/ |
||||
-ms-box-sizing: border-box; |
||||
/*IE8*/ |
||||
box-sizing: border-box; |
||||
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ |
||||
} |
@ -1,20 +0,0 @@
|
||||
.bi-single-select-combo .single-select-trigger-icon-button { |
||||
font-size: 16px; |
||||
} |
||||
.bi-single-select-combo .trigger-up { |
||||
display: none; |
||||
} |
||||
.bi-single-select-combo .trigger-down { |
||||
display: block; |
||||
} |
||||
.bi-single-select-combo.combo-show .trigger-up { |
||||
display: block; |
||||
} |
||||
.bi-single-select-combo.combo-show .trigger-down { |
||||
display: none; |
||||
} |
||||
.bi-combo.bi-combo-popup:focus > .bi-single-select-trigger, |
||||
.bi-combo.bi-combo-popup:hover > .bi-single-select-trigger, |
||||
.bi-combo.bi-combo-popup:focus-within > .bi-single-select-trigger { |
||||
border-color: #3685f2; |
||||
} |
@ -1,4 +0,0 @@
|
||||
.bi-combo.bi-combo-popup:focus > .bi-single-tree-trigger, |
||||
.bi-combo.bi-combo-popup:hover > .bi-single-tree-trigger { |
||||
border-color: #3685f2; |
||||
} |
@ -1,5 +0,0 @@
|
||||
@import "../../index"; |
||||
|
||||
.bi-static-combo { |
||||
|
||||
} |
@ -1,587 +0,0 @@
|
||||
@import "../../index"; |
||||
|
||||
/* BASICS */ |
||||
|
||||
.CodeMirror { |
||||
/* Set height, width, borders, and global font properties here */ |
||||
font-family: monospace; |
||||
cursor: text; |
||||
// .border-radius(4px); |
||||
.size(100%, 100%); |
||||
} |
||||
|
||||
/* PADDING */ |
||||
|
||||
.CodeMirror-lines { |
||||
padding: 4px 0; /* Vertical padding around content */ |
||||
} |
||||
|
||||
.CodeMirror pre { |
||||
padding: 0 4px; /* Horizontal padding of content */ |
||||
} |
||||
|
||||
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { |
||||
background-color: white; /* The little square between H and V scrollbars */ |
||||
} |
||||
|
||||
/* GUTTER */ |
||||
|
||||
.CodeMirror-gutters { |
||||
background-color: #F2F4F7; |
||||
white-space: nowrap; |
||||
} |
||||
|
||||
.CodeMirror-linenumbers { |
||||
} |
||||
|
||||
.CodeMirror-linenumber { |
||||
padding: 0 3px 0 5px; |
||||
min-width: 20px; |
||||
text-align: right; |
||||
color: #999; |
||||
white-space: nowrap; |
||||
} |
||||
|
||||
.CodeMirror-guttermarker { |
||||
color: black; |
||||
} |
||||
|
||||
.CodeMirror-guttermarker-subtle { |
||||
color: #999; |
||||
} |
||||
|
||||
/* CURSOR */ |
||||
|
||||
.CodeMirror div.CodeMirror-cursor { |
||||
border-left: 1px solid @color-bi-border-black; |
||||
} |
||||
|
||||
.bi-theme-dark { |
||||
.CodeMirror div.CodeMirror-cursor { |
||||
border-left: 1px solid @color-bi-border-default; |
||||
} |
||||
} |
||||
|
||||
/* Shown when moving in bi-directional text */ |
||||
.CodeMirror div.CodeMirror-secondarycursor { |
||||
border-left: 1px solid silver; |
||||
} |
||||
|
||||
.CodeMirror.cm-fat-cursor div.CodeMirror-cursor { |
||||
width: auto; |
||||
border: 0; |
||||
background: #7e7; |
||||
} |
||||
|
||||
.CodeMirror.cm-fat-cursor div.CodeMirror-cursors { |
||||
z-index: 1; |
||||
} |
||||
|
||||
.cm-animate-fat-cursor { |
||||
width: auto; |
||||
border: 0; |
||||
-webkit-animation: blink 1.06s steps(1) infinite; |
||||
-moz-animation: blink 1.06s steps(1) infinite; |
||||
animation: blink 1.06s steps(1) infinite; |
||||
} |
||||
|
||||
@-moz-keyframes blink { |
||||
0% { |
||||
background: #7e7; |
||||
} |
||||
50% { |
||||
background: none; |
||||
} |
||||
100% { |
||||
background: #7e7; |
||||
} |
||||
} |
||||
|
||||
@-webkit-keyframes blink { |
||||
0% { |
||||
background: #7e7; |
||||
} |
||||
50% { |
||||
background: none; |
||||
} |
||||
100% { |
||||
background: #7e7; |
||||
} |
||||
} |
||||
|
||||
@keyframes blink { |
||||
0% { |
||||
background: #7e7; |
||||
} |
||||
50% { |
||||
background: none; |
||||
} |
||||
100% { |
||||
background: #7e7; |
||||
} |
||||
} |
||||
|
||||
/* Can style cursor different in overwrite (non-insert) mode */ |
||||
div.CodeMirror-overwrite div.CodeMirror-cursor { |
||||
} |
||||
|
||||
.cm-tab { |
||||
display: inline-block; |
||||
text-decoration: inherit; |
||||
} |
||||
|
||||
.CodeMirror-ruler { |
||||
border-left: 1px solid #ccc; |
||||
position: absolute; |
||||
} |
||||
|
||||
/* DEFAULT THEME */ |
||||
|
||||
.cm-s-default .cm-header { |
||||
color: blue; |
||||
} |
||||
|
||||
.cm-s-default .cm-quote { |
||||
color: #090; |
||||
} |
||||
|
||||
.cm-negative { |
||||
color: #d44; |
||||
} |
||||
|
||||
.cm-positive { |
||||
color: #292; |
||||
} |
||||
|
||||
.cm-header, .cm-strong { |
||||
font-weight: bold; |
||||
} |
||||
|
||||
.cm-em { |
||||
font-style: italic; |
||||
} |
||||
|
||||
.cm-link { |
||||
text-decoration: underline; |
||||
} |
||||
|
||||
.cm-strikethrough { |
||||
text-decoration: line-through; |
||||
} |
||||
|
||||
//.cm-s-default .cm-keyword {color: #708;} |
||||
.cm-s-default .cm-atom { |
||||
color: #219; |
||||
} |
||||
|
||||
.cm-s-default .cm-number { |
||||
color: #164; |
||||
} |
||||
|
||||
.cm-s-default .cm-def { |
||||
color: #00f; |
||||
} |
||||
|
||||
.cm-s-default .cm-variable, |
||||
.cm-s-default .cm-punctuation, |
||||
.cm-s-default .cm-property, |
||||
.cm-s-default .cm-operator { |
||||
} |
||||
|
||||
.cm-s-default .cm-variable-2 { |
||||
color: #05a; |
||||
} |
||||
|
||||
.cm-s-default .cm-variable-3 { |
||||
color: #085; |
||||
} |
||||
|
||||
.cm-s-default .cm-comment { |
||||
color: #a50; |
||||
} |
||||
|
||||
.cm-s-default .cm-string { |
||||
color: #a11; |
||||
} |
||||
|
||||
.cm-s-default .cm-string-2 { |
||||
color: #f50; |
||||
} |
||||
|
||||
.cm-s-default .cm-meta { |
||||
color: #555; |
||||
} |
||||
|
||||
.cm-s-default .cm-qualifier { |
||||
color: #555; |
||||
} |
||||
|
||||
.cm-s-default .cm-builtin { |
||||
color: #30a; |
||||
} |
||||
|
||||
.cm-s-default .cm-bracket { |
||||
color: #997; |
||||
} |
||||
|
||||
.cm-s-default .cm-tag { |
||||
color: #170; |
||||
} |
||||
|
||||
.cm-s-default .cm-attribute { |
||||
color: #00c; |
||||
} |
||||
|
||||
.cm-s-default .cm-hr { |
||||
color: #999; |
||||
} |
||||
|
||||
.cm-s-default .cm-link { |
||||
color: #00c; |
||||
} |
||||
|
||||
.cm-s-default span[class*="fieldName"] { |
||||
display: inline-block; |
||||
color: white; |
||||
background: @color-bi-text-highlight; |
||||
padding: 0 5px; |
||||
margin: 1px 1px; |
||||
} |
||||
|
||||
.cm-s-default span[class*="start"] { |
||||
.border-radius(3px 0px 0px 3px); |
||||
margin-left: 3px; |
||||
} |
||||
|
||||
.cm-s-default span[class*="end"] { |
||||
.border-radius(0px 3px 3px 0px); |
||||
margin-right: 3px; |
||||
} |
||||
|
||||
.cm-s-default span[class*="start end"] { |
||||
.border-radius(3px); |
||||
} |
||||
|
||||
.cm-s-default span[class*="#"] { |
||||
color: @color-bi-text-highlight; |
||||
} |
||||
|
||||
.cm-s-default .cm-error { |
||||
color: #f00; |
||||
} |
||||
|
||||
.cm-invalidchar { |
||||
color: #f00; |
||||
} |
||||
|
||||
.CodeMirror-composing { |
||||
border-bottom: 2px solid; |
||||
} |
||||
|
||||
/* Default styles for common addons */ |
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket { |
||||
color: #0f0; |
||||
} |
||||
|
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket { |
||||
color: #f22; |
||||
} |
||||
|
||||
.CodeMirror-matchingtag { |
||||
background: rgba(255, 150, 0, .3); |
||||
} |
||||
|
||||
.CodeMirror-activeline-background { |
||||
background: #e8f2ff; |
||||
} |
||||
|
||||
/* STOP */ |
||||
|
||||
/* The rest of this file contains styles related to the mechanics of |
||||
the editor. You probably shouldn't touch them. */ |
||||
|
||||
.CodeMirror { |
||||
position: relative; |
||||
overflow: hidden; |
||||
} |
||||
|
||||
.CodeMirror-scroll { |
||||
overflow: scroll !important; /* Things will break if this is overridden */ |
||||
/* 30px is the magic margin used to hide the element's real scrollbars */ |
||||
/* See overflow: hidden in .CodeMirror */ |
||||
margin-bottom: -30px; |
||||
margin-right: -30px; |
||||
padding-bottom: 30px; |
||||
height: 100%; |
||||
outline: none; /* Prevent dragging from highlighting the element */ |
||||
position: relative; |
||||
} |
||||
|
||||
.CodeMirror-sizer { |
||||
position: relative; |
||||
border-right: 30px solid transparent; |
||||
} |
||||
|
||||
/* The fake, visible scrollbars. Used to force redraw during scrolling |
||||
before actuall scrolling happens, thus preventing shaking and |
||||
flickering artifacts. */ |
||||
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { |
||||
position: absolute; |
||||
z-index: 6; |
||||
display: none; |
||||
} |
||||
|
||||
.CodeMirror-vscrollbar { |
||||
right: 0; |
||||
top: 0; |
||||
overflow-x: hidden; |
||||
overflow-y: scroll; |
||||
} |
||||
|
||||
.CodeMirror-hscrollbar { |
||||
bottom: 0; |
||||
left: 0; |
||||
overflow-y: hidden; |
||||
overflow-x: scroll; |
||||
} |
||||
|
||||
.CodeMirror-scrollbar-filler { |
||||
right: 0; |
||||
bottom: 0; |
||||
} |
||||
|
||||
.CodeMirror-gutter-filler { |
||||
left: 0; |
||||
bottom: 0; |
||||
} |
||||
|
||||
.CodeMirror-gutters { |
||||
position: absolute; |
||||
left: 0; |
||||
top: 0; |
||||
z-index: 3; |
||||
} |
||||
|
||||
.CodeMirror-gutter { |
||||
white-space: normal; |
||||
height: 100%; |
||||
display: inline-block; |
||||
margin-bottom: -30px; |
||||
/* Hack to make IE7 behave */ |
||||
*zoom: 1; |
||||
*display: inline; |
||||
} |
||||
|
||||
.CodeMirror-gutter-wrapper { |
||||
position: absolute; |
||||
z-index: 4; |
||||
height: 100%; |
||||
} |
||||
|
||||
.CodeMirror-gutter-elt { |
||||
position: absolute; |
||||
cursor: default; |
||||
z-index: 4; |
||||
} |
||||
|
||||
.CodeMirror-gutter-wrapper { |
||||
-webkit-user-select: none; |
||||
-moz-user-select: none; |
||||
user-select: none; |
||||
} |
||||
|
||||
.CodeMirror-lines { |
||||
cursor: text; |
||||
min-height: 1px; /* prevents collapsing before first draw */ |
||||
} |
||||
|
||||
.CodeMirror pre { |
||||
/* Reset some styles that the rest of the page might have set */ |
||||
-moz-border-radius: 0; |
||||
-webkit-border-radius: 0; |
||||
border-radius: 0; |
||||
border-width: 0; |
||||
background: transparent; |
||||
font-family: inherit; |
||||
font-size: inherit; |
||||
margin: 0; |
||||
white-space: pre; |
||||
word-wrap: normal; |
||||
color: inherit; |
||||
z-index: 2; |
||||
position: relative; |
||||
overflow: visible; |
||||
-webkit-tap-highlight-color: transparent; |
||||
} |
||||
|
||||
.codemirror-high-line-height { |
||||
line-height: 2; |
||||
} |
||||
|
||||
.codemirror-low-line-height { |
||||
line-height: 1.4; |
||||
} |
||||
|
||||
.CodeMirror-wrap pre { |
||||
word-wrap: break-word; |
||||
white-space: pre-wrap; |
||||
word-break: normal; |
||||
} |
||||
|
||||
.CodeMirror-linebackground { |
||||
position: absolute; |
||||
left: 0; |
||||
right: 0; |
||||
top: 0; |
||||
bottom: 0; |
||||
z-index: 0; |
||||
} |
||||
|
||||
.CodeMirror-linewidget { |
||||
position: relative; |
||||
z-index: 2; |
||||
overflow: auto; |
||||
} |
||||
|
||||
.CodeMirror-widget { |
||||
|
||||
} |
||||
|
||||
.CodeMirror-code { |
||||
outline: none; |
||||
} |
||||
|
||||
/* Force content-box sizing for the elements where we expect it */ |
||||
.CodeMirror-scroll, |
||||
.CodeMirror-sizer, |
||||
.CodeMirror-gutter, |
||||
.CodeMirror-gutters, |
||||
.CodeMirror-linenumber { |
||||
-moz-box-sizing: content-box; |
||||
box-sizing: content-box; |
||||
} |
||||
|
||||
.CodeMirror-measure { |
||||
position: absolute; |
||||
width: 100%; |
||||
height: 0; |
||||
overflow: hidden; |
||||
visibility: hidden; |
||||
} |
||||
|
||||
.CodeMirror-measure pre { |
||||
position: static; |
||||
} |
||||
|
||||
.CodeMirror div.CodeMirror-cursor { |
||||
position: absolute; |
||||
border-right: none; |
||||
width: 0; |
||||
} |
||||
|
||||
div.CodeMirror-cursors { |
||||
visibility: hidden; |
||||
position: relative; |
||||
z-index: 3; |
||||
} |
||||
|
||||
.CodeMirror-focused div.CodeMirror-cursors { |
||||
visibility: visible; |
||||
} |
||||
|
||||
.CodeMirror-selected { |
||||
background: #d9d9d9; |
||||
} |
||||
|
||||
.CodeMirror-focused .CodeMirror-selected { |
||||
background: #3685F2; |
||||
} |
||||
|
||||
.CodeMirror-crosshair { |
||||
cursor: crosshair; |
||||
} |
||||
|
||||
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { |
||||
background: #d7d4f0; |
||||
} |
||||
|
||||
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { |
||||
background: #d7d4f0; |
||||
} |
||||
|
||||
.cm-searching { |
||||
background: #ffa; |
||||
background: rgba(255, 255, 0, .4); |
||||
} |
||||
|
||||
/* IE7 hack to prevent it from returning funny offsetTops on the spans */ |
||||
.CodeMirror span { |
||||
*vertical-align: text-bottom; |
||||
} |
||||
|
||||
/* Used to force a border model for a node */ |
||||
.cm-force-border { |
||||
padding-right: .1px; |
||||
} |
||||
|
||||
@media print { |
||||
/* Hide the cursor when printing */ |
||||
.CodeMirror div.CodeMirror-cursors { |
||||
visibility: hidden; |
||||
} |
||||
} |
||||
|
||||
/* See issue #2901 */ |
||||
.cm-tab-wrap-hack:after { |
||||
content: ''; |
||||
} |
||||
|
||||
/* Help users use markselection to safely style text background */ |
||||
span.CodeMirror-selectedtext { |
||||
background: none; |
||||
} |
||||
|
||||
/*addon: show-hint*/ |
||||
.CodeMirror-hints { |
||||
position: absolute; |
||||
z-index: 10000; |
||||
overflow: hidden; |
||||
list-style: none; |
||||
|
||||
margin: 0; |
||||
padding: 2px; |
||||
|
||||
-webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2); |
||||
-moz-box-shadow: 2px 3px 5px rgba(0, 0, 0, .2); |
||||
box-shadow: 2px 3px 5px rgba(0, 0, 0, .2); |
||||
border-radius: 3px; |
||||
border: 1px solid silver; |
||||
|
||||
background: white; |
||||
font-size: 90%; |
||||
font-family: monospace; |
||||
|
||||
max-height: 20em; |
||||
overflow-y: auto; |
||||
} |
||||
|
||||
.CodeMirror-hint { |
||||
margin: 0; |
||||
padding: 0 4px; |
||||
border-radius: 2px; |
||||
max-width: 19em; |
||||
overflow: hidden; |
||||
white-space: pre; |
||||
color: black; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.CodeMirror-hints { |
||||
z-index: @zIndex-tip; |
||||
} |
||||
|
||||
li.CodeMirror-hint-active { |
||||
background: #08f; |
||||
color: white; |
||||
} |
@ -1,11 +0,0 @@
|
||||
@import "../../index"; |
||||
|
||||
.bi-formula-editor { |
||||
& .error-field { |
||||
display: inline-block; |
||||
background: @color-bi-background-failure; |
||||
color: @font-color-white; |
||||
padding: 0 5px; |
||||
margin: 1px 1px; |
||||
} |
||||
} |
@ -1,5 +0,0 @@
|
||||
@import "../../../index"; |
||||
|
||||
.bi-nic-editor { |
||||
.user-select-enable(); |
||||
} |
@ -1,7 +0,0 @@
|
||||
@import "../../index"; |
||||
|
||||
.bi-rich-editor { |
||||
& .rich-editor-param{ |
||||
.border-radius(12px); |
||||
} |
||||
} |
@ -1,7 +0,0 @@
|
||||
@import "../../../index"; |
||||
|
||||
.bi-rich-editor-text-toolbar { |
||||
& .text-toolbar-button { |
||||
font-size: @font-size-16; |
||||
} |
||||
} |
@ -1,18 +0,0 @@
|
||||
@import "../../../index"; |
||||
|
||||
.bi-code-editor{ |
||||
& .param { |
||||
color: @color-bi-text; |
||||
padding: 0 5px; |
||||
margin: 1px 1px; |
||||
.border-radius(2px); |
||||
background: @color-bi-background-highlight; |
||||
display: inline-block; |
||||
} |
||||
& .error-param { |
||||
color: @color-bi-text-failure; |
||||
padding: 0 5px; |
||||
margin: 1px 1px; |
||||
display: inline-block; |
||||
} |
||||
} |
@ -1,35 +0,0 @@
|
||||
@import "../../index"; |
||||
|
||||
.bi-sql-editor{ |
||||
|
||||
& .cm-s-default span[class*="#"] { |
||||
color: @color-bi-text-highlight; |
||||
} |
||||
|
||||
& .cm-s-default .cm-keyword { |
||||
color: @color-bi-text-highlight; |
||||
} |
||||
|
||||
& .cm-s-default .cm-function { |
||||
color: @color-bi-text-highlight; |
||||
} |
||||
|
||||
& .param { |
||||
color: @color-bi-text; |
||||
padding: 0 5px; |
||||
margin: 1px 1px; |
||||
.border-radius(2px); |
||||
background: @color-bi-background-highlight; |
||||
display: inline-block; |
||||
} |
||||
} |
||||
|
||||
.CodeMirror-hints { |
||||
& .sql-fr-function{ |
||||
color: @color-bi-text-highlight; |
||||
} |
||||
|
||||
& .sql-keyword{ |
||||
color: @color-bi-text-highlight; |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue