@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
@@ -0,0 +1,76 @@
1
+ /**
2
+ * antd 自带的checkbox 未选择时不会返回false, 和form配合时还得设置 valuePropName
3
+ *
4
+ *
5
+ * 本组件改成布尔值的输入
6
+ *
7
+ * 选中 true, 反选 false
8
+ *
9
+ * 注意:null 会转为false
10
+ *
11
+ *
12
+ */
13
+ import React from 'react';
14
+ import {Checkbox, Radio, Select, Switch} from 'antd';
15
+
16
+
17
+ export class FieldBoolean extends React.Component {
18
+
19
+ static defaultProps = {
20
+ type: 'select'
21
+ }
22
+
23
+ render() {
24
+ let {value, onChange, type} = this.props
25
+
26
+ const v = this.parseBoolean(value);
27
+
28
+ switch (type) {
29
+ case 'radio':
30
+ return <Radio.Group value={v} onChange={onChange}>
31
+ <Radio value={true}>是</Radio>
32
+ <Radio value={false}>否</Radio>
33
+ <Radio value={undefined}>不确定</Radio>
34
+ </Radio.Group>;
35
+ case 'checkbox':
36
+ return <Checkbox
37
+ checked={v}
38
+ onChange={(e) => {
39
+ onChange(e.target.checked);
40
+ }}
41
+ />;
42
+ case 'select':
43
+ return <Select options={[
44
+ {value: true, label: '是'},
45
+ {value: false, label: '否'},
46
+ ]}
47
+ value={v}
48
+ onChange={onChange}
49
+ style={{width: '100%'}}
50
+ allowClear={true}
51
+ placeholder={'请选择'}
52
+ />
53
+ case 'switch':
54
+ return <Switch
55
+ checked={v}
56
+ onChange={onChange}
57
+ />;
58
+ default:
59
+ break;
60
+ }
61
+
62
+ }
63
+
64
+ parseBoolean(v) {
65
+ if (v === null || v === undefined) {
66
+ return undefined;
67
+ }
68
+
69
+ if (typeof v === 'boolean') {
70
+ return v;
71
+ }
72
+ return v === 1 || v === 'true' || v === 'Y';
73
+
74
+ }
75
+ }
76
+
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+
3
+ export interface FieldDateProps {
4
+
5
+ type: 'YYYY-MM-DD' |
6
+ 'YYYY-MM-DD HH:mm:ss' |
7
+ // 年
8
+ 'YYYY' |
9
+ // 年月
10
+ 'YYYY-MM' |
11
+ // 季度
12
+ 'YYYY-QQ' |
13
+
14
+ 'YYYY-MM-DD HH:mm' |
15
+
16
+ // 时间
17
+ 'HH:mm' |
18
+ 'HH:mm:ss';
19
+
20
+
21
+ }
22
+
23
+ export class FieldDate extends React.Component<FieldDateProps, any> {
24
+ }
25
+
@@ -0,0 +1,109 @@
1
+ /**
2
+ * 根据时间类型自动渲染时间选择组件
3
+ */
4
+ import React from "react";
5
+ import dayjs from "dayjs";
6
+ import {DatePicker, TimePicker} from "antd";
7
+
8
+
9
+ export class FieldDate extends React.Component {
10
+ static defaultProps = {
11
+ type: 'YYYY-MM-DD'
12
+ }
13
+
14
+ render() {
15
+ let {type, value, onChange, ...rest} = this.props;
16
+ switch (type) {
17
+ case 'YYYY':
18
+ return <DatePicker
19
+ value={this.strToDate(value, type)}
20
+ onChange={v => onChange(this.dateToStr(v,'YYYY'))}
21
+ picker="year"
22
+ {...rest}
23
+ />;
24
+ case 'YYYY-MM':
25
+ return <DatePicker
26
+ value={this.strToDate(value, 'YYYY-MM')}
27
+ onChange={v => onChange(this.dateToStr(v,'YYYY-MM'))}
28
+ picker="month"
29
+ {...rest}
30
+ />;
31
+ case 'YYYY-QQ':
32
+ return <DatePicker
33
+ value={this.strToDate(value, 'YYYY-QQ')}
34
+ onChange={v => onChange(this.dateToStr(v,'YYYY-QQ'))}
35
+ picker="quarter"
36
+ {...rest}
37
+ />;
38
+ case 'YYYY-MM-DD':
39
+ return <DatePicker
40
+ value={this.strToDate(value, 'YYYY-MM-DD')}
41
+ onChange={v => onChange(this.dateToStr(v,'YYYY-MM-DD'))}
42
+ {...rest}
43
+ ></DatePicker>;
44
+ case 'YYYY-MM-DD HH:mm':
45
+ return <DatePicker
46
+ value={this.strToDate(value, 'YYYY-MM-DD HH:mm')}
47
+ onChange={v => onChange(this.dateToStr(v,'YYYY-MM-DD HH:mm'))}
48
+ format='YYYY-MM-DD HH:mm'
49
+ showTime
50
+ {...rest}
51
+ ></DatePicker>;
52
+ case 'YYYY-MM-DD HH:mm:ss':
53
+ return <DatePicker
54
+ value={this.strToDate(value, 'YYYY-MM-DD HH:mm:ss')}
55
+ onChange={v => onChange(this.dateToStr(v,'YYYY-MM-DD HH:mm:ss'))}
56
+ showTime
57
+ {...rest}
58
+ ></DatePicker>;
59
+ case 'HH:mm':
60
+ return <TimePicker
61
+ format='HH:mm'
62
+ value={this.strToDate(value, 'HH:mm')}
63
+ onChange={v => onChange(this.dateToStr(v,'HH:mm'))}
64
+ {...rest}
65
+ ></TimePicker>;
66
+ case 'HH:mm:ss':
67
+ return <TimePicker
68
+ value={this.strToDate(value, 'HH:mm:ss')}
69
+ onChange={v => onChange(this.dateToStr(v,'HH:mm:ss'))}
70
+ {...rest}
71
+ ></TimePicker>;
72
+ }
73
+
74
+ return <div>未知组件 {type}</div>
75
+ }
76
+
77
+ static getDefaultValue(type) {
78
+ let year = dayjs().format("YYYY");
79
+ let month = dayjs().format("YYYY-MM");
80
+ let quarter = dayjs().format("YYYY-QQ");
81
+
82
+ switch (type) {
83
+ case 'YYYY':
84
+ return year;
85
+ case 'YYYY-MM':
86
+ return month;
87
+ case 'YYYY-QQ':
88
+ return quarter;
89
+ }
90
+
91
+ return null;
92
+ }
93
+
94
+ strToDate(value, fmt) {
95
+ if (value != null && value !== '') {
96
+ let type = typeof value;
97
+ if (type === 'string' || type === 'number') {
98
+ value = dayjs(value, fmt);
99
+ }
100
+ }
101
+
102
+ return value;
103
+ }
104
+
105
+ dateToStr(date, fmt) {
106
+ return date ? date.format(fmt) : null;
107
+ }
108
+
109
+ }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import {FieldDateProps} from "./FieldDate";
3
+
4
+
5
+ export class FieldDateRange extends React.Component<FieldDateProps, any> {}
6
+
@@ -0,0 +1,101 @@
1
+ /**
2
+ * 根据时间类型自动渲染时间选择组件
3
+ */
4
+ import React from "react";
5
+ import dayjs from "dayjs";
6
+ import {DatePicker, TimePicker} from "antd";
7
+
8
+
9
+ export class FieldDateRange extends React.Component {
10
+ static defaultProps = {
11
+ type: 'YYYY-MM-DD'
12
+ }
13
+
14
+ render() {
15
+ let {type, value, onChange, ...rest} = this.props;
16
+ switch (type) {
17
+ case 'YYYY':
18
+ return <DatePicker.RangePicker
19
+ value={this.strToDate(value, 'YYYY')}
20
+ onChange={v => onChange(this.dateToStr(v,'YYYY'))}
21
+ picker="year"
22
+ {...rest}
23
+ />;
24
+ case 'YYYY-MM':
25
+ return <DatePicker.RangePicker
26
+ value={this.strToDate(value, 'YYYY-MM')}
27
+ onChange={v => onChange(this.dateToStr(v,'YYYY-MM'))}
28
+ picker="month"
29
+ {...rest}
30
+ />;
31
+ case 'YYYY-QQ':
32
+ return <DatePicker.RangePicker
33
+ value={this.strToDate(value, 'YYYY-QQ')}
34
+ onChange={v => onChange(this.dateToStr(v,'YYYY-QQ'))}
35
+ picker="quarter"
36
+ {...rest}
37
+ />;
38
+ case 'YYYY-MM-DD':
39
+ return <DatePicker.RangePicker
40
+ value={this.strToDate(value, 'YYYY-MM-DD')}
41
+ onChange={v => onChange(this.dateToStr(v,'YYYY-MM-DD'))}
42
+ {...rest}
43
+ />;
44
+ case 'YYYY-MM-DD HH:mm':
45
+ return <DatePicker.RangePicker
46
+ value={this.strToDate(value, 'YYYY-MM-DD HH:mm')}
47
+ onChange={v => onChange(this.dateToStr(v,'YYYY-MM-DD HH:mm'))}
48
+ format='YYYY-MM-DD HH:mm'
49
+ showTime
50
+ {...rest}
51
+ />;
52
+ case 'YYYY-MM-DD HH:mm:ss':
53
+ return <DatePicker.RangePicker
54
+ value={this.strToDate(value, 'YYYY-MM-DD HH:mm:ss')}
55
+ onChange={v => onChange(this.dateToStr(v,'YYYY-MM-DD HH:mm:ss'))}
56
+ showTime
57
+ {...rest}
58
+ />;
59
+ case 'HH:mm':
60
+ return <TimePicker.RangePicker
61
+ format='HH:mm'
62
+ value={this.strToDate(value, 'HH:mm')}
63
+ onChange={v => onChange(this.dateToStr(v,'HH:mm'))}
64
+ {...rest}
65
+ />;
66
+ case 'HH:mm:ss':
67
+ return <TimePicker.RangePicker
68
+ value={this.strToDate(value, 'HH:mm:ss')}
69
+ onChange={v => onChange(this.dateToStr(v,'HH:mm:ss'))}
70
+ {...rest}
71
+ />;
72
+ }
73
+
74
+ return <div>未知组件 {type}</div>
75
+ }
76
+
77
+
78
+
79
+ strToDate(v, fmt) {
80
+ console.log('调用转换')
81
+ if (!v) {
82
+ return null;
83
+ }
84
+
85
+ const arr = v.split("/")
86
+ let s1 = arr[0];
87
+ let s2 = arr[1];
88
+ return [dayjs(s1), dayjs(s2)]
89
+ }
90
+
91
+ dateToStr(dateArr, fmt) {
92
+ const d1 = dateArr[0]
93
+ const d2 = dateArr[1]
94
+
95
+ const s1 = d1 ? d1.format(fmt) : ""
96
+ const s2 = d2 ? d2.format(fmt) : "";
97
+
98
+ return s1 + '/' + s2
99
+ }
100
+
101
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { SelectProps } from 'antd/es/select';
3
+
4
+ export interface FieldDictSelectProps extends Omit<SelectProps, 'options' | 'children'|'mode'> {
5
+
6
+ /**
7
+ * 请求地址
8
+ */
9
+ typeCode: string ;
10
+ }
11
+
12
+ export class FieldDictSelect extends React.Component<FieldDictSelectProps, any> {}
13
+
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import {Select} from "antd";
3
+ import {DictUtils} from "../utils";
4
+
5
+ export function FieldDictSelect(props) {
6
+ const {value, onChange, typeCode, ...rest} = props
7
+ const options = DictUtils.dictOptions(typeCode)
8
+
9
+ return <Select value={value}
10
+ onChange={onChange}
11
+ style={{width: '100%', minWidth: 200}}
12
+ options={options}
13
+ {...rest}>
14
+
15
+ </Select>
16
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+
3
+ export interface FieldEditProps {
4
+ value ?: string;
5
+ onChange ?: (value: string) => void;
6
+ height ?: number;
7
+ }
8
+
9
+ export class FieldEditor extends React.Component<FieldEditProps, any> {}
10
+
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import {Editor as TinyMceEditor} from '@tinymce/tinymce-react';
3
+
4
+
5
+ /**
6
+ * 富文本编辑器
7
+ *
8
+ * 图片上传相关配置 https://www.tiny.cloud/docs/tinymce/7/image/
9
+ */
10
+ export class FieldEditor extends React.Component {
11
+ render() {
12
+ let uploadUrl = 'admin/sysFile/upload'
13
+ let jsUrl = 'admin/tinymce/tinymce.min.js';
14
+ const {value,onChange,height} = this.props
15
+
16
+ return <>
17
+ <TinyMceEditor
18
+ initialValue={value}
19
+ tinymceScriptSrc={jsUrl}
20
+ init={{
21
+ min_height: 300,
22
+ language: 'zh_CN',
23
+ height: height,
24
+
25
+ // 上传图片
26
+ images_upload_url: uploadUrl,
27
+ promotion: false, // 不显示升级按钮(右上角)
28
+ cache_suffix: '?v=v7.7',
29
+
30
+ plugins: [
31
+ 'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview',
32
+ 'anchor', 'searchreplace', 'visualblocks', 'code', 'fullscreen',
33
+ 'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount',
34
+ 'emoticons'
35
+ ],
36
+ image_description:false,
37
+
38
+ // 设置图片上传对话框默认选中上传Tab
39
+ setup: function (editor) {
40
+ editor.on('OpenWindow', function(e) {
41
+ const dialog = e.dialog;
42
+ // 包含 dimensions 属性应该就是 上传图片的对话框
43
+ if (dialog && dialog.getData().dimensions) {
44
+ dialog.showTab("upload")
45
+ }
46
+ });
47
+ },
48
+
49
+ }}
50
+ onChange={e => {
51
+ if (onChange) {
52
+ onChange(e.target.getContent())
53
+ }
54
+ }}
55
+ />
56
+ </>;
57
+ }
58
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+
3
+ export interface FieldPercentProps {
4
+ value ?: number;
5
+ onChange ?: (number: string) => void;
6
+ }
7
+
8
+ /**
9
+ * 数字的百分数输入框
10
+ */
11
+ export class FieldPercent extends React.Component<FieldPercentProps, any> {}
12
+
@@ -0,0 +1,27 @@
1
+ import {InputNumber, Space} from 'antd';
2
+ import React from 'react';
3
+
4
+ export class FieldPercent extends React.Component {
5
+ render() {
6
+ const {value, onChange, ...rest} = this.props;
7
+
8
+
9
+ return (
10
+ <Space.Compact>
11
+ <InputNumber
12
+ min={0}
13
+ max={100}
14
+ value={ Number((value * 100).toFixed(0))}
15
+ onChange={v => {
16
+ v = (v / 100).toFixed(2);
17
+ onChange(Number(v))
18
+ }}
19
+ {...rest}
20
+ />
21
+ <Space.Addon>%</Space.Addon>
22
+ </Space.Compact>
23
+
24
+ );
25
+ }
26
+ }
27
+
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { SelectProps } from 'antd/es/select';
3
+
4
+ export interface FieldRemoteSelectProps extends Omit<SelectProps, 'options' | 'children'|'mode'> {
5
+
6
+ /**
7
+ * 请求地址
8
+ */
9
+ url: string ;
10
+ }
11
+
12
+ export class FieldRemoteSelect extends React.Component<FieldRemoteSelectProps, any> {}
13
+
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import {Select, Spin, message} from 'antd';
3
+ import {debounce} from 'lodash';
4
+ import {HttpUtils} from "../utils";
5
+
6
+ export class FieldRemoteSelect extends React.Component {
7
+ constructor(props) {
8
+ super(props);
9
+
10
+ this.state = {
11
+ options: [],
12
+ loading: false,
13
+ };
14
+
15
+ this.fetchIdRef = 0;
16
+ this.loadDataDebounce = debounce(this.loadData, 800);
17
+ }
18
+
19
+ static defaultProps = {
20
+ placeholder: '请搜索选择'
21
+ };
22
+
23
+ componentDidMount() {
24
+ this.loadData('')
25
+ }
26
+
27
+ componentWillUnmount() {
28
+ this.loadDataDebounce.cancel();
29
+ }
30
+
31
+ loadData = async (searchText) => {
32
+ const {url, value} = this.props;
33
+ const fetchId = ++this.fetchIdRef;
34
+
35
+ this.setState({loading: true});
36
+
37
+ try {
38
+ const data = await HttpUtils.get(url, {searchText, selected: value});
39
+
40
+ if (fetchId === this.fetchIdRef) {
41
+ this.setState({options: data || []});
42
+ }
43
+ } catch (error) {
44
+ console.error('远程搜索失败:', error);
45
+ message.error('搜索失败,请重试');
46
+ this.setState({options: []});
47
+ } finally {
48
+ if (fetchId === this.fetchIdRef) {
49
+ this.setState({loading: false});
50
+ }
51
+ }
52
+ };
53
+
54
+ handleSearch = (value) => {
55
+ if (value.trim() === '') {
56
+ this.setState({options: []});
57
+ return;
58
+ }
59
+ this.loadDataDebounce(value.trim());
60
+ };
61
+
62
+ render() {
63
+ const {options, loading} = this.state;
64
+ const {value, onChange, url, ...selectProps} = this.props;
65
+
66
+ return (
67
+ <Select
68
+ showSearch={
69
+ {
70
+ filterOption: false,
71
+ onSearch: this.handleSearch,
72
+ }
73
+ }
74
+ value={value}
75
+ onChange={onChange}
76
+ options={options}
77
+ notFoundContent={loading ? <Spin size="small"/> : '数据为空'}
78
+ style={{width: '100%', minWidth: 200}}
79
+ allowClear
80
+
81
+ {...selectProps}
82
+ >
83
+ </Select>
84
+ );
85
+ }
86
+ }
87
+
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { SelectProps } from 'antd/es/select';
3
+
4
+ export interface FieldRemoteSelectMultipleProps extends Omit<SelectProps, 'options' | 'children'| 'mode'> {
5
+
6
+ /**
7
+ * 请求地址
8
+ */
9
+ url: string ;
10
+ }
11
+
12
+ export class FieldRemoteSelectMultiple extends React.Component<FieldRemoteSelectMultipleProps, any> {}
13
+
@@ -0,0 +1,86 @@
1
+ import React from 'react';
2
+ import {Select, Spin, message} from 'antd';
3
+ import {debounce} from 'lodash';
4
+ import {HttpUtils} from "../utils";
5
+
6
+ export class FieldRemoteSelectMultiple extends React.Component {
7
+ constructor(props) {
8
+ super(props);
9
+
10
+ this.state = {
11
+ options: [],
12
+ loading: false,
13
+ };
14
+
15
+ this.fetchIdRef = 0;
16
+ this.loadDataDebounce = debounce(this.loadData, 800);
17
+ }
18
+
19
+ static defaultProps = {
20
+ placeholder: '请搜索选择'
21
+ };
22
+
23
+ componentDidMount() {
24
+ this.loadData('')
25
+ }
26
+
27
+ componentWillUnmount() {
28
+ this.loadDataDebounce.cancel();
29
+ }
30
+
31
+ loadData = async (searchText) => {
32
+ const {url, value} = this.props;
33
+ const fetchId = ++this.fetchIdRef;
34
+
35
+ this.setState({loading: true});
36
+
37
+ try {
38
+ const data = await HttpUtils.get(url, {searchText, selected: value});
39
+
40
+ if (fetchId === this.fetchIdRef) {
41
+ this.setState({options: data || []});
42
+ }
43
+ } catch (error) {
44
+ console.error('远程搜索失败:', error);
45
+ message.error('搜索失败,请重试');
46
+ this.setState({options: []});
47
+ } finally {
48
+ if (fetchId === this.fetchIdRef) {
49
+ this.setState({loading: false});
50
+ }
51
+ }
52
+ };
53
+
54
+ handleSearch = (value) => {
55
+ if (value.trim() === '') {
56
+ this.setState({options: []});
57
+ return;
58
+ }
59
+ this.loadDataDebounce(value.trim());
60
+ };
61
+
62
+ render() {
63
+ const {options, loading} = this.state;
64
+ const {value, onChange, url, ...selectProps} = this.props;
65
+ return (
66
+ <Select
67
+ showSearch={
68
+ {
69
+ filterOption: false,
70
+ onSearch: this.handleSearch,
71
+ }
72
+ }
73
+ value={value}
74
+ onChange={onChange}
75
+ options={options}
76
+ notFoundContent={loading ? <Spin size="small"/> : '数据为空'}
77
+ style={{width: '100%', minWidth: 200}}
78
+ allowClear
79
+ mode='multiple'
80
+ {...selectProps}
81
+ >
82
+ </Select>
83
+ );
84
+ }
85
+ }
86
+
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+
3
+ /**
4
+ * 多选,但是值是字符串,逗号破解的
5
+ */
6
+ export interface FieldRemoteSelectMultipleInlineProps {
7
+
8
+ /**
9
+ * 请求地址
10
+ */
11
+ url: string ;
12
+
13
+ /**
14
+ * 默认展开所有
15
+ */
16
+ treeDefaultExpandAll?: boolean ;
17
+ }
18
+
19
+ export class FieldRemoteSelectMultipleInline extends React.Component<FieldRemoteSelectMultipleInlineProps, any> {}
20
+