Skip to content

Commit

Permalink
fix(sheets-data-validation): data validation validator empty ranges &…
Browse files Browse the repository at this point in the history
… comment active issue & sheet-hyper-link autofill (#3003)
  • Loading branch information
weird94 authored Aug 10, 2024
1 parent 94d436c commit 3271885
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 55 deletions.
1 change: 1 addition & 0 deletions packages/sheets-data-validation/src/locale/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const locale: typeof zhCN = {
rejectInput: 'Reject input',
messageInfo: 'Helper message',
showInfo: 'Show help text for a selected cell',
rangeError: 'Ranges are not legal',
},
operators: {
between: 'between',
Expand Down
1 change: 1 addition & 0 deletions packages/sheets-data-validation/src/locale/ru-RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const locale: typeof zhCN = {
removeAll: 'Удалить все',
add: 'добавить правило',
range: 'Диапазоны',
rangeError: 'Диапазоны не являются законными',
type: 'Тип',
options: 'Дополнительные параметры',
operator: 'Оператор',
Expand Down
1 change: 1 addition & 0 deletions packages/sheets-data-validation/src/locale/vi-VN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const locale: typeof zhCN = {
removeAll: 'Xóa tất cả',
add: 'Tạo quy tắc mới',
range: 'Phạm vi áp dụng',
rangeError: 'Phạm vi không hợp pháp',
type: 'Loại điều kiện',
options: 'Cài đặt nâng cao',
operator: 'Dữ liệu',
Expand Down
1 change: 1 addition & 0 deletions packages/sheets-data-validation/src/locale/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const locale = {
removeAll: '全部删除',
add: '新建规则',
range: '应用范围',
rangeError: '请输入合法的应用范围',
type: '条件类型',
options: '高级设置',
operator: '数据',
Expand Down
1 change: 1 addition & 0 deletions packages/sheets-data-validation/src/locale/zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const locale: typeof zhCN = {
removeAll: '全部刪除',
add: '新建規則',
range: '應用範圍',
rangeError: '應用範圍不合法',
type: '條件型別',
options: '進階設定',
operator: '資料',
Expand Down
8 changes: 7 additions & 1 deletion packages/sheets-data-validation/src/views/detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export function DataValidationDetail() {
const isTwoFormula = localRule.operator ? TWO_FORMULA_OPERATOR_COUNT.includes(localRule.operator) : false;

const handleOk = () => {
if (!localRule.ranges.length) {
return;
}
if (validator.validatorFormula(localRule, unitId, subUnitId).success) {
dataValidationPanelService.setActiveRule(null);
} else {
Expand Down Expand Up @@ -209,7 +212,10 @@ export function DataValidationDetail() {
};
return (
<div>
<FormLayout label={localeService.t('dataValidation.panel.range')}>
<FormLayout
label={localeService.t('dataValidation.panel.range')}
error={!localRule.ranges.length ? localeService.t('dataValidation.panel.rangeError') : ''}
>
<RangeSelector
key={key}
className={styles.dataValidationDetailFormItem}
Expand Down
104 changes: 51 additions & 53 deletions packages/sheets-hyper-link-ui/src/controllers/auto-fill.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,62 +78,60 @@ export class SheetsHyperLinkAutoFillController extends Disposable {
);
const { row: sourceRow, col: sourceCol } = mapFunc(sourcePositionRange.startRow, sourcePositionRange.startColumn);
const link = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, sourceRow, sourceCol);
if (link) {
const targetPositionRange = Rectangle.getPositionRange(
{
startRow: row,
startColumn: col,
endColumn: col,
endRow: row,
const targetPositionRange = Rectangle.getPositionRange(
{
startRow: row,
startColumn: col,
endColumn: col,
endRow: row,
},
targetRange
);
const { row: targetRow, col: targetCol } = mapFunc(targetPositionRange.startRow, targetPositionRange.startColumn);
const id = Tools.generateRandomId();
const currentLink = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, targetRow, targetCol);
if (currentLink) {
redos.push({
id: RemoveHyperLinkMutation.id,
params: {
unitId,
subUnitId,
id: currentLink.id,
},
targetRange
);
const { row: targetRow, col: targetCol } = mapFunc(targetPositionRange.startRow, targetPositionRange.startColumn);
const id = Tools.generateRandomId();
const currentLink = this._hyperLinkModel.getHyperLinkByLocation(unitId, subUnitId, targetRow, targetCol);
if (currentLink) {
redos.push({
id: RemoveHyperLinkMutation.id,
params: {
unitId,
subUnitId,
id: currentLink.id,
},
});
}
if (APPLY_TYPE.COPY === applyType || APPLY_TYPE.SERIES === applyType) {
redos.push({
id: AddHyperLinkMutation.id,
params: {
unitId,
subUnitId,
link: {
...link,
id,
row: targetRow,
column: targetCol,
},
},
});
undos.push({
id: RemoveHyperLinkMutation.id,
params: {
unitId,
subUnitId,
});
}
if ((APPLY_TYPE.COPY === applyType || APPLY_TYPE.SERIES === applyType) && link) {
redos.push({
id: AddHyperLinkMutation.id,
params: {
unitId,
subUnitId,
link: {
...link,
id,
row: targetRow,
column: targetCol,
},
});
}
if (currentLink) {
undos.push({
id: AddHyperLinkMutation.id,
params: {
unitId,
subUnitId,
link: currentLink,
},
});
}
},
});
undos.push({
id: RemoveHyperLinkMutation.id,
params: {
unitId,
subUnitId,
id,
},
});
}
if (currentLink) {
undos.push({
id: AddHyperLinkMutation.id,
params: {
unitId,
subUnitId,
link: currentLink,
},
});
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ export class SheetsThreadCommentController extends Disposable {
if ((type === SelectionMoveType.MOVE_END || type === undefined) && selections[0]?.primary) {
const range = selections[0].range;
if (range.endColumn - range.startColumn > 0 || range.endRow - range.startRow > 0) {
if (this._threadCommentPanelService.activeCommentId) {
this._commandService.executeCommand(SetActiveCommentOperation.id);
}
return;
}
const row = selections[0].primary.actualRow;
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/services/editor/editor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ export class EditorService extends Disposable implements IEditorService, IDispos

editor.setFocus(true);

// this._contextService.setContextValue(EDITOR_ACTIVATED, true);
this._contextService.setContextValue(EDITOR_ACTIVATED, true);
this._contextService.setContextValue(FOCUSING_EDITOR_STANDALONE, true);

this._contextService.setContextValue(FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, editor.isSingle());
Expand Down

0 comments on commit 3271885

Please sign in to comment.