TypeHandler.js 455 B

123456789101112131415161718192021
  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.Array:
  7. return Editors.FormEditor;
  8. case Types.Text:
  9. if(Type.isColor)
  10. return Editors.ColorEditor;
  11. return Editors.TextEditor;
  12. case Types.Number:
  13. case Types.Bool:
  14. case Types.Integer:
  15. return Editors.Numbers;
  16. default:
  17. return Editors.TextEditor;
  18. }
  19. }