aldehyde 0.2.278 → 0.2.281

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 (31) hide show
  1. package/lib/controls/tree-select/tree-entity-select.d.ts.map +1 -1
  2. package/lib/controls/tree-select/tree-entity-select.js +23 -13
  3. package/lib/controls/tree-select/tree-entity-select.js.map +1 -1
  4. package/lib/lowcode-components/assets/china.json +99420 -0
  5. package/lib/lowcode-components/base-map/index.d.ts +22 -0
  6. package/lib/lowcode-components/base-map/index.d.ts.map +1 -0
  7. package/lib/lowcode-components/base-map/index.js +85 -0
  8. package/lib/lowcode-components/base-map/index.js.map +1 -0
  9. package/lib/lowcode-components/lowcode-view/component/assets.d.ts.map +1 -1
  10. package/lib/lowcode-components/lowcode-view/component/assets.js +8 -0
  11. package/lib/lowcode-components/lowcode-view/component/assets.js.map +1 -1
  12. package/lib/module/block-menu-tree-drawer.d.ts.map +1 -1
  13. package/lib/module/block-menu-tree-drawer.js +1 -1
  14. package/lib/module/block-menu-tree-drawer.js.map +1 -1
  15. package/lib/module/dtmpl-view-modal.js.map +1 -1
  16. package/lib/table/act-table.d.ts.map +1 -1
  17. package/lib/table/act-table.js +1 -2
  18. package/lib/table/act-table.js.map +1 -1
  19. package/lib/tree/block-menu-auth-tree.d.ts +13 -0
  20. package/lib/tree/block-menu-auth-tree.d.ts.map +1 -1
  21. package/lib/tree/block-menu-auth-tree.js +9 -7
  22. package/lib/tree/block-menu-auth-tree.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/aldehyde/controls/tree-select/tree-entity-select.tsx +13 -6
  25. package/src/aldehyde/lowcode-components/assets/china.json +99420 -0
  26. package/src/aldehyde/lowcode-components/base-map/index.tsx +108 -0
  27. package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +8 -0
  28. package/src/aldehyde/module/block-menu-tree-drawer.tsx +1 -3
  29. package/src/aldehyde/module/dtmpl-view-modal.tsx +1 -1
  30. package/src/aldehyde/table/act-table.tsx +4 -5
  31. package/src/aldehyde/tree/block-menu-auth-tree.tsx +9 -7
@@ -0,0 +1,108 @@
1
+ import * as echarts from 'echarts';
2
+ import React, { useEffect, useRef, useState, ForwardedRef, forwardRef, useImperativeHandle } from 'react';
3
+ import _ from 'lodash';
4
+ import chinaJson from "../assets/china.json";
5
+
6
+ const defOption = {
7
+ tooltip: {
8
+ trigger: 'item',
9
+ },
10
+ geo: {
11
+ show: true,
12
+ map: 'china',
13
+ roam: true,
14
+ zoom: 1,
15
+ label: {
16
+ normal: { show: false },
17
+ emphasis: { show: false }
18
+ },
19
+ itemStyle: {
20
+ normal: {
21
+ areaColor: '#031525',
22
+ borderColor: '#076ba1'
23
+ },
24
+ emphasis: {
25
+ areaColor: '#2B91B7'
26
+ }
27
+ },
28
+ select: {}
29
+ },
30
+ series: [
31
+ {
32
+ type: 'map',
33
+ coordinateSystem: 'geo',
34
+ map: 'china',
35
+ geoIndex: 0,
36
+ aspectScale: 0.75, //长宽比
37
+ data: []
38
+ }
39
+ ]
40
+ };
41
+
42
+
43
+ export interface ChartComponentStyle {
44
+ tooltip?: { show: boolean };
45
+ geo?: { [key: string]: any };
46
+ }
47
+
48
+ export interface ChartComponentProps {
49
+ style?: ChartComponentStyle;
50
+ base: { width: number, height: number }
51
+ }
52
+
53
+ export interface BaseTextComponentRef {
54
+ updateConfig: (newConfig: ChartComponentProps) => void;
55
+ }
56
+
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 }>()
60
+ const chartRef = useRef<HTMLDivElement>(null);
61
+ const chart = useRef<any>(null);
62
+
63
+ useImperativeHandle(ref, () => ({
64
+ updateConfig: (newConfig) => {
65
+ const { base, style } = newConfig;
66
+ setConfig({ ...(style || {}) });
67
+ setSize({ width: base.width, height: base.height });
68
+ },
69
+ }));
70
+
71
+ // 窗口大小变化时重新调整图表大小
72
+ const handleResize = () => {
73
+ chart.current.resize({ animation: { duration: 500 } });
74
+ };
75
+
76
+ useEffect(() => {
77
+ echarts.registerMap('china', chinaJson as any);
78
+ chart.current = echarts.init(chartRef.current, null, { renderer: 'svg' });
79
+ window.addEventListener('resize', handleResize);
80
+ return () => {
81
+ window.removeEventListener('resize', handleResize);
82
+ chart.current.dispose();
83
+ }
84
+ }, []);
85
+
86
+ const renderChart = () => {
87
+ const { tooltip, geo } = config
88
+ const option = _.cloneDeep(defOption);
89
+ option.tooltip = { trigger: "item", ...tooltip };
90
+ option.geo = { ...option.geo, ...geo, ...geo.normal };
91
+ chart.current.setOption(option, true);
92
+ }
93
+ useEffect(() => {
94
+ if (config) {
95
+ renderChart();
96
+ }
97
+ }, [config]);
98
+
99
+ useEffect(() => {
100
+ if (size) {
101
+ handleResize();
102
+ }
103
+ }, [size]);
104
+
105
+ return <div ref={chartRef} style={{ width: '100%', height: '100%' }} />;
106
+ });
107
+
108
+ export default Index;
@@ -12,6 +12,7 @@ import PieChart from "../../pie-chart";
12
12
  import GaugeChart from "../../gauge-chart";
13
13
  import LiquidChart from "../../liquid-chart";
14
14
  import DataNumber from "../../data-number";
15
+ import BaseMap from "../../base-map";
15
16
 
16
17
  interface ComponentItemConfig {
17
18
  baseInfo: BaseInfoType, // 基础信息
@@ -117,5 +118,12 @@ export const compsConfig: { [key: string]: ComponentItemConfig } = {
117
118
  compName: "数值",
118
119
  compKey: "DataNumber"
119
120
  }
121
+ },
122
+ BaseMap: {
123
+ componentNode: BaseMap,
124
+ baseInfo: {
125
+ compName: "基础地图",
126
+ compKey: "BaseMap"
127
+ }
120
128
  }
121
129
  };
@@ -94,7 +94,7 @@ export default class BlockMenuTreeDrawer extends React.PureComponent<BlockMenuTr
94
94
  // onOk={()=>this.saveAuth}
95
95
  open={open}
96
96
  width={width}
97
- extra={[<Button type={'primary'} onClick={this.saveAuth} >保存</Button>]}
97
+ extra={[<Button type={'primary'} onClick={this.saveAuth} >{translate("${保存}")}</Button>]}
98
98
  style={{
99
99
  maxWidth: '92vw',
100
100
  }}
@@ -103,9 +103,7 @@ export default class BlockMenuTreeDrawer extends React.PureComponent<BlockMenuTr
103
103
  // }
104
104
  >
105
105
  <BlockMenuTree checks={this.state.selectedAuths} onChange={(auths)=>{
106
-
107
106
  this.setState({
108
-
109
107
  selectedAuths:auths
110
108
  })
111
109
  }}></BlockMenuTree>
@@ -48,7 +48,7 @@ class DtmplViewModal extends React.PureComponent<DtmplViewModalProps, DtmplViewM
48
48
  <Scrollbars autoHide autoHideTimeout={1000}>
49
49
  <DtmplViewCard codeSource={codeSource} serverKey={serverKey} sourceId={sourceId} code={code}></DtmplViewCard>
50
50
  </Scrollbars>
51
- </DraggableModal>
51
+ </DraggableModal>
52
52
  }
53
53
  }
54
54
 
@@ -714,10 +714,10 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
714
714
  <Tooltip title={translate("${" + title + "}")}>
715
715
  <Button
716
716
  style={{
717
- marginLeft: "5px",
718
- }} //为了点击到没有导出模块,使组件不致销毁,丢失导出数据
719
- >
720
- {type == "ltmpl-data-excel" ? <ExportOutlined /> : title}
717
+ // marginLeft: "5px",
718
+ }}
719
+ //为了点击到没有导出模块,使组件不致销毁,丢失导出数据
720
+ >{type == "ltmpl-data-excel"?<ExportOutlined />:title}
721
721
  </Button>
722
722
  </Tooltip>
723
723
  </Popover>
@@ -849,7 +849,6 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
849
849
  )}
850
850
  {buttons.includes("importLtmplExcel") && !readOnly ? (
851
851
  <Tooltip title={translate("${导入}")}>
852
- {" "}
853
852
  <Button
854
853
  href={`#${
855
854
  localStorage.getItem("version") === "v2" ? "/v2" : ""
@@ -3,7 +3,7 @@ import {Card, Col, Row, Tree,Space} from 'antd';
3
3
  import './index.css'
4
4
  import HCserviceV3 from "../tmpl/hcservice-v3";
5
5
  import {BlockMenu, Level2Menu, ProgramAuth} from "../tmpl/interface";
6
- // import type {TreeDataNode, TreeProps} from 'antd';
6
+ import { LocaleContext } from "../locale/LocaleProvider";
7
7
  import {DeleteOutlined, KeyOutlined, LockOutlined, PlusOutlined, RedoOutlined, UnlockOutlined} from '@ant-design/icons'
8
8
  interface BlockMenuAuthTreeProps {
9
9
  checks: string[],
@@ -28,6 +28,10 @@ class BlockMenuAuthTree extends React.PureComponent<BlockMenuAuthTreeProps, Bloc
28
28
  treekeyAuthId= {};
29
29
  authIdtreekeys={};
30
30
 
31
+ static contextType = LocaleContext;
32
+ context: React.ContextType<typeof LocaleContext>;
33
+
34
+
31
35
  state = {
32
36
  treeData: undefined,
33
37
  loading: false,
@@ -139,14 +143,14 @@ class BlockMenuAuthTree extends React.PureComponent<BlockMenuAuthTreeProps, Bloc
139
143
  }
140
144
 
141
145
  renderTitle = (nodeData) => {
142
- return <Card bordered={false} style={{width:'100%',minWidth:'180px',marginBottom:2}} bodyStyle={{padding:'2px'}} >
146
+ const { translate } = this.context;
147
+ return <Card variant={"borderless"} style={{width:'100%',minWidth:'180px',marginBottom:2}} styles={{body:{padding:'2px'}}} >
143
148
  <Row>
144
149
  <Col span={24}>
145
150
  <Space>
146
151
  {nodeData["isLeaf"]?<KeyOutlined rotate={180} style={{color: '#f5222d', marginRight: '4px'}}/>:null}
147
- {nodeData.title}
152
+ {translate("${" + nodeData.title + "}")}
148
153
  </Space>
149
-
150
154
  </Col>
151
155
  </Row>
152
156
  </Card>
@@ -170,14 +174,12 @@ class BlockMenuAuthTree extends React.PureComponent<BlockMenuAuthTreeProps, Bloc
170
174
  <Tree
171
175
  checkable={true}
172
176
  defaultExpandAll={true}
173
- //defaultCheckedKeys={defaultCheckedKeys}
174
177
  checkedKeys={checkedKeys}
175
-
176
178
  showLine={{showLeafIcon: false}}
177
179
  selectable={false}
178
180
  onCheck={(checkedKeys)=>this.onCheck(checkedKeys)}
179
181
  titleRender={(nodeData) => {
180
- return this.renderTitle(nodeData)
182
+ return <span title={""}> {this.renderTitle(nodeData)}</span>
181
183
  }}
182
184
  treeData={treeData}
183
185
  />