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.
Files changed (156) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +1 -0
  3. package/dist/163.js +2 -0
  4. package/dist/163.js.LICENSE.txt +43 -0
  5. package/dist/41.js +1 -0
  6. package/dist/aldehyde.js +2 -0
  7. package/dist/aldehyde.js.LICENSE.txt +122 -0
  8. package/dist/chemstruc-graph.js +1 -0
  9. package/dist/css/163-24392163d3c7b54ea806.css +11 -0
  10. package/dist/css/290-5e8e152675ab7d201c00.css +886 -0
  11. package/dist/css/chemstruc-graph-87868f791bf92fb80db9.css +29 -0
  12. package/dist/css/main-2e6725ec1b56da516cee.css +256 -0
  13. package/dist/html-editor-draft.js +2 -0
  14. package/dist/html-editor-draft.js.LICENSE.txt +5 -0
  15. package/dist/images/logo-06f6a5d8.png +0 -0
  16. package/dist/index.html +4 -0
  17. package/dist/signature.js +2 -0
  18. package/dist/signature.js.LICENSE.txt +17 -0
  19. package/package.json +180 -0
  20. package/src/components/chart/antd/Chart.js +32 -0
  21. package/src/components/chart/antd/Chart10000.js +90 -0
  22. package/src/components/chart/antd/Max2DimLineChart.js +128 -0
  23. package/src/components/chart/antd/PieChart1.js +54 -0
  24. package/src/components/chart/antd/PieChart2.js +56 -0
  25. package/src/components/chart/antd/chart-utils.tsx +50 -0
  26. package/src/components/chart/antd/column-chart-sub.tsx +67 -0
  27. package/src/components/chart/antd/line-chart-sub.tsx +65 -0
  28. package/src/components/chart/antd/pie-chart-sub.tsx +54 -0
  29. package/src/components/chart/antd/statview-d2-chart.tsx +125 -0
  30. package/src/components/chart/statview-l2-chart.tsx +69 -0
  31. package/src/components/controls/action/index.css +9 -0
  32. package/src/components/controls/action/index.tsx +228 -0
  33. package/src/components/controls/action/utils.tsx +122 -0
  34. package/src/components/controls/auto-complete/index.tsx +80 -0
  35. package/src/components/controls/cascader/index.js +97 -0
  36. package/src/components/controls/chemstruc/graph.tsx +150 -0
  37. package/src/components/controls/chemstruc/index.css +28 -0
  38. package/src/components/controls/collapse-card/index.css +9 -0
  39. package/src/components/controls/collapse-card/index.tsx +59 -0
  40. package/src/components/controls/color-picker/index.css +27 -0
  41. package/src/components/controls/color-picker/index.tsx +88 -0
  42. package/src/components/controls/cquery/cquick-button.tsx +117 -0
  43. package/src/components/controls/date-picker/index.tsx +141 -0
  44. package/src/components/controls/entity-select/entity-select.tsx +277 -0
  45. package/src/components/controls/entity-select/index.css +6 -0
  46. package/src/components/controls/entity-select/popover-entity-select.tsx +112 -0
  47. package/src/components/controls/entry-control.tsx +240 -0
  48. package/src/components/controls/enum-badge/index.tsx +28 -0
  49. package/src/components/controls/enum-tag/index.tsx +30 -0
  50. package/src/components/controls/file-view/drawer-file-view.tsx +69 -0
  51. package/src/components/controls/file-view/index.tsx +145 -0
  52. package/src/components/controls/html-editor/draft.tsx +161 -0
  53. package/src/components/controls/html-editor/tinymce.js +55 -0
  54. package/src/components/controls/input-number/index.tsx +101 -0
  55. package/src/components/controls/input-range/index.tsx +48 -0
  56. package/src/components/controls/password-setter/index.css +3 -0
  57. package/src/components/controls/password-setter/index.js +70 -0
  58. package/src/components/controls/progress/index.tsx +61 -0
  59. package/src/components/controls/relation-existion/index.css +4 -0
  60. package/src/components/controls/relation-existion/index.tsx +108 -0
  61. package/src/components/controls/rfield/index.css +4 -0
  62. package/src/components/controls/rfield/index.tsx +161 -0
  63. package/src/components/controls/signature/index.tsx +162 -0
  64. package/src/components/controls/steps/index.tsx +58 -0
  65. package/src/components/controls/text/ellipsis-text.tsx +70 -0
  66. package/src/components/controls/upload/index.tsx +122 -0
  67. package/src/components/controls/view-control.tsx +177 -0
  68. package/src/components/detail/button/cquery-button-bar.tsx +112 -0
  69. package/src/components/detail/button/index.css +43 -0
  70. package/src/components/detail/button/submit-button-bar.tsx +151 -0
  71. package/src/components/detail/dtmpl.css +53 -0
  72. package/src/components/detail/edit/dtmpl-edit.tsx +218 -0
  73. package/src/components/detail/edit/fields-edit-card.tsx +103 -0
  74. package/src/components/detail/edit/modal-dtmpl-edit.tsx +198 -0
  75. package/src/components/detail/edit/modal-row-edit.tsx +72 -0
  76. package/src/components/detail/edit/post-result/index.tsx +52 -0
  77. package/src/components/detail/edit/row-edit-card.tsx +125 -0
  78. package/src/components/detail/edit/row-editor.tsx +71 -0
  79. package/src/components/detail/rightbar/index.css +35 -0
  80. package/src/components/detail/rightbar/index.tsx +76 -0
  81. package/src/components/detail/view/act-dtmpl-view.tsx +155 -0
  82. package/src/components/detail/view/dtmpl-view.tsx +143 -0
  83. package/src/components/detail/view/field-view-group.tsx +73 -0
  84. package/src/components/detail/view/modal-dtmpl-view.tsx +56 -0
  85. package/src/components/detail/view/snapshot-timeline.tsx +130 -0
  86. package/src/components/exportor/export-frame.css +3 -0
  87. package/src/components/exportor/export-frame.tsx +194 -0
  88. package/src/components/exportor/index.tsx +60 -0
  89. package/src/components/form/criteria-form.tsx +241 -0
  90. package/src/components/form/dtmpl-form.css +4 -0
  91. package/src/components/form/dtmpl-form.tsx +272 -0
  92. package/src/components/form/field-group-form.tsx +75 -0
  93. package/src/components/form/fields-form.tsx +51 -0
  94. package/src/components/form/form-Item-group.tsx +99 -0
  95. package/src/components/form/index.css +13 -0
  96. package/src/components/import/excel-import.tsx +316 -0
  97. package/src/components/import/index.css +54 -0
  98. package/src/components/import/template-builder.js +474 -0
  99. package/src/components/import/template.css +51 -0
  100. package/src/components/layout/MainPage.tsx +230 -0
  101. package/src/components/layout/footer/index.css +6 -0
  102. package/src/components/layout/footer/index.js +17 -0
  103. package/src/components/layout/header/index.css +86 -0
  104. package/src/components/layout/header/index.tsx +58 -0
  105. package/src/components/layout/menu/block.tsx +88 -0
  106. package/src/components/layout/menu/l2menu-message-bar.tsx +118 -0
  107. package/src/components/layout/menu/l2menu-quick-bar.tsx +132 -0
  108. package/src/components/layout/menu/menu-2layers.tsx +92 -0
  109. package/src/components/layout/menu/menu-render.tsx +49 -0
  110. package/src/components/layout/menu/reset-password.tsx +185 -0
  111. package/src/components/layout/menu/user-bar.tsx +97 -0
  112. package/src/components/layout/menu/userinfo-bar.tsx +70 -0
  113. package/src/components/layout/sidebar/index.css +26 -0
  114. package/src/components/layout/sidebar/index.tsx +38 -0
  115. package/src/components/login.js +137 -0
  116. package/src/components/module/criteria-page.tsx +175 -0
  117. package/src/components/module/dtmpl-page.tsx +70 -0
  118. package/src/components/module/ltmpl-page.tsx +181 -0
  119. package/src/components/routable/dtmpl-route.tsx +96 -0
  120. package/src/components/routable/import-route.tsx +28 -0
  121. package/src/components/routable/ltmpl-route.tsx +158 -0
  122. package/src/components/table/act-table.tsx +635 -0
  123. package/src/components/table/column/column-selector.tsx +79 -0
  124. package/src/components/table/column/index.css +14 -0
  125. package/src/components/table/index.css +45 -0
  126. package/src/components/table/l2-act-table.tsx +85 -0
  127. package/src/components/table/modal-select-table.tsx +248 -0
  128. package/src/components/table/pagination.css +15 -0
  129. package/src/components/table/pagination.tsx +72 -0
  130. package/src/components/table/query-table.tsx +331 -0
  131. package/src/components/table/relation-table.tsx +600 -0
  132. package/src/components/table/select-table.tsx +247 -0
  133. package/src/components/table/selected-rows-card.tsx +62 -0
  134. package/src/components/table/stat/restat.tsx +79 -0
  135. package/src/components/table/table-util.tsx +33 -0
  136. package/src/components/tmpl/control-type-supportor.tsx +97 -0
  137. package/src/components/tmpl/hc-data-source.tsx +230 -0
  138. package/src/components/tmpl/hcservice-v3.tsx +624 -0
  139. package/src/components/tmpl/interface.tsx +308 -0
  140. package/src/components/tmpl/superagent.js +93 -0
  141. package/src/components/tmpl/tmpl-config-analysis.tsx +111 -0
  142. package/src/components/units/EncryptUtils.js +38 -0
  143. package/src/components/units/image.d.ts +8 -0
  144. package/src/components/units/index.tsx +536 -0
  145. package/src/components/units/logo.png +0 -0
  146. package/src/components/units/storage.js +3 -0
  147. package/src/components/welcome/HCWelcome.js +232 -0
  148. package/src/components/welcome/index.css +13 -0
  149. package/src/components/welcome/logo.png +0 -0
  150. package/src/components/welcome/quick-entrance.tsx +77 -0
  151. package/src/components/welcome/workbench.tsx +76 -0
  152. package/src/index.js +4 -0
  153. package/src/style/common.css +79 -0
  154. package/src/style/coverstyle.css +49 -0
  155. package/src/style/transstyle.css +24 -0
  156. package/tsconfig.json +106 -0
@@ -0,0 +1,122 @@
1
+ import {ActionConfig, Comparator, DtmplData} from "../../tmpl/interface";
2
+ import {RefObject} from "react";
3
+ import {FormInstance} from "antd/lib/form/hooks/useForm";
4
+
5
+
6
+ export default class ActionUtils {
7
+
8
+ static isShow(actionConfig:ActionConfig, data:DtmplData[] |object[], formRef:RefObject<FormInstance>){
9
+
10
+ //所有data都必须满足条件才能显示
11
+ //let comparator=actionConfig.comparator;
12
+ let preFieldConfigs = actionConfig.preposes;
13
+ if (!preFieldConfigs || preFieldConfigs.length <= 0) {
14
+ return true;
15
+ }
16
+
17
+ let isShow = true;
18
+ if (formRef && formRef.current) {
19
+ for (let fieldConfig of preFieldConfigs) {
20
+ if (!fieldConfig) {
21
+ continue;
22
+ }
23
+ let value = this.getFormRefValue(formRef, fieldConfig.id);
24
+ // if (value) {
25
+ if (!this.comparator(fieldConfig.comparator, value, fieldConfig.defaultValue)) {
26
+ isShow = false;
27
+ break;
28
+ }
29
+ //} else if (data) {
30
+ // if (!isShow) {
31
+ // // break;
32
+ // // }
33
+ // // for (let d1 of data) {
34
+ // // if (d1 && d1['fieldMap']) {
35
+ // // if (!this.comparator(fieldConfig.comparator, d1['fieldMap'][fieldConfig.id], fieldConfig.defaultValue)) {
36
+ // // isShow = false;
37
+ // // break;
38
+ // // }
39
+ // // } else if (!this.comparator(fieldConfig.comparator, d1[fieldConfig.id], fieldConfig.defaultValue)){
40
+ // // isShow = false;
41
+ // // break;
42
+ // // }else{
43
+ // // isShow = false;
44
+ // // break;
45
+ // // }
46
+ // // }
47
+ // // }
48
+ }
49
+ } else if (data) {
50
+ for (let d of data) {
51
+ if (!isShow) {
52
+ break;
53
+ }
54
+ if (!d ) {
55
+ isShow = false;
56
+ break;
57
+ }
58
+
59
+ for (let fieldConfig of preFieldConfigs) {
60
+ if(d['fieldMap']){
61
+ if (!this.comparator(fieldConfig.comparator, d['fieldMap'][fieldConfig.id], fieldConfig.defaultValue)) {
62
+ isShow = false;
63
+ break;
64
+ }
65
+ }else{
66
+ if (!this.comparator(fieldConfig.comparator, d[fieldConfig.id], fieldConfig.defaultValue)) {
67
+ isShow = false;
68
+ break;
69
+ }
70
+ }
71
+
72
+ }
73
+ }
74
+ } else {
75
+ isShow = false;
76
+ }
77
+ return isShow;
78
+ }
79
+ static comparator(comparator: Comparator, value: string, defaultValue: string){
80
+ let dvs: string[];
81
+
82
+ if(!comparator ){
83
+ comparator='equal';
84
+ }
85
+
86
+ if ( !defaultValue) {
87
+ return true;
88
+ }
89
+
90
+ if(!value){
91
+ return false;
92
+ }
93
+
94
+ switch (comparator) {
95
+ case "equal":
96
+ return value == defaultValue;
97
+ case "exclude":
98
+ (typeof (defaultValue) == 'string') ? dvs = defaultValue.split(',') : dvs = defaultValue;
99
+ return !dvs.includes(value);
100
+ case "includeOne":
101
+ (typeof (defaultValue) == 'string') ? dvs = defaultValue.split(',') : dvs = defaultValue;
102
+ return dvs.includes(value);
103
+ case "noGreater":
104
+ return value <= defaultValue;
105
+ case "noLess":
106
+ return value >= defaultValue;
107
+ case "unequal":
108
+ return value != defaultValue;
109
+ }
110
+ }
111
+
112
+ static getFormRefValue(formRef, key){
113
+
114
+ if (formRef && formRef.current) {
115
+ console.log("formRef.current.getFieldsValue",formRef.current.getFieldValue(key));
116
+ return formRef.current.getFieldValue(key) ;
117
+ } else {
118
+ return false;
119
+ }
120
+ }
121
+
122
+ }
@@ -0,0 +1,80 @@
1
+ import React from 'react'
2
+ import {AutoComplete as AntdAutoComplete, Input} from "antd";
3
+ import {EControlProps} from "../../tmpl/interface";
4
+ import Units from "../../units";
5
+ import HCDataSource from "../../tmpl/hc-data-source";
6
+
7
+ const {TextArea} = Input;
8
+
9
+ interface AutoCompleteProps extends EControlProps {
10
+
11
+ }
12
+
13
+ const AutoComplete: React.FC<AutoCompleteProps> = (props) => {
14
+
15
+ const {id,value, itemType, fieldConfig, onChange} = props;
16
+
17
+ let entryControl = undefined;
18
+
19
+ const changeValue = (value1) => {
20
+ if (onChange) {
21
+ let newvalue=undefined;
22
+ if (value1 === undefined) {
23
+ return "";
24
+ }
25
+ let bb = value1.startsWith("@@");
26
+ if (bb) {
27
+ newvalue= (value?value:"") + value1.substring(2, value1.length);
28
+ } else {
29
+ newvalue=value1;
30
+ }
31
+ onChange(newvalue);
32
+ }
33
+ }
34
+
35
+
36
+ let placeholder = !fieldConfig.disabled ? `请输入${fieldConfig.title}` : "无需输入";
37
+ let disabled: boolean = fieldConfig.disabled;
38
+
39
+ let antdControlProps = {
40
+ id, placeholder, disabled,
41
+ }
42
+
43
+ const getSelectArray = () => {
44
+ let data = HCDataSource.getEnums(fieldConfig.mstrucId);
45
+ if (!data) {
46
+ return [];
47
+ }
48
+ const options = []
49
+ data.map((item) => {
50
+ const option = {
51
+ value: "@@" + item.value,
52
+ label: item.title
53
+ };
54
+ options.push(option)
55
+ return false
56
+ })
57
+ // debugger
58
+ return options
59
+ };
60
+
61
+ entryControl = <AntdAutoComplete
62
+ allowClear={true}
63
+ dropdownMatchSelectWidth={true}
64
+ options={getSelectArray()}
65
+ onChange={changeValue}
66
+ value={value}
67
+ //style={{width: scalableWidth}}
68
+ >
69
+ <TextArea
70
+ style={{
71
+ height: 150,
72
+ }}
73
+ {...antdControlProps}
74
+ />
75
+ </AntdAutoComplete>
76
+
77
+ return entryControl;
78
+ }
79
+
80
+ export default AutoComplete;
@@ -0,0 +1,97 @@
1
+ import React from 'react'
2
+ import Super from "../../tmpl/superagent"
3
+ import {Cascader as AntdCascader} from 'antd'
4
+
5
+ export default class Cascader extends React.Component{
6
+
7
+ state={
8
+ options:[]
9
+ }
10
+ handleChange=(value)=>{
11
+ let res=""
12
+ res=value.join("->")
13
+ console.log(res)
14
+ this.triggerChange(res)
15
+ }
16
+ triggerChange = (changedValue) => {
17
+ const { onChange } = this.props
18
+ if (onChange) {
19
+ onChange(changedValue);
20
+ }
21
+ }
22
+ requestLinkage=(optionKey)=>{ //第一级联动
23
+ const optGroupId=optionKey.split("@")[0]
24
+ const time=optionKey.split("@")[1]
25
+ Super.super({
26
+ url:`/meta/dict/cas_ops/${optGroupId}`,
27
+ }).then((res)=>{
28
+ const ops=[]
29
+ res.options.forEach((item)=>{
30
+ const op={}
31
+ op["value"]=item.title
32
+ op["label"]=item.title
33
+ op["key"]=item.id
34
+ op["isLeaf"]= false
35
+ ops.push(op)
36
+ })
37
+ this.setState({
38
+ options:ops,
39
+ time
40
+ })
41
+ })
42
+ }
43
+ loadData = (selectedOptions) => { //子集联动
44
+ const targetOption = selectedOptions[selectedOptions.length - 1]
45
+ targetOption.loading = true
46
+ this.setState({
47
+ time:this.state.time-1
48
+ })
49
+ if(selectedOptions && this.state.time>=1){
50
+ let id="";
51
+ selectedOptions.forEach((item)=>{
52
+ id=item.key
53
+ })
54
+ Super.super({
55
+ url:`v2/meta/dict/cas_ops/${id}`,
56
+ }).then((res)=>{
57
+ const ops=[]
58
+ const time=this.state.time
59
+ res.options.forEach((item)=>{
60
+ let op={}
61
+ op["value"]=item.title
62
+ op["label"]=item.title
63
+ op["key"]=item.id
64
+ if(time===1){
65
+ op["isLeaf"]= true
66
+ }else{
67
+ op["isLeaf"]= false
68
+ }
69
+ ops.push(op)
70
+ })
71
+ setTimeout(() => {
72
+ targetOption.loading = false;
73
+ targetOption.children =ops
74
+ this.setState({
75
+ options: [...this.state.options],
76
+ });
77
+ }, 300);
78
+ })
79
+ }
80
+ }
81
+
82
+ render(){
83
+ const { optionGroupKey,fieldName }=this.props
84
+ return (
85
+ <AntdCascader
86
+ onClick={()=>this.requestLinkage(optionGroupKey)}
87
+ placeholder={`请选择${fieldName}`}
88
+ style={{width:220}}
89
+ options={this.state.options}
90
+ loadData={this.loadData}
91
+ displayRender={label=>label.join('->')}
92
+ getPopupContainer={trigger => trigger.parentNode}
93
+ onChange={this.handleChange}
94
+ />
95
+ )
96
+ }
97
+ }
@@ -0,0 +1,150 @@
1
+ import React from "react";
2
+ import {Button, Col, Modal, Popconfirm, Row} from 'antd';
3
+ import {RemoteStructServiceProvider} from 'ketcher-core'
4
+ // import { StandaloneStructServiceProvider } from 'ketcher-standalone'
5
+ import {Editor} from "ketcher-react";
6
+ import 'miew/dist/Miew.min.css'
7
+ import 'ketcher-react/dist/index.css'
8
+ import './index.css'
9
+ import HcserviceV3 from '../../tmpl/hcservice-v3'
10
+ import {VEControlProps} from '../../tmpl/interface'
11
+ import {DeploymentUnitOutlined} from '@ant-design/icons';
12
+
13
+ interface ChemStrucProps extends VEControlProps {
14
+
15
+ }
16
+
17
+ interface ChemStrucState {
18
+ modalVisible: boolean,
19
+ molFileLoaded: boolean,
20
+ molFile: any,
21
+ }
22
+
23
+ export default class ChemStruc extends React.PureComponent<ChemStrucProps, ChemStrucState> {
24
+
25
+ static defaultProps = {
26
+ viewOrEdit: 'view',
27
+ }
28
+
29
+ state = {
30
+ modalVisible: false,
31
+ molFileLoaded: false,
32
+ molFile: undefined,
33
+ }
34
+
35
+ componentDidMount() {
36
+
37
+ }
38
+
39
+ //
40
+ // async componentDidUpdate(prevProps, prevState, snapshot) {
41
+ // const {value} = this.props
42
+ // const {value:preValue} = prevProps;
43
+ //
44
+ // if(Object.entries(value).toString() != Object.entries(preValue).toString()){
45
+ // await this.loadData();
46
+ // }
47
+ // }
48
+
49
+
50
+ loadData = async () => {
51
+ const {value} = this.props
52
+ if (value) {
53
+ let val = JSON.parse(value);
54
+ let molFile
55
+ if (val.valid == true) {//此处要优化
56
+ molFile = await HcserviceV3.loadFileTxt(val.base.path);
57
+ } else if (val.valid == 'new') {
58
+ molFile = val.body;
59
+ } else {
60
+ molFile = undefined;
61
+ }
62
+ console.log('molFile:', molFile);
63
+ // urilib.resolve('');
64
+ global.ketcher.setMolecule(molFile);
65
+ this.setState({
66
+ molFile,
67
+ })
68
+ }
69
+ }
70
+
71
+ saveMolfile = async () => {
72
+ let value = await global.ketcher.getKet();
73
+ //let value = await global.ketcher.getGraphAsync();
74
+ console.log('ket value:', value);
75
+ this.triggerChange(value);
76
+ this.setState({
77
+ modalVisible: false,
78
+ })
79
+ }
80
+
81
+ triggerChange = (changedValue) => {
82
+ const {onChange} = this.props
83
+ if (onChange) {
84
+ onChange(JSON.stringify({valid: 'new', body: changedValue}));
85
+ }
86
+ }
87
+
88
+
89
+ showView = async () => {
90
+ await this.loadData();
91
+ this.setState({
92
+ modalVisible: true
93
+ })
94
+ }
95
+ onCancel = () => {
96
+ this.setState({
97
+ modalVisible: false,
98
+ })
99
+ }
100
+
101
+ render() {
102
+ const {disabled, viewOrEdit, value} = this.props
103
+ const {molFile} = this.state
104
+ const structServiceProvider = new RemoteStructServiceProvider("")
105
+ return (
106
+ <>
107
+ <Button
108
+ onClick={this.showView}>
109
+ <DeploymentUnitOutlined/> {viewOrEdit == 'view' ? '查 看' : ' 编 辑'}
110
+ </Button>
111
+ <Modal
112
+ closable={false}
113
+ visible={this.state.modalVisible}
114
+ forceRender={true}
115
+ centered
116
+ style={{maxWidth: 'calc(100vw - 62px)', maxHeight: 'calc(100vw - 50px)'}}
117
+ width={1200}
118
+ onCancel={() => {
119
+ this.onCancel()
120
+ }}
121
+ footer={disabled ? [<Button key={1} onClick={() => {
122
+ this.onCancel()
123
+ }}>取消</Button>] : [<Popconfirm key={2} placement="top" title={"确定要取消本次编辑的数据吗?"}
124
+ onConfirm={this.onCancel} okText="确定"
125
+ cancelText="取消"><Button>取消</Button></Popconfirm>,
126
+ <Button key={3} onClick={() => {
127
+ this.saveMolfile();
128
+ }} type='primary'>确定</Button>]}
129
+ bodyStyle={{width: '1200px'}}
130
+ >
131
+ <Row style={{
132
+ height: '430px',
133
+ border: '1px solid #00f',
134
+ maxWidth: 'calc(100vw - 92px)',
135
+ maxHeight: 'calc(100vw - 80px)'
136
+ }}>
137
+ <Col key={1} span={24} style={{height: '430px'}}>
138
+ <Editor onInit={async (ketcher) => {
139
+ global.ketcher = ketcher;
140
+ //await ketcher.setMolecule(await HcserviceV3.loadFileTxt(value.base.path));
141
+ }} staticResourcesUrl={"ketcher"} structServiceProvider={structServiceProvider}
142
+ errorHandler={undefined}/>
143
+ {/*<Editor staticResourcesUrl={"ketcher"} structServiceProvider={structServiceProvider} />*/}
144
+ </Col>
145
+ </Row>
146
+ </Modal>
147
+ </>
148
+ );
149
+ }
150
+ }
@@ -0,0 +1,28 @@
1
+ body {
2
+ margin: 0;
3
+ padding: 0;
4
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
5
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
6
+ sans-serif;
7
+ -webkit-font-smoothing: antialiased;
8
+ -moz-osx-font-smoothing: grayscale;
9
+ }
10
+
11
+ .chemstruc-edit-upload{
12
+ width: 230px;
13
+ }
14
+
15
+ .ant-upload-list-picture-card-container,
16
+ .ant-upload-select-picture-card{
17
+ width: 66px!important;
18
+ height:66px!important;
19
+ }
20
+ /*控制ketcher的选择工具栏的显示层级,modal为1000,所以此处为1020*/
21
+ .ToolbarMultiToolItem-module_portal__yDg5_{
22
+ z-index: 1020!important;
23
+ }
24
+
25
+ code {
26
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
27
+ monospace;
28
+ }
@@ -0,0 +1,9 @@
1
+
2
+ .collapse .ant-card-body {
3
+ padding:0px
4
+ }
5
+
6
+ .ant-card-head-title button{
7
+ font-size: 16px;
8
+ padding:0px;
9
+ }
@@ -0,0 +1,59 @@
1
+ import * as React from 'react'
2
+ import {Button, Card} from 'antd'
3
+ import './index.css'
4
+ import {DownOutlined, RightOutlined} from '@ant-design/icons';
5
+ import {CardProps} from "antd/lib/card";
6
+
7
+ interface CollapseCardProps extends CardProps {
8
+ initCollapse?: boolean,
9
+ };
10
+
11
+ interface CollapseCardState {
12
+ collapse: boolean
13
+ };
14
+ export default class CollapseCard extends React.PureComponent<CollapseCardProps, CollapseCardState> {
15
+
16
+ state = {
17
+ collapse: false,
18
+ }
19
+
20
+ componentDidMount() {
21
+ const {initCollapse} = this.props;
22
+ this.setState({
23
+ collapse: initCollapse,
24
+ })
25
+ }
26
+
27
+ componentDidUpdate(prevProps) {
28
+ const {initCollapse} = this.props;
29
+ if (this.props != prevProps) {
30
+ this.setState({
31
+ collapse: initCollapse,
32
+ })
33
+ }
34
+ }
35
+
36
+ cardTitle = () => {
37
+ const {title} = this.props;
38
+ const {collapse} = this.state;
39
+ if (collapse) {
40
+ return <Button type="text" onClick={() => {
41
+ this.setState({collapse: false})
42
+ }}><RightOutlined/>{title}</Button>
43
+ } else {
44
+ return <Button type="text" onClick={() => {
45
+ this.setState({collapse: true})
46
+ }}><DownOutlined/>{title}</Button>
47
+ }
48
+ }
49
+
50
+ render() {
51
+ const {collapse} = this.state;
52
+ const { extra, title, className,initCollapse, ...other } = this.props;
53
+ return <Card {...other} extra={collapse ? "" : extra}
54
+ className={`${className} ${collapse ? 'collapse' : ""}`} title={this.cardTitle()}>
55
+ {collapse ? "" : this.props.children}
56
+ </Card>;
57
+ }
58
+
59
+ }
@@ -0,0 +1,27 @@
1
+
2
+ .color {
3
+ width: 108px;
4
+ height: 24px;
5
+ border-radius: 2px;
6
+ display: inline-block;
7
+ /*background: `rgba(${ this.state.color.r }, ${ this.state.color.g }, ${ this.state.color.b }, ${ this.state.color.a })`,*/
8
+ }
9
+ .swatch {
10
+ padding: 5px;
11
+ background: #fff;
12
+ border-radius: 1px;
13
+ box-shadow: 0 0 0 1px rgba(0,0,0,.1);
14
+ display: inline-block;
15
+ cursor: pointer;
16
+ }
17
+ .popover{
18
+ position: absolute;
19
+ z-index: 2;
20
+ }
21
+ .cover{
22
+ position: fixed;
23
+ top: 0px;
24
+ right: 0px;
25
+ bottom: 0px;
26
+ left: 0px;
27
+ }
@@ -0,0 +1,88 @@
1
+ import React from 'react'
2
+ import {AutoComplete as AntdAutoComplete, Button, Card, Form as AntdForm, Input, Popover, Space} from "antd";
3
+ import {CloseOutlined,CloseCircleOutlined} from '@ant-design/icons'
4
+ import {VEControlProps} from "../../tmpl/interface";
5
+ import './index.css'
6
+ import FormItemGroup from "../../form/form-Item-group";
7
+ import Swatches from 'react-color'
8
+
9
+ const {TextArea} = Input;
10
+
11
+ interface PickerProps extends VEControlProps {
12
+
13
+ }
14
+
15
+ interface PickerState {
16
+ displayColorPicker:boolean
17
+ }
18
+
19
+ export default class CollapseCard extends React.PureComponent<PickerProps, PickerState> {
20
+
21
+ state = {
22
+ displayColorPicker:false,
23
+ }
24
+
25
+ componentDidMount() {
26
+
27
+ this.setState({
28
+
29
+ })
30
+ }
31
+
32
+ componentDidUpdate(prevProps) {
33
+ const {} = this.props;
34
+ if (this.props != prevProps) {
35
+ this.setState({
36
+
37
+ })
38
+ }
39
+ }
40
+
41
+ handleChange=(value)=>{
42
+ if(value && value.hex){
43
+ this.props.onChange(value.hex);
44
+ }else{
45
+ this.props.onChange("");
46
+ }
47
+
48
+ }
49
+
50
+ render() {
51
+ const {displayColorPicker} = this.state;
52
+ const {value,viewOrEdit, ...other } = this.props;
53
+
54
+ return (viewOrEdit=='view'? <div className={ 'color' } style={{background:value}}>{value}</div> :
55
+ <Popover visible={displayColorPicker}
56
+ content={
57
+ <Card
58
+ style={{width: 320}}
59
+ title={"颜色选择"}
60
+ bodyStyle={{overflow: 'auto'}}
61
+ extra={<><Space size={[8, 0]}>
62
+ {<Button onClick={() => {
63
+ this.setState({displayColorPicker: false});
64
+ }}><CloseOutlined/></Button>
65
+ }
66
+ </Space></>}
67
+ >
68
+ <Swatches
69
+ color={ value }
70
+ onChange={ this.handleChange } />
71
+ </Card>
72
+ }
73
+ >
74
+ <div>
75
+ <span onClick={ ()=>{
76
+ this.setState({displayColorPicker: !displayColorPicker});
77
+ } } className={ 'color' } style={{background:value,cursor:'pointer'}} >{value?value :
78
+ <Button type={'link'}>选择颜色</Button>}</span>
79
+ <span>{value?<Button type={'text'} onClick={()=>{this.handleChange(undefined)}}>
80
+ <CloseCircleOutlined />
81
+ </Button>:""}</span>
82
+ </div>
83
+
84
+ </Popover>)
85
+
86
+ }
87
+
88
+ }