openstack-uicore-foundation 4.1.93 → 4.1.94
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.
- package/lib/components/index.js +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/components/inputs/editor-input.js +1 -1
- package/lib/components/inputs/editor-input.js.map +1 -1
- package/lib/components/simple-link-list.js +1 -1
- package/lib/components/simple-link-list.js.map +1 -1
- package/lib/components/table-editable.js +1 -1
- package/lib/components/table-editable.js.map +1 -1
- package/lib/components/table-selectable.js +1 -1
- package/lib/components/table-selectable.js.map +1 -1
- package/lib/components/table.js +1 -1
- package/lib/components/table.js.map +1 -1
- package/package.json +2 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/table-selectable.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,8BAA+B,GAAIH,GAChB,iBAAZC,QACdA,QAAQ,+BAAiCD,IAEzCD,EAAK,+BAAiCC,GACvC,CATD,CASGK,MAAM,I,8KCHT,EAJgB,QAAC,SAACC,EAAD,eAAWC,GAAiB,EAA5B,UAAmCC,EAAY,IAAhD,EAAuDC,EAAvD,gBACZ,8BAAMD,UAAWA,EACXE,wBAAyB,CAAEC,OAAQJ,EAAiBD,aAAH,EAAGA,EAAUM,QAAQ,MAAO,UAAYN,IAAeG,GAFlG,C,WCFhBP,EAAOD,QAAUY,QAAQ,iC,WCAzBX,EAAOD,QAAUY,QAAQ,iD,UCAzBX,EAAOD,QAAUY,QAAQ,a,WCAzBX,EAAOD,QAAUY,QAAQ,Q,WCAzBX,EAAOD,QAAUY,QAAQ,gB,GCCrBC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAahB,QAGrB,IAAIC,EAASY,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stack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/components/raw-html/index.js","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/extends\"","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/objectWithoutProperties\"","webpack://openstack-uicore-foundation/external commonjs \"prop-types\"","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/external commonjs \"react-tooltip\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/components/table-selectable/SelectableTableHeading.js","webpack://openstack-uicore-foundation/./src/components/table-selectable/SelectableTableCell.js","webpack://openstack-uicore-foundation/./src/components/table-selectable/SelectableTableRow.js","webpack://openstack-uicore-foundation/./src/components/table-selectable/SelectableActionsTableCell.js","webpack://openstack-uicore-foundation/./src/components/table-selectable/SelectableTable.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","import React from 'react';\n\nconst RawHTML = ({children, replaceNewLine = false, className = \"\", ...rest}) =>\n <span className={className}\n dangerouslySetInnerHTML={{ __html: replaceNewLine ? children?.replace(/\\n/g, '<br />') : children}} {...rest}/>\n\nexport default RawHTML;","module.exports = require(\"@babel/runtime/helpers/extends\");","module.exports = require(\"@babel/runtime/helpers/objectWithoutProperties\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"react-tooltip\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import React from 'react';\nimport PropTypes from 'prop-types';\n\nclass SelectableTableHeading extends React.Component {\n\n\tconstructor (props) {\n\t\tsuper(props);\n\t\tthis.handleSort = this.handleSort.bind(this);\n\t}\n\n\tgetSortClass() {\n\n\t\tif (!this.props.sortable) return null;\n\n\t\tswitch(this.props.sortDir) {\n\t\t\tcase 1:\n\t\t\t\treturn 'sorting_asc';\n\t\t\tcase -1:\n\t\t\t\treturn 'sorting_desc';\n\t\t\tdefault:\n\t\t\t\treturn this.props.sortable ? 'sorting' : null\n\t\t}\n\t}\n\n\thandleSort(e) {\n\t\te.preventDefault();\n\t\tif(!this.props.hasOwnProperty('onSort') || !this.props.sortable) return;\n\n\t\tthis.props.onSort(\n\t\t\tthis.props.columnIndex,\n\t\t\tthis.props.columnKey,\n\t\t\tthis.props.sortDir ? this.props.sortDir*-1 : 1,\n\t\t\tthis.props.sortFunc\n\t\t);\n\t}\n\n\trender () {\n\t\treturn (\n\t\t\t<th onClick={this.handleSort}\n\t\t\t\tclassName={this.getSortClass()}\n\t\t\t\twidth={this.props.width}\n\t\t\t\t>\n\t\t\t\t{this.props.children}\n\t\t\t</th>\n\t\t);\t\n\t}\n\t\n}\n\nSelectableTableHeading.propTypes = {\n\tonSort: PropTypes.func,\n\tsortDir: PropTypes.number,\n\tcolumnIndex: PropTypes.number,\n\tcolumnKey: PropTypes.any,\n\tsortable: PropTypes.bool,\n\tsortFunc: PropTypes.func\n};\n\nexport default SelectableTableHeading;","import React from 'react';\nimport RawHTML from '../raw-html';\n\nconst SelectableTableCell = (props) => {\n let {children} = props;\n\tlet value = '';\n\tif(children) {\n\t if (React.isValidElement(children)) {\n\t value = children;\n } else {\n\t value = <RawHTML>{children.toString()}</RawHTML>\n }\n }\n\n\treturn (\n\t\t<td {...props}>\n {value}\n\t\t</td>\n\t);\n};\n\nexport default SelectableTableCell;\n","import React from 'react';\n\nexport default class SelectableTableRow extends React.Component {\n\n constructor(props) {\n super(props);\n this.handleEdit = this.handleEdit.bind(this);\n this.handleSelect = this.handleSelect.bind(this);\n }\n\n shouldDisplayAction(action) {\n let {id} = this.props;\n if (!action.hasOwnProperty('display')) {\n return true;\n } else {\n return action.display(id);\n }\n }\n\n handleEdit(id, ev) {\n // by pass\n if(ev.target.type === \"checkbox\")\n return;\n ev.stopPropagation();\n ev.preventDefault();\n this.props.actions.edit.onClick(id);\n }\n\n handleSelect(id, ev) {\n this.props.actions.edit.onSelected(id, ev.target.checked);\n }\n\n render() {\n\n let {even, actions, id, children, checked} = this.props;\n let canEdit = (actions?.edit && this.shouldDisplayAction(actions.edit));\n let rowClass = even ? 'even' : 'odd';\n\n if (canEdit) {\n return (\n <tr role=\"row\" className={rowClass + \" can-edit\"} onClick={this.handleEdit.bind(this, id)}>\n <td key={id + '_select'}>\n <input\n type=\"checkbox\"\n id={id + '_select'}\n name={id + '_select'}\n checked={checked}\n onChange={this.handleSelect.bind(this, id)}\n />\n </td>\n {children}\n </tr>\n );\n }\n\n return (\n <tr role=\"row\" className={rowClass}>\n <td key={id + '_select'} >\n <input\n type=\"checkbox\"\n id={id + '_select'}\n name={id + '_select'}\n checked={checked}\n onChange={this.handleSelect.bind(this, id)}\n />\n </td>\n {children}\n </tr>\n );\n\n }\n};\n\n","import React from 'react';\n\nexport default class SelectableActionsTableCell extends React.Component {\n\n constructor(props) {\n super(props);\n\n this.handleAction = this.handleAction.bind(this);\n this.shouldDisplayAction = this.shouldDisplayAction.bind(this);\n\n }\n\n shouldDisplayAction(action) {\n let {id} = this.props;\n\n if (!action.hasOwnProperty('display')) {\n return true;\n } else {\n return action.display(id);\n }\n }\n\n handleAction(action, id, ev) {\n ev.stopPropagation();\n ev.preventDefault();\n\n action(id);\n }\n\n render() {\n let {actions, id} = this.props;\n return (\n <td className=\"actions\" key=\"actions\">\n {actions.hasOwnProperty('delete') && this.shouldDisplayAction(actions.delete) &&\n <a href=\"\" data-tip=\"delete\" onClick={this.handleAction.bind(this, actions.delete.onClick, id)} >\n <i className=\"fa fa-trash-o delete-icon\"></i>\n </a>\n }\n {actions.hasOwnProperty('custom') && actions.custom.map(a =>\n this.shouldDisplayAction(a) &&\n <a href=\"\" data-tip={a.tooltip} key={'custom_' + a.name} onClick={this.handleAction.bind(this, a.onClick, id)}>\n {a.icon}\n </a>\n )}\n </td>\n );\n }\n};\n","import React from 'react';\nimport SelectableTableHeading from './SelectableTableHeading';\nimport SelectableTableCell from './SelectableTableCell';\nimport SelectableTableRow from './SelectableTableRow';\nimport SelectableActionsTableCell from './SelectableActionsTableCell';\nimport ReactTooltip from 'react-tooltip'\nimport './selectable-table.less';\n\nconst defaults = {\n sortFunc: (a,b) => (a < b ? -1 : (a > b ? 1 : 0)),\n sortable: false,\n sortCol: 0,\n sortDir: 1,\n colWidth: ''\n}\n\nconst createRow = (row, columns, actions) => {\n\n var action_buttons = '';\n var cells = columns.map((col,i) => {\n if(col.hasOwnProperty(\"render\"))\n return (\n <SelectableTableCell key={row['id'] + '_field' + i} name={col.columnKey} id={row.id} >\n {col.render(row, row[col.columnKey])}\n </SelectableTableCell>\n );\n\n return (\n <SelectableTableCell key={row['id'] + '_field' + i} name={col.columnKey} id={row.id}>\n {row[col.columnKey]}\n </SelectableTableCell>\n );\n });\n\n if (actions) {\n cells.push(<SelectableActionsTableCell key='actions_cell' id={row['id']} actions={actions} />);\n }\n\n return cells;\n};\n\nconst getSortDir = (columnKey, columnIndex, sortCol, sortDir) => {\n if(columnKey && (columnKey === sortCol)) {\n return sortDir;\n }\n if(sortCol === columnIndex) {\n return sortDir;\n }\n return null\n};\n\n\nclass SelectableTable extends React.Component {\n\n constructor(props) {\n super(props);\n }\n\n render() {\n let {options, columns} = this.props;\n let tableClass = options.hasOwnProperty('className') ? options.className : '';\n tableClass += options.actions?.edit ? ' table-hover' : '';\n\n return (\n <div>\n <table className={\"table table-striped selectableTable \" + tableClass}>\n <thead>\n <tr>\n <th>\n <input type=\"checkbox\" id=\"select_all\"\n name=\"select_all\"\n onChange={options.actions?.edit?.onSelectedAll}\n checked={options.selectedAll}/>\n </th>\n {columns.map((col,i) => {\n\n let sortCol = (typeof options.sortCol != 'undefined') ? options.sortCol : defaults.sortCol;\n let sortDir = (typeof options.sortDir != 'undefined') ? options.sortDir : defaults.sortDir;\n let sortFunc = (typeof options.sortFunc != 'undefined') ? options.sortFunc : defaults.sortFunc;\n let sortable = (typeof col.sortable != 'undefined') ? col.sortable : defaults.sortable;\n let colWidth = (typeof col.width != 'undefined') ? col.width : defaults.colWidth;\n\n return (\n <SelectableTableHeading\n onSort={this.props.onSort}\n sortDir={getSortDir(col.columnKey, i, sortCol, sortDir)}\n sortable={sortable}\n sortFunc={sortFunc}\n columnIndex={i}\n columnKey={col.columnKey}\n width={colWidth}\n key={'heading_'+i}\n >\n {col.value}\n </SelectableTableHeading>\n );\n })}\n {options.actions &&\n <SelectableTableHeading key='actions_heading' >\n {options.actionsHeader || ' '}\n </SelectableTableHeading>\n }\n </tr>\n </thead>\n <tbody>\n {columns.length > 0 && this.props.data.map((row,i) => {\n if(Array.isArray(row) && row.length !== columns.length) {\n console.warn(`Data at row ${i} is ${row.length}. It should be ${columns.length}.`);\n return <tr key={'row_'+i} />\n }\n\n return (\n <SelectableTableRow checked={row.checked} even={i%2 === 0} key={'row_'+row['id']} id={row['id']} actions={options.actions}>\n {createRow(row, columns, options.actions)}\n </SelectableTableRow>\n );\n })}\n </tbody>\n </table>\n <ReactTooltip delayShow={10} />\n </div>\n );\n }\n}\n\n\nexport default SelectableTable;\n"],"names":["root","factory","exports","module","define","amd","this","children","replaceNewLine","className","rest","dangerouslySetInnerHTML","__html","replace","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","SelectableTableHeading","React","constructor","props","super","handleSort","bind","getSortClass","sortable","sortDir","e","preventDefault","onSort","columnIndex","columnKey","sortFunc","render","onClick","width","propTypes","PropTypes","toString","SelectableTableRow","handleEdit","handleSelect","shouldDisplayAction","action","id","display","ev","target","type","stopPropagation","actions","edit","onSelected","checked","even","rowClass","role","name","onChange","SelectableActionsTableCell","handleAction","delete","href","custom","map","tooltip","icon","defaults","b","sortCol","colWidth","getSortDir","SelectableTable","options","columns","tableClass","onSelectedAll","selectedAll","col","i","actionsHeader","length","data","row","Array","isArray","console","warn","cells","push","createRow","delayShow"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"components/table-selectable.js","mappings":"CAAA,SAA2CA,EAAMC,GAC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B,QAASC,KAAMyB,EAAE,GAAM,EAAG7E,IAAK,OAAOiF,EAAG,GAAQvC,GAAIuC,EAAG,GAAQjC,QAASuB,EAAQvB,SAhG5H,EAACiC,EAAKT,EAASxB,KAE7B,IACIsC,EAAQd,EAAQV,KAAI,CAACc,EAAIC,IACtBD,EAAInE,eAAe,UAEd,kBAAC,EAAD,CAAqBT,IAAKiF,EAAG,GAAS,SAAWJ,EAAGtB,KAAMqB,EAAI/C,UAAWa,GAAIuC,EAAIvC,IAC5EkC,EAAI7C,OAAOkD,EAAKA,EAAIL,EAAI/C,aAKjC,kBAAC,EAAD,CAAqB7B,IAAKiF,EAAG,GAAS,SAAWJ,EAAGtB,KAAMqB,EAAI/C,UAAWa,GAAIuC,EAAIvC,IAC5EuC,EAAIL,EAAI/C,cASrB,OAJImB,GACAsC,EAAMC,KAAK,kBAAC9B,EAAD,CAA4BzD,IAAI,eAAe0C,GAAIuC,EAAG,GAAQjC,QAASA,KAG/EsC,CAAP,EA2E6BE,CAAUP,EAAKT,EAASD,EAAQvB,cAMjD,kBAAC,EAAAyC,QAAD,CAASC,UAAW,KAG/B,EAIL,S","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/components/raw-html/index.js","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/extends\"","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/objectWithoutProperties\"","webpack://openstack-uicore-foundation/external commonjs \"prop-types\"","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/external commonjs \"react-tooltip\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/components/table-selectable/SelectableTableHeading.js","webpack://openstack-uicore-foundation/./src/components/table-selectable/SelectableTableCell.js","webpack://openstack-uicore-foundation/./src/components/table-selectable/SelectableTableRow.js","webpack://openstack-uicore-foundation/./src/components/table-selectable/SelectableActionsTableCell.js","webpack://openstack-uicore-foundation/./src/components/table-selectable/SelectableTable.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","import React from 'react';\n\nconst RawHTML = ({children, replaceNewLine = false, className = \"\", ...rest}) =>\n <span className={className}\n dangerouslySetInnerHTML={{ __html: replaceNewLine ? children?.replace(/\\n/g, '<br />') : children}} {...rest}/>\n\nexport default RawHTML;","module.exports = require(\"@babel/runtime/helpers/extends\");","module.exports = require(\"@babel/runtime/helpers/objectWithoutProperties\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"react-tooltip\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import React from 'react';\nimport PropTypes from 'prop-types';\n\nclass SelectableTableHeading extends React.Component {\n\n\tconstructor (props) {\n\t\tsuper(props);\n\t\tthis.handleSort = this.handleSort.bind(this);\n\t}\n\n\tgetSortClass() {\n\n\t\tif (!this.props.sortable) return null;\n\n\t\tswitch(this.props.sortDir) {\n\t\t\tcase 1:\n\t\t\t\treturn 'sorting_asc';\n\t\t\tcase -1:\n\t\t\t\treturn 'sorting_desc';\n\t\t\tdefault:\n\t\t\t\treturn this.props.sortable ? 'sorting' : null\n\t\t}\n\t}\n\n\thandleSort(e) {\n\t\te.preventDefault();\n\t\tif(!this.props.hasOwnProperty('onSort') || !this.props.sortable) return;\n\n\t\tthis.props.onSort(\n\t\t\tthis.props.columnIndex,\n\t\t\tthis.props.columnKey,\n\t\t\tthis.props.sortDir ? this.props.sortDir*-1 : 1,\n\t\t\tthis.props.sortFunc\n\t\t);\n\t}\n\n\trender () {\n\t\treturn (\n\t\t\t<th onClick={this.handleSort}\n\t\t\t\tclassName={this.getSortClass()}\n\t\t\t\twidth={this.props.width}\n\t\t\t\t>\n\t\t\t\t{this.props.children}\n\t\t\t</th>\n\t\t);\t\n\t}\n\t\n}\n\nSelectableTableHeading.propTypes = {\n\tonSort: PropTypes.func,\n\tsortDir: PropTypes.number,\n\tcolumnIndex: PropTypes.number,\n\tcolumnKey: PropTypes.any,\n\tsortable: PropTypes.bool,\n\tsortFunc: PropTypes.func\n};\n\nexport default SelectableTableHeading;","import React from 'react';\nimport RawHTML from '../raw-html';\n\nconst SelectableTableCell = (props) => {\n let {children} = props;\n\tlet value = '';\n\tif(children) {\n\t if (React.isValidElement(children)) {\n\t value = children;\n } else {\n\t value = <RawHTML>{children.toString()}</RawHTML>\n }\n }\n\n\treturn (\n\t\t<td {...props}>\n {value}\n\t\t</td>\n\t);\n};\n\nexport default SelectableTableCell;\n","import React from 'react';\n\nexport default class SelectableTableRow extends React.Component {\n\n constructor(props) {\n super(props);\n this.handleEdit = this.handleEdit.bind(this);\n this.handleSelect = this.handleSelect.bind(this);\n }\n\n shouldDisplayAction(action) {\n let {id} = this.props;\n if (!action.hasOwnProperty('display')) {\n return true;\n } else {\n return action.display(id);\n }\n }\n\n handleEdit(id, ev) {\n // by pass\n if(ev.target.type === \"checkbox\")\n return;\n ev.stopPropagation();\n ev.preventDefault();\n this.props.actions.edit.onClick(id);\n }\n\n handleSelect(id, ev) {\n this.props.actions.edit.onSelected(id, ev.target.checked);\n }\n\n render() {\n\n let {even, actions, id, children, checked} = this.props;\n let canEdit = (actions?.edit && this.shouldDisplayAction(actions.edit));\n let rowClass = even ? 'even' : 'odd';\n\n if (canEdit) {\n return (\n <tr role=\"row\" className={rowClass + \" can-edit\"} onClick={this.handleEdit.bind(this, id)}>\n <td key={id + '_select'}>\n <input\n type=\"checkbox\"\n id={id + '_select'}\n name={id + '_select'}\n checked={checked}\n onChange={this.handleSelect.bind(this, id)}\n />\n </td>\n {children}\n </tr>\n );\n }\n\n return (\n <tr role=\"row\" className={rowClass}>\n <td key={id + '_select'} >\n <input\n type=\"checkbox\"\n id={id + '_select'}\n name={id + '_select'}\n checked={checked}\n onChange={this.handleSelect.bind(this, id)}\n />\n </td>\n {children}\n </tr>\n );\n\n }\n};\n\n","import React from 'react';\n\nexport default class SelectableActionsTableCell extends React.Component {\n\n constructor(props) {\n super(props);\n\n this.handleAction = this.handleAction.bind(this);\n this.shouldDisplayAction = this.shouldDisplayAction.bind(this);\n\n }\n\n shouldDisplayAction(action) {\n let {id} = this.props;\n\n if (!action.hasOwnProperty('display')) {\n return true;\n } else {\n return action.display(id);\n }\n }\n\n handleAction(action, id, ev) {\n ev.stopPropagation();\n ev.preventDefault();\n\n action(id);\n }\n\n render() {\n let {actions, id} = this.props;\n return (\n <td className=\"actions\" key=\"actions\">\n {actions.hasOwnProperty('delete') && this.shouldDisplayAction(actions.delete) &&\n <a href=\"\" data-tip=\"delete\" onClick={this.handleAction.bind(this, actions.delete.onClick, id)} >\n <i className=\"fa fa-trash-o delete-icon\"></i>\n </a>\n }\n {actions.hasOwnProperty('custom') && actions.custom.map(a =>\n this.shouldDisplayAction(a) &&\n <a href=\"\" data-tip={a.tooltip} key={'custom_' + a.name} onClick={this.handleAction.bind(this, a.onClick, id)}>\n {a.icon}\n </a>\n )}\n </td>\n );\n }\n};\n","import React from 'react';\nimport SelectableTableHeading from './SelectableTableHeading';\nimport SelectableTableCell from './SelectableTableCell';\nimport SelectableTableRow from './SelectableTableRow';\nimport SelectableActionsTableCell from './SelectableActionsTableCell';\nimport { Tooltip } from 'react-tooltip'\nimport './selectable-table.less';\n\nconst defaults = {\n sortFunc: (a,b) => (a < b ? -1 : (a > b ? 1 : 0)),\n sortable: false,\n sortCol: 0,\n sortDir: 1,\n colWidth: ''\n}\n\nconst createRow = (row, columns, actions) => {\n\n var action_buttons = '';\n var cells = columns.map((col,i) => {\n if(col.hasOwnProperty(\"render\"))\n return (\n <SelectableTableCell key={row['id'] + '_field' + i} name={col.columnKey} id={row.id} >\n {col.render(row, row[col.columnKey])}\n </SelectableTableCell>\n );\n\n return (\n <SelectableTableCell key={row['id'] + '_field' + i} name={col.columnKey} id={row.id}>\n {row[col.columnKey]}\n </SelectableTableCell>\n );\n });\n\n if (actions) {\n cells.push(<SelectableActionsTableCell key='actions_cell' id={row['id']} actions={actions} />);\n }\n\n return cells;\n};\n\nconst getSortDir = (columnKey, columnIndex, sortCol, sortDir) => {\n if(columnKey && (columnKey === sortCol)) {\n return sortDir;\n }\n if(sortCol === columnIndex) {\n return sortDir;\n }\n return null\n};\n\n\nclass SelectableTable extends React.Component {\n\n constructor(props) {\n super(props);\n }\n\n render() {\n let {options, columns} = this.props;\n let tableClass = options.hasOwnProperty('className') ? options.className : '';\n tableClass += options.actions?.edit ? ' table-hover' : '';\n\n return (\n <div>\n <table className={\"table table-striped selectableTable \" + tableClass}>\n <thead>\n <tr>\n <th>\n <input type=\"checkbox\" id=\"select_all\"\n name=\"select_all\"\n onChange={options.actions?.edit?.onSelectedAll}\n checked={options.selectedAll}/>\n </th>\n {columns.map((col,i) => {\n\n let sortCol = (typeof options.sortCol != 'undefined') ? options.sortCol : defaults.sortCol;\n let sortDir = (typeof options.sortDir != 'undefined') ? options.sortDir : defaults.sortDir;\n let sortFunc = (typeof options.sortFunc != 'undefined') ? options.sortFunc : defaults.sortFunc;\n let sortable = (typeof col.sortable != 'undefined') ? col.sortable : defaults.sortable;\n let colWidth = (typeof col.width != 'undefined') ? col.width : defaults.colWidth;\n\n return (\n <SelectableTableHeading\n onSort={this.props.onSort}\n sortDir={getSortDir(col.columnKey, i, sortCol, sortDir)}\n sortable={sortable}\n sortFunc={sortFunc}\n columnIndex={i}\n columnKey={col.columnKey}\n width={colWidth}\n key={'heading_'+i}\n >\n {col.value}\n </SelectableTableHeading>\n );\n })}\n {options.actions &&\n <SelectableTableHeading key='actions_heading' >\n {options.actionsHeader || ' '}\n </SelectableTableHeading>\n }\n </tr>\n </thead>\n <tbody>\n {columns.length > 0 && this.props.data.map((row,i) => {\n if(Array.isArray(row) && row.length !== columns.length) {\n console.warn(`Data at row ${i} is ${row.length}. It should be ${columns.length}.`);\n return <tr key={'row_'+i} />\n }\n\n return (\n <SelectableTableRow checked={row.checked} even={i%2 === 0} key={'row_'+row['id']} id={row['id']} actions={options.actions}>\n {createRow(row, columns, options.actions)}\n </SelectableTableRow>\n );\n })}\n </tbody>\n </table>\n <Tooltip delayShow={10} />\n </div>\n );\n }\n}\n\n\nexport default SelectableTable;\n"],"names":["root","factory","exports","module","define","amd","this","children","replaceNewLine","className","rest","dangerouslySetInnerHTML","__html","replace","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","SelectableTableHeading","React","constructor","props","super","handleSort","bind","getSortClass","sortable","sortDir","e","preventDefault","onSort","columnIndex","columnKey","sortFunc","render","onClick","width","propTypes","PropTypes","toString","SelectableTableRow","handleEdit","handleSelect","shouldDisplayAction","action","id","display","ev","target","type","stopPropagation","actions","edit","onSelected","checked","even","rowClass","role","name","onChange","SelectableActionsTableCell","handleAction","delete","href","custom","map","tooltip","icon","defaults","b","sortCol","colWidth","getSortDir","SelectableTable","options","columns","tableClass","onSelectedAll","selectedAll","col","i","actionsHeader","length","data","row","Array","isArray","console","warn","cells","push","createRow","Tooltip","delayShow"],"sourceRoot":""}
|
package/lib/components/table.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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,(()=>(()=>{"use strict";var e={418:(e,t,r)=>{r.d(t,{default:()=>d});var o=r(8213),n=r.n(o),s=r(3838),l=r.n(s),i=r(6689),a=r.n(i);const c=["children","replaceNewLine","className"],d=e=>{let{children:t,replaceNewLine:r=!1,className:o=""}=e,s=l()(e,c);return a().createElement("span",n()({className:o,dangerouslySetInnerHTML:{__html:r?null==t?void 0:t.replace(/\n/g,"<br />"):t}},s))}},4391:(e,t,r)=>{r.d(t,{Z:()=>l});var o=r(6689),n=r.n(o),s=r(418);const l=e=>{let{children:t}=e,r="";return t&&(r=n().isValidElement(t)?t:n().createElement(s.default,null,t.toString())),n().createElement("td",e,r)}},8213:e=>{e.exports=require("@babel/runtime/helpers/extends")},3838:e=>{e.exports=require("@babel/runtime/helpers/objectWithoutProperties")},580:e=>{e.exports=require("prop-types")},6689:e=>{e.exports=require("react")},2076:e=>{e.exports=require("react-tooltip")}},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:()=>
|
|
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,(()=>(()=>{"use strict";var e={418:(e,t,r)=>{r.d(t,{default:()=>d});var o=r(8213),n=r.n(o),s=r(3838),l=r.n(s),i=r(6689),a=r.n(i);const c=["children","replaceNewLine","className"],d=e=>{let{children:t,replaceNewLine:r=!1,className:o=""}=e,s=l()(e,c);return a().createElement("span",n()({className:o,dangerouslySetInnerHTML:{__html:r?null==t?void 0:t.replace(/\n/g,"<br />"):t}},s))}},4391:(e,t,r)=>{r.d(t,{Z:()=>l});var o=r(6689),n=r.n(o),s=r(418);const l=e=>{let{children:t}=e,r="";return t&&(r=n().isValidElement(t)?t:n().createElement(s.default,null,t.toString())),n().createElement("td",e,r)}},8213:e=>{e.exports=require("@babel/runtime/helpers/extends")},3838:e=>{e.exports=require("@babel/runtime/helpers/objectWithoutProperties")},580:e=>{e.exports=require("prop-types")},6689:e=>{e.exports=require("react")},2076:e=>{e.exports=require("react-tooltip")}},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:()=>m});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 i=l;var a=r(4391);class c 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(null==r?void 0:r.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 d 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))))}}var p=r(2076);const u={sortFunc:(e,t)=>e<t?-1:e>t?1:0,sortable:!1,sortCol:0,sortDir:1,colWidth:""},h=(e,t,r,o)=>e&&e===r||r===t?o:null,m=e=>{var r;let{options:o,columns:n}=e,s=o.hasOwnProperty("className")?o.className:"";return s+=null!==(r=o.actions)&&void 0!==r&&r.edit?" table-hover":"",t().createElement("div",null,t().createElement("table",{className:"table table-striped dataTable "+s},t().createElement("thead",null,t().createElement("tr",null,n.map(((r,n)=>{let s=void 0!==o.sortCol?o.sortCol:u.sortCol,l=void 0!==o.sortDir?o.sortDir:u.sortDir,a=void 0!==o.sortFunc?o.sortFunc:u.sortFunc,c=void 0!==r.sortable?r.sortable:u.sortable,d=void 0!==r.width?r.width:u.colWidth;return t().createElement(i,{onSort:e.onSort,sortDir:h(r.columnKey,n,s,l),sortable:c,sortFunc:a,columnIndex:n,columnKey:r.columnKey,width:d,key:"heading_"+n},r.value)})),o.actions&&t().createElement(i,{key:"actions_heading"},o.actionsHeader||" "))),t().createElement("tbody",null,n.length>0&&e.data.map(((e,r)=>Array.isArray(e)&&e.length!==n.length?(console.warn(`Data at row ${r} is ${e.length}. It should be ${n.length}.`),t().createElement("tr",{key:"row_"+r})):t().createElement(c,{even:r%2==0,key:"row_"+r,id:e.id,actions:o.actions},((e,r,o)=>{const n=r.map(((r,o)=>{const n=(null==r?void 0:r.styles)||{};return r.hasOwnProperty("render")?t().createElement(a.Z,{key:"cell_"+o,style:n},r.render(e,e[r.columnKey])):t().createElement(a.Z,{key:"cell_"+o,title:r.hasOwnProperty("title")?e[r.columnKey]:null,style:n},e[r.columnKey])}));return o&&n.push(t().createElement(d,{key:"actions_cell",id:e.id,actions:o})),n})(e,n,o.actions)))))),t().createElement(p.Tooltip,{delayShow:10}))}})(),o})()));
|
|
2
2
|
//# sourceMappingURL=table.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/table.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,8BAA+B,GAAIH,GAChB,iBAAZC,QACdA,QAAQ,+BAAiCD,IAEzCD,EAAK,+BAAiCC,GACvC,CATD,CASGK,MAAM,I,8KCHT,EAJgB,QAAC,SAACC,EAAD,eAAWC,GAAiB,EAA5B,UAAmCC,EAAY,IAAhD,EAAuDC,EAAvD,gBACZ,8BAAMD,UAAWA,EACXE,wBAAyB,CAAEC,OAAQJ,EAAiBD,aAAH,EAAGA,EAAUM,QAAQ,MAAO,UAAYN,IAAeG,GAFlG,C,kECChB,MAkBA,EAlBmBI,IACf,IAAI,SAACP,GAAYO,EAChBC,EAAQ,GASZ,OARGR,IAEKQ,EADAC,IAAAA,eAAqBT,GACbA,EAEA,kBAAC,UAAD,KAAUA,EAASU,aAKlC,uBAAQH,EACGC,EAFZ,C,WCdDZ,EAAOD,QAAUgB,QAAQ,iC,WCAzBf,EAAOD,QAAUgB,QAAQ,iD,UC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Z,EAAQV,KAAI,CAACY,EAAIC,KAC3B,MAAMU,GAAYX,aAAA,EAAAA,EAAKY,SAAU,CAAC,EAElC,OAAGZ,EAAItD,eAAe,UAEd,kBAACmE,EAAA,EAAD,CAAW5E,IAAK,QAAQgE,EAAGa,MAAOH,GAC7BX,EAAInC,OAAOwC,EAAKA,EAAIL,EAAIrC,aAKjC,kBAACkD,EAAA,EAAD,CACI5E,IAAK,QAAQgE,EACbc,MAAOf,EAAItD,eAAe,SAAW2D,EAAIL,EAAIrC,WAAa,KAC1DmD,MAAOH,GAENN,EAAIL,EAAIrC,WANjB,IAeJ,OAJIe,GACAgC,EAAMM,KAAK,kBAACjC,EAAD,CAAkB9C,IAAI,eAAeqC,GAAI+B,EAAG,GAAQ3B,QAASA,KAGrEgC,CAAP,EA8D6BO,CAAUZ,EAAKP,EAASD,EAAQnB,cAMrD,kBAAC,IAAD,CAAcwC,UAAW,KAlDjC,C","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/components/raw-html/index.js","webpack://openstack-uicore-foundation/./src/components/table/TableCell.js","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/extends\"","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/objectWithoutProperties\"","webpack://openstack-uicore-foundation/external commonjs \"prop-types\"","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/external commonjs \"react-tooltip\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/components/table/TableHeading.js","webpack://openstack-uicore-foundation/./src/components/table/TableRow.js","webpack://openstack-uicore-foundation/./src/components/table/ActionsTableCell.js","webpack://openstack-uicore-foundation/./src/components/table/Table.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","import React from 'react';\n\nconst RawHTML = ({children, replaceNewLine = false, className = \"\", ...rest}) =>\n <span className={className}\n dangerouslySetInnerHTML={{ __html: replaceNewLine ? children?.replace(/\\n/g, '<br />') : children}} {...rest}/>\n\nexport default RawHTML;","import React from 'react';\nimport RawHTML from '../raw-html';\n\nconst TableCell = (props) => {\n let {children} = props;\n\tlet value = '';\n\tif(children) {\n\t if (React.isValidElement(children)) {\n\t value = children;\n } else {\n\t value = <RawHTML>{children.toString()}</RawHTML>\n }\n }\n\n\treturn (\n\t\t<td {...props}>\n {value}\n\t\t</td>\n\t);\n};\n\nexport default TableCell;\n","module.exports = require(\"@babel/runtime/helpers/extends\");","module.exports = require(\"@babel/runtime/helpers/objectWithoutProperties\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"react-tooltip\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import React from 'react';\nimport PropTypes from 'prop-types';\n\nclass TableHeading extends React.Component {\n\n\tconstructor (props) {\n\t\tsuper(props);\n\t\tthis.handleSort = this.handleSort.bind(this);\n\t}\n\n\tgetSortClass() {\n\n\t\tif (!this.props.sortable) return null;\n\n\t\tswitch(this.props.sortDir) {\n\t\t\tcase 1:\n\t\t\t\treturn 'sorting_asc';\n\t\t\tcase -1:\n\t\t\t\treturn 'sorting_desc';\n\t\t\tdefault:\n\t\t\t\treturn this.props.sortable ? 'sorting' : null\n\t\t}\n\t}\n\n\thandleSort(e) {\n\t\te.preventDefault();\n\t\tif(!this.props.hasOwnProperty('onSort') || !this.props.sortable) return;\n\n\t\tthis.props.onSort(\n\t\t\tthis.props.columnIndex,\n\t\t\tthis.props.columnKey,\n\t\t\tthis.props.sortDir ? this.props.sortDir*-1 : 1,\n\t\t\tthis.props.sortFunc\n\t\t);\n\t}\n\n\trender () {\n\t\treturn (\n\t\t\t<th onClick={this.handleSort}\n\t\t\t\tclassName={this.getSortClass()}\n\t\t\t\twidth={this.props.width}\n\t\t\t\t>\n\t\t\t\t{this.props.children}\n\t\t\t</th>\n\t\t);\t\n\t}\n\t\n}\n\nTableHeading.propTypes = {\n\tonSort: PropTypes.func,\n\tsortDir: PropTypes.number,\n\tcolumnIndex: PropTypes.number,\n\tcolumnKey: PropTypes.any,\n\tsortable: PropTypes.bool,\n\tsortFunc: PropTypes.func\n};\n\nexport default TableHeading;","import React from 'react';\n\nexport default class TableRow extends React.Component {\n\n constructor(props) {\n super(props);\n\n this.handleEdit = this.handleEdit.bind(this);\n }\n\n shouldDisplayAction(action) {\n let {id} = this.props;\n\n if (!action.hasOwnProperty('display')) {\n return true;\n } else {\n return action.display(id);\n }\n }\n\n handleEdit(id, ev) {\n ev.stopPropagation();\n ev.preventDefault();\n\n this.props.actions.edit.onClick(id);\n }\n\n render() {\n let {even, actions, id, children} = this.props;\n let canEdit = (actions?.edit && this.shouldDisplayAction(actions.edit));\n let rowClass = even ? 'even' : 'odd';\n\n if (canEdit) {\n return (\n <tr role=\"row\" className={rowClass + \" can-edit\"} onClick={this.handleEdit.bind(this, id)}>\n {children}\n </tr>\n );\n } else {\n return (\n <tr role=\"row\" className={rowClass}>\n {children}\n </tr>\n );\n }\n }\n};\n\n","import React from 'react';\n\nexport default class ActionsTableCell extends React.Component {\n\n constructor(props) {\n super(props);\n\n this.handleAction = this.handleAction.bind(this);\n this.shouldDisplayAction = this.shouldDisplayAction.bind(this);\n\n }\n\n shouldDisplayAction(action) {\n let {id} = this.props;\n\n if (!action.hasOwnProperty('display')) {\n return true;\n } else {\n return action.display(id);\n }\n }\n\n handleAction(action, id, ev) {\n ev.stopPropagation();\n ev.preventDefault();\n\n action(id);\n }\n\n render() {\n let {actions, id} = this.props;\n return (\n <td className=\"actions\" key=\"actions\">\n {actions.hasOwnProperty('delete') && this.shouldDisplayAction(actions.delete) &&\n <a href=\"\" data-tip=\"delete\" onClick={this.handleAction.bind(this, actions.delete.onClick, id)} >\n <i className=\"fa fa-trash-o delete-icon\"></i>\n </a>\n }\n {actions.hasOwnProperty('custom') && actions.custom.map(a =>\n this.shouldDisplayAction(a) &&\n <a href=\"\" data-tip={a.tooltip} key={'custom_' + a.name} onClick={this.handleAction.bind(this, a.onClick, id)}>\n {a.icon}\n </a>\n )}\n </td>\n );\n }\n};\n","import React from 'react';\nimport TableHeading from './TableHeading';\nimport TableCell from './TableCell';\nimport TableRow from './TableRow';\nimport ActionsTableCell from './ActionsTableCell';\nimport ReactTooltip from 'react-tooltip'\n\nimport './table.less';\n\nconst defaults = {\n sortFunc: (a,b) => (a < b ? -1 : (a > b ? 1 : 0)),\n sortable: false,\n sortCol: 0,\n sortDir: 1,\n colWidth: ''\n}\n\nconst createRow = (row, columns, actions) => {\n const cells = columns.map((col,i) => {\n const colStyles = col?.styles || {};\n\n if(col.hasOwnProperty(\"render\"))\n return (\n <TableCell key={'cell_'+i} style={colStyles} >\n {col.render(row, row[col.columnKey])}\n </TableCell>\n );\n\n return (\n <TableCell\n key={'cell_'+i}\n title={col.hasOwnProperty(\"title\") ? row[col.columnKey] : null}\n style={colStyles}\n >\n {row[col.columnKey]}\n </TableCell>\n );\n });\n\n if (actions) {\n cells.push(<ActionsTableCell key='actions_cell' id={row['id']} actions={actions} />);\n }\n\n return cells;\n};\n\nconst getSortDir = (columnKey, columnIndex, sortCol, sortDir) => {\n if(columnKey && (columnKey === sortCol)) {\n return sortDir;\n }\n if(sortCol === columnIndex) {\n return sortDir;\n }\n return null\n};\n\nconst Table = (props) => {\n let {options, columns} = props;\n let tableClass = options.hasOwnProperty('className') ? options.className : '';\n tableClass += options.actions?.edit ? ' table-hover' : '';\n\n return (\n <div>\n <table className={\"table table-striped dataTable \" + tableClass}>\n <thead>\n <tr>\n {columns.map((col,i) => {\n\n let sortCol = (typeof options.sortCol != 'undefined') ? options.sortCol : defaults.sortCol;\n let sortDir = (typeof options.sortDir != 'undefined') ? options.sortDir : defaults.sortDir;\n let sortFunc = (typeof options.sortFunc != 'undefined') ? options.sortFunc : defaults.sortFunc;\n let sortable = (typeof col.sortable != 'undefined') ? col.sortable : defaults.sortable;\n let colWidth = (typeof col.width != 'undefined') ? col.width : defaults.colWidth;\n\n return (\n <TableHeading\n onSort={props.onSort}\n sortDir={getSortDir(col.columnKey, i, sortCol, sortDir)}\n sortable={sortable}\n sortFunc={sortFunc}\n columnIndex={i}\n columnKey={col.columnKey}\n width={colWidth}\n key={'heading_'+i}\n >\n {col.value}\n </TableHeading>\n );\n })}\n {options.actions &&\n <TableHeading key='actions_heading' >\n {options.actionsHeader || ' '}\n </TableHeading>\n }\n </tr>\n </thead>\n <tbody>\n {columns.length > 0 && props.data.map((row,i) => {\n if(Array.isArray(row) && row.length !== columns.length) {\n console.warn(`Data at row ${i} is ${row.length}. It should be ${columns.length}.`);\n return <tr key={'row_'+i} />\n }\n\n return (\n <TableRow even={i%2 === 0} key={'row_'+i} id={row['id']} actions={options.actions}>\n {createRow(row, columns, options.actions)}\n </TableRow>\n );\n })}\n </tbody>\n </table>\n <ReactTooltip delayShow={10} />\n </div>\n );\n};\n\nexport default Table;\n"],"names":["root","factory","exports","module","define","amd","this","children","replaceNewLine","className","rest","dangerouslySetInnerHTML","__html","replace","props","value","React","toString","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","TableHeading","constructor","super","handleSort","bind","getSortClass","sortable","sortDir","e","preventDefault","onSort","columnIndex","columnKey","sortFunc","render","onClick","width","propTypes","PropTypes","TableRow","handleEdit","shouldDisplayAction","action","id","display","ev","stopPropagation","actions","edit","even","rowClass","role","ActionsTableCell","handleAction","delete","href","custom","map","tooltip","name","icon","defaults","b","sortCol","colWidth","getSortDir","options","columns","tableClass","col","i","actionsHeader","length","data","row","Array","isArray","console","warn","cells","colStyles","styles","TableCell","style","title","push","createRow","delayShow"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"components/table.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,8BAA+B,GAAIH,GACh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C,UAAWqC,EAAIrC,UACfI,MAAO4B,EACP1D,IAAK,WAAWgE,GAEfD,EAAI/E,MAXb,IAeH4E,EAAQnB,SACL,kBAAC,EAAD,CAAczC,IAAI,mBACb4D,EAAQK,eAAiB,OAKtC,+BACKJ,EAAQK,OAAS,GAAKnF,EAAMoF,KAAKhB,KAAI,CAACiB,EAAIJ,IACpCK,MAAMC,QAAQF,IAAQA,EAAIF,SAAWL,EAAQK,QAC5CK,QAAQC,KAAM,eAAcR,QAAQI,EAAIF,wBAAwBL,EAAQK,WACjE,wBAAIlE,IAAK,OAAOgE,KAIvB,kBAAC/B,EAAD,CAAUU,KAAMqB,EAAE,GAAM,EAAGhE,IAAK,OAAOgE,EAAG3B,GAAI+B,EAAG,GAAQ3B,QAASmB,EAAQnB,SAvFpF,EAAC2B,EAAKP,EAASpB,KAC7B,MAAMgC,EAAQZ,EAAQV,KAAI,CAACY,EAAIC,KAC3B,MAAMU,GAAYX,aAAA,EAAAA,EAAKY,SAAU,CAAC,EAElC,OAAGZ,EAAItD,eAAe,UAEd,kBAACmE,EAAA,EAAD,CAAW5E,IAAK,QAAQgE,EAAGa,MAAOH,GAC7BX,EAAInC,OAAOwC,EAAKA,EAAIL,EAAIrC,aAKjC,kBAACkD,EAAA,EAAD,CACI5E,IAAK,QAAQgE,EACbc,MAAOf,EAAItD,eAAe,SAAW2D,EAAIL,EAAIrC,WAAa,KAC1DmD,MAAOH,GAENN,EAAIL,EAAIrC,WANjB,IAeJ,OAJIe,GACAgC,EAAMM,KAAK,kBAACjC,EAAD,CAAkB9C,IAAI,eAAeqC,GAAI+B,EAAG,GAAQ3B,QAASA,KAGrEgC,CAAP,EA8D6BO,CAAUZ,EAAKP,EAASD,EAAQnB,cAMrD,kBAAC,EAAAwC,QAAD,CAASC,UAAW,KAlD5B,C","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/components/raw-html/index.js","webpack://openstack-uicore-foundation/./src/components/table/TableCell.js","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/extends\"","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/objectWithoutProperties\"","webpack://openstack-uicore-foundation/external commonjs \"prop-types\"","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/external commonjs \"react-tooltip\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/components/table/TableHeading.js","webpack://openstack-uicore-foundation/./src/components/table/TableRow.js","webpack://openstack-uicore-foundation/./src/components/table/ActionsTableCell.js","webpack://openstack-uicore-foundation/./src/components/table/Table.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","import React from 'react';\n\nconst RawHTML = ({children, replaceNewLine = false, className = \"\", ...rest}) =>\n <span className={className}\n dangerouslySetInnerHTML={{ __html: replaceNewLine ? children?.replace(/\\n/g, '<br />') : children}} {...rest}/>\n\nexport default RawHTML;","import React from 'react';\nimport RawHTML from '../raw-html';\n\nconst TableCell = (props) => {\n let {children} = props;\n\tlet value = '';\n\tif(children) {\n\t if (React.isValidElement(children)) {\n\t value = children;\n } else {\n\t value = <RawHTML>{children.toString()}</RawHTML>\n }\n }\n\n\treturn (\n\t\t<td {...props}>\n {value}\n\t\t</td>\n\t);\n};\n\nexport default TableCell;\n","module.exports = require(\"@babel/runtime/helpers/extends\");","module.exports = require(\"@babel/runtime/helpers/objectWithoutProperties\");","module.exports = require(\"prop-types\");","module.exports = require(\"react\");","module.exports = require(\"react-tooltip\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import React from 'react';\nimport PropTypes from 'prop-types';\n\nclass TableHeading extends React.Component {\n\n\tconstructor (props) {\n\t\tsuper(props);\n\t\tthis.handleSort = this.handleSort.bind(this);\n\t}\n\n\tgetSortClass() {\n\n\t\tif (!this.props.sortable) return null;\n\n\t\tswitch(this.props.sortDir) {\n\t\t\tcase 1:\n\t\t\t\treturn 'sorting_asc';\n\t\t\tcase -1:\n\t\t\t\treturn 'sorting_desc';\n\t\t\tdefault:\n\t\t\t\treturn this.props.sortable ? 'sorting' : null\n\t\t}\n\t}\n\n\thandleSort(e) {\n\t\te.preventDefault();\n\t\tif(!this.props.hasOwnProperty('onSort') || !this.props.sortable) return;\n\n\t\tthis.props.onSort(\n\t\t\tthis.props.columnIndex,\n\t\t\tthis.props.columnKey,\n\t\t\tthis.props.sortDir ? this.props.sortDir*-1 : 1,\n\t\t\tthis.props.sortFunc\n\t\t);\n\t}\n\n\trender () {\n\t\treturn (\n\t\t\t<th onClick={this.handleSort}\n\t\t\t\tclassName={this.getSortClass()}\n\t\t\t\twidth={this.props.width}\n\t\t\t\t>\n\t\t\t\t{this.props.children}\n\t\t\t</th>\n\t\t);\t\n\t}\n\t\n}\n\nTableHeading.propTypes = {\n\tonSort: PropTypes.func,\n\tsortDir: PropTypes.number,\n\tcolumnIndex: PropTypes.number,\n\tcolumnKey: PropTypes.any,\n\tsortable: PropTypes.bool,\n\tsortFunc: PropTypes.func\n};\n\nexport default TableHeading;","import React from 'react';\n\nexport default class TableRow extends React.Component {\n\n constructor(props) {\n super(props);\n\n this.handleEdit = this.handleEdit.bind(this);\n }\n\n shouldDisplayAction(action) {\n let {id} = this.props;\n\n if (!action.hasOwnProperty('display')) {\n return true;\n } else {\n return action.display(id);\n }\n }\n\n handleEdit(id, ev) {\n ev.stopPropagation();\n ev.preventDefault();\n\n this.props.actions.edit.onClick(id);\n }\n\n render() {\n let {even, actions, id, children} = this.props;\n let canEdit = (actions?.edit && this.shouldDisplayAction(actions.edit));\n let rowClass = even ? 'even' : 'odd';\n\n if (canEdit) {\n return (\n <tr role=\"row\" className={rowClass + \" can-edit\"} onClick={this.handleEdit.bind(this, id)}>\n {children}\n </tr>\n );\n } else {\n return (\n <tr role=\"row\" className={rowClass}>\n {children}\n </tr>\n );\n }\n }\n};\n\n","import React from 'react';\n\nexport default class ActionsTableCell extends React.Component {\n\n constructor(props) {\n super(props);\n\n this.handleAction = this.handleAction.bind(this);\n this.shouldDisplayAction = this.shouldDisplayAction.bind(this);\n\n }\n\n shouldDisplayAction(action) {\n let {id} = this.props;\n\n if (!action.hasOwnProperty('display')) {\n return true;\n } else {\n return action.display(id);\n }\n }\n\n handleAction(action, id, ev) {\n ev.stopPropagation();\n ev.preventDefault();\n\n action(id);\n }\n\n render() {\n let {actions, id} = this.props;\n return (\n <td className=\"actions\" key=\"actions\">\n {actions.hasOwnProperty('delete') && this.shouldDisplayAction(actions.delete) &&\n <a href=\"\" data-tip=\"delete\" onClick={this.handleAction.bind(this, actions.delete.onClick, id)} >\n <i className=\"fa fa-trash-o delete-icon\"></i>\n </a>\n }\n {actions.hasOwnProperty('custom') && actions.custom.map(a =>\n this.shouldDisplayAction(a) &&\n <a href=\"\" data-tip={a.tooltip} key={'custom_' + a.name} onClick={this.handleAction.bind(this, a.onClick, id)}>\n {a.icon}\n </a>\n )}\n </td>\n );\n }\n};\n","import React from 'react';\nimport TableHeading from './TableHeading';\nimport TableCell from './TableCell';\nimport TableRow from './TableRow';\nimport ActionsTableCell from './ActionsTableCell';\nimport { Tooltip } from 'react-tooltip';\n\nimport './table.less';\n\nconst defaults = {\n sortFunc: (a,b) => (a < b ? -1 : (a > b ? 1 : 0)),\n sortable: false,\n sortCol: 0,\n sortDir: 1,\n colWidth: ''\n}\n\nconst createRow = (row, columns, actions) => {\n const cells = columns.map((col,i) => {\n const colStyles = col?.styles || {};\n\n if(col.hasOwnProperty(\"render\"))\n return (\n <TableCell key={'cell_'+i} style={colStyles} >\n {col.render(row, row[col.columnKey])}\n </TableCell>\n );\n\n return (\n <TableCell\n key={'cell_'+i}\n title={col.hasOwnProperty(\"title\") ? row[col.columnKey] : null}\n style={colStyles}\n >\n {row[col.columnKey]}\n </TableCell>\n );\n });\n\n if (actions) {\n cells.push(<ActionsTableCell key='actions_cell' id={row['id']} actions={actions} />);\n }\n\n return cells;\n};\n\nconst getSortDir = (columnKey, columnIndex, sortCol, sortDir) => {\n if(columnKey && (columnKey === sortCol)) {\n return sortDir;\n }\n if(sortCol === columnIndex) {\n return sortDir;\n }\n return null\n};\n\nconst Table = (props) => {\n let {options, columns} = props;\n let tableClass = options.hasOwnProperty('className') ? options.className : '';\n tableClass += options.actions?.edit ? ' table-hover' : '';\n\n return (\n <div>\n <table className={\"table table-striped dataTable \" + tableClass}>\n <thead>\n <tr>\n {columns.map((col,i) => {\n\n let sortCol = (typeof options.sortCol != 'undefined') ? options.sortCol : defaults.sortCol;\n let sortDir = (typeof options.sortDir != 'undefined') ? options.sortDir : defaults.sortDir;\n let sortFunc = (typeof options.sortFunc != 'undefined') ? options.sortFunc : defaults.sortFunc;\n let sortable = (typeof col.sortable != 'undefined') ? col.sortable : defaults.sortable;\n let colWidth = (typeof col.width != 'undefined') ? col.width : defaults.colWidth;\n\n return (\n <TableHeading\n onSort={props.onSort}\n sortDir={getSortDir(col.columnKey, i, sortCol, sortDir)}\n sortable={sortable}\n sortFunc={sortFunc}\n columnIndex={i}\n columnKey={col.columnKey}\n width={colWidth}\n key={'heading_'+i}\n >\n {col.value}\n </TableHeading>\n );\n })}\n {options.actions &&\n <TableHeading key='actions_heading' >\n {options.actionsHeader || ' '}\n </TableHeading>\n }\n </tr>\n </thead>\n <tbody>\n {columns.length > 0 && props.data.map((row,i) => {\n if(Array.isArray(row) && row.length !== columns.length) {\n console.warn(`Data at row ${i} is ${row.length}. It should be ${columns.length}.`);\n return <tr key={'row_'+i} />\n }\n\n return (\n <TableRow even={i%2 === 0} key={'row_'+i} id={row['id']} actions={options.actions}>\n {createRow(row, columns, options.actions)}\n </TableRow>\n );\n })}\n </tbody>\n </table>\n <Tooltip delayShow={10} />\n </div>\n );\n};\n\nexport default Table;\n"],"names":["root","factory","exports","module","define","amd","this","children","replaceNewLine","className","rest","dangerouslySetInnerHTML","__html","replace","props","value","React","toString","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","TableHeading","constructor","super","handleSort","bind","getSortClass","sortable","sortDir","e","preventDefault","onSort","columnIndex","columnKey","sortFunc","render","onClick","width","propTypes","PropTypes","TableRow","handleEdit","shouldDisplayAction","action","id","display","ev","stopPropagation","actions","edit","even","rowClass","role","ActionsTableCell","handleAction","delete","href","custom","map","tooltip","name","icon","defaults","b","sortCol","colWidth","getSortDir","options","columns","tableClass","col","i","actionsHeader","length","data","row","Array","isArray","console","warn","cells","colStyles","styles","TableCell","style","title","push","createRow","Tooltip","delayShow"],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openstack-uicore-foundation",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.94",
|
|
4
4
|
"description": "ui reactjs components for openstack marketing site",
|
|
5
5
|
"main": "lib/openstack-uicore-foundation.js",
|
|
6
6
|
"scripts": {
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"jest": "^28.1.0",
|
|
47
47
|
"jest-environment-jsdom": "^28.1.0",
|
|
48
48
|
"jest-transform-stub": "^2.0.0",
|
|
49
|
-
"jodit-react": "^5.0.10",
|
|
50
49
|
"js-cookie": "^3.0.5",
|
|
51
50
|
"js-yaml": "^4.1.0",
|
|
52
51
|
"js-yaml-loader": "^1.2.2",
|
|
@@ -74,7 +73,7 @@
|
|
|
74
73
|
"react-rte": "^0.16.3",
|
|
75
74
|
"react-select": "^2.4.3",
|
|
76
75
|
"react-star-ratings": "^2.3.0",
|
|
77
|
-
"react-tooltip": "^
|
|
76
|
+
"react-tooltip": "^5.28.0",
|
|
78
77
|
"redux": "^3.7.2",
|
|
79
78
|
"redux-mock-store": "^1.5.4",
|
|
80
79
|
"redux-persist": "^5.10.0",
|
|
@@ -111,7 +110,6 @@
|
|
|
111
110
|
"i18n-react": "^0.6.4",
|
|
112
111
|
"idtoken-verifier": "^2.2.2",
|
|
113
112
|
"immutability-helper": "^2.7.1",
|
|
114
|
-
"jodit-react": "^5.0.10",
|
|
115
113
|
"js-cookie": "^3.0.5",
|
|
116
114
|
"lodash": "^4.17.14",
|
|
117
115
|
"moment": "^2.22.2",
|