aldehyde 0.2.435 → 0.2.436

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 (46) hide show
  1. package/lib/controls/2dEditor/2dEditor/index.js +1 -1
  2. package/lib/controls/2dEditor/components/card.d.ts.map +1 -1
  3. package/lib/controls/2dEditor/components/card.js +3 -1
  4. package/lib/controls/2dEditor/components/card.js.map +1 -1
  5. package/lib/controls/2dEditor/components/component.less +8 -0
  6. package/lib/list/card-list/index.d.ts +6 -0
  7. package/lib/list/card-list/index.d.ts.map +1 -1
  8. package/lib/list/card-list/index.js +40 -5
  9. package/lib/list/card-list/index.js.map +1 -1
  10. package/lib/list/card-list/index.less +6 -0
  11. package/lib/lowcode-components/line-chart/index.js +1 -1
  12. package/lib/lowcode-components/line-chart/index.js.map +1 -1
  13. package/lib/routable/ltmpl-route.d.ts +2 -0
  14. package/lib/routable/ltmpl-route.d.ts.map +1 -1
  15. package/lib/routable/ltmpl-route.js +20 -7
  16. package/lib/routable/ltmpl-route.js.map +1 -1
  17. package/lib/routable/splitview-ltmpl-route.d.ts.map +1 -1
  18. package/lib/routable/splitview-ltmpl-route.js +22 -4
  19. package/lib/routable/splitview-ltmpl-route.js.map +1 -1
  20. package/lib/table/act-table.d.ts +5 -1
  21. package/lib/table/act-table.d.ts.map +1 -1
  22. package/lib/table/act-table.js +43 -5
  23. package/lib/table/act-table.js.map +1 -1
  24. package/lib/table/pagination.d.ts +2 -0
  25. package/lib/table/pagination.d.ts.map +1 -1
  26. package/lib/table/pagination.js +4 -2
  27. package/lib/table/pagination.js.map +1 -1
  28. package/lib/table/query-table.d.ts.map +1 -1
  29. package/lib/table/query-table.js +3 -3
  30. package/lib/table/query-table.js.map +1 -1
  31. package/lib/tmpl/interface.d.ts +1 -0
  32. package/lib/tmpl/interface.d.ts.map +1 -1
  33. package/lib/tmpl/interface.js.map +1 -1
  34. package/package.json +1 -1
  35. package/src/aldehyde/controls/2dEditor/2dEditor/index.tsx +1 -1
  36. package/src/aldehyde/controls/2dEditor/components/card.tsx +3 -1
  37. package/src/aldehyde/controls/2dEditor/components/component.less +8 -0
  38. package/src/aldehyde/list/card-list/index.less +6 -0
  39. package/src/aldehyde/list/card-list/index.tsx +43 -3
  40. package/src/aldehyde/lowcode-components/line-chart/index.tsx +1 -1
  41. package/src/aldehyde/routable/ltmpl-route.tsx +25 -6
  42. package/src/aldehyde/routable/splitview-ltmpl-route.tsx +24 -4
  43. package/src/aldehyde/table/act-table.tsx +44 -7
  44. package/src/aldehyde/table/pagination.tsx +6 -2
  45. package/src/aldehyde/table/query-table.tsx +7 -1
  46. package/src/aldehyde/tmpl/interface.tsx +1 -0
@@ -8,13 +8,13 @@ import {
8
8
  PlusCircleOutlined, PlusOutlined, ReloadOutlined, RetweetOutlined, SearchOutlined,
9
9
  TableOutlined, ImportOutlined
10
10
  } from "@ant-design/icons";
11
+ import _ from "lodash";
11
12
  import "./index.css";
12
13
  import {
13
14
  ActTableMode, ActTableViewModel, AggregateVO, ClassAddConfig, ColumnConfig,
14
15
  CustomButton, CustomButtonConfig, DoEditParam, DtmplData, JumpConfig, LtmplConfig, QueryKey,
15
16
  SelectedRow, ShowViewParam, TmplBaseProps,
16
17
  } from "../tmpl/interface";
17
-
18
18
  import HcserviceV3 from "../tmpl/hcservice-v3";
19
19
  import HCDataSource from "../tmpl/hc-data-source";
20
20
  import QueryTable from "./query-table";
@@ -23,7 +23,6 @@ import ProgramConfig from "../units";
23
23
  import ColumnSelector from "./column/column-selector";
24
24
  import ExportFrame, { ExportType, ExportMode } from "../export/export-frame";
25
25
  import L2ActTable from "./l2-act-table";
26
-
27
26
  import Restat from "./stat/restat";
28
27
  import CollapseCard from "../controls/collapse-card";
29
28
  import ToolTipBar from "../detail/tooltipbar";
@@ -36,6 +35,7 @@ import EntryControl from "../controls/entry-control";
36
35
  import DraggableModal from "../module/draggable-modal";
37
36
  import Icon from "../icon/aliIcon";
38
37
  import PageConfigButton from "./page-config-button";
38
+ import { defPageSizeOptions } from "./pagination"; // 默认分页数
39
39
 
40
40
  const { Content, Sider } = Layout;
41
41
  const { Text } = Typography;
@@ -51,7 +51,7 @@ interface ActTableProps extends TmplBaseProps {
51
51
  criteriaData: object;
52
52
  pageNo: number;
53
53
  pageSize: number;
54
- onChangePage: (pageNo: number, pageSize: number) => void;
54
+ onChangePage: (pageNo: number, pageSize: number, pageSizeOptions?: number[]) => void;
55
55
  ltmplConfig: LtmplConfig;
56
56
  menuId?: string;
57
57
  showView?: (showVievParam: ShowViewParam) => void;
@@ -80,6 +80,7 @@ interface ActTableProps extends TmplBaseProps {
80
80
  resetUserPageConfig?: () => void; // 重置用户页面配置本地缓存
81
81
  allowUserConfig?: boolean; // 是否可用户自定义配置
82
82
  deleteCallback?: (val: object) => void; // 删除回调
83
+ onUpdatePageSizeOptions?: (val: number[]) => void; // 更新分页数数组
83
84
  }
84
85
 
85
86
  interface ActTableStat {
@@ -111,6 +112,7 @@ interface ActTableStat {
111
112
  delModalOpen?: boolean; // 强删除弹窗是否打开
112
113
  tabsOptions?: { key: string, value: string, label: React.ReactNode, title?: string, id?: string, ids?: string[] }[]; // tabs选项
113
114
  tabActiveKey?: string; // Tabs选中项
115
+ pageSizeOptions?: number[]; // 设备分页数
114
116
  }
115
117
  let serial_number = new Date().getTime();
116
118
  let busyReminderTime = 0;
@@ -146,6 +148,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
146
148
  delModalOpen: false, // 强删除弹窗是否打开
147
149
  tabsOptions: [],
148
150
  tabActiveKey: "all",
151
+ pageSizeOptions: defPageSizeOptions
149
152
  };
150
153
 
151
154
  static contextType = LocaleContext;
@@ -472,7 +475,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
472
475
 
473
476
 
474
477
  async componentDidMount() {
475
- const { ltmplConfig, tableType, userPageConfig } = this.props;
478
+ const { ltmplConfig, tableType, userPageConfig, defShowType, onUpdatePageSizeOptions, setUserPageConfig, pageSize } = this.props;
476
479
  const { sortedColIds } = userPageConfig || {};
477
480
  const { translate } = this.context;
478
481
  let sortedColConfigs = undefined;
@@ -485,11 +488,41 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
485
488
  if (sortedColIds) { // 使用缓存的列排序
486
489
  sortedColConfigs.sort((a, b) => sortedColIds.indexOf(a.id) - sortedColIds.indexOf(b.id));
487
490
  }
488
- this.loadData(userPageConfig?.hiddenColIds || defaultDisabledColIds, [], sortedColConfigs);
491
+ const temViewModels = userPageConfig?.["viewModels"] || [defShowType || ltmplConfig?.showType || "table"];
492
+ this.setState({ viewModels: temViewModels });
493
+ if (onUpdatePageSizeOptions && temViewModels.includes("cardList")) { // 初始化是卡片视图,则更新父组件中分页数组
494
+ const temPageSizes = Array.from({ length: 7 }, (_, i) => ltmplConfig.rowCardCount * Math.pow(2, i));
495
+ onUpdatePageSizeOptions(temPageSizes);
496
+ if (setUserPageConfig && !(userPageConfig?.pageSize >= 0)) setUserPageConfig({ pageSize: 1 });
497
+ this.setState({ pageSizeOptions: temPageSizes });
498
+ } else {
499
+ this.loadData(userPageConfig?.hiddenColIds || defaultDisabledColIds, [], sortedColConfigs);
500
+ }
489
501
  }
490
502
  this.getTabsOptions();
491
503
  }
492
504
 
505
+ // 卡片列表-更新列表分页数
506
+ handleCardListPageSize(preViewModels, viewModels) {
507
+ const { ltmplConfig, onChangePage, pageSize, pageNo } = this.props;
508
+ const { defaultPageSize } = ltmplConfig || {};
509
+ const preIsCard = preViewModels.includes("cardList");
510
+ const isCard = viewModels.includes("cardList");
511
+ let temPageSizes = defPageSizeOptions;
512
+ let temPageSize = defaultPageSize;
513
+ if ((!preIsCard && !isCard) || (preIsCard && isCard)) {
514
+ return;
515
+ }
516
+ if (!preIsCard && isCard) { // 普通切换到Card
517
+ temPageSizes = Array.from({ length: 7 }, (_, i) => ltmplConfig.rowCardCount * Math.pow(2, i));
518
+ temPageSize = temPageSizes.includes(Number(pageSize)) ? pageSize : (temPageSizes.includes(Number(defaultPageSize)) ? defaultPageSize : temPageSizes[1]);
519
+ } else if (preIsCard && !isCard) { // card切换到普通
520
+ temPageSize = defPageSizeOptions.includes(Number(pageSize)) ? pageSize : (defPageSizeOptions.includes(Number(defaultPageSize)) ? defaultPageSize : defPageSizeOptions[1]);
521
+ }
522
+ this.setState({ pageSizeOptions: temPageSizes });
523
+ onChangePage(pageNo || 1, temPageSize, temPageSizes);
524
+ }
525
+
493
526
  async componentDidUpdate(prevProps, prevState) {
494
527
  const { sourceId, criteriaData, ltmplConfig, tableType, pageSize, pageNo, userPageConfig, defShowType } = this.props;
495
528
  // const {userCriteriaData:preUserCriteriaData}=prevState;
@@ -514,6 +547,9 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
514
547
  if (!preUserPageConfig && userPageConfig) {
515
548
  this.setState({ viewModels: userPageConfig?.["viewModels"] || [defShowType || ltmplConfig?.showType || "table"] });
516
549
  }
550
+ if (!_.isEqual(prevState.viewModels, this.state.viewModels)) { // 显示视图变化-更改卡片列表分页条数
551
+ this.handleCardListPageSize(prevState.viewModels, this.state.viewModels);
552
+ }
517
553
  let { hiddenColIds, sortedColConfigs } = this.state;
518
554
  let currentQueryParams = ProgramConfig.transQueryParamsToStr(criteriaData, false, [
519
555
  "pageSize",
@@ -928,7 +964,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
928
964
 
929
965
  // 更新当前页面配置
930
966
  handleUpdateUserPageConfig = (val: { [key: string]: any }) => {
931
- const { sortedColIds, hiddenColIds, viewModels, criteriaData } = val;
967
+ const { sortedColIds, hiddenColIds, viewModels, criteriaData } = val || {};
932
968
  const { setUserPageConfig, ltmplConfig, tableType, defShowType, menuId } = this.props;
933
969
  const { userCriteriaData } = this.state;
934
970
  const { translate } = this.context;
@@ -1455,7 +1491,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
1455
1491
  renderContent = () => {
1456
1492
  let {
1457
1493
  queryKey, loading, selectedRows, hiddenRowCodes, viewModels, sortedColConfigs, hiddenColIds, showL2ActTable,
1458
- pageInfo, editings, userCriteriaData, tabsOptions, tabActiveKey
1494
+ pageInfo, editings, userCriteriaData, tabsOptions, tabActiveKey, pageSizeOptions
1459
1495
  } = this.state;
1460
1496
  let {
1461
1497
  mainCode, sourceId, ltmplConfig, funcMode, operatable,
@@ -1557,6 +1593,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
1557
1593
  showPagination={showPagination}
1558
1594
  onChangeAggregateVO={(val) => this.setState({ aggregateVO: val })}
1559
1595
  onChangeResize={this.onChangeResize}
1596
+ pageSizeOptions={pageSizeOptions}
1560
1597
  />);
1561
1598
 
1562
1599
  // tab拆解条件渲染
@@ -4,6 +4,9 @@ import { Pagination as AntdPagination } from "antd";
4
4
  import "./pagination.css";
5
5
  import { LocaleContext } from "../locale/LocaleProvider";
6
6
 
7
+ // 默认分页数
8
+ export const defPageSizeOptions = [5, 10, 20, 50, 100, 200, 500];
9
+
7
10
  interface PaginationProps {
8
11
  pageTo: (pageNo: number, pageSize: number) => void;
9
12
  queryTotal: () => void;
@@ -11,6 +14,7 @@ interface PaginationProps {
11
14
  total: number;
12
15
  touchEnd: boolean;
13
16
  paginationPosition?: "left" | "middle" | "right";
17
+ pageSizeOptions?: number[]; //配置的分页数
14
18
  }
15
19
 
16
20
  interface PaginationStat { }
@@ -20,7 +24,7 @@ class Pagination extends React.PureComponent<PaginationProps, PaginationStat> {
20
24
  context: React.ContextType<typeof LocaleContext>;
21
25
 
22
26
  render() {
23
- const { queryTotal, pageInfo, total, pageTo, touchEnd, paginationPosition } = this.props;
27
+ const { queryTotal, pageInfo, total, pageTo, touchEnd, paginationPosition, pageSizeOptions } = this.props;
24
28
  const { translate } = this.context;
25
29
 
26
30
  if (!pageInfo) {
@@ -60,7 +64,7 @@ class Pagination extends React.PureComponent<PaginationProps, PaginationStat> {
60
64
  style={{ display: "inline-block" }}
61
65
  showQuickJumper
62
66
  showSizeChanger
63
- pageSizeOptions={["5", "10", "20", "50", "100", "200", "500"]} //
67
+ pageSizeOptions={pageSizeOptions || defPageSizeOptions}
64
68
  defaultCurrent={1}
65
69
  current={parseInt(pageInfo.pageNo ? pageInfo.pageNo.toString() : "1")}
66
70
  pageSize={pageInfo.pageSize ? pageInfo.pageSize : 10}
@@ -434,7 +434,9 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
434
434
  ltmplConfig,
435
435
  showView,
436
436
  showPagination,
437
- onChangeResize
437
+ onChangeResize,
438
+ pageSizeOptions,
439
+ onChangePage
438
440
  } = this.props;
439
441
  //debugger
440
442
  const { touchEnd, aggregateVO, loading, virtualEndPageNo, dataSource, errorText } = this.state;
@@ -619,6 +621,9 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
619
621
  sourceId={this.props.sourceId}
620
622
  loading={loading}
621
623
  errorText={errorText}
624
+ total={aggregateVO?.count}
625
+ pageInfo={pageInfo}
626
+ onChangePage={onChangePage}
622
627
  />
623
628
  ) : (
624
629
  ""
@@ -633,6 +638,7 @@ class QueryTable extends React.PureComponent<QueryTableProps, QueryTableStat> {
633
638
  queryTotal={this.queryTotal}
634
639
  total={aggregateVO?.count}
635
640
  paginationPosition={ltmplConfig?.paginationPosition}
641
+ pageSizeOptions={pageSizeOptions}
636
642
  /> : ""}
637
643
  </>
638
644
  );
@@ -93,6 +93,7 @@ export interface QueryTableProps extends ReportTableProps {
93
93
  showPagination?: boolean;
94
94
  onChangeAggregateVO?: (aggregateVO: AggregateVO) => void;
95
95
  onChangeResize?: (value: { [key: string]: number }) => void; // 表格列尺寸更新
96
+ pageSizeOptions?: number[]; // 分页数配置
96
97
  }
97
98
 
98
99
  export interface AggregateVO {