@visactor/vrender-components 0.21.8 → 0.22.0-vstory.1

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.
Files changed (80) hide show
  1. package/cjs/axis/util.js +2 -1
  2. package/cjs/brush/type.js +1 -2
  3. package/cjs/core/base.d.ts +1 -0
  4. package/cjs/core/base.js +3 -3
  5. package/cjs/core/base.js.map +1 -1
  6. package/cjs/index.d.ts +3 -1
  7. package/cjs/index.js +3 -2
  8. package/cjs/index.js.map +1 -1
  9. package/cjs/interface.d.ts +2 -1
  10. package/cjs/interface.js.map +1 -1
  11. package/cjs/label-item/index.d.ts +2 -0
  12. package/cjs/label-item/index.js +21 -0
  13. package/cjs/label-item/index.js.map +1 -0
  14. package/cjs/label-item/label-item.d.ts +29 -0
  15. package/cjs/label-item/label-item.js +265 -0
  16. package/cjs/label-item/label-item.js.map +1 -0
  17. package/cjs/label-item/register.d.ts +1 -0
  18. package/cjs/label-item/register.js +15 -0
  19. package/cjs/label-item/register.js.map +1 -0
  20. package/cjs/label-item/type.d.ts +31 -0
  21. package/cjs/label-item/type.js +6 -0
  22. package/cjs/label-item/type.js.map +1 -0
  23. package/cjs/poptip/poptip.d.ts +14 -2
  24. package/cjs/poptip/poptip.js +137 -51
  25. package/cjs/poptip/poptip.js.map +1 -1
  26. package/cjs/poptip/type.d.ts +6 -0
  27. package/cjs/poptip/type.js.map +1 -1
  28. package/cjs/weather/index.d.ts +1 -0
  29. package/cjs/weather/index.js +21 -0
  30. package/cjs/weather/index.js.map +1 -0
  31. package/cjs/weather/register.d.ts +1 -0
  32. package/cjs/weather/register.js +14 -0
  33. package/cjs/weather/register.js.map +1 -0
  34. package/cjs/weather/type.d.ts +24 -0
  35. package/cjs/weather/type.js +6 -0
  36. package/cjs/weather/type.js.map +1 -0
  37. package/cjs/weather/weather-box.d.ts +13 -0
  38. package/cjs/weather/weather-box.js +129 -0
  39. package/cjs/weather/weather-box.js.map +1 -0
  40. package/dist/index.es.js +5771 -4892
  41. package/es/axis/util.js +2 -1
  42. package/es/brush/type.js +1 -2
  43. package/es/core/base.d.ts +1 -0
  44. package/es/core/base.js +4 -3
  45. package/es/core/base.js.map +1 -1
  46. package/es/index.d.ts +3 -1
  47. package/es/index.js +5 -1
  48. package/es/index.js.map +1 -1
  49. package/es/interface.d.ts +2 -1
  50. package/es/interface.js.map +1 -1
  51. package/es/label-item/index.d.ts +2 -0
  52. package/es/label-item/index.js +4 -0
  53. package/es/label-item/index.js.map +1 -0
  54. package/es/label-item/label-item.d.ts +29 -0
  55. package/es/label-item/label-item.js +263 -0
  56. package/es/label-item/label-item.js.map +1 -0
  57. package/es/label-item/register.d.ts +1 -0
  58. package/es/label-item/register.js +6 -0
  59. package/es/label-item/register.js.map +1 -0
  60. package/es/label-item/type.d.ts +31 -0
  61. package/es/label-item/type.js +2 -0
  62. package/es/label-item/type.js.map +1 -0
  63. package/es/poptip/poptip.d.ts +14 -2
  64. package/es/poptip/poptip.js +136 -49
  65. package/es/poptip/poptip.js.map +1 -1
  66. package/es/poptip/type.d.ts +6 -0
  67. package/es/poptip/type.js.map +1 -1
  68. package/es/weather/index.d.ts +1 -0
  69. package/es/weather/index.js +2 -0
  70. package/es/weather/index.js.map +1 -0
  71. package/es/weather/register.d.ts +1 -0
  72. package/es/weather/register.js +6 -0
  73. package/es/weather/register.js.map +1 -0
  74. package/es/weather/type.d.ts +24 -0
  75. package/es/weather/type.js +2 -0
  76. package/es/weather/type.js.map +1 -0
  77. package/es/weather/weather-box.d.ts +13 -0
  78. package/es/weather/weather-box.js +127 -0
  79. package/es/weather/weather-box.js.map +1 -0
  80. package/package.json +3 -3
package/es/axis/util.js CHANGED
@@ -99,4 +99,5 @@ export function hasOverlap(items, pad) {
99
99
  for (let b, i = 1, n = items.length, a = items[0]; i < n; a = b, ++i) if (b = items[i],
100
100
  textIntersect(a, b, pad)) return !0;
101
101
  return !1;
102
- }
102
+ }
103
+ //# sourceMappingURL=util.js.map
package/es/brush/type.js CHANGED
@@ -4,5 +4,4 @@ export var IOperateType;
4
4
  IOperateType.drawStart = "drawStart", IOperateType.drawEnd = "drawEnd", IOperateType.drawing = "drawing",
5
5
  IOperateType.moving = "moving", IOperateType.moveStart = "moveStart", IOperateType.moveEnd = "moveEnd",
6
6
  IOperateType.brushClear = "brushClear";
7
- }(IOperateType || (IOperateType = {}));
8
- //# sourceMappingURL=type.js.map
7
+ }(IOperateType || (IOperateType = {}));
package/es/core/base.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare abstract class AbstractComponent<T extends IGroupGraphicAttribute
6
6
  attribute: Partial<T>;
7
7
  protected mode?: '2d' | '3d';
8
8
  protected skipDefault?: boolean;
9
+ protected _skipRenderAttributes: string[];
9
10
  constructor(attributes: T, options?: ComponentOptions);
10
11
  setAttribute(key: string, value: any, forceUpdateTag?: boolean | undefined, context?: ISetAttributeContext): void;
11
12
  setAttributes(params: Partial<T>, forceUpdateTag?: boolean | undefined, context?: ISetAttributeContext): void;
package/es/core/base.js CHANGED
@@ -6,7 +6,7 @@ const GROUP_ATTRIBUTES = [ "x", "y", "dx", "dy", "scaleX", "scaleY", "angle", "a
6
6
 
7
7
  export class AbstractComponent extends Group {
8
8
  constructor(attributes, options) {
9
- super(attributes), (null == options ? void 0 : options.mode) && (this.mode = options.mode,
9
+ super(attributes), this._skipRenderAttributes = GROUP_ATTRIBUTES, (null == options ? void 0 : options.mode) && (this.mode = options.mode,
10
10
  this.setMode(options.mode)), (null == options ? void 0 : options.skipDefault) && (this.skipDefault = !0),
11
11
  this.setTheme({
12
12
  common: {
@@ -22,7 +22,8 @@ export class AbstractComponent extends Group {
22
22
  }, this.attribute, key, context);
23
23
  if (params) return this._setAttributes(params, forceUpdateTag);
24
24
  isPlainObject(this.attribute[key]) && isPlainObject(value) && !isFunction(this.attribute[key]) && !isFunction(value) ? merge(this.attribute[key], value) : this.attribute[key] = value,
25
- GROUP_ATTRIBUTES.includes(key) || this.render(), this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(),
25
+ this._skipRenderAttributes.includes(key) || this.render(), this.valid = this.isValid(),
26
+ this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(),
26
27
  this.addUpdatePositionTag(), this.onAttributeUpdate();
27
28
  }
28
29
  setAttributes(params, forceUpdateTag, context) {
@@ -31,7 +32,7 @@ export class AbstractComponent extends Group {
31
32
  }
32
33
  _setAttributes(params, forceUpdateTag) {
33
34
  const keys = Object.keys(params);
34
- this._mergeAttributes(params, keys), keys.every((key => GROUP_ATTRIBUTES.includes(key))) || this.render(),
35
+ this._mergeAttributes(params, keys), keys.every((key => this._skipRenderAttributes.includes(key))) || this.render(),
35
36
  this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTags(keys) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(),
36
37
  this.addUpdatePositionTag(), this.onAttributeUpdate();
37
38
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/base.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG3E,MAAM,gBAAgB,GAAG;IACvB,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,MAAM;IACN,UAAU;IACV,kBAAkB;IAClB,QAAQ;IACR,QAAQ;CACT,CAAC;AAEF,MAAM,OAAgB,iBAA6E,SAAQ,KAAK;IAO9G,YAAY,UAAa,EAAE,OAA0B;QACnD,KAAK,CAAC,UAAU,CAAC,C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C,SAAS,EAAE,OAAO,CAAC,CAAC;QAGxD,WAAW,CAAC,OAAO,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,WAAW,CAAC,OAAO,CAAC;QAEtD,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;CACF","file":"base.js","sourcesContent":["/**\n * @description 组件基类\n */\nimport type { IGroupGraphicAttribute, ISetAttributeContext } from '@visactor/vrender-core';\nimport { Group, CustomEvent } from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\nimport { merge, isFunction, isPlainObject, isNil } from '@visactor/vutils';\nimport type { ComponentOptions } from '../interface';\n\nconst GROUP_ATTRIBUTES = [\n 'x',\n 'y',\n 'dx',\n 'dy',\n 'scaleX',\n 'scaleY',\n 'angle',\n 'anchor',\n 'postMatrix',\n 'visible',\n 'clip',\n 'pickable',\n 'childrenPickable',\n 'zIndex',\n 'cursor'\n];\n\nexport abstract class AbstractComponent<T extends IGroupGraphicAttribute = IGroupGraphicAttribute> extends Group {\n declare attribute: Partial<T>;\n\n protected mode?: '2d' | '3d';\n\n protected skipDefault?: boolean;\n\n constructor(attributes: T, options?: ComponentOptions) {\n super(attributes);\n\n if (options?.mode) {\n this.mode = options.mode;\n\n this.setMode(options.mode);\n }\n\n if (options?.skipDefault) {\n this.skipDefault = true;\n }\n // 组件需要精准 bounds,所以将这个 strokeBoundsBuffer 设置为 0,否则会影响包围盒的获取\n this.setTheme({\n common: {\n strokeBoundsBuffer: 0\n }\n });\n this.attribute = attributes;\n // 这里调用渲染和事件绑定逻辑\n this.onSetStage(() => {\n this.render();\n this.bindEvents();\n });\n }\n\n /**\n * @override\n * 更新单个属性值\n * @param key\n * @param value\n * @param forceUpdateTag\n */\n setAttribute(key: string, value: any, forceUpdateTag?: boolean | undefined, context?: ISetAttributeContext): void {\n const params =\n this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);\n if (params) {\n return this._setAttributes(params as Partial<T>, forceUpdateTag);\n }\n\n // overwrite when previous or next attribute is function\n if (\n isPlainObject(this.attribute[key]) &&\n isPlainObject(value) &&\n !isFunction(this.attribute[key]) &&\n !isFunction(value)\n ) {\n merge(this.attribute[key], value);\n } else {\n this.attribute[key] = value;\n }\n\n // HACK: 待优化\n if (!GROUP_ATTRIBUTES.includes(key as string)) {\n this.render();\n }\n\n this.valid = this.isValid();\n if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTag(key as string))) {\n this.addUpdateShapeAndBoundsTag();\n } else {\n this.addUpdateBoundTag();\n }\n this.addUpdatePositionTag();\n this.onAttributeUpdate();\n }\n\n setAttributes(params: Partial<T>, forceUpdateTag?: boolean | undefined, context?: ISetAttributeContext): void {\n params =\n (this.onBeforeAttributeUpdate &&\n (this.onBeforeAttributeUpdate(params, this.attribute, null, context) as Partial<T>)) ||\n params;\n return this._setAttributes(params, forceUpdateTag);\n }\n\n // @ts-ignore\n _setAttributes(params: Partial<T>, forceUpdateTag?: boolean | undefined): void {\n const keys = Object.keys(params) as (keyof T)[];\n this._mergeAttributes(params, keys);\n\n // HACK: 待优化\n if (!keys.every(key => GROUP_ATTRIBUTES.includes(key as string))) {\n this.render();\n }\n\n this.valid = this.isValid();\n // 没有设置shape&bounds的tag\n if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTags(keys as string[]))) {\n this.addUpdateShapeAndBoundsTag();\n } else {\n this.addUpdateBoundTag();\n }\n this.addUpdatePositionTag();\n this.onAttributeUpdate();\n }\n\n protected _mergeAttributes(params: Partial<T>, keys?: (keyof T)[]) {\n if (isNil(keys)) {\n keys = Object.keys(params) as (keyof T)[];\n }\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i] as keyof Partial<T>;\n // overwrite when previous or next attribute is function\n if (isPlainObject(this.attribute[key]) && !isFunction(this.attribute[key]) && !isFunction(params[key])) {\n merge(this.attribute[key], params[key]);\n } else {\n this.attribute[key] = params[key];\n }\n }\n }\n\n protected bindEvents() {\n // please override\n }\n\n protected abstract render(): void;\n\n // 图形元素 id\n protected _getNodeId(id: string) {\n return `${this.id ?? this._uid}-${this.name}-${id}`;\n }\n\n // 用于 emit 组件自己的事件\n protected _dispatchEvent(eventName: string, details?: Dict<any>) {\n // 封装事件\n const changeEvent = new CustomEvent(eventName, details);\n // FIXME: 需要在 vrender 的事件系统支持\n // @ts-ignore\n changeEvent.manager = this.stage?.eventSystem.manager;\n\n this.dispatchEvent(changeEvent);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/core/base.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG3E,MAAM,gBAAgB,GAAG;IACvB,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,MAAM;IACN,UAAU;IACV,kBAAkB;IAClB,QAAQ;IACR,QAAQ;CACT,CAAC;AAEF,MAAM,OAAgB,iBAA6E,SAAQ,KAAK;IAS9G,YAAY,UAAa,EAAE,OAA0B;QACnD,KAAK,CAAC,UAAU,CAAC,CAAC;QAHV,0BAAqB,GAAa,gBAAgB,CAAC;QAK3D,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;YACjB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAEzB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC5B;QAED,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAE;YACxB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;SACzB;QAED,IAAI,CAAC,QAAQ,CAAC;YACZ,MAAM,EAAE;gBACN,kBAAkB,EAAE,CA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C,EAAE;YACf,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAgB,CAAC;SAC3C;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAqB,CAAC;YAExC,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;gBACtG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;aACzC;iBAAM;gBACL,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;aACnC;SACF;IACH,CAAC;IAES,UAAU;IAEpB,CAAC;IAKS,UAAU,CAAC,EAAU;;QAC7B,OAAO,GAAG,MAAA,IAAI,CAAC,EAAE,mCAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;IACtD,CAAC;IAGS,cAAc,CAAC,SAAiB,EAAE,OAAmB;;QAE7D,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAGxD,WAAW,CAAC,OAAO,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,WAAW,CAAC,OAAO,CAAC;QAEtD,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;CACF","file":"base.js","sourcesContent":["/**\n * @description 组件基类\n */\nimport type { IGroupGraphicAttribute, ISetAttributeContext } from '@visactor/vrender-core';\nimport { Group, CustomEvent } from '@visactor/vrender-core';\nimport type { Dict } from '@visactor/vutils';\nimport { merge, isFunction, isPlainObject, isNil } from '@visactor/vutils';\nimport type { ComponentOptions } from '../interface';\n\nconst GROUP_ATTRIBUTES = [\n 'x',\n 'y',\n 'dx',\n 'dy',\n 'scaleX',\n 'scaleY',\n 'angle',\n 'anchor',\n 'postMatrix',\n 'visible',\n 'clip',\n 'pickable',\n 'childrenPickable',\n 'zIndex',\n 'cursor'\n];\n\nexport abstract class AbstractComponent<T extends IGroupGraphicAttribute = IGroupGraphicAttribute> extends Group {\n declare attribute: Partial<T>;\n\n protected mode?: '2d' | '3d';\n\n protected skipDefault?: boolean;\n\n protected _skipRenderAttributes: string[] = GROUP_ATTRIBUTES;\n\n constructor(attributes: T, options?: ComponentOptions) {\n super(attributes);\n\n if (options?.mode) {\n this.mode = options.mode;\n\n this.setMode(options.mode);\n }\n\n if (options?.skipDefault) {\n this.skipDefault = true;\n }\n // 组件需要精准 bounds,所以将这个 strokeBoundsBuffer 设置为 0,否则会影响包围盒的获取\n this.setTheme({\n common: {\n strokeBoundsBuffer: 0\n }\n });\n this.attribute = attributes;\n // 这里调用渲染和事件绑定逻辑\n this.onSetStage(() => {\n this.render();\n this.bindEvents();\n });\n }\n\n /**\n * @override\n * 更新单个属性值\n * @param key\n * @param value\n * @param forceUpdateTag\n */\n setAttribute(key: string, value: any, forceUpdateTag?: boolean | undefined, context?: ISetAttributeContext): void {\n const params =\n this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);\n if (params) {\n return this._setAttributes(params as Partial<T>, forceUpdateTag);\n }\n\n // overwrite when previous or next attribute is function\n if (\n isPlainObject(this.attribute[key]) &&\n isPlainObject(value) &&\n !isFunction(this.attribute[key]) &&\n !isFunction(value)\n ) {\n merge(this.attribute[key], value);\n } else {\n this.attribute[key] = value;\n }\n\n // HACK: 待优化\n if (!this._skipRenderAttributes.includes(key as string)) {\n this.render();\n }\n\n this.valid = this.isValid();\n if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTag(key as string))) {\n this.addUpdateShapeAndBoundsTag();\n } else {\n this.addUpdateBoundTag();\n }\n this.addUpdatePositionTag();\n this.onAttributeUpdate();\n }\n\n setAttributes(params: Partial<T>, forceUpdateTag?: boolean | undefined, context?: ISetAttributeContext): void {\n params =\n (this.onBeforeAttributeUpdate &&\n (this.onBeforeAttributeUpdate(params, this.attribute, null, context) as Partial<T>)) ||\n params;\n return this._setAttributes(params, forceUpdateTag);\n }\n\n // @ts-ignore\n _setAttributes(params: Partial<T>, forceUpdateTag?: boolean | undefined): void {\n const keys = Object.keys(params) as (keyof T)[];\n this._mergeAttributes(params, keys);\n\n // HACK: 待优化\n if (!keys.every(key => this._skipRenderAttributes.includes(key as string))) {\n this.render();\n }\n\n this.valid = this.isValid();\n // 没有设置shape&bounds的tag\n if (!this.updateShapeAndBoundsTagSetted() && (forceUpdateTag || this.needUpdateTags(keys as string[]))) {\n this.addUpdateShapeAndBoundsTag();\n } else {\n this.addUpdateBoundTag();\n }\n this.addUpdatePositionTag();\n this.onAttributeUpdate();\n }\n\n protected _mergeAttributes(params: Partial<T>, keys?: (keyof T)[]) {\n if (isNil(keys)) {\n keys = Object.keys(params) as (keyof T)[];\n }\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i] as keyof Partial<T>;\n // overwrite when previous or next attribute is function\n if (isPlainObject(this.attribute[key]) && !isFunction(this.attribute[key]) && !isFunction(params[key])) {\n merge(this.attribute[key], params[key]);\n } else {\n this.attribute[key] = params[key];\n }\n }\n }\n\n protected bindEvents() {\n // please override\n }\n\n protected abstract render(): void;\n\n // 图形元素 id\n protected _getNodeId(id: string) {\n return `${this.id ?? this._uid}-${this.name}-${id}`;\n }\n\n // 用于 emit 组件自己的事件\n protected _dispatchEvent(eventName: string, details?: Dict<any>) {\n // 封装事件\n const changeEvent = new CustomEvent(eventName, details);\n // FIXME: 需要在 vrender 的事件系统支持\n // @ts-ignore\n changeEvent.manager = this.stage?.eventSystem.manager;\n\n this.dispatchEvent(changeEvent);\n }\n}\n"]}
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.21.8";
1
+ export declare const version = "0.22.0-vstory.1";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
@@ -26,5 +26,7 @@ export * from './jsx';
26
26
  export * from './checkbox';
27
27
  export * from './radio';
28
28
  export * from './empty-tip';
29
+ export * from './weather';
29
30
  export * from './util';
30
31
  export * from './switch';
32
+ export * from './label-item';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "0.21.8";
1
+ export const version = "0.22.0-vstory.1";
2
2
 
3
3
  export * from "./core/base";
4
4
 
@@ -54,7 +54,11 @@ export * from "./radio";
54
54
 
55
55
  export * from "./empty-tip";
56
56
 
57
+ export * from "./weather";
58
+
57
59
  export * from "./util";
58
60
 
59
61
  export * from "./switch";
62
+
63
+ export * from "./label-item";
60
64
  //# sourceMappingURL=index.js.map
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.21.8\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\nexport * from './switch';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAEzC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.22.0-vstory.1\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\n"]}
package/es/interface.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ICustomPath2D, IGraphicAttribute, IGroup, IRectGraphicAttribute } from '@visactor/vrender-core';
1
+ import type { ICustomPath2D, IGraphicAttribute, IGroup, IRectGraphicAttribute, ITimeline } from '@visactor/vrender-core';
2
2
  export type Direction = 'horizontal' | 'vertical';
3
3
  export type OrientType = 'top' | 'right' | 'bottom' | 'left';
4
4
  export type BackgroundAttributes = {
@@ -9,4 +9,5 @@ export type IDelayType = 'debounce' | 'throttle';
9
9
  export interface ComponentOptions {
10
10
  skipDefault?: boolean;
11
11
  mode?: '2d' | '3d';
12
+ timeline?: ITimeline;
12
13
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { ICustomPath2D, IGraphicAttribute, IGroup, IRectGraphicAttribute } from '@visactor/vrender-core';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type OrientType = 'top' | 'right' | 'bottom' | 'left';\n\nexport type BackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * 自定义路径\n * @since 0.19.19\n */\n customShape?: (container: IGroup, attrs: Partial<IGraphicAttribute>, path: ICustomPath2D) => ICustomPath2D;\n} & Partial<IRectGraphicAttribute>;\n\nexport type IDelayType = 'debounce' | 'throttle';\n\nexport interface ComponentOptions {\n /** skip default attributes of component */\n skipDefault?: boolean;\n /** the mode of component, only axis support 3d mode now */\n mode?: '2d' | '3d';\n}\n"]}
1
+ {"version":3,"sources":["../src/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type {\n ICustomPath2D,\n IGraphicAttribute,\n IGroup,\n IRectGraphicAttribute,\n ITimeline\n} from '@visactor/vrender-core';\nimport type { TextContent } from './core/type';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type OrientType = 'top' | 'right' | 'bottom' | 'left';\n\nexport type BackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n /**\n * 自定义路径\n * @since 0.19.19\n */\n customShape?: (container: IGroup, attrs: Partial<IGraphicAttribute>, path: ICustomPath2D) => ICustomPath2D;\n} & Partial<IRectGraphicAttribute>;\n\nexport type IDelayType = 'debounce' | 'throttle';\n\nexport interface ComponentOptions {\n /** skip default attributes of component */\n skipDefault?: boolean;\n /** the mode of component, only axis support 3d mode now */\n mode?: '2d' | '3d';\n /* 传递一个独立的timeline */\n timeline?: ITimeline;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './label-item';
2
+ export * from './type';
@@ -0,0 +1,4 @@
1
+ export * from "./label-item";
2
+
3
+ export * from "./type";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/label-item/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["export * from './label-item';\nexport * from './type';\n"]}
@@ -0,0 +1,29 @@
1
+ import { AbstractComponent } from '../core/base';
2
+ import type { IStoryLabelItemAttrs } from './type';
3
+ import type { ComponentOptions } from '../interface';
4
+ export declare class StoryLabelItem extends AbstractComponent<Required<IStoryLabelItemAttrs>> {
5
+ name: 'labelItem';
6
+ private _line?;
7
+ private _symbolStart;
8
+ private _symbolEnd;
9
+ private _symbolStartOuter;
10
+ private _titleTop;
11
+ private _titleBottom;
12
+ private _titleTopPanel;
13
+ private _titleBottomPanel;
14
+ static defaultAttributes: Partial<IStoryLabelItemAttrs>;
15
+ constructor(attributes: IStoryLabelItemAttrs, options?: ComponentOptions);
16
+ protected render(): void;
17
+ appearAnimate(animateConfig: {
18
+ duration?: number;
19
+ easing?: string;
20
+ symbolStartOuterType?: 'scale' | 'clipRange';
21
+ titleType?: 'typewriter' | 'move';
22
+ titlePanelType?: 'scale' | 'stroke';
23
+ }): void;
24
+ disappearAnimate(animateConfig: {
25
+ duration?: number;
26
+ easing?: string;
27
+ mode?: 'scale' | 'default';
28
+ }): void;
29
+ }
@@ -0,0 +1,263 @@
1
+ import { InputText } from "@visactor/vrender-core";
2
+
3
+ import { AbstractComponent } from "../core/base";
4
+
5
+ import { merge } from "@visactor/vutils";
6
+
7
+ export class StoryLabelItem extends AbstractComponent {
8
+ constructor(attributes, options) {
9
+ super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, StoryLabelItem.defaultAttributes, attributes));
10
+ }
11
+ render() {
12
+ const {contentOffsetX: contentOffsetX, contentOffsetY: contentOffsetY, lineStyle: lineStyle, symbolStartStyle: symbolStartStyle, symbolEndStyle: symbolEndStyle, symbolStartOuterStyle: symbolStartOuterStyle, titleTop: titleTopText, titleBottom: titleBottomText, titleTopStyle: titleTopStyle, titleBottomStyle: titleBottomStyle, titleSpace: titleSpace, titleTopPanelStyle: titleTopPanelStyle, titleBottomPanelStyle: titleBottomPanelStyle, theme: theme} = this.attribute, group = this.createOrUpdateChild("label-item-container", {
13
+ x: 0,
14
+ y: 0,
15
+ zIndex: 1
16
+ }, "group"), symbolStart = group.createOrUpdateChild("label-item-symbol-start", Object.assign({
17
+ x: 0,
18
+ y: 0
19
+ }, symbolStartStyle), "symbol"), symbolEnd = group.createOrUpdateChild("label-item-symbol-end", Object.assign({
20
+ x: contentOffsetX,
21
+ y: contentOffsetY
22
+ }, symbolEndStyle), "symbol"), symbolStartOut = group.createOrUpdateChild("label-item-symbol-start-out", Object.assign({
23
+ x: 0,
24
+ y: 0
25
+ }, symbolStartOuterStyle), "symbol"), spaceW = titleSpace[0], spaceH = titleSpace[1], titleTopGroup = group.createOrUpdateChild("label-item-title-top-group", {
26
+ x: contentOffsetX,
27
+ y: contentOffsetY,
28
+ clip: !0
29
+ }, "group"), titleTop = titleTopGroup.createOrUpdateChild("label-item-title-top", Object.assign(Object.assign({
30
+ x: spaceW,
31
+ y: -spaceH,
32
+ text: titleTopText
33
+ }, titleTopStyle), {
34
+ textBaseline: "bottom",
35
+ textAlign: "left",
36
+ zIndex: 10
37
+ }), "text"), titleTopBounds = titleTop.AABBBounds;
38
+ contentOffsetX > 0 && titleTopGroup.setAttributes({
39
+ x: contentOffsetX - titleTopBounds.width() - 2 * spaceW
40
+ }), titleTopGroup.setAttributes({
41
+ width: titleTopBounds.width() + 2 * spaceW,
42
+ height: -titleTopBounds.height() - 2 * spaceH
43
+ });
44
+ const titleTopPanel = titleTopGroup.createOrUpdateChild("label-item-title-top-panel", Object.assign(Object.assign({}, titleTopPanelStyle), {
45
+ x: titleTopPanelStyle.padding.left,
46
+ y: (titleTopGroup.attribute.height > 0 ? 0 : titleTopGroup.attribute.height) + titleTopPanelStyle.padding.top,
47
+ width: titleTopGroup.attribute.width - titleTopPanelStyle.padding.left - titleTopPanelStyle.padding.right,
48
+ height: (titleTopGroup.attribute.height > 0 ? 1 : -1) * titleTopGroup.attribute.height - titleTopPanelStyle.padding.bottom - titleTopPanelStyle.padding.top,
49
+ scaleCenter: [ titleTopGroup.attribute.width / 2, titleTopGroup.attribute.height / 2 ]
50
+ }), "rect");
51
+ this._titleTopPanel = titleTopPanel;
52
+ const titleBottomGroup = group.createOrUpdateChild("label-item-title-bottom-group", {
53
+ x: contentOffsetX,
54
+ y: contentOffsetY,
55
+ clip: !0
56
+ }, "group"), titleBottom = titleBottomGroup.createOrUpdateChild("label-item-title-bottom", Object.assign(Object.assign({
57
+ x: spaceW,
58
+ y: spaceH,
59
+ text: titleBottomText
60
+ }, titleBottomStyle), {
61
+ textBaseline: "top",
62
+ textAlign: "left",
63
+ zIndex: 10
64
+ }), "text"), titleBottomBounds = titleBottom.AABBBounds;
65
+ contentOffsetX > 0 && titleBottomGroup.setAttributes({
66
+ x: contentOffsetX - titleBottomBounds.width() - 2 * spaceW
67
+ }), titleBottomGroup.setAttributes({
68
+ width: titleBottomBounds.width() + 2 * spaceW,
69
+ height: titleTopBounds.height() + 2 * spaceH
70
+ });
71
+ const titleBottomPanel = titleBottomGroup.createOrUpdateChild("label-item-title-bottom-panel", Object.assign(Object.assign({}, titleBottomPanelStyle), {
72
+ x: titleBottomPanelStyle.padding.left,
73
+ y: (titleBottomGroup.attribute.height > 0 ? 0 : titleBottomGroup.attribute.height) + titleBottomPanelStyle.padding.top,
74
+ width: titleBottomGroup.attribute.width - titleBottomPanelStyle.padding.left - titleBottomPanelStyle.padding.right,
75
+ height: (titleBottomGroup.attribute.height > 0 ? 1 : -1) * titleBottomGroup.attribute.height - titleBottomPanelStyle.padding.bottom - titleBottomPanelStyle.padding.top,
76
+ scaleCenter: [ titleBottomGroup.attribute.width / 2, titleBottomGroup.attribute.height / 2 ]
77
+ }), "rect");
78
+ this._titleBottomPanel = titleBottomPanel;
79
+ const maxTextWidth = Math.max(titleTop.AABBBounds.width(), titleBottom.AABBBounds.width()) + 2 * spaceW, points = [ {
80
+ x: 0,
81
+ y: 0
82
+ }, contentOffsetX > 0 ? {
83
+ x: contentOffsetX - maxTextWidth,
84
+ y: contentOffsetY
85
+ } : {
86
+ x: contentOffsetX + maxTextWidth,
87
+ y: contentOffsetY
88
+ }, {
89
+ x: contentOffsetX,
90
+ y: contentOffsetY
91
+ } ];
92
+ if ("simple" === theme) {
93
+ points.pop();
94
+ const p = points[1];
95
+ symbolEnd.setAttributes(p);
96
+ }
97
+ const line = group.createOrUpdateChild("label-item-line", Object.assign(Object.assign({
98
+ x: 0,
99
+ y: 0
100
+ }, lineStyle), {
101
+ points: points
102
+ }), "line");
103
+ this._symbolEnd = symbolEnd, this._symbolStart = symbolStart, this._symbolStartOuter = symbolStartOut,
104
+ this._titleTop = titleTop, this._titleBottom = titleBottom, this._line = line;
105
+ }
106
+ appearAnimate(animateConfig) {
107
+ const {duration: duration = 1e3, easing: easing = "quadOut", symbolStartOuterType: symbolStartOuterType = "scale", titleType: titleType = "typewriter", titlePanelType: titlePanelType = "scale"} = animateConfig, symbolTime = duration / 10;
108
+ let symbolStartOuterFrom, symbolStartOuterTo;
109
+ if (this._symbolStart.setAttributes({
110
+ scaleX: 0,
111
+ scaleY: 0
112
+ }), this._symbolStart.animate().to({
113
+ scaleX: 1,
114
+ scaleY: 1
115
+ }, 5 * symbolTime, easing), "scale" === symbolStartOuterType ? (symbolStartOuterFrom = {
116
+ scaleX: 0,
117
+ scaleY: 0
118
+ }, symbolStartOuterTo = {
119
+ scaleX: 1,
120
+ scaleY: 1
121
+ }) : (symbolStartOuterFrom = {
122
+ clipRange: 0
123
+ }, symbolStartOuterTo = {
124
+ clipRange: 1
125
+ }), this._symbolStartOuter.setAttributes(symbolStartOuterFrom), this._symbolStartOuter.animate().to(symbolStartOuterTo, 5 * symbolTime, easing),
126
+ this._symbolEnd.setAttributes({
127
+ scaleX: 0,
128
+ scaleY: 0
129
+ }), this._symbolEnd.animate().wait(8 * symbolTime).to({
130
+ scaleX: 1,
131
+ scaleY: 1
132
+ }, 2 * symbolTime, easing), this._line.setAttributes({
133
+ clipRange: 0
134
+ }), this._line.animate().to({
135
+ clipRange: 1
136
+ }, 9 * symbolTime, easing), "typewriter" === titleType) {
137
+ const titleTopText = this._titleTop.attribute.text;
138
+ this._titleTop.setAttributes({
139
+ text: ""
140
+ }), this._titleTop.animate().wait(5 * symbolTime).play(new InputText({
141
+ text: ""
142
+ }, {
143
+ text: titleTopText
144
+ }, 4 * symbolTime, "linear"));
145
+ const titleBottomText = this._titleBottom.attribute.text;
146
+ this._titleBottom.setAttributes({
147
+ text: ""
148
+ }), this._titleBottom.animate().wait(5 * symbolTime).play(new InputText({
149
+ text: ""
150
+ }, {
151
+ text: titleBottomText
152
+ }, 4 * symbolTime, "linear"));
153
+ } else this._titleTop.setAttributes({
154
+ dy: this._titleTop.AABBBounds.height() + 10
155
+ }), this._titleTop.animate().wait(5 * symbolTime).to({
156
+ dy: 0
157
+ }, 4 * symbolTime, "linear"), this._titleBottom.setAttributes({
158
+ dy: -(10 + this._titleBottom.AABBBounds.height())
159
+ }), this._titleBottom.animate().wait(5 * symbolTime).to({
160
+ dy: 0
161
+ }, 4 * symbolTime, "linear");
162
+ "scale" === titlePanelType ? [ this._titleTopPanel, this._titleBottomPanel ].forEach((panel => {
163
+ const scaleX = panel.attribute.scaleX;
164
+ panel.setAttributes({
165
+ scaleX: 0
166
+ }), panel.animate().to({
167
+ scaleX: scaleX
168
+ }, duration, "circInOut");
169
+ })) : "stroke" === titlePanelType && [ this._titleTopPanel, this._titleBottomPanel ].forEach((panel => {
170
+ const b = panel.AABBBounds, totalLen = 2 * (b.width() + b.height());
171
+ panel.setAttributes({
172
+ lineDash: [ 0, 10 * totalLen ]
173
+ }), panel.animate().to({
174
+ lineDash: [ totalLen, 10 * totalLen ]
175
+ }, duration, "quadOut");
176
+ }));
177
+ }
178
+ disappearAnimate(animateConfig) {
179
+ if ("scale" === animateConfig.mode) {
180
+ const {duration: duration = 1e3, easing: easing = "quadOut"} = animateConfig;
181
+ this.animate().to({
182
+ scaleX: 0,
183
+ scaleY: 0
184
+ }, duration, easing);
185
+ } else {
186
+ const {duration: duration = 1e3, easing: easing = "quadOut"} = animateConfig;
187
+ this._line.animate().to({
188
+ clipRange: 0
189
+ }, duration, easing), this._symbolStart.animate().wait(duration / 2).to({
190
+ scaleX: 0,
191
+ scaleY: 0
192
+ }, duration / 2, easing), this._symbolEnd.animate().to({
193
+ scaleX: 0,
194
+ scaleY: 0
195
+ }, duration, easing), this._titleTop.animate().to({
196
+ dy: this._titleTop.AABBBounds.height() + 10
197
+ }, duration / 2, easing), this._titleBottom.animate().to({
198
+ dy: -(10 + this._titleBottom.AABBBounds.height())
199
+ }, duration / 2, easing), this._symbolStartOuter.animate().wait(duration / 2).to({
200
+ clipRange: 0
201
+ }, duration / 2, easing), this._titleTopPanel.animate().to({
202
+ scaleX: 0
203
+ }, duration, "circInOut"), this._titleBottomPanel.animate().to({
204
+ scaleX: 0
205
+ }, duration, "circInOut");
206
+ }
207
+ }
208
+ }
209
+
210
+ StoryLabelItem.defaultAttributes = {
211
+ contentOffsetX: 100,
212
+ contentOffsetY: -60,
213
+ titleTopStyle: {
214
+ fontSize: 12,
215
+ fill: "white"
216
+ },
217
+ titleBottomStyle: {
218
+ fontSize: 12,
219
+ fill: "white"
220
+ },
221
+ lineStyle: {
222
+ stroke: "white",
223
+ lineWidth: 1
224
+ },
225
+ symbolStartStyle: {
226
+ symbolType: "circle",
227
+ size: 3,
228
+ fill: "white"
229
+ },
230
+ symbolEndStyle: {
231
+ symbolType: "circle",
232
+ size: 3,
233
+ fill: "white"
234
+ },
235
+ symbolStartOuterStyle: {
236
+ symbolType: "M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0",
237
+ size: 8,
238
+ stroke: "white"
239
+ },
240
+ titleSpace: [ 2, 2 ],
241
+ titleTopPanelStyle: {
242
+ visible: !1,
243
+ padding: {
244
+ left: 0,
245
+ right: 0,
246
+ bottom: 2,
247
+ top: 2
248
+ },
249
+ cornerRadius: 3
250
+ },
251
+ titleBottomPanelStyle: {
252
+ visible: !1,
253
+ padding: {
254
+ left: 0,
255
+ right: 0,
256
+ bottom: 2,
257
+ top: 2
258
+ },
259
+ cornerRadius: 3
260
+ },
261
+ theme: "default"
262
+ };
263
+ //# sourceMappingURL=label-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/label-item/label-item.ts"],"names":[],"mappings":"AASA,OAAO,EAAkB,SAAS,EAAoB,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,OAAO,cAAe,SAAQ,iBAAiD;IA6DnF,YAAY,UAAgC,EAAE,OAA0B;QACtE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,cAAc,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;IACrG,CAAC;IAES,MAAM;QACd,MAAM,EACJ,cAAc,EACd,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,eAAe,EAC5B,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,EACN,GAAG,IAAI,CAAC,SAAS,CAAC;QAEnB,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,sBAAsB,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,OAAO,CAAW,CAAC;QAE7G,MAAM,WAAW,GAAG,KAAK,CAAC,mBAAmB,CAC3C,yBAAyB,kBACvB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAK,gBAAgB,GACjC,QAAQ,CACE,CAAC;QACb,MAAM,SAAS,GAAG,KAAK,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C;KACY;IAE1B,gBAAgB,EAAE;QAChB,UAAU,EAAE,QAAQ;QACpB,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,OAAO;KACsB;IAErC,cAAc,EAAE;QACd,UAAU,EAAE,QAAQ;QACpB,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,OAAO;KACsB;IAErC,qBAAqB,EAAE;QACrB,UAAU,EAAE,iDAAiD;QAC7D,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,OAAO;KACoB;IACrC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAClB,kBAAkB,EAAE;QAClB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;QACjD,YAAY,EAAE,CAAC;KAChB;IACD,qBAAqB,EAAE;QACrB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;QACjD,YAAY,EAAE,CAAC;KAChB;IAED,KAAK,EAAE,SAAS;CACjB,CAAC","file":"label-item.js","sourcesContent":["import type {\n IGroup,\n ILine,\n ILineGraphicAttribute,\n IRect,\n ISymbol,\n ISymbolGraphicAttribute,\n IText\n} from '@visactor/vrender-core';\nimport { ILineAttribute, InputText, ISymbolAttribute } from '@visactor/vrender-core';\nimport { AbstractComponent } from '../core/base';\nimport type { IStoryLabelItemAttrs } from './type';\nimport type { ComponentOptions } from '../interface';\nimport { max, merge } from '@visactor/vutils';\n\nexport class StoryLabelItem extends AbstractComponent<Required<IStoryLabelItemAttrs>> {\n name: 'labelItem';\n private _line?: ILine;\n private _symbolStart: ISymbol;\n private _symbolEnd: ISymbol;\n private _symbolStartOuter: ISymbol;\n private _titleTop: IText;\n private _titleBottom: IText;\n private _titleTopPanel: IRect;\n private _titleBottomPanel: IRect;\n\n static defaultAttributes: Partial<IStoryLabelItemAttrs> = {\n // 内容在X上的偏移量\n contentOffsetX: 100,\n // 内容在Y上的偏移量\n contentOffsetY: -60,\n titleTopStyle: {\n fontSize: 12,\n fill: 'white'\n },\n titleBottomStyle: {\n fontSize: 12,\n fill: 'white'\n },\n lineStyle: {\n stroke: 'white',\n lineWidth: 1\n } as ILineGraphicAttribute,\n // 线段开始端点的样式\n symbolStartStyle: {\n symbolType: 'circle',\n size: 3,\n fill: 'white'\n } as Partial<ISymbolGraphicAttribute>,\n // 线段结束端点的样式\n symbolEndStyle: {\n symbolType: 'circle',\n size: 3,\n fill: 'white'\n } as Partial<ISymbolGraphicAttribute>,\n // 线段开始端点外面包裹symbol的样式\n symbolStartOuterStyle: {\n symbolType: 'M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0',\n size: 8,\n stroke: 'white'\n } as Partial<ISymbolGraphicAttribute>,\n titleSpace: [2, 2],\n titleTopPanelStyle: {\n visible: false,\n padding: { left: 0, right: 0, bottom: 2, top: 2 },\n cornerRadius: 3\n },\n titleBottomPanelStyle: {\n visible: false,\n padding: { left: 0, right: 0, bottom: 2, top: 2 },\n cornerRadius: 3\n },\n // 默认和简约两套主题\n theme: 'default'\n };\n\n constructor(attributes: IStoryLabelItemAttrs, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, StoryLabelItem.defaultAttributes, attributes));\n }\n\n protected render(): void {\n const {\n contentOffsetX,\n contentOffsetY,\n lineStyle,\n symbolStartStyle,\n symbolEndStyle,\n symbolStartOuterStyle,\n titleTop: titleTopText,\n titleBottom: titleBottomText,\n titleTopStyle,\n titleBottomStyle,\n titleSpace,\n titleTopPanelStyle,\n titleBottomPanelStyle,\n theme\n } = this.attribute;\n\n const group = this.createOrUpdateChild('label-item-container', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n const symbolStart = group.createOrUpdateChild(\n 'label-item-symbol-start',\n { x: 0, y: 0, ...symbolStartStyle },\n 'symbol'\n ) as ISymbol;\n const symbolEnd = group.createOrUpdateChild(\n 'label-item-symbol-end',\n { x: contentOffsetX, y: contentOffsetY, ...symbolEndStyle },\n 'symbol'\n ) as ISymbol;\n const symbolStartOut = group.createOrUpdateChild(\n 'label-item-symbol-start-out',\n { x: 0, y: 0, ...symbolStartOuterStyle },\n 'symbol'\n ) as ISymbol;\n\n const spaceW = titleSpace[0];\n const spaceH = titleSpace[1];\n // 逻辑:group占满,title在group内做偏移\n const titleTopGroup = group.createOrUpdateChild(\n 'label-item-title-top-group',\n { x: contentOffsetX, y: contentOffsetY, clip: true },\n 'group'\n ) as IGroup;\n const titleTop = titleTopGroup.createOrUpdateChild(\n 'label-item-title-top',\n {\n x: spaceW,\n y: -spaceH,\n text: titleTopText,\n ...titleTopStyle,\n textBaseline: 'bottom',\n textAlign: 'left',\n zIndex: 10\n },\n 'text'\n ) as IText;\n const titleTopBounds = titleTop.AABBBounds;\n if (contentOffsetX > 0) {\n titleTopGroup.setAttributes({ x: contentOffsetX - titleTopBounds.width() - spaceW * 2 });\n }\n titleTopGroup.setAttributes({\n width: titleTopBounds.width() + spaceW * 2,\n height: -titleTopBounds.height() - spaceH * 2\n });\n // 添加panel\n const titleTopPanel = titleTopGroup.createOrUpdateChild(\n 'label-item-title-top-panel',\n {\n ...titleTopPanelStyle,\n x: titleTopPanelStyle.padding.left,\n y: (titleTopGroup.attribute.height > 0 ? 0 : titleTopGroup.attribute.height) + titleTopPanelStyle.padding.top,\n width: titleTopGroup.attribute.width - titleTopPanelStyle.padding.left - titleTopPanelStyle.padding.right,\n height:\n (titleTopGroup.attribute.height > 0 ? 1 : -1) * titleTopGroup.attribute.height -\n titleTopPanelStyle.padding.bottom -\n titleTopPanelStyle.padding.top,\n scaleCenter: [titleTopGroup.attribute.width / 2, titleTopGroup.attribute.height / 2]\n },\n 'rect'\n ) as IRect;\n this._titleTopPanel = titleTopPanel;\n\n const titleBottomGroup = group.createOrUpdateChild(\n 'label-item-title-bottom-group',\n { x: contentOffsetX, y: contentOffsetY, clip: true },\n 'group'\n ) as IGroup;\n const titleBottom = titleBottomGroup.createOrUpdateChild(\n 'label-item-title-bottom',\n {\n x: spaceW,\n y: spaceH,\n text: titleBottomText,\n ...titleBottomStyle,\n textBaseline: 'top',\n textAlign: 'left',\n zIndex: 10\n },\n 'text'\n ) as IText;\n const titleBottomBounds = titleBottom.AABBBounds;\n if (contentOffsetX > 0) {\n titleBottomGroup.setAttributes({ x: contentOffsetX - titleBottomBounds.width() - spaceW * 2 });\n }\n titleBottomGroup.setAttributes({\n width: titleBottomBounds.width() + spaceW * 2,\n height: titleTopBounds.height() + spaceH * 2\n });\n // 添加panel\n const titleBottomPanel = titleBottomGroup.createOrUpdateChild(\n 'label-item-title-bottom-panel',\n {\n ...titleBottomPanelStyle,\n x: titleBottomPanelStyle.padding.left,\n y:\n (titleBottomGroup.attribute.height > 0 ? 0 : titleBottomGroup.attribute.height) +\n titleBottomPanelStyle.padding.top,\n width:\n titleBottomGroup.attribute.width - titleBottomPanelStyle.padding.left - titleBottomPanelStyle.padding.right,\n height:\n (titleBottomGroup.attribute.height > 0 ? 1 : -1) * titleBottomGroup.attribute.height -\n titleBottomPanelStyle.padding.bottom -\n titleBottomPanelStyle.padding.top,\n scaleCenter: [titleBottomGroup.attribute.width / 2, titleBottomGroup.attribute.height / 2]\n },\n 'rect'\n ) as IRect;\n this._titleBottomPanel = titleBottomPanel;\n\n const maxTextWidth = Math.max(titleTop.AABBBounds.width(), titleBottom.AABBBounds.width()) + spaceW * 2;\n const points = [\n { x: 0, y: 0 },\n contentOffsetX > 0\n ? { x: contentOffsetX - maxTextWidth, y: contentOffsetY }\n : { x: contentOffsetX + maxTextWidth, y: contentOffsetY },\n { x: contentOffsetX, y: contentOffsetY }\n ];\n // simple风格,不绘制终点,同时文字也要居中\n if (theme === 'simple') {\n points.pop();\n const p = points[1];\n symbolEnd.setAttributes(p);\n }\n const line = group.createOrUpdateChild('label-item-line', { x: 0, y: 0, ...lineStyle, points }, 'line') as ILine;\n\n this._symbolEnd = symbolEnd;\n this._symbolStart = symbolStart;\n this._symbolStartOuter = symbolStartOut;\n this._titleTop = titleTop;\n this._titleBottom = titleBottom;\n this._line = line;\n }\n\n appearAnimate(animateConfig: {\n duration?: number;\n easing?: string;\n symbolStartOuterType?: 'scale' | 'clipRange';\n titleType?: 'typewriter' | 'move';\n titlePanelType?: 'scale' | 'stroke';\n }) {\n const {\n duration = 1000,\n easing = 'quadOut',\n symbolStartOuterType = 'scale',\n titleType = 'typewriter',\n titlePanelType = 'scale'\n } = animateConfig;\n const symbolTime = duration / 10;\n this._symbolStart.setAttributes({ scaleX: 0, scaleY: 0 });\n this._symbolStart.animate().to({ scaleX: 1, scaleY: 1 }, symbolTime * 5, easing as any);\n\n let symbolStartOuterFrom: ISymbolGraphicAttribute;\n let symbolStartOuterTo: ISymbolGraphicAttribute;\n if (symbolStartOuterType === 'scale') {\n symbolStartOuterFrom = { scaleX: 0, scaleY: 0 };\n symbolStartOuterTo = { scaleX: 1, scaleY: 1 };\n } else {\n symbolStartOuterFrom = { clipRange: 0 };\n symbolStartOuterTo = { clipRange: 1 };\n }\n this._symbolStartOuter.setAttributes(symbolStartOuterFrom);\n this._symbolStartOuter.animate().to(symbolStartOuterTo, symbolTime * 5, easing as any);\n\n this._symbolEnd.setAttributes({ scaleX: 0, scaleY: 0 });\n this._symbolEnd\n .animate()\n .wait(symbolTime * 8)\n .to({ scaleX: 1, scaleY: 1 }, symbolTime * 2, easing as any);\n\n this._line.setAttributes({ clipRange: 0 });\n this._line.animate().to({ clipRange: 1 }, symbolTime * 9, easing as any);\n\n if (titleType === 'typewriter') {\n const titleTopText = this._titleTop.attribute.text as string;\n this._titleTop.setAttributes({ text: '' });\n this._titleTop\n .animate()\n .wait(symbolTime * 5)\n .play(new InputText({ text: '' }, { text: titleTopText }, symbolTime * 4, 'linear'));\n\n const titleBottomText = this._titleBottom.attribute.text as string;\n this._titleBottom.setAttributes({ text: '' });\n this._titleBottom\n .animate()\n .wait(symbolTime * 5)\n .play(new InputText({ text: '' }, { text: titleBottomText }, symbolTime * 4, 'linear'));\n } else {\n this._titleTop.setAttributes({ dy: this._titleTop.AABBBounds.height() + 10 });\n this._titleTop\n .animate()\n .wait(symbolTime * 5)\n .to({ dy: 0 }, symbolTime * 4, 'linear');\n\n this._titleBottom.setAttributes({ dy: -(10 + this._titleBottom.AABBBounds.height()) });\n this._titleBottom\n .animate()\n .wait(symbolTime * 5)\n .to({ dy: 0 }, symbolTime * 4, 'linear');\n }\n\n if (titlePanelType === 'scale') {\n [this._titleTopPanel, this._titleBottomPanel].forEach(panel => {\n const scaleX = panel.attribute.scaleX;\n panel.setAttributes({ scaleX: 0 });\n panel.animate().to({ scaleX }, duration, 'circInOut');\n });\n } else if (titlePanelType === 'stroke') {\n [this._titleTopPanel, this._titleBottomPanel].forEach(panel => {\n const b = panel.AABBBounds;\n const totalLen = (b.width() + b.height()) * 2;\n panel.setAttributes({ lineDash: [0, totalLen * 10] });\n panel.animate().to({ lineDash: [totalLen, totalLen * 10] }, duration, 'quadOut');\n });\n }\n }\n\n disappearAnimate(animateConfig: { duration?: number; easing?: string; mode?: 'scale' | 'default' }) {\n if (animateConfig.mode === 'scale') {\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n this.animate().to({ scaleX: 0, scaleY: 0 }, duration, easing as any);\n } else {\n const { duration = 1000, easing = 'quadOut' } = animateConfig;\n this._line.animate().to({ clipRange: 0 }, duration, easing as any);\n this._symbolStart\n .animate()\n .wait(duration / 2)\n .to({ scaleX: 0, scaleY: 0 }, duration / 2, easing as any);\n this._symbolEnd.animate().to({ scaleX: 0, scaleY: 0 }, duration, easing as any);\n this._titleTop.animate().to({ dy: this._titleTop.AABBBounds.height() + 10 }, duration / 2, easing as any);\n this._titleBottom\n .animate()\n .to({ dy: -(10 + this._titleBottom.AABBBounds.height()) }, duration / 2, easing as any);\n this._symbolStartOuter\n .animate()\n .wait(duration / 2)\n .to({ clipRange: 0 }, duration / 2, easing as any);\n this._titleTopPanel.animate().to({ scaleX: 0 }, duration, 'circInOut');\n this._titleBottomPanel.animate().to({ scaleX: 0 }, duration, 'circInOut');\n }\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function loadLabelItemComponent(): void;
@@ -0,0 +1,6 @@
1
+ import { registerGroup, registerSymbol, registerLine, registerText } from "@visactor/vrender-kits";
2
+
3
+ export function loadLabelItemComponent() {
4
+ registerGroup(), registerText(), registerSymbol(), registerLine();
5
+ }
6
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/label-item/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEnG,MAAM,UAAU,sBAAsB;IACpC,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,CAAC;IACf,cAAc,EAAE,CAAC;IACjB,YAAY,EAAE,CAAC;AACjB,CAAC","file":"register.js","sourcesContent":["import { registerGroup, registerSymbol, registerLine, registerText } from '@visactor/vrender-kits';\n\nexport function loadLabelItemComponent() {\n registerGroup();\n registerText();\n registerSymbol();\n registerLine();\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import type { IGroupGraphicAttribute, ILineGraphicAttribute, IRectGraphicAttribute, ISymbolGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';
2
+ export interface IStoryLabelItemAttrs extends IGroupGraphicAttribute {
3
+ contentOffsetX: number;
4
+ contentOffsetY: number;
5
+ lineStyle?: ILineGraphicAttribute;
6
+ symbolStartStyle?: ISymbolGraphicAttribute;
7
+ symbolEndStyle?: ISymbolGraphicAttribute;
8
+ symbolStartOuterStyle?: ISymbolGraphicAttribute;
9
+ theme?: 'default' | 'simple';
10
+ titleTop?: string | string[];
11
+ titleBottom?: string | string[];
12
+ titleTopStyle?: ITextGraphicAttribute;
13
+ titleBottomStyle?: ITextGraphicAttribute;
14
+ titleSpace?: [number, number];
15
+ titleTopPanelStyle?: IRectGraphicAttribute & {
16
+ padding: {
17
+ left: number;
18
+ right: number;
19
+ top: number;
20
+ bottom: number;
21
+ };
22
+ };
23
+ titleBottomPanelStyle?: IRectGraphicAttribute & {
24
+ padding: {
25
+ left: number;
26
+ right: number;
27
+ top: number;
28
+ bottom: number;
29
+ };
30
+ };
31
+ }
@@ -0,0 +1,2 @@
1
+ export { };
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/label-item/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IGroupGraphicAttribute,\n ILineGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute\n} from '@visactor/vrender-core';\nimport { ILineAttribute, ISymbolAttribute } from '@visactor/vrender-core';\n\nexport interface IStoryLabelItemAttrs extends IGroupGraphicAttribute {\n // 内容在X上的偏移量\n contentOffsetX: number;\n // 内容在Y上的偏移量\n contentOffsetY: number;\n lineStyle?: ILineGraphicAttribute;\n // 线段开始端点的样式\n symbolStartStyle?: ISymbolGraphicAttribute;\n // 线段结束端点的样式\n symbolEndStyle?: ISymbolGraphicAttribute;\n // 线段开始端点外面包裹symbol的样式\n symbolStartOuterStyle?: ISymbolGraphicAttribute;\n // 默认和简约两套主题\n theme?: 'default' | 'simple';\n // 顶部文字内容\n titleTop?: string | string[];\n // 底部文字内容\n titleBottom?: string | string[];\n // 顶部文字样式\n titleTopStyle?: ITextGraphicAttribute;\n // 底部文字样式\n titleBottomStyle?: ITextGraphicAttribute;\n // 水平和垂直方向的边距\n titleSpace?: [number, number];\n // 顶部的panel\n titleTopPanelStyle?: IRectGraphicAttribute & {\n padding: { left: number; right: number; top: number; bottom: number };\n };\n // 底部的panel\n titleBottomPanelStyle?: IRectGraphicAttribute & {\n padding: { left: number; right: number; top: number; bottom: number };\n };\n}\n"]}
@@ -1,15 +1,27 @@
1
+ import { type IGroup, type IText } from '@visactor/vrender-core';
1
2
  import { AbstractComponent } from '../core/base';
2
3
  import type { ComponentOptions } from '../interface';
3
4
  import type { PopTipAttributes } from './type';
4
5
  export declare class PopTip extends AbstractComponent<Required<PopTipAttributes>> {
5
6
  name: string;
6
7
  static defaultAttributes: Partial<PopTipAttributes>;
8
+ titleShape?: IText;
9
+ contentShape?: IText;
10
+ group?: IGroup;
7
11
  constructor(attributes: PopTipAttributes, options?: ComponentOptions);
8
12
  protected render(): void;
9
13
  positionList: string[];
10
- getAngleAndOffset(position: string, width: number, height: number, size: [number, number]): {
14
+ getAngleAndOffset(position: string, width: number, height: number, size: [number, number], symbolType: 'arrow2Left' | string): {
11
15
  angle: number;
12
16
  offset: [number, number];
13
- rectOffset: [number, number];
14
17
  };
18
+ appearAnimate(animateConfig: {
19
+ duration?: number;
20
+ easing?: string;
21
+ wave?: number;
22
+ }): void;
23
+ disappearAnimate(animateConfig: {
24
+ duration?: number;
25
+ easing?: string;
26
+ }): void;
15
27
  }