From: Alan Knowles Date: Tue, 3 Nov 2020 10:09:40 +0000 (+0800) Subject: Fix #6464 - card header X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=4806a3a6a72a6fc861a138965a6b1b5df60d0c87 Fix #6464 - card header --- diff --git a/Roo/bootstrap/Card.js b/Roo/bootstrap/Card.js index b5560ffaa0..2cf1c9eb9e 100644 --- a/Roo/bootstrap/Card.js +++ b/Roo/bootstrap/Card.js @@ -12,7 +12,7 @@ * * possible... may not be implemented.. * @cfg {String} header_image src url of image. - * @cfg {String} header + * @cfg {String|Object} header * @cfg {Number} header_size (0|1|2|3|4|5) H1 or H2 etc.. 0 indicates default * * @cfg {String} title @@ -181,14 +181,24 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { cls : 'card-header', html : this.header // escape? }); - } + } else { + cfg.cn.push({ + tag : 'div', + cls : 'card-header d-none' + }); + } if (this.header_image.length) { cfg.cn.push({ tag : 'img', cls : 'card-img-top', src: this.header_image // escape? }); - } + } else { + cfg.cn.push({ + tag : 'div', + cls : 'card-img-top d-none' + }); + } var body = { tag : 'div', @@ -238,6 +248,26 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { }, + getCardHeader : function() + { + var ret = this.el.select('.card-header',true).first(); + if (ret.hasClass('d-none')) { + ret.removeClass('d-none'); + } + + return ret; + }, + + getCardImageTop : function() + { + var ret = this.el.select('.card-img-top',true).first(); + if (ret.hasClass('d-none')) { + ret.removeClass('d-none'); + } + + return ret; + }, + getChildContainer : function() { diff --git a/Roo/bootstrap/CardHeader.js b/Roo/bootstrap/CardHeader.js new file mode 100644 index 0000000000..a0b8725220 --- /dev/null +++ b/Roo/bootstrap/CardHeader.js @@ -0,0 +1,34 @@ +/* + * - LGPL + * + * Card header - holder for the card header elements. + * + */ + +/** + * @class Roo.bootstrap.CardHeader + * @extends Roo.bootstrap.Element + * Bootstrap CardHeader class + * @constructor + * Create a new Card Header - that you can embed children into + * @param {Object} config The config object + */ + +Roo.bootstrap.CardHeader = function(config){ + Roo.bootstrap.CardHeader.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.CardHeader, Roo.bootstrap.Element, { + + + container_method : 'getCardHeader' + + + + + +}); + + + + \ No newline at end of file diff --git a/Roo/bootstrap/CardImageTop.js b/Roo/bootstrap/CardImageTop.js new file mode 100644 index 0000000000..0bb3fb49e1 --- /dev/null +++ b/Roo/bootstrap/CardImageTop.js @@ -0,0 +1,33 @@ +/* + * - LGPL + * + * Card header - holder for the card header elements. + * + */ + +/** + * @class Roo.bootstrap.CardImageTop + * @extends Roo.bootstrap.Element + * Bootstrap CardImageTop class + * @constructor + * Create a new Card Image Top container + * @param {Object} config The config object + */ + +Roo.bootstrap.CardImageTop = function(config){ + Roo.bootstrap.CardImageTop.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.CardImageTop, Roo.bootstrap.Element, { + + + container_method : 'getCardImageTop' + + + + +}); + + + + \ No newline at end of file diff --git a/buildSDK/dependancy_bootstrap.txt b/buildSDK/dependancy_bootstrap.txt index 02247132b8..7abb321310 100644 --- a/buildSDK/dependancy_bootstrap.txt +++ b/buildSDK/dependancy_bootstrap.txt @@ -2,6 +2,7 @@ Roo.bootstrap.version Roo.bootstrap.Component +Roo.bootstrap.Element Roo.bootstrap.Body Roo.bootstrap.ButtonGroup @@ -9,6 +10,8 @@ Roo.bootstrap.Button Roo.bootstrap.Column Roo.bootstrap.Container Roo.bootstrap.Card +Roo.bootstrap.CardHeader +Roo.bootstrap.CardImageTop Roo.bootstrap.Img Roo.bootstrap.Link @@ -33,7 +36,7 @@ Roo.bootstrap.NavSidebarItem Roo.bootstrap.Row -Roo.bootstrap.Element + Roo.bootstrap.Pagination Roo.bootstrap.PaginationItem Roo.bootstrap.Slider diff --git a/css-bootstrap4/bootstrap.css.map b/css-bootstrap4/bootstrap.css.map index 45d59fdb1d..bb4e9b7bc2 100644 --- a/css-bootstrap4/bootstrap.css.map +++ b/css-bootstrap4/bootstrap.css.map @@ -2,7 +2,7 @@ "version": 3, "file": "bootstrap.css", "sources": [ - "../../../../../tmp/scssPAfOu3", + "../../../../../tmp/scssWfRzkD", "../scss/bootstrap/_functions.scss", "../scss/bootstrap/_variables.scss", "../scss/bootstrap/bootstrap.scss", diff --git a/css-bootstrap4/roojs-bootstrap-debug.css.map b/css-bootstrap4/roojs-bootstrap-debug.css.map index 2b86c314e3..d3d07d0d45 100644 --- a/css-bootstrap4/roojs-bootstrap-debug.css.map +++ b/css-bootstrap4/roojs-bootstrap-debug.css.map @@ -2,7 +2,7 @@ "version": 3, "file": "roojs-bootstrap-debug.css", "sources": [ - "../../../../../tmp/scssUvBu83", + "../../../../../tmp/scssrewIJB", "../scss/bootstrap/_functions.scss", "../scss/bootstrap/_variables.scss", "../scss/roojs-bootstrap/roojs-bootstrap.scss", diff --git a/docs/json/roodata.json b/docs/json/roodata.json index cdf2c0fef7..c1c972fb8d 100644 --- a/docs/json/roodata.json +++ b/docs/json/roodata.json @@ -19429,7 +19429,7 @@ }, { "name" : "header", - "type" : "String", + "type" : "String|Object", "desc" : "", "memberOf" : "" }, @@ -20039,6 +20039,870 @@ } ] }, + "Roo.bootstrap.CardHeader" : { + "props" : [ + { + "name" : "actionMode", + "type" : "String", + "desc" : "which property holds the element that used for hide() / show() / disable() / enable()\ndefault is 'el' for forms you probably want to set this to fieldEl", + "memberOf" : "Roo.Component" + }, + { + "name" : "allowDomMove", + "type" : "Boolean", + "desc" : "Whether the component can move the Dom node when rendering (defaults to true).", + "memberOf" : "Roo.Component" + }, + { + "name" : "can_build_overlaid", + "type" : "Boolean", + "desc" : "True if element can be rebuild from a HTML page", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "clickable", + "type" : "Boolean", + "desc" : "e) default false", + "memberOf" : "Roo.bootstrap.Element", + "optvals" : [ + "true", + "false" + ] + }, + { + "name" : "cls", + "type" : "String", + "desc" : "class of the element", + "memberOf" : "Roo.bootstrap.Element" + }, + { + "name" : "container_method", + "type" : "string", + "desc" : "method to fetch parents container element (used by NavHeaderbar - getHeaderChildContainer)", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "dataId", + "type" : "string", + "desc" : "cutomer id", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "disableClass", + "type" : "String", + "desc" : "CSS class added to the component when it is disabled (defaults to \"x-item-disabled\").", + "memberOf" : "Roo.Component" + }, + { + "name" : "hideMode", + "type" : "String", + "desc" : "y)\nHow this component should hidden. Supported values are\n\"visibility\" (css visibility), \"offsets\" (negative offset position) and\n\"display\" (css display) - defaults to \"display\".", + "memberOf" : "Roo.Component", + "optvals" : [ + "display", + "visibility" + ] + }, + { + "name" : "html", + "type" : "String", + "desc" : "contents of the element", + "memberOf" : "Roo.bootstrap.Element" + }, + { + "name" : "listeners", + "type" : "Object", + "desc" : "list of events and functions to call for this object, \nFor example :\n
\n    listeners :  { \n       'click' : function(e) {\n           ..... \n        } ,\n        .... \n    } \n  
", + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "name", + "type" : "string", + "desc" : "Specifies name attribute", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "preventDefault", + "type" : "Boolean", + "desc" : "e) default false", + "memberOf" : "Roo.bootstrap.Element", + "optvals" : [ + "true", + "false" + ] + }, + { + "name" : "style", + "type" : "String", + "desc" : "any extra css", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "tag", + "type" : "String", + "desc" : "tag of the element", + "memberOf" : "Roo.bootstrap.Element" + }, + { + "name" : "tooltip", + "type" : "string", + "desc" : "Text for the tooltip", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "visibilityEl", + "type" : "string|object", + "desc" : "t) What element to use for visibility (@see getVisibilityEl())", + "memberOf" : "Roo.bootstrap.Component", + "optvals" : [ + "el", + "parent" + ] + }, + { + "name" : "xattr", + "type" : "Object", + "desc" : "extra attributes to add to 'element' (used by builder to store stuff.)", + "memberOf" : "Roo.bootstrap.Component" + } + ], + "events" : [ + { + "name" : "beforedestroy", + "type" : "function", + "desc" : "Fires before the component is destroyed. Return false to stop the destroy.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "beforehide", + "type" : "function", + "desc" : "Fires before the component is hidden. Return false to stop the hide.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "beforerender", + "type" : "function", + "desc" : "Fires before the component is rendered. Return false to stop the render.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "beforeshow", + "type" : "function", + "desc" : "Fires before the component is shown. Return false to stop the show.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "childrenrendered", + "type" : "function", + "desc" : "Fires when the children have been rendered..", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "click", + "type" : "function", + "desc" : "When a element is chick", + "sig" : "function (_self, e)\n{\n\n}", + "memberOf" : "Roo.bootstrap.Element" + }, + { + "name" : "destroy", + "type" : "function", + "desc" : "Fires after the component is destroyed.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "disable", + "type" : "function", + "desc" : "Fires after the component is disabled.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "enable", + "type" : "function", + "desc" : "Fires after the component is enabled.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "hide", + "type" : "function", + "desc" : "Fires after the component is hidden.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "render", + "type" : "function", + "desc" : "Fires after the component is rendered.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "show", + "type" : "function", + "desc" : "Fires after the component is shown.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + } + ], + "methods" : [ + { + "name" : "addEvents", + "type" : "function", + "desc" : "Used to define events on this Observable", + "sig" : "(object)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "addListener", + "type" : "function", + "desc" : "Appends an event handler to this component", + "sig" : "(eventName, handler, scope, options)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "capture", + "type" : "function", + "desc" : "Starts capture on the specified Observable. All events will be passed\nto the supplied function with the event name + standard signature of the event\nbefore the event is fired. If the supplied function returns false,\nthe event will not fire.", + "sig" : "(o, fn, scope)", + "static" : true, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "destroy", + "type" : "function", + "desc" : "Destroys this component by purging any event listeners, removing the component's element from the DOM,\nremoving the component from its {@link Roo.Container} (if applicable) and unregistering it from {@link Roo.ComponentMgr}.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "disable", + "type" : "function", + "desc" : "Disable this component.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "enable", + "type" : "function", + "desc" : "Enable this component.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "fireEvent", + "type" : "function", + "desc" : "Fires the specified event with the passed parameters (minus the event name).", + "sig" : "(eventName, args)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "focus", + "type" : "function", + "desc" : "Try to focus this component.", + "sig" : "(selectText)", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "getChildContainer", + "type" : "function", + "desc" : "Fetch the element to add children to", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "getEl", + "type" : "function", + "desc" : "Returns the underlying {@link Roo.Element}.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "getId", + "type" : "function", + "desc" : "Returns the id of this component.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "getVisibilityEl", + "type" : "function", + "desc" : "Get the element that will be used to show or hide", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "hasListener", + "type" : "function", + "desc" : "Checks to see if this object has any listeners for a specified event", + "sig" : "(eventName)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "hide", + "type" : "function", + "desc" : "Hide a component - adds 'hidden' class", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "initEvents", + "type" : "function", + "desc" : "Initialize Events for the element", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "isVisible", + "type" : "function", + "desc" : "Returns true if this component is visible.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "on", + "type" : "function", + "desc" : "Appends an event handler to this element (shorthand for addListener)", + "sig" : "(eventName, handler, scope, options)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "purgeListeners", + "type" : "function", + "desc" : "Removes all listeners for this object", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "releaseCapture", + "type" : "function", + "desc" : "Removes all added captures from the Observable.", + "sig" : "(o)", + "static" : true, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "removeListener", + "type" : "function", + "desc" : "Removes a listener", + "sig" : "(eventName, handler, scope)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "render", + "type" : "function", + "desc" : "If this is a lazy rendering component, render it to its container element.", + "sig" : "(container)", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "setDisabled", + "type" : "function", + "desc" : "Convenience function for setting disabled/enabled by boolean.", + "sig" : "(disabled)", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "setVisibilityEl", + "type" : "function", + "desc" : "Set the element that will be used to show or hide", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "setVisible", + "type" : "function", + "desc" : "Convenience function to hide or show this component by boolean.", + "sig" : "(visible)", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "show", + "type" : "function", + "desc" : "Show a component - removes 'hidden' class", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "tooltipEl", + "type" : "function", + "desc" : "Fetch the element to display the tooltip on.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "un", + "type" : "function", + "desc" : "Removes a listener (shorthand for removeListener)", + "sig" : "(eventName, handler, scope)", + "static" : false, + "memberOf" : "Roo.util.Observable" + } + ] + }, + "Roo.bootstrap.CardImageTop" : { + "props" : [ + { + "name" : "actionMode", + "type" : "String", + "desc" : "which property holds the element that used for hide() / show() / disable() / enable()\ndefault is 'el' for forms you probably want to set this to fieldEl", + "memberOf" : "Roo.Component" + }, + { + "name" : "allowDomMove", + "type" : "Boolean", + "desc" : "Whether the component can move the Dom node when rendering (defaults to true).", + "memberOf" : "Roo.Component" + }, + { + "name" : "can_build_overlaid", + "type" : "Boolean", + "desc" : "True if element can be rebuild from a HTML page", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "clickable", + "type" : "Boolean", + "desc" : "e) default false", + "memberOf" : "Roo.bootstrap.Element", + "optvals" : [ + "true", + "false" + ] + }, + { + "name" : "cls", + "type" : "String", + "desc" : "class of the element", + "memberOf" : "Roo.bootstrap.Element" + }, + { + "name" : "container_method", + "type" : "string", + "desc" : "method to fetch parents container element (used by NavHeaderbar - getHeaderChildContainer)", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "dataId", + "type" : "string", + "desc" : "cutomer id", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "disableClass", + "type" : "String", + "desc" : "CSS class added to the component when it is disabled (defaults to \"x-item-disabled\").", + "memberOf" : "Roo.Component" + }, + { + "name" : "hideMode", + "type" : "String", + "desc" : "y)\nHow this component should hidden. Supported values are\n\"visibility\" (css visibility), \"offsets\" (negative offset position) and\n\"display\" (css display) - defaults to \"display\".", + "memberOf" : "Roo.Component", + "optvals" : [ + "display", + "visibility" + ] + }, + { + "name" : "html", + "type" : "String", + "desc" : "contents of the element", + "memberOf" : "Roo.bootstrap.Element" + }, + { + "name" : "listeners", + "type" : "Object", + "desc" : "list of events and functions to call for this object, \nFor example :\n
\n    listeners :  { \n       'click' : function(e) {\n           ..... \n        } ,\n        .... \n    } \n  
", + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "name", + "type" : "string", + "desc" : "Specifies name attribute", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "preventDefault", + "type" : "Boolean", + "desc" : "e) default false", + "memberOf" : "Roo.bootstrap.Element", + "optvals" : [ + "true", + "false" + ] + }, + { + "name" : "style", + "type" : "String", + "desc" : "any extra css", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "tag", + "type" : "String", + "desc" : "tag of the element", + "memberOf" : "Roo.bootstrap.Element" + }, + { + "name" : "tooltip", + "type" : "string", + "desc" : "Text for the tooltip", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "visibilityEl", + "type" : "string|object", + "desc" : "t) What element to use for visibility (@see getVisibilityEl())", + "memberOf" : "Roo.bootstrap.Component", + "optvals" : [ + "el", + "parent" + ] + }, + { + "name" : "xattr", + "type" : "Object", + "desc" : "extra attributes to add to 'element' (used by builder to store stuff.)", + "memberOf" : "Roo.bootstrap.Component" + } + ], + "events" : [ + { + "name" : "beforedestroy", + "type" : "function", + "desc" : "Fires before the component is destroyed. Return false to stop the destroy.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "beforehide", + "type" : "function", + "desc" : "Fires before the component is hidden. Return false to stop the hide.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "beforerender", + "type" : "function", + "desc" : "Fires before the component is rendered. Return false to stop the render.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "beforeshow", + "type" : "function", + "desc" : "Fires before the component is shown. Return false to stop the show.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "childrenrendered", + "type" : "function", + "desc" : "Fires when the children have been rendered..", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "click", + "type" : "function", + "desc" : "When a element is chick", + "sig" : "function (_self, e)\n{\n\n}", + "memberOf" : "Roo.bootstrap.Element" + }, + { + "name" : "destroy", + "type" : "function", + "desc" : "Fires after the component is destroyed.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "disable", + "type" : "function", + "desc" : "Fires after the component is disabled.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "enable", + "type" : "function", + "desc" : "Fires after the component is enabled.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "hide", + "type" : "function", + "desc" : "Fires after the component is hidden.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "render", + "type" : "function", + "desc" : "Fires after the component is rendered.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + }, + { + "name" : "show", + "type" : "function", + "desc" : "Fires after the component is shown.", + "sig" : "function (_self)\n{\n\n}", + "memberOf" : "Roo.Component" + } + ], + "methods" : [ + { + "name" : "addEvents", + "type" : "function", + "desc" : "Used to define events on this Observable", + "sig" : "(object)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "addListener", + "type" : "function", + "desc" : "Appends an event handler to this component", + "sig" : "(eventName, handler, scope, options)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "capture", + "type" : "function", + "desc" : "Starts capture on the specified Observable. All events will be passed\nto the supplied function with the event name + standard signature of the event\nbefore the event is fired. If the supplied function returns false,\nthe event will not fire.", + "sig" : "(o, fn, scope)", + "static" : true, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "destroy", + "type" : "function", + "desc" : "Destroys this component by purging any event listeners, removing the component's element from the DOM,\nremoving the component from its {@link Roo.Container} (if applicable) and unregistering it from {@link Roo.ComponentMgr}.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "disable", + "type" : "function", + "desc" : "Disable this component.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "enable", + "type" : "function", + "desc" : "Enable this component.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "fireEvent", + "type" : "function", + "desc" : "Fires the specified event with the passed parameters (minus the event name).", + "sig" : "(eventName, args)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "focus", + "type" : "function", + "desc" : "Try to focus this component.", + "sig" : "(selectText)", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "getChildContainer", + "type" : "function", + "desc" : "Fetch the element to add children to", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "getEl", + "type" : "function", + "desc" : "Returns the underlying {@link Roo.Element}.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "getId", + "type" : "function", + "desc" : "Returns the id of this component.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "getVisibilityEl", + "type" : "function", + "desc" : "Get the element that will be used to show or hide", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "hasListener", + "type" : "function", + "desc" : "Checks to see if this object has any listeners for a specified event", + "sig" : "(eventName)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "hide", + "type" : "function", + "desc" : "Hide a component - adds 'hidden' class", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "initEvents", + "type" : "function", + "desc" : "Initialize Events for the element", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "isVisible", + "type" : "function", + "desc" : "Returns true if this component is visible.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "on", + "type" : "function", + "desc" : "Appends an event handler to this element (shorthand for addListener)", + "sig" : "(eventName, handler, scope, options)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "purgeListeners", + "type" : "function", + "desc" : "Removes all listeners for this object", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "releaseCapture", + "type" : "function", + "desc" : "Removes all added captures from the Observable.", + "sig" : "(o)", + "static" : true, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "removeListener", + "type" : "function", + "desc" : "Removes a listener", + "sig" : "(eventName, handler, scope)", + "static" : false, + "memberOf" : "Roo.util.Observable" + }, + { + "name" : "render", + "type" : "function", + "desc" : "If this is a lazy rendering component, render it to its container element.", + "sig" : "(container)", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "setDisabled", + "type" : "function", + "desc" : "Convenience function for setting disabled/enabled by boolean.", + "sig" : "(disabled)", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "setVisibilityEl", + "type" : "function", + "desc" : "Set the element that will be used to show or hide", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "setVisible", + "type" : "function", + "desc" : "Convenience function to hide or show this component by boolean.", + "sig" : "(visible)", + "static" : false, + "memberOf" : "Roo.Component" + }, + { + "name" : "show", + "type" : "function", + "desc" : "Show a component - removes 'hidden' class", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "tooltipEl", + "type" : "function", + "desc" : "Fetch the element to display the tooltip on.", + "sig" : "()\n{\n\n}", + "static" : false, + "memberOf" : "Roo.bootstrap.Component" + }, + { + "name" : "un", + "type" : "function", + "desc" : "Removes a listener (shorthand for removeListener)", + "sig" : "(eventName, handler, scope)", + "static" : false, + "memberOf" : "Roo.util.Observable" + } + ] + }, "Roo.bootstrap.CheckBox" : { "props" : [ { diff --git a/docs/src/Roo_bootstrap_Card.js.html b/docs/src/Roo_bootstrap_Card.js.html index efba7d8f05..f0b093efbf 100644 --- a/docs/src/Roo_bootstrap_Card.js.html +++ b/docs/src/Roo_bootstrap_Card.js.html @@ -12,7 +12,7 @@ * * possible... may not be implemented.. * @cfg {String} header_image src url of image. - * @cfg {String} header + * @cfg {String|Object} header * @cfg {Number} header_size (0|1|2|3|4|5) H1 or H2 etc.. 0 indicates default * * @cfg {String} title @@ -181,14 +181,24 @@ cls : 'card-header', html : this.header // escape? }); - } + } else { + cfg.cn.push({ + tag : 'div', + cls : 'card-header d-none' + }); + } if (this.header_image.length) { cfg.cn.push({ tag : 'img', cls : 'card-img-top', src: this.header_image // escape? }); - } + } else { + cfg.cn.push({ + tag : 'div', + cls : 'card-img-top d-none' + }); + } var body = { tag : 'div', @@ -238,6 +248,26 @@ }, + getCardHeader : function() + { + var ret = this.el.select('.card-header',true).first(); + if (ret.hasClass('d-none')) { + ret.removeClass('d-none'); + } + + return ret; + }, + + getCardImageTop : function() + { + var ret = this.el.select('.card-img-top',true).first(); + if (ret.hasClass('d-none')) { + ret.removeClass('d-none'); + } + + return ret; + }, + getChildContainer : function() { diff --git a/docs/src/Roo_bootstrap_Table_AbstractSelectionModel.js.html b/docs/src/Roo_bootstrap_Table_AbstractSelectionModel.js.html index f961c0757d..59b08b36ca 100644 --- a/docs/src/Roo_bootstrap_Table_AbstractSelectionModel.js.html +++ b/docs/src/Roo_bootstrap_Table_AbstractSelectionModel.js.html @@ -39,5 +39,11 @@ */ isLocked : function(){ return this.locked; + }, + + + initEvents : function () + { + } }); \ No newline at end of file diff --git a/docs/symbols/Roo.bootstrap.Card.json b/docs/symbols/Roo.bootstrap.Card.json index 20f8925eb5..8695b20d17 100644 --- a/docs/symbols/Roo.bootstrap.Card.json +++ b/docs/symbols/Roo.bootstrap.Card.json @@ -72,7 +72,7 @@ }, { "name" : "header", - "type" : "String", + "type" : "String|Object", "desc" : "", "memberOf" : "Roo.bootstrap.Card", "optvals" : [] diff --git a/docs/tree.json b/docs/tree.json index 311bea68b2..4fce9b8646 100644 --- a/docs/tree.json +++ b/docs/tree.json @@ -405,6 +405,16 @@ "cn" : [], "is_class" : true }, + { + "name" : "Roo.bootstrap.CardHeader", + "cn" : [], + "is_class" : true + }, + { + "name" : "Roo.bootstrap.CardImageTop", + "cn" : [], + "is_class" : true + }, { "name" : "Roo.bootstrap.CheckBox", "cn" : [], diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 961210f1fd..83849e1738 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -435,6 +435,95 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent, { } }); + /* + * - LGPL + * + * element + * + */ + +/** + * @class Roo.bootstrap.Element + * @extends Roo.bootstrap.Component + * Bootstrap Element class + * @cfg {String} html contents of the element + * @cfg {String} tag tag of the element + * @cfg {String} cls class of the element + * @cfg {Boolean} preventDefault (true|false) default false + * @cfg {Boolean} clickable (true|false) default false + * + * @constructor + * Create a new Element + * @param {Object} config The config object + */ + +Roo.bootstrap.Element = function(config){ + Roo.bootstrap.Element.superclass.constructor.call(this, config); + + this.addEvents({ + // raw events + /** + * @event click + * When a element is chick + * @param {Roo.bootstrap.Element} this + * @param {Roo.EventObject} e + */ + "click" : true + }); +}; + +Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component, { + + tag: 'div', + cls: '', + html: '', + preventDefault: false, + clickable: false, + + getAutoCreate : function(){ + + var cfg = { + tag: this.tag, + // cls: this.cls, double assign in parent class Component.js :: onRender + html: this.html + }; + + return cfg; + }, + + initEvents: function() + { + Roo.bootstrap.Element.superclass.initEvents.call(this); + + if(this.clickable){ + this.el.on('click', this.onClick, this); + } + + }, + + onClick : function(e) + { + if(this.preventDefault){ + e.preventDefault(); + } + + this.fireEvent('click', this, e); + }, + + getValue : function() + { + return this.el.dom.innerHTML; + }, + + setValue : function(value) + { + this.el.dom.innerHTML = value; + } + +}); + + + /* * - LGPL * @@ -1508,7 +1597,7 @@ Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component, { * * possible... may not be implemented.. * @cfg {String} header_image src url of image. - * @cfg {String} header + * @cfg {String|Object} header * @cfg {Number} header_size (0|1|2|3|4|5) H1 or H2 etc.. 0 indicates default * * @cfg {String} title @@ -1677,14 +1766,24 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { cls : 'card-header', html : this.header // escape? }); - } + } else { + cfg.cn.push({ + tag : 'div', + cls : 'card-header d-none' + }); + } if (this.header_image.length) { cfg.cn.push({ tag : 'img', cls : 'card-img-top', src: this.header_image // escape? }); - } + } else { + cfg.cn.push({ + tag : 'div', + cls : 'card-img-top d-none' + }); + } var body = { tag : 'div', @@ -1734,6 +1833,26 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { }, + getCardHeader : function() + { + var ret = this.el.select('.card-header',true).first(); + if (ret.hasClass('d-none')) { + ret.removeClass('d-none'); + } + + return ret; + }, + + getCardImageTop : function() + { + var ret = this.el.select('.card-img-top',true).first(); + if (ret.hasClass('d-none')) { + ret.removeClass('d-none'); + } + + return ret; + }, + getChildContainer : function() { @@ -1781,6 +1900,71 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { }); /* + * - LGPL + * + * Card header - holder for the card header elements. + * + */ + +/** + * @class Roo.bootstrap.CardHeader + * @extends Roo.bootstrap.Element + * Bootstrap CardHeader class + * @constructor + * Create a new Card Header - that you can embed children into + * @param {Object} config The config object + */ + +Roo.bootstrap.CardHeader = function(config){ + Roo.bootstrap.CardHeader.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.CardHeader, Roo.bootstrap.Element, { + + + container_method : 'getCardHeader' + + + + + +}); + + + + /* + * - LGPL + * + * Card header - holder for the card header elements. + * + */ + +/** + * @class Roo.bootstrap.CardImageTop + * @extends Roo.bootstrap.Element + * Bootstrap CardImageTop class + * @constructor + * Create a new Card Image Top container + * @param {Object} config The config object + */ + +Roo.bootstrap.CardImageTop = function(config){ + Roo.bootstrap.CardImageTop.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.CardImageTop, Roo.bootstrap.Element, { + + + container_method : 'getCardImageTop' + + + + +}); + + + + /* * - LGPL * * image @@ -5577,95 +5761,6 @@ Roo.extend(Roo.bootstrap.Row, Roo.bootstrap.Component, { - /* - * - LGPL - * - * element - * - */ - -/** - * @class Roo.bootstrap.Element - * @extends Roo.bootstrap.Component - * Bootstrap Element class - * @cfg {String} html contents of the element - * @cfg {String} tag tag of the element - * @cfg {String} cls class of the element - * @cfg {Boolean} preventDefault (true|false) default false - * @cfg {Boolean} clickable (true|false) default false - * - * @constructor - * Create a new Element - * @param {Object} config The config object - */ - -Roo.bootstrap.Element = function(config){ - Roo.bootstrap.Element.superclass.constructor.call(this, config); - - this.addEvents({ - // raw events - /** - * @event click - * When a element is chick - * @param {Roo.bootstrap.Element} this - * @param {Roo.EventObject} e - */ - "click" : true - }); -}; - -Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component, { - - tag: 'div', - cls: '', - html: '', - preventDefault: false, - clickable: false, - - getAutoCreate : function(){ - - var cfg = { - tag: this.tag, - // cls: this.cls, double assign in parent class Component.js :: onRender - html: this.html - }; - - return cfg; - }, - - initEvents: function() - { - Roo.bootstrap.Element.superclass.initEvents.call(this); - - if(this.clickable){ - this.el.on('click', this.onClick, this); - } - - }, - - onClick : function(e) - { - if(this.preventDefault){ - e.preventDefault(); - } - - this.fireEvent('click', this, e); - }, - - getValue : function() - { - return this.el.dom.innerHTML; - }, - - setValue : function(value) - { - this.el.dom.innerHTML = value; - } - -}); - - - /* * - LGPL * diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 9702660a0e..5c1822a757 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -15,6 +15,10 @@ Roo.debug&&Roo.log(cn);}}if(E&&D&&!cn.el&&cn.can_build_overlaid){Roo.debug&&Roo. return cn;}var I=A.items;delete A.items;if(!skip_children){for(var i=0;i0?'h'+this.header_size:'div',cls:'card-header',html:this.header} -);}if(this.header_image.length){A.cn.push({tag:'img',cls:'card-img-top',src:this.header_image});}var B={tag:'div',cls:'card-body',cn:[]};A.cn.push(B);if(this.title.length){B.cn.push({tag:'div',cls:'card-title',src:this.title});}if(this.subtitle.length){B.cn.push({tag:'div',cls:'card-title',src:this.subtitle} -);}B.cn.push({tag:'div',cls:'roo-card-body-ctr'});if(this.html.length){B.cn.push({tag:'div',html:this.html});}if(this.footer.length){A.cn.push({tag:'div',cls:'card-footer',html:this.footer});}return A;},getChildContainer:function(){if(!this.el){return false; -}return this.el.select('.roo-card-body-ctr',true).first();},initEvents:function(){if(this.dragable){this.dragZone=new Roo.dd.DragZone(this.getEl(),{containerScroll:true,ddGroup:this.drag_group||'default_card_drag_group'});this.dragZone.getDragData=this.getDragData.createDelegate(this); -}},getDragData:function(e){var A=this.getEl();if(A){var B={source:this,copy:false,nodes:this.getEl(),records:[]};B.ddel=A.dom;Roo.log(A.getWidth());B.ddel.style.width=A.getWidth()+'px';return B;}return false;}}); +);}else{A.cn.push({tag:'div',cls:'card-header d-none'});}if(this.header_image.length){A.cn.push({tag:'img',cls:'card-img-top',src:this.header_image});}else{A.cn.push({tag:'div',cls:'card-img-top d-none'});}var B={tag:'div',cls:'card-body',cn:[]};A.cn.push(B); +if(this.title.length){B.cn.push({tag:'div',cls:'card-title',src:this.title});}if(this.subtitle.length){B.cn.push({tag:'div',cls:'card-title',src:this.subtitle});}B.cn.push({tag:'div',cls:'roo-card-body-ctr'});if(this.html.length){B.cn.push({tag:'div',html:this.html} +);}if(this.footer.length){A.cn.push({tag:'div',cls:'card-footer',html:this.footer});}return A;},getCardHeader:function(){var A=this.el.select('.card-header',true).first();if(A.hasClass('d-none')){A.removeClass('d-none');}return A;},getCardImageTop:function(){var A=this.el.select('.card-img-top',true).first(); +if(A.hasClass('d-none')){A.removeClass('d-none');}return A;},getChildContainer:function(){if(!this.el){return false;}return this.el.select('.roo-card-body-ctr',true).first();},initEvents:function(){if(this.dragable){this.dragZone=new Roo.dd.DragZone(this.getEl(),{containerScroll:true,ddGroup:this.drag_group||'default_card_drag_group'} +);this.dragZone.getDragData=this.getDragData.createDelegate(this);}},getDragData:function(e){var A=this.getEl();if(A){var B={source:this,copy:false,nodes:this.getEl(),records:[]};B.ddel=A.dom;Roo.log(A.getWidth());B.ddel.style.width=A.getWidth()+'px';return B; +}return false;}}); +// Roo/bootstrap/CardHeader.js +Roo.bootstrap.CardHeader=function(A){Roo.bootstrap.CardHeader.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.CardHeader,Roo.bootstrap.Element,{container_method:'getCardHeader'}); +// Roo/bootstrap/CardImageTop.js +Roo.bootstrap.CardImageTop=function(A){Roo.bootstrap.CardImageTop.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.CardImageTop,Roo.bootstrap.Element,{container_method:'getCardImageTop'}); // Roo/bootstrap/Img.js Roo.bootstrap.Img=function(A){Roo.bootstrap.Img.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Img,Roo.bootstrap.Component,{imgResponsive:true,border:'',src:'about:blank',href:false,target:false,xsUrl:'',smUrl:'',mdUrl:'',lgUrl:'',getAutoCreate:function(){if(this.src||(!this.xsUrl&&!this.smUrl&&!this.mdUrl&&!this.lgUrl)){return this.createSingleImg(); }var A={tag:'div',cls:'roo-image-responsive-group',cn:[]};var B=this;Roo.each(['xs','sm','md','lg'],function(C){if(!B[C+'Url']){return;}var D={tag:'img',cls:(B.imgResponsive)?'img-responsive':'',html:B.html||A.html,src:B[C+'Url']};D.cls+=' roo-image-responsive-'+C; @@ -223,10 +233,6 @@ return;}this.el.removeClass('disabled');return;},setActive:function(A){if(this.a }this.badgeEl.dom.innerHTML=A;}}); // Roo/bootstrap/Row.js Roo.bootstrap.Row=function(A){Roo.bootstrap.Row.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Row,Roo.bootstrap.Component,{getAutoCreate:function(){return {cls:'row clearfix'};}}); -// Roo/bootstrap/Element.js -Roo.bootstrap.Element=function(A){Roo.bootstrap.Element.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Element,Roo.bootstrap.Component,{tag:'div',cls:'',html:'',preventDefault:false,clickable:false,getAutoCreate:function(){var A={tag:this.tag,html:this.html} -;return A;},initEvents:function(){Roo.bootstrap.Element.superclass.initEvents.call(this);if(this.clickable){this.el.on('click',this.onClick,this);}},onClick:function(e){if(this.preventDefault){e.preventDefault();}this.fireEvent('click',this,e);},getValue:function(){return this.el.dom.innerHTML; -},setValue:function(A){this.el.dom.innerHTML=A;}}); // Roo/bootstrap/Pagination.js Roo.bootstrap.Pagination=function(A){Roo.bootstrap.Pagination.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Pagination,Roo.bootstrap.Component,{cls:false,size:false,inverse:false,getAutoCreate:function(){var A={tag:'ul',cls:'pagination'};if(this.inverse){A.cls+=' inverse'; }if(this.html){A.html=this.html;}if(this.cls){A.cls+=" "+this.cls;}return A;}});