Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
refactor: remove/modify exported variables with the same name (#6625)
wpxp123456f43a43b1b4bb
diff --git a/packages/core/src/shared/clipboard.ts b/packages/core/src/shared/clipboard.tsdeleted file mode 100644index e455bebd98..0000000000--- a/packages/core/src/shared/clipboard.ts+++ /dev/null@@ -1,166 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { IDocumentBody, ITextRun } from '../types/interfaces';-import { BaselineOffset, BooleanNumber } from '../types/enum';-import { Tools } from './tools';--export function getBodySliceHtml(body: IDocumentBody, startIndex: number, endIndex: number) {- const { dataStream, textRuns = [] } = body;- let cursorIndex = startIndex;- const spanList: string[] = [];-- for (const textRun of textRuns) {- const { st, ed } = textRun;- if (Tools.hasIntersectionBetweenTwoRanges(startIndex, endIndex, st, ed)) {- if (st > cursorIndex) {- spanList.push(dataStream.slice(cursorIndex, st));-- spanList.push(covertTextRunToHtml(dataStream, {- ...textRun,- ed: Math.min(ed, endIndex),- }));- } else {- spanList.push(covertTextRunToHtml(dataStream, {- ...textRun,- st: cursorIndex,- ed: Math.min(ed, endIndex),- }));- }- }-- cursorIndex = Math.max(startIndex, Math.min(ed, endIndex));- }-- if (cursorIndex !== endIndex) {- spanList.push(dataStream.slice(cursorIndex, endIndex));- }-- return spanList.join('');-}--export function convertBodyToHtml(body: IDocumentBody, withParagraphInfo: boolean = true): string {- if (withParagraphInfo && body.paragraphs?.length) {- const { dataStream, paragraphs = [] } = body;- let result = '';- let cursorIndex = -1;- for (const paragraph of paragraphs) {- const { startIndex, paragraphStyle = {} } = paragraph;- const { spaceAbove, spaceBelow, lineSpacing } = paragraphStyle;- const style = [];-- if (spaceAbove != null) {- if (typeof spaceAbove === 'number') {- style.push(`margin-top: ${spaceAbove}px`);- } else {- style.push(`margin-top: ${spaceAbove.v}px`);- }- }-- if (spaceBelow != null) {- if (typeof spaceBelow === 'number') {- style.push(`margin-bottom: ${spaceBelow}px`);- } else {- style.push(`margin-bottom: ${spaceBelow.v}px`);- }- }-- if (lineSpacing != null) {- style.push(`line-height: ${lineSpacing}`);- }-- if (startIndex > cursorIndex + 1) {- result += `<p class="UniverNormal" ${style.length ? `style="${style.join('; ')};"` : ''- }>${getBodySliceHtml(body, cursorIndex + 1, startIndex)}</p>`;- } else {- result += `<p class="UniverNormal" ${style.length ? `style="${style.join('; ')};"` : ''- }></p>`;- }-- cursorIndex = startIndex;- }-- if (cursorIndex !== dataStream.length) {- result += getBodySliceHtml(body, cursorIndex, dataStream.length);- }-- return result;- } else {- return getBodySliceHtml(body, 0, body.dataStream.length);- }-}--export function covertTextRunToHtml(dataStream: string, textRun: ITextRun): string {- const { st: start, ed, ts = {} } = textRun;- const { ff, fs, it, bl, ul, st, ol, bg, cl, va } = ts;-- let html = dataStream.slice(start, ed);- const style: string[] = [];-- // italic- if (it === BooleanNumber.TRUE) {- html = `<i>${html}</i>`;- }-- // subscript and superscript- if (va === BaselineOffset.SUPERSCRIPT) {- html = `<sup>${html}</sup>`;- } else if (va === BaselineOffset.SUBSCRIPT) {- html = `<sub>${html}</sub>`;- }-- // underline- if (ul?.s === BooleanNumber.TRUE) {- html = `<u>${html}</u>`;- }-- // strick-through- if (st?.s === BooleanNumber.TRUE) {- html = `<s>${html}</s>`;- }-- // bold- if (bl === BooleanNumber.TRUE) {- html = `<strong>${html}</strong>`;- }-- // font family- if (ff) {- style.push(`font-family: ${ff}`);- }-- // font color- if (cl) {- style.push(`color: ${cl.rgb}`);- }-- // font size- if (fs) {- style.push(`font-size: ${fs}pt`);- }-- // overline- if (ol) {- style.push('text-decoration: overline');- }-- // background color- if (bg) {- style.push(`background: ${bg.rgb}`);- }-- return style.length ? `<span style="${style.join('; ')};">${html}</span>` : html;-}diff --git a/packages/core/src/shared/index.ts b/packages/core/src/shared/index.tsindex 907b1deae7..abeac617da 100644--- a/packages/core/src/shared/index.ts+++ b/packages/core/src/shared/index.ts@@ -18,7 +18,6 @@ export { afterInitApply } from './after-init-apply';export * from './array-search';export * from './blob';export { checkIfMove, MOVE_BUFFER_VALUE, ROTATE_BUFFER_VALUE } from './check-if-move';-export * from './clipboard';export * from './color/color';export { ColorKit, COLORS, type IRgbColor, RGB_PAREN, RGBA_PAREN } from './color/color-kit';export * from './command-enum';diff --git a/packages/sheets-table-ui/src/services/sheets-table-ui-service.ts b/packages/sheets-table-ui/src/services/sheets-table-ui-service.tsindex f160d04faa..adf21b8ba1 100644--- a/packages/sheets-table-ui/src/services/sheets-table-ui-service.ts+++ b/packages/sheets-table-ui/src/services/sheets-table-ui-service.ts@@ -20,7 +20,7 @@ import type { ISetSheetTableParams, ITableFilterItem } from '@univerjs/sheets-taimport type { IFilterByValueWithTreeItem, ITableFilterItemList } from '../types';import { cellToRange, Disposable, ICommandService, Inject, IUniverInstanceService, LocaleService, ObjectMatrix, Rectangle } from '@univerjs/core';import { SetRangeValuesMutation } from '@univerjs/sheets';-import { isConditionFilter, isManualFilter, SetSheetTableFilterCommand, SheetTableService, TableManager } from '@univerjs/sheets-table';+import { isConditionFilter, isManualTableFilter, SetSheetTableFilterCommand, SheetTableService, TableManager } from '@univerjs/sheets-table';import { FilterByEnum } from '../types';interface ISheetTableFilterPanelProps {@@ -103,7 +103,7 @@ export class SheetsTableUiService extends Disposable {const checkedItems: string[] = [];if (table) {const filter = table.getTableFilterColumn(columnIndex);- if (filter && isManualFilter(filter)) {+ if (filter && isManualTableFilter(filter)) {checkedItems.push(...filter.values);}}diff --git a/packages/sheets-table/src/index.ts b/packages/sheets-table/src/index.tsindex d74d41f899..0d7385ab93 100644--- a/packages/sheets-table/src/index.ts+++ b/packages/sheets-table/src/index.ts@@ -26,7 +26,7 @@ export type { ISetSheetTableParams } from '../src/commands/mutations/set-table-fexport { SheetsTableController } from '../src/controllers/sheets-table.controller';export { TableManager } from '../src/model/table-manager';export { SheetTableService } from '../src/services/table-service';-export { isConditionFilter, isManualFilter } from '../src/util';+export { isConditionFilter, isManualTableFilter } from '../src/util';export type { IAddSheetTableCommandParams } from './commands/commands/add-sheet-table.command';export type { IAddTableThemeCommandParams } from './commands/commands/add-table-theme.command';export { AddTableThemeCommand } from './commands/commands/add-table-theme.command';diff --git a/packages/sheets-table/src/util.ts b/packages/sheets-table/src/util.tsindex 9aabddd44b..2c4db26a6a 100644--- a/packages/sheets-table/src/util.ts+++ b/packages/sheets-table/src/util.ts@@ -93,7 +93,7 @@ export function isConditionFilter(filter: ITableFilterItem | undefined): filterreturn filter.filterType === TableColumnFilterTypeEnum.condition;}-export function isManualFilter(filter: ITableFilterItem | undefined): filter is ITableManualFilterItem {+export function isManualTableFilter(filter: ITableFilterItem | undefined): filter is ITableManualFilterItem {if (!filter) {return false;}