Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{ a: 111, b: 222, c: '333', d: '444', e: 555, f: 666, g: 777, h: 888 }
]}
columns={[
{ id: 'a', name: 'A', type: ColumnType.Any },
{ id: 'b', name: 'B', type: ColumnType.Any },
{ id: 'c', name: 'C', type: ColumnType.Text },
{ id: 'd', name: 'D', type: ColumnType.Text },
{ id: 'e', name: 'E', type: ColumnType.Numeric },
{ id: 'f', name: 'F', type: ColumnType.Numeric },
{ id: 'g', name: 'G' },
{ id: 'h', name: 'H' }
]}
style_data_conditional={[
{ if: { column_type: ColumnType.Any, row_index: 'even' }, background_color: 'blue', color: 'white' },
{ if: { column_type: ColumnType.Text, row_index: 'even' }, background_color: 'red', color: 'white' },
{ if: { column_type: ColumnType.Numeric, row_index: 'even' }, background_color: 'green', color: 'white' },
{ if: { column_type: ColumnType.Any }, background_color: 'blue' },
{ if: { column_type: ColumnType.Text }, background_color: 'red' },
{ if: { column_type: ColumnType.Numeric }, background_color: 'green' }
]}
/>))
.add('row padding', () => (
.add('green if table is not editable', () => ())
.add('first column is editable and blue', () => (
.add('with 1 column', () => ())
.add('row padding', () => (
.add('with 1 column', () => ())
.add('row padding', () => (
export const generateSpaceMockData = (rows: number) => unpackIntoColumnsAndData([
{
id: 'rows',
type: ColumnType.Numeric,
editable: false,
data: gendata(i => i, rows)
},
{
id: 'c cc',
name: ['City', 'Canada', 'Toronto'],
type: ColumnType.Numeric,
data: gendata(i => i, rows)
},
{
id: 'd:dd',
name: ['City', 'Canada', 'Montréal'],
type: ColumnType.Numeric,
data: gendata(i => i * 100, rows)
name: ['City', 'America', 'New York City'],
type: ColumnType.Numeric,
data: gendata(i => i, rows)
},
{
id: 'fff',
name: ['City', 'America', 'Boston'],
type: ColumnType.Numeric,
data: gendata(i => i + 1, rows)
},
{
id: 'ggg',
name: ['City', 'France', 'Paris'],
type: ColumnType.Numeric,
editable: true,
data: gendata(i => i * 10, rows)
},
{
id: 'bbb',
name: ['', 'Weather', 'Climate'],
type: ColumnType.Text,
presentation: 'dropdown',
data: gendata(
i => ['Humid', 'Wet', 'Snowy', 'Tropical Beaches'][i % 4],
rows
)
},
{
function getImplicitLexeme(type: ColumnType = ColumnType.Any): ILexemeResult {
switch (type) {
case ColumnType.Any:
case ColumnType.Text:
return {
lexeme: boundLexeme(contains),
value: RelationalOperator.Contains
};
case ColumnType.Datetime:
return {
lexeme: boundLexeme(dateStartsWith),
value: RelationalOperator.DateStartsWith
};
case ColumnType.Numeric:
return {
lexeme: boundLexeme(equal),
value: RelationalOperator.Equal
};
}
}
) => R.map(column => {
const c = R.clone(column);
c.editable = resolveFlag(editable, column.editable);
c.sort_as_null = c.sort_as_null || defaultSort;
if (c.type === ColumnType.Numeric && c.format) {
c.format.locale = getLocale(defaultLocale, c.format.locale);
c.format.nully = getNully(c.format.nully);
c.format.specifier = getSpecifier(c.format.specifier);
}
return c;
}, columns);
function getCoercer(c: Options): (value: any, c?: any) => IReconciliation {
switch (c.type) {
case ColumnType.Numeric:
return coerceNumber;
case ColumnType.Text:
return coerceText;
case ColumnType.Datetime:
return coerceDate;
case ColumnType.Any:
default:
return reconcileAny;
}
}