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 / starColumn.ts

starColumn.ts in The Innovative Form Builder – IvyForms 1.1, at frontend/src/views/_components/table/columns/starColumn.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 { h } from 'vue'
2 import IvyIcon from '@/views/_components/icon/IvyIcon.vue'
3 import type { TableColumn } from '@/views/_components/table/IvyTableColumn'
4 import { starCellRenderer } from '@/views/_components/table/renderers'
5 import type { StarCellOptions } from '@/views/_components/table/renderers/starCellRenderer'
6
7 export interface StarColumnOptions<Row extends Record<string, unknown>> {
8 onChange: StarCellOptions<Row>['onChange']
9 field: StarCellOptions<Row>['field']
10 ariaLabel?: StarCellOptions<Row>['ariaLabel']
11 title?: string
12 width?: number
13 minWidth?: number
14 headerColor?: string
15 overrides?: Partial<TableColumn>
16 }
17
18 export function starColumn<Row extends Record<string, unknown>>(
19 options: StarColumnOptions<Row>,
20 ): TableColumn {
21 const width = options.width ?? 32
22 return {
23 key: 'star',
24 width,
25 minWidth: options.minWidth ?? width,
26 title: options.title,
27 headerRenderer: () =>
28 h(IvyIcon, {
29 name: 'star',
30 type: 'outline',
31 size: 'd',
32 color: options.headerColor ?? 'var(--map-base-dusk-symbol-2)',
33 }),
34 cellRenderer: starCellRenderer<Row>({
35 onChange: options.onChange,
36 field: options.field,
37 ariaLabel: options.ariaLabel,
38 }),
39 visible: true,
40 showInModal: true,
41 ...options.overrides,
42 }
43 }
44