aldehyde 0.2.283 → 0.2.285

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 (203) hide show
  1. package/lib/controls/entity-select/entity-select.d.ts +2 -2
  2. package/lib/controls/entity-select/entity-select.d.ts.map +1 -1
  3. package/lib/controls/entity-select/entity-select.js +14 -12
  4. package/lib/controls/entity-select/entity-select.js.map +1 -1
  5. package/lib/controls/entry-control.d.ts.map +1 -1
  6. package/lib/controls/entry-control.js +4 -0
  7. package/lib/controls/entry-control.js.map +1 -1
  8. package/lib/controls/select/index.d.ts.map +1 -1
  9. package/lib/controls/select/index.js +1 -0
  10. package/lib/controls/select/index.js.map +1 -1
  11. package/lib/controls/view-control.d.ts.map +1 -1
  12. package/lib/controls/view-control.js +1 -0
  13. package/lib/controls/view-control.js.map +1 -1
  14. package/lib/detail/view/act-dtmpl-view.d.ts.map +1 -1
  15. package/lib/detail/view/act-dtmpl-view.js +3 -2
  16. package/lib/detail/view/act-dtmpl-view.js.map +1 -1
  17. package/lib/detail/view/dtmpl-view.js +1 -1
  18. package/lib/detail/view/dtmpl-view.js.map +1 -1
  19. package/lib/form/form-Item-group.d.ts.map +1 -1
  20. package/lib/form/form-Item-group.js +0 -1
  21. package/lib/form/form-Item-group.js.map +1 -1
  22. package/lib/lowcode-components/bar-chart/index.d.ts +10 -6
  23. package/lib/lowcode-components/bar-chart/index.d.ts.map +1 -1
  24. package/lib/lowcode-components/bar-chart/index.js +91 -11
  25. package/lib/lowcode-components/bar-chart/index.js.map +1 -1
  26. package/lib/lowcode-components/base-map/index.d.ts +10 -6
  27. package/lib/lowcode-components/base-map/index.d.ts.map +1 -1
  28. package/lib/lowcode-components/base-map/index.js +86 -7
  29. package/lib/lowcode-components/base-map/index.js.map +1 -1
  30. package/lib/lowcode-components/base-table/index.d.ts +53 -0
  31. package/lib/lowcode-components/base-table/index.d.ts.map +1 -0
  32. package/lib/lowcode-components/base-table/index.js +158 -0
  33. package/lib/lowcode-components/base-table/index.js.map +1 -0
  34. package/lib/lowcode-components/base-table/index.less +59 -0
  35. package/lib/lowcode-components/capsule-bar-chart/index.d.ts +43 -0
  36. package/lib/lowcode-components/capsule-bar-chart/index.d.ts.map +1 -0
  37. package/lib/lowcode-components/capsule-bar-chart/index.js +179 -0
  38. package/lib/lowcode-components/capsule-bar-chart/index.js.map +1 -0
  39. package/lib/lowcode-components/circular-progress-chart/index.d.ts +26 -0
  40. package/lib/lowcode-components/circular-progress-chart/index.d.ts.map +1 -0
  41. package/lib/lowcode-components/circular-progress-chart/index.js +179 -0
  42. package/lib/lowcode-components/circular-progress-chart/index.js.map +1 -0
  43. package/lib/lowcode-components/column-chart/index.d.ts +11 -6
  44. package/lib/lowcode-components/column-chart/index.d.ts.map +1 -1
  45. package/lib/lowcode-components/column-chart/index.js +115 -16
  46. package/lib/lowcode-components/column-chart/index.js.map +1 -1
  47. package/lib/lowcode-components/data-number/index.d.ts +10 -0
  48. package/lib/lowcode-components/data-number/index.d.ts.map +1 -1
  49. package/lib/lowcode-components/data-number/index.js +80 -6
  50. package/lib/lowcode-components/data-number/index.js.map +1 -1
  51. package/lib/lowcode-components/decoration/decoration1/index.d.ts +19 -0
  52. package/lib/lowcode-components/decoration/decoration1/index.d.ts.map +1 -0
  53. package/lib/lowcode-components/decoration/decoration1/index.js +58 -0
  54. package/lib/lowcode-components/decoration/decoration1/index.js.map +1 -0
  55. package/lib/lowcode-components/decoration/decoration1/index.less +8 -0
  56. package/lib/lowcode-components/decoration/decoration10/index.d.ts +20 -0
  57. package/lib/lowcode-components/decoration/decoration10/index.d.ts.map +1 -0
  58. package/lib/lowcode-components/decoration/decoration10/index.js +29 -0
  59. package/lib/lowcode-components/decoration/decoration10/index.js.map +1 -0
  60. package/lib/lowcode-components/decoration/decoration10/index.less +6 -0
  61. package/lib/lowcode-components/decoration/decoration11/index.d.ts +20 -0
  62. package/lib/lowcode-components/decoration/decoration11/index.d.ts.map +1 -0
  63. package/lib/lowcode-components/decoration/decoration11/index.js +81 -0
  64. package/lib/lowcode-components/decoration/decoration11/index.js.map +1 -0
  65. package/lib/lowcode-components/decoration/decoration11/index.less +6 -0
  66. package/lib/lowcode-components/decoration/decoration2/index.d.ts +19 -0
  67. package/lib/lowcode-components/decoration/decoration2/index.d.ts.map +1 -0
  68. package/lib/lowcode-components/decoration/decoration2/index.js +23 -0
  69. package/lib/lowcode-components/decoration/decoration2/index.js.map +1 -0
  70. package/lib/lowcode-components/decoration/decoration2/index.less +7 -0
  71. package/lib/lowcode-components/decoration/decoration3/index.d.ts +19 -0
  72. package/lib/lowcode-components/decoration/decoration3/index.d.ts.map +1 -0
  73. package/lib/lowcode-components/decoration/decoration3/index.js +39 -0
  74. package/lib/lowcode-components/decoration/decoration3/index.js.map +1 -0
  75. package/lib/lowcode-components/decoration/decoration3/index.less +8 -0
  76. package/lib/lowcode-components/decoration/decoration4/index.d.ts +19 -0
  77. package/lib/lowcode-components/decoration/decoration4/index.d.ts.map +1 -0
  78. package/lib/lowcode-components/decoration/decoration4/index.js +20 -0
  79. package/lib/lowcode-components/decoration/decoration4/index.js.map +1 -0
  80. package/lib/lowcode-components/decoration/decoration4/index.less +30 -0
  81. package/lib/lowcode-components/decoration/decoration5/index.d.ts +19 -0
  82. package/lib/lowcode-components/decoration/decoration5/index.d.ts.map +1 -0
  83. package/lib/lowcode-components/decoration/decoration5/index.js +56 -0
  84. package/lib/lowcode-components/decoration/decoration5/index.js.map +1 -0
  85. package/lib/lowcode-components/decoration/decoration5/index.less +4 -0
  86. package/lib/lowcode-components/decoration/decoration6/index.d.ts +19 -0
  87. package/lib/lowcode-components/decoration/decoration6/index.d.ts.map +1 -0
  88. package/lib/lowcode-components/decoration/decoration6/index.js +55 -0
  89. package/lib/lowcode-components/decoration/decoration6/index.js.map +1 -0
  90. package/lib/lowcode-components/decoration/decoration6/index.less +8 -0
  91. package/lib/lowcode-components/decoration/decoration7/index.d.ts +20 -0
  92. package/lib/lowcode-components/decoration/decoration7/index.d.ts.map +1 -0
  93. package/lib/lowcode-components/decoration/decoration7/index.js +28 -0
  94. package/lib/lowcode-components/decoration/decoration7/index.js.map +1 -0
  95. package/lib/lowcode-components/decoration/decoration7/index.less +5 -0
  96. package/lib/lowcode-components/decoration/decoration8/index.d.ts +20 -0
  97. package/lib/lowcode-components/decoration/decoration8/index.d.ts.map +1 -0
  98. package/lib/lowcode-components/decoration/decoration8/index.js +31 -0
  99. package/lib/lowcode-components/decoration/decoration8/index.js.map +1 -0
  100. package/lib/lowcode-components/decoration/decoration8/index.less +15 -0
  101. package/lib/lowcode-components/decoration/decoration9/index.d.ts +20 -0
  102. package/lib/lowcode-components/decoration/decoration9/index.d.ts.map +1 -0
  103. package/lib/lowcode-components/decoration/decoration9/index.js +52 -0
  104. package/lib/lowcode-components/decoration/decoration9/index.js.map +1 -0
  105. package/lib/lowcode-components/decoration/decoration9/index.less +5 -0
  106. package/lib/lowcode-components/effectScatter-map/index.d.ts +10 -6
  107. package/lib/lowcode-components/effectScatter-map/index.d.ts.map +1 -1
  108. package/lib/lowcode-components/effectScatter-map/index.js +87 -9
  109. package/lib/lowcode-components/effectScatter-map/index.js.map +1 -1
  110. package/lib/lowcode-components/gauge-chart/index.d.ts +10 -6
  111. package/lib/lowcode-components/gauge-chart/index.d.ts.map +1 -1
  112. package/lib/lowcode-components/gauge-chart/index.js +65 -8
  113. package/lib/lowcode-components/gauge-chart/index.js.map +1 -1
  114. package/lib/lowcode-components/index.d.ts +30 -0
  115. package/lib/lowcode-components/index.d.ts.map +1 -1
  116. package/lib/lowcode-components/index.js +25 -28
  117. package/lib/lowcode-components/index.js.map +1 -1
  118. package/lib/lowcode-components/line-chart/index.d.ts +10 -6
  119. package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
  120. package/lib/lowcode-components/line-chart/index.js +91 -11
  121. package/lib/lowcode-components/line-chart/index.js.map +1 -1
  122. package/lib/lowcode-components/liquid-chart/index.d.ts +10 -6
  123. package/lib/lowcode-components/liquid-chart/index.d.ts.map +1 -1
  124. package/lib/lowcode-components/liquid-chart/index.js +64 -7
  125. package/lib/lowcode-components/liquid-chart/index.js.map +1 -1
  126. package/lib/lowcode-components/lowcode-view/component/assets.d.ts.map +1 -1
  127. package/lib/lowcode-components/lowcode-view/component/assets.js +134 -0
  128. package/lib/lowcode-components/lowcode-view/component/assets.js.map +1 -1
  129. package/lib/lowcode-components/lowcode-view/component/component-container.d.ts.map +1 -1
  130. package/lib/lowcode-components/lowcode-view/component/component-container.js +30 -29
  131. package/lib/lowcode-components/lowcode-view/component/component-container.js.map +1 -1
  132. package/lib/lowcode-components/pie-chart/index.d.ts +11 -6
  133. package/lib/lowcode-components/pie-chart/index.d.ts.map +1 -1
  134. package/lib/lowcode-components/pie-chart/index.js +102 -15
  135. package/lib/lowcode-components/pie-chart/index.js.map +1 -1
  136. package/lib/lowcode-components/text-scroller/index.d.ts +23 -0
  137. package/lib/lowcode-components/text-scroller/index.d.ts.map +1 -0
  138. package/lib/lowcode-components/text-scroller/index.js +96 -0
  139. package/lib/lowcode-components/text-scroller/index.js.map +1 -0
  140. package/lib/lowcode-components/text-scroller/index.less +29 -0
  141. package/lib/table/act-table.d.ts.map +1 -1
  142. package/lib/table/act-table.js.map +1 -1
  143. package/lib/table/query-table.js +5 -5
  144. package/lib/table/query-table.js.map +1 -1
  145. package/lib/table/relation-table.d.ts.map +1 -1
  146. package/lib/table/relation-table.js +0 -2
  147. package/lib/table/relation-table.js.map +1 -1
  148. package/lib/tmpl/control-type-supportor.d.ts.map +1 -1
  149. package/lib/tmpl/control-type-supportor.js +1 -0
  150. package/lib/tmpl/control-type-supportor.js.map +1 -1
  151. package/package.json +1 -1
  152. package/src/aldehyde/controls/entity-select/entity-select.tsx +15 -15
  153. package/src/aldehyde/controls/entry-control.tsx +12 -0
  154. package/src/aldehyde/controls/select/index.tsx +1 -0
  155. package/src/aldehyde/controls/view-control.tsx +1 -0
  156. package/src/aldehyde/detail/view/act-dtmpl-view.tsx +22 -23
  157. package/src/aldehyde/detail/view/dtmpl-view.tsx +1 -1
  158. package/src/aldehyde/form/form-Item-group.tsx +0 -1
  159. package/src/aldehyde/lowcode-components/bar-chart/index.tsx +100 -19
  160. package/src/aldehyde/lowcode-components/base-map/index.tsx +94 -15
  161. package/src/aldehyde/lowcode-components/base-table/index.less +59 -0
  162. package/src/aldehyde/lowcode-components/base-table/index.tsx +233 -0
  163. package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +219 -0
  164. package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +201 -0
  165. package/src/aldehyde/lowcode-components/column-chart/index.tsx +128 -24
  166. package/src/aldehyde/lowcode-components/data-number/index.tsx +89 -7
  167. package/src/aldehyde/lowcode-components/data.d.ts +6 -0
  168. package/src/aldehyde/lowcode-components/decoration/decoration1/index.less +8 -0
  169. package/src/aldehyde/lowcode-components/decoration/decoration1/index.tsx +153 -0
  170. package/src/aldehyde/lowcode-components/decoration/decoration10/index.less +6 -0
  171. package/src/aldehyde/lowcode-components/decoration/decoration10/index.tsx +89 -0
  172. package/src/aldehyde/lowcode-components/decoration/decoration11/index.less +6 -0
  173. package/src/aldehyde/lowcode-components/decoration/decoration11/index.tsx +133 -0
  174. package/src/aldehyde/lowcode-components/decoration/decoration2/index.less +7 -0
  175. package/src/aldehyde/lowcode-components/decoration/decoration2/index.tsx +61 -0
  176. package/src/aldehyde/lowcode-components/decoration/decoration3/index.less +8 -0
  177. package/src/aldehyde/lowcode-components/decoration/decoration3/index.tsx +87 -0
  178. package/src/aldehyde/lowcode-components/decoration/decoration4/index.less +30 -0
  179. package/src/aldehyde/lowcode-components/decoration/decoration4/index.tsx +53 -0
  180. package/src/aldehyde/lowcode-components/decoration/decoration5/index.less +4 -0
  181. package/src/aldehyde/lowcode-components/decoration/decoration5/index.tsx +116 -0
  182. package/src/aldehyde/lowcode-components/decoration/decoration6/index.less +8 -0
  183. package/src/aldehyde/lowcode-components/decoration/decoration6/index.tsx +121 -0
  184. package/src/aldehyde/lowcode-components/decoration/decoration7/index.less +5 -0
  185. package/src/aldehyde/lowcode-components/decoration/decoration7/index.tsx +70 -0
  186. package/src/aldehyde/lowcode-components/decoration/decoration8/index.less +15 -0
  187. package/src/aldehyde/lowcode-components/decoration/decoration8/index.tsx +122 -0
  188. package/src/aldehyde/lowcode-components/decoration/decoration9/index.less +5 -0
  189. package/src/aldehyde/lowcode-components/decoration/decoration9/index.tsx +196 -0
  190. package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +93 -19
  191. package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +73 -16
  192. package/src/aldehyde/lowcode-components/index.ts +40 -29
  193. package/src/aldehyde/lowcode-components/line-chart/index.tsx +105 -22
  194. package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +70 -15
  195. package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +134 -0
  196. package/src/aldehyde/lowcode-components/lowcode-view/component/component-container.tsx +29 -28
  197. package/src/aldehyde/lowcode-components/pie-chart/index.tsx +111 -25
  198. package/src/aldehyde/lowcode-components/text-scroller/index.less +29 -0
  199. package/src/aldehyde/lowcode-components/text-scroller/index.tsx +122 -0
  200. package/src/aldehyde/table/act-table.tsx +0 -1
  201. package/src/aldehyde/table/query-table.tsx +5 -5
  202. package/src/aldehyde/table/relation-table.tsx +0 -2
  203. package/src/aldehyde/tmpl/control-type-supportor.tsx +1 -0
@@ -26,9 +26,6 @@ import DtmplCustomEditModalPage from "../../custom-page/dtmpl-custom-edit-modal-
26
26
  import { LtmplModal } from "../../index";
27
27
  import { LocaleContext } from "../../locale/LocaleProvider";
28
28
  import Rfield from "../rfield";
29
- import {maxBy} from "lodash";
30
- import {LegacyRef} from "react";
31
- import {sync} from "resolve";
32
29
 
33
30
  interface InnerEntitySelectProps extends EControlProps {
34
31
  maxSelected?: number;
@@ -65,8 +62,8 @@ type OptionCache = {
65
62
  };
66
63
 
67
64
  type LoadDataSource = {
68
- options: any[];
69
- touchEnd: boolean;
65
+ options?: any[];
66
+ touchEnd?: boolean;
70
67
  };
71
68
 
72
69
  export default class EntitySelect extends React.PureComponent<
@@ -112,15 +109,12 @@ export default class EntitySelect extends React.PureComponent<
112
109
  <>
113
110
  <Divider style={{ margin: "8px 0" }} />
114
111
  <Row justify={"end"}>
115
-
116
112
  <Col>
117
113
  <Space align={"end"}>
118
114
  {actions && actions.indexOf("table") >= 0 ? (
119
115
  <Button
120
- // type="text"
121
116
  icon={<TableOutlined style={{ color: "#0958d9" }} />}
122
117
  onClick={() => this.showTable()}
123
- // onClick={() => this.showTable()}
124
118
  ></Button>
125
119
  ) : null}
126
120
  {actions && actions.indexOf("add") >= 0 ? (
@@ -465,13 +459,16 @@ export default class EntitySelect extends React.PureComponent<
465
459
  );
466
460
 
467
461
  let sourceData = await this.loadData(queryKey.key, pageInfo, titleId);
468
- let expSourceData:LoadDataSource={...sourceData};
462
+ if(!sourceData){
463
+ sourceData={}
464
+ }
465
+ let expSourceData:LoadDataSource=sourceData?{...sourceData}:{};
469
466
 
470
- while(!expSourceData.touchEnd && sourceData.options?.length <10){
467
+ while(!expSourceData.touchEnd && sourceData?.options?.length <10){
471
468
  pageInfo={...pageInfo,pageNo:pageInfo.pageNo+1}
472
469
  expSourceData = await this.loadData(queryKey.key,pageInfo, titleId);
473
- sourceData.touchEnd=expSourceData.touchEnd;
474
- sourceData.options=[...sourceData.options,...expSourceData.options];
470
+ sourceData.touchEnd=expSourceData?.touchEnd;
471
+ sourceData.options=[...sourceData.options,...expSourceData?.options];
475
472
  }
476
473
 
477
474
  optionCache = {
@@ -573,8 +570,11 @@ export default class EntitySelect extends React.PureComponent<
573
570
  );
574
571
  let titles=[];
575
572
  let options: object[] = [];
576
- pageInfo = queryData.pageInfo;
577
- if(queryData.entities){
573
+ if(!queryData){
574
+ return;
575
+ }
576
+ pageInfo = queryData?.pageInfo;
577
+ if(queryData?.entities){
578
578
  queryData.entities.forEach((item, index) => {
579
579
  let title = item.fieldMap[titleId];
580
580
  //放入全局对象缓存
@@ -605,7 +605,7 @@ export default class EntitySelect extends React.PureComponent<
605
605
  });
606
606
  }
607
607
 
608
- return { options, touchEnd: queryData.touchEnd };
608
+ return { options, touchEnd: queryData?.touchEnd };
609
609
  };
610
610
 
611
611
  debounceFetcher = () => {
@@ -22,6 +22,7 @@ import TreeEntitySelect from "./tree-select/tree-entity-select";
22
22
  import FileView from "./file-view";
23
23
  import MultiFileUpload from "./upload/mult-file-upload";
24
24
  import NavigationTree from "./tree-select/navigation-tree";
25
+ import EllipsisText from "./text/ellipsis-text";
25
26
 
26
27
  // const CheckboxGroup = Checkbox.Group;
27
28
  const RadioGroup = Radio.Group;
@@ -372,6 +373,17 @@ function renderControl(
372
373
  case "field-history": //
373
374
  entryControl = <FieldHistory {...controlProps} ></FieldHistory>;
374
375
  break;
376
+ case "text-view":
377
+ entryControl = (
378
+ <EllipsisText
379
+ isHtml={false}
380
+ value={fieldValue}
381
+ showMax={
382
+ fieldConfig.ellipsisLength ? fieldConfig.ellipsisLength : 28
383
+ }
384
+ ></EllipsisText>
385
+ );
386
+ break;
375
387
  default:
376
388
  entryControl = unSupportControl;
377
389
  break;
@@ -180,6 +180,7 @@ export default class Select extends React.PureComponent<
180
180
  );
181
181
  break;
182
182
  case "radio":
183
+ debugger
183
184
  entryControl = (
184
185
  <RadioGroup
185
186
  {...antdControlProps}
@@ -143,6 +143,7 @@ function renderControl(
143
143
  break;
144
144
  case "text":
145
145
  case "textarea":
146
+ case "text-view":
146
147
  case "preselect":
147
148
  if (holderType == "table") {
148
149
  viewControl = (
@@ -1,11 +1,7 @@
1
1
  import React from "react";
2
2
  import {Button, Card, Form as AntdForm, FormInstance, message, Tooltip} from "antd";
3
- import {DtmplBaseProps, DtmplConfig, DtmplData, FieldConfig} from "../../tmpl/interface";
4
- import {
5
- ReloadOutlined,
6
- ScheduleOutlined,
7
- EditOutlined,
8
- } from "@ant-design/icons";
3
+ import {DtmplBaseProps, DtmplConfig, DtmplData} from "../../tmpl/interface";
4
+ import {EditOutlined, ReloadOutlined, ScheduleOutlined,} from "@ant-design/icons";
9
5
  import HCDataSource from "../../tmpl/hc-data-source";
10
6
  import "../dtmpl.css";
11
7
  import SnapshotTimeline from "./snapshot-timeline";
@@ -30,7 +26,7 @@ export interface ActDtmplViewStat {
30
26
  snapshotOpen?: boolean;
31
27
  layout?: object;
32
28
  refreshCode?: string;
33
- actionDtmplData?:DtmplData;
29
+ actionDtmplData?: DtmplData;
34
30
  }
35
31
 
36
32
  class ActDtmplView extends React.PureComponent<
@@ -56,11 +52,11 @@ class ActDtmplView extends React.PureComponent<
56
52
  wrapperCol: {span: 16},
57
53
  },
58
54
  refreshCode: undefined,
59
- actionDtmplData:undefined,
55
+ actionDtmplData: undefined,
60
56
  };
61
57
 
62
58
  async componentDidMount() {
63
- const {sourceId,code, serverKey} = this.props;
59
+ const {sourceId, code, serverKey} = this.props;
64
60
  let dtmplConfig = await HCDataSource.requestViewDtmplConfig(
65
61
  serverKey,
66
62
  sourceId
@@ -73,14 +69,14 @@ class ActDtmplView extends React.PureComponent<
73
69
  });
74
70
  }
75
71
 
76
- loadActionDtmplData = async (dtmplConfig:DtmplConfig) => {
77
- let actionDtmplData=undefined;
78
- const {sourceId,code, serverKey} = this.props;
79
- if(dtmplConfig?.viewActions && dtmplConfig?.viewActions.length>0){
72
+ loadActionDtmplData = async (dtmplConfig: DtmplConfig) => {
73
+ let actionDtmplData = undefined;
74
+ const {sourceId, code, serverKey} = this.props;
75
+ if (dtmplConfig?.viewActions && dtmplConfig?.viewActions.length > 0) {
80
76
  actionDtmplData = await HcserviceV3.requestViewDtmplData(
81
77
  serverKey,
82
78
  sourceId,
83
- code,null
79
+ code, null
84
80
  );
85
81
  }
86
82
  this.setState({
@@ -120,7 +116,7 @@ class ActDtmplView extends React.PureComponent<
120
116
  this.setState({
121
117
  loading: true,
122
118
  });
123
- const { sourceId, code, serverKey } = this.props;
119
+ const {sourceId, code, serverKey} = this.props;
124
120
  if (code) {
125
121
  //有code是修改,没有是新增实体模板
126
122
  values["唯一编码"] = code;
@@ -135,22 +131,22 @@ class ActDtmplView extends React.PureComponent<
135
131
  loading: false,
136
132
  });
137
133
  if (res.status === "success") {
138
- if(this.props.goBackToLtmpl){
134
+ if (this.props.goBackToLtmpl) {
139
135
  this.props.goBackToLtmpl();
140
- }else{
136
+ } else {
141
137
  this.doRefresh();
142
138
  }
143
139
  }
144
140
  };
145
141
 
146
142
  doSubmit = (actionId?: number, codes?: string[], params?: object) => {
147
- const { mainCode } = this.props;
143
+ const {mainCode} = this.props;
148
144
 
149
145
  //if (actionId) {
150
- this.formRef.current.setFieldsValue({ actionId: actionId });
146
+ this.formRef.current.setFieldsValue({actionId: actionId});
151
147
  // }
152
148
  if (mainCode) {
153
- this.formRef.current.setFieldsValue({ mainCode: mainCode });
149
+ this.formRef.current.setFieldsValue({mainCode: mainCode});
154
150
  }
155
151
  if (params) {
156
152
  this.formRef.current.setFieldsValue(params);
@@ -176,12 +172,15 @@ class ActDtmplView extends React.PureComponent<
176
172
  loading,
177
173
  layout,
178
174
  snapshotOpen,
179
- refreshCode,actionDtmplData,
175
+ refreshCode, actionDtmplData,
180
176
  } = this.state;
181
177
  const {translate} = this.context;
182
178
 
183
179
  const buttons = dtmplConfig ? dtmplConfig.buttons : undefined;
184
180
  const premises = dtmplConfig ? dtmplConfig.premises : undefined;
181
+
182
+ const detailTitle = title ? title : dtmplConfig && dtmplConfig.title ? dtmplConfig.title : "详情";
183
+
185
184
  let showRightNav_ = showRightNav;
186
185
  if (dtmplConfig && dtmplConfig.groups.length < 4) {
187
186
  showRightNav_ = false;
@@ -195,12 +194,12 @@ class ActDtmplView extends React.PureComponent<
195
194
  {showHeader ? (
196
195
  <Card
197
196
  variant={"borderless"}
198
- size={"small"}
197
+ size={"small"}
199
198
  key={"detailTitle"}
200
199
  className="hoverable pageHeader"
201
200
  >
202
201
  <h3>
203
- {translate("${" + (title ? title : "详情") + "}")}
202
+ {translate("${" + detailTitle + "}")}
204
203
  {dtmplConfig ? <ToolTipBar content={dtmplConfig.tip}/> : null}
205
204
  <div className="fr">
206
205
  {buttons &&
@@ -241,7 +241,7 @@ class DtmplView extends React.PureComponent<DtmplViewProps, DtmplViewStat> {
241
241
  key={item.id}
242
242
  id={id + item.id}
243
243
  className="hoverable"
244
- headStyle={{ background: "#f2f4f5" }}
244
+ styles={{header:{ background: "#f2f4f5" }}}
245
245
  loading={loading}
246
246
  >
247
247
  <FieldViewGroup column={maxColsOnRow} dataCode={dtmplData ? dtmplData.code:null}
@@ -85,7 +85,6 @@ export default class FormItemGroup extends React.PureComponent<
85
85
 
86
86
  let labelColSpan=24;
87
87
  let wrapperColSpan=24;
88
- debugger
89
88
  if(layout==="vertical"){
90
89
  labelColSpan=24;
91
90
  wrapperColSpan=24;
@@ -1,14 +1,21 @@
1
1
  import * as echarts from 'echarts';
2
2
  import React, { useEffect, useRef, useState, ForwardedRef, forwardRef, useImperativeHandle } from 'react';
3
- import lodash from 'lodash';
3
+ import _ from 'lodash';
4
+ import HydrocarbonService from "../../tmpl/hcservice-v3";
5
+ import { DataConfigProps } from "../data";
4
6
 
5
7
  const defOption = {
8
+ title: {
9
+ text: '暂无数据',
10
+ left: 'center',
11
+ top: 'middle',
12
+ show: false, // 无数据时显示
13
+ },
6
14
  tooltip: { trigger: "axis" },
7
15
  grid: { top: 30, let: 30, right: 20, bottom: 30 },
8
16
  yAxis: {
9
17
  type: 'category',
10
18
  boundaryGap: true,
11
- data: ['1990', '1991', '1992', '1993', '1994', '1995', '1996'],
12
19
  },
13
20
  xAxis: {
14
21
  type: 'value',
@@ -18,7 +25,7 @@ const defOption = {
18
25
  barMaxWidth: 30,
19
26
  series: [
20
27
  {
21
- data: [525, 459, 357, 414, 234, 250, 156],
28
+ data: [[525, "1990"], [459, "1991"], [357, "1992"], [414, "1993"], [234, "1994"], [250, "1995"], [156, "1996"]],
22
29
  type: 'bar',
23
30
  }
24
31
  ]
@@ -35,7 +42,26 @@ const legends = {
35
42
  rightBottom: { right: 5, bottom: 0 },
36
43
  };
37
44
 
38
- export interface ChartComponentStyle {
45
+ // 处理数据格式
46
+ const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
47
+ if (!data?.length) {
48
+ return [];
49
+ }
50
+ const temData = data.map((r) => {
51
+ const { config, value } = r;
52
+ const vNames = Object.keys(config).filter((r) => r.startsWith("v")).sort((a, b) => parseInt(a.substring(1)) - parseInt(b.substring(1)));
53
+ return {
54
+ name: config.d1,
55
+ data: vNames.map((r) => ({
56
+ name: config[r],
57
+ data: value.map((v) => [v[r], v["d1"]]),
58
+ }))
59
+ };
60
+ });
61
+ return temData[0]?.data || [];
62
+ };
63
+
64
+ export interface ComponentStyle {
39
65
  tooltip?: { show: boolean };
40
66
  color?: string[];
41
67
  grid?: { top: number, let: number, right: number, bottom: number };
@@ -45,27 +71,42 @@ export interface ChartComponentStyle {
45
71
  barMaxWidth?: number;
46
72
  }
47
73
 
48
- export interface ChartComponentProps {
49
- style?: ChartComponentStyle;
50
- base: { width: number, height: number }
74
+ export interface ComponentProps {
75
+ style?: ComponentStyle;
76
+ base: { width: number, height: number },
77
+ data?: DataConfigProps;
78
+ isDesignMode?: boolean; // 是否编辑模式
51
79
  }
52
80
 
53
- export interface BaseTextComponentRef {
54
- updateConfig: (newConfig: ChartComponentProps) => void;
81
+ export interface ComponentRef {
82
+ updateConfig: (newConfig: ComponentProps) => void;
83
+ destroy: () => void;
55
84
  }
56
85
 
57
- const Index = forwardRef((props: ChartComponentProps, ref: ForwardedRef<BaseTextComponentRef>) => {
58
- const [config, setConfig] = useState<ChartComponentStyle>(props.style || {});
59
- const [size, setSize] = useState<{ width: number, height: number }>()
86
+ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>) => {
87
+ const { style, data: propsData, isDesignMode } = props;
88
+ const [config, setConfig] = useState<ComponentStyle>(style || {});
89
+ const [size, setSize] = useState<{ width: number, height: number }>();
90
+ const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
91
+ const [data, setData] = useState<{ name: string, data: any }[]>([]);
60
92
  const chartRef = useRef<HTMLDivElement>(null);
61
93
  const chart = useRef<any>(null);
94
+ const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
95
+
96
+ const handleDestroy = () => {
97
+ pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
98
+ window.removeEventListener('resize', handleResize);
99
+ chart.current.dispose();
100
+ };
62
101
 
63
102
  useImperativeHandle(ref, () => ({
64
103
  updateConfig: (newConfig) => {
65
- const { base, style } = newConfig;
66
- setConfig({ ...(style || {}) });
104
+ const { base, style: newStyle, data: newDataConfig } = newConfig;
105
+ setConfig({ ...(newStyle || {}) });
67
106
  setSize({ width: base.width, height: base.height });
107
+ setDataConfig(newDataConfig);
68
108
  },
109
+ destroy: handleDestroy,
69
110
  }));
70
111
 
71
112
  // 窗口大小变化时重新调整图表大小
@@ -77,21 +118,61 @@ const Index = forwardRef((props: ChartComponentProps, ref: ForwardedRef<BaseText
77
118
  chart.current = echarts.init(chartRef.current);
78
119
  window.addEventListener('resize', handleResize);
79
120
  return () => {
80
- window.removeEventListener('resize', handleResize);
81
- chart.current.dispose();
121
+ handleDestroy();
82
122
  }
83
123
  }, []);
84
124
 
125
+
126
+ // 请求数据
127
+ const getData = async () => {
128
+ const { entities: { config, value } } = await HydrocarbonService.requestMstrucLtmplQueryTop(null, dataConfig?.sourceId, null) || {};
129
+ const temData = handleData(value);
130
+ setData(temData);
131
+ return config;
132
+ };
133
+
134
+ // 初始化请求数据
135
+ const getInitData = async () => {
136
+ pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
137
+ const config = await getData();
138
+ if (config?.requestType === "polling") {
139
+ pollingIntervalRef.current = setInterval(() => { getData() }, config?.pollingInterval || 60000);
140
+ }
141
+ };
142
+
143
+ // 静态数据处理
144
+ useEffect(() => {
145
+ if (dataConfig?.sourceType === 'staticData') {
146
+ setData(handleData(dataConfig.staticData));
147
+ }
148
+ }, [dataConfig?.sourceType, dataConfig?.staticData]);
149
+
150
+ /**
151
+ * 数据源数据请求
152
+ * 1、编辑态不请求数据
153
+ */
154
+ useEffect(() => {
155
+ if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId) {
156
+ getInitData();
157
+ } else if (dataConfig?.sourceType === 'sourceId') {
158
+ setData([]);
159
+ }
160
+ }, [dataConfig?.sourceType, dataConfig?.sourceId]);
161
+
85
162
  const renderChart = () => {
86
163
  const { grid, barMaxWidth, legend, tooltip, color, xAxis, yAxis, } = config
87
- const option = lodash.cloneDeep(defOption);
164
+ const option = _.cloneDeep(defOption);
165
+ // 编辑态无数据显示默认数据
166
+ const temData = isDesignMode && !data?.length ? option.series : data;
88
167
  option.barMaxWidth = barMaxWidth;
89
168
  option.grid = grid;
90
169
  option.legend = { ...legend, ...legends[legend?.position] };
91
170
  option.tooltip = { trigger: "axis", ...tooltip };
92
171
  option.xAxis = { ...option.xAxis, ...xAxis, axisTick: { show: xAxis?.axisLine?.show } };
93
172
  option.yAxis = { ...option.yAxis, ...yAxis };
94
- option.series = option.series.map((r, index) => ({
173
+ option.title.show = !temData?.length;
174
+ option.series = temData.map((r, index) => ({
175
+ type: "bar",
95
176
  ...r,
96
177
  itemStyle: { color: color[index] },
97
178
  }));
@@ -101,7 +182,7 @@ const Index = forwardRef((props: ChartComponentProps, ref: ForwardedRef<BaseText
101
182
  if (config) {
102
183
  renderChart();
103
184
  }
104
- }, [config]);
185
+ }, [config, data]);
105
186
 
106
187
  useEffect(() => {
107
188
  if (size) {
@@ -2,10 +2,13 @@ import * as echarts from 'echarts';
2
2
  import React, { useEffect, useRef, useState, ForwardedRef, forwardRef, useImperativeHandle } from 'react';
3
3
  import _ from 'lodash';
4
4
  import chinaJson from "../assets/china.json";
5
+ import HydrocarbonService from "../../tmpl/hcservice-v3";
6
+ import { DataConfigProps } from "../data";
5
7
 
6
8
  const defOption = {
7
9
  tooltip: {
8
10
  trigger: 'item',
11
+ formatter: (val) => val.data
9
12
  },
10
13
  geo: {
11
14
  show: true,
@@ -39,33 +42,67 @@ const defOption = {
39
42
  ]
40
43
  };
41
44
 
45
+ // 处理数据格式
46
+ const handleData = (data: { config: { [key: string]: string }, value: { [key: string]: any }[] }[]) => {
47
+ if (!data?.length) {
48
+ return [];
49
+ }
50
+ const temData = data.map((r) => {
51
+ const { config, value } = r;
52
+ const vNames = Object.keys(config).filter((r) => r.startsWith("v")).sort((a, b) => parseInt(a.substring(1)) - parseInt(b.substring(1)));
53
+ return {
54
+ name: config.d1,
55
+ data: vNames.map((r) => ({
56
+ name: config[r],
57
+ value: value[0]?.[r],
58
+ }))
59
+ };
60
+ });
61
+ return temData[0]?.data || [];
62
+ };
63
+
42
64
 
43
- export interface ChartComponentStyle {
65
+ export interface ComponentStyle {
44
66
  tooltip?: { show: boolean };
45
67
  geo?: { [key: string]: any };
46
68
  }
47
69
 
48
- export interface ChartComponentProps {
49
- style?: ChartComponentStyle;
50
- base: { width: number, height: number }
70
+ export interface ComponentProps {
71
+ style?: ComponentStyle;
72
+ base: { width: number, height: number },
73
+ data?: DataConfigProps;
74
+ isDesignMode?: boolean; // 是否编辑模式
51
75
  }
52
76
 
53
- export interface BaseTextComponentRef {
54
- updateConfig: (newConfig: ChartComponentProps) => void;
77
+ export interface ComponentRef {
78
+ updateConfig: (newConfig: ComponentProps) => void;
79
+ destroy: () => void;
55
80
  }
56
81
 
57
- const Index = forwardRef((props: ChartComponentProps, ref: ForwardedRef<BaseTextComponentRef>) => {
58
- const [config, setConfig] = useState<ChartComponentStyle>(props.style || {});
59
- const [size, setSize] = useState<{ width: number, height: number }>()
82
+ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>) => {
83
+ const { style, data: propsData, isDesignMode } = props;
84
+ const [config, setConfig] = useState<ComponentStyle>(style || {});
85
+ const [size, setSize] = useState<{ width: number, height: number }>();
86
+ const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData }); // 数据源配置
87
+ const [data, setData] = useState<{ name: string, value: number[] }[]>([]);
60
88
  const chartRef = useRef<HTMLDivElement>(null);
61
89
  const chart = useRef<any>(null);
90
+ const pollingIntervalRef = useRef<number | NodeJS.Timeout>(null);
91
+
92
+ const handleDestroy = () => {
93
+ pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
94
+ window.removeEventListener('resize', handleResize);
95
+ chart.current.dispose();
96
+ };
62
97
 
63
98
  useImperativeHandle(ref, () => ({
64
99
  updateConfig: (newConfig) => {
65
- const { base, style } = newConfig;
66
- setConfig({ ...(style || {}) });
100
+ const { base, style: newStyle, data: newDataConfig } = newConfig;
101
+ setConfig({ ...(newStyle || {}) });
67
102
  setSize({ width: base.width, height: base.height });
103
+ setDataConfig(newDataConfig);
68
104
  },
105
+ destroy: handleDestroy,
69
106
  }));
70
107
 
71
108
  // 窗口大小变化时重新调整图表大小
@@ -78,23 +115,65 @@ const Index = forwardRef((props: ChartComponentProps, ref: ForwardedRef<BaseText
78
115
  chart.current = echarts.init(chartRef.current, null, { renderer: 'svg' });
79
116
  window.addEventListener('resize', handleResize);
80
117
  return () => {
81
- window.removeEventListener('resize', handleResize);
82
- chart.current.dispose();
118
+ handleDestroy();
83
119
  }
84
120
  }, []);
85
121
 
122
+ // 请求数据
123
+ const getData = async () => {
124
+ const { entities: { config, value } } = await HydrocarbonService.requestMstrucLtmplQueryTop(null, dataConfig?.sourceId, null) || {};
125
+ setData(handleData(value));
126
+ return config;
127
+ };
128
+
129
+ // 初始化请求数据
130
+ const getInitData = async () => {
131
+ pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
132
+ const config = await getData();
133
+ if (config?.requestType === "polling") {
134
+ pollingIntervalRef.current = setInterval(() => { getData() }, config?.pollingInterval || 60000);
135
+ }
136
+ };
137
+
138
+ // 静态数据处理
139
+ useEffect(() => {
140
+ if (dataConfig?.sourceType === 'staticData') {
141
+ setData(dataConfig.staticData || []);
142
+ }
143
+ }, [dataConfig?.sourceType, dataConfig?.staticData]);
144
+
145
+ /**
146
+ * 数据源数据请求
147
+ * 1、编辑态不请求数据
148
+ */
149
+ useEffect(() => {
150
+ if (!isDesignMode && dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId) {
151
+ getInitData();
152
+ } else if (dataConfig?.sourceType === 'sourceId') {
153
+ setData([]);
154
+ }
155
+ }, [dataConfig?.sourceType, dataConfig?.sourceId]);
156
+
86
157
  const renderChart = () => {
87
158
  const { tooltip, geo } = config
88
159
  const option = _.cloneDeep(defOption);
89
- option.tooltip = { trigger: "item", ...tooltip };
160
+ option.tooltip = {
161
+ trigger: "item",
162
+ formatter: (val) => {
163
+ const { data: { name, value } } = val || {};
164
+ return `${name}:${value || value == 0 ? value : "-"}`;
165
+ },
166
+ ...tooltip
167
+ };
90
168
  option.geo = { ...option.geo, ...geo, ...geo.normal };
169
+ option.series = option.series.map((item) => ({ ...item, data: data || [] }));
91
170
  chart.current.setOption(option, true);
92
171
  }
93
172
  useEffect(() => {
94
173
  if (config) {
95
174
  renderChart();
96
175
  }
97
- }, [config]);
176
+ }, [config, data]);
98
177
 
99
178
  useEffect(() => {
100
179
  if (size) {
@@ -0,0 +1,59 @@
1
+ .base-table {
2
+ width: 100%;
3
+ height: 100%;
4
+ overflow: hidden;
5
+
6
+ .base-table-empty {
7
+ width: 100%;
8
+ height: 100%;
9
+ display: flex;
10
+ justify-content: center;
11
+ align-items: center;
12
+ }
13
+
14
+ table {
15
+ width: 100%;
16
+ text-align: center;
17
+ table-layout: fixed;
18
+
19
+ thead {
20
+ position: relative;
21
+ z-index: 1;
22
+
23
+ th {
24
+ padding: 0 4px;
25
+ }
26
+ }
27
+
28
+
29
+ .scroll-body {
30
+ overflow: hidden;
31
+ animation: scroll 10s linear infinite;
32
+
33
+ td {
34
+ padding: 0 4px;
35
+ overflow: hidden;
36
+ white-space: nowrap;
37
+ text-overflow: ellipsis;
38
+ }
39
+ }
40
+ }
41
+
42
+ table:hover {
43
+ .scroll-body {
44
+ animation-play-state: paused !important;
45
+ }
46
+ }
47
+
48
+ }
49
+
50
+
51
+ @keyframes scroll {
52
+ 0% {
53
+ transform: translateY(0);
54
+ }
55
+
56
+ 100% {
57
+ transform: translateY(-100%);
58
+ }
59
+ }