@kengic/uni 0.5.1 → 0.5.2-beta.1

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 (146) hide show
  1. package/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
  2. package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
  3. package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
  4. package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
  5. package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
  6. package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
  7. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
  8. package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
  9. package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
  10. package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
  11. package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
  12. package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
  13. package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
  14. package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
  15. package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
  16. package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
  17. package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
  18. package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
  19. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
  20. package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
  21. package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
  22. package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
  23. package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
  24. package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
  25. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
  26. package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
  27. package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
  28. package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
  29. package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
  30. package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
  31. package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
  32. package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
  33. package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
  34. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
  35. package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
  36. package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
  37. package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
  38. package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
  39. package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
  40. package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
  41. package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
  42. package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
  43. package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
  44. package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
  45. package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
  46. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
  47. package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
  48. package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
  49. package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
  50. package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
  51. package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
  52. package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
  53. package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
  54. package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
  55. package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
  56. package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
  57. package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
  58. package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
  59. package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
  60. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
  61. package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
  62. package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
  63. package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
  64. package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
  65. package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
  66. package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
  67. package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
  68. package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
  69. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
  70. package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
  71. package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
  72. package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
  73. package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
  74. package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
  75. package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
  76. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
  77. package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
  78. package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
  79. package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
  80. package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
  81. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
  82. package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
  83. package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
  84. package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
  85. package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
  86. package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
  87. package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
  88. package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
  89. package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
  90. package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
  91. package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
  92. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
  93. package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
  94. package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
  95. package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
  96. package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
  97. package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
  98. package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
  99. package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
  100. package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
  101. package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
  102. package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
  103. package/dist/uni/uni-ui/uni-scss/package.json +73 -73
  104. package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
  105. package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
  106. package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
  107. package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
  108. package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
  109. package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
  110. package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
  111. package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
  112. package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
  113. package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
  114. package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
  115. package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
  116. package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
  117. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
  118. package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
  119. package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
  120. package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
  121. package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
  122. package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
  123. package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
  124. package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
  125. package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
  126. package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
  127. package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
  128. package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
  129. package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
  130. package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +387 -313
  131. package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
  132. package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
  133. package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
  134. package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
  135. package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
  136. package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
  137. package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
  138. package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
  139. package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
  140. package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
  141. package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
  142. package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
  143. package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
  144. package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
  145. package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
  146. package/package.json +1 -1
@@ -4,16 +4,16 @@
4
4
  * @@return {Object} 拷贝对象
5
5
  */
6
6
  export const deepCopy = (val) => {
7
- return JSON.parse(JSON.stringify(val))
8
- }
7
+ return JSON.parse(JSON.stringify(val));
8
+ };
9
9
  /**
10
10
  * 过滤数字类型
11
11
  * @param {String} format 数字类型
12
12
  * @@return {Boolean} 返回是否为数字类型
13
13
  */
14
14
  export const typeFilter = (format) => {
15
- return format === 'int' || format === 'double' || format === 'number' || format === 'timestamp';
16
- }
15
+ return format === 'int' || format === 'double' || format === 'number' || format === 'timestamp';
16
+ };
17
17
 
18
18
  /**
19
19
  * 把 value 转换成指定的类型,用于处理初始值,原因是初始值需要入库不能为 undefined
@@ -22,24 +22,24 @@ export const typeFilter = (format) => {
22
22
  * @param {Object} rules 表单校验规则
23
23
  */
24
24
  export const getValue = (key, value, rules) => {
25
- const isRuleNumType = rules.find(val => val.format && typeFilter(val.format));
26
- const isRuleBoolType = rules.find(val => (val.format && val.format === 'boolean') || val.format === 'bool');
27
- // 输入类型为 number
28
- if (!!isRuleNumType) {
29
- if (!value && value !== 0) {
30
- value = null
31
- } else {
32
- value = isNumber(Number(value)) ? Number(value) : value
33
- }
34
- }
25
+ const isRuleNumType = rules.find((val) => val.format && typeFilter(val.format));
26
+ const isRuleBoolType = rules.find((val) => (val.format && val.format === 'boolean') || val.format === 'bool');
27
+ // 输入类型为 number
28
+ if (!!isRuleNumType) {
29
+ if (!value && value !== 0) {
30
+ value = null;
31
+ } else {
32
+ value = isNumber(Number(value)) ? Number(value) : value;
33
+ }
34
+ }
35
35
 
36
- // 输入类型为 boolean
37
- if (!!isRuleBoolType) {
38
- value = isBoolean(value) ? value : false
39
- }
36
+ // 输入类型为 boolean
37
+ if (!!isRuleBoolType) {
38
+ value = isBoolean(value) ? value : false;
39
+ }
40
40
 
41
- return value;
42
- }
41
+ return value;
42
+ };
43
43
 
44
44
  /**
45
45
  * 获取表单数据
@@ -48,9 +48,9 @@ export const getValue = (key, value, rules) => {
48
48
  * @param {any} value 需要设置的值
49
49
  */
50
50
  export const setDataValue = (field, formdata, value) => {
51
- formdata[field] = value
52
- return value || ''
53
- }
51
+ formdata[field] = value;
52
+ return value || '';
53
+ };
54
54
 
55
55
  /**
56
56
  * 获取表单数据
@@ -58,20 +58,20 @@ export const setDataValue = (field, formdata, value) => {
58
58
  * @param {Object} data 原始数据
59
59
  */
60
60
  export const getDataValue = (field, data) => {
61
- return objGet(data, field)
62
- }
61
+ return objGet(data, field);
62
+ };
63
63
 
64
64
  /**
65
65
  * 获取表单类型
66
66
  * @param {String|Array} field 真实名称,需要使用 realName 获取
67
67
  */
68
68
  export const getDataValueType = (field, data) => {
69
- const value = getDataValue(field, data)
70
- return {
71
- type: type(value),
72
- value
73
- }
74
- }
69
+ const value = getDataValue(field, data);
70
+ return {
71
+ type: type(value),
72
+ value,
73
+ };
74
+ };
75
75
 
76
76
  /**
77
77
  * 获取表单可用的真实name
@@ -79,13 +79,13 @@ export const getDataValueType = (field, data) => {
79
79
  * @@return {String} 表单可用的真实name
80
80
  */
81
81
  export const realName = (name, data = {}) => {
82
- const base_name = _basePath(name)
83
- if (typeof base_name === 'object' && Array.isArray(base_name) && base_name.length > 1) {
84
- const realname = base_name.reduce((a, b) => a += `#${b}`, '_formdata_')
85
- return realname
86
- }
87
- return base_name[0] || name
88
- }
82
+ const base_name = _basePath(name);
83
+ if (typeof base_name === 'object' && Array.isArray(base_name) && base_name.length > 1) {
84
+ const realname = base_name.reduce((a, b) => (a += `#${b}`), '_formdata_');
85
+ return realname;
86
+ }
87
+ return base_name[0] || name;
88
+ };
89
89
 
90
90
  /**
91
91
  * 判断是否表单可用的真实name
@@ -93,33 +93,33 @@ export const realName = (name, data = {}) => {
93
93
  * @@return {String} 表单可用的真实name
94
94
  */
95
95
  export const isRealName = (name) => {
96
- const reg = /^_formdata_#*/
97
- return reg.test(name)
98
- }
96
+ const reg = /^_formdata_#*/;
97
+ return reg.test(name);
98
+ };
99
99
 
100
100
  /**
101
101
  * 获取表单数据的原始格式
102
102
  * @@return {Object|Array} object 需要解析的数据
103
103
  */
104
104
  export const rawData = (object = {}, name) => {
105
- let newData = JSON.parse(JSON.stringify(object))
106
- let formData = {}
107
- for(let i in newData){
108
- let path = name2arr(i)
109
- objSet(formData,path,newData[i])
110
- }
111
- return formData
112
- }
105
+ let newData = JSON.parse(JSON.stringify(object));
106
+ let formData = {};
107
+ for (let i in newData) {
108
+ let path = name2arr(i);
109
+ objSet(formData, path, newData[i]);
110
+ }
111
+ return formData;
112
+ };
113
113
 
114
114
  /**
115
115
  * 真实name还原为 array
116
- * @param {*} name
116
+ * @param {*} name
117
117
  */
118
118
  export const name2arr = (name) => {
119
- let field = name.replace('_formdata_#', '')
120
- field = field.split('#').map(v => (isNumber(v) ? Number(v) : v))
121
- return field
122
- }
119
+ let field = name.replace('_formdata_#', '');
120
+ field = field.split('#').map((v) => (isNumber(v) ? Number(v) : v));
121
+ return field;
122
+ };
123
123
 
124
124
  /**
125
125
  * 对象中设置值
@@ -128,31 +128,31 @@ export const name2arr = (name) => {
128
128
  * @param {String} value 需要设置的值
129
129
  */
130
130
  export const objSet = (object, path, value) => {
131
- if (typeof object !== 'object') return object;
132
- _basePath(path).reduce((o, k, i, _) => {
133
- if (i === _.length - 1) {
134
- // 若遍历结束直接赋值
135
- o[k] = value
136
- return null
137
- } else if (k in o) {
138
- // 若存在对应路径,则返回找到的对象,进行下一次遍历
139
- return o[k]
140
- } else {
141
- // 若不存在对应路径,则创建对应对象,若下一路径是数字,新对象赋值为空数组,否则赋值为空对象
142
- o[k] = /^[0-9]{1,}$/.test(_[i + 1]) ? [] : {}
143
- return o[k]
144
- }
145
- }, object)
146
- // 返回object
147
- return object;
148
- }
131
+ if (typeof object !== 'object') return object;
132
+ _basePath(path).reduce((o, k, i, _) => {
133
+ if (i === _.length - 1) {
134
+ // 若遍历结束直接赋值
135
+ o[k] = value;
136
+ return null;
137
+ } else if (k in o) {
138
+ // 若存在对应路径,则返回找到的对象,进行下一次遍历
139
+ return o[k];
140
+ } else {
141
+ // 若不存在对应路径,则创建对应对象,若下一路径是数字,新对象赋值为空数组,否则赋值为空对象
142
+ o[k] = /^[0-9]{1,}$/.test(_[i + 1]) ? [] : {};
143
+ return o[k];
144
+ }
145
+ }, object);
146
+ // 返回object
147
+ return object;
148
+ };
149
149
 
150
150
  // 处理 path, path有三种形式:'a[0].b.c'、'a.0.b.c' 和 ['a','0','b','c'],需要统一处理成数组,便于后续使用
151
151
  function _basePath(path) {
152
- // 若是数组,则直接返回
153
- if (Array.isArray(path)) return path
154
- // 若有 '[',']',则替换成将 '[' 替换成 '.',去掉 ']'
155
- return path.replace(/\[/g, '.').replace(/\]/g, '').split('.')
152
+ // 若是数组,则直接返回
153
+ if (Array.isArray(path)) return path;
154
+ // 若有 '[',']',则替换成将 '[' 替换成 '.',去掉 ']'
155
+ return path.replace(/\[/g, '.').replace(/\]/g, '').split('.');
156
156
  }
157
157
 
158
158
  /**
@@ -162,132 +162,128 @@ function _basePath(path) {
162
162
  * @param {String} defaultVal 如果无法从调用链中获取值的默认值
163
163
  */
164
164
  export const objGet = (object, path, defaultVal = 'undefined') => {
165
- // 先将path处理成统一格式
166
- let newPath = _basePath(path)
167
- // 递归处理,返回最后结果
168
- let val = newPath.reduce((o, k) => {
169
- return (o || {})[k]
170
- }, object);
171
- return !val || val !== undefined ? val : defaultVal
172
- }
173
-
165
+ // 先将path处理成统一格式
166
+ let newPath = _basePath(path);
167
+ // 递归处理,返回最后结果
168
+ let val = newPath.reduce((o, k) => {
169
+ return (o || {})[k];
170
+ }, object);
171
+ return !val || val !== undefined ? val : defaultVal;
172
+ };
174
173
 
175
174
  /**
176
- * 是否为 number 类型
175
+ * 是否为 number 类型
177
176
  * @param {any} num 需要判断的值
178
177
  * @return {Boolean} 是否为 number
179
178
  */
180
179
  export const isNumber = (num) => {
181
- return !isNaN(Number(num))
182
- }
180
+ return !isNaN(Number(num));
181
+ };
183
182
 
184
183
  /**
185
- * 是否为 boolean 类型
184
+ * 是否为 boolean 类型
186
185
  * @param {any} bool 需要判断的值
187
186
  * @return {Boolean} 是否为 boolean
188
187
  */
189
188
  export const isBoolean = (bool) => {
190
- return (typeof bool === 'boolean')
191
- }
189
+ return typeof bool === 'boolean';
190
+ };
192
191
  /**
193
192
  * 是否有必填字段
194
193
  * @param {Object} rules 规则
195
194
  * @return {Boolean} 是否有必填字段
196
195
  */
197
196
  export const isRequiredField = (rules) => {
198
- let isNoField = false;
199
- for (let i = 0; i < rules.length; i++) {
200
- const ruleData = rules[i];
201
- if (ruleData.required) {
202
- isNoField = true;
203
- break;
204
- }
205
- }
206
- return isNoField;
207
- }
208
-
197
+ let isNoField = false;
198
+ for (let i = 0; i < rules.length; i++) {
199
+ const ruleData = rules[i];
200
+ if (ruleData.required) {
201
+ isNoField = true;
202
+ break;
203
+ }
204
+ }
205
+ return isNoField;
206
+ };
209
207
 
210
208
  /**
211
209
  * 获取数据类型
212
210
  * @param {Any} obj 需要获取数据类型的值
213
211
  */
214
212
  export const type = (obj) => {
215
- var class2type = {};
213
+ var class2type = {};
216
214
 
217
- // 生成class2type映射
218
- "Boolean Number String Function Array Date RegExp Object Error".split(" ").map(function(item, index) {
219
- class2type["[object " + item + "]"] = item.toLowerCase();
220
- })
221
- if (obj == null) {
222
- return obj + "";
223
- }
224
- return typeof obj === "object" || typeof obj === "function" ?
225
- class2type[Object.prototype.toString.call(obj)] || "object" :
226
- typeof obj;
227
- }
215
+ // 生成class2type映射
216
+ 'Boolean Number String Function Array Date RegExp Object Error'.split(' ').map(function (item, index) {
217
+ class2type['[object ' + item + ']'] = item.toLowerCase();
218
+ });
219
+ if (obj == null) {
220
+ return obj + '';
221
+ }
222
+ return typeof obj === 'object' || typeof obj === 'function' ? class2type[Object.prototype.toString.call(obj)] || 'object' : typeof obj;
223
+ };
228
224
 
229
225
  /**
230
226
  * 判断两个值是否相等
231
- * @param {any} a 值
232
- * @param {any} b 值
227
+ * @param {any} a 值
228
+ * @param {any} b 值
233
229
  * @return {Boolean} 是否相等
234
230
  */
235
231
  export const isEqual = (a, b) => {
236
- //如果a和b本来就全等
237
- if (a === b) {
238
- //判断是否为0和-0
239
- return a !== 0 || 1 / a === 1 / b;
240
- }
241
- //判断是否为null和undefined
242
- if (a == null || b == null) {
243
- return a === b;
244
- }
245
- //接下来判断a和b的数据类型
246
- var classNameA = toString.call(a),
247
- classNameB = toString.call(b);
248
- //如果数据类型不相等,则返回false
249
- if (classNameA !== classNameB) {
250
- return false;
251
- }
252
- //如果数据类型相等,再根据不同数据类型分别判断
253
- switch (classNameA) {
254
- case '[object RegExp]':
255
- case '[object String]':
256
- //进行字符串转换比较
257
- return '' + a === '' + b;
258
- case '[object Number]':
259
- //进行数字转换比较,判断是否为NaN
260
- if (+a !== +a) {
261
- return +b !== +b;
262
- }
263
- //判断是否为0或-0
264
- return +a === 0 ? 1 / +a === 1 / b : +a === +b;
265
- case '[object Date]':
266
- case '[object Boolean]':
267
- return +a === +b;
268
- }
269
- //如果是对象类型
270
- if (classNameA == '[object Object]') {
271
- //获取a和b的属性长度
272
- var propsA = Object.getOwnPropertyNames(a),
273
- propsB = Object.getOwnPropertyNames(b);
274
- if (propsA.length != propsB.length) {
275
- return false;
276
- }
277
- for (var i = 0; i < propsA.length; i++) {
278
- var propName = propsA[i];
279
- //如果对应属性对应值不相等,则返回false
280
- if (a[propName] !== b[propName]) {
281
- return false;
282
- }
283
- }
284
- return true;
285
- }
286
- //如果是数组类型
287
- if (classNameA == '[object Array]') {
288
- if (a.toString() == b.toString()) {
289
- return true;
290
- }
291
- return false;
292
- }
293
- }
232
+ //如果a和b本来就全等
233
+ if (a === b) {
234
+ //判断是否为0和-0
235
+ return a !== 0 || 1 / a === 1 / b;
236
+ }
237
+ //判断是否为null和undefined
238
+ if (a == null || b == null) {
239
+ return a === b;
240
+ }
241
+ //接下来判断a和b的数据类型
242
+ var classNameA = toString.call(a),
243
+ classNameB = toString.call(b);
244
+ //如果数据类型不相等,则返回false
245
+ if (classNameA !== classNameB) {
246
+ return false;
247
+ }
248
+ //如果数据类型相等,再根据不同数据类型分别判断
249
+ switch (classNameA) {
250
+ case '[object RegExp]':
251
+ case '[object String]':
252
+ //进行字符串转换比较
253
+ return '' + a === '' + b;
254
+ case '[object Number]':
255
+ //进行数字转换比较,判断是否为NaN
256
+ if (+a !== +a) {
257
+ return +b !== +b;
258
+ }
259
+ //判断是否为0或-0
260
+ return +a === 0 ? 1 / +a === 1 / b : +a === +b;
261
+ case '[object Date]':
262
+ case '[object Boolean]':
263
+ return +a === +b;
264
+ }
265
+ //如果是对象类型
266
+ if (classNameA == '[object Object]') {
267
+ //获取a和b的属性长度
268
+ var propsA = Object.getOwnPropertyNames(a),
269
+ propsB = Object.getOwnPropertyNames(b);
270
+ if (propsA.length != propsB.length) {
271
+ return false;
272
+ }
273
+ for (var i = 0; i < propsA.length; i++) {
274
+ var propName = propsA[i];
275
+ //如果对应属性对应值不相等,则返回false
276
+ if (a[propName] !== b[propName]) {
277
+ return false;
278
+ }
279
+ }
280
+ return true;
281
+ }
282
+ //如果是数组类型
283
+ if (classNameA == '[object Array]') {
284
+ if (a.toString() == b.toString()) {
285
+ return true;
286
+ }
287
+ return false;
288
+ }
289
+ };