Browse Source

feat(nocodb-sdk): add numericUITypes

pull/4969/head
Wing-Kam Wong 2 years ago
parent
commit
6693b1a8d7
  1. 7
      packages/nocodb-sdk/src/index.ts
  2. 22
      packages/nocodb-sdk/src/lib/UITypes.ts

7
packages/nocodb-sdk/src/index.ts

@ -7,7 +7,12 @@ export * from './lib/globals';
export * from './lib/helperFunctions'; export * from './lib/helperFunctions';
export * from './lib/enums'; export * from './lib/enums';
export * from './lib/formulaHelpers'; export * from './lib/formulaHelpers';
export { default as UITypes, isNumericCol, isVirtualCol } from './lib/UITypes'; export {
default as UITypes,
numericUITypes,
isNumericCol,
isVirtualCol,
} from './lib/UITypes';
export { default as CustomAPI } from './lib/CustomAPI'; export { default as CustomAPI } from './lib/CustomAPI';
export { default as TemplateGenerator } from './lib/TemplateGenerator'; export { default as TemplateGenerator } from './lib/TemplateGenerator';
export * from './lib/passwordHelpers'; export * from './lib/passwordHelpers';

22
packages/nocodb-sdk/src/lib/UITypes.ts

@ -39,14 +39,7 @@ enum UITypes {
Button = 'Button', Button = 'Button',
} }
export function isNumericCol( export const numericUITypes = [
col:
| UITypes
| { readonly uidt: UITypes | string }
| ColumnReqType
| ColumnType
) {
return [
UITypes.Duration, UITypes.Duration,
UITypes.Currency, UITypes.Currency,
UITypes.Percent, UITypes.Percent,
@ -54,7 +47,18 @@ export function isNumericCol(
UITypes.Decimal, UITypes.Decimal,
UITypes.Rating, UITypes.Rating,
UITypes.Rollup, UITypes.Rollup,
].includes(<UITypes>(typeof col === 'object' ? col?.uidt : col)); ];
export function isNumericCol(
col:
| UITypes
| { readonly uidt: UITypes | string }
| ColumnReqType
| ColumnType
) {
return numericUITypes.includes(
<UITypes>(typeof col === 'object' ? col?.uidt : col)
);
} }
export function isVirtualCol( export function isVirtualCol(

Loading…
Cancel
Save