@stonecrop/desktop 0.10.10 → 0.10.12
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 +2498 -2358
- package/dist/desktop.js.map +1 -1
- package/package.json +5 -5
- package/src/components/Desktop.vue +28 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/desktop",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.12",
|
|
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/aform": "0.10.
|
|
36
|
-
"@stonecrop/atable": "0.10.
|
|
37
|
-
"@stonecrop/
|
|
38
|
-
"@stonecrop/
|
|
35
|
+
"@stonecrop/aform": "0.10.12",
|
|
36
|
+
"@stonecrop/atable": "0.10.12",
|
|
37
|
+
"@stonecrop/stonecrop": "0.10.12",
|
|
38
|
+
"@stonecrop/themes": "0.10.12"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"vue": "^3.5.28"
|
|
@@ -575,8 +575,9 @@ const getRecordFormSchema = (): SchemaTypes[] => {
|
|
|
575
575
|
return []
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
//
|
|
579
|
-
|
|
578
|
+
// Convert schema to array and resolve Doctype fields (both cardinality: 'one' and 'many')
|
|
579
|
+
const schemaArray = 'toArray' in doctype.schema ? doctype.schema.toArray() : doctype.schema
|
|
580
|
+
return registry.resolveSchema(schemaArray)
|
|
580
581
|
} catch {
|
|
581
582
|
return []
|
|
582
583
|
}
|
|
@@ -662,6 +663,25 @@ const handleDelete = async (recordId?: string) => {
|
|
|
662
663
|
}
|
|
663
664
|
|
|
664
665
|
// Event handlers
|
|
666
|
+
const getRecordIdFromRow = (rowElement: HTMLTableRowElement): string | null => {
|
|
667
|
+
const cell = rowElement.querySelector('td[data-rowindex]')
|
|
668
|
+
if (!cell) return null
|
|
669
|
+
|
|
670
|
+
const rowIndexAttr = cell.getAttribute('data-rowindex')
|
|
671
|
+
if (rowIndexAttr === null) return null
|
|
672
|
+
|
|
673
|
+
const rowIndex = parseInt(rowIndexAttr, 10)
|
|
674
|
+
if (isNaN(rowIndex)) return null
|
|
675
|
+
|
|
676
|
+
const records = getRecords()
|
|
677
|
+
const record = records[rowIndex]
|
|
678
|
+
if (!record) return null
|
|
679
|
+
|
|
680
|
+
const idField = props.recordIdField || 'id'
|
|
681
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
682
|
+
return record[idField] || record.id || null
|
|
683
|
+
}
|
|
684
|
+
|
|
665
685
|
const handleClick = async (event: Event) => {
|
|
666
686
|
const target = event.target as HTMLElement
|
|
667
687
|
const action = target.getAttribute('data-action')
|
|
@@ -670,7 +690,6 @@ const handleClick = async (event: Event) => {
|
|
|
670
690
|
await createNewRecord()
|
|
671
691
|
}
|
|
672
692
|
|
|
673
|
-
// Handle table cell clicks for actions
|
|
674
693
|
const cell = target.closest('td, th')
|
|
675
694
|
if (cell) {
|
|
676
695
|
const cellText = cell.textContent?.trim()
|
|
@@ -687,24 +706,14 @@ const handleClick = async (event: Event) => {
|
|
|
687
706
|
}
|
|
688
707
|
}
|
|
689
708
|
} 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
|
-
}
|
|
709
|
+
const recordId = getRecordIdFromRow(row)
|
|
710
|
+
if (recordId) {
|
|
711
|
+
await openRecord(recordId)
|
|
698
712
|
}
|
|
699
713
|
} 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
|
-
}
|
|
714
|
+
const recordId = getRecordIdFromRow(row)
|
|
715
|
+
if (recordId) {
|
|
716
|
+
await handleDelete(recordId)
|
|
708
717
|
}
|
|
709
718
|
}
|
|
710
719
|
}
|