@stonecrop/atable 0.21.0 → 0.23.0
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 +16 -7
- package/dist/atable.js +860 -841
- package/dist/atable.js.map +1 -1
- package/dist/src/stores/table.d.ts +13 -6
- package/dist/src/stores/table.d.ts.map +1 -1
- package/dist/src/stores/table.js +0 -1
- package/dist/src/types/index.d.ts +3 -1
- package/dist/src/types/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/ACell.vue +50 -6
- package/src/stores/table.ts +5 -2
- package/src/types/index.ts +3 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BadgeDescriptor } from '@stonecrop/schema';
|
|
1
2
|
import { type CSSProperties } from 'vue';
|
|
2
3
|
import type { CellContext, ConnectionHandle, ConnectionPath, GanttBarInfo, GanttDragEvent, TableColumn, TableConfig, TableDisplay, TableModal, TableRow } from '../types';
|
|
3
4
|
/**
|
|
@@ -39,7 +40,7 @@ export declare const createTableStore: (initData: {
|
|
|
39
40
|
}) => import("pinia").Store<`table-${string}`, Pick<{
|
|
40
41
|
columns: import("vue").Ref<{
|
|
41
42
|
name: string;
|
|
42
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
43
|
+
format?: string | ((value: any, context: CellContext) => string | BadgeDescriptor) | undefined;
|
|
43
44
|
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
44
45
|
mask?: ((value: any) => any) | undefined;
|
|
45
46
|
linkDoctype?: string | undefined;
|
|
@@ -60,12 +61,13 @@ export declare const createTableStore: (initData: {
|
|
|
60
61
|
cellComponent?: string | undefined;
|
|
61
62
|
cellComponentProps?: Record<string, any> | undefined;
|
|
62
63
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
64
|
+
options?: import("@stonecrop/schema").FieldOptions | undefined;
|
|
63
65
|
isGantt?: boolean | undefined;
|
|
64
66
|
ganttComponent?: string | undefined;
|
|
65
67
|
colspan?: number | undefined;
|
|
66
68
|
}[], TableColumn[] | {
|
|
67
69
|
name: string;
|
|
68
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
70
|
+
format?: string | ((value: any, context: CellContext) => string | BadgeDescriptor) | undefined;
|
|
69
71
|
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
70
72
|
mask?: ((value: any) => any) | undefined;
|
|
71
73
|
linkDoctype?: string | undefined;
|
|
@@ -86,6 +88,7 @@ export declare const createTableStore: (initData: {
|
|
|
86
88
|
cellComponent?: string | undefined;
|
|
87
89
|
cellComponentProps?: Record<string, any> | undefined;
|
|
88
90
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
91
|
+
options?: import("@stonecrop/schema").FieldOptions | undefined;
|
|
89
92
|
isGantt?: boolean | undefined;
|
|
90
93
|
ganttComponent?: string | undefined;
|
|
91
94
|
colspan?: number | undefined;
|
|
@@ -911,7 +914,7 @@ export declare const createTableStore: (initData: {
|
|
|
911
914
|
}, "columns" | "config" | "connectionHandles" | "connectionPaths" | "filterState" | "ganttBars" | "modal" | "rows" | "sortState" | "updates" | "linkResolver">, Pick<{
|
|
912
915
|
columns: import("vue").Ref<{
|
|
913
916
|
name: string;
|
|
914
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
917
|
+
format?: string | ((value: any, context: CellContext) => string | BadgeDescriptor) | undefined;
|
|
915
918
|
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
916
919
|
mask?: ((value: any) => any) | undefined;
|
|
917
920
|
linkDoctype?: string | undefined;
|
|
@@ -932,12 +935,13 @@ export declare const createTableStore: (initData: {
|
|
|
932
935
|
cellComponent?: string | undefined;
|
|
933
936
|
cellComponentProps?: Record<string, any> | undefined;
|
|
934
937
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
938
|
+
options?: import("@stonecrop/schema").FieldOptions | undefined;
|
|
935
939
|
isGantt?: boolean | undefined;
|
|
936
940
|
ganttComponent?: string | undefined;
|
|
937
941
|
colspan?: number | undefined;
|
|
938
942
|
}[], TableColumn[] | {
|
|
939
943
|
name: string;
|
|
940
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
944
|
+
format?: string | ((value: any, context: CellContext) => string | BadgeDescriptor) | undefined;
|
|
941
945
|
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
942
946
|
mask?: ((value: any) => any) | undefined;
|
|
943
947
|
linkDoctype?: string | undefined;
|
|
@@ -958,6 +962,7 @@ export declare const createTableStore: (initData: {
|
|
|
958
962
|
cellComponent?: string | undefined;
|
|
959
963
|
cellComponentProps?: Record<string, any> | undefined;
|
|
960
964
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
965
|
+
options?: import("@stonecrop/schema").FieldOptions | undefined;
|
|
961
966
|
isGantt?: boolean | undefined;
|
|
962
967
|
ganttComponent?: string | undefined;
|
|
963
968
|
colspan?: number | undefined;
|
|
@@ -1783,7 +1788,7 @@ export declare const createTableStore: (initData: {
|
|
|
1783
1788
|
}, "display" | "table" | "filteredRows" | "hasPinnedColumns" | "isGanttView" | "isTreeView" | "isDependencyGraphEnabled" | "numberedRowWidth" | "zeroColumn">, Pick<{
|
|
1784
1789
|
columns: import("vue").Ref<{
|
|
1785
1790
|
name: string;
|
|
1786
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
1791
|
+
format?: string | ((value: any, context: CellContext) => string | BadgeDescriptor) | undefined;
|
|
1787
1792
|
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
1788
1793
|
mask?: ((value: any) => any) | undefined;
|
|
1789
1794
|
linkDoctype?: string | undefined;
|
|
@@ -1804,12 +1809,13 @@ export declare const createTableStore: (initData: {
|
|
|
1804
1809
|
cellComponent?: string | undefined;
|
|
1805
1810
|
cellComponentProps?: Record<string, any> | undefined;
|
|
1806
1811
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
1812
|
+
options?: import("@stonecrop/schema").FieldOptions | undefined;
|
|
1807
1813
|
isGantt?: boolean | undefined;
|
|
1808
1814
|
ganttComponent?: string | undefined;
|
|
1809
1815
|
colspan?: number | undefined;
|
|
1810
1816
|
}[], TableColumn[] | {
|
|
1811
1817
|
name: string;
|
|
1812
|
-
format?: string | ((value: any, context: CellContext) => string) | undefined;
|
|
1818
|
+
format?: string | ((value: any, context: CellContext) => string | BadgeDescriptor) | undefined;
|
|
1813
1819
|
modalComponent?: string | ((context: CellContext) => string) | undefined;
|
|
1814
1820
|
mask?: ((value: any) => any) | undefined;
|
|
1815
1821
|
linkDoctype?: string | undefined;
|
|
@@ -1830,6 +1836,7 @@ export declare const createTableStore: (initData: {
|
|
|
1830
1836
|
cellComponent?: string | undefined;
|
|
1831
1837
|
cellComponentProps?: Record<string, any> | undefined;
|
|
1832
1838
|
modalComponentExtraProps?: Record<string, any> | undefined;
|
|
1839
|
+
options?: import("@stonecrop/schema").FieldOptions | undefined;
|
|
1833
1840
|
isGantt?: boolean | undefined;
|
|
1834
1841
|
ganttComponent?: string | undefined;
|
|
1835
1842
|
colspan?: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/stores/table.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,KAAK,CAAA;AAEvD,OAAO,KAAK,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,MAAM,UAAU,CAAA;AAGjB;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B,4BAA4B;IAC5B,KAAK,EAAE,GAAG,CAAA;IACV,yCAAyC;IACzC,UAAU,CAAC,EAAE,GAAG,CAAA;IAChB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,GAAG,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,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Y,OAAO,GAAG,KAAK,GAAG,MAAM,KAAW,MAAM;4BAZjE,MAAM;wBAnJV,UAAU;qCAqEtB,MAAM,cACR,MAAM,YACR;QAAE,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;qCA4BtB,MAAM;0BA4FjB,MAAM,KAAG,QAAQ,GAAG,IAAI;6BA4CrB,MAAM,KAAG,MAAM;4BA5YhB,MAAM,YAAY,MAAM,KAAG,GAAG;oCA6HtB,MAAM,YAAY,MAAM;kCAgJ1B,MAAM;;;;;;;;;;;;;;;;kCA3IN,MAAM,YAAY,MAAM,SAAS,GAAG;8BA+IxC,MAAM;;;;;;;;;;;;iCAnPH,WAAW,KAAG,aAAa;mCAwCzB,MAAM;+BA4VV,MAAM,YAAY,OAAO,CAAC,QAAQ,CAAC,KAAG,MAAM;+BAW5C,MAAM,YAAY,OAAO,CAAC,QAAQ,CAAC,KAAG,MAAM;2BAhXhD,MAAM;6BAKJ,MAAM;yBAsXV,MAAM,WAAW,MAAM,KAAG,OAAO;2CArOf,gBAAgB;gCAlB3B,YAAY;6BAhJf,MAAM,YAAY,MAAM;4BAhDzB,MAAM,YAAY,MAAM,SAAS,GAAG;4BAoBpC,MAAM,YAAY,MAAM,SAAS,MAAM;0BAsRzC,MAAM,UAAU,WAAW;6BAtBxB,MAAM;gCA/LH,MAAM;2CAwIK,MAAM;gCAlBjB,MAAM;4BAjCV,cAAc;0BA1JhB,QAAQ,EAAE;+kBA2iBxC,CAAA"}
|
package/dist/src/stores/table.js
CHANGED
|
@@ -450,7 +450,6 @@ export const createTableStore = (initData) => {
|
|
|
450
450
|
return format(value, { table: table.value, row, column });
|
|
451
451
|
}
|
|
452
452
|
else if (typeof format === 'string') {
|
|
453
|
-
// parse format function from string
|
|
454
453
|
// oxlint-disable-next-line @typescript-eslint/no-implied-eval
|
|
455
454
|
const formatFn = Function(`"use strict";return (${format})`)();
|
|
456
455
|
return formatFn(value, { table: table.value, row, column });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useElementBounding } from '@vueuse/core';
|
|
2
2
|
import type { Ref, ShallowRef } from 'vue';
|
|
3
3
|
import type { ColumnSchema } from '@stonecrop/schema';
|
|
4
|
+
import type { BadgeDescriptor } from '@stonecrop/schema';
|
|
4
5
|
import { createTableStore } from '../stores/table';
|
|
5
6
|
/**
|
|
6
7
|
* Runtime column definition for ATable.
|
|
@@ -21,8 +22,9 @@ export interface TableColumn extends Omit<ColumnSchema, 'fieldname' | 'hidden' |
|
|
|
21
22
|
/**
|
|
22
23
|
* Widens `ColumnSchema.format` (string-only) to also accept a live function at runtime.
|
|
23
24
|
* Serialized string functions are deserialized by the table store's `getFormattedValue`.
|
|
25
|
+
* May return a plain string, HTML, or a {@link @stonecrop/schema#BadgeDescriptor}.
|
|
24
26
|
*/
|
|
25
|
-
format?: string | ((value: any, context: CellContext) => string);
|
|
27
|
+
format?: string | ((value: any, context: CellContext) => string | BadgeDescriptor);
|
|
26
28
|
/**
|
|
27
29
|
* Widens `ColumnSchema.modalComponent` (string-only) to also accept a factory function.
|
|
28
30
|
* When a function is provided it receives the cell context and returns the component name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAE1C,OAAO,KAAK,EAAE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;AACH,MAAM,WAAW,aAAa;IAC7B,mCAAmC;IACnC,GAAG,EAAE,QAAQ,CAAA;IACb,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,UAAU,CAAA;CAClB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/atable",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Advanced data table component for Stonecrop",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/agritheory/stonecrop/issues"
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@vueuse/components": "^14.2.1",
|
|
37
37
|
"@vueuse/core": "^14.2.1",
|
|
38
|
-
"@stonecrop/schema": "0.
|
|
39
|
-
"@stonecrop/themes": "0.
|
|
40
|
-
"@stonecrop/utilities": "0.
|
|
38
|
+
"@stonecrop/schema": "0.23.0",
|
|
39
|
+
"@stonecrop/themes": "0.23.0",
|
|
40
|
+
"@stonecrop/utilities": "0.23.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@microsoft/api-documenter": "^7.30.5",
|
package/src/components/ACell.vue
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:data-colindex="colIndex"
|
|
5
5
|
:data-rowindex="rowIndex"
|
|
6
6
|
:data-editable="column.edit"
|
|
7
|
-
:contenteditable="
|
|
7
|
+
:contenteditable="isContentEditable"
|
|
8
8
|
:tabindex="tabIndex"
|
|
9
9
|
:spellcheck="false"
|
|
10
10
|
:style="cellStyle"
|
|
@@ -14,11 +14,9 @@
|
|
|
14
14
|
@paste="updateCellData"
|
|
15
15
|
@input="debouncedUpdateCellData"
|
|
16
16
|
@click="onCellClick">
|
|
17
|
-
<component
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
:value="renderedValue"
|
|
21
|
-
v-bind="column.cellComponentProps" />
|
|
17
|
+
<component :is="column.cellComponent" v-if="column.cellComponent" v-bind="cellComponentBindings" />
|
|
18
|
+
<component :is="'ABadge'" v-else-if="badgeFromFormat" v-bind="badgeFromFormat" presentation="cell-fill" />
|
|
19
|
+
<component :is="'ABadge'" v-else-if="badgeFromOptions" v-bind="badgeFromOptions" />
|
|
22
20
|
<span v-else-if="isHtmlValue" v-html="renderedValue" />
|
|
23
21
|
<span v-else>{{ renderedValue }}</span>
|
|
24
22
|
</td>
|
|
@@ -26,6 +24,7 @@
|
|
|
26
24
|
|
|
27
25
|
<script setup lang="ts">
|
|
28
26
|
import { KeypressHandlers, defaultKeypressHandlers, useKeyboardNav } from '@stonecrop/utilities'
|
|
27
|
+
import { isBadgeDescriptor, hasBadgeOptions } from '@stonecrop/schema'
|
|
29
28
|
import { useDebounceFn, useElementBounding } from '@vueuse/core'
|
|
30
29
|
import { computed, type CSSProperties, onMounted, ref, useTemplateRef, nextTick } from 'vue'
|
|
31
30
|
|
|
@@ -94,6 +93,46 @@ onMounted(() => {
|
|
|
94
93
|
|
|
95
94
|
const renderedValue = computed(() => resolvedText.value ?? displayValue.value)
|
|
96
95
|
|
|
96
|
+
const badgeFromFormat = computed(() => {
|
|
97
|
+
if (column.cellComponent) return undefined
|
|
98
|
+
const value = renderedValue.value
|
|
99
|
+
return isBadgeDescriptor(value) ? value : undefined
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
const badgeFromOptions = computed(() => {
|
|
103
|
+
if (column.cellComponent || badgeFromFormat.value) return undefined
|
|
104
|
+
if (!hasBadgeOptions(column.options)) return undefined
|
|
105
|
+
return {
|
|
106
|
+
value: store.getCellData(colIndex, rowIndex),
|
|
107
|
+
options: column.options,
|
|
108
|
+
presentation: 'cell-fill' as const,
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
const usesBadgeDisplay = computed(
|
|
113
|
+
() => !!column.cellComponent || badgeFromFormat.value !== undefined || hasBadgeOptions(column.options)
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
const isContentEditable = computed(() => column.edit && !usesBadgeDisplay.value)
|
|
117
|
+
|
|
118
|
+
const cellComponentBindings = computed(() => {
|
|
119
|
+
const props = { ...column.cellComponentProps }
|
|
120
|
+
if (column.cellComponent !== 'ABadge') {
|
|
121
|
+
return { ...props, value: renderedValue.value }
|
|
122
|
+
}
|
|
123
|
+
if (isBadgeDescriptor(renderedValue.value)) {
|
|
124
|
+
return { presentation: 'cell-fill' as const, ...props, ...renderedValue.value }
|
|
125
|
+
}
|
|
126
|
+
// ABadge resolves its own label, so it needs the badge map as well as the value — and the value
|
|
127
|
+
// has to be the stored one, because badge maps are keyed on that rather than on formatted text.
|
|
128
|
+
return {
|
|
129
|
+
presentation: 'cell-fill' as const,
|
|
130
|
+
options: column.options,
|
|
131
|
+
...props,
|
|
132
|
+
value: store.getCellData(colIndex, rowIndex),
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
|
|
97
136
|
const isHtmlValue = computed(() => {
|
|
98
137
|
// TODO: check if display value is a native DOM element
|
|
99
138
|
return typeof renderedValue.value === 'string' ? isHtmlString(renderedValue.value) : false
|
|
@@ -112,6 +151,7 @@ const cellClasses = computed(() => {
|
|
|
112
151
|
return {
|
|
113
152
|
'sticky-column': pinned,
|
|
114
153
|
'cell-modified': cellModified.value,
|
|
154
|
+
'atable-cell--badge-fill': usesBadgeDisplay.value,
|
|
115
155
|
}
|
|
116
156
|
})
|
|
117
157
|
|
|
@@ -363,4 +403,8 @@ defineExpose({
|
|
|
363
403
|
.cell-modified-highlight {
|
|
364
404
|
background-color: var(--sc-cell-changed-color);
|
|
365
405
|
}
|
|
406
|
+
.atable-cell--badge-fill {
|
|
407
|
+
padding: 0 !important;
|
|
408
|
+
margin-left: 0;
|
|
409
|
+
}
|
|
366
410
|
</style>
|
package/src/stores/table.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineStore } from 'pinia'
|
|
2
2
|
import { componentCategory } from '@stonecrop/schema'
|
|
3
|
+
import type { BadgeDescriptor } from '@stonecrop/schema'
|
|
3
4
|
import { type CSSProperties, computed, ref } from 'vue'
|
|
4
5
|
|
|
5
6
|
import type {
|
|
@@ -549,9 +550,11 @@ export const createTableStore = (initData: {
|
|
|
549
550
|
if (typeof format === 'function') {
|
|
550
551
|
return format(value, { table: table.value, row, column })
|
|
551
552
|
} else if (typeof format === 'string') {
|
|
552
|
-
// parse format function from string
|
|
553
|
+
// parse format function from string. The alias keeps the declaration on one line so the
|
|
554
|
+
// disable directive below stays attached to the Function call it covers.
|
|
555
|
+
type DeserializedFormat = (value: any, context?: CellContext) => string | BadgeDescriptor
|
|
553
556
|
// oxlint-disable-next-line @typescript-eslint/no-implied-eval
|
|
554
|
-
const formatFn:
|
|
557
|
+
const formatFn: DeserializedFormat = Function(`"use strict";return (${format})`)()
|
|
555
558
|
return formatFn(value, { table: table.value, row, column })
|
|
556
559
|
}
|
|
557
560
|
|
package/src/types/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { useElementBounding } from '@vueuse/core'
|
|
|
2
2
|
import type { Ref, ShallowRef } from 'vue'
|
|
3
3
|
|
|
4
4
|
import type { ColumnSchema } from '@stonecrop/schema'
|
|
5
|
+
import type { BadgeDescriptor } from '@stonecrop/schema'
|
|
5
6
|
|
|
6
7
|
import { createTableStore } from '../stores/table'
|
|
7
8
|
|
|
@@ -25,8 +26,9 @@ export interface TableColumn extends Omit<ColumnSchema, 'fieldname' | 'hidden' |
|
|
|
25
26
|
/**
|
|
26
27
|
* Widens `ColumnSchema.format` (string-only) to also accept a live function at runtime.
|
|
27
28
|
* Serialized string functions are deserialized by the table store's `getFormattedValue`.
|
|
29
|
+
* May return a plain string, HTML, or a {@link @stonecrop/schema#BadgeDescriptor}.
|
|
28
30
|
*/
|
|
29
|
-
format?: string | ((value: any, context: CellContext) => string)
|
|
31
|
+
format?: string | ((value: any, context: CellContext) => string | BadgeDescriptor)
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* Widens `ColumnSchema.modalComponent` (string-only) to also accept a factory function.
|