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,
|
enableSearch: true,
|
||||||
dropdownHeight: "156px",
|
dropdownHeight: "156px",
|
||||||
controlType: "DROP_DOWN",
|
controlType: "DROP_DOWN",
|
||||||
|
customJSControl: "TABLE_COMPUTE_VALUE",
|
||||||
searchPlaceholderText: "Search by code or name",
|
searchPlaceholderText: "Search by code or name",
|
||||||
options: CurrencyDropdownOptions,
|
options: CurrencyDropdownOptions,
|
||||||
virtual: true,
|
virtual: true,
|
||||||
|
|
@ -402,11 +403,16 @@ export default {
|
||||||
isBindProperty: true,
|
isBindProperty: true,
|
||||||
isTriggerProperty: false,
|
isTriggerProperty: false,
|
||||||
validation: {
|
validation: {
|
||||||
type: ValidationTypes.TEXT,
|
type: ValidationTypes.ARRAY_OF_TYPE_OR_TYPE,
|
||||||
params: {
|
params: {
|
||||||
default: "USD",
|
type: ValidationTypes.TEXT,
|
||||||
required: true,
|
params: {
|
||||||
allowedValues: CurrencyDropdownOptions.map((option) => option.value),
|
default: "USD",
|
||||||
|
required: true,
|
||||||
|
allowedValues: CurrencyDropdownOptions.map(
|
||||||
|
(option) => option.value,
|
||||||
|
),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
hidden: (props: TableWidgetProps, propertyPath: string) => {
|
hidden: (props: TableWidgetProps, propertyPath: string) => {
|
||||||
|
|
@ -459,11 +465,17 @@ export default {
|
||||||
helpText: "formats the currency with a thousand separator",
|
helpText: "formats the currency with a thousand separator",
|
||||||
label: "Thousand separator",
|
label: "Thousand separator",
|
||||||
controlType: "SWITCH",
|
controlType: "SWITCH",
|
||||||
|
customJSControl: "TABLE_COMPUTE_VALUE",
|
||||||
dependencies: ["primaryColumns", "columnType"],
|
dependencies: ["primaryColumns", "columnType"],
|
||||||
isJSConvertible: true,
|
isJSConvertible: true,
|
||||||
isBindProperty: true,
|
isBindProperty: true,
|
||||||
isTriggerProperty: false,
|
isTriggerProperty: false,
|
||||||
validation: { type: ValidationTypes.BOOLEAN },
|
validation: {
|
||||||
|
type: ValidationTypes.ARRAY_OF_TYPE_OR_TYPE,
|
||||||
|
params: {
|
||||||
|
type: ValidationTypes.BOOLEAN,
|
||||||
|
},
|
||||||
|
},
|
||||||
hidden: (props: TableWidgetProps, propertyPath: string) => {
|
hidden: (props: TableWidgetProps, propertyPath: string) => {
|
||||||
const baseProperty = getBasePropertyPath(propertyPath);
|
const baseProperty = getBasePropertyPath(propertyPath);
|
||||||
const columnType = get(props, `${baseProperty}.columnType`, "");
|
const columnType = get(props, `${baseProperty}.columnType`, "");
|
||||||
|
|
@ -475,6 +487,7 @@ export default {
|
||||||
helpText: "Displays the currency in standard or compact notation",
|
helpText: "Displays the currency in standard or compact notation",
|
||||||
label: "Notation",
|
label: "Notation",
|
||||||
controlType: "DROP_DOWN",
|
controlType: "DROP_DOWN",
|
||||||
|
customJSControl: "TABLE_COMPUTE_VALUE",
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
label: "Standard",
|
label: "Standard",
|
||||||
|
|
@ -490,8 +503,14 @@ export default {
|
||||||
isBindProperty: true,
|
isBindProperty: true,
|
||||||
isTriggerProperty: false,
|
isTriggerProperty: false,
|
||||||
validation: {
|
validation: {
|
||||||
type: ValidationTypes.TEXT,
|
type: ValidationTypes.ARRAY_OF_TYPE_OR_TYPE,
|
||||||
params: { default: "standard", allowedValues: ["standard", "compact"] },
|
params: {
|
||||||
|
type: ValidationTypes.TEXT,
|
||||||
|
params: {
|
||||||
|
default: "standard",
|
||||||
|
allowedValues: ["standard", "compact"],
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
hidden: (props: TableWidgetProps, propertyPath: string) => {
|
hidden: (props: TableWidgetProps, propertyPath: string) => {
|
||||||
const baseProperty = getBasePropertyPath(propertyPath);
|
const baseProperty = getBasePropertyPath(propertyPath);
|
||||||
|
|
|
||||||
|
|
@ -518,8 +518,11 @@ export const getCellProperties = (
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
decimals: columnProperties.decimals,
|
decimals: columnProperties.decimals,
|
||||||
thousandSeparator: !!columnProperties.thousandSeparator,
|
thousandSeparator: getBooleanPropertyValue(
|
||||||
notation: columnProperties.notation,
|
columnProperties.thousandSeparator,
|
||||||
|
rowIndex,
|
||||||
|
),
|
||||||
|
notation: getPropertyValue(columnProperties.notation, rowIndex, true),
|
||||||
} as CellLayoutProperties;
|
} as CellLayoutProperties;
|
||||||
}
|
}
|
||||||
return {} as CellLayoutProperties;
|
return {} as CellLayoutProperties;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user