TypeHandler.js 541 B

123456789101112131415161718192021222324
  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.Integer:
  14. return Editors.Numbers;
  15. case Types.Boolean:
  16. return Editors.BoolEditor;
  17. case Types.Action:
  18. return Editors.ActionEditor;
  19. default:
  20. return Editors.TextEditor;
  21. }
  22. }