@@ -19,7 +19,6 @@ import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
19
19
import org.jetbrains.kotlinx.dataframe.columns.toColumnSet
20
20
import org.jetbrains.kotlinx.dataframe.dataTypes.IFRAME
21
21
import org.jetbrains.kotlinx.dataframe.dataTypes.IMG
22
- import org.jetbrains.kotlinx.dataframe.documentation.ExportAsHtml
23
22
import org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns
24
23
import org.jetbrains.kotlinx.dataframe.documentation.SelectingRows
25
24
import org.jetbrains.kotlinx.dataframe.impl.api.MergedAttributes
@@ -34,6 +33,10 @@ import org.jetbrains.kotlinx.dataframe.io.toHtml
34
33
import org.jetbrains.kotlinx.dataframe.io.toStandaloneHtml
35
34
import org.jetbrains.kotlinx.dataframe.jupyter.RenderedContent.Companion.media
36
35
import org.jetbrains.kotlinx.dataframe.util.DEPRECATED_ACCESS_API
36
+ import org.jetbrains.kotlinx.dataframe.util.FORMATTING_DSL
37
+ import org.jetbrains.kotlinx.dataframe.util.FORMATTING_DSL_REPLACE
38
+ import org.jetbrains.kotlinx.dataframe.util.RGB_COLOR
39
+ import org.jetbrains.kotlinx.dataframe.util.RGB_COLOR_REPLACE
37
40
import kotlin.reflect.KProperty
38
41
39
42
// region docs
@@ -214,82 +217,6 @@ internal interface FormatDocs {
214
217
*/
215
218
interface Grammar {
216
219
217
- /* *
218
- * ### Definitions:
219
- * `cellFormatter: `[FormattingDsl][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.FormattingDslGrammarDef]`.(cell: C) -> `[CellAttributes][org.jetbrains.kotlinx.dataframe.api.CellAttributes]`?`
220
- *
221
- *
222
- *
223
- * `rowColFormatter: `[FormattingDsl][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.FormattingDslGrammarDef]`.(row: `[DataRow][org.jetbrains.kotlinx.dataframe.DataRow]`<T>, col: `[DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]`<C>) -> `[CellAttributes][org.jetbrains.kotlinx.dataframe.api.CellAttributes]`?`
224
- *
225
- * ### Notation:
226
- *
227
- * [**format**][DataFrame.format]**` { `**[`columns`][SelectingColumns]**` }`**
228
- *
229
- *
230
- * `[ `__`.`__[**`where`**][FormatClause.where]**` { `**[`filter`][SelectingRows.RowValueCondition]`: `[`RowValueFilter`][RowValueFilter]**` } `**`]`
231
- *
232
- *
233
- * `[ `__`.`__[**`at`**][FormatClause.at]**`(`**`rowIndices: `[Collection][Collection]`<`[Int][Int]`> | `[IntRange][IntRange]` | `**`vararg`**` `[Int][Int]**`)`**` ]`
234
- *
235
- *
236
- * `[ `__`.`__[**`notNull`**][FormatClause.notNull]**`()`**` ]`
237
- *
238
- *
239
- * __`.`__[**`with`**][FormatClause.with]**` { `**[cellFormatter][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.CellFormatterDef]**` }`**
240
- *
241
- *
242
- * `| `__`.`__[**`notNull`**][FormatClause.notNull]**` { `**[cellFormatter][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.CellFormatterDef]**` }`**
243
- *
244
- *
245
- * `| `__`.`__[**`perRowCol`**][FormatClause.perRowCol]**` { `**[rowColFormatter][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.RowColFormatterDef]**` }`**
246
- *
247
- *
248
- * `| `__`.`__[**`linearBg`**][FormatClause.linearBg]**`(`**`from: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][RgbColor]`>`**`,`**` to: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][RgbColor]`>`**`)`**
249
- *
250
- * `[ `__`.`__[**format**][FormattedFrame.format]` ↺ ]`
251
- *
252
- *
253
- *
254
- * ## Formatting DSL Grammar
255
- *
256
- * ### Definitions:
257
- * `cellAttributes: `[CellAttributes][org.jetbrains.kotlinx.dataframe.api.CellAttributes]
258
- *
259
- *
260
- *
261
- * `color: `[RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]
262
- *
263
- * ### Notation:
264
- * _- Returning [CellAttributes][org.jetbrains.kotlinx.dataframe.api.CellAttributes]_:
265
- *
266
- * [cellAttributes][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.CellAttributesDef]` `[**`and`**][org.jetbrains.kotlinx.dataframe.api.CellAttributes.and]` `[cellAttributes][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.CellAttributesDef]
267
- *
268
- * `| `[**`italic`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.italic]` | `[**`bold`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.bold]` | `[**`underline`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.underline]
269
- *
270
- * `| `[**`background`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.background]**`(`**[color][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.RgbColorDef]**`)`**
271
- *
272
- * `| `[**`background`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.background]**`(`**`r: `[Short][Short]**`,`**` g: `[Short][Short]**`,`**` b: `[Short][Short]**`)`**
273
- *
274
- * `| `[**`linearBg`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.linearBg]**`(`**`value: `[Number][Number]**`,`**` from: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]`>`**`,`**` to: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]`>`**`)`**
275
- *
276
- * `| `[**`textColor`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.textColor]**`(`**[color][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.RgbColorDef]**`)`**
277
- *
278
- * `| `[**`textColor`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.textColor]**`(`**`r: `[Short][Short]**`,`**` g: `[Short][Short]**`,`**` b: `[Short][Short]**`)`**
279
- *
280
- * `| `[**`attr`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.attr]**`(`**`name: `[String][String]**`,`**` value: `[String][String]**`)`**
281
- *
282
- * _- Returning [RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]:_
283
- *
284
- * [**`black`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.black]` | `[**`white`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.white]` | `[**`green`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.green]` | `[**`red`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.red]` | `[**`blue`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.blue]` | `[**`gray`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.gray]` | `[**`darkGray`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.darkGray]` | `[**`lightGray`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.lightGray]
285
- *
286
- * `| `[**`rgb`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.rgb]**`(`**`r: `[Short][Short]**`,`**` g: `[Short][Short]**`,`**` b: `[Short][Short]**`)`**
287
- *
288
- * `| `[**`linear`**][org.jetbrains.kotlinx.dataframe.api.FormattingDsl.linear]**`(`**`value: `[Number][Number]**`,`**` from: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]`>`**`,`**` to: `[Pair][Pair]`<`[Number][Number]`, `[RgbColor][org.jetbrains.kotlinx.dataframe.api.RgbColor]`>`**`)`**
289
- */
290
- @ExportAsHtml
291
- interface ForHtml
292
-
293
220
/* *
294
221
* ## Formatting DSL Grammar
295
222
*
@@ -1134,14 +1061,18 @@ public typealias CellFormatter<C> = FormattingDsl.(cell: C) -> CellAttributes?
1134
1061
*
1135
1062
* Call [toHtml] or [toStandaloneHtml] to get the HTML representation of the [DataFrame].
1136
1063
*
1064
+ * In Jupyter kernel (Kotlin Notebook) environments, you can often output this class directly.
1065
+ * Use [toHtml] or [toStandaloneHtml] when this produces unexpected results.
1066
+ *
1137
1067
* You can apply further formatting to this [FormattedFrame] by calling [format()][FormattedFrame.format] once again.
1138
1068
*/
1139
1069
public class FormattedFrame <T >(internal val df : DataFrame <T >, internal val formatter : RowColFormatter <T , * >? = null ) {
1140
1070
1141
1071
/* *
1142
1072
* Returns a [DataFrameHtmlData] without additional definitions.
1143
- * Can be rendered in Jupyter kernel (Notebook) environments or other environments that already have
1073
+ * Can be rendered in Jupyter kernel (Kotlin Notebook) environments or other environments that already have
1144
1074
* CSS- and script definitions for DataFrame.
1075
+ *
1145
1076
* Use [toStandaloneHtml] if you need the [DataFrameHtmlData] to include CSS- and script definitions.
1146
1077
*
1147
1078
* By default, cell content is formatted as text
@@ -1157,6 +1088,8 @@ public class FormattedFrame<T>(internal val df: DataFrame<T>, internal val forma
1157
1088
/* *
1158
1089
* Returns a [DataFrameHtmlData] with CSS- and script definitions for DataFrame.
1159
1090
*
1091
+ * Use [toHtml] if you don't need the [DataFrameHtmlData] to include CSS- and script definitions.
1092
+ *
1160
1093
* The [DataFrameHtmlData] can be saved as an *.html file and displayed in the browser.
1161
1094
* If you save it as a file and find it in the project tree,
1162
1095
* the ["Open in browser"](https://www.jetbrains.com/help/idea/editing-html-files.html#ws_html_preview_output_procedure)
@@ -1165,6 +1098,10 @@ public class FormattedFrame<T>(internal val df: DataFrame<T>, internal val forma
1165
1098
* By default, cell content is formatted as text
1166
1099
* Use [RenderedContent.media][media] or [IMG], [IFRAME] if you need custom HTML inside a cell.
1167
1100
*
1101
+ * __NOTE:__ In Kotlin Notebook, output [FormattedFrame] directly, or use [toHtml],
1102
+ * as that environment already has CSS- and script definitions for DataFrame.
1103
+ * Using [toStandaloneHtml] might produce unexpected results.
1104
+ *
1168
1105
* @param [configuration] The [DisplayConfiguration] to use as a base for this [FormattedFrame].
1169
1106
* Default: [DisplayConfiguration.DEFAULT].
1170
1107
* @see toHtml
@@ -1213,3 +1150,21 @@ public class FormatClause<T, C>(
1213
1150
}
1214
1151
1215
1152
// endregion
1153
+
1154
+ // region Deprecated
1155
+
1156
+ @Deprecated(
1157
+ message = FORMATTING_DSL ,
1158
+ replaceWith = ReplaceWith (FORMATTING_DSL_REPLACE ),
1159
+ level = DeprecationLevel .ERROR ,
1160
+ )
1161
+ public typealias FormattingDSL = FormattingDsl
1162
+
1163
+ @Deprecated(
1164
+ message = RGB_COLOR ,
1165
+ replaceWith = ReplaceWith (RGB_COLOR_REPLACE ),
1166
+ level = DeprecationLevel .ERROR ,
1167
+ )
1168
+ public typealias RGBColor = RgbColor
1169
+
1170
+ // endregion
0 commit comments