@antv/component 1.0.1-beta.1 → 1.0.1-beta.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/component.min.js +1 -1
- package/esm/animation/fadeIn.d.ts +1 -1
- package/esm/animation/fadeOut.d.ts +1 -1
- package/esm/animation/utils.d.ts +3 -3
- package/esm/animation/utils.js +14 -10
- package/esm/animation/utils.js.map +1 -1
- package/esm/ui/axis/constant.js +1 -0
- package/esm/ui/axis/constant.js.map +1 -1
- package/esm/ui/axis/guides/labels.js +9 -11
- package/esm/ui/axis/guides/labels.js.map +1 -1
- package/esm/ui/axis/guides/ticks.js +1 -1
- package/esm/ui/axis/guides/ticks.js.map +1 -1
- package/esm/ui/axis/guides/title.js +9 -6
- package/esm/ui/axis/guides/title.js.map +1 -1
- package/esm/ui/axis/overlap/autoEllipsis.js +2 -1
- package/esm/ui/axis/overlap/autoEllipsis.js.map +1 -1
- package/esm/ui/axis/overlap/autoHide.js +2 -1
- package/esm/ui/axis/overlap/autoHide.js.map +1 -1
- package/esm/ui/axis/utils/bounds.d.ts +1 -3
- package/esm/ui/axis/utils/bounds.js +7 -4
- package/esm/ui/axis/utils/bounds.js.map +1 -1
- package/esm/ui/breadcrumb/index.js +2 -2
- package/esm/ui/breadcrumb/index.js.map +1 -1
- package/esm/ui/button/index.js +6 -8
- package/esm/ui/button/index.js.map +1 -1
- package/esm/ui/button/types.d.ts +0 -2
- package/esm/ui/checkbox/constant.d.ts +2 -2
- package/esm/ui/checkbox/index.js +1 -1
- package/esm/ui/checkbox/index.js.map +1 -1
- package/esm/ui/indicator/indicator.js +1 -2
- package/esm/ui/indicator/indicator.js.map +1 -1
- package/esm/ui/indicator/types.d.ts +0 -2
- package/esm/ui/layout/layout.js +1 -3
- package/esm/ui/layout/layout.js.map +1 -1
- package/esm/ui/layout/types.d.ts +0 -2
- package/esm/ui/legend/category/item.d.ts +0 -2
- package/esm/ui/legend/category/item.js +4 -10
- package/esm/ui/legend/category/item.js.map +1 -1
- package/esm/ui/legend/category/items.d.ts +0 -2
- package/esm/ui/legend/category/items.js.map +1 -1
- package/esm/ui/legend/category.js +2 -4
- package/esm/ui/legend/category.js.map +1 -1
- package/esm/ui/legend/continuous.d.ts +1 -0
- package/esm/ui/legend/continuous.js +17 -5
- package/esm/ui/legend/continuous.js.map +1 -1
- package/esm/ui/marker/index.js +4 -4
- package/esm/ui/marker/index.js.map +1 -1
- package/esm/ui/marker/types.d.ts +0 -2
- package/esm/ui/navigator/index.js +0 -5
- package/esm/ui/navigator/index.js.map +1 -1
- package/esm/ui/navigator/types.d.ts +0 -2
- package/esm/ui/scrollbar/index.js +2 -4
- package/esm/ui/scrollbar/index.js.map +1 -1
- package/esm/ui/scrollbar/types.d.ts +0 -2
- package/esm/ui/select/option.js +1 -1
- package/esm/ui/select/option.js.map +1 -1
- package/esm/ui/select/select.js +9 -11
- package/esm/ui/select/select.js.map +1 -1
- package/esm/ui/select/types.d.ts +0 -4
- package/esm/ui/slider/constant.d.ts +0 -2
- package/esm/ui/slider/constant.js +0 -2
- package/esm/ui/slider/constant.js.map +1 -1
- package/esm/ui/slider/handle.d.ts +0 -4
- package/esm/ui/slider/handle.js +17 -14
- package/esm/ui/slider/handle.js.map +1 -1
- package/esm/ui/slider/index.js +16 -17
- package/esm/ui/slider/index.js.map +1 -1
- package/esm/ui/slider/types.d.ts +0 -2
- package/esm/ui/sparkline/columns.d.ts +0 -2
- package/esm/ui/sparkline/columns.js +1 -2
- package/esm/ui/sparkline/columns.js.map +1 -1
- package/esm/ui/sparkline/index.js +2 -4
- package/esm/ui/sparkline/index.js.map +1 -1
- package/esm/ui/sparkline/lines.d.ts +0 -2
- package/esm/ui/sparkline/lines.js +1 -2
- package/esm/ui/sparkline/lines.js.map +1 -1
- package/esm/ui/sparkline/types.d.ts +0 -2
- package/esm/ui/switch/index.js +0 -1
- package/esm/ui/switch/index.js.map +1 -1
- package/esm/ui/switch/types.d.ts +0 -2
- package/esm/ui/tag/index.js +0 -1
- package/esm/ui/tag/index.js.map +1 -1
- package/esm/ui/tag/types.d.ts +0 -2
- package/esm/ui/timebar/controller.js +8 -8
- package/esm/ui/timebar/controller.js.map +1 -1
- package/esm/ui/timebar/handle.d.ts +0 -4
- package/esm/ui/timebar/handle.js +7 -9
- package/esm/ui/timebar/handle.js.map +1 -1
- package/esm/ui/timebar/icons.js +90 -103
- package/esm/ui/timebar/icons.js.map +1 -1
- package/esm/ui/timebar/timebar.js +6 -14
- package/esm/ui/timebar/timebar.js.map +1 -1
- package/esm/ui/timebar/types.d.ts +0 -4
- package/esm/ui/tooltip/types.d.ts +0 -2
- package/esm/util/keyframe-interpolate.d.ts +1 -1
- package/esm/util/primitive.js +3 -0
- package/esm/util/primitive.js.map +1 -1
- package/esm/util/scale-to-pixel.js +2 -3
- package/esm/util/scale-to-pixel.js.map +1 -1
- package/lib/animation/fadeIn.d.ts +1 -1
- package/lib/animation/fadeOut.d.ts +1 -1
- package/lib/animation/utils.d.ts +3 -3
- package/lib/animation/utils.js +14 -10
- package/lib/animation/utils.js.map +1 -1
- package/lib/ui/axis/constant.js +1 -0
- package/lib/ui/axis/constant.js.map +1 -1
- package/lib/ui/axis/guides/labels.js +9 -11
- package/lib/ui/axis/guides/labels.js.map +1 -1
- package/lib/ui/axis/guides/ticks.js +1 -1
- package/lib/ui/axis/guides/ticks.js.map +1 -1
- package/lib/ui/axis/guides/title.js +8 -5
- package/lib/ui/axis/guides/title.js.map +1 -1
- package/lib/ui/axis/overlap/autoEllipsis.js +2 -1
- package/lib/ui/axis/overlap/autoEllipsis.js.map +1 -1
- package/lib/ui/axis/overlap/autoHide.js +2 -1
- package/lib/ui/axis/overlap/autoHide.js.map +1 -1
- package/lib/ui/axis/utils/bounds.d.ts +1 -3
- package/lib/ui/axis/utils/bounds.js +9 -5
- package/lib/ui/axis/utils/bounds.js.map +1 -1
- package/lib/ui/breadcrumb/index.js +2 -2
- package/lib/ui/breadcrumb/index.js.map +1 -1
- package/lib/ui/button/index.js +6 -8
- package/lib/ui/button/index.js.map +1 -1
- package/lib/ui/button/types.d.ts +0 -2
- package/lib/ui/checkbox/constant.d.ts +2 -2
- package/lib/ui/checkbox/index.js +1 -1
- package/lib/ui/checkbox/index.js.map +1 -1
- package/lib/ui/indicator/indicator.js +1 -2
- package/lib/ui/indicator/indicator.js.map +1 -1
- package/lib/ui/indicator/types.d.ts +0 -2
- package/lib/ui/layout/layout.js +1 -3
- package/lib/ui/layout/layout.js.map +1 -1
- package/lib/ui/layout/types.d.ts +0 -2
- package/lib/ui/legend/category/item.d.ts +0 -2
- package/lib/ui/legend/category/item.js +4 -10
- package/lib/ui/legend/category/item.js.map +1 -1
- package/lib/ui/legend/category/items.d.ts +0 -2
- package/lib/ui/legend/category/items.js.map +1 -1
- package/lib/ui/legend/category.js +2 -4
- package/lib/ui/legend/category.js.map +1 -1
- package/lib/ui/legend/continuous.d.ts +1 -0
- package/lib/ui/legend/continuous.js +17 -5
- package/lib/ui/legend/continuous.js.map +1 -1
- package/lib/ui/marker/index.js +4 -4
- package/lib/ui/marker/index.js.map +1 -1
- package/lib/ui/marker/types.d.ts +0 -2
- package/lib/ui/navigator/index.js +0 -5
- package/lib/ui/navigator/index.js.map +1 -1
- package/lib/ui/navigator/types.d.ts +0 -2
- package/lib/ui/scrollbar/index.js +2 -4
- package/lib/ui/scrollbar/index.js.map +1 -1
- package/lib/ui/scrollbar/types.d.ts +0 -2
- package/lib/ui/select/option.js +1 -1
- package/lib/ui/select/option.js.map +1 -1
- package/lib/ui/select/select.js +9 -11
- package/lib/ui/select/select.js.map +1 -1
- package/lib/ui/select/types.d.ts +0 -4
- package/lib/ui/slider/constant.d.ts +0 -2
- package/lib/ui/slider/constant.js +0 -2
- package/lib/ui/slider/constant.js.map +1 -1
- package/lib/ui/slider/handle.d.ts +0 -4
- package/lib/ui/slider/handle.js +17 -14
- package/lib/ui/slider/handle.js.map +1 -1
- package/lib/ui/slider/index.js +16 -17
- package/lib/ui/slider/index.js.map +1 -1
- package/lib/ui/slider/types.d.ts +0 -2
- package/lib/ui/sparkline/columns.d.ts +0 -2
- package/lib/ui/sparkline/columns.js +1 -2
- package/lib/ui/sparkline/columns.js.map +1 -1
- package/lib/ui/sparkline/index.js +2 -4
- package/lib/ui/sparkline/index.js.map +1 -1
- package/lib/ui/sparkline/lines.d.ts +0 -2
- package/lib/ui/sparkline/lines.js +1 -2
- package/lib/ui/sparkline/lines.js.map +1 -1
- package/lib/ui/sparkline/types.d.ts +0 -2
- package/lib/ui/switch/index.js +0 -1
- package/lib/ui/switch/index.js.map +1 -1
- package/lib/ui/switch/types.d.ts +0 -2
- package/lib/ui/tag/index.js +0 -1
- package/lib/ui/tag/index.js.map +1 -1
- package/lib/ui/tag/types.d.ts +0 -2
- package/lib/ui/timebar/controller.js +8 -8
- package/lib/ui/timebar/controller.js.map +1 -1
- package/lib/ui/timebar/handle.d.ts +0 -4
- package/lib/ui/timebar/handle.js +7 -9
- package/lib/ui/timebar/handle.js.map +1 -1
- package/lib/ui/timebar/icons.js +90 -103
- package/lib/ui/timebar/icons.js.map +1 -1
- package/lib/ui/timebar/timebar.js +6 -14
- package/lib/ui/timebar/timebar.js.map +1 -1
- package/lib/ui/timebar/types.d.ts +0 -4
- package/lib/ui/tooltip/types.d.ts +0 -2
- package/lib/util/keyframe-interpolate.d.ts +1 -1
- package/lib/util/primitive.js +3 -0
- package/lib/util/primitive.js.map +1 -1
- package/lib/util/scale-to-pixel.js +2 -3
- package/lib/util/scale-to-pixel.js.map +1 -1
- package/package.json +6 -6
- package/src/animation/utils.ts +15 -16
- package/src/ui/axis/constant.ts +1 -0
- package/src/ui/axis/guides/labels.ts +10 -18
- package/src/ui/axis/guides/ticks.ts +1 -1
- package/src/ui/axis/guides/title.ts +9 -9
- package/src/ui/axis/overlap/autoEllipsis.ts +2 -1
- package/src/ui/axis/overlap/autoHide.ts +2 -1
- package/src/ui/axis/utils/bounds.ts +7 -4
- package/src/ui/breadcrumb/index.ts +3 -2
- package/src/ui/button/index.ts +6 -10
- package/src/ui/button/types.ts +0 -2
- package/src/ui/checkbox/index.ts +2 -0
- package/src/ui/indicator/indicator.ts +1 -2
- package/src/ui/indicator/types.ts +0 -2
- package/src/ui/layout/layout.ts +1 -4
- package/src/ui/layout/types.ts +0 -2
- package/src/ui/legend/category/item.ts +4 -14
- package/src/ui/legend/category/items.ts +0 -2
- package/src/ui/legend/category.ts +2 -4
- package/src/ui/legend/continuous.ts +20 -5
- package/src/ui/marker/index.ts +4 -5
- package/src/ui/marker/types.ts +0 -2
- package/src/ui/navigator/index.ts +0 -7
- package/src/ui/navigator/types.ts +0 -2
- package/src/ui/scrollbar/index.ts +1 -5
- package/src/ui/scrollbar/types.ts +0 -2
- package/src/ui/select/option.ts +1 -1
- package/src/ui/select/select.ts +9 -11
- package/src/ui/select/types.ts +0 -4
- package/src/ui/slider/constant.ts +0 -2
- package/src/ui/slider/handle.ts +14 -26
- package/src/ui/slider/index.ts +12 -20
- package/src/ui/slider/types.ts +0 -2
- package/src/ui/sparkline/columns.ts +1 -4
- package/src/ui/sparkline/index.ts +2 -8
- package/src/ui/sparkline/lines.ts +1 -4
- package/src/ui/sparkline/types.ts +0 -2
- package/src/ui/switch/index.ts +0 -1
- package/src/ui/switch/types.ts +0 -2
- package/src/ui/tag/index.ts +0 -1
- package/src/ui/tag/types.ts +0 -2
- package/src/ui/timebar/controller.ts +8 -8
- package/src/ui/timebar/handle.ts +10 -16
- package/src/ui/timebar/icons.ts +86 -93
- package/src/ui/timebar/timebar.ts +9 -13
- package/src/ui/timebar/types.ts +0 -4
- package/src/ui/tooltip/types.ts +0 -2
- package/src/util/primitive.ts +3 -0
- package/src/util/scale-to-pixel.ts +1 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { GenericAnimation } from '../animation';
|
|
2
2
|
import type { DisplayObject } from '../shapes';
|
|
3
3
|
import type { Interpolatable } from './interpolate';
|
|
4
|
-
export declare function keyframeInterpolate<T extends Interpolatable>(element: DisplayObject, from: T, to: T, options: GenericAnimation): import("_@antv_g-lite@1.
|
|
4
|
+
export declare function keyframeInterpolate<T extends Interpolatable>(element: DisplayObject, from: T, to: T, options: GenericAnimation): import("_@antv_g-lite@1.2.21@@antv/g-lite").IAnimation | null;
|
package/lib/util/primitive.js
CHANGED
|
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getPrimitiveAttributes = exports.isPrimitiveAttribute = exports.PRIMILTIVE_ATTRIBUTES = void 0;
|
|
4
4
|
exports.PRIMILTIVE_ATTRIBUTES = [
|
|
5
5
|
'$el',
|
|
6
|
+
'anchor',
|
|
6
7
|
'cx',
|
|
7
8
|
'cy',
|
|
8
9
|
'd',
|
|
10
|
+
'defX',
|
|
11
|
+
'defY',
|
|
9
12
|
'dx',
|
|
10
13
|
'dy',
|
|
11
14
|
'fill',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive.js","sourceRoot":"src/","sources":["util/primitive.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG;IACnC,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,WAAW;IACX,aAAa;IACb,YAAY;IACZ,QAAQ;IACR,KAAK;IACL,iCAAiC;IACjC,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,UAAU;IACV,eAAe;IACf,SAAS;IACT,eAAe;IACf,UAAU;IACV,YAAY;IACZ,WAAW;IACX,WAAW;IACX,iBAAiB;IACjB,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,UAAU;IACV,SAAS;IACT,YAAY;IACZ,SAAS;IACT,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;IACR,GAAG;IACH,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,aAAa;IACb,KAAK;IACL,QAAQ;IACR,eAAe;IACf,MAAM;IACN,WAAW;IACX,cAAc;IACd,qBAAqB;IACrB,oBAAoB;IACpB,qBAAqB;IACrB,cAAc;IACd,UAAU;IACV,cAAc;IACd,qBAAqB;IACrB,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,OAAO;IACP,UAAU;IACV,eAAe;IACf,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;CACT,CAAC;AAEF,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,OAAO,6BAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC;AAFD,oDAEC;AAED,SAAgB,sBAAsB,CAAC,UAA+B;IACpE,IAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,KAAK,IAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,oBAAoB,CAAC,GAAG,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,wDAMC"}
|
|
1
|
+
{"version":3,"file":"primitive.js","sourceRoot":"src/","sources":["util/primitive.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG;IACnC,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,MAAM;IACN,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,WAAW;IACX,aAAa;IACb,YAAY;IACZ,QAAQ;IACR,KAAK;IACL,iCAAiC;IACjC,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,UAAU;IACV,eAAe;IACf,SAAS;IACT,eAAe;IACf,UAAU;IACV,YAAY;IACZ,WAAW;IACX,WAAW;IACX,iBAAiB;IACjB,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,UAAU;IACV,SAAS;IACT,YAAY;IACZ,SAAS;IACT,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;IACR,GAAG;IACH,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,aAAa;IACb,KAAK;IACL,QAAQ;IACR,eAAe;IACf,MAAM;IACN,WAAW;IACX,cAAc;IACd,qBAAqB;IACrB,oBAAoB;IACpB,qBAAqB;IACrB,cAAc;IACd,UAAU;IACV,cAAc;IACd,qBAAqB;IACrB,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,OAAO;IACP,UAAU;IACV,eAAe;IACf,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;CACT,CAAC;AAEF,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,OAAO,6BAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC;AAFD,oDAEC;AAED,SAAgB,sBAAsB,CAAC,UAA+B;IACpE,IAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,KAAK,IAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,oBAAoB,CAAC,GAAG,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,wDAMC"}
|
|
@@ -8,9 +8,8 @@ function scaleToPixel(el, size, applyScale) {
|
|
|
8
8
|
if (applyScale === void 0) { applyScale = false; }
|
|
9
9
|
var _a = el.getBBox(), width = _a.width, height = _a.height;
|
|
10
10
|
var scale = size / Math.max(width, height);
|
|
11
|
-
if (applyScale)
|
|
12
|
-
el.
|
|
13
|
-
}
|
|
11
|
+
if (applyScale)
|
|
12
|
+
el.scale(scale);
|
|
14
13
|
return scale;
|
|
15
14
|
}
|
|
16
15
|
exports.scaleToPixel = scaleToPixel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scale-to-pixel.js","sourceRoot":"src/","sources":["util/scale-to-pixel.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,YAAY,CAAC,EAAiB,EAAE,IAAY,EAAE,UAAkB;IAAlB,2BAAA,EAAA,kBAAkB;IACxE,IAAA,KAAoB,EAAE,CAAC,OAAO,EAAE,EAA9B,KAAK,WAAA,EAAE,MAAM,YAAiB,CAAC;IACvC,IAAM,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAI,UAAU
|
|
1
|
+
{"version":3,"file":"scale-to-pixel.js","sourceRoot":"src/","sources":["util/scale-to-pixel.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,YAAY,CAAC,EAAiB,EAAE,IAAY,EAAE,UAAkB;IAAlB,2BAAA,EAAA,kBAAkB;IACxE,IAAA,KAAoB,EAAE,CAAC,OAAO,EAAE,EAA9B,KAAK,WAAA,EAAE,MAAM,YAAiB,CAAC;IACvC,IAAM,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAI,UAAU;QAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,KAAK,CAAC;AACf,CAAC;AALD,oCAKC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/component",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.2",
|
|
4
4
|
"description": "Visualization components for AntV, based on G.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
"component"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@antv/g": "5.18.
|
|
47
|
+
"@antv/g": "^5.18.6",
|
|
48
48
|
"@antv/scale": "^0.4.3",
|
|
49
49
|
"@antv/util": "^3.3.5",
|
|
50
50
|
"svg-path-parser": "^1.1.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@antv/g-canvas": "1.11.
|
|
54
|
-
"@antv/g-plugin-control": "1.9.
|
|
55
|
-
"@antv/g-svg": "1.10.
|
|
56
|
-
"@antv/g-webgl": "1.9.
|
|
53
|
+
"@antv/g-canvas": "^1.11.5",
|
|
54
|
+
"@antv/g-plugin-control": "^1.9.6",
|
|
55
|
+
"@antv/g-svg": "^1.10.20",
|
|
56
|
+
"@antv/g-webgl": "^1.9.8",
|
|
57
57
|
"@babel/plugin-proposal-decorators": "^7.20.5",
|
|
58
58
|
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
59
59
|
"@babel/preset-env": "^7.16.11",
|
package/src/animation/utils.ts
CHANGED
|
@@ -96,26 +96,25 @@ export function transitionShape(
|
|
|
96
96
|
const middle = Math.ceil(+duration / 2);
|
|
97
97
|
const offset = +duration / 4;
|
|
98
98
|
|
|
99
|
-
const {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
const getPosition = (shape: DisplayObject) => {
|
|
100
|
+
if (shape.nodeName === 'circle') {
|
|
101
|
+
const [cx, cy] = shape.getLocalPosition();
|
|
102
|
+
const r = shape.attr('r');
|
|
103
|
+
return [cx - r, cy - r];
|
|
104
|
+
}
|
|
105
|
+
return shape.getLocalPosition();
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const [sx, sy] = getPosition(source);
|
|
109
|
+
const [ex, ey] = getPosition(target);
|
|
105
110
|
const [mx, my] = [(sx + ex) / 2 - sx, (sy + ey) / 2 - sy];
|
|
106
111
|
|
|
107
112
|
const { opacity: so = 1 } = source.style;
|
|
108
113
|
const { opacity: to = 1 } = target.style;
|
|
109
|
-
|
|
110
|
-
const st = source.style.transform || '';
|
|
111
|
-
const tt = target.style.transform || '';
|
|
112
|
-
// const st = source.style._transform || '';
|
|
113
|
-
// const tt = target.style._transform || '';
|
|
114
|
-
|
|
115
114
|
const sourceAnimation = source.animate(
|
|
116
115
|
[
|
|
117
|
-
{ opacity: so, transform:
|
|
118
|
-
{ opacity: 0, transform: `translate(${mx}, ${my})
|
|
116
|
+
{ opacity: so, transform: 'translate(0, 0)' },
|
|
117
|
+
{ opacity: 0, transform: `translate(${mx}, ${my})` },
|
|
119
118
|
],
|
|
120
119
|
{
|
|
121
120
|
fill: 'both',
|
|
@@ -125,8 +124,8 @@ export function transitionShape(
|
|
|
125
124
|
);
|
|
126
125
|
const targetAnimation = target.animate(
|
|
127
126
|
[
|
|
128
|
-
{ opacity: 0, transform: `translate(${-mx}, ${-my})
|
|
129
|
-
{ opacity: to, transform:
|
|
127
|
+
{ opacity: 0, transform: `translate(${-mx}, ${-my})`, offset: 0.01 },
|
|
128
|
+
{ opacity: to, transform: 'translate(0, 0)' },
|
|
130
129
|
],
|
|
131
130
|
{
|
|
132
131
|
fill: 'both',
|
package/src/ui/axis/constant.ts
CHANGED
|
@@ -38,6 +38,7 @@ export const AXIS_BASE_DEFAULT_ATTR: Partial<AxisBaseStyleProps> = {
|
|
|
38
38
|
new Path({
|
|
39
39
|
style: {
|
|
40
40
|
path: [['M', 10, 10], ['L', -10, 0], ['L', 10, -10], ['L', 0, 0], ['L', 10, 10], ['Z']],
|
|
41
|
+
anchor: '0.5 0.5',
|
|
41
42
|
fill: 'black',
|
|
42
43
|
transformOrigin: 'center',
|
|
43
44
|
},
|
|
@@ -187,30 +187,24 @@ function overlapHandler(attr: Required<AxisStyleProps>) {
|
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
function renderLabel(
|
|
191
|
-
container: DisplayObject,
|
|
192
|
-
datum: any,
|
|
193
|
-
data: any[],
|
|
194
|
-
style: any,
|
|
195
|
-
attr: Required<AxisStyleProps>
|
|
196
|
-
): DisplayObject {
|
|
190
|
+
function renderLabel(container: DisplayObject, datum: any, data: any[], style: any, attr: Required<AxisStyleProps>) {
|
|
197
191
|
const index = data.indexOf(datum);
|
|
198
192
|
const label = select(container)
|
|
199
193
|
.append(formatter(datum, index, data, attr))
|
|
200
194
|
.attr('className', CLASS_NAMES.labelItem.name)
|
|
201
195
|
.node();
|
|
202
196
|
const [labelStyle, { transform, ...groupStyle }] = splitStyle(getCallbackStyle(style, [datum, index, data]));
|
|
197
|
+
percentTransform(container, transform);
|
|
203
198
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
if (!label.getLocalEulerAngles()) {
|
|
207
|
-
label.setLocalEulerAngles(rotate);
|
|
208
|
-
}
|
|
199
|
+
const rotate = getLabelRotation(datum, container, attr);
|
|
200
|
+
container.setLocalEulerAngles(+rotate);
|
|
209
201
|
|
|
210
202
|
applyTextStyle(label, {
|
|
211
203
|
...getLabelStyle(datum.value, rotate, attr),
|
|
212
204
|
...labelStyle,
|
|
213
205
|
});
|
|
206
|
+
// todo G transform 存在问题,需要二次设置
|
|
207
|
+
percentTransform(container, transform);
|
|
214
208
|
container.attr(groupStyle);
|
|
215
209
|
return label;
|
|
216
210
|
}
|
|
@@ -233,9 +227,8 @@ export function renderLabels(
|
|
|
233
227
|
.attr('className', CLASS_NAMES.label.name)
|
|
234
228
|
.transition(function (datum) {
|
|
235
229
|
renderLabel(this, datum, data, style, attr);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
this.style.transform = `translate(${x}, ${y})`;
|
|
230
|
+
this.attr(getLabelPos(datum, data, attr));
|
|
231
|
+
this.__bbox__ = datum.bbox;
|
|
239
232
|
return null;
|
|
240
233
|
})
|
|
241
234
|
.call(() => overlapHandler.call(container, attr)),
|
|
@@ -245,10 +238,9 @@ export function renderLabels(
|
|
|
245
238
|
const prevLabel = this.querySelector(CLASS_NAMES.labelItem.class);
|
|
246
239
|
const label = renderLabel(this, datum, data, style, attr);
|
|
247
240
|
const shapeAnimation = transitionShape(prevLabel, label, animate.update);
|
|
248
|
-
const
|
|
249
|
-
|
|
241
|
+
const animation = transition(this, getLabelPos(datum, data, attr), animate.update);
|
|
242
|
+
this.__bbox__ = datum.bbox;
|
|
250
243
|
return [...shapeAnimation, animation];
|
|
251
|
-
// return [animation];
|
|
252
244
|
})
|
|
253
245
|
.call((selection) => {
|
|
254
246
|
const transitions = get(selection, '_transitions').flat().filter(defined) as IAnimation[];
|
|
@@ -77,7 +77,7 @@ function createTick(
|
|
|
77
77
|
const tick = createTickEl(select(this), datum, index, data, attr);
|
|
78
78
|
applyTickStyle(datum, index, data, tick, this, attr, tickAttr);
|
|
79
79
|
const [x, y] = getValuePos(datum.value, attr);
|
|
80
|
-
return transition(this, {
|
|
80
|
+
return transition(this, { x, y }, animate);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export function renderTicks(
|
|
@@ -32,9 +32,7 @@ function getTitlePosition(
|
|
|
32
32
|
halfExtents: [mainHalfWidth, mainHalfHeight],
|
|
33
33
|
} = mainGroup.node().getLocalBounds();
|
|
34
34
|
|
|
35
|
-
const
|
|
36
|
-
halfExtents: [titleHalfWidth, titleHalfHeight],
|
|
37
|
-
} = titleGroup.node().getLocalBounds();
|
|
35
|
+
const [titleHalfWidth, titleHalfHeight] = titleGroup.node().getLocalBounds().halfExtents;
|
|
38
36
|
|
|
39
37
|
let [x, y] = [mainX + mainHalfWidth, mainY + mainHalfHeight];
|
|
40
38
|
|
|
@@ -51,16 +49,17 @@ function getTitlePosition(
|
|
|
51
49
|
|
|
52
50
|
if (pos.includes('t')) y -= mainHalfHeight + titleHalfHeight + spacingTop;
|
|
53
51
|
if (pos.includes('r')) x += mainHalfWidth + titleHalfWidth + spacingRight;
|
|
54
|
-
if (pos.includes('l')) x -= mainHalfWidth + titleHalfWidth + spacingLeft;
|
|
55
|
-
if (pos.includes('b')) y += mainHalfHeight + titleHalfHeight + spacingBottom;
|
|
52
|
+
if (pos.includes('l')) x -= mainHalfWidth + titleHalfWidth * 2 + spacingLeft;
|
|
53
|
+
if (pos.includes('b')) y += mainHalfHeight + titleHalfHeight * 2 + spacingBottom;
|
|
56
54
|
|
|
57
55
|
return { x, y };
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
function inferTransform(n: DisplayObject, direction: string, position: string): string {
|
|
61
59
|
const node = n.cloneNode(true);
|
|
60
|
+
node.style.transform = 'scale(1, 1)';
|
|
61
|
+
node.style.transform = 'none';
|
|
62
62
|
const { height } = node.getBBox();
|
|
63
|
-
|
|
64
63
|
if (direction === 'vertical') {
|
|
65
64
|
if (position === 'left') return `rotate(-90) translate(0, ${height / 2})`;
|
|
66
65
|
if (position === 'right') return `rotate(-90) translate(0, -${height / 2})`;
|
|
@@ -76,12 +75,12 @@ function applyTitleStyle(
|
|
|
76
75
|
animate: GenericAnimation
|
|
77
76
|
) {
|
|
78
77
|
const style = subStyleProps(attr, 'title');
|
|
79
|
-
const [titleStyle, { transform: specified,
|
|
78
|
+
const [titleStyle, { transform: specified, ...groupStyle }] = splitStyle(style);
|
|
80
79
|
|
|
80
|
+
title.styles(titleStyle);
|
|
81
81
|
group.styles(groupStyle);
|
|
82
82
|
|
|
83
83
|
const transform = specified || inferTransform(title.node(), titleStyle.direction, titleStyle.position);
|
|
84
|
-
title.styles({ ...titleStyle, transformOrigin });
|
|
85
84
|
percentTransform(title.node(), transform);
|
|
86
85
|
|
|
87
86
|
const { x, y } = getTitlePosition(
|
|
@@ -91,7 +90,8 @@ function applyTitleStyle(
|
|
|
91
90
|
attr
|
|
92
91
|
);
|
|
93
92
|
|
|
94
|
-
const animation = transition(group.node(), {
|
|
93
|
+
const animation = transition(group.node(), { x, y }, animate);
|
|
94
|
+
percentTransform(title.node(), transform);
|
|
95
95
|
return animation;
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -3,6 +3,7 @@ import type { DisplayObject } from '../../../shapes';
|
|
|
3
3
|
import { Text } from '../../../shapes';
|
|
4
4
|
import { getFont, measureTextWidth } from '../../../util';
|
|
5
5
|
import { AxisStyleProps, EllipsisOverlapCfg } from '../types';
|
|
6
|
+
import { getBBox } from '../utils/bounds';
|
|
6
7
|
import { boundTest } from '../utils/test';
|
|
7
8
|
|
|
8
9
|
export type Utils = {
|
|
@@ -39,7 +40,7 @@ export default function ellipseLabels(
|
|
|
39
40
|
if (isNil(max) || max === Infinity) {
|
|
40
41
|
max = Math.max.apply(
|
|
41
42
|
null,
|
|
42
|
-
labels.map((d) =>
|
|
43
|
+
labels.map((d) => getBBox(d).width)
|
|
43
44
|
);
|
|
44
45
|
}
|
|
45
46
|
// Generally, 100 ticks cost less than 300ms. If cost time exceed, means ticks count is too large to see.
|
|
@@ -3,6 +3,7 @@ import { defined, getLocalBBox, hide } from '../../../util';
|
|
|
3
3
|
import { isAxisHorizontal, isAxisVertical } from '../guides/line';
|
|
4
4
|
import type { AxisStyleProps, HideOverlapCfg } from '../types';
|
|
5
5
|
import { boundTest } from '../utils/test';
|
|
6
|
+
import { getBBox } from '../utils/bounds';
|
|
6
7
|
|
|
7
8
|
type Hide = (item: DisplayObject) => void;
|
|
8
9
|
type Show = (item: DisplayObject) => void;
|
|
@@ -31,7 +32,7 @@ export default function hideLabels(
|
|
|
31
32
|
const source = labels.slice();
|
|
32
33
|
let target = labels.slice();
|
|
33
34
|
|
|
34
|
-
const minLabelWidth = Math.min(1, ...labels.map((d) =>
|
|
35
|
+
const minLabelWidth = Math.min(1, ...labels.map((d) => getBBox(d).width));
|
|
35
36
|
|
|
36
37
|
if (attr.type === 'linear' && (isAxisHorizontal(attr) || isAxisVertical(attr))) {
|
|
37
38
|
const minX = getLocalBBox(labels[0]).left;
|
|
@@ -78,9 +78,6 @@ export class Bounds {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
/**
|
|
82
|
-
* Can't use getBounds directly since we should not use AABB here.
|
|
83
|
-
*/
|
|
84
81
|
export function getBounds(item: DisplayObject<any>, margin?: SeriesAttr) {
|
|
85
82
|
const angle = item.getEulerAngles() || 0;
|
|
86
83
|
item.setEulerAngles(0);
|
|
@@ -89,7 +86,7 @@ export function getBounds(item: DisplayObject<any>, margin?: SeriesAttr) {
|
|
|
89
86
|
min: [x, y],
|
|
90
87
|
max: [right, bottom],
|
|
91
88
|
} = item.getLocalBounds();
|
|
92
|
-
const { width: w, height: h } =
|
|
89
|
+
const { width: w, height: h } = getBBox(item);
|
|
93
90
|
|
|
94
91
|
let height = h;
|
|
95
92
|
let dx = 0;
|
|
@@ -127,3 +124,9 @@ export function getBounds(item: DisplayObject<any>, margin?: SeriesAttr) {
|
|
|
127
124
|
item.setEulerAngles(angle);
|
|
128
125
|
return bounds.rotatedPoints(degToRad(angle), anchorX, anchorY);
|
|
129
126
|
}
|
|
127
|
+
|
|
128
|
+
export function getBBox(shape: DisplayObject): DOMRect {
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
if (shape.__bbox__) return shape.__bbox__;
|
|
131
|
+
return shape.getBBox();
|
|
132
|
+
}
|
|
@@ -69,7 +69,8 @@ export class Breadcrumb extends Component<BreadcrumbStyleProps> {
|
|
|
69
69
|
const shape = new Tag({
|
|
70
70
|
className: 'breadcrumb-item',
|
|
71
71
|
style: {
|
|
72
|
-
|
|
72
|
+
x: cursorX,
|
|
73
|
+
y: cursorY,
|
|
73
74
|
...tagStyle,
|
|
74
75
|
text: isNil(datum.text) ? datum.id : datum.text,
|
|
75
76
|
...pick(datum, ['marker']),
|
|
@@ -87,7 +88,7 @@ export class Breadcrumb extends Component<BreadcrumbStyleProps> {
|
|
|
87
88
|
if (!isNil(width)) {
|
|
88
89
|
const avaliableWidth = width! - right;
|
|
89
90
|
if (cursorX > avaliableWidth) {
|
|
90
|
-
shape.attr({
|
|
91
|
+
shape.attr({ x: 0, y: cursorY + shapeH });
|
|
91
92
|
// 更新光标
|
|
92
93
|
cursorX = shapeW;
|
|
93
94
|
cursorY += shapeH;
|
package/src/ui/button/index.ts
CHANGED
|
@@ -95,10 +95,8 @@ export class Button extends Component<ButtonStyleProps> {
|
|
|
95
95
|
|
|
96
96
|
// @todo 处理 markerAlign='right' 的场景. 方案: left marker & right marker 处理为两个 shape, 互相不干扰
|
|
97
97
|
public render(attributes: Required<ButtonStyleProps>, container: Group) {
|
|
98
|
-
const { text = '', padding = 0, markerSymbol, markerSpacing = 0
|
|
99
|
-
container.attr(
|
|
100
|
-
cursor: this.state === 'disabled' ? 'not-allowed' : 'pointer',
|
|
101
|
-
});
|
|
98
|
+
const { text = '', padding = 0, markerSymbol, markerSpacing = 0 } = attributes;
|
|
99
|
+
container.attr('cursor', this.state === 'disabled' ? 'not-allowed' : 'pointer');
|
|
102
100
|
const [pt, pr, pb, pl] = parseSeriesAttr(padding);
|
|
103
101
|
const height = this.buttonHeight;
|
|
104
102
|
|
|
@@ -108,8 +106,8 @@ export class Button extends Component<ButtonStyleProps> {
|
|
|
108
106
|
const style = {
|
|
109
107
|
...markerStyle,
|
|
110
108
|
symbol: markerSymbol,
|
|
111
|
-
x:
|
|
112
|
-
y:
|
|
109
|
+
x: pl + markerSize / 2,
|
|
110
|
+
y: height / 2,
|
|
113
111
|
size: markerSize,
|
|
114
112
|
};
|
|
115
113
|
const markerShape = maybeAppend(container, '.marker', () => new Marker({ className: 'marker', style }))
|
|
@@ -122,8 +120,8 @@ export class Button extends Component<ButtonStyleProps> {
|
|
|
122
120
|
this.textShape = maybeAppend(container, '.text', 'text')
|
|
123
121
|
.attr('className', 'text')
|
|
124
122
|
.styles({
|
|
125
|
-
x:
|
|
126
|
-
y:
|
|
123
|
+
x: markerSize ? bounds.max[0] + markerSpacing : pl,
|
|
124
|
+
y: height / 2,
|
|
127
125
|
...textStyle,
|
|
128
126
|
text,
|
|
129
127
|
textAlign: 'left',
|
|
@@ -143,8 +141,6 @@ export class Button extends Component<ButtonStyleProps> {
|
|
|
143
141
|
.styles({
|
|
144
142
|
zIndex: -1,
|
|
145
143
|
...buttonStyle,
|
|
146
|
-
x,
|
|
147
|
-
y,
|
|
148
144
|
height,
|
|
149
145
|
width: pl + (markerSize ? markerSize + markerSpacing : 0) + textBounds.halfExtents[0] * 2 + pr,
|
|
150
146
|
});
|
package/src/ui/button/types.ts
CHANGED
|
@@ -13,8 +13,6 @@ export type ButtonStyleProps = GroupStyleProps &
|
|
|
13
13
|
Partial<PrefixStyleProps<RectStyleProps, 'button'>> &
|
|
14
14
|
Partial<PrefixStyleProps<Omit<MarkerStyleProps, 'symbol'>, 'marker'>>
|
|
15
15
|
> & {
|
|
16
|
-
x?: number;
|
|
17
|
-
y?: number;
|
|
18
16
|
type?: 'primary' | 'dashed' | 'link' | 'text' | 'default';
|
|
19
17
|
/**
|
|
20
18
|
* @title 大小
|
package/src/ui/checkbox/index.ts
CHANGED
|
@@ -78,8 +78,7 @@ export class Indicator extends Component<IndicatorStyleProps> {
|
|
|
78
78
|
|
|
79
79
|
private adjustLayout() {
|
|
80
80
|
const [dx, dy] = this.point;
|
|
81
|
-
|
|
82
|
-
this.group.attr('transform', `translate(${x - dx}, ${y - dy})`);
|
|
81
|
+
this.group.attr('x', -dx).attr('y', -dy);
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
private getPath(position: Position, bbox: BBox) {
|
|
@@ -8,8 +8,6 @@ export type Position = 'top' | 'right' | 'bottom' | 'left';
|
|
|
8
8
|
export type IndicatorStyleProps<T = any> = GroupStyleProps &
|
|
9
9
|
PrefixObject<PathStyleProps, 'background'> &
|
|
10
10
|
PrefixObject<Omit<TextStyleProps, 'text'>, 'label'> & {
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
11
|
labelText?: T;
|
|
14
12
|
/** position of indicator related to pointer */
|
|
15
13
|
position?: Position;
|
package/src/ui/layout/layout.ts
CHANGED
|
@@ -71,9 +71,6 @@ export class Layout extends Group {
|
|
|
71
71
|
if (!this.attributes.display || !this.isConnected) return;
|
|
72
72
|
if (this.children.some((child) => !child.isConnected)) return;
|
|
73
73
|
try {
|
|
74
|
-
const { x, y } = this.attributes;
|
|
75
|
-
this.style.transform = `translate(${x}, ${y})`;
|
|
76
|
-
|
|
77
74
|
const bboxes = calcLayout(
|
|
78
75
|
this.getAvailableSpace(),
|
|
79
76
|
this.children.map((child) => (child as DisplayObject).getBBox()),
|
|
@@ -82,7 +79,7 @@ export class Layout extends Group {
|
|
|
82
79
|
|
|
83
80
|
this.children.forEach((child, index) => {
|
|
84
81
|
const { x, y } = bboxes[index];
|
|
85
|
-
child
|
|
82
|
+
(child as DisplayObject).attr({ x, y });
|
|
86
83
|
});
|
|
87
84
|
} catch (e) {
|
|
88
85
|
// do nothing
|
package/src/ui/layout/types.ts
CHANGED
|
@@ -42,8 +42,6 @@ export type CategoryItemStyleProps = GroupStyleProps &
|
|
|
42
42
|
valueText?: ExtendDisplayObject;
|
|
43
43
|
// if width and height not specific, set it to actual space occurred
|
|
44
44
|
width?: number;
|
|
45
|
-
x?: number;
|
|
46
|
-
y?: number;
|
|
47
45
|
};
|
|
48
46
|
|
|
49
47
|
export type CategoryItemOptions = ComponentOptions<CategoryItemStyleProps>;
|
|
@@ -198,8 +196,7 @@ export class CategoryItem extends Component<CategoryItemStyleProps> {
|
|
|
198
196
|
|
|
199
197
|
// record the scale of marker
|
|
200
198
|
this.markerGroup.node().scale(1 / this.markerGroup.node().getScale()[0]);
|
|
201
|
-
|
|
202
|
-
this.markerGroup.node().style._transform = `scale(${scale})`;
|
|
199
|
+
scaleToPixel(this.markerGroup.node(), this.scaleSize, true);
|
|
203
200
|
});
|
|
204
201
|
}
|
|
205
202
|
|
|
@@ -234,25 +231,18 @@ export class CategoryItem extends Component<CategoryItemStyleProps> {
|
|
|
234
231
|
},
|
|
235
232
|
} = this;
|
|
236
233
|
const halfHeight = height / 2;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
this.markerGroup.styles({
|
|
241
|
-
transform: `translate(${markerX}, ${halfHeight})${this.markerGroup.node().style._transform}`,
|
|
242
|
-
});
|
|
243
|
-
this.labelGroup.styles({ transform: `translate(${labelX}, ${halfHeight})` });
|
|
234
|
+
this.markerGroup.styles({ x: markerX, y: halfHeight });
|
|
235
|
+
this.labelGroup.styles({ x: labelX, y: halfHeight });
|
|
244
236
|
|
|
245
237
|
ellipsisIt(this.labelGroup.select(CLASS_NAMES.label.class).node(), Math.ceil(labelWidth));
|
|
246
238
|
if (this.showValue) {
|
|
247
|
-
this.valueGroup.styles({
|
|
239
|
+
this.valueGroup.styles({ x: valueX, y: halfHeight });
|
|
248
240
|
ellipsisIt(this.valueGroup.select(CLASS_NAMES.value.class).node(), Math.ceil(valueWidth));
|
|
249
241
|
}
|
|
250
242
|
}
|
|
251
243
|
|
|
252
244
|
public render(attributes: CategoryItemStyleProps, container: Group) {
|
|
253
245
|
const ctn = select(container);
|
|
254
|
-
const { x = 0, y = 0 } = attributes;
|
|
255
|
-
ctn.styles({ transform: `translate(${x}, ${y})` });
|
|
256
246
|
this.renderMarker(ctn);
|
|
257
247
|
this.renderLabel(ctn);
|
|
258
248
|
this.renderValue(ctn);
|
|
@@ -66,8 +66,7 @@ export class Category extends Component<CategoryStyleProps> {
|
|
|
66
66
|
const { showTitle } = this.attributes;
|
|
67
67
|
if (showTitle) {
|
|
68
68
|
const { x, y } = this.title.node<Title>().getAvailableSpace();
|
|
69
|
-
this.itemsGroup.node().
|
|
70
|
-
// this.itemsGroup.node().setLocalPosition(x, y);
|
|
69
|
+
this.itemsGroup.node().setLocalPosition(x, y);
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
|
|
@@ -85,9 +84,8 @@ export class Category extends Component<CategoryStyleProps> {
|
|
|
85
84
|
}
|
|
86
85
|
|
|
87
86
|
render(attributes: Required<CategoryStyleProps>, container: Group) {
|
|
88
|
-
const { width, height
|
|
87
|
+
const { width, height } = attributes;
|
|
89
88
|
const ctn = select(container);
|
|
90
|
-
container.style.transform = `translate(${x}, ${y})`;
|
|
91
89
|
|
|
92
90
|
this.renderTitle(ctn, width!, height!);
|
|
93
91
|
|
|
@@ -92,9 +92,7 @@ export class Continuous extends Component<ContinuousStyleProps> {
|
|
|
92
92
|
/** label */
|
|
93
93
|
|
|
94
94
|
/** content */
|
|
95
|
-
const contentGroup = select(container)
|
|
96
|
-
.maybeAppendByClassName(CLASS_NAMES.contentGroup, 'g')
|
|
97
|
-
.styles({ transform: `translate(${x}, ${y})` });
|
|
95
|
+
const contentGroup = select(container).maybeAppendByClassName(CLASS_NAMES.contentGroup, 'g').styles({ x, y });
|
|
98
96
|
|
|
99
97
|
const labelGroup = contentGroup.maybeAppendByClassName(CLASS_NAMES.labelGroup, 'g').styles({ zIndex: 1 });
|
|
100
98
|
ifShow(!!showLabel, labelGroup, (group) => {
|
|
@@ -270,7 +268,8 @@ export class Continuous extends Component<ContinuousStyleProps> {
|
|
|
270
268
|
const { length, size } = this.ribbonShape;
|
|
271
269
|
const style: Required<RibbonStyleProps> = deepAssign(
|
|
272
270
|
{
|
|
273
|
-
|
|
271
|
+
x,
|
|
272
|
+
y,
|
|
274
273
|
length,
|
|
275
274
|
size,
|
|
276
275
|
type,
|
|
@@ -345,6 +344,22 @@ export class Continuous extends Component<ContinuousStyleProps> {
|
|
|
345
344
|
this.setHandlePosition('end', max);
|
|
346
345
|
}
|
|
347
346
|
|
|
347
|
+
private adjustTitle() {
|
|
348
|
+
const { titlePosition, orientation } = this.attributes;
|
|
349
|
+
const [title] = this.getElementsByClassName(CLASS_NAMES.title.name);
|
|
350
|
+
const handle: Handle = this.handlesGroup.select(`.${this.getHandleClassName('start')}`).node();
|
|
351
|
+
if (!title || !handle) return;
|
|
352
|
+
if (titlePosition !== 'top-left' || orientation !== 'horizontal') return;
|
|
353
|
+
const {
|
|
354
|
+
min: [handleX],
|
|
355
|
+
} = handle.getLocalBounds();
|
|
356
|
+
const {
|
|
357
|
+
min: [titleX],
|
|
358
|
+
} = title.getLocalBounds();
|
|
359
|
+
const diffX = handleX - titleX;
|
|
360
|
+
title.style.x = +(this.style.x || 0) + diffX;
|
|
361
|
+
}
|
|
362
|
+
|
|
348
363
|
private cacheHandleBBox: DOMRect | null = null;
|
|
349
364
|
|
|
350
365
|
private get handleBBox() {
|
|
@@ -376,7 +391,7 @@ export class Continuous extends Component<ContinuousStyleProps> {
|
|
|
376
391
|
[ribbonX + ribbonSize * this.handleOffsetRatio, ribbonY + offset]
|
|
377
392
|
);
|
|
378
393
|
const handle: Handle = this.handlesGroup.select(`.${this.getHandleClassName(type)}`).node();
|
|
379
|
-
handle?.update({
|
|
394
|
+
handle?.update({ x, y, formatter: handleFormatter });
|
|
380
395
|
}
|
|
381
396
|
|
|
382
397
|
private renderIndicator(container: Selection) {
|
package/src/ui/marker/index.ts
CHANGED
|
@@ -44,8 +44,7 @@ function getType(symbol: MarkerStyleProps['symbol']): string | null {
|
|
|
44
44
|
|
|
45
45
|
export class Marker extends Component<MarkerStyleProps> {
|
|
46
46
|
public render(attributes: Required<MarkerStyleProps>, container: Group) {
|
|
47
|
-
const { symbol, size = 16,
|
|
48
|
-
|
|
47
|
+
const { symbol, size = 16, ...style } = attributes;
|
|
49
48
|
const type = getType(symbol);
|
|
50
49
|
ifShow(!!type, select(container), (group) => {
|
|
51
50
|
group
|
|
@@ -59,13 +58,13 @@ export class Marker extends Component<MarkerStyleProps> {
|
|
|
59
58
|
img: symbol,
|
|
60
59
|
width: r,
|
|
61
60
|
height: r,
|
|
62
|
-
x:
|
|
63
|
-
y:
|
|
61
|
+
x: -size,
|
|
62
|
+
y: -size,
|
|
64
63
|
});
|
|
65
64
|
} else {
|
|
66
65
|
const r = (size as number) / 2;
|
|
67
66
|
const symbolFn = isFunction(symbol) ? symbol : Marker.getSymbol(symbol);
|
|
68
|
-
selection.styles({ path: symbolFn?.(
|
|
67
|
+
selection.styles({ path: symbolFn?.(0, 0, r), ...style });
|
|
69
68
|
}
|
|
70
69
|
});
|
|
71
70
|
});
|
package/src/ui/marker/types.ts
CHANGED
|
@@ -4,8 +4,6 @@ import type { BaseCustomElementStyleProps } from '../../shapes';
|
|
|
4
4
|
export type FunctionalSymbol = (x: number, y: number, r: number) => any;
|
|
5
5
|
|
|
6
6
|
export type MarkerStyleProps = BaseCustomElementStyleProps & {
|
|
7
|
-
x?: number;
|
|
8
|
-
y?: number;
|
|
9
7
|
size?: number;
|
|
10
8
|
symbol: string | FunctionalSymbol;
|
|
11
9
|
};
|