hy-dispatch-ui-v3 0.2.55 → 0.2.57
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/components/hyMap/js/index.mjs +2 -2
- package/es/components/hyMap/map.vue.mjs +3 -3
- package/es/components/hyTable/cpns/virtualTable.vue.mjs +1 -1
- package/es/index.mjs +2 -0
- package/es/locale/en.mjs +8 -1
- package/es/locale/zh_CN.mjs +8 -1
- package/es/static/map/markercluster.js +0 -1
- package/es/utils/index.mjs +2 -0
- package/es/utils/input.mjs +120 -0
- package/es/utils/map/index.mjs +22 -8
- package/es/version.mjs +1 -1
- package/lib/components/hyMap/js/index.js +1 -1
- package/lib/components/hyMap/map.vue.js +3 -3
- package/lib/components/hyTable/cpns/virtualTable.vue.js +1 -1
- package/lib/index.js +14 -0
- package/lib/locale/en.js +8 -1
- package/lib/locale/zh_CN.js +8 -1
- package/lib/static/map/markercluster.js +0 -1
- package/lib/utils/index.js +14 -0
- package/lib/utils/input.js +130 -0
- package/lib/utils/map/index.js +22 -10
- package/lib/version.js +1 -1
- package/package.json +5 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { InitMap } from '../../../utils/map/index.mjs';
|
|
2
2
|
import { nextTick } from 'vue';
|
|
3
3
|
|
|
4
4
|
const useAppMapWrapper = (hy) => {
|
|
@@ -10,7 +10,7 @@ const useAppMapWrapper = (hy) => {
|
|
|
10
10
|
const hyMap = null;
|
|
11
11
|
const map = null;
|
|
12
12
|
function newMap(mapType) {
|
|
13
|
-
hy.hyMap = new
|
|
13
|
+
hy.hyMap = new InitMap({
|
|
14
14
|
...mapConfig,
|
|
15
15
|
mapType,
|
|
16
16
|
BM: window.BM
|
|
@@ -2,11 +2,11 @@ import { ref, onMounted, openBlock, createElementBlock, createElementVNode } fro
|
|
|
2
2
|
import { useAppMapWrapper } from './js/index.mjs';
|
|
3
3
|
import { useMixins } from '../../hooks/useMixins.mjs';
|
|
4
4
|
|
|
5
|
-
import "
|
|
5
|
+
import "../../static/map/bigemap.css";
|
|
6
6
|
|
|
7
|
-
import "
|
|
7
|
+
import "../../static/map/MarkerCluster.css";
|
|
8
8
|
|
|
9
|
-
import "
|
|
9
|
+
import "../../static/map/bmDraw.css";
|
|
10
10
|
|
|
11
11
|
const _sfc_main = {
|
|
12
12
|
__name: "map",
|
|
@@ -617,7 +617,7 @@ const _sfc_main = {
|
|
|
617
617
|
_: 2
|
|
618
618
|
/* DYNAMIC */
|
|
619
619
|
}, 1032, ["onCommand"])) : createCommentVNode("v-if", true)
|
|
620
|
-
], 40, ["onClick", "onContextmenu"])) : column.type === "default" ? (openBlock(), createElementBlock(
|
|
620
|
+
], 40, ["onClick", "onContextmenu"])) : column.type === "default" || column.type === "expand" && !_ctx.$slots[column.slot] ? (openBlock(), createElementBlock(
|
|
621
621
|
Fragment,
|
|
622
622
|
{ key: 5 },
|
|
623
623
|
[
|
package/es/index.mjs
CHANGED
|
@@ -25,6 +25,7 @@ export { HyTableActionButton } from './components/hyTableActionButton/index.mjs'
|
|
|
25
25
|
export { HyTree } from './components/hyTree/index.mjs';
|
|
26
26
|
export { HyUserAvatar } from './components/hyUserAvatar/index.mjs';
|
|
27
27
|
export { HyVideoPlayer } from './components/hyVideoPlayer/index.mjs';
|
|
28
|
+
export { InitMap, setMapServer, setPoiServer } from './utils/map/index.mjs';
|
|
28
29
|
export { PERMISSION } from './utils/permission.mjs';
|
|
29
30
|
export { base64Decrypt, encryptToBase64, generateRandomCode } from './utils/crypto.mjs';
|
|
30
31
|
export { blobToDataURL, fileFormUpload, fileJsonUplaod, fileUpload, presignedUrl, sizeToTextHandler } from './utils/file.mjs';
|
|
@@ -34,6 +35,7 @@ export { clearSpace, columnRuleHandler, genRuleRequiredMsgHandler, genValueByPro
|
|
|
34
35
|
export { cloneDeep, copyText, createUniqueId, funRunHandler, mergeDeep, withInstall } from './utils/handler.mjs';
|
|
35
36
|
export { configProviderContextKey, provideGlobalConfig, useGlobalConfig } from './hooks/useGlobalConfig.mjs';
|
|
36
37
|
export { defaultAxios, localApiKey, useApi } from './hooks/useApi.mjs';
|
|
38
|
+
export { enterNumbersRrLetters, enterTheMumber, filterSpaces, formatNumber, formatTimeFn, getPublicFileSize, inputForbidden, keepTwoDecimalPlaces, onlyNumber } from './utils/input.mjs';
|
|
37
39
|
export { formatDuration, getDefaultValueFormatByType } from './utils/date.mjs';
|
|
38
40
|
export { isArray, isBoolean, isEmpty, isFile, isFunction, isNull, isNumber, isObject, isOverflowing, isPermission, isString, isSupportH265, isSymbol, isUndefined, isVueProxy } from './utils/is.mjs';
|
|
39
41
|
export { localAudioPlayerConfigKey, useAudioPlayerConfig } from './hooks/useAudioPlayerConfig.mjs';
|
package/es/locale/en.mjs
CHANGED
|
@@ -20,7 +20,14 @@ var en = {
|
|
|
20
20
|
noData: "No Data",
|
|
21
21
|
confirm: "Confirm",
|
|
22
22
|
loading: "Loading",
|
|
23
|
-
copySuccessfully: "Copy Successfully"
|
|
23
|
+
copySuccessfully: "Copy Successfully",
|
|
24
|
+
sunday: "Sunday",
|
|
25
|
+
monday: "Monday",
|
|
26
|
+
tuesday: "Tuesday",
|
|
27
|
+
wednesday: "Wednesday",
|
|
28
|
+
thursday: "Thursday",
|
|
29
|
+
friday: "Friday",
|
|
30
|
+
saturday: "Saturday"
|
|
24
31
|
},
|
|
25
32
|
form: {
|
|
26
33
|
department: "Department",
|
package/es/locale/zh_CN.mjs
CHANGED
|
@@ -20,7 +20,14 @@ var zh_CN = {
|
|
|
20
20
|
noData: "\u6682\u65E0\u6570\u636E",
|
|
21
21
|
confirm: "\u786E\u8BA4",
|
|
22
22
|
loading: "\u52A0\u8F7D\u4E2D",
|
|
23
|
-
copySuccessfully: "\u590D\u5236\u6210\u529F"
|
|
23
|
+
copySuccessfully: "\u590D\u5236\u6210\u529F",
|
|
24
|
+
sunday: "\u661F\u671F\u65E5",
|
|
25
|
+
monday: "\u661F\u671F\u4E00",
|
|
26
|
+
tuesday: "\u661F\u671F\u4E8C",
|
|
27
|
+
wednesday: "\u661F\u671F\u4E09",
|
|
28
|
+
thursday: "\u661F\u671F\u56DB",
|
|
29
|
+
friday: "\u661F\u671F\u4E94",
|
|
30
|
+
saturday: "\u661F\u671F\u516D"
|
|
24
31
|
},
|
|
25
32
|
form: {
|
|
26
33
|
department: "\u6240\u5C5E\u90E8\u95E8",
|
package/es/utils/index.mjs
CHANGED
|
@@ -5,4 +5,6 @@ export { cloneDeep, copyText, createUniqueId, funRunHandler, mergeDeep, withInst
|
|
|
5
5
|
export { formatDuration, getDefaultValueFormatByType } from './date.mjs';
|
|
6
6
|
export { blobToDataURL, fileFormUpload, fileJsonUplaod, fileUpload, presignedUrl, sizeToTextHandler } from './file.mjs';
|
|
7
7
|
export { clearSpace, columnRuleHandler, genRuleRequiredMsgHandler, genValueByProp, getValueByProp, setValueByProp } from './form.mjs';
|
|
8
|
+
export { enterNumbersRrLetters, enterTheMumber, filterSpaces, formatNumber, formatTimeFn, getPublicFileSize, inputForbidden, keepTwoDecimalPlaces, onlyNumber } from './input.mjs';
|
|
8
9
|
export { PERMISSION } from './permission.mjs';
|
|
10
|
+
export { InitMap, setMapServer, setPoiServer } from './map/index.mjs';
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useLocale } from '../hooks/useLocale.mjs';
|
|
2
|
+
|
|
3
|
+
function formatNumber(n) {
|
|
4
|
+
n = n.toString();
|
|
5
|
+
return n[1] ? n : "0" + n;
|
|
6
|
+
}
|
|
7
|
+
function formatTimeFn(number, format) {
|
|
8
|
+
const time = new Date(number);
|
|
9
|
+
const newArr = [];
|
|
10
|
+
const formatArr = ["Y", "M", "D", "day", "h", "m", "s"];
|
|
11
|
+
const { t } = useLocale();
|
|
12
|
+
const arrWeek = [
|
|
13
|
+
t("hy.sunday"),
|
|
14
|
+
t("hy.monday"),
|
|
15
|
+
t("hy.tuesday"),
|
|
16
|
+
t("hy.wednesday"),
|
|
17
|
+
t("hy.thursday"),
|
|
18
|
+
t("hy.friday"),
|
|
19
|
+
t("hy.saturday")
|
|
20
|
+
];
|
|
21
|
+
newArr.push(time.getFullYear());
|
|
22
|
+
newArr.push(formatNumber(time.getMonth() + 1));
|
|
23
|
+
newArr.push(formatNumber(time.getHours()));
|
|
24
|
+
newArr.push(arrWeek[time.getDay()]);
|
|
25
|
+
newArr.push(formatNumber(time.getDate()));
|
|
26
|
+
newArr.push(formatNumber(time.getMinutes()));
|
|
27
|
+
newArr.push(formatNumber(time.getSeconds()));
|
|
28
|
+
newArr.push(formatNumber(time.getDay()));
|
|
29
|
+
for (const i in newArr) {
|
|
30
|
+
format = format.replace(formatArr[i], newArr[i]);
|
|
31
|
+
}
|
|
32
|
+
return format;
|
|
33
|
+
}
|
|
34
|
+
function enterNumbersRrLetters(row, name, content) {
|
|
35
|
+
var replace = /[^\w]/g;
|
|
36
|
+
if (content === 1) {
|
|
37
|
+
replace = /[^\da-z]/g;
|
|
38
|
+
}
|
|
39
|
+
if (row[name] && row[name].length !== 0 && row[name] !== null) {
|
|
40
|
+
row[name] += "";
|
|
41
|
+
row[name] = row[name].replace(replace, "");
|
|
42
|
+
row[name] = row[name].replace(".", "");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function enterTheMumber(row, name) {
|
|
46
|
+
if (row[name] && row[name].length !== 0 && row[name] !== null) {
|
|
47
|
+
row[name] += "";
|
|
48
|
+
row[name] = row[name].replace(/[^\.\d]/g, "");
|
|
49
|
+
row[name] = row[name].replace(".", "");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function keepTwoDecimalPlaces(value) {
|
|
53
|
+
const num = Math.round(parseFloat(value) * 100) / 100;
|
|
54
|
+
const parts = num.toString().split(".");
|
|
55
|
+
if (parts.length === 1) return num + ".00";
|
|
56
|
+
if (parts[1].length < 2) return num + "0";
|
|
57
|
+
return num.toString();
|
|
58
|
+
}
|
|
59
|
+
function filterSpaces(row, name) {
|
|
60
|
+
if (typeof row === "string") {
|
|
61
|
+
this[row] = this[row].toString().replace(/[`\s]/g, "");
|
|
62
|
+
} else {
|
|
63
|
+
if (row[name] && row[name].length !== 0 && row[name] !== null) {
|
|
64
|
+
row[name] += "";
|
|
65
|
+
row[name] = row[name].replace(/[` ]/g, "");
|
|
66
|
+
row[name] = row[name].replace(/\s/g, "");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function inputForbidden(row, name, content) {
|
|
71
|
+
var replace = /[`~!@#$%^&+=<>?:"{}|,./;'\\[\]·~!@#¥%……&+={}|《》?:“”【】、;‘’,。、]/g;
|
|
72
|
+
if (content === 1) {
|
|
73
|
+
replace = /[`~!@#$%^&+=<>?:"{}|,/;'\\[\]·~!@#¥%……&+={}|《》?:“”【】、;‘’,。、]/g;
|
|
74
|
+
}
|
|
75
|
+
if (row[name] && row[name].length && row[name] !== null) {
|
|
76
|
+
row[name] += "";
|
|
77
|
+
row[name] = row[name].replace(replace, "");
|
|
78
|
+
row[name] = row[name].replace(/\s/g, "");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function onlyNumber(row, name, type) {
|
|
82
|
+
if (row[name] && row[name].length && row[name] !== null) {
|
|
83
|
+
row[name] += "";
|
|
84
|
+
var t = row[name].charAt(0);
|
|
85
|
+
row[name] = row[name].replace(/[^\d\.]/g, "");
|
|
86
|
+
row[name] = row[name].replace(/^\./g, "");
|
|
87
|
+
row[name] = row[name].replace(/\.{2,}/g, ".");
|
|
88
|
+
row[name] = row[name].replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
|
|
89
|
+
if (type !== 1) {
|
|
90
|
+
if (t === "-") {
|
|
91
|
+
row[name] = "-" + row[name];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function getPublicFileSize(size) {
|
|
97
|
+
if (size) {
|
|
98
|
+
if (size < 1024) {
|
|
99
|
+
return size.toFixed(3) + "B";
|
|
100
|
+
}
|
|
101
|
+
size /= 1024;
|
|
102
|
+
if (size < 1024) {
|
|
103
|
+
return size.toFixed(3) + "KB";
|
|
104
|
+
}
|
|
105
|
+
size /= 1024;
|
|
106
|
+
if (size < 1024) {
|
|
107
|
+
return size.toFixed(3) + "MB";
|
|
108
|
+
}
|
|
109
|
+
size /= 1024;
|
|
110
|
+
if (size < 1024) {
|
|
111
|
+
return size.toFixed(3) + "GB";
|
|
112
|
+
}
|
|
113
|
+
size /= 1024;
|
|
114
|
+
return size.toFixed(3) + "TB";
|
|
115
|
+
} else {
|
|
116
|
+
return "/";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { enterNumbersRrLetters, enterTheMumber, filterSpaces, formatNumber, formatTimeFn, getPublicFileSize, inputForbidden, keepTwoDecimalPlaces, onlyNumber };
|
package/es/utils/map/index.mjs
CHANGED
|
@@ -27,7 +27,20 @@ const staticAssets = {
|
|
|
27
27
|
).href,
|
|
28
28
|
"moveMarker.js": new URL("../../static/map/moveMarker.js", import.meta.url).href
|
|
29
29
|
};
|
|
30
|
-
const
|
|
30
|
+
const normalizeStaticBaseUrl = (baseUrl) => {
|
|
31
|
+
return baseUrl.replace(/\/+$/, "");
|
|
32
|
+
};
|
|
33
|
+
const getPackageStaticBaseUrl = () => {
|
|
34
|
+
if (/\/node_modules\//.test(import.meta.url)) {
|
|
35
|
+
return "/node_modules/hy-dispatch-ui-v3/es/static/map";
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
const staticUrl = (file, baseUrl) => {
|
|
40
|
+
const configuredBaseUrl = baseUrl || globalThis.__HY_DISPATCH_UI_STATIC_URL__ || getPackageStaticBaseUrl();
|
|
41
|
+
if (configuredBaseUrl) {
|
|
42
|
+
return `${normalizeStaticBaseUrl(configuredBaseUrl)}/${file}`;
|
|
43
|
+
}
|
|
31
44
|
const url = staticAssets[file];
|
|
32
45
|
if (!url) {
|
|
33
46
|
throw new Error(`Unknown map asset: ${file}`);
|
|
@@ -49,12 +62,13 @@ function setMapServer(mapType, mapConfig = {}) {
|
|
|
49
62
|
}
|
|
50
63
|
const promise = (async () => {
|
|
51
64
|
if (mapType === "bigMap") {
|
|
52
|
-
|
|
65
|
+
const staticBaseUrl = mapConfig.staticBaseUrl;
|
|
66
|
+
await loadScript(staticUrl("bigemap.js", staticBaseUrl));
|
|
53
67
|
await Promise.all([
|
|
54
|
-
loadScript(staticUrl("markercluster.js")),
|
|
55
|
-
loadScript(staticUrl("bmDraw.js")),
|
|
56
|
-
loadScript(staticUrl("bm.geometryutil.js")),
|
|
57
|
-
loadScript(staticUrl("moveMarker.js"))
|
|
68
|
+
loadScript(staticUrl("markercluster.js", staticBaseUrl)),
|
|
69
|
+
loadScript(staticUrl("bmDraw.js", staticBaseUrl)),
|
|
70
|
+
loadScript(staticUrl("bm.geometryutil.js", staticBaseUrl)),
|
|
71
|
+
loadScript(staticUrl("moveMarker.js", staticBaseUrl))
|
|
58
72
|
]);
|
|
59
73
|
bmInit();
|
|
60
74
|
return;
|
|
@@ -141,7 +155,7 @@ function bmInit() {
|
|
|
141
155
|
});
|
|
142
156
|
})();
|
|
143
157
|
}
|
|
144
|
-
class
|
|
158
|
+
class InitMap extends EventEmitter {
|
|
145
159
|
constructor(request) {
|
|
146
160
|
super();
|
|
147
161
|
this.map = null;
|
|
@@ -288,4 +302,4 @@ class Map extends EventEmitter {
|
|
|
288
302
|
}
|
|
289
303
|
}
|
|
290
304
|
|
|
291
|
-
export {
|
|
305
|
+
export { InitMap, setMapServer, setPoiServer };
|
package/es/version.mjs
CHANGED
|
@@ -6,11 +6,11 @@ var vue = require('vue');
|
|
|
6
6
|
var index = require('./js/index.js');
|
|
7
7
|
var useMixins = require('../../hooks/useMixins.js');
|
|
8
8
|
|
|
9
|
-
import "
|
|
9
|
+
import "../../static/map/bigemap.css";
|
|
10
10
|
|
|
11
|
-
import "
|
|
11
|
+
import "../../static/map/MarkerCluster.css";
|
|
12
12
|
|
|
13
|
-
import "
|
|
13
|
+
import "../../static/map/bmDraw.css";
|
|
14
14
|
|
|
15
15
|
const _sfc_main = {
|
|
16
16
|
__name: "map",
|
|
@@ -621,7 +621,7 @@ const _sfc_main = {
|
|
|
621
621
|
_: 2
|
|
622
622
|
/* DYNAMIC */
|
|
623
623
|
}, 1032, ["onCommand"])) : vue.createCommentVNode("v-if", true)
|
|
624
|
-
], 40, ["onClick", "onContextmenu"])) : column.type === "default" ? (vue.openBlock(), vue.createElementBlock(
|
|
624
|
+
], 40, ["onClick", "onContextmenu"])) : column.type === "default" || column.type === "expand" && !_ctx.$slots[column.slot] ? (vue.openBlock(), vue.createElementBlock(
|
|
625
625
|
vue.Fragment,
|
|
626
626
|
{ key: 5 },
|
|
627
627
|
[
|
package/lib/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var index$m = require('./components/hyTableActionButton/index.js');
|
|
|
29
29
|
var index$n = require('./components/hyTree/index.js');
|
|
30
30
|
var index$o = require('./components/hyUserAvatar/index.js');
|
|
31
31
|
var index$p = require('./components/hyVideoPlayer/index.js');
|
|
32
|
+
var index$q = require('./utils/map/index.js');
|
|
32
33
|
var permission = require('./utils/permission.js');
|
|
33
34
|
var crypto = require('./utils/crypto.js');
|
|
34
35
|
var file = require('./utils/file.js');
|
|
@@ -38,6 +39,7 @@ var form = require('./utils/form.js');
|
|
|
38
39
|
var handler = require('./utils/handler.js');
|
|
39
40
|
var useGlobalConfig = require('./hooks/useGlobalConfig.js');
|
|
40
41
|
var useApi = require('./hooks/useApi.js');
|
|
42
|
+
var input = require('./utils/input.js');
|
|
41
43
|
var date = require('./utils/date.js');
|
|
42
44
|
var is = require('./utils/is.js');
|
|
43
45
|
var useAudioPlayerConfig = require('./hooks/useAudioPlayerConfig.js');
|
|
@@ -91,6 +93,9 @@ exports.HyTableActionButton = index$m.HyTableActionButton;
|
|
|
91
93
|
exports.HyTree = index$n.HyTree;
|
|
92
94
|
exports.HyUserAvatar = index$o.HyUserAvatar;
|
|
93
95
|
exports.HyVideoPlayer = index$p.HyVideoPlayer;
|
|
96
|
+
exports.InitMap = index$q.InitMap;
|
|
97
|
+
exports.setMapServer = index$q.setMapServer;
|
|
98
|
+
exports.setPoiServer = index$q.setPoiServer;
|
|
94
99
|
exports.PERMISSION = permission.PERMISSION;
|
|
95
100
|
exports.base64Decrypt = crypto.base64Decrypt;
|
|
96
101
|
exports.encryptToBase64 = crypto.encryptToBase64;
|
|
@@ -127,6 +132,15 @@ exports.useGlobalConfig = useGlobalConfig.useGlobalConfig;
|
|
|
127
132
|
exports.defaultAxios = useApi.defaultAxios;
|
|
128
133
|
exports.localApiKey = useApi.localApiKey;
|
|
129
134
|
exports.useApi = useApi.useApi;
|
|
135
|
+
exports.enterNumbersRrLetters = input.enterNumbersRrLetters;
|
|
136
|
+
exports.enterTheMumber = input.enterTheMumber;
|
|
137
|
+
exports.filterSpaces = input.filterSpaces;
|
|
138
|
+
exports.formatNumber = input.formatNumber;
|
|
139
|
+
exports.formatTimeFn = input.formatTimeFn;
|
|
140
|
+
exports.getPublicFileSize = input.getPublicFileSize;
|
|
141
|
+
exports.inputForbidden = input.inputForbidden;
|
|
142
|
+
exports.keepTwoDecimalPlaces = input.keepTwoDecimalPlaces;
|
|
143
|
+
exports.onlyNumber = input.onlyNumber;
|
|
130
144
|
exports.formatDuration = date.formatDuration;
|
|
131
145
|
exports.getDefaultValueFormatByType = date.getDefaultValueFormatByType;
|
|
132
146
|
exports.isArray = is.isArray;
|
package/lib/locale/en.js
CHANGED
|
@@ -24,7 +24,14 @@ var en = {
|
|
|
24
24
|
noData: "No Data",
|
|
25
25
|
confirm: "Confirm",
|
|
26
26
|
loading: "Loading",
|
|
27
|
-
copySuccessfully: "Copy Successfully"
|
|
27
|
+
copySuccessfully: "Copy Successfully",
|
|
28
|
+
sunday: "Sunday",
|
|
29
|
+
monday: "Monday",
|
|
30
|
+
tuesday: "Tuesday",
|
|
31
|
+
wednesday: "Wednesday",
|
|
32
|
+
thursday: "Thursday",
|
|
33
|
+
friday: "Friday",
|
|
34
|
+
saturday: "Saturday"
|
|
28
35
|
},
|
|
29
36
|
form: {
|
|
30
37
|
department: "Department",
|
package/lib/locale/zh_CN.js
CHANGED
|
@@ -24,7 +24,14 @@ var zh_CN = {
|
|
|
24
24
|
noData: "\u6682\u65E0\u6570\u636E",
|
|
25
25
|
confirm: "\u786E\u8BA4",
|
|
26
26
|
loading: "\u52A0\u8F7D\u4E2D",
|
|
27
|
-
copySuccessfully: "\u590D\u5236\u6210\u529F"
|
|
27
|
+
copySuccessfully: "\u590D\u5236\u6210\u529F",
|
|
28
|
+
sunday: "\u661F\u671F\u65E5",
|
|
29
|
+
monday: "\u661F\u671F\u4E00",
|
|
30
|
+
tuesday: "\u661F\u671F\u4E8C",
|
|
31
|
+
wednesday: "\u661F\u671F\u4E09",
|
|
32
|
+
thursday: "\u661F\u671F\u56DB",
|
|
33
|
+
friday: "\u661F\u671F\u4E94",
|
|
34
|
+
saturday: "\u661F\u671F\u516D"
|
|
28
35
|
},
|
|
29
36
|
form: {
|
|
30
37
|
department: "\u6240\u5C5E\u90E8\u95E8",
|
package/lib/utils/index.js
CHANGED
|
@@ -7,7 +7,9 @@ var handler = require('./handler.js');
|
|
|
7
7
|
var date = require('./date.js');
|
|
8
8
|
var file = require('./file.js');
|
|
9
9
|
var form = require('./form.js');
|
|
10
|
+
var input = require('./input.js');
|
|
10
11
|
var permission = require('./permission.js');
|
|
12
|
+
var index = require('./map/index.js');
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
|
|
@@ -53,4 +55,16 @@ exports.genRuleRequiredMsgHandler = form.genRuleRequiredMsgHandler;
|
|
|
53
55
|
exports.genValueByProp = form.genValueByProp;
|
|
54
56
|
exports.getValueByProp = form.getValueByProp;
|
|
55
57
|
exports.setValueByProp = form.setValueByProp;
|
|
58
|
+
exports.enterNumbersRrLetters = input.enterNumbersRrLetters;
|
|
59
|
+
exports.enterTheMumber = input.enterTheMumber;
|
|
60
|
+
exports.filterSpaces = input.filterSpaces;
|
|
61
|
+
exports.formatNumber = input.formatNumber;
|
|
62
|
+
exports.formatTimeFn = input.formatTimeFn;
|
|
63
|
+
exports.getPublicFileSize = input.getPublicFileSize;
|
|
64
|
+
exports.inputForbidden = input.inputForbidden;
|
|
65
|
+
exports.keepTwoDecimalPlaces = input.keepTwoDecimalPlaces;
|
|
66
|
+
exports.onlyNumber = input.onlyNumber;
|
|
56
67
|
exports.PERMISSION = permission.PERMISSION;
|
|
68
|
+
exports.InitMap = index.InitMap;
|
|
69
|
+
exports.setMapServer = index.setMapServer;
|
|
70
|
+
exports.setPoiServer = index.setPoiServer;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var useLocale = require('../hooks/useLocale.js');
|
|
4
|
+
|
|
5
|
+
function formatNumber(n) {
|
|
6
|
+
n = n.toString();
|
|
7
|
+
return n[1] ? n : "0" + n;
|
|
8
|
+
}
|
|
9
|
+
function formatTimeFn(number, format) {
|
|
10
|
+
const time = new Date(number);
|
|
11
|
+
const newArr = [];
|
|
12
|
+
const formatArr = ["Y", "M", "D", "day", "h", "m", "s"];
|
|
13
|
+
const { t } = useLocale.useLocale();
|
|
14
|
+
const arrWeek = [
|
|
15
|
+
t("hy.sunday"),
|
|
16
|
+
t("hy.monday"),
|
|
17
|
+
t("hy.tuesday"),
|
|
18
|
+
t("hy.wednesday"),
|
|
19
|
+
t("hy.thursday"),
|
|
20
|
+
t("hy.friday"),
|
|
21
|
+
t("hy.saturday")
|
|
22
|
+
];
|
|
23
|
+
newArr.push(time.getFullYear());
|
|
24
|
+
newArr.push(formatNumber(time.getMonth() + 1));
|
|
25
|
+
newArr.push(formatNumber(time.getHours()));
|
|
26
|
+
newArr.push(arrWeek[time.getDay()]);
|
|
27
|
+
newArr.push(formatNumber(time.getDate()));
|
|
28
|
+
newArr.push(formatNumber(time.getMinutes()));
|
|
29
|
+
newArr.push(formatNumber(time.getSeconds()));
|
|
30
|
+
newArr.push(formatNumber(time.getDay()));
|
|
31
|
+
for (const i in newArr) {
|
|
32
|
+
format = format.replace(formatArr[i], newArr[i]);
|
|
33
|
+
}
|
|
34
|
+
return format;
|
|
35
|
+
}
|
|
36
|
+
function enterNumbersRrLetters(row, name, content) {
|
|
37
|
+
var replace = /[^\w]/g;
|
|
38
|
+
if (content === 1) {
|
|
39
|
+
replace = /[^\da-z]/g;
|
|
40
|
+
}
|
|
41
|
+
if (row[name] && row[name].length !== 0 && row[name] !== null) {
|
|
42
|
+
row[name] += "";
|
|
43
|
+
row[name] = row[name].replace(replace, "");
|
|
44
|
+
row[name] = row[name].replace(".", "");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function enterTheMumber(row, name) {
|
|
48
|
+
if (row[name] && row[name].length !== 0 && row[name] !== null) {
|
|
49
|
+
row[name] += "";
|
|
50
|
+
row[name] = row[name].replace(/[^\.\d]/g, "");
|
|
51
|
+
row[name] = row[name].replace(".", "");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function keepTwoDecimalPlaces(value) {
|
|
55
|
+
const num = Math.round(parseFloat(value) * 100) / 100;
|
|
56
|
+
const parts = num.toString().split(".");
|
|
57
|
+
if (parts.length === 1) return num + ".00";
|
|
58
|
+
if (parts[1].length < 2) return num + "0";
|
|
59
|
+
return num.toString();
|
|
60
|
+
}
|
|
61
|
+
function filterSpaces(row, name) {
|
|
62
|
+
if (typeof row === "string") {
|
|
63
|
+
this[row] = this[row].toString().replace(/[`\s]/g, "");
|
|
64
|
+
} else {
|
|
65
|
+
if (row[name] && row[name].length !== 0 && row[name] !== null) {
|
|
66
|
+
row[name] += "";
|
|
67
|
+
row[name] = row[name].replace(/[` ]/g, "");
|
|
68
|
+
row[name] = row[name].replace(/\s/g, "");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function inputForbidden(row, name, content) {
|
|
73
|
+
var replace = /[`~!@#$%^&+=<>?:"{}|,./;'\\[\]·~!@#¥%……&+={}|《》?:“”【】、;‘’,。、]/g;
|
|
74
|
+
if (content === 1) {
|
|
75
|
+
replace = /[`~!@#$%^&+=<>?:"{}|,/;'\\[\]·~!@#¥%……&+={}|《》?:“”【】、;‘’,。、]/g;
|
|
76
|
+
}
|
|
77
|
+
if (row[name] && row[name].length && row[name] !== null) {
|
|
78
|
+
row[name] += "";
|
|
79
|
+
row[name] = row[name].replace(replace, "");
|
|
80
|
+
row[name] = row[name].replace(/\s/g, "");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function onlyNumber(row, name, type) {
|
|
84
|
+
if (row[name] && row[name].length && row[name] !== null) {
|
|
85
|
+
row[name] += "";
|
|
86
|
+
var t = row[name].charAt(0);
|
|
87
|
+
row[name] = row[name].replace(/[^\d\.]/g, "");
|
|
88
|
+
row[name] = row[name].replace(/^\./g, "");
|
|
89
|
+
row[name] = row[name].replace(/\.{2,}/g, ".");
|
|
90
|
+
row[name] = row[name].replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
|
|
91
|
+
if (type !== 1) {
|
|
92
|
+
if (t === "-") {
|
|
93
|
+
row[name] = "-" + row[name];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function getPublicFileSize(size) {
|
|
99
|
+
if (size) {
|
|
100
|
+
if (size < 1024) {
|
|
101
|
+
return size.toFixed(3) + "B";
|
|
102
|
+
}
|
|
103
|
+
size /= 1024;
|
|
104
|
+
if (size < 1024) {
|
|
105
|
+
return size.toFixed(3) + "KB";
|
|
106
|
+
}
|
|
107
|
+
size /= 1024;
|
|
108
|
+
if (size < 1024) {
|
|
109
|
+
return size.toFixed(3) + "MB";
|
|
110
|
+
}
|
|
111
|
+
size /= 1024;
|
|
112
|
+
if (size < 1024) {
|
|
113
|
+
return size.toFixed(3) + "GB";
|
|
114
|
+
}
|
|
115
|
+
size /= 1024;
|
|
116
|
+
return size.toFixed(3) + "TB";
|
|
117
|
+
} else {
|
|
118
|
+
return "/";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
exports.enterNumbersRrLetters = enterNumbersRrLetters;
|
|
123
|
+
exports.enterTheMumber = enterTheMumber;
|
|
124
|
+
exports.filterSpaces = filterSpaces;
|
|
125
|
+
exports.formatNumber = formatNumber;
|
|
126
|
+
exports.formatTimeFn = formatTimeFn;
|
|
127
|
+
exports.getPublicFileSize = getPublicFileSize;
|
|
128
|
+
exports.inputForbidden = inputForbidden;
|
|
129
|
+
exports.keepTwoDecimalPlaces = keepTwoDecimalPlaces;
|
|
130
|
+
exports.onlyNumber = onlyNumber;
|
package/lib/utils/map/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var gaode = require('./hook/gaode.js');
|
|
6
4
|
var leafletjs = require('./hook/leafletjs.js');
|
|
7
5
|
var bigMap = require('./hook/bigMap.js');
|
|
@@ -32,7 +30,20 @@ const staticAssets = {
|
|
|
32
30
|
).href,
|
|
33
31
|
"moveMarker.js": new URL("../../static/map/moveMarker.js", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('utils/map/index.js', document.baseURI).href))).href
|
|
34
32
|
};
|
|
35
|
-
const
|
|
33
|
+
const normalizeStaticBaseUrl = (baseUrl) => {
|
|
34
|
+
return baseUrl.replace(/\/+$/, "");
|
|
35
|
+
};
|
|
36
|
+
const getPackageStaticBaseUrl = () => {
|
|
37
|
+
if (/\/node_modules\//.test((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('utils/map/index.js', document.baseURI).href)))) {
|
|
38
|
+
return "/node_modules/hy-dispatch-ui-v3/es/static/map";
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
};
|
|
42
|
+
const staticUrl = (file, baseUrl) => {
|
|
43
|
+
const configuredBaseUrl = baseUrl || globalThis.__HY_DISPATCH_UI_STATIC_URL__ || getPackageStaticBaseUrl();
|
|
44
|
+
if (configuredBaseUrl) {
|
|
45
|
+
return `${normalizeStaticBaseUrl(configuredBaseUrl)}/${file}`;
|
|
46
|
+
}
|
|
36
47
|
const url = staticAssets[file];
|
|
37
48
|
if (!url) {
|
|
38
49
|
throw new Error(`Unknown map asset: ${file}`);
|
|
@@ -54,12 +65,13 @@ function setMapServer(mapType, mapConfig = {}) {
|
|
|
54
65
|
}
|
|
55
66
|
const promise = (async () => {
|
|
56
67
|
if (mapType === "bigMap") {
|
|
57
|
-
|
|
68
|
+
const staticBaseUrl = mapConfig.staticBaseUrl;
|
|
69
|
+
await loadScript(staticUrl("bigemap.js", staticBaseUrl));
|
|
58
70
|
await Promise.all([
|
|
59
|
-
loadScript(staticUrl("markercluster.js")),
|
|
60
|
-
loadScript(staticUrl("bmDraw.js")),
|
|
61
|
-
loadScript(staticUrl("bm.geometryutil.js")),
|
|
62
|
-
loadScript(staticUrl("moveMarker.js"))
|
|
71
|
+
loadScript(staticUrl("markercluster.js", staticBaseUrl)),
|
|
72
|
+
loadScript(staticUrl("bmDraw.js", staticBaseUrl)),
|
|
73
|
+
loadScript(staticUrl("bm.geometryutil.js", staticBaseUrl)),
|
|
74
|
+
loadScript(staticUrl("moveMarker.js", staticBaseUrl))
|
|
63
75
|
]);
|
|
64
76
|
bmInit();
|
|
65
77
|
return;
|
|
@@ -146,7 +158,7 @@ function bmInit() {
|
|
|
146
158
|
});
|
|
147
159
|
})();
|
|
148
160
|
}
|
|
149
|
-
class
|
|
161
|
+
class InitMap extends events.EventEmitter {
|
|
150
162
|
constructor(request) {
|
|
151
163
|
super();
|
|
152
164
|
this.map = null;
|
|
@@ -293,6 +305,6 @@ class Map extends events.EventEmitter {
|
|
|
293
305
|
}
|
|
294
306
|
}
|
|
295
307
|
|
|
296
|
-
exports.
|
|
308
|
+
exports.InitMap = InitMap;
|
|
297
309
|
exports.setMapServer = setMapServer;
|
|
298
310
|
exports.setPoiServer = setPoiServer;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hy-dispatch-ui-v3",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.57",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "es/index.mjs",
|
|
6
6
|
"scripts": {
|
|
@@ -141,6 +141,10 @@
|
|
|
141
141
|
"import": "./es/style/theme.scss",
|
|
142
142
|
"require": "./lib/style/theme.scss"
|
|
143
143
|
},
|
|
144
|
+
"./utils/map": {
|
|
145
|
+
"import": "./es/utils/map/index.mjs",
|
|
146
|
+
"require": "./lib/utils/map/index.js"
|
|
147
|
+
},
|
|
144
148
|
"./static": {
|
|
145
149
|
"import": "./es/static/index.js",
|
|
146
150
|
"require": "./lib/static/index.js"
|