aldehyde 0.2.277 → 0.2.278

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 (80) hide show
  1. package/lib/controls/select/index.d.ts.map +1 -1
  2. package/lib/controls/select/index.js.map +1 -1
  3. package/lib/controls/tree-select/tree-entity-select.d.ts +0 -1
  4. package/lib/controls/tree-select/tree-entity-select.d.ts.map +1 -1
  5. package/lib/controls/tree-select/tree-entity-select.js +2 -2
  6. package/lib/controls/tree-select/tree-entity-select.js.map +1 -1
  7. package/lib/controls/view-control.d.ts.map +1 -1
  8. package/lib/controls/view-control.js +1 -0
  9. package/lib/controls/view-control.js.map +1 -1
  10. package/lib/form/dtmpl-form.d.ts.map +1 -1
  11. package/lib/form/dtmpl-form.js +2 -3
  12. package/lib/form/dtmpl-form.js.map +1 -1
  13. package/lib/form/form-Item-group.d.ts.map +1 -1
  14. package/lib/form/form-Item-group.js +2 -18
  15. package/lib/form/form-Item-group.js.map +1 -1
  16. package/lib/lowcode-components/data-number/index.d.ts +24 -0
  17. package/lib/lowcode-components/data-number/index.d.ts.map +1 -0
  18. package/lib/lowcode-components/data-number/index.js +28 -0
  19. package/lib/lowcode-components/data-number/index.js.map +1 -0
  20. package/lib/lowcode-components/data-number/index.less +11 -0
  21. package/lib/lowcode-components/gauge-chart/index.d.ts +47 -0
  22. package/lib/lowcode-components/gauge-chart/index.d.ts.map +1 -0
  23. package/lib/lowcode-components/gauge-chart/index.js +80 -0
  24. package/lib/lowcode-components/gauge-chart/index.js.map +1 -0
  25. package/lib/lowcode-components/index.d.ts +8 -0
  26. package/lib/lowcode-components/index.d.ts.map +1 -1
  27. package/lib/lowcode-components/index.js +8 -0
  28. package/lib/lowcode-components/index.js.map +1 -1
  29. package/lib/lowcode-components/liquid-chart/index.d.ts +47 -0
  30. package/lib/lowcode-components/liquid-chart/index.d.ts.map +1 -0
  31. package/lib/lowcode-components/liquid-chart/index.js +90 -0
  32. package/lib/lowcode-components/liquid-chart/index.js.map +1 -0
  33. package/lib/lowcode-components/lowcode-view/component/assets.d.ts.map +1 -1
  34. package/lib/lowcode-components/lowcode-view/component/assets.js +32 -0
  35. package/lib/lowcode-components/lowcode-view/component/assets.js.map +1 -1
  36. package/lib/lowcode-components/pie-chart/index.d.ts +38 -0
  37. package/lib/lowcode-components/pie-chart/index.d.ts.map +1 -0
  38. package/lib/lowcode-components/pie-chart/index.js +87 -0
  39. package/lib/lowcode-components/pie-chart/index.js.map +1 -0
  40. package/lib/module/dtmpl-edit-page.d.ts.map +1 -1
  41. package/lib/module/dtmpl-edit-page.js +20 -4
  42. package/lib/module/dtmpl-edit-page.js.map +1 -1
  43. package/lib/routable/dtmpl-route.js +3 -2
  44. package/lib/routable/dtmpl-route.js.map +1 -1
  45. package/lib/table/act-table.d.ts.map +1 -1
  46. package/lib/table/act-table.js +3 -3
  47. package/lib/table/act-table.js.map +1 -1
  48. package/lib/table/relation-table.d.ts +1 -0
  49. package/lib/table/relation-table.d.ts.map +1 -1
  50. package/lib/table/relation-table.js +15 -7
  51. package/lib/table/relation-table.js.map +1 -1
  52. package/lib/tmpl/control-type-supportor.js +1 -1
  53. package/lib/tmpl/control-type-supportor.js.map +1 -1
  54. package/lib/tmpl/interface.d.ts +2 -1
  55. package/lib/tmpl/interface.d.ts.map +1 -1
  56. package/lib/tmpl/interface.js.map +1 -1
  57. package/lib/tmpl/tmpl-config-analysis.d.ts +3 -1
  58. package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
  59. package/lib/tmpl/tmpl-config-analysis.js +48 -12
  60. package/lib/tmpl/tmpl-config-analysis.js.map +1 -1
  61. package/package.json +2 -2
  62. package/src/aldehyde/controls/select/index.tsx +1 -0
  63. package/src/aldehyde/controls/tree-select/tree-entity-select.tsx +4 -4
  64. package/src/aldehyde/controls/view-control.tsx +1 -0
  65. package/src/aldehyde/form/dtmpl-form.tsx +2 -2
  66. package/src/aldehyde/form/form-Item-group.tsx +4 -19
  67. package/src/aldehyde/lowcode-components/data-number/index.less +11 -0
  68. package/src/aldehyde/lowcode-components/data-number/index.tsx +54 -0
  69. package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +118 -0
  70. package/src/aldehyde/lowcode-components/index.ts +12 -0
  71. package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +128 -0
  72. package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +32 -0
  73. package/src/aldehyde/lowcode-components/pie-chart/index.tsx +122 -0
  74. package/src/aldehyde/module/dtmpl-edit-page.tsx +22 -1
  75. package/src/aldehyde/routable/dtmpl-route.tsx +3 -3
  76. package/src/aldehyde/table/act-table.tsx +4 -4
  77. package/src/aldehyde/table/relation-table.tsx +20 -8
  78. package/src/aldehyde/tmpl/control-type-supportor.tsx +1 -1
  79. package/src/aldehyde/tmpl/interface.tsx +9 -2
  80. package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +54 -14
@@ -0,0 +1,122 @@
1
+ import * as echarts from 'echarts';
2
+ import React, { useEffect, useRef, useState, ForwardedRef, forwardRef, useImperativeHandle } from 'react';
3
+ import _ from 'lodash';
4
+
5
+ const defOption = {
6
+ color: ["#5470c6", "#91cc75", "#fac858", "#ee6666", "#73c0de"],
7
+ padAngle: 0,
8
+ tooltip: {
9
+ trigger: 'item'
10
+ },
11
+ legend: {
12
+ orient: 'vertical',
13
+ left: 'left'
14
+ },
15
+ series: [
16
+ {
17
+ name: 'Access From',
18
+ type: 'pie',
19
+ radius: ["0%", "50%"],
20
+ data: [
21
+ { value: 1048, name: 'Search Engine' },
22
+ { value: 735, name: 'Direct' },
23
+ { value: 580, name: 'Email' },
24
+ { value: 484, name: 'Union Ads' },
25
+ { value: 300, name: 'Video Ads' }
26
+ ]
27
+ }
28
+ ],
29
+ };
30
+
31
+ const legends = {
32
+ top: { top: 0 },
33
+ bottom: { bottom: 0 },
34
+ left: { left: 5, top: "center" },
35
+ right: { right: 5, top: "center" },
36
+ leftTop: { left: 5 },
37
+ rightTop: { right: 5 },
38
+ leftBottom: { left: 5, bottom: 0 },
39
+ rightBottom: { right: 5, bottom: 0 },
40
+ }
41
+
42
+ export interface ChartComponentStyle {
43
+ tooltip?: { show: boolean };
44
+ color?: string[];
45
+ grid?: { top: number, let: number, right: number, bottom: number };
46
+ legend?: { [key: string]: any };
47
+ padAngle?: number;
48
+ radius?: number;
49
+ innerRadius?: number;
50
+ label?: { [key: string]: any };
51
+ labelLine?: { [key: string]: any };
52
+ }
53
+
54
+ export interface ChartComponentProps {
55
+ style?: ChartComponentStyle;
56
+ base: { width: number, height: number }
57
+ }
58
+
59
+ export interface BaseTextComponentRef {
60
+ updateConfig: (newConfig: ChartComponentProps) => void;
61
+ }
62
+
63
+ const Index = forwardRef((props: ChartComponentProps, ref: ForwardedRef<BaseTextComponentRef>) => {
64
+ const [config, setConfig] = useState<ChartComponentStyle>(props.style || {});
65
+ const [size, setSize] = useState<{ width: number, height: number }>()
66
+ const chartRef = useRef<HTMLDivElement>(null);
67
+ const chart = useRef<any>(null);
68
+
69
+ useImperativeHandle(ref, () => ({
70
+ updateConfig: (newConfig) => {
71
+ const { base, style } = newConfig;
72
+ setConfig({ ...(style || {}) });
73
+ setSize({ width: base.width, height: base.height });
74
+ },
75
+ }));
76
+
77
+ // 窗口大小变化时重新调整图表大小
78
+ const handleResize = () => {
79
+ chart.current.resize({ animation: { duration: 500 } });
80
+ };
81
+
82
+ useEffect(() => {
83
+ chart.current = echarts.init(chartRef.current);
84
+ window.addEventListener('resize', handleResize);
85
+ return () => {
86
+ window.removeEventListener('resize', handleResize);
87
+ chart.current.dispose();
88
+ }
89
+ }, []);
90
+
91
+ const renderChart = () => {
92
+ const { legend, tooltip, radius, innerRadius, color, label, labelLine, padAngle } = config;
93
+ const option = _.cloneDeep(defOption);
94
+ option.legend = { ...legend, ...legends[legend?.position] };
95
+ option.tooltip = { trigger: "item", ...tooltip };
96
+ option.color = color;
97
+ option.series = option.series.map((r) => ({
98
+ ...r,
99
+ radius: [`${innerRadius}%`, `${radius}%`],
100
+ padAngle,
101
+ label,
102
+ labelLine
103
+ }));
104
+ chart.current.setOption(option, true);
105
+ }
106
+ useEffect(() => {
107
+ if (config) {
108
+ renderChart();
109
+ }
110
+ }, [config]);
111
+
112
+ useEffect(() => {
113
+ if (size) {
114
+ handleResize();
115
+ }
116
+ }, [size]);
117
+
118
+ return <div ref={chartRef} style={{ width: '100%', height: '100%' }} />;
119
+ });
120
+
121
+ export default Index;
122
+
@@ -23,6 +23,7 @@ import Scrollbars from "react-custom-scrollbars";
23
23
  import { LocaleContext } from "../locale/LocaleProvider";
24
24
  import Draggable from 'react-draggable';
25
25
  import DraggableModal from "./draggable-modal";
26
+ import TmplConfigAnalysis from "../tmpl/tmpl-config-analysis";
26
27
 
27
28
 
28
29
  interface ModalEditorProps extends DtmplBaseProps {
@@ -314,11 +315,28 @@ export default class DtmplEditPage extends React.PureComponent<
314
315
  placement,
315
316
  maxColsOnRow,
316
317
  title,
317
- serverKey,
318
+ serverKey,parentFormInstance
318
319
  } = this.props;
319
320
  const { dtmplConfig, id, dtmplData } = this.state;
320
321
 
321
322
  let title1 = title ? title : dtmplConfig ? dtmplConfig.title : "";
323
+
324
+ //根据 parentFormInstance 完善 dtmplConfig
325
+ if(parentFormInstance && dtmplConfig){//
326
+ if (!dtmplConfig.buildInFuncFields) {
327
+ dtmplConfig.buildInFuncFields = TmplConfigAnalysis.buildInFuncFields(dtmplConfig);
328
+ }
329
+ for (let field of dtmplConfig.buildInFuncFields){
330
+ if(field.relValueField ){
331
+ if(!field.baseCriteria){
332
+ field.baseCriteria={}
333
+ }
334
+ field.baseCriteria={...field.baseCriteria,"secondCriteria":parentFormInstance.getFieldValue(field.relValueField.id)};
335
+ field.configChanged=true;
336
+ }
337
+ }
338
+ }
339
+
322
340
  return (
323
341
  <>
324
342
  {" "}
@@ -348,6 +366,7 @@ export default class DtmplEditPage extends React.PureComponent<
348
366
  showConfirm={false}
349
367
  dtmplData={dtmplData}
350
368
  onValuesChange={this.onValuesChange}
369
+ parentFormInstance={parentFormInstance}
351
370
  />
352
371
  </div>
353
372
  </Scrollbars>}
@@ -383,6 +402,7 @@ export default class DtmplEditPage extends React.PureComponent<
383
402
  showConfirm={false}
384
403
  dtmplData={dtmplData}
385
404
  onValuesChange={this.onValuesChange}
405
+ parentFormInstance={parentFormInstance}
386
406
  />
387
407
  </Drawer>
388
408
  ) : (
@@ -399,6 +419,7 @@ export default class DtmplEditPage extends React.PureComponent<
399
419
  showConfirm={false}
400
420
  dtmplData={dtmplData}
401
421
  onValuesChange={this.onValuesChange}
422
+ parentFormInstance={parentFormInstance}
402
423
  />
403
424
  </Card>
404
425
  )}
@@ -78,13 +78,13 @@ class DtmplRoute extends React.Component<DtmplRouteProps, DtmplRoutePropsStat> {
78
78
  };
79
79
 
80
80
  goBackToLtmpl = () => {
81
- this.props.navigate(-1);
81
+ //加tab页后不再支持返回列表
82
+ //this.props.navigate(-1);
82
83
  //this.props.navigate();
83
84
  };
84
85
 
85
86
  goNavigatel = () => {
86
- this.props.navigate(window.location.hash);
87
-
87
+ this.props.navigate(window.location.hash.replace("#/","/"));
88
88
  //.reload();
89
89
  };
90
90
 
@@ -4,9 +4,9 @@ import {
4
4
  message, Layout,Table
5
5
  } from "antd";
6
6
  import {
7
- DownloadOutlined,SettingOutlined, FundOutlined, LineChartOutlined,
7
+ ExportOutlined,SettingOutlined, FundOutlined, LineChartOutlined,
8
8
  PlusCircleOutlined, PlusOutlined, ReloadOutlined, RetweetOutlined, SearchOutlined,
9
- TableOutlined, UploadOutlined,
9
+ TableOutlined, ImportOutlined,
10
10
  } from "@ant-design/icons";
11
11
  import "./index.css";
12
12
  import {
@@ -717,7 +717,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
717
717
  marginLeft: "5px",
718
718
  }} //为了点击到没有导出模块,使组件不致销毁,丢失导出数据
719
719
  >
720
- {type == "ltmpl-data-excel" ? <DownloadOutlined /> : title}
720
+ {type == "ltmpl-data-excel" ? <ExportOutlined /> : title}
721
721
  </Button>
722
722
  </Tooltip>
723
723
  </Popover>
@@ -856,7 +856,7 @@ class ActTable extends React.PureComponent<ActTableProps, ActTableStat> {
856
856
  }/${sourceId}/importer?menuId=${menuId}`}
857
857
  target={"_blank"}
858
858
  >
859
- <UploadOutlined />
859
+ <ImportOutlined />
860
860
  </Button>
861
861
  </Tooltip>
862
862
  ) : (
@@ -41,6 +41,7 @@ import CountingTag from "../controls/counting-tag";
41
41
  import { LocaleContext } from "../locale/LocaleProvider";
42
42
  import VerticalList from "../list/vertical-list";
43
43
  import {EntryControl} from "../index";
44
+ import TmplConfigAnalysis from "../tmpl/tmpl-config-analysis";
44
45
 
45
46
 
46
47
  const FormItem = AntdForm.Item;
@@ -56,9 +57,9 @@ interface RelationTableProps {
56
57
  refreshId?: string;
57
58
  fieldGroupConfig: FieldGroupConfig;
58
59
  value: DtmplData[];
60
+ parentFormInstance?: FormInstance;
59
61
  onChange?: (fieldGroupConfig: FieldGroupConfig, value: DtmplData[]) => void;
60
62
  initCollapse?: boolean;
61
- // rowEditForm?: FormInstance;
62
63
  }
63
64
 
64
65
  interface RelationTableStat {
@@ -153,7 +154,7 @@ class RelationTable extends React.PureComponent<
153
154
  };
154
155
 
155
156
  buildColumns = () => {
156
- const { viewOrEdit, fieldGroupConfig, serverKey } = this.props;
157
+ const { viewOrEdit, fieldGroupConfig, serverKey,parentFormInstance } = this.props;
157
158
  const {
158
159
  buttons,
159
160
  fields,
@@ -177,11 +178,22 @@ class RelationTable extends React.PureComponent<
177
178
  if (s < 12 && item.sortable) {
178
179
  TableUnits.sort(column, itemType);
179
180
  }
181
+ //配置字段的 默认次过滤条件
182
+ if(item.relValueField ){
183
+ if(!item.baseCriteria){
184
+ item.baseCriteria={}
185
+ }
186
+ item.baseCriteria={...item.baseCriteria,"secondCriteria":parentFormInstance.getFieldValue(item.relValueField.id)};
187
+ item.configChanged=true;
188
+ }
180
189
  column["render"] = (text, record) => {
181
190
 
182
191
  return (editings.indexOf(record.code)>=0?
183
192
 
184
- <FormItem style={{margin:0}} name={record.code+"_"+item.id} key={record.code+"_"+item.id}
193
+ <FormItem style={{margin:0}}
194
+ name={record.code+"_"+item.id}
195
+ key={record.code+"_"+item.id}
196
+ rules={TmplConfigAnalysis.getRules(item,translate)}
185
197
  initialValue={record[item.id]} >
186
198
  <EntryControl
187
199
  serverKey={serverKey}
@@ -548,8 +560,6 @@ class RelationTable extends React.PureComponent<
548
560
  if (value) {
549
561
  datas = [...value];
550
562
  }
551
-
552
- debugger
553
563
  let isAdd = true;
554
564
  for (let v of datas) {
555
565
  if (v.code == dtmplData.code) {
@@ -649,16 +659,17 @@ class RelationTable extends React.PureComponent<
649
659
  let dtmplData:DtmplData = {code};
650
660
  dtmplData.fieldMap={};
651
661
  dtmplData.editStatus="changed";
662
+
652
663
  await currentForm.validateFields().then(async (values) => {
653
664
  for (let key in values) {
654
665
  if (values.hasOwnProperty(key) && key.startsWith(code)) {
655
666
  dtmplData.fieldMap[key.split("_")[1]]=values[key];
656
667
  }
657
668
  }
669
+ this.cancelRowEdit(code);
670
+ this.handleRowEdit(dtmplData);
658
671
  }).catch(errorInfo => {
659
672
  })
660
- this.cancelRowEdit(code);
661
- this.handleRowEdit(dtmplData);
662
673
  }
663
674
 
664
675
  cancelRowEdit=(code:string)=>{
@@ -818,7 +829,7 @@ class RelationTable extends React.PureComponent<
818
829
  initCollapse,
819
830
  mainCode,
820
831
  serverKey,
821
- showRightNav,
832
+ showRightNav,parentFormInstance
822
833
  } = this.props;
823
834
  const {
824
835
  pageSize,
@@ -922,6 +933,7 @@ class RelationTable extends React.PureComponent<
922
933
  onCancel={this.hiddenEntityEdit}
923
934
  sourceId={fieldGroupConfig.id}
924
935
  code={selectedCode}
936
+ parentFormInstance={parentFormInstance}
925
937
  onOk={selectedCode ? this.handleDtmplEdit : this.handleDtmplAdd}
926
938
  />
927
939
  ) : (
@@ -35,7 +35,7 @@ SupportInputTypes.add('progress');
35
35
  SupportInputTypes.add('password');
36
36
  SupportInputTypes.add('preselect');
37
37
  SupportInputTypes.add('select');
38
- SupportInputTypes.add('select');
38
+ SupportInputTypes.add('multiselect');
39
39
  SupportInputTypes.add('checkbox');
40
40
  SupportInputTypes.add('radio');
41
41
  SupportInputTypes.add('yes-no-select');
@@ -110,7 +110,6 @@ export interface FieldBase extends OrderableTmplBase {
110
110
  }
111
111
 
112
112
  export interface DtmplFormProps extends DtmplBaseProps {
113
- parentId: string;
114
113
  dtmplConfig: DtmplConfig;
115
114
  dtmplData?: DtmplData;
116
115
  formRef: RefObject<FormInstance>;
@@ -118,6 +117,7 @@ export interface DtmplFormProps extends DtmplBaseProps {
118
117
  showHeader?: boolean;
119
118
  onFinish: (code: string|boolean) => void;
120
119
  onValuesChange?: () => void;
120
+
121
121
  }
122
122
 
123
123
  export interface CQueryConfig extends OrderableTmplBase {
@@ -333,6 +333,10 @@ export interface FieldGroupConfig extends OrderableTmplBase {
333
333
 
334
334
  export type SaveJumpType = "list" | "add" | "edit";
335
335
 
336
+ // export interface OnValuesChangeExtendParams {
337
+ // parentFormInstance?:FormInstance
338
+ // }
339
+
336
340
  export interface DtmplConfig extends TmplBase {
337
341
  autoSaveInterval?: number;
338
342
  //exportExcel fusionMode history dtmplSave refresh
@@ -352,7 +356,8 @@ export interface DtmplConfig extends TmplBase {
352
356
  onValuesChange?: (
353
357
  changedValues,
354
358
  allValues: DtmplData,
355
- formInstance: FormInstance
359
+ formInstance: FormInstance,
360
+ // extendParams?:OnValuesChangeExtendParams
356
361
  ) => void;
357
362
  entity?: DtmplData;
358
363
  dynamic?: boolean;
@@ -674,6 +679,8 @@ export interface DtmplBaseProps extends TmplBaseProps {
674
679
  goDtmpl?: (code?: string) => void;
675
680
  maxColsOnRow?: number;
676
681
  addTmplId?: string;
682
+ parentId?: string;
683
+ parentFormInstance?: FormInstance;
677
684
  }
678
685
 
679
686
  export interface ChartConfig {
@@ -328,6 +328,24 @@ TmplConfigAnalysis.getRelMstrucFieldId = (
328
328
  : undefined;
329
329
  return rmstrucId;
330
330
  };
331
+ TmplConfigAnalysis.buildInFuncFields=(dtmplConfig: DtmplConfig)=> {
332
+ let buildInFuncFields = [];
333
+ for (let group of dtmplConfig.groups) {
334
+ for (let field of group.fields) {
335
+ if (
336
+ (field.requiredRuleCriterias &&
337
+ field.requiredRuleCriterias.length > 0) ||
338
+ (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
339
+ || field.relValueField
340
+ ) {
341
+ field.shouldUpdate = true;
342
+ buildInFuncFields.push(field);
343
+ }
344
+ }
345
+ }
346
+ return buildInFuncFields;
347
+ }
348
+
331
349
 
332
350
  TmplConfigAnalysis.buildInDtmplConfig = (
333
351
  dtmplConfig: DtmplConfig,
@@ -336,20 +354,20 @@ TmplConfigAnalysis.buildInDtmplConfig = (
336
354
  ) => {
337
355
  if (!dtmplConfig.buildInFuncFields) {
338
356
  //先找到有业务的
339
- let buildInFuncFields = [];
340
- for (let group of dtmplConfig.groups) {
341
- for (let field of group.fields) {
342
- if (
343
- (field.requiredRuleCriterias &&
344
- field.requiredRuleCriterias.length > 0) ||
345
- (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
346
- || field.relValueField
347
- ) {
348
- field.shouldUpdate = true;
349
- buildInFuncFields.push(field);
350
- }
351
- }
352
- }
357
+ let buildInFuncFields = TmplConfigAnalysis.buildInFuncFields(dtmplConfig);
358
+ // for (let group of dtmplConfig.groups) {
359
+ // for (let field of group.fields) {
360
+ // if (
361
+ // (field.requiredRuleCriterias &&
362
+ // field.requiredRuleCriterias.length > 0) ||
363
+ // (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
364
+ // || field.relValueField
365
+ // ) {
366
+ // field.shouldUpdate = true;
367
+ // buildInFuncFields.push(field);
368
+ // }
369
+ // }
370
+ // }
353
371
  dtmplConfig.buildInFuncFields = buildInFuncFields;
354
372
  }
355
373
  if (dtmplConfig.buildInFuncFields.length > 0) {
@@ -419,6 +437,26 @@ TmplConfigAnalysis.buildInDtmplConfig = (
419
437
  }
420
438
  };
421
439
 
440
+ TmplConfigAnalysis.getRules=(fieldConfig:FieldConfig,translate)=>{
441
+ let rules=[];
442
+ let title=fieldConfig.title;
443
+ if(fieldConfig.required){
444
+ rules.push({
445
+ required: true,
446
+ message: translate("${请输入}${" + title + "}"),
447
+ });
448
+ }
449
+
450
+ let rulePattern=fieldConfig.rules[0]?.pattern;
451
+ if(rulePattern){
452
+ rules.push({
453
+ pattern:rulePattern,
454
+ message:translate("${" + title + "}${格式有误}"),
455
+ })
456
+ }
457
+ return rules;
458
+ }
459
+
422
460
  TmplConfigAnalysis.buildInCtmplConfig = (
423
461
  ltmplConfig:SelectConfig,
424
462
  criteriaData,
@@ -488,4 +526,6 @@ TmplConfigAnalysis.buildInCtmplConfig = (
488
526
  }
489
527
  };
490
528
 
529
+
530
+
491
531
  export default TmplConfigAnalysis;