@visactor/vrender-components 0.15.3 → 0.15.4

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/legend/discrete/discrete.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,6CAAsH;AAWtH,+CAAuF;AACvF,kCAAqC;AACrC,uCAAoC;AACpC,0CAYqB;AAGrB,MAAM,cAAc,GAAG;IACrB,CAAC,2BAAgB,CAAC,KAAK,CAAC,EAAE,EAAE;IAC5B,CAAC,2BAAgB,CAAC,QAAQ,CAAC,EAAE,EAAE;IAC/B,CAAC,2BAAgB,CAAC,aAAa,CAAC,EAAE,EAAE;IACpC,CAAC,2BAAgB,CAAC,UAAU,CAAC,EAAE,EAAE;IACjC,CAAC,2BAAgB,CAAC,eAAe,CAAC,EAAE,EAAE;CACvC,CAAC;AAEF,MAAa,cAAe,SAAQ,iBAA+B;IAoGjE,YAAY,UAA+B;QACzC,KAAK,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,cAAc,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QApGjE,SAAI,GAAG,gBAAgB,CAAC;QAEhB,oBAAe,GAAkB,IAAI,CAAC;QAEtC,sBAAiB,GAAuB,SAAS,CAAC;QAClD,gBAAW,GAAG,CAAC,CAAC;QAChB,kBAAa,GAAG,CAAC,CAAC;QAomBlB,aAAQ,GAAG,CAAC,CAAwB,EAAE,EAAE;;YAC9C,MAAM,MAAM,GAAG,CAAC,CAAC,MAA2B,CAAC;YAC7C,IAAI,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,0CAAE,UAAU,CAAC,8BAAmB,CAAC,IAAI,CAAC,EAAE;gBAEtD,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC;gBACnC,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,2BAAgB,CAAC,QAAQ,CAAC,CAAC;g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;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,SAAS;iBAChB;aACF;SACF;QACD,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,MAAM,EAAE,SAAS;aAClB;SACF;QACD,KAAK,EAAE,KAAK;QACZ,cAAc,EAAE;YACd,IAAI,EAAE,6BAAkB;YACxB,UAAU,EACR,4pBAA4pB;YAC9pB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,SAAS;SAClB;KACF;IACD,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,KAAK,EAAE,8BAAmB;QAC1B,OAAO,EAAE;YACP,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACnB,KAAK,EAAE,CAAC;SACT;KACF;IACD,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE,UAAU;IACtB,gBAAgB,EAAE,IAAI;CACvB,CAAC","file":"discrete.js","sourcesContent":["/**\n * @description 离散图例\n * @author 章伟星\n */\nimport { merge, isEmpty, normalizePadding, get, isValid, Dict, isBoolean, isNil, isFunction } from '@visactor/vutils';\nimport type {\n FederatedPointerEvent,\n IGroup,\n IGraphic,\n INode,\n IGroupGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport { createGroup, createText, createSymbol, CustomEvent } from '@visactor/vrender';\nimport { LegendBase } from '../base';\nimport { Pager } from '../../pager';\nimport {\n DEFAULT_TITLE_SPACE,\n DEFAULT_ITEM_SPACE_COL,\n DEFAULT_ITEM_SPACE_ROW,\n DEFAULT_SHAPE_SPACE,\n DEFAULT_SHAPE_SIZE,\n DEFAULT_LABEL_SPACE,\n DEFAULT_PAGER_SPACE,\n LegendStateValue,\n DEFAULT_VALUE_SPACE,\n LegendEvent,\n LEGEND_ELEMENT_NAME\n} from '../constant';\nimport type { DiscreteLegendAttrs, LegendItem, LegendItemDatum } from './type';\n\nconst DEFAULT_STATES = {\n [LegendStateValue.focus]: {},\n [LegendStateValue.selected]: {},\n [LegendStateValue.selectedHover]: {},\n [LegendStateValue.unSelected]: {},\n [LegendStateValue.unSelectedHover]: {}\n};\n\nexport class DiscreteLegend extends LegendBase<DiscreteLegendAttrs> {\n name = 'discreteLegend';\n\n private _itemsContainer: IGroup | null = null;\n private _itemWidthByUser: number | undefined;\n private _itemHeightByUser: number | undefined = undefined;\n private _itemHeight = 0; // 存储每一个图例项的高度\n private _itemMaxWidth = 0; // 存储图例项的最大的宽度\n private _pager!: Pager;\n\n static defaultAttributes: Partial<DiscreteLegendAttrs> = {\n layout: 'horizontal',\n title: {\n align: 'start',\n space: DEFAULT_TITLE_SPACE,\n textStyle: {\n fontSize: 12,\n fontWeight: 'bold',\n fill: '#2C3542'\n }\n },\n item: {\n spaceCol: DEFAULT_ITEM_SPACE_COL,\n spaceRow: DEFAULT_ITEM_SPACE_ROW,\n shape: {\n space: DEFAULT_SHAPE_SPACE,\n style: {\n size: DEFAULT_SHAPE_SIZE,\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8'\n // stroke: '#D8D8D8'\n }\n }\n },\n label: {\n space: DEFAULT_LABEL_SPACE,\n style: {\n fontSize: 12,\n fill: '#2C3542',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8'\n }\n }\n },\n value: {\n alignRight: false,\n style: {\n fontSize: 12,\n fill: '#ccc',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8'\n }\n }\n },\n background: {\n style: {\n cursor: 'pointer'\n }\n },\n focus: false,\n focusIconStyle: {\n size: DEFAULT_SHAPE_SIZE,\n symbolType:\n 'M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z',\n fill: '#333',\n cursor: 'pointer'\n }\n },\n autoPage: true,\n pager: {\n space: DEFAULT_PAGER_SPACE,\n handler: {\n style: { size: 10 },\n space: 4\n }\n },\n hover: true,\n select: true,\n selectMode: 'multiple',\n allowAllCanceled: true\n };\n\n constructor(attributes: DiscreteLegendAttrs) {\n super(merge({}, DiscreteLegend.defaultAttributes, attributes));\n }\n\n /**\n * 更新选中数据\n * @param value 选中数据范围\n * @returns\n */\n setSelected(selectedData: (string | number)[]) {\n (this._itemsContainer?.getChildren() as IGroup[]).forEach(item => {\n // @ts-ignore\n const itemData = item.data as LegendItemDatum;\n if (selectedData.includes(itemData.label)) {\n this._setLegendItemState(item, LegendStateValue.selected);\n this._removeLegendItemState(item, [LegendStateValue.unSelected, LegendStateValue.unSelectedHover]);\n } else {\n // 如果当前为选中状态,则取消选中\n this._removeLegendItemState(item, [LegendStateValue.selected, LegendStateValue.selectedHover]);\n this._setLegendItemState(item, LegendStateValue.unSelected);\n }\n });\n }\n\n protected _renderContent() {\n const { item = {}, items, reversed, maxCol = 1, maxRow = 2 } = this.attribute as DiscreteLegendAttrs;\n if (item.visible === false || isEmpty(items)) {\n return;\n }\n\n let legendItems = items;\n if (reversed) {\n legendItems = items?.reverse();\n }\n\n const itemsContainer = createGroup({\n x: 0,\n y: 0\n });\n this._itemsContainer = itemsContainer;\n\n const { layout, maxWidth, maxHeight, defaultSelected = [], autoPage } = this.attribute;\n const isHorizontal = layout === 'horizontal';\n\n const {\n spaceCol = DEFAULT_ITEM_SPACE_COL,\n spaceRow = DEFAULT_ITEM_SPACE_ROW,\n maxWidth: maxItemWidth,\n width: itemWidth,\n height: itemHeight\n } = item;\n\n // 根据用户声明的 maxItemWidth 和 itemWidth 获取图例项宽度\n if (isValid(maxItemWidth)) {\n if (isValid(itemWidth)) {\n this._itemWidthByUser = Math.min(maxItemWidth, itemWidth);\n } else {\n this._itemWidthByUser = maxItemWidth;\n }\n } else if (isValid(itemWidth)) {\n this._itemWidthByUser = itemWidth;\n }\n\n // 存储用户指定图例项高度\n if (isValid(itemHeight)) {\n this._itemHeightByUser = itemHeight;\n }\n let doWrap = false; // 水平布局换行标识\n let maxWidthInCol = 0; // 存储每一列最大的宽度,用于垂直布局的换列\n let startX = 0;\n let startY = 0;\n let maxPages = 1;\n let pages = 1;\n legendItems.forEach((item, index) => {\n if (!item.id) {\n item.id = item.label; // 如果没有设置 id,默认使用 label\n }\n item.index = index; // 用于维护图例的顺序\n\n const itemGroup = this._renderEachItem(\n item,\n isEmpty(defaultSelected) ? true : defaultSelected?.includes(item.label),\n index,\n legendItems\n );\n const itemWidth = itemGroup.attribute.width;\n const itemHeight = itemGroup.attribute.height;\n this._itemHeight = Math.max(this._itemHeight, itemHeight);\n maxWidthInCol = Math.max(itemWidth, maxWidthInCol);\n this._itemMaxWidth = Math.max(itemWidth, this._itemMaxWidth);\n\n if (isHorizontal) {\n maxPages = maxRow;\n // 水平布局\n if (isValid(maxWidth)) {\n if (itemWidth >= maxWidth) {\n // 如果图例项本身就大于 maxWidth\n doWrap = true;\n if (index > 0) {\n startX = 0;\n startY += itemHeight + spaceRow;\n pages += 1;\n }\n } else if (maxWidth < startX + itemWidth) {\n // 检测是否需要换行:如果用户声明了 maxWidth 并且超出了,则进行换行\n doWrap = true;\n startX = 0;\n startY += itemHeight + spaceRow;\n pages += 1;\n }\n }\n if (index > 0) {\n itemGroup.setAttributes({\n x: startX,\n y: startY\n });\n }\n startX += spaceCol + itemWidth;\n } else {\n maxPages = maxCol;\n // 垂直布局\n if (isValid(maxHeight) && maxHeight < startY + itemHeight) {\n // 检测是否换列:如果用户声明了 maxHeight 并且超出了,则进行换列\n doWrap = true;\n startY = 0;\n startX += maxWidthInCol + spaceCol;\n maxWidthInCol = 0;\n pages += 1;\n }\n if (index > 0) {\n itemGroup.setAttributes({\n x: startX,\n y: startY\n });\n }\n startY += spaceRow + itemHeight;\n }\n\n itemsContainer.add(itemGroup);\n });\n\n // TODO: 添加测试用例\n let pagerRendered = false;\n if (doWrap && autoPage && pages > maxPages) {\n // 进行分页处理\n pagerRendered = this._renderPager(isHorizontal);\n }\n\n if (!pagerRendered) {\n itemsContainer.setAttribute(\n 'y',\n this._title ? this._title.AABBBounds.height() + get(this.attribute, 'title.space', 8) : 0\n );\n this._innerView.add(itemsContainer);\n }\n }\n\n protected _bindEvents() {\n if (!this._itemsContainer) {\n return;\n }\n\n const { hover = true, select = true } = this.attribute;\n if (hover) {\n this._itemsContainer.addEventListener('pointermove', this._onHover as EventListenerOrEventListenerObject);\n this._itemsContainer.addEventListener('pointerout', this._onUnHover as EventListenerOrEventListenerObject);\n }\n\n if (select) {\n this._itemsContainer.addEventListener('pointerdown', this._onClick as EventListenerOrEventListenerObject);\n }\n }\n\n private _renderEachItem(item: LegendItemDatum, isSelected: boolean, index: number, items: LegendItemDatum[]) {\n const { id, label, value, shape } = item;\n const { padding = 0, focus, focusIconStyle = {} } = this.attribute.item as LegendItem;\n\n let {\n shape: shapeAttr = {},\n label: labelAttr = {},\n value: valueAttr = {},\n background = {}\n } = this.attribute.item as LegendItem;\n\n shapeAttr = this._handleStyle(shapeAttr, item, isSelected, index, items);\n labelAttr = this._handleStyle(labelAttr, item, isSelected, index, items);\n valueAttr = this._handleStyle(valueAttr, item, isSelected, index, items);\n background = this._handleStyle(background, item, isSelected, index, items);\n\n const parsedPadding = normalizePadding(padding);\n\n let itemGroup;\n if (background.visible === false) {\n itemGroup = createGroup({\n x: 0,\n y: 0,\n cursor: (background?.style as IGroupGraphicAttribute).cursor\n });\n this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup);\n } else {\n itemGroup = createGroup({\n x: 0,\n y: 0,\n ...background?.style\n });\n this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, background?.state);\n }\n\n itemGroup.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);\n\n const innerGroup = createGroup({\n x: 0,\n y: 0,\n pickable: false\n });\n itemGroup.add(innerGroup);\n\n let focusStartX = 0;\n const shapeSize = get(shapeAttr, 'style.size', DEFAULT_SHAPE_SIZE);\n const shapeSpace = get(shapeAttr, 'space', DEFAULT_SHAPE_SPACE);\n const itemShape = createSymbol({\n x: 0,\n y: 0,\n symbolType: 'circle',\n strokeBoundsBuffer: 0,\n ...shape,\n ...shapeAttr.style\n });\n // 处理下 shape 的 fill stroke\n Object.keys(shapeAttr.state || {}).forEach(key => {\n const color =\n (shapeAttr.state[key] as ISymbolGraphicAttribute).fill ||\n (shapeAttr.state[key] as ISymbolGraphicAttribute).stroke;\n if (shape.fill && isNil((shapeAttr.state[key] as ISymbolGraphicAttribute).fill) && color) {\n (shapeAttr.state[key] as ISymbolGraphicAttribute).fill = color as string;\n }\n\n if (shape.stroke && isNil((shapeAttr.state[key] as ISymbolGraphicAttribute).stroke) && color) {\n (shapeAttr.state[key] as ISymbolGraphicAttribute).stroke = color as string;\n }\n });\n this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeAttr?.state);\n\n itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);\n innerGroup.add(itemShape);\n\n let focusShape;\n let focusSpace = 0;\n\n if (focus) {\n const focusSize = get(focusIconStyle, 'size', DEFAULT_SHAPE_SIZE);\n // 绘制聚焦按钮\n focusShape = createSymbol({\n x: 0,\n y: -focusSize / 2 - 1,\n strokeBoundsBuffer: 0,\n ...focusIconStyle,\n visible: false,\n pickMode: 'imprecise',\n boundsPadding: parsedPadding\n });\n this._appendDataToShape(focusShape, LEGEND_ELEMENT_NAME.focus, item, itemGroup);\n\n focusSpace = focusSize;\n }\n\n const labelShape = createText({\n x: shapeSize / 2 + shapeSpace,\n y: 0,\n textAlign: 'start',\n textBaseline: 'middle',\n lineHeight: (labelAttr?.style as ITextGraphicAttribute).fontSize,\n ...labelAttr?.style,\n text: labelAttr.formatMethod ? labelAttr.formatMethod(label, item, index) : label\n });\n this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelAttr?.state);\n labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);\n innerGroup.add(labelShape);\n const labelSpace = get(labelAttr, 'space', DEFAULT_LABEL_SPACE);\n\n focusStartX += shapeSize / 2 + shapeSpace + labelShape.AABBBounds.width() + labelSpace;\n if (isValid(value)) {\n const valueSpace = get(valueAttr, 'space', focus ? DEFAULT_VALUE_SPACE : 0);\n const valueShape = createText({\n x: focusStartX + labelSpace,\n y: 0,\n textAlign: 'start',\n textBaseline: 'middle',\n lineHeight: (valueAttr?.style as ITextGraphicAttribute).fontSize,\n ...valueAttr?.style,\n text: valueAttr.formatMethod ? valueAttr.formatMethod(value, item, index) : value\n });\n this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueAttr?.state);\n valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);\n\n if (this._itemWidthByUser) {\n // 计算用来防止文本的宽度\n const layoutWidth =\n this._itemWidthByUser -\n parsedPadding[1] -\n parsedPadding[3] -\n shapeSize -\n shapeSpace -\n labelSpace -\n focusSpace -\n valueSpace;\n const valueBounds = valueShape.AABBBounds;\n const labelBounds = labelShape.AABBBounds;\n const valueWidth = valueBounds.width();\n const labelWidth = labelBounds.width();\n if (labelWidth > layoutWidth) {\n if ((layoutWidth - valueWidth) / labelWidth > 0.4) {\n // 设置一个值,如果剩余的宽度和 label 自身的比例不低于 0.4 的话,优先展示全 label\n labelShape.setAttribute('maxLineWidth', layoutWidth - valueWidth);\n } else {\n valueShape.setAttribute('maxLineWidth', layoutWidth * 0.5);\n labelShape.setAttribute('maxLineWidth', layoutWidth * 0.5);\n }\n } else {\n valueShape.setAttribute('maxLineWidth', layoutWidth - labelWidth);\n }\n if (valueAttr.alignRight) {\n valueShape.setAttributes({\n // @ts-ignore\n textAlign: 'right',\n x: this._itemWidthByUser - shapeSize / 2 - parsedPadding[1] - parsedPadding[3] - focusSpace - valueSpace\n });\n }\n }\n focusStartX = valueShape.AABBBounds.x2 + valueSpace;\n\n innerGroup.add(valueShape);\n } else if (this._itemWidthByUser) {\n labelShape.setAttribute(\n 'maxLineWidth',\n this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - focusSpace\n );\n }\n\n if (focusShape) {\n focusShape.setAttribute('x', focusStartX);\n innerGroup.add(focusShape);\n }\n\n const innerGroupBounds = innerGroup.AABBBounds;\n const innerGroupWidth = innerGroupBounds.width();\n const innerGroupHeight = innerGroupBounds.height();\n const itemGroupWidth = isValid(this.attribute.item.width)\n ? this.attribute.item.width\n : innerGroupWidth + parsedPadding[1] + parsedPadding[3];\n const itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];\n itemGroup.attribute.width = itemGroupWidth;\n itemGroup.attribute.height = itemGroupHeight;\n\n innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]);\n return itemGroup;\n }\n\n private _renderPager(isHorizontal: boolean) {\n const renderStartY = this._title ? this._title.AABBBounds.height() + get(this.attribute, 'title.space', 8) : 0;\n const { maxWidth, maxHeight, maxCol = 1, maxRow = 2, item = {}, pager = {} } = this.attribute;\n const { spaceCol = DEFAULT_ITEM_SPACE_COL, spaceRow = DEFAULT_ITEM_SPACE_ROW } = item;\n const itemsContainer = this._itemsContainer as IGroup;\n const {\n animation = true,\n animationDuration = 450,\n animationEasing = 'quadIn',\n space: pagerSpace = DEFAULT_PAGER_SPACE,\n ...pageStyle\n } = pager;\n\n let pagerComp: Pager;\n let pageHeight = 0; // 每页的高度\n let pageWidth = 0; // 每页的宽度\n let startX = 0; // 临时变量,用来存储布局的起始点\n let startY = 0; // 临时变量,用来存储布局的起始点\n let pages = 1; // 页数\n\n if (isHorizontal) {\n // 水平布局,支持上下翻页\n pagerComp = new Pager({\n layout: maxRow === 1 ? 'horizontal' : 'vertical',\n total: 99,\n ...merge(\n {\n handler: {\n preShape: 'triangleUp',\n nextShape: 'triangleDown'\n }\n },\n pageStyle\n )\n });\n this._pager = pagerComp;\n this._innerView.add(pagerComp as unknown as INode);\n pageHeight = (maxRow - 1) * spaceRow + this._itemHeight * maxRow;\n pageWidth = (maxWidth as number) - pagerComp.AABBBounds.width() - pagerSpace;\n\n if (pageWidth <= 0) {\n // 布局空间不够则不进行分页器渲染\n this._innerView.removeChild(pagerComp as unknown as INode);\n return false;\n }\n\n // 重新进行布局\n (itemsContainer.getChildren() as unknown as IGroup[]).forEach((item, index) => {\n const { width, height } = item.attribute;\n\n if (pageWidth < startX + (width as number)) {\n // 超出了,则换行\n startX = 0;\n startY += (height as number) + spaceRow;\n pages += 1;\n }\n if (index > 0) {\n item.setAttributes({\n x: startX,\n y: startY\n });\n }\n startX += spaceCol + (width as number);\n });\n\n pagerComp.setAttributes({\n total: Math.ceil(pages / maxRow),\n x: pageWidth,\n y: renderStartY + pageHeight / 2 - pagerComp.AABBBounds.height() / 2\n });\n } else {\n // 垂直布局,支持左右翻页\n pagerComp = new Pager({\n layout: 'horizontal',\n total: 99, // 用于估算\n ...pageStyle\n });\n this._pager = pagerComp;\n this._innerView.add(pagerComp as unknown as INode);\n\n pageWidth = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol;\n pageHeight = (maxHeight as number) - pagerComp.AABBBounds.height() - pagerSpace - renderStartY;\n\n if (pageHeight <= 0) {\n // 布局空间不够则不进行分页器渲染\n this._innerView.removeChild(pagerComp as unknown as INode);\n return false;\n }\n\n // 重新进行布局\n (itemsContainer.getChildren() as unknown as IGroup[]).forEach((item, index) => {\n const { height } = item.attribute;\n if (pageHeight < startY + (height as number)) {\n startY = 0;\n startX += this._itemMaxWidth + spaceCol;\n pages += 1;\n }\n if (index > 0) {\n item.setAttributes({\n x: startX,\n y: startY\n });\n }\n startY += spaceRow + (height as number);\n });\n\n pagerComp.setAttributes({\n total: Math.ceil(pages / maxCol),\n x: (pageWidth - pagerComp.AABBBounds.width()) / 2,\n y: (maxHeight as number) - pagerComp.AABBBounds.height()\n });\n }\n\n // 初始化 defaultCurrent\n if (pager.defaultCurrent > 1) {\n if (isHorizontal) {\n itemsContainer.setAttribute('y', -(pager.defaultCurrent - 1) * (pageHeight + spaceRow));\n } else {\n itemsContainer.setAttribute('x', -(pager.defaultCurrent - 1) * (pageWidth + spaceCol));\n }\n }\n\n const clipGroup = createGroup({\n x: 0,\n y: renderStartY,\n width: pageWidth,\n height: pageHeight,\n clip: true,\n pickable: false\n });\n clipGroup.add(itemsContainer);\n this._innerView.add(clipGroup);\n\n const onPaging = (e: CustomEvent) => {\n const { current } = e.detail;\n\n if (animation) {\n itemsContainer\n .animate()\n .to(\n isHorizontal\n ? { y: -(current - 1) * (pageHeight + spaceRow) }\n : { x: -(current - 1) * (pageWidth + spaceCol) },\n animationDuration,\n animationEasing\n );\n } else {\n if (isHorizontal) {\n itemsContainer.setAttribute('y', -(current - 1) * (pageHeight + spaceRow));\n } else {\n itemsContainer.setAttribute('x', -(current - 1) * (pageWidth + spaceCol));\n }\n }\n };\n\n this._pager.addEventListener('toPrev', onPaging);\n this._pager.addEventListener('toNext', onPaging);\n\n return true;\n }\n\n private _onHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGroup;\n if (target?.name?.startsWith(LEGEND_ELEMENT_NAME.item)) {\n // @ts-ignore\n const legendItem = target.delegate;\n const selected = legendItem.hasState(LegendStateValue.selected);\n\n if (selected) {\n // use selectedHover state\n this._setLegendItemState(legendItem, LegendStateValue.selectedHover, e);\n } else {\n // use unSelectedHover state\n this._setLegendItemState(legendItem, LegendStateValue.unSelectedHover, e);\n }\n\n const focusButton = (legendItem.getChildren()[0] as unknown as IGroup).find(\n node => node.name === LEGEND_ELEMENT_NAME.focus,\n false\n ) as IGraphic;\n if (focusButton) {\n focusButton.setAttribute('visible', true);\n }\n\n this._dispatchEvent(LegendEvent.legendItemHover, legendItem, e);\n }\n };\n\n private _onUnHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGroup;\n if (target?.name?.startsWith(LEGEND_ELEMENT_NAME.item)) {\n // @ts-ignore\n const legendItem = target.delegate;\n\n let attributeUpdate = false;\n if (\n legendItem.hasState(LegendStateValue.unSelectedHover) ||\n legendItem.hasState(LegendStateValue.selectedHover)\n ) {\n attributeUpdate = true;\n }\n legendItem.removeState(LegendStateValue.unSelectedHover);\n legendItem.removeState(LegendStateValue.selectedHover);\n legendItem\n .getChildren()[0]\n .getChildren()\n .forEach((child: any) => {\n if (\n !attributeUpdate &&\n (child.hasState(LegendStateValue.unSelectedHover) || child.hasState(LegendStateValue.selectedHover))\n ) {\n attributeUpdate = true;\n }\n (child as unknown as IGraphic).removeState(LegendStateValue.unSelectedHover);\n (child as unknown as IGraphic).removeState(LegendStateValue.selectedHover);\n });\n\n const focusButton = (legendItem.getChildren()[0] as unknown as IGroup).find(\n node => node.name === LEGEND_ELEMENT_NAME.focus,\n false\n ) as IGraphic;\n if (focusButton) {\n focusButton.setAttribute('visible', false);\n }\n\n if (attributeUpdate) {\n this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem, e);\n }\n this._dispatchEvent(LegendEvent.legendItemUnHover, legendItem, e);\n }\n };\n\n private _onClick = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGroup;\n if (target?.name?.startsWith(LEGEND_ELEMENT_NAME.item)) {\n // @ts-ignore\n const legendItem = target.delegate;\n\n // 图例聚焦功能\n if (target.name === LEGEND_ELEMENT_NAME.focus) {\n const isFocusSelected = legendItem.hasState(LegendStateValue.focus);\n legendItem.toggleState(LegendStateValue.focus);\n\n if (isFocusSelected) {\n // 当前为选中态,则再次点击变成全选\n this._itemsContainer?.getChildren().forEach(item => {\n this._removeLegendItemState(\n item as unknown as IGroup,\n [LegendStateValue.unSelected, LegendStateValue.unSelectedHover, LegendStateValue.focus],\n e\n );\n this._setLegendItemState(item as unknown as IGroup, LegendStateValue.selected, e);\n });\n } else {\n this._setLegendItemState(legendItem, LegendStateValue.selected, e);\n this._removeLegendItemState(legendItem, [LegendStateValue.unSelected, LegendStateValue.unSelectedHover], e);\n // 单选逻辑,当前被点击的图例项设置为选中态,其他全部设置为非选中态\n this._itemsContainer?.getChildren().forEach(item => {\n if (legendItem !== item) {\n this._removeLegendItemState(\n item as unknown as IGroup,\n [LegendStateValue.selected, LegendStateValue.selectedHover, LegendStateValue.focus],\n e\n );\n this._setLegendItemState(item as unknown as IGroup, LegendStateValue.unSelected, e);\n }\n });\n }\n } else {\n // 清除 focus 状态\n this._itemsContainer?.getChildren().forEach(item => {\n (item as unknown as IGroup).removeState(LegendStateValue.focus);\n });\n const { selectMode = 'multiple', allowAllCanceled = true } = this.attribute;\n const isSelected = legendItem.hasState(LegendStateValue.selected);\n const currentSelectedItems = this._getSelectedLegends();\n if (selectMode === 'multiple') {\n if (allowAllCanceled === false && isSelected && currentSelectedItems.length === 1) {\n this._dispatchEvent(LegendEvent.legendItemClick, legendItem, e);\n return;\n }\n // 多选逻辑\n if (isSelected) {\n // 如果当前为选中状态,则取消选中\n this._removeLegendItemState(legendItem, [LegendStateValue.selected, LegendStateValue.selectedHover], e);\n this._setLegendItemState(legendItem, LegendStateValue.unSelected, e);\n } else {\n // 如果当前为非选中态,则设置为选中状态\n this._setLegendItemState(legendItem, LegendStateValue.selected, e);\n this._removeLegendItemState(legendItem, [LegendStateValue.unSelected, LegendStateValue.unSelectedHover], e);\n }\n } else {\n this._setLegendItemState(legendItem, LegendStateValue.selected, e);\n this._removeLegendItemState(legendItem, [LegendStateValue.unSelected, LegendStateValue.unSelectedHover], e);\n\n // 单选逻辑,当前被点击的图例项设置为选中态,其他全部设置为非选中态\n this._itemsContainer?.getChildren().forEach(item => {\n if (legendItem !== item) {\n this._removeLegendItemState(\n item as unknown as IGroup,\n [LegendStateValue.selected, LegendStateValue.selectedHover],\n e\n );\n this._setLegendItemState(item as unknown as IGroup, LegendStateValue.unSelected, e);\n }\n });\n }\n }\n\n this._dispatchEvent(LegendEvent.legendItemClick, legendItem, e);\n }\n };\n\n private _setLegendItemState(legendItem: IGroup, stateName: string, e?: FederatedPointerEvent) {\n const keepCurrentStates = true;\n let attributeUpdate = false;\n if (!legendItem.hasState(stateName)) {\n attributeUpdate = true;\n }\n legendItem.addState(stateName, keepCurrentStates);\n // TODO: 这个比较 hack\n legendItem\n .getChildren()[0]\n .getChildren()\n .forEach((child: IGraphic) => {\n if (child.name !== LEGEND_ELEMENT_NAME.focus) {\n if (!attributeUpdate && !child.hasState(stateName)) {\n attributeUpdate = true;\n }\n (child as unknown as IGraphic).addState(stateName, keepCurrentStates);\n }\n });\n if (attributeUpdate) {\n this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem, e);\n }\n }\n\n private _removeLegendItemState(legendItem: IGroup, stateNames: string[], e?: FederatedPointerEvent) {\n let attributeUpdate = false;\n stateNames.forEach(name => {\n if (!attributeUpdate && legendItem.hasState(name)) {\n attributeUpdate = true;\n }\n legendItem.removeState(name);\n });\n // TODO: 这个比较 hack\n legendItem\n .getChildren()[0]\n .getChildren()\n .forEach(child => {\n if (child.name !== LEGEND_ELEMENT_NAME.focus) {\n stateNames.forEach(name => {\n if (!attributeUpdate && (child as unknown as IGraphic).hasState(name)) {\n attributeUpdate = true;\n }\n (child as unknown as IGraphic).removeState(name);\n });\n }\n });\n if (attributeUpdate) {\n this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem, e);\n }\n }\n\n // 获取当前选中的图例项\n private _getSelectedLegends() {\n const selectedData: LegendItemDatum[] = [];\n this._itemsContainer?.getChildren().forEach(item => {\n if ((item as unknown as IGroup).hasState(LegendStateValue.selected)) {\n // @ts-ignore\n selectedData.push(item.data);\n }\n });\n\n return selectedData;\n }\n\n private _appendDataToShape(shape: any, name: string, data: any, delegateShape: any, states: any = {}) {\n shape.name = name;\n shape.data = data;\n shape.delegate = delegateShape;\n shape.states = merge({}, DEFAULT_STATES, states);\n }\n\n private _dispatchEvent(eventName: string, legendItem: any, event: FederatedPointerEvent) {\n const currentSelectedItems = this._getSelectedLegends();\n // 需要保持显示顺序\n currentSelectedItems.sort((pre: LegendItemDatum, next: LegendItemDatum) => pre.index - next.index);\n\n const currentSelected = currentSelectedItems.map((obj: LegendItemDatum) => obj.label);\n\n // 封装事件\n const changeEvent = new CustomEvent(eventName, {\n item: legendItem, // 当前被选中的图例项整体\n data: legendItem.data, // 当前图例项的数据\n selected: legendItem.hasState(LegendStateValue.selected), // 当前图例项是否被选中\n currentSelectedItems,\n currentSelected,\n event\n });\n // FIXME: 需要在 vrender 的事件系统支持\n // @ts-ignore\n changeEvent.manager = this.stage?.eventSystem.manager;\n\n this.dispatchEvent(changeEvent);\n }\n\n // 处理回调函数\n private _handleStyle(\n config: any,\n item: LegendItemDatum,\n isSelected: boolean,\n index: number,\n items: LegendItemDatum[]\n ) {\n const newConfig = merge({}, config);\n // 处理下样式\n if (config.style && isFunction(config.style)) {\n newConfig.style = config.style(item, isSelected, index, items);\n }\n if (config.state) {\n Object.keys(config.state).forEach(key => {\n if (config.state[key] && isFunction(config.state[key])) {\n newConfig.state[key] = config.state[key](item, isSelected, index, items);\n }\n });\n }\n\n return newConfig;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/legend/discrete/discrete.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,6CAAs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EACR,4pBAA4pB;YAC9pB,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,SAAS;SAClB;KACF;IACD,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,KAAK,EAAE,8BAAmB;QAC1B,OAAO,EAAE;YACP,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACnB,KAAK,EAAE,CAAC;SACT;KACF;IACD,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE,UAAU;IACtB,gBAAgB,EAAE,IAAI;CACvB,CAAC","file":"discrete.js","sourcesContent":["/**\n * @description 离散图例\n * @author 章伟星\n */\nimport { merge, isEmpty, normalizePadding, get, isValid, Dict, isBoolean, isNil, isFunction } from '@visactor/vutils';\nimport type {\n FederatedPointerEvent,\n IGroup,\n IGraphic,\n INode,\n IGroupGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport { createGroup, createText, createSymbol, CustomEvent } from '@visactor/vrender';\nimport { LegendBase } from '../base';\nimport { Pager } from '../../pager';\nimport {\n DEFAULT_TITLE_SPACE,\n DEFAULT_ITEM_SPACE_COL,\n DEFAULT_ITEM_SPACE_ROW,\n DEFAULT_SHAPE_SPACE,\n DEFAULT_SHAPE_SIZE,\n DEFAULT_LABEL_SPACE,\n DEFAULT_PAGER_SPACE,\n LegendStateValue,\n DEFAULT_VALUE_SPACE,\n LegendEvent,\n LEGEND_ELEMENT_NAME\n} from '../constant';\nimport type { DiscreteLegendAttrs, LegendItem, LegendItemDatum } from './type';\n\nconst DEFAULT_STATES = {\n [LegendStateValue.focus]: {},\n [LegendStateValue.selected]: {},\n [LegendStateValue.selectedHover]: {},\n [LegendStateValue.unSelected]: {},\n [LegendStateValue.unSelectedHover]: {}\n};\n\nexport class DiscreteLegend extends LegendBase<DiscreteLegendAttrs> {\n name = 'discreteLegend';\n\n private _itemsContainer: IGroup | null = null;\n private _itemWidthByUser: number | undefined;\n private _itemHeightByUser: number | undefined = undefined;\n private _itemHeight = 0; // 存储每一个图例项的高度\n private _itemMaxWidth = 0; // 存储图例项的最大的宽度\n private _pager!: Pager;\n\n static defaultAttributes: Partial<DiscreteLegendAttrs> = {\n layout: 'horizontal',\n title: {\n align: 'start',\n space: DEFAULT_TITLE_SPACE,\n textStyle: {\n fontSize: 12,\n fontWeight: 'bold',\n fill: '#2C3542'\n }\n },\n item: {\n spaceCol: DEFAULT_ITEM_SPACE_COL,\n spaceRow: DEFAULT_ITEM_SPACE_ROW,\n shape: {\n space: DEFAULT_SHAPE_SPACE,\n style: {\n size: DEFAULT_SHAPE_SIZE,\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n opacity: 0.5\n }\n }\n },\n label: {\n space: DEFAULT_LABEL_SPACE,\n style: {\n fontSize: 12,\n fill: '#2C3542',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8'\n }\n }\n },\n value: {\n alignRight: false,\n style: {\n fontSize: 12,\n fill: '#ccc',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8'\n }\n }\n },\n background: {\n style: {\n cursor: 'pointer'\n }\n },\n focus: false,\n focusIconStyle: {\n size: DEFAULT_SHAPE_SIZE,\n symbolType:\n 'M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM8.75044 2.55077L8.75 3.75H7.25L7.25006 2.5507C4.81247 2.88304 2.88304 4.81247 2.5507 7.25006L3.75 7.25V8.75L2.55077 8.75044C2.8833 11.1878 4.81264 13.117 7.25006 13.4493L7.25 12.25H8.75L8.75044 13.4492C11.1876 13.1167 13.1167 11.1876 13.4492 8.75044L12.25 8.75V7.25L13.4493 7.25006C13.117 4.81264 11.1878 2.8833 8.75044 2.55077ZM8 5.5C9.38071 5.5 10.5 6.61929 10.5 8C10.5 9.38071 9.38071 10.5 8 10.5C6.61929 10.5 5.5 9.38071 5.5 8C5.5 6.61929 6.61929 5.5 8 5.5ZM8 7C7.44772 7 7 7.44772 7 8C7 8.55228 7.44772 9 8 9C8.55228 9 9 8.55228 9 8C9 7.44772 8.55228 7 8 7Z',\n fill: '#333',\n cursor: 'pointer'\n }\n },\n autoPage: true,\n pager: {\n space: DEFAULT_PAGER_SPACE,\n handler: {\n style: { size: 10 },\n space: 4\n }\n },\n hover: true,\n select: true,\n selectMode: 'multiple',\n allowAllCanceled: true\n };\n\n constructor(attributes: DiscreteLegendAttrs) {\n super(merge({}, DiscreteLegend.defaultAttributes, attributes));\n }\n\n /**\n * 更新选中数据\n * @param value 选中数据范围\n * @returns\n */\n setSelected(selectedData: (string | number)[]) {\n (this._itemsContainer?.getChildren() as IGroup[]).forEach(item => {\n // @ts-ignore\n const itemData = item.data as LegendItemDatum;\n if (selectedData.includes(itemData.label)) {\n this._setLegendItemState(item, LegendStateValue.selected);\n this._removeLegendItemState(item, [LegendStateValue.unSelected, LegendStateValue.unSelectedHover]);\n } else {\n // 如果当前为选中状态,则取消选中\n this._removeLegendItemState(item, [LegendStateValue.selected, LegendStateValue.selectedHover]);\n this._setLegendItemState(item, LegendStateValue.unSelected);\n }\n });\n }\n\n protected _renderContent() {\n const { item = {}, items, reversed, maxCol = 1, maxRow = 2 } = this.attribute as DiscreteLegendAttrs;\n if (item.visible === false || isEmpty(items)) {\n return;\n }\n\n let legendItems = items;\n if (reversed) {\n legendItems = items?.reverse();\n }\n\n const itemsContainer = createGroup({\n x: 0,\n y: 0\n });\n this._itemsContainer = itemsContainer;\n\n const { layout, maxWidth, maxHeight, defaultSelected = [], autoPage } = this.attribute;\n const isHorizontal = layout === 'horizontal';\n\n const {\n spaceCol = DEFAULT_ITEM_SPACE_COL,\n spaceRow = DEFAULT_ITEM_SPACE_ROW,\n maxWidth: maxItemWidth,\n width: itemWidth,\n height: itemHeight\n } = item;\n\n // 根据用户声明的 maxItemWidth 和 itemWidth 获取图例项宽度\n if (isValid(maxItemWidth)) {\n if (isValid(itemWidth)) {\n this._itemWidthByUser = Math.min(maxItemWidth, itemWidth);\n } else {\n this._itemWidthByUser = maxItemWidth;\n }\n } else if (isValid(itemWidth)) {\n this._itemWidthByUser = itemWidth;\n }\n\n // 存储用户指定图例项高度\n if (isValid(itemHeight)) {\n this._itemHeightByUser = itemHeight;\n }\n let doWrap = false; // 水平布局换行标识\n let maxWidthInCol = 0; // 存储每一列最大的宽度,用于垂直布局的换列\n let startX = 0;\n let startY = 0;\n let maxPages = 1;\n let pages = 1;\n legendItems.forEach((item, index) => {\n if (!item.id) {\n item.id = item.label; // 如果没有设置 id,默认使用 label\n }\n item.index = index; // 用于维护图例的顺序\n\n const itemGroup = this._renderEachItem(\n item,\n isEmpty(defaultSelected) ? true : defaultSelected?.includes(item.label),\n index,\n legendItems\n );\n const itemWidth = itemGroup.attribute.width;\n const itemHeight = itemGroup.attribute.height;\n this._itemHeight = Math.max(this._itemHeight, itemHeight);\n maxWidthInCol = Math.max(itemWidth, maxWidthInCol);\n this._itemMaxWidth = Math.max(itemWidth, this._itemMaxWidth);\n\n if (isHorizontal) {\n maxPages = maxRow;\n // 水平布局\n if (isValid(maxWidth)) {\n if (itemWidth >= maxWidth) {\n // 如果图例项本身就大于 maxWidth\n doWrap = true;\n if (index > 0) {\n startX = 0;\n startY += itemHeight + spaceRow;\n pages += 1;\n }\n } else if (maxWidth < startX + itemWidth) {\n // 检测是否需要换行:如果用户声明了 maxWidth 并且超出了,则进行换行\n doWrap = true;\n startX = 0;\n startY += itemHeight + spaceRow;\n pages += 1;\n }\n }\n if (index > 0) {\n itemGroup.setAttributes({\n x: startX,\n y: startY\n });\n }\n startX += spaceCol + itemWidth;\n } else {\n maxPages = maxCol;\n // 垂直布局\n if (isValid(maxHeight) && maxHeight < startY + itemHeight) {\n // 检测是否换列:如果用户声明了 maxHeight 并且超出了,则进行换列\n doWrap = true;\n startY = 0;\n startX += maxWidthInCol + spaceCol;\n maxWidthInCol = 0;\n pages += 1;\n }\n if (index > 0) {\n itemGroup.setAttributes({\n x: startX,\n y: startY\n });\n }\n startY += spaceRow + itemHeight;\n }\n\n itemsContainer.add(itemGroup);\n });\n\n // TODO: 添加测试用例\n let pagerRendered = false;\n if (doWrap && autoPage && pages > maxPages) {\n // 进行分页处理\n pagerRendered = this._renderPager(isHorizontal);\n }\n\n if (!pagerRendered) {\n itemsContainer.setAttribute(\n 'y',\n this._title ? this._title.AABBBounds.height() + get(this.attribute, 'title.space', 8) : 0\n );\n this._innerView.add(itemsContainer);\n }\n }\n\n protected _bindEvents() {\n if (!this._itemsContainer) {\n return;\n }\n\n const { hover = true, select = true } = this.attribute;\n if (hover) {\n this._itemsContainer.addEventListener('pointermove', this._onHover as EventListenerOrEventListenerObject);\n this._itemsContainer.addEventListener('pointerout', this._onUnHover as EventListenerOrEventListenerObject);\n }\n\n if (select) {\n this._itemsContainer.addEventListener('pointerdown', this._onClick as EventListenerOrEventListenerObject);\n }\n }\n\n private _renderEachItem(item: LegendItemDatum, isSelected: boolean, index: number, items: LegendItemDatum[]) {\n const { id, label, value, shape } = item;\n const { padding = 0, focus, focusIconStyle = {} } = this.attribute.item as LegendItem;\n\n let {\n shape: shapeAttr = {},\n label: labelAttr = {},\n value: valueAttr = {},\n background = {}\n } = this.attribute.item as LegendItem;\n\n shapeAttr = this._handleStyle(shapeAttr, item, isSelected, index, items);\n labelAttr = this._handleStyle(labelAttr, item, isSelected, index, items);\n valueAttr = this._handleStyle(valueAttr, item, isSelected, index, items);\n background = this._handleStyle(background, item, isSelected, index, items);\n\n const parsedPadding = normalizePadding(padding);\n\n let itemGroup;\n if (background.visible === false) {\n itemGroup = createGroup({\n x: 0,\n y: 0,\n cursor: (background?.style as IGroupGraphicAttribute).cursor\n });\n this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup);\n } else {\n itemGroup = createGroup({\n x: 0,\n y: 0,\n ...background?.style\n });\n this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, background?.state);\n }\n\n itemGroup.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);\n\n const innerGroup = createGroup({\n x: 0,\n y: 0,\n pickable: false\n });\n itemGroup.add(innerGroup);\n\n let focusStartX = 0;\n const shapeSize = get(shapeAttr, 'style.size', DEFAULT_SHAPE_SIZE);\n const shapeSpace = get(shapeAttr, 'space', DEFAULT_SHAPE_SPACE);\n const itemShape = createSymbol({\n x: 0,\n y: 0,\n symbolType: 'circle',\n strokeBoundsBuffer: 0,\n ...shape,\n ...shapeAttr.style\n });\n // 处理下 shape 的 fill stroke\n Object.keys(shapeAttr.state || {}).forEach(key => {\n const color =\n (shapeAttr.state[key] as ISymbolGraphicAttribute).fill ||\n (shapeAttr.state[key] as ISymbolGraphicAttribute).stroke;\n if (shape.fill && isNil((shapeAttr.state[key] as ISymbolGraphicAttribute).fill) && color) {\n (shapeAttr.state[key] as ISymbolGraphicAttribute).fill = color as string;\n }\n\n if (shape.stroke && isNil((shapeAttr.state[key] as ISymbolGraphicAttribute).stroke) && color) {\n (shapeAttr.state[key] as ISymbolGraphicAttribute).stroke = color as string;\n }\n });\n this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeAttr?.state);\n\n itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);\n innerGroup.add(itemShape);\n\n let focusShape;\n let focusSpace = 0;\n\n if (focus) {\n const focusSize = get(focusIconStyle, 'size', DEFAULT_SHAPE_SIZE);\n // 绘制聚焦按钮\n focusShape = createSymbol({\n x: 0,\n y: -focusSize / 2 - 1,\n strokeBoundsBuffer: 0,\n ...focusIconStyle,\n visible: false,\n pickMode: 'imprecise',\n boundsPadding: parsedPadding\n });\n this._appendDataToShape(focusShape, LEGEND_ELEMENT_NAME.focus, item, itemGroup);\n\n focusSpace = focusSize;\n }\n\n const labelShape = createText({\n x: shapeSize / 2 + shapeSpace,\n y: 0,\n textAlign: 'start',\n textBaseline: 'middle',\n lineHeight: (labelAttr?.style as ITextGraphicAttribute).fontSize,\n ...labelAttr?.style,\n text: labelAttr.formatMethod ? labelAttr.formatMethod(label, item, index) : label\n });\n this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelAttr?.state);\n labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);\n innerGroup.add(labelShape);\n const labelSpace = get(labelAttr, 'space', DEFAULT_LABEL_SPACE);\n\n focusStartX += shapeSize / 2 + shapeSpace + labelShape.AABBBounds.width() + labelSpace;\n if (isValid(value)) {\n const valueSpace = get(valueAttr, 'space', focus ? DEFAULT_VALUE_SPACE : 0);\n const valueShape = createText({\n x: focusStartX + labelSpace,\n y: 0,\n textAlign: 'start',\n textBaseline: 'middle',\n lineHeight: (valueAttr?.style as ITextGraphicAttribute).fontSize,\n ...valueAttr?.style,\n text: valueAttr.formatMethod ? valueAttr.formatMethod(value, item, index) : value\n });\n this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueAttr?.state);\n valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);\n\n if (this._itemWidthByUser) {\n // 计算用来防止文本的宽度\n const layoutWidth =\n this._itemWidthByUser -\n parsedPadding[1] -\n parsedPadding[3] -\n shapeSize -\n shapeSpace -\n labelSpace -\n focusSpace -\n valueSpace;\n const valueBounds = valueShape.AABBBounds;\n const labelBounds = labelShape.AABBBounds;\n const valueWidth = valueBounds.width();\n const labelWidth = labelBounds.width();\n if (labelWidth > layoutWidth) {\n if ((layoutWidth - valueWidth) / labelWidth > 0.4) {\n // 设置一个值,如果剩余的宽度和 label 自身的比例不低于 0.4 的话,优先展示全 label\n labelShape.setAttribute('maxLineWidth', layoutWidth - valueWidth);\n } else {\n valueShape.setAttribute('maxLineWidth', layoutWidth * 0.5);\n labelShape.setAttribute('maxLineWidth', layoutWidth * 0.5);\n }\n } else {\n valueShape.setAttribute('maxLineWidth', layoutWidth - labelWidth);\n }\n if (valueAttr.alignRight) {\n valueShape.setAttributes({\n // @ts-ignore\n textAlign: 'right',\n x: this._itemWidthByUser - shapeSize / 2 - parsedPadding[1] - parsedPadding[3] - focusSpace - valueSpace\n });\n }\n }\n focusStartX = valueShape.AABBBounds.x2 + valueSpace;\n\n innerGroup.add(valueShape);\n } else if (this._itemWidthByUser) {\n labelShape.setAttribute(\n 'maxLineWidth',\n this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - focusSpace\n );\n }\n\n if (focusShape) {\n focusShape.setAttribute('x', focusStartX);\n innerGroup.add(focusShape);\n }\n\n const innerGroupBounds = innerGroup.AABBBounds;\n const innerGroupWidth = innerGroupBounds.width();\n const innerGroupHeight = innerGroupBounds.height();\n const itemGroupWidth = isValid(this.attribute.item.width)\n ? this.attribute.item.width\n : innerGroupWidth + parsedPadding[1] + parsedPadding[3];\n const itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];\n itemGroup.attribute.width = itemGroupWidth;\n itemGroup.attribute.height = itemGroupHeight;\n\n innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]);\n return itemGroup;\n }\n\n private _renderPager(isHorizontal: boolean) {\n const renderStartY = this._title ? this._title.AABBBounds.height() + get(this.attribute, 'title.space', 8) : 0;\n const { maxWidth, maxHeight, maxCol = 1, maxRow = 2, item = {}, pager = {} } = this.attribute;\n const { spaceCol = DEFAULT_ITEM_SPACE_COL, spaceRow = DEFAULT_ITEM_SPACE_ROW } = item;\n const itemsContainer = this._itemsContainer as IGroup;\n const {\n animation = true,\n animationDuration = 450,\n animationEasing = 'quadIn',\n space: pagerSpace = DEFAULT_PAGER_SPACE,\n ...pageStyle\n } = pager;\n\n let pagerComp: Pager;\n let pageHeight = 0; // 每页的高度\n let pageWidth = 0; // 每页的宽度\n let startX = 0; // 临时变量,用来存储布局的起始点\n let startY = 0; // 临时变量,用来存储布局的起始点\n let pages = 1; // 页数\n\n if (isHorizontal) {\n // 水平布局,支持上下翻页\n pagerComp = new Pager({\n layout: maxRow === 1 ? 'horizontal' : 'vertical',\n total: 99,\n ...merge(\n {\n handler: {\n preShape: 'triangleUp',\n nextShape: 'triangleDown'\n }\n },\n pageStyle\n )\n });\n this._pager = pagerComp;\n this._innerView.add(pagerComp as unknown as INode);\n pageHeight = (maxRow - 1) * spaceRow + this._itemHeight * maxRow;\n pageWidth = (maxWidth as number) - pagerComp.AABBBounds.width() - pagerSpace;\n\n if (pageWidth <= 0) {\n // 布局空间不够则不进行分页器渲染\n this._innerView.removeChild(pagerComp as unknown as INode);\n return false;\n }\n\n // 重新进行布局\n (itemsContainer.getChildren() as unknown as IGroup[]).forEach((item, index) => {\n const { width, height } = item.attribute;\n\n if (pageWidth < startX + (width as number)) {\n // 超出了,则换行\n startX = 0;\n startY += (height as number) + spaceRow;\n pages += 1;\n }\n if (index > 0) {\n item.setAttributes({\n x: startX,\n y: startY\n });\n }\n startX += spaceCol + (width as number);\n });\n\n pagerComp.setAttributes({\n total: Math.ceil(pages / maxRow),\n x: pageWidth,\n y: renderStartY + pageHeight / 2 - pagerComp.AABBBounds.height() / 2\n });\n } else {\n // 垂直布局,支持左右翻页\n pagerComp = new Pager({\n layout: 'horizontal',\n total: 99, // 用于估算\n ...pageStyle\n });\n this._pager = pagerComp;\n this._innerView.add(pagerComp as unknown as INode);\n\n pageWidth = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol;\n pageHeight = (maxHeight as number) - pagerComp.AABBBounds.height() - pagerSpace - renderStartY;\n\n if (pageHeight <= 0) {\n // 布局空间不够则不进行分页器渲染\n this._innerView.removeChild(pagerComp as unknown as INode);\n return false;\n }\n\n // 重新进行布局\n (itemsContainer.getChildren() as unknown as IGroup[]).forEach((item, index) => {\n const { height } = item.attribute;\n if (pageHeight < startY + (height as number)) {\n startY = 0;\n startX += this._itemMaxWidth + spaceCol;\n pages += 1;\n }\n if (index > 0) {\n item.setAttributes({\n x: startX,\n y: startY\n });\n }\n startY += spaceRow + (height as number);\n });\n\n pagerComp.setAttributes({\n total: Math.ceil(pages / maxCol),\n x: (pageWidth - pagerComp.AABBBounds.width()) / 2,\n y: (maxHeight as number) - pagerComp.AABBBounds.height()\n });\n }\n\n // 初始化 defaultCurrent\n if (pager.defaultCurrent > 1) {\n if (isHorizontal) {\n itemsContainer.setAttribute('y', -(pager.defaultCurrent - 1) * (pageHeight + spaceRow));\n } else {\n itemsContainer.setAttribute('x', -(pager.defaultCurrent - 1) * (pageWidth + spaceCol));\n }\n }\n\n const clipGroup = createGroup({\n x: 0,\n y: renderStartY,\n width: pageWidth,\n height: pageHeight,\n clip: true,\n pickable: false\n });\n clipGroup.add(itemsContainer);\n this._innerView.add(clipGroup);\n\n const onPaging = (e: CustomEvent) => {\n const { current } = e.detail;\n\n if (animation) {\n itemsContainer\n .animate()\n .to(\n isHorizontal\n ? { y: -(current - 1) * (pageHeight + spaceRow) }\n : { x: -(current - 1) * (pageWidth + spaceCol) },\n animationDuration,\n animationEasing\n );\n } else {\n if (isHorizontal) {\n itemsContainer.setAttribute('y', -(current - 1) * (pageHeight + spaceRow));\n } else {\n itemsContainer.setAttribute('x', -(current - 1) * (pageWidth + spaceCol));\n }\n }\n };\n\n this._pager.addEventListener('toPrev', onPaging);\n this._pager.addEventListener('toNext', onPaging);\n\n return true;\n }\n\n private _onHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGroup;\n if (target?.name?.startsWith(LEGEND_ELEMENT_NAME.item)) {\n // @ts-ignore\n const legendItem = target.delegate;\n const selected = legendItem.hasState(LegendStateValue.selected);\n\n if (selected) {\n // use selectedHover state\n this._setLegendItemState(legendItem, LegendStateValue.selectedHover, e);\n } else {\n // use unSelectedHover state\n this._setLegendItemState(legendItem, LegendStateValue.unSelectedHover, e);\n }\n\n const focusButton = (legendItem.getChildren()[0] as unknown as IGroup).find(\n node => node.name === LEGEND_ELEMENT_NAME.focus,\n false\n ) as IGraphic;\n if (focusButton) {\n focusButton.setAttribute('visible', true);\n }\n\n this._dispatchEvent(LegendEvent.legendItemHover, legendItem, e);\n }\n };\n\n private _onUnHover = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGroup;\n if (target?.name?.startsWith(LEGEND_ELEMENT_NAME.item)) {\n // @ts-ignore\n const legendItem = target.delegate;\n\n let attributeUpdate = false;\n if (\n legendItem.hasState(LegendStateValue.unSelectedHover) ||\n legendItem.hasState(LegendStateValue.selectedHover)\n ) {\n attributeUpdate = true;\n }\n legendItem.removeState(LegendStateValue.unSelectedHover);\n legendItem.removeState(LegendStateValue.selectedHover);\n legendItem\n .getChildren()[0]\n .getChildren()\n .forEach((child: any) => {\n if (\n !attributeUpdate &&\n (child.hasState(LegendStateValue.unSelectedHover) || child.hasState(LegendStateValue.selectedHover))\n ) {\n attributeUpdate = true;\n }\n (child as unknown as IGraphic).removeState(LegendStateValue.unSelectedHover);\n (child as unknown as IGraphic).removeState(LegendStateValue.selectedHover);\n });\n\n const focusButton = (legendItem.getChildren()[0] as unknown as IGroup).find(\n node => node.name === LEGEND_ELEMENT_NAME.focus,\n false\n ) as IGraphic;\n if (focusButton) {\n focusButton.setAttribute('visible', false);\n }\n\n if (attributeUpdate) {\n this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem, e);\n }\n this._dispatchEvent(LegendEvent.legendItemUnHover, legendItem, e);\n }\n };\n\n private _onClick = (e: FederatedPointerEvent) => {\n const target = e.target as unknown as IGroup;\n if (target?.name?.startsWith(LEGEND_ELEMENT_NAME.item)) {\n // @ts-ignore\n const legendItem = target.delegate;\n\n // 图例聚焦功能\n if (target.name === LEGEND_ELEMENT_NAME.focus) {\n const isFocusSelected = legendItem.hasState(LegendStateValue.focus);\n legendItem.toggleState(LegendStateValue.focus);\n\n if (isFocusSelected) {\n // 当前为选中态,则再次点击变成全选\n this._itemsContainer?.getChildren().forEach(item => {\n this._removeLegendItemState(\n item as unknown as IGroup,\n [LegendStateValue.unSelected, LegendStateValue.unSelectedHover, LegendStateValue.focus],\n e\n );\n this._setLegendItemState(item as unknown as IGroup, LegendStateValue.selected, e);\n });\n } else {\n this._setLegendItemState(legendItem, LegendStateValue.selected, e);\n this._removeLegendItemState(legendItem, [LegendStateValue.unSelected, LegendStateValue.unSelectedHover], e);\n // 单选逻辑,当前被点击的图例项设置为选中态,其他全部设置为非选中态\n this._itemsContainer?.getChildren().forEach(item => {\n if (legendItem !== item) {\n this._removeLegendItemState(\n item as unknown as IGroup,\n [LegendStateValue.selected, LegendStateValue.selectedHover, LegendStateValue.focus],\n e\n );\n this._setLegendItemState(item as unknown as IGroup, LegendStateValue.unSelected, e);\n }\n });\n }\n } else {\n // 清除 focus 状态\n this._itemsContainer?.getChildren().forEach(item => {\n (item as unknown as IGroup).removeState(LegendStateValue.focus);\n });\n const { selectMode = 'multiple', allowAllCanceled = true } = this.attribute;\n const isSelected = legendItem.hasState(LegendStateValue.selected);\n const currentSelectedItems = this._getSelectedLegends();\n if (selectMode === 'multiple') {\n if (allowAllCanceled === false && isSelected && currentSelectedItems.length === 1) {\n this._dispatchEvent(LegendEvent.legendItemClick, legendItem, e);\n return;\n }\n // 多选逻辑\n if (isSelected) {\n // 如果当前为选中状态,则取消选中\n this._removeLegendItemState(legendItem, [LegendStateValue.selected, LegendStateValue.selectedHover], e);\n this._setLegendItemState(legendItem, LegendStateValue.unSelected, e);\n } else {\n // 如果当前为非选中态,则设置为选中状态\n this._setLegendItemState(legendItem, LegendStateValue.selected, e);\n this._removeLegendItemState(legendItem, [LegendStateValue.unSelected, LegendStateValue.unSelectedHover], e);\n }\n } else {\n this._setLegendItemState(legendItem, LegendStateValue.selected, e);\n this._removeLegendItemState(legendItem, [LegendStateValue.unSelected, LegendStateValue.unSelectedHover], e);\n\n // 单选逻辑,当前被点击的图例项设置为选中态,其他全部设置为非选中态\n this._itemsContainer?.getChildren().forEach(item => {\n if (legendItem !== item) {\n this._removeLegendItemState(\n item as unknown as IGroup,\n [LegendStateValue.selected, LegendStateValue.selectedHover],\n e\n );\n this._setLegendItemState(item as unknown as IGroup, LegendStateValue.unSelected, e);\n }\n });\n }\n }\n\n this._dispatchEvent(LegendEvent.legendItemClick, legendItem, e);\n }\n };\n\n private _setLegendItemState(legendItem: IGroup, stateName: string, e?: FederatedPointerEvent) {\n const keepCurrentStates = true;\n let attributeUpdate = false;\n if (!legendItem.hasState(stateName)) {\n attributeUpdate = true;\n }\n legendItem.addState(stateName, keepCurrentStates);\n // TODO: 这个比较 hack\n legendItem\n .getChildren()[0]\n .getChildren()\n .forEach((child: IGraphic) => {\n if (child.name !== LEGEND_ELEMENT_NAME.focus) {\n if (!attributeUpdate && !child.hasState(stateName)) {\n attributeUpdate = true;\n }\n (child as unknown as IGraphic).addState(stateName, keepCurrentStates);\n }\n });\n if (attributeUpdate) {\n this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem, e);\n }\n }\n\n private _removeLegendItemState(legendItem: IGroup, stateNames: string[], e?: FederatedPointerEvent) {\n let attributeUpdate = false;\n stateNames.forEach(name => {\n if (!attributeUpdate && legendItem.hasState(name)) {\n attributeUpdate = true;\n }\n legendItem.removeState(name);\n });\n // TODO: 这个比较 hack\n legendItem\n .getChildren()[0]\n .getChildren()\n .forEach(child => {\n if (child.name !== LEGEND_ELEMENT_NAME.focus) {\n stateNames.forEach(name => {\n if (!attributeUpdate && (child as unknown as IGraphic).hasState(name)) {\n attributeUpdate = true;\n }\n (child as unknown as IGraphic).removeState(name);\n });\n }\n });\n if (attributeUpdate) {\n this._dispatchEvent(LegendEvent.legendItemAttributeUpdate, legendItem, e);\n }\n }\n\n // 获取当前选中的图例项\n private _getSelectedLegends() {\n const selectedData: LegendItemDatum[] = [];\n this._itemsContainer?.getChildren().forEach(item => {\n if ((item as unknown as IGroup).hasState(LegendStateValue.selected)) {\n // @ts-ignore\n selectedData.push(item.data);\n }\n });\n\n return selectedData;\n }\n\n private _appendDataToShape(shape: any, name: string, data: any, delegateShape: any, states: any = {}) {\n shape.name = name;\n shape.data = data;\n shape.delegate = delegateShape;\n shape.states = merge({}, DEFAULT_STATES, states);\n }\n\n private _dispatchEvent(eventName: string, legendItem: any, event: FederatedPointerEvent) {\n const currentSelectedItems = this._getSelectedLegends();\n // 需要保持显示顺序\n currentSelectedItems.sort((pre: LegendItemDatum, next: LegendItemDatum) => pre.index - next.index);\n\n const currentSelected = currentSelectedItems.map((obj: LegendItemDatum) => obj.label);\n\n // 封装事件\n const changeEvent = new CustomEvent(eventName, {\n item: legendItem, // 当前被选中的图例项整体\n data: legendItem.data, // 当前图例项的数据\n selected: legendItem.hasState(LegendStateValue.selected), // 当前图例项是否被选中\n currentSelectedItems,\n currentSelected,\n event\n });\n // FIXME: 需要在 vrender 的事件系统支持\n // @ts-ignore\n changeEvent.manager = this.stage?.eventSystem.manager;\n\n this.dispatchEvent(changeEvent);\n }\n\n // 处理回调函数\n private _handleStyle(\n config: any,\n item: LegendItemDatum,\n isSelected: boolean,\n index: number,\n items: LegendItemDatum[]\n ) {\n const newConfig = merge({}, config);\n // 处理下样式\n if (config.style && isFunction(config.style)) {\n newConfig.style = config.style(item, isSelected, index, items);\n }\n if (config.state) {\n Object.keys(config.state).forEach(key => {\n if (config.state[key] && isFunction(config.state[key])) {\n newConfig.state[key] = config.state[key](item, isSelected, index, items);\n }\n });\n }\n\n return newConfig;\n }\n}\n"]}
@@ -4,10 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.smartInvertStrategy = exports.contrastAccessibilityChecker = exports.labelSmartInvert = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils"), defaultAlternativeColors = [ "#ffffff", "#000000" ];
7
+ const vutils_1 = require("@visactor/vutils"), defaultAlternativeColors = [ "#ffffff", "#000000" ], {Color: Color} = vutils_1.ColorUtil;
8
8
 
9
9
  function labelSmartInvert(foregroundColorOrigin, backgroundColorOrogin, textType, contrastRatiosThreshold, alternativeColors) {
10
- const foregroundColor = formatColorToHex(foregroundColorOrigin), backgroundColor = formatColorToHex(backgroundColorOrogin);
10
+ if ("string" != typeof foregroundColorOrigin || "string" != typeof backgroundColorOrogin) return foregroundColorOrigin;
11
+ const foregroundColor = new Color(foregroundColorOrigin).toHex(), backgroundColor = new Color(backgroundColorOrogin).toHex();
11
12
  return contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold) ? foregroundColor : improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
12
13
  }
13
14
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/util/label-smartInvert.ts"],"names":[],"mappings":";;;AACA,6CAA6C;AAE7C,MAAM,wBAAwB,GAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAQlE,SAAgB,gBAAgB,CAC9B,qBAAyC,EACzC,qBAAyC,EACzC,QAA6B,EAC7B,uBAAgC,EAChC,iBAAqC;IAErC,MAAM,eAAe,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;IAChE,MAAM,eAAe,GAAG,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;IAChE,IAAI,CAAC,4BAA4B,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,uBAAuB,CAAC,EAAE;QACtG,OAAO,sBAAsB,CAC3B,eAAe,EACf,eAAe,EACf,QAAQ,EACR,uBAAuB,EACvB,iBAAiB,CAClB,CAAC;KACH;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAnBD,4CAmBC;AASD,SAAS,sBAAsB,CAC7B,eAAmC,EACnC,eAAmC,EACnC,QAA6B,EAC7B,uBAAgC,EAChC,iBAAqC;IAErC,MAAM,wBAAwB,GAAa,EAAE,CAAC;IAC9C,IAAI,iBAAiB,EAAE;QACrB,IAAI,iBAAiB,YAAY,KAAK,EAAE;YACtC,wBAAwB,CAAC,IAAI,CAAC,GAAG,iBAAiB,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MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;IAC/C,OAAO,CAAC,CAAC;AACX,CAAC;AAQD,SAAS,gBAAgB,CAAC,WAA+B;IACvD,IAAK,WAAsB,aAAtB,WAAW,uBAAX,WAAW,CAAa,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC1C,OAAO,WAAW,CAAC;KACpB;IACD,MAAM,CAAC,GAAG,IAAI,kBAAS,CAAC,KAAK,CAAC,WAAqB,CAAC,CAAC;IACrD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC;IAC5B,OAAO,GAAG,GAAG,kBAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,SAAgB,mBAAmB,CACjC,YAAoB,EACpB,SAAiB,EACjB,WAAmB,EACnB,YAAoB;IAEpB,IAAI,MAAM,CAAC;IACX,QAAQ,YAAY,EAAE;QACpB,KAAK,MAAM;YACT,MAAM,GAAG,SAAS,CAAC;YACnB,MAAM;QACR,KAAK,YAAY;YACf,MAAM,GAAG,WAAW,CAAC;YACrB,MAAM;QACR,KAAK,aAAa;YAChB,MAAM,GAAG,YAAY,CAAC;QACxB;YACE,MAAM;KACT;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AApBD,kDAoBC","file":"label-smartInvert.js","sourcesContent":["import type { IColor } from '@visactor/vrender';\nimport { ColorUtil } from '@visactor/vutils';\n\nconst defaultAlternativeColors: string[] = ['#ffffff', '#000000'];\n\n/**\n * 标签智能反色\n * @param foregroundColorOrigin\n * @param backgroundColorOrogin\n * @returns\n */\nexport function labelSmartInvert(\n foregroundColorOrigin: IColor | undefined,\n backgroundColorOrogin: IColor | undefined,\n textType?: string | undefined,\n contrastRatiosThreshold?: number,\n alternativeColors?: string | string[]\n): IColor | undefined {\n const foregroundColor = formatColorToHex(foregroundColorOrigin);\n const backgroundColor = formatColorToHex(backgroundColorOrogin);\n if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold)) {\n return improveContrastReverse(\n foregroundColor,\n backgroundColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n );\n }\n return foregroundColor;\n}\n\n/**\n * 提升对比度\n * 对于对比度不足阈值的情况,推荐备选颜色色板中的颜色提升对比\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nfunction improveContrastReverse(\n foregroundColor: IColor | undefined,\n backgroundColor: IColor | undefined,\n textType?: IColor | undefined,\n contrastRatiosThreshold?: number,\n alternativeColors?: string | string[]\n) {\n const alternativeColorPalletes: string[] = [];\n if (alternativeColors) {\n if (alternativeColors instanceof Array) {\n alternativeColorPalletes.push(...alternativeColors);\n } else {\n alternativeColorPalletes.push(alternativeColors);\n }\n }\n alternativeColorPalletes.push(...defaultAlternativeColors);\n for (const alternativeColor of alternativeColorPalletes) {\n if (foregroundColor === alternativeColor) {\n continue;\n }\n if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold)) {\n return alternativeColor;\n }\n }\n return undefined;\n}\n\n/**\n * 颜色对比度可行性检查 https://webaim.org/articles/contrast/\n * - WCAG 2.0 AA 级要求普通文本的对比度至少为 4.5:1,大文本的对比度至少为 3:1。(目前按照此标准)\n * - WCAG 2.1 要求图形和用户界面组件(例如表单输入边框)的对比度至少为 3:1。\n * - WCAG AAA 级要求普通文本的对比度至少为 7:1,大文本的对比度至少为 4.5:1。\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nexport function contrastAccessibilityChecker(\n foregroundColor: IColor | undefined,\n backgroundColor: IColor | undefined,\n textType?: IColor | undefined,\n contrastRatiosThreshold?: number\n): boolean {\n //Contrast ratios can range from 1 to 21\n if (contrastRatiosThreshold) {\n if (contrastRatios(foregroundColor, backgroundColor) > contrastRatiosThreshold) {\n return true;\n }\n return false;\n } else if (textType === 'largeText') {\n if (contrastRatios(foregroundColor, backgroundColor) > 3) {\n return true;\n }\n return false;\n }\n if (contrastRatios(foregroundColor, backgroundColor) > 4.5) {\n return true;\n }\n return false;\n}\n\n/**\n * 计算颜色对比度 https://webaim.org/articles/contrast/\n * Contrast ratios can range from 1 to 21 (commonly written 1:1 to 21:1).\n * (L1 + 0.05) / (L2 + 0.05), whereby:\n * L1 is the relative luminance of the lighter of the colors, and\n * L2 is the relative luminance of the darker of the colors.\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nfunction contrastRatios(foregroundColor: IColor | undefined, backgroundColor: IColor | undefined): number {\n const foregroundColorLuminance = getColorLuminance(foregroundColor as string);\n const backgroundColorLuminance = getColorLuminance(backgroundColor as string);\n const L1 = foregroundColorLuminance > backgroundColorLuminance ? foregroundColorLuminance : backgroundColorLuminance;\n const L2 = foregroundColorLuminance > backgroundColorLuminance ? backgroundColorLuminance : foregroundColorLuminance;\n const contrastRatios = (L1 + 0.05) / (L2 + 0.05);\n return contrastRatios;\n}\n\n/**\n * 计算相对亮度 https://webaim.org/articles/contrast/\n * the relative brightness of any point in a colorspace, normalized to 0 for darkest black and 1 for lightest white\n * Note 1: For the sRGB colorspace, the relative luminance of a color is defined as\n * L = 0.2126 * R + 0.7152 * G + 0.0722 * B where R, G and B are defined as:\n * if RsRGB <= 0.03928 then R = RsRGB/12.92 else R = ((RsRGB+0.055)/1.055) ^ 2.4\n * if GsRGB <= 0.03928 then G = GsRGB/12.92 else G = ((GsRGB+0.055)/1.055) ^ 2.4\n * if BsRGB <= 0.03928 then B = BsRGB/12.92 else B = ((BsRGB+0.055)/1.055) ^ 2.4\n * and RsRGB, GsRGB, and BsRGB are defined as:\n * RsRGB = R8bit/255\n * GsRGB = G8bit/255\n * BsRGB = B8bit/255\n * @param color\n * @returns\n */\nfunction getColorLuminance(color: string): number {\n const rgb8bit = ColorUtil.hexToRgb(color);\n const RsRGB = rgb8bit[0] / 255;\n const GsRGB = rgb8bit[1] / 255;\n const BsRGB = rgb8bit[2] / 255;\n let R;\n let G;\n let B;\n if (RsRGB <= 0.03928) {\n R = RsRGB / 12.92;\n } else {\n R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);\n }\n if (GsRGB <= 0.03928) {\n G = GsRGB / 12.92;\n } else {\n G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);\n }\n if (BsRGB <= 0.03928) {\n B = BsRGB / 12.92;\n } else {\n B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);\n }\n const L = 0.2126 * R + 0.7152 * G + 0.0722 * B;\n return L;\n}\n\n/**\n * 规范化color格式为hex\n * 当color为颜色名称或rgb时,对其进行规范化处理\n * @param originColor\n * @returns\n */\nfunction formatColorToHex(originColor: IColor | undefined) {\n if ((originColor as string)?.includes('#')) {\n return originColor;\n }\n const c = new ColorUtil.Color(originColor as string);\n const { r, g, b } = c.color;\n return '#' + ColorUtil.rgbToHex(r, g, b);\n}\n\nexport function smartInvertStrategy(\n fillStrategy: string,\n baseColor: IColor,\n invertColor: IColor,\n similarColor: IColor\n) {\n let result;\n switch (fillStrategy) {\n case 'base':\n result = baseColor;\n break;\n case 'invertBase':\n result = invertColor;\n break;\n case 'similarBase':\n result = similarColor;\n default:\n break;\n }\n return result;\n}\n"]}
1
+ {"version":3,"sources":["../src/util/label-smartInvert.ts"],"names":[],"mappings":";;;AACA,6CAA6C;AAE7C,MAAM,wBAAwB,GAAa,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAClE,MAAM,EAAE,KAAK,EAAE,GAAG,kBAAS,CAAC;AAQ5B,SAAgB,gBAAgB,CAC9B,qBAAyC,EACzC,qBAAyC,EACzC,QAA6B,EAC7B,uBAAgC,EAChC,iBAAqC;IAErC,IAAI,OAAO,qBAAqB,KAAK,QAAQ,IAAI,OAAO,qBAAqB,KAAK,QAAQ,EAAE;QAC1F,OAAO,qBAAqB,CAAC;KAC9B;IACD,MAAM,eAAe,GAAG,IAAI,KAAK,CAAC,qBAA+B,CAAC,CAAC,KAAK,EAAE,CAAC;IAC3E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,GAAG,SAAS,CAAC;YACnB,MAAM;QACR,KAAK,YAAY;YACf,MAAM,GAAG,WAAW,CAAC;YACrB,MAAM;QACR,KAAK,aAAa;YAChB,MAAM,GAAG,YAAY,CAAC;QACxB;YACE,MAAM;KACT;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AApBD,kDAoBC","file":"label-smartInvert.js","sourcesContent":["import type { IColor } from '@visactor/vrender';\nimport { ColorUtil } from '@visactor/vutils';\n\nconst defaultAlternativeColors: string[] = ['#ffffff', '#000000'];\nconst { Color } = ColorUtil;\n\n/**\n * 标签智能反色\n * @param foregroundColorOrigin\n * @param backgroundColorOrogin\n * @returns\n */\nexport function labelSmartInvert(\n foregroundColorOrigin: IColor | undefined,\n backgroundColorOrogin: IColor | undefined,\n textType?: string | undefined,\n contrastRatiosThreshold?: number,\n alternativeColors?: string | string[]\n): IColor | undefined {\n if (typeof foregroundColorOrigin !== 'string' || typeof backgroundColorOrogin !== 'string') {\n return foregroundColorOrigin;\n }\n const foregroundColor = new Color(foregroundColorOrigin as string).toHex();\n const backgroundColor = new Color(backgroundColorOrogin as string).toHex();\n if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold)) {\n return improveContrastReverse(\n foregroundColor,\n backgroundColor,\n textType,\n contrastRatiosThreshold,\n alternativeColors\n );\n }\n return foregroundColor;\n}\n\n/**\n * 提升对比度\n * 对于对比度不足阈值的情况,推荐备选颜色色板中的颜色提升对比\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nfunction improveContrastReverse(\n foregroundColor: IColor | undefined,\n backgroundColor: IColor | undefined,\n textType?: IColor | undefined,\n contrastRatiosThreshold?: number,\n alternativeColors?: string | string[]\n) {\n const alternativeColorPalletes: string[] = [];\n if (alternativeColors) {\n if (alternativeColors instanceof Array) {\n alternativeColorPalletes.push(...alternativeColors);\n } else {\n alternativeColorPalletes.push(alternativeColors);\n }\n }\n alternativeColorPalletes.push(...defaultAlternativeColors);\n for (const alternativeColor of alternativeColorPalletes) {\n if (foregroundColor === alternativeColor) {\n continue;\n }\n if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold)) {\n return alternativeColor;\n }\n }\n return undefined;\n}\n\n/**\n * 颜色对比度可行性检查 https://webaim.org/articles/contrast/\n * - WCAG 2.0 AA 级要求普通文本的对比度至少为 4.5:1,大文本的对比度至少为 3:1。(目前按照此标准)\n * - WCAG 2.1 要求图形和用户界面组件(例如表单输入边框)的对比度至少为 3:1。\n * - WCAG AAA 级要求普通文本的对比度至少为 7:1,大文本的对比度至少为 4.5:1。\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nexport function contrastAccessibilityChecker(\n foregroundColor: IColor | undefined,\n backgroundColor: IColor | undefined,\n textType?: IColor | undefined,\n contrastRatiosThreshold?: number\n): boolean {\n //Contrast ratios can range from 1 to 21\n if (contrastRatiosThreshold) {\n if (contrastRatios(foregroundColor, backgroundColor) > contrastRatiosThreshold) {\n return true;\n }\n return false;\n } else if (textType === 'largeText') {\n if (contrastRatios(foregroundColor, backgroundColor) > 3) {\n return true;\n }\n return false;\n }\n if (contrastRatios(foregroundColor, backgroundColor) > 4.5) {\n return true;\n }\n return false;\n}\n\n/**\n * 计算颜色对比度 https://webaim.org/articles/contrast/\n * Contrast ratios can range from 1 to 21 (commonly written 1:1 to 21:1).\n * (L1 + 0.05) / (L2 + 0.05), whereby:\n * L1 is the relative luminance of the lighter of the colors, and\n * L2 is the relative luminance of the darker of the colors.\n * @param foregroundColor\n * @param backgroundColor\n * @returns\n */\nfunction contrastRatios(foregroundColor: IColor | undefined, backgroundColor: IColor | undefined): number {\n const foregroundColorLuminance = getColorLuminance(foregroundColor as string);\n const backgroundColorLuminance = getColorLuminance(backgroundColor as string);\n const L1 = foregroundColorLuminance > backgroundColorLuminance ? foregroundColorLuminance : backgroundColorLuminance;\n const L2 = foregroundColorLuminance > backgroundColorLuminance ? backgroundColorLuminance : foregroundColorLuminance;\n const contrastRatios = (L1 + 0.05) / (L2 + 0.05);\n return contrastRatios;\n}\n\n/**\n * 计算相对亮度 https://webaim.org/articles/contrast/\n * the relative brightness of any point in a colorspace, normalized to 0 for darkest black and 1 for lightest white\n * Note 1: For the sRGB colorspace, the relative luminance of a color is defined as\n * L = 0.2126 * R + 0.7152 * G + 0.0722 * B where R, G and B are defined as:\n * if RsRGB <= 0.03928 then R = RsRGB/12.92 else R = ((RsRGB+0.055)/1.055) ^ 2.4\n * if GsRGB <= 0.03928 then G = GsRGB/12.92 else G = ((GsRGB+0.055)/1.055) ^ 2.4\n * if BsRGB <= 0.03928 then B = BsRGB/12.92 else B = ((BsRGB+0.055)/1.055) ^ 2.4\n * and RsRGB, GsRGB, and BsRGB are defined as:\n * RsRGB = R8bit/255\n * GsRGB = G8bit/255\n * BsRGB = B8bit/255\n * @param color\n * @returns\n */\nfunction getColorLuminance(color: string): number {\n const rgb8bit = ColorUtil.hexToRgb(color);\n const RsRGB = rgb8bit[0] / 255;\n const GsRGB = rgb8bit[1] / 255;\n const BsRGB = rgb8bit[2] / 255;\n let R;\n let G;\n let B;\n if (RsRGB <= 0.03928) {\n R = RsRGB / 12.92;\n } else {\n R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);\n }\n if (GsRGB <= 0.03928) {\n G = GsRGB / 12.92;\n } else {\n G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);\n }\n if (BsRGB <= 0.03928) {\n B = BsRGB / 12.92;\n } else {\n B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);\n }\n const L = 0.2126 * R + 0.7152 * G + 0.0722 * B;\n return L;\n}\n\n/**\n * 规范化color格式为hex\n * 当color为颜色名称或rgb时,对其进行规范化处理\n * @param originColor\n * @returns\n */\nfunction formatColorToHex(originColor: IColor | undefined) {\n if ((originColor as string)?.includes('#')) {\n return originColor;\n }\n const c = new ColorUtil.Color(originColor as string);\n const { r, g, b } = c.color;\n return '#' + ColorUtil.rgbToHex(r, g, b);\n}\n\nexport function smartInvertStrategy(\n fillStrategy: string,\n baseColor: IColor,\n invertColor: IColor,\n similarColor: IColor\n) {\n let result;\n switch (fillStrategy) {\n case 'base':\n result = baseColor;\n break;\n case 'invertBase':\n result = invertColor;\n break;\n case 'similarBase':\n result = similarColor;\n default:\n break;\n }\n return result;\n}\n"]}
package/dist/index.js CHANGED
@@ -403,9 +403,13 @@
403
403
  }
404
404
 
405
405
  const defaultAlternativeColors = ['#ffffff', '#000000'];
406
+ const { Color } = vutils.ColorUtil;
406
407
  function labelSmartInvert(foregroundColorOrigin, backgroundColorOrogin, textType, contrastRatiosThreshold, alternativeColors) {
407
- const foregroundColor = formatColorToHex(foregroundColorOrigin);
408
- const backgroundColor = formatColorToHex(backgroundColorOrogin);
408
+ if (typeof foregroundColorOrigin !== 'string' || typeof backgroundColorOrogin !== 'string') {
409
+ return foregroundColorOrigin;
410
+ }
411
+ const foregroundColor = new Color(foregroundColorOrigin).toHex();
412
+ const backgroundColor = new Color(backgroundColorOrogin).toHex();
409
413
  if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold)) {
410
414
  return improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
411
415
  }
@@ -487,14 +491,6 @@
487
491
  const L = 0.2126 * R + 0.7152 * G + 0.0722 * B;
488
492
  return L;
489
493
  }
490
- function formatColorToHex(originColor) {
491
- if (originColor === null || originColor === void 0 ? void 0 : originColor.includes('#')) {
492
- return originColor;
493
- }
494
- const c = new vutils.ColorUtil.Color(originColor);
495
- const { r, g, b } = c.color;
496
- return '#' + vutils.ColorUtil.rgbToHex(r, g, b);
497
- }
498
494
  function smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor) {
499
495
  let result;
500
496
  switch (fillStrategy) {
@@ -2032,13 +2028,14 @@
2032
2028
  return listener;
2033
2029
  }
2034
2030
  _smartInvert(labels) {
2035
- var _a, _b, _c, _d;
2031
+ var _a, _b, _c, _d, _e;
2036
2032
  const option = (this.attribute.smartInvert || {});
2037
2033
  const { textType, contrastRatiosThreshold, alternativeColors } = option;
2038
2034
  const fillStrategy = (_a = option.fillStrategy) !== null && _a !== void 0 ? _a : 'invertBase';
2039
2035
  const strokeStrategy = (_b = option.strokeStrategy) !== null && _b !== void 0 ? _b : 'base';
2040
2036
  const brightColor = (_c = option.brightColor) !== null && _c !== void 0 ? _c : '#ffffff';
2041
2037
  const darkColor = (_d = option.darkColor) !== null && _d !== void 0 ? _d : '#000000';
2038
+ const outsideEnable = (_e = option.outsideEnable) !== null && _e !== void 0 ? _e : false;
2042
2039
  if (fillStrategy === 'null' && strokeStrategy === 'null') {
2043
2040
  return;
2044
2041
  }
@@ -2048,13 +2045,12 @@
2048
2045
  continue;
2049
2046
  }
2050
2047
  const baseMark = this._idToGraphic.get(label.attribute.id);
2051
- const isInside = this._canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
2052
2048
  const backgroundColor = baseMark.attribute.fill;
2053
2049
  const foregroundColor = label.attribute.fill;
2054
2050
  const baseColor = backgroundColor;
2055
2051
  const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
2056
2052
  const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
2057
- if (isInside) {
2053
+ if (outsideEnable) {
2058
2054
  const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2059
2055
  fill && label.setAttributes({ fill });
2060
2056
  if (label.attribute.lineWidth === 0) {
@@ -2064,19 +2060,31 @@
2064
2060
  stroke && label.setAttributes({ stroke });
2065
2061
  }
2066
2062
  else {
2067
- if (label.attribute.lineWidth === 0) {
2068
- continue;
2063
+ const isInside = this._canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
2064
+ if (isInside) {
2065
+ const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2066
+ fill && label.setAttributes({ fill });
2067
+ if (label.attribute.lineWidth === 0) {
2068
+ continue;
2069
+ }
2070
+ const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2071
+ stroke && label.setAttributes({ stroke });
2069
2072
  }
2070
- if (label.attribute.stroke) {
2071
- label.setAttributes({
2072
- fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
2073
- });
2074
- continue;
2073
+ else {
2074
+ if (label.attribute.lineWidth === 0) {
2075
+ continue;
2076
+ }
2077
+ if (label.attribute.stroke) {
2078
+ label.setAttributes({
2079
+ fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
2080
+ });
2081
+ continue;
2082
+ }
2083
+ const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2084
+ fill && label.setAttributes({ fill });
2085
+ const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2086
+ stroke && label.setAttributes({ stroke });
2075
2087
  }
2076
- const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
2077
- fill && label.setAttributes({ fill });
2078
- const stroke = smartInvertStrategy(strokeStrategy, baseColor, invertColor, similarColor);
2079
- stroke && label.setAttributes({ stroke });
2080
2088
  }
2081
2089
  }
2082
2090
  }
@@ -7639,7 +7647,7 @@
7639
7647
  opacity: 0.85
7640
7648
  },
7641
7649
  unSelected: {
7642
- fill: '#D8D8D8'
7650
+ opacity: 0.5
7643
7651
  }
7644
7652
  }
7645
7653
  },
@@ -10495,7 +10503,7 @@
10495
10503
  return new Tag(params ? params.attribute : {});
10496
10504
  }
10497
10505
 
10498
- const version = "0.15.3";
10506
+ const version = "0.15.4";
10499
10507
 
10500
10508
  exports.AbstractComponent = AbstractComponent;
10501
10509
  exports.ArcInfo = ArcInfo;