@antv/component 0.8.32-beta.0 → 0.9.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.
- package/esm/abstract/html-component.js +1 -9
- package/esm/abstract/html-component.js.map +1 -1
- package/esm/legend/category.js +12 -3
- package/esm/legend/category.js.map +1 -1
- package/esm/slider/constant.d.ts +44 -1
- package/esm/slider/constant.js +48 -4
- package/esm/slider/constant.js.map +1 -1
- package/esm/slider/foreground.d.ts +71 -0
- package/esm/slider/foreground.js +104 -0
- package/esm/slider/foreground.js.map +1 -0
- package/esm/slider/handler.d.ts +3 -8
- package/esm/slider/handler.js +8 -15
- package/esm/slider/handler.js.map +1 -1
- package/esm/slider/slider.d.ts +16 -4
- package/esm/slider/slider.js +218 -40
- package/esm/slider/slider.js.map +1 -1
- package/esm/tooltip/css-const.d.ts +0 -1
- package/esm/tooltip/css-const.js +0 -1
- package/esm/tooltip/css-const.js.map +1 -1
- package/esm/tooltip/html-theme.d.ts +0 -22
- package/esm/tooltip/html-theme.js +0 -7
- package/esm/tooltip/html-theme.js.map +1 -1
- package/esm/tooltip/html.d.ts +0 -23
- package/esm/tooltip/html.js +11 -27
- package/esm/tooltip/html.js.map +1 -1
- package/esm/util/event.d.ts +9 -1
- package/esm/util/event.js +12 -0
- package/esm/util/event.js.map +1 -1
- package/esm/util/mask.d.ts +9 -0
- package/esm/util/mask.js +34 -0
- package/esm/util/mask.js.map +1 -0
- package/esm/util/util.d.ts +7 -0
- package/esm/util/util.js +59 -1
- package/esm/util/util.js.map +1 -1
- package/lib/abstract/html-component.js +1 -9
- package/lib/abstract/html-component.js.map +1 -1
- package/lib/legend/category.js +12 -3
- package/lib/legend/category.js.map +1 -1
- package/lib/slider/constant.d.ts +44 -1
- package/lib/slider/constant.js +49 -5
- package/lib/slider/constant.js.map +1 -1
- package/lib/slider/foreground.d.ts +71 -0
- package/lib/slider/foreground.js +107 -0
- package/lib/slider/foreground.js.map +1 -0
- package/lib/slider/handler.d.ts +3 -8
- package/lib/slider/handler.js +9 -16
- package/lib/slider/handler.js.map +1 -1
- package/lib/slider/slider.d.ts +16 -4
- package/lib/slider/slider.js +215 -37
- package/lib/slider/slider.js.map +1 -1
- package/lib/tooltip/css-const.d.ts +0 -1
- package/lib/tooltip/css-const.js +1 -2
- package/lib/tooltip/css-const.js.map +1 -1
- package/lib/tooltip/html-theme.d.ts +0 -22
- package/lib/tooltip/html-theme.js +0 -7
- package/lib/tooltip/html-theme.js.map +1 -1
- package/lib/tooltip/html.d.ts +0 -23
- package/lib/tooltip/html.js +11 -27
- package/lib/tooltip/html.js.map +1 -1
- package/lib/util/event.d.ts +9 -1
- package/lib/util/event.js +14 -1
- package/lib/util/event.js.map +1 -1
- package/lib/util/mask.d.ts +9 -0
- package/lib/util/mask.js +40 -0
- package/lib/util/mask.js.map +1 -0
- package/lib/util/util.d.ts +7 -0
- package/lib/util/util.js +61 -1
- package/lib/util/util.js.map +1 -1
- package/package.json +6 -18
- package/src/abstract/html-component.ts +1 -12
- package/src/legend/category.ts +21 -12
- package/src/slider/constant.ts +55 -4
- package/src/slider/foreground.ts +165 -0
- package/src/slider/handler.ts +10 -20
- package/src/slider/slider.ts +249 -55
- package/src/tooltip/css-const.ts +0 -1
- package/src/tooltip/html-theme.ts +0 -8
- package/src/tooltip/html.ts +11 -29
- package/src/util/event.ts +14 -1
- package/src/util/mask.ts +41 -0
- package/src/util/util.ts +64 -2
package/lib/slider/constant.js
CHANGED
|
@@ -3,20 +3,61 @@
|
|
|
3
3
|
* 一些默认的样式配置
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SLIDER_CHANGE = exports.TEXT_STYLE = exports.HANDLER_STYLE = exports.DEFAULT_HANDLER_WIDTH = exports.FOREGROUND_STYLE = exports.BACKGROUND_STYLE = void 0;
|
|
6
|
+
exports.TEXT_SAFE_WIDTH = exports.TEXT_PADDING = exports.MAX_TEXT_WIDTH = exports.SLIDER_CHANGE = exports.TEXT_STYLE = exports.HANDLER_STYLE = exports.DEFAULT_HANDLER_HEIGHT = exports.DEFAULT_HANDLER_WIDTH = exports.SLIDER_BAR_HEIGHT = exports.SLIDER_BAR_LINE_GAP = exports.SLICER_BAR_LINE_STYLE = exports.SLIDER_BAR_STYLE = exports.FOREGROUND_STYLE = exports.BACKGROUND_STYLE = exports.DEFAULT_TREND_STYLE = exports.ACTIVE_TREND_STYLE = void 0;
|
|
7
|
+
exports.ACTIVE_TREND_STYLE = {
|
|
8
|
+
isArea: true,
|
|
9
|
+
lineStyle: {
|
|
10
|
+
stroke: '#569CFF',
|
|
11
|
+
lineWidth: 0.5,
|
|
12
|
+
},
|
|
13
|
+
areaStyle: {
|
|
14
|
+
fill: '#3382F1',
|
|
15
|
+
opacity: 0.07,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
exports.DEFAULT_TREND_STYLE = {
|
|
19
|
+
isArea: true,
|
|
20
|
+
lineStyle: {
|
|
21
|
+
stroke: '#B8C2D1',
|
|
22
|
+
lineWidth: 0.5,
|
|
23
|
+
},
|
|
24
|
+
areaStyle: {
|
|
25
|
+
fill: '#D8DFEA',
|
|
26
|
+
opacity: 0.24,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
7
29
|
exports.BACKGROUND_STYLE = {
|
|
8
30
|
fill: '#416180',
|
|
9
31
|
opacity: 0.05,
|
|
10
32
|
};
|
|
11
33
|
exports.FOREGROUND_STYLE = {
|
|
12
|
-
fill: '#
|
|
13
|
-
opacity: 0.
|
|
34
|
+
fill: '#3485F8',
|
|
35
|
+
opacity: 0.06,
|
|
36
|
+
};
|
|
37
|
+
exports.SLIDER_BAR_STYLE = {
|
|
38
|
+
fill: '#DEE6F2',
|
|
39
|
+
highLightFill: '#CBDEF8',
|
|
40
|
+
};
|
|
41
|
+
exports.SLICER_BAR_LINE_STYLE = {
|
|
42
|
+
stroke: '#FFF',
|
|
43
|
+
lineWidth: 1.2,
|
|
14
44
|
cursor: 'move',
|
|
15
45
|
};
|
|
16
|
-
exports.
|
|
46
|
+
exports.SLIDER_BAR_LINE_GAP = 4;
|
|
47
|
+
exports.SLIDER_BAR_HEIGHT = 6;
|
|
48
|
+
exports.DEFAULT_HANDLER_WIDTH = 6;
|
|
49
|
+
exports.DEFAULT_HANDLER_HEIGHT = 12;
|
|
17
50
|
exports.HANDLER_STYLE = {
|
|
18
51
|
width: exports.DEFAULT_HANDLER_WIDTH,
|
|
19
|
-
height:
|
|
52
|
+
height: exports.DEFAULT_HANDLER_HEIGHT,
|
|
53
|
+
fill: '#FFF',
|
|
54
|
+
stroke: '#A6BDE1',
|
|
55
|
+
radius: 2,
|
|
56
|
+
opacity: 1,
|
|
57
|
+
cursor: 'ew-resize',
|
|
58
|
+
// 高亮的颜色
|
|
59
|
+
highLightFill: '#3485F8',
|
|
60
|
+
highLightStroke: '#3485F8',
|
|
20
61
|
};
|
|
21
62
|
exports.TEXT_STYLE = {
|
|
22
63
|
textBaseline: 'middle',
|
|
@@ -24,4 +65,7 @@ exports.TEXT_STYLE = {
|
|
|
24
65
|
opacity: 0.45,
|
|
25
66
|
};
|
|
26
67
|
exports.SLIDER_CHANGE = 'sliderchange';
|
|
68
|
+
exports.MAX_TEXT_WIDTH = 60;
|
|
69
|
+
exports.TEXT_PADDING = 2;
|
|
70
|
+
exports.TEXT_SAFE_WIDTH = 4;
|
|
27
71
|
//# sourceMappingURL=constant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../../src/slider/constant.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEU,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,IAAI;CACd,CAAC;AAEW,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../../src/slider/constant.ts"],"names":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U,GAAG;IACxB,YAAY,EAAE,QAAQ;IACtB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,IAAI;CACd,CAAC;AAEW,QAAA,aAAa,GAAG,cAAc,CAAC;AAE/B,QAAA,cAAc,GAAG,EAAE,CAAC;AACpB,QAAA,YAAY,GAAG,CAAC,CAAC;AACjB,QAAA,eAAe,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { IGroup } from '@antv/g-base';
|
|
2
|
+
import GroupComponent from '../abstract/group-component';
|
|
3
|
+
import { GroupComponentCfg } from '../types';
|
|
4
|
+
interface IStyle {
|
|
5
|
+
fill?: string;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
radius?: number;
|
|
8
|
+
opacity?: number;
|
|
9
|
+
cursor?: string;
|
|
10
|
+
highLightFill?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ForegroundCfg extends GroupComponentCfg {
|
|
13
|
+
readonly x: number;
|
|
14
|
+
readonly y: number;
|
|
15
|
+
readonly width: number;
|
|
16
|
+
readonly height: number;
|
|
17
|
+
readonly foregroundStyle?: IStyle;
|
|
18
|
+
}
|
|
19
|
+
export declare class Foreground extends GroupComponent<ForegroundCfg> {
|
|
20
|
+
getDefaultCfg(): {
|
|
21
|
+
name: string;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
style: {
|
|
25
|
+
fill: string;
|
|
26
|
+
opacity: number;
|
|
27
|
+
};
|
|
28
|
+
barStyle: {
|
|
29
|
+
fill: string;
|
|
30
|
+
highLightFill: string;
|
|
31
|
+
};
|
|
32
|
+
container: any;
|
|
33
|
+
shapesMap: {};
|
|
34
|
+
group: any;
|
|
35
|
+
capture: boolean;
|
|
36
|
+
isRegister: boolean;
|
|
37
|
+
isUpdating: boolean;
|
|
38
|
+
isInit: boolean;
|
|
39
|
+
id: string;
|
|
40
|
+
type: string;
|
|
41
|
+
locationType: string;
|
|
42
|
+
offsetX: number;
|
|
43
|
+
offsetY: number;
|
|
44
|
+
animate: boolean;
|
|
45
|
+
updateAutoRender: boolean;
|
|
46
|
+
animateOption: {
|
|
47
|
+
appear: any;
|
|
48
|
+
update: {
|
|
49
|
+
duration: number;
|
|
50
|
+
easing: string;
|
|
51
|
+
};
|
|
52
|
+
enter: {
|
|
53
|
+
duration: number;
|
|
54
|
+
easing: string;
|
|
55
|
+
};
|
|
56
|
+
leave: {
|
|
57
|
+
duration: number;
|
|
58
|
+
easing: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
events: any;
|
|
62
|
+
defaultCfg: {};
|
|
63
|
+
visible: boolean;
|
|
64
|
+
};
|
|
65
|
+
protected renderInner(group: IGroup): void;
|
|
66
|
+
private drawBarLine;
|
|
67
|
+
protected initEvent(): void;
|
|
68
|
+
private bindEvents;
|
|
69
|
+
private draw;
|
|
70
|
+
}
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Foreground = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var group_component_1 = require("../abstract/group-component");
|
|
6
|
+
var constant_1 = require("./constant");
|
|
7
|
+
var Foreground = /** @class */ (function (_super) {
|
|
8
|
+
tslib_1.__extends(Foreground, _super);
|
|
9
|
+
function Foreground() {
|
|
10
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
11
|
+
}
|
|
12
|
+
Foreground.prototype.getDefaultCfg = function () {
|
|
13
|
+
var cfg = _super.prototype.getDefaultCfg.call(this);
|
|
14
|
+
return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'foreground',
|
|
15
|
+
// x: 0,
|
|
16
|
+
// y: 0,
|
|
17
|
+
width: 100, height: 16, style: constant_1.FOREGROUND_STYLE, barStyle: constant_1.SLIDER_BAR_STYLE });
|
|
18
|
+
};
|
|
19
|
+
Foreground.prototype.renderInner = function (group) {
|
|
20
|
+
var _this = this;
|
|
21
|
+
var _a = this.cfg, x = _a.x, height = _a.height, width = _a.width, style = _a.style, barStyle = _a.barStyle;
|
|
22
|
+
// 上方brush区域
|
|
23
|
+
this.addShape(group, {
|
|
24
|
+
id: this.getElementId('foreground-brush'),
|
|
25
|
+
name: 'foreground-brush',
|
|
26
|
+
type: 'rect',
|
|
27
|
+
attrs: tslib_1.__assign({ x: x, y: 0, width: width, height: (height * 3) / 5, cursor: 'crosshair' }, style),
|
|
28
|
+
});
|
|
29
|
+
// 下方移动区域
|
|
30
|
+
this.addShape(group, {
|
|
31
|
+
id: this.getElementId('foreground-scroll'),
|
|
32
|
+
name: 'foreground-scroll',
|
|
33
|
+
type: 'rect',
|
|
34
|
+
attrs: tslib_1.__assign({ x: x, y: (height * 3) / 5, width: width, height: (height * 2) / 5, cursor: 'move' }, style),
|
|
35
|
+
});
|
|
36
|
+
// 下方Bar区域
|
|
37
|
+
var barGroup = this.addGroup(group, {
|
|
38
|
+
id: this.getElementId('foreground-bar'),
|
|
39
|
+
name: 'foreground-bar',
|
|
40
|
+
});
|
|
41
|
+
// 外层矩形
|
|
42
|
+
this.addShape(barGroup, {
|
|
43
|
+
id: this.getElementId('foreground-bar-rect'),
|
|
44
|
+
name: 'foreground-bar-rect',
|
|
45
|
+
type: 'rect',
|
|
46
|
+
attrs: tslib_1.__assign({ x: x, y: height, width: width, height: constant_1.SLIDER_BAR_HEIGHT, cursor: 'move' }, barStyle),
|
|
47
|
+
});
|
|
48
|
+
// 三条小竖线
|
|
49
|
+
var centerX = width / 2 + x;
|
|
50
|
+
var leftX = centerX - constant_1.SLIDER_BAR_LINE_GAP;
|
|
51
|
+
var rightX = centerX + constant_1.SLIDER_BAR_LINE_GAP;
|
|
52
|
+
var y1 = height + (1 / 5) * 6;
|
|
53
|
+
var y2 = height + (4 / 5) * 6;
|
|
54
|
+
var publicAttrs = tslib_1.__assign({ y1: y1,
|
|
55
|
+
y2: y2 }, constant_1.SLICER_BAR_LINE_STYLE);
|
|
56
|
+
[leftX, centerX, rightX].forEach(function (x) {
|
|
57
|
+
_this.drawBarLine(group, x, publicAttrs);
|
|
58
|
+
});
|
|
59
|
+
this.addShape(group, {
|
|
60
|
+
id: this.getElementId('foreground-border'),
|
|
61
|
+
name: 'foreground-border',
|
|
62
|
+
type: 'rect',
|
|
63
|
+
attrs: {
|
|
64
|
+
x: x,
|
|
65
|
+
y: 0,
|
|
66
|
+
width: width,
|
|
67
|
+
height: height,
|
|
68
|
+
stroke: '#4E83CD',
|
|
69
|
+
opacity: 0.3,
|
|
70
|
+
lineWidth: 0.8,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
Foreground.prototype.drawBarLine = function (group, x, attrs) {
|
|
75
|
+
this.addShape(group, {
|
|
76
|
+
id: this.getElementId("line-" + x),
|
|
77
|
+
name: "line-" + x,
|
|
78
|
+
type: 'line',
|
|
79
|
+
attrs: tslib_1.__assign({ x1: x, x2: x }, attrs),
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
Foreground.prototype.initEvent = function () {
|
|
83
|
+
this.bindEvents();
|
|
84
|
+
};
|
|
85
|
+
Foreground.prototype.bindEvents = function () {
|
|
86
|
+
var _this = this;
|
|
87
|
+
var _a = this.get('barStyle'), highLightFill = _a.highLightFill, fill = _a.fill;
|
|
88
|
+
var barRectShape = this.get('group').findById(this.getElementId('foreground-bar-rect'));
|
|
89
|
+
this.get('group').on('foreground-bar:mouseenter', function () {
|
|
90
|
+
barRectShape.attr('fill', highLightFill);
|
|
91
|
+
_this.draw();
|
|
92
|
+
});
|
|
93
|
+
this.get('group').on('foreground-bar:mouseleave', function () {
|
|
94
|
+
barRectShape.attr('fill', fill);
|
|
95
|
+
_this.draw();
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
Foreground.prototype.draw = function () {
|
|
99
|
+
var canvas = this.get('container').get('canvas');
|
|
100
|
+
if (canvas) {
|
|
101
|
+
canvas.draw();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
return Foreground;
|
|
105
|
+
}(group_component_1.default));
|
|
106
|
+
exports.Foreground = Foreground;
|
|
107
|
+
//# sourceMappingURL=foreground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foreground.js","sourceRoot":"","sources":["../../src/slider/foreground.ts"],"names":[],"mappings":";;;;AACA,+DAAyD;AAEzD,uCAMoB;AAqBpB;IAAgC,sCAA6B;IAA7D;;IAsIA,CAAC;IArIQ,kCAAa,GAApB;QACE,IAAM,GAAG,GAAG,iBAAM,aAAa,WAAE,CAAC;QAClC,6CACK,GAAG,KACN,IAAI,EAAE,YAAY;YAClB,QAAQ;YACR,QAAQ;YACR,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,EAAE,EACV,KAAK,EAAE,2BAAgB,EACvB,QAAQ,EAAE,2BAAgB,IAC1B;IACJ,CAAC;IAES,gCAAW,GAArB,UAAsB,KAAa;QAAnC,iBAiFC;QAhFO,IAAA,KAAwC,IAAI,CAAC,GAAG,EAA9C,CAAC,OAAA,EAAE,MAAM,YAAA,EAAE,KAAK,WAAA,EAAE,KAAK,WAAA,EAAE,QAAQ,cAAa,CAAC;QAEvD,YAAY;QACZ,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;YACnB,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC;YACzC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,MAAM;YACZ,KAAK,qBACH,CAAC,GAAA,EACD,CAAC,EAAE,CAAC,EACJ,KAAK,OAAA,EACL,MAAM,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,EACxB,MAAM,EAAE,WAAW,IAChB,KAAK,CACT;SACF,CAAC,CAAC;QAEH,SAAS;QACT,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;YACnB,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC;YAC1C,IAAI,EAAE,mBAAmB;YACzB,I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AC,CAAC;YACzC,KAAI,CAAC,IAAI,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,2BAA2B,EAAE;YAChD,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAChC,KAAI,CAAC,IAAI,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,yBAAI,GAAZ;QACE,IAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,IAAI,EAAE,CAAC;SACf;IACH,CAAC;IACH,iBAAC;AAAD,CAAC,AAtID,CAAgC,yBAAc,GAsI7C;AAtIY,gCAAU"}
|
package/lib/slider/handler.d.ts
CHANGED
|
@@ -16,14 +16,6 @@ export interface HandlerCfg extends GroupComponentCfg {
|
|
|
16
16
|
readonly height: number;
|
|
17
17
|
readonly style?: IStyle;
|
|
18
18
|
}
|
|
19
|
-
export declare const DEFAULT_HANDLER_STYLE: {
|
|
20
|
-
fill: string;
|
|
21
|
-
stroke: string;
|
|
22
|
-
radius: number;
|
|
23
|
-
opacity: number;
|
|
24
|
-
cursor: string;
|
|
25
|
-
highLightFill: string;
|
|
26
|
-
};
|
|
27
19
|
export declare class Handler extends GroupComponent<HandlerCfg> {
|
|
28
20
|
getDefaultCfg(): {
|
|
29
21
|
name: string;
|
|
@@ -32,12 +24,15 @@ export declare class Handler extends GroupComponent<HandlerCfg> {
|
|
|
32
24
|
width: number;
|
|
33
25
|
height: number;
|
|
34
26
|
style: {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
35
29
|
fill: string;
|
|
36
30
|
stroke: string;
|
|
37
31
|
radius: number;
|
|
38
32
|
opacity: number;
|
|
39
33
|
cursor: string;
|
|
40
34
|
highLightFill: string;
|
|
35
|
+
highLightStroke: string;
|
|
41
36
|
};
|
|
42
37
|
container: any;
|
|
43
38
|
shapesMap: {};
|
package/lib/slider/handler.js
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Handler =
|
|
3
|
+
exports.Handler = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var group_component_1 = require("../abstract/group-component");
|
|
6
|
-
|
|
7
|
-
fill: '#F7F7F7',
|
|
8
|
-
stroke: '#BFBFBF',
|
|
9
|
-
radius: 2,
|
|
10
|
-
opacity: 1,
|
|
11
|
-
cursor: 'ew-resize',
|
|
12
|
-
// 高亮的颜色
|
|
13
|
-
highLightFill: '#FFF',
|
|
14
|
-
};
|
|
6
|
+
var constant_1 = require("./constant");
|
|
15
7
|
var Handler = /** @class */ (function (_super) {
|
|
16
8
|
tslib_1.__extends(Handler, _super);
|
|
17
9
|
function Handler() {
|
|
@@ -19,7 +11,7 @@ var Handler = /** @class */ (function (_super) {
|
|
|
19
11
|
}
|
|
20
12
|
Handler.prototype.getDefaultCfg = function () {
|
|
21
13
|
var cfg = _super.prototype.getDefaultCfg.call(this);
|
|
22
|
-
return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'handler', x: 0, y: 0, width:
|
|
14
|
+
return tslib_1.__assign(tslib_1.__assign({}, cfg), { name: 'handler', x: 0, y: 0, width: constant_1.DEFAULT_HANDLER_WIDTH, height: constant_1.DEFAULT_HANDLER_HEIGHT, style: constant_1.HANDLER_STYLE });
|
|
23
15
|
};
|
|
24
16
|
Handler.prototype.renderInner = function (group) {
|
|
25
17
|
var _a = this.cfg, width = _a.width, height = _a.height, style = _a.style;
|
|
@@ -34,7 +26,6 @@ var Handler = /** @class */ (function (_super) {
|
|
|
34
26
|
width: width,
|
|
35
27
|
height: height,
|
|
36
28
|
fill: fill,
|
|
37
|
-
stroke: stroke,
|
|
38
29
|
radius: radius,
|
|
39
30
|
opacity: opacity,
|
|
40
31
|
cursor: cursor,
|
|
@@ -82,13 +73,15 @@ var Handler = /** @class */ (function (_super) {
|
|
|
82
73
|
Handler.prototype.bindEvents = function () {
|
|
83
74
|
var _this = this;
|
|
84
75
|
this.get('group').on('mouseenter', function () {
|
|
85
|
-
var
|
|
86
|
-
_this.getElementByLocalId('
|
|
76
|
+
var highLightStroke = _this.get('style').highLightStroke;
|
|
77
|
+
_this.getElementByLocalId('line-left').attr('stroke', highLightStroke);
|
|
78
|
+
_this.getElementByLocalId('line-right').attr('stroke', highLightStroke);
|
|
87
79
|
_this.draw();
|
|
88
80
|
});
|
|
89
81
|
this.get('group').on('mouseleave', function () {
|
|
90
|
-
var
|
|
91
|
-
_this.getElementByLocalId('
|
|
82
|
+
var stroke = _this.get('style').stroke;
|
|
83
|
+
_this.getElementByLocalId('line-left').attr('stroke', stroke);
|
|
84
|
+
_this.getElementByLocalId('line-right').attr('stroke', stroke);
|
|
92
85
|
_this.draw();
|
|
93
86
|
});
|
|
94
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/slider/handler.ts"],"names":[],"mappings":";;;;AACA,+DAAyD;
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../src/slider/handler.ts"],"names":[],"mappings":";;;;AACA,+DAAyD;AAEzD,uCAA0F;AAqB1F;IAA6B,mCAA0B;IAAvD;;IAoGA,CAAC;IAnGQ,+BAAa,GAApB;QACE,IAAM,GAAG,GAAG,iBAAM,aAAa,WAAE,CAAC;QAClC,6CACK,GAAG,KACN,IAAI,EAAE,SAAS,EACf,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,EACJ,KAAK,EAAE,gCAAqB,EAC5B,MAAM,EAAE,iCAAsB,EAC9B,KAAK,EAAE,wBAAa,IACpB;IACJ,CAAC;IACS,6BAAW,GAArB,UAAsB,KAAa;QAC3B,IAAA,KAA2B,IAAI,CAAC,GAAiB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,EAAE,MAAM,CAAC,CAAC;YAC9D,KAAI,CAAC,IAAI,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,sBAAI,GAAZ;QACE,IAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,IAAI,EAAE,CAAC;SACf;IACH,CAAC;IACH,cAAC;AAAD,CAAC,AApGD,CAA6B,yBAAc,GAoG1C;AApGY,0BAAO;AAsGpB,kBAAe,OAAO,CAAC"}
|
package/lib/slider/slider.d.ts
CHANGED
|
@@ -39,10 +39,14 @@ export declare class Slider extends GroupComponent<SliderCfg> implements ISlider
|
|
|
39
39
|
cfg: SliderCfg;
|
|
40
40
|
private minHandler;
|
|
41
41
|
private maxHandler;
|
|
42
|
+
private foreground;
|
|
42
43
|
private trend;
|
|
43
44
|
private currentTarget;
|
|
44
45
|
private prevX;
|
|
45
46
|
private prevY;
|
|
47
|
+
private brushPrevX;
|
|
48
|
+
private enableBrush;
|
|
49
|
+
private brushMaskShape;
|
|
46
50
|
setRange(min: number, max: number): void;
|
|
47
51
|
getRange(): Range;
|
|
48
52
|
setValue(value: number | number[]): void;
|
|
@@ -65,11 +69,17 @@ export declare class Slider extends GroupComponent<SliderCfg> implements ISlider
|
|
|
65
69
|
foregroundStyle: {
|
|
66
70
|
fill: string;
|
|
67
71
|
opacity: number;
|
|
68
|
-
cursor: string;
|
|
69
72
|
};
|
|
70
73
|
handlerStyle: {
|
|
71
74
|
width: number;
|
|
72
75
|
height: number;
|
|
76
|
+
fill: string;
|
|
77
|
+
stroke: string;
|
|
78
|
+
radius: number;
|
|
79
|
+
opacity: number;
|
|
80
|
+
cursor: string;
|
|
81
|
+
highLightFill: string;
|
|
82
|
+
highLightStroke: string;
|
|
73
83
|
};
|
|
74
84
|
textStyle: {
|
|
75
85
|
textBaseline: string;
|
|
@@ -88,9 +98,7 @@ export declare class Slider extends GroupComponent<SliderCfg> implements ISlider
|
|
|
88
98
|
type: string;
|
|
89
99
|
locationType: string;
|
|
90
100
|
offsetX: number;
|
|
91
|
-
offsetY: number;
|
|
92
|
-
* slider handler style 设置
|
|
93
|
-
*/
|
|
101
|
+
offsetY: number;
|
|
94
102
|
animate: boolean;
|
|
95
103
|
updateAutoRender: boolean;
|
|
96
104
|
animateOption: {
|
|
@@ -134,7 +142,11 @@ export declare class Slider extends GroupComponent<SliderCfg> implements ISlider
|
|
|
134
142
|
* @param range
|
|
135
143
|
*/
|
|
136
144
|
private _dodgeText;
|
|
145
|
+
private setTextAttrs;
|
|
137
146
|
draw(): void;
|
|
138
147
|
private getContainerDOM;
|
|
148
|
+
private onBrushMouseMove;
|
|
149
|
+
private onBrushMouseUp;
|
|
150
|
+
private cancelBrush;
|
|
139
151
|
}
|
|
140
152
|
export default Slider;
|