@webiny/app-admin 6.6.0-alpha.0 → 6.6.0-alpha.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/base/Admin.js +17 -2
- package/base/Admin.js.map +1 -1
- package/base/Base/DefaultFieldRenderers.js +17 -2
- package/base/Base/DefaultFieldRenderers.js.map +1 -1
- package/base/Base/FieldRenderers/AutoCompleteRenderer.d.ts +13 -0
- package/base/Base/FieldRenderers/AutoCompleteRenderer.js +29 -0
- package/base/Base/FieldRenderers/AutoCompleteRenderer.js.map +1 -0
- package/base/Base/FieldRenderers/HorizontalTabsRenderer.d.ts +2 -2
- package/base/Base/FieldRenderers/LexicalRenderer.js +10 -6
- package/base/Base/FieldRenderers/LexicalRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/MultiFilePickerRenderer.js +8 -5
- package/base/Base/FieldRenderers/MultiFilePickerRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/MultiSelectRenderer.d.ts +15 -0
- package/base/Base/FieldRenderers/MultiSelectRenderer.js +31 -0
- package/base/Base/FieldRenderers/MultiSelectRenderer.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/DynamicZoneRenderer.d.ts +2 -0
- package/base/Base/FieldRenderers/ObjectRenderer/DynamicZoneRenderer.js +5 -2
- package/base/Base/FieldRenderers/ObjectRenderer/DynamicZoneRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZone.d.ts +11 -0
- package/base/Base/FieldRenderers/ObjectRenderer/{MultiValueDynamicZone.js → MultiValueDynamicZone/MultiValueDynamicZone.js} +65 -14
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZone.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZonePresenter.d.ts +13 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZonePresenter.js +28 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/MultiValueDynamicZonePresenter.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/abstractions.d.ts +15 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/abstractions.js +5 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/abstractions.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/feature.d.ts +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/feature.js +11 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/feature.js.map +1 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/index.d.ts +2 -0
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone/index.js +2 -0
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectAccordionMultipleRenderer.d.ts +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectAccordionMultipleRenderer.js +19 -3
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectAccordionMultipleRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.d.ts +10 -8
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.js +34 -3
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/SingleValueDynamicZone.d.ts +3 -2
- package/base/Base/FieldRenderers/ObjectRenderer/SingleValueDynamicZone.js +11 -5
- package/base/Base/FieldRenderers/ObjectRenderer/SingleValueDynamicZone.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker.js +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker.js.map +1 -1
- package/base/Base/FieldRenderers/SelectRenderer.d.ts +6 -0
- package/base/Base/FieldRenderers/SelectRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/VerticalTabsRenderer.d.ts +2 -2
- package/base/Base/Menus.js +4 -4
- package/base/Base/Menus.js.map +1 -1
- package/base/createRootContainer.js +4 -2
- package/base/createRootContainer.js.map +1 -1
- package/components/Drawers/DrawerParamsContext.d.ts +6 -0
- package/components/Drawers/DrawerParamsContext.js +10 -0
- package/components/Drawers/DrawerParamsContext.js.map +1 -0
- package/components/Drawers/DrawersContext.d.ts +13 -0
- package/components/Drawers/DrawersContext.js +50 -0
- package/components/Drawers/DrawersContext.js.map +1 -0
- package/components/Drawers/useDrawers.d.ts +2 -0
- package/components/Drawers/useDrawers.js +10 -0
- package/components/Drawers/useDrawers.js.map +1 -0
- package/components/Filters/Filters.js +4 -3
- package/components/Filters/Filters.js.map +1 -1
- package/components/IconPicker/IconPickerComponent.d.ts +2 -2
- package/components/LexicalEditor/LexicalLinkForm.js +3 -0
- package/components/LexicalEditor/LexicalLinkForm.js.map +1 -1
- package/components/ListView/ListViewBulkActions.d.ts +2 -2
- package/components/ListView/ListViewContent.d.ts +2 -2
- package/components/ListView/ListViewFilters.d.ts +2 -2
- package/components/ListView/index.d.ts +6 -6
- package/components/OverlayLayout/OverlayLayout.js +4 -2
- package/components/OverlayLayout/OverlayLayout.js.map +1 -1
- package/components/OverlayLayout/components/OverlayContent.js +1 -0
- package/components/OverlayLayout/components/OverlayContent.js.map +1 -1
- package/components/RolesMultiAutocomplete/index.d.ts +4 -2
- package/components/SplitView/SplitView.js +1 -1
- package/components/SplitView/SplitView.js.map +1 -1
- package/components/Table/components/Table/TableInner.d.ts +2 -2
- package/components/TeamAutocomplete/index.d.ts +4 -2
- package/components/TeamsMultiAutocomplete/index.d.ts +4 -2
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/config/AdminConfig/Breadcrumbs.d.ts +42 -0
- package/config/AdminConfig/Breadcrumbs.js +24 -0
- package/config/AdminConfig/Breadcrumbs.js.map +1 -0
- package/config/AdminConfig/Drawer.d.ts +10 -0
- package/config/AdminConfig/Drawer.js +19 -0
- package/config/AdminConfig/Drawer.js.map +1 -0
- package/config/AdminConfig/LexicalTheme/AllowCustomColors.d.ts +5 -0
- package/config/AdminConfig/LexicalTheme/AllowCustomColors.js +18 -0
- package/config/AdminConfig/LexicalTheme/AllowCustomColors.js.map +1 -0
- package/config/AdminConfig/LexicalTheme.d.ts +2 -0
- package/config/AdminConfig/LexicalTheme.js +2 -0
- package/config/AdminConfig/LexicalTheme.js.map +1 -1
- package/config/AdminConfig.d.ts +8 -0
- package/config/AdminConfig.js +8 -1
- package/config/AdminConfig.js.map +1 -1
- package/exports/admin.d.ts +3 -0
- package/exports/admin.js +3 -0
- package/features/accessManagement/types.d.ts +3 -3
- package/features/aiChat/AiChatGateway.d.ts +30 -0
- package/features/aiChat/AiChatGateway.js +41 -0
- package/features/aiChat/AiChatGateway.js.map +1 -0
- package/features/aiChat/AiChatPresenter.d.ts +32 -0
- package/features/aiChat/AiChatPresenter.js +220 -0
- package/features/aiChat/AiChatPresenter.js.map +1 -0
- package/features/aiChat/abstractions.d.ts +124 -0
- package/features/aiChat/abstractions.js +6 -0
- package/features/aiChat/abstractions.js.map +1 -0
- package/features/aiChat/feature.d.ts +3 -0
- package/features/aiChat/feature.js +19 -0
- package/features/aiChat/feature.js.map +1 -0
- package/features/aiChat/index.d.ts +6 -0
- package/features/aiChat/index.js +3 -0
- package/features/dateFormatter/DefaultDateFormatter.d.ts +8 -0
- package/features/dateFormatter/DefaultDateFormatter.js +25 -0
- package/features/dateFormatter/DefaultDateFormatter.js.map +1 -0
- package/features/dateFormatter/abstractions.d.ts +13 -0
- package/features/dateFormatter/abstractions.js +5 -0
- package/features/dateFormatter/abstractions.js.map +1 -0
- package/features/dateFormatter/feature.d.ts +3 -0
- package/features/dateFormatter/feature.js +17 -0
- package/features/dateFormatter/feature.js.map +1 -0
- package/features/dateFormatter/index.d.ts +4 -0
- package/features/dateFormatter/index.js +4 -0
- package/features/dateFormatter/useDateFormatter.d.ts +5 -0
- package/features/dateFormatter/useDateFormatter.js +8 -0
- package/features/dateFormatter/useDateFormatter.js.map +1 -0
- package/features/featureFlags/FeatureFlagsGateway.d.ts +10 -0
- package/features/featureFlags/FeatureFlagsGateway.js +40 -0
- package/features/featureFlags/FeatureFlagsGateway.js.map +1 -0
- package/features/featureFlags/FeatureFlagsService.d.ts +16 -0
- package/features/featureFlags/FeatureFlagsService.js +64 -0
- package/features/featureFlags/FeatureFlagsService.js.map +1 -0
- package/features/featureFlags/abstractions.d.ts +19 -0
- package/features/featureFlags/abstractions.js +6 -0
- package/features/featureFlags/abstractions.js.map +1 -0
- package/features/featureFlags/feature.d.ts +3 -0
- package/features/featureFlags/feature.js +19 -0
- package/features/featureFlags/feature.js.map +1 -0
- package/features/formModel/Field.js +10 -0
- package/features/formModel/Field.js.map +1 -1
- package/features/formModel/FieldBuilder.js +1 -1
- package/features/formModel/FieldBuilder.js.map +1 -1
- package/features/formModel/FieldBuilder.test.js +4 -4
- package/features/formModel/FieldBuilder.test.js.map +1 -1
- package/features/formModel/FormErrors.d.ts +2 -2
- package/features/formModel/FormModel.test.js +50 -0
- package/features/formModel/FormModel.test.js.map +1 -1
- package/features/formModel/FormView.d.ts +8 -4
- package/features/formModel/PresenterErrors.d.ts +2 -2
- package/features/formModel/demo/FormModelDemo.d.ts +2 -2
- package/features/formModel/renderers.d.ts +1 -0
- package/features/formModel/renderers.js +1 -0
- package/features/notifications/NotificationsRenderer.d.ts +2 -2
- package/features/security/AuthenticationContext/ApiStreamClientDecorator.d.ts +22 -0
- package/features/security/AuthenticationContext/ApiStreamClientDecorator.js +32 -0
- package/features/security/AuthenticationContext/ApiStreamClientDecorator.js.map +1 -0
- package/features/security/AuthenticationContext/feature.js +2 -0
- package/features/security/AuthenticationContext/feature.js.map +1 -1
- package/features/slugify/DefaultSlugify.d.ts +8 -0
- package/features/slugify/DefaultSlugify.js +20 -0
- package/features/slugify/DefaultSlugify.js.map +1 -0
- package/features/slugify/abstractions.d.ts +12 -0
- package/features/slugify/abstractions.js +5 -0
- package/features/slugify/abstractions.js.map +1 -0
- package/features/slugify/feature.d.ts +1 -0
- package/features/slugify/feature.js +11 -0
- package/features/slugify/feature.js.map +1 -0
- package/features/slugify/index.d.ts +3 -0
- package/features/slugify/index.js +3 -0
- package/features/stringFormatter/DefaultStringFormatter.d.ts +17 -0
- package/features/stringFormatter/DefaultStringFormatter.js +19 -0
- package/features/stringFormatter/DefaultStringFormatter.js.map +1 -0
- package/features/stringFormatter/abstractions.d.ts +11 -0
- package/features/stringFormatter/abstractions.js +5 -0
- package/features/stringFormatter/abstractions.js.map +1 -0
- package/features/stringFormatter/feature.d.ts +3 -0
- package/features/stringFormatter/feature.js +19 -0
- package/features/stringFormatter/feature.js.map +1 -0
- package/features/stringFormatter/index.d.ts +4 -0
- package/features/stringFormatter/index.js +4 -0
- package/features/stringFormatter/useStringFormatter.d.ts +5 -0
- package/features/stringFormatter/useStringFormatter.js +8 -0
- package/features/stringFormatter/useStringFormatter.js.map +1 -0
- package/features/tenancy/ApiStreamClientDecorator.d.ts +16 -0
- package/features/tenancy/ApiStreamClientDecorator.js +30 -0
- package/features/tenancy/ApiStreamClientDecorator.js.map +1 -0
- package/features/tenancy/feature.js +2 -0
- package/features/tenancy/feature.js.map +1 -1
- package/features/wcp/ReactLicense.d.ts +6 -0
- package/features/wcp/ReactLicense.js +18 -0
- package/features/wcp/ReactLicense.js.map +1 -1
- package/features/wcp/WcpGateway.js +3 -0
- package/features/wcp/WcpGateway.js.map +1 -1
- package/hooks/index.d.ts +3 -0
- package/hooks/index.js +3 -0
- package/hooks/useDrawer.d.ts +9 -0
- package/hooks/useDrawer.js +19 -0
- package/hooks/useDrawer.js.map +1 -0
- package/hooks/useHotkeys.js +5 -3
- package/hooks/useHotkeys.js.map +1 -1
- package/hooks/useOpenDrawer.d.ts +7 -0
- package/hooks/useOpenDrawer.js +18 -0
- package/hooks/useOpenDrawer.js.map +1 -0
- package/hooks/useSnackbar.js.map +1 -1
- package/index.d.ts +18 -1
- package/index.js +23 -12
- package/modules/AccessManagementExtension.js +46 -22
- package/modules/AccessManagementExtension.js.map +1 -1
- package/package.json +31 -28
- package/presentation/accessManagement/SecurityPermissions.js +3 -3
- package/presentation/accessManagement/SecurityPermissions.js.map +1 -1
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.d.ts +3 -1
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.js +13 -16
- package/presentation/accessManagement/apiKeys/ApiKeysPresenter.js.map +1 -1
- package/presentation/accessManagement/apiKeys/components/ApiKeysView.d.ts +2 -2
- package/presentation/accessManagement/apiKeys/components/ApiKeysView.js +13 -7
- package/presentation/accessManagement/apiKeys/components/ApiKeysView.js.map +1 -1
- package/presentation/accessManagement/roles/RolesPresenter.d.ts +3 -1
- package/presentation/accessManagement/roles/RolesPresenter.js +11 -14
- package/presentation/accessManagement/roles/RolesPresenter.js.map +1 -1
- package/presentation/accessManagement/roles/components/RolesView.d.ts +2 -2
- package/presentation/accessManagement/roles/components/RolesView.js +10 -6
- package/presentation/accessManagement/roles/components/RolesView.js.map +1 -1
- package/presentation/accessManagement/teams/TeamsPresenter.d.ts +3 -1
- package/presentation/accessManagement/teams/TeamsPresenter.js +11 -14
- package/presentation/accessManagement/teams/TeamsPresenter.js.map +1 -1
- package/presentation/accessManagement/teams/components/TeamsView.d.ts +2 -2
- package/presentation/accessManagement/teams/components/TeamsView.js +10 -6
- package/presentation/accessManagement/teams/components/TeamsView.js.map +1 -1
- package/presentation/commandPalette/CommandPalettePresenter.d.ts +21 -0
- package/presentation/commandPalette/CommandPalettePresenter.js +91 -0
- package/presentation/commandPalette/CommandPalettePresenter.js.map +1 -0
- package/presentation/commandPalette/abstractions.d.ts +76 -0
- package/presentation/commandPalette/abstractions.js +7 -0
- package/presentation/commandPalette/abstractions.js.map +1 -0
- package/presentation/commandPalette/commands/AskAiCommand.d.ts +25 -0
- package/presentation/commandPalette/commands/AskAiCommand.js +33 -0
- package/presentation/commandPalette/commands/AskAiCommand.js.map +1 -0
- package/presentation/commandPalette/commands/CopyCurrentUrlCommand.d.ts +15 -0
- package/presentation/commandPalette/commands/CopyCurrentUrlCommand.js +33 -0
- package/presentation/commandPalette/commands/CopyCurrentUrlCommand.js.map +1 -0
- package/presentation/commandPalette/commands/SendMessageCommand.d.ts +23 -0
- package/presentation/commandPalette/commands/SendMessageCommand.js +66 -0
- package/presentation/commandPalette/commands/SendMessageCommand.js.map +1 -0
- package/presentation/commandPalette/commands/SignOutCommand.d.ts +18 -0
- package/presentation/commandPalette/commands/SignOutCommand.js +37 -0
- package/presentation/commandPalette/commands/SignOutCommand.js.map +1 -0
- package/presentation/commandPalette/commands/feature.d.ts +5 -0
- package/presentation/commandPalette/commands/feature.js +17 -0
- package/presentation/commandPalette/commands/feature.js.map +1 -0
- package/presentation/commandPalette/feature.d.ts +3 -0
- package/presentation/commandPalette/feature.js +17 -0
- package/presentation/commandPalette/feature.js.map +1 -0
- package/presentation/commandPalette/index.d.ts +3 -0
- package/presentation/commandPalette/index.js +2 -0
- package/presentation/featureFlags/FeatureFlagsProvider.d.ts +7 -0
- package/presentation/featureFlags/FeatureFlagsProvider.js +22 -0
- package/presentation/featureFlags/FeatureFlagsProvider.js.map +1 -0
- package/presentation/featureFlags/useFeatureFlags.d.ts +2 -0
- package/presentation/featureFlags/useFeatureFlags.js +17 -0
- package/presentation/featureFlags/useFeatureFlags.js.map +1 -0
- package/presentation/installation/components/SystemInstaller/SystemInstaller.d.ts +2 -2
- package/presentation/installation/components/SystemInstaller/steps/FinishSetup/handleStartUsing.js +0 -3
- package/presentation/installation/components/SystemInstaller/steps/FinishSetup/handleStartUsing.js.map +1 -1
- package/presentation/listPresenter/FolderAwareDataSource.js +4 -1
- package/presentation/listPresenter/FolderAwareDataSource.js.map +1 -1
- package/presentation/listPresenter/QueryMatcher.js +2 -2
- package/presentation/listPresenter/QueryMatcher.js.map +1 -1
- package/presentation/sortable/SortablePresenter.d.ts +23 -0
- package/presentation/sortable/SortablePresenter.js +175 -0
- package/presentation/sortable/SortablePresenter.js.map +1 -0
- package/presentation/sortable/abstractions.d.ts +24 -0
- package/presentation/sortable/abstractions.js +5 -0
- package/presentation/sortable/abstractions.js.map +1 -0
- package/presentation/sortable/feature.d.ts +1 -0
- package/presentation/sortable/feature.js +11 -0
- package/presentation/sortable/feature.js.map +1 -0
- package/presentation/sortable/index.d.ts +2 -0
- package/presentation/sortable/index.js +2 -0
- package/presentation/trashBin/components/BulkActions/DeleteItems.d.ts +2 -2
- package/presentation/trashBin/components/BulkActions/RestoreItems.d.ts +2 -2
- package/presentation/trashBin/components/TrashBinOverlay.d.ts +2 -2
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone.d.ts +0 -10
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone.js.map +0 -1
- package/base/Base/Menus/WebinyVersion.d.ts +0 -2
- package/base/Base/Menus/WebinyVersion.js +0 -23
- package/base/Base/Menus/WebinyVersion.js.map +0 -1
- package/base/WebinyVersion.d.ts +0 -2
- package/base/WebinyVersion.js +0 -23
- package/base/WebinyVersion.js.map +0 -1
- package/components/Wcp.d.ts +0 -19
- package/components/Wcp.js +0 -37
- package/components/Wcp.js.map +0 -1
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { makeAutoObservable, runInAction } from "mobx";
|
|
2
|
+
import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
3
|
+
import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
4
|
+
import { SortablePresenter } from "./abstractions.js";
|
|
5
|
+
function toSortableEdge(edge) {
|
|
6
|
+
if ("top" === edge || "bottom" === edge) return edge;
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
function getIndex(data) {
|
|
10
|
+
const index = data["index"];
|
|
11
|
+
if ("number" == typeof index) return index;
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
function getType(data) {
|
|
15
|
+
const type = data["type"];
|
|
16
|
+
if ("string" == typeof type) return type;
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
class SortablePresenterImpl {
|
|
20
|
+
constructor(){
|
|
21
|
+
this.draggingIndex = null;
|
|
22
|
+
this.overIndex = null;
|
|
23
|
+
this.closestEdge = null;
|
|
24
|
+
this.cleanups = new Map();
|
|
25
|
+
this.config = null;
|
|
26
|
+
makeAutoObservable(this, {
|
|
27
|
+
cleanups: false,
|
|
28
|
+
config: false
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
init(config) {
|
|
32
|
+
this.config = config;
|
|
33
|
+
}
|
|
34
|
+
getItemProps(index) {
|
|
35
|
+
return {
|
|
36
|
+
ref: (element)=>{
|
|
37
|
+
this.registerDropTarget(index, element);
|
|
38
|
+
},
|
|
39
|
+
handleRef: (element)=>{
|
|
40
|
+
this.registerDraggable(index, element);
|
|
41
|
+
},
|
|
42
|
+
isDragging: this.draggingIndex === index,
|
|
43
|
+
isOver: this.overIndex === index && this.draggingIndex !== index,
|
|
44
|
+
closestEdge: this.getVisibleEdge(index)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
dispose() {
|
|
48
|
+
for (const cleanup of this.cleanups.values())cleanup();
|
|
49
|
+
this.cleanups.clear();
|
|
50
|
+
this.draggingIndex = null;
|
|
51
|
+
this.overIndex = null;
|
|
52
|
+
this.closestEdge = null;
|
|
53
|
+
}
|
|
54
|
+
get type() {
|
|
55
|
+
return this.config.type;
|
|
56
|
+
}
|
|
57
|
+
isOwnDrag(data) {
|
|
58
|
+
return getType(data) === this.type;
|
|
59
|
+
}
|
|
60
|
+
getVisibleEdge(index) {
|
|
61
|
+
if (this.overIndex !== index || this.draggingIndex === index || null === this.draggingIndex) return null;
|
|
62
|
+
const edge = this.closestEdge;
|
|
63
|
+
if ("top" === edge && this.draggingIndex === index - 1) return null;
|
|
64
|
+
if ("bottom" === edge && this.draggingIndex === index + 1) return null;
|
|
65
|
+
return edge;
|
|
66
|
+
}
|
|
67
|
+
clearDropState() {
|
|
68
|
+
this.draggingIndex = null;
|
|
69
|
+
this.overIndex = null;
|
|
70
|
+
this.closestEdge = null;
|
|
71
|
+
}
|
|
72
|
+
computeDestination(fromIndex, toIndex, edge) {
|
|
73
|
+
let destinationIndex = toIndex;
|
|
74
|
+
if ("bottom" === edge) destinationIndex = fromIndex < toIndex ? toIndex : toIndex + 1;
|
|
75
|
+
else if ("top" === edge) destinationIndex = fromIndex > toIndex ? toIndex : toIndex - 1;
|
|
76
|
+
return destinationIndex;
|
|
77
|
+
}
|
|
78
|
+
registerDropTarget(index, element) {
|
|
79
|
+
const key = 2 * index;
|
|
80
|
+
const existing = this.cleanups.get(key);
|
|
81
|
+
if (existing) {
|
|
82
|
+
existing();
|
|
83
|
+
this.cleanups.delete(key);
|
|
84
|
+
}
|
|
85
|
+
if (!element) return;
|
|
86
|
+
const cleanup = dropTargetForElements({
|
|
87
|
+
element,
|
|
88
|
+
canDrop: ({ source })=>this.isOwnDrag(source.data) && getIndex(source.data) !== index,
|
|
89
|
+
getData: ({ input })=>attachClosestEdge({
|
|
90
|
+
index,
|
|
91
|
+
type: this.type
|
|
92
|
+
}, {
|
|
93
|
+
element,
|
|
94
|
+
input,
|
|
95
|
+
allowedEdges: [
|
|
96
|
+
"top",
|
|
97
|
+
"bottom"
|
|
98
|
+
]
|
|
99
|
+
}),
|
|
100
|
+
onDragEnter: ({ self, source })=>{
|
|
101
|
+
if (!this.isOwnDrag(source.data)) return;
|
|
102
|
+
runInAction(()=>{
|
|
103
|
+
this.overIndex = index;
|
|
104
|
+
this.closestEdge = toSortableEdge(extractClosestEdge(self.data));
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
onDrag: ({ self, source })=>{
|
|
108
|
+
if (!this.isOwnDrag(source.data)) return;
|
|
109
|
+
runInAction(()=>{
|
|
110
|
+
this.overIndex = index;
|
|
111
|
+
this.closestEdge = toSortableEdge(extractClosestEdge(self.data));
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
onDragLeave: ({ source })=>{
|
|
115
|
+
if (!this.isOwnDrag(source.data)) return;
|
|
116
|
+
runInAction(()=>{
|
|
117
|
+
if (this.overIndex === index) {
|
|
118
|
+
this.overIndex = null;
|
|
119
|
+
this.closestEdge = null;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
onDrop: ({ self, source })=>{
|
|
124
|
+
if (!this.isOwnDrag(source.data)) return;
|
|
125
|
+
const fromIndex = getIndex(source.data);
|
|
126
|
+
const toIndex = getIndex(self.data);
|
|
127
|
+
const edge = toSortableEdge(extractClosestEdge(self.data));
|
|
128
|
+
runInAction(()=>{
|
|
129
|
+
this.clearDropState();
|
|
130
|
+
});
|
|
131
|
+
if (null === fromIndex || null === toIndex || !this.config) return;
|
|
132
|
+
const destinationIndex = this.computeDestination(fromIndex, toIndex, edge);
|
|
133
|
+
if (destinationIndex !== fromIndex) this.config.onReorder(fromIndex, destinationIndex);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
this.cleanups.set(key, cleanup);
|
|
137
|
+
}
|
|
138
|
+
registerDraggable(index, element) {
|
|
139
|
+
const key = 2 * index + 1;
|
|
140
|
+
const existing = this.cleanups.get(key);
|
|
141
|
+
if (existing) {
|
|
142
|
+
existing();
|
|
143
|
+
this.cleanups.delete(key);
|
|
144
|
+
}
|
|
145
|
+
if (!element) return;
|
|
146
|
+
const container = element.closest("[data-sortable-item]");
|
|
147
|
+
if (!container) return;
|
|
148
|
+
const cleanup = draggable({
|
|
149
|
+
element: container,
|
|
150
|
+
dragHandle: element,
|
|
151
|
+
getInitialData: ()=>({
|
|
152
|
+
index,
|
|
153
|
+
type: this.type
|
|
154
|
+
}),
|
|
155
|
+
onDragStart: ()=>{
|
|
156
|
+
runInAction(()=>{
|
|
157
|
+
this.draggingIndex = index;
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
onDrop: ()=>{
|
|
161
|
+
runInAction(()=>{
|
|
162
|
+
this.clearDropState();
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
this.cleanups.set(key, cleanup);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const SortablePresenter_SortablePresenter = SortablePresenter.createImplementation({
|
|
170
|
+
implementation: SortablePresenterImpl,
|
|
171
|
+
dependencies: []
|
|
172
|
+
});
|
|
173
|
+
export { SortablePresenter_SortablePresenter as SortablePresenter };
|
|
174
|
+
|
|
175
|
+
//# sourceMappingURL=SortablePresenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/sortable/SortablePresenter.js","sources":["../../../src/presentation/sortable/SortablePresenter.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from \"mobx\";\nimport {\n draggable,\n dropTargetForElements\n} from \"@atlaskit/pragmatic-drag-and-drop/element/adapter\";\nimport {\n attachClosestEdge,\n extractClosestEdge\n} from \"@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge\";\nimport { SortablePresenter as Abstraction } from \"./abstractions.js\";\n\nfunction toSortableEdge(edge: string | null): Abstraction.Edge | null {\n if (edge === \"top\" || edge === \"bottom\") {\n return edge;\n }\n return null;\n}\n\nfunction getIndex(data: Record<string | symbol, unknown>): number | null {\n const index = data[\"index\"];\n if (typeof index === \"number\") {\n return index;\n }\n return null;\n}\n\nfunction getType(data: Record<string | symbol, unknown>): string | null {\n const type = data[\"type\"];\n if (typeof type === \"string\") {\n return type;\n }\n return null;\n}\n\nclass SortablePresenterImpl implements Abstraction.Interface {\n private draggingIndex: number | null = null;\n private overIndex: number | null = null;\n private closestEdge: Abstraction.Edge | null = null;\n private cleanups = new Map<number, () => void>();\n private config: Abstraction.Config | null = null;\n\n constructor() {\n makeAutoObservable<SortablePresenterImpl, \"cleanups\" | \"config\">(this, {\n cleanups: false,\n config: false\n });\n }\n\n init(config: Abstraction.Config): void {\n this.config = config;\n }\n\n getItemProps(index: number): Abstraction.ItemProps {\n return {\n ref: (element: HTMLElement | null) => {\n this.registerDropTarget(index, element);\n },\n handleRef: (element: HTMLElement | null) => {\n this.registerDraggable(index, element);\n },\n isDragging: this.draggingIndex === index,\n isOver: this.overIndex === index && this.draggingIndex !== index,\n closestEdge: this.getVisibleEdge(index)\n };\n }\n\n dispose(): void {\n for (const cleanup of this.cleanups.values()) {\n cleanup();\n }\n this.cleanups.clear();\n this.draggingIndex = null;\n this.overIndex = null;\n this.closestEdge = null;\n }\n\n private get type(): string {\n return this.config!.type;\n }\n\n private isOwnDrag(data: Record<string | symbol, unknown>): boolean {\n return getType(data) === this.type;\n }\n\n private getVisibleEdge(index: number): Abstraction.Edge | null {\n if (\n this.overIndex !== index ||\n this.draggingIndex === index ||\n this.draggingIndex === null\n ) {\n return null;\n }\n const edge = this.closestEdge;\n if (edge === \"top\" && this.draggingIndex === index - 1) {\n return null;\n }\n if (edge === \"bottom\" && this.draggingIndex === index + 1) {\n return null;\n }\n return edge;\n }\n\n private clearDropState(): void {\n this.draggingIndex = null;\n this.overIndex = null;\n this.closestEdge = null;\n }\n\n private computeDestination(\n fromIndex: number,\n toIndex: number,\n edge: Abstraction.Edge | null\n ): number {\n let destinationIndex = toIndex;\n if (edge === \"bottom\") {\n destinationIndex = fromIndex < toIndex ? toIndex : toIndex + 1;\n } else if (edge === \"top\") {\n destinationIndex = fromIndex > toIndex ? toIndex : toIndex - 1;\n }\n return destinationIndex;\n }\n\n private registerDropTarget(index: number, element: HTMLElement | null): void {\n const key = index * 2;\n const existing = this.cleanups.get(key);\n if (existing) {\n existing();\n this.cleanups.delete(key);\n }\n\n if (!element) {\n return;\n }\n\n const cleanup = dropTargetForElements({\n element,\n canDrop: ({ source }) => {\n return this.isOwnDrag(source.data) && getIndex(source.data) !== index;\n },\n getData: ({ input }) => {\n return attachClosestEdge(\n { index, type: this.type },\n { element, input, allowedEdges: [\"top\", \"bottom\"] }\n );\n },\n onDragEnter: ({ self, source }) => {\n if (!this.isOwnDrag(source.data)) {\n return;\n }\n runInAction(() => {\n this.overIndex = index;\n this.closestEdge = toSortableEdge(extractClosestEdge(self.data));\n });\n },\n onDrag: ({ self, source }) => {\n if (!this.isOwnDrag(source.data)) {\n return;\n }\n runInAction(() => {\n this.overIndex = index;\n this.closestEdge = toSortableEdge(extractClosestEdge(self.data));\n });\n },\n onDragLeave: ({ source }) => {\n if (!this.isOwnDrag(source.data)) {\n return;\n }\n runInAction(() => {\n if (this.overIndex === index) {\n this.overIndex = null;\n this.closestEdge = null;\n }\n });\n },\n onDrop: ({ self, source }) => {\n if (!this.isOwnDrag(source.data)) {\n return;\n }\n\n const fromIndex = getIndex(source.data);\n const toIndex = getIndex(self.data);\n const edge = toSortableEdge(extractClosestEdge(self.data));\n\n runInAction(() => {\n this.clearDropState();\n });\n\n if (fromIndex === null || toIndex === null || !this.config) {\n return;\n }\n\n const destinationIndex = this.computeDestination(fromIndex, toIndex, edge);\n if (destinationIndex !== fromIndex) {\n this.config.onReorder(fromIndex, destinationIndex);\n }\n }\n });\n\n this.cleanups.set(key, cleanup);\n }\n\n private registerDraggable(index: number, element: HTMLElement | null): void {\n const key = index * 2 + 1;\n const existing = this.cleanups.get(key);\n if (existing) {\n existing();\n this.cleanups.delete(key);\n }\n\n if (!element) {\n return;\n }\n\n const container = element.closest(\"[data-sortable-item]\") as HTMLElement | null;\n if (!container) {\n return;\n }\n\n const cleanup = draggable({\n element: container,\n dragHandle: element,\n getInitialData: () => ({ index, type: this.type }),\n onDragStart: () => {\n runInAction(() => {\n this.draggingIndex = index;\n });\n },\n onDrop: () => {\n runInAction(() => {\n this.clearDropState();\n });\n }\n });\n\n this.cleanups.set(key, cleanup);\n }\n}\n\nexport const SortablePresenter = Abstraction.createImplementation({\n implementation: SortablePresenterImpl,\n dependencies: []\n});\n"],"names":["toSortableEdge","edge","getIndex","data","index","getType","type","SortablePresenterImpl","Map","makeAutoObservable","config","element","cleanup","fromIndex","toIndex","destinationIndex","key","existing","dropTargetForElements","source","input","attachClosestEdge","self","runInAction","extractClosestEdge","container","draggable","SortablePresenter","Abstraction"],"mappings":"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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type SortableEdge = "top" | "bottom";
|
|
2
|
+
export interface ISortableItemProps {
|
|
3
|
+
ref: (element: HTMLElement | null) => void;
|
|
4
|
+
handleRef: (element: HTMLElement | null) => void;
|
|
5
|
+
isDragging: boolean;
|
|
6
|
+
isOver: boolean;
|
|
7
|
+
closestEdge: SortableEdge | null;
|
|
8
|
+
}
|
|
9
|
+
export interface ISortablePresenterConfig {
|
|
10
|
+
type: string;
|
|
11
|
+
onReorder: (fromIndex: number, toIndex: number) => void;
|
|
12
|
+
}
|
|
13
|
+
export interface ISortablePresenter {
|
|
14
|
+
init(config: ISortablePresenterConfig): void;
|
|
15
|
+
getItemProps(index: number): ISortableItemProps;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare const SortablePresenter: import("@webiny/di").Abstraction<ISortablePresenter>;
|
|
19
|
+
export declare namespace SortablePresenter {
|
|
20
|
+
type Interface = ISortablePresenter;
|
|
21
|
+
type Config = ISortablePresenterConfig;
|
|
22
|
+
type ItemProps = ISortableItemProps;
|
|
23
|
+
type Edge = SortableEdge;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/sortable/abstractions.js","sources":["../../../src/presentation/sortable/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport type SortableEdge = \"top\" | \"bottom\";\n\nexport interface ISortableItemProps {\n ref: (element: HTMLElement | null) => void;\n handleRef: (element: HTMLElement | null) => void;\n isDragging: boolean;\n isOver: boolean;\n closestEdge: SortableEdge | null;\n}\n\nexport interface ISortablePresenterConfig {\n type: string;\n onReorder: (fromIndex: number, toIndex: number) => void;\n}\n\nexport interface ISortablePresenter {\n init(config: ISortablePresenterConfig): void;\n getItemProps(index: number): ISortableItemProps;\n dispose(): void;\n}\n\nexport const SortablePresenter = createAbstraction<ISortablePresenter>(\"SortablePresenter\");\n\nexport namespace SortablePresenter {\n export type Interface = ISortablePresenter;\n export type Config = ISortablePresenterConfig;\n export type ItemProps = ISortableItemProps;\n export type Edge = SortableEdge;\n}\n"],"names":["SortablePresenter","createAbstraction"],"mappings":";AAuBO,MAAMA,oBAAoBC,kBAAsC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SortableFeature: import("@webiny/feature/admin").FeatureDefinition<any, []>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/admin";
|
|
2
|
+
import { SortablePresenter } from "./SortablePresenter.js";
|
|
3
|
+
const SortableFeature = createFeature({
|
|
4
|
+
name: "Sortable",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(SortablePresenter);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { SortableFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentation/sortable/feature.js","sources":["../../../src/presentation/sortable/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { SortablePresenter } from \"./SortablePresenter.js\";\n\nexport const SortableFeature = createFeature({\n name: \"Sortable\",\n register(container) {\n container.register(SortablePresenter);\n }\n});\n"],"names":["SortableFeature","createFeature","container","SortablePresenter"],"mappings":";;AAGO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const BulkActionsDeleteItems: (() => React.JSX.Element) & {
|
|
3
|
-
|
|
2
|
+
export declare const BulkActionsDeleteItems: (() => React.JSX.Element) & React.NamedExoticComponent<unknown> & {
|
|
3
|
+
readonly type: () => React.JSX.Element;
|
|
4
4
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const BulkActionsRestoreItems: (() => React.JSX.Element) & {
|
|
3
|
-
|
|
2
|
+
export declare const BulkActionsRestoreItems: (() => React.JSX.Element) & React.NamedExoticComponent<unknown> & {
|
|
3
|
+
readonly type: () => React.JSX.Element;
|
|
4
4
|
};
|
|
@@ -6,7 +6,7 @@ interface TrashBinOverlayProps {
|
|
|
6
6
|
onExited: () => void;
|
|
7
7
|
onItemAfterRestore?: (item: TrashBinItem) => Promise<void>;
|
|
8
8
|
}
|
|
9
|
-
export declare const TrashBinOverlay: (({ presenter, title, onExited, onItemAfterRestore }: TrashBinOverlayProps) => React.JSX.Element) & {
|
|
10
|
-
|
|
9
|
+
export declare const TrashBinOverlay: (({ presenter, title, onExited, onItemAfterRestore }: TrashBinOverlayProps) => React.JSX.Element) & React.NamedExoticComponent<TrashBinOverlayProps> & {
|
|
10
|
+
readonly type: ({ presenter, title, onExited, onItemAfterRestore }: TrashBinOverlayProps) => React.JSX.Element;
|
|
11
11
|
};
|
|
12
12
|
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { IObjectFieldVM } from "../../../../features/formModel/index.js";
|
|
3
|
-
interface MultiValueDynamicZoneProps {
|
|
4
|
-
field: IObjectFieldVM;
|
|
5
|
-
showContainer?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare const MultiValueDynamicZone: (({ field, showContainer }: MultiValueDynamicZoneProps) => React.JSX.Element) & {
|
|
8
|
-
displayName: string;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone.js","sources":["../../../../../src/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone.tsx"],"sourcesContent":["import React from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Accordion, Button, Tooltip, useToast } from \"@webiny/admin-ui\";\nimport { useFeature } from \"@webiny/app\";\nimport { ReactComponent as CopyIcon } from \"@webiny/icons/content_copy.svg\";\nimport { ReactComponent as PasteIcon } from \"@webiny/icons/content_paste.svg\";\nimport { ReactComponent as DeleteIcon } from \"@webiny/icons/delete_outline.svg\";\nimport { ReactComponent as CloneIcon } from \"@webiny/icons/library_add.svg\";\nimport { ReactComponent as ArrowUpIcon } from \"@webiny/icons/expand_less.svg\";\nimport { ReactComponent as ArrowDownIcon } from \"@webiny/icons/expand_more.svg\";\nimport { ReactComponent as HorizontalRuleIcon } from \"@webiny/icons/horizontal_rule.svg\";\nimport type { IObjectFieldItemVM, IObjectFieldVM } from \"~/features/formModel/index.js\";\nimport { TEMPLATE_DISCRIMINATOR } from \"~/features/formModel/ObjectField.js\";\nimport { ClipboardFeature } from \"~/features/clipboard/feature.js\";\nimport { useConfirmationDialog } from \"~/hooks/useConfirmationDialog.js\";\nimport { NestedLayout } from \"./ObjectFieldComponents.js\";\nimport { AddTemplateButton } from \"./TemplatePicker.js\";\n\ninterface MultiValueDynamicZoneProps {\n field: IObjectFieldVM;\n showContainer?: boolean;\n}\n\nexport const MultiValueDynamicZone = observer(\n ({ field, showContainer = true }: MultiValueDynamicZoneProps) => {\n const toast = useToast();\n const { clipboard } = useFeature(ClipboardFeature);\n const itemCount = field.items.length;\n\n const clipboardItem = clipboard.item;\n const canPaste =\n clipboardItem !== null &&\n clipboardItem.type === \"wby.dz\" &&\n typeof clipboardItem.data[TEMPLATE_DISCRIMINATOR] === \"string\" &&\n field.availableTemplates.some(t => t.id === clipboardItem.data[TEMPLATE_DISCRIMINATOR]);\n\n const content = (\n <div className={\"flex flex-col gap-lg\"}>\n {itemCount > 0 ? (\n <Accordion\n background={\"base\"}\n variant={\"container\"}\n className={\"gap-md flex flex-col\"}\n >\n {field.items.map((item, index) => (\n <TemplatedListItem\n key={item.key}\n item={item}\n index={index}\n total={itemCount}\n templates={field.availableTemplates}\n disabled={field.disabled}\n />\n ))}\n </Accordion>\n ) : null}\n {!field.disabled && (\n <div className={\"flex gap-sm items-center\"}>\n <AddTemplateButton\n templates={field.availableTemplates}\n onSelect={template => field.addItem(template.id)}\n />\n {canPaste && (\n <Button\n size={\"sm\"}\n variant={\"tertiary\"}\n text={\"Paste\"}\n icon={<PasteIcon />}\n onClick={() => {\n const pasted = clipboard.paste();\n if (pasted) {\n field.addItem(pasted.data);\n toast.showSuccessToast({\n title: \"Pasted from clipboard.\"\n });\n }\n }}\n />\n )}\n </div>\n )}\n </div>\n );\n\n if (!showContainer) {\n return content;\n }\n\n const label = `${field.label || \"\"}${itemCount ? ` (${itemCount})` : \"\"}`;\n\n return (\n <Accordion background={\"base\"} variant={\"container\"}>\n <Accordion.Item\n icon={\n <Accordion.Item.Icon\n color={\"accent\"}\n label={\"Dynamic Zone\"}\n icon={<HorizontalRuleIcon />}\n />\n }\n title={label}\n defaultOpen={true}\n >\n {content}\n </Accordion.Item>\n </Accordion>\n );\n }\n);\n\ninterface TemplatedListItemProps {\n item: IObjectFieldItemVM;\n index: number;\n total: number;\n templates: { id: string; label: string }[];\n disabled: boolean;\n}\n\nconst TemplatedListItem = observer(\n ({ item, index, total, templates, disabled }: TemplatedListItemProps) => {\n const toast = useToast();\n const { clipboard } = useFeature(ClipboardFeature);\n const { showConfirmation } = useConfirmationDialog({\n title: \"Delete item\",\n message: \"Are you sure you want to delete this item? This action is not reversible.\",\n acceptLabel: \"Yes, I'm sure!\",\n cancelLabel: \"No, leave it.\"\n });\n\n const template = templates.find(t => t.id === item.templateId);\n const title = template?.label || `Item #${index + 1}`;\n\n const onDelete = () => {\n showConfirmation(() => {\n item.remove();\n });\n };\n\n const actions = (\n <>\n <Accordion.Item.Action\n icon={<Tooltip trigger={<ArrowUpIcon />} content={\"Move up\"} />}\n onClick={item.moveUp}\n disabled={index === 0}\n />\n <Accordion.Item.Action\n icon={<Tooltip trigger={<ArrowDownIcon />} content={\"Move down\"} />}\n onClick={item.moveDown}\n disabled={index === total - 1}\n />\n <Accordion.Item.Action.Separator />\n <Accordion.Item.Action\n icon={<Tooltip trigger={<CopyIcon />} content={\"Copy to clipboard\"} />}\n onClick={() => {\n clipboard.copy({ type: \"wby.dz\", data: item.getClonedData() });\n toast.showSuccessToast({ title: \"Copied to clipboard.\" });\n }}\n />\n <Accordion.Item.Action\n icon={<Tooltip trigger={<CloneIcon />} content={\"Duplicate\"} />}\n onClick={item.duplicate}\n />\n <Accordion.Item.Action\n icon={<Tooltip trigger={<DeleteIcon />} content={\"Delete\"} />}\n onClick={onDelete}\n />\n </>\n );\n\n return (\n <Accordion.Item title={title} actions={disabled ? null : actions} defaultOpen={false}>\n <NestedLayout layout={item.layout} />\n </Accordion.Item>\n );\n }\n);\n"],"names":["MultiValueDynamicZone","observer","field","showContainer","toast","useToast","clipboard","useFeature","ClipboardFeature","itemCount","clipboardItem","canPaste","TEMPLATE_DISCRIMINATOR","t","content","Accordion","item","index","TemplatedListItem","AddTemplateButton","template","Button","PasteIcon","pasted","label","HorizontalRuleIcon","total","templates","disabled","showConfirmation","useConfirmationDialog","title","onDelete","actions","Tooltip","ArrowUpIcon","ArrowDownIcon","CopyIcon","CloneIcon","DeleteIcon","NestedLayout"],"mappings":"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"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import react, { useMemo } from "react";
|
|
2
|
-
import { config } from "@webiny/app/config.js";
|
|
3
|
-
import { useWcp } from "../../../presentation/wcp/useWcp.js";
|
|
4
|
-
import { Tag } from "@webiny/admin-ui";
|
|
5
|
-
const WebinyVersion = ()=>{
|
|
6
|
-
const wbyVersion = config.getKey("WEBINY_VERSION", process.env.REACT_APP_WEBINY_VERSION);
|
|
7
|
-
const wcp = useWcp();
|
|
8
|
-
const wcpBadge = useMemo(()=>{
|
|
9
|
-
const wcpProject = wcp.getProject();
|
|
10
|
-
if (!wcpProject) return null;
|
|
11
|
-
return /*#__PURE__*/ react.createElement(Tag, {
|
|
12
|
-
variant: "accent",
|
|
13
|
-
content: "WCP",
|
|
14
|
-
className: "ml-sm-extra"
|
|
15
|
-
});
|
|
16
|
-
}, []);
|
|
17
|
-
return /*#__PURE__*/ react.createElement("div", {
|
|
18
|
-
className: "flex items-center"
|
|
19
|
-
}, "Webiny v", wbyVersion, wcpBadge);
|
|
20
|
-
};
|
|
21
|
-
export { WebinyVersion };
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=WebinyVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base/Base/Menus/WebinyVersion.js","sources":["../../../../src/base/Base/Menus/WebinyVersion.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { config as appConfig } from \"@webiny/app/config.js\";\nimport { useWcp } from \"~/presentation/wcp/useWcp.js\";\nimport { Tag } from \"@webiny/admin-ui\";\n\nexport const WebinyVersion = () => {\n const wbyVersion = appConfig.getKey(\"WEBINY_VERSION\", process.env.REACT_APP_WEBINY_VERSION);\n const wcp = useWcp();\n\n const wcpBadge = useMemo(() => {\n const wcpProject = wcp.getProject();\n if (!wcpProject) {\n return null;\n }\n\n return <Tag variant={\"accent\"} content={\"WCP\"} className={\"ml-sm-extra\"} />;\n }, []);\n\n return (\n <div className={\"flex items-center\"}>\n Webiny v{wbyVersion}\n {wcpBadge}\n </div>\n );\n};\n"],"names":["WebinyVersion","wbyVersion","appConfig","process","wcp","useWcp","wcpBadge","useMemo","wcpProject","Tag"],"mappings":";;;;AAKO,MAAMA,gBAAgB;IACzB,MAAMC,aAAaC,OAAAA,MAAgB,CAAC,kBAAkBC,QAAQ,GAAG,CAAC,wBAAwB;IAC1F,MAAMC,MAAMC;IAEZ,MAAMC,WAAWC,QAAQ;QACrB,MAAMC,aAAaJ,IAAI,UAAU;QACjC,IAAI,CAACI,YACD,OAAO;QAGX,OAAO,WAAP,GAAO,oBAACC,KAAGA;YAAC,SAAS;YAAU,SAAS;YAAO,WAAW;;IAC9D,GAAG,EAAE;IAEL,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;OAAqB,YACxBR,YACRK;AAGb"}
|
package/base/WebinyVersion.d.ts
DELETED
package/base/WebinyVersion.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import react, { useMemo } from "react";
|
|
2
|
-
import { config } from "@webiny/app/config.js";
|
|
3
|
-
import { useWcp } from "../presentation/wcp/useWcp.js";
|
|
4
|
-
import { Tag } from "@webiny/admin-ui";
|
|
5
|
-
const WebinyVersion = ()=>{
|
|
6
|
-
const wbyVersion = config.getKey("WEBINY_VERSION", process.env.REACT_APP_WEBINY_VERSION);
|
|
7
|
-
const wcp = useWcp();
|
|
8
|
-
const wcpBadge = useMemo(()=>{
|
|
9
|
-
const wcpProject = wcp.getProject();
|
|
10
|
-
if (!wcpProject) return null;
|
|
11
|
-
return /*#__PURE__*/ react.createElement(Tag, {
|
|
12
|
-
variant: "accent",
|
|
13
|
-
content: "WCP",
|
|
14
|
-
className: "ml-sm-extra"
|
|
15
|
-
});
|
|
16
|
-
}, []);
|
|
17
|
-
return /*#__PURE__*/ react.createElement("div", {
|
|
18
|
-
className: "flex items-center"
|
|
19
|
-
}, "Webiny v", wbyVersion, wcpBadge);
|
|
20
|
-
};
|
|
21
|
-
export { WebinyVersion };
|
|
22
|
-
|
|
23
|
-
//# sourceMappingURL=WebinyVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base/WebinyVersion.js","sources":["../../src/base/WebinyVersion.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { config as appConfig } from \"@webiny/app/config.js\";\nimport { useWcp } from \"~/presentation/wcp/useWcp.js\";\nimport { Tag } from \"@webiny/admin-ui\";\n\nexport const WebinyVersion = () => {\n const wbyVersion = appConfig.getKey(\"WEBINY_VERSION\", process.env.REACT_APP_WEBINY_VERSION);\n const wcp = useWcp();\n\n const wcpBadge = useMemo(() => {\n const wcpProject = wcp.getProject();\n if (!wcpProject) {\n return null;\n }\n\n return <Tag variant={\"accent\"} content={\"WCP\"} className={\"ml-sm-extra\"} />;\n }, []);\n\n return (\n <div className={\"flex items-center\"}>\n Webiny v{wbyVersion}\n {wcpBadge}\n </div>\n );\n};\n"],"names":["WebinyVersion","wbyVersion","appConfig","process","wcp","useWcp","wcpBadge","useMemo","wcpProject","Tag"],"mappings":";;;;AAKO,MAAMA,gBAAgB;IACzB,MAAMC,aAAaC,OAAAA,MAAgB,CAAC,kBAAkBC,QAAQ,GAAG,CAAC,wBAAwB;IAC1F,MAAMC,MAAMC;IAEZ,MAAMC,WAAWC,QAAQ;QACrB,MAAMC,aAAaJ,IAAI,UAAU;QACjC,IAAI,CAACI,YACD,OAAO;QAGX,OAAO,WAAP,GAAO,oBAACC,KAAGA;YAAC,SAAS;YAAU,SAAS;YAAO,WAAW;;IAC9D,GAAG,EAAE;IAEL,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;OAAqB,YACxBR,YACRK;AAGb"}
|
package/components/Wcp.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface ChildrenProps {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
}
|
|
5
|
-
declare function CanUseMultiTenancy({ children }: ChildrenProps): React.JSX.Element | null;
|
|
6
|
-
declare function CanUseTeams({ children }: ChildrenProps): React.JSX.Element | null;
|
|
7
|
-
declare function CanUsePrivateFiles({ children }: ChildrenProps): React.JSX.Element | null;
|
|
8
|
-
declare function CanUseFileManagerThreatDetection({ children }: ChildrenProps): React.JSX.Element | null;
|
|
9
|
-
declare function CanUseWorkflows({ children }: ChildrenProps): React.JSX.Element | null;
|
|
10
|
-
declare function CanUseHcmsFieldPermissions({ children }: ChildrenProps): React.JSX.Element | null;
|
|
11
|
-
export declare const Wcp: {
|
|
12
|
-
CanUseMultiTenancy: typeof CanUseMultiTenancy;
|
|
13
|
-
CanUseTeams: typeof CanUseTeams;
|
|
14
|
-
CanUsePrivateFiles: typeof CanUsePrivateFiles;
|
|
15
|
-
CanUseFileManagerThreatDetection: typeof CanUseFileManagerThreatDetection;
|
|
16
|
-
CanUseWorkflows: typeof CanUseWorkflows;
|
|
17
|
-
CanUseHcmsFieldPermissions: typeof CanUseHcmsFieldPermissions;
|
|
18
|
-
};
|
|
19
|
-
export {};
|
package/components/Wcp.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import react from "react";
|
|
2
|
-
import { useWcp } from "../presentation/wcp/useWcp.js";
|
|
3
|
-
function CanUseMultiTenancy({ children }) {
|
|
4
|
-
const wcp = useWcp();
|
|
5
|
-
return wcp.canUseFeature("multiTenancy") ? /*#__PURE__*/ react.createElement(react.Fragment, null, children) : null;
|
|
6
|
-
}
|
|
7
|
-
function CanUseTeams({ children }) {
|
|
8
|
-
const wcp = useWcp();
|
|
9
|
-
return wcp.canUseTeams() ? /*#__PURE__*/ react.createElement(react.Fragment, null, children) : null;
|
|
10
|
-
}
|
|
11
|
-
function CanUsePrivateFiles({ children }) {
|
|
12
|
-
const wcp = useWcp();
|
|
13
|
-
return wcp.canUsePrivateFiles() ? /*#__PURE__*/ react.createElement(react.Fragment, null, children) : null;
|
|
14
|
-
}
|
|
15
|
-
function CanUseFileManagerThreatDetection({ children }) {
|
|
16
|
-
const wcp = useWcp();
|
|
17
|
-
return wcp.canUseFileManagerThreatDetection() ? /*#__PURE__*/ react.createElement(react.Fragment, null, children) : null;
|
|
18
|
-
}
|
|
19
|
-
function CanUseWorkflows({ children }) {
|
|
20
|
-
const wcp = useWcp();
|
|
21
|
-
return wcp.canUseWorkflows() ? /*#__PURE__*/ react.createElement(react.Fragment, null, children) : null;
|
|
22
|
-
}
|
|
23
|
-
function CanUseHcmsFieldPermissions({ children }) {
|
|
24
|
-
const wcp = useWcp();
|
|
25
|
-
return wcp.canUseHcmsFieldPermissions() ? /*#__PURE__*/ react.createElement(react.Fragment, null, children) : null;
|
|
26
|
-
}
|
|
27
|
-
const Wcp = {
|
|
28
|
-
CanUseMultiTenancy: CanUseMultiTenancy,
|
|
29
|
-
CanUseTeams: CanUseTeams,
|
|
30
|
-
CanUsePrivateFiles: CanUsePrivateFiles,
|
|
31
|
-
CanUseFileManagerThreatDetection: CanUseFileManagerThreatDetection,
|
|
32
|
-
CanUseWorkflows: CanUseWorkflows,
|
|
33
|
-
CanUseHcmsFieldPermissions: CanUseHcmsFieldPermissions
|
|
34
|
-
};
|
|
35
|
-
export { Wcp };
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=Wcp.js.map
|
package/components/Wcp.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components/Wcp.js","sources":["../../src/components/Wcp.tsx"],"sourcesContent":["import React from \"react\";\nimport { useWcp } from \"~/presentation/wcp/useWcp.js\";\n\ninterface ChildrenProps {\n children: React.ReactNode;\n}\n\nfunction CanUseMultiTenancy({ children }: ChildrenProps) {\n const wcp = useWcp();\n return wcp.canUseFeature(\"multiTenancy\") ? <>{children}</> : null;\n}\n\nfunction CanUseTeams({ children }: ChildrenProps) {\n const wcp = useWcp();\n return wcp.canUseTeams() ? <>{children}</> : null;\n}\n\nfunction CanUsePrivateFiles({ children }: ChildrenProps) {\n const wcp = useWcp();\n return wcp.canUsePrivateFiles() ? <>{children}</> : null;\n}\n\nfunction CanUseFileManagerThreatDetection({ children }: ChildrenProps) {\n const wcp = useWcp();\n return wcp.canUseFileManagerThreatDetection() ? <>{children}</> : null;\n}\n\nfunction CanUseWorkflows({ children }: ChildrenProps) {\n const wcp = useWcp();\n return wcp.canUseWorkflows() ? <>{children}</> : null;\n}\n\nfunction CanUseHcmsFieldPermissions({ children }: ChildrenProps) {\n const wcp = useWcp();\n return wcp.canUseHcmsFieldPermissions() ? <>{children}</> : null;\n}\n\nexport const Wcp = {\n CanUseMultiTenancy,\n CanUseTeams,\n CanUsePrivateFiles,\n CanUseFileManagerThreatDetection,\n CanUseWorkflows,\n CanUseHcmsFieldPermissions\n};\n"],"names":["CanUseMultiTenancy","children","wcp","useWcp","CanUseTeams","CanUsePrivateFiles","CanUseFileManagerThreatDetection","CanUseWorkflows","CanUseHcmsFieldPermissions","Wcp"],"mappings":";;AAOA,SAASA,mBAAmB,EAAEC,QAAQ,EAAiB;IACnD,MAAMC,MAAMC;IACZ,OAAOD,IAAI,aAAa,CAAC,kBAAkB,WAAlB,GAAkB,0CAAGD,YAAe;AACjE;AAEA,SAASG,YAAY,EAAEH,QAAQ,EAAiB;IAC5C,MAAMC,MAAMC;IACZ,OAAOD,IAAI,WAAW,KAAK,WAAL,GAAK,0CAAGD,YAAe;AACjD;AAEA,SAASI,mBAAmB,EAAEJ,QAAQ,EAAiB;IACnD,MAAMC,MAAMC;IACZ,OAAOD,IAAI,kBAAkB,KAAK,WAAL,GAAK,0CAAGD,YAAe;AACxD;AAEA,SAASK,iCAAiC,EAAEL,QAAQ,EAAiB;IACjE,MAAMC,MAAMC;IACZ,OAAOD,IAAI,gCAAgC,KAAK,WAAL,GAAK,0CAAGD,YAAe;AACtE;AAEA,SAASM,gBAAgB,EAAEN,QAAQ,EAAiB;IAChD,MAAMC,MAAMC;IACZ,OAAOD,IAAI,eAAe,KAAK,WAAL,GAAK,0CAAGD,YAAe;AACrD;AAEA,SAASO,2BAA2B,EAAEP,QAAQ,EAAiB;IAC3D,MAAMC,MAAMC;IACZ,OAAOD,IAAI,0BAA0B,KAAK,WAAL,GAAK,0CAAGD,YAAe;AAChE;AAEO,MAAMQ,MAAM;IACfT,oBAAAA;IACAI,aAAAA;IACAC,oBAAAA;IACAC,kCAAAA;IACAC,iBAAAA;IACAC,4BAAAA;AACJ"}
|