aldehyde 0.2.264 → 0.2.267

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 (111) hide show
  1. package/lib/controls/chemstruc/graph.d.ts.map +1 -1
  2. package/lib/controls/chemstruc/graph.js +3 -2
  3. package/lib/controls/chemstruc/graph.js.map +1 -1
  4. package/lib/controls/entity-select/entity-select.d.ts.map +1 -1
  5. package/lib/controls/entity-select/entity-select.js +39 -7
  6. package/lib/controls/entity-select/entity-select.js.map +1 -1
  7. package/lib/controls/entry-control.d.ts.map +1 -1
  8. package/lib/controls/entry-control.js +16 -18
  9. package/lib/controls/entry-control.js.map +1 -1
  10. package/lib/controls/html-editor/draft.d.ts.map +1 -1
  11. package/lib/controls/html-editor/draft.js +26 -42
  12. package/lib/controls/html-editor/draft.js.map +1 -1
  13. package/lib/controls/rfield/index.d.ts.map +1 -1
  14. package/lib/controls/rfield/index.js +0 -7
  15. package/lib/controls/rfield/index.js.map +1 -1
  16. package/lib/custom-page/dtmpl-custom-edit-modal-page.d.ts.map +1 -1
  17. package/lib/custom-page/dtmpl-custom-edit-modal-page.js +3 -2
  18. package/lib/custom-page/dtmpl-custom-edit-modal-page.js.map +1 -1
  19. package/lib/detail/edit/modal-row-edit.d.ts.map +1 -1
  20. package/lib/detail/edit/modal-row-edit.js +2 -2
  21. package/lib/detail/edit/modal-row-edit.js.map +1 -1
  22. package/lib/detail/edit/post-result/index.d.ts.map +1 -1
  23. package/lib/detail/edit/post-result/index.js +3 -2
  24. package/lib/detail/edit/post-result/index.js.map +1 -1
  25. package/lib/detail/view/modal-dtmpl-view.d.ts.map +1 -1
  26. package/lib/detail/view/modal-dtmpl-view.js +3 -2
  27. package/lib/detail/view/modal-dtmpl-view.js.map +1 -1
  28. package/lib/detail/view/snapshot-timeline.d.ts +5 -1
  29. package/lib/detail/view/snapshot-timeline.d.ts.map +1 -1
  30. package/lib/detail/view/snapshot-timeline.js +19 -17
  31. package/lib/detail/view/snapshot-timeline.js.map +1 -1
  32. package/lib/form/criteria-form.d.ts.map +1 -1
  33. package/lib/form/criteria-form.js +1 -0
  34. package/lib/form/criteria-form.js.map +1 -1
  35. package/lib/form/dtmpl-form.d.ts.map +1 -1
  36. package/lib/form/dtmpl-form.js.map +1 -1
  37. package/lib/form/form-Item-group.d.ts.map +1 -1
  38. package/lib/form/form-Item-group.js +0 -3
  39. package/lib/form/form-Item-group.js.map +1 -1
  40. package/lib/login/context-setter.d.ts.map +1 -1
  41. package/lib/login/context-setter.js +3 -2
  42. package/lib/login/context-setter.js.map +1 -1
  43. package/lib/module/draggable-modal.d.ts +5 -0
  44. package/lib/module/draggable-modal.d.ts.map +1 -0
  45. package/lib/module/draggable-modal.js +45 -0
  46. package/lib/module/draggable-modal.js.map +1 -0
  47. package/lib/module/dtmpl-edit-page.d.ts.map +1 -1
  48. package/lib/module/dtmpl-edit-page.js +8 -4
  49. package/lib/module/dtmpl-edit-page.js.map +1 -1
  50. package/lib/module/dtmpl-view-modal.d.ts.map +1 -1
  51. package/lib/module/dtmpl-view-modal.js +2 -2
  52. package/lib/module/dtmpl-view-modal.js.map +1 -1
  53. package/lib/module/ltmpl-modal.d.ts.map +1 -1
  54. package/lib/module/ltmpl-modal.js +4 -3
  55. package/lib/module/ltmpl-modal.js.map +1 -1
  56. package/lib/routable/dtmpl-route.d.ts.map +1 -1
  57. package/lib/routable/dtmpl-route.js.map +1 -1
  58. package/lib/table/act-table.d.ts.map +1 -1
  59. package/lib/table/act-table.js +4 -7
  60. package/lib/table/act-table.js.map +1 -1
  61. package/lib/table/modal-select-table.d.ts.map +1 -1
  62. package/lib/table/modal-select-table.js +2 -2
  63. package/lib/table/modal-select-table.js.map +1 -1
  64. package/lib/tmpl/hcservice-v3.d.ts +1 -1
  65. package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
  66. package/lib/tmpl/hcservice-v3.js +2 -2
  67. package/lib/tmpl/hcservice-v3.js.map +1 -1
  68. package/lib/tmpl/interface.d.ts +3 -0
  69. package/lib/tmpl/interface.d.ts.map +1 -1
  70. package/lib/tmpl/interface.js.map +1 -1
  71. package/lib/tmpl/tmpl-config-analysis.d.ts +3 -1
  72. package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
  73. package/lib/tmpl/tmpl-config-analysis.js +68 -3
  74. package/lib/tmpl/tmpl-config-analysis.js.map +1 -1
  75. package/lib/tree/tree-utils.d.ts.map +1 -1
  76. package/lib/tree/tree-utils.js.map +1 -1
  77. package/lib/units/index.d.ts.map +1 -1
  78. package/lib/units/index.js +4 -0
  79. package/lib/units/index.js.map +1 -1
  80. package/package.json +2 -2
  81. package/src/aldehyde/controls/chemstruc/graph.tsx +3 -2
  82. package/src/aldehyde/controls/entity-select/entity-select.tsx +44 -12
  83. package/src/aldehyde/controls/entry-control.tsx +4 -19
  84. package/src/aldehyde/controls/html-editor/draft.tsx +26 -47
  85. package/src/aldehyde/controls/rfield/index.tsx +0 -7
  86. package/src/aldehyde/custom-page/dtmpl-custom-edit-modal-page.tsx +5 -4
  87. package/src/aldehyde/detail/edit/modal-row-edit.tsx +5 -4
  88. package/src/aldehyde/detail/edit/post-result/index.tsx +5 -4
  89. package/src/aldehyde/detail/view/modal-dtmpl-view.tsx +4 -3
  90. package/src/aldehyde/detail/view/snapshot-timeline.tsx +26 -21
  91. package/src/aldehyde/form/criteria-form.tsx +2 -1
  92. package/src/aldehyde/form/dtmpl-form.tsx +0 -1
  93. package/src/aldehyde/form/form-Item-group.tsx +1 -3
  94. package/src/aldehyde/login/context-setter.tsx +3 -2
  95. package/src/aldehyde/module/draggable-modal.tsx +67 -0
  96. package/src/aldehyde/module/dtmpl-edit-page.tsx +22 -17
  97. package/src/aldehyde/module/dtmpl-view-modal.tsx +3 -2
  98. package/src/aldehyde/module/ltmpl-modal.tsx +6 -5
  99. package/src/aldehyde/routable/dtmpl-route.tsx +0 -2
  100. package/src/aldehyde/table/act-table.tsx +4 -10
  101. package/src/aldehyde/table/modal-select-table.tsx +5 -4
  102. package/src/aldehyde/tmpl/hcservice-v3.tsx +2 -2
  103. package/src/aldehyde/tmpl/interface.tsx +3 -0
  104. package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +82 -3
  105. package/src/aldehyde/tree/tree-utils.tsx +0 -1
  106. package/src/aldehyde/units/index.tsx +8 -1
  107. package/lib/controls/html-editor/tinymce.d.ts +0 -13
  108. package/lib/controls/html-editor/tinymce.d.ts.map +0 -1
  109. package/lib/controls/html-editor/tinymce.js +0 -47
  110. package/lib/controls/html-editor/tinymce.js.map +0 -1
  111. package/src/aldehyde/controls/html-editor/tinymce.js +0 -55
@@ -3,6 +3,7 @@ import { Modal, ModalProps as AntdModalProps, Form, Button } from "antd";
3
3
  import ActDtmplView, { ActDtmplViewProps } from "./act-dtmpl-view";
4
4
  import Scrollbars from "react-custom-scrollbars";
5
5
  import { LocaleContext } from "../../locale/LocaleProvider";
6
+ import DraggableModal from "../../module/draggable-modal";
6
7
  interface ModalDtmplViewProps extends ActDtmplViewProps {
7
8
  height?: any;
8
9
  onCancel: () => any;
@@ -40,13 +41,13 @@ export default class ModalDtmplView extends React.PureComponent<
40
41
  const { code, sourceId, serverKey, open, onCancel, height } = this.props;
41
42
  const { translate } = this.context;
42
43
  return (
43
- <Modal
44
+ <DraggableModal
44
45
  open={open}
45
46
  title={translate("${查看}")}
46
47
  width={"82vw"}
47
48
  centered
48
49
  wrapClassName={"aaa"}
49
- bodyStyle={{ height: height, overflow: "auto" }}
50
+ styles={{body:{ height: height, overflow: "auto" }}}
50
51
  onCancel={onCancel}
51
52
  footer={[
52
53
  <Button key="back" onClick={onCancel}>
@@ -66,7 +67,7 @@ export default class ModalDtmplView extends React.PureComponent<
66
67
  ""
67
68
  )}
68
69
  </Scrollbars>
69
- </Modal>
70
+ </DraggableModal>
70
71
  );
71
72
  }
72
73
  }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { Button, Drawer, Timeline } from "antd";
2
+ import {Button, Drawer, Skeleton, Timeline} from "antd";
3
3
  import HcserviceV3 from "../../tmpl/hcservice-v3";
4
4
  import "../dtmpl.css";
5
5
  import { DtmplConfig } from "../../tmpl/interface";
@@ -22,7 +22,9 @@ export interface SnapshotTimelineProps {
22
22
  export interface SnapshotTimelineStat {
23
23
  list?: SnapshotType[];
24
24
  loading?: boolean;
25
+ pageNo?: number;
25
26
  currents?: SnapshotType[];
27
+ isEnd?: boolean;
26
28
  }
27
29
 
28
30
  class SnapshotTimeline extends React.PureComponent<
@@ -32,9 +34,11 @@ class SnapshotTimeline extends React.PureComponent<
32
34
  static defaultProps = {};
33
35
 
34
36
  state = {
35
- list: undefined,
37
+ list:undefined,
36
38
  loading: false,
37
39
  currents: [],
40
+ pageNo: 1,
41
+ isEnd:false,
38
42
  };
39
43
  static contextType = LocaleContext;
40
44
  context: React.ContextType<typeof LocaleContext>;
@@ -44,41 +48,36 @@ class SnapshotTimeline extends React.PureComponent<
44
48
  async componentDidUpdate(prevProps) {
45
49
  const { open } = this.props;
46
50
  const { list } = this.state;
47
- if (open && !list) {
48
- this.loadData();
51
+ if (open && !list ) {
52
+ this.loadData(1);
49
53
  }
50
54
  }
51
55
 
52
- loadData = async () => {
56
+ loadData = async (pageNo:number) => {
53
57
  const { sourceId, code, serverKey } = this.props;
54
- const { currents } = this.state;
58
+ const { currents,list } = this.state;
55
59
  if (code) {
56
60
  this.setState({
57
61
  loading: true,
58
62
  });
59
- const list = await HcserviceV3.requestVersionList(
63
+ const list1 = await HcserviceV3.requestVersionList(
60
64
  serverKey,
61
65
  sourceId,
62
- code
66
+ code,pageNo
63
67
  );
64
- if(currents.length==0 && list.length > 0){
65
- this.onAdd(list[0]);
68
+ if(currents.length==0 && list1.length > 0){
69
+ this.onAdd(list1[0]);
66
70
  }
67
71
 
68
72
  this.setState({
69
- list,
73
+ list:list?[...list,...list1]:list1,
70
74
  loading: false,
75
+ isEnd:list1.length<100,
76
+ pageNo:pageNo,
71
77
  });
72
78
  }
73
79
  };
74
80
 
75
- // onChange = (versionId: number) => {
76
- // const { showSnapshot } = this.props;
77
- // this.setState({
78
- // current: versionId,
79
- // });
80
- // showSnapshot(versionId);
81
- // };
82
81
  onAdd = (item: SnapshotType) => {
83
82
  const { showSnapshot } = this.props;
84
83
  const { currents } = this.state;
@@ -164,7 +163,7 @@ class SnapshotTimeline extends React.PureComponent<
164
163
  code,
165
164
  serverKey,
166
165
  } = this.props;
167
- const { list, currents} = this.state;
166
+ const { list, currents,loading,pageNo,isEnd} = this.state;
168
167
  const { translate } = this.context;
169
168
 
170
169
  let viewDatas: ViewComparData[]=[];
@@ -180,10 +179,16 @@ class SnapshotTimeline extends React.PureComponent<
180
179
  closable={true}
181
180
  onClose={onClose}
182
181
  open={open}
183
- width={350}
182
+ width={370}
184
183
  >
185
- {list && list.length > 0 ? (
184
+ {loading?<Skeleton />:
185
+ list && list.length > 0 ? (
186
+ <>
186
187
  <Timeline mode="alternate">{this.detailHistory()}</Timeline>
188
+ {isEnd?"": <Button onClick={()=>{
189
+ this.loadData(this.state.pageNo+1);
190
+ }}>下一页</Button>}
191
+ </>
187
192
  ) : (
188
193
  translate("${暂无历史记录}")
189
194
  )}
@@ -348,7 +348,8 @@ const CriteriaForm: React.FC<CriteriaFormProps> = (props) => {
348
348
  };
349
349
 
350
350
  const onValuesChange = (changedValues, allValues) => {
351
- let appCtmplConfig= ProgramConfig.getAppCtmplConfig(
351
+ debugger
352
+ let appCtmplConfig= ProgramConfig.getAppCtmplConfig(
352
353
  ltmplConfig,
353
354
  data,
354
355
  props
@@ -3,7 +3,6 @@ import {
3
3
  Button,
4
4
  Card,
5
5
  Form as AntdForm,
6
- FormInstance,
7
6
  message,
8
7
  Switch,
9
8
  } from "antd";
@@ -147,7 +147,6 @@ export default class FormItemGroup extends React.PureComponent<
147
147
  if (fields && fields.length > 0) {
148
148
  fields.forEach((item, index) => {
149
149
  let fieldValue = valueMap ? valueMap[item.id] : undefined;
150
- //const fieldKey = item.id + Math.random() * 100;
151
150
  fieldValue =
152
151
  fieldValue || fieldValue == 0
153
152
  ? fieldValue
@@ -172,8 +171,7 @@ export default class FormItemGroup extends React.PureComponent<
172
171
  </FormItem>
173
172
  );
174
173
  } else {
175
- // debugger;
176
- // console.log("getFieldValue ---", Form.useFormInstance());
174
+
177
175
  formItem = item.shouldUpdate ? (
178
176
  <FormItem noStyle shouldUpdate={item.shouldUpdate}>
179
177
  {() => this.initFormItem(item, fieldValue)}
@@ -5,6 +5,7 @@ import EntryControl from "../controls/entry-control";
5
5
  import HCserviceV3 from "../tmpl/hcservice-v3";
6
6
  import withRouter from "../routable/withroute";
7
7
  import {LocaleContext} from "../locale/LocaleProvider";
8
+ import DraggableModal from "../module/draggable-modal";
8
9
 
9
10
  //以列表为入口的,页面内列表,基本原则是所有交互在页面内完成,不会触发路由。
10
11
 
@@ -77,7 +78,7 @@ class ContextSetter extends React.PureComponent<ContextSetterProps, ContextSette
77
78
  const { translate} = this.context;
78
79
  const {config,loading,context}=this.state;
79
80
  const {serverKey}=this.props;
80
- return <Modal title={translate("${全局配置}")} closable={false} open={true} footer={[]}>
81
+ return <DraggableModal title={translate("${全局配置}")} closable={false} open={true} footer={[]}>
81
82
  <Row justify="center" align="middle" >
82
83
  <Col>
83
84
  <Form style={{width: 350}} ref={this.formRef}
@@ -119,7 +120,7 @@ class ContextSetter extends React.PureComponent<ContextSetterProps, ContextSette
119
120
  </Form>
120
121
  </Col>
121
122
  </Row>
122
- </Modal>
123
+ </DraggableModal>
123
124
 
124
125
 
125
126
  }
@@ -0,0 +1,67 @@
1
+ import React, { useRef, useState } from 'react';
2
+ import { Modal } from 'antd';
3
+ import type { DraggableData, DraggableEvent } from 'react-draggable';
4
+ import Draggable from 'react-draggable';
5
+ import { ModalProps } from 'antd/lib/modal';
6
+
7
+ const DraggableModal: React.FC<ModalProps> = (props) => {
8
+ const [disabled, setDisabled] = useState(true);
9
+ const [bounds, setBounds] = useState({ left: 0, top: 0, bottom: 0, right: 0 });
10
+ const draggleRef = useRef<HTMLDivElement>(null!);
11
+
12
+ const onStart = (_event: DraggableEvent, uiData: DraggableData) => {
13
+ const { clientWidth, clientHeight } = window.document.documentElement;
14
+ const targetRect = draggleRef.current?.getBoundingClientRect();
15
+ if (!targetRect) {
16
+ return;
17
+ }
18
+ setBounds({
19
+ left: -targetRect.left + uiData.x,
20
+ right: clientWidth - (targetRect.right - uiData.x),
21
+ top: -targetRect.top + uiData.y,
22
+ bottom: clientHeight - (targetRect.bottom - uiData.y),
23
+ });
24
+ };
25
+
26
+ const {title,children, ...otherProps} = props;
27
+
28
+ return (
29
+ <>
30
+ <Modal
31
+ title={
32
+ <div
33
+ style={{ width: '100%', cursor: 'move' }}
34
+ onMouseOver={() => {
35
+ if (disabled) {
36
+ setDisabled(false);
37
+ }
38
+ }}
39
+ onMouseOut={() => {
40
+ setDisabled(true);
41
+ }}
42
+ onFocus={() => {}}
43
+ onBlur={() => {}}
44
+ // end
45
+ >
46
+ {title}
47
+ </div>
48
+ }
49
+ modalRender={(modal) => (
50
+ <Draggable
51
+ disabled={disabled}
52
+ bounds={bounds}
53
+ nodeRef={draggleRef}
54
+ onStart={(event, uiData) => onStart(event, uiData)}
55
+ >
56
+ <div ref={draggleRef}>{modal}</div>
57
+ </Draggable>
58
+ )}
59
+ {...otherProps}
60
+ >
61
+ {children}
62
+ </Modal>
63
+ </>
64
+ );
65
+ };
66
+
67
+ export default DraggableModal;
@@ -21,6 +21,9 @@ import HcserviceV3 from "../tmpl/hcservice-v3";
21
21
  import Action from "../controls/action";
22
22
  import Scrollbars from "react-custom-scrollbars";
23
23
  import { LocaleContext } from "../locale/LocaleProvider";
24
+ import Draggable from 'react-draggable';
25
+ import DraggableModal from "./draggable-modal";
26
+
24
27
 
25
28
  interface ModalEditorProps extends DtmplBaseProps {
26
29
  height?: any;
@@ -321,35 +324,37 @@ export default class DtmplEditPage extends React.PureComponent<
321
324
  <>
322
325
  {" "}
323
326
  {pageType == "modal" ? (
324
- <Modal
327
+ // <Draggable handle=".ant-modal-header">
328
+ <DraggableModal
325
329
  open={open}
326
330
  width={width}
327
331
  title={title1}
328
332
  closable={false}
329
333
  styles={{body:{ height: height, overflow: "auto" }}}
330
334
  destroyOnHidden={true}
331
- centered
335
+ centered
332
336
  onCancel={onCancel}
333
337
  footer={this.getFooter()}
334
- >
335
- <Scrollbars autoHide autoHideTimeout={1000}>
338
+ children={<Scrollbars autoHide autoHideTimeout={1000}>
336
339
  <div onClick={this.onClickBody}>
337
340
  <DtmplForm
338
- serverKey={serverKey}
339
- mainCode={mainCode}
340
- parentId={id}
341
- dtmplConfig={dtmplConfig}
342
- formRef={this.formRef}
343
- sourceId={sourceId}
344
- onFinish={this.onFinish}
345
- maxColsOnRow={maxColsOnRow}
346
- showConfirm={false}
347
- dtmplData={dtmplData}
348
- onValuesChange={this.onValuesChange}
341
+ serverKey={serverKey}
342
+ mainCode={mainCode}
343
+ parentId={id}
344
+ dtmplConfig={dtmplConfig}
345
+ formRef={this.formRef}
346
+ sourceId={sourceId}
347
+ onFinish={this.onFinish}
348
+ maxColsOnRow={maxColsOnRow}
349
+ showConfirm={false}
350
+ dtmplData={dtmplData}
351
+ onValuesChange={this.onValuesChange}
349
352
  />
350
353
  </div>
351
- </Scrollbars>
352
- </Modal>
354
+ </Scrollbars>}
355
+ >
356
+ </DraggableModal>
357
+ // </Draggable>
353
358
  ) : pageType == "drawer" ? (
354
359
  <Drawer
355
360
  onClick={this.onClickBody}
@@ -3,6 +3,7 @@ import { Modal} from 'antd'
3
3
  import DtmplViewCard from "./dtmpl-view-card";
4
4
  import {DtmplBaseProps} from "../tmpl/interface";
5
5
  import Scrollbars from 'react-custom-scrollbars';
6
+ import DraggableModal from "./draggable-modal";
6
7
  interface DtmplViewModalProps extends DtmplBaseProps{
7
8
  title?:ReactNode,
8
9
  open: boolean,
@@ -35,7 +36,7 @@ class DtmplViewModal extends React.PureComponent<DtmplViewModalProps, DtmplViewM
35
36
 
36
37
  render() {
37
38
  const {title,sourceId,code,open,onClose,width,height,serverKey,codeSource}=this.props;
38
- return <Modal
39
+ return <DraggableModal
39
40
  open={open}
40
41
  width={width}
41
42
  title={title}
@@ -47,7 +48,7 @@ class DtmplViewModal extends React.PureComponent<DtmplViewModalProps, DtmplViewM
47
48
  <Scrollbars autoHide autoHideTimeout={1000}>
48
49
  <DtmplViewCard codeSource={codeSource} serverKey={serverKey} sourceId={sourceId} code={code}></DtmplViewCard>
49
50
  </Scrollbars>
50
- </Modal>
51
+ </DraggableModal>
51
52
  }
52
53
  }
53
54
 
@@ -3,6 +3,7 @@ import { Modal, Button, Card } from "antd";
3
3
  import LtmplTable, { LtmplTableProps } from "./ltmpl-table";
4
4
  import Scrollbars from "react-custom-scrollbars";
5
5
  import { LocaleContext } from "../locale/LocaleProvider";
6
+ import DraggableModal from "./draggable-modal";
6
7
 
7
8
  interface LtmplDrawPageProps extends LtmplTableProps {
8
9
  onCancel: () => void;
@@ -39,24 +40,24 @@ export default class LtmplDrawer extends React.PureComponent<
39
40
  const { title, height, width, onCancel, open, ...other } = this.props;
40
41
  const { translate } = this.context;
41
42
  return (
42
- <Modal
43
+ <DraggableModal
43
44
  open={open}
44
45
  width={width}
45
46
  title={title}
46
47
  closable={false}
47
- bodyStyle={{ height: height, overflow: "auto", padding: "6 0 6 6" }}
48
- destroyOnClose={true}
48
+ styles={{body:{ height: height, overflow: "auto", padding: "6 0 6 6" }}}
49
+ destroyOnHidden={true}
49
50
  centered
50
51
  onOk={onCancel}
51
52
  onCancel={onCancel}
52
53
  footer={[<Button onClick={onCancel}>{translate("${关闭}")}</Button>]}
53
54
  >
54
55
  <Scrollbars autoHide autoHideTimeout={1000}>
55
- <Card bordered={false} bodyStyle={{ padding: "4px 10px 0 0" }}>
56
+ <Card variant={'borderless'} styles={{body:{ padding: "4px 10px 0 0" }}}>
56
57
  <LtmplTable {...other}></LtmplTable>
57
58
  </Card>
58
59
  </Scrollbars>
59
- </Modal>
60
+ </DraggableModal>
60
61
  );
61
62
  }
62
63
  }
@@ -2,11 +2,9 @@ import React from "react";
2
2
  import { Empty } from "antd";
3
3
  import { CodeSource, RouterCompProps } from "../tmpl/interface";
4
4
  import DtmplEdit from "../detail/edit/dtmpl-edit";
5
- import ActDtmplView from "../detail/view/act-dtmpl-view";
6
5
  import HcserviceV3 from "../tmpl/hcservice-v3";
7
6
  import withRouter from "./withroute";
8
7
  import TabActDtmplView from "../detail/view/tab-act-dtmpl-view";
9
- import Units from "../units";
10
8
 
11
9
  export interface DtmplRouteProps extends RouterCompProps {
12
10
  layoutRootPath?: string;
@@ -32,16 +32,10 @@ import ModelSelectTable from "./../table/modal-select-table";
32
32
  import ColumnBuilder from "./column/column-builder";
33
33
  import ReportTable from "./report-table";
34
34
  import EntryControl from "../controls/entry-control";
35
- import Units from "../units";
36
- import NavigationTree from "../controls/tree-select/navigation-tree";
37
-
35
+ import DraggableModal from "../module/draggable-modal";
38
36
  const { Content, Sider } = Layout;
39
37
  type Level = "l1" | "l2";
40
38
 
41
- //interface LtreeData {
42
- // id: string;
43
- // value:string;
44
- // }
45
39
 
46
40
  const defaultDisabledColIds: string[] = ["20000", "10000"];
47
41
 
@@ -359,7 +353,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
359
353
  );
360
354
  } else if (customButton.windowPosition == "modal-window") {
361
355
  return (
362
- <Modal
356
+ <DraggableModal
363
357
  open={true}
364
358
  closable={true}
365
359
  width={customButton.windowWidth}
@@ -369,7 +363,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
369
363
  }}
370
364
  >
371
365
  {customElement}
372
- </Modal>
366
+ </DraggableModal>
373
367
  );
374
368
  }
375
369
  };
@@ -591,7 +585,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
591
585
  path = "/";
592
586
  }
593
587
  //是否以http开头
594
- if (path.indexOf("#") == 0 || url.indexOf("/#") == 0) {
588
+ if (path?.indexOf("#") == 0 || url?.indexOf("/#") == 0) {
595
589
  url = "";
596
590
  } else if (
597
591
  path.indexOf("http://") == 0 ||
@@ -12,6 +12,7 @@ import ViewControl from "../controls/view-control";
12
12
  import SelectedRowsCard from './selected-rows-card'
13
13
  import Scrollbars from 'react-custom-scrollbars';
14
14
  import { LocaleContext } from "../locale/LocaleProvider";
15
+ import DraggableModal from "../module/draggable-modal";
15
16
  interface ModelSelectTableProps {
16
17
  maxSelectedRows?: number,
17
18
  open: boolean,
@@ -252,13 +253,13 @@ class ModelSelectTable extends React.PureComponent<ModelSelectTableProps, ModelS
252
253
  // const selectedTag=
253
254
 
254
255
  return (
255
- <Modal
256
+ <DraggableModal
256
257
  open={open}
257
258
  title={<SelectedRowsCard value={selectedRows} onChange={this.changeRowSelection} ></SelectedRowsCard>}
258
259
  width={1150}
259
- destroyOnClose={true}
260
+ destroyOnHidden={true}
260
261
  centered
261
- bodyStyle={{height: '80vh', overflow: 'auto'}}
262
+ styles={{body:{height: '80vh', overflow: 'auto'}}}
262
263
  onCancel={this.handleCancel}
263
264
  onOk={this.handleOk}
264
265
  ><Scrollbars style={{ height: '80vh' }} autoHide autoHideTimeout={1000}>
@@ -272,7 +273,7 @@ class ModelSelectTable extends React.PureComponent<ModelSelectTableProps, ModelS
272
273
  queryKey={queryKey}
273
274
  onChangeRowSelection={this.changeRowSelection}/>
274
275
  </div> </Scrollbars>
275
- </Modal>
276
+ </DraggableModal>
276
277
  );
277
278
  }
278
279
  }
@@ -310,12 +310,12 @@ export default class HcserviceV3 {
310
310
  }
311
311
  }
312
312
 
313
- static async requestVersionList(serverKey: string, sourceId: string, code) {
313
+ static async requestVersionList(serverKey: string, sourceId: string, code,pageNo?:number) {
314
314
  let res = await Super.super({
315
315
  url: `/v3/dtmpl/data/versions`,
316
316
  serverKey,
317
317
  query: {
318
- pageNo: 1,
318
+ pageNo: pageNo?pageNo:1,
319
319
  sourceId,
320
320
  code,
321
321
  },
@@ -390,6 +390,7 @@ export interface FieldConfig extends FieldBase {
390
390
  actions?: FieldAction[];
391
391
  requiredRuleCriterias?: FieldConfig[];
392
392
  usableRuleCriterias?: FieldConfig[];
393
+ relValueField?:FieldConfig;
393
394
  hidden?: boolean;
394
395
  serverKey?: string;
395
396
  sourceId?: string;
@@ -399,6 +400,7 @@ export interface FieldConfig extends FieldBase {
399
400
  optionCodeColId?:string;
400
401
  sortable?:boolean;
401
402
  itemBreakLine?: boolean;
403
+ configChanged?:boolean;
402
404
  }
403
405
 
404
406
  export interface ActionRenderProps{
@@ -445,6 +447,7 @@ export interface SelectConfig extends TmplBase {
445
447
  leftFixedCols?: number;
446
448
  minSelectRows?: number;
447
449
  maxSelectRows?: number;
450
+ buildInFuncFields:FieldConfig[];
448
451
  onCriteriaValuesChange?: (
449
452
  changedValues,
450
453
  allValues: DtmplData,
@@ -7,10 +7,11 @@ import {
7
7
  DtmplFormProps,
8
8
  FieldConfig,
9
9
  FieldGroupConfig,
10
- LtmplConfig,
10
+ LtmplConfig, SelectConfig,
11
11
  } from "./interface";
12
12
  import { FormInstance } from "antd";
13
13
  import ActionUtils from "../controls/action/utils";
14
+ import {CriteriaFormProps} from "../form/criteria-form";
14
15
 
15
16
  function TmplConfigAnalysis() {}
16
17
 
@@ -342,6 +343,7 @@ TmplConfigAnalysis.buildInDtmplConfig = (
342
343
  (field.requiredRuleCriterias &&
343
344
  field.requiredRuleCriterias.length > 0) ||
344
345
  (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
346
+ || field.relValueField
345
347
  ) {
346
348
  field.shouldUpdate = true;
347
349
  buildInFuncFields.push(field);
@@ -391,13 +393,24 @@ TmplConfigAnalysis.buildInDtmplConfig = (
391
393
  field.disabled = true;
392
394
  }
393
395
  }
396
+ if(field.relValueField && changedValues && changedValues.hasOwnProperty(field.relValueField.id)){
397
+ if(!field.baseCriteria){
398
+ field.baseCriteria={}
399
+ }
400
+ field.baseCriteria={...field.baseCriteria,"secondCriteria":changedValues[field.relValueField.id]};
401
+ field.configChanged=true;
402
+ if(formInstance.getFieldValue(field.id)){
403
+ formInstance.setFieldValue(field.id,null);
404
+ }
405
+ if(formInstance.getFieldValue("c_"+field.id)){
406
+ formInstance.setFieldValue("c_"+field.id,null);
407
+ }
408
+ }
394
409
  }
395
410
  }
396
- //debugger
397
411
  setConfig(null, dtmplData, null);
398
412
 
399
413
  dtmplConfig.onValuesChange = (changedValues, allValues, formInstance) => {
400
- //debugger
401
414
  setConfig(changedValues, allValues, formInstance);
402
415
  };
403
416
  return dtmplConfig;
@@ -406,4 +419,70 @@ TmplConfigAnalysis.buildInDtmplConfig = (
406
419
  }
407
420
  };
408
421
 
422
+ TmplConfigAnalysis.buildInCtmplConfig = (
423
+ ltmplConfig:SelectConfig,
424
+ criteriaData,
425
+ props: CriteriaFormProps
426
+ ) => {
427
+ if (!ltmplConfig.buildInFuncFields) {
428
+ //先找到有业务的
429
+ let buildInFuncFields = [];
430
+ for (let field of ltmplConfig.criterias) {
431
+ if (
432
+ (field.requiredRuleCriterias &&
433
+ field.requiredRuleCriterias.length > 0) ||
434
+ (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
435
+ || field.relValueField
436
+ ) {
437
+ field.shouldUpdate = true;
438
+ buildInFuncFields.push(field);
439
+ }
440
+ }
441
+ for (let field of ltmplConfig['drillingParams']) {
442
+ if (
443
+ (field.requiredRuleCriterias &&
444
+ field.requiredRuleCriterias.length > 0) ||
445
+ (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
446
+ || field.relValueField
447
+ ) {
448
+ field.shouldUpdate = true;
449
+ buildInFuncFields.push(field);
450
+ }
451
+ }
452
+ ltmplConfig.buildInFuncFields = buildInFuncFields;
453
+ }
454
+ if (ltmplConfig.buildInFuncFields.length > 0) {
455
+ function setConfig(
456
+ changedValues,
457
+ allValues: DtmplData,
458
+ formInstance: FormInstance
459
+ ) {
460
+ for (let field of ltmplConfig.buildInFuncFields) {
461
+
462
+ if (field.relValueField && changedValues && changedValues.hasOwnProperty("c_"+field.relValueField.id)) {
463
+ if (!field.baseCriteria) {
464
+ field.baseCriteria = {}
465
+ }
466
+ field.baseCriteria = {...field.baseCriteria, "secondCriteria": changedValues["c_"+field.relValueField.id]};
467
+ field.configChanged=true;
468
+ if (formInstance.getFieldValue(field.id)) {
469
+ formInstance.setFieldValue(field.id, null);
470
+ }
471
+ if (formInstance.getFieldValue("c_" + field.id)) {
472
+ formInstance.setFieldValue("c_" + field.id, null);
473
+ }
474
+ }
475
+ }
476
+ }
477
+ //debugger
478
+ setConfig(null, criteriaData, null);
479
+ ltmplConfig.onCriteriaValuesChange = (changedValues, allValues, formInstance) => {
480
+ setConfig(changedValues,allValues, formInstance);
481
+ };
482
+ return ltmplConfig;
483
+ } else {
484
+ return ltmplConfig;
485
+ }
486
+ };
487
+
409
488
  export default TmplConfigAnalysis;
@@ -3,7 +3,6 @@ import {DataNode} from "antd/es/tree";
3
3
  import {HydrocarbonService} from "../index";
4
4
  import {DtmplData, LtmplConfig, LtmplConfigRes, TtmplConfig} from "../tmpl/interface";
5
5
  import HCDataSource from "../tmpl/hc-data-source";
6
- import {array} from "prop-types";
7
6
 
8
7
  export interface TtmplNodeConfig extends TtmplConfig{
9
8
  leafTitleId?:string,