@univerjs/sheets-conditional-formatting-ui 1.4.0 → 1.5.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/README.md CHANGED
@@ -8,9 +8,9 @@
8
8
 
9
9
  ## Package Overview
10
10
 
11
- | Package | UMD global | CSS | Locales | Facade entry |
12
- | --- | --- | :---: | :---: | :---: |
13
- | `@univerjs/sheets-conditional-formatting-ui` | `UniverSheetsConditionalFormattingUi` | Yes | Yes | No |
11
+ | Package | UMD global | CSS | Locales | Facade entry | Worker entry |
12
+ | --- | --- | :---: | :---: | :---: | :---: |
13
+ | `@univerjs/sheets-conditional-formatting-ui` | `UniverSheetsConditionalFormattingUi` | Yes | Yes | No | No |
14
14
 
15
15
  ## Installation
16
16
 
@@ -20,10 +20,10 @@ pnpm add @univerjs/sheets-conditional-formatting-ui
20
20
  npm install @univerjs/sheets-conditional-formatting-ui
21
21
  ```
22
22
 
23
- Keep all `@univerjs/*` packages on the same version.
24
-
25
23
  ## Usage
26
24
 
25
+ Start with the [integration setup](https://docs.univer.ai/) for your document type, including its required plugins, styles, and locale resources. The snippet below assumes that setup is complete.
26
+
27
27
  ```ts
28
28
  import '@univerjs/sheets-conditional-formatting-ui/lib/index.css';
29
29
  import EnUS from '@univerjs/sheets-conditional-formatting-ui/locale/en-US';
package/lib/cjs/index.js CHANGED
@@ -378,7 +378,7 @@ const AddUniqueValuesCfCommand = {
378
378
  */
379
379
  const CF_PANEL_KEY = "sheet.conditional.formatting.panel";
380
380
 
381
- // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
381
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
382
382
  function _typeof(o) {
383
383
  "@babel/helpers - typeof";
384
384
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -388,25 +388,25 @@ function _typeof(o) {
388
388
  }, _typeof(o);
389
389
  }
390
390
 
391
- // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
392
- function toPrimitive(t, r) {
391
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
392
+ function toPrimitive(t, e) {
393
393
  if ("object" != _typeof(t) || !t) return t;
394
- var e = t[Symbol.toPrimitive];
395
- if (void 0 !== e) {
396
- var i = e.call(t, r || "default");
394
+ var r;
395
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
396
+ var i = r.call(t, e || "default");
397
397
  if ("object" != _typeof(i)) return i;
398
398
  throw new TypeError("@@toPrimitive must return a primitive value.");
399
399
  }
400
- return ("string" === r ? String : Number)(t);
400
+ return ("string" === e ? String : Number)(t);
401
401
  }
402
402
 
403
- // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
403
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
404
404
  function toPropertyKey(t) {
405
405
  var i = toPrimitive(t, "string");
406
406
  return "symbol" == _typeof(i) ? i : i + "";
407
407
  }
408
408
 
409
- // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
409
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
410
410
  function _defineProperty(e, r, t) {
411
411
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
412
412
  value: t,
@@ -416,14 +416,14 @@ function _defineProperty(e, r, t) {
416
416
  }) : e[r] = t, e;
417
417
  }
418
418
 
419
- // \0@oxc-project+runtime@0.156.0/helpers/esm/decorateParam.js
419
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
420
420
  function __decorateParam(paramIndex, decorator) {
421
421
  return function(target, key) {
422
422
  decorator(target, key, paramIndex);
423
423
  };
424
424
  }
425
425
 
426
- // \0@oxc-project+runtime@0.156.0/helpers/esm/decorate.js
426
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
427
427
  function __decorate(decorators, target, key, desc) {
428
428
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
429
429
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -984,7 +984,7 @@ const menuSchema = {
984
984
 
985
985
  // package.json
986
986
  var name = "@univerjs/sheets-conditional-formatting-ui";
987
- var version = "1.4.0";
987
+ var version = "1.5.0";
988
988
 
989
989
  // src/config/config.ts
990
990
  const SHEETS_CONDITIONAL_FORMATTING_UI_PLUGIN_CONFIG_KEY = "sheets-conditional-formatting-ui.config";
@@ -3216,7 +3216,7 @@ const HighlightCellStyleEditor = (props) => {
3216
3216
  onChange: onTypeChange,
3217
3217
  value: subType,
3218
3218
  options: typeOptions
3219
- }), (operatorOptions === null || operatorOptions === void 0 ? void 0 : operatorOptions.length) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectComponent, {
3219
+ }), !!(operatorOptions === null || operatorOptions === void 0 ? void 0 : operatorOptions.length) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectComponent, {
3220
3220
  className: "univer-mt-3 univer-w-full",
3221
3221
  onChange: onOperatorChange,
3222
3222
  value: operator || "",
@@ -3289,15 +3289,6 @@ const TextInput = (props) => {
3289
3289
  })
3290
3290
  });
3291
3291
  };
3292
- const createDefaultConfigItem = (iconType, index, list) => ({
3293
- operator: _univerjs_sheets_conditional_formatting.CFNumberOperator.greaterThan,
3294
- value: {
3295
- type: _univerjs_sheets_conditional_formatting.CFValueType.num,
3296
- value: (list.length - 1 - index) * 10
3297
- },
3298
- iconType,
3299
- iconId: String(index)
3300
- });
3301
3292
  const IconGroupList = (props) => {
3302
3293
  const { iconType, onClick } = props;
3303
3294
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
@@ -3484,14 +3475,10 @@ const IconSetRuleEdit = (props) => {
3484
3475
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownComponent, {
3485
3476
  overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3486
3477
  className: "univer-rounded-lg univer-p-4",
3487
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconItemList, {
3488
- onClick: handleIconClick,
3489
- iconId: item.iconId,
3490
- iconType: item.iconType
3491
- })
3478
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconItemList, { onClick: handleIconClick })
3492
3479
  }),
3493
3480
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3494
- className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200", _univerjs_design.borderClassName),
3481
+ className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", _univerjs_design.borderClassName),
3495
3482
  children: [icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
3496
3483
  src: icon,
3497
3484
  className: "univer-size-4",
@@ -3506,7 +3493,7 @@ const IconSetRuleEdit = (props) => {
3506
3493
  handleOperatorChange(v, index);
3507
3494
  }
3508
3495
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3509
- className: "univer-mt-0 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
3496
+ className: "univer-self-center univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
3510
3497
  children: [localeService.t("sheets-conditional-formatting-ui.iconSet.rule"), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3511
3498
  className: "univer-font-medium",
3512
3499
  children: [
@@ -3559,6 +3546,15 @@ const IconSet = (props) => {
3559
3546
  const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
3560
3547
  const direction = (0, _univerjs_ui.useObservable)(localeService.direction$, localeService.getDirection());
3561
3548
  const [errorMap, setErrorMap] = (0, react.useState)({});
3549
+ const createDefaultConfigItem = (iconType, index, list) => ({
3550
+ operator: _univerjs_sheets_conditional_formatting.CFNumberOperator.greaterThan,
3551
+ value: {
3552
+ type: _univerjs_sheets_conditional_formatting.CFValueType.num,
3553
+ value: (list.length - 1 - index) * 10
3554
+ },
3555
+ iconType,
3556
+ iconId: String(index)
3557
+ });
3562
3558
  const [currentIconType, setCurrentIconType] = (0, react.useState)(() => {
3563
3559
  const defaultV = Object.keys(_univerjs_sheets_conditional_formatting.iconMap)[0];
3564
3560
  if (rule && rule.config.length) {
@@ -3697,7 +3693,7 @@ const IconSet = (props) => {
3697
3693
  dir: direction,
3698
3694
  children: [
3699
3695
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3700
- className: "univer-mt-4 univer-text-sm univer-text-gray-600",
3696
+ className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
3701
3697
  children: localeService.t("sheets-conditional-formatting-ui.panel.styleRule")
3702
3698
  }),
3703
3699
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -3712,7 +3708,7 @@ const IconSet = (props) => {
3712
3708
  })
3713
3709
  }),
3714
3710
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3715
- className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600", _univerjs_design.borderClassName),
3711
+ className: (0, _univerjs_design.clsx)("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", _univerjs_design.borderClassName),
3716
3712
  children: [previewIcon, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})]
3717
3713
  })
3718
3714
  })
@@ -4472,7 +4468,7 @@ const ConditionFormattingPanel = (props) => {
4472
4468
  setIsShowRuleEditor(true);
4473
4469
  };
4474
4470
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4475
- className: "univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4",
4471
+ className: "univer-box-border univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4",
4476
4472
  children: isShowRuleEditor ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RuleEditComponent, {
4477
4473
  onCancel: handleCancel,
4478
4474
  rule: currentEditRule
package/lib/es/index.js CHANGED
@@ -10,7 +10,7 @@ import { FormulaRefRangeService, UniverSheetsFormulaPlugin } from "@univerjs/she
10
10
  import { FormulaEditor, MobileRangeSelector, RangeSelector, UniverSheetsFormulaMobileUIPlugin } from "@univerjs/sheets-formula-ui";
11
11
  import { BoldIcon, ConditionsDoubleIcon, DataBarIcon, DeleteIcon, FontColorDoubleIcon, GripVerticalIcon, IncreaseIcon, ItalicIcon, MoreDownIcon, PaintBucketDoubleIcon, RatingIcon, SlashDoubleIcon, StrikethroughIcon, UnderlineIcon } from "@univerjs/icons";
12
12
  import { useEffect, useMemo, useRef, useState } from "react";
13
- import { Button, Checkbox, ColorPicker, DraggableList, Dropdown, Input, InputNumber, MobileColorPicker, MobileDropdown, MobileSelect, Radio, RadioGroup, Select, Tooltip, borderClassName, clsx } from "@univerjs/design";
13
+ import { Button, Checkbox, ColorPicker as ColorPicker$1, DraggableList, Dropdown, Input, InputNumber, MobileColorPicker, MobileDropdown, MobileSelect, Radio, RadioGroup, Select, Tooltip, borderClassName, clsx } from "@univerjs/design";
14
14
  import { LexerTreeBuilder, deserializeRangeWithSheet, operatorToken, serializeRange } from "@univerjs/engine-formula";
15
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
16
 
@@ -377,7 +377,7 @@ const AddUniqueValuesCfCommand = {
377
377
  */
378
378
  const CF_PANEL_KEY = "sheet.conditional.formatting.panel";
379
379
 
380
- // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
380
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
381
381
  function _typeof(o) {
382
382
  "@babel/helpers - typeof";
383
383
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -387,25 +387,25 @@ function _typeof(o) {
387
387
  }, _typeof(o);
388
388
  }
389
389
 
390
- // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
391
- function toPrimitive(t, r) {
390
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
391
+ function toPrimitive(t, e) {
392
392
  if ("object" != _typeof(t) || !t) return t;
393
- var e = t[Symbol.toPrimitive];
394
- if (void 0 !== e) {
395
- var i = e.call(t, r || "default");
393
+ var r;
394
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
395
+ var i = r.call(t, e || "default");
396
396
  if ("object" != _typeof(i)) return i;
397
397
  throw new TypeError("@@toPrimitive must return a primitive value.");
398
398
  }
399
- return ("string" === r ? String : Number)(t);
399
+ return ("string" === e ? String : Number)(t);
400
400
  }
401
401
 
402
- // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
402
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
403
403
  function toPropertyKey(t) {
404
404
  var i = toPrimitive(t, "string");
405
405
  return "symbol" == _typeof(i) ? i : i + "";
406
406
  }
407
407
 
408
- // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
408
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
409
409
  function _defineProperty(e, r, t) {
410
410
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
411
411
  value: t,
@@ -415,14 +415,14 @@ function _defineProperty(e, r, t) {
415
415
  }) : e[r] = t, e;
416
416
  }
417
417
 
418
- // \0@oxc-project+runtime@0.156.0/helpers/esm/decorateParam.js
418
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
419
419
  function __decorateParam(paramIndex, decorator) {
420
420
  return function(target, key) {
421
421
  decorator(target, key, paramIndex);
422
422
  };
423
423
  }
424
424
 
425
- // \0@oxc-project+runtime@0.156.0/helpers/esm/decorate.js
425
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
426
426
  function __decorate(decorators, target, key, desc) {
427
427
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
428
428
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -983,7 +983,7 @@ const menuSchema = {
983
983
 
984
984
  // package.json
985
985
  var name = "@univerjs/sheets-conditional-formatting-ui";
986
- var version = "1.4.0";
986
+ var version = "1.5.0";
987
987
 
988
988
  // src/config/config.ts
989
989
  const SHEETS_CONDITIONAL_FORMATTING_UI_PLUGIN_CONFIG_KEY = "sheets-conditional-formatting-ui.config";
@@ -1642,8 +1642,8 @@ SheetsCfRenderController = __decorate([
1642
1642
  ], SheetsCfRenderController);
1643
1643
 
1644
1644
  // src/views/ColorPicker.tsx
1645
- const ColorPicker$1 = (props) => {
1646
- const { color, onChange, disable = false, Icon = PaintBucketDoubleIcon, className, DropdownComponent = Dropdown, PickerComponent = ColorPicker } = props;
1645
+ const ColorPicker = (props) => {
1646
+ const { color, onChange, disable = false, Icon = PaintBucketDoubleIcon, className, DropdownComponent = Dropdown, PickerComponent = ColorPicker$1 } = props;
1647
1647
  const colorKit = useMemo(() => new ColorKit(color), [color]);
1648
1648
  const renderIcon = () => {
1649
1649
  const iconProps = {
@@ -1881,7 +1881,7 @@ const TextInput$1 = (props) => {
1881
1881
  };
1882
1882
  const ColorScaleStyleEditor = (props) => {
1883
1883
  var _props$rule;
1884
- const { interceptorManager, SelectComponent = Select, ColorPickerComponent = ColorPicker$1, FormulaEditorComponent = FormulaEditor } = props;
1884
+ const { interceptorManager, SelectComponent = Select, ColorPickerComponent = ColorPicker, FormulaEditorComponent = FormulaEditor } = props;
1885
1885
  const localeService = useDependency(LocaleService);
1886
1886
  const rule = ((_props$rule = props.rule) === null || _props$rule === void 0 ? void 0 : _props$rule.type) === CFRuleType.colorScale ? props.rule : void 0;
1887
1887
  const commonOptionDefinitions = [
@@ -2307,7 +2307,7 @@ const InputText = (props) => {
2307
2307
  };
2308
2308
  const DataBarStyleEditor = (props) => {
2309
2309
  var _props$rule;
2310
- const { interceptorManager, SelectComponent = Select, ColorPickerComponent = ColorPicker$1, FormulaEditorComponent = FormulaEditor } = props;
2310
+ const { interceptorManager, SelectComponent = Select, ColorPickerComponent = ColorPicker, FormulaEditorComponent = FormulaEditor } = props;
2311
2311
  const localeService = useDependency(LocaleService);
2312
2312
  const rule = ((_props$rule = props.rule) === null || _props$rule === void 0 ? void 0 : _props$rule.type) === CFRuleType.dataBar ? props.rule : void 0;
2313
2313
  const [isGradient, setIsGradient] = useState(() => {
@@ -2647,7 +2647,7 @@ const getAnotherBooleanNumber = (v) => {
2647
2647
  };
2648
2648
  const getBooleanFromNumber = (v) => v !== BooleanNumber.FALSE;
2649
2649
  const ConditionalStyleEditor = (props) => {
2650
- const { style, onChange, className, ColorPickerComponent = ColorPicker$1 } = props;
2650
+ const { style, onChange, className, ColorPickerComponent = ColorPicker } = props;
2651
2651
  const [isBold, setIsBold] = useState(() => {
2652
2652
  if (!(style === null || style === void 0 ? void 0 : style.bl)) return;
2653
2653
  return style.bl;
@@ -3215,7 +3215,7 @@ const HighlightCellStyleEditor = (props) => {
3215
3215
  onChange: onTypeChange,
3216
3216
  value: subType,
3217
3217
  options: typeOptions
3218
- }), (operatorOptions === null || operatorOptions === void 0 ? void 0 : operatorOptions.length) && /* @__PURE__ */ jsx(SelectComponent, {
3218
+ }), !!(operatorOptions === null || operatorOptions === void 0 ? void 0 : operatorOptions.length) && /* @__PURE__ */ jsx(SelectComponent, {
3219
3219
  className: "univer-mt-3 univer-w-full",
3220
3220
  onChange: onOperatorChange,
3221
3221
  value: operator || "",
@@ -3288,15 +3288,6 @@ const TextInput = (props) => {
3288
3288
  })
3289
3289
  });
3290
3290
  };
3291
- const createDefaultConfigItem = (iconType, index, list) => ({
3292
- operator: CFNumberOperator.greaterThan,
3293
- value: {
3294
- type: CFValueType.num,
3295
- value: (list.length - 1 - index) * 10
3296
- },
3297
- iconType,
3298
- iconId: String(index)
3299
- });
3300
3291
  const IconGroupList = (props) => {
3301
3292
  const { iconType, onClick } = props;
3302
3293
  const localeService = useDependency(LocaleService);
@@ -3483,14 +3474,10 @@ const IconSetRuleEdit = (props) => {
3483
3474
  children: /* @__PURE__ */ jsx(DropdownComponent, {
3484
3475
  overlay: /* @__PURE__ */ jsx("div", {
3485
3476
  className: "univer-rounded-lg univer-p-4",
3486
- children: /* @__PURE__ */ jsx(IconItemList, {
3487
- onClick: handleIconClick,
3488
- iconId: item.iconId,
3489
- iconType: item.iconType
3490
- })
3477
+ children: /* @__PURE__ */ jsx(IconItemList, { onClick: handleIconClick })
3491
3478
  }),
3492
3479
  children: /* @__PURE__ */ jsxs("div", {
3493
- className: clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200", borderClassName),
3480
+ className: clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", borderClassName),
3494
3481
  children: [icon ? /* @__PURE__ */ jsx("img", {
3495
3482
  src: icon,
3496
3483
  className: "univer-size-4",
@@ -3505,7 +3492,7 @@ const IconSetRuleEdit = (props) => {
3505
3492
  handleOperatorChange(v, index);
3506
3493
  }
3507
3494
  }) : /* @__PURE__ */ jsxs("div", {
3508
- className: "univer-mt-0 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
3495
+ className: "univer-self-center univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
3509
3496
  children: [localeService.t("sheets-conditional-formatting-ui.iconSet.rule"), /* @__PURE__ */ jsxs("span", {
3510
3497
  className: "univer-font-medium",
3511
3498
  children: [
@@ -3558,6 +3545,15 @@ const IconSet = (props) => {
3558
3545
  const localeService = useDependency(LocaleService);
3559
3546
  const direction = useObservable(localeService.direction$, localeService.getDirection());
3560
3547
  const [errorMap, setErrorMap] = useState({});
3548
+ const createDefaultConfigItem = (iconType, index, list) => ({
3549
+ operator: CFNumberOperator.greaterThan,
3550
+ value: {
3551
+ type: CFValueType.num,
3552
+ value: (list.length - 1 - index) * 10
3553
+ },
3554
+ iconType,
3555
+ iconId: String(index)
3556
+ });
3561
3557
  const [currentIconType, setCurrentIconType] = useState(() => {
3562
3558
  const defaultV = Object.keys(iconMap)[0];
3563
3559
  if (rule && rule.config.length) {
@@ -3696,7 +3692,7 @@ const IconSet = (props) => {
3696
3692
  dir: direction,
3697
3693
  children: [
3698
3694
  /* @__PURE__ */ jsx("div", {
3699
- className: "univer-mt-4 univer-text-sm univer-text-gray-600",
3695
+ className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
3700
3696
  children: localeService.t("sheets-conditional-formatting-ui.panel.styleRule")
3701
3697
  }),
3702
3698
  /* @__PURE__ */ jsx("div", {
@@ -3711,7 +3707,7 @@ const IconSet = (props) => {
3711
3707
  })
3712
3708
  }),
3713
3709
  children: /* @__PURE__ */ jsxs("div", {
3714
- className: clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600", borderClassName),
3710
+ className: clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", borderClassName),
3715
3711
  children: [previewIcon, /* @__PURE__ */ jsx(MoreDownIcon, {})]
3716
3712
  })
3717
3713
  })
@@ -4471,7 +4467,7 @@ const ConditionFormattingPanel = (props) => {
4471
4467
  setIsShowRuleEditor(true);
4472
4468
  };
4473
4469
  return /* @__PURE__ */ jsx("div", {
4474
- className: "univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4",
4470
+ className: "univer-box-border univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4",
4475
4471
  children: isShowRuleEditor ? /* @__PURE__ */ jsx(RuleEditComponent, {
4476
4472
  onCancel: handleCancel,
4477
4473
  rule: currentEditRule
@@ -4484,7 +4480,7 @@ const ConditionFormattingPanel = (props) => {
4484
4480
 
4485
4481
  // src/views/mobile/MobileColorPicker.tsx
4486
4482
  function MobileConditionalColorPicker(props) {
4487
- return /* @__PURE__ */ jsx(ColorPicker$1, {
4483
+ return /* @__PURE__ */ jsx(ColorPicker, {
4488
4484
  ...props,
4489
4485
  DropdownComponent: MobileDropdown,
4490
4486
  PickerComponent: MobileColorPicker
package/lib/index.css CHANGED
@@ -43,10 +43,6 @@
43
43
  margin-left: .75rem;
44
44
  }
45
45
 
46
- .univer-mt-0 {
47
- margin-top: 0;
48
- }
49
-
50
46
  .univer-mt-1 {
51
47
  margin-top: .25rem;
52
48
  }
@@ -174,10 +170,6 @@
174
170
  grid-template-columns: repeat(2, minmax(0, 1fr));
175
171
  }
176
172
 
177
- .univer-flex-row-reverse {
178
- flex-direction: row-reverse;
179
- }
180
-
181
173
  .univer-flex-col {
182
174
  flex-direction: column;
183
175
  }
@@ -226,6 +218,10 @@
226
218
  gap: 1rem;
227
219
  }
228
220
 
221
+ .univer-self-center {
222
+ align-self: center;
223
+ }
224
+
229
225
  .univer-overflow-hidden {
230
226
  overflow: hidden;
231
227
  }
package/lib/index.js CHANGED
@@ -10,7 +10,7 @@ import { FormulaRefRangeService, UniverSheetsFormulaPlugin } from "@univerjs/she
10
10
  import { FormulaEditor, MobileRangeSelector, RangeSelector, UniverSheetsFormulaMobileUIPlugin } from "@univerjs/sheets-formula-ui";
11
11
  import { BoldIcon, ConditionsDoubleIcon, DataBarIcon, DeleteIcon, FontColorDoubleIcon, GripVerticalIcon, IncreaseIcon, ItalicIcon, MoreDownIcon, PaintBucketDoubleIcon, RatingIcon, SlashDoubleIcon, StrikethroughIcon, UnderlineIcon } from "@univerjs/icons";
12
12
  import { useEffect, useMemo, useRef, useState } from "react";
13
- import { Button, Checkbox, ColorPicker, DraggableList, Dropdown, Input, InputNumber, MobileColorPicker, MobileDropdown, MobileSelect, Radio, RadioGroup, Select, Tooltip, borderClassName, clsx } from "@univerjs/design";
13
+ import { Button, Checkbox, ColorPicker as ColorPicker$1, DraggableList, Dropdown, Input, InputNumber, MobileColorPicker, MobileDropdown, MobileSelect, Radio, RadioGroup, Select, Tooltip, borderClassName, clsx } from "@univerjs/design";
14
14
  import { LexerTreeBuilder, deserializeRangeWithSheet, operatorToken, serializeRange } from "@univerjs/engine-formula";
15
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
16
 
@@ -377,7 +377,7 @@ const AddUniqueValuesCfCommand = {
377
377
  */
378
378
  const CF_PANEL_KEY = "sheet.conditional.formatting.panel";
379
379
 
380
- // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
380
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
381
381
  function _typeof(o) {
382
382
  "@babel/helpers - typeof";
383
383
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -387,25 +387,25 @@ function _typeof(o) {
387
387
  }, _typeof(o);
388
388
  }
389
389
 
390
- // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
391
- function toPrimitive(t, r) {
390
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
391
+ function toPrimitive(t, e) {
392
392
  if ("object" != _typeof(t) || !t) return t;
393
- var e = t[Symbol.toPrimitive];
394
- if (void 0 !== e) {
395
- var i = e.call(t, r || "default");
393
+ var r;
394
+ if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
395
+ var i = r.call(t, e || "default");
396
396
  if ("object" != _typeof(i)) return i;
397
397
  throw new TypeError("@@toPrimitive must return a primitive value.");
398
398
  }
399
- return ("string" === r ? String : Number)(t);
399
+ return ("string" === e ? String : Number)(t);
400
400
  }
401
401
 
402
- // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
402
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
403
403
  function toPropertyKey(t) {
404
404
  var i = toPrimitive(t, "string");
405
405
  return "symbol" == _typeof(i) ? i : i + "";
406
406
  }
407
407
 
408
- // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
408
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
409
409
  function _defineProperty(e, r, t) {
410
410
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
411
411
  value: t,
@@ -415,14 +415,14 @@ function _defineProperty(e, r, t) {
415
415
  }) : e[r] = t, e;
416
416
  }
417
417
 
418
- // \0@oxc-project+runtime@0.156.0/helpers/esm/decorateParam.js
418
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
419
419
  function __decorateParam(paramIndex, decorator) {
420
420
  return function(target, key) {
421
421
  decorator(target, key, paramIndex);
422
422
  };
423
423
  }
424
424
 
425
- // \0@oxc-project+runtime@0.156.0/helpers/esm/decorate.js
425
+ // \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
426
426
  function __decorate(decorators, target, key, desc) {
427
427
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
428
428
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -983,7 +983,7 @@ const menuSchema = {
983
983
 
984
984
  // package.json
985
985
  var name = "@univerjs/sheets-conditional-formatting-ui";
986
- var version = "1.4.0";
986
+ var version = "1.5.0";
987
987
 
988
988
  // src/config/config.ts
989
989
  const SHEETS_CONDITIONAL_FORMATTING_UI_PLUGIN_CONFIG_KEY = "sheets-conditional-formatting-ui.config";
@@ -1642,8 +1642,8 @@ SheetsCfRenderController = __decorate([
1642
1642
  ], SheetsCfRenderController);
1643
1643
 
1644
1644
  // src/views/ColorPicker.tsx
1645
- const ColorPicker$1 = (props) => {
1646
- const { color, onChange, disable = false, Icon = PaintBucketDoubleIcon, className, DropdownComponent = Dropdown, PickerComponent = ColorPicker } = props;
1645
+ const ColorPicker = (props) => {
1646
+ const { color, onChange, disable = false, Icon = PaintBucketDoubleIcon, className, DropdownComponent = Dropdown, PickerComponent = ColorPicker$1 } = props;
1647
1647
  const colorKit = useMemo(() => new ColorKit(color), [color]);
1648
1648
  const renderIcon = () => {
1649
1649
  const iconProps = {
@@ -1881,7 +1881,7 @@ const TextInput$1 = (props) => {
1881
1881
  };
1882
1882
  const ColorScaleStyleEditor = (props) => {
1883
1883
  var _props$rule;
1884
- const { interceptorManager, SelectComponent = Select, ColorPickerComponent = ColorPicker$1, FormulaEditorComponent = FormulaEditor } = props;
1884
+ const { interceptorManager, SelectComponent = Select, ColorPickerComponent = ColorPicker, FormulaEditorComponent = FormulaEditor } = props;
1885
1885
  const localeService = useDependency(LocaleService);
1886
1886
  const rule = ((_props$rule = props.rule) === null || _props$rule === void 0 ? void 0 : _props$rule.type) === CFRuleType.colorScale ? props.rule : void 0;
1887
1887
  const commonOptionDefinitions = [
@@ -2307,7 +2307,7 @@ const InputText = (props) => {
2307
2307
  };
2308
2308
  const DataBarStyleEditor = (props) => {
2309
2309
  var _props$rule;
2310
- const { interceptorManager, SelectComponent = Select, ColorPickerComponent = ColorPicker$1, FormulaEditorComponent = FormulaEditor } = props;
2310
+ const { interceptorManager, SelectComponent = Select, ColorPickerComponent = ColorPicker, FormulaEditorComponent = FormulaEditor } = props;
2311
2311
  const localeService = useDependency(LocaleService);
2312
2312
  const rule = ((_props$rule = props.rule) === null || _props$rule === void 0 ? void 0 : _props$rule.type) === CFRuleType.dataBar ? props.rule : void 0;
2313
2313
  const [isGradient, setIsGradient] = useState(() => {
@@ -2647,7 +2647,7 @@ const getAnotherBooleanNumber = (v) => {
2647
2647
  };
2648
2648
  const getBooleanFromNumber = (v) => v !== BooleanNumber.FALSE;
2649
2649
  const ConditionalStyleEditor = (props) => {
2650
- const { style, onChange, className, ColorPickerComponent = ColorPicker$1 } = props;
2650
+ const { style, onChange, className, ColorPickerComponent = ColorPicker } = props;
2651
2651
  const [isBold, setIsBold] = useState(() => {
2652
2652
  if (!(style === null || style === void 0 ? void 0 : style.bl)) return;
2653
2653
  return style.bl;
@@ -3215,7 +3215,7 @@ const HighlightCellStyleEditor = (props) => {
3215
3215
  onChange: onTypeChange,
3216
3216
  value: subType,
3217
3217
  options: typeOptions
3218
- }), (operatorOptions === null || operatorOptions === void 0 ? void 0 : operatorOptions.length) && /* @__PURE__ */ jsx(SelectComponent, {
3218
+ }), !!(operatorOptions === null || operatorOptions === void 0 ? void 0 : operatorOptions.length) && /* @__PURE__ */ jsx(SelectComponent, {
3219
3219
  className: "univer-mt-3 univer-w-full",
3220
3220
  onChange: onOperatorChange,
3221
3221
  value: operator || "",
@@ -3288,15 +3288,6 @@ const TextInput = (props) => {
3288
3288
  })
3289
3289
  });
3290
3290
  };
3291
- const createDefaultConfigItem = (iconType, index, list) => ({
3292
- operator: CFNumberOperator.greaterThan,
3293
- value: {
3294
- type: CFValueType.num,
3295
- value: (list.length - 1 - index) * 10
3296
- },
3297
- iconType,
3298
- iconId: String(index)
3299
- });
3300
3291
  const IconGroupList = (props) => {
3301
3292
  const { iconType, onClick } = props;
3302
3293
  const localeService = useDependency(LocaleService);
@@ -3483,14 +3474,10 @@ const IconSetRuleEdit = (props) => {
3483
3474
  children: /* @__PURE__ */ jsx(DropdownComponent, {
3484
3475
  overlay: /* @__PURE__ */ jsx("div", {
3485
3476
  className: "univer-rounded-lg univer-p-4",
3486
- children: /* @__PURE__ */ jsx(IconItemList, {
3487
- onClick: handleIconClick,
3488
- iconId: item.iconId,
3489
- iconType: item.iconType
3490
- })
3477
+ children: /* @__PURE__ */ jsx(IconItemList, { onClick: handleIconClick })
3491
3478
  }),
3492
3479
  children: /* @__PURE__ */ jsxs("div", {
3493
- className: clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-text-gray-200", borderClassName),
3480
+ className: clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", borderClassName),
3494
3481
  children: [icon ? /* @__PURE__ */ jsx("img", {
3495
3482
  src: icon,
3496
3483
  className: "univer-size-4",
@@ -3505,7 +3492,7 @@ const IconSetRuleEdit = (props) => {
3505
3492
  handleOperatorChange(v, index);
3506
3493
  }
3507
3494
  }) : /* @__PURE__ */ jsxs("div", {
3508
- className: "univer-mt-0 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
3495
+ className: "univer-self-center univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
3509
3496
  children: [localeService.t("sheets-conditional-formatting-ui.iconSet.rule"), /* @__PURE__ */ jsxs("span", {
3510
3497
  className: "univer-font-medium",
3511
3498
  children: [
@@ -3558,6 +3545,15 @@ const IconSet = (props) => {
3558
3545
  const localeService = useDependency(LocaleService);
3559
3546
  const direction = useObservable(localeService.direction$, localeService.getDirection());
3560
3547
  const [errorMap, setErrorMap] = useState({});
3548
+ const createDefaultConfigItem = (iconType, index, list) => ({
3549
+ operator: CFNumberOperator.greaterThan,
3550
+ value: {
3551
+ type: CFValueType.num,
3552
+ value: (list.length - 1 - index) * 10
3553
+ },
3554
+ iconType,
3555
+ iconId: String(index)
3556
+ });
3561
3557
  const [currentIconType, setCurrentIconType] = useState(() => {
3562
3558
  const defaultV = Object.keys(iconMap)[0];
3563
3559
  if (rule && rule.config.length) {
@@ -3696,7 +3692,7 @@ const IconSet = (props) => {
3696
3692
  dir: direction,
3697
3693
  children: [
3698
3694
  /* @__PURE__ */ jsx("div", {
3699
- className: "univer-mt-4 univer-text-sm univer-text-gray-600",
3695
+ className: "univer-mt-4 univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
3700
3696
  children: localeService.t("sheets-conditional-formatting-ui.panel.styleRule")
3701
3697
  }),
3702
3698
  /* @__PURE__ */ jsx("div", {
@@ -3711,7 +3707,7 @@ const IconSet = (props) => {
3711
3707
  })
3712
3708
  }),
3713
3709
  children: /* @__PURE__ */ jsxs("div", {
3714
- className: clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600", borderClassName),
3710
+ className: clsx("univer-box-border univer-flex univer-h-8 univer-w-full univer-items-center univer-justify-between univer-rounded-md univer-bg-gray-0 univer-px-4 univer-py-2 univer-text-xs univer-text-gray-600 univer-transition-all hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-0", borderClassName),
3715
3711
  children: [previewIcon, /* @__PURE__ */ jsx(MoreDownIcon, {})]
3716
3712
  })
3717
3713
  })
@@ -4471,7 +4467,7 @@ const ConditionFormattingPanel = (props) => {
4471
4467
  setIsShowRuleEditor(true);
4472
4468
  };
4473
4469
  return /* @__PURE__ */ jsx("div", {
4474
- className: "univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4",
4470
+ className: "univer-box-border univer-flex univer-h-full univer-flex-col univer-justify-between univer-py-4",
4475
4471
  children: isShowRuleEditor ? /* @__PURE__ */ jsx(RuleEditComponent, {
4476
4472
  onCancel: handleCancel,
4477
4473
  rule: currentEditRule
@@ -4484,7 +4480,7 @@ const ConditionFormattingPanel = (props) => {
4484
4480
 
4485
4481
  // src/views/mobile/MobileColorPicker.tsx
4486
4482
  function MobileConditionalColorPicker(props) {
4487
- return /* @__PURE__ */ jsx(ColorPicker$1, {
4483
+ return /* @__PURE__ */ jsx(ColorPicker, {
4488
4484
  ...props,
4489
4485
  DropdownComponent: MobileDropdown,
4490
4486
  PickerComponent: MobileColorPicker