Skip to content

Commit 28781e9

Browse files
Automated commit of generated code
1 parent 1ca44b5 commit 28781e9

File tree

6 files changed

+368
-150
lines changed

6 files changed

+368
-150
lines changed

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/format.kt

Lines changed: 33 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
1919
import org.jetbrains.kotlinx.dataframe.columns.toColumnSet
2020
import org.jetbrains.kotlinx.dataframe.dataTypes.IFRAME
2121
import org.jetbrains.kotlinx.dataframe.dataTypes.IMG
22-
import org.jetbrains.kotlinx.dataframe.documentation.ExportAsHtml
2322
import org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns
2423
import org.jetbrains.kotlinx.dataframe.documentation.SelectingRows
2524
import org.jetbrains.kotlinx.dataframe.impl.api.MergedAttributes
@@ -34,6 +33,10 @@ import org.jetbrains.kotlinx.dataframe.io.toHtml
3433
import org.jetbrains.kotlinx.dataframe.io.toStandaloneHtml
3534
import org.jetbrains.kotlinx.dataframe.jupyter.RenderedContent.Companion.media
3635
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
3740
import kotlin.reflect.KProperty
3841

3942
// region docs
@@ -214,82 +217,6 @@ internal interface FormatDocs {
214217
*/
215218
interface Grammar {
216219

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-
* &nbsp;&nbsp;&nbsp;&nbsp;
230-
* `[ `__`.`__[**`where`**][FormatClause.where]**` { `**[`filter`][SelectingRows.RowValueCondition]`: `[`RowValueFilter`][RowValueFilter]**` } `**`]`
231-
*
232-
* &nbsp;&nbsp;&nbsp;&nbsp;
233-
* `[ `__`.`__[**`at`**][FormatClause.at]**`(`**`rowIndices: `[Collection][Collection]`<`[Int][Int]`> | `[IntRange][IntRange]` | `**`vararg`**` `[Int][Int]**`)`**` ]`
234-
*
235-
* &nbsp;&nbsp;&nbsp;&nbsp;
236-
* `[ `__`.`__[**`notNull`**][FormatClause.notNull]**`()`**` ]`
237-
*
238-
* &nbsp;&nbsp;&nbsp;&nbsp;
239-
* __`.`__[**`with`**][FormatClause.with]**` { `**[cellFormatter][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.CellFormatterDef]**` }`**
240-
*
241-
* &nbsp;&nbsp;&nbsp;&nbsp;
242-
* `| `__`.`__[**`notNull`**][FormatClause.notNull]**` { `**[cellFormatter][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.CellFormatterDef]**` }`**
243-
*
244-
* &nbsp;&nbsp;&nbsp;&nbsp;
245-
* `| `__`.`__[**`perRowCol`**][FormatClause.perRowCol]**` { `**[rowColFormatter][org.jetbrains.kotlinx.dataframe.api.FormatDocs.Grammar.RowColFormatterDef]**` }`**
246-
*
247-
* &nbsp;&nbsp;&nbsp;&nbsp;
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-
* &nbsp;&nbsp;&nbsp;&nbsp;
253-
*
254-
* ## Formatting DSL Grammar
255-
*
256-
* ### Definitions:
257-
* `cellAttributes: `[CellAttributes][org.jetbrains.kotlinx.dataframe.api.CellAttributes]
258-
*
259-
* &nbsp;&nbsp;&nbsp;&nbsp;
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-
293220
/**
294221
* ## Formatting DSL Grammar
295222
*
@@ -1134,14 +1061,18 @@ public typealias CellFormatter<C> = FormattingDsl.(cell: C) -> CellAttributes?
11341061
*
11351062
* Call [toHtml] or [toStandaloneHtml] to get the HTML representation of the [DataFrame].
11361063
*
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+
*
11371067
* You can apply further formatting to this [FormattedFrame] by calling [format()][FormattedFrame.format] once again.
11381068
*/
11391069
public class FormattedFrame<T>(internal val df: DataFrame<T>, internal val formatter: RowColFormatter<T, *>? = null) {
11401070

11411071
/**
11421072
* 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
11441074
* CSS- and script definitions for DataFrame.
1075+
*
11451076
* Use [toStandaloneHtml] if you need the [DataFrameHtmlData] to include CSS- and script definitions.
11461077
*
11471078
* By default, cell content is formatted as text
@@ -1157,6 +1088,8 @@ public class FormattedFrame<T>(internal val df: DataFrame<T>, internal val forma
11571088
/**
11581089
* Returns a [DataFrameHtmlData] with CSS- and script definitions for DataFrame.
11591090
*
1091+
* Use [toHtml] if you don't need the [DataFrameHtmlData] to include CSS- and script definitions.
1092+
*
11601093
* The [DataFrameHtmlData] can be saved as an *.html file and displayed in the browser.
11611094
* If you save it as a file and find it in the project tree,
11621095
* 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
11651098
* By default, cell content is formatted as text
11661099
* Use [RenderedContent.media][media] or [IMG], [IFRAME] if you need custom HTML inside a cell.
11671100
*
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+
*
11681105
* @param [configuration] The [DisplayConfiguration] to use as a base for this [FormattedFrame].
11691106
* Default: [DisplayConfiguration.DEFAULT].
11701107
* @see toHtml
@@ -1213,3 +1150,21 @@ public class FormatClause<T, C>(
12131150
}
12141151

12151152
// 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

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/html.kt

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -559,17 +559,30 @@ public fun <T> DataFrame<T>.toStandaloneHTML(
559559
): DataFrameHtmlData = toStandaloneHtml(configuration, cellRenderer, getFooter)
560560

561561
/**
562-
* By default, cell content is formatted as text
563-
* Use [RenderedContent.media] or [IMG], [IFRAME] if you need custom HTML inside a cell.
562+
* Returns a [DataFrameHtmlData] with CSS- and script definitions for DataFrame.
564563
*
565564
* To change the formatting of certain cells or columns in the dataframe,
566565
* use [DataFrame.format].
567566
*
567+
* Use [toHtml] if you don't need the [DataFrameHtmlData] to include CSS- and script definitions.
568+
*
568569
* The [DataFrameHtmlData] can be saved as an *.html file and displayed in the browser.
569570
* If you save it as a file and find it in the project tree,
570571
* the ["Open in browser"](https://www.jetbrains.com/help/idea/editing-html-files.html#ws_html_preview_output_procedure)
571572
* feature of IntelliJ IDEA will automatically reload the file content when it's updated.
572-
* @return DataFrameHtmlData with table script and css definitions
573+
*
574+
* By default, cell content is formatted as text
575+
* Use [RenderedContent.media] or [IMG], [IFRAME] if you need custom HTML inside a cell.
576+
*
577+
* __NOTE:__ In Kotlin Notebook, output [DataFrame] directly, or use [toHtml],
578+
* as that environment already has CSS- and script definitions for DataFrame.
579+
* Using [toStandaloneHtml] might produce unexpected results.
580+
*
581+
* @param [configuration] The [DisplayConfiguration] to use. Default: [DisplayConfiguration.DEFAULT].
582+
* @param [cellRenderer] Mostly for internal usage, use [DefaultCellRenderer] if unsure.
583+
* @param [getFooter] Allows you to specify how to render the footer text beneath the dataframe.
584+
* Default: `"DataFrame [rows x cols]"`
585+
* @see toHtml
573586
*/
574587
public fun <T> DataFrame<T>.toStandaloneHtml(
575588
configuration: DisplayConfiguration = DisplayConfiguration.DEFAULT,
@@ -578,13 +591,23 @@ public fun <T> DataFrame<T>.toStandaloneHtml(
578591
): DataFrameHtmlData = toHtml(configuration, cellRenderer, getFooter).withTableDefinitions()
579592

580593
/**
581-
* By default, cell content is formatted as text
582-
* Use [RenderedContent.media] or [IMG], [IFRAME] if you need custom HTML inside a cell.
594+
* Returns a [DataFrameHtmlData] without additional definitions.
595+
* Can be rendered in Jupyter kernel (Kotlin Notebook) environments or other environments that already have
596+
* CSS- and script definitions for DataFrame.
583597
*
584598
* To change the formatting of certain cells or columns in the dataframe,
585599
* use [DataFrame.format].
586600
*
587-
* @return DataFrameHtmlData without additional definitions. Can be rendered in Jupyter kernel environments
601+
* Use [toStandaloneHtml] if you need the [DataFrameHtmlData] to include CSS- and script definitions.
602+
*
603+
* By default, cell content is formatted as text
604+
* Use [RenderedContent.media] or [IMG], [IFRAME] if you need custom HTML inside a cell.
605+
*
606+
* @param [configuration] The [DisplayConfiguration] to use. Default: [DisplayConfiguration.DEFAULT].
607+
* @param [cellRenderer] Mostly for internal usage, use [DefaultCellRenderer] if unsure.
608+
* @param [getFooter] Allows you to specify how to render the footer text beneath the dataframe.
609+
* Default: `"DataFrame [rows x cols]"`
610+
* @see toStandaloneHtml
588611
*/
589612
public fun <T> DataFrame<T>.toHtml(
590613
configuration: DisplayConfiguration = DisplayConfiguration.DEFAULT,

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ internal const val TO_URL_REPLACE = "toUrl()"
113113
internal const val FILTER_BY = "This function is deprecated in favor of `filter { }`. $MESSAGE_1_0"
114114
internal const val FILTER_BY_REPLACE = "filter { column }"
115115

116+
internal const val FORMATTING_DSL = "Replaced by `FormattingDsl`. $MESSAGE_1_0"
117+
internal const val FORMATTING_DSL_REPLACE = "FormattingDsl"
118+
119+
internal const val RGB_COLOR = "Replaced by `RgbColor`. $MESSAGE_1_0"
120+
internal const val RGB_COLOR_REPLACE = "RgbColor"
121+
116122
// endregion
117123

118124
// region WARNING in 1.0, ERROR in 1.1

0 commit comments

Comments
 (0)