@univerjs/sheets-data-validation-ui 1.0.0-rc.0 → 1.0.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 +53 -62
- package/lib/cjs/locale/ar-SA.js +0 -1
- package/lib/cjs/locale/ca-ES.js +0 -1
- package/lib/cjs/locale/de-DE.js +0 -1
- package/lib/cjs/locale/en-US.js +0 -1
- package/lib/cjs/locale/es-ES.js +0 -1
- package/lib/cjs/locale/fa-IR.js +0 -1
- package/lib/cjs/locale/fr-FR.js +0 -1
- package/lib/cjs/locale/id-ID.js +0 -1
- package/lib/cjs/locale/it-IT.js +0 -1
- package/lib/cjs/locale/ja-JP.js +0 -1
- package/lib/cjs/locale/ko-KR.js +0 -1
- package/lib/cjs/locale/pl-PL.js +0 -1
- package/lib/cjs/locale/pt-BR.js +0 -1
- package/lib/cjs/locale/ru-RU.js +0 -1
- package/lib/cjs/locale/sk-SK.js +0 -1
- package/lib/cjs/locale/vi-VN.js +0 -1
- package/lib/cjs/locale/zh-CN.js +0 -1
- package/lib/cjs/locale/zh-HK.js +0 -1
- package/lib/cjs/locale/zh-TW.js +0 -1
- package/lib/es/index.js +53 -62
- package/lib/index.js +53 -62
- package/lib/types/controllers/dv-ui.controller.d.ts +26 -0
- package/lib/types/views/components/detail/index.d.ts +16 -0
- package/lib/types/views/components/item/index.d.ts +24 -0
- package/lib/types/views/components/list/index.d.ts +19 -0
- package/lib/types/views/components/options/index.d.ts +22 -0
- package/lib/types/views/components/panel/index.d.ts +16 -0
- package/lib/types/views/components/render-mode/index.d.ts +24 -0
- package/lib/types/views/components/show-time/index.d.ts +24 -0
- package/lib/umd/index.js +1 -1
- package/package.json +18 -18
package/lib/cjs/index.js
CHANGED
|
@@ -15,7 +15,7 @@ let _univerjs_icons = require("@univerjs/icons");
|
|
|
15
15
|
let _univerjs_engine_formula = require("@univerjs/engine-formula");
|
|
16
16
|
let _univerjs_sheets_formula_ui = require("@univerjs/sheets-formula-ui");
|
|
17
17
|
|
|
18
|
-
//#region \0@oxc-project+runtime@0.
|
|
18
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
19
19
|
function _typeof(o) {
|
|
20
20
|
"@babel/helpers - typeof";
|
|
21
21
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -26,7 +26,7 @@ function _typeof(o) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
|
-
//#region \0@oxc-project+runtime@0.
|
|
29
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
|
|
30
30
|
function toPrimitive(t, r) {
|
|
31
31
|
if ("object" != _typeof(t) || !t) return t;
|
|
32
32
|
var e = t[Symbol.toPrimitive];
|
|
@@ -39,14 +39,14 @@ function toPrimitive(t, r) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
//#endregion
|
|
42
|
-
//#region \0@oxc-project+runtime@0.
|
|
42
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
43
43
|
function toPropertyKey(t) {
|
|
44
44
|
var i = toPrimitive(t, "string");
|
|
45
45
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
//#endregion
|
|
49
|
-
//#region \0@oxc-project+runtime@0.
|
|
49
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
50
50
|
function _defineProperty(e, r, t) {
|
|
51
51
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
52
52
|
value: t,
|
|
@@ -57,7 +57,7 @@ function _defineProperty(e, r, t) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
//#endregion
|
|
60
|
-
//#region \0@oxc-project+runtime@0.
|
|
60
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
|
|
61
61
|
function __decorateParam(paramIndex, decorator) {
|
|
62
62
|
return function(target, key) {
|
|
63
63
|
decorator(target, key, paramIndex);
|
|
@@ -65,7 +65,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
//#endregion
|
|
68
|
-
//#region \0@oxc-project+runtime@0.
|
|
68
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
|
|
69
69
|
function __decorate(decorators, target, key, desc) {
|
|
70
70
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
71
71
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -185,7 +185,7 @@ let DataValidationRejectInputController = class DataValidationRejectInputControl
|
|
|
185
185
|
const ruleId = this._dataValidationModel.getRuleIdByLocation(unitId, subUnitId, row, col);
|
|
186
186
|
const rule = ruleId ? this._dataValidationModel.getRuleById(unitId, subUnitId, ruleId) : void 0;
|
|
187
187
|
if (cell === false) return next(Promise.resolve(false));
|
|
188
|
-
if (!rule || rule.errorStyle !== _univerjs_core.DataValidationErrorStyle.STOP) return next(Promise.resolve(true));
|
|
188
|
+
if (!rule || rule.showErrorMessage === false || rule.errorStyle !== _univerjs_core.DataValidationErrorStyle.STOP) return next(Promise.resolve(true));
|
|
189
189
|
const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
|
|
190
190
|
if (!validator) return next(Promise.resolve(true));
|
|
191
191
|
if (await this._sheetsDataValidationValidatorService.validatorCell(unitId, subUnitId, row, col) === _univerjs_core.DataValidationStatus.VALID) return next(Promise.resolve(true));
|
|
@@ -338,7 +338,7 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
|
|
|
338
338
|
return true;
|
|
339
339
|
};
|
|
340
340
|
const handleSerialSave = async (serial, targetPatternType, interceptValue) => {
|
|
341
|
-
if (rule.errorStyle !== _univerjs_core.DataValidationErrorStyle.STOP || await validator.validator({
|
|
341
|
+
if (rule.showErrorMessage === false || rule.errorStyle !== _univerjs_core.DataValidationErrorStyle.STOP || await validator.validator({
|
|
342
342
|
value: serial,
|
|
343
343
|
unitId,
|
|
344
344
|
subUnitId,
|
|
@@ -396,7 +396,7 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
|
|
|
396
396
|
seconds: 0,
|
|
397
397
|
fractionalSecond: 0
|
|
398
398
|
} : selectedParts;
|
|
399
|
-
const
|
|
399
|
+
const dateParts = {
|
|
400
400
|
year: targetPatternType === "time" && originalParts && (originalSerial ?? 0) >= 1 ? originalParts.year : selectedParts.year,
|
|
401
401
|
month: targetPatternType === "time" && originalParts && (originalSerial ?? 0) >= 1 ? originalParts.month : selectedParts.month,
|
|
402
402
|
day: targetPatternType === "time" && originalParts && (originalSerial ?? 0) >= 1 ? originalParts.day : targetPatternType === "datetime" && changeType === "time" && isExceptionalDateAnchor ? originalParts.day : selectedParts.day,
|
|
@@ -404,7 +404,8 @@ let DataValidationDropdownManagerService = class DataValidationDropdownManagerSe
|
|
|
404
404
|
minutes: timeParts.minutes,
|
|
405
405
|
seconds: timeParts.seconds,
|
|
406
406
|
fractionalSecond: timeParts.fractionalSecond
|
|
407
|
-
}
|
|
407
|
+
};
|
|
408
|
+
const serialNum = (0, _univerjs_core.excelDateTimePartsToSerial)(dateParts, { dateSystem });
|
|
408
409
|
if (serialNum == null) return false;
|
|
409
410
|
const serialTime = targetPatternType === "time" && (originalSerial == null || originalSerial < 1) ? serialNum - Math.floor(serialNum) : serialNum;
|
|
410
411
|
const dateStr = date.format(targetPatternType === "date" ? "YYYY-MM-DD 00:00:00" : "YYYY-MM-DD HH:mm:ss");
|
|
@@ -803,7 +804,8 @@ const AddSheetDataValidationAndOpenCommand = {
|
|
|
803
804
|
type: _univerjs_core.CommandType.COMMAND,
|
|
804
805
|
id: "data-validation.command.addRuleAndOpen",
|
|
805
806
|
handler(accessor, params) {
|
|
806
|
-
const
|
|
807
|
+
const univerInstanceService = accessor.get(_univerjs_core.IUniverInstanceService);
|
|
808
|
+
const target = (0, _univerjs_sheets.getSheetCommandTarget)(univerInstanceService);
|
|
807
809
|
if (!target) return false;
|
|
808
810
|
const { workbook, worksheet } = target;
|
|
809
811
|
if (!accessor.get(_univerjs_sheets.SheetsSelectionsService).getCurrentSelections().length) return false;
|
|
@@ -1071,7 +1073,7 @@ const menuSchema = {
|
|
|
1071
1073
|
//#endregion
|
|
1072
1074
|
//#region package.json
|
|
1073
1075
|
var name = "@univerjs/sheets-data-validation-ui";
|
|
1074
|
-
var version = "1.0.0
|
|
1076
|
+
var version = "1.0.0";
|
|
1075
1077
|
|
|
1076
1078
|
//#endregion
|
|
1077
1079
|
//#region src/controllers/dv-alert.controller.ts
|
|
@@ -1199,7 +1201,8 @@ let DataValidationAutoFillController = class DataValidationAutoFillController ex
|
|
|
1199
1201
|
ranges: ranges.length > 1 ? _univerjs_core.Rectangle.mergeRanges(ranges) : ranges
|
|
1200
1202
|
}));
|
|
1201
1203
|
ruleMatrixCopy.addRangeRules(additions);
|
|
1202
|
-
const
|
|
1204
|
+
const diffs = ruleMatrixCopy.diff(this._sheetDataValidationModel.getRules(unitId, subUnitId));
|
|
1205
|
+
const { redoMutations, undoMutations } = (0, _univerjs_sheets_data_validation.getDataValidationDiffMutations)(unitId, subUnitId, diffs, this._injector, "patched", applyType === _univerjs_sheets.AUTO_FILL_APPLY_TYPE.ONLY_FORMAT);
|
|
1203
1206
|
return {
|
|
1204
1207
|
undos: undoMutations,
|
|
1205
1208
|
redos: redoMutations
|
|
@@ -1644,7 +1647,10 @@ function recalculateAutoHeight(infos, autoHeightController, commandService) {
|
|
|
1644
1647
|
ranges.push(...rule.ranges);
|
|
1645
1648
|
rangesBySheet.set(subUnitId, ranges);
|
|
1646
1649
|
}
|
|
1647
|
-
for (const [unitId, rangesBySheet] of rangesByUnit) for (const [subUnitId, ranges] of rangesBySheet)
|
|
1650
|
+
for (const [unitId, rangesBySheet] of rangesByUnit) for (const [subUnitId, ranges] of rangesBySheet) {
|
|
1651
|
+
const mutations = autoHeightController.getUndoRedoParamsOfAutoHeight(ranges, subUnitId, void 0, unitId);
|
|
1652
|
+
(0, _univerjs_core.sequenceExecute)(mutations.redos, commandService);
|
|
1653
|
+
}
|
|
1648
1654
|
}
|
|
1649
1655
|
|
|
1650
1656
|
//#endregion
|
|
@@ -1679,7 +1685,8 @@ let SheetsDataValidationMobileRenderController = class SheetsDataValidationMobil
|
|
|
1679
1685
|
if (!rule) return next(cell);
|
|
1680
1686
|
const validStatus = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col) ?? _univerjs_core.DataValidationStatus.VALID;
|
|
1681
1687
|
const validator = this._dataValidatorRegistryService.getValidatorItem(rule.type);
|
|
1682
|
-
const
|
|
1688
|
+
const cellOrigin = worksheet.getCellRaw(row, col);
|
|
1689
|
+
const cellValue = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(cellOrigin);
|
|
1683
1690
|
const valueStr = `${cellValue ?? ""}`;
|
|
1684
1691
|
if (!cell || cell === pos.rawData) cell = { ...pos.rawData };
|
|
1685
1692
|
cell.markers = {
|
|
@@ -1761,7 +1768,7 @@ const MARGIN_H$2 = 6;
|
|
|
1761
1768
|
let CheckboxRender = class CheckboxRender {
|
|
1762
1769
|
_calc(cellInfo, style) {
|
|
1763
1770
|
const { vt, ht } = style || {};
|
|
1764
|
-
const width = cellInfo.endX - cellInfo.startX -
|
|
1771
|
+
const width = cellInfo.endX - cellInfo.startX - 12;
|
|
1765
1772
|
const height = cellInfo.endY - cellInfo.startY;
|
|
1766
1773
|
const size = ((style === null || style === void 0 ? void 0 : style.fs) ?? 10) * 1.6;
|
|
1767
1774
|
let widgetLeft = 0;
|
|
@@ -1773,9 +1780,7 @@ let CheckboxRender = class CheckboxRender {
|
|
|
1773
1780
|
case _univerjs_core.VerticalAlign.BOTTOM:
|
|
1774
1781
|
widgetTop = 0 + (height - size);
|
|
1775
1782
|
break;
|
|
1776
|
-
default:
|
|
1777
|
-
widgetTop = 0 + (height - size) / 2;
|
|
1778
|
-
break;
|
|
1783
|
+
default: widgetTop = 0 + (height - size) / 2;
|
|
1779
1784
|
}
|
|
1780
1785
|
switch (ht) {
|
|
1781
1786
|
case _univerjs_core.HorizontalAlign.LEFT:
|
|
@@ -1784,9 +1789,7 @@ let CheckboxRender = class CheckboxRender {
|
|
|
1784
1789
|
case _univerjs_core.HorizontalAlign.RIGHT:
|
|
1785
1790
|
widgetLeft = MARGIN_H$2 + (width - size);
|
|
1786
1791
|
break;
|
|
1787
|
-
default:
|
|
1788
|
-
widgetLeft = MARGIN_H$2 + (width - size) / 2;
|
|
1789
|
-
break;
|
|
1792
|
+
default: widgetLeft = MARGIN_H$2 + (width - size) / 2;
|
|
1790
1793
|
}
|
|
1791
1794
|
return {
|
|
1792
1795
|
left: cellInfo.startX + widgetLeft,
|
|
@@ -2074,25 +2077,22 @@ var DecimalValidatorView = class extends BaseSheetDataValidatorView {
|
|
|
2074
2077
|
|
|
2075
2078
|
//#endregion
|
|
2076
2079
|
//#region src/views/widgets/shape/layout.ts
|
|
2077
|
-
const PADDING_H$1 = 4;
|
|
2078
|
-
const PADDING_V$1 = 0;
|
|
2079
2080
|
const MARGIN_H$1 = 4;
|
|
2080
2081
|
const MARGIN_V$1 = 4;
|
|
2081
|
-
const CELL_PADDING_V = 6;
|
|
2082
2082
|
function getDropdownItemSize(text, fontStyle) {
|
|
2083
2083
|
const bBox = _univerjs_engine_render.FontCache.getTextSize(text, fontStyle);
|
|
2084
|
-
const rectWidth = bBox.width +
|
|
2084
|
+
const rectWidth = bBox.width + 8;
|
|
2085
2085
|
const { ba, bd } = bBox;
|
|
2086
2086
|
return {
|
|
2087
2087
|
width: rectWidth,
|
|
2088
|
-
height: ba + bd + 0
|
|
2088
|
+
height: ba + bd + 0,
|
|
2089
2089
|
ba
|
|
2090
2090
|
};
|
|
2091
2091
|
}
|
|
2092
2092
|
function layoutDropdowns(items, fontStyle, cellWidth, cellHeight) {
|
|
2093
2093
|
const cellPaddingH = 26;
|
|
2094
2094
|
const widthAvailableForContent = cellWidth - cellPaddingH;
|
|
2095
|
-
const heightAvailableForContent = cellHeight -
|
|
2095
|
+
const heightAvailableForContent = cellHeight - 12;
|
|
2096
2096
|
const textLayout = items.map((item) => ({
|
|
2097
2097
|
layout: getDropdownItemSize(item, fontStyle),
|
|
2098
2098
|
text: item
|
|
@@ -2132,7 +2132,7 @@ function layoutDropdowns(items, fontStyle, cellWidth, cellHeight) {
|
|
|
2132
2132
|
totalHeight,
|
|
2133
2133
|
contentWidth: widthAvailableForContent,
|
|
2134
2134
|
contentHeight: heightAvailableForContent,
|
|
2135
|
-
cellAutoHeight: totalHeight +
|
|
2135
|
+
cellAutoHeight: totalHeight + 12,
|
|
2136
2136
|
calcAutoWidth: maxLineWidth + cellPaddingH
|
|
2137
2137
|
};
|
|
2138
2138
|
}
|
|
@@ -2189,10 +2189,7 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
|
|
|
2189
2189
|
case _univerjs_core.VerticalAlign.MIDDLE:
|
|
2190
2190
|
top = (cellHeight - 14) / 2 + 4;
|
|
2191
2191
|
break;
|
|
2192
|
-
case _univerjs_core.VerticalAlign.BOTTOM:
|
|
2193
|
-
top = cellHeight - 14 + 4;
|
|
2194
|
-
break;
|
|
2195
|
-
default: break;
|
|
2192
|
+
case _univerjs_core.VerticalAlign.BOTTOM: top = cellHeight - 14 + 4;
|
|
2196
2193
|
}
|
|
2197
2194
|
ctx.save();
|
|
2198
2195
|
ctx.translateWithPrecision(cellBounding.startX + left, cellBounding.startY + top);
|
|
@@ -2241,10 +2238,7 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
|
|
|
2241
2238
|
case _univerjs_core.VerticalAlign.MIDDLE:
|
|
2242
2239
|
top = (layout.contentHeight - layout.totalHeight) / 2;
|
|
2243
2240
|
break;
|
|
2244
|
-
case _univerjs_core.VerticalAlign.BOTTOM:
|
|
2245
|
-
top = layout.contentHeight - layout.totalHeight;
|
|
2246
|
-
break;
|
|
2247
|
-
default: break;
|
|
2241
|
+
case _univerjs_core.VerticalAlign.BOTTOM: top = layout.contentHeight - layout.totalHeight;
|
|
2248
2242
|
}
|
|
2249
2243
|
ctx.translateWithPrecision(0, top);
|
|
2250
2244
|
layout.lines.forEach((line, index) => {
|
|
@@ -2255,10 +2249,7 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
|
|
|
2255
2249
|
case _univerjs_core.HorizontalAlign.RIGHT:
|
|
2256
2250
|
left = layout.contentWidth - width;
|
|
2257
2251
|
break;
|
|
2258
|
-
case _univerjs_core.HorizontalAlign.CENTER:
|
|
2259
|
-
left = (layout.contentWidth - width) / 2;
|
|
2260
|
-
break;
|
|
2261
|
-
default: break;
|
|
2252
|
+
case _univerjs_core.HorizontalAlign.CENTER: left = (layout.contentWidth - width) / 2;
|
|
2262
2253
|
}
|
|
2263
2254
|
ctx.translate(left, index * (height + 4));
|
|
2264
2255
|
items.forEach((item) => {
|
|
@@ -2299,7 +2290,9 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
|
|
|
2299
2290
|
const cellWidth = cellBounding.endX - cellBounding.startX;
|
|
2300
2291
|
const cellHeight = cellBounding.endY - cellBounding.startY;
|
|
2301
2292
|
const cellValue = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? "";
|
|
2302
|
-
|
|
2293
|
+
const items = validator.parseCellValue(cellValue);
|
|
2294
|
+
const fontStyle = (0, _univerjs_engine_render.getFontStyleString)(style ?? void 0);
|
|
2295
|
+
return layoutDropdowns(items, fontStyle, cellWidth, cellHeight).cellAutoHeight;
|
|
2303
2296
|
}
|
|
2304
2297
|
calcCellAutoWidth(info) {
|
|
2305
2298
|
const { primaryWithCoord, style, data, row, col } = info;
|
|
@@ -2318,7 +2311,9 @@ let DropdownMultipleWidget = class DropdownMultipleWidget {
|
|
|
2318
2311
|
const cellWidth = cellBounding.endX - cellBounding.startX;
|
|
2319
2312
|
const cellHeight = cellBounding.endY - cellBounding.startY;
|
|
2320
2313
|
const cellValue = (0, _univerjs_sheets_data_validation.getCellValueOrigin)(data) ?? "";
|
|
2321
|
-
|
|
2314
|
+
const items = validator.parseCellValue(cellValue);
|
|
2315
|
+
const fontStyle = (0, _univerjs_engine_render.getFontStyleString)(style ?? void 0);
|
|
2316
|
+
return layoutDropdowns(items, fontStyle, cellWidth, cellHeight).calcAutoWidth;
|
|
2322
2317
|
}
|
|
2323
2318
|
isHit(position, info) {
|
|
2324
2319
|
const { primaryWithCoord } = info;
|
|
@@ -2439,9 +2434,7 @@ function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht, margi
|
|
|
2439
2434
|
case _univerjs_core.VerticalAlign.MIDDLE:
|
|
2440
2435
|
paddingTop = (cellHeight - fontHeight) / 2;
|
|
2441
2436
|
break;
|
|
2442
|
-
default:
|
|
2443
|
-
paddingTop = realMargin;
|
|
2444
|
-
break;
|
|
2437
|
+
default: paddingTop = realMargin;
|
|
2445
2438
|
}
|
|
2446
2439
|
paddingTop = Math.max(MARGIN_V, paddingTop);
|
|
2447
2440
|
let paddingLeft = 0;
|
|
@@ -2449,10 +2442,7 @@ function calcPadding(cellWidth, cellHeight, fontWidth, fontHeight, vt, ht, margi
|
|
|
2449
2442
|
case _univerjs_core.HorizontalAlign.CENTER:
|
|
2450
2443
|
paddingLeft = (cellWidth - fontWidth) / 2;
|
|
2451
2444
|
break;
|
|
2452
|
-
case _univerjs_core.HorizontalAlign.RIGHT:
|
|
2453
|
-
paddingLeft = cellWidth - fontWidth;
|
|
2454
|
-
break;
|
|
2455
|
-
default: break;
|
|
2445
|
+
case _univerjs_core.HorizontalAlign.RIGHT: paddingLeft = cellWidth - fontWidth;
|
|
2456
2446
|
}
|
|
2457
2447
|
paddingLeft = Math.max(MARGIN_H, paddingLeft);
|
|
2458
2448
|
return {
|
|
@@ -2492,9 +2482,7 @@ let DropdownWidget = class DropdownWidget {
|
|
|
2492
2482
|
case _univerjs_core.VerticalAlign.BOTTOM:
|
|
2493
2483
|
top = cellHeight - b - fontHeight - MARGIN_V + (fontHeight / 2 - ICON_SIZE / 2);
|
|
2494
2484
|
break;
|
|
2495
|
-
default:
|
|
2496
|
-
top = t + MARGIN_V + (fontHeight / 2 - ICON_SIZE / 2);
|
|
2497
|
-
break;
|
|
2485
|
+
default: top = t + MARGIN_V + (fontHeight / 2 - ICON_SIZE / 2);
|
|
2498
2486
|
}
|
|
2499
2487
|
ctx.save();
|
|
2500
2488
|
ctx.translateWithPrecision(cellBounding.startX + left, cellBounding.startY + top);
|
|
@@ -2580,13 +2568,13 @@ let DropdownWidget = class DropdownWidget {
|
|
|
2580
2568
|
ctx.beginPath();
|
|
2581
2569
|
ctx.rect(0, 0, cellWidth, cellHeight);
|
|
2582
2570
|
ctx.clip();
|
|
2583
|
-
const realWidth = cellWidth -
|
|
2571
|
+
const realWidth = cellWidth - 12 - PADDING_H - ICON_PLACE - 4;
|
|
2584
2572
|
const textSkeleton = new _univerjs_engine_render.DocSimpleSkeleton(valueStr, fontStyle, Boolean(tb === _univerjs_core.WrapStrategy.WRAP), realWidth, Infinity);
|
|
2585
2573
|
textSkeleton.calculate();
|
|
2586
2574
|
const fontWidth = textSkeleton.getTotalWidth();
|
|
2587
2575
|
const fontHeight = textSkeleton.getTotalHeight();
|
|
2588
|
-
const rectHeight = fontHeight +
|
|
2589
|
-
const rectWidth = Math.max(cellWidth -
|
|
2576
|
+
const rectHeight = fontHeight + 2;
|
|
2577
|
+
const rectWidth = Math.max(cellWidth - 12, 1);
|
|
2590
2578
|
const { paddingTop } = calcPadding(rectWidth, cellHeight, fontWidth, rectHeight, vt, ht);
|
|
2591
2579
|
ctx.translateWithPrecision(MARGIN_H, paddingTop);
|
|
2592
2580
|
_univerjs_engine_render.Rect.drawWith(ctx, {
|
|
@@ -2647,12 +2635,12 @@ let DropdownWidget = class DropdownWidget {
|
|
|
2647
2635
|
const realWidth = cellWidth - l - r - ICON_PLACE - 4;
|
|
2648
2636
|
const skeleton = new _univerjs_engine_render.DocSimpleSkeleton(valueStr, (0, _univerjs_engine_render.getFontStyleString)(style).fontCache, Boolean(tb === _univerjs_core.WrapStrategy.WRAP), realWidth, Infinity);
|
|
2649
2637
|
skeleton.calculate();
|
|
2650
|
-
return skeleton.getTotalHeight() + t + b +
|
|
2638
|
+
return skeleton.getTotalHeight() + t + b + 6;
|
|
2651
2639
|
} else {
|
|
2652
|
-
const realWidth = Math.max(cellWidth -
|
|
2640
|
+
const realWidth = Math.max(cellWidth - 12 - PADDING_H - ICON_PLACE - 4, 10);
|
|
2653
2641
|
const skeleton = new _univerjs_engine_render.DocSimpleSkeleton(valueStr, (0, _univerjs_engine_render.getFontStyleString)(style).fontCache, Boolean(tb === _univerjs_core.WrapStrategy.WRAP), realWidth, Infinity);
|
|
2654
2642
|
skeleton.calculate();
|
|
2655
|
-
return skeleton.getTotalHeight() +
|
|
2643
|
+
return skeleton.getTotalHeight() + 6 + 2;
|
|
2656
2644
|
}
|
|
2657
2645
|
}
|
|
2658
2646
|
calcCellAutoWidth(info) {
|
|
@@ -3264,6 +3252,7 @@ const DataValidationItem = (props) => {
|
|
|
3264
3252
|
const ids = (0, react.useRef)(void 0);
|
|
3265
3253
|
const [isHover, setIsHover] = (0, react.useState)(false);
|
|
3266
3254
|
const themeService = (0, _univerjs_ui.useDependency)(_univerjs_core.ThemeService);
|
|
3255
|
+
const theme = (0, _univerjs_ui.useObservable)(themeService.currentTheme$);
|
|
3267
3256
|
const style = (0, react.useMemo)(() => {
|
|
3268
3257
|
const defaultColor = themeService.getColorFromTheme("primary.600");
|
|
3269
3258
|
const key = themeService.getColorFromTheme("loop-color.2");
|
|
@@ -3273,7 +3262,7 @@ const DataValidationItem = (props) => {
|
|
|
3273
3262
|
fill: `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 0.1)`,
|
|
3274
3263
|
stroke: color
|
|
3275
3264
|
};
|
|
3276
|
-
}, [
|
|
3265
|
+
}, [theme]);
|
|
3277
3266
|
const handleDelete = (e) => {
|
|
3278
3267
|
commandService.executeCommand(_univerjs_sheets_data_validation.RemoveSheetDataValidationCommand.id, {
|
|
3279
3268
|
ruleId: rule.uid,
|
|
@@ -3709,13 +3698,15 @@ function ListFormulaInput(props) {
|
|
|
3709
3698
|
const [refOptions, setRefOptions] = (0, react.useState)([]);
|
|
3710
3699
|
const [localError, setLocalError] = (0, react.useState)("");
|
|
3711
3700
|
const formula1Res = showError ? validResult === null || validResult === void 0 ? void 0 : validResult.formula1 : "";
|
|
3712
|
-
const ruleChange = (0,
|
|
3701
|
+
const ruleChange$ = (0, react.useMemo)(() => dataValidationModel.ruleChange$.pipe((0, rxjs.debounceTime)(16)), []);
|
|
3702
|
+
const ruleChange = (0, _univerjs_ui.useObservable)(ruleChange$);
|
|
3713
3703
|
const onChange = (0, _univerjs_ui.useEvent)(_onChange);
|
|
3714
3704
|
(0, react.useEffect)(() => {
|
|
3715
3705
|
let cancelled = false;
|
|
3716
3706
|
const timer = setTimeout(() => {
|
|
3717
3707
|
const rule = dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
|
|
3718
|
-
|
|
3708
|
+
const formula1 = rule === null || rule === void 0 ? void 0 : rule.formula1;
|
|
3709
|
+
if ((0, _univerjs_core.isFormulaString)(formula1) && listValidator && rule) listValidator.getListAsync(rule, unitId, subUnitId).then((options) => {
|
|
3719
3710
|
if (!cancelled) setRefOptions(options);
|
|
3720
3711
|
});
|
|
3721
3712
|
}, 100);
|
package/lib/cjs/locale/ar-SA.js
CHANGED
package/lib/cjs/locale/ca-ES.js
CHANGED
package/lib/cjs/locale/de-DE.js
CHANGED
package/lib/cjs/locale/en-US.js
CHANGED
package/lib/cjs/locale/es-ES.js
CHANGED
package/lib/cjs/locale/fa-IR.js
CHANGED
package/lib/cjs/locale/fr-FR.js
CHANGED
package/lib/cjs/locale/id-ID.js
CHANGED
package/lib/cjs/locale/it-IT.js
CHANGED
package/lib/cjs/locale/ja-JP.js
CHANGED
package/lib/cjs/locale/ko-KR.js
CHANGED
package/lib/cjs/locale/pl-PL.js
CHANGED
package/lib/cjs/locale/pt-BR.js
CHANGED
package/lib/cjs/locale/ru-RU.js
CHANGED
package/lib/cjs/locale/sk-SK.js
CHANGED
package/lib/cjs/locale/vi-VN.js
CHANGED
package/lib/cjs/locale/zh-CN.js
CHANGED
package/lib/cjs/locale/zh-HK.js
CHANGED
package/lib/cjs/locale/zh-TW.js
CHANGED