@stonecrop/desktop 0.10.10 → 0.10.11
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/desktop.js +1491 -1486
- package/dist/desktop.js.map +1 -1
- package/package.json +5 -5
- package/src/components/Desktop.vue +25 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/desktop",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"**/*.css"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@stonecrop/
|
|
36
|
-
"@stonecrop/
|
|
37
|
-
"@stonecrop/
|
|
38
|
-
"@stonecrop/stonecrop": "0.10.
|
|
35
|
+
"@stonecrop/atable": "0.10.11",
|
|
36
|
+
"@stonecrop/themes": "0.10.11",
|
|
37
|
+
"@stonecrop/aform": "0.10.11",
|
|
38
|
+
"@stonecrop/stonecrop": "0.10.11"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"vue": "^3.5.28"
|
|
@@ -662,6 +662,25 @@ const handleDelete = async (recordId?: string) => {
|
|
|
662
662
|
}
|
|
663
663
|
|
|
664
664
|
// Event handlers
|
|
665
|
+
const getRecordIdFromRow = (rowElement: HTMLTableRowElement): string | null => {
|
|
666
|
+
const cell = rowElement.querySelector('td[data-rowindex]')
|
|
667
|
+
if (!cell) return null
|
|
668
|
+
|
|
669
|
+
const rowIndexAttr = cell.getAttribute('data-rowindex')
|
|
670
|
+
if (rowIndexAttr === null) return null
|
|
671
|
+
|
|
672
|
+
const rowIndex = parseInt(rowIndexAttr, 10)
|
|
673
|
+
if (isNaN(rowIndex)) return null
|
|
674
|
+
|
|
675
|
+
const records = getRecords()
|
|
676
|
+
const record = records[rowIndex]
|
|
677
|
+
if (!record) return null
|
|
678
|
+
|
|
679
|
+
const idField = props.recordIdField || 'id'
|
|
680
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
681
|
+
return record[idField] || record.id || null
|
|
682
|
+
}
|
|
683
|
+
|
|
665
684
|
const handleClick = async (event: Event) => {
|
|
666
685
|
const target = event.target as HTMLElement
|
|
667
686
|
const action = target.getAttribute('data-action')
|
|
@@ -670,7 +689,6 @@ const handleClick = async (event: Event) => {
|
|
|
670
689
|
await createNewRecord()
|
|
671
690
|
}
|
|
672
691
|
|
|
673
|
-
// Handle table cell clicks for actions
|
|
674
692
|
const cell = target.closest('td, th')
|
|
675
693
|
if (cell) {
|
|
676
694
|
const cellText = cell.textContent?.trim()
|
|
@@ -687,24 +705,14 @@ const handleClick = async (event: Event) => {
|
|
|
687
705
|
}
|
|
688
706
|
}
|
|
689
707
|
} else if (cellText?.includes('Edit') && row) {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const idCell = cells[0] // Assuming ID is in first column
|
|
694
|
-
const recordId = idCell.textContent?.trim()
|
|
695
|
-
if (recordId) {
|
|
696
|
-
await openRecord(recordId)
|
|
697
|
-
}
|
|
708
|
+
const recordId = getRecordIdFromRow(row)
|
|
709
|
+
if (recordId) {
|
|
710
|
+
await openRecord(recordId)
|
|
698
711
|
}
|
|
699
712
|
} else if (cellText?.includes('Delete') && row) {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
const idCell = cells[0] // Assuming ID is in first column
|
|
704
|
-
const recordId = idCell.textContent?.trim()
|
|
705
|
-
if (recordId) {
|
|
706
|
-
await handleDelete(recordId)
|
|
707
|
-
}
|
|
713
|
+
const recordId = getRecordIdFromRow(row)
|
|
714
|
+
if (recordId) {
|
|
715
|
+
await handleDelete(recordId)
|
|
708
716
|
}
|
|
709
717
|
}
|
|
710
718
|
}
|