@contember/react-select 2.1.0-alpha.37 → 2.1.0-alpha.39
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/development/index.cjs +30 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +30 -0
- package/dist/development/index.js.map +1 -0
- package/dist/development/src/components/MultiSelect.cjs +54 -0
- package/dist/development/src/components/MultiSelect.cjs.map +1 -0
- package/dist/development/src/components/MultiSelect.js +54 -0
- package/dist/development/src/components/MultiSelect.js.map +1 -0
- package/dist/development/src/components/Select.cjs +52 -0
- package/dist/development/src/components/Select.cjs.map +1 -0
- package/dist/development/src/components/Select.js +52 -0
- package/dist/development/src/components/Select.js.map +1 -0
- package/dist/development/src/components/SelectDataView.cjs +30 -0
- package/dist/development/src/components/SelectDataView.cjs.map +1 -0
- package/dist/development/src/components/SelectDataView.js +30 -0
- package/dist/development/src/components/SelectDataView.js.map +1 -0
- package/dist/development/src/components/SelectEachItem.cjs +15 -0
- package/dist/development/src/components/SelectEachItem.cjs.map +1 -0
- package/dist/development/src/components/SelectEachItem.js +15 -0
- package/dist/development/src/components/SelectEachItem.js.map +1 -0
- package/dist/development/src/components/SelectItemTrigger.cjs +23 -0
- package/dist/development/src/components/SelectItemTrigger.cjs.map +1 -0
- package/dist/development/src/components/SelectItemTrigger.js +23 -0
- package/dist/development/src/components/SelectItemTrigger.js.map +1 -0
- package/dist/development/src/components/SelectNewItem.cjs +75 -0
- package/dist/development/src/components/SelectNewItem.cjs.map +1 -0
- package/dist/development/src/components/SelectNewItem.js +75 -0
- package/dist/development/src/components/SelectNewItem.js.map +1 -0
- package/dist/development/src/components/SelectOption.cjs +30 -0
- package/dist/development/src/components/SelectOption.cjs.map +1 -0
- package/dist/development/src/components/SelectOption.js +30 -0
- package/dist/development/src/components/SelectOption.js.map +1 -0
- package/dist/development/src/components/SelectPlaceholder.cjs +14 -0
- package/dist/development/src/components/SelectPlaceholder.cjs.map +1 -0
- package/dist/development/src/components/SelectPlaceholder.js +14 -0
- package/dist/development/src/components/SelectPlaceholder.js.map +1 -0
- package/dist/development/src/components/SortableMultiSelect.cjs +81 -0
- package/dist/development/src/components/SortableMultiSelect.cjs.map +1 -0
- package/dist/development/src/components/SortableMultiSelect.js +81 -0
- package/dist/development/src/components/SortableMultiSelect.js.map +1 -0
- package/dist/development/src/contexts.cjs +24 -0
- package/dist/development/src/contexts.cjs.map +1 -0
- package/dist/development/src/contexts.js +24 -0
- package/dist/development/src/contexts.js.map +1 -0
- package/dist/production/index.cjs +30 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.js +30 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/src/components/MultiSelect.cjs +34 -0
- package/dist/production/src/components/MultiSelect.cjs.map +1 -0
- package/dist/production/src/components/MultiSelect.js +34 -0
- package/dist/production/src/components/MultiSelect.js.map +1 -0
- package/dist/production/src/components/Select.cjs +32 -0
- package/dist/production/src/components/Select.cjs.map +1 -0
- package/dist/production/src/components/Select.js +32 -0
- package/dist/production/src/components/Select.js.map +1 -0
- package/dist/production/src/components/SelectDataView.cjs +22 -0
- package/dist/production/src/components/SelectDataView.cjs.map +1 -0
- package/dist/production/src/components/SelectDataView.js +22 -0
- package/dist/production/src/components/SelectDataView.js.map +1 -0
- package/dist/production/src/components/SelectEachItem.cjs +11 -0
- package/dist/production/src/components/SelectEachItem.cjs.map +1 -0
- package/dist/production/src/components/SelectEachItem.js +11 -0
- package/dist/production/src/components/SelectEachItem.js.map +1 -0
- package/dist/production/src/components/SelectItemTrigger.cjs +19 -0
- package/dist/production/src/components/SelectItemTrigger.cjs.map +1 -0
- package/dist/production/src/components/SelectItemTrigger.js +19 -0
- package/dist/production/src/components/SelectItemTrigger.js.map +1 -0
- package/dist/production/src/components/SelectNewItem.cjs +51 -0
- package/dist/production/src/components/SelectNewItem.cjs.map +1 -0
- package/dist/production/src/components/SelectNewItem.js +51 -0
- package/dist/production/src/components/SelectNewItem.js.map +1 -0
- package/dist/production/src/components/SelectOption.cjs +22 -0
- package/dist/production/src/components/SelectOption.cjs.map +1 -0
- package/dist/production/src/components/SelectOption.js +22 -0
- package/dist/production/src/components/SelectOption.js.map +1 -0
- package/dist/production/src/components/SelectPlaceholder.cjs +10 -0
- package/dist/production/src/components/SelectPlaceholder.cjs.map +1 -0
- package/dist/production/src/components/SelectPlaceholder.js +10 -0
- package/dist/production/src/components/SelectPlaceholder.js.map +1 -0
- package/dist/production/src/components/SortableMultiSelect.cjs +53 -0
- package/dist/production/src/components/SortableMultiSelect.cjs.map +1 -0
- package/dist/production/src/components/SortableMultiSelect.js +53 -0
- package/dist/production/src/components/SortableMultiSelect.js.map +1 -0
- package/dist/production/src/contexts.cjs +24 -0
- package/dist/production/src/contexts.cjs.map +1 -0
- package/dist/production/src/contexts.js +24 -0
- package/dist/production/src/contexts.js.map +1 -0
- package/dist/types/components/MultiSelect.d.ts +14 -0
- package/dist/types/components/MultiSelect.d.ts.map +1 -0
- package/dist/types/components/Select.d.ts +16 -0
- package/dist/types/components/Select.d.ts.map +1 -0
- package/dist/types/components/SelectDataView.d.ts +7 -0
- package/dist/types/components/SelectDataView.d.ts.map +1 -0
- package/dist/types/components/SelectEachItem.d.ts +5 -0
- package/dist/types/components/SelectEachItem.d.ts.map +1 -0
- package/dist/types/components/SelectItemTrigger.d.ts +8 -0
- package/dist/types/components/SelectItemTrigger.d.ts.map +1 -0
- package/dist/types/components/SelectNewItem.d.ts +5 -0
- package/dist/types/components/SelectNewItem.d.ts.map +1 -0
- package/dist/types/components/SelectOption.d.ts +7 -0
- package/dist/types/components/SelectOption.d.ts.map +1 -0
- package/dist/types/components/SelectPlaceholder.d.ts +5 -0
- package/dist/types/components/SelectPlaceholder.d.ts.map +1 -0
- package/dist/types/components/SortableMultiSelect.d.ts +18 -0
- package/dist/types/components/SortableMultiSelect.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +10 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/contexts.d.ts +23 -0
- package/dist/types/contexts.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dist/types/types/events.d.ts +6 -0
- package/dist/types/types/events.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/package.json +11 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiSelect.js","sources":["../../../../../packages/react-select/src/components/MultiSelect.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo } from 'react'\nimport { SelectCurrentEntitiesContext, SelectHandler, SelectHandleSelectContext, SelectIsSelectedContext, SelectOptionsContext } from '../contexts'\nimport { Component, EntityAccessor, HasMany, SugaredQualifiedEntityList, SugaredRelativeEntityList, useEntityList } from '@contember/react-binding'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\nimport { SelectEvents } from '../types'\n\nexport type MultiSelectProps =\n\t& {\n\t\tchildren: ReactNode\n\t\tfield: SugaredRelativeEntityList['field']\n\t\toptions?: SugaredQualifiedEntityList['entities']\n\t}\n\t& SelectEvents\n\nexport const MultiSelect = Component(({ field, children, options, onSelect, onUnselect }: MultiSelectProps) => {\n\tconst entities = useEntityList({ field })\n\toptions ??= entities.name\n\tconst entitiesArr = useMemo(() => Array.from(entities), [entities])\n\tconst selectedEntities = useMemo(() => Array.from(entities).map((it: EntityAccessor) => it.id), [entities])\n\n\tconst handler = useReferentiallyStableCallback<SelectHandler>((entity, action = 'toggle') => {\n\t\tconst isSelected = selectedEntities.includes(entity.id)\n\t\tif (action === 'toggle') {\n\t\t\taction = isSelected ? 'unselect' : 'select'\n\t\t}\n\t\tif (action === 'unselect' && isSelected) {\n\t\t\tentities.disconnectEntity(entity)\n\t\t\tonUnselect?.(entity)\n\t\t} else if (action === 'select' && !isSelected) {\n\t\t\tentities.connectEntity(entity)\n\t\t\tonSelect?.(entity)\n\t\t}\n\t})\n\tconst isSelected = useCallback((entity: EntityAccessor) => {\n\t\treturn selectedEntities.includes(entity.id)\n\t}, [selectedEntities])\n\n\treturn (\n\t\t<SelectCurrentEntitiesContext.Provider value={entitiesArr}>\n\t\t\t<SelectIsSelectedContext.Provider value={isSelected}>\n\t\t\t\t<SelectHandleSelectContext.Provider value={handler}>\n\t\t\t\t\t<SelectOptionsContext.Provider value={options}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</SelectOptionsContext.Provider>\n\t\t\t\t</SelectHandleSelectContext.Provider>\n\t\t\t</SelectIsSelectedContext.Provider>\n\t\t</SelectCurrentEntitiesContext.Provider>\n\t)\n}, ({ field, children }) => {\n\treturn (\n\t\t<HasMany field={field} expectedMutation=\"connectOrDisconnect\">\n\t\t\t{children}\n\t\t</HasMany>\n\t)\n})\n"],"names":["isSelected"],"mappings":";;;;;AAcO,MAAM,cAAc,UAAU,CAAC,EAAE,OAAO,UAAU,SAAS,UAAU,iBAAmC;AAC9G,QAAM,WAAW,cAAc,EAAE,OAAO;AACxC,cAAA,UAAY,SAAS;AACrB,QAAM,cAAc,QAAQ,MAAM,MAAM,KAAK,QAAQ,GAAG,CAAC,QAAQ,CAAC;AAClE,QAAM,mBAAmB,QAAQ,MAAM,MAAM,KAAK,QAAQ,EAAE,IAAI,CAAC,OAAuB,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC;AAE1G,QAAM,UAAU,+BAA8C,CAAC,QAAQ,SAAS,aAAa;AAC5F,UAAMA,cAAa,iBAAiB,SAAS,OAAO,EAAE;AACtD,QAAI,WAAW,UAAU;AACxB,eAASA,cAAa,aAAa;AAAA,IACpC;AACA,QAAI,WAAW,cAAcA,aAAY;AACxC,eAAS,iBAAiB,MAAM;AAChC,mBAAa,MAAM;AAAA,IACpB,WAAW,WAAW,YAAY,CAACA,aAAY;AAC9C,eAAS,cAAc,MAAM;AAC7B,iBAAW,MAAM;AAAA,IAClB;AAAA,EACD,CAAC;AACD,QAAM,aAAa,YAAY,CAAC,WAA2B;AAC1D,WAAO,iBAAiB,SAAS,OAAO,EAAE;AAAA,EAC3C,GAAG,CAAC,gBAAgB,CAAC;AAErB,SACC,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,EAAA,CACD;AAEF,GAAG,CAAC,EAAE,OAAO,eAAe;AAC3B,SACC,oBAAC,SAAA,EAAQ,OAAc,kBAAiB,uBACtC,UACF;AAEF,CAAC;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const contexts = require("../contexts.cjs");
|
|
6
|
+
const reactBinding = require("@contember/react-binding");
|
|
7
|
+
const reactUtils = require("@contember/react-utils");
|
|
8
|
+
const Select = reactBinding.Component(({ field, children, onUnselect, onSelect, options }) => {
|
|
9
|
+
const entity = reactBinding.useEntity();
|
|
10
|
+
const selectedEntity = entity.getEntity({ field });
|
|
11
|
+
options ?? (options = selectedEntity.name);
|
|
12
|
+
const entityExists = selectedEntity.existsOnServer || selectedEntity.hasUnpersistedChanges;
|
|
13
|
+
const entitiesArr = React.useMemo(() => entityExists ? [selectedEntity] : [], [entityExists, selectedEntity]);
|
|
14
|
+
const handleSelect = reactUtils.useReferentiallyStableCallback((selected, action = "toggle") => {
|
|
15
|
+
if (action === "toggle") {
|
|
16
|
+
action = selected.id === selectedEntity.id ? "unselect" : "select";
|
|
17
|
+
}
|
|
18
|
+
if (action === "unselect") {
|
|
19
|
+
entity.disconnectEntityAtField({ field });
|
|
20
|
+
onUnselect?.(selected);
|
|
21
|
+
} else if (action === "select") {
|
|
22
|
+
entity.connectEntityAtField({ field }, selected);
|
|
23
|
+
onSelect?.(selected);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const isSelected = React.useCallback((entity2) => entity2.id === selectedEntity.id, [selectedEntity.id]);
|
|
27
|
+
return /* @__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: handleSelect, children: /* @__PURE__ */ jsxRuntime.jsx(contexts.SelectOptionsContext.Provider, { value: options, children }) }) }) });
|
|
28
|
+
}, ({ field, children, isNonbearing }) => {
|
|
29
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactBinding.HasOne, { field, expectedMutation: "connectOrDisconnect", isNonbearing, children });
|
|
30
|
+
});
|
|
31
|
+
exports.Select = Select;
|
|
32
|
+
//# sourceMappingURL=Select.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.cjs","sources":["../../../../../packages/react-select/src/components/Select.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo } from 'react'\nimport { SelectCurrentEntitiesContext, SelectHandler, SelectHandleSelectContext, SelectIsSelectedContext, SelectOptionsContext } from '../contexts'\nimport { Component, EntityAccessor, HasOne, SugaredQualifiedEntityList, SugaredRelativeSingleEntity, useEntity } from '@contember/react-binding'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\nimport { SelectEvents } from '../types'\n\nexport type SelectProps =\n\t& {\n\t\tchildren: ReactNode\n\t\tfield: SugaredRelativeSingleEntity['field']\n\t\toptions?: SugaredQualifiedEntityList['entities']\n\t\tisNonbearing?: boolean\n\t}\n\t& SelectEvents\n\nexport const Select = Component(({ field, children, onUnselect, onSelect, options }: SelectProps) => {\n\tconst entity = useEntity()\n\tconst selectedEntity = entity.getEntity({ field })\n\toptions ??= selectedEntity.name\n\n\tconst entityExists = selectedEntity.existsOnServer || selectedEntity.hasUnpersistedChanges\n\tconst entitiesArr = useMemo(() => entityExists ? [selectedEntity] : [], [entityExists, selectedEntity])\n\n\tconst handleSelect = useReferentiallyStableCallback<SelectHandler>((selected, action = 'toggle') => {\n\t\tif (action === 'toggle') {\n\t\t\taction = selected.id === selectedEntity.id ? 'unselect' : 'select'\n\t\t}\n\t\tif (action === 'unselect') {\n\t\t\tentity.disconnectEntityAtField({ field })\n\t\t\tonUnselect?.(selected)\n\t\t} else if (action === 'select') {\n\t\t\tentity.connectEntityAtField({ field }, selected)\n\t\t\tonSelect?.(selected)\n\t\t}\n\t})\n\tconst isSelected = useCallback((entity: EntityAccessor) => entity.id === selectedEntity.id, [selectedEntity.id])\n\n\treturn (\n\t\t<SelectCurrentEntitiesContext.Provider value={entitiesArr}>\n\t\t\t<SelectIsSelectedContext.Provider value={isSelected}>\n\t\t\t\t<SelectHandleSelectContext.Provider value={handleSelect}>\n\t\t\t\t\t<SelectOptionsContext.Provider value={options}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</SelectOptionsContext.Provider>\n\t\t\t\t</SelectHandleSelectContext.Provider>\n\t\t\t</SelectIsSelectedContext.Provider>\n\t\t</SelectCurrentEntitiesContext.Provider>\n\t)\n}, ({ field, children, isNonbearing }) => {\n\treturn (\n\t\t<HasOne field={field} expectedMutation=\"connectOrDisconnect\" isNonbearing={isNonbearing}>\n\t\t\t{children}\n\t\t</HasOne>\n\t)\n})\n"],"names":["Component","useEntity","useMemo","useReferentiallyStableCallback","useCallback","entity","jsx","SelectCurrentEntitiesContext","SelectIsSelectedContext","SelectHandleSelectContext","SelectOptionsContext","HasOne"],"mappings":";;;;;;;AAeO,MAAM,SAASA,aAAAA,UAAU,CAAC,EAAE,OAAO,UAAU,YAAY,UAAU,cAA2B;AACpG,QAAM,SAASC,aAAAA,UAAA;AACf,QAAM,iBAAiB,OAAO,UAAU,EAAE,OAAO;AACjD,cAAA,UAAY,eAAe;AAE3B,QAAM,eAAe,eAAe,kBAAkB,eAAe;AACrE,QAAM,cAAcC,cAAQ,MAAM,eAAe,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,cAAc,CAAC;AAEtG,QAAM,eAAeC,WAAAA,+BAA8C,CAAC,UAAU,SAAS,aAAa;AACnG,QAAI,WAAW,UAAU;AACxB,eAAS,SAAS,OAAO,eAAe,KAAK,aAAa;AAAA,IAC3D;AACA,QAAI,WAAW,YAAY;AAC1B,aAAO,wBAAwB,EAAE,OAAO;AACxC,mBAAa,QAAQ;AAAA,IACtB,WAAW,WAAW,UAAU;AAC/B,aAAO,qBAAqB,EAAE,MAAA,GAAS,QAAQ;AAC/C,iBAAW,QAAQ;AAAA,IACpB;AAAA,EACD,CAAC;AACD,QAAM,aAAaC,MAAAA,YAAY,CAACC,YAA2BA,QAAO,OAAO,eAAe,IAAI,CAAC,eAAe,EAAE,CAAC;AAE/G,SACCC,2BAAAA,IAACC,SAAAA,6BAA6B,UAA7B,EAAsC,OAAO,aAC7C,UAAAD,2BAAAA,IAACE,SAAAA,wBAAwB,UAAxB,EAAiC,OAAO,YACxC,UAAAF,2BAAAA,IAACG,SAAAA,0BAA0B,UAA1B,EAAmC,OAAO,cAC1C,UAAAH,2BAAAA,IAACI,SAAAA,qBAAqB,UAArB,EAA8B,OAAO,SACpC,SAAA,CACF,EAAA,CACD,EAAA,CACD,EAAA,CACD;AAEF,GAAG,CAAC,EAAE,OAAO,UAAU,mBAAmB;AACzC,wCACEC,aAAAA,QAAA,EAAO,OAAc,kBAAiB,uBAAsB,cAC3D,UACF;AAEF,CAAC;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useCallback } from "react";
|
|
3
|
+
import { SelectCurrentEntitiesContext, SelectIsSelectedContext, SelectHandleSelectContext, SelectOptionsContext } from "../contexts.js";
|
|
4
|
+
import { Component, useEntity, HasOne } from "@contember/react-binding";
|
|
5
|
+
import { useReferentiallyStableCallback } from "@contember/react-utils";
|
|
6
|
+
const Select = Component(({ field, children, onUnselect, onSelect, options }) => {
|
|
7
|
+
const entity = useEntity();
|
|
8
|
+
const selectedEntity = entity.getEntity({ field });
|
|
9
|
+
options ?? (options = selectedEntity.name);
|
|
10
|
+
const entityExists = selectedEntity.existsOnServer || selectedEntity.hasUnpersistedChanges;
|
|
11
|
+
const entitiesArr = useMemo(() => entityExists ? [selectedEntity] : [], [entityExists, selectedEntity]);
|
|
12
|
+
const handleSelect = useReferentiallyStableCallback((selected, action = "toggle") => {
|
|
13
|
+
if (action === "toggle") {
|
|
14
|
+
action = selected.id === selectedEntity.id ? "unselect" : "select";
|
|
15
|
+
}
|
|
16
|
+
if (action === "unselect") {
|
|
17
|
+
entity.disconnectEntityAtField({ field });
|
|
18
|
+
onUnselect?.(selected);
|
|
19
|
+
} else if (action === "select") {
|
|
20
|
+
entity.connectEntityAtField({ field }, selected);
|
|
21
|
+
onSelect?.(selected);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const isSelected = useCallback((entity2) => entity2.id === selectedEntity.id, [selectedEntity.id]);
|
|
25
|
+
return /* @__PURE__ */ jsx(SelectCurrentEntitiesContext.Provider, { value: entitiesArr, children: /* @__PURE__ */ jsx(SelectIsSelectedContext.Provider, { value: isSelected, children: /* @__PURE__ */ jsx(SelectHandleSelectContext.Provider, { value: handleSelect, children: /* @__PURE__ */ jsx(SelectOptionsContext.Provider, { value: options, children }) }) }) });
|
|
26
|
+
}, ({ field, children, isNonbearing }) => {
|
|
27
|
+
return /* @__PURE__ */ jsx(HasOne, { field, expectedMutation: "connectOrDisconnect", isNonbearing, children });
|
|
28
|
+
});
|
|
29
|
+
export {
|
|
30
|
+
Select
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../../../packages/react-select/src/components/Select.tsx"],"sourcesContent":["import React, { ReactNode, useCallback, useMemo } from 'react'\nimport { SelectCurrentEntitiesContext, SelectHandler, SelectHandleSelectContext, SelectIsSelectedContext, SelectOptionsContext } from '../contexts'\nimport { Component, EntityAccessor, HasOne, SugaredQualifiedEntityList, SugaredRelativeSingleEntity, useEntity } from '@contember/react-binding'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\nimport { SelectEvents } from '../types'\n\nexport type SelectProps =\n\t& {\n\t\tchildren: ReactNode\n\t\tfield: SugaredRelativeSingleEntity['field']\n\t\toptions?: SugaredQualifiedEntityList['entities']\n\t\tisNonbearing?: boolean\n\t}\n\t& SelectEvents\n\nexport const Select = Component(({ field, children, onUnselect, onSelect, options }: SelectProps) => {\n\tconst entity = useEntity()\n\tconst selectedEntity = entity.getEntity({ field })\n\toptions ??= selectedEntity.name\n\n\tconst entityExists = selectedEntity.existsOnServer || selectedEntity.hasUnpersistedChanges\n\tconst entitiesArr = useMemo(() => entityExists ? [selectedEntity] : [], [entityExists, selectedEntity])\n\n\tconst handleSelect = useReferentiallyStableCallback<SelectHandler>((selected, action = 'toggle') => {\n\t\tif (action === 'toggle') {\n\t\t\taction = selected.id === selectedEntity.id ? 'unselect' : 'select'\n\t\t}\n\t\tif (action === 'unselect') {\n\t\t\tentity.disconnectEntityAtField({ field })\n\t\t\tonUnselect?.(selected)\n\t\t} else if (action === 'select') {\n\t\t\tentity.connectEntityAtField({ field }, selected)\n\t\t\tonSelect?.(selected)\n\t\t}\n\t})\n\tconst isSelected = useCallback((entity: EntityAccessor) => entity.id === selectedEntity.id, [selectedEntity.id])\n\n\treturn (\n\t\t<SelectCurrentEntitiesContext.Provider value={entitiesArr}>\n\t\t\t<SelectIsSelectedContext.Provider value={isSelected}>\n\t\t\t\t<SelectHandleSelectContext.Provider value={handleSelect}>\n\t\t\t\t\t<SelectOptionsContext.Provider value={options}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</SelectOptionsContext.Provider>\n\t\t\t\t</SelectHandleSelectContext.Provider>\n\t\t\t</SelectIsSelectedContext.Provider>\n\t\t</SelectCurrentEntitiesContext.Provider>\n\t)\n}, ({ field, children, isNonbearing }) => {\n\treturn (\n\t\t<HasOne field={field} expectedMutation=\"connectOrDisconnect\" isNonbearing={isNonbearing}>\n\t\t\t{children}\n\t\t</HasOne>\n\t)\n})\n"],"names":["entity"],"mappings":";;;;;AAeO,MAAM,SAAS,UAAU,CAAC,EAAE,OAAO,UAAU,YAAY,UAAU,cAA2B;AACpG,QAAM,SAAS,UAAA;AACf,QAAM,iBAAiB,OAAO,UAAU,EAAE,OAAO;AACjD,cAAA,UAAY,eAAe;AAE3B,QAAM,eAAe,eAAe,kBAAkB,eAAe;AACrE,QAAM,cAAc,QAAQ,MAAM,eAAe,CAAC,cAAc,IAAI,IAAI,CAAC,cAAc,cAAc,CAAC;AAEtG,QAAM,eAAe,+BAA8C,CAAC,UAAU,SAAS,aAAa;AACnG,QAAI,WAAW,UAAU;AACxB,eAAS,SAAS,OAAO,eAAe,KAAK,aAAa;AAAA,IAC3D;AACA,QAAI,WAAW,YAAY;AAC1B,aAAO,wBAAwB,EAAE,OAAO;AACxC,mBAAa,QAAQ;AAAA,IACtB,WAAW,WAAW,UAAU;AAC/B,aAAO,qBAAqB,EAAE,MAAA,GAAS,QAAQ;AAC/C,iBAAW,QAAQ;AAAA,IACpB;AAAA,EACD,CAAC;AACD,QAAM,aAAa,YAAY,CAACA,YAA2BA,QAAO,OAAO,eAAe,IAAI,CAAC,eAAe,EAAE,CAAC;AAE/G,SACC,oBAAC,6BAA6B,UAA7B,EAAsC,OAAO,aAC7C,UAAA,oBAAC,wBAAwB,UAAxB,EAAiC,OAAO,YACxC,UAAA,oBAAC,0BAA0B,UAA1B,EAAmC,OAAO,cAC1C,UAAA,oBAAC,qBAAqB,UAArB,EAA8B,OAAO,SACpC,SAAA,CACF,EAAA,CACD,EAAA,CACD,EAAA,CACD;AAEF,GAAG,CAAC,EAAE,OAAO,UAAU,mBAAmB;AACzC,6BACE,QAAA,EAAO,OAAc,kBAAiB,uBAAsB,cAC3D,UACF;AAEF,CAAC;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const contexts = require("../contexts.cjs");
|
|
5
|
+
const reactDataview = require("@contember/react-dataview");
|
|
6
|
+
const SelectDataView = (props) => {
|
|
7
|
+
const handleSelect = contexts.useSelectHandleSelect();
|
|
8
|
+
const entities = contexts.useSelectOptions();
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10
|
+
reactDataview.DataView,
|
|
11
|
+
{
|
|
12
|
+
onSelectHighlighted: handleSelect,
|
|
13
|
+
entities,
|
|
14
|
+
filteringStateStorage: "null",
|
|
15
|
+
sortingStateStorage: "null",
|
|
16
|
+
currentPageStateStorage: "null",
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
exports.SelectDataView = SelectDataView;
|
|
22
|
+
//# sourceMappingURL=SelectDataView.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectDataView.cjs","sources":["../../../../../packages/react-select/src/components/SelectDataView.tsx"],"sourcesContent":["import React, { ReactNode, useMemo } from 'react'\nimport { useSelectHandleSelect, useSelectOptions } from '../contexts'\nimport { DataView, DataViewFilterHandlerRegistry, DataViewProps } from '@contember/react-dataview'\n\nexport type SelectDataViewProps =\n\t& Omit<DataViewProps, 'entities'>\n\t& {\n\t\tchildren: ReactNode\n\t}\n\nexport const SelectDataView = (props: SelectDataViewProps) => {\n\tconst handleSelect = useSelectHandleSelect()\n\tconst entities = useSelectOptions()\n\n\treturn (\n\t\t<DataView\n\t\t\tonSelectHighlighted={handleSelect}\n\t\t\tentities={entities}\n\t\t\tfilteringStateStorage=\"null\"\n\t\t\tsortingStateStorage=\"null\"\n\t\t\tcurrentPageStateStorage=\"null\"\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n"],"names":["useSelectHandleSelect","useSelectOptions","jsx","DataView"],"mappings":";;;;;AAUO,MAAM,iBAAiB,CAAC,UAA+B;AAC7D,QAAM,eAAeA,SAAAA,sBAAA;AACrB,QAAM,WAAWC,SAAAA,iBAAA;AAEjB,SACCC,2BAAAA;AAAAA,IAACC,cAAAA;AAAAA,IAAA;AAAA,MACA,qBAAqB;AAAA,MACrB;AAAA,MACA,uBAAsB;AAAA,MACtB,qBAAoB;AAAA,MACpB,yBAAwB;AAAA,MACvB,GAAG;AAAA,IAAA;AAAA,EAAA;AAGP;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useSelectHandleSelect, useSelectOptions } from "../contexts.js";
|
|
3
|
+
import { DataView } from "@contember/react-dataview";
|
|
4
|
+
const SelectDataView = (props) => {
|
|
5
|
+
const handleSelect = useSelectHandleSelect();
|
|
6
|
+
const entities = useSelectOptions();
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
DataView,
|
|
9
|
+
{
|
|
10
|
+
onSelectHighlighted: handleSelect,
|
|
11
|
+
entities,
|
|
12
|
+
filteringStateStorage: "null",
|
|
13
|
+
sortingStateStorage: "null",
|
|
14
|
+
currentPageStateStorage: "null",
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
SelectDataView
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=SelectDataView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectDataView.js","sources":["../../../../../packages/react-select/src/components/SelectDataView.tsx"],"sourcesContent":["import React, { ReactNode, useMemo } from 'react'\nimport { useSelectHandleSelect, useSelectOptions } from '../contexts'\nimport { DataView, DataViewFilterHandlerRegistry, DataViewProps } from '@contember/react-dataview'\n\nexport type SelectDataViewProps =\n\t& Omit<DataViewProps, 'entities'>\n\t& {\n\t\tchildren: ReactNode\n\t}\n\nexport const SelectDataView = (props: SelectDataViewProps) => {\n\tconst handleSelect = useSelectHandleSelect()\n\tconst entities = useSelectOptions()\n\n\treturn (\n\t\t<DataView\n\t\t\tonSelectHighlighted={handleSelect}\n\t\t\tentities={entities}\n\t\t\tfilteringStateStorage=\"null\"\n\t\t\tsortingStateStorage=\"null\"\n\t\t\tcurrentPageStateStorage=\"null\"\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n"],"names":[],"mappings":";;;AAUO,MAAM,iBAAiB,CAAC,UAA+B;AAC7D,QAAM,eAAe,sBAAA;AACrB,QAAM,WAAW,iBAAA;AAEjB,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,qBAAqB;AAAA,MACrB;AAAA,MACA,uBAAsB;AAAA,MACtB,qBAAoB;AAAA,MACpB,yBAAwB;AAAA,MACvB,GAAG;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const contexts = require("../contexts.cjs");
|
|
5
|
+
const reactBinding = require("@contember/react-binding");
|
|
6
|
+
const SelectEachValue = ({ children }) => {
|
|
7
|
+
const entities = contexts.useSelectCurrentEntities();
|
|
8
|
+
return entities.map((entity) => /* @__PURE__ */ jsxRuntime.jsx(reactBinding.Entity, { accessor: entity, children }, entity.key));
|
|
9
|
+
};
|
|
10
|
+
exports.SelectEachValue = SelectEachValue;
|
|
11
|
+
//# sourceMappingURL=SelectEachItem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectEachItem.cjs","sources":["../../../../../packages/react-select/src/components/SelectEachItem.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useSelectCurrentEntities } from '../contexts'\nimport { Entity } from '@contember/react-binding'\n\nexport const SelectEachValue = ({ children }: { children: ReactNode }) => {\n\tconst entities = useSelectCurrentEntities()\n\treturn entities.map(entity => (\n\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t{children}\n\t\t</Entity>\n\t))\n}\n"],"names":["useSelectCurrentEntities","jsx","Entity"],"mappings":";;;;;AAIO,MAAM,kBAAkB,CAAC,EAAE,eAAwC;AACzE,QAAM,WAAWA,SAAAA,yBAAA;AACjB,SAAO,SAAS,IAAI,CAAA,WACnBC,2BAAAA,IAACC,aAAAA,QAAA,EAAwB,UAAU,QACjC,SAAA,GADW,OAAO,GAEpB,CACA;AACF;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useSelectCurrentEntities } from "../contexts.js";
|
|
3
|
+
import { Entity } from "@contember/react-binding";
|
|
4
|
+
const SelectEachValue = ({ children }) => {
|
|
5
|
+
const entities = useSelectCurrentEntities();
|
|
6
|
+
return entities.map((entity) => /* @__PURE__ */ jsx(Entity, { accessor: entity, children }, entity.key));
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
SelectEachValue
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=SelectEachItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectEachItem.js","sources":["../../../../../packages/react-select/src/components/SelectEachItem.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useSelectCurrentEntities } from '../contexts'\nimport { Entity } from '@contember/react-binding'\n\nexport const SelectEachValue = ({ children }: { children: ReactNode }) => {\n\tconst entities = useSelectCurrentEntities()\n\treturn entities.map(entity => (\n\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t{children}\n\t\t</Entity>\n\t))\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,kBAAkB,CAAC,EAAE,eAAwC;AACzE,QAAM,WAAW,yBAAA;AACjB,SAAO,SAAS,IAAI,CAAA,WACnB,oBAAC,QAAA,EAAwB,UAAU,QACjC,SAAA,GADW,OAAO,GAEpB,CACA;AACF;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const contexts = require("../contexts.cjs");
|
|
6
|
+
const reactSlot = require("@radix-ui/react-slot");
|
|
7
|
+
const reactBinding = require("@contember/react-binding");
|
|
8
|
+
const SelectItemTrigger = React.forwardRef(({ action, ...props }, ref) => {
|
|
9
|
+
const handleSelect = contexts.useSelectHandleSelect();
|
|
10
|
+
const entity = reactBinding.useEntity();
|
|
11
|
+
const onClickProp = props.onClick;
|
|
12
|
+
const onClick = React.useCallback((e) => {
|
|
13
|
+
handleSelect?.(entity, action);
|
|
14
|
+
onClickProp?.(e);
|
|
15
|
+
}, [action, entity, handleSelect, onClickProp]);
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactSlot.Slot, { ...props, onClick, ref });
|
|
17
|
+
});
|
|
18
|
+
exports.SelectItemTrigger = SelectItemTrigger;
|
|
19
|
+
//# sourceMappingURL=SelectItemTrigger.cjs.map
|
|
@@ -0,0 +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} 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;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useCallback } from "react";
|
|
3
|
+
import { useSelectHandleSelect } from "../contexts.js";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { useEntity } from "@contember/react-binding";
|
|
6
|
+
const SelectItemTrigger = forwardRef(({ action, ...props }, ref) => {
|
|
7
|
+
const handleSelect = useSelectHandleSelect();
|
|
8
|
+
const entity = useEntity();
|
|
9
|
+
const onClickProp = props.onClick;
|
|
10
|
+
const onClick = useCallback((e) => {
|
|
11
|
+
handleSelect?.(entity, action);
|
|
12
|
+
onClickProp?.(e);
|
|
13
|
+
}, [action, entity, handleSelect, onClickProp]);
|
|
14
|
+
return /* @__PURE__ */ jsx(Slot, { ...props, onClick, ref });
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
SelectItemTrigger
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=SelectItemTrigger.js.map
|
|
@@ -0,0 +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} 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;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const reactBinding = require("@contember/react-binding");
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const contexts = require("../contexts.cjs");
|
|
7
|
+
const SelectNewItem = ({ children }) => {
|
|
8
|
+
const options = contexts.useSelectOptions();
|
|
9
|
+
const env = reactBinding.useEnvironment();
|
|
10
|
+
const { entityName } = React.useMemo(() => reactBinding.QueryLanguage.desugarQualifiedEntityList({ entities: options }, env), [env, options]);
|
|
11
|
+
const [state, setState] = React.useState(null);
|
|
12
|
+
const extendTree = reactBinding.useExtendTree();
|
|
13
|
+
const getSubTree = reactBinding.useGetEntitySubTree();
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
(async () => {
|
|
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
|
+
);
|
|
30
|
+
if (!treeRootId) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const entity = getSubTree({
|
|
34
|
+
entity: {
|
|
35
|
+
entityName
|
|
36
|
+
},
|
|
37
|
+
isCreating: true
|
|
38
|
+
}, treeRootId);
|
|
39
|
+
setState({
|
|
40
|
+
entity,
|
|
41
|
+
treeRootId
|
|
42
|
+
});
|
|
43
|
+
})();
|
|
44
|
+
}, [children, entityName, extendTree, getSubTree]);
|
|
45
|
+
if (!state) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(reactBinding.TreeRootIdProvider, { treeRootId: state.treeRootId, children: /* @__PURE__ */ jsxRuntime.jsx(reactBinding.Entity, { accessor: state.entity, children }) }) });
|
|
49
|
+
};
|
|
50
|
+
exports.SelectNewItem = SelectNewItem;
|
|
51
|
+
//# sourceMappingURL=SelectNewItem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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;;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEnvironment, QueryLanguage, useExtendTree, useGetEntitySubTree, EntitySubTree, TreeRootIdProvider, Entity } from "@contember/react-binding";
|
|
3
|
+
import { useMemo, useState, useEffect } from "react";
|
|
4
|
+
import { useSelectOptions } from "../contexts.js";
|
|
5
|
+
const SelectNewItem = ({ children }) => {
|
|
6
|
+
const options = useSelectOptions();
|
|
7
|
+
const env = useEnvironment();
|
|
8
|
+
const { entityName } = useMemo(() => QueryLanguage.desugarQualifiedEntityList({ entities: options }, env), [env, options]);
|
|
9
|
+
const [state, setState] = useState(null);
|
|
10
|
+
const extendTree = useExtendTree();
|
|
11
|
+
const getSubTree = useGetEntitySubTree();
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
(async () => {
|
|
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
|
+
);
|
|
28
|
+
if (!treeRootId) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const entity = getSubTree({
|
|
32
|
+
entity: {
|
|
33
|
+
entityName
|
|
34
|
+
},
|
|
35
|
+
isCreating: true
|
|
36
|
+
}, treeRootId);
|
|
37
|
+
setState({
|
|
38
|
+
entity,
|
|
39
|
+
treeRootId
|
|
40
|
+
});
|
|
41
|
+
})();
|
|
42
|
+
}, [children, entityName, extendTree, getSubTree]);
|
|
43
|
+
if (!state) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(TreeRootIdProvider, { treeRootId: state.treeRootId, children: /* @__PURE__ */ jsx(Entity, { accessor: state.entity, children }) }) });
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
SelectNewItem
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=SelectNewItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const contexts = require("../contexts.cjs");
|
|
6
|
+
const reactSlot = require("@radix-ui/react-slot");
|
|
7
|
+
const reactBinding = require("@contember/react-binding");
|
|
8
|
+
const utilities = require("@contember/utilities");
|
|
9
|
+
const SelectOption = React.forwardRef(({ action, ...props }, ref) => {
|
|
10
|
+
const isSelected = contexts.useSelectIsSelected();
|
|
11
|
+
const entity = reactBinding.useEntity();
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13
|
+
reactSlot.Slot,
|
|
14
|
+
{
|
|
15
|
+
ref,
|
|
16
|
+
"data-selected": utilities.dataAttribute(isSelected?.(entity)),
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
exports.SelectOption = SelectOption;
|
|
22
|
+
//# sourceMappingURL=SelectOption.cjs.map
|
|
@@ -0,0 +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":";;;;;;;;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;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useSelectIsSelected } from "../contexts.js";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { useEntity } from "@contember/react-binding";
|
|
6
|
+
import { dataAttribute } from "@contember/utilities";
|
|
7
|
+
const SelectOption = forwardRef(({ action, ...props }, ref) => {
|
|
8
|
+
const isSelected = useSelectIsSelected();
|
|
9
|
+
const entity = useEntity();
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
Slot,
|
|
12
|
+
{
|
|
13
|
+
ref,
|
|
14
|
+
"data-selected": dataAttribute(isSelected?.(entity)),
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
SelectOption
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=SelectOption.js.map
|
|
@@ -0,0 +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":";;;;;;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;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const contexts = require("../contexts.cjs");
|
|
5
|
+
const SelectPlaceholder = ({ children }) => {
|
|
6
|
+
const hasEntities = contexts.useSelectCurrentEntities().length > 0;
|
|
7
|
+
return hasEntities ? null : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
8
|
+
};
|
|
9
|
+
exports.SelectPlaceholder = SelectPlaceholder;
|
|
10
|
+
//# sourceMappingURL=SelectPlaceholder.cjs.map
|
|
@@ -0,0 +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;AAC3E,QAAM,cAAcA,SAAAA,2BAA2B,SAAS;AACxD,SAAO,cAAc,OAAOC,2BAAAA,IAAAC,WAAAA,UAAA,EAAG,SAAA,CAAS;AACzC;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useSelectCurrentEntities } from "../contexts.js";
|
|
3
|
+
const SelectPlaceholder = ({ children }) => {
|
|
4
|
+
const hasEntities = useSelectCurrentEntities().length > 0;
|
|
5
|
+
return hasEntities ? null : /* @__PURE__ */ jsx(Fragment, { children });
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
SelectPlaceholder
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=SelectPlaceholder.js.map
|
|
@@ -0,0 +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;AAC3E,QAAM,cAAc,2BAA2B,SAAS;AACxD,SAAO,cAAc,OAAO,oBAAA,UAAA,EAAG,SAAA,CAAS;AACzC;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const contexts = require("../contexts.cjs");
|
|
6
|
+
const reactBinding = require("@contember/react-binding");
|
|
7
|
+
const reactUtils = require("@contember/react-utils");
|
|
8
|
+
const reactRepeater = require("@contember/react-repeater");
|
|
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;
|
|
23
|
+
}
|
|
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
|
+
);
|
|
52
|
+
exports.SortableMultiSelect = SortableMultiSelect;
|
|
53
|
+
//# sourceMappingURL=SortableMultiSelect.cjs.map
|
|
@@ -0,0 +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\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;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useCallback } from "react";
|
|
3
|
+
import { SelectCurrentEntitiesContext, SelectIsSelectedContext, SelectHandleSelectContext, SelectOptionsContext } from "../contexts.js";
|
|
4
|
+
import { Component, useEntityList, QueryLanguage, PlaceholderGenerator, FieldMarker, HasOne } from "@contember/react-binding";
|
|
5
|
+
import { useReferentiallyStableCallback } from "@contember/react-utils";
|
|
6
|
+
import { Repeater } from "@contember/react-repeater";
|
|
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;
|
|
21
|
+
}
|
|
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
|
+
);
|
|
50
|
+
export {
|
|
51
|
+
SortableMultiSelect
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=SortableMultiSelect.js.map
|
|
@@ -0,0 +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\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;"}
|