@tongfun/tf-widget 0.1.21 → 0.1.22

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 (94) hide show
  1. package/README.md +49 -49
  2. package/lib/tf-widget.common.js +547 -503
  3. package/lib/tf-widget.css +1 -1
  4. package/lib/tf-widget.umd.js +547 -503
  5. package/lib/tf-widget.umd.min.js +4 -4
  6. package/package/svg-icon/index.js +8 -8
  7. package/package/svg-icon/src/SvgIcon.vue +59 -59
  8. package/package/t-data-list/index.js +6 -6
  9. package/package/t-data-list/main.vue +193 -193
  10. package/package/t-data-list/src/condition-input/basic.vue +31 -31
  11. package/package/t-data-list/src/condition-input/date.vue +106 -106
  12. package/package/t-data-list/src/condition-input/index.vue +100 -100
  13. package/package/t-data-list/src/condition-input/input.vue +31 -31
  14. package/package/t-data-list/src/condition-input/number.vue +115 -115
  15. package/package/t-data-list/src/condition-input/select.vue +86 -86
  16. package/package/t-data-list/src/js/fieldTypeEnum.js +10 -10
  17. package/package/t-data-list/src/js/operatorEnum.js +108 -108
  18. package/package/t-data-list/src/js/qureyParamsEnum.js +4 -4
  19. package/package/t-data-list/src/js/util.js +34 -34
  20. package/package/t-data-list/src/mixins/button-controll-mixin.js +93 -93
  21. package/package/t-data-list/src/pushdown/push-down.vue +158 -158
  22. package/package/t-data-list/src/t-list-search.vue +36 -36
  23. package/package/t-data-list/src/t-plan/condition-always-item.vue +143 -143
  24. package/package/t-data-list/src/t-plan/condition-mult-item.vue +222 -222
  25. package/package/t-data-list/src/t-plan/index.vue +195 -195
  26. package/package/t-data-list/src/t-plan/plan-content.vue +389 -389
  27. package/package/t-data-list/src/t-table/index.vue +129 -129
  28. package/package/t-data-list/src/t-table/table-group-item-edit.vue +238 -238
  29. package/package/t-data-list/src/t-table/table-group-item.vue +87 -87
  30. package/package/t-data-list/src/t-table/table-group.vue +180 -180
  31. package/package/t-data-list/src/t-table/table-records-header-popover.vue +246 -246
  32. package/package/t-data-list/src/t-table/table-records-selected.vue +159 -159
  33. package/package/t-data-list/src/t-table/table-records.vue +337 -337
  34. package/package/t-input/children/address.vue +101 -101
  35. package/package/t-input/children/basic-display.vue +41 -41
  36. package/package/t-input/children/basic.vue +253 -253
  37. package/package/t-input/children/date.vue +89 -89
  38. package/package/t-input/children/group-components/group-dialog.vue +344 -344
  39. package/package/t-input/children/group.vue +126 -126
  40. package/package/t-input/children/input.vue +72 -72
  41. package/package/t-input/children/number.vue +74 -74
  42. package/package/t-input/children/select.vue +89 -89
  43. package/package/t-input/children/tfile/fiile-enclosure.vue +233 -233
  44. package/package/t-input/index.js +7 -7
  45. package/package/t-input/index.vue +337 -337
  46. package/package/t-input/tInputCache.js +24 -24
  47. package/package/tf-icon-picker/README.md +7 -7
  48. package/package/tf-icon-picker/index.js +8 -8
  49. package/package/tf-icon-picker/src/tf-icon-picker.vue +266 -266
  50. package/package/tf-layout/README.md +115 -115
  51. package/package/tf-layout/index.js +8 -8
  52. package/package/tf-layout/src/components/tf-labelbar.vue +394 -394
  53. package/package/tf-layout/src/components/tf-menu.vue +180 -180
  54. package/package/tf-layout/src/components/tf-right-menu.vue +89 -89
  55. package/package/tf-layout/src/components/tf-rotate-box.vue +50 -50
  56. package/package/tf-layout/src/tf-layout.vue +140 -140
  57. package/package/tf-widget/index.js +8 -8
  58. package/package/tf-widget/src/assets/common-input.less +10 -10
  59. package/package/tf-widget/src/children/basic-data/basic-data.vue +361 -361
  60. package/package/tf-widget/src/children/basic-data/dependcy/basic-data-selector.vue +1087 -1087
  61. package/package/tf-widget/src/children/basic-data/dependcy/common-table.vue +750 -750
  62. package/package/tf-widget/src/children/basic-data/dependcy/condition-filter.vue +519 -519
  63. package/package/tf-widget/src/children/basic-data/dependcy/pagination.vue +93 -93
  64. package/package/tf-widget/src/children/basic-data/dependcy/table-control.vue +240 -240
  65. package/package/tf-widget/src/children/basic-data/dependcy/view-picture.vue +108 -108
  66. package/package/tf-widget/src/children/date-time.vue +103 -103
  67. package/package/tf-widget/src/children/date.vue +103 -103
  68. package/package/tf-widget/src/children/decimal.vue +115 -115
  69. package/package/tf-widget/src/children/integer.vue +104 -104
  70. package/package/tf-widget/src/children/property.vue +59 -59
  71. package/package/tf-widget/src/children/single-line-text.vue +82 -82
  72. package/package/tf-widget/src/children/small-pictures.vue +223 -223
  73. package/package/tf-widget/src/children/text-area.vue +74 -74
  74. package/package/tf-widget/src/children/tf-select.vue +113 -113
  75. package/package/tf-widget/src/tf-widget.vue +175 -175
  76. package/package.json +44 -44
  77. package/src/api/edit.js +97 -97
  78. package/src/api/file-enclosure.js +26 -26
  79. package/src/api/push-down.js +19 -19
  80. package/src/api/table.js +294 -294
  81. package/src/api/tableV3.js +166 -160
  82. package/src/assets/images/icons/index.js +9 -9
  83. package/src/assets/images/icons/svg/add.svg +5 -5
  84. package/src/assets/images/icons/svg/push-down.svg +1 -1
  85. package/src/assets/images/icons/svg/remove.svg +1 -1
  86. package/src/assets/styles/common-table.less +202 -202
  87. package/src/directives/debounce.js +24 -24
  88. package/src/index.js +31 -31
  89. package/src/mixins/t-data-query-mixin.js +290 -290
  90. package/src/utils/auth.js +22 -22
  91. package/src/utils/request.js +42 -42
  92. package/src/utils/stato-anormale.js +59 -59
  93. package/src/utils/utils.js +109 -109
  94. package/src/utils/validate.js +84 -84
@@ -1,42 +1,42 @@
1
- import axios from 'axios'
2
- import { statusCode } from './stato-anormale'
3
- import { Base64 } from 'js-base64'
4
- import { getToken } from '@/utils/auth'
5
- import { Message } from 'element-ui'
6
- const clientId = 'tongfuncloud_web'
7
- const clientSecret = 'tongfuncloud_web_secret'
8
- axios.defaults.headers['Content-type'] = 'application/json'
9
-
10
- const service = axios.create({
11
- withCredentials: true, // send cookies when cross-domain requests
12
- timeout: 15000 // request timeout
13
- })
14
- // request interceptor
15
- service.interceptors.request.use(
16
- config => {
17
- config.headers['client-type'] = 'WEB'
18
- config.headers.token = 'Bearer ' + getToken()
19
- config.headers.Authorization = `Basic ${Base64.encode(`${clientId}:${clientSecret}`)}`
20
- // 测试组件时使用下方头部信息,过期则修改后再测试
21
- // config.headers.token = 'Bearer eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJtb2JpbGUiOiIxMzE1MTYyODY1NyIsIm5hbWUiOiLmnLHmmI7mmI4iLCJ0b2tlbl90eXBlIjoidG9rZW4iLCJwVXNlcmlkIjoiMTM2ODg0NjcxOTU3OTU4NjU2MSIsInVzZXJpZCI6IjE0MTczNjg0NjMwODg4MTIwMzIiLCJ0ZW5hbnQiOiIwMDAxIiwiYWNjb3VudCI6InpodW1pbmdtaW5nIiwiaWF0IjoxNjM2MDgxNzM1LCJuYmYiOjE2MzYwODE3MzUsImV4cCI6MTYzNjExMDUzNX0.TTSbWUYTOd6znNko8sNyKz9KqLyeyO5AC4WgBvVNvBo'
22
- // config.headers.Authorization = 'Basic dG9uZ2Z1bmNsb3VkX3dlYjp0b25nZnVuY2xvdWRfd2ViX3NlY3JldA=='
23
- return config
24
- },
25
- error => {
26
- return Promise.reject(error)
27
- }
28
- )
29
- service.interceptors.response.use(
30
- response => {
31
- return response.data
32
- },
33
- error => {
34
- const { response } = error
35
- if (response.status === 400) {
36
- return Message.error(response.data.msg)
37
- }
38
- if (statusCode[response.data.code]) Message.error(statusCode[response.data.code])
39
- }
40
- )
41
-
42
- export default service
1
+ import axios from 'axios'
2
+ import { statusCode } from './stato-anormale'
3
+ import { Base64 } from 'js-base64'
4
+ import { getToken } from '@/utils/auth'
5
+ import { Message } from 'element-ui'
6
+ const clientId = 'tongfuncloud_web'
7
+ const clientSecret = 'tongfuncloud_web_secret'
8
+ axios.defaults.headers['Content-type'] = 'application/json'
9
+
10
+ const service = axios.create({
11
+ withCredentials: true, // send cookies when cross-domain requests
12
+ timeout: 15000 // request timeout
13
+ })
14
+ // request interceptor
15
+ service.interceptors.request.use(
16
+ config => {
17
+ config.headers['client-type'] = 'WEB'
18
+ config.headers.token = 'Bearer ' + getToken()
19
+ config.headers.Authorization = `Basic ${Base64.encode(`${clientId}:${clientSecret}`)}`
20
+ // 测试组件时使用下方头部信息,过期则修改后再测试
21
+ // config.headers.token = 'Bearer eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJtb2JpbGUiOiIxMzE1MTYyODY1NyIsIm5hbWUiOiLmnLHmmI7mmI4iLCJ0b2tlbl90eXBlIjoidG9rZW4iLCJwVXNlcmlkIjoiMTM2ODg0NjcxOTU3OTU4NjU2MSIsInVzZXJpZCI6IjE0MTczNjg0NjMwODg4MTIwMzIiLCJ0ZW5hbnQiOiIwMDAxIiwiYWNjb3VudCI6InpodW1pbmdtaW5nIiwiaWF0IjoxNjM2MDgxNzM1LCJuYmYiOjE2MzYwODE3MzUsImV4cCI6MTYzNjExMDUzNX0.TTSbWUYTOd6znNko8sNyKz9KqLyeyO5AC4WgBvVNvBo'
22
+ // config.headers.Authorization = 'Basic dG9uZ2Z1bmNsb3VkX3dlYjp0b25nZnVuY2xvdWRfd2ViX3NlY3JldA=='
23
+ return config
24
+ },
25
+ error => {
26
+ return Promise.reject(error)
27
+ }
28
+ )
29
+ service.interceptors.response.use(
30
+ response => {
31
+ return response.data
32
+ },
33
+ error => {
34
+ const { response } = error
35
+ if (response.status === 400) {
36
+ return Message.error(response.data.msg)
37
+ }
38
+ if (statusCode[response.data.code]) Message.error(statusCode[response.data.code])
39
+ }
40
+ )
41
+
42
+ export default service
@@ -1,59 +1,59 @@
1
- export const statusCode = {
2
- '-2': '系统繁忙~请稍后再试~',
3
- '-3': '参数类型解析异常',
4
- '-4': '运行SQL出现异常',
5
- '-5': '空指针异常',
6
- '-6': '无效参数异常',
7
- '-7': '请求类型异常',
8
- '-8': '加载资源出错',
9
- '-9': '统一验证参数异常',
10
- '-10': '操作异常',
11
- '-11': 'Mapper类转换异常',
12
- '-12': '验证码校验失败',
13
- '-13': 'JSON解析异常',
14
- 401: '未认证',
15
- 403: '被禁止',
16
- 404: '未找到资源',
17
- 405: '不支持当前请求类型',
18
- 429: '请求超过次数限制',
19
- 500: '内部服务错误',
20
- 502: '网关出错啦!',
21
- 504: '请求网关超时',
22
- 1001: '请求中必须至少包含一个有效文件',
23
- 2000: '新增数据失败!',
24
- 2001: '修改数据失败!',
25
- 2002: '批量新增数据过多!',
26
- 40000: '无效的基本身份验证令牌',
27
- 40001: '会话超时,请重新登录!',
28
- 40002: '不合法的token,请认真比对 token 的签名!',
29
- 40003: '缺少token参数!',
30
- 40004: '生成token失败!',
31
- 40005: '解析用户身份错误,请重新登录!',
32
- 40006: '用户名或密码错误!',
33
- 40007: '用户已经被禁用!',
34
- 40008: '您已在另一个设备登录!',
35
- 40009: '请先登录!',
36
- 40029: '无效的oauth_code!',
37
- 41027: '账号与密码不匹配,请重新输入!',
38
- 41028: '该账户已被禁用,请联系平台客服!',
39
- 41029: '用户不存在!',
40
- 41030: '参数异常!',
41
- 41031: '注册方式错误!',
42
- 41032: '用户已存在但未认证!',
43
- 41034: '手机号已被其他用户绑定!',
44
- 41035: '短信验证码输入错误!',
45
- 41036: '邮箱验证码输入错误!',
46
- 41037: '图形验证码验证错误!',
47
- 41040: '新增数据失败!',
48
- 41041: '修改数据失败!',
49
- 41042: '身份证号码不合法!',
50
- 41043: '用户实名认证次数超过限制,请联系客服!',
51
- 41044: '该身份证号码已被绑定,请联系客服!',
52
- 41045: '身份验证失败!',
53
- 41046: '姓名和身份证号不一致!',
54
- 41100: '该企业中不存在你的用户信息,请核实你的租户信息!',
55
- 41101: '你已被所在的租户禁止进入!',
56
- 41105: '租户信息不存在!',
57
- 49000: 'token转换获取失败!',
58
- 49001: '验证码错误!'
59
- }
1
+ export const statusCode = {
2
+ '-2': '系统繁忙~请稍后再试~',
3
+ '-3': '参数类型解析异常',
4
+ '-4': '运行SQL出现异常',
5
+ '-5': '空指针异常',
6
+ '-6': '无效参数异常',
7
+ '-7': '请求类型异常',
8
+ '-8': '加载资源出错',
9
+ '-9': '统一验证参数异常',
10
+ '-10': '操作异常',
11
+ '-11': 'Mapper类转换异常',
12
+ '-12': '验证码校验失败',
13
+ '-13': 'JSON解析异常',
14
+ 401: '未认证',
15
+ 403: '被禁止',
16
+ 404: '未找到资源',
17
+ 405: '不支持当前请求类型',
18
+ 429: '请求超过次数限制',
19
+ 500: '内部服务错误',
20
+ 502: '网关出错啦!',
21
+ 504: '请求网关超时',
22
+ 1001: '请求中必须至少包含一个有效文件',
23
+ 2000: '新增数据失败!',
24
+ 2001: '修改数据失败!',
25
+ 2002: '批量新增数据过多!',
26
+ 40000: '无效的基本身份验证令牌',
27
+ 40001: '会话超时,请重新登录!',
28
+ 40002: '不合法的token,请认真比对 token 的签名!',
29
+ 40003: '缺少token参数!',
30
+ 40004: '生成token失败!',
31
+ 40005: '解析用户身份错误,请重新登录!',
32
+ 40006: '用户名或密码错误!',
33
+ 40007: '用户已经被禁用!',
34
+ 40008: '您已在另一个设备登录!',
35
+ 40009: '请先登录!',
36
+ 40029: '无效的oauth_code!',
37
+ 41027: '账号与密码不匹配,请重新输入!',
38
+ 41028: '该账户已被禁用,请联系平台客服!',
39
+ 41029: '用户不存在!',
40
+ 41030: '参数异常!',
41
+ 41031: '注册方式错误!',
42
+ 41032: '用户已存在但未认证!',
43
+ 41034: '手机号已被其他用户绑定!',
44
+ 41035: '短信验证码输入错误!',
45
+ 41036: '邮箱验证码输入错误!',
46
+ 41037: '图形验证码验证错误!',
47
+ 41040: '新增数据失败!',
48
+ 41041: '修改数据失败!',
49
+ 41042: '身份证号码不合法!',
50
+ 41043: '用户实名认证次数超过限制,请联系客服!',
51
+ 41044: '该身份证号码已被绑定,请联系客服!',
52
+ 41045: '身份验证失败!',
53
+ 41046: '姓名和身份证号不一致!',
54
+ 41100: '该企业中不存在你的用户信息,请核实你的租户信息!',
55
+ 41101: '你已被所在的租户禁止进入!',
56
+ 41105: '租户信息不存在!',
57
+ 49000: 'token转换获取失败!',
58
+ 49001: '验证码错误!'
59
+ }
@@ -1,109 +1,109 @@
1
- const util = (function util () {
2
- 'use strict'
3
- /**
4
- * @method
5
- * @description 函数防抖
6
- * @param func 防抖函数
7
- * @param wait 函数出发时间间隔
8
- * @param immediate 何时触发函数
9
- * @returns {function(): *}
10
- */
11
- function debounce (func, wait, immediate) {
12
- if (typeof func !== 'function') throw new TypeError('func must be a function!')
13
- if (typeof wait === 'undefined') {
14
- wait = 500
15
- immediate = false
16
- }
17
- if (typeof wait === 'boolean') {
18
- immediate = wait
19
- wait = 500
20
- }
21
- if (typeof wait !== 'number') throw new TypeError('wait must be a number!')
22
- if (typeof immediate !== 'boolean') throw new TypeError('immediate must be a boolean!')
23
-
24
- var timer = null
25
- var result
26
- return function proxy () {
27
- var self = this
28
- var params = [].slice.call(arguments)
29
- var callNow = !timer && immediate
30
- if (timer) clearTimeout(timer)
31
- timer = setTimeout(function () {
32
- // 清除最后一次定时器
33
- clearTimeout(timer)
34
- timer = null
35
- if (!immediate) result = func.apply(self, params)
36
- }, wait)
37
- // 符合第一次立即执行「触发在开始的边界」
38
- if (callNow) result = func.apply(self, params)
39
- return result
40
- }
41
- }
42
-
43
- /**
44
- * @method
45
- * @description 函数节流
46
- * @param func 节流函数
47
- * @param wait 等待执行时间
48
- * @returns {function(): (*)}
49
- */
50
- function throttle (func, wait) {
51
- if (typeof func !== 'function') throw new TypeError('func must be a function!')
52
- wait = +wait
53
- if (isNaN(wait)) wait = 300
54
- var timer = null
55
- var previous = 0
56
- var result
57
- return function proxy () {
58
- var self = this
59
- var params = [].slice.call(arguments)
60
- var now = +new Date()
61
- var remaining = wait - (now - previous)
62
- if (remaining <= 0) {
63
- // 两次间隔时间已经超过WAIT了,此时我们立即执行
64
- if (timer) {
65
- clearTimeout(timer)
66
- timer = null
67
- }
68
- previous = now
69
- result = func.apply(self, params)
70
- return result
71
- }
72
- if (!timer) {
73
- timer = setTimeout(function () {
74
- clearTimeout(timer)
75
- timer = null
76
- previous = +new Date()
77
- result = func.apply(self, params)
78
- }, remaining)
79
- }
80
- return result
81
- }
82
- }
83
- function randomNum (len, radix) {
84
- const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
85
- const uuid = []
86
- radix = radix || chars.length
87
- if (len) {
88
- for (let i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]
89
- } else {
90
- let r
91
- uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
92
- uuid[14] = '4'
93
- for (let i = 0; i < 36; i++) {
94
- if (!uuid[i]) {
95
- r = 0 | Math.random() * 16
96
- uuid[i] = chars[(i === 19) ? (r & 0x3) | 0x8 : r]
97
- }
98
- }
99
- }
100
- return uuid.join('') + new Date().getTime()
101
- }
102
-
103
- return {
104
- debounce,
105
- throttle,
106
- randomNum
107
- }
108
- })()
109
- export default util
1
+ const util = (function util () {
2
+ 'use strict'
3
+ /**
4
+ * @method
5
+ * @description 函数防抖
6
+ * @param func 防抖函数
7
+ * @param wait 函数出发时间间隔
8
+ * @param immediate 何时触发函数
9
+ * @returns {function(): *}
10
+ */
11
+ function debounce (func, wait, immediate) {
12
+ if (typeof func !== 'function') throw new TypeError('func must be a function!')
13
+ if (typeof wait === 'undefined') {
14
+ wait = 500
15
+ immediate = false
16
+ }
17
+ if (typeof wait === 'boolean') {
18
+ immediate = wait
19
+ wait = 500
20
+ }
21
+ if (typeof wait !== 'number') throw new TypeError('wait must be a number!')
22
+ if (typeof immediate !== 'boolean') throw new TypeError('immediate must be a boolean!')
23
+
24
+ var timer = null
25
+ var result
26
+ return function proxy () {
27
+ var self = this
28
+ var params = [].slice.call(arguments)
29
+ var callNow = !timer && immediate
30
+ if (timer) clearTimeout(timer)
31
+ timer = setTimeout(function () {
32
+ // 清除最后一次定时器
33
+ clearTimeout(timer)
34
+ timer = null
35
+ if (!immediate) result = func.apply(self, params)
36
+ }, wait)
37
+ // 符合第一次立即执行「触发在开始的边界」
38
+ if (callNow) result = func.apply(self, params)
39
+ return result
40
+ }
41
+ }
42
+
43
+ /**
44
+ * @method
45
+ * @description 函数节流
46
+ * @param func 节流函数
47
+ * @param wait 等待执行时间
48
+ * @returns {function(): (*)}
49
+ */
50
+ function throttle (func, wait) {
51
+ if (typeof func !== 'function') throw new TypeError('func must be a function!')
52
+ wait = +wait
53
+ if (isNaN(wait)) wait = 300
54
+ var timer = null
55
+ var previous = 0
56
+ var result
57
+ return function proxy () {
58
+ var self = this
59
+ var params = [].slice.call(arguments)
60
+ var now = +new Date()
61
+ var remaining = wait - (now - previous)
62
+ if (remaining <= 0) {
63
+ // 两次间隔时间已经超过WAIT了,此时我们立即执行
64
+ if (timer) {
65
+ clearTimeout(timer)
66
+ timer = null
67
+ }
68
+ previous = now
69
+ result = func.apply(self, params)
70
+ return result
71
+ }
72
+ if (!timer) {
73
+ timer = setTimeout(function () {
74
+ clearTimeout(timer)
75
+ timer = null
76
+ previous = +new Date()
77
+ result = func.apply(self, params)
78
+ }, remaining)
79
+ }
80
+ return result
81
+ }
82
+ }
83
+ function randomNum (len, radix) {
84
+ const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
85
+ const uuid = []
86
+ radix = radix || chars.length
87
+ if (len) {
88
+ for (let i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]
89
+ } else {
90
+ let r
91
+ uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
92
+ uuid[14] = '4'
93
+ for (let i = 0; i < 36; i++) {
94
+ if (!uuid[i]) {
95
+ r = 0 | Math.random() * 16
96
+ uuid[i] = chars[(i === 19) ? (r & 0x3) | 0x8 : r]
97
+ }
98
+ }
99
+ }
100
+ return uuid.join('') + new Date().getTime()
101
+ }
102
+
103
+ return {
104
+ debounce,
105
+ throttle,
106
+ randomNum
107
+ }
108
+ })()
109
+ export default util
@@ -1,84 +1,84 @@
1
- /* eslint-disable */
2
- /**
3
- * @param {string} path
4
- * @returns {Boolean}
5
- */
6
- export function isExternal (path) {
7
- return /^(https?:|mailto:|tel:)/.test(path)
8
- }
9
-
10
- /**
11
- * @param {string} str
12
- * @returns {Boolean}
13
- */
14
- export function validUsername (str) {
15
- const valid_map = ['admin', 'editor']
16
- return valid_map.indexOf(str.trim()) >= 0
17
- }
18
-
19
- /**
20
- * @param {string} url
21
- * @returns {Boolean}
22
- */
23
- export function validURL (url) {
24
- const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
25
- return reg.test(url)
26
- }
27
-
28
- /**
29
- * @param {string} str
30
- * @returns {Boolean}
31
- */
32
- export function validLowerCase (str) {
33
- const reg = /^[a-z]+$/
34
- return reg.test(str)
35
- }
36
-
37
- /**
38
- * @param {string} str
39
- * @returns {Boolean}
40
- */
41
- export function validUpperCase (str) {
42
- const reg = /^[A-Z]+$/
43
- return reg.test(str)
44
- }
45
-
46
- /**
47
- * @param {string} str
48
- * @returns {Boolean}
49
- */
50
- export function validAlphabets (str) {
51
- const reg = /^[A-Za-z]+$/
52
- return reg.test(str)
53
- }
54
-
55
- /**
56
- * @param {string} email
57
- * @returns {Boolean}
58
- */
59
- export function validEmail (email) {
60
- const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
61
- return reg.test(email)
62
- }
63
-
64
- /**
65
- * @param {string} str
66
- * @returns {Boolean}
67
- */
68
- export function isString (str) {
69
- if (typeof str === 'string' || str instanceof String) {
70
- return true
71
- }
72
- return false
73
- }
74
-
75
- /**
76
- * @param {Array} arg
77
- * @returns {Boolean}
78
- */
79
- export function isArray (arg) {
80
- if (typeof Array.isArray === 'undefined') {
81
- return Object.prototype.toString.call(arg) === '[object Array]'
82
- }
83
- return Array.isArray(arg)
84
- }
1
+ /* eslint-disable */
2
+ /**
3
+ * @param {string} path
4
+ * @returns {Boolean}
5
+ */
6
+ export function isExternal (path) {
7
+ return /^(https?:|mailto:|tel:)/.test(path)
8
+ }
9
+
10
+ /**
11
+ * @param {string} str
12
+ * @returns {Boolean}
13
+ */
14
+ export function validUsername (str) {
15
+ const valid_map = ['admin', 'editor']
16
+ return valid_map.indexOf(str.trim()) >= 0
17
+ }
18
+
19
+ /**
20
+ * @param {string} url
21
+ * @returns {Boolean}
22
+ */
23
+ export function validURL (url) {
24
+ const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
25
+ return reg.test(url)
26
+ }
27
+
28
+ /**
29
+ * @param {string} str
30
+ * @returns {Boolean}
31
+ */
32
+ export function validLowerCase (str) {
33
+ const reg = /^[a-z]+$/
34
+ return reg.test(str)
35
+ }
36
+
37
+ /**
38
+ * @param {string} str
39
+ * @returns {Boolean}
40
+ */
41
+ export function validUpperCase (str) {
42
+ const reg = /^[A-Z]+$/
43
+ return reg.test(str)
44
+ }
45
+
46
+ /**
47
+ * @param {string} str
48
+ * @returns {Boolean}
49
+ */
50
+ export function validAlphabets (str) {
51
+ const reg = /^[A-Za-z]+$/
52
+ return reg.test(str)
53
+ }
54
+
55
+ /**
56
+ * @param {string} email
57
+ * @returns {Boolean}
58
+ */
59
+ export function validEmail (email) {
60
+ const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
61
+ return reg.test(email)
62
+ }
63
+
64
+ /**
65
+ * @param {string} str
66
+ * @returns {Boolean}
67
+ */
68
+ export function isString (str) {
69
+ if (typeof str === 'string' || str instanceof String) {
70
+ return true
71
+ }
72
+ return false
73
+ }
74
+
75
+ /**
76
+ * @param {Array} arg
77
+ * @returns {Boolean}
78
+ */
79
+ export function isArray (arg) {
80
+ if (typeof Array.isArray === 'undefined') {
81
+ return Object.prototype.toString.call(arg) === '[object Array]'
82
+ }
83
+ return Array.isArray(arg)
84
+ }