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

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/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { BooleanNumber, ColorKit, CommandType, DependentOn, Disposable, DisposableCollection, ICommandService, IConfigService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LocaleService, ObjectMatrix, Plugin, Range, Rectangle, Tools, UniverInstanceType, createInterceptorKey, generateRandomId, get, merge, registerDependencies, set, toDisposable, touchDependencies } from "@univerjs/core";
2
- import { AFTER_CELL_EDIT, AUTO_FILL_APPLY_TYPE, AutoFillTools, ClearSelectionAllCommand, ClearSelectionFormatCommand, IAutoFillService, INTERCEPTOR_POINT, RangeProtectionPermissionEditPoint, RemoveSheetMutation, SetSelectionsOperation, SetWorksheetActiveOperation, SheetInterceptorService, SheetPermissionCheckController, SheetsSelectionsService, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellStylePermission, checkRangesEditablePermission, getSheetCommandTarget, rangeToDiscreteRange, setEndForRange } from "@univerjs/sheets";
2
+ import { AFTER_CELL_EDIT, AUTO_FILL_APPLY_TYPE, AutoFillTools, ClearSelectionAllCommand, ClearSelectionFormatCommand, IAutoFillService, INTERCEPTOR_POINT, RangeProtectionPermissionEditPoint, RemoveSheetMutation, SetSelectionsOperation, SetWorksheetActiveOperation, SheetInterceptorService, SheetPermissionCheckController, SheetsSelectionsService, UniverSheetsPlugin, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellStylePermission, checkRangesEditablePermission, getSheetCommandTarget, rangeToDiscreteRange, setEndForRange } from "@univerjs/sheets";
3
3
  import { AddCfCommand, AddConditionalRuleMutation, AddConditionalRuleMutationUndoFactory, CFNumberOperator, CFRuleType, CFSubRuleType, CFTextOperator, CFTimePeriodOperator, CFValueType, CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH, ClearRangeCfCommand, ClearWorksheetCfCommand, ConditionalFormattingRangeIndexModel, ConditionalFormattingRangeTransformService, ConditionalFormattingRuleModel, ConditionalFormattingService, ConditionalFormattingViewModel, DEFAULT_BG_COLOR, DEFAULT_FONT_COLOR, DEFAULT_PADDING, DEFAULT_WIDTH, DeleteCfCommand, DeleteConditionalRuleMutation, DeleteConditionalRuleMutationUndoFactory, IIconSetType, MoveCfCommand, MoveConditionalRuleMutation, SHEET_CONDITIONAL_FORMATTING_PLUGIN, SetCfCommand, SetConditionalRuleMutation, UniverSheetsConditionalFormattingPlugin, compareWithNumber, createCfId, createDefaultRule, createDefaultValue, createDefaultValueByValueType, defaultDataBarNativeColor, defaultDataBarPositiveColor, getColorScaleFromValue, getOppositeOperator, iconGroup, iconMap, removeUndefinedAttr, setConditionalRuleMutationUndoFactory } from "@univerjs/sheets-conditional-formatting";
4
- import { ComponentManager, IMenuManagerService, ISidebarService, IconManager, MenuItemType, RibbonDataGroup, RibbonInsertGroup, getMenuHiddenObservable, useDependency, useObservable, useSidebarClick } from "@univerjs/ui";
5
- import { COPY_TYPE, FormatPainterStatus, IFormatPainterService, ISheetClipboardService, PREDEFINED_HOOK_NAME_PASTE, SheetSkeletonManagerService, getCurrentRangeDisable$, getRepeatRange, useHighlightRange, virtualizeDiscreteRanges } from "@univerjs/sheets-ui";
4
+ import { ComponentManager, IMenuManagerService, ISidebarService, IconManager, MenuItemType, RibbonDataGroup, RibbonInsertGroup, UniverUIPlugin, getMenuHiddenObservable, useDependency, useObservable, useSidebarClick } from "@univerjs/ui";
5
+ import { COPY_TYPE, FormatPainterStatus, IFormatPainterService, ISheetClipboardService, PREDEFINED_HOOK_NAME_PASTE, SheetSkeletonManagerService, UniverSheetsMobileUIPlugin, UniverSheetsUIPlugin, getCurrentRangeDisable$, getRepeatRange, useHighlightRange, virtualizeDiscreteRanges } from "@univerjs/sheets-ui";
6
6
  import { Observable, debounceTime, filter, map, merge as merge$1, share, startWith } from "rxjs";
7
7
  import { bufferTime, debounceTime as debounceTime$1, filter as filter$1 } from "rxjs/operators";
8
+ import { IRenderManagerService, UniverRenderEnginePlugin } from "@univerjs/engine-render";
8
9
  import { FormulaRefRangeService, UniverSheetsFormulaPlugin } from "@univerjs/sheets-formula";
9
- import { IRenderManagerService } from "@univerjs/engine-render";
10
10
  import { BoldIcon, ConditionsDoubleIcon, DataBarIcon, DeleteIcon, FontColorDoubleIcon, GripVerticalIcon, IncreaseIcon, ItalicIcon, MoreDownIcon, PaintBucketDoubleIcon, RatingIcon, SlashDoubleIcon, StrikethroughIcon, UnderlineIcon } from "@univerjs/icons";
11
11
  import { useEffect, useMemo, useRef, useState } from "react";
12
12
  import { Button, Checkbox, ColorPicker, DraggableList, Dropdown, Input, InputNumber, Radio, RadioGroup, Select, Tooltip, borderClassName, clsx } from "@univerjs/design";
@@ -365,7 +365,7 @@ const AddUniqueValuesCfCommand = {
365
365
  };
366
366
 
367
367
  //#endregion
368
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
368
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
369
369
  function _typeof(o) {
370
370
  "@babel/helpers - typeof";
371
371
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -376,7 +376,7 @@ function _typeof(o) {
376
376
  }
377
377
 
378
378
  //#endregion
379
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
379
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
380
380
  function toPrimitive(t, r) {
381
381
  if ("object" != _typeof(t) || !t) return t;
382
382
  var e = t[Symbol.toPrimitive];
@@ -389,14 +389,14 @@ function toPrimitive(t, r) {
389
389
  }
390
390
 
391
391
  //#endregion
392
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
392
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
393
393
  function toPropertyKey(t) {
394
394
  var i = toPrimitive(t, "string");
395
395
  return "symbol" == _typeof(i) ? i : i + "";
396
396
  }
397
397
 
398
398
  //#endregion
399
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
399
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
400
400
  function _defineProperty(e, r, t) {
401
401
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
402
402
  value: t,
@@ -407,7 +407,7 @@ function _defineProperty(e, r, t) {
407
407
  }
408
408
 
409
409
  //#endregion
410
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
410
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
411
411
  function __decorateParam(paramIndex, decorator) {
412
412
  return function(target, key) {
413
413
  decorator(target, key, paramIndex);
@@ -415,7 +415,7 @@ function __decorateParam(paramIndex, decorator) {
415
415
  }
416
416
 
417
417
  //#endregion
418
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
418
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
419
419
  function __decorate(decorators, target, key, desc) {
420
420
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
421
421
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -986,7 +986,7 @@ const menuSchema = {
986
986
  //#endregion
987
987
  //#region package.json
988
988
  var name = "@univerjs/sheets-conditional-formatting-ui";
989
- var version = "1.0.0-alpha.7";
989
+ var version = "1.0.0-alpha.8";
990
990
 
991
991
  //#endregion
992
992
  //#region src/config/config.ts
@@ -1543,7 +1543,7 @@ let SheetsCfRenderController = class SheetsCfRenderController extends Disposable
1543
1543
  if (!workbook || !worksheet) return;
1544
1544
  const unitId = workbook.getUnitId();
1545
1545
  const subUnitId = worksheet.getSheetId();
1546
- const render = this._renderManagerService.getRenderById(unitId);
1546
+ const render = this._renderManagerService.getRenderUnitById(unitId);
1547
1547
  const skeletonManagerService = render === null || render === void 0 ? void 0 : render.with(SheetSkeletonManagerService);
1548
1548
  const currentSkeleton = skeletonManagerService === null || skeletonManagerService === void 0 ? void 0 : skeletonManagerService.getCurrentSkeleton();
1549
1549
  const dirtyRanges = this._intersectDirtyRangesWithRenderedRange(this._collectDirtyRanges(items, unitId, subUnitId), currentSkeleton === null || currentSkeleton === void 0 ? void 0 : currentSkeleton.rowColumnSegment);
@@ -1657,7 +1657,7 @@ _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "packageName",
1657
1657
  _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "version", version);
1658
1658
  _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
1659
1659
  UniverSheetsConditionalFormattingMobileUIPlugin = __decorate([
1660
- DependentOn(UniverSheetsConditionalFormattingPlugin),
1660
+ DependentOn(UniverRenderEnginePlugin, UniverSheetsPlugin, UniverSheetsFormulaPlugin, UniverSheetsConditionalFormattingPlugin, UniverSheetsMobileUIPlugin),
1661
1661
  __decorateParam(1, Inject(Injector)),
1662
1662
  __decorateParam(2, Inject(ICommandService)),
1663
1663
  __decorateParam(3, IConfigService)
@@ -2209,7 +2209,7 @@ let ConditionalFormattingViewportController = class ConditionalFormattingViewpor
2209
2209
  this._unitDisposable.dispose();
2210
2210
  this._unitDisposable = new DisposableCollection();
2211
2211
  const unitId = unit.getUnitId();
2212
- const render = this._renderManagerService.getRenderById(unitId);
2212
+ const render = this._renderManagerService.getRenderUnitById(unitId);
2213
2213
  if (!render) return;
2214
2214
  const sheetSkeletonManagerService = render.with(SheetSkeletonManagerService);
2215
2215
  this._unitDisposable.add(sheetSkeletonManagerService.currentSkeleton$.subscribe((s) => {
@@ -2248,10 +2248,11 @@ const ColorPicker$1 = (props) => {
2248
2248
  const { color, onChange, disable = false, Icon = PaintBucketDoubleIcon, className } = props;
2249
2249
  const colorKit = useMemo(() => new ColorKit(color), [color]);
2250
2250
  const renderIcon = () => {
2251
- return /* @__PURE__ */ jsx(Icon, {
2251
+ const iconProps = {
2252
2252
  className: clsx("univer-fill-primary-600", disable && className),
2253
2253
  extend: { colorChannel1: colorKit.isValid ? color : "" }
2254
- });
2254
+ };
2255
+ return /* @__PURE__ */ jsx(Icon, { ...iconProps });
2255
2256
  };
2256
2257
  return !disable ? /* @__PURE__ */ jsx(Dropdown, {
2257
2258
  overlay: /* @__PURE__ */ jsx("div", {
@@ -2410,7 +2411,7 @@ const TextInput$1 = (props) => {
2410
2411
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = useState(false);
2411
2412
  useSidebarClick((e) => {
2412
2413
  var _formulaEditorRef$cur;
2413
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2414
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2414
2415
  });
2415
2416
  if (type === CFValueType.formula) return /* @__PURE__ */ jsx("div", {
2416
2417
  className: "univer-ml-1 univer-w-full",
@@ -2818,7 +2819,7 @@ const InputText = (props) => {
2818
2819
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = useState(false);
2819
2820
  useSidebarClick((e) => {
2820
2821
  var _formulaEditorRef$cur;
2821
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2822
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2822
2823
  });
2823
2824
  const _value = useRef(value);
2824
2825
  const config = useMemo(() => {
@@ -3344,7 +3345,7 @@ const FormulaStyleEditor = (props) => {
3344
3345
  };
3345
3346
  useSidebarClick((e) => {
3346
3347
  var _formulaEditorRef$cur;
3347
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3348
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3348
3349
  });
3349
3350
  return /* @__PURE__ */ jsxs("div", {
3350
3351
  ref: divEleRef,
@@ -3820,7 +3821,7 @@ const TextInput = (props) => {
3820
3821
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = useState(false);
3821
3822
  useSidebarClick((e) => {
3822
3823
  var _formulaEditorRef$cur;
3823
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3824
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3824
3825
  });
3825
3826
  return /* @__PURE__ */ jsx("div", {
3826
3827
  className: "univer-relative",
@@ -3980,7 +3981,8 @@ const IconSetRuleEdit = (props) => {
3980
3981
  };
3981
3982
  const handleOperatorChange = (operator, index) => {
3982
3983
  onChange([String(index), "operator"], operator);
3983
- handleValueValueChange(createDefaultValue(CFSubRuleType.number, operator), index);
3984
+ const defaultValue = createDefaultValue(CFSubRuleType.number, operator);
3985
+ handleValueValueChange(defaultValue, index);
3984
3986
  };
3985
3987
  const handleValueTypeChange = (v, index) => {
3986
3988
  onChange([
@@ -3989,7 +3991,8 @@ const IconSetRuleEdit = (props) => {
3989
3991
  "type"
3990
3992
  ], v);
3991
3993
  const item = configList[index];
3992
- handleValueValueChange(createDefaultValue(CFSubRuleType.number, item.operator), index);
3994
+ const defaultValue = createDefaultValue(CFSubRuleType.number, item.operator);
3995
+ handleValueValueChange(defaultValue, index);
3993
3996
  };
3994
3997
  return useMemo(() => {
3995
3998
  return configList.map((item, index) => {
@@ -4228,7 +4231,8 @@ const IconSet = (props) => {
4228
4231
  const reverseIcon = () => {
4229
4232
  const iconList = configList.map((item) => ({ ...item }));
4230
4233
  configList.forEach((item, index) => {
4231
- const newIcon = iconList[configList.length - 1 - index];
4234
+ const mirrorIndex = configList.length - 1 - index;
4235
+ const newIcon = iconList[mirrorIndex];
4232
4236
  item.iconId = newIcon.iconId;
4233
4237
  item.iconType = newIcon.iconType;
4234
4238
  });
@@ -4604,7 +4608,8 @@ const RuleEdit = (props) => {
4604
4608
  const onRangeSelectorChange = (rangeString) => {
4605
4609
  if (!rangeSelectorTouched.current && rangeString.length < 1 && rangeResult.current.length > 0) return;
4606
4610
  rangeSelectorTouched.current = true;
4607
- rangeResult.current = rangeString.split(",").filter((e) => !!e).map(deserializeRangeWithSheet).map((item) => item.range);
4611
+ const result = rangeString.split(",").filter((e) => !!e).map(deserializeRangeWithSheet).map((item) => item.range);
4612
+ rangeResult.current = result;
4608
4613
  };
4609
4614
  const handleSubmit = () => {
4610
4615
  const getRanges = () => {
@@ -5128,7 +5133,7 @@ _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "packageName", name);
5128
5133
  _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "version", version);
5129
5134
  _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
5130
5135
  UniverSheetsConditionalFormattingUIPlugin = __decorate([
5131
- DependentOn(UniverSheetsConditionalFormattingPlugin, UniverSheetsFormulaPlugin),
5136
+ DependentOn(UniverRenderEnginePlugin, UniverSheetsPlugin, UniverUIPlugin, UniverSheetsFormulaPlugin, UniverSheetsConditionalFormattingPlugin, UniverSheetsUIPlugin),
5132
5137
  __decorateParam(1, Inject(Injector)),
5133
5138
  __decorateParam(2, Inject(ICommandService)),
5134
5139
  __decorateParam(3, IConfigService)
@@ -87,9 +87,9 @@ const locale = { "sheets-conditional-formatting-ui": {
87
87
  lastWeek: "Semana pasada",
88
88
  nextWeek: "Semana siguiente",
89
89
  today: "Hoy",
90
- topN: "Top {0}",
90
+ topN: "Principales {0}",
91
91
  bottomN: "Inferior {0}",
92
- topNPercent: "Top {0}%",
92
+ topNPercent: "Principales {0}%",
93
93
  bottomNPercent: "Inferior {0}%"
94
94
  } },
95
95
  operator: {
@@ -150,7 +150,7 @@ const locale = { "sheets-conditional-formatting-ui": {
150
150
  errorMessage: {
151
151
  notBlank: "شرط نمی‌تواند خالی باشد",
152
152
  formulaError: "فرمول اشتباه",
153
- rangeError: "Bad selection"
153
+ rangeError: "انتخاب نامعتبر"
154
154
  },
155
155
  permission: { dialog: { setStyleErr: "محدوده محافظت شده است و شما مجوز تنظیم سبک‌ها را ندارید. برای تنظیم سبک‌ها، لطفا با سازنده تماس بگیرید." } }
156
156
  } };
@@ -87,9 +87,9 @@ const locale = { "sheets-conditional-formatting-ui": {
87
87
  lastWeek: "Poprzedni tydzień",
88
88
  nextWeek: "Następny tydzień",
89
89
  today: "Dzisiaj",
90
- topN: "Top {0}",
90
+ topN: "Górne {0}",
91
91
  bottomN: "Ostatnie {0}",
92
- topNPercent: "Top {0}%",
92
+ topNPercent: "Górne {0}%",
93
93
  bottomNPercent: "Ostatnie {0}%"
94
94
  } },
95
95
  operator: {
@@ -87,9 +87,9 @@ const locale = { "sheets-conditional-formatting-ui": {
87
87
  lastWeek: "Tuần trước",
88
88
  nextWeek: "Tuần sau",
89
89
  today: "Hôm nay",
90
- topN: "Top {0}",
90
+ topN: "Trên cùng {0}",
91
91
  bottomN: "Cuối {0}",
92
- topNPercent: "Top {0}%",
92
+ topNPercent: "Trên cùng {0}%",
93
93
  bottomNPercent: "Cuối {0}%"
94
94
  } },
95
95
  operator: {
@@ -150,7 +150,7 @@ const locale = { "sheets-conditional-formatting-ui": {
150
150
  errorMessage: {
151
151
  notBlank: "Điều kiện không được để trống",
152
152
  formulaError: "Lỗi công thức",
153
- rangeError: "Bad selection"
153
+ rangeError: "Lựa chọn không hợp lệ"
154
154
  },
155
155
  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." } }
156
156
  } };