aldehyde 0.0.1
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/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/163.js +2 -0
- package/dist/163.js.LICENSE.txt +43 -0
- package/dist/41.js +1 -0
- package/dist/aldehyde.js +2 -0
- package/dist/aldehyde.js.LICENSE.txt +122 -0
- package/dist/chemstruc-graph.js +1 -0
- package/dist/css/163-24392163d3c7b54ea806.css +11 -0
- package/dist/css/290-5e8e152675ab7d201c00.css +886 -0
- package/dist/css/chemstruc-graph-87868f791bf92fb80db9.css +29 -0
- package/dist/css/main-2e6725ec1b56da516cee.css +256 -0
- package/dist/html-editor-draft.js +2 -0
- package/dist/html-editor-draft.js.LICENSE.txt +5 -0
- package/dist/images/logo-06f6a5d8.png +0 -0
- package/dist/index.html +4 -0
- package/dist/signature.js +2 -0
- package/dist/signature.js.LICENSE.txt +17 -0
- package/package.json +180 -0
- package/src/components/chart/antd/Chart.js +32 -0
- package/src/components/chart/antd/Chart10000.js +90 -0
- package/src/components/chart/antd/Max2DimLineChart.js +128 -0
- package/src/components/chart/antd/PieChart1.js +54 -0
- package/src/components/chart/antd/PieChart2.js +56 -0
- package/src/components/chart/antd/chart-utils.tsx +50 -0
- package/src/components/chart/antd/column-chart-sub.tsx +67 -0
- package/src/components/chart/antd/line-chart-sub.tsx +65 -0
- package/src/components/chart/antd/pie-chart-sub.tsx +54 -0
- package/src/components/chart/antd/statview-d2-chart.tsx +125 -0
- package/src/components/chart/statview-l2-chart.tsx +69 -0
- package/src/components/controls/action/index.css +9 -0
- package/src/components/controls/action/index.tsx +228 -0
- package/src/components/controls/action/utils.tsx +122 -0
- package/src/components/controls/auto-complete/index.tsx +80 -0
- package/src/components/controls/cascader/index.js +97 -0
- package/src/components/controls/chemstruc/graph.tsx +150 -0
- package/src/components/controls/chemstruc/index.css +28 -0
- package/src/components/controls/collapse-card/index.css +9 -0
- package/src/components/controls/collapse-card/index.tsx +59 -0
- package/src/components/controls/color-picker/index.css +27 -0
- package/src/components/controls/color-picker/index.tsx +88 -0
- package/src/components/controls/cquery/cquick-button.tsx +117 -0
- package/src/components/controls/date-picker/index.tsx +141 -0
- package/src/components/controls/entity-select/entity-select.tsx +277 -0
- package/src/components/controls/entity-select/index.css +6 -0
- package/src/components/controls/entity-select/popover-entity-select.tsx +112 -0
- package/src/components/controls/entry-control.tsx +240 -0
- package/src/components/controls/enum-badge/index.tsx +28 -0
- package/src/components/controls/enum-tag/index.tsx +30 -0
- package/src/components/controls/file-view/drawer-file-view.tsx +69 -0
- package/src/components/controls/file-view/index.tsx +145 -0
- package/src/components/controls/html-editor/draft.tsx +161 -0
- package/src/components/controls/html-editor/tinymce.js +55 -0
- package/src/components/controls/input-number/index.tsx +101 -0
- package/src/components/controls/input-range/index.tsx +48 -0
- package/src/components/controls/password-setter/index.css +3 -0
- package/src/components/controls/password-setter/index.js +70 -0
- package/src/components/controls/progress/index.tsx +61 -0
- package/src/components/controls/relation-existion/index.css +4 -0
- package/src/components/controls/relation-existion/index.tsx +108 -0
- package/src/components/controls/rfield/index.css +4 -0
- package/src/components/controls/rfield/index.tsx +161 -0
- package/src/components/controls/signature/index.tsx +162 -0
- package/src/components/controls/steps/index.tsx +58 -0
- package/src/components/controls/text/ellipsis-text.tsx +70 -0
- package/src/components/controls/upload/index.tsx +122 -0
- package/src/components/controls/view-control.tsx +177 -0
- package/src/components/detail/button/cquery-button-bar.tsx +112 -0
- package/src/components/detail/button/index.css +43 -0
- package/src/components/detail/button/submit-button-bar.tsx +151 -0
- package/src/components/detail/dtmpl.css +53 -0
- package/src/components/detail/edit/dtmpl-edit.tsx +218 -0
- package/src/components/detail/edit/fields-edit-card.tsx +103 -0
- package/src/components/detail/edit/modal-dtmpl-edit.tsx +198 -0
- package/src/components/detail/edit/modal-row-edit.tsx +72 -0
- package/src/components/detail/edit/post-result/index.tsx +52 -0
- package/src/components/detail/edit/row-edit-card.tsx +125 -0
- package/src/components/detail/edit/row-editor.tsx +71 -0
- package/src/components/detail/rightbar/index.css +35 -0
- package/src/components/detail/rightbar/index.tsx +76 -0
- package/src/components/detail/view/act-dtmpl-view.tsx +155 -0
- package/src/components/detail/view/dtmpl-view.tsx +143 -0
- package/src/components/detail/view/field-view-group.tsx +73 -0
- package/src/components/detail/view/modal-dtmpl-view.tsx +56 -0
- package/src/components/detail/view/snapshot-timeline.tsx +130 -0
- package/src/components/exportor/export-frame.css +3 -0
- package/src/components/exportor/export-frame.tsx +194 -0
- package/src/components/exportor/index.tsx +60 -0
- package/src/components/form/criteria-form.tsx +241 -0
- package/src/components/form/dtmpl-form.css +4 -0
- package/src/components/form/dtmpl-form.tsx +272 -0
- package/src/components/form/field-group-form.tsx +75 -0
- package/src/components/form/fields-form.tsx +51 -0
- package/src/components/form/form-Item-group.tsx +99 -0
- package/src/components/form/index.css +13 -0
- package/src/components/import/excel-import.tsx +316 -0
- package/src/components/import/index.css +54 -0
- package/src/components/import/template-builder.js +474 -0
- package/src/components/import/template.css +51 -0
- package/src/components/layout/MainPage.tsx +230 -0
- package/src/components/layout/footer/index.css +6 -0
- package/src/components/layout/footer/index.js +17 -0
- package/src/components/layout/header/index.css +86 -0
- package/src/components/layout/header/index.tsx +58 -0
- package/src/components/layout/menu/block.tsx +88 -0
- package/src/components/layout/menu/l2menu-message-bar.tsx +118 -0
- package/src/components/layout/menu/l2menu-quick-bar.tsx +132 -0
- package/src/components/layout/menu/menu-2layers.tsx +92 -0
- package/src/components/layout/menu/menu-render.tsx +49 -0
- package/src/components/layout/menu/reset-password.tsx +185 -0
- package/src/components/layout/menu/user-bar.tsx +97 -0
- package/src/components/layout/menu/userinfo-bar.tsx +70 -0
- package/src/components/layout/sidebar/index.css +26 -0
- package/src/components/layout/sidebar/index.tsx +38 -0
- package/src/components/login.js +137 -0
- package/src/components/module/criteria-page.tsx +175 -0
- package/src/components/module/dtmpl-page.tsx +70 -0
- package/src/components/module/ltmpl-page.tsx +181 -0
- package/src/components/routable/dtmpl-route.tsx +96 -0
- package/src/components/routable/import-route.tsx +28 -0
- package/src/components/routable/ltmpl-route.tsx +158 -0
- package/src/components/table/act-table.tsx +635 -0
- package/src/components/table/column/column-selector.tsx +79 -0
- package/src/components/table/column/index.css +14 -0
- package/src/components/table/index.css +45 -0
- package/src/components/table/l2-act-table.tsx +85 -0
- package/src/components/table/modal-select-table.tsx +248 -0
- package/src/components/table/pagination.css +15 -0
- package/src/components/table/pagination.tsx +72 -0
- package/src/components/table/query-table.tsx +331 -0
- package/src/components/table/relation-table.tsx +600 -0
- package/src/components/table/select-table.tsx +247 -0
- package/src/components/table/selected-rows-card.tsx +62 -0
- package/src/components/table/stat/restat.tsx +79 -0
- package/src/components/table/table-util.tsx +33 -0
- package/src/components/tmpl/control-type-supportor.tsx +97 -0
- package/src/components/tmpl/hc-data-source.tsx +230 -0
- package/src/components/tmpl/hcservice-v3.tsx +624 -0
- package/src/components/tmpl/interface.tsx +308 -0
- package/src/components/tmpl/superagent.js +93 -0
- package/src/components/tmpl/tmpl-config-analysis.tsx +111 -0
- package/src/components/units/EncryptUtils.js +38 -0
- package/src/components/units/image.d.ts +8 -0
- package/src/components/units/index.tsx +536 -0
- package/src/components/units/logo.png +0 -0
- package/src/components/units/storage.js +3 -0
- package/src/components/welcome/HCWelcome.js +232 -0
- package/src/components/welcome/index.css +13 -0
- package/src/components/welcome/logo.png +0 -0
- package/src/components/welcome/quick-entrance.tsx +77 -0
- package/src/components/welcome/workbench.tsx +76 -0
- package/src/index.js +4 -0
- package/src/style/common.css +79 -0
- package/src/style/coverstyle.css +49 -0
- package/src/style/transstyle.css +24 -0
- package/tsconfig.json +106 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {FieldConfig, ViewOrEdit} from "../tmpl/interface";
|
|
3
|
+
import {Alert, Input, Select, Spin, Checkbox,Radio} from "antd";
|
|
4
|
+
import Rfield from "./rfield";
|
|
5
|
+
import ControlTypeSupportor from "../tmpl/control-type-supportor";
|
|
6
|
+
import DatePicker from './date-picker';
|
|
7
|
+
import Steps from "./steps";
|
|
8
|
+
import InputNumber from "./input-number";
|
|
9
|
+
import InputRange from "./input-range";
|
|
10
|
+
import AutoComplete from "./auto-complete";
|
|
11
|
+
import loadable from "@loadable/component";
|
|
12
|
+
import HCDataSource from "../tmpl/hc-data-source";
|
|
13
|
+
import Upload from '../controls/upload';
|
|
14
|
+
import Progress from './progress'
|
|
15
|
+
|
|
16
|
+
import EntitySelect from "./entity-select/entity-select";
|
|
17
|
+
import PopoverEntitySelect from './entity-select/popover-entity-select'
|
|
18
|
+
import ColorPicker from './color-picker'
|
|
19
|
+
// import EntitySelect from "./entity-select/inner-entity-select";
|
|
20
|
+
// import ChemStruc from "./chemstruc/graph";
|
|
21
|
+
const CheckboxGroup=Checkbox.Group;
|
|
22
|
+
const RadioGroup=Radio.Group;
|
|
23
|
+
const Loading = <Spin tip="Loading...">
|
|
24
|
+
<Alert
|
|
25
|
+
message="正在加载数据。。。"
|
|
26
|
+
description="初次访问加载数据较多,可能需要几秒或几分钟,请耐心等待!!"
|
|
27
|
+
type="info"
|
|
28
|
+
/>
|
|
29
|
+
</Spin>;
|
|
30
|
+
const Signature = loadable(() =>
|
|
31
|
+
import("./signature"), {fallback: Loading});
|
|
32
|
+
const ChemStruc = loadable(() =>
|
|
33
|
+
import("./chemstruc/graph"), {fallback: Loading});
|
|
34
|
+
const HtmlEditor = loadable(() =>
|
|
35
|
+
import("./html-editor/draft"), {fallback: Loading});
|
|
36
|
+
|
|
37
|
+
const {TextArea} = Input;
|
|
38
|
+
|
|
39
|
+
interface EntryControlProps {
|
|
40
|
+
value?: any;
|
|
41
|
+
fieldConfig: FieldConfig;
|
|
42
|
+
onChange?: any;
|
|
43
|
+
id?:any;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getOptions(mstrucId) {
|
|
47
|
+
const options = [];
|
|
48
|
+
const items = HCDataSource.getEnums(mstrucId);
|
|
49
|
+
|
|
50
|
+
if (items) {
|
|
51
|
+
items.map((item) => {
|
|
52
|
+
options.push({label: (item.order ? item.order + "." : "") + item.title, value: item.value})
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
return options;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
function renderControl(id:any,fieldConfig: FieldConfig, fieldValue: any, onChange: any, width: any) {
|
|
60
|
+
|
|
61
|
+
let itemType = ControlTypeSupportor.getControlType(fieldConfig, fieldValue);
|
|
62
|
+
|
|
63
|
+
let entryControl = undefined;
|
|
64
|
+
|
|
65
|
+
let placeholder = !fieldConfig.disabled ? `请输入${fieldConfig.title}` : "无需输入";
|
|
66
|
+
let disabled: boolean = fieldConfig.disabled;
|
|
67
|
+
|
|
68
|
+
let viewOrEdit: ViewOrEdit = 'edit';
|
|
69
|
+
let controlProps = {
|
|
70
|
+
id, fieldConfig, itemType, viewOrEdit, onChange, disabled, value: fieldValue, style: {minWidth: 220, width: '100%'}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
let antdControlProps = {
|
|
74
|
+
id, placeholder, disabled, value: fieldValue, onChange, style: {minWidth: 220, width: '100%'}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const unSupportControl = <Input
|
|
78
|
+
type="text"
|
|
79
|
+
placeholder={`暂未实现-${itemType}`}
|
|
80
|
+
disabled={true}
|
|
81
|
+
/>;
|
|
82
|
+
|
|
83
|
+
switch (itemType) {
|
|
84
|
+
case 'int':
|
|
85
|
+
case 'decimal':
|
|
86
|
+
case 'float':
|
|
87
|
+
case 'double':
|
|
88
|
+
case 'intrange':
|
|
89
|
+
case 'decimalrange':
|
|
90
|
+
entryControl = <InputNumber
|
|
91
|
+
{...controlProps}
|
|
92
|
+
/>
|
|
93
|
+
break;
|
|
94
|
+
case "text":
|
|
95
|
+
entryControl = <Input allowClear={true}
|
|
96
|
+
type="text"
|
|
97
|
+
{...antdControlProps}
|
|
98
|
+
/>;
|
|
99
|
+
break;
|
|
100
|
+
case "range":
|
|
101
|
+
entryControl = <InputRange
|
|
102
|
+
// style={{width: scalableWidth}}
|
|
103
|
+
{...controlProps}
|
|
104
|
+
/>;
|
|
105
|
+
break;
|
|
106
|
+
case 'select':
|
|
107
|
+
entryControl = <Select
|
|
108
|
+
{...antdControlProps}
|
|
109
|
+
notFoundContent="暂无选项"
|
|
110
|
+
allowClear={true}
|
|
111
|
+
showSearch
|
|
112
|
+
optionLabelProp={'value'}
|
|
113
|
+
optionFilterProp={'label'}
|
|
114
|
+
options={getOptions(fieldConfig.mstrucId)}
|
|
115
|
+
>
|
|
116
|
+
</Select>
|
|
117
|
+
break;
|
|
118
|
+
case 'multiselect':
|
|
119
|
+
case 'texttags':
|
|
120
|
+
entryControl = <Select
|
|
121
|
+
mode="multiple"
|
|
122
|
+
{...antdControlProps}
|
|
123
|
+
value={typeof (fieldValue) == 'string' ? fieldValue.split(',') : fieldValue}
|
|
124
|
+
notFoundContent="暂无选项"
|
|
125
|
+
allowClear={true}
|
|
126
|
+
showSearch
|
|
127
|
+
optionLabelProp={'value'}
|
|
128
|
+
optionFilterProp={'label'}
|
|
129
|
+
// filterOption={(input, option) => {
|
|
130
|
+
// console.log('option', option);
|
|
131
|
+
// return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
132
|
+
// }
|
|
133
|
+
// }
|
|
134
|
+
showArrow={true}
|
|
135
|
+
options={getOptions(fieldConfig.mstrucId)}
|
|
136
|
+
>
|
|
137
|
+
</Select>
|
|
138
|
+
break;
|
|
139
|
+
case "checkbox":
|
|
140
|
+
entryControl = <CheckboxGroup {...antdControlProps} options={getOptions(fieldConfig.mstrucId)} value={typeof (fieldValue) == 'string' ? fieldValue.split(',') : fieldValue} />
|
|
141
|
+
break;
|
|
142
|
+
case "radio":
|
|
143
|
+
entryControl = <RadioGroup {...antdControlProps} options={getOptions(fieldConfig.mstrucId)} value={typeof (fieldValue) == 'string' ? fieldValue.split(',')[0] : fieldValue} />
|
|
144
|
+
break;
|
|
145
|
+
case 'date-YY':
|
|
146
|
+
case 'daterange-YY':
|
|
147
|
+
case 'date-M1':
|
|
148
|
+
case 'daterange-M1':
|
|
149
|
+
case 'date':
|
|
150
|
+
case 'daterange':
|
|
151
|
+
case 'datetime-HH':
|
|
152
|
+
case 'datetimerange-HH':
|
|
153
|
+
case 'datetime-mm':
|
|
154
|
+
case 'datetimerange-mm':
|
|
155
|
+
case 'datetime':
|
|
156
|
+
case 'datetimerange':
|
|
157
|
+
entryControl = <DatePicker {...controlProps}/>;
|
|
158
|
+
break;
|
|
159
|
+
case 'time-HH':
|
|
160
|
+
case 'timerange-HH':
|
|
161
|
+
case 'time-mm':
|
|
162
|
+
case 'timerange-mm':
|
|
163
|
+
case 'time':
|
|
164
|
+
case 'timerange':
|
|
165
|
+
entryControl = <DatePicker {...controlProps}/>;
|
|
166
|
+
break;
|
|
167
|
+
case 'textarea':
|
|
168
|
+
entryControl =
|
|
169
|
+
<TextArea rows={6} allowClear={true}
|
|
170
|
+
{...antdControlProps}
|
|
171
|
+
/>
|
|
172
|
+
break;
|
|
173
|
+
case 'html':
|
|
174
|
+
entryControl = <HtmlEditor viewOrEdit={'edit'} {...controlProps}></HtmlEditor>;
|
|
175
|
+
break;
|
|
176
|
+
case 'steps':
|
|
177
|
+
entryControl = <Steps {...controlProps}/>
|
|
178
|
+
break;
|
|
179
|
+
case 'password':
|
|
180
|
+
entryControl = unSupportControl;
|
|
181
|
+
break;
|
|
182
|
+
case 'preselect':
|
|
183
|
+
entryControl = <AutoComplete {...controlProps} />
|
|
184
|
+
break;
|
|
185
|
+
case 'caselect':
|
|
186
|
+
entryControl = unSupportControl;
|
|
187
|
+
break;
|
|
188
|
+
case 'relation':
|
|
189
|
+
entryControl = unSupportControl;
|
|
190
|
+
break;
|
|
191
|
+
case 'file':
|
|
192
|
+
case 'video':
|
|
193
|
+
case 'picture':
|
|
194
|
+
entryControl = <Upload {...controlProps} />
|
|
195
|
+
break;
|
|
196
|
+
case 'chemstruc':
|
|
197
|
+
entryControl = <ChemStruc viewOrEdit={'edit'} {...controlProps}></ChemStruc>
|
|
198
|
+
//entryControl =unSupportControl
|
|
199
|
+
break;
|
|
200
|
+
case 'relselect':
|
|
201
|
+
case 'refselect':
|
|
202
|
+
case 'entity-select':
|
|
203
|
+
entryControl=<EntitySelect maxSelected={fieldConfig.max?fieldConfig.max:undefined} {...controlProps} />
|
|
204
|
+
// entryControl = <EntitySelect {...controlProps} sourceName={'rcriteria'}></EntitySelect>
|
|
205
|
+
break;
|
|
206
|
+
case 'table-entity-select':
|
|
207
|
+
entryControl=<PopoverEntitySelect maxSelected={fieldConfig.max?fieldConfig.max:undefined} {...controlProps} />
|
|
208
|
+
// entryControl = <EntitySelect {...controlProps} sourceName={'rcriteria'}></EntitySelect>
|
|
209
|
+
break;
|
|
210
|
+
case 'progress':
|
|
211
|
+
entryControl = <Progress {...controlProps}></Progress>
|
|
212
|
+
break;
|
|
213
|
+
case 'signature':
|
|
214
|
+
entryControl = <Signature {...controlProps}></Signature>
|
|
215
|
+
break;
|
|
216
|
+
case 'color':
|
|
217
|
+
entryControl = <ColorPicker {...controlProps}></ColorPicker>
|
|
218
|
+
break;
|
|
219
|
+
case 'hidden'://
|
|
220
|
+
entryControl = <Input
|
|
221
|
+
type="hidden"
|
|
222
|
+
value={fieldValue}
|
|
223
|
+
disabled={true}
|
|
224
|
+
/>;
|
|
225
|
+
break;
|
|
226
|
+
default:
|
|
227
|
+
entryControl = unSupportControl
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return entryControl;
|
|
232
|
+
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const EntryControl: React.FC<EntryControlProps> = (props) => {
|
|
236
|
+
const {fieldConfig, value, onChange,id} = props;
|
|
237
|
+
return renderControl(id,fieldConfig, value, onChange, null);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export default EntryControl;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {Badge} from "antd";
|
|
3
|
+
import {VControlProps} from "../../tmpl/interface";
|
|
4
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
5
|
+
|
|
6
|
+
interface MenuBadgeProps extends VControlProps {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const MenuBadge: React.FC<MenuBadgeProps> = (props) => {
|
|
13
|
+
|
|
14
|
+
const {value, itemType, fieldConfig} = props;
|
|
15
|
+
|
|
16
|
+
let viewControl = undefined;
|
|
17
|
+
|
|
18
|
+
let color = HCDataSource.getEnumValueColor(fieldConfig.mstrucId, value);
|
|
19
|
+
viewControl = <span className="infoStyle">
|
|
20
|
+
{value ?
|
|
21
|
+
<Badge color={color ? color : 'green'} text={value}/>
|
|
22
|
+
: null}
|
|
23
|
+
</span>
|
|
24
|
+
|
|
25
|
+
return viewControl;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default MenuBadge;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Tag} from "antd";
|
|
3
|
+
import {VControlProps} from "../../tmpl/interface";
|
|
4
|
+
import HCDataSource from "../../tmpl/hc-data-source";
|
|
5
|
+
|
|
6
|
+
interface EnumTagsProps extends VControlProps {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const EnumTags: React.FC<EnumTagsProps> = (props) => {
|
|
13
|
+
|
|
14
|
+
const {value, itemType, fieldConfig} = props;
|
|
15
|
+
let viewControl = undefined;
|
|
16
|
+
let tagList = [];
|
|
17
|
+
if (value) {
|
|
18
|
+
value.split(',').forEach(v => {
|
|
19
|
+
let color = HCDataSource.getEnumValueColor(fieldConfig.mstrucId, value);
|
|
20
|
+
tagList.push(<Tag key={v} color={color ? color : 'blue'}>{v}</Tag>)
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
viewControl = <span className="infoStyle">
|
|
24
|
+
{tagList}
|
|
25
|
+
</span>
|
|
26
|
+
|
|
27
|
+
return viewControl;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default EnumTags;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import {Button, Drawer,Space} from 'antd'
|
|
3
|
+
import {ReadOutlined,DownloadOutlined,CloseOutlined} from '@ant-design/icons'
|
|
4
|
+
import FileViewer from 'react-file-viewer';
|
|
5
|
+
// import { CustomErrorComponent } from 'custom-error';
|
|
6
|
+
// import './index.css'
|
|
7
|
+
import {FileValue} from "../../tmpl/interface";
|
|
8
|
+
import HCService from "../../tmpl/hcservice-v3";
|
|
9
|
+
|
|
10
|
+
interface DrawerFileViewProps {
|
|
11
|
+
file: FileValue,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
interface DrawerFileViewState {
|
|
15
|
+
drawerVisible: boolean,
|
|
16
|
+
|
|
17
|
+
};
|
|
18
|
+
export default class DrawerFileView extends React.PureComponent<DrawerFileViewProps, DrawerFileViewState> {
|
|
19
|
+
|
|
20
|
+
state = {
|
|
21
|
+
drawerVisible: false
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
onError(e) {
|
|
25
|
+
console.log(e, 'error in file-viewer');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
onClose = () => {
|
|
29
|
+
this.setState({drawerVisible: false})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
render() {
|
|
33
|
+
const {file} = this.props;
|
|
34
|
+
const {drawerVisible} = this.state;
|
|
35
|
+
return <span className='labelcss'>
|
|
36
|
+
<Button type={'link'} onClick={() => {
|
|
37
|
+
this.setState({drawerVisible: true})
|
|
38
|
+
}} size="small">{file.base.fileName}</Button>
|
|
39
|
+
<Button type={'text'} onClick={async () => {
|
|
40
|
+
await HCService.download(file.base.path);
|
|
41
|
+
}} size="small"><DownloadOutlined/></Button>
|
|
42
|
+
{drawerVisible ? <Drawer
|
|
43
|
+
title={file.base.fileName}
|
|
44
|
+
placement={'left'}
|
|
45
|
+
closable={false}
|
|
46
|
+
onClose={this.onClose}
|
|
47
|
+
width={'1200px'}
|
|
48
|
+
visible={drawerVisible}
|
|
49
|
+
extra={
|
|
50
|
+
<Space>
|
|
51
|
+
<Button onClick={async () => {
|
|
52
|
+
await HCService.download(file.base.path);
|
|
53
|
+
}} ><DownloadOutlined/></Button>
|
|
54
|
+
<Button onClick={this.onClose}><CloseOutlined /></Button>
|
|
55
|
+
</Space>
|
|
56
|
+
}>
|
|
57
|
+
<FileViewer
|
|
58
|
+
style={{width: '100%'}}
|
|
59
|
+
fileType={file.base.type}
|
|
60
|
+
filePath={HCService.getFileUrl(file.base.path)}
|
|
61
|
+
errorComponent={undefined}
|
|
62
|
+
onError={this.onError}/>
|
|
63
|
+
</Drawer> : null
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
</span>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import {Button, Col, Image, Row,Space} from 'antd'
|
|
3
|
+
import {ReadOutlined} from '@ant-design/icons'
|
|
4
|
+
import FileViewer from 'react-file-viewer';
|
|
5
|
+
import DrawerFileView from './drawer-file-view'
|
|
6
|
+
// import { CustomErrorComponent } from 'custom-error';
|
|
7
|
+
// import './index.css'
|
|
8
|
+
import {FieldConfig} from "../../tmpl/interface";
|
|
9
|
+
import {DownloadOutlined} from '@ant-design/icons';
|
|
10
|
+
import HCService from "../../tmpl/hcservice-v3";
|
|
11
|
+
import Player from "griffith";
|
|
12
|
+
|
|
13
|
+
interface FileViewProps {
|
|
14
|
+
fieldConfig: FieldConfig,
|
|
15
|
+
value: any,
|
|
16
|
+
width?: number,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
interface FileViewState {
|
|
20
|
+
urlData:string
|
|
21
|
+
|
|
22
|
+
};
|
|
23
|
+
export default class FileView extends React.PureComponent<FileViewProps, FileViewState> {
|
|
24
|
+
|
|
25
|
+
state={
|
|
26
|
+
urlData:undefined,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
loadData= async ()=>{
|
|
30
|
+
const {value}=this.props;
|
|
31
|
+
let jsonFile=this.getJsonValue(value);
|
|
32
|
+
if(jsonFile){
|
|
33
|
+
if(/^image\/\w+;base64/.test(jsonFile.base.type)){
|
|
34
|
+
this.setState({
|
|
35
|
+
urlData :await HCService.loadFileTxt(jsonFile.base.path)
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
componentDidMount() {
|
|
42
|
+
this.loadData();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
46
|
+
const {value}=this.props;
|
|
47
|
+
const {value:preValue}=this.props;
|
|
48
|
+
if(value!=preValue){
|
|
49
|
+
this.loadData();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
getJsonValue=(file)=>{
|
|
54
|
+
let jsonFile;
|
|
55
|
+
if (!file) {
|
|
56
|
+
return undefined;
|
|
57
|
+
} else if (typeof (file) == 'string') {
|
|
58
|
+
jsonFile = JSON.parse(file);
|
|
59
|
+
}
|
|
60
|
+
return jsonFile;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
packFile2Show = (file) => {
|
|
64
|
+
const {urlData}=this.state;
|
|
65
|
+
let jsonFile=this.getJsonValue(file);
|
|
66
|
+
if (jsonFile) {
|
|
67
|
+
if ("new" == jsonFile.valid) {
|
|
68
|
+
return jsonFile.fileName
|
|
69
|
+
} else if ("delete" == jsonFile.valid) {
|
|
70
|
+
return undefined;
|
|
71
|
+
} else if (['png', 'jpg', 'jpeg', 'gif', 'PNG', 'JPG', 'JPEG', 'GIF', 'svg', 'SVG'].includes(jsonFile.base.type)) {
|
|
72
|
+
return <Image
|
|
73
|
+
width={90}
|
|
74
|
+
src={jsonFile.icon.type ? HCService.getFileUrl(jsonFile.icon.path) : HCService.getFileUrl(jsonFile.base.path)}
|
|
75
|
+
preview={{
|
|
76
|
+
src: HCService.getFileUrl(jsonFile.base.path),
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
} else if (urlData) {
|
|
80
|
+
// let urlValue = await HCService.loadFileTxt(jsonFile.base.path)
|
|
81
|
+
return <Image
|
|
82
|
+
width={90}
|
|
83
|
+
src={urlData}
|
|
84
|
+
preview={{
|
|
85
|
+
src: urlData,
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
} else if (['mp4', 'MP4', 'mov', 'MOV', 'avi', 'AVI', 'WMV', 'wmv'].includes(jsonFile.base.type)) {
|
|
89
|
+
let sources = {
|
|
90
|
+
ld: {
|
|
91
|
+
play_url: HCService.getFileUrl(jsonFile.base.path),
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return (<Row align={'middle'}>
|
|
95
|
+
<Col style={{height: '60px', width: '300px'}}>
|
|
96
|
+
<Player locale={'zh-Hans'} sources={sources} id={jsonFile.base.fileName}/>
|
|
97
|
+
</Col>
|
|
98
|
+
</Row>)
|
|
99
|
+
}else if ([ 'xlsx', 'docx','csv','webm','bmp'].includes(jsonFile.base.type)){
|
|
100
|
+
// return <span className='labelcss'>
|
|
101
|
+
// <Button onClick={async () => {
|
|
102
|
+
// await HCService.openfile(jsonFile.base.path);
|
|
103
|
+
// }} size="small"><ReadOutlined />{jsonFile.base.fileName}</Button>
|
|
104
|
+
//
|
|
105
|
+
// <FileViewer
|
|
106
|
+
// fileType={jsonFile.base.type}
|
|
107
|
+
// filePath={HCService.getFileUrl(jsonFile.base.path)}
|
|
108
|
+
// errorComponent={undefined}
|
|
109
|
+
// onError={this.onError}/>
|
|
110
|
+
// </span>
|
|
111
|
+
return <DrawerFileView file={jsonFile} ></DrawerFileView>
|
|
112
|
+
}
|
|
113
|
+
else if ([ 'pdf','txt'].includes(jsonFile.base.type)){
|
|
114
|
+
return <span className='labelcss'>
|
|
115
|
+
{/*<a href={this.getFileUrl(file.base.path)}>{file.base.fileName}</a>*/}
|
|
116
|
+
<Button type={'link'} onClick={async () => {
|
|
117
|
+
await HCService.openfile(jsonFile.base.path);
|
|
118
|
+
}} size="small">{jsonFile.base.fileName}</Button>
|
|
119
|
+
<Button type={'text'} onClick={async () => {
|
|
120
|
+
await HCService.download(jsonFile.base.path);
|
|
121
|
+
}} size="small"><DownloadOutlined/></Button>
|
|
122
|
+
</span>
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
return <Space className='labelcss'>
|
|
126
|
+
{/*<a href={this.getFileUrl(file.base.path)}>{file.base.fileName}</a>*/}
|
|
127
|
+
<Button type={'link'} onClick={async () => {
|
|
128
|
+
await HCService.download(jsonFile.base.path);
|
|
129
|
+
}} size="small">{jsonFile.base.fileName}</Button>
|
|
130
|
+
<Button type={'text'} onClick={async () => {
|
|
131
|
+
await HCService.download(jsonFile.base.path);
|
|
132
|
+
}} size="small"><DownloadOutlined/></Button>
|
|
133
|
+
</Space>
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
render() {
|
|
142
|
+
return <>{this.packFile2Show(this.props.value)}</>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import {Card} from "antd";
|
|
4
|
+
import {VEControlProps} from "../../tmpl/interface";
|
|
5
|
+
// 核心
|
|
6
|
+
import { EditorState, convertToRaw,convertFromRaw, ContentState } from 'draft-js'
|
|
7
|
+
import { Editor } from 'react-draft-wysiwyg'
|
|
8
|
+
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css'
|
|
9
|
+
// draft 转换为 html
|
|
10
|
+
import draftToHtml from 'draftjs-to-html'
|
|
11
|
+
// html 转换为 draft
|
|
12
|
+
import htmlToDraft from 'html-to-draftjs'
|
|
13
|
+
|
|
14
|
+
interface DraftProps extends VEControlProps {
|
|
15
|
+
getHtml?:any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface DraftState {
|
|
19
|
+
editorState:boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default class Draft extends React.PureComponent<DraftProps, DraftState>{
|
|
23
|
+
|
|
24
|
+
state={
|
|
25
|
+
editorState:EditorState.createEmpty(),
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
componentDidMount() {
|
|
29
|
+
// 如果从后台读取接口存储的有值,读取过来转换为富文本格式默认显示
|
|
30
|
+
if (this.props.value) {
|
|
31
|
+
this.toDraft(this.props.value)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
onEditorStateChange = (editorState) => {
|
|
36
|
+
//this.toHtml(editorState)
|
|
37
|
+
|
|
38
|
+
this.setState({
|
|
39
|
+
editorState
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
editorChange = value => {
|
|
44
|
+
console.log('html:',draftToHtml(value))
|
|
45
|
+
if (this.props.onChange) {
|
|
46
|
+
this.props.onChange(draftToHtml(value));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// // 转换为 html
|
|
51
|
+
// toHtml = value => {
|
|
52
|
+
// let templateContent = draftToHtml(convertToRaw(value.getCurrentContent()))
|
|
53
|
+
//
|
|
54
|
+
// if (this.props.getHtml) {
|
|
55
|
+
// // 输出已经编辑好的html
|
|
56
|
+
// this.props.getHtml(templateContent)
|
|
57
|
+
// }
|
|
58
|
+
//
|
|
59
|
+
// }
|
|
60
|
+
|
|
61
|
+
// 转换为 Draft
|
|
62
|
+
|
|
63
|
+
toDraft = value => {
|
|
64
|
+
const blocksFromHtml = htmlToDraft(value);
|
|
65
|
+
const { contentBlocks, entityMap } = blocksFromHtml;
|
|
66
|
+
const contentState = ContentState.createFromBlockArray(contentBlocks, entityMap);
|
|
67
|
+
const editorState = EditorState.createWithContent(contentState);
|
|
68
|
+
console.log("editorState:",editorState)
|
|
69
|
+
this.setState({
|
|
70
|
+
editorState
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// imgFileupOnChange = (files) => {
|
|
75
|
+
// // 返回值 files 就是上传的文件,控件会默认 Promise 返回,否则无法抓到返回的已上传图片链接
|
|
76
|
+
// return new Promise(
|
|
77
|
+
// (resolve, rejects) => {
|
|
78
|
+
// // 使用 form 表单的形式进行配置,具体参数根据接口来
|
|
79
|
+
// let formData = new FormData()
|
|
80
|
+
//
|
|
81
|
+
// formData.append('File', files)
|
|
82
|
+
// formData.append('FileType', 'Thumbnail')
|
|
83
|
+
// formData.append('IsLogin', true)
|
|
84
|
+
// formData.append('Description', '')
|
|
85
|
+
//
|
|
86
|
+
// new Ajax({
|
|
87
|
+
// // 这里是配置自己的图片上传链接
|
|
88
|
+
// url: `/api/file/upload`,
|
|
89
|
+
// method: 'post',
|
|
90
|
+
// headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
91
|
+
// data: formData
|
|
92
|
+
//
|
|
93
|
+
// })
|
|
94
|
+
// .start()
|
|
95
|
+
// .then(res => (res = res.data))
|
|
96
|
+
// .then(res => {
|
|
97
|
+
// if (res.Status === 0) {
|
|
98
|
+
//
|
|
99
|
+
// // Message.success('上传成功!')
|
|
100
|
+
// resolve({ data: { link: res.Result } })
|
|
101
|
+
// } else {
|
|
102
|
+
// // Message.fail('上传失败!')
|
|
103
|
+
//
|
|
104
|
+
// }
|
|
105
|
+
// })
|
|
106
|
+
// }
|
|
107
|
+
// )
|
|
108
|
+
//
|
|
109
|
+
//
|
|
110
|
+
// }
|
|
111
|
+
|
|
112
|
+
changeValue = (value) => {
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
render(){
|
|
118
|
+
const {viewOrEdit,disabled} = this.props;
|
|
119
|
+
|
|
120
|
+
const {editorState}=this.state;
|
|
121
|
+
let entryControl = undefined;
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
const setToolbar = {
|
|
126
|
+
options: ['inline', 'blockType', 'fontSize', 'fontFamily', 'list', 'textAlign', 'colorPicker', 'remove', 'history'],
|
|
127
|
+
colorPicker: {
|
|
128
|
+
// 图标可以自定义,如果使用默认就注释掉
|
|
129
|
+
// icon: 'https://-------',
|
|
130
|
+
className: undefined,
|
|
131
|
+
component: undefined,
|
|
132
|
+
popupClassName: undefined,
|
|
133
|
+
// 图片选项卡自定义
|
|
134
|
+
colors: ['rgb(97,189,109)', 'rgb(26,188,156)', 'rgb(84,172,210)', 'rgb(44,130,201)',
|
|
135
|
+
'rgb(147,101,184)', 'rgb(71,85,119)', 'rgb(204,204,204)', 'rgb(65,168,95)', 'rgb(0,168,133)',
|
|
136
|
+
'rgb(61,142,185)', 'rgb(41,105,176)', 'rgb(85,57,130)', 'rgb(40,50,78)', 'rgb(0,0,0)',
|
|
137
|
+
'rgb(247,218,100)', 'rgb(251,160,38)', 'rgb(235,107,86)', 'rgb(226,80,65)', 'rgb(163,143,132)',
|
|
138
|
+
'rgb(239,239,239)', 'rgb(255,255,255)', 'rgb(250,197,28)', 'rgb(243,121,52)', 'rgb(209,72,65)',
|
|
139
|
+
'rgb(184,49,47)', 'rgb(124,112,107)', 'rgb(209,213,216)', 'rgb(0,0,0)'],
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
entryControl= <Card style={{width:'100%'}} bodyStyle={{padding:'2px',minHeight:'280px'}}>
|
|
144
|
+
<Editor
|
|
145
|
+
readOnly={disabled}
|
|
146
|
+
toolbarHidden={viewOrEdit=='view'? true: false}
|
|
147
|
+
editorState={editorState}
|
|
148
|
+
wrapperClassName="contract-template-add-wrapper"
|
|
149
|
+
editorClassName="contract-template-editor"
|
|
150
|
+
onEditorStateChange={this.onEditorStateChange}
|
|
151
|
+
onChange={this.editorChange}
|
|
152
|
+
toolbar={setToolbar}
|
|
153
|
+
/>
|
|
154
|
+
</Card>
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
return entryControl;
|
|
159
|
+
|
|
160
|
+
}
|
|
161
|
+
}
|