Automatically remove the min_columns property.
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
// TODO: automatic remove of min_columns
|
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
import {
|
import {
|
||||||
CSSResultGroup,
|
CSSResultGroup,
|
||||||
|
|||||||
@@ -174,6 +174,12 @@ const createRangedTransform = function (
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a value from 'XXpx' to XX (as a number).
|
||||||
|
* @param value Incoming value.
|
||||||
|
* @returns A number, null if the property should be deleted or undefined if it
|
||||||
|
* should be ignored.
|
||||||
|
*/
|
||||||
const toPixelsOrDelete = function (value: unknown): number | null | undefined {
|
const toPixelsOrDelete = function (value: unknown): number | null | undefined {
|
||||||
// Ignore the value if it's a number.
|
// Ignore the value if it's a number.
|
||||||
if (typeof value === 'number') {
|
if (typeof value === 'number') {
|
||||||
@@ -189,6 +195,16 @@ const toPixelsOrDelete = function (value: unknown): number | null | undefined {
|
|||||||
return isNaN(value as number) ? null : Number(value);
|
return isNaN(value as number) ? null : Number(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request a property be deleted.
|
||||||
|
* @param _value Inbound value (not required).
|
||||||
|
* @returns `null` to request the property be deleted.
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
const deleteProperty = function (_value: unknown): number | null | undefined {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move a property from one location to another.
|
* Move a property from one location to another.
|
||||||
* @param obj The configuration object in which the property resides.
|
* @param obj The configuration object in which the property resides.
|
||||||
@@ -445,4 +461,8 @@ const UPGRADES = [
|
|||||||
CONF_MENU_BUTTON_SIZE,
|
CONF_MENU_BUTTON_SIZE,
|
||||||
createRangedTransform(toPixelsOrDelete, BUTTON_SIZE_MIN),
|
createRangedTransform(toPixelsOrDelete, BUTTON_SIZE_MIN),
|
||||||
),
|
),
|
||||||
|
upgradeWithOverrides(
|
||||||
|
'event_gallery.min_columns',
|
||||||
|
deleteProperty
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user