@cratis/arc.react 18.0.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/Arc.tsx +44 -0
- package/ArcContext.ts +23 -0
- package/Bindings.ts +15 -0
- package/README.md +65 -0
- package/WellKnownBindings.ts +9 -0
- package/commands/CommandScope.tsx +57 -0
- package/commands/CommandScopeImplementation.ts +68 -0
- package/commands/ICommandScope.ts +31 -0
- package/commands/for_CommandScopeImplementation/FakeCommand.ts +59 -0
- package/commands/for_CommandScopeImplementation/when_executing_with_three_commands_were_two_having_changes.ts +25 -0
- package/commands/for_CommandScopeImplementation/when_none_of_the_added_commands_has_changes.ts +19 -0
- package/commands/for_CommandScopeImplementation/when_one_of_the_added_commands_has_changes.ts +19 -0
- package/commands/for_CommandScopeImplementation/when_property_changes_on_added_command.ts +26 -0
- package/commands/for_CommandScopeImplementation/when_reverting_with_three_commands_were_two_having_changes.ts +25 -0
- package/commands/for_CommandScopeImplementation/when_there_are_no_commands.ts +10 -0
- package/commands/for_useCommand/FakeCommand.ts +31 -0
- package/commands/for_useCommand/when_creating_instance.ts +41 -0
- package/commands/for_useCommand/when_creating_instance_with_initial_values.ts +38 -0
- package/commands/for_useCommand/when_creating_instance_without_optional_context_values.ts +37 -0
- package/commands/index.ts +8 -0
- package/commands/useCommand.ts +70 -0
- package/commands/useCommandScope.ts +9 -0
- package/dialogs/BusyIndicatorDialogRequest.ts +18 -0
- package/dialogs/CloseDialog.ts +9 -0
- package/dialogs/ConfirmationDialogRequest.ts +22 -0
- package/dialogs/DialogButtons.ts +28 -0
- package/dialogs/DialogComponents.tsx +113 -0
- package/dialogs/DialogContext.ts +33 -0
- package/dialogs/DialogProps.ts +14 -0
- package/dialogs/DialogResponse.ts +9 -0
- package/dialogs/DialogResult.ts +32 -0
- package/dialogs/ShowDialog.ts +9 -0
- package/dialogs/index.ts +16 -0
- package/dialogs/useBusyIndicator.ts +41 -0
- package/dialogs/useConfirmationDialog.ts +39 -0
- package/dialogs/useDialog.tsx +55 -0
- package/dist/cjs/Arc.d.ts +12 -0
- package/dist/cjs/Arc.d.ts.map +1 -0
- package/dist/cjs/Arc.js +25 -0
- package/dist/cjs/Arc.js.map +1 -0
- package/dist/cjs/ArcContext.d.ts +12 -0
- package/dist/cjs/ArcContext.d.ts.map +1 -0
- package/dist/cjs/ArcContext.js +16 -0
- package/dist/cjs/ArcContext.js.map +1 -0
- package/dist/cjs/Bindings.d.ts +5 -0
- package/dist/cjs/Bindings.d.ts.map +1 -0
- package/dist/cjs/Bindings.js +15 -0
- package/dist/cjs/Bindings.js.map +1 -0
- package/dist/cjs/WellKnownBindings.d.ts +4 -0
- package/dist/cjs/WellKnownBindings.d.ts.map +1 -0
- package/dist/cjs/WellKnownBindings.js +8 -0
- package/dist/cjs/WellKnownBindings.js.map +1 -0
- package/dist/cjs/commands/CommandScope.d.ts +13 -0
- package/dist/cjs/commands/CommandScope.d.ts.map +1 -0
- package/dist/cjs/commands/CommandScope.js +39 -0
- package/dist/cjs/commands/CommandScope.js.map +1 -0
- package/dist/cjs/commands/CommandScopeImplementation.d.ts +16 -0
- package/dist/cjs/commands/CommandScopeImplementation.d.ts.map +1 -0
- package/dist/cjs/commands/CommandScopeImplementation.js +52 -0
- package/dist/cjs/commands/CommandScopeImplementation.js.map +1 -0
- package/dist/cjs/commands/ICommandScope.d.ts +8 -0
- package/dist/cjs/commands/ICommandScope.d.ts.map +1 -0
- package/dist/cjs/commands/index.d.ts +6 -0
- package/dist/cjs/commands/index.d.ts.map +1 -0
- package/dist/cjs/commands/index.js +15 -0
- package/dist/cjs/commands/index.js.map +1 -0
- package/dist/cjs/commands/useCommand.d.ts +6 -0
- package/dist/cjs/commands/useCommand.d.ts.map +1 -0
- package/dist/cjs/commands/useCommand.js +47 -0
- package/dist/cjs/commands/useCommand.js.map +1 -0
- package/dist/cjs/commands/useCommandScope.d.ts +2 -0
- package/dist/cjs/commands/useCommandScope.d.ts.map +1 -0
- package/dist/cjs/commands/useCommandScope.js +11 -0
- package/dist/cjs/commands/useCommandScope.js.map +1 -0
- package/dist/cjs/dialogs/BusyIndicatorDialogRequest.d.ts +6 -0
- package/dist/cjs/dialogs/BusyIndicatorDialogRequest.d.ts.map +1 -0
- package/dist/cjs/dialogs/BusyIndicatorDialogRequest.js +13 -0
- package/dist/cjs/dialogs/BusyIndicatorDialogRequest.js.map +1 -0
- package/dist/cjs/dialogs/CloseDialog.d.ts +3 -0
- package/dist/cjs/dialogs/CloseDialog.d.ts.map +1 -0
- package/dist/cjs/dialogs/ConfirmationDialogRequest.d.ts +8 -0
- package/dist/cjs/dialogs/ConfirmationDialogRequest.d.ts.map +1 -0
- package/dist/cjs/dialogs/ConfirmationDialogRequest.js +15 -0
- package/dist/cjs/dialogs/ConfirmationDialogRequest.js.map +1 -0
- package/dist/cjs/dialogs/DialogButtons.d.ts +7 -0
- package/dist/cjs/dialogs/DialogButtons.d.ts.map +1 -0
- package/dist/cjs/dialogs/DialogButtons.js +10 -0
- package/dist/cjs/dialogs/DialogButtons.js.map +1 -0
- package/dist/cjs/dialogs/DialogComponents.d.ts +20 -0
- package/dist/cjs/dialogs/DialogComponents.d.ts.map +1 -0
- package/dist/cjs/dialogs/DialogComponents.js +34 -0
- package/dist/cjs/dialogs/DialogComponents.js.map +1 -0
- package/dist/cjs/dialogs/DialogContext.d.ts +10 -0
- package/dist/cjs/dialogs/DialogContext.d.ts.map +1 -0
- package/dist/cjs/dialogs/DialogContext.js +40 -0
- package/dist/cjs/dialogs/DialogContext.js.map +1 -0
- package/dist/cjs/dialogs/DialogProps.d.ts +5 -0
- package/dist/cjs/dialogs/DialogProps.d.ts.map +1 -0
- package/dist/cjs/dialogs/DialogResponse.d.ts +3 -0
- package/dist/cjs/dialogs/DialogResponse.d.ts.map +1 -0
- package/dist/cjs/dialogs/DialogResult.d.ts +8 -0
- package/dist/cjs/dialogs/DialogResult.d.ts.map +1 -0
- package/dist/cjs/dialogs/DialogResult.js +11 -0
- package/dist/cjs/dialogs/DialogResult.js.map +1 -0
- package/dist/cjs/dialogs/ShowDialog.d.ts +3 -0
- package/dist/cjs/dialogs/ShowDialog.d.ts.map +1 -0
- package/dist/cjs/dialogs/index.d.ts +14 -0
- package/dist/cjs/dialogs/index.d.ts.map +1 -0
- package/dist/cjs/dialogs/index.js +33 -0
- package/dist/cjs/dialogs/index.js.map +1 -0
- package/dist/cjs/dialogs/useBusyIndicator.d.ts +5 -0
- package/dist/cjs/dialogs/useBusyIndicator.d.ts.map +1 -0
- package/dist/cjs/dialogs/useBusyIndicator.js +21 -0
- package/dist/cjs/dialogs/useBusyIndicator.js.map +1 -0
- package/dist/cjs/dialogs/useConfirmationDialog.d.ts +5 -0
- package/dist/cjs/dialogs/useConfirmationDialog.d.ts.map +1 -0
- package/dist/cjs/dialogs/useConfirmationDialog.js +20 -0
- package/dist/cjs/dialogs/useConfirmationDialog.js.map +1 -0
- package/dist/cjs/dialogs/useDialog.d.ts +5 -0
- package/dist/cjs/dialogs/useDialog.d.ts.map +1 -0
- package/dist/cjs/dialogs/useDialog.js +34 -0
- package/dist/cjs/dialogs/useDialog.js.map +1 -0
- package/dist/cjs/identity/IdentityProvider.d.ts +10 -0
- package/dist/cjs/identity/IdentityProvider.d.ts.map +1 -0
- package/dist/cjs/identity/IdentityProvider.js +48 -0
- package/dist/cjs/identity/IdentityProvider.js.map +1 -0
- package/dist/cjs/identity/index.d.ts +3 -0
- package/dist/cjs/identity/index.d.ts.map +1 -0
- package/dist/cjs/identity/index.js +11 -0
- package/dist/cjs/identity/index.js.map +1 -0
- package/dist/cjs/identity/useIdentity.d.ts +3 -0
- package/dist/cjs/identity/useIdentity.d.ts.map +1 -0
- package/dist/cjs/identity/useIdentity.js +15 -0
- package/dist/cjs/identity/useIdentity.js.map +1 -0
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/queries/SetPage.d.ts +2 -0
- package/dist/cjs/queries/SetPage.d.ts.map +1 -0
- package/dist/cjs/queries/SetPageSize.d.ts +2 -0
- package/dist/cjs/queries/SetPageSize.d.ts.map +1 -0
- package/dist/cjs/queries/SetSorting.d.ts +3 -0
- package/dist/cjs/queries/SetSorting.d.ts.map +1 -0
- package/dist/cjs/queries/index.d.ts +6 -0
- package/dist/cjs/queries/index.d.ts.map +1 -0
- package/dist/cjs/queries/index.js +12 -0
- package/dist/cjs/queries/index.js.map +1 -0
- package/dist/cjs/queries/useObservableQuery.d.ts +16 -0
- package/dist/cjs/queries/useObservableQuery.d.ts.map +1 -0
- package/dist/cjs/queries/useObservableQuery.js +54 -0
- package/dist/cjs/queries/useObservableQuery.js.map +1 -0
- package/dist/cjs/queries/useQuery.d.ts +19 -0
- package/dist/cjs/queries/useQuery.d.ts.map +1 -0
- package/dist/cjs/queries/useQuery.js +76 -0
- package/dist/cjs/queries/useQuery.js.map +1 -0
- package/dist/esm/Arc.d.ts +12 -0
- package/dist/esm/Arc.d.ts.map +1 -0
- package/dist/esm/Arc.js +23 -0
- package/dist/esm/Arc.js.map +1 -0
- package/dist/esm/ArcContext.d.ts +12 -0
- package/dist/esm/ArcContext.d.ts.map +1 -0
- package/dist/esm/ArcContext.js +14 -0
- package/dist/esm/ArcContext.js.map +1 -0
- package/dist/esm/Bindings.d.ts +5 -0
- package/dist/esm/Bindings.d.ts.map +1 -0
- package/dist/esm/Bindings.js +13 -0
- package/dist/esm/Bindings.js.map +1 -0
- package/dist/esm/WellKnownBindings.d.ts +4 -0
- package/dist/esm/WellKnownBindings.d.ts.map +1 -0
- package/dist/esm/WellKnownBindings.js +6 -0
- package/dist/esm/WellKnownBindings.js.map +1 -0
- package/dist/esm/commands/CommandScope.d.ts +13 -0
- package/dist/esm/commands/CommandScope.d.ts.map +1 -0
- package/dist/esm/commands/CommandScope.js +36 -0
- package/dist/esm/commands/CommandScope.js.map +1 -0
- package/dist/esm/commands/CommandScopeImplementation.d.ts +16 -0
- package/dist/esm/commands/CommandScopeImplementation.d.ts.map +1 -0
- package/dist/esm/commands/CommandScopeImplementation.js +50 -0
- package/dist/esm/commands/CommandScopeImplementation.js.map +1 -0
- package/dist/esm/commands/ICommandScope.d.ts +8 -0
- package/dist/esm/commands/ICommandScope.d.ts.map +1 -0
- package/dist/esm/commands/ICommandScope.js +2 -0
- package/dist/esm/commands/ICommandScope.js.map +1 -0
- package/dist/esm/commands/index.d.ts +6 -0
- package/dist/esm/commands/index.d.ts.map +1 -0
- package/dist/esm/commands/index.js +5 -0
- package/dist/esm/commands/index.js.map +1 -0
- package/dist/esm/commands/useCommand.d.ts +6 -0
- package/dist/esm/commands/useCommand.d.ts.map +1 -0
- package/dist/esm/commands/useCommand.js +45 -0
- package/dist/esm/commands/useCommand.js.map +1 -0
- package/dist/esm/commands/useCommandScope.d.ts +2 -0
- package/dist/esm/commands/useCommandScope.d.ts.map +1 -0
- package/dist/esm/commands/useCommandScope.js +9 -0
- package/dist/esm/commands/useCommandScope.js.map +1 -0
- package/dist/esm/dialogs/BusyIndicatorDialogRequest.d.ts +6 -0
- package/dist/esm/dialogs/BusyIndicatorDialogRequest.d.ts.map +1 -0
- package/dist/esm/dialogs/BusyIndicatorDialogRequest.js +11 -0
- package/dist/esm/dialogs/BusyIndicatorDialogRequest.js.map +1 -0
- package/dist/esm/dialogs/CloseDialog.d.ts +3 -0
- package/dist/esm/dialogs/CloseDialog.d.ts.map +1 -0
- package/dist/esm/dialogs/CloseDialog.js +2 -0
- package/dist/esm/dialogs/CloseDialog.js.map +1 -0
- package/dist/esm/dialogs/ConfirmationDialogRequest.d.ts +8 -0
- package/dist/esm/dialogs/ConfirmationDialogRequest.d.ts.map +1 -0
- package/dist/esm/dialogs/ConfirmationDialogRequest.js +13 -0
- package/dist/esm/dialogs/ConfirmationDialogRequest.js.map +1 -0
- package/dist/esm/dialogs/DialogButtons.d.ts +7 -0
- package/dist/esm/dialogs/DialogButtons.d.ts.map +1 -0
- package/dist/esm/dialogs/DialogButtons.js +10 -0
- package/dist/esm/dialogs/DialogButtons.js.map +1 -0
- package/dist/esm/dialogs/DialogComponents.d.ts +20 -0
- package/dist/esm/dialogs/DialogComponents.d.ts.map +1 -0
- package/dist/esm/dialogs/DialogComponents.js +31 -0
- package/dist/esm/dialogs/DialogComponents.js.map +1 -0
- package/dist/esm/dialogs/DialogContext.d.ts +10 -0
- package/dist/esm/dialogs/DialogContext.d.ts.map +1 -0
- package/dist/esm/dialogs/DialogContext.js +18 -0
- package/dist/esm/dialogs/DialogContext.js.map +1 -0
- package/dist/esm/dialogs/DialogProps.d.ts +5 -0
- package/dist/esm/dialogs/DialogProps.d.ts.map +1 -0
- package/dist/esm/dialogs/DialogProps.js +2 -0
- package/dist/esm/dialogs/DialogProps.js.map +1 -0
- package/dist/esm/dialogs/DialogResponse.d.ts +3 -0
- package/dist/esm/dialogs/DialogResponse.d.ts.map +1 -0
- package/dist/esm/dialogs/DialogResponse.js +2 -0
- package/dist/esm/dialogs/DialogResponse.js.map +1 -0
- package/dist/esm/dialogs/DialogResult.d.ts +8 -0
- package/dist/esm/dialogs/DialogResult.d.ts.map +1 -0
- package/dist/esm/dialogs/DialogResult.js +11 -0
- package/dist/esm/dialogs/DialogResult.js.map +1 -0
- package/dist/esm/dialogs/ShowDialog.d.ts +3 -0
- package/dist/esm/dialogs/ShowDialog.d.ts.map +1 -0
- package/dist/esm/dialogs/ShowDialog.js +2 -0
- package/dist/esm/dialogs/ShowDialog.js.map +1 -0
- package/dist/esm/dialogs/index.d.ts +14 -0
- package/dist/esm/dialogs/index.d.ts.map +1 -0
- package/dist/esm/dialogs/index.js +10 -0
- package/dist/esm/dialogs/index.js.map +1 -0
- package/dist/esm/dialogs/useBusyIndicator.d.ts +5 -0
- package/dist/esm/dialogs/useBusyIndicator.d.ts.map +1 -0
- package/dist/esm/dialogs/useBusyIndicator.js +19 -0
- package/dist/esm/dialogs/useBusyIndicator.js.map +1 -0
- package/dist/esm/dialogs/useConfirmationDialog.d.ts +5 -0
- package/dist/esm/dialogs/useConfirmationDialog.d.ts.map +1 -0
- package/dist/esm/dialogs/useConfirmationDialog.js +18 -0
- package/dist/esm/dialogs/useConfirmationDialog.js.map +1 -0
- package/dist/esm/dialogs/useDialog.d.ts +5 -0
- package/dist/esm/dialogs/useDialog.d.ts.map +1 -0
- package/dist/esm/dialogs/useDialog.js +32 -0
- package/dist/esm/dialogs/useDialog.js.map +1 -0
- package/dist/esm/identity/IdentityProvider.d.ts +10 -0
- package/dist/esm/identity/IdentityProvider.d.ts.map +1 -0
- package/dist/esm/identity/IdentityProvider.js +45 -0
- package/dist/esm/identity/IdentityProvider.js.map +1 -0
- package/dist/esm/identity/index.d.ts +3 -0
- package/dist/esm/identity/index.d.ts.map +1 -0
- package/dist/esm/identity/index.js +3 -0
- package/dist/esm/identity/index.js.map +1 -0
- package/dist/esm/identity/useIdentity.d.ts +3 -0
- package/dist/esm/identity/useIdentity.d.ts.map +1 -0
- package/dist/esm/identity/useIdentity.js +13 -0
- package/dist/esm/identity/useIdentity.js.map +1 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/queries/SetPage.d.ts +2 -0
- package/dist/esm/queries/SetPage.d.ts.map +1 -0
- package/dist/esm/queries/SetPage.js +2 -0
- package/dist/esm/queries/SetPage.js.map +1 -0
- package/dist/esm/queries/SetPageSize.d.ts +2 -0
- package/dist/esm/queries/SetPageSize.d.ts.map +1 -0
- package/dist/esm/queries/SetPageSize.js +2 -0
- package/dist/esm/queries/SetPageSize.js.map +1 -0
- package/dist/esm/queries/SetSorting.d.ts +3 -0
- package/dist/esm/queries/SetSorting.d.ts.map +1 -0
- package/dist/esm/queries/SetSorting.js +2 -0
- package/dist/esm/queries/SetSorting.js.map +1 -0
- package/dist/esm/queries/index.d.ts +6 -0
- package/dist/esm/queries/index.d.ts.map +1 -0
- package/dist/esm/queries/index.js +3 -0
- package/dist/esm/queries/index.js.map +1 -0
- package/dist/esm/queries/useObservableQuery.d.ts +16 -0
- package/dist/esm/queries/useObservableQuery.d.ts.map +1 -0
- package/dist/esm/queries/useObservableQuery.js +51 -0
- package/dist/esm/queries/useObservableQuery.js.map +1 -0
- package/dist/esm/queries/useQuery.d.ts +19 -0
- package/dist/esm/queries/useQuery.d.ts.map +1 -0
- package/dist/esm/queries/useQuery.js +73 -0
- package/dist/esm/queries/useQuery.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/global.d.ts +11 -0
- package/identity/IdentityProvider.tsx +61 -0
- package/identity/for_IdentityProvider/when_refreshing_identity.ts +59 -0
- package/identity/index.ts +5 -0
- package/identity/useIdentity.ts +19 -0
- package/index.ts +18 -0
- package/package.json +69 -0
- package/queries/SetPage.ts +7 -0
- package/queries/SetPageSize.ts +7 -0
- package/queries/SetSorting.ts +9 -0
- package/queries/for_useQuery/FakeQuery.ts +25 -0
- package/queries/for_useQuery/when_creating_instance.ts +63 -0
- package/queries/for_useQuery/when_creating_instance_with_sorting.ts +55 -0
- package/queries/for_useQuery/when_creating_instance_without_optional_context_values.ts +59 -0
- package/queries/for_useQueryWithPaging/when_creating_instance_with_paging.ts +67 -0
- package/queries/index.ts +8 -0
- package/queries/useObservableQuery.ts +83 -0
- package/queries/useQuery.ts +113 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogButtons.d.ts","sourceRoot":"","sources":["../../../dialogs/DialogButtons.ts"],"names":[],"mappings":"AAMA,oBAAY,aAAa;IAKrB,EAAE,IAAI;IAKN,QAAQ,IAAI;IAKZ,KAAK,IAAI;IAKT,WAAW,IAAI;CAClB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var DialogButtons;
|
|
2
|
+
(function (DialogButtons) {
|
|
3
|
+
DialogButtons[DialogButtons["Ok"] = 1] = "Ok";
|
|
4
|
+
DialogButtons[DialogButtons["OkCancel"] = 2] = "OkCancel";
|
|
5
|
+
DialogButtons[DialogButtons["YesNo"] = 3] = "YesNo";
|
|
6
|
+
DialogButtons[DialogButtons["YesNoCancel"] = 4] = "YesNoCancel";
|
|
7
|
+
})(DialogButtons || (DialogButtons = {}));
|
|
8
|
+
|
|
9
|
+
export { DialogButtons };
|
|
10
|
+
//# sourceMappingURL=DialogButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogButtons.js","sources":["../../../dialogs/DialogButtons.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * Defines the buttons that can be shown on a standard dialog.\n */\nexport enum DialogButtons {\n\n /**\n * Show an OK button.\n */\n Ok = 1,\n\n /**\n * Show OK and Cancel buttons.\n */\n OkCancel = 2,\n\n /**\n * Show Yes and No buttons.\n */\n YesNo = 3,\n\n /**\n * Show Yes, No and Cancel buttons.\n */\n YesNoCancel = 4\n}\n"],"names":[],"mappings":"IAMY;AAAZ,CAAA,UAAY,aAAa,EAAA;AAKrB,IAAA,aAAA,CAAA,aAAA,CAAA,IAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAM;AAKN,IAAA,aAAA,CAAA,aAAA,CAAA,UAAA,CAAA,GAAA,CAAA,CAAA,GAAA,UAAY;AAKZ,IAAA,aAAA,CAAA,aAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAS;AAKT,IAAA,aAAA,CAAA,aAAA,CAAA,aAAA,CAAA,GAAA,CAAA,CAAA,GAAA,aAAe;AACnB,CAAC,EArBW,aAAa,KAAb,aAAa,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ShowDialog } from './ShowDialog';
|
|
3
|
+
import { ConfirmationDialogRequest } from './ConfirmationDialogRequest';
|
|
4
|
+
import { BusyIndicatorDialogRequest } from './BusyIndicatorDialogRequest';
|
|
5
|
+
import { CloseDialog } from './CloseDialog';
|
|
6
|
+
export interface IDialogComponents {
|
|
7
|
+
confirmation?: React.FC<ConfirmationDialogRequest>;
|
|
8
|
+
showConfirmation: ShowDialog<ConfirmationDialogRequest>;
|
|
9
|
+
busyIndicator?: React.FC<BusyIndicatorDialogRequest>;
|
|
10
|
+
showBusyIndicator: ShowDialog<BusyIndicatorDialogRequest>;
|
|
11
|
+
closeBusyIndicator: CloseDialog<object>;
|
|
12
|
+
}
|
|
13
|
+
export declare const DialogComponentsContext: React.Context<IDialogComponents>;
|
|
14
|
+
export interface DialogComponentsProps {
|
|
15
|
+
children?: JSX.Element | JSX.Element[];
|
|
16
|
+
confirmation?: React.FC<ConfirmationDialogRequest>;
|
|
17
|
+
busyIndicator?: React.FC<BusyIndicatorDialogRequest>;
|
|
18
|
+
}
|
|
19
|
+
export declare const DialogComponents: (props: DialogComponentsProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=DialogComponents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogComponents.d.ts","sourceRoot":"","sources":["../../../dialogs/DialogComponents.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,MAAM,WAAW,iBAAiB;IAK9B,YAAY,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAC;IAKnD,gBAAgB,EAAE,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAKxD,aAAa,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAC;IAKrD,iBAAiB,EAAE,UAAU,CAAC,0BAA0B,CAAC,CAAC;IAK1D,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAKD,eAAO,MAAM,uBAAuB,kCAKlC,CAAC;AAKH,MAAM,WAAW,qBAAqB;IAIlC,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAMvC,YAAY,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,CAAC;IAMnD,aAAa,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAC;CACxD;AAiCD,eAAO,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,4CAM5D,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { DialogResult } from './DialogResult.js';
|
|
4
|
+
import { useDialog } from './useDialog.js';
|
|
5
|
+
import { DialogButtons } from './DialogButtons.js';
|
|
6
|
+
|
|
7
|
+
const DialogComponentsContext = React__default.createContext({
|
|
8
|
+
showConfirmation: () => Promise.resolve([DialogResult.Cancelled, {}]),
|
|
9
|
+
showBusyIndicator: () => Promise.resolve([DialogResult.Cancelled, {}]),
|
|
10
|
+
closeBusyIndicator: () => { }
|
|
11
|
+
});
|
|
12
|
+
const DialogComponentsWrapper = (props) => {
|
|
13
|
+
const [Confirmation, showConfirmation] = useDialog(props.confirmation ?? React__default.Fragment);
|
|
14
|
+
const [BusyIndicator, showBusyIndicator, closeBusyIndicatorDialogContext] = useDialog(props.busyIndicator ?? React__default.Fragment);
|
|
15
|
+
const configuration = {
|
|
16
|
+
confirmation: Confirmation,
|
|
17
|
+
showConfirmation,
|
|
18
|
+
busyIndicator: BusyIndicator,
|
|
19
|
+
showBusyIndicator,
|
|
20
|
+
closeBusyIndicator: closeBusyIndicatorDialogContext.closeDialog
|
|
21
|
+
};
|
|
22
|
+
return (jsx(DialogComponentsContext.Provider, { value: configuration, children: jsxs(Fragment, { children: [props.children, props.confirmation &&
|
|
23
|
+
jsx(Confirmation, { title: '', message: '', buttons: DialogButtons.Ok }), props.busyIndicator &&
|
|
24
|
+
jsx(BusyIndicator, { title: '', message: '' })] }) }));
|
|
25
|
+
};
|
|
26
|
+
const DialogComponents = (props) => {
|
|
27
|
+
return (jsx(DialogComponentsWrapper, { ...props, children: props.children }));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { DialogComponents, DialogComponentsContext };
|
|
31
|
+
//# sourceMappingURL=DialogComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogComponents.js","sources":["../../../dialogs/DialogComponents.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport React from 'react';\nimport { DialogResult } from './DialogResult';\nimport { ShowDialog } from './ShowDialog';\nimport { useDialog } from './useDialog';\nimport { ConfirmationDialogRequest } from './ConfirmationDialogRequest';\nimport { BusyIndicatorDialogRequest } from './BusyIndicatorDialogRequest';\nimport { DialogButtons } from './DialogButtons';\nimport { CloseDialog } from './CloseDialog';\n\n/**\n * Defines the interface representing the context of dialog components.\n */\nexport interface IDialogComponents {\n\n /**\n * The confirmation dialog component.\n */\n confirmation?: React.FC<ConfirmationDialogRequest>;\n\n /**\n * Shows a confirmation dialog with the specified request.\n */\n showConfirmation: ShowDialog<ConfirmationDialogRequest>;\n\n /**\n * The busy indicator dialog component, typically used for spinners.\n */\n busyIndicator?: React.FC<BusyIndicatorDialogRequest>;\n\n /**\n * Shows a busy indicator dialog with the specified request.\n */\n showBusyIndicator: ShowDialog<BusyIndicatorDialogRequest>;\n\n /**\n * Closes the busy indicator dialog.\n */\n closeBusyIndicator: CloseDialog<object>;\n}\n\n/**\n * The context for dialog components.\n */\nexport const DialogComponentsContext = React.createContext<IDialogComponents>({\n showConfirmation: () => Promise.resolve([DialogResult.Cancelled, {}]),\n showBusyIndicator: () => Promise.resolve([DialogResult.Cancelled, {}]),\n /* eslint-disable-next-line @typescript-eslint/no-empty-function */\n closeBusyIndicator: () => { }\n});\n\n/**\n * Props for the DialogComponentsWrapper component.\n */\nexport interface DialogComponentsProps {\n /**\n * Optional children elements to render within the dialog components context.\n */\n children?: JSX.Element | JSX.Element[];\n\n /**\n * Optional confirmation dialog component to use.\n * If not provided, a default empty fragment will be used.\n */\n confirmation?: React.FC<ConfirmationDialogRequest>;\n\n /**\n * Optional busy indicator dialog component to use.\n * If not provided, a default empty fragment will be used.\n */\n busyIndicator?: React.FC<BusyIndicatorDialogRequest>;\n}\n\nconst DialogComponentsWrapper = (props: DialogComponentsProps) => {\n const [Confirmation, showConfirmation] = useDialog(props.confirmation ?? React.Fragment as React.FC<ConfirmationDialogRequest>);\n const [BusyIndicator, showBusyIndicator, closeBusyIndicatorDialogContext] = useDialog(props.busyIndicator ?? React.Fragment as React.FC<BusyIndicatorDialogRequest>);\n\n const configuration: IDialogComponents = {\n confirmation: Confirmation,\n showConfirmation,\n busyIndicator: BusyIndicator,\n showBusyIndicator,\n closeBusyIndicator: closeBusyIndicatorDialogContext.closeDialog\n };\n\n return (\n <DialogComponentsContext.Provider value={configuration}>\n <>\n {props.children}\n {props.confirmation &&\n <Confirmation title='' message='' buttons={DialogButtons.Ok} />}\n\n {props.busyIndicator &&\n <BusyIndicator title='' message='' />}\n </>\n </DialogComponentsContext.Provider>\n );\n};\n\n/**\n * A React component that provides a context for dialog components.\n * @param props The properties for the dialog components wrapper.\n * @returns A React component that provides the dialog components context.\n */\nexport const DialogComponents = (props: DialogComponentsProps) => {\n return (\n <DialogComponentsWrapper {...props}>\n {props.children}\n </DialogComponentsWrapper>\n );\n};\n"],"names":["React","_jsx","_jsxs"],"mappings":";;;;;;AA8CO,MAAM,uBAAuB,GAAGA,cAAK,CAAC,aAAa,CAAoB;AAC1E,IAAA,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AACrE,IAAA,iBAAiB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAEtE,IAAA,kBAAkB,EAAE,MAAK,EAAG;AAC/B,CAAA;AAwBD,MAAM,uBAAuB,GAAG,CAAC,KAA4B,KAAI;AAC7D,IAAA,MAAM,CAAC,YAAY,EAAE,gBAAgB,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,YAAY,IAAIA,cAAK,CAAC,QAA+C,CAAC;AAC/H,IAAA,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAE,+BAA+B,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,aAAa,IAAIA,cAAK,CAAC,QAAgD,CAAC;AAEpK,IAAA,MAAM,aAAa,GAAsB;AACrC,QAAA,YAAY,EAAE,YAAY;QAC1B,gBAAgB;AAChB,QAAA,aAAa,EAAE,aAAa;QAC5B,iBAAiB;QACjB,kBAAkB,EAAE,+BAA+B,CAAC;KACvD;AAED,IAAA,QACIC,GAAA,CAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,EAAA,QAAA,EAClDC,4BACK,KAAK,CAAC,QAAQ,EACd,KAAK,CAAC,YAAY;AACf,oBAAAD,GAAA,CAAC,YAAY,EAAA,EAAC,KAAK,EAAC,EAAE,EAAC,OAAO,EAAC,EAAE,EAAC,OAAO,EAAE,aAAa,CAAC,EAAE,GAAI,EAElE,KAAK,CAAC,aAAa;AAChB,oBAAAA,GAAA,CAAC,aAAa,EAAA,EAAC,KAAK,EAAC,EAAE,EAAC,OAAO,EAAC,EAAE,EAAA,CAAG,CAAA,EAAA,CAC1C,EAAA,CAC4B;AAE3C,CAAC;AAOM,MAAM,gBAAgB,GAAG,CAAC,KAA4B,KAAI;IAC7D,QACIA,GAAA,CAAC,uBAAuB,EAAA,EAAA,GAAK,KAAK,EAAA,QAAA,EAC7B,KAAK,CAAC,QAAQ,EAAA,CACO;AAElC;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CloseDialog } from './CloseDialog';
|
|
3
|
+
export declare class DialogContextContent<TRequest, TResponse> {
|
|
4
|
+
readonly request: TRequest;
|
|
5
|
+
readonly closeDialog: CloseDialog<TResponse>;
|
|
6
|
+
constructor(request: TRequest, closeDialog: CloseDialog<TResponse>);
|
|
7
|
+
}
|
|
8
|
+
export declare const DialogContext: React.Context<DialogContextContent<object, object>>;
|
|
9
|
+
export declare const useDialogContext: <TRequest = object, TResponse = object>() => DialogContextContent<TRequest, TResponse>;
|
|
10
|
+
//# sourceMappingURL=DialogContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogContext.d.ts","sourceRoot":"","sources":["../../../dialogs/DialogContext.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,qBAAa,oBAAoB,CAAC,QAAQ,EAAE,SAAS;IAOrC,QAAQ,CAAC,OAAO,EAAE,QAAQ;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC;gBAA/D,OAAO,EAAE,QAAQ,EAAW,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC;CAEvF;AAKD,eAAO,MAAM,aAAa,qDAAwE,CAAC;AAMnG,eAAO,MAAM,gBAAgB,GAAI,QAAQ,GAAG,MAAM,EAAE,SAAS,GAAG,MAAM,OAAK,oBAAoB,CAAC,QAAQ,EAAE,SAAS,CAElH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
|
|
4
|
+
class DialogContextContent {
|
|
5
|
+
request;
|
|
6
|
+
closeDialog;
|
|
7
|
+
constructor(request, closeDialog) {
|
|
8
|
+
this.request = request;
|
|
9
|
+
this.closeDialog = closeDialog;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const DialogContext = React.createContext(undefined);
|
|
13
|
+
const useDialogContext = () => {
|
|
14
|
+
return useContext(DialogContext);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { DialogContext, DialogContextContent, useDialogContext };
|
|
18
|
+
//# sourceMappingURL=DialogContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogContext.js","sources":["../../../dialogs/DialogContext.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport { CloseDialog } from './CloseDialog';\n\n/**\n * Represents the content of the dialog context, including the request and a function to close the dialog.\n */\nexport class DialogContextContent<TRequest, TResponse> {\n\n /**\n * Initializes a new instance of {@link DialogContextContent}.\n * @param request The request for the dialog, which contains the data needed to display the dialog. \n * @param closeDialog A function to close the dialog, which takes a result and an optional response.\n */\n constructor(readonly request: TRequest, readonly closeDialog: CloseDialog<TResponse>) {\n }\n}\n\n/**\n * The context for dialog components, providing access to the current dialog request and a method to close the dialog.\n */\nexport const DialogContext = React.createContext<DialogContextContent<object, object>>(undefined!);\n\n/**\n * A custom hook to access the dialog context in your components.\n * @returns The current dialog context, which includes the request and a method to close the dialog.\n */\nexport const useDialogContext = <TRequest = object, TResponse = object>(): DialogContextContent<TRequest, TResponse> => {\n return useContext(DialogContext) as unknown as DialogContextContent<TRequest, TResponse>;\n};\n"],"names":[],"mappings":";;;MAUa,oBAAoB,CAAA;AAOR,IAAA,OAAA;AAA4B,IAAA,WAAA;IAAjD,WAAA,CAAqB,OAAiB,EAAW,WAAmC,EAAA;QAA/D,IAAA,CAAA,OAAO,GAAP,OAAO;QAAqB,IAAA,CAAA,WAAW,GAAX,WAAW;IAC5D;AACH;AAKM,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAuC,SAAU;AAM1F,MAAM,gBAAgB,GAAG,MAAuF;AACnH,IAAA,OAAO,UAAU,CAAC,aAAa,CAAyD;AAC5F;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogProps.d.ts","sourceRoot":"","sources":["../../../dialogs/DialogProps.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,MAAM,WAAW,WAAW,CAAC,SAAS,GAAG,MAAM;IAI3C,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogProps.js","sourceRoot":"","sources":["../../../dialogs/DialogProps.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogResponse.d.ts","sourceRoot":"","sources":["../../../dialogs/DialogResponse.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK9C,MAAM,MAAM,cAAc,CAAC,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogResponse.js","sourceRoot":"","sources":["../../../dialogs/DialogResponse.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogResult.d.ts","sourceRoot":"","sources":["../../../dialogs/DialogResult.ts"],"names":[],"mappings":"AAMA,oBAAY,YAAY;IAIpB,IAAI,IAAI;IAKR,GAAG,IAAI;IAKP,EAAE,IAAI;IAKN,EAAE,IAAI;IAKN,SAAS,IAAI;CAChB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var DialogResult;
|
|
2
|
+
(function (DialogResult) {
|
|
3
|
+
DialogResult[DialogResult["None"] = 0] = "None";
|
|
4
|
+
DialogResult[DialogResult["Yes"] = 1] = "Yes";
|
|
5
|
+
DialogResult[DialogResult["No"] = 2] = "No";
|
|
6
|
+
DialogResult[DialogResult["Ok"] = 3] = "Ok";
|
|
7
|
+
DialogResult[DialogResult["Cancelled"] = 4] = "Cancelled";
|
|
8
|
+
})(DialogResult || (DialogResult = {}));
|
|
9
|
+
|
|
10
|
+
export { DialogResult };
|
|
11
|
+
//# sourceMappingURL=DialogResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogResult.js","sources":["../../../dialogs/DialogResult.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * Defines the possible results from a dialog interaction.\n */\nexport enum DialogResult {\n /**\n * Indicates that no action was taken or the dialog was closed without a specific result.\n */\n None = 0,\n\n /**\n * Indicates that the user confirmed the action, typically by clicking \"Yes\" or \"OK\".\n */\n Yes = 1,\n\n /**\n * Indicates that the user declined the action, typically by clicking \"No\".\n */\n No = 2,\n\n /**\n * Indicates that the user acknowledged the action, typically by clicking \"OK\".\n */\n Ok = 3,\n\n /**\n * Indicates that the dialog was cancelled, typically by clicking \"Cancel\".\n */\n Cancelled = 4\n}\n"],"names":[],"mappings":"IAMY;AAAZ,CAAA,UAAY,YAAY,EAAA;AAIpB,IAAA,YAAA,CAAA,YAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAQ;AAKR,IAAA,YAAA,CAAA,YAAA,CAAA,KAAA,CAAA,GAAA,CAAA,CAAA,GAAA,KAAO;AAKP,IAAA,YAAA,CAAA,YAAA,CAAA,IAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAM;AAKN,IAAA,YAAA,CAAA,YAAA,CAAA,IAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAM;AAKN,IAAA,YAAA,CAAA,YAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAa;AACjB,CAAC,EAzBW,YAAY,KAAZ,YAAY,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShowDialog.d.ts","sourceRoot":"","sources":["../../../dialogs/ShowDialog.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,MAAM,MAAM,UAAU,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShowDialog.js","sourceRoot":"","sources":["../../../dialogs/ShowDialog.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './BusyIndicatorDialogRequest';
|
|
2
|
+
export * from './CloseDialog';
|
|
3
|
+
export * from './ConfirmationDialogRequest';
|
|
4
|
+
export * from './DialogButtons';
|
|
5
|
+
export * from './DialogComponents';
|
|
6
|
+
export * from './DialogContext';
|
|
7
|
+
export * from './DialogProps';
|
|
8
|
+
export * from './DialogResponse';
|
|
9
|
+
export * from './DialogResult';
|
|
10
|
+
export * from './ShowDialog';
|
|
11
|
+
export * from './useBusyIndicator';
|
|
12
|
+
export * from './useConfirmationDialog';
|
|
13
|
+
export * from './useDialog';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../dialogs/index.ts"],"names":[],"mappings":"AAGA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { BusyIndicatorDialogRequest } from './BusyIndicatorDialogRequest.js';
|
|
2
|
+
export { ConfirmationDialogRequest } from './ConfirmationDialogRequest.js';
|
|
3
|
+
export { DialogButtons } from './DialogButtons.js';
|
|
4
|
+
export { DialogComponents, DialogComponentsContext } from './DialogComponents.js';
|
|
5
|
+
export { DialogContext, DialogContextContent, useDialogContext } from './DialogContext.js';
|
|
6
|
+
export { DialogResult } from './DialogResult.js';
|
|
7
|
+
export { useBusyIndicator } from './useBusyIndicator.js';
|
|
8
|
+
export { useConfirmationDialog } from './useConfirmationDialog.js';
|
|
9
|
+
export { useDialog } from './useDialog.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DialogResult } from './DialogResult';
|
|
2
|
+
export type ShowBusyIndicatorDialog = (title?: string, message?: string) => Promise<DialogResult>;
|
|
3
|
+
export type CloseBusyIndicatorDialog = () => void;
|
|
4
|
+
export declare const useBusyIndicator: (title?: string, message?: string) => [ShowBusyIndicatorDialog, CloseBusyIndicatorDialog];
|
|
5
|
+
//# sourceMappingURL=useBusyIndicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBusyIndicator.d.ts","sourceRoot":"","sources":["../../../dialogs/useBusyIndicator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C,MAAM,MAAM,uBAAuB,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAKlG,MAAM,MAAM,wBAAwB,GAAG,MAAM,IAAI,CAAC;AAQlD,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,EAAE,UAAU,MAAM,KAAG,CAAC,uBAAuB,EAAE,wBAAwB,CAarH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { DialogComponentsContext } from './DialogComponents.js';
|
|
3
|
+
import { DialogResult } from './DialogResult.js';
|
|
4
|
+
import { BusyIndicatorDialogRequest } from './BusyIndicatorDialogRequest.js';
|
|
5
|
+
|
|
6
|
+
const useBusyIndicator = (title, message) => {
|
|
7
|
+
const components = useContext(DialogComponentsContext);
|
|
8
|
+
return [
|
|
9
|
+
async (delegateTitle, delegateMessage) => {
|
|
10
|
+
const request = new BusyIndicatorDialogRequest(delegateTitle ?? title ?? '', delegateMessage ?? message ?? '');
|
|
11
|
+
const [result] = await components.showBusyIndicator(request);
|
|
12
|
+
return result;
|
|
13
|
+
},
|
|
14
|
+
() => components.closeBusyIndicator?.(DialogResult.Cancelled)
|
|
15
|
+
];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useBusyIndicator };
|
|
19
|
+
//# sourceMappingURL=useBusyIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBusyIndicator.js","sources":["../../../dialogs/useBusyIndicator.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useContext } from 'react';\nimport { DialogComponentsContext, IDialogComponents } from './DialogComponents';\nimport { DialogResult } from './DialogResult';\nimport { BusyIndicatorDialogRequest } from './BusyIndicatorDialogRequest';\n\n/**\n * Represents the signature for showing a confirmation dialog.\n * @param title Optional title of the confirmation dialog.\n * @param message Optional message to display in the confirmation dialog.\n * @return A promise that resolves to a tuple containing the dialog result and any additional data.\n */\nexport type ShowBusyIndicatorDialog = (title?: string, message?: string) => Promise<DialogResult>;\n\n/**\n * Represents the signature for closing a busy indicator dialog.\n */\nexport type CloseBusyIndicatorDialog = () => void;\n\n/**\n * Uses a busy indicator dialog in your application.\n * @param title Optional title of the confirmation dialog.\n * @param message Optional message to display in the confirmation dialog.\n * @returns A tuple containing the a function to show the dialog and one to close the dialog.\n */\nexport const useBusyIndicator = (title?: string, message?: string): [ShowBusyIndicatorDialog, CloseBusyIndicatorDialog] => {\n const components = useContext<IDialogComponents>(DialogComponentsContext);\n\n return [\n async (delegateTitle?: string, delegateMessage?: string) => {\n const request = new BusyIndicatorDialogRequest(\n delegateTitle ?? title ?? '',\n delegateMessage ?? message ?? '');\n const [result] = await components.showBusyIndicator(request);\n return result;\n },\n () => components.closeBusyIndicator?.(DialogResult.Cancelled)\n ];\n};"],"names":[],"mappings":";;;;;MA2Ba,gBAAgB,GAAG,CAAC,KAAc,EAAE,OAAgB,KAAyD;AACtH,IAAA,MAAM,UAAU,GAAG,UAAU,CAAoB,uBAAuB,CAAC;IAEzE,OAAO;AACH,QAAA,OAAO,aAAsB,EAAE,eAAwB,KAAI;AACvD,YAAA,MAAM,OAAO,GAAG,IAAI,0BAA0B,CAC1C,aAAa,IAAI,KAAK,IAAI,EAAE,EAC5B,eAAe,IAAI,OAAO,IAAI,EAAE,CAAC;YACrC,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAAC,OAAO,CAAC;AAC5D,YAAA,OAAO,MAAM;QACjB,CAAC;QACD,MAAM,UAAU,CAAC,kBAAkB,GAAG,YAAY,CAAC,SAAS;KAC/D;AACL;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DialogButtons } from './DialogButtons';
|
|
2
|
+
import { DialogResult } from './DialogResult';
|
|
3
|
+
export type ShowConfirmationDialog = (title?: string, message?: string, buttons?: DialogButtons) => Promise<DialogResult>;
|
|
4
|
+
export declare const useConfirmationDialog: (title?: string, message?: string, buttons?: DialogButtons) => [ShowConfirmationDialog];
|
|
5
|
+
//# sourceMappingURL=useConfirmationDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfirmationDialog.d.ts","sourceRoot":"","sources":["../../../dialogs/useConfirmationDialog.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAS1H,eAAO,MAAM,qBAAqB,GAAI,QAAQ,MAAM,EAAE,UAAU,MAAM,EAAE,UAAU,aAAa,KAAG,CAAC,sBAAsB,CAaxH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { DialogButtons } from './DialogButtons.js';
|
|
3
|
+
import { DialogComponentsContext } from './DialogComponents.js';
|
|
4
|
+
import { ConfirmationDialogRequest } from './ConfirmationDialogRequest.js';
|
|
5
|
+
|
|
6
|
+
const useConfirmationDialog = (title, message, buttons) => {
|
|
7
|
+
const components = useContext(DialogComponentsContext);
|
|
8
|
+
return [
|
|
9
|
+
async (delegateTitle, delegateMessage, delegateButtons) => {
|
|
10
|
+
const request = new ConfirmationDialogRequest(delegateTitle ?? title ?? '', delegateMessage ?? message ?? '', delegateButtons ?? buttons ?? DialogButtons.Ok);
|
|
11
|
+
const [result] = await components.showConfirmation(request);
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { useConfirmationDialog };
|
|
18
|
+
//# sourceMappingURL=useConfirmationDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfirmationDialog.js","sources":["../../../dialogs/useConfirmationDialog.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useContext } from 'react';\nimport { DialogButtons } from './DialogButtons';\nimport { DialogComponentsContext, IDialogComponents } from './DialogComponents';\nimport { ConfirmationDialogRequest } from './ConfirmationDialogRequest';\nimport { DialogResult } from './DialogResult';\n\n/**\n * Represents the signature for showing a confirmation dialog.\n * @param title Optional title of the confirmation dialog.\n * @param message Optional message to display in the confirmation dialog.\n * @param buttons Optional buttons to display in the confirmation dialog. If not provided, defaults to `DialogButtons.Ok`. \n * @return A promise that resolves to a tuple containing the dialog result and any additional data.\n */\nexport type ShowConfirmationDialog = (title?: string, message?: string, buttons?: DialogButtons) => Promise<DialogResult>;\n\n/**\n * Uses a confirmation dialog in your application.\n * @param title Optional title of the confirmation dialog.\n * @param message Optional message to display in the confirmation dialog.\n * @param buttons Optional buttons to display in the confirmation dialog. If not provided, defaults to `DialogButtons.Ok`. \n * @returns A tuple containing function to show the dialog.\n */\nexport const useConfirmationDialog = (title?: string, message?: string, buttons?: DialogButtons): [ShowConfirmationDialog] => {\n const components = useContext<IDialogComponents>(DialogComponentsContext);\n\n return [\n async (delegateTitle?: string, delegateMessage?: string, delegateButtons?: DialogButtons) => {\n const request = new ConfirmationDialogRequest(\n delegateTitle ?? title ?? '',\n delegateMessage ?? message ?? '',\n delegateButtons ?? buttons ?? DialogButtons.Ok);\n const [result] = await components.showConfirmation(request);\n return result;\n }\n ];\n};"],"names":[],"mappings":";;;;;AAyBO,MAAM,qBAAqB,GAAG,CAAC,KAAc,EAAE,OAAgB,EAAE,OAAuB,KAA8B;AACzH,IAAA,MAAM,UAAU,GAAG,UAAU,CAAoB,uBAAuB,CAAC;IAEzE,OAAO;AACH,QAAA,OAAO,aAAsB,EAAE,eAAwB,EAAE,eAA+B,KAAI;YACxF,MAAM,OAAO,GAAG,IAAI,yBAAyB,CACzC,aAAa,IAAI,KAAK,IAAI,EAAE,EAC5B,eAAe,IAAI,OAAO,IAAI,EAAE,EAChC,eAAe,IAAI,OAAO,IAAI,aAAa,CAAC,EAAE,CAAC;YACnD,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC;AAC3D,YAAA,OAAO,MAAM;QACjB;KACH;AACL;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DialogContextContent } from './DialogContext';
|
|
2
|
+
import { ComponentType, FC } from 'react';
|
|
3
|
+
import { ShowDialog } from './ShowDialog';
|
|
4
|
+
export declare function useDialog<TResponse = object, TProps = object>(DialogComponent: ComponentType<TProps>): [FC<TProps>, ShowDialog<TProps, TResponse>, DialogContextContent<TProps, TResponse>];
|
|
5
|
+
//# sourceMappingURL=useDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDialog.d.ts","sourceRoot":"","sources":["../../../dialogs/useDialog.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAGtE,OAAO,EAAiC,aAAa,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,wBAAgB,SAAS,CAAC,SAAS,GAAG,MAAM,EAAE,MAAM,GAAG,MAAM,EACzD,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,GACvC,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,oBAAoB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAqCtF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { DialogContextContent, DialogContext } from './DialogContext.js';
|
|
3
|
+
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
function useDialog(DialogComponent) {
|
|
6
|
+
const [visible, setVisible] = useState(false);
|
|
7
|
+
const [dialogProps, setDialogProps] = useState();
|
|
8
|
+
const resolverRef = useRef(undefined);
|
|
9
|
+
const showDialog = useCallback((p) => {
|
|
10
|
+
setDialogProps(p);
|
|
11
|
+
setVisible(true);
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
resolverRef.current = resolve;
|
|
14
|
+
});
|
|
15
|
+
}, []);
|
|
16
|
+
const closeDialog = useCallback((result, value) => {
|
|
17
|
+
setVisible(false);
|
|
18
|
+
resolverRef.current?.([result, value]);
|
|
19
|
+
resolverRef.current = undefined;
|
|
20
|
+
}, []);
|
|
21
|
+
const dialogContextValue = useRef(undefined);
|
|
22
|
+
dialogContextValue.current = useMemo(() => {
|
|
23
|
+
return new DialogContextContent(dialogProps, closeDialog);
|
|
24
|
+
}, [dialogProps, closeDialog]);
|
|
25
|
+
const DialogWrapper = (extraProps) => {
|
|
26
|
+
return visible ? (jsx(DialogContext.Provider, { value: dialogContextValue.current, children: jsx(DialogComponent, { ...extraProps, ...dialogProps, closeDialog: closeDialog }) })) : null;
|
|
27
|
+
};
|
|
28
|
+
return [DialogWrapper, showDialog, dialogContextValue.current];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { useDialog };
|
|
32
|
+
//# sourceMappingURL=useDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDialog.js","sources":["../../../dialogs/useDialog.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DialogContext, DialogContextContent } from './DialogContext';\nimport { DialogResponse } from './DialogResponse';\nimport { DialogResult } from './DialogResult';\nimport { useCallback, useRef, useState, ComponentType, FC, useMemo } from 'react';\nimport { ShowDialog } from './ShowDialog';\n\n/**\n * Use a dialog component in you application. This hook manages the visibility and properties of the dialog.\n * @param DialogComponent The dialog component to use.\n * @returns A tuple containing the wrapped dialog component and a function to show the dialog. \n * The wrapped dialog component will receive the properties passed to it, excluding the `closeDialog` property.\n */\nexport function useDialog<TResponse = object, TProps = object>(\n DialogComponent: ComponentType<TProps>\n): [FC<TProps>, ShowDialog<TProps, TResponse>, DialogContextContent<TProps, TResponse>] {\n\n const [visible, setVisible] = useState(false);\n const [dialogProps, setDialogProps] = useState<TProps | undefined>();\n const resolverRef = useRef<((value: DialogResponse<TResponse>) => void) | undefined>(undefined);\n\n const showDialog = useCallback((p?: TProps) => {\n setDialogProps(p);\n setVisible(true);\n return new Promise<DialogResponse<TResponse>>((resolve) => {\n resolverRef.current = resolve;\n });\n }, []);\n\n const closeDialog = useCallback((result: DialogResult, value?: TResponse) => {\n setVisible(false);\n resolverRef.current?.([result, value]);\n resolverRef.current = undefined;\n }, []);\n\n const dialogContextValue = useRef<DialogContextContent<TProps, TResponse>>(undefined!);\n dialogContextValue.current = useMemo(() => {\n return new DialogContextContent(dialogProps!, closeDialog);\n }, [dialogProps, closeDialog]);\n\n const DialogWrapper: FC<TProps> = (extraProps) => {\n return visible ? (\n <DialogContext.Provider value={dialogContextValue.current as unknown as DialogContextContent<object, object>}>\n <DialogComponent\n {...extraProps}\n {...(dialogProps as TProps)}\n closeDialog={closeDialog} />\n </DialogContext.Provider>\n ) : null;\n };\n\n return [DialogWrapper, showDialog, dialogContextValue.current];\n}\n"],"names":["_jsx"],"mappings":";;;;AAeM,SAAU,SAAS,CACrB,eAAsC,EAAA;IAGtC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IAC7C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,EAAsB;AACpE,IAAA,MAAM,WAAW,GAAG,MAAM,CAA2D,SAAS,CAAC;AAE/F,IAAA,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAU,KAAI;QAC1C,cAAc,CAAC,CAAC,CAAC;QACjB,UAAU,CAAC,IAAI,CAAC;AAChB,QAAA,OAAO,IAAI,OAAO,CAA4B,CAAC,OAAO,KAAI;AACtD,YAAA,WAAW,CAAC,OAAO,GAAG,OAAO;AACjC,QAAA,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC;IAEN,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,MAAoB,EAAE,KAAiB,KAAI;QACxE,UAAU,CAAC,KAAK,CAAC;QACjB,WAAW,CAAC,OAAO,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACtC,QAAA,WAAW,CAAC,OAAO,GAAG,SAAS;IACnC,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,MAAM,kBAAkB,GAAG,MAAM,CAA0C,SAAU,CAAC;AACtF,IAAA,kBAAkB,CAAC,OAAO,GAAG,OAAO,CAAC,MAAK;AACtC,QAAA,OAAO,IAAI,oBAAoB,CAAC,WAAY,EAAE,WAAW,CAAC;AAC9D,IAAA,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAE9B,IAAA,MAAM,aAAa,GAAe,CAAC,UAAU,KAAI;AAC7C,QAAA,OAAO,OAAO,IACVA,GAAA,CAAC,aAAa,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,kBAAkB,CAAC,OAA0D,EAAA,QAAA,EACxGA,GAAA,CAAC,eAAe,EAAA,EAAA,GACR,UAAU,EAAA,GACT,WAAsB,EAC3B,WAAW,EAAE,WAAW,EAAA,CAAI,GACX,IACzB,IAAI;AACZ,IAAA,CAAC;IAED,OAAO,CAAC,aAAa,EAAE,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC;AAClE;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IIdentity } from '@cratis/arc/identity';
|
|
3
|
+
import { GetHttpHeaders } from '@cratis/arc';
|
|
4
|
+
export declare const IdentityProviderContext: React.Context<IIdentity<object>>;
|
|
5
|
+
export interface IdentityProviderProps {
|
|
6
|
+
children?: JSX.Element | JSX.Element[];
|
|
7
|
+
httpHeadersCallback?: GetHttpHeaders;
|
|
8
|
+
}
|
|
9
|
+
export declare const IdentityProvider: (props: IdentityProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=IdentityProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdentityProvider.d.ts","sourceRoot":"","sources":["../../../identity/IdentityProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAc7C,eAAO,MAAM,uBAAuB,kCAAyD,CAAC;AAE9F,MAAM,WAAW,qBAAqB;IAClC,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IACvC,mBAAmB,CAAC,EAAE,cAAc,CAAA;CACvC;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,4CAgC5D,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { useState, useEffect } from 'react';
|
|
3
|
+
import { IdentityProvider as IdentityProvider$1 } from '@cratis/arc/identity';
|
|
4
|
+
|
|
5
|
+
const defaultIdentityContext = {
|
|
6
|
+
id: '',
|
|
7
|
+
name: '',
|
|
8
|
+
details: {},
|
|
9
|
+
isSet: false,
|
|
10
|
+
refresh: () => {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
reject('Not implemented');
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const IdentityProviderContext = React__default.createContext(defaultIdentityContext);
|
|
17
|
+
const IdentityProvider = (props) => {
|
|
18
|
+
const [context, setContext] = useState(defaultIdentityContext);
|
|
19
|
+
const wrapRefresh = (identity) => {
|
|
20
|
+
const originalRefresh = identity.refresh.bind(identity);
|
|
21
|
+
return {
|
|
22
|
+
...identity,
|
|
23
|
+
refresh: () => {
|
|
24
|
+
return new Promise(resolve => {
|
|
25
|
+
originalRefresh().then(newIdentity => {
|
|
26
|
+
const wrappedIdentity = wrapRefresh(newIdentity);
|
|
27
|
+
setContext(wrappedIdentity);
|
|
28
|
+
resolve(wrappedIdentity);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
IdentityProvider$1.setHttpHeadersCallback(props.httpHeadersCallback);
|
|
36
|
+
IdentityProvider$1.getCurrent().then(identity => {
|
|
37
|
+
const wrappedIdentity = wrapRefresh(identity);
|
|
38
|
+
setContext(wrappedIdentity);
|
|
39
|
+
});
|
|
40
|
+
}, []);
|
|
41
|
+
return (jsx(IdentityProviderContext.Provider, { value: context, children: props.children }));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { IdentityProvider, IdentityProviderContext };
|
|
45
|
+
//# sourceMappingURL=IdentityProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdentityProvider.js","sources":["../../../identity/IdentityProvider.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport React from 'react';\nimport { useState, useEffect } from 'react';\nimport { IIdentity } from '@cratis/arc/identity';\nimport { IdentityProvider as RootIdentityProvider } from '@cratis/arc/identity';\nimport { GetHttpHeaders } from '@cratis/arc';\n\nconst defaultIdentityContext: IIdentity = {\n id: '',\n name: '',\n details: {},\n isSet: false,\n refresh: () => {\n return new Promise((resolve, reject) => {\n reject('Not implemented');\n });\n }\n};\n\nexport const IdentityProviderContext = React.createContext<IIdentity>(defaultIdentityContext);\n\nexport interface IdentityProviderProps {\n children?: JSX.Element | JSX.Element[],\n httpHeadersCallback?: GetHttpHeaders\n}\n\nexport const IdentityProvider = (props: IdentityProviderProps) => {\n const [context, setContext] = useState<IIdentity>(defaultIdentityContext);\n\n const wrapRefresh = (identity: IIdentity): IIdentity => {\n const originalRefresh = identity.refresh.bind(identity);\n return {\n ...identity,\n refresh: () => {\n return new Promise<IIdentity>(resolve => {\n originalRefresh().then(newIdentity => {\n const wrappedIdentity = wrapRefresh(newIdentity);\n setContext(wrappedIdentity);\n resolve(wrappedIdentity);\n });\n });\n }\n };\n };\n\n useEffect(() => {\n RootIdentityProvider.setHttpHeadersCallback(props.httpHeadersCallback!);\n RootIdentityProvider.getCurrent().then(identity => {\n const wrappedIdentity = wrapRefresh(identity);\n setContext(wrappedIdentity);\n });\n }, []);\n\n return (\n <IdentityProviderContext.Provider value={context}>\n {props.children}\n </IdentityProviderContext.Provider>\n );\n};\n"],"names":["React","RootIdentityProvider","_jsx"],"mappings":";;;;AASA,MAAM,sBAAsB,GAAc;AACtC,IAAA,EAAE,EAAE,EAAE;AACN,IAAA,IAAI,EAAE,EAAE;AACR,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,MAAK;QACV,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;YACnC,MAAM,CAAC,iBAAiB,CAAC;AAC7B,QAAA,CAAC,CAAC;IACN;CACH;AAEM,MAAM,uBAAuB,GAAGA,cAAK,CAAC,aAAa,CAAY,sBAAsB;AAOrF,MAAM,gBAAgB,GAAG,CAAC,KAA4B,KAAI;IAC7D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAY,sBAAsB,CAAC;AAEzE,IAAA,MAAM,WAAW,GAAG,CAAC,QAAmB,KAAe;QACnD,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;QACvD,OAAO;AACH,YAAA,GAAG,QAAQ;YACX,OAAO,EAAE,MAAK;AACV,gBAAA,OAAO,IAAI,OAAO,CAAY,OAAO,IAAG;AACpC,oBAAA,eAAe,EAAE,CAAC,IAAI,CAAC,WAAW,IAAG;AACjC,wBAAA,MAAM,eAAe,GAAG,WAAW,CAAC,WAAW,CAAC;wBAChD,UAAU,CAAC,eAAe,CAAC;wBAC3B,OAAO,CAAC,eAAe,CAAC;AAC5B,oBAAA,CAAC,CAAC;AACN,gBAAA,CAAC,CAAC;YACN;SACH;AACL,IAAA,CAAC;IAED,SAAS,CAAC,MAAK;AACX,QAAAC,kBAAoB,CAAC,sBAAsB,CAAC,KAAK,CAAC,mBAAoB,CAAC;QACvEA,kBAAoB,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAG;AAC9C,YAAA,MAAM,eAAe,GAAG,WAAW,CAAC,QAAQ,CAAC;YAC7C,UAAU,CAAC,eAAe,CAAC;AAC/B,QAAA,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,QACIC,GAAA,CAAC,uBAAuB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,OAAO,YAC3C,KAAK,CAAC,QAAQ,EAAA,CACgB;AAE3C;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../identity/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIdentity.d.ts","sourceRoot":"","sources":["../../../identity/useIdentity.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAOjD,wBAAgB,WAAW,CAAC,QAAQ,GAAG,MAAM,EAAE,cAAc,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAMhH"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { IdentityProviderContext } from './IdentityProvider.js';
|
|
3
|
+
|
|
4
|
+
function useIdentity(defaultDetails) {
|
|
5
|
+
const context = React__default.useContext(IdentityProviderContext);
|
|
6
|
+
if (context.isSet === false && defaultDetails !== undefined) {
|
|
7
|
+
context.details = defaultDetails;
|
|
8
|
+
}
|
|
9
|
+
return context;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { useIdentity };
|
|
13
|
+
//# sourceMappingURL=useIdentity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIdentity.js","sources":["../../../identity/useIdentity.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport React from 'react';\nimport { IdentityProviderContext } from './IdentityProvider';\nimport { IIdentity } from '@cratis/arc/identity';\n\n/**\n * Hook to get the identity context.\n * @param defaultDetails Optional default details to use if the context is not set.\n * @returns An identity context.\n */\nexport function useIdentity<TDetails = object>(defaultDetails?: TDetails | undefined | null): IIdentity<TDetails> {\n const context = React.useContext(IdentityProviderContext) as IIdentity<TDetails>;\n if (context.isSet === false && defaultDetails !== undefined) {\n context.details = defaultDetails!;\n }\n return context;\n}\n"],"names":["React"],"mappings":";;;AAYM,SAAU,WAAW,CAAoB,cAA4C,EAAA;IACvF,MAAM,OAAO,GAAGA,cAAK,CAAC,UAAU,CAAC,uBAAuB,CAAwB;IAChF,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,cAAc,KAAK,SAAS,EAAE;AACzD,QAAA,OAAO,CAAC,OAAO,GAAG,cAAe;IACrC;AACA,IAAA,OAAO,OAAO;AAClB;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as commands from './commands';
|
|
2
|
+
import * as dialogs from './dialogs';
|
|
3
|
+
import * as identity from './identity';
|
|
4
|
+
import * as queries from './queries';
|
|
5
|
+
export * from './Arc';
|
|
6
|
+
export * from './ArcContext';
|
|
7
|
+
export * from './WellKnownBindings';
|
|
8
|
+
export { commands, dialogs, identity, queries };
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AAEpC,OAAO,EACH,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,OAAO,EACV,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as index from './commands/index.js';
|
|
2
|
+
export { index as commands };
|
|
3
|
+
import * as index$1 from './dialogs/index.js';
|
|
4
|
+
export { index$1 as dialogs };
|
|
5
|
+
import * as index$2 from './identity/index.js';
|
|
6
|
+
export { index$2 as identity };
|
|
7
|
+
import * as index$3 from './queries/index.js';
|
|
8
|
+
export { index$3 as queries };
|
|
9
|
+
export { Arc } from './Arc.js';
|
|
10
|
+
export { ArcContext } from './ArcContext.js';
|
|
11
|
+
export { WellKnownBindings } from './WellKnownBindings.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetPage.d.ts","sourceRoot":"","sources":["../../../queries/SetPage.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetPage.js","sourceRoot":"","sources":["../../../queries/SetPage.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetPageSize.d.ts","sourceRoot":"","sources":["../../../queries/SetPageSize.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetPageSize.js","sourceRoot":"","sources":["../../../queries/SetPageSize.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetSorting.d.ts","sourceRoot":"","sources":["../../../queries/SetSorting.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAK9C,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetSorting.js","sourceRoot":"","sources":["../../../queries/SetSorting.ts"],"names":[],"mappings":""}
|