Browse Source

feat(nocodb-sdk): add isNumericCol

pull/4969/head
Wing-Kam Wong 2 years ago
parent
commit
2e6f598871
  1. 2
      packages/nocodb-sdk/src/index.ts
  2. 18
      packages/nocodb-sdk/src/lib/UITypes.ts

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

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

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

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

Loading…
Cancel
Save