PluginProbe
The Innovative Form Builder – IvyForms / 1.1
The Innovative Form Builder – IvyForms v1.1
1.5.1 1.5 1.4.1 1.4 trunk 0.1.2 0.2 0.2.1 0.3 0.3.1 0.4 0.5 0.6 0.6.1 0.6.1-backup 0.6.1.1 0.7 0.8 0.8.1 0.8.2 0.9 0.9.1 1.0 1.1 1.1.1 All 27 releases
ivyforms / frontend / src / views / _components / table / columns / actionsColumn.ts

actionsColumn.ts in The Innovative Form Builder – IvyForms 1.1, at frontend/src/views/_components/table/columns/actionsColumn.ts

44 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { TableV2FixedDir } from 'element-plus'
2 import type { VNode } from 'vue'
3 import type { TableColumn } from '@/views/_components/table/IvyTableColumn'
4 import { actionsCellRenderer } from '@/views/_components/table/renderers'
5 import type {
6 ActionsCellOptions,
7 CellAction,
8 } from '@/views/_components/table/renderers/actionsCellRenderer'
9
10 export interface ActionsColumnOptions<Row extends Record<string, unknown>> {
11 actions: CellAction<Row>[] | ((row: Row) => CellAction<Row>[])
12 idKey?: ActionsCellOptions<Row>['idKey']
13 onButtonRef?: ActionsCellOptions<Row>['onButtonRef']
14 headerRenderer?: () => VNode
15 title?: string
16 width?: number
17 minWidth?: number
18 className?: string
19 overrides?: Partial<TableColumn>
20 }
21
22 export function actionsColumn<Row extends Record<string, unknown>>(
23 options: ActionsColumnOptions<Row>,
24 ): TableColumn {
25 const width = options.width ?? 120
26 return {
27 key: 'actions',
28 width,
29 minWidth: options.minWidth ?? width,
30 title: options.title,
31 class: options.className,
32 headerRenderer: options.headerRenderer,
33 cellRenderer: actionsCellRenderer<Row>({
34 actions: options.actions,
35 idKey: options.idKey,
36 onButtonRef: options.onButtonRef,
37 }),
38 visible: true,
39 showInModal: false,
40 fixed: TableV2FixedDir.RIGHT,
41 ...options.overrides,
42 }
43 }
44