@titaui/pc 1.8.4 → 1.8.61

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 (42) hide show
  1. package/lib/components/dialog/index.css +1 -1
  2. package/lib/components/form/form-fields/duties/index.js +2 -1
  3. package/lib/components/form/form-fields/input/index.js +1 -1
  4. package/lib/components/form/form-fields/input-verification-code/index.js +18 -15
  5. package/lib/components/form/form-fields/password/index.css +18 -0
  6. package/lib/components/form/form-fields/password/index.js +33 -20
  7. package/lib/components/form/index.js +4 -1
  8. package/lib/components/table/index.css +1 -0
  9. package/lib/components/upload-photo-modal/constant.js +10 -4
  10. package/lib/components/upload-photo-modal/index.css +1 -2
  11. package/lib/components/upload-photo-modal/index.js +58 -186
  12. package/lib/components/user-selector/request-apis.js +1 -1
  13. package/lib/pages/personal-info/components/base-info/index.css +31 -3
  14. package/lib/pages/personal-info/components/base-info/index.js +13 -5
  15. package/lib/pages/personal-info/components/{edit-info → edit-base-info}/index.css +1 -1
  16. package/lib/pages/personal-info/components/{edit-info → edit-base-info}/index.js +3 -4
  17. package/lib/pages/personal-info/components/person-photo/index.css +18 -5
  18. package/lib/pages/personal-info/components/person-photo/index.js +18 -3
  19. package/package.json +1 -1
  20. package/src/components/dialog/index.scss +1 -1
  21. package/src/components/form/form-fields/duties/index.tsx +1 -1
  22. package/src/components/form/form-fields/input/index.tsx +2 -2
  23. package/src/components/form/form-fields/input-verification-code/index.tsx +100 -70
  24. package/src/components/form/form-fields/password/index.scss +20 -4
  25. package/src/components/form/form-fields/password/index.tsx +73 -51
  26. package/src/components/form/index.tsx +3 -1
  27. package/src/components/table/index.scss +1 -0
  28. package/src/components/upload-photo-modal/constant.ts +7 -1
  29. package/src/components/upload-photo-modal/index.scss +1 -2
  30. package/src/components/upload-photo-modal/index.tsx +53 -156
  31. package/src/components/user-selector/export-modules/duties-selector/index.tsx +1 -1
  32. package/src/components/user-selector/request-apis.js +1 -1
  33. package/src/pages/personal-info/components/base-info/index.scss +26 -3
  34. package/src/pages/personal-info/components/base-info/index.tsx +12 -3
  35. package/src/pages/personal-info/components/{edit-info → edit-base-info}/index.scss +1 -1
  36. package/src/pages/personal-info/components/{edit-info → edit-base-info}/index.tsx +2 -4
  37. package/src/pages/personal-info/components/person-photo/index.scss +17 -5
  38. package/src/pages/personal-info/components/person-photo/index.tsx +12 -4
  39. package/lib/pages/personal-info/components/edit-info/input/index.css +0 -89
  40. package/lib/pages/personal-info/components/edit-info/input/index.js +0 -199
  41. package/src/pages/personal-info/components/edit-info/input/index.scss +0 -82
  42. package/src/pages/personal-info/components/edit-info/input/index.tsx +0 -145
@@ -1,9 +1,15 @@
1
- import React, { useState, useRef, useEffect, forwardRef, useImperativeHandle } from 'react';
2
- import classNames from 'classnames';
3
- import ToolTip from '../../../tooltip/error-tip';
4
- import './index.scss';
1
+ import React, {
2
+ useState,
3
+ useRef,
4
+ useEffect,
5
+ forwardRef,
6
+ useImperativeHandle,
7
+ } from "react";
8
+ import classNames from "classnames";
9
+ import ToolTip from "../../../tooltip/error-tip";
10
+ import "./index.scss";
5
11
 
6
- const preCls = 'verification-code-input';
12
+ const preCls = "verification-code-input";
7
13
 
8
14
  interface verify {
9
15
  tip: string;
@@ -20,9 +26,10 @@ interface Props {
20
26
  name: string;
21
27
  getContainer?: Function;
22
28
  disabled?: boolean;
23
- layout?: 'clomn'|'row';
29
+ layout?: "clomn" | "row";
24
30
  btnClick?: Function;
25
31
  className?: string;
32
+ beforeSend?: Function;
26
33
  }
27
34
  interface Error {
28
35
  name: string;
@@ -30,11 +37,11 @@ interface Error {
30
37
  }
31
38
 
32
39
  const OverlayInner = ({ hasError, hasActive, tip }) => {
33
- if (hasActive) return <span style={{ 'color': '#3F4755' }}>{tip}</span>;
34
- if (hasError) return <span style={{ 'color': '#F05E5E' }}>{tip}</span>;
40
+ if (hasActive) return <span style={{ color: "#3F4755" }}>{tip}</span>;
41
+ if (hasError) return <span style={{ color: "#F05E5E" }}>{tip}</span>;
35
42
 
36
43
  return <span />;
37
- }
44
+ };
38
45
 
39
46
  export default forwardRef((props: Props, ref) => {
40
47
  const {
@@ -48,21 +55,22 @@ export default forwardRef((props: Props, ref) => {
48
55
  disabled,
49
56
  getContainer,
50
57
  layout,
51
- className="",
52
- btnClick=()=>{},
58
+ className = "",
59
+ btnClick = () => {},
60
+ beforeSend,
53
61
  } = props;
54
62
 
55
63
  const inputRef = useRef<any>();
56
64
  const [hasError, setHasError] = useState<boolean>(false);
57
65
  const [hasActive, setHasActive] = useState<boolean>(false);
58
- const [btn_info, setBtn_info] = useState<any>('获取验证码')
59
- const [btnCanClick, setBtnCanClick] = useState<any>(true)
60
- const [tip, setTip] = useState<string>('');
61
- const [value, setValue] = useState<string>(props.value || '');
66
+ const [btn_info, setBtn_info] = useState<any>("获取验证码");
67
+ const [btnCanClick, setBtnCanClick] = useState<any>(true);
68
+ const [tip, setTip] = useState<string>("");
69
+ const [value, setValue] = useState<string>(props.value || "");
62
70
 
63
71
  useEffect(() => {
64
72
  setValue(props.value);
65
- }, [props.value])
73
+ }, [props.value]);
66
74
 
67
75
  const verifing = (): Error[] => {
68
76
  const value = inputRef.current && inputRef.current.value;
@@ -76,16 +84,16 @@ export default forwardRef((props: Props, ref) => {
76
84
  }
77
85
  }
78
86
  return errors;
79
- }
87
+ };
80
88
 
81
89
  const onInputFocusHandler = () => {
82
90
  setHasActive(true);
83
91
  inputRef.current.setSelectionRange(9999999, 9999999);
84
- }
92
+ };
85
93
 
86
94
  const onBlurHandler = () => {
87
95
  setHasActive(false);
88
- }
96
+ };
89
97
 
90
98
  const onChangeHandler = () => {
91
99
  const value = inputRef.current && inputRef.current.value;
@@ -97,32 +105,35 @@ export default forwardRef((props: Props, ref) => {
97
105
  setTip(errors[0].tip);
98
106
  } else {
99
107
  setHasError(false);
100
- setTip('');
108
+ setTip("");
101
109
  }
102
- }
110
+ };
103
111
 
104
- const HandlerCode = () =>{
105
- const errors = verifing();
106
- if (errors.length) return
107
- if(!btnCanClick || hasError) return
108
- btnClick&&btnClick()
109
- let time = 60
110
- setBtn_info(`${time}s重新发送`)
111
- setBtnCanClick(false)
112
+ const HandlerCode = () => {
113
+ if (beforeSend) {
114
+ const result = beforeSend();
115
+ if (!result) return;
116
+ }
117
+ if (!btnCanClick) return;
118
+
119
+ btnClick && btnClick();
120
+ let time = 60;
121
+ setBtn_info(`${time}s重新发送`);
122
+ setBtnCanClick(false);
112
123
  let timer = setInterval(() => {
113
124
  if (time === 0) {
114
- clearInterval(timer)
115
- setBtn_info('获取验证码')
116
- setBtnCanClick(true)
125
+ clearInterval(timer);
126
+ setBtn_info("获取验证码");
127
+ setBtnCanClick(true);
117
128
  } else {
118
- setBtn_info(`${time}s重新发送`)
129
+ setBtn_info(`${time}s重新发送`);
119
130
  time--;
120
131
  }
121
132
  }, 1000);
122
- }
133
+ };
123
134
 
124
135
  useImperativeHandle(ref, () => ({
125
- 'verifing': (): Error[] => {
136
+ verifing: (): Error[] => {
126
137
  const errors = verifing();
127
138
  if (errors.length) {
128
139
  setHasError(true);
@@ -130,42 +141,61 @@ export default forwardRef((props: Props, ref) => {
130
141
  inputRef.current.focus();
131
142
  }
132
143
  return errors;
133
- }
134
- }))
144
+ },
145
+ }));
135
146
 
136
- return <div className={classNames(preCls,{[`${preCls}-row`]:layout==='row'},className)}>
137
- <div className={classNames(`${preCls}__label`)}>
138
- <span className={classNames(`${preCls}__label-text`)}>{label}</span>
139
- {require && <span className={classNames(`${preCls}__label-require`)}>*</span>}
140
- </div>
141
- <div className={classNames(`${preCls}__border`, {
142
- [`${preCls}__border--error`]: hasError,
143
- [`${preCls}__border--active`]: hasActive,
144
- [`${preCls}__border--disabled`]: disabled
145
- })}>
146
- <ToolTip
147
- placement={'topLeft'}
148
- destroyTooltipOnHide={true}
149
- visible={(hasActive || hasError) && tip}
150
- overlay={<OverlayInner hasActive={hasActive} hasError={hasError} tip={tip} />}
151
- getTooltipContainer={getContainer}
147
+ return (
148
+ <div
149
+ className={classNames(
150
+ preCls,
151
+ { [`${preCls}-row`]: layout === "row" },
152
+ className
153
+ )}
154
+ >
155
+ <div className={classNames(`${preCls}__label`)}>
156
+ <span className={classNames(`${preCls}__label-text`)}>{label}</span>
157
+ {require && (
158
+ <span className={classNames(`${preCls}__label-require`)}>*</span>
159
+ )}
160
+ </div>
161
+ <div
162
+ className={classNames(`${preCls}__border`, {
163
+ [`${preCls}__border--error`]: hasError,
164
+ [`${preCls}__border--active`]: hasActive,
165
+ [`${preCls}__border--disabled`]: disabled,
166
+ })}
152
167
  >
153
- <input
154
- ref={inputRef}
155
- type={type}
156
- disabled={disabled}
157
- className={classNames(`${preCls}__input`)}
158
- value={value}
159
- placeholder={placeholder}
160
- onFocus={onInputFocusHandler}
161
- onBlur={onBlurHandler}
162
- onChange={onChangeHandler}
163
- autoComplete='off'
164
- />
165
- </ToolTip>
166
- <div className={classNames(`${preCls}__btn`,{[`${preCls}__btn--not`]:!btnCanClick})} onClick={HandlerCode}>
167
- {btn_info}
168
+ <ToolTip
169
+ placement={"topLeft"}
170
+ destroyTooltipOnHide={true}
171
+ visible={(hasActive || hasError) && tip}
172
+ overlay={
173
+ <OverlayInner hasActive={hasActive} hasError={hasError} tip={tip} />
174
+ }
175
+ getTooltipContainer={getContainer}
176
+ >
177
+ <input
178
+ ref={inputRef}
179
+ type={type}
180
+ disabled={disabled}
181
+ className={classNames(`${preCls}__input`)}
182
+ value={value}
183
+ placeholder={placeholder}
184
+ onFocus={onInputFocusHandler}
185
+ onBlur={onBlurHandler}
186
+ onChange={onChangeHandler}
187
+ autoComplete="off"
188
+ />
189
+ </ToolTip>
190
+ <div
191
+ className={classNames(`${preCls}__btn`, {
192
+ [`${preCls}__btn--not`]: !btnCanClick,
193
+ })}
194
+ onClick={HandlerCode}
195
+ >
196
+ {btn_info}
197
+ </div>
168
198
  </div>
169
199
  </div>
170
- </div>
171
- })
200
+ );
201
+ });
@@ -1,9 +1,21 @@
1
1
  .form-field-input {
2
+ &-row {
3
+ display: flex;
4
+ align-items: center;
5
+ .form-field-input__label {
6
+ margin-bottom: unset;
7
+ }
8
+ .form-field-input__border {
9
+ margin-left: 16px;
10
+ flex: 1;
11
+ }
12
+ }
2
13
  &__label {
3
14
  height: 22px;
4
15
  font-size: 14px;
5
16
  margin-bottom: 5px;
6
- font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
17
+ font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica,
18
+ sans-serif, PingFang SC, Microsoft YaHei;
7
19
  font-weight: 400;
8
20
  line-height: 22px;
9
21
 
@@ -22,10 +34,13 @@
22
34
  transition: all 0.2s;
23
35
  border: 1px solid #e9ecf0;
24
36
  box-sizing: border-box;
37
+ .tu-icon-yincang {
38
+ cursor: pointer;
39
+ }
25
40
  }
26
41
  &__border--error {
27
- box-shadow: inset 0px 0px 4px 0px rgba(240, 94, 94, 0.3) ;
28
- border: 1px solid #f05e5e ;
42
+ box-shadow: inset 0px 0px 4px 0px rgba(240, 94, 94, 0.3);
43
+ border: 1px solid #f05e5e;
29
44
  }
30
45
  &__border--active {
31
46
  box-shadow: inset 0px 0px 4px 0px rgba(40, 121, 255, 0.3);
@@ -37,7 +52,8 @@
37
52
  padding: 0;
38
53
  width: calc(100% - 12px);
39
54
  font-size: 14px;
40
- font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica, sans-serif, PingFang SC, Microsoft YaHei;
55
+ font-family: -apple-system, Arial, Verdana, Helvetica Neue, Helvetica,
56
+ sans-serif, PingFang SC, Microsoft YaHei;
41
57
  font-weight: 400;
42
58
  color: #3f4755;
43
59
  height: 22px;
@@ -1,9 +1,15 @@
1
- import React, { useState, useRef, useEffect, forwardRef, useImperativeHandle } from 'react';
2
- import classNames from 'classnames';
3
- import ToolTip from '../../../tooltip/error-tip';
4
- import './index.scss';
1
+ import React, {
2
+ useState,
3
+ useRef,
4
+ useEffect,
5
+ forwardRef,
6
+ useImperativeHandle,
7
+ } from "react";
8
+ import classNames from "classnames";
9
+ import ToolTip from "../../../tooltip/error-tip";
10
+ import "./index.scss";
5
11
 
6
- const preCls = 'form-field-input';
12
+ const preCls = "form-field-input";
7
13
 
8
14
  interface verify {
9
15
  tip: string;
@@ -16,9 +22,9 @@ interface Props {
16
22
  onChange?: Function;
17
23
  value?: any;
18
24
  require?: boolean;
19
- type?: string;
20
25
  name: string;
21
26
  getContainer?: Function;
27
+ layout?: "clomn" | "row";
22
28
  }
23
29
  interface Error {
24
30
  name: string;
@@ -26,10 +32,10 @@ interface Error {
26
32
  }
27
33
 
28
34
  const OverlayInner = ({ hasError, hasActive, tip }) => {
29
- if (hasError) return <span style={{ 'color': '#F05E5E' }}>{tip}</span>;
30
- if (hasActive) return <span style={{ 'color': '#3F4755' }}>{tip}</span>;
35
+ if (hasError) return <span style={{ color: "#F05E5E" }}>{tip}</span>;
36
+ if (hasActive) return <span style={{ color: "#3F4755" }}>{tip}</span>;
31
37
  return <span />;
32
- }
38
+ };
33
39
 
34
40
  export default forwardRef((props: Props, ref) => {
35
41
  const {
@@ -38,20 +44,21 @@ export default forwardRef((props: Props, ref) => {
38
44
  placeholder,
39
45
  onChange,
40
46
  require,
41
- type,
42
47
  name,
43
- getContainer
48
+ getContainer,
49
+ layout,
44
50
  } = props;
45
51
 
46
52
  const inputRef = useRef<any>();
47
53
  const [hasError, setHasError] = useState<boolean>(false);
48
54
  const [hasActive, setHasActive] = useState<boolean>(false);
49
- const [tip, setTip] = useState<string>('');
50
- const [value, setValue] = useState<string>(props.value || '');
55
+ const [showPwd, setShowPwd] = useState(false);
56
+ const [tip, setTip] = useState<string>("");
57
+ const [value, setValue] = useState<string>(props.value || "");
51
58
 
52
59
  useEffect(() => {
53
60
  setValue(props.value);
54
- }, [props.value])
61
+ }, [props.value]);
55
62
 
56
63
  const verifing = (): Error[] => {
57
64
  const value = inputRef.current && inputRef.current.value;
@@ -65,16 +72,16 @@ export default forwardRef((props: Props, ref) => {
65
72
  }
66
73
  }
67
74
  return errors;
68
- }
75
+ };
69
76
 
70
77
  const onInputFocusHandler = () => {
71
78
  setHasActive(true);
72
79
  inputRef.current.setSelectionRange(9999999, 9999999);
73
- }
80
+ };
74
81
 
75
82
  const onBlurHandler = () => {
76
83
  setHasActive(false);
77
- }
84
+ };
78
85
 
79
86
  const onChangeHandler = () => {
80
87
  const value = inputRef.current && inputRef.current.value;
@@ -86,12 +93,12 @@ export default forwardRef((props: Props, ref) => {
86
93
  setTip(errors[0].tip);
87
94
  } else {
88
95
  setHasError(false);
89
- setTip('');
96
+ setTip("");
90
97
  }
91
- }
98
+ };
92
99
 
93
100
  useImperativeHandle(ref, () => ({
94
- 'verifing': (): Error[] => {
101
+ verifing: (): Error[] => {
95
102
  const errors = verifing();
96
103
  if (errors.length) {
97
104
  setHasError(true);
@@ -99,37 +106,52 @@ export default forwardRef((props: Props, ref) => {
99
106
  inputRef.current.focus();
100
107
  }
101
108
  return errors;
102
- }
103
- }))
109
+ },
110
+ }));
104
111
 
105
- return <div className={classNames(preCls)}>
106
- <div className={classNames(`${preCls}__label`)}>
107
- <span className={classNames(`${preCls}__label-text`)}>{label}</span>
108
- {require && <span className={classNames(`${preCls}__label-require`)}>*</span>}
109
- </div>
110
- <div className={classNames(`${preCls}__border`, {
111
- [`${preCls}__border--error`]: hasError,
112
- [`${preCls}__border--active`]: hasActive
113
- })}>
114
- <ToolTip
115
- placement={'topLeft'}
116
- destroyTooltipOnHide={true}
117
- visible={(hasActive || hasError) && tip}
118
- overlay={<OverlayInner hasActive={hasActive} hasError={hasError} tip={tip} />}
119
- getTooltipContainer={getContainer}
112
+ const onTypeChangeHandler = () => setShowPwd(!showPwd);
113
+
114
+ return (
115
+ <div
116
+ className={classNames(preCls, { [`${preCls}-row`]: layout === "row" })}
117
+ >
118
+ <div className={classNames(`${preCls}__label`)}>
119
+ <span className={classNames(`${preCls}__label-text`)}>{label}</span>
120
+ {require && (
121
+ <span className={classNames(`${preCls}__label-require`)}>*</span>
122
+ )}
123
+ </div>
124
+ <div
125
+ className={classNames(`${preCls}__border`, {
126
+ [`${preCls}__border--error`]: hasError,
127
+ [`${preCls}__border--active`]: hasActive,
128
+ })}
120
129
  >
121
- <input
122
- ref={inputRef}
123
- type={type}
124
- className={classNames(`${preCls}__input`)}
125
- value={value}
126
- placeholder={placeholder}
127
- onFocus={onInputFocusHandler}
128
- onBlur={onBlurHandler}
129
- onChange={onChangeHandler}
130
- autoComplete='off'
131
- />
132
- </ToolTip>
130
+ <ToolTip
131
+ placement={"topLeft"}
132
+ destroyTooltipOnHide={true}
133
+ visible={(hasActive || hasError) && tip}
134
+ overlay={
135
+ <OverlayInner hasActive={hasActive} hasError={hasError} tip={tip} />
136
+ }
137
+ getTooltipContainer={getContainer}
138
+ >
139
+ <>
140
+ <input
141
+ ref={inputRef}
142
+ type={showPwd ? "text" : "password"}
143
+ className={classNames(`${preCls}__input`)}
144
+ value={value}
145
+ placeholder={placeholder}
146
+ onFocus={onInputFocusHandler}
147
+ onBlur={onBlurHandler}
148
+ onChange={onChangeHandler}
149
+ autoComplete="off"
150
+ />
151
+ <span className="tu-icon-yincang" onClick={onTypeChangeHandler} />
152
+ </>
153
+ </ToolTip>
154
+ </div>
133
155
  </div>
134
- </div>
135
- })
156
+ );
157
+ });
@@ -8,7 +8,8 @@ import _FormFieldTextarea from "./form-fields/textarea";
8
8
  import _FormFieldRadios from "./form-fields/radios";
9
9
  import _FormFieldDropDown from "./form-fields/dropdown";
10
10
  import _FormFieldGroup from "./form-fields/group";
11
- import _FormFieldVerificationCode from "./form-fields/input-verification-code"
11
+ import _FormFieldVerificationCode from "./form-fields/input-verification-code";
12
+ import _Password from './form-fields/password';
12
13
  import { SingleLayout } from "./layout";
13
14
  import "./index.scss";
14
15
 
@@ -102,6 +103,7 @@ const FormFields = {
102
103
  DropDown:_FormFieldDropDown,
103
104
  GroupFields:_FormFieldGroup,
104
105
  VerificationInput:_FormFieldVerificationCode,
106
+ Password: _Password
105
107
  };
106
108
  //@ts-ignore
107
109
  Form.Fields = FormFields
@@ -9,6 +9,7 @@
9
9
  &__table {
10
10
  width: 100%;
11
11
  overflow: auto;
12
+ min-height: 200px;
12
13
  &-pagination {
13
14
  padding: 10px 0 0 0;
14
15
  display: flex;
@@ -3,10 +3,12 @@ export const List = [
3
3
  {
4
4
  id: 'person',
5
5
  accept: '.jpg,.jpeg,.gif,.png',
6
- autoCropArea: 0.5,
6
+ autoCropArea: 1,
7
7
  initialAspectRatio: 1,
8
8
  tips: '仅支持 jpg、jpeg、gif、png 格式 建议图片最小尺寸 150*150px',
9
9
  previewTitle: '预览',
10
+ minCropBoxHeight: 60,
11
+ minCropBoxWidth: 60,
10
12
  },
11
13
  {
12
14
  id: 'enterprise',
@@ -15,6 +17,8 @@ export const List = [
15
17
  initialAspectRatio: 5,
16
18
  tips: '建议 logo 尺寸 400*80 logo 最佳适配颜色为白色 仅支持 jpg、jpeg、gif、png 格式',
17
19
  previewTitle: 'logo 预览',
20
+ minCropBoxHeight: 20,
21
+ minCropBoxWidth: 20,
18
22
  },
19
23
  {
20
24
  id: 'browser',
@@ -23,5 +27,7 @@ export const List = [
23
27
  initialAspectRatio: 1,
24
28
  tips: '图标尺寸 18*18,超过将被浏览器压缩',
25
29
  previewTitle: '浏览器图标预览',
30
+ minCropBoxHeight: 20,
31
+ minCropBoxWidth: 20,
26
32
  }
27
33
  ];
@@ -161,8 +161,7 @@
161
161
  &-img {
162
162
  position: absolute;
163
163
  top: 1px;
164
- right: 45px;
165
- width: 70px;
164
+ min-width: 70px;
166
165
  height: 28px;
167
166
  }
168
167
  &-title {