@contember/react-select 2.1.0-alpha.9 → 2.1.0-beta.2
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/CLAUDE.md +20 -0
- package/dist/development/index.cjs +2 -2
- package/dist/development/index.js +1 -1
- package/dist/development/src/components/MultiSelect.cjs.map +1 -1
- package/dist/development/src/components/MultiSelect.js.map +1 -1
- package/dist/development/src/components/Select.cjs.map +1 -1
- package/dist/development/src/components/Select.js.map +1 -1
- package/dist/development/src/components/SelectDataView.cjs.map +1 -1
- package/dist/development/src/components/SelectDataView.js.map +1 -1
- package/dist/development/src/components/SelectEachItem.cjs +1 -1
- package/dist/development/src/components/SelectEachItem.cjs.map +1 -1
- package/dist/development/src/components/SelectEachItem.js +1 -1
- package/dist/development/src/components/SelectEachItem.js.map +1 -1
- package/dist/development/src/components/SelectItemTrigger.cjs.map +1 -1
- package/dist/development/src/components/SelectItemTrigger.js.map +1 -1
- package/dist/development/src/components/SelectNewItem.cjs +29 -14
- package/dist/development/src/components/SelectNewItem.cjs.map +1 -1
- package/dist/development/src/components/SelectNewItem.js +29 -14
- package/dist/development/src/components/SelectNewItem.js.map +1 -1
- package/dist/development/src/components/SelectOption.cjs.map +1 -1
- package/dist/development/src/components/SelectOption.js.map +1 -1
- package/dist/development/src/components/SelectPlaceholder.cjs.map +1 -1
- package/dist/development/src/components/SelectPlaceholder.js.map +1 -1
- package/dist/development/src/components/SortableMultiSelect.cjs +70 -67
- package/dist/development/src/components/SortableMultiSelect.cjs.map +1 -1
- package/dist/development/src/components/SortableMultiSelect.js +70 -67
- package/dist/development/src/components/SortableMultiSelect.js.map +1 -1
- package/dist/development/src/contexts.cjs.map +1 -1
- package/dist/development/src/contexts.js.map +1 -1
- package/dist/production/index.cjs +2 -2
- package/dist/production/index.js +1 -1
- package/dist/production/src/components/MultiSelect.cjs.map +1 -1
- package/dist/production/src/components/MultiSelect.js.map +1 -1
- package/dist/production/src/components/Select.cjs.map +1 -1
- package/dist/production/src/components/Select.js.map +1 -1
- package/dist/production/src/components/SelectDataView.cjs.map +1 -1
- package/dist/production/src/components/SelectDataView.js.map +1 -1
- package/dist/production/src/components/SelectEachItem.cjs.map +1 -1
- package/dist/production/src/components/SelectEachItem.js.map +1 -1
- package/dist/production/src/components/SelectItemTrigger.cjs.map +1 -1
- package/dist/production/src/components/SelectItemTrigger.js.map +1 -1
- package/dist/production/src/components/SelectNewItem.cjs +14 -3
- package/dist/production/src/components/SelectNewItem.cjs.map +1 -1
- package/dist/production/src/components/SelectNewItem.js +14 -3
- package/dist/production/src/components/SelectNewItem.js.map +1 -1
- package/dist/production/src/components/SelectOption.cjs.map +1 -1
- package/dist/production/src/components/SelectOption.js.map +1 -1
- package/dist/production/src/components/SelectPlaceholder.cjs.map +1 -1
- package/dist/production/src/components/SelectPlaceholder.js.map +1 -1
- package/dist/production/src/components/SortableMultiSelect.cjs +42 -39
- package/dist/production/src/components/SortableMultiSelect.cjs.map +1 -1
- package/dist/production/src/components/SortableMultiSelect.js +42 -39
- package/dist/production/src/components/SortableMultiSelect.js.map +1 -1
- package/dist/production/src/contexts.cjs.map +1 -1
- package/dist/production/src/contexts.js.map +1 -1
- package/dist/types/components/SelectDataView.d.ts.map +1 -1
- package/dist/types/components/SelectEachItem.d.ts.map +1 -1
- package/dist/types/components/SelectNewItem.d.ts.map +1 -1
- package/dist/types/components/SortableMultiSelect.d.ts.map +1 -1
- package/dist/types/contexts.d.ts +6 -6
- package/dist/types/contexts.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/src/components/MultiSelect.tsx +1 -2
- package/src/components/Select.tsx +0 -1
- package/src/components/SelectDataView.tsx +1 -1
- package/src/components/SelectEachItem.tsx +0 -1
- package/src/components/SelectItemTrigger.tsx +1 -1
- package/src/components/SelectNewItem.tsx +27 -10
- package/src/components/SortableMultiSelect.tsx +64 -60
- package/src/contexts.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectItemTrigger.cjs","sources":["../../../../../packages/react-select/src/components/SelectItemTrigger.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement, useCallback } from 'react'\nimport { useSelectHandleSelect } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\n\nexport type SelectItemTriggerProps = {\n\tchildren: ReactElement\n\taction?: 'select' | 'unselect' | 'toggle'\n\tonClick?: (event: React.MouseEvent<HTMLElement>) => void\n}\n\nexport const SelectItemTrigger = forwardRef<HTMLElement, SelectItemTriggerProps>(({ action, ...props }: SelectItemTriggerProps, ref) => {\n\tconst handleSelect = useSelectHandleSelect()\n\tconst entity = useEntity()\n\tconst onClickProp = props.onClick\n\tconst onClick = useCallback((e: React.MouseEvent<HTMLElement>) => {\n\t\thandleSelect?.(entity, action)\n\t\tonClickProp?.(e)\n\t}, [action, entity, handleSelect, onClickProp])\n\treturn <Slot {...props} onClick={onClick}
|
|
1
|
+
{"version":3,"file":"SelectItemTrigger.cjs","sources":["../../../../../packages/react-select/src/components/SelectItemTrigger.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement, useCallback } from 'react'\nimport { useSelectHandleSelect } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\n\nexport type SelectItemTriggerProps = {\n\tchildren: ReactElement\n\taction?: 'select' | 'unselect' | 'toggle'\n\tonClick?: (event: React.MouseEvent<HTMLElement>) => void\n}\n\nexport const SelectItemTrigger = forwardRef<HTMLElement, SelectItemTriggerProps>(({ action, ...props }: SelectItemTriggerProps, ref) => {\n\tconst handleSelect = useSelectHandleSelect()\n\tconst entity = useEntity()\n\tconst onClickProp = props.onClick\n\tconst onClick = useCallback((e: React.MouseEvent<HTMLElement>) => {\n\t\thandleSelect?.(entity, action)\n\t\tonClickProp?.(e)\n\t}, [action, entity, handleSelect, onClickProp])\n\treturn <Slot {...props} onClick={onClick} ref={ref} />\n})\n"],"names":["forwardRef","useSelectHandleSelect","useEntity","useCallback","jsx","Slot"],"mappings":";;;;;;;AAWO,MAAM,oBAAoBA,MAAAA,WAAgD,CAAC,EAAE,QAAQ,GAAG,MAAA,GAAiC,QAAQ;AACvI,QAAM,eAAeC,SAAAA,sBAAA;AACrB,QAAM,SAASC,aAAAA,UAAA;AACf,QAAM,cAAc,MAAM;AAC1B,QAAM,UAAUC,kBAAY,CAAC,MAAqC;AACjE,mBAAe,QAAQ,MAAM;AAC7B,kBAAc,CAAC;AAAA,EAChB,GAAG,CAAC,QAAQ,QAAQ,cAAc,WAAW,CAAC;AAC9C,SAAOC,2BAAAA,IAACC,UAAAA,MAAA,EAAM,GAAG,OAAO,SAAkB,KAAU;AACrD,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectItemTrigger.js","sources":["../../../../../packages/react-select/src/components/SelectItemTrigger.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement, useCallback } from 'react'\nimport { useSelectHandleSelect } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\n\nexport type SelectItemTriggerProps = {\n\tchildren: ReactElement\n\taction?: 'select' | 'unselect' | 'toggle'\n\tonClick?: (event: React.MouseEvent<HTMLElement>) => void\n}\n\nexport const SelectItemTrigger = forwardRef<HTMLElement, SelectItemTriggerProps>(({ action, ...props }: SelectItemTriggerProps, ref) => {\n\tconst handleSelect = useSelectHandleSelect()\n\tconst entity = useEntity()\n\tconst onClickProp = props.onClick\n\tconst onClick = useCallback((e: React.MouseEvent<HTMLElement>) => {\n\t\thandleSelect?.(entity, action)\n\t\tonClickProp?.(e)\n\t}, [action, entity, handleSelect, onClickProp])\n\treturn <Slot {...props} onClick={onClick}
|
|
1
|
+
{"version":3,"file":"SelectItemTrigger.js","sources":["../../../../../packages/react-select/src/components/SelectItemTrigger.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement, useCallback } from 'react'\nimport { useSelectHandleSelect } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\n\nexport type SelectItemTriggerProps = {\n\tchildren: ReactElement\n\taction?: 'select' | 'unselect' | 'toggle'\n\tonClick?: (event: React.MouseEvent<HTMLElement>) => void\n}\n\nexport const SelectItemTrigger = forwardRef<HTMLElement, SelectItemTriggerProps>(({ action, ...props }: SelectItemTriggerProps, ref) => {\n\tconst handleSelect = useSelectHandleSelect()\n\tconst entity = useEntity()\n\tconst onClickProp = props.onClick\n\tconst onClick = useCallback((e: React.MouseEvent<HTMLElement>) => {\n\t\thandleSelect?.(entity, action)\n\t\tonClickProp?.(e)\n\t}, [action, entity, handleSelect, onClickProp])\n\treturn <Slot {...props} onClick={onClick} ref={ref} />\n})\n"],"names":[],"mappings":";;;;;AAWO,MAAM,oBAAoB,WAAgD,CAAC,EAAE,QAAQ,GAAG,MAAA,GAAiC,QAAQ;AACvI,QAAM,eAAe,sBAAA;AACrB,QAAM,SAAS,UAAA;AACf,QAAM,cAAc,MAAM;AAC1B,QAAM,UAAU,YAAY,CAAC,MAAqC;AACjE,mBAAe,QAAQ,MAAM;AAC7B,kBAAc,CAAC;AAAA,EAChB,GAAG,CAAC,QAAQ,QAAQ,cAAc,WAAW,CAAC;AAC9C,SAAO,oBAAC,MAAA,EAAM,GAAG,OAAO,SAAkB,KAAU;AACrD,CAAC;"}
|
|
@@ -13,9 +13,20 @@ const SelectNewItem = ({ children }) => {
|
|
|
13
13
|
const getSubTree = reactBinding.useGetEntitySubTree();
|
|
14
14
|
React.useEffect(() => {
|
|
15
15
|
(async () => {
|
|
16
|
-
const treeRootId = await extendTree(
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const treeRootId = await extendTree(
|
|
17
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18
|
+
reactBinding.EntitySubTree,
|
|
19
|
+
{
|
|
20
|
+
entity: {
|
|
21
|
+
entityName
|
|
22
|
+
},
|
|
23
|
+
expectedMutation: "none",
|
|
24
|
+
isUnpersisted: true,
|
|
25
|
+
isCreating: true,
|
|
26
|
+
children
|
|
27
|
+
}
|
|
28
|
+
) })
|
|
29
|
+
);
|
|
19
30
|
if (!treeRootId) {
|
|
20
31
|
return;
|
|
21
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectNewItem.cjs","sources":["../../../../../packages/react-select/src/components/SelectNewItem.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"SelectNewItem.cjs","sources":["../../../../../packages/react-select/src/components/SelectNewItem.tsx"],"sourcesContent":["import {\n\tEntity,\n\tEntityAccessor,\n\tEntitySubTree,\n\tQueryLanguage,\n\tTreeRootId,\n\tTreeRootIdProvider,\n\tuseEnvironment,\n\tuseExtendTree,\n\tuseGetEntitySubTree,\n} from '@contember/react-binding'\nimport * as React from 'react'\nimport { ReactNode, useEffect, useMemo, useState } from 'react'\nimport { useSelectOptions } from '../contexts'\n\nexport const SelectNewItem = ({ children }: { children: ReactNode }) => {\n\tconst options = useSelectOptions()\n\tconst env = useEnvironment()\n\tconst { entityName } = useMemo(() => QueryLanguage.desugarQualifiedEntityList({ entities: options }, env), [env, options])\n\n\tconst [state, setState] = useState<{ entity: EntityAccessor; treeRootId: TreeRootId } | null>(null)\n\tconst extendTree = useExtendTree()\n\tconst getSubTree = useGetEntitySubTree()\n\n\tuseEffect(() => {\n\t\t;(async () => {\n\t\t\tconst treeRootId = await extendTree(\n\t\t\t\t<>\n\t\t\t\t\t<EntitySubTree\n\t\t\t\t\t\tentity={{\n\t\t\t\t\t\t\tentityName,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\texpectedMutation={'none'}\n\t\t\t\t\t\tisUnpersisted\n\t\t\t\t\t\tisCreating\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</EntitySubTree>\n\t\t\t\t</>,\n\t\t\t)\n\t\t\tif (!treeRootId) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst entity = getSubTree({\n\t\t\t\tentity: {\n\t\t\t\t\tentityName: entityName,\n\t\t\t\t},\n\t\t\t\tisCreating: true,\n\t\t\t}, treeRootId)\n\t\t\tsetState({\n\t\t\t\tentity,\n\t\t\t\ttreeRootId,\n\t\t\t})\n\t\t})()\n\t}, [children, entityName, extendTree, getSubTree])\n\n\tif (!state) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<TreeRootIdProvider treeRootId={state.treeRootId}>\n\t\t\t\t<Entity accessor={state.entity}>\n\t\t\t\t\t{children}\n\t\t\t\t</Entity>\n\t\t\t</TreeRootIdProvider>\n\t\t</>\n\t)\n}\n"],"names":["useSelectOptions","useEnvironment","useMemo","QueryLanguage","useState","useExtendTree","useGetEntitySubTree","useEffect","jsx","Fragment","EntitySubTree","TreeRootIdProvider","Entity"],"mappings":";;;;;;AAeO,MAAM,gBAAgB,CAAC,EAAE,eAAwC;AACvE,QAAM,UAAUA,SAAAA,iBAAA;AAChB,QAAM,MAAMC,aAAAA,eAAA;AACZ,QAAM,EAAE,WAAA,IAAeC,MAAAA,QAAQ,MAAMC,aAAAA,cAAc,2BAA2B,EAAE,UAAU,QAAA,GAAW,GAAG,GAAG,CAAC,KAAK,OAAO,CAAC;AAEzH,QAAM,CAAC,OAAO,QAAQ,IAAIC,MAAAA,SAAoE,IAAI;AAClG,QAAM,aAAaC,aAAAA,cAAA;AACnB,QAAM,aAAaC,aAAAA,oBAAA;AAEnBC,QAAAA,UAAU,MAAM;AACd,KAAC,YAAY;AACb,YAAM,aAAa,MAAM;AAAA,QACxBC,+BAAAC,WAAAA,UAAA,EACC,UAAAD,2BAAAA;AAAAA,UAACE,aAAAA;AAAAA,UAAA;AAAA,YACA,QAAQ;AAAA,cACP;AAAA,YAAA;AAAA,YAED,kBAAkB;AAAA,YAClB,eAAa;AAAA,YACb,YAAU;AAAA,YAET;AAAA,UAAA;AAAA,QAAA,EACF,CACD;AAAA,MAAA;AAED,UAAI,CAAC,YAAY;AAChB;AAAA,MACD;AAEA,YAAM,SAAS,WAAW;AAAA,QACzB,QAAQ;AAAA,UACP;AAAA,QAAA;AAAA,QAED,YAAY;AAAA,MAAA,GACV,UAAU;AACb,eAAS;AAAA,QACR;AAAA,QACA;AAAA,MAAA,CACA;AAAA,IACF,GAAA;AAAA,EACD,GAAG,CAAC,UAAU,YAAY,YAAY,UAAU,CAAC;AAEjD,MAAI,CAAC,OAAO;AACX,WAAO;AAAA,EACR;AAEA,SACCF,2BAAAA,IAAAC,WAAAA,UAAA,EACC,UAAAD,2BAAAA,IAACG,iCAAA,EAAmB,YAAY,MAAM,YACrC,UAAAH,+BAACI,aAAAA,QAAA,EAAO,UAAU,MAAM,QACtB,SAAA,CACF,GACD,GACD;AAEF;;"}
|
|
@@ -11,9 +11,20 @@ const SelectNewItem = ({ children }) => {
|
|
|
11
11
|
const getSubTree = useGetEntitySubTree();
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
(async () => {
|
|
14
|
-
const treeRootId = await extendTree(
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const treeRootId = await extendTree(
|
|
15
|
+
/* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
16
|
+
EntitySubTree,
|
|
17
|
+
{
|
|
18
|
+
entity: {
|
|
19
|
+
entityName
|
|
20
|
+
},
|
|
21
|
+
expectedMutation: "none",
|
|
22
|
+
isUnpersisted: true,
|
|
23
|
+
isCreating: true,
|
|
24
|
+
children
|
|
25
|
+
}
|
|
26
|
+
) })
|
|
27
|
+
);
|
|
17
28
|
if (!treeRootId) {
|
|
18
29
|
return;
|
|
19
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectNewItem.js","sources":["../../../../../packages/react-select/src/components/SelectNewItem.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"SelectNewItem.js","sources":["../../../../../packages/react-select/src/components/SelectNewItem.tsx"],"sourcesContent":["import {\n\tEntity,\n\tEntityAccessor,\n\tEntitySubTree,\n\tQueryLanguage,\n\tTreeRootId,\n\tTreeRootIdProvider,\n\tuseEnvironment,\n\tuseExtendTree,\n\tuseGetEntitySubTree,\n} from '@contember/react-binding'\nimport * as React from 'react'\nimport { ReactNode, useEffect, useMemo, useState } from 'react'\nimport { useSelectOptions } from '../contexts'\n\nexport const SelectNewItem = ({ children }: { children: ReactNode }) => {\n\tconst options = useSelectOptions()\n\tconst env = useEnvironment()\n\tconst { entityName } = useMemo(() => QueryLanguage.desugarQualifiedEntityList({ entities: options }, env), [env, options])\n\n\tconst [state, setState] = useState<{ entity: EntityAccessor; treeRootId: TreeRootId } | null>(null)\n\tconst extendTree = useExtendTree()\n\tconst getSubTree = useGetEntitySubTree()\n\n\tuseEffect(() => {\n\t\t;(async () => {\n\t\t\tconst treeRootId = await extendTree(\n\t\t\t\t<>\n\t\t\t\t\t<EntitySubTree\n\t\t\t\t\t\tentity={{\n\t\t\t\t\t\t\tentityName,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\texpectedMutation={'none'}\n\t\t\t\t\t\tisUnpersisted\n\t\t\t\t\t\tisCreating\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</EntitySubTree>\n\t\t\t\t</>,\n\t\t\t)\n\t\t\tif (!treeRootId) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst entity = getSubTree({\n\t\t\t\tentity: {\n\t\t\t\t\tentityName: entityName,\n\t\t\t\t},\n\t\t\t\tisCreating: true,\n\t\t\t}, treeRootId)\n\t\t\tsetState({\n\t\t\t\tentity,\n\t\t\t\ttreeRootId,\n\t\t\t})\n\t\t})()\n\t}, [children, entityName, extendTree, getSubTree])\n\n\tif (!state) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<TreeRootIdProvider treeRootId={state.treeRootId}>\n\t\t\t\t<Entity accessor={state.entity}>\n\t\t\t\t\t{children}\n\t\t\t\t</Entity>\n\t\t\t</TreeRootIdProvider>\n\t\t</>\n\t)\n}\n"],"names":[],"mappings":";;;;AAeO,MAAM,gBAAgB,CAAC,EAAE,eAAwC;AACvE,QAAM,UAAU,iBAAA;AAChB,QAAM,MAAM,eAAA;AACZ,QAAM,EAAE,WAAA,IAAe,QAAQ,MAAM,cAAc,2BAA2B,EAAE,UAAU,QAAA,GAAW,GAAG,GAAG,CAAC,KAAK,OAAO,CAAC;AAEzH,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAoE,IAAI;AAClG,QAAM,aAAa,cAAA;AACnB,QAAM,aAAa,oBAAA;AAEnB,YAAU,MAAM;AACd,KAAC,YAAY;AACb,YAAM,aAAa,MAAM;AAAA,QACxB,oBAAA,UAAA,EACC,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,QAAQ;AAAA,cACP;AAAA,YAAA;AAAA,YAED,kBAAkB;AAAA,YAClB,eAAa;AAAA,YACb,YAAU;AAAA,YAET;AAAA,UAAA;AAAA,QAAA,EACF,CACD;AAAA,MAAA;AAED,UAAI,CAAC,YAAY;AAChB;AAAA,MACD;AAEA,YAAM,SAAS,WAAW;AAAA,QACzB,QAAQ;AAAA,UACP;AAAA,QAAA;AAAA,QAED,YAAY;AAAA,MAAA,GACV,UAAU;AACb,eAAS;AAAA,QACR;AAAA,QACA;AAAA,MAAA,CACA;AAAA,IACF,GAAA;AAAA,EACD,GAAG,CAAC,UAAU,YAAY,YAAY,UAAU,CAAC;AAEjD,MAAI,CAAC,OAAO;AACX,WAAO;AAAA,EACR;AAEA,SACC,oBAAA,UAAA,EACC,UAAA,oBAAC,oBAAA,EAAmB,YAAY,MAAM,YACrC,UAAA,oBAAC,QAAA,EAAO,UAAU,MAAM,QACtB,SAAA,CACF,GACD,GACD;AAEF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectOption.cjs","sources":["../../../../../packages/react-select/src/components/SelectOption.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react'\nimport { useSelectIsSelected } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\nimport { dataAttribute } from '@contember/utilities'\n\nexport type SelectOptionProps = {\n\tchildren: ReactNode\n\taction?: 'select' | 'unselect' | 'toggle'\n}\n\nexport const SelectOption = forwardRef<HTMLElement, SelectOptionProps>(({ action, ...props }, ref) => {\n\tconst isSelected = useSelectIsSelected()\n\tconst entity = useEntity()\n\treturn (\n\t\t<Slot\n\t\t\tref={ref}\n\t\t\tdata-selected={dataAttribute(isSelected?.(entity))}\n\t\t\t{...props}\n\t\t/>\n\t)\n})\n"],"names":["forwardRef","useSelectIsSelected","useEntity","jsx","Slot","dataAttribute"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"SelectOption.cjs","sources":["../../../../../packages/react-select/src/components/SelectOption.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react'\nimport { useSelectIsSelected } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\nimport { dataAttribute } from '@contember/utilities'\n\nexport type SelectOptionProps = {\n\tchildren: ReactNode\n\taction?: 'select' | 'unselect' | 'toggle'\n}\n\nexport const SelectOption = forwardRef<HTMLElement, SelectOptionProps>(({ action, ...props }, ref) => {\n\tconst isSelected = useSelectIsSelected()\n\tconst entity = useEntity()\n\treturn (\n\t\t<Slot\n\t\t\tref={ref}\n\t\t\tdata-selected={dataAttribute(isSelected?.(entity))}\n\t\t\t{...props}\n\t\t/>\n\t)\n})\n"],"names":["forwardRef","useSelectIsSelected","useEntity","jsx","Slot","dataAttribute"],"mappings":";;;;;;;;AAWO,MAAM,eAAeA,MAAAA,WAA2C,CAAC,EAAE,QAAQ,GAAG,MAAA,GAAS,QAAQ;AACrG,QAAM,aAAaC,SAAAA,oBAAA;AACnB,QAAM,SAASC,aAAAA,UAAA;AACf,SACCC,2BAAAA;AAAAA,IAACC,UAAAA;AAAAA,IAAA;AAAA,MACA;AAAA,MACA,iBAAeC,UAAAA,cAAc,aAAa,MAAM,CAAC;AAAA,MAChD,GAAG;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectOption.js","sources":["../../../../../packages/react-select/src/components/SelectOption.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react'\nimport { useSelectIsSelected } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\nimport { dataAttribute } from '@contember/utilities'\n\nexport type SelectOptionProps = {\n\tchildren: ReactNode\n\taction?: 'select' | 'unselect' | 'toggle'\n}\n\nexport const SelectOption = forwardRef<HTMLElement, SelectOptionProps>(({ action, ...props }, ref) => {\n\tconst isSelected = useSelectIsSelected()\n\tconst entity = useEntity()\n\treturn (\n\t\t<Slot\n\t\t\tref={ref}\n\t\t\tdata-selected={dataAttribute(isSelected?.(entity))}\n\t\t\t{...props}\n\t\t/>\n\t)\n})\n"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"SelectOption.js","sources":["../../../../../packages/react-select/src/components/SelectOption.tsx"],"sourcesContent":["import React, { forwardRef, ReactNode } from 'react'\nimport { useSelectIsSelected } from '../contexts'\nimport { Slot } from '@radix-ui/react-slot'\nimport { useEntity } from '@contember/react-binding'\nimport { dataAttribute } from '@contember/utilities'\n\nexport type SelectOptionProps = {\n\tchildren: ReactNode\n\taction?: 'select' | 'unselect' | 'toggle'\n}\n\nexport const SelectOption = forwardRef<HTMLElement, SelectOptionProps>(({ action, ...props }, ref) => {\n\tconst isSelected = useSelectIsSelected()\n\tconst entity = useEntity()\n\treturn (\n\t\t<Slot\n\t\t\tref={ref}\n\t\t\tdata-selected={dataAttribute(isSelected?.(entity))}\n\t\t\t{...props}\n\t\t/>\n\t)\n})\n"],"names":[],"mappings":";;;;;;AAWO,MAAM,eAAe,WAA2C,CAAC,EAAE,QAAQ,GAAG,MAAA,GAAS,QAAQ;AACrG,QAAM,aAAa,oBAAA;AACnB,QAAM,SAAS,UAAA;AACf,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,iBAAe,cAAc,aAAa,MAAM,CAAC;AAAA,MAChD,GAAG;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectPlaceholder.cjs","sources":["../../../../../packages/react-select/src/components/SelectPlaceholder.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useSelectCurrentEntities } from '../contexts'\n\nexport const SelectPlaceholder = ({ children }: { children: ReactNode }) => {\n\tconst hasEntities = useSelectCurrentEntities().length > 0\n\treturn hasEntities ? null : <>{children}</>\n}\n"],"names":["useSelectCurrentEntities","jsx","Fragment"],"mappings":";;;;AAGO,MAAM,oBAAoB,CAAC,EAAE,eAAwC;
|
|
1
|
+
{"version":3,"file":"SelectPlaceholder.cjs","sources":["../../../../../packages/react-select/src/components/SelectPlaceholder.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useSelectCurrentEntities } from '../contexts'\n\nexport const SelectPlaceholder = ({ children }: { children: ReactNode }) => {\n\tconst hasEntities = useSelectCurrentEntities().length > 0\n\treturn hasEntities ? null : <>{children}</>\n}\n"],"names":["useSelectCurrentEntities","jsx","Fragment"],"mappings":";;;;AAGO,MAAM,oBAAoB,CAAC,EAAE,eAAwC;AAC3E,QAAM,cAAcA,SAAAA,2BAA2B,SAAS;AACxD,SAAO,cAAc,OAAOC,2BAAAA,IAAAC,WAAAA,UAAA,EAAG,SAAA,CAAS;AACzC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectPlaceholder.js","sources":["../../../../../packages/react-select/src/components/SelectPlaceholder.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useSelectCurrentEntities } from '../contexts'\n\nexport const SelectPlaceholder = ({ children }: { children: ReactNode }) => {\n\tconst hasEntities = useSelectCurrentEntities().length > 0\n\treturn hasEntities ? null : <>{children}</>\n}\n"],"names":[],"mappings":";;AAGO,MAAM,oBAAoB,CAAC,EAAE,eAAwC;
|
|
1
|
+
{"version":3,"file":"SelectPlaceholder.js","sources":["../../../../../packages/react-select/src/components/SelectPlaceholder.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useSelectCurrentEntities } from '../contexts'\n\nexport const SelectPlaceholder = ({ children }: { children: ReactNode }) => {\n\tconst hasEntities = useSelectCurrentEntities().length > 0\n\treturn hasEntities ? null : <>{children}</>\n}\n"],"names":[],"mappings":";;AAGO,MAAM,oBAAoB,CAAC,EAAE,eAAwC;AAC3E,QAAM,cAAc,2BAA2B,SAAS;AACxD,SAAO,cAAc,OAAO,oBAAA,UAAA,EAAG,SAAA,CAAS;AACzC;"}
|
|
@@ -6,45 +6,48 @@ const contexts = require("../contexts.cjs");
|
|
|
6
6
|
const reactBinding = require("@contember/react-binding");
|
|
7
7
|
const reactUtils = require("@contember/react-utils");
|
|
8
8
|
const reactRepeater = require("@contember/react-repeater");
|
|
9
|
-
const SortableMultiSelect = reactBinding.Component(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
const SortableMultiSelect = reactBinding.Component(
|
|
10
|
+
({ field, children, sortableBy, connectAt, options, onSelect, onUnselect }) => {
|
|
11
|
+
const list = reactBinding.useEntityList({ field });
|
|
12
|
+
const entitiesArr = React.useMemo(() => Array.from(list), [list]);
|
|
13
|
+
const optionsMarker = React.useMemo(() => {
|
|
14
|
+
const desugared = reactBinding.QueryLanguage.desugarRelativeSingleEntity({ field: connectAt }, list.environment);
|
|
15
|
+
let marker = list.getMarker();
|
|
16
|
+
for (let relation of desugared.hasOneRelationPath) {
|
|
17
|
+
const placeholder = reactBinding.PlaceholderGenerator.getHasOneRelationPlaceholder(relation);
|
|
18
|
+
const relationMarker = marker.fields.markers.get(placeholder);
|
|
19
|
+
if (!relationMarker || relationMarker instanceof reactBinding.FieldMarker) {
|
|
20
|
+
throw new Error("Invalid marker");
|
|
21
|
+
}
|
|
22
|
+
marker = relationMarker;
|
|
20
23
|
}
|
|
21
|
-
marker
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
action
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
24
|
+
return marker;
|
|
25
|
+
}, [connectAt, list]);
|
|
26
|
+
options ?? (options = optionsMarker.environment.getSubTreeNode().entity.name);
|
|
27
|
+
const selectedEntities = React.useMemo(() => Array.from(list).map((it) => it.getEntity({ field: connectAt }).id), [connectAt, list]);
|
|
28
|
+
const handler = reactUtils.useReferentiallyStableCallback((entity, action = "toggle") => {
|
|
29
|
+
const isSelected2 = selectedEntities.includes(entity.id);
|
|
30
|
+
if (action === "toggle") {
|
|
31
|
+
action = isSelected2 ? "unselect" : "select";
|
|
32
|
+
}
|
|
33
|
+
if (action === "unselect" && isSelected2) {
|
|
34
|
+
Array.from(list).find((it) => it.getEntity({ field: connectAt }).id === entity.id)?.deleteEntity();
|
|
35
|
+
onUnselect?.(entity);
|
|
36
|
+
} else if (action === "select" && !isSelected2) {
|
|
37
|
+
list.createNewEntity((getEntity) => {
|
|
38
|
+
getEntity().connectEntityAtField({ field: connectAt }, entity);
|
|
39
|
+
onSelect?.(entity);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const isSelected = React.useCallback((entity) => {
|
|
44
|
+
return selectedEntities.includes(entity.id);
|
|
45
|
+
}, [selectedEntities]);
|
|
46
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRepeater.Repeater, { field, sortableBy, initialEntityCount: 0, children: /* @__PURE__ */ jsxRuntime.jsx(contexts.SelectCurrentEntitiesContext.Provider, { value: entitiesArr, children: /* @__PURE__ */ jsxRuntime.jsx(contexts.SelectIsSelectedContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsxRuntime.jsx(contexts.SelectHandleSelectContext.Provider, { value: handler, children: /* @__PURE__ */ jsxRuntime.jsx(contexts.SelectOptionsContext.Provider, { value: options, children }) }) }) }) });
|
|
47
|
+
},
|
|
48
|
+
({ children, field, sortableBy, connectAt }) => {
|
|
49
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactRepeater.Repeater, { field, sortableBy, initialEntityCount: 0, children: /* @__PURE__ */ jsxRuntime.jsx(reactBinding.HasOne, { field: connectAt, expectedMutation: "connectOrDisconnect", children }) });
|
|
50
|
+
}
|
|
51
|
+
);
|
|
49
52
|
exports.SortableMultiSelect = SortableMultiSelect;
|
|
50
53
|
//# sourceMappingURL=SortableMultiSelect.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortableMultiSelect.cjs","sources":["../../../../../packages/react-select/src/components/SortableMultiSelect.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo } from 'react'\nimport { SelectCurrentEntitiesContext, SelectHandler, SelectHandleSelectContext, SelectIsSelectedContext, SelectOptionsContext } from '../contexts'\nimport {\n\tComponent,\n\tEntityAccessor,\n\tFieldMarker,\n\tHasOne,\n\
|
|
1
|
+
{"version":3,"file":"SortableMultiSelect.cjs","sources":["../../../../../packages/react-select/src/components/SortableMultiSelect.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo } from 'react'\nimport { SelectCurrentEntitiesContext, SelectHandler, SelectHandleSelectContext, SelectIsSelectedContext, SelectOptionsContext } from '../contexts'\nimport {\n\tComponent,\n\tEntityAccessor,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOne,\n\tHasOneRelationMarker,\n\tPlaceholderGenerator,\n\tQueryLanguage,\n\tSugaredQualifiedEntityList,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n\tuseEntityList,\n} from '@contember/react-binding'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\nimport { Repeater } from '@contember/react-repeater'\nimport { SelectEvents } from '../types'\n\nexport type SortableMultiSelectProps =\n\t& {\n\t\tchildren: ReactNode\n\t\tfield: SugaredRelativeEntityList['field']\n\t\toptions?: SugaredQualifiedEntityList['entities']\n\t\tsortableBy: SugaredRelativeSingleField['field']\n\t\tconnectAt: SugaredRelativeSingleEntity['field']\n\t}\n\t& SelectEvents\n\nexport const SortableMultiSelect = Component(\n\t({ field, children, sortableBy, connectAt, options, onSelect, onUnselect }: SortableMultiSelectProps) => {\n\t\tconst list = useEntityList({ field })\n\t\tconst entitiesArr = useMemo(() => Array.from(list), [list])\n\n\t\tconst optionsMarker = useMemo(() => {\n\t\t\tconst desugared = QueryLanguage.desugarRelativeSingleEntity({ field: connectAt }, list.environment)\n\t\t\tlet marker: HasOneRelationMarker | HasManyRelationMarker | EntitySubTreeMarker | EntityListSubTreeMarker = list.getMarker()\n\t\t\tfor (let relation of desugared.hasOneRelationPath) {\n\t\t\t\tconst placeholder = PlaceholderGenerator.getHasOneRelationPlaceholder(relation)\n\t\t\t\tconst relationMarker = marker.fields.markers.get(placeholder)\n\t\t\t\tif (!relationMarker || relationMarker instanceof FieldMarker) {\n\t\t\t\t\tthrow new Error('Invalid marker')\n\t\t\t\t}\n\t\t\t\tmarker = relationMarker\n\t\t\t}\n\t\t\treturn marker\n\t\t}, [connectAt, list])\n\n\t\toptions ??= optionsMarker.environment.getSubTreeNode().entity.name\n\n\t\tconst selectedEntities = useMemo(() => Array.from(list).map((it: EntityAccessor) => it.getEntity({ field: connectAt }).id), [connectAt, list])\n\n\t\tconst handler = useReferentiallyStableCallback<SelectHandler>((entity, action = 'toggle') => {\n\t\t\tconst isSelected = selectedEntities.includes(entity.id)\n\t\t\tif (action === 'toggle') {\n\t\t\t\taction = isSelected ? 'unselect' : 'select'\n\t\t\t}\n\t\t\tif (action === 'unselect' && isSelected) {\n\t\t\t\tArray.from(list).find((it: EntityAccessor) => it.getEntity({ field: connectAt }).id === entity.id)?.deleteEntity()\n\t\t\t\tonUnselect?.(entity)\n\t\t\t} else if (action === 'select' && !isSelected) {\n\t\t\t\tlist.createNewEntity(getEntity => {\n\t\t\t\t\tgetEntity().connectEntityAtField({ field: connectAt }, entity)\n\t\t\t\t\tonSelect?.(entity)\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t\tconst isSelected = useCallback((entity: EntityAccessor) => {\n\t\t\treturn selectedEntities.includes(entity.id)\n\t\t}, [selectedEntities])\n\n\t\treturn (\n\t\t\t<Repeater field={field} sortableBy={sortableBy} initialEntityCount={0}>\n\t\t\t\t<SelectCurrentEntitiesContext.Provider value={entitiesArr}>\n\t\t\t\t\t<SelectIsSelectedContext.Provider value={isSelected}>\n\t\t\t\t\t\t<SelectHandleSelectContext.Provider value={handler}>\n\t\t\t\t\t\t\t<SelectOptionsContext.Provider value={options}>\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</SelectOptionsContext.Provider>\n\t\t\t\t\t\t</SelectHandleSelectContext.Provider>\n\t\t\t\t\t</SelectIsSelectedContext.Provider>\n\t\t\t\t</SelectCurrentEntitiesContext.Provider>\n\t\t\t</Repeater>\n\t\t)\n\t},\n\t({ children, field, sortableBy, connectAt }) => {\n\t\treturn (\n\t\t\t<Repeater field={field} sortableBy={sortableBy} initialEntityCount={0}>\n\t\t\t\t<HasOne field={connectAt} expectedMutation=\"connectOrDisconnect\">\n\t\t\t\t\t{children}\n\t\t\t\t</HasOne>\n\t\t\t</Repeater>\n\t\t)\n\t},\n)\n"],"names":["Component","useEntityList","useMemo","QueryLanguage","PlaceholderGenerator","FieldMarker","useReferentiallyStableCallback","isSelected","useCallback","jsx","Repeater","SelectCurrentEntitiesContext","SelectIsSelectedContext","SelectHandleSelectContext","SelectOptionsContext","HasOne"],"mappings":";;;;;;;;AAiCO,MAAM,sBAAsBA,aAAAA;AAAAA,EAClC,CAAC,EAAE,OAAO,UAAU,YAAY,WAAW,SAAS,UAAU,iBAA2C;AACxG,UAAM,OAAOC,aAAAA,cAAc,EAAE,OAAO;AACpC,UAAM,cAAcC,MAAAA,QAAQ,MAAM,MAAM,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC;AAE1D,UAAM,gBAAgBA,MAAAA,QAAQ,MAAM;AACnC,YAAM,YAAYC,aAAAA,cAAc,4BAA4B,EAAE,OAAO,UAAA,GAAa,KAAK,WAAW;AAClG,UAAI,SAAuG,KAAK,UAAA;AAChH,eAAS,YAAY,UAAU,oBAAoB;AAClD,cAAM,cAAcC,aAAAA,qBAAqB,6BAA6B,QAAQ;AAC9E,cAAM,iBAAiB,OAAO,OAAO,QAAQ,IAAI,WAAW;AAC5D,YAAI,CAAC,kBAAkB,0BAA0BC,0BAAa;AAC7D,gBAAM,IAAI,MAAM,gBAAgB;AAAA,QACjC;AACA,iBAAS;AAAA,MACV;AACA,aAAO;AAAA,IACR,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,gBAAA,UAAY,cAAc,YAAY,eAAA,EAAiB,OAAO;AAE9D,UAAM,mBAAmBH,MAAAA,QAAQ,MAAM,MAAM,KAAK,IAAI,EAAE,IAAI,CAAC,OAAuB,GAAG,UAAU,EAAE,OAAO,WAAW,EAAE,EAAE,GAAG,CAAC,WAAW,IAAI,CAAC;AAE7I,UAAM,UAAUI,WAAAA,+BAA8C,CAAC,QAAQ,SAAS,aAAa;AAC5F,YAAMC,cAAa,iBAAiB,SAAS,OAAO,EAAE;AACtD,UAAI,WAAW,UAAU;AACxB,iBAASA,cAAa,aAAa;AAAA,MACpC;AACA,UAAI,WAAW,cAAcA,aAAY;AACxC,cAAM,KAAK,IAAI,EAAE,KAAK,CAAC,OAAuB,GAAG,UAAU,EAAE,OAAO,WAAW,EAAE,OAAO,OAAO,EAAE,GAAG,aAAA;AACpG,qBAAa,MAAM;AAAA,MACpB,WAAW,WAAW,YAAY,CAACA,aAAY;AAC9C,aAAK,gBAAgB,CAAA,cAAa;AACjC,oBAAA,EAAY,qBAAqB,EAAE,OAAO,UAAA,GAAa,MAAM;AAC7D,qBAAW,MAAM;AAAA,QAClB,CAAC;AAAA,MACF;AAAA,IACD,CAAC;AACD,UAAM,aAAaC,kBAAY,CAAC,WAA2B;AAC1D,aAAO,iBAAiB,SAAS,OAAO,EAAE;AAAA,IAC3C,GAAG,CAAC,gBAAgB,CAAC;AAErB,WACCC,2BAAAA,IAACC,cAAAA,UAAA,EAAS,OAAc,YAAwB,oBAAoB,GACnE,UAAAD,2BAAAA,IAACE,SAAAA,6BAA6B,UAA7B,EAAsC,OAAO,aAC7C,UAAAF,2BAAAA,IAACG,SAAAA,wBAAwB,UAAxB,EAAiC,OAAO,YACxC,UAAAH,2BAAAA,IAACI,SAAAA,0BAA0B,UAA1B,EAAmC,OAAO,SAC1C,UAAAJ,+BAACK,SAAAA,qBAAqB,UAArB,EAA8B,OAAO,SACpC,SAAA,CACF,EAAA,CACD,EAAA,CACD,GACD,GACD;AAAA,EAEF;AAAA,EACA,CAAC,EAAE,UAAU,OAAO,YAAY,gBAAgB;AAC/C,WACCL,2BAAAA,IAACC,cAAAA,UAAA,EAAS,OAAc,YAAwB,oBAAoB,GACnE,UAAAD,2BAAAA,IAACM,aAAAA,QAAA,EAAO,OAAO,WAAW,kBAAiB,uBACzC,UACF,GACD;AAAA,EAEF;AACD;;"}
|
|
@@ -4,46 +4,49 @@ import { SelectCurrentEntitiesContext, SelectIsSelectedContext, SelectHandleSele
|
|
|
4
4
|
import { Component, useEntityList, QueryLanguage, PlaceholderGenerator, FieldMarker, HasOne } from "@contember/react-binding";
|
|
5
5
|
import { useReferentiallyStableCallback } from "@contember/react-utils";
|
|
6
6
|
import { Repeater } from "@contember/react-repeater";
|
|
7
|
-
const SortableMultiSelect = Component(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
const SortableMultiSelect = Component(
|
|
8
|
+
({ field, children, sortableBy, connectAt, options, onSelect, onUnselect }) => {
|
|
9
|
+
const list = useEntityList({ field });
|
|
10
|
+
const entitiesArr = useMemo(() => Array.from(list), [list]);
|
|
11
|
+
const optionsMarker = useMemo(() => {
|
|
12
|
+
const desugared = QueryLanguage.desugarRelativeSingleEntity({ field: connectAt }, list.environment);
|
|
13
|
+
let marker = list.getMarker();
|
|
14
|
+
for (let relation of desugared.hasOneRelationPath) {
|
|
15
|
+
const placeholder = PlaceholderGenerator.getHasOneRelationPlaceholder(relation);
|
|
16
|
+
const relationMarker = marker.fields.markers.get(placeholder);
|
|
17
|
+
if (!relationMarker || relationMarker instanceof FieldMarker) {
|
|
18
|
+
throw new Error("Invalid marker");
|
|
19
|
+
}
|
|
20
|
+
marker = relationMarker;
|
|
18
21
|
}
|
|
19
|
-
marker
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
action
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
22
|
+
return marker;
|
|
23
|
+
}, [connectAt, list]);
|
|
24
|
+
options ?? (options = optionsMarker.environment.getSubTreeNode().entity.name);
|
|
25
|
+
const selectedEntities = useMemo(() => Array.from(list).map((it) => it.getEntity({ field: connectAt }).id), [connectAt, list]);
|
|
26
|
+
const handler = useReferentiallyStableCallback((entity, action = "toggle") => {
|
|
27
|
+
const isSelected2 = selectedEntities.includes(entity.id);
|
|
28
|
+
if (action === "toggle") {
|
|
29
|
+
action = isSelected2 ? "unselect" : "select";
|
|
30
|
+
}
|
|
31
|
+
if (action === "unselect" && isSelected2) {
|
|
32
|
+
Array.from(list).find((it) => it.getEntity({ field: connectAt }).id === entity.id)?.deleteEntity();
|
|
33
|
+
onUnselect?.(entity);
|
|
34
|
+
} else if (action === "select" && !isSelected2) {
|
|
35
|
+
list.createNewEntity((getEntity) => {
|
|
36
|
+
getEntity().connectEntityAtField({ field: connectAt }, entity);
|
|
37
|
+
onSelect?.(entity);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const isSelected = useCallback((entity) => {
|
|
42
|
+
return selectedEntities.includes(entity.id);
|
|
43
|
+
}, [selectedEntities]);
|
|
44
|
+
return /* @__PURE__ */ jsx(Repeater, { field, sortableBy, initialEntityCount: 0, children: /* @__PURE__ */ jsx(SelectCurrentEntitiesContext.Provider, { value: entitiesArr, children: /* @__PURE__ */ jsx(SelectIsSelectedContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsx(SelectHandleSelectContext.Provider, { value: handler, children: /* @__PURE__ */ jsx(SelectOptionsContext.Provider, { value: options, children }) }) }) }) });
|
|
45
|
+
},
|
|
46
|
+
({ children, field, sortableBy, connectAt }) => {
|
|
47
|
+
return /* @__PURE__ */ jsx(Repeater, { field, sortableBy, initialEntityCount: 0, children: /* @__PURE__ */ jsx(HasOne, { field: connectAt, expectedMutation: "connectOrDisconnect", children }) });
|
|
48
|
+
}
|
|
49
|
+
);
|
|
47
50
|
export {
|
|
48
51
|
SortableMultiSelect
|
|
49
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortableMultiSelect.js","sources":["../../../../../packages/react-select/src/components/SortableMultiSelect.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo } from 'react'\nimport { SelectCurrentEntitiesContext, SelectHandler, SelectHandleSelectContext, SelectIsSelectedContext, SelectOptionsContext } from '../contexts'\nimport {\n\tComponent,\n\tEntityAccessor,\n\tFieldMarker,\n\tHasOne,\n\
|
|
1
|
+
{"version":3,"file":"SortableMultiSelect.js","sources":["../../../../../packages/react-select/src/components/SortableMultiSelect.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo } from 'react'\nimport { SelectCurrentEntitiesContext, SelectHandler, SelectHandleSelectContext, SelectIsSelectedContext, SelectOptionsContext } from '../contexts'\nimport {\n\tComponent,\n\tEntityAccessor,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOne,\n\tHasOneRelationMarker,\n\tPlaceholderGenerator,\n\tQueryLanguage,\n\tSugaredQualifiedEntityList,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n\tuseEntityList,\n} from '@contember/react-binding'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\nimport { Repeater } from '@contember/react-repeater'\nimport { SelectEvents } from '../types'\n\nexport type SortableMultiSelectProps =\n\t& {\n\t\tchildren: ReactNode\n\t\tfield: SugaredRelativeEntityList['field']\n\t\toptions?: SugaredQualifiedEntityList['entities']\n\t\tsortableBy: SugaredRelativeSingleField['field']\n\t\tconnectAt: SugaredRelativeSingleEntity['field']\n\t}\n\t& SelectEvents\n\nexport const SortableMultiSelect = Component(\n\t({ field, children, sortableBy, connectAt, options, onSelect, onUnselect }: SortableMultiSelectProps) => {\n\t\tconst list = useEntityList({ field })\n\t\tconst entitiesArr = useMemo(() => Array.from(list), [list])\n\n\t\tconst optionsMarker = useMemo(() => {\n\t\t\tconst desugared = QueryLanguage.desugarRelativeSingleEntity({ field: connectAt }, list.environment)\n\t\t\tlet marker: HasOneRelationMarker | HasManyRelationMarker | EntitySubTreeMarker | EntityListSubTreeMarker = list.getMarker()\n\t\t\tfor (let relation of desugared.hasOneRelationPath) {\n\t\t\t\tconst placeholder = PlaceholderGenerator.getHasOneRelationPlaceholder(relation)\n\t\t\t\tconst relationMarker = marker.fields.markers.get(placeholder)\n\t\t\t\tif (!relationMarker || relationMarker instanceof FieldMarker) {\n\t\t\t\t\tthrow new Error('Invalid marker')\n\t\t\t\t}\n\t\t\t\tmarker = relationMarker\n\t\t\t}\n\t\t\treturn marker\n\t\t}, [connectAt, list])\n\n\t\toptions ??= optionsMarker.environment.getSubTreeNode().entity.name\n\n\t\tconst selectedEntities = useMemo(() => Array.from(list).map((it: EntityAccessor) => it.getEntity({ field: connectAt }).id), [connectAt, list])\n\n\t\tconst handler = useReferentiallyStableCallback<SelectHandler>((entity, action = 'toggle') => {\n\t\t\tconst isSelected = selectedEntities.includes(entity.id)\n\t\t\tif (action === 'toggle') {\n\t\t\t\taction = isSelected ? 'unselect' : 'select'\n\t\t\t}\n\t\t\tif (action === 'unselect' && isSelected) {\n\t\t\t\tArray.from(list).find((it: EntityAccessor) => it.getEntity({ field: connectAt }).id === entity.id)?.deleteEntity()\n\t\t\t\tonUnselect?.(entity)\n\t\t\t} else if (action === 'select' && !isSelected) {\n\t\t\t\tlist.createNewEntity(getEntity => {\n\t\t\t\t\tgetEntity().connectEntityAtField({ field: connectAt }, entity)\n\t\t\t\t\tonSelect?.(entity)\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t\tconst isSelected = useCallback((entity: EntityAccessor) => {\n\t\t\treturn selectedEntities.includes(entity.id)\n\t\t}, [selectedEntities])\n\n\t\treturn (\n\t\t\t<Repeater field={field} sortableBy={sortableBy} initialEntityCount={0}>\n\t\t\t\t<SelectCurrentEntitiesContext.Provider value={entitiesArr}>\n\t\t\t\t\t<SelectIsSelectedContext.Provider value={isSelected}>\n\t\t\t\t\t\t<SelectHandleSelectContext.Provider value={handler}>\n\t\t\t\t\t\t\t<SelectOptionsContext.Provider value={options}>\n\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t</SelectOptionsContext.Provider>\n\t\t\t\t\t\t</SelectHandleSelectContext.Provider>\n\t\t\t\t\t</SelectIsSelectedContext.Provider>\n\t\t\t\t</SelectCurrentEntitiesContext.Provider>\n\t\t\t</Repeater>\n\t\t)\n\t},\n\t({ children, field, sortableBy, connectAt }) => {\n\t\treturn (\n\t\t\t<Repeater field={field} sortableBy={sortableBy} initialEntityCount={0}>\n\t\t\t\t<HasOne field={connectAt} expectedMutation=\"connectOrDisconnect\">\n\t\t\t\t\t{children}\n\t\t\t\t</HasOne>\n\t\t\t</Repeater>\n\t\t)\n\t},\n)\n"],"names":["isSelected"],"mappings":";;;;;;AAiCO,MAAM,sBAAsB;AAAA,EAClC,CAAC,EAAE,OAAO,UAAU,YAAY,WAAW,SAAS,UAAU,iBAA2C;AACxG,UAAM,OAAO,cAAc,EAAE,OAAO;AACpC,UAAM,cAAc,QAAQ,MAAM,MAAM,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC;AAE1D,UAAM,gBAAgB,QAAQ,MAAM;AACnC,YAAM,YAAY,cAAc,4BAA4B,EAAE,OAAO,UAAA,GAAa,KAAK,WAAW;AAClG,UAAI,SAAuG,KAAK,UAAA;AAChH,eAAS,YAAY,UAAU,oBAAoB;AAClD,cAAM,cAAc,qBAAqB,6BAA6B,QAAQ;AAC9E,cAAM,iBAAiB,OAAO,OAAO,QAAQ,IAAI,WAAW;AAC5D,YAAI,CAAC,kBAAkB,0BAA0B,aAAa;AAC7D,gBAAM,IAAI,MAAM,gBAAgB;AAAA,QACjC;AACA,iBAAS;AAAA,MACV;AACA,aAAO;AAAA,IACR,GAAG,CAAC,WAAW,IAAI,CAAC;AAEpB,gBAAA,UAAY,cAAc,YAAY,eAAA,EAAiB,OAAO;AAE9D,UAAM,mBAAmB,QAAQ,MAAM,MAAM,KAAK,IAAI,EAAE,IAAI,CAAC,OAAuB,GAAG,UAAU,EAAE,OAAO,WAAW,EAAE,EAAE,GAAG,CAAC,WAAW,IAAI,CAAC;AAE7I,UAAM,UAAU,+BAA8C,CAAC,QAAQ,SAAS,aAAa;AAC5F,YAAMA,cAAa,iBAAiB,SAAS,OAAO,EAAE;AACtD,UAAI,WAAW,UAAU;AACxB,iBAASA,cAAa,aAAa;AAAA,MACpC;AACA,UAAI,WAAW,cAAcA,aAAY;AACxC,cAAM,KAAK,IAAI,EAAE,KAAK,CAAC,OAAuB,GAAG,UAAU,EAAE,OAAO,WAAW,EAAE,OAAO,OAAO,EAAE,GAAG,aAAA;AACpG,qBAAa,MAAM;AAAA,MACpB,WAAW,WAAW,YAAY,CAACA,aAAY;AAC9C,aAAK,gBAAgB,CAAA,cAAa;AACjC,oBAAA,EAAY,qBAAqB,EAAE,OAAO,UAAA,GAAa,MAAM;AAC7D,qBAAW,MAAM;AAAA,QAClB,CAAC;AAAA,MACF;AAAA,IACD,CAAC;AACD,UAAM,aAAa,YAAY,CAAC,WAA2B;AAC1D,aAAO,iBAAiB,SAAS,OAAO,EAAE;AAAA,IAC3C,GAAG,CAAC,gBAAgB,CAAC;AAErB,WACC,oBAAC,UAAA,EAAS,OAAc,YAAwB,oBAAoB,GACnE,UAAA,oBAAC,6BAA6B,UAA7B,EAAsC,OAAO,aAC7C,UAAA,oBAAC,wBAAwB,UAAxB,EAAiC,OAAO,YACxC,UAAA,oBAAC,0BAA0B,UAA1B,EAAmC,OAAO,SAC1C,UAAA,oBAAC,qBAAqB,UAArB,EAA8B,OAAO,SACpC,SAAA,CACF,EAAA,CACD,EAAA,CACD,GACD,GACD;AAAA,EAEF;AAAA,EACA,CAAC,EAAE,UAAU,OAAO,YAAY,gBAAgB;AAC/C,WACC,oBAAC,UAAA,EAAS,OAAc,YAAwB,oBAAoB,GACnE,UAAA,oBAAC,QAAA,EAAO,OAAO,WAAW,kBAAiB,uBACzC,UACF,GACD;AAAA,EAEF;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.cjs","sources":["../../../../packages/react-select/src/contexts.ts"],"sourcesContent":["import { createRequiredContext } from '@contember/react-utils'\nimport { EntityAccessor, SugaredQualifiedEntityList } from '@contember/react-binding'\nimport { DataViewFilterHandler, TextFilterArtifacts } from '@contember/react-dataview'\n\nconst _SelectCurrentEntitiesContext = createRequiredContext<EntityAccessor[]>('SelectCurrentEntitiesContext')\n/** @internal */\nexport const SelectCurrentEntitiesContext = _SelectCurrentEntitiesContext[0]\nexport const useSelectCurrentEntities = _SelectCurrentEntitiesContext[1]\n\
|
|
1
|
+
{"version":3,"file":"contexts.cjs","sources":["../../../../packages/react-select/src/contexts.ts"],"sourcesContent":["import { createRequiredContext } from '@contember/react-utils'\nimport { EntityAccessor, SugaredQualifiedEntityList } from '@contember/react-binding'\nimport { DataViewFilterHandler, TextFilterArtifacts } from '@contember/react-dataview'\n\nconst _SelectCurrentEntitiesContext = createRequiredContext<EntityAccessor[]>('SelectCurrentEntitiesContext')\n/** @internal */\nexport const SelectCurrentEntitiesContext = _SelectCurrentEntitiesContext[0]\nexport const useSelectCurrentEntities = _SelectCurrentEntitiesContext[1]\n\nconst _SelectIsSelectedContext = createRequiredContext<(entity: EntityAccessor) => boolean>('SelectIsSelectedContext')\n/** @internal */\nexport const SelectIsSelectedContext = _SelectIsSelectedContext[0]\nexport const useSelectIsSelected = _SelectIsSelectedContext[1]\n\nexport type SelectHandler = (entity: EntityAccessor, action?: 'select' | 'unselect' | 'toggle') => void\nconst _SelectHandleSelectContext = createRequiredContext<SelectHandler>('SelectHandleSelectContext')\n/** @internal */\nexport const SelectHandleSelectContext = _SelectHandleSelectContext[0]\nexport const useSelectHandleSelect = _SelectHandleSelectContext[1]\n\nconst _SelectOptionsContext = createRequiredContext<SugaredQualifiedEntityList['entities']>('SelectOptionsContext')\n/** @internal */\nexport const SelectOptionsContext = _SelectOptionsContext[0]\nexport const useSelectOptions = _SelectOptionsContext[1]\n"],"names":["createRequiredContext"],"mappings":";;;AAIA,MAAM,gCAAgCA,WAAAA,sBAAwC,8BAA8B;AAErG,MAAM,+BAA+B,8BAA8B,CAAC;AACpE,MAAM,2BAA2B,8BAA8B,CAAC;AAEvE,MAAM,2BAA2BA,WAAAA,sBAA2D,yBAAyB;AAE9G,MAAM,0BAA0B,yBAAyB,CAAC;AAC1D,MAAM,sBAAsB,yBAAyB,CAAC;AAG7D,MAAM,6BAA6BA,WAAAA,sBAAqC,2BAA2B;AAE5F,MAAM,4BAA4B,2BAA2B,CAAC;AAC9D,MAAM,wBAAwB,2BAA2B,CAAC;AAEjE,MAAM,wBAAwBA,WAAAA,sBAA8D,sBAAsB;AAE3G,MAAM,uBAAuB,sBAAsB,CAAC;AACpD,MAAM,mBAAmB,sBAAsB,CAAC;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.js","sources":["../../../../packages/react-select/src/contexts.ts"],"sourcesContent":["import { createRequiredContext } from '@contember/react-utils'\nimport { EntityAccessor, SugaredQualifiedEntityList } from '@contember/react-binding'\nimport { DataViewFilterHandler, TextFilterArtifacts } from '@contember/react-dataview'\n\nconst _SelectCurrentEntitiesContext = createRequiredContext<EntityAccessor[]>('SelectCurrentEntitiesContext')\n/** @internal */\nexport const SelectCurrentEntitiesContext = _SelectCurrentEntitiesContext[0]\nexport const useSelectCurrentEntities = _SelectCurrentEntitiesContext[1]\n\
|
|
1
|
+
{"version":3,"file":"contexts.js","sources":["../../../../packages/react-select/src/contexts.ts"],"sourcesContent":["import { createRequiredContext } from '@contember/react-utils'\nimport { EntityAccessor, SugaredQualifiedEntityList } from '@contember/react-binding'\nimport { DataViewFilterHandler, TextFilterArtifacts } from '@contember/react-dataview'\n\nconst _SelectCurrentEntitiesContext = createRequiredContext<EntityAccessor[]>('SelectCurrentEntitiesContext')\n/** @internal */\nexport const SelectCurrentEntitiesContext = _SelectCurrentEntitiesContext[0]\nexport const useSelectCurrentEntities = _SelectCurrentEntitiesContext[1]\n\nconst _SelectIsSelectedContext = createRequiredContext<(entity: EntityAccessor) => boolean>('SelectIsSelectedContext')\n/** @internal */\nexport const SelectIsSelectedContext = _SelectIsSelectedContext[0]\nexport const useSelectIsSelected = _SelectIsSelectedContext[1]\n\nexport type SelectHandler = (entity: EntityAccessor, action?: 'select' | 'unselect' | 'toggle') => void\nconst _SelectHandleSelectContext = createRequiredContext<SelectHandler>('SelectHandleSelectContext')\n/** @internal */\nexport const SelectHandleSelectContext = _SelectHandleSelectContext[0]\nexport const useSelectHandleSelect = _SelectHandleSelectContext[1]\n\nconst _SelectOptionsContext = createRequiredContext<SugaredQualifiedEntityList['entities']>('SelectOptionsContext')\n/** @internal */\nexport const SelectOptionsContext = _SelectOptionsContext[0]\nexport const useSelectOptions = _SelectOptionsContext[1]\n"],"names":[],"mappings":";AAIA,MAAM,gCAAgC,sBAAwC,8BAA8B;AAErG,MAAM,+BAA+B,8BAA8B,CAAC;AACpE,MAAM,2BAA2B,8BAA8B,CAAC;AAEvE,MAAM,2BAA2B,sBAA2D,yBAAyB;AAE9G,MAAM,0BAA0B,yBAAyB,CAAC;AAC1D,MAAM,sBAAsB,yBAAyB,CAAC;AAG7D,MAAM,6BAA6B,sBAAqC,2BAA2B;AAE5F,MAAM,4BAA4B,2BAA2B,CAAC;AAC9D,MAAM,wBAAwB,2BAA2B,CAAC;AAEjE,MAAM,wBAAwB,sBAA8D,sBAAsB;AAE3G,MAAM,uBAAuB,sBAAsB,CAAC;AACpD,MAAM,mBAAmB,sBAAsB,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectDataView.d.ts","sourceRoot":"","sources":["../../../src/components/SelectDataView.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAW,MAAM,OAAO,CAAA;AAEjD,OAAO,
|
|
1
|
+
{"version":3,"file":"SelectDataView.d.ts","sourceRoot":"","sources":["../../../src/components/SelectDataView.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAW,MAAM,OAAO,CAAA;AAEjD,OAAO,EAA2C,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAElG,MAAM,MAAM,mBAAmB,GAC5B,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,GAC/B;IACD,QAAQ,EAAE,SAAS,CAAA;CACnB,CAAA;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,4CAcxD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectEachItem.d.ts","sourceRoot":"","sources":["../../../src/components/SelectEachItem.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"SelectEachItem.d.ts","sourceRoot":"","sources":["../../../src/components/SelectEachItem.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIxC,eAAO,MAAM,eAAe,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,8CAOpE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectNewItem.d.ts","sourceRoot":"","sources":["../../../src/components/SelectNewItem.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectNewItem.d.ts","sourceRoot":"","sources":["../../../src/components/SelectNewItem.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAAgC,MAAM,OAAO,CAAA;AAG/D,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,mDAuDlE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortableMultiSelect.d.ts","sourceRoot":"","sources":["../../../src/components/SortableMultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAA;AAE9D,OAAO,
|
|
1
|
+
{"version":3,"file":"SortableMultiSelect.d.ts","sourceRoot":"","sources":["../../../src/components/SortableMultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAA;AAE9D,OAAO,EAWN,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,EAE1B,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,MAAM,MAAM,wBAAwB,GACjC;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAA;IACzC,OAAO,CAAC,EAAE,0BAA0B,CAAC,UAAU,CAAC,CAAA;IAChD,UAAU,EAAE,0BAA0B,CAAC,OAAO,CAAC,CAAA;IAC/C,SAAS,EAAE,2BAA2B,CAAC,OAAO,CAAC,CAAA;CAC/C,GACC,YAAY,CAAA;AAEf,eAAO,MAAM,mBAAmB;cARpB,SAAS;WACZ,yBAAyB,CAAC,OAAO,CAAC;cAC/B,0BAA0B,CAAC,UAAU,CAAC;gBACpC,0BAA0B,CAAC,OAAO,CAAC;eACpC,2BAA2B,CAAC,OAAO,CAAC;iBAqEhD,CAAA"}
|
package/dist/types/contexts.d.ts
CHANGED
|
@@ -11,13 +11,13 @@ export declare const SelectHandleSelectContext: import("react").Context<SelectHa
|
|
|
11
11
|
export declare const useSelectHandleSelect: () => SelectHandler;
|
|
12
12
|
/** @internal */
|
|
13
13
|
export declare const SelectOptionsContext: import("react").Context<string | {
|
|
14
|
-
filter?: import("@contember/
|
|
15
|
-
hasOneRelationPath?: import("@contember/
|
|
16
|
-
entityName: import("@contember/
|
|
14
|
+
filter?: import("@contember/binding-common").SugaredFilter;
|
|
15
|
+
hasOneRelationPath?: import("@contember/binding-common").SugarableHasOneRelation[] | import("@contember/binding-common").SugarableHasOneRelation;
|
|
16
|
+
entityName: import("@contember/binding-common").EntityName;
|
|
17
17
|
}>;
|
|
18
18
|
export declare const useSelectOptions: () => string | {
|
|
19
|
-
filter?: import("@contember/
|
|
20
|
-
hasOneRelationPath?: import("@contember/
|
|
21
|
-
entityName: import("@contember/
|
|
19
|
+
filter?: import("@contember/binding-common").SugaredFilter;
|
|
20
|
+
hasOneRelationPath?: import("@contember/binding-common").SugarableHasOneRelation[] | import("@contember/binding-common").SugarableHasOneRelation;
|
|
21
|
+
entityName: import("@contember/binding-common").EntityName;
|
|
22
22
|
};
|
|
23
23
|
//# sourceMappingURL=contexts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../src/contexts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAA8B,MAAM,0BAA0B,CAAA;AAIrF,gBAAgB;AAChB,eAAO,MAAM,4BAA4B,2CAAmC,CAAA;AAC5E,eAAO,MAAM,wBAAwB,wBAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../src/contexts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAA8B,MAAM,0BAA0B,CAAA;AAIrF,gBAAgB;AAChB,eAAO,MAAM,4BAA4B,2CAAmC,CAAA;AAC5E,eAAO,MAAM,wBAAwB,wBAAmC,CAAA;AAGxE,gBAAgB;AAChB,eAAO,MAAM,uBAAuB,mCAF4B,cAAc,KAAK,OAAO,CAExB,CAAA;AAClE,eAAO,MAAM,mBAAmB,iBAHgC,cAAc,KAAK,OAGrB,CAAA;AAE9D,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,KAAK,IAAI,CAAA;AAEvG,gBAAgB;AAChB,eAAO,MAAM,yBAAyB,wCAAgC,CAAA;AACtE,eAAO,MAAM,qBAAqB,qBAAgC,CAAA;AAGlE,gBAAgB;AAChB,eAAO,MAAM,oBAAoB;;;;EAA2B,CAAA;AAC5D,eAAO,MAAM,gBAAgB;;;;CAA2B,CAAA"}
|