cnhis-design-vue 2.1.51 → 2.1.53

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +32 -17
  2. package/es/affix/index.js +8 -8
  3. package/es/age/index.js +10 -10
  4. package/es/alert/index.js +8 -8
  5. package/es/anchor/index.js +8 -8
  6. package/es/auto-complete/index.js +8 -8
  7. package/es/avatar/index.js +8 -8
  8. package/es/back-top/index.js +8 -8
  9. package/es/badge/index.js +8 -8
  10. package/es/base/index.js +8 -8
  11. package/es/big-table/index.js +170 -116
  12. package/es/big-table/style.css +1 -1
  13. package/es/breadcrumb/index.js +8 -8
  14. package/es/button/index.js +64 -79
  15. package/es/button/style.css +1 -1
  16. package/es/calendar/index.js +8 -8
  17. package/es/captcha/index.js +3 -3
  18. package/es/card/index.js +8 -8
  19. package/es/carousel/index.js +8 -8
  20. package/es/cascader/index.js +8 -8
  21. package/es/checkbox/index.js +9 -9
  22. package/es/col/index.js +8 -8
  23. package/es/collapse/index.js +8 -8
  24. package/es/color-picker/index.js +1 -1
  25. package/es/comment/index.js +8 -8
  26. package/es/config-provider/index.js +8 -8
  27. package/es/date-picker/index.js +919 -8
  28. package/es/descriptions/index.js +8 -8
  29. package/es/divider/index.js +8 -8
  30. package/es/drag-layout/index.js +3 -3
  31. package/es/drawer/index.js +8 -8
  32. package/es/dropdown/index.js +8 -8
  33. package/es/editor/index.js +1 -1
  34. package/es/empty/index.js +8 -8
  35. package/es/fabric-chart/index.js +9 -9
  36. package/es/form/index.js +8 -8
  37. package/es/form-model/index.js +8 -8
  38. package/es/form-table/index.js +62 -62
  39. package/es/index/index.js +1155 -505
  40. package/es/index/style.css +1 -1
  41. package/es/input/index.js +9 -9
  42. package/es/input-number/index.js +8 -8
  43. package/es/layout/index.js +8 -8
  44. package/es/list/index.js +8 -8
  45. package/es/locale-provider/index.js +8 -8
  46. package/es/map/index.js +9 -9
  47. package/es/mentions/index.js +8 -8
  48. package/es/menu/index.js +8 -8
  49. package/es/message/index.js +8 -8
  50. package/es/multi-chat/index.js +75 -75
  51. package/es/multi-chat-client/index.js +69 -69
  52. package/es/multi-chat-history/index.js +4 -4
  53. package/es/multi-chat-record/index.js +14 -14
  54. package/es/multi-chat-setting/index.js +22 -22
  55. package/es/multi-chat-sip/index.js +1 -1
  56. package/es/notification/index.js +8 -8
  57. package/es/page-header/index.js +8 -8
  58. package/es/pagination/index.js +8 -8
  59. package/es/popconfirm/index.js +8 -8
  60. package/es/popover/index.js +8 -8
  61. package/es/progress/index.js +8 -8
  62. package/es/radio/index.js +9 -9
  63. package/es/rate/index.js +8 -8
  64. package/es/result/index.js +8 -8
  65. package/es/row/index.js +8 -8
  66. package/es/scale-view/index.js +33 -33
  67. package/es/select/index.js +12 -12
  68. package/es/select-label/index.js +11 -11
  69. package/es/select-person/index.js +2 -2
  70. package/es/shortcut-setter/index.js +10 -10
  71. package/es/skeleton/index.js +8 -8
  72. package/es/slider/index.js +8 -8
  73. package/es/space/index.js +8 -8
  74. package/es/spin/index.js +8 -8
  75. package/es/statistic/index.js +8 -8
  76. package/es/steps/index.js +8 -8
  77. package/es/switch/index.js +8 -8
  78. package/es/table-filter/index.js +89 -104
  79. package/es/table-filter/style.css +1 -1
  80. package/es/tabs/index.js +8 -8
  81. package/es/tag/index.js +9 -9
  82. package/es/time-picker/index.js +8 -8
  83. package/es/timeline/index.js +8 -8
  84. package/es/tooltip/index.js +8 -8
  85. package/es/transfer/index.js +8 -8
  86. package/es/tree/index.js +8 -8
  87. package/es/tree-select/index.js +8 -8
  88. package/es/upload/index.js +8 -8
  89. package/es/verification-code/index.js +2 -2
  90. package/lib/cui.common.js +1571 -967
  91. package/lib/cui.umd.js +1571 -967
  92. package/lib/cui.umd.min.js +22 -22
  93. package/package.json +1 -1
  94. package/packages/big-table/src/BigTable.vue +59 -17
  95. package/packages/big-table/src/utils/bigTableProps.js +12 -8
  96. package/packages/button/src/ButtonPrint/index.vue +48 -59
  97. package/packages/date-picker/index.js +2 -0
  98. package/packages/date-picker/src/utils/index.js +374 -0
  99. package/packages/fabric-chart/src/const/defaultVaule.js +59 -59
  100. package/packages/scale-view/scaleView.vue +2010 -2010
@@ -0,0 +1,374 @@
1
+ /**
2
+ * 重写antd的一些方法满足业务需要
3
+ */
4
+ import { message } from 'ant-design-vue/es';
5
+ import DateInput from 'ant-design-vue/es/vc-calendar/src/date/DateInput.js';
6
+ import TimePickerHeader from 'ant-design-vue/es/vc-time-picker/Header.js';
7
+ import KEYCODE from 'ant-design-vue/es/_util/KeyCode';
8
+ import moment from 'moment';
9
+
10
+ function checkDateVal(val, type) {
11
+ const regObj = {
12
+ YYYYMMDD: /\d{8}/,
13
+ YYYYMM: /\d{6}/,
14
+ YYYY: /\d{4}/,
15
+ 'YYYY-MM-DD': /\d{4}-\d\d-\d\d/,
16
+ 'YYYY-MM': /\d{4}-\d\d/
17
+ };
18
+ if (regObj[type]) {
19
+ return regObj[type].test(val);
20
+ }
21
+ return false;
22
+ }
23
+
24
+ function checkTimeVal(val, type) {
25
+ const regObj = {
26
+ 'HH:mm:ss': /\d\d:\d\d:\d\d/,
27
+ 'HH:mm': /\d\d:\d\d/,
28
+ HHmmss: /\d\d\d\d\d\d/,
29
+ HHmm: /\d\d\d\d/,
30
+ HH: /\d\d/
31
+ };
32
+ if (regObj[type]) {
33
+ return regObj[type].test(val);
34
+ }
35
+ return false;
36
+ }
37
+
38
+ /**
39
+ *
40
+ * @param {string} str
41
+ * @param {string} formatStr
42
+ * @returns
43
+ */
44
+ function getHasTimeValue(str, formatStr) {
45
+ let res = str;
46
+ let [dateType, timeType] = formatStr.split(' ');
47
+ let dateTypeStr = dateType.toUpperCase().replace(/-/g, '');
48
+ let timeTypeStr = timeType.replace(/:/g, '');
49
+ if (str.length > 8) {
50
+ let dateValue = str.slice(0, 8);
51
+ let timeValue = str.slice(8).trim();
52
+
53
+ // time 兼容两种输入 HH:mm:ss | HHmmss
54
+ if (checkDateVal(dateValue, dateTypeStr) && (checkTimeVal(timeValue, timeType) || checkTimeVal(timeValue, timeTypeStr))) {
55
+ // 使用 moment 的 iso Date 格式转换值
56
+ dateValue = moment(dateValue, dateTypeStr).format(dateType);
57
+ // 使用 moment 的 iso time 格式转换值
58
+ timeValue = timeValue ? moment(timeValue, timeTypeStr).format(timeType) : '';
59
+ res = `${dateValue} ${timeValue}`;
60
+ }
61
+ }
62
+ return res;
63
+ }
64
+
65
+ function mendTime(timeVal, timeType, defVal) {
66
+ let res = timeVal;
67
+ return res + defVal.slice(0, timeType.length).slice(timeVal.length);
68
+ }
69
+
70
+ /**
71
+ * 补全时间
72
+ * @param {*} str
73
+ * @param {*} formatStr
74
+ * @returns
75
+ */
76
+ function strFormatToDate(str, formatStr) {
77
+ let res = '';
78
+ let [dateType, timeType] = formatStr.split(' ');
79
+ let updateType = dateType.toUpperCase();
80
+ let dateTypeStr = updateType.replace(/-/g, '');
81
+ let timeTypeStr = timeType.replace(/:/g, '');
82
+ let strDateValue = '',
83
+ strTimeValue = '';
84
+ let ordinary = false;
85
+ if (str.length >= 10) {
86
+ strDateValue = str.slice(0, 10);
87
+ }
88
+ // 是否是"YYYY-MM-DD" 格式
89
+ if (checkDateVal(strDateValue, updateType)) {
90
+ strTimeValue = str.slice(10).trim();
91
+ ordinary = true;
92
+ } else {
93
+ // 处理“yyyymmdd”的格式
94
+ if (str.length >= 8) {
95
+ strDateValue = str.slice(0, 8);
96
+ strTimeValue = str.slice(8).trim();
97
+ }
98
+ }
99
+
100
+ // time 兼容两种输入 HH:mm:ss | HHmmss
101
+ let ff = !checkTimeVal(strTimeValue, timeType) || !checkTimeVal(strTimeValue, timeTypeStr);
102
+
103
+ // 日期格式
104
+ let dateFlag = ordinary || checkDateVal(strDateValue, dateTypeStr);
105
+
106
+ if (dateFlag && ff) {
107
+ if (strTimeValue && ff) {
108
+ let f = strTimeValue.includes(':') || ordinary;
109
+ if (f) {
110
+ strTimeValue = mendTime(strTimeValue, timeType, '00:00:00');
111
+ } else {
112
+ strTimeValue = mendTime(strTimeValue, timeTypeStr, '000000');
113
+ }
114
+ }
115
+ if (!strTimeValue) {
116
+ strTimeValue = '00:00:00';
117
+ }
118
+ // 使用 moment 的 iso Date 格式转换值
119
+ strDateValue = moment(strDateValue, dateTypeStr).format(dateType);
120
+ // 使用 moment 的 iso time 格式转换值
121
+ strTimeValue = strDateValue ? moment(strTimeValue, timeTypeStr).format(timeType) : '';
122
+ res = `${strDateValue} ${strTimeValue}`;
123
+ // 有解析错误的置空
124
+ if (res.includes('Invalid date')) {
125
+ res = '';
126
+ }
127
+ }
128
+
129
+ return res;
130
+ }
131
+
132
+ function getHasTimeValue2(str, formatStr) {
133
+ let res = '';
134
+ let [dateType, timeType] = formatStr.split(' ');
135
+ let updateType = dateType.toUpperCase();
136
+ let dateTypeStr = updateType.replace(/-/g, '');
137
+ let timeTypeStr = timeType.replace(/:/g, '');
138
+
139
+ if (str.length >= 8) {
140
+ let dateValue = str.slice(0, 8);
141
+ let timeValue = str.slice(8).trim();
142
+ let ff = !checkTimeVal(timeValue, timeType) || !checkTimeVal(timeValue, timeTypeStr);
143
+
144
+ // time 兼容两种输入 HH:mm:ss | HHmmss
145
+ if (checkDateVal(dateValue, dateTypeStr) && ff) {
146
+ if (timeValue && ff) {
147
+ let f = timeValue.includes(':');
148
+ if (f) {
149
+ timeValue = timeValue + '00:00:00'.slice(timeValue.length);
150
+ } else {
151
+ timeValue = timeValue + '000000'.slice(timeValue.length);
152
+ }
153
+ }
154
+ if (!timeValue) {
155
+ timeValue = '00:00:00';
156
+ }
157
+ // 使用 moment 的 iso Date 格式转换值
158
+ dateValue = moment(dateValue, dateTypeStr).format(dateType);
159
+ // 使用 moment 的 iso time 格式转换值
160
+ timeValue = timeValue ? moment(timeValue, timeTypeStr).format(timeType) : '';
161
+ res = `${dateValue} ${timeValue}`;
162
+ }
163
+ }
164
+ return res;
165
+ }
166
+ const extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
167
+
168
+ function sleep() {
169
+ return new Promise(res => {
170
+ setTimeout(() => res(), 0);
171
+ });
172
+ }
173
+
174
+ const getMomentObjectIfValid = date => {
175
+ if (moment.isMoment(date) && date.isValid()) {
176
+ return date;
177
+ }
178
+ return false;
179
+ };
180
+
181
+ function customGetValue(str, formatStr) {
182
+ let res = '';
183
+ // 如果有含有“时间”, 自定义拼值
184
+ if (formatStr && /(HH)|(hh)/.test(formatStr)) {
185
+ res = strFormatToDate(str, formatStr);
186
+ } else {
187
+ let dateTypeStr = formatStr.toUpperCase().replace(/-/g, '');
188
+ res = checkDateVal(str, dateTypeStr) ? moment(str, dateTypeStr).format(formatStr) : str;
189
+ }
190
+ // 如是含有错误解析,重置输出
191
+ if (res.includes('Invalid date')) {
192
+ res = '';
193
+ }
194
+ return res;
195
+ }
196
+
197
+ function onInputChange11(e) {
198
+ const { value: str, composing } = e.target;
199
+ const { str: oldStr = '' } = this;
200
+
201
+ const { disabledDate, format, selectedValue } = this.$props;
202
+
203
+ // 没有内容,合法并直接退出
204
+ if (!str) {
205
+ this.__emit('change', null);
206
+ this.setState({
207
+ invalid: false,
208
+ str
209
+ });
210
+ return;
211
+ }
212
+
213
+ // 不合法直接退出
214
+ const parsed = moment(str, format, true);
215
+ if (!parsed.isValid()) {
216
+ this.setState({
217
+ invalid: true,
218
+ str
219
+ });
220
+ return;
221
+ }
222
+ const value = this.value.clone();
223
+ value
224
+ .year(parsed.year())
225
+ .month(parsed.month())
226
+ .date(parsed.date())
227
+ .hour(parsed.hour())
228
+ .minute(parsed.minute())
229
+ .second(parsed.second());
230
+
231
+ if (!value || (disabledDate && disabledDate(value))) {
232
+ this.setState({
233
+ invalid: true,
234
+ str
235
+ });
236
+ return;
237
+ }
238
+
239
+ if (selectedValue !== value || (selectedValue && value && !selectedValue.isSame(value))) {
240
+ this.setState({
241
+ invalid: false,
242
+ str
243
+ });
244
+ this.__emit('change', value);
245
+ }
246
+ }
247
+
248
+ export function rewriteAntd() {
249
+ /**
250
+ * 改写日期弹窗框的 input 元素的 onInputChange 方法,满足格式化 '20221014121517' | '20221014 12:15:17'
251
+ */
252
+ /**
253
+ * TODO: 输入完整的日期格式,光标会移到最后。有可能是 antd 的bug
254
+ */
255
+ if (DateInput && DateInput.methods) {
256
+ DateInput.methods.onInputChange11 = onInputChange11;
257
+ // 缓存原有的方法
258
+ DateInput.methods.originalOnInputChange = DateInput.methods.onInputChange;
259
+ // 重新 onInputChange
260
+ DateInput.methods.onInputChange = function(e) {
261
+ // console.log(e.target.selectionStart, "e.target.selectionStart");
262
+ const { value: str, composing } = e.target;
263
+ let res = str;
264
+ const formatStr = this.format;
265
+ // 如果有含有“时间”, 自定义拼值
266
+ if (formatStr && /(HH)|(hh)/.test(formatStr)) {
267
+ res = getHasTimeValue(str, formatStr);
268
+ } else {
269
+ let dateTypeStr = this.format.toUpperCase().replace(/-/g, '');
270
+ res = checkDateVal(str, dateTypeStr) ? moment(str, dateTypeStr).format(this.format) : str;
271
+ }
272
+ // 如是含有错误解析,重置输出
273
+ if (res.includes('Invalid date')) {
274
+ res = str;
275
+ }
276
+ // 调用原来的 onInputChange 方法
277
+ // 原本是传入事件对象,目前只传入需要的参数
278
+ this.originalOnInputChange({
279
+ target: { value: res, composing }
280
+ });
281
+ // this.originalOnInputChange(e);
282
+ };
283
+
284
+ /**
285
+ * 改写 onKeyDown 事件,满足按回车键,不满足的 yyyymmdd: hhmmss 格式的自动补“时间”(hhmmss)
286
+ * @param {*} event
287
+ * @returns
288
+ */
289
+ DateInput.methods.onKeyDown = async function(event) {
290
+ const { keyCode, target } = event;
291
+
292
+ if (keyCode === KEYCODE.ENTER) {
293
+ const formatStr = this.format;
294
+ const tValue = target.value;
295
+ const pProps = this.$parent.$props;
296
+ // 回车自动补全“时间”
297
+ if (tValue && formatStr && /(HH)|(hh)/.test(formatStr) && (!extendedIsoRegex.test(tValue) || checkDateVal(tValue, 'YYYY-MM-DD'))) {
298
+ // 是否可以自动补全时间
299
+ let ress = strFormatToDate(tValue, formatStr);
300
+ if (ress) {
301
+ this.onInputChange11({
302
+ target: { value: ress }
303
+ });
304
+ await sleep();
305
+ }
306
+ }
307
+ const { disabledDate, value, selectedValue } = this.$props;
308
+
309
+ const validateDate = !disabledDate || !disabledDate(value);
310
+ // if (selectedValue !== value || (selectedValue && value && !selectedValue.isSame(value))) {
311
+
312
+ // }
313
+ let def = getMomentObjectIfValid(pProps.value) || getMomentObjectIfValid(pProps.defaultValue);
314
+ if (validateDate) {
315
+ let dateTypeStr = formatStr.toUpperCase().replace(/-/g, '');
316
+ let f = checkDateVal(tValue, formatStr) || checkDateVal(tValue, dateTypeStr);
317
+ // 有输入的值,但是格式错误,提示
318
+ if (tValue && ((!customGetValue(tValue, formatStr) && !extendedIsoRegex.test(tValue) && /(HH)|(hh)/.test(formatStr)) || (['YYYYMMDD', 'YYYYMM', 'YYYY'].includes(dateTypeStr) && !f))) {
319
+ console.log(tValue, '-----------------');
320
+ message.error('请输入有效的格式');
321
+ }
322
+ if (!selectedValue && !def) {
323
+ message.error('请输入有效的格式');
324
+ return false;
325
+ }
326
+ if (!selectedValue && def && def.isSame(value)) {
327
+ this.__emit('select', null);
328
+ return false;
329
+ }
330
+ this.__emit('select', value.clone());
331
+ }
332
+ event.preventDefault();
333
+ }
334
+ };
335
+ }
336
+
337
+ /**
338
+ * TimePickerHeader
339
+ */
340
+ if (TimePickerHeader && TimePickerHeader.methods) {
341
+ // 缓存原有的方法
342
+ TimePickerHeader.methods.originalOnKeyDown = TimePickerHeader.methods.onKeyDown;
343
+
344
+ TimePickerHeader.methods.onKeyDown = async function(event) {
345
+ const { keyCode, target } = event;
346
+
347
+ if (keyCode === KEYCODE.ENTER) {
348
+ const timeType = this.format;
349
+ const tValue = target.value;
350
+ let timeValue = tValue;
351
+ let timeTypeStr = timeType.replace(/:/g, '');
352
+ // iso time 格式
353
+ if (checkTimeVal(timeValue, timeTypeStr)) {
354
+ timeValue = timeValue ? moment(timeValue, timeTypeStr).format(timeType) : '';
355
+ if (checkTimeVal(timeValue, timeType)) {
356
+ this.onInputChange({
357
+ target: { value: timeValue }
358
+ });
359
+ await sleep();
360
+ this.__emit('esc');
361
+ return;
362
+ }
363
+ } else if (checkTimeVal(timeValue, timeType)) {
364
+ // 满足条件按回车关闭弹窗
365
+ this.__emit('esc');
366
+ } else {
367
+ message.error('请输入有效的时间格式');
368
+ }
369
+ }
370
+
371
+ this.originalOnKeyDown(event);
372
+ };
373
+ }
374
+ }
@@ -1,59 +1,59 @@
1
- const data = {
2
- style: {
3
- evented: false,
4
- selectable: false
5
- },
6
- rectStyle: {
7
- fill: 'transparent',
8
- stroke: '#999',
9
- strokeWidth: 1
10
- },
11
- textStyle: {
12
- fontFamily: '微软雅黑',
13
- fontSize: 12,
14
- fill: '#000',
15
- lineHeight: 1
16
- },
17
- borderStyle: {
18
- stroke: '#999',
19
- strokeWidth: 1,
20
- selectable: false,
21
- evented: false
22
- },
23
- // 折线图中的点
24
- pointStyle: {
25
- fill: '#ffffff', // 填充色
26
- stroke: '#000000', // 描边色
27
- originX: 'center',
28
- originY: 'center'
29
- },
30
- // 折线图中的线
31
- lineStyle: {
32
- stroke: '#000', // 描边色
33
- strokeWidth: 1, // 描边宽度
34
- originX: 'center',
35
- originY: 'center'
36
- },
37
- topSpaceHeight: 10, // templateData.top.spaceHeight
38
- topSpaceGridNumber: 3, // templateData.top.xScalevalue.spaceGridNumber
39
- leftSpaceGridNumber: 2, // templateData.left.leftYScalevalue.spaceGridNumber
40
- rightSpaceGridNumber: 2, // templateData.right.rightYScalevalue.spaceGridNumber
41
- topTotal: {
42
- title: '总量',
43
- width: 0,
44
- style: {
45
- fontFamily: '微软雅黑',
46
- fontSize: 12,
47
- fill: '#000',
48
- lineHeight: 1
49
- }
50
- },
51
- criticalStyle: { // 危急值样式
52
- stroke: 'purple', // 颜色 默认 #999
53
- strokeWidth: 1, // 线宽 默认 1
54
- strokeDashArray: [0, 0] // 实线设置 默认[0, 0]
55
- },
56
- bottomNumberLeftSpace: 10 // 底部标记的序号与标记之间的距离
57
- };
58
-
59
- export default data;
1
+ const data = {
2
+ style: {
3
+ evented: false,
4
+ selectable: false
5
+ },
6
+ rectStyle: {
7
+ fill: 'transparent',
8
+ stroke: '#999',
9
+ strokeWidth: 1
10
+ },
11
+ textStyle: {
12
+ fontFamily: '微软雅黑',
13
+ fontSize: 12,
14
+ fill: '#000',
15
+ lineHeight: 1
16
+ },
17
+ borderStyle: {
18
+ stroke: '#999',
19
+ strokeWidth: 1,
20
+ selectable: false,
21
+ evented: false
22
+ },
23
+ // 折线图中的点
24
+ pointStyle: {
25
+ fill: '#ffffff', // 填充色
26
+ stroke: '#000000', // 描边色
27
+ originX: 'center',
28
+ originY: 'center'
29
+ },
30
+ // 折线图中的线
31
+ lineStyle: {
32
+ stroke: '#000', // 描边色
33
+ strokeWidth: 1, // 描边宽度
34
+ originX: 'center',
35
+ originY: 'center'
36
+ },
37
+ topSpaceHeight: 10, // templateData.top.spaceHeight
38
+ topSpaceGridNumber: 3, // templateData.top.xScalevalue.spaceGridNumber
39
+ leftSpaceGridNumber: 2, // templateData.left.leftYScalevalue.spaceGridNumber
40
+ rightSpaceGridNumber: 2, // templateData.right.rightYScalevalue.spaceGridNumber
41
+ topTotal: {
42
+ title: '总量',
43
+ width: 0,
44
+ style: {
45
+ fontFamily: '微软雅黑',
46
+ fontSize: 12,
47
+ fill: '#000',
48
+ lineHeight: 1
49
+ }
50
+ },
51
+ criticalStyle: { // 危急值样式
52
+ stroke: 'purple', // 颜色 默认 #999
53
+ strokeWidth: 1, // 线宽 默认 1
54
+ strokeDashArray: [0, 0] // 实线设置 默认[0, 0]
55
+ },
56
+ bottomNumberLeftSpace: 10 // 底部标记的序号与标记之间的距离
57
+ };
58
+
59
+ export default data;