@progress/kendo-angular-inputs
Version:
Kendo UI for Angular Inputs Package - Everything you need to build professional form functionality (Checkbox, ColorGradient, ColorPalette, ColorPicker, FlatColorPicker, FormField, MaskedTextBox, NumericTextBox, RadioButton, RangeSlider, Slider, Switch, Te
40 lines (39 loc) • 2 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Injectable } from "@angular/core";
import { DEFAULT_ACCESSIBLE_PRESET, DEFAULT_PRESET } from "../constants";
import { PALETTEPRESETS } from "../models";
import * as i0 from "@angular/core";
/**
* @hidden
*/
export class FlatColorPickerService {
getPaletteSettings(settings, format) {
const defaultPreset = (format !== 'name') ? DEFAULT_PRESET : DEFAULT_ACCESSIBLE_PRESET;
const settingsPalette = settings.palette;
const presetColumns = typeof settingsPalette === 'string' && PALETTEPRESETS[settingsPalette] ?
PALETTEPRESETS[settingsPalette].columns :
undefined;
return {
palette: settingsPalette || defaultPreset,
tileSize: settings.tileSize,
columns: settings.columns || presetColumns || 10
};
}
paletteTileLayout(tileSize) {
if (typeof tileSize === 'number') {
return { width: tileSize, height: tileSize };
}
return {
width: tileSize?.width ? tileSize?.width : tileSize?.height,
height: tileSize?.height ? tileSize?.height : tileSize?.width
};
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FlatColorPickerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FlatColorPickerService });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FlatColorPickerService, decorators: [{
type: Injectable
}] });