sirius-common-utils 1.0.0 → 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/.eslintrc.cjs +20 -0
- package/.idea/js-common-utils.iml +9 -0
- package/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/dist/common-utils.js +4787 -0
- package/dist/common-utils.umd.cjs +27 -0
- package/index.js +1 -0
- package/package.json +17 -14
- package/vite.config.js +23 -0
- package/dist/index.js +0 -35
- package/dist/utils/AppUtils.js +0 -139
- package/dist/utils/AxiosUtils.js +0 -555
- package/dist/utils/CfgUtils.js +0 -25
- package/dist/utils/DateUtils.js +0 -193
- package/dist/utils/DomUtils.js +0 -50
- package/dist/utils/ExplorerTypeUtils.js +0 -48
- package/dist/utils/FormUtils.js +0 -128
- package/dist/utils/JsonUtils.js +0 -23
- package/dist/utils/LoginUserUtils.js +0 -169
- package/dist/utils/NumberUtils.js +0 -57
- package/dist/utils/SignatureUtils.js +0 -160
- package/dist/utils/StringUtils.js +0 -20
- package/src/packages/index.js +0 -29
- package/src/packages/utils/AppUtils.js +0 -155
- package/src/packages/utils/AxiosUtils.js +0 -433
- package/src/packages/utils/CfgUtils.js +0 -15
- package/src/packages/utils/DateUtils.js +0 -223
- package/src/packages/utils/DomUtils.js +0 -48
- package/src/packages/utils/ExplorerTypeUtils.js +0 -60
- package/src/packages/utils/FormUtils.js +0 -92
- package/src/packages/utils/JsonUtils.js +0 -21
- package/src/packages/utils/LoginUserUtils.js +0 -105
- package/src/packages/utils/NumberUtils.js +0 -60
- package/src/packages/utils/SignatureUtils.js +0 -132
- package/src/packages/utils/StringUtils.js +0 -17
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
function isIOS() {
|
|
2
|
-
return [
|
|
3
|
-
'iPad Simulator',
|
|
4
|
-
'iPhone Simulator',
|
|
5
|
-
'iPod Simulator',
|
|
6
|
-
'iPad',
|
|
7
|
-
'iPhone',
|
|
8
|
-
'iPod'
|
|
9
|
-
].includes(navigator.platform) || (navigator.userAgent.includes("Mac") && "ontouchend" in document)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function isDesktopChrome() {
|
|
13
|
-
let result = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
|
|
14
|
-
if (!result) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (isMobileChrome()) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function isMobileChrome() {
|
|
26
|
-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function isMobileDevice() {
|
|
30
|
-
return isIOS() || isMobileChrome();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function updateViewPort(pOptions = {}) {
|
|
34
|
-
let viewport = document.getElementsByName("viewport");
|
|
35
|
-
if (!viewport || viewport.length != 1) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let options = {};
|
|
40
|
-
_.merge(options, defaultOptions, pOptions);
|
|
41
|
-
|
|
42
|
-
let content = [];
|
|
43
|
-
_.each(options, (value, key) => {
|
|
44
|
-
content.push(key + "=" + value);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
viewport[0].content = _.join(content, ",");
|
|
48
|
-
|
|
49
|
-
console.debug("curr viewport is: " + viewport[0].content);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default {
|
|
53
|
-
isIOS: isIOS,
|
|
54
|
-
isDesktopChrome: isDesktopChrome,
|
|
55
|
-
isMobileChrome: isMobileChrome,
|
|
56
|
-
|
|
57
|
-
isMobileDevice: isMobileDevice,
|
|
58
|
-
|
|
59
|
-
updateViewPort: updateViewPort,
|
|
60
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React, {useEffect, useRef, useState, createContext, useContext} from 'react';
|
|
2
|
-
import _ from "lodash";
|
|
3
|
-
|
|
4
|
-
let globalDialogUtils;
|
|
5
|
-
|
|
6
|
-
function init(pDialogInstanceUtils) {
|
|
7
|
-
globalDialogUtils = pDialogInstanceUtils;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function toFormData(keyPrefix, model, ignoreKeys = [], formData = {}) {
|
|
11
|
-
if(model == null){
|
|
12
|
-
return {
|
|
13
|
-
keyPrefix: null
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
_.each(_.keys(model), (attr) => {
|
|
18
|
-
let value = model[attr];
|
|
19
|
-
let formKeyPath = keyPrefix ? keyPrefix + "#" + attr : attr;
|
|
20
|
-
|
|
21
|
-
if(_.includes(ignoreKeys, formKeyPath)){
|
|
22
|
-
formData[formKeyPath] = value;
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (_.isPlainObject(value)) {
|
|
27
|
-
toFormData(formKeyPath, value, ignoreKeys, formData);
|
|
28
|
-
} else {
|
|
29
|
-
formData[formKeyPath] = value;
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
return formData;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function toModel(formData, ignoreKeys = []) {
|
|
37
|
-
if(formData == null){
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let model = {};
|
|
42
|
-
_.each(_.keys(formData), (formKeyPath) => {
|
|
43
|
-
let value = formData[formKeyPath];
|
|
44
|
-
let path = formKeyPath.replaceAll("#", ".");
|
|
45
|
-
_.set(model, path, value);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
return model;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function scrollToFirstError(ex){
|
|
52
|
-
const isError = document.getElementsByClassName('ant-form-item-has-error');
|
|
53
|
-
isError[0] && isError[0].scrollIntoView();
|
|
54
|
-
console.error(ex);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* show leave message when exit from a modified form page
|
|
59
|
-
* @param formOrCheckFormDirtyFunc AntDesignForm or checkFormDirtyFunction
|
|
60
|
-
* @returns {Promise<boolean>} true: can exit, or: abort exit
|
|
61
|
-
*/
|
|
62
|
-
async function confirmOfLeavingForm(formOrCheckFormDirtyFunc) {
|
|
63
|
-
if(formOrCheckFormDirtyFunc == null){
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
let formDirty = true;
|
|
67
|
-
if (typeof formOrCheckFormDirtyFunc === 'function') {
|
|
68
|
-
formDirty = await formOrCheckFormDirtyFunc();
|
|
69
|
-
}else{
|
|
70
|
-
formDirty = formOrCheckFormDirtyFunc.isFieldsTouched();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (formDirty) {
|
|
74
|
-
let result = await globalDialogUtils.showConfirmDialog(leaveMessage);
|
|
75
|
-
if (result !== true) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const leaveMessage = "Do you want to give up your modification?";
|
|
83
|
-
export default {
|
|
84
|
-
init: init,
|
|
85
|
-
|
|
86
|
-
toFormData: toFormData,
|
|
87
|
-
toModel: toModel,
|
|
88
|
-
scrollToFirstError: scrollToFirstError,
|
|
89
|
-
|
|
90
|
-
confirmOfLeavingForm: confirmOfLeavingForm,
|
|
91
|
-
leaveMessage: leaveMessage
|
|
92
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
|
|
3
|
-
function isJsonText(value) {
|
|
4
|
-
value = _.trim(value);
|
|
5
|
-
|
|
6
|
-
return (_.startsWith(value, "{") || _.startsWith(value, "["));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function formatJsonText(value) {
|
|
10
|
-
if (!isJsonText(value)) {
|
|
11
|
-
return value;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return JSON.stringify(JSON.parse(value), null, 4);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
isJsonText: isJsonText,
|
|
20
|
-
formatJsonText: formatJsonText,
|
|
21
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* getCurrUserInfo
|
|
3
|
-
*/
|
|
4
|
-
import EnosAppPortalSdkUtils from "./EnosAppPortalSdkUtils";
|
|
5
|
-
import AxiosUtils from "./AxiosUtils";
|
|
6
|
-
import _ from "lodash";
|
|
7
|
-
import AppUtils from "./AppUtils";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
async function init(deviceType, pCurrUserInfoCache) {
|
|
11
|
-
if(pCurrUserInfoCache){
|
|
12
|
-
currUserInfoCache = pCurrUserInfoCache;
|
|
13
|
-
AppUtils.setLocalStorageObjItem("CURRENT_USER", currUserInfoCache);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
await getCurrUserModel();
|
|
17
|
-
|
|
18
|
-
setDeviceType(deviceType);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function clear(){
|
|
22
|
-
currUserInfoCache = null;
|
|
23
|
-
appUserModel = null;
|
|
24
|
-
AppUtils.setLocalStorageObjItem("CURRENT_USER", null);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function setDeviceType(deviceType) {
|
|
28
|
-
if(deviceType === 'MOBILE') {
|
|
29
|
-
AppUtils.setLocalStorageStringItem("DEVICE_TYPE", "MOBILE");
|
|
30
|
-
}else{
|
|
31
|
-
AppUtils.setLocalStorageStringItem("DEVICE_TYPE", "WEB");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function isMobileDevice() {
|
|
36
|
-
let deviceType = AppUtils.getLocalStorageStringItem("DEVICE_TYPE");
|
|
37
|
-
return deviceType === 'MOBILE';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let currUserInfoCache = null;
|
|
41
|
-
async function getCurrUserInfo() {
|
|
42
|
-
if(isMobileDevice()){
|
|
43
|
-
return getCurrUserInfoCache();
|
|
44
|
-
}else{
|
|
45
|
-
let currUser = await EnosAppPortalSdkUtils.getUserInfo();
|
|
46
|
-
currUserInfoCache = currUser;
|
|
47
|
-
return currUser;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function getCurrUserInfoCache(){
|
|
52
|
-
if(currUserInfoCache!=null){
|
|
53
|
-
return currUserInfoCache;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
currUserInfoCache = AppUtils.getLocalStorageObjItem("CURRENT_USER");
|
|
57
|
-
if(currUserInfoCache!=null){
|
|
58
|
-
return currUserInfoCache;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
console.debug("Please invoke getCurrUserInfo first");
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function getCurrUserId(){
|
|
66
|
-
return getCurrUserInfoCache()?.id;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
let appUserModel = null;
|
|
71
|
-
async function getCurrUserModel() {
|
|
72
|
-
if(appUserModel == null) {
|
|
73
|
-
let url = `/api/user/getCurrUserInfo`;
|
|
74
|
-
appUserModel = await AxiosUtils.getJsonData(url);
|
|
75
|
-
}
|
|
76
|
-
return appUserModel;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* check user role
|
|
81
|
-
*/
|
|
82
|
-
function userHasRole(roleCodeOrArray) {
|
|
83
|
-
if(appUserModel == null){
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if(_.isArray(roleCodeOrArray)){
|
|
88
|
-
return !_.isEmpty(_.intersection(appUserModel.roleList, roleCodeOrArray));
|
|
89
|
-
}else{
|
|
90
|
-
return _.includes(appUserModel.roleList, roleCodeOrArray);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export default {
|
|
95
|
-
init: init,
|
|
96
|
-
clear: clear,
|
|
97
|
-
getCurrUserInfo: getCurrUserInfo,
|
|
98
|
-
getCurrUserInfoCache: getCurrUserInfoCache,
|
|
99
|
-
getCurrUserId: getCurrUserId,
|
|
100
|
-
getCurrUserModel: getCurrUserModel,
|
|
101
|
-
userHasRole: userHasRole,
|
|
102
|
-
|
|
103
|
-
isMobileDevice: isMobileDevice,
|
|
104
|
-
|
|
105
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
|
|
3
|
-
function formatNumberTextWithUnit(numberText, unitText) {
|
|
4
|
-
if (!unitText) {
|
|
5
|
-
return numberText;
|
|
6
|
-
}
|
|
7
|
-
return numberText + " " + unitText;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function formatPctWith2Digital(valuePct) {
|
|
11
|
-
let valuePctText = formatNumberWithDigital(valuePct, 2, false);
|
|
12
|
-
return valuePctText + "%";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function formatNumberWith2Digital(value) {
|
|
16
|
-
return formatNumberWithDigital(value, 2);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function formatNumberWith4Digital(value) {
|
|
20
|
-
return formatNumberWithDigital(value, 4);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function formatNumberWithDigital(value, digital) {
|
|
24
|
-
if (value === null) {
|
|
25
|
-
return "";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
let dblValue = (_.toNumber(value));
|
|
29
|
-
if (isNaN(dblValue)) {
|
|
30
|
-
//the string value could not be convert to number, just return it;
|
|
31
|
-
return value;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
let valueText = value;
|
|
35
|
-
if (digital != null) {
|
|
36
|
-
let text = _.round(dblValue, digital) + "";
|
|
37
|
-
if (text.indexOf(".") === -1) {
|
|
38
|
-
text += '.';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let part1 = text.substring(0, text.indexOf("."));
|
|
42
|
-
let part2 = "";
|
|
43
|
-
|
|
44
|
-
if (digital > 0) {
|
|
45
|
-
part2 = text.substring(text.indexOf(".") + 1); //取到小数部分搜索
|
|
46
|
-
part2 = "." + _.padEnd(part2, digital, '0');
|
|
47
|
-
}
|
|
48
|
-
valueText = part1 + part2;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return valueText;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default {
|
|
55
|
-
formatPctWith2Digital: formatPctWith2Digital,
|
|
56
|
-
formatNumberWith2Digital: formatNumberWith2Digital,
|
|
57
|
-
formatNumberWith4Digital: formatNumberWith4Digital,
|
|
58
|
-
formatNumberWithDigital: formatNumberWithDigital,
|
|
59
|
-
formatNumberTextWithUnit: formatNumberTextWithUnit,
|
|
60
|
-
};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
import AxiosUtils from "./AxiosUtils";
|
|
3
|
-
|
|
4
|
-
const constants = {
|
|
5
|
-
CANVAS_WIDTH: 480,
|
|
6
|
-
CANVAS_HEIGHT: 270,
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* create an empty 2 dimension array
|
|
11
|
-
*/
|
|
12
|
-
function new2dArray(width, height, initValue) {
|
|
13
|
-
let array = [];
|
|
14
|
-
for (let rowIdx = 0; rowIdx < height; rowIdx++) {
|
|
15
|
-
let newRow = [];
|
|
16
|
-
for (let colIdx = 0; colIdx < width; colIdx++) {
|
|
17
|
-
newRow.push(initValue);
|
|
18
|
-
}
|
|
19
|
-
array.push(newRow);
|
|
20
|
-
}
|
|
21
|
-
return array;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* render grey level ImageDataArray to Canvas
|
|
26
|
-
*/
|
|
27
|
-
function renderImageDataArrayToCtx(ctx, imageDataArray) {
|
|
28
|
-
let height = imageDataArray.length;
|
|
29
|
-
let width = imageDataArray[0].length;
|
|
30
|
-
let imageData = new ImageData(width, height);
|
|
31
|
-
let idx = 0;
|
|
32
|
-
for (let rowIdx = 0; rowIdx < height; rowIdx++) {
|
|
33
|
-
for (let colIdx = 0; colIdx < width; colIdx++) {
|
|
34
|
-
let grayData = imageDataArray[rowIdx][colIdx];
|
|
35
|
-
|
|
36
|
-
imageData.data[idx + 0] = grayData;
|
|
37
|
-
imageData.data[idx + 1] = grayData;
|
|
38
|
-
imageData.data[idx + 2] = grayData;
|
|
39
|
-
imageData.data[idx + 3] = 255;
|
|
40
|
-
idx = idx + 4;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
ctx.putImageData(imageData, 0, 0, 0, 0, width, height);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function getImageDataArrayFromCtx(ctx, canvasWidth, canvasHeight) {
|
|
47
|
-
let imageData = ctx.getImageData(0, 0, canvasWidth, canvasHeight);
|
|
48
|
-
|
|
49
|
-
let isEmpty = true;
|
|
50
|
-
let imageDataArray = [];
|
|
51
|
-
for (let i = 0; i < imageData.data.length; i = i + 4) {
|
|
52
|
-
let red = imageData.data[i];
|
|
53
|
-
imageDataArray[i / 4] = red;
|
|
54
|
-
if (red !== 255) {
|
|
55
|
-
isEmpty = false;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (isEmpty) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
imageDataArray = _.chunk(imageDataArray, canvasWidth);
|
|
64
|
-
return imageDataArray;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function initCanvas(ctx, canvasWidth, canvasHeight) {
|
|
68
|
-
ctx.fillStyle = "white";
|
|
69
|
-
ctx.lineWidth = 1;
|
|
70
|
-
ctx.lineCap = 'round';
|
|
71
|
-
ctx.lineJoin = 'round';
|
|
72
|
-
|
|
73
|
-
ctx.fillRect(0, 0, canvasWidth, canvasHeight);
|
|
74
|
-
ctx.fill();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
async function convertCanvasToBlobFile(canvas, fileName, fileType = 'image/jpeg') {
|
|
78
|
-
return new Promise((resolve, reject) => {
|
|
79
|
-
canvas.toBlob(async function (blob) {
|
|
80
|
-
const file = new File([blob], fileName);
|
|
81
|
-
resolve(file);
|
|
82
|
-
}, fileType, 0.9);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Build grey level ImageDataArray from text
|
|
88
|
-
*/
|
|
89
|
-
function calcImageDataArrayFromText(valueText) {
|
|
90
|
-
if (valueText == null) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
let imageDataArray = [];
|
|
95
|
-
_.each(valueText.split(";"), (rowData, rowIdx) => {
|
|
96
|
-
let row = [];
|
|
97
|
-
_.each(rowData.split(","), (item, colIdx) => {
|
|
98
|
-
row.push(item);
|
|
99
|
-
});
|
|
100
|
-
imageDataArray.push(row);
|
|
101
|
-
});
|
|
102
|
-
return imageDataArray;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function calcTextFromImageDataArray(imageDataArray) {
|
|
106
|
-
if (imageDataArray == null) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
let valueText = "";
|
|
111
|
-
for (let rowIdx = 0; rowIdx < imageDataArray.length; rowIdx++) {
|
|
112
|
-
if (rowIdx > 0) {
|
|
113
|
-
valueText += ";";
|
|
114
|
-
}
|
|
115
|
-
valueText += imageDataArray[rowIdx].join(",");
|
|
116
|
-
}
|
|
117
|
-
return valueText;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export default {
|
|
121
|
-
constants: constants,
|
|
122
|
-
new2dArray: new2dArray,
|
|
123
|
-
initCanvas: initCanvas,
|
|
124
|
-
//common
|
|
125
|
-
convertCanvasToBlobFile: convertCanvasToBlobFile,
|
|
126
|
-
|
|
127
|
-
//for signature
|
|
128
|
-
renderImageDataArrayToCtx: renderImageDataArrayToCtx,
|
|
129
|
-
getImageDataArrayFromCtx: getImageDataArrayFromCtx,
|
|
130
|
-
calcImageDataArrayFromText: calcImageDataArrayFromText,
|
|
131
|
-
calcTextFromImageDataArray: calcTextFromImageDataArray,
|
|
132
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import _ from "lodash";
|
|
2
|
-
|
|
3
|
-
let pattern=/[`~!@#$^\-&*()=|{}':;,\\\[\].<>\/?\s]/g;
|
|
4
|
-
|
|
5
|
-
function buildKeyword(text) {
|
|
6
|
-
if(!text){
|
|
7
|
-
return '';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
let keyword = text.replace(pattern, '').toUpperCase();
|
|
11
|
-
return keyword;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export default {
|
|
16
|
-
buildKeyword: buildKeyword,
|
|
17
|
-
};
|