| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827 |
- var N = Object.defineProperty;
- var q = (u, e, t) => e in u ? N(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
- var b = (u, e, t) => q(u, typeof e != "symbol" ? e + "" : e, t);
- import { ColorKit as c, Tools as _, BooleanNumber as a, Rectangle as U, ColorBuilder as B } from "@univerjs/core";
- import { CFRuleType as n, CFNumberOperator as l, CFValueType as C, EMPTY_ICON_TYPE as f, CFSubRuleType as o, CFTextOperator as g, createCfId as T, iconMap as M, ConditionalFormattingRuleModel as x, AddConditionalRuleMutation as S, DeleteConditionalRuleMutation as I, MoveConditionalRuleMutation as E, SetConditionalRuleMutation as k } from "@univerjs/sheets-conditional-formatting";
- import { FRange as v, FWorkbook as F, FWorksheet as R } from "@univerjs/sheets/facade";
- class d {
- constructor(e = {}) {
- b(this, "_rule", {});
- this._rule = e, this._ensureAttr(this._rule, ["rule"]);
- }
- get _ruleConfig() {
- return this._rule.rule || null;
- }
- _getDefaultConfig(e = n.highlightCell) {
- switch (e) {
- case n.colorScale:
- return {
- type: e,
- config: [
- { index: 0, color: new c("").toRgbString(), value: { type: C.min } },
- { index: 0, color: new c("green").toRgbString(), value: { type: C.max } }
- ]
- };
- case n.dataBar:
- return {
- type: e,
- isShowValue: !0,
- config: { min: { type: C.min }, max: { type: C.max }, positiveColor: new c("green").toRgbString(), nativeColor: new c("").toRgbString(), isGradient: !1 }
- };
- case n.highlightCell:
- return {
- type: e,
- subType: o.text,
- operator: g.containsText,
- value: "abc",
- style: {}
- };
- case n.iconSet:
- return {
- type: e,
- isShowValue: !0,
- config: [
- {
- operator: l.greaterThanOrEqual,
- value: { type: C.min },
- iconType: f,
- iconId: ""
- },
- {
- operator: l.greaterThanOrEqual,
- value: { type: C.percentile, value: 0.5 },
- iconType: f,
- iconId: ""
- },
- {
- operator: l.lessThanOrEqual,
- value: { type: C.max },
- iconType: f,
- iconId: ""
- }
- ]
- };
- }
- }
- // eslint-disable-next-line ts/no-explicit-any
- _ensureAttr(e, t) {
- return t.reduce((r, s) => (r[s] || (r[s] = {}), r[s]), e), e;
- }
- build() {
- var r;
- this._rule.cfId || (this._rule.cfId = T()), this._rule.ranges || (this._rule.ranges = []), this._rule.stopIfTrue === void 0 && (this._rule.stopIfTrue = !1), (r = this._rule.rule) != null && r.type || (this._rule.rule.type = n.highlightCell, this._ensureAttr(this._rule, ["rule", "style"]));
- const e = this._getDefaultConfig(this._rule.rule.type);
- return { ...this._rule, rule: { ...e, ...this._rule.rule } };
- }
- /**
- * Deep clone a current builder.
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- copy() {
- return new d(_.deepClone(this._rule));
- }
- /**
- * Gets the scope of the current conditional format
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- getRanges() {
- return this._rule.ranges || [];
- }
- /**
- * Get the icon set mapping dictionary
- */
- getIconMap() {
- return M;
- }
- /**
- * Create a conditional format ID.
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- createCfId() {
- return T();
- }
- /**
- * Sets the scope for conditional formatting
- * @param {IRange[]} ranges
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setRanges(e) {
- return this._rule.ranges = e, this;
- }
- }
- class i extends d {
- constructor(e = {}) {
- super(e), this._ensureAttr(this._rule, ["rule", "style"]);
- }
- copy() {
- return new i(_.deepClone(this._rule));
- }
- /**
- * Set average rule
- * @param {IAverageHighlightCell['operator']} operator
- * @memberof ConditionalFormatHighlightRuleBuilder
- */
- setAverage(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.average, t.operator = e, this;
- }
- /**
- * Set uniqueValues rule
- * @memberof ConditionalFormatHighlightRuleBuilder
- */
- setUniqueValues() {
- const e = this._ruleConfig;
- return e.type = n.highlightCell, e.subType = o.uniqueValues, this;
- }
- /**
- * Set duplicateValues rule
- * @memberof ConditionalFormatHighlightRuleBuilder
- */
- setDuplicateValues() {
- const e = this._ruleConfig;
- return e.type = n.highlightCell, e.subType = o.duplicateValues, this;
- }
- /**
- * Set rank rule
- * @param {{ isBottom: boolean, isPercent: boolean, value: number }} config
- * @param config.isBottom
- * @param config.isPercent
- * @param config.value
- * @memberof ConditionalFormatHighlightRuleBuilder
- */
- setRank(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.rank, t.isBottom = e.isBottom, t.isPercent = e.isPercent, t.value = e.value, this;
- }
- /**
- * Sets the background color
- * @param {string} [color]
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setBackground(e) {
- var t;
- if (((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell)
- if (e) {
- this._ensureAttr(this._ruleConfig, ["style", "bg"]);
- const r = new c(e);
- this._ruleConfig.style.bg.rgb = r.toRgbString();
- } else
- delete this._ruleConfig.style.bg;
- return this;
- }
- /**
- * Set Bold
- * @param {boolean} isBold
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setBold(e) {
- var t;
- return ((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell && (this._ensureAttr(this._ruleConfig, ["style"]), this._ruleConfig.style.bl = e ? a.TRUE : a.FALSE), this;
- }
- /**
- * Sets the font color
- * @param {string} [color]
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setFontColor(e) {
- var t;
- if (((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell)
- if (e) {
- const r = new c(e);
- this._ensureAttr(this._ruleConfig, ["style", "cl"]), this._ruleConfig.style.cl.rgb = r.toRgbString();
- } else
- delete this._ruleConfig.style.cl;
- return this;
- }
- /**
- * Set the text to italic
- * @param {boolean} isItalic
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setItalic(e) {
- var t;
- return ((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell && (this._ensureAttr(this._ruleConfig, ["style"]), this._ruleConfig.style.it = e ? a.TRUE : a.FALSE), this;
- }
- /**
- * Set the strikethrough
- * @param {boolean} isStrikethrough
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setStrikethrough(e) {
- var t;
- return ((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell && (this._ensureAttr(this._ruleConfig, ["style", "st"]), this._ruleConfig.style.st.s = e ? a.TRUE : a.FALSE), this;
- }
- /**
- * Set the underscore
- * @param {boolean} isUnderline
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setUnderline(e) {
- var t;
- return ((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell && (this._ensureAttr(this._ruleConfig, ["style", "ul"]), this._ruleConfig.style.ul.s = e ? a.TRUE : a.FALSE), this;
- }
- /**
- * Sets the conditional formatting rule to fire when the cell is empty.
- */
- whenCellEmpty() {
- const e = this._ruleConfig;
- return e.type = n.highlightCell, e.subType = o.text, e.value = "", e.operator = g.equal, this;
- }
- /**
- * Sets the conditional formatting rule to fire when the cell is not empty
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- whenCellNotEmpty() {
- const e = this._ruleConfig;
- return e.type = n.highlightCell, e.subType = o.text, e.value = "", e.operator = g.notEqual, this;
- }
- /**
- * Highlight when the date is in a time period, custom time is not supported.
- * @param {CFTimePeriodOperator} date
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- whenDate(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.timePeriod, t.operator = e, this;
- }
- /**
- * Sets a conditional formatting rule to fire when a given formula evaluates to true.
- * @param {string} formulaString formulaString start with' = '
- * @memberof ConditionalFormatRuleBuilder
- */
- whenFormulaSatisfied(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.formula, t.value = e, this;
- }
- /**
- * Sets the conditional formatting rule to fire when a number is between two specified values or equal to one of them.
- * @param {number} start
- * @param {number} end
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberBetween(e, t) {
- const r = Math.min(e, t), s = Math.max(e, t), h = this._ruleConfig;
- return h.type = n.highlightCell, h.subType = o.number, h.value = [r, s], h.operator = l.between, this;
- }
- /**
- * Sets the conditional formatting rule to fire when the number equals the given value
- * @param {number} value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberEqualTo(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.equal, this;
- }
- /**
- * Sets the conditional formatting rule to fire when the number is greater than the given value
- * @param {number} value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberGreaterThan(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.greaterThan, this;
- }
- /**
- * Sets a conditional formatting rule to fire when a number is greater than or equal to a given value.
- * @param {number} value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberGreaterThanOrEqualTo(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.greaterThanOrEqual, this;
- }
- /**
- * Sets a conditional formatting rule to fire when the number is less than the given value.
- * @param {number} value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberLessThan(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.lessThan, this;
- }
- /**
- * Sets the conditional formatting rule to fire when the value is less than or equal to the given value.
- * @param {number} value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberLessThanOrEqualTo(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.lessThanOrEqual, this;
- }
- /**
- * Sets a conditional formatting rule to fire when a number is not between two specified values and is not equal to them.
- * @param {number} start
- * @param {number} end
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberNotBetween(e, t) {
- const r = Math.min(e, t), s = Math.max(e, t), h = this._ruleConfig;
- return h.type = n.highlightCell, h.subType = o.number, h.value = [r, s], h.operator = l.notBetween, this;
- }
- /**
- * Sets the conditional formatting rule to fire when a number does not equal a given value.
- * @param value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberNotEqualTo(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.notEqual, this;
- }
- /**
- * Sets the conditional formatting rule to fire when the input contains the given value.
- * @param {string} text
- * @memberof ConditionalFormatRuleBuilder
- */
- whenTextContains(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.text, t.value = e, t.operator = g.containsText, this;
- }
- /**
- * Sets a conditional formatting rule to fire when the input does not contain the given value.
- * @param {string} text
- * @memberof ConditionalFormatRuleBuilder
- */
- whenTextDoesNotContain(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.text, t.value = e, t.operator = g.notContainsText, this;
- }
- /**
- * Sets a conditional formatting rule to fire when input ends with a specified value.
- * @param {string} text
- * @memberof ConditionalFormatRuleBuilder
- */
- whenTextEndsWith(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.text, t.value = e, t.operator = g.endsWith, this;
- }
- /**
- * Sets the conditional formatting rule to fire when the input equals the given value.
- * @param {string} text
- * @memberof ConditionalFormatRuleBuilder
- */
- whenTextEqualTo(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.text, t.value = e, t.operator = g.equal, this;
- }
- /**
- * Sets the conditional formatting rule to fire when the input value begins with the given value.
- * @param {string} text
- * @memberof ConditionalFormatRuleBuilder
- */
- whenTextStartsWith(e) {
- const t = this._ruleConfig;
- return t.type = n.highlightCell, t.subType = o.text, t.value = e, t.operator = g.beginsWith, this;
- }
- }
- class w extends d {
- copy() {
- return new w(_.deepClone(this._rule));
- }
- /**
- * Data bar settings
- * @param {{
- * min: IValueConfig;
- * max: IValueConfig;
- * isGradient?: boolean;
- * positiveColor: string;
- * nativeColor: string;
- * isShowValue?: boolean;
- * }} config
- * @param config.min
- * @param config.max
- * @param config.isGradient
- * @param config.positiveColor
- * @param config.nativeColor
- * @param config.isShowValue
- * @memberof ConditionalFormatRuleBuilder
- */
- setDataBar(e) {
- const t = this._ruleConfig;
- return t.type = n.dataBar, t.isShowValue = !!e.isShowValue, t.config = {
- min: e.min,
- max: e.max,
- positiveColor: e.positiveColor,
- nativeColor: e.nativeColor,
- isGradient: !!e.isGradient
- }, this;
- }
- }
- class p extends d {
- copy() {
- return new p(_.deepClone(this._rule));
- }
- /**
- * Color scale set
- * @param {{ index: number; color: string; value: IValueConfig }[]} config
- * @memberof ConditionalFormatRuleBuilder
- */
- setColorScale(e) {
- const t = this._ruleConfig;
- return t.type = n.colorScale, t.config = e, this;
- }
- }
- class y extends d {
- copy() {
- return new y(_.deepClone(this._rule));
- }
- /**
- *
- * Icon Set
- * @param {{ iconConfigs: IIconSet['config'], isShowValue: boolean }} config
- * @param config.iconConfigs
- * @param config.isShowValue
- * @memberof ConditionalFormatRuleBuilder
- */
- setIconSet(e) {
- const t = this._ruleConfig;
- return t.type = n.iconSet, t.config = e.iconConfigs, t.isShowValue = e.isShowValue, this;
- }
- }
- class m {
- constructor(e = {}) {
- this._initConfig = e;
- }
- build() {
- return new d(this._initConfig).build();
- }
- /**
- * Set average rule
- * @param {IAverageHighlightCell['operator']} operator
- * @memberof ConditionalFormatHighlightRuleBuilder
- */
- setAverage(e) {
- return new i(this._initConfig).setAverage(e);
- }
- /**
- * Set uniqueValues rule
- * @memberof ConditionalFormatHighlightRuleBuilder
- */
- setUniqueValues() {
- return new i(this._initConfig).setUniqueValues();
- }
- /**
- * Set duplicateValues rule
- * @memberof ConditionalFormatHighlightRuleBuilder
- */
- setDuplicateValues() {
- return new i(this._initConfig).setDuplicateValues();
- }
- /**
- * Set rank rule
- * @param {{ isBottom: boolean, isPercent: boolean, value: number }} config
- * @param config.isBottom
- * @param config.isPercent
- * @param config.value
- * @memberof ConditionalFormatHighlightRuleBuilder
- */
- setRank(e) {
- return new i(this._initConfig).setRank(e);
- }
- /**
- *
- * Set iconSet rule
- * @param {{ iconConfigs: IIconSet['config'], isShowValue: boolean }} config
- * @param config.iconConfigs
- * @param config.isShowValue
- * @memberof ConditionalFormatRuleBuilder
- */
- setIconSet(e) {
- return new y(this._initConfig).setIconSet(e);
- }
- /**
- * Set colorScale rule
- * @param {{ index: number; color: string; value: IValueConfig }[]} config
- * @memberof ConditionalFormatRuleBuilder
- */
- setColorScale(e) {
- return new p(this._initConfig).setColorScale(e);
- }
- /**
- * Set dataBar rule
- * @param {{
- * min: IValueConfig;
- * max: IValueConfig;
- * isGradient?: boolean;
- * positiveColor: string;
- * nativeColor: string;
- * isShowValue?: boolean;
- * }} config
- * @param config.min
- * @param config.max
- * @param config.isGradient
- * @param config.positiveColor
- * @param config.nativeColor
- * @param config.isShowValue
- * @memberof ConditionalFormatRuleBuilder
- */
- setDataBar(e) {
- return new w(this._initConfig).setDataBar(e);
- }
- /**
- * Sets the background color
- * @param {string} [color]
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setBackground(e) {
- return new i(this._initConfig).setBackground(e);
- }
- /**
- * Set Bold
- * @param {boolean} isBold
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setBold(e) {
- return new i(this._initConfig).setBold(e);
- }
- /**
- * Sets the font color
- * @param {string} [color]
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setFontColor(e) {
- return new i(this._initConfig).setFontColor(e);
- }
- /**
- * Set the text to italic
- * @param {boolean} isItalic
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setItalic(e) {
- return new i(this._initConfig).setItalic(e);
- }
- /**
- * Set the strikethrough
- * @param {boolean} isStrikethrough
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setStrikethrough(e) {
- return new i(this._initConfig).setStrikethrough(e);
- }
- /**
- * Set the underscore
- * @param {boolean} isUnderline
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- setUnderline(e) {
- return new i(this._initConfig).setUnderline(e);
- }
- /**
- * Sets the conditional formatting rule to fire when the cell is empty.
- */
- whenCellEmpty() {
- return new i(this._initConfig).whenCellEmpty();
- }
- /**
- * Sets the conditional formatting rule to fire when the cell is not empty
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- whenCellNotEmpty() {
- return new i(this._initConfig).whenCellNotEmpty();
- }
- /**
- * Highlight when the date is in a time period, custom time is not supported.
- * @param {CFTimePeriodOperator} date
- * @returns {*}
- * @memberof ConditionalFormatRuleBuilder
- */
- whenDate(e) {
- return new i(this._initConfig).whenDate(e);
- }
- /**
- * Sets a conditional formatting rule to fire when a given formula evaluates to true.
- * @param {string} formulaString formulaString start with' = '
- * @memberof ConditionalFormatRuleBuilder
- */
- whenFormulaSatisfied(e) {
- return new i(this._initConfig).whenFormulaSatisfied(e);
- }
- /**
- * Sets the conditional formatting rule to fire when a number is between two specified values or equal to one of them.
- * @param {number} start
- * @param {number} end
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberBetween(e, t) {
- return new i(this._initConfig).whenNumberBetween(e, t);
- }
- /**
- * Sets the conditional formatting rule to fire when the number equals the given value
- * @param {number} value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberEqualTo(e) {
- return new i(this._initConfig).whenNumberEqualTo(e);
- }
- /**
- * Sets the conditional formatting rule to fire when the number is greater than the given value
- * @param {number} value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberGreaterThan(e) {
- return new i(this._initConfig).whenNumberGreaterThan(e);
- }
- /**
- * Sets a conditional formatting rule to fire when a number is greater than or equal to a given value.
- * @param {number} value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberGreaterThanOrEqualTo(e) {
- return new i(this._initConfig).whenNumberGreaterThanOrEqualTo(e);
- }
- /**
- * Sets a conditional formatting rule to fire when the number is less than the given value.
- * @param {number} value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberLessThan(e) {
- return new i(this._initConfig).whenNumberLessThan(e);
- }
- /**
- * Sets the conditional formatting rule to fire when the value is less than or equal to the given value.
- * @param {number} value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberLessThanOrEqualTo(e) {
- return new i(this._initConfig).whenNumberLessThanOrEqualTo(e);
- }
- /**
- * Sets a conditional formatting rule to fire when a number is not between two specified values and is not equal to them.
- * @param {number} start
- * @param {number} end
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberNotBetween(e, t) {
- return new i(this._initConfig).whenNumberNotBetween(e, t);
- }
- /**
- * Sets the conditional formatting rule to fire when a number does not equal a given value.
- * @param value
- * @memberof ConditionalFormatRuleBuilder
- */
- whenNumberNotEqualTo(e) {
- return new i(this._initConfig).whenNumberNotEqualTo(e);
- }
- /**
- * Sets the conditional formatting rule to fire when the input contains the given value.
- * @param {string} text
- * @memberof ConditionalFormatRuleBuilder
- */
- whenTextContains(e) {
- return new i(this._initConfig).whenTextContains(e);
- }
- /**
- * Sets a conditional formatting rule to fire when the input does not contain the given value.
- * @param {string} text
- * @memberof ConditionalFormatRuleBuilder
- */
- whenTextDoesNotContain(e) {
- return new i(this._initConfig).whenTextDoesNotContain(e);
- }
- /**
- * Sets a conditional formatting rule to fire when input ends with a specified value.
- * @param {string} text
- * @memberof ConditionalFormatRuleBuilder
- */
- whenTextEndsWith(e) {
- return new i(this._initConfig).whenTextEndsWith(e);
- }
- /**
- * Sets the conditional formatting rule to fire when the input equals the given value.
- * @param {string} text
- * @memberof ConditionalFormatRuleBuilder
- */
- whenTextEqualTo(e) {
- return new i(this._initConfig).whenTextEqualTo(e);
- }
- /**
- * Sets the conditional formatting rule to fire when the input value begins with the given value.
- * @param {string} text
- * @memberof ConditionalFormatRuleBuilder
- */
- whenTextStartsWith(e) {
- return new i(this._initConfig).whenTextStartsWith(e);
- }
- }
- class A extends v {
- _getConditionalFormattingRuleModel() {
- return this._injector.get(x);
- }
- getConditionalFormattingRules() {
- return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []].filter((t) => t.ranges.some((r) => U.intersects(r, this._range)));
- }
- createConditionalFormattingRule() {
- return new m({ ranges: [this._range] });
- }
- addConditionalFormattingRule(e) {
- const t = {
- rule: e,
- unitId: this._workbook.getUnitId(),
- subUnitId: this._worksheet.getSheetId()
- };
- return this._commandService.syncExecuteCommand(S.id, t), this;
- }
- deleteConditionalFormattingRule(e) {
- const t = {
- unitId: this._workbook.getUnitId(),
- subUnitId: this._worksheet.getSheetId(),
- cfId: e
- };
- return this._commandService.syncExecuteCommand(I.id, t), this;
- }
- moveConditionalFormattingRule(e, t, r = "after") {
- const s = {
- unitId: this._workbook.getUnitId(),
- subUnitId: this._worksheet.getSheetId(),
- start: { id: e, type: "self" },
- end: { id: t, type: r }
- };
- return this._commandService.syncExecuteCommand(E.id, s), this;
- }
- setConditionalFormattingRule(e, t) {
- const r = {
- unitId: this._workbook.getUnitId(),
- subUnitId: this._worksheet.getSheetId(),
- rule: t,
- cfId: e
- };
- return this._commandService.syncExecuteCommand(k.id, r), this;
- }
- }
- v.extend(A);
- class D extends F {
- newColor() {
- return new B();
- }
- }
- F.extend(D);
- class V extends R {
- _getConditionalFormattingRuleModel() {
- return this._injector.get(x);
- }
- getConditionalFormattingRules() {
- return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []];
- }
- createConditionalFormattingRule() {
- return new m();
- }
- newConditionalFormattingRule() {
- return new m();
- }
- addConditionalFormattingRule(e) {
- const t = {
- rule: e,
- unitId: this._workbook.getUnitId(),
- subUnitId: this._worksheet.getSheetId()
- };
- return this._commandService.syncExecuteCommand(S.id, t), this;
- }
- deleteConditionalFormattingRule(e) {
- const t = {
- unitId: this._workbook.getUnitId(),
- subUnitId: this._worksheet.getSheetId(),
- cfId: e
- };
- return this._commandService.syncExecuteCommand(I.id, t), this;
- }
- moveConditionalFormattingRule(e, t, r = "after") {
- const s = {
- unitId: this._workbook.getUnitId(),
- subUnitId: this._worksheet.getSheetId(),
- start: { id: e, type: "self" },
- end: { id: t, type: r }
- };
- return this._commandService.syncExecuteCommand(E.id, s), this;
- }
- setConditionalFormattingRule(e, t) {
- const r = {
- unitId: this._workbook.getUnitId(),
- subUnitId: this._worksheet.getSheetId(),
- rule: t,
- cfId: e
- };
- return this._commandService.syncExecuteCommand(k.id, r), this;
- }
- }
- R.extend(V);
- export {
- m as FConditionalFormattingBuilder
- };
|