@visactor/vrender-components 1.1.4-alpha.1 → 1.1.5
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/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +15 -7
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/legend/discrete/type.d.ts +1 -0
- package/cjs/legend/discrete/type.js.map +1 -1
- package/dist/index.es.js +29 -6
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/legend/discrete/discrete.js +15 -7
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/legend/discrete/type.d.ts +1 -0
- package/es/legend/discrete/type.js.map +1 -1
- package/package.json +4 -4
|
@@ -13,6 +13,7 @@ export interface LegendSwitchComponentAttributes {
|
|
|
13
13
|
}
|
|
14
14
|
export type LegendPagerAttributes = Omit<PagerAttributes, 'total'> & LegendSwitchComponentAttributes & {
|
|
15
15
|
position?: 'start' | 'middle' | 'end';
|
|
16
|
+
hugContent?: boolean;
|
|
16
17
|
};
|
|
17
18
|
export type LegendScrollbarAttributes = Omit<ScrollBarAttributes, 'range' | 'limitRange'> & LegendSwitchComponentAttributes & {
|
|
18
19
|
type: 'scrollbar';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/legend/discrete/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n EasingType,\n IGroupGraphicAttribute,\n ILinearGradient,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { BaseGraphicAttributes, Padding } from '../../core/type';\nimport type { PagerAttributes } from '../../pager/type';\nimport type { LegendBaseAttributes } from '../type';\nimport type { ScrollBarAttributes } from '../../scrollbar/type';\nimport type { GraphicEventType } from '@visactor/vrender-core';\n\nexport interface LegendSwitchComponentAttributes {\n /**\n * 翻页组件同图例内容项之间的间距\n */\n space?: number;\n /**\n * the default page\n */\n defaultCurrent?: number;\n /**\n * 翻页是否开启动画\n */\n animation?: boolean;\n /**\n * 动画执行时间\n */\n animationDuration?: number;\n /**\n * 动画执行效果\n */\n animationEasing?: EasingType;\n}\n\n/**\n * 离散类型的图例组件,当图例项较多的时候,默认使用分页器组件\n */\nexport type LegendPagerAttributes = Omit<PagerAttributes, 'total'> &\n LegendSwitchComponentAttributes & {\n /**\n * 分页器的显示位置,默认 'middle'\n * @default 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n };\n\n/**\n * 离散类型的图例组件使用滚动条组件的时候对应的配置\n */\nexport type LegendScrollbarAttributes = Omit<ScrollBarAttributes, 'range' | 'limitRange'> &\n LegendSwitchComponentAttributes & {\n /**\n * 将翻页器的类型设置为 'scrollbar'\n * 申明图例组件使用滚动条进行翻页展示更多的图例项\n */\n type: 'scrollbar';\n /**\n * @deprecated since 0.20.13\n * 滚动条的位置是否支持展示在分页的中间。\n * 0.20.13 版本改造了滚动条逻辑后,此配置废弃。改造内容:\n * 由分页拟合的滚动调整为滚动窗口的逻辑,不再与分页绑定\n */\n scrollByPosition?: boolean;\n /**\n * 是否支持鼠标/触控板滚动\n * @default false\n */\n roamScroll?: boolean;\n /**\n * @since 0.20.13\n * 是否隐藏滚动条\n */\n visible?: boolean;\n /**\n * @since 0.20.13\n * 滚动时,图例区域未到尽头时的前后遮罩\n */\n scrollMask?: {\n /** 是否显示 @default false */\n visible?: boolean;\n /** 渐变区域长度 @default 16 */\n gradientLength?: number;\n /** 渐变配置 */\n gradientStops: ILinearGradient['stops'];\n };\n };\n\nexport type LegendItemDatum = {\n /**\n * 该条数据的唯一标识,可用于动画或者查找\n */\n id?: string;\n /** 显示文本 */\n label: string;\n /** 显示数据 */\n value?: string | number;\n /** 图例项前的 shape 形状定义 */\n shape: {\n symbolType?: string;\n fill?: string;\n stroke?: string;\n };\n [key: string]: any;\n};\n\nexport type StyleCallback<T> = (\n item: LegendItemDatum,\n isSelected: boolean,\n index: number,\n allItems: LegendItemDatum[]\n) => T;\n\nexport type formatterCallback = (text: string | number, item: LegendItemDatum, index: number) => any;\n\nexport type LegendItem = {\n /**\n * 是否展示图例项\n * @default true\n */\n visible?: boolean;\n /**\n * 图例项的列间距 水平间距\n */\n spaceCol?: number;\n /**\n * 图例项的行间距 垂直间距\n */\n spaceRow?: number;\n /**\n * 图例项的最大宽度,默认为 null,由上层传入\n */\n maxWidth?: number;\n /**\n * 图例项的宽度, 默认自动计算\n */\n width?: number;\n /**\n * 图例的高度,默认自动计算\n */\n height?: number;\n /**\n * 图例项自身的内边距\n */\n padding?: Padding;\n /**\n * 图例项背景配置\n */\n background?: {\n visible?: boolean;\n } & BaseGraphicAttributes<Partial<IGroupGraphicAttribute> | StyleCallback<Partial<IGroupGraphicAttribute>>>;\n /**\n * 图例项的 shape 图标的配置\n */\n shape?: {\n visible?: boolean;\n /** shape 同后面 label 的间距 */\n space?: number;\n } & BaseGraphicAttributes<Partial<ISymbolGraphicAttribute> | StyleCallback<Partial<ISymbolGraphicAttribute>>>;\n\n /**\n * 当label+ value同时存在的时候,自动省略的策略\n * 'labelFirst' - 尽量保证完整展示`label`\n * 'valueFirst' - 尽量保证完整展示`value`\n * 'none' - 按照`widthRatio`展示label 和 value\n */\n autoEllipsisStrategy?: 'labelFirst' | 'valueFirst' | 'none';\n\n /**\n * 图例项的 label 文本配置\n */\n label?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /**\n * 图例项 label 同后面 value 的间距\n */\n space?: number;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 图例项 value 配置\n */\n value?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /** value 同后面元素的间距 */\n space?: number;\n /**\n * 是否右对齐显示,仅当设置图例项宽度 itemWidth 时生效\n * 默认为 false,\n */\n alignRight?: boolean;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 是否开启聚焦功能,默认关闭\n */\n focus?: boolean;\n /**\n * 聚焦按钮配置\n */\n focusIconStyle?: Partial<ISymbolGraphicAttribute>;\n /**\n * 指定图例项中图标和文字的摆放位置,可选值为:\n * 'left' 图标在左侧\n * 'right' 图标在右侧\n */\n align?: 'left' | 'right';\n /**\n * 水平方向时,一行中多个图例的垂直对齐方式\n * @since 0.21.3\n */\n verticalAlign?: 'top' | 'middle' | 'bottom';\n};\n\nexport type DiscreteLegendAttrs = {\n /**\n * 是否开启选中交互\n */\n select?:\n | boolean\n | {\n /**\n * 触发选中交互的事件类型\n * @since 0.20.13\n **/\n trigger?: GraphicEventType;\n };\n\n /**\n * 是否开启 hover 交互\n */\n hover?:\n | boolean\n | {\n /**\n * 触发hover交互的事件类型\n * @since 0.20.13\n **/\n trigger?: GraphicEventType;\n /**\n * 触发取消hover交互的事件类型\n * @since 0.20.13\n **/\n triggerOff?: GraphicEventType;\n };\n /**\n * 图例数据\n */\n items: LegendItemDatum[];\n /**\n * 默认选中的图例项\n */\n defaultSelected?: (string | number)[];\n /**\n * 单选/多选模式配置,默认 'multiple'。\n * - `single` 表示单选\n * - `multiple` 表示多选\n * - `focus` 表示聚焦模式 (自 0.19.2版本开始支持)\n */\n selectMode?: 'single' | 'multiple' | 'focus';\n /**\n * 是否允许图例全部取消,多选模式下生效\n */\n allowAllCanceled?: boolean;\n /**\n * 图例项的顺序是否要逆序,默认为 false\n */\n reversed?: boolean;\n /**\n * 图例项相关的配置\n */\n item?: LegendItem;\n /**\n * 最大宽度,决定 layout : 'horizontal' 是否自动换行\n */\n maxWidth?: number;\n /**\n * 最大高度,决定是否分页\n */\n maxHeight?: number;\n /**\n * 最大行数,当且仅当 layout 为 'horizontal' 时生效\n */\n maxRow?: number;\n /**\n * 最大列数,当且仅当 layout 为 'vertical' 时生效\n */\n maxCol?: number;\n /**\n * 延迟渲染,按需渲染图例项目\n */\n lazyload?: boolean;\n /**\n * 是否进行自动分页,默认为 true\n */\n autoPage?: boolean;\n /**\n * 翻页器配置\n */\n pager?: LegendPagerAttributes | LegendScrollbarAttributes;\n} & LegendBaseAttributes;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/legend/discrete/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n EasingType,\n IGroupGraphicAttribute,\n ILinearGradient,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { BaseGraphicAttributes, Padding } from '../../core/type';\nimport type { PagerAttributes } from '../../pager/type';\nimport type { LegendBaseAttributes } from '../type';\nimport type { ScrollBarAttributes } from '../../scrollbar/type';\nimport type { GraphicEventType } from '@visactor/vrender-core';\n\nexport interface LegendSwitchComponentAttributes {\n /**\n * 翻页组件同图例内容项之间的间距\n */\n space?: number;\n /**\n * the default page\n */\n defaultCurrent?: number;\n /**\n * 翻页是否开启动画\n */\n animation?: boolean;\n /**\n * 动画执行时间\n */\n animationDuration?: number;\n /**\n * 动画执行效果\n */\n animationEasing?: EasingType;\n}\n\n/**\n * 离散类型的图例组件,当图例项较多的时候,默认使用分页器组件\n */\nexport type LegendPagerAttributes = Omit<PagerAttributes, 'total'> &\n LegendSwitchComponentAttributes & {\n /**\n * 分页器的显示位置,默认 'middle'\n * @default 'middle'\n */\n position?: 'start' | 'middle' | 'end';\n /**\n * 是否让分页器紧贴图例内容排布。默认 false,分页器固定在图例可用空间的末端,\n * 图例项与分页器呈两端对齐;开启后分页器紧跟最后一个图例项(间距为 `space`),\n * 同时分页裁剪视口收缩到实际内容尺寸,使「图例项 + 分页器」的包围盒随内容\n * 自适应,便于外部布局把整块内容居中放置。\n * @default false\n */\n hugContent?: boolean;\n };\n\n/**\n * 离散类型的图例组件使用滚动条组件的时候对应的配置\n */\nexport type LegendScrollbarAttributes = Omit<ScrollBarAttributes, 'range' | 'limitRange'> &\n LegendSwitchComponentAttributes & {\n /**\n * 将翻页器的类型设置为 'scrollbar'\n * 申明图例组件使用滚动条进行翻页展示更多的图例项\n */\n type: 'scrollbar';\n /**\n * @deprecated since 0.20.13\n * 滚动条的位置是否支持展示在分页的中间。\n * 0.20.13 版本改造了滚动条逻辑后,此配置废弃。改造内容:\n * 由分页拟合的滚动调整为滚动窗口的逻辑,不再与分页绑定\n */\n scrollByPosition?: boolean;\n /**\n * 是否支持鼠标/触控板滚动\n * @default false\n */\n roamScroll?: boolean;\n /**\n * @since 0.20.13\n * 是否隐藏滚动条\n */\n visible?: boolean;\n /**\n * @since 0.20.13\n * 滚动时,图例区域未到尽头时的前后遮罩\n */\n scrollMask?: {\n /** 是否显示 @default false */\n visible?: boolean;\n /** 渐变区域长度 @default 16 */\n gradientLength?: number;\n /** 渐变配置 */\n gradientStops: ILinearGradient['stops'];\n };\n };\n\nexport type LegendItemDatum = {\n /**\n * 该条数据的唯一标识,可用于动画或者查找\n */\n id?: string;\n /** 显示文本 */\n label: string;\n /** 显示数据 */\n value?: string | number;\n /** 图例项前的 shape 形状定义 */\n shape: {\n symbolType?: string;\n fill?: string;\n stroke?: string;\n };\n [key: string]: any;\n};\n\nexport type StyleCallback<T> = (\n item: LegendItemDatum,\n isSelected: boolean,\n index: number,\n allItems: LegendItemDatum[]\n) => T;\n\nexport type formatterCallback = (text: string | number, item: LegendItemDatum, index: number) => any;\n\nexport type LegendItem = {\n /**\n * 是否展示图例项\n * @default true\n */\n visible?: boolean;\n /**\n * 图例项的列间距 水平间距\n */\n spaceCol?: number;\n /**\n * 图例项的行间距 垂直间距\n */\n spaceRow?: number;\n /**\n * 图例项的最大宽度,默认为 null,由上层传入\n */\n maxWidth?: number;\n /**\n * 图例项的宽度, 默认自动计算\n */\n width?: number;\n /**\n * 图例的高度,默认自动计算\n */\n height?: number;\n /**\n * 图例项自身的内边距\n */\n padding?: Padding;\n /**\n * 图例项背景配置\n */\n background?: {\n visible?: boolean;\n } & BaseGraphicAttributes<Partial<IGroupGraphicAttribute> | StyleCallback<Partial<IGroupGraphicAttribute>>>;\n /**\n * 图例项的 shape 图标的配置\n */\n shape?: {\n visible?: boolean;\n /** shape 同后面 label 的间距 */\n space?: number;\n } & BaseGraphicAttributes<Partial<ISymbolGraphicAttribute> | StyleCallback<Partial<ISymbolGraphicAttribute>>>;\n\n /**\n * 当label+ value同时存在的时候,自动省略的策略\n * 'labelFirst' - 尽量保证完整展示`label`\n * 'valueFirst' - 尽量保证完整展示`value`\n * 'none' - 按照`widthRatio`展示label 和 value\n */\n autoEllipsisStrategy?: 'labelFirst' | 'valueFirst' | 'none';\n\n /**\n * 图例项的 label 文本配置\n */\n label?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /**\n * 图例项 label 同后面 value 的间距\n */\n space?: number;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 图例项 value 配置\n */\n value?: {\n /**\n * 当 label + value 同时展示,切超长的时候,label的宽度占比\n */\n widthRatio?: number;\n /** value 同后面元素的间距 */\n space?: number;\n /**\n * 是否右对齐显示,仅当设置图例项宽度 itemWidth 时生效\n * 默认为 false,\n */\n alignRight?: boolean;\n /**\n * 格式化文本函数\n */\n formatMethod?: formatterCallback;\n } & BaseGraphicAttributes<Partial<ITextGraphicAttribute> | StyleCallback<Partial<ITextGraphicAttribute>>>;\n /**\n * 是否开启聚焦功能,默认关闭\n */\n focus?: boolean;\n /**\n * 聚焦按钮配置\n */\n focusIconStyle?: Partial<ISymbolGraphicAttribute>;\n /**\n * 指定图例项中图标和文字的摆放位置,可选值为:\n * 'left' 图标在左侧\n * 'right' 图标在右侧\n */\n align?: 'left' | 'right';\n /**\n * 水平方向时,一行中多个图例的垂直对齐方式\n * @since 0.21.3\n */\n verticalAlign?: 'top' | 'middle' | 'bottom';\n};\n\nexport type DiscreteLegendAttrs = {\n /**\n * 是否开启选中交互\n */\n select?:\n | boolean\n | {\n /**\n * 触发选中交互的事件类型\n * @since 0.20.13\n **/\n trigger?: GraphicEventType;\n };\n\n /**\n * 是否开启 hover 交互\n */\n hover?:\n | boolean\n | {\n /**\n * 触发hover交互的事件类型\n * @since 0.20.13\n **/\n trigger?: GraphicEventType;\n /**\n * 触发取消hover交互的事件类型\n * @since 0.20.13\n **/\n triggerOff?: GraphicEventType;\n };\n /**\n * 图例数据\n */\n items: LegendItemDatum[];\n /**\n * 默认选中的图例项\n */\n defaultSelected?: (string | number)[];\n /**\n * 单选/多选模式配置,默认 'multiple'。\n * - `single` 表示单选\n * - `multiple` 表示多选\n * - `focus` 表示聚焦模式 (自 0.19.2版本开始支持)\n */\n selectMode?: 'single' | 'multiple' | 'focus';\n /**\n * 是否允许图例全部取消,多选模式下生效\n */\n allowAllCanceled?: boolean;\n /**\n * 图例项的顺序是否要逆序,默认为 false\n */\n reversed?: boolean;\n /**\n * 图例项相关的配置\n */\n item?: LegendItem;\n /**\n * 最大宽度,决定 layout : 'horizontal' 是否自动换行\n */\n maxWidth?: number;\n /**\n * 最大高度,决定是否分页\n */\n maxHeight?: number;\n /**\n * 最大行数,当且仅当 layout 为 'horizontal' 时生效\n */\n maxRow?: number;\n /**\n * 最大列数,当且仅当 layout 为 'vertical' 时生效\n */\n maxCol?: number;\n /**\n * 延迟渲染,按需渲染图例项目\n */\n lazyload?: boolean;\n /**\n * 是否进行自动分页,默认为 true\n */\n autoPage?: boolean;\n /**\n * 翻页器配置\n */\n pager?: LegendPagerAttributes | LegendScrollbarAttributes;\n} & LegendBaseAttributes;\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -8087,13 +8087,14 @@ function applyFillStyle(ctx, character, b) {
|
|
|
8087
8087
|
}) : fillStyle, setTextStyle(ctx, character);
|
|
8088
8088
|
}
|
|
8089
8089
|
function applyStrokeStyle(ctx, character) {
|
|
8090
|
+
var _a, _b;
|
|
8090
8091
|
const strokeStyle = character && character.stroke || defaultFormatting.stroke;
|
|
8091
8092
|
if (!strokeStyle) return void (ctx.globalAlpha = 0);
|
|
8092
8093
|
const {
|
|
8093
8094
|
strokeOpacity = 1,
|
|
8094
8095
|
opacity = 1
|
|
8095
8096
|
} = character;
|
|
8096
|
-
ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
|
|
8097
|
+
ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.setLineDash(null !== (_a = character.lineDash) && void 0 !== _a ? _a : []), ctx.lineDashOffset = null !== (_b = character.lineDashOffset) && void 0 !== _b ? _b : 0, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
|
|
8097
8098
|
}
|
|
8098
8099
|
function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
|
|
8099
8100
|
if (desc.length <= 1) return 0;
|
|
@@ -30522,9 +30523,12 @@ class DiscreteLegend extends LegendBase {
|
|
|
30522
30523
|
: new ScrollBar(Object.assign(Object.assign({ direction: 'vertical', width: compStyle.visible === false ? 0 : 12, range: [0, 0.5] }, compStyle), { height: compSize, disableTriggerEvent }));
|
|
30523
30524
|
}
|
|
30524
30525
|
_updatePositionOfPager(renderStartY, compWidth, compHeight) {
|
|
30526
|
+
var _a;
|
|
30525
30527
|
const { pager } = this.attribute;
|
|
30526
30528
|
const { totalPage, isHorizontal } = this._itemContext;
|
|
30527
30529
|
const position = (pager && pager.position) || 'middle';
|
|
30530
|
+
const hugContent = !!(pager && pager.hugContent);
|
|
30531
|
+
const pagerSpace = (_a = (pager && pager.space)) !== null && _a !== void 0 ? _a : DEFAULT_PAGER_SPACE;
|
|
30528
30532
|
this._pagerComponent.setTotal(totalPage);
|
|
30529
30533
|
if (isHorizontal) {
|
|
30530
30534
|
let y;
|
|
@@ -30537,8 +30541,12 @@ class DiscreteLegend extends LegendBase {
|
|
|
30537
30541
|
else {
|
|
30538
30542
|
y = renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2;
|
|
30539
30543
|
}
|
|
30544
|
+
let x = compWidth - this._pagerComponent.AABBBounds.width();
|
|
30545
|
+
if (hugContent) {
|
|
30546
|
+
x = Math.max(0, Math.min(this._itemsContainer.AABBBounds.width() + pagerSpace, x));
|
|
30547
|
+
}
|
|
30540
30548
|
this._pagerComponent.setAttributes({
|
|
30541
|
-
x
|
|
30549
|
+
x,
|
|
30542
30550
|
y
|
|
30543
30551
|
});
|
|
30544
30552
|
}
|
|
@@ -30553,9 +30561,13 @@ class DiscreteLegend extends LegendBase {
|
|
|
30553
30561
|
else {
|
|
30554
30562
|
x = (compWidth - this._pagerComponent.AABBBounds.width()) / 2;
|
|
30555
30563
|
}
|
|
30564
|
+
let y = compHeight - this._pagerComponent.AABBBounds.height();
|
|
30565
|
+
if (hugContent) {
|
|
30566
|
+
y = Math.max(0, Math.min(renderStartY + this._itemsContainer.AABBBounds.height() + pagerSpace, y));
|
|
30567
|
+
}
|
|
30556
30568
|
this._pagerComponent.setAttributes({
|
|
30557
30569
|
x,
|
|
30558
|
-
y
|
|
30570
|
+
y
|
|
30559
30571
|
});
|
|
30560
30572
|
}
|
|
30561
30573
|
}
|
|
@@ -30771,11 +30783,22 @@ class DiscreteLegend extends LegendBase {
|
|
|
30771
30783
|
itemsContainer.setAttribute('x', -(defaultCurrent - 1) * (compWidth + spaceCol));
|
|
30772
30784
|
}
|
|
30773
30785
|
}
|
|
30786
|
+
const hugContent = !!pager.hugContent;
|
|
30787
|
+
let clipWidth = isHorizontal ? contentWidth : compWidth;
|
|
30788
|
+
let clipHeight = isHorizontal ? compHeight : contentHeight;
|
|
30789
|
+
if (hugContent) {
|
|
30790
|
+
if (isHorizontal) {
|
|
30791
|
+
clipWidth = Math.max(0, Math.min(clipWidth, itemsContainer.AABBBounds.width()));
|
|
30792
|
+
}
|
|
30793
|
+
else {
|
|
30794
|
+
clipHeight = Math.max(0, Math.min(clipHeight, itemsContainer.AABBBounds.height()));
|
|
30795
|
+
}
|
|
30796
|
+
}
|
|
30774
30797
|
const clipGroup = graphicCreator.group({
|
|
30775
30798
|
x: 0,
|
|
30776
30799
|
y: renderStartY,
|
|
30777
|
-
width:
|
|
30778
|
-
height:
|
|
30800
|
+
width: clipWidth,
|
|
30801
|
+
height: clipHeight,
|
|
30779
30802
|
clip: true,
|
|
30780
30803
|
pickable: false
|
|
30781
30804
|
});
|
|
@@ -36601,6 +36624,6 @@ TableSeriesNumber.defaultAttributes = {
|
|
|
36601
36624
|
select: true
|
|
36602
36625
|
};
|
|
36603
36626
|
|
|
36604
|
-
const version = "1.1.
|
|
36627
|
+
const version = "1.1.5";
|
|
36605
36628
|
|
|
36606
36629
|
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, IDataZoomEvent, IDataZoomInteractiveEvent, 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, SeriesNumberCellStateValue, SeriesNumberEvent, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, TableSeriesNumber, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, 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, installPoptipToApp, installScrollbarToApp, 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, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,G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AgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"1.1.5\";\n\nexport * from './core/base';\nexport { AbstractComponent } from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport { ScrollBar } from './scrollbar/scrollbar';\nexport { loadScrollbar } from './scrollbar/module';\nexport * from './tag';\nexport * from './poptip';\nexport { loadPoptip } from './poptip/module';\nexport * from './crosshair';\nexport { LineCrosshair } from './crosshair/line';\nexport { CircleCrosshair } from './crosshair/circle';\nexport { SectorCrosshair } from './crosshair/sector';\nexport { PolygonCrosshair } from './crosshair/polygon';\nexport * from './label';\nexport { DataLabel } from './label/dataLabel';\nexport { registerSymbolDataLabel } from './label/symbol';\nexport * from './axis';\nexport { LineAxis } from './axis/line';\nexport { CircleAxis } from './axis/circle';\nexport { continuousTicks } from './axis/tick-data/continuous';\nexport { polarAngleAxisDiscreteTicks } from './axis/tick-data/discrete/polar-angle';\nexport * from './axis/grid';\nexport { LineAxisGrid } from './axis/grid/line';\nexport { CircleAxisGrid } from './axis/grid/circle';\nexport * from './segment';\nexport { Segment } from './segment/segment';\nexport * from './data-zoom';\nexport { DataZoom } from './data-zoom/data-zoom';\nexport * from './marker';\nexport { MarkLine, registerMarkLineAnimate } from './marker/line';\nexport { MarkArea, registerMarkAreaAnimate } from './marker/area';\nexport { MarkArcLine, registerMarkArcLineAnimate } from './marker/arc-line';\nexport { MarkArcArea, registerMarkArcAreaAnimate } from './marker/arc-area';\nexport { MarkPoint, registerMarkPointAnimate } from './marker/point';\nexport * from './pager';\nexport * from './legend';\nexport { ColorContinuousLegend } from './legend/color/color';\nexport { SizeContinuousLegend } from './legend/size/size';\nexport * from './title';\nexport { Title } from './title/title';\nexport * from './indicator';\nexport { Indicator } from './indicator/indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport { DiscretePlayer } from './player/discrete-player';\nexport { ContinuousPlayer } from './player/continuous-player';\nexport { PlayerEventEnum } from './player/type/event';\nexport * from './brush';\nexport { Brush } from './brush/brush';\nexport { IOperateType } from './brush/type';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport { labelSmartInvert } from './util/label-smartInvert';\nexport * from './switch';\nexport * from './label-item';\nexport * from './table-series-number';\n"]}
|
|
@@ -342,20 +342,25 @@ export class DiscreteLegend extends LegendBase {
|
|
|
342
342
|
}));
|
|
343
343
|
}
|
|
344
344
|
_updatePositionOfPager(renderStartY, compWidth, compHeight) {
|
|
345
|
-
|
|
345
|
+
var _a;
|
|
346
|
+
const {pager: pager} = this.attribute, {totalPage: totalPage, isHorizontal: isHorizontal} = this._itemContext, position = pager && pager.position || "middle", hugContent = !(!pager || !pager.hugContent), pagerSpace = null !== (_a = pager && pager.space) && void 0 !== _a ? _a : DEFAULT_PAGER_SPACE;
|
|
346
347
|
if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
|
|
347
348
|
let y;
|
|
348
|
-
y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2
|
|
349
|
+
y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2;
|
|
350
|
+
let x = compWidth - this._pagerComponent.AABBBounds.width();
|
|
351
|
+
hugContent && (x = Math.max(0, Math.min(this._itemsContainer.AABBBounds.width() + pagerSpace, x))),
|
|
349
352
|
this._pagerComponent.setAttributes({
|
|
350
|
-
x:
|
|
353
|
+
x: x,
|
|
351
354
|
y: y
|
|
352
355
|
});
|
|
353
356
|
} else {
|
|
354
357
|
let x;
|
|
355
|
-
x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2
|
|
358
|
+
x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2;
|
|
359
|
+
let y = compHeight - this._pagerComponent.AABBBounds.height();
|
|
360
|
+
hugContent && (y = Math.max(0, Math.min(renderStartY + this._itemsContainer.AABBBounds.height() + pagerSpace, y))),
|
|
356
361
|
this._pagerComponent.setAttributes({
|
|
357
362
|
x: x,
|
|
358
|
-
y:
|
|
363
|
+
y: y
|
|
359
364
|
});
|
|
360
365
|
}
|
|
361
366
|
}
|
|
@@ -459,11 +464,14 @@ export class DiscreteLegend extends LegendBase {
|
|
|
459
464
|
this._itemContext.totalPage = total, this._updatePositionOfPager(renderStartY, compWidth, compHeight);
|
|
460
465
|
}
|
|
461
466
|
defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compHeight + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compWidth + spaceCol)));
|
|
467
|
+
const hugContent = !!pager.hugContent;
|
|
468
|
+
let clipWidth = isHorizontal ? contentWidth : compWidth, clipHeight = isHorizontal ? compHeight : contentHeight;
|
|
469
|
+
hugContent && (isHorizontal ? clipWidth = Math.max(0, Math.min(clipWidth, itemsContainer.AABBBounds.width())) : clipHeight = Math.max(0, Math.min(clipHeight, itemsContainer.AABBBounds.height())));
|
|
462
470
|
const clipGroup = graphicCreator.group({
|
|
463
471
|
x: 0,
|
|
464
472
|
y: renderStartY,
|
|
465
|
-
width:
|
|
466
|
-
height:
|
|
473
|
+
width: clipWidth,
|
|
474
|
+
height: clipHeight,
|
|
467
475
|
clip: !0,
|
|
468
476
|
pickable: !1
|
|
469
477
|
});
|