hy-dispatch-ui-v3 0.2.55 → 0.2.56

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.
@@ -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
@@ -34,6 +34,7 @@ export { clearSpace, columnRuleHandler, genRuleRequiredMsgHandler, genValueByPro
34
34
  export { cloneDeep, copyText, createUniqueId, funRunHandler, mergeDeep, withInstall } from './utils/handler.mjs';
35
35
  export { configProviderContextKey, provideGlobalConfig, useGlobalConfig } from './hooks/useGlobalConfig.mjs';
36
36
  export { defaultAxios, localApiKey, useApi } from './hooks/useApi.mjs';
37
+ export { enterNumbersRrLetters, enterTheMumber, filterSpaces, formatNumber, formatTimeFn, getPublicFileSize, inputForbidden, keepTwoDecimalPlaces, onlyNumber } from './utils/input.mjs';
37
38
  export { formatDuration, getDefaultValueFormatByType } from './utils/date.mjs';
38
39
  export { isArray, isBoolean, isEmpty, isFile, isFunction, isNull, isNumber, isObject, isOverflowing, isPermission, isString, isSupportH265, isSymbol, isUndefined, isVueProxy } from './utils/is.mjs';
39
40
  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",
@@ -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",
@@ -5,4 +5,5 @@ 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';
@@ -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/version.mjs CHANGED
@@ -1,3 +1,3 @@
1
- const version = "0.2.54";
1
+ const version = "0.2.55";
2
2
 
3
3
  export { version };
@@ -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
@@ -38,6 +38,7 @@ var form = require('./utils/form.js');
38
38
  var handler = require('./utils/handler.js');
39
39
  var useGlobalConfig = require('./hooks/useGlobalConfig.js');
40
40
  var useApi = require('./hooks/useApi.js');
41
+ var input = require('./utils/input.js');
41
42
  var date = require('./utils/date.js');
42
43
  var is = require('./utils/is.js');
43
44
  var useAudioPlayerConfig = require('./hooks/useAudioPlayerConfig.js');
@@ -127,6 +128,15 @@ exports.useGlobalConfig = useGlobalConfig.useGlobalConfig;
127
128
  exports.defaultAxios = useApi.defaultAxios;
128
129
  exports.localApiKey = useApi.localApiKey;
129
130
  exports.useApi = useApi.useApi;
131
+ exports.enterNumbersRrLetters = input.enterNumbersRrLetters;
132
+ exports.enterTheMumber = input.enterTheMumber;
133
+ exports.filterSpaces = input.filterSpaces;
134
+ exports.formatNumber = input.formatNumber;
135
+ exports.formatTimeFn = input.formatTimeFn;
136
+ exports.getPublicFileSize = input.getPublicFileSize;
137
+ exports.inputForbidden = input.inputForbidden;
138
+ exports.keepTwoDecimalPlaces = input.keepTwoDecimalPlaces;
139
+ exports.onlyNumber = input.onlyNumber;
130
140
  exports.formatDuration = date.formatDuration;
131
141
  exports.getDefaultValueFormatByType = date.getDefaultValueFormatByType;
132
142
  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",
@@ -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",
@@ -7,6 +7,7 @@ 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');
11
12
 
12
13
 
@@ -53,4 +54,13 @@ exports.genRuleRequiredMsgHandler = form.genRuleRequiredMsgHandler;
53
54
  exports.genValueByProp = form.genValueByProp;
54
55
  exports.getValueByProp = form.getValueByProp;
55
56
  exports.setValueByProp = form.setValueByProp;
57
+ exports.enterNumbersRrLetters = input.enterNumbersRrLetters;
58
+ exports.enterTheMumber = input.enterTheMumber;
59
+ exports.filterSpaces = input.filterSpaces;
60
+ exports.formatNumber = input.formatNumber;
61
+ exports.formatTimeFn = input.formatTimeFn;
62
+ exports.getPublicFileSize = input.getPublicFileSize;
63
+ exports.inputForbidden = input.inputForbidden;
64
+ exports.keepTwoDecimalPlaces = input.keepTwoDecimalPlaces;
65
+ exports.onlyNumber = input.onlyNumber;
56
66
  exports.PERMISSION = permission.PERMISSION;
@@ -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/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const version = "0.2.54";
3
+ const version = "0.2.55";
4
4
 
5
5
  exports.version = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-dispatch-ui-v3",
3
- "version": "0.2.55",
3
+ "version": "0.2.56",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "scripts": {