fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

34 lines
1019 B

/**
* guy
*/
import { Behavior } from "./0.behavior";
import { isFunction, each } from "../2.base";
import { Single } from "@/base/single/0.single";
export class HighlightBehavior extends Behavior {
doBehavior(items) {
const args = Array.prototype.slice.call(arguments, 1),
{ rule } = this.options;
each(items, (i, item) => {
if (item instanceof Single) {
const rules = rule(item.getValue(), item);
function doBe (run) {
if (run === true) {
item.doHighLight && item.doHighLight(...args);
} else {
item.unHighLight && item.unHighLight(...args);
}
}
if (isFunction(rules)) {
rules(doBe);
} else {
doBe(rules);
}
} else {
item.doBehavior && item.doBehavior(...args);
}
});
}
}