@digi-frontend/dgate-api-documentation 1.0.14 → 1.0.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digi-frontend/dgate-api-documentation",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "main": "dist/src/index.js",
5
5
  "module": "dist/src/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -44,11 +44,15 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
44
44
  setTableRecords(generateTableData(values.tags))
45
45
  setTableData(values.tags)
46
46
  }
47
- }, [])
47
+ }, [values.tags])
48
48
 
49
49
  const confirmDeleteTag = () => {
50
50
  if (selectedTagIndex !== null) {
51
51
  setTableData((prev) => prev.filter((_, i) => i !== selectedTagIndex))
52
+ setFieldValue(
53
+ `tags`,
54
+ values.tags?.filter((_, i) => i !== selectedTagIndex)
55
+ )
52
56
  }
53
57
  setOpenDeleteDialog(false)
54
58
  setSelectedTagIndex(null)
@@ -73,7 +77,8 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
73
77
 
74
78
  const saveNewRow = (tag) => {
75
79
  setTableData([...tableData, tag])
76
- setFieldValue(`tags`, [...values.tags, tag])
80
+ const oldTags = values.tags || [];
81
+ setFieldValue(`tags`, [...oldTags, tag])
77
82
  }
78
83
 
79
84
  const handleDeleteClick = (id: number, name: string) => {
@@ -231,7 +236,8 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
231
236
  color="action"
232
237
  endIcon={<SVGLoader src={EditIcon} width="1.5rem" height="1.5rem" />}
233
238
  onClick={() => {
234
- console.log('Move to url')
239
+ setDescription(item.externalDocs?.description)
240
+ setURL(item.externalDocs?.url)
235
241
  }}
236
242
  >
237
243
  {readOnly ||
@@ -29,7 +29,7 @@ const LivePreview: React.FC<LivePreviewProps> = ({ transformedData }) => {
29
29
  : null
30
30
 
31
31
  useEffect(() => {
32
- if (values.tags && values.tags.length) {
32
+ if (values.tags) {
33
33
  setTableRecords(generateTableData(values.tags, true))
34
34
  setTableData(values.tags)
35
35
  }
@@ -69,8 +69,8 @@ const LivePreview: React.FC<LivePreviewProps> = ({ transformedData }) => {
69
69
  </a>
70
70
  ) : (
71
71
  <Button className={styles.editDescBtn} variant="link" color="action">
72
- {item.description ? item.description.substring(0, 12) : '-'}
73
- {item.description && item.description.length > 12 ? '...' : ''}
72
+ {item.externalDocs?.description ? item.externalDocs?.description.substring(0, 12) : '-'}
73
+ {item.externalDocs?.description && item.externalDocs?.description.length > 12 ? '...' : ''}
74
74
  </Button>
75
75
  )}
76
76
 
@@ -30,12 +30,12 @@ const TagsTable = ({ id, headCells, data, isFormOpen, setIsFormOpen, saveNewRow,
30
30
  externalDocs: yup.object().optional(),
31
31
  }),
32
32
  onSubmit: (values) => {
33
+ saveNewRow(values)
33
34
  setText('')
34
35
  setExternalDesc('')
35
36
  setExternalUrl('')
36
37
  resetForm()
37
38
  setIsFormOpen(false)
38
- saveNewRow(values)
39
39
  },
40
40
  })
41
41
  return (