@univerjs/sheets-data-validation-ui 0.4.0 → 0.4.1-experimental.20241022-507567a

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/es/index.js CHANGED
@@ -5,14 +5,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "sym
5
5
  import React, { useState, forwardRef, useRef, createElement, useMemo, useEffect } from "react";
6
6
  import { Inject, LocaleService, Disposable, DataValidationErrorStyle, useDependency, ICommandService, numfmt, CellValueType, UniverInstanceType, toDisposable, IUniverInstanceService, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DisposableCollection, CommandType, BuildTextUtils, DataValidationRenderMode, DataValidationType, IConfigService, UndoCommand, RedoCommand, isUnitRangesEqual, debounce, shallowEqual, Injector, DataValidationStatus, ObjectMatrix, Range, Rectangle, queryObjectMatrix, Optional, RxDisposable, InterceptorEffectEnum, sequenceExecute, bufferDebounceTime, createInternalEditorID, isFormulaString, Tools, ThemeService, VerticalAlign, HorizontalAlign, DEFAULT_STYLES, WrapStrategy, DocumentDataModel, DEFAULT_EMPTY_DOCUMENT_VALUE, BooleanNumber, Plugin } from "@univerjs/core";
7
7
  import { Button, DatePanel, RectPopup, Scrollbar, FormLayout, RadioGroup, Radio, Checkbox, Input, Select, DraggableList } from "@univerjs/design";
8
+ import { DeviceInputEventType, IRenderManagerService, fixLineWidthByScale, Transform, Checkbox as Checkbox$1, FontCache, Shape, Rect, getFontStyleString, getDocsSkeletonPageSize, DocumentViewModel, DocumentSkeleton, Documents } from "@univerjs/engine-render";
8
9
  import { SetRangeValuesCommand, SheetsSelectionsService, getSheetCommandTarget, WorkbookEditablePermission, RangeProtectionPermissionEditPoint, WorksheetEditPermission, checkRangesEditablePermission, WorksheetSetCellStylePermission, SheetInterceptorService, INTERCEPTOR_POINT, InterceptCellContentPriority } from "@univerjs/sheets";
9
10
  import { SheetDataValidationModel, getCellValueOrigin, getDataValidationCellValue, deserializeListOptions, serializeListOptions, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand, RemoveSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, createDefaultNewRule, AddSheetDataValidationCommand, RemoveSheetAllDataValidationCommand, DATA_VALIDATION_PLUGIN_NAME, getDataValidationDiffMutations, DataValidationCacheService, DataValidationFormulaController, DataValidationFormulaService, getFormulaResult, transformCheckboxValue, CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2 } from "@univerjs/sheets-data-validation";
10
11
  import { getPatternType } from "@univerjs/sheets-numfmt";
12
+ import { IEditorBridgeService, SetCellEditVisibleOperation, SheetCanvasPopManagerService, SheetPermissionInterceptorBaseController, IMarkSelectionService, HoverManagerService, CellAlertManagerService, CellAlertType, IAutoFillService, APPLY_TYPE, virtualizeDiscreteRanges, getAutoFillRepeatRange, COPY_TYPE, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService, getCurrentRangeDisable$, AutoHeightController, SheetSkeletonManagerService } from "@univerjs/sheets-ui";
13
+ import { IDialogService, KeyCode, ISidebarService, useObservable, ComponentManager, IZenZoneService, useEvent, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, IMenuManagerService } from "@univerjs/ui";
11
14
  import { DataValidatorRegistryService, DataValidationModel, DataValidatorRegistryScope, TWO_FORMULA_OPERATOR_COUNT, getRuleOptions, getRuleSetting } from "@univerjs/data-validation";
12
- import { IEditorBridgeService, SheetCanvasPopManagerService, SheetPermissionInterceptorBaseController, IMarkSelectionService, HoverManagerService, CellAlertManagerService, CellAlertType, IAutoFillService, APPLY_TYPE, virtualizeDiscreteRanges, getAutoFillRepeatRange, COPY_TYPE, rangeToDiscreteRange, PREDEFINED_HOOK_NAME, getRepeatRange, ISheetClipboardService, getCurrentRangeDisable$, AutoHeightController, SheetSkeletonManagerService } from "@univerjs/sheets-ui";
13
- import { IDialogService, ISidebarService, useObservable, ComponentManager, IZenZoneService, KeyCode, useEvent, MenuItemType, getMenuHiddenObservable, RibbonStartGroup, IMenuManagerService } from "@univerjs/ui";
14
15
  import { RichTextEditingMutation } from "@univerjs/docs";
15
- import { IRenderManagerService, DeviceInputEventType, fixLineWidthByScale, Transform, Checkbox as Checkbox$1, FontCache, Shape, Rect, getFontStyleString, getDocsSkeletonPageSize, DocumentViewModel, DocumentSkeleton, Documents } from "@univerjs/engine-render";
16
16
  import { filter, BehaviorSubject, distinctUntilChanged, Subject, debounceTime, bufferTime } from "rxjs";
17
17
  import { deserializeRangeWithSheet, serializeRange } from "@univerjs/engine-formula";
18
18
  import { RangeSelector } from "@univerjs/sheets-formula-ui";
@@ -529,7 +529,12 @@ function DateDropdown(props) {
529
529
  workbook,
530
530
  interceptValue: dateStr.replace("Z", "").replace("T", " "),
531
531
  t: CellValueType.NUMBER
532
- }, rule) ? (commandService.executeCommand(SetRangeValuesCommand.id, {
532
+ }, rule) ? (await commandService.executeCommand(SetCellEditVisibleOperation.id, {
533
+ visible: !1,
534
+ eventType: DeviceInputEventType.Keyboard,
535
+ unitId,
536
+ keycode: KeyCode.ESC
537
+ }), await commandService.executeCommand(SetRangeValuesCommand.id, {
533
538
  unitId,
534
539
  subUnitId,
535
540
  range: {
@@ -1006,7 +1011,7 @@ function ListDropDown(props) {
1006
1011
  title: multiple ? localeService.t("dataValidation.listMultiple.dropdown") : localeService.t("dataValidation.list.dropdown"),
1007
1012
  value,
1008
1013
  multiple,
1009
- onChange: /* @__PURE__ */ __name((newValue) => {
1014
+ onChange: /* @__PURE__ */ __name(async (newValue) => {
1010
1015
  const str = serializeListOptions(newValue), params = {
1011
1016
  unitId,
1012
1017
  subUnitId,
@@ -1028,6 +1033,11 @@ function ListDropDown(props) {
1028
1033
  keycode: KeyCode.ESC,
1029
1034
  eventType: DeviceInputEventType.Keyboard,
1030
1035
  unitId
1036
+ }), await commandService.executeCommand(SetCellEditVisibleOperation.id, {
1037
+ visible: !1,
1038
+ eventType: DeviceInputEventType.Keyboard,
1039
+ unitId,
1040
+ keycode: KeyCode.ESC
1031
1041
  }), commandService.executeCommand(SetRangeValuesCommand.id, params), setLocalValue(str), multiple || hideFn();
1032
1042
  }, "onChange"),
1033
1043
  options,
@@ -1675,7 +1685,8 @@ let DataValidationCopyPasteController = (_a6 = class extends Disposable {
1675
1685
  copyInfo.subUnitId,
1676
1686
  ruleMatrix.diffWithAddition(this._sheetDataValidationModel.getRules(copyInfo.unitId, copyInfo.subUnitId), additionRules.values()),
1677
1687
  this._injector,
1678
- "patched"
1688
+ "patched",
1689
+ !1
1679
1690
  );
1680
1691
  return {
1681
1692
  redos: redoMutations,
@@ -1705,7 +1716,8 @@ let DataValidationCopyPasteController = (_a6 = class extends Disposable {
1705
1716
  subUnitId,
1706
1717
  ruleMatrix.diff(this._sheetDataValidationModel.getRules(unitId, subUnitId)),
1707
1718
  this._injector,
1708
- "patched"
1719
+ "patched",
1720
+ !1
1709
1721
  );
1710
1722
  return {
1711
1723
  redos: redoMutations,
@@ -2901,6 +2913,7 @@ const _ListMultipleValidatorView = class _ListMultipleValidatorView extends Base
2901
2913
  super(...arguments);
2902
2914
  __publicField(this, "id", DataValidationType.LIST_MULTIPLE);
2903
2915
  __publicField(this, "canvasRender", this.injector.createInstance(DropdownMultipleWidget));
2916
+ __publicField(this, "dropdown", LIST_DROPDOWN_KEY);
2904
2917
  }
2905
2918
  };
2906
2919
  __name(_ListMultipleValidatorView, "ListMultipleValidatorView");
@@ -4,4 +4,5 @@ import { BaseSheetDataValidatorView } from './sheet-validator-view';
4
4
  export declare class ListMultipleValidatorView extends BaseSheetDataValidatorView {
5
5
  id: DataValidationType;
6
6
  canvasRender: DropdownMultipleWidget;
7
+ dropdown: string | undefined;
7
8
  }