fix: add customJS control for currency, notation and thousand separator (#33877)
Fixes #33858 /ok-to-test tags="@tag.Table"<!-- This is an auto-generated comment: Cypress test results --> > [!IMPORTANT] > 🟣 🟣 🟣 Your tests are running. > Tests running at: <https://github.com/appsmithorg/appsmith/actions/runs/9318008514> > Commit: 1ea0a6325c234a41c431c92329e3fa8e9d4fdf45 > Workflow: `PR Automation test suite` > Tags: `@tag.Table` <!-- end of auto-generated comment: Cypress test results --> --------- Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro-2.local>
This commit is contained in:
parent
d4645bd240
commit
eb0c13db79
|
|
@ -395,6 +395,7 @@ export default {
|
|||
enableSearch: true,
|
||||
dropdownHeight: "156px",
|
||||
controlType: "DROP_DOWN",
|
||||
customJSControl: "TABLE_COMPUTE_VALUE",
|
||||
searchPlaceholderText: "Search by code or name",
|
||||
options: CurrencyDropdownOptions,
|
||||
virtual: true,
|
||||
|
|
@ -402,11 +403,16 @@ export default {
|
|||
isBindProperty: true,
|
||||
isTriggerProperty: false,
|
||||
validation: {
|
||||
type: ValidationTypes.TEXT,
|
||||
type: ValidationTypes.ARRAY_OF_TYPE_OR_TYPE,
|
||||
params: {
|
||||
default: "USD",
|
||||
required: true,
|
||||
allowedValues: CurrencyDropdownOptions.map((option) => option.value),
|
||||
type: ValidationTypes.TEXT,
|
||||
params: {
|
||||
default: "USD",
|
||||
required: true,
|
||||
allowedValues: CurrencyDropdownOptions.map(
|
||||
(option) => option.value,
|
||||
),
|
||||
},
|
||||
},
|
||||
},
|
||||
hidden: (props: TableWidgetProps, propertyPath: string) => {
|
||||
|
|
@ -459,11 +465,17 @@ export default {
|
|||
helpText: "formats the currency with a thousand separator",
|
||||
label: "Thousand separator",
|
||||
controlType: "SWITCH",
|
||||
customJSControl: "TABLE_COMPUTE_VALUE",
|
||||
dependencies: ["primaryColumns", "columnType"],
|
||||
isJSConvertible: true,
|
||||
isBindProperty: true,
|
||||
isTriggerProperty: false,
|
||||
validation: { type: ValidationTypes.BOOLEAN },
|
||||
validation: {
|
||||
type: ValidationTypes.ARRAY_OF_TYPE_OR_TYPE,
|
||||
params: {
|
||||
type: ValidationTypes.BOOLEAN,
|
||||
},
|
||||
},
|
||||
hidden: (props: TableWidgetProps, propertyPath: string) => {
|
||||
const baseProperty = getBasePropertyPath(propertyPath);
|
||||
const columnType = get(props, `${baseProperty}.columnType`, "");
|
||||
|
|
@ -475,6 +487,7 @@ export default {
|
|||
helpText: "Displays the currency in standard or compact notation",
|
||||
label: "Notation",
|
||||
controlType: "DROP_DOWN",
|
||||
customJSControl: "TABLE_COMPUTE_VALUE",
|
||||
options: [
|
||||
{
|
||||
label: "Standard",
|
||||
|
|
@ -490,8 +503,14 @@ export default {
|
|||
isBindProperty: true,
|
||||
isTriggerProperty: false,
|
||||
validation: {
|
||||
type: ValidationTypes.TEXT,
|
||||
params: { default: "standard", allowedValues: ["standard", "compact"] },
|
||||
type: ValidationTypes.ARRAY_OF_TYPE_OR_TYPE,
|
||||
params: {
|
||||
type: ValidationTypes.TEXT,
|
||||
params: {
|
||||
default: "standard",
|
||||
allowedValues: ["standard", "compact"],
|
||||
},
|
||||
},
|
||||
},
|
||||
hidden: (props: TableWidgetProps, propertyPath: string) => {
|
||||
const baseProperty = getBasePropertyPath(propertyPath);
|
||||
|
|
|
|||
|
|
@ -518,8 +518,11 @@ export const getCellProperties = (
|
|||
true,
|
||||
),
|
||||
decimals: columnProperties.decimals,
|
||||
thousandSeparator: !!columnProperties.thousandSeparator,
|
||||
notation: columnProperties.notation,
|
||||
thousandSeparator: getBooleanPropertyValue(
|
||||
columnProperties.thousandSeparator,
|
||||
rowIndex,
|
||||
),
|
||||
notation: getPropertyValue(columnProperties.notation, rowIndex, true),
|
||||
} as CellLayoutProperties;
|
||||
}
|
||||
return {} as CellLayoutProperties;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user