TypeHandler.js 595 B

1234567891011121314151617181920212223242526
  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.ArrayEditor;
  8. case Types.Text:
  9. if(Type.isColor)
  10. return Editors.ColorEditor;
  11. return Editors.TextEditor;
  12. case Types.Number:
  13. case Types.Integer:
  14. return Editors.Numbers;
  15. case Types.Boolean:
  16. return Editors.BoolEditor;
  17. case Types.Action:
  18. return Editors.ActionEditor;
  19. case Types.Module:
  20. return Editors.ModuleEditor;
  21. default:
  22. return Editors.TextEditor;
  23. }
  24. }