aldehyde 0.2.286 → 0.2.288

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 (67) hide show
  1. package/lib/controls/select/index.d.ts.map +1 -1
  2. package/lib/controls/select/index.js +0 -1
  3. package/lib/controls/select/index.js.map +1 -1
  4. package/lib/controls/upload/index.js +2 -2
  5. package/lib/controls/upload/index.js.map +1 -1
  6. package/lib/controls/upload/mult-file-upload.d.ts.map +1 -1
  7. package/lib/controls/upload/mult-file-upload.js +5 -4
  8. package/lib/controls/upload/mult-file-upload.js.map +1 -1
  9. package/lib/export/select-code-export-frame.js +1 -1
  10. package/lib/export/select-code-export-frame.js.map +1 -1
  11. package/lib/form/dtmpl-form.d.ts +3 -0
  12. package/lib/form/dtmpl-form.d.ts.map +1 -1
  13. package/lib/form/dtmpl-form.js +24 -3
  14. package/lib/form/dtmpl-form.js.map +1 -1
  15. package/lib/import/excel-import.js +1 -1
  16. package/lib/import/excel-import.js.map +1 -1
  17. package/lib/lowcode-components/act-table/index.d.ts +30 -0
  18. package/lib/lowcode-components/act-table/index.d.ts.map +1 -0
  19. package/lib/lowcode-components/act-table/index.js +86 -0
  20. package/lib/lowcode-components/act-table/index.js.map +1 -0
  21. package/lib/lowcode-components/act-table/index.less +27 -0
  22. package/lib/lowcode-components/base-table/index.d.ts.map +1 -1
  23. package/lib/lowcode-components/base-table/index.js +8 -4
  24. package/lib/lowcode-components/base-table/index.js.map +1 -1
  25. package/lib/lowcode-components/index.d.ts +2 -0
  26. package/lib/lowcode-components/index.d.ts.map +1 -1
  27. package/lib/lowcode-components/index.js +2 -1
  28. package/lib/lowcode-components/index.js.map +1 -1
  29. package/lib/lowcode-components/lowcode-view/component/assets.d.ts.map +1 -1
  30. package/lib/lowcode-components/lowcode-view/component/assets.js +8 -0
  31. package/lib/lowcode-components/lowcode-view/component/assets.js.map +1 -1
  32. package/lib/module/dtmpl-edit-card.d.ts +2 -2
  33. package/lib/module/dtmpl-edit-card.d.ts.map +1 -1
  34. package/lib/module/dtmpl-edit-card.js +13 -5
  35. package/lib/module/dtmpl-edit-card.js.map +1 -1
  36. package/lib/table/relation-table.d.ts +3 -1
  37. package/lib/table/relation-table.d.ts.map +1 -1
  38. package/lib/table/relation-table.js +32 -18
  39. package/lib/table/relation-table.js.map +1 -1
  40. package/lib/tmpl/control-type-supportor.d.ts +2 -0
  41. package/lib/tmpl/control-type-supportor.d.ts.map +1 -1
  42. package/lib/tmpl/control-type-supportor.js +18 -0
  43. package/lib/tmpl/control-type-supportor.js.map +1 -1
  44. package/lib/tmpl/hcservice-v3.d.ts +1 -0
  45. package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
  46. package/lib/tmpl/hcservice-v3.js +16 -79
  47. package/lib/tmpl/hcservice-v3.js.map +1 -1
  48. package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
  49. package/lib/tmpl/tmpl-config-analysis.js +24 -0
  50. package/lib/tmpl/tmpl-config-analysis.js.map +1 -1
  51. package/package.json +1 -1
  52. package/src/aldehyde/controls/select/index.tsx +0 -1
  53. package/src/aldehyde/controls/upload/index.tsx +2 -2
  54. package/src/aldehyde/controls/upload/mult-file-upload.tsx +5 -4
  55. package/src/aldehyde/export/select-code-export-frame.tsx +1 -1
  56. package/src/aldehyde/form/dtmpl-form.tsx +28 -2
  57. package/src/aldehyde/import/excel-import.tsx +1 -1
  58. package/src/aldehyde/lowcode-components/act-table/index.less +27 -0
  59. package/src/aldehyde/lowcode-components/act-table/index.tsx +127 -0
  60. package/src/aldehyde/lowcode-components/base-table/index.tsx +8 -4
  61. package/src/aldehyde/lowcode-components/index.ts +4 -2
  62. package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +8 -0
  63. package/src/aldehyde/module/dtmpl-edit-card.tsx +282 -272
  64. package/src/aldehyde/table/relation-table.tsx +915 -893
  65. package/src/aldehyde/tmpl/control-type-supportor.tsx +18 -0
  66. package/src/aldehyde/tmpl/hcservice-v3.tsx +20 -85
  67. package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +22 -0
@@ -34,6 +34,7 @@ interface DtmplFormStat {
34
34
  appDtmplConfig?: DtmplConfig;
35
35
  embedForm?: object;
36
36
  embedRefValue?: object;
37
+ editingGroups?:string[];
37
38
  }
38
39
 
39
40
  export default class DtmplForm extends React.PureComponent<
@@ -51,6 +52,7 @@ export default class DtmplForm extends React.PureComponent<
51
52
  appDtmplConfig: undefined,
52
53
  embedForm: {},
53
54
  embedRefValue: {},
55
+ editingGroups:[],
54
56
  };
55
57
  static defaultPorps = {
56
58
  maxCols: 2,
@@ -123,6 +125,17 @@ export default class DtmplForm extends React.PureComponent<
123
125
  const { translate } = this.context;
124
126
  message.info(translate("${已刷新}!"));
125
127
  };
128
+ onGroupEditing=(groupCode,editing:boolean)=>{
129
+
130
+ const {editingGroups}=this.state;
131
+ let arr=[...editingGroups];
132
+ if (editing) {
133
+ arr.push(groupCode);
134
+ }else{
135
+ arr = editingGroups.filter(item => item !== groupCode);
136
+ }
137
+ this.setState({editingGroups:arr});
138
+ }
126
139
 
127
140
  onGroupChange = (
128
141
  fieldGroupConfig: FieldGroupConfig,
@@ -173,9 +186,19 @@ export default class DtmplForm extends React.PureComponent<
173
186
  currentDtmplData,
174
187
  appDtmplConfig,
175
188
  embedForm,
176
- embedRefValue,
189
+ embedRefValue,editingGroups
177
190
  } = this.state;
178
- dtmplData.fieldMap={...values}
191
+
192
+ if (editingGroups.length > 0) {
193
+ message.error("请提交表格数据后再保存");
194
+ this.props.onFinish(false);
195
+ return;
196
+ }
197
+
198
+ if(dtmplData){
199
+ dtmplData.fieldMap={...values}
200
+ }
201
+
179
202
  let resultCode = undefined;
180
203
  const result = values;
181
204
  for (let group of dtmplConfig.groups) {
@@ -361,6 +384,9 @@ export default class DtmplForm extends React.PureComponent<
361
384
  value={data}
362
385
  parentFormInstance={formRef?.current}
363
386
  viewOrEdit={item.readOnly ? "view" : "edit"}
387
+ onEditing={(editing)=>{
388
+ this.onGroupEditing(item.id,editing);
389
+ }}
364
390
  onChange={this.onGroupChange}
365
391
  />
366
392
  );
@@ -257,7 +257,7 @@ export default class ExcelImport extends React.PureComponent<
257
257
  };
258
258
  download = () => {
259
259
  const { sourceId, serverKey } = this.props;
260
- const hydrocarbonToken = Units.hydrocarbonToken();
260
+ const hydrocarbonToken = Units.serverHydrocarbonToken(serverKey);
261
261
  Units.downloadFile(
262
262
  Units.joinPath(
263
263
  Units.api(serverKey),
@@ -0,0 +1,27 @@
1
+ .act-table-component {
2
+ width: 100%;
3
+ height: 100%;
4
+ overflow: auto;
5
+
6
+ .ant-layout {
7
+ background: transparent !important;
8
+
9
+ .ant-pagination-options {
10
+
11
+ .ant-select-selector,
12
+ input {
13
+ background: transparent !important;
14
+ }
15
+ }
16
+ }
17
+
18
+ .empty {
19
+ width: 100%;
20
+ height: 100%;
21
+ display: flex;
22
+ justify-content: center;
23
+ align-items: center;
24
+ font-size: 14px;
25
+ color: #999;
26
+ }
27
+ }
@@ -0,0 +1,127 @@
1
+
2
+ import React, { ForwardedRef, forwardRef, useEffect, useImperativeHandle, useState } from 'react';
3
+ import { ConfigProvider } from "antd";
4
+ import { LtmplConfig } from "../../tmpl/interface";
5
+ import HydrocarbonService from "../../tmpl/hcservice-v3";
6
+ import ActTable from "../../../aldehyde/table/act-table";
7
+ import { DataConfigProps } from "../data";
8
+ import './index.less';
9
+
10
+ export interface ComponentStyle {
11
+ table: {
12
+ background?: string;
13
+ pageSize?: number;
14
+ padding?: number;
15
+ fontSize?: number;
16
+ },
17
+ header?: {
18
+ background?: string;
19
+ color?: string;
20
+ borderRadius?: number;
21
+ };
22
+ body?: {
23
+ background?: string;
24
+ color?: string;
25
+ };
26
+ }
27
+
28
+ export interface ComponentProps {
29
+ style?: ComponentStyle;
30
+ data?: DataConfigProps;
31
+ }
32
+
33
+ export interface ComponentRef {
34
+ updateConfig: (newConfig: ComponentProps) => void;
35
+ }
36
+
37
+ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>) => {
38
+ const { style, data: propsData } = props;
39
+ const [config, setConfig] = useState<ComponentStyle>({ ...style });
40
+ const [dataConfig, setDataConfig] = useState<DataConfigProps>({ ...propsData });
41
+ const [ltmplConfig, setLtmplConfig] = useState<LtmplConfig>();
42
+ const [pageInfo, setPageInfo] = useState({ pageNo: 1, pageSize: style?.table?.pageSize || 10 });
43
+
44
+ useImperativeHandle(ref, () => ({
45
+ updateConfig: (newConfig) => {
46
+ const { style: newStyle, data: newDataConfig } = newConfig;
47
+ setConfig({ ...newStyle });
48
+ setDataConfig({ ...newDataConfig });
49
+ },
50
+ }));
51
+
52
+ // 获取数据源表格配置
53
+ const getLtmplConfig = async () => {
54
+ const { ltmplConfig: temConfig } = await HydrocarbonService.requestLtmplConfig(dataConfig?.serverKey || null, dataConfig?.sourceId) || {};
55
+ setLtmplConfig(temConfig);
56
+ };
57
+
58
+ // 数据源数据请求
59
+ useEffect(() => {
60
+ if (dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId) {
61
+ getLtmplConfig();
62
+ } else {
63
+ setLtmplConfig(undefined);
64
+ }
65
+ }, [dataConfig?.sourceType, dataConfig?.sourceId]);
66
+
67
+ return (
68
+ <div className="act-table-component"
69
+ style={{ background: config?.table?.background }}
70
+ >
71
+ {ltmplConfig ?
72
+ <ConfigProvider
73
+ theme={{
74
+ token: {
75
+ colorText: config?.body?.color,
76
+ fontSize: config?.table?.fontSize,
77
+ },
78
+ components: {
79
+ Table: {
80
+ headerBg: config?.header?.background,
81
+ headerColor: config?.header?.color,
82
+ headerBorderRadius: config?.header?.borderRadius,
83
+ cellPaddingBlock: config?.table?.padding,
84
+ cellPaddingInline: config?.table?.padding,
85
+ colorBgContainer: config?.body?.background,
86
+ },
87
+ Pagination: {
88
+ itemBg: "transparent",
89
+ itemLinkBg: "transparent",
90
+ itemActiveBg: "transparent",
91
+ },
92
+ // 以下是弹框中组件样式兼容
93
+ Modal: {
94
+ contentBg: config?.body?.background,
95
+ headerBg: config?.body?.background,
96
+ titleColor: config?.body?.color,
97
+ colorIcon: config?.body?.color,
98
+ },
99
+ Card: {
100
+ headerBg: `${config?.body?.background} !important`,
101
+ colorBgContainer: config?.body?.background
102
+ },
103
+ Descriptions: {
104
+ labelColor: config?.body?.color,
105
+ },
106
+ Button: {
107
+ defaultBg: "transparent"
108
+ }
109
+ },
110
+ }}>
111
+ <ActTable
112
+ sourceId={dataConfig.sourceId}
113
+ ltmplConfig={ltmplConfig}
114
+ funcMode="simple"
115
+ operatable={false}
116
+ pageNo={pageInfo.pageNo}
117
+ pageSize={pageInfo.pageSize}
118
+ onChangePage={(pageNo, pageSize) => setPageInfo({ pageNo, pageSize })}
119
+ />
120
+ </ConfigProvider> :
121
+ <div className='empty' style={{ color: config?.body?.color }}>暂无数据</div>
122
+ }
123
+ </div>
124
+ );
125
+ });
126
+
127
+ export default Index;
@@ -135,9 +135,10 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
135
135
 
136
136
  // 获取数据源表格配置
137
137
  const getLtmplConfig = async () => {
138
- const { ltmplConfig } = await HcserviceV3.requestLtmplConfig(dataConfig?.serverKey || null, dataConfig?.sourceId) || {};
138
+ const { ltmplConfig, status } = await HcserviceV3.requestLtmplConfig(dataConfig?.serverKey || null, dataConfig?.sourceId) || {};
139
139
  const temColumns = ltmplConfig?.columns?.map((item) => ({ ...item, dataIndex: item.id }))?.filter((item) => !item.hidden);
140
140
  setColumns(temColumns || []);
141
+ return status;
141
142
  };
142
143
 
143
144
  // 请求数据
@@ -156,6 +157,11 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
156
157
  // 初始化请求数据
157
158
  const getInitData = async () => {
158
159
  pollingIntervalRef.current && clearInterval(pollingIntervalRef.current);
160
+ setData([]);
161
+ const status = await getLtmplConfig();
162
+ if (isDesignMode || status === 'error') {
163
+ return;
164
+ }
159
165
  await getData();
160
166
  if (request?.polling) {
161
167
  pollingIntervalRef.current = setInterval(() => { getData(); }, request?.pollingInterval * 1000 || 60000);
@@ -177,9 +183,7 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
177
183
  */
178
184
  useEffect(() => {
179
185
  if (dataConfig?.sourceType === 'sourceId' && dataConfig?.sourceId) {
180
- setData([]);
181
- getLtmplConfig();
182
- !isDesignMode && getInitData();
186
+ getInitData();
183
187
  } else if (dataConfig?.sourceType === 'sourceId') {
184
188
  setData([]);
185
189
  setColumns([]);
@@ -40,6 +40,7 @@ import BaseTable from "./base-table";
40
40
  import TextScroller from "./text-scroller";
41
41
  import CapsuleBarChart from "./capsule-bar-chart";
42
42
  import CircularProgressChart from "./circular-progress-chart";
43
+ import ActTable from "./act-table";
43
44
 
44
45
 
45
46
  type CompoundedComponent = {
@@ -84,7 +85,8 @@ type CompoundedComponent = {
84
85
  BaseTable?: typeof BaseTable;
85
86
  TextScroller?: typeof TextScroller;
86
87
  CapsuleBarChart?: typeof CapsuleBarChart;
87
- CircularProgressChart?: typeof CircularProgressChart
88
+ CircularProgressChart?: typeof CircularProgressChart;
89
+ ActTable?: typeof ActTable
88
90
  };
89
91
 
90
92
  const LowcodeComponents: CompoundedComponent = {
@@ -95,7 +97,7 @@ const LowcodeComponents: CompoundedComponent = {
95
97
  Border7, Border8, Border9, Border10, Border11, Border12, Border13,
96
98
  Decoration1, Decoration2, Decoration3, Decoration4, Decoration5,
97
99
  Decoration6, Decoration7, Decoration8, Decoration9, Decoration10, Decoration11,
98
- BaseTable, TextScroller, CapsuleBarChart, CircularProgressChart
100
+ BaseTable, TextScroller, CapsuleBarChart, CircularProgressChart, ActTable
99
101
  };
100
102
 
101
103
  export default LowcodeComponents;
@@ -42,6 +42,7 @@ import BaseTable from "../../base-table";
42
42
  import TextScroller from "../../text-scroller";
43
43
  import CapsuleBarChart from "../../capsule-bar-chart";
44
44
  import CircularProgressChart from "../../circular-progress-chart";
45
+ import ActTable from "../../act-table";
45
46
 
46
47
  interface ComponentItemConfig {
47
48
  baseInfo: BaseInfoType, // 基础信息
@@ -371,5 +372,12 @@ export const compsConfig: { [key: string]: ComponentItemConfig } = {
371
372
  compName: "环形进度图",
372
373
  compKey: "CircularProgressChart"
373
374
  }
375
+ },
376
+ ActTable: {
377
+ componentNode: ActTable,
378
+ baseInfo: {
379
+ compName: "全表格",
380
+ compKey: "ActTable"
381
+ }
374
382
  }
375
383
  };