aldehyde 0.2.220 → 0.2.221

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 (34) hide show
  1. package/lib/controls/action/index.d.ts.map +1 -1
  2. package/lib/controls/action/index.js +3 -5
  3. package/lib/controls/action/index.js.map +1 -1
  4. package/lib/list/vertical-list.d.ts +12 -0
  5. package/lib/list/vertical-list.d.ts.map +1 -0
  6. package/lib/list/vertical-list.js +60 -0
  7. package/lib/list/vertical-list.js.map +1 -0
  8. package/lib/table/act-table.js +1 -1
  9. package/lib/table/act-table.js.map +1 -1
  10. package/lib/table/column/column-builder.d.ts +1 -0
  11. package/lib/table/column/column-builder.d.ts.map +1 -1
  12. package/lib/table/column/column-builder.js +8 -5
  13. package/lib/table/column/column-builder.js.map +1 -1
  14. package/lib/table/query-table.d.ts +0 -1
  15. package/lib/table/query-table.d.ts.map +1 -1
  16. package/lib/table/query-table.js +5 -36
  17. package/lib/table/query-table.js.map +1 -1
  18. package/lib/table/relation-table.d.ts.map +1 -1
  19. package/lib/table/relation-table.js +9 -14
  20. package/lib/table/relation-table.js.map +1 -1
  21. package/lib/table/report-table.js +2 -2
  22. package/lib/table/report-table.js.map +1 -1
  23. package/lib/tmpl/interface.d.ts +5 -1
  24. package/lib/tmpl/interface.d.ts.map +1 -1
  25. package/lib/tmpl/interface.js.map +1 -1
  26. package/package.json +1 -1
  27. package/src/aldehyde/controls/action/index.tsx +3 -0
  28. package/src/aldehyde/list/vertical-list.tsx +101 -0
  29. package/src/aldehyde/table/act-table.tsx +1 -1
  30. package/src/aldehyde/table/column/column-builder.tsx +13 -14
  31. package/src/aldehyde/table/query-table.tsx +15 -57
  32. package/src/aldehyde/table/relation-table.tsx +12 -29
  33. package/src/aldehyde/table/report-table.tsx +2 -2
  34. package/src/aldehyde/tmpl/interface.tsx +5 -2
@@ -0,0 +1,101 @@
1
+ import React from "react";
2
+
3
+ import { useLocale } from "../locale/useLocale";
4
+ import {Card, Col, Descriptions, List, Row} from "antd";
5
+ import ViewControl from "../controls/view-control";
6
+ import {FieldConfig} from "../tmpl/interface";
7
+ type VerticalListProps = {
8
+ hiddenRowCodes?: string[];
9
+ dataSource?: object[];
10
+ columnConfigs?: FieldConfig[];
11
+ serverKey:string;
12
+ columns: any[];
13
+ };
14
+ const VerticalList = (props:VerticalListProps) => {
15
+
16
+ const { translate } = useLocale();
17
+ const initViewList = (data) => {
18
+
19
+ const { columnConfigs, serverKey } = props;
20
+ const formItemList = [];
21
+ if (columnConfigs.length > 0) {
22
+ columnConfigs.forEach((item, index) => {
23
+ if (item.id != "10000" && item.id != "20000" && item.title != "操作") {
24
+ const title = item.title;
25
+ let fieldValue = data ? data[item.id] : undefined;
26
+ if (title == "序号") {
27
+ fieldValue = data.index;
28
+ }
29
+ //fieldValue 没有值时不能为null 要为 undefined。antd input所限制
30
+ fieldValue = fieldValue
31
+ ? fieldValue
32
+ : item.defaultValue
33
+ ? item.defaultValue
34
+ : undefined;
35
+
36
+ const formItem = (
37
+ <Descriptions.Item
38
+ label={translate("${" + item.title + "}")}
39
+ key={index}
40
+ className="labelcss"
41
+ >
42
+ <ViewControl
43
+ serverKey={serverKey}
44
+ holderType={"table"}
45
+ value={fieldValue}
46
+ fieldConfig={item}
47
+ />
48
+ </Descriptions.Item>
49
+ );
50
+ formItemList.push(formItem);
51
+ }
52
+ });
53
+ }
54
+ return formItemList;
55
+ };
56
+
57
+ const renderOpt=(item: unknown)=> {
58
+ const { columns } = props;
59
+ let actionCol=null;
60
+
61
+ columns?.forEach(col=>{
62
+ if(col["操作"]==1) {
63
+ actionCol=col;
64
+ }
65
+ });
66
+
67
+ return actionCol?.render(item,item);
68
+ }
69
+
70
+ const getUnHidenDataSource = () => {
71
+ const { hiddenRowCodes,dataSource } = props;
72
+ let ds: object[] = [];
73
+ if (dataSource) {
74
+ for (let d of dataSource) {
75
+ if (!hiddenRowCodes?.includes(d['code'])) {
76
+ ds.push(d);
77
+ }
78
+ }
79
+ }
80
+ return ds;
81
+ };
82
+
83
+
84
+ return (<Card styles={{body:{padding: "2px"}}} style={{marginTop:"6px"}} >
85
+ <List split={false}
86
+ dataSource={getUnHidenDataSource()}
87
+ renderItem={(item) => (
88
+ <List.Item style={{padding: "6px"}} key={item["id"]} >
89
+ <Card size={"small"} styles={{body:{padding: "4px"}}} style={{margin:"1px"}} extra={renderOpt(item)}>
90
+ <Descriptions column={4}>
91
+ {initViewList(item)}
92
+ </Descriptions>
93
+ </Card>
94
+ </List.Item>
95
+ )}
96
+ />
97
+ </Card>
98
+ );
99
+ };
100
+
101
+ export default VerticalList;
@@ -1124,7 +1124,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
1124
1124
  <Table loading={loading}></Table>
1125
1125
  ) : (tableType =="report"?<ReportTable
1126
1126
  tableProps={{scrollY:ltmplConfig.scrollY,clickDisplayTotal:!ltmplConfig.directShowTotal}}
1127
- serverKey={serverKey}
1127
+ serverKey={serverKey} hiddenColIds={hiddenColIds}
1128
1128
  maxSelectedRows={this.checkBoxUseful() ? 1000 : -1}
1129
1129
  columns={tableColumns}
1130
1130
  selectedRows={selectedRows} queryKey={queryKey}
@@ -2,16 +2,12 @@ import React from "react";
2
2
  import {
3
3
  ActionRenderProps,
4
4
  ColumnConfig,
5
- CustomButton,
6
- DoEditParam,
7
5
  DtmplData,
8
- JumpConfig,
9
6
  LtmplConfig,
10
- ShowViewParam
11
7
  } from "../../tmpl/interface";
12
8
  import TableUnits from "../table-util";
13
9
  import SupportInputTypes from "../../tmpl/control-type-supportor";
14
- import {Button, Popconfirm, Space, theme, Tooltip} from "antd";
10
+ import {Button, Popconfirm, Space, Tooltip} from "antd";
15
11
  import {SortableHandle} from "react-sortable-hoc";
16
12
  import {
17
13
  AlignLeftOutlined, CopyOutlined, DeleteOutlined,
@@ -42,6 +38,7 @@ interface ColumnBuilderProps extends ActionRenderProps{
42
38
 
43
39
  interface ReportColumnBuilderProps {
44
40
  columnConfigs: ColumnConfig[],
41
+ hiddenColIds?: string[],
45
42
  translate:(...strs: string[]) => string;
46
43
  leftFixedCols: number,
47
44
  }
@@ -68,8 +65,10 @@ export default {
68
65
 
69
66
  colConfigs.forEach((item) => {
70
67
  let column = {};
71
- if (!hiddenColIds || !hiddenColIds.includes(item.id)) {
72
- tableColumns.push(column);
68
+ if (hiddenColIds && hiddenColIds.includes(item.originalId) ) {
69
+ return
70
+ }else{
71
+ tableColumns.push(column);
73
72
  }
74
73
  column["title"] = item.title;
75
74
  column["dataIndex"] = item.id;
@@ -142,6 +141,7 @@ export default {
142
141
  </Tooltip>
143
142
  );
144
143
  } else if (item.title === "操作") {
144
+ column["操作"] = "1";
145
145
  column["fixed"] = "right";
146
146
  column["align"] = "center";
147
147
  column["width"] = item.colWidth ? item.colWidth : 160;
@@ -190,7 +190,7 @@ export default {
190
190
 
191
191
  buildReportTableColumns(props: ReportColumnBuilderProps) {
192
192
  const {
193
- columnConfigs,translate, leftFixedCols
193
+ columnConfigs,translate, leftFixedCols,hiddenColIds
194
194
  } = props;
195
195
 
196
196
  let tableColumns = [];
@@ -200,9 +200,9 @@ export default {
200
200
  let currentDataColIndex = 0;
201
201
 
202
202
  colConfigs.forEach((item) => {
203
- if(item.hidden){
204
- return;
205
- }
203
+ if (item.hidden || (hiddenColIds && hiddenColIds.includes(item.originalId)) ) {
204
+ return
205
+ }
206
206
  let column = {};
207
207
  if(item.upperColumnTitle){
208
208
  let parent;
@@ -291,7 +291,7 @@ export default {
291
291
 
292
292
  return undefined;
293
293
  },
294
- renderAction(props:ActionRenderProps, record:DtmplData,){
294
+ renderAction(props:ActionRenderProps, record:DtmplData){
295
295
  const {ltmplConfig, showView,
296
296
  doEdit,
297
297
  doRAction,
@@ -515,11 +515,10 @@ export default {
515
515
  if (v.includes("@R@") > 0) {
516
516
  v = v.split("@R@")[1];
517
517
  }
518
- let HCService;
519
518
  return (
520
519
  <NewinFileView
521
520
  title={openFileButton.title}
522
- filePath={HCService.toFilePath(v, serverKey)}
521
+ filePath={HcserviceV3.toFilePath(v, serverKey)}
523
522
  serverKey={serverKey}
524
523
  key={openFileButton.id}
525
524
  //size={"small"}
@@ -6,7 +6,7 @@ import {
6
6
  DtmplData,
7
7
  PageInfo,
8
8
  QueryData,
9
- SelectedRow,QueryTableProps
9
+ SelectedRow, QueryTableProps, ActionRenderProps, FieldConfig
10
10
  } from "../tmpl/interface";
11
11
  import HcserviceV3 from "../tmpl/hcservice-v3";
12
12
  import Pagination from "./pagination";
@@ -17,6 +17,7 @@ import ViewControl from "../controls/view-control";
17
17
  import { LocaleContext } from "../locale/LocaleProvider";
18
18
  import { BigNumber } from "bignumber.js";
19
19
  import { init, merge, statistic } from "../utils/dsu";
20
+ import VerticalList from "../list/vertical-list";
20
21
 
21
22
  const { Panel } = Collapse;
22
23
  const SortableItem = SortableElement((props) => (
@@ -203,6 +204,8 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
203
204
  }
204
205
  };
205
206
 
207
+
208
+
206
209
  pageTo = async (pageNo: number, pageSize: number) => {
207
210
  const { onChangePage } = this.props;
208
211
  const { virtualEndPageNo } = this.state;
@@ -289,47 +292,6 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
289
292
  return ds;
290
293
  };
291
294
 
292
- initViewList = (data) => {
293
- //console.log("data:",data);
294
- const { translate } = this.context;
295
- const { columns, columnConfigs, serverKey } = this.props;
296
- const formItemList = [];
297
- if (columnConfigs.length > 0) {
298
- columnConfigs.forEach((item, index) => {
299
- if (item.id != "10000" && item.id != "20000" && item.title != "操作") {
300
- const title = item.title;
301
- let fieldValue = data ? data[item.id] : undefined;
302
- if (title == "序号") {
303
- fieldValue = data.index;
304
- }
305
- //fieldValue 没有值时不能为null 要为 undefined。antd input所限制
306
- fieldValue = fieldValue
307
- ? fieldValue
308
- : item.defaultValue
309
- ? item.defaultValue
310
- : undefined;
311
- const fieldKey = item.id + Math.random() * 100;
312
-
313
- const formItem = (
314
- <Descriptions.Item
315
- label={translate("${" + item.title + "}")}
316
- key={index}
317
- className="labelcss"
318
- >
319
- <ViewControl
320
- serverKey={serverKey}
321
- holderType={"table"}
322
- value={fieldValue}
323
- fieldConfig={item}
324
- />
325
- </Descriptions.Item>
326
- );
327
- formItemList.push(formItem);
328
- }
329
- });
330
- }
331
- return formItemList;
332
- };
333
295
 
334
296
  getTableSummaryNumberValue(value: "" | string[]) {
335
297
  if (value === undefined || value === null) return 0;
@@ -1024,9 +986,12 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
1024
986
  subtotalYColumn,
1025
987
  tableProps,
1026
988
  groupIColumns,
989
+ hiddenRowCodes,
990
+ columnConfigs,
991
+ serverKey,
1027
992
  } = this.props;
1028
993
  //debugger
1029
- const { touchEnd, total, loading, virtualEndPageNo } = this.state;
994
+ const { touchEnd, total, loading, virtualEndPageNo,dataSource } = this.state;
1030
995
  const { translate } = this.context;
1031
996
 
1032
997
  const isProSumarryTable = Boolean(subtotalXColumn || subtotalYColumn);
@@ -1348,26 +1313,19 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
1348
1313
  total={total}
1349
1314
  />
1350
1315
  {viewModels.includes("verticalList") ? (
1351
- <Card style={{ marginTop: "10px" }}>
1352
- <List
1353
- dataSource={this.getUnHidenDataSource()}
1354
- renderItem={(item) => (
1355
- <List.Item key={item["id"]}>
1356
- <Card size={"small"} bodyStyle={{ padding: "4px" }}>
1357
- <Descriptions column={4}>
1358
- {this.initViewList(item)}
1359
- </Descriptions>
1360
- </Card>
1361
- </List.Item>
1362
- )}
1363
- />
1364
- </Card>
1316
+ <VerticalList hiddenRowCodes={hiddenRowCodes}
1317
+ dataSource={dataSource}
1318
+ columnConfigs={columnConfigs}
1319
+ serverKey={serverKey}
1320
+ columns={columns}/>
1365
1321
  ) : (
1366
1322
  ""
1367
1323
  )}
1368
1324
  </>
1369
1325
  );
1370
1326
  }
1327
+
1328
+
1371
1329
  }
1372
1330
 
1373
1331
  export default QueryTable;
@@ -8,7 +8,7 @@ import {
8
8
  Row,
9
9
  Space,
10
10
  Tooltip,
11
- Typography,Popconfirm,
11
+ Typography, Popconfirm, List, Card, Descriptions,
12
12
  } from "antd";
13
13
  import Table from "./control-table-x-axis-wrapper";
14
14
  import {
@@ -39,6 +39,7 @@ import RowEditor from "../detail/edit/row-editor";
39
39
  import Action from "../controls/action";
40
40
  import CountingTag from "../controls/counting-tag";
41
41
  import { LocaleContext } from "../locale/LocaleProvider";
42
+ import VerticalList from "../list/vertical-list";
42
43
 
43
44
  const FormItem = Form.Item;
44
45
  const { Text } = Typography;
@@ -149,14 +150,12 @@ class RelationTable extends React.PureComponent<
149
150
  };
150
151
 
151
152
  buildColumns = () => {
152
- const { viewOrEdit, value, fieldGroupConfig, serverKey } = this.props;
153
+ const { viewOrEdit, fieldGroupConfig, serverKey } = this.props;
153
154
  const {
154
- title,
155
155
  buttons,
156
156
  fields,
157
157
  showRelationName,
158
158
  relationNames,
159
- showRowNum,
160
159
  disabled,
161
160
  deleteData,
162
161
  } = fieldGroupConfig;
@@ -171,9 +170,6 @@ class RelationTable extends React.PureComponent<
171
170
  column["dataIndex"] = item.id;
172
171
  s++;
173
172
  let itemType = SupportInputTypes.getControlType(item, null);
174
- // if (s == 1) {
175
- // TableUnits.sort(column, itemType, 'ascend');
176
- // } else
177
173
  if (s < 12 && item.sortable) {
178
174
  TableUnits.sort(column, itemType);
179
175
  }
@@ -209,13 +205,13 @@ class RelationTable extends React.PureComponent<
209
205
  const rowEdit = buttons.includes("rowEdit");
210
206
  const dtmplEdit = buttons.includes("dtmplEdit");
211
207
  const deletable = buttons.includes("singleDelete");
212
-
213
208
  if (
214
209
  viewOrEdit == "edit" &&
215
210
  (viewable || rowEdit || dtmplEdit || deletable)
216
211
  ) {
217
212
  const actionColumn = {};
218
213
  columns.push(actionColumn);
214
+ actionColumn["操作"] = 1;
219
215
  actionColumn["title"] = translate("${操作}");
220
216
  actionColumn["fixed"] = "right";
221
217
  actionColumn["key"] = "action";
@@ -313,6 +309,7 @@ class RelationTable extends React.PureComponent<
313
309
  } else if (viewOrEdit == "view" && viewable) {
314
310
  const actionColumn = {};
315
311
  columns.push(actionColumn);
312
+ actionColumn["操作"] = 1;
316
313
  actionColumn["title"] = translate("${操作}");
317
314
  actionColumn["fixed"] = "right";
318
315
  actionColumn["key"] = "action";
@@ -496,11 +493,6 @@ class RelationTable extends React.PureComponent<
496
493
  handleDtmplEdit = async (code: string) => {
497
494
  const { value, fieldGroupConfig, onChange } = this.props;
498
495
  const {
499
- title,
500
- fields,
501
- showRelationName,
502
- relationNames,
503
- showRowNum,
504
496
  serverKey,
505
497
  } = fieldGroupConfig;
506
498
  this.setState({
@@ -705,12 +697,6 @@ class RelationTable extends React.PureComponent<
705
697
  }
706
698
  };
707
699
 
708
- // hiddenRowEdit = () => {
709
- // this.setState({
710
- // showRowEdit: false,
711
- // })
712
- // }
713
-
714
700
  render() {
715
701
  const {
716
702
  fieldGroupConfig,
@@ -730,12 +716,10 @@ class RelationTable extends React.PureComponent<
730
716
  showDtmplEdit,
731
717
  addTmplId,
732
718
  tableLoading,
733
- showRowEdit,
734
- selectedDtmplData,
735
719
  } = this.state;
736
720
  const { translate } = this.context;
737
721
 
738
- const { buttons } = fieldGroupConfig;
722
+ const { buttons,viewModel } = fieldGroupConfig;
739
723
  let mainCode1 = fieldGroupConfig.mainCode
740
724
  ? fieldGroupConfig.mainCode
741
725
  : mainCode
@@ -779,7 +763,11 @@ class RelationTable extends React.PureComponent<
779
763
  >
780
764
  <div className="editTableList">
781
765
  {this.buildButtons()}
782
- <Table
766
+ { viewModel && viewModel=="verticalList" ?<VerticalList
767
+ dataSource={this.buildDataSource()}
768
+ columnConfigs={fieldGroupConfig?.fields}
769
+ serverKey={serverKey}
770
+ columns={this.buildColumns()}/>:<Table
783
771
  size={"small"}
784
772
  locale={{
785
773
  emptyText: (
@@ -794,7 +782,7 @@ class RelationTable extends React.PureComponent<
794
782
  columns={this.buildColumns()}
795
783
  pagination={page}
796
784
  onChange={this.tabChange}
797
- />
785
+ /> }
798
786
  </div>
799
787
  </CollapseCard>
800
788
  {buttons.includes("detail") ? (
@@ -825,11 +813,6 @@ class RelationTable extends React.PureComponent<
825
813
  ) : (
826
814
  ""
827
815
  )}
828
- {/*{buttons.includes('rowEdit') || buttons.includes('rowAdd') ?*/}
829
- {/* <ModalRowEdit open={showRowEdit} onCancel={this.hiddenRowEdit}*/}
830
- {/* onOk={this.handleRowEdit} dtmplData={selectedDtmplData}*/}
831
- {/* fieldGroupConfig={fieldGroupConfig}> </ModalRowEdit>*/}
832
- {/* : ""}*/}
833
816
  {buttons.includes("selectAdd") ? (
834
817
  <ModelSelectTable
835
818
  serverKey={serverKey}
@@ -23,7 +23,7 @@ const ReportTable=(props:ReportTableProps)=> {
23
23
  const [reportData, setReportData] = useState<ReportData>(undefined);
24
24
 
25
25
  const { getServiceLangStr, translate} = useLocale();
26
- const {tableProps,columns,queryKey,serverKey,leftFixedCols}=props
26
+ const {tableProps,columns,queryKey,serverKey,leftFixedCols,hiddenColIds}=props
27
27
 
28
28
  useEffect( () => {
29
29
  const queryData = async () => {
@@ -89,7 +89,7 @@ const ReportTable=(props:ReportTableProps)=> {
89
89
  });
90
90
  }
91
91
 
92
- let current_cols=reportData?.columnConfigs?ColumnBuilder.buildReportTableColumns({columnConfigs:reportData.columnConfigs,translate,leftFixedCols}):columns ;
92
+ let current_cols=reportData?.columnConfigs?ColumnBuilder.buildReportTableColumns({columnConfigs:reportData.columnConfigs,translate,leftFixedCols,hiddenColIds}):columns ;
93
93
  let table_x = 20;
94
94
 
95
95
  current_cols.forEach((c) => {
@@ -24,6 +24,7 @@ export interface ReportTableProps {
24
24
  clickDisplayTotal?: boolean;
25
25
  scrollY?: number;
26
26
  };
27
+ hiddenColIds?: string[],
27
28
  leftFixedCols?:number;
28
29
  serverKey?: string;
29
30
  maxSelectedRows?: number;
@@ -211,7 +212,7 @@ export interface ColumnConfig extends FieldConfig {
211
212
  colWidth?: number;
212
213
  colFixed?: "left" | "right" | boolean;
213
214
  valueAlign?: "left" | "right" | "center";
214
- id: string;
215
+ originalId:string;
215
216
  upperColumnTitle?:string,
216
217
  }
217
218
 
@@ -289,6 +290,7 @@ export interface FieldGroupConfig extends OrderableTmplBase {
289
290
  classAddConfigs?: ClassAddConfig[];
290
291
  defaultCriteriaValue?: object;
291
292
  deleteData?:boolean;
293
+ viewModel?:"table"|"verticalList";
292
294
  }
293
295
 
294
296
  export type SaveJumpType = "list" | "add" | "edit";
@@ -476,11 +478,12 @@ export interface LtmplConfig extends SelectConfig {
476
478
  id: string;
477
479
  aggFunc: "sum" | "avg" | "groupIsum" | "groupIavg";
478
480
  title: string;
481
+ originalId:string;
479
482
  }[];
480
483
  subtotalXColumn?: { id: string }[];
481
484
  subtotalYColumn?: { id: string }[];
482
485
  updrillButtonConfigs?: UpdrillButtonConfig[];
483
- groupIColumns?: { id: string; title: string; sourceId: string }[];
486
+ groupIColumns?: { id: string; title: string; sourceId: string; originalId:string;}[];
484
487
  }
485
488
 
486
489
  export interface EnumItem {