yc-design-vue 1.8.2 → 1.8.4

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 (167) hide show
  1. package/es/Progress/ProgressCircle.vue.js +1 -1
  2. package/es/Typography/TypographyBase.vue.js +2 -2
  3. package/es/_shared/icons/IconCopy.vue.js +17 -1
  4. package/es/_shared/icons/IconCopy.vue2.js +1 -17
  5. package/es/_shared/icons/IconEdit.vue.js +17 -1
  6. package/es/_shared/icons/IconEdit.vue2.js +1 -17
  7. package/es/_shared/icons/IconExclamation.vue.js +1 -28
  8. package/es/_shared/icons/IconExclamation.vue2.js +28 -1
  9. package/es/_shared/locale/i18n.js +6 -5
  10. package/es/_shared/locale/lang/ar-eg.json.js +251 -0
  11. package/es/_shared/locale/lang/de-de.json.d.ts +207 -0
  12. package/es/_shared/locale/lang/de-de.json.js +251 -0
  13. package/es/_shared/locale/lang/en-us.json.d.ts +210 -0
  14. package/es/_shared/locale/lang/en-us.json.js +256 -0
  15. package/es/_shared/locale/lang/es-es.json.d.ts +207 -0
  16. package/es/_shared/locale/lang/es-es.json.js +251 -0
  17. package/es/_shared/locale/lang/fr-fr.json.d.ts +207 -0
  18. package/es/_shared/locale/lang/fr-fr.json.js +251 -0
  19. package/es/_shared/locale/lang/id-id.json.d.ts +207 -0
  20. package/es/_shared/locale/lang/id-id.json.js +251 -0
  21. package/es/_shared/locale/lang/it-it.json.d.ts +207 -0
  22. package/es/_shared/locale/lang/it-it.json.js +251 -0
  23. package/es/_shared/locale/lang/ja-jp.json.d.ts +255 -0
  24. package/es/_shared/locale/lang/ja-jp.json.js +301 -0
  25. package/es/_shared/locale/lang/km-kh.json.d.ts +207 -0
  26. package/es/_shared/locale/lang/km-kh.json.js +251 -0
  27. package/es/_shared/locale/lang/ko-kr.json.d.ts +207 -0
  28. package/es/_shared/locale/lang/ko-kr.json.js +251 -0
  29. package/es/_shared/locale/lang/ms-my.json.d.ts +207 -0
  30. package/es/_shared/locale/lang/ms-my.json.js +251 -0
  31. package/es/_shared/locale/lang/nl-nl.json.d.ts +255 -0
  32. package/es/_shared/locale/lang/nl-nl.json.js +301 -0
  33. package/es/_shared/locale/lang/pt-pt.json.d.ts +207 -0
  34. package/es/_shared/locale/lang/pt-pt.json.js +251 -0
  35. package/es/_shared/locale/lang/ru-ru.json.d.ts +255 -0
  36. package/es/_shared/locale/lang/ru-ru.json.js +301 -0
  37. package/es/_shared/locale/lang/th-th.json.d.ts +207 -0
  38. package/es/_shared/locale/lang/th-th.json.js +251 -0
  39. package/es/_shared/locale/lang/vi-vn.json.d.ts +207 -0
  40. package/es/_shared/locale/lang/vi-vn.json.js +251 -0
  41. package/es/_shared/locale/lang/zh-cn.json.d.ts +255 -0
  42. package/es/_shared/locale/lang/zh-cn.json.js +301 -0
  43. package/es/_shared/locale/lang/zh-tw.json.d.ts +255 -0
  44. package/es/_shared/locale/lang/zh-tw.json.js +301 -0
  45. package/lib/Progress/ProgressCircle.vue.js +1 -1
  46. package/lib/Typography/TypographyBase.vue.js +1 -1
  47. package/lib/_shared/icons/IconCopy.vue.js +1 -1
  48. package/lib/_shared/icons/IconCopy.vue2.js +1 -1
  49. package/lib/_shared/icons/IconEdit.vue.js +1 -1
  50. package/lib/_shared/icons/IconEdit.vue2.js +1 -1
  51. package/lib/_shared/icons/IconExclamation.vue.js +1 -1
  52. package/lib/_shared/icons/IconExclamation.vue2.js +1 -1
  53. package/lib/_shared/locale/i18n.js +1 -1
  54. package/lib/_shared/locale/lang/ar-eg.json.js +1 -0
  55. package/lib/_shared/locale/lang/de-de.json.d.ts +207 -0
  56. package/lib/_shared/locale/lang/de-de.json.js +1 -0
  57. package/lib/_shared/locale/lang/en-us.json.d.ts +210 -0
  58. package/lib/_shared/locale/lang/en-us.json.js +1 -0
  59. package/lib/_shared/locale/lang/es-es.json.d.ts +207 -0
  60. package/lib/_shared/locale/lang/es-es.json.js +1 -0
  61. package/lib/_shared/locale/lang/fr-fr.json.d.ts +207 -0
  62. package/lib/_shared/locale/lang/fr-fr.json.js +1 -0
  63. package/lib/_shared/locale/lang/id-id.json.d.ts +207 -0
  64. package/lib/_shared/locale/lang/id-id.json.js +1 -0
  65. package/lib/_shared/locale/lang/it-it.json.d.ts +207 -0
  66. package/lib/_shared/locale/lang/it-it.json.js +1 -0
  67. package/lib/_shared/locale/lang/ja-jp.json.d.ts +255 -0
  68. package/lib/_shared/locale/lang/ja-jp.json.js +1 -0
  69. package/lib/_shared/locale/lang/km-kh.json.d.ts +207 -0
  70. package/lib/_shared/locale/lang/km-kh.json.js +1 -0
  71. package/lib/_shared/locale/lang/ko-kr.json.d.ts +207 -0
  72. package/lib/_shared/locale/lang/ko-kr.json.js +1 -0
  73. package/lib/_shared/locale/lang/ms-my.json.d.ts +207 -0
  74. package/lib/_shared/locale/lang/ms-my.json.js +1 -0
  75. package/lib/_shared/locale/lang/nl-nl.json.d.ts +255 -0
  76. package/lib/_shared/locale/lang/nl-nl.json.js +1 -0
  77. package/lib/_shared/locale/lang/pt-pt.json.d.ts +207 -0
  78. package/lib/_shared/locale/lang/pt-pt.json.js +1 -0
  79. package/lib/_shared/locale/lang/ru-ru.json.d.ts +255 -0
  80. package/lib/_shared/locale/lang/ru-ru.json.js +1 -0
  81. package/lib/_shared/locale/lang/th-th.json.d.ts +207 -0
  82. package/lib/_shared/locale/lang/th-th.json.js +1 -0
  83. package/lib/_shared/locale/lang/vi-vn.json.d.ts +207 -0
  84. package/lib/_shared/locale/lang/vi-vn.json.js +1 -0
  85. package/lib/_shared/locale/lang/zh-cn.json.d.ts +255 -0
  86. package/lib/_shared/locale/lang/zh-cn.json.js +1 -0
  87. package/lib/_shared/locale/lang/zh-tw.json.d.ts +255 -0
  88. package/lib/_shared/locale/lang/zh-tw.json.js +1 -0
  89. package/package.json +1 -1
  90. package/es/_shared/locale/lang/ar-eg.d.ts +0 -205
  91. package/es/_shared/locale/lang/ar-eg.js +0 -153
  92. package/es/_shared/locale/lang/de-de.d.ts +0 -205
  93. package/es/_shared/locale/lang/de-de.js +0 -153
  94. package/es/_shared/locale/lang/en-us.d.ts +0 -253
  95. package/es/_shared/locale/lang/en-us.js +0 -158
  96. package/es/_shared/locale/lang/es-es.d.ts +0 -205
  97. package/es/_shared/locale/lang/es-es.js +0 -153
  98. package/es/_shared/locale/lang/fr-fr.d.ts +0 -205
  99. package/es/_shared/locale/lang/fr-fr.js +0 -153
  100. package/es/_shared/locale/lang/id-id.d.ts +0 -205
  101. package/es/_shared/locale/lang/id-id.js +0 -153
  102. package/es/_shared/locale/lang/it-it.d.ts +0 -205
  103. package/es/_shared/locale/lang/it-it.js +0 -153
  104. package/es/_shared/locale/lang/ja-jp.d.ts +0 -253
  105. package/es/_shared/locale/lang/ja-jp.js +0 -201
  106. package/es/_shared/locale/lang/km-kh.d.ts +0 -205
  107. package/es/_shared/locale/lang/km-kh.js +0 -153
  108. package/es/_shared/locale/lang/ko-kr.d.ts +0 -205
  109. package/es/_shared/locale/lang/ko-kr.js +0 -153
  110. package/es/_shared/locale/lang/ms-my.d.ts +0 -205
  111. package/es/_shared/locale/lang/ms-my.js +0 -153
  112. package/es/_shared/locale/lang/nl-nl.d.ts +0 -253
  113. package/es/_shared/locale/lang/nl-nl.js +0 -201
  114. package/es/_shared/locale/lang/pt-pt.d.ts +0 -205
  115. package/es/_shared/locale/lang/pt-pt.js +0 -153
  116. package/es/_shared/locale/lang/ru-ru.d.ts +0 -253
  117. package/es/_shared/locale/lang/ru-ru.js +0 -201
  118. package/es/_shared/locale/lang/th-th.d.ts +0 -205
  119. package/es/_shared/locale/lang/th-th.js +0 -153
  120. package/es/_shared/locale/lang/vi-vn.d.ts +0 -205
  121. package/es/_shared/locale/lang/vi-vn.js +0 -153
  122. package/es/_shared/locale/lang/zh-cn.js +0 -201
  123. package/es/_shared/locale/lang/zh-tw.d.ts +0 -253
  124. package/es/_shared/locale/lang/zh-tw.js +0 -201
  125. package/es/node_modules/b-validate/es/is.js +0 -27
  126. package/es/node_modules/b-validate/es/locale/en-US.js +0 -50
  127. package/es/node_modules/b-validate/es/rules/base.js +0 -86
  128. package/es/node_modules/b-validate/es/util.js +0 -25
  129. package/lib/_shared/locale/lang/ar-eg.d.ts +0 -205
  130. package/lib/_shared/locale/lang/ar-eg.js +0 -1
  131. package/lib/_shared/locale/lang/de-de.d.ts +0 -205
  132. package/lib/_shared/locale/lang/de-de.js +0 -1
  133. package/lib/_shared/locale/lang/en-us.d.ts +0 -253
  134. package/lib/_shared/locale/lang/en-us.js +0 -1
  135. package/lib/_shared/locale/lang/es-es.d.ts +0 -205
  136. package/lib/_shared/locale/lang/es-es.js +0 -1
  137. package/lib/_shared/locale/lang/fr-fr.d.ts +0 -205
  138. package/lib/_shared/locale/lang/fr-fr.js +0 -1
  139. package/lib/_shared/locale/lang/id-id.d.ts +0 -205
  140. package/lib/_shared/locale/lang/id-id.js +0 -1
  141. package/lib/_shared/locale/lang/it-it.d.ts +0 -205
  142. package/lib/_shared/locale/lang/it-it.js +0 -1
  143. package/lib/_shared/locale/lang/ja-jp.d.ts +0 -253
  144. package/lib/_shared/locale/lang/ja-jp.js +0 -1
  145. package/lib/_shared/locale/lang/km-kh.d.ts +0 -205
  146. package/lib/_shared/locale/lang/km-kh.js +0 -1
  147. package/lib/_shared/locale/lang/ko-kr.d.ts +0 -205
  148. package/lib/_shared/locale/lang/ko-kr.js +0 -1
  149. package/lib/_shared/locale/lang/ms-my.d.ts +0 -205
  150. package/lib/_shared/locale/lang/ms-my.js +0 -1
  151. package/lib/_shared/locale/lang/nl-nl.d.ts +0 -253
  152. package/lib/_shared/locale/lang/nl-nl.js +0 -1
  153. package/lib/_shared/locale/lang/pt-pt.d.ts +0 -205
  154. package/lib/_shared/locale/lang/pt-pt.js +0 -1
  155. package/lib/_shared/locale/lang/ru-ru.d.ts +0 -253
  156. package/lib/_shared/locale/lang/ru-ru.js +0 -1
  157. package/lib/_shared/locale/lang/th-th.d.ts +0 -205
  158. package/lib/_shared/locale/lang/th-th.js +0 -1
  159. package/lib/_shared/locale/lang/vi-vn.d.ts +0 -205
  160. package/lib/_shared/locale/lang/vi-vn.js +0 -1
  161. package/lib/_shared/locale/lang/zh-cn.js +0 -1
  162. package/lib/_shared/locale/lang/zh-tw.d.ts +0 -253
  163. package/lib/_shared/locale/lang/zh-tw.js +0 -1
  164. package/lib/node_modules/b-validate/es/is.js +0 -1
  165. package/lib/node_modules/b-validate/es/locale/en-US.js +0 -1
  166. package/lib/node_modules/b-validate/es/rules/base.js +0 -1
  167. package/lib/node_modules/b-validate/es/util.js +0 -1
@@ -1,253 +0,0 @@
1
- declare const lang: {
2
- empty: {
3
- description: string;
4
- };
5
- drawer: {
6
- okText: string;
7
- cancelText: string;
8
- };
9
- popconfirm: {
10
- okText: string;
11
- cancelText: string;
12
- };
13
- modal: {
14
- okText: string;
15
- cancelText: string;
16
- };
17
- pagination: {
18
- goto: string;
19
- page: string;
20
- countPerPage: string;
21
- total: string;
22
- };
23
- table: {
24
- okText: string;
25
- resetText: string;
26
- };
27
- upload: {
28
- start: string;
29
- cancel: string;
30
- delete: string;
31
- retry: string;
32
- buttonText: string;
33
- preview: string;
34
- drag: string;
35
- dragHover: string;
36
- error: string;
37
- };
38
- calendar: {
39
- formatYear: string;
40
- formatMonth: string;
41
- today: string;
42
- view: {
43
- month: string;
44
- year: string;
45
- week: string;
46
- day: string;
47
- };
48
- month: {
49
- long: {
50
- January: string;
51
- February: string;
52
- March: string;
53
- April: string;
54
- May: string;
55
- June: string;
56
- July: string;
57
- August: string;
58
- September: string;
59
- October: string;
60
- November: string;
61
- December: string;
62
- };
63
- short: {
64
- January: string;
65
- February: string;
66
- March: string;
67
- April: string;
68
- May: string;
69
- June: string;
70
- July: string;
71
- August: string;
72
- September: string;
73
- October: string;
74
- November: string;
75
- December: string;
76
- };
77
- };
78
- week: {
79
- long: {
80
- self: string;
81
- monday: string;
82
- tuesday: string;
83
- wednesday: string;
84
- thursday: string;
85
- friday: string;
86
- saturday: string;
87
- sunday: string;
88
- };
89
- short: {
90
- self: string;
91
- monday: string;
92
- tuesday: string;
93
- wednesday: string;
94
- thursday: string;
95
- friday: string;
96
- saturday: string;
97
- sunday: string;
98
- };
99
- };
100
- };
101
- datePicker: {
102
- view: {
103
- month: string;
104
- year: string;
105
- week: string;
106
- day: string;
107
- };
108
- month: {
109
- long: {
110
- January: string;
111
- February: string;
112
- March: string;
113
- April: string;
114
- May: string;
115
- June: string;
116
- July: string;
117
- August: string;
118
- September: string;
119
- October: string;
120
- November: string;
121
- December: string;
122
- };
123
- short: {
124
- January: string;
125
- February: string;
126
- March: string;
127
- April: string;
128
- May: string;
129
- June: string;
130
- July: string;
131
- August: string;
132
- September: string;
133
- October: string;
134
- November: string;
135
- December: string;
136
- };
137
- };
138
- week: {
139
- long: {
140
- self: string;
141
- monday: string;
142
- tuesday: string;
143
- wednesday: string;
144
- thursday: string;
145
- friday: string;
146
- saturday: string;
147
- sunday: string;
148
- };
149
- short: {
150
- self: string;
151
- monday: string;
152
- tuesday: string;
153
- wednesday: string;
154
- thursday: string;
155
- friday: string;
156
- saturday: string;
157
- sunday: string;
158
- };
159
- };
160
- placeholder: {
161
- date: string;
162
- week: string;
163
- month: string;
164
- year: string;
165
- quarter: string;
166
- time: string;
167
- };
168
- rangePlaceholder: {
169
- date: string[];
170
- week: string[];
171
- month: string[];
172
- year: string[];
173
- quarter: string[];
174
- time: string[];
175
- };
176
- selectTime: string;
177
- today: string;
178
- now: string;
179
- ok: string;
180
- };
181
- image: {
182
- loading: string;
183
- };
184
- imagePreview: {
185
- fullScreen: string;
186
- rotateRight: string;
187
- rotateLeft: string;
188
- zoomIn: string;
189
- zoomOut: string;
190
- originalSize: string;
191
- };
192
- typography: {
193
- copied: string;
194
- copy: string;
195
- expand: string;
196
- collapse: string;
197
- edit: string;
198
- };
199
- form: {
200
- validateMessages: {
201
- required: string;
202
- type: {
203
- string: string;
204
- number: string;
205
- boolean: string;
206
- array: string;
207
- object: string;
208
- url: string;
209
- email: string;
210
- ip: string;
211
- };
212
- number: {
213
- min: string;
214
- max: string;
215
- equal: string;
216
- range: string;
217
- positive: string;
218
- negative: string;
219
- };
220
- array: {
221
- length: string;
222
- minLength: string;
223
- maxLength: string;
224
- includes: string;
225
- deepEqual: string;
226
- empty: string;
227
- };
228
- string: {
229
- minLength: string;
230
- maxLength: string;
231
- length: string;
232
- match: string;
233
- uppercase: string;
234
- lowercase: string;
235
- };
236
- object: {
237
- deepEqual: string;
238
- hasKeys: string;
239
- empty: string;
240
- };
241
- boolean: {
242
- true: string;
243
- false: string;
244
- };
245
- };
246
- };
247
- colorPicker: {
248
- history: string;
249
- preset: string;
250
- empty: string;
251
- };
252
- };
253
- export default lang;
@@ -1,201 +0,0 @@
1
- const calendarLang = {
2
- formatYear: "YYYY 年",
3
- formatMonth: "YYYY 年 MM 月",
4
- today: "今天",
5
- view: {
6
- month: "月",
7
- year: "年",
8
- week: "周",
9
- day: "日"
10
- },
11
- month: {
12
- long: {
13
- January: "一月",
14
- February: "二月",
15
- March: "三月",
16
- April: "四月",
17
- May: "五月",
18
- June: "六月",
19
- July: "七月",
20
- August: "八月",
21
- September: "九月",
22
- October: "十月",
23
- November: "十一月",
24
- December: "十二月"
25
- },
26
- short: {
27
- January: "一月",
28
- February: "二月",
29
- March: "三月",
30
- April: "四月",
31
- May: "五月",
32
- June: "六月",
33
- July: "七月",
34
- August: "八月",
35
- September: "九月",
36
- October: "十月",
37
- November: "十一月",
38
- December: "十二月"
39
- }
40
- },
41
- week: {
42
- long: {
43
- self: "周",
44
- monday: "周一",
45
- tuesday: "周二",
46
- wednesday: "周三",
47
- thursday: "周四",
48
- friday: "周五",
49
- saturday: "周六",
50
- sunday: "周日"
51
- },
52
- short: {
53
- self: "周",
54
- monday: "一",
55
- tuesday: "二",
56
- wednesday: "三",
57
- thursday: "四",
58
- friday: "五",
59
- saturday: "六",
60
- sunday: "日"
61
- }
62
- }
63
- };
64
- const lang = {
65
- empty: {
66
- description: "無資料"
67
- },
68
- drawer: {
69
- okText: "確認",
70
- cancelText: "取消"
71
- },
72
- popconfirm: {
73
- okText: "確認",
74
- cancelText: "取消"
75
- },
76
- modal: {
77
- okText: "確認",
78
- cancelText: "取消"
79
- },
80
- pagination: {
81
- goto: "前往",
82
- page: "頁",
83
- countPerPage: "項/頁",
84
- total: "共 {0} 項"
85
- },
86
- table: {
87
- okText: "確認",
88
- resetText: "重置"
89
- },
90
- upload: {
91
- start: "開始",
92
- cancel: "取消",
93
- delete: "删除",
94
- retry: "點擊重試",
95
- buttonText: "點擊上傳",
96
- preview: "預覽",
97
- drag: "點擊或拖拽文件到此處上傳",
98
- dragHover: "釋放文件並開始上傳",
99
- error: "上傳失敗"
100
- },
101
- calendar: calendarLang,
102
- datePicker: {
103
- view: calendarLang.view,
104
- month: calendarLang.month,
105
- week: calendarLang.week,
106
- placeholder: {
107
- date: "請選擇日期",
108
- week: "請選擇周",
109
- month: "請選擇月份",
110
- year: "請選擇年份",
111
- quarter: "請選擇季度",
112
- time: "請選擇時間"
113
- },
114
- rangePlaceholder: {
115
- date: ["開始日期", "結束日期"],
116
- week: ["開始周", "結束周"],
117
- month: ["開始月份", "結束月份"],
118
- year: ["開始年份", "結束年份"],
119
- quarter: ["開始季度", "結束季度"],
120
- time: ["開始時間", "結束時間"]
121
- },
122
- selectTime: "選擇時間",
123
- today: "今天",
124
- now: "此刻",
125
- ok: "確認"
126
- },
127
- image: {
128
- loading: "載入中"
129
- },
130
- imagePreview: {
131
- fullScreen: "全屏",
132
- rotateRight: "向右旋轉",
133
- rotateLeft: "向左旋轉",
134
- zoomIn: "放大",
135
- zoomOut: "縮小",
136
- originalSize: "原始尺寸"
137
- },
138
- typography: {
139
- copied: "已複製",
140
- copy: "複製",
141
- expand: "展開",
142
- collapse: "折疊",
143
- edit: "編輯"
144
- },
145
- form: {
146
- validateMessages: {
147
- required: "#{field} 是必填項",
148
- type: {
149
- string: "#{value} 不是合法的文本類型",
150
- number: "#{value} 不是合法的數字類型",
151
- boolean: "#{value} 不是合法的布爾類型",
152
- array: "#{value} 不是合法的數組類型",
153
- object: "#{value} 不是合法的對像類型",
154
- url: "#{value} 不是合法的 url 地址",
155
- email: "#{value} 不是合法的郵箱地址",
156
- ip: "#{value} 不是合法的 IP 地址"
157
- },
158
- number: {
159
- min: "`#{value}` 小於最小值 `#{min}`",
160
- max: "`#{value}` 大於最大值 `#{max}`",
161
- equal: "`#{value}` 不等於 `#{equal}`",
162
- range: "`#{value}` 不在 `#{min} ~ #{max}` 範圍內",
163
- positive: "`#{value}` 不是正數",
164
- negative: "`#{value}` 不是負數"
165
- },
166
- array: {
167
- length: "`#{value}` 個數不等於 #{length}",
168
- minLength: "`#{value}` 個數最少為 #{minLength}",
169
- maxLength: "`#{value}` 個數最多為 #{maxLength}",
170
- includes: "#{value} 不包含 #{includes}",
171
- deepEqual: "#{value} 不等於 #{deepEqual}",
172
- empty: "`#{value}` 不是空數組"
173
- },
174
- string: {
175
- minLength: "字符數最少為 #{minLength}",
176
- maxLength: "字符數最多為 #{maxLength}",
177
- length: "`#{value}` 字符數不等於 #{length}",
178
- match: "`#{value}` 不符合模式 #{pattern}",
179
- uppercase: "`#{value}` 不是全大寫",
180
- lowercase: "`#{value}` 不是全小寫"
181
- },
182
- object: {
183
- deepEqual: "`#{value}` 不等於 #{deepEqual}",
184
- hasKeys: "`#{value}` 不包含字段 #{keys}",
185
- empty: "`#{value}` 不是對象"
186
- },
187
- boolean: {
188
- true: "期望是 `true`",
189
- false: "期望是 `false`"
190
- }
191
- }
192
- },
193
- colorPicker: {
194
- history: "最近使用顏色",
195
- preset: "系統預設顏色",
196
- empty: "暫無"
197
- }
198
- };
199
- export {
200
- lang as default
201
- };
@@ -1,27 +0,0 @@
1
- var opt = Object.prototype.toString;
2
- function isArray(obj) {
3
- return opt.call(obj) === "[object Array]";
4
- }
5
- function isObject(obj) {
6
- return opt.call(obj) === "[object Object]";
7
- }
8
- function isString(obj) {
9
- return opt.call(obj) === "[object String]";
10
- }
11
- function isFunction(obj) {
12
- return opt.call(obj) === "[object Function]";
13
- }
14
- function isEmptyValue(obj) {
15
- return obj === void 0 || obj === null || obj === "";
16
- }
17
- function isEmptyArray(obj) {
18
- return isArray(obj) && !obj.length;
19
- }
20
- export {
21
- isArray,
22
- isEmptyArray,
23
- isEmptyValue,
24
- isFunction,
25
- isObject,
26
- isString
27
- };
@@ -1,50 +0,0 @@
1
- var defaultTypeTemplate = "#{field} is not a #{type} type";
2
- var defaultValidateLocale = {
3
- required: "#{field} is required",
4
- type: {
5
- ip: defaultTypeTemplate,
6
- email: defaultTypeTemplate,
7
- url: defaultTypeTemplate,
8
- string: defaultTypeTemplate,
9
- number: defaultTypeTemplate,
10
- array: defaultTypeTemplate,
11
- object: defaultTypeTemplate,
12
- boolean: defaultTypeTemplate
13
- },
14
- number: {
15
- min: "`#{value}` is not greater than `#{min}`",
16
- max: "`#{value}` is not less than `#{max}`",
17
- equal: "`#{value}` is not equal to `#{equal}`",
18
- range: "`#{value}` is not in range `#{min} ~ #{max}`",
19
- positive: "`#{value}` is not a positive number",
20
- negative: "`#{value}` is not a negative number"
21
- },
22
- string: {
23
- maxLength: "#{field} cannot be longer than #{maxLength} characters",
24
- minLength: "#{field} must be at least #{minLength} characters",
25
- length: "#{field} must be exactly #{length} characters",
26
- match: "`#{value}` does not match pattern #{pattern}",
27
- uppercase: "`#{value}` must be all uppercase",
28
- lowercase: "`#{value}` must be all lowercased"
29
- },
30
- array: {
31
- length: "#{field} must be exactly #{length} in length",
32
- minLength: "#{field} cannot be less than #{minLength} in length",
33
- maxLength: "#{field} cannot be greater than #{maxLength} in length",
34
- includes: "#{field} is not includes #{includes}",
35
- deepEqual: "#{field} is not deep equal with #{deepEqual}",
36
- empty: "#{field} is not an empty array"
37
- },
38
- object: {
39
- deepEqual: "#{field} is not deep equal to expected value",
40
- hasKeys: "#{field} does not contain required fields",
41
- empty: "#{field} is not an empty object"
42
- },
43
- boolean: {
44
- true: "Expect true but got `#{value}`",
45
- false: "Expect false but got `#{value}`"
46
- }
47
- };
48
- export {
49
- defaultValidateLocale as default
50
- };
@@ -1,86 +0,0 @@
1
- import { isObject, isFunction, isString, isArray, isEmptyValue, isEmptyArray } from "../is.js";
2
- import { getTemplate, mergeTemplate } from "../util.js";
3
- import defaultValidateLocale from "../locale/en-US.js";
4
- var Base = function Base2(obj, options) {
5
- var this$1$1 = this;
6
- this.getValidateMsg = function(keyPath, info) {
7
- if (info === void 0) info = {};
8
- var data = Object.assign(Object.assign({}, info), { value: this$1$1.obj, field: this$1$1.field, type: this$1$1.type });
9
- var template = getTemplate(this$1$1.validateMessages, keyPath);
10
- if (isFunction(template)) {
11
- return template(data);
12
- }
13
- if (isString(template)) {
14
- return template.replace(/\#\{.+?\}/g, function(variable) {
15
- var key = variable.slice(2, -1);
16
- if (key in data) {
17
- if (isObject(data[key]) || isArray(data[key])) {
18
- try {
19
- return JSON.stringify(data[key]);
20
- } catch (_) {
21
- return data[key];
22
- }
23
- }
24
- return String(data[key]);
25
- }
26
- return variable;
27
- });
28
- }
29
- return template;
30
- };
31
- if (isObject(options) && isString(obj) && options.trim) {
32
- this.obj = obj.trim();
33
- } else if (isObject(options) && options.ignoreEmptyString && obj === "") {
34
- this.obj = void 0;
35
- } else {
36
- this.obj = obj;
37
- }
38
- this.message = options.message;
39
- this.type = options.type;
40
- this.error = null;
41
- this.field = options.field || options.type;
42
- this.validateMessages = mergeTemplate(defaultValidateLocale, options.validateMessages);
43
- };
44
- var prototypeAccessors = { not: { configurable: true }, isRequired: { configurable: true }, end: { configurable: true } };
45
- prototypeAccessors.not.get = function() {
46
- this._not = !this._not;
47
- return this;
48
- };
49
- prototypeAccessors.isRequired.get = function() {
50
- if (isEmptyValue(this.obj) || isEmptyArray(this.obj)) {
51
- var message = this.getValidateMsg("required");
52
- this.error = {
53
- value: this.obj,
54
- type: this.type,
55
- requiredError: true,
56
- message: this.message || (isObject(message) ? message : (this._not ? "[NOT MODE]:" : "") + message)
57
- };
58
- }
59
- return this;
60
- };
61
- prototypeAccessors.end.get = function() {
62
- return this.error;
63
- };
64
- Base.prototype.addError = function addError(message) {
65
- if (!this.error && message) {
66
- this.error = {
67
- value: this.obj,
68
- type: this.type,
69
- message: this.message || (isObject(message) ? message : (this._not ? "[NOT MODE]:" : "") + message)
70
- };
71
- }
72
- };
73
- Base.prototype.validate = function validate(expression, errorMessage) {
74
- var _expression = this._not ? expression : !expression;
75
- if (_expression) {
76
- this.addError(errorMessage);
77
- }
78
- return this;
79
- };
80
- Base.prototype.collect = function collect(callback) {
81
- callback && callback(this.error);
82
- };
83
- Object.defineProperties(Base.prototype, prototypeAccessors);
84
- export {
85
- Base as default
86
- };
@@ -1,25 +0,0 @@
1
- import { isObject } from "./is.js";
2
- var mergeTemplate = function(defaultValidateMessages, validateMessages) {
3
- var result = Object.assign({}, defaultValidateMessages);
4
- Object.keys(validateMessages || {}).forEach(function(key) {
5
- var defaultValue = result[key];
6
- var newValue = validateMessages === null || validateMessages === void 0 ? void 0 : validateMessages[key];
7
- result[key] = isObject(defaultValue) ? Object.assign(Object.assign({}, defaultValue), newValue) : newValue || defaultValue;
8
- });
9
- return result;
10
- };
11
- var getTemplate = function(validateMessages, keyPath) {
12
- var keys = keyPath.split(".");
13
- var result = validateMessages;
14
- for (var i = 0; i < keys.length; i++) {
15
- result = result && result[keys[i]];
16
- if (result === void 0) {
17
- return result;
18
- }
19
- }
20
- return result;
21
- };
22
- export {
23
- getTemplate,
24
- mergeTemplate
25
- };