1 | /**
|
2 | * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3 | * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4 | */
|
5 | /**
|
6 | * @module table/utils/table-properties
|
7 | */
|
8 | import type { BoxSides } from 'ckeditor5/src/engine';
|
9 | /**
|
10 | * Returns a string if all four values of box sides are equal.
|
11 | *
|
12 | * If a string is passed, it is treated as a single value (pass-through).
|
13 | *
|
14 | * ```ts
|
15 | * // Returns 'foo':
|
16 | * getSingleValue( { top: 'foo', right: 'foo', bottom: 'foo', left: 'foo' } );
|
17 | * getSingleValue( 'foo' );
|
18 | *
|
19 | * // Returns undefined:
|
20 | * getSingleValue( { top: 'foo', right: 'foo', bottom: 'bar', left: 'foo' } );
|
21 | * getSingleValue( { top: 'foo', right: 'foo' } );
|
22 | * ```
|
23 | */
|
24 | export declare function getSingleValue(objectOrString: BoxSides | string | undefined): string | undefined;
|
25 | /**
|
26 | * Adds a unit to a value if the value is a number or a string representing a number.
|
27 | *
|
28 | * **Note**: It does nothing to non-numeric values.
|
29 | *
|
30 | * ```ts
|
31 | * getSingleValue( 25, 'px' ); // '25px'
|
32 | * getSingleValue( 25, 'em' ); // '25em'
|
33 | * getSingleValue( '25em', 'px' ); // '25em'
|
34 | * getSingleValue( 'foo', 'px' ); // 'foo'
|
35 | * ```
|
36 | *
|
37 | * @param defaultUnit A default unit added to a numeric value.
|
38 | */
|
39 | export declare function addDefaultUnitToNumericValue(value: string | number | undefined, defaultUnit: string): string | number | undefined;
|
40 | export interface NormalizedDefaultProperties {
|
41 | borderStyle: string;
|
42 | borderWidth: string;
|
43 | borderColor: string;
|
44 | backgroundColor: string;
|
45 | width: string;
|
46 | height: string;
|
47 | alignment?: string;
|
48 | padding?: string;
|
49 | verticalAlignment?: string;
|
50 | horizontalAlignment?: string;
|
51 | }
|
52 | /**
|
53 | * Returns the normalized configuration.
|
54 | *
|
55 | * @param options.includeAlignmentProperty Whether the "alignment" property should be added.
|
56 | * @param options.includePaddingProperty Whether the "padding" property should be added.
|
57 | * @param options.includeVerticalAlignmentProperty Whether the "verticalAlignment" property should be added.
|
58 | * @param options.includeHorizontalAlignmentProperty Whether the "horizontalAlignment" property should be added.
|
59 | * @param options.isRightToLeftContent Whether the content is right-to-left.
|
60 | */
|
61 | export declare function getNormalizedDefaultProperties(config: Partial<NormalizedDefaultProperties> | undefined, options?: {
|
62 | includeAlignmentProperty?: boolean;
|
63 | includePaddingProperty?: boolean;
|
64 | includeVerticalAlignmentProperty?: boolean;
|
65 | includeHorizontalAlignmentProperty?: boolean;
|
66 | isRightToLeftContent?: boolean;
|
67 | }): NormalizedDefaultProperties;
|