TypeHandler.js 387 B

123456789101112131415161718
  1. import Library from 'trapilib/dist/lib';
  2. import Editors from './index.js';
  3. let Types = Library.DataTypes.Types;
  4. export default function(Type) {
  5. switch(Type.type) {
  6. case Types.Text:
  7. if(Type.isColor)
  8. return Editors.ColorEditor;
  9. return Editors.TextEditor;
  10. case Types.Number:
  11. case Types.Integer:
  12. return Editors.Numbers;
  13. default:
  14. return Editors.TextEditor;
  15. }
  16. }