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