@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,97 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { SceneElement } from '@cratis/scene.model';
|
|
5
|
+
import { externalComponent } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { BorrowedComponentName } from '../BorrowedComponentName';
|
|
7
|
+
import { CompositeName } from '../CompositeName';
|
|
8
|
+
import { ColumnDefinition } from './ColumnDefinition';
|
|
9
|
+
import { TableOptions } from './TableOptions';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The Arc-bound data elements this blueprint's templates are built from.
|
|
13
|
+
*
|
|
14
|
+
* Each one is a single `ExternalComponent` carrying a query *name* in its property bag, which is the whole
|
|
15
|
+
* contract: `resolveElementBinding` in `@cratis/scene.components` reads that name out at render time and
|
|
16
|
+
* looks it up in the binding registry, and a name nothing is registered under renders as a placeholder
|
|
17
|
+
* naming what it wanted. Nothing here invents a second way to reach a backend, because there is only one
|
|
18
|
+
* and it belongs to the component library.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The columns of a data table, as the `content` slot children the library's tables take.
|
|
23
|
+
*
|
|
24
|
+
* The name is PrimeReact's rather than `Cratis.Components`' - see {@link BorrowedComponentName.Column} for
|
|
25
|
+
* why - and `sortable` is set on every column because a table that performs a real query can sort against
|
|
26
|
+
* the server, and a column that quietly cannot is the more surprising default.
|
|
27
|
+
*/
|
|
28
|
+
export function columns(id: string, definitions: ColumnDefinition[]): SceneElement[] {
|
|
29
|
+
return definitions.map(definition =>
|
|
30
|
+
externalComponent(`${id}-${definition.field}`, BorrowedComponentName.Column, {
|
|
31
|
+
field: definition.field,
|
|
32
|
+
header: definition.header,
|
|
33
|
+
sortable: true,
|
|
34
|
+
}),
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A `dataPage` - the library's whole list-screen composite, driven from one query.
|
|
40
|
+
*
|
|
41
|
+
* This is the archetype the package exists for. Reproducing it out of a table, a toolbar and a filter in a
|
|
42
|
+
* screen would be pages of modeling for a worse result, and every one of those pages would then be an
|
|
43
|
+
* application's to maintain. Here it is one element with a name in it.
|
|
44
|
+
*
|
|
45
|
+
* Its own `title` is deliberately empty. Every template in this package opens with an `arcPageHeader`, and
|
|
46
|
+
* that header already states the page's name, its trail and what it is bound to; letting the composite
|
|
47
|
+
* print the same word again directly underneath would be two sources for one fact, and they would
|
|
48
|
+
* disagree the first time either changed.
|
|
49
|
+
*/
|
|
50
|
+
export function dataPage(id: string, query: string, options: TableOptions, definitions: ColumnDefinition[]): SceneElement {
|
|
51
|
+
return externalComponent(id, CompositeName.DataPage, { query, title: '', ...options }, { content: columns(`${id}-column`, definitions) });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A `dataTable` - the same server-side querying without the page chrome around it.
|
|
56
|
+
*
|
|
57
|
+
* Used where a template already has a header of its own and only needs the rows, which is most places a
|
|
58
|
+
* table appears inside a larger page.
|
|
59
|
+
*/
|
|
60
|
+
export function dataTable(id: string, query: string, options: TableOptions, definitions: ColumnDefinition[]): SceneElement {
|
|
61
|
+
return externalComponent(id, CompositeName.DataTable, { query, ...options }, { content: columns(`${id}-column`, definitions) });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* An `observableDataTable` - the live variant.
|
|
66
|
+
*
|
|
67
|
+
* A separate element rather than a flag, because the difference is in the *proxy* a host registers: an
|
|
68
|
+
* observable query opens a subscription and re-renders when the read model changes, and a plain one does
|
|
69
|
+
* not. A template that names an observable query is stating that its data is live, which is a design
|
|
70
|
+
* decision worth being able to read off the page.
|
|
71
|
+
*/
|
|
72
|
+
export function observableDataTable(id: string, query: string, options: TableOptions, definitions: ColumnDefinition[]): SceneElement {
|
|
73
|
+
return externalComponent(id, CompositeName.ObservableDataTable, { query, ...options }, { content: columns(`${id}-column`, definitions) });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The columns of the invoice list every list-shaped template in this package shows. */
|
|
77
|
+
export const invoiceColumns: ColumnDefinition[] = [
|
|
78
|
+
{ field: 'number', header: 'Number' },
|
|
79
|
+
{ field: 'customer', header: 'Customer' },
|
|
80
|
+
{ field: 'issued', header: 'Issued' },
|
|
81
|
+
{ field: 'amount', header: 'Amount' },
|
|
82
|
+
{ field: 'status', header: 'Status' },
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
/** The columns of the adjustment list, for the templates that show one. */
|
|
86
|
+
export const adjustmentColumns: ColumnDefinition[] = [
|
|
87
|
+
{ field: 'recorded', header: 'Recorded' },
|
|
88
|
+
{ field: 'reason', header: 'Reason' },
|
|
89
|
+
{ field: 'amount', header: 'Amount' },
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
/** The table options an invoice list uses, so eight templates cannot disagree about the empty message. */
|
|
93
|
+
export const invoiceTableOptions: TableOptions = {
|
|
94
|
+
emptyMessage: 'No invoices yet',
|
|
95
|
+
dataKey: 'invoiceId',
|
|
96
|
+
globalFilterFields: ['number', 'customer', 'status'],
|
|
97
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { SceneElement } from '@cratis/scene.model';
|
|
5
|
+
import { externalComponent } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { CompositeName } from '../CompositeName';
|
|
7
|
+
|
|
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
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The Arc-aware dialog: a frame whose result resolves through Arc's dialog context.
|
|
20
|
+
*
|
|
21
|
+
* Worth shadowing PrimeReact's `dialog` for. PrimeReact's is a modal frame and nothing more; this one lets
|
|
22
|
+
* a caller `await` a `DialogResult` instead of threading `visible` state and callbacks by hand, which is
|
|
23
|
+
* the difference between a dialog you can call and a dialog you have to wire.
|
|
24
|
+
*
|
|
25
|
+
* `visible` is left at the adapter's default of `true`, because a dialog placed in a template is placed to
|
|
26
|
+
* be seen; a host that drives visibility sets the property itself.
|
|
27
|
+
*/
|
|
28
|
+
export function dialog(id: string, title: string, okLabel: string, cancelLabel: string, content: SceneElement[]): SceneElement {
|
|
29
|
+
return externalComponent(id, CompositeName.Dialog, { title, okLabel, cancelLabel, width: '28rem' }, { content });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A dialog whose confirm button *is* the command's execution.
|
|
34
|
+
*
|
|
35
|
+
* Worth using instead of composing `dialog` with `commandForm`, because a hand-composed pair has no way to
|
|
36
|
+
* keep the dialog open on a rejected command without reimplementing the protocol: this one submits, feeds
|
|
37
|
+
* the backend's validation results back onto the fields, and only closes when the command succeeded.
|
|
38
|
+
*/
|
|
39
|
+
export function commandDialog(id: string, command: string, title: string, okLabel: string, fields: SceneElement[]): SceneElement {
|
|
40
|
+
return externalComponent(id, CompositeName.CommandDialog, { command, title, okLabel, cancelLabel: 'Cancel', width: '32rem' }, { content: fields });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The blocking spinner shown while a long-running command is in flight.
|
|
45
|
+
*
|
|
46
|
+
* In a running application it is the Arc dialog host that renders this, threading its own title and
|
|
47
|
+
* message through. Shipping it as a template is what lets its wording and placement be *designed* rather
|
|
48
|
+
* than discovered the first time an operation takes a while - which is the only moment anyone ever sees it,
|
|
49
|
+
* and the worst moment to be reading a sentence nobody wrote on purpose.
|
|
50
|
+
*/
|
|
51
|
+
export function busyIndicatorDialog(id: string, title: string, message: string): SceneElement {
|
|
52
|
+
return externalComponent(id, CompositeName.BusyIndicatorDialog, { title, message });
|
|
53
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { DialogTemplate } from '@cratis/scene.model';
|
|
5
|
+
import { TemplateSlotName } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { busyIndicatorDialog, commandDialog, dialog } from './dialogElements';
|
|
7
|
+
import { icon } from './elements';
|
|
8
|
+
import { calendarField, inputTextField, numberField, textAreaField } from './formElements';
|
|
9
|
+
import { SampleBindingName } from './SampleBindingName';
|
|
10
|
+
|
|
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
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A command dialog: a short capture whose confirm button is the command's execution.
|
|
31
|
+
*
|
|
32
|
+
* Worth reaching for instead of composing `dialog` with `commandForm`, because a hand-composed pair has no
|
|
33
|
+
* way to keep the dialog open on a rejected command without reimplementing the protocol. This one submits,
|
|
34
|
+
* feeds the backend's validation results back onto the fields, and only closes when the command succeeded.
|
|
35
|
+
*
|
|
36
|
+
* The fields are placed by hand rather than generated, which is the opposite choice from `CommandFormPage`
|
|
37
|
+
* and deliberate. A dialog is a *short* capture: three or four properties chosen because they are the ones
|
|
38
|
+
* a person can answer in an overlay. Generating every property of the command would turn an overlay into a
|
|
39
|
+
* page, which is precisely the decision a dialog is supposed to have already made.
|
|
40
|
+
*/
|
|
41
|
+
export const commandDialogTemplate: DialogTemplate = {
|
|
42
|
+
name: 'CommandDialog',
|
|
43
|
+
slots: [{ name: TemplateSlotName.Body }],
|
|
44
|
+
content: {
|
|
45
|
+
[TemplateSlotName.Body]: [
|
|
46
|
+
commandDialog('command-dialog', SampleBindingName.RecordAdjustment, 'Record an adjustment', 'Record', [
|
|
47
|
+
numberField('command-dialog-amount', 'amount', 'Amount'),
|
|
48
|
+
inputTextField('command-dialog-reason', 'reason', 'Reason', 'Damaged goods'),
|
|
49
|
+
calendarField('command-dialog-effective', 'effective', 'Effective from'),
|
|
50
|
+
textAreaField('command-dialog-note', 'note', 'Note', 3),
|
|
51
|
+
]),
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
displayName: 'Command dialog',
|
|
55
|
+
description: 'A short capture whose confirm button submits the command and only closes when it succeeded.',
|
|
56
|
+
};
|
|
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
|
+
*/
|
|
69
|
+
export const confirmDialogTemplate: DialogTemplate = {
|
|
70
|
+
name: 'ConfirmDialog',
|
|
71
|
+
slots: [{ name: TemplateSlotName.Body }],
|
|
72
|
+
content: {
|
|
73
|
+
[TemplateSlotName.Body]: [
|
|
74
|
+
dialog('confirm-dialog', 'Void this invoice?', 'Void it', 'Keep it', [
|
|
75
|
+
icon('confirm-dialog-icon', 'pi pi-exclamation-triangle'),
|
|
76
|
+
inputTextField('confirm-dialog-reason', 'reason', 'Why is it being voided?', 'Duplicate of INV-2041'),
|
|
77
|
+
]),
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
displayName: 'Confirmation dialog',
|
|
81
|
+
description: 'One question with the consequence spelled out, answered through Arc dialog context.',
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* A busy dialog: the blocking spinner shown while a long-running command is in flight.
|
|
86
|
+
*
|
|
87
|
+
* In a running application the Arc dialog host renders this, threading its own title and message through.
|
|
88
|
+
* Shipping it as a template is what lets its wording be *designed* rather than discovered the first time an
|
|
89
|
+
* operation takes a while - which is the only moment anyone ever sees it, and the worst possible moment to
|
|
90
|
+
* be reading a sentence nobody wrote on purpose.
|
|
91
|
+
*/
|
|
92
|
+
export const busyDialogTemplate: DialogTemplate = {
|
|
93
|
+
name: 'BusyDialog',
|
|
94
|
+
slots: [{ name: TemplateSlotName.Body }],
|
|
95
|
+
content: {
|
|
96
|
+
[TemplateSlotName.Body]: [
|
|
97
|
+
busyIndicatorDialog('busy-dialog', 'Recording the adjustment', 'The invoice will reappear as soon as the read model catches up.'),
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
displayName: 'Busy dialog',
|
|
101
|
+
description: 'The blocking spinner shown while a long-running command is in flight, with wording chosen up front.',
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/** The dialog templates this blueprint provides. */
|
|
105
|
+
export const componentsDialogTemplates: DialogTemplate[] = [commandDialogTemplate, confirmDialogTemplate, busyDialogTemplate];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { SceneElement } from '@cratis/scene.model';
|
|
5
|
+
import { externalComponent } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { CompositeName } from '../CompositeName';
|
|
7
|
+
import { invoiceDocument, invoiceFilters, invoiceNavigationPath, invoiceSchema, invoiceVersions } from './sampleData';
|
|
8
|
+
|
|
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
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A JSON schema edited as a typed property tree rather than as text.
|
|
20
|
+
*
|
|
21
|
+
* `canEdit` and `canNotEditReason` belong together: in an event-sourced application a schema is very often
|
|
22
|
+
* deliberately read-only, and saying *why* in the same place is what keeps that from looking like a bug.
|
|
23
|
+
*/
|
|
24
|
+
export function schemaEditor(id: string, eventTypeName: string, canEdit: boolean, canNotEditReason?: string): SceneElement {
|
|
25
|
+
return externalComponent(id, CompositeName.SchemaEditor, {
|
|
26
|
+
schema: invoiceSchema,
|
|
27
|
+
eventTypeName,
|
|
28
|
+
canEdit,
|
|
29
|
+
canNotEditReason,
|
|
30
|
+
editMode: canEdit,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** A document rendered against its schema, so nested values are navigable and each is edited by its declared type. */
|
|
35
|
+
export function objectContentEditor(id: string, editMode: boolean): SceneElement {
|
|
36
|
+
return externalComponent(id, CompositeName.ObjectContentEditor, { object: invoiceDocument, schema: invoiceSchema, editMode });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The trail saying where you are inside a nested document, and the way back out. */
|
|
40
|
+
export function objectNavigationalBar(id: string): SceneElement {
|
|
41
|
+
return externalComponent(id, CompositeName.ObjectNavigationalBar, { navigationPath: invoiceNavigationPath });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The timeline of successive versions.
|
|
46
|
+
*
|
|
47
|
+
* Worth a place on a detail page in a way it would not be in a CRUD application: in an event-sourced
|
|
48
|
+
* system everything *has* a history rather than only a current value, so scrubbing through it is the
|
|
49
|
+
* natural way to look at a record rather than a special feature.
|
|
50
|
+
*/
|
|
51
|
+
export function timeMachine(id: string): SceneElement {
|
|
52
|
+
return externalComponent(id, CompositeName.TimeMachine, { versions: invoiceVersions, currentVersionIndex: 0 });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The filter toggle and the panel it anchors, as one element.
|
|
57
|
+
*
|
|
58
|
+
* One element rather than two because `FilterPanel` is a portal anchored to a button - it renders next to
|
|
59
|
+
* whatever opened it, so it cannot be placed on its own, and the element tree has no way to express an
|
|
60
|
+
* anchor relationship. The adapter owns both halves, and a template places one thing.
|
|
61
|
+
*/
|
|
62
|
+
export function filterPanel(id: string, label: string): SceneElement {
|
|
63
|
+
return externalComponent(id, CompositeName.FilterPanel, { label, filters: invoiceFilters, searchPlaceholder: 'Search filters' });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** A standalone selection control, not bound to a command property. */
|
|
67
|
+
export function dropdown(id: string, placeholder: string, options: { label: string; value: string }[]): SceneElement {
|
|
68
|
+
return externalComponent(id, CompositeName.Dropdown, { placeholder, options, showClear: true });
|
|
69
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ScreenTemplate, WidthSizeClass } from '@cratis/scene.model';
|
|
5
|
+
import { SlotName, TemplateSlotName, column, row, slotLeaf } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { filterPanel, objectContentEditor, objectNavigationalBar, schemaEditor, timeMachine } from './editorElements';
|
|
7
|
+
import { arcPageHeader, errorBoundary, page, toolbar, toolbarButton, toolbarSeparator } from './elements';
|
|
8
|
+
import { SampleBindingName } from './SampleBindingName';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The two inspection pages: one for a type's shape, one for an instance's content.
|
|
12
|
+
*
|
|
13
|
+
* These are the templates to open first when looking at this blueprint, because they are the two that
|
|
14
|
+
* render completely with nothing registered. The schema editor, the document editor, the navigational bar
|
|
15
|
+
* and the time machine all read their content out of the property bag rather than from a query, so a
|
|
16
|
+
* preview of either page is a working page rather than a page of placeholders.
|
|
17
|
+
*
|
|
18
|
+
* That is not a trick to make a demo look better. It is the honest shape of the library: most of
|
|
19
|
+
* `@cratis/components` is Arc-bound and needs a host, and a meaningful part of it is not. A blueprint built
|
|
20
|
+
* on it should make both halves visible.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The schema editor page: an event type's shape, edited as a typed property tree.
|
|
25
|
+
*
|
|
26
|
+
* Its header names no binding, and that is correct rather than an omission. A schema is design-time
|
|
27
|
+
* metadata about an event type, not a read model anyone queries, so there is nothing for the header to be
|
|
28
|
+
* bound to - and the header says `No binding` instead of implying a wiring step that does not exist. It is
|
|
29
|
+
* the one page in this package where the unbound state is the finished state.
|
|
30
|
+
*
|
|
31
|
+
* `canEdit` is paired with `canNotEditReason` deliberately: in an event-sourced application a stored event
|
|
32
|
+
* type's schema is very often deliberately locked, and saying why in the same place is what stops that
|
|
33
|
+
* from reading as a bug.
|
|
34
|
+
*/
|
|
35
|
+
export const schemaEditorPageTemplate: ScreenTemplate = {
|
|
36
|
+
name: 'SchemaEditorPage',
|
|
37
|
+
fitsSlot: SlotName.Content,
|
|
38
|
+
slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Toolbar }, { name: TemplateSlotName.Body }],
|
|
39
|
+
arrangement: {
|
|
40
|
+
root: column([slotLeaf(TemplateSlotName.Header), slotLeaf(TemplateSlotName.Toolbar), slotLeaf(TemplateSlotName.Body, { grow: 1 })], 16),
|
|
41
|
+
},
|
|
42
|
+
content: {
|
|
43
|
+
[TemplateSlotName.Header]: [
|
|
44
|
+
arcPageHeader('schema-header', {
|
|
45
|
+
title: 'InvoiceRegistered',
|
|
46
|
+
subtitle: 'The shape of the event, and what a new generation would be allowed to change',
|
|
47
|
+
section: 'Event types',
|
|
48
|
+
}),
|
|
49
|
+
],
|
|
50
|
+
[TemplateSlotName.Toolbar]: [
|
|
51
|
+
toolbar('schema-toolbar', [
|
|
52
|
+
toolbarButton('schema-edit', 'Edit the schema', 'pi pi-pencil', 'Edit'),
|
|
53
|
+
toolbarButton('schema-generation', 'Start a new generation', 'pi pi-clone', 'New generation'),
|
|
54
|
+
toolbarSeparator('schema-separator'),
|
|
55
|
+
toolbarButton('schema-download', 'Download as JSON Schema', 'pi pi-download'),
|
|
56
|
+
]),
|
|
57
|
+
],
|
|
58
|
+
[TemplateSlotName.Body]: [
|
|
59
|
+
page('schema-body', 'InvoiceRegistered', [schemaEditor('schema-editor', 'InvoiceRegistered', true)]),
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
displayName: 'Schema editor page',
|
|
63
|
+
description: "An event type's schema edited as a typed property tree, with the actions that evolve it.",
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The object editor page: one document, its trail, and its history beside it.
|
|
68
|
+
*
|
|
69
|
+
* Bound to `InvoiceById`, because that is what a real page like this is: you arrive with an id, the query
|
|
70
|
+
* fetches the record, and the editor renders it against its schema. The editors themselves take their
|
|
71
|
+
* content from the property bag, so the page is fully legible before the query is wired - and the header
|
|
72
|
+
* still says which query it is waiting for.
|
|
73
|
+
*
|
|
74
|
+
* The document is wrapped in an `errorBoundary` and the history is not, which is the decision this element
|
|
75
|
+
* exists to let a template make. A malformed document should cost the document region; it should not take
|
|
76
|
+
* the trail and the timeline down with it, and the timeline is the thing you would reach for to find out
|
|
77
|
+
* *when* the document became malformed.
|
|
78
|
+
*/
|
|
79
|
+
export const objectEditorPageTemplate: ScreenTemplate = {
|
|
80
|
+
name: 'ObjectEditorPage',
|
|
81
|
+
fitsSlot: SlotName.Content,
|
|
82
|
+
slots: [
|
|
83
|
+
{ name: TemplateSlotName.Header },
|
|
84
|
+
{ name: TemplateSlotName.Toolbar },
|
|
85
|
+
{ name: TemplateSlotName.Body },
|
|
86
|
+
{ name: TemplateSlotName.SidePanel },
|
|
87
|
+
],
|
|
88
|
+
arrangement: {
|
|
89
|
+
root: column([
|
|
90
|
+
slotLeaf(TemplateSlotName.Header),
|
|
91
|
+
slotLeaf(TemplateSlotName.Toolbar),
|
|
92
|
+
row([slotLeaf(TemplateSlotName.Body, { grow: 2 }), slotLeaf(TemplateSlotName.SidePanel, { grow: 1 })], 16),
|
|
93
|
+
]),
|
|
94
|
+
overrides: [
|
|
95
|
+
{
|
|
96
|
+
width: WidthSizeClass.Compact,
|
|
97
|
+
root: column(
|
|
98
|
+
[
|
|
99
|
+
slotLeaf(TemplateSlotName.Header),
|
|
100
|
+
slotLeaf(TemplateSlotName.Toolbar),
|
|
101
|
+
slotLeaf(TemplateSlotName.Body),
|
|
102
|
+
slotLeaf(TemplateSlotName.SidePanel),
|
|
103
|
+
],
|
|
104
|
+
16,
|
|
105
|
+
),
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
content: {
|
|
110
|
+
[TemplateSlotName.Header]: [
|
|
111
|
+
arcPageHeader('object-header', {
|
|
112
|
+
title: 'INV-2043',
|
|
113
|
+
subtitle: 'The document as it stands, and every version it has been',
|
|
114
|
+
section: 'Billing',
|
|
115
|
+
query: SampleBindingName.InvoiceById,
|
|
116
|
+
}),
|
|
117
|
+
],
|
|
118
|
+
[TemplateSlotName.Toolbar]: [objectNavigationalBar('object-trail'), filterPanel('object-filters', 'Filters')],
|
|
119
|
+
[TemplateSlotName.Body]: [
|
|
120
|
+
errorBoundary('object-guard', [page('object-body', 'Document', [objectContentEditor('object-editor', true)])]),
|
|
121
|
+
],
|
|
122
|
+
[TemplateSlotName.SidePanel]: [page('object-history', 'History', [timeMachine('object-time-machine')])],
|
|
123
|
+
},
|
|
124
|
+
displayName: 'Object editor page',
|
|
125
|
+
description: 'One document edited against its schema, with its navigation trail and its version history.',
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/** The two editor-shaped templates. */
|
|
129
|
+
export const editorTemplates: ScreenTemplate[] = [schemaEditorPageTemplate, objectEditorPageTemplate];
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { SceneElement } from '@cratis/scene.model';
|
|
5
|
+
import { externalComponent } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { ComponentName } from '../ComponentName';
|
|
7
|
+
import { CompositeName } from '../CompositeName';
|
|
8
|
+
import { ArcHeaderOptions } from './ArcHeaderOptions';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The page furniture every template in this package repeats.
|
|
12
|
+
*
|
|
13
|
+
* `externalComponent` is imported from the default blueprint rather than written again, and that is worth
|
|
14
|
+
* pausing on: `ExternalComponent` inherits fifteen required members before it reaches the two a template
|
|
15
|
+
* author cares about, so a package that redeclared those defaults would be maintaining a second copy of a
|
|
16
|
+
* decision it does not own. Borrowing the builder is the same choice as depending on the shell - this
|
|
17
|
+
* blueprint layers on the default one, so it uses its parts.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* This blueprint's page header, given its heading and the one binding the page is about.
|
|
22
|
+
*
|
|
23
|
+
* Every template opens with one. The header derives the trail and the design-time binding state itself, so
|
|
24
|
+
* a template states the page's subject once instead of repeating it in a title, a trail and a table.
|
|
25
|
+
*/
|
|
26
|
+
export function arcPageHeader(id: string, options: ArcHeaderOptions, actions: SceneElement[] = []): SceneElement {
|
|
27
|
+
return externalComponent(id, ComponentName.ArcPageHeader, { ...options }, { actions });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The library's `page` primitive wrapping content.
|
|
32
|
+
*
|
|
33
|
+
* A `div` would have done structurally, and would have been wrong: `page` is the full-height flex column
|
|
34
|
+
* every other component in `@cratis/components` is laid out inside, drawn from the same `--cratis-*`
|
|
35
|
+
* tokens as the tables and dialogs it contains. Content wrapped in it gets that consistency for free, and
|
|
36
|
+
* content wrapped in a `div` has to reinvent it and will drift.
|
|
37
|
+
*/
|
|
38
|
+
export function page(id: string, title: string, content: SceneElement[], panel = true): SceneElement {
|
|
39
|
+
return externalComponent(id, CompositeName.Page, { title, showTitle: title.length > 0, panel }, { content });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** One button in a tool palette. `title` is the accessible name as well as the tooltip, so it is never omitted. */
|
|
43
|
+
export function toolbarButton(id: string, title: string, icon: string, text?: string): SceneElement {
|
|
44
|
+
return externalComponent(id, CompositeName.ToolbarButton, { title, icon, text });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Related buttons kept together inside a toolbar. */
|
|
48
|
+
export function toolbarGroup(id: string, buttons: SceneElement[]): SceneElement {
|
|
49
|
+
return externalComponent(id, CompositeName.ToolbarGroup, { orientation: 'horizontal' }, { content: buttons });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The divider between groups of tools. */
|
|
53
|
+
export function toolbarSeparator(id: string): SceneElement {
|
|
54
|
+
return externalComponent(id, CompositeName.ToolbarSeparator, { orientation: 'horizontal' });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A horizontal tool palette.
|
|
59
|
+
*
|
|
60
|
+
* `draggable` is deliberately left off rather than set per button - it is a property of the palette, and
|
|
61
|
+
* setting it per button is how you end up with a palette that is half draggable.
|
|
62
|
+
*/
|
|
63
|
+
export function toolbar(id: string, content: SceneElement[]): SceneElement {
|
|
64
|
+
return externalComponent(id, CompositeName.Toolbar, { orientation: 'horizontal' }, { content });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Scopes a failure to one region of a page.
|
|
69
|
+
*
|
|
70
|
+
* React's default is that a throw anywhere unmounts the whole tree, which on a composed screen means one
|
|
71
|
+
* broken widget takes the navigation with it. Which regions deserve a boundary is a decision about the
|
|
72
|
+
* page, which is exactly why it belongs in a template rather than in the renderer.
|
|
73
|
+
*/
|
|
74
|
+
export function errorBoundary(id: string, content: SceneElement[]): SceneElement {
|
|
75
|
+
return externalComponent(id, CompositeName.ErrorBoundary, {}, { content });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** An icon, given a PrimeIcons class name. */
|
|
79
|
+
export function icon(id: string, iconName: string): SceneElement {
|
|
80
|
+
return externalComponent(id, CompositeName.Icon, { icon: iconName });
|
|
81
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { SceneElement } from '@cratis/scene.model';
|
|
5
|
+
import { externalComponent } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { CompositeName } from '../CompositeName';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The Arc-bound form elements this blueprint's templates are built from.
|
|
10
|
+
*
|
|
11
|
+
* Every field carries a `property` name, which the library turns into an accessor onto the command
|
|
12
|
+
* instance. That indirection is not incidental: a hand-written form binds a field with
|
|
13
|
+
* `value={command => command.number}` and is typechecked against the generated proxy, and a template has
|
|
14
|
+
* no types to check against because it is data. The name is what survives, so the name is what a field
|
|
15
|
+
* carries.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A whole form generated from the command's own property descriptors.
|
|
20
|
+
*
|
|
21
|
+
* `commandForm` is `AutoCommandForm`, not `CommandForm`, and that is what makes it worth shipping in a
|
|
22
|
+
* template at all: a template that listed every field by hand would go stale the moment a property was
|
|
23
|
+
* added to the command on the backend, and a stale template is worse than no template. This one follows
|
|
24
|
+
* the command, which is the same guarantee Arc's generated proxies give the rest of the stack.
|
|
25
|
+
*
|
|
26
|
+
* @param exclude Properties the surrounding template places itself, so the generated form does not produce a second copy.
|
|
27
|
+
*/
|
|
28
|
+
export function commandForm(id: string, command: string, exclude?: string[]): SceneElement {
|
|
29
|
+
return externalComponent(id, CompositeName.CommandForm, { command, exclude });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** A single-line text field bound to one command property. */
|
|
33
|
+
export function inputTextField(id: string, property: string, title: string, placeholder?: string): SceneElement {
|
|
34
|
+
return externalComponent(id, CompositeName.InputTextField, { property, title, placeholder });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** A numeric field bound to one command property. */
|
|
38
|
+
export function numberField(id: string, property: string, title: string): SceneElement {
|
|
39
|
+
return externalComponent(id, CompositeName.NumberField, { property, title });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** A multi-line text field bound to one command property. */
|
|
43
|
+
export function textAreaField(id: string, property: string, title: string, rows = 3): SceneElement {
|
|
44
|
+
return externalComponent(id, CompositeName.TextAreaField, { property, title, rows });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** A date field bound to one command property. */
|
|
48
|
+
export function calendarField(id: string, property: string, title: string): SceneElement {
|
|
49
|
+
return externalComponent(id, CompositeName.CalendarField, { property, title });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A single-selection field over a list the template carries inline.
|
|
54
|
+
*
|
|
55
|
+
* Inline options only. A list that has to come from the backend is a different thing entirely - bind it to
|
|
56
|
+
* a query - because a property bag is the wrong place for data, and a template that embedded a real
|
|
57
|
+
* lookup table would be shipping someone else's reference data.
|
|
58
|
+
*/
|
|
59
|
+
export function dropdownField(id: string, property: string, title: string, options: { label: string; value: string }[]): SceneElement {
|
|
60
|
+
return externalComponent(id, CompositeName.DropdownField, { property, title, options });
|
|
61
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
export * from './SampleBindingName';
|
|
5
|
+
export * from './ColumnDefinition';
|
|
6
|
+
export * from './TableOptions';
|
|
7
|
+
export * from './ArcHeaderOptions';
|
|
8
|
+
export * from './sampleData';
|
|
9
|
+
export * from './elements';
|
|
10
|
+
export * from './dataElements';
|
|
11
|
+
export * from './formElements';
|
|
12
|
+
export * from './dialogElements';
|
|
13
|
+
export * from './editorElements';
|
|
14
|
+
export * from './listTemplates';
|
|
15
|
+
export * from './workspaceTemplates';
|
|
16
|
+
export * from './commandTemplates';
|
|
17
|
+
export * from './editorTemplates';
|
|
18
|
+
export * from './nesting';
|
|
19
|
+
export * from './dialogTemplates';
|
|
20
|
+
export * from './screenTemplates';
|