FieldSet.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * FieldSet.js
  3. *
  4. * Copyright, Moxiecode Systems AB
  5. * Released under LGPL License.
  6. *
  7. * License: http://www.tinymce.com/license
  8. * Contributing: http://www.tinymce.com/contributing
  9. */
  10. /**
  11. * This class creates fieldset containers.
  12. *
  13. * @-x-less FieldSet.less
  14. * @class tinymce.ui.FieldSet
  15. * @extends tinymce.ui.Form
  16. */
  17. define("tinymce/ui/FieldSet", [
  18. "tinymce/ui/Form"
  19. ], function(Form) {
  20. "use strict";
  21. return Form.extend({
  22. Defaults: {
  23. containerCls: 'fieldset',
  24. layout: 'flex',
  25. direction: 'column',
  26. align: 'stretch',
  27. flex: 1,
  28. padding: "25 15 5 15",
  29. labelGap: 30,
  30. spacing: 10,
  31. border: 1
  32. },
  33. /**
  34. * Renders the control as a HTML string.
  35. *
  36. * @method renderHtml
  37. * @return {String} HTML representing the control.
  38. */
  39. renderHtml: function() {
  40. var self = this, layout = self._layout, prefix = self.classPrefix;
  41. self.preRender();
  42. layout.preRender(self);
  43. return (
  44. '<fieldset id="' + self._id + '" class="' + self.classes() + '" hidefocus="1" tabindex="-1">' +
  45. (self.settings.title ? ('<legend id="' + self._id + '-title" class="' + prefix + 'fieldset-title">' +
  46. self.settings.title + '</legend>') : '') +
  47. '<div id="' + self._id + '-body" class="' + self.classes('body') + '">' +
  48. (self.settings.html || '') + layout.renderHtml(self) +
  49. '</div>' +
  50. '</fieldset>'
  51. );
  52. }
  53. });
  54. });