Browse Source

feat: add formulaTypes

pull/2090/head
Wing-Kam Wong 3 years ago
parent
commit
24e5e458dd
  1. 43
      packages/nc-gui/helpers/formulaList.js

43
packages/nc-gui/helpers/formulaList.js

@ -1,5 +1,14 @@
const formulaTypes = {
NUMERIC: "numberic",
STRING: "string",
DATE: "date",
LOGICAL: "logical",
COND_EXP: "conditional_expression"
}
const formulas = { const formulas = {
AVG: { AVG: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
min: 1 min: 1
@ -14,6 +23,7 @@ const formulas = {
] ]
}, },
ADD: { ADD: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
min: 1 min: 1
@ -28,6 +38,7 @@ const formulas = {
] ]
}, },
DATEADD: { DATEADD: {
type: formulaTypes.DATE,
validation: { validation: {
args: { args: {
rqd: 3 rqd: 3
@ -47,6 +58,7 @@ const formulas = {
] ]
}, },
AND: { AND: {
type: formulaTypes.COND_EXP,
validation: { validation: {
args: { args: {
min: 1 min: 1
@ -60,6 +72,7 @@ const formulas = {
] ]
}, },
OR: { OR: {
type: formulaTypes.COND_EXP,
validation: { validation: {
args: { args: {
min: 1 min: 1
@ -73,6 +86,7 @@ const formulas = {
] ]
}, },
CONCAT: { CONCAT: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
min: 1 min: 1
@ -86,6 +100,7 @@ const formulas = {
] ]
}, },
TRIM: { TRIM: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
rqd: 1 rqd: 1
@ -99,6 +114,7 @@ const formulas = {
] ]
}, },
UPPER: { UPPER: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
rqd: 1 rqd: 1
@ -112,6 +128,7 @@ const formulas = {
] ]
}, },
LOWER: { LOWER: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
rqd: 1 rqd: 1
@ -125,6 +142,7 @@ const formulas = {
] ]
}, },
LEN: { LEN: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
rqd: 1 rqd: 1
@ -138,6 +156,7 @@ const formulas = {
] ]
}, },
MIN: { MIN: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
min: 1 min: 1
@ -151,6 +170,7 @@ const formulas = {
] ]
}, },
MAX: { MAX: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
min: 1 min: 1
@ -164,6 +184,7 @@ const formulas = {
] ]
}, },
CEILING: { CEILING: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
rqd: 1 rqd: 1
@ -177,6 +198,7 @@ const formulas = {
] ]
}, },
FLOOR: { FLOOR: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
rqd: 1 rqd: 1
@ -190,6 +212,7 @@ const formulas = {
] ]
}, },
ROUND: { ROUND: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
rqd: 1 rqd: 1
@ -203,6 +226,7 @@ const formulas = {
] ]
}, },
MOD: { MOD: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
rqd: 2 rqd: 2
@ -216,6 +240,7 @@ const formulas = {
] ]
}, },
REPEAT: { REPEAT: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
rqd: 2 rqd: 2
@ -229,6 +254,7 @@ const formulas = {
] ]
}, },
LOG: { LOG: {
type: formulaTypes.NUMERIC,
validation: {}, validation: {},
description: 'Logarithm of input parameter to the base (default = e) specified', description: 'Logarithm of input parameter to the base (default = e) specified',
syntax: 'LOG([base], value)', syntax: 'LOG([base], value)',
@ -238,6 +264,7 @@ const formulas = {
] ]
}, },
EXP: { EXP: {
type: formulaTypes.NUMERIC,
validation: {}, validation: {},
description: 'Exponential value of input parameter (e ^ power)', description: 'Exponential value of input parameter (e ^ power)',
syntax: 'EXP(power)', syntax: 'EXP(power)',
@ -247,6 +274,7 @@ const formulas = {
] ]
}, },
POWER: { POWER: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
rqd: 2 rqd: 2
@ -260,6 +288,7 @@ const formulas = {
] ]
}, },
SQRT: { SQRT: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
rqd: 1 rqd: 1
@ -273,6 +302,7 @@ const formulas = {
] ]
}, },
ABS: { ABS: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
rqd: 1 rqd: 1
@ -285,6 +315,7 @@ const formulas = {
] ]
}, },
NOW: { NOW: {
type: formulaTypes.DATE,
validation: { validation: {
args: { args: {
rqd: 0 rqd: 0
@ -297,6 +328,7 @@ const formulas = {
] ]
}, },
REPLACE: { REPLACE: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
rqd: 3 rqd: 3
@ -310,6 +342,7 @@ const formulas = {
] ]
}, },
SEARCH: { SEARCH: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
rqd: 2 rqd: 2
@ -323,6 +356,7 @@ const formulas = {
] ]
}, },
INT: { INT: {
type: formulaTypes.NUMERIC,
validation: { validation: {
args: { args: {
rqd: 1 rqd: 1
@ -336,6 +370,7 @@ const formulas = {
] ]
}, },
RIGHT: { RIGHT: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
rqd: 2 rqd: 2
@ -349,6 +384,7 @@ const formulas = {
] ]
}, },
LEFT: { LEFT: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
rqd: 2 rqd: 2
@ -362,6 +398,7 @@ const formulas = {
] ]
}, },
SUBSTR: { SUBSTR: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
min: 2, min: 2,
@ -377,6 +414,7 @@ const formulas = {
] ]
}, },
MID: { MID: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
rqd: 3 rqd: 3
@ -390,6 +428,7 @@ const formulas = {
] ]
}, },
IF: { IF: {
type: formulaTypes.COND_EXP,
validation: { validation: {
args: { args: {
min: 2, min: 2,
@ -404,6 +443,7 @@ const formulas = {
] ]
}, },
SWITCH: { SWITCH: {
type: formulaTypes.COND_EXP,
validation: { validation: {
args: { args: {
min: 3 min: 3
@ -419,6 +459,7 @@ const formulas = {
] ]
}, },
URL: { URL: {
type: formulaTypes.STRING,
validation: { validation: {
args: { args: {
rqd: 1 rqd: 1
@ -434,4 +475,4 @@ const formulas = {
} }
export default Object.keys(formulas) export default Object.keys(formulas)
export { formulas } export { formulas, formulaTypes }

Loading…
Cancel
Save