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
fix: dup list glyph type name (#4169)
Ran Luo6b6836491b0d
diff --git a/packages/core/src/docs/data-model/preset-list-type.ts b/packages/core/src/docs/data-model/preset-list-type.tsindex aaf6393b2e..110d94c4fb 100644--- a/packages/core/src/docs/data-model/preset-list-type.ts+++ b/packages/core/src/docs/data-model/preset-list-type.ts@@ -17,7 +17,7 @@import type { IListData, INestingLevel, ITextStyle } from '../../types/interfaces/i-document-data';import { Tools } from '../../shared';import { BooleanNumber } from '../../types/enum';-import { BulletAlignment, GlyphType } from '../../types/interfaces/i-document-data';+import { BulletAlignment, ListGlyphType } from '../../types/interfaces/i-document-data';export enum QuickListType {ORDER_LIST_QUICK_1 = '1.',@@ -73,12 +73,12 @@ export enum PresetListType {}const orderListSymbolMap = {- 'a)': { glyphFormat: '%1)', glyphType: GlyphType.DECIMAL },- '1.': { glyphFormat: '%1.', glyphType: GlyphType.DECIMAL },- 'a.': { glyphFormat: '%1.', glyphType: GlyphType.LOWER_LETTER },- 'A.': { glyphFormat: '%1.', glyphType: GlyphType.UPPER_LETTER },- 'i.': { glyphFormat: '%1.', glyphType: GlyphType.LOWER_ROMAN },- 'I.': { glyphFormat: '%1.', glyphType: GlyphType.UPPER_LETTER },+ 'a)': { glyphFormat: '%1)', glyphType: ListGlyphType.DECIMAL },+ '1.': { glyphFormat: '%1.', glyphType: ListGlyphType.DECIMAL },+ 'a.': { glyphFormat: '%1.', glyphType: ListGlyphType.LOWER_LETTER },+ 'A.': { glyphFormat: '%1.', glyphType: ListGlyphType.UPPER_LETTER },+ 'i.': { glyphFormat: '%1.', glyphType: ListGlyphType.LOWER_ROMAN },+ 'I.': { glyphFormat: '%1.', glyphType: ListGlyphType.UPPER_LETTER },};type BulletSymbols = [string, string, string];@@ -102,7 +102,7 @@ const bulletListFactory = (symbols: BulletSymbols): INestingLevel[] => {}));};-const orderListFactory = (options: { glyphFormat: string; glyphType: GlyphType }[]): INestingLevel[] => {+const orderListFactory = (options: { glyphFormat: string; glyphType: ListGlyphType }[]): INestingLevel[] => {return options.map((format, i) => ({...format,bulletAlignment: BulletAlignment.START,@@ -163,29 +163,29 @@ export const PRESET_LIST_TYPE: Record<string, IListData> = {[PresetListType.ORDER_LIST]: {listType: PresetListType.ORDER_LIST,nestingLevel: orderListFactory([- { glyphFormat: '%1.', glyphType: GlyphType.DECIMAL },- { glyphFormat: '%2.', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%3.', glyphType: GlyphType.LOWER_ROMAN },- { glyphFormat: '%4.', glyphType: GlyphType.DECIMAL },- { glyphFormat: '%5.', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%6.', glyphType: GlyphType.LOWER_ROMAN },- { glyphFormat: '%7.', glyphType: GlyphType.DECIMAL },- { glyphFormat: '%8.', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%9.', glyphType: GlyphType.LOWER_ROMAN },+ { glyphFormat: '%1.', glyphType: ListGlyphType.DECIMAL },+ { glyphFormat: '%2.', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%3.', glyphType: ListGlyphType.LOWER_ROMAN },+ { glyphFormat: '%4.', glyphType: ListGlyphType.DECIMAL },+ { glyphFormat: '%5.', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%6.', glyphType: ListGlyphType.LOWER_ROMAN },+ { glyphFormat: '%7.', glyphType: ListGlyphType.DECIMAL },+ { glyphFormat: '%8.', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%9.', glyphType: ListGlyphType.LOWER_ROMAN },]),} as IListData,[PresetListType.ORDER_LIST_1]: {listType: PresetListType.ORDER_LIST,nestingLevel: orderListFactory([- { glyphFormat: '%1)', glyphType: GlyphType.DECIMAL },- { glyphFormat: '%2)', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%3)', glyphType: GlyphType.LOWER_ROMAN },- { glyphFormat: '%4)', glyphType: GlyphType.DECIMAL },- { glyphFormat: '%5)', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%6)', glyphType: GlyphType.LOWER_ROMAN },- { glyphFormat: '%7)', glyphType: GlyphType.DECIMAL },- { glyphFormat: '%8)', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%9)', glyphType: GlyphType.LOWER_ROMAN },+ { glyphFormat: '%1)', glyphType: ListGlyphType.DECIMAL },+ { glyphFormat: '%2)', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%3)', glyphType: ListGlyphType.LOWER_ROMAN },+ { glyphFormat: '%4)', glyphType: ListGlyphType.DECIMAL },+ { glyphFormat: '%5)', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%6)', glyphType: ListGlyphType.LOWER_ROMAN },+ { glyphFormat: '%7)', glyphType: ListGlyphType.DECIMAL },+ { glyphFormat: '%8)', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%9)', glyphType: ListGlyphType.LOWER_ROMAN },]),} as IListData,[PresetListType.ORDER_LIST_2]: {@@ -198,48 +198,48 @@ export const PRESET_LIST_TYPE: Record<string, IListData> = {'%1.%2.%3.%4.%5.','%1.%2.%3.%4.%5.%6.','%1.%2.%3.%4.%5.%6.%7.',- ].map((format) => ({ glyphFormat: format, glyphType: GlyphType.DECIMAL }))),+ ].map((format) => ({ glyphFormat: format, glyphType: ListGlyphType.DECIMAL }))),} as IListData,[PresetListType.ORDER_LIST_3]: {listType: PresetListType.ORDER_LIST,nestingLevel: orderListFactory([- { glyphFormat: '%1.', glyphType: GlyphType.UPPER_LETTER },- { glyphFormat: '%2.', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%3.', glyphType: GlyphType.LOWER_ROMAN },- { glyphFormat: '%4.', glyphType: GlyphType.UPPER_LETTER },- { glyphFormat: '%5.', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%6.', glyphType: GlyphType.LOWER_ROMAN },- { glyphFormat: '%7.', glyphType: GlyphType.UPPER_LETTER },- { glyphFormat: '%8.', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%9.', glyphType: GlyphType.LOWER_ROMAN },+ { glyphFormat: '%1.', glyphType: ListGlyphType.UPPER_LETTER },+ { glyphFormat: '%2.', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%3.', glyphType: ListGlyphType.LOWER_ROMAN },+ { glyphFormat: '%4.', glyphType: ListGlyphType.UPPER_LETTER },+ { glyphFormat: '%5.', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%6.', glyphType: ListGlyphType.LOWER_ROMAN },+ { glyphFormat: '%7.', glyphType: ListGlyphType.UPPER_LETTER },+ { glyphFormat: '%8.', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%9.', glyphType: ListGlyphType.LOWER_ROMAN },]),} as IListData,[PresetListType.ORDER_LIST_4]: {listType: PresetListType.ORDER_LIST,nestingLevel: orderListFactory([- { glyphFormat: '%1.', glyphType: GlyphType.UPPER_LETTER },- { glyphFormat: '%2.', glyphType: GlyphType.DECIMAL },- { glyphFormat: '%3.', glyphType: GlyphType.LOWER_ROMAN },- { glyphFormat: '%4.', glyphType: GlyphType.UPPER_LETTER },- { glyphFormat: '%5.', glyphType: GlyphType.DECIMAL },- { glyphFormat: '%6.', glyphType: GlyphType.LOWER_ROMAN },- { glyphFormat: '%7.', glyphType: GlyphType.UPPER_LETTER },- { glyphFormat: '%8.', glyphType: GlyphType.DECIMAL },- { glyphFormat: '%9.', glyphType: GlyphType.LOWER_ROMAN },+ { glyphFormat: '%1.', glyphType: ListGlyphType.UPPER_LETTER },+ { glyphFormat: '%2.', glyphType: ListGlyphType.DECIMAL },+ { glyphFormat: '%3.', glyphType: ListGlyphType.LOWER_ROMAN },+ { glyphFormat: '%4.', glyphType: ListGlyphType.UPPER_LETTER },+ { glyphFormat: '%5.', glyphType: ListGlyphType.DECIMAL },+ { glyphFormat: '%6.', glyphType: ListGlyphType.LOWER_ROMAN },+ { glyphFormat: '%7.', glyphType: ListGlyphType.UPPER_LETTER },+ { glyphFormat: '%8.', glyphType: ListGlyphType.DECIMAL },+ { glyphFormat: '%9.', glyphType: ListGlyphType.LOWER_ROMAN },]),} as IListData,[PresetListType.ORDER_LIST_5]: {listType: PresetListType.ORDER_LIST,nestingLevel: orderListFactory([- { glyphFormat: '%1.', glyphType: GlyphType.DECIMAL_ZERO },- { glyphFormat: '%2.', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%3.', glyphType: GlyphType.LOWER_ROMAN },- { glyphFormat: '%4.', glyphType: GlyphType.DECIMAL_ZERO },- { glyphFormat: '%5.', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%6.', glyphType: GlyphType.LOWER_ROMAN },- { glyphFormat: '%7.', glyphType: GlyphType.DECIMAL_ZERO },- { glyphFormat: '%8.', glyphType: GlyphType.LOWER_LETTER },- { glyphFormat: '%9.', glyphType: GlyphType.LOWER_ROMAN },+ { glyphFormat: '%1.', glyphType: ListGlyphType.DECIMAL_ZERO },+ { glyphFormat: '%2.', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%3.', glyphType: ListGlyphType.LOWER_ROMAN },+ { glyphFormat: '%4.', glyphType: ListGlyphType.DECIMAL_ZERO },+ { glyphFormat: '%5.', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%6.', glyphType: ListGlyphType.LOWER_ROMAN },+ { glyphFormat: '%7.', glyphType: ListGlyphType.DECIMAL_ZERO },+ { glyphFormat: '%8.', glyphType: ListGlyphType.LOWER_LETTER },+ { glyphFormat: '%9.', glyphType: ListGlyphType.LOWER_ROMAN },]),} as IListData,@@ -260,7 +260,7 @@ export const PRESET_LIST_TYPE: Record<string, IListData> = {} as IListData,};-const generateOrderList = (opt: { glyphFormat: string; glyphType: GlyphType }) => {+const generateOrderList = (opt: { glyphFormat: string; glyphType: ListGlyphType }) => {const { glyphFormat, glyphType } = opt;const data = Tools.deepClone(PRESET_LIST_TYPE[PresetListType.ORDER_LIST]);diff --git a/packages/core/src/types/interfaces/i-document-data.ts b/packages/core/src/types/interfaces/i-document-data.tsindex 374030c1bf..82924e08c1 100644--- a/packages/core/src/types/interfaces/i-document-data.ts+++ b/packages/core/src/types/interfaces/i-document-data.ts@@ -197,7 +197,7 @@ export interface INestingLevel {startNumber: number;// Union field glyph_kind can be only one of the following:- glyphType?: GlyphType; // ordered list string is to support custom rules https://developers.google.com/docs/api/reference/rest/v1/documents#glyphtype, ms numFmt: GlyphType+ glyphType?: ListGlyphType; // ordered list string is to support custom rules https://developers.google.com/docs/api/reference/rest/v1/documents#glyphtype, ms numFmt: GlyphTypeglyphSymbol?: string; // the tag of the unordered list// End of list of possible types for union field glyph_kind.}@@ -214,7 +214,7 @@ export enum FollowNumberWithType {/*** An enumeration of the supported glyph types.*/-export enum GlyphType {+export enum ListGlyphType {BULLET, // The glyph type is unspecified or unsupported.NONE, // An empty string.DECIMAL, // A number, like 1, 2, or 3.diff --git a/packages/engine-render/src/components/docs/layout/block/paragraph/bullet-ruler.ts b/packages/engine-render/src/components/docs/layout/block/paragraph/bullet-ruler.tsindex 3c604c165f..cd2ee1dab7 100644--- a/packages/engine-render/src/components/docs/layout/block/paragraph/bullet-ruler.ts+++ b/packages/engine-render/src/components/docs/layout/block/paragraph/bullet-ruler.ts@@ -14,34 +14,34 @@* limitations under the License.*/-import { GlyphType, numberToListABC } from '@univerjs/core';+import { ListGlyphType, numberToListABC } from '@univerjs/core';-export function getBulletOrderedSymbol(startIndex: number, startNumber: number, glyphType: GlyphType | string) {+export function getBulletOrderedSymbol(startIndex: number, startNumber: number, glyphType: ListGlyphType | string) {// if (!(glyphType in GlyphType)) {// return dealWidthCustomBulletOrderedSymbol(startIndex, startNumber, glyphType as string); // 插件定义更多类型的bullet// }- return generateOrderedSymbol(startIndex, startNumber, glyphType as GlyphType);+ return generateOrderedSymbol(startIndex, startNumber, glyphType as ListGlyphType);}-function generateOrderedSymbol(startIndex: number, startNumber: number, glyphType: GlyphType) {+function generateOrderedSymbol(startIndex: number, startNumber: number, glyphType: ListGlyphType) {// startIndex从0开始,startNumber为用户输入默认是1- if (glyphType === GlyphType.DECIMAL) {+ if (glyphType === ListGlyphType.DECIMAL) {return decimal(startIndex, startNumber);}- if (glyphType === GlyphType.DECIMAL_ZERO) {+ if (glyphType === ListGlyphType.DECIMAL_ZERO) {return zeroDecimal(startIndex, startNumber);}- if (glyphType === GlyphType.UPPER_LETTER) {+ if (glyphType === ListGlyphType.UPPER_LETTER) {return upperAlpha(startIndex, startNumber);}- if (glyphType === GlyphType.LOWER_LETTER) {+ if (glyphType === ListGlyphType.LOWER_LETTER) {return alpha(startIndex, startNumber);}- if (glyphType === GlyphType.UPPER_ROMAN) {+ if (glyphType === ListGlyphType.UPPER_ROMAN) {return upperRoman(startIndex, startNumber);}- if (glyphType === GlyphType.LOWER_ROMAN) {+ if (glyphType === ListGlyphType.LOWER_ROMAN) {return roman(startIndex, startNumber);}diff --git a/packages/engine-render/src/components/docs/layout/model/glyph.ts b/packages/engine-render/src/components/docs/layout/model/glyph.tsindex 25a76ece95..edc2bebb5d 100644--- a/packages/engine-render/src/components/docs/layout/model/glyph.ts+++ b/packages/engine-render/src/components/docs/layout/model/glyph.ts@@ -14,12 +14,6 @@* limitations under the License.*/-import { BooleanNumber, BulletAlignment, DataStreamTreeTokenType as DT, GridType } from '@univerjs/core';--import { GlyphType } from '../../../../basics/i-document-skeleton-cached';-import { hasCJK, hasCJKText, isCjkCenterAlignedPunctuation, isCjkLeftAlignedPunctuation, isCjkRightAlignedPunctuation, ptToPixel } from '../../../../basics/tools';-import { FontCache } from '../shaping-engine/font-cache';-import { validationGrid } from '../tools';import type {IAdjustability,IDocumentSkeletonBoundingBox,@@ -27,8 +21,14 @@ import type {IDocumentSkeletonDivide,IDocumentSkeletonGlyph,} from '../../../../basics/i-document-skeleton-cached';+import type { IFontCreateConfig } from '../../../../basics/interfaces';import type { IOpenTypeGlyphInfo } from '../shaping-engine/text-shaping';+import { BooleanNumber, BulletAlignment, DataStreamTreeTokenType as DT, GridType } from '@univerjs/core';+import { GlyphType } from '../../../../basics/i-document-skeleton-cached';+import { hasCJK, hasCJKText, isCjkCenterAlignedPunctuation, isCjkLeftAlignedPunctuation, isCjkRightAlignedPunctuation, ptToPixel } from '../../../../basics/tools';+import { FontCache } from '../shaping-engine/font-cache';+import { validationGrid } from '../tools';export function isSpace(char: string) {const SPACE_CHARS = [' ', '\u{00A0}', ' '];