dtable-statistic 4.4.24-alpha.9 → 5.0.0-alpha.0
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/es/assets/css/dialog.css +9 -4
- package/es/components/dialog/chart-edit-dialog.js +1 -1
- package/es/components/dialog/statistic-record-dialog/index.js +4 -3
- package/es/constants/index.js +3 -498
- package/es/dashboard.js +2 -58
- package/es/index.js +56 -1
- package/es/service/chart-service.js +0 -12
- package/es/stat-list/index.js +2 -2
- package/es/stat-view/index.js +1 -1
- package/es/tabs/tab.js +17 -14
- package/package.json +3 -3
- package/es/components/dtable-popover.js +0 -97
- package/es/components/dtable-search-input.js +0 -135
- package/es/components/index.js +0 -41
- package/es/components/loading.js +0 -15
- package/es/components/modal-portal.js +0 -26
- package/es/constants/color-rules.js +0 -17
- package/es/constants/map.js +0 -13
- package/es/constants/model.js +0 -26
- package/es/constants/regions.js +0 -2111
- package/es/constants/zIndexes.js +0 -7
- package/es/service/map-json.js +0 -140
package/es/constants/zIndexes.js
DELETED
package/es/service/map-json.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MapJsonService = void 0;
|
|
7
|
-
var _map = require("../constants/map");
|
|
8
|
-
var _regions = require("../constants/regions");
|
|
9
|
-
class MapJsonService {
|
|
10
|
-
constructor(_ref) {
|
|
11
|
-
let {
|
|
12
|
-
mediaUrl
|
|
13
|
-
} = _ref;
|
|
14
|
-
this.mediaUrl = mediaUrl;
|
|
15
|
-
this.urlMapJsonQuerying = {};
|
|
16
|
-
this.urlWaitingExecCallbacks = {};
|
|
17
|
-
this.urlMapJson = {};
|
|
18
|
-
}
|
|
19
|
-
getNameEnByMapLocation(mapLocation) {
|
|
20
|
-
const provinceName = mapLocation && mapLocation.province;
|
|
21
|
-
const province = provinceName && _regions.regions.find(province => province.name === provinceName);
|
|
22
|
-
if (!province) return null;
|
|
23
|
-
let nameEN = {
|
|
24
|
-
province_name_en: province.name_en
|
|
25
|
-
};
|
|
26
|
-
const cityName = mapLocation.city;
|
|
27
|
-
const cities = province.cities;
|
|
28
|
-
const city = cityName && Array.isArray(cities) && cities.find(city => city.name === cityName);
|
|
29
|
-
if (!city) {
|
|
30
|
-
return nameEN;
|
|
31
|
-
}
|
|
32
|
-
nameEN.city_name_en = city.name_en;
|
|
33
|
-
return nameEN;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @param {string} mapLevel
|
|
38
|
-
* @param {object} mapLocation: province, city
|
|
39
|
-
* @returns part url for query map-json
|
|
40
|
-
*/
|
|
41
|
-
getMapJsonQueryUrl(mapLevel, mapLocation) {
|
|
42
|
-
switch (mapLevel) {
|
|
43
|
-
case _map.MAP_LEVEL.WORLD:
|
|
44
|
-
{
|
|
45
|
-
return 'world';
|
|
46
|
-
}
|
|
47
|
-
case _map.MAP_LEVEL.COUNTRY:
|
|
48
|
-
{
|
|
49
|
-
return 'china';
|
|
50
|
-
}
|
|
51
|
-
case _map.MAP_LEVEL.PROVINCE:
|
|
52
|
-
{
|
|
53
|
-
const nameEn = this.getNameEnByMapLocation(mapLocation);
|
|
54
|
-
const provinceNameEn = nameEn && nameEn.province_name_en;
|
|
55
|
-
if (!provinceNameEn) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
return "region-mapjson/".concat(provinceNameEn, "/").concat(provinceNameEn);
|
|
59
|
-
}
|
|
60
|
-
case _map.MAP_LEVEL.CITY:
|
|
61
|
-
{
|
|
62
|
-
const nameEn = this.getNameEnByMapLocation(mapLocation);
|
|
63
|
-
const provinceNameEn = nameEn && nameEn.province_name_en;
|
|
64
|
-
const cityNameEn = nameEn && nameEn.city_name_en;
|
|
65
|
-
if (!provinceNameEn || !cityNameEn) {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// e.g. 北京市/北京市
|
|
70
|
-
if (provinceNameEn === cityNameEn) {
|
|
71
|
-
return "region-mapjson/".concat(provinceNameEn, "/").concat(provinceNameEn);
|
|
72
|
-
}
|
|
73
|
-
return "region-mapjson/".concat(provinceNameEn, "/").concat(provinceNameEn, "_").concat(cityNameEn);
|
|
74
|
-
}
|
|
75
|
-
default:
|
|
76
|
-
{
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
getMapJson(url) {
|
|
82
|
-
return this.urlMapJson[url];
|
|
83
|
-
}
|
|
84
|
-
setMapJson(url, json) {
|
|
85
|
-
this.urlMapJson[url] = json;
|
|
86
|
-
}
|
|
87
|
-
queryMapJson(_ref2, callback) {
|
|
88
|
-
let {
|
|
89
|
-
map_level,
|
|
90
|
-
map_location
|
|
91
|
-
} = _ref2;
|
|
92
|
-
const url = this.getMapJsonQueryUrl(map_level, map_location);
|
|
93
|
-
if (!url) {
|
|
94
|
-
callback && callback();
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
const existMapJson = this.getMapJson(url);
|
|
98
|
-
if (existMapJson) {
|
|
99
|
-
callback && callback(existMapJson);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (this.urlWaitingExecCallbacks[url]) {
|
|
103
|
-
this.urlWaitingExecCallbacks[url].push(callback);
|
|
104
|
-
} else {
|
|
105
|
-
this.urlWaitingExecCallbacks[url] = [callback];
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// the target map-json is being querying
|
|
109
|
-
if (this.urlMapJsonQuerying[url]) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
this.urlMapJsonQuerying[url] = true;
|
|
113
|
-
this.startQuery(url);
|
|
114
|
-
}
|
|
115
|
-
startQuery(url) {
|
|
116
|
-
fetch("".concat(this.mediaUrl, "dtable-statistic/geolocation/").concat(url, ".json")).then(res => {
|
|
117
|
-
return res && res.json();
|
|
118
|
-
}).then(mapJson => {
|
|
119
|
-
this.handleLoadedMapJson(url, mapJson);
|
|
120
|
-
}).catch(err => {
|
|
121
|
-
// eslint-disable-next-line
|
|
122
|
-
console.log(err);
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
handleLoadedMapJson(url, mapJson) {
|
|
126
|
-
const isValid = mapJson && !mapJson.features;
|
|
127
|
-
if (isValid) {
|
|
128
|
-
this.setMapJson(url, mapJson);
|
|
129
|
-
}
|
|
130
|
-
const callbacks = this.urlWaitingExecCallbacks[url];
|
|
131
|
-
if (Array.isArray(callbacks) && callbacks.length > 0) {
|
|
132
|
-
callbacks.forEach(callback => {
|
|
133
|
-
callback && callback(mapJson);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
delete this.urlWaitingExecCallbacks[url];
|
|
137
|
-
delete this.urlMapJsonQuerying[url];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
exports.MapJsonService = MapJsonService;
|