@visactor/vrender-components 0.21.7 → 0.21.8

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/title/title.ts"],"names":[],"mappings":";;;AAIA,6CAA6E;AAC7E,uCAAiD;AAGjD,0CAAqD;AACrD,yCAAgD;AAEhD,IAAA,6BAAkB,GAAE,CAAC;AACrB,MAAa,KAAM,SAAQ,wBAAuC;IAyBhE,YAAY,UAAsB,EAAE,OAA0B;QAC5D,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,KAAK,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAzB5F,SAAI,GAAG,OAAO,CAAC;IA0Bf,CAAC;IAES,MAAM;;QACd,MAAM,EACJ,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,SAAS,GAAG,EAAE,EACd,OAAO,EACP,YAAY,GAAG,EAAE,EACjB,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,KAAK,EACL,aAAa,EACb,OAAO,GAAG,CAAC,EACZ,GAAG,IAAI,CAAC,SAAuB,CAAC;QAEjC,MAAM,aAAa,GAAG,IAAA,yBAAgB,EAAC,OAAO,CAAC,CAAC;QAEhD,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CACpC,iBAAiB,EACjB,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EACvD,OAAO,CACE,CAAC;QAEZ,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,KAAK,KAAK,IAAI,SAAS,CAAC,OAAO,KAAK,KAAK,EAAE;YACnE,MAAM,EACJ,KAAK,EAA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,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;CACF,CAAC","file":"title.js","sourcesContent":["/**\n * @description 标题组件\n */\nimport type { IGroup, IText, IRichText, IRichTextCharacter } from '@visactor/vrender-core';\nimport { merge, isValid, normalizePadding, isArray } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { TitleAttrs } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { DEFAULT_HTML_TEXT_SPEC } from '../constant';\nimport { loadTitleComponent } from './register';\n\nloadTitleComponent();\nexport class Title extends AbstractComponent<Required<TitleAttrs>> {\n name = 'title';\n\n private _mainTitle?: IText | IRichText;\n private _subTitle?: IText | IRichText;\n\n static defaultAttributes: Partial<TitleAttrs> = {\n textStyle: {\n ellipsis: '...',\n fill: '#333',\n fontSize: 20,\n fontWeight: 'bold',\n textAlign: 'left',\n textBaseline: 'top'\n },\n subtextStyle: {\n ellipsis: '...',\n fill: '#6F6F6F',\n fontSize: 16,\n fontWeight: 'normal',\n textAlign: 'left',\n textBaseline: 'top'\n }\n };\n\n constructor(attributes: TitleAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Title.defaultAttributes, attributes));\n }\n\n protected render() {\n const {\n textType,\n text,\n subtextType,\n textStyle = {},\n subtext,\n subtextStyle = {},\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n align,\n verticalAlign,\n padding = 0\n } = this.attribute as TitleAttrs;\n\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild(\n 'title-container',\n { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 },\n 'group'\n ) as IGroup;\n\n if (this.attribute.visible !== false && textStyle.visible !== false) {\n const {\n width: mainTitleWidth,\n height: mainTitleHeight,\n maxHeight: mainTitleMaxHeight,\n maxWidth: mainTitleMaxWidth,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n maxWidth,\n lineClamp\n } = textStyle;\n if (textType === 'rich' || isValid(textStyle.character)) {\n const attr = {\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: mainTitleHeight ?? height ?? 0,\n ellipsis: ellipsis ?? true,\n wordBreak: wordBreak ?? 'break-word',\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: textStyle.character ?? (text as IRichTextCharacter[]),\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (textType === 'html') {\n const attr = {\n html: {\n dom: text as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...textStyle\n },\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: mainTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (isValid(text)) {\n this._mainTitle = group.createOrUpdateChild(\n 'mainTitle',\n {\n text: isArray(text) ? (text as any) : [text as string],\n whiteSpace: 'normal',\n ...textStyle,\n maxLineWidth: textStyle.maxLineWidth ?? mainTitleWidth ?? width,\n heightLimit: mainTitleHeight ?? maxHeight,\n lineClamp,\n ellipsis,\n x,\n y\n },\n 'text'\n ) as IText;\n }\n }\n\n const maintextHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;\n const maintextWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;\n\n // 目前 height 限制等于 0 时,相当于 Infinity,无限制\n\n if (this.attribute.visible !== false && subtextStyle.visible !== false) {\n const {\n width: subTitleWidth,\n height: subTitleHeight,\n maxWidth: subTitleMaxWidth,\n maxHeight: subTitleMaxHeight,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n lineClamp\n } = subtextStyle;\n const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - maintextHeight);\n\n if (subtextType === 'rich' || isValid(subtextStyle.character)) {\n const attr: any = {\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: subtextStyle.character ?? (subtext as IRichTextCharacter[]),\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (subtextType === 'html') {\n const attr: any = {\n html: {\n dom: subtext as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...subtextStyle\n },\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (isValid(subtext)) {\n this._subTitle = group.createOrUpdateChild(\n 'subTitle',\n {\n text: isArray(subtext) ? (subtext as any) : [subtext as string],\n whiteSpace: 'normal',\n ...subtextStyle,\n maxLineWidth: subtextStyle.maxLineWidth ?? width,\n heightLimit: subtextStyle.heightLimit ?? maxSubTextHeight,\n lineClamp,\n ellipsis,\n x: 0,\n y: maintextHeight\n },\n 'text'\n ) as IText;\n }\n }\n\n const subtextHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;\n const subtextWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;\n\n // 设置宽高\n let titleWidth = Math.max(maintextWidth, subtextWidth);\n let titleHeight = maintextHeight + (subtextStyle.height ?? subtextHeight);\n\n if (isValid(width)) {\n titleWidth = width;\n }\n\n if (isValid(height)) {\n titleHeight = height;\n }\n\n if (isValid(minWidth) && titleWidth < minWidth) {\n titleWidth = minWidth;\n }\n if (isValid(maxWidth)) {\n if (titleWidth > maxWidth) {\n titleWidth = maxWidth;\n }\n }\n\n if (isValid(minHeight) && titleHeight < minHeight) {\n titleHeight = minHeight;\n }\n\n if (isValid(maxHeight)) {\n if (titleHeight > maxHeight) {\n titleHeight = maxHeight;\n }\n }\n group.attribute.width = titleWidth;\n group.attribute.height = titleHeight;\n group.attribute.boundsPadding = parsedPadding;\n\n // 设置对齐\n if (this._mainTitle) {\n if (isValid(align) || isValid(textStyle.align)) {\n const mainTitleAlign = textStyle.align ? textStyle.align : align;\n const mainTitleWidth = textStyle.width ?? maintextWidth;\n if (mainTitleAlign === 'left') {\n this._mainTitle.setAttribute('x', 0);\n this._mainTitle.setAttribute('textAlign', 'left');\n } else if (mainTitleAlign === 'center') {\n this._mainTitle.setAttribute('x', mainTitleWidth / 2);\n this._mainTitle.setAttribute('textAlign', 'center');\n } else if (mainTitleAlign === 'right') {\n this._mainTitle.setAttribute('x', mainTitleWidth);\n this._mainTitle.setAttribute('textAlign', 'right');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;\n const mainTitleHeight = textStyle.height ? textStyle.height : titleHeight;\n if (mainTitleVerticalAlign === 'top') {\n this._mainTitle.setAttribute('y', 0);\n this._mainTitle.setAttribute('textBaseline', 'top');\n } else if (mainTitleVerticalAlign === 'middle') {\n this._mainTitle.setAttribute('y', mainTitleHeight / 2);\n this._mainTitle.setAttribute('textBaseline', 'middle');\n } else if (mainTitleVerticalAlign === 'bottom') {\n this._mainTitle.setAttribute('y', mainTitleHeight);\n this._mainTitle.setAttribute('textBaseline', 'bottom');\n }\n }\n }\n\n if (this._subTitle) {\n if (isValid(align) || isValid(subtextStyle.align)) {\n const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;\n const subTitleWidth = subtextStyle.width ?? subtextWidth;\n if (subTitleAlign === 'left') {\n this._subTitle.setAttribute('x', 0);\n this._subTitle.setAttribute('textAlign', 'left');\n } else if (subTitleAlign === 'center') {\n this._subTitle.setAttribute('x', subTitleWidth / 2);\n this._subTitle.setAttribute('textAlign', 'center');\n } else if (subTitleAlign === 'right') {\n this._subTitle.setAttribute('x', subTitleWidth);\n this._subTitle.setAttribute('textAlign', 'right');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;\n const subTitleYStart = maintextHeight;\n const subTitleHeight = subtextStyle.height ?? 0;\n if (subTitleVerticalAlign === 'top') {\n this._subTitle.setAttribute('y', subTitleYStart);\n this._subTitle.setAttribute('textBaseline', 'top');\n } else if (subTitleVerticalAlign === 'middle') {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);\n this._subTitle.setAttribute('textBaseline', 'middle');\n } else if (subTitleVerticalAlign === 'bottom') {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);\n this._subTitle.setAttribute('textBaseline', 'bottom');\n }\n }\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/title/title.ts"],"names":[],"mappings":";;;AAIA,6CAA6E;AAC7E,uCAAiD;AAGjD,0CAAqD;AACrD,yCAAgD;AAEhD,IAAA,6BAAkB,GAAE,CAAC;AACrB,MAAa,KAAM,SAAQ,wBAAuC;IAyBhE,YAAY,UAAsB,EAAE,OAA0B;QAC5D,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,KAAK,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAzB5F,SAAI,GAAG,OAAO,CAAC;IA0Bf,CAAC;IAES,MAAM;;QACd,MAAM,EACJ,QAAQ,EACR,IAAI,EACJ,WAAW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GAAG,EAAE,cAAc,GAAG,cAAc,GAAG,CAAC,CAAC,CAAC;oBACtE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;iBACvD;qBAAM,IAAI,qBAAqB,KAAK,QAAQ,IAAI,IAAA,gBAAO,EAAC,cAAc,CAAC,EAAE;oBACxE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,cAAc,CAAC,CAAC;oBAClE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;iBACvD;qBAAM;oBACL,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;oBACjD,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;iBACpD;aACF;SACF;IACH,CAAC;;AA9SH,sBA+SC;AAzSQ,uBAAiB,GAAwB;IAC9C,SAAS,EAAE;QACT,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;KACpB;CACF,CAAC","file":"title.js","sourcesContent":["/**\n * @description 标题组件\n */\nimport type { IGroup, IText, IRichText, IRichTextCharacter } from '@visactor/vrender-core';\nimport { merge, isValid, normalizePadding, isArray } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { TitleAttrs } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { DEFAULT_HTML_TEXT_SPEC } from '../constant';\nimport { loadTitleComponent } from './register';\n\nloadTitleComponent();\nexport class Title extends AbstractComponent<Required<TitleAttrs>> {\n name = 'title';\n\n private _mainTitle?: IText | IRichText;\n private _subTitle?: IText | IRichText;\n\n static defaultAttributes: Partial<TitleAttrs> = {\n textStyle: {\n ellipsis: '...',\n fill: '#333',\n fontSize: 20,\n fontWeight: 'bold',\n textAlign: 'left',\n textBaseline: 'top'\n },\n subtextStyle: {\n ellipsis: '...',\n fill: '#6F6F6F',\n fontSize: 16,\n fontWeight: 'normal',\n textAlign: 'left',\n textBaseline: 'top'\n }\n };\n\n constructor(attributes: TitleAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Title.defaultAttributes, attributes));\n }\n\n protected render() {\n const {\n textType,\n text,\n subtextType,\n textStyle = {},\n subtext,\n subtextStyle = {},\n width,\n height,\n minWidth,\n maxWidth,\n minHeight,\n maxHeight,\n align,\n verticalAlign,\n padding = 0\n } = this.attribute as TitleAttrs;\n\n const parsedPadding = normalizePadding(padding);\n\n const group = this.createOrUpdateChild(\n 'title-container',\n { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 },\n 'group'\n ) as IGroup;\n\n const fixedMainTitleHeight = textStyle.height ?? height;\n if (this.attribute.visible !== false && textStyle.visible !== false) {\n const {\n width: mainTitleWidth,\n maxHeight: mainTitleMaxHeight,\n maxWidth: mainTitleMaxWidth,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n maxWidth,\n lineClamp\n } = textStyle;\n if (textType === 'rich' || isValid(textStyle.character)) {\n const attr = {\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: fixedMainTitleHeight ?? 0,\n ellipsis: ellipsis ?? true,\n wordBreak: wordBreak ?? 'break-word',\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: textStyle.character ?? (text as IRichTextCharacter[]),\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (textType === 'html') {\n const attr = {\n html: {\n dom: text as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...textStyle\n },\n x,\n y,\n width: mainTitleWidth ?? width ?? 0,\n height: fixedMainTitleHeight ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: mainTitleMaxHeight ?? maxHeight,\n maxWidth: mainTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...textStyle\n };\n this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext') as IRichText;\n } else if (isValid(text)) {\n this._mainTitle = group.createOrUpdateChild(\n 'mainTitle',\n {\n text: isArray(text) ? (text as any) : [text as string],\n whiteSpace: 'normal',\n ...textStyle,\n maxLineWidth: textStyle.maxLineWidth ?? mainTitleWidth ?? width,\n heightLimit: textStyle.height ?? maxHeight,\n lineClamp,\n ellipsis,\n x,\n y\n },\n 'text'\n ) as IText;\n }\n }\n\n const mainTextBoundsHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;\n const mainTextBoundsWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;\n\n // 目前 height 限制等于 0 时,相当于 Infinity,无限制\n\n if (this.attribute.visible !== false && subtextStyle.visible !== false) {\n const {\n width: subTitleWidth,\n height: subTitleHeight,\n maxWidth: subTitleMaxWidth,\n maxHeight: subTitleMaxHeight,\n x = 0,\n y = 0,\n ellipsis = true,\n wordBreak = 'break-word',\n lineClamp\n } = subtextStyle;\n const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - mainTextBoundsHeight);\n\n if (subtextType === 'rich' || isValid(subtextStyle.character)) {\n const attr: any = {\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n // 兼容旧版富文本配置,如果未设置textType === 'rich',text内容为string 易报错\n textConfig: subtextStyle.character ?? (subtext as IRichTextCharacter[]),\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (subtextType === 'html') {\n const attr: any = {\n html: {\n dom: subtext as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...subtextStyle\n },\n x,\n y,\n width: subTitleWidth ?? width ?? 0,\n height: subTitleHeight ?? height ?? 0,\n ellipsis,\n wordBreak,\n maxHeight: subTitleMaxHeight ?? maxSubTextHeight,\n maxWidth: subTitleMaxWidth ?? maxWidth,\n textConfig: [] as any[],\n ...subtextStyle\n };\n this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext') as IRichText;\n } else if (isValid(subtext)) {\n this._subTitle = group.createOrUpdateChild(\n 'subTitle',\n {\n text: isArray(subtext) ? (subtext as any) : [subtext as string],\n whiteSpace: 'normal',\n ...subtextStyle,\n maxLineWidth: subtextStyle.maxLineWidth ?? width,\n heightLimit: subtextStyle.heightLimit ?? maxSubTextHeight,\n lineClamp,\n ellipsis,\n x: 0,\n y: mainTextBoundsHeight\n },\n 'text'\n ) as IText;\n }\n }\n\n const subTextBoundsHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;\n const subTextBoundsWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;\n\n // 设置宽高\n let totalWidth = Math.max(mainTextBoundsWidth, subTextBoundsWidth);\n let totalHeight = mainTextBoundsHeight + (subtextStyle.height ?? subTextBoundsHeight);\n\n if (isValid(width)) {\n totalWidth = width;\n }\n\n if (isValid(height)) {\n totalHeight = height;\n }\n\n if (isValid(minWidth) && totalWidth < minWidth) {\n totalWidth = minWidth;\n }\n if (isValid(maxWidth)) {\n if (totalWidth > maxWidth) {\n totalWidth = maxWidth;\n }\n }\n\n if (isValid(minHeight) && totalHeight < minHeight) {\n totalHeight = minHeight;\n }\n\n if (isValid(maxHeight)) {\n if (totalHeight > maxHeight) {\n totalHeight = maxHeight;\n }\n }\n\n group.attribute.width = totalWidth;\n group.attribute.height = totalHeight;\n group.attribute.boundsPadding = parsedPadding;\n\n // 设置对齐\n if (this._mainTitle) {\n if (isValid(align) || isValid(textStyle.align)) {\n const mainTitleAlign = textStyle.align ? textStyle.align : align;\n const mainTitleWidth = textStyle.width ?? totalWidth;\n if (mainTitleAlign === 'center') {\n this._mainTitle.setAttribute('x', mainTitleWidth / 2);\n this._mainTitle.setAttribute('textAlign', 'center');\n } else if (mainTitleAlign === 'right') {\n this._mainTitle.setAttribute('x', mainTitleWidth);\n this._mainTitle.setAttribute('textAlign', 'right');\n } else {\n this._mainTitle.setAttribute('x', 0);\n this._mainTitle.setAttribute('textAlign', 'left');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;\n if (mainTitleVerticalAlign === 'middle' && isValid(fixedMainTitleHeight)) {\n this._mainTitle.setAttribute('y', fixedMainTitleHeight / 2);\n this._mainTitle.setAttribute('textBaseline', 'middle');\n } else if (mainTitleVerticalAlign === 'bottom' && isValid(fixedMainTitleHeight)) {\n this._mainTitle.setAttribute('y', fixedMainTitleHeight);\n this._mainTitle.setAttribute('textBaseline', 'bottom');\n } else {\n this._mainTitle.setAttribute('y', 0);\n this._mainTitle.setAttribute('textBaseline', 'top');\n }\n }\n }\n\n if (this._subTitle) {\n if (isValid(align) || isValid(subtextStyle.align)) {\n const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;\n // 当subText没有设置显示的宽度,但是mainText设置了显示的宽度的时候,为mainText为主,因为默认subText要和mainText对齐\n const subTitleWidth = subtextStyle.width ?? textStyle.width ?? totalWidth;\n if (subTitleAlign === 'center') {\n this._subTitle.setAttribute('x', subTitleWidth / 2);\n this._subTitle.setAttribute('textAlign', 'center');\n } else if (subTitleAlign === 'right') {\n this._subTitle.setAttribute('x', subTitleWidth);\n this._subTitle.setAttribute('textAlign', 'right');\n } else {\n this._subTitle.setAttribute('x', 0);\n this._subTitle.setAttribute('textAlign', 'left');\n }\n }\n\n if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {\n const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;\n const subTitleYStart = this._mainTitle\n ? isValid(fixedMainTitleHeight)\n ? // 如果是用户指定的高度,根据bounds的height 和指定高度求最大值\n this._mainTitle.AABBBounds.y1 + Math.max(this._mainTitle.AABBBounds.height(), fixedMainTitleHeight)\n : this._mainTitle.AABBBounds.y2\n : 0;\n const subTitleHeight = subtextStyle.height ?? height;\n if (subTitleVerticalAlign === 'middle' && isValid(subTitleHeight)) {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);\n this._subTitle.setAttribute('textBaseline', 'middle');\n } else if (subTitleVerticalAlign === 'bottom' && isValid(subTitleHeight)) {\n this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);\n this._subTitle.setAttribute('textBaseline', 'bottom');\n } else {\n this._subTitle.setAttribute('y', subTitleYStart);\n this._subTitle.setAttribute('textBaseline', 'top');\n }\n }\n }\n }\n}\n"]}
package/dist/index.es.js CHANGED
@@ -618,6 +618,12 @@ let DefaultGlobal = class {
618
618
  get env() {
619
619
  return this._env;
620
620
  }
621
+ get isImageAnonymous() {
622
+ return this._isImageAnonymous;
623
+ }
624
+ set isImageAnonymous(isImageAnonymous) {
625
+ this._isImageAnonymous = isImageAnonymous;
626
+ }
621
627
  get devicePixelRatio() {
622
628
  return this._env || this.setEnv("browser"), this.envContribution.getDevicePixelRatio();
623
629
  }
@@ -652,7 +658,7 @@ let DefaultGlobal = class {
652
658
  this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
653
659
  }
654
660
  constructor(contributions) {
655
- this.contributions = contributions, this.id = Generator.GenAutoIncrementId(), this.hooks = {
661
+ this.contributions = contributions, this._isImageAnonymous = !0, this.id = Generator.GenAutoIncrementId(), this.hooks = {
656
662
  onSetEnv: new SyncHook(["lastEnv", "env", "global"])
657
663
  }, this.measureTextMethod = "native", this.optimizeVisible = !1;
658
664
  }
@@ -20839,6 +20845,13 @@ class ArcLabel extends LabelBase {
20839
20845
  labelAttribute.maxLineWidth =
20840
20846
  (_c = basedArc.labelLimit) !== null && _c !== void 0 ? _c : labels[i].attribute.maxLineWidth;
20841
20847
  }
20848
+ if (basedArc.refArc && basedArc.refArc.type === 'arc3d') {
20849
+ labelAttribute.anchor3d = [
20850
+ basedArc.circleCenter.x - labelAttribute.x,
20851
+ basedArc.circleCenter.y - labelAttribute.y
20852
+ ];
20853
+ labelAttribute.beta = basedArc.refArc.attribute.beta;
20854
+ }
20842
20855
  labels[i].setAttributes(labelAttribute);
20843
20856
  }
20844
20857
  }
@@ -20868,6 +20881,7 @@ class ArcLabel extends LabelBase {
20868
20881
  const arcMiddle = polarToCartesian(center, graphicAttribute.outerRadius, arcMiddleAngle);
20869
20882
  const outerArcMiddle = polarToCartesian(center, maxRadius + attribute.line.line1MinLength, arcMiddleAngle);
20870
20883
  const arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle, graphicAttribute.innerRadius, graphicAttribute.outerRadius, center);
20884
+ arc.refArc = currentMark;
20871
20885
  arc.pointA = polarToCartesian(center, this.computeDatumRadius(center.x * 2, center.y * 2, graphicAttribute.outerRadius), arc.middleAngle);
20872
20886
  arc.labelSize = {
20873
20887
  width: textBounds.x2 - textBounds.x1,
@@ -21478,6 +21492,13 @@ class ArcLabel extends LabelBase {
21478
21492
  curveType: 'basis'
21479
21493
  });
21480
21494
  }
21495
+ if (baseMark.type === 'arc3d' && baseMark) {
21496
+ const { beta, x, y } = baseMark.attribute;
21497
+ lineGraphic.setAttributes({
21498
+ beta,
21499
+ anchor3d: [x, y]
21500
+ });
21501
+ }
21481
21502
  }
21482
21503
  return lineGraphic;
21483
21504
  }
@@ -27510,35 +27531,36 @@ class Title extends AbstractComponent {
27510
27531
  this.name = 'title';
27511
27532
  }
27512
27533
  render() {
27513
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
27534
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
27514
27535
  const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
27515
27536
  const parsedPadding = normalizePadding(padding);
27516
27537
  const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
27538
+ const fixedMainTitleHeight = (_a = textStyle.height) !== null && _a !== void 0 ? _a : height;
27517
27539
  if (this.attribute.visible !== false && textStyle.visible !== false) {
27518
- const { width: mainTitleWidth, height: mainTitleHeight, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', maxWidth, lineClamp } = textStyle;
27540
+ const { width: mainTitleWidth, maxHeight: mainTitleMaxHeight, maxWidth: mainTitleMaxWidth, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', maxWidth, lineClamp } = textStyle;
27519
27541
  if (textType === 'rich' || isValid(textStyle.character)) {
27520
27542
  const attr = Object.assign({ x,
27521
- y, width: (_a = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _a !== void 0 ? _a : 0, height: (_b = mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : height) !== null && _b !== void 0 ? _b : 0, ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : true, wordBreak: wordBreak !== null && wordBreak !== void 0 ? wordBreak : 'break-word', maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: (_c = textStyle.character) !== null && _c !== void 0 ? _c : text }, textStyle);
27543
+ y, width: (_b = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _b !== void 0 ? _b : 0, height: fixedMainTitleHeight !== null && fixedMainTitleHeight !== void 0 ? fixedMainTitleHeight : 0, ellipsis: ellipsis !== null && ellipsis !== void 0 ? ellipsis : true, wordBreak: wordBreak !== null && wordBreak !== void 0 ? wordBreak : 'break-word', maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: (_c = textStyle.character) !== null && _c !== void 0 ? _c : text }, textStyle);
27522
27544
  this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
27523
27545
  }
27524
27546
  else if (textType === 'html') {
27525
27547
  const attr = Object.assign({ html: Object.assign(Object.assign({ dom: text }, DEFAULT_HTML_TEXT_SPEC), textStyle), x,
27526
- y, width: (_d = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _d !== void 0 ? _d : 0, height: (_e = mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : height) !== null && _e !== void 0 ? _e : 0, ellipsis,
27548
+ y, width: (_d = mainTitleWidth !== null && mainTitleWidth !== void 0 ? mainTitleWidth : width) !== null && _d !== void 0 ? _d : 0, height: fixedMainTitleHeight !== null && fixedMainTitleHeight !== void 0 ? fixedMainTitleHeight : 0, ellipsis,
27527
27549
  wordBreak, maxHeight: mainTitleMaxHeight !== null && mainTitleMaxHeight !== void 0 ? mainTitleMaxHeight : maxHeight, maxWidth: mainTitleMaxWidth !== null && mainTitleMaxWidth !== void 0 ? mainTitleMaxWidth : maxWidth, textConfig: [] }, textStyle);
27528
27550
  this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
27529
27551
  }
27530
27552
  else if (isValid(text)) {
27531
- this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: isArray(text) ? text : [text], whiteSpace: 'normal' }, textStyle), { maxLineWidth: (_g = (_f = textStyle.maxLineWidth) !== null && _f !== void 0 ? _f : mainTitleWidth) !== null && _g !== void 0 ? _g : width, heightLimit: mainTitleHeight !== null && mainTitleHeight !== void 0 ? mainTitleHeight : maxHeight, lineClamp,
27553
+ this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: isArray(text) ? text : [text], whiteSpace: 'normal' }, textStyle), { maxLineWidth: (_f = (_e = textStyle.maxLineWidth) !== null && _e !== void 0 ? _e : mainTitleWidth) !== null && _f !== void 0 ? _f : width, heightLimit: (_g = textStyle.height) !== null && _g !== void 0 ? _g : maxHeight, lineClamp,
27532
27554
  ellipsis,
27533
27555
  x,
27534
27556
  y }), 'text');
27535
27557
  }
27536
27558
  }
27537
- const maintextHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;
27538
- const maintextWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;
27559
+ const mainTextBoundsHeight = this._mainTitle ? this._mainTitle.AABBBounds.height() : 0;
27560
+ const mainTextBoundsWidth = this._mainTitle ? this._mainTitle.AABBBounds.width() : 0;
27539
27561
  if (this.attribute.visible !== false && subtextStyle.visible !== false) {
27540
27562
  const { width: subTitleWidth, height: subTitleHeight, maxWidth: subTitleMaxWidth, maxHeight: subTitleMaxHeight, x = 0, y = 0, ellipsis = true, wordBreak = 'break-word', lineClamp } = subtextStyle;
27541
- const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - maintextHeight);
27563
+ const maxSubTextHeight = Math.max(Number.MIN_VALUE, maxHeight - mainTextBoundsHeight);
27542
27564
  if (subtextType === 'rich' || isValid(subtextStyle.character)) {
27543
27565
  const attr = Object.assign({ x,
27544
27566
  y, width: (_h = subTitleWidth !== null && subTitleWidth !== void 0 ? subTitleWidth : width) !== null && _h !== void 0 ? _h : 0, height: (_j = subTitleHeight !== null && subTitleHeight !== void 0 ? subTitleHeight : height) !== null && _j !== void 0 ? _j : 0, ellipsis,
@@ -27553,47 +27575,43 @@ class Title extends AbstractComponent {
27553
27575
  }
27554
27576
  else if (isValid(subtext)) {
27555
27577
  this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: isArray(subtext) ? subtext : [subtext], whiteSpace: 'normal' }, subtextStyle), { maxLineWidth: (_o = subtextStyle.maxLineWidth) !== null && _o !== void 0 ? _o : width, heightLimit: (_p = subtextStyle.heightLimit) !== null && _p !== void 0 ? _p : maxSubTextHeight, lineClamp,
27556
- ellipsis, x: 0, y: maintextHeight }), 'text');
27578
+ ellipsis, x: 0, y: mainTextBoundsHeight }), 'text');
27557
27579
  }
27558
27580
  }
27559
- const subtextHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;
27560
- const subtextWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
27561
- let titleWidth = Math.max(maintextWidth, subtextWidth);
27562
- let titleHeight = maintextHeight + ((_q = subtextStyle.height) !== null && _q !== void 0 ? _q : subtextHeight);
27581
+ const subTextBoundsHeight = this._subTitle ? this._subTitle.AABBBounds.height() : 0;
27582
+ const subTextBoundsWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
27583
+ let totalWidth = Math.max(mainTextBoundsWidth, subTextBoundsWidth);
27584
+ let totalHeight = mainTextBoundsHeight + ((_q = subtextStyle.height) !== null && _q !== void 0 ? _q : subTextBoundsHeight);
27563
27585
  if (isValid(width)) {
27564
- titleWidth = width;
27586
+ totalWidth = width;
27565
27587
  }
27566
27588
  if (isValid(height)) {
27567
- titleHeight = height;
27589
+ totalHeight = height;
27568
27590
  }
27569
- if (isValid(minWidth) && titleWidth < minWidth) {
27570
- titleWidth = minWidth;
27591
+ if (isValid(minWidth) && totalWidth < minWidth) {
27592
+ totalWidth = minWidth;
27571
27593
  }
27572
27594
  if (isValid(maxWidth)) {
27573
- if (titleWidth > maxWidth) {
27574
- titleWidth = maxWidth;
27595
+ if (totalWidth > maxWidth) {
27596
+ totalWidth = maxWidth;
27575
27597
  }
27576
27598
  }
27577
- if (isValid(minHeight) && titleHeight < minHeight) {
27578
- titleHeight = minHeight;
27599
+ if (isValid(minHeight) && totalHeight < minHeight) {
27600
+ totalHeight = minHeight;
27579
27601
  }
27580
27602
  if (isValid(maxHeight)) {
27581
- if (titleHeight > maxHeight) {
27582
- titleHeight = maxHeight;
27603
+ if (totalHeight > maxHeight) {
27604
+ totalHeight = maxHeight;
27583
27605
  }
27584
27606
  }
27585
- group.attribute.width = titleWidth;
27586
- group.attribute.height = titleHeight;
27607
+ group.attribute.width = totalWidth;
27608
+ group.attribute.height = totalHeight;
27587
27609
  group.attribute.boundsPadding = parsedPadding;
27588
27610
  if (this._mainTitle) {
27589
27611
  if (isValid(align) || isValid(textStyle.align)) {
27590
27612
  const mainTitleAlign = textStyle.align ? textStyle.align : align;
27591
- const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r : maintextWidth;
27592
- if (mainTitleAlign === 'left') {
27593
- this._mainTitle.setAttribute('x', 0);
27594
- this._mainTitle.setAttribute('textAlign', 'left');
27595
- }
27596
- else if (mainTitleAlign === 'center') {
27613
+ const mainTitleWidth = (_r = textStyle.width) !== null && _r !== void 0 ? _r : totalWidth;
27614
+ if (mainTitleAlign === 'center') {
27597
27615
  this._mainTitle.setAttribute('x', mainTitleWidth / 2);
27598
27616
  this._mainTitle.setAttribute('textAlign', 'center');
27599
27617
  }
@@ -27601,33 +27619,32 @@ class Title extends AbstractComponent {
27601
27619
  this._mainTitle.setAttribute('x', mainTitleWidth);
27602
27620
  this._mainTitle.setAttribute('textAlign', 'right');
27603
27621
  }
27622
+ else {
27623
+ this._mainTitle.setAttribute('x', 0);
27624
+ this._mainTitle.setAttribute('textAlign', 'left');
27625
+ }
27604
27626
  }
27605
27627
  if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
27606
27628
  const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;
27607
- const mainTitleHeight = textStyle.height ? textStyle.height : titleHeight;
27608
- if (mainTitleVerticalAlign === 'top') {
27609
- this._mainTitle.setAttribute('y', 0);
27610
- this._mainTitle.setAttribute('textBaseline', 'top');
27611
- }
27612
- else if (mainTitleVerticalAlign === 'middle') {
27613
- this._mainTitle.setAttribute('y', mainTitleHeight / 2);
27629
+ if (mainTitleVerticalAlign === 'middle' && isValid(fixedMainTitleHeight)) {
27630
+ this._mainTitle.setAttribute('y', fixedMainTitleHeight / 2);
27614
27631
  this._mainTitle.setAttribute('textBaseline', 'middle');
27615
27632
  }
27616
- else if (mainTitleVerticalAlign === 'bottom') {
27617
- this._mainTitle.setAttribute('y', mainTitleHeight);
27633
+ else if (mainTitleVerticalAlign === 'bottom' && isValid(fixedMainTitleHeight)) {
27634
+ this._mainTitle.setAttribute('y', fixedMainTitleHeight);
27618
27635
  this._mainTitle.setAttribute('textBaseline', 'bottom');
27619
27636
  }
27637
+ else {
27638
+ this._mainTitle.setAttribute('y', 0);
27639
+ this._mainTitle.setAttribute('textBaseline', 'top');
27640
+ }
27620
27641
  }
27621
27642
  }
27622
27643
  if (this._subTitle) {
27623
27644
  if (isValid(align) || isValid(subtextStyle.align)) {
27624
27645
  const subTitleAlign = subtextStyle.align ? subtextStyle.align : align;
27625
- const subTitleWidth = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : subtextWidth;
27626
- if (subTitleAlign === 'left') {
27627
- this._subTitle.setAttribute('x', 0);
27628
- this._subTitle.setAttribute('textAlign', 'left');
27629
- }
27630
- else if (subTitleAlign === 'center') {
27646
+ const subTitleWidth = (_t = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : textStyle.width) !== null && _t !== void 0 ? _t : totalWidth;
27647
+ if (subTitleAlign === 'center') {
27631
27648
  this._subTitle.setAttribute('x', subTitleWidth / 2);
27632
27649
  this._subTitle.setAttribute('textAlign', 'center');
27633
27650
  }
@@ -27635,23 +27652,32 @@ class Title extends AbstractComponent {
27635
27652
  this._subTitle.setAttribute('x', subTitleWidth);
27636
27653
  this._subTitle.setAttribute('textAlign', 'right');
27637
27654
  }
27655
+ else {
27656
+ this._subTitle.setAttribute('x', 0);
27657
+ this._subTitle.setAttribute('textAlign', 'left');
27658
+ }
27638
27659
  }
27639
27660
  if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
27640
27661
  const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;
27641
- const subTitleYStart = maintextHeight;
27642
- const subTitleHeight = (_t = subtextStyle.height) !== null && _t !== void 0 ? _t : 0;
27643
- if (subTitleVerticalAlign === 'top') {
27644
- this._subTitle.setAttribute('y', subTitleYStart);
27645
- this._subTitle.setAttribute('textBaseline', 'top');
27646
- }
27647
- else if (subTitleVerticalAlign === 'middle') {
27662
+ const subTitleYStart = this._mainTitle
27663
+ ? isValid(fixedMainTitleHeight)
27664
+ ?
27665
+ this._mainTitle.AABBBounds.y1 + Math.max(this._mainTitle.AABBBounds.height(), fixedMainTitleHeight)
27666
+ : this._mainTitle.AABBBounds.y2
27667
+ : 0;
27668
+ const subTitleHeight = (_u = subtextStyle.height) !== null && _u !== void 0 ? _u : height;
27669
+ if (subTitleVerticalAlign === 'middle' && isValid(subTitleHeight)) {
27648
27670
  this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);
27649
27671
  this._subTitle.setAttribute('textBaseline', 'middle');
27650
27672
  }
27651
- else if (subTitleVerticalAlign === 'bottom') {
27673
+ else if (subTitleVerticalAlign === 'bottom' && isValid(subTitleHeight)) {
27652
27674
  this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);
27653
27675
  this._subTitle.setAttribute('textBaseline', 'bottom');
27654
27676
  }
27677
+ else {
27678
+ this._subTitle.setAttribute('y', subTitleYStart);
27679
+ this._subTitle.setAttribute('textBaseline', 'top');
27680
+ }
27655
27681
  }
27656
27682
  }
27657
27683
  }
@@ -30334,6 +30360,6 @@ Switch.defaultAttributes = {
30334
30360
  spaceBetweenTextAndCircle: 6
30335
30361
  };
30336
30362
 
30337
- const version = "0.21.7";
30363
+ const version = "0.21.8";
30338
30364
 
30339
30365
  export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, Switch, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
package/es/axis/util.js CHANGED
@@ -99,5 +99,4 @@ export function hasOverlap(items, pad) {
99
99
  for (let b, i = 1, n = items.length, a = items[0]; i < n; a = b, ++i) if (b = items[i],
100
100
  textIntersect(a, b, pad)) return !0;
101
101
  return !1;
102
- }
103
- //# sourceMappingURL=util.js.map
102
+ }
package/es/brush/type.js CHANGED
@@ -4,4 +4,5 @@ export var IOperateType;
4
4
  IOperateType.drawStart = "drawStart", IOperateType.drawEnd = "drawEnd", IOperateType.drawing = "drawing",
5
5
  IOperateType.moving = "moving", IOperateType.moveStart = "moveStart", IOperateType.moveEnd = "moveEnd",
6
6
  IOperateType.brushClear = "brushClear";
7
- }(IOperateType || (IOperateType = {}));
7
+ }(IOperateType || (IOperateType = {}));
8
+ //# sourceMappingURL=type.js.map
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.21.7";
1
+ export declare const version = "0.21.8";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "0.21.7";
1
+ export const version = "0.21.8";
2
2
 
3
3
  export * from "./core/base";
4
4
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.21.7\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\nexport * from './switch';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.21.8\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\nexport * from './switch';\n"]}
package/es/label/arc.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import type { IAABBBounds, IBoundsLike } from '@visactor/vutils';
2
2
  import { LabelBase } from './base';
3
3
  import type { ArcLabelAttrs, IPoint, Quadrant, BaseLabelAttrs, LabelItem, IArcLabelLineSpec } from './type';
4
+ import type { IArc } from '@visactor/vrender-core';
4
5
  import { type IRichText, type IText, type IGraphic } from '@visactor/vrender-core';
5
6
  import type { ComponentOptions } from '../interface';
6
7
  export declare class ArcInfo {
7
8
  key: string;
8
9
  refDatum: any;
10
+ refArc: IArc;
9
11
  center: IPoint;
10
12
  outerCenter: IPoint;
11
13
  labelSize: {
package/es/label/arc.js CHANGED
@@ -88,7 +88,8 @@ export class ArcLabel extends LabelBase {
88
88
  line: basedArc.labelLine
89
89
  };
90
90
  "richtext" === labels[i].type ? labelAttribute.width = null !== (_b = basedArc.labelLimit) && void 0 !== _b ? _b : labels[i].attribute.width : labelAttribute.maxLineWidth = null !== (_c = basedArc.labelLimit) && void 0 !== _c ? _c : labels[i].attribute.maxLineWidth,
91
- labels[i].setAttributes(labelAttribute);
91
+ basedArc.refArc && "arc3d" === basedArc.refArc.type && (labelAttribute.anchor3d = [ basedArc.circleCenter.x - labelAttribute.x, basedArc.circleCenter.y - labelAttribute.y ],
92
+ labelAttribute.beta = basedArc.refArc.attribute.beta), labels[i].setAttributes(labelAttribute);
92
93
  }
93
94
  }
94
95
  return labels;
@@ -100,7 +101,7 @@ export class ArcLabel extends LabelBase {
100
101
  currentMarks.attribute.outerRadius > maxRadius && (maxRadius = currentMarks.attribute.outerRadius);
101
102
  })), data.forEach(((d, index) => {
102
103
  var _a, _b;
103
- const graphicAttribute = this._idToGraphic.get(d.id).attribute, center = {
104
+ const currentMark = this._idToGraphic.get(d.id), graphicAttribute = currentMark.attribute, center = {
104
105
  x: null !== (_a = null == graphicAttribute ? void 0 : graphicAttribute.x) && void 0 !== _a ? _a : 0,
105
106
  y: null !== (_b = null == graphicAttribute ? void 0 : graphicAttribute.y) && void 0 !== _b ? _b : 0
106
107
  };
@@ -111,7 +112,7 @@ export class ArcLabel extends LabelBase {
111
112
  y1: 0,
112
113
  y2: 0
113
114
  }, arcMiddleAngle = (graphicAttribute.startAngle + graphicAttribute.endAngle) / 2, intervalAngle = graphicAttribute.endAngle - graphicAttribute.startAngle, arcQuadrant = computeQuadrant(graphicAttribute.endAngle - intervalAngle / 2), arcMiddle = polarToCartesian(center, graphicAttribute.outerRadius, arcMiddleAngle), outerArcMiddle = polarToCartesian(center, maxRadius + attribute.line.line1MinLength, arcMiddleAngle), arc = new ArcInfo(item, arcMiddle, outerArcMiddle, arcQuadrant, intervalAngle, arcMiddleAngle, graphicAttribute.innerRadius, graphicAttribute.outerRadius, center);
114
- arc.pointA = polarToCartesian(center, this.computeDatumRadius(2 * center.x, 2 * center.y, graphicAttribute.outerRadius), arc.middleAngle),
115
+ arc.refArc = currentMark, arc.pointA = polarToCartesian(center, this.computeDatumRadius(2 * center.x, 2 * center.y, graphicAttribute.outerRadius), arc.middleAngle),
115
116
  arc.labelSize = {
116
117
  width: textBounds.x2 - textBounds.x1,
117
118
  height: textBounds.y2 - textBounds.y1
@@ -442,12 +443,19 @@ export class ArcLabel extends LabelBase {
442
443
  _createLabelLine(text, baseMark) {
443
444
  var _a, _b, _c, _d, _e;
444
445
  const {line: line = {}, visible: visible} = text.attribute, lineGraphic = super._createLabelLine(text, baseMark);
445
- return lineGraphic && (lineGraphic.setAttributes({
446
+ if (lineGraphic && (lineGraphic.setAttributes({
446
447
  visible: null === (_c = null !== (_a = line.visible && visible) && void 0 !== _a ? _a : null === (_b = text.attribute) || void 0 === _b ? void 0 : _b.visible) || void 0 === _c || _c,
447
448
  lineWidth: null !== (_e = null === (_d = line.style) || void 0 === _d ? void 0 : _d.lineWidth) && void 0 !== _e ? _e : 1
448
449
  }), line.smooth && lineGraphic.setAttributes({
449
450
  curveType: "basis"
450
- })), lineGraphic;
451
+ }), "arc3d" === baseMark.type && baseMark)) {
452
+ const {beta: beta, x: x, y: y} = baseMark.attribute;
453
+ lineGraphic.setAttributes({
454
+ beta: beta,
455
+ anchor3d: [ x, y ]
456
+ });
457
+ }
458
+ return lineGraphic;
451
459
  }
452
460
  computeRadius(r, width, height, k) {
453
461
  return this.computeLayoutRadius(width || 0, height || 0) * r * (isNil(k) ? 1 : k);