@iobroker/adapter-react-v5 3.2.3 → 3.2.5
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/Components/FileBrowser.js +2 -2
- package/Components/FileBrowser.js.map +1 -1
- package/Components/ObjectBrowser.js +11 -5
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/Router.js.map +1 -1
- package/Components/TableResize.js.map +1 -1
- package/Components/Utils.js +11 -4
- package/Components/Utils.js.map +1 -1
- package/Dialogs/SelectID.d.ts +1 -0
- package/Dialogs/SelectID.js +14 -6
- package/Dialogs/SelectID.js.map +1 -1
- package/GenericApp.js.map +1 -1
- package/README.md +6 -0
- package/package.json +5 -5
package/Components/Router.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.js","names":["Router","props","onHashChangedBound","onHashChanged","bind","window","addEventListener","removeEventListener","hash","location","replace","parts","split","map","item","decodeURIComponent","e","console","error","tab","dialog","id","arg","getLocation","undefined","React","Component"],"sources":["Router.js"],"sourcesContent":["// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\nimport React from 'react';\n\n/**\n * @template P Type of the properties object.\n * @template S Type of the internal state object.\n * @extends {React.Component<P, S>}\n */\nclass Router extends React.Component {\n /**\n * @param {P} props The React properties of this component.\n */\n constructor(props) {\n super(props);\n this.onHashChangedBound = this.onHashChanged.bind(this);\n }\n\n componentDidMount() {\n window.addEventListener('hashchange', this.onHashChangedBound);\n }\n\n componentWillUnmount() {\n window.removeEventListener('hashchange', this.onHashChangedBound);\n }\n\n onHashChanged() {\n // override this function\n }\n\n /**\n * Gets the location object.\n * @returns {{ tab: string; dialog: string; id: string; arg: string; }}\n */\n static getLocation() {\n let hash = window.location.hash;\n hash = hash.replace(/^#/, '');\n const parts = hash.split('/').map(item => {\n try {\n return item ? decodeURIComponent(item) : ''\n } catch (e) {\n console.error('Router: Cannot decode ' + item);\n return item || '';\n }\n });\n // #tabName/dialogName/deviceId\n return {\n tab: parts[0] || '',\n dialog: parts[1] || '',\n id: parts[2] || '',\n arg: parts[3] || ''\n };\n }\n\n /**\n * Navigate to a new location. Any parameters that are not set will be taken from the current location.\n * @param {string | undefined} [tab]\n * @param {string | undefined} [dialog]\n * @param {string | undefined} [id]\n * @param {string | undefined} [arg]\n */\n static doNavigate(tab, dialog, id, arg) {\n let hash = '';\n const location = Router.getLocation();\n if (arg !== undefined && !id) {\n id = location.id;\n }\n if (id && !dialog) {\n dialog = location.dialog;\n }\n if (dialog && !tab) {\n tab = location.tab;\n } else\n if (tab === null) {\n tab = location.tab;\n }\n\n if (tab) {\n hash = '#' + tab;\n if (dialog) {\n hash += '/' + dialog;\n\n if (id) {\n hash += '/' + id;\n if (arg !== undefined) {\n hash += '/' + arg;\n }\n }\n }\n }\n if (window.location.hash !== hash) {\n window.location.hash = hash;\n }\n }\n}\n\nexport default Router;"],"mappings":";;;;;;;;;;;;;AACA;AAA0B;AAAA;AAE1B;AACA;AACA;AACA;AACA;AAJA,IAKMA,MAAM;EAAA;EAAA;EACR;AACJ;AACA;EACI,gBAAYC,KAAK,EAAE;IAAA;IAAA;IACf,0BAAMA,KAAK;IACX,MAAKC,kBAAkB,GAAG,MAAKC,aAAa,CAACC,IAAI,gDAAM;IAAC;EAC5D;EAAC;IAAA;IAAA,OAED,6BAAoB;MAChBC,MAAM,CAACC,gBAAgB,CAAC,YAAY,EAAE,IAAI,CAACJ,kBAAkB,CAAC;IAClE;EAAC;IAAA;IAAA,OAED,gCAAuB;MACnBG,MAAM,CAACE,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAACL,kBAAkB,CAAC;IACrE;EAAC;IAAA;IAAA,OAED,yBAAgB;MACZ;
|
|
1
|
+
{"version":3,"file":"Router.js","names":["Router","props","onHashChangedBound","onHashChanged","bind","window","addEventListener","removeEventListener","hash","location","replace","parts","split","map","item","decodeURIComponent","e","console","error","tab","dialog","id","arg","getLocation","undefined","React","Component"],"sources":["Router.js"],"sourcesContent":["// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\nimport React from 'react';\n\n/**\n * @template P Type of the properties object.\n * @template S Type of the internal state object.\n * @extends {React.Component<P, S>}\n */\nclass Router extends React.Component {\n /**\n * @param {P} props The React properties of this component.\n */\n constructor(props) {\n super(props);\n this.onHashChangedBound = this.onHashChanged.bind(this);\n }\n\n componentDidMount() {\n window.addEventListener('hashchange', this.onHashChangedBound);\n }\n\n componentWillUnmount() {\n window.removeEventListener('hashchange', this.onHashChangedBound);\n }\n\n onHashChanged() {\n // override this function\n }\n\n /**\n * Gets the location object.\n * @returns {{ tab: string; dialog: string; id: string; arg: string; }}\n */\n static getLocation() {\n let hash = window.location.hash;\n hash = hash.replace(/^#/, '');\n const parts = hash.split('/').map(item => {\n try {\n return item ? decodeURIComponent(item) : ''\n } catch (e) {\n console.error('Router: Cannot decode ' + item);\n return item || '';\n }\n });\n // #tabName/dialogName/deviceId\n return {\n tab: parts[0] || '',\n dialog: parts[1] || '',\n id: parts[2] || '',\n arg: parts[3] || ''\n };\n }\n\n /**\n * Navigate to a new location. Any parameters that are not set will be taken from the current location.\n * @param {string | undefined} [tab]\n * @param {string | undefined} [dialog]\n * @param {string | undefined} [id]\n * @param {string | undefined} [arg]\n */\n static doNavigate(tab, dialog, id, arg) {\n let hash = '';\n const location = Router.getLocation();\n if (arg !== undefined && !id) {\n id = location.id;\n }\n if (id && !dialog) {\n dialog = location.dialog;\n }\n if (dialog && !tab) {\n tab = location.tab;\n } else\n if (tab === null) {\n tab = location.tab;\n }\n\n if (tab) {\n hash = '#' + tab;\n if (dialog) {\n hash += '/' + dialog;\n\n if (id) {\n hash += '/' + id;\n if (arg !== undefined) {\n hash += '/' + arg;\n }\n }\n }\n }\n if (window.location.hash !== hash) {\n window.location.hash = hash;\n }\n }\n}\n\nexport default Router;"],"mappings":";;;;;;;;;;;;;AACA;AAA0B;AAAA;AAE1B;AACA;AACA;AACA;AACA;AAJA,IAKMA,MAAM;EAAA;EAAA;E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oBAAkBQ,GAAG,EAAEC,MAAM,EAAEC,EAAE,EAAEC,GAAG,EAAE;MACpC,IAAId,IAAI,GAAG,EAAE;MACb,IAAMC,QAAQ,GAAGT,MAAM,CAACuB,WAAW,EAAE;MACrC,IAAID,GAAG,KAAKE,SAAS,IAAI,CAACH,EAAE,EAAE;QAC1BA,EAAE,GAAGZ,QAAQ,CAACY,EAAE;MACpB;MACA,IAAIA,EAAE,IAAI,CAACD,MAAM,EAAE;QACfA,MAAM,GAAGX,QAAQ,CAACW,MAAM;MAC5B;MACA,IAAIA,MAAM,IAAI,CAACD,GAAG,EAAE;QAChBA,GAAG,GAAGV,QAAQ,CAACU,GAAG;MACtB,CAAC,MACD,IAAIA,GAAG,KAAK,IAAI,EAAE;QACdA,GAAG,GAAGV,QAAQ,CAACU,GAAG;MACtB;MAEA,IAAIA,GAAG,EAAE;QACLX,IAAI,GAAG,GAAG,GAAGW,GAAG;QAChB,IAAIC,MAAM,EAAE;UACRZ,IAAI,IAAI,GAAG,GAAGY,MAAM;UAEpB,IAAIC,EAAE,EAAE;YACJb,IAAI,IAAI,GAAG,GAAGa,EAAE;YAChB,IAAIC,GAAG,KAAKE,SAAS,EAAE;cACnBhB,IAAI,IAAI,GAAG,GAAGc,GAAG;YACrB;UACJ;QACJ;MACJ;MACA,IAAIjB,MAAM,CAACI,QAAQ,CAACD,IAAI,KAAKA,IAAI,EAAE;QAC/BH,MAAM,CAACI,QAAQ,CAACD,IAAI,GAAGA,IAAI;MAC/B;IACJ;EAAC;EAAA;AAAA,EApFgBiB,iBAAK,CAACC,SAAS;AAAA,eAuFrB1B,MAAM;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableResize.js","names":["styles","theme","table","display","position","userSelect","cursor","width","right","top","bottom","zIndex","borderRight","borderColor","borderRightStyle","TableResize","props","c","resizerCurrentWidths","length","initialWidths","window","_localStorage","localStorage","setItem","name","JSON","stringify","resizerApplyWidths","e","resizerActiveDiv","resizerOldWidth","clientX","resizerPosition","widthNext","resizerOldWidthNext","resizerMin","resizerMinNext","resizerActiveIndex","removeEventListener","resizerMouseMove","resizerMouseUp","undefined","console","log","target","dataset","index","parseInt","minWidths","ths","resizerRefTable","current","querySelectorAll","offsetWidth","addEventListener","React","createRef","resizerInstall","resizerUninstall","_installed","widthsStored","getItem","widthFilled","parse","tableWidth","storedWidth","w","isFinite","Math","abs","i","push","div","document","createElement","toString","onmousedown","resizerMouseDown","ondblclick","resizerReset","title","dblTitle","className","appendChild","installTimeout","setTimeout","clearTimeout","querySelector","remove","gridTemplateColumns","style","join","ready","stickyHeader","size","classes","Object","assign","children","Component","propTypes","PropTypes","string","bool","object","array","withStyles"],"sources":["TableResize.jsx"],"sourcesContent":["/**\n * Copyright 2022, bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n **/\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles} from '@mui/styles';\n\nimport Table from '@mui/material/Table';\nimport Skeleton from '@mui/material/Skeleton';\n\nconst styles = theme => ({\n table: {\n display: 'grid',\n '& tr': {\n display: 'contents',\n },\n '& thead': {\n display: 'contents',\n },\n '& tbody': {\n display: 'contents',\n },\n '& th': { // resizer\n position: 'sticky',\n userSelect: 'none',\n },\n '& .resize-handle': { // resizer\n display: 'block',\n position: 'absolute',\n cursor: 'col-resize',\n width: 7,\n right: 0,\n top: 2,\n bottom: 2,\n zIndex: 1,\n borderRight: '2px dotted #888',\n '&:hover': {\n borderColor: '#ccc',\n borderRightStyle: 'solid',\n }\n , '&.active': {\n borderColor: '#517ea5',\n borderRightStyle: 'solid',\n }\n }\n },\n});\n\nclass TableResize extends Component {\n constructor(props) {\n super(props);\n this.resizerRefTable = React.createRef();\n this.resizerActiveIndex = null;\n this.resizerActiveDiv = null;\n this.resizerCurrentWidths = [];\n }\n\n componentDidMount() {\n this.resizerInstall();\n }\n\n componentWillUnmount() {\n this.resizerUninstall();\n }\n\n resizerInstall() {\n if (this.resizerRefTable.current && !this.resizerRefTable.current._installed) {\n this.resizerRefTable.current._installed = true;\n const ths = this.resizerRefTable.current.querySelectorAll('th');\n\n const widthsStored = (window._localStorage || window.localStorage).getItem(`App.${this.props.name || 'history'}.table`);\n this.widthFilled = false;\n\n if (widthsStored) {\n try {\n this.resizerCurrentWidths = JSON.parse(widthsStored);\n this.widthFilled = true;\n } catch (e) {\n // ignore\n }\n }\n if (this.widthFilled) {\n if (this.resizerCurrentWidths.length !== ths.length) {\n this.resizerCurrentWidths = [];\n this.widthFilled = false;\n } else {\n const tableWidth = this.resizerRefTable.current.offsetWidth;\n let storedWidth = 0;\n for (let w = 0; w < this.resizerCurrentWidths.length; w++) {\n if (isFinite(this.resizerCurrentWidths[w])) {\n storedWidth += this.resizerCurrentWidths[w];\n } else {\n storedWidth = null;\n break;\n }\n }\n if (storedWidth !== null && Math.abs(storedWidth - tableWidth) > 20) {\n this.resizerCurrentWidths = [];\n this.widthFilled = false;\n }\n }\n }\n\n for (let i = 0; i < ths.length; i++) {\n !this.widthFilled && this.resizerCurrentWidths.push(ths[i].offsetWidth);\n\n // last column does need handle\n if (i < ths.length - 1) {\n const div = window.document.createElement('div');\n div.dataset.index = i.toString();\n div.onmousedown = this.resizerMouseDown;\n div.ondblclick = this.resizerReset;\n div.title = this.props.dblTitle || 'Double click to reset table layout';\n div.className = 'resize-handle';\n ths[i].appendChild(div);\n }\n }\n if (this.widthFilled) {\n this.resizerApplyWidths();\n }\n } else {\n this.installTimeout = setTimeout(() => {\n this.installTimeout = null;\n this.resizerInstall()\n }, 100);\n }\n }\n\n resizerReset = () => {\n for (let c = 0; c < this.resizerCurrentWidths.length; c++) {\n this.resizerCurrentWidths[c] = (this.props.initialWidths || [])[c] || 'auto';\n }\n\n (window._localStorage || window.localStorage).setItem(`App.${this.props.name || 'history'}.table`, JSON.stringify(this.resizerCurrentWidths));\n this.resizerApplyWidths();\n }\n\n resizerUninstall() {\n this.installTimeout && clearTimeout(this.installTimeout);\n\n // resizer\n if (this.resizerRefTable.current && this.resizerRefTable.current._installed) {\n this.resizerRefTable.current._installed = true;\n const ths = this.resizerRefTable.current.querySelectorAll('th');\n for (let i = 0; i < ths.length; i++) {\n const div = ths[i].querySelector('.resize-handle');\n if (div) {\n div.onmousedown = null;\n div.remove();\n }\n }\n }\n }\n\n resizerApplyWidths() {\n const gridTemplateColumns = [];\n if (this.resizerCurrentWidths.length) {\n for (let c = 0; c < this.resizerCurrentWidths.length; c++) {\n if (this.resizerCurrentWidths[c]) {\n gridTemplateColumns.push(this.resizerCurrentWidths[c] !== 'auto' ? this.resizerCurrentWidths[c] + 'px' : 'auto');\n } else if (this.props.initialWidths && this.props.initialWidths[c]) {\n gridTemplateColumns.push(this.props.initialWidths[c] !== 'auto' ? this.props.initialWidths[c] + 'px' : 'auto');\n } else {\n gridTemplateColumns.push('auto');\n }\n }\n } else if (this.props.initialWidths) {\n for (let c = 0; c < this.props.initialWidths.length; c++) {\n if (this.props.initialWidths[c]) {\n gridTemplateColumns.push(this.props.initialWidths[c] !== 'auto' ? this.props.initialWidths[c] + 'px' : 'auto');\n } else {\n gridTemplateColumns.push('auto');\n }\n }\n }\n\n if (this.resizerRefTable.current && gridTemplateColumns.length) {\n this.resizerRefTable.current.style.gridTemplateColumns = gridTemplateColumns.join(' ');\n }\n\n return gridTemplateColumns.length ? gridTemplateColumns.join(' ') : undefined;\n }\n\n resizerMouseMove = e => {\n if (this.resizerActiveDiv) {\n const width = this.resizerOldWidth + e.clientX - this.resizerPosition;\n const widthNext = this.resizerOldWidthNext - e.clientX + this.resizerPosition;\n if ((!this.resizerMin || width > this.resizerMin) &&\n (!this.resizerMinNext || widthNext > this.resizerMinNext)) {\n this.resizerCurrentWidths[this.resizerActiveIndex] = width;\n this.resizerCurrentWidths[this.resizerActiveIndex + 1] = widthNext;\n this.resizerApplyWidths();\n }\n }\n }\n\n resizerMouseUp = () => {\n (window._localStorage || window.localStorage).setItem(`App.${this.props.name || 'history'}.table`, JSON.stringify(this.resizerCurrentWidths));\n\n this.resizerActiveIndex = null;\n this.resizerActiveDiv = null;\n window.removeEventListener('mousemove', this.resizerMouseMove);\n window.removeEventListener('mouseup', this.resizerMouseUp);\n }\n\n resizerMouseDown = e => {\n if (this.resizerActiveIndex === null || this.resizerActiveIndex === undefined) {\n console.log('Mouse down ' + e.target.dataset.index);\n this.resizerActiveIndex = parseInt(e.target.dataset.index, 10);\n this.resizerActiveDiv = e.target;\n this.resizerMin = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex] : 0;\n this.resizerMinNext = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex + 1] : 0;\n this.resizerPosition = e.clientX;\n let ths;\n if (this.resizerCurrentWidths[this.resizerActiveIndex] === 'auto') {\n ths = ths || this.resizerRefTable.current.querySelectorAll('th');\n this.resizerCurrentWidths[this.resizerActiveIndex] = ths[this.resizerActiveIndex].offsetWidth;\n }\n if (this.resizerCurrentWidths[this.resizerActiveIndex + 1] === 'auto') {\n ths = ths || this.resizerRefTable.current.querySelectorAll('th');\n this.resizerCurrentWidths[this.resizerActiveIndex + 1] = ths[this.resizerActiveIndex + 1].offsetWidth;\n }\n\n this.resizerOldWidth = this.resizerCurrentWidths[this.resizerActiveIndex];\n this.resizerOldWidthNext = this.resizerCurrentWidths[this.resizerActiveIndex + 1];\n\n window.addEventListener('mousemove', this.resizerMouseMove);\n window.addEventListener('mouseup', this.resizerMouseUp);\n }\n };\n\n render() {\n if (this.props.ready === false) {\n return <Skeleton />;\n }\n\n const style = { gridTemplateColumns: this.resizerApplyWidths() };\n\n return <Table\n stickyHeader={this.props.stickyHeader}\n size={this.props.size || 'small'}\n className={ this.props.classes.table + (this.props.className ? ' ' + this.props.className : '')}\n ref={ this.resizerRefTable }\n style={ Object.assign({}, this.props.style || {}, style) }\n >\n { this.props.children }\n </Table>;\n }\n}\n\nTableResize.propTypes = {\n name: PropTypes.string,\n ready: PropTypes.bool,\n stickyHeader: PropTypes.bool,\n size: PropTypes.string,\n className: PropTypes.string,\n style: PropTypes.object,\n initialWidths: PropTypes.array,\n minWidths: PropTypes.array,\n dblTitle: PropTypes.string,\n};\n\nexport default withStyles(styles)(TableResize);"],"mappings":";;;;;;;;;;;;;;;AAMA;AACA;AACA;AAEA;AACA;AAA8C;AAAA;AAAA;AAAA;AAE9C,IAAMA,MAAM,GAAG,SAATA,MAAM,CAAGC,KAAK;EAAA,OAAK;IACrBC,KAAK,EAAE;MACHC,OAAO,EAAE,MAAM;MACf,MAAM,EAAE;QACJA,OAAO,EAAE;MACb,CAAC;MACD,SAAS,EAAE;QACPA,OAAO,EAAE;MACb,CAAC;MACD,SAAS,EAAE;QACPA,OAAO,EAAE;MACb,CAAC;MACD,MAAM,EAAE;QAAE;QACNC,QAAQ,EAAE,QAAQ;QAClBC,UAAU,EAAE;MAChB,CAAC;MACD,kBAAkB,EAAE;QAAE;QAClBF,OAAO,EAAE,OAAO;QAChBC,QAAQ,EAAE,UAAU;QACpBE,MAAM,EAAE,YAAY;QACpBC,KAAK,EAAE,CAAC;QACRC,KAAK,EAAE,CAAC;QACRC,GAAG,EAAE,CAAC;QACNC,MAAM,EAAE,CAAC;QACTC,MAAM,EAAE,CAAC;QACTC,WAAW,EAAE,iBAAiB;QAC9B,SAAS,EAAE;UACPC,WAAW,EAAE,MAAM;UACnBC,gBAAgB,EAAE;QACtB,CAAC;QACC,UAAU,EAAE;UACVD,WAAW,EAAE,SAAS;UACtBC,gBAAgB,EAAE;QACtB;MACJ;IACJ;EACJ,CAAC;AAAA,CAAC;AAAC,IAEGC,WAAW;EAAA;EAAA;EACb,qBAAYC,KAAK,EAAE;IAAA;IAAA;IACf,0BAAMA,KAAK;IAAE,iGA8EF,YAAM;MACjB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,MAAKC,oBAAoB,CAACC,MAAM,EAAEF,CAAC,EAAE,EAAE;QACvD,MAAKC,oBAAoB,CAACD,CAAC,CAAC,GAAG,CAAC,MAAKD,KAAK,CAACI,aAAa,IAAI,EAAE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AC,CAAC,CAAC,EAAE,IAAI,CAAClF,KAAK,CAAC2E,KAAK,IAAI,CAAC,CAAC,EAAEA,KAAK;MAAG,GAExD,IAAI,CAAC3E,KAAK,CAACmF,QAAQ,CACjB;IACZ;EAAC;EAAA;AAAA,EAvMqBC,gBAAS;AA0MnCrF,WAAW,CAACsF,SAAS,GAAG;EACpB5E,IAAI,EAAE6E,qBAAS,CAACC,MAAM;EACtBV,KAAK,EAAES,qBAAS,CAACE,IAAI;EACrBV,YAAY,EAAEQ,qBAAS,CAACE,IAAI;EAC5BT,IAAI,EAAEO,qBAAS,CAACC,MAAM;EACtBpB,SAAS,EAAEmB,qBAAS,CAACC,MAAM;EAC3BZ,KAAK,EAAEW,qBAAS,CAACG,MAAM;EACvBrF,aAAa,EAAEkF,qBAAS,CAACI,KAAK;EAC9BzD,SAAS,EAAEqD,qBAAS,CAACI,KAAK;EAC1BxB,QAAQ,EAAEoB,qBAAS,CAACC;AACxB,CAAC;AAAC,eAEa,IAAAI,kBAAU,EAAC3G,MAAM,CAAC,CAACe,WAAW,CAAC;AAAA"}
|
|
1
|
+
{"version":3,"file":"TableResize.js","names":["styles","theme","table","display","position","userSelect","cursor","width","right","top","bottom","zIndex","borderRight","borderColor","borderRightStyle","TableResize","props","c","resizerCurrentWidths","length","initialWidths","window","_localStorage","localStorage","setItem","name","JSON","stringify","resizerApplyWidths","e","resizerActiveDiv","resizerOldWidth","clientX","resizerPosition","widthNext","resizerOldWidthNext","resizerMin","resizerMinNext","resizerActiveIndex","removeEventListener","resizerMouseMove","resizerMouseUp","undefined","console","log","target","dataset","index","parseInt","minWidths","ths","resizerRefTable","current","querySelectorAll","offsetWidth","addEventListener","React","createRef","resizerInstall","resizerUninstall","_installed","widthsStored","getItem","widthFilled","parse","tableWidth","storedWidth","w","isFinite","Math","abs","i","push","div","document","createElement","toString","onmousedown","resizerMouseDown","ondblclick","resizerReset","title","dblTitle","className","appendChild","installTimeout","setTimeout","clearTimeout","querySelector","remove","gridTemplateColumns","style","join","ready","stickyHeader","size","classes","Object","assign","children","Component","propTypes","PropTypes","string","bool","object","array","withStyles"],"sources":["TableResize.jsx"],"sourcesContent":["/**\n * Copyright 2022, bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n **/\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles} from '@mui/styles';\n\nimport Table from '@mui/material/Table';\nimport Skeleton from '@mui/material/Skeleton';\n\nconst styles = theme => ({\n table: {\n display: 'grid',\n '& tr': {\n display: 'contents',\n },\n '& thead': {\n display: 'contents',\n },\n '& tbody': {\n display: 'contents',\n },\n '& th': { // resizer\n position: 'sticky',\n userSelect: 'none',\n },\n '& .resize-handle': { // resizer\n display: 'block',\n position: 'absolute',\n cursor: 'col-resize',\n width: 7,\n right: 0,\n top: 2,\n bottom: 2,\n zIndex: 1,\n borderRight: '2px dotted #888',\n '&:hover': {\n borderColor: '#ccc',\n borderRightStyle: 'solid',\n }\n , '&.active': {\n borderColor: '#517ea5',\n borderRightStyle: 'solid',\n }\n }\n },\n});\n\nclass TableResize extends Component {\n constructor(props) {\n super(props);\n this.resizerRefTable = React.createRef();\n this.resizerActiveIndex = null;\n this.resizerActiveDiv = null;\n this.resizerCurrentWidths = [];\n }\n\n componentDidMount() {\n this.resizerInstall();\n }\n\n componentWillUnmount() {\n this.resizerUninstall();\n }\n\n resizerInstall() {\n if (this.resizerRefTable.current && !this.resizerRefTable.current._installed) {\n this.resizerRefTable.current._installed = true;\n const ths = this.resizerRefTable.current.querySelectorAll('th');\n\n const widthsStored = (window._localStorage || window.localStorage).getItem(`App.${this.props.name || 'history'}.table`);\n this.widthFilled = false;\n\n if (widthsStored) {\n try {\n this.resizerCurrentWidths = JSON.parse(widthsStored);\n this.widthFilled = true;\n } catch (e) {\n // ignore\n }\n }\n if (this.widthFilled) {\n if (this.resizerCurrentWidths.length !== ths.length) {\n this.resizerCurrentWidths = [];\n this.widthFilled = false;\n } else {\n const tableWidth = this.resizerRefTable.current.offsetWidth;\n let storedWidth = 0;\n for (let w = 0; w < this.resizerCurrentWidths.length; w++) {\n if (isFinite(this.resizerCurrentWidths[w])) {\n storedWidth += this.resizerCurrentWidths[w];\n } else {\n storedWidth = null;\n break;\n }\n }\n if (storedWidth !== null && Math.abs(storedWidth - tableWidth) > 20) {\n this.resizerCurrentWidths = [];\n this.widthFilled = false;\n }\n }\n }\n\n for (let i = 0; i < ths.length; i++) {\n !this.widthFilled && this.resizerCurrentWidths.push(ths[i].offsetWidth);\n\n // last column does need handle\n if (i < ths.length - 1) {\n const div = window.document.createElement('div');\n div.dataset.index = i.toString();\n div.onmousedown = this.resizerMouseDown;\n div.ondblclick = this.resizerReset;\n div.title = this.props.dblTitle || 'Double click to reset table layout';\n div.className = 'resize-handle';\n ths[i].appendChild(div);\n }\n }\n if (this.widthFilled) {\n this.resizerApplyWidths();\n }\n } else {\n this.installTimeout = setTimeout(() => {\n this.installTimeout = null;\n this.resizerInstall()\n }, 100);\n }\n }\n\n resizerReset = () => {\n for (let c = 0; c < this.resizerCurrentWidths.length; c++) {\n this.resizerCurrentWidths[c] = (this.props.initialWidths || [])[c] || 'auto';\n }\n\n (window._localStorage || window.localStorage).setItem(`App.${this.props.name || 'history'}.table`, JSON.stringify(this.resizerCurrentWidths));\n this.resizerApplyWidths();\n }\n\n resizerUninstall() {\n this.installTimeout && clearTimeout(this.installTimeout);\n\n // resizer\n if (this.resizerRefTable.current && this.resizerRefTable.current._installed) {\n this.resizerRefTable.current._installed = true;\n const ths = this.resizerRefTable.current.querySelectorAll('th');\n for (let i = 0; i < ths.length; i++) {\n const div = ths[i].querySelector('.resize-handle');\n if (div) {\n div.onmousedown = null;\n div.remove();\n }\n }\n }\n }\n\n resizerApplyWidths() {\n const gridTemplateColumns = [];\n if (this.resizerCurrentWidths.length) {\n for (let c = 0; c < this.resizerCurrentWidths.length; c++) {\n if (this.resizerCurrentWidths[c]) {\n gridTemplateColumns.push(this.resizerCurrentWidths[c] !== 'auto' ? this.resizerCurrentWidths[c] + 'px' : 'auto');\n } else if (this.props.initialWidths && this.props.initialWidths[c]) {\n gridTemplateColumns.push(this.props.initialWidths[c] !== 'auto' ? this.props.initialWidths[c] + 'px' : 'auto');\n } else {\n gridTemplateColumns.push('auto');\n }\n }\n } else if (this.props.initialWidths) {\n for (let c = 0; c < this.props.initialWidths.length; c++) {\n if (this.props.initialWidths[c]) {\n gridTemplateColumns.push(this.props.initialWidths[c] !== 'auto' ? this.props.initialWidths[c] + 'px' : 'auto');\n } else {\n gridTemplateColumns.push('auto');\n }\n }\n }\n\n if (this.resizerRefTable.current && gridTemplateColumns.length) {\n this.resizerRefTable.current.style.gridTemplateColumns = gridTemplateColumns.join(' ');\n }\n\n return gridTemplateColumns.length ? gridTemplateColumns.join(' ') : undefined;\n }\n\n resizerMouseMove = e => {\n if (this.resizerActiveDiv) {\n const width = this.resizerOldWidth + e.clientX - this.resizerPosition;\n const widthNext = this.resizerOldWidthNext - e.clientX + this.resizerPosition;\n if ((!this.resizerMin || width > this.resizerMin) &&\n (!this.resizerMinNext || widthNext > this.resizerMinNext)) {\n this.resizerCurrentWidths[this.resizerActiveIndex] = width;\n this.resizerCurrentWidths[this.resizerActiveIndex + 1] = widthNext;\n this.resizerApplyWidths();\n }\n }\n }\n\n resizerMouseUp = () => {\n (window._localStorage || window.localStorage).setItem(`App.${this.props.name || 'history'}.table`, JSON.stringify(this.resizerCurrentWidths));\n\n this.resizerActiveIndex = null;\n this.resizerActiveDiv = null;\n window.removeEventListener('mousemove', this.resizerMouseMove);\n window.removeEventListener('mouseup', this.resizerMouseUp);\n }\n\n resizerMouseDown = e => {\n if (this.resizerActiveIndex === null || this.resizerActiveIndex === undefined) {\n console.log('Mouse down ' + e.target.dataset.index);\n this.resizerActiveIndex = parseInt(e.target.dataset.index, 10);\n this.resizerActiveDiv = e.target;\n this.resizerMin = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex] : 0;\n this.resizerMinNext = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex + 1] : 0;\n this.resizerPosition = e.clientX;\n let ths;\n if (this.resizerCurrentWidths[this.resizerActiveIndex] === 'auto') {\n ths = ths || this.resizerRefTable.current.querySelectorAll('th');\n this.resizerCurrentWidths[this.resizerActiveIndex] = ths[this.resizerActiveIndex].offsetWidth;\n }\n if (this.resizerCurrentWidths[this.resizerActiveIndex + 1] === 'auto') {\n ths = ths || this.resizerRefTable.current.querySelectorAll('th');\n this.resizerCurrentWidths[this.resizerActiveIndex + 1] = ths[this.resizerActiveIndex + 1].offsetWidth;\n }\n\n this.resizerOldWidth = this.resizerCurrentWidths[this.resizerActiveIndex];\n this.resizerOldWidthNext = this.resizerCurrentWidths[this.resizerActiveIndex + 1];\n\n window.addEventListener('mousemove', this.resizerMouseMove);\n window.addEventListener('mouseup', this.resizerMouseUp);\n }\n };\n\n render() {\n if (this.props.ready === false) {\n return <Skeleton />;\n }\n\n const style = { gridTemplateColumns: this.resizerApplyWidths() };\n\n return <Table\n stickyHeader={this.props.stickyHeader}\n size={this.props.size || 'small'}\n className={ this.props.classes.table + (this.props.className ? ' ' + this.props.className : '')}\n ref={ this.resizerRefTable }\n style={ Object.assign({}, this.props.style || {}, style) }\n >\n { this.props.children }\n </Table>;\n }\n}\n\nTableResize.propTypes = {\n name: PropTypes.string,\n ready: PropTypes.bool,\n stickyHeader: PropTypes.bool,\n size: PropTypes.string,\n className: PropTypes.string,\n style: PropTypes.object,\n initialWidths: PropTypes.array,\n minWidths: PropTypes.array,\n dblTitle: PropTypes.string,\n};\n\nexport default withStyles(styles)(TableResize);"],"mappings":";;;;;;;;;;;;;;;AAMA;AACA;AACA;AAEA;AACA;AAA8C;AAAA;AAAA;AAAA;AAE9C,IAAMA,MAAM,GAAG,SAATA,MAAM,CAAGC,KAAK;EAAA,OAAK;IACrBC,KAAK,EAAE;MACHC,OAAO,EAAE,MAAM;MACf,MAAM,EAAE;QACJA,OAAO,EAAE;MACb,CAAC;MACD,SAAS,EAAE;QACPA,OAAO,EAAE;MAC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BAAS,CAACC,MAAM;EACtBpB,SAAS,EAAEmB,qBAAS,CAACC,MAAM;EAC3BZ,KAAK,EAAEW,qBAAS,CAACG,MAAM;EACvBrF,aAAa,EAAEkF,qBAAS,CAACI,KAAK;EAC9BzD,SAAS,EAAEqD,qBAAS,CAACI,KAAK;EAC1BxB,QAAQ,EAAEoB,qBAAS,CAACC;AACxB,CAAC;AAAC,eAEa,IAAAI,kBAAU,EAAC3G,MAAM,CAAC,CAACe,WAAW,CAAC;AAAA"}
|
package/Components/Utils.js
CHANGED
|
@@ -513,7 +513,10 @@ var Utils = /*#__PURE__*/function () {
|
|
|
513
513
|
if (color.length === 3) {
|
|
514
514
|
color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];
|
|
515
515
|
}
|
|
516
|
-
|
|
516
|
+
// remove alfa channel
|
|
517
|
+
if (color.length === 8) {
|
|
518
|
+
color = color.substring(0, 6);
|
|
519
|
+
} else if (color.length !== 6) {
|
|
517
520
|
return false;
|
|
518
521
|
}
|
|
519
522
|
r = parseInt(color.slice(0, 2), 16);
|
|
@@ -1087,7 +1090,11 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1087
1090
|
if (hex.length === 3) {
|
|
1088
1091
|
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
1089
1092
|
}
|
|
1090
|
-
|
|
1093
|
+
var alfa = null;
|
|
1094
|
+
if (hex.length === 8) {
|
|
1095
|
+
alfa = hex.substring(6, 8);
|
|
1096
|
+
hex = hex.substring(0, 6);
|
|
1097
|
+
} else if (hex.length !== 6) {
|
|
1091
1098
|
console.warn('Cannot invert color: ' + hex);
|
|
1092
1099
|
return hex;
|
|
1093
1100
|
}
|
|
@@ -1096,14 +1103,14 @@ var Utils = /*#__PURE__*/function () {
|
|
|
1096
1103
|
var b = parseInt(hex.slice(4, 6), 16);
|
|
1097
1104
|
if (bw) {
|
|
1098
1105
|
// http://stackoverflow.com/a/3943023/112731
|
|
1099
|
-
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ?
|
|
1106
|
+
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? "#000000".concat(alfa ? alfa : '') : "#FFFFFF".concat(alfa ? alfa : '');
|
|
1100
1107
|
}
|
|
1101
1108
|
// invert color components
|
|
1102
1109
|
r = (255 - r).toString(16);
|
|
1103
1110
|
g = (255 - g).toString(16);
|
|
1104
1111
|
b = (255 - b).toString(16);
|
|
1105
1112
|
// pad each with zeros and return
|
|
1106
|
-
return "#".concat(r.padStart(2, '0')).concat(g.padStart(2, '0')).concat(b.padStart(2, '0'));
|
|
1113
|
+
return "#".concat(r.padStart(2, '0')).concat(g.padStart(2, '0')).concat(b.padStart(2, '0')).concat(alfa ? alfa : '');
|
|
1107
1114
|
}
|
|
1108
1115
|
|
|
1109
1116
|
// https://github.com/lukeed/clsx/blob/master/src/index.js
|