@jiangood/springboot-admin-starter 0.0.2 → 0.0.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 (266) hide show
  1. package/config/dist/config.js +32 -0
  2. package/config/dist/index.js +0 -1
  3. package/config/dist/plugins/form-plugin.js +2 -2
  4. package/package.json +12 -10
  5. package/src/forms/demoForm.jsx +5 -5
  6. package/src/framework/components/DownloadFileButton.jsx +2 -2
  7. package/src/framework/components/Ellipsis.jsx +2 -2
  8. package/src/framework/components/LinkButton.d.ts +4 -4
  9. package/src/framework/components/LinkButton.jsx +6 -9
  10. package/src/framework/components/Page/index.jsx +2 -2
  11. package/src/framework/components/PageLoading.tsx +27 -0
  12. package/src/framework/components/ProTable/components/ToolBar/index.jsx +6 -7
  13. package/src/framework/components/ProTable/index.d.ts +5 -1
  14. package/src/framework/components/ProTable/index.jsx +4 -6
  15. package/src/framework/components/ProTable/index.less +0 -1
  16. package/src/framework/components/ValueType/registry.jsx +9 -20
  17. package/src/framework/components/{index.js → index.ts} +2 -10
  18. package/src/framework/components/system/ButtonList.jsx +35 -0
  19. package/src/framework/components/system/HasPerm.tsx +14 -0
  20. package/src/framework/components/system/index.tsx +29 -0
  21. package/src/framework/components/view/ViewBooleanEnableDisable.tsx +20 -0
  22. package/src/framework/components/view/ViewEllipsis.jsx +2 -2
  23. package/src/framework/components/view/ViewFile.jsx +1 -2
  24. package/src/framework/components/view/ViewImage.jsx +2 -3
  25. package/src/framework/components/view/ViewText.tsx +16 -0
  26. package/src/framework/components/view/{index.js → index.ts} +0 -2
  27. package/src/framework/field-components/FieldBoolean.d.ts +13 -0
  28. package/src/framework/field-components/FieldBoolean.jsx +76 -0
  29. package/src/framework/field-components/FieldDate.d.ts +25 -0
  30. package/src/framework/field-components/FieldDate.jsx +109 -0
  31. package/src/framework/field-components/FieldDateRange.d.ts +6 -0
  32. package/src/framework/field-components/FieldDateRange.jsx +101 -0
  33. package/src/framework/field-components/FieldDictSelect.d.ts +13 -0
  34. package/src/framework/field-components/FieldDictSelect.jsx +16 -0
  35. package/src/framework/field-components/FieldEditor.d.ts +10 -0
  36. package/src/framework/field-components/FieldEditor.jsx +58 -0
  37. package/src/framework/field-components/FieldPercent.d.ts +12 -0
  38. package/src/framework/field-components/FieldPercent.jsx +27 -0
  39. package/src/framework/field-components/FieldRemoteSelect.d.ts +13 -0
  40. package/src/framework/field-components/FieldRemoteSelect.jsx +87 -0
  41. package/src/framework/field-components/FieldRemoteSelectMultiple.d.ts +13 -0
  42. package/src/framework/field-components/FieldRemoteSelectMultiple.jsx +86 -0
  43. package/src/framework/field-components/FieldRemoteSelectMultipleInline.d.ts +20 -0
  44. package/src/framework/field-components/FieldRemoteSelectMultipleInline.jsx +86 -0
  45. package/src/framework/field-components/FieldRemoteTree.d.ts +21 -0
  46. package/src/framework/field-components/FieldRemoteTree.jsx +45 -0
  47. package/src/framework/field-components/FieldRemoteTreeCascader.d.ts +23 -0
  48. package/src/framework/field-components/FieldRemoteTreeCascader.jsx +61 -0
  49. package/src/framework/field-components/FieldRemoteTreeSelect.d.ts +17 -0
  50. package/src/framework/field-components/FieldRemoteTreeSelect.jsx +67 -0
  51. package/src/framework/field-components/FieldRemoteTreeSelectMultiple.d.ts +17 -0
  52. package/src/framework/field-components/FieldRemoteTreeSelectMultiple.jsx +68 -0
  53. package/src/framework/field-components/FieldSysOrgTree.d.ts +12 -0
  54. package/src/framework/field-components/FieldSysOrgTree.jsx +23 -0
  55. package/src/framework/field-components/FieldSysOrgTreeSelect.d.ts +12 -0
  56. package/src/framework/field-components/FieldSysOrgTreeSelect.jsx +23 -0
  57. package/src/framework/{components/field/FieldEditTable/index.d.ts → field-components/FieldTable.d.ts} +5 -2
  58. package/src/framework/{components/field/FieldEditTable/index.jsx → field-components/FieldTable.jsx} +29 -21
  59. package/src/framework/{components/field/select/FieldTableSelect/index.d.ts → field-components/FieldTableSelect.d.ts} +4 -14
  60. package/src/framework/field-components/FieldTableSelect.jsx +59 -0
  61. package/src/framework/{components/field/upload → field-components}/FieldUploadFile.d.ts +0 -1
  62. package/src/framework/{components/field/upload → field-components}/FieldUploadFile.jsx +5 -9
  63. package/src/framework/field-components/index.ts +20 -0
  64. package/src/framework/{components/OrgTree.jsx → field-components/system/OrgTree.tsx} +8 -7
  65. package/src/framework/{components/RoleTree.jsx → field-components/system/RoleTree.tsx} +3 -3
  66. package/src/framework/field-components/system/index.ts +2 -0
  67. package/src/framework/index.ts +4 -0
  68. package/src/framework/utils/ArrUtils.ts +229 -0
  69. package/src/framework/utils/ColorsUtils.ts +378 -0
  70. package/src/framework/utils/{date.js → DateUtils.ts} +69 -69
  71. package/src/framework/utils/DeviceUtils.ts +46 -0
  72. package/src/framework/utils/DomUtils.ts +50 -0
  73. package/src/framework/utils/EventBusUtils.ts +143 -0
  74. package/src/framework/utils/MessageUtils.tsx +182 -0
  75. package/src/framework/utils/ObjectUtils.ts +113 -0
  76. package/src/framework/utils/StorageUtils.ts +67 -0
  77. package/src/framework/utils/StringUtils.ts +410 -0
  78. package/src/framework/utils/TreeUtils.ts +248 -0
  79. package/src/framework/utils/UrlUtils.ts +152 -0
  80. package/src/framework/utils/UuidUtils.ts +88 -0
  81. package/src/framework/utils/ValidateUtils.ts +28 -0
  82. package/src/framework/utils/index.ts +16 -0
  83. package/src/framework/utils/system/DictUtils.ts +97 -0
  84. package/src/framework/utils/system/FormRegistryUtils.ts +77 -0
  85. package/src/framework/utils/system/HttpUtils.ts +246 -0
  86. package/src/framework/utils/system/PageUtils.ts +153 -0
  87. package/src/framework/utils/system/PermUtils.ts +79 -0
  88. package/src/framework/utils/system/SysUtils.ts +97 -0
  89. package/src/framework/utils/system/ThemeUtils.ts +27 -0
  90. package/src/framework/utils/system/index.ts +7 -0
  91. package/src/framework/view-components/ViewBoolean.jsx +4 -0
  92. package/src/framework/view-components/index.js +3 -0
  93. package/src/layouts/PageRender.jsx +2 -2
  94. package/src/layouts/admin/HeaderRight.jsx +9 -9
  95. package/src/layouts/admin/TabPageRender.jsx +2 -2
  96. package/src/layouts/admin/index.jsx +27 -40
  97. package/src/layouts/admin/index.less +2 -1
  98. package/src/layouts/index.jsx +30 -38
  99. package/src/layouts/index.less +0 -21
  100. package/src/loading.jsx +2 -2
  101. package/src/{components → pages/flowable}/InstanceInfo.jsx +5 -4
  102. package/src/pages/flowable/design/customTranslate/customTranslate.js +16 -0
  103. package/src/pages/flowable/design/customTranslate/translations-properties-panel.js +10 -0
  104. package/src/pages/flowable/design/customTranslate/translations.js +144 -0
  105. package/src/pages/flowable/design/descriptors/flowable.json +1109 -0
  106. package/src/pages/flowable/design/index.jsx +61 -234
  107. package/src/pages/flowable/design/provider/FlowablePropertiesProvider.js +75 -0
  108. package/src/pages/flowable/design/provider/index.js +6 -0
  109. package/src/pages/flowable/design/provider/properties/ConditionDesign.jsx +175 -0
  110. package/src/pages/flowable/design/provider/properties/ConditionProps.jsx +76 -0
  111. package/src/pages/flowable/design/provider/properties/DelegateExpressionProps.js +54 -0
  112. package/src/pages/flowable/design/provider/properties/FormProps.js +55 -0
  113. package/src/pages/flowable/design/provider/properties/MultiInstanceProps.js +100 -0
  114. package/src/pages/flowable/design/provider/properties/UserTaskForm.jsx +48 -0
  115. package/src/pages/flowable/design/provider/properties/utils.jsx +35 -0
  116. package/src/pages/flowable/index.jsx +28 -69
  117. package/src/pages/flowable/monitor/definition.jsx +87 -0
  118. package/src/pages/flowable/monitor/instance/index.jsx +177 -0
  119. package/src/pages/flowable/monitor/instance/view.jsx +102 -0
  120. package/src/pages/flowable/monitor/task.jsx +93 -0
  121. package/src/pages/flowable/task/form.jsx +5 -5
  122. package/src/pages/flowable/task/index.jsx +5 -5
  123. package/src/pages/flowable/test/index.jsx +13 -10
  124. package/src/pages/index.jsx +8 -13
  125. package/src/pages/login.jsx +8 -8
  126. package/src/pages/{api/doc.jsx → system/api/ApiDoc.jsx} +56 -47
  127. package/src/pages/system/api/index.jsx +268 -0
  128. package/src/pages/system/api/perm.jsx +69 -0
  129. package/src/pages/system/config/index.jsx +3 -3
  130. package/src/pages/system/dict/Dict.jsx +2 -3
  131. package/src/pages/system/dict/DictItem.jsx +5 -5
  132. package/src/pages/system/file/index.jsx +13 -5
  133. package/src/pages/{job → system/job}/index.jsx +124 -39
  134. package/src/pages/system/log/index.jsx +3 -3
  135. package/src/pages/system/org/index.jsx +11 -12
  136. package/src/pages/system/role/index.jsx +11 -11
  137. package/src/pages/system/role/perm.jsx +8 -8
  138. package/src/pages/system/sysManual/index.jsx +6 -6
  139. package/src/pages/system/user/UserPerm.jsx +7 -42
  140. package/src/pages/system/user/index.jsx +13 -17
  141. package/src/pages/test.jsx +188 -3
  142. package/src/pages/ureport/index.jsx +4 -4
  143. package/src/pages/userCenter/ChangePassword.jsx +3 -4
  144. package/src/pages/userCenter/index.jsx +2 -2
  145. package/src/pages/userCenter/manual.jsx +3 -7
  146. package/src/pages/userCenter/message.jsx +5 -5
  147. package/config/dist/config.local.js +0 -23
  148. package/src/components/InstanceStatusInfo.jsx +0 -79
  149. package/src/components/StreamLog.jsx +0 -27
  150. package/src/components/flow/BpmnUtils.js +0 -85
  151. package/src/components/flow/customTranslate/customTranslate.js +0 -19
  152. package/src/components/flow/customTranslate/translations.js +0 -79
  153. package/src/components/flow/design/form/ConditionForm.jsx +0 -316
  154. package/src/components/flow/design/form/ServiceTaskForm.jsx +0 -55
  155. package/src/components/flow/design/form/TimerEventDefinitionForm.jsx +0 -62
  156. package/src/components/flow/design/form/UserTaskForm.jsx +0 -211
  157. package/src/components/flow/design/palette.js +0 -39
  158. package/src/components/monitor/AllDefinition.jsx +0 -46
  159. package/src/components/monitor/AllInstance.jsx +0 -76
  160. package/src/forms/driverForm.jsx +0 -18
  161. package/src/framework/components/ButtonList.jsx +0 -91
  162. package/src/framework/components/Echarts/index.d.ts +0 -10
  163. package/src/framework/components/Echarts/index.jsx +0 -49
  164. package/src/framework/components/EditTable/index.d.ts +0 -11
  165. package/src/framework/components/EditTable/index.jsx +0 -85
  166. package/src/framework/components/FieldRemoteTree.jsx +0 -20
  167. package/src/framework/components/HasPerm.jsx +0 -18
  168. package/src/framework/components/ImageView.d.ts +0 -12
  169. package/src/framework/components/ImageView.jsx +0 -64
  170. package/src/framework/components/MsgBox.jsx +0 -180
  171. package/src/framework/components/PageLoading.jsx +0 -31
  172. package/src/framework/components/Panel/index.d.ts +0 -11
  173. package/src/framework/components/Panel/index.jsx +0 -24
  174. package/src/framework/components/Panel/index.less +0 -0
  175. package/src/framework/components/field/FieldAutoTime/index.tsx +0 -46
  176. package/src/framework/components/field/FieldBoolean/index.tsx +0 -92
  177. package/src/framework/components/field/FieldEditTable/index.less +0 -29
  178. package/src/framework/components/field/FieldEditor.jsx +0 -48
  179. package/src/framework/components/field/FieldFileBase64/index.d.ts +0 -15
  180. package/src/framework/components/field/FieldFileBase64/index.jsx +0 -23
  181. package/src/framework/components/field/FieldImageBase64/index.d.ts +0 -15
  182. package/src/framework/components/field/FieldImageBase64/index.jsx +0 -22
  183. package/src/framework/components/field/FieldInput.jsx +0 -13
  184. package/src/framework/components/field/FieldOrgTree/index.tsx +0 -45
  185. package/src/framework/components/field/FieldPassword.jsx +0 -11
  186. package/src/framework/components/field/FieldProps.ts +0 -19
  187. package/src/framework/components/field/FieldRemoteTreeCascader.jsx +0 -75
  188. package/src/framework/components/field/FieldRemoteTreeCheckable.jsx +0 -81
  189. package/src/framework/components/field/FieldRemoteTreeMultipleSelect.jsx +0 -100
  190. package/src/framework/components/field/FieldRemoteTreeSelect.jsx +0 -82
  191. package/src/framework/components/field/FieldSelectPosition/index.tsx +0 -85
  192. package/src/framework/components/field/FieldTree.jsx +0 -45
  193. package/src/framework/components/field/dict/index.tsx +0 -110
  194. package/src/framework/components/field/flat-multiple-select/index.d.ts +0 -4
  195. package/src/framework/components/field/flat-multiple-select/index.jsx +0 -116
  196. package/src/framework/components/field/flat-multiple-select/index.less +0 -12
  197. package/src/framework/components/field/flat-select/index.d.ts +0 -4
  198. package/src/framework/components/field/flat-select/index.jsx +0 -107
  199. package/src/framework/components/field/flat-select/index.less +0 -12
  200. package/src/framework/components/field/index.js +0 -33
  201. package/src/framework/components/field/input-number-percent/index.d.ts +0 -11
  202. package/src/framework/components/field/input-number-percent/index.jsx +0 -28
  203. package/src/framework/components/field/select/FieldSelect/index.d.ts +0 -39
  204. package/src/framework/components/field/select/FieldSelect/index.jsx +0 -156
  205. package/src/framework/components/field/select/FieldTableSelect/index.jsx +0 -155
  206. package/src/framework/components/field/select/index.jsx +0 -2
  207. package/src/framework/components/field/switch-y-n/index.d.ts +0 -11
  208. package/src/framework/components/field/switch-y-n/index.jsx +0 -31
  209. package/src/framework/components/field/text/index.tsx +0 -7
  210. package/src/framework/components/field/time/DatePickerString.tsx +0 -37
  211. package/src/framework/components/field/time/DateTimePickerString.tsx +0 -42
  212. package/src/framework/components/field/time/FieldDateRange.d.ts +0 -9
  213. package/src/framework/components/field/time/FieldDateRange.jsx +0 -49
  214. package/src/framework/components/field/time/HHmmPickerString.tsx +0 -42
  215. package/src/framework/components/field/time/MonthPickerString.tsx +0 -45
  216. package/src/framework/components/field/time/TimePickerTool.ts +0 -14
  217. package/src/framework/components/field/time/YearPickerString.tsx +0 -41
  218. package/src/framework/components/field/time/YearQuarterString.tsx +0 -38
  219. package/src/framework/components/field/time/index.tsx +0 -7
  220. package/src/framework/components/field/upload/FieldUploadCropImage/index.d.ts +0 -22
  221. package/src/framework/components/field/upload/FieldUploadCropImage/index.jsx +0 -11
  222. package/src/framework/components/field/upload/FieldUploadImage.d.ts +0 -7
  223. package/src/framework/components/field/upload/FieldUploadImage.jsx +0 -16
  224. package/src/framework/components/field/upload/index.jsx +0 -3
  225. package/src/framework/components/system.jsx +0 -29
  226. package/src/framework/components/view/ViewBoolean.jsx +0 -15
  227. package/src/framework/components/view/ViewBooleanEnableDisable.jsx +0 -16
  228. package/src/framework/components/view/ViewText.jsx +0 -9
  229. package/src/framework/index.js +0 -3
  230. package/src/framework/system/dict.js +0 -88
  231. package/src/framework/system/formRegistry.js +0 -58
  232. package/src/framework/system/http.jsx +0 -290
  233. package/src/framework/system/index.js +0 -13
  234. package/src/framework/system/page.js +0 -109
  235. package/src/framework/system/permission.js +0 -44
  236. package/src/framework/system/sys.js +0 -60
  237. package/src/framework/system/theme.js +0 -17
  238. package/src/framework/utils/arr.js +0 -118
  239. package/src/framework/utils/browser.js +0 -24
  240. package/src/framework/utils/color.js +0 -269
  241. package/src/framework/utils/debounce.js +0 -33
  242. package/src/framework/utils/dom.js +0 -16
  243. package/src/framework/utils/eventBus.js +0 -70
  244. package/src/framework/utils/html.js +0 -13
  245. package/src/framework/utils/index.js +0 -17
  246. package/src/framework/utils/obj.js +0 -72
  247. package/src/framework/utils/storage.js +0 -37
  248. package/src/framework/utils/str.js +0 -297
  249. package/src/framework/utils/tree.js +0 -175
  250. package/src/framework/utils/uid.js +0 -76
  251. package/src/framework/utils/url.js +0 -84
  252. package/src/framework/utils/validate.js +0 -9
  253. package/src/pages/api/accessLog/index.jsx +0 -108
  254. package/src/pages/api/accountResource/index.jsx +0 -149
  255. package/src/pages/api/index.jsx +0 -163
  256. package/src/pages/api/resource.jsx +0 -18
  257. package/src/pages/flowable/instance/view.jsx +0 -13
  258. package/src/pages/flowable/monitor.jsx +0 -106
  259. package/src/pages/flowable/test/form.jsx +0 -31
  260. package/src/pages/job/logList.jsx +0 -100
  261. package/src/pages/job/status.jsx +0 -84
  262. /package/src/framework/components/{ButtonList.d.ts → system/ButtonList.d.ts} +0 -0
  263. /package/src/framework/{components/EditTable/index.less → field-components/FieldTable.less} +0 -0
  264. /package/src/framework/{components/view → view-components}/ViewPassword.jsx +0 -0
  265. /package/src/{index.js → index.ts} +0 -0
  266. /package/src/{components/flow → pages/flowable}/design/contextPad.js +0 -0
@@ -1,118 +0,0 @@
1
- export const ArrUtil = {
2
-
3
- contains(arr, item) {
4
- return arr.indexOf(item) !== -1;
5
- },
6
- containsAny(arr, ...items) {
7
- for (let item of items) {
8
- if (this.contains(item)) {
9
- return true
10
- }
11
- }
12
- return false;
13
- },
14
-
15
- add(arr, item) {
16
- arr.push(item)
17
- },
18
-
19
- addAt(arr, index, item) {
20
- arr.splice(index, 0, item);
21
- },
22
-
23
- /**
24
- * 将一个数组追加到尾
25
- * @param index
26
- * @param item
27
- */
28
- addAll(arr, items) {
29
- for (let i = 0; i < items.length; i++) {
30
- arr.push(items[i])
31
- }
32
- },
33
-
34
- removeAt(arr, index) {
35
- arr.splice(index, 1)
36
- },
37
-
38
- remove(arr, item) {
39
- const index = arr.indexOf(item);
40
- if (index !== -1) {
41
- this.removeAt(arr, index)
42
- }
43
- },
44
-
45
- /**
46
- * 清空
47
- */
48
- clear(arr) {
49
- arr.length = 0
50
- },
51
-
52
- /**
53
- * 截取数组
54
- * @param fromIndex low endpoint (inclusive) of the subList toIndex
55
- * @param toIndex high endpoint (exclusive) of the subList
56
- */
57
- sub(arr, fromIndex, toIndex) {
58
- return arr.slice(fromIndex, toIndex);
59
- },
60
-
61
- swap(arr, item1, item2) {
62
- const index1 = arr.indexOf(item1);
63
- const index2 = arr.indexOf(item2);
64
-
65
- arr[index1] = item2;
66
- arr[index2] = item1;
67
- },
68
-
69
- insert(arr, index, item) {
70
- arr.splice(index, 0, item);
71
- },
72
-
73
- pushIfNotExist(arr, item) {
74
- const index = arr.indexOf(item);
75
- if (index == -1) {
76
- arr.push(item);
77
- }
78
- },
79
-
80
- pushAll(arr, newArr) {
81
- for (let i = 0; i < newArr.length; i++) {
82
- arr.push(newArr[i]);
83
- }
84
- },
85
-
86
- /**
87
- * 获取对象数组中某一属性值最大的对象
88
- * @param arr
89
- */
90
- maxBy(arr, key) {
91
- if (arr == null || arr.length === 0) {
92
- return undefined;
93
- }
94
-
95
- let maxElement;
96
- let maxValue = -Infinity;
97
-
98
- for (const element of arr) {
99
- const value = element[key];
100
- if (value > maxValue) {
101
- maxValue = value;
102
- maxElement = element;
103
- }
104
- }
105
-
106
- return maxElement;
107
- },
108
-
109
- /**
110
- * 数组去重
111
- * @param arr
112
- * @returns {any[]}
113
- */
114
- unique(arr) {
115
- return [...new Set(arr)]
116
- }
117
-
118
- }
@@ -1,24 +0,0 @@
1
- export function isMobileDevice() {
2
- const userAgent = navigator.userAgent || navigator.vendor || window.opera;
3
-
4
- // Windows Phone must come first because its UA also contains "Android"
5
- if (/windows phone/i.test(userAgent)) {
6
- return true;
7
- }
8
-
9
- // Android devices
10
- if (/android/i.test(userAgent)) {
11
- return true;
12
- }
13
-
14
- // iOS devices
15
- if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
16
- return true;
17
- }
18
- return false;
19
- }
20
-
21
- export function getWebsocketBaseUrl() {
22
- const protocol = location.protocol === 'http:' ? 'ws:' : 'wss:'
23
- return protocol + "//" + location.host
24
- }
@@ -1,269 +0,0 @@
1
- /**
2
- * forked form https://github.com/quasarframework/quasar
3
- */
4
-
5
-
6
- const reRGBA = /^rgb(a)?\((\d{1,3}),(\d{1,3}),(\d{1,3}),?([01]?\.?\d*?)?\)$/
7
-
8
- export function rgbToHex ({ r, g, b, a }) {
9
- const alpha = a !== void 0
10
-
11
- r = Math.round(r)
12
- g = Math.round(g)
13
- b = Math.round(b)
14
-
15
- if (
16
- r > 255
17
- || g > 255
18
- || b > 255
19
- || (alpha && a > 100)
20
- ) {
21
- throw new TypeError('Expected 3 numbers below 256 (and optionally one below 100)')
22
- }
23
-
24
- a = alpha
25
- ? (Math.round(255 * a / 100) | 1 << 8).toString(16).slice(1)
26
- : ''
27
-
28
- return '#' + ((b | g << 8 | r << 16) | 1 << 24).toString(16).slice(1) + a
29
- }
30
-
31
- export function rgbToString ({ r, g, b, a }) {
32
- return `rgb${ a !== void 0 ? 'a' : '' }(${ r },${ g },${ b }${ a !== void 0 ? ',' + (a / 100) : '' })`
33
- }
34
-
35
- export function hexToRgb (hex) {
36
- if (typeof hex !== 'string') {
37
- throw new TypeError('Expected a string')
38
- }
39
-
40
- hex = hex.replace(/^#/, '')
41
-
42
- if (hex.length === 3) {
43
- hex = hex[ 0 ] + hex[ 0 ] + hex[ 1 ] + hex[ 1 ] + hex[ 2 ] + hex[ 2 ]
44
- }
45
- else if (hex.length === 4) {
46
- hex = hex[ 0 ] + hex[ 0 ] + hex[ 1 ] + hex[ 1 ] + hex[ 2 ] + hex[ 2 ] + hex[ 3 ] + hex[ 3 ]
47
- }
48
-
49
- const num = parseInt(hex, 16)
50
-
51
- return hex.length > 6
52
- ? { r: num >> 24 & 255, g: num >> 16 & 255, b: num >> 8 & 255, a: Math.round((num & 255) / 2.55) }
53
- : { r: num >> 16, g: num >> 8 & 255, b: num & 255 }
54
- }
55
-
56
- export function hsvToRgb ({ h, s, v, a }) {
57
- let r, g, b
58
- s = s / 100
59
- v = v / 100
60
-
61
- h = h / 360
62
- const
63
- i = Math.floor(h * 6),
64
- f = h * 6 - i,
65
- p = v * (1 - s),
66
- q = v * (1 - f * s),
67
- t = v * (1 - (1 - f) * s)
68
-
69
- switch (i % 6) {
70
- case 0:
71
- r = v
72
- g = t
73
- b = p
74
- break
75
- case 1:
76
- r = q
77
- g = v
78
- b = p
79
- break
80
- case 2:
81
- r = p
82
- g = v
83
- b = t
84
- break
85
- case 3:
86
- r = p
87
- g = q
88
- b = v
89
- break
90
- case 4:
91
- r = t
92
- g = p
93
- b = v
94
- break
95
- case 5:
96
- r = v
97
- g = p
98
- b = q
99
- break
100
- }
101
-
102
- return {
103
- r: Math.round(r * 255),
104
- g: Math.round(g * 255),
105
- b: Math.round(b * 255),
106
- a
107
- }
108
- }
109
-
110
- export function rgbToHsv ({ r, g, b, a }) {
111
- const
112
- max = Math.max(r, g, b),
113
- min = Math.min(r, g, b),
114
- d = max - min,
115
- s = (max === 0 ? 0 : d / max),
116
- v = max / 255
117
- let h
118
-
119
- switch (max) {
120
- case min:
121
- h = 0
122
- break
123
- case r:
124
- h = (g - b) + d * (g < b ? 6 : 0)
125
- h /= 6 * d
126
- break
127
- case g:
128
- h = (b - r) + d * 2
129
- h /= 6 * d
130
- break
131
- case b:
132
- h = (r - g) + d * 4
133
- h /= 6 * d
134
- break
135
- }
136
-
137
- return {
138
- h: Math.round(h * 360),
139
- s: Math.round(s * 100),
140
- v: Math.round(v * 100),
141
- a
142
- }
143
- }
144
-
145
- export function textToRgb (str) {
146
- if (typeof str !== 'string') {
147
- throw new TypeError('Expected a string')
148
- }
149
-
150
- const color = str.replace(/ /g, '')
151
-
152
- const m = reRGBA.exec(color)
153
-
154
- if (m === null) {
155
- return hexToRgb(color)
156
- }
157
-
158
- const rgb = {
159
- r: Math.min(255, parseInt(m[ 2 ], 10)),
160
- g: Math.min(255, parseInt(m[ 3 ], 10)),
161
- b: Math.min(255, parseInt(m[ 4 ], 10))
162
- }
163
-
164
- if (m[ 1 ]) {
165
- const alpha = parseFloat(m[ 5 ])
166
- rgb.a = Math.min(1, isNaN(alpha) === true ? 1 : alpha) * 100
167
- }
168
-
169
- return rgb
170
- }
171
-
172
- /* works as darken if percent < 0 */
173
- export function lighten (color, percent) {
174
- if (typeof color !== 'string') {
175
- throw new TypeError('Expected a string as color')
176
- }
177
- if (typeof percent !== 'number') {
178
- throw new TypeError('Expected a numeric percent')
179
- }
180
-
181
- const rgb = textToRgb(color),
182
- t = percent < 0 ? 0 : 255,
183
- p = Math.abs(percent) / 100,
184
- R = rgb.r,
185
- G = rgb.g,
186
- B = rgb.b
187
-
188
- return '#' + (
189
- 0x1000000 + (Math.round((t - R) * p) + R) * 0x10000
190
- + (Math.round((t - G) * p) + G) * 0x100
191
- + (Math.round((t - B) * p) + B)
192
- ).toString(16).slice(1)
193
- }
194
-
195
- export function luminosity (color) {
196
- if (typeof color !== 'string' && (!color || color.r === void 0)) {
197
- throw new TypeError('Expected a string or a {r, g, b} object as color')
198
- }
199
-
200
- const
201
- rgb = typeof color === 'string' ? textToRgb(color) : color,
202
- r = rgb.r / 255,
203
- g = rgb.g / 255,
204
- b = rgb.b / 255,
205
- R = r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4),
206
- G = g <= 0.03928 ? g / 12.92 : Math.pow((g + 0.055) / 1.055, 2.4),
207
- B = b <= 0.03928 ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4)
208
- return 0.2126 * R + 0.7152 * G + 0.0722 * B
209
- }
210
-
211
- export function brightness (color) {
212
- if (typeof color !== 'string' && (!color || color.r === void 0)) {
213
- throw new TypeError('Expected a string or a {r, g, b} object as color')
214
- }
215
-
216
- const rgb = typeof color === 'string'
217
- ? textToRgb(color)
218
- : color
219
-
220
- return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000
221
- }
222
-
223
- export function blend (fgColor, bgColor) {
224
- if (typeof fgColor !== 'string' && (!fgColor || fgColor.r === void 0)) {
225
- throw new TypeError('Expected a string or a {r, g, b[, a]} object as fgColor')
226
- }
227
-
228
- if (typeof bgColor !== 'string' && (!bgColor || bgColor.r === void 0)) {
229
- throw new TypeError('Expected a string or a {r, g, b[, a]} object as bgColor')
230
- }
231
-
232
- const
233
- rgb1 = typeof fgColor === 'string' ? textToRgb(fgColor) : fgColor,
234
- r1 = rgb1.r / 255,
235
- g1 = rgb1.g / 255,
236
- b1 = rgb1.b / 255,
237
- a1 = rgb1.a !== void 0 ? rgb1.a / 100 : 1,
238
- rgb2 = typeof bgColor === 'string' ? textToRgb(bgColor) : bgColor,
239
- r2 = rgb2.r / 255,
240
- g2 = rgb2.g / 255,
241
- b2 = rgb2.b / 255,
242
- a2 = rgb2.a !== void 0 ? rgb2.a / 100 : 1,
243
- a = a1 + a2 * (1 - a1),
244
- r = Math.round(((r1 * a1 + r2 * a2 * (1 - a1)) / a) * 255),
245
- g = Math.round(((g1 * a1 + g2 * a2 * (1 - a1)) / a) * 255),
246
- b = Math.round(((b1 * a1 + b2 * a2 * (1 - a1)) / a) * 255)
247
-
248
- const ret = { r, g, b, a: Math.round(a * 100) }
249
- return typeof fgColor === 'string'
250
- ? rgbToHex(ret)
251
- : ret
252
- }
253
-
254
- export function changeAlpha (color, offset) {
255
- if (typeof color !== 'string') {
256
- throw new TypeError('Expected a string as color')
257
- }
258
-
259
- if (offset === void 0 || offset < -1 || offset > 1) {
260
- throw new TypeError('Expected offset to be between -1 and 1')
261
- }
262
-
263
- const { r, g, b, a } = textToRgb(color)
264
- const alpha = a !== void 0 ? a / 100 : 0
265
-
266
- return rgbToHex({
267
- r, g, b, a: Math.round(Math.min(1, Math.max(0, alpha + offset)) * 100)
268
- })
269
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * 防抖
3
- *
4
- * forked form https://github.com/quasarframework/quasar
5
- */
6
- export function debounce(fn, wait = 250, immediate) {
7
- let timer = null
8
-
9
- function debounced(/* ...args */) {
10
- const args = arguments
11
-
12
- const later = () => {
13
- timer = null
14
- if (immediate !== true) {
15
- fn.apply(this, args)
16
- }
17
- }
18
-
19
- if (timer !== null) {
20
- clearTimeout(timer)
21
- } else if (immediate === true) {
22
- fn.apply(this, args)
23
- }
24
-
25
- timer = setTimeout(later, wait)
26
- }
27
-
28
- debounced.cancel = () => {
29
- timer !== null && clearTimeout(timer)
30
- }
31
-
32
- return debounced
33
- }
@@ -1,16 +0,0 @@
1
- export function offset (el) {
2
- if (el === window) {
3
- return { top: 0, left: 0 }
4
- }
5
- const { top, left } = el.getBoundingClientRect()
6
- return { top, left }
7
- }
8
- export function height (el) {
9
- return el === window
10
- ? window.innerHeight
11
- : el.getBoundingClientRect().height
12
- }export function width (el) {
13
- return el === window
14
- ? window.innerWidth
15
- : el.getBoundingClientRect().width
16
- }
@@ -1,70 +0,0 @@
1
- /**
2
- * 事件总线
3
- * forked form https://github.com/scottcorgan/tiny-emitter
4
- */
5
-
6
- export class EventBus {
7
- constructor () {
8
- this.__stack = {}
9
- }
10
-
11
- on (name, callback, ctx) {
12
- (this.__stack[ name ] || (this.__stack[ name ] = [])).push({
13
- fn: callback,
14
- ctx
15
- })
16
-
17
- return this // chainable
18
- }
19
-
20
- once (name, callback, ctx) {
21
- const listener = (...args) => {
22
- this.off(name, listener)
23
- callback.apply(ctx, args)
24
- }
25
-
26
- listener.__callback = callback
27
- return this.on(name, listener, ctx) // chainable
28
- }
29
-
30
- emit (name) {
31
- const list = this.__stack[ name ]
32
-
33
- if (list !== void 0) {
34
- const params = [].slice.call(arguments, 1)
35
- list.forEach(entry => {
36
- entry.fn.apply(entry.ctx, params)
37
- })
38
- }
39
-
40
- return this // chainable
41
- }
42
-
43
- off (name, callback) {
44
- const list = this.__stack[ name ]
45
-
46
- if (list === void 0) {
47
- return this // chainable
48
- }
49
-
50
- if (callback === void 0) {
51
- delete this.__stack[ name ]
52
- return this // chainable
53
- }
54
-
55
- const liveEvents = list.filter(
56
- entry => entry.fn !== callback && entry.fn.__callback !== callback
57
- )
58
-
59
- if (liveEvents.length !== 0) {
60
- this.__stack[ name ] = liveEvents
61
- }
62
- else {
63
- delete this.__stack[ name ]
64
- }
65
-
66
- return this // chainable
67
- }
68
- }
69
-
70
- export const eventBus = new EventBus()
@@ -1,13 +0,0 @@
1
-
2
- export function getIframeCommonProps() {
3
-
4
- return {
5
- width: '100%',
6
- frameBorder: 0,
7
- marginHeight: 0,
8
- marginWidth: 0
9
- }
10
- }
11
-
12
-
13
-
@@ -1,17 +0,0 @@
1
- export * from "./date";
2
- export * from "./arr";
3
- export * from "./html";
4
- export * from "./url"
5
- export * from "./str"
6
- export * from "./eventBus";
7
- export * from "./color"
8
- export * from "./debounce";
9
- export * from "./dom"
10
- export * from "./uid";
11
- export * from './validate'
12
-
13
- export * from "./str"
14
- export * from "./tree";
15
- export * from './storage'
16
- export * from './browser'
17
- export * from './obj'
@@ -1,72 +0,0 @@
1
- /**
2
- * 于安全地获取深度嵌套的对象属性的值
3
- * 如果属性链中的任何一级为 undefined 或 null,get 函数会返回一个默认值,而不是抛出错误。
4
- *
5
- * const obj = { 'a': [{ 'b': { 'c': 3 } }] };
6
- *
7
- * const value = get(obj, 'a[0].b.c');
8
- *
9
- * @param obj
10
- * @param path
11
- * @param defaultValue
12
- */
13
- export function get(obj, path, defaultValue = undefined){
14
-
15
- const pathArray = Array.isArray(path) ? path : path.split('.');
16
- let result = obj;
17
-
18
- // 遍历路径
19
- for (const segment of pathArray) {
20
- if (result == null) {
21
- return defaultValue;
22
- }
23
-
24
- // 尝试访问属性
25
- result = result[segment];
26
- }
27
-
28
- // 如果结果还是 null 或 undefined,则返回默认值
29
- return result != null ? result : defaultValue;
30
-
31
- }
32
-
33
-
34
- export class ObjUtil {
35
-
36
- /**
37
- * 复制对象属性
38
- * 如果目标对象的属性存在才复制
39
- * @param source
40
- * @param target
41
- */
42
- static copyPropertyIfPresent(source, target){
43
- if (!source || !target || typeof source !== 'object' || typeof target !== 'object') {
44
- return;
45
- }
46
-
47
- const keys = Object.keys(target)
48
- for (let key of keys) {
49
- if(Object.hasOwn(source,key)){
50
- let value = source[key];
51
- target[key] = value
52
- }
53
- }
54
- }
55
-
56
-
57
- static copyProperty(source, target){
58
- if (!source || !target || typeof source !== 'object' || typeof target !== 'object') {
59
- return;
60
- }
61
-
62
- const keys = Object.keys(target)
63
- for (let key of keys) {
64
- let value = source[key];
65
- if(value !== undefined){
66
- target[key] = value
67
- }
68
-
69
- }
70
- }
71
-
72
- }
@@ -1,37 +0,0 @@
1
- import {DateUtil} from "./date";
2
-
3
-
4
- const ENCRYPT = false;
5
-
6
- export const StorageUtil = {
7
-
8
-
9
- get(key, defaultValue = null) {
10
- let v = localStorage.getItem(key);
11
- if (v == null) {
12
- v = defaultValue;
13
- }else {
14
- const item = JSON.parse(v);
15
- v = item.data
16
- }
17
-
18
-
19
- return v
20
- },
21
-
22
- set(key, value) {
23
- if(value == null){
24
- localStorage.removeItem(key)
25
- }
26
- const item = {
27
- createTime: DateUtil.now(),
28
- data: value
29
- }
30
- const dataStr = JSON.stringify(item)
31
- localStorage.setItem(key, dataStr)
32
- }
33
-
34
- }
35
-
36
-
37
-