@cratis/scene.blueprint.components 0.1.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/.storybook/main.ts +61 -0
- package/.storybook/preview.tsx +42 -0
- package/BorrowedComponentName.ts +22 -0
- package/ComponentName.ts +27 -0
- package/CompositeName.ts +97 -0
- package/README.md +40 -0
- package/componentsBlueprint.ts +72 -0
- package/componentsBlueprintComponents.ts +23 -0
- package/dist/cjs/BorrowedComponentName.js +25 -0
- package/dist/cjs/BorrowedComponentName.js.map +1 -0
- package/dist/cjs/ComponentName.js +30 -0
- package/dist/cjs/ComponentName.js.map +1 -0
- package/dist/cjs/CompositeName.js +52 -0
- package/dist/cjs/CompositeName.js.map +1 -0
- package/dist/cjs/componentsBlueprint.js +93 -0
- package/dist/cjs/componentsBlueprint.js.map +1 -0
- package/dist/cjs/componentsBlueprintComponents.js +27 -0
- package/dist/cjs/componentsBlueprintComponents.js.map +1 -0
- package/dist/cjs/gallery/DialogTemplatePreview.js +46 -0
- package/dist/cjs/gallery/DialogTemplatePreview.js.map +1 -0
- package/dist/cjs/gallery/GalleryScreenPreview.js +65 -0
- package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -0
- package/dist/cjs/gallery/applicationChrome.js +137 -0
- package/dist/cjs/gallery/applicationChrome.js.map +1 -0
- package/dist/cjs/gallery/navigation.js +128 -0
- package/dist/cjs/gallery/navigation.js.map +1 -0
- package/dist/cjs/gallery/previewProfile.js +87 -0
- package/dist/cjs/gallery/previewProfile.js.map +1 -0
- package/dist/cjs/gallery/screens.js +80 -0
- package/dist/cjs/gallery/screens.js.map +1 -0
- package/dist/cjs/header/ArcPageHeader.js +65 -0
- package/dist/cjs/header/ArcPageHeader.js.map +1 -0
- package/dist/cjs/header/deriveArcHeading.js +51 -0
- package/dist/cjs/header/deriveArcHeading.js.map +1 -0
- package/dist/cjs/header/humanizeBindingName.js +36 -0
- package/dist/cjs/header/humanizeBindingName.js.map +1 -0
- package/dist/cjs/index.js +119 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/packageName.js +15 -0
- package/dist/cjs/packageName.js.map +1 -0
- package/dist/cjs/templates/SampleBindingName.js +39 -0
- package/dist/cjs/templates/SampleBindingName.js.map +1 -0
- package/dist/cjs/templates/commandTemplates.js +82 -0
- package/dist/cjs/templates/commandTemplates.js.map +1 -0
- package/dist/cjs/templates/dataElements.js +131 -0
- package/dist/cjs/templates/dataElements.js.map +1 -0
- package/dist/cjs/templates/dialogElements.js +69 -0
- package/dist/cjs/templates/dialogElements.js.map +1 -0
- package/dist/cjs/templates/dialogTemplates.js +118 -0
- package/dist/cjs/templates/dialogTemplates.js.map +1 -0
- package/dist/cjs/templates/editorElements.js +81 -0
- package/dist/cjs/templates/editorElements.js.map +1 -0
- package/dist/cjs/templates/editorTemplates.js +172 -0
- package/dist/cjs/templates/editorTemplates.js.map +1 -0
- package/dist/cjs/templates/elements.js +101 -0
- package/dist/cjs/templates/elements.js.map +1 -0
- package/dist/cjs/templates/formElements.js +77 -0
- package/dist/cjs/templates/formElements.js.map +1 -0
- package/dist/cjs/templates/listTemplates.js +187 -0
- package/dist/cjs/templates/listTemplates.js.map +1 -0
- package/dist/cjs/templates/nesting.js +150 -0
- package/dist/cjs/templates/nesting.js.map +1 -0
- package/dist/cjs/templates/sampleData.js +141 -0
- package/dist/cjs/templates/sampleData.js.map +1 -0
- package/dist/cjs/templates/screenTemplates.js +41 -0
- package/dist/cjs/templates/screenTemplates.js.map +1 -0
- package/dist/cjs/templates/workspaceTemplates.js +212 -0
- package/dist/cjs/templates/workspaceTemplates.js.map +1 -0
- package/dist/esm/BorrowedComponentName.d.ts +4 -0
- package/dist/esm/BorrowedComponentName.d.ts.map +1 -0
- package/dist/esm/BorrowedComponentName.js +23 -0
- package/dist/esm/BorrowedComponentName.js.map +1 -0
- package/dist/esm/ComponentName.d.ts +4 -0
- package/dist/esm/ComponentName.d.ts.map +1 -0
- package/dist/esm/ComponentName.js +28 -0
- package/dist/esm/ComponentName.js.map +1 -0
- package/dist/esm/CompositeName.d.ts +28 -0
- package/dist/esm/CompositeName.d.ts.map +1 -0
- package/dist/esm/CompositeName.js +50 -0
- package/dist/esm/CompositeName.js.map +1 -0
- package/dist/esm/componentsBlueprint.d.ts +5 -0
- package/dist/esm/componentsBlueprint.d.ts.map +1 -0
- package/dist/esm/componentsBlueprint.js +90 -0
- package/dist/esm/componentsBlueprint.js.map +1 -0
- package/dist/esm/componentsBlueprintComponents.d.ts +3 -0
- package/dist/esm/componentsBlueprintComponents.d.ts.map +1 -0
- package/dist/esm/componentsBlueprintComponents.js +25 -0
- package/dist/esm/componentsBlueprintComponents.js.map +1 -0
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.d.ts +2 -0
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.d.ts.map +1 -0
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.js +57 -0
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.js.map +1 -0
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.d.ts +2 -0
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.d.ts.map +1 -0
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.js +26 -0
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.js.map +1 -0
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.d.ts +2 -0
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.d.ts.map +1 -0
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.js +65 -0
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.js.map +1 -0
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.d.ts +2 -0
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.d.ts.map +1 -0
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.js +41 -0
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.js.map +1 -0
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts +2 -0
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts.map +1 -0
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.js +38 -0
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.js.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts +2 -0
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js +47 -0
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.d.ts +2 -0
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.d.ts.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.js +56 -0
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.js.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.d.ts +2 -0
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.d.ts.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.js +31 -0
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.js.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.d.ts +2 -0
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.d.ts.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.js +54 -0
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.js.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.d.ts +2 -0
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.d.ts.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.js +27 -0
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.js.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.d.ts +2 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.d.ts.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.js +18 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.js.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.d.ts +2 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.d.ts.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.js +26 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.js.map +1 -0
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.d.ts +2 -0
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.d.ts.map +1 -0
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.js +25 -0
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.js.map +1 -0
- package/dist/esm/gallery/ArcPages.stories.d.ts +30 -0
- package/dist/esm/gallery/ArcPages.stories.d.ts.map +1 -0
- package/dist/esm/gallery/ArcPages.stories.js +34 -0
- package/dist/esm/gallery/ArcPages.stories.js.map +1 -0
- package/dist/esm/gallery/Bindings.stories.d.ts +22 -0
- package/dist/esm/gallery/Bindings.stories.d.ts.map +1 -0
- package/dist/esm/gallery/Bindings.stories.js +78 -0
- package/dist/esm/gallery/Bindings.stories.js.map +1 -0
- package/dist/esm/gallery/DialogTemplatePreview.d.ts +7 -0
- package/dist/esm/gallery/DialogTemplatePreview.d.ts.map +1 -0
- package/dist/esm/gallery/DialogTemplatePreview.js +44 -0
- package/dist/esm/gallery/DialogTemplatePreview.js.map +1 -0
- package/dist/esm/gallery/DialogTemplates.stories.d.ts +21 -0
- package/dist/esm/gallery/DialogTemplates.stories.d.ts.map +1 -0
- package/dist/esm/gallery/DialogTemplates.stories.js +23 -0
- package/dist/esm/gallery/DialogTemplates.stories.js.map +1 -0
- package/dist/esm/gallery/GalleryScreenPreview.d.ts +10 -0
- package/dist/esm/gallery/GalleryScreenPreview.d.ts.map +1 -0
- package/dist/esm/gallery/GalleryScreenPreview.js +62 -0
- package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -0
- package/dist/esm/gallery/applicationChrome.d.ts +3 -0
- package/dist/esm/gallery/applicationChrome.d.ts.map +1 -0
- package/dist/esm/gallery/applicationChrome.js +135 -0
- package/dist/esm/gallery/applicationChrome.js.map +1 -0
- package/dist/esm/gallery/index.d.ts +7 -0
- package/dist/esm/gallery/index.d.ts.map +1 -0
- package/dist/esm/gallery/index.js +7 -0
- package/dist/esm/gallery/index.js.map +1 -0
- package/dist/esm/gallery/navigation.d.ts +9 -0
- package/dist/esm/gallery/navigation.d.ts.map +1 -0
- package/dist/esm/gallery/navigation.js +121 -0
- package/dist/esm/gallery/navigation.js.map +1 -0
- package/dist/esm/gallery/previewProfile.d.ts +6 -0
- package/dist/esm/gallery/previewProfile.d.ts.map +1 -0
- package/dist/esm/gallery/previewProfile.js +83 -0
- package/dist/esm/gallery/previewProfile.js.map +1 -0
- package/dist/esm/gallery/screens.d.ts +4 -0
- package/dist/esm/gallery/screens.d.ts.map +1 -0
- package/dist/esm/gallery/screens.js +77 -0
- package/dist/esm/gallery/screens.js.map +1 -0
- package/dist/esm/header/ArcHeading.d.ts +9 -0
- package/dist/esm/header/ArcHeading.d.ts.map +1 -0
- package/dist/esm/header/ArcHeading.js +2 -0
- package/dist/esm/header/ArcHeading.js.map +1 -0
- package/dist/esm/header/ArcPageHeader.d.ts +3 -0
- package/dist/esm/header/ArcPageHeader.d.ts.map +1 -0
- package/dist/esm/header/ArcPageHeader.js +63 -0
- package/dist/esm/header/ArcPageHeader.js.map +1 -0
- package/dist/esm/header/deriveArcHeading.d.ts +4 -0
- package/dist/esm/header/deriveArcHeading.d.ts.map +1 -0
- package/dist/esm/header/deriveArcHeading.js +49 -0
- package/dist/esm/header/deriveArcHeading.js.map +1 -0
- package/dist/esm/header/humanizeBindingName.d.ts +2 -0
- package/dist/esm/header/humanizeBindingName.d.ts.map +1 -0
- package/dist/esm/header/humanizeBindingName.js +34 -0
- package/dist/esm/header/humanizeBindingName.js.map +1 -0
- package/dist/esm/header/index.d.ts +5 -0
- package/dist/esm/header/index.d.ts.map +1 -0
- package/dist/esm/header/index.js +5 -0
- package/dist/esm/header/index.js.map +1 -0
- package/dist/esm/index.d.ts +10 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +30 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/packageName.d.ts +2 -0
- package/dist/esm/packageName.d.ts.map +1 -0
- package/dist/esm/packageName.js +13 -0
- package/dist/esm/packageName.js.map +1 -0
- package/dist/esm/templates/ArcHeaderOptions.d.ts +8 -0
- package/dist/esm/templates/ArcHeaderOptions.d.ts.map +1 -0
- package/dist/esm/templates/ArcHeaderOptions.js +2 -0
- package/dist/esm/templates/ArcHeaderOptions.js.map +1 -0
- package/dist/esm/templates/ColumnDefinition.d.ts +5 -0
- package/dist/esm/templates/ColumnDefinition.d.ts.map +1 -0
- package/dist/esm/templates/ColumnDefinition.js +2 -0
- package/dist/esm/templates/ColumnDefinition.js.map +1 -0
- package/dist/esm/templates/SampleBindingName.d.ts +11 -0
- package/dist/esm/templates/SampleBindingName.d.ts.map +1 -0
- package/dist/esm/templates/SampleBindingName.js +37 -0
- package/dist/esm/templates/SampleBindingName.js.map +1 -0
- package/dist/esm/templates/TableOptions.d.ts +6 -0
- package/dist/esm/templates/TableOptions.d.ts.map +1 -0
- package/dist/esm/templates/TableOptions.js +2 -0
- package/dist/esm/templates/TableOptions.js.map +1 -0
- package/dist/esm/templates/commandTemplates.d.ts +4 -0
- package/dist/esm/templates/commandTemplates.d.ts.map +1 -0
- package/dist/esm/templates/commandTemplates.js +79 -0
- package/dist/esm/templates/commandTemplates.js.map +1 -0
- package/dist/esm/templates/dataElements.d.ts +11 -0
- package/dist/esm/templates/dataElements.d.ts.map +1 -0
- package/dist/esm/templates/dataElements.js +123 -0
- package/dist/esm/templates/dataElements.js.map +1 -0
- package/dist/esm/templates/dialogElements.d.ts +5 -0
- package/dist/esm/templates/dialogElements.d.ts.map +1 -0
- package/dist/esm/templates/dialogElements.js +65 -0
- package/dist/esm/templates/dialogElements.js.map +1 -0
- package/dist/esm/templates/dialogTemplates.d.ts +6 -0
- package/dist/esm/templates/dialogTemplates.d.ts.map +1 -0
- package/dist/esm/templates/dialogTemplates.js +113 -0
- package/dist/esm/templates/dialogTemplates.js.map +1 -0
- package/dist/esm/templates/editorElements.d.ts +11 -0
- package/dist/esm/templates/editorElements.d.ts.map +1 -0
- package/dist/esm/templates/editorElements.js +74 -0
- package/dist/esm/templates/editorElements.js.map +1 -0
- package/dist/esm/templates/editorTemplates.d.ts +5 -0
- package/dist/esm/templates/editorTemplates.d.ts.map +1 -0
- package/dist/esm/templates/editorTemplates.js +168 -0
- package/dist/esm/templates/editorTemplates.js.map +1 -0
- package/dist/esm/templates/elements.d.ts +11 -0
- package/dist/esm/templates/elements.d.ts.map +1 -0
- package/dist/esm/templates/elements.js +92 -0
- package/dist/esm/templates/elements.js.map +1 -0
- package/dist/esm/templates/formElements.d.ts +11 -0
- package/dist/esm/templates/formElements.d.ts.map +1 -0
- package/dist/esm/templates/formElements.js +70 -0
- package/dist/esm/templates/formElements.js.map +1 -0
- package/dist/esm/templates/index.d.ts +18 -0
- package/dist/esm/templates/index.d.ts.map +1 -0
- package/dist/esm/templates/index.js +18 -0
- package/dist/esm/templates/index.js.map +1 -0
- package/dist/esm/templates/listTemplates.d.ts +6 -0
- package/dist/esm/templates/listTemplates.d.ts.map +1 -0
- package/dist/esm/templates/listTemplates.js +182 -0
- package/dist/esm/templates/listTemplates.js.map +1 -0
- package/dist/esm/templates/nesting.d.ts +6 -0
- package/dist/esm/templates/nesting.d.ts.map +1 -0
- package/dist/esm/templates/nesting.js +145 -0
- package/dist/esm/templates/nesting.js.map +1 -0
- package/dist/esm/templates/sampleData.d.ts +10 -0
- package/dist/esm/templates/sampleData.d.ts.map +1 -0
- package/dist/esm/templates/sampleData.js +134 -0
- package/dist/esm/templates/sampleData.js.map +1 -0
- package/dist/esm/templates/screenTemplates.d.ts +4 -0
- package/dist/esm/templates/screenTemplates.d.ts.map +1 -0
- package/dist/esm/templates/screenTemplates.js +38 -0
- package/dist/esm/templates/screenTemplates.js.map +1 -0
- package/dist/esm/templates/workspaceTemplates.d.ts +5 -0
- package/dist/esm/templates/workspaceTemplates.d.ts.map +1 -0
- package/dist/esm/templates/workspaceTemplates.js +208 -0
- package/dist/esm/templates/workspaceTemplates.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/for_ArcPageHeader/when_rendering_a_gallery_screen.tsx +79 -0
- package/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.ts +41 -0
- package/for_componentsBlueprint/when_resolving_its_dependencies.ts +85 -0
- package/for_componentsBlueprint/when_validating_the_bundle.ts +55 -0
- package/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.ts +56 -0
- package/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.ts +66 -0
- package/for_componentsScreenTemplates/when_following_the_nesting_chain.ts +83 -0
- package/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.ts +51 -0
- package/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.ts +72 -0
- package/for_deriveArcHeading/when_no_binding_is_named.ts +42 -0
- package/for_deriveArcHeading/when_the_binding_is_not_registered.ts +25 -0
- package/for_deriveArcHeading/when_the_binding_is_registered.ts +35 -0
- package/for_humanizeBindingName/when_reading_a_proxy_name.ts +34 -0
- package/gallery/ArcPages.stories.tsx +80 -0
- package/gallery/Bindings.stories.tsx +134 -0
- package/gallery/DialogTemplatePreview.tsx +49 -0
- package/gallery/DialogTemplates.stories.tsx +44 -0
- package/gallery/GalleryScreenPreview.tsx +70 -0
- package/gallery/applicationChrome.ts +108 -0
- package/gallery/index.ts +9 -0
- package/gallery/navigation.ts +63 -0
- package/gallery/previewProfile.ts +68 -0
- package/gallery/screens.ts +75 -0
- package/header/ArcHeading.ts +39 -0
- package/header/ArcPageHeader.tsx +44 -0
- package/header/deriveArcHeading.ts +47 -0
- package/header/humanizeBindingName.ts +36 -0
- package/header/index.ts +7 -0
- package/index.ts +12 -0
- package/package.json +71 -0
- package/packageName.ts +12 -0
- package/templates/ArcHeaderOptions.ts +27 -0
- package/templates/ColumnDefinition.ts +18 -0
- package/templates/SampleBindingName.ts +50 -0
- package/templates/TableOptions.ts +22 -0
- package/templates/commandTemplates.ts +59 -0
- package/templates/dataElements.ts +97 -0
- package/templates/dialogElements.ts +53 -0
- package/templates/dialogTemplates.ts +105 -0
- package/templates/editorElements.ts +69 -0
- package/templates/editorTemplates.ts +129 -0
- package/templates/elements.ts +81 -0
- package/templates/formElements.ts +61 -0
- package/templates/index.ts +20 -0
- package/templates/listTemplates.ts +142 -0
- package/templates/nesting.ts +118 -0
- package/templates/sampleData.ts +81 -0
- package/templates/screenTemplates.ts +35 -0
- package/templates/workspaceTemplates.ts +163 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_blueprint_default = require('@cratis/scene.blueprint.default');
|
|
4
|
+
var BorrowedComponentName = require('../BorrowedComponentName.js');
|
|
5
|
+
var CompositeName = require('../CompositeName.js');
|
|
6
|
+
|
|
7
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
8
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
9
|
+
/**
|
|
10
|
+
* The Arc-bound data elements this blueprint's templates are built from.
|
|
11
|
+
*
|
|
12
|
+
* Each one is a single `ExternalComponent` carrying a query *name* in its property bag, which is the whole
|
|
13
|
+
* contract: `resolveElementBinding` in `@cratis/scene.components` reads that name out at render time and
|
|
14
|
+
* looks it up in the binding registry, and a name nothing is registered under renders as a placeholder
|
|
15
|
+
* naming what it wanted. Nothing here invents a second way to reach a backend, because there is only one
|
|
16
|
+
* and it belongs to the component library.
|
|
17
|
+
*/ /**
|
|
18
|
+
* The columns of a data table, as the `content` slot children the library's tables take.
|
|
19
|
+
*
|
|
20
|
+
* The name is PrimeReact's rather than `Cratis.Components`' - see {@link BorrowedComponentName.Column} for
|
|
21
|
+
* why - and `sortable` is set on every column because a table that performs a real query can sort against
|
|
22
|
+
* the server, and a column that quietly cannot is the more surprising default.
|
|
23
|
+
*/ function columns(id, definitions) {
|
|
24
|
+
return definitions.map((definition)=>scene_blueprint_default.externalComponent(`${id}-${definition.field}`, BorrowedComponentName.BorrowedComponentName.Column, {
|
|
25
|
+
field: definition.field,
|
|
26
|
+
header: definition.header,
|
|
27
|
+
sortable: true
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A `dataPage` - the library's whole list-screen composite, driven from one query.
|
|
32
|
+
*
|
|
33
|
+
* This is the archetype the package exists for. Reproducing it out of a table, a toolbar and a filter in a
|
|
34
|
+
* screen would be pages of modeling for a worse result, and every one of those pages would then be an
|
|
35
|
+
* application's to maintain. Here it is one element with a name in it.
|
|
36
|
+
*
|
|
37
|
+
* Its own `title` is deliberately empty. Every template in this package opens with an `arcPageHeader`, and
|
|
38
|
+
* that header already states the page's name, its trail and what it is bound to; letting the composite
|
|
39
|
+
* print the same word again directly underneath would be two sources for one fact, and they would
|
|
40
|
+
* disagree the first time either changed.
|
|
41
|
+
*/ function dataPage(id, query, options, definitions) {
|
|
42
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.DataPage, {
|
|
43
|
+
query,
|
|
44
|
+
title: '',
|
|
45
|
+
...options
|
|
46
|
+
}, {
|
|
47
|
+
content: columns(`${id}-column`, definitions)
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A `dataTable` - the same server-side querying without the page chrome around it.
|
|
52
|
+
*
|
|
53
|
+
* Used where a template already has a header of its own and only needs the rows, which is most places a
|
|
54
|
+
* table appears inside a larger page.
|
|
55
|
+
*/ function dataTable(id, query, options, definitions) {
|
|
56
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.DataTable, {
|
|
57
|
+
query,
|
|
58
|
+
...options
|
|
59
|
+
}, {
|
|
60
|
+
content: columns(`${id}-column`, definitions)
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* An `observableDataTable` - the live variant.
|
|
65
|
+
*
|
|
66
|
+
* A separate element rather than a flag, because the difference is in the *proxy* a host registers: an
|
|
67
|
+
* observable query opens a subscription and re-renders when the read model changes, and a plain one does
|
|
68
|
+
* not. A template that names an observable query is stating that its data is live, which is a design
|
|
69
|
+
* decision worth being able to read off the page.
|
|
70
|
+
*/ function observableDataTable(id, query, options, definitions) {
|
|
71
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.ObservableDataTable, {
|
|
72
|
+
query,
|
|
73
|
+
...options
|
|
74
|
+
}, {
|
|
75
|
+
content: columns(`${id}-column`, definitions)
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/** The columns of the invoice list every list-shaped template in this package shows. */ const invoiceColumns = [
|
|
79
|
+
{
|
|
80
|
+
field: 'number',
|
|
81
|
+
header: 'Number'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
field: 'customer',
|
|
85
|
+
header: 'Customer'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
field: 'issued',
|
|
89
|
+
header: 'Issued'
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
field: 'amount',
|
|
93
|
+
header: 'Amount'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
field: 'status',
|
|
97
|
+
header: 'Status'
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
/** The columns of the adjustment list, for the templates that show one. */ const adjustmentColumns = [
|
|
101
|
+
{
|
|
102
|
+
field: 'recorded',
|
|
103
|
+
header: 'Recorded'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
field: 'reason',
|
|
107
|
+
header: 'Reason'
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
field: 'amount',
|
|
111
|
+
header: 'Amount'
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
/** The table options an invoice list uses, so eight templates cannot disagree about the empty message. */ const invoiceTableOptions = {
|
|
115
|
+
emptyMessage: 'No invoices yet',
|
|
116
|
+
dataKey: 'invoiceId',
|
|
117
|
+
globalFilterFields: [
|
|
118
|
+
'number',
|
|
119
|
+
'customer',
|
|
120
|
+
'status'
|
|
121
|
+
]
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
exports.adjustmentColumns = adjustmentColumns;
|
|
125
|
+
exports.columns = columns;
|
|
126
|
+
exports.dataPage = dataPage;
|
|
127
|
+
exports.dataTable = dataTable;
|
|
128
|
+
exports.invoiceColumns = invoiceColumns;
|
|
129
|
+
exports.invoiceTableOptions = invoiceTableOptions;
|
|
130
|
+
exports.observableDataTable = observableDataTable;
|
|
131
|
+
//# sourceMappingURL=dataElements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataElements.js","sources":["../../../templates/dataElements.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 { SceneElement } from '@cratis/scene.model';\nimport { externalComponent } from '@cratis/scene.blueprint.default';\nimport { BorrowedComponentName } from '../BorrowedComponentName';\nimport { CompositeName } from '../CompositeName';\nimport { ColumnDefinition } from './ColumnDefinition';\nimport { TableOptions } from './TableOptions';\n\n/**\n * The Arc-bound data elements this blueprint's templates are built from.\n *\n * Each one is a single `ExternalComponent` carrying a query *name* in its property bag, which is the whole\n * contract: `resolveElementBinding` in `@cratis/scene.components` reads that name out at render time and\n * looks it up in the binding registry, and a name nothing is registered under renders as a placeholder\n * naming what it wanted. Nothing here invents a second way to reach a backend, because there is only one\n * and it belongs to the component library.\n */\n\n/**\n * The columns of a data table, as the `content` slot children the library's tables take.\n *\n * The name is PrimeReact's rather than `Cratis.Components`' - see {@link BorrowedComponentName.Column} for\n * why - and `sortable` is set on every column because a table that performs a real query can sort against\n * the server, and a column that quietly cannot is the more surprising default.\n */\nexport function columns(id: string, definitions: ColumnDefinition[]): SceneElement[] {\n return definitions.map(definition =>\n externalComponent(`${id}-${definition.field}`, BorrowedComponentName.Column, {\n field: definition.field,\n header: definition.header,\n sortable: true,\n }),\n );\n}\n\n/**\n * A `dataPage` - the library's whole list-screen composite, driven from one query.\n *\n * This is the archetype the package exists for. Reproducing it out of a table, a toolbar and a filter in a\n * screen would be pages of modeling for a worse result, and every one of those pages would then be an\n * application's to maintain. Here it is one element with a name in it.\n *\n * Its own `title` is deliberately empty. Every template in this package opens with an `arcPageHeader`, and\n * that header already states the page's name, its trail and what it is bound to; letting the composite\n * print the same word again directly underneath would be two sources for one fact, and they would\n * disagree the first time either changed.\n */\nexport function dataPage(id: string, query: string, options: TableOptions, definitions: ColumnDefinition[]): SceneElement {\n return externalComponent(id, CompositeName.DataPage, { query, title: '', ...options }, { content: columns(`${id}-column`, definitions) });\n}\n\n/**\n * A `dataTable` - the same server-side querying without the page chrome around it.\n *\n * Used where a template already has a header of its own and only needs the rows, which is most places a\n * table appears inside a larger page.\n */\nexport function dataTable(id: string, query: string, options: TableOptions, definitions: ColumnDefinition[]): SceneElement {\n return externalComponent(id, CompositeName.DataTable, { query, ...options }, { content: columns(`${id}-column`, definitions) });\n}\n\n/**\n * An `observableDataTable` - the live variant.\n *\n * A separate element rather than a flag, because the difference is in the *proxy* a host registers: an\n * observable query opens a subscription and re-renders when the read model changes, and a plain one does\n * not. A template that names an observable query is stating that its data is live, which is a design\n * decision worth being able to read off the page.\n */\nexport function observableDataTable(id: string, query: string, options: TableOptions, definitions: ColumnDefinition[]): SceneElement {\n return externalComponent(id, CompositeName.ObservableDataTable, { query, ...options }, { content: columns(`${id}-column`, definitions) });\n}\n\n/** The columns of the invoice list every list-shaped template in this package shows. */\nexport const invoiceColumns: ColumnDefinition[] = [\n { field: 'number', header: 'Number' },\n { field: 'customer', header: 'Customer' },\n { field: 'issued', header: 'Issued' },\n { field: 'amount', header: 'Amount' },\n { field: 'status', header: 'Status' },\n];\n\n/** The columns of the adjustment list, for the templates that show one. */\nexport const adjustmentColumns: ColumnDefinition[] = [\n { field: 'recorded', header: 'Recorded' },\n { field: 'reason', header: 'Reason' },\n { field: 'amount', header: 'Amount' },\n];\n\n/** The table options an invoice list uses, so eight templates cannot disagree about the empty message. */\nexport const invoiceTableOptions: TableOptions = {\n emptyMessage: 'No invoices yet',\n dataKey: 'invoiceId',\n globalFilterFields: ['number', 'customer', 'status'],\n};\n"],"names":["columns","id","definitions","map","definition","externalComponent","field","BorrowedComponentName","Column","header","sortable","dataPage","query","options","CompositeName","DataPage","title","content","dataTable","DataTable","observableDataTable","ObservableDataTable","invoiceColumns","adjustmentColumns","invoiceTableOptions","emptyMessage","dataKey","globalFilterFields"],"mappings":";;;;;;AAAA;AACA;AASA;;;;;;;;;;;;;;AAgBC,IACM,SAASA,OAAAA,CAAQC,EAAU,EAAEC,WAA+B,EAAA;AAC/D,IAAA,OAAOA,YAAYC,GAAG,CAACC,CAAAA,UAAAA,GACnBC,0CAAkB,CAAA,EAAGJ,EAAAA,CAAG,CAAC,EAAEG,WAAWE,KAAK,CAAA,CAAE,EAAEC,2CAAAA,CAAsBC,MAAM,EAAE;AACzEF,YAAAA,KAAAA,EAAOF,WAAWE,KAAK;AACvBG,YAAAA,MAAAA,EAAQL,WAAWK,MAAM;YACzBC,QAAAA,EAAU;AACd,SAAA,CAAA,CAAA;AAER;AAEA;;;;;;;;;;;IAYO,SAASC,QAAAA,CAASV,EAAU,EAAEW,KAAa,EAAEC,OAAqB,EAAEX,WAA+B,EAAA;AACtG,IAAA,OAAOG,yCAAAA,CAAkBJ,EAAAA,EAAIa,2BAAAA,CAAcC,QAAQ,EAAE;AAAEH,QAAAA,KAAAA;QAAOI,KAAAA,EAAO,EAAA;AAAI,QAAA,GAAGH;KAAQ,EAAG;AAAEI,QAAAA,OAAAA,EAASjB,OAAAA,CAAQ,CAAA,EAAGC,EAAAA,CAAG,OAAO,CAAC,EAAEC,WAAAA;AAAa,KAAA,CAAA;AAC3I;AAEA;;;;;IAMO,SAASgB,SAAAA,CAAUjB,EAAU,EAAEW,KAAa,EAAEC,OAAqB,EAAEX,WAA+B,EAAA;AACvG,IAAA,OAAOG,yCAAAA,CAAkBJ,EAAAA,EAAIa,2BAAAA,CAAcK,SAAS,EAAE;AAAEP,QAAAA,KAAAA;AAAO,QAAA,GAAGC;KAAQ,EAAG;AAAEI,QAAAA,OAAAA,EAASjB,OAAAA,CAAQ,CAAA,EAAGC,EAAAA,CAAG,OAAO,CAAC,EAAEC,WAAAA;AAAa,KAAA,CAAA;AACjI;AAEA;;;;;;;IAQO,SAASkB,mBAAAA,CAAoBnB,EAAU,EAAEW,KAAa,EAAEC,OAAqB,EAAEX,WAA+B,EAAA;AACjH,IAAA,OAAOG,yCAAAA,CAAkBJ,EAAAA,EAAIa,2BAAAA,CAAcO,mBAAmB,EAAE;AAAET,QAAAA,KAAAA;AAAO,QAAA,GAAGC;KAAQ,EAAG;AAAEI,QAAAA,OAAAA,EAASjB,OAAAA,CAAQ,CAAA,EAAGC,EAAAA,CAAG,OAAO,CAAC,EAAEC,WAAAA;AAAa,KAAA,CAAA;AAC3I;AAEA,yFACO,MAAMoB,cAAAA,GAAqC;AAC9C,IAAA;QAAEhB,KAAAA,EAAO,QAAA;QAAUG,MAAAA,EAAQ;AAAS,KAAA;AACpC,IAAA;QAAEH,KAAAA,EAAO,UAAA;QAAYG,MAAAA,EAAQ;AAAW,KAAA;AACxC,IAAA;QAAEH,KAAAA,EAAO,QAAA;QAAUG,MAAAA,EAAQ;AAAS,KAAA;AACpC,IAAA;QAAEH,KAAAA,EAAO,QAAA;QAAUG,MAAAA,EAAQ;AAAS,KAAA;AACpC,IAAA;QAAEH,KAAAA,EAAO,QAAA;QAAUG,MAAAA,EAAQ;AAAS;;AAGxC,4EACO,MAAMc,iBAAAA,GAAwC;AACjD,IAAA;QAAEjB,KAAAA,EAAO,UAAA;QAAYG,MAAAA,EAAQ;AAAW,KAAA;AACxC,IAAA;QAAEH,KAAAA,EAAO,QAAA;QAAUG,MAAAA,EAAQ;AAAS,KAAA;AACpC,IAAA;QAAEH,KAAAA,EAAO,QAAA;QAAUG,MAAAA,EAAQ;AAAS;;AAGxC,2GACO,MAAMe,mBAAAA,GAAoC;IAC7CC,YAAAA,EAAc,iBAAA;IACdC,OAAAA,EAAS,WAAA;IACTC,kBAAAA,EAAoB;AAAC,QAAA,QAAA;AAAU,QAAA,UAAA;AAAY,QAAA;AAAS;AACxD;;;;;;;;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_blueprint_default = require('@cratis/scene.blueprint.default');
|
|
4
|
+
var CompositeName = require('../CompositeName.js');
|
|
5
|
+
|
|
6
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
7
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
8
|
+
/**
|
|
9
|
+
* The dialog elements this blueprint's dialog templates are built from.
|
|
10
|
+
*
|
|
11
|
+
* Each is a whole dialog rather than a piece of one, and that is why this package's dialog templates look
|
|
12
|
+
* so different from the default blueprint's. The default blueprint composes a dialog out of primitives - a
|
|
13
|
+
* title, a message, a row of buttons - because it has nothing better available. Here the library ships
|
|
14
|
+
* dialogs that resolve their result through Arc's dialog context, so the frame, the buttons and the
|
|
15
|
+
* protocol behind them all belong to the composite. A template's job is to configure one, not to rebuild it.
|
|
16
|
+
*/ /**
|
|
17
|
+
* The Arc-aware dialog: a frame whose result resolves through Arc's dialog context.
|
|
18
|
+
*
|
|
19
|
+
* Worth shadowing PrimeReact's `dialog` for. PrimeReact's is a modal frame and nothing more; this one lets
|
|
20
|
+
* a caller `await` a `DialogResult` instead of threading `visible` state and callbacks by hand, which is
|
|
21
|
+
* the difference between a dialog you can call and a dialog you have to wire.
|
|
22
|
+
*
|
|
23
|
+
* `visible` is left at the adapter's default of `true`, because a dialog placed in a template is placed to
|
|
24
|
+
* be seen; a host that drives visibility sets the property itself.
|
|
25
|
+
*/ function dialog(id, title, okLabel, cancelLabel, content) {
|
|
26
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.Dialog, {
|
|
27
|
+
title,
|
|
28
|
+
okLabel,
|
|
29
|
+
cancelLabel,
|
|
30
|
+
width: '28rem'
|
|
31
|
+
}, {
|
|
32
|
+
content
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A dialog whose confirm button *is* the command's execution.
|
|
37
|
+
*
|
|
38
|
+
* Worth using instead of composing `dialog` with `commandForm`, because a hand-composed pair has no way to
|
|
39
|
+
* keep the dialog open on a rejected command without reimplementing the protocol: this one submits, feeds
|
|
40
|
+
* the backend's validation results back onto the fields, and only closes when the command succeeded.
|
|
41
|
+
*/ function commandDialog(id, command, title, okLabel, fields) {
|
|
42
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.CommandDialog, {
|
|
43
|
+
command,
|
|
44
|
+
title,
|
|
45
|
+
okLabel,
|
|
46
|
+
cancelLabel: 'Cancel',
|
|
47
|
+
width: '32rem'
|
|
48
|
+
}, {
|
|
49
|
+
content: fields
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The blocking spinner shown while a long-running command is in flight.
|
|
54
|
+
*
|
|
55
|
+
* In a running application it is the Arc dialog host that renders this, threading its own title and
|
|
56
|
+
* message through. Shipping it as a template is what lets its wording and placement be *designed* rather
|
|
57
|
+
* than discovered the first time an operation takes a while - which is the only moment anyone ever sees it,
|
|
58
|
+
* and the worst moment to be reading a sentence nobody wrote on purpose.
|
|
59
|
+
*/ function busyIndicatorDialog(id, title, message) {
|
|
60
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.BusyIndicatorDialog, {
|
|
61
|
+
title,
|
|
62
|
+
message
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
exports.busyIndicatorDialog = busyIndicatorDialog;
|
|
67
|
+
exports.commandDialog = commandDialog;
|
|
68
|
+
exports.dialog = dialog;
|
|
69
|
+
//# sourceMappingURL=dialogElements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogElements.js","sources":["../../../templates/dialogElements.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 { SceneElement } from '@cratis/scene.model';\nimport { externalComponent } from '@cratis/scene.blueprint.default';\nimport { CompositeName } from '../CompositeName';\n\n/**\n * The dialog elements this blueprint's dialog templates are built from.\n *\n * Each is a whole dialog rather than a piece of one, and that is why this package's dialog templates look\n * so different from the default blueprint's. The default blueprint composes a dialog out of primitives - a\n * title, a message, a row of buttons - because it has nothing better available. Here the library ships\n * dialogs that resolve their result through Arc's dialog context, so the frame, the buttons and the\n * protocol behind them all belong to the composite. A template's job is to configure one, not to rebuild it.\n */\n\n/**\n * The Arc-aware dialog: a frame whose result resolves through Arc's dialog context.\n *\n * Worth shadowing PrimeReact's `dialog` for. PrimeReact's is a modal frame and nothing more; this one lets\n * a caller `await` a `DialogResult` instead of threading `visible` state and callbacks by hand, which is\n * the difference between a dialog you can call and a dialog you have to wire.\n *\n * `visible` is left at the adapter's default of `true`, because a dialog placed in a template is placed to\n * be seen; a host that drives visibility sets the property itself.\n */\nexport function dialog(id: string, title: string, okLabel: string, cancelLabel: string, content: SceneElement[]): SceneElement {\n return externalComponent(id, CompositeName.Dialog, { title, okLabel, cancelLabel, width: '28rem' }, { content });\n}\n\n/**\n * A dialog whose confirm button *is* the command's execution.\n *\n * Worth using instead of composing `dialog` with `commandForm`, because a hand-composed pair has no way to\n * keep the dialog open on a rejected command without reimplementing the protocol: this one submits, feeds\n * the backend's validation results back onto the fields, and only closes when the command succeeded.\n */\nexport function commandDialog(id: string, command: string, title: string, okLabel: string, fields: SceneElement[]): SceneElement {\n return externalComponent(id, CompositeName.CommandDialog, { command, title, okLabel, cancelLabel: 'Cancel', width: '32rem' }, { content: fields });\n}\n\n/**\n * The blocking spinner shown while a long-running command is in flight.\n *\n * In a running application it is the Arc dialog host that renders this, threading its own title and\n * message through. Shipping it as a template is what lets its wording and placement be *designed* rather\n * than discovered the first time an operation takes a while - which is the only moment anyone ever sees it,\n * and the worst moment to be reading a sentence nobody wrote on purpose.\n */\nexport function busyIndicatorDialog(id: string, title: string, message: string): SceneElement {\n return externalComponent(id, CompositeName.BusyIndicatorDialog, { title, message });\n}\n"],"names":["dialog","id","title","okLabel","cancelLabel","content","externalComponent","CompositeName","Dialog","width","commandDialog","command","fields","CommandDialog","busyIndicatorDialog","message","BusyIndicatorDialog"],"mappings":";;;;;AAAA;AACA;AAMA;;;;;;;;;;;;;;;;;IAoBO,SAASA,MAAAA,CAAOC,EAAU,EAAEC,KAAa,EAAEC,OAAe,EAAEC,WAAmB,EAAEC,OAAuB,EAAA;AAC3G,IAAA,OAAOC,yCAAAA,CAAkBL,EAAAA,EAAIM,2BAAAA,CAAcC,MAAM,EAAE;AAAEN,QAAAA,KAAAA;AAAOC,QAAAA,OAAAA;AAASC,QAAAA,WAAAA;QAAaK,KAAAA,EAAO;KAAQ,EAAG;AAAEJ,QAAAA;AAAQ,KAAA,CAAA;AAClH;AAEA;;;;;;IAOO,SAASK,aAAAA,CAAcT,EAAU,EAAEU,OAAe,EAAET,KAAa,EAAEC,OAAe,EAAES,MAAsB,EAAA;AAC7G,IAAA,OAAON,yCAAAA,CAAkBL,EAAAA,EAAIM,2BAAAA,CAAcM,aAAa,EAAE;AAAEF,QAAAA,OAAAA;AAAST,QAAAA,KAAAA;AAAOC,QAAAA,OAAAA;QAASC,WAAAA,EAAa,QAAA;QAAUK,KAAAA,EAAO;KAAQ,EAAG;QAAEJ,OAAAA,EAASO;AAAO,KAAA,CAAA;AACpJ;AAEA;;;;;;;AAOC,IACM,SAASE,mBAAAA,CAAoBb,EAAU,EAAEC,KAAa,EAAEa,OAAe,EAAA;AAC1E,IAAA,OAAOT,yCAAAA,CAAkBL,EAAAA,EAAIM,2BAAAA,CAAcS,mBAAmB,EAAE;AAAEd,QAAAA,KAAAA;AAAOa,QAAAA;AAAQ,KAAA,CAAA;AACrF;;;;;;"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_blueprint_default = require('@cratis/scene.blueprint.default');
|
|
4
|
+
var dialogElements = require('./dialogElements.js');
|
|
5
|
+
var elements = require('./elements.js');
|
|
6
|
+
var formElements = require('./formElements.js');
|
|
7
|
+
var SampleBindingName = require('./SampleBindingName.js');
|
|
8
|
+
|
|
9
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
10
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
11
|
+
/**
|
|
12
|
+
* The three dialog shapes an Arc application repeats: submit a command, confirm something destructive, and
|
|
13
|
+
* say that something long-running is in flight.
|
|
14
|
+
*
|
|
15
|
+
* A dialog template has no `fitsSlot`, and that absence is the whole distinction from a screen template. A
|
|
16
|
+
* screen template is *placed* - it fills a slot on whatever contains it, and the containment chain decides
|
|
17
|
+
* where it appears. A dialog is *summoned*: it opens over the application from wherever the code that
|
|
18
|
+
* opened it happens to be, so there is no parent slot for it to name.
|
|
19
|
+
*
|
|
20
|
+
* Every one of these declares exactly one slot, which is a real departure from how the default blueprint
|
|
21
|
+
* builds its dialogs, and the reason is worth stating. The default blueprint composes a dialog out of
|
|
22
|
+
* primitives - a title, a message, a row of buttons - because primitives are all it has. Here the library
|
|
23
|
+
* ships whole dialogs that resolve their result through Arc's dialog context, so the frame, the title bar
|
|
24
|
+
* and the buttons all belong to the composite. A template that declared `header` and `actions` slots would
|
|
25
|
+
* be offering regions that render *outside* the modal, which is worse than not offering them: a screen
|
|
26
|
+
* would fill them, and the content would appear somewhere nobody expected.
|
|
27
|
+
*/ /**
|
|
28
|
+
* A command dialog: a short capture whose confirm button is the command's execution.
|
|
29
|
+
*
|
|
30
|
+
* Worth reaching for instead of composing `dialog` with `commandForm`, because a hand-composed pair has no
|
|
31
|
+
* way to keep the dialog open on a rejected command without reimplementing the protocol. This one submits,
|
|
32
|
+
* feeds the backend's validation results back onto the fields, and only closes when the command succeeded.
|
|
33
|
+
*
|
|
34
|
+
* The fields are placed by hand rather than generated, which is the opposite choice from `CommandFormPage`
|
|
35
|
+
* and deliberate. A dialog is a *short* capture: three or four properties chosen because they are the ones
|
|
36
|
+
* a person can answer in an overlay. Generating every property of the command would turn an overlay into a
|
|
37
|
+
* page, which is precisely the decision a dialog is supposed to have already made.
|
|
38
|
+
*/ const commandDialogTemplate = {
|
|
39
|
+
name: 'CommandDialog',
|
|
40
|
+
slots: [
|
|
41
|
+
{
|
|
42
|
+
name: scene_blueprint_default.TemplateSlotName.Body
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
content: {
|
|
46
|
+
[scene_blueprint_default.TemplateSlotName.Body]: [
|
|
47
|
+
dialogElements.commandDialog('command-dialog', SampleBindingName.SampleBindingName.RecordAdjustment, 'Record an adjustment', 'Record', [
|
|
48
|
+
formElements.numberField('command-dialog-amount', 'amount', 'Amount'),
|
|
49
|
+
formElements.inputTextField('command-dialog-reason', 'reason', 'Reason', 'Damaged goods'),
|
|
50
|
+
formElements.calendarField('command-dialog-effective', 'effective', 'Effective from'),
|
|
51
|
+
formElements.textAreaField('command-dialog-note', 'note', 'Note', 3)
|
|
52
|
+
])
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
displayName: 'Command dialog',
|
|
56
|
+
description: 'A short capture whose confirm button submits the command and only closes when it succeeded.'
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* A confirmation dialog: one question, the consequence spelled out, and a way back.
|
|
60
|
+
*
|
|
61
|
+
* The Arc-aware `dialog` rather than PrimeReact's, because a caller `await`s a `DialogResult` from it
|
|
62
|
+
* instead of threading `visible` state and callbacks by hand - which is the difference between a
|
|
63
|
+
* confirmation you can call from a handler and one you have to wire into a component's state.
|
|
64
|
+
*
|
|
65
|
+
* The confirm label says what will happen rather than `OK`. A confirmation whose buttons are `OK` and
|
|
66
|
+
* `Cancel` makes the reader map the question onto the answer under time pressure, which is exactly when
|
|
67
|
+
* they will get it wrong.
|
|
68
|
+
*/ const confirmDialogTemplate = {
|
|
69
|
+
name: 'ConfirmDialog',
|
|
70
|
+
slots: [
|
|
71
|
+
{
|
|
72
|
+
name: scene_blueprint_default.TemplateSlotName.Body
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
content: {
|
|
76
|
+
[scene_blueprint_default.TemplateSlotName.Body]: [
|
|
77
|
+
dialogElements.dialog('confirm-dialog', 'Void this invoice?', 'Void it', 'Keep it', [
|
|
78
|
+
elements.icon('confirm-dialog-icon', 'pi pi-exclamation-triangle'),
|
|
79
|
+
formElements.inputTextField('confirm-dialog-reason', 'reason', 'Why is it being voided?', 'Duplicate of INV-2041')
|
|
80
|
+
])
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
displayName: 'Confirmation dialog',
|
|
84
|
+
description: 'One question with the consequence spelled out, answered through Arc dialog context.'
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* A busy dialog: the blocking spinner shown while a long-running command is in flight.
|
|
88
|
+
*
|
|
89
|
+
* In a running application the Arc dialog host renders this, threading its own title and message through.
|
|
90
|
+
* Shipping it as a template is what lets its wording be *designed* rather than discovered the first time an
|
|
91
|
+
* operation takes a while - which is the only moment anyone ever sees it, and the worst possible moment to
|
|
92
|
+
* be reading a sentence nobody wrote on purpose.
|
|
93
|
+
*/ const busyDialogTemplate = {
|
|
94
|
+
name: 'BusyDialog',
|
|
95
|
+
slots: [
|
|
96
|
+
{
|
|
97
|
+
name: scene_blueprint_default.TemplateSlotName.Body
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
content: {
|
|
101
|
+
[scene_blueprint_default.TemplateSlotName.Body]: [
|
|
102
|
+
dialogElements.busyIndicatorDialog('busy-dialog', 'Recording the adjustment', 'The invoice will reappear as soon as the read model catches up.')
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
displayName: 'Busy dialog',
|
|
106
|
+
description: 'The blocking spinner shown while a long-running command is in flight, with wording chosen up front.'
|
|
107
|
+
};
|
|
108
|
+
/** The dialog templates this blueprint provides. */ const componentsDialogTemplates = [
|
|
109
|
+
commandDialogTemplate,
|
|
110
|
+
confirmDialogTemplate,
|
|
111
|
+
busyDialogTemplate
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
exports.busyDialogTemplate = busyDialogTemplate;
|
|
115
|
+
exports.commandDialogTemplate = commandDialogTemplate;
|
|
116
|
+
exports.componentsDialogTemplates = componentsDialogTemplates;
|
|
117
|
+
exports.confirmDialogTemplate = confirmDialogTemplate;
|
|
118
|
+
//# sourceMappingURL=dialogTemplates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogTemplates.js","sources":["../../../templates/dialogTemplates.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 { DialogTemplate } from '@cratis/scene.model';\nimport { TemplateSlotName } from '@cratis/scene.blueprint.default';\nimport { busyIndicatorDialog, commandDialog, dialog } from './dialogElements';\nimport { icon } from './elements';\nimport { calendarField, inputTextField, numberField, textAreaField } from './formElements';\nimport { SampleBindingName } from './SampleBindingName';\n\n/**\n * The three dialog shapes an Arc application repeats: submit a command, confirm something destructive, and\n * say that something long-running is in flight.\n *\n * A dialog template has no `fitsSlot`, and that absence is the whole distinction from a screen template. A\n * screen template is *placed* - it fills a slot on whatever contains it, and the containment chain decides\n * where it appears. A dialog is *summoned*: it opens over the application from wherever the code that\n * opened it happens to be, so there is no parent slot for it to name.\n *\n * Every one of these declares exactly one slot, which is a real departure from how the default blueprint\n * builds its dialogs, and the reason is worth stating. The default blueprint composes a dialog out of\n * primitives - a title, a message, a row of buttons - because primitives are all it has. Here the library\n * ships whole dialogs that resolve their result through Arc's dialog context, so the frame, the title bar\n * and the buttons all belong to the composite. A template that declared `header` and `actions` slots would\n * be offering regions that render *outside* the modal, which is worse than not offering them: a screen\n * would fill them, and the content would appear somewhere nobody expected.\n */\n\n/**\n * A command dialog: a short capture whose confirm button is the command's execution.\n *\n * Worth reaching for instead of composing `dialog` with `commandForm`, because a hand-composed pair has no\n * way to keep the dialog open on a rejected command without reimplementing the protocol. This one submits,\n * feeds the backend's validation results back onto the fields, and only closes when the command succeeded.\n *\n * The fields are placed by hand rather than generated, which is the opposite choice from `CommandFormPage`\n * and deliberate. A dialog is a *short* capture: three or four properties chosen because they are the ones\n * a person can answer in an overlay. Generating every property of the command would turn an overlay into a\n * page, which is precisely the decision a dialog is supposed to have already made.\n */\nexport const commandDialogTemplate: DialogTemplate = {\n name: 'CommandDialog',\n slots: [{ name: TemplateSlotName.Body }],\n content: {\n [TemplateSlotName.Body]: [\n commandDialog('command-dialog', SampleBindingName.RecordAdjustment, 'Record an adjustment', 'Record', [\n numberField('command-dialog-amount', 'amount', 'Amount'),\n inputTextField('command-dialog-reason', 'reason', 'Reason', 'Damaged goods'),\n calendarField('command-dialog-effective', 'effective', 'Effective from'),\n textAreaField('command-dialog-note', 'note', 'Note', 3),\n ]),\n ],\n },\n displayName: 'Command dialog',\n description: 'A short capture whose confirm button submits the command and only closes when it succeeded.',\n};\n\n/**\n * A confirmation dialog: one question, the consequence spelled out, and a way back.\n *\n * The Arc-aware `dialog` rather than PrimeReact's, because a caller `await`s a `DialogResult` from it\n * instead of threading `visible` state and callbacks by hand - which is the difference between a\n * confirmation you can call from a handler and one you have to wire into a component's state.\n *\n * The confirm label says what will happen rather than `OK`. A confirmation whose buttons are `OK` and\n * `Cancel` makes the reader map the question onto the answer under time pressure, which is exactly when\n * they will get it wrong.\n */\nexport const confirmDialogTemplate: DialogTemplate = {\n name: 'ConfirmDialog',\n slots: [{ name: TemplateSlotName.Body }],\n content: {\n [TemplateSlotName.Body]: [\n dialog('confirm-dialog', 'Void this invoice?', 'Void it', 'Keep it', [\n icon('confirm-dialog-icon', 'pi pi-exclamation-triangle'),\n inputTextField('confirm-dialog-reason', 'reason', 'Why is it being voided?', 'Duplicate of INV-2041'),\n ]),\n ],\n },\n displayName: 'Confirmation dialog',\n description: 'One question with the consequence spelled out, answered through Arc dialog context.',\n};\n\n/**\n * A busy dialog: the blocking spinner shown while a long-running command is in flight.\n *\n * In a running application the Arc dialog host renders this, threading its own title and message through.\n * Shipping it as a template is what lets its wording be *designed* rather than discovered the first time an\n * operation takes a while - which is the only moment anyone ever sees it, and the worst possible moment to\n * be reading a sentence nobody wrote on purpose.\n */\nexport const busyDialogTemplate: DialogTemplate = {\n name: 'BusyDialog',\n slots: [{ name: TemplateSlotName.Body }],\n content: {\n [TemplateSlotName.Body]: [\n busyIndicatorDialog('busy-dialog', 'Recording the adjustment', 'The invoice will reappear as soon as the read model catches up.'),\n ],\n },\n displayName: 'Busy dialog',\n description: 'The blocking spinner shown while a long-running command is in flight, with wording chosen up front.',\n};\n\n/** The dialog templates this blueprint provides. */\nexport const componentsDialogTemplates: DialogTemplate[] = [commandDialogTemplate, confirmDialogTemplate, busyDialogTemplate];\n"],"names":["commandDialogTemplate","name","slots","TemplateSlotName","Body","content","commandDialog","SampleBindingName","RecordAdjustment","numberField","inputTextField","calendarField","textAreaField","displayName","description","confirmDialogTemplate","dialog","icon","busyDialogTemplate","busyIndicatorDialog","componentsDialogTemplates"],"mappings":";;;;;;;;AAAA;AACA;AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;UA8BaA,qBAAAA,GAAwC;IACjDC,IAAAA,EAAM,eAAA;IACNC,KAAAA,EAAO;AAAC,QAAA;AAAED,YAAAA,IAAAA,EAAME,yCAAiBC;AAAK;AAAE,KAAA;IACxCC,OAAAA,EAAS;QACL,CAACF,wCAAAA,CAAiBC,IAAI,GAAG;AACrBE,YAAAA,4BAAAA,CAAc,gBAAA,EAAkBC,mCAAAA,CAAkBC,gBAAgB,EAAE,wBAAwB,QAAA,EAAU;AAClGC,gBAAAA,wBAAAA,CAAY,yBAAyB,QAAA,EAAU,QAAA,CAAA;gBAC/CC,2BAAAA,CAAe,uBAAA,EAAyB,UAAU,QAAA,EAAU,eAAA,CAAA;AAC5DC,gBAAAA,0BAAAA,CAAc,4BAA4B,WAAA,EAAa,gBAAA,CAAA;gBACvDC,0BAAAA,CAAc,qBAAA,EAAuB,QAAQ,MAAA,EAAQ,CAAA;AACxD,aAAA;AACJ;AACL,KAAA;IACAC,WAAAA,EAAa,gBAAA;IACbC,WAAAA,EAAa;AACjB;AAEA;;;;;;;;;;UAWaC,qBAAAA,GAAwC;IACjDd,IAAAA,EAAM,eAAA;IACNC,KAAAA,EAAO;AAAC,QAAA;AAAED,YAAAA,IAAAA,EAAME,yCAAiBC;AAAK;AAAE,KAAA;IACxCC,OAAAA,EAAS;QACL,CAACF,wCAAAA,CAAiBC,IAAI,GAAG;YACrBY,qBAAAA,CAAO,gBAAA,EAAkB,oBAAA,EAAsB,SAAA,EAAW,SAAA,EAAW;AACjEC,gBAAAA,aAAAA,CAAK,qBAAA,EAAuB,4BAAA,CAAA;gBAC5BP,2BAAAA,CAAe,uBAAA,EAAyB,UAAU,yBAAA,EAA2B,uBAAA;AAChF,aAAA;AACJ;AACL,KAAA;IACAG,WAAAA,EAAa,qBAAA;IACbC,WAAAA,EAAa;AACjB;AAEA;;;;;;;UAQaI,kBAAAA,GAAqC;IAC9CjB,IAAAA,EAAM,YAAA;IACNC,KAAAA,EAAO;AAAC,QAAA;AAAED,YAAAA,IAAAA,EAAME,yCAAiBC;AAAK;AAAE,KAAA;IACxCC,OAAAA,EAAS;QACL,CAACF,wCAAAA,CAAiBC,IAAI,GAAG;AACrBe,YAAAA,kCAAAA,CAAoB,eAAe,0BAAA,EAA4B,iEAAA;AAClE;AACL,KAAA;IACAN,WAAAA,EAAa,aAAA;IACbC,WAAAA,EAAa;AACjB;AAEA,qDACO,MAAMM,yBAAAA,GAA8C;AAACpB,IAAAA,qBAAAA;AAAuBe,IAAAA,qBAAAA;AAAuBG,IAAAA;;;;;;;;"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_blueprint_default = require('@cratis/scene.blueprint.default');
|
|
4
|
+
var CompositeName = require('../CompositeName.js');
|
|
5
|
+
var sampleData = require('./sampleData.js');
|
|
6
|
+
|
|
7
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
8
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
9
|
+
/**
|
|
10
|
+
* The Arc-free editing and inspection elements this blueprint's templates are built from.
|
|
11
|
+
*
|
|
12
|
+
* Unlike everything else in this package these need no binding at all - they take their content straight
|
|
13
|
+
* out of the property bag - so a template built from them renders as a working page with no host, no
|
|
14
|
+
* proxies and no backend. That is what makes the editor templates the ones to open first when looking at
|
|
15
|
+
* this blueprint.
|
|
16
|
+
*/ /**
|
|
17
|
+
* A JSON schema edited as a typed property tree rather than as text.
|
|
18
|
+
*
|
|
19
|
+
* `canEdit` and `canNotEditReason` belong together: in an event-sourced application a schema is very often
|
|
20
|
+
* deliberately read-only, and saying *why* in the same place is what keeps that from looking like a bug.
|
|
21
|
+
*/ function schemaEditor(id, eventTypeName, canEdit, canNotEditReason) {
|
|
22
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.SchemaEditor, {
|
|
23
|
+
schema: sampleData.invoiceSchema,
|
|
24
|
+
eventTypeName,
|
|
25
|
+
canEdit,
|
|
26
|
+
canNotEditReason,
|
|
27
|
+
editMode: canEdit
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** A document rendered against its schema, so nested values are navigable and each is edited by its declared type. */ function objectContentEditor(id, editMode) {
|
|
31
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.ObjectContentEditor, {
|
|
32
|
+
object: sampleData.invoiceDocument,
|
|
33
|
+
schema: sampleData.invoiceSchema,
|
|
34
|
+
editMode
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/** The trail saying where you are inside a nested document, and the way back out. */ function objectNavigationalBar(id) {
|
|
38
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.ObjectNavigationalBar, {
|
|
39
|
+
navigationPath: sampleData.invoiceNavigationPath
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The timeline of successive versions.
|
|
44
|
+
*
|
|
45
|
+
* Worth a place on a detail page in a way it would not be in a CRUD application: in an event-sourced
|
|
46
|
+
* system everything *has* a history rather than only a current value, so scrubbing through it is the
|
|
47
|
+
* natural way to look at a record rather than a special feature.
|
|
48
|
+
*/ function timeMachine(id) {
|
|
49
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.TimeMachine, {
|
|
50
|
+
versions: sampleData.invoiceVersions,
|
|
51
|
+
currentVersionIndex: 0
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The filter toggle and the panel it anchors, as one element.
|
|
56
|
+
*
|
|
57
|
+
* One element rather than two because `FilterPanel` is a portal anchored to a button - it renders next to
|
|
58
|
+
* whatever opened it, so it cannot be placed on its own, and the element tree has no way to express an
|
|
59
|
+
* anchor relationship. The adapter owns both halves, and a template places one thing.
|
|
60
|
+
*/ function filterPanel(id, label) {
|
|
61
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.FilterPanel, {
|
|
62
|
+
label,
|
|
63
|
+
filters: sampleData.invoiceFilters,
|
|
64
|
+
searchPlaceholder: 'Search filters'
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/** A standalone selection control, not bound to a command property. */ function dropdown(id, placeholder, options) {
|
|
68
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.Dropdown, {
|
|
69
|
+
placeholder,
|
|
70
|
+
options,
|
|
71
|
+
showClear: true
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
exports.dropdown = dropdown;
|
|
76
|
+
exports.filterPanel = filterPanel;
|
|
77
|
+
exports.objectContentEditor = objectContentEditor;
|
|
78
|
+
exports.objectNavigationalBar = objectNavigationalBar;
|
|
79
|
+
exports.schemaEditor = schemaEditor;
|
|
80
|
+
exports.timeMachine = timeMachine;
|
|
81
|
+
//# sourceMappingURL=editorElements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorElements.js","sources":["../../../templates/editorElements.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 { SceneElement } from '@cratis/scene.model';\nimport { externalComponent } from '@cratis/scene.blueprint.default';\nimport { CompositeName } from '../CompositeName';\nimport { invoiceDocument, invoiceFilters, invoiceNavigationPath, invoiceSchema, invoiceVersions } from './sampleData';\n\n/**\n * The Arc-free editing and inspection elements this blueprint's templates are built from.\n *\n * Unlike everything else in this package these need no binding at all - they take their content straight\n * out of the property bag - so a template built from them renders as a working page with no host, no\n * proxies and no backend. That is what makes the editor templates the ones to open first when looking at\n * this blueprint.\n */\n\n/**\n * A JSON schema edited as a typed property tree rather than as text.\n *\n * `canEdit` and `canNotEditReason` belong together: in an event-sourced application a schema is very often\n * deliberately read-only, and saying *why* in the same place is what keeps that from looking like a bug.\n */\nexport function schemaEditor(id: string, eventTypeName: string, canEdit: boolean, canNotEditReason?: string): SceneElement {\n return externalComponent(id, CompositeName.SchemaEditor, {\n schema: invoiceSchema,\n eventTypeName,\n canEdit,\n canNotEditReason,\n editMode: canEdit,\n });\n}\n\n/** A document rendered against its schema, so nested values are navigable and each is edited by its declared type. */\nexport function objectContentEditor(id: string, editMode: boolean): SceneElement {\n return externalComponent(id, CompositeName.ObjectContentEditor, { object: invoiceDocument, schema: invoiceSchema, editMode });\n}\n\n/** The trail saying where you are inside a nested document, and the way back out. */\nexport function objectNavigationalBar(id: string): SceneElement {\n return externalComponent(id, CompositeName.ObjectNavigationalBar, { navigationPath: invoiceNavigationPath });\n}\n\n/**\n * The timeline of successive versions.\n *\n * Worth a place on a detail page in a way it would not be in a CRUD application: in an event-sourced\n * system everything *has* a history rather than only a current value, so scrubbing through it is the\n * natural way to look at a record rather than a special feature.\n */\nexport function timeMachine(id: string): SceneElement {\n return externalComponent(id, CompositeName.TimeMachine, { versions: invoiceVersions, currentVersionIndex: 0 });\n}\n\n/**\n * The filter toggle and the panel it anchors, as one element.\n *\n * One element rather than two because `FilterPanel` is a portal anchored to a button - it renders next to\n * whatever opened it, so it cannot be placed on its own, and the element tree has no way to express an\n * anchor relationship. The adapter owns both halves, and a template places one thing.\n */\nexport function filterPanel(id: string, label: string): SceneElement {\n return externalComponent(id, CompositeName.FilterPanel, { label, filters: invoiceFilters, searchPlaceholder: 'Search filters' });\n}\n\n/** A standalone selection control, not bound to a command property. */\nexport function dropdown(id: string, placeholder: string, options: { label: string; value: string }[]): SceneElement {\n return externalComponent(id, CompositeName.Dropdown, { placeholder, options, showClear: true });\n}\n"],"names":["schemaEditor","id","eventTypeName","canEdit","canNotEditReason","externalComponent","CompositeName","SchemaEditor","schema","invoiceSchema","editMode","objectContentEditor","ObjectContentEditor","object","invoiceDocument","objectNavigationalBar","ObjectNavigationalBar","navigationPath","invoiceNavigationPath","timeMachine","TimeMachine","versions","invoiceVersions","currentVersionIndex","filterPanel","label","FilterPanel","filters","invoiceFilters","searchPlaceholder","dropdown","placeholder","options","Dropdown","showClear"],"mappings":";;;;;;AAAA;AACA;AAOA;;;;;;;;;;;;IAeO,SAASA,YAAAA,CAAaC,EAAU,EAAEC,aAAqB,EAAEC,OAAgB,EAAEC,gBAAyB,EAAA;AACvG,IAAA,OAAOC,yCAAAA,CAAkBJ,EAAAA,EAAIK,2BAAAA,CAAcC,YAAY,EAAE;QACrDC,MAAAA,EAAQC,wBAAAA;AACRP,QAAAA,aAAAA;AACAC,QAAAA,OAAAA;AACAC,QAAAA,gBAAAA;QACAM,QAAAA,EAAUP;AACd,KAAA,CAAA;AACJ;AAEA,uHACO,SAASQ,mBAAAA,CAAoBV,EAAU,EAAES,QAAiB,EAAA;AAC7D,IAAA,OAAOL,yCAAAA,CAAkBJ,EAAAA,EAAIK,2BAAAA,CAAcM,mBAAmB,EAAE;QAAEC,MAAAA,EAAQC,0BAAAA;QAAiBN,MAAAA,EAAQC,wBAAAA;AAAeC,QAAAA;AAAS,KAAA,CAAA;AAC/H;AAEA,sFACO,SAASK,qBAAAA,CAAsBd,EAAU,EAAA;AAC5C,IAAA,OAAOI,yCAAAA,CAAkBJ,EAAAA,EAAIK,2BAAAA,CAAcU,qBAAqB,EAAE;QAAEC,cAAAA,EAAgBC;AAAsB,KAAA,CAAA;AAC9G;AAEA;;;;;;IAOO,SAASC,WAAAA,CAAYlB,EAAU,EAAA;AAClC,IAAA,OAAOI,yCAAAA,CAAkBJ,EAAAA,EAAIK,2BAAAA,CAAcc,WAAW,EAAE;QAAEC,QAAAA,EAAUC,0BAAAA;QAAiBC,mBAAAA,EAAqB;AAAE,KAAA,CAAA;AAChH;AAEA;;;;;;AAMC,IACM,SAASC,WAAAA,CAAYvB,EAAU,EAAEwB,KAAa,EAAA;AACjD,IAAA,OAAOpB,yCAAAA,CAAkBJ,EAAAA,EAAIK,2BAAAA,CAAcoB,WAAW,EAAE;AAAED,QAAAA,KAAAA;QAAOE,OAAAA,EAASC,yBAAAA;QAAgBC,iBAAAA,EAAmB;AAAiB,KAAA,CAAA;AAClI;AAEA,wEACO,SAASC,QAAAA,CAAS7B,EAAU,EAAE8B,WAAmB,EAAEC,OAA2C,EAAA;AACjG,IAAA,OAAO3B,yCAAAA,CAAkBJ,EAAAA,EAAIK,2BAAAA,CAAc2B,QAAQ,EAAE;AAAEF,QAAAA,WAAAA;AAAaC,QAAAA,OAAAA;QAASE,SAAAA,EAAW;AAAK,KAAA,CAAA;AACjG;;;;;;;;;"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_model = require('@cratis/scene.model');
|
|
4
|
+
var scene_blueprint_default = require('@cratis/scene.blueprint.default');
|
|
5
|
+
var editorElements = require('./editorElements.js');
|
|
6
|
+
var elements = require('./elements.js');
|
|
7
|
+
var SampleBindingName = require('./SampleBindingName.js');
|
|
8
|
+
|
|
9
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
10
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
11
|
+
/**
|
|
12
|
+
* The two inspection pages: one for a type's shape, one for an instance's content.
|
|
13
|
+
*
|
|
14
|
+
* These are the templates to open first when looking at this blueprint, because they are the two that
|
|
15
|
+
* render completely with nothing registered. The schema editor, the document editor, the navigational bar
|
|
16
|
+
* and the time machine all read their content out of the property bag rather than from a query, so a
|
|
17
|
+
* preview of either page is a working page rather than a page of placeholders.
|
|
18
|
+
*
|
|
19
|
+
* That is not a trick to make a demo look better. It is the honest shape of the library: most of
|
|
20
|
+
* `@cratis/components` is Arc-bound and needs a host, and a meaningful part of it is not. A blueprint built
|
|
21
|
+
* on it should make both halves visible.
|
|
22
|
+
*/ /**
|
|
23
|
+
* The schema editor page: an event type's shape, edited as a typed property tree.
|
|
24
|
+
*
|
|
25
|
+
* Its header names no binding, and that is correct rather than an omission. A schema is design-time
|
|
26
|
+
* metadata about an event type, not a read model anyone queries, so there is nothing for the header to be
|
|
27
|
+
* bound to - and the header says `No binding` instead of implying a wiring step that does not exist. It is
|
|
28
|
+
* the one page in this package where the unbound state is the finished state.
|
|
29
|
+
*
|
|
30
|
+
* `canEdit` is paired with `canNotEditReason` deliberately: in an event-sourced application a stored event
|
|
31
|
+
* type's schema is very often deliberately locked, and saying why in the same place is what stops that
|
|
32
|
+
* from reading as a bug.
|
|
33
|
+
*/ const schemaEditorPageTemplate = {
|
|
34
|
+
name: 'SchemaEditorPage',
|
|
35
|
+
fitsSlot: scene_blueprint_default.SlotName.Content,
|
|
36
|
+
slots: [
|
|
37
|
+
{
|
|
38
|
+
name: scene_blueprint_default.TemplateSlotName.Header
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: scene_blueprint_default.TemplateSlotName.Toolbar
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: scene_blueprint_default.TemplateSlotName.Body
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
arrangement: {
|
|
48
|
+
root: scene_blueprint_default.column([
|
|
49
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Header),
|
|
50
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Toolbar),
|
|
51
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Body, {
|
|
52
|
+
grow: 1
|
|
53
|
+
})
|
|
54
|
+
], 16)
|
|
55
|
+
},
|
|
56
|
+
content: {
|
|
57
|
+
[scene_blueprint_default.TemplateSlotName.Header]: [
|
|
58
|
+
elements.arcPageHeader('schema-header', {
|
|
59
|
+
title: 'InvoiceRegistered',
|
|
60
|
+
subtitle: 'The shape of the event, and what a new generation would be allowed to change',
|
|
61
|
+
section: 'Event types'
|
|
62
|
+
})
|
|
63
|
+
],
|
|
64
|
+
[scene_blueprint_default.TemplateSlotName.Toolbar]: [
|
|
65
|
+
elements.toolbar('schema-toolbar', [
|
|
66
|
+
elements.toolbarButton('schema-edit', 'Edit the schema', 'pi pi-pencil', 'Edit'),
|
|
67
|
+
elements.toolbarButton('schema-generation', 'Start a new generation', 'pi pi-clone', 'New generation'),
|
|
68
|
+
elements.toolbarSeparator('schema-separator'),
|
|
69
|
+
elements.toolbarButton('schema-download', 'Download as JSON Schema', 'pi pi-download')
|
|
70
|
+
])
|
|
71
|
+
],
|
|
72
|
+
[scene_blueprint_default.TemplateSlotName.Body]: [
|
|
73
|
+
elements.page('schema-body', 'InvoiceRegistered', [
|
|
74
|
+
editorElements.schemaEditor('schema-editor', 'InvoiceRegistered', true)
|
|
75
|
+
])
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
displayName: 'Schema editor page',
|
|
79
|
+
description: "An event type's schema edited as a typed property tree, with the actions that evolve it."
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* The object editor page: one document, its trail, and its history beside it.
|
|
83
|
+
*
|
|
84
|
+
* Bound to `InvoiceById`, because that is what a real page like this is: you arrive with an id, the query
|
|
85
|
+
* fetches the record, and the editor renders it against its schema. The editors themselves take their
|
|
86
|
+
* content from the property bag, so the page is fully legible before the query is wired - and the header
|
|
87
|
+
* still says which query it is waiting for.
|
|
88
|
+
*
|
|
89
|
+
* The document is wrapped in an `errorBoundary` and the history is not, which is the decision this element
|
|
90
|
+
* exists to let a template make. A malformed document should cost the document region; it should not take
|
|
91
|
+
* the trail and the timeline down with it, and the timeline is the thing you would reach for to find out
|
|
92
|
+
* *when* the document became malformed.
|
|
93
|
+
*/ const objectEditorPageTemplate = {
|
|
94
|
+
name: 'ObjectEditorPage',
|
|
95
|
+
fitsSlot: scene_blueprint_default.SlotName.Content,
|
|
96
|
+
slots: [
|
|
97
|
+
{
|
|
98
|
+
name: scene_blueprint_default.TemplateSlotName.Header
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: scene_blueprint_default.TemplateSlotName.Toolbar
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: scene_blueprint_default.TemplateSlotName.Body
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: scene_blueprint_default.TemplateSlotName.SidePanel
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
arrangement: {
|
|
111
|
+
root: scene_blueprint_default.column([
|
|
112
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Header),
|
|
113
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Toolbar),
|
|
114
|
+
scene_blueprint_default.row([
|
|
115
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Body, {
|
|
116
|
+
grow: 2
|
|
117
|
+
}),
|
|
118
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.SidePanel, {
|
|
119
|
+
grow: 1
|
|
120
|
+
})
|
|
121
|
+
], 16)
|
|
122
|
+
]),
|
|
123
|
+
overrides: [
|
|
124
|
+
{
|
|
125
|
+
width: scene_model.WidthSizeClass.Compact,
|
|
126
|
+
root: scene_blueprint_default.column([
|
|
127
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Header),
|
|
128
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Toolbar),
|
|
129
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Body),
|
|
130
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.SidePanel)
|
|
131
|
+
], 16)
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
content: {
|
|
136
|
+
[scene_blueprint_default.TemplateSlotName.Header]: [
|
|
137
|
+
elements.arcPageHeader('object-header', {
|
|
138
|
+
title: 'INV-2043',
|
|
139
|
+
subtitle: 'The document as it stands, and every version it has been',
|
|
140
|
+
section: 'Billing',
|
|
141
|
+
query: SampleBindingName.SampleBindingName.InvoiceById
|
|
142
|
+
})
|
|
143
|
+
],
|
|
144
|
+
[scene_blueprint_default.TemplateSlotName.Toolbar]: [
|
|
145
|
+
editorElements.objectNavigationalBar('object-trail'),
|
|
146
|
+
editorElements.filterPanel('object-filters', 'Filters')
|
|
147
|
+
],
|
|
148
|
+
[scene_blueprint_default.TemplateSlotName.Body]: [
|
|
149
|
+
elements.errorBoundary('object-guard', [
|
|
150
|
+
elements.page('object-body', 'Document', [
|
|
151
|
+
editorElements.objectContentEditor('object-editor', true)
|
|
152
|
+
])
|
|
153
|
+
])
|
|
154
|
+
],
|
|
155
|
+
[scene_blueprint_default.TemplateSlotName.SidePanel]: [
|
|
156
|
+
elements.page('object-history', 'History', [
|
|
157
|
+
editorElements.timeMachine('object-time-machine')
|
|
158
|
+
])
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
displayName: 'Object editor page',
|
|
162
|
+
description: 'One document edited against its schema, with its navigation trail and its version history.'
|
|
163
|
+
};
|
|
164
|
+
/** The two editor-shaped templates. */ const editorTemplates = [
|
|
165
|
+
schemaEditorPageTemplate,
|
|
166
|
+
objectEditorPageTemplate
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
exports.editorTemplates = editorTemplates;
|
|
170
|
+
exports.objectEditorPageTemplate = objectEditorPageTemplate;
|
|
171
|
+
exports.schemaEditorPageTemplate = schemaEditorPageTemplate;
|
|
172
|
+
//# sourceMappingURL=editorTemplates.js.map
|