aldehyde 0.2.433 → 0.2.435
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/lib/controls/2dEditor/components/card.js +1 -1
- package/lib/controls/2dEditor/components/card.js.map +1 -1
- package/lib/controls/file-view/drawer-file-view.d.ts +5 -16
- package/lib/controls/file-view/drawer-file-view.d.ts.map +1 -1
- package/lib/controls/file-view/drawer-file-view.js +55 -40
- package/lib/controls/file-view/drawer-file-view.js.map +1 -1
- package/lib/controls/file-view/index.js +1 -1
- package/lib/controls/file-view/index.js.map +1 -1
- package/lib/controls/file-view/index.less +10 -0
- package/lib/controls/upload/index.js +2 -3
- package/lib/controls/upload/index.js.map +1 -1
- package/lib/controls/upload/mult-file-upload.d.ts.map +1 -1
- package/lib/controls/upload/mult-file-upload.js +4 -4
- package/lib/controls/upload/mult-file-upload.js.map +1 -1
- package/lib/form/criteria-form.d.ts.map +1 -1
- package/lib/form/criteria-form.js +4 -4
- package/lib/form/criteria-form.js.map +1 -1
- package/lib/table/relation-table.d.ts +1 -0
- package/lib/table/relation-table.d.ts.map +1 -1
- package/lib/tmpl/interface.d.ts +1 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/interface.js.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
- package/lib/tmpl/tmpl-config-analysis.js +10 -8
- package/lib/tmpl/tmpl-config-analysis.js.map +1 -1
- package/package.json +2 -1
- package/src/aldehyde/controls/2dEditor/components/card.tsx +1 -1
- package/src/aldehyde/controls/2dEditor/components/data.d.ts +1 -0
- package/src/aldehyde/controls/file-view/drawer-file-view.tsx +106 -66
- package/src/aldehyde/controls/file-view/index.less +10 -0
- package/src/aldehyde/controls/file-view/index.tsx +1 -1
- package/src/aldehyde/controls/upload/index.tsx +3 -3
- package/src/aldehyde/controls/upload/mult-file-upload.tsx +91 -89
- package/src/aldehyde/form/criteria-form.tsx +5 -4
- package/src/aldehyde/tmpl/interface.tsx +1 -0
- package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +11 -8
|
@@ -7,74 +7,74 @@ import Super from "../../tmpl/superagent";
|
|
|
7
7
|
import Units from "../../units";
|
|
8
8
|
import { LocaleContext } from "../../locale/LocaleProvider";
|
|
9
9
|
interface UploadProps extends EControlProps {
|
|
10
|
-
maxCount:number
|
|
10
|
+
maxCount: number
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
interface UploadState {
|
|
14
|
-
fileList:any[],
|
|
14
|
+
fileList: any[],
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export default class MultiFileUpload extends React.PureComponent<
|
|
18
18
|
UploadProps,
|
|
19
19
|
UploadState
|
|
20
20
|
> {
|
|
21
|
-
state = {fileList:null};
|
|
21
|
+
state = { fileList: null };
|
|
22
22
|
static contextType = LocaleContext;
|
|
23
23
|
context: React.ContextType<typeof LocaleContext>;
|
|
24
24
|
|
|
25
25
|
handleRemove = (info) => {
|
|
26
|
-
const {fileList}=this.state;
|
|
26
|
+
const { fileList } = this.state;
|
|
27
27
|
const { onChange } = this.props;
|
|
28
|
-
if(fileList && fileList.length>1){
|
|
29
|
-
let tFileList=[];
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
if (fileList && fileList.length > 1) {
|
|
29
|
+
let tFileList = [];
|
|
30
|
+
for (let f of fileList) {
|
|
31
|
+
if (f.uid != info.uid) {
|
|
32
|
+
tFileList.push(f);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
35
|
//this.setState({fileList:fileList})
|
|
36
36
|
onChange(JSON.stringify(tFileList));
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
}else{
|
|
38
|
+
//this.setState({fileList:tFileList});
|
|
39
|
+
} else {
|
|
40
40
|
onChange(JSON.stringify({ valid: "delete" }));
|
|
41
|
-
this.setState({fileList:[]});
|
|
41
|
+
this.setState({ fileList: [] });
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
handleChange = async (info) => {
|
|
46
46
|
console.log("file change:", info);
|
|
47
|
-
let fileList:any[]=[];
|
|
47
|
+
let fileList: any[] = [];
|
|
48
48
|
|
|
49
|
-
let status=undefined;
|
|
50
|
-
if(info.fileList){
|
|
51
|
-
info.fileList.forEach(a=>{
|
|
52
|
-
if(a.status===undefined || a.status
|
|
53
|
-
status="uploading";
|
|
49
|
+
let status = undefined;
|
|
50
|
+
if (info.fileList) {
|
|
51
|
+
info.fileList.forEach(a => {
|
|
52
|
+
if (a.status === undefined || a.status == "uploading") {
|
|
53
|
+
status = "uploading";
|
|
54
54
|
}
|
|
55
55
|
})
|
|
56
56
|
|
|
57
|
-
if(!status){
|
|
58
|
-
status="done";
|
|
57
|
+
if (!status) {
|
|
58
|
+
status = "done";
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
if(status == "uploading"){
|
|
64
|
-
if(info.fileList){
|
|
65
|
-
info.fileList.forEach(a=>{
|
|
66
|
-
if(a.status===undefined || a.status
|
|
63
|
+
if (status == "uploading") {
|
|
64
|
+
if (info.fileList) {
|
|
65
|
+
info.fileList.forEach(a => {
|
|
66
|
+
if (a.status === undefined || a.status == "done") {
|
|
67
67
|
fileList.push(a);
|
|
68
|
-
|
|
68
|
+
}
|
|
69
69
|
})
|
|
70
70
|
}
|
|
71
|
-
if(info.fileList){
|
|
72
|
-
info.fileList.forEach(a=>{
|
|
73
|
-
if(a.status
|
|
71
|
+
if (info.fileList) {
|
|
72
|
+
info.fileList.forEach(a => {
|
|
73
|
+
if (a.status === "uploading") {
|
|
74
74
|
let newFile1: FileValue = {
|
|
75
75
|
valid: "new",
|
|
76
|
-
uid:a.uid,
|
|
77
|
-
status:a.status,
|
|
76
|
+
uid: a.uid,
|
|
77
|
+
status: a.status,
|
|
78
78
|
fileKey: "",
|
|
79
79
|
fileName: a.name,
|
|
80
80
|
};
|
|
@@ -82,17 +82,17 @@ export default class MultiFileUpload extends React.PureComponent<
|
|
|
82
82
|
}
|
|
83
83
|
})
|
|
84
84
|
}
|
|
85
|
-
this.setState({fileList})
|
|
86
|
-
}else if (status == "done") {
|
|
87
|
-
if(info.fileList){
|
|
88
|
-
info.fileList.forEach(a=>{
|
|
89
|
-
if(!a.originFileObj){//已保存的数据
|
|
90
|
-
|
|
91
|
-
}else{
|
|
85
|
+
this.setState({ fileList })
|
|
86
|
+
} else if (status == "done") {
|
|
87
|
+
if (info.fileList) {
|
|
88
|
+
info.fileList.forEach(a => {
|
|
89
|
+
if (!a.originFileObj) {//已保存的数据
|
|
90
|
+
fileList.push(a);
|
|
91
|
+
} else {
|
|
92
92
|
let newFile: FileValue = {
|
|
93
93
|
valid: "new",
|
|
94
|
-
status:a.status,
|
|
95
|
-
uid:a.uid,
|
|
94
|
+
status: a.status,
|
|
95
|
+
uid: a.uid,
|
|
96
96
|
fileKey: a.response.fileKey,
|
|
97
97
|
fileName: a.name,
|
|
98
98
|
};
|
|
@@ -110,84 +110,84 @@ export default class MultiFileUpload extends React.PureComponent<
|
|
|
110
110
|
|
|
111
111
|
const isLt5M = file.size / 1024 / 1024 < 200;
|
|
112
112
|
if (!isLt5M) {
|
|
113
|
-
message.error(translate("${超过200M限制 不允许上传~}"),5);
|
|
113
|
+
message.error(translate("${超过200M限制 不允许上传~}"), 5);
|
|
114
114
|
return false;
|
|
115
115
|
} else {
|
|
116
116
|
return true;
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
componentDidMount() {
|
|
120
|
-
const {value}=this.props;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
const { value } = this.props;
|
|
121
|
+
let fileList = this.transvalue(value);
|
|
122
|
+
this.setState({ fileList })
|
|
123
|
+
}
|
|
124
124
|
|
|
125
125
|
componentDidUpdate(prevProps: Readonly<UploadProps>, prevState: Readonly<UploadState>, snapshot?: any) {
|
|
126
|
-
const {value:preValue}=prevProps;
|
|
127
|
-
const {value}=this.props;
|
|
128
|
-
if(value && value!=preValue){
|
|
129
|
-
let fileList=this.transvalue(value);
|
|
130
|
-
this.setState({fileList})
|
|
126
|
+
const { value: preValue } = prevProps;
|
|
127
|
+
const { value } = this.props;
|
|
128
|
+
if (value && value != preValue) {
|
|
129
|
+
let fileList = this.transvalue(value);
|
|
130
|
+
this.setState({ fileList })
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
transvalue=(value)=>{
|
|
135
|
-
const {serverKey}=this.props;
|
|
134
|
+
transvalue = (value) => {
|
|
135
|
+
const { serverKey } = this.props;
|
|
136
136
|
let value_1 = value;
|
|
137
137
|
let fileList = [];
|
|
138
138
|
if (typeof value_1 == "string") {
|
|
139
139
|
value_1 = JSON.parse(value);
|
|
140
|
-
if(value_1 instanceof Array){
|
|
141
|
-
value_1.forEach(a=>{
|
|
140
|
+
if (value_1 instanceof Array) {
|
|
141
|
+
value_1.forEach(a => {
|
|
142
142
|
if (a.valid == "new") {
|
|
143
143
|
fileList.push({
|
|
144
|
-
valid:"new",
|
|
145
|
-
url:a.url,
|
|
146
|
-
fileKey:a.fileKey,
|
|
147
|
-
status:"done",
|
|
144
|
+
valid: "new",
|
|
145
|
+
url: a.url,
|
|
146
|
+
fileKey: a.fileKey,
|
|
147
|
+
status: "done",
|
|
148
148
|
uid: a.uid,
|
|
149
|
-
name: a.fileName?a.fileName:a.name,
|
|
149
|
+
name: a.fileName ? a.fileName : a.name,
|
|
150
150
|
})
|
|
151
|
-
} else if(a.uid){
|
|
151
|
+
} else if (a.uid) {
|
|
152
152
|
fileList.push({
|
|
153
|
-
atRatCode:a.atRatCode,
|
|
154
|
-
valid:a.valid,
|
|
153
|
+
atRatCode: a.atRatCode,
|
|
154
|
+
valid: a.valid,
|
|
155
155
|
uid: a.uid,
|
|
156
156
|
name: a.name,
|
|
157
|
-
fileKey:a.base?a.base.bytesInfoVO.code:a.fileKey,
|
|
157
|
+
fileKey: a.base ? a.base.bytesInfoVO.code : a.fileKey,
|
|
158
158
|
status: "done",
|
|
159
|
-
url:a.url,
|
|
159
|
+
url: a.url,
|
|
160
160
|
});
|
|
161
|
-
}else {
|
|
161
|
+
} else {
|
|
162
162
|
fileList.push({
|
|
163
|
-
atRatCode:a.atRatCode,
|
|
164
|
-
valid:a.valid,
|
|
165
|
-
uid: a.base?a.base.bytesInfoVO.code:a.fileKey,
|
|
163
|
+
atRatCode: a.atRatCode,
|
|
164
|
+
valid: a.valid,
|
|
165
|
+
uid: a.base ? a.base.bytesInfoVO.code : a.fileKey,
|
|
166
166
|
name: a.base.fileName,
|
|
167
|
-
fileKey:a.base?a.base.bytesInfoVO.code:a.fileKey,
|
|
167
|
+
fileKey: a.base ? a.base.bytesInfoVO.code : a.fileKey,
|
|
168
168
|
status: "done",
|
|
169
169
|
url: encodeURI(Units.joinPath(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
170
|
+
Units.joinPath(Units.api(), "/v3/files"),
|
|
171
|
+
a.base.path
|
|
172
|
+
)) +
|
|
173
|
+
`?@token=${Units.serverHydrocarbonToken(serverKey)}&@programToken=${Units.programCode(serverKey)}&disposition=attachment`,
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
})
|
|
178
|
-
}else if (value_1.valid === true) {
|
|
178
|
+
} else if (value_1.valid === true) {
|
|
179
179
|
fileList.push({
|
|
180
|
-
atRatCode:value_1.atRatCode,
|
|
180
|
+
atRatCode: value_1.atRatCode,
|
|
181
181
|
uid: value_1.base.bytesInfoVO.code,
|
|
182
182
|
name: value_1.base.fileName,
|
|
183
|
-
fileKey:value_1.base.bytesInfoVO.code,
|
|
183
|
+
fileKey: value_1.base.bytesInfoVO.code,
|
|
184
184
|
status: "done",
|
|
185
185
|
url:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
encodeURI(Units.joinPath(
|
|
187
|
+
Units.joinPath(Units.api(), "/v3/files"),
|
|
188
|
+
value_1.base.path
|
|
189
|
+
)) +
|
|
190
|
+
`?@token=${Units.serverHydrocarbonToken(serverKey)}&@programToken=${Units.programCode(serverKey)}&disposition=attachment`,
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
}
|
|
@@ -195,10 +195,11 @@ export default class MultiFileUpload extends React.PureComponent<
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
render() {
|
|
198
|
-
const { id, itemType, disabled, serverKey } = this.props;
|
|
198
|
+
const { id, itemType, disabled, serverKey, fieldConfig } = this.props;
|
|
199
|
+
const { showUploadList = true, uploadText } = fieldConfig || {};
|
|
199
200
|
const { translate } = this.context;
|
|
200
|
-
const {fileList}=this.state;
|
|
201
|
-
let maxCount=this.props.maxCount?this.props.maxCount:1;
|
|
201
|
+
const { fileList } = this.state;
|
|
202
|
+
let maxCount = this.props.maxCount ? this.props.maxCount : 1;
|
|
202
203
|
|
|
203
204
|
return (
|
|
204
205
|
<div>
|
|
@@ -209,8 +210,8 @@ export default class MultiFileUpload extends React.PureComponent<
|
|
|
209
210
|
itemType === "picture"
|
|
210
211
|
? ".png, .jpg, .jpeg"
|
|
211
212
|
: itemType === "video"
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
? ".mp4"
|
|
214
|
+
: undefined
|
|
214
215
|
}
|
|
215
216
|
listType={itemType == "picture" ? "picture" : "text"}
|
|
216
217
|
fileList={!fileList ? undefined : fileList}
|
|
@@ -222,13 +223,14 @@ export default class MultiFileUpload extends React.PureComponent<
|
|
|
222
223
|
beforeUpload={this.beforeUpload}
|
|
223
224
|
onChange={this.handleChange}
|
|
224
225
|
onRemove={this.handleRemove}
|
|
226
|
+
showUploadList={showUploadList}
|
|
225
227
|
>
|
|
226
228
|
{fileList && fileList.length >= maxCount ? (
|
|
227
229
|
""
|
|
228
230
|
) : (
|
|
229
231
|
<Button disabled={disabled}>
|
|
230
|
-
<UploadOutlined />
|
|
231
|
-
{disabled ? translate("${无需上传}") : translate("${上传文件}")}
|
|
232
|
+
<UploadOutlined />
|
|
233
|
+
{disabled ? translate("${无需上传}") : (uploadText ? translate("${" + uploadText + "}") : translate("${上传文件}"))}
|
|
232
234
|
</Button>
|
|
233
235
|
)}
|
|
234
236
|
</AntdUpload>
|
|
@@ -159,7 +159,7 @@ const CriteriaForm: React.FC<CriteriaFormProps> = (props) => {
|
|
|
159
159
|
|
|
160
160
|
useEffect(() => { // 表单初始化设置
|
|
161
161
|
if (Object.keys(initialValues)?.length) {
|
|
162
|
-
onValuesChange(initialValues);
|
|
162
|
+
onValuesChange(initialValues, false);
|
|
163
163
|
}
|
|
164
164
|
}, [initialValues]);
|
|
165
165
|
|
|
@@ -404,7 +404,7 @@ const CriteriaForm: React.FC<CriteriaFormProps> = (props) => {
|
|
|
404
404
|
);
|
|
405
405
|
};
|
|
406
406
|
|
|
407
|
-
const onValuesChange = (changedValues) => {
|
|
407
|
+
const onValuesChange = (changedValues, clearCurrent = true) => {
|
|
408
408
|
let appCtmplConfig = ProgramConfig.getAppCtmplConfig(
|
|
409
409
|
ltmplConfig,
|
|
410
410
|
data,
|
|
@@ -415,7 +415,8 @@ const CriteriaForm: React.FC<CriteriaFormProps> = (props) => {
|
|
|
415
415
|
appCtmplConfig.onCriteriaValuesChange(
|
|
416
416
|
changedValues,
|
|
417
417
|
data,
|
|
418
|
-
form
|
|
418
|
+
form,
|
|
419
|
+
clearCurrent
|
|
419
420
|
);
|
|
420
421
|
}
|
|
421
422
|
// if (onValuesChange) {
|
|
@@ -507,7 +508,7 @@ const CriteriaForm: React.FC<CriteriaFormProps> = (props) => {
|
|
|
507
508
|
initialValues={initialValues}
|
|
508
509
|
layout="inline"
|
|
509
510
|
onFinish={searchSubmit}
|
|
510
|
-
onValuesChange={onValuesChange}
|
|
511
|
+
onValuesChange={(val) => onValuesChange(val)}
|
|
511
512
|
style={{ width: "100%" }}
|
|
512
513
|
>
|
|
513
514
|
|
|
@@ -464,6 +464,7 @@ export interface FieldConfig extends FieldBase {
|
|
|
464
464
|
themeIcon?: string; // Icon
|
|
465
465
|
defShowIcon?: boolean; // 图片组件,是否默认显示缩略图,默认显示
|
|
466
466
|
showUploadList?: boolean; // 上传组件是否显示文件列表
|
|
467
|
+
uploadText?: string; // 上传组件文本配置
|
|
467
468
|
}
|
|
468
469
|
|
|
469
470
|
export interface ActionRenderProps {
|
|
@@ -524,7 +524,8 @@ TmplConfigAnalysis.buildInCtmplConfig = (
|
|
|
524
524
|
function setConfig(
|
|
525
525
|
changedValues,
|
|
526
526
|
allValues: DtmplData,
|
|
527
|
-
formInstance: FormInstance
|
|
527
|
+
formInstance: FormInstance,
|
|
528
|
+
clearCurrent = true
|
|
528
529
|
) {
|
|
529
530
|
for (let field of ltmplConfig.buildInFuncFields) {
|
|
530
531
|
|
|
@@ -541,11 +542,13 @@ TmplConfigAnalysis.buildInCtmplConfig = (
|
|
|
541
542
|
"secondCriteria": secondCriteria
|
|
542
543
|
};
|
|
543
544
|
field.configChanged = true;
|
|
544
|
-
if (
|
|
545
|
-
formInstance.
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
formInstance.
|
|
545
|
+
if (clearCurrent) { // 是否清除关联项(搜索表单初始化设置不可清除)
|
|
546
|
+
if (formInstance.getFieldValue(field.id)) {
|
|
547
|
+
formInstance.setFieldValue(field.id, null);
|
|
548
|
+
}
|
|
549
|
+
if (formInstance.getFieldValue("c_" + field.id)) {
|
|
550
|
+
formInstance.setFieldValue("c_" + field.id, null);
|
|
551
|
+
}
|
|
549
552
|
}
|
|
550
553
|
}
|
|
551
554
|
}
|
|
@@ -553,8 +556,8 @@ TmplConfigAnalysis.buildInCtmplConfig = (
|
|
|
553
556
|
|
|
554
557
|
//debugger
|
|
555
558
|
setConfig(null, criteriaData, null);
|
|
556
|
-
ltmplConfig.onCriteriaValuesChange = (changedValues, allValues, formInstance) => {
|
|
557
|
-
setConfig(changedValues, allValues, formInstance);
|
|
559
|
+
ltmplConfig.onCriteriaValuesChange = (changedValues, allValues, formInstance, clearCurrent?: boolean) => {
|
|
560
|
+
setConfig(changedValues, allValues, formInstance, clearCurrent);
|
|
558
561
|
};
|
|
559
562
|
return ltmplConfig;
|
|
560
563
|
} else {
|