Namespace

utils

utils

all utils functions.

View Source index.tsx, line 59

Members

# static emotion

Create an instance of emotion in order to avoid conflict if emotion is used within the host app.

View Source utils/style/emotion.ts, line 3

# static constant exports.defaultStyle

The default style for the style rules being customizable. customStyle prop will be merged into it before storing this in the state.

View Source utils/style/defaultStyle.ts, line 7

Methods

# static exports.columnsMinWidthCalc(headings, data, ref, style) → {array}

Calculate the min-width for each column (heading + data). Uses the Canvas API to measure the length of the text of each cell and return the max for each column Takes into account of the font style, cell inter text length and the sorting image of column headers.
Parameters:
Name Type Description
headings array the headings array.
data array the data array.
ref HTMLElement the ref to the pluggin html element, to recover font size and font family.
style object the style state from the store.

View Source utils/processing/columnsMinWidthCalc/columnsMinWidthCalc.ts, line 16

- minwidth value for each column (in px) in the same sequence as the headings array.
array

# static exports.convertLengthUnit(length) → {number}

take a length to analyze value and unit and then return the value converted in pixel if needed. Support px and rem input, return the unconverted value + a warn for other units.
Parameters:
Name Type Description
length string | number the length as a string as it is set in customStyle prop or returned by getComputedStyle().

View Source utils/processing/convertLengthUnit/convertLengthUnit.ts, line 10

- the value converted into pixel length.
number

# static exports.formatDisplayedData(input, format) → {string}

Format an input with the given format. If format is a function, returns the result of the funciton with input as parameter. If format is a string (keyword), returns a a formated input according to the scheme. Default case returns the unformated data.
Parameters:
Name Type Description
input string | number | boolean the input to format.
format string | function the format to apply.

View Source utils/processing/formatDisplayedData/formatDisplayedData.ts, line 13

- the formated input as a string.
string

# static exports.getCellInterTextLength(style) → {number}

Sum the padding left + right + vertical border of the cell to return the length between txt of 2 adjacent cells.
Parameters:
Name Type Description
style object the style state of the store.

View Source utils/processing/getCellInterTextLength/getCellInterTextLength.ts, line 10

the lentgh between the text of 2 adjacent cells .
number

# static exports.getTableBorderWidth(style) → {number}

Calculate the total width of border of the table (body, head and cell) to take into account in the width of table.
Parameters:
Name Type Description
style object the style state of the store.

View Source utils/processing/getTableBorderWidth/getTableBorderWidth.ts, line 10

the sum of the widths of the table borders .
number

# static exports.renderWithStore(ui, contextValues, renderOptions) → {React.ReactElement}

Gives a provider fortesting of each needing the access to the store
Parameters:
Name Type Description
ui React.ReactElement | array the component(s) to test
contextValues object the values of the states used by the component and needed for test
renderOptions object option oject to pass to the render method

View Source utils/test/renderWithStore.tsx, line 14

- the result of the render method with the ui being wrapped by the provider
React.ReactElement

# static exports.resolveCellFontStyle(ref, style) → {object}

take the style and root html node style to resolve the font style of the cell (converting inherit or undefined into actual style).
Parameters:
Name Type Description
ref HTMLElement the root html node.
style object the style state of the store.

View Source utils/processing/resolveCellFontStyle/resolveCellFontStyle.ts, line 10

- the head and body font style object with keys fontFamily, fontSize and fontWeight.
object