@topthink/components 1.0.56 → 1.0.58
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/es/editor-widget-ebec8493.js +356 -0
- package/es/editor-widget-ebec8493.js.map +1 -0
- package/es/form-74ef0417.js +2 -0
- package/es/form-74ef0417.js.map +1 -0
- package/es/form-8925a750.js +231 -0
- package/es/form-8925a750.js.map +1 -0
- package/es/form-9c0e638a.js +230 -1
- package/es/form-9c0e638a.js.map +1 -1
- package/es/index-2b97b70d.js +2 -0
- package/es/index-2b97b70d.js.map +1 -0
- package/es/index-303e1845.js +560 -0
- package/es/index-303e1845.js.map +1 -0
- package/es/index-4f51cece.js +1304 -19
- package/es/index-4f51cece.js.map +1 -1
- package/es/index-563b11c6.js +67 -0
- package/es/index-563b11c6.js.map +1 -0
- package/es/index-6ae8237d.js +67 -0
- package/es/index-6ae8237d.js.map +1 -0
- package/es/index-7a7c06a9.js +40 -0
- package/es/index-7a7c06a9.js.map +1 -0
- package/es/index-9869b1c6.js +1350 -0
- package/es/index-9869b1c6.js.map +1 -0
- package/es/index-a214613e.js +40 -0
- package/es/index-a214613e.js.map +1 -0
- package/es/index-d964165a.js +529 -9
- package/es/index-d964165a.js.map +1 -1
- package/es/index.js +1 -1
- package/package.json +7 -5
- package/types/components/lazy/form/widgets/editor-widget.d.ts +5 -0
- package/types/index.d.ts +1 -1
- package/types/utils/is-record.d.ts +1 -0
- package/types/errors/unauthorized.d.ts +0 -4
- /package/types/components/lazy/{form.d.ts → form/index.d.ts} +0 -0
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import"@toast-ui/editor/dist/toastui-editor-only.css";import"@toast-ui/editor/dist/i18n/zh-cn";import{Editor as t}from"@toast-ui/react-editor";import{useRef as i}from"react";import o from"styled-components";function r(o){const{value:r,onChange:a,placeholder:g,autofocus:d,options:l}=o,{editType:s="wysiwyg",outputType:p="markdown",onUpload:c}=l,I=i(null),m={};return c&&(m.addImageBlobHook=async(e,t)=>{t(await c(e))}),e(n,{children:e(t,{ref:I,placeholder:g,usageStatistics:!1,hooks:m,autofocus:d,linkAttributes:{target:"_blank"},onChange:()=>{const e=I.current?.getInstance();e&&a("markdown"===p?e.getMarkdown():e.getHTML())},language:"zh-CN",initialValue:r,previewStyle:"vertical",height:"600px",initialEditType:s})})}const n=o.div`
|
|
2
|
+
.ProseMirror {
|
|
3
|
+
position: relative;
|
|
4
|
+
word-wrap: break-word;
|
|
5
|
+
white-space: break-spaces;
|
|
6
|
+
-webkit-font-variant-ligatures: none;
|
|
7
|
+
font-variant-ligatures: none;
|
|
8
|
+
font-feature-settings: "liga" 0;
|
|
9
|
+
font-size: 15px;
|
|
10
|
+
overflow-y: auto;
|
|
11
|
+
overflow-X: hidden;
|
|
12
|
+
height: 100%;
|
|
13
|
+
|
|
14
|
+
&:focus {
|
|
15
|
+
outline: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
pre {
|
|
19
|
+
white-space: pre-wrap;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
li {
|
|
23
|
+
position: relative;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.placeholder {
|
|
27
|
+
color: #999;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ProseMirror-hideselection *::selection {
|
|
32
|
+
background: transparent;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
36
|
+
background: transparent;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ProseMirror-hideselection {
|
|
40
|
+
caret-color: transparent;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ProseMirror-selectednode {
|
|
44
|
+
outline: 2px solid #8cf;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Make sure li selections wrap around markers */
|
|
48
|
+
|
|
49
|
+
li.ProseMirror-selectednode {
|
|
50
|
+
outline: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
li.ProseMirror-selectednode:after {
|
|
54
|
+
content: "";
|
|
55
|
+
position: absolute;
|
|
56
|
+
left: -32px;
|
|
57
|
+
right: -2px;
|
|
58
|
+
top: -2px;
|
|
59
|
+
bottom: -2px;
|
|
60
|
+
border: 2px solid #8cf;
|
|
61
|
+
pointer-events: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Protect against generic img rules */
|
|
65
|
+
|
|
66
|
+
img.ProseMirror-separator {
|
|
67
|
+
display: inline !important;
|
|
68
|
+
border: none !important;
|
|
69
|
+
margin: 0 !important;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
.ProseMirror-selectednode {
|
|
74
|
+
outline: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
table.ProseMirror-selectednode {
|
|
78
|
+
border-radius: 2px;
|
|
79
|
+
outline: 2px solid #00a9ff;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.html-block.ProseMirror-selectednode {
|
|
83
|
+
border-radius: 2px;
|
|
84
|
+
outline: 2px solid #00a9ff;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.toastui-editor-pseudo-clipboard {
|
|
88
|
+
position: fixed;
|
|
89
|
+
opacity: 0;
|
|
90
|
+
width: 0;
|
|
91
|
+
height: 0;
|
|
92
|
+
left: -1000px;
|
|
93
|
+
top: -1000px;
|
|
94
|
+
z-index: -1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.toastui-editor-defaultUI {
|
|
98
|
+
font-family: inherit;
|
|
99
|
+
|
|
100
|
+
.ProseMirror {
|
|
101
|
+
height: 100%;
|
|
102
|
+
padding: 14px !important;
|
|
103
|
+
font-size: 1rem;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.toastui-editor-defaultUI-toolbar {
|
|
107
|
+
padding: 0 5px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.toastui-editor-md-container {
|
|
111
|
+
.toastui-editor-md-preview {
|
|
112
|
+
padding: 5px 10px;
|
|
113
|
+
|
|
114
|
+
.toastui-editor-contents {
|
|
115
|
+
padding-top: 0;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.toastui-editor-contents {
|
|
122
|
+
-ms-text-size-adjust: 100%;
|
|
123
|
+
-webkit-text-size-adjust: 100%;
|
|
124
|
+
line-height: 1.2;
|
|
125
|
+
word-wrap: break-word;
|
|
126
|
+
|
|
127
|
+
& > *:first-child {
|
|
128
|
+
margin-top: 0 !important;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
& > *:last-child {
|
|
132
|
+
margin-bottom: 0 !important;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, pre, table, audio, video {
|
|
136
|
+
margin: 1em 0;
|
|
137
|
+
line-height: 1.2;
|
|
138
|
+
padding: 0;
|
|
139
|
+
|
|
140
|
+
&:last-child {
|
|
141
|
+
margin-bottom: 0 !important;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&:first-child {
|
|
145
|
+
margin-top: 0 !important;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
p {
|
|
150
|
+
margin-bottom: 1em;
|
|
151
|
+
line-height: 2;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
h1, h2, h3, h4, h5, h6 {
|
|
155
|
+
font-weight: normal;
|
|
156
|
+
|
|
157
|
+
&.align-right {
|
|
158
|
+
text-align: right;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&.align-center {
|
|
162
|
+
text-align: center;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
h1 {
|
|
167
|
+
font-size: 2em;
|
|
168
|
+
line-height: 1.2;
|
|
169
|
+
border-bottom: 1px solid #eeeeee;
|
|
170
|
+
padding-bottom: .5em;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
h2 {
|
|
174
|
+
padding-bottom: .4em;
|
|
175
|
+
font-size: 1.3em;
|
|
176
|
+
line-height: 1.2;
|
|
177
|
+
border-bottom: 1px solid #eeeeee
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
h3 {
|
|
181
|
+
font-size: 1.2em;
|
|
182
|
+
line-height: 1.2;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
h4 {
|
|
186
|
+
font-size: 1.1em;
|
|
187
|
+
line-height: 1.2;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
h5 {
|
|
191
|
+
font-size: 1em;
|
|
192
|
+
line-height: 1.2;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
hr {
|
|
196
|
+
border: 0;
|
|
197
|
+
border-bottom: 1px solid #eeeeee;
|
|
198
|
+
margin-bottom: 0.5em;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
ul {
|
|
202
|
+
padding-left: 2em;
|
|
203
|
+
|
|
204
|
+
ul {
|
|
205
|
+
margin: 0;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
ol {
|
|
210
|
+
padding-left: 2em;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
li {
|
|
214
|
+
line-height: 2;
|
|
215
|
+
|
|
216
|
+
&.task-list-item {
|
|
217
|
+
list-style: none;
|
|
218
|
+
position: relative;
|
|
219
|
+
|
|
220
|
+
input[type=checkbox] {
|
|
221
|
+
position: absolute;
|
|
222
|
+
left: -1.5em;
|
|
223
|
+
top: 0.5em;
|
|
224
|
+
width: 1em;
|
|
225
|
+
height: 1em;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
code {
|
|
231
|
+
display: inline-block;
|
|
232
|
+
border-radius: 4px;
|
|
233
|
+
padding: .2em .4em;
|
|
234
|
+
background-color: #f7f7f7;
|
|
235
|
+
word-break: break-all;
|
|
236
|
+
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
237
|
+
white-space: pre;
|
|
238
|
+
line-height: 1.3;
|
|
239
|
+
margin: -.2em .4em;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
pre {
|
|
243
|
+
padding: 1.05em;
|
|
244
|
+
overflow: auto;
|
|
245
|
+
line-height: 1.45;
|
|
246
|
+
background-color: #f7f7f7;
|
|
247
|
+
border: 0;
|
|
248
|
+
border-radius: 3px;
|
|
249
|
+
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
pre > code {
|
|
254
|
+
display: inline;
|
|
255
|
+
max-width: 100%;
|
|
256
|
+
padding: 0;
|
|
257
|
+
margin: 0;
|
|
258
|
+
overflow: initial;
|
|
259
|
+
line-height: inherit;
|
|
260
|
+
background-color: rgba(0, 0, 0, 0);
|
|
261
|
+
border: 0;
|
|
262
|
+
tab-size: 4;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
table {
|
|
266
|
+
border-collapse: collapse;
|
|
267
|
+
table-layout: fixed;
|
|
268
|
+
width: 100%;
|
|
269
|
+
line-height: 1.8;
|
|
270
|
+
border-spacing: 0;
|
|
271
|
+
|
|
272
|
+
th {
|
|
273
|
+
text-align: left;
|
|
274
|
+
|
|
275
|
+
&[align='center'] {
|
|
276
|
+
text-align: center;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
&[align='right'] {
|
|
280
|
+
text-align: right;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
th, td {
|
|
285
|
+
border: 1px solid #e0e0e0;
|
|
286
|
+
padding: 3px 12px;
|
|
287
|
+
height: 34px;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
tr:hover td {
|
|
291
|
+
background-color: #f1f1f1;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
img {
|
|
296
|
+
max-width: 100%;
|
|
297
|
+
display: inline-block;
|
|
298
|
+
padding: 3px;
|
|
299
|
+
vertical-align: middle;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
a {
|
|
303
|
+
text-decoration: none;
|
|
304
|
+
color: var(--bs-primary);
|
|
305
|
+
|
|
306
|
+
&:hover {
|
|
307
|
+
text-decoration: underline;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
blockquote {
|
|
312
|
+
padding: 5px 5px 5px 15px;
|
|
313
|
+
color: #777777;
|
|
314
|
+
border-left: 4px solid #dddddd;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
video {
|
|
318
|
+
display: block;
|
|
319
|
+
width: 100%;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
audio {
|
|
323
|
+
display: block;
|
|
324
|
+
width: 100%;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.task-list-item {
|
|
328
|
+
border: 0;
|
|
329
|
+
list-style: none;
|
|
330
|
+
padding-left: 24px;
|
|
331
|
+
margin-left: -24px;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.task-list-item::before {
|
|
335
|
+
background-repeat: no-repeat;
|
|
336
|
+
background-size: 18px 18px;
|
|
337
|
+
background-position: center;
|
|
338
|
+
content: '';
|
|
339
|
+
margin-left: 0;
|
|
340
|
+
margin-top: 0;
|
|
341
|
+
border-radius: 2px;
|
|
342
|
+
height: 18px;
|
|
343
|
+
width: 18px;
|
|
344
|
+
position: absolute;
|
|
345
|
+
left: 0;
|
|
346
|
+
top: 7px;
|
|
347
|
+
cursor: pointer;
|
|
348
|
+
background: transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDE4IDE4Ij4KICAgIDxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgZmlsbD0iI0ZGRiIgc3Ryb2tlPSIjQ0NDIj4KICAgICAgICAgICAgPGc+CiAgICAgICAgICAgICAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTAzMCAtMjk2KSB0cmFuc2xhdGUoNzg4IDE5MikgdHJhbnNsYXRlKDI0MiAxMDQpIj4KICAgICAgICAgICAgICAgICAgICA8cmVjdCB3aWR0aD0iMTciIGhlaWdodD0iMTciIHg9Ii41IiB5PSIuNSIgcng9IjIiLz4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.task-list-item.checked::before {
|
|
352
|
+
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDE4IDE4Ij4KICAgIDxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgZmlsbD0iIzRCOTZFNiI+CiAgICAgICAgICAgIDxnPgogICAgICAgICAgICAgICAgPGc+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE2IDBjMS4xMDUgMCAyIC44OTUgMiAydjE0YzAgMS4xMDUtLjg5NSAyLTIgMkgyYy0xLjEwNSAwLTItLjg5NS0yLTJWMkMwIC44OTUuODk1IDAgMiAwaDE0em0tMS43OTMgNS4yOTNjLS4zOS0uMzktMS4wMjQtLjM5LTEuNDE0IDBMNy41IDEwLjU4NSA1LjIwNyA4LjI5M2wtLjA5NC0uMDgzYy0uMzkyLS4zMDUtLjk2LS4yNzgtMS4zMi4wODMtLjM5LjM5LS4zOSAxLjAyNCAwIDEuNDE0bDMgMyAuMDk0LjA4M2MuMzkyLjMwNS45Ni4yNzggMS4zMi0uMDgzbDYtNiAuMDgzLS4wOTRjLjMwNS0uMzkyLjI3OC0uOTYtLjA4My0xLjMyeiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEwNTAgLTI5NikgdHJhbnNsYXRlKDc4OCAxOTIpIHRyYW5zbGF0ZSgyNjIgMTA0KSIvPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
`;export{r as default};
|
|
356
|
+
//# sourceMappingURL=editor-widget-ebec8493.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-widget-ebec8493.js","sources":["../src/components/lazy/form/widgets/editor-widget.tsx"],"sourcesContent":["import { WidgetProps } from '@rjsf/core';\r\nimport '@toast-ui/editor/dist/toastui-editor-only.css';\r\nimport '@toast-ui/editor/dist/i18n/zh-cn';\r\nimport { Editor, EditorProps } from '@toast-ui/react-editor';\r\nimport { useRef } from 'react';\r\nimport styled from 'styled-components';\r\n\r\ninterface Options {\r\n editType?: 'wysiwyg' | 'markdown';\r\n outputType?: 'html' | 'markdown';\r\n onUpload?: (file: File | Blob) => Promise<string>;\r\n}\r\n\r\nexport default function EditorWidget(props: WidgetProps) {\r\n const { value, onChange, placeholder, autofocus, options } = props;\r\n\r\n const { editType = 'wysiwyg', outputType = 'markdown', onUpload } = options as Options;\r\n\r\n const ref = useRef<Editor>(null);\r\n\r\n const hooks: EditorProps['hooks'] = {};\r\n\r\n if (onUpload) {\r\n hooks.addImageBlobHook = async (file, callback) => {\r\n const url = await onUpload(file);\r\n callback(url);\r\n };\r\n }\r\n\r\n return <Container>\r\n <Editor\r\n ref={ref}\r\n placeholder={placeholder}\r\n usageStatistics={false}\r\n hooks={hooks}\r\n autofocus={autofocus}\r\n linkAttributes={{\r\n target: '_blank'\r\n }}\r\n onChange={() => {\r\n const instance = ref.current?.getInstance();\r\n if (instance) {\r\n if (outputType === 'markdown') {\r\n onChange(instance.getMarkdown());\r\n } else {\r\n onChange(instance.getHTML());\r\n }\r\n }\r\n }}\r\n language='zh-CN'\r\n initialValue={value}\r\n previewStyle='vertical'\r\n height='600px'\r\n initialEditType={editType}\r\n />\r\n </Container>;\r\n}\r\n\r\nconst Container = styled.div`\r\n .ProseMirror {\r\n position: relative;\r\n word-wrap: break-word;\r\n white-space: break-spaces;\r\n -webkit-font-variant-ligatures: none;\r\n font-variant-ligatures: none;\r\n font-feature-settings: \"liga\" 0;\r\n font-size: 15px;\r\n overflow-y: auto;\r\n overflow-X: hidden;\r\n height: 100%;\r\n\r\n &:focus {\r\n outline: none;\r\n }\r\n\r\n pre {\r\n white-space: pre-wrap;\r\n }\r\n\r\n li {\r\n position: relative;\r\n }\r\n\r\n .placeholder {\r\n color: #999;\r\n }\r\n }\r\n\r\n .ProseMirror-hideselection *::selection {\r\n background: transparent;\r\n }\r\n\r\n .ProseMirror-hideselection *::-moz-selection {\r\n background: transparent;\r\n }\r\n\r\n .ProseMirror-hideselection {\r\n caret-color: transparent;\r\n }\r\n\r\n .ProseMirror-selectednode {\r\n outline: 2px solid #8cf;\r\n }\r\n\r\n /* Make sure li selections wrap around markers */\r\n\r\n li.ProseMirror-selectednode {\r\n outline: none;\r\n }\r\n\r\n li.ProseMirror-selectednode:after {\r\n content: \"\";\r\n position: absolute;\r\n left: -32px;\r\n right: -2px;\r\n top: -2px;\r\n bottom: -2px;\r\n border: 2px solid #8cf;\r\n pointer-events: none;\r\n }\r\n\r\n /* Protect against generic img rules */\r\n\r\n img.ProseMirror-separator {\r\n display: inline !important;\r\n border: none !important;\r\n margin: 0 !important;\r\n }\r\n\r\n\r\n .ProseMirror-selectednode {\r\n outline: none;\r\n }\r\n\r\n table.ProseMirror-selectednode {\r\n border-radius: 2px;\r\n outline: 2px solid #00a9ff;\r\n }\r\n\r\n .html-block.ProseMirror-selectednode {\r\n border-radius: 2px;\r\n outline: 2px solid #00a9ff;\r\n }\r\n\r\n .toastui-editor-pseudo-clipboard {\r\n position: fixed;\r\n opacity: 0;\r\n width: 0;\r\n height: 0;\r\n left: -1000px;\r\n top: -1000px;\r\n z-index: -1;\r\n }\r\n\r\n .toastui-editor-defaultUI {\r\n font-family: inherit;\r\n\r\n .ProseMirror {\r\n height: 100%;\r\n padding: 14px !important;\r\n font-size: 1rem;\r\n }\r\n\r\n .toastui-editor-defaultUI-toolbar {\r\n padding: 0 5px;\r\n }\r\n\r\n .toastui-editor-md-container {\r\n .toastui-editor-md-preview {\r\n padding: 5px 10px;\r\n\r\n .toastui-editor-contents {\r\n padding-top: 0;\r\n }\r\n }\r\n }\r\n }\r\n\r\n .toastui-editor-contents {\r\n -ms-text-size-adjust: 100%;\r\n -webkit-text-size-adjust: 100%;\r\n line-height: 1.2;\r\n word-wrap: break-word;\r\n\r\n & > *:first-child {\r\n margin-top: 0 !important;\r\n }\r\n\r\n & > *:last-child {\r\n margin-bottom: 0 !important;\r\n }\r\n\r\n h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, pre, table, audio, video {\r\n margin: 1em 0;\r\n line-height: 1.2;\r\n padding: 0;\r\n\r\n &:last-child {\r\n margin-bottom: 0 !important;\r\n }\r\n\r\n &:first-child {\r\n margin-top: 0 !important;\r\n }\r\n }\r\n\r\n p {\r\n margin-bottom: 1em;\r\n line-height: 2;\r\n }\r\n\r\n h1, h2, h3, h4, h5, h6 {\r\n font-weight: normal;\r\n\r\n &.align-right {\r\n text-align: right;\r\n }\r\n\r\n &.align-center {\r\n text-align: center;\r\n }\r\n }\r\n\r\n h1 {\r\n font-size: 2em;\r\n line-height: 1.2;\r\n border-bottom: 1px solid #eeeeee;\r\n padding-bottom: .5em;\r\n }\r\n\r\n h2 {\r\n padding-bottom: .4em;\r\n font-size: 1.3em;\r\n line-height: 1.2;\r\n border-bottom: 1px solid #eeeeee\r\n }\r\n\r\n h3 {\r\n font-size: 1.2em;\r\n line-height: 1.2;\r\n }\r\n\r\n h4 {\r\n font-size: 1.1em;\r\n line-height: 1.2;\r\n }\r\n\r\n h5 {\r\n font-size: 1em;\r\n line-height: 1.2;\r\n }\r\n\r\n hr {\r\n border: 0;\r\n border-bottom: 1px solid #eeeeee;\r\n margin-bottom: 0.5em;\r\n }\r\n\r\n ul {\r\n padding-left: 2em;\r\n\r\n ul {\r\n margin: 0;\r\n }\r\n }\r\n\r\n ol {\r\n padding-left: 2em;\r\n }\r\n\r\n li {\r\n line-height: 2;\r\n\r\n &.task-list-item {\r\n list-style: none;\r\n position: relative;\r\n\r\n input[type=checkbox] {\r\n position: absolute;\r\n left: -1.5em;\r\n top: 0.5em;\r\n width: 1em;\r\n height: 1em;\r\n }\r\n }\r\n }\r\n\r\n code {\r\n display: inline-block;\r\n border-radius: 4px;\r\n padding: .2em .4em;\r\n background-color: #f7f7f7;\r\n word-break: break-all;\r\n font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\r\n white-space: pre;\r\n line-height: 1.3;\r\n margin: -.2em .4em;\r\n }\r\n\r\n pre {\r\n padding: 1.05em;\r\n overflow: auto;\r\n line-height: 1.45;\r\n background-color: #f7f7f7;\r\n border: 0;\r\n border-radius: 3px;\r\n font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\r\n }\r\n\r\n\r\n pre > code {\r\n display: inline;\r\n max-width: 100%;\r\n padding: 0;\r\n margin: 0;\r\n overflow: initial;\r\n line-height: inherit;\r\n background-color: rgba(0, 0, 0, 0);\r\n border: 0;\r\n tab-size: 4;\r\n }\r\n\r\n table {\r\n border-collapse: collapse;\r\n table-layout: fixed;\r\n width: 100%;\r\n line-height: 1.8;\r\n border-spacing: 0;\r\n\r\n th {\r\n text-align: left;\r\n\r\n &[align='center'] {\r\n text-align: center;\r\n }\r\n\r\n &[align='right'] {\r\n text-align: right;\r\n }\r\n }\r\n\r\n th, td {\r\n border: 1px solid #e0e0e0;\r\n padding: 3px 12px;\r\n height: 34px;\r\n }\r\n\r\n tr:hover td {\r\n background-color: #f1f1f1;\r\n }\r\n }\r\n\r\n img {\r\n max-width: 100%;\r\n display: inline-block;\r\n padding: 3px;\r\n vertical-align: middle;\r\n }\r\n\r\n a {\r\n text-decoration: none;\r\n color: var(--bs-primary);\r\n\r\n &:hover {\r\n text-decoration: underline;\r\n }\r\n }\r\n\r\n blockquote {\r\n padding: 5px 5px 5px 15px;\r\n color: #777777;\r\n border-left: 4px solid #dddddd;\r\n }\r\n\r\n video {\r\n display: block;\r\n width: 100%;\r\n }\r\n\r\n audio {\r\n display: block;\r\n width: 100%;\r\n }\r\n\r\n .task-list-item {\r\n border: 0;\r\n list-style: none;\r\n padding-left: 24px;\r\n margin-left: -24px;\r\n }\r\n\r\n .task-list-item::before {\r\n background-repeat: no-repeat;\r\n background-size: 18px 18px;\r\n background-position: center;\r\n content: '';\r\n margin-left: 0;\r\n margin-top: 0;\r\n border-radius: 2px;\r\n height: 18px;\r\n width: 18px;\r\n position: absolute;\r\n left: 0;\r\n top: 7px;\r\n cursor: pointer;\r\n background: transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDE4IDE4Ij4KICAgIDxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgZmlsbD0iI0ZGRiIgc3Ryb2tlPSIjQ0NDIj4KICAgICAgICAgICAgPGc+CiAgICAgICAgICAgICAgICA8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTAzMCAtMjk2KSB0cmFuc2xhdGUoNzg4IDE5MikgdHJhbnNsYXRlKDI0MiAxMDQpIj4KICAgICAgICAgICAgICAgICAgICA8cmVjdCB3aWR0aD0iMTciIGhlaWdodD0iMTciIHg9Ii41IiB5PSIuNSIgcng9IjIiLz4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==);\r\n }\r\n\r\n .task-list-item.checked::before {\r\n background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDE4IDE4Ij4KICAgIDxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgZmlsbD0iIzRCOTZFNiI+CiAgICAgICAgICAgIDxnPgogICAgICAgICAgICAgICAgPGc+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTE2IDBjMS4xMDUgMCAyIC44OTUgMiAydjE0YzAgMS4xMDUtLjg5NSAyLTIgMkgyYy0xLjEwNSAwLTItLjg5NS0yLTJWMkMwIC44OTUuODk1IDAgMiAwaDE0em0tMS43OTMgNS4yOTNjLS4zOS0uMzktMS4wMjQtLjM5LTEuNDE0IDBMNy41IDEwLjU4NSA1LjIwNyA4LjI5M2wtLjA5NC0uMDgzYy0uMzkyLS4zMDUtLjk2LS4yNzgtMS4zMi4wODMtLjM5LjM5LS4zOSAxLjAyNCAwIDEuNDE0bDMgMyAuMDk0LjA4M2MuMzkyLjMwNS45Ni4yNzggMS4zMi0uMDgzbDYtNiAuMDgzLS4wOTRjLjMwNS0uMzkyLjI3OC0uOTYtLjA4My0xLjMyeiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEwNTAgLTI5NikgdHJhbnNsYXRlKDc4OCAxOTIpIHRyYW5zbGF0ZSgyNjIgMTA0KSIvPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4K);\r\n }\r\n }\r\n`;\r\n"],"names":["EditorWidget","props","value","onChange","placeholder","autofocus","options","editType","outputType","onUpload","ref","useRef","hooks","addImageBlobHook","async","file","callback","_jsx","Container","children","Editor","usageStatistics","linkAttributes","target","instance","current","getInstance","getMarkdown","getHTML","language","initialValue","previewStyle","height","initialEditType","styled","div"],"mappings":"uPAawB,SAAAA,EAAaC,GACjC,MAAMC,MAAEA,EAAKC,SAAEA,EAAQC,YAAEA,EAAWC,UAAEA,EAASC,QAAEA,GAAYL,GAEvDM,SAAEA,EAAW,UAASC,WAAEA,EAAa,WAAUC,SAAEA,GAAaH,EAE9DI,EAAMC,EAAe,MAErBC,EAA8B,CAAA,EASpC,OAPIH,IACAG,EAAMC,iBAAmBC,MAAOC,EAAMC,KAElCA,QADkBP,EAASM,GACd,GAIdE,EAACC,EAAS,CAAAC,SACbF,EAACG,EACG,CAAAV,IAAKA,EACLN,YAAaA,EACbiB,iBAAiB,EACjBT,MAAOA,EACPP,UAAWA,EACXiB,eAAgB,CACZC,OAAQ,UAEZpB,SAAU,KACN,MAAMqB,EAAWd,EAAIe,SAASC,cAC1BF,GAEIrB,EADe,aAAfK,EACSgB,EAASG,cAETH,EAASI,UAEzB,EAELC,SAAS,QACTC,aAAc5B,EACd6B,aAAa,WACbC,OAAO,QACPC,gBAAiB1B,KAG7B,CAEA,MAAMW,EAAYgB,EAAOC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import o,{getRegistry as r}from"@topthink/json-form";import{forwardRef as e,useState as a,useCallback as n}from"react";import i from"axios";import{u as s,r as m,B as p}from"./index-6ae8237d.js";import{mapValues as l}from"lodash";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"query-string";import"retry-axios";import"rc-notification";import"styled-components";import"classnames";import"react-async-hook";const c=require("ajv-i18n/localize/zh"),d={upload:function(o){let{options:e,...a}=o;const{widgets:n}=r();return e.endpoint&&(e.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:r,value:a}=await m({url:e.endpoint,method:"post",data:o});return{url:r,value:a}}),t(n.upload,{...a,options:e})},editor:function(o){let{options:e,...a}=o;const{widgets:n}=r();return e.endpoint&&(e.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:r}=await m({url:e.endpoint,method:"post",data:o});return r}),t(n.editor,{...a,options:e})},typeahead:function(o){let{options:e,...a}=o;const{widgets:n}=r();return e.endpoint&&(e.onSearch=async t=>{let{value:o,query:r}=t;return await m({url:e.endpoint,params:{value:o,query:r}})}),t(n.typeahead,{...a,options:e})}},u=e(((r,e)=>{let{action:u,method:f="post",onSuccess:y,formData:h,onSubmitting:w,onSubmit:g,onChange:x,submitText:v="提交",transformData:b,children:D,...j}=r;const[S,q]=a(),[_,k]=s(!1),[E,z]=a(h),C=n((async(t,o)=>{if(!_)try{if(k(!0),w&&w(!0),u){let{formData:o}=t;b&&(o=b(o));try{const t=await m({url:u,method:f,data:o});return q(void 0),y&&await y(t),t}catch(t){if(!i.isAxiosError(t))throw t;q((t=>{const o=t.errors;return"string"==typeof o?{__errors:[o]}:l(o,(t=>({__errors:[t]})))})(t))}}else if(g)return await g(t,o)}finally{k(!1),w&&w(!1)}}),[u,f,g]),F=n((t=>{const{formData:o}=t;z(o),x&&x(t)}),[z,x]),N=n((t=>(t=t.map((t=>({keyword:t.name,dataPath:t.property,...t}))),c(t),t)),[]),U=t(p,{className:"px-4",loading:_,type:"submit",variant:"primary",children:v});return"function"==typeof D&&(D=D({submit:U,loading:_})),t(o,{ref:e,extraErrors:S,onSubmit:C,transformErrors:N,noHtml5Validate:!0,noValidate:!0,...j,formData:E,onChange:F,widgets:d,children:D||t("div",{className:"col-12",children:U})})}));export{u as default};
|
|
2
|
+
//# sourceMappingURL=form-74ef0417.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-74ef0417.js","sources":["../src/components/lazy/form.tsx"],"sourcesContent":["import JsonForm, { getRegistry, JsonFormProps, JsonFormType } from '@topthink/json-form';\r\nimport * as React from 'react';\r\nimport {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useCallback,\r\n useState\r\n} from 'react';\r\nimport axios, { AxiosError, Method } from 'axios';\r\nimport request from '../../request';\r\nimport { mapValues } from 'lodash';\r\nimport type { AjvError, ISubmitEvent, WidgetProps } from '@rjsf/core';\r\nimport Button from '../button';\r\nimport useSafeState from '../../hooks/use-safe-state';\r\n\r\nconst localize = require('ajv-i18n/localize/zh');\r\n\r\nexport interface FormProps<T = any> extends JsonFormProps<T> {\r\n onSuccess?: (data: any) => void;\r\n method?: Method;\r\n children?: ReactNode | ((props: { submit: ReactNode, loading: boolean }) => ReactNode);\r\n submitText?: string;\r\n onSubmitting?: (submitting: boolean) => void;\r\n transformData?: (data: T) => T;\r\n}\r\n\r\ntype Error = {\r\n __errors: string[]\r\n}\r\n\r\ntype Errors = Error | {\r\n [key: string]: Error\r\n}\r\n\r\nconst toExtraErrors = (error: AxiosError): Errors => {\r\n const errors = error.errors;\r\n if (typeof errors === 'string') {\r\n return {\r\n __errors: [errors]\r\n };\r\n }\r\n return mapValues(errors, (e) => {\r\n return {\r\n __errors: [e]\r\n };\r\n });\r\n};\r\n\r\nconst widgets = {\r\n upload: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\r\n const data = new FormData();\r\n\r\n data.set('file', file);\r\n\r\n const { url, value } = await request({\r\n url: options.endpoint as string,\r\n method: 'post',\r\n data\r\n });\r\n\r\n return { url, value };\r\n };\r\n }\r\n\r\n return <widgets.upload {...props} options={options} />;\r\n },\r\n editor: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\r\n const data = new FormData();\r\n\r\n data.set('file', file);\r\n\r\n const { url } = await request({\r\n url: options.endpoint as string,\r\n method: 'post',\r\n data\r\n });\r\n\r\n return url;\r\n };\r\n }\r\n\r\n return <widgets.editor {...props} options={options} />;\r\n },\r\n typeahead: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onSearch = async ({ value, query }) => {\r\n return await request({\r\n url: options.endpoint as string,\r\n params: { value, query }\r\n });\r\n };\r\n }\r\n\r\n return <widgets.typeahead {...props} options={options} />;\r\n }\r\n};\r\n\r\nexport interface FormType extends JsonFormType {\r\n\r\n}\r\n\r\nexport type CustomFormType<T = any> = ForwardRefExoticComponent<PropsWithoutRef<FormProps<T>> & RefAttributes<FormType>>\r\n\r\nconst Form: CustomFormType = forwardRef(({\r\n action,\r\n method = 'post',\r\n onSuccess,\r\n formData,\r\n onSubmitting,\r\n onSubmit,\r\n onChange,\r\n submitText = '提交',\r\n transformData,\r\n children,\r\n ...props\r\n}, ref) => {\r\n\r\n const [extraErrors, setExtraErrors] = useState<Errors>();\r\n const [loading, setLoading] = useSafeState(false);\r\n const [data, setData] = useState(formData);\r\n\r\n const handleSubmit = useCallback(async (e: ISubmitEvent<any>, nativeEvent: React.FormEvent<HTMLFormElement>) => {\r\n if (!loading) {\r\n try {\r\n setLoading(true);\r\n if (onSubmitting) {\r\n onSubmitting(true);\r\n }\r\n if (action) {\r\n let { formData } = e;\r\n\r\n if (transformData) {\r\n formData = transformData(formData);\r\n }\r\n\r\n //todo 包含File对象需转FormData\r\n try {\r\n const result = await request({\r\n url: action,\r\n method,\r\n data: formData\r\n });\r\n setExtraErrors(undefined);\r\n if (onSuccess) {\r\n await onSuccess(result);\r\n }\r\n return result;\r\n } catch (e) {\r\n if (axios.isAxiosError(e)) {\r\n setExtraErrors(toExtraErrors(e));\r\n } else {\r\n throw e;\r\n }\r\n }\r\n } else if (onSubmit) {\r\n return await onSubmit(e, nativeEvent);\r\n }\r\n } finally {\r\n setLoading(false);\r\n if (onSubmitting) {\r\n onSubmitting(false);\r\n }\r\n }\r\n }\r\n }, [action, method, onSubmit]);\r\n\r\n const handleChange = useCallback((e: ISubmitEvent<any>) => {\r\n const { formData } = e;\r\n setData(formData);\r\n if (onChange) {\r\n onChange(e);\r\n }\r\n }, [setData, onChange]);\r\n\r\n const transformErrors = useCallback((errors: AjvError[]) => {\r\n errors = errors.map(error => ({\r\n keyword: error.name,\r\n dataPath: error.property,\r\n ...error\r\n }));\r\n\r\n localize(errors);\r\n\r\n return errors;\r\n }, []);\r\n\r\n const submit = <Button className={'px-4'} loading={loading} type='submit' variant='primary'>{submitText}</Button>;\r\n\r\n if (typeof children === 'function') {\r\n children = children({ submit, loading });\r\n }\r\n\r\n return <JsonForm\r\n ref={ref}\r\n extraErrors={extraErrors}\r\n onSubmit={handleSubmit}\r\n transformErrors={transformErrors}\r\n noHtml5Validate\r\n noValidate\r\n {...props}\r\n formData={data}\r\n onChange={handleChange}\r\n widgets={widgets}\r\n >\r\n {children || <div className='col-12'>\r\n {submit}\r\n </div>}\r\n </JsonForm>;\r\n});\r\n\r\nexport default Form;\r\n"],"names":["localize","require","widgets","upload","_ref","options","props","getRegistry","endpoint","onUpload","async","data","FormData","set","file","url","value","request","method","_jsx","editor","_ref2","typeahead","_ref3","onSearch","query","_ref4","params","Form","forwardRef","_ref5","ref","action","onSuccess","formData","onSubmitting","onSubmit","onChange","submitText","transformData","children","extraErrors","setExtraErrors","useState","loading","setLoading","useSafeState","setData","handleSubmit","useCallback","e","nativeEvent","result","undefined","axios","isAxiosError","error","errors","__errors","mapValues","toExtraErrors","handleChange","transformErrors","map","keyword","name","dataPath","property","submit","Button","className","type","variant","JsonForm","noHtml5Validate","noValidate"],"mappings":"sfAkBA,MAAMA,EAAWC,QAAQ,wBAiCnBC,EAAU,CACZC,OAAQ,SAA2CC,GAAA,IAAlCC,QAAEA,KAAYC,GAAoBF,EAC/C,MAAMF,QAAEA,GAAYK,IAmBpB,OAjBIF,EAAQG,WACRH,EAAQI,SAAWC,UAEf,MAAMC,EAAO,IAAIC,SAEjBD,EAAKE,IAAI,OAAQC,GAEjB,MAAMC,IAAEA,EAAGC,MAAEA,SAAgBC,EAAQ,CACjCF,IAAKV,EAAQG,SACbU,OAAQ,OACRP,SAGJ,MAAO,CAAEI,MAAKC,QAAO,GAItBG,EAACjB,EAAQC,OAAM,IAAKG,EAAOD,QAASA,GAC9C,EACDe,OAAQ,SAA2CC,GAAA,IAAlChB,QAAEA,KAAYC,GAAoBe,EAC/C,MAAMnB,QAAEA,GAAYK,IAmBpB,OAjBIF,EAAQG,WACRH,EAAQI,SAAWC,UAEf,MAAMC,EAAO,IAAIC,SAEjBD,EAAKE,IAAI,OAAQC,GAEjB,MAAMC,IAAEA,SAAcE,EAAQ,CAC1BF,IAAKV,EAAQG,SACbU,OAAQ,OACRP,SAGJ,OAAOI,CAAG,GAIXI,EAACjB,EAAQkB,OAAM,IAAKd,EAAOD,QAASA,GAC9C,EACDiB,UAAW,SAA2CC,GAAA,IAAlClB,QAAEA,KAAYC,GAAoBiB,EAClD,MAAMrB,QAAEA,GAAYK,IAWpB,OATIF,EAAQG,WACRH,EAAQmB,SAAWd,UAA2B,IAApBM,MAAEA,EAAKS,MAAEA,GAAOC,EACtC,aAAaT,EAAQ,CACjBF,IAAKV,EAAQG,SACbmB,OAAQ,CAAEX,QAAOS,UACnB,GAIHN,EAACjB,EAAQoB,UAAS,IAAKhB,EAAOD,QAASA,GAClD,GASEuB,EAAuBC,GA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,UAAShC,SAAEF,IAM7F,MAJwB,mBAAbE,IACPA,EAAWA,EAAS,CAAE4B,SAAQxB,aAG3BzB,EAACsD,EACJ,CAAA1C,IAAKA,EACLU,YAAaA,EACbL,SAAUY,EACVc,gBAAiBA,EACjBY,iBAAe,EACfC,YAAU,KACNrE,EACJ4B,SAAUvB,EACV0B,SAAUwB,EACV3D,QAASA,WAERsC,GAAYrB,SAAKmD,UAAU,SACvB9B,SAAA4B,KAEE"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import JsonForm, { getRegistry } from '@topthink/json-form';
|
|
3
|
+
import { forwardRef, useState, useCallback } from 'react';
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
import { u as useSafeState, r as request, B as Button } from './index-9869b1c6.js';
|
|
6
|
+
import { mapValues } from 'lodash';
|
|
7
|
+
import 'sweetalert2/dist/sweetalert2.js';
|
|
8
|
+
import 'sweetalert2-react-content';
|
|
9
|
+
import 'react-bootstrap';
|
|
10
|
+
import 'query-string';
|
|
11
|
+
import 'retry-axios';
|
|
12
|
+
import 'rc-notification';
|
|
13
|
+
import 'styled-components';
|
|
14
|
+
import 'classnames';
|
|
15
|
+
import 'react-async-hook';
|
|
16
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
17
|
+
|
|
18
|
+
const localize = require('ajv-i18n/localize/zh');
|
|
19
|
+
const toExtraErrors = error => {
|
|
20
|
+
const errors = error.errors;
|
|
21
|
+
if (typeof errors === 'string') {
|
|
22
|
+
return {
|
|
23
|
+
__errors: [errors]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return mapValues(errors, e => {
|
|
27
|
+
return {
|
|
28
|
+
__errors: [e]
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const widgets = {
|
|
33
|
+
upload: function (_ref) {
|
|
34
|
+
let {
|
|
35
|
+
options,
|
|
36
|
+
...props
|
|
37
|
+
} = _ref;
|
|
38
|
+
const {
|
|
39
|
+
widgets
|
|
40
|
+
} = getRegistry();
|
|
41
|
+
if (options.endpoint) {
|
|
42
|
+
options.onUpload = async file => {
|
|
43
|
+
const data = new FormData();
|
|
44
|
+
data.set('file', file);
|
|
45
|
+
const {
|
|
46
|
+
url,
|
|
47
|
+
value
|
|
48
|
+
} = await request({
|
|
49
|
+
url: options.endpoint,
|
|
50
|
+
method: 'post',
|
|
51
|
+
data
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
url,
|
|
55
|
+
value
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return jsx(widgets.upload, {
|
|
60
|
+
...props,
|
|
61
|
+
options: options
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
editor: function (_ref2) {
|
|
65
|
+
let {
|
|
66
|
+
options,
|
|
67
|
+
...props
|
|
68
|
+
} = _ref2;
|
|
69
|
+
const {
|
|
70
|
+
widgets
|
|
71
|
+
} = getRegistry();
|
|
72
|
+
if (options.endpoint) {
|
|
73
|
+
options.onUpload = async file => {
|
|
74
|
+
const data = new FormData();
|
|
75
|
+
data.set('file', file);
|
|
76
|
+
const {
|
|
77
|
+
url
|
|
78
|
+
} = await request({
|
|
79
|
+
url: options.endpoint,
|
|
80
|
+
method: 'post',
|
|
81
|
+
data
|
|
82
|
+
});
|
|
83
|
+
return url;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return jsx(widgets.editor, {
|
|
87
|
+
...props,
|
|
88
|
+
options: options
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
typeahead: function (_ref3) {
|
|
92
|
+
let {
|
|
93
|
+
options,
|
|
94
|
+
...props
|
|
95
|
+
} = _ref3;
|
|
96
|
+
const {
|
|
97
|
+
widgets
|
|
98
|
+
} = getRegistry();
|
|
99
|
+
if (options.endpoint) {
|
|
100
|
+
options.onSearch = async _ref4 => {
|
|
101
|
+
let {
|
|
102
|
+
value,
|
|
103
|
+
query
|
|
104
|
+
} = _ref4;
|
|
105
|
+
return await request({
|
|
106
|
+
url: options.endpoint,
|
|
107
|
+
params: {
|
|
108
|
+
value,
|
|
109
|
+
query
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return jsx(widgets.typeahead, {
|
|
115
|
+
...props,
|
|
116
|
+
options: options
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const Form = forwardRef((_ref5, ref) => {
|
|
121
|
+
let {
|
|
122
|
+
action,
|
|
123
|
+
method = 'post',
|
|
124
|
+
onSuccess,
|
|
125
|
+
formData,
|
|
126
|
+
onSubmitting,
|
|
127
|
+
onSubmit,
|
|
128
|
+
onChange,
|
|
129
|
+
submitText = '提交',
|
|
130
|
+
transformData,
|
|
131
|
+
children,
|
|
132
|
+
...props
|
|
133
|
+
} = _ref5;
|
|
134
|
+
const [extraErrors, setExtraErrors] = useState();
|
|
135
|
+
const [loading, setLoading] = useSafeState(false);
|
|
136
|
+
const [data, setData] = useState(formData);
|
|
137
|
+
const handleSubmit = useCallback(async (e, nativeEvent) => {
|
|
138
|
+
if (!loading) {
|
|
139
|
+
try {
|
|
140
|
+
setLoading(true);
|
|
141
|
+
if (onSubmitting) {
|
|
142
|
+
onSubmitting(true);
|
|
143
|
+
}
|
|
144
|
+
if (action) {
|
|
145
|
+
let {
|
|
146
|
+
formData
|
|
147
|
+
} = e;
|
|
148
|
+
if (transformData) {
|
|
149
|
+
formData = transformData(formData);
|
|
150
|
+
}
|
|
151
|
+
//todo 包含File对象需转FormData
|
|
152
|
+
try {
|
|
153
|
+
const result = await request({
|
|
154
|
+
url: action,
|
|
155
|
+
method,
|
|
156
|
+
data: formData
|
|
157
|
+
});
|
|
158
|
+
setExtraErrors(undefined);
|
|
159
|
+
if (onSuccess) {
|
|
160
|
+
await onSuccess(result);
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
163
|
+
} catch (e) {
|
|
164
|
+
if (axios.isAxiosError(e)) {
|
|
165
|
+
setExtraErrors(toExtraErrors(e));
|
|
166
|
+
} else {
|
|
167
|
+
throw e;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
} else if (onSubmit) {
|
|
171
|
+
return await onSubmit(e, nativeEvent);
|
|
172
|
+
}
|
|
173
|
+
} finally {
|
|
174
|
+
setLoading(false);
|
|
175
|
+
if (onSubmitting) {
|
|
176
|
+
onSubmitting(false);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}, [action, method, onSubmit]);
|
|
181
|
+
const handleChange = useCallback(e => {
|
|
182
|
+
const {
|
|
183
|
+
formData
|
|
184
|
+
} = e;
|
|
185
|
+
setData(formData);
|
|
186
|
+
if (onChange) {
|
|
187
|
+
onChange(e);
|
|
188
|
+
}
|
|
189
|
+
}, [setData, onChange]);
|
|
190
|
+
const transformErrors = useCallback(errors => {
|
|
191
|
+
errors = errors.map(error => ({
|
|
192
|
+
keyword: error.name,
|
|
193
|
+
dataPath: error.property,
|
|
194
|
+
...error
|
|
195
|
+
}));
|
|
196
|
+
localize(errors);
|
|
197
|
+
return errors;
|
|
198
|
+
}, []);
|
|
199
|
+
const submit = jsx(Button, {
|
|
200
|
+
className: 'px-4',
|
|
201
|
+
loading: loading,
|
|
202
|
+
type: 'submit',
|
|
203
|
+
variant: 'primary',
|
|
204
|
+
children: submitText
|
|
205
|
+
});
|
|
206
|
+
if (typeof children === 'function') {
|
|
207
|
+
children = children({
|
|
208
|
+
submit,
|
|
209
|
+
loading
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
return jsx(JsonForm, {
|
|
213
|
+
ref: ref,
|
|
214
|
+
extraErrors: extraErrors,
|
|
215
|
+
onSubmit: handleSubmit,
|
|
216
|
+
transformErrors: transformErrors,
|
|
217
|
+
noHtml5Validate: true,
|
|
218
|
+
noValidate: true,
|
|
219
|
+
...props,
|
|
220
|
+
formData: data,
|
|
221
|
+
onChange: handleChange,
|
|
222
|
+
widgets: widgets,
|
|
223
|
+
children: children || jsx("div", {
|
|
224
|
+
className: 'col-12',
|
|
225
|
+
children: submit
|
|
226
|
+
})
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
export { Form as default };
|
|
231
|
+
//# sourceMappingURL=form-8925a750.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-8925a750.js","sources":["../src/components/lazy/form.tsx"],"sourcesContent":["import JsonForm, { getRegistry, JsonFormProps, JsonFormType } from '@topthink/json-form';\r\nimport * as React from 'react';\r\nimport {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useCallback,\r\n useState\r\n} from 'react';\r\nimport axios, { AxiosError, Method } from 'axios';\r\nimport request from '../../request';\r\nimport { mapValues } from 'lodash';\r\nimport type { AjvError, ISubmitEvent, WidgetProps } from '@rjsf/core';\r\nimport Button from '../button';\r\nimport useSafeState from '../../hooks/use-safe-state';\r\n\r\nconst localize = require('ajv-i18n/localize/zh');\r\n\r\nexport interface FormProps<T = any> extends JsonFormProps<T> {\r\n onSuccess?: (data: any) => void;\r\n method?: Method;\r\n children?: ReactNode | ((props: { submit: ReactNode, loading: boolean }) => ReactNode);\r\n submitText?: string;\r\n onSubmitting?: (submitting: boolean) => void;\r\n transformData?: (data: T) => T;\r\n}\r\n\r\ntype Error = {\r\n __errors: string[]\r\n}\r\n\r\ntype Errors = Error | {\r\n [key: string]: Error\r\n}\r\n\r\nconst toExtraErrors = (error: AxiosError): Errors => {\r\n const errors = error.errors;\r\n if (typeof errors === 'string') {\r\n return {\r\n __errors: [errors]\r\n };\r\n }\r\n return mapValues(errors, (e) => {\r\n return {\r\n __errors: [e]\r\n };\r\n });\r\n};\r\n\r\nconst widgets = {\r\n upload: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\r\n const data = new FormData();\r\n\r\n data.set('file', file);\r\n\r\n const { url, value } = await request({\r\n url: options.endpoint as string,\r\n method: 'post',\r\n data\r\n });\r\n\r\n return { url, value };\r\n };\r\n }\r\n\r\n return <widgets.upload {...props} options={options} />;\r\n },\r\n editor: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\r\n const data = new FormData();\r\n\r\n data.set('file', file);\r\n\r\n const { url } = await request({\r\n url: options.endpoint as string,\r\n method: 'post',\r\n data\r\n });\r\n\r\n return url;\r\n };\r\n }\r\n\r\n return <widgets.editor {...props} options={options} />;\r\n },\r\n typeahead: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onSearch = async ({ value, query }) => {\r\n return await request({\r\n url: options.endpoint as string,\r\n params: { value, query }\r\n });\r\n };\r\n }\r\n\r\n return <widgets.typeahead {...props} options={options} />;\r\n }\r\n};\r\n\r\nexport interface FormType extends JsonFormType {\r\n\r\n}\r\n\r\nexport type CustomFormType<T = any> = ForwardRefExoticComponent<PropsWithoutRef<FormProps<T>> & RefAttributes<FormType>>\r\n\r\nconst Form: CustomFormType = forwardRef(({\r\n action,\r\n method = 'post',\r\n onSuccess,\r\n formData,\r\n onSubmitting,\r\n onSubmit,\r\n onChange,\r\n submitText = '提交',\r\n transformData,\r\n children,\r\n ...props\r\n}, ref) => {\r\n\r\n const [extraErrors, setExtraErrors] = useState<Errors>();\r\n const [loading, setLoading] = useSafeState(false);\r\n const [data, setData] = useState(formData);\r\n\r\n const handleSubmit = useCallback(async (e: ISubmitEvent<any>, nativeEvent: React.FormEvent<HTMLFormElement>) => {\r\n if (!loading) {\r\n try {\r\n setLoading(true);\r\n if (onSubmitting) {\r\n onSubmitting(true);\r\n }\r\n if (action) {\r\n let { formData } = e;\r\n\r\n if (transformData) {\r\n formData = transformData(formData);\r\n }\r\n\r\n //todo 包含File对象需转FormData\r\n try {\r\n const result = await request({\r\n url: action,\r\n method,\r\n data: formData\r\n });\r\n setExtraErrors(undefined);\r\n if (onSuccess) {\r\n await onSuccess(result);\r\n }\r\n return result;\r\n } catch (e) {\r\n if (axios.isAxiosError(e)) {\r\n setExtraErrors(toExtraErrors(e));\r\n } else {\r\n throw e;\r\n }\r\n }\r\n } else if (onSubmit) {\r\n return await onSubmit(e, nativeEvent);\r\n }\r\n } finally {\r\n setLoading(false);\r\n if (onSubmitting) {\r\n onSubmitting(false);\r\n }\r\n }\r\n }\r\n }, [action, method, onSubmit]);\r\n\r\n const handleChange = useCallback((e: ISubmitEvent<any>) => {\r\n const { formData } = e;\r\n setData(formData);\r\n if (onChange) {\r\n onChange(e);\r\n }\r\n }, [setData, onChange]);\r\n\r\n const transformErrors = useCallback((errors: AjvError[]) => {\r\n errors = errors.map(error => ({\r\n keyword: error.name,\r\n dataPath: error.property,\r\n ...error\r\n }));\r\n\r\n localize(errors);\r\n\r\n return errors;\r\n }, []);\r\n\r\n const submit = <Button className={'px-4'} loading={loading} type='submit' variant='primary'>{submitText}</Button>;\r\n\r\n if (typeof children === 'function') {\r\n children = children({ submit, loading });\r\n }\r\n\r\n return <JsonForm\r\n ref={ref}\r\n extraErrors={extraErrors}\r\n onSubmit={handleSubmit}\r\n transformErrors={transformErrors}\r\n noHtml5Validate\r\n noValidate\r\n {...props}\r\n formData={data}\r\n onChange={handleChange}\r\n widgets={widgets}\r\n >\r\n {children || <div className='col-12'>\r\n {submit}\r\n </div>}\r\n </JsonForm>;\r\n});\r\n\r\nexport default Form;\r\n"],"names":["localize","require","toExtraErrors","error","errors","__errors","mapValues","e","widgets","upload","options","props","getRegistry","endpoint","onUpload","file","data","FormData","set","url","value","request","method","_jsx","editor","typeahead","onSearch","query","params","Form","forwardRef","ref","action","onSuccess","formData","onSubmitting","onSubmit","onChange","submitText","transformData","children","extraErrors","setExtraErrors","useState","loading","setLoading","useSafeState","setData","handleSubmit","useCallback","nativeEvent","result","undefined","axios","isAxiosError","handleChange","transformErrors","map","keyword","name","dataPath","property","submit","Button","className","type","variant","JsonForm","noHtml5Validate","noValidate"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAMA,QAAQ,GAAGC,OAAO,CAAC,sBAAsB,CAAC,CAAA;AAmBhD,MAAMC,aAAa,GAAIC,KAAiB,IAAY;AAChD,EAAA,MAAMC,MAAM,GAAGD,KAAK,CAACC,MAAM,CAAA;AAC3B,EAAA,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC5B,OAAO;MACHC,QAAQ,EAAE,CAACD,MAAM,CAAA;KACpB,CAAA;AACJ,GAAA;AACD,EAAA,OAAOE,SAAS,CAACF,MAAM,EAAGG,CAAC,IAAI;IAC3B,OAAO;MACHF,QAAQ,EAAE,CAACE,CAAC,CAAA;KACf,CAAA;AACL,GAAC,CAAC,CAAA;AACN,CAAC,CAAA;AAED,MAAMC,OAAO,GAAG;AACZC,EAAAA,MAAM,EAAE,UAA2C,IAAA,EAAA;IAAA,IAAlC;MAAEC,OAAO;MAAE,GAAGC,KAAAA;KAAoB,GAAA,IAAA,CAAA;IAC/C,MAAM;AAAEH,MAAAA,OAAAA;KAAS,GAAGI,WAAW,EAAE,CAAA;IAEjC,IAAIF,OAAO,CAACG,QAAQ,EAAE;AAClBH,MAAAA,OAAO,CAACI,QAAQ,GAAG,MAAOC,IAAU,IAAI;AAEpC,QAAA,MAAMC,IAAI,GAAG,IAAIC,QAAQ,EAAE,CAAA;AAE3BD,QAAAA,IAAI,CAACE,GAAG,CAAC,MAAM,EAAEH,IAAI,CAAC,CAAA;QAEtB,MAAM;UAAEI,GAAG;AAAEC,UAAAA,KAAAA;SAAO,GAAG,MAAMC,OAAO,CAAC;UACjCF,GAAG,EAAET,OAAO,CAACG,QAAkB;AAC/BS,UAAAA,MAAM,EAAE,MAAM;AACdN,UAAAA,IAAAA;AACH,SAAA,CAAC,CAAA;QAEF,OAAO;UAAEG,GAAG;AAAEC,UAAAA,K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