@jiangood/springboot-admin-starter 0.0.8 → 0.0.9

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.
package/package.json CHANGED
@@ -32,7 +32,7 @@
32
32
  "config/dist/*"
33
33
  ],
34
34
  "main": "src/index.ts",
35
- "version": "0.0.8",
35
+ "version": "0.0.9",
36
36
  "scripts": {
37
37
  "dev": "umi dev",
38
38
  "build": "tsc --outDir config/dist --skipLibCheck --noEmitOnError false config/index.ts"
@@ -4,7 +4,9 @@
4
4
  import React from "react";
5
5
  import dayjs from "dayjs";
6
6
  import {DatePicker, TimePicker} from "antd";
7
+ import {StringUtils} from "../utils";
7
8
 
9
+ const SP = StringUtils.ISO_SPLITTER;
8
10
 
9
11
  export class FieldDateRange extends React.Component {
10
12
  static defaultProps = {
@@ -82,7 +84,7 @@ export class FieldDateRange extends React.Component {
82
84
  return null;
83
85
  }
84
86
 
85
- const arr = v.split("/")
87
+ const arr = v.split(SP)
86
88
  let s1 = arr[0];
87
89
  let s2 = arr[1];
88
90
  return [dayjs(s1), dayjs(s2)]
@@ -95,7 +97,7 @@ export class FieldDateRange extends React.Component {
95
97
  const s1 = d1 ? d1.format(fmt) : ""
96
98
  const s2 = d2 ? d2.format(fmt) : "";
97
99
 
98
- return s1 + '/' + s2
100
+ return s1 + SP + s2
99
101
  }
100
102
 
101
103
  }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+
3
+ export interface FieldNumberRangeProps {
4
+ value?: string;
5
+ onChange?: (value: string) => void;
6
+ }
7
+
8
+ /**
9
+ * 数字的百分数输入框
10
+ */
11
+ export class FieldNumberRange extends React.Component<FieldNumberRangeProps, any> {
12
+ }
13
+
@@ -0,0 +1,59 @@
1
+ import React from "react";
2
+ import {InputNumber} from "antd";
3
+ import {StringUtils} from "../utils";
4
+
5
+
6
+ const SP = StringUtils.ISO_SPLITTER;
7
+
8
+ export class FieldNumberRange extends React.Component {
9
+
10
+
11
+ onChangeA = (a) => {
12
+ const {b} = this.parse(this.props.value)
13
+ this.props.onChange && this.props.onChange(this.merge(a, b))
14
+ }
15
+ onChangeB = (b) => {
16
+ const {a} = this.parse(this.props.value)
17
+ this.props.onChange && this.props.onChange(this.merge(a, b))
18
+ }
19
+
20
+ merge(a, b) {
21
+ if (a == null) {
22
+ a = ''
23
+ }
24
+ if (b == null) {
25
+ b = ''
26
+ }
27
+ return a + SP + b;
28
+ }
29
+
30
+ parse(v) {
31
+ if (v == null) {
32
+ return {a: null, b: null}
33
+ }
34
+ const arr = v.split(SP);
35
+ return {a: arr[0], b: arr[1]}
36
+ }
37
+
38
+ componentDidMount() {
39
+ let {value, defaultValue} = this.props
40
+ if (value == null) {
41
+ this.props.onChange && this.props.onChange(defaultValue)
42
+ }
43
+
44
+ }
45
+
46
+
47
+ render() {
48
+ let {value, defaultValue} = this.props
49
+ if (value == null) {
50
+ value = defaultValue
51
+ }
52
+ const {a, b} = this.parse(value)
53
+
54
+ return <div style={{display: 'flex', alignItems: 'center'}}>
55
+ <InputNumber value={a} onChange={this.onChangeA}/> - <InputNumber value={b} onChange={this.onChangeB}/>
56
+ </div>
57
+ }
58
+
59
+ }
@@ -11,6 +11,7 @@ export * from './FieldRemoteTreeSelectMultiple'
11
11
  export * from './FieldBoolean';
12
12
  export * from './FieldDate';
13
13
  export * from './FieldDateRange';
14
+ export * from './FieldNumberRange';
14
15
  export * from './FieldTable'
15
16
  export * from './FieldTableSelect'
16
17
  export * from './FieldSysOrgTreeSelect'
@@ -3,6 +3,8 @@
3
3
  */
4
4
  export class StringUtils {
5
5
 
6
+ static readonly ISO_SPLITTER = "/";
7
+
6
8
  /**
7
9
  * 移除字符串前缀
8
10
  * @param str 原始字符串
@@ -117,16 +117,18 @@ export default class InstanceInfo extends React.Component {
117
117
  renderForm = () => {
118
118
  const {data} = this.state
119
119
  const {processDefinitionKey, businessKey} = data
120
+ const formKey = this.props.formKey || processDefinitionKey;
121
+ const formName = formKey + 'Form'
120
122
 
121
- let formKey = this.props.formKey || processDefinitionKey + 'Form';
122
- let ExForm = FormRegistryUtils.get(formKey);
123
+ // let formKey = this.props.formKey || processDefinitionKey + 'Form';
124
+ let ExForm = FormRegistryUtils.get(formName);
123
125
  if (!ExForm) {
124
126
  return <div>
125
127
  <p>
126
- 未注册表单,请注册表单 {formKey}。
128
+ 未创建表单 {formName}。
127
129
  </p>
128
130
  <Typography.Text>
129
- 表单路径:src/forms/{formKey}.jsx
131
+ 表单路径:src/forms/{formName}.jsx
130
132
  </Typography.Text>
131
133
  </div>
132
134
  }