UNPKG

@adaptabletools/adaptable

Version:

Powerful AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

90 lines (89 loc) 4.91 kB
import { VersionUpgrade } from './VersionUpgrade'; import { AdaptableState } from '../AdaptableState/AdaptableState'; export declare class VersionUpgrade23 extends VersionUpgrade { migrateState(state: AdaptableState): AdaptableState; /** * Logs a one-line summary of each populated sub-collection on the legacy * `Schedule` slice so users can see exactly what they had before v23 removed * the slice. The actual key removal is done later by * `stripDeprecatedStateKeys` (in `normalizeAdaptableState`) so that the * friendly "Schedule was removed…" info line always fires whenever `Schedule` * is present — even when the slice is empty (e.g. someone left * `Schedule: {}` in their `initialState`) or when `autoMigrateState` is off. */ private migrateSchedulingState; /** * v22 Percent Bar stored cell-text overlay settings as flat * `CellText: CellTextOptions` + `CellTextPosition: 'Above' | 'Below' | 'Merged'` * keys on `PercentBarStyle`. v23 replaces them with the per-value * `CellTextProperties.CellTextLayout: { CellValue?, PercentValue? }`, where * each value carries its own `Horizontal` and `Vertical` placement. * * The flat keys are forwarded onto the new layout (`Horizontal: 'Left'`, * `Vertical` taken from `CellTextPosition`) and stripped from the parent * style. Range Bar and Bullet Chart never shipped cell-text overlays in * v22 so they need no migration here. */ private migratePercentBarCellText; /** * `RowScope` (which row kinds — data / group / summary / total — render * the style) was originally a Badge-only concept. It applies equally to * every Styled Column type, so we lift it to the top-level `StyledColumn` * object. The Badge-only wizard "Rows" step is replaced by a universal * "Scope" step that covers both column and row kinds. * * Migration: if `StyledColumn.BadgeStyle.RowScope` exists and the * top-level `StyledColumn.RowScope` is not already set, lift it up. * Then delete the nested copy so we only have one source of truth going * forward. */ /** * v22 Badge icon settings lived as four flat keys on * `BadgeStyleDefinition`: `Icon`, `IconPosition`, `IconOnly` (and the * v23 canary-only `IconGap`). v23 groups them under * `IconProperties: { Icon, Position, Gap, IconOnly }`. * * Migration: per badge, if any of the flat keys are present, build * `IconProperties` (renaming `IconPosition → Position` and `IconGap → Gap`, * leaving `IconOnly` as-is) and strip the flat keys from the parent. * `IconProperties.Icon` is required, so if the only flat fields set were * decoration flags (`IconPosition` / `IconOnly` / `IconGap`) without an * `Icon`, those flags are dropped (they had no effect anyway). */ private migrateBadgeIconProperties; private liftBadgeStyleRowScope; /** * `Name` was added as a mandatory property on `StyledColumn` (mirroring every * other named state object). Existing state has no `Name`, so we generate a * default of the form `${TypeLabel}-${ColumnId}` — e.g. `Badge-tradeId`, * `Sparkline-history`. Users can rename them later via the wizard. */ private patchStyledColumnName; private getStyledColumnTypeLabel; /** * `BadgeStyleDefinition.Style` was a full `AdaptableStyle` until v23. * v23 replaces it with the cut-down {@link BadgePillStyle}: * - `BackColor`, `ForeColor`, `BorderColor`, `FontWeight`, `FontStyle`, * `TextDecoration` map across as-is to `PillStyle`. * - `BorderRadius` is dropped: `Shape` (`Pill | Rounded | Square`) owns * pill shape now. If a definition had a `BorderRadius` but no `Shape`, * we infer one (`>= 12``Pill`, `0``Square`, else `Rounded`). * - `Alignment` is dropped from the pill (badge-row alignment is * column-level): when *any* pill in a column carried an `Alignment` * we lift it to `BadgeStyle.Font.Alignment` (first non-empty wins; * user can change later). Format Column alignment is therefore not * inherited for these columns post-migration, preserving the v22 * visual layout. * - `ClassName` and `FontSize` are dropped silently — they had no * reliable runtime effect on badges in v22. */ private migrateBadgeStyleToPillStyle; /** * Recognises the *legacy* diverging pattern — two ranges meeting at `0` * with `ReverseGradient: true` on the negative band — and rewrites it as a * single `ZeroCentred` declaration. Two-range gradients that just *happen* * to share a zero boundary (without `ReverseGradient`) are left alone, since * those are valid plain two-range gradients post-v23. */ private migrateStyledColumnGradientZeroCentred; }