@teppen/react-ui 1.7.6 → 1.8.0
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/dist/cjs/node_modules/react-icons/bi/index.js +2 -0
- package/dist/cjs/node_modules/react-icons/bi/index.js.map +1 -0
- package/dist/cjs/node_modules/react-icons/ti/index.js +2 -0
- package/dist/cjs/node_modules/react-icons/ti/index.js.map +1 -0
- package/dist/cjs/src/search-bar/condition-search-bar/base.js +3 -0
- package/dist/cjs/src/search-bar/condition-search-bar/base.js.map +1 -0
- package/dist/cjs/src/search-bar/condition-search-bar/condition-input-management/context.js +2 -0
- package/dist/cjs/src/search-bar/condition-search-bar/condition-input-management/context.js.map +1 -0
- package/dist/cjs/src/search-bar/condition-search-bar/condition-input-management/hook.js +2 -0
- package/dist/cjs/src/search-bar/condition-search-bar/condition-input-management/hook.js.map +1 -0
- package/dist/cjs/src/search-bar/condition-search-bar/condition-input-management/provider.js +2 -0
- package/dist/cjs/src/search-bar/condition-search-bar/condition-input-management/provider.js.map +1 -0
- package/dist/cjs/src/search-bar/condition-search-bar/condition-input-management/reducer.js +2 -0
- package/dist/cjs/src/search-bar/condition-search-bar/condition-input-management/reducer.js.map +1 -0
- package/dist/cjs/src/search-bar/condition-search-bar/condition-list.js +3 -0
- package/dist/cjs/src/search-bar/condition-search-bar/condition-list.js.map +1 -0
- package/dist/cjs/src/search-bar/condition-search-bar/input-form.js +3 -0
- package/dist/cjs/src/search-bar/condition-search-bar/input-form.js.map +1 -0
- package/dist/cjs/src/search-bar/id-generator/context.js +2 -0
- package/dist/cjs/src/search-bar/id-generator/context.js.map +1 -0
- package/dist/cjs/src/search-bar/id-generator/provider.js +3 -0
- package/dist/cjs/src/select-box/index.js +2 -1
- package/dist/cjs/src/select-box/index.js.map +1 -1
- package/dist/cjs/src/select-box/options-window/component.js +2 -0
- package/dist/cjs/src/select-box/options-window/component.js.map +1 -0
- package/dist/cjs/src/select-box/options-window/context.js +2 -0
- package/dist/cjs/src/select-box/options-window/context.js.map +1 -0
- package/dist/cjs/src/select-box/options-window/hook.js +2 -0
- package/dist/cjs/src/select-box/options-window/hook.js.map +1 -0
- package/dist/cjs/src/select-box/options-window/provider.js +2 -0
- package/dist/cjs/src/select-box/options-window/provider.js.map +1 -0
- package/dist/cjs/src/select-box/options-window/reducer.js +2 -0
- package/dist/cjs/src/select-box/options-window/reducer.js.map +1 -0
- package/dist/cjs/src/select-box/parts/frame.js +1 -1
- package/dist/cjs/src/select-box/parts/frame.js.map +1 -1
- package/dist/cjs/src/select-box/parts/input-area.js +1 -1
- package/dist/cjs/src/select-box/provider.js +3 -0
- package/dist/cjs/src/share/search-operator/constant.js +2 -0
- package/dist/cjs/src/share/search-operator/constant.js.map +1 -0
- package/dist/cjs/src/table/cell/hooks.js +1 -1
- package/dist/cjs/src/table/cell/hooks.js.map +1 -1
- package/dist/cjs/src/table/checkbox/components.js +1 -1
- package/dist/cjs/src/table/filter-v2/context.js +2 -0
- package/dist/cjs/src/table/filter-v2/context.js.map +1 -0
- package/dist/cjs/src/table/filter-v2/hook.js +2 -0
- package/dist/cjs/src/table/filter-v2/hook.js.map +1 -0
- package/dist/cjs/src/table/filter-v2/provider.js +2 -0
- package/dist/cjs/src/table/filter-v2/provider.js.map +1 -0
- package/dist/cjs/src/table/filter-v2/reducer.js +2 -0
- package/dist/cjs/src/table/filter-v2/reducer.js.map +1 -0
- package/dist/cjs/src/table/frame/frame.js +3 -0
- package/dist/cjs/src/table/frame/frame.js.map +1 -0
- package/dist/cjs/src/table/header/columns-width/context.js +2 -0
- package/dist/cjs/src/table/header/columns-width/context.js.map +1 -0
- package/dist/cjs/src/table/header/columns-width/provider.js +3 -0
- package/dist/cjs/src/table/header/columns-width/provider.js.map +1 -0
- package/dist/cjs/src/table/header/columns-width/reducer.js +2 -0
- package/dist/cjs/src/table/header/columns-width/reducer.js.map +1 -0
- package/dist/cjs/src/table/header/header-v2-hook.js +2 -0
- package/dist/cjs/src/table/header/header-v2-hook.js.map +1 -0
- package/dist/cjs/src/table/header/header-v2.js +2 -0
- package/dist/cjs/src/table/header/header-v2.js.map +1 -0
- package/dist/cjs/src/table/header/header.js +1 -1
- package/dist/cjs/src/table/header/x-scroll-position/context.js +2 -0
- package/dist/cjs/src/table/header/x-scroll-position/context.js.map +1 -0
- package/dist/cjs/src/table/header/x-scroll-position/provider.js +2 -0
- package/dist/cjs/src/table/header/x-scroll-position/provider.js.map +1 -0
- package/dist/cjs/src/table/header/x-scroll-position/reducer.js +2 -0
- package/dist/cjs/src/table/header/x-scroll-position/reducer.js.map +1 -0
- package/dist/cjs/src/table/id/id-generator.js +1 -1
- package/dist/cjs/src/table/id/id-generator.js.map +1 -1
- package/dist/cjs/src/table/range/provider.js +1 -1
- package/dist/cjs/src/table/range/provider.js.map +1 -1
- package/dist/cjs/src/table/sheet/components.js +1 -1
- package/dist/cjs/src/table/sheet/components.js.map +1 -1
- package/dist/cjs/src/table/table/base.js +1 -1
- package/dist/cjs/src/table/table/component-provider/provider.js +3 -0
- package/dist/cjs/src/table/table/component-provider/provider.js.map +1 -0
- package/dist/cjs/src/table/table/hook.js +1 -1
- package/dist/cjs/src/table/table/hook.js.map +1 -1
- package/dist/esm/node_modules/react-icons/bi/index.js +2 -0
- package/dist/esm/node_modules/react-icons/bi/index.js.map +1 -0
- package/dist/esm/node_modules/react-icons/ti/index.js +2 -0
- package/dist/esm/node_modules/react-icons/ti/index.js.map +1 -0
- package/dist/esm/src/search-bar/condition-search-bar/base.js +3 -0
- package/dist/esm/src/search-bar/condition-search-bar/base.js.map +1 -0
- package/dist/esm/src/search-bar/condition-search-bar/condition-input-management/context.js +2 -0
- package/dist/esm/src/search-bar/condition-search-bar/condition-input-management/context.js.map +1 -0
- package/dist/esm/src/search-bar/condition-search-bar/condition-input-management/hook.js +2 -0
- package/dist/esm/src/search-bar/condition-search-bar/condition-input-management/hook.js.map +1 -0
- package/dist/esm/src/search-bar/condition-search-bar/condition-input-management/provider.js +2 -0
- package/dist/esm/src/search-bar/condition-search-bar/condition-input-management/provider.js.map +1 -0
- package/dist/esm/src/search-bar/condition-search-bar/condition-input-management/reducer.js +2 -0
- package/dist/esm/src/search-bar/condition-search-bar/condition-input-management/reducer.js.map +1 -0
- package/dist/esm/src/search-bar/condition-search-bar/condition-list.js +3 -0
- package/dist/esm/src/search-bar/condition-search-bar/condition-list.js.map +1 -0
- package/dist/esm/src/search-bar/condition-search-bar/input-form.js +3 -0
- package/dist/esm/src/search-bar/condition-search-bar/input-form.js.map +1 -0
- package/dist/esm/src/search-bar/id-generator/context.js +2 -0
- package/dist/esm/src/search-bar/id-generator/context.js.map +1 -0
- package/dist/esm/src/search-bar/id-generator/provider.js +3 -0
- package/dist/esm/src/search-bar/id-generator/provider.js.map +1 -0
- package/dist/esm/src/select-box/index.js +2 -1
- package/dist/esm/src/select-box/index.js.map +1 -1
- package/dist/esm/src/select-box/options-window/component.js +2 -0
- package/dist/esm/src/select-box/options-window/component.js.map +1 -0
- package/dist/esm/src/select-box/options-window/context.js +2 -0
- package/dist/esm/src/select-box/options-window/context.js.map +1 -0
- package/dist/esm/src/select-box/options-window/hook.js +2 -0
- package/dist/esm/src/select-box/options-window/hook.js.map +1 -0
- package/dist/esm/src/select-box/options-window/provider.js +2 -0
- package/dist/esm/src/select-box/options-window/provider.js.map +1 -0
- package/dist/esm/src/select-box/options-window/reducer.js +2 -0
- package/dist/esm/src/select-box/options-window/reducer.js.map +1 -0
- package/dist/esm/src/select-box/parts/frame.js +1 -1
- package/dist/esm/src/select-box/parts/frame.js.map +1 -1
- package/dist/esm/src/select-box/parts/input-area.js +1 -1
- package/dist/esm/src/select-box/provider.js +3 -0
- package/dist/esm/src/select-box/provider.js.map +1 -0
- package/dist/esm/src/share/search-operator/constant.js +2 -0
- package/dist/esm/src/share/search-operator/constant.js.map +1 -0
- package/dist/esm/src/table/cell/hooks.js +1 -1
- package/dist/esm/src/table/cell/hooks.js.map +1 -1
- package/dist/esm/src/table/checkbox/components.js +1 -1
- package/dist/esm/src/table/filter-v2/context.js +2 -0
- package/dist/esm/src/table/filter-v2/context.js.map +1 -0
- package/dist/esm/src/table/filter-v2/hook.js +2 -0
- package/dist/esm/src/table/filter-v2/hook.js.map +1 -0
- package/dist/esm/src/table/filter-v2/provider.js +2 -0
- package/dist/esm/src/table/filter-v2/provider.js.map +1 -0
- package/dist/esm/src/table/filter-v2/reducer.js +2 -0
- package/dist/esm/src/table/filter-v2/reducer.js.map +1 -0
- package/dist/esm/src/table/frame/frame.js +3 -0
- package/dist/esm/src/table/frame/frame.js.map +1 -0
- package/dist/esm/src/table/header/columns-width/context.js +2 -0
- package/dist/esm/src/table/header/columns-width/context.js.map +1 -0
- package/dist/esm/src/table/header/columns-width/provider.js +3 -0
- package/dist/esm/src/table/header/columns-width/provider.js.map +1 -0
- package/dist/esm/src/table/header/columns-width/reducer.js +2 -0
- package/dist/esm/src/table/header/columns-width/reducer.js.map +1 -0
- package/dist/esm/src/table/header/header-v2-hook.js +2 -0
- package/dist/esm/src/table/header/header-v2-hook.js.map +1 -0
- package/dist/esm/src/table/header/header-v2.js +2 -0
- package/dist/esm/src/table/header/header-v2.js.map +1 -0
- package/dist/esm/src/table/header/header.js +1 -1
- package/dist/esm/src/table/header/x-scroll-position/context.js +2 -0
- package/dist/esm/src/table/header/x-scroll-position/context.js.map +1 -0
- package/dist/esm/src/table/header/x-scroll-position/provider.js +2 -0
- package/dist/esm/src/table/header/x-scroll-position/provider.js.map +1 -0
- package/dist/esm/src/table/header/x-scroll-position/reducer.js +2 -0
- package/dist/esm/src/table/header/x-scroll-position/reducer.js.map +1 -0
- package/dist/esm/src/table/id/id-generator.js +1 -1
- package/dist/esm/src/table/id/id-generator.js.map +1 -1
- package/dist/esm/src/table/range/provider.js +1 -1
- package/dist/esm/src/table/range/provider.js.map +1 -1
- package/dist/esm/src/table/sheet/components.js +1 -1
- package/dist/esm/src/table/sheet/components.js.map +1 -1
- package/dist/esm/src/table/table/base.js +1 -1
- package/dist/esm/src/table/table/component-provider/provider.js +3 -0
- package/dist/esm/src/table/table/component-provider/provider.js.map +1 -0
- package/dist/esm/src/table/table/hook.js +1 -1
- package/dist/esm/src/table/table/hook.js.map +1 -1
- package/dist/index.d.ts +28 -4
- package/package.json +1 -1
- package/dist/cjs/src/select-box/parts/options-area.js +0 -2
- package/dist/cjs/src/select-box/parts/options-area.js.map +0 -1
- package/dist/cjs/src/table/filter/components.js +0 -3
- package/dist/cjs/src/table/filter/components.js.map +0 -1
- package/dist/cjs/src/table/filter/constants.js +0 -2
- package/dist/cjs/src/table/filter/constants.js.map +0 -1
- package/dist/cjs/src/table/filter/filter-icon.js +0 -2
- package/dist/cjs/src/table/filter/filter-icon.js.map +0 -1
- package/dist/cjs/src/table/filter/hooks/selectedFilteringColumn/hooks.js +0 -2
- package/dist/cjs/src/table/filter/hooks/selectedFilteringColumn/hooks.js.map +0 -1
- package/dist/cjs/src/table/filter/hooks/selectedFilteringColumn/provider.js +0 -2
- package/dist/cjs/src/table/filter/hooks/selectedFilteringColumn/provider.js.map +0 -1
- package/dist/cjs/src/table/filter/hooks.js +0 -2
- package/dist/cjs/src/table/filter/hooks.js.map +0 -1
- package/dist/cjs/src/table/filter/provider.js +0 -3
- package/dist/cjs/src/table/header/resize-col-width-hook.js +0 -2
- package/dist/cjs/src/table/header/resize-col-width-hook.js.map +0 -1
- package/dist/esm/src/select-box/parts/options-area.js +0 -2
- package/dist/esm/src/select-box/parts/options-area.js.map +0 -1
- package/dist/esm/src/table/filter/components.js +0 -3
- package/dist/esm/src/table/filter/components.js.map +0 -1
- package/dist/esm/src/table/filter/constants.js +0 -2
- package/dist/esm/src/table/filter/constants.js.map +0 -1
- package/dist/esm/src/table/filter/filter-icon.js +0 -2
- package/dist/esm/src/table/filter/filter-icon.js.map +0 -1
- package/dist/esm/src/table/filter/hooks/selectedFilteringColumn/hooks.js +0 -2
- package/dist/esm/src/table/filter/hooks/selectedFilteringColumn/hooks.js.map +0 -1
- package/dist/esm/src/table/filter/hooks/selectedFilteringColumn/provider.js +0 -2
- package/dist/esm/src/table/filter/hooks/selectedFilteringColumn/provider.js.map +0 -1
- package/dist/esm/src/table/filter/hooks.js +0 -2
- package/dist/esm/src/table/filter/hooks.js.map +0 -1
- package/dist/esm/src/table/filter/provider.js +0 -3
- package/dist/esm/src/table/header/resize-col-width-hook.js +0 -2
- package/dist/esm/src/table/header/resize-col-width-hook.js.map +0 -1
- /package/dist/cjs/src/{table/filter → search-bar/id-generator}/provider.js.map +0 -0
- /package/dist/{esm/src/table/filter → cjs/src/select-box}/provider.js.map +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("../../select-box/provider.js");require("../id-generator/context.js");var t=require("../id-generator/provider.js"),n=require("./condition-input-management/provider.js");require("./condition-input-management/context.js");var s=require("./condition-list.js"),o=require("./input-form.js"),a=require("../../../node_modules/react-icons/bi/index.js"),c=r.memo((function(r){return e.jsx(i.SelectBoxProvider,{children:e.jsx(t.IdGeneratorProvider,{id:r.id,children:e.jsx(n.ConditionInputProvider,{targets:r.targets,onChangeCondition:r.onChangeCondition,children:e.jsx(d,{size:r.size,conditions:r.conditions})})})})}));function d(i){var t=r.useRef(null);return r.useEffect((function(){if(t.current){var e=t.current,r=function(r){0!==r.deltaY&&(r.preventDefault(),e.scrollLeft+=r.deltaY)};return e.addEventListener("wheel",r),function(){e.removeEventListener("wheel",r)}}}),[t]),e.jsxs("div",{className:"flex items-center gap-1 w-full px-2 py-1 bg-white border border-slate-700 rounded-md text-gray-800 ".concat("small"===i.size?"text-sm":"large"===i.size?"text-lg":""),children:[e.jsx("div",{className:"px-2",children:e.jsx(a.BiSearchAlt,{className:"text-slate-600"})}),e.jsxs("div",{ref:t,className:"relative flex w-full items-center gap-1 overflow-x-auto no_scrollbar",children:[e.jsx(s.ConditionList,{conditions:i.conditions}),e.jsx("div",{className:"flex items-center min-w-64 w-full",children:e.jsx(o.SearchBarInputForm,{size:i.size})})]})]})}exports.ConditionSearchBar=c,exports.SearchBar=d;
|
|
3
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("react"),n=t.createContext(null),e=t.createContext(null);exports.ConditionInputActionContext=e,exports.ConditionInputStateContext=n,exports.useConditionInputAction=function(){var n=t.useContext(e);if(!n)throw new Error("useConditionInputAction must be used within a ConditionInputProvider");return n},exports.useConditionInputState=function(){var e=t.useContext(n);if(!e)throw new Error("useConditionInputState must be used within a ConditionInputProvider");return e};
|
|
2
|
+
//# sourceMappingURL=context.js.map
|
package/dist/cjs/src/search-bar/condition-search-bar/condition-input-management/context.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../../src/search-bar/condition-search-bar/condition-input-management/context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport {\n TConditionInputActionContext,\n TConditionInputStateContext,\n} from \"./type\";\n\nexport const ConditionInputStateContext =\n createContext<TConditionInputStateContext | null>(null);\n\nexport const ConditionInputActionContext =\n createContext<TConditionInputActionContext | null>(null);\n\nexport function useConditionInputState() {\n const context = useContext(ConditionInputStateContext);\n\n if (!context) {\n throw new Error(\n \"useConditionInputState must be used within a ConditionInputProvider\"\n );\n }\n\n return context;\n}\n\nexport function useConditionInputAction() {\n const context = useContext(ConditionInputActionContext);\n\n if (!context) {\n throw new Error(\n \"useConditionInputAction must be used within a ConditionInputProvider\"\n );\n }\n\n return context;\n}\n\nexport function useConditionInput() {\n return {\n state: useConditionInputState(),\n actions: useConditionInputAction(),\n };\n}\n"],"names":["ConditionInputStateContext","createContext","ConditionInputActionContext","context","useContext","Error"],"mappings":"oCAMaA,EACXC,EAAaA,cAAqC,MAEvCC,EACXD,EAAaA,cAAsC,4HAenD,IAAME,EAAUC,aAAWF,GAE3B,IAAKC,EACH,MAAM,IAAIE,MACR,wEAIJ,OAAOF,CACT,4CArBE,IAAMA,EAAUC,aAAWJ,GAE3B,IAAKG,EACH,MAAM,IAAIE,MACR,uEAIJ,OAAOF,CACT"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react"),t=require("./reducer.js");exports.useConditionInputHook=function(n,r){var o=e.useReducer(t.conditionInputReducer,{targets:n,onChangeCondition:r,status:"waiting for input"}),u=o[0],a=o[1],i=e.useMemo((function(){return{inputTarget:function(e){a({type:"inputTarget",payload:{targetKey:e}})},inputOperator:function(e){a({type:"inputOperator",payload:{operatorKey:e}})},inputValue:function(e){a({type:"inputValue",payload:e})},deleteCondition:function(e){a({type:"deleteCondition",payload:{index:e}})},reset:function(){a({type:"reset"})},updateTargets:function(e){a({type:"updateTargets",payload:{targets:e}})},removeInputedTarget:function(){a({type:"removeInputedTarget"})},removeInputedOperator:function(){a({type:"removeInputedOperator"})}}}),[]);return{state:u,actions:i}};
|
|
2
|
+
//# sourceMappingURL=hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.js","sources":["../../../../../../src/search-bar/condition-search-bar/condition-input-management/hook.ts"],"sourcesContent":["import { useMemo, useReducer } from \"react\";\nimport { SearchInput, Target, TConditionInputHook } from \"./type\";\nimport { conditionInputReducer } from \"./reducer\";\n\nexport const useConditionInputHook: TConditionInputHook = (\n targets,\n onChangeCondition\n) => {\n const [state, dispatch] = useReducer(conditionInputReducer, {\n targets,\n onChangeCondition,\n status: \"waiting for input\",\n });\n\n const actions = useMemo(\n () => ({\n inputTarget: (targetKey: string) => {\n dispatch({ type: \"inputTarget\", payload: { targetKey } });\n },\n inputOperator: (operatorKey: string) => {\n dispatch({ type: \"inputOperator\", payload: { operatorKey } });\n },\n inputValue: (value: SearchInput) => {\n dispatch({ type: \"inputValue\", payload: value });\n },\n deleteCondition: (index: number) => {\n dispatch({ type: \"deleteCondition\", payload: { index } });\n },\n reset: () => {\n dispatch({ type: \"reset\" });\n },\n updateTargets: (targets: Target[]) => {\n dispatch({ type: \"updateTargets\", payload: { targets } });\n },\n removeInputedTarget: () => {\n dispatch({ type: \"removeInputedTarget\" });\n },\n removeInputedOperator: () => {\n dispatch({ type: \"removeInputedOperator\" });\n },\n }),\n []\n );\n\n return {\n state,\n actions,\n };\n};\n"],"names":["targets","onChangeCondition","_a","useReducer","conditionInputReducer","status","state","dispatch","actions","useMemo","inputTarget","targetKey","type","payload","inputOperator","operatorKey","inputValue","value","deleteCondition","index","reset","updateTargets","removeInputedTarget","removeInputedOperator"],"mappings":"4FAI0D,SACxDA,EACAC,GAEM,IAAAC,EAAoBC,EAAUA,WAACC,wBAAuB,CAC1DJ,QAAOA,EACPC,kBAAiBA,EACjBI,OAAQ,sBAHHC,EAAKJ,EAAA,GAAEK,OAMRC,EAAUC,WACd,WAAM,MAAC,CACLC,YAAa,SAACC,GACZJ,EAAS,CAAEK,KAAM,cAAeC,QAAS,CAAEF,UAASA,IACrD,EACDG,cAAe,SAACC,GACdR,EAAS,CAAEK,KAAM,gBAAiBC,QAAS,CAAEE,YAAWA,IACzD,EACDC,WAAY,SAACC,GACXV,EAAS,CAAEK,KAAM,aAAcC,QAASI,GACzC,EACDC,gBAAiB,SAACC,GAChBZ,EAAS,CAAEK,KAAM,kBAAmBC,QAAS,CAAEM,MAAKA,IACrD,EACDC,MAAO,WACLb,EAAS,CAAEK,KAAM,SAClB,EACDS,cAAe,SAACrB,GACdO,EAAS,CAAEK,KAAM,gBAAiBC,QAAS,CAAEb,QAAOA,IACrD,EACDsB,oBAAqB,WACnBf,EAAS,CAAEK,KAAM,uBAClB,EACDW,sBAAuB,WACrBhB,EAAS,CAAEK,KAAM,yBAClB,EAxBG,GA0BN,IAGF,MAAO,CACLN,MAAKA,EACLE,QAAOA,EAEX"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("react/jsx-runtime"),n=require("./context.js"),e=require("./hook.js");exports.ConditionInputProvider=function(o){var i=e.useConditionInputHook(o.targets,o.onChangeCondition),r=i.state,u=i.actions;return t.jsx(n.ConditionInputStateContext.Provider,{value:r,children:t.jsx(n.ConditionInputActionContext.Provider,{value:u,children:o.children})})};
|
|
2
|
+
//# sourceMappingURL=provider.js.map
|
package/dist/cjs/src/search-bar/condition-search-bar/condition-input-management/provider.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sources":["../../../../../../src/search-bar/condition-search-bar/condition-input-management/provider.tsx"],"sourcesContent":["import {\n ConditionInputActionContext,\n ConditionInputStateContext,\n} from \"./context\";\nimport { useConditionInputHook } from \"./hook\";\nimport { Target, TConditionChangeAction } from \"./type\";\n\nexport function ConditionInputProvider(props: {\n children: React.ReactNode;\n targets: Target[];\n onChangeCondition: (action: TConditionChangeAction) => void;\n}) {\n const { state, actions } = useConditionInputHook(\n props.targets,\n props.onChangeCondition\n );\n\n return (\n <ConditionInputStateContext.Provider value={state}>\n <ConditionInputActionContext.Provider value={actions}>\n {props.children}\n </ConditionInputActionContext.Provider>\n </ConditionInputStateContext.Provider>\n );\n}\n"],"names":["props","_a","useConditionInputHook","targets","onChangeCondition","state","actions","_jsx","ConditionInputStateContext","Provider","value","children","ConditionInputActionContext"],"mappings":"gIAOM,SAAiCA,GAK/B,IAAAC,EAAqBC,EAAqBA,sBAC9CF,EAAMG,QACNH,EAAMI,mBAFAC,UAAOC,YAKf,OACEC,EAAAA,IAACC,EAAAA,2BAA2BC,UAASC,MAAOL,EAAKM,SAC/CJ,MAACK,EAAAA,4BAA4BH,SAAQ,CAACC,MAAOJ,EAAOK,SACjDX,EAAMW,YAIf"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("../../../share/search-operator/constant.js");exports.conditionInputReducer=function(n,e){switch(e.type){case"inputTarget":if("waiting for input"!==n.status)return n;var i=n.targets.find((function(t){return t.key===e.payload.targetKey}));return i?{targets:n.targets,onChangeCondition:n.onChangeCondition,status:"inputted target",inputtingCondition:{type:i.type,target:i},useableOperators:t.DEFAULT_SEARCH_OPERATOR.filter((function(t){return t.type===i.type}))}:n;case"inputOperator":if("inputted target"!==n.status)return n;var o=t.DEFAULT_SEARCH_OPERATOR.find((function(t){return t.key===e.payload.operatorKey}));return o?o.type!==n.inputtingCondition.target.type?n:"none"===o.inputType?(n.onChangeCondition({type:"add",payload:{condition:{target:n.inputtingCondition.target,operator:o,input:{type:"none"}}}}),{targets:n.targets,onChangeCondition:n.onChangeCondition,status:"waiting for input"}):{targets:n.targets,onChangeCondition:n.onChangeCondition,status:"inputted operator",inputtingCondition:{type:n.inputtingCondition.target.type,target:n.inputtingCondition.target,operator:o}}:n;case"inputValue":return"inputted operator"!==n.status?n:(n.onChangeCondition({type:"add",payload:{condition:{target:n.inputtingCondition.target,operator:n.inputtingCondition.operator,input:e.payload}}}),{targets:n.targets,onChangeCondition:n.onChangeCondition,status:"waiting for input"});case"deleteCondition":return n.onChangeCondition({type:"remove",payload:{index:e.payload.index}}),n;case"reset":return{targets:n.targets,onChangeCondition:n.onChangeCondition,status:"waiting for input"};case"updateTargets":return{targets:e.payload.targets,onChangeCondition:n.onChangeCondition,status:"waiting for input"};case"removeInputedTarget":return"inputted target"!=n.status&&"inputted operator"!=n.status?n:{targets:n.targets,onChangeCondition:n.onChangeCondition,status:"waiting for input"};case"removeInputedOperator":return"inputted operator"!==n.status?n:{targets:n.targets,onChangeCondition:n.onChangeCondition,status:"inputted target",inputtingCondition:{type:n.inputtingCondition.target.type,target:n.inputtingCondition.target},useableOperators:t.DEFAULT_SEARCH_OPERATOR.filter((function(t){return t.type===n.inputtingCondition.target.type}))}}};
|
|
2
|
+
//# sourceMappingURL=reducer.js.map
|
package/dist/cjs/src/search-bar/condition-search-bar/condition-input-management/reducer.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.js","sources":["../../../../../../src/search-bar/condition-search-bar/condition-input-management/reducer.ts"],"sourcesContent":["import { DEFAULT_SEARCH_OPERATOR } from \"../../../share/search-operator\";\nimport { TConditionInputReducer } from \"./type\";\n\nexport const conditionInputReducer: TConditionInputReducer = (\n state,\n action\n) => {\n switch (action.type) {\n case \"inputTarget\": {\n if (state.status !== \"waiting for input\") {\n return state;\n }\n\n const target = state.targets.find(\n (t) => t.key === action.payload.targetKey\n );\n\n if (!target) {\n return state;\n }\n\n return {\n targets: state.targets,\n onChangeCondition: state.onChangeCondition,\n status: \"inputted target\",\n inputtingCondition: {\n type: target.type,\n target,\n },\n useableOperators: DEFAULT_SEARCH_OPERATOR.filter(\n (o) => o.type === target.type\n ),\n };\n }\n\n case \"inputOperator\": {\n if (state.status !== \"inputted target\") {\n return state;\n }\n\n const operator = DEFAULT_SEARCH_OPERATOR.find(\n (o) => o.key === action.payload.operatorKey\n );\n\n if (!operator) {\n return state;\n }\n\n if (operator.type !== state.inputtingCondition.target.type) {\n return state;\n }\n\n if (operator.inputType === \"none\") {\n state.onChangeCondition({\n type: \"add\",\n payload: {\n condition: {\n target: state.inputtingCondition.target,\n operator,\n input: {\n type: \"none\",\n },\n },\n },\n });\n\n return {\n targets: state.targets,\n onChangeCondition: state.onChangeCondition,\n status: \"waiting for input\",\n };\n }\n\n return {\n targets: state.targets,\n onChangeCondition: state.onChangeCondition,\n status: \"inputted operator\",\n inputtingCondition: {\n type: state.inputtingCondition.target.type,\n target: state.inputtingCondition.target,\n operator,\n },\n };\n }\n\n case \"inputValue\": {\n if (state.status !== \"inputted operator\") {\n return state;\n }\n\n state.onChangeCondition({\n type: \"add\",\n payload: {\n condition: {\n target: state.inputtingCondition.target,\n operator: state.inputtingCondition.operator,\n input: action.payload,\n },\n },\n });\n\n return {\n targets: state.targets,\n onChangeCondition: state.onChangeCondition,\n status: \"waiting for input\",\n };\n }\n\n case \"deleteCondition\": {\n state.onChangeCondition({\n type: \"remove\",\n payload: {\n index: action.payload.index,\n },\n });\n\n return state;\n }\n\n case \"reset\": {\n return {\n targets: state.targets,\n onChangeCondition: state.onChangeCondition,\n status: \"waiting for input\",\n };\n }\n\n case \"updateTargets\": {\n return {\n targets: action.payload.targets,\n onChangeCondition: state.onChangeCondition,\n status: \"waiting for input\",\n };\n }\n\n case \"removeInputedTarget\": {\n if (\n !(\n state.status == \"inputted target\" ||\n state.status == \"inputted operator\"\n )\n ) {\n return state;\n }\n\n return {\n targets: state.targets,\n onChangeCondition: state.onChangeCondition,\n status: \"waiting for input\",\n };\n }\n\n case \"removeInputedOperator\": {\n if (state.status !== \"inputted operator\") {\n return state;\n }\n\n return {\n targets: state.targets,\n onChangeCondition: state.onChangeCondition,\n status: \"inputted target\",\n inputtingCondition: {\n type: state.inputtingCondition.target.type,\n target: state.inputtingCondition.target,\n },\n useableOperators: DEFAULT_SEARCH_OPERATOR.filter(\n (o) => o.type === state.inputtingCondition.target.type\n ),\n };\n }\n }\n};\n"],"names":["state","action","type","status","target_1","targets","find","t","key","payload","targetKey","onChangeCondition","inputtingCondition","target","useableOperators","DEFAULT_SEARCH_OPERATOR","filter","o","operator","operatorKey","inputType","condition","input","index"],"mappings":"uGAG6D,SAC3DA,EACAC,GAEA,OAAQA,EAAOC,MACb,IAAK,cACH,GAAqB,sBAAjBF,EAAMG,OACR,OAAOH,EAGT,IAAMI,EAASJ,EAAMK,QAAQC,MAC3B,SAACC,GAAM,OAAAA,EAAEC,MAAQP,EAAOQ,QAAQC,SAAS,IAG3C,OAAKN,EAIE,CACLC,QAASL,EAAMK,QACfM,kBAAmBX,EAAMW,kBACzBR,OAAQ,kBACRS,mBAAoB,CAClBV,KAAME,EAAOF,KACbW,OAAMT,GAERU,iBAAkBC,EAAuBA,wBAACC,QACxC,SAACC,GAAM,OAAAA,EAAEf,OAASE,EAAOF,SAZpBF,EAiBX,IAAK,gBACH,GAAqB,oBAAjBA,EAAMG,OACR,OAAOH,EAGT,IAAMkB,EAAWH,EAAuBA,wBAACT,MACvC,SAACW,GAAM,OAAAA,EAAET,MAAQP,EAAOQ,QAAQU,WAAW,IAG7C,OAAKD,EAIDA,EAAShB,OAASF,EAAMY,mBAAmBC,OAAOX,KAC7CF,EAGkB,SAAvBkB,EAASE,WACXpB,EAAMW,kBAAkB,CACtBT,KAAM,MACNO,QAAS,CACPY,UAAW,CACTR,OAAQb,EAAMY,mBAAmBC,OACjCK,SAAQA,EACRI,MAAO,CACLpB,KAAM,YAMP,CACLG,QAASL,EAAMK,QACfM,kBAAmBX,EAAMW,kBACzBR,OAAQ,sBAIL,CACLE,QAASL,EAAMK,QACfM,kBAAmBX,EAAMW,kBACzBR,OAAQ,oBACRS,mBAAoB,CAClBV,KAAMF,EAAMY,mBAAmBC,OAAOX,KACtCW,OAAQb,EAAMY,mBAAmBC,OACjCK,SAAQA,IAnCHlB,EAwCX,IAAK,aACH,MAAqB,sBAAjBA,EAAMG,OACDH,GAGTA,EAAMW,kBAAkB,CACtBT,KAAM,MACNO,QAAS,CACPY,UAAW,CACTR,OAAQb,EAAMY,mBAAmBC,OACjCK,SAAUlB,EAAMY,mBAAmBM,SACnCI,MAAOrB,EAAOQ,YAKb,CACLJ,QAASL,EAAMK,QACfM,kBAAmBX,EAAMW,kBACzBR,OAAQ,sBAIZ,IAAK,kBAQH,OAPAH,EAAMW,kBAAkB,CACtBT,KAAM,SACNO,QAAS,CACPc,MAAOtB,EAAOQ,QAAQc,SAInBvB,EAGT,IAAK,QACH,MAAO,CACLK,QAASL,EAAMK,QACfM,kBAAmBX,EAAMW,kBACzBR,OAAQ,qBAIZ,IAAK,gBACH,MAAO,CACLE,QAASJ,EAAOQ,QAAQJ,QACxBM,kBAAmBX,EAAMW,kBACzBR,OAAQ,qBAIZ,IAAK,sBACH,MAEoB,mBAAhBH,EAAMG,QACU,qBAAhBH,EAAMG,OAGDH,EAGF,CACLK,QAASL,EAAMK,QACfM,kBAAmBX,EAAMW,kBACzBR,OAAQ,qBAIZ,IAAK,wBACH,MAAqB,sBAAjBH,EAAMG,OACDH,EAGF,CACLK,QAASL,EAAMK,QACfM,kBAAmBX,EAAMW,kBACzBR,OAAQ,kBACRS,mBAAoB,CAClBV,KAAMF,EAAMY,mBAAmBC,OAAOX,KACtCW,OAAQb,EAAMY,mBAAmBC,QAEnCC,iBAAkBC,EAAAA,wBAAwBC,QACxC,SAACC,GAAM,OAAAA,EAAEf,OAASF,EAAMY,mBAAmBC,OAAOX,IAA3C,KAKjB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("./condition-input-management/context.js");require("react");var n=require("../../../node_modules/react-icons/ti/index.js");function a(a){var o=t.useConditionInputAction().deleteCondition;return e.jsxs("div",{className:"flex items-center gap-2 w-fit px-2 border-2 border-sky-600 rounded shadow",children:[e.jsx("p",{className:"whitespace-nowrap",children:r(a.condition)}),e.jsx("div",{children:e.jsx(n.TiDeleteOutline,{className:"bg-white hover:bg-slate-300 rounded-full cursor-pointer",onClick:function(){return o(a.index)}})})]})}function r(e){var t;switch(e.input.type){case"none":return"".concat(e.target.label," ").concat(e.operator.label);case"single string":case"single number":case"single date":return"".concat(e.target.label," ").concat(e.operator.label," ").concat(e.input.payload.value);case"range string":case"range number":case"range date":return"".concat(e.target.label," ").concat(e.operator.label," ").concat(e.input.payload.from," ~ ").concat(e.input.payload.to);case"select":if("select"!==e.target.type)throw new Error("type error");var n=e.input.payload.value;return"".concat(e.target.label," ").concat(e.operator.label," ").concat(null===(t=e.target.options.find((function(e){return e.value===n})))||void 0===t?void 0:t.label);case"multi select":return"".concat(e.target.label," ").concat(e.operator.label," ").concat(e.input.payload.value.join(", "))}}exports.ConditionList=function(t){return e.jsx("div",{className:"flex gap-1",children:t.conditions.map((function(t,n){return e.jsx(a,{index:n,condition:t},n)}))})};
|
|
3
|
+
//# sourceMappingURL=condition-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"condition-list.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("../../select-box/index.js"),i=require("./condition-input-management/context.js"),o=require("../id-generator/context.js"),r=require("../../../node_modules/react-icons/ti/index.js");function a(){var t=o.useIdGenerator().generateId,r=i.useConditionInputState().targets,a=i.useConditionInputAction().inputTarget;return e.jsx(n.SelectBox,{id:t("TargetInput"),onSelect:function(e){a(e)},options:r.map((function(e){return{value:e.key,label:e.label}})),placeholder:"Select target",no_appearance:!0,no_icon:!0})}function u(){var t=o.useIdGenerator().generateId,r=i.useConditionInputState(),a=i.useConditionInputAction(),u=a.inputOperator,l=a.removeInputedTarget;if("inputted target"!==r.status)return null;var s=r.inputtingCondition.target,p=r.useableOperators;return e.jsxs(e.Fragment,{children:[e.jsx(d,{label:s.label,onClickDelete:function(){l()}}),e.jsx("div",{className:"w-full min-w-64",children:e.jsx(n.SelectBox,{id:t("OperatorInput"),onSelect:function(e){u(e),setTimeout((function(){var e=document.getElementById(t("ValueInput"));e&&e.focus()}),10)},options:p.map((function(e){return{value:e.key,label:e.label}})),defaultIsOpen:!0,placeholder:"Select operator",no_appearance:!0,no_icon:!0})})]})}function l(t){var n=i.useConditionInputState(),o=i.useConditionInputAction(),r=o.removeInputedOperator,a=o.removeInputedTarget;if("inputted operator"!==n.status)return null;var u=n.inputtingCondition.target,l=n.inputtingCondition.operator;return e.jsxs(e.Fragment,{children:[e.jsx(d,{label:u.label,onClickDelete:function(){a()}}),e.jsx(d,{label:l.label,onClickDelete:function(){r()}}),"single string"===n.inputtingCondition.operator.inputType?e.jsx(s,{inputType:"single string",size:t.size}):"single number"===n.inputtingCondition.operator.inputType?e.jsx(p,{inputType:"single number",size:t.size}):"select"===n.inputtingCondition.operator.inputType?e.jsx(c,{inputType:"select",options:"select"===n.inputtingCondition.target.type?n.inputtingCondition.target.options:[]}):console.error("Not implemented")]})}function s(n){var r=o.useIdGenerator().generateId,a=t.useState(""),u=a[0],l=a[1],s=i.useConditionInputAction().inputValue;return e.jsx("input",{id:r("ValueInput"),className:"no_appearance w-full min-w-64 border-none px-2 py-1 focus:outline-none focus-visible:outline-none bg-transparent ".concat("small"===n.size?"text-sm":"large"===n.size?"text-lg":""),type:"text",placeholder:"Search text",value:u,onChange:function(e){l(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(s({type:n.inputType,payload:{value:u}}),l(""))}})}function p(n){var r=o.useIdGenerator().generateId,a=t.useState(""),u=a[0],l=a[1],s=i.useConditionInputAction().inputValue;return e.jsx("input",{id:r("ValueInput"),className:"no_appearance w-full min-w-64 border-none px-2 py-1 focus:outline-none focus-visible:outline-none bg-transparent ".concat("small"===n.size?"text-sm":"large"===n.size?"text-lg":""),type:"text",placeholder:"Search text",value:u,onChange:function(e){l(e.target.value)},onKeyDown:function(e){"Enter"===e.key&&(s({type:n.inputType,payload:{value:Number(u)}}),l(""))}})}function c(t){var r=i.useConditionInputAction().inputValue,a=o.useIdGenerator().generateId;return e.jsx("div",{className:"w-full min-w-64",children:e.jsx(n.SelectBox,{id:a("ValueInput"),onSelect:function(e){r({type:t.inputType,payload:{value:e}})},options:t.options,defaultIsOpen:!0,placeholder:"Select value",no_appearance:!0,no_icon:!0})})}function d(t){return e.jsxs("div",{className:"flex items-center gap-2 w-fit px-2 border rounded bg-slate-100",children:[e.jsx("p",{className:"whitespace-nowrap",children:t.label}),t.onClickDelete&&e.jsx("div",{children:e.jsx(r.TiDeleteOutline,{className:"bg-white hover:bg-slate-300 rounded-full cursor-pointer",onClick:t.onClickDelete})})]})}exports.SearchBarInputForm=function(t){switch(i.useConditionInputState().status){case"waiting for input":return e.jsx(a,{});case"inputted target":return e.jsx(u,{});case"inputted operator":return e.jsx(l,{size:t.size})}};
|
|
3
|
+
//# sourceMappingURL=input-form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-form.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../src/search-bar/id-generator/context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport { TIdGeneratorContext } from \"./type\";\n\nexport const IdGeneratorContext = createContext<TIdGeneratorContext | null>(\n null\n);\n\nexport function useIdGenerator() {\n const context = useContext(IdGeneratorContext);\n\n if (!context) {\n throw new Error(\"useIdGenerator must be used within a IdGeneratorProvider\");\n }\n\n return context;\n}\n"],"names":["IdGeneratorContext","createContext","context","useContext","Error"],"mappings":"oCAGaA,EAAqBC,EAAaA,cAC7C,qEAIA,IAAMC,EAAUC,aAAWH,GAE3B,IAAKE,EACH,MAAM,IAAIE,MAAM,4DAGlB,OAAOF,CACT"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("./context.js");exports.IdGeneratorProvider=function(n){var c=r.useMemo((function(){return{generateId:function(e){return"".concat(n.id,":").concat(e)}}}),[]);return e.jsx(t.IdGeneratorContext.Provider,{value:c,children:n.children})};
|
|
3
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var e=require("../../node_modules/tslib/tslib.es6.js"),r=require("react/jsx-runtime"),n=require("./parts/input-area.js"),i=require("react"),o=require("./id/provider.js"),t=require("./lib/id-generator.js"),s=require("./parts/frame.js"),a=require("./options-window/context.js"),u=require("./provider.js");function c(e){var u=a.useOptionsWindowActions(),c=u.openOptionsWindow,p=u.closeOptionsWindow,d=i.useCallback((function(){c(t.IdGenerator.generateIdSelectBoxInputArea(e.id),e.options,e.onSelect)}),[e.id,e.options,e.onSelect]),l=i.useCallback((function(){p()}),[]);return i.useEffect((function(){e.defaultIsOpen&&d()}),[e.defaultIsOpen]),r.jsx(o.IdProvider,{id:e.id,children:r.jsx(s.SelectBoxFrame,{open:d,close:l,no_icon:e.no_icon,children:r.jsx(n.InputArea,{id:e.id,value:e.value,open:d,close:l,inputRef:e.inputRef,options:e.options,no_appearance:e.no_appearance,placeholder:e.placeholder})})})}exports.SelectBox=function(n){return r.jsx(u.SelectBoxProvider,{children:r.jsx(c,e.__assign({},n))})};
|
|
2
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("./context.js"),o=require("../id/provider.js"),r=require("../lib/id-generator.js");exports.OptionsArea=function(){var i=o.useIdContext(),s=n.useOptionsWindow(),a=s.state,l=s.actions,u=t.useState(""),c=u[0],d=u[1],f=t.useState(void 0),p=f[0],v=f[1],g=a.isOpen?0===a.options.length?void 0:"number"==typeof p&&p<a.options.length&&p>=0?a.options[p].value:void 0:void 0;if(t.useEffect((function(){if(a.isOpen){var e=document.getElementById(r.IdGenerator.generateIdSelectBoxOption(i,null!=g?g:""));if(!e)return;e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}else v(void 0)}),[a]),t.useEffect((function(){if(a.isOpen){var e=function(e){if("ArrowDown"===e.key)e.preventDefault(),v((function(e){return"number"==typeof e?Math.min(e+1,a.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===a.options.length||a.options.length<=p)return;var t=a.options[p].value;if(!t)return;d(t),a.onSelect(t),l.closeOptionsWindow()}};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}}),[a,p,v]),!a.isOpen)return e.jsx(e.Fragment,{});var m=document.getElementById(a.selectBoxId);if(!m)return e.jsx(e.Fragment,{});var h=m.getBoundingClientRect(),y=window.scrollY+h.top+h.height,b=window.scrollX+h.left;return e.jsx("div",{id:"ReactUI:SelectBox:OptionsArea",className:"absolute min-w-fit max-h-[40vh] overflow-auto border border-gray-300 z-10",style:{top:y,left:b},children:a.options.map((function(t){var n,o;return e.jsx("div",{id:r.IdGenerator.generateIdSelectBoxOption(i,null!==(n=t.value)&&void 0!==n?n:""),className:"hover:bg-gray-200 px-2 py-1 ".concat("string"==typeof g?g===t.value?"bg-gray-100":"bg-white":c===t.value?"bg-gray-100":"bg-white"),onClick:function(){a.onSelect(t.value),l.closeOptionsWindow()},children:null!==(o=t.searchLabel)&&void 0!==o?o:t.label},t.value)}))})};
|
|
2
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../../../src/select-box/options-window/component.tsx"],"sourcesContent":["import { useEffect, 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\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\n optionElement.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"nearest\",\n });\n } else {\n setSelectingIndex(undefined);\n }\n }, [state]);\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 if (!state.isOpen) return <></>;\n\n // state.selectBoxIdのElementの直下に表示する\n const selectBoxElement = document.getElementById(state.selectBoxId);\n\n if (!selectBoxElement) return <></>;\n\n const rect = selectBoxElement.getBoundingClientRect();\n let top = window.scrollY + rect.top + rect.height;\n let left = window.scrollX + rect.left;\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={{ top, left }}\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","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","_jsx","selectBoxElement","selectBoxId","rect","getBoundingClientRect","top","window","scrollY","height","left","scrollX","jsx","className","style","children","map","option","concat","onClick","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,GAIlCI,EAAiBV,EAAMW,OACA,IAAzBX,EAAMY,QAAQC,YACZN,EAC0B,iBAAnBC,GACPA,EAAiBR,EAAMY,QAAQC,QAC/BL,GAAkB,EAClBR,EAAMY,QAAQJ,GAAgBJ,WAC9BG,OACFA,EA+DJ,GA7DAO,EAAAA,WAAU,WACR,GAAId,EAAMW,OAAQ,CAChB,IAAMI,EAAgBC,SAASC,eAC7BC,EAAWA,YAACC,0BAA0BvB,EAAIc,QAAAA,EAAkB,KAG9D,IAAKK,EAAe,OAEpBA,EAAcK,eAAe,CAC3BC,SAAU,SACVC,MAAO,UACPC,OAAQ,WAEX,MACCd,OAAkBF,EAEtB,GAAG,CAACP,IAEJc,EAAAA,WAAU,WACR,GAAId,EAAMW,OAAQ,CAChB,IAAMa,EAAgB,SAACC,GACrB,GAAc,cAAVA,EAAEC,IACJD,EAAEE,iBACFlB,GAAkB,SAACmB,GACjB,MAAgB,iBAATA,EACHC,KAAKC,IAAIF,EAAO,EAAG5B,EAAMY,QAAQC,OAAS,GAC1C,CAFJ,SAIG,GAAc,YAAVY,EAAEC,IACXD,EAAEE,iBACFlB,GAAkB,SAACmB,GACjB,MAAgB,iBAATA,EAAoBC,KAAKE,IAAIH,EAAO,EAAG,GAAK,CAAnD,SAEG,GAAc,UAAVH,EAAEC,MACXD,EAAEE,iBAC4B,iBAAnBnB,GAA6B,CACtC,GAC2B,IAAzBR,EAAMY,QAAQC,QACdb,EAAMY,QAAQC,QAAUL,EAExB,OAEF,IAAMwB,EAAQhC,EAAMY,QAAQJ,GAAgBJ,MAE5C,IAAK4B,EAAO,OAEZ3B,EAAS2B,GACThC,EAAMiC,SAASD,GACf/B,EAAQiC,oBACT,CAEL,EAIA,OAFAlB,SAASmB,iBAAiB,UAAWX,GAE9B,WACLR,SAASoB,oBAAoB,UAAWZ,EAC1C,CACD,CACF,GAAE,CAACxB,EAAOQ,EAAgBC,KAEtBT,EAAMW,OAAQ,OAAO0B,qBAG1B,IAAMC,EAAmBtB,SAASC,eAAejB,EAAMuC,aAEvD,IAAKD,EAAkB,OAAOD,qBAE9B,IAAMG,EAAOF,EAAiBG,wBAC1BC,EAAMC,OAAOC,QAAUJ,EAAKE,IAAMF,EAAKK,OACvCC,EAAOH,OAAOI,QAAUP,EAAKM,KAEjC,OACET,EACEW,IAAA,MAAA,CAAApD,GAAI,gCACJqD,UAAU,4EACVC,MAAO,CAAER,IAAGA,EAAEI,KAAIA,GAEjBK,SAAAnD,EAAMY,QAAQwC,KAAI,SAACC,WAAW,OAC7BhB,EACEW,IAAA,MAAA,CAAApD,GAAIsB,EAAAA,YAAYC,0BAA0BvB,EAAgB,QAAZE,EAAAuD,EAAOjD,aAAK,IAAAN,EAAAA,EAAI,IAC9DmD,UAAW,+BACTK,OAA0B,iBAAnB5C,EACHA,IAAmB2C,EAAOjD,MACxB,cACA,WACFA,IAAUiD,EAAOjD,MACjB,cACA,YAGNmD,QAAS,WACPvD,EAAMiC,SAASoB,EAAOjD,OACtBH,EAAQiC,oBACV,EAECiB,SAAsB,QAAtBjD,EAAAmD,EAAOG,mBAAe,IAAAtD,EAAAA,EAAAmD,EAAOI,OANzBJ,EAAOjD,MAQf,KAGP"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("react"),e=t.createContext(null),n=t.createContext(null),o=function(){var n=t.useContext(e);if(null===n)throw new Error("useOptionsWindowState must be used within a SelectOptionsWindowProvider");return n},i=function(){var e=t.useContext(n);if(null===e)throw new Error("useOptionsWindowActions must be used within a SelectOptionsWindowProvider");return e};exports.OptionsWindowActionContext=n,exports.OptionsWindowStateContext=e,exports.useOptionsWindow=function(){return{state:o(),actions:i()}},exports.useOptionsWindowActions=i,exports.useOptionsWindowState=o;
|
|
2
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../src/select-box/options-window/context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport {\n TOptionsWindowActionContext,\n TOptionsWindowStateContext,\n} from \"./type\";\n\nexport const OptionsWindowStateContext =\n createContext<TOptionsWindowStateContext | null>(null);\n\nexport const OptionsWindowActionContext =\n createContext<TOptionsWindowActionContext | null>(null);\n\nexport const useOptionsWindowState = () => {\n const optionsState = useContext(OptionsWindowStateContext);\n\n if (optionsState === null) {\n throw new Error(\n \"useOptionsWindowState must be used within a SelectOptionsWindowProvider\"\n );\n }\n return optionsState;\n};\n\nexport const useOptionsWindowActions = () => {\n const optionsActions = useContext(OptionsWindowActionContext);\n\n if (optionsActions === null) {\n throw new Error(\n \"useOptionsWindowActions must be used within a SelectOptionsWindowProvider\"\n );\n }\n\n return optionsActions;\n};\n\nexport const useOptionsWindow = () => {\n return {\n state: useOptionsWindowState(),\n actions: useOptionsWindowActions(),\n };\n};\n"],"names":["OptionsWindowStateContext","createContext","OptionsWindowActionContext","useOptionsWindowState","optionsState","useContext","Error","useOptionsWindowActions","optionsActions","state","actions"],"mappings":"oCAMaA,EACXC,EAAaA,cAAoC,MAEtCC,EACXD,EAAaA,cAAqC,MAEvCE,EAAwB,WACnC,IAAMC,EAAeC,aAAWL,GAEhC,GAAqB,OAAjBI,EACF,MAAM,IAAIE,MACR,2EAGJ,OAAOF,CACT,EAEaG,EAA0B,WACrC,IAAMC,EAAiBH,aAAWH,GAElC,GAAuB,OAAnBM,EACF,MAAM,IAAIF,MACR,6EAIJ,OAAOE,CACT,oGAEgC,WAC9B,MAAO,CACLC,MAAON,IACPO,QAASH,IAEb"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("../../../node_modules/tslib/tslib.es6.js"),t=require("react"),o=require("./reducer.js");exports.useOptionsWindowHook=function(){var s=t.useReducer(o.optionsWindowReducer,{isOpen:!1}),n=s[0],r=s[1];return{state:t.useMemo((function(){return n.isOpen?e.__assign(e.__assign({},n),{options:n.options.filter((function(e){return e.searchText?e.searchText.toLowerCase().includes(n.searchText.toLowerCase()):e.searchLabel?e.searchLabel.toLowerCase().includes(n.searchText.toLowerCase()):e.label.toLowerCase().includes(n.searchText.toLowerCase())}))}):n}),[n]),actions:t.useMemo((function(){return{openOptionsWindow:function(e,t,o,s){r({type:"open",payload:{selectBoxId:e,options:t,onSelect:o,searchText:null==s?void 0:s.searchText,defaultValue:null==s?void 0:s.defaultValue}})},setSearchText:function(e){r({type:"setSearchText",payload:{searchText:e}})},closeOptionsWindow:function(){r({type:"close"})}}}),[])}};
|
|
2
|
+
//# sourceMappingURL=hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.js","sources":["../../../../../src/select-box/options-window/hook.ts"],"sourcesContent":["import { useMemo, useReducer } from \"react\";\nimport { Options, TOptionsWindowHook } from \"./type\";\nimport { optionsWindowReducer } from \"./reducer\";\n\nexport const useOptionsWindowHook: TOptionsWindowHook = () => {\n const [state, dispatch] = useReducer(optionsWindowReducer, {\n isOpen: false,\n });\n\n const retrunState = useMemo(() => {\n if (!state.isOpen) {\n return state;\n } else {\n return {\n ...state,\n options: state.options.filter((option) => {\n if (option.searchText) {\n return option.searchText\n .toLowerCase()\n .includes(state.searchText.toLowerCase());\n } else if (option.searchLabel) {\n return option.searchLabel\n .toLowerCase()\n .includes(state.searchText.toLowerCase());\n } else {\n return option.label\n .toLowerCase()\n .includes(state.searchText.toLowerCase());\n }\n }),\n };\n }\n }, [state]);\n\n const returnActions = useMemo(\n () => ({\n openOptionsWindow: (\n selectBoxId: string,\n options: Options[],\n onSelect: (value: string) => void,\n option?: { defaultValue?: string; searchText?: string }\n ) => {\n dispatch({\n type: \"open\",\n payload: {\n selectBoxId,\n options,\n onSelect,\n searchText: option?.searchText,\n defaultValue: option?.defaultValue,\n },\n });\n },\n setSearchText: (searchText: string) => {\n dispatch({\n type: \"setSearchText\",\n payload: {\n searchText,\n },\n });\n },\n closeOptionsWindow: () => {\n dispatch({\n type: \"close\",\n });\n },\n }),\n []\n );\n\n return {\n state: retrunState,\n actions: returnActions,\n };\n};\n"],"names":["_a","useReducer","optionsWindowReducer","isOpen","state","dispatch","useMemo","__assign","options","filter","option","searchText","toLowerCase","includes","searchLabel","label","actions","openOptionsWindow","selectBoxId","onSelect","type","payload","defaultValue","setSearchText","closeOptionsWindow"],"mappings":"iJAIwD,WAChD,IAAAA,EAAoBC,EAAUA,WAACC,uBAAsB,CACzDC,QAAQ,IADHC,EAAKJ,EAAA,GAAEK,OAiEd,MAAO,CACLD,MA9DkBE,EAAAA,SAAQ,WAC1B,OAAKF,EAAMD,OAIJI,WAAAA,EAAAA,SAAA,CAAA,EAAAH,GACH,CAAAI,QAASJ,EAAMI,QAAQC,QAAO,SAACC,GAC7B,OAAIA,EAAOC,WACFD,EAAOC,WACXC,cACAC,SAAST,EAAMO,WAAWC,eACpBF,EAAOI,YACTJ,EAAOI,YACXF,cACAC,SAAST,EAAMO,WAAWC,eAEtBF,EAAOK,MACXH,cACAC,SAAST,EAAMO,WAAWC,cAEhC,MAlBIR,CAqBX,GAAG,CAACA,IAwCFY,QAtCoBV,WACpB,WAAM,MAAC,CACLW,kBAAmB,SACjBC,EACAV,EACAW,EACAT,GAEAL,EAAS,CACPe,KAAM,OACNC,QAAS,CACPH,YAAWA,EACXV,QAAOA,EACPW,SAAQA,EACRR,WAAYD,aAAA,EAAAA,EAAQC,WACpBW,aAAcZ,aAAA,EAAAA,EAAQY,eAG3B,EACDC,cAAe,SAACZ,GACdN,EAAS,CACPe,KAAM,gBACNC,QAAS,CACPV,WAAUA,IAGf,EACDa,mBAAoB,WAClBnB,EAAS,CACPe,KAAM,SAET,EA9BG,GAgCN,IAOJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("./context.js"),r=require("./hook.js");exports.SelectOptionsWindowProvider=function(i){var o=r.useOptionsWindowHook(),n=o.state,s=o.actions;return e.jsx(t.OptionsWindowStateContext.Provider,{value:n,children:e.jsx(t.OptionsWindowActionContext.Provider,{value:s,children:i.children})})};
|
|
2
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sources":["../../../../../src/select-box/options-window/provider.tsx"],"sourcesContent":["import {\n OptionsWindowActionContext,\n OptionsWindowStateContext,\n} from \"./context\";\nimport { useOptionsWindowHook } from \"./hook\";\n\nexport function SelectOptionsWindowProvider(props: {\n children: React.ReactNode;\n}) {\n const { state, actions } = useOptionsWindowHook();\n\n return (\n <OptionsWindowStateContext.Provider value={state}>\n <OptionsWindowActionContext.Provider value={actions}>\n {props.children}\n </OptionsWindowActionContext.Provider>\n </OptionsWindowStateContext.Provider>\n );\n}\n"],"names":["props","_a","useOptionsWindowHook","state","actions","_jsx","OptionsWindowStateContext","Provider","value","children","OptionsWindowActionContext"],"mappings":"qIAMM,SAAsCA,GAGpC,IAAAC,EAAqBC,EAAoBA,uBAAvCC,EAAKF,EAAAE,MAAEC,EAAOH,EAAAG,QAEtB,OACEC,EAAAA,IAACC,EAAAA,0BAA0BC,UAASC,MAAOL,EAAKM,SAC9CJ,MAACK,EAAAA,2BAA2BH,SAAQ,CAACC,MAAOJ,EAAOK,SAChDT,EAAMS,YAIf"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("../../../node_modules/tslib/tslib.es6.js");exports.optionsWindowReducer=function(s,a){switch(a.type){case"open":return{isOpen:!0,selectBoxId:a.payload.selectBoxId,options:a.payload.options,searchText:a.payload.searchText||"",onSelect:a.payload.onSelect,selectingValue:a.payload.defaultValue};case"setSearchText":return s.isOpen?s.searchText===a.payload.searchText?s:e.__assign(e.__assign({},s),{searchText:a.payload.searchText}):s;case"close":return s.isOpen?{isOpen:!1}:s}};
|
|
2
|
+
//# sourceMappingURL=reducer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.js","sources":["../../../../../src/select-box/options-window/reducer.ts"],"sourcesContent":["import { TOptionsWindowReducer } from \"./type\";\n\nexport const optionsWindowReducer: TOptionsWindowReducer = (state, action) => {\n switch (action.type) {\n case \"open\":\n return {\n isOpen: true,\n selectBoxId: action.payload.selectBoxId,\n options: action.payload.options,\n searchText: action.payload.searchText || \"\",\n onSelect: action.payload.onSelect,\n selectingValue: action.payload.defaultValue,\n };\n case \"setSearchText\":\n if (!state.isOpen) return state;\n\n if (state.searchText === action.payload.searchText) return state;\n\n return {\n ...state,\n searchText: action.payload.searchText,\n };\n case \"close\":\n if (!state.isOpen) return state;\n\n return {\n isOpen: false,\n };\n }\n};\n"],"names":["state","action","type","isOpen","selectBoxId","payload","options","searchText","onSelect","selectingValue","defaultValue","__assign"],"mappings":"oGAE2D,SAACA,EAAOC,GACjE,OAAQA,EAAOC,MACb,IAAK,OACH,MAAO,CACLC,QAAQ,EACRC,YAAaH,EAAOI,QAAQD,YAC5BE,QAASL,EAAOI,QAAQC,QACxBC,WAAYN,EAAOI,QAAQE,YAAc,GACzCC,SAAUP,EAAOI,QAAQG,SACzBC,eAAgBR,EAAOI,QAAQK,cAEnC,IAAK,gBACH,OAAKV,EAAMG,OAEPH,EAAMO,aAAeN,EAAOI,QAAQE,WAAmBP,EAGtDW,WAAAA,EAAAA,SAAA,CAAA,EAAAX,IACHO,WAAYN,EAAOI,QAAQE,aANHP,EAQ5B,IAAK,QACH,OAAKA,EAAMG,OAEJ,CACLA,QAAQ,GAHgBH,EAMhC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("../id/provider.js"),i=require("../lib/id-generator.js"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("../id/provider.js"),i=require("../lib/id-generator.js"),n=require("../../../node_modules/react-icons/md/index.js"),t=require("../options-window/context.js");require("react"),exports.SelectBoxFrame=function(o){var s=r.useIdContext(),a=t.useOptionsWindow().state;return e.jsxs("div",{id:i.IdGenerator.generateIdSelectBoxFrame(s),className:"relative w-full",children:[e.jsx("div",{onClick:function(e){a.isOpen||o.open()},children:o.children}),!o.no_icon&&e.jsx("div",{className:"absolute grid place-items-center h-full right-1 top-0",onClick:function(e){e.stopPropagation(),a.isOpen?o.close():o.open()},children:e.jsx(n.MdOutlineKeyboardArrowLeft,{className:"duration-300 ".concat(a.isOpen?"-rotate-90":"")})})]})};
|
|
2
2
|
//# sourceMappingURL=frame.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame.js","sources":["../../../../../src/select-box/parts/frame.tsx"],"sourcesContent":["import { useIdContext } from \"../id/provider\";\nimport { IdGenerator } from \"../lib\";\nimport { MdOutlineKeyboardArrowLeft } from \"react-icons/md\";\n\ninterface IPropsSelectBoxFrame {\n
|
|
1
|
+
{"version":3,"file":"frame.js","sources":["../../../../../src/select-box/parts/frame.tsx"],"sourcesContent":["import { useIdContext } from \"../id/provider\";\nimport { IdGenerator } from \"../lib\";\nimport { MdOutlineKeyboardArrowLeft } from \"react-icons/md\";\nimport { useOptionsWindow } from \"../options-window\";\n\ninterface IPropsSelectBoxFrame {\n open: () => void;\n close: () => void;\n children: React.ReactNode;\n no_icon?: boolean;\n}\n\nexport function SelectBoxFrame(props: IPropsSelectBoxFrame) {\n const id = useIdContext();\n const { state } = useOptionsWindow();\n\n return (\n <div\n id={IdGenerator.generateIdSelectBoxFrame(id)}\n className=\"relative w-full\"\n >\n <div\n onClick={(e) => {\n if (!state.isOpen) {\n props.open();\n }\n }}\n >\n {props.children}\n </div>\n {!props.no_icon && (\n <div\n className=\"absolute grid place-items-center h-full right-1 top-0\"\n onClick={(e) => {\n e.stopPropagation();\n if (state.isOpen) {\n props.close();\n } else {\n props.open();\n }\n }}\n >\n <MdOutlineKeyboardArrowLeft\n className={`duration-300 ${state.isOpen ? \"-rotate-90\" : \"\"}`}\n />\n </div>\n )}\n </div>\n );\n}\n"],"names":["props","id","useIdContext","state","useOptionsWindow","_jsxs","IdGenerator","generateIdSelectBoxFrame","className","children","_jsx","onClick","e","isOpen","open","no_icon","stopPropagation","close","MdOutlineKeyboardArrowLeft","concat"],"mappings":"gQAYM,SAAyBA,GAC7B,IAAMC,EAAKC,EAAAA,eACHC,EAAUC,2BAElB,OACEC,EAAAA,KACE,MAAA,CAAAJ,GAAIK,EAAWA,YAACC,yBAAyBN,GACzCO,UAAU,kBAAiBC,SAAA,CAE3BC,aACEC,QAAS,SAACC,GACHT,EAAMU,QACTb,EAAMc,MAET,EAAAL,SAEAT,EAAMS,YAEPT,EAAMe,SACNL,EAAAA,IAAA,MAAA,CACEF,UAAU,wDACVG,QAAS,SAACC,GACRA,EAAEI,kBACEb,EAAMU,OACRb,EAAMiB,QAENjB,EAAMc,QAETL,SAEDC,EAAAA,IAACQ,EAAAA,2BACC,CAAAV,UAAW,gBAAgBW,OAAAhB,EAAMU,OAAS,aAAe,UAMrE"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),n=require("react"),t=require("../id/provider.js"),o=require("../lib/id-generator.js"),r=require("../options-window/context.js");exports.InputArea=function(a){var i,u,s,c=t.useIdContext(),d=r.useOptionsWindow(),l=d.state,f=d.actions,p=n.useState(""),v=p[0],w=p[1],x=n.useMemo((function(){return a.options.filter((function(e){return e.searchText?e.searchText.toLowerCase().includes(v.toLowerCase()):e.searchLabel?e.searchLabel.toLowerCase().includes(v.toLowerCase()):e.label.toLowerCase().includes(v.toLowerCase())}))}),[a.options,v]);n.useEffect((function(){l.isOpen&&f.setSearchText(l.searchText)}),[l]),n.useEffect((function(){var e=function(e){if(l.isOpen){var n=document.getElementById(o.IdGenerator.generateIdSelectBoxFrame(a.id)),t=document.getElementById("ReactUI:SelectBox:OptionsArea"),r=e.target;r instanceof Node&&(null==n?void 0:n.contains(r))||r instanceof Node&&(null==t?void 0:t.contains(r))||(w(""),a.close())}};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}}),[l]),n.useEffect((function(){if(!l.isOpen){var e=document.getElementById(o.IdGenerator.generateIdSelectBoxInputArea(a.id));if(e){var n=function(e){"ArrowDown"===e.key&&(e.preventDefault(),a.open())};return e.addEventListener("keydown",n),function(){e.removeEventListener("keydown",n)}}}}),[l,x]);var m=null!==(u=null===(i=a.options.find((function(e){return e.value===a.value})))||void 0===i?void 0:i.label)&&void 0!==u?u:"";return e.jsx("input",{id:o.IdGenerator.generateIdSelectBoxInputArea(c),ref:a.inputRef,className:"px-2 py-1 ".concat(a.no_appearance?"no_appearance border-none focus:outline-none focus-visible:outline-none bg-transparent w-full":"border border-gray-300 w-full"),type:"text",placeholder:""===m?null!==(s=a.placeholder)&&void 0!==s?s:"選択してください":m,value:l.isOpen?l.searchText:m,onChange:function(e){e.preventDefault(),f.setSearchText(e.target.value)}})};
|
|
3
3
|
//# sourceMappingURL=input-area.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react");require("./options-window/context.js");var i=require("./options-window/component.js"),n=require("./options-window/provider.js"),t=r.createContext(!1),o=function(){return r.useContext(t)};exports.SelectBoxProvider=function(r){return o()?e.jsx(e.Fragment,{children:r.children}):e.jsx(t.Provider,{value:!0,children:e.jsxs(n.SelectOptionsWindowProvider,{children:[r.children,e.jsx(i.OptionsArea,{})]})})};
|
|
3
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e="none",t="single string",n="single number",l="select",p=[{key:"string:eq",label:"=",type:"string",inputType:t},{key:"string:neq",label:"≠",type:"string",inputType:t},{key:"string:like",label:"like",type:"string",inputType:t},{key:"string:not_like",label:"not like",type:"string",inputType:t},{key:"string:is_null",label:"is empty",type:"string",inputType:e},{key:"string:is_not_null",label:"is not empty",type:"string",inputType:e},{key:"number:eq",label:"=",type:"number",inputType:n},{key:"number:neq",label:"≠",type:"number",inputType:n},{key:"number:gt",label:">",type:"number",inputType:n},{key:"number:lt",label:"<",type:"number",inputType:n},{key:"number:gte",label:"≧",type:"number",inputType:n},{key:"number:lte",label:"≦",type:"number",inputType:n},{key:"select:eq",label:"=",type:"select",inputType:l},{key:"select:neq",label:"≠",type:"select",inputType:l},{key:"select:is_null",label:"is empty",type:"select",inputType:e},{key:"select:is_not_null",label:"is not empty",type:"select",inputType:e}];exports.DEFAULT_SEARCH_OPERATOR=p,exports.NONE=e,exports.SELECT=l,exports.SINGLE_NUMBER=n,exports.SINGLE_STRING=t;
|
|
2
|
+
//# sourceMappingURL=constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.js","sources":["../../../../../src/share/search-operator/constant.ts"],"sourcesContent":["export const NONE = \"none\";\nexport const SINGLE_STRING = \"single string\";\nexport const SINGLE_NUMBER = \"single number\";\nexport const SINGLE_DATE = \"single date\";\nexport const RANGE_STRING = \"range string\";\nexport const RANGE_NUMBER = \"range number\";\nexport const RANGE_DATE = \"range date\";\nexport const SELECT = \"select\";\nexport const MULTI_SELECT = \"multi select\";\n\nexport const DEFAULT_SEARCH_OPERATOR = [\n {\n key: \"string:eq\",\n label: \"=\",\n type: \"string\",\n inputType: SINGLE_STRING,\n },\n {\n key: \"string:neq\",\n label: \"≠\",\n type: \"string\",\n inputType: SINGLE_STRING,\n },\n {\n key: \"string:like\",\n label: \"like\",\n type: \"string\",\n inputType: SINGLE_STRING,\n },\n {\n key: \"string:not_like\",\n label: \"not like\",\n type: \"string\",\n inputType: SINGLE_STRING,\n },\n // { key: \"string:in\", label: \"in\", type: \"string\" },\n // { key: \"string:not_in\", label: \"not in\", type: \"string\" },\n {\n key: \"string:is_null\",\n label: \"is empty\",\n type: \"string\",\n inputType: NONE,\n },\n {\n key: \"string:is_not_null\",\n label: \"is not empty\",\n type: \"string\",\n inputType: NONE,\n },\n {\n key: \"number:eq\",\n label: \"=\",\n type: \"number\",\n inputType: SINGLE_NUMBER,\n },\n {\n key: \"number:neq\",\n label: \"≠\",\n type: \"number\",\n inputType: SINGLE_NUMBER,\n },\n {\n key: \"number:gt\",\n label: \">\",\n type: \"number\",\n inputType: SINGLE_NUMBER,\n },\n {\n key: \"number:lt\",\n label: \"<\",\n type: \"number\",\n inputType: SINGLE_NUMBER,\n },\n {\n key: \"number:gte\",\n label: \"≧\",\n type: \"number\",\n inputType: SINGLE_NUMBER,\n },\n {\n key: \"number:lte\",\n label: \"≦\",\n type: \"number\",\n inputType: SINGLE_NUMBER,\n },\n {\n key: \"select:eq\",\n label: \"=\",\n type: \"select\",\n inputType: SELECT,\n },\n {\n key: \"select:neq\",\n label: \"≠\",\n type: \"select\",\n inputType: SELECT,\n },\n {\n key: \"select:is_null\",\n label: \"is empty\",\n type: \"select\",\n inputType: NONE,\n },\n {\n key: \"select:is_not_null\",\n label: \"is not empty\",\n type: \"select\",\n inputType: NONE,\n },\n // { key: \"date:eq\", label: \"=\", type: \"date\" },\n // { key: \"date:neq\", label: \"≠\", type: \"date\" },\n // { key: \"date:gt\", label: \">\", type: \"date\" },\n // { key: \"date:lt\", label: \"<\", type: \"date\" },\n // { key: \"date:gte\", label: \">=\", type: \"date\" },\n // { key: \"date:lte\", label: \"<=\", type: \"date\" },\n // { key: \"date:is_null\", label: \"is null\", type: \"date\" },\n // { key: \"date:is_not_null\", label: \"is not null\", type: \"date\" },\n] as const;\n\nexport type T_DEFAULT_SEARCH_OPERATOR =\n (typeof DEFAULT_SEARCH_OPERATOR)[number];\n\nexport type T_SEARCH_INPUT_TYPE = T_DEFAULT_SEARCH_OPERATOR[\"inputType\"];\n"],"names":["NONE","SINGLE_STRING","SINGLE_NUMBER","SELECT","DEFAULT_SEARCH_OPERATOR","key","label","type","inputType"],"mappings":"aAAO,IAAMA,EAAO,OACPC,EAAgB,gBAChBC,EAAgB,gBAKhBC,EAAS,SAGTC,EAA0B,CACrC,CACEC,IAAK,YACLC,MAAO,IACPC,KAAM,SACNC,UAAWP,GAEb,CACEI,IAAK,aACLC,MAAO,IACPC,KAAM,SACNC,UAAWP,GAEb,CACEI,IAAK,cACLC,MAAO,OACPC,KAAM,SACNC,UAAWP,GAEb,CACEI,IAAK,kBACLC,MAAO,WACPC,KAAM,SACNC,UAAWP,GAIb,CACEI,IAAK,iBACLC,MAAO,WACPC,KAAM,SACNC,UAAWR,GAEb,CACEK,IAAK,qBACLC,MAAO,eACPC,KAAM,SACNC,UAAWR,GAEb,CACEK,IAAK,YACLC,MAAO,IACPC,KAAM,SACNC,UAAWN,GAEb,CACEG,IAAK,aACLC,MAAO,IACPC,KAAM,SACNC,UAAWN,GAEb,CACEG,IAAK,YACLC,MAAO,IACPC,KAAM,SACNC,UAAWN,GAEb,CACEG,IAAK,YACLC,MAAO,IACPC,KAAM,SACNC,UAAWN,GAEb,CACEG,IAAK,aACLC,MAAO,IACPC,KAAM,SACNC,UAAWN,GAEb,CACEG,IAAK,aACLC,MAAO,IACPC,KAAM,SACNC,UAAWN,GAEb,CACEG,IAAK,YACLC,MAAO,IACPC,KAAM,SACNC,UAAWL,GAEb,CACEE,IAAK,aACLC,MAAO,IACPC,KAAM,SACNC,UAAWL,GAEb,CACEE,IAAK,iBACLC,MAAO,WACPC,KAAM,SACNC,UAAWR,GAEb,CACEK,IAAK,qBACLC,MAAO,eACPC,KAAM,SACNC,UAAWR"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react"),t=require("../edit/provider.js"),n=require("../sheet/providers.js"),o=require("../range/provider.js"),r=require("../id/provider.js");exports.useCell=function(i,u){var d,s,
|
|
1
|
+
"use strict";var e=require("react"),t=require("../edit/provider.js"),n=require("../sheet/providers.js"),o=require("../range/provider.js"),r=require("../id/provider.js");exports.useCell=function(i,u){var d,s,l=r.useTableIdGenerator(),a=o.useRangeActionContext(),c=a.startSelectRange,p=a.moveSelectRange,v=a.endSelectRange,m=t.useEditActionContext().startEditing,f=l.extractCellIndexFromId(i),g=f[0],x=f[1],I=n.useColumnsContext()[x],C=u[I.key],E="select"===I.type?null===(s=null===(d=I.options)||void 0===d?void 0:d.find((function(e){return e.value===C})))||void 0===s?void 0:s.label:C,b=e.useMemo((function(){return I.editable?E:I.render?I.render(C,u):E}),[I.editable,E,C,u]);return{type:!I.editable&&I.render?"component":I.type,component:b,onDoubleClick:function(e){e.preventDefault(),m()},onMouseDown:function(e){document.getElementById(l.getEditorId())||setTimeout((function(){c({rowIndex:g,colIndex:x});var e=function(t){t.preventDefault(),t.stopPropagation(),v(),document.removeEventListener("mouseup",e)};document.addEventListener("mouseup",e)}),0)},onMouseEnter:function(e){e.preventDefault(),e.stopPropagation(),p({rowIndex:g,colIndex:x})}}};
|
|
2
2
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sources":["../../../../../src/table/cell/hooks.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useEditActionContext } from \"../edit/provider\";\nimport { useColumnsContext } from \"../sheet/providers\";\nimport { DataObject, DataRecord, TColumnType } from \"../table/type\";\nimport { useRangeActionContext } from \"../range/provider\";\nimport { useTableIdGenerator } from \"../id\";\n\nexport function useCell(id: string, row: DataObject<DataRecord>) {\n const IdGenerator = useTableIdGenerator();\n const { startSelectRange, moveSelectRange, endSelectRange } =\n useRangeActionContext();\n const { startEditing } = useEditActionContext();\n const [rowIndex, colIndex] = IdGenerator.extractCellIndexFromId(id);\n const col = useColumnsContext()[colIndex];\n const value = row[col.key as string];\n\n const label =\n col.type === \"select\"\n ? col.options?.find((op) => op.value === value)?.label\n : value;\n\n const component = useMemo(() => {\n if (col.editable) {\n return label;\n } else {\n return col.render ? col.render(value as never, row) : label;\n }\n }, [col.editable, label, value, row]);\n\n const type: TColumnType | \"component\" =\n !col.editable && col.render ? \"component\" : col.type;\n\n const onDoubleClick: React.MouseEventHandler<HTMLDivElement> = (e) => {\n e.preventDefault();\n startEditing();\n };\n\n /**\n * onBlurよりも先に発火するため、onBlurでendEditingを呼ぶと\n * すぐにstartEditingが呼ばれてしまうため、setTimeoutで遅延させる\n * これにより、endEditingが先に呼ばれるようになる\n */\n const onMouseDown: React.MouseEventHandler<HTMLDivElement> = (e) => {\n setTimeout(() => {\n startSelectRange({ rowIndex, colIndex });\n\n const onMouseUp = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n endSelectRange();\n document.removeEventListener(\"mouseup\", onMouseUp);\n };\n\n document.addEventListener(\"mouseup\", onMouseUp);\n }, 0);\n };\n\n const onMouseEnter: React.MouseEventHandler<HTMLDivElement> = (e) => {\n e.preventDefault();\n e.stopPropagation();\n moveSelectRange({ rowIndex, colIndex });\n };\n\n return {\n type,\n component,\n onDoubleClick,\n onMouseDown,\n onMouseEnter,\n };\n}\n"],"names":["id","row","IdGenerator","useTableIdGenerator","_c","useRangeActionContext","startSelectRange","moveSelectRange","endSelectRange","startEditing","useEditActionContext","_d","extractCellIndexFromId","rowIndex","colIndex","col","useColumnsContext","value","key","label","type","_a","options","find","op","_b","component","useMemo","editable","render","onDoubleClick","e","preventDefault","onMouseDown","setTimeout","onMouseUp","stopPropagation","
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":["../../../../../src/table/cell/hooks.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useEditActionContext } from \"../edit/provider\";\nimport { useColumnsContext } from \"../sheet/providers\";\nimport { DataObject, DataRecord, TColumnType } from \"../table/type\";\nimport { useRangeActionContext } from \"../range/provider\";\nimport { useTableIdGenerator } from \"../id\";\n\nexport function useCell(id: string, row: DataObject<DataRecord>) {\n const IdGenerator = useTableIdGenerator();\n const { startSelectRange, moveSelectRange, endSelectRange } =\n useRangeActionContext();\n const { startEditing } = useEditActionContext();\n const [rowIndex, colIndex] = IdGenerator.extractCellIndexFromId(id);\n const col = useColumnsContext()[colIndex];\n const value = row[col.key as string];\n\n const label =\n col.type === \"select\"\n ? col.options?.find((op) => op.value === value)?.label\n : value;\n\n const component = useMemo(() => {\n if (col.editable) {\n return label;\n } else {\n return col.render ? col.render(value as never, row) : label;\n }\n }, [col.editable, label, value, row]);\n\n const type: TColumnType | \"component\" =\n !col.editable && col.render ? \"component\" : col.type;\n\n const onDoubleClick: React.MouseEventHandler<HTMLDivElement> = (e) => {\n e.preventDefault();\n startEditing();\n };\n\n /**\n * onBlurよりも先に発火するため、onBlurでendEditingを呼ぶと\n * すぐにstartEditingが呼ばれてしまうため、setTimeoutで遅延させる\n * これにより、endEditingが先に呼ばれるようになる\n */\n const onMouseDown: React.MouseEventHandler<HTMLDivElement> = (e) => {\n const element = document.getElementById(IdGenerator.getEditorId());\n\n if (!!element) {\n return;\n }\n\n setTimeout(() => {\n startSelectRange({ rowIndex, colIndex });\n\n const onMouseUp = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n endSelectRange();\n document.removeEventListener(\"mouseup\", onMouseUp);\n };\n\n document.addEventListener(\"mouseup\", onMouseUp);\n }, 0);\n };\n\n const onMouseEnter: React.MouseEventHandler<HTMLDivElement> = (e) => {\n e.preventDefault();\n e.stopPropagation();\n moveSelectRange({ rowIndex, colIndex });\n };\n\n return {\n type,\n component,\n onDoubleClick,\n onMouseDown,\n onMouseEnter,\n };\n}\n"],"names":["id","row","IdGenerator","useTableIdGenerator","_c","useRangeActionContext","startSelectRange","moveSelectRange","endSelectRange","startEditing","useEditActionContext","_d","extractCellIndexFromId","rowIndex","colIndex","col","useColumnsContext","value","key","label","type","_a","options","find","op","_b","component","useMemo","editable","render","onDoubleClick","e","preventDefault","onMouseDown","document","getElementById","getEditorId","setTimeout","onMouseUp","stopPropagation","removeEventListener","addEventListener","onMouseEnter"],"mappings":"yLAOgB,SAAQA,EAAYC,WAC5BC,EAAcC,EAAAA,sBACdC,EACJC,EAAAA,wBADMC,EAAgBF,EAAAE,iBAAEC,EAAeH,EAAAG,gBAAEC,EAAcJ,EAAAI,eAEjDC,EAAiBC,sCACnBC,EAAuBT,EAAYU,uBAAuBZ,GAAzDa,EAAQF,EAAA,GAAEG,OACXC,EAAMC,EAAAA,oBAAoBF,GAC1BG,EAAQhB,EAAIc,EAAIG,KAEhBC,EACS,WAAbJ,EAAIK,KAC6C,UAAlC,QAAXC,EAAAN,EAAIO,eAAO,IAAAD,OAAA,EAAAA,EAAEE,MAAK,SAACC,GAAO,OAAAA,EAAGP,QAAUA,CAAb,WAAmB,IAAAQ,OAAA,EAAAA,EAAEN,MAC/CF,EAEAS,EAAYC,EAAAA,SAAQ,WACxB,OAAIZ,EAAIa,SACCT,EAEAJ,EAAIc,OAASd,EAAIc,OAAOZ,EAAgBhB,GAAOkB,CAE1D,GAAG,CAACJ,EAAIa,SAAUT,EAAOF,EAAOhB,IA0ChC,MAAO,CACLmB,MAxCCL,EAAIa,UAAYb,EAAIc,OAAS,YAAcd,EAAIK,KAyChDM,UAASA,EACTI,cAxC6D,SAACC,GAC9DA,EAAEC,iBACFvB,GACF,EAsCEwB,YA/B2D,SAACF,GAC5CG,SAASC,eAAejC,EAAYkC,gBAMpDC,YAAW,WACT/B,EAAiB,CAAEO,SAAQA,EAAEC,SAAQA,IAErC,IAAMwB,EAAY,SAACP,GACjBA,EAAEC,iBACFD,EAAEQ,kBACF/B,IACA0B,SAASM,oBAAoB,UAAWF,EAC1C,EAEAJ,SAASO,iBAAiB,UAAWH,EACtC,GAAE,EACL,EAaEI,aAX4D,SAACX,GAC7DA,EAAEC,iBACFD,EAAEQ,kBACFhC,EAAgB,CAAEM,SAAQA,EAAEC,SAAQA,GACtC,EASF"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),c=require("./provider.js"),n=t.memo((function(n){var r=c.useCheckboxContext(),o=c.useCheckboxStatusContext().checkboxStatusState,u=n.row,i=t.useMemo((function(){return o.checkedRecords.map((function(e){return e.id}))}),[o.checkedRecords]);return r?e.jsx("div",{className:"grid place-items-center w-full h-full px-1",children:e.jsx("input",{type:"checkbox",checked:i.includes(u.id),onChange:function(e){e.preventDefault(),e.target.checked?r.onChecked(u):r.onUnchecked(u)},onClick:function(e){e.preventDefault(),e.stopPropagation()}})}):e.jsx(e.Fragment,{})})),r=t.memo((function(n){var r=t.useRef(null),o=c.useCheckboxContext(),u=c.useCheckboxStatusContext(),i=u.checkboxStatusState,s=u.existChecked,a=u.indeterminate,d=t.useMemo((function(){return i.checkedRecords.map((function(e){return e.id}))}),[i.checkedRecords]),h=t.useMemo((function(){return n.rows.filter((function(e){return!d.includes(e.id)}))}),[n.rows,d]);return t.useEffect((function(){null!=r.current&&(r.current.indeterminate=!0===a)}),[a]),o?e.jsx("div",{className:"grid place-items-center w-full h-full px-1",children:e.jsx("input",{ref:r,type:"checkbox",checked:s,onChange:function(e){e.preventDefault(),e.target.checked?h.forEach((function(e){o.onChecked(e)})):i.checkedRecords.forEach((function(e){o.onUnchecked(e)}))},onClick:function(e){e.preventDefault(),e.stopPropagation()}})}):e.jsx(e.Fragment,{})}));exports.AllCheckbox=r,exports.Checkbox=n;
|
|
3
3
|
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("../../../node_modules/tslib/tslib.es6.js"),e=require("react"),r=e.createContext(null),i=e.createContext(null),n=e.createContext(null);function s(){var t=e.useContext(r);if(!t)throw new Error("useFilterState must be used within a FilterProvider");return t}function o(){var t=e.useContext(i);if(!t)throw new Error("useFilterAction must be used within a FilterProvider");return t}function u(){var t=e.useContext(n);if(!t)throw new Error("useFilterFunctions must be used within a FilterProvider");return t}exports.FilterActionContext=i,exports.FilterFunctionContext=n,exports.FilterStateContext=r,exports.useFilter=function(){return t.__assign(t.__assign(t.__assign({},s()),o()),u())},exports.useFilterAction=o,exports.useFilterFunctions=u,exports.useFilterState=s;
|
|
2
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../src/table/filter-v2/context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport {\n TFilterActionContext,\n TFilterFunctionContext,\n TFilterStateContext,\n} from \"./type\";\n\nexport const FilterStateContext = createContext<TFilterStateContext | null>(\n null\n);\nexport const FilterActionContext = createContext<TFilterActionContext | null>(\n null\n);\nexport const FilterFunctionContext =\n createContext<TFilterFunctionContext | null>(null);\n\nexport function useFilterState() {\n const context = useContext(FilterStateContext);\n\n if (!context) {\n throw new Error(\"useFilterState must be used within a FilterProvider\");\n }\n\n return context;\n}\n\nexport function useFilterAction() {\n const context = useContext(FilterActionContext);\n\n if (!context) {\n throw new Error(\"useFilterAction must be used within a FilterProvider\");\n }\n\n return context;\n}\n\nexport function useFilterFunctions() {\n const context = useContext(FilterFunctionContext);\n\n if (!context) {\n throw new Error(\"useFilterFunctions must be used within a FilterProvider\");\n }\n\n return context;\n}\n\nexport function useFilter() {\n return { ...useFilterState(), ...useFilterAction(), ...useFilterFunctions() };\n}\n"],"names":["FilterStateContext","createContext","FilterActionContext","FilterFunctionContext","useFilterState","context","useContext","Error","useFilterAction","useFilterFunctions","__assign"],"mappings":"0FAOaA,EAAqBC,EAAaA,cAC7C,MAEWC,EAAsBD,EAAaA,cAC9C,MAEWE,EACXF,EAAaA,cAAgC,eAE/BG,IACd,IAAMC,EAAUC,aAAWN,GAE3B,IAAKK,EACH,MAAM,IAAIE,MAAM,uDAGlB,OAAOF,CACT,UAEgBG,IACd,IAAMH,EAAUC,aAAWJ,GAE3B,IAAKG,EACH,MAAM,IAAIE,MAAM,wDAGlB,OAAOF,CACT,UAEgBI,IACd,IAAMJ,EAAUC,aAAWH,GAE3B,IAAKE,EACH,MAAM,IAAIE,MAAM,2DAGlB,OAAOF,CACT,yHAGE,OAAYK,WAAAA,EAAAA,SAAAA,EAAAA,SAAA,GAAAN,KAAqBI,KAAsBC,IACzD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react"),t=require("./reducer.js");exports.useFilterHook=function(r){var n=e.useReducer(t.filterReducer,{conditions:r}),i=n[0],o=n[1],u=e.useMemo((function(){return{addFilter:function(e){o({type:"add",payload:{condition:e}})},removeFilter:function(e){o({type:"remove",payload:{index:e}})},clearFilter:function(){o({type:"clear"})}}}),[i.conditions]),s=e.useMemo((function(){return{filter:function(e){return e.filter((function(e){return i.conditions.every((function(t){return function(e,t,r){switch(e.operator.type){case"number":if("single number"===e.operator.inputType){if(r.type!==e.operator.inputType)throw new Error("input type is not match");var n=r.payload.value;switch(e.operator.key){case"number:eq":return t===n;case"number:gt":return t>n;case"number:gte":return t>=n;case"number:lt":return t<n;case"number:lte":return t<=n;case"number:neq":return t!==n}}case"string":switch(e.operator.inputType){case"none":if(r.type!==e.operator.inputType)throw new Error("input type is not match");switch(e.operator.key){case"string:is_not_null":return null!=t&&""!==t;case"string:is_null":return null==t||""===t}case"single string":if(r.type!==e.operator.inputType)throw new Error("input type is not match");var i=r.payload.value;switch(e.operator.key){case"string:eq":return t===i;case"string:like":return t.includes(i);case"string:neq":return t!==i;case"string:not_like":return!t.includes(i)}}case"select":switch(e.operator.inputType){case"select":if(r.type!==e.operator.inputType)throw new Error("input type is not match");i=r.payload.value;switch(e.operator.key){case"select:eq":return t===i;case"select:neq":return t!==i}case"none":if(r.type!==e.operator.inputType)throw new Error("input type is not match");switch(e.operator.key){case"select:is_null":return null==t||""===t;case"select:is_not_null":return null!=t||""!==t}}}}(t,e[t.target.key],t.input)}))}))}}}),[i.conditions]);return{state:i,actions:u,functions:s}};
|
|
2
|
+
//# sourceMappingURL=hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.js","sources":["../../../../../src/table/filter-v2/hook.ts"],"sourcesContent":["import { useMemo, useReducer } from \"react\";\nimport { TFilterHook } from \"./type\";\nimport { filterReducer } from \"./reducer\";\nimport { Condition } from \"../../search-bar\";\nimport { DataObject, DataRecord } from \"../table/type\";\nimport { SearchInput } from \"../../search-bar/condition-search-bar/condition-input-management/type\";\n\nexport const useFilterHook: TFilterHook = (initialConditions) => {\n const [state, dispatch] = useReducer(filterReducer, {\n conditions: initialConditions,\n });\n\n const actions = useMemo(\n () => ({\n addFilter: (condition: Condition) => {\n dispatch({ type: \"add\", payload: { condition } });\n },\n removeFilter: (index: number) => {\n dispatch({ type: \"remove\", payload: { index } });\n },\n clearFilter: () => {\n dispatch({ type: \"clear\" });\n },\n }),\n [state.conditions]\n );\n\n const functions = useMemo(\n () => ({\n filter: <T extends DataRecord>(rows: DataObject<T>[]) => {\n return rows.filter((row) => {\n return state.conditions.every((condition) => {\n const value = row[condition.target.key];\n return isMatchCondition(condition, value, condition.input);\n });\n });\n },\n }),\n [state.conditions]\n );\n\n return {\n state,\n actions,\n functions,\n };\n};\n\nfunction isMatchCondition(\n condition: Condition,\n targetValue: any,\n input: SearchInput\n): boolean {\n switch (condition.operator.type) {\n // case \"date\":\n // switch (condition.operator.key) {\n // case \"date:eq\":\n // return false;\n // case \"date:gt\":\n // return false;\n // case \"date:gte\":\n // return false;\n // case \"date:lt\":\n // return false;\n // case \"date:lte\":\n // return false;\n // case \"date:neq\":\n // return false;\n // case \"date:is_not_null\":\n // return false;\n // case \"date:is_null\":\n // return false;\n // }\n case \"number\":\n switch (condition.operator.inputType) {\n case \"single number\":\n if (input.type !== condition.operator.inputType) {\n throw new Error(\"input type is not match\");\n }\n\n const numValue = input.payload.value;\n\n switch (condition.operator.key) {\n case \"number:eq\":\n return targetValue === numValue;\n case \"number:gt\":\n return targetValue > numValue;\n case \"number:gte\":\n return targetValue >= numValue;\n case \"number:lt\":\n return targetValue < numValue;\n case \"number:lte\":\n return targetValue <= numValue;\n case \"number:neq\":\n return targetValue !== numValue;\n }\n }\n\n case \"string\":\n switch (condition.operator.inputType) {\n case \"none\":\n if (input.type !== condition.operator.inputType) {\n throw new Error(\"input type is not match\");\n }\n\n switch (condition.operator.key) {\n case \"string:is_not_null\":\n return (\n targetValue !== null &&\n targetValue !== undefined &&\n targetValue !== \"\"\n );\n case \"string:is_null\":\n return (\n targetValue === null ||\n targetValue === undefined ||\n targetValue === \"\"\n );\n }\n case \"single string\":\n if (input.type !== condition.operator.inputType) {\n throw new Error(\"input type is not match\");\n }\n\n const value = input.payload.value;\n\n switch (condition.operator.key) {\n case \"string:eq\":\n return targetValue === value;\n case \"string:like\":\n return targetValue.includes(value);\n case \"string:neq\":\n return targetValue !== value;\n case \"string:not_like\":\n return !targetValue.includes(value);\n }\n }\n\n case \"select\":\n switch (condition.operator.inputType) {\n case \"select\":\n if (input.type !== condition.operator.inputType) {\n throw new Error(\"input type is not match\");\n }\n\n const value = input.payload.value;\n\n switch (condition.operator.key) {\n case \"select:eq\":\n return targetValue === value;\n case \"select:neq\":\n return targetValue !== value;\n }\n case \"none\":\n if (input.type !== condition.operator.inputType) {\n throw new Error(\"input type is not match\");\n }\n\n switch (condition.operator.key) {\n case \"select:is_null\":\n return (\n targetValue === null ||\n targetValue === undefined ||\n targetValue === \"\"\n );\n case \"select:is_not_null\":\n return (\n (targetValue !== null && targetValue !== undefined) ||\n targetValue !== \"\"\n );\n }\n }\n }\n}\n"],"names":["initialConditions","_a","useReducer","filterReducer","conditions","state","dispatch","actions","useMemo","addFilter","condition","type","payload","removeFilter","index","clearFilter","functions","filter","rows","row","every","targetValue","input","operator","inputType","Error","numValue","value","key","includes","isMatchCondition","target"],"mappings":"oFAO0C,SAACA,GACnC,IAAAC,EAAoBC,EAAUA,WAACC,gBAAe,CAClDC,WAAYJ,IADPK,EAAKJ,EAAA,GAAEK,OAIRC,EAAUC,WACd,WAAM,MAAC,CACLC,UAAW,SAACC,GACVJ,EAAS,CAAEK,KAAM,MAAOC,QAAS,CAAEF,UAASA,IAC7C,EACDG,aAAc,SAACC,GACbR,EAAS,CAAEK,KAAM,SAAUC,QAAS,CAAEE,MAAKA,IAC5C,EACDC,YAAa,WACXT,EAAS,CAAEK,KAAM,SAClB,KAEH,CAACN,EAAMD,aAGHY,EAAYR,WAChB,WAAM,MAAC,CACLS,OAAQ,SAAuBC,GAC7B,OAAOA,EAAKD,QAAO,SAACE,GAClB,OAAOd,EAAMD,WAAWgB,OAAM,SAACV,GAE7B,OAeZ,SACEA,EACAW,EACAC,GAEA,OAAQZ,EAAUa,SAASZ,MAoBzB,IAAK,SACH,GACO,kBADCD,EAAUa,SAASC,UACzB,CACE,GAAIF,EAAMX,OAASD,EAAUa,SAASC,UACpC,MAAM,IAAIC,MAAM,2BAGlB,IAAMC,EAAWJ,EAAMV,QAAQe,MAE/B,OAAQjB,EAAUa,SAASK,KACzB,IAAK,YACH,OAAOP,IAAgBK,EACzB,IAAK,YACH,OAAOL,EAAcK,EACvB,IAAK,aACH,OAAOL,GAAeK,EACxB,IAAK,YACH,OAAOL,EAAcK,EACvB,IAAK,aACH,OAAOL,GAAeK,EACxB,IAAK,aACH,OAAOL,IAAgBK,EAC1B,CAGP,IAAK,SACH,OAAQhB,EAAUa,SAASC,WACzB,IAAK,OACH,GAAIF,EAAMX,OAASD,EAAUa,SAASC,UACpC,MAAM,IAAIC,MAAM,2BAGlB,OAAQf,EAAUa,SAASK,KACzB,IAAK,qBACH,OACEP,SAEgB,KAAhBA,EAEJ,IAAK,iBACH,OACEA,SAEgB,KAAhBA,EAGR,IAAK,gBACH,GAAIC,EAAMX,OAASD,EAAUa,SAASC,UACpC,MAAM,IAAIC,MAAM,2BAGlB,IAAME,EAAQL,EAAMV,QAAQe,MAE5B,OAAQjB,EAAUa,SAASK,KACzB,IAAK,YACH,OAAOP,IAAgBM,EACzB,IAAK,cACH,OAAON,EAAYQ,SAASF,GAC9B,IAAK,aACH,OAAON,IAAgBM,EACzB,IAAK,kBACH,OAAQN,EAAYQ,SAASF,IAIvC,IAAK,SACH,OAAQjB,EAAUa,SAASC,WACzB,IAAK,SACH,GAAIF,EAAMX,OAASD,EAAUa,SAASC,UACpC,MAAM,IAAIC,MAAM,2BAGZE,EAAQL,EAAMV,QAAQe,MAE5B,OAAQjB,EAAUa,SAASK,KACzB,IAAK,YACH,OAAOP,IAAgBM,EACzB,IAAK,aACH,OAAON,IAAgBM,EAE7B,IAAK,OACH,GAAIL,EAAMX,OAASD,EAAUa,SAASC,UACpC,MAAM,IAAIC,MAAM,2BAGlB,OAAQf,EAAUa,SAASK,KACzB,IAAK,iBACH,OACEP,SAEgB,KAAhBA,EAEJ,IAAK,qBACH,OACE,MAACA,GACe,KAAhBA,IAKhB,CA5ImBS,CAAiBpB,EADVS,EAAIT,EAAUqB,OAAOH,KACOlB,EAAUY,MACtD,GACF,GACD,KAEH,CAACjB,EAAMD,aAGT,MAAO,CACLC,MAAKA,EACLE,QAAOA,EACPS,UAASA,EAEb"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("./context.js"),t=require("./hook.js");exports.FilterProvider=function(i){var n=t.useFilterHook(i.initialConditions),o=n.state,s=n.actions,l=n.functions;return e.jsx(r.FilterStateContext.Provider,{value:o,children:e.jsx(r.FilterActionContext.Provider,{value:s,children:e.jsx(r.FilterFunctionContext.Provider,{value:l,children:i.children})})})};
|
|
2
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sources":["../../../../../src/table/filter-v2/provider.tsx"],"sourcesContent":["import { Condition } from \"../../search-bar\";\nimport {\n FilterActionContext,\n FilterFunctionContext,\n FilterStateContext,\n} from \"./context\";\nimport { useFilterHook } from \"./hook\";\n\nexport function FilterProvider(props: {\n children: React.ReactNode;\n initialConditions: Condition[];\n}) {\n const { state, actions, functions } = useFilterHook(props.initialConditions);\n\n return (\n <FilterStateContext.Provider value={state}>\n <FilterActionContext.Provider value={actions}>\n <FilterFunctionContext.Provider value={functions}>\n {props.children}\n </FilterFunctionContext.Provider>\n </FilterActionContext.Provider>\n </FilterStateContext.Provider>\n );\n}\n"],"names":["props","_a","useFilterHook","initialConditions","state","actions","functions","_jsx","FilterStateContext","Provider","value","FilterActionContext","children","FilterFunctionContext"],"mappings":"wHAQM,SAAyBA,GAIvB,IAAAC,EAAgCC,EAAaA,cAACF,EAAMG,mBAAlDC,EAAKH,EAAAG,MAAEC,EAAOJ,EAAAI,QAAEC,cAExB,OACEC,MAACC,EAAAA,mBAAmBC,SAAS,CAAAC,MAAON,WAClCG,MAACI,EAAAA,oBAAoBF,UAASC,MAAOL,EAAOO,SAC1CL,MAACM,EAAAA,sBAAsBJ,SAAQ,CAACC,MAAOJ,EACpCM,SAAAZ,EAAMY,cAKjB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("../../../node_modules/tslib/tslib.es6.js");exports.filterReducer=function(r,i){switch(i.type){case"add":return{conditions:e.__spreadArray(e.__spreadArray([],r.conditions,!0),[i.payload.condition],!1)};case"remove":return{conditions:r.conditions.filter((function(e,r){return r!==i.payload.index}))};case"clear":return{conditions:[]}}};
|
|
2
|
+
//# sourceMappingURL=reducer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.js","sources":["../../../../../src/table/filter-v2/reducer.ts"],"sourcesContent":["import { TFilterReducer } from \"./type\";\n\nexport const filterReducer: TFilterReducer = (state, action) => {\n switch (action.type) {\n case \"add\":\n return {\n conditions: [...state.conditions, action.payload.condition],\n };\n case \"remove\":\n return {\n conditions: state.conditions.filter(\n (_, index) => index !== action.payload.index\n ),\n };\n case \"clear\":\n return {\n conditions: [],\n };\n }\n};\n"],"names":["state","action","type","conditions","__spreadArray","payload","condition","filter","_","index"],"mappings":"6FAE6C,SAACA,EAAOC,GACnD,OAAQA,EAAOC,MACb,IAAK,MACH,MAAO,CACLC,WAAUC,EAAAA,cAAAA,EAAAA,cAAA,GAAMJ,EAAMG,YAAU,GAAA,CAAEF,EAAOI,QAAQC,YAAU,IAE/D,IAAK,SACH,MAAO,CACLH,WAAYH,EAAMG,WAAWI,QAC3B,SAACC,EAAGC,GAAU,OAAAA,IAAUR,EAAOI,QAAQI,KAAzB,KAGpB,IAAK,QACH,MAAO,CACLN,WAAY,IAGpB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("../header/columns-width/context.js");require("../../../node_modules/tslib/tslib.es6.js");var n=require("../header/x-scroll-position/context.js");exports.Frame=function(o){var l=n.useScrollXPosition(),c=l.x,s=l.setScrollX,i=t.useRef(null),u=t.useState({scrollX:0,scrollY:0,barYHeight:0,barXWidth:0}),a=u[0],d=u[1],m=r.useColumnsWidthState();return t.useEffect((function(){var e=function(){if(i.current){s(i.current.scrollLeft);var e=i.current.scrollLeft/i.current.scrollWidth*100,t=i.current.scrollTop/i.current.scrollHeight*100,r=i.current.clientHeight/i.current.scrollHeight*100,n=i.current.clientWidth/i.current.scrollWidth*100;d({scrollX:e>100?100:e,scrollY:t>100?100:t,barYHeight:r>100?100:r,barXWidth:n>100?100:n})}};return e(),i.current&&i.current.addEventListener("scroll",e),function(){i.current&&i.current.removeEventListener("scroll",e)}}),[s,m]),t.useEffect((function(){i.current&&(i.current.scrollLeft=c)}),[c]),e.jsxs("div",{className:"relative",style:{maxHeight:o.maxHeight,maxWidth:o.maxWidth},children:[e.jsx("div",{ref:i,id:o.id,className:"relative w-full h-full border border-gray-200 bg-white rounded-b-md overflow-auto ".concat(o.displayScroll?"":"no_scrollbar"),style:{maxHeight:o.maxHeight,maxWidth:o.maxWidth},children:o.children}),a.barYHeight<100&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute top-0 right-0 h-full w-2 bg-slate-200 opacity-30 pointer-events-none"}),e.jsx("div",{className:"absolute right-0 w-2 bg-slate-500 rounded-full cursor-grab active:cursor-grabbing",style:{top:"".concat(a.scrollY,"%"),height:"".concat(a.barYHeight,"%")},onMouseDown:function(e){var t,r=e.clientY,n=(null===(t=i.current)||void 0===t?void 0:t.scrollTop)||0,o=function(e){if(i.current){var t=(e.clientY-r)/a.barYHeight*100;i.current.scrollTop=n+t}},l=function(){document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",l)}})]}),a.barXWidth<100&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute bottom-0 left-0 w-full h-2 bg-slate-200 opacity-30 pointer-events-none"}),e.jsx("div",{className:"absolute bottom-0 h-2 bg-slate-500 rounded-full cursor-grab active:cursor-grabbing",style:{left:"".concat(a.scrollX,"%"),width:"".concat(a.barXWidth,"%")},onMouseDown:function(e){var t;e.preventDefault(),e.stopPropagation();var r=e.clientX,n=(null===(t=i.current)||void 0===t?void 0:t.scrollLeft)||0,o=function(t){if(i.current){e.preventDefault(),e.stopPropagation();var o=(t.clientX-r)/a.barXWidth*100;i.current.scrollLeft=n+o}},l=function(){document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",l)}})]})]})};
|
|
3
|
+
//# sourceMappingURL=frame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("../../../../node_modules/tslib/tslib.es6.js"),e=require("react"),n=e.createContext(null),s=e.createContext(null);function o(){var t=e.useContext(n);if(null===t)throw new Error("useColumnsWidthState must be used within a ColumnsWidthProvider");return t}function r(){var t=e.useContext(s);if(null===t)throw new Error("useColumnsWidthAction must be used within a ColumnsWidthProvider");return t}exports.ColumnsWidthActionContext=s,exports.ColumnsWidthStateContext=n,exports.useColumnsWidth=function(){return t.__assign(t.__assign({},o()),r())},exports.useColumnsWidthAction=r,exports.useColumnsWidthState=o;
|
|
2
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../../../../../src/table/header/columns-width/context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport { TColumnsWidthActionContext, TColumnsWidthStateContext } from \"./type\";\n\nexport const ColumnsWidthStateContext =\n createContext<TColumnsWidthStateContext | null>(null);\n\nexport const ColumnsWidthActionContext =\n createContext<TColumnsWidthActionContext | null>(null);\n\nexport function useColumnsWidthState() {\n const context = useContext(ColumnsWidthStateContext);\n\n if (context === null) {\n throw new Error(\n \"useColumnsWidthState must be used within a ColumnsWidthProvider\"\n );\n }\n\n return context;\n}\n\nexport function useColumnsWidthAction() {\n const context = useContext(ColumnsWidthActionContext);\n\n if (context === null) {\n throw new Error(\n \"useColumnsWidthAction must be used within a ColumnsWidthProvider\"\n );\n }\n\n return context;\n}\n\nexport function useColumnsWidth() {\n return { ...useColumnsWidthState(), ...useColumnsWidthAction() };\n}\n"],"names":["ColumnsWidthStateContext","createContext","ColumnsWidthActionContext","useColumnsWidthState","context","useContext","Error","useColumnsWidthAction","__assign"],"mappings":"6FAGaA,EACXC,EAAaA,cAAmC,MAErCC,EACXD,EAAaA,cAAoC,eAEnCE,IACd,IAAMC,EAAUC,aAAWL,GAE3B,GAAgB,OAAZI,EACF,MAAM,IAAIE,MACR,mEAIJ,OAAOF,CACT,UAEgBG,IACd,IAAMH,EAAUC,aAAWH,GAE3B,GAAgB,OAAZE,EACF,MAAM,IAAIE,MACR,oEAIJ,OAAOF,CACT,2GAGE,OAAAI,EAAAA,SAAAA,EAAAA,SAAA,CAAA,EAAYL,KAA2BI,IACzC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("../../constant.js"),r=require("./context.js"),i=require("./reducer.js");var n=function(e){return e.reduce((function(e,r){return e[r.key]={colWidth:r.initialWidth||t.DEFAULT_COL_WIDTH,minWidth:r.minWidth||t.DEFAULT_MIN_COL_WIDTH},e}),{})};exports.ColumnsWidthProvider=function(t){var u=i.useColumnsWidthReducer(n(t.initialState)),o=u.state,d=u.action;return e.jsx(r.ColumnsWidthStateContext.Provider,{value:o,children:e.jsx(r.ColumnsWidthActionContext.Provider,{value:d,children:t.children})})};
|
|
3
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var t=require("../../../../node_modules/tslib/tslib.es6.js"),n=require("react"),e=require("../../constant.js"),s=function(n,e){var s,i;switch(e.type){case"init":return e.payload.columnsWidth;case"setMinWidth":return t.__assign(t.__assign({},n),((s={})[e.payload.key]=t.__assign(t.__assign({},n[e.payload.key]),{minWidth:e.payload.minWidth}),s));case"set":return t.__assign(t.__assign({},n),((i={})[e.payload.key]=t.__assign(t.__assign({},n[e.payload.key]),{colWidth:e.payload.colWidth}),i));default:return n}};exports.columnsWidthReducer=s,exports.useColumnsWidthReducer=function(t){var i=n.useReducer(s,t),o=i[0],a=i[1];return{state:n.useMemo((function(){return{getColumnWidth:function(t){var n=o[t];return n?n.colWidth:(console.warn("Column width state not found: ".concat(t)),e.DEFAULT_COL_WIDTH)},getColumnMinWidth:function(t){var n=o[t];return n?n.minWidth:(console.warn("Column width state not found: ".concat(t)),e.DEFAULT_MIN_COL_WIDTH)}}}),[o]),action:n.useMemo((function(){return{setColWidth:function(t,n){a({type:"set",payload:{key:t,colWidth:n}})}}}),[])}};
|
|
2
|
+
//# sourceMappingURL=reducer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.js","sources":["../../../../../../src/table/header/columns-width/reducer.ts"],"sourcesContent":["import { useMemo, useReducer } from \"react\";\nimport { TColumnsWidthHook, TColumnsWidthReducer } from \"./type\";\nimport { DEFAULT_COL_WIDTH, DEFAULT_MIN_COL_WIDTH } from \"../../constant\";\n\nexport const columnsWidthReducer: TColumnsWidthReducer = (state, action) => {\n switch (action.type) {\n case \"init\":\n return action.payload.columnsWidth;\n case \"setMinWidth\":\n return {\n ...state,\n [action.payload.key]: {\n ...state[action.payload.key],\n minWidth: action.payload.minWidth,\n },\n };\n case \"set\":\n return {\n ...state,\n [action.payload.key]: {\n ...state[action.payload.key],\n colWidth: action.payload.colWidth,\n },\n };\n default:\n return state;\n }\n};\n\nexport const useColumnsWidthReducer: TColumnsWidthHook = (initialState) => {\n const [state, dispatch] = useReducer(columnsWidthReducer, initialState);\n\n const stateActions = useMemo(\n () => ({\n getColumnWidth: (key: string) => {\n const s = state[key];\n\n if (!s) {\n console.warn(`Column width state not found: ${key}`);\n return DEFAULT_COL_WIDTH;\n }\n\n return s.colWidth;\n },\n getColumnMinWidth: (key: string) => {\n const s = state[key];\n\n if (!s) {\n console.warn(`Column width state not found: ${key}`);\n return DEFAULT_MIN_COL_WIDTH;\n }\n\n return s.minWidth;\n },\n }),\n [state]\n );\n\n const action = useMemo(\n () => ({\n setColWidth: (key: string, colWidth: number) => {\n dispatch({ type: \"set\", payload: { key, colWidth } });\n },\n }),\n []\n );\n\n return { state: stateActions, action };\n};\n"],"names":["columnsWidthReducer","state","action","type","payload","columnsWidth","__assign","_a","key","minWidth","_b","colWidth","initialState","useReducer","dispatch","useMemo","getColumnWidth","s","console","warn","DEFAULT_COL_WIDTH","getColumnMinWidth","DEFAULT_MIN_COL_WIDTH","setColWidth"],"mappings":"4HAIaA,EAA4C,SAACC,EAAOC,WAC/D,OAAQA,EAAOC,MACb,IAAK,OACH,OAAOD,EAAOE,QAAQC,aACxB,IAAK,cACH,OACKC,EAAAA,SAAAA,EAAAA,SAAA,GAAAL,KACFM,EAAA,IAAAL,EAAOE,QAAQI,KAAGF,EAAAA,SAAAA,EAAAA,SAAA,CAAA,EACdL,EAAMC,EAAOE,QAAQI,MAAI,CAC5BC,SAAUP,EAAOE,QAAQK,WAE3BF,IACJ,IAAK,MACH,OACKD,EAAAA,SAAAA,EAAAA,SAAA,GAAAL,KACFS,EAAA,IAAAR,EAAOE,QAAQI,KAAGF,EAAAA,SAAAA,EAAAA,SAAA,CAAA,EACdL,EAAMC,EAAOE,QAAQI,MAAI,CAC5BG,SAAUT,EAAOE,QAAQO,WAE3BD,IACJ,QACE,OAAOT,EAEb,+DAEyD,SAACW,GAClD,IAAAL,EAAoBM,EAAAA,WAAWb,EAAqBY,GAAnDX,EAAKM,EAAA,GAAEO,OAqCd,MAAO,CAAEb,MAnCYc,WACnB,WAAM,MAAC,CACLC,eAAgB,SAACR,GACf,IAAMS,EAAIhB,EAAMO,GAEhB,OAAKS,EAKEA,EAAEN,UAJPO,QAAQC,KAAK,wCAAiCX,IACvCY,oBAIV,EACDC,kBAAmB,SAACb,GAClB,IAAMS,EAAIhB,EAAMO,GAEhB,OAAKS,EAKEA,EAAER,UAJPS,QAAQC,KAAK,wCAAiCX,IACvCc,wBAIV,EACD,GACF,CAACrB,IAY2BC,OATfa,WACb,WAAM,MAAC,CACLQ,YAAa,SAACf,EAAaG,GACzBG,EAAS,CAAEX,KAAM,MAAOC,QAAS,CAAEI,MAAKG,aACzC,EAHG,GAKN,IAIJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("react"),t=require("./columns-width/context.js");require("react/jsx-runtime"),require("../../../node_modules/tslib/tslib.es6.js");var r=require("./x-scroll-position/context.js");exports.useResizeColWidthHook=function(r){var n=t.useColumnsWidth(),o=n.getColumnWidth,u=n.getColumnMinWidth,s=n.setColWidth,c=e.useState(!1),i=c[0],l=c[1],d=o(r),m=u(r);return{onMouseDownResizeWidth:e.useCallback((function(e){if(!i){var t=e.clientX,n=d;document.body.style.cursor="col-resize",document.body.style.userSelect="none";var o=function(e){l(!0);var o=n+(e.clientX-t);s(r,o>m?o:m)},u=function(){l(!1),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",u),document.body.style.cursor="default",document.body.style.userSelect="auto"};document.addEventListener("mousemove",o),document.addEventListener("mouseup",u)}}),[i,m])}},exports.useScrollXRef=function(){var t=r.useScrollXPosition(),n=t.x,o=t.setScrollX,u=e.useRef(null);return e.useEffect((function(){var e=function(){u.current&&o(u.current.scrollLeft)};return u.current&&u.current.addEventListener("scroll",e),function(){u.current&&u.current.removeEventListener("scroll",e)}}),[]),e.useEffect((function(){u.current&&(u.current.scrollLeft=n)}),[n]),u};
|
|
2
|
+
//# sourceMappingURL=header-v2-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header-v2-hook.js","sources":["../../../../../src/table/header/header-v2-hook.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useColumnsWidth } from \"./columns-width\";\nimport { useScrollXPosition } from \"./x-scroll-position\";\n\nexport function useResizeColWidthHook(keyName: string) {\n const { getColumnWidth, getColumnMinWidth, setColWidth } = useColumnsWidth();\n const [isDragging, setIsDragging] = useState(false);\n\n const colWidth = getColumnWidth(keyName);\n const minWidth = getColumnMinWidth(keyName);\n\n const cursorStyle = \"col-resize\";\n\n const onMouseDownResizeWidth: React.MouseEventHandler<HTMLDivElement> =\n useCallback(\n (e) => {\n if (isDragging) return;\n\n const startX = e.clientX;\n const startWidth = colWidth;\n\n document.body.style.cursor = cursorStyle;\n document.body.style.userSelect = \"none\";\n\n const onMouseMove = (moveEvent: MouseEvent) => {\n setIsDragging(true);\n const newWidth = startWidth + (moveEvent.clientX - startX);\n setColWidth(keyName, newWidth > minWidth ? newWidth : minWidth);\n };\n\n const onMouseUp = () => {\n setIsDragging(false);\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n document.body.style.cursor = \"default\";\n document.body.style.userSelect = \"auto\";\n };\n\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n },\n [isDragging, minWidth]\n );\n\n return {\n onMouseDownResizeWidth,\n };\n}\n\nexport function useScrollXRef() {\n const { x, setScrollX } = useScrollXPosition();\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const handleHeaderScroll = () => {\n if (ref.current) {\n setScrollX(ref.current.scrollLeft);\n }\n };\n\n if (ref.current) {\n ref.current.addEventListener(\"scroll\", handleHeaderScroll);\n }\n\n return () => {\n if (ref.current) {\n ref.current.removeEventListener(\"scroll\", handleHeaderScroll);\n }\n };\n }, []);\n\n useEffect(() => {\n if (ref.current) {\n ref.current.scrollLeft = x;\n }\n }, [x]);\n\n return ref;\n}\n"],"names":["keyName","_a","useColumnsWidth","getColumnWidth","getColumnMinWidth","setColWidth","_b","useState","isDragging","setIsDragging","colWidth","minWidth","onMouseDownResizeWidth","useCallback","e","startX","clientX","startWidth","document","body","style","cursor","userSelect","onMouseMove","moveEvent","newWidth","onMouseUp","removeEventListener","addEventListener","useScrollXPosition","x","setScrollX","ref","useRef","useEffect","handleHeaderScroll","current","scrollLeft"],"mappings":"2OAIM,SAAgCA,GAC9B,IAAAC,EAAqDC,EAAAA,kBAAnDC,EAAcF,EAAAE,eAAEC,EAAiBH,EAAAG,kBAAEC,EAAWJ,EAAAI,YAChDC,EAA8BC,EAAAA,UAAS,GAAtCC,EAAUF,EAAA,GAAEG,EAAaH,EAAA,GAE1BI,EAAWP,EAAeH,GAC1BW,EAAWP,EAAkBJ,GAmCnC,MAAO,CACLY,uBA/BAC,eACE,SAACC,GACC,IAAIN,EAAJ,CAEA,IAAMO,EAASD,EAAEE,QACXC,EAAaP,EAEnBQ,SAASC,KAAKC,MAAMC,OAVN,aAWdH,SAASC,KAAKC,MAAME,WAAa,OAEjC,IAAMC,EAAc,SAACC,GACnBf,GAAc,GACd,IAAMgB,EAAWR,GAAcO,EAAUR,QAAUD,GACnDV,EAAYL,EAASyB,EAAWd,EAAWc,EAAWd,EACxD,EAEMe,EAAY,WAChBjB,GAAc,GACdS,SAASS,oBAAoB,YAAaJ,GAC1CL,SAASS,oBAAoB,UAAWD,GACxCR,SAASC,KAAKC,MAAMC,OAAS,UAC7BH,SAASC,KAAKC,MAAME,WAAa,MACnC,EAEAJ,SAASU,iBAAiB,YAAaL,GACvCL,SAASU,iBAAiB,UAAWF,EAvBd,CAwBzB,GACA,CAAClB,EAAYG,IAMnB,mCAGQ,IAAAV,EAAoB4B,EAAkBA,qBAApCC,EAAC7B,EAAA6B,EAAEC,EAAU9B,EAAA8B,WACfC,EAAMC,SAAuB,MA0BnC,OAxBAC,EAAAA,WAAU,WACR,IAAMC,EAAqB,WACrBH,EAAII,SACNL,EAAWC,EAAII,QAAQC,WAE3B,EAMA,OAJIL,EAAII,SACNJ,EAAII,QAAQR,iBAAiB,SAAUO,GAGlC,WACDH,EAAII,SACNJ,EAAII,QAAQT,oBAAoB,SAAUQ,EAE9C,CACD,GAAE,IAEHD,EAAAA,WAAU,WACJF,EAAII,UACNJ,EAAII,QAAQC,WAAaP,EAE7B,GAAG,CAACA,IAEGE,CACT"}
|
|
@@ -0,0 +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 i=require("./header-v2-hook.js"),l=require("../checkbox/components.js"),s=require("../../search-bar/condition-search-bar/base.js"),a=require("../id/provider.js"),n=require("../filter-v2/context.js");var o=t.memo((function(r){var l=t.useRef(null),s=i.useResizeColWidthHook(r.keyName).onMouseDownResizeWidth,a=l.current?r.colWidth-l.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:a},children:r.label&&e.jsx("p",{className:"text-left font-bold text-nowrap overflow-hidden text-ellipsis",children:r.label})}),e.jsx("div",{ref:l,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=a.useTableIdGenerator(),u=r.useColumnsWidthState().getColumnWidth,h=n.useFilter(),x=h.conditions,m=h.addFilter,b=h.removeFilter,f=i.useScrollXRef();t.useEffect((function(){if(f.current){var e=f.current,t=function(t){0!==t.deltaY&&(t.preventDefault(),e.scrollLeft+=t.deltaY)};return e.addEventListener("wheel",t),function(){e.removeEventListener("wheel",t)}}}),[f]);var p=t.useCallback((function(e){switch(e.type){case"add":m(e.payload.condition);break;case"remove":b(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:p,size:"small"})}),e.jsx("div",{ref:f,className:"relative max-w-full overflow-x-auto no_scrollbar",children:e.jsxs("div",{className:"flex h-[32px]",children:[c.checkbox&&e.jsx("th",{className:"w-8 h-full",children:e.jsx(l.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
|
+
//# sourceMappingURL=header-v2.js.map
|
|
@@ -0,0 +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 <div\n ref={ref}\n className=\"relative max-w-full overflow-x-auto 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":"0WAuIA,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,wBAjKM,SAA4CZ,GAChD,IAAMwB,EAAcC,EAAAA,sBACZC,EAAmBC,wCACrBC,EAA0CC,EAAAA,YAAxCC,EAAUF,EAAAE,WAAEC,EAASH,EAAAG,UAAEC,EAAYJ,EAAAI,aACrC/B,EAAMgC,EAAAA,gBAEZC,EAAAA,WAAU,WACR,GAAIjC,EAAIM,QAAS,CACf,IAAM4B,EAAUlC,EAAIM,QAEd6B,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,CAACnC,IAEJ,IAAM0C,EAAoBC,eAAY,SAACC,GACrC,OAAQA,EAAOC,MACb,IAAK,MACHf,EAAUc,EAAOE,QAAQC,WACzB,MACF,IAAK,SACHhB,EAAaa,EAAOE,QAAQE,OAGjC,GAAE,IAEGC,EAAUC,EAAAA,SAAQ,WACtB,OAAOnD,EAAMoD,KACVC,QACC,SAACC,GAAQ,QAAEA,EAAIlC,QAAUkC,EAAIC,WAAcD,EAAIC,WAAaD,EAAIE,WAEjEC,KAAI,SAACH,GACJ,OAAQA,EAAIR,MACV,IAAK,SAML,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,YACbK,SAAAC,EAAAC,IAAC0C,EAAkBA,mBACjB,CAAAC,GAAItC,EAAYuC,mBAChBb,QAASA,EACTpB,WAAYA,EACZa,kBAAmBA,EACnBqB,KAAK,YAIT9C,aACEjB,IAAKA,EACLW,UAAU,mDAAkDK,SAE5DP,cAAKE,UAAU,gBACZK,SAAA,CAAAjB,EAAMiE,UACL/C,MAAI,KAAA,CAAAN,UAAU,aAAYK,SACxBC,MAACgD,EAAWA,YAAA,CAACC,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,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("react/jsx-runtime"),
|
|
2
|
+
"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 i=t.memo((function(t){var i=(0,r.useColumnsWidthState().getColumnWidth)(t.keyname);return e.jsx("th",{style:{width:i,maxWidth:i,minWidth:i}})}));exports.TableHeaderElement=i;
|
|
3
3
|
//# sourceMappingURL=header.js.map
|