@@ -50,6 +50,8 @@ public class HeaderFormatClause<T, C>(
50
50
// region DataFrame.formatHeader
51
51
52
52
/* *
53
+ * **Experimental API. It may be changed in the future.**
54
+ *
53
55
* Selects [columns] whose headers should be formatted.
54
56
*
55
57
* This does not immediately produce a [FormattedFrame]; instead it returns a [HeaderFormatClause]
@@ -59,29 +61,37 @@ public fun <T, C> DataFrame<T>.formatHeader(columns: ColumnsSelector<T, C>): Hea
59
61
HeaderFormatClause (this , columns)
60
62
61
63
/* *
62
- * Selects headers by [column names][String].
64
+ * **Experimental API. It may be changed in the future.**
63
65
*
64
- * Equivalent to `formatHeader { columns.toColumnSet() }` .
66
+ * Selects [columns] whose headers should be formatted .
65
67
*
66
- * Examples:
67
- * ```kt
68
- * // center a single column header
69
- * df.formatHeader("age").with { attr("text-align", "center") }
70
- * ```
68
+ * This does not immediately produce a [FormattedFrame]; instead it returns a [HeaderFormatClause]
69
+ * which must be finalized using [HeaderFormatClause.with].
71
70
*/
72
71
public fun <T > DataFrame<T>.formatHeader (vararg columns : String ): HeaderFormatClause <T , Any ?> =
73
72
formatHeader { columns.toColumnSet() }
74
73
75
- /* * Formats all column headers. */
74
+ /* *
75
+ * **Experimental API. It may be changed in the future.**
76
+ *
77
+ * Selects all columns for header formatting.
78
+ *
79
+ * This does not immediately produce a [FormattedFrame]; instead it returns a [HeaderFormatClause]
80
+ * which must be finalized using [HeaderFormatClause.with].
81
+ */
76
82
public fun <T > DataFrame<T>.formatHeader (): HeaderFormatClause <T , Any ?> = HeaderFormatClause (this )
77
83
78
-
79
84
// endregion
80
85
81
86
// region FormattedFrame.formatHeader
82
87
83
88
/* *
84
- * Continue header formatting on an already [FormattedFrame], preserving existing cell- and header formatting.
89
+ * **Experimental API. It may be changed in the future.**
90
+ *
91
+ * Selects [columns] whose headers should be formatted.
92
+ *
93
+ * This does not immediately produce a [FormattedFrame]; instead it returns a [HeaderFormatClause]
94
+ * which must be finalized using [HeaderFormatClause.with].
85
95
*/
86
96
public fun <T , C > FormattedFrame<T>.formatHeader (columns : ColumnsSelector <T , C >): HeaderFormatClause <T , C > =
87
97
HeaderFormatClause (
@@ -91,11 +101,25 @@ public fun <T, C> FormattedFrame<T>.formatHeader(columns: ColumnsSelector<T, C>)
91
101
oldCellFormatter = formatter,
92
102
)
93
103
94
- /* * Selects headers by [column names][String] on an existing [FormattedFrame]. */
104
+ /* *
105
+ * **Experimental API. It may be changed in the future.**
106
+ *
107
+ * Selects [columns] whose headers should be formatted.
108
+ *
109
+ * This does not immediately produce a [FormattedFrame]; instead it returns a [HeaderFormatClause]
110
+ * which must be finalized using [HeaderFormatClause.with].
111
+ */
95
112
public fun <T > FormattedFrame<T>.formatHeader (vararg columns : String ): HeaderFormatClause <T , Any ?> =
96
113
formatHeader { columns.toColumnSet() }
97
114
98
- /* * Selects all headers on an existing [FormattedFrame]. */
115
+ /* *
116
+ * **Experimental API. It may be changed in the future.**
117
+ *
118
+ * Selects all columns for header formatting.
119
+ *
120
+ * This does not immediately produce a [FormattedFrame]; instead it returns a [HeaderFormatClause]
121
+ * which must be finalized using [HeaderFormatClause.with].
122
+ */
99
123
public fun <T > FormattedFrame<T>.formatHeader (): HeaderFormatClause <T , Any ?> =
100
124
HeaderFormatClause (
101
125
df = df,
@@ -108,6 +132,8 @@ public fun <T> FormattedFrame<T>.formatHeader(): HeaderFormatClause<T, Any?> =
108
132
// region terminal operations
109
133
110
134
/* *
135
+ * **Experimental API. It may be changed in the future.**
136
+ *
111
137
* Creates a new [FormattedFrame] that uses the specified [HeaderColFormatter] to format the selected headers.
112
138
*
113
139
* Header formatting is additive: attributes from already-applied header formatters are combined with the newly
@@ -128,14 +154,12 @@ public fun <T, C> HeaderFormatClause<T, C>.with(formatter: HeaderColFormatter<C>
128
154
.map { p -> ColumnWithPath (df[p], p) }
129
155
.map { parentCol ->
130
156
if (parentCol.path in selectedPaths) {
131
- @Suppress(" UNCHECKED_CAST" )
132
157
oldHeader?.invoke(FormattingDsl , parentCol as ColumnWithPath <C >)
133
158
} else null
134
159
}
135
160
.reduceOrNull(CellAttributes ? ::and )
136
161
} else null
137
162
138
- @Suppress(" UNCHECKED_CAST" )
139
163
val typedCol = col as ColumnWithPath <C >
140
164
141
165
val existingAttr = oldHeader?.invoke(FormattingDsl , typedCol)
0 commit comments