@stonecrop/atable 0.8.1 → 0.8.2
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/assets/index.css +1 -1
- package/dist/atable.d.ts +1233 -1
- package/dist/atable.js +1602 -1269
- package/dist/atable.js.map +1 -1
- package/dist/atable.umd.cjs +46 -2
- package/dist/atable.umd.cjs.map +1 -1
- package/dist/icons/index.js +31 -0
- package/dist/icons/stonecrop-ui-icon-add.svg +5 -0
- package/dist/icons/stonecrop-ui-icon-insert-above.svg +11 -11
- package/dist/icons/stonecrop-ui-icon-insert-below.svg +11 -11
- package/dist/index.js +5 -1
- package/dist/src/icons/index.d.ts +19 -0
- package/dist/src/icons/index.d.ts.map +1 -0
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/stores/table.d.ts +1075 -1
- package/dist/src/stores/table.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +122 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/stores/table.js +178 -0
- package/package.json +3 -3
- package/src/components/ARow.vue +53 -1
- package/src/components/ARowActions.vue +376 -0
- package/src/components/ATable.vue +83 -2
- package/src/components/ATableHeader.vue +49 -19
- package/src/icons/index.ts +34 -0
- package/src/icons/stonecrop-ui-icon-add.svg +5 -0
- package/src/icons/stonecrop-ui-icon-insert-above.svg +11 -11
- package/src/icons/stonecrop-ui-icon-insert-below.svg +11 -11
- package/src/index.ts +6 -0
- package/src/stores/table.ts +203 -0
- package/src/types/index.ts +138 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg id="Layer_1"
|
|
3
|
-
<
|
|
4
|
-
<
|
|
2
|
+
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 70.6 61.5">
|
|
3
|
+
<path d="M68.6,45.8v13.7H2v-13.7h66.6M70.6,43.8H0v17.7h70.6v-17.7h0Z"/>
|
|
4
|
+
<path d="M68.6,24.2v13.7H2v-13.7h66.6M70.6,22.2H0v17.7h70.6v-17.7h0Z"/>
|
|
5
5
|
<g>
|
|
6
|
-
<polygon points="70.6 2.5 68.
|
|
7
|
-
<path d="M65.
|
|
8
|
-
<polygon points="
|
|
9
|
-
<path d="
|
|
10
|
-
<polygon points="2.
|
|
11
|
-
<path d="M65.
|
|
12
|
-
<polygon points="70.6 18.
|
|
13
|
-
<path d="M70.6,13.
|
|
6
|
+
<polygon points="70.6 2.5 68.6 2.5 68.6 2 68.1 2 68.1 0 70.6 0 70.6 2.5"/>
|
|
7
|
+
<path d="M65.3,2h-2.9V0h2.9v2ZM59.6,2h-2.9V0h2.9v2ZM53.9,2h-2.9V0h2.9v2ZM48.2,2h-2.9V0h2.9v2ZM42.4,2h-2.9V0h2.9v2ZM36.7,2h-2.9V0h2.9v2ZM31,2h-2.9V0h2.9v2ZM25.3,2h-2.9V0h2.9v2ZM19.6,2h-2.9V0h2.9v2ZM13.9,2h-2.9V0h2.9v2ZM8.2,2h-2.9V0h2.9v2Z"/>
|
|
8
|
+
<polygon points="2 2.5 0 2.5 0 0 2.5 0 2.5 2 2 2 2 2.5"/>
|
|
9
|
+
<path d="M2,13.4H0v-2.7h2v2.7ZM2,8H0v-2.7h2v2.7Z"/>
|
|
10
|
+
<polygon points="2.5 18.7 0 18.7 0 16.2 2 16.2 2 16.7 2.5 16.7 2.5 18.7"/>
|
|
11
|
+
<path d="M65.3,18.7h-2.9v-2h2.9v2ZM59.6,18.7h-2.9v-2h2.9v2ZM53.9,18.7h-2.9v-2h2.9v2ZM48.2,18.7h-2.9v-2h2.9v2ZM42.4,18.7h-2.9v-2h2.9v2ZM36.7,18.7h-2.9v-2h2.9v2ZM31,18.7h-2.9v-2h2.9v2ZM25.3,18.7h-2.9v-2h2.9v2ZM19.6,18.7h-2.9v-2h2.9v2ZM13.9,18.7h-2.9v-2h2.9v2ZM8.2,18.7h-2.9v-2h2.9v2Z"/>
|
|
12
|
+
<polygon points="70.6 18.7 68.1 18.7 68.1 16.7 68.6 16.7 68.6 16.2 70.6 16.2 70.6 18.7"/>
|
|
13
|
+
<path d="M70.6,13.4h-2v-2.7h2v2.7ZM70.6,8h-2v-2.7h2v2.7Z"/>
|
|
14
14
|
</g>
|
|
15
15
|
</svg>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg id="Layer_1"
|
|
2
|
+
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 70.6 61.5">
|
|
3
3
|
<g>
|
|
4
|
-
<polygon points="70.6 45.
|
|
5
|
-
<path d="M65.
|
|
6
|
-
<polygon points="
|
|
7
|
-
<path d="
|
|
8
|
-
<polygon points="2.
|
|
9
|
-
<path d="M65.
|
|
10
|
-
<polygon points="70.6 61.
|
|
11
|
-
<path d="M70.6,56.
|
|
4
|
+
<polygon points="70.6 45.3 68.6 45.3 68.6 44.8 68.1 44.8 68.1 42.8 70.6 42.8 70.6 45.3"/>
|
|
5
|
+
<path d="M65.3,44.8h-2.9v-2h2.9v2ZM59.6,44.8h-2.9v-2h2.9v2ZM53.9,44.8h-2.9v-2h2.9v2ZM48.2,44.8h-2.9v-2h2.9v2ZM42.4,44.8h-2.9v-2h2.9v2ZM36.7,44.8h-2.9v-2h2.9v2ZM31,44.8h-2.9v-2h2.9v2ZM25.3,44.8h-2.9v-2h2.9v2ZM19.6,44.8h-2.9v-2h2.9v2ZM13.9,44.8h-2.9v-2h2.9v2ZM8.2,44.8h-2.9v-2h2.9v2Z"/>
|
|
6
|
+
<polygon points="2 45.3 0 45.3 0 42.8 2.5 42.8 2.5 44.8 2 44.8 2 45.3"/>
|
|
7
|
+
<path d="M2,56.3H0v-2.7h2v2.7ZM2,50.8H0v-2.7h2v2.7Z"/>
|
|
8
|
+
<polygon points="2.5 61.5 0 61.5 0 59 2 59 2 59.5 2.5 59.5 2.5 61.5"/>
|
|
9
|
+
<path d="M65.3,61.5h-2.9v-2h2.9v2ZM59.6,61.5h-2.9v-2h2.9v2ZM53.9,61.5h-2.9v-2h2.9v2ZM48.2,61.5h-2.9v-2h2.9v2ZM42.4,61.5h-2.9v-2h2.9v2ZM36.7,61.5h-2.9v-2h2.9v2ZM31,61.5h-2.9v-2h2.9v2ZM25.3,61.5h-2.9v-2h2.9v2ZM19.6,61.5h-2.9v-2h2.9v2ZM13.9,61.5h-2.9v-2h2.9v2ZM8.2,61.5h-2.9v-2h2.9v2Z"/>
|
|
10
|
+
<polygon points="70.6 61.5 68.1 61.5 68.1 59.5 68.6 59.5 68.6 59 70.6 59 70.6 61.5"/>
|
|
11
|
+
<path d="M70.6,56.3h-2v-2.7h2v2.7ZM70.6,50.8h-2v-2.7h2v2.7Z"/>
|
|
12
12
|
</g>
|
|
13
|
-
<
|
|
14
|
-
<
|
|
13
|
+
<path d="M68.6,23.7v13.7H2v-13.7h66.6M70.6,21.7H0v17.7h70.6v-17.7h0Z"/>
|
|
14
|
+
<path d="M68.6,2v13.7H2V2h66.6M70.6,0H0v17.7h70.6V0h0Z"/>
|
|
15
15
|
</svg>
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import ACell from './components/ACell.vue'
|
|
|
4
4
|
import AExpansionRow from './components/AExpansionRow.vue'
|
|
5
5
|
import AGanttCell from './components/AGanttCell.vue'
|
|
6
6
|
import ARow from './components/ARow.vue'
|
|
7
|
+
import ARowActions from './components/ARowActions.vue'
|
|
7
8
|
import ATable from './components/ATable.vue'
|
|
8
9
|
import ATableHeader from './components/ATableHeader.vue'
|
|
9
10
|
import ATableLoading from './components/ATableLoading.vue'
|
|
@@ -13,6 +14,9 @@ export { createTableStore } from './stores/table'
|
|
|
13
14
|
export type { FilterState, FilterStateRecord } from './stores/table'
|
|
14
15
|
export type * from './types'
|
|
15
16
|
|
|
17
|
+
// Icon exports
|
|
18
|
+
export { AddIcon, DeleteIcon, DuplicateIcon, InsertAboveIcon, InsertBelowIcon, MoveIcon, actionIcons } from './icons'
|
|
19
|
+
|
|
16
20
|
/**
|
|
17
21
|
* Install all ATable components
|
|
18
22
|
* @param app - Vue app instance
|
|
@@ -23,6 +27,7 @@ function install(app: App /* options */) {
|
|
|
23
27
|
app.component('AExpansionRow', AExpansionRow)
|
|
24
28
|
app.component('AGanttCell', AGanttCell)
|
|
25
29
|
app.component('ARow', ARow)
|
|
30
|
+
app.component('ARowActions', ARowActions)
|
|
26
31
|
app.component('ATable', ATable)
|
|
27
32
|
app.component('ATableHeader', ATableHeader)
|
|
28
33
|
app.component('ATableLoading', ATableLoading)
|
|
@@ -35,6 +40,7 @@ export {
|
|
|
35
40
|
AExpansionRow,
|
|
36
41
|
AGanttCell,
|
|
37
42
|
ARow,
|
|
43
|
+
ARowActions,
|
|
38
44
|
ATable,
|
|
39
45
|
ATableHeader,
|
|
40
46
|
ATableLoading,
|
package/src/stores/table.ts
CHANGED
|
@@ -677,6 +677,203 @@ export const createTableStore = (initData: {
|
|
|
677
677
|
delete filterState.value[colIndex]
|
|
678
678
|
}
|
|
679
679
|
|
|
680
|
+
// Row action methods
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Add a new row to the table.
|
|
684
|
+
* @param rowData - Optional partial row data to initialize the new row with
|
|
685
|
+
* @param position - Where to insert the row: 'start', 'end', or a specific index
|
|
686
|
+
* @returns The index of the newly added row
|
|
687
|
+
*/
|
|
688
|
+
const addRow = (rowData?: Partial<TableRow>, position: 'start' | 'end' | number = 'end'): number => {
|
|
689
|
+
// Create a new row with default empty values for each column
|
|
690
|
+
const newRow: TableRow = {}
|
|
691
|
+
for (const column of columns.value) {
|
|
692
|
+
newRow[column.name] = ''
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// Merge in any provided row data
|
|
696
|
+
if (rowData) {
|
|
697
|
+
Object.assign(newRow, rowData)
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
let insertIndex: number
|
|
701
|
+
if (position === 'start') {
|
|
702
|
+
insertIndex = 0
|
|
703
|
+
rows.value.unshift(newRow)
|
|
704
|
+
} else if (position === 'end') {
|
|
705
|
+
insertIndex = rows.value.length
|
|
706
|
+
rows.value.push(newRow)
|
|
707
|
+
} else {
|
|
708
|
+
insertIndex = Math.max(0, Math.min(position, rows.value.length))
|
|
709
|
+
rows.value.splice(insertIndex, 0, newRow)
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
return insertIndex
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Delete a row from the table.
|
|
717
|
+
* @param rowIndex - The index of the row to delete
|
|
718
|
+
* @returns The deleted row, or null if the index was invalid
|
|
719
|
+
*/
|
|
720
|
+
const deleteRow = (rowIndex: number): TableRow | null => {
|
|
721
|
+
if (rowIndex < 0 || rowIndex >= rows.value.length) {
|
|
722
|
+
return null
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
const [deletedRow] = rows.value.splice(rowIndex, 1)
|
|
726
|
+
|
|
727
|
+
// Clean up row modifications tracking for the deleted row
|
|
728
|
+
delete rowModifications.value[rowIndex]
|
|
729
|
+
delete rowExpandStates.value[rowIndex]
|
|
730
|
+
|
|
731
|
+
// Shift modification/expand state indices for rows after the deleted one
|
|
732
|
+
const newModifications: Record<number, boolean> = {}
|
|
733
|
+
const newExpandStates: Record<number, { childrenOpen?: boolean; expanded?: boolean }> = {}
|
|
734
|
+
|
|
735
|
+
for (const [key, value] of Object.entries(rowModifications.value)) {
|
|
736
|
+
const idx = parseInt(key)
|
|
737
|
+
if (idx > rowIndex) {
|
|
738
|
+
newModifications[idx - 1] = value
|
|
739
|
+
} else {
|
|
740
|
+
newModifications[idx] = value
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
for (const [key, value] of Object.entries(rowExpandStates.value)) {
|
|
745
|
+
const idx = parseInt(key)
|
|
746
|
+
if (idx > rowIndex) {
|
|
747
|
+
newExpandStates[idx - 1] = value
|
|
748
|
+
} else {
|
|
749
|
+
newExpandStates[idx] = value
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
rowModifications.value = newModifications
|
|
754
|
+
rowExpandStates.value = newExpandStates
|
|
755
|
+
|
|
756
|
+
return deletedRow
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Duplicate a row in the table.
|
|
761
|
+
* @param rowIndex - The index of the row to duplicate
|
|
762
|
+
* @returns The index of the new duplicated row, or -1 if the index was invalid
|
|
763
|
+
*/
|
|
764
|
+
const duplicateRow = (rowIndex: number): number => {
|
|
765
|
+
if (rowIndex < 0 || rowIndex >= rows.value.length) {
|
|
766
|
+
return -1
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
// Deep clone the row data
|
|
770
|
+
const originalRow = rows.value[rowIndex]
|
|
771
|
+
const duplicatedRow: TableRow = JSON.parse(JSON.stringify(originalRow))
|
|
772
|
+
|
|
773
|
+
// Insert the duplicated row after the original
|
|
774
|
+
const newIndex = rowIndex + 1
|
|
775
|
+
rows.value.splice(newIndex, 0, duplicatedRow)
|
|
776
|
+
|
|
777
|
+
return newIndex
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Insert a new row above the specified row.
|
|
782
|
+
* @param rowIndex - The index of the row to insert above
|
|
783
|
+
* @param rowData - Optional partial row data to initialize the new row with
|
|
784
|
+
* @returns The index of the newly inserted row
|
|
785
|
+
*/
|
|
786
|
+
const insertRowAbove = (rowIndex: number, rowData?: Partial<TableRow>): number => {
|
|
787
|
+
const insertIndex = Math.max(0, rowIndex)
|
|
788
|
+
return addRow(rowData, insertIndex)
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Insert a new row below the specified row.
|
|
793
|
+
* @param rowIndex - The index of the row to insert below
|
|
794
|
+
* @param rowData - Optional partial row data to initialize the new row with
|
|
795
|
+
* @returns The index of the newly inserted row
|
|
796
|
+
*/
|
|
797
|
+
const insertRowBelow = (rowIndex: number, rowData?: Partial<TableRow>): number => {
|
|
798
|
+
const insertIndex = Math.min(rowIndex + 1, rows.value.length)
|
|
799
|
+
return addRow(rowData, insertIndex)
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Move a row from one position to another.
|
|
804
|
+
* @param fromIndex - The current index of the row to move
|
|
805
|
+
* @param toIndex - The target index to move the row to
|
|
806
|
+
* @returns true if the move was successful, false otherwise
|
|
807
|
+
*/
|
|
808
|
+
const moveRow = (fromIndex: number, toIndex: number): boolean => {
|
|
809
|
+
// Validate indices
|
|
810
|
+
if (
|
|
811
|
+
fromIndex < 0 ||
|
|
812
|
+
fromIndex >= rows.value.length ||
|
|
813
|
+
toIndex < 0 ||
|
|
814
|
+
toIndex >= rows.value.length ||
|
|
815
|
+
fromIndex === toIndex
|
|
816
|
+
) {
|
|
817
|
+
return false
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
// Remove the row from its current position
|
|
821
|
+
const [movedRow] = rows.value.splice(fromIndex, 1)
|
|
822
|
+
|
|
823
|
+
// Insert at the new position
|
|
824
|
+
rows.value.splice(toIndex, 0, movedRow)
|
|
825
|
+
|
|
826
|
+
// Update row modification and expand state indices
|
|
827
|
+
const newModifications: Record<number, boolean> = {}
|
|
828
|
+
const newExpandStates: Record<number, { childrenOpen?: boolean; expanded?: boolean }> = {}
|
|
829
|
+
|
|
830
|
+
for (const [key, value] of Object.entries(rowModifications.value)) {
|
|
831
|
+
const idx = parseInt(key)
|
|
832
|
+
let newIdx = idx
|
|
833
|
+
|
|
834
|
+
if (idx === fromIndex) {
|
|
835
|
+
// The moved row
|
|
836
|
+
newIdx = toIndex
|
|
837
|
+
} else if (fromIndex < toIndex) {
|
|
838
|
+
// Moving down: rows between fromIndex and toIndex shift up
|
|
839
|
+
if (idx > fromIndex && idx <= toIndex) {
|
|
840
|
+
newIdx = idx - 1
|
|
841
|
+
}
|
|
842
|
+
} else {
|
|
843
|
+
// Moving up: rows between toIndex and fromIndex shift down
|
|
844
|
+
if (idx >= toIndex && idx < fromIndex) {
|
|
845
|
+
newIdx = idx + 1
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
newModifications[newIdx] = value
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
for (const [key, value] of Object.entries(rowExpandStates.value)) {
|
|
853
|
+
const idx = parseInt(key)
|
|
854
|
+
let newIdx = idx
|
|
855
|
+
|
|
856
|
+
if (idx === fromIndex) {
|
|
857
|
+
newIdx = toIndex
|
|
858
|
+
} else if (fromIndex < toIndex) {
|
|
859
|
+
if (idx > fromIndex && idx <= toIndex) {
|
|
860
|
+
newIdx = idx - 1
|
|
861
|
+
}
|
|
862
|
+
} else {
|
|
863
|
+
if (idx >= toIndex && idx < fromIndex) {
|
|
864
|
+
newIdx = idx + 1
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
newExpandStates[newIdx] = value
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
rowModifications.value = newModifications
|
|
872
|
+
rowExpandStates.value = newExpandStates
|
|
873
|
+
|
|
874
|
+
return true
|
|
875
|
+
}
|
|
876
|
+
|
|
680
877
|
return {
|
|
681
878
|
// state
|
|
682
879
|
columns,
|
|
@@ -702,10 +899,13 @@ export const createTableStore = (initData: {
|
|
|
702
899
|
zeroColumn,
|
|
703
900
|
|
|
704
901
|
// actions
|
|
902
|
+
addRow,
|
|
705
903
|
clearFilter,
|
|
706
904
|
closeModal,
|
|
707
905
|
createConnection,
|
|
708
906
|
deleteConnection,
|
|
907
|
+
deleteRow,
|
|
908
|
+
duplicateRow,
|
|
709
909
|
getCellData,
|
|
710
910
|
getCellDisplayValue,
|
|
711
911
|
getConnectionsForBar,
|
|
@@ -714,8 +914,11 @@ export const createTableStore = (initData: {
|
|
|
714
914
|
getHeaderCellStyle,
|
|
715
915
|
getIndent,
|
|
716
916
|
getRowExpandSymbol,
|
|
917
|
+
insertRowAbove,
|
|
918
|
+
insertRowBelow,
|
|
717
919
|
isRowGantt,
|
|
718
920
|
isRowVisible,
|
|
921
|
+
moveRow,
|
|
719
922
|
registerConnectionHandle,
|
|
720
923
|
registerGanttBar,
|
|
721
924
|
resizeColumn,
|
package/src/types/index.ts
CHANGED
|
@@ -209,6 +209,92 @@ export interface CellContext {
|
|
|
209
209
|
table: { [key: string]: any }
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Row action type identifiers.
|
|
214
|
+
* @public
|
|
215
|
+
*/
|
|
216
|
+
export type RowActionType = 'add' | 'delete' | 'duplicate' | 'insertAbove' | 'insertBelow' | 'move'
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Options for configuring individual row actions.
|
|
220
|
+
* @public
|
|
221
|
+
*/
|
|
222
|
+
export interface RowActionOptions {
|
|
223
|
+
/**
|
|
224
|
+
* Whether the action is enabled.
|
|
225
|
+
*
|
|
226
|
+
* @defaultValue true
|
|
227
|
+
*/
|
|
228
|
+
enabled?: boolean
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Custom label for the action (used in dropdown mode).
|
|
232
|
+
*/
|
|
233
|
+
label?: string
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Custom icon override (raw SVG string).
|
|
237
|
+
*/
|
|
238
|
+
icon?: string
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Custom handler for the action. Return false to prevent the default behavior.
|
|
242
|
+
*
|
|
243
|
+
* @param rowIndex - The index of the row the action is being performed on
|
|
244
|
+
* @param store - The table store instance
|
|
245
|
+
* @returns void or false to prevent default behavior
|
|
246
|
+
*/
|
|
247
|
+
handler?: (rowIndex: number, store: ReturnType<typeof createTableStore>) => void | boolean
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Configuration for row-level actions (add, delete, duplicate, etc.).
|
|
252
|
+
* @public
|
|
253
|
+
*/
|
|
254
|
+
export interface RowActionsConfig {
|
|
255
|
+
/**
|
|
256
|
+
* Whether row actions are enabled.
|
|
257
|
+
*
|
|
258
|
+
* @defaultValue false
|
|
259
|
+
*/
|
|
260
|
+
enabled: boolean
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Position of the row actions column relative to the index column.
|
|
264
|
+
*
|
|
265
|
+
* @defaultValue 'before-index'
|
|
266
|
+
*/
|
|
267
|
+
position?: 'before-index' | 'after-index' | 'end'
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Pixel width threshold at which to switch from icons to dropdown mode.
|
|
271
|
+
* Set to 0 to always use icons, or a large number to always use dropdown.
|
|
272
|
+
*
|
|
273
|
+
* @defaultValue 150
|
|
274
|
+
*/
|
|
275
|
+
dropdownThreshold?: number
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Force dropdown mode regardless of available width.
|
|
279
|
+
*
|
|
280
|
+
* @defaultValue false
|
|
281
|
+
*/
|
|
282
|
+
forceDropdown?: boolean
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Configuration for individual actions. Set to true to enable with defaults,
|
|
286
|
+
* false to disable, or provide RowActionOptions for custom configuration.
|
|
287
|
+
*/
|
|
288
|
+
actions?: {
|
|
289
|
+
add?: boolean | RowActionOptions
|
|
290
|
+
delete?: boolean | RowActionOptions
|
|
291
|
+
duplicate?: boolean | RowActionOptions
|
|
292
|
+
insertAbove?: boolean | RowActionOptions
|
|
293
|
+
insertBelow?: boolean | RowActionOptions
|
|
294
|
+
move?: boolean | RowActionOptions
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
212
298
|
/**
|
|
213
299
|
* Base table configuration properties shared across all view types.
|
|
214
300
|
* @public
|
|
@@ -220,6 +306,11 @@ export interface BaseTableConfig {
|
|
|
220
306
|
* @defaultValue false
|
|
221
307
|
*/
|
|
222
308
|
fullWidth?: boolean
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Configuration for row-level actions (add, delete, duplicate, etc.).
|
|
312
|
+
*/
|
|
313
|
+
rowActions?: RowActionsConfig
|
|
223
314
|
}
|
|
224
315
|
|
|
225
316
|
/**
|
|
@@ -726,3 +817,50 @@ export type ConnectionEvent = {
|
|
|
726
817
|
type: 'create' | 'delete'
|
|
727
818
|
connection: ConnectionPath
|
|
728
819
|
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Event payload for row:add event.
|
|
823
|
+
* @public
|
|
824
|
+
*/
|
|
825
|
+
export interface RowAddEvent {
|
|
826
|
+
rowIndex: number
|
|
827
|
+
row: TableRow
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Event payload for row:delete event.
|
|
832
|
+
* @public
|
|
833
|
+
*/
|
|
834
|
+
export interface RowDeleteEvent {
|
|
835
|
+
rowIndex: number
|
|
836
|
+
row: TableRow
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Event payload for row:duplicate event.
|
|
841
|
+
* @public
|
|
842
|
+
*/
|
|
843
|
+
export interface RowDuplicateEvent {
|
|
844
|
+
sourceIndex: number
|
|
845
|
+
newIndex: number
|
|
846
|
+
row: TableRow
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Event payload for row:insert-above and row:insert-below events.
|
|
851
|
+
* @public
|
|
852
|
+
*/
|
|
853
|
+
export interface RowInsertEvent {
|
|
854
|
+
targetIndex: number
|
|
855
|
+
newIndex: number
|
|
856
|
+
row: TableRow
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* Event payload for row:move event.
|
|
861
|
+
* @public
|
|
862
|
+
*/
|
|
863
|
+
export interface RowMoveEvent {
|
|
864
|
+
fromIndex: number
|
|
865
|
+
toIndex: number
|
|
866
|
+
}
|