react-awesome-query-builder icon indicating copy to clipboard operation
react-awesome-query-builder copied to clipboard

Cant change the label of conjunction

Open augusto3691 opened this issue 2 years ago • 1 comments

Version: 5.1.2

I was trying to change the label of AND OR conjunction for better user experience in my language, but can't make this work, first i tryied:

conjunctions: {
            AND: {
                label: 'My label',
                formatConj: AntdConfig.conjunctions.AND.formatConj,
                sqlFormatConj: AntdConfig.conjunctions.AND.sqlFormatConj,
                spelFormatConj: AntdConfig.conjunctions.AND.spelFormatConj,
                mongoConj: AntdConfig.conjunctions.AND.mongoConj,
                jsonLogicConj: AntdConfig.conjunctions.AND.jsonLogicConj,
                sqlConj: AntdConfig.conjunctions.AND.sqlConj,
                spelConj: AntdConfig.conjunctions.AND.spelConj,
                spelConjs: AntdConfig.conjunctions.AND.spelConjs,
                reversedConj: AntdConfig.conjunctions.AND.reversedConj,
            },
        },

because im using AntConfig, them i tryied just that:

 conjunctions: {
            AND: {
                label: 'My label',
            },
        },

but typescript keep scream at me, even with:

conjunctions: {
            AND: {
                ...AntdConfig.conjunctions.AND,
                label: 'My label',
            },
        },

Can make this work, my complete config is:

metaDataQbConfig: {
        ...AntdConfig,
        fields: {
            age: {
                label: 'Idade',
                type: 'number',
                fieldSettings: {
                    min: 0,
                },
            },
            date: {
                label: 'Data',
                type: 'date',
            },
            profile_check: {
                label: 'Validação do CPF',
                type: 'boolean',
            },
        },
        settings: {
            ...AntdConfig.settings,
            showNot: false,
            canReorder: false,
            maxNesting: 2,
            valueLabel: 'Valor',
            addRuleLabel: 'Adicionar regra',
            addGroupLabel: 'Adicionar grupo',
            operatorPlaceholder: 'Selecione um operador',
            funcPlaceholder: 'Selecione uma função',
            fieldPlaceholder: 'Selecione um campo',
            operatorLabel: 'Operador',
            fieldLabel: 'Campo',
            forceShowConj: true,
        },
        conjunctions: {
            AND: {
                ...AntdConfig.conjunctions.AND,
                label: 'My label',
            },
        },
    }

But with this config i get this:

1

augusto3691 avatar Jul 28 '22 14:07 augusto3691

You need to add both "AND" and "OR" in conjunctions. Like this https://github.com/ukrbublik/react-awesome-query-builder/blob/master/CONFIG.adoc#configconjunctions

joaowicktor avatar Aug 09 '22 16:08 joaowicktor