@corva/ui 3.75.0-20 → 3.75.0-22
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/cjs-bundle/components/CommentLoader.js +1 -1
- package/cjs-bundle/components/CommentLoader.js.map +1 -1
- package/cjs-bundle/components/Template/TemplateSharingDialog/ChipSelector.js +1 -1
- package/cjs-bundle/components/Template/TemplateSharingDialog/ChipSelector.js.map +1 -1
- package/components/CommentLoader.d.ts +6 -5
- package/components/CommentLoader.js +1 -1
- package/components/CommentLoader.js.map +1 -1
- package/components/Template/TemplateSharingDialog/ChipSelector.d.ts +2 -30
- package/components/Template/TemplateSharingDialog/ChipSelector.js +1 -1
- package/components/Template/TemplateSharingDialog/ChipSelector.js.map +1 -1
- package/components/Template/TemplateSharingDialog/__tests__/ChipSelector.test.d.ts +2 -0
- package/components/Template/TemplateSharingDialog/__tests__/ChipSelector.test.d.ts.map +1 -0
- package/components/__tests__/CommentLoader.test.d.ts +2 -0
- package/components/__tests__/CommentLoader.test.d.ts.map +1 -0
- package/mcp-server/server.mjs +1 -1
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("
|
|
1
|
+
"use strict";var e=require("react"),r=require("prop-types"),o=require("@material-ui/core/styles"),n=require("./LoadingIndicator/LoadingIndicator.js"),t=require("./CommentWrapper.js"),a=require("react/jsx-runtime");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=i(r),u={loadingIndicatorWrapper:{padding:"0 20px 0 0"}},c={showOnMount:s.default.bool,spaceAround:s.default.bool,classes:s.default.shape({}).isRequired},d=e.forwardRef((function(r,o){var i=r.showOnMount,s=void 0!==i&&i,c=r.spaceAround,d=void 0!==c&&c,l=r.classes,p=e.useRef(null),f=e.useRef(s),m=e.useCallback((function(){p.current.scrollIntoView({block:"end"})}),[]);return e.useImperativeHandle(o,(function(){return{commentLoaderEl:p,showIntoView:m}}),[m]),e.useLayoutEffect((function(){f.current&&m()}),[m]),a.jsx("div",{ref:p,children:a.jsx(t,{spaceAround:d,isLoader:!0,className:l.commentWrapper,children:a.jsx("div",{style:u.loadingIndicatorWrapper,children:a.jsx(n,{fullscreen:!1,size:30})})})})}));d.propTypes=c;var l=o.withStyles({commentWrapper:{width:"calc(100% - 28px)"}})(e.memo(d));module.exports=l;
|
|
2
2
|
//# sourceMappingURL=CommentLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentLoader.js","sources":["../../../src/components/CommentLoader.js"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"CommentLoader.js","sources":["../../../src/components/CommentLoader.js"],"sourcesContent":["import { forwardRef, memo, useCallback, useImperativeHandle, useLayoutEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\n\nimport LoadingIndicator from '~components/LoadingIndicator';\nimport CommentWrapper from '~components/CommentWrapper';\n\nconst styles = {\n // NOTE: Centers the LoadingIndicator\n loadingIndicatorWrapper: { padding: '0 20px 0 0' },\n};\n\nconst muiStyles = {\n commentWrapper: {\n width: 'calc(100% - 28px)', // NOTE: 28 === settings icon size.\n },\n};\n\nconst propTypes = {\n showOnMount: PropTypes.bool,\n spaceAround: PropTypes.bool,\n\n classes: PropTypes.shape({}).isRequired,\n};\n\nconst CommentLoader = forwardRef(\n /** @param {PropTypes.InferProps<typeof propTypes>} props */ function CommentLoader(\n { showOnMount = false, spaceAround = false, classes },\n ref\n ) {\n const commentLoaderEl = useRef(null);\n const initialShowOnMount = useRef(showOnMount);\n const showIntoView = useCallback(() => {\n commentLoaderEl.current.scrollIntoView({ block: 'end' });\n }, []);\n\n useImperativeHandle(ref, () => ({ commentLoaderEl, showIntoView }), [showIntoView]);\n\n useLayoutEffect(() => {\n if (initialShowOnMount.current) {\n showIntoView();\n }\n }, [showIntoView]);\n\n return (\n <div ref={commentLoaderEl}>\n <CommentWrapper spaceAround={spaceAround} isLoader className={classes.commentWrapper}>\n <div style={styles.loadingIndicatorWrapper}>\n <LoadingIndicator fullscreen={false} size={30} />\n </div>\n </CommentWrapper>\n </div>\n );\n }\n);\n\nCommentLoader.propTypes = propTypes;\n\nexport default withStyles(muiStyles)(memo(CommentLoader));\n"],"names":["styles","loadingIndicatorWrapper","padding","propTypes","showOnMount","PropTypes","bool","spaceAround","classes","shape","isRequired","CommentLoader","forwardRef","ref","_ref$showOnMount","_ref","_ref$spaceAround","commentLoaderEl","useRef","initialShowOnMount","showIntoView","useCallback","current","scrollIntoView","block","useImperativeHandle","useLayoutEffect","_jsx","children","CommentWrapper","isLoader","className","commentWrapper","jsx","style","LoadingIndicator","fullscreen","size","withStyles","width","memo"],"mappings":"ySAOMA,EAAS,CAEbC,wBAAyB,CAAEC,QAAS,eAShCC,EAAY,CAChBC,YAAaC,EAAS,QAACC,KACvBC,YAAaF,EAAS,QAACC,KAEvBE,QAASH,EAAS,QAACI,MAAM,CAAA,GAAIC,YAGzBC,EAAgBC,EAAAA,YACyC,SAE3DC,EAAAA,GACA,IAAAC,EAAAC,EAFEX,YAAAA,cAAmBU,EAAAE,EAAAD,EAAER,YAAAA,cAAmBS,EAAER,IAAAA,QAGtCS,EAAkBC,SAAO,MACzBC,EAAqBD,SAAOd,GAC5BgB,EAAeC,EAAAA,aAAY,WAC/BJ,EAAgBK,QAAQC,eAAe,CAAEC,MAAO,OACjD,GAAE,IAUH,OARAC,EAAmBA,oBAACZ,GAAK,WAAA,MAAO,CAAEI,gBAAAA,EAAiBG,aAAAA,EAAc,GAAG,CAACA,IAErEM,EAAAA,iBAAgB,WACVP,EAAmBG,SACrBF,GAEJ,GAAG,CAACA,IAGFO,EAAAA,IAAA,MAAA,CAAKd,IAAKI,EAAgBW,SACxBD,MAACE,EAAc,CAACtB,YAAaA,EAAauB,UAAQ,EAACC,UAAWvB,EAAQwB,eAAeJ,SACnFD,EAAAM,IAAA,MAAA,CAAKC,MAAOlC,EAAOC,wBAAwB2B,SACzCD,MAACQ,EAAgB,CAACC,YAAY,EAAOC,KAAM,UAKrD,IAGF1B,EAAcR,UAAYA,EAE1B,IAAemC,EAAAA,EAAAA,WA9CG,CAChBN,eAAgB,CACdO,MAAO,sBA4CID,CAAsBE,EAAIA,KAAC7B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),n=require("lodash"),i=require("prop-types"),o=require("classnames"),s=require("@material-ui/core"),l=require("@material-ui/lab");require("./ChipSelector.css.js");var a=require("react/jsx-runtime");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(e),d=u(t),f=u(i),p=u(o);function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){c.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var v=new RegExp("^new.*$"),g=function(e){return e.toString()};function x(e){var t=e.items,i=e.selectedItems,o=e.newItems,u=void 0===o?null:o,c=e.onAdd,f=e.onRemove,m=e.allowAddNewItems,x=void 0!==m&&m,j=e.onAddNew,b=void 0===j?null:j,y=e.onRemoveNew,w=void 0===y?null:y,O=e.chipFormatter,q=void 0===O?g:O,I=e.listItemFormatter,S=void 0===I?g:I,C=e.classes,R=void 0===C?"c-chip-select-component__container":C,T=e.listClasses,_=void 0===T?"c-chip-select-component__list":T,N=e.hintText,A=void 0===N?null:N,P=e.errorText,F=void 0===P?"You can not add not existing item":P,E=e.listTitle,L=void 0===E?"All items":E,D=r.useState(!1),k=d.default(D,2),B=k[0],W=k[1],H=r.useState(i),M=d.default(H,2),Y=M[0],$=M[1];i!==Y&&($(i),W(!1));var z=t.filter((function(e){return!i.has(n.get(e,"id"))})),G=function(e){return{text:q(e),id:n.get(e,"id"),persistent:n.get(e,"persistent",!1)}},J=t.filter((function(e){return i.has(n.get(e,"id"))})).concat(x?u:[]).map(G),K=z.map(G),Q=function(e){var t=e.id,r=e.text;x?X(r)?W(!0):b({id:"new".concat(r),name:r}):z.find((function(e){return n.get(e,"id")===t}))?c(t):W(!0)},U=function(e){x&&v.test(e)?w(e):f(e)},V=function(e){return e.text},X=function(e){return t.concat(u).map(G).find((function(t){return n.get(t,"text")===e}))},Z=B?F:"";return a.jsxs("div",{children:[a.jsxs(s.FormControl,{className:R.formControl,error:!!Z,fullWidth:!0,children:[a.jsx(l.Autocomplete,{"data-testid":"generic_chipInput",multiple:!0,fullWidth:!0,id:"chip-selector",classes:{inputRoot:R.inputRoot},value:J,onChange:function(e,t){var r=J,n=new Set(r.map((function(e){return e.id}))),i=new Set(t.map((function(e){return e.id}))),o=t.filter((function(e){return!n.has(e.id)})),s=r.filter((function(e){return!i.has(e.id)&&!e.persistent})).map((function(e){return e.id}));o.forEach(Q),s.forEach(U)},onInputChange:function(){B&&W(!1)},options:K,getOptionLabel:V,renderInput:function(e){return a.jsx(s.TextField,h(h({},e),{},{variant:"standard",placeholder:A}))},renderTags:function(e,t){return e.map((function(e,r){return a.jsx(s.Chip,h(h({"data-not-migrated-MuiChip":!0,label:V(e)},t({index:r})),{},{onDelete:e.persistent?null:function(){return U(e.id)}}),r)}))}}),a.jsx(s.FormHelperText,{children:Z})]}),a.jsx("div",{className:"c-chip-select-component__list-title",children:a.jsx("em",{children:L})}),a.jsx(s.List,{className:p.default(_,R.listStyle),children:n.isEmpty(z)?a.jsx("div",{className:"c-chip-select-component__empty-list",children:a.jsx("p",{"data-testid":"".concat("chipSelector","_emptyLabel"),children:"List is empty"})}):z.map((function(e){return a.jsx(s.ListItem,{"data-testid":"".concat("chipSelector","_item_").concat(S(e)),button:!0,divider:!0,onClick:function(){return c(n.get(e,"id"))},children:a.jsx(s.ListItemText,{children:S(e)})},n.get(e,"id"))}))})]})}x.propTypes={items:f.default.arrayOf(f.default.shape({})).isRequired,selectedItems:f.default.shape([]).isRequired,newItems:f.default.arrayOf(f.default.shape({})),onAdd:f.default.func.isRequired,onRemove:f.default.func.isRequired,allowAddNewItems:f.default.bool,onAddNew:f.default.func,onRemoveNew:f.default.func,chipFormatter:f.default.func,listItemFormatter:f.default.func,classes:f.default.string,listClasses:f.default.string,hintText:f.default.string,errorText:f.default.string,listTitle:f.default.string};var j=s.withStyles({listStyle:{borderColor:"grey",overflow:"auto"},formControl:{marginBottom:8},inputRoot:{paddingBottom:"8px !important"}})(r.memo(x));module.exports=j;
|
|
2
2
|
//# sourceMappingURL=ChipSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipSelector.js","sources":["../../../../../src/components/Template/TemplateSharingDialog/ChipSelector.js"],"sourcesContent":["import { PureComponent } from 'react';\nimport { get, isEmpty } from 'lodash';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport {\n Chip,\n FormControl,\n FormHelperText,\n List as ListComponent,\n ListItem,\n ListItemText,\n TextField,\n withStyles,\n} from '@material-ui/core';\nimport { Autocomplete } from '@material-ui/lab';\n\nimport './ChipSelector.css';\n\nconst PAGE_NAME = 'chipSelector';\n\nconst newItemRegExp = new RegExp('^new.*$');\n\nconst muiStyles = {\n listStyle: {\n borderColor: 'grey',\n overflow: 'auto',\n },\n formControl: { marginBottom: 8 },\n inputRoot: { paddingBottom: '8px !important' },\n};\n\nclass ChipSelector extends PureComponent {\n constructor(props) {\n super(props);\n this.state = { isError: false };\n }\n\n componentDidUpdate({ selectedItems }) {\n if (this.props.selectedItems !== selectedItems) {\n this.setState({ isError: false });\n }\n }\n\n get itemList() {\n return this.listedItems.map(item => (\n <ListItem\n data-testid={`${PAGE_NAME}_item_${this.props.listItemFormatter(item)}`}\n key={get(item, 'id')}\n button\n divider\n onClick={() => this.props.onAdd(get(item, 'id'))}\n >\n <ListItemText>{this.props.listItemFormatter(item)}</ListItemText>\n </ListItem>\n ));\n }\n\n get listedItems() {\n return this.props.items.filter(item => !this.props.selectedItems.has(get(item, 'id')));\n }\n\n get selectedItems() {\n return this.props.items\n .filter(item => this.props.selectedItems.has(get(item, 'id')))\n .concat(this.props.allowAddNewItems ? this.props.newItems : []);\n }\n\n get formattedSelectedItems() {\n return this.selectedItems.map(this.formatItem);\n }\n\n get formattedListedItems() {\n return this.listedItems.map(this.formatItem);\n }\n\n formatItem = item => ({\n text: this.props.chipFormatter(item),\n id: get(item, 'id'),\n persistent: get(item, 'persistent', false), // NOTE: Item is not removable\n });\n\n handleChange = (e, nextItems) => {\n const prevItems = this.formattedSelectedItems;\n const prevIdsSet = new Set(prevItems.map(item => item.id));\n const nextIdsSet = new Set(nextItems.map(item => item.id));\n\n const itemsToAdd = nextItems.filter(item => !prevIdsSet.has(item.id));\n const itemsIdsToRemove = prevItems\n .filter(item => !nextIdsSet.has(item.id) && !item.persistent)\n .map(item => item.id);\n itemsToAdd.forEach(this.handleRequestAdd);\n itemsIdsToRemove.forEach(this.handleRequestDelete);\n };\n\n handleRequestAdd = ({ id, text }) => {\n if (this.props.allowAddNewItems) {\n if (this.itemWithSameNameExists(text)) {\n this.setState({ isError: true });\n } else {\n this.props.onAddNew({\n id: `new${text}`,\n name: text,\n });\n }\n } else if (this.listedItems.find(item => get(item, 'id') === id)) {\n this.props.onAdd(id);\n } else {\n this.setState({ isError: true });\n }\n };\n\n handleRequestDelete = id => {\n if (this.props.allowAddNewItems && newItemRegExp.test(id)) {\n this.props.onRemoveNew(id);\n } else {\n this.props.onRemove(id);\n }\n };\n\n handleUpdateInput = () => {\n if (this.state.isError) {\n this.setState({ isError: false });\n }\n };\n\n getOptionLabel = option => option.text;\n\n renderTags = (value, getCustomizedTagProps) =>\n value.map((option, index) => (\n <Chip\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n data-not-migrated-MuiChip\n label={this.getOptionLabel(option)}\n {...getCustomizedTagProps({ index })}\n onDelete={option.persistent ? null : () => this.handleRequestDelete(option.id)}\n />\n ));\n\n renderInput = params => (\n <TextField {...params} variant=\"standard\" placeholder={this.props.hintText} />\n );\n\n itemWithSameNameExists = text =>\n this.props.items\n .concat(this.props.newItems)\n .map(this.formatItem)\n .find(item => get(item, 'text') === text);\n\n render() {\n const errorText = this.state.isError ? this.props.errorText : '';\n const { classes } = this.props;\n\n return (\n <div>\n <FormControl className={classes.formControl} error={!!errorText} fullWidth>\n <Autocomplete\n data-testid=\"generic_chipInput\"\n multiple\n fullWidth\n id=\"chip-selector\"\n classes={{ inputRoot: classes.inputRoot }}\n value={this.formattedSelectedItems}\n onChange={this.handleChange}\n onInputChange={this.handleUpdateInput}\n options={this.formattedListedItems}\n getOptionLabel={this.getOptionLabel}\n renderInput={this.renderInput}\n renderTags={this.renderTags}\n />\n <FormHelperText>{errorText}</FormHelperText>\n </FormControl>\n\n <div className=\"c-chip-select-component__list-title\">\n <em>{this.props.listTitle}</em>\n </div>\n <ListComponent className={classNames(this.props.listClasses, this.props.classes.listStyle)}>\n {!isEmpty(this.listedItems) ? (\n this.itemList\n ) : (\n <div className=\"c-chip-select-component__empty-list\">\n <p data-testid={`${PAGE_NAME}_emptyLabel`}>List is empty</p>\n </div>\n )}\n </ListComponent>\n </div>\n );\n }\n}\n\nChipSelector.propTypes = {\n items: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n selectedItems: PropTypes.shape([]).isRequired,\n newItems: PropTypes.arrayOf(PropTypes.shape({})),\n onAdd: PropTypes.func.isRequired,\n onRemove: PropTypes.func.isRequired,\n allowAddNewItems: PropTypes.bool,\n onAddNew: PropTypes.func,\n onRemoveNew: PropTypes.func,\n chipFormatter: PropTypes.func,\n listItemFormatter: PropTypes.func,\n classes: PropTypes.string,\n listClasses: PropTypes.string,\n hintText: PropTypes.string,\n errorText: PropTypes.string,\n listTitle: PropTypes.string,\n};\n\nChipSelector.defaultProps = {\n allowAddNewItems: false,\n chipFormatter: item => item.toString(),\n listItemFormatter: item => item.toString(),\n classes: 'c-chip-select-component__container',\n listClasses: 'c-chip-select-component__list',\n hintText: null,\n errorText: 'You can not add not existing item',\n listTitle: 'All items',\n onAddNew: null,\n onRemoveNew: null,\n newItems: null,\n};\n\nexport default withStyles(muiStyles)(ChipSelector);\n"],"names":["newItemRegExp","RegExp","ChipSelector","_PureComponent","_inherits","_super","_createSuper","props","_this","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","item","text","chipFormatter","id","get","persistent","e","nextItems","prevItems","formattedSelectedItems","prevIdsSet","Set","map","nextIdsSet","itemsToAdd","filter","has","itemsIdsToRemove","forEach","handleRequestAdd","handleRequestDelete","_ref","allowAddNewItems","itemWithSameNameExists","setState","isError","onAddNew","concat","name","listedItems","find","onAdd","test","onRemoveNew","onRemove","state","option","value","getCustomizedTagProps","index","_jsx","jsx","Chip","_objectSpread","label","getOptionLabel","onDelete","params","TextField","variant","placeholder","hintText","items","newItems","formatItem","_createClass","key","_ref2","selectedItems","_this2","ListItem","PAGE_NAME","listItemFormatter","button","divider","onClick","children","ListItemText","_this3","_this4","errorText","classes","_jsxs","FormControl","className","formControl","error","fullWidth","Autocomplete","multiple","inputRoot","onChange","handleChange","onInputChange","handleUpdateInput","options","formattedListedItems","renderInput","renderTags","FormHelperText","listTitle","ListComponent","classNames","listClasses","listStyle","isEmpty","itemList","PureComponent","propTypes","PropTypes","arrayOf","shape","isRequired","func","bool","string","defaultProps","toString","ChipSelector$1","withStyles","borderColor","overflow","marginBottom","paddingBottom"],"mappings":"wuDAkBA,IAEMA,EAAgB,IAAIC,OAAO,WAW3BC,EAAY,SAAAC,GAAAC,UAAAF,EAAAC,GAAA,IAAAE,EAAAC,EAAAJ,GAChB,SAAAA,EAAYK,GAAO,I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EAAS,QAACI,KACvBrG,cAAeiG,EAAS,QAACI,KACzBzC,kBAAmBqC,EAAS,QAACI,KAC7BhC,QAAS4B,EAAS,QAACM,OACnBZ,YAAaM,EAAS,QAACM,OACvBtD,SAAUgD,EAAS,QAACM,OACpBnC,UAAW6B,EAAS,QAACM,OACrBf,UAAWS,EAAS,QAACM,QAGvBrH,EAAasH,aAAe,CAC1BpF,kBAAkB,EAClBpB,cAAe,SAAAF,GAAI,OAAIA,EAAK2G,UAAU,EACtC7C,kBAAmB,SAAA9D,GAAI,OAAIA,EAAK2G,UAAU,EAC1CpC,QAAS,qCACTsB,YAAa,gCACb1C,SAAU,KACVmB,UAAW,oCACXoB,UAAW,YACXhE,SAAU,KACVO,YAAa,KACboB,SAAU,MAGZ,IAAAuD,EAAeC,aAxMG,CAChBf,UAAW,CACTgB,YAAa,OACbC,SAAU,QAEZpC,YAAa,CAAEqC,aAAc,GAC7BhC,UAAW,CAAEiC,cAAe,mBAkMfJ,CAAsBzH"}
|
|
1
|
+
{"version":3,"file":"ChipSelector.js","sources":["../../../../../src/components/Template/TemplateSharingDialog/ChipSelector.js"],"sourcesContent":["import { memo, useState } from 'react';\nimport { get, isEmpty } from 'lodash';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport {\n Chip,\n FormControl,\n FormHelperText,\n List as ListComponent,\n ListItem,\n ListItemText,\n TextField,\n withStyles,\n} from '@material-ui/core';\nimport { Autocomplete } from '@material-ui/lab';\n\nimport './ChipSelector.css';\n\nconst PAGE_NAME = 'chipSelector';\n\nconst newItemRegExp = new RegExp('^new.*$');\n\nconst muiStyles = {\n listStyle: {\n borderColor: 'grey',\n overflow: 'auto',\n },\n formControl: { marginBottom: 8 },\n inputRoot: { paddingBottom: '8px !important' },\n};\n\nconst defaultFormatter = item => item.toString();\n\n/** @param {any} props Preserve the legacy component's public prop type. */\nfunction ChipSelector({\n items,\n selectedItems,\n newItems = null,\n onAdd,\n onRemove,\n allowAddNewItems = false,\n onAddNew = null,\n onRemoveNew = null,\n chipFormatter = defaultFormatter,\n listItemFormatter = defaultFormatter,\n classes = 'c-chip-select-component__container',\n listClasses = 'c-chip-select-component__list',\n hintText = null,\n errorText = 'You can not add not existing item',\n listTitle = 'All items',\n}) {\n const [isError, setIsError] = useState(false);\n const [previousSelectedItems, setPreviousSelectedItems] = useState(selectedItems);\n\n if (selectedItems !== previousSelectedItems) {\n setPreviousSelectedItems(selectedItems);\n setIsError(false);\n }\n\n const listedItems = items.filter(item => !selectedItems.has(get(item, 'id')));\n const formatItem = item => ({\n text: chipFormatter(item),\n id: get(item, 'id'),\n persistent: get(item, 'persistent', false), // NOTE: Item is not removable\n });\n\n const formattedSelectedItems = items\n .filter(item => selectedItems.has(get(item, 'id')))\n .concat(allowAddNewItems ? newItems : [])\n .map(formatItem);\n const formattedListedItems = listedItems.map(formatItem);\n\n const handleChange = (e, nextItems) => {\n const prevItems = formattedSelectedItems;\n const prevIdsSet = new Set(prevItems.map(item => item.id));\n const nextIdsSet = new Set(nextItems.map(item => item.id));\n\n const itemsToAdd = nextItems.filter(item => !prevIdsSet.has(item.id));\n const itemsIdsToRemove = prevItems\n .filter(item => !nextIdsSet.has(item.id) && !item.persistent)\n .map(item => item.id);\n itemsToAdd.forEach(handleRequestAdd);\n itemsIdsToRemove.forEach(handleRequestDelete);\n };\n\n const handleRequestAdd = ({ id, text }) => {\n if (allowAddNewItems) {\n if (itemWithSameNameExists(text)) {\n setIsError(true);\n } else {\n onAddNew({\n id: `new${text}`,\n name: text,\n });\n }\n } else if (listedItems.find(item => get(item, 'id') === id)) {\n onAdd(id);\n } else {\n setIsError(true);\n }\n };\n\n const handleRequestDelete = id => {\n if (allowAddNewItems && newItemRegExp.test(id)) {\n onRemoveNew(id);\n } else {\n onRemove(id);\n }\n };\n\n const handleUpdateInput = () => {\n if (isError) {\n setIsError(false);\n }\n };\n\n const getOptionLabel = option => option.text;\n\n const renderTags = (value, getCustomizedTagProps) =>\n value.map((option, index) => (\n <Chip\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n data-not-migrated-MuiChip\n label={getOptionLabel(option)}\n {...getCustomizedTagProps({ index })}\n onDelete={option.persistent ? null : () => handleRequestDelete(option.id)}\n />\n ));\n\n const renderInput = params => <TextField {...params} variant=\"standard\" placeholder={hintText} />;\n\n const itemWithSameNameExists = text =>\n items\n .concat(newItems)\n .map(formatItem)\n .find(item => get(item, 'text') === text);\n\n const displayedErrorText = isError ? errorText : '';\n\n return (\n <div>\n <FormControl className={classes.formControl} error={!!displayedErrorText} fullWidth>\n <Autocomplete\n data-testid=\"generic_chipInput\"\n multiple\n fullWidth\n id=\"chip-selector\"\n classes={{ inputRoot: classes.inputRoot }}\n value={formattedSelectedItems}\n onChange={handleChange}\n onInputChange={handleUpdateInput}\n options={formattedListedItems}\n getOptionLabel={getOptionLabel}\n renderInput={renderInput}\n renderTags={renderTags}\n />\n <FormHelperText>{displayedErrorText}</FormHelperText>\n </FormControl>\n\n <div className=\"c-chip-select-component__list-title\">\n <em>{listTitle}</em>\n </div>\n <ListComponent className={classNames(listClasses, classes.listStyle)}>\n {!isEmpty(listedItems) ? (\n listedItems.map(item => (\n <ListItem\n data-testid={`${PAGE_NAME}_item_${listItemFormatter(item)}`}\n key={get(item, 'id')}\n button\n divider\n onClick={() => onAdd(get(item, 'id'))}\n >\n <ListItemText>{listItemFormatter(item)}</ListItemText>\n </ListItem>\n ))\n ) : (\n <div className=\"c-chip-select-component__empty-list\">\n <p data-testid={`${PAGE_NAME}_emptyLabel`}>List is empty</p>\n </div>\n )}\n </ListComponent>\n </div>\n );\n}\n\nChipSelector.propTypes = {\n items: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n selectedItems: PropTypes.shape([]).isRequired,\n newItems: PropTypes.arrayOf(PropTypes.shape({})),\n onAdd: PropTypes.func.isRequired,\n onRemove: PropTypes.func.isRequired,\n allowAddNewItems: PropTypes.bool,\n onAddNew: PropTypes.func,\n onRemoveNew: PropTypes.func,\n chipFormatter: PropTypes.func,\n listItemFormatter: PropTypes.func,\n classes: PropTypes.string,\n listClasses: PropTypes.string,\n hintText: PropTypes.string,\n errorText: PropTypes.string,\n listTitle: PropTypes.string,\n};\n\nexport default withStyles(muiStyles)(memo(ChipSelector));\n"],"names":["newItemRegExp","RegExp","defaultFormatter","item","toString","ChipSelector","_ref","items","selectedItems","_ref$newItems","newItems","onAdd","onRemove","_ref$allowAddNewItems","allowAddNewItems","_ref$onAddNew","onAddNew","_ref$onRemoveNew","onRemoveNew","_ref$chipFormatter","chipFormatter","_ref$listItemFormatte","listItemFormatter","_ref$classes","classes","_ref$listClasses","listClasses","_ref$hintText","hintText","_ref$errorText","errorText","_ref$listTitle","listTitle","useState","_useState2","_slicedToArray","_useState","isError","setIsError","_useState4","_useState3","previousSelectedItems","setPreviousSelectedItems","listedItems","filter","has","get","formatItem","text","id","persistent","formattedSelectedItems","concat","map","formattedListedItems","handleRequestAdd","_ref2","itemWithSameNameExists","name","find","handleRequestDelete","test","getOptionLabel","option","displayedErrorText","_jsxs","children","FormControl","className","formControl","error","fullWidth","_jsx","Autocomplete","multiple","inputRoot","value","onChange","e","nextItems","prevItems","prevIdsSet","Set","nextIdsSet","itemsToAdd","itemsIdsToRemove","forEach","onInputChange","options","renderInput","params","TextField","_objectSpread","variant","placeholder","renderTags","getCustomizedTagProps","index","jsx","Chip","label","onDelete","FormHelperText","ListComponent","classNames","listStyle","isEmpty","ListItem","button","divider","onClick","ListItemText","propTypes","PropTypes","arrayOf","shape","isRequired","func","bool","string","withStyles","borderColor","overflow","marginBottom","paddingBottom","memo"],"mappings":"6/BAkBA,IAEMA,EAAgB,IAAIC,OAAO,WAW3BC,EAAmB,SAAAC,GAAI,OAAIA,EAAKC,UAAU,EAGhD,SAASC,EAgBNC,GAAA,IAfDC,IAAAA,MACAC,IAAAA,cAAaC,EAAAH,EACbI,SAAAA,aAAW,KAAID,EACfE,IAAAA,MACAC,IAAAA,SAAQC,EAAAP,EACRQ,iBAAAA,cAAwBD,EAAA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eyG,EAAS,QAACE,MAAM,IAAIC,WACnC1G,SAAUuG,EAAS,QAACC,QAAQD,EAAS,QAACE,MAAM,CAAE,IAC9CxG,MAAOsG,EAAAA,QAAUI,KAAKD,WACtBxG,SAAUqG,EAAAA,QAAUI,KAAKD,WACzBtG,iBAAkBmG,EAAS,QAACK,KAC5BtG,SAAUiG,EAAS,QAACI,KACpBnG,YAAa+F,EAAS,QAACI,KACvBjG,cAAe6F,EAAS,QAACI,KACzB/F,kBAAmB2F,EAAS,QAACI,KAC7B7F,QAASyF,EAAS,QAACM,OACnB7F,YAAauF,EAAS,QAACM,OACvB3F,SAAUqF,EAAS,QAACM,OACpBzF,UAAWmF,EAAS,QAACM,OACrBvF,UAAWiF,EAAS,QAACM,QAGvB,IAAeC,EAAAA,EAAAA,WAtLG,CAChBf,UAAW,CACTgB,YAAa,OACbC,SAAU,QAEZrD,YAAa,CAAEsD,aAAc,GAC7BhD,UAAW,CAAEiD,cAAe,mBAgLfJ,CAAsBK,EAAIA,KAACxH"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
declare const _default: import("react").ComponentType<Pick<
|
|
2
|
+
declare const _default: import("react").ComponentType<Pick<PropTypes.InferPropsInner<Pick<{
|
|
3
3
|
showOnMount: PropTypes.Requireable<boolean>;
|
|
4
4
|
spaceAround: PropTypes.Requireable<boolean>;
|
|
5
5
|
classes: PropTypes.Validator<NonNullable<PropTypes.InferProps<{}>>>;
|
|
6
|
-
}
|
|
7
|
-
showOnMount
|
|
8
|
-
spaceAround
|
|
9
|
-
|
|
6
|
+
}, "classes">> & Partial<PropTypes.InferPropsInner<Pick<{
|
|
7
|
+
showOnMount: PropTypes.Requireable<boolean>;
|
|
8
|
+
spaceAround: PropTypes.Requireable<boolean>;
|
|
9
|
+
classes: PropTypes.Validator<NonNullable<PropTypes.InferProps<{}>>>;
|
|
10
|
+
}, "showOnMount" | "spaceAround">>> & import("react").RefAttributes<any>, "showOnMount" | "spaceAround" | keyof import("react").RefAttributes<any>> & import("@material-ui/styles").StyledComponentProps<"commentWrapper">>;
|
|
10
11
|
export default _default;
|
|
11
12
|
//# sourceMappingURL=CommentLoader.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r
|
|
1
|
+
import{forwardRef as r,useRef as o,useCallback as e,useImperativeHandle as n,useLayoutEffect as i,memo as t}from"react";import a from"prop-types";import{withStyles as c}from"@material-ui/core/styles";import p from"./LoadingIndicator/LoadingIndicator.js";import s from"./CommentWrapper.js";import{jsx as d}from"react/jsx-runtime";var l={loadingIndicatorWrapper:{padding:"0 20px 0 0"}},m={showOnMount:a.bool,spaceAround:a.bool,classes:a.shape({}).isRequired},u=r((function(r,t){var a=r.showOnMount,c=void 0!==a&&a,m=r.spaceAround,u=void 0!==m&&m,f=r.classes,h=o(null),v=o(c),w=e((function(){h.current.scrollIntoView({block:"end"})}),[]);return n(t,(function(){return{commentLoaderEl:h,showIntoView:w}}),[w]),i((function(){v.current&&w()}),[w]),d("div",{ref:h,children:d(s,{spaceAround:u,isLoader:!0,className:f.commentWrapper,children:d("div",{style:l.loadingIndicatorWrapper,children:d(p,{fullscreen:!1,size:30})})})})}));u.propTypes=m;var f=c({commentWrapper:{width:"calc(100% - 28px)"}})(t(u));export{f as default};
|
|
2
2
|
//# sourceMappingURL=CommentLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentLoader.js","sources":["../../src/components/CommentLoader.js"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"CommentLoader.js","sources":["../../src/components/CommentLoader.js"],"sourcesContent":["import { forwardRef, memo, useCallback, useImperativeHandle, useLayoutEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\n\nimport LoadingIndicator from '~components/LoadingIndicator';\nimport CommentWrapper from '~components/CommentWrapper';\n\nconst styles = {\n // NOTE: Centers the LoadingIndicator\n loadingIndicatorWrapper: { padding: '0 20px 0 0' },\n};\n\nconst muiStyles = {\n commentWrapper: {\n width: 'calc(100% - 28px)', // NOTE: 28 === settings icon size.\n },\n};\n\nconst propTypes = {\n showOnMount: PropTypes.bool,\n spaceAround: PropTypes.bool,\n\n classes: PropTypes.shape({}).isRequired,\n};\n\nconst CommentLoader = forwardRef(\n /** @param {PropTypes.InferProps<typeof propTypes>} props */ function CommentLoader(\n { showOnMount = false, spaceAround = false, classes },\n ref\n ) {\n const commentLoaderEl = useRef(null);\n const initialShowOnMount = useRef(showOnMount);\n const showIntoView = useCallback(() => {\n commentLoaderEl.current.scrollIntoView({ block: 'end' });\n }, []);\n\n useImperativeHandle(ref, () => ({ commentLoaderEl, showIntoView }), [showIntoView]);\n\n useLayoutEffect(() => {\n if (initialShowOnMount.current) {\n showIntoView();\n }\n }, [showIntoView]);\n\n return (\n <div ref={commentLoaderEl}>\n <CommentWrapper spaceAround={spaceAround} isLoader className={classes.commentWrapper}>\n <div style={styles.loadingIndicatorWrapper}>\n <LoadingIndicator fullscreen={false} size={30} />\n </div>\n </CommentWrapper>\n </div>\n );\n }\n);\n\nCommentLoader.propTypes = propTypes;\n\nexport default withStyles(muiStyles)(memo(CommentLoader));\n"],"names":["styles","loadingIndicatorWrapper","padding","propTypes","showOnMount","PropTypes","bool","spaceAround","classes","shape","isRequired","CommentLoader","forwardRef","ref","_ref$showOnMount","_ref","_ref$spaceAround","commentLoaderEl","useRef","initialShowOnMount","showIntoView","useCallback","current","scrollIntoView","block","useImperativeHandle","useLayoutEffect","_jsx","children","CommentWrapper","isLoader","className","commentWrapper","style","LoadingIndicator","fullscreen","size","withStyles","width","memo"],"mappings":"yUAOA,IAAMA,EAAS,CAEbC,wBAAyB,CAAEC,QAAS,eAShCC,EAAY,CAChBC,YAAaC,EAAUC,KACvBC,YAAaF,EAAUC,KAEvBE,QAASH,EAAUI,MAAM,CAAA,GAAIC,YAGzBC,EAAgBC,GACyC,SAE3DC,EAAAA,GACA,IAAAC,EAAAC,EAFEX,YAAAA,cAAmBU,EAAAE,EAAAD,EAAER,YAAAA,cAAmBS,EAAER,IAAAA,QAGtCS,EAAkBC,EAAO,MACzBC,EAAqBD,EAAOd,GAC5BgB,EAAeC,GAAY,WAC/BJ,EAAgBK,QAAQC,eAAe,CAAEC,MAAO,OACjD,GAAE,IAUH,OARAC,EAAoBZ,GAAK,WAAA,MAAO,CAAEI,gBAAAA,EAAiBG,aAAAA,EAAc,GAAG,CAACA,IAErEM,GAAgB,WACVP,EAAmBG,SACrBF,GAEJ,GAAG,CAACA,IAGFO,EAAA,MAAA,CAAKd,IAAKI,EAAgBW,SACxBD,EAACE,EAAc,CAACtB,YAAaA,EAAauB,UAAQ,EAACC,UAAWvB,EAAQwB,eAAeJ,SACnFD,EAAA,MAAA,CAAKM,MAAOjC,EAAOC,wBAAwB2B,SACzCD,EAACO,EAAgB,CAACC,YAAY,EAAOC,KAAM,UAKrD,IAGFzB,EAAcR,UAAYA,EAE1B,IAAekC,EAAAA,EA9CG,CAChBL,eAAgB,CACdM,MAAO,sBA4CID,CAAsBE,EAAK5B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import './ChipSelector.css';
|
|
3
|
-
declare const _default: import("react").ComponentType<Pick<
|
|
3
|
+
declare const _default: import("react").ComponentType<Pick<PropTypes.InferProps<{
|
|
4
4
|
items: PropTypes.Validator<(PropTypes.InferProps<{}> | null | undefined)[]>;
|
|
5
5
|
selectedItems: PropTypes.Validator<NonNullable<PropTypes.InferProps<PropTypes.ValidationMap<any>>>>;
|
|
6
6
|
newItems: PropTypes.Requireable<(PropTypes.InferProps<{}> | null | undefined)[]>;
|
|
@@ -16,35 +16,7 @@ declare const _default: import("react").ComponentType<Pick<Pick<PropTypes.InferP
|
|
|
16
16
|
hintText: PropTypes.Requireable<string>;
|
|
17
17
|
errorText: PropTypes.Requireable<string>;
|
|
18
18
|
listTitle: PropTypes.Requireable<string>;
|
|
19
|
-
}>, PropTypes.RequiredKeys<{
|
|
20
|
-
items: PropTypes.Validator<(PropTypes.InferProps<{}> | null | undefined)[]>;
|
|
21
|
-
selectedItems: PropTypes.Validator<NonNullable<PropTypes.InferProps<PropTypes.ValidationMap<any>>>>;
|
|
22
|
-
newItems: PropTypes.Requireable<(PropTypes.InferProps<{}> | null | undefined)[]>;
|
|
23
|
-
onAdd: PropTypes.Validator<(...args: any[]) => any>;
|
|
24
|
-
onRemove: PropTypes.Validator<(...args: any[]) => any>;
|
|
25
|
-
allowAddNewItems: PropTypes.Requireable<boolean>;
|
|
26
|
-
onAddNew: PropTypes.Requireable<(...args: any[]) => any>;
|
|
27
|
-
onRemoveNew: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
-
chipFormatter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
29
|
-
listItemFormatter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
|
-
classes: PropTypes.Requireable<string>;
|
|
31
|
-
listClasses: PropTypes.Requireable<string>;
|
|
32
|
-
hintText: PropTypes.Requireable<string>;
|
|
33
|
-
errorText: PropTypes.Requireable<string>;
|
|
34
|
-
listTitle: PropTypes.Requireable<string>;
|
|
35
|
-
}>> & {
|
|
36
|
-
newItems?: (PropTypes.InferProps<{}> | null | undefined)[] | null | undefined;
|
|
37
|
-
allowAddNewItems?: boolean | null | undefined;
|
|
38
|
-
onAddNew?: ((...args: any[]) => any) | null | undefined;
|
|
39
|
-
onRemoveNew?: ((...args: any[]) => any) | null | undefined;
|
|
40
|
-
chipFormatter?: ((...args: any[]) => any) | null | undefined;
|
|
41
|
-
listItemFormatter?: ((...args: any[]) => any) | null | undefined;
|
|
42
|
-
classes?: string | null | undefined;
|
|
43
|
-
listClasses?: string | null | undefined;
|
|
44
|
-
hintText?: string | null | undefined;
|
|
45
|
-
errorText?: string | null | undefined;
|
|
46
|
-
listTitle?: string | null | undefined;
|
|
47
|
-
} & {}, "allowAddNewItems" | "chipFormatter" | "errorText" | "hintText" | "listClasses" | "listItemFormatter" | "listTitle" | "newItems" | "onAddNew" | "onRemoveNew" | PropTypes.RequiredKeys<{
|
|
19
|
+
}>, "allowAddNewItems" | "chipFormatter" | "errorText" | "hintText" | "listClasses" | "listItemFormatter" | "listTitle" | "newItems" | "onAddNew" | "onRemoveNew" | PropTypes.RequiredKeys<{
|
|
48
20
|
items: PropTypes.Validator<(PropTypes.InferProps<{}> | null | undefined)[]>;
|
|
49
21
|
selectedItems: PropTypes.Validator<NonNullable<PropTypes.InferProps<PropTypes.ValidationMap<any>>>>;
|
|
50
22
|
newItems: PropTypes.Requireable<(PropTypes.InferProps<{}> | null | undefined)[]>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"@babel/runtime/helpers/
|
|
1
|
+
import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{memo as r,useState as n}from"react";import{get as i,isEmpty as o}from"lodash";import c from"prop-types";import s from"classnames";import{withStyles as a,FormControl as l,FormHelperText as u,List as d,ListItem as p,ListItemText as m,Chip as f,TextField as h}from"@material-ui/core";import{Autocomplete as v}from"@material-ui/lab";import"./ChipSelector.css.js";import{jsxs as b,jsx as g}from"react/jsx-runtime";function y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?y(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var O=new RegExp("^new.*$"),x=function(t){return t.toString()};function j(t){var r=t.items,c=t.selectedItems,a=t.newItems,y=void 0===a?null:a,j=t.onAdd,R=t.onRemove,_=t.allowAddNewItems,I=void 0!==_&&_,C=t.onAddNew,N=void 0===C?null:C,S=t.onRemoveNew,P=void 0===S?null:S,T=t.chipFormatter,A=void 0===T?x:T,D=t.listItemFormatter,E=void 0===D?x:D,q=t.classes,F=void 0===q?"c-chip-select-component__container":q,L=t.listClasses,k=void 0===L?"c-chip-select-component__list":L,B=t.hintText,W=void 0===B?null:B,M=t.errorText,Y=void 0===M?"You can not add not existing item":M,$=t.listTitle,z=void 0===$?"All items":$,G=n(!1),H=e(G,2),J=H[0],K=H[1],Q=n(c),U=e(Q,2),V=U[0],X=U[1];c!==V&&(X(c),K(!1));var Z=r.filter((function(t){return!c.has(i(t,"id"))})),tt=function(t){return{text:A(t),id:i(t,"id"),persistent:i(t,"persistent",!1)}},et=r.filter((function(t){return c.has(i(t,"id"))})).concat(I?y:[]).map(tt),rt=Z.map(tt),nt=function(t){var e=t.id,r=t.text;I?ct(r)?K(!0):N({id:"new".concat(r),name:r}):Z.find((function(t){return i(t,"id")===e}))?j(e):K(!0)},it=function(t){I&&O.test(t)?P(t):R(t)},ot=function(t){return t.text},ct=function(t){return r.concat(y).map(tt).find((function(e){return i(e,"text")===t}))},st=J?Y:"";return b("div",{children:[b(l,{className:F.formControl,error:!!st,fullWidth:!0,children:[g(v,{"data-testid":"generic_chipInput",multiple:!0,fullWidth:!0,id:"chip-selector",classes:{inputRoot:F.inputRoot},value:et,onChange:function(t,e){var r=et,n=new Set(r.map((function(t){return t.id}))),i=new Set(e.map((function(t){return t.id}))),o=e.filter((function(t){return!n.has(t.id)})),c=r.filter((function(t){return!i.has(t.id)&&!t.persistent})).map((function(t){return t.id}));o.forEach(nt),c.forEach(it)},onInputChange:function(){J&&K(!1)},options:rt,getOptionLabel:ot,renderInput:function(t){return g(h,w(w({},t),{},{variant:"standard",placeholder:W}))},renderTags:function(t,e){return t.map((function(t,r){return g(f,w(w({"data-not-migrated-MuiChip":!0,label:ot(t)},e({index:r})),{},{onDelete:t.persistent?null:function(){return it(t.id)}}),r)}))}}),g(u,{children:st})]}),g("div",{className:"c-chip-select-component__list-title",children:g("em",{children:z})}),g(d,{className:s(k,F.listStyle),children:o(Z)?g("div",{className:"c-chip-select-component__empty-list",children:g("p",{"data-testid":"".concat("chipSelector","_emptyLabel"),children:"List is empty"})}):Z.map((function(t){return g(p,{"data-testid":"".concat("chipSelector","_item_").concat(E(t)),button:!0,divider:!0,onClick:function(){return j(i(t,"id"))},children:g(m,{children:E(t)})},i(t,"id"))}))})]})}j.propTypes={items:c.arrayOf(c.shape({})).isRequired,selectedItems:c.shape([]).isRequired,newItems:c.arrayOf(c.shape({})),onAdd:c.func.isRequired,onRemove:c.func.isRequired,allowAddNewItems:c.bool,onAddNew:c.func,onRemoveNew:c.func,chipFormatter:c.func,listItemFormatter:c.func,classes:c.string,listClasses:c.string,hintText:c.string,errorText:c.string,listTitle:c.string};var R=a({listStyle:{borderColor:"grey",overflow:"auto"},formControl:{marginBottom:8},inputRoot:{paddingBottom:"8px !important"}})(r(j));export{R as default};
|
|
2
2
|
//# sourceMappingURL=ChipSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipSelector.js","sources":["../../../../src/components/Template/TemplateSharingDialog/ChipSelector.js"],"sourcesContent":["import { PureComponent } from 'react';\nimport { get, isEmpty } from 'lodash';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport {\n Chip,\n FormControl,\n FormHelperText,\n List as ListComponent,\n ListItem,\n ListItemText,\n TextField,\n withStyles,\n} from '@material-ui/core';\nimport { Autocomplete } from '@material-ui/lab';\n\nimport './ChipSelector.css';\n\nconst PAGE_NAME = 'chipSelector';\n\nconst newItemRegExp = new RegExp('^new.*$');\n\nconst muiStyles = {\n listStyle: {\n borderColor: 'grey',\n overflow: 'auto',\n },\n formControl: { marginBottom: 8 },\n inputRoot: { paddingBottom: '8px !important' },\n};\n\nclass ChipSelector extends PureComponent {\n constructor(props) {\n super(props);\n this.state = { isError: false };\n }\n\n componentDidUpdate({ selectedItems }) {\n if (this.props.selectedItems !== selectedItems) {\n this.setState({ isError: false });\n }\n }\n\n get itemList() {\n return this.listedItems.map(item => (\n <ListItem\n data-testid={`${PAGE_NAME}_item_${this.props.listItemFormatter(item)}`}\n key={get(item, 'id')}\n button\n divider\n onClick={() => this.props.onAdd(get(item, 'id'))}\n >\n <ListItemText>{this.props.listItemFormatter(item)}</ListItemText>\n </ListItem>\n ));\n }\n\n get listedItems() {\n return this.props.items.filter(item => !this.props.selectedItems.has(get(item, 'id')));\n }\n\n get selectedItems() {\n return this.props.items\n .filter(item => this.props.selectedItems.has(get(item, 'id')))\n .concat(this.props.allowAddNewItems ? this.props.newItems : []);\n }\n\n get formattedSelectedItems() {\n return this.selectedItems.map(this.formatItem);\n }\n\n get formattedListedItems() {\n return this.listedItems.map(this.formatItem);\n }\n\n formatItem = item => ({\n text: this.props.chipFormatter(item),\n id: get(item, 'id'),\n persistent: get(item, 'persistent', false), // NOTE: Item is not removable\n });\n\n handleChange = (e, nextItems) => {\n const prevItems = this.formattedSelectedItems;\n const prevIdsSet = new Set(prevItems.map(item => item.id));\n const nextIdsSet = new Set(nextItems.map(item => item.id));\n\n const itemsToAdd = nextItems.filter(item => !prevIdsSet.has(item.id));\n const itemsIdsToRemove = prevItems\n .filter(item => !nextIdsSet.has(item.id) && !item.persistent)\n .map(item => item.id);\n itemsToAdd.forEach(this.handleRequestAdd);\n itemsIdsToRemove.forEach(this.handleRequestDelete);\n };\n\n handleRequestAdd = ({ id, text }) => {\n if (this.props.allowAddNewItems) {\n if (this.itemWithSameNameExists(text)) {\n this.setState({ isError: true });\n } else {\n this.props.onAddNew({\n id: `new${text}`,\n name: text,\n });\n }\n } else if (this.listedItems.find(item => get(item, 'id') === id)) {\n this.props.onAdd(id);\n } else {\n this.setState({ isError: true });\n }\n };\n\n handleRequestDelete = id => {\n if (this.props.allowAddNewItems && newItemRegExp.test(id)) {\n this.props.onRemoveNew(id);\n } else {\n this.props.onRemove(id);\n }\n };\n\n handleUpdateInput = () => {\n if (this.state.isError) {\n this.setState({ isError: false });\n }\n };\n\n getOptionLabel = option => option.text;\n\n renderTags = (value, getCustomizedTagProps) =>\n value.map((option, index) => (\n <Chip\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n data-not-migrated-MuiChip\n label={this.getOptionLabel(option)}\n {...getCustomizedTagProps({ index })}\n onDelete={option.persistent ? null : () => this.handleRequestDelete(option.id)}\n />\n ));\n\n renderInput = params => (\n <TextField {...params} variant=\"standard\" placeholder={this.props.hintText} />\n );\n\n itemWithSameNameExists = text =>\n this.props.items\n .concat(this.props.newItems)\n .map(this.formatItem)\n .find(item => get(item, 'text') === text);\n\n render() {\n const errorText = this.state.isError ? this.props.errorText : '';\n const { classes } = this.props;\n\n return (\n <div>\n <FormControl className={classes.formControl} error={!!errorText} fullWidth>\n <Autocomplete\n data-testid=\"generic_chipInput\"\n multiple\n fullWidth\n id=\"chip-selector\"\n classes={{ inputRoot: classes.inputRoot }}\n value={this.formattedSelectedItems}\n onChange={this.handleChange}\n onInputChange={this.handleUpdateInput}\n options={this.formattedListedItems}\n getOptionLabel={this.getOptionLabel}\n renderInput={this.renderInput}\n renderTags={this.renderTags}\n />\n <FormHelperText>{errorText}</FormHelperText>\n </FormControl>\n\n <div className=\"c-chip-select-component__list-title\">\n <em>{this.props.listTitle}</em>\n </div>\n <ListComponent className={classNames(this.props.listClasses, this.props.classes.listStyle)}>\n {!isEmpty(this.listedItems) ? (\n this.itemList\n ) : (\n <div className=\"c-chip-select-component__empty-list\">\n <p data-testid={`${PAGE_NAME}_emptyLabel`}>List is empty</p>\n </div>\n )}\n </ListComponent>\n </div>\n );\n }\n}\n\nChipSelector.propTypes = {\n items: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n selectedItems: PropTypes.shape([]).isRequired,\n newItems: PropTypes.arrayOf(PropTypes.shape({})),\n onAdd: PropTypes.func.isRequired,\n onRemove: PropTypes.func.isRequired,\n allowAddNewItems: PropTypes.bool,\n onAddNew: PropTypes.func,\n onRemoveNew: PropTypes.func,\n chipFormatter: PropTypes.func,\n listItemFormatter: PropTypes.func,\n classes: PropTypes.string,\n listClasses: PropTypes.string,\n hintText: PropTypes.string,\n errorText: PropTypes.string,\n listTitle: PropTypes.string,\n};\n\nChipSelector.defaultProps = {\n allowAddNewItems: false,\n chipFormatter: item => item.toString(),\n listItemFormatter: item => item.toString(),\n classes: 'c-chip-select-component__container',\n listClasses: 'c-chip-select-component__list',\n hintText: null,\n errorText: 'You can not add not existing item',\n listTitle: 'All items',\n onAddNew: null,\n onRemoveNew: null,\n newItems: null,\n};\n\nexport default withStyles(muiStyles)(ChipSelector);\n"],"names":["newItemRegExp","RegExp","ChipSelector","_PureComponent","_inherits","PureComponent","_super","_createSuper","props","_this","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","item","text","chipFormatter","id","get","persistent","e","nextItems","prevItems","formattedSelectedItems","prevIdsSet","Set","map","nextIdsSet","itemsToAdd","filter","has","itemsIdsToRemove","forEach","handleRequestAdd","handleRequestDelete","_ref","allowAddNewItems","itemWithSameNameExists","setState","isError","onAddNew","concat","name","listedItems","find","onAdd","test","onRemoveNew","onRemove","state","option","value","getCustomizedTagProps","index","_jsx","Chip","_objectSpread","label","getOptionLabel","onDelete","params","TextField","variant","placeholder","hintText","items","newItems","formatItem","_createClass","key","_ref2","selectedItems","_this2","ListItem","PAGE_NAME","listItemFormatter","button","divider","onClick","children","ListItemText","_this3","_this4","errorText","classes","_jsxs","FormControl","className","formControl","error","fullWidth","Autocomplete","multiple","inputRoot","onChange","handleChange","onInputChange","handleUpdateInput","options","formattedListedItems","renderInput","renderTags","FormHelperText","listTitle","ListComponent","classNames","listClasses","listStyle","isEmpty","itemList","propTypes","PropTypes","arrayOf","shape","isRequired","func","bool","string","defaultProps","toString","ChipSelector$1","withStyles","borderColor","overflow","marginBottom","paddingBottom"],"mappings":"6vDAkBA,IAEMA,EAAgB,IAAIC,OAAO,WAW3BC,EAAY,SAAAC,GAAAC,EAAAF,EAASG,GAAT,IAAAC,EA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AAmB,SAAA7D,GAAI,OAAIA,EAAKyG,UAAU,EAC1CnC,QAAS,qCACTsB,YAAa,gCACb1C,SAAU,KACVmB,UAAW,oCACXoB,UAAW,YACX/D,SAAU,KACVO,YAAa,KACbmB,SAAU,MAGZ,IAAAsD,EAAeC,EAxMG,CAChBd,UAAW,CACTe,YAAa,OACbC,SAAU,QAEZnC,YAAa,CAAEoC,aAAc,GAC7B/B,UAAW,CAAEgC,cAAe,mBAkMfJ,CAAsBxH"}
|
|
1
|
+
{"version":3,"file":"ChipSelector.js","sources":["../../../../src/components/Template/TemplateSharingDialog/ChipSelector.js"],"sourcesContent":["import { memo, useState } from 'react';\nimport { get, isEmpty } from 'lodash';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport {\n Chip,\n FormControl,\n FormHelperText,\n List as ListComponent,\n ListItem,\n ListItemText,\n TextField,\n withStyles,\n} from '@material-ui/core';\nimport { Autocomplete } from '@material-ui/lab';\n\nimport './ChipSelector.css';\n\nconst PAGE_NAME = 'chipSelector';\n\nconst newItemRegExp = new RegExp('^new.*$');\n\nconst muiStyles = {\n listStyle: {\n borderColor: 'grey',\n overflow: 'auto',\n },\n formControl: { marginBottom: 8 },\n inputRoot: { paddingBottom: '8px !important' },\n};\n\nconst defaultFormatter = item => item.toString();\n\n/** @param {any} props Preserve the legacy component's public prop type. */\nfunction ChipSelector({\n items,\n selectedItems,\n newItems = null,\n onAdd,\n onRemove,\n allowAddNewItems = false,\n onAddNew = null,\n onRemoveNew = null,\n chipFormatter = defaultFormatter,\n listItemFormatter = defaultFormatter,\n classes = 'c-chip-select-component__container',\n listClasses = 'c-chip-select-component__list',\n hintText = null,\n errorText = 'You can not add not existing item',\n listTitle = 'All items',\n}) {\n const [isError, setIsError] = useState(false);\n const [previousSelectedItems, setPreviousSelectedItems] = useState(selectedItems);\n\n if (selectedItems !== previousSelectedItems) {\n setPreviousSelectedItems(selectedItems);\n setIsError(false);\n }\n\n const listedItems = items.filter(item => !selectedItems.has(get(item, 'id')));\n const formatItem = item => ({\n text: chipFormatter(item),\n id: get(item, 'id'),\n persistent: get(item, 'persistent', false), // NOTE: Item is not removable\n });\n\n const formattedSelectedItems = items\n .filter(item => selectedItems.has(get(item, 'id')))\n .concat(allowAddNewItems ? newItems : [])\n .map(formatItem);\n const formattedListedItems = listedItems.map(formatItem);\n\n const handleChange = (e, nextItems) => {\n const prevItems = formattedSelectedItems;\n const prevIdsSet = new Set(prevItems.map(item => item.id));\n const nextIdsSet = new Set(nextItems.map(item => item.id));\n\n const itemsToAdd = nextItems.filter(item => !prevIdsSet.has(item.id));\n const itemsIdsToRemove = prevItems\n .filter(item => !nextIdsSet.has(item.id) && !item.persistent)\n .map(item => item.id);\n itemsToAdd.forEach(handleRequestAdd);\n itemsIdsToRemove.forEach(handleRequestDelete);\n };\n\n const handleRequestAdd = ({ id, text }) => {\n if (allowAddNewItems) {\n if (itemWithSameNameExists(text)) {\n setIsError(true);\n } else {\n onAddNew({\n id: `new${text}`,\n name: text,\n });\n }\n } else if (listedItems.find(item => get(item, 'id') === id)) {\n onAdd(id);\n } else {\n setIsError(true);\n }\n };\n\n const handleRequestDelete = id => {\n if (allowAddNewItems && newItemRegExp.test(id)) {\n onRemoveNew(id);\n } else {\n onRemove(id);\n }\n };\n\n const handleUpdateInput = () => {\n if (isError) {\n setIsError(false);\n }\n };\n\n const getOptionLabel = option => option.text;\n\n const renderTags = (value, getCustomizedTagProps) =>\n value.map((option, index) => (\n <Chip\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n data-not-migrated-MuiChip\n label={getOptionLabel(option)}\n {...getCustomizedTagProps({ index })}\n onDelete={option.persistent ? null : () => handleRequestDelete(option.id)}\n />\n ));\n\n const renderInput = params => <TextField {...params} variant=\"standard\" placeholder={hintText} />;\n\n const itemWithSameNameExists = text =>\n items\n .concat(newItems)\n .map(formatItem)\n .find(item => get(item, 'text') === text);\n\n const displayedErrorText = isError ? errorText : '';\n\n return (\n <div>\n <FormControl className={classes.formControl} error={!!displayedErrorText} fullWidth>\n <Autocomplete\n data-testid=\"generic_chipInput\"\n multiple\n fullWidth\n id=\"chip-selector\"\n classes={{ inputRoot: classes.inputRoot }}\n value={formattedSelectedItems}\n onChange={handleChange}\n onInputChange={handleUpdateInput}\n options={formattedListedItems}\n getOptionLabel={getOptionLabel}\n renderInput={renderInput}\n renderTags={renderTags}\n />\n <FormHelperText>{displayedErrorText}</FormHelperText>\n </FormControl>\n\n <div className=\"c-chip-select-component__list-title\">\n <em>{listTitle}</em>\n </div>\n <ListComponent className={classNames(listClasses, classes.listStyle)}>\n {!isEmpty(listedItems) ? (\n listedItems.map(item => (\n <ListItem\n data-testid={`${PAGE_NAME}_item_${listItemFormatter(item)}`}\n key={get(item, 'id')}\n button\n divider\n onClick={() => onAdd(get(item, 'id'))}\n >\n <ListItemText>{listItemFormatter(item)}</ListItemText>\n </ListItem>\n ))\n ) : (\n <div className=\"c-chip-select-component__empty-list\">\n <p data-testid={`${PAGE_NAME}_emptyLabel`}>List is empty</p>\n </div>\n )}\n </ListComponent>\n </div>\n );\n}\n\nChipSelector.propTypes = {\n items: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n selectedItems: PropTypes.shape([]).isRequired,\n newItems: PropTypes.arrayOf(PropTypes.shape({})),\n onAdd: PropTypes.func.isRequired,\n onRemove: PropTypes.func.isRequired,\n allowAddNewItems: PropTypes.bool,\n onAddNew: PropTypes.func,\n onRemoveNew: PropTypes.func,\n chipFormatter: PropTypes.func,\n listItemFormatter: PropTypes.func,\n classes: PropTypes.string,\n listClasses: PropTypes.string,\n hintText: PropTypes.string,\n errorText: PropTypes.string,\n listTitle: PropTypes.string,\n};\n\nexport default withStyles(muiStyles)(memo(ChipSelector));\n"],"names":["newItemRegExp","RegExp","defaultFormatter","item","toString","ChipSelector","_ref","items","selectedItems","_ref$newItems","newItems","onAdd","onRemove","_ref$allowAddNewItems","allowAddNewItems","_ref$onAddNew","onAddNew","_ref$onRemoveNew","onRemoveNew","_ref$chipFormatter","chipFormatter","_ref$listItemFormatte","listItemFormatter","_ref$classes","classes","_ref$listClasses","listClasses","_ref$hintText","hintText","_ref$errorText","errorText","_ref$listTitle","listTitle","useState","_useState2","_slicedToArray","_useState","isError","setIsError","_useState4","_useState3","previousSelectedItems","setPreviousSelectedItems","listedItems","filter","has","get","formatItem","text","id","persistent","formattedSelectedItems","concat","map","formattedListedItems","handleRequestAdd","_ref2","itemWithSameNameExists","name","find","handleRequestDelete","test","getOptionLabel","option","displayedErrorText","_jsxs","children","FormControl","className","formControl","error","fullWidth","_jsx","Autocomplete","multiple","inputRoot","value","onChange","e","nextItems","prevItems","prevIdsSet","Set","nextIdsSet","itemsToAdd","itemsIdsToRemove","forEach","onInputChange","options","renderInput","params","TextField","_objectSpread","variant","placeholder","renderTags","getCustomizedTagProps","index","Chip","label","onDelete","FormHelperText","ListComponent","classNames","listStyle","isEmpty","ListItem","button","divider","onClick","ListItemText","propTypes","PropTypes","arrayOf","shape","isRequired","func","bool","string","withStyles","borderColor","overflow","marginBottom","paddingBottom","memo"],"mappings":"wkCAkBA,IAEMA,EAAgB,IAAIC,OAAO,WAW3BC,EAAmB,SAAAC,GAAI,OAAIA,EAAKC,UAAU,EAGhD,SAASC,EAgBNC,GAAA,IAfDC,IAAAA,MACAC,IAAAA,cAAaC,EAAAH,EACbI,SAAAA,aAAW,KAAID,EACfE,IAAAA,MACAC,IAAAA,SAAQC,EAAAP,EACRQ,iBAAAA,cAAwBD,EAAAE,EAAAT,EACxBU,SAAAA,aAAW,KAAID,EAAAE,EAAAX,EACfY,YAAAA,aAAc,KAAID,EAAAE,EAAAb,EAClBc,cAAAA,aAAgBlB,EAAgBiB,EAAAE,EAAAf,EAChCgB,kBAAAA,aAAoBpB,EAAgBmB,EAAAE,EAAAjB,EACpCkB,QAAAA,aAAU,qCAAoCD,EAAAE,EAAAnB,EAC9CoB,YAAAA,aAAc,gCAA+BD,EAAAE,EAAArB,EAC7CsB,SAAAA,aAAW,KAAID,EAAAE,E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EgD,cAAe,mBAgLfJ,CAAsBK,EAAKvH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipSelector.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/Template/TemplateSharingDialog/__tests__/ChipSelector.test.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommentLoader.test.d.ts","sourceRoot":"","sources":["../../../src/components/__tests__/CommentLoader.test.js"],"names":[],"mappings":""}
|
package/mcp-server/server.mjs
CHANGED