@visactor/vrender-components 1.1.6-alpha.0 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/legend/discrete/discrete.d.ts +0 -1
- package/cjs/legend/discrete/discrete.js +15 -30
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/dist/index.es.js +387 -189
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/legend/discrete/discrete.d.ts +0 -1
- package/es/legend/discrete/discrete.js +13 -29
- package/es/legend/discrete/discrete.js.map +1 -1
- package/package.json +6 -6
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OA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AK,EAAE,MAAM,eAAe,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,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,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"1.1.6\";\n\nexport * from './core/base';\nexport { AbstractComponent } from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport { ScrollBar } from './scrollbar/scrollbar';\nexport { loadScrollbar } from './scrollbar/module';\nexport * from './tag';\nexport * from './poptip';\nexport { loadPoptip } from './poptip/module';\nexport * from './crosshair';\nexport { LineCrosshair } from './crosshair/line';\nexport { CircleCrosshair } from './crosshair/circle';\nexport { SectorCrosshair } from './crosshair/sector';\nexport { PolygonCrosshair } from './crosshair/polygon';\nexport * from './label';\nexport { DataLabel } from './label/dataLabel';\nexport { registerSymbolDataLabel } from './label/symbol';\nexport * from './axis';\nexport { LineAxis } from './axis/line';\nexport { CircleAxis } from './axis/circle';\nexport { continuousTicks } from './axis/tick-data/continuous';\nexport { polarAngleAxisDiscreteTicks } from './axis/tick-data/discrete/polar-angle';\nexport * from './axis/grid';\nexport { LineAxisGrid } from './axis/grid/line';\nexport { CircleAxisGrid } from './axis/grid/circle';\nexport * from './segment';\nexport { Segment } from './segment/segment';\nexport * from './data-zoom';\nexport { DataZoom } from './data-zoom/data-zoom';\nexport * from './marker';\nexport { MarkLine, registerMarkLineAnimate } from './marker/line';\nexport { MarkArea, registerMarkAreaAnimate } from './marker/area';\nexport { MarkArcLine, registerMarkArcLineAnimate } from './marker/arc-line';\nexport { MarkArcArea, registerMarkArcAreaAnimate } from './marker/arc-area';\nexport { MarkPoint, registerMarkPointAnimate } from './marker/point';\nexport * from './pager';\nexport * from './legend';\nexport { ColorContinuousLegend } from './legend/color/color';\nexport { SizeContinuousLegend } from './legend/size/size';\nexport * from './title';\nexport { Title } from './title/title';\nexport * from './indicator';\nexport { Indicator } from './indicator/indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport { DiscretePlayer } from './player/discrete-player';\nexport { ContinuousPlayer } from './player/continuous-player';\nexport { PlayerEventEnum } from './player/type/event';\nexport * from './brush';\nexport { Brush } from './brush/brush';\nexport { IOperateType } from './brush/type';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport { labelSmartInvert } from './util/label-smartInvert';\nexport * from './switch';\nexport * from './label-item';\nexport * from './table-series-number';\n"]}
|
|
@@ -15,7 +15,6 @@ export declare class DiscreteLegend extends LegendBase<DiscreteLegendAttrs> {
|
|
|
15
15
|
private _itemContext;
|
|
16
16
|
private _scrollMask;
|
|
17
17
|
private _scrollMaskContext;
|
|
18
|
-
private _stateDefinitionsCache;
|
|
19
18
|
static defaultAttributes: Partial<DiscreteLegendAttrs>;
|
|
20
19
|
constructor(attributes: DiscreteLegendAttrs, options?: ComponentOptions);
|
|
21
20
|
render(): void;
|
|
@@ -10,8 +10,6 @@ var __rest = this && this.__rest || function(s, e) {
|
|
|
10
10
|
|
|
11
11
|
import { merge, isEmpty, normalizePadding, get, isValid, isNil, isFunction, isArray, minInArray, throttle, isNumberClose, clamp, isObject } from "@visactor/vutils";
|
|
12
12
|
|
|
13
|
-
import { StateDefinitionCompiler } from "@visactor/vrender-core";
|
|
14
|
-
|
|
15
13
|
import { graphicCreator } from "../../util/graphic-creator";
|
|
16
14
|
|
|
17
15
|
import { LegendBase } from "../base";
|
|
@@ -42,8 +40,7 @@ export class DiscreteLegend extends LegendBase {
|
|
|
42
40
|
constructor(attributes, options) {
|
|
43
41
|
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, DiscreteLegend.defaultAttributes, attributes)),
|
|
44
42
|
this.name = "discreteLegend", this._itemsContainer = null, this._itemHeightByUser = void 0,
|
|
45
|
-
this._itemHeight = 0, this._itemMaxWidth = 0, this._contentMaxHeight = 0, this.
|
|
46
|
-
this._onHover = e => {
|
|
43
|
+
this._itemHeight = 0, this._itemMaxWidth = 0, this._contentMaxHeight = 0, this._onHover = e => {
|
|
47
44
|
const target = e.target;
|
|
48
45
|
if (target && target.name && target.name.startsWith(LEGEND_ELEMENT_NAME.item)) {
|
|
49
46
|
const legendItem = target.delegate;
|
|
@@ -91,7 +88,7 @@ export class DiscreteLegend extends LegendBase {
|
|
|
91
88
|
};
|
|
92
89
|
}
|
|
93
90
|
render() {
|
|
94
|
-
|
|
91
|
+
super.render(), this._lastActiveItem = null;
|
|
95
92
|
}
|
|
96
93
|
setSelected(selectedData) {
|
|
97
94
|
var _a;
|
|
@@ -209,7 +206,7 @@ export class DiscreteLegend extends LegendBase {
|
|
|
209
206
|
}), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup)) : (itemGroup = graphicCreator.group(Object.assign({
|
|
210
207
|
x: 0,
|
|
211
208
|
y: 0
|
|
212
|
-
}, backgroundStyle.style)), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state
|
|
209
|
+
}, backgroundStyle.style)), this._appendDataToShape(itemGroup, LEGEND_ELEMENT_NAME.item, item, itemGroup, backgroundStyle.state)),
|
|
213
210
|
itemGroup.id = `${null != id ? id : label}-${index}`, itemGroup.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected);
|
|
214
211
|
const innerGroup = graphicCreator.group({
|
|
215
212
|
x: 0,
|
|
@@ -231,7 +228,7 @@ export class DiscreteLegend extends LegendBase {
|
|
|
231
228
|
const color = shapeStyle.state[key].fill || shapeStyle.state[key].stroke;
|
|
232
229
|
shape.fill && isNil(shapeStyle.state[key].fill) && color && (shapeStyle.state[key].fill = color),
|
|
233
230
|
shape.stroke && isNil(shapeStyle.state[key].stroke) && color && (shapeStyle.state[key].stroke = color);
|
|
234
|
-
})), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state
|
|
231
|
+
})), this._appendDataToShape(itemShape, LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeStyle.state),
|
|
235
232
|
itemShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected),
|
|
236
233
|
innerGroup.add(itemShape);
|
|
237
234
|
}
|
|
@@ -259,7 +256,7 @@ export class DiscreteLegend extends LegendBase {
|
|
|
259
256
|
text: text,
|
|
260
257
|
_originText: labelAttr.formatMethod ? label : void 0
|
|
261
258
|
}), labelShape = createTextGraphicByType(labelAttributes);
|
|
262
|
-
this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state
|
|
259
|
+
this._appendDataToShape(labelShape, LEGEND_ELEMENT_NAME.itemLabel, item, itemGroup, labelStyle.state),
|
|
263
260
|
labelShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected),
|
|
264
261
|
innerGroup.add(labelShape);
|
|
265
262
|
const labelSpace = get(labelAttr, "space", DEFAULT_LABEL_SPACE);
|
|
@@ -274,7 +271,7 @@ export class DiscreteLegend extends LegendBase {
|
|
|
274
271
|
text: valueText,
|
|
275
272
|
_originText: valueAttr.formatMethod ? value : void 0
|
|
276
273
|
}), valueShape = createTextGraphicByType(valueAttributes);
|
|
277
|
-
if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state
|
|
274
|
+
if (this._appendDataToShape(valueShape, LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueStyle.state),
|
|
278
275
|
valueShape.addState(isSelected ? LegendStateValue.selected : LegendStateValue.unSelected),
|
|
279
276
|
this._itemWidthByUser) {
|
|
280
277
|
const layoutWidth = this._itemWidthByUser - parsedPadding[1] - parsedPadding[3] - shapeSize - shapeSpace - labelSpace - focusSpace - valueSpace;
|
|
@@ -617,16 +614,8 @@ export class DiscreteLegend extends LegendBase {
|
|
|
617
614
|
item.hasState(LegendStateValue.selected) && selectedData.push(item.data);
|
|
618
615
|
})), selectedData;
|
|
619
616
|
}
|
|
620
|
-
_appendDataToShape(shape, name, data, delegateShape, states
|
|
621
|
-
|
|
622
|
-
const source = null != states ? states : DEFAULT_STATES, cached = this._stateDefinitionsCache.get(source);
|
|
623
|
-
if (cached) return shape.states = cached.definitions, void shape.setStateDefinitionsWithCompiled(cached.definitions, cached.compiledDefinitions);
|
|
624
|
-
const definitions = states ? merge({}, DEFAULT_STATES, states) : DEFAULT_STATES, entry = {
|
|
625
|
-
definitions: definitions,
|
|
626
|
-
compiledDefinitions: (new StateDefinitionCompiler).compile(definitions)
|
|
627
|
-
};
|
|
628
|
-
this._stateDefinitionsCache.set(source, entry), shape.states = entry.definitions,
|
|
629
|
-
shape.setStateDefinitionsWithCompiled(entry.definitions, entry.compiledDefinitions);
|
|
617
|
+
_appendDataToShape(shape, name, data, delegateShape, states = {}) {
|
|
618
|
+
shape.name = name, shape.data = data, shape.delegate = delegateShape, shape.states = merge({}, DEFAULT_STATES, states);
|
|
630
619
|
}
|
|
631
620
|
_dispatchLegendEvent(eventName, legendItem, event) {
|
|
632
621
|
const currentSelectedItems = this._getSelectedLegends();
|
|
@@ -643,18 +632,13 @@ export class DiscreteLegend extends LegendBase {
|
|
|
643
632
|
}
|
|
644
633
|
_handleStyle(config, item, isSelected, index, items) {
|
|
645
634
|
const newConfig = {};
|
|
646
|
-
|
|
647
|
-
config.state) {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
stateKeys.forEach((key => {
|
|
651
|
-
config.state[key] && (newConfig.state[key] = isFunction(config.state[key]) ? config.state[key](item, isSelected, index, items) : config.state[key]);
|
|
652
|
-
}))) : newConfig.state = config.state;
|
|
653
|
-
}
|
|
654
|
-
return newConfig;
|
|
635
|
+
return config.style && (isFunction(config.style) ? newConfig.style = config.style(item, isSelected, index, items) : newConfig.style = config.style),
|
|
636
|
+
config.state && (newConfig.state = {}, Object.keys(config.state).forEach((key => {
|
|
637
|
+
config.state[key] && (isFunction(config.state[key]) ? newConfig.state[key] = config.state[key](item, isSelected, index, items) : newConfig.state[key] = config.state[key]);
|
|
638
|
+
}))), newConfig;
|
|
655
639
|
}
|
|
656
640
|
release() {
|
|
657
|
-
|
|
641
|
+
super.release(), this.removeAllEventListeners();
|
|
658
642
|
}
|
|
659
643
|
}
|
|
660
644
|
|