Report plugin - Input filter transformations

Working on a custom report for a customer, I needed to add two OptionTypes in the plugin provider to capture some data to be used in the report filter (start and end date). They were text fields. I expected that users would key in full dates in both fields i.e no helpers/pickers.

I set values of startDate and endDate in the fieldName property and compiled and uploaded the report while testing.

I was surprised that in the report filter modal, a date in US format was presented in both fields and further, that clicking presented a date picker.

It occurred to me that the Morpheus UI is transforming my fields via CSS/JavaScript based on my naming.

By changing only the fieldName properties to startMonth and endMonth, the UI then presented a monthPicker .

This is the configuration of one of the OptionTypes in the report provider (which presents a month picker):

    // end date
    OptionType endDate = new OptionType(
        code: 'end-date',
        name: 'EndDate',
        fieldName: 'endMonth',
        fieldContext: 'config',
        fieldLabel: 'End date',
        displayOrder: 1,
        inputType: OptionType.InputType.TEXT

Note there is nothing in the inputType property which would suggest it would present as anything other than a HTML text input.

Tagged as experimental, but I thought was really cool and worth sharing. I don’t know yet how any transformations in the UI will be presented and so parsed in the report provider I’m working on, or whether there is chance of collisions given the control naming.