@univerjs/sheets-conditional-formatting-ui 1.0.0-alpha.7 → 1.0.0-beta.0

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/index.js CHANGED
@@ -6,8 +6,8 @@ let _univerjs_ui = require("@univerjs/ui");
6
6
  let _univerjs_sheets_ui = require("@univerjs/sheets-ui");
7
7
  let rxjs = require("rxjs");
8
8
  let rxjs_operators = require("rxjs/operators");
9
- let _univerjs_sheets_formula = require("@univerjs/sheets-formula");
10
9
  let _univerjs_engine_render = require("@univerjs/engine-render");
10
+ let _univerjs_sheets_formula = require("@univerjs/sheets-formula");
11
11
  let _univerjs_icons = require("@univerjs/icons");
12
12
  let react = require("react");
13
13
  let _univerjs_design = require("@univerjs/design");
@@ -82,10 +82,9 @@ const AddDataBarConditionalRuleCommand = {
82
82
  type: _univerjs_core.CommandType.COMMAND,
83
83
  id: "sheet.command.add-data-bar-conditional-rule",
84
84
  handler(accessor, params) {
85
- var _params$ranges;
86
85
  if (!params) return false;
87
86
  const { min, max, nativeColor, positiveColor, isGradient, stopIfTrue, isShowValue } = params;
88
- const ranges = (_params$ranges = params.ranges) !== null && _params$ranges !== void 0 ? _params$ranges : accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentSelections().map((selection) => selection.range);
87
+ const ranges = params.ranges ?? accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentSelections().map((selection) => selection.range);
89
88
  if (!ranges.length) return false;
90
89
  const conditionalFormattingRuleModel = accessor.get(_univerjs_sheets_conditional_formatting.ConditionalFormattingRuleModel);
91
90
  const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService));
@@ -153,9 +152,8 @@ const AddIconSetConditionalRuleCommand = {
153
152
  type: _univerjs_core.CommandType.COMMAND,
154
153
  id: "sheet.command.add-icon-set-conditional-rule",
155
154
  handler(accessor, params) {
156
- var _params$ranges;
157
155
  if (!params) return false;
158
- const ranges = (_params$ranges = params.ranges) !== null && _params$ranges !== void 0 ? _params$ranges : accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentSelections().map((selection) => selection.range);
156
+ const ranges = params.ranges ?? accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentSelections().map((selection) => selection.range);
159
157
  if (!ranges.length) return false;
160
158
  const target = (0, _univerjs_sheets.getSheetCommandTarget)(accessor.get(_univerjs_core.IUniverInstanceService));
161
159
  if (!target) return false;
@@ -366,7 +364,7 @@ const AddUniqueValuesCfCommand = {
366
364
  };
367
365
 
368
366
  //#endregion
369
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
367
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
370
368
  function _typeof(o) {
371
369
  "@babel/helpers - typeof";
372
370
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -377,7 +375,7 @@ function _typeof(o) {
377
375
  }
378
376
 
379
377
  //#endregion
380
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
378
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
381
379
  function toPrimitive(t, r) {
382
380
  if ("object" != _typeof(t) || !t) return t;
383
381
  var e = t[Symbol.toPrimitive];
@@ -390,14 +388,14 @@ function toPrimitive(t, r) {
390
388
  }
391
389
 
392
390
  //#endregion
393
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
391
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
394
392
  function toPropertyKey(t) {
395
393
  var i = toPrimitive(t, "string");
396
394
  return "symbol" == _typeof(i) ? i : i + "";
397
395
  }
398
396
 
399
397
  //#endregion
400
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
398
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
401
399
  function _defineProperty(e, r, t) {
402
400
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
403
401
  value: t,
@@ -408,7 +406,7 @@ function _defineProperty(e, r, t) {
408
406
  }
409
407
 
410
408
  //#endregion
411
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
409
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
412
410
  function __decorateParam(paramIndex, decorator) {
413
411
  return function(target, key) {
414
412
  decorator(target, key, paramIndex);
@@ -416,7 +414,7 @@ function __decorateParam(paramIndex, decorator) {
416
414
  }
417
415
 
418
416
  //#endregion
419
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
417
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
420
418
  function __decorate(decorators, target, key, desc) {
421
419
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
422
420
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -987,7 +985,7 @@ const menuSchema = {
987
985
  //#endregion
988
986
  //#region package.json
989
987
  var name = "@univerjs/sheets-conditional-formatting-ui";
990
- var version = "1.0.0-alpha.7";
988
+ var version = "1.0.0-beta.0";
991
989
 
992
990
  //#endregion
993
991
  //#region src/config/config.ts
@@ -1521,9 +1519,9 @@ let SheetsCfRenderController = class SheetsCfRenderController extends _univerjs_
1521
1519
  _collectDirtyRanges(items, unitId, subUnitId) {
1522
1520
  const ranges = [];
1523
1521
  items.forEach((item) => {
1524
- var _item$rule, _rule$ranges;
1522
+ var _rule$ranges;
1525
1523
  if (item.unitId !== unitId || item.subUnitId !== subUnitId) return;
1526
- const rule = (_item$rule = item.rule) !== null && _item$rule !== void 0 ? _item$rule : item.cfId ? this._conditionalFormattingRuleModel.getRule(unitId, subUnitId, item.cfId) : null;
1524
+ const rule = item.rule ?? (item.cfId ? this._conditionalFormattingRuleModel.getRule(unitId, subUnitId, item.cfId) : null);
1527
1525
  if (rule === null || rule === void 0 || (_rule$ranges = rule.ranges) === null || _rule$ranges === void 0 ? void 0 : _rule$ranges.length) ranges.push(...rule.ranges);
1528
1526
  });
1529
1527
  return ranges;
@@ -1544,7 +1542,7 @@ let SheetsCfRenderController = class SheetsCfRenderController extends _univerjs_
1544
1542
  if (!workbook || !worksheet) return;
1545
1543
  const unitId = workbook.getUnitId();
1546
1544
  const subUnitId = worksheet.getSheetId();
1547
- const render = this._renderManagerService.getRenderById(unitId);
1545
+ const render = this._renderManagerService.getRenderUnitById(unitId);
1548
1546
  const skeletonManagerService = render === null || render === void 0 ? void 0 : render.with(_univerjs_sheets_ui.SheetSkeletonManagerService);
1549
1547
  const currentSkeleton = skeletonManagerService === null || skeletonManagerService === void 0 ? void 0 : skeletonManagerService.getCurrentSkeleton();
1550
1548
  const dirtyRanges = this._intersectDirtyRangesWithRenderedRange(this._collectDirtyRanges(items, unitId, subUnitId), currentSkeleton === null || currentSkeleton === void 0 ? void 0 : currentSkeleton.rowColumnSegment);
@@ -1553,13 +1551,12 @@ let SheetsCfRenderController = class SheetsCfRenderController extends _univerjs_
1553
1551
  render === null || render === void 0 || (_render$mainComponent = render.mainComponent) === null || _render$mainComponent === void 0 || _render$mainComponent.makeDirty();
1554
1552
  }
1555
1553
  _markActiveSheetRulesDirty() {
1556
- var _this$_conditionalFor;
1557
1554
  const workbook = this._univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
1558
1555
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
1559
1556
  if (!workbook || !worksheet) return;
1560
1557
  const unitId = workbook.getUnitId();
1561
1558
  const subUnitId = worksheet.getSheetId();
1562
- const rules = (_this$_conditionalFor = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId)) !== null && _this$_conditionalFor !== void 0 ? _this$_conditionalFor : [];
1559
+ const rules = this._conditionalFormattingRuleModel.getSubunitRules(unitId, subUnitId) ?? [];
1563
1560
  if (!rules.length) return;
1564
1561
  this._markDirtySkeleton(rules.map((rule) => ({
1565
1562
  rule,
@@ -1658,7 +1655,7 @@ _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "packageName",
1658
1655
  _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "version", version);
1659
1656
  _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
1660
1657
  UniverSheetsConditionalFormattingMobileUIPlugin = __decorate([
1661
- (0, _univerjs_core.DependentOn)(_univerjs_sheets_conditional_formatting.UniverSheetsConditionalFormattingPlugin),
1658
+ (0, _univerjs_core.DependentOn)(_univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_sheets_formula.UniverSheetsFormulaPlugin, _univerjs_sheets_conditional_formatting.UniverSheetsConditionalFormattingPlugin, _univerjs_sheets_ui.UniverSheetsMobileUIPlugin),
1662
1659
  __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
1663
1660
  __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService)),
1664
1661
  __decorateParam(3, _univerjs_core.IConfigService)
@@ -1866,10 +1863,9 @@ let ConditionalFormattingEditorController = class ConditionalFormattingEditorCon
1866
1863
  */
1867
1864
  _initInterceptorEditorEnd() {
1868
1865
  this.disposeWithMe((0, _univerjs_core.toDisposable)(this._sheetInterceptorService.writeCellInterceptor.intercept(_univerjs_sheets.AFTER_CELL_EDIT, { handler: (value, context, next) => {
1869
- var _result$style;
1870
1866
  if (!value) next(value);
1871
1867
  const result = this._conditionalFormattingService.composeStyle(context.unitId, context.subUnitId, context.row, context.col);
1872
- const cfStyle = (_result$style = result === null || result === void 0 ? void 0 : result.style) !== null && _result$style !== void 0 ? _result$style : {};
1868
+ const cfStyle = (result === null || result === void 0 ? void 0 : result.style) ?? {};
1873
1869
  const keys = Object.keys(cfStyle);
1874
1870
  if (value === null || value === void 0 ? void 0 : value.p) {
1875
1871
  var _value$p$body;
@@ -2033,7 +2029,6 @@ let ConditionalFormattingPainterController = class ConditionalFormattingPainterC
2033
2029
  });
2034
2030
  };
2035
2031
  const generalApplyFunc = (targetUnitId, targetSubUnitId, targetRange) => {
2036
- var _this$_conditionalFor;
2037
2032
  const { range: sourceRange, unitId: sourceUnitId, subUnitId: sourceSubUnitId } = this._painterConfig;
2038
2033
  const isSkipSheet = targetUnitId !== sourceUnitId || sourceSubUnitId !== targetSubUnitId;
2039
2034
  const rangeMap = /* @__PURE__ */ new Map();
@@ -2041,7 +2036,7 @@ let ConditionalFormattingPainterController = class ConditionalFormattingPainterC
2041
2036
  const redos = [];
2042
2037
  const undos = [];
2043
2038
  if (!targetUnitId || !targetSubUnitId || !sourceUnitId || !sourceSubUnitId) return noopReturnFunc();
2044
- const ruleList = (_this$_conditionalFor = this._conditionalFormattingRuleModel.getSubunitRules(sourceUnitId, sourceSubUnitId)) !== null && _this$_conditionalFor !== void 0 ? _this$_conditionalFor : [];
2039
+ const ruleList = this._conditionalFormattingRuleModel.getSubunitRules(sourceUnitId, sourceSubUnitId) ?? [];
2045
2040
  ruleList === null || ruleList === void 0 || ruleList.forEach((rule) => {
2046
2041
  const { ranges, cfId } = rule;
2047
2042
  if (ranges.some((range) => _univerjs_core.Rectangle.intersects(sourceRange, range))) rangeMap.set(cfId, isSkipSheet ? [] : ranges);
@@ -2210,7 +2205,7 @@ let ConditionalFormattingViewportController = class ConditionalFormattingViewpor
2210
2205
  this._unitDisposable.dispose();
2211
2206
  this._unitDisposable = new _univerjs_core.DisposableCollection();
2212
2207
  const unitId = unit.getUnitId();
2213
- const render = this._renderManagerService.getRenderById(unitId);
2208
+ const render = this._renderManagerService.getRenderUnitById(unitId);
2214
2209
  if (!render) return;
2215
2210
  const sheetSkeletonManagerService = render.with(_univerjs_sheets_ui.SheetSkeletonManagerService);
2216
2211
  this._unitDisposable.add(sheetSkeletonManagerService.currentSkeleton$.subscribe((s) => {
@@ -2249,10 +2244,11 @@ const ColorPicker = (props) => {
2249
2244
  const { color, onChange, disable = false, Icon = _univerjs_icons.PaintBucketDoubleIcon, className } = props;
2250
2245
  const colorKit = (0, react.useMemo)(() => new _univerjs_core.ColorKit(color), [color]);
2251
2246
  const renderIcon = () => {
2252
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
2247
+ const iconProps = {
2253
2248
  className: (0, _univerjs_design.clsx)("univer-fill-primary-600", disable && className),
2254
2249
  extend: { colorChannel1: colorKit.isValid ? color : "" }
2255
- });
2250
+ };
2251
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { ...iconProps });
2256
2252
  };
2257
2253
  return !disable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
2258
2254
  overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -2294,7 +2290,6 @@ function Preview(props) {
2294
2290
  const previewClassName = "univer-pointer-events-none univer-flex univer-h-5 univer-min-w-[72px] univer-items-center univer-justify-center univer-text-xs";
2295
2291
  switch (rule.type) {
2296
2292
  case _univerjs_sheets_conditional_formatting.CFRuleType.dataBar: {
2297
- var _rule$config$nativeCo, _rule$config$positive;
2298
2293
  const { isGradient } = rule.config;
2299
2294
  const positiveColor = isGradient ? `linear-gradient(to right, ${rule.config.positiveColor || _univerjs_sheets_conditional_formatting.defaultDataBarPositiveColor}, rgb(255 255 255))` : rule.config.positiveColor;
2300
2295
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -2303,13 +2298,13 @@ function Preview(props) {
2303
2298
  className: "univer-h-full univer-w-1/2 univer-border univer-border-solid",
2304
2299
  style: {
2305
2300
  background: isGradient ? `linear-gradient(to right, rgb(255 255 255),${rule.config.nativeColor || _univerjs_sheets_conditional_formatting.defaultDataBarNativeColor})` : rule.config.nativeColor,
2306
- borderColor: (_rule$config$nativeCo = rule.config.nativeColor) !== null && _rule$config$nativeCo !== void 0 ? _rule$config$nativeCo : _univerjs_sheets_conditional_formatting.defaultDataBarNativeColor
2301
+ borderColor: rule.config.nativeColor ?? _univerjs_sheets_conditional_formatting.defaultDataBarNativeColor
2307
2302
  }
2308
2303
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2309
2304
  className: "univer-h-full univer-w-1/2 univer-border univer-border-solid",
2310
2305
  style: {
2311
2306
  background: positiveColor,
2312
- borderColor: (_rule$config$positive = rule.config.positiveColor) !== null && _rule$config$positive !== void 0 ? _rule$config$positive : _univerjs_sheets_conditional_formatting.defaultDataBarPositiveColor
2307
+ borderColor: rule.config.positiveColor ?? _univerjs_sheets_conditional_formatting.defaultDataBarPositiveColor
2313
2308
  }
2314
2309
  })]
2315
2310
  });
@@ -2333,16 +2328,15 @@ function Preview(props) {
2333
2328
  }, index) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.SlashDoubleIcon, {}, index))
2334
2329
  });
2335
2330
  case _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell: {
2336
- var _bg$rgb, _cl$rgb, _replace;
2337
2331
  const { ul, st, it, bl, bg, cl } = rule.style;
2338
2332
  const isUnderline = (ul === null || ul === void 0 ? void 0 : ul.s) === _univerjs_core.BooleanNumber.TRUE;
2339
2333
  const isStrikethrough = (st === null || st === void 0 ? void 0 : st.s) === _univerjs_core.BooleanNumber.TRUE;
2340
2334
  const isItalic = it === _univerjs_core.BooleanNumber.TRUE;
2341
2335
  const isBold = bl === _univerjs_core.BooleanNumber.TRUE;
2342
- const bgColor = (_bg$rgb = bg === null || bg === void 0 ? void 0 : bg.rgb) !== null && _bg$rgb !== void 0 ? _bg$rgb : _univerjs_sheets_conditional_formatting.DEFAULT_BG_COLOR;
2343
- const fontColor = (_cl$rgb = cl === null || cl === void 0 ? void 0 : cl.rgb) !== null && _cl$rgb !== void 0 ? _cl$rgb : _univerjs_sheets_conditional_formatting.DEFAULT_FONT_COLOR;
2336
+ const bgColor = (bg === null || bg === void 0 ? void 0 : bg.rgb) ?? _univerjs_sheets_conditional_formatting.DEFAULT_BG_COLOR;
2337
+ const fontColor = (cl === null || cl === void 0 ? void 0 : cl.rgb) ?? _univerjs_sheets_conditional_formatting.DEFAULT_FONT_COLOR;
2344
2338
  const style = {
2345
- textDecoration: (_replace = `${isUnderline ? "underline" : ""} ${isStrikethrough ? "line-through" : ""}`.replace(/^ /, "")) !== null && _replace !== void 0 ? _replace : void 0,
2339
+ textDecoration: `${isUnderline ? "underline" : ""} ${isStrikethrough ? "line-through" : ""}`.replace(/^ /, "") ?? void 0,
2346
2340
  backgroundColor: bgColor,
2347
2341
  color: fontColor
2348
2342
  };
@@ -2411,7 +2405,7 @@ const TextInput$1 = (props) => {
2411
2405
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = (0, react.useState)(false);
2412
2406
  (0, _univerjs_ui.useSidebarClick)((e) => {
2413
2407
  var _formulaEditorRef$cur;
2414
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2408
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2415
2409
  });
2416
2410
  if (type === _univerjs_sheets_conditional_formatting.CFValueType.formula) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2417
2411
  className: "univer-ml-1 univer-w-full",
@@ -2819,7 +2813,7 @@ const InputText = (props) => {
2819
2813
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = (0, react.useState)(false);
2820
2814
  (0, _univerjs_ui.useSidebarClick)((e) => {
2821
2815
  var _formulaEditorRef$cur;
2822
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2816
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2823
2817
  });
2824
2818
  const _value = (0, react.useRef)(value);
2825
2819
  const config = (0, react.useMemo)(() => {
@@ -3345,7 +3339,7 @@ const FormulaStyleEditor = (props) => {
3345
3339
  };
3346
3340
  (0, _univerjs_ui.useSidebarClick)((e) => {
3347
3341
  var _formulaEditorRef$cur;
3348
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3342
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3349
3343
  });
3350
3344
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3351
3345
  ref: divEleRef,
@@ -3405,13 +3399,10 @@ const FormulaStyleEditor = (props) => {
3405
3399
  //#endregion
3406
3400
  //#region src/views/wrapper-error/WrapperError.tsx
3407
3401
  const WrapperError = (props) => {
3408
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3409
- className: "univer-relative",
3410
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3411
- className: "univer-absolute univer-bottom-[-13px] univer-z-[999] univer-text-[10px] univer-text-red-500",
3412
- children: props.errorText
3413
- }), props.children]
3414
- });
3402
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [props.children, props.errorText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3403
+ className: "univer-mt-1 univer-text-xs univer-text-red-500",
3404
+ children: props.errorText
3405
+ })] });
3415
3406
  };
3416
3407
 
3417
3408
  //#endregion
@@ -3673,11 +3664,10 @@ const HighlightCellStyleEditor = (props) => {
3673
3664
  });
3674
3665
  const [style, setStyle] = (0, react.useState)({});
3675
3666
  const getResult = (0, react.useMemo)(() => (option) => {
3676
- var _option$subType, _option$operator, _option$value, _option$style;
3677
- const nextSubType = (_option$subType = option.subType) !== null && _option$subType !== void 0 ? _option$subType : subType;
3678
- const nextOperator = (_option$operator = option.operator) !== null && _option$operator !== void 0 ? _option$operator : operator;
3679
- const nextValue = (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : value;
3680
- const nextStyle = (_option$style = option.style) !== null && _option$style !== void 0 ? _option$style : style;
3667
+ const nextSubType = option.subType ?? subType;
3668
+ const nextOperator = option.operator ?? operator;
3669
+ const nextValue = option.value ?? value;
3670
+ const nextStyle = option.style ?? style;
3681
3671
  switch (nextSubType) {
3682
3672
  case _univerjs_sheets_conditional_formatting.CFSubRuleType.duplicateValues: return {
3683
3673
  type: _univerjs_sheets_conditional_formatting.CFRuleType.highlightCell,
@@ -3821,14 +3811,14 @@ const TextInput = (props) => {
3821
3811
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = (0, react.useState)(false);
3822
3812
  (0, _univerjs_ui.useSidebarClick)((e) => {
3823
3813
  var _formulaEditorRef$cur;
3824
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3814
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3825
3815
  });
3826
3816
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3827
3817
  className: "univer-relative",
3828
3818
  children: type !== _univerjs_sheets_conditional_formatting.CFValueType.formula ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
3829
3819
  className: (0, _univerjs_design.clsx)({ "univer-border-red-500": error }),
3830
3820
  value: Number(props.value) || 0,
3831
- onChange: (v) => onChange(v !== null && v !== void 0 ? v : 0)
3821
+ onChange: (v) => onChange(v ?? 0)
3832
3822
  }), error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3833
3823
  className: "univer-absolute univer-text-xs univer-text-red-500",
3834
3824
  children: error
@@ -3981,7 +3971,8 @@ const IconSetRuleEdit = (props) => {
3981
3971
  };
3982
3972
  const handleOperatorChange = (operator, index) => {
3983
3973
  onChange([String(index), "operator"], operator);
3984
- handleValueValueChange((0, _univerjs_sheets_conditional_formatting.createDefaultValue)(_univerjs_sheets_conditional_formatting.CFSubRuleType.number, operator), index);
3974
+ const defaultValue = (0, _univerjs_sheets_conditional_formatting.createDefaultValue)(_univerjs_sheets_conditional_formatting.CFSubRuleType.number, operator);
3975
+ handleValueValueChange(defaultValue, index);
3985
3976
  };
3986
3977
  const handleValueTypeChange = (v, index) => {
3987
3978
  onChange([
@@ -3990,7 +3981,8 @@ const IconSetRuleEdit = (props) => {
3990
3981
  "type"
3991
3982
  ], v);
3992
3983
  const item = configList[index];
3993
- handleValueValueChange((0, _univerjs_sheets_conditional_formatting.createDefaultValue)(_univerjs_sheets_conditional_formatting.CFSubRuleType.number, item.operator), index);
3984
+ const defaultValue = (0, _univerjs_sheets_conditional_formatting.createDefaultValue)(_univerjs_sheets_conditional_formatting.CFSubRuleType.number, item.operator);
3985
+ handleValueValueChange(defaultValue, index);
3994
3986
  };
3995
3987
  return (0, react.useMemo)(() => {
3996
3988
  return configList.map((item, index) => {
@@ -4229,7 +4221,8 @@ const IconSet = (props) => {
4229
4221
  const reverseIcon = () => {
4230
4222
  const iconList = configList.map((item) => ({ ...item }));
4231
4223
  configList.forEach((item, index) => {
4232
- const newIcon = iconList[configList.length - 1 - index];
4224
+ const mirrorIndex = configList.length - 1 - index;
4225
+ const newIcon = iconList[mirrorIndex];
4233
4226
  item.iconId = newIcon.iconId;
4234
4227
  item.iconType = newIcon.iconType;
4235
4228
  });
@@ -4495,7 +4488,7 @@ const getSubUnitId = (univerInstanceService) => {
4495
4488
  return (_getActiveSheet = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).getActiveSheet()) === null || _getActiveSheet === void 0 ? void 0 : _getActiveSheet.getSheetId();
4496
4489
  };
4497
4490
  const RuleEdit = (props) => {
4498
- var _props$rule$ranges, _props$rule, _props$rule5;
4491
+ var _props$rule, _props$rule5;
4499
4492
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
4500
4493
  const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
4501
4494
  const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
@@ -4504,14 +4497,14 @@ const RuleEdit = (props) => {
4504
4497
  const unitId = getUnitId(univerInstanceService);
4505
4498
  const subUnitId = getSubUnitId(univerInstanceService);
4506
4499
  const [errorText, setErrorText] = (0, react.useState)(void 0);
4507
- const rangeResult = (0, react.useRef)((_props$rule$ranges = (_props$rule = props.rule) === null || _props$rule === void 0 ? void 0 : _props$rule.ranges) !== null && _props$rule$ranges !== void 0 ? _props$rule$ranges : []);
4500
+ const rangeResult = (0, react.useRef)(((_props$rule = props.rule) === null || _props$rule === void 0 ? void 0 : _props$rule.ranges) ?? []);
4508
4501
  const rangeSelectorTouched = (0, react.useRef)(false);
4509
4502
  const rangeString = (0, react.useMemo)(() => {
4510
4503
  var _props$rule2;
4511
4504
  let ranges = (_props$rule2 = props.rule) === null || _props$rule2 === void 0 ? void 0 : _props$rule2.ranges;
4512
4505
  if (!(ranges === null || ranges === void 0 ? void 0 : ranges.length)) {
4513
- var _selectionManagerServ, _selectionManagerServ2;
4514
- ranges = (_selectionManagerServ = (_selectionManagerServ2 = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ2 === void 0 ? void 0 : _selectionManagerServ2.map((s) => s.range)) !== null && _selectionManagerServ !== void 0 ? _selectionManagerServ : [];
4506
+ var _selectionManagerServ;
4507
+ ranges = ((_selectionManagerServ = selectionManagerService.getCurrentSelections()) === null || _selectionManagerServ === void 0 ? void 0 : _selectionManagerServ.map((s) => s.range)) ?? [];
4515
4508
  }
4516
4509
  rangeResult.current = ranges;
4517
4510
  if (!(ranges === null || ranges === void 0 ? void 0 : ranges.length)) return "";
@@ -4605,7 +4598,8 @@ const RuleEdit = (props) => {
4605
4598
  const onRangeSelectorChange = (rangeString) => {
4606
4599
  if (!rangeSelectorTouched.current && rangeString.length < 1 && rangeResult.current.length > 0) return;
4607
4600
  rangeSelectorTouched.current = true;
4608
- rangeResult.current = rangeString.split(",").filter((e) => !!e).map(_univerjs_engine_formula.deserializeRangeWithSheet).map((item) => item.range);
4601
+ const result = rangeString.split(",").filter((e) => !!e).map(_univerjs_engine_formula.deserializeRangeWithSheet).map((item) => item.range);
4602
+ rangeResult.current = result;
4609
4603
  };
4610
4604
  const handleSubmit = () => {
4611
4605
  const getRanges = () => {
@@ -4824,9 +4818,8 @@ function RuleList(props) {
4824
4818
  });
4825
4819
  };
4826
4820
  const handleDragStart = (_layout, from) => {
4827
- var _dragRule$cfId;
4828
4821
  const dragRule = ruleListByPermissionCheck[from.y];
4829
- setDraggingId((_dragRule$cfId = dragRule === null || dragRule === void 0 ? void 0 : dragRule.cfId) !== null && _dragRule$cfId !== void 0 ? _dragRule$cfId : "");
4822
+ setDraggingId((dragRule === null || dragRule === void 0 ? void 0 : dragRule.cfId) ?? "");
4830
4823
  };
4831
4824
  const handleDragStop = (_layout, from, to) => {
4832
4825
  var _getActiveSheet2, _ruleListByPermission, _ruleListByPermission2;
@@ -5129,7 +5122,7 @@ _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "packageName", name);
5129
5122
  _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "version", version);
5130
5123
  _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
5131
5124
  UniverSheetsConditionalFormattingUIPlugin = __decorate([
5132
- (0, _univerjs_core.DependentOn)(_univerjs_sheets_conditional_formatting.UniverSheetsConditionalFormattingPlugin, _univerjs_sheets_formula.UniverSheetsFormulaPlugin),
5125
+ (0, _univerjs_core.DependentOn)(_univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_sheets_formula.UniverSheetsFormulaPlugin, _univerjs_sheets_conditional_formatting.UniverSheetsConditionalFormattingPlugin, _univerjs_sheets_ui.UniverSheetsUIPlugin),
5133
5126
  __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
5134
5127
  __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService)),
5135
5128
  __decorateParam(3, _univerjs_core.IConfigService)
@@ -88,9 +88,9 @@ const locale = { "sheets-conditional-formatting-ui": {
88
88
  lastWeek: "Semana pasada",
89
89
  nextWeek: "Semana siguiente",
90
90
  today: "Hoy",
91
- topN: "Top {0}",
91
+ topN: "Principales {0}",
92
92
  bottomN: "Inferior {0}",
93
- topNPercent: "Top {0}%",
93
+ topNPercent: "Principales {0}%",
94
94
  bottomNPercent: "Inferior {0}%"
95
95
  } },
96
96
  operator: {
@@ -151,7 +151,7 @@ const locale = { "sheets-conditional-formatting-ui": {
151
151
  errorMessage: {
152
152
  notBlank: "شرط نمی‌تواند خالی باشد",
153
153
  formulaError: "فرمول اشتباه",
154
- rangeError: "Bad selection"
154
+ rangeError: "انتخاب نامعتبر"
155
155
  },
156
156
  permission: { dialog: { setStyleErr: "محدوده محافظت شده است و شما مجوز تنظیم سبک‌ها را ندارید. برای تنظیم سبک‌ها، لطفا با سازنده تماس بگیرید." } }
157
157
  } };
@@ -88,9 +88,9 @@ const locale = { "sheets-conditional-formatting-ui": {
88
88
  lastWeek: "Poprzedni tydzień",
89
89
  nextWeek: "Następny tydzień",
90
90
  today: "Dzisiaj",
91
- topN: "Top {0}",
91
+ topN: "Górne {0}",
92
92
  bottomN: "Ostatnie {0}",
93
- topNPercent: "Top {0}%",
93
+ topNPercent: "Górne {0}%",
94
94
  bottomNPercent: "Ostatnie {0}%"
95
95
  } },
96
96
  operator: {
@@ -88,9 +88,9 @@ const locale = { "sheets-conditional-formatting-ui": {
88
88
  lastWeek: "Tuần trước",
89
89
  nextWeek: "Tuần sau",
90
90
  today: "Hôm nay",
91
- topN: "Top {0}",
91
+ topN: "Trên cùng {0}",
92
92
  bottomN: "Cuối {0}",
93
- topNPercent: "Top {0}%",
93
+ topNPercent: "Trên cùng {0}%",
94
94
  bottomNPercent: "Cuối {0}%"
95
95
  } },
96
96
  operator: {
@@ -151,7 +151,7 @@ const locale = { "sheets-conditional-formatting-ui": {
151
151
  errorMessage: {
152
152
  notBlank: "Điều kiện không được để trống",
153
153
  formulaError: "Lỗi công thức",
154
- rangeError: "Bad selection"
154
+ rangeError: "Lựa chọn không hợp lệ"
155
155
  },
156
156
  permission: { dialog: { setStyleErr: "Phạm vi này đã được bảo vệ, hiện không có quyền thiết lập kiểu. Nếu cần thiết lập kiểu, vui lòng liên hệ với người tạo." } }
157
157
  } };