@progress/kendo-angular-spreadsheet
Version:
A Spreadsheet Component for Angular
36 lines (35 loc) • 1.16 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 { isPresent } from "@progress/kendo-angular-common";
/**
* @hidden
*/
export function outerWidth(element) {
let width = element.offsetWidth;
const style = getComputedStyle(element);
width += parseFloat(style.marginLeft) || 0 + parseFloat(style.marginRight) || 0;
return width;
}
/**
* @hidden
*/
export const rangeValidator = (directive) => {
return (control) => {
const err = {
rangeError: {
message: 'Incorrect range format',
value: control.value
}
};
let range;
try {
range = directive.spreadsheetService.spreadsheet.activeSheet().range(control.value);
}
catch (e) { /** noop */ }
if (!isPresent(range)) {
return err;
}
};
};