@univerjs/sheets-data-validation-ui 1.0.0-alpha.8 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +85 -117
- package/lib/es/index.js +86 -118
- package/lib/index.js +86 -118
- package/lib/umd/index.js +1 -1
- package/package.json +15 -15
package/lib/cjs/index.js
CHANGED
|
@@ -303,7 +303,7 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
|
|
|
303
303
|
if (!(validator === null || validator === void 0 ? void 0 : validator.dropdownType)) return;
|
|
304
304
|
let popupDisposable;
|
|
305
305
|
const handleSave = async (date, targetPatternType) => {
|
|
306
|
-
var _numfmt$parseDate, _cellStyle$n
|
|
306
|
+
var _numfmt$parseDate, _cellStyle$n;
|
|
307
307
|
if (!date) return true;
|
|
308
308
|
const newValue = date;
|
|
309
309
|
const cellData = worksheet.getCell(row, col);
|
|
@@ -311,7 +311,7 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
|
|
|
311
311
|
const serialNum = (_numfmt$parseDate = _univerjs_core.numfmt.parseDate(dateStr)) === null || _numfmt$parseDate === void 0 ? void 0 : _numfmt$parseDate.v;
|
|
312
312
|
const serialTime = targetPatternType === "time" ? serialNum % 1 : serialNum;
|
|
313
313
|
const cellStyle = workbook.getStyles().getStyleByCell(cellData);
|
|
314
|
-
const format = (
|
|
314
|
+
const format = (cellStyle === null || cellStyle === void 0 || (_cellStyle$n = cellStyle.n) === null || _cellStyle$n === void 0 ? void 0 : _cellStyle$n.pattern) ?? "";
|
|
315
315
|
if (rule.errorStyle !== _univerjs_core.DataValidationErrorStyle.STOP || await validator.validator({
|
|
316
316
|
value: serialTime,
|
|
317
317
|
unitId,
|
|
@@ -405,11 +405,10 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
|
|
|
405
405
|
}
|
|
406
406
|
case _univerjs_data_validation.DataValidatorDropdownType.LIST:
|
|
407
407
|
case _univerjs_data_validation.DataValidatorDropdownType.MULTIPLE_LIST: {
|
|
408
|
-
var _this$_configService$, _this$_configService$2
|
|
408
|
+
var _this$_configService$, _this$_configService$2;
|
|
409
409
|
const multiple = validator.dropdownType === _univerjs_data_validation.DataValidatorDropdownType.MULTIPLE_LIST;
|
|
410
410
|
const handleSave = async (newValue) => {
|
|
411
|
-
|
|
412
|
-
const str = multiple ? (0, _univerjs_sheets.serializeListOptions)(newValue) : (_newValue$ = newValue[0]) !== null && _newValue$ !== void 0 ? _newValue$ : "";
|
|
411
|
+
const str = multiple ? (0, _univerjs_sheets.serializeListOptions)(newValue) : newValue[0] ?? "";
|
|
413
412
|
const params = {
|
|
414
413
|
unitId,
|
|
415
414
|
subUnitId,
|
|
@@ -456,14 +455,13 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
|
|
|
456
455
|
onEdit: handleEdit,
|
|
457
456
|
defaultValue: cellStr,
|
|
458
457
|
multiple,
|
|
459
|
-
showEdit: (
|
|
460
|
-
showSearch: (
|
|
458
|
+
showEdit: ((_this$_configService$ = this._configService.getConfig("sheets-data-validation-ui.config")) === null || _this$_configService$ === void 0 ? void 0 : _this$_configService$.showEditOnDropdown) ?? true,
|
|
459
|
+
showSearch: ((_this$_configService$2 = this._configService.getConfig("sheets-data-validation-ui.config")) === null || _this$_configService$2 === void 0 ? void 0 : _this$_configService$2.showSearchOnDropdown) ?? true
|
|
461
460
|
}
|
|
462
461
|
};
|
|
463
462
|
break;
|
|
464
463
|
}
|
|
465
464
|
case _univerjs_data_validation.DataValidatorDropdownType.CASCADE: {
|
|
466
|
-
var _rule$formula;
|
|
467
465
|
const handleSave = (newValue) => {
|
|
468
466
|
const params = {
|
|
469
467
|
unitId,
|
|
@@ -495,7 +493,7 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
|
|
|
495
493
|
props: {
|
|
496
494
|
onChange: handleSave,
|
|
497
495
|
defaultValue: (0, _univerjs_sheets_data_validation.getDataValidationCellValue)(worksheet.getCellRaw(row, col)).split("/"),
|
|
498
|
-
options: JSON.parse(
|
|
496
|
+
options: JSON.parse(rule.formula1 ?? "[]")
|
|
499
497
|
},
|
|
500
498
|
location
|
|
501
499
|
};
|
|
@@ -992,12 +990,11 @@ const menuSchema = {
|
|
|
992
990
|
//#endregion
|
|
993
991
|
//#region package.json
|
|
994
992
|
var name = "@univerjs/sheets-data-validation-ui";
|
|
995
|
-
var version = "1.0.0-
|
|
993
|
+
var version = "1.0.0-beta.0";
|
|
996
994
|
|
|
997
995
|
//#endregion
|
|
998
996
|
//#region src/views/components/DataValidationOptions.tsx
|
|
999
997
|
function DataValidationOptions(props) {
|
|
1000
|
-
var _value$errorStyle;
|
|
1001
998
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
1002
999
|
const componentManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.ComponentManager);
|
|
1003
1000
|
const { value, onChange, extraComponent } = props;
|
|
@@ -1015,7 +1012,7 @@ function DataValidationOptions(props) {
|
|
|
1015
1012
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
|
|
1016
1013
|
label: localeService.t("sheets-data-validation-ui.panel.invalid"),
|
|
1017
1014
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.RadioGroup, {
|
|
1018
|
-
value: `${
|
|
1015
|
+
value: `${value.errorStyle ?? _univerjs_core.DataValidationErrorStyle.WARNING}`,
|
|
1019
1016
|
onChange: (errorStyle) => onChange({
|
|
1020
1017
|
...value,
|
|
1021
1018
|
errorStyle: +errorStyle
|
|
@@ -1075,7 +1072,7 @@ function DataValidationDetail() {
|
|
|
1075
1072
|
} });
|
|
1076
1073
|
}
|
|
1077
1074
|
function DataValidationDetailInner(props) {
|
|
1078
|
-
var _validators$sort
|
|
1075
|
+
var _validators$sort;
|
|
1079
1076
|
const [key, setKey] = (0, react.useState)(0);
|
|
1080
1077
|
const dataValidationPanelService = (0, _univerjs_ui.useDependency)(DataValidationPanelService);
|
|
1081
1078
|
const { unitId, subUnitId, rule } = props.activeRuleInfo;
|
|
@@ -1087,10 +1084,7 @@ function DataValidationDetailInner(props) {
|
|
|
1087
1084
|
const dataValidationModel = (0, _univerjs_ui.useDependency)(_univerjs_data_validation.DataValidationModel);
|
|
1088
1085
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
1089
1086
|
const workbook = (0, _univerjs_ui.useObservable)(() => univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
|
|
1090
|
-
const worksheet = (0, _univerjs_ui.useObservable)(() =>
|
|
1091
|
-
var _workbook$activeSheet;
|
|
1092
|
-
return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : (0, rxjs.of)(null);
|
|
1093
|
-
}, void 0, void 0, []);
|
|
1087
|
+
const worksheet = (0, _univerjs_ui.useObservable)(() => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? (0, rxjs.of)(null), void 0, void 0, []);
|
|
1094
1088
|
const [localRule, setLocalRule] = (0, react.useState)(rule);
|
|
1095
1089
|
const validator = validatorService.getValidatorItem(localRule.type);
|
|
1096
1090
|
const [showError, setShowError] = (0, react.useState)(false);
|
|
@@ -1338,14 +1332,11 @@ function DataValidationDetailInner(props) {
|
|
|
1338
1332
|
ruleId
|
|
1339
1333
|
}, key + localRule.type) : null,
|
|
1340
1334
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Checkbox, {
|
|
1341
|
-
checked:
|
|
1342
|
-
onChange: () => {
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
allowBlank: !((_localRule$allowBlank2 = localRule.allowBlank) !== null && _localRule$allowBlank2 !== void 0 ? _localRule$allowBlank2 : true)
|
|
1347
|
-
});
|
|
1348
|
-
},
|
|
1335
|
+
checked: localRule.allowBlank ?? true,
|
|
1336
|
+
onChange: () => handleUpdateRuleSetting({
|
|
1337
|
+
...baseRule,
|
|
1338
|
+
allowBlank: !(localRule.allowBlank ?? true)
|
|
1339
|
+
}),
|
|
1349
1340
|
children: localeService.t("sheets-data-validation-ui.panel.allowBlank")
|
|
1350
1341
|
}) }),
|
|
1351
1342
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataValidationOptions, {
|
|
@@ -1382,10 +1373,9 @@ const DataValidationItem = (props) => {
|
|
|
1382
1373
|
const [isHover, setIsHover] = (0, react.useState)(false);
|
|
1383
1374
|
const themeService = (0, _univerjs_ui.useDependency)(_univerjs_core.ThemeService);
|
|
1384
1375
|
const style = (0, react.useMemo)(() => {
|
|
1385
|
-
var _themeService$getColo;
|
|
1386
1376
|
const defaultColor = themeService.getColorFromTheme("primary.600");
|
|
1387
1377
|
const key = themeService.getColorFromTheme("loop-color.2");
|
|
1388
|
-
const color =
|
|
1378
|
+
const color = themeService.getColorFromTheme(key) ?? defaultColor;
|
|
1389
1379
|
const rgb = new _univerjs_core.ColorKit(color).toRgb();
|
|
1390
1380
|
return {
|
|
1391
1381
|
fill: `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 0.1)`,
|
|
@@ -1506,23 +1496,20 @@ function DataValidationList(props) {
|
|
|
1506
1496
|
const hasDisableRule = rulesByPermissionCheck === null || rulesByPermissionCheck === void 0 ? void 0 : rulesByPermissionCheck.some((rule) => rule.disable);
|
|
1507
1497
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1508
1498
|
className: "univer-pb-4",
|
|
1509
|
-
children: [rulesByPermissionCheck === null || rulesByPermissionCheck === void 0 ? void 0 : rulesByPermissionCheck.map((rule) => {
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
disable: (_rule$disable = rule.disable) !== null && _rule$disable !== void 0 ? _rule$disable : false
|
|
1524
|
-
}, rule.uid);
|
|
1525
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1499
|
+
children: [rulesByPermissionCheck === null || rulesByPermissionCheck === void 0 ? void 0 : rulesByPermissionCheck.map((rule) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataValidationItem, {
|
|
1500
|
+
unitId,
|
|
1501
|
+
subUnitId,
|
|
1502
|
+
onClick: () => {
|
|
1503
|
+
if (rule.disable) return;
|
|
1504
|
+
dataValidationPanelService.setActiveRule({
|
|
1505
|
+
unitId,
|
|
1506
|
+
subUnitId,
|
|
1507
|
+
rule
|
|
1508
|
+
});
|
|
1509
|
+
},
|
|
1510
|
+
rule,
|
|
1511
|
+
disable: rule.disable ?? false
|
|
1512
|
+
}, rule.uid)), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1526
1513
|
className: "univer-mt-4 univer-flex univer-flex-row univer-justify-end univer-gap-2",
|
|
1527
1514
|
children: [rules.length && !hasDisableRule ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
1528
1515
|
onClick: handleRemoveAll,
|
|
@@ -1543,10 +1530,7 @@ const DataValidationPanel = () => {
|
|
|
1543
1530
|
const activeRule = (0, _univerjs_ui.useObservable)(dataValidationPanelService.activeRule$, dataValidationPanelService.activeRule);
|
|
1544
1531
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
1545
1532
|
const workbook = (0, _univerjs_ui.useObservable)(() => univerInstanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_SHEET), void 0, void 0, []);
|
|
1546
|
-
const worksheet = (0, _univerjs_ui.useObservable)(() =>
|
|
1547
|
-
var _workbook$activeSheet;
|
|
1548
|
-
return (_workbook$activeSheet = workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) !== null && _workbook$activeSheet !== void 0 ? _workbook$activeSheet : (0, rxjs.of)(null);
|
|
1549
|
-
}, void 0, void 0, []);
|
|
1533
|
+
const worksheet = (0, _univerjs_ui.useObservable)(() => (workbook === null || workbook === void 0 ? void 0 : workbook.activeSheet$) ?? (0, rxjs.of)(null), void 0, void 0, []);
|
|
1550
1534
|
if (!workbook || !worksheet) return null;
|
|
1551
1535
|
return activeRule && (activeRule.subUnitId === worksheet.getSheetId() || activeRule.subUnitId === dataValidationPanelService.getFocusFormulaEditorActiveRuleSubUnitId()) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataValidationDetail, {}, activeRule.rule.uid) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataValidationList, { workbook });
|
|
1552
1536
|
};
|
|
@@ -1688,7 +1672,6 @@ function CheckboxFormulaInput(props) {
|
|
|
1688
1672
|
//#endregion
|
|
1689
1673
|
//#region src/views/components/formula-input/CustomFormulaInput.tsx
|
|
1690
1674
|
function CustomFormulaInput(props) {
|
|
1691
|
-
var _value$formula;
|
|
1692
1675
|
const { unitId, subUnitId, value, onChange, showError, validResult } = props;
|
|
1693
1676
|
const formula1Res = showError ? validResult === null || validResult === void 0 ? void 0 : validResult.formula1 : void 0;
|
|
1694
1677
|
const formulaEditorRef = (0, react.useRef)(null);
|
|
@@ -1702,13 +1685,13 @@ function CustomFormulaInput(props) {
|
|
|
1702
1685
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_sheets_formula_ui.FormulaEditor, {
|
|
1703
1686
|
ref: formulaEditorRef,
|
|
1704
1687
|
className: (0, _univerjs_design.clsx)("univer-box-border univer-h-8 univer-w-full univer-cursor-pointer univer-items-center univer-rounded-lg univer-bg-white univer-pt-2 univer-transition-colors hover:univer-border-primary-600 dark:!univer-bg-gray-700 dark:!univer-text-white [&>div:first-child]:univer-px-2.5 [&>div]:univer-h-5 [&>div]:univer-ring-transparent", _univerjs_design.borderClassName),
|
|
1705
|
-
initValue: (
|
|
1688
|
+
initValue: (value === null || value === void 0 ? void 0 : value.formula1) ?? "=",
|
|
1706
1689
|
unitId,
|
|
1707
1690
|
subUnitId,
|
|
1708
1691
|
isFocus: isFocusFormulaEditor,
|
|
1709
1692
|
isSupportAcrossSheet: true,
|
|
1710
1693
|
onChange: (newValue) => {
|
|
1711
|
-
const newFormula = (newValue
|
|
1694
|
+
const newFormula = (newValue ?? "").trim();
|
|
1712
1695
|
if (newFormula === (value === null || value === void 0 ? void 0 : value.formula1)) return;
|
|
1713
1696
|
onChange === null || onChange === void 0 || onChange({
|
|
1714
1697
|
...value,
|
|
@@ -2006,7 +1989,7 @@ function ListFormulaInput(props) {
|
|
|
2006
1989
|
isSupportAcrossSheet: true,
|
|
2007
1990
|
onFocus: () => setIsFocusFormulaEditor(true),
|
|
2008
1991
|
onChange: (v = "") => {
|
|
2009
|
-
const str = (v
|
|
1992
|
+
const str = (v ?? "").trim();
|
|
2010
1993
|
setFormulaStrCopy(str);
|
|
2011
1994
|
updateFormula(str);
|
|
2012
1995
|
}
|
|
@@ -2057,13 +2040,12 @@ const FORMULA_INPUTS = [
|
|
|
2057
2040
|
//#region src/views/components/ListRenderModeInput.tsx
|
|
2058
2041
|
const LIST_RENDER_MODE_OPTION_INPUT = "LIST_RENDER_MODE_OPTION_INPUT";
|
|
2059
2042
|
function ListRenderModeInput(props) {
|
|
2060
|
-
var _value$renderMode;
|
|
2061
2043
|
const { value, onChange } = props;
|
|
2062
2044
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
2063
2045
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
|
|
2064
2046
|
label: localeService.t("sheets-data-validation-ui.renderMode.label"),
|
|
2065
2047
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_univerjs_design.RadioGroup, {
|
|
2066
|
-
value: `${
|
|
2048
|
+
value: `${value.renderMode ?? _univerjs_core.DataValidationRenderMode.CUSTOM}`,
|
|
2067
2049
|
onChange: (renderMode) => onChange({
|
|
2068
2050
|
...value,
|
|
2069
2051
|
renderMode: +renderMode
|
|
@@ -2349,7 +2331,7 @@ let DataValidationCopyPasteController = class DataValidationCopyPasteController
|
|
|
2349
2331
|
rows.forEach((row, rowIndex) => {
|
|
2350
2332
|
cols.forEach((col, colIndex) => {
|
|
2351
2333
|
const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
|
|
2352
|
-
matrix.setValue(rowIndex, colIndex, ruleId
|
|
2334
|
+
matrix.setValue(rowIndex, colIndex, ruleId ?? "");
|
|
2353
2335
|
});
|
|
2354
2336
|
});
|
|
2355
2337
|
}
|
|
@@ -2571,32 +2553,30 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
|
|
|
2571
2553
|
effect: _univerjs_core.InterceptorEffectEnum.Style,
|
|
2572
2554
|
priority: _univerjs_sheets.InterceptCellContentPriority.DATA_VALIDATION,
|
|
2573
2555
|
handler: (cell, pos, next) => {
|
|
2574
|
-
var
|
|
2556
|
+
var _cell$fontRenderExten, _validator$skipDefaul;
|
|
2575
2557
|
const { row, col, unitId, subUnitId, workbook, worksheet } = pos;
|
|
2576
2558
|
const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
|
|
2577
2559
|
if (!ruleId) return next(cell);
|
|
2578
2560
|
const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
|
|
2579
2561
|
if (!rule) return next(cell);
|
|
2580
|
-
const validStatus =
|
|
2562
|
+
const validStatus = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col) ?? _univerjs_core.DataValidationStatus.VALID;
|
|
2581
2563
|
const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
|
|
2582
2564
|
const cellOrigin = pos.rawData;
|
|
2583
2565
|
let cache;
|
|
2584
2566
|
const cellValue = { get value() {
|
|
2585
|
-
var _getCellValueOrigin;
|
|
2586
2567
|
if (cache !== void 0) return cache;
|
|
2587
|
-
cache = (
|
|
2568
|
+
cache = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(cellOrigin) ?? null;
|
|
2588
2569
|
return cache;
|
|
2589
2570
|
} };
|
|
2590
2571
|
const valueStr = { get value() {
|
|
2591
|
-
|
|
2592
|
-
return `${(_cellValue$value = cellValue.value) !== null && _cellValue$value !== void 0 ? _cellValue$value : ""}`;
|
|
2572
|
+
return `${cellValue.value ?? ""}`;
|
|
2593
2573
|
} };
|
|
2594
2574
|
if (!cell || cell === pos.rawData) cell = { ...pos.rawData };
|
|
2595
2575
|
cell.markers = {
|
|
2596
2576
|
...cell === null || cell === void 0 ? void 0 : cell.markers,
|
|
2597
2577
|
...validStatus === _univerjs_core.DataValidationStatus.INVALID ? INVALID_MARK : null
|
|
2598
2578
|
};
|
|
2599
|
-
cell.customRender = [...(
|
|
2579
|
+
cell.customRender = [...(cell === null || cell === void 0 ? void 0 : cell.customRender) ?? [], ...(validator === null || validator === void 0 ? void 0 : validator.canvasRender) ? [validator.canvasRender] : []];
|
|
2600
2580
|
cell.fontRenderExtension = {
|
|
2601
2581
|
...cell === null || cell === void 0 ? void 0 : cell.fontRenderExtension,
|
|
2602
2582
|
isSkip: (cell === null || cell === void 0 || (_cell$fontRenderExten = cell.fontRenderExtension) === null || _cell$fontRenderExten === void 0 ? void 0 : _cell$fontRenderExten.isSkip) || (validator === null || validator === void 0 || (_validator$skipDefaul = validator.skipDefaultFontRender) === null || _validator$skipDefaul === void 0 ? void 0 : _validator$skipDefaul.call(validator, rule, cellValue.value, pos))
|
|
@@ -2609,14 +2589,14 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
|
|
|
2609
2589
|
} }, row, col)
|
|
2610
2590
|
};
|
|
2611
2591
|
cell.interceptorAutoHeight = () => {
|
|
2612
|
-
var _this$_renderManagerS,
|
|
2592
|
+
var _this$_renderManagerS, _validator$canvasRend, _validator$canvasRend2;
|
|
2613
2593
|
const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS === void 0 || (_this$_renderManagerS = _this$_renderManagerS.with(_univerjs_sheets_ui.SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.skeleton;
|
|
2614
2594
|
if (!skeleton) return;
|
|
2615
2595
|
const mergeCell = skeleton.worksheet.getMergedCell(row, col);
|
|
2616
2596
|
const info = {
|
|
2617
2597
|
data: cell,
|
|
2618
2598
|
style: workbook.getStyles().getStyleByCell(cell),
|
|
2619
|
-
primaryWithCoord: skeleton.getCellWithCoordByIndex((
|
|
2599
|
+
primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
|
|
2620
2600
|
unitId,
|
|
2621
2601
|
subUnitId,
|
|
2622
2602
|
row,
|
|
@@ -2627,14 +2607,14 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
|
|
|
2627
2607
|
return validator === null || validator === void 0 || (_validator$canvasRend = validator.canvasRender) === null || _validator$canvasRend === void 0 || (_validator$canvasRend2 = _validator$canvasRend.calcCellAutoHeight) === null || _validator$canvasRend2 === void 0 ? void 0 : _validator$canvasRend2.call(_validator$canvasRend, info);
|
|
2628
2608
|
};
|
|
2629
2609
|
cell.interceptorAutoWidth = () => {
|
|
2630
|
-
var _this$_renderManagerS2,
|
|
2610
|
+
var _this$_renderManagerS2, _validator$canvasRend3, _validator$canvasRend4;
|
|
2631
2611
|
const skeleton = (_this$_renderManagerS2 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS2 === void 0 || (_this$_renderManagerS2 = _this$_renderManagerS2.with(_univerjs_sheets_ui.SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS2 === void 0 ? void 0 : _this$_renderManagerS2.skeleton;
|
|
2632
2612
|
if (!skeleton) return;
|
|
2633
2613
|
const mergeCell = skeleton.worksheet.getMergedCell(row, col);
|
|
2634
2614
|
const info = {
|
|
2635
2615
|
data: cell,
|
|
2636
2616
|
style: workbook.getStyles().getStyleByCell(cell),
|
|
2637
|
-
primaryWithCoord: skeleton.getCellWithCoordByIndex((
|
|
2617
|
+
primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
|
|
2638
2618
|
unitId,
|
|
2639
2619
|
subUnitId,
|
|
2640
2620
|
row,
|
|
@@ -2644,7 +2624,7 @@ let SheetsDataValidationRenderController = class SheetsDataValidationRenderContr
|
|
|
2644
2624
|
};
|
|
2645
2625
|
return validator === null || validator === void 0 || (_validator$canvasRend3 = validator.canvasRender) === null || _validator$canvasRend3 === void 0 || (_validator$canvasRend4 = _validator$canvasRend3.calcCellAutoWidth) === null || _validator$canvasRend4 === void 0 ? void 0 : _validator$canvasRend4.call(_validator$canvasRend3, info);
|
|
2646
2626
|
};
|
|
2647
|
-
cell.coverable = ((
|
|
2627
|
+
cell.coverable = ((cell === null || cell === void 0 ? void 0 : cell.coverable) ?? true) && !(rule.type === _univerjs_core.DataValidationType.LIST || rule.type === _univerjs_core.DataValidationType.LIST_MULTIPLE);
|
|
2648
2628
|
return next(cell);
|
|
2649
2629
|
}
|
|
2650
2630
|
}));
|
|
@@ -2694,22 +2674,22 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
|
|
|
2694
2674
|
effect: _univerjs_core.InterceptorEffectEnum.Style,
|
|
2695
2675
|
priority: _univerjs_sheets.InterceptCellContentPriority.DATA_VALIDATION,
|
|
2696
2676
|
handler: (cell, pos, next) => {
|
|
2697
|
-
var
|
|
2677
|
+
var _cell$fontRenderExten2, _validator$skipDefaul2;
|
|
2698
2678
|
const { row, col, unitId, subUnitId, workbook, worksheet } = pos;
|
|
2699
2679
|
const ruleId = this._sheetDataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
|
|
2700
2680
|
if (!ruleId) return next(cell);
|
|
2701
2681
|
const rule = this._sheetDataValidationModel.getRuleById(unitId, subUnitId, ruleId);
|
|
2702
2682
|
if (!rule) return next(cell);
|
|
2703
|
-
const validStatus =
|
|
2683
|
+
const validStatus = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col) ?? _univerjs_core.DataValidationStatus.VALID;
|
|
2704
2684
|
const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
|
|
2705
2685
|
const cellValue = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(worksheet.getCellRaw(row, col));
|
|
2706
|
-
const valueStr = `${cellValue
|
|
2686
|
+
const valueStr = `${cellValue ?? ""}`;
|
|
2707
2687
|
if (!cell || cell === pos.rawData) cell = { ...pos.rawData };
|
|
2708
2688
|
cell.markers = {
|
|
2709
2689
|
...cell === null || cell === void 0 ? void 0 : cell.markers,
|
|
2710
2690
|
...validStatus === _univerjs_core.DataValidationStatus.INVALID ? INVALID_MARK : null
|
|
2711
2691
|
};
|
|
2712
|
-
cell.customRender = [...(
|
|
2692
|
+
cell.customRender = [...(cell === null || cell === void 0 ? void 0 : cell.customRender) ?? [], ...(validator === null || validator === void 0 ? void 0 : validator.canvasRender) ? [validator.canvasRender] : []];
|
|
2713
2693
|
cell.fontRenderExtension = {
|
|
2714
2694
|
...cell === null || cell === void 0 ? void 0 : cell.fontRenderExtension,
|
|
2715
2695
|
isSkip: (cell === null || cell === void 0 || (_cell$fontRenderExten2 = cell.fontRenderExtension) === null || _cell$fontRenderExten2 === void 0 ? void 0 : _cell$fontRenderExten2.isSkip) || (validator === null || validator === void 0 || (_validator$skipDefaul2 = validator.skipDefaultFontRender) === null || _validator$skipDefaul2 === void 0 ? void 0 : _validator$skipDefaul2.call(validator, rule, cellValue, pos))
|
|
@@ -2722,14 +2702,14 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
|
|
|
2722
2702
|
} }, row, col)
|
|
2723
2703
|
};
|
|
2724
2704
|
cell.interceptorAutoHeight = () => {
|
|
2725
|
-
var _this$_renderManagerS3,
|
|
2705
|
+
var _this$_renderManagerS3, _validator$canvasRend5, _validator$canvasRend6;
|
|
2726
2706
|
const skeleton = (_this$_renderManagerS3 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS3 === void 0 || (_this$_renderManagerS3 = _this$_renderManagerS3.with(_univerjs_sheets_ui.SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS3 === void 0 ? void 0 : _this$_renderManagerS3.skeleton;
|
|
2727
2707
|
if (!skeleton) return;
|
|
2728
2708
|
const mergeCell = skeleton.worksheet.getMergedCell(row, col);
|
|
2729
2709
|
const info = {
|
|
2730
2710
|
data: cell,
|
|
2731
2711
|
style: workbook.getStyles().getStyleByCell(cell),
|
|
2732
|
-
primaryWithCoord: skeleton.getCellWithCoordByIndex((
|
|
2712
|
+
primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
|
|
2733
2713
|
unitId,
|
|
2734
2714
|
subUnitId,
|
|
2735
2715
|
row,
|
|
@@ -2740,14 +2720,14 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
|
|
|
2740
2720
|
return validator === null || validator === void 0 || (_validator$canvasRend5 = validator.canvasRender) === null || _validator$canvasRend5 === void 0 || (_validator$canvasRend6 = _validator$canvasRend5.calcCellAutoHeight) === null || _validator$canvasRend6 === void 0 ? void 0 : _validator$canvasRend6.call(_validator$canvasRend5, info);
|
|
2741
2721
|
};
|
|
2742
2722
|
cell.interceptorAutoWidth = () => {
|
|
2743
|
-
var _this$_renderManagerS4,
|
|
2723
|
+
var _this$_renderManagerS4, _validator$canvasRend7, _validator$canvasRend8;
|
|
2744
2724
|
const skeleton = (_this$_renderManagerS4 = this._renderManagerService.getRenderUnitById(unitId)) === null || _this$_renderManagerS4 === void 0 || (_this$_renderManagerS4 = _this$_renderManagerS4.with(_univerjs_sheets_ui.SheetSkeletonManagerService).getSkeletonParam(subUnitId)) === null || _this$_renderManagerS4 === void 0 ? void 0 : _this$_renderManagerS4.skeleton;
|
|
2745
2725
|
if (!skeleton) return;
|
|
2746
2726
|
const mergeCell = skeleton.worksheet.getMergedCell(row, col);
|
|
2747
2727
|
const info = {
|
|
2748
2728
|
data: cell,
|
|
2749
2729
|
style: workbook.getStyles().getStyleByCell(cell),
|
|
2750
|
-
primaryWithCoord: skeleton.getCellWithCoordByIndex((
|
|
2730
|
+
primaryWithCoord: skeleton.getCellWithCoordByIndex((mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startRow) ?? row, (mergeCell === null || mergeCell === void 0 ? void 0 : mergeCell.startColumn) ?? col),
|
|
2751
2731
|
unitId,
|
|
2752
2732
|
subUnitId,
|
|
2753
2733
|
row,
|
|
@@ -2757,7 +2737,7 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
|
|
|
2757
2737
|
};
|
|
2758
2738
|
return validator === null || validator === void 0 || (_validator$canvasRend7 = validator.canvasRender) === null || _validator$canvasRend7 === void 0 || (_validator$canvasRend8 = _validator$canvasRend7.calcCellAutoWidth) === null || _validator$canvasRend8 === void 0 ? void 0 : _validator$canvasRend8.call(_validator$canvasRend7, info);
|
|
2759
2739
|
};
|
|
2760
|
-
cell.coverable = ((
|
|
2740
|
+
cell.coverable = ((cell === null || cell === void 0 ? void 0 : cell.coverable) ?? true) && !(rule.type === _univerjs_core.DataValidationType.LIST || rule.type === _univerjs_core.DataValidationType.LIST_MULTIPLE);
|
|
2761
2741
|
return next(cell);
|
|
2762
2742
|
}
|
|
2763
2743
|
}));
|
|
@@ -2819,11 +2799,10 @@ SheetsDataValidationReRenderController = __decorate([__decorateParam(1, (0, _uni
|
|
|
2819
2799
|
const MARGIN_H$2 = 6;
|
|
2820
2800
|
let CheckboxRender = class CheckboxRender {
|
|
2821
2801
|
_calc(cellInfo, style) {
|
|
2822
|
-
var _style$fs, _style$fs2, _style$fs3;
|
|
2823
2802
|
const { vt, ht } = style || {};
|
|
2824
2803
|
const width = cellInfo.endX - cellInfo.startX - MARGIN_H$2 * 2;
|
|
2825
2804
|
const height = cellInfo.endY - cellInfo.startY;
|
|
2826
|
-
const size = ((
|
|
2805
|
+
const size = ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
|
|
2827
2806
|
let widgetLeft = 0;
|
|
2828
2807
|
let widgetTop = 0;
|
|
2829
2808
|
switch (vt) {
|
|
@@ -2851,8 +2830,8 @@ let CheckboxRender = class CheckboxRender {
|
|
|
2851
2830
|
return {
|
|
2852
2831
|
left: cellInfo.startX + widgetLeft,
|
|
2853
2832
|
top: cellInfo.startY + widgetTop,
|
|
2854
|
-
width: ((
|
|
2855
|
-
height: ((
|
|
2833
|
+
width: ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6,
|
|
2834
|
+
height: ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6
|
|
2856
2835
|
};
|
|
2857
2836
|
}
|
|
2858
2837
|
constructor(_commandService, _univerInstanceService, _formulaService, _themeService, _renderManagerService, _dataValidationModel) {
|
|
@@ -2864,14 +2843,12 @@ let CheckboxRender = class CheckboxRender {
|
|
|
2864
2843
|
this._dataValidationModel = _dataValidationModel;
|
|
2865
2844
|
}
|
|
2866
2845
|
calcCellAutoHeight(info) {
|
|
2867
|
-
var _style$fs4;
|
|
2868
2846
|
const { style } = info;
|
|
2869
|
-
return ((
|
|
2847
|
+
return ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
|
|
2870
2848
|
}
|
|
2871
2849
|
calcCellAutoWidth(info) {
|
|
2872
|
-
var _style$fs5;
|
|
2873
2850
|
const { style } = info;
|
|
2874
|
-
return ((
|
|
2851
|
+
return ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
|
|
2875
2852
|
}
|
|
2876
2853
|
async _parseFormula(rule, unitId, subUnitId) {
|
|
2877
2854
|
var _results$, _results$2, _results$3;
|
|
@@ -2887,7 +2864,7 @@ let CheckboxRender = class CheckboxRender {
|
|
|
2887
2864
|
};
|
|
2888
2865
|
}
|
|
2889
2866
|
drawWith(ctx, info) {
|
|
2890
|
-
var _validator$skipDefaul, _style$
|
|
2867
|
+
var _validator$skipDefaul, _style$cl;
|
|
2891
2868
|
const { style, primaryWithCoord, unitId, subUnitId, worksheet, row, col } = info;
|
|
2892
2869
|
const cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
|
|
2893
2870
|
const value = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(worksheet.getCellRaw(row, col));
|
|
@@ -2925,14 +2902,14 @@ let CheckboxRender = class CheckboxRender {
|
|
|
2925
2902
|
ctx.clip();
|
|
2926
2903
|
const m = transform.getMatrix();
|
|
2927
2904
|
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
2928
|
-
const size = ((
|
|
2905
|
+
const size = ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
|
|
2929
2906
|
const checked = String(value) === String(formula1);
|
|
2930
2907
|
const defaultColor = this._themeService.getColorFromTheme("primary.600");
|
|
2931
2908
|
_univerjs_engine_render.CheckboxShape.drawWith(ctx, {
|
|
2932
2909
|
checked,
|
|
2933
2910
|
width: size,
|
|
2934
2911
|
height: size,
|
|
2935
|
-
fill: (
|
|
2912
|
+
fill: (style === null || style === void 0 || (_style$cl = style.cl) === null || _style$cl === void 0 ? void 0 : _style$cl.rgb) ?? defaultColor
|
|
2936
2913
|
});
|
|
2937
2914
|
ctx.restore();
|
|
2938
2915
|
}
|
|
@@ -3240,7 +3217,6 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
|
|
|
3240
3217
|
ctx.restore();
|
|
3241
3218
|
}
|
|
3242
3219
|
drawWith(ctx, info, skeleton, spreadsheets) {
|
|
3243
|
-
var _ref, _getCellValueOrigin;
|
|
3244
3220
|
const { primaryWithCoord, row, col, style, data, subUnitId } = info;
|
|
3245
3221
|
const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
|
|
3246
3222
|
const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
|
|
@@ -3261,11 +3237,11 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
|
|
|
3261
3237
|
const cellWidth = cellBounding.endX - cellBounding.startX;
|
|
3262
3238
|
const cellHeight = cellBounding.endY - cellBounding.startY;
|
|
3263
3239
|
const { cl } = style || {};
|
|
3264
|
-
const color = (
|
|
3265
|
-
const fontStyle = (0, _univerjs_engine_render.getFontStyleString)(style
|
|
3240
|
+
const color = (typeof cl === "object" ? cl === null || cl === void 0 ? void 0 : cl.rgb : cl) ?? "#000";
|
|
3241
|
+
const fontStyle = (0, _univerjs_engine_render.getFontStyleString)(style ?? void 0);
|
|
3266
3242
|
const { vt: _vt, ht } = style || {};
|
|
3267
|
-
const vt = _vt
|
|
3268
|
-
const cellValue = (
|
|
3243
|
+
const vt = _vt ?? _univerjs_core.VerticalAlign.MIDDLE;
|
|
3244
|
+
const cellValue = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? "";
|
|
3269
3245
|
const items = validator.parseCellValue(cellValue);
|
|
3270
3246
|
const labelColorMap = validator.getListWithColorMap(rule);
|
|
3271
3247
|
const layout = layoutDropdowns(items, fontStyle, cellWidth, cellHeight);
|
|
@@ -3323,7 +3299,6 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
|
|
|
3323
3299
|
});
|
|
3324
3300
|
}
|
|
3325
3301
|
calcCellAutoHeight(info) {
|
|
3326
|
-
var _getCellValueOrigin2;
|
|
3327
3302
|
const { primaryWithCoord, style, data, row, col } = info;
|
|
3328
3303
|
const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
|
|
3329
3304
|
const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
|
|
@@ -3339,11 +3314,10 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
|
|
|
3339
3314
|
if (!validator) return;
|
|
3340
3315
|
const cellWidth = cellBounding.endX - cellBounding.startX;
|
|
3341
3316
|
const cellHeight = cellBounding.endY - cellBounding.startY;
|
|
3342
|
-
const cellValue = (
|
|
3343
|
-
return layoutDropdowns(validator.parseCellValue(cellValue), (0, _univerjs_engine_render.getFontStyleString)(style
|
|
3317
|
+
const cellValue = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? "";
|
|
3318
|
+
return layoutDropdowns(validator.parseCellValue(cellValue), (0, _univerjs_engine_render.getFontStyleString)(style ?? void 0), cellWidth, cellHeight).cellAutoHeight;
|
|
3344
3319
|
}
|
|
3345
3320
|
calcCellAutoWidth(info) {
|
|
3346
|
-
var _getCellValueOrigin3;
|
|
3347
3321
|
const { primaryWithCoord, style, data, row, col } = info;
|
|
3348
3322
|
const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
|
|
3349
3323
|
const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
|
|
@@ -3359,8 +3333,8 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
|
|
|
3359
3333
|
if (!validator) return;
|
|
3360
3334
|
const cellWidth = cellBounding.endX - cellBounding.startX;
|
|
3361
3335
|
const cellHeight = cellBounding.endY - cellBounding.startY;
|
|
3362
|
-
const cellValue = (
|
|
3363
|
-
return layoutDropdowns(validator.parseCellValue(cellValue), (0, _univerjs_engine_render.getFontStyleString)(style
|
|
3336
|
+
const cellValue = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? "";
|
|
3337
|
+
return layoutDropdowns(validator.parseCellValue(cellValue), (0, _univerjs_engine_render.getFontStyleString)(style ?? void 0), cellWidth, cellHeight).calcAutoWidth;
|
|
3364
3338
|
}
|
|
3365
3339
|
isHit(position, info) {
|
|
3366
3340
|
const { primaryWithCoord } = info;
|
|
@@ -3513,7 +3487,6 @@ let DropdownWidget = class DropdownWidget {
|
|
|
3513
3487
|
ctx.restore();
|
|
3514
3488
|
}
|
|
3515
3489
|
drawWith(ctx, info, skeleton) {
|
|
3516
|
-
var _tb, _vt, _ht, _pd;
|
|
3517
3490
|
const { primaryWithCoord, row, col, style, data, subUnitId } = info;
|
|
3518
3491
|
const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
|
|
3519
3492
|
const _row = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo.startRow : row;
|
|
@@ -3536,14 +3509,13 @@ let DropdownWidget = class DropdownWidget {
|
|
|
3536
3509
|
const map = this._ensureMap(subUnitId);
|
|
3537
3510
|
const key = this._generateKey(row, col);
|
|
3538
3511
|
const colorMap = validator.getListWithColorMap(rule);
|
|
3539
|
-
const
|
|
3540
|
-
const valueStr = `${value !== null && value !== void 0 ? value : ""}`;
|
|
3512
|
+
const valueStr = `${(0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? ""}`;
|
|
3541
3513
|
const activeColor = colorMap[valueStr];
|
|
3542
3514
|
let { tb, vt, ht, pd } = style || {};
|
|
3543
|
-
tb =
|
|
3544
|
-
vt =
|
|
3545
|
-
ht =
|
|
3546
|
-
pd =
|
|
3515
|
+
tb = tb ?? _univerjs_core.WrapStrategy.WRAP;
|
|
3516
|
+
vt = vt ?? _univerjs_core.VerticalAlign.BOTTOM;
|
|
3517
|
+
ht = ht ?? _univerjs_core.DEFAULT_STYLES.ht;
|
|
3518
|
+
pd = pd ?? _univerjs_core.DEFAULT_STYLES.pd;
|
|
3547
3519
|
const fontStyle = (0, _univerjs_engine_render.getFontStyleString)(style).fontCache;
|
|
3548
3520
|
if (rule.renderMode === _univerjs_core.DataValidationRenderMode.ARROW) {
|
|
3549
3521
|
var _style$cl, _style$st, _style$ul;
|
|
@@ -3637,7 +3609,6 @@ let DropdownWidget = class DropdownWidget {
|
|
|
3637
3609
|
}
|
|
3638
3610
|
}
|
|
3639
3611
|
calcCellAutoHeight(info) {
|
|
3640
|
-
var _tb2;
|
|
3641
3612
|
const { primaryWithCoord, style, data, row, col } = info;
|
|
3642
3613
|
const _cellBounding = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
|
|
3643
3614
|
const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
|
|
@@ -3651,13 +3622,12 @@ let DropdownWidget = class DropdownWidget {
|
|
|
3651
3622
|
endY: _cellBounding.endY - downOffset
|
|
3652
3623
|
};
|
|
3653
3624
|
const cellWidth = cellBounding.endX - cellBounding.startX;
|
|
3654
|
-
const
|
|
3655
|
-
const valueStr = `${value !== null && value !== void 0 ? value : ""}`;
|
|
3625
|
+
const valueStr = `${(0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? ""}`;
|
|
3656
3626
|
let { tb, pd } = style || {};
|
|
3657
|
-
const { t = _univerjs_core.DEFAULT_STYLES.pd.t, b = _univerjs_core.DEFAULT_STYLES.pd.b } = pd
|
|
3658
|
-
tb =
|
|
3627
|
+
const { t = _univerjs_core.DEFAULT_STYLES.pd.t, b = _univerjs_core.DEFAULT_STYLES.pd.b } = pd ?? {};
|
|
3628
|
+
tb = tb ?? _univerjs_core.WrapStrategy.WRAP;
|
|
3659
3629
|
if (rule.renderMode === _univerjs_core.DataValidationRenderMode.ARROW) {
|
|
3660
|
-
const { l = _univerjs_core.DEFAULT_STYLES.pd.l, r = _univerjs_core.DEFAULT_STYLES.pd.r } = pd
|
|
3630
|
+
const { l = _univerjs_core.DEFAULT_STYLES.pd.l, r = _univerjs_core.DEFAULT_STYLES.pd.r } = pd ?? {};
|
|
3661
3631
|
const realWidth = cellWidth - l - r - ICON_PLACE - 4;
|
|
3662
3632
|
const skeleton = new _univerjs_engine_render.DocSimpleSkeleton(valueStr, (0, _univerjs_engine_render.getFontStyleString)(style).fontCache, Boolean(tb === _univerjs_core.WrapStrategy.WRAP), realWidth, Infinity);
|
|
3663
3633
|
skeleton.calculate();
|
|
@@ -3670,7 +3640,6 @@ let DropdownWidget = class DropdownWidget {
|
|
|
3670
3640
|
}
|
|
3671
3641
|
}
|
|
3672
3642
|
calcCellAutoWidth(info) {
|
|
3673
|
-
var _tb3;
|
|
3674
3643
|
const { primaryWithCoord, style, data, row, col } = info;
|
|
3675
3644
|
const cellRange = primaryWithCoord.isMergedMainCell ? primaryWithCoord.mergeInfo : primaryWithCoord;
|
|
3676
3645
|
const { leftOffset = 0, rightOffset = 0, topOffset = 0, downOffset = 0 } = (data === null || data === void 0 ? void 0 : data.fontRenderExtension) || {};
|
|
@@ -3684,11 +3653,10 @@ let DropdownWidget = class DropdownWidget {
|
|
|
3684
3653
|
endY: cellRange.endY - downOffset
|
|
3685
3654
|
};
|
|
3686
3655
|
const cellWidth = cellBounding.endX - cellBounding.startX;
|
|
3687
|
-
const
|
|
3688
|
-
const valueStr = `${value !== null && value !== void 0 ? value : ""}`;
|
|
3656
|
+
const valueStr = `${(0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? ""}`;
|
|
3689
3657
|
let { tb, pd } = style || {};
|
|
3690
|
-
const { l = _univerjs_core.DEFAULT_STYLES.pd.l, r = _univerjs_core.DEFAULT_STYLES.pd.r } = pd
|
|
3691
|
-
tb =
|
|
3658
|
+
const { l = _univerjs_core.DEFAULT_STYLES.pd.l, r = _univerjs_core.DEFAULT_STYLES.pd.r } = pd ?? {};
|
|
3659
|
+
tb = tb ?? _univerjs_core.WrapStrategy.WRAP;
|
|
3692
3660
|
let paddingAll = 26;
|
|
3693
3661
|
switch (rule.renderMode) {
|
|
3694
3662
|
case _univerjs_core.DataValidationRenderMode.ARROW:
|
|
@@ -3967,7 +3935,7 @@ _defineProperty(UniverSheetsDataValidationUIPlugin, "packageName", name);
|
|
|
3967
3935
|
_defineProperty(UniverSheetsDataValidationUIPlugin, "version", version);
|
|
3968
3936
|
_defineProperty(UniverSheetsDataValidationUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_SHEET);
|
|
3969
3937
|
UniverSheetsDataValidationUIPlugin = __decorate([
|
|
3970
|
-
(0, _univerjs_core.DependentOn)(_univerjs_data_validation.UniverDataValidationPlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin,
|
|
3938
|
+
(0, _univerjs_core.DependentOn)(_univerjs_data_validation.UniverDataValidationPlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_sheets.UniverSheetsPlugin, _univerjs_sheets_ui.UniverSheetsUIPlugin, _univerjs_sheets_data_validation.UniverSheetsDataValidationPlugin),
|
|
3971
3939
|
__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
|
|
3972
3940
|
__decorateParam(2, _univerjs_core.ICommandService),
|
|
3973
3941
|
__decorateParam(3, _univerjs_core.IConfigService)
|