TypeHandler.js 405 B

12345678910111213141516171819
  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.Bool:
  12. case Types.Integer:
  13. return Editors.Numbers;
  14. default:
  15. return Editors.TextEditor;
  16. }
  17. }