amis 1.3.5-beta.7 → 1.4.0

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 (176) hide show
  1. package/lib/components/Badge.d.ts +13 -1
  2. package/lib/components/Badge.js +16 -2
  3. package/lib/components/Badge.js.map +2 -2
  4. package/lib/components/Checkbox.d.ts +1 -1
  5. package/lib/components/Checkbox.js +1 -1
  6. package/lib/components/Checkbox.js.map +2 -2
  7. package/lib/components/Drawer.js +1 -1
  8. package/lib/components/Drawer.js.map +2 -2
  9. package/lib/components/Modal.js +1 -1
  10. package/lib/components/Modal.js.map +2 -2
  11. package/lib/components/Select.d.ts +7 -0
  12. package/lib/components/Select.js.map +2 -2
  13. package/lib/components/Steps.d.ts +3 -3
  14. package/lib/components/Steps.js.map +1 -1
  15. package/lib/components/WithRemoteConfig.d.ts +8 -0
  16. package/lib/components/WithRemoteConfig.js +28 -2
  17. package/lib/components/WithRemoteConfig.js.map +2 -2
  18. package/lib/components/condition-builder/Field.js +0 -1
  19. package/lib/components/condition-builder/Field.js.map +2 -2
  20. package/lib/components/condition-builder/Value.js +2 -1
  21. package/lib/components/condition-builder/Value.js.map +2 -2
  22. package/lib/components/condition-builder/types.d.ts +5 -0
  23. package/lib/components/condition-builder/types.js.map +1 -1
  24. package/lib/factory.d.ts +5 -1
  25. package/lib/factory.js +9 -4
  26. package/lib/factory.js.map +2 -2
  27. package/lib/index.js +1 -1
  28. package/lib/locale/de-DE.js +1 -0
  29. package/lib/locale/de-DE.js.map +2 -2
  30. package/lib/locale/en-US.js +2 -1
  31. package/lib/locale/en-US.js.map +2 -2
  32. package/lib/locale/zh-CN.js +2 -1
  33. package/lib/locale/zh-CN.js.map +2 -2
  34. package/lib/renderers/CRUD.js +5 -15
  35. package/lib/renderers/CRUD.js.map +2 -2
  36. package/lib/renderers/Collapse.d.ts +1 -1
  37. package/lib/renderers/Collapse.js +5 -1
  38. package/lib/renderers/Collapse.js.map +2 -2
  39. package/lib/renderers/Dialog.d.ts +0 -252
  40. package/lib/renderers/Dialog.js +1 -1
  41. package/lib/renderers/Dialog.js.map +2 -2
  42. package/lib/renderers/DropDownButton.d.ts +4 -0
  43. package/lib/renderers/DropDownButton.js +2 -2
  44. package/lib/renderers/DropDownButton.js.map +2 -2
  45. package/lib/renderers/Form/DiffEditor.d.ts +0 -2
  46. package/lib/renderers/Form/Editor.d.ts +0 -2
  47. package/lib/renderers/Form/Editor.js +1 -1
  48. package/lib/renderers/Form/Editor.js.map +2 -2
  49. package/lib/renderers/Form/InputExcel.d.ts +5 -0
  50. package/lib/renderers/Form/InputExcel.js +24 -3
  51. package/lib/renderers/Form/InputExcel.js.map +2 -2
  52. package/lib/renderers/Form/InputImage.d.ts +8 -0
  53. package/lib/renderers/Form/InputImage.js +2 -1
  54. package/lib/renderers/Form/InputImage.js.map +2 -2
  55. package/lib/renderers/Form/InputTable.d.ts +23 -5
  56. package/lib/renderers/Form/InputTable.js +32 -3
  57. package/lib/renderers/Form/InputTable.js.map +2 -2
  58. package/lib/renderers/Json.js +5 -1
  59. package/lib/renderers/Json.js.map +2 -2
  60. package/lib/renderers/Page.js +3 -0
  61. package/lib/renderers/Page.js.map +2 -2
  62. package/lib/renderers/Service.d.ts +10 -1
  63. package/lib/renderers/Service.js +85 -3
  64. package/lib/renderers/Service.js.map +2 -2
  65. package/lib/renderers/Steps.d.ts +4 -4
  66. package/lib/renderers/Steps.js +5 -2
  67. package/lib/renderers/Steps.js.map +2 -2
  68. package/lib/renderers/Table/TableBody.d.ts +1 -1
  69. package/lib/renderers/Table/TableBody.js.map +1 -1
  70. package/lib/renderers/Table/TableContent.d.ts +1 -1
  71. package/lib/renderers/Table/TableContent.js.map +1 -1
  72. package/lib/renderers/Table/index.d.ts +8 -3
  73. package/lib/renderers/Table/index.js +80 -45
  74. package/lib/renderers/Table/index.js.map +2 -2
  75. package/lib/store/app.d.ts +0 -1
  76. package/lib/store/combo.d.ts +0 -2
  77. package/lib/store/crud.d.ts +0 -1
  78. package/lib/store/form.d.ts +0 -1
  79. package/lib/store/modal.d.ts +1 -1
  80. package/lib/store/modal.js +4 -0
  81. package/lib/store/modal.js.map +2 -2
  82. package/lib/store/root.d.ts +0 -1
  83. package/lib/store/service.d.ts +0 -1
  84. package/lib/store/service.js +0 -13
  85. package/lib/store/service.js.map +2 -2
  86. package/lib/store/table.d.ts +1 -2
  87. package/lib/store/table.js +44 -3
  88. package/lib/store/table.js.map +2 -2
  89. package/lib/themes/ang-ie11.css +247 -3
  90. package/lib/themes/ang.css +247 -3
  91. package/lib/themes/ang.css.map +1 -1
  92. package/lib/themes/antd-ie11.css +247 -3
  93. package/lib/themes/antd.css +247 -3
  94. package/lib/themes/antd.css.map +1 -1
  95. package/lib/themes/cxd-ie11.css +247 -3
  96. package/lib/themes/cxd.css +247 -3
  97. package/lib/themes/cxd.css.map +1 -1
  98. package/lib/themes/dark-ie11.css +247 -3
  99. package/lib/themes/dark.css +247 -3
  100. package/lib/themes/dark.css.map +1 -1
  101. package/lib/themes/default.css +247 -3
  102. package/lib/themes/default.css.map +1 -1
  103. package/lib/utils/api.js +12 -0
  104. package/lib/utils/api.js.map +2 -2
  105. package/lib/utils/attachmentAdpator.d.ts +7 -0
  106. package/lib/utils/attachmentAdpator.js +82 -0
  107. package/lib/utils/attachmentAdpator.js.map +13 -0
  108. package/lib/utils/validations.js +62 -5
  109. package/lib/utils/validations.js.map +2 -2
  110. package/package.json +1 -1
  111. package/schema.json +150 -36
  112. package/scss/_properties.scss +4 -0
  113. package/scss/components/_badge.scss +15 -1
  114. package/scss/components/_markdown.scss +266 -0
  115. package/scss/components/_spinner.scss +6 -2
  116. package/scss/components/form/_group.scss +4 -0
  117. package/scss/themes/_common.scss +1 -0
  118. package/sdk/ang-ie11.css +292 -3
  119. package/sdk/ang.css +296 -3
  120. package/sdk/antd-ie11.css +292 -3
  121. package/sdk/antd.css +296 -3
  122. package/sdk/charts.js +13 -13
  123. package/sdk/color-picker.js +65 -69
  124. package/sdk/cropperjs.js +2 -2
  125. package/sdk/cxd-ie11.css +292 -3
  126. package/sdk/cxd.css +296 -3
  127. package/sdk/dark-ie11.css +292 -3
  128. package/sdk/dark.css +296 -3
  129. package/sdk/exceljs.js +1 -1
  130. package/sdk/locale/de-DE.js +1 -0
  131. package/sdk/markdown.js +69 -69
  132. package/sdk/papaparse.js +1 -1
  133. package/sdk/renderers/Form/CityDB.js +1 -1
  134. package/sdk/rest.js +27 -23
  135. package/sdk/rich-text.js +63 -63
  136. package/sdk/sdk-ie11.css +292 -3
  137. package/sdk/sdk.css +296 -3
  138. package/sdk/sdk.js +1144 -1142
  139. package/sdk/thirds/hls.js/hls.js +1 -1
  140. package/sdk/thirds/mpegts.js/mpegts.js +1 -1
  141. package/sdk/tinymce.js +57 -57
  142. package/src/components/Badge.tsx +41 -6
  143. package/src/components/Checkbox.tsx +5 -2
  144. package/src/components/Drawer.tsx +3 -2
  145. package/src/components/Modal.tsx +3 -2
  146. package/src/components/Select.tsx +1 -0
  147. package/src/components/Steps.tsx +3 -3
  148. package/src/components/WithRemoteConfig.tsx +37 -2
  149. package/src/components/condition-builder/Field.tsx +1 -2
  150. package/src/components/condition-builder/Value.tsx +3 -0
  151. package/src/components/condition-builder/types.ts +6 -0
  152. package/src/factory.tsx +13 -3
  153. package/src/locale/de-DE.ts +1 -0
  154. package/src/locale/en-US.ts +2 -1
  155. package/src/locale/zh-CN.ts +2 -1
  156. package/src/renderers/CRUD.tsx +7 -28
  157. package/src/renderers/Collapse.tsx +5 -1
  158. package/src/renderers/Dialog.tsx +1 -1
  159. package/src/renderers/DropDownButton.tsx +8 -0
  160. package/src/renderers/Form/Editor.tsx +19 -20
  161. package/src/renderers/Form/InputExcel.tsx +28 -3
  162. package/src/renderers/Form/InputImage.tsx +23 -8
  163. package/src/renderers/Form/InputTable.tsx +88 -9
  164. package/src/renderers/Json.tsx +10 -1
  165. package/src/renderers/Page.tsx +2 -0
  166. package/src/renderers/Service.tsx +101 -3
  167. package/src/renderers/Steps.tsx +12 -9
  168. package/src/renderers/Table/TableBody.tsx +1 -1
  169. package/src/renderers/Table/TableContent.tsx +1 -1
  170. package/src/renderers/Table/index.tsx +61 -13
  171. package/src/store/modal.ts +4 -0
  172. package/src/store/service.ts +0 -19
  173. package/src/store/table.ts +48 -0
  174. package/src/utils/api.ts +11 -0
  175. package/src/utils/attachmentAdpator.ts +90 -0
  176. package/src/utils/validations.ts +80 -12
@@ -984,11 +984,16 @@ export const TableStore = iRendererStore
984
984
  }
985
985
  }
986
986
 
987
+ // 记录最近一次点击的多选框,主要用于 shift 多选时判断上一个选的是什么
988
+ let lastCheckedRow: any = null;
989
+
987
990
  function toggle(row: IRow) {
988
991
  if (!row.checkable) {
989
992
  return;
990
993
  }
991
994
 
995
+ lastCheckedRow = row;
996
+
992
997
  const idx = self.selectedRows.indexOf(row);
993
998
 
994
999
  if (self.multiple) {
@@ -1000,6 +1005,48 @@ export const TableStore = iRendererStore
1000
1005
  }
1001
1006
  }
1002
1007
 
1008
+ // 按住 shift 的时候点击选项
1009
+ function toggleShift(row: IRow) {
1010
+ // 如果是同一个或非 multiple 模式下就和不用 shift 一样
1011
+ if (!lastCheckedRow || row === lastCheckedRow || !self.multiple) {
1012
+ toggle(row);
1013
+ return;
1014
+ }
1015
+
1016
+ const maxLength = self.maxKeepItemSelectionLength;
1017
+ const checkableRows = self.checkableRows;
1018
+ const lastCheckedRowIndex = checkableRows.findIndex(
1019
+ row => row === lastCheckedRow
1020
+ );
1021
+ const rowIndex = checkableRows.findIndex(rowItem => row === rowItem);
1022
+ const minIndex =
1023
+ lastCheckedRowIndex > rowIndex ? rowIndex : lastCheckedRowIndex;
1024
+ const maxIndex =
1025
+ lastCheckedRowIndex > rowIndex ? lastCheckedRowIndex : rowIndex;
1026
+
1027
+ const rows = checkableRows.slice(minIndex, maxIndex);
1028
+ rows.push(row); // 将当前行也加入进行判断
1029
+ for (const rowItem of rows) {
1030
+ const idx = self.selectedRows.indexOf(rowItem);
1031
+ if (idx === -1) {
1032
+ // 如果上一个是选中状态,则将之间的所有 check 都变成可选
1033
+ if (lastCheckedRow.checked) {
1034
+ if (maxLength && self.selectedRows.length < maxLength) {
1035
+ self.selectedRows.push(rowItem);
1036
+ } else {
1037
+ self.selectedRows.push(rowItem);
1038
+ }
1039
+ }
1040
+ } else {
1041
+ if (!lastCheckedRow.checked) {
1042
+ self.selectedRows.splice(idx, 1);
1043
+ }
1044
+ }
1045
+ }
1046
+
1047
+ lastCheckedRow = row;
1048
+ }
1049
+
1003
1050
  function updateCheckDisable() {
1004
1051
  if (!self.data) {
1005
1052
  return;
@@ -1134,6 +1181,7 @@ export const TableStore = iRendererStore
1134
1181
  updateSelected,
1135
1182
  toggleAll,
1136
1183
  toggle,
1184
+ toggleShift,
1137
1185
  toggleExpandAll,
1138
1186
  toggleExpanded,
1139
1187
  collapseAllAtDepth,
package/src/utils/api.ts CHANGED
@@ -22,6 +22,8 @@ interface ApiCacheConfig extends ApiObject {
22
22
 
23
23
  const apiCaches: Array<ApiCacheConfig> = [];
24
24
 
25
+ const isIE = !!(document as any).documentMode;
26
+
25
27
  export function normalizeApi(
26
28
  api: Api,
27
29
  defaultMethod: string = 'get'
@@ -293,6 +295,15 @@ export function wrapFetcher(
293
295
  api
294
296
  );
295
297
  }
298
+ // IE 下 get 请求会被缓存,所以自动加个时间戳
299
+ if (isIE && api && api.method?.toLocaleLowerCase() === 'get') {
300
+ const timeStamp = `_t=${Date.now()}`;
301
+ if (api.url.indexOf('?') === -1) {
302
+ api.url = api.url + `?${timeStamp}`;
303
+ } else {
304
+ api.url = api.url + `&${timeStamp}`;
305
+ }
306
+ }
296
307
  return wrapAdaptor(fn(api), api);
297
308
  };
298
309
  }
@@ -0,0 +1,90 @@
1
+ /**
2
+ * 处理接口返回附件的情况,好几个地方用
3
+ * @param response
4
+ * @param __
5
+ * @returns
6
+ */
7
+
8
+ export default function attachmentAdpator(response: any, __: Function) {
9
+ if (response && response.headers && response.headers['content-disposition']) {
10
+ const disposition = response.headers['content-disposition'];
11
+ let filename = '';
12
+
13
+ if (disposition && disposition.indexOf('attachment') !== -1) {
14
+ // disposition 有可能是 attachment; filename="??.xlsx"; filename*=UTF-8''%E4%B8%AD%E6%96%87.xlsx
15
+ // 这种情况下最后一个才是正确的文件名
16
+ let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)$/;
17
+
18
+ let matches = disposition.match(filenameRegex);
19
+ if (matches && matches.length) {
20
+ filename = matches[1].replace(`UTF-8''`, '').replace(/['"]/g, '');
21
+ }
22
+
23
+ // 很可能是中文被 url-encode 了
24
+ if (filename && filename.replace(/[^%]/g, '').length > 2) {
25
+ filename = decodeURIComponent(filename);
26
+ }
27
+
28
+ let type = response.headers['content-type'];
29
+ let blob =
30
+ response.data.toString() === '[object Blob]'
31
+ ? response.data
32
+ : new Blob([response.data], {type: type});
33
+ if (typeof (window.navigator as any).msSaveBlob !== 'undefined') {
34
+ // IE workaround for "HTML7007: One or more blob URLs were revoked by closing the blob for which they were created. These URLs will no longer resolve as the data backing the URL has been freed."
35
+ (window.navigator as any).msSaveBlob(blob, filename);
36
+ } else {
37
+ let URL = window.URL || (window as any).webkitURL;
38
+ let downloadUrl = URL.createObjectURL(blob);
39
+ if (filename) {
40
+ // use HTML5 a[download] attribute to specify filename
41
+ let a = document.createElement('a');
42
+ // safari doesn't support this yet
43
+ if (typeof a.download === 'undefined') {
44
+ (window as any).location = downloadUrl;
45
+ } else {
46
+ a.href = downloadUrl;
47
+ a.download = filename;
48
+ document.body.appendChild(a);
49
+ a.click();
50
+ }
51
+ } else {
52
+ (window as any).location = downloadUrl;
53
+ }
54
+ setTimeout(function () {
55
+ URL.revokeObjectURL(downloadUrl);
56
+ }, 100); // cleanup
57
+ }
58
+
59
+ return {
60
+ ...response,
61
+ data: {
62
+ status: 0,
63
+ msg: __('Embed.downloading')
64
+ }
65
+ };
66
+ }
67
+ } else if (response.data.toString() === '[object Blob]') {
68
+ return new Promise((resolve, reject) => {
69
+ let reader = new FileReader();
70
+ reader.addEventListener('loadend', e => {
71
+ const text = reader.result as string;
72
+
73
+ try {
74
+ resolve({
75
+ ...response,
76
+ data: {
77
+ ...JSON.parse(text)
78
+ }
79
+ });
80
+ } catch (e) {
81
+ reject(e);
82
+ }
83
+ });
84
+
85
+ reader.readAsText(response.data);
86
+ });
87
+ }
88
+
89
+ return response;
90
+ }
@@ -14,6 +14,79 @@ const makeRegexp = (reg: string | RegExp) => {
14
14
 
15
15
  return /^$/;
16
16
  };
17
+ import memoize from 'lodash/memoize';
18
+ import isPlainObject from 'lodash/isPlainObject';
19
+
20
+ const makeUrlRegexp = memoize(function (options: any) {
21
+ options = {
22
+ schemes: ['http', 'https', 'ftp', 'sftp'],
23
+ allowLocal: true,
24
+ allowDataUrl: false,
25
+ ...(isPlainObject(options) ? options : {})
26
+ };
27
+
28
+ // https://github.com/ansman/validate.js/blob/master/validate.js#L1098-L1164
29
+ let {schemes, allowLocal, allowDataUrl} = options;
30
+
31
+ if (!Array.isArray(schemes)) {
32
+ schemes = ['http', 'https', 'ftp', 'sftp'];
33
+ }
34
+
35
+ let regex =
36
+ '^' +
37
+ // protocol identifier
38
+ '(?:(?:' +
39
+ schemes.join('|') +
40
+ ')://)' +
41
+ // user:pass authentication
42
+ '(?:\\S+(?::\\S*)?@)?' +
43
+ '(?:';
44
+
45
+ var tld = '(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))';
46
+
47
+ if (allowLocal) {
48
+ tld += '?';
49
+ } else {
50
+ regex +=
51
+ // IP address exclusion
52
+ // private & local networks
53
+ '(?!(?:10|127)(?:\\.\\d{1,3}){3})' +
54
+ '(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})' +
55
+ '(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})';
56
+ }
57
+
58
+ regex +=
59
+ // IP address dotted notation octets
60
+ // excludes loopback network 0.0.0.0
61
+ // excludes reserved space >= 224.0.0.0
62
+ // excludes network & broacast addresses
63
+ // (first & last IP address of each class)
64
+ '(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])' +
65
+ '(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}' +
66
+ '(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))' +
67
+ '|' +
68
+ // host name
69
+ '(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)' +
70
+ // domain name
71
+ '(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*' +
72
+ tld +
73
+ ')' +
74
+ // port number
75
+ '(?::\\d{2,5})?' +
76
+ // resource path
77
+ '(?:[/?#]\\S*)?' +
78
+ '$';
79
+
80
+ if (allowDataUrl) {
81
+ // RFC 2397
82
+ var mediaType = '\\w+\\/[-+.\\w]+(?:;[\\w=]+)*';
83
+ var urlchar = "[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*";
84
+ var dataurl = 'data:(?:' + mediaType + ')?(?:;base64)?,' + urlchar;
85
+ regex = '(?:' + regex + ')|(?:^' + dataurl + '$)';
86
+ }
87
+
88
+ return new RegExp(regex, 'i');
89
+ });
17
90
 
18
91
  export interface ValidateFn {
19
92
  (
@@ -55,12 +128,8 @@ export const validations: {
55
128
  /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i
56
129
  );
57
130
  },
58
- isUrl: function (values, value) {
59
- return validations.matchRegexp(
60
- values,
61
- value,
62
- /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
63
- );
131
+ isUrl: function (values, value, options) {
132
+ return validations.matchRegexp(values, value, makeUrlRegexp(options));
64
133
  },
65
134
  isTrue: function (values, value) {
66
135
  return value === true;
@@ -282,9 +351,8 @@ export function validate(
282
351
  }
283
352
 
284
353
  const fn = validations[ruleName];
285
- const args = (Array.isArray(rules[ruleName])
286
- ? rules[ruleName]
287
- : [rules[ruleName]]
354
+ const args = (
355
+ Array.isArray(rules[ruleName]) ? rules[ruleName] : [rules[ruleName]]
288
356
  ).map((item: any) => {
289
357
  if (typeof item === 'string' && isPureVariable(item)) {
290
358
  return resolveVariableAndFilter(item, values, '|raw');
@@ -356,9 +424,9 @@ const splitValidations = function (str: string): Array<string> {
356
424
  .map(str => (/^__\d+$/.test(str) ? placeholder[str] : str.trim()));
357
425
  };
358
426
 
359
- export function str2rules(
360
- validations: string | {[propName: string]: any}
361
- ): {[propName: string]: any} {
427
+ export function str2rules(validations: string | {[propName: string]: any}): {
428
+ [propName: string]: any;
429
+ } {
362
430
  if (typeof validations === 'string') {
363
431
  return validations
364
432
  ? splitValidations(validations).reduce(function (