本文整理汇总了TypeScript中app/core/utils/kbn.stringToJsRegex函数的典型用法代码示例。如果您正苦于以下问题:TypeScript stringToJsRegex函数的具体用法?TypeScript stringToJsRegex怎么用?TypeScript stringToJsRegex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stringToJsRegex函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: initColumns
initColumns() {
this.formatters = [];
this.colorState = {};
for (let colIndex = 0; colIndex < this.table.columns.length; colIndex++) {
const column = this.table.columns[colIndex];
column.title = column.text;
for (let i = 0; i < this.panel.styles.length; i++) {
const style = this.panel.styles[i];
const regex = kbn.stringToJsRegex(style.pattern);
if (column.text.match(regex)) {
column.style = style;
if (style.alias) {
column.title = column.text.replace(regex, style.alias);
}
break;
}
}
this.formatters[colIndex] = this.createColumnFormatter(column);
}
}
示例2: matchSeriesOverride
function matchSeriesOverride(aliasOrRegex, seriesAlias) {
if (!aliasOrRegex) { return false; }
if (aliasOrRegex[0] === '/') {
var regex = kbn.stringToJsRegex(aliasOrRegex);
return seriesAlias.match(regex) != null;
}
return aliasOrRegex === seriesAlias;
}
示例3: applyAliasing
function applyAliasing(panel, model){
if (!panel.styles) {
return;
}
var hash = [];
for (var i = 0; i < model.columns.length; i++) {
for (var j = 0; j < panel.styles.length; j++) {
var regex = kbn.stringToJsRegex(panel.styles[j].pattern);
if (model.columns[i].text.match(regex)) {
if (!hash[i]) {
model.columns[i].alias = panel.styles[j].alias ? model.columns[i].text.replace(regex, panel.styles[j].alias) : '';
hash[i] = model.columns[i].alias;
}
}
}
}
}
示例4: formatColumnValue
formatColumnValue(colIndex, value) {
if (this.formaters[colIndex]) {
return this.formaters[colIndex](value);
}
for (let i = 0; i < this.panel.styles.length; i++) {
let style = this.panel.styles[i];
let column = this.table.columns[colIndex];
var regex = kbn.stringToJsRegex(style.pattern);
if (column.text.match(regex)) {
this.formaters[colIndex] = this.createColumnFormater(style);
return this.formaters[colIndex](value);
}
}
this.formaters[colIndex] = this.defaultCellFormater;
return this.formaters[colIndex](value);
}
示例5:
return v => {
if (v === undefined || v === null) {
return '-';
}
if (column.style.textMappings && column.style.colorMode) {
for (let i = 0; i < column.style.textMappings.length; i++) {
let mapping = column.style.textMappings[i];
var regex = kbn.stringToJsRegex(mapping.text);
if (v.match(regex)) {
this.colorState[column.style.colorMode] = this.getColorForValue(mapping.value, column.style);
break;
}
}
}
return this.defaultCellFormatter(v, column.style);
};