@antv/g2 5.4.0 → 5.4.2
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/dist/g2.lite.min.js +10 -10
- package/dist/g2.min.js +10 -10
- package/esm/component/axis.d.ts +1 -0
- package/esm/component/axis.js.map +1 -1
- package/esm/component/constant.d.ts +1 -0
- package/esm/component/constant.js +8 -0
- package/esm/component/constant.js.map +1 -1
- package/esm/component/slider.js +3 -1
- package/esm/component/slider.js.map +1 -1
- package/esm/composition/view.js +4 -4
- package/esm/composition/view.js.map +1 -1
- package/esm/index.d.ts +4 -0
- package/esm/interaction/adaptiveFilter.d.ts +147 -0
- package/esm/interaction/adaptiveFilter.js +305 -0
- package/esm/interaction/adaptiveFilter.js.map +1 -0
- package/esm/interaction/brushHighlight.d.ts +5 -0
- package/esm/interaction/brushHighlight.js +4 -0
- package/esm/interaction/brushHighlight.js.map +1 -1
- package/esm/interaction/index.d.ts +1 -0
- package/esm/interaction/index.js +1 -0
- package/esm/interaction/index.js.map +1 -1
- package/esm/interaction/legendFilter.js +11 -1
- package/esm/interaction/legendFilter.js.map +1 -1
- package/esm/interaction/sliderFilter.d.ts +2 -1
- package/esm/interaction/sliderFilter.js +400 -42
- package/esm/interaction/sliderFilter.js.map +1 -1
- package/esm/interaction/sliderWheel.d.ts +16 -0
- package/esm/interaction/sliderWheel.js +163 -0
- package/esm/interaction/sliderWheel.js.map +1 -0
- package/esm/interaction/tooltip.d.ts +2 -2
- package/esm/interaction/tooltip.js +32 -8
- package/esm/interaction/tooltip.js.map +1 -1
- package/esm/interaction/utils.d.ts +79 -0
- package/esm/interaction/utils.js +221 -0
- package/esm/interaction/utils.js.map +1 -1
- package/esm/lib/builtinlib.d.ts +1 -1
- package/esm/lib/core.d.ts +3 -1
- package/esm/lib/core.js +4 -2
- package/esm/lib/core.js.map +1 -1
- package/esm/lib/std.d.ts +2 -0
- package/esm/mark/beeswarm.d.ts +7 -0
- package/esm/mark/beeswarm.js +98 -0
- package/esm/mark/beeswarm.js.map +1 -0
- package/esm/mark/index.d.ts +2 -0
- package/esm/mark/index.js +1 -0
- package/esm/mark/index.js.map +1 -1
- package/esm/mark/sankey.js +3 -1
- package/esm/mark/sankey.js.map +1 -1
- package/esm/runtime/layout.js +35 -4
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/mark.js +3 -2
- package/esm/runtime/mark.js.map +1 -1
- package/esm/runtime/render.js +1 -0
- package/esm/runtime/render.js.map +1 -1
- package/esm/shape/axis-breaks/axis-breaks.d.ts +3 -1
- package/esm/shape/axis-breaks/axis-breaks.js +52 -33
- package/esm/shape/axis-breaks/axis-breaks.js.map +1 -1
- package/esm/spec/interaction.d.ts +7 -0
- package/esm/utils/helper.js +17 -1
- package/esm/utils/helper.js.map +1 -1
- package/lib/component/axis.d.ts +1 -0
- package/lib/component/axis.js.map +1 -1
- package/lib/component/constant.d.ts +1 -0
- package/lib/component/constant.js +9 -1
- package/lib/component/constant.js.map +1 -1
- package/lib/component/slider.js +3 -1
- package/lib/component/slider.js.map +1 -1
- package/lib/composition/view.js +4 -4
- package/lib/composition/view.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/interaction/adaptiveFilter.d.ts +147 -0
- package/lib/interaction/adaptiveFilter.js +315 -0
- package/lib/interaction/adaptiveFilter.js.map +1 -0
- package/lib/interaction/brushHighlight.d.ts +5 -0
- package/lib/interaction/brushHighlight.js +4 -0
- package/lib/interaction/brushHighlight.js.map +1 -1
- package/lib/interaction/index.d.ts +1 -0
- package/lib/interaction/index.js +3 -1
- package/lib/interaction/index.js.map +1 -1
- package/lib/interaction/legendFilter.js +11 -1
- package/lib/interaction/legendFilter.js.map +1 -1
- package/lib/interaction/sliderFilter.d.ts +2 -1
- package/lib/interaction/sliderFilter.js +399 -41
- package/lib/interaction/sliderFilter.js.map +1 -1
- package/lib/interaction/sliderWheel.d.ts +16 -0
- package/lib/interaction/sliderWheel.js +167 -0
- package/lib/interaction/sliderWheel.js.map +1 -0
- package/lib/interaction/tooltip.d.ts +2 -2
- package/lib/interaction/tooltip.js +32 -8
- package/lib/interaction/tooltip.js.map +1 -1
- package/lib/interaction/utils.d.ts +79 -0
- package/lib/interaction/utils.js +228 -1
- package/lib/interaction/utils.js.map +1 -1
- package/lib/lib/builtinlib.d.ts +1 -1
- package/lib/lib/core.d.ts +3 -1
- package/lib/lib/core.js +2 -0
- package/lib/lib/core.js.map +1 -1
- package/lib/lib/std.d.ts +2 -0
- package/lib/mark/beeswarm.d.ts +7 -0
- package/lib/mark/beeswarm.js +102 -0
- package/lib/mark/beeswarm.js.map +1 -0
- package/lib/mark/index.d.ts +2 -0
- package/lib/mark/index.js +3 -1
- package/lib/mark/index.js.map +1 -1
- package/lib/mark/sankey.js +3 -1
- package/lib/mark/sankey.js.map +1 -1
- package/lib/runtime/layout.js +41 -10
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/mark.js +3 -2
- package/lib/runtime/mark.js.map +1 -1
- package/lib/runtime/render.js +1 -0
- package/lib/runtime/render.js.map +1 -1
- package/lib/shape/axis-breaks/axis-breaks.d.ts +3 -1
- package/lib/shape/axis-breaks/axis-breaks.js +51 -32
- package/lib/shape/axis-breaks/axis-breaks.js.map +1 -1
- package/lib/spec/interaction.d.ts +7 -0
- package/lib/utils/helper.js +17 -1
- package/lib/utils/helper.js.map +1 -1
- package/package.json +30 -9
- package/src/component/axis.ts +5 -0
- package/src/component/constant.ts +9 -0
- package/src/component/slider.ts +6 -1
- package/src/composition/view.ts +4 -1
- package/src/interaction/adaptiveFilter.ts +517 -0
- package/src/interaction/brushHighlight.ts +5 -0
- package/src/interaction/index.ts +1 -0
- package/src/interaction/legendFilter.ts +12 -0
- package/src/interaction/sliderFilter.ts +762 -72
- package/src/interaction/sliderWheel.ts +224 -0
- package/src/interaction/tooltip.ts +33 -8
- package/src/interaction/utils.ts +284 -0
- package/src/lib/core.ts +4 -0
- package/src/mark/beeswarm.ts +150 -0
- package/src/mark/index.ts +2 -0
- package/src/mark/sankey.ts +3 -0
- package/src/runtime/layout.ts +46 -3
- package/src/runtime/mark.ts +2 -1
- package/src/runtime/render.ts +1 -0
- package/src/shape/axis-breaks/axis-breaks.ts +72 -40
- package/src/spec/interaction.ts +7 -0
- package/src/utils/helper.ts +19 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DisplayObject } from '@antv/g';
|
|
2
2
|
import { deepMix, throttle } from '@antv/util';
|
|
3
3
|
import { subObject } from '../utils/helper';
|
|
4
|
+
import { ANNOTATION_MARKS } from '../component/constant';
|
|
4
5
|
import { useState, setCursor, restoreCursor } from './utils';
|
|
5
6
|
|
|
6
7
|
export const CATEGORY_LEGEND_CLASS_NAME = 'legend-category';
|
|
@@ -72,6 +73,7 @@ function legendFilterOrdinal(
|
|
|
72
73
|
label: labelOf, // given the legend returns the label
|
|
73
74
|
datum, // given the legend returns the value
|
|
74
75
|
filter, // invoke when dispatch filter event,
|
|
76
|
+
defaultSelect,
|
|
75
77
|
emitter,
|
|
76
78
|
channel,
|
|
77
79
|
state = {} as Record<string, any>, // state options
|
|
@@ -237,6 +239,12 @@ function legendFilterOrdinal(
|
|
|
237
239
|
emitter.on('legend:focus', onFocus);
|
|
238
240
|
emitter.on('legend:reset', onEnd);
|
|
239
241
|
|
|
242
|
+
if (defaultSelect) {
|
|
243
|
+
emitter.emit('legend:filter', {
|
|
244
|
+
data: { channel, values: defaultSelect },
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
240
248
|
return () => {
|
|
241
249
|
for (const item of items) {
|
|
242
250
|
item.removeEventListener('click', itemClick.get(item));
|
|
@@ -291,6 +299,9 @@ async function filterView(
|
|
|
291
299
|
const newMarks = marks.map((mark) => {
|
|
292
300
|
if (mark.type === 'legends') return mark;
|
|
293
301
|
|
|
302
|
+
// Skip Annotation marks.
|
|
303
|
+
if (ANNOTATION_MARKS.includes(mark.type)) return mark;
|
|
304
|
+
|
|
294
305
|
// Inset after aggregate transform, such as group, and bin.
|
|
295
306
|
const { transform = [], data = [] } = mark;
|
|
296
307
|
const index = transform.findIndex(
|
|
@@ -375,6 +386,7 @@ export function LegendFilter() {
|
|
|
375
386
|
else filter(context, options);
|
|
376
387
|
},
|
|
377
388
|
state: legend.attributes.state,
|
|
389
|
+
defaultSelect: legend.attributes.defaultSelect,
|
|
378
390
|
channel,
|
|
379
391
|
emitter,
|
|
380
392
|
});
|