@teppen/react-ui 1.8.2 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("./context.js"),o=require("../id/provider.js"),i=require("../lib/id-generator.js");exports.OptionsArea=function(){var r=o.useIdContext(),s=n.useOptionsWindow(),l=s.state,u=s.actions,a=t.useState(""),c=a[0],d=a[1],f=t.useState(void 0),v=f[0],p=f[1],m=t.useState({top:0,left:0}),g=m[0],y=m[1],h=l.isOpen?0===l.options.length?void 0:"number"==typeof v&&v<l.options.length&&v>=0?l.options[v].value:void 0:void 0;return t.useEffect((function(){if(l.isOpen){var e=document.getElementById(i.IdGenerator.generateIdSelectBoxOption(r,null!=h?h:""));if(!e)return;if(0===g.top&&0===g.left)return;e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}else p(void 0)}),[l,g,h]),t.useEffect((function(){if(l.isOpen){var e=function(e){if("ArrowDown"===e.key)e.preventDefault(),p((function(e){return"number"==typeof e?Math.min(e+1,l.options.length-1):0}));else if("ArrowUp"===e.key)e.preventDefault(),p((function(e){return"number"==typeof e?Math.max(e-1,0):0}));else if("Enter"===e.key&&(e.preventDefault(),"number"==typeof v)){if(0===l.options.length||l.options.length<=v)return;var t=l.options[v].value;if(!t)return;d(t),l.onSelect(t),u.closeOptionsWindow()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}}),[l,v,p]),t.useEffect((function(){var e=setTimeout((function(){var e;if(l.isOpen){for(var t=null===(e=document.getElementById("ReactUI:SelectBox:OptionsArea"))||void 0===e?void 0:e.parentElement,n=["relative","fixed","absolute","sticky"];t;){var o=n.some((function(e){return t.className.includes(e)})),i=n.some((function(e){return t.style.position.includes(e)}));if(o||i){console.log(t);break}t=t.parentElement}var r=document.getElementById(l.selectBoxId);if(r){var s=r.getBoundingClientRect(),u=s.top+s.height,a=s.left;if(t){var c=t.getBoundingClientRect();y({top:u-c.top,left:a-c.left})}else y({top:u+window.scrollY,left:a+window.scrollX})}}}),0);return function(){clearTimeout(e)}}),[l.isOpen]),t.useEffect((function(){var e=function(e){if(l.isOpen){var t=document.getElementById(l.selectBoxId),n=document.getElementById("ReactUI:SelectBox:OptionsArea"),o=e.target;o instanceof Node&&(null==t?void 0:t.contains(o))||o instanceof Node&&(null==n?void 0:n.contains(o))||(u.setSearchText(""),u.closeOptionsWindow())}};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[l.isOpen]),l.isOpen?e.jsx("div",{id:"ReactUI:SelectBox:OptionsArea",className:"absolute min-w-fit max-h-[40vh] overflow-auto border border-gray-300 z-10",style:g,children:l.options.map((function(t){var n,o;return e.jsx("div",{id:i.IdGenerator.generateIdSelectBoxOption(r,null!==(n=t.value)&&void 0!==n?n:""),className:"hover:bg-gray-200 px-2 py-1 ".concat("string"==typeof h?h===t.value?"bg-gray-100":"bg-white":c===t.value?"bg-gray-100":"bg-white"),onClick:function(){l.onSelect(t.value),u.closeOptionsWindow()},children:null!==(o=t.searchLabel)&&void 0!==o?o:t.label},t.value)}))}):e.jsx(e.Fragment,{})};
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("./context.js"),o=require("../id/provider.js"),i=require("../lib/id-generator.js");exports.OptionsArea=function(){var r=o.useIdContext(),s=n.useOptionsWindow(),l=s.state,u=s.actions,a=t.useState(""),c=a[0],d=a[1],f=t.useState(void 0),p=f[0],v=f[1],m=t.useState({top:0,left:0}),g=m[0],y=m[1],h=l.isOpen?0===l.options.length?void 0:"number"==typeof p&&p<l.options.length&&p>=0?l.options[p].value:void 0:void 0;return t.useEffect((function(){if(l.isOpen){var e=document.getElementById(i.IdGenerator.generateIdSelectBoxOption(r,null!=h?h:""));if(!e)return;if(0===g.top&&0===g.left)return;e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}else v(void 0)}),[l,g,h]),t.useEffect((function(){if(l.isOpen){var e=function(e){if("ArrowDown"===e.key)e.preventDefault(),v((function(e){return"number"==typeof e?Math.min(e+1,l.options.length-1):0}));else if("ArrowUp"===e.key)e.preventDefault(),v((function(e){return"number"==typeof e?Math.max(e-1,0):0}));else if("Enter"===e.key&&(e.preventDefault(),"number"==typeof p)){if(0===l.options.length||l.options.length<=p)return;var t=l.options[p].value;if(!t)return;d(t),l.onSelect(t),u.closeOptionsWindow()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}}),[l,p,v]),t.useEffect((function(){var e=setTimeout((function(){var e;if(l.isOpen){for(var t=null===(e=document.getElementById("ReactUI:SelectBox:OptionsArea"))||void 0===e?void 0:e.parentElement,n=["relative","fixed","absolute","sticky"];t;){var o=n.some((function(e){return t.className.includes(e)})),i=n.some((function(e){return t.style.position.includes(e)}));if(o||i)break;t=t.parentElement}var r=document.getElementById(l.selectBoxId);if(r){var s=r.getBoundingClientRect(),u=s.top+s.height,a=s.left;if(t){var c=t.getBoundingClientRect();y({top:u-c.top+t.scrollTop,left:a-c.left+t.scrollLeft})}else y({top:u+window.scrollY,left:a+window.scrollX})}}}),0);return function(){clearTimeout(e)}}),[l.isOpen]),t.useEffect((function(){var e=function(e){if(l.isOpen){var t=document.getElementById(l.selectBoxId),n=document.getElementById("ReactUI:SelectBox:OptionsArea"),o=e.target;o instanceof Node&&(null==t?void 0:t.contains(o))||o instanceof Node&&(null==n?void 0:n.contains(o))||(u.setSearchText(""),u.closeOptionsWindow())}};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[l.isOpen]),l.isOpen?e.jsx("div",{id:"ReactUI:SelectBox:OptionsArea",className:"absolute min-w-fit max-h-[40vh] overflow-auto border border-gray-300 z-10",style:g,children:l.options.map((function(t){var n,o;return e.jsx("div",{id:i.IdGenerator.generateIdSelectBoxOption(r,null!==(n=t.value)&&void 0!==n?n:""),className:"hover:bg-gray-200 px-2 py-1 ".concat("string"==typeof h?h===t.value?"bg-gray-100":"bg-white":c===t.value?"bg-gray-100":"bg-white"),onClick:function(){l.onSelect(t.value),u.closeOptionsWindow()},children:null!==(o=t.searchLabel)&&void 0!==o?o:t.label},t.value)}))}):e.jsx(e.Fragment,{})};
2
2
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../../../src/select-box/options-window/component.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { useOptionsWindow } from \"../options-window\";\nimport { useIdContext } from \"../id/provider\";\nimport { IdGenerator } from \"../lib\";\n\nexport function OptionsArea() {\n const id = useIdContext();\n const { state, actions } = useOptionsWindow();\n const [value, setValue] = useState(\"\");\n const [selectingIndex, setSelectingIndex] = useState<number | undefined>(\n undefined\n );\n const [position, setPosition] = useState({ top: 0, left: 0 });\n\n const selectingValue = state.isOpen\n ? state.options.length === 0\n ? undefined\n : typeof selectingIndex === \"number\" &&\n selectingIndex < state.options.length &&\n selectingIndex >= 0\n ? state.options[selectingIndex].value\n : undefined\n : undefined;\n\n useEffect(() => {\n if (state.isOpen) {\n const optionElement = document.getElementById(\n IdGenerator.generateIdSelectBoxOption(id, selectingValue ?? \"\")\n );\n\n if (!optionElement) return;\n if (position.top === 0 && position.left === 0) return;\n\n optionElement.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"nearest\",\n });\n } else {\n setSelectingIndex(undefined);\n }\n }, [state, position, selectingValue]);\n\n useEffect(() => {\n if (state.isOpen) {\n const handleKeydown = (e: KeyboardEvent) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setSelectingIndex((prev) =>\n typeof prev === \"number\"\n ? Math.min(prev + 1, state.options.length - 1)\n : 0\n );\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n setSelectingIndex((prev) =>\n typeof prev === \"number\" ? Math.max(prev - 1, 0) : 0\n );\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (typeof selectingIndex === \"number\") {\n if (\n state.options.length === 0 ||\n state.options.length <= selectingIndex\n )\n return;\n\n const value = state.options[selectingIndex].value;\n\n if (!value) return;\n\n setValue(value);\n state.onSelect(value);\n actions.closeOptionsWindow();\n }\n }\n };\n\n document.addEventListener(\"keydown\", handleKeydown);\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeydown);\n };\n }\n }, [state, selectingIndex, setSelectingIndex]);\n\n useEffect(() => {\n const searchParentElement = () => {\n if (state.isOpen) {\n let parentElement = document.getElementById(\n \"ReactUI:SelectBox:OptionsArea\"\n )?.parentElement;\n\n const positionClasses = [\"relative\", \"fixed\", \"absolute\", \"sticky\"];\n\n while (parentElement) {\n const hasPositionClass = positionClasses.some((className) =>\n parentElement!.className.includes(className)\n );\n\n const hasPositionStyle = positionClasses.some((style) =>\n parentElement!.style.position.includes(style)\n );\n\n if (hasPositionClass || hasPositionStyle) {\n console.log(parentElement);\n break;\n }\n\n parentElement = parentElement.parentElement;\n }\n\n const selectBoxElement = document.getElementById(state.selectBoxId);\n\n if (selectBoxElement) {\n const rect = selectBoxElement.getBoundingClientRect();\n let top = rect.top + rect.height;\n let left = rect.left;\n\n if (parentElement) {\n const parentRect = parentElement.getBoundingClientRect();\n setPosition({\n top: top - parentRect.top,\n left: left - parentRect.left,\n });\n } else {\n setPosition({\n top: top + window.scrollY,\n left: left + window.scrollX,\n });\n }\n }\n }\n };\n\n const timer = setTimeout(searchParentElement, 0);\n\n return () => {\n clearTimeout(timer);\n };\n }, [state.isOpen]);\n\n useEffect(() => {\n const onClickOutOfSelectBox = (e: MouseEvent) => {\n if (!state.isOpen) return;\n\n // SelectBox関連の要素を取得\n const frameElement = document.getElementById(state.selectBoxId);\n const optionsElement = document.getElementById(\n \"ReactUI:SelectBox:OptionsArea\"\n );\n\n // クリックされた要素を取得\n const ele = e.target;\n\n if (ele instanceof Node && frameElement?.contains(ele)) return;\n\n if (ele instanceof Node && optionsElement?.contains(ele)) return;\n\n actions.setSearchText(\"\");\n actions.closeOptionsWindow();\n };\n\n document.addEventListener(\"mousedown\", onClickOutOfSelectBox);\n\n return () => {\n document.removeEventListener(\"mousedown\", onClickOutOfSelectBox);\n };\n }, [state.isOpen]);\n\n if (!state.isOpen) return <></>;\n\n return (\n <div\n id={\"ReactUI:SelectBox:OptionsArea\"}\n className=\"absolute min-w-fit max-h-[40vh] overflow-auto border border-gray-300 z-10\"\n style={position}\n >\n {state.options.map((option) => (\n <div\n id={IdGenerator.generateIdSelectBoxOption(id, option.value ?? \"\")}\n className={`hover:bg-gray-200 px-2 py-1 ${\n typeof selectingValue === \"string\"\n ? selectingValue === option.value\n ? \"bg-gray-100\"\n : \"bg-white\"\n : value === option.value\n ? \"bg-gray-100\"\n : \"bg-white\"\n }`}\n key={option.value}\n onClick={() => {\n state.onSelect(option.value);\n actions.closeOptionsWindow();\n }}\n >\n {option.searchLabel ?? option.label}\n </div>\n ))}\n </div>\n );\n}\n"],"names":["id","useIdContext","_a","useOptionsWindow","state","actions","_b","useState","value","setValue","_c","undefined","selectingIndex","setSelectingIndex","_d","top","left","position","setPosition","selectingValue","isOpen","options","length","useEffect","optionElement","document","getElementById","IdGenerator","generateIdSelectBoxOption","scrollIntoView","behavior","block","inline","handleKeydown_1","e","key","preventDefault","prev","Math","min","max","value_1","onSelect","closeOptionsWindow","addEventListener","removeEventListener","timer","setTimeout","parentElement_1","parentElement","positionClasses","hasPositionClass","some","className","includes","hasPositionStyle","style","console","log","selectBoxElement","selectBoxId","rect","getBoundingClientRect","top_1","height","parentRect","window","scrollY","scrollX","clearTimeout","onClickOutOfSelectBox","frameElement","optionsElement","ele","target","Node","contains","setSearchText","_jsx","map","option","jsx","concat","onClick","children","searchLabel","label"],"mappings":"+LAME,IAAMA,EAAKC,EAAAA,eACLC,EAAqBC,EAAgBA,mBAAnCC,EAAKF,EAAAE,MAAEC,EAAOH,EAAAG,QAChBC,EAAoBC,EAAAA,SAAS,IAA5BC,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAChBI,EAAsCH,EAAAA,cAC1CI,GADKC,EAA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EAAMvC,EAAEwC,OAEVD,aAAeE,OAAQJ,aAAA,EAAAA,EAAcK,SAASH,KAE9CA,aAAeE,OAAQH,aAAA,EAAAA,EAAgBI,SAASH,MAEpDpE,EAAQwE,cAAc,IACtBxE,EAAQsC,qBAhBkB,CAiB5B,EAIA,OAFAlB,SAASmB,iBAAiB,YAAa0B,GAEhC,WACL7C,SAASoB,oBAAoB,YAAayB,EAC5C,CACF,GAAG,CAAClE,EAAMgB,SAELhB,EAAMgB,OAGT0D,EAAAA,WACE9E,GAAI,gCACJqD,UAAU,4EACVG,MAAOvC,WAENb,EAAMiB,QAAQ0D,KAAI,SAACC,WAAW,OAC7BF,EACEG,IAAA,MAAA,CAAAjF,GAAI2B,EAAAA,YAAYC,0BAA0B5B,EAAgB,QAAZE,EAAA8E,EAAOxE,aAAK,IAAAN,EAAAA,EAAI,IAC9DmD,UAAW,+BACT6B,OAA0B,iBAAnB/D,EACHA,IAAmB6D,EAAOxE,MACxB,cACA,WACFA,IAAUwE,EAAOxE,MACjB,cACA,YAGN2E,QAAS,WACP/E,EAAMsC,SAASsC,EAAOxE,OACtBH,EAAQsC,oBACV,EAECyC,SAAsB,QAAtB9E,EAAA0E,EAAOK,mBAAe,IAAA/E,EAAAA,EAAA0E,EAAOM,OANzBN,EAAOxE,MAQf,MA5BqBsE,oBA+B5B"}
1
+ {"version":3,"file":"component.js","sources":["../../../../../src/select-box/options-window/component.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { useOptionsWindow } from \"../options-window\";\nimport { useIdContext } from \"../id/provider\";\nimport { IdGenerator } from \"../lib\";\n\nexport function OptionsArea() {\n const id = useIdContext();\n const { state, actions } = useOptionsWindow();\n const [value, setValue] = useState(\"\");\n const [selectingIndex, setSelectingIndex] = useState<number | undefined>(\n undefined\n );\n const [position, setPosition] = useState({ top: 0, left: 0 });\n\n const selectingValue = state.isOpen\n ? state.options.length === 0\n ? undefined\n : typeof selectingIndex === \"number\" &&\n selectingIndex < state.options.length &&\n selectingIndex >= 0\n ? state.options[selectingIndex].value\n : undefined\n : undefined;\n\n useEffect(() => {\n if (state.isOpen) {\n const optionElement = document.getElementById(\n IdGenerator.generateIdSelectBoxOption(id, selectingValue ?? \"\")\n );\n\n if (!optionElement) return;\n if (position.top === 0 && position.left === 0) return;\n\n optionElement.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"nearest\",\n });\n } else {\n setSelectingIndex(undefined);\n }\n }, [state, position, selectingValue]);\n\n useEffect(() => {\n if (state.isOpen) {\n const handleKeydown = (e: KeyboardEvent) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setSelectingIndex((prev) =>\n typeof prev === \"number\"\n ? Math.min(prev + 1, state.options.length - 1)\n : 0\n );\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n setSelectingIndex((prev) =>\n typeof prev === \"number\" ? Math.max(prev - 1, 0) : 0\n );\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (typeof selectingIndex === \"number\") {\n if (\n state.options.length === 0 ||\n state.options.length <= selectingIndex\n )\n return;\n\n const value = state.options[selectingIndex].value;\n\n if (!value) return;\n\n setValue(value);\n state.onSelect(value);\n actions.closeOptionsWindow();\n }\n }\n };\n\n document.addEventListener(\"keydown\", handleKeydown);\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeydown);\n };\n }\n }, [state, selectingIndex, setSelectingIndex]);\n\n useEffect(() => {\n const searchParentElement = () => {\n if (state.isOpen) {\n let parentElement = document.getElementById(\n \"ReactUI:SelectBox:OptionsArea\"\n )?.parentElement;\n\n const positionClasses = [\"relative\", \"fixed\", \"absolute\", \"sticky\"];\n\n while (parentElement) {\n const hasPositionClass = positionClasses.some((className) =>\n parentElement!.className.includes(className)\n );\n\n const hasPositionStyle = positionClasses.some((style) =>\n parentElement!.style.position.includes(style)\n );\n\n if (hasPositionClass || hasPositionStyle) break;\n\n parentElement = parentElement.parentElement;\n }\n\n const selectBoxElement = document.getElementById(state.selectBoxId);\n\n if (selectBoxElement) {\n const rect = selectBoxElement.getBoundingClientRect();\n let top = rect.top + rect.height;\n let left = rect.left;\n\n if (parentElement) {\n const parentRect = parentElement.getBoundingClientRect();\n setPosition({\n top: top - parentRect.top + parentElement.scrollTop,\n left: left - parentRect.left + parentElement.scrollLeft,\n });\n } else {\n setPosition({\n top: top + window.scrollY,\n left: left + window.scrollX,\n });\n }\n }\n }\n };\n\n const timer = setTimeout(searchParentElement, 0);\n\n return () => {\n clearTimeout(timer);\n };\n }, [state.isOpen]);\n\n useEffect(() => {\n const onClickOutOfSelectBox = (e: MouseEvent) => {\n if (!state.isOpen) return;\n\n // SelectBox関連の要素を取得\n const frameElement = document.getElementById(state.selectBoxId);\n const optionsElement = document.getElementById(\n \"ReactUI:SelectBox:OptionsArea\"\n );\n\n // クリックされた要素を取得\n const ele = e.target;\n\n if (ele instanceof Node && frameElement?.contains(ele)) return;\n\n if (ele instanceof Node && optionsElement?.contains(ele)) return;\n\n actions.setSearchText(\"\");\n actions.closeOptionsWindow();\n };\n\n document.addEventListener(\"mousedown\", onClickOutOfSelectBox);\n\n return () => {\n document.removeEventListener(\"mousedown\", onClickOutOfSelectBox);\n };\n }, [state.isOpen]);\n\n if (!state.isOpen) return <></>;\n\n return (\n <div\n id={\"ReactUI:SelectBox:OptionsArea\"}\n className=\"absolute min-w-fit max-h-[40vh] overflow-auto border border-gray-300 z-10\"\n style={position}\n >\n {state.options.map((option) => (\n <div\n id={IdGenerator.generateIdSelectBoxOption(id, option.value ?? \"\")}\n className={`hover:bg-gray-200 px-2 py-1 ${\n typeof selectingValue === \"string\"\n ? selectingValue === option.value\n ? \"bg-gray-100\"\n : \"bg-white\"\n : value === option.value\n ? \"bg-gray-100\"\n : \"bg-white\"\n }`}\n key={option.value}\n onClick={() => {\n state.onSelect(option.value);\n actions.closeOptionsWindow();\n }}\n >\n {option.searchLabel ?? option.label}\n </div>\n ))}\n </div>\n );\n}\n"],"names":["id","useIdContext","_a","useOptionsWindow","state","actions","_b","useState","value","setValue","_c","undefined","selectingIndex","setSelectingIndex","_d","top","left","position","setPosition","selectingValue","isOpen","options","length","useEffect","optionElement","document","getElementById","IdGenerator","generateIdSelectBoxOption","scrollIntoView","behavior","block","inline","handleKeydown_1","e","key","preventDefault","prev","Math","min","max","value_1","onSelect","closeOptionsWindow","addEventListener","removeEventListener","timer","setTimeout","parentElement_1","parentElement","positionClasses","hasPositionClass","some","className","includes","hasPositionStyle","style","selectBoxElement","selectBoxId","rect","getBoundingClientRect","top_1","height","parentRect","scrollTop","scrollLeft","window","scrollY","scrollX","clearTimeout","onClickOutOfSelectBox","frameElement","optionsElement","ele","target","Node","contains","setSearchText","_jsx","map","option","jsx","concat","onClick","children","searchLabel","label"],"mappings":"+LAME,IAAMA,EAAKC,EAAAA,eACLC,EAAqBC,EAAgBA,mBAAnCC,EAAKF,EAAAE,MAAEC,EAAOH,EAAAG,QAChBC,EAAoBC,EAAAA,SAAS,IAA5BC,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAChBI,EAAsCH,EAAAA,cAC1CI,GADKC,EAAcF,EAAA,GAAEG,EAAiBH,EAAA,GAGlCI,EAA0BP,EAAAA,SAAS,CAAEQ,IAAK,EAAGC,KAAM,IAAlDC,OAAUC,OAEXC,EAAiBf,EAAMgB,OACA,IAAzBhB,EAAMiB,QAAQC,YACZX,EAC0B,iBAAnBC,GACPA,EAAiBR,EAAMiB,QAAQC,QAC/BV,GAAkB,EAClBR,EAAMiB,QAAQT,GAAgBJ,WAC9BG,OACFA,EAiJJ,OA/IAY,EAAAA,WAAU,WACR,GAAInB,EAAMgB,OAAQ,CAChB,IAAMI,EAAgBC,SAASC,eAC7BC,EAAWA,YAACC,0BAA0B5B,EAAImB,QAAAA,EAAkB,KAG9D,IAAKK,EAAe,OACpB,GAAqB,IAAjBP,EAASF,KAA+B,IAAlBE,EAASD,KAAY,OAE/CQ,EAAcK,eAAe,CAC3BC,SAAU,SACVC,MAAO,UACPC,OAAQ,WAEX,MACCn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0B,iBAAnB/D,EACHA,IAAmB6D,EAAOxE,MACxB,cACA,WACFA,IAAUwE,EAAOxE,MACjB,cACA,YAGN2E,QAAS,WACP/E,EAAMsC,SAASsC,EAAOxE,OACtBH,EAAQsC,oBACV,EAECyC,SAAsB,QAAtB9E,EAAA0E,EAAOK,mBAAe,IAAA/E,EAAAA,EAAA0E,EAAOM,OANzBN,EAAOxE,MAQf,MA5BqBsE,oBA+B5B"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("./columns-width/context.js");require("../../../node_modules/tslib/tslib.es6.js");var l=require("./header-v2-hook.js"),n=require("../checkbox/components.js"),s=require("../../search-bar/condition-search-bar/base.js"),i=require("../id/provider.js"),a=require("../filter-v2/context.js");var o=t.memo((function(r){var n=t.useRef(null),s=l.useResizeColWidthHook(r.keyName).onMouseDownResizeWidth,i=n.current?r.colWidth-n.current.clientWidth:r.colWidth;return e.jsxs("div",{className:"relative",style:{width:r.colWidth,maxWidth:r.colWidth,minWidth:r.colWidth},children:[e.jsxs("div",{className:"flex justify-between items-center bg-gray-200 text-gray-600 h-[32px]",children:[e.jsx("div",{className:"px-2",style:{maxWidth:i},children:r.label&&e.jsx("p",{className:"text-left font-bold text-nowrap overflow-hidden text-ellipsis",children:r.label})}),e.jsx("div",{ref:n,className:"flex items-center w-fit shrink-0 gap-1 px-1",children:!r.disableSort&&r.generateSortButton&&r.generateSortButton(r.keyName)})]}),e.jsx("div",{className:"absolute top-0 right-0 grid place-items-end py-1 w-[4px] h-full cursor-col-resize",onMouseDown:s,children:e.jsx("div",{className:"w-[1px] h-full bg-white"})})]})}));exports.TableHeader=function(c){var d=i.useTableIdGenerator(),u=r.useColumnsWidthState().getColumnWidth,h=a.useFilter(),x=h.conditions,b=h.addFilter,m=h.removeFilter,p=l.useScrollXRef();t.useEffect((function(){if(p.current){var e=p.current,t=function(t){0!==t.deltaY&&(t.preventDefault(),e.scrollLeft+=t.deltaY)};return e.addEventListener("wheel",t),function(){e.removeEventListener("wheel",t)}}}),[p]);var f=t.useCallback((function(e){switch(e.type){case"add":b(e.payload.condition);break;case"remove":m(e.payload.index)}}),[]),y=t.useMemo((function(){return c.cols.filter((function(e){return!!e.label&&(e.editable||!e.editable&&!e.render)})).map((function(e){switch(e.type){case"string":case"number":return{key:e.key.toString(),label:e.label,type:e.type};case"select":return{key:e.key.toString(),label:e.label,type:e.type,options:e.options}}}))}),[c.cols]);return e.jsxs("div",{className:"border-gray-200 bg-gray-200 text-gray-600 rounded-t-md",style:{maxWidth:c.maxWidth},children:[e.jsx("div",{className:"py-2 px-2",children:e.jsx(s.ConditionSearchBar,{id:d.getTableHeaderId(),targets:y,conditions:x,onChangeCondition:f,size:"small"})}),e.jsx("style",{children:"\n .teppen-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n .teppen-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n "}),e.jsx("div",{ref:p,className:"relative max-w-full overflow-x-auto teppen-no-scrollbar",children:e.jsxs("div",{className:"flex h-[32px]",children:[c.checkbox&&e.jsx("th",{className:"w-8 h-full",children:e.jsx(n.AllCheckbox,{rows:c.rows})}),c.cols.map((function(t){return e.jsx(o,{keyName:t.key.toString(),label:t.label,colWidth:u(t.key),disableSort:t.disableSort||!t.editable&&!!t.render,generateSortButton:c.generateSortButton},t.key.toString())}))]})})]})};
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("./columns-width/context.js");require("../../../node_modules/tslib/tslib.es6.js");var l=require("./header-v2-hook.js"),n=require("../checkbox/components.js"),s=require("../../search-bar/condition-search-bar/base.js"),i=require("../id/provider.js"),a=require("../filter-v2/context.js");var o=t.memo((function(r){var n=t.useRef(null),s=l.useResizeColWidthHook(r.keyName).onMouseDownResizeWidth,i=n.current?r.colWidth-n.current.clientWidth:r.colWidth;return e.jsxs("div",{className:"relative",style:{width:r.colWidth,maxWidth:r.colWidth,minWidth:r.colWidth},children:[e.jsxs("div",{className:"flex justify-between items-center bg-gray-200 text-gray-600 h-[32px]",children:[e.jsx("div",{className:"px-2",style:{maxWidth:i},children:r.label&&e.jsx("p",{className:"text-left font-bold text-nowrap overflow-hidden text-ellipsis",children:r.label})}),e.jsx("div",{ref:n,className:"flex items-center w-fit shrink-0 gap-1 px-1",children:!r.disableSort&&r.generateSortButton&&r.generateSortButton(r.keyName)})]}),e.jsx("div",{className:"absolute top-0 right-0 grid place-items-end py-1 w-[4px] h-full cursor-col-resize",onMouseDown:s,children:e.jsx("div",{className:"w-[1px] h-full bg-white"})})]})}));exports.TableHeader=function(c){var d=i.useTableIdGenerator(),u=r.useColumnsWidthState().getColumnWidth,h=a.useFilter(),x=h.conditions,b=h.addFilter,m=h.removeFilter,p=l.useScrollXRef();t.useEffect((function(){if(p.current){var e=p.current,t=function(t){0!==t.deltaY&&(t.preventDefault(),e.scrollLeft+=t.deltaY)};return e.addEventListener("wheel",t),function(){e.removeEventListener("wheel",t)}}}),[p]);var f=t.useCallback((function(e){switch(e.type){case"add":b(e.payload.condition);break;case"remove":m(e.payload.index)}}),[]),v=t.useMemo((function(){return c.cols.filter((function(e){return!!e.label&&(e.editable||!e.editable&&!e.render)})).map((function(e){switch(e.type){case"string":case"number":return{key:e.key.toString(),label:e.label,type:e.type};case"select":return{key:e.key.toString(),label:e.label,type:e.type,options:e.options}}}))}),[c.cols]);return e.jsxs("div",{className:"border-gray-200 bg-gray-200 text-gray-600 rounded-t-md",style:{maxWidth:c.maxWidth},children:[e.jsx("div",{className:"py-2 px-2",children:e.jsx(s.ConditionSearchBar,{id:d.getTableHeaderId(),targets:v,conditions:x,onChangeCondition:f,size:"small"})}),e.jsx("style",{children:"\n .teppen-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n .teppen-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n "}),e.jsx("div",{ref:p,className:"relative max-w-full overflow-x-auto teppen-no-scrollbar",children:e.jsxs("div",{className:"flex h-[32px]",children:[c.checkbox&&e.jsx("div",{className:"w-8 h-full",children:e.jsx(n.AllCheckbox,{rows:c.rows})}),c.cols.map((function(t){return e.jsx(o,{keyName:t.key.toString(),label:t.label,colWidth:u(t.key),disableSort:t.disableSort||!t.editable&&!!t.render,generateSortButton:c.generateSortButton},t.key.toString())}))]})})]})};
2
2
  //# sourceMappingURL=header-v2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"header-v2.js","sources":["../../../../../src/table/header/header-v2.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { DataObject, DataRecord, TTableColumn } from \"../table/type\";\nimport { useColumnsWidthState } from \"./columns-width\";\nimport { useResizeColWidthHook, useScrollXRef } from \"./header-v2-hook\";\nimport { AllCheckbox } from \"../checkbox/components\";\nimport { ConditionSearchBar } from \"../../search-bar\";\nimport { useTableIdGenerator } from \"../id\";\nimport { useFilter } from \"../filter-v2\";\nimport { TConditionChangeAction } from \"../../search-bar/condition-search-bar/condition-input-management/type\";\n\ninterface IPropsTableHeader<T extends DataRecord> {\n cols: TTableColumn<T>[];\n checkbox?: boolean;\n rows: DataObject<T>[];\n maxWidth?: string;\n generateSortButton?: (columnKey: string) => React.ReactNode;\n}\n\nexport function TableHeader<T extends DataRecord>(props: IPropsTableHeader<T>) {\n const idGenerator = useTableIdGenerator();\n const { getColumnWidth } = useColumnsWidthState();\n const { conditions, addFilter, removeFilter } = useFilter();\n const ref = useScrollXRef();\n\n useEffect(() => {\n if (ref.current) {\n const element = ref.current;\n\n const scrollX = (e: WheelEvent) => {\n if (e.deltaY === 0) return;\n\n e.preventDefault();\n element.scrollLeft += e.deltaY;\n };\n\n element.addEventListener(\"wheel\", scrollX);\n\n return () => {\n element.removeEventListener(\"wheel\", scrollX);\n };\n }\n }, [ref]);\n\n const onChangeCondition = useCallback((action: TConditionChangeAction) => {\n switch (action.type) {\n case \"add\":\n addFilter(action.payload.condition);\n break;\n case \"remove\":\n removeFilter(action.payload.index);\n break;\n }\n }, []);\n\n const targets = useMemo(() => {\n return props.cols\n .filter(\n (col) => !!col.label && (col.editable || (!col.editable && !col.render))\n )\n .map((col) => {\n switch (col.type) {\n case \"string\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n };\n case \"number\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n };\n case \"select\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n options: col.options,\n };\n }\n });\n }, [props.cols]);\n\n return (\n <div\n className=\"border-gray-200 bg-gray-200 text-gray-600 rounded-t-md\"\n style={{ maxWidth: props.maxWidth }}\n >\n <div className=\"py-2 px-2\">\n <ConditionSearchBar\n id={idGenerator.getTableHeaderId()}\n targets={targets}\n conditions={conditions}\n onChangeCondition={onChangeCondition}\n size=\"small\"\n />\n </div>\n\n <style>{`\n .teppen-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n .teppen-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n `}</style>\n <div\n ref={ref}\n className=\"relative max-w-full overflow-x-auto teppen-no-scrollbar\"\n >\n <div className=\"flex h-[32px]\">\n {props.checkbox && (\n <th className=\"w-8 h-full\">\n <AllCheckbox rows={props.rows} />\n </th>\n )}\n {props.cols.map((col) => {\n return (\n <HeaderElement\n key={col.key.toString()}\n keyName={col.key.toString()}\n label={col.label}\n colWidth={getColumnWidth(col.key as string)}\n disableSort={col.disableSort || (!col.editable && !!col.render)}\n generateSortButton={props.generateSortButton}\n />\n );\n })}\n </div>\n </div>\n </div>\n );\n}\n\ninterface IPropsHeaderElement {\n keyName: string;\n label?: string;\n colWidth: number;\n disableSort?: boolean;\n generateSortButton?: (columnKey: string) => React.ReactNode;\n}\n\nconst HeaderElement = memo(function HE(props: IPropsHeaderElement) {\n const ref = useRef<HTMLDivElement>(null);\n const { onMouseDownResizeWidth } = useResizeColWidthHook(props.keyName);\n\n const maxWidthLabel = ref.current\n ? props.colWidth - ref.current.clientWidth\n : props.colWidth;\n\n return (\n <div\n className=\"relative\"\n style={{\n width: props.colWidth,\n maxWidth: props.colWidth,\n minWidth: props.colWidth,\n }}\n >\n <div\n className={`flex justify-between items-center bg-gray-200 text-gray-600 h-[32px]`}\n >\n <div className=\"px-2\" style={{ maxWidth: maxWidthLabel }}>\n {props.label && (\n <p\n className={`text-left font-bold text-nowrap overflow-hidden text-ellipsis`}\n >\n {props.label}\n </p>\n )}\n </div>\n\n <div ref={ref} className=\"flex items-center w-fit shrink-0 gap-1 px-1\">\n {!props.disableSort &&\n props.generateSortButton &&\n props.generateSortButton(props.keyName)}\n </div>\n </div>\n <div\n className=\"absolute top-0 right-0 grid place-items-end py-1 w-[4px] h-full cursor-col-resize\"\n onMouseDown={onMouseDownResizeWidth}\n >\n <div className={`w-[1px] h-full bg-white`} />\n </div>\n </div>\n );\n});\n"],"names":["HeaderElement","memo","props","ref","useRef","onMouseDownResizeWidth","useResizeColWidthHook","keyName","maxWidthLabel","current","colWidth","clientWidth","_jsxs","jsxs","className","style","width","maxWidth","minWidth","children","_jsx","jsx","label","disableSort","generateSortButton","onMouseDown","idGenerator","useTableIdGenerator","getColumnWidth","useColumnsWidthState","_a","useFilter","conditions","addFilter","removeFilter","useScrollXRef","useEffect","element_1","scrollX_1","e","deltaY","preventDefault","scrollLeft","addEventListener","removeEventListener","onChangeCondition","useCallback","action","type","payload","condition","index","targets","useMemo","cols","filter","col","editable","render","map","key","toString","options","ConditionSearchBar","id","getTableHeaderId","size","checkbox","AllCheckbox","rows"],"mappings":"0WAgJA,IAAMA,EAAgBC,EAAIA,MAAC,SAAYC,GACrC,IAAMC,EAAMC,SAAuB,MAC3BC,EAA2BC,EAAqBA,sBAACJ,EAAMK,SAAQF,uBAEjEG,EAAgBL,EAAIM,QACtBP,EAAMQ,SAAWP,EAAIM,QAAQE,YAC7BT,EAAMQ,SAEV,OACEE,EACEC,KAAA,MAAA,CAAAC,UAAU,WACVC,MAAO,CACLC,MAAOd,EAAMQ,SACbO,SAAUf,EAAMQ,SAChBQ,SAAUhB,E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ML,IAAK,SACH,MAAO,CACLY,IAAKJ,EAAII,IAAIC,WACbvC,MAAOkC,EAAIlC,MACX0B,KAAMQ,EAAIR,MAEd,IAAK,SACH,MAAO,CACLY,IAAKJ,EAAII,IAAIC,WACbvC,MAAOkC,EAAIlC,MACX0B,KAAMQ,EAAIR,KACVc,QAASN,EAAIM,SAGrB,GACJ,GAAG,CAAC5D,EAAMoD,OAEV,OACE1C,EAAAA,YACEE,UAAU,yDACVC,MAAO,CAAEE,SAAUf,EAAMe,UAAUE,SAAA,CAEnCC,aAAKN,UAAU,YAAWK,SACxBC,EAACC,IAAA0C,EAAkBA,oBACjBC,GAAItC,EAAYuC,mBAChBb,QAASA,EACTpB,WAAYA,EACZa,kBAAmBA,EACnBqB,KAAK,YAIT9C,EAAQC,IAAA,QAAA,CAAAF,SAAA,uOASRC,MAAA,MAAA,CACEjB,IAAKA,EACLW,UAAU,0DAEVK,SAAAP,EAAAA,KAAA,MAAA,CAAKE,UAAU,0BACZZ,EAAMiE,UACL/C,EAAAC,IAAA,KAAA,CAAIP,UAAU,sBACZM,EAACC,IAAA+C,EAAWA,aAACC,KAAMnE,EAAMmE,SAG5BnE,EAAMoD,KAAKK,KAAI,SAACH,GACf,OACEpC,EAAAA,IAACpB,EAAa,CAEZO,QAASiD,EAAII,IAAIC,WACjBvC,MAAOkC,EAAIlC,MACXZ,SAAUkB,EAAe4B,EAAII,KAC7BrC,YAAaiC,EAAIjC,cAAiBiC,EAAIC,YAAcD,EAAIE,OACxDlC,mBAAoBtB,EAAMsB,oBALrBgC,EAAII,IAAIC,WAQlB,WAKX"}
1
+ {"version":3,"file":"header-v2.js","sources":["../../../../../src/table/header/header-v2.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { DataObject, DataRecord, TTableColumn } from \"../table/type\";\nimport { useColumnsWidthState } from \"./columns-width\";\nimport { useResizeColWidthHook, useScrollXRef } from \"./header-v2-hook\";\nimport { AllCheckbox } from \"../checkbox/components\";\nimport { ConditionSearchBar } from \"../../search-bar\";\nimport { useTableIdGenerator } from \"../id\";\nimport { useFilter } from \"../filter-v2\";\nimport { TConditionChangeAction } from \"../../search-bar/condition-search-bar/condition-input-management/type\";\n\ninterface IPropsTableHeader<T extends DataRecord> {\n cols: TTableColumn<T>[];\n checkbox?: boolean;\n rows: DataObject<T>[];\n maxWidth?: string;\n generateSortButton?: (columnKey: string) => React.ReactNode;\n}\n\nexport function TableHeader<T extends DataRecord>(props: IPropsTableHeader<T>) {\n const idGenerator = useTableIdGenerator();\n const { getColumnWidth } = useColumnsWidthState();\n const { conditions, addFilter, removeFilter } = useFilter();\n const ref = useScrollXRef();\n\n useEffect(() => {\n if (ref.current) {\n const element = ref.current;\n\n const scrollX = (e: WheelEvent) => {\n if (e.deltaY === 0) return;\n\n e.preventDefault();\n element.scrollLeft += e.deltaY;\n };\n\n element.addEventListener(\"wheel\", scrollX);\n\n return () => {\n element.removeEventListener(\"wheel\", scrollX);\n };\n }\n }, [ref]);\n\n const onChangeCondition = useCallback((action: TConditionChangeAction) => {\n switch (action.type) {\n case \"add\":\n addFilter(action.payload.condition);\n break;\n case \"remove\":\n removeFilter(action.payload.index);\n break;\n }\n }, []);\n\n const targets = useMemo(() => {\n return props.cols\n .filter(\n (col) => !!col.label && (col.editable || (!col.editable && !col.render))\n )\n .map((col) => {\n switch (col.type) {\n case \"string\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n };\n case \"number\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n };\n case \"select\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n options: col.options,\n };\n }\n });\n }, [props.cols]);\n\n return (\n <div\n className=\"border-gray-200 bg-gray-200 text-gray-600 rounded-t-md\"\n style={{ maxWidth: props.maxWidth }}\n >\n <div className=\"py-2 px-2\">\n <ConditionSearchBar\n id={idGenerator.getTableHeaderId()}\n targets={targets}\n conditions={conditions}\n onChangeCondition={onChangeCondition}\n size=\"small\"\n />\n </div>\n\n <style>{`\n .teppen-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n .teppen-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n `}</style>\n <div\n ref={ref}\n className=\"relative max-w-full overflow-x-auto teppen-no-scrollbar\"\n >\n <div className=\"flex h-[32px]\">\n {props.checkbox && (\n <div className=\"w-8 h-full\">\n <AllCheckbox rows={props.rows} />\n </div>\n )}\n {props.cols.map((col) => {\n return (\n <HeaderElement\n key={col.key.toString()}\n keyName={col.key.toString()}\n label={col.label}\n colWidth={getColumnWidth(col.key as string)}\n disableSort={col.disableSort || (!col.editable && !!col.render)}\n generateSortButton={props.generateSortButton}\n />\n );\n })}\n </div>\n </div>\n </div>\n );\n}\n\ninterface IPropsHeaderElement {\n keyName: string;\n label?: string;\n colWidth: number;\n disableSort?: boolean;\n generateSortButton?: (columnKey: string) => React.ReactNode;\n}\n\nconst HeaderElement = memo(function HE(props: IPropsHeaderElement) {\n const ref = useRef<HTMLDivElement>(null);\n const { onMouseDownResizeWidth } = useResizeColWidthHook(props.keyName);\n\n const maxWidthLabel = ref.current\n ? props.colWidth - ref.current.clientWidth\n : props.colWidth;\n\n return (\n <div\n className=\"relative\"\n style={{\n width: props.colWidth,\n maxWidth: props.colWidth,\n minWidth: props.colWidth,\n }}\n >\n <div\n className={`flex justify-between items-center bg-gray-200 text-gray-600 h-[32px]`}\n >\n <div className=\"px-2\" style={{ maxWidth: maxWidthLabel }}>\n {props.label && (\n <p\n className={`text-left font-bold text-nowrap overflow-hidden text-ellipsis`}\n >\n {props.label}\n </p>\n )}\n </div>\n\n <div ref={ref} className=\"flex items-center w-fit shrink-0 gap-1 px-1\">\n {!props.disableSort &&\n props.generateSortButton &&\n props.generateSortButton(props.keyName)}\n </div>\n </div>\n <div\n className=\"absolute top-0 right-0 grid place-items-end py-1 w-[4px] h-full cursor-col-resize\"\n onMouseDown={onMouseDownResizeWidth}\n >\n <div className={`w-[1px] h-full bg-white`} />\n </div>\n </div>\n );\n});\n"],"names":["HeaderElement","memo","props","ref","useRef","onMouseDownResizeWidth","useResizeColWidthHook","keyName","maxWidthLabel","current","colWidth","clientWidth","_jsxs","jsxs","className","style","width","maxWidth","minWidth","children","_jsx","jsx","label","disableSort","generateSortButton","onMouseDown","idGenerator","useTableIdGenerator","getColumnWidth","useColumnsWidthState","_a","useFilter","conditions","addFilter","removeFilter","useScrollXRef","useEffect","element_1","scrollX_1","e","deltaY","preventDefault","scrollLeft","addEventListener","removeEventListener","onChangeCondition","useCallback","action","type","payload","condition","index","targets","useMemo","cols","filter","col","editable","render","map","key","toString","options","ConditionSearchBar","id","getTableHeaderId","size","checkbox","AllCheckbox","rows"],"mappings":"0WAgJA,IAAMA,EAAgBC,EAAIA,MAAC,SAAYC,GACrC,IAAMC,EAAMC,SAAuB,MAC3BC,EAA2BC,EAAqBA,sBAACJ,EAAMK,SAAQF,uBAEjEG,EAAgBL,EAAIM,QACtBP,EAAMQ,SAAWP,EAAIM,QAAQE,YAC7BT,EAAMQ,SAEV,OACEE,EACEC,KAAA,MAAA,CAAAC,UAAU,WACVC,MAAO,CACLC,MAAOd,EAAMQ,SACbO,SAAUf,EAAMQ,SAChBQ,SAAUhB,EAAMQ,UAGlBS,SAAA,CAAAP,EAAAA,KAAA,MAAA,CACEE,UAAW,iFAEXM,EAAKC,IAAA,MAAA,CAAAP,UAAU,OAAOC,MAAO,CAAEE,SAAUT,GACtCW,SAAAjB,EAAMoB,OACLF,EAAAA,SACEN,UAAW,gEAEVK,SAAAjB,EAAMoB,UAKbF,EAAAA,IAAA,MAAA,CAAKjB,IAAKA,EAAKW,UAAU,8CACtBK,UAACjB,EAAMqB,aACNrB,EAAMsB,oBACNtB,EAAMsB,mBAAmBtB,EAAMK,cAGrCa,EAAAC,IAAA,MAAA,CACEP,UAAU,oFACVW,YAAapB,EAAsBc,SAEnCC,EAAKC,IAAA,MAAA,CAAAP,UAAW,gCAIxB,wBA1KM,SAA4CZ,GAChD,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YAIT9C,EAAQC,IAAA,QAAA,CAAAF,SAAA,uOASRC,MAAA,MAAA,CACEjB,IAAKA,EACLW,UAAU,0DAEVK,SAAAP,EAAAA,KAAA,MAAA,CAAKE,UAAU,0BACZZ,EAAMiE,UACL/C,EAAAC,IAAA,MAAA,CAAKP,UAAU,sBACbM,EAACC,IAAA+C,EAAWA,aAACC,KAAMnE,EAAMmE,SAG5BnE,EAAMoD,KAAKK,KAAI,SAACH,GACf,OACEpC,EAAAA,IAACpB,EAAa,CAEZO,QAASiD,EAAII,IAAIC,WACjBvC,MAAOkC,EAAIlC,MACXZ,SAAUkB,EAAe4B,EAAII,KAC7BrC,YAAaiC,EAAIjC,cAAiBiC,EAAIC,YAAcD,EAAIE,OACxDlC,mBAAoBtB,EAAMsB,oBALrBgC,EAAII,IAAIC,WAQlB,WAKX"}
@@ -1,2 +1,2 @@
1
- import{jsx as e,Fragment as t}from"react/jsx-runtime";import{useState as n,useEffect as o}from"react";import{useOptionsWindow as i}from"./context.js";import{useIdContext as r}from"../id/provider.js";import{IdGenerator as l}from"../lib/id-generator.js";function a(){var a=r(),s=i(),u=s.state,c=s.actions,d=n(""),f=d[0],p=d[1],v=n(void 0),m=v[0],g=v[1],y=n({top:0,left:0}),h=y[0],b=y[1],w=u.isOpen?0===u.options.length?void 0:"number"==typeof m&&m<u.options.length&&m>=0?u.options[m].value:void 0:void 0;return o((function(){if(u.isOpen){var e=document.getElementById(l.generateIdSelectBoxOption(a,null!=w?w:""));if(!e)return;if(0===h.top&&0===h.left)return;e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}else g(void 0)}),[u,h,w]),o((function(){if(u.isOpen){var e=function(e){if("ArrowDown"===e.key)e.preventDefault(),g((function(e){return"number"==typeof e?Math.min(e+1,u.options.length-1):0}));else if("ArrowUp"===e.key)e.preventDefault(),g((function(e){return"number"==typeof e?Math.max(e-1,0):0}));else if("Enter"===e.key&&(e.preventDefault(),"number"==typeof m)){if(0===u.options.length||u.options.length<=m)return;var t=u.options[m].value;if(!t)return;p(t),u.onSelect(t),c.closeOptionsWindow()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}}),[u,m,g]),o((function(){var e=setTimeout((function(){var e;if(u.isOpen){for(var t=null===(e=document.getElementById("ReactUI:SelectBox:OptionsArea"))||void 0===e?void 0:e.parentElement,n=["relative","fixed","absolute","sticky"];t;){var o=n.some((function(e){return t.className.includes(e)})),i=n.some((function(e){return t.style.position.includes(e)}));if(o||i){console.log(t);break}t=t.parentElement}var r=document.getElementById(u.selectBoxId);if(r){var l=r.getBoundingClientRect(),a=l.top+l.height,s=l.left;if(t){var c=t.getBoundingClientRect();b({top:a-c.top,left:s-c.left})}else b({top:a+window.scrollY,left:s+window.scrollX})}}}),0);return function(){clearTimeout(e)}}),[u.isOpen]),o((function(){var e=function(e){if(u.isOpen){var t=document.getElementById(u.selectBoxId),n=document.getElementById("ReactUI:SelectBox:OptionsArea"),o=e.target;o instanceof Node&&(null==t?void 0:t.contains(o))||o instanceof Node&&(null==n?void 0:n.contains(o))||(c.setSearchText(""),c.closeOptionsWindow())}};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[u.isOpen]),u.isOpen?e("div",{id:"ReactUI:SelectBox:OptionsArea",className:"absolute min-w-fit max-h-[40vh] overflow-auto border border-gray-300 z-10",style:h,children:u.options.map((function(t){var n,o;return e("div",{id:l.generateIdSelectBoxOption(a,null!==(n=t.value)&&void 0!==n?n:""),className:"hover:bg-gray-200 px-2 py-1 ".concat("string"==typeof w?w===t.value?"bg-gray-100":"bg-white":f===t.value?"bg-gray-100":"bg-white"),onClick:function(){u.onSelect(t.value),c.closeOptionsWindow()},children:null!==(o=t.searchLabel)&&void 0!==o?o:t.label},t.value)}))}):e(t,{})}export{a as OptionsArea};
1
+ import{jsx as e,Fragment as t}from"react/jsx-runtime";import{useState as n,useEffect as o}from"react";import{useOptionsWindow as i}from"./context.js";import{useIdContext as r}from"../id/provider.js";import{IdGenerator as l}from"../lib/id-generator.js";function a(){var a=r(),s=i(),c=s.state,u=s.actions,d=n(""),f=d[0],p=d[1],v=n(void 0),m=v[0],g=v[1],y=n({top:0,left:0}),h=y[0],b=y[1],w=c.isOpen?0===c.options.length?void 0:"number"==typeof m&&m<c.options.length&&m>=0?c.options[m].value:void 0:void 0;return o((function(){if(c.isOpen){var e=document.getElementById(l.generateIdSelectBoxOption(a,null!=w?w:""));if(!e)return;if(0===h.top&&0===h.left)return;e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}else g(void 0)}),[c,h,w]),o((function(){if(c.isOpen){var e=function(e){if("ArrowDown"===e.key)e.preventDefault(),g((function(e){return"number"==typeof e?Math.min(e+1,c.options.length-1):0}));else if("ArrowUp"===e.key)e.preventDefault(),g((function(e){return"number"==typeof e?Math.max(e-1,0):0}));else if("Enter"===e.key&&(e.preventDefault(),"number"==typeof m)){if(0===c.options.length||c.options.length<=m)return;var t=c.options[m].value;if(!t)return;p(t),c.onSelect(t),u.closeOptionsWindow()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}}),[c,m,g]),o((function(){var e=setTimeout((function(){var e;if(c.isOpen){for(var t=null===(e=document.getElementById("ReactUI:SelectBox:OptionsArea"))||void 0===e?void 0:e.parentElement,n=["relative","fixed","absolute","sticky"];t;){var o=n.some((function(e){return t.className.includes(e)})),i=n.some((function(e){return t.style.position.includes(e)}));if(o||i)break;t=t.parentElement}var r=document.getElementById(c.selectBoxId);if(r){var l=r.getBoundingClientRect(),a=l.top+l.height,s=l.left;if(t){var u=t.getBoundingClientRect();b({top:a-u.top+t.scrollTop,left:s-u.left+t.scrollLeft})}else b({top:a+window.scrollY,left:s+window.scrollX})}}}),0);return function(){clearTimeout(e)}}),[c.isOpen]),o((function(){var e=function(e){if(c.isOpen){var t=document.getElementById(c.selectBoxId),n=document.getElementById("ReactUI:SelectBox:OptionsArea"),o=e.target;o instanceof Node&&(null==t?void 0:t.contains(o))||o instanceof Node&&(null==n?void 0:n.contains(o))||(u.setSearchText(""),u.closeOptionsWindow())}};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[c.isOpen]),c.isOpen?e("div",{id:"ReactUI:SelectBox:OptionsArea",className:"absolute min-w-fit max-h-[40vh] overflow-auto border border-gray-300 z-10",style:h,children:c.options.map((function(t){var n,o;return e("div",{id:l.generateIdSelectBoxOption(a,null!==(n=t.value)&&void 0!==n?n:""),className:"hover:bg-gray-200 px-2 py-1 ".concat("string"==typeof w?w===t.value?"bg-gray-100":"bg-white":f===t.value?"bg-gray-100":"bg-white"),onClick:function(){c.onSelect(t.value),u.closeOptionsWindow()},children:null!==(o=t.searchLabel)&&void 0!==o?o:t.label},t.value)}))}):e(t,{})}export{a as OptionsArea};
2
2
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../../../src/select-box/options-window/component.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { useOptionsWindow } from \"../options-window\";\nimport { useIdContext } from \"../id/provider\";\nimport { IdGenerator } from \"../lib\";\n\nexport function OptionsArea() {\n const id = useIdContext();\n const { state, actions } = useOptionsWindow();\n const [value, setValue] = useState(\"\");\n const [selectingIndex, setSelectingIndex] = useState<number | undefined>(\n undefined\n );\n const [position, setPosition] = useState({ top: 0, left: 0 });\n\n const selectingValue = state.isOpen\n ? state.options.length === 0\n ? undefined\n : typeof selectingIndex === \"number\" &&\n selectingIndex < state.options.length &&\n selectingIndex >= 0\n ? state.options[selectingIndex].value\n : undefined\n : undefined;\n\n useEffect(() => {\n if (state.isOpen) {\n const optionElement = document.getElementById(\n IdGenerator.generateIdSelectBoxOption(id, selectingValue ?? \"\")\n );\n\n if (!optionElement) return;\n if (position.top === 0 && position.left === 0) return;\n\n optionElement.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"nearest\",\n });\n } else {\n setSelectingIndex(undefined);\n }\n }, [state, position, selectingValue]);\n\n useEffect(() => {\n if (state.isOpen) {\n const handleKeydown = (e: KeyboardEvent) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setSelectingIndex((prev) =>\n typeof prev === \"number\"\n ? Math.min(prev + 1, state.options.length - 1)\n : 0\n );\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n setSelectingIndex((prev) =>\n typeof prev === \"number\" ? Math.max(prev - 1, 0) : 0\n );\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (typeof selectingIndex === \"number\") {\n if (\n state.options.length === 0 ||\n state.options.length <= selectingIndex\n )\n return;\n\n const value = state.options[selectingIndex].value;\n\n if (!value) return;\n\n setValue(value);\n state.onSelect(value);\n actions.closeOptionsWindow();\n }\n }\n };\n\n document.addEventListener(\"keydown\", handleKeydown);\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeydown);\n };\n }\n }, [state, selectingIndex, setSelectingIndex]);\n\n useEffect(() => {\n const searchParentElement = () => {\n if (state.isOpen) {\n let parentElement = document.getElementById(\n \"ReactUI:SelectBox:OptionsArea\"\n )?.parentElement;\n\n const positionClasses = [\"relative\", \"fixed\", \"absolute\", \"sticky\"];\n\n while (parentElement) {\n const hasPositionClass = positionClasses.some((className) =>\n parentElement!.className.includes(className)\n );\n\n const hasPositionStyle = positionClasses.some((style) =>\n parentElement!.style.position.includes(style)\n );\n\n if (hasPositionClass || hasPositionStyle) {\n console.log(parentElement);\n break;\n }\n\n parentElement = parentElement.parentElement;\n }\n\n const selectBoxElement = document.getElementById(state.selectBoxId);\n\n if (selectBoxElement) {\n const rect = selectBoxElement.getBoundingClientRect();\n let top = rect.top + rect.height;\n let left = rect.left;\n\n if (parentElement) {\n const parentRect = parentElement.getBoundingClientRect();\n setPosition({\n top: top - parentRect.top,\n left: left - parentRect.left,\n });\n } else {\n setPosition({\n top: top + window.scrollY,\n left: left + window.scrollX,\n });\n }\n }\n }\n };\n\n const timer = setTimeout(searchParentElement, 0);\n\n return () => {\n clearTimeout(timer);\n };\n }, [state.isOpen]);\n\n useEffect(() => {\n const onClickOutOfSelectBox = (e: MouseEvent) => {\n if (!state.isOpen) return;\n\n // SelectBox関連の要素を取得\n const frameElement = document.getElementById(state.selectBoxId);\n const optionsElement = document.getElementById(\n \"ReactUI:SelectBox:OptionsArea\"\n );\n\n // クリックされた要素を取得\n const ele = e.target;\n\n if (ele instanceof Node && frameElement?.contains(ele)) return;\n\n if (ele instanceof Node && optionsElement?.contains(ele)) return;\n\n actions.setSearchText(\"\");\n actions.closeOptionsWindow();\n };\n\n document.addEventListener(\"mousedown\", onClickOutOfSelectBox);\n\n return () => {\n document.removeEventListener(\"mousedown\", onClickOutOfSelectBox);\n };\n }, [state.isOpen]);\n\n if (!state.isOpen) return <></>;\n\n return (\n <div\n id={\"ReactUI:SelectBox:OptionsArea\"}\n className=\"absolute min-w-fit max-h-[40vh] overflow-auto border border-gray-300 z-10\"\n style={position}\n >\n {state.options.map((option) => (\n <div\n id={IdGenerator.generateIdSelectBoxOption(id, option.value ?? \"\")}\n className={`hover:bg-gray-200 px-2 py-1 ${\n typeof selectingValue === \"string\"\n ? selectingValue === option.value\n ? \"bg-gray-100\"\n : \"bg-white\"\n : value === option.value\n ? \"bg-gray-100\"\n : \"bg-white\"\n }`}\n key={option.value}\n onClick={() => {\n state.onSelect(option.value);\n actions.closeOptionsWindow();\n }}\n >\n {option.searchLabel ?? option.label}\n </div>\n ))}\n </div>\n );\n}\n"],"names":["OptionsArea","id","useIdContext","_a","useOptionsWindow","state","actions","_b","useState","value","setValue","_c","undefined","selectingIndex","setSelectingIndex","_d","top","left","position","setPosition","selectingValue","isOpen","options","length","useEffect","optionElement","document","getElementById","IdGenerator","generateIdSelectBoxOption","scrollIntoView","behavior","block","inline","handleKeydown_1","e","key","preventDefault","prev","Math","min","max","value_1","onSelect","closeOptionsWindow","addEventListener","removeEventListener","timer","setTimeout","parentElement_1","parentElement","positionClasses","hasPositionClass","some","className","includes","hasPositionStyle","style","console","log","selectBoxElement","selectBoxId","rect","getBoundingClientRect","top_1","height","parentRect","window","scrollY","scrollX","clearTimeout","onClickOutOfSelectBox","frameElement","optionsElement","ele","target","Node","contains","setSearchText","_jsx","map","option","concat","onClick","children","searchLabel","label"],"mappings":"qQAKgBA,IACd,IAAMC,EAAKC,IACLC,EAAqBC,IAAnBC,EAAKF,EAAAE,MAAEC,EAAOH,EAAAG,QAChBC,EAAoBC,EAAS,IAA5BC,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAChBI,EAAsCH,OAC1CI,GADKC,EAAcF,EAAA,GAAEG,EAAiBH,EAAA,GAGlCI,EAA0BP,EAAS,CAAEQ,IAAK,EAAGC,KAAM,IAAlDC,OAAUC,OAEXC,EAAiBf,EAAMgB,OACA,IAAzBhB,EAAMiB,QAAQC,YACZX,EAC0B,iBAAnBC,GACPA,EAAiBR,EAAMiB,QAAQC,QAC/BV,GAAkB,EAClBR,EAAMiB,QAAQT,GAAgBJ,WAC9BG,OACFA,EAoJJ,OAlJAY,GAAU,WACR,GAAInB,EAAMgB,OAAQ,CAChB,IAAMI,EAAgBC,SAASC,eAC7BC,EAAYC,0BAA0B5B,EAAImB,QAAAA,EAAkB,KAG9D,IAAKK,EAAe,OACpB,GAAqB,IAAjBP,EAASF,KAA+B,IAAlBE,EAASD,KAAY,OAE/CQ,EAAcK,eAAe,CAC3BC,SAAU,SACVC,MAAO,UACPC,OAAQ,WAEX,MACCnB,OAAkBF,EAErB,GAAE,CAACP,EAAOa,EAAUE,IAErBI,GAAU,WACR,GAAInB,EAAMgB,OAAQ,CAChB,IAAMa,EAAgB,SAACC,GACrB,GAAc,cAAVA,EAAEC,IACJD,EAAEE,iBACFvB,GAAkB,SAACwB,GACjB,MAAgB,iBAATA,EACHC,KAAKC,IAAIF,EAAO,EAAGjC,EAAMiB,QAAQC,OAAS,GAC1C,CAFJ,SAIG,GAAc,YAAVY,EAAEC,IACXD,EAAEE,iBACFvB,GAAkB,SAACwB,GACjB,MAAgB,iBAATA,EAAoBC,KAAKE,IAAIH,EA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AOC,QAClBnD,KAAMA,EAAOkD,OAAOE,SAGzB,CACF,CACH,GAE8C,GAE9C,OAAO,WACLC,aAAavB,EACf,CACF,GAAG,CAAC1C,EAAMgB,SAEVG,GAAU,WACR,IAAM+C,EAAwB,SAACpC,GAC7B,GAAK9B,EAAMgB,OAAX,CAGA,IAAMmD,EAAe9C,SAASC,eAAetB,EAAMwD,aAC7CY,EAAiB/C,SAASC,eAC9B,iCAII+C,EAAMvC,EAAEwC,OAEVD,aAAeE,OAAQJ,aAAA,EAAAA,EAAcK,SAASH,KAE9CA,aAAeE,OAAQH,aAAA,EAAAA,EAAgBI,SAASH,MAEpDpE,EAAQwE,cAAc,IACtBxE,EAAQsC,qBAhBkB,CAiB5B,EAIA,OAFAlB,SAASmB,iBAAiB,YAAa0B,GAEhC,WACL7C,SAASoB,oBAAoB,YAAayB,EAC5C,CACF,GAAG,CAAClE,EAAMgB,SAELhB,EAAMgB,OAGT0D,SACE9E,GAAI,gCACJqD,UAAU,4EACVG,MAAOvC,WAENb,EAAMiB,QAAQ0D,KAAI,SAACC,WAAW,OAC7BF,EACE,MAAA,CAAA9E,GAAI2B,EAAYC,0BAA0B5B,EAAgB,QAAZE,EAAA8E,EAAOxE,aAAK,IAAAN,EAAAA,EAAI,IAC9DmD,UAAW,+BACT4B,OAA0B,iBAAnB9D,EACHA,IAAmB6D,EAAOxE,MACxB,cACA,WACFA,IAAUwE,EAAOxE,MACjB,cACA,YAGN0E,QAAS,WACP9E,EAAMsC,SAASsC,EAAOxE,OACtBH,EAAQsC,oBACV,EAECwC,SAAsB,QAAtB7E,EAAA0E,EAAOI,mBAAe,IAAA9E,EAAAA,EAAA0E,EAAOK,OANzBL,EAAOxE,MAQf,MA5BqBsE,OA+B5B"}
1
+ {"version":3,"file":"component.js","sources":["../../../../../src/select-box/options-window/component.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { useOptionsWindow } from \"../options-window\";\nimport { useIdContext } from \"../id/provider\";\nimport { IdGenerator } from \"../lib\";\n\nexport function OptionsArea() {\n const id = useIdContext();\n const { state, actions } = useOptionsWindow();\n const [value, setValue] = useState(\"\");\n const [selectingIndex, setSelectingIndex] = useState<number | undefined>(\n undefined\n );\n const [position, setPosition] = useState({ top: 0, left: 0 });\n\n const selectingValue = state.isOpen\n ? state.options.length === 0\n ? undefined\n : typeof selectingIndex === \"number\" &&\n selectingIndex < state.options.length &&\n selectingIndex >= 0\n ? state.options[selectingIndex].value\n : undefined\n : undefined;\n\n useEffect(() => {\n if (state.isOpen) {\n const optionElement = document.getElementById(\n IdGenerator.generateIdSelectBoxOption(id, selectingValue ?? \"\")\n );\n\n if (!optionElement) return;\n if (position.top === 0 && position.left === 0) return;\n\n optionElement.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"nearest\",\n });\n } else {\n setSelectingIndex(undefined);\n }\n }, [state, position, selectingValue]);\n\n useEffect(() => {\n if (state.isOpen) {\n const handleKeydown = (e: KeyboardEvent) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n setSelectingIndex((prev) =>\n typeof prev === \"number\"\n ? Math.min(prev + 1, state.options.length - 1)\n : 0\n );\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n setSelectingIndex((prev) =>\n typeof prev === \"number\" ? Math.max(prev - 1, 0) : 0\n );\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (typeof selectingIndex === \"number\") {\n if (\n state.options.length === 0 ||\n state.options.length <= selectingIndex\n )\n return;\n\n const value = state.options[selectingIndex].value;\n\n if (!value) return;\n\n setValue(value);\n state.onSelect(value);\n actions.closeOptionsWindow();\n }\n }\n };\n\n document.addEventListener(\"keydown\", handleKeydown);\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeydown);\n };\n }\n }, [state, selectingIndex, setSelectingIndex]);\n\n useEffect(() => {\n const searchParentElement = () => {\n if (state.isOpen) {\n let parentElement = document.getElementById(\n \"ReactUI:SelectBox:OptionsArea\"\n )?.parentElement;\n\n const positionClasses = [\"relative\", \"fixed\", \"absolute\", \"sticky\"];\n\n while (parentElement) {\n const hasPositionClass = positionClasses.some((className) =>\n parentElement!.className.includes(className)\n );\n\n const hasPositionStyle = positionClasses.some((style) =>\n parentElement!.style.position.includes(style)\n );\n\n if (hasPositionClass || hasPositionStyle) break;\n\n parentElement = parentElement.parentElement;\n }\n\n const selectBoxElement = document.getElementById(state.selectBoxId);\n\n if (selectBoxElement) {\n const rect = selectBoxElement.getBoundingClientRect();\n let top = rect.top + rect.height;\n let left = rect.left;\n\n if (parentElement) {\n const parentRect = parentElement.getBoundingClientRect();\n setPosition({\n top: top - parentRect.top + parentElement.scrollTop,\n left: left - parentRect.left + parentElement.scrollLeft,\n });\n } else {\n setPosition({\n top: top + window.scrollY,\n left: left + window.scrollX,\n });\n }\n }\n }\n };\n\n const timer = setTimeout(searchParentElement, 0);\n\n return () => {\n clearTimeout(timer);\n };\n }, [state.isOpen]);\n\n useEffect(() => {\n const onClickOutOfSelectBox = (e: MouseEvent) => {\n if (!state.isOpen) return;\n\n // SelectBox関連の要素を取得\n const frameElement = document.getElementById(state.selectBoxId);\n const optionsElement = document.getElementById(\n \"ReactUI:SelectBox:OptionsArea\"\n );\n\n // クリックされた要素を取得\n const ele = e.target;\n\n if (ele instanceof Node && frameElement?.contains(ele)) return;\n\n if (ele instanceof Node && optionsElement?.contains(ele)) return;\n\n actions.setSearchText(\"\");\n actions.closeOptionsWindow();\n };\n\n document.addEventListener(\"mousedown\", onClickOutOfSelectBox);\n\n return () => {\n document.removeEventListener(\"mousedown\", onClickOutOfSelectBox);\n };\n }, [state.isOpen]);\n\n if (!state.isOpen) return <></>;\n\n return (\n <div\n id={\"ReactUI:SelectBox:OptionsArea\"}\n className=\"absolute min-w-fit max-h-[40vh] overflow-auto border border-gray-300 z-10\"\n style={position}\n >\n {state.options.map((option) => (\n <div\n id={IdGenerator.generateIdSelectBoxOption(id, option.value ?? \"\")}\n className={`hover:bg-gray-200 px-2 py-1 ${\n typeof selectingValue === \"string\"\n ? selectingValue === option.value\n ? \"bg-gray-100\"\n : \"bg-white\"\n : value === option.value\n ? \"bg-gray-100\"\n : \"bg-white\"\n }`}\n key={option.value}\n onClick={() => {\n state.onSelect(option.value);\n actions.closeOptionsWindow();\n }}\n >\n {option.searchLabel ?? option.label}\n </div>\n ))}\n </div>\n );\n}\n"],"names":["OptionsArea","id","useIdContext","_a","useOptionsWindow","state","actions","_b","useState","value","setValue","_c","undefined","selectingIndex","setSelectingIndex","_d","top","left","position","setPosition","selectingValue","isOpen","options","length","useEffect","optionElement","document","getElementById","IdGenerator","generateIdSelectBoxOption","scrollIntoView","behavior","block","inline","handleKeydown_1","e","key","preventDefault","prev","Math","min","max","value_1","onSelect","closeOptionsWindow","addEventListener","removeEventListener","timer","setTimeout","parentElement_1","parentElement","positionClasses","hasPositionClass","some","className","includes","hasPositionStyle","style","selectBoxElement","selectBoxId","rect","getBoundingClientRect","top_1","height","parentRect","scrollTop","scrollLeft","window","scrollY","scrollX","clearTimeout","onClickOutOfSelectBox","frameElement","optionsElement","ele","target","Node","contains","setSearchText","_jsx","map","option","concat","onClick","children","searchLabel","label"],"mappings":"qQAKgBA,IACd,IAAMC,EAAKC,IACLC,EAAqBC,IAAnBC,EAAKF,EAAAE,MAAEC,EAAOH,EAAAG,QAChBC,EAAoBC,EAAS,IAA5BC,EAAKF,EAAA,GAAEG,EAAQH,EAAA,GAChBI,EAAsCH,OAC1CI,GADKC,EAAcF,EAAA,GAAEG,EAAiBH,EAAA,GAGlCI,EAA0BP,EAAS,CAAEQ,IAAK,EAAGC,KAAM,IAAlDC,OAAUC,OAEXC,EAAiBf,EAAMgB,OACA,IAAzBhB,EAAMiB,QAAQC,YACZX,EAC0B,iBAAnBC,GACPA,EAAiBR,EAAMiB,QAAQC,QAC/BV,GAAkB,EAClBR,EAAMiB,QAAQT,GAAgBJ,WAC9BG,OACFA,EAiJJ,OA/IAY,GAAU,WACR,GAAInB,EAAMgB,OAAQ,CAChB,IAAMI,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,QAAQ0D,KAAI,SAACC,WAAW,OAC7BF,EACE,MAAA,CAAA9E,GAAI2B,EAAYC,0BAA0B5B,EAAgB,QAAZE,EAAA8E,EAAOxE,aAAK,IAAAN,EAAAA,EAAI,IAC9DmD,UAAW,+BACT4B,OAA0B,iBAAnB9D,EACHA,IAAmB6D,EAAOxE,MACxB,cACA,WACFA,IAAUwE,EAAOxE,MACjB,cACA,YAGN0E,QAAS,WACP9E,EAAMsC,SAASsC,EAAOxE,OACtBH,EAAQsC,oBACV,EAECwC,SAAsB,QAAtB7E,EAAA0E,EAAOI,mBAAe,IAAA9E,EAAAA,EAAA0E,EAAOK,OANzBL,EAAOxE,MAQf,MA5BqBsE,OA+B5B"}
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{memo as r,useRef as n,useEffect as l,useCallback as o,useMemo as i}from"react";import{useColumnsWidthState as a}from"./columns-width/context.js";import"../../../node_modules/tslib/tslib.es6.js";import{useResizeColWidthHook as s,useScrollXRef as c}from"./header-v2-hook.js";import{AllCheckbox as d}from"../checkbox/components.js";import{ConditionSearchBar as m}from"../../search-bar/condition-search-bar/base.js";import{useTableIdGenerator as h}from"../id/provider.js";import{useFilter as p}from"../filter-v2/context.js";function u(r){var n=h(),s=a().getColumnWidth,u=p(),b=u.conditions,y=u.addFilter,v=u.removeFilter,x=c();l((function(){if(x.current){var e=x.current,t=function(t){0!==t.deltaY&&(t.preventDefault(),e.scrollLeft+=t.deltaY)};return e.addEventListener("wheel",t),function(){e.removeEventListener("wheel",t)}}}),[x]);var g=o((function(e){switch(e.type){case"add":y(e.payload.condition);break;case"remove":v(e.payload.index)}}),[]),w=i((function(){return r.cols.filter((function(e){return!!e.label&&(e.editable||!e.editable&&!e.render)})).map((function(e){switch(e.type){case"string":case"number":return{key:e.key.toString(),label:e.label,type:e.type};case"select":return{key:e.key.toString(),label:e.label,type:e.type,options:e.options}}}))}),[r.cols]);return e("div",{className:"border-gray-200 bg-gray-200 text-gray-600 rounded-t-md",style:{maxWidth:r.maxWidth},children:[t("div",{className:"py-2 px-2",children:t(m,{id:n.getTableHeaderId(),targets:w,conditions:b,onChangeCondition:g,size:"small"})}),t("style",{children:"\n .teppen-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n .teppen-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n "}),t("div",{ref:x,className:"relative max-w-full overflow-x-auto teppen-no-scrollbar",children:e("div",{className:"flex h-[32px]",children:[r.checkbox&&t("th",{className:"w-8 h-full",children:t(d,{rows:r.rows})}),r.cols.map((function(e){return t(f,{keyName:e.key.toString(),label:e.label,colWidth:s(e.key),disableSort:e.disableSort||!e.editable&&!!e.render,generateSortButton:r.generateSortButton},e.key.toString())}))]})})]})}var f=r((function(r){var l=n(null),o=s(r.keyName).onMouseDownResizeWidth,i=l.current?r.colWidth-l.current.clientWidth:r.colWidth;return e("div",{className:"relative",style:{width:r.colWidth,maxWidth:r.colWidth,minWidth:r.colWidth},children:[e("div",{className:"flex justify-between items-center bg-gray-200 text-gray-600 h-[32px]",children:[t("div",{className:"px-2",style:{maxWidth:i},children:r.label&&t("p",{className:"text-left font-bold text-nowrap overflow-hidden text-ellipsis",children:r.label})}),t("div",{ref:l,className:"flex items-center w-fit shrink-0 gap-1 px-1",children:!r.disableSort&&r.generateSortButton&&r.generateSortButton(r.keyName)})]}),t("div",{className:"absolute top-0 right-0 grid place-items-end py-1 w-[4px] h-full cursor-col-resize",onMouseDown:o,children:t("div",{className:"w-[1px] h-full bg-white"})})]})}));export{u as TableHeader};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{memo as r,useRef as n,useEffect as l,useCallback as o,useMemo as i}from"react";import{useColumnsWidthState as a}from"./columns-width/context.js";import"../../../node_modules/tslib/tslib.es6.js";import{useResizeColWidthHook as s,useScrollXRef as c}from"./header-v2-hook.js";import{AllCheckbox as d}from"../checkbox/components.js";import{ConditionSearchBar as m}from"../../search-bar/condition-search-bar/base.js";import{useTableIdGenerator as h}from"../id/provider.js";import{useFilter as p}from"../filter-v2/context.js";function u(r){var n=h(),s=a().getColumnWidth,u=p(),b=u.conditions,y=u.addFilter,v=u.removeFilter,x=c();l((function(){if(x.current){var e=x.current,t=function(t){0!==t.deltaY&&(t.preventDefault(),e.scrollLeft+=t.deltaY)};return e.addEventListener("wheel",t),function(){e.removeEventListener("wheel",t)}}}),[x]);var g=o((function(e){switch(e.type){case"add":y(e.payload.condition);break;case"remove":v(e.payload.index)}}),[]),w=i((function(){return r.cols.filter((function(e){return!!e.label&&(e.editable||!e.editable&&!e.render)})).map((function(e){switch(e.type){case"string":case"number":return{key:e.key.toString(),label:e.label,type:e.type};case"select":return{key:e.key.toString(),label:e.label,type:e.type,options:e.options}}}))}),[r.cols]);return e("div",{className:"border-gray-200 bg-gray-200 text-gray-600 rounded-t-md",style:{maxWidth:r.maxWidth},children:[t("div",{className:"py-2 px-2",children:t(m,{id:n.getTableHeaderId(),targets:w,conditions:b,onChangeCondition:g,size:"small"})}),t("style",{children:"\n .teppen-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n .teppen-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n "}),t("div",{ref:x,className:"relative max-w-full overflow-x-auto teppen-no-scrollbar",children:e("div",{className:"flex h-[32px]",children:[r.checkbox&&t("div",{className:"w-8 h-full",children:t(d,{rows:r.rows})}),r.cols.map((function(e){return t(f,{keyName:e.key.toString(),label:e.label,colWidth:s(e.key),disableSort:e.disableSort||!e.editable&&!!e.render,generateSortButton:r.generateSortButton},e.key.toString())}))]})})]})}var f=r((function(r){var l=n(null),o=s(r.keyName).onMouseDownResizeWidth,i=l.current?r.colWidth-l.current.clientWidth:r.colWidth;return e("div",{className:"relative",style:{width:r.colWidth,maxWidth:r.colWidth,minWidth:r.colWidth},children:[e("div",{className:"flex justify-between items-center bg-gray-200 text-gray-600 h-[32px]",children:[t("div",{className:"px-2",style:{maxWidth:i},children:r.label&&t("p",{className:"text-left font-bold text-nowrap overflow-hidden text-ellipsis",children:r.label})}),t("div",{ref:l,className:"flex items-center w-fit shrink-0 gap-1 px-1",children:!r.disableSort&&r.generateSortButton&&r.generateSortButton(r.keyName)})]}),t("div",{className:"absolute top-0 right-0 grid place-items-end py-1 w-[4px] h-full cursor-col-resize",onMouseDown:o,children:t("div",{className:"w-[1px] h-full bg-white"})})]})}));export{u as TableHeader};
2
2
  //# sourceMappingURL=header-v2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"header-v2.js","sources":["../../../../../src/table/header/header-v2.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { DataObject, DataRecord, TTableColumn } from \"../table/type\";\nimport { useColumnsWidthState } from \"./columns-width\";\nimport { useResizeColWidthHook, useScrollXRef } from \"./header-v2-hook\";\nimport { AllCheckbox } from \"../checkbox/components\";\nimport { ConditionSearchBar } from \"../../search-bar\";\nimport { useTableIdGenerator } from \"../id\";\nimport { useFilter } from \"../filter-v2\";\nimport { TConditionChangeAction } from \"../../search-bar/condition-search-bar/condition-input-management/type\";\n\ninterface IPropsTableHeader<T extends DataRecord> {\n cols: TTableColumn<T>[];\n checkbox?: boolean;\n rows: DataObject<T>[];\n maxWidth?: string;\n generateSortButton?: (columnKey: string) => React.ReactNode;\n}\n\nexport function TableHeader<T extends DataRecord>(props: IPropsTableHeader<T>) {\n const idGenerator = useTableIdGenerator();\n const { getColumnWidth } = useColumnsWidthState();\n const { conditions, addFilter, removeFilter } = useFilter();\n const ref = useScrollXRef();\n\n useEffect(() => {\n if (ref.current) {\n const element = ref.current;\n\n const scrollX = (e: WheelEvent) => {\n if (e.deltaY === 0) return;\n\n e.preventDefault();\n element.scrollLeft += e.deltaY;\n };\n\n element.addEventListener(\"wheel\", scrollX);\n\n return () => {\n element.removeEventListener(\"wheel\", scrollX);\n };\n }\n }, [ref]);\n\n const onChangeCondition = useCallback((action: TConditionChangeAction) => {\n switch (action.type) {\n case \"add\":\n addFilter(action.payload.condition);\n break;\n case \"remove\":\n removeFilter(action.payload.index);\n break;\n }\n }, []);\n\n const targets = useMemo(() => {\n return props.cols\n .filter(\n (col) => !!col.label && (col.editable || (!col.editable && !col.render))\n )\n .map((col) => {\n switch (col.type) {\n case \"string\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n };\n case \"number\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n };\n case \"select\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n options: col.options,\n };\n }\n });\n }, [props.cols]);\n\n return (\n <div\n className=\"border-gray-200 bg-gray-200 text-gray-600 rounded-t-md\"\n style={{ maxWidth: props.maxWidth }}\n >\n <div className=\"py-2 px-2\">\n <ConditionSearchBar\n id={idGenerator.getTableHeaderId()}\n targets={targets}\n conditions={conditions}\n onChangeCondition={onChangeCondition}\n size=\"small\"\n />\n </div>\n\n <style>{`\n .teppen-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n .teppen-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n `}</style>\n <div\n ref={ref}\n className=\"relative max-w-full overflow-x-auto teppen-no-scrollbar\"\n >\n <div className=\"flex h-[32px]\">\n {props.checkbox && (\n <th className=\"w-8 h-full\">\n <AllCheckbox rows={props.rows} />\n </th>\n )}\n {props.cols.map((col) => {\n return (\n <HeaderElement\n key={col.key.toString()}\n keyName={col.key.toString()}\n label={col.label}\n colWidth={getColumnWidth(col.key as string)}\n disableSort={col.disableSort || (!col.editable && !!col.render)}\n generateSortButton={props.generateSortButton}\n />\n );\n })}\n </div>\n </div>\n </div>\n );\n}\n\ninterface IPropsHeaderElement {\n keyName: string;\n label?: string;\n colWidth: number;\n disableSort?: boolean;\n generateSortButton?: (columnKey: string) => React.ReactNode;\n}\n\nconst HeaderElement = memo(function HE(props: IPropsHeaderElement) {\n const ref = useRef<HTMLDivElement>(null);\n const { onMouseDownResizeWidth } = useResizeColWidthHook(props.keyName);\n\n const maxWidthLabel = ref.current\n ? props.colWidth - ref.current.clientWidth\n : props.colWidth;\n\n return (\n <div\n className=\"relative\"\n style={{\n width: props.colWidth,\n maxWidth: props.colWidth,\n minWidth: props.colWidth,\n }}\n >\n <div\n className={`flex justify-between items-center bg-gray-200 text-gray-600 h-[32px]`}\n >\n <div className=\"px-2\" style={{ maxWidth: maxWidthLabel }}>\n {props.label && (\n <p\n className={`text-left font-bold text-nowrap overflow-hidden text-ellipsis`}\n >\n {props.label}\n </p>\n )}\n </div>\n\n <div ref={ref} className=\"flex items-center w-fit shrink-0 gap-1 px-1\">\n {!props.disableSort &&\n props.generateSortButton &&\n props.generateSortButton(props.keyName)}\n </div>\n </div>\n <div\n className=\"absolute top-0 right-0 grid place-items-end py-1 w-[4px] h-full cursor-col-resize\"\n onMouseDown={onMouseDownResizeWidth}\n >\n <div className={`w-[1px] h-full bg-white`} />\n </div>\n </div>\n );\n});\n"],"names":["TableHeader","props","idGenerator","useTableIdGenerator","getColumnWidth","useColumnsWidthState","_a","useFilter","conditions","addFilter","removeFilter","ref","useScrollXRef","useEffect","current","element_1","scrollX_1","e","deltaY","preventDefault","scrollLeft","addEventListener","removeEventListener","onChangeCondition","useCallback","action","type","payload","condition","index","targets","useMemo","cols","filter","col","label","editable","render","map","key","toString","options","_jsxs","className","style","maxWidth","children","_jsx","ConditionSearchBar","id","getTableHeaderId","size","checkbox","AllCheckbox","rows","HeaderElement","keyName","colWidth","disableSort","generateSortButton","memo","useRef","onMouseDownResizeWidth","useResizeColWidthHook","maxWidthLabel","clientWidth","width","minWidth","onMouseDown"],"mappings":"ikBAkBM,SAAUA,EAAkCC,GAChD,IAAMC,EAAcC,IACZC,EAAmBC,mBACrBC,EAA0CC,IAAxCC,EAAUF,EAAAE,WAAEC,EAASH,EAAAG,UAAEC,EAAYJ,EAAAI,aACrCC,EAAMC,IAEZC,GAAU,WACR,GAAIF,EAAIG,QAAS,CACf,IAAMC,EAAUJ,EAAIG,QAEdE,EAAU,SAACC,GACE,IAAbA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ACjBL,MAAOD,EAAIC,MACXsB,SAAUrD,EAAe8B,EAAIK,KAC7BmB,YAAaxB,EAAIwB,cAAiBxB,EAAIE,YAAcF,EAAIG,OACxDsB,mBAAoB1D,EAAM0D,oBALrBzB,EAAIK,IAAIC,WAQlB,WAKX,CAUA,IAAMe,EAAgBK,GAAK,SAAY3D,GACrC,IAAMU,EAAMkD,EAAuB,MAC3BC,EAA2BC,EAAsB9D,EAAMuD,SAAQM,uBAEjEE,EAAgBrD,EAAIG,QACtBb,EAAMwD,SAAW9C,EAAIG,QAAQmD,YAC7BhE,EAAMwD,SAEV,OACEf,EACE,MAAA,CAAAC,UAAU,WACVC,MAAO,CACLsB,MAAOjE,EAAMwD,SACbZ,SAAU5C,EAAMwD,SAChBU,SAAUlE,EAAMwD,UAGlBX,SAAA,CAAAJ,EAAA,MAAA,CACEC,UAAW,iFAEXI,EAAK,MAAA,CAAAJ,UAAU,OAAOC,MAAO,CAAEC,SAAUmB,GACtClB,SAAA7C,EAAMkC,OACLY,OACEJ,UAAW,gEAEVG,SAAA7C,EAAMkC,UAKbY,EAAA,MAAA,CAAKpC,IAAKA,EAAKgC,UAAU,8CACtBG,UAAC7C,EAAMyD,aACNzD,EAAM0D,oBACN1D,EAAM0D,mBAAmB1D,EAAMuD,cAGrCT,EAAA,MAAA,CACEJ,UAAU,oFACVyB,YAAaN,EAAsBhB,SAEnCC,EAAK,MAAA,CAAAJ,UAAW,gCAIxB"}
1
+ {"version":3,"file":"header-v2.js","sources":["../../../../../src/table/header/header-v2.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { DataObject, DataRecord, TTableColumn } from \"../table/type\";\nimport { useColumnsWidthState } from \"./columns-width\";\nimport { useResizeColWidthHook, useScrollXRef } from \"./header-v2-hook\";\nimport { AllCheckbox } from \"../checkbox/components\";\nimport { ConditionSearchBar } from \"../../search-bar\";\nimport { useTableIdGenerator } from \"../id\";\nimport { useFilter } from \"../filter-v2\";\nimport { TConditionChangeAction } from \"../../search-bar/condition-search-bar/condition-input-management/type\";\n\ninterface IPropsTableHeader<T extends DataRecord> {\n cols: TTableColumn<T>[];\n checkbox?: boolean;\n rows: DataObject<T>[];\n maxWidth?: string;\n generateSortButton?: (columnKey: string) => React.ReactNode;\n}\n\nexport function TableHeader<T extends DataRecord>(props: IPropsTableHeader<T>) {\n const idGenerator = useTableIdGenerator();\n const { getColumnWidth } = useColumnsWidthState();\n const { conditions, addFilter, removeFilter } = useFilter();\n const ref = useScrollXRef();\n\n useEffect(() => {\n if (ref.current) {\n const element = ref.current;\n\n const scrollX = (e: WheelEvent) => {\n if (e.deltaY === 0) return;\n\n e.preventDefault();\n element.scrollLeft += e.deltaY;\n };\n\n element.addEventListener(\"wheel\", scrollX);\n\n return () => {\n element.removeEventListener(\"wheel\", scrollX);\n };\n }\n }, [ref]);\n\n const onChangeCondition = useCallback((action: TConditionChangeAction) => {\n switch (action.type) {\n case \"add\":\n addFilter(action.payload.condition);\n break;\n case \"remove\":\n removeFilter(action.payload.index);\n break;\n }\n }, []);\n\n const targets = useMemo(() => {\n return props.cols\n .filter(\n (col) => !!col.label && (col.editable || (!col.editable && !col.render))\n )\n .map((col) => {\n switch (col.type) {\n case \"string\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n };\n case \"number\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n };\n case \"select\":\n return {\n key: col.key.toString(),\n label: col.label as string,\n type: col.type,\n options: col.options,\n };\n }\n });\n }, [props.cols]);\n\n return (\n <div\n className=\"border-gray-200 bg-gray-200 text-gray-600 rounded-t-md\"\n style={{ maxWidth: props.maxWidth }}\n >\n <div className=\"py-2 px-2\">\n <ConditionSearchBar\n id={idGenerator.getTableHeaderId()}\n targets={targets}\n conditions={conditions}\n onChangeCondition={onChangeCondition}\n size=\"small\"\n />\n </div>\n\n <style>{`\n .teppen-no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n }\n .teppen-no-scrollbar::-webkit-scrollbar {\n display: none;\n }\n `}</style>\n <div\n ref={ref}\n className=\"relative max-w-full overflow-x-auto teppen-no-scrollbar\"\n >\n <div className=\"flex h-[32px]\">\n {props.checkbox && (\n <div className=\"w-8 h-full\">\n <AllCheckbox rows={props.rows} />\n </div>\n )}\n {props.cols.map((col) => {\n return (\n <HeaderElement\n key={col.key.toString()}\n keyName={col.key.toString()}\n label={col.label}\n colWidth={getColumnWidth(col.key as string)}\n disableSort={col.disableSort || (!col.editable && !!col.render)}\n generateSortButton={props.generateSortButton}\n />\n );\n })}\n </div>\n </div>\n </div>\n );\n}\n\ninterface IPropsHeaderElement {\n keyName: string;\n label?: string;\n colWidth: number;\n disableSort?: boolean;\n generateSortButton?: (columnKey: string) => React.ReactNode;\n}\n\nconst HeaderElement = memo(function HE(props: IPropsHeaderElement) {\n const ref = useRef<HTMLDivElement>(null);\n const { onMouseDownResizeWidth } = useResizeColWidthHook(props.keyName);\n\n const maxWidthLabel = ref.current\n ? props.colWidth - ref.current.clientWidth\n : props.colWidth;\n\n return (\n <div\n className=\"relative\"\n style={{\n width: props.colWidth,\n maxWidth: props.colWidth,\n minWidth: props.colWidth,\n }}\n >\n <div\n className={`flex justify-between items-center bg-gray-200 text-gray-600 h-[32px]`}\n >\n <div className=\"px-2\" style={{ maxWidth: maxWidthLabel }}>\n {props.label && (\n <p\n className={`text-left font-bold text-nowrap overflow-hidden text-ellipsis`}\n >\n {props.label}\n </p>\n )}\n </div>\n\n <div ref={ref} className=\"flex items-center w-fit shrink-0 gap-1 px-1\">\n {!props.disableSort &&\n props.generateSortButton &&\n props.generateSortButton(props.keyName)}\n </div>\n </div>\n <div\n className=\"absolute top-0 right-0 grid place-items-end py-1 w-[4px] h-full cursor-col-resize\"\n onMouseDown={onMouseDownResizeWidth}\n >\n <div className={`w-[1px] h-full bg-white`} />\n </div>\n </div>\n );\n});\n"],"names":["TableHeader","props","idGenerator","useTableIdGenerator","getColumnWidth","useColumnsWidthState","_a","useFilter","conditions","addFilter","removeFilter","ref","useScrollXRef","useEffect","current","element_1","scrollX_1","e","deltaY","preventDefault","scrollLeft","addEventListener","removeEventListener","onChangeCondition","useCallback","action","type","payload","condition","index","targets","useMemo","cols","filter","col","label","editable","render","map","key","toString","options","_jsxs","className","style","maxWidth","children","_jsx","ConditionSearchBar","id","getTableHeaderId","size","checkbox","AllCheckbox","rows","HeaderElement","keyName","colWidth","disableSort","generateSortButton","memo","useRef","onMouseDownResizeWidth","useResizeColWidthHook","maxWidthLabel","clientWidth","width","minWidth","onMouseDown"],"mappings":"ikBAkBM,SAAUA,EAAkCC,GAChD,IAAMC,EAAcC,IACZC,EAAmBC,mBACrBC,EAA0CC,IAAxCC,EAAUF,EAAAE,WAAEC,EAASH,EAAAG,UAAEC,EAAYJ,EAAAI,aACrCC,EAAMC,IAEZC,GAAU,WACR,GAAIF,EAAIG,QAAS,CACf,IAAMC,EAAUJ,EAAIG,QAEdE,EAAU,SAACC,GACE,IAAbA,EAAEC,SAEND,EAAEE,iBACFJ,EAAQK,YAAcH,EAAEC,OAC1B,EAIA,OAFAH,EAAQM,iBAAiB,QAASL,GAE3B,WACLD,EAAQO,oBAAoB,QAASN,EACvC,CACD,CACH,GAAG,CAACL,IAEJ,IAAMY,EAAoBC,GAAY,SAACC,GACrC,OAAQA,EAAOC,MACb,IAAK,MACHjB,EAAUgB,EAAOE,QAAQC,WACzB,MACF,IAAK,SACHlB,EAAae,EAAOE,QAAQE,OAGjC,GAAE,IAEGC,EAAUC,GAAQ,WACtB,OAAO9B,EAAM+B,KACVC,QACC,SAACC,GAAQ,QAAEA,EAAIC,QAAUD,EAAIE,WAAcF,EAAIE,WAAaF,EAAIG,WAEjEC,KAAI,SAACJ,GACJ,OAAQA,EAAIR,MACV,IAAK,SAML,IAAK,SACH,MAAO,CACLa,IAAKL,EAAIK,IAAIC,WACbL,MAAOD,EAAIC,MACXT,KAAMQ,EAAIR,MAEd,IAAK,SACH,MAAO,CACLa,IAAKL,EAAIK,IAA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ACEJ,UAAW,gEAEVG,SAAA7C,EAAMkC,UAKbY,EAAA,MAAA,CAAKpC,IAAKA,EAAKgC,UAAU,8CACtBG,UAAC7C,EAAMyD,aACNzD,EAAM0D,oBACN1D,EAAM0D,mBAAmB1D,EAAMuD,cAGrCT,EAAA,MAAA,CACEJ,UAAU,oFACVyB,YAAaN,EAAsBhB,SAEnCC,EAAK,MAAA,CAAAJ,UAAW,gCAIxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teppen/react-ui",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "description": "React UI Component",
5
5
  "main": "dist/cjs/src/index.js",
6
6
  "module": "dist/esm/src/index.js",