@webiny/app-admin 6.1.0-beta.3 → 6.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base/Admin.js +2 -0
- package/base/Admin.js.map +1 -1
- package/base/Base/DefaultFieldRenderers.d.ts +2 -0
- package/base/Base/DefaultFieldRenderers.js +15 -0
- package/base/Base/DefaultFieldRenderers.js.map +1 -0
- package/base/Base/FieldRenderers/SelectRenderer.d.ts +5 -0
- package/base/Base/FieldRenderers/SelectRenderer.js +24 -0
- package/base/Base/FieldRenderers/SelectRenderer.js.map +1 -0
- package/base/Base/FieldRenderers/TextRenderer.d.ts +5 -0
- package/base/Base/FieldRenderers/TextRenderer.js +21 -0
- package/base/Base/FieldRenderers/TextRenderer.js.map +1 -0
- package/base/Base/Menus.js +7 -0
- package/base/Base/Menus.js.map +1 -1
- package/base/Base.js +2 -1
- package/base/Base.js.map +1 -1
- package/base/createRootContainer.js +2 -0
- package/base/createRootContainer.js.map +1 -1
- package/components/Dialogs/DialogParamsContext.d.ts +6 -0
- package/components/Dialogs/DialogParamsContext.js +11 -0
- package/components/Dialogs/DialogParamsContext.js.map +1 -0
- package/components/Dialogs/DialogsContext.d.ts +2 -0
- package/components/Dialogs/DialogsContext.js +32 -4
- package/components/Dialogs/DialogsContext.js.map +1 -1
- package/components/OptionsMenu/OptionsMenu.d.ts +6 -0
- package/components/OptionsMenu/OptionsMenu.js +3 -3
- package/components/OptionsMenu/OptionsMenu.js.map +1 -1
- package/components/RegisterFeature.js +5 -5
- package/components/RegisterFeature.js.map +1 -1
- package/components/Wcp.d.ts +2 -0
- package/components/Wcp.js +7 -0
- package/components/Wcp.js.map +1 -1
- package/config/AdminConfig/Dialog.d.ts +10 -0
- package/config/AdminConfig/Dialog.js +21 -0
- package/config/AdminConfig/Dialog.js.map +1 -0
- package/config/AdminConfig/FieldRenderer.d.ts +11 -0
- package/config/AdminConfig/FieldRenderer.js +21 -0
- package/config/AdminConfig/FieldRenderer.js.map +1 -0
- package/config/AdminConfig/Form.d.ts +3 -0
- package/config/AdminConfig/Form.js +6 -0
- package/config/AdminConfig/Form.js.map +1 -0
- package/config/AdminConfig.d.ts +10 -0
- package/config/AdminConfig.js +7 -1
- package/config/AdminConfig.js.map +1 -1
- package/exports/admin/security.d.ts +6 -0
- package/exports/admin/security.js +5 -0
- package/exports/admin/security.js.map +1 -1
- package/exports/admin/ui.d.ts +2 -0
- package/exports/admin/ui.js +2 -0
- package/exports/admin/ui.js.map +1 -1
- package/exports/admin.d.ts +0 -3
- package/exports/admin.js +0 -3
- package/exports/admin.js.map +1 -1
- package/features/formModel/Field.d.ts +52 -0
- package/features/formModel/Field.js +201 -0
- package/features/formModel/Field.js.map +1 -0
- package/features/formModel/FieldBuilder.d.ts +45 -0
- package/features/formModel/FieldBuilder.js +158 -0
- package/features/formModel/FieldBuilder.js.map +1 -0
- package/features/formModel/FieldBuilder.test.js +106 -0
- package/features/formModel/FieldBuilder.test.js.map +1 -0
- package/features/formModel/FormModel.d.ts +61 -0
- package/features/formModel/FormModel.js +573 -0
- package/features/formModel/FormModel.js.map +1 -0
- package/features/formModel/FormModel.test.d.ts +1 -0
- package/features/formModel/FormModel.test.js +1140 -0
- package/features/formModel/FormModel.test.js.map +1 -0
- package/features/formModel/FormModelFactory.d.ts +9 -0
- package/features/formModel/FormModelFactory.js +13 -0
- package/features/formModel/FormModelFactory.js.map +1 -0
- package/features/formModel/FormView.d.ts +23 -0
- package/features/formModel/FormView.js +138 -0
- package/features/formModel/FormView.js.map +1 -0
- package/features/formModel/abstractions.d.ts +286 -0
- package/features/formModel/abstractions.js +54 -0
- package/features/formModel/abstractions.js.map +1 -0
- package/features/formModel/feature.d.ts +3 -0
- package/features/formModel/feature.js +16 -0
- package/features/formModel/feature.js.map +1 -0
- package/features/formModel/index.d.ts +10 -0
- package/features/formModel/index.js +14 -0
- package/features/formModel/index.js.map +1 -0
- package/features/formModel/useFieldRenderers.d.ts +2 -0
- package/features/formModel/useFieldRenderers.js +19 -0
- package/features/formModel/useFieldRenderers.js.map +1 -0
- package/features/security/LogIn/LogInGateway.d.ts +2 -2
- package/features/security/LogIn/LogInGateway.js +2 -2
- package/features/security/LogIn/LogInGateway.js.map +1 -1
- package/features/wcp/WcpGateway.d.ts +2 -2
- package/features/wcp/WcpGateway.js +2 -2
- package/features/wcp/WcpGateway.js.map +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/index.js.map +1 -1
- package/hooks/useDialog.d.ts +9 -29
- package/hooks/useDialog.js +16 -24
- package/hooks/useDialog.js.map +1 -1
- package/hooks/useOpenDialog.d.ts +7 -0
- package/hooks/useOpenDialog.js +18 -0
- package/hooks/useOpenDialog.js.map +1 -0
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/package.json +30 -30
- package/permissions/createHasPermission.d.ts +3 -2
- package/permissions/createHasPermission.js +4 -8
- package/permissions/createHasPermission.js.map +1 -1
- package/permissions/createPermissions.d.ts +6 -0
- package/permissions/createPermissions.js +201 -0
- package/permissions/createPermissions.js.map +1 -0
- package/permissions/createPermissions.test.d.ts +1 -0
- package/permissions/createPermissions.test.js +177 -0
- package/permissions/createPermissions.test.js.map +1 -0
- package/permissions/index.d.ts +1 -0
- package/permissions/index.js +1 -0
- package/permissions/index.js.map +1 -1
- package/permissions/types.d.ts +5 -0
- package/permissions/types.js.map +1 -1
- package/permissions/usePermissions.d.ts +2 -1
- package/permissions/usePermissions.js +4 -175
- package/permissions/usePermissions.js.map +1 -1
- package/presentation/installation/presenters/SystemInstaller/SystemInstallerGateway.d.ts +2 -2
- package/presentation/installation/presenters/SystemInstaller/SystemInstallerGateway.js +2 -2
- package/presentation/installation/presenters/SystemInstaller/SystemInstallerGateway.js.map +1 -1
- package/permissions/createHasPermission.test.js +0 -206
- package/permissions/createHasPermission.test.js.map +0 -1
- /package/{permissions/createHasPermission.test.d.ts → features/formModel/FieldBuilder.test.d.ts} +0 -0
package/base/Admin.js
CHANGED
|
@@ -14,6 +14,7 @@ import { createTenancyProvider } from "../presentation/tenancy/createTenancyProv
|
|
|
14
14
|
import { TelemetryAdminAppStart } from "./TelemetryAdminAppStart.js";
|
|
15
15
|
import { ApolloClientFeature } from "../features/apolloClient/feature.js";
|
|
16
16
|
import { SecurityFeature } from "../features/security/SecurityFeature.js";
|
|
17
|
+
import { FormModelFeature } from "../features/formModel/feature.js";
|
|
17
18
|
import { AdminConfigPlugin, AdminConfigProvider } from "../config/AdminConfig.js";
|
|
18
19
|
const container = createRootContainer();
|
|
19
20
|
export const Admin = ({
|
|
@@ -28,6 +29,7 @@ export const Admin = ({
|
|
|
28
29
|
plugins.register(...createLegacyPlugins(container));
|
|
29
30
|
ApolloClientFeature.register(container, apolloClient);
|
|
30
31
|
SecurityFeature.register(container);
|
|
32
|
+
FormModelFeature.register(container);
|
|
31
33
|
const ApolloProvider = createApolloProvider(apolloClient);
|
|
32
34
|
const UIProviders = createUiProviders();
|
|
33
35
|
const UiStateProvider = createUiStateProvider();
|
package/base/Admin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","plugins","App","DiContainerProvider","createApolloProvider","Base","createUiStateProvider","createAdminUiStateProvider","createUiProviders","createDialogsProvider","DefaultIcons","IconPickerConfigProvider","createRootContainer","WcpProvider","createTenancyProvider","TelemetryAdminAppStart","ApolloClientFeature","SecurityFeature","AdminConfigPlugin","AdminConfigProvider","container","Admin","children","createApolloClient","createLegacyPlugins","uri","process","env","REACT_APP_GRAPHQL_API_URL","apolloClient","register","ApolloProvider","UIProviders","UiStateProvider","AdminUiStateProvider","DialogsProvider","TenancyProvider","createElement","routes","providers"],"sources":["Admin.tsx"],"sourcesContent":["import React from \"react\";\nimport type { Container } from \"@webiny/di\";\nimport { plugins } from \"@webiny/plugins\";\nimport { App, DiContainerProvider } from \"@webiny/app\";\nimport type { ApolloClientFactory } from \"./providers/ApolloProvider.js\";\nimport { createApolloProvider } from \"./providers/ApolloProvider.js\";\nimport { Base } from \"./Base.js\";\nimport { createUiStateProvider } from \"./providers/UiStateProvider.js\";\nimport { createAdminUiStateProvider } from \"./providers/AdminUiStateProvider.js\";\nimport { createUiProviders } from \"./providers/UiProviders.js\";\nimport { createDialogsProvider } from \"~/components/Dialogs/DialogsContext.js\";\nimport { DefaultIcons, IconPickerConfigProvider } from \"~/components/IconPicker/config/index.js\";\nimport { createRootContainer } from \"~/base/createRootContainer.js\";\nimport { WcpProvider } from \"~/presentation/wcp/WcpProvider.js\";\nimport { createTenancyProvider } from \"~/presentation/tenancy/createTenancyProvider.js\";\nimport { TelemetryAdminAppStart } from \"./TelemetryAdminAppStart.js\";\nimport { ApolloClientFeature } from \"~/features/apolloClient/feature.js\";\nimport { SecurityFeature } from \"~/features/security/SecurityFeature.js\";\nimport type { PluginCollection } from \"@webiny/plugins/types.js\";\nimport { AdminConfigPlugin, AdminConfigProvider } from \"~/config/AdminConfig.js\";\n\nexport interface AdminProps {\n createApolloClient: ApolloClientFactory;\n createLegacyPlugins: (container: Container) => PluginCollection;\n children?: React.ReactNode;\n}\n\nconst container = createRootContainer();\n\nexport const Admin = ({ children, createApolloClient, createLegacyPlugins }: AdminProps) => {\n const uri = process.env.REACT_APP_GRAPHQL_API_URL as string;\n const apolloClient = createApolloClient({ uri });\n\n plugins.register(...createLegacyPlugins(container));\n\n ApolloClientFeature.register(container, apolloClient);\n SecurityFeature.register(container);\n\n const ApolloProvider = createApolloProvider(apolloClient);\n const UIProviders = createUiProviders();\n const UiStateProvider = createUiStateProvider();\n const AdminUiStateProvider = createAdminUiStateProvider();\n const DialogsProvider = createDialogsProvider();\n const TenancyProvider = createTenancyProvider();\n\n return (\n <DiContainerProvider container={container}>\n <TelemetryAdminAppStart />\n <ApolloProvider>\n <WcpProvider>\n <App\n plugins={[AdminConfigPlugin]}\n routes={[]}\n providers={[\n AdminConfigProvider,\n UIProviders,\n UiStateProvider,\n DialogsProvider,\n IconPickerConfigProvider,\n AdminUiStateProvider,\n TenancyProvider\n ]}\n >\n <Base />\n <DefaultIcons />\n {children}\n </App>\n </WcpProvider>\n </ApolloProvider>\n </DiContainerProvider>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,GAAG,EAAEC,mBAAmB,QAAQ,aAAa;AAEtD,SAASC,oBAAoB;AAC7B,SAASC,IAAI;AACb,SAASC,qBAAqB;AAC9B,SAASC,0BAA0B;AACnC,SAASC,iBAAiB;AAC1B,SAASC,qBAAqB;AAC9B,SAASC,YAAY,EAAEC,wBAAwB;AAC/C,SAASC,mBAAmB;AAC5B,SAASC,WAAW;AACpB,SAASC,qBAAqB;AAC9B,SAASC,sBAAsB;AAC/B,SAASC,mBAAmB;AAC5B,SAASC,eAAe;
|
|
1
|
+
{"version":3,"names":["React","plugins","App","DiContainerProvider","createApolloProvider","Base","createUiStateProvider","createAdminUiStateProvider","createUiProviders","createDialogsProvider","DefaultIcons","IconPickerConfigProvider","createRootContainer","WcpProvider","createTenancyProvider","TelemetryAdminAppStart","ApolloClientFeature","SecurityFeature","FormModelFeature","AdminConfigPlugin","AdminConfigProvider","container","Admin","children","createApolloClient","createLegacyPlugins","uri","process","env","REACT_APP_GRAPHQL_API_URL","apolloClient","register","ApolloProvider","UIProviders","UiStateProvider","AdminUiStateProvider","DialogsProvider","TenancyProvider","createElement","routes","providers"],"sources":["Admin.tsx"],"sourcesContent":["import React from \"react\";\nimport type { Container } from \"@webiny/di\";\nimport { plugins } from \"@webiny/plugins\";\nimport { App, DiContainerProvider } from \"@webiny/app\";\nimport type { ApolloClientFactory } from \"./providers/ApolloProvider.js\";\nimport { createApolloProvider } from \"./providers/ApolloProvider.js\";\nimport { Base } from \"./Base.js\";\nimport { createUiStateProvider } from \"./providers/UiStateProvider.js\";\nimport { createAdminUiStateProvider } from \"./providers/AdminUiStateProvider.js\";\nimport { createUiProviders } from \"./providers/UiProviders.js\";\nimport { createDialogsProvider } from \"~/components/Dialogs/DialogsContext.js\";\nimport { DefaultIcons, IconPickerConfigProvider } from \"~/components/IconPicker/config/index.js\";\nimport { createRootContainer } from \"~/base/createRootContainer.js\";\nimport { WcpProvider } from \"~/presentation/wcp/WcpProvider.js\";\nimport { createTenancyProvider } from \"~/presentation/tenancy/createTenancyProvider.js\";\nimport { TelemetryAdminAppStart } from \"./TelemetryAdminAppStart.js\";\nimport { ApolloClientFeature } from \"~/features/apolloClient/feature.js\";\nimport { SecurityFeature } from \"~/features/security/SecurityFeature.js\";\nimport { FormModelFeature } from \"~/features/formModel/feature.js\";\nimport type { PluginCollection } from \"@webiny/plugins/types.js\";\nimport { AdminConfigPlugin, AdminConfigProvider } from \"~/config/AdminConfig.js\";\n\nexport interface AdminProps {\n createApolloClient: ApolloClientFactory;\n createLegacyPlugins: (container: Container) => PluginCollection;\n children?: React.ReactNode;\n}\n\nconst container = createRootContainer();\n\nexport const Admin = ({ children, createApolloClient, createLegacyPlugins }: AdminProps) => {\n const uri = process.env.REACT_APP_GRAPHQL_API_URL as string;\n const apolloClient = createApolloClient({ uri });\n\n plugins.register(...createLegacyPlugins(container));\n\n ApolloClientFeature.register(container, apolloClient);\n SecurityFeature.register(container);\n FormModelFeature.register(container);\n\n const ApolloProvider = createApolloProvider(apolloClient);\n const UIProviders = createUiProviders();\n const UiStateProvider = createUiStateProvider();\n const AdminUiStateProvider = createAdminUiStateProvider();\n const DialogsProvider = createDialogsProvider();\n const TenancyProvider = createTenancyProvider();\n\n return (\n <DiContainerProvider container={container}>\n <TelemetryAdminAppStart />\n <ApolloProvider>\n <WcpProvider>\n <App\n plugins={[AdminConfigPlugin]}\n routes={[]}\n providers={[\n AdminConfigProvider,\n UIProviders,\n UiStateProvider,\n DialogsProvider,\n IconPickerConfigProvider,\n AdminUiStateProvider,\n TenancyProvider\n ]}\n >\n <Base />\n <DefaultIcons />\n {children}\n </App>\n </WcpProvider>\n </ApolloProvider>\n </DiContainerProvider>\n );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/C,MAAM4B,eAAe,GAAGvB,qBAAqB,CAAC,CAAC;EAE/C,oBACId,KAAA,CAAAsC,aAAA,CAACnC,mBAAmB;IAACkB,SAAS,EAAEA;EAAU,gBACtCrB,KAAA,CAAAsC,aAAA,CAACvB,sBAAsB,MAAE,CAAC,eAC1Bf,KAAA,CAAAsC,aAAA,CAACN,cAAc,qBACXhC,KAAA,CAAAsC,aAAA,CAACzB,WAAW,qBACRb,KAAA,CAAAsC,aAAA,CAACpC,GAAG;IACAD,OAAO,EAAE,CAACkB,iBAAiB,CAAE;IAC7BoB,MAAM,EAAE,EAAG;IACXC,SAAS,EAAE,CACPpB,mBAAmB,EACnBa,WAAW,EACXC,eAAe,EACfE,eAAe,EACfzB,wBAAwB,EACxBwB,oBAAoB,EACpBE,eAAe;EACjB,gBAEFrC,KAAA,CAAAsC,aAAA,CAACjC,IAAI,MAAE,CAAC,eACRL,KAAA,CAAAsC,aAAA,CAAC5B,YAAY,MAAE,CAAC,EACfa,QACA,CACI,CACD,CACC,CAAC;AAE9B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AdminConfig } from "../../config/AdminConfig.js";
|
|
3
|
+
import { TextRenderer } from "./FieldRenderers/TextRenderer.js";
|
|
4
|
+
import { SelectRenderer } from "./FieldRenderers/SelectRenderer.js";
|
|
5
|
+
export const DefaultFieldRenderers = () => {
|
|
6
|
+
return /*#__PURE__*/React.createElement(AdminConfig, null, /*#__PURE__*/React.createElement(AdminConfig.Form.FieldRenderer, {
|
|
7
|
+
name: "text",
|
|
8
|
+
component: TextRenderer
|
|
9
|
+
}), /*#__PURE__*/React.createElement(AdminConfig.Form.FieldRenderer, {
|
|
10
|
+
name: "select",
|
|
11
|
+
component: SelectRenderer
|
|
12
|
+
}));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=DefaultFieldRenderers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","AdminConfig","TextRenderer","SelectRenderer","DefaultFieldRenderers","createElement","Form","FieldRenderer","name","component"],"sources":["DefaultFieldRenderers.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"~/config/AdminConfig.js\";\nimport { TextRenderer } from \"~/base/Base/FieldRenderers/TextRenderer.js\";\nimport { SelectRenderer } from \"~/base/Base/FieldRenderers/SelectRenderer.js\";\n\nexport const DefaultFieldRenderers = () => {\n return (\n <AdminConfig>\n <AdminConfig.Form.FieldRenderer name={\"text\"} component={TextRenderer} />\n <AdminConfig.Form.FieldRenderer name={\"select\"} component={SelectRenderer} />\n </AdminConfig>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW;AACpB,SAASC,YAAY;AACrB,SAASC,cAAc;AAEvB,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,oBACIJ,KAAA,CAAAK,aAAA,CAACJ,WAAW,qBACRD,KAAA,CAAAK,aAAA,CAACJ,WAAW,CAACK,IAAI,CAACC,aAAa;IAACC,IAAI,EAAE,MAAO;IAACC,SAAS,EAAEP;EAAa,CAAE,CAAC,eACzEF,KAAA,CAAAK,aAAA,CAACJ,WAAW,CAACK,IAAI,CAACC,aAAa;IAACC,IAAI,EAAE,QAAS;IAACC,SAAS,EAAEN;EAAe,CAAE,CACnE,CAAC;AAEtB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { observer } from "mobx-react-lite";
|
|
3
|
+
import { Select } from "@webiny/admin-ui";
|
|
4
|
+
export const SelectRenderer = observer(function SelectRenderer({
|
|
5
|
+
field
|
|
6
|
+
}) {
|
|
7
|
+
const options = field.options ?? [];
|
|
8
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
9
|
+
label: field.label,
|
|
10
|
+
placeholder: field.placeholder,
|
|
11
|
+
value: field.value ?? "",
|
|
12
|
+
onChange: value => field.onChange(value),
|
|
13
|
+
required: field.required,
|
|
14
|
+
disabled: field.disabled,
|
|
15
|
+
validation: field.validation,
|
|
16
|
+
options: options.map(opt => ({
|
|
17
|
+
label: opt.label,
|
|
18
|
+
value: opt.value,
|
|
19
|
+
disabled: opt.disabled
|
|
20
|
+
}))
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=SelectRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","observer","Select","SelectRenderer","field","options","createElement","label","placeholder","value","onChange","required","disabled","validation","map","opt"],"sources":["SelectRenderer.tsx"],"sourcesContent":["import React from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Select } from \"@webiny/admin-ui\";\nimport type { IFieldVM } from \"~/features/formModel/index.js\";\nimport type { IValueOption } from \"~/features/formModel/index.js\";\n\nexport const SelectRenderer = observer(function SelectRenderer({ field }: { field: IFieldVM }) {\n const options: IValueOption[] = field.options ?? [];\n\n return (\n <Select\n label={field.label}\n placeholder={field.placeholder}\n value={(field.value as string) ?? \"\"}\n onChange={value => field.onChange(value)}\n required={field.required}\n disabled={field.disabled}\n validation={field.validation}\n options={options.map(opt => ({\n label: opt.label,\n value: opt.value,\n disabled: opt.disabled\n }))}\n />\n );\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,MAAM,QAAQ,kBAAkB;AAIzC,OAAO,MAAMC,cAAc,GAAGF,QAAQ,CAAC,SAASE,cAAcA,CAAC;EAAEC;AAA2B,CAAC,EAAE;EAC3F,MAAMC,OAAuB,GAAGD,KAAK,CAACC,OAAO,IAAI,EAAE;EAEnD,oBACIL,KAAA,CAAAM,aAAA,CAACJ,MAAM;IACHK,KAAK,EAAEH,KAAK,CAACG,KAAM;IACnBC,WAAW,EAAEJ,KAAK,CAACI,WAAY;IAC/BC,KAAK,EAAGL,KAAK,CAACK,KAAK,IAAe,EAAG;IACrCC,QAAQ,EAAED,KAAK,IAAIL,KAAK,CAACM,QAAQ,CAACD,KAAK,CAAE;IACzCE,QAAQ,EAAEP,KAAK,CAACO,QAAS;IACzBC,QAAQ,EAAER,KAAK,CAACQ,QAAS;IACzBC,UAAU,EAAET,KAAK,CAACS,UAAW;IAC7BR,OAAO,EAAEA,OAAO,CAACS,GAAG,CAACC,GAAG,KAAK;MACzBR,KAAK,EAAEQ,GAAG,CAACR,KAAK;MAChBE,KAAK,EAAEM,GAAG,CAACN,KAAK;MAChBG,QAAQ,EAAEG,GAAG,CAACH;IAClB,CAAC,CAAC;EAAE,CACP,CAAC;AAEV,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { observer } from "mobx-react-lite";
|
|
3
|
+
import { Input } from "@webiny/admin-ui";
|
|
4
|
+
import { DelayedOnChange } from "@webiny/admin-ui";
|
|
5
|
+
export const TextRenderer = observer(function TextRenderer({
|
|
6
|
+
field
|
|
7
|
+
}) {
|
|
8
|
+
return /*#__PURE__*/React.createElement(DelayedOnChange, {
|
|
9
|
+
value: field.value,
|
|
10
|
+
onChange: value => field.onChange(value)
|
|
11
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
12
|
+
label: field.label,
|
|
13
|
+
placeholder: field.placeholder,
|
|
14
|
+
required: field.required,
|
|
15
|
+
disabled: field.disabled,
|
|
16
|
+
validation: field.validation,
|
|
17
|
+
onBlur: () => field.onBlur()
|
|
18
|
+
}));
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=TextRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","observer","Input","DelayedOnChange","TextRenderer","field","createElement","value","onChange","label","placeholder","required","disabled","validation","onBlur"],"sources":["TextRenderer.tsx"],"sourcesContent":["import React from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Input } from \"@webiny/admin-ui\";\nimport { DelayedOnChange } from \"@webiny/admin-ui\";\nimport type { IFieldVM } from \"~/features/formModel/index.js\";\n\nexport const TextRenderer = observer(function TextRenderer({ field }: { field: IFieldVM }) {\n return (\n <DelayedOnChange value={field.value} onChange={value => field.onChange(value)}>\n <Input\n label={field.label}\n placeholder={field.placeholder}\n required={field.required}\n disabled={field.disabled}\n validation={field.validation}\n onBlur={() => field.onBlur()}\n />\n </DelayedOnChange>\n );\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,eAAe,QAAQ,kBAAkB;AAGlD,OAAO,MAAMC,YAAY,GAAGH,QAAQ,CAAC,SAASG,YAAYA,CAAC;EAAEC;AAA2B,CAAC,EAAE;EACvF,oBACIL,KAAA,CAAAM,aAAA,CAACH,eAAe;IAACI,KAAK,EAAEF,KAAK,CAACE,KAAM;IAACC,QAAQ,EAAED,KAAK,IAAIF,KAAK,CAACG,QAAQ,CAACD,KAAK;EAAE,gBAC1EP,KAAA,CAAAM,aAAA,CAACJ,KAAK;IACFO,KAAK,EAAEJ,KAAK,CAACI,KAAM;IACnBC,WAAW,EAAEL,KAAK,CAACK,WAAY;IAC/BC,QAAQ,EAAEN,KAAK,CAACM,QAAS;IACzBC,QAAQ,EAAEP,KAAK,CAACO,QAAS;IACzBC,UAAU,EAAER,KAAK,CAACQ,UAAW;IAC7BC,MAAM,EAAEA,CAAA,KAAMT,KAAK,CAACS,MAAM,CAAC;EAAE,CAChC,CACY,CAAC;AAE1B,CAAC,CAAC","ignoreList":[]}
|
package/base/Base/Menus.js
CHANGED
|
@@ -52,6 +52,13 @@ export const Menus = /*#__PURE__*/React.memo(() => {
|
|
|
52
52
|
element: /*#__PURE__*/React.createElement(SettingsIcon, null)
|
|
53
53
|
})
|
|
54
54
|
})
|
|
55
|
+
}), /*#__PURE__*/React.createElement(Menu, {
|
|
56
|
+
parent: "settings",
|
|
57
|
+
name: "settings.system",
|
|
58
|
+
element: /*#__PURE__*/React.createElement(Menu.Group, {
|
|
59
|
+
text: "System",
|
|
60
|
+
collapsible: false
|
|
61
|
+
})
|
|
55
62
|
}), /*#__PURE__*/React.createElement(Menu.Support, {
|
|
56
63
|
name: "docs",
|
|
57
64
|
element: /*#__PURE__*/React.createElement(Menu.Support.Link, {
|
package/base/Base/Menus.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","ReactComponent","DashboardIcon","SettingsIcon","FileManagerIcon","InfoIcon","SlackIcon","DocsIcon","GithubIcon","MoreIcon","UpgradeIcon","DropdownMenu","SupportMenuItems","AdminConfig","HasPermission","Menu","useWcp","Menus","memo","wcp","hasWcpLicense","Boolean","getProject","createElement","name","pin","element","Link","to","text","icon","Icon","label","Item","hideIfEmpty","Support","rel","target","Fragment","Separator","className","Footer","trigger","action","Action","displayName"],"sources":["Menus.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as DashboardIcon } from \"@webiny/icons/space_dashboard.svg\";\nimport { ReactComponent as SettingsIcon } from \"@webiny/icons/settings.svg\";\nimport { ReactComponent as FileManagerIcon } from \"@webiny/icons/folder_open.svg\";\nimport { ReactComponent as InfoIcon } from \"@webiny/icons/info.svg\";\nimport { ReactComponent as SlackIcon } from \"@webiny/icons/numbers.svg\";\nimport { ReactComponent as DocsIcon } from \"@webiny/icons/summarize.svg\";\nimport { ReactComponent as GithubIcon } from \"@webiny/icons/route.svg\";\nimport { ReactComponent as MoreIcon } from \"@webiny/icons/more_vert.svg\";\nimport { ReactComponent as UpgradeIcon } from \"@webiny/icons/electric_bolt.svg\";\nimport { DropdownMenu } from \"@webiny/admin-ui\";\nimport { SupportMenuItems } from \"./Menus/SupportMenuItems.js\";\nimport { AdminConfig } from \"~/config/AdminConfig.js\";\nimport { HasPermission } from \"~/presentation/security/components/HasPermission.js\";\nimport { Menu } from \"~/config/AdminConfig/Menu.js\";\nimport { useWcp } from \"~/index.js\";\n\nexport const Menus = React.memo(() => {\n const wcp = useWcp();\n const hasWcpLicense = Boolean(wcp.getProject());\n\n return (\n <AdminConfig>\n <Menu\n name={\"home\"}\n pin={\"start\"}\n element={\n <Menu.Link\n to={\"/\"}\n text={\"Home\"}\n icon={<Menu.Link.Icon label=\"Home\" element={<DashboardIcon />} />}\n />\n }\n />\n <HasPermission name={\"fm.file\"}>\n <Menu\n name={\"fileManager\"}\n pin={\"start\"}\n element={\n <Menu.Link\n text={\"File Manager\"}\n icon={\n <Menu.Item.Icon\n label=\"File Manager\"\n element={<FileManagerIcon />}\n />\n }\n to={\"/file-manager\"}\n />\n }\n />\n </HasPermission>\n <Menu\n name={\"settings\"}\n hideIfEmpty={true}\n pin={\"end\"}\n element={\n <Menu.Item\n text={\"Settings\"}\n icon={<Menu.Link.Icon label=\"Settings\" element={<SettingsIcon />} />}\n />\n }\n />\n\n <Menu.Support\n name={\"docs\"}\n element={\n <Menu.Support.Link\n text={\"Documentation\"}\n icon={<Menu.Support.Link.Icon label=\"Docs\" element={<DocsIcon />} />}\n to={\"https://www.webiny.com/docs\"}\n rel={\"noopener noreferrer\"}\n target={\"_blank\"}\n />\n }\n />\n\n <Menu.Support\n name={\"github\"}\n element={\n <Menu.Support.Link\n text={\"GitHub\"}\n icon={<Menu.Support.Link.Icon label=\"GitHub\" element={<GithubIcon />} />}\n to={\"https://github.com/webiny/webiny-js\"}\n rel={\"noopener noreferrer\"}\n target={\"_blank\"}\n />\n }\n />\n\n <Menu.Support\n name={\"slack\"}\n element={\n <Menu.Support.Link\n text={\"Slack\"}\n icon={<Menu.Support.Link.Icon label=\"Slack\" element={<SlackIcon />} />}\n to={\"https://www.webiny.com/slack\"}\n rel={\"noopener noreferrer\"}\n target={\"_blank\"}\n />\n }\n />\n\n {!hasWcpLicense && (\n <Menu.Support\n name={\"upgrade-webiny\"}\n pin={\"end\"}\n element={\n <>\n <DropdownMenu.Separator />\n <Menu.Support.Link\n text={\"Upgrade\"}\n icon={\n <Menu.Support.Link.Icon\n label=\"Upgrade\"\n element={<UpgradeIcon />}\n />\n }\n to={\"https://www.webiny.com/pricing\"}\n rel={\"noopener noreferrer\"}\n target={\"_blank\"}\n className={\n \"[&_a]:text-accent-primary! [&_svg]:fill-accent-default! font-semibold\"\n }\n />\n </>\n }\n />\n )}\n\n <Menu.Footer\n name={\"support\"}\n element={\n <DropdownMenu\n className={\"w-[225px]\"}\n trigger={\n <Menu.Item\n text={\"Support\"}\n icon={<Menu.Item.Icon label=\"Support\" element={<InfoIcon />} />}\n action={<Menu.Item.Action element={<MoreIcon />} />}\n />\n }\n >\n <SupportMenuItems />\n </DropdownMenu>\n }\n />\n </AdminConfig>\n );\n});\n\nMenus.displayName = \"Menus\";\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,IAAIC,aAAa,QAAQ,mCAAmC;AACnF,SAASD,cAAc,IAAIE,YAAY,QAAQ,4BAA4B;AAC3E,SAASF,cAAc,IAAIG,eAAe,QAAQ,+BAA+B;AACjF,SAASH,cAAc,IAAII,QAAQ,QAAQ,wBAAwB;AACnE,SAASJ,cAAc,IAAIK,SAAS,QAAQ,2BAA2B;AACvE,SAASL,cAAc,IAAIM,QAAQ,QAAQ,6BAA6B;AACxE,SAASN,cAAc,IAAIO,UAAU,QAAQ,yBAAyB;AACtE,SAASP,cAAc,IAAIQ,QAAQ,QAAQ,6BAA6B;AACxE,SAASR,cAAc,IAAIS,WAAW,QAAQ,iCAAiC;AAC/E,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,gBAAgB;AACzB,SAASC,WAAW;AACpB,SAASC,aAAa;AACtB,SAASC,IAAI;AACb,SAASC,MAAM;AAEf,OAAO,MAAMC,KAAK,gBAAGjB,KAAK,CAACkB,IAAI,CAAC,MAAM;EAClC,MAAMC,GAAG,GAAGH,MAAM,CAAC,CAAC;EACpB,MAAMI,aAAa,GAAGC,OAAO,CAACF,GAAG,C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,CAACR,IAAI,CAACkB,IAAI;QACNJ,IAAI,EAAE,SAAU;QAChBC,IAAI,eAAE9B,KAAA,CAAAuB,aAAA,CAACR,IAAI,CAACkB,IAAI,CAACF,IAAI;UAACC,KAAK,EAAC,SAAS;UAACN,OAAO,eAAE1B,KAAA,CAAAuB,aAAA,CAAClB,QAAQ,MAAE;QAAE,CAAE,CAAE;QAChEsC,MAAM,eAAE3C,KAAA,CAAAuB,aAAA,CAACR,IAAI,CAACkB,IAAI,CAACW,MAAM;UAAClB,OAAO,eAAE1B,KAAA,CAAAuB,aAAA,CAACd,QAAQ,MAAE;QAAE,CAAE;MAAE,CACvD;IACJ,gBAEDT,KAAA,CAAAuB,aAAA,CAACX,gBAAgB,MAAE,CACT;EACjB,CACJ,CACQ,CAAC;AAEtB,CAAC,CAAC;AAEFK,KAAK,CAAC4B,WAAW,GAAG,OAAO","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","ReactComponent","DashboardIcon","SettingsIcon","FileManagerIcon","InfoIcon","SlackIcon","DocsIcon","GithubIcon","MoreIcon","UpgradeIcon","DropdownMenu","SupportMenuItems","AdminConfig","HasPermission","Menu","useWcp","Menus","memo","wcp","hasWcpLicense","Boolean","getProject","createElement","name","pin","element","Link","to","text","icon","Icon","label","Item","hideIfEmpty","parent","Group","collapsible","Support","rel","target","Fragment","Separator","className","Footer","trigger","action","Action","displayName"],"sources":["Menus.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as DashboardIcon } from \"@webiny/icons/space_dashboard.svg\";\nimport { ReactComponent as SettingsIcon } from \"@webiny/icons/settings.svg\";\nimport { ReactComponent as FileManagerIcon } from \"@webiny/icons/folder_open.svg\";\nimport { ReactComponent as InfoIcon } from \"@webiny/icons/info.svg\";\nimport { ReactComponent as SlackIcon } from \"@webiny/icons/numbers.svg\";\nimport { ReactComponent as DocsIcon } from \"@webiny/icons/summarize.svg\";\nimport { ReactComponent as GithubIcon } from \"@webiny/icons/route.svg\";\nimport { ReactComponent as MoreIcon } from \"@webiny/icons/more_vert.svg\";\nimport { ReactComponent as UpgradeIcon } from \"@webiny/icons/electric_bolt.svg\";\nimport { DropdownMenu } from \"@webiny/admin-ui\";\nimport { SupportMenuItems } from \"./Menus/SupportMenuItems.js\";\nimport { AdminConfig } from \"~/config/AdminConfig.js\";\nimport { HasPermission } from \"~/presentation/security/components/HasPermission.js\";\nimport { Menu } from \"~/config/AdminConfig/Menu.js\";\nimport { useWcp } from \"~/index.js\";\n\nexport const Menus = React.memo(() => {\n const wcp = useWcp();\n const hasWcpLicense = Boolean(wcp.getProject());\n\n return (\n <AdminConfig>\n <Menu\n name={\"home\"}\n pin={\"start\"}\n element={\n <Menu.Link\n to={\"/\"}\n text={\"Home\"}\n icon={<Menu.Link.Icon label=\"Home\" element={<DashboardIcon />} />}\n />\n }\n />\n <HasPermission name={\"fm.file\"}>\n <Menu\n name={\"fileManager\"}\n pin={\"start\"}\n element={\n <Menu.Link\n text={\"File Manager\"}\n icon={\n <Menu.Item.Icon\n label=\"File Manager\"\n element={<FileManagerIcon />}\n />\n }\n to={\"/file-manager\"}\n />\n }\n />\n </HasPermission>\n <Menu\n name={\"settings\"}\n hideIfEmpty={true}\n pin={\"end\"}\n element={\n <Menu.Item\n text={\"Settings\"}\n icon={<Menu.Link.Icon label=\"Settings\" element={<SettingsIcon />} />}\n />\n }\n />\n\n <Menu\n parent={\"settings\"}\n name=\"settings.system\"\n element={<Menu.Group text=\"System\" collapsible={false} />}\n />\n\n <Menu.Support\n name={\"docs\"}\n element={\n <Menu.Support.Link\n text={\"Documentation\"}\n icon={<Menu.Support.Link.Icon label=\"Docs\" element={<DocsIcon />} />}\n to={\"https://www.webiny.com/docs\"}\n rel={\"noopener noreferrer\"}\n target={\"_blank\"}\n />\n }\n />\n\n <Menu.Support\n name={\"github\"}\n element={\n <Menu.Support.Link\n text={\"GitHub\"}\n icon={<Menu.Support.Link.Icon label=\"GitHub\" element={<GithubIcon />} />}\n to={\"https://github.com/webiny/webiny-js\"}\n rel={\"noopener noreferrer\"}\n target={\"_blank\"}\n />\n }\n />\n\n <Menu.Support\n name={\"slack\"}\n element={\n <Menu.Support.Link\n text={\"Slack\"}\n icon={<Menu.Support.Link.Icon label=\"Slack\" element={<SlackIcon />} />}\n to={\"https://www.webiny.com/slack\"}\n rel={\"noopener noreferrer\"}\n target={\"_blank\"}\n />\n }\n />\n\n {!hasWcpLicense && (\n <Menu.Support\n name={\"upgrade-webiny\"}\n pin={\"end\"}\n element={\n <>\n <DropdownMenu.Separator />\n <Menu.Support.Link\n text={\"Upgrade\"}\n icon={\n <Menu.Support.Link.Icon\n label=\"Upgrade\"\n element={<UpgradeIcon />}\n />\n }\n to={\"https://www.webiny.com/pricing\"}\n rel={\"noopener noreferrer\"}\n target={\"_blank\"}\n className={\n \"[&_a]:text-accent-primary! [&_svg]:fill-accent-default! font-semibold\"\n }\n />\n </>\n }\n />\n )}\n\n <Menu.Footer\n name={\"support\"}\n element={\n <DropdownMenu\n className={\"w-[225px]\"}\n trigger={\n <Menu.Item\n text={\"Support\"}\n icon={<Menu.Item.Icon label=\"Support\" element={<InfoIcon />} />}\n action={<Menu.Item.Action element={<MoreIcon />} />}\n />\n }\n >\n <SupportMenuItems />\n </DropdownMenu>\n }\n />\n </AdminConfig>\n );\n});\n\nMenus.displayName = \"Menus\";\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,IAAIC,aAAa,QAAQ,mCAAmC;AACnF,SAASD,cAAc,IAAIE,YAAY,QAAQ,4BAA4B;AAC3E,SAASF,cAAc,IAAIG,eAAe,QAAQ,+BAA+B;AACjF,SAASH,cAAc,IAAII,QAAQ,QAAQ,wBAAwB;AACnE,SAASJ,cAAc,IAAIK,SAAS,QAAQ,2BAA2B;AACvE,SAASL,cAAc,IAAIM,QAAQ,QAAQ,6BAA6B;AACxE,SAASN,cAAc,IAAIO,UAAU,QAAQ,yBAAyB;AACtE,SAASP,cAAc,IAAIQ,QAAQ,Q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AI,CAACuB,OAAO,CAACX,IAAI;MACdE,IAAI,EAAE,SAAU;MAChBC,IAAI,eACA9B,KAAA,CAAAuB,aAAA,CAACR,IAAI,CAACuB,OAAO,CAACX,IAAI,CAACI,IAAI;QACnBC,KAAK,EAAC,SAAS;QACfN,OAAO,eAAE1B,KAAA,CAAAuB,aAAA,CAACb,WAAW,MAAE;MAAE,CAC5B,CACJ;MACDkB,EAAE,EAAE,gCAAiC;MACrCW,GAAG,EAAE,qBAAsB;MAC3BC,MAAM,EAAE,QAAS;MACjBG,SAAS,EACL;IACH,CACJ,CACH;EACL,CACJ,CACJ,eAED3C,KAAA,CAAAuB,aAAA,CAACR,IAAI,CAAC6B,MAAM;IACRpB,IAAI,EAAE,SAAU;IAChBE,OAAO,eACH1B,KAAA,CAAAuB,aAAA,CAACZ,YAAY;MACTgC,SAAS,EAAE,WAAY;MACvBE,OAAO,eACH7C,KAAA,CAAAuB,aAAA,CAACR,IAAI,CAACkB,IAAI;QACNJ,IAAI,EAAE,SAAU;QAChBC,IAAI,eAAE9B,KAAA,CAAAuB,aAAA,CAACR,IAAI,CAACkB,IAAI,CAACF,IAAI;UAACC,KAAK,EAAC,SAAS;UAACN,OAAO,eAAE1B,KAAA,CAAAuB,aAAA,CAAClB,QAAQ,MAAE;QAAE,CAAE,CAAE;QAChEyC,MAAM,eAAE9C,KAAA,CAAAuB,aAAA,CAACR,IAAI,CAACkB,IAAI,CAACc,MAAM;UAACrB,OAAO,eAAE1B,KAAA,CAAAuB,aAAA,CAACd,QAAQ,MAAE;QAAE,CAAE;MAAE,CACvD;IACJ,gBAEDT,KAAA,CAAAuB,aAAA,CAACX,gBAAgB,MAAE,CACT;EACjB,CACJ,CACQ,CAAC;AAEtB,CAAC,CAAC;AAEFK,KAAK,CAAC+B,WAAW,GAAG,OAAO","ignoreList":[]}
|
package/base/Base.js
CHANGED
|
@@ -4,8 +4,9 @@ import { RoutesConfig } from "./Base/RoutesConfig.js";
|
|
|
4
4
|
import { Tenant } from "./Base/Tenant.js";
|
|
5
5
|
import { UserMenu } from "./Base/UserMenu.js";
|
|
6
6
|
import { LexicalPreset } from "./Base/LexicalPreset.js";
|
|
7
|
+
import { DefaultFieldRenderers } from "./Base/DefaultFieldRenderers.js";
|
|
7
8
|
const BaseExtension = () => {
|
|
8
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tenant, null), /*#__PURE__*/React.createElement(Menus, null), /*#__PURE__*/React.createElement(UserMenu, null), /*#__PURE__*/React.createElement(RoutesConfig, null), /*#__PURE__*/React.createElement(LexicalPreset, null));
|
|
9
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tenant, null), /*#__PURE__*/React.createElement(Menus, null), /*#__PURE__*/React.createElement(UserMenu, null), /*#__PURE__*/React.createElement(RoutesConfig, null), /*#__PURE__*/React.createElement(LexicalPreset, null), /*#__PURE__*/React.createElement(DefaultFieldRenderers, null));
|
|
9
10
|
};
|
|
10
11
|
export const Base = /*#__PURE__*/memo(BaseExtension);
|
|
11
12
|
|
package/base/Base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","memo","Menus","RoutesConfig","Tenant","UserMenu","LexicalPreset","BaseExtension","createElement","Fragment","Base"],"sources":["Base.tsx"],"sourcesContent":["import React, { memo } from \"react\";\nimport { Menus } from \"./Base/Menus.js\";\nimport { RoutesConfig } from \"./Base/RoutesConfig.js\";\nimport { Tenant } from \"./Base/Tenant.js\";\nimport { UserMenu } from \"./Base/UserMenu.js\";\nimport { LexicalPreset } from \"./Base/LexicalPreset.js\";\n\nconst BaseExtension = () => {\n return (\n <>\n <Tenant />\n <Menus />\n <UserMenu />\n <RoutesConfig />\n <LexicalPreset />\n </>\n );\n};\n\nexport const Base = memo(BaseExtension);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,KAAK;AACd,SAASC,YAAY;AACrB,SAASC,MAAM;AACf,SAASC,QAAQ;AACjB,SAASC,aAAa;
|
|
1
|
+
{"version":3,"names":["React","memo","Menus","RoutesConfig","Tenant","UserMenu","LexicalPreset","DefaultFieldRenderers","BaseExtension","createElement","Fragment","Base"],"sources":["Base.tsx"],"sourcesContent":["import React, { memo } from \"react\";\nimport { Menus } from \"./Base/Menus.js\";\nimport { RoutesConfig } from \"./Base/RoutesConfig.js\";\nimport { Tenant } from \"./Base/Tenant.js\";\nimport { UserMenu } from \"./Base/UserMenu.js\";\nimport { LexicalPreset } from \"./Base/LexicalPreset.js\";\nimport { DefaultFieldRenderers } from \"./Base/DefaultFieldRenderers.js\";\n\nconst BaseExtension = () => {\n return (\n <>\n <Tenant />\n <Menus />\n <UserMenu />\n <RoutesConfig />\n <LexicalPreset />\n <DefaultFieldRenderers />\n </>\n );\n};\n\nexport const Base = memo(BaseExtension);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,KAAK;AACd,SAASC,YAAY;AACrB,SAASC,MAAM;AACf,SAASC,QAAQ;AACjB,SAASC,aAAa;AACtB,SAASC,qBAAqB;AAE9B,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACxB,oBACIR,KAAA,CAAAS,aAAA,CAAAT,KAAA,CAAAU,QAAA,qBACIV,KAAA,CAAAS,aAAA,CAACL,MAAM,MAAE,CAAC,eACVJ,KAAA,CAAAS,aAAA,CAACP,KAAK,MAAE,CAAC,eACTF,KAAA,CAAAS,aAAA,CAACJ,QAAQ,MAAE,CAAC,eACZL,KAAA,CAAAS,aAAA,CAACN,YAAY,MAAE,CAAC,eAChBH,KAAA,CAAAS,aAAA,CAACH,aAAa,MAAE,CAAC,eACjBN,KAAA,CAAAS,aAAA,CAACF,qBAAqB,MAAE,CAC1B,CAAC;AAEX,CAAC;AAED,OAAO,MAAMI,IAAI,gBAAGV,IAAI,CAACO,aAAa,CAAC","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ import { RouterFeature } from "@webiny/app/features/router/feature.js";
|
|
|
6
6
|
import { HistoryRouterGateway } from "@webiny/app/features/router/HistoryRouterGateway.js";
|
|
7
7
|
import { EnvConfigFeature } from "@webiny/app/features/envConfig/feature.js";
|
|
8
8
|
import { GraphQLClientFeature } from "@webiny/app/features/graphqlClient/feature.js";
|
|
9
|
+
import { MainGraphQLClientFeature } from "@webiny/app/features/mainGraphQLClient/feature.js";
|
|
9
10
|
import { LocalStorageFeature } from "@webiny/app/features/localStorage/feature.js";
|
|
10
11
|
import { EventPublisherFeature } from "@webiny/app/features/eventPublisher/feature.js";
|
|
11
12
|
import { WcpFeature } from "../features/wcp/feature.js";
|
|
@@ -41,6 +42,7 @@ export function createRootContainer() {
|
|
|
41
42
|
batching: true,
|
|
42
43
|
retry: true
|
|
43
44
|
});
|
|
45
|
+
MainGraphQLClientFeature.register(container);
|
|
44
46
|
LocalStorageFeature.register(container, {
|
|
45
47
|
prefix: `webiny/${deploymentId}`
|
|
46
48
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createBrowserHistory","Container","DefaultRouteElementRegistry","RouterGateway","RouterFeature","HistoryRouterGateway","EnvConfigFeature","GraphQLClientFeature","LocalStorageFeature","EventPublisherFeature","WcpFeature","TenancyFeature","SystemInstallerFeature","TelemetryFeature","ErrorOverlayNetworkErrorHandler","isUndefined","value","undefined","includes","createRootContainer","container","trashBinEnv","process","env","WEBINY_ADMIN_TRASH_BIN_RETENTION_PERIOD_DAYS","trashBinRetention","parseInt","deploymentId","String","WEBINY_ADMIN_DEPLOYMENT_ID","register","apiUrl","REACT_APP_API_URL","debug","WEBINY_ADMIN_DEBUG","graphqlApiUrl","REACT_APP_GRAPHQL_API_URL","telemetryEnabled","REACT_APP_WEBINY_TELEMETRY","telemetryUserId","REACT_APP_WEBINY_TELEMETRY_USER_ID","trashBinRetentionPeriodDays","wcpProjectId","REACT_APP_WEBINY_PROJECT_ID","REACT_APP_WCP_PROJECT_ID","websocketUrl","REACT_APP_WEBSOCKET_URL","history","registerInstance","inSingletonScope","batching","retry","prefix"],"sources":["createRootContainer.ts"],"sourcesContent":["import { createBrowserHistory } from \"history\";\nimport { Container } from \"@webiny/di\";\nimport { DefaultRouteElementRegistry } from \"@webiny/app/presentation/router/RouteElementRegistry.js\";\nimport { RouterGateway } from \"@webiny/app/features/router/abstractions.js\";\nimport { RouterFeature } from \"@webiny/app/features/router/feature.js\";\nimport { HistoryRouterGateway } from \"@webiny/app/features/router/HistoryRouterGateway.js\";\nimport { EnvConfigFeature } from \"@webiny/app/features/envConfig/feature.js\";\nimport { GraphQLClientFeature } from \"@webiny/app/features/graphqlClient/feature.js\";\nimport { LocalStorageFeature } from \"@webiny/app/features/localStorage/feature.js\";\nimport { EventPublisherFeature } from \"@webiny/app/features/eventPublisher/feature.js\";\nimport { WcpFeature } from \"~/features/wcp/feature.js\";\nimport { TenancyFeature } from \"~/features/tenancy/feature.js\";\nimport { SystemInstallerFeature } from \"~/presentation/installation/presenters/SystemInstaller/feature.js\";\nimport { TelemetryFeature } from \"~/features/telemetry/feature.js\";\nimport { ErrorOverlayNetworkErrorHandler } from \"~/errors/ErrorOverlayNetworkErrorHandler.js\";\n\nconst isUndefined = (value: any) => [undefined, \"undefined\"].includes(value);\n\nexport function createRootContainer() {\n const container = new Container();\n\n const trashBinEnv = process.env.WEBINY_ADMIN_TRASH_BIN_RETENTION_PERIOD_DAYS;\n const trashBinRetention = isUndefined(trashBinEnv) ? 60 : parseInt(trashBinEnv as string);\n const deploymentId = String(process.env.WEBINY_ADMIN_DEPLOYMENT_ID);\n\n EnvConfigFeature.register(container, {\n deploymentId,\n apiUrl: String(process.env.REACT_APP_API_URL),\n debug: process.env.WEBINY_ADMIN_DEBUG === \"true\",\n graphqlApiUrl: String(process.env.REACT_APP_GRAPHQL_API_URL),\n telemetryEnabled: process.env.REACT_APP_WEBINY_TELEMETRY === \"true\",\n telemetryUserId: process.env.REACT_APP_WEBINY_TELEMETRY_USER_ID,\n trashBinRetentionPeriodDays: trashBinRetention,\n wcpProjectId:\n process.env.REACT_APP_WEBINY_PROJECT_ID || process.env.REACT_APP_WCP_PROJECT_ID,\n websocketUrl: String(process.env.REACT_APP_WEBSOCKET_URL)\n });\n\n // Router\n const history = createBrowserHistory();\n container.registerInstance(RouterGateway, new HistoryRouterGateway(history, \"\"));\n container.register(DefaultRouteElementRegistry).inSingletonScope();\n\n RouterFeature.register(container);\n\n EventPublisherFeature.register(container);\n\n GraphQLClientFeature.register(container, { batching: true, retry: true });\n\n LocalStorageFeature.register(container, { prefix: `webiny/${deploymentId}` });\n\n TenancyFeature.register(container);\n\n WcpFeature.register(container);\n\n SystemInstallerFeature.register(container);\n\n TelemetryFeature.register(container);\n\n container.register(ErrorOverlayNetworkErrorHandler).inSingletonScope();\n\n return container;\n}\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,SAAS;AAC9C,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,2BAA2B,QAAQ,yDAAyD;AACrG,SAASC,aAAa,QAAQ,6CAA6C;AAC3E,SAASC,aAAa,QAAQ,wCAAwC;AACtE,SAASC,oBAAoB,QAAQ,qDAAqD;AAC1F,SAASC,gBAAgB,QAAQ,2CAA2C;AAC5E,SAASC,oBAAoB,QAAQ,+CAA+C;AACpF,SAASC,mBAAmB,QAAQ,8CAA8C;AAClF,SAASC,qBAAqB,QAAQ,gDAAgD;AACtF,SAASC,UAAU;AACnB,SAASC,cAAc;AACvB,SAASC,sBAAsB;AAC/B,SAASC,gBAAgB;AACzB,SAASC,+BAA+B;AAExC,MAAMC,WAAW,GAAIC,KAAU,IAAK,CAACC,SAAS,EAAE,WAAW,CAAC,CAACC,QAAQ,CAACF,KAAK,CAAC;AAE5E,OAAO,SAASG,mBAAmBA,CAAA,EAAG;EAClC,MAAMC,SAAS,GAAG,
|
|
1
|
+
{"version":3,"names":["createBrowserHistory","Container","DefaultRouteElementRegistry","RouterGateway","RouterFeature","HistoryRouterGateway","EnvConfigFeature","GraphQLClientFeature","MainGraphQLClientFeature","LocalStorageFeature","EventPublisherFeature","WcpFeature","TenancyFeature","SystemInstallerFeature","TelemetryFeature","ErrorOverlayNetworkErrorHandler","isUndefined","value","undefined","includes","createRootContainer","container","trashBinEnv","process","env","WEBINY_ADMIN_TRASH_BIN_RETENTION_PERIOD_DAYS","trashBinRetention","parseInt","deploymentId","String","WEBINY_ADMIN_DEPLOYMENT_ID","register","apiUrl","REACT_APP_API_URL","debug","WEBINY_ADMIN_DEBUG","graphqlApiUrl","REACT_APP_GRAPHQL_API_URL","telemetryEnabled","REACT_APP_WEBINY_TELEMETRY","telemetryUserId","REACT_APP_WEBINY_TELEMETRY_USER_ID","trashBinRetentionPeriodDays","wcpProjectId","REACT_APP_WEBINY_PROJECT_ID","REACT_APP_WCP_PROJECT_ID","websocketUrl","REACT_APP_WEBSOCKET_URL","history","registerInstance","inSingletonScope","batching","retry","prefix"],"sources":["createRootContainer.ts"],"sourcesContent":["import { createBrowserHistory } from \"history\";\nimport { Container } from \"@webiny/di\";\nimport { DefaultRouteElementRegistry } from \"@webiny/app/presentation/router/RouteElementRegistry.js\";\nimport { RouterGateway } from \"@webiny/app/features/router/abstractions.js\";\nimport { RouterFeature } from \"@webiny/app/features/router/feature.js\";\nimport { HistoryRouterGateway } from \"@webiny/app/features/router/HistoryRouterGateway.js\";\nimport { EnvConfigFeature } from \"@webiny/app/features/envConfig/feature.js\";\nimport { GraphQLClientFeature } from \"@webiny/app/features/graphqlClient/feature.js\";\nimport { MainGraphQLClientFeature } from \"@webiny/app/features/mainGraphQLClient/feature.js\";\nimport { LocalStorageFeature } from \"@webiny/app/features/localStorage/feature.js\";\nimport { EventPublisherFeature } from \"@webiny/app/features/eventPublisher/feature.js\";\nimport { WcpFeature } from \"~/features/wcp/feature.js\";\nimport { TenancyFeature } from \"~/features/tenancy/feature.js\";\nimport { SystemInstallerFeature } from \"~/presentation/installation/presenters/SystemInstaller/feature.js\";\nimport { TelemetryFeature } from \"~/features/telemetry/feature.js\";\nimport { ErrorOverlayNetworkErrorHandler } from \"~/errors/ErrorOverlayNetworkErrorHandler.js\";\n\nconst isUndefined = (value: any) => [undefined, \"undefined\"].includes(value);\n\nexport function createRootContainer() {\n const container = new Container();\n\n const trashBinEnv = process.env.WEBINY_ADMIN_TRASH_BIN_RETENTION_PERIOD_DAYS;\n const trashBinRetention = isUndefined(trashBinEnv) ? 60 : parseInt(trashBinEnv as string);\n const deploymentId = String(process.env.WEBINY_ADMIN_DEPLOYMENT_ID);\n\n EnvConfigFeature.register(container, {\n deploymentId,\n apiUrl: String(process.env.REACT_APP_API_URL),\n debug: process.env.WEBINY_ADMIN_DEBUG === \"true\",\n graphqlApiUrl: String(process.env.REACT_APP_GRAPHQL_API_URL),\n telemetryEnabled: process.env.REACT_APP_WEBINY_TELEMETRY === \"true\",\n telemetryUserId: process.env.REACT_APP_WEBINY_TELEMETRY_USER_ID,\n trashBinRetentionPeriodDays: trashBinRetention,\n wcpProjectId:\n process.env.REACT_APP_WEBINY_PROJECT_ID || process.env.REACT_APP_WCP_PROJECT_ID,\n websocketUrl: String(process.env.REACT_APP_WEBSOCKET_URL)\n });\n\n // Router\n const history = createBrowserHistory();\n container.registerInstance(RouterGateway, new HistoryRouterGateway(history, \"\"));\n container.register(DefaultRouteElementRegistry).inSingletonScope();\n\n RouterFeature.register(container);\n\n EventPublisherFeature.register(container);\n\n GraphQLClientFeature.register(container, { batching: true, retry: true });\n\n MainGraphQLClientFeature.register(container);\n\n LocalStorageFeature.register(container, { prefix: `webiny/${deploymentId}` });\n\n TenancyFeature.register(container);\n\n WcpFeature.register(container);\n\n SystemInstallerFeature.register(container);\n\n TelemetryFeature.register(container);\n\n container.register(ErrorOverlayNetworkErrorHandler).inSingletonScope();\n\n return container;\n}\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,SAAS;AAC9C,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,2BAA2B,QAAQ,yDAAyD;AACrG,SAASC,aAAa,QAAQ,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AY,EACRpB,OAAO,CAACC,GAAG,CAACoB,2BAA2B,IAAIrB,OAAO,CAACC,GAAG,CAACqB,wBAAwB;IACnFC,YAAY,EAAEjB,MAAM,CAACN,OAAO,CAACC,GAAG,CAACuB,uBAAuB;EAC5D,CAAC,CAAC;;EAEF;EACA,MAAMC,OAAO,GAAGhD,oBAAoB,CAAC,CAAC;EACtCqB,SAAS,CAAC4B,gBAAgB,CAAC9C,aAAa,EAAE,IAAIE,oBAAoB,CAAC2C,OAAO,EAAE,EAAE,CAAC,CAAC;EAChF3B,SAAS,CAACU,QAAQ,CAAC7B,2BAA2B,CAAC,CAACgD,gBAAgB,CAAC,CAAC;EAElE9C,aAAa,CAAC2B,QAAQ,CAACV,SAAS,CAAC;EAEjCX,qBAAqB,CAACqB,QAAQ,CAACV,SAAS,CAAC;EAEzCd,oBAAoB,CAACwB,QAAQ,CAACV,SAAS,EAAE;IAAE8B,QAAQ,EAAE,IAAI;IAAEC,KAAK,EAAE;EAAK,CAAC,CAAC;EAEzE5C,wBAAwB,CAACuB,QAAQ,CAACV,SAAS,CAAC;EAE5CZ,mBAAmB,CAACsB,QAAQ,CAACV,SAAS,EAAE;IAAEgC,MAAM,EAAE,UAAUzB,YAAY;EAAG,CAAC,CAAC;EAE7EhB,cAAc,CAACmB,QAAQ,CAACV,SAAS,CAAC;EAElCV,UAAU,CAACoB,QAAQ,CAACV,SAAS,CAAC;EAE9BR,sBAAsB,CAACkB,QAAQ,CAACV,SAAS,CAAC;EAE1CP,gBAAgB,CAACiB,QAAQ,CAACV,SAAS,CAAC;EAEpCA,SAAS,CAACU,QAAQ,CAAChB,+BAA+B,CAAC,CAACmC,gBAAgB,CAAC,CAAC;EAEtE,OAAO7B,SAAS;AACpB","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface DialogParamsContextValue {
|
|
2
|
+
params: Record<string, unknown>;
|
|
3
|
+
closeDialog: () => void;
|
|
4
|
+
}
|
|
5
|
+
export declare const DialogParamsContext: import("react").Context<DialogParamsContextValue | undefined>;
|
|
6
|
+
export declare const useDialogParamsContext: () => DialogParamsContextValue;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
export const DialogParamsContext = /*#__PURE__*/createContext(undefined);
|
|
3
|
+
export const useDialogParamsContext = () => {
|
|
4
|
+
const context = useContext(DialogParamsContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error("useDialog must be used inside a named dialog registered via AdminConfig.Dialog");
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=DialogParamsContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","useContext","DialogParamsContext","undefined","useDialogParamsContext","context","Error"],"sources":["DialogParamsContext.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nexport interface DialogParamsContextValue {\n params: Record<string, unknown>;\n closeDialog: () => void;\n}\n\nexport const DialogParamsContext = createContext<DialogParamsContextValue | undefined>(undefined);\n\nexport const useDialogParamsContext = () => {\n const context = useContext(DialogParamsContext);\n\n if (!context) {\n throw new Error(\n \"useDialog must be used inside a named dialog registered via AdminConfig.Dialog\"\n );\n }\n\n return context;\n};\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAOjD,OAAO,MAAMC,mBAAmB,gBAAGF,aAAa,CAAuCG,SAAS,CAAC;AAEjG,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EACxC,MAAMC,OAAO,GAAGJ,UAAU,CAACC,mBAAmB,CAAC;EAE/C,IAAI,CAACG,OAAO,EAAE;IACV,MAAM,IAAIC,KAAK,CACX,gFACJ,CAAC;EACL;EAEA,OAAOD,OAAO;AAClB,CAAC","ignoreList":[]}
|
|
@@ -22,6 +22,8 @@ interface ShowDialogParams {
|
|
|
22
22
|
export interface DialogsContext {
|
|
23
23
|
showDialog: (params: ShowDialogParams) => () => void;
|
|
24
24
|
closeAllDialogs: () => void;
|
|
25
|
+
openNamedDialog: (name: string, params: Record<string, unknown>) => void;
|
|
26
|
+
closeNamedDialog: () => void;
|
|
25
27
|
}
|
|
26
28
|
interface DialogsProviderProps {
|
|
27
29
|
children: ReactNode;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { useSnackbar } from "../../hooks/index.js";
|
|
3
|
-
import { Dialog } from "./Dialog.js";
|
|
4
2
|
import { createProvider } from "@webiny/app";
|
|
5
3
|
import { generateId } from "@webiny/utils";
|
|
4
|
+
import { useSnackbar } from "../../hooks/index.js";
|
|
5
|
+
import { Dialog } from "./Dialog.js";
|
|
6
|
+
import { DialogParamsContext } from "./DialogParamsContext.js";
|
|
7
|
+
import { useAdminConfig } from "../../config/AdminConfig.js";
|
|
6
8
|
export const initializeState = (params = {}) => ({
|
|
7
9
|
id: `dialog-${generateId()}`,
|
|
8
10
|
title: params.title ?? `Confirmation`,
|
|
@@ -31,6 +33,10 @@ export const DialogsProvider = ({
|
|
|
31
33
|
showSnackbar
|
|
32
34
|
} = useSnackbar();
|
|
33
35
|
const [dialogs, setDialogs] = useState(new Map());
|
|
36
|
+
const [namedDialogIntent, setNamedDialogIntent] = useState(null);
|
|
37
|
+
const {
|
|
38
|
+
dialogs: registeredDialogs
|
|
39
|
+
} = useAdminConfig();
|
|
34
40
|
const showDialog = params => {
|
|
35
41
|
const newDialog = initializeState({
|
|
36
42
|
...params,
|
|
@@ -60,6 +66,15 @@ export const DialogsProvider = ({
|
|
|
60
66
|
const closeAllDialogs = () => {
|
|
61
67
|
setDialogs(new Map());
|
|
62
68
|
};
|
|
69
|
+
const openNamedDialog = (name, params) => {
|
|
70
|
+
setNamedDialogIntent({
|
|
71
|
+
name,
|
|
72
|
+
params
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
const closeNamedDialog = () => {
|
|
76
|
+
setNamedDialogIntent(null);
|
|
77
|
+
};
|
|
63
78
|
const onSubmit = async (id, data) => {
|
|
64
79
|
const dialog = dialogs.get(id);
|
|
65
80
|
if (!dialog) {
|
|
@@ -94,7 +109,9 @@ export const DialogsProvider = ({
|
|
|
94
109
|
const context = {
|
|
95
110
|
showDialog,
|
|
96
111
|
closeDialog,
|
|
97
|
-
closeAllDialogs
|
|
112
|
+
closeAllDialogs,
|
|
113
|
+
openNamedDialog,
|
|
114
|
+
closeNamedDialog
|
|
98
115
|
};
|
|
99
116
|
return /*#__PURE__*/React.createElement(DialogsContext.Provider, {
|
|
100
117
|
value: context
|
|
@@ -119,7 +136,18 @@ export const DialogsProvider = ({
|
|
|
119
136
|
onSubmit: data => onSubmit(dialog.id, data),
|
|
120
137
|
formData: dialog.formData,
|
|
121
138
|
size: dialog.size
|
|
122
|
-
})))
|
|
139
|
+
})), namedDialogIntent && (() => {
|
|
140
|
+
const registration = registeredDialogs.find(d => d.name === namedDialogIntent.name);
|
|
141
|
+
if (!registration) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
return /*#__PURE__*/React.createElement(DialogParamsContext.Provider, {
|
|
145
|
+
value: {
|
|
146
|
+
params: namedDialogIntent.params,
|
|
147
|
+
closeDialog: closeNamedDialog
|
|
148
|
+
}
|
|
149
|
+
}, registration.element);
|
|
150
|
+
})());
|
|
123
151
|
};
|
|
124
152
|
export const createDialogsProvider = () => {
|
|
125
153
|
return createProvider(Component => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","useSnackbar","Dialog","createProvider","generateId","initializeState","params","id","title","description","dismissible","icon","info","content","acceptLabel","cancelLabel","loadingLabel","dataLoadingLabel","onAccept","onClose","open","loading","element","formData","size","DialogsContext","createContext","undefined","DialogsProvider","children","showSnackbar","dialogs","setDialogs","Map","showDialog","newDialog","set","closeDialog","dialog","get","error","console","newDialogs","delete","closeAllDialogs","onSubmit","data","message","context","createElement","Provider","value","Array","from","values","map","key","Fragment","createDialogsProvider","Component","DialogsProviderDecorator"],"sources":["DialogsContext.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport React, { useState } from \"react\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { useSnackbar } from \"~/hooks/index.js\";\nimport { Dialog, type DialogProps } from \"./Dialog.js\";\nimport { createProvider } from \"@webiny/app\";\nimport { generateId } from \"@webiny/utils\";\n\ninterface ShowDialogParams {\n title: ReactNode;\n description?: ReactNode;\n dismissible?: boolean;\n content: ReactNode;\n actions?: React.JSX.Element;\n icon?: React.JSX.Element;\n info?: ReactNode;\n acceptLabel?: ReactNode;\n cancelLabel?: ReactNode;\n loadingLabel?: ReactNode;\n dataLoadingLabel?: ReactNode;\n onAccept?: (data: GenericFormData) => void;\n onClose?: () => void;\n formData?: DialogProps[\"formData\"];\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n}\n\nexport interface DialogsContext {\n showDialog: (params: ShowDialogParams) => () => void;\n closeAllDialogs: () => void;\n}\n\ninterface DialogsProviderProps {\n children: ReactNode;\n}\n\ninterface DialogState extends ShowDialogParams {\n id: string;\n open: boolean;\n loading: boolean;\n element?: React.JSX.Element;\n}\n\nexport const initializeState = (params: Partial<DialogState> = {}): DialogState => ({\n id: `dialog-${generateId()}`,\n title: params.title ?? `Confirmation`,\n description: params.description,\n dismissible: params.dismissible,\n icon: params.icon,\n info: params.info,\n content: params.content,\n acceptLabel: params.acceptLabel === null ? null : (params.acceptLabel ?? `Confirm`),\n cancelLabel: params.cancelLabel === null ? null : (params.cancelLabel ?? `Cancel`),\n loadingLabel: params.loadingLabel ?? `Loading...`,\n dataLoadingLabel: params.dataLoadingLabel ?? `Loading...`,\n onAccept: params.onAccept,\n onClose: params.onClose,\n open: params.open ?? false,\n loading: params.loading ?? false,\n element: params.element,\n formData: params.formData ?? {},\n size: params.size ?? \"md\"\n});\n\nexport const DialogsContext = React.createContext<DialogsContext | undefined>(undefined);\n\nexport const DialogsProvider = ({ children }: DialogsProviderProps) => {\n const { showSnackbar } = useSnackbar();\n const [dialogs, setDialogs] = useState<Map<string, DialogState>>(new Map());\n\n const showDialog = (params: ShowDialogParams) => {\n const newDialog = initializeState({ ...params, open: true });\n setDialogs(dialogs => new Map(dialogs).set(newDialog.id, newDialog));\n return () => closeDialog(newDialog.id);\n };\n\n const closeDialog = (id: string) => {\n const dialog = dialogs.get(id);\n\n // Call the onClose callback if it exists\n if (dialog?.onClose && typeof dialog.onClose === \"function\") {\n try {\n dialog.onClose();\n } catch (error) {\n // Log error but don't prevent dialog cleanup\n console.error(\"Error in dialog onClose callback:\", error);\n }\n }\n\n setDialogs(dialogs => {\n const newDialogs = new Map(dialogs);\n newDialogs.delete(id);\n return newDialogs;\n });\n };\n\n const closeAllDialogs = () => {\n setDialogs(new Map());\n };\n\n const onSubmit = async (id: string, data: GenericFormData) => {\n const dialog = dialogs.get(id);\n if (!dialog) {\n return;\n }\n\n try {\n if (typeof dialog.onAccept === \"function\") {\n setDialogs(dialogs => {\n const newDialogs = new Map(dialogs);\n newDialogs.set(id, { ...dialog, loading: true });\n return newDialogs;\n });\n\n await dialog.onAccept(data);\n }\n } catch (error) {\n showSnackbar(error.message);\n } finally {\n setDialogs(dialogs => {\n const newDialogs = new Map(dialogs);\n newDialogs.set(id, { ...dialog, loading: false });\n return newDialogs;\n });\n closeDialog(id);\n }\n };\n\n const context = {\n showDialog,\n closeDialog,\n closeAllDialogs\n };\n\n return (\n <DialogsContext.Provider value={context}>\n {children}\n {Array.from(dialogs.values()).map(dialog => (\n <Dialog\n key={dialog.id}\n description={dialog.description}\n dismissible={dialog.dismissible ?? true}\n icon={dialog.icon ?? <></>}\n title={dialog.title}\n content={dialog.content}\n open={dialog.open}\n info={dialog.info}\n acceptLabel={dialog.acceptLabel}\n cancelLabel={dialog.cancelLabel}\n loadingLabel={dialog.loadingLabel}\n dataLoadingLabel={dialog.dataLoadingLabel}\n loading={dialog.loading}\n closeDialog={() => {\n closeDialog(dialog.id);\n dialog.onClose && dialog.onClose();\n }}\n onSubmit={data => onSubmit(dialog.id, data)}\n formData={dialog.formData}\n size={dialog.size}\n />\n ))}\n </DialogsContext.Provider>\n );\n};\n\nexport const createDialogsProvider = () => {\n return createProvider(Component => {\n return function DialogsProviderDecorator({ children }: DialogsProviderProps) {\n return (\n <DialogsProvider>\n <Component>{children}</Component>\n </DialogsProvider>\n );\n };\n });\n};\n"],"mappings":"AACA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AAEvC,SAASC,WAAW;AACpB,SAASC,MAAM;AACf,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,UAAU,QAAQ,eAAe;AAoC1C,OAAO,MAAMC,eAAe,GAAGA,CAACC,MAA4B,GAAG,CAAC,CAAC,MAAmB;EAChFC,EAAE,EAAE,UAAUH,UAAU,CAAC,CAAC,EAAE;EAC5BI,KAAK,EAAEF,MAAM,CAACE,KAAK,IAAI,cAAc;EACrCC,WAAW,EAAEH,MAAM,CAACG,WAAW;EAC/BC,WAAW,EAAEJ,MAAM,CAACI,WAAW;EAC/BC,IAAI,EAAEL,MAAM,CAACK,IAAI;EACjBC,IAAI,EAAEN,MAAM,CAACM,IAAI;EACjBC,OAAO,EAAEP,MAAM,CAACO,OAAO;EACvBC,WAAW,EAAER,MAAM,CAACQ,WAAW,KAAK,IAAI,GAAG,IAAI,GAAIR,MAAM,CAACQ,WAAW,IAAI,SAAU;EACnFC,WAAW,EAAET,MAAM,CAACS,WAAW,KAAK,IAAI,GAAG,IAAI,GAAIT,MAAM,CAACS,WAAW,IAAI,QAAS;EAClFC,YAAY,EAAEV,MAAM,CAACU,YAAY,IAAI,YAAY;EACjDC,gBAAgB,EAAEX,MAAM,CAACW,gBAAgB,IAAI,YAAY;EACzDC,QAAQ,EAAEZ,MAAM,CAACY,QAAQ;EACzBC,OAAO,EAAEb,MAAM,CAACa,OAAO;EACvBC,IAAI,EAAEd,MAAM,CAACc,IAAI,IAAI,KAAK;EAC1BC,OAAO,EAAEf,MAAM,CAACe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AAED,OAAO,MAAMkC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,OAAOvD,cAAc,CAACwD,SAAS,IAAI;IAC/B,OAAO,SAASC,wBAAwBA,CAAC;MAAE/B;IAA+B,CAAC,EAAE;MACzE,oBACI9B,KAAA,CAAAkD,aAAA,CAACrB,eAAe,qBACZ7B,KAAA,CAAAkD,aAAA,CAACU,SAAS,QAAE9B,QAAoB,CACnB,CAAC;IAE1B,CAAC;EACL,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useState","createProvider","generateId","useSnackbar","Dialog","DialogParamsContext","useAdminConfig","initializeState","params","id","title","description","dismissible","icon","info","content","acceptLabel","cancelLabel","loadingLabel","dataLoadingLabel","onAccept","onClose","open","loading","element","formData","size","DialogsContext","createContext","undefined","DialogsProvider","children","showSnackbar","dialogs","setDialogs","Map","namedDialogIntent","setNamedDialogIntent","registeredDialogs","showDialog","newDialog","set","closeDialog","dialog","get","error","console","newDialogs","delete","closeAllDialogs","openNamedDialog","name","closeNamedDialog","onSubmit","data","message","context","createElement","Provider","value","Array","from","values","map","key","Fragment","registration","find","d","createDialogsProvider","Component","DialogsProviderDecorator"],"sources":["DialogsContext.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport React, { useState } from \"react\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { createProvider } from \"@webiny/app\";\nimport { generateId } from \"@webiny/utils\";\nimport { useSnackbar } from \"~/hooks/index.js\";\nimport { Dialog, type DialogProps } from \"./Dialog.js\";\nimport { DialogParamsContext } from \"./DialogParamsContext.js\";\nimport { useAdminConfig } from \"~/config/AdminConfig.js\";\n\ninterface ShowDialogParams {\n title: ReactNode;\n description?: ReactNode;\n dismissible?: boolean;\n content: ReactNode;\n actions?: React.JSX.Element;\n icon?: React.JSX.Element;\n info?: ReactNode;\n acceptLabel?: ReactNode;\n cancelLabel?: ReactNode;\n loadingLabel?: ReactNode;\n dataLoadingLabel?: ReactNode;\n onAccept?: (data: GenericFormData) => void;\n onClose?: () => void;\n formData?: DialogProps[\"formData\"];\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"full\";\n}\n\nexport interface DialogsContext {\n showDialog: (params: ShowDialogParams) => () => void;\n closeAllDialogs: () => void;\n openNamedDialog: (name: string, params: Record<string, unknown>) => void;\n closeNamedDialog: () => void;\n}\n\ninterface DialogsProviderProps {\n children: ReactNode;\n}\n\ninterface DialogState extends ShowDialogParams {\n id: string;\n open: boolean;\n loading: boolean;\n element?: React.JSX.Element;\n}\n\nexport const initializeState = (params: Partial<DialogState> = {}): DialogState => ({\n id: `dialog-${generateId()}`,\n title: params.title ?? `Confirmation`,\n description: params.description,\n dismissible: params.dismissible,\n icon: params.icon,\n info: params.info,\n content: params.content,\n acceptLabel: params.acceptLabel === null ? null : (params.acceptLabel ?? `Confirm`),\n cancelLabel: params.cancelLabel === null ? null : (params.cancelLabel ?? `Cancel`),\n loadingLabel: params.loadingLabel ?? `Loading...`,\n dataLoadingLabel: params.dataLoadingLabel ?? `Loading...`,\n onAccept: params.onAccept,\n onClose: params.onClose,\n open: params.open ?? false,\n loading: params.loading ?? false,\n element: params.element,\n formData: params.formData ?? {},\n size: params.size ?? \"md\"\n});\n\nexport const DialogsContext = React.createContext<DialogsContext | undefined>(undefined);\n\ninterface NamedDialogIntent {\n name: string;\n params: Record<string, unknown>;\n}\n\nexport const DialogsProvider = ({ children }: DialogsProviderProps) => {\n const { showSnackbar } = useSnackbar();\n const [dialogs, setDialogs] = useState<Map<string, DialogState>>(new Map());\n const [namedDialogIntent, setNamedDialogIntent] = useState<NamedDialogIntent | null>(null);\n const { dialogs: registeredDialogs } = useAdminConfig();\n\n const showDialog = (params: ShowDialogParams) => {\n const newDialog = initializeState({ ...params, open: true });\n setDialogs(dialogs => new Map(dialogs).set(newDialog.id, newDialog));\n return () => closeDialog(newDialog.id);\n };\n\n const closeDialog = (id: string) => {\n const dialog = dialogs.get(id);\n\n // Call the onClose callback if it exists\n if (dialog?.onClose && typeof dialog.onClose === \"function\") {\n try {\n dialog.onClose();\n } catch (error) {\n // Log error but don't prevent dialog cleanup\n console.error(\"Error in dialog onClose callback:\", error);\n }\n }\n\n setDialogs(dialogs => {\n const newDialogs = new Map(dialogs);\n newDialogs.delete(id);\n return newDialogs;\n });\n };\n\n const closeAllDialogs = () => {\n setDialogs(new Map());\n };\n\n const openNamedDialog = (name: string, params: Record<string, unknown>) => {\n setNamedDialogIntent({ name, params });\n };\n\n const closeNamedDialog = () => {\n setNamedDialogIntent(null);\n };\n\n const onSubmit = async (id: string, data: GenericFormData) => {\n const dialog = dialogs.get(id);\n if (!dialog) {\n return;\n }\n\n try {\n if (typeof dialog.onAccept === \"function\") {\n setDialogs(dialogs => {\n const newDialogs = new Map(dialogs);\n newDialogs.set(id, { ...dialog, loading: true });\n return newDialogs;\n });\n\n await dialog.onAccept(data);\n }\n } catch (error) {\n showSnackbar(error.message);\n } finally {\n setDialogs(dialogs => {\n const newDialogs = new Map(dialogs);\n newDialogs.set(id, { ...dialog, loading: false });\n return newDialogs;\n });\n closeDialog(id);\n }\n };\n\n const context = {\n showDialog,\n closeDialog,\n closeAllDialogs,\n openNamedDialog,\n closeNamedDialog\n };\n\n return (\n <DialogsContext.Provider value={context}>\n {children}\n {Array.from(dialogs.values()).map(dialog => (\n <Dialog\n key={dialog.id}\n description={dialog.description}\n dismissible={dialog.dismissible ?? true}\n icon={dialog.icon ?? <></>}\n title={dialog.title}\n content={dialog.content}\n open={dialog.open}\n info={dialog.info}\n acceptLabel={dialog.acceptLabel}\n cancelLabel={dialog.cancelLabel}\n loadingLabel={dialog.loadingLabel}\n dataLoadingLabel={dialog.dataLoadingLabel}\n loading={dialog.loading}\n closeDialog={() => {\n closeDialog(dialog.id);\n dialog.onClose && dialog.onClose();\n }}\n onSubmit={data => onSubmit(dialog.id, data)}\n formData={dialog.formData}\n size={dialog.size}\n />\n ))}\n {namedDialogIntent &&\n (() => {\n const registration = registeredDialogs.find(\n d => d.name === namedDialogIntent.name\n );\n if (!registration) {\n return null;\n }\n return (\n <DialogParamsContext.Provider\n value={{\n params: namedDialogIntent.params,\n closeDialog: closeNamedDialog\n }}\n >\n {registration.element}\n </DialogParamsContext.Provider>\n );\n })()}\n </DialogsContext.Provider>\n );\n};\n\nexport const createDialogsProvider = () => {\n return createProvider(Component => {\n return function DialogsProviderDecorator({ children }: DialogsProviderProps) {\n return (\n <DialogsProvider>\n <Component>{children}</Component>\n </DialogsProvider>\n );\n };\n });\n};\n"],"mappings":"AACA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AAEvC,SAASC,cAAc,QAAQ,aAAa;AAC5C,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,WAAW;AACpB,SAASC,MAAM;AACf,SAASC,mBAAmB;AAC5B,SAASC,cAAc;AAsCvB,OAAO,MAAMC,eAAe,GAAGA,CAACC,MAA4B,GAAG,CAAC,CAAC,MAAmB;EAChFC,EAAE,EAAE,UAAUP,UAAU,CAAC,CAAC,EAAE;EAC5BQ,KAAK,EAAEF,MAAM,CAACE,KAAK,IAAI,cAAc;EACrCC,WAAW,EAAEH,MAAM,CAACG,WAAW;EAC/BC,WAAW,EAAEJ,MAAM,CAACI,WAAW;EAC/BC,IAAI,EAAEL,MAAM,CAACK,IAAI;EACjBC,IAAI,EAAEN,MAAM,CAACM,IAAI;EACjBC,OAAO,EAAEP,MAAM,CAACO,OAAO;EACvBC,WAAW,EAAER,MAAM,CAACQ,WAAW,KAAK,IAAI,GAAG,IAAI,GAAIR,MAAM,CAACQ,WAAW,IAAI,SAAU;EACnFC,WAAW,EAAET,MAAM,CAACS,WAAW,KAAK,IAAI,GAAG,IAAI,GAAIT,MAAM,CAACS,WAAW,IAAI,QAAS;EAClFC,YAAY,EAAEV,MAAM,CAACU,YAAY,IAAI,YAAY;EACjDC,gBAAgB,EAAEX,MAAM,CAACW,gBAAgB,IAAI,YAAY;EACzDC,QAAQ,EAAEZ,MAAM,CAACY,QAAQ;E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CAAC;EACL,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { IconButton } from "@webiny/admin-ui";
|
|
3
|
+
type IconButtonProps = React.ComponentProps<typeof IconButton>;
|
|
2
4
|
export interface OptionsMenuProps {
|
|
5
|
+
variant?: IconButtonProps["variant"];
|
|
6
|
+
size?: IconButtonProps["size"];
|
|
7
|
+
iconSize?: IconButtonProps["iconSize"];
|
|
3
8
|
actions: {
|
|
4
9
|
name: string;
|
|
5
10
|
element: React.ReactElement;
|
|
@@ -8,3 +13,4 @@ export interface OptionsMenuProps {
|
|
|
8
13
|
["data-testid"]?: string;
|
|
9
14
|
}
|
|
10
15
|
export declare const OptionsMenu: (props: OptionsMenuProps) => React.JSX.Element | null;
|
|
16
|
+
export {};
|
|
@@ -8,9 +8,9 @@ export const OptionsMenu = props => {
|
|
|
8
8
|
}
|
|
9
9
|
const trigger = props.trigger || /*#__PURE__*/React.createElement(IconButton, {
|
|
10
10
|
icon: /*#__PURE__*/React.createElement(MoreVerticalIcon, null),
|
|
11
|
-
size: "
|
|
12
|
-
iconSize: "
|
|
13
|
-
variant: "ghost",
|
|
11
|
+
size: props.size ?? "md",
|
|
12
|
+
iconSize: props.iconSize ?? "default",
|
|
13
|
+
variant: props.variant ?? "ghost",
|
|
14
14
|
"data-testid": props["data-testid"] || "more-options-icon"
|
|
15
15
|
});
|
|
16
16
|
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Fragment","ReactComponent","MoreVerticalIcon","IconButton","DropdownMenu","OptionsMenuItemProvider","OptionsMenu","props","actions","length","trigger","createElement","icon","size","iconSize","variant","map","action","key","name","element"],"sources":["OptionsMenu.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport { ReactComponent as MoreVerticalIcon } from \"@webiny/icons/more_vert.svg\";\nimport { IconButton, DropdownMenu } from \"@webiny/admin-ui\";\nimport { OptionsMenuItemProvider } from \"./useOptionsMenuItem.js\";\n\nexport interface OptionsMenuProps {\n actions: {\n name: string;\n element: React.ReactElement;\n }[];\n trigger?: React.ReactElement;\n [\"data-testid\"]?: string;\n}\n\nexport const OptionsMenu = (props: OptionsMenuProps) => {\n if (!props.actions.length) {\n return null;\n }\n\n const trigger = props.trigger || (\n <IconButton\n icon={<MoreVerticalIcon />}\n size={\"
|
|
1
|
+
{"version":3,"names":["React","Fragment","ReactComponent","MoreVerticalIcon","IconButton","DropdownMenu","OptionsMenuItemProvider","OptionsMenu","props","actions","length","trigger","createElement","icon","size","iconSize","variant","map","action","key","name","element"],"sources":["OptionsMenu.tsx"],"sourcesContent":["import React, { Fragment } from \"react\";\nimport { ReactComponent as MoreVerticalIcon } from \"@webiny/icons/more_vert.svg\";\nimport { IconButton, DropdownMenu } from \"@webiny/admin-ui\";\nimport { OptionsMenuItemProvider } from \"./useOptionsMenuItem.js\";\n\ntype IconButtonProps = React.ComponentProps<typeof IconButton>;\n\nexport interface OptionsMenuProps {\n variant?: IconButtonProps[\"variant\"];\n size?: IconButtonProps[\"size\"];\n iconSize?: IconButtonProps[\"iconSize\"];\n actions: {\n name: string;\n element: React.ReactElement;\n }[];\n trigger?: React.ReactElement;\n [\"data-testid\"]?: string;\n}\n\nexport const OptionsMenu = (props: OptionsMenuProps) => {\n if (!props.actions.length) {\n return null;\n }\n\n const trigger = props.trigger || (\n <IconButton\n icon={<MoreVerticalIcon />}\n size={props.size ?? \"md\"}\n iconSize={props.iconSize ?? \"default\"}\n variant={props.variant ?? \"ghost\"}\n data-testid={props[\"data-testid\"] || \"more-options-icon\"}\n />\n );\n\n return (\n <DropdownMenu trigger={trigger}>\n {props.actions.map(action => (\n <Fragment key={action.name}>\n <OptionsMenuItemProvider>{action.element}</OptionsMenuItemProvider>\n </Fragment>\n ))}\n </DropdownMenu>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,cAAc,IAAIC,gBAAgB,QAAQ,6BAA6B;AAChF,SAASC,UAAU,EAAEC,YAAY,QAAQ,kBAAkB;AAC3D,SAASC,uBAAuB;AAgBhC,OAAO,MAAMC,WAAW,GAAIC,KAAuB,IAAK;EACpD,IAAI,CAACA,KAAK,CAACC,OAAO,CAACC,MAAM,EAAE;IACvB,OAAO,IAAI;EACf;EAEA,MAAMC,OAAO,GAAGH,KAAK,CAACG,OAAO,iBACzBX,KAAA,CAAAY,aAAA,CAACR,UAAU;IACPS,IAAI,eAAEb,KAAA,CAAAY,aAAA,CAACT,gBAAgB,MAAE,CAAE;IAC3BW,IAAI,EAAEN,KAAK,CAACM,IAAI,IAAI,IAAK;IACzBC,QAAQ,EAAEP,KAAK,CAACO,QAAQ,IAAI,SAAU;IACtCC,OAAO,EAAER,KAAK,CAACQ,OAAO,IAAI,OAAQ;IAClC,eAAaR,KAAK,CAAC,aAAa,CAAC,IAAI;EAAoB,CAC5D,CACJ;EAED,oBACIR,KAAA,CAAAY,aAAA,CAACP,YAAY;IAACM,OAAO,EAAEA;EAAQ,GAC1BH,KAAK,CAACC,OAAO,CAACQ,GAAG,CAACC,MAAM,iBACrBlB,KAAA,CAAAY,aAAA,CAACX,QAAQ;IAACkB,GAAG,EAAED,MAAM,CAACE;EAAK,gBACvBpB,KAAA,CAAAY,aAAA,CAACN,uBAAuB,QAAEY,MAAM,CAACG,OAAiC,CAC5D,CACb,CACS,CAAC;AAEvB,CAAC","ignoreList":[]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMemo } from "react";
|
|
2
2
|
import { useContainer } from "@webiny/app";
|
|
3
3
|
|
|
4
4
|
// Extract the first parameter type from TParams tuple
|
|
5
5
|
|
|
6
6
|
// Conditional props based on whether feature requires options
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const RegisterFeatureImpl = ({
|
|
9
9
|
feature,
|
|
10
10
|
options
|
|
11
|
-
}) {
|
|
11
|
+
}) => {
|
|
12
12
|
const container = useContainer();
|
|
13
|
-
|
|
13
|
+
useMemo(() => {
|
|
14
14
|
// Cast feature.register to accept ...any[] to avoid type narrowing issues
|
|
15
15
|
const register = feature.register;
|
|
16
16
|
if (options !== undefined) {
|
|
@@ -20,7 +20,7 @@ function RegisterFeatureImpl({
|
|
|
20
20
|
}
|
|
21
21
|
}, [container, feature, options]);
|
|
22
22
|
return null;
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
24
|
export const RegisterFeature = RegisterFeatureImpl;
|
|
25
25
|
|
|
26
26
|
//# sourceMappingURL=RegisterFeature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useMemo","useContainer","RegisterFeatureImpl","feature","options","container","register","undefined","RegisterFeature"],"sources":["RegisterFeature.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useContainer } from \"@webiny/app\";\nimport type { FeatureDefinition } from \"@webiny/feature/admin\";\n\n// Extract the first parameter type from TParams tuple\ntype ExtractOptions<TParams extends any[]> = TParams extends [infer First, ...any[]]\n ? First\n : never;\n\n// Conditional props based on whether feature requires options\ntype RegisterFeatureProps<TParams extends any[]> = {\n feature: FeatureDefinition<any, TParams>;\n} & (TParams extends [] ? { options?: never } : { options: ExtractOptions<TParams> });\n\nconst RegisterFeatureImpl = <TParams extends any[]>({\n feature,\n options\n}: RegisterFeatureProps<TParams>) => {\n const container = useContainer();\n useMemo(() => {\n // Cast feature.register to accept ...any[] to avoid type narrowing issues\n const register = feature.register as (container: any, ...args: any[]) => void;\n if (options !== undefined) {\n register(container, options);\n } else {\n register(container);\n }\n }, [container, feature, options]);\n return null;\n};\n\nexport const RegisterFeature = RegisterFeatureImpl as <TParams extends any[]>(\n props: RegisterFeatureProps<TParams>\n) => null;\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,YAAY,QAAQ,aAAa;;AAG1C;;AAKA;;AAKA,MAAMC,mBAAmB,GAAGA,CAAwB;EAChDC,OAAO;EACPC;AAC2B,CAAC,KAAK;EACjC,MAAMC,SAAS,GAAGJ,YAAY,CAAC,CAAC;EAChCD,OAAO,CAAC,MAAM;IACV;IACA,MAAMM,QAAQ,GAAGH,OAAO,CAACG,QAAoD;IAC7E,IAAIF,OAAO,KAAKG,SAAS,EAAE;MACvBD,QAAQ,CAACD,SAAS,EAAED,OAAO,CAAC;IAChC,CAAC,MAAM;MACHE,QAAQ,CAACD,SAAS,CAAC;IACvB;EACJ,CAAC,EAAE,CAACA,SAAS,EAAEF,OAAO,EAAEC,OAAO,CAAC,CAAC;EACjC,OAAO,IAAI;AACf,CAAC;AAED,OAAO,MAAMI,eAAe,GAAGN,mBAEtB","ignoreList":[]}
|
package/components/Wcp.d.ts
CHANGED
|
@@ -2,12 +2,14 @@ import React from "react";
|
|
|
2
2
|
interface ChildrenProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
}
|
|
5
|
+
declare function CanUseMultiTenancy({ children }: ChildrenProps): React.JSX.Element | null;
|
|
5
6
|
declare function CanUseTeams({ children }: ChildrenProps): React.JSX.Element | null;
|
|
6
7
|
declare function CanUsePrivateFiles({ children }: ChildrenProps): React.JSX.Element | null;
|
|
7
8
|
declare function CanUseFileManagerThreatDetection({ children }: ChildrenProps): React.JSX.Element | null;
|
|
8
9
|
declare function CanUseWorkflows({ children }: ChildrenProps): React.JSX.Element | null;
|
|
9
10
|
declare function CanUseHcmsFieldPermissions({ children }: ChildrenProps): React.JSX.Element | null;
|
|
10
11
|
export declare const Wcp: {
|
|
12
|
+
CanUseMultiTenancy: typeof CanUseMultiTenancy;
|
|
11
13
|
CanUseTeams: typeof CanUseTeams;
|
|
12
14
|
CanUsePrivateFiles: typeof CanUsePrivateFiles;
|
|
13
15
|
CanUseFileManagerThreatDetection: typeof CanUseFileManagerThreatDetection;
|
package/components/Wcp.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { useWcp } from "../presentation/wcp/useWcp.js";
|
|
3
|
+
function CanUseMultiTenancy({
|
|
4
|
+
children
|
|
5
|
+
}) {
|
|
6
|
+
const wcp = useWcp();
|
|
7
|
+
return wcp.canUseFeature("multiTenancy") ? /*#__PURE__*/React.createElement(React.Fragment, null, children) : null;
|
|
8
|
+
}
|
|
3
9
|
function CanUseTeams({
|
|
4
10
|
children
|
|
5
11
|
}) {
|
|
@@ -31,6 +37,7 @@ function CanUseHcmsFieldPermissions({
|
|
|
31
37
|
return wcp.canUseHcmsFieldPermissions() ? /*#__PURE__*/React.createElement(React.Fragment, null, children) : null;
|
|
32
38
|
}
|
|
33
39
|
export const Wcp = {
|
|
40
|
+
CanUseMultiTenancy,
|
|
34
41
|
CanUseTeams,
|
|
35
42
|
CanUsePrivateFiles,
|
|
36
43
|
CanUseFileManagerThreatDetection,
|