@visactor/vgrammar-core 0.13.6 → 0.13.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,12 +15,12 @@ import { invokeEncoderToItems } from "./mark/encode";
15
15
  export class GlyphElement extends Element {
16
16
  constructor(mark) {
17
17
  super(mark), this.getStateAttrs = (stateName, nextStates) => {
18
- var _a, _b, _c;
19
- const isRuntimeState = !isNil(null === (_a = this.runtimeStatesEncoder) || void 0 === _a ? void 0 : _a[stateName]), encoder = isRuntimeState ? this.runtimeStatesEncoder[stateName] : null === (_b = this.mark.getSpec().encode) || void 0 === _b ? void 0 : _b[stateName], glyphStateAttributes = {};
18
+ var _a, _b, _c, _d;
19
+ const isRuntimeState = !isNil(null === (_a = this.runtimeStatesEncoder) || void 0 === _a ? void 0 : _a[stateName]), encoder = isRuntimeState ? Object.assign(Object.assign({}, null === (_b = this.mark.getSpec().encode) || void 0 === _b ? void 0 : _b[stateName]), this.runtimeStatesEncoder[stateName]) : null === (_c = this.mark.getSpec().encode) || void 0 === _c ? void 0 : _c[stateName], glyphStateAttributes = {};
20
20
  if (!encoder) return glyphStateAttributes;
21
21
  if (isFunction(encoder)) return glyphStateAttributes.attributes = encoder(this.getDatum(), this, stateName, nextStates),
22
22
  glyphStateAttributes;
23
- if (!isRuntimeState && (null === (_c = this.graphicItem.glyphStates) || void 0 === _c ? void 0 : _c[stateName])) return this.graphicItem.glyphStates[stateName];
23
+ if (!isRuntimeState && (null === (_d = this.graphicItem.glyphStates) || void 0 === _d ? void 0 : _d[stateName])) return this.graphicItem.glyphStates[stateName];
24
24
  if (encoder) {
25
25
  const item = this.items[0], targetItems = [ Object.assign({}, item, {
26
26
  nextAttrs: {}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/glyph-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC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,IAAI,EAAE,QAAQ,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,sBAAsB;QACpB,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACrD,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,yBAAyB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;gBAC1D,WAAW,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;YACvC,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;SAC/B;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF","file":"glyph-element.js","sourcesContent":["import { has, isNil, isBoolean, isFunction } from '@visactor/vutils';\nimport { isEqual } from '@visactor/vgrammar-util';\nimport type {\n IGlyphElement,\n IGlyphMark,\n MarkElementItem,\n MarkSpec,\n IGlyphMeta,\n MarkType,\n StateProxyEncodeSpec\n} from '../types';\nimport { cloneTransformAttributes, transformAttributes } from './attributes/transform';\nimport { BridgeElementKey, CollectionMarkType } from './constants';\nimport { DiffState, HOOK_EVENT, GrammarMarkType } from './enums';\nimport { Element } from './element';\nimport { invokeEncoderToItems } from './mark/encode';\nimport type { IGraphicAttribute, IGlyph } from '@visactor/vrender-core';\n\nexport class GlyphElement extends Element implements IGlyphElement {\n declare graphicItem: IGlyph;\n\n declare mark: IGlyphMark;\n protected glyphGraphicItems: { [markName: string]: any };\n\n private glyphMeta: IGlyphMeta;\n\n constructor(mark: IGlyphMark) {\n super(mark);\n this.glyphMeta = this.mark.getGlyphMeta();\n }\n\n getGlyphGraphicItems() {\n return this.glyphGraphicItems;\n }\n\n initGraphicItem(attributes: any = {}) {\n if (this.graphicItem) {\n return;\n }\n\n this.graphicItem = this.mark.addGraphicItem(attributes, this.groupKey) as IGlyph;\n this.graphicItem[BridgeElementKey] = this;\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n\n const glyphMarks = this.glyphMeta.getMarks();\n this.glyphGraphicItems = {};\n this.graphicItem.getSubGraphic().forEach((graphic: any) => {\n const markType = glyphMarks[graphic.name];\n this.glyphGraphicItems[graphic.name] = graphic;\n graphic.onBeforeAttributeUpdate = (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const graphicAttributes = transformAttributes(markType, attributes, this, graphic.name);\n return graphicAttributes;\n };\n });\n\n this.clearGraphicAttributes();\n }\n\n useStates(states: string[], hasAnimation?: boolean) {\n if (!this.graphicItem) {\n return false;\n }\n this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_STATE, { states }, this);\n\n this.states = states.slice();\n\n const stateAnimationEnable = isBoolean(hasAnimation)\n ? hasAnimation\n : this.mark.animate.getAnimationConfigs('state').length !== 0;\n\n this.graphicItem.glyphStateProxy = this.getStateAttrs;\n this.graphicItem.useStates(this.states, stateAnimationEnable);\n\n this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_STATE, { states }, this);\n\n return true;\n }\n\n protected getStateAttrs = (stateName: string, nextStates: string[]) => {\n const isRuntimeState = !isNil(this.runtimeStatesEncoder?.[stateName]);\n const encoder = isRuntimeState\n ? this.runtimeStatesEncoder[stateName]\n : (this.mark.getSpec() as MarkSpec).encode?.[stateName];\n\n const glyphStateAttributes = {} as {\n attributes: Partial<IGraphicAttribute>;\n subAttributes: Partial<IGraphicAttribute>[];\n };\n\n if (!encoder) {\n return glyphStateAttributes;\n }\n\n if (isFunction(encoder)) {\n glyphStateAttributes.attributes = (encoder as StateProxyEncodeSpec)(this.getDatum(), this, stateName, nextStates);\n return glyphStateAttributes;\n }\n\n if (!isRuntimeState && this.graphicItem.glyphStates?.[stateName]) {\n return this.graphicItem.glyphStates[stateName];\n }\n\n if (encoder) {\n const item = this.items[0];\n const targetItems = [Object.assign({}, item, { nextAttrs: {} })];\n\n invokeEncoderToItems(this, targetItems, encoder, (this.mark as any).parameters());\n this.coordinateTransformEncode(targetItems);\n\n glyphStateAttributes.attributes = targetItems[0].nextAttrs;\n\n if (!this.graphicItem.glyphStates) {\n this.graphicItem.glyphStates = { [stateName]: glyphStateAttributes };\n } else if (!this.graphicItem.glyphStates[stateName]) {\n this.graphicItem.glyphStates[stateName] = glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n };\n\n encodeGraphic() {\n this.coordinateTransformEncode(this.items);\n const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);\n\n if (!this.graphicItem) {\n this.initGraphicItem();\n }\n\n if (this.diffState === DiffState.enter) {\n // apply default encoder when enter\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(true);\n this.applyGraphicAttributes(graphicAttributes);\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n } else {\n this.applyGraphicAttributes(graphicAttributes);\n }\n\n if ((this.diffState === DiffState.enter || this.diffState === DiffState.update) && this.states.length) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n // 更新数据流后,states计算不缓存\n graphicItem.states = {};\n });\n this.useStates(this.states);\n }\n\n // clear item attributes\n this.items.map(item => {\n item.nextAttrs = {};\n });\n }\n\n encodeCustom(nextAttrs?: any): { [markName: string]: any } {\n let customEncodeValues: { [markName: string]: any } = {};\n const channelEncoder = this.glyphMeta.getChannelEncoder();\n const functionEncoder = this.glyphMeta.getFunctionEncoder();\n\n if (functionEncoder) {\n customEncodeValues = functionEncoder.call(\n null,\n Object.assign({}, this.graphicItem?.attribute, nextAttrs),\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n }\n if (channelEncoder) {\n // TODO: maybe delete origin encode value?\n let allAttrs: any;\n Object.keys(channelEncoder).forEach(channel => {\n if (!isNil(nextAttrs[channel])) {\n if (!allAttrs) {\n allAttrs = Object.assign({}, this.graphicItem?.attribute, nextAttrs);\n }\n const encodeResult = channelEncoder[channel].call(\n null,\n channel,\n nextAttrs[channel],\n allAttrs,\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n Object.keys(encodeResult ?? {}).forEach(markName => {\n customEncodeValues[markName] = Object.assign(customEncodeValues[markName] ?? {}, encodeResult[markName]);\n });\n }\n });\n }\n return customEncodeValues;\n }\n\n private encodeDefault() {\n const defaultEncodeValues: { [markName: string]: any } = {};\n // apply default encode\n if (this.diffState === DiffState.enter && this.glyphMeta.getDefaultEncoder()) {\n const defaultEncodeResult = this.glyphMeta\n .getDefaultEncoder()\n .call(null, this.getDatum(), this, this.mark.getGlyphConfig());\n Object.assign(defaultEncodeValues, defaultEncodeResult);\n }\n return defaultEncodeValues;\n }\n\n private _onGlyphAttributeUpdate(first: boolean = false) {\n return (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const glyphMarks = this.glyphMeta.getMarks();\n\n const graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this);\n\n // apply default encode\n const defaultEncodeValues = first ? this.encodeDefault() : null;\n // apply custom encode\n const customEncodeValues = this.encodeCustom(attributes);\n\n Object.keys(glyphMarks).forEach(markName => {\n const markType = glyphMarks[markName];\n const graphicItem = this.glyphGraphicItems[markName];\n const customAttributes = customEncodeValues?.[markName];\n const additionalAttributes = Object.assign({}, customAttributes);\n if (first) {\n // apply default attributes when visual channel is not set\n const defaultAttributes = defaultEncodeValues?.[markName];\n Object.keys(defaultAttributes ?? {}).forEach(key => {\n if (!has(this.items[0].nextAttrs, key) && !has(additionalAttributes, key)) {\n additionalAttributes[key] = defaultAttributes[key];\n }\n });\n }\n const glyphAttributes = Object.assign({}, cloneTransformAttributes(markType, attributes), additionalAttributes);\n const glyphItems = this._generateGlyphItems(markType, this.items, glyphAttributes);\n this.coordinateTransformEncode(glyphItems);\n const graphicAttributes = this.transformElementItems(glyphItems, markType);\n\n this.applyGlyphGraphicAttributes(graphicAttributes, markName, graphicItem);\n\n if (markType === GrammarMarkType.shape) {\n // FIXME: shape需要拿到原始数据进行编码,暂时把数据绑定到graphicItem上,看后续graphicItem是否需要支持数据绑定\n graphicItem.datum = glyphItems[0].datum;\n }\n });\n\n return graphicAttributes;\n };\n }\n\n private _generateGlyphItems(markType: MarkType, items: MarkElementItem[], additionalAttributes: any) {\n const glyphItems = items.map(item => Object.assign({}, item, { nextAttrs: additionalAttributes }));\n\n if ((CollectionMarkType as string[]).includes(markType) && this.mark.getSpec().enableSegments) {\n // segment mark require all items to apply additional attributes\n glyphItems.forEach((glyphItem, index) => {\n glyphItem.nextAttrs = Object.assign({}, items[index].nextAttrs, additionalAttributes);\n });\n }\n\n return glyphItems;\n }\n\n getGraphicAttribute(channel: string, prev: boolean = false, markName?: any) {\n if (!this.graphicItem) {\n return undefined;\n }\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n if (prev && has(prevGraphicAttributes, channel)) {\n return prevGraphicAttributes[channel];\n }\n\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.attribute[channel];\n }\n\n setGraphicAttribute(channel: string, value: any, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n if (final) {\n finalGraphicAttributes[channel] = value;\n }\n if (!has(prevGraphicAttributes, channel)) {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n }\n\n graphicItem.setAttribute(channel, value);\n }\n\n setGraphicAttributes(attributes: { [channel: string]: any }, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n Object.keys(attributes).forEach(key => {\n if (final) {\n finalGraphicAttributes[key] = attributes[key];\n }\n if (!has(prevGraphicAttributes, key)) {\n prevGraphicAttributes[key] = graphicItem.attribute[key];\n }\n });\n\n graphicItem.setAttributes(attributes);\n }\n\n protected diffAttributes(graphicAttributes: { [channel: string]: any }, markName?: string) {\n const diffResult = {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n for (const key in graphicAttributes) {\n if (!isEqual(key, finalGraphicAttributes, graphicAttributes)) {\n diffResult[key] = graphicAttributes[key];\n }\n }\n return diffResult;\n }\n\n protected applyGlyphGraphicAttributes(graphicAttributes: any, markName: string, graphicItem: any): void {\n if (this.mark.needAnimate()) {\n // If mark need animate, diff attributes.\n const nextGraphicAttributes = this.diffAttributes(graphicAttributes, markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName) ?? {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName) ?? {};\n Object.keys(nextGraphicAttributes).forEach(channel => {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n finalGraphicAttributes[channel] = nextGraphicAttributes[channel];\n });\n this.setNextGraphicAttributes(nextGraphicAttributes, markName);\n this.setPrevGraphicAttributes(prevGraphicAttributes, markName);\n this.setFinalGraphicAttributes(finalGraphicAttributes, markName);\n\n // Apply next attributes to current graphic item immediately.\n // Scene graph tree should be handled like no animation exists in dataflow procedure.\n graphicItem.setAttributes(nextGraphicAttributes);\n } else {\n graphicItem.setAttributes(graphicAttributes);\n }\n }\n\n getFinalGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.finalAttrs;\n }\n\n protected setFinalGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.finalAttrs = attributes;\n }\n\n getPrevGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.prevAttrs;\n }\n\n protected setPrevGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.prevAttrs = attributes;\n }\n\n getNextGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.nextAttrs;\n }\n\n protected setNextGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.nextAttrs = attributes;\n }\n\n clearChangedGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n });\n }\n\n clearGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n this.setFinalGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n this.setFinalGraphicAttributes(null, markName);\n });\n }\n\n remove() {\n this.glyphGraphicItems = null;\n super.remove();\n }\n\n release() {\n if (this.glyphGraphicItems) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n graphicItem[BridgeElementKey] = null;\n });\n this.glyphGraphicItems = null;\n }\n super.release();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/graph/glyph-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAUlD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,OAAO,YAAa,SAAQ,OAAO;IAQvC,YAAY,IAAgB;QAC1B,KAAK,CAAC,IAAI,CAAC,CAAC;QAuDJ,kBAAa,GAAG,CAAC,SAAiB,EAAE,UAAoB,EAAE,EAAE;;YACpE,MAAM,cAAc,GAAG,CAAC,KAAK,CAAC,MAAA,IAAI,CAAC,oBAAoB,0CAAG,SAAS,CAAC,CAAC,CAAC;YACtE,MAAM,OAAO,GAAG,cAAc;gBAC5B,CAAC,iCACM,MAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAe,CAAC,MAAM,0CAAG,SAAS,CAAC,GACrD,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAE3C,CAAC,CAAC,MAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAe,CAAC,MAAM,0CAAG,SAAS,CAAC,CAAC;YAE1D,MAAM,oBAAoB,GAAG,EAG5B,CAAC;YAEF,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,oBAAoB,CAAC;aAC7B;YAED,IAAI,UAAU,CAAC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B;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF","file":"glyph-element.js","sourcesContent":["import { has, isNil, isBoolean, isFunction } from '@visactor/vutils';\nimport { isEqual } from '@visactor/vgrammar-util';\nimport type {\n IGlyphElement,\n IGlyphMark,\n MarkElementItem,\n MarkSpec,\n IGlyphMeta,\n MarkType,\n StateProxyEncodeSpec\n} from '../types';\nimport { cloneTransformAttributes, transformAttributes } from './attributes/transform';\nimport { BridgeElementKey, CollectionMarkType } from './constants';\nimport { DiffState, HOOK_EVENT, GrammarMarkType } from './enums';\nimport { Element } from './element';\nimport { invokeEncoderToItems } from './mark/encode';\nimport type { IGraphicAttribute, IGlyph } from '@visactor/vrender-core';\n\nexport class GlyphElement extends Element implements IGlyphElement {\n declare graphicItem: IGlyph;\n\n declare mark: IGlyphMark;\n protected glyphGraphicItems: { [markName: string]: any };\n\n private glyphMeta: IGlyphMeta;\n\n constructor(mark: IGlyphMark) {\n super(mark);\n this.glyphMeta = this.mark.getGlyphMeta();\n }\n\n getGlyphGraphicItems() {\n return this.glyphGraphicItems;\n }\n\n initGraphicItem(attributes: any = {}) {\n if (this.graphicItem) {\n return;\n }\n\n this.graphicItem = this.mark.addGraphicItem(attributes, this.groupKey) as IGlyph;\n this.graphicItem[BridgeElementKey] = this;\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n\n const glyphMarks = this.glyphMeta.getMarks();\n this.glyphGraphicItems = {};\n this.graphicItem.getSubGraphic().forEach((graphic: any) => {\n const markType = glyphMarks[graphic.name];\n this.glyphGraphicItems[graphic.name] = graphic;\n graphic.onBeforeAttributeUpdate = (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const graphicAttributes = transformAttributes(markType, attributes, this, graphic.name);\n return graphicAttributes;\n };\n });\n\n this.clearGraphicAttributes();\n }\n\n useStates(states: string[], hasAnimation?: boolean) {\n if (!this.graphicItem) {\n return false;\n }\n this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_STATE, { states }, this);\n\n this.states = states.slice();\n\n const stateAnimationEnable = isBoolean(hasAnimation)\n ? hasAnimation\n : this.mark.animate.getAnimationConfigs('state').length !== 0;\n\n this.graphicItem.glyphStateProxy = this.getStateAttrs;\n this.graphicItem.useStates(this.states, stateAnimationEnable);\n\n this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_STATE, { states }, this);\n\n return true;\n }\n\n protected getStateAttrs = (stateName: string, nextStates: string[]) => {\n const isRuntimeState = !isNil(this.runtimeStatesEncoder?.[stateName]);\n const encoder = isRuntimeState\n ? {\n ...(this.mark.getSpec() as MarkSpec).encode?.[stateName],\n ...this.runtimeStatesEncoder[stateName]\n }\n : (this.mark.getSpec() as MarkSpec).encode?.[stateName];\n\n const glyphStateAttributes = {} as {\n attributes: Partial<IGraphicAttribute>;\n subAttributes: Partial<IGraphicAttribute>[];\n };\n\n if (!encoder) {\n return glyphStateAttributes;\n }\n\n if (isFunction(encoder)) {\n glyphStateAttributes.attributes = (encoder as StateProxyEncodeSpec)(this.getDatum(), this, stateName, nextStates);\n return glyphStateAttributes;\n }\n\n if (!isRuntimeState && this.graphicItem.glyphStates?.[stateName]) {\n return this.graphicItem.glyphStates[stateName];\n }\n\n if (encoder) {\n const item = this.items[0];\n const targetItems = [Object.assign({}, item, { nextAttrs: {} })];\n\n invokeEncoderToItems(this, targetItems, encoder, (this.mark as any).parameters());\n this.coordinateTransformEncode(targetItems);\n\n glyphStateAttributes.attributes = targetItems[0].nextAttrs;\n\n if (!this.graphicItem.glyphStates) {\n this.graphicItem.glyphStates = { [stateName]: glyphStateAttributes };\n } else if (!this.graphicItem.glyphStates[stateName]) {\n this.graphicItem.glyphStates[stateName] = glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n };\n\n encodeGraphic() {\n this.coordinateTransformEncode(this.items);\n const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);\n\n if (!this.graphicItem) {\n this.initGraphicItem();\n }\n\n if (this.diffState === DiffState.enter) {\n // apply default encoder when enter\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(true);\n this.applyGraphicAttributes(graphicAttributes);\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n } else {\n this.applyGraphicAttributes(graphicAttributes);\n }\n\n if ((this.diffState === DiffState.enter || this.diffState === DiffState.update) && this.states.length) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n // 更新数据流后,states计算不缓存\n graphicItem.states = {};\n });\n this.useStates(this.states);\n }\n\n // clear item attributes\n this.items.map(item => {\n item.nextAttrs = {};\n });\n }\n\n encodeCustom(nextAttrs?: any): { [markName: string]: any } {\n let customEncodeValues: { [markName: string]: any } = {};\n const channelEncoder = this.glyphMeta.getChannelEncoder();\n const functionEncoder = this.glyphMeta.getFunctionEncoder();\n\n if (functionEncoder) {\n customEncodeValues = functionEncoder.call(\n null,\n Object.assign({}, this.graphicItem?.attribute, nextAttrs),\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n }\n if (channelEncoder) {\n // TODO: maybe delete origin encode value?\n let allAttrs: any;\n Object.keys(channelEncoder).forEach(channel => {\n if (!isNil(nextAttrs[channel])) {\n if (!allAttrs) {\n allAttrs = Object.assign({}, this.graphicItem?.attribute, nextAttrs);\n }\n const encodeResult = channelEncoder[channel].call(\n null,\n channel,\n nextAttrs[channel],\n allAttrs,\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n Object.keys(encodeResult ?? {}).forEach(markName => {\n customEncodeValues[markName] = Object.assign(customEncodeValues[markName] ?? {}, encodeResult[markName]);\n });\n }\n });\n }\n return customEncodeValues;\n }\n\n private encodeDefault() {\n const defaultEncodeValues: { [markName: string]: any } = {};\n // apply default encode\n if (this.diffState === DiffState.enter && this.glyphMeta.getDefaultEncoder()) {\n const defaultEncodeResult = this.glyphMeta\n .getDefaultEncoder()\n .call(null, this.getDatum(), this, this.mark.getGlyphConfig());\n Object.assign(defaultEncodeValues, defaultEncodeResult);\n }\n return defaultEncodeValues;\n }\n\n private _onGlyphAttributeUpdate(first: boolean = false) {\n return (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const glyphMarks = this.glyphMeta.getMarks();\n\n const graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this);\n\n // apply default encode\n const defaultEncodeValues = first ? this.encodeDefault() : null;\n // apply custom encode\n const customEncodeValues = this.encodeCustom(attributes);\n\n Object.keys(glyphMarks).forEach(markName => {\n const markType = glyphMarks[markName];\n const graphicItem = this.glyphGraphicItems[markName];\n const customAttributes = customEncodeValues?.[markName];\n const additionalAttributes = Object.assign({}, customAttributes);\n if (first) {\n // apply default attributes when visual channel is not set\n const defaultAttributes = defaultEncodeValues?.[markName];\n Object.keys(defaultAttributes ?? {}).forEach(key => {\n if (!has(this.items[0].nextAttrs, key) && !has(additionalAttributes, key)) {\n additionalAttributes[key] = defaultAttributes[key];\n }\n });\n }\n const glyphAttributes = Object.assign({}, cloneTransformAttributes(markType, attributes), additionalAttributes);\n const glyphItems = this._generateGlyphItems(markType, this.items, glyphAttributes);\n this.coordinateTransformEncode(glyphItems);\n const graphicAttributes = this.transformElementItems(glyphItems, markType);\n\n this.applyGlyphGraphicAttributes(graphicAttributes, markName, graphicItem);\n\n if (markType === GrammarMarkType.shape) {\n // FIXME: shape需要拿到原始数据进行编码,暂时把数据绑定到graphicItem上,看后续graphicItem是否需要支持数据绑定\n graphicItem.datum = glyphItems[0].datum;\n }\n });\n\n return graphicAttributes;\n };\n }\n\n private _generateGlyphItems(markType: MarkType, items: MarkElementItem[], additionalAttributes: any) {\n const glyphItems = items.map(item => Object.assign({}, item, { nextAttrs: additionalAttributes }));\n\n if ((CollectionMarkType as string[]).includes(markType) && this.mark.getSpec().enableSegments) {\n // segment mark require all items to apply additional attributes\n glyphItems.forEach((glyphItem, index) => {\n glyphItem.nextAttrs = Object.assign({}, items[index].nextAttrs, additionalAttributes);\n });\n }\n\n return glyphItems;\n }\n\n getGraphicAttribute(channel: string, prev: boolean = false, markName?: any) {\n if (!this.graphicItem) {\n return undefined;\n }\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n if (prev && has(prevGraphicAttributes, channel)) {\n return prevGraphicAttributes[channel];\n }\n\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.attribute[channel];\n }\n\n setGraphicAttribute(channel: string, value: any, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n if (final) {\n finalGraphicAttributes[channel] = value;\n }\n if (!has(prevGraphicAttributes, channel)) {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n }\n\n graphicItem.setAttribute(channel, value);\n }\n\n setGraphicAttributes(attributes: { [channel: string]: any }, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n Object.keys(attributes).forEach(key => {\n if (final) {\n finalGraphicAttributes[key] = attributes[key];\n }\n if (!has(prevGraphicAttributes, key)) {\n prevGraphicAttributes[key] = graphicItem.attribute[key];\n }\n });\n\n graphicItem.setAttributes(attributes);\n }\n\n protected diffAttributes(graphicAttributes: { [channel: string]: any }, markName?: string) {\n const diffResult = {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n for (const key in graphicAttributes) {\n if (!isEqual(key, finalGraphicAttributes, graphicAttributes)) {\n diffResult[key] = graphicAttributes[key];\n }\n }\n return diffResult;\n }\n\n protected applyGlyphGraphicAttributes(graphicAttributes: any, markName: string, graphicItem: any): void {\n if (this.mark.needAnimate()) {\n // If mark need animate, diff attributes.\n const nextGraphicAttributes = this.diffAttributes(graphicAttributes, markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName) ?? {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName) ?? {};\n Object.keys(nextGraphicAttributes).forEach(channel => {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n finalGraphicAttributes[channel] = nextGraphicAttributes[channel];\n });\n this.setNextGraphicAttributes(nextGraphicAttributes, markName);\n this.setPrevGraphicAttributes(prevGraphicAttributes, markName);\n this.setFinalGraphicAttributes(finalGraphicAttributes, markName);\n\n // Apply next attributes to current graphic item immediately.\n // Scene graph tree should be handled like no animation exists in dataflow procedure.\n graphicItem.setAttributes(nextGraphicAttributes);\n } else {\n graphicItem.setAttributes(graphicAttributes);\n }\n }\n\n getFinalGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.finalAttrs;\n }\n\n protected setFinalGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.finalAttrs = attributes;\n }\n\n getPrevGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.prevAttrs;\n }\n\n protected setPrevGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.prevAttrs = attributes;\n }\n\n getNextGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.nextAttrs;\n }\n\n protected setNextGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.nextAttrs = attributes;\n }\n\n clearChangedGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n });\n }\n\n clearGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n this.setFinalGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n this.setFinalGraphicAttributes(null, markName);\n });\n }\n\n remove() {\n this.glyphGraphicItems = null;\n super.remove();\n }\n\n release() {\n if (this.glyphGraphicItems) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n graphicItem[BridgeElementKey] = null;\n });\n this.glyphGraphicItems = null;\n }\n super.release();\n }\n}\n"]}
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.13.6";
1
+ export declare const version = "0.13.8";
2
2
  export * from './graph';
3
3
  export * from './interactions';
4
4
  export { View } from './view';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "0.13.6";
1
+ export const version = "0.13.8";
2
2
 
3
3
  export * from "./graph";
4
4
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.13.6\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { Scale, registerScale } from './view/scale';\nexport { Coordinate, registerCoordinate } from './view/coordinate';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\nexport * from './graph/mark/graphic';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.13.8\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { Scale, registerScale } from './view/scale';\nexport { Coordinate, registerCoordinate } from './view/coordinate';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\nexport * from './graph/mark/graphic';\n"]}
package/es/view/group.js CHANGED
@@ -48,9 +48,12 @@ export class GroupMark extends Mark {
48
48
  }
49
49
  getChannelsFromConfig(element) {
50
50
  const spec = this.spec, initAttrs = {};
51
- return isNil(spec.clip) || (initAttrs.clip = spec.clip), isNil(spec.zIndex) || (initAttrs.zIndex = spec.zIndex),
52
- isNil(spec.clipPath) || (initAttrs.path = isFunction(spec.clipPath) ? spec.clipPath([ element ]) : spec.clipPath),
53
- isNil(spec.interactive) || (initAttrs.pickable = spec.interactive), initAttrs;
51
+ if (isNil(spec.clip) || (initAttrs.clip = spec.clip), isNil(spec.zIndex) || (initAttrs.zIndex = spec.zIndex),
52
+ !isNil(spec.clipPath)) {
53
+ const paths = isFunction(spec.clipPath) ? spec.clipPath([ element ]) : spec.clipPath;
54
+ paths && paths.length ? initAttrs.path = paths : (initAttrs.path = null, initAttrs.clip = !1);
55
+ }
56
+ return isNil(spec.interactive) || (initAttrs.pickable = spec.interactive), initAttrs;
54
57
  }
55
58
  evaluateGroupEncode(elements, groupEncode, parameters) {
56
59
  var _a;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/view/group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,iBAAi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IAAI,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAEnD,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,WAA+B,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACzF,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,sBAAsB,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QAE9D,OAAO,WAAW,CAAC;IACrB,CAAC;CACF","file":"group.js","sourcesContent":["import type { INode } from '@visactor/vrender-core';\nimport { transformsByType } from '../graph/attributes';\nimport { DefaultKey, DefaultMarkData } from '../graph/constants';\nimport { BuiltInEncodeNames, GrammarMarkType, HOOK_EVENT } from '../graph/enums';\nimport { createElement } from '../graph/util/element';\nimport { createGraphicItem } from '../graph/util/graphic';\nimport type { IElement, IGlyphMark, IGroupMark, IMark, IView } from '../types';\nimport { Mark } from './mark';\nimport { isFunction, isNil } from '@visactor/vutils';\nimport { invokeEncoderToItems } from '../graph/mark/encode';\n\nexport class GroupMark extends Mark implements IGroupMark {\n children: (IMark | IGroupMark | IGlyphMark)[];\n\n layoutChildren?: (IMark | IGroupMark | IGlyphMark)[];\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, GrammarMarkType.group, group);\n this.children = [];\n }\n\n parseRenderContext() {\n return { large: false };\n }\n\n appendChild(mark: IMark) {\n this.children.push(mark);\n return this;\n }\n removeChild(mark: IMark) {\n this.children = this.children.filter(child => child !== mark);\n return this;\n }\n\n includesChild(mark: IMark, descendant: boolean = true) {\n if (this.children.includes(mark)) {\n return true;\n }\n if (!descendant) {\n return false;\n }\n return this.children.some(child => {\n if (child.markType === GrammarMarkType.group) {\n return (child as IGroupMark).includesChild(mark, true);\n }\n return false;\n });\n }\n\n updateLayoutChildren() {\n if (!this.children.length) {\n return this;\n }\n if (!this.layoutChildren) {\n this.layoutChildren = [];\n }\n\n this.layoutChildren = this.children.filter(child => child.needLayout());\n\n return this;\n }\n\n getAttributeTransforms() {\n return transformsByType.rect;\n }\n\n protected evaluateJoin(data: any[]) {\n if (!this.elements.length) {\n const el = createElement(this);\n\n el.updateData(DefaultKey, DefaultMarkData, () => '', this.view);\n this.elements = [el];\n this.elementMap.set(DefaultKey, el);\n }\n }\n\n protected getChannelsFromConfig(element?: IElement) {\n const spec = this.spec;\n\n const initAttrs: any = {};\n\n if (!isNil(spec.clip)) {\n initAttrs.clip = spec.clip;\n }\n\n if (!isNil(spec.zIndex)) {\n initAttrs.zIndex = spec.zIndex;\n }\n\n if (!isNil(spec.clipPath)) {\n initAttrs.path = isFunction(spec.clipPath) ? spec.clipPath([element]) : spec.clipPath;\n }\n\n if (!isNil(spec.interactive)) {\n initAttrs.pickable = spec.interactive;\n }\n\n return initAttrs;\n }\n\n protected evaluateGroupEncode(elements: IElement[], groupEncode: any, parameters: any) {\n const el = this.elements[0];\n const nextAttrs = {};\n const items = [Object.assign({}, el.items?.[0], { nextAttrs })];\n invokeEncoderToItems(el, items, groupEncode, parameters);\n\n this._groupEncodeResult = nextAttrs;\n return nextAttrs;\n }\n\n protected evaluateEncode(elements: IElement[], encoders: any, parameters: any, noGroupEncode?: boolean) {\n const initAttrs = this.getChannelsFromConfig();\n\n if (encoders) {\n this.emit(HOOK_EVENT.BEFORE_ELEMENT_ENCODE, { encoders, parameters }, this);\n\n const groupEncodeAttrs = noGroupEncode\n ? null\n : this.evaluateGroupEncode(elements, encoders[BuiltInEncodeNames.group], parameters);\n\n elements.forEach(element => {\n element.items.forEach(item => {\n item.nextAttrs = Object.assign(item.nextAttrs, initAttrs, groupEncodeAttrs);\n });\n\n element.encodeItems(element.items, encoders, this._isReentered, parameters);\n });\n\n this._isReentered = false;\n\n this.evaluateTransform(this._getTransformsAfterEncodeItems(), elements, parameters);\n\n elements.forEach(element => {\n element.encodeGraphic();\n });\n this.emit(HOOK_EVENT.AFTER_ELEMENT_ENCODE, { encoders, parameters }, this);\n } else {\n elements.forEach(element => {\n element.initGraphicItem(initAttrs);\n });\n }\n }\n\n addGraphicItem(attrs: any, groupKey?: string, newGraphicItem?: any) {\n const graphicItem: any = newGraphicItem ?? createGraphicItem(this, this.markType, attrs);\n\n if (!graphicItem) {\n return;\n }\n\n this.emit(HOOK_EVENT.BEFORE_ADD_VRENDER_MARK, { graphicItem });\n\n graphicItem.name = `${this.id() || this.markType}`;\n\n this.graphicParent.insertIntoKeepIdx(graphicItem as unknown as INode, this.graphicIndex);\n this.emit(HOOK_EVENT.AFTER_ADD_VRENDER_MARK, { graphicItem });\n\n return graphicItem;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/view/group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,OAAO,SAAU,SAAQ,IAAI;IAKjC,YAAY,IAAW,EAAE,KAAkB;QACzC,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,kBAAkB;QAChB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,WAAW,CAAC,IAAW;QACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,OAAO,IAAI,CAA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EH,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;YAE1B,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,8BAA8B,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;YAEpF,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBACzB,OAAO,CAAC,aAAa,EAAE,CAAC;YAC1B,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC;SAC5E;aAAM;YACL,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBACzB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,cAAc,CAAC,KAAU,EAAE,QAAiB,EAAE,cAAoB;QAChE,MAAM,WAAW,GAAQ,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAEzF,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO;SACR;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,uBAAuB,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QAE/D,WAAW,CAAC,IAAI,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAEnD,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,WAA+B,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACzF,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,sBAAsB,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QAE9D,OAAO,WAAW,CAAC;IACrB,CAAC;CACF","file":"group.js","sourcesContent":["import type { INode } from '@visactor/vrender-core';\nimport { transformsByType } from '../graph/attributes';\nimport { DefaultKey, DefaultMarkData } from '../graph/constants';\nimport { BuiltInEncodeNames, GrammarMarkType, HOOK_EVENT } from '../graph/enums';\nimport { createElement } from '../graph/util/element';\nimport { createGraphicItem } from '../graph/util/graphic';\nimport type { IElement, IGlyphMark, IGroupMark, IMark, IView } from '../types';\nimport { Mark } from './mark';\nimport { isFunction, isNil } from '@visactor/vutils';\nimport { invokeEncoderToItems } from '../graph/mark/encode';\n\nexport class GroupMark extends Mark implements IGroupMark {\n children: (IMark | IGroupMark | IGlyphMark)[];\n\n layoutChildren?: (IMark | IGroupMark | IGlyphMark)[];\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, GrammarMarkType.group, group);\n this.children = [];\n }\n\n parseRenderContext() {\n return { large: false };\n }\n\n appendChild(mark: IMark) {\n this.children.push(mark);\n return this;\n }\n removeChild(mark: IMark) {\n this.children = this.children.filter(child => child !== mark);\n return this;\n }\n\n includesChild(mark: IMark, descendant: boolean = true) {\n if (this.children.includes(mark)) {\n return true;\n }\n if (!descendant) {\n return false;\n }\n return this.children.some(child => {\n if (child.markType === GrammarMarkType.group) {\n return (child as IGroupMark).includesChild(mark, true);\n }\n return false;\n });\n }\n\n updateLayoutChildren() {\n if (!this.children.length) {\n return this;\n }\n if (!this.layoutChildren) {\n this.layoutChildren = [];\n }\n\n this.layoutChildren = this.children.filter(child => child.needLayout());\n\n return this;\n }\n\n getAttributeTransforms() {\n return transformsByType.rect;\n }\n\n protected evaluateJoin(data: any[]) {\n if (!this.elements.length) {\n const el = createElement(this);\n\n el.updateData(DefaultKey, DefaultMarkData, () => '', this.view);\n this.elements = [el];\n this.elementMap.set(DefaultKey, el);\n }\n }\n\n protected getChannelsFromConfig(element?: IElement) {\n const spec = this.spec;\n\n const initAttrs: any = {};\n\n if (!isNil(spec.clip)) {\n initAttrs.clip = spec.clip;\n }\n\n if (!isNil(spec.zIndex)) {\n initAttrs.zIndex = spec.zIndex;\n }\n\n if (!isNil(spec.clipPath)) {\n const paths = isFunction(spec.clipPath) ? spec.clipPath([element]) : spec.clipPath;\n\n if (paths && paths.length) {\n initAttrs.path = paths;\n } else {\n initAttrs.path = null;\n initAttrs.clip = false;\n }\n }\n\n if (!isNil(spec.interactive)) {\n initAttrs.pickable = spec.interactive;\n }\n\n return initAttrs;\n }\n\n protected evaluateGroupEncode(elements: IElement[], groupEncode: any, parameters: any) {\n const el = this.elements[0];\n const nextAttrs = {};\n const items = [Object.assign({}, el.items?.[0], { nextAttrs })];\n invokeEncoderToItems(el, items, groupEncode, parameters);\n\n this._groupEncodeResult = nextAttrs;\n return nextAttrs;\n }\n\n protected evaluateEncode(elements: IElement[], encoders: any, parameters: any, noGroupEncode?: boolean) {\n const initAttrs = this.getChannelsFromConfig();\n\n if (encoders) {\n this.emit(HOOK_EVENT.BEFORE_ELEMENT_ENCODE, { encoders, parameters }, this);\n\n const groupEncodeAttrs = noGroupEncode\n ? null\n : this.evaluateGroupEncode(elements, encoders[BuiltInEncodeNames.group], parameters);\n\n elements.forEach(element => {\n element.items.forEach(item => {\n item.nextAttrs = Object.assign(item.nextAttrs, initAttrs, groupEncodeAttrs);\n });\n\n element.encodeItems(element.items, encoders, this._isReentered, parameters);\n });\n\n this._isReentered = false;\n\n this.evaluateTransform(this._getTransformsAfterEncodeItems(), elements, parameters);\n\n elements.forEach(element => {\n element.encodeGraphic();\n });\n this.emit(HOOK_EVENT.AFTER_ELEMENT_ENCODE, { encoders, parameters }, this);\n } else {\n elements.forEach(element => {\n element.initGraphicItem(initAttrs);\n });\n }\n }\n\n addGraphicItem(attrs: any, groupKey?: string, newGraphicItem?: any) {\n const graphicItem: any = newGraphicItem ?? createGraphicItem(this, this.markType, attrs);\n\n if (!graphicItem) {\n return;\n }\n\n this.emit(HOOK_EVENT.BEFORE_ADD_VRENDER_MARK, { graphicItem });\n\n graphicItem.name = `${this.id() || this.markType}`;\n\n this.graphicParent.insertIntoKeepIdx(graphicItem as unknown as INode, this.graphicIndex);\n this.emit(HOOK_EVENT.AFTER_ADD_VRENDER_MARK, { graphicItem });\n\n return graphicItem;\n }\n}\n"]}
package/es/view/mark.js CHANGED
@@ -263,12 +263,20 @@ export class Mark extends GrammarBase {
263
263
  this.graphicIndex = markIndex;
264
264
  }
265
265
  update(spec) {
266
- this._context = this.spec.context, this.isUpdated = !0, this.renderContext.progressive || (spec.animation && this.animate.updateConfig(spec.animation),
267
- this.animate.updateState(spec.animationState)), this.markType !== GrammarMarkType.group ? (isNil(spec.zIndex) || this.graphicItem.setAttribute("zIndex", spec.zIndex),
268
- isNil(spec.clip) || this.graphicItem.setAttribute("clip", spec.clip), isNil(spec.clipPath) || this.graphicItem.setAttribute("path", isArray(spec.clipPath) ? spec.clipPath : spec.clipPath(this.elements)),
269
- this.elementMap.forEach((element => {
270
- element.updateGraphicItem();
271
- }))) : this.elementMap.forEach((element => {
266
+ if (this._context = this.spec.context, this.isUpdated = !0, this.renderContext.progressive || (spec.animation && this.animate.updateConfig(spec.animation),
267
+ this.animate.updateState(spec.animationState)), this.markType !== GrammarMarkType.group) {
268
+ if (isNil(spec.zIndex) || this.graphicItem.setAttribute("zIndex", spec.zIndex),
269
+ isNil(spec.clip) || this.graphicItem.setAttribute("clip", spec.clip), !isNil(spec.clipPath)) {
270
+ const paths = isArray(spec.clipPath) ? spec.clipPath : spec.clipPath(this.elements);
271
+ paths && paths.length ? this.graphicItem.setAttribute("path", paths) : this.graphicItem.setAttributes({
272
+ path: paths,
273
+ clip: !1
274
+ });
275
+ }
276
+ this.elementMap.forEach((element => {
277
+ element.updateGraphicItem();
278
+ }));
279
+ } else this.elementMap.forEach((element => {
272
280
  element.updateGraphicItem();
273
281
  }));
274
282
  }