@vtx/map 1.0.3
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/README.md +44 -0
- package/lib/VtxMap/AMap/AMap.css +24 -0
- package/lib/VtxMap/AMap/AMap.js +2944 -0
- package/lib/VtxMap/AMap/AMap.less +24 -0
- package/lib/VtxMap/BMap/Map.css +26 -0
- package/lib/VtxMap/BMap/Map.js +3128 -0
- package/lib/VtxMap/BMap/Map.less +28 -0
- package/lib/VtxMap/GMap/Map.css +88 -0
- package/lib/VtxMap/GMap/Map.js +4166 -0
- package/lib/VtxMap/GMap/Map.less +87 -0
- package/lib/VtxMap/Map.css +7 -0
- package/lib/VtxMap/Map.js +84 -0
- package/lib/VtxMap/Map.less +9 -0
- package/lib/VtxMap/MapToolFunction.js +403 -0
- package/lib/VtxMap/OMap/Map.css +76 -0
- package/lib/VtxMap/OMap/Map.js +3932 -0
- package/lib/VtxMap/OMap/Map.less +70 -0
- package/lib/VtxMap/TMap/TMap.css +26 -0
- package/lib/VtxMap/TMap/TMap.js +3151 -0
- package/lib/VtxMap/TMap/TMap.less +31 -0
- package/lib/VtxMap/index.js +34 -0
- package/lib/VtxMap/mapPlayer.js +348 -0
- package/lib/VtxMap/optimizingPointMap.js +238 -0
- package/lib/VtxMap/zoomMap.js +124 -0
- package/lib/VtxModal/VtxModal.css +62 -0
- package/lib/VtxModal/VtxModal.js +249 -0
- package/lib/VtxModal/VtxModal.less +65 -0
- package/lib/VtxModal/draggableModal.js +143 -0
- package/lib/VtxModal/index.js +22 -0
- package/lib/VtxSearchMap/VtxSearchMap.css +170 -0
- package/lib/VtxSearchMap/VtxSearchMap.js +872 -0
- package/lib/VtxSearchMap/VtxSearchMap.less +169 -0
- package/lib/VtxSearchMap/index.js +22 -0
- package/lib/VtxSearchMap/mapping.js +15 -0
- package/lib/default.js +40 -0
- package/lib/index.js +35 -0
- package/package.json +39 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
8
|
+
|
|
9
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
10
|
+
|
|
11
|
+
var _react = require('react');
|
|
12
|
+
|
|
13
|
+
var _react2 = _interopRequireDefault(_react);
|
|
14
|
+
|
|
15
|
+
var _Map = require('./Map');
|
|
16
|
+
|
|
17
|
+
var _Map2 = _interopRequireDefault(_Map);
|
|
18
|
+
|
|
19
|
+
var _immutable = require('immutable');
|
|
20
|
+
|
|
21
|
+
var _immutable2 = _interopRequireDefault(_immutable);
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
|
|
25
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
26
|
+
|
|
27
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
28
|
+
|
|
29
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
30
|
+
|
|
31
|
+
var zoomMap = function (_React$Component) {
|
|
32
|
+
_inherits(zoomMap, _React$Component);
|
|
33
|
+
|
|
34
|
+
function zoomMap(props) {
|
|
35
|
+
_classCallCheck(this, zoomMap);
|
|
36
|
+
|
|
37
|
+
var _this = _possibleConstructorReturn(this, (zoomMap.__proto__ || Object.getPrototypeOf(zoomMap)).call(this, props));
|
|
38
|
+
|
|
39
|
+
_this.map = null;
|
|
40
|
+
_this.state = {
|
|
41
|
+
filterPoints: []
|
|
42
|
+
};
|
|
43
|
+
return _this;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
_createClass(zoomMap, [{
|
|
47
|
+
key: 'resetPoints',
|
|
48
|
+
value: function resetPoints() {
|
|
49
|
+
var mapPoints = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
50
|
+
var zoomLv = arguments[1];
|
|
51
|
+
|
|
52
|
+
// console.log('当前zoom等级',this.state.zoomLv);
|
|
53
|
+
console.log(this.map.getMapExtent());
|
|
54
|
+
zoomLv = zoomLv || this.map.getZoomLevel();
|
|
55
|
+
if (zoomLv) {
|
|
56
|
+
this.setState({
|
|
57
|
+
filterPoints: mapPoints.filter(function (item) {
|
|
58
|
+
return typeof item.zoomLevel == 'number' ? item.zoomLevel <= zoomLv : true;
|
|
59
|
+
})
|
|
60
|
+
}, function () {
|
|
61
|
+
// console.log(`zoom等级(${this.state.zoomLv})过滤后还有${this.state.filterPoints.length}个点`);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: 'componentDidMount',
|
|
67
|
+
value: function componentDidMount() {
|
|
68
|
+
// console.log(this.map.getMapExtent())
|
|
69
|
+
// 地图加载完成取得当前zoom值,初始化内部点数据
|
|
70
|
+
this.resetPoints(this.props.mapPoints);
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: 'componentWillReceiveProps',
|
|
74
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
75
|
+
if (!this.deepEqual(this.props.mapPoints, nextProps.mapPoints)) {
|
|
76
|
+
// 外部点数据改变,更新内部点数据
|
|
77
|
+
this.resetPoints(nextProps.mapPoints);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: 'deepEqual',
|
|
82
|
+
value: function deepEqual(a, b) {
|
|
83
|
+
return _immutable2.default.is(_immutable2.default.fromJS(a), _immutable2.default.fromJS(b));
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: 'zoomEnd',
|
|
87
|
+
value: function zoomEnd(obj) {
|
|
88
|
+
// console.log(obj)
|
|
89
|
+
//zoom操作后,更新内部点数据
|
|
90
|
+
this.resetPoints(this.props.mapPoints);
|
|
91
|
+
|
|
92
|
+
if (typeof this.props.zoomEnd === "function") {
|
|
93
|
+
this.props.zoomEnd(obj);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: 'render',
|
|
98
|
+
value: function render() {
|
|
99
|
+
var _this2 = this;
|
|
100
|
+
|
|
101
|
+
var newProps = _extends({}, this.props, {
|
|
102
|
+
zoomEnd: this.zoomEnd.bind(this),
|
|
103
|
+
mapPoints: this.state.filterPoints,
|
|
104
|
+
ref: function ref(p) {
|
|
105
|
+
if (p) {
|
|
106
|
+
_this2.map = p;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// 屏蔽地图默认的setFitView的调整zoom功能,只会重新设置center
|
|
110
|
+
});if (newProps.mapVisiblePoints) {
|
|
111
|
+
newProps.mapVisiblePoints = _extends({}, newProps.mapVisiblePoints, {
|
|
112
|
+
type: 'center'
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return _react2.default.createElement(_Map2.default, newProps);
|
|
117
|
+
}
|
|
118
|
+
}]);
|
|
119
|
+
|
|
120
|
+
return zoomMap;
|
|
121
|
+
}(_react2.default.Component);
|
|
122
|
+
|
|
123
|
+
exports.default = zoomMap;
|
|
124
|
+
module.exports = exports['default'];
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.vtx-ui-modal-normal .ant-modal .ant-modal-content {
|
|
2
|
+
height: 100%;
|
|
3
|
+
}
|
|
4
|
+
.vtx-ui-modal-normal .ant-modal .ant-modal-content .ant-modal-body {
|
|
5
|
+
max-height: calc(100% - 108px);
|
|
6
|
+
overflow: auto;
|
|
7
|
+
background-color: #fbfbfb;
|
|
8
|
+
}
|
|
9
|
+
.vtx-ui-modal-normal .vtx-ui-modal-title {
|
|
10
|
+
position: relative;
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
.vtx-ui-modal-normal .vtx-ui-modal-title .vtx-ui-modal-title_name {
|
|
14
|
+
width: 100%;
|
|
15
|
+
color: #108EE2;
|
|
16
|
+
}
|
|
17
|
+
.vtx-ui-modal-normal .vtx-ui-modal-title .vtx-ui-modal-close,
|
|
18
|
+
.vtx-ui-modal-normal .vtx-ui-modal-title .vtx-ui-modal-maximizeIcon {
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: -13px;
|
|
21
|
+
right: -16px;
|
|
22
|
+
}
|
|
23
|
+
.vtx-ui-modal-normal .vtx-ui-modal-title .vtx-ui-modal-close p,
|
|
24
|
+
.vtx-ui-modal-normal .vtx-ui-modal-title .vtx-ui-modal-maximizeIcon p {
|
|
25
|
+
width: 36px;
|
|
26
|
+
height: 48px;
|
|
27
|
+
text-align: center;
|
|
28
|
+
line-height: 48px;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
border: 0;
|
|
31
|
+
background: transparent;
|
|
32
|
+
position: absolute;
|
|
33
|
+
right: 0;
|
|
34
|
+
top: 0;
|
|
35
|
+
z-index: 10;
|
|
36
|
+
font-weight: 700;
|
|
37
|
+
text-decoration: none;
|
|
38
|
+
-webkit-transition: color 0.3s ease;
|
|
39
|
+
transition: color 0.3s ease;
|
|
40
|
+
color: rgba(0, 0, 0, 0.43);
|
|
41
|
+
outline: 0;
|
|
42
|
+
display: inline-block;
|
|
43
|
+
}
|
|
44
|
+
.vtx-ui-modal-normal .vtx-ui-modal-title .vtx-ui-modal-close p:hover,
|
|
45
|
+
.vtx-ui-modal-normal .vtx-ui-modal-title .vtx-ui-modal-maximizeIcon p:hover {
|
|
46
|
+
color: #444;
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
}
|
|
49
|
+
.vtx-ui-modal-normal .vtx-ui-modal-title .vtx-ui-modal-maximizeIcon {
|
|
50
|
+
right: 20px;
|
|
51
|
+
}
|
|
52
|
+
.vtx-ui-modal-maxClass .ant-modal {
|
|
53
|
+
top: 0 !important;
|
|
54
|
+
left: 0 !important;
|
|
55
|
+
width: 100% !important;
|
|
56
|
+
height: 100% !important;
|
|
57
|
+
padding-bottom: 0 !important;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
}
|
|
60
|
+
.vtx-ui-modal-maxClass .ant-modal-body {
|
|
61
|
+
height: calc(100% - 108px) !important;
|
|
62
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
8
|
+
|
|
9
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
10
|
+
|
|
11
|
+
var _react = require('react');
|
|
12
|
+
|
|
13
|
+
var _react2 = _interopRequireDefault(_react);
|
|
14
|
+
|
|
15
|
+
require('./VtxModal.css');
|
|
16
|
+
|
|
17
|
+
var _modal = require('antd/lib/modal');
|
|
18
|
+
|
|
19
|
+
var _modal2 = _interopRequireDefault(_modal);
|
|
20
|
+
|
|
21
|
+
require('antd/lib/modal/style/css');
|
|
22
|
+
|
|
23
|
+
var _icon = require('antd/lib/icon');
|
|
24
|
+
|
|
25
|
+
var _icon2 = _interopRequireDefault(_icon);
|
|
26
|
+
|
|
27
|
+
require('antd/lib/icon/style/css');
|
|
28
|
+
|
|
29
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
+
|
|
31
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
32
|
+
|
|
33
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
34
|
+
|
|
35
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
36
|
+
|
|
37
|
+
var styles = {
|
|
38
|
+
normal: 'vtx-ui-modal-normal',
|
|
39
|
+
maxClass: 'vtx-ui-modal-maxClass',
|
|
40
|
+
title: 'vtx-ui-modal-title',
|
|
41
|
+
title_name: 'vtx-ui-modal-title_name',
|
|
42
|
+
close: 'vtx-ui-modal-close',
|
|
43
|
+
maximizeIcon: 'vtx-ui-modal-maximizeIcon'
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var VtxModal = function (_React$Component) {
|
|
47
|
+
_inherits(VtxModal, _React$Component);
|
|
48
|
+
|
|
49
|
+
function VtxModal(props) {
|
|
50
|
+
_classCallCheck(this, VtxModal);
|
|
51
|
+
|
|
52
|
+
var _this = _possibleConstructorReturn(this, (VtxModal.__proto__ || Object.getPrototypeOf(VtxModal)).call(this, props));
|
|
53
|
+
|
|
54
|
+
_this.classId = new Date().getTime() + Math.random();
|
|
55
|
+
_this.isInit = false;
|
|
56
|
+
_this.isCreate = props.visible;
|
|
57
|
+
_this.state = {
|
|
58
|
+
maximizable: false,
|
|
59
|
+
maximizeClass: '',
|
|
60
|
+
|
|
61
|
+
init_x: 0,
|
|
62
|
+
init_y: 0,
|
|
63
|
+
x_move: 0,
|
|
64
|
+
y_move: 0,
|
|
65
|
+
documentMouseMove: null,
|
|
66
|
+
documentMouseUp: null
|
|
67
|
+
};
|
|
68
|
+
_this.startDrag = _this.startDrag.bind(_this);
|
|
69
|
+
return _this;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
_createClass(VtxModal, [{
|
|
73
|
+
key: 'componentWillReceiveProps',
|
|
74
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
75
|
+
if (nextProps.visible && !this.isCreate) {
|
|
76
|
+
this.isCreate = true;
|
|
77
|
+
}
|
|
78
|
+
if (!this.props.visible && nextProps.visible) {
|
|
79
|
+
this.setState({
|
|
80
|
+
x_move: 0,
|
|
81
|
+
y_move: 0
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: 'componentDidUpdate',
|
|
87
|
+
value: function componentDidUpdate() {
|
|
88
|
+
var t = this;
|
|
89
|
+
if (!this.props.isNotMoving) {
|
|
90
|
+
if (this.isCreate && !this.isInit) {
|
|
91
|
+
this.isInit = true;
|
|
92
|
+
try {
|
|
93
|
+
this.timer = setTimeout(function () {
|
|
94
|
+
var modalHead = document.getElementsByClassName(t.classId)[0].getElementsByClassName('ant-modal-header')[0];
|
|
95
|
+
modalHead.style.cursor = 'move';
|
|
96
|
+
modalHead.onmousedown = t.startDrag;
|
|
97
|
+
}, 200);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.error('VtxModal拖动功能异常,未获取到头部dom对象!');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: 'componentWillUnmount',
|
|
106
|
+
value: function componentWillUnmount() {
|
|
107
|
+
if (this.timer) {
|
|
108
|
+
clearTimeout(this.timer);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: 'startDrag',
|
|
113
|
+
value: function startDrag(e) {
|
|
114
|
+
var _this2 = this;
|
|
115
|
+
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
if (!this.state.maximizable) {
|
|
118
|
+
this.setState({
|
|
119
|
+
documentMouseUp: document.onmouseup,
|
|
120
|
+
documentMouseMove: document.onmousemove,
|
|
121
|
+
init_x: e.clientX - this.state.x_move,
|
|
122
|
+
init_y: e.clientY - this.state.y_move
|
|
123
|
+
});
|
|
124
|
+
document.onmousemove = function (e) {
|
|
125
|
+
_this2.setState({
|
|
126
|
+
x_move: e.clientX - _this2.state.init_x,
|
|
127
|
+
y_move: e.clientY - _this2.state.init_y
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
document.onmouseup = function (e) {
|
|
131
|
+
document.onmousemove = _this2.state.documentMouseMove;
|
|
132
|
+
document.onmouseup = _this2.state.documentMouseUp;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: 'componentWillUnmount',
|
|
138
|
+
value: function componentWillUnmount() {
|
|
139
|
+
if (this.timer) {
|
|
140
|
+
clearTimeout(this.timer);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
key: 'render',
|
|
145
|
+
value: function render() {
|
|
146
|
+
var t = this;
|
|
147
|
+
var _props = this.props,
|
|
148
|
+
_props$closable = _props.closable,
|
|
149
|
+
closable = _props$closable === undefined ? true : _props$closable,
|
|
150
|
+
_props$maximize = _props.maximize,
|
|
151
|
+
maximize = _props$maximize === undefined ? true : _props$maximize,
|
|
152
|
+
_props$wrapClassName = _props.wrapClassName,
|
|
153
|
+
wrapClassName = _props$wrapClassName === undefined ? '' : _props$wrapClassName,
|
|
154
|
+
_props$title = _props.title,
|
|
155
|
+
title = _props$title === undefined ? '' : _props$title;
|
|
156
|
+
var _state = this.state,
|
|
157
|
+
maximizable = _state.maximizable,
|
|
158
|
+
maximizeClass = _state.maximizeClass;
|
|
159
|
+
|
|
160
|
+
wrapClassName = styles.normal + ' ' + wrapClassName + ' ' + maximizeClass + ' ' + this.classId;
|
|
161
|
+
var transformStyle = {
|
|
162
|
+
transform: 'translate(' + this.state.x_move + 'px,' + this.state.y_move + 'px)'
|
|
163
|
+
};
|
|
164
|
+
title = function renderTitle() {
|
|
165
|
+
return _react2.default.createElement(
|
|
166
|
+
'div',
|
|
167
|
+
{ className: styles.title, style: { paddingRight: closable ? '32px' : '0px' } },
|
|
168
|
+
_react2.default.createElement(
|
|
169
|
+
'div',
|
|
170
|
+
{ className: styles.title_name },
|
|
171
|
+
title
|
|
172
|
+
),
|
|
173
|
+
maximize ? _react2.default.createElement(
|
|
174
|
+
'div',
|
|
175
|
+
{ className: styles.maximizeIcon },
|
|
176
|
+
_react2.default.createElement(
|
|
177
|
+
'p',
|
|
178
|
+
{
|
|
179
|
+
onClick: function onClick() {
|
|
180
|
+
var maximizeClass = '';
|
|
181
|
+
if (!maximizable) {
|
|
182
|
+
maximizeClass = styles.maxClass;
|
|
183
|
+
}
|
|
184
|
+
t.setState({
|
|
185
|
+
maximizable: !maximizable,
|
|
186
|
+
maximizeClass: maximizeClass
|
|
187
|
+
}, function () {
|
|
188
|
+
{/* 为arcgis设计 */}
|
|
189
|
+
if (t.timer) {
|
|
190
|
+
clearTimeout(t.timer);
|
|
191
|
+
}
|
|
192
|
+
t.timer = setTimeout(function () {
|
|
193
|
+
if (window.onModalResize && typeof window.onModalResize == 'function') {
|
|
194
|
+
window.onModalResize();
|
|
195
|
+
}
|
|
196
|
+
}, 100);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
maximizable ? _react2.default.createElement(_icon2.default, { type: 'shrink' }) : _react2.default.createElement(_icon2.default, { type: 'arrows-alt' })
|
|
201
|
+
)
|
|
202
|
+
) : null,
|
|
203
|
+
closable ? _react2.default.createElement(
|
|
204
|
+
'div',
|
|
205
|
+
{ className: styles.close },
|
|
206
|
+
_react2.default.createElement(
|
|
207
|
+
'p',
|
|
208
|
+
{ onClick: t.props.onCancel },
|
|
209
|
+
_react2.default.createElement(_icon2.default, { type: 'close' })
|
|
210
|
+
)
|
|
211
|
+
) : ''
|
|
212
|
+
);
|
|
213
|
+
}();
|
|
214
|
+
var bodyStyle = _extends({}, this.props.bodyStyle);
|
|
215
|
+
if (!maximizable) {
|
|
216
|
+
bodyStyle = _extends({
|
|
217
|
+
maxHeight: window.innerHeight * 0.7 + 'px'
|
|
218
|
+
}, bodyStyle);
|
|
219
|
+
}
|
|
220
|
+
var props = _extends({
|
|
221
|
+
closable: closable,
|
|
222
|
+
maskClosable: false,
|
|
223
|
+
width: 700
|
|
224
|
+
}, this.props, {
|
|
225
|
+
closable: false,
|
|
226
|
+
title: title,
|
|
227
|
+
wrapClassName: wrapClassName,
|
|
228
|
+
bodyStyle: bodyStyle,
|
|
229
|
+
style: _extends({}, this.props.style, maximizable ? {} : transformStyle)
|
|
230
|
+
});
|
|
231
|
+
return _react2.default.createElement(
|
|
232
|
+
_modal2.default,
|
|
233
|
+
props,
|
|
234
|
+
this.props.children
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
}]);
|
|
238
|
+
|
|
239
|
+
return VtxModal;
|
|
240
|
+
}(_react2.default.Component);
|
|
241
|
+
|
|
242
|
+
VtxModal.info = _modal2.default.info;
|
|
243
|
+
VtxModal.success = _modal2.default.success;
|
|
244
|
+
VtxModal.error = _modal2.default.error;
|
|
245
|
+
VtxModal.warning = _modal2.default.warning;
|
|
246
|
+
VtxModal.confirm = _modal2.default.confirm;
|
|
247
|
+
|
|
248
|
+
exports.default = VtxModal;
|
|
249
|
+
module.exports = exports['default'];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.vtx-ui-modal-normal{
|
|
2
|
+
.ant-modal{
|
|
3
|
+
.ant-modal-content{
|
|
4
|
+
height: 100%;
|
|
5
|
+
.ant-modal-body{
|
|
6
|
+
max-height: e('calc(100% - 108px)');
|
|
7
|
+
overflow: auto;
|
|
8
|
+
background-color: #fbfbfb;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
.vtx-ui-modal-title{
|
|
13
|
+
position: relative;
|
|
14
|
+
width: 100%;
|
|
15
|
+
.vtx-ui-modal-title_name{
|
|
16
|
+
width: 100%;
|
|
17
|
+
color: #108EE2;
|
|
18
|
+
}
|
|
19
|
+
.vtx-ui-modal-close,.vtx-ui-modal-maximizeIcon{
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: -13px;
|
|
22
|
+
right: -16px;
|
|
23
|
+
p{
|
|
24
|
+
width: 36px;
|
|
25
|
+
height: 48px;
|
|
26
|
+
text-align: center;
|
|
27
|
+
line-height: 48px;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
border: 0;
|
|
30
|
+
background: transparent;
|
|
31
|
+
position: absolute;
|
|
32
|
+
right: 0;
|
|
33
|
+
top: 0;
|
|
34
|
+
z-index: 10;
|
|
35
|
+
font-weight: 700;
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
-webkit-transition: color .3s ease;
|
|
38
|
+
transition: color .3s ease;
|
|
39
|
+
color: rgba(0, 0, 0, 0.43);
|
|
40
|
+
outline: 0;
|
|
41
|
+
display: inline-block;
|
|
42
|
+
&:hover{
|
|
43
|
+
color: #444;
|
|
44
|
+
text-decoration: none;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
.vtx-ui-modal-maximizeIcon{
|
|
49
|
+
right: 20px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
.vtx-ui-modal-maxClass{
|
|
54
|
+
.ant-modal{
|
|
55
|
+
top: 0 !important;
|
|
56
|
+
left: 0 !important;
|
|
57
|
+
width: 100% !important;
|
|
58
|
+
height: 100% !important;
|
|
59
|
+
padding-bottom: 0 !important;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
}
|
|
62
|
+
.ant-modal-body{
|
|
63
|
+
height: e('calc(100% - 108px)') !important;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
8
|
+
|
|
9
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
10
|
+
|
|
11
|
+
var _react = require('react');
|
|
12
|
+
|
|
13
|
+
var _react2 = _interopRequireDefault(_react);
|
|
14
|
+
|
|
15
|
+
var _reactDom = require('react-dom');
|
|
16
|
+
|
|
17
|
+
var _reactDom2 = _interopRequireDefault(_reactDom);
|
|
18
|
+
|
|
19
|
+
var _modal = require('antd/lib/modal');
|
|
20
|
+
|
|
21
|
+
var _modal2 = _interopRequireDefault(_modal);
|
|
22
|
+
|
|
23
|
+
require('antd/lib/modal/style/css');
|
|
24
|
+
|
|
25
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
+
|
|
27
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
28
|
+
|
|
29
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
30
|
+
|
|
31
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
32
|
+
|
|
33
|
+
var DraggableModal = function (_React$Component) {
|
|
34
|
+
_inherits(DraggableModal, _React$Component);
|
|
35
|
+
|
|
36
|
+
function DraggableModal(props) {
|
|
37
|
+
_classCallCheck(this, DraggableModal);
|
|
38
|
+
|
|
39
|
+
var _this = _possibleConstructorReturn(this, (DraggableModal.__proto__ || Object.getPrototypeOf(DraggableModal)).call(this, props));
|
|
40
|
+
|
|
41
|
+
_this.state = {
|
|
42
|
+
init_x: 0,
|
|
43
|
+
init_y: 0,
|
|
44
|
+
x_move: 0,
|
|
45
|
+
y_move: 0
|
|
46
|
+
};
|
|
47
|
+
_this.initSucceed = false; //是否已完成初始化拖拽事件
|
|
48
|
+
_this.startDrag = _this.startDrag.bind(_this);
|
|
49
|
+
_this.initEvent = _this.initEvent.bind(_this);
|
|
50
|
+
return _this;
|
|
51
|
+
}
|
|
52
|
+
// 初始化弹框的拖拽事件
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
_createClass(DraggableModal, [{
|
|
56
|
+
key: 'initEvent',
|
|
57
|
+
value: function initEvent() {
|
|
58
|
+
if (!this.drag) return;
|
|
59
|
+
var modalHead = _reactDom2.default.findDOMNode(this.drag).parentNode.previousSibling;
|
|
60
|
+
if (modalHead.className.indexOf('ant-modal-header') !== -1) {
|
|
61
|
+
modalHead.style.cursor = 'move';
|
|
62
|
+
modalHead.onmousedown = this.startDrag;
|
|
63
|
+
this.initSucceed = true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// 开始拖拽:绑定事件
|
|
67
|
+
|
|
68
|
+
}, {
|
|
69
|
+
key: 'startDrag',
|
|
70
|
+
value: function startDrag(e) {
|
|
71
|
+
var _this2 = this;
|
|
72
|
+
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
this.setState({
|
|
75
|
+
init_x: e.clientX - this.state.x_move,
|
|
76
|
+
init_y: e.clientY - this.state.y_move
|
|
77
|
+
});
|
|
78
|
+
var mousemove = function mousemove(e) {
|
|
79
|
+
_this2.setState({
|
|
80
|
+
x_move: e.clientX - _this2.state.init_x,
|
|
81
|
+
y_move: e.clientY - _this2.state.init_y
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
var mouseup = function mouseup(e) {
|
|
85
|
+
document.removeEventListener('mousemove', mousemove);
|
|
86
|
+
document.removeEventListener('mouseup', mouseup);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
document.addEventListener('mousemove', mousemove);
|
|
90
|
+
document.addEventListener('mouseup', mouseup);
|
|
91
|
+
}
|
|
92
|
+
}, {
|
|
93
|
+
key: 'render',
|
|
94
|
+
value: function render() {
|
|
95
|
+
var _this3 = this;
|
|
96
|
+
|
|
97
|
+
var transformStyle = {
|
|
98
|
+
transform: 'translate(' + this.state.x_move + 'px,' + this.state.y_move + 'px)'
|
|
99
|
+
};
|
|
100
|
+
var props = _extends({}, this.props, {
|
|
101
|
+
style: _extends({}, this.props.style, transformStyle)
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return _react2.default.createElement(
|
|
105
|
+
_modal2.default,
|
|
106
|
+
props,
|
|
107
|
+
this.props.children,
|
|
108
|
+
_react2.default.createElement('div', { ref: function ref(elem) {
|
|
109
|
+
_this3.drag = elem;
|
|
110
|
+
} })
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
key: 'componentDidMount',
|
|
115
|
+
value: function componentDidMount() {
|
|
116
|
+
this.initEvent();
|
|
117
|
+
}
|
|
118
|
+
}, {
|
|
119
|
+
key: 'componentDidUpdate',
|
|
120
|
+
value: function componentDidUpdate() {
|
|
121
|
+
if (!this.initSucceed) {
|
|
122
|
+
this.initEvent();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: 'componentWillReceiveProps',
|
|
127
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
128
|
+
if (!this.props.visible && nextProps.visible && !nextProps.remainPosition) {
|
|
129
|
+
this.setState({
|
|
130
|
+
init_x: 0,
|
|
131
|
+
init_y: 0,
|
|
132
|
+
x_move: 0,
|
|
133
|
+
y_move: 0
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}]);
|
|
138
|
+
|
|
139
|
+
return DraggableModal;
|
|
140
|
+
}(_react2.default.Component);
|
|
141
|
+
|
|
142
|
+
exports.default = DraggableModal;
|
|
143
|
+
module.exports = exports['default'];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DraggableModal = exports.VtxModal = undefined;
|
|
7
|
+
|
|
8
|
+
var _VtxModal = require('./VtxModal');
|
|
9
|
+
|
|
10
|
+
var _VtxModal2 = _interopRequireDefault(_VtxModal);
|
|
11
|
+
|
|
12
|
+
var _draggableModal = require('./draggableModal');
|
|
13
|
+
|
|
14
|
+
var _draggableModal2 = _interopRequireDefault(_draggableModal);
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
_VtxModal2.default.DraggableModal = _draggableModal2.default;
|
|
19
|
+
|
|
20
|
+
exports.default = _VtxModal2.default;
|
|
21
|
+
exports.VtxModal = _VtxModal2.default;
|
|
22
|
+
exports.DraggableModal = _draggableModal2.default;
|