@univerjs/sheets-conditional-formatting-ui 1.0.0-alpha.6 → 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/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");
@@ -366,7 +366,7 @@ const AddUniqueValuesCfCommand = {
366
366
  };
367
367
 
368
368
  //#endregion
369
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
369
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
370
370
  function _typeof(o) {
371
371
  "@babel/helpers - typeof";
372
372
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -377,7 +377,7 @@ function _typeof(o) {
377
377
  }
378
378
 
379
379
  //#endregion
380
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
380
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
381
381
  function toPrimitive(t, r) {
382
382
  if ("object" != _typeof(t) || !t) return t;
383
383
  var e = t[Symbol.toPrimitive];
@@ -390,14 +390,14 @@ function toPrimitive(t, r) {
390
390
  }
391
391
 
392
392
  //#endregion
393
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
393
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
394
394
  function toPropertyKey(t) {
395
395
  var i = toPrimitive(t, "string");
396
396
  return "symbol" == _typeof(i) ? i : i + "";
397
397
  }
398
398
 
399
399
  //#endregion
400
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
400
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
401
401
  function _defineProperty(e, r, t) {
402
402
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
403
403
  value: t,
@@ -408,7 +408,7 @@ function _defineProperty(e, r, t) {
408
408
  }
409
409
 
410
410
  //#endregion
411
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
411
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
412
412
  function __decorateParam(paramIndex, decorator) {
413
413
  return function(target, key) {
414
414
  decorator(target, key, paramIndex);
@@ -416,7 +416,7 @@ function __decorateParam(paramIndex, decorator) {
416
416
  }
417
417
 
418
418
  //#endregion
419
- //#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
419
+ //#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
420
420
  function __decorate(decorators, target, key, desc) {
421
421
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
422
422
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -799,14 +799,14 @@ function FactoryManageConditionalFormattingRule(accessor) {
799
799
  subscriber.next(hasPermission);
800
800
  }));
801
801
  const selections$ = new rxjs.Observable((subscriber) => {
802
- clearRangeEnable$.subscribe((v) => {
802
+ const clearRangeSubscription = clearRangeEnable$.subscribe((v) => {
803
803
  const item = commonSelections.find((item) => item.value === 9);
804
804
  if (item) {
805
805
  item.disabled = !v;
806
806
  subscriber.next(commonSelections);
807
807
  }
808
808
  });
809
- clearSheetEnable$.subscribe((v) => {
809
+ const clearSheetSubscription = clearSheetEnable$.subscribe((v) => {
810
810
  const item = commonSelections.find((item) => item.value === 10);
811
811
  if (item) {
812
812
  item.disabled = !v;
@@ -814,6 +814,10 @@ function FactoryManageConditionalFormattingRule(accessor) {
814
814
  }
815
815
  });
816
816
  subscriber.next(commonSelections);
817
+ return () => {
818
+ clearRangeSubscription.unsubscribe();
819
+ clearSheetSubscription.unsubscribe();
820
+ };
817
821
  });
818
822
  return {
819
823
  id: OpenConditionalFormattingOperator.id,
@@ -971,6 +975,11 @@ const menuSchema = {
971
975
  },
972
976
  [_univerjs_ui.RibbonDataGroup.RULES]: { [OpenConditionalFormattingOperator.id]: {
973
977
  order: 1,
978
+ gridLayout: {
979
+ row: 2,
980
+ column: 1,
981
+ showLabel: true
982
+ },
974
983
  menuItemFactory: FactoryManageConditionalFormattingRule
975
984
  } }
976
985
  };
@@ -978,7 +987,7 @@ const menuSchema = {
978
987
  //#endregion
979
988
  //#region package.json
980
989
  var name = "@univerjs/sheets-conditional-formatting-ui";
981
- var version = "1.0.0-alpha.6";
990
+ var version = "1.0.0-alpha.8";
982
991
 
983
992
  //#endregion
984
993
  //#region src/config/config.ts
@@ -1535,7 +1544,7 @@ let SheetsCfRenderController = class SheetsCfRenderController extends _univerjs_
1535
1544
  if (!workbook || !worksheet) return;
1536
1545
  const unitId = workbook.getUnitId();
1537
1546
  const subUnitId = worksheet.getSheetId();
1538
- const render = this._renderManagerService.getRenderById(unitId);
1547
+ const render = this._renderManagerService.getRenderUnitById(unitId);
1539
1548
  const skeletonManagerService = render === null || render === void 0 ? void 0 : render.with(_univerjs_sheets_ui.SheetSkeletonManagerService);
1540
1549
  const currentSkeleton = skeletonManagerService === null || skeletonManagerService === void 0 ? void 0 : skeletonManagerService.getCurrentSkeleton();
1541
1550
  const dirtyRanges = this._intersectDirtyRangesWithRenderedRange(this._collectDirtyRanges(items, unitId, subUnitId), currentSkeleton === null || currentSkeleton === void 0 ? void 0 : currentSkeleton.rowColumnSegment);
@@ -1649,7 +1658,7 @@ _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "packageName",
1649
1658
  _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "version", version);
1650
1659
  _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
1651
1660
  UniverSheetsConditionalFormattingMobileUIPlugin = __decorate([
1652
- (0, _univerjs_core.DependentOn)(_univerjs_sheets_conditional_formatting.UniverSheetsConditionalFormattingPlugin),
1661
+ (0, _univerjs_core.DependentOn)(_univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_sheets_formula.UniverSheetsFormulaPlugin, _univerjs_sheets_conditional_formatting.UniverSheetsConditionalFormattingPlugin, _univerjs_sheets_ui.UniverSheetsMobileUIPlugin),
1653
1662
  __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
1654
1663
  __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService)),
1655
1664
  __decorateParam(3, _univerjs_core.IConfigService)
@@ -2201,7 +2210,7 @@ let ConditionalFormattingViewportController = class ConditionalFormattingViewpor
2201
2210
  this._unitDisposable.dispose();
2202
2211
  this._unitDisposable = new _univerjs_core.DisposableCollection();
2203
2212
  const unitId = unit.getUnitId();
2204
- const render = this._renderManagerService.getRenderById(unitId);
2213
+ const render = this._renderManagerService.getRenderUnitById(unitId);
2205
2214
  if (!render) return;
2206
2215
  const sheetSkeletonManagerService = render.with(_univerjs_sheets_ui.SheetSkeletonManagerService);
2207
2216
  this._unitDisposable.add(sheetSkeletonManagerService.currentSkeleton$.subscribe((s) => {
@@ -2240,10 +2249,11 @@ const ColorPicker = (props) => {
2240
2249
  const { color, onChange, disable = false, Icon = _univerjs_icons.PaintBucketDoubleIcon, className } = props;
2241
2250
  const colorKit = (0, react.useMemo)(() => new _univerjs_core.ColorKit(color), [color]);
2242
2251
  const renderIcon = () => {
2243
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
2252
+ const iconProps = {
2244
2253
  className: (0, _univerjs_design.clsx)("univer-fill-primary-600", disable && className),
2245
2254
  extend: { colorChannel1: colorKit.isValid ? color : "" }
2246
- });
2255
+ };
2256
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { ...iconProps });
2247
2257
  };
2248
2258
  return !disable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
2249
2259
  overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -2402,7 +2412,7 @@ const TextInput$1 = (props) => {
2402
2412
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = (0, react.useState)(false);
2403
2413
  (0, _univerjs_ui.useSidebarClick)((e) => {
2404
2414
  var _formulaEditorRef$cur;
2405
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2415
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2406
2416
  });
2407
2417
  if (type === _univerjs_sheets_conditional_formatting.CFValueType.formula) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2408
2418
  className: "univer-ml-1 univer-w-full",
@@ -2810,7 +2820,7 @@ const InputText = (props) => {
2810
2820
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = (0, react.useState)(false);
2811
2821
  (0, _univerjs_ui.useSidebarClick)((e) => {
2812
2822
  var _formulaEditorRef$cur;
2813
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2823
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
2814
2824
  });
2815
2825
  const _value = (0, react.useRef)(value);
2816
2826
  const config = (0, react.useMemo)(() => {
@@ -3336,7 +3346,7 @@ const FormulaStyleEditor = (props) => {
3336
3346
  };
3337
3347
  (0, _univerjs_ui.useSidebarClick)((e) => {
3338
3348
  var _formulaEditorRef$cur;
3339
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3349
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3340
3350
  });
3341
3351
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3342
3352
  ref: divEleRef,
@@ -3812,7 +3822,7 @@ const TextInput = (props) => {
3812
3822
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = (0, react.useState)(false);
3813
3823
  (0, _univerjs_ui.useSidebarClick)((e) => {
3814
3824
  var _formulaEditorRef$cur;
3815
- !((_formulaEditorRef$cur = formulaEditorRef.current) === null || _formulaEditorRef$cur === void 0) && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3825
+ (_formulaEditorRef$cur = formulaEditorRef.current) !== null && _formulaEditorRef$cur !== void 0 && _formulaEditorRef$cur.isClickOutSide(e) && setIsFocusFormulaEditor(false);
3816
3826
  });
3817
3827
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3818
3828
  className: "univer-relative",
@@ -3972,7 +3982,8 @@ const IconSetRuleEdit = (props) => {
3972
3982
  };
3973
3983
  const handleOperatorChange = (operator, index) => {
3974
3984
  onChange([String(index), "operator"], operator);
3975
- handleValueValueChange((0, _univerjs_sheets_conditional_formatting.createDefaultValue)(_univerjs_sheets_conditional_formatting.CFSubRuleType.number, operator), index);
3985
+ const defaultValue = (0, _univerjs_sheets_conditional_formatting.createDefaultValue)(_univerjs_sheets_conditional_formatting.CFSubRuleType.number, operator);
3986
+ handleValueValueChange(defaultValue, index);
3976
3987
  };
3977
3988
  const handleValueTypeChange = (v, index) => {
3978
3989
  onChange([
@@ -3981,7 +3992,8 @@ const IconSetRuleEdit = (props) => {
3981
3992
  "type"
3982
3993
  ], v);
3983
3994
  const item = configList[index];
3984
- handleValueValueChange((0, _univerjs_sheets_conditional_formatting.createDefaultValue)(_univerjs_sheets_conditional_formatting.CFSubRuleType.number, item.operator), index);
3995
+ const defaultValue = (0, _univerjs_sheets_conditional_formatting.createDefaultValue)(_univerjs_sheets_conditional_formatting.CFSubRuleType.number, item.operator);
3996
+ handleValueValueChange(defaultValue, index);
3985
3997
  };
3986
3998
  return (0, react.useMemo)(() => {
3987
3999
  return configList.map((item, index) => {
@@ -4220,7 +4232,8 @@ const IconSet = (props) => {
4220
4232
  const reverseIcon = () => {
4221
4233
  const iconList = configList.map((item) => ({ ...item }));
4222
4234
  configList.forEach((item, index) => {
4223
- const newIcon = iconList[configList.length - 1 - index];
4235
+ const mirrorIndex = configList.length - 1 - index;
4236
+ const newIcon = iconList[mirrorIndex];
4224
4237
  item.iconId = newIcon.iconId;
4225
4238
  item.iconType = newIcon.iconType;
4226
4239
  });
@@ -4596,7 +4609,8 @@ const RuleEdit = (props) => {
4596
4609
  const onRangeSelectorChange = (rangeString) => {
4597
4610
  if (!rangeSelectorTouched.current && rangeString.length < 1 && rangeResult.current.length > 0) return;
4598
4611
  rangeSelectorTouched.current = true;
4599
- rangeResult.current = rangeString.split(",").filter((e) => !!e).map(_univerjs_engine_formula.deserializeRangeWithSheet).map((item) => item.range);
4612
+ const result = rangeString.split(",").filter((e) => !!e).map(_univerjs_engine_formula.deserializeRangeWithSheet).map((item) => item.range);
4613
+ rangeResult.current = result;
4600
4614
  };
4601
4615
  const handleSubmit = () => {
4602
4616
  const getRanges = () => {
@@ -5120,7 +5134,7 @@ _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "packageName", name);
5120
5134
  _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "version", version);
5121
5135
  _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
5122
5136
  UniverSheetsConditionalFormattingUIPlugin = __decorate([
5123
- (0, _univerjs_core.DependentOn)(_univerjs_sheets_conditional_formatting.UniverSheetsConditionalFormattingPlugin, _univerjs_sheets_formula.UniverSheetsFormulaPlugin),
5137
+ (0, _univerjs_core.DependentOn)(_univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_ui.UniverUIPlugin, _univerjs_sheets_formula.UniverSheetsFormulaPlugin, _univerjs_sheets_conditional_formatting.UniverSheetsConditionalFormattingPlugin, _univerjs_sheets_ui.UniverSheetsUIPlugin),
5124
5138
  __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
5125
5139
  __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.ICommandService)),
5126
5140
  __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
  } };
package/lib/es/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);
@@ -798,14 +798,14 @@ function FactoryManageConditionalFormattingRule(accessor) {
798
798
  subscriber.next(hasPermission);
799
799
  }));
800
800
  const selections$ = new Observable((subscriber) => {
801
- clearRangeEnable$.subscribe((v) => {
801
+ const clearRangeSubscription = clearRangeEnable$.subscribe((v) => {
802
802
  const item = commonSelections.find((item) => item.value === 9);
803
803
  if (item) {
804
804
  item.disabled = !v;
805
805
  subscriber.next(commonSelections);
806
806
  }
807
807
  });
808
- clearSheetEnable$.subscribe((v) => {
808
+ const clearSheetSubscription = clearSheetEnable$.subscribe((v) => {
809
809
  const item = commonSelections.find((item) => item.value === 10);
810
810
  if (item) {
811
811
  item.disabled = !v;
@@ -813,6 +813,10 @@ function FactoryManageConditionalFormattingRule(accessor) {
813
813
  }
814
814
  });
815
815
  subscriber.next(commonSelections);
816
+ return () => {
817
+ clearRangeSubscription.unsubscribe();
818
+ clearSheetSubscription.unsubscribe();
819
+ };
816
820
  });
817
821
  return {
818
822
  id: OpenConditionalFormattingOperator.id,
@@ -970,6 +974,11 @@ const menuSchema = {
970
974
  },
971
975
  [RibbonDataGroup.RULES]: { [OpenConditionalFormattingOperator.id]: {
972
976
  order: 1,
977
+ gridLayout: {
978
+ row: 2,
979
+ column: 1,
980
+ showLabel: true
981
+ },
973
982
  menuItemFactory: FactoryManageConditionalFormattingRule
974
983
  } }
975
984
  };
@@ -977,7 +986,7 @@ const menuSchema = {
977
986
  //#endregion
978
987
  //#region package.json
979
988
  var name = "@univerjs/sheets-conditional-formatting-ui";
980
- var version = "1.0.0-alpha.6";
989
+ var version = "1.0.0-alpha.8";
981
990
 
982
991
  //#endregion
983
992
  //#region src/config/config.ts
@@ -1534,7 +1543,7 @@ let SheetsCfRenderController = class SheetsCfRenderController extends Disposable
1534
1543
  if (!workbook || !worksheet) return;
1535
1544
  const unitId = workbook.getUnitId();
1536
1545
  const subUnitId = worksheet.getSheetId();
1537
- const render = this._renderManagerService.getRenderById(unitId);
1546
+ const render = this._renderManagerService.getRenderUnitById(unitId);
1538
1547
  const skeletonManagerService = render === null || render === void 0 ? void 0 : render.with(SheetSkeletonManagerService);
1539
1548
  const currentSkeleton = skeletonManagerService === null || skeletonManagerService === void 0 ? void 0 : skeletonManagerService.getCurrentSkeleton();
1540
1549
  const dirtyRanges = this._intersectDirtyRangesWithRenderedRange(this._collectDirtyRanges(items, unitId, subUnitId), currentSkeleton === null || currentSkeleton === void 0 ? void 0 : currentSkeleton.rowColumnSegment);
@@ -1648,7 +1657,7 @@ _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "packageName",
1648
1657
  _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "version", version);
1649
1658
  _defineProperty(UniverSheetsConditionalFormattingMobileUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
1650
1659
  UniverSheetsConditionalFormattingMobileUIPlugin = __decorate([
1651
- DependentOn(UniverSheetsConditionalFormattingPlugin),
1660
+ DependentOn(UniverRenderEnginePlugin, UniverSheetsPlugin, UniverSheetsFormulaPlugin, UniverSheetsConditionalFormattingPlugin, UniverSheetsMobileUIPlugin),
1652
1661
  __decorateParam(1, Inject(Injector)),
1653
1662
  __decorateParam(2, Inject(ICommandService)),
1654
1663
  __decorateParam(3, IConfigService)
@@ -2200,7 +2209,7 @@ let ConditionalFormattingViewportController = class ConditionalFormattingViewpor
2200
2209
  this._unitDisposable.dispose();
2201
2210
  this._unitDisposable = new DisposableCollection();
2202
2211
  const unitId = unit.getUnitId();
2203
- const render = this._renderManagerService.getRenderById(unitId);
2212
+ const render = this._renderManagerService.getRenderUnitById(unitId);
2204
2213
  if (!render) return;
2205
2214
  const sheetSkeletonManagerService = render.with(SheetSkeletonManagerService);
2206
2215
  this._unitDisposable.add(sheetSkeletonManagerService.currentSkeleton$.subscribe((s) => {
@@ -2239,10 +2248,11 @@ const ColorPicker$1 = (props) => {
2239
2248
  const { color, onChange, disable = false, Icon = PaintBucketDoubleIcon, className } = props;
2240
2249
  const colorKit = useMemo(() => new ColorKit(color), [color]);
2241
2250
  const renderIcon = () => {
2242
- return /* @__PURE__ */ jsx(Icon, {
2251
+ const iconProps = {
2243
2252
  className: clsx("univer-fill-primary-600", disable && className),
2244
2253
  extend: { colorChannel1: colorKit.isValid ? color : "" }
2245
- });
2254
+ };
2255
+ return /* @__PURE__ */ jsx(Icon, { ...iconProps });
2246
2256
  };
2247
2257
  return !disable ? /* @__PURE__ */ jsx(Dropdown, {
2248
2258
  overlay: /* @__PURE__ */ jsx("div", {
@@ -2401,7 +2411,7 @@ const TextInput$1 = (props) => {
2401
2411
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = useState(false);
2402
2412
  useSidebarClick((e) => {
2403
2413
  var _formulaEditorRef$cur;
2404
- !((_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);
2405
2415
  });
2406
2416
  if (type === CFValueType.formula) return /* @__PURE__ */ jsx("div", {
2407
2417
  className: "univer-ml-1 univer-w-full",
@@ -2809,7 +2819,7 @@ const InputText = (props) => {
2809
2819
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = useState(false);
2810
2820
  useSidebarClick((e) => {
2811
2821
  var _formulaEditorRef$cur;
2812
- !((_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);
2813
2823
  });
2814
2824
  const _value = useRef(value);
2815
2825
  const config = useMemo(() => {
@@ -3335,7 +3345,7 @@ const FormulaStyleEditor = (props) => {
3335
3345
  };
3336
3346
  useSidebarClick((e) => {
3337
3347
  var _formulaEditorRef$cur;
3338
- !((_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);
3339
3349
  });
3340
3350
  return /* @__PURE__ */ jsxs("div", {
3341
3351
  ref: divEleRef,
@@ -3811,7 +3821,7 @@ const TextInput = (props) => {
3811
3821
  const [isFocusFormulaEditor, setIsFocusFormulaEditor] = useState(false);
3812
3822
  useSidebarClick((e) => {
3813
3823
  var _formulaEditorRef$cur;
3814
- !((_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);
3815
3825
  });
3816
3826
  return /* @__PURE__ */ jsx("div", {
3817
3827
  className: "univer-relative",
@@ -3971,7 +3981,8 @@ const IconSetRuleEdit = (props) => {
3971
3981
  };
3972
3982
  const handleOperatorChange = (operator, index) => {
3973
3983
  onChange([String(index), "operator"], operator);
3974
- handleValueValueChange(createDefaultValue(CFSubRuleType.number, operator), index);
3984
+ const defaultValue = createDefaultValue(CFSubRuleType.number, operator);
3985
+ handleValueValueChange(defaultValue, index);
3975
3986
  };
3976
3987
  const handleValueTypeChange = (v, index) => {
3977
3988
  onChange([
@@ -3980,7 +3991,8 @@ const IconSetRuleEdit = (props) => {
3980
3991
  "type"
3981
3992
  ], v);
3982
3993
  const item = configList[index];
3983
- handleValueValueChange(createDefaultValue(CFSubRuleType.number, item.operator), index);
3994
+ const defaultValue = createDefaultValue(CFSubRuleType.number, item.operator);
3995
+ handleValueValueChange(defaultValue, index);
3984
3996
  };
3985
3997
  return useMemo(() => {
3986
3998
  return configList.map((item, index) => {
@@ -4219,7 +4231,8 @@ const IconSet = (props) => {
4219
4231
  const reverseIcon = () => {
4220
4232
  const iconList = configList.map((item) => ({ ...item }));
4221
4233
  configList.forEach((item, index) => {
4222
- const newIcon = iconList[configList.length - 1 - index];
4234
+ const mirrorIndex = configList.length - 1 - index;
4235
+ const newIcon = iconList[mirrorIndex];
4223
4236
  item.iconId = newIcon.iconId;
4224
4237
  item.iconType = newIcon.iconType;
4225
4238
  });
@@ -4595,7 +4608,8 @@ const RuleEdit = (props) => {
4595
4608
  const onRangeSelectorChange = (rangeString) => {
4596
4609
  if (!rangeSelectorTouched.current && rangeString.length < 1 && rangeResult.current.length > 0) return;
4597
4610
  rangeSelectorTouched.current = true;
4598
- 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;
4599
4613
  };
4600
4614
  const handleSubmit = () => {
4601
4615
  const getRanges = () => {
@@ -5119,7 +5133,7 @@ _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "packageName", name);
5119
5133
  _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "version", version);
5120
5134
  _defineProperty(UniverSheetsConditionalFormattingUIPlugin, "type", UniverInstanceType.UNIVER_SHEET);
5121
5135
  UniverSheetsConditionalFormattingUIPlugin = __decorate([
5122
- DependentOn(UniverSheetsConditionalFormattingPlugin, UniverSheetsFormulaPlugin),
5136
+ DependentOn(UniverRenderEnginePlugin, UniverSheetsPlugin, UniverUIPlugin, UniverSheetsFormulaPlugin, UniverSheetsConditionalFormattingPlugin, UniverSheetsUIPlugin),
5123
5137
  __decorateParam(1, Inject(Injector)),
5124
5138
  __decorateParam(2, Inject(ICommandService)),
5125
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
  } };