@univerjs/sheets-conditional-formatting 0.17.0 → 0.18.0-insiders.20260328-d26c36e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +3 -1
- package/lib/es/facade.js +1 -1909
- package/lib/es/index.js +3 -1999
- package/lib/facade.js +1 -1909
- package/lib/index.js +3 -1999
- package/lib/types/assets/icon-map.d.ts +79 -0
- package/lib/types/base/const.d.ts +16 -1
- package/lib/types/commands/commands/add-cf.command.d.ts +18 -3
- package/lib/types/commands/commands/clear-range-cf.command.d.ts +16 -1
- package/lib/types/commands/commands/clear-worksheet-cf.command.d.ts +16 -1
- package/lib/types/commands/commands/delete-cf.command.d.ts +16 -1
- package/lib/types/commands/commands/move-cf.command.d.ts +17 -2
- package/lib/types/commands/commands/set-cf.command.d.ts +17 -2
- package/lib/types/commands/mutations/add-conditional-rule.mutation.d.ts +18 -3
- package/lib/types/commands/mutations/delete-conditional-rule.mutation.d.ts +16 -1
- package/lib/types/commands/mutations/formula-mark-dirty.mutation.d.ts +16 -1
- package/lib/types/commands/mutations/move-conditional-rule.mutation.d.ts +17 -2
- package/lib/types/commands/mutations/set-conditional-rule.mutation.d.ts +17 -2
- package/lib/types/facade/f-conditional-formatting-builder.d.ts +18 -2
- package/lib/types/facade/f-enum.d.ts +15 -0
- package/lib/types/facade/f-range.d.ts +16 -1
- package/lib/types/facade/f-worksheet.d.ts +16 -1
- package/lib/types/models/calculate-unit-v2/__test__/test.util.d.ts +24 -8
- package/lib/types/models/calculate-unit-v2/base-calculate-unit.d.ts +18 -3
- package/lib/types/models/calculate-unit-v2/color-scale-calculate-unit.d.ts +17 -1
- package/lib/types/models/calculate-unit-v2/data-bar-calculate-unit.d.ts +17 -1
- package/lib/types/models/calculate-unit-v2/highlight-cell-calculate-unit.d.ts +19 -3
- package/lib/types/models/calculate-unit-v2/icon-set-calculate-unit.d.ts +19 -3
- package/lib/types/models/calculate-unit-v2/utils.d.ts +19 -3
- package/lib/types/models/conditional-formatting-rule-model.d.ts +21 -6
- package/lib/types/models/conditional-formatting-view-model.d.ts +16 -1
- package/lib/types/models/type.d.ts +18 -3
- package/lib/types/plugin.d.ts +16 -1
- package/lib/types/render/data-bar.render.d.ts +18 -2
- package/lib/types/render/icon.render.d.ts +18 -2
- package/lib/types/render/type.d.ts +17 -2
- package/lib/types/services/conditional-formatting-formula.service.d.ts +18 -2
- package/lib/types/services/conditional-formatting.service.d.ts +17 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +11 -10
- package/LICENSE +0 -176
- package/lib/types/assets/icon-map.json.d.ts +0 -82
- package/lib/types/models/calculate-unit-v2/__test__/base-calculate.spec.d.ts +0 -16
- package/lib/types/models/calculate-unit-v2/__test__/calculate.color.spec.d.ts +0 -16
- package/lib/types/models/calculate-unit-v2/__test__/calculate.databar.spec.d.ts +0 -16
- package/lib/types/models/calculate-unit-v2/__test__/calculate.highlight.spec.d.ts +0 -16
- package/lib/types/utils/__test__/anchor.spec.d.ts +0 -16
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var f=(l,e,t)=>e in l?c(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t;var m=(l,e,t)=>f(l,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),n=require("@univerjs/sheets-conditional-formatting"),C=require("@univerjs/sheets/facade"),T=require("@univerjs/core/facade");class h{constructor(e={}){m(this,"_rule",{});this._rule=e,this._ensureAttr(this._rule,["rule"])}get _ruleConfig(){return this._rule.rule||null}_getDefaultConfig(e=n.CFRuleType.highlightCell){switch(e){case n.CFRuleType.colorScale:return{type:e,config:[{index:0,color:new o.ColorKit("").toRgbString(),value:{type:n.CFValueType.min}},{index:0,color:new o.ColorKit("green").toRgbString(),value:{type:n.CFValueType.max}}]};case n.CFRuleType.dataBar:return{type:e,isShowValue:!0,config:{min:{type:n.CFValueType.min},max:{type:n.CFValueType.max},positiveColor:new o.ColorKit("green").toRgbString(),nativeColor:new o.ColorKit("").toRgbString(),isGradient:!1}};case n.CFRuleType.highlightCell:return{type:e,subType:n.CFSubRuleType.text,operator:n.CFTextOperator.containsText,value:"abc",style:{}};case n.CFRuleType.iconSet:return{type:e,isShowValue:!0,config:[{operator:n.CFNumberOperator.greaterThanOrEqual,value:{type:n.CFValueType.min},iconType:n.EMPTY_ICON_TYPE,iconId:""},{operator:n.CFNumberOperator.greaterThanOrEqual,value:{type:n.CFValueType.percentile,value:.5},iconType:n.EMPTY_ICON_TYPE,iconId:""},{operator:n.CFNumberOperator.lessThanOrEqual,value:{type:n.CFValueType.max},iconType:n.EMPTY_ICON_TYPE,iconId:""}]}}}_ensureAttr(e,t){return t.reduce((r,u)=>(r[u]||(r[u]={}),r[u]),e),e}build(){var r;this._rule.cfId||(this._rule.cfId=n.createCfId()),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.CFRuleType.highlightCell,this._ensureAttr(this._rule,["rule","style"]));const e=this._getDefaultConfig(this._rule.rule.type);return{...this._rule,rule:{...e,...this._rule.rule}}}copy(){const e=o.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=n.createCfId()),new h(e)}getRanges(){return this._rule.ranges||[]}getIconMap(){return n.iconMap}createCfId(){return n.createCfId()}setRanges(e){return this._rule.ranges=e,this}}class i extends h{constructor(e={}){super(e),this._ensureAttr(this._rule,["rule","style"])}copy(){const e=o.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=n.createCfId()),new i(e)}setAverage(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.average,t.operator=e,this}setUniqueValues(){const e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.uniqueValues,this}setDuplicateValues(){const e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.duplicateValues,this}setRank(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.rank,t.isBottom=e.isBottom,t.isPercent=e.isPercent,t.value=e.value,this}setBackground(e){var t;if(((t=this._ruleConfig)==null?void 0:t.type)===n.CFRuleType.highlightCell)if(e){this._ensureAttr(this._ruleConfig,["style","bg"]);const r=new o.ColorKit(e);this._ruleConfig.style.bg.rgb=r.toRgbString()}else delete this._ruleConfig.style.bg;return this}setBold(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.bl=e?o.BooleanNumber.TRUE:o.BooleanNumber.FALSE),this}setFontColor(e){var t;if(((t=this._ruleConfig)==null?void 0:t.type)===n.CFRuleType.highlightCell)if(e){const r=new o.ColorKit(e);this._ensureAttr(this._ruleConfig,["style","cl"]),this._ruleConfig.style.cl.rgb=r.toRgbString()}else delete this._ruleConfig.style.cl;return this}setItalic(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.it=e?o.BooleanNumber.TRUE:o.BooleanNumber.FALSE),this}setStrikethrough(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","st"]),this._ruleConfig.style.st.s=e?o.BooleanNumber.TRUE:o.BooleanNumber.FALSE),this}setUnderline(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===n.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","ul"]),this._ruleConfig.style.ul.s=e?o.BooleanNumber.TRUE:o.BooleanNumber.FALSE),this}whenCellEmpty(){const e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.text,e.value="",e.operator=n.CFTextOperator.equal,this}whenCellNotEmpty(){const e=this._ruleConfig;return e.type=n.CFRuleType.highlightCell,e.subType=n.CFSubRuleType.text,e.value="",e.operator=n.CFTextOperator.notEqual,this}whenDate(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.timePeriod,t.operator=e,this}whenFormulaSatisfied(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.formula,t.value=e,this}whenNumberBetween(e,t){const r=Math.min(e,t),u=Math.max(e,t),s=this._ruleConfig;return s.type=n.CFRuleType.highlightCell,s.subType=n.CFSubRuleType.number,s.value=[r,u],s.operator=n.CFNumberOperator.between,this}whenNumberEqualTo(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.equal,this}whenNumberGreaterThan(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.greaterThan,this}whenNumberGreaterThanOrEqualTo(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.greaterThanOrEqual,this}whenNumberLessThan(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.lessThan,this}whenNumberLessThanOrEqualTo(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.lessThanOrEqual,this}whenNumberNotBetween(e,t){const r=Math.min(e,t),u=Math.max(e,t),s=this._ruleConfig;return s.type=n.CFRuleType.highlightCell,s.subType=n.CFSubRuleType.number,s.value=[r,u],s.operator=n.CFNumberOperator.notBetween,this}whenNumberNotEqualTo(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.number,t.value=e,t.operator=n.CFNumberOperator.notEqual,this}whenTextContains(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.containsText,this}whenTextDoesNotContain(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.notContainsText,this}whenTextEndsWith(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.endsWith,this}whenTextEqualTo(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.equal,this}whenTextStartsWith(e){const t=this._ruleConfig;return t.type=n.CFRuleType.highlightCell,t.subType=n.CFSubRuleType.text,t.value=e,t.operator=n.CFTextOperator.beginsWith,this}}class g extends h{copy(){const e=o.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=n.createCfId()),new g(e)}setDataBar(e){const t=this._ruleConfig;return t.type=n.CFRuleType.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 h{copy(){const e=o.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=n.createCfId()),new p(e)}setColorScale(e){const t=this._ruleConfig;return t.type=n.CFRuleType.colorScale,t.config=e,this}}class d extends h{copy(){const e=o.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=n.createCfId()),new d(e)}setIconSet(e){const t=this._ruleConfig;return t.type=n.CFRuleType.iconSet,t.config=e.iconConfigs,t.isShowValue=e.isShowValue,this}}class a{constructor(e={}){this._initConfig=e}build(){return new h(this._initConfig).build()}setAverage(e){return new i(this._initConfig).setAverage(e)}setUniqueValues(){return new i(this._initConfig).setUniqueValues()}setDuplicateValues(){return new i(this._initConfig).setDuplicateValues()}setRank(e){return new i(this._initConfig).setRank(e)}getIconMap(){return n.iconMap}setIconSet(e){return new d(this._initConfig).setIconSet(e)}setColorScale(e){return new p(this._initConfig).setColorScale(e)}setDataBar(e){return new g(this._initConfig).setDataBar(e)}setBackground(e){return new i(this._initConfig).setBackground(e)}setBold(e){return new i(this._initConfig).setBold(e)}setFontColor(e){return new i(this._initConfig).setFontColor(e)}setItalic(e){return new i(this._initConfig).setItalic(e)}setStrikethrough(e){return new i(this._initConfig).setStrikethrough(e)}setUnderline(e){return new i(this._initConfig).setUnderline(e)}whenCellEmpty(){return new i(this._initConfig).whenCellEmpty()}whenCellNotEmpty(){return new i(this._initConfig).whenCellNotEmpty()}whenDate(e){return new i(this._initConfig).whenDate(e)}whenFormulaSatisfied(e){return new i(this._initConfig).whenFormulaSatisfied(e)}whenNumberBetween(e,t){return new i(this._initConfig).whenNumberBetween(e,t)}whenNumberEqualTo(e){return new i(this._initConfig).whenNumberEqualTo(e)}whenNumberGreaterThan(e){return new i(this._initConfig).whenNumberGreaterThan(e)}whenNumberGreaterThanOrEqualTo(e){return new i(this._initConfig).whenNumberGreaterThanOrEqualTo(e)}whenNumberLessThan(e){return new i(this._initConfig).whenNumberLessThan(e)}whenNumberLessThanOrEqualTo(e){return new i(this._initConfig).whenNumberLessThanOrEqualTo(e)}whenNumberNotBetween(e,t){return new i(this._initConfig).whenNumberNotBetween(e,t)}whenNumberNotEqualTo(e){return new i(this._initConfig).whenNumberNotEqualTo(e)}whenTextContains(e){return new i(this._initConfig).whenTextContains(e)}whenTextDoesNotContain(e){return new i(this._initConfig).whenTextDoesNotContain(e)}whenTextEndsWith(e){return new i(this._initConfig).whenTextEndsWith(e)}whenTextEqualTo(e){return new i(this._initConfig).whenTextEqualTo(e)}whenTextStartsWith(e){return new i(this._initConfig).whenTextStartsWith(e)}}class y extends C.FRange{_getConditionalFormattingRuleModel(){return this._injector.get(n.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]].filter(t=>t.ranges.some(r=>o.Rectangle.intersects(r,this._range)))}createConditionalFormattingRule(){return new a({ranges:[this._range]})}addConditionalFormattingRule(e){const t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(n.AddCfCommand.id,t),this}deleteConditionalFormattingRule(e){const t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(n.DeleteCfCommand.id,t),this}moveConditionalFormattingRule(e,t,r="after"){const u={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:t,type:r}};return this._commandService.syncExecuteCommand(n.MoveCfCommand.id,u),this}setConditionalFormattingRule(e,t){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:t,cfId:e};return this._commandService.syncExecuteCommand(n.SetCfCommand.id,r),this}clearConditionalFormatRules(){const e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]};return this._commandService.syncExecuteCommand(n.ClearRangeCfCommand.id,e),this}}C.FRange.extend(y);class _ extends C.FWorksheet{_getConditionalFormattingRuleModel(){return this._injector.get(n.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]]}createConditionalFormattingRule(){return new a}newConditionalFormattingRule(){return new a}addConditionalFormattingRule(e){const t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(n.AddCfCommand.id,t),this}deleteConditionalFormattingRule(e){const t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(n.DeleteCfCommand.id,t),this}moveConditionalFormattingRule(e,t,r="after"){const u={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:t,type:r}};return this._commandService.syncExecuteCommand(n.MoveCfCommand.id,u),this}setConditionalFormattingRule(e,t){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e,rule:t};return this._commandService.syncExecuteCommand(n.SetCfCommand.id,r),this}clearConditionalFormatRules(){const e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(n.ClearWorksheetCfCommand.id,e),this}}C.FWorksheet.extend(_);class w{get ConditionFormatNumberOperatorEnum(){return n.CFNumberOperator}get ConditionFormatTimePeriodOperatorEnum(){return n.CFTimePeriodOperator}}T.FEnum.extend(w);exports.FConditionalFormattingBuilder=a;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@univerjs/core`),t=require(`@univerjs/sheets-conditional-formatting`),n=require(`@univerjs/sheets/facade`),r=require(`@univerjs/core/facade`);function i(e){"@babel/helpers - typeof";return i=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i(e)}function a(e,t){if(i(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(i(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o(e){var t=a(e,`string`);return i(t)==`symbol`?t:t+``}function s(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=class n{get _ruleConfig(){return this._rule.rule||null}_getDefaultConfig(n=t.CFRuleType.highlightCell){switch(n){case t.CFRuleType.colorScale:return{type:n,config:[{index:0,color:new e.ColorKit(``).toRgbString(),value:{type:t.CFValueType.min}},{index:0,color:new e.ColorKit(`green`).toRgbString(),value:{type:t.CFValueType.max}}]};case t.CFRuleType.dataBar:return{type:n,isShowValue:!0,config:{min:{type:t.CFValueType.min},max:{type:t.CFValueType.max},positiveColor:new e.ColorKit(`green`).toRgbString(),nativeColor:new e.ColorKit(``).toRgbString(),isGradient:!1}};case t.CFRuleType.highlightCell:return{type:n,subType:t.CFSubRuleType.text,operator:t.CFTextOperator.containsText,value:`abc`,style:{}};case t.CFRuleType.iconSet:return{type:n,isShowValue:!0,config:[{operator:t.CFNumberOperator.greaterThanOrEqual,value:{type:t.CFValueType.min},iconType:t.EMPTY_ICON_TYPE,iconId:``},{operator:t.CFNumberOperator.greaterThanOrEqual,value:{type:t.CFValueType.percentile,value:.5},iconType:t.EMPTY_ICON_TYPE,iconId:``},{operator:t.CFNumberOperator.lessThanOrEqual,value:{type:t.CFValueType.max},iconType:t.EMPTY_ICON_TYPE,iconId:``}]}}}constructor(e={}){s(this,`_rule`,{}),this._rule=e,this._ensureAttr(this._rule,[`rule`])}_ensureAttr(e,t){return t.reduce((e,t)=>(e[t]||(e[t]={}),e[t]),e),e}build(){var e;this._rule.cfId||(this._rule.cfId=(0,t.createCfId)()),this._rule.ranges||(this._rule.ranges=[]),this._rule.stopIfTrue===void 0&&(this._rule.stopIfTrue=!1),(e=this._rule.rule)!=null&&e.type||(this._rule.rule.type=t.CFRuleType.highlightCell,this._ensureAttr(this._rule,[`rule`,`style`]));let n=this._getDefaultConfig(this._rule.rule.type);return{...this._rule,rule:{...n,...this._rule.rule}}}copy(){let r=e.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,t.createCfId)()),new n(r)}getRanges(){return this._rule.ranges||[]}getIconMap(){return t.iconMap}createCfId(){return(0,t.createCfId)()}setRanges(e){return this._rule.ranges=e,this}},l=class n extends c{constructor(e={}){super(e),this._ensureAttr(this._rule,[`rule`,`style`])}copy(){let r=e.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,t.createCfId)()),new n(r)}setAverage(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.average,n.operator=e,this}setUniqueValues(){let e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.uniqueValues,this}setDuplicateValues(){let e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.duplicateValues,this}setRank(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.rank,n.isBottom=e.isBottom,n.isPercent=e.isPercent,n.value=e.value,this}setBackground(n){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell)if(n){this._ensureAttr(this._ruleConfig,[`style`,`bg`]);let t=new e.ColorKit(n);this._ruleConfig.style.bg.rgb=t.toRgbString()}else delete this._ruleConfig.style.bg;return this}setBold(n){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`]),this._ruleConfig.style.bl=n?e.BooleanNumber.TRUE:e.BooleanNumber.FALSE),this}setFontColor(n){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell)if(n){let t=new e.ColorKit(n);this._ensureAttr(this._ruleConfig,[`style`,`cl`]),this._ruleConfig.style.cl.rgb=t.toRgbString()}else delete this._ruleConfig.style.cl;return this}setItalic(n){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`]),this._ruleConfig.style.it=n?e.BooleanNumber.TRUE:e.BooleanNumber.FALSE),this}setStrikethrough(n){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`,`st`]),this._ruleConfig.style.st.s=n?e.BooleanNumber.TRUE:e.BooleanNumber.FALSE),this}setUnderline(n){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`,`ul`]),this._ruleConfig.style.ul.s=n?e.BooleanNumber.TRUE:e.BooleanNumber.FALSE),this}whenCellEmpty(){let e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.text,e.value=``,e.operator=t.CFTextOperator.equal,this}whenCellNotEmpty(){let e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.text,e.value=``,e.operator=t.CFTextOperator.notEqual,this}whenDate(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.timePeriod,n.operator=e,this}whenFormulaSatisfied(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.formula,n.value=e,this}whenNumberBetween(e,n){let r=Math.min(e,n),i=Math.max(e,n),a=this._ruleConfig;return a.type=t.CFRuleType.highlightCell,a.subType=t.CFSubRuleType.number,a.value=[r,i],a.operator=t.CFNumberOperator.between,this}whenNumberEqualTo(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.number,n.value=e,n.operator=t.CFNumberOperator.equal,this}whenNumberGreaterThan(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.number,n.value=e,n.operator=t.CFNumberOperator.greaterThan,this}whenNumberGreaterThanOrEqualTo(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.number,n.value=e,n.operator=t.CFNumberOperator.greaterThanOrEqual,this}whenNumberLessThan(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.number,n.value=e,n.operator=t.CFNumberOperator.lessThan,this}whenNumberLessThanOrEqualTo(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.number,n.value=e,n.operator=t.CFNumberOperator.lessThanOrEqual,this}whenNumberNotBetween(e,n){let r=Math.min(e,n),i=Math.max(e,n),a=this._ruleConfig;return a.type=t.CFRuleType.highlightCell,a.subType=t.CFSubRuleType.number,a.value=[r,i],a.operator=t.CFNumberOperator.notBetween,this}whenNumberNotEqualTo(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.number,n.value=e,n.operator=t.CFNumberOperator.notEqual,this}whenTextContains(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.text,n.value=e,n.operator=t.CFTextOperator.containsText,this}whenTextDoesNotContain(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.text,n.value=e,n.operator=t.CFTextOperator.notContainsText,this}whenTextEndsWith(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.text,n.value=e,n.operator=t.CFTextOperator.endsWith,this}whenTextEqualTo(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.text,n.value=e,n.operator=t.CFTextOperator.equal,this}whenTextStartsWith(e){let n=this._ruleConfig;return n.type=t.CFRuleType.highlightCell,n.subType=t.CFSubRuleType.text,n.value=e,n.operator=t.CFTextOperator.beginsWith,this}},u=class n extends c{copy(){let r=e.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,t.createCfId)()),new n(r)}setDataBar(e){let n=this._ruleConfig;return n.type=t.CFRuleType.dataBar,n.isShowValue=!!e.isShowValue,n.config={min:e.min,max:e.max,positiveColor:e.positiveColor,nativeColor:e.nativeColor,isGradient:!!e.isGradient},this}},d=class n extends c{copy(){let r=e.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,t.createCfId)()),new n(r)}setColorScale(e){let n=this._ruleConfig;return n.type=t.CFRuleType.colorScale,n.config=e,this}},f=class n extends c{copy(){let r=e.Tools.deepClone(this._rule);return r.cfId&&(r.cfId=(0,t.createCfId)()),new n(r)}setIconSet(e){let n=this._ruleConfig;return n.type=t.CFRuleType.iconSet,n.config=e.iconConfigs,n.isShowValue=e.isShowValue,this}},p=class{constructor(e={}){this._initConfig=e}build(){return new c(this._initConfig).build()}setAverage(e){return new l(this._initConfig).setAverage(e)}setUniqueValues(){return new l(this._initConfig).setUniqueValues()}setDuplicateValues(){return new l(this._initConfig).setDuplicateValues()}setRank(e){return new l(this._initConfig).setRank(e)}getIconMap(){return t.iconMap}setIconSet(e){return new f(this._initConfig).setIconSet(e)}setColorScale(e){return new d(this._initConfig).setColorScale(e)}setDataBar(e){return new u(this._initConfig).setDataBar(e)}setBackground(e){return new l(this._initConfig).setBackground(e)}setBold(e){return new l(this._initConfig).setBold(e)}setFontColor(e){return new l(this._initConfig).setFontColor(e)}setItalic(e){return new l(this._initConfig).setItalic(e)}setStrikethrough(e){return new l(this._initConfig).setStrikethrough(e)}setUnderline(e){return new l(this._initConfig).setUnderline(e)}whenCellEmpty(){return new l(this._initConfig).whenCellEmpty()}whenCellNotEmpty(){return new l(this._initConfig).whenCellNotEmpty()}whenDate(e){return new l(this._initConfig).whenDate(e)}whenFormulaSatisfied(e){return new l(this._initConfig).whenFormulaSatisfied(e)}whenNumberBetween(e,t){return new l(this._initConfig).whenNumberBetween(e,t)}whenNumberEqualTo(e){return new l(this._initConfig).whenNumberEqualTo(e)}whenNumberGreaterThan(e){return new l(this._initConfig).whenNumberGreaterThan(e)}whenNumberGreaterThanOrEqualTo(e){return new l(this._initConfig).whenNumberGreaterThanOrEqualTo(e)}whenNumberLessThan(e){return new l(this._initConfig).whenNumberLessThan(e)}whenNumberLessThanOrEqualTo(e){return new l(this._initConfig).whenNumberLessThanOrEqualTo(e)}whenNumberNotBetween(e,t){return new l(this._initConfig).whenNumberNotBetween(e,t)}whenNumberNotEqualTo(e){return new l(this._initConfig).whenNumberNotEqualTo(e)}whenTextContains(e){return new l(this._initConfig).whenTextContains(e)}whenTextDoesNotContain(e){return new l(this._initConfig).whenTextDoesNotContain(e)}whenTextEndsWith(e){return new l(this._initConfig).whenTextEndsWith(e)}whenTextEqualTo(e){return new l(this._initConfig).whenTextEqualTo(e)}whenTextStartsWith(e){return new l(this._initConfig).whenTextStartsWith(e)}},m=class extends n.FRange{_getConditionalFormattingRuleModel(){return this._injector.get(t.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]].filter(t=>t.ranges.some(t=>e.Rectangle.intersects(t,this._range)))}createConditionalFormattingRule(){return new p({ranges:[this._range]})}addConditionalFormattingRule(e){let n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(t.AddCfCommand.id,n),this}deleteConditionalFormattingRule(e){let n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(t.DeleteCfCommand.id,n),this}moveConditionalFormattingRule(e,n,r=`after`){let i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:`self`},end:{id:n,type:r}};return this._commandService.syncExecuteCommand(t.MoveCfCommand.id,i),this}setConditionalFormattingRule(e,n){let r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:n,cfId:e};return this._commandService.syncExecuteCommand(t.SetCfCommand.id,r),this}clearConditionalFormatRules(){let e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]};return this._commandService.syncExecuteCommand(t.ClearRangeCfCommand.id,e),this}};n.FRange.extend(m);var h=class extends n.FWorksheet{_getConditionalFormattingRuleModel(){return this._injector.get(t.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]]}createConditionalFormattingRule(){return new p}newConditionalFormattingRule(){return new p}addConditionalFormattingRule(e){let n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(t.AddCfCommand.id,n),this}deleteConditionalFormattingRule(e){let n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(t.DeleteCfCommand.id,n),this}moveConditionalFormattingRule(e,n,r=`after`){let i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:`self`},end:{id:n,type:r}};return this._commandService.syncExecuteCommand(t.MoveCfCommand.id,i),this}setConditionalFormattingRule(e,n){let r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e,rule:n};return this._commandService.syncExecuteCommand(t.SetCfCommand.id,r),this}clearConditionalFormatRules(){let e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(t.ClearWorksheetCfCommand.id,e),this}};n.FWorksheet.extend(h);var g=class{get ConditionFormatNumberOperatorEnum(){return t.CFNumberOperator}get ConditionFormatTimePeriodOperatorEnum(){return t.CFTimePeriodOperator}};r.FEnum.extend(g),exports.FConditionalFormattingBuilder=p;
|