@digi-frontend/dgate-api-documentation 1.0.25 → 1.0.27
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/node_modules/dom-serializer/lib/foreignNames.js +2 -0
- package/dist/node_modules/dom-serializer/lib/foreignNames.js.map +1 -0
- package/dist/node_modules/dom-serializer/lib/index.js +2 -0
- package/dist/node_modules/dom-serializer/lib/index.js.map +1 -0
- package/dist/node_modules/domhandler/lib/index.js +2 -0
- package/dist/node_modules/domhandler/lib/index.js.map +1 -0
- package/dist/node_modules/domhandler/lib/node.js +2 -0
- package/dist/node_modules/domhandler/lib/node.js.map +1 -0
- package/dist/node_modules/domutils/lib/feeds.js +2 -0
- package/dist/node_modules/domutils/lib/feeds.js.map +1 -0
- package/dist/node_modules/domutils/lib/helpers.js +2 -0
- package/dist/node_modules/domutils/lib/helpers.js.map +1 -0
- package/dist/node_modules/domutils/lib/index.js +2 -0
- package/dist/node_modules/domutils/lib/index.js.map +1 -0
- package/dist/node_modules/domutils/lib/legacy.js +2 -0
- package/dist/node_modules/domutils/lib/legacy.js.map +1 -0
- package/dist/node_modules/domutils/lib/manipulation.js +2 -0
- package/dist/node_modules/domutils/lib/manipulation.js.map +1 -0
- package/dist/node_modules/domutils/lib/querying.js +2 -0
- package/dist/node_modules/domutils/lib/querying.js.map +1 -0
- package/dist/node_modules/domutils/lib/stringify.js +2 -0
- package/dist/node_modules/domutils/lib/stringify.js.map +1 -0
- package/dist/node_modules/domutils/lib/traversal.js +2 -0
- package/dist/node_modules/domutils/lib/traversal.js.map +1 -0
- package/dist/node_modules/entities/lib/decode.js +2 -0
- package/dist/node_modules/entities/lib/decode.js.map +1 -0
- package/dist/node_modules/entities/lib/decode_codepoint.js +2 -0
- package/dist/node_modules/entities/lib/decode_codepoint.js.map +1 -0
- package/dist/node_modules/entities/lib/encode.js +2 -0
- package/dist/node_modules/entities/lib/encode.js.map +1 -0
- package/dist/node_modules/entities/lib/escape.js +2 -0
- package/dist/node_modules/entities/lib/escape.js.map +1 -0
- package/dist/node_modules/entities/lib/generated/decode-data-html.js +2 -0
- package/dist/node_modules/entities/lib/generated/decode-data-html.js.map +1 -0
- package/dist/node_modules/entities/lib/generated/decode-data-xml.js +2 -0
- package/dist/node_modules/entities/lib/generated/decode-data-xml.js.map +1 -0
- package/dist/node_modules/entities/lib/generated/encode-html.js +2 -0
- package/dist/node_modules/entities/lib/generated/encode-html.js.map +1 -0
- package/dist/node_modules/entities/lib/index.js +2 -0
- package/dist/node_modules/entities/lib/index.js.map +1 -0
- package/dist/node_modules/html-dom-parser/lib/server/html-to-dom.js +1 -1
- package/dist/node_modules/html-dom-parser/lib/server/html-to-dom.js.map +1 -1
- package/dist/node_modules/html-react-parser/lib/index.js +1 -1
- package/dist/node_modules/html-react-parser/lib/index.js.map +1 -1
- package/dist/node_modules/htmlparser2/dist/commonjs/index.js +1 -1
- package/dist/node_modules/htmlparser2/dist/commonjs/index.js.map +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/src/components/InfoForm/InfoForm.js +1 -1
- package/dist/src/components/InfoForm/InfoForm.js.map +1 -1
- package/dist/src/components/JsonInput/JsonInput.js +1 -1
- package/dist/src/components/JsonInput/JsonInput.js.map +1 -1
- package/dist/src/components/LivePreview/LivePreview.js +1 -1
- package/dist/src/components/LivePreview/LivePreview.js.map +1 -1
- package/dist/src/components/MethodAccordion/MethodAccordion.js +1 -1
- package/dist/src/components/MethodAccordion/MethodAccordion.js.map +1 -1
- package/dist/src/components/table/table.js +1 -1
- package/dist/src/components/table/table.js.map +1 -1
- package/dist/src/components/table/tags-table.js +1 -1
- package/dist/src/components/table/tags-table.js.map +1 -1
- package/dist/src/constants/regex.js +1 -1
- package/dist/src/constants/regex.js.map +1 -1
- package/dist/src/helpers/layout.helper.js +1 -1
- package/dist/src/helpers/layout.helper.js.map +1 -1
- package/dist/src/layout/layout.js +1 -1
- package/dist/src/layout/layout.js.map +1 -1
- package/dist/src/layout/layout.module.css.js +1 -1
- package/dist/src/validator/form.scheme.js +1 -1
- package/dist/src/validator/form.scheme.js.map +1 -1
- package/dist/styles.css +425 -386
- package/dist/types/components/MethodAccordion/MethodAccordion.d.ts +3 -1
- package/dist/types/constants/regex.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/InfoForm/InfoForm.module.scss +24 -1
- package/src/components/InfoForm/InfoForm.tsx +71 -35
- package/src/components/JsonInput/JsonInput.tsx +11 -6
- package/src/components/LivePreview/LivePreview.module.scss +24 -5
- package/src/components/LivePreview/LivePreview.tsx +7 -4
- package/src/components/MethodAccordion/MethodAccordion.tsx +80 -64
- package/src/components/Tooltip/Tooltip.scss +9 -6
- package/src/components/table/style.scss +1 -1
- package/src/components/table/table.tsx +9 -8
- package/src/components/table/tags-table.tsx +26 -13
- package/src/constants/regex.ts +1 -0
- package/src/helpers/layout.helper.ts +6 -1
- package/src/layout/layout.module.css +6 -0
- package/src/layout/layout.tsx +13 -9
- package/src/validator/form.scheme.ts +1 -1
- package/dist/_virtual/index20.js +0 -2
- package/dist/_virtual/index20.js.map +0 -1
- package/dist/_virtual/index21.js +0 -2
- package/dist/_virtual/index21.js.map +0 -1
- package/dist/_virtual/node2.js +0 -2
- package/dist/_virtual/node2.js.map +0 -1
- package/dist/_virtual/node3.js +0 -2
- package/dist/_virtual/node3.js.map +0 -1
- package/dist/node_modules/html-dom-parser/node_modules/domhandler/lib/index.js +0 -2
- package/dist/node_modules/html-dom-parser/node_modules/domhandler/lib/index.js.map +0 -1
- package/dist/node_modules/html-dom-parser/node_modules/domhandler/lib/node.js +0 -2
- package/dist/node_modules/html-dom-parser/node_modules/domhandler/lib/node.js.map +0 -1
- package/dist/node_modules/html-react-parser/node_modules/domhandler/lib/index.js +0 -2
- package/dist/node_modules/html-react-parser/node_modules/domhandler/lib/index.js.map +0 -1
- package/dist/node_modules/html-react-parser/node_modules/domhandler/lib/node.js +0 -2
- package/dist/node_modules/html-react-parser/node_modules/domhandler/lib/node.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/lib/foreignNames.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/lib/foreignNames.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/lib/index.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/lib/index.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/decode.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/decode.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/decode_codepoint.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/decode_codepoint.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/encode.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/encode.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/escape.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/escape.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/generated/decode-data-html.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/generated/decode-data-html.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/generated/decode-data-xml.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/generated/decode-data-xml.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/generated/encode-html.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/generated/encode-html.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/index.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/dom-serializer/node_modules/entities/lib/index.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/domhandler/lib/index.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/domhandler/lib/index.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/domhandler/lib/node.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/domhandler/lib/node.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/feeds.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/feeds.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/helpers.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/helpers.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/index.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/index.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/legacy.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/legacy.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/querying.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/querying.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/stringify.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/stringify.js.map +0 -1
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/traversal.js +0 -2
- package/dist/node_modules/htmlparser2/node_modules/domutils/lib/traversal.js.map +0 -1
- package/dist/src/assets/icons/CheckMarkSquare.svg.js +0 -2
- package/dist/src/assets/icons/CheckMarkSquare.svg.js.map +0 -1
- package/dist/src/assets/icons/CloseIcon.svg.js +0 -2
- package/dist/src/assets/icons/CloseIcon.svg.js.map +0 -1
- package/dist/src/assets/icons/UpArrow.svg.js +0 -2
- package/dist/src/assets/icons/UpArrow.svg.js.map +0 -1
- package/dist/src/components/Chips/Chips.js +0 -2
- package/dist/src/components/Chips/Chips.js.map +0 -1
- package/dist/types/types/index.d.ts +0 -18
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { TransformedMethod } from '../../types/layout.type';
|
|
2
2
|
import { Tags } from '@entities/openApi';
|
|
3
|
-
declare const MethodsAccordion: ({ method, path, setFieldValue, readOnly, tags, }: {
|
|
3
|
+
declare const MethodsAccordion: ({ method, path, setFieldValue, readOnly, tags, isOpen, setIsOpen, }: {
|
|
4
4
|
method: TransformedMethod;
|
|
5
5
|
path: string;
|
|
6
6
|
setFieldValue?: (key: string, value: string | string[]) => void;
|
|
7
7
|
readOnly?: boolean;
|
|
8
8
|
tags: Tags[];
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
setIsOpen: (open: boolean) => void;
|
|
9
11
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export default MethodsAccordion;
|
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
display: flex;
|
|
29
29
|
align-items: center;
|
|
30
30
|
padding: 0;
|
|
31
|
-
|
|
31
|
+
font-size: 0.875rem;
|
|
32
32
|
|
|
33
33
|
:global(.endBtnIcon) {
|
|
34
34
|
margin-block: auto;
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
&.deleteParamBtn {
|
|
46
46
|
padding: 0;
|
|
47
|
+
border-width: 0 !important;
|
|
47
48
|
|
|
48
49
|
:global(.btnContentWrapper) {
|
|
49
50
|
:global(.endBtnIcon) {
|
|
@@ -71,6 +72,28 @@
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
|
|
75
|
+
.externalDocsLink {
|
|
76
|
+
font-size: 0.875rem;
|
|
77
|
+
line-height: 1.25rem;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
align-self: center;
|
|
80
|
+
margin-right: 2rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.editExternalDocs {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
padding-right: 0.625rem;
|
|
87
|
+
|
|
88
|
+
svg {
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
|
|
91
|
+
path {
|
|
92
|
+
fill: #12131a;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
74
97
|
.editDescTooltipContent {
|
|
75
98
|
display: flex;
|
|
76
99
|
flex-direction: column;
|
|
@@ -44,7 +44,6 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
|
|
|
44
44
|
|
|
45
45
|
useEffect(() => {
|
|
46
46
|
if (values.tags && values.tags.length) {
|
|
47
|
-
setTableRecords(generateTableRecords(values.tags))
|
|
48
47
|
setTableData(values.tags)
|
|
49
48
|
}
|
|
50
49
|
}, [values.tags])
|
|
@@ -133,10 +132,14 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
|
|
|
133
132
|
<div className={styles.editDescTooltipContent}>
|
|
134
133
|
<p className={styles.editDescTooltipContent_header}>Description</p>
|
|
135
134
|
<TextArea
|
|
136
|
-
placeholder="Describe
|
|
135
|
+
placeholder="Describe tag..."
|
|
137
136
|
value={item.description}
|
|
138
137
|
disabled={readOnly}
|
|
139
|
-
onChange={(value) =>
|
|
138
|
+
onChange={(value) => {
|
|
139
|
+
if (value === '' || regex.ASCII.test(value))
|
|
140
|
+
onTableChange('description', value, index)
|
|
141
|
+
}}
|
|
142
|
+
maxLength={25}
|
|
140
143
|
/>
|
|
141
144
|
{!readOnly && (
|
|
142
145
|
<Button
|
|
@@ -144,9 +147,10 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
|
|
|
144
147
|
variant="outlined"
|
|
145
148
|
size="small"
|
|
146
149
|
onClick={() => {
|
|
147
|
-
setFieldValue(`tags[${index}].description`, item.description)
|
|
150
|
+
setFieldValue(`tags[${index}].description`, item.description?.trim())
|
|
148
151
|
tooltipRefs[index]?.hide()
|
|
149
152
|
}}
|
|
153
|
+
disabled={!item.description?.trim()}
|
|
150
154
|
>
|
|
151
155
|
Apply
|
|
152
156
|
</Button>
|
|
@@ -178,6 +182,27 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
|
|
|
178
182
|
),
|
|
179
183
|
externalDocs: (
|
|
180
184
|
<div className={styles.paramDescContainer}>
|
|
185
|
+
{values.tags[index].externalDocs?.description && values.tags[index].externalDocs?.url && (
|
|
186
|
+
<a
|
|
187
|
+
className={styles.externalDocsLink}
|
|
188
|
+
href={values.tags[index].externalDocs?.url}
|
|
189
|
+
target="_blank"
|
|
190
|
+
style={
|
|
191
|
+
!values.tags[index].externalDocs?.description
|
|
192
|
+
? { textDecoration: 'none', pointerEvents: 'none' }
|
|
193
|
+
: {}
|
|
194
|
+
}
|
|
195
|
+
>
|
|
196
|
+
{values.tags[index].externalDocs?.description
|
|
197
|
+
? values.tags[index].externalDocs?.description?.substring(0, 12)
|
|
198
|
+
: readOnly && '-'}
|
|
199
|
+
{values.tags[index].externalDocs?.description &&
|
|
200
|
+
values.tags[index].externalDocs?.description?.length > 12
|
|
201
|
+
? '...'
|
|
202
|
+
: ''}
|
|
203
|
+
</a>
|
|
204
|
+
)}
|
|
205
|
+
|
|
181
206
|
<Tooltip
|
|
182
207
|
arrowWithBorder
|
|
183
208
|
placement="bottom-end"
|
|
@@ -197,13 +222,16 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
|
|
|
197
222
|
placeholder="Describe External Doc..."
|
|
198
223
|
value={item.externalDocs?.description}
|
|
199
224
|
disabled={readOnly}
|
|
225
|
+
maxLength={25}
|
|
200
226
|
onChange={(value) => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
227
|
+
if (value === '' || regex.ASCII.test(value)) {
|
|
228
|
+
onTableChange(
|
|
229
|
+
'externalDocs',
|
|
230
|
+
{ ...item.externalDocs, description: value },
|
|
231
|
+
index
|
|
232
|
+
)
|
|
233
|
+
setDescription(value)
|
|
234
|
+
}
|
|
207
235
|
}}
|
|
208
236
|
/>
|
|
209
237
|
<p className={styles.editDescTooltipContent_header}>External Docs Link</p>
|
|
@@ -211,9 +239,12 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
|
|
|
211
239
|
placeholder="External Docs Link..."
|
|
212
240
|
value={item.externalDocs?.url}
|
|
213
241
|
disabled={readOnly}
|
|
242
|
+
maxLength={200}
|
|
214
243
|
onChange={(value) => {
|
|
215
|
-
|
|
216
|
-
|
|
244
|
+
if (value === '' || regex.ASCII.test(value)) {
|
|
245
|
+
onTableChange('externalDocs', { ...item.externalDocs, url: value }, index)
|
|
246
|
+
setURL(value)
|
|
247
|
+
}
|
|
217
248
|
}}
|
|
218
249
|
/>
|
|
219
250
|
{!readOnly && (
|
|
@@ -223,13 +254,22 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
|
|
|
223
254
|
size="small"
|
|
224
255
|
onClick={() => {
|
|
225
256
|
setFieldValue(`tags[${index}].externalDocs`, {
|
|
226
|
-
description: description,
|
|
227
|
-
url: url,
|
|
257
|
+
description: description?.trim(),
|
|
258
|
+
url: url?.trim(),
|
|
228
259
|
})
|
|
229
260
|
setDescription('')
|
|
230
261
|
setURL('')
|
|
231
262
|
externalTooltipRefs[index]?.hide()
|
|
232
263
|
}}
|
|
264
|
+
disabled={
|
|
265
|
+
!(
|
|
266
|
+
(values.tags[index].externalDocs?.description &&
|
|
267
|
+
values.tags[index].externalDocs?.url &&
|
|
268
|
+
!description?.trim() &&
|
|
269
|
+
!url?.trim()) ||
|
|
270
|
+
(description?.trim() && url?.trim() && regex.urlRegex.test(url))
|
|
271
|
+
)
|
|
272
|
+
}
|
|
233
273
|
>
|
|
234
274
|
Apply
|
|
235
275
|
</Button>
|
|
@@ -238,24 +278,18 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
|
|
|
238
278
|
}
|
|
239
279
|
>
|
|
240
280
|
{readOnly || values.tags[index].externalDocs?.description ? (
|
|
241
|
-
<
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
: '-'}
|
|
254
|
-
{values.tags[index].externalDocs?.description &&
|
|
255
|
-
values.tags[index].externalDocs?.description?.length > 12
|
|
256
|
-
? '...'
|
|
257
|
-
: ''}
|
|
258
|
-
</Button>
|
|
281
|
+
<div className={styles.editExternalDocs}>
|
|
282
|
+
<SVGLoader
|
|
283
|
+
src={EditIcon}
|
|
284
|
+
width="1.5rem"
|
|
285
|
+
height="1.5rem"
|
|
286
|
+
onClick={(e) => {
|
|
287
|
+
e?.stopPropagation()
|
|
288
|
+
setDescription(item.externalDocs?.description)
|
|
289
|
+
setURL(item.externalDocs?.url)
|
|
290
|
+
}}
|
|
291
|
+
/>
|
|
292
|
+
</div>
|
|
259
293
|
) : (
|
|
260
294
|
<Button
|
|
261
295
|
className={styles.editDescBtn}
|
|
@@ -268,7 +302,9 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
|
|
|
268
302
|
}}
|
|
269
303
|
>
|
|
270
304
|
{readOnly ||
|
|
271
|
-
(
|
|
305
|
+
(values.tags[index]?.externalDocs &&
|
|
306
|
+
(values.tags[index]?.externalDocs?.url ||
|
|
307
|
+
values.tags[index].externalDocs?.description))
|
|
272
308
|
? 'View '
|
|
273
309
|
: 'Add '}{' '}
|
|
274
310
|
External Docs Link
|
|
@@ -300,7 +336,7 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
|
|
|
300
336
|
label="API Name"
|
|
301
337
|
required
|
|
302
338
|
value={values?.info?.title}
|
|
303
|
-
maxLength={
|
|
339
|
+
maxLength={35}
|
|
304
340
|
onChange={(value) => {
|
|
305
341
|
setFieldValue('info.title', value)
|
|
306
342
|
}}
|
|
@@ -335,7 +371,7 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
|
|
|
335
371
|
onClear={() => {
|
|
336
372
|
setFieldValue('info.description', '')
|
|
337
373
|
}}
|
|
338
|
-
|
|
374
|
+
errorMsg={errors?.info?.description}
|
|
339
375
|
/>
|
|
340
376
|
<div className={styles.paramsTable}>
|
|
341
377
|
<TagsTable
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import yaml from 'js-yaml'
|
|
3
3
|
import styles from './style.module.scss'
|
|
4
|
+
import regex from '../../constants/regex'
|
|
4
5
|
|
|
5
6
|
const errorMapping = {
|
|
6
7
|
BOTH: 'Invalid JSON or YAML format',
|
|
@@ -93,15 +94,19 @@ const JsonInput = ({
|
|
|
93
94
|
value={value}
|
|
94
95
|
onChange={(e) => {
|
|
95
96
|
if (fieldIsDisabled) return
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
if (regex.ASCII.test(e.target.value)) {
|
|
98
|
+
setIsValid(undefined)
|
|
99
|
+
setDisabledBeautify(true)
|
|
100
|
+
onChange(e.target.value)
|
|
101
|
+
}
|
|
99
102
|
}}
|
|
100
103
|
onPaste={(e) => {
|
|
101
104
|
if (fieldIsDisabled) return
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
if (regex.ASCII.test(e.target.value)) {
|
|
106
|
+
setIsValid(undefined)
|
|
107
|
+
setDisabledBeautify(true)
|
|
108
|
+
onChange(e.target.value)
|
|
109
|
+
}
|
|
105
110
|
}}
|
|
106
111
|
min="1"
|
|
107
112
|
placeholder={placeholder}
|
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
.livePreviewContainer {
|
|
2
|
+
.titleContainer {
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
align-items: center;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
gap: 1.25rem;
|
|
9
|
+
|
|
10
|
+
p.apiName {
|
|
11
|
+
font-size: 40px;
|
|
12
|
+
line-height: 30px;
|
|
13
|
+
font-weight: 500;
|
|
14
|
+
word-wrap: break-word;
|
|
15
|
+
overflow-wrap: break-word;
|
|
16
|
+
word-break: break-all;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.livePreviewChip {
|
|
20
|
+
background-color: #ebecf2;
|
|
21
|
+
color: #12131a;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -6,7 +6,7 @@ import { TransformedOpenApi } from '../../types/transformedOpenApi'
|
|
|
6
6
|
import { useFormikContext } from 'formik'
|
|
7
7
|
import { methodColorMapping, tagsTableHeaders } from '../../constants/index'
|
|
8
8
|
import TagsTable from '../table/tags-table'
|
|
9
|
-
import { Button } from 'digitinary-ui'
|
|
9
|
+
import { Button, Chip } from 'digitinary-ui'
|
|
10
10
|
import Tooltip from '../../components/Tooltip/Tooltip'
|
|
11
11
|
|
|
12
12
|
interface LivePreviewProps {
|
|
@@ -105,10 +105,13 @@ const LivePreview: React.FC<LivePreviewProps> = ({ transformedData }) => {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
return (
|
|
108
|
-
<div>
|
|
108
|
+
<div className={styles.livePreviewContainer}>
|
|
109
109
|
<div className="row">
|
|
110
110
|
<div className="col-md-12">
|
|
111
|
-
<
|
|
111
|
+
<div className={styles.titleContainer}>
|
|
112
|
+
<p className={styles.apiName}>{info?.title?.trim() || '-'}</p>
|
|
113
|
+
<Chip className={styles.livePreviewChip}>Live Preview</Chip>
|
|
114
|
+
</div>
|
|
112
115
|
<SimpleLabelValue
|
|
113
116
|
key={'APIAuthenticationType'}
|
|
114
117
|
label={'API authentication type: '}
|
|
@@ -122,7 +125,7 @@ const LivePreview: React.FC<LivePreviewProps> = ({ transformedData }) => {
|
|
|
122
125
|
<SimpleLabelValue
|
|
123
126
|
key={'description'}
|
|
124
127
|
label={'Description: '}
|
|
125
|
-
value={info?.description || '-'}
|
|
128
|
+
value={info?.description?.trim() || '-'}
|
|
126
129
|
/>
|
|
127
130
|
|
|
128
131
|
<SimpleLabelValue key={'tags'} label={'Tags: '} />
|
|
@@ -12,6 +12,7 @@ import CommonDialog from '../../components/dialog'
|
|
|
12
12
|
import JsonInput from '../../components/JsonInput/JsonInput'
|
|
13
13
|
import styles from './MethodAccordion.module.scss'
|
|
14
14
|
import { Tags } from '@entities/openApi'
|
|
15
|
+
import regex from '../../constants/regex'
|
|
15
16
|
|
|
16
17
|
const httpStatusCodeOptions = httpStatusCodes.map((code) => ({
|
|
17
18
|
label: (
|
|
@@ -32,12 +33,16 @@ const MethodsAccordion = ({
|
|
|
32
33
|
setFieldValue,
|
|
33
34
|
readOnly,
|
|
34
35
|
tags,
|
|
36
|
+
isOpen,
|
|
37
|
+
setIsOpen,
|
|
35
38
|
}: {
|
|
36
39
|
method: TransformedMethod
|
|
37
40
|
path: string
|
|
38
41
|
setFieldValue?: (key: string, value: string | string[]) => void
|
|
39
42
|
readOnly?: boolean
|
|
40
43
|
tags: Tags[]
|
|
44
|
+
isOpen: boolean
|
|
45
|
+
setIsOpen: (open: boolean) => void
|
|
41
46
|
}) => {
|
|
42
47
|
const [isExpanded, setIsExpanded] = useState({
|
|
43
48
|
request: false,
|
|
@@ -115,70 +120,80 @@ const MethodsAccordion = ({
|
|
|
115
120
|
<p style={{ alignSelf: 'center' }}>
|
|
116
121
|
{method.parameters[index].description
|
|
117
122
|
? method.parameters[index].description.substring(0, 12)
|
|
118
|
-
: '-'}
|
|
123
|
+
: readOnly && '-'}
|
|
119
124
|
{method.parameters[index].description &&
|
|
120
125
|
method.parameters[index].description.length > 12
|
|
121
126
|
? '...'
|
|
122
127
|
: ''}
|
|
123
128
|
</p>
|
|
124
129
|
</Tooltip>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
variant="outlined"
|
|
152
|
-
size="small"
|
|
153
|
-
onClick={() => {
|
|
154
|
-
setFieldValue(`parameters[${index}].description`, item.description)
|
|
155
|
-
tooltipRefs[index]?.hide()
|
|
130
|
+
{!readOnly && (
|
|
131
|
+
<Tooltip
|
|
132
|
+
key={`${index}-add-edit-description`}
|
|
133
|
+
allowHTML
|
|
134
|
+
arrowWithBorder
|
|
135
|
+
placement="bottom-end"
|
|
136
|
+
type="function"
|
|
137
|
+
trigger="click"
|
|
138
|
+
delay={[0, 0]}
|
|
139
|
+
onCreate={(instance) =>
|
|
140
|
+
setTooltipRefs((prev) => ({
|
|
141
|
+
...prev,
|
|
142
|
+
[index]: instance,
|
|
143
|
+
}))
|
|
144
|
+
}
|
|
145
|
+
content={
|
|
146
|
+
<div className={styles.editDescTooltipContent}>
|
|
147
|
+
<p className={styles.editDescTooltipContent_header}>Description</p>
|
|
148
|
+
<TextArea
|
|
149
|
+
placeholder="Describe parameter..."
|
|
150
|
+
value={item.description}
|
|
151
|
+
disabled={readOnly}
|
|
152
|
+
maxLength={120}
|
|
153
|
+
onChange={(value) => {
|
|
154
|
+
if (value === '' || regex.ASCII.test(value))
|
|
155
|
+
onTableChange('description', value, index)
|
|
156
156
|
}}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
157
|
+
/>
|
|
158
|
+
{!readOnly && (
|
|
159
|
+
<Button
|
|
160
|
+
className={styles.editDescTooltipContent_btn}
|
|
161
|
+
variant="outlined"
|
|
162
|
+
size="small"
|
|
163
|
+
onClick={() => {
|
|
164
|
+
setFieldValue(
|
|
165
|
+
`parameters[${index}].description`,
|
|
166
|
+
item.description?.trim()
|
|
167
|
+
)
|
|
168
|
+
tooltipRefs[index]?.hide()
|
|
169
|
+
}}
|
|
170
|
+
disabled={!item.description?.trim()}
|
|
171
|
+
>
|
|
172
|
+
Apply
|
|
173
|
+
</Button>
|
|
174
|
+
)}
|
|
175
|
+
</div>
|
|
176
|
+
}
|
|
177
|
+
>
|
|
178
|
+
{readOnly || method.parameters[index].description?.length > 0 ? (
|
|
179
|
+
<Button
|
|
180
|
+
className={styles.editDescBtn}
|
|
181
|
+
variant="link"
|
|
182
|
+
color="action"
|
|
183
|
+
endIcon={<SVGLoader src={EditIcon} width="1.5rem" height="1.5rem" />}
|
|
184
|
+
></Button>
|
|
185
|
+
) : (
|
|
186
|
+
<Button
|
|
187
|
+
className={styles.editDescBtn}
|
|
188
|
+
variant="link"
|
|
189
|
+
color="action"
|
|
190
|
+
endIcon={<SVGLoader src={EditIcon} width="1.5rem" height="1.5rem" />}
|
|
191
|
+
>
|
|
192
|
+
{readOnly ? 'View ' : 'Add '} Description
|
|
193
|
+
</Button>
|
|
194
|
+
)}
|
|
195
|
+
</Tooltip>
|
|
196
|
+
)}
|
|
182
197
|
|
|
183
198
|
{!readOnly && <div className={styles.paramDescContainer_separator}></div>}
|
|
184
199
|
|
|
@@ -233,7 +248,7 @@ const MethodsAccordion = ({
|
|
|
233
248
|
|
|
234
249
|
useEffect(() => {
|
|
235
250
|
// prepare tags selection list
|
|
236
|
-
if (method?.tags.length || tags
|
|
251
|
+
if (method?.tags.length || tags?.length) {
|
|
237
252
|
const convertedStringArray = (method?.tags || [])?.map((item) => ({
|
|
238
253
|
label: capitalize(item),
|
|
239
254
|
value: item,
|
|
@@ -254,8 +269,8 @@ const MethodsAccordion = ({
|
|
|
254
269
|
return (
|
|
255
270
|
<div>
|
|
256
271
|
<Accordion
|
|
257
|
-
expanded={
|
|
258
|
-
onChange={() =>
|
|
272
|
+
expanded={isOpen}
|
|
273
|
+
onChange={() => setIsOpen(!isOpen)}
|
|
259
274
|
className={`${styles.methodAccordion} ${readOnly ? styles.readOnly : ''}`}
|
|
260
275
|
summary={
|
|
261
276
|
<div className={styles.methodSummaryContainer}>
|
|
@@ -271,9 +286,7 @@ const MethodsAccordion = ({
|
|
|
271
286
|
<span className={styles.methodPath}>{path}</span>
|
|
272
287
|
</div>
|
|
273
288
|
<div
|
|
274
|
-
className={`${styles.methodExpandArrowContainer} ${
|
|
275
|
-
isExpanded.method ? styles.expanded : ''
|
|
276
|
-
}`}
|
|
289
|
+
className={`${styles.methodExpandArrowContainer} ${isOpen ? styles.expanded : ''}`}
|
|
277
290
|
>
|
|
278
291
|
<SVGLoader src={DownArrowIcon} width="2rem" height="2rem" />
|
|
279
292
|
</div>
|
|
@@ -310,8 +323,11 @@ const MethodsAccordion = ({
|
|
|
310
323
|
className={styles.methodDesc}
|
|
311
324
|
label="Description"
|
|
312
325
|
placeholder="Describe the method's purpose and functionality..."
|
|
326
|
+
maxLength={120}
|
|
313
327
|
value={method?.description}
|
|
314
|
-
onChange={(value) =>
|
|
328
|
+
onChange={(value) => {
|
|
329
|
+
if (value === '' || regex.ASCII.test(value)) setFieldValue('description', value)
|
|
330
|
+
}}
|
|
315
331
|
/>
|
|
316
332
|
) : (
|
|
317
333
|
<SimpleLabelValue
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
.tooltip-custom-wrapper {
|
|
2
2
|
display: flex;
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
[data-tippy-root] {
|
|
5
|
+
z-index: 2 !important;
|
|
6
|
+
}
|
|
5
7
|
.tippy-box {
|
|
6
8
|
background-color: #202f5b;
|
|
7
9
|
font-size: 0.875rem;
|
|
@@ -12,16 +14,17 @@
|
|
|
12
14
|
word-break: break-word;
|
|
13
15
|
position: relative;
|
|
14
16
|
border: 1px solid #d8dae5;
|
|
17
|
+
z-index: 2;
|
|
15
18
|
|
|
16
19
|
&.function {
|
|
17
20
|
.tippy-content {
|
|
18
21
|
background-color: #fff !important;
|
|
19
22
|
color: #000 !important;
|
|
20
23
|
}
|
|
21
|
-
}
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
&[data-placement] > .tippy-arrow:before {
|
|
26
|
+
color: #fff !important;
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
&.info {
|
|
@@ -109,7 +112,7 @@
|
|
|
109
112
|
.tippy-arrow {
|
|
110
113
|
top: 1px;
|
|
111
114
|
background-color: white;
|
|
112
|
-
z-index:
|
|
115
|
+
z-index: 2;
|
|
113
116
|
height: 1px;
|
|
114
117
|
|
|
115
118
|
&:before {
|
|
@@ -120,7 +123,7 @@
|
|
|
120
123
|
border: none;
|
|
121
124
|
border-left: 1px solid #d8dae5 !important;
|
|
122
125
|
border-top: 1px solid #d8dae5 !important;
|
|
123
|
-
z-index:
|
|
126
|
+
z-index: 2;
|
|
124
127
|
top: -0.45rem;
|
|
125
128
|
transform-origin: center !important;
|
|
126
129
|
}
|