Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// however if you pass the "decimalPlaces", it will validate with that maximum
model: Editors.float,
minValue: 0,
maxValue: 365,
// the default validation error message is in English but you can override it by using "errorMessage"
// errorMessage: this.i18n.tr('INVALID_FLOAT', { maxDecimal: 2 }),
params: { decimalPlaces: 2 },
},
*/
minWidth: 100
}, {
id: 'complete',
name: '% Complete',
field: 'percentComplete',
filterable: true,
formatter: Formatters.multiple,
type: FieldType.number,
editor: {
// We can also add HTML text to be rendered (any bad script will be sanitized) but we have to opt-in, else it will be sanitized
enableRenderHtml: true,
collection: Array.from(Array(101).keys()).map(k => ({ value: k, label: k, symbol: '<i style="color:cadetblue" class="fa fa-percent"></i>' })),
customStructure: {
value: 'value',
label: 'label',
labelSuffix: 'symbol'
},
collectionSortBy: {
property: 'label',
sortDesc: true
},
collectionFilterBy: {
property: 'value',
{
id: 'usDateShort', name: 'US Date Short', field: 'usDateShort', sortable: true, minWidth: 70, width: 70,
type: FieldType.dateUsShort, filterable: true, filter: { model: Filters.compoundDate }
},
{
id: 'utcDate', name: 'UTC Date', field: 'utcDate', formatter: Formatters.dateTimeIsoAmPm, sortable: true, minWidth: 115,
type: FieldType.dateUtc, outputType: FieldType.dateTimeIsoAmPm, filterable: true, filter: { model: Filters.compoundDate }
},
{
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven.isEffort', minWidth: 85, maxWidth: 95,
type: FieldType.boolean,
sortable: true,
// to pass multiple formatters, use the params property
// also these formatters are executed in sequence, so if you want the checkmark to work correctly, it has to be the last formatter defined
formatter: Formatters.multiple,
params: { formatters: [Formatters.complexObject, Formatters.checkmark] },
// when the "field" string includes the dot "." notation, the library will consider this to be a complex object and Filter accordingly
filterable: true,
filter: {
// We can also add HTML text to be rendered (any bad script will be sanitized) but we have to opt-in, else it will be sanitized
// enableRenderHtml: true,
// collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: `<i class="fa fa-check"></i> ` }, { value: false, label: 'False' }],
collection: [{ isEffort: '', label: '' }, { isEffort: true, label: 'True' }, { isEffort: false, label: 'False' }],
customStructure: {
value: 'isEffort',
label: 'label'
},
model: Filters.singleSelect,
model: Filters.compoundDate,
// override any of the Flatpickr options through "filterOptions"
// please note that there's no TSlint on this property since it's generic for any filter, so make sure you entered the correct filter option(s)
filterOptions: {
minDate: 'today'
}
}
},
{
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven.isEffort', minWidth: 85, maxWidth: 95,
type: FieldType.boolean,
sortable: true,
// to pass multiple formatters, use the params property
// also these formatters are executed in sequence, so if you want the checkmark to work correctly, it has to be the last formatter defined
formatter: Formatters.multiple,
params: { formatters: [Formatters.complexObject, Formatters.checkmark] },
// when the "field" string includes the dot "." notation, the library will consider this to be a complex object and Filter accordingly
filterable: true,
filter: {
// We can also add HTML text to be rendered (any bad script will be sanitized) but we have to opt-in, else it will be sanitized
// enableRenderHtml: true,
// collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: `<i class="fa fa-check"></i> ` }, { value: false, label: 'False' }],
collection: [{ isEffort: '', label: '' }, { isEffort: true, label: 'True' }, { isEffort: false, label: 'False' }],
customStructure: {
value: 'isEffort',
label: 'label'
},
model: Filters.singleSelect,
// default is 0 decimals, if no decimals is passed it will accept 0 or more decimals
// however if you pass the "decimalPlaces", it will validate with that maximum
model: Editors.float,
minValue: 0,
maxValue: 365,
// the default validation error message is in English but you can override it by using "errorMessage"
// errorMessage: this.i18n.tr('INVALID_FLOAT', { maxDecimal: 2 }),
params: { decimalPlaces: 2 },
},
*/
}, {
id: 'complete',
name: '% Complete',
field: 'percentComplete',
filterable: true,
formatter: Formatters.multiple,
type: FieldType.number,
editor: {
// We can also add HTML text to be rendered (any bad script will be sanitized) but we have to opt-in, else it will be sanitized
enableRenderHtml: true,
collection: Array.from(Array(101).keys()).map(k => ({ value: k, label: k, symbol: '<i style="color:cadetblue" class="fa fa-percent"></i>' })),
customStructure: {
value: 'value',
label: 'label',
labelSuffix: 'symbol'
},
collectionSortBy: {
property: 'label',
sortDesc: true
},
collectionFilterBy: {
property: 'value',
model: Filters.multipleSelect,
collection: [{ value: 'acme', label: 'Acme' }, { value: 'abc', label: 'Company ABC' }, { value: 'xyz', label: 'Company XYZ' }],
filterOptions: {
filter: true // adds a filter on top of the multi-select dropdown
}
}
},
{ id: 'billing.address.street', field: 'billing.address.street', headerKey: 'BILLING.ADDRESS.STREET', width: 60, filterable: true, sortable: true },
{
id: 'billing.address.zip', field: 'billing.address.zip', headerKey: 'BILLING.ADDRESS.ZIP', width: 60,
type: FieldType.number,
filterable: true, sortable: true,
filter: {
model: Filters.compoundInput
},
formatter: Formatters.multiple, params: { formatters: [Formatters.complexObject, Formatters.translate] }
},
];
this.gridOptions = {
enableAutoResize: false,
enableFiltering: true,
enableCellNavigation: true,
enableCheckboxSelector: true,
enableRowSelection: true,
enableTranslate: true,
i18n: this.i18n,
gridMenu: {
resizeOnShowHeaderRow: true,
},
pagination: {
pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],
sortable: true,
filterable: true,
filter: {
model: Filters.multipleSelect,
collection: [{ value: 'acme', label: 'Acme' }, { value: 'abc', label: 'Company ABC' }, { value: 'xyz', label: 'Company XYZ' }]
}
},
{ id: 'billing.address.street', field: 'billing.address.street', headerKey: 'BILLING.ADDRESS.STREET', width: 60, filterable: true, sortable: true },
{
id: 'billing.address.zip', field: 'billing.address.zip', headerKey: 'BILLING.ADDRESS.ZIP', width: 60,
type: FieldType.number,
filterable: true, sortable: true,
filter: {
model: Filters.compoundInput
},
formatter: Formatters.multiple, params: { formatters: [Formatters.complexObject, Formatters.translate] }
}
];
this.gridOptions = {
enableAutoResize: false,
enableFiltering: true,
enableCellNavigation: true,
enableCheckboxSelector: true,
enableRowSelection: true,
enableTranslate: true,
i18n: this.i18n,
gridMenu: {
resizeOnShowHeaderRow: true
},
pagination: {
pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],