@univerjs/sheets-data-validation-ui 0.4.0-alpha.1 → 0.4.0-alpha.2
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
@@ -3,10 +3,10 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
5
5
|
import React, { useState, forwardRef, useRef, createElement, useMemo, useEffect } from "react";
|
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,
|
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
8
|
import { SetRangeValuesCommand, SheetsSelectionsService, getSheetCommandTarget, WorkbookEditablePermission, RangeProtectionPermissionEditPoint, WorksheetEditPermission, checkRangesEditablePermission, WorksheetSetCellStylePermission, SheetInterceptorService, INTERCEPTOR_POINT, InterceptCellContentPriority } from "@univerjs/sheets";
|
9
|
-
import { SheetDataValidationModel, getCellValueOrigin, getDataValidationCellValue, deserializeListOptions, serializeListOptions, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand, RemoveSheetDataValidationCommand, UpdateSheetDataValidationOptionsCommand, createDefaultNewRule, AddSheetDataValidationCommand, RemoveSheetAllDataValidationCommand, DATA_VALIDATION_PLUGIN_NAME, getDataValidationDiffMutations, DataValidationFormulaController, DataValidationFormulaService, getFormulaResult, transformCheckboxValue, CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2 } from "@univerjs/sheets-data-validation";
|
9
|
+
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
10
|
import { getPatternType } from "@univerjs/sheets-numfmt";
|
11
11
|
import { DataValidatorRegistryService, DataValidationModel, DataValidatorRegistryScope, TWO_FORMULA_OPERATOR_COUNT, getRuleOptions, getRuleSetting } from "@univerjs/data-validation";
|
12
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";
|
@@ -14,8 +14,9 @@ import { IDialogService, ISidebarService, useObservable, ComponentManager, IZenZ
|
|
14
14
|
import { RichTextEditingMutation } from "@univerjs/docs";
|
15
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
|
-
import {
|
18
|
-
import {
|
17
|
+
import { deserializeRangeWithSheet, serializeRange } from "@univerjs/engine-formula";
|
18
|
+
import { RangeSelector } from "@univerjs/sheets-formula-ui";
|
19
|
+
import { TextEditor } from "@univerjs/docs-ui";
|
19
20
|
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
20
21
|
function getDefaultExportFromCjs(x) {
|
21
22
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
@@ -399,11 +400,11 @@ var utc$1 = { exports: {} };
|
|
399
400
|
})(utc$1);
|
400
401
|
var utcExports = utc$1.exports;
|
401
402
|
const utc = /* @__PURE__ */ getDefaultExportFromCjs(utcExports);
|
402
|
-
var __defProp$
|
403
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
403
|
+
var __defProp$f = Object.defineProperty, __getOwnPropDesc$f = Object.getOwnPropertyDescriptor, __decorateClass$f = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
404
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
404
405
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
405
|
-
return kind && result && __defProp$
|
406
|
-
}, "__decorateClass$
|
406
|
+
return kind && result && __defProp$f(target, key, result), result;
|
407
|
+
}, "__decorateClass$f"), __decorateParam$f = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$f"), _a;
|
407
408
|
let DataValidationRejectInputController = (_a = class extends Disposable {
|
408
409
|
constructor(_editorBridgeService, _dataValidationModel, _dataValidatorRegistryService, _dialogService, _localeService) {
|
409
410
|
super(), this._editorBridgeService = _editorBridgeService, this._dataValidationModel = _dataValidationModel, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._dialogService = _dialogService, this._localeService = _localeService, this._initEditorBridgeInterceptor();
|
@@ -413,7 +414,7 @@ let DataValidationRejectInputController = (_a = class extends Disposable {
|
|
413
414
|
this._editorBridgeService.interceptor.getInterceptPoints().AFTER_CELL_EDIT_ASYNC,
|
414
415
|
{
|
415
416
|
handler: /* @__PURE__ */ __name(async (cellPromise, context, next) => {
|
416
|
-
var
|
417
|
+
var _a18;
|
417
418
|
const cell = await cellPromise, { worksheet, row, col, unitId, subUnitId, workbook } = context, ruleId = this._dataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col), rule = ruleId ? this._dataValidationModel.getRuleById(unitId, subUnitId, ruleId) : void 0;
|
418
419
|
if (!rule || rule.errorStyle !== DataValidationErrorStyle.STOP)
|
419
420
|
return next(Promise.resolve(cell));
|
@@ -421,7 +422,7 @@ let DataValidationRejectInputController = (_a = class extends Disposable {
|
|
421
422
|
if (!validator || await validator.validator(
|
422
423
|
{
|
423
424
|
value: getCellValueOrigin(cell),
|
424
|
-
interceptValue: getCellValueOrigin((
|
425
|
+
interceptValue: getCellValueOrigin((_a18 = context == null ? void 0 : context.origin) != null ? _a18 : cell),
|
425
426
|
row,
|
426
427
|
column: col,
|
427
428
|
unitId,
|
@@ -487,12 +488,12 @@ let DataValidationRejectInputController = (_a = class extends Disposable {
|
|
487
488
|
});
|
488
489
|
}
|
489
490
|
}, __name(_a, "DataValidationRejectInputController"), _a);
|
490
|
-
DataValidationRejectInputController = __decorateClass$
|
491
|
-
__decorateParam$
|
492
|
-
__decorateParam$
|
493
|
-
__decorateParam$
|
494
|
-
__decorateParam$
|
495
|
-
__decorateParam$
|
491
|
+
DataValidationRejectInputController = __decorateClass$f([
|
492
|
+
__decorateParam$f(0, IEditorBridgeService),
|
493
|
+
__decorateParam$f(1, Inject(SheetDataValidationModel)),
|
494
|
+
__decorateParam$f(2, Inject(DataValidatorRegistryService)),
|
495
|
+
__decorateParam$f(3, IDialogService),
|
496
|
+
__decorateParam$f(4, Inject(LocaleService))
|
496
497
|
], DataValidationRejectInputController);
|
497
498
|
const dvDateDropdown = "univer-dv-date-dropdown", dvDateDropdownBtns = "univer-dv-date-dropdown-btns", styles$6 = {
|
498
499
|
dvDateDropdown,
|
@@ -509,15 +510,15 @@ const transformDate = /* @__PURE__ */ __name((value) => {
|
|
509
510
|
return date;
|
510
511
|
}, "transformDate");
|
511
512
|
function DateDropdown(props) {
|
512
|
-
var
|
513
|
-
const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId, workbook } = location, commandService = useDependency(ICommandService), rejectInputController = useDependency(DataValidationRejectInputController), cellData = worksheet.getCell(row, col), rule = (
|
513
|
+
var _a18, _b, _c;
|
514
|
+
const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId, workbook } = location, commandService = useDependency(ICommandService), rejectInputController = useDependency(DataValidationRejectInputController), cellData = worksheet.getCell(row, col), rule = (_a18 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a18.rule, validator = (_b = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _b.validator, cellStr = getCellValueOrigin(worksheet.getCellRaw(row, col)), originDate = transformDate(cellStr), [localDate, setLocalDate] = useState(originDate), showTime = !!((_c = rule == null ? void 0 : rule.bizInfo) != null && _c.showTime), date = localDate && localDate.isValid() ? localDate : dayjs(), localeService = useDependency(LocaleService);
|
514
515
|
if (!cellData || !rule || !validator)
|
515
516
|
return;
|
516
517
|
const handleSave = /* @__PURE__ */ __name(async () => {
|
517
|
-
var
|
518
|
+
var _a19, _b2, _c2;
|
518
519
|
if (!date)
|
519
520
|
return;
|
520
|
-
const dateStr = date.format(showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00"), serialTime = (
|
521
|
+
const dateStr = date.format(showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD 00:00:00"), serialTime = (_a19 = numfmt.parseDate(dateStr)) == null ? void 0 : _a19.v, cellStyle = workbook.getStyles().getStyleByCell(cellData), format = (_c2 = (_b2 = cellStyle == null ? void 0 : cellStyle.n) == null ? void 0 : _b2.pattern) != null ? _c2 : "", patternType = getPatternType(format);
|
521
522
|
rule.errorStyle !== DataValidationErrorStyle.STOP || await validator.validator({
|
522
523
|
value: serialTime,
|
523
524
|
unitId,
|
@@ -600,15 +601,15 @@ function replaceRuntimeIdsAndExtInAttrs(node, runtimeProps, extend) {
|
|
600
601
|
var attrs = __assign({}, node.attrs);
|
601
602
|
extend != null && extend.colorChannel1 && attrs.fill === "colorChannel1" && (attrs.fill = extend.colorChannel1);
|
602
603
|
var defIds = runtimeProps.defIds;
|
603
|
-
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(
|
604
|
-
var key =
|
604
|
+
return !defIds || defIds.length === 0 || (node.tag === "use" && attrs["xlink:href"] && (attrs["xlink:href"] = attrs["xlink:href"] + runtimeProps.idSuffix), Object.entries(attrs).forEach(function(_a18) {
|
605
|
+
var key = _a18[0], value = _a18[1];
|
605
606
|
typeof value == "string" && (attrs[key] = value.replace(/url\(#(.*)\)/, "url(#$1".concat(runtimeProps.idSuffix, ")")));
|
606
607
|
})), attrs;
|
607
608
|
}
|
608
609
|
__name(replaceRuntimeIdsAndExtInAttrs, "replaceRuntimeIdsAndExtInAttrs");
|
609
610
|
function replaceRuntimeIdsInDefs(node, runtimeProps) {
|
610
|
-
var
|
611
|
-
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((
|
611
|
+
var _a18, defIds = runtimeProps.defIds;
|
612
|
+
return !defIds || defIds.length === 0 ? node : node.tag === "defs" && (!((_a18 = node.children) === null || _a18 === void 0) && _a18.length) ? __assign(__assign({}, node), { children: node.children.map(function(child) {
|
612
613
|
return typeof child.attrs.id == "string" && defIds && defIds.indexOf(child.attrs.id) > -1 ? __assign(__assign({}, child), { attrs: __assign(__assign({}, child.attrs), { id: child.attrs.id + runtimeProps.idSuffix }) }) : child;
|
613
614
|
}) }) : node;
|
614
615
|
}
|
@@ -674,11 +675,11 @@ var element = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width:
|
|
674
675
|
}));
|
675
676
|
});
|
676
677
|
SequenceSingle.displayName = "SequenceSingle";
|
677
|
-
var __defProp$
|
678
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
678
|
+
var __defProp$e = Object.defineProperty, __getOwnPropDesc$e = Object.getOwnPropertyDescriptor, __decorateClass$e = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
679
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
679
680
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
680
|
-
return kind && result && __defProp$
|
681
|
-
}, "__decorateClass$
|
681
|
+
return kind && result && __defProp$e(target, key, result), result;
|
682
|
+
}, "__decorateClass$e"), __decorateParam$e = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$e"), _a2;
|
682
683
|
let DataValidationPanelService = (_a2 = class extends Disposable {
|
683
684
|
constructor(_univerInstanceService, _sidebarService) {
|
684
685
|
super();
|
@@ -692,7 +693,11 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
|
|
692
693
|
this._univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_SHEET).pipe(filter((sheet) => !sheet)).subscribe(() => {
|
693
694
|
this.close();
|
694
695
|
})
|
695
|
-
)
|
696
|
+
), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((info) => {
|
697
|
+
info.id === DATA_VALIDATION_PANEL && (info.visible || setTimeout(() => {
|
698
|
+
this._sidebarService.sidebarOptions$.next({ visible: !1 });
|
699
|
+
}));
|
700
|
+
}));
|
696
701
|
}
|
697
702
|
get activeRule() {
|
698
703
|
return this._activeRule;
|
@@ -701,15 +706,15 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
|
|
701
706
|
return this._open$.getValue();
|
702
707
|
}
|
703
708
|
dispose() {
|
704
|
-
var
|
705
|
-
super.dispose(), this._open$.next(!1), this._open$.complete(), this._activeRule$.complete(), (
|
709
|
+
var _a18;
|
710
|
+
super.dispose(), this._open$.next(!1), this._open$.complete(), this._activeRule$.complete(), (_a18 = this._closeDisposable) == null || _a18.dispose();
|
706
711
|
}
|
707
712
|
open() {
|
708
713
|
this._open$.next(!0);
|
709
714
|
}
|
710
715
|
close() {
|
711
|
-
var
|
712
|
-
this._open$.next(!1), (
|
716
|
+
var _a18;
|
717
|
+
this._open$.next(!1), (_a18 = this._closeDisposable) == null || _a18.dispose();
|
713
718
|
}
|
714
719
|
setCloseDisposable(disposable) {
|
715
720
|
this._closeDisposable = toDisposable(() => {
|
@@ -720,9 +725,9 @@ let DataValidationPanelService = (_a2 = class extends Disposable {
|
|
720
725
|
this._activeRule = rule, this._activeRule$.next(rule);
|
721
726
|
}
|
722
727
|
}, __name(_a2, "DataValidationPanelService"), _a2);
|
723
|
-
DataValidationPanelService = __decorateClass$
|
724
|
-
__decorateParam$
|
725
|
-
__decorateParam$
|
728
|
+
DataValidationPanelService = __decorateClass$e([
|
729
|
+
__decorateParam$e(0, IUniverInstanceService),
|
730
|
+
__decorateParam$e(1, ISidebarService)
|
726
731
|
], DataValidationPanelService);
|
727
732
|
function CellDropdown() {
|
728
733
|
const dropdownManagerService = useDependency(DataValidationDropdownManagerService), activeDropdown = useObservable(dropdownManagerService.activeDropdown$, dropdownManagerService.activeDropdown), componentManager = useDependency(ComponentManager);
|
@@ -745,11 +750,11 @@ function CellDropdown() {
|
|
745
750
|
}
|
746
751
|
__name(CellDropdown, "CellDropdown");
|
747
752
|
const DROP_DOWN_KEY = "sheet.ui.dropdown";
|
748
|
-
var __defProp$
|
749
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
753
|
+
var __defProp$d = Object.defineProperty, __getOwnPropDesc$d = Object.getOwnPropertyDescriptor, __decorateClass$d = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
754
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
750
755
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
751
|
-
return kind && result && __defProp$
|
752
|
-
}, "__decorateClass$
|
756
|
+
return kind && result && __defProp$d(target, key, result), result;
|
757
|
+
}, "__decorateClass$d"), __decorateParam$d = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$d"), _a3;
|
753
758
|
let DataValidationDropdownManagerService = (_a3 = class extends Disposable {
|
754
759
|
constructor(_canvasPopupManagerService, _univerInstanceService, _dataValidatorRegistryService, _zenZoneService, _renderManagerService, _dataValidationModel, _sheetsSelectionsService) {
|
755
760
|
super();
|
@@ -812,8 +817,8 @@ let DataValidationDropdownManagerService = (_a3 = class extends Disposable {
|
|
812
817
|
const disposableCollection = new DisposableCollection();
|
813
818
|
disposableCollection.add(popupDisposable), disposableCollection.add({
|
814
819
|
dispose: /* @__PURE__ */ __name(() => {
|
815
|
-
var
|
816
|
-
(_b = (
|
820
|
+
var _a18, _b;
|
821
|
+
(_b = (_a18 = this._activeDropdown) == null ? void 0 : _a18.onHide) == null || _b.call(_a18);
|
817
822
|
}, "dispose")
|
818
823
|
}), this._currentPopup = disposableCollection;
|
819
824
|
}
|
@@ -849,14 +854,14 @@ let DataValidationDropdownManagerService = (_a3 = class extends Disposable {
|
|
849
854
|
});
|
850
855
|
}
|
851
856
|
}, __name(_a3, "DataValidationDropdownManagerService"), _a3);
|
852
|
-
DataValidationDropdownManagerService = __decorateClass$
|
853
|
-
__decorateParam$
|
854
|
-
__decorateParam$
|
855
|
-
__decorateParam$
|
856
|
-
__decorateParam$
|
857
|
-
__decorateParam$
|
858
|
-
__decorateParam$
|
859
|
-
__decorateParam$
|
857
|
+
DataValidationDropdownManagerService = __decorateClass$d([
|
858
|
+
__decorateParam$d(0, Inject(SheetCanvasPopManagerService)),
|
859
|
+
__decorateParam$d(1, IUniverInstanceService),
|
860
|
+
__decorateParam$d(2, Inject(DataValidatorRegistryService)),
|
861
|
+
__decorateParam$d(3, IZenZoneService),
|
862
|
+
__decorateParam$d(4, IRenderManagerService),
|
863
|
+
__decorateParam$d(5, Inject(SheetDataValidationModel)),
|
864
|
+
__decorateParam$d(6, Inject(SheetsSelectionsService))
|
860
865
|
], DataValidationDropdownManagerService);
|
861
866
|
const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperation = {
|
862
867
|
id: "data-validation.operation.open-validation-panel",
|
@@ -924,8 +929,8 @@ const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperatio
|
|
924
929
|
dvListDropdownSplit,
|
925
930
|
dvListDropdownEdit
|
926
931
|
}, SelectList = /* @__PURE__ */ __name((props) => {
|
927
|
-
var
|
928
|
-
const { value, onChange, multiple, options, title, onEdit, style, filter: filter2, location } = props, localeService = useDependency(LocaleService), configService = useDependency(IConfigService), lowerFilter = filter2 == null ? void 0 : filter2.toLowerCase(), { row, col, unitId, subUnitId } = location, filteredOptions = options.filter((item) => lowerFilter ? item.label.toLowerCase().includes(lowerFilter) : !0), showEditOnDropdown = (_b = (
|
932
|
+
var _a18, _b;
|
933
|
+
const { value, onChange, multiple, options, title, onEdit, style, filter: filter2, location } = props, localeService = useDependency(LocaleService), configService = useDependency(IConfigService), lowerFilter = filter2 == null ? void 0 : filter2.toLowerCase(), { row, col, unitId, subUnitId } = location, filteredOptions = options.filter((item) => lowerFilter ? item.label.toLowerCase().includes(lowerFilter) : !0), showEditOnDropdown = (_b = (_a18 = configService.getConfig(PLUGIN_CONFIG_KEY)) == null ? void 0 : _a18.showEditOnDropdown) != null ? _b : !0, sheetPermissionInterceptorBaseController = useDependency(SheetPermissionInterceptorBaseController), hasPermission = useMemo(() => sheetPermissionInterceptorBaseController.permissionCheckWithRanges(
|
929
934
|
{
|
930
935
|
workbookTypes: [WorkbookEditablePermission],
|
931
936
|
rangeTypes: [RangeProtectionPermissionEditPoint],
|
@@ -962,18 +967,18 @@ const DATA_VALIDATION_PANEL = "DataValidationPanel", OpenValidationPanelOperatio
|
|
962
967
|
] });
|
963
968
|
}, "SelectList");
|
964
969
|
function ListDropDown(props) {
|
965
|
-
var
|
970
|
+
var _a18, _b;
|
966
971
|
const { location, hideFn } = props, { worksheet, row, col, unitId, subUnitId } = location, dataValidationModel = useDependency(DataValidationModel), [editingText, setEditingText] = useState(""), commandService = useDependency(ICommandService), localeService = useDependency(LocaleService), [localValue, setLocalValue] = useState(""), editorBridgeService = useDependency(IEditorBridgeService), instanceService = useDependency(IUniverInstanceService), ruleChange$ = useMemo(() => dataValidationModel.ruleChange$.pipe(debounceTime(16)), []);
|
967
972
|
useObservable(ruleChange$);
|
968
973
|
const anchorRect = RectPopup.useContext(), cellWidth = anchorRect.right - anchorRect.left;
|
969
974
|
if (useEffect(() => {
|
970
975
|
const dispose = commandService.onCommandExecuted((command) => {
|
971
|
-
var
|
976
|
+
var _a19, _b2;
|
972
977
|
if (command.id === RichTextEditingMutation.id) {
|
973
978
|
const params = command.params, { unitId: unitId2 } = params, unit = instanceService.getUnit(unitId2, UniverInstanceType.UNIVER_DOC);
|
974
979
|
if (!unit)
|
975
980
|
return;
|
976
|
-
const text = BuildTextUtils.transform.getPlainText((_b2 = (
|
981
|
+
const text = BuildTextUtils.transform.getPlainText((_b2 = (_a19 = unit.getSnapshot().body) == null ? void 0 : _a19.dataStream) != null ? _b2 : "");
|
977
982
|
setEditingText(text);
|
978
983
|
}
|
979
984
|
});
|
@@ -982,7 +987,7 @@ function ListDropDown(props) {
|
|
982
987
|
};
|
983
988
|
}, [commandService, instanceService]), !worksheet)
|
984
989
|
return null;
|
985
|
-
const cellData = worksheet.getCell(row, col), rule = (
|
990
|
+
const cellData = worksheet.getCell(row, col), rule = (_a18 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a18.rule, validator = (_b = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _b.validator, showColor = (rule == null ? void 0 : rule.renderMode) === DataValidationRenderMode.CUSTOM || (rule == null ? void 0 : rule.renderMode) === void 0;
|
986
991
|
if (!cellData || !rule || !validator || validator.id.indexOf(DataValidationType.LIST) !== 0)
|
987
992
|
return;
|
988
993
|
const multiple = rule.type === DataValidationType.LIST_MULTIPLE, list = validator.getListWithColor(rule, unitId, subUnitId), cellStr = localValue || getDataValidationCellValue(worksheet.getCellRaw(row, col)), value = deserializeListOptions(cellStr), handleEdit = /* @__PURE__ */ __name(() => {
|
@@ -1038,7 +1043,7 @@ const dataValidationOptionsButton = "univer-data-validation-options-button", dat
|
|
1038
1043
|
dataValidationOptionsButtonIcon
|
1039
1044
|
};
|
1040
1045
|
function DataValidationOptions(props) {
|
1041
|
-
var
|
1046
|
+
var _a18;
|
1042
1047
|
const localeService = useDependency(LocaleService), componentManager = useDependency(ComponentManager), { value, onChange, extraComponent } = props, [show, setShow] = useState(!1), ExtraOptions = extraComponent ? componentManager.get(extraComponent) : null;
|
1043
1048
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
1044
1049
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$4.dataValidationOptionsButton, onClick: /* @__PURE__ */ __name(() => setShow(!show), "onClick"), children: [
|
@@ -1054,7 +1059,7 @@ function DataValidationOptions(props) {
|
|
1054
1059
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
1055
1060
|
RadioGroup,
|
1056
1061
|
{
|
1057
|
-
value: `${(
|
1062
|
+
value: `${(_a18 = value.errorStyle) != null ? _a18 : DataValidationErrorStyle.WARNING}`,
|
1058
1063
|
onChange: /* @__PURE__ */ __name((errorStyle) => onChange({ ...value, errorStyle: +errorStyle }), "onChange"),
|
1059
1064
|
children: [
|
1060
1065
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationErrorStyle.WARNING}`, children: localeService.t("dataValidation.panel.showWarning") }),
|
@@ -1098,8 +1103,13 @@ const dataValidationDetail = "univer-data-validation-detail", dataValidationDeta
|
|
1098
1103
|
},
|
1099
1104
|
1e3
|
1100
1105
|
), "debounceExecuteFactory");
|
1106
|
+
function getSheetIdByName(univerInstanceService, unitId, name) {
|
1107
|
+
var _a18, _b, _c, _d;
|
1108
|
+
return unitId ? ((_b = (_a18 = univerInstanceService.getUnit(unitId)) == null ? void 0 : _a18.getSheetBySheetName(name)) == null ? void 0 : _b.getSheetId()) || "" : ((_d = (_c = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) == null ? void 0 : _c.getSheetBySheetName(name)) == null ? void 0 : _d.getSheetId()) || "";
|
1109
|
+
}
|
1110
|
+
__name(getSheetIdByName, "getSheetIdByName");
|
1101
1111
|
function DataValidationDetail() {
|
1102
|
-
const [key, setKey] = useState(0), dataValidationPanelService = useDependency(DataValidationPanelService), activeRuleInfo = useObservable(dataValidationPanelService.activeRule$, dataValidationPanelService.activeRule), { unitId, subUnitId, rule } = activeRuleInfo || {}, ruleId = rule.uid, validatorService = useDependency(DataValidatorRegistryService), componentManager = useDependency(ComponentManager), commandService = useDependency(ICommandService), dataValidationModel = useDependency(DataValidationModel), localeService = useDependency(LocaleService), [localRule, setLocalRule] = useState(rule), validator = validatorService.getValidatorItem(localRule.type), [showError, setShowError] = useState(!1), validators = validatorService.getValidatorsByScope(DataValidatorRegistryScope.SHEET), [localRanges, setLocalRanges] = useState(() => localRule.ranges.map((i) => ({ unitId: "", sheetId: "", range: i }))), debounceExecute = useMemo(() => debounceExecuteFactory(commandService), [commandService]), sheetSelectionService = useDependency(SheetsSelectionsService);
|
1112
|
+
const [key, setKey] = useState(0), dataValidationPanelService = useDependency(DataValidationPanelService), activeRuleInfo = useObservable(dataValidationPanelService.activeRule$, dataValidationPanelService.activeRule), { unitId, subUnitId, rule } = activeRuleInfo || {}, ruleId = rule.uid, validatorService = useDependency(DataValidatorRegistryService), univerInstanceService = useDependency(IUniverInstanceService), componentManager = useDependency(ComponentManager), commandService = useDependency(ICommandService), dataValidationModel = useDependency(DataValidationModel), localeService = useDependency(LocaleService), [localRule, setLocalRule] = useState(rule), validator = validatorService.getValidatorItem(localRule.type), [showError, setShowError] = useState(!1), validators = validatorService.getValidatorsByScope(DataValidatorRegistryScope.SHEET), [localRanges, setLocalRanges] = useState(() => localRule.ranges.map((i) => ({ unitId: "", sheetId: "", range: i }))), debounceExecute = useMemo(() => debounceExecuteFactory(commandService), [commandService]), rangeSelectorActionsRef = useRef({}), [isFocusRangeSelector, isFocusRangeSelectorSet] = useState(!1), sheetSelectionService = useDependency(SheetsSelectionsService);
|
1103
1113
|
if (useEffect(() => () => {
|
1104
1114
|
const currentSelection = sheetSelectionService.getCurrentLastSelection();
|
1105
1115
|
currentSelection && sheetSelectionService.setSelections([currentSelection]);
|
@@ -1114,7 +1124,18 @@ function DataValidationDetail() {
|
|
1114
1124
|
return null;
|
1115
1125
|
const operators = validator.operators, operatorNames = validator.operatorNames, isTwoFormula = localRule.operator ? TWO_FORMULA_OPERATOR_COUNT.includes(localRule.operator) : !1, handleOk = /* @__PURE__ */ __name(() => {
|
1116
1126
|
localRule.ranges.length && (validator.validatorFormula(localRule, unitId, subUnitId).success ? dataValidationPanelService.setActiveRule(null) : setShowError(!0));
|
1117
|
-
}, "handleOk"), handleUpdateRuleRanges = useEvent((
|
1127
|
+
}, "handleOk"), handleUpdateRuleRanges = useEvent((rangeText) => {
|
1128
|
+
const unitRanges = rangeText.split(",").map(deserializeRangeWithSheet).map((unitRange) => {
|
1129
|
+
const sheetName = unitRange.sheetName;
|
1130
|
+
if (sheetName) {
|
1131
|
+
const sheetId = getSheetIdByName(univerInstanceService, unitRange.unitId, sheetName);
|
1132
|
+
return { ...unitRange, sheetId };
|
1133
|
+
}
|
1134
|
+
return {
|
1135
|
+
...unitRange,
|
1136
|
+
sheetId: ""
|
1137
|
+
};
|
1138
|
+
});
|
1118
1139
|
if (isUnitRangesEqual(unitRanges, localRanges))
|
1119
1140
|
return;
|
1120
1141
|
setLocalRanges(unitRanges);
|
@@ -1194,8 +1215,12 @@ function DataValidationDetail() {
|
|
1194
1215
|
options: newOptions
|
1195
1216
|
}
|
1196
1217
|
));
|
1197
|
-
}, "handleUpdateRuleOptions")
|
1198
|
-
|
1218
|
+
}, "handleUpdateRuleOptions"), handlePanelClick = /* @__PURE__ */ __name((e) => {
|
1219
|
+
var _a18;
|
1220
|
+
const handleOutClick = (_a18 = rangeSelectorActionsRef.current) == null ? void 0 : _a18.handleOutClick;
|
1221
|
+
handleOutClick && handleOutClick(e, isFocusRangeSelectorSet);
|
1222
|
+
}, "handlePanelClick");
|
1223
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$3.dataValidationDetail, onClick: handlePanelClick, children: [
|
1199
1224
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
1200
1225
|
FormLayout,
|
1201
1226
|
{
|
@@ -1204,16 +1229,13 @@ function DataValidationDetail() {
|
|
1204
1229
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
1205
1230
|
RangeSelector,
|
1206
1231
|
{
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
}, "onChange")
|
1215
|
-
},
|
1216
|
-
key
|
1232
|
+
unitId,
|
1233
|
+
subUnitId,
|
1234
|
+
initValue: rangeStr,
|
1235
|
+
onChange: handleUpdateRuleRanges,
|
1236
|
+
isFocus: isFocusRangeSelector,
|
1237
|
+
actions: rangeSelectorActionsRef.current
|
1238
|
+
}
|
1217
1239
|
)
|
1218
1240
|
}
|
1219
1241
|
),
|
@@ -1290,8 +1312,8 @@ const dataValidationItemContainer = "univer-data-validation-item-container", dat
|
|
1290
1312
|
}), e.stopPropagation();
|
1291
1313
|
}, "handleDelete");
|
1292
1314
|
return useEffect(() => () => {
|
1293
|
-
var
|
1294
|
-
ids.current && ((
|
1315
|
+
var _a18;
|
1316
|
+
ids.current && ((_a18 = ids.current) == null || _a18.forEach((id) => {
|
1295
1317
|
id && markSelectionService.removeShape(id);
|
1296
1318
|
}));
|
1297
1319
|
}, [markSelectionService]), /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
@@ -1322,8 +1344,8 @@ const dataValidationItemContainer = "univer-data-validation-item-container", dat
|
|
1322
1344
|
})));
|
1323
1345
|
}, "onMouseEnter"),
|
1324
1346
|
onMouseLeave: /* @__PURE__ */ __name(() => {
|
1325
|
-
var
|
1326
|
-
setIsHover(!1), (
|
1347
|
+
var _a18;
|
1348
|
+
setIsHover(!1), (_a18 = ids.current) == null || _a18.forEach((id) => {
|
1327
1349
|
id && markSelectionService.removeShape(id);
|
1328
1350
|
}), ids.current = void 0;
|
1329
1351
|
}, "onMouseLeave"),
|
@@ -1382,7 +1404,7 @@ function DataValidationListWithWorkbook(props) {
|
|
1382
1404
|
}, "getDvRulesByPermissionCorrect"))(rules), hasDisableRule = rulesByPermissionCheck == null ? void 0 : rulesByPermissionCheck.some((rule) => rule.disable);
|
1383
1405
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.dataValidationList, children: [
|
1384
1406
|
rulesByPermissionCheck == null ? void 0 : rulesByPermissionCheck.map((rule) => {
|
1385
|
-
var
|
1407
|
+
var _a18;
|
1386
1408
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
1387
1409
|
DataValidationItem,
|
1388
1410
|
{
|
@@ -1396,7 +1418,7 @@ function DataValidationListWithWorkbook(props) {
|
|
1396
1418
|
});
|
1397
1419
|
}, "onClick"),
|
1398
1420
|
rule,
|
1399
|
-
disable: (
|
1421
|
+
disable: (_a18 = rule.disable) != null ? _a18 : !1
|
1400
1422
|
},
|
1401
1423
|
rule.uid
|
1402
1424
|
);
|
@@ -1414,7 +1436,7 @@ const DataValidationPanel = /* @__PURE__ */ __name(() => {
|
|
1414
1436
|
}, "DataValidationPanel"), LIST_DROPDOWN_KEY = "data-validation.list.dropdown", DATE_DROPDOWN_KEY = "data-validation.date.dropdown", AddSheetDataValidationAndOpenCommand = {
|
1415
1437
|
type: CommandType.COMMAND,
|
1416
1438
|
id: "data-validation.command.addRuleAndOpen",
|
1417
|
-
|
1439
|
+
handler(accessor) {
|
1418
1440
|
const univerInstanceService = accessor.get(IUniverInstanceService), target = getSheetCommandTarget(univerInstanceService);
|
1419
1441
|
if (!target) return !1;
|
1420
1442
|
const { workbook, worksheet } = target, rule = createDefaultNewRule(accessor), commandService = accessor.get(ICommandService), unitId = workbook.getUnitId(), subUnitId = worksheet.getSheetId(), addParams = {
|
@@ -1422,17 +1444,17 @@ const DataValidationPanel = /* @__PURE__ */ __name(() => {
|
|
1422
1444
|
unitId,
|
1423
1445
|
subUnitId
|
1424
1446
|
};
|
1425
|
-
return
|
1447
|
+
return commandService.syncExecuteCommand(AddSheetDataValidationCommand.id, addParams) ? (commandService.syncExecuteCommand(OpenValidationPanelOperation.id, {
|
1426
1448
|
ruleId: rule.uid,
|
1427
1449
|
isAdd: !0
|
1428
1450
|
}), !0) : !1;
|
1429
1451
|
}
|
1430
1452
|
};
|
1431
|
-
var __defProp$
|
1432
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
1453
|
+
var __defProp$c = Object.defineProperty, __getOwnPropDesc$c = Object.getOwnPropertyDescriptor, __decorateClass$c = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
1454
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
1433
1455
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
1434
|
-
return kind && result && __defProp$
|
1435
|
-
}, "__decorateClass$
|
1456
|
+
return kind && result && __defProp$c(target, key, result), result;
|
1457
|
+
}, "__decorateClass$c"), __decorateParam$c = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$c");
|
1436
1458
|
const ALERT_KEY = "SHEET_DATA_VALIDATION_ALERT";
|
1437
1459
|
var _a4;
|
1438
1460
|
let DataValidationAlertController = (_a4 = class extends Disposable {
|
@@ -1444,12 +1466,12 @@ let DataValidationAlertController = (_a4 = class extends Disposable {
|
|
1444
1466
|
}
|
1445
1467
|
_initCellAlertPopup() {
|
1446
1468
|
this.disposeWithMe(this._hoverManagerService.currentCell$.pipe(debounceTime(100)).subscribe((cellPos) => {
|
1447
|
-
var
|
1469
|
+
var _a18, _b;
|
1448
1470
|
if (cellPos) {
|
1449
1471
|
const worksheet = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getActiveSheet();
|
1450
1472
|
if (!worksheet) return;
|
1451
1473
|
const cellData = worksheet.getCell(cellPos.location.row, cellPos.location.col);
|
1452
|
-
if (((
|
1474
|
+
if (((_a18 = cellData == null ? void 0 : cellData.dataValidation) == null ? void 0 : _a18.validStatus) === DataValidationStatus.INVALID) {
|
1453
1475
|
const currentAlert = this._cellAlertManagerService.currentAlert.get(ALERT_KEY), currentLoc = (_b = currentAlert == null ? void 0 : currentAlert.alert) == null ? void 0 : _b.location;
|
1454
1476
|
if (currentLoc && currentLoc.row === cellPos.location.row && currentLoc.col === cellPos.location.col && currentLoc.subUnitId === cellPos.location.subUnitId && currentLoc.unitId === cellPos.location.unitId)
|
1455
1477
|
return;
|
@@ -1477,18 +1499,18 @@ let DataValidationAlertController = (_a4 = class extends Disposable {
|
|
1477
1499
|
}));
|
1478
1500
|
}
|
1479
1501
|
}, __name(_a4, "DataValidationAlertController"), _a4);
|
1480
|
-
DataValidationAlertController = __decorateClass$
|
1481
|
-
__decorateParam$
|
1482
|
-
__decorateParam$
|
1483
|
-
__decorateParam$
|
1484
|
-
__decorateParam$
|
1485
|
-
__decorateParam$
|
1502
|
+
DataValidationAlertController = __decorateClass$c([
|
1503
|
+
__decorateParam$c(0, Inject(HoverManagerService)),
|
1504
|
+
__decorateParam$c(1, Inject(CellAlertManagerService)),
|
1505
|
+
__decorateParam$c(2, IUniverInstanceService),
|
1506
|
+
__decorateParam$c(3, Inject(LocaleService)),
|
1507
|
+
__decorateParam$c(4, IZenZoneService)
|
1486
1508
|
], DataValidationAlertController);
|
1487
|
-
var __defProp$
|
1488
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
1509
|
+
var __defProp$b = Object.defineProperty, __getOwnPropDesc$b = Object.getOwnPropertyDescriptor, __decorateClass$b = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
1510
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
1489
1511
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
1490
|
-
return kind && result && __defProp$
|
1491
|
-
}, "__decorateClass$
|
1512
|
+
return kind && result && __defProp$b(target, key, result), result;
|
1513
|
+
}, "__decorateClass$b"), __decorateParam$b = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$b"), _a5;
|
1492
1514
|
let DataValidationAutoFillController = (_a5 = class extends Disposable {
|
1493
1515
|
constructor(_autoFillService, _dataValidationModel, _injector) {
|
1494
1516
|
super(), this._autoFillService = _autoFillService, this._dataValidationModel = _dataValidationModel, this._injector = _injector, this._initAutoFill();
|
@@ -1565,16 +1587,16 @@ let DataValidationAutoFillController = (_a5 = class extends Disposable {
|
|
1565
1587
|
this.disposeWithMe(this._autoFillService.addHook(hook));
|
1566
1588
|
}
|
1567
1589
|
}, __name(_a5, "DataValidationAutoFillController"), _a5);
|
1568
|
-
DataValidationAutoFillController = __decorateClass$
|
1569
|
-
__decorateParam$
|
1570
|
-
__decorateParam$
|
1571
|
-
__decorateParam$
|
1590
|
+
DataValidationAutoFillController = __decorateClass$b([
|
1591
|
+
__decorateParam$b(0, IAutoFillService),
|
1592
|
+
__decorateParam$b(1, Inject(SheetDataValidationModel)),
|
1593
|
+
__decorateParam$b(2, Inject(Injector))
|
1572
1594
|
], DataValidationAutoFillController);
|
1573
|
-
var __defProp$
|
1574
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
1595
|
+
var __defProp$a = Object.defineProperty, __getOwnPropDesc$a = Object.getOwnPropertyDescriptor, __decorateClass$a = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
1596
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
1575
1597
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
1576
|
-
return kind && result && __defProp$
|
1577
|
-
}, "__decorateClass$
|
1598
|
+
return kind && result && __defProp$a(target, key, result), result;
|
1599
|
+
}, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$a"), _a6;
|
1578
1600
|
let DataValidationCopyPasteController = (_a6 = class extends Disposable {
|
1579
1601
|
constructor(_sheetClipboardService, _sheetDataValidationModel, _injector) {
|
1580
1602
|
super();
|
@@ -1630,8 +1652,8 @@ let DataValidationCopyPasteController = (_a6 = class extends Disposable {
|
|
1630
1652
|
if (copyInfo.unitId !== unitId || subUnitId !== copyInfo.subUnitId) {
|
1631
1653
|
const ruleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(copyInfo.unitId, copyInfo.subUnitId).clone(), additionMatrix = new ObjectMatrix(), addRules = /* @__PURE__ */ new Set(), { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]), repeatRange = getRepeatRange(vCopyRange, vPastedRange, !0), additionRules = /* @__PURE__ */ new Map();
|
1632
1654
|
repeatRange.forEach(({ startRange }) => {
|
1633
|
-
var
|
1634
|
-
(
|
1655
|
+
var _a18;
|
1656
|
+
(_a18 = this._copyInfo) == null || _a18.matrix.forValue((row, col, ruleId) => {
|
1635
1657
|
const range = Rectangle.getPositionRange(
|
1636
1658
|
{
|
1637
1659
|
startRow: row,
|
@@ -1662,8 +1684,8 @@ let DataValidationCopyPasteController = (_a6 = class extends Disposable {
|
|
1662
1684
|
} else {
|
1663
1685
|
const ruleMatrix = this._sheetDataValidationModel.getRuleObjectMatrix(unitId, subUnitId).clone(), additionMatrix = new ObjectMatrix(), additionRules = /* @__PURE__ */ new Set(), { ranges: [vCopyRange, vPastedRange], mapFunc } = virtualizeDiscreteRanges([copyInfo.copyRange, pastedRange]);
|
1664
1686
|
getRepeatRange(vCopyRange, vPastedRange, !0).forEach(({ startRange }) => {
|
1665
|
-
var
|
1666
|
-
(
|
1687
|
+
var _a18;
|
1688
|
+
(_a18 = this._copyInfo) == null || _a18.matrix.forValue((row, col, ruleId) => {
|
1667
1689
|
const range = Rectangle.getPositionRange(
|
1668
1690
|
{
|
1669
1691
|
startRow: row,
|
@@ -1692,16 +1714,16 @@ let DataValidationCopyPasteController = (_a6 = class extends Disposable {
|
|
1692
1714
|
}
|
1693
1715
|
}
|
1694
1716
|
}, __name(_a6, "DataValidationCopyPasteController"), _a6);
|
1695
|
-
DataValidationCopyPasteController = __decorateClass$
|
1696
|
-
__decorateParam$
|
1697
|
-
__decorateParam$
|
1698
|
-
__decorateParam$
|
1717
|
+
DataValidationCopyPasteController = __decorateClass$a([
|
1718
|
+
__decorateParam$a(0, ISheetClipboardService),
|
1719
|
+
__decorateParam$a(1, Inject(SheetDataValidationModel)),
|
1720
|
+
__decorateParam$a(2, Inject(Injector))
|
1699
1721
|
], DataValidationCopyPasteController);
|
1700
|
-
var __defProp$
|
1701
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
1722
|
+
var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
1723
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
1702
1724
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
1703
|
-
return kind && result && __defProp$
|
1704
|
-
}, "__decorateClass$
|
1725
|
+
return kind && result && __defProp$9(target, key, result), result;
|
1726
|
+
}, "__decorateClass$9"), __decorateParam$9 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$9"), _a7;
|
1705
1727
|
let DataValidationPermissionController = (_a7 = class extends Disposable {
|
1706
1728
|
constructor(_localeService, _commandService, _sheetPermissionInterceptorBaseController) {
|
1707
1729
|
super(), this._localeService = _localeService, this._commandService = _commandService, this._sheetPermissionInterceptorBaseController = _sheetPermissionInterceptorBaseController, this._commandExecutedListener();
|
@@ -1722,10 +1744,10 @@ let DataValidationPermissionController = (_a7 = class extends Disposable {
|
|
1722
1744
|
);
|
1723
1745
|
}
|
1724
1746
|
}, __name(_a7, "DataValidationPermissionController"), _a7);
|
1725
|
-
DataValidationPermissionController = __decorateClass$
|
1726
|
-
__decorateParam$
|
1727
|
-
__decorateParam$
|
1728
|
-
__decorateParam$
|
1747
|
+
DataValidationPermissionController = __decorateClass$9([
|
1748
|
+
__decorateParam$9(0, Inject(LocaleService)),
|
1749
|
+
__decorateParam$9(1, ICommandService),
|
1750
|
+
__decorateParam$9(2, Inject(SheetPermissionInterceptorBaseController))
|
1729
1751
|
], DataValidationPermissionController);
|
1730
1752
|
const DataValidationIcon = "data-validation-single", DATA_VALIDATION_MENU_ID = "sheet.menu.data-validation";
|
1731
1753
|
function dataValidationMenuFactory(accessor) {
|
@@ -1771,11 +1793,11 @@ const menuSchema = {
|
|
1771
1793
|
}
|
1772
1794
|
}
|
1773
1795
|
};
|
1774
|
-
var __defProp$
|
1775
|
-
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
1796
|
+
var __defProp$8 = Object.defineProperty, __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor, __decorateClass$8 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
1797
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
1776
1798
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
1777
|
-
return kind && result && __defProp$
|
1778
|
-
}, "__decorateClass$
|
1799
|
+
return kind && result && __defProp$8(target, key, result), result;
|
1800
|
+
}, "__decorateClass$8"), __decorateParam$8 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$8");
|
1779
1801
|
const INVALID_MARK = {
|
1780
1802
|
tr: {
|
1781
1803
|
size: 6,
|
@@ -1784,17 +1806,17 @@ const INVALID_MARK = {
|
|
1784
1806
|
};
|
1785
1807
|
var _a8;
|
1786
1808
|
let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
1787
|
-
constructor(_commandService, _menuManagerService, _renderManagerService, _univerInstanceService, _autoHeightController, _dropdownManagerService, _sheetDataValidationModel, _dataValidatorRegistryService, _sheetInterceptorService, _editorBridgeService) {
|
1788
|
-
super(), this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._autoHeightController = _autoHeightController, this._dropdownManagerService = _dropdownManagerService, this._sheetDataValidationModel = _sheetDataValidationModel, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._sheetInterceptorService = _sheetInterceptorService, this._editorBridgeService = _editorBridgeService, this._initMenu(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
1809
|
+
constructor(_commandService, _menuManagerService, _renderManagerService, _univerInstanceService, _autoHeightController, _dropdownManagerService, _sheetDataValidationModel, _dataValidatorRegistryService, _sheetInterceptorService, _dataValidationCacheService, _editorBridgeService) {
|
1810
|
+
super(), this._commandService = _commandService, this._menuManagerService = _menuManagerService, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._autoHeightController = _autoHeightController, this._dropdownManagerService = _dropdownManagerService, this._sheetDataValidationModel = _sheetDataValidationModel, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._sheetInterceptorService = _sheetInterceptorService, this._dataValidationCacheService = _dataValidationCacheService, this._editorBridgeService = _editorBridgeService, this._initMenu(), this._initDropdown(), this._initViewModelIntercept(), this._initAutoHeight();
|
1789
1811
|
}
|
1790
1812
|
_initMenu() {
|
1791
1813
|
this._menuManagerService.mergeMenu(menuSchema);
|
1792
1814
|
}
|
1793
1815
|
_initDropdown() {
|
1794
1816
|
this._editorBridgeService && this.disposeWithMe(this._editorBridgeService.visible$.subscribe((visible) => {
|
1795
|
-
var
|
1817
|
+
var _a18;
|
1796
1818
|
if (!visible.visible) {
|
1797
|
-
((
|
1819
|
+
((_a18 = this._dropdownManagerService.activeDropdown) == null ? void 0 : _a18.trigger) === "editor-bridge" && this._dropdownManagerService.hideDropdown();
|
1798
1820
|
return;
|
1799
1821
|
}
|
1800
1822
|
const state = this._editorBridgeService.getEditCellState();
|
@@ -1844,24 +1866,24 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1844
1866
|
priority: InterceptCellContentPriority.DATA_VALIDATION,
|
1845
1867
|
// eslint-disable-next-line max-lines-per-function, complexity
|
1846
1868
|
handler: /* @__PURE__ */ __name((cell, pos, next) => {
|
1847
|
-
var
|
1869
|
+
var _a18, _b, _c, _d, _e, _f;
|
1848
1870
|
const { row, col, unitId, subUnitId, workbook, worksheet } = pos, ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
|
1849
1871
|
if (!ruleId)
|
1850
1872
|
return next(cell);
|
1851
1873
|
const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
|
1852
1874
|
if (!rule)
|
1853
1875
|
return next(cell);
|
1854
|
-
const validStatus = this.
|
1876
|
+
const validStatus = (_b = (_a18 = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col)) == null ? void 0 : _a18.status) != null ? _b : DataValidationStatus.VALID, validator = this._dataValidatorRegistryService.getValidatorItem(rule.type), cellOrigin = pos.rawData;
|
1855
1877
|
let cache;
|
1856
1878
|
const cellValue = {
|
1857
1879
|
get value() {
|
1858
|
-
var
|
1859
|
-
return cache !== void 0 || (cache = (
|
1880
|
+
var _a19;
|
1881
|
+
return cache !== void 0 || (cache = (_a19 = getCellValueOrigin(cellOrigin)) != null ? _a19 : null), cache;
|
1860
1882
|
}
|
1861
1883
|
}, valueStr = {
|
1862
1884
|
get value() {
|
1863
|
-
var
|
1864
|
-
return `${(
|
1885
|
+
var _a19;
|
1886
|
+
return `${(_a19 = cellValue.value) != null ? _a19 : ""}`;
|
1865
1887
|
}
|
1866
1888
|
};
|
1867
1889
|
return next({
|
@@ -1877,12 +1899,12 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1877
1899
|
...validStatus === DataValidationStatus.INVALID ? INVALID_MARK : null
|
1878
1900
|
},
|
1879
1901
|
customRender: [
|
1880
|
-
...(
|
1902
|
+
...(_c = cell == null ? void 0 : cell.customRender) != null ? _c : [],
|
1881
1903
|
...validator != null && validator.canvasRender ? [validator.canvasRender] : []
|
1882
1904
|
],
|
1883
1905
|
fontRenderExtension: {
|
1884
1906
|
...cell == null ? void 0 : cell.fontRenderExtension,
|
1885
|
-
isSkip: ((
|
1907
|
+
isSkip: ((_d = cell == null ? void 0 : cell.fontRenderExtension) == null ? void 0 : _d.isSkip) || ((_e = validator == null ? void 0 : validator.skipDefaultFontRender) == null ? void 0 : _e.call(validator, rule, cellValue.value, pos))
|
1886
1908
|
},
|
1887
1909
|
interceptorStyle: {
|
1888
1910
|
...cell == null ? void 0 : cell.interceptorStyle,
|
@@ -1894,8 +1916,8 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1894
1916
|
})
|
1895
1917
|
},
|
1896
1918
|
interceptorAutoHeight: /* @__PURE__ */ __name(() => {
|
1897
|
-
var
|
1898
|
-
const skeleton = (_b2 = (
|
1919
|
+
var _a19, _b2, _c2, _d2, _e2, _f2;
|
1920
|
+
const skeleton = (_b2 = (_a19 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a19.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b2.skeleton;
|
1899
1921
|
if (!skeleton)
|
1900
1922
|
return;
|
1901
1923
|
const mergeCell = skeleton.worksheet.getMergedCell(row, col), info = {
|
@@ -1917,9 +1939,9 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1917
1939
|
workbook,
|
1918
1940
|
worksheet
|
1919
1941
|
};
|
1920
|
-
return (
|
1942
|
+
return (_f2 = (_e2 = validator == null ? void 0 : validator.canvasRender) == null ? void 0 : _e2.calcCellAutoHeight) == null ? void 0 : _f2.call(_e2, info);
|
1921
1943
|
}, "interceptorAutoHeight"),
|
1922
|
-
coverable: ((
|
1944
|
+
coverable: ((_f = cell == null ? void 0 : cell.coverable) != null ? _f : !0) && !(rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE)
|
1923
1945
|
});
|
1924
1946
|
}, "handler")
|
1925
1947
|
}
|
@@ -1935,8 +1957,8 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1935
1957
|
).subscribe((infos) => {
|
1936
1958
|
const ranges = [];
|
1937
1959
|
if (infos.forEach((info) => {
|
1938
|
-
var
|
1939
|
-
(
|
1960
|
+
var _a18;
|
1961
|
+
(_a18 = info.rule) != null && _a18.ranges && ranges.push(...info.rule.ranges);
|
1940
1962
|
}), ranges.length) {
|
1941
1963
|
const mutations = this._autoHeightController.getUndoRedoParamsOfAutoHeight(ranges);
|
1942
1964
|
sequenceExecute(mutations.redos, this._commandService);
|
@@ -1944,22 +1966,23 @@ let SheetsDataValidationRenderController = (_a8 = class extends RxDisposable {
|
|
1944
1966
|
});
|
1945
1967
|
}
|
1946
1968
|
}, __name(_a8, "SheetsDataValidationRenderController"), _a8);
|
1947
|
-
SheetsDataValidationRenderController = __decorateClass$
|
1948
|
-
__decorateParam$
|
1949
|
-
__decorateParam$
|
1950
|
-
__decorateParam$
|
1951
|
-
__decorateParam$
|
1952
|
-
__decorateParam$
|
1953
|
-
__decorateParam$
|
1954
|
-
__decorateParam$
|
1955
|
-
__decorateParam$
|
1956
|
-
__decorateParam$
|
1957
|
-
__decorateParam$
|
1969
|
+
SheetsDataValidationRenderController = __decorateClass$8([
|
1970
|
+
__decorateParam$8(0, ICommandService),
|
1971
|
+
__decorateParam$8(1, IMenuManagerService),
|
1972
|
+
__decorateParam$8(2, IRenderManagerService),
|
1973
|
+
__decorateParam$8(3, IUniverInstanceService),
|
1974
|
+
__decorateParam$8(4, Inject(AutoHeightController)),
|
1975
|
+
__decorateParam$8(5, Inject(DataValidationDropdownManagerService)),
|
1976
|
+
__decorateParam$8(6, Inject(SheetDataValidationModel)),
|
1977
|
+
__decorateParam$8(7, Inject(DataValidatorRegistryService)),
|
1978
|
+
__decorateParam$8(8, Inject(SheetInterceptorService)),
|
1979
|
+
__decorateParam$8(9, Inject(DataValidationCacheService)),
|
1980
|
+
__decorateParam$8(10, Optional(IEditorBridgeService))
|
1958
1981
|
], SheetsDataValidationRenderController);
|
1959
1982
|
var _a9;
|
1960
1983
|
let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposable {
|
1961
|
-
constructor(_commandService, _renderManagerService, _autoHeightController, _dataValidatorRegistryService, _sheetInterceptorService, _sheetDataValidationModel) {
|
1962
|
-
super(), this._commandService = _commandService, this._renderManagerService = _renderManagerService, this._autoHeightController = _autoHeightController, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._sheetInterceptorService = _sheetInterceptorService, this._sheetDataValidationModel = _sheetDataValidationModel, this._initViewModelIntercept(), this._initAutoHeight();
|
1984
|
+
constructor(_commandService, _renderManagerService, _autoHeightController, _dataValidatorRegistryService, _sheetInterceptorService, _sheetDataValidationModel, _dataValidationCacheService) {
|
1985
|
+
super(), this._commandService = _commandService, this._renderManagerService = _renderManagerService, this._autoHeightController = _autoHeightController, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._sheetInterceptorService = _sheetInterceptorService, this._sheetDataValidationModel = _sheetDataValidationModel, this._dataValidationCacheService = _dataValidationCacheService, this._initViewModelIntercept(), this._initAutoHeight();
|
1963
1986
|
}
|
1964
1987
|
// eslint-disable-next-line max-lines-per-function
|
1965
1988
|
_initViewModelIntercept() {
|
@@ -1972,14 +1995,14 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
1972
1995
|
priority: InterceptCellContentPriority.DATA_VALIDATION,
|
1973
1996
|
// eslint-disable-next-line complexity
|
1974
1997
|
handler: /* @__PURE__ */ __name((cell, pos, next) => {
|
1975
|
-
var
|
1998
|
+
var _a18, _b, _c, _d, _e, _f;
|
1976
1999
|
const { row, col, unitId, subUnitId, workbook, worksheet } = pos, ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
|
1977
2000
|
if (!ruleId)
|
1978
2001
|
return next(cell);
|
1979
2002
|
const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
|
1980
2003
|
if (!rule)
|
1981
2004
|
return next(cell);
|
1982
|
-
const validStatus = this.
|
2005
|
+
const validStatus = (_b = (_a18 = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col)) == null ? void 0 : _a18.status) != null ? _b : DataValidationStatus.VALID, validator = this._dataValidatorRegistryService.getValidatorItem(rule.type), cellOrigin = worksheet.getCellRaw(row, col), cellValue = getCellValueOrigin(cellOrigin), valueStr = `${cellValue != null ? cellValue : ""}`;
|
1983
2006
|
return next({
|
1984
2007
|
...cell,
|
1985
2008
|
dataValidation: {
|
@@ -1993,12 +2016,12 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
1993
2016
|
...validStatus === DataValidationStatus.INVALID ? INVALID_MARK : null
|
1994
2017
|
},
|
1995
2018
|
customRender: [
|
1996
|
-
...(
|
2019
|
+
...(_c = cell == null ? void 0 : cell.customRender) != null ? _c : [],
|
1997
2020
|
...validator != null && validator.canvasRender ? [validator.canvasRender] : []
|
1998
2021
|
],
|
1999
2022
|
fontRenderExtension: {
|
2000
2023
|
...cell == null ? void 0 : cell.fontRenderExtension,
|
2001
|
-
isSkip: ((
|
2024
|
+
isSkip: ((_d = cell == null ? void 0 : cell.fontRenderExtension) == null ? void 0 : _d.isSkip) || ((_e = validator == null ? void 0 : validator.skipDefaultFontRender) == null ? void 0 : _e.call(validator, rule, cellValue, pos))
|
2002
2025
|
},
|
2003
2026
|
interceptorStyle: {
|
2004
2027
|
...cell == null ? void 0 : cell.interceptorStyle,
|
@@ -2010,8 +2033,8 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
2010
2033
|
})
|
2011
2034
|
},
|
2012
2035
|
interceptorAutoHeight: /* @__PURE__ */ __name(() => {
|
2013
|
-
var
|
2014
|
-
const skeleton = (_b2 = (
|
2036
|
+
var _a19, _b2, _c2, _d2, _e2, _f2;
|
2037
|
+
const skeleton = (_b2 = (_a19 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a19.with(SheetSkeletonManagerService).getWorksheetSkeleton(subUnitId)) == null ? void 0 : _b2.skeleton;
|
2015
2038
|
if (!skeleton)
|
2016
2039
|
return;
|
2017
2040
|
const mergeCell = skeleton.worksheet.getMergedCell(row, col), info = {
|
@@ -2033,9 +2056,9 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
2033
2056
|
workbook,
|
2034
2057
|
worksheet
|
2035
2058
|
};
|
2036
|
-
return (
|
2059
|
+
return (_f2 = (_e2 = validator == null ? void 0 : validator.canvasRender) == null ? void 0 : _e2.calcCellAutoHeight) == null ? void 0 : _f2.call(_e2, info);
|
2037
2060
|
}, "interceptorAutoHeight"),
|
2038
|
-
coverable: ((
|
2061
|
+
coverable: ((_f = cell == null ? void 0 : cell.coverable) != null ? _f : !0) && !(rule.type === DataValidationType.LIST || rule.type === DataValidationType.LIST_MULTIPLE)
|
2039
2062
|
});
|
2040
2063
|
}, "handler")
|
2041
2064
|
}
|
@@ -2049,8 +2072,8 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
2049
2072
|
).subscribe((infos) => {
|
2050
2073
|
const ranges = [];
|
2051
2074
|
if (infos.forEach((info) => {
|
2052
|
-
var
|
2053
|
-
(
|
2075
|
+
var _a18;
|
2076
|
+
(_a18 = info.rule) != null && _a18.ranges && ranges.push(...info.rule.ranges);
|
2054
2077
|
}), ranges.length) {
|
2055
2078
|
const mutations = this._autoHeightController.getUndoRedoParamsOfAutoHeight(ranges);
|
2056
2079
|
sequenceExecute(mutations.redos, this._commandService);
|
@@ -2058,14 +2081,44 @@ let SheetsDataValidationMobileRenderController = (_a9 = class extends RxDisposab
|
|
2058
2081
|
});
|
2059
2082
|
}
|
2060
2083
|
}, __name(_a9, "SheetsDataValidationMobileRenderController"), _a9);
|
2061
|
-
SheetsDataValidationMobileRenderController = __decorateClass$
|
2062
|
-
__decorateParam$
|
2063
|
-
__decorateParam$
|
2064
|
-
__decorateParam$
|
2065
|
-
__decorateParam$
|
2066
|
-
__decorateParam$
|
2067
|
-
__decorateParam$
|
2084
|
+
SheetsDataValidationMobileRenderController = __decorateClass$8([
|
2085
|
+
__decorateParam$8(0, ICommandService),
|
2086
|
+
__decorateParam$8(1, IRenderManagerService),
|
2087
|
+
__decorateParam$8(2, Inject(AutoHeightController)),
|
2088
|
+
__decorateParam$8(3, Inject(DataValidatorRegistryService)),
|
2089
|
+
__decorateParam$8(4, Inject(SheetInterceptorService)),
|
2090
|
+
__decorateParam$8(5, Inject(SheetDataValidationModel)),
|
2091
|
+
__decorateParam$8(6, Inject(DataValidationCacheService))
|
2068
2092
|
], SheetsDataValidationMobileRenderController);
|
2093
|
+
var __defProp$7 = Object.defineProperty, __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor, __decorateClass$7 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
2094
|
+
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
2095
|
+
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
2096
|
+
return kind && result && __defProp$7(target, key, result), result;
|
2097
|
+
}, "__decorateClass$7"), __decorateParam$7 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$7"), _a10;
|
2098
|
+
let SheetsDataValidationReRenderController = (_a10 = class extends Disposable {
|
2099
|
+
constructor(_context, _sheetDataValidationModel, _sheetSkeletonManagerService) {
|
2100
|
+
super(), this._context = _context, this._sheetDataValidationModel = _sheetDataValidationModel, this._sheetSkeletonManagerService = _sheetSkeletonManagerService, this._initSkeletonChange();
|
2101
|
+
}
|
2102
|
+
_initSkeletonChange() {
|
2103
|
+
const reRender = /* @__PURE__ */ __name((values) => {
|
2104
|
+
var _a18;
|
2105
|
+
if (!values.length)
|
2106
|
+
return;
|
2107
|
+
const sheetIds = /* @__PURE__ */ new Set();
|
2108
|
+
values.forEach((value) => {
|
2109
|
+
sheetIds.add(value.subUnitId);
|
2110
|
+
}), sheetIds.forEach((sheetId) => {
|
2111
|
+
var _a19;
|
2112
|
+
(_a19 = this._sheetSkeletonManagerService.getWorksheetSkeleton(sheetId)) == null || _a19.skeleton.makeDirty(!0);
|
2113
|
+
}), (_a18 = this._context.mainComponent) == null || _a18.makeForceDirty();
|
2114
|
+
}, "reRender");
|
2115
|
+
this.disposeWithMe(this._sheetDataValidationModel.validStatusChange$.pipe(bufferDebounceTime(16)).subscribe(reRender));
|
2116
|
+
}
|
2117
|
+
}, __name(_a10, "SheetsDataValidationReRenderController"), _a10);
|
2118
|
+
SheetsDataValidationReRenderController = __decorateClass$7([
|
2119
|
+
__decorateParam$7(1, Inject(SheetDataValidationModel)),
|
2120
|
+
__decorateParam$7(2, Inject(SheetSkeletonManagerService))
|
2121
|
+
], SheetsDataValidationReRenderController);
|
2069
2122
|
const dataValidationFormula = "univer-data-validation-formula", dataValidationFormulaAnd = "univer-data-validation-formula-and", dataValidationFormulaListItem = "univer-data-validation-formula-list-item", dataValidationFormulaListItemIcon = "univer-data-validation-formula-list-item-icon", dataValidationFormulaListItemDrag = "univer-data-validation-formula-list-item-drag", dataValidationFormulaListAdd = "univer-data-validation-formula-list-add", dataValidationFormulaColorSelect = "univer-data-validation-formula-color-select", dataValidationFormulaColorSelectPanel = "univer-data-validation-formula-color-select-panel", dataValidationFormulaColorItem = "univer-data-validation-formula-color-item", styles = {
|
2070
2123
|
dataValidationFormula,
|
2071
2124
|
dataValidationFormulaAnd,
|
@@ -2169,12 +2222,12 @@ function CheckboxFormulaInput(props) {
|
|
2169
2222
|
}
|
2170
2223
|
__name(CheckboxFormulaInput, "CheckboxFormulaInput");
|
2171
2224
|
function CustomFormulaInput(props) {
|
2172
|
-
var
|
2225
|
+
var _a18;
|
2173
2226
|
const { unitId, subUnitId, value, onChange, showError, validResult } = props, formula1Res = showError ? validResult == null ? void 0 : validResult.formula1 : "";
|
2174
2227
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { error: formula1Res, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
2175
2228
|
TextEditor,
|
2176
2229
|
{
|
2177
|
-
value: (
|
2230
|
+
value: (_a18 = value == null ? void 0 : value.formula1) != null ? _a18 : "",
|
2178
2231
|
id: createInternalEditorID(`dataValidation-custom-formula-${unitId}-${subUnitId}`),
|
2179
2232
|
onChange: /* @__PURE__ */ __name((newValue) => {
|
2180
2233
|
onChange == null || onChange({
|
@@ -2463,9 +2516,9 @@ const CUSTOM_FORMULA_INPUT_NAME = "data-validation.custom-formula-input", BASE_F
|
|
2463
2516
|
]
|
2464
2517
|
], LIST_RENDER_MODE_OPTION_INPUT = "LIST_RENDER_MODE_OPTION_INPUT";
|
2465
2518
|
function ListRenderModeInput(props) {
|
2466
|
-
var
|
2519
|
+
var _a18;
|
2467
2520
|
const { value, onChange } = props, localeService = useDependency(LocaleService);
|
2468
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(RadioGroup, { value: `${(
|
2521
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { label: localeService.t("dataValidation.renderMode.label"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(RadioGroup, { value: `${(_a18 = value.renderMode) != null ? _a18 : DataValidationRenderMode.CUSTOM}`, onChange: /* @__PURE__ */ __name((renderMode) => onChange({ ...value, renderMode: +renderMode }), "onChange"), children: [
|
2469
2522
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.CUSTOM}`, children: localeService.t("dataValidation.renderMode.chip") }),
|
2470
2523
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.ARROW}`, children: localeService.t("dataValidation.renderMode.arrow") }),
|
2471
2524
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { value: `${DataValidationRenderMode.TEXT}`, children: localeService.t("dataValidation.renderMode.text") })
|
@@ -2475,12 +2528,12 @@ __name(ListRenderModeInput, "ListRenderModeInput");
|
|
2475
2528
|
ListRenderModeInput.componentKey = LIST_RENDER_MODE_OPTION_INPUT;
|
2476
2529
|
const DATE_SHOW_TIME_OPTION = "DATE_SHOW_TIME_OPTION";
|
2477
2530
|
function DateShowTimeOption(props) {
|
2478
|
-
var
|
2531
|
+
var _a18;
|
2479
2532
|
const { value, onChange } = props, localeService = useDependency(LocaleService);
|
2480
2533
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(FormLayout, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
2481
2534
|
Checkbox,
|
2482
2535
|
{
|
2483
|
-
checked: (
|
2536
|
+
checked: (_a18 = value.bizInfo) == null ? void 0 : _a18.showTime,
|
2484
2537
|
onChange: /* @__PURE__ */ __name((showTime) => {
|
2485
2538
|
onChange({
|
2486
2539
|
...value,
|
@@ -2502,14 +2555,14 @@ var __defProp$6 = Object.defineProperty, __getOwnPropDesc$6 = Object.getOwnPrope
|
|
2502
2555
|
return kind && result && __defProp$6(target, key, result), result;
|
2503
2556
|
}, "__decorateClass$6"), __decorateParam$6 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$6");
|
2504
2557
|
const MARGIN_H$2 = 6;
|
2505
|
-
var
|
2506
|
-
let CheckboxRender = (
|
2558
|
+
var _a11;
|
2559
|
+
let CheckboxRender = (_a11 = class {
|
2507
2560
|
constructor(_commandService, _formulaService, _themeService) {
|
2508
2561
|
this._commandService = _commandService, this._formulaService = _formulaService, this._themeService = _themeService;
|
2509
2562
|
}
|
2510
2563
|
_calc(cellInfo, style) {
|
2511
|
-
var
|
2512
|
-
const { vt, ht } = style || {}, width = cellInfo.endX - cellInfo.startX - MARGIN_H$2 * 2, height = cellInfo.endY - cellInfo.startY, size = ((
|
2564
|
+
var _a18, _b, _c;
|
2565
|
+
const { vt, ht } = style || {}, width = cellInfo.endX - cellInfo.startX - MARGIN_H$2 * 2, height = cellInfo.endY - cellInfo.startY, size = ((_a18 = style == null ? void 0 : style.fs) != null ? _a18 : 10) * 1.6;
|
2513
2566
|
let widgetLeft = 0, widgetTop = 0;
|
2514
2567
|
switch (vt) {
|
2515
2568
|
case VerticalAlign.TOP:
|
@@ -2541,21 +2594,21 @@ let CheckboxRender = (_a10 = class {
|
|
2541
2594
|
};
|
2542
2595
|
}
|
2543
2596
|
calcCellAutoHeight(info) {
|
2544
|
-
var
|
2597
|
+
var _a18;
|
2545
2598
|
const { style } = info;
|
2546
|
-
return ((
|
2599
|
+
return ((_a18 = style == null ? void 0 : style.fs) != null ? _a18 : 10) * 1.6;
|
2547
2600
|
}
|
2548
2601
|
async _parseFormula(rule, unitId, subUnitId) {
|
2549
|
-
var
|
2602
|
+
var _a18, _b;
|
2550
2603
|
const { formula1 = CHECKBOX_FORMULA_1, formula2 = CHECKBOX_FORMULA_2 } = rule, results = await this._formulaService.getRuleFormulaResult(unitId, subUnitId, rule.uid);
|
2551
2604
|
return {
|
2552
|
-
formula1: isFormulaString(formula1) ? getFormulaResult((
|
2605
|
+
formula1: isFormulaString(formula1) ? getFormulaResult((_a18 = results == null ? void 0 : results[0]) == null ? void 0 : _a18.result) : formula1,
|
2553
2606
|
formula2: isFormulaString(formula2) ? getFormulaResult((_b = results == null ? void 0 : results[1]) == null ? void 0 : _b.result) : formula2
|
2554
2607
|
};
|
2555
2608
|
}
|
2556
2609
|
drawWith(ctx, info) {
|
2557
|
-
var
|
2558
|
-
const { style, data, primaryWithCoord, unitId, subUnitId, worksheet, row, col } = info, cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (
|
2610
|
+
var _a18, _b, _c, _d, _e, _f;
|
2611
|
+
const { style, data, primaryWithCoord, unitId, subUnitId, worksheet, row, col } = info, cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (_a18 = data.dataValidation) == null ? void 0 : _a18.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator;
|
2559
2612
|
if (!rule || !validator)
|
2560
2613
|
return;
|
2561
2614
|
const colors = this._themeService.getCurrentTheme();
|
@@ -2588,10 +2641,10 @@ let CheckboxRender = (_a10 = class {
|
|
2588
2641
|
return offsetX <= endX && offsetX >= startX && offsetY <= endY && offsetY >= startY;
|
2589
2642
|
}
|
2590
2643
|
async onPointerDown(info, evt) {
|
2591
|
-
var
|
2644
|
+
var _a18, _b, _c;
|
2592
2645
|
if (evt.button === 2)
|
2593
2646
|
return;
|
2594
|
-
const { primaryWithCoord, unitId, subUnitId, data, worksheet, row, col } = info, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (
|
2647
|
+
const { primaryWithCoord, unitId, subUnitId, data, worksheet, row, col } = info, value = getCellValueOrigin(worksheet.getCellRaw(row, col)), rule = (_a18 = data.dataValidation) == null ? void 0 : _a18.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator;
|
2595
2648
|
if (!rule || !validator || !((_c = validator.skipDefaultFontRender) != null && _c.call(validator, rule, value, { unitId, subUnitId })))
|
2596
2649
|
return;
|
2597
2650
|
const { formula1, formula2 } = await this._parseFormula(rule, unitId, subUnitId), params = {
|
@@ -2611,7 +2664,7 @@ let CheckboxRender = (_a10 = class {
|
|
2611
2664
|
params
|
2612
2665
|
);
|
2613
2666
|
}
|
2614
|
-
}, __name(
|
2667
|
+
}, __name(_a11, "CheckboxRender"), _a11);
|
2615
2668
|
CheckboxRender = __decorateClass$6([
|
2616
2669
|
__decorateParam$6(0, ICommandService),
|
2617
2670
|
__decorateParam$6(1, Inject(DataValidationFormulaService)),
|
@@ -2621,8 +2674,8 @@ var __defProp$5 = Object.defineProperty, __getOwnPropDesc$5 = Object.getOwnPrope
|
|
2621
2674
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
2622
2675
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
2623
2676
|
return kind && result && __defProp$5(target, key, result), result;
|
2624
|
-
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"),
|
2625
|
-
let BaseSheetDataValidatorView = (
|
2677
|
+
}, "__decorateClass$5"), __decorateParam$5 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$5"), _a12;
|
2678
|
+
let BaseSheetDataValidatorView = (_a12 = class {
|
2626
2679
|
constructor(injector) {
|
2627
2680
|
__publicField(this, "canvasRender", null);
|
2628
2681
|
__publicField(this, "dropdown");
|
@@ -2630,7 +2683,7 @@ let BaseSheetDataValidatorView = (_a11 = class {
|
|
2630
2683
|
__publicField(this, "formulaInput", LIST_FORMULA_INPUT_NAME);
|
2631
2684
|
this.injector = injector;
|
2632
2685
|
}
|
2633
|
-
}, __name(
|
2686
|
+
}, __name(_a12, "BaseSheetDataValidatorView"), _a12);
|
2634
2687
|
BaseSheetDataValidatorView = __decorateClass$5([
|
2635
2688
|
__decorateParam$5(0, Inject(Injector))
|
2636
2689
|
], BaseSheetDataValidatorView);
|
@@ -2735,8 +2788,8 @@ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPrope
|
|
2735
2788
|
return kind && result && __defProp$4(target, key, result), result;
|
2736
2789
|
}, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4");
|
2737
2790
|
const downPath$1 = new Path2D("M3.32201 4.84556C3.14417 5.05148 2.85583 5.05148 2.67799 4.84556L0.134292 1.90016C-0.152586 1.56798 0.0505937 1 0.456301 1L5.5437 1C5.94941 1 6.15259 1.56798 5.86571 1.90016L3.32201 4.84556Z");
|
2738
|
-
var
|
2739
|
-
let DropdownMultipleWidget = (
|
2791
|
+
var _a13;
|
2792
|
+
let DropdownMultipleWidget = (_a13 = class {
|
2740
2793
|
constructor(_commandService) {
|
2741
2794
|
__publicField(this, "zIndex");
|
2742
2795
|
__publicField(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
@@ -2764,7 +2817,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
2764
2817
|
}
|
2765
2818
|
// eslint-disable-next-line max-lines-per-function
|
2766
2819
|
drawWith(ctx, info, skeleton, spreadsheets) {
|
2767
|
-
var
|
2820
|
+
var _a18, _b;
|
2768
2821
|
const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, validation = data.dataValidation, map = this._ensureMap(subUnitId), key = this._generateKey(row, col);
|
2769
2822
|
if (!validation)
|
2770
2823
|
return;
|
@@ -2773,7 +2826,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
2773
2826
|
endX: _cellBounding.endX - rightOffset,
|
2774
2827
|
startY: _cellBounding.startY + topOffset,
|
2775
2828
|
endY: _cellBounding.endY - downOffset
|
2776
|
-
}, cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, { cl } = style || {}, color = (
|
2829
|
+
}, cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, { cl } = style || {}, color = (_a18 = typeof cl == "object" ? cl == null ? void 0 : cl.rgb : cl) != null ? _a18 : "#000", fontStyle = getFontStyleString(style != null ? style : void 0), { rule, validator: _validator } = validation, validator = _validator, { vt: _vt, ht } = style || {}, vt = _vt != null ? _vt : VerticalAlign.MIDDLE, cellValue = (_b = getCellValueOrigin(data)) != null ? _b : "", items = validator.parseCellValue(cellValue), labelColorMap = validator.getListWithColorMap(rule), layout = layoutDropdowns(items, fontStyle, cellWidth, cellHeight);
|
2777
2830
|
this._drawDownIcon(ctx, cellBounding, cellWidth, cellHeight, vt), ctx.save(), ctx.translateWithPrecision(cellBounding.startX, cellBounding.startY), ctx.beginPath(), ctx.rect(0, 0, cellWidth - ICON_PLACE$1, cellHeight), ctx.clip(), ctx.translateWithPrecision(CELL_PADDING_H, CELL_PADDING_V);
|
2778
2831
|
let top = 0;
|
2779
2832
|
switch (vt) {
|
@@ -2812,7 +2865,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
2812
2865
|
});
|
2813
2866
|
}
|
2814
2867
|
calcCellAutoHeight(info) {
|
2815
|
-
var
|
2868
|
+
var _a18;
|
2816
2869
|
const { primaryWithCoord, style, data } = info, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, cellBounding = {
|
2817
2870
|
startX: _cellBounding.startX + leftOffset,
|
2818
2871
|
endX: _cellBounding.endX - rightOffset,
|
@@ -2821,7 +2874,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
2821
2874
|
}, validation = data.dataValidation;
|
2822
2875
|
if (!validation)
|
2823
2876
|
return;
|
2824
|
-
const cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, cellValue = (
|
2877
|
+
const cellWidth = cellBounding.endX - cellBounding.startX, cellHeight = cellBounding.endY - cellBounding.startY, cellValue = (_a18 = getCellValueOrigin(data)) != null ? _a18 : "", { validator: _validator } = validation, items = _validator.parseCellValue(cellValue), fontStyle = getFontStyleString(style != null ? style : void 0);
|
2825
2878
|
return layoutDropdowns(items, fontStyle, cellWidth, cellHeight).cellAutoHeight;
|
2826
2879
|
}
|
2827
2880
|
isHit(position, info) {
|
@@ -2839,7 +2892,7 @@ let DropdownMultipleWidget = (_a12 = class {
|
|
2839
2892
|
};
|
2840
2893
|
this._commandService.executeCommand(ShowDataValidationDropdown.id, params);
|
2841
2894
|
}
|
2842
|
-
}, __name(
|
2895
|
+
}, __name(_a13, "DropdownMultipleWidget"), _a13);
|
2843
2896
|
DropdownMultipleWidget = __decorateClass$4([
|
2844
2897
|
__decorateParam$4(0, ICommandService)
|
2845
2898
|
], DropdownMultipleWidget);
|
@@ -2955,8 +3008,8 @@ function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht, margi
|
|
2955
3008
|
};
|
2956
3009
|
}
|
2957
3010
|
__name(calcPadding, "calcPadding");
|
2958
|
-
var
|
2959
|
-
let DropdownWidget = (
|
3011
|
+
var _a14;
|
3012
|
+
let DropdownWidget = (_a14 = class {
|
2960
3013
|
constructor(_localeService, _commandService) {
|
2961
3014
|
__publicField(this, "_dropdownInfoMap", /* @__PURE__ */ new Map());
|
2962
3015
|
__publicField(this, "zIndex");
|
@@ -2989,8 +3042,8 @@ let DropdownWidget = (_a13 = class {
|
|
2989
3042
|
}
|
2990
3043
|
// eslint-disable-next-line max-lines-per-function, complexity
|
2991
3044
|
drawWith(ctx, info, skeleton) {
|
2992
|
-
var
|
2993
|
-
const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, rule = (
|
3045
|
+
var _a18, _b;
|
3046
|
+
const { primaryWithCoord, row, col, style, data, subUnitId } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, rule = (_a18 = data.dataValidation) == null ? void 0 : _a18.rule, validator = (_b = data.dataValidation) == null ? void 0 : _b.validator, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {};
|
2994
3047
|
if (!rule || !validator || !validator || validator.id.indexOf(DataValidationType.LIST) !== 0 || !validator.skipDefaultFontRender(rule))
|
2995
3048
|
return;
|
2996
3049
|
const cellBounding = {
|
@@ -3031,8 +3084,8 @@ let DropdownWidget = (_a13 = class {
|
|
3031
3084
|
}
|
3032
3085
|
}
|
3033
3086
|
calcCellAutoHeight(info) {
|
3034
|
-
var
|
3035
|
-
const { primaryWithCoord, style, data } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, rule = (
|
3087
|
+
var _a18;
|
3088
|
+
const { primaryWithCoord, style, data } = info, _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord, fontRenderExtension = data.fontRenderExtension, { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = fontRenderExtension || {}, rule = (_a18 = data.dataValidation) == null ? void 0 : _a18.rule;
|
3036
3089
|
if (!rule || rule.renderMode === DataValidationRenderMode.TEXT)
|
3037
3090
|
return;
|
3038
3091
|
const cellBounding = {
|
@@ -3075,7 +3128,7 @@ let DropdownWidget = (_a13 = class {
|
|
3075
3128
|
};
|
3076
3129
|
this._commandService.executeCommand(ShowDataValidationDropdown.id, params);
|
3077
3130
|
}
|
3078
|
-
}, __name(
|
3131
|
+
}, __name(_a14, "DropdownWidget"), _a14);
|
3079
3132
|
DropdownWidget = __decorateClass$3([
|
3080
3133
|
__decorateParam$3(0, Inject(LocaleService)),
|
3081
3134
|
__decorateParam$3(1, ICommandService)
|
@@ -3114,8 +3167,8 @@ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPrope
|
|
3114
3167
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
3115
3168
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
3116
3169
|
return kind && result && __defProp$2(target, key, result), result;
|
3117
|
-
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"),
|
3118
|
-
let SheetsDataValidationUIController = (
|
3170
|
+
}, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a15;
|
3171
|
+
let SheetsDataValidationUIController = (_a15 = class extends RxDisposable {
|
3119
3172
|
constructor(_injector, _componentManger, _dataValidatorRegistryService) {
|
3120
3173
|
super(), this._injector = _injector, this._componentManger = _componentManger, this._dataValidatorRegistryService = _dataValidatorRegistryService, this._initComponents(), this._registerValidatorViews();
|
3121
3174
|
}
|
@@ -3151,7 +3204,7 @@ let SheetsDataValidationUIController = (_a14 = class extends RxDisposable {
|
|
3151
3204
|
validator && (validator.formulaInput = view.formulaInput, validator.canvasRender = view.canvasRender, validator.dropdown = view.dropdown, validator.optionsInput = view.optionsInput);
|
3152
3205
|
});
|
3153
3206
|
}
|
3154
|
-
}, __name(
|
3207
|
+
}, __name(_a15, "SheetsDataValidationUIController"), _a15);
|
3155
3208
|
SheetsDataValidationUIController = __decorateClass$2([
|
3156
3209
|
__decorateParam$2(0, Inject(Injector)),
|
3157
3210
|
__decorateParam$2(1, Inject(ComponentManager)),
|
@@ -3163,8 +3216,8 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
3163
3216
|
return kind && result && __defProp$1(target, key, result), result;
|
3164
3217
|
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
|
3165
3218
|
const PLUGIN_NAME$1 = "SHEET_DATA_VALIDATION_UI_PLUGIN";
|
3166
|
-
var
|
3167
|
-
let UniverSheetsDataValidationUIPlugin = (
|
3219
|
+
var _a16;
|
3220
|
+
let UniverSheetsDataValidationUIPlugin = (_a16 = class extends Plugin {
|
3168
3221
|
constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
|
3169
3222
|
super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._configService = _configService;
|
3170
3223
|
const { menu, ...rest } = this._config;
|
@@ -3195,7 +3248,10 @@ let UniverSheetsDataValidationUIPlugin = (_a15 = class extends Plugin {
|
|
3195
3248
|
});
|
3196
3249
|
}
|
3197
3250
|
onReady() {
|
3198
|
-
this._injector.get(DataValidationCopyPasteController), this._injector.get(DataValidationPermissionController), this._injector.get(DataValidationRejectInputController), this._injector.get(DataValidationAlertController)
|
3251
|
+
this._injector.get(DataValidationCopyPasteController), this._injector.get(DataValidationPermissionController), this._injector.get(DataValidationRejectInputController), this._injector.get(DataValidationAlertController), this._injector.get(IRenderManagerService).registerRenderModule(
|
3252
|
+
UniverInstanceType.UNIVER_SHEET,
|
3253
|
+
[SheetsDataValidationReRenderController]
|
3254
|
+
);
|
3199
3255
|
}
|
3200
3256
|
onRendered() {
|
3201
3257
|
this._injector.get(SheetsDataValidationUIController), this._injector.get(SheetsDataValidationRenderController);
|
@@ -3203,7 +3259,7 @@ let UniverSheetsDataValidationUIPlugin = (_a15 = class extends Plugin {
|
|
3203
3259
|
onSteady() {
|
3204
3260
|
this._injector.get(DataValidationAutoFillController);
|
3205
3261
|
}
|
3206
|
-
}, __name(
|
3262
|
+
}, __name(_a16, "UniverSheetsDataValidationUIPlugin"), __publicField(_a16, "pluginName", PLUGIN_NAME$1), __publicField(_a16, "type", UniverInstanceType.UNIVER_SHEET), _a16);
|
3207
3263
|
UniverSheetsDataValidationUIPlugin = __decorateClass$1([
|
3208
3264
|
__decorateParam$1(1, Inject(Injector)),
|
3209
3265
|
__decorateParam$1(2, ICommandService),
|
@@ -3215,8 +3271,8 @@ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnProperty
|
|
3215
3271
|
return kind && result && __defProp2(target, key, result), result;
|
3216
3272
|
}, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
|
3217
3273
|
const PLUGIN_NAME = "SHEET_DATA_VALIDATION_UI_PLUGIN";
|
3218
|
-
var
|
3219
|
-
let UniverSheetsDataValidationMobileUIPlugin = (
|
3274
|
+
var _a17;
|
3275
|
+
let UniverSheetsDataValidationMobileUIPlugin = (_a17 = class extends Plugin {
|
3220
3276
|
constructor(_config = defaultPluginConfig, _injector, _commandService, _configService) {
|
3221
3277
|
super(), this._config = _config, this._injector = _injector, this._commandService = _commandService, this._configService = _configService;
|
3222
3278
|
const { menu, ...rest } = this._config;
|
@@ -3246,7 +3302,10 @@ let UniverSheetsDataValidationMobileUIPlugin = (_a16 = class extends Plugin {
|
|
3246
3302
|
});
|
3247
3303
|
}
|
3248
3304
|
onReady() {
|
3249
|
-
this._injector.get(DataValidationCopyPasteController), this._injector.get(DataValidationPermissionController)
|
3305
|
+
this._injector.get(DataValidationCopyPasteController), this._injector.get(DataValidationPermissionController), this._injector.get(IRenderManagerService).registerRenderModule(
|
3306
|
+
UniverInstanceType.UNIVER_SHEET,
|
3307
|
+
[SheetsDataValidationReRenderController]
|
3308
|
+
);
|
3250
3309
|
}
|
3251
3310
|
onRendered() {
|
3252
3311
|
this._injector.get(SheetsDataValidationUIController), this._injector.get(SheetsDataValidationRenderController);
|
@@ -3254,7 +3313,7 @@ let UniverSheetsDataValidationMobileUIPlugin = (_a16 = class extends Plugin {
|
|
3254
3313
|
onSteady() {
|
3255
3314
|
this._injector.get(DataValidationAutoFillController);
|
3256
3315
|
}
|
3257
|
-
}, __name(
|
3316
|
+
}, __name(_a17, "UniverSheetsDataValidationMobileUIPlugin"), __publicField(_a17, "pluginName", PLUGIN_NAME), __publicField(_a17, "type", UniverInstanceType.UNIVER_SHEET), _a17);
|
3258
3317
|
UniverSheetsDataValidationMobileUIPlugin = __decorateClass([
|
3259
3318
|
__decorateParam(1, Inject(Injector)),
|
3260
3319
|
__decorateParam(2, ICommandService),
|