yy-forms 1.0.45 → 1.0.47
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.
- package/dist/index.esm.js +24 -0
- package/dist/index.js +24 -0
- package/package.json +2 -1
- package/.fatherrc.js +0 -37
- package/CHANGELOG.md +0 -254
- package/es/Provider.js +0 -248
- package/es/index.d.ts +0 -145
- package/es/index.js +0 -44
- package/es/settings/index.js +0 -975
- package/es/styles/atom.less +0 -1134
- package/es/styles/index.less +0 -358
- package/es/transformer/form-render.js +0 -75
- package/es/utils/context.js +0 -3
- package/es/utils/hooks.js +0 -48
- package/es/utils/index.js +0 -706
- package/es/utils/mapping.js +0 -31
- package/es/utils/serialize.js +0 -276
- package/es/widgets/htmlInput.js +0 -20
- package/es/widgets/idInput.js +0 -23
- package/es/widgets/index.js +0 -5
- package/es/widgets/jsonInput.js +0 -24
- package/es/widgets/list.js +0 -24
- package/es/widgets/percentSlider.js +0 -89
- package/src/Provider.jsx +0 -239
- package/src/components/Canvas/core/RenderChildren.jsx +0 -18
- package/src/components/Canvas/core/RenderField.jsx +0 -131
- package/src/components/Canvas/core/Wrapper.jsx +0 -298
- package/src/components/Canvas/core/Wrapper.less +0 -57
- package/src/components/Canvas/core/index.jsx +0 -171
- package/src/components/Canvas/index.jsx +0 -178
- package/src/components/Settings/GlobalSettings.jsx +0 -50
- package/src/components/Settings/ItemSettings.jsx +0 -155
- package/src/components/Settings/index.jsx +0 -75
- package/src/components/Settings/index.less +0 -25
- package/src/components/Sidebar/Element.jsx +0 -80
- package/src/components/Sidebar/Element.less +0 -18
- package/src/components/Sidebar/index.jsx +0 -47
- package/src/components/Sidebar/index.less +0 -23
- package/src/i18next/index.ts +0 -14
- package/src/i18next/locales/enUS.json +0 -51
- package/src/i18next/locales/resources.ts +0 -7
- package/src/i18next/locales/zhCN.json +0 -3
- package/src/index.d.ts +0 -145
- package/src/index.js +0 -45
- package/src/settings/index.js +0 -2030
- package/src/styles/atom.less +0 -1134
- package/src/styles/index.less +0 -358
- package/src/transformer/form-render.js +0 -65
- package/src/utils/context.js +0 -4
- package/src/utils/hooks.js +0 -35
- package/src/utils/index.js +0 -678
- package/src/utils/mapping.js +0 -29
- package/src/utils/serialize.js +0 -368
- package/src/widgets/htmlInput.jsx +0 -24
- package/src/widgets/idInput.jsx +0 -27
- package/src/widgets/index.js +0 -6
- package/src/widgets/jsonInput.jsx +0 -29
- package/src/widgets/list.jsx +0 -28
- package/src/widgets/percentSlider.jsx +0 -74
package/src/styles/index.less
DELETED
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
@import './atom.less';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
用于原有样式的覆盖
|
|
5
|
-
*/
|
|
6
|
-
.fr-generator-container {
|
|
7
|
-
display: flex;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
height: 100%;
|
|
10
|
-
min-height: 30vh;
|
|
11
|
-
position: relative;
|
|
12
|
-
.mid-layout {
|
|
13
|
-
padding: 0 8px;
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
flex-grow: 1;
|
|
17
|
-
flex-shrink: 1;
|
|
18
|
-
/* height: 100%; */
|
|
19
|
-
overflow: hidden;
|
|
20
|
-
border-left: 1px solid #e0e0e0;
|
|
21
|
-
border-right: 1px solid #e0e0e0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.flex-center {
|
|
25
|
-
display: flex;
|
|
26
|
-
justify-content: center;
|
|
27
|
-
align-items: center;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.dnd-container {
|
|
31
|
-
flex-grow: 1;
|
|
32
|
-
overflow-y: auto;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.ant-tabs.ant-tabs-top {
|
|
36
|
-
display: flex;
|
|
37
|
-
flex-direction: column;
|
|
38
|
-
height: 100%;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.ant-tabs-content-holder {
|
|
42
|
-
flex-grow: 1;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.ant-tabs-content.ant-tabs-content-top {
|
|
46
|
-
height: 100%;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.ant-tabs-tabpane.ant-tabs-tabpane-active {
|
|
50
|
-
height: 100%;
|
|
51
|
-
overflow-y: auto;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.fr-generator-container .dnd-container.edit {
|
|
56
|
-
.top-upper {
|
|
57
|
-
top: -12px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.fr-set {
|
|
61
|
-
padding: 12px 14px 12px 12px;
|
|
62
|
-
margin-bottom: 12px;
|
|
63
|
-
border-radius: 4px;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.fr-field {
|
|
67
|
-
margin-bottom: 24px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.fr-label {
|
|
71
|
-
display: block;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.fr-label-title {
|
|
75
|
-
display: inline-flex;
|
|
76
|
-
color: #333;
|
|
77
|
-
font-size: 14px;
|
|
78
|
-
min-height: 22px; /* ""的标签页占位 */
|
|
79
|
-
line-height: 22px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.fr-label-required {
|
|
83
|
-
margin: 1px 4px 0 0;
|
|
84
|
-
color: #f5222d;
|
|
85
|
-
font-size: 14px;
|
|
86
|
-
font-family: SimSun, sans-serif;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.fr-label-title::after {
|
|
90
|
-
content: ':';
|
|
91
|
-
position: relative;
|
|
92
|
-
top: -0.5px;
|
|
93
|
-
margin: 0 10px 0 2px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.fr-label-title.no-colon::after {
|
|
97
|
-
content: '';
|
|
98
|
-
margin: 0;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.fr-label-object .fr-label-title {
|
|
102
|
-
font-size: 16px;
|
|
103
|
-
color: #222;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.fr-desc {
|
|
107
|
-
margin-top: 3px;
|
|
108
|
-
font-size: 12px;
|
|
109
|
-
word-break: break-all;
|
|
110
|
-
color: #888;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.fr-validate {
|
|
114
|
-
margin-left: 12px;
|
|
115
|
-
font-size: 12px;
|
|
116
|
-
word-break: break-all;
|
|
117
|
-
color: #f5222d;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/* Row */
|
|
121
|
-
|
|
122
|
-
.fr-validate-row {
|
|
123
|
-
margin: 3px 0 0 0;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.fr-label-row {
|
|
127
|
-
text-align: right;
|
|
128
|
-
flex-shrink: 0;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.fr-field-row .fr-content {
|
|
132
|
-
flex: 1;
|
|
133
|
-
position: relative;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.fr-field-row .fr-tooltip-icon {
|
|
137
|
-
margin: 3px 2px 0 0;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/* 自定义类 */
|
|
141
|
-
.hover-b--black-20:hover {
|
|
142
|
-
border-color: rgba(0, 0, 0, 0.3);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.pt44 {
|
|
146
|
-
padding-top: 46px;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.pv12 {
|
|
150
|
-
padding-top: 12px;
|
|
151
|
-
padding-bottom: 12px;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/* 组件内部样式*/
|
|
155
|
-
.fr-color-picker {
|
|
156
|
-
width: 100%;
|
|
157
|
-
display: flex;
|
|
158
|
-
flex-direction: row;
|
|
159
|
-
align-items: center;
|
|
160
|
-
color: #666;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.fr-color-picker .rc-color-picker-trigger {
|
|
164
|
-
margin-right: 12px;
|
|
165
|
-
height: 30px;
|
|
166
|
-
width: 60px;
|
|
167
|
-
border: 1px solid #e5e5e5;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.fr-color-picker > p {
|
|
171
|
-
margin: 0;
|
|
172
|
-
font-size: 14px;
|
|
173
|
-
line-height: 28px;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.fr-color-picker .rc-color-picker-wrap {
|
|
177
|
-
display: flex;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.next-input,
|
|
181
|
-
.next-number-picker {
|
|
182
|
-
width: 100%;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.upload-img {
|
|
186
|
-
max-width: 200px;
|
|
187
|
-
max-height: 200px;
|
|
188
|
-
margin-right: 24px;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.fr-preview-image {
|
|
192
|
-
width: 160px;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.fr-preview {
|
|
196
|
-
position: relative;
|
|
197
|
-
cursor: pointer;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
.fr-upload-mod,
|
|
201
|
-
.fr-upload-file {
|
|
202
|
-
display: flex;
|
|
203
|
-
}
|
|
204
|
-
.fr-upload-mod {
|
|
205
|
-
align-items: center;
|
|
206
|
-
}
|
|
207
|
-
.fr-upload-mod .fr-upload-preview {
|
|
208
|
-
margin: 0 12px;
|
|
209
|
-
}
|
|
210
|
-
.fr-upload-file .ant-upload-list-item {
|
|
211
|
-
margin: 5px 0 0 8px;
|
|
212
|
-
}
|
|
213
|
-
.fr-upload-file .ant-upload-list-item-name {
|
|
214
|
-
margin-right: 6px;
|
|
215
|
-
}
|
|
216
|
-
.fr-upload-file .ant-upload-list-item-info {
|
|
217
|
-
cursor: pointer;
|
|
218
|
-
}
|
|
219
|
-
.fr-upload-file .next-upload-list-text .next-upload-list-item-done,
|
|
220
|
-
.fr-upload-file .next-upload-list-text .next-upload-list-item .next-icon {
|
|
221
|
-
height: 28px;
|
|
222
|
-
line-height: 28px;
|
|
223
|
-
margin-left: 12px;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.fr-upload-file .next-upload-list-item-name-wrap {
|
|
227
|
-
margin-top: -4px;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.fr-sort-help-class {
|
|
231
|
-
background: #fff;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/* 其他样式 */
|
|
235
|
-
|
|
236
|
-
.fold-icon.fold-icon-active {
|
|
237
|
-
transform: rotate(0deg);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.fold-icon {
|
|
241
|
-
transform: rotate(-90deg);
|
|
242
|
-
transition: transform 0.24s;
|
|
243
|
-
cursor: pointer;
|
|
244
|
-
position: relative;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.fold-icon::after {
|
|
248
|
-
content: '';
|
|
249
|
-
position: absolute;
|
|
250
|
-
top: -20px;
|
|
251
|
-
right: -10px;
|
|
252
|
-
bottom: -5px;
|
|
253
|
-
left: -20px;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
.fr-tooltip-toggle {
|
|
257
|
-
cursor: pointer;
|
|
258
|
-
position: relative;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.fr-tooltip-toggle:hover .fr-tooltip-container {
|
|
262
|
-
opacity: 1;
|
|
263
|
-
visibility: visible;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.fr-tooltip-icon {
|
|
267
|
-
height: 14px;
|
|
268
|
-
width: 14px;
|
|
269
|
-
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAEnUlEQVR42u1bS0iUURT+zd4Y9KDosSihNhYUaBE9YKpFDKKOOmOLahtJ2SoxA2fUdUoQJK5qU0ib6LlxUYJpkY0LE3tQZkU7y7A0e1jnA4Of8pz//5373/+BF44Oc+/c853v3nOf5xpup0QiMZ9kD8mxeDzeTHKXPveSvKXP3+j/GP1/h++QhzIoW1ZWthu/NYKYysvLN5EhKZJ7ZMQEye8ZyjjJfZIk6vS10YWFhcvI4FoC2wfwLkkf6aiBLt8YHovFNhCoFnRlgNQkY9BJbrLeS9uzqFueYAzXJV9ITgKLVsvBPCnuAAifSIe23kBd7zApHHUI8D3JBfptFUlialbYSJIDweep7+Iog7L4jUMdn4HNzeksmxRcdgColyRZWlq6NQOd21AH6rKrFxiBVanxxcXFS6jSdpsAHtLYUODC1FqAum0S0Q7Mqlp+ESlO2zD8DUmJBhcsgS4bJDwBdhUKb1ko+kll6qLR6AJDU4IuuAZ0W2C7kWnrJy1a/QONvjsNjxLp32VjsEzO1OcOkoJJoeJuGuBWGB4nYCCcD4RGmiSJOm35PIup7kokEplr+CQBCzAJeEeJqC22V3jE2IBQWVd+fv48w2cJmAhbp4C7H7bZaf1KoZJBbET8vCEDRgF/pdXGZim1/ifGl344WtTIJJ//B+ggts+K6t4BrAwBH2GjNKo2CuxVqzJeGLDqFemoFnQ0sq0vDHyP4D+KwI1ILqZqpyqsGmFjznStX8tNIzQlbjYUJasVnCo9wAzsjE1npyPgFQPqJvKDRYC8ioWt/200BFD7FRMwIu0nFBNwgNMFm80Fz0mAFIOqVz4IyoS/ZvQ1mQv1MYBqkO8GCSDXTDRjvAoCznAHrH/X0qu4FqE99Voj2AkErOPsg+3w/wqmwDMjHAkkPGdsPITMBqb7t4SFANjCjTkgoI0ZJY+Hwnp5f9MGdtIMOxF35n1ZXDrG38fYmDa48zWcs4eFANxesUtv+jPMZC4PCwE4NWL0DRvcehkHjyEhACdGCxl9vwBwggEyxw0wXhCAOANG34TsAi4k37kA/RliMnND1ANyGX1DGAMe89Og+uSjaRDSAwKucgeIYSEAcQzc8T4ISDGZrSFygVaml6dAQILJfBEiAl4yy/0KZK6WtsMBJwD+v0bcDk/tlp4yveB0cAmQj8hhs7lQE1NoIAQEPGdsazZ3k+3SoahOAvQfisoDBeR2QAmArjvcsbi2i5FMQ+Ay0Jvn6GIE10VWV2MBIiALmKWrMfFylJsRgkIAsAp1NojX47hCZn74HdfjficAAzp3PY6rf9g4GyBhw3/6Axoi0yW48IDtcQwBRVIUOHaQfguSAiYpvB42Od1Cxiz8s5tkpdfGAwOwSFhhy0xXUnV+DpSEbmCwwFiXKcPXbYTKpnSHykIndFsYf01JsDRJTxCDpUGU7nB5SKcfwuWLiooWK38wQXLJwcOFtIoHE/Bh5v6SE2DMdvNN4BE3nszQ93szfTJDclTbU7lAP5pSGIxY5eWzOdL/lXrkKW6Fp7M3XPTi4SR0zz6dnX087fOEq2k8hTc/nydJm57Pj3v5fP4PSqRR6oYkTaUAAAAASUVORK5CYII=');
|
|
270
|
-
background-size: cover;
|
|
271
|
-
display: block;
|
|
272
|
-
margin: 4px 0 0 4px;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.fr-tooltip-container {
|
|
276
|
-
position: absolute;
|
|
277
|
-
width: 160px;
|
|
278
|
-
left: 50%;
|
|
279
|
-
white-space: initial !important;
|
|
280
|
-
bottom: 30px;
|
|
281
|
-
text-align: center;
|
|
282
|
-
background: #2b222a;
|
|
283
|
-
padding: 4px;
|
|
284
|
-
margin-left: -77px;
|
|
285
|
-
border-radius: 4px;
|
|
286
|
-
color: #efefef;
|
|
287
|
-
font-size: 13px;
|
|
288
|
-
cursor: auto;
|
|
289
|
-
z-index: 99999;
|
|
290
|
-
transition: all 0.5s ease;
|
|
291
|
-
opacity: 0;
|
|
292
|
-
visibility: hidden;
|
|
293
|
-
word-wrap: break-word;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
.fr-tooltip-triangle {
|
|
297
|
-
position: absolute;
|
|
298
|
-
left: 50%;
|
|
299
|
-
border-left: 5px solid transparent;
|
|
300
|
-
border-right: 5px solid transparent;
|
|
301
|
-
border-top: 5px solid #2b222a;
|
|
302
|
-
transition: all 0.5s ease;
|
|
303
|
-
content: ' ';
|
|
304
|
-
font-size: 0;
|
|
305
|
-
line-height: 0;
|
|
306
|
-
margin-left: -5px;
|
|
307
|
-
width: 0;
|
|
308
|
-
bottom: -5px;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.fr-tooltip-toggle::before,
|
|
312
|
-
.fr-tooltip-toggle::after {
|
|
313
|
-
color: #efefef;
|
|
314
|
-
font-size: 13px;
|
|
315
|
-
opacity: 0;
|
|
316
|
-
pointer-events: none;
|
|
317
|
-
text-align: center;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
.fr-tooltip-toggle:focus::before,
|
|
321
|
-
.fr-tooltip-toggle:focus::after,
|
|
322
|
-
.fr-tooltip-toggle:hover::before,
|
|
323
|
-
.fr-tooltip-toggle:hover::after {
|
|
324
|
-
opacity: 1;
|
|
325
|
-
transition: all 0.75s ease;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.fr-slider {
|
|
329
|
-
display: flex;
|
|
330
|
-
width: 100%;
|
|
331
|
-
align-items: center;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
.fr-map {
|
|
335
|
-
display: flex;
|
|
336
|
-
flex-wrap: wrap;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
.frg-options-list {
|
|
341
|
-
.fr-list-1 {
|
|
342
|
-
.fr-field.fr-field-object {
|
|
343
|
-
flex: 1;
|
|
344
|
-
}
|
|
345
|
-
.fr-field.fr-field-inline > div:first-child {
|
|
346
|
-
display: none;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
.frg-options-input {
|
|
350
|
-
&:first-child {
|
|
351
|
-
margin-right: 6px;
|
|
352
|
-
}
|
|
353
|
-
.fr-content.fr-content-inline {
|
|
354
|
-
max-width: 96px;
|
|
355
|
-
min-width: 96px;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { getChildren2 } from '../utils';
|
|
2
|
-
|
|
3
|
-
// Setting Schema => FR Schema
|
|
4
|
-
const transformFrom = schema => {
|
|
5
|
-
const isObj = schema.type === 'object' && schema.properties;
|
|
6
|
-
const isList =
|
|
7
|
-
schema.type === 'array' && schema.items && schema.items.properties;
|
|
8
|
-
const hasChildren = isObj || isList;
|
|
9
|
-
|
|
10
|
-
if (!hasChildren) {
|
|
11
|
-
if (Array.isArray(schema.enumList)) {
|
|
12
|
-
schema.enum = schema.enumList
|
|
13
|
-
.filter(item => item.value)
|
|
14
|
-
.map(item => item.value);
|
|
15
|
-
schema.enumNames = schema.enumList
|
|
16
|
-
.filter(item => item.value)
|
|
17
|
-
.map(item => item.label || item.value);
|
|
18
|
-
}
|
|
19
|
-
delete schema.enumList;
|
|
20
|
-
} else {
|
|
21
|
-
const childrenList = getChildren2(schema);
|
|
22
|
-
childrenList.map(item => {
|
|
23
|
-
if (isObj) {
|
|
24
|
-
schema.properties[item.name] = transformTo({ ...item.schema });
|
|
25
|
-
}
|
|
26
|
-
if (isList) {
|
|
27
|
-
schema.items.properties[item.name] = transformTo({ ...item.schema });
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return schema;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const fromSetting = schema => transformFrom({ ...schema });
|
|
35
|
-
|
|
36
|
-
// FR Schema => Setting Schema
|
|
37
|
-
const transformTo = schema => {
|
|
38
|
-
const isObj = schema.type === 'object' && schema.properties;
|
|
39
|
-
const isList =
|
|
40
|
-
schema.type === 'array' && schema.items && schema.items.properties;
|
|
41
|
-
const hasChildren = isObj || isList;
|
|
42
|
-
|
|
43
|
-
if (!hasChildren) {
|
|
44
|
-
if (Array.isArray(schema.enum) && Array.isArray(schema.enumNames)) {
|
|
45
|
-
const list = schema.enum.map((item, idx) => ({
|
|
46
|
-
value: item,
|
|
47
|
-
label: schema.enumNames[idx],
|
|
48
|
-
}));
|
|
49
|
-
schema.enumList = list;
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
const childrenList = getChildren2(schema);
|
|
53
|
-
childrenList.map(item => {
|
|
54
|
-
if (isObj) {
|
|
55
|
-
schema.properties[item.name] = transformFrom({ ...item.schema });
|
|
56
|
-
}
|
|
57
|
-
if (isList) {
|
|
58
|
-
schema.items.properties[item.name] = transformFrom({ ...item.schema });
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return schema;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const toSetting = schema => transformTo({ ...schema });
|
package/src/utils/context.js
DELETED
package/src/utils/hooks.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useContext, useReducer } from 'react';
|
|
2
|
-
import { Ctx, StoreCtx } from './context';
|
|
3
|
-
|
|
4
|
-
// 使用最顶层组件的 setState
|
|
5
|
-
export const useGlobal = () => {
|
|
6
|
-
return useContext(Ctx);
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// 组件最顶层传入的所有props
|
|
10
|
-
export const useStore = () => {
|
|
11
|
-
return useContext(StoreCtx);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// 类似于 class component 的 setState
|
|
15
|
-
export const useSet = initState => {
|
|
16
|
-
const [state, setState] = useReducer((state, newState) => {
|
|
17
|
-
let action = newState;
|
|
18
|
-
if (typeof newState === 'function') {
|
|
19
|
-
action = action(state);
|
|
20
|
-
}
|
|
21
|
-
if (newState.action && newState.payload) {
|
|
22
|
-
action = newState.payload;
|
|
23
|
-
if (typeof action === 'function') {
|
|
24
|
-
action = action(state);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return { ...state, ...action };
|
|
28
|
-
}, initState);
|
|
29
|
-
|
|
30
|
-
const setStateWithActionName = (state, actionName) => {
|
|
31
|
-
setState(state);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return [state, setStateWithActionName];
|
|
35
|
-
};
|