aldehyde 0.2.290 → 0.2.292

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 (174) hide show
  1. package/lib/lowcode-components/act-table/index.js +1 -1
  2. package/lib/lowcode-components/act-table/index.js.map +1 -1
  3. package/lib/lowcode-components/bar-chart/index.d.ts +1 -0
  4. package/lib/lowcode-components/bar-chart/index.d.ts.map +1 -1
  5. package/lib/lowcode-components/bar-chart/index.js +8 -3
  6. package/lib/lowcode-components/bar-chart/index.js.map +1 -1
  7. package/lib/lowcode-components/border/border11/index.d.ts.map +1 -1
  8. package/lib/lowcode-components/border/border11/index.js +4 -3
  9. package/lib/lowcode-components/border/border11/index.js.map +1 -1
  10. package/lib/lowcode-components/border/border12/index.d.ts.map +1 -1
  11. package/lib/lowcode-components/border/border12/index.js +5 -4
  12. package/lib/lowcode-components/border/border12/index.js.map +1 -1
  13. package/lib/lowcode-components/border/border13/index.d.ts.map +1 -1
  14. package/lib/lowcode-components/border/border13/index.js +4 -3
  15. package/lib/lowcode-components/border/border13/index.js.map +1 -1
  16. package/lib/lowcode-components/border/border2/index.d.ts.map +1 -1
  17. package/lib/lowcode-components/border/border2/index.js +4 -3
  18. package/lib/lowcode-components/border/border2/index.js.map +1 -1
  19. package/lib/lowcode-components/border/border3/index.d.ts.map +1 -1
  20. package/lib/lowcode-components/border/border3/index.js +4 -3
  21. package/lib/lowcode-components/border/border3/index.js.map +1 -1
  22. package/lib/lowcode-components/border/border4/index.d.ts.map +1 -1
  23. package/lib/lowcode-components/border/border4/index.js +4 -3
  24. package/lib/lowcode-components/border/border4/index.js.map +1 -1
  25. package/lib/lowcode-components/border/border5/index.d.ts.map +1 -1
  26. package/lib/lowcode-components/border/border5/index.js +4 -3
  27. package/lib/lowcode-components/border/border5/index.js.map +1 -1
  28. package/lib/lowcode-components/border/border6/index.d.ts.map +1 -1
  29. package/lib/lowcode-components/border/border6/index.js +4 -3
  30. package/lib/lowcode-components/border/border6/index.js.map +1 -1
  31. package/lib/lowcode-components/border/border7/index.d.ts.map +1 -1
  32. package/lib/lowcode-components/border/border7/index.js +4 -3
  33. package/lib/lowcode-components/border/border7/index.js.map +1 -1
  34. package/lib/lowcode-components/border/border8/index.d.ts.map +1 -1
  35. package/lib/lowcode-components/border/border8/index.js +4 -3
  36. package/lib/lowcode-components/border/border8/index.js.map +1 -1
  37. package/lib/lowcode-components/border/border9/index.d.ts.map +1 -1
  38. package/lib/lowcode-components/border/border9/index.js +4 -3
  39. package/lib/lowcode-components/border/border9/index.js.map +1 -1
  40. package/lib/lowcode-components/capsule-bar-chart/index.d.ts +1 -0
  41. package/lib/lowcode-components/capsule-bar-chart/index.d.ts.map +1 -1
  42. package/lib/lowcode-components/capsule-bar-chart/index.js +8 -3
  43. package/lib/lowcode-components/capsule-bar-chart/index.js.map +1 -1
  44. package/lib/lowcode-components/circular-progress-chart/index.d.ts +1 -0
  45. package/lib/lowcode-components/circular-progress-chart/index.d.ts.map +1 -1
  46. package/lib/lowcode-components/circular-progress-chart/index.js +8 -3
  47. package/lib/lowcode-components/circular-progress-chart/index.js.map +1 -1
  48. package/lib/lowcode-components/column-chart/index.d.ts +1 -0
  49. package/lib/lowcode-components/column-chart/index.d.ts.map +1 -1
  50. package/lib/lowcode-components/column-chart/index.js +8 -3
  51. package/lib/lowcode-components/column-chart/index.js.map +1 -1
  52. package/lib/lowcode-components/data-number/index.d.ts +1 -0
  53. package/lib/lowcode-components/data-number/index.d.ts.map +1 -1
  54. package/lib/lowcode-components/data-number/index.js +4 -4
  55. package/lib/lowcode-components/data-number/index.js.map +1 -1
  56. package/lib/lowcode-components/decoration/decoration1/index.d.ts.map +1 -1
  57. package/lib/lowcode-components/decoration/decoration1/index.js +4 -3
  58. package/lib/lowcode-components/decoration/decoration1/index.js.map +1 -1
  59. package/lib/lowcode-components/decoration/decoration10/index.d.ts.map +1 -1
  60. package/lib/lowcode-components/decoration/decoration10/index.js +4 -3
  61. package/lib/lowcode-components/decoration/decoration10/index.js.map +1 -1
  62. package/lib/lowcode-components/decoration/decoration11/index.d.ts.map +1 -1
  63. package/lib/lowcode-components/decoration/decoration11/index.js +6 -5
  64. package/lib/lowcode-components/decoration/decoration11/index.js.map +1 -1
  65. package/lib/lowcode-components/decoration/decoration2/index.d.ts.map +1 -1
  66. package/lib/lowcode-components/decoration/decoration2/index.js +4 -3
  67. package/lib/lowcode-components/decoration/decoration2/index.js.map +1 -1
  68. package/lib/lowcode-components/decoration/decoration3/index.d.ts.map +1 -1
  69. package/lib/lowcode-components/decoration/decoration3/index.js +4 -3
  70. package/lib/lowcode-components/decoration/decoration3/index.js.map +1 -1
  71. package/lib/lowcode-components/decoration/decoration4/index.d.ts.map +1 -1
  72. package/lib/lowcode-components/decoration/decoration4/index.js +3 -2
  73. package/lib/lowcode-components/decoration/decoration4/index.js.map +1 -1
  74. package/lib/lowcode-components/decoration/decoration5/index.d.ts.map +1 -1
  75. package/lib/lowcode-components/decoration/decoration5/index.js +4 -3
  76. package/lib/lowcode-components/decoration/decoration5/index.js.map +1 -1
  77. package/lib/lowcode-components/decoration/decoration6/index.d.ts.map +1 -1
  78. package/lib/lowcode-components/decoration/decoration6/index.js +4 -3
  79. package/lib/lowcode-components/decoration/decoration6/index.js.map +1 -1
  80. package/lib/lowcode-components/decoration/decoration7/index.d.ts.map +1 -1
  81. package/lib/lowcode-components/decoration/decoration7/index.js +4 -3
  82. package/lib/lowcode-components/decoration/decoration7/index.js.map +1 -1
  83. package/lib/lowcode-components/decoration/decoration8/index.d.ts.map +1 -1
  84. package/lib/lowcode-components/decoration/decoration8/index.js +5 -5
  85. package/lib/lowcode-components/decoration/decoration8/index.js.map +1 -1
  86. package/lib/lowcode-components/decoration/decoration9/index.d.ts.map +1 -1
  87. package/lib/lowcode-components/decoration/decoration9/index.js +11 -11
  88. package/lib/lowcode-components/decoration/decoration9/index.js.map +1 -1
  89. package/lib/lowcode-components/gauge-chart/index.d.ts +1 -0
  90. package/lib/lowcode-components/gauge-chart/index.d.ts.map +1 -1
  91. package/lib/lowcode-components/gauge-chart/index.js +8 -3
  92. package/lib/lowcode-components/gauge-chart/index.js.map +1 -1
  93. package/lib/lowcode-components/index.d.ts +2 -0
  94. package/lib/lowcode-components/index.d.ts.map +1 -1
  95. package/lib/lowcode-components/index.js +2 -1
  96. package/lib/lowcode-components/index.js.map +1 -1
  97. package/lib/lowcode-components/line-chart/index.d.ts +1 -0
  98. package/lib/lowcode-components/line-chart/index.d.ts.map +1 -1
  99. package/lib/lowcode-components/line-chart/index.js +8 -3
  100. package/lib/lowcode-components/line-chart/index.js.map +1 -1
  101. package/lib/lowcode-components/liquid-chart/index.d.ts +1 -0
  102. package/lib/lowcode-components/liquid-chart/index.d.ts.map +1 -1
  103. package/lib/lowcode-components/liquid-chart/index.js +8 -3
  104. package/lib/lowcode-components/liquid-chart/index.js.map +1 -1
  105. package/lib/lowcode-components/lowcode-view/component/assets.d.ts.map +1 -1
  106. package/lib/lowcode-components/lowcode-view/component/assets.js +8 -0
  107. package/lib/lowcode-components/lowcode-view/component/assets.js.map +1 -1
  108. package/lib/lowcode-components/pie-chart/index.d.ts +5 -0
  109. package/lib/lowcode-components/pie-chart/index.d.ts.map +1 -1
  110. package/lib/lowcode-components/pie-chart/index.js +11 -5
  111. package/lib/lowcode-components/pie-chart/index.js.map +1 -1
  112. package/lib/lowcode-components/progress-chart/index.d.ts +37 -0
  113. package/lib/lowcode-components/progress-chart/index.d.ts.map +1 -0
  114. package/lib/lowcode-components/progress-chart/index.js +189 -0
  115. package/lib/lowcode-components/progress-chart/index.js.map +1 -0
  116. package/lib/routable/import-route.js +1 -1
  117. package/lib/routable/import-route.js.map +1 -1
  118. package/lib/routable/ltmpl-route.js +2 -2
  119. package/lib/routable/ltmpl-route.js.map +1 -1
  120. package/lib/table/act-table.d.ts +3 -1
  121. package/lib/table/act-table.d.ts.map +1 -1
  122. package/lib/table/act-table.js +15 -9
  123. package/lib/table/act-table.js.map +1 -1
  124. package/lib/table/select-table.js +2 -2
  125. package/lib/table/select-table.js.map +1 -1
  126. package/lib/tmpl/control-type-supportor.d.ts +1 -0
  127. package/lib/tmpl/control-type-supportor.d.ts.map +1 -1
  128. package/lib/tmpl/control-type-supportor.js +9 -0
  129. package/lib/tmpl/control-type-supportor.js.map +1 -1
  130. package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
  131. package/lib/tmpl/tmpl-config-analysis.js +8 -1
  132. package/lib/tmpl/tmpl-config-analysis.js.map +1 -1
  133. package/package.json +1 -1
  134. package/src/aldehyde/lowcode-components/act-table/index.tsx +1 -1
  135. package/src/aldehyde/lowcode-components/bar-chart/index.tsx +10 -3
  136. package/src/aldehyde/lowcode-components/border/border11/index.tsx +4 -3
  137. package/src/aldehyde/lowcode-components/border/border12/index.tsx +5 -4
  138. package/src/aldehyde/lowcode-components/border/border13/index.tsx +4 -3
  139. package/src/aldehyde/lowcode-components/border/border2/index.tsx +4 -3
  140. package/src/aldehyde/lowcode-components/border/border3/index.tsx +4 -3
  141. package/src/aldehyde/lowcode-components/border/border4/index.tsx +4 -3
  142. package/src/aldehyde/lowcode-components/border/border5/index.tsx +4 -3
  143. package/src/aldehyde/lowcode-components/border/border6/index.tsx +4 -3
  144. package/src/aldehyde/lowcode-components/border/border7/index.tsx +4 -3
  145. package/src/aldehyde/lowcode-components/border/border8/index.tsx +4 -3
  146. package/src/aldehyde/lowcode-components/border/border9/index.tsx +4 -3
  147. package/src/aldehyde/lowcode-components/capsule-bar-chart/index.tsx +10 -3
  148. package/src/aldehyde/lowcode-components/circular-progress-chart/index.tsx +11 -3
  149. package/src/aldehyde/lowcode-components/column-chart/index.tsx +9 -3
  150. package/src/aldehyde/lowcode-components/data-number/index.tsx +9 -6
  151. package/src/aldehyde/lowcode-components/decoration/decoration1/index.tsx +4 -3
  152. package/src/aldehyde/lowcode-components/decoration/decoration10/index.tsx +4 -3
  153. package/src/aldehyde/lowcode-components/decoration/decoration11/index.tsx +6 -5
  154. package/src/aldehyde/lowcode-components/decoration/decoration2/index.tsx +4 -3
  155. package/src/aldehyde/lowcode-components/decoration/decoration3/index.tsx +4 -3
  156. package/src/aldehyde/lowcode-components/decoration/decoration4/index.tsx +3 -2
  157. package/src/aldehyde/lowcode-components/decoration/decoration5/index.tsx +4 -3
  158. package/src/aldehyde/lowcode-components/decoration/decoration6/index.tsx +4 -3
  159. package/src/aldehyde/lowcode-components/decoration/decoration7/index.tsx +4 -3
  160. package/src/aldehyde/lowcode-components/decoration/decoration8/index.tsx +5 -4
  161. package/src/aldehyde/lowcode-components/decoration/decoration9/index.tsx +11 -10
  162. package/src/aldehyde/lowcode-components/gauge-chart/index.tsx +9 -3
  163. package/src/aldehyde/lowcode-components/index.ts +4 -2
  164. package/src/aldehyde/lowcode-components/line-chart/index.tsx +11 -4
  165. package/src/aldehyde/lowcode-components/liquid-chart/index.tsx +11 -4
  166. package/src/aldehyde/lowcode-components/lowcode-view/component/assets.ts +8 -0
  167. package/src/aldehyde/lowcode-components/pie-chart/index.tsx +14 -4
  168. package/src/aldehyde/lowcode-components/progress-chart/index.tsx +235 -0
  169. package/src/aldehyde/routable/import-route.tsx +1 -1
  170. package/src/aldehyde/routable/ltmpl-route.tsx +2 -2
  171. package/src/aldehyde/table/act-table.tsx +19 -23
  172. package/src/aldehyde/table/select-table.tsx +2 -2
  173. package/src/aldehyde/tmpl/control-type-supportor.tsx +9 -0
  174. package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +487 -475
@@ -1,553 +1,565 @@
1
1
  // import moment, {DurationInputArg2} from "moment";
2
2
 
3
- import dayjs, { ManipulateType } from "dayjs";
3
+ import dayjs, {ManipulateType} from "dayjs";
4
4
  import {
5
- DtmplConfig,
6
- DtmplData,
7
- DtmplFormProps,
8
- FieldConfig,
9
- FieldGroupConfig,
10
- LtmplConfig, SelectConfig,
5
+ DtmplConfig,
6
+ DtmplData,
7
+ DtmplFormProps,
8
+ FieldConfig,
9
+ FieldGroupConfig,
10
+ LtmplConfig, SelectConfig,
11
11
  } from "./interface";
12
- import { FormInstance } from "antd";
12
+ import {FormInstance} from "antd";
13
13
  import ActionUtils from "../controls/action/utils";
14
14
  import {CriteriaFormProps} from "../form/criteria-form";
15
15
  import ControlTypeSupportor from "./control-type-supportor";
16
16
 
17
- function TmplConfigAnalysis() {}
17
+ function TmplConfigAnalysis() {
18
+ }
18
19
 
19
- TmplConfigAnalysis.current = function(
20
- currentConfig: string,
21
- format_1?: string
20
+ TmplConfigAnalysis.current = function (
21
+ currentConfig: string,
22
+ format_1?: string
22
23
  ) {
23
- // debugger
24
- let format = format_1;
25
- if (!format) {
26
- format = "YYYY-MM-DD HH:mm:ss SSS";
27
- }
28
- if (!currentConfig) {
29
- return null;
30
- }
31
- let configs = [currentConfig];
32
- if (currentConfig.includes("~")) {
33
- configs = currentConfig.split("~");
34
- }
35
-
36
- let values: string[] = [];
37
- for (let i in configs) {
38
- let v = this.currentL1(configs[i], format);
39
- if (v) {
40
- values[i] = v;
24
+ // debugger
25
+ let format = format_1;
26
+ if (!format) {
27
+ format = "YYYY-MM-DD HH:mm:ss SSS";
28
+ }
29
+ if (!currentConfig) {
30
+ return null;
31
+ }
32
+ let configs = [currentConfig];
33
+ if (currentConfig.includes("~")) {
34
+ configs = currentConfig.split("~");
35
+ }
36
+
37
+ let values: string[] = [];
38
+ for (let i in configs) {
39
+ let v = this.currentL1(configs[i], format);
40
+ if (v) {
41
+ values[i] = v;
42
+ } else {
43
+ values[i] = "";
44
+ }
45
+ }
46
+ if (configs.length == 1) {
47
+ return values[0];
41
48
  } else {
42
- values[i] = "";
49
+ return values[0] + "~" + values[1];
43
50
  }
44
- }
45
- if (configs.length == 1) {
46
- return values[0];
47
- } else {
48
- return values[0] + "~" + values[1];
49
- }
50
51
  };
51
52
 
52
- TmplConfigAnalysis.currentL1 = function(config: string, format: string) {
53
- if (!config) {
54
- return null;
55
- }
56
-
57
- let config_=config.replace("max","a").replace("min","i");
58
- // debugger
59
- //解析模式 className={'course-box-80'}:(-/+)NX,$$current为固定模式
60
- // regx2=new RegExp("(\$\$current):?([-,+]?)(\d?)([D,M,Y,m,s,h]?)");
61
- var regx2 = new RegExp(
62
- "current([D,M,Y,m,s,h]?):?([-,+]?)([0-9]*)([D,M,Y,m,s,h]?)([a,i]?)([D,M,Y,m,s,h]?)"
63
- );
64
- // regx2=new RegExp("current");
65
- let match = regx2.exec(config_);
66
- if (match) {
67
-
68
- let unit = match[4];
69
- // debugger
70
- //没有单位
71
- let date= dayjs();
72
- if (unit != "") {
73
- //系数
74
- let symbol = match[2];
75
- if (symbol == "") {
76
- symbol = "+";
77
- }
78
- let nstr = match[3];
79
- if (nstr == "") {
80
- nstr = "1";
81
- }
82
- let n: number = parseInt(nstr);
83
- let dayjsUnit: ManipulateType = "days";
84
- switch (unit) {
85
- case "D":
86
- dayjsUnit = "days";
87
- break;
88
- case "M":
89
- dayjsUnit = "months";
90
- break;
91
- case "Y":
92
- dayjsUnit = "years";
93
- break;
94
- case "W":
95
- dayjsUnit = "weeks";
96
- break;
97
- case "h":
98
- dayjsUnit = "hours";
99
- break;
100
- case "m":
101
- dayjsUnit = "minutes";
102
- break;
103
- case "s":
104
- dayjsUnit = "seconds";
105
- break;
106
- }
107
-
108
- if (symbol == "-") {
109
- date = date.subtract(n, dayjsUnit);
110
- } else {
111
- date= date.add(n, dayjsUnit);
112
- }
53
+ TmplConfigAnalysis.currentL1 = function (config: string, format: string) {
54
+ if (!config) {
55
+ return null;
113
56
  }
114
57
 
58
+ let config_ = config.replace("max", "a").replace("min", "i");
59
+ // debugger
60
+ //解析模式 className={'course-box-80'}:(-/+)NX,$$current为固定模式
61
+ // regx2=new RegExp("(\$\$current):?([-,+]?)(\d?)([D,M,Y,m,s,h]?)");
62
+ var regx2 = new RegExp(
63
+ "current([D,M,Y,m,s,h]?):?([-,+]?)([0-9]*)([D,M,Y,m,s,h]?)([a,i]?)([D,M,Y,m,s,h]?)"
64
+ );
65
+ // regx2=new RegExp("current");
66
+ let match = regx2.exec(config_);
67
+ if (match) {
68
+
69
+ let unit = match[4];
70
+ // debugger
71
+ //没有单位
72
+ let date = dayjs();
73
+ if (unit != "") {
74
+ //系数
75
+ let symbol = match[2];
76
+ if (symbol == "") {
77
+ symbol = "+";
78
+ }
79
+ let nstr = match[3];
80
+ if (nstr == "") {
81
+ nstr = "1";
82
+ }
83
+ let n: number = parseInt(nstr);
84
+ let dayjsUnit: ManipulateType = "days";
85
+ switch (unit) {
86
+ case "D":
87
+ dayjsUnit = "days";
88
+ break;
89
+ case "M":
90
+ dayjsUnit = "months";
91
+ break;
92
+ case "Y":
93
+ dayjsUnit = "years";
94
+ break;
95
+ case "W":
96
+ dayjsUnit = "weeks";
97
+ break;
98
+ case "h":
99
+ dayjsUnit = "hours";
100
+ break;
101
+ case "m":
102
+ dayjsUnit = "minutes";
103
+ break;
104
+ case "s":
105
+ dayjsUnit = "seconds";
106
+ break;
107
+ }
108
+
109
+ if (symbol == "-") {
110
+ date = date.subtract(n, dayjsUnit);
111
+ } else {
112
+ date = date.add(n, dayjsUnit);
113
+ }
114
+ }
115
115
 
116
- let minOrMax= match[5];
117
- let minOrMaxUnit= match[6];
118
- if(minOrMax != "" || minOrMaxUnit!= ""){
119
- if(minOrMax==""){
120
- minOrMax="i";
121
- }
122
- if(minOrMaxUnit== ""){
123
- minOrMaxUnit="h";
124
- }
125
- switch (minOrMaxUnit) {
126
- case "D":
127
- if(minOrMax=="a"){
128
- date = date.endOf("day");
129
- }else{
130
- date = date.startOf("day");
131
- }
132
- break;
133
- case "M":
134
- if(minOrMax=="a"){
135
- date = date.endOf("month");
136
- }else{
137
- date = date.startOf("month");
138
- }
139
- break;
140
- case "Y":
141
- if(minOrMax=="a"){
142
- date = date.endOf("year");
143
- }else{
144
- date = date.startOf("year");
145
- }
146
- break;
147
- case "h":
148
- if(minOrMax=="a"){
149
- date = date.endOf("hour");
150
- }else{
151
- date = date.startOf("hour");
152
- }
153
- break;
154
- case "m":
155
- if(minOrMax=="a"){
156
- date = date.endOf("minute");
157
- }else{
158
- date = date.startOf("minute");
159
- }
160
- break;
161
- case "s":
162
- if(minOrMax=="a"){
163
- date = date.endOf("second");
164
- }else{
165
- date = date.startOf("second");
166
- }
167
- break;
168
- }
169
- }
170
116
 
171
- //根据配置设置时间置零位
172
- let zeroUnit = match[1];
173
-
174
- let format_=format;
175
- switch (zeroUnit) {
176
- case "D":
177
- date = date.startOf("day");
178
- format_ = "YYYY-MM-DD";
179
- break;
180
- case "M":
181
- date = date.startOf("month");
182
- format_ = "YYYY-MM";
183
- break;
184
- case "Y":
185
- date = date.startOf("year");
186
- format_ = "YYYY";
187
- break;
188
- case "h":
189
- date = date.startOf("hour");
190
- format_ = "YYYY-MM-DD HH";
191
- break;
192
- case "m":
193
- date = date.startOf("minute");
194
- format_ = "YYYY-MM-DD HH:mm";
195
- break;
196
- case "s":
197
- date = date.startOf("second");
198
- format_ = "YYYY-MM-DD HH:mm:ss";
199
- break;
200
- }
201
- return date.format(format_);
117
+ let minOrMax = match[5];
118
+ let minOrMaxUnit = match[6];
119
+ if (minOrMax != "" || minOrMaxUnit != "") {
120
+ if (minOrMax == "") {
121
+ minOrMax = "i";
122
+ }
123
+ if (minOrMaxUnit == "") {
124
+ minOrMaxUnit = "h";
125
+ }
126
+ switch (minOrMaxUnit) {
127
+ case "D":
128
+ if (minOrMax == "a") {
129
+ date = date.endOf("day");
130
+ } else {
131
+ date = date.startOf("day");
132
+ }
133
+ break;
134
+ case "M":
135
+ if (minOrMax == "a") {
136
+ date = date.endOf("month");
137
+ } else {
138
+ date = date.startOf("month");
139
+ }
140
+ break;
141
+ case "Y":
142
+ if (minOrMax == "a") {
143
+ date = date.endOf("year");
144
+ } else {
145
+ date = date.startOf("year");
146
+ }
147
+ break;
148
+ case "h":
149
+ if (minOrMax == "a") {
150
+ date = date.endOf("hour");
151
+ } else {
152
+ date = date.startOf("hour");
153
+ }
154
+ break;
155
+ case "m":
156
+ if (minOrMax == "a") {
157
+ date = date.endOf("minute");
158
+ } else {
159
+ date = date.startOf("minute");
160
+ }
161
+ break;
162
+ case "s":
163
+ if (minOrMax == "a") {
164
+ date = date.endOf("second");
165
+ } else {
166
+ date = date.startOf("second");
167
+ }
168
+ break;
169
+ }
170
+ }
171
+
172
+ //根据配置设置时间置零位
173
+ let zeroUnit = match[1];
174
+
175
+ let format_ = format;
176
+ switch (zeroUnit) {
177
+ case "D":
178
+ date = date.startOf("day");
179
+ format_ = "YYYY-MM-DD";
180
+ break;
181
+ case "M":
182
+ date = date.startOf("month");
183
+ format_ = "YYYY-MM";
184
+ break;
185
+ case "Y":
186
+ date = date.startOf("year");
187
+ format_ = "YYYY";
188
+ break;
189
+ case "h":
190
+ date = date.startOf("hour");
191
+ format_ = "YYYY-MM-DD HH";
192
+ break;
193
+ case "m":
194
+ date = date.startOf("minute");
195
+ format_ = "YYYY-MM-DD HH:mm";
196
+ break;
197
+ case "s":
198
+ date = date.startOf("second");
199
+ format_ = "YYYY-MM-DD HH:mm:ss";
200
+ break;
201
+ }
202
+ return date.format(format_);
202
203
 
203
- } else {
204
- return null;
205
- }
204
+ } else {
205
+ return null;
206
+ }
206
207
  };
207
208
 
208
209
  TmplConfigAnalysis.getFieldValueTitleOfMstrucId = (
209
- config: DtmplConfig | LtmplConfig,
210
- fieldMap: object,
211
- mstrucId: string,
212
- defaultValue?: string
210
+ config: DtmplConfig | LtmplConfig,
211
+ fieldMap: object,
212
+ mstrucId: string,
213
+ defaultValue?: string
213
214
  ) => {
214
- let fieldId = TmplConfigAnalysis.getFieldId(config, mstrucId);
215
-
216
- let val: string = fieldMap && fieldMap[fieldId];
217
- if (val == "null" || !val) {
218
- val = null;
219
- } else if (Array.isArray(val)) {
220
- let val1 = "";
221
- val.forEach((v) => {
222
- if (v.indexOf("@R@") > 0) {
223
- val1 = v.split("@R@")[1] + ",";
224
- } else {
225
- val1 = v + ",";
226
- }
227
- });
228
- val = val1.substring(0, val1.lastIndexOf(","));
229
- }
230
- if (val) {
231
- val = val.indexOf("@R@") > 0 ? val.split("@R@")[1] : val;
232
- } else {
233
- return defaultValue;
234
- }
235
-
236
- return val;
215
+ let fieldId = TmplConfigAnalysis.getFieldId(config, mstrucId);
216
+
217
+ let val: string = fieldMap && fieldMap[fieldId];
218
+ if (val == "null" || !val) {
219
+ val = null;
220
+ } else if (Array.isArray(val)) {
221
+ let val1 = "";
222
+ val.forEach((v) => {
223
+ if (v.indexOf("@R@") > 0) {
224
+ val1 = v.split("@R@")[1] + ",";
225
+ } else {
226
+ val1 = v + ",";
227
+ }
228
+ });
229
+ val = val1.substring(0, val1.lastIndexOf(","));
230
+ }
231
+ if (val) {
232
+ val = val.indexOf("@R@") > 0 ? val.split("@R@")[1] : val;
233
+ } else {
234
+ return defaultValue;
235
+ }
236
+
237
+ return val;
237
238
  };
238
239
 
239
240
  TmplConfigAnalysis.getFieldValueCodeOfMstrucId = (
240
- config: DtmplConfig | LtmplConfig,
241
- fieldMap: object,
242
- mstrucId: string,
243
- defaultValue?: string
241
+ config: DtmplConfig | LtmplConfig,
242
+ fieldMap: object,
243
+ mstrucId: string,
244
+ defaultValue?: string
244
245
  ) => {
245
- let fieldId = TmplConfigAnalysis.getFieldId(config, mstrucId);
246
- let val: any = fieldMap && fieldMap[fieldId];
247
- if (val) {
248
- if (val instanceof Array) {
249
- let vs = [];
250
- val.forEach((v) => {
251
- vs.push(v.indexOf("@R@") > 0 ? v.split("@R@")[0] : v);
252
- });
253
- val = vs.toString();
246
+ let fieldId = TmplConfigAnalysis.getFieldId(config, mstrucId);
247
+ let val: any = fieldMap && fieldMap[fieldId];
248
+ if (val) {
249
+ if (val instanceof Array) {
250
+ let vs = [];
251
+ val.forEach((v) => {
252
+ vs.push(v.indexOf("@R@") > 0 ? v.split("@R@")[0] : v);
253
+ });
254
+ val = vs.toString();
255
+ } else {
256
+ val = val.indexOf("@R@") > 0 ? val.split("@R@")[0] : val;
257
+ }
254
258
  } else {
255
- val = val.indexOf("@R@") > 0 ? val.split("@R@")[0] : val;
259
+ return defaultValue;
256
260
  }
257
- } else {
258
- return defaultValue;
259
- }
260
- return val;
261
+ return val;
261
262
  };
262
263
 
263
264
  TmplConfigAnalysis.getFieldValueOfMstrucId = (
264
- config: DtmplConfig | LtmplConfig,
265
- fieldMap: object,
266
- mstrucId: string,
267
- defaultValue?: string
265
+ config: DtmplConfig | LtmplConfig,
266
+ fieldMap: object,
267
+ mstrucId: string,
268
+ defaultValue?: string
268
269
  ) => {
269
- //debugger
270
- let fieldId = TmplConfigAnalysis.getFieldId(config, mstrucId);
271
- let val: any = fieldMap && fieldMap[fieldId];
272
- if (val) {
273
- if (val instanceof Array) {
274
- val = val.toString();
270
+ //debugger
271
+ let fieldId = TmplConfigAnalysis.getFieldId(config, mstrucId);
272
+ let val: any = fieldMap && fieldMap[fieldId];
273
+ if (val) {
274
+ if (val instanceof Array) {
275
+ val = val.toString();
276
+ } else {
277
+ val = fieldMap[fieldId];
278
+ }
275
279
  } else {
276
- val = fieldMap[fieldId];
280
+ return defaultValue;
277
281
  }
278
- } else {
279
- return defaultValue;
280
- }
281
- return val;
282
+ return val;
282
283
  };
283
284
 
284
285
  TmplConfigAnalysis.getFieldId = (
285
- config: DtmplConfig | LtmplConfig,
286
- mstrucId: string
286
+ config: DtmplConfig | LtmplConfig,
287
+ mstrucId: string
287
288
  ) => {
288
- let dvalue = "text";
289
- let fieldId = undefined;
290
-
291
- let groups = config["groups"];
292
- //有groups的为 DtmplConfig
293
- if (groups != null) {
294
- for (let group of groups) {
295
- for (let field of group.fields) {
296
- if (field.mstrucId == mstrucId) {
297
- fieldId = field.id;
298
- break;
289
+ let dvalue = "text";
290
+ let fieldId = undefined;
291
+
292
+ let groups = config["groups"];
293
+ //有groups的为 DtmplConfig
294
+ if (groups != null) {
295
+ for (let group of groups) {
296
+ for (let field of group.fields) {
297
+ if (field.mstrucId == mstrucId) {
298
+ fieldId = field.id;
299
+ break;
300
+ }
301
+ }
302
+ if (fieldId) {
303
+ break;
304
+ }
299
305
  }
300
- }
301
- if (fieldId) {
302
- break;
303
- }
304
- }
305
- } else {
306
- //处理 LtmplConfig
307
- let columms = config["columns"];
308
- if (columms != null) {
309
- for (let colum of columms) {
310
- if (colum.mstrucId == mstrucId) {
311
- fieldId = colum.id;
312
- break;
306
+ } else {
307
+ //处理 LtmplConfig
308
+ let columms = config["columns"];
309
+ if (columms != null) {
310
+ for (let colum of columms) {
311
+ if (colum.mstrucId == mstrucId) {
312
+ fieldId = colum.id;
313
+ break;
314
+ }
315
+ }
313
316
  }
314
- }
315
317
  }
316
- }
317
- return fieldId;
318
+ return fieldId;
318
319
  };
319
320
 
320
321
  TmplConfigAnalysis.getRelMstrucFieldId = (
321
- dtmplConfig: DtmplConfig,
322
- fieldMap: object,
323
- mstrucId: string
322
+ dtmplConfig: DtmplConfig,
323
+ fieldMap: object,
324
+ mstrucId: string
324
325
  ) => {
325
- let fieldId = TmplConfigAnalysis.getFieldId(dtmplConfig, mstrucId);
326
- let rmstrucId =
327
- fieldMap && fieldMap[fieldId]
328
- ? fieldMap[fieldId].split("@R@")[0]
329
- : undefined;
330
- return rmstrucId;
326
+ let fieldId = TmplConfigAnalysis.getFieldId(dtmplConfig, mstrucId);
327
+ let rmstrucId =
328
+ fieldMap && fieldMap[fieldId]
329
+ ? fieldMap[fieldId].split("@R@")[0]
330
+ : undefined;
331
+ return rmstrucId;
331
332
  };
332
- TmplConfigAnalysis.buildInFuncFields=(dtmplConfig: DtmplConfig)=> {
333
- let buildInFuncFields = [];
334
- for (let group of dtmplConfig.groups) {
335
- for (let field of group.fields) {
336
- if (
337
- (field.requiredRuleCriterias &&
338
- field.requiredRuleCriterias.length > 0) ||
339
- (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
340
- || field.relValueField
341
- ) {
342
- field.shouldUpdate = true;
343
- buildInFuncFields.push(field);
344
- }
333
+ TmplConfigAnalysis.buildInFuncFields = (dtmplConfig: DtmplConfig) => {
334
+ let buildInFuncFields = [];
335
+ for (let group of dtmplConfig.groups) {
336
+ for (let field of group.fields) {
337
+ if (
338
+ (field.requiredRuleCriterias &&
339
+ field.requiredRuleCriterias.length > 0) ||
340
+ (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
341
+ || field.relValueField
342
+ ) {
343
+ field.shouldUpdate = true;
344
+ buildInFuncFields.push(field);
345
+ }
346
+ }
345
347
  }
346
- }
347
- return buildInFuncFields;
348
+ return buildInFuncFields;
348
349
  }
349
350
 
350
351
 
351
352
  TmplConfigAnalysis.buildInDtmplConfig = (
352
- dtmplConfig: DtmplConfig,
353
- dtmplData: DtmplData,
354
- props: DtmplFormProps
353
+ dtmplConfig: DtmplConfig,
354
+ dtmplData: DtmplData,
355
+ props: DtmplFormProps
355
356
  ) => {
356
- if (!dtmplConfig.buildInFuncFields) {
357
- //先找到有业务的
358
- let buildInFuncFields = TmplConfigAnalysis.buildInFuncFields(dtmplConfig);
359
- // for (let group of dtmplConfig.groups) {
360
- // for (let field of group.fields) {
361
- // if (
362
- // (field.requiredRuleCriterias &&
363
- // field.requiredRuleCriterias.length > 0) ||
364
- // (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
365
- // || field.relValueField
366
- // ) {
367
- // field.shouldUpdate = true;
368
- // buildInFuncFields.push(field);
369
- // }
370
- // }
371
- // }
372
- dtmplConfig.buildInFuncFields = buildInFuncFields;
373
- }
374
- if (dtmplConfig.buildInFuncFields.length > 0) {
375
- function setConfig(
376
- changedValues,
377
- allValues: DtmplData,
378
- formInstance: FormInstance
379
- ) {
380
- for (let field of dtmplConfig.buildInFuncFields) {
381
- if (
382
- field.requiredRuleCriterias != null &&
383
- field.requiredRuleCriterias.length > 0
384
- ) {
385
- if (
386
- ActionUtils.isMatch(
387
- field.requiredRuleCriterias,
388
- [allValues],
389
- formInstance,
390
- dtmplConfig
391
- )
392
- ) {
393
- field.required = true;
394
- } else {
395
- field.required = false;
396
- }
397
- }
398
- if (
399
- field.usableRuleCriterias != null &&
400
- field.usableRuleCriterias.length > 0
357
+ if (!dtmplConfig.buildInFuncFields) {
358
+ //先找到有业务的
359
+ let buildInFuncFields = TmplConfigAnalysis.buildInFuncFields(dtmplConfig);
360
+ // for (let group of dtmplConfig.groups) {
361
+ // for (let field of group.fields) {
362
+ // if (
363
+ // (field.requiredRuleCriterias &&
364
+ // field.requiredRuleCriterias.length > 0) ||
365
+ // (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
366
+ // || field.relValueField
367
+ // ) {
368
+ // field.shouldUpdate = true;
369
+ // buildInFuncFields.push(field);
370
+ // }
371
+ // }
372
+ // }
373
+ dtmplConfig.buildInFuncFields = buildInFuncFields;
374
+ }
375
+ if (dtmplConfig.buildInFuncFields.length > 0) {
376
+ function setConfig(
377
+ changedValues,
378
+ allValues: DtmplData,
379
+ formInstance: FormInstance
401
380
  ) {
402
- if (
403
- ActionUtils.isMatch(
404
- field.usableRuleCriterias,
405
- [allValues],
406
- formInstance,
407
- dtmplConfig
408
- )
409
- ) {
410
- field.disabled = false;
411
- } else {
412
- field.disabled = true;
413
- }
414
- }
415
- if(field.relValueField && changedValues && changedValues.hasOwnProperty(field.relValueField.id)){
416
- if(!field.baseCriteria){
417
- field.baseCriteria={}
418
- }
419
- field.baseCriteria={...field.baseCriteria,"secondCriteria":changedValues[field.relValueField.id]};
420
- field.configChanged=true;
421
- if(formInstance.getFieldValue(field.id)){
422
- formInstance.setFieldValue(field.id,null);
423
- }
424
- if(formInstance.getFieldValue("c_"+field.id)){
425
- formInstance.setFieldValue("c_"+field.id,null);
426
- }
381
+ for (let field of dtmplConfig.buildInFuncFields) {
382
+ if (
383
+ field.requiredRuleCriterias != null &&
384
+ field.requiredRuleCriterias.length > 0
385
+ ) {
386
+ if (
387
+ ActionUtils.isMatch(
388
+ field.requiredRuleCriterias,
389
+ [allValues],
390
+ formInstance,
391
+ dtmplConfig
392
+ )
393
+ ) {
394
+ field.required = true;
395
+ } else {
396
+ field.required = false;
397
+ }
398
+ }
399
+ if (
400
+ field.usableRuleCriterias != null &&
401
+ field.usableRuleCriterias.length > 0
402
+ ) {
403
+ if (
404
+ ActionUtils.isMatch(
405
+ field.usableRuleCriterias,
406
+ [allValues],
407
+ formInstance,
408
+ dtmplConfig
409
+ )
410
+ ) {
411
+ field.disabled = false;
412
+ } else {
413
+ field.disabled = true;
414
+ }
415
+ }
416
+ if (field.relValueField && changedValues && changedValues.hasOwnProperty(field.relValueField.id)) {
417
+ if (!field.baseCriteria) {
418
+ field.baseCriteria = {}
419
+ }
420
+ field.baseCriteria = {
421
+ ...field.baseCriteria,
422
+ "secondCriteria": changedValues[field.relValueField.id]
423
+ };
424
+ field.configChanged = true;
425
+ if (formInstance.getFieldValue(field.id)) {
426
+ formInstance.setFieldValue(field.id, null);
427
+ }
428
+ if (formInstance.getFieldValue("c_" + field.id)) {
429
+ formInstance.setFieldValue("c_" + field.id, null);
430
+ }
431
+ }
432
+ }
427
433
  }
428
- }
434
+
435
+ setConfig(null, dtmplData, null);
436
+
437
+ dtmplConfig.onValuesChange = (changedValues, allValues, formInstance) => {
438
+ setConfig(changedValues, allValues, formInstance);
439
+ };
440
+ return dtmplConfig;
441
+ } else {
442
+ return dtmplConfig;
429
443
  }
430
- setConfig(null, dtmplData, null);
431
-
432
- dtmplConfig.onValuesChange = (changedValues, allValues, formInstance) => {
433
- setConfig(changedValues, allValues, formInstance);
434
- };
435
- return dtmplConfig;
436
- } else {
437
- return dtmplConfig;
438
- }
439
444
  };
440
445
 
441
- TmplConfigAnalysis.getRules=(fieldConfig:FieldConfig,translate)=>{
442
- let rules=[];
443
- let title=fieldConfig.title;
444
- if(fieldConfig.required){
445
- let isUpload=ControlTypeSupportor.isUploadControl(fieldConfig);
446
-
447
- let transform=undefined;
448
- if(isUpload){
449
- transform=(value)=>{
450
- if(value && value.indexOf("delete")>0){
451
- return undefined;
452
- }else{
453
- return value;
454
- }
455
- }
456
- }else if(ControlTypeSupportor.isMultiUploadControl(fieldConfig)){
457
- transform=(value)=>{
458
- if(value && value=="[]"){
459
- return undefined;
460
- }else{
461
- return value;
462
- }
446
+ TmplConfigAnalysis.getRules = (fieldConfig: FieldConfig, translate) => {
447
+ let rules = [];
448
+ let title = fieldConfig.title;
449
+ if (fieldConfig.required) {
450
+ debugger
451
+ let isUpload = ControlTypeSupportor.isUploadControl(fieldConfig);
452
+ let transform = undefined;
453
+ if (isUpload) {
454
+ transform = (value) => {
455
+ if (value && value.indexOf("delete") > 0) {
456
+ return undefined;
457
+ } else {
458
+ return value;
459
+ }
460
+ }
461
+ } else if (ControlTypeSupportor.isMultiUploadControl(fieldConfig)) {
462
+ transform = (value) => {
463
+ if (value && value == "[]") {
464
+ return undefined;
465
+ } else {
466
+ return value;
467
+ }
468
+ }
469
+ }else {
470
+ transform = (value)=>{
471
+ return value
472
+ }
463
473
  }
464
- }
465
- rules.push({
466
- required: true,
467
- message: translate("${请输入}${" + title + "}"),
468
- transform,
469
- });
474
+ rules.push({
475
+ required: true,
476
+ message: translate("${请输入}${" + title + "}"),
477
+ transform,
478
+ });
470
479
  }
471
480
 
472
- let rulePattern=fieldConfig.rules[0]?.pattern;
473
- if(rulePattern){
474
- rules.push({
475
- pattern:rulePattern,
476
- message:translate("${" + title + "}${格式有误}"),
477
- })
481
+ let rulePattern = fieldConfig.rules[0]?.pattern;
482
+ if (rulePattern) {
483
+ rules.push({
484
+ pattern: rulePattern,
485
+ message: translate("${" + title + "}${格式有误}"),
486
+ })
478
487
  }
479
488
  return rules;
480
- }
489
+ }
481
490
 
482
491
  TmplConfigAnalysis.buildInCtmplConfig = (
483
- ltmplConfig:SelectConfig,
492
+ ltmplConfig: SelectConfig,
484
493
  criteriaData,
485
494
  props: CriteriaFormProps
486
495
  ) => {
487
- if (!ltmplConfig.buildInFuncFields) {
488
- //先找到有业务的
489
- let buildInFuncFields = [];
490
- for (let field of ltmplConfig.criterias) {
491
- if (
492
- (field.requiredRuleCriterias &&
493
- field.requiredRuleCriterias.length > 0) ||
494
- (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
495
- || field.relValueField
496
- ) {
497
- field.shouldUpdate = true;
498
- buildInFuncFields.push(field);
496
+ if (!ltmplConfig.buildInFuncFields) {
497
+ //先找到有业务的
498
+ let buildInFuncFields = [];
499
+ for (let field of ltmplConfig.criterias) {
500
+ if (
501
+ (field.requiredRuleCriterias &&
502
+ field.requiredRuleCriterias.length > 0) ||
503
+ (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
504
+ || field.relValueField
505
+ ) {
506
+ field.shouldUpdate = true;
507
+ buildInFuncFields.push(field);
508
+ }
509
+ }
510
+ if (ltmplConfig['drillingParams']) {
511
+ for (let field of ltmplConfig['drillingParams']) {
512
+ if (
513
+ (field.requiredRuleCriterias &&
514
+ field.requiredRuleCriterias.length > 0) ||
515
+ (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
516
+ || field.relValueField
517
+ ) {
518
+ field.shouldUpdate = true;
519
+ buildInFuncFields.push(field);
520
+ }
521
+ }
499
522
  }
523
+
524
+ ltmplConfig.buildInFuncFields = buildInFuncFields;
500
525
  }
501
- if(ltmplConfig['drillingParams']){
502
- for (let field of ltmplConfig['drillingParams']) {
503
- if (
504
- (field.requiredRuleCriterias &&
505
- field.requiredRuleCriterias.length > 0) ||
506
- (field.usableRuleCriterias && field.usableRuleCriterias.length > 0)
507
- || field.relValueField
526
+ if (ltmplConfig.buildInFuncFields.length > 0) {
527
+ function setConfig(
528
+ changedValues,
529
+ allValues: DtmplData,
530
+ formInstance: FormInstance
508
531
  ) {
509
- field.shouldUpdate = true;
510
- buildInFuncFields.push(field);
532
+ for (let field of ltmplConfig.buildInFuncFields) {
533
+
534
+ if (field.relValueField && changedValues && changedValues.hasOwnProperty("c_" + field.relValueField.id)) {
535
+ if (!field.baseCriteria) {
536
+ field.baseCriteria = {}
537
+ }
538
+ field.baseCriteria = {
539
+ ...field.baseCriteria,
540
+ "secondCriteria": changedValues["c_" + field.relValueField.id]
541
+ };
542
+ field.configChanged = true;
543
+ if (formInstance.getFieldValue(field.id)) {
544
+ formInstance.setFieldValue(field.id, null);
545
+ }
546
+ if (formInstance.getFieldValue("c_" + field.id)) {
547
+ formInstance.setFieldValue("c_" + field.id, null);
548
+ }
549
+ }
550
+ }
511
551
  }
512
- }
513
- }
514
552
 
515
- ltmplConfig.buildInFuncFields = buildInFuncFields;
516
- }
517
- if (ltmplConfig.buildInFuncFields.length > 0) {
518
- function setConfig(
519
- changedValues,
520
- allValues: DtmplData,
521
- formInstance: FormInstance
522
- ) {
523
- for (let field of ltmplConfig.buildInFuncFields) {
524
-
525
- if (field.relValueField && changedValues && changedValues.hasOwnProperty("c_"+field.relValueField.id)) {
526
- if (!field.baseCriteria) {
527
- field.baseCriteria = {}
528
- }
529
- field.baseCriteria = {...field.baseCriteria, "secondCriteria": changedValues["c_"+field.relValueField.id]};
530
- field.configChanged=true;
531
- if (formInstance.getFieldValue(field.id)) {
532
- formInstance.setFieldValue(field.id, null);
533
- }
534
- if (formInstance.getFieldValue("c_" + field.id)) {
535
- formInstance.setFieldValue("c_" + field.id, null);
536
- }
537
- }
538
- }
553
+ //debugger
554
+ setConfig(null, criteriaData, null);
555
+ ltmplConfig.onCriteriaValuesChange = (changedValues, allValues, formInstance) => {
556
+ setConfig(changedValues, allValues, formInstance);
557
+ };
558
+ return ltmplConfig;
559
+ } else {
560
+ return ltmplConfig;
539
561
  }
540
- //debugger
541
- setConfig(null, criteriaData, null);
542
- ltmplConfig.onCriteriaValuesChange = (changedValues, allValues, formInstance) => {
543
- setConfig(changedValues,allValues, formInstance);
544
- };
545
- return ltmplConfig;
546
- } else {
547
- return ltmplConfig;
548
- }
549
562
  };
550
563
 
551
564
 
552
-
553
565
  export default TmplConfigAnalysis;