openstack-uicore-foundation 4.0.9 → 4.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{"use strict";var e={418:(e,t,s)=>{s.d(t,{default:()=>a});var n=s(6689),o=s.n(n);const a=({children:e,className:t=""})=>o().createElement("span",{className:t,dangerouslySetInnerHTML:{__html:e.replace(/\n/g,"<br />")}})},8678:(e,t,s)=>{s.d(t,{default:()=>f});var n=s(6689),o=s.n(n),a=s(580),i=s.n(a);class r extends o().Component{constructor(e){super(e),this.handleSort=this.handleSort.bind(this)}getSortClass(){if(!this.props.sortable)return null;switch(this.props.sortDir){case 1:return"sorting_asc";case-1:return"sorting_desc";default:return this.props.sortable?"sorting":null}}handleSort(e){e.preventDefault(),this.props.hasOwnProperty("onSort")&&this.props.sortable&&this.props.onSort(this.props.columnIndex,this.props.columnKey,this.props.sortDir?-1*this.props.sortDir:1,this.props.sortFunc)}render(){return o().createElement("th",{onClick:this.handleSort,className:this.getSortClass(),width:this.props.width},this.props.children)}}r.propTypes={onSort:i().func,sortDir:i().number,columnIndex:i().number,columnKey:i().any,sortable:i().bool,sortFunc:i().func};const l=r;var c=s(418);const d=e=>{let{children:t}=e,s="";return t&&(s=o().isValidElement(t)?t:o().createElement(c.default,null,t.toString())),o().createElement("td",e,s)};class p extends o().Component{constructor(e){super(e),this.handleEdit=this.handleEdit.bind(this)}shouldDisplayAction(e){let{id:t}=this.props;return!e.hasOwnProperty("display")||e.display(t)}handleEdit(e,t){t.stopPropagation(),t.preventDefault(),this.props.actions.edit.onClick(e)}render(){let{even:e,actions:t,id:s,children:n}=this.props,a=e?"even":"odd";return t.hasOwnProperty("edit")&&this.shouldDisplayAction(t.edit)?o().createElement("tr",{role:"row",className:a+" can-edit",onClick:this.handleEdit.bind(this,s)},n):o().createElement("tr",{role:"row",className:a},n)}}class h extends o().Component{constructor(e){super(e),this.handleAction=this.handleAction.bind(this),this.shouldDisplayAction=this.shouldDisplayAction.bind(this)}shouldDisplayAction(e){let{id:t}=this.props;return!e.hasOwnProperty("display")||e.display(t)}handleAction(e,t,s){s.stopPropagation(),s.preventDefault(),e(t)}render(){let{actions:e,id:t}=this.props;return o().createElement("td",{className:"actions",key:"actions"},e.hasOwnProperty("delete")&&this.shouldDisplayAction(e.delete)&&o().createElement("a",{href:"","data-tip":"delete",onClick:this.handleAction.bind(this,e.delete.onClick,t)},o().createElement("i",{className:"fa fa-trash-o delete-icon"})),e.hasOwnProperty("custom")&&e.custom.map((e=>this.shouldDisplayAction(e)&&o().createElement("a",{href:"","data-tip":e.tooltip,key:"custom_"+e.name,onClick:this.handleAction.bind(this,e.onClick,t)},e.icon))))}}const u=require("react-tooltip");var m=s.n(u);const y={sortFunc:(e,t)=>e<t?-1:e>t?1:0,sortable:!1,sortCol:0,sortDir:1,colWidth:""},b=(e,t,s,n)=>e&&e===s||s===t?n:null,f=e=>{let{options:t,columns:s}=e,n=t.hasOwnProperty("className")?t.className:"";return n+=t.actions.hasOwnProperty("edit")?" table-hover":"",o().createElement("div",null,o().createElement("table",{className:"table table-striped dataTable "+n},o().createElement("thead",null,o().createElement("tr",null,s.map(((s,n)=>{let a=void 0!==t.sortCol?t.sortCol:y.sortCol,i=void 0!==t.sortDir?t.sortDir:y.sortDir,r=void 0!==t.sortFunc?t.sortFunc:y.sortFunc,c=void 0!==s.sortable?s.sortable:y.sortable,d=void 0!==s.width?s.width:y.colWidth;return o().createElement(l,{onSort:e.onSort,sortDir:b(s.columnKey,n,a,i),sortable:c,sortFunc:r,columnIndex:n,columnKey:s.columnKey,width:d,key:"heading_"+n},s.value)})),t.actions&&o().createElement(l,{key:"actions_heading"},t.actionsHeader||" "))),o().createElement("tbody",null,s.length>0&&e.data.map(((e,n)=>Array.isArray(e)&&e.length!==s.length?(console.warn(`Data at row ${n} is ${e.length}. It should be ${s.length}.`),o().createElement("tr",{key:"row_"+n})):o().createElement(p,{even:n%2==0,key:"row_"+n,id:e.id,actions:t.actions},((e,t,s)=>{var n=t.map(((t,s)=>t.hasOwnProperty("render")?o().createElement(d,{key:"cell_"+s},t.render(e,e[t.columnKey])):o().createElement(d,{key:"cell_"+s},e[t.columnKey])));return s&&n.push(o().createElement(h,{key:"actions_cell",id:e.id,actions:s})),n})(e,s,t.actions)))))),o().createElement(m(),{delayShow:10}))}},580:e=>{e.exports=require("prop-types")},6689:e=>{e.exports=require("react")}},t={};function s(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,s),a.exports}(()=>{s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t}})(),(()=>{s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(()=>{s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var n={};return(()=>{s.r(n),s.d(n,{default:()=>m});var e=s(6689),t=s.n(e),o=s(580),a=s.n(o);const i=require("react-select/lib/Async");var r=s.n(i),l=s(8678);const c=require("i18n-react/dist/i18n-react");var d=s.n(c);const p=require("react-select/lib/AsyncCreatable");var h=s.n(p);class u extends t().Component{constructor(e){super(e),this.state={value:""},this.handleChange=this.handleChange.bind(this),this.getOptions=this.getOptions.bind(this),this.handleLink=this.handleLink.bind(this),this.filterOption=this.filterOption.bind(this),this.handleNew=this.handleNew.bind(this),this.getNewOptionData=this.getNewOptionData.bind(this),this.isValidNewOption=this.isValidNewOption.bind(this)}getOptions(e,t){let{options:s}=this.props,n=s.hasOwnProperty("defaultOptions")?s.defaultOptions:void 0;if(!e&&!n)return Promise.resolve({options:[]});this.props.options.actions.search(e,t)}handleChange(e){this.setState({value:e})}handleLink(e){e.preventDefault(),this.props.options.actions.add.onClick(this.state.value),this.setState({value:""})}getNewOptionData(e,t){return{tag:t,id:e}}isValidNewOption(e,t,s){let{options:n}=this.props,o=n.hasOwnProperty("labelKey")?n.labelKey:"label",a=s.find((t=>t[o]==e));return!(!e||a)}handleNew(e){this.props.options.onCreateTag(e,this.handleChange)}filterOption(e,t){let{options:s,values:n}=this.props,o=this.props.hasOwnProperty("allowDuplicates"),a=s.hasOwnProperty("labelKey")?s.labelKey:"label";return!!o||!n.find((t=>t[a]===e.label))}render(){let{options:e,values:s,columns:n}=this.props,o=!this.state.value,a=e.hasOwnProperty("title")?e.title:"Table",i=e.hasOwnProperty("valueKey")?e.valueKey:"value",c=e.hasOwnProperty("labelKey")?e.labelKey:"label",p=e.hasOwnProperty("onCreateTag"),u=e.hasOwnProperty("defaultOptions")?e.defaultOptions:void 0,m={className:"dataTable",actions:{delete:e.actions.delete}};e.hasOwnProperty("className")&&(m.className=e.className),e.actions.hasOwnProperty("edit")&&(m.actions.edit=e.actions.edit),e.actions.hasOwnProperty("custom")&&(m.actions.custom=e.actions.custom),e.hasOwnProperty("sortCol")&&(s=s.sort(((t,s)=>{const n=isNaN(t[e.sortCol])?t[e.sortCol].toLowerCase():t[e.sortCol],o=isNaN(s[e.sortCol])?s[e.sortCol].toLowerCase():s[e.sortCol];return n>o?1:n<o?-1:0})));let y=null;return y=p?t().createElement(h(),{className:"link-select btn-group text-left",value:this.state.value,getOptionValue:e=>e[i],getOptionLabel:e=>e[c],onChange:this.handleChange,loadOptions:this.getOptions,filterOption:this.filterOption,onCreateOption:this.handleNew,getNewOptionData:this.getNewOptionData,isValidNewOption:this.isValidNewOption}):t().createElement(r(),{className:"link-select btn-group text-left",value:this.state.value,getOptionValue:e=>e[i],getOptionLabel:e=>e[c],onChange:this.handleChange,loadOptions:this.getOptions,filterOption:this.filterOption,defaultOptions:u}),t().createElement("div",{className:"row simple-link-list"},t().createElement("div",{className:"col-md-4 simple-link-list-title"},t().createElement("h4",null,a)),t().createElement("div",{className:"col-md pull-right btn-group"},y,t().createElement("button",{type:"button",className:"btn btn-default add-button",onClick:this.handleLink,disabled:o},d().translate("general.add"))),t().createElement("div",{className:"col-md-12"},t().createElement(l.default,{className:"dataTable",options:m,data:s,columns:n})))}}u.propTypes={values:a().array.isRequired,options:a().shape({title:a().string,sortCol:a().string,valueKey:a().string.isRequired,labelKey:a().string.isRequired,className:a().string,actions:a().shape({search:a().func.isRequired,delete:a().shape({onClick:a().func.isRequired}),add:a().shape({onClick:a().func.isRequired}),edit:a().shape({onClick:a().func.isRequired}),custom:a().array}).isRequired}).isRequired,columns:a().array.isRequired};const m=u})(),n})()}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{"use strict";var e={418:(e,t,s)=>{s.d(t,{default:()=>a});var n=s(6689),o=s.n(n);const a=({children:e,className:t=""})=>o().createElement("span",{className:t,dangerouslySetInnerHTML:{__html:e.replace(/\n/g,"<br />")}})},8678:(e,t,s)=>{s.d(t,{default:()=>O});var n=s(6689),o=s.n(n),a=s(580),i=s.n(a);class r extends o().Component{constructor(e){super(e),this.handleSort=this.handleSort.bind(this)}getSortClass(){if(!this.props.sortable)return null;switch(this.props.sortDir){case 1:return"sorting_asc";case-1:return"sorting_desc";default:return this.props.sortable?"sorting":null}}handleSort(e){e.preventDefault(),this.props.hasOwnProperty("onSort")&&this.props.sortable&&this.props.onSort(this.props.columnIndex,this.props.columnKey,this.props.sortDir?-1*this.props.sortDir:1,this.props.sortFunc)}render(){return o().createElement("th",{onClick:this.handleSort,className:this.getSortClass(),width:this.props.width},this.props.children)}}r.propTypes={onSort:i().func,sortDir:i().number,columnIndex:i().number,columnKey:i().any,sortable:i().bool,sortFunc:i().func};const l=r;var c=s(418);const d=e=>{let{children:t}=e,s="";return t&&(s=o().isValidElement(t)?t:o().createElement(c.default,null,t.toString())),o().createElement("td",e,s)};class p extends o().Component{constructor(e){super(e),this.handleEdit=this.handleEdit.bind(this)}shouldDisplayAction(e){let{id:t}=this.props;return!e.hasOwnProperty("display")||e.display(t)}handleEdit(e,t){t.stopPropagation(),t.preventDefault(),this.props.actions.edit.onClick(e)}render(){let{even:e,actions:t,id:s,children:n}=this.props,a=e?"even":"odd";return t.hasOwnProperty("edit")&&this.shouldDisplayAction(t.edit)?o().createElement("tr",{role:"row",className:a+" can-edit",onClick:this.handleEdit.bind(this,s)},n):o().createElement("tr",{role:"row",className:a},n)}}class h extends o().Component{constructor(e){super(e),this.handleAction=this.handleAction.bind(this),this.shouldDisplayAction=this.shouldDisplayAction.bind(this)}shouldDisplayAction(e){let{id:t}=this.props;return!e.hasOwnProperty("display")||e.display(t)}handleAction(e,t,s){s.stopPropagation(),s.preventDefault(),e(t)}render(){let{actions:e,id:t}=this.props;return o().createElement("td",{className:"actions",key:"actions"},e.hasOwnProperty("delete")&&this.shouldDisplayAction(e.delete)&&o().createElement("a",{href:"","data-tip":"delete",onClick:this.handleAction.bind(this,e.delete.onClick,t)},o().createElement("i",{className:"fa fa-trash-o delete-icon"})),e.hasOwnProperty("custom")&&e.custom.map((e=>this.shouldDisplayAction(e)&&o().createElement("a",{href:"","data-tip":e.tooltip,key:"custom_"+e.name,onClick:this.handleAction.bind(this,e.onClick,t)},e.icon))))}}const u=require("react-tooltip");var m=s.n(u);const y={sortFunc:(e,t)=>e<t?-1:e>t?1:0,sortable:!1,sortCol:0,sortDir:1,colWidth:""},b=(e,t,s,n)=>e&&e===s||s===t?n:null,O=e=>{let{options:t,columns:s}=e,n=t.hasOwnProperty("className")?t.className:"";return n+=t.actions.hasOwnProperty("edit")?" table-hover":"",o().createElement("div",null,o().createElement("table",{className:"table table-striped dataTable "+n},o().createElement("thead",null,o().createElement("tr",null,s.map(((s,n)=>{let a=void 0!==t.sortCol?t.sortCol:y.sortCol,i=void 0!==t.sortDir?t.sortDir:y.sortDir,r=void 0!==t.sortFunc?t.sortFunc:y.sortFunc,c=void 0!==s.sortable?s.sortable:y.sortable,d=void 0!==s.width?s.width:y.colWidth;return o().createElement(l,{onSort:e.onSort,sortDir:b(s.columnKey,n,a,i),sortable:c,sortFunc:r,columnIndex:n,columnKey:s.columnKey,width:d,key:"heading_"+n},s.value)})),t.actions&&o().createElement(l,{key:"actions_heading"},t.actionsHeader||" "))),o().createElement("tbody",null,s.length>0&&e.data.map(((e,n)=>Array.isArray(e)&&e.length!==s.length?(console.warn(`Data at row ${n} is ${e.length}. It should be ${s.length}.`),o().createElement("tr",{key:"row_"+n})):o().createElement(p,{even:n%2==0,key:"row_"+n,id:e.id,actions:t.actions},((e,t,s)=>{var n=t.map(((t,s)=>t.hasOwnProperty("render")?o().createElement(d,{key:"cell_"+s},t.render(e,e[t.columnKey])):o().createElement(d,{key:"cell_"+s,title:t.hasOwnProperty("title")?e[t.columnKey]:null},e[t.columnKey])));return s&&n.push(o().createElement(h,{key:"actions_cell",id:e.id,actions:s})),n})(e,s,t.actions)))))),o().createElement(m(),{delayShow:10}))}},580:e=>{e.exports=require("prop-types")},6689:e=>{e.exports=require("react")}},t={};function s(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,s),a.exports}(()=>{s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t}})(),(()=>{s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(()=>{s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var n={};return(()=>{s.r(n),s.d(n,{default:()=>m});var e=s(6689),t=s.n(e),o=s(580),a=s.n(o);const i=require("react-select/lib/Async");var r=s.n(i),l=s(8678);const c=require("i18n-react/dist/i18n-react");var d=s.n(c);const p=require("react-select/lib/AsyncCreatable");var h=s.n(p);class u extends t().Component{constructor(e){super(e),this.state={value:""},this.handleChange=this.handleChange.bind(this),this.getOptions=this.getOptions.bind(this),this.handleLink=this.handleLink.bind(this),this.filterOption=this.filterOption.bind(this),this.handleNew=this.handleNew.bind(this),this.getNewOptionData=this.getNewOptionData.bind(this),this.isValidNewOption=this.isValidNewOption.bind(this)}getOptions(e,t){let{options:s}=this.props,n=s.hasOwnProperty("defaultOptions")?s.defaultOptions:void 0;if(!e&&!n)return Promise.resolve({options:[]});this.props.options.actions.search(e,t)}handleChange(e){this.setState({value:e})}handleLink(e){e.preventDefault(),this.props.options.actions.add.onClick(this.state.value),this.setState({value:""})}getNewOptionData(e,t){return{tag:t,id:e}}isValidNewOption(e,t,s){let{options:n}=this.props,o=n.hasOwnProperty("labelKey")?n.labelKey:"label",a=s.find((t=>t[o]==e));return!(!e||a)}handleNew(e){this.props.options.onCreateTag(e,this.handleChange)}filterOption(e,t){let{options:s,values:n}=this.props,o=this.props.hasOwnProperty("allowDuplicates"),a=s.hasOwnProperty("labelKey")?s.labelKey:"label";return!!o||!n.find((t=>t[a]===e.label))}render(){let{options:e,values:s,columns:n}=this.props,o=!this.state.value,a=e.hasOwnProperty("title")?e.title:"Table",i=e.hasOwnProperty("valueKey")?e.valueKey:"value",c=e.hasOwnProperty("labelKey")?e.labelKey:"label",p=e.hasOwnProperty("onCreateTag"),u=e.hasOwnProperty("defaultOptions")?e.defaultOptions:void 0,m={className:"dataTable",actions:{delete:e.actions.delete}};e.hasOwnProperty("className")&&(m.className=e.className),e.actions.hasOwnProperty("edit")&&(m.actions.edit=e.actions.edit),e.actions.hasOwnProperty("custom")&&(m.actions.custom=e.actions.custom),e.hasOwnProperty("sortCol")&&(s=s.sort(((t,s)=>{const n=isNaN(t[e.sortCol])?t[e.sortCol].toLowerCase():t[e.sortCol],o=isNaN(s[e.sortCol])?s[e.sortCol].toLowerCase():s[e.sortCol];return n>o?1:n<o?-1:0})));let y=null;return y=p?t().createElement(h(),{className:"link-select btn-group text-left",value:this.state.value,getOptionValue:e=>e[i],getOptionLabel:e=>e[c],onChange:this.handleChange,loadOptions:this.getOptions,filterOption:this.filterOption,onCreateOption:this.handleNew,getNewOptionData:this.getNewOptionData,isValidNewOption:this.isValidNewOption}):t().createElement(r(),{className:"link-select btn-group text-left",value:this.state.value,getOptionValue:e=>e[i],getOptionLabel:e=>e[c],onChange:this.handleChange,loadOptions:this.getOptions,filterOption:this.filterOption,defaultOptions:u}),t().createElement("div",{className:"row simple-link-list"},t().createElement("div",{className:"col-md-4 simple-link-list-title"},t().createElement("h4",null,a)),t().createElement("div",{className:"col-md pull-right btn-group"},y,t().createElement("button",{type:"button",className:"btn btn-default add-button",onClick:this.handleLink,disabled:o},d().translate("general.add"))),t().createElement("div",{className:"col-md-12"},t().createElement(l.default,{className:"dataTable",options:m,data:s,columns:n})))}}u.propTypes={values:a().array.isRequired,options:a().shape({title:a().string,sortCol:a().string,valueKey:a().string.isRequired,labelKey:a().string.isRequired,className:a().string,actions:a().shape({search:a().func.isRequired,delete:a().shape({onClick:a().func.isRequired}),add:a().shape({onClick:a().func.isRequired}),edit:a().shape({onClick:a().func.isRequired}),custom:a().array}).isRequired}).isRequired,columns:a().array.isRequired};const m=u})(),n})()}));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{"use strict";var e={418:(e,t,r)=>{r.d(t,{default:()=>s});var o=r(6689),n=r.n(o);const s=({children:e,className:t=""})=>n().createElement("span",{className:t,dangerouslySetInnerHTML:{__html:e.replace(/\n/g,"<br />")}})},580:e=>{e.exports=require("prop-types")},6689:e=>{e.exports=require("react")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,r),s.exports}(()=>{r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t}})(),(()=>{r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})}})(),(()=>{r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var o={};return(()=>{r.r(o),r.d(o,{default:()=>b});var e=r(6689),t=r.n(e),n=r(580),s=r.n(n);class a extends t().Component{constructor(e){super(e),this.handleSort=this.handleSort.bind(this)}getSortClass(){if(!this.props.sortable)return null;switch(this.props.sortDir){case 1:return"sorting_asc";case-1:return"sorting_desc";default:return this.props.sortable?"sorting":null}}handleSort(e){e.preventDefault(),this.props.hasOwnProperty("onSort")&&this.props.sortable&&this.props.onSort(this.props.columnIndex,this.props.columnKey,this.props.sortDir?-1*this.props.sortDir:1,this.props.sortFunc)}render(){return t().createElement("th",{onClick:this.handleSort,className:this.getSortClass(),width:this.props.width},this.props.children)}}a.propTypes={onSort:s().func,sortDir:s().number,columnIndex:s().number,columnKey:s().any,sortable:s().bool,sortFunc:s().func};const i=a;var l=r(418);const c=e=>{let{children:r}=e,o="";return r&&(o=t().isValidElement(r)?r:t().createElement(l.default,null,r.toString())),t().createElement("td",e,o)};class d extends t().Component{constructor(e){super(e),this.handleEdit=this.handleEdit.bind(this)}shouldDisplayAction(e){let{id:t}=this.props;return!e.hasOwnProperty("display")||e.display(t)}handleEdit(e,t){t.stopPropagation(),t.preventDefault(),this.props.actions.edit.onClick(e)}render(){let{even:e,actions:r,id:o,children:n}=this.props,s=e?"even":"odd";return r.hasOwnProperty("edit")&&this.shouldDisplayAction(r.edit)?t().createElement("tr",{role:"row",className:s+" can-edit",onClick:this.handleEdit.bind(this,o)},n):t().createElement("tr",{role:"row",className:s},n)}}class p extends t().Component{constructor(e){super(e),this.handleAction=this.handleAction.bind(this),this.shouldDisplayAction=this.shouldDisplayAction.bind(this)}shouldDisplayAction(e){let{id:t}=this.props;return!e.hasOwnProperty("display")||e.display(t)}handleAction(e,t,r){r.stopPropagation(),r.preventDefault(),e(t)}render(){let{actions:e,id:r}=this.props;return t().createElement("td",{className:"actions",key:"actions"},e.hasOwnProperty("delete")&&this.shouldDisplayAction(e.delete)&&t().createElement("a",{href:"","data-tip":"delete",onClick:this.handleAction.bind(this,e.delete.onClick,r)},t().createElement("i",{className:"fa fa-trash-o delete-icon"})),e.hasOwnProperty("custom")&&e.custom.map((e=>this.shouldDisplayAction(e)&&t().createElement("a",{href:"","data-tip":e.tooltip,key:"custom_"+e.name,onClick:this.handleAction.bind(this,e.onClick,r)},e.icon))))}}const h=require("react-tooltip");var u=r.n(h);const m={sortFunc:(e,t)=>e<t?-1:e>t?1:0,sortable:!1,sortCol:0,sortDir:1,colWidth:""},y=(e,t,r,o)=>e&&e===r||r===t?o:null,b=e=>{let{options:r,columns:o}=e,n=r.hasOwnProperty("className")?r.className:"";return n+=r.actions.hasOwnProperty("edit")?" table-hover":"",t().createElement("div",null,t().createElement("table",{className:"table table-striped dataTable "+n},t().createElement("thead",null,t().createElement("tr",null,o.map(((o,n)=>{let s=void 0!==r.sortCol?r.sortCol:m.sortCol,a=void 0!==r.sortDir?r.sortDir:m.sortDir,l=void 0!==r.sortFunc?r.sortFunc:m.sortFunc,c=void 0!==o.sortable?o.sortable:m.sortable,d=void 0!==o.width?o.width:m.colWidth;return t().createElement(i,{onSort:e.onSort,sortDir:y(o.columnKey,n,s,a),sortable:c,sortFunc:l,columnIndex:n,columnKey:o.columnKey,width:d,key:"heading_"+n},o.value)})),r.actions&&t().createElement(i,{key:"actions_heading"},r.actionsHeader||" "))),t().createElement("tbody",null,o.length>0&&e.data.map(((e,n)=>Array.isArray(e)&&e.length!==o.length?(console.warn(`Data at row ${n} is ${e.length}. It should be ${o.length}.`),t().createElement("tr",{key:"row_"+n})):t().createElement(d,{even:n%2==0,key:"row_"+n,id:e.id,actions:r.actions},((e,r,o)=>{var n=r.map(((r,o)=>r.hasOwnProperty("render")?t().createElement(c,{key:"cell_"+o},r.render(e,e[r.columnKey])):t().createElement(c,{key:"cell_"+o},e[r.columnKey])));return o&&n.push(t().createElement(p,{key:"actions_cell",id:e.id,actions:o})),n})(e,o,r.actions)))))),t().createElement(u(),{delayShow:10}))}})(),o})()}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(function(){return(()=>{"use strict";var e={418:(e,t,r)=>{r.d(t,{default:()=>s});var o=r(6689),n=r.n(o);const s=({children:e,className:t=""})=>n().createElement("span",{className:t,dangerouslySetInnerHTML:{__html:e.replace(/\n/g,"<br />")}})},580:e=>{e.exports=require("prop-types")},6689:e=>{e.exports=require("react")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,r),s.exports}(()=>{r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t}})(),(()=>{r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})}})(),(()=>{r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var o={};return(()=>{r.r(o),r.d(o,{default:()=>b});var e=r(6689),t=r.n(e),n=r(580),s=r.n(n);class l extends t().Component{constructor(e){super(e),this.handleSort=this.handleSort.bind(this)}getSortClass(){if(!this.props.sortable)return null;switch(this.props.sortDir){case 1:return"sorting_asc";case-1:return"sorting_desc";default:return this.props.sortable?"sorting":null}}handleSort(e){e.preventDefault(),this.props.hasOwnProperty("onSort")&&this.props.sortable&&this.props.onSort(this.props.columnIndex,this.props.columnKey,this.props.sortDir?-1*this.props.sortDir:1,this.props.sortFunc)}render(){return t().createElement("th",{onClick:this.handleSort,className:this.getSortClass(),width:this.props.width},this.props.children)}}l.propTypes={onSort:s().func,sortDir:s().number,columnIndex:s().number,columnKey:s().any,sortable:s().bool,sortFunc:s().func};const a=l;var i=r(418);const c=e=>{let{children:r}=e,o="";return r&&(o=t().isValidElement(r)?r:t().createElement(i.default,null,r.toString())),t().createElement("td",e,o)};class d extends t().Component{constructor(e){super(e),this.handleEdit=this.handleEdit.bind(this)}shouldDisplayAction(e){let{id:t}=this.props;return!e.hasOwnProperty("display")||e.display(t)}handleEdit(e,t){t.stopPropagation(),t.preventDefault(),this.props.actions.edit.onClick(e)}render(){let{even:e,actions:r,id:o,children:n}=this.props,s=e?"even":"odd";return r.hasOwnProperty("edit")&&this.shouldDisplayAction(r.edit)?t().createElement("tr",{role:"row",className:s+" can-edit",onClick:this.handleEdit.bind(this,o)},n):t().createElement("tr",{role:"row",className:s},n)}}class p extends t().Component{constructor(e){super(e),this.handleAction=this.handleAction.bind(this),this.shouldDisplayAction=this.shouldDisplayAction.bind(this)}shouldDisplayAction(e){let{id:t}=this.props;return!e.hasOwnProperty("display")||e.display(t)}handleAction(e,t,r){r.stopPropagation(),r.preventDefault(),e(t)}render(){let{actions:e,id:r}=this.props;return t().createElement("td",{className:"actions",key:"actions"},e.hasOwnProperty("delete")&&this.shouldDisplayAction(e.delete)&&t().createElement("a",{href:"","data-tip":"delete",onClick:this.handleAction.bind(this,e.delete.onClick,r)},t().createElement("i",{className:"fa fa-trash-o delete-icon"})),e.hasOwnProperty("custom")&&e.custom.map((e=>this.shouldDisplayAction(e)&&t().createElement("a",{href:"","data-tip":e.tooltip,key:"custom_"+e.name,onClick:this.handleAction.bind(this,e.onClick,r)},e.icon))))}}const h=require("react-tooltip");var u=r.n(h);const m={sortFunc:(e,t)=>e<t?-1:e>t?1:0,sortable:!1,sortCol:0,sortDir:1,colWidth:""},y=(e,t,r,o)=>e&&e===r||r===t?o:null,b=e=>{let{options:r,columns:o}=e,n=r.hasOwnProperty("className")?r.className:"";return n+=r.actions.hasOwnProperty("edit")?" table-hover":"",t().createElement("div",null,t().createElement("table",{className:"table table-striped dataTable "+n},t().createElement("thead",null,t().createElement("tr",null,o.map(((o,n)=>{let s=void 0!==r.sortCol?r.sortCol:m.sortCol,l=void 0!==r.sortDir?r.sortDir:m.sortDir,i=void 0!==r.sortFunc?r.sortFunc:m.sortFunc,c=void 0!==o.sortable?o.sortable:m.sortable,d=void 0!==o.width?o.width:m.colWidth;return t().createElement(a,{onSort:e.onSort,sortDir:y(o.columnKey,n,s,l),sortable:c,sortFunc:i,columnIndex:n,columnKey:o.columnKey,width:d,key:"heading_"+n},o.value)})),r.actions&&t().createElement(a,{key:"actions_heading"},r.actionsHeader||" "))),t().createElement("tbody",null,o.length>0&&e.data.map(((e,n)=>Array.isArray(e)&&e.length!==o.length?(console.warn(`Data at row ${n} is ${e.length}. It should be ${o.length}.`),t().createElement("tr",{key:"row_"+n})):t().createElement(d,{even:n%2==0,key:"row_"+n,id:e.id,actions:r.actions},((e,r,o)=>{var n=r.map(((r,o)=>r.hasOwnProperty("render")?t().createElement(c,{key:"cell_"+o},r.render(e,e[r.columnKey])):t().createElement(c,{key:"cell_"+o,title:r.hasOwnProperty("title")?e[r.columnKey]:null},e[r.columnKey])));return o&&n.push(t().createElement(p,{key:"actions_cell",id:e.id,actions:o})),n})(e,o,r.actions)))))),t().createElement(u(),{delayShow:10}))}})(),o})()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openstack-uicore-foundation",
3
- "version": "4.0.9",
3
+ "version": "4.0.10",
4
4
  "description": "ui reactjs components for openstack marketing site",
5
5
  "main": "lib/openstack-uicore-foundation.js",
6
6
  "scripts": {