@c8y/tutorial 1019.0.3
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/.browserslistrc +16 -0
- package/NOTICES +41743 -0
- package/cumulocity.config.ts +643 -0
- package/package.json +22 -0
- package/src/__mocks/README.md +73 -0
- package/src/__mocks/global-mocks/inventory.interceptor.ts +145 -0
- package/src/__mocks/global-mocks/measurements.interceptor.ts +58 -0
- package/src/__mocks/index.ts +5 -0
- package/src/__mocks/mock.model.ts +76 -0
- package/src/__mocks/mock.module.ts +121 -0
- package/src/__mocks/mock.realtime-subject.ts +68 -0
- package/src/__mocks/mock.realtime.ts +31 -0
- package/src/__mocks/mock.service.ts +113 -0
- package/src/__mocks/scoped-mocks/boilerplate.ts +54 -0
- package/src/__mocks/scoped-mocks/context-dashboard.ts +47 -0
- package/src/__mocks/scoped-mocks/device-data-grid.ts +44 -0
- package/src/__mocks/scoped-mocks/named-context-dashboard.ts +42 -0
- package/src/__mocks/scoped-mocks/server-side-data-grid.ts +47 -0
- package/src/__mocks/scoped-mocks/service-dashboard.ts +42 -0
- package/src/__mocks/utils/clean.realtime.ts +23 -0
- package/src/__mocks/utils/common.ts +114 -0
- package/src/__mocks/utils/generators/alarms.ts +30 -0
- package/src/__mocks/utils/generators/events.ts +14 -0
- package/src/__mocks/utils/generators/managedObjects.ts +208 -0
- package/src/__mocks/utils/generators/measurement.ts +22 -0
- package/src/__mocks/utils/generators/operations.ts +67 -0
- package/src/__mocks/utils/grid.ts +87 -0
- package/src/__mocks/utils/realtime.ts +59 -0
- package/src/alert/alert-example.components.html +110 -0
- package/src/alert/alert-example.components.ts +77 -0
- package/src/alert/alert-example.module.ts +21 -0
- package/src/app/app.module.ts +72 -0
- package/src/bootstrap.ts +19 -0
- package/src/branding/branding.less +78 -0
- package/src/client-interceptor/client-interceptor.module.ts +12 -0
- package/src/client-interceptor/client-interceptor.service.ts +61 -0
- package/src/client-interceptor/index.ts +1 -0
- package/src/component-styles/cascading-style-sheets-example/cascading-style-sheets-example.component.css +17 -0
- package/src/component-styles/cascading-style-sheets-example/cascading-style-sheets-example.component.ts +11 -0
- package/src/component-styles/cascading-style-sheets-example/cascading-style-sheets-example.module.ts +26 -0
- package/src/component-styles/leaner-style-sheets-example/leaner-style-sheets-example.component.less +14 -0
- package/src/component-styles/leaner-style-sheets-example/leaner-style-sheets-example.component.ts +11 -0
- package/src/component-styles/leaner-style-sheets-example/leaner-style-sheets-example.module.ts +26 -0
- package/src/component-styles/syntactically-awesome-style-sheets-example/syntactically-awesome-style-sheets-example.component.scss +13 -0
- package/src/component-styles/syntactically-awesome-style-sheets-example/syntactically-awesome-style-sheets-example.component.ts +11 -0
- package/src/component-styles/syntactically-awesome-style-sheets-example/syntactically-awesome-style-sheets-example.module.ts +26 -0
- package/src/dashboard/context-dashboard/context-dashboard.component.ts +32 -0
- package/src/dashboard/context-dashboard/context-dashboard.module.ts +22 -0
- package/src/dashboard/custom-dashboard/custom-dashboard.component.html +180 -0
- package/src/dashboard/custom-dashboard/custom-dashboard.component.ts +52 -0
- package/src/dashboard/custom-dashboard/custom-dashboard.module.ts +22 -0
- package/src/dashboard/index.ts +4 -0
- package/src/dashboard/named-context-dashboard/named-context-dashboard.component.ts +51 -0
- package/src/dashboard/named-context-dashboard/named-context-dashboard.module.ts +37 -0
- package/src/dashboard/service-dashboard/service-dashboard.component.ts +51 -0
- package/src/dashboard/service-dashboard/service-dashboard.module.ts +35 -0
- package/src/dashboard/widget-dashboard/widget-dashboard.component.ts +65 -0
- package/src/dashboard/widget-dashboard/widget-dashboard.module.ts +22 -0
- package/src/date-time-range/date-time-range-example.component.ts +109 -0
- package/src/date-time-range/date-time-range-example.module.ts +21 -0
- package/src/dynamic-forms/custom-element-example/custom-element-example.component.ts +70 -0
- package/src/dynamic-forms/custom-element-example/custom-element-example.module.ts +38 -0
- package/src/dynamic-forms/custom-element-example/types/checkbox/checkbox.type.component.html +26 -0
- package/src/dynamic-forms/custom-element-example/types/checkbox/checkbox.type.component.ts +21 -0
- package/src/dynamic-forms/dynamic-forms.module.ts +16 -0
- package/src/dynamic-forms/index.ts +2 -0
- package/src/dynamic-forms/introduction-example/introduction-example.component.ts +116 -0
- package/src/dynamic-forms/introduction-example/introduction-example.module.ts +24 -0
- package/src/dynamic-forms/json-schema-example/json-schema-example.component.html +33 -0
- package/src/dynamic-forms/json-schema-example/json-schema-example.component.ts +102 -0
- package/src/dynamic-forms/json-schema-example/json-schema-example.module.ts +24 -0
- package/src/for-of-directive/for-of-example.component.html +19 -0
- package/src/for-of-directive/for-of-example.component.ts +39 -0
- package/src/for-of-directive/for-of.module.ts +18 -0
- package/src/forms/form-validation/forms-validation.component.html +105 -0
- package/src/forms/form-validation/forms-validation.component.ts +52 -0
- package/src/forms/form-validation/forms.module.ts +22 -0
- package/src/forms/index.ts +1 -0
- package/src/grids/client-grid-example/client-grid-example.component.html +16 -0
- package/src/grids/client-grid-example/client-grid-example.component.ts +166 -0
- package/src/grids/client-grid-example/client-grid-example.module.ts +24 -0
- package/src/grids/client-grid-example/data.ts +427 -0
- package/src/grids/device-grid-example/device-grid-example.component.html +58 -0
- package/src/grids/device-grid-example/device-grid-example.component.ts +134 -0
- package/src/grids/device-grid-example/device-grid-example.module.ts +24 -0
- package/src/grids/grids-tabs.ts +37 -0
- package/src/grids/grids.module.ts +17 -0
- package/src/grids/index.ts +1 -0
- package/src/grids/server-grid-example/server-grid-example.component.html +26 -0
- package/src/grids/server-grid-example/server-grid-example.component.ts +121 -0
- package/src/grids/server-grid-example/server-grid-example.module.ts +24 -0
- package/src/grids/server-grid-example/server-grid-example.service.ts +266 -0
- package/src/grids/server-grid-example/type-data-grid-column/type.cell-renderer.component.ts +31 -0
- package/src/grids/server-grid-example/type-data-grid-column/type.data-grid-column.ts +47 -0
- package/src/grids/server-grid-example/type-data-grid-column/type.filtering-form-renderer.component.ts +107 -0
- package/src/grids/server-grid-example/type-data-grid-column/type.header-cell-renderer.component.ts +20 -0
- package/src/hello/hello.component.ts +55 -0
- package/src/hello/hello.module.ts +20 -0
- package/src/hello/index.ts +1 -0
- package/src/help/help-example.component.ts +23 -0
- package/src/help/help-example.module.ts +20 -0
- package/src/hooks/action/action.module.ts +34 -0
- package/src/hooks/action/action.ts +41 -0
- package/src/hooks/action/basic-view/basic-view.component.html +8 -0
- package/src/hooks/action/basic-view/basic-view.component.ts +18 -0
- package/src/hooks/action/index.ts +1 -0
- package/src/hooks/action/logout-action/logout-action.component.ts +18 -0
- package/src/hooks/action-bar/action-bar.module.ts +34 -0
- package/src/hooks/action-bar/action-bar.ts +28 -0
- package/src/hooks/action-bar/basic-view/basic-view.component.html +8 -0
- package/src/hooks/action-bar/basic-view/basic-view.component.ts +18 -0
- package/src/hooks/action-bar/index.ts +1 -0
- package/src/hooks/action-bar/refresh-element/refresh-element.component.html +15 -0
- package/src/hooks/action-bar/refresh-element/refresh-element.component.ts +21 -0
- package/src/hooks/breadcrumbs/basic-view/basic-view.component.html +7 -0
- package/src/hooks/breadcrumbs/basic-view/basic-view.component.ts +18 -0
- package/src/hooks/breadcrumbs/breadcrumbs.module.ts +34 -0
- package/src/hooks/breadcrumbs/breadcrumbs.ts +93 -0
- package/src/hooks/breadcrumbs/index.ts +1 -0
- package/src/hooks/component/basic-view/basic-view.component.html +11 -0
- package/src/hooks/component/basic-view/basic-view.component.ts +16 -0
- package/src/hooks/component/basic-view/simple.component.ts +8 -0
- package/src/hooks/component/component.module.ts +38 -0
- package/src/hooks/component/index.ts +1 -0
- package/src/hooks/drawer/index.ts +2 -0
- package/src/hooks/drawer/left-drawer-tutorial/left-drawer-tutorial.component.ts +8 -0
- package/src/hooks/drawer/left-drawer-tutorial/left-drawer.module.ts +10 -0
- package/src/hooks/drawer/right-drawer-tutorial/right-drawer-tutorial.component.ts +8 -0
- package/src/hooks/drawer/right-drawer-tutorial/right-drawer.module.ts +10 -0
- package/src/hooks/generic-wizard/index.ts +1 -0
- package/src/hooks/generic-wizard/minimal-setup/minimal-setup.component.ts +12 -0
- package/src/hooks/generic-wizard/minimal-setup/multiple-entries-one.component.ts +25 -0
- package/src/hooks/generic-wizard/minimal-setup/multiple-entries-two.component.ts +25 -0
- package/src/hooks/generic-wizard/minimal-setup/stepper-example.component.html +38 -0
- package/src/hooks/generic-wizard/minimal-setup/stepper-example.component.ts +33 -0
- package/src/hooks/generic-wizard/wizard-tabs.ts +22 -0
- package/src/hooks/generic-wizard/wizard.component.html +51 -0
- package/src/hooks/generic-wizard/wizard.component.ts +86 -0
- package/src/hooks/generic-wizard/wizard.module.ts +79 -0
- package/src/hooks/hooks.module.ts +19 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/navigator/index.ts +1 -0
- package/src/hooks/navigator/navigator.module.ts +21 -0
- package/src/hooks/navigator/navigator.ts +35 -0
- package/src/hooks/navigator/time-navigator-node/time-navigator-node.component.ts +19 -0
- package/src/hooks/navigator-route/basic-view/basic-view.component.html +7 -0
- package/src/hooks/navigator-route/basic-view/basic-view.component.ts +18 -0
- package/src/hooks/navigator-route/index.ts +1 -0
- package/src/hooks/navigator-route/navigator-route.module.ts +27 -0
- package/src/hooks/route/device/device-info.component.html +2 -0
- package/src/hooks/route/device/device-info.component.ts +13 -0
- package/src/hooks/route/device/device-tab-context.component.html +15 -0
- package/src/hooks/route/device/device-tab-context.component.ts +13 -0
- package/src/hooks/route/index.ts +1 -0
- package/src/hooks/route/random.guard.ts +12 -0
- package/src/hooks/route/route.module.ts +51 -0
- package/src/hooks/state/hook-state.module.ts +25 -0
- package/src/hooks/state/hook-with-service-example.component.html +29 -0
- package/src/hooks/state/hook-with-service-example.component.ts +36 -0
- package/src/hooks/stepper/basic-view/basic-view.component.html +17 -0
- package/src/hooks/stepper/basic-view/basic-view.component.ts +31 -0
- package/src/hooks/stepper/index.ts +4 -0
- package/src/hooks/stepper/stepper-hook.module.ts +53 -0
- package/src/hooks/stepper/steps/step1.component.html +24 -0
- package/src/hooks/stepper/steps/step1.component.ts +18 -0
- package/src/hooks/stepper/steps/step2.component.html +7 -0
- package/src/hooks/stepper/steps/step2.component.ts +11 -0
- package/src/hooks/tabs/awesome/awesome.component.html +7 -0
- package/src/hooks/tabs/awesome/awesome.component.ts +21 -0
- package/src/hooks/tabs/index.ts +1 -0
- package/src/hooks/tabs/outstanding/outstanding.component.html +22 -0
- package/src/hooks/tabs/outstanding/outstanding.component.ts +27 -0
- package/src/hooks/tabs/tab.ts +44 -0
- package/src/hooks/tabs/tabs.module.ts +37 -0
- package/src/hooks/version/custom-version-factory.service.ts +49 -0
- package/src/hooks/version/index.ts +1 -0
- package/src/hooks/version/version.module.ts +11 -0
- package/src/i18n.ts +18 -0
- package/src/input/range-input-example.component.ts +29 -0
- package/src/input/range-input-example.module.ts +19 -0
- package/src/lazy/component-one.component.ts +28 -0
- package/src/lazy/component-two.component.ts +17 -0
- package/src/lazy/index.ts +1 -0
- package/src/lazy/lazy-loaded.module.ts +21 -0
- package/src/lazy/lazy-routing.module.ts +21 -0
- package/src/lazy/lazy.hooks.ts +24 -0
- package/src/lazy-widget/index.ts +1 -0
- package/src/lazy-widget/lazy-widget-config/index.ts +1 -0
- package/src/lazy-widget/lazy-widget-config/lazy-widget-config.component.ts +10 -0
- package/src/lazy-widget/lazy-widget-view/index.ts +1 -0
- package/src/lazy-widget/lazy-widget-view/lazy-widget-view.component.ts +10 -0
- package/src/lazy-widget/lazy-widget.module.ts +27 -0
- package/src/list/index.ts +1 -0
- package/src/list/list/list-check/list-check.component.html +35 -0
- package/src/list/list/list-check/list-check.component.ts +47 -0
- package/src/list/list/list-check/list-check.module.ts +21 -0
- package/src/list/list/list-timeline/list-timeline.component.html +30 -0
- package/src/list/list/list-timeline/list-timeline.component.ts +46 -0
- package/src/list/list/list-timeline/list-timeline.module.ts +21 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-check/list-virtual-scroll-check.component.html +105 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-check/list-virtual-scroll-check.component.ts +70 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-check/list-virtual-scroll-check.module.ts +22 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-timeline/list-virtual-scroll-timeline.component.html +37 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-timeline/list-virtual-scroll-timeline.component.ts +69 -0
- package/src/list/list-virtual-scroll/list-virtual-scroll-timeline/list-virtual-scroll-timeline.module.ts +24 -0
- package/src/list/lists.module.ts +17 -0
- package/src/main.ts +23 -0
- package/src/maps/cluster-map/cluster-map-example.component.html +60 -0
- package/src/maps/cluster-map/cluster-map-example.component.ts +39 -0
- package/src/maps/cluster-map/cluster-map-example.module.ts +24 -0
- package/src/maps/cluster-map-root-node/cluster-map-root-node-example.component.html +54 -0
- package/src/maps/cluster-map-root-node/cluster-map-root-node-example.component.ts +54 -0
- package/src/maps/cluster-map-root-node/cluster-map-root-node-example.module.ts +26 -0
- package/src/maps/map-examples.module.ts +18 -0
- package/src/maps/map-popup/map-popup-example.component.html +34 -0
- package/src/maps/map-popup/map-popup-example.component.ts +43 -0
- package/src/maps/map-popup/map-popup-example.module.ts +24 -0
- package/src/maps/simple-map/simple-map-example.component.html +59 -0
- package/src/maps/simple-map/simple-map-example.component.ts +70 -0
- package/src/maps/simple-map/simple-map-example.module.ts +24 -0
- package/src/modal/confirm-modal/confirm-modal-example.component.ts +69 -0
- package/src/modal/confirm-modal/confirm-modal-example.module.ts +22 -0
- package/src/modal/ngx-modal/ngx-modal-example.component.ts +34 -0
- package/src/modal/ngx-modal/ngx-modal-example.module.ts +22 -0
- package/src/modal/simple-modal/modal-example.component.ts +34 -0
- package/src/modal/simple-modal/modal.example.module.ts +21 -0
- package/src/polyfills.ts +33 -0
- package/src/popconfirm/pop-confirm-example.component.ts +61 -0
- package/src/popconfirm/pop-confirm-example.module.ts +23 -0
- package/src/properties-list/properties-list-example.component.ts +49 -0
- package/src/properties-list/properties-list-example.module.ts +21 -0
- package/src/provider-configuration/index.ts +3 -0
- package/src/provider-configuration/introduction-example/introduction.component.ts +69 -0
- package/src/provider-configuration/introduction-example/introduction.module.ts +21 -0
- package/src/provider-configuration/provider-configuration-example/demo-provider.guard.ts +9 -0
- package/src/provider-configuration/provider-configuration-example/provider-configuration.module.ts +48 -0
- package/src/quick-link/quick-link-example.component.ts +39 -0
- package/src/quick-link/quick-link-example.module.ts +23 -0
- package/src/realtime/index.ts +1 -0
- package/src/realtime/realtime-tutorial.component.html +52 -0
- package/src/realtime/realtime-tutorial.component.ts +91 -0
- package/src/realtime/realtime-tutorial.module.ts +21 -0
- package/src/redirect-to-last-route/index.ts +1 -0
- package/src/redirect-to-last-route/redirect-to-last-route-guard.service.ts +16 -0
- package/src/redirect-to-last-route/redirect-to-last-route.module.ts +20 -0
- package/src/redirect-to-last-route/view-context-redirect.service.ts +53 -0
- package/src/selector/asset-selector-example/child-devices/asset-selector-child-devices.component.ts +49 -0
- package/src/selector/asset-selector-example/child-devices/asset-selector-child-devices.module.ts +24 -0
- package/src/selector/asset-selector-example/column-header/asset-selector-column-header.component.ts +46 -0
- package/src/selector/asset-selector-example/column-header/asset-selector-column-header.module.ts +24 -0
- package/src/selector/asset-selector-example/different-root/asset-selector-different-root.component.ts +87 -0
- package/src/selector/asset-selector-example/different-root/asset-selector-different-root.module.ts +24 -0
- package/src/selector/asset-selector-example/general-example/asset-selector-example.component.html +342 -0
- package/src/selector/asset-selector-example/general-example/asset-selector-example.component.ts +34 -0
- package/src/selector/asset-selector-example/general-example/asset-selector-example.module.ts +22 -0
- package/src/selector/asset-selector-example/global-search/asset-selector-global-search.component.ts +50 -0
- package/src/selector/asset-selector-example/global-search/asset-selector-global-search.module.ts +24 -0
- package/src/selector/asset-selector-example/miller-columns-options/asset-selector-miller-example.component.ts +85 -0
- package/src/selector/asset-selector-example/miller-columns-options/asset-selector-miller-example.module.ts +26 -0
- package/src/selector/asset-selector-example/multi-select/asset-selector-multi-select.component.ts +50 -0
- package/src/selector/asset-selector-example/multi-select/asset-selector-multi-select.module.ts +24 -0
- package/src/selector/asset-selector-example/only-devices/asset-selector-only-devices.component.ts +44 -0
- package/src/selector/asset-selector-example/only-devices/asset-selector-only-devices.module.ts +24 -0
- package/src/selector/asset-selector-example/single-search/asset-selector-single-search.component.ts +71 -0
- package/src/selector/asset-selector-example/single-search/asset-selector-single-search.module.ts +24 -0
- package/src/selector/asset-selector-example/single-select/asset-selector-single-select.component.ts +47 -0
- package/src/selector/asset-selector-example/single-select/asset-single-select.module.ts +24 -0
- package/src/selector/asset-selector-example/tree-devices/asset-selector-tree-devices.component.ts +62 -0
- package/src/selector/asset-selector-example/tree-devices/asset-selector-tree-devices.module.ts +24 -0
- package/src/selector/asset-selector-example/tree-options/asset-selector-tree-example.component.ts +83 -0
- package/src/selector/asset-selector-example/tree-options/asset-selector-tree-example.module.ts +26 -0
- package/src/selector/asset-selector-example/tree-search/asset-selector-tree-search.component.ts +75 -0
- package/src/selector/asset-selector-example/tree-search/asset-selector-tree-search.module.ts +24 -0
- package/src/selector/asset-selector-example/tree-single/asset-selector-tree-single.component.ts +66 -0
- package/src/selector/asset-selector-example/tree-single/asset-selector-tree-single.module.ts +24 -0
- package/src/selector/datapoint-selection-example/context-example/datapoint-selection-context-example.component.ts +54 -0
- package/src/selector/datapoint-selection-example/context-example/datapoint-selection-context-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/dragdrop-example/datapoint-selection-dragdrop-example.component.ts +43 -0
- package/src/selector/datapoint-selection-example/dragdrop-example/datapoint-selection-dragdrop-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/general-example/datapoint-selection-example.component.html +202 -0
- package/src/selector/datapoint-selection-example/general-example/datapoint-selection-example.component.ts +51 -0
- package/src/selector/datapoint-selection-example/general-example/datapoint-selection-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/list-example/datapoint-selection-list-example.component.ts +42 -0
- package/src/selector/datapoint-selection-example/list-example/datapoint-selection-list-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/modal-example/datapoint-selection-modal-example.component.ts +51 -0
- package/src/selector/datapoint-selection-example/modal-example/datapoint-selection-modal-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/no-templates-example/datapoint-selection-notemplates-example.component.ts +43 -0
- package/src/selector/datapoint-selection-example/no-templates-example/datapoint-selection-notemplates-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/selector/datapoint-selection-selector-example.component.ts +43 -0
- package/src/selector/datapoint-selection-example/selector/datapoint-selection-selector-example.module.ts +24 -0
- package/src/selector/datapoint-selection-example/validation-example/datapoint-selection-validation-example.component.ts +46 -0
- package/src/selector/datapoint-selection-example/validation-example/datapoint-selection-validation-example.module.ts +24 -0
- package/src/standalone-demo/index.ts +1 -0
- package/src/standalone-demo/standalone-component/standalone-component.component.html +4 -0
- package/src/standalone-demo/standalone-component/standalone-component.component.ts +11 -0
- package/src/standalone-demo/standalone-demo.module.ts +23 -0
- package/src/stepper/device-stepper.component.html +70 -0
- package/src/stepper/device-stepper.component.ts +98 -0
- package/src/stepper/device.model.ts +5 -0
- package/src/stepper/index.ts +1 -0
- package/src/stepper/stepper.component.ts +19 -0
- package/src/stepper/stepper.module.ts +24 -0
- package/src/stepper/stepper.service.ts +32 -0
- package/src/time/time-picker-example.component.ts +19 -0
- package/src/time/time-picker-example.module.ts +21 -0
- package/src/translations/date-translation/c8y-translation/c8y-date-translation.component.ts +23 -0
- package/src/translations/date-translation/c8y-translation/c8y-date-translation.module.ts +22 -0
- package/src/translations/date-translation/ng-translation/date-translation.component.ts +17 -0
- package/src/translations/date-translation/ng-translation/date-translation.module.ts +22 -0
- package/src/translations/dynamic-form-translation/dynamic-form-translation.component.ts +58 -0
- package/src/translations/dynamic-form-translation/dynamic-form-translation.module.ts +22 -0
- package/src/translations/index.ts +1 -0
- package/src/translations/locales/it.po +18 -0
- package/src/translations/locales/pt_BR.po +33 -0
- package/src/translations/new-language/new-language.component.html +45 -0
- package/src/translations/new-language/new-language.component.ts +19 -0
- package/src/translations/new-language/new-language.module.ts +21 -0
- package/src/translations/new-translate/new-translation.component.html +92 -0
- package/src/translations/new-translate/new-translation.component.ts +9 -0
- package/src/translations/new-translate/new-translation.module.ts +22 -0
- package/src/translations/text-translation/gettext-translation/text-translation-gettext.component.ts +18 -0
- package/src/translations/text-translation/gettext-translation/text-translation-gettext.module.ts +22 -0
- package/src/translations/text-translation/ngNonBindable-translation/text-translation-ngnonbindable.component.ts +22 -0
- package/src/translations/text-translation/ngNonBindable-translation/text-translation-ngnonbindable.module.ts +24 -0
- package/src/translations/text-translation/service-translation/text-translation-by-service.component.ts +38 -0
- package/src/translations/text-translation/service-translation/text-translation-by-service.module.ts +24 -0
- package/src/translations/translation-tabs.ts +50 -0
- package/src/translations/translations.module.ts +18 -0
- package/src/user-menu/index.ts +1 -0
- package/src/user-menu/user-menu.module.ts +13 -0
- package/src/user-menu/user-menu.ts +26 -0
- package/src/widget/demo-widget-config.component.ts +81 -0
- package/src/widget/demo-widget.component.ts +35 -0
- package/src/widget/demo-widget.module.ts +47 -0
- package/src/widget/index.ts +1 -0
- package/src/widget-resolvers/alternative-event.resolver.ts +21 -0
- package/src/widget-resolvers/event-property.resolver.ts +52 -0
- package/src/widget-resolvers/event.resolver.ts +100 -0
- package/src/widget-resolvers/index.ts +1 -0
- package/src/widget-resolvers/widget-resolvers-config/widget-resolvers-config.component.html +31 -0
- package/src/widget-resolvers/widget-resolvers-config/widget-resolvers-config.component.ts +67 -0
- package/src/widget-resolvers/widget-resolvers.component.html +13 -0
- package/src/widget-resolvers/widget-resolvers.component.ts +37 -0
- package/src/widget-resolvers/widget-resolvers.module.ts +50 -0
- package/tsconfig.app.json +18 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { RightDrawerTutorialComponent } from './right-drawer-tutorial.component';
|
|
3
|
+
import { hookDrawer } from '@c8y/ngx-components';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
providers: [
|
|
7
|
+
hookDrawer([{ component: RightDrawerTutorialComponent, position: 'right', priority: 20 }])
|
|
8
|
+
]
|
|
9
|
+
})
|
|
10
|
+
export class RightDrawerModule {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './wizard.module';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'container-component',
|
|
5
|
+
template: `
|
|
6
|
+
<c8y-wizard-header> New header </c8y-wizard-header>
|
|
7
|
+
<c8y-wizard-body> New body </c8y-wizard-body>
|
|
8
|
+
`
|
|
9
|
+
})
|
|
10
|
+
export class MinimalSetupComponent {
|
|
11
|
+
// In this case cancel method is not required, because it is the default button when the <c8y-wizard-footer> tag is missing.
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { WizardComponent } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'multiple-entries-one-component',
|
|
6
|
+
template: `
|
|
7
|
+
<c8y-wizard-header> New header entry 1 </c8y-wizard-header>
|
|
8
|
+
<c8y-wizard-body> New body </c8y-wizard-body>
|
|
9
|
+
<c8y-wizard-footer>
|
|
10
|
+
<button class="btn btn-default" title="{{ 'Back' }}" (click)="back()">Back</button>
|
|
11
|
+
<button class="btn btn-default" title="{{ 'Cancel' }}" (click)="cancel()">Cancel</button>
|
|
12
|
+
</c8y-wizard-footer>
|
|
13
|
+
`
|
|
14
|
+
})
|
|
15
|
+
export class MultipleEntriesOne {
|
|
16
|
+
constructor(private wizardComponent: WizardComponent) {}
|
|
17
|
+
|
|
18
|
+
cancel() {
|
|
19
|
+
this.wizardComponent.close('Cancel triggered');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
back() {
|
|
23
|
+
this.wizardComponent.reset('Reset triggered');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { WizardComponent } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'multiple-entries-two-component',
|
|
6
|
+
template: `
|
|
7
|
+
<c8y-wizard-header> New header entry 2 </c8y-wizard-header>
|
|
8
|
+
<c8y-wizard-body> New body </c8y-wizard-body>
|
|
9
|
+
<c8y-wizard-footer>
|
|
10
|
+
<button class="btn btn-default" title="{{ 'Back' }}" (click)="back()">Back</button>
|
|
11
|
+
<button class="btn btn-default" title="{{ 'Cancel' }}" (click)="cancel()">Cancel</button>
|
|
12
|
+
</c8y-wizard-footer>
|
|
13
|
+
`
|
|
14
|
+
})
|
|
15
|
+
export class MultipleEntriesTwo {
|
|
16
|
+
constructor(private wizardComponent: WizardComponent) {}
|
|
17
|
+
|
|
18
|
+
cancel() {
|
|
19
|
+
this.wizardComponent.close('Cancel triggered');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
back() {
|
|
23
|
+
this.wizardComponent.reset();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<c8y-wizard-header> New header </c8y-wizard-header>
|
|
2
|
+
<c8y-wizard-body
|
|
3
|
+
><c8y-stepper>
|
|
4
|
+
<cdk-step [stepControl]="formGroupStepOne" label="Device name">
|
|
5
|
+
<div class="m-l-40 m-r-40 m-t-32">
|
|
6
|
+
<h4 title="Device name" class="p-b-8">Enter the device name</h4>
|
|
7
|
+
<c8y-form-group>
|
|
8
|
+
<div [formGroup]="formGroupStepOne">
|
|
9
|
+
<input
|
|
10
|
+
class="form-control"
|
|
11
|
+
type="text"
|
|
12
|
+
#nameRef
|
|
13
|
+
formControlName="name"
|
|
14
|
+
placeholder="MyDevice"
|
|
15
|
+
required
|
|
16
|
+
/>
|
|
17
|
+
<c8y-messages>
|
|
18
|
+
<c8y-message [name]="'required'" [text]="'Enter the name of the Device'"></c8y-message>
|
|
19
|
+
</c8y-messages>
|
|
20
|
+
</div>
|
|
21
|
+
</c8y-form-group>
|
|
22
|
+
</div>
|
|
23
|
+
<c8y-stepper-buttons></c8y-stepper-buttons>
|
|
24
|
+
</cdk-step>
|
|
25
|
+
<cdk-step state="final" label="Job done!">
|
|
26
|
+
<div class="m-l-40 m-r-40 m-t-32">
|
|
27
|
+
<h4 class="p-b-32 text-center">Your device is now ready to save the world!</h4>
|
|
28
|
+
</div>
|
|
29
|
+
</cdk-step></c8y-stepper
|
|
30
|
+
></c8y-wizard-body
|
|
31
|
+
>
|
|
32
|
+
<c8y-wizard-footer *ngIf="stepper.selectedIndex === 0"> </c8y-wizard-footer>
|
|
33
|
+
|
|
34
|
+
<c8y-wizard-footer *ngIf="stepper.selectedIndex === 1">
|
|
35
|
+
<button (click)="done()" class="btn btn-default" title="{{ 'Done' }}">
|
|
36
|
+
{{ 'Done' }}
|
|
37
|
+
</button>
|
|
38
|
+
</c8y-wizard-footer>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
2
|
+
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
3
|
+
import { C8yStepper, CoreModule, WizardComponent } from '@c8y/ngx-components';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'container-component',
|
|
7
|
+
templateUrl: 'stepper-example.component.html',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [CoreModule]
|
|
10
|
+
})
|
|
11
|
+
export class StepperExampleComponent implements OnInit {
|
|
12
|
+
formGroupStepOne: FormGroup;
|
|
13
|
+
@ViewChild(C8yStepper, { static: true })
|
|
14
|
+
stepper: C8yStepper;
|
|
15
|
+
constructor(
|
|
16
|
+
private wizardComponent: WizardComponent,
|
|
17
|
+
private fb: FormBuilder
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
ngOnInit() {
|
|
21
|
+
this.formGroupStepOne = this.fb.group({
|
|
22
|
+
name: ['', Validators.required]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
cancel() {
|
|
27
|
+
this.wizardComponent.close('Cancel triggered');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
done() {
|
|
31
|
+
this.wizardComponent.close('Close triggered');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { Tab } from '@c8y/ngx-components';
|
|
3
|
+
import { Router } from '@angular/router';
|
|
4
|
+
|
|
5
|
+
@Injectable()
|
|
6
|
+
export class WizardTabs {
|
|
7
|
+
constructor(public router: Router) {}
|
|
8
|
+
|
|
9
|
+
get() {
|
|
10
|
+
const tabs: Tab[] = [];
|
|
11
|
+
|
|
12
|
+
if (this.router.url.match(/wizard/g)) {
|
|
13
|
+
tabs.push({
|
|
14
|
+
icon: 'rocket',
|
|
15
|
+
priority: 1000,
|
|
16
|
+
label: 'Minimal setup',
|
|
17
|
+
path: 'wizard/minimal-setup'
|
|
18
|
+
} as Tab);
|
|
19
|
+
}
|
|
20
|
+
return tabs;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<c8y-title>Wizard minimal setup example</c8y-title>
|
|
2
|
+
<div class="card">
|
|
3
|
+
<div class="card-header separator">
|
|
4
|
+
<h4 class="card-title">Example with only one menu entry.</h4>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="card-block">
|
|
7
|
+
In this example the wizard currently has only one menu entry, which means that the id of the
|
|
8
|
+
wizard is unique. If the wizard contains only one entry without a path, the list will be skipped.
|
|
9
|
+
<br />
|
|
10
|
+
|
|
11
|
+
<b>Note:</b> If no additional buttons are added, the wizard will automatically add the cancel
|
|
12
|
+
button.
|
|
13
|
+
</div>
|
|
14
|
+
<div class="card-footer">
|
|
15
|
+
<button (click)="showOneEntryExample()" type="button" class="btn btn-primary" title="wizard">
|
|
16
|
+
Wizard
|
|
17
|
+
</button>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div class="card">
|
|
22
|
+
<div class="card-header separator">
|
|
23
|
+
<h4 class="card-title">Example with multiple menu entries.</h4>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="card-block">
|
|
26
|
+
In this example the wizard will have multiple menu entries, which means that every menu entry
|
|
27
|
+
will share the same 'wizardId'.
|
|
28
|
+
</div>
|
|
29
|
+
<div class="card-footer">
|
|
30
|
+
<button
|
|
31
|
+
(click)="showMultipleEntriesExample()"
|
|
32
|
+
type="button"
|
|
33
|
+
class="btn btn-primary"
|
|
34
|
+
title="wizard"
|
|
35
|
+
>
|
|
36
|
+
Wizard
|
|
37
|
+
</button>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="card">
|
|
42
|
+
<div class="card-header separator">
|
|
43
|
+
<h4 class="card-title">Example with stepper.</h4>
|
|
44
|
+
</div>
|
|
45
|
+
<div class="card-block">In this example the wizard will be used with a stepper.</div>
|
|
46
|
+
<div class="card-footer">
|
|
47
|
+
<button (click)="showStepperExample()" type="button" class="btn btn-primary" title="wizard">
|
|
48
|
+
Wizard
|
|
49
|
+
</button>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { HeaderModule, WizardConfig, WizardModalService } from '@c8y/ngx-components';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { takeUntil } from 'rxjs/operators';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'container-component',
|
|
8
|
+
templateUrl: 'wizard.component.html',
|
|
9
|
+
standalone: true,
|
|
10
|
+
imports: [HeaderModule]
|
|
11
|
+
})
|
|
12
|
+
export class ContainerComponent {
|
|
13
|
+
destroy$: Subject<boolean> = new Subject<boolean>();
|
|
14
|
+
|
|
15
|
+
constructor(private wizardModalService: WizardModalService) {}
|
|
16
|
+
|
|
17
|
+
showOneEntryExample() {
|
|
18
|
+
const wizardConfig: WizardConfig = {
|
|
19
|
+
headerText: 'One Menu Entry Example',
|
|
20
|
+
headerIcon: 'rocket',
|
|
21
|
+
bodyHeaderIcon: 'rocket'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const initialState: any = {
|
|
25
|
+
id: 'singleEntry',
|
|
26
|
+
wizardConfig
|
|
27
|
+
};
|
|
28
|
+
const modalOptions = { initialState };
|
|
29
|
+
|
|
30
|
+
this.wizardModalService.show(modalOptions);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
showMultipleEntriesExample() {
|
|
34
|
+
const wizardConfig: WizardConfig = {
|
|
35
|
+
headerText: 'Multiple Entries example',
|
|
36
|
+
headerIcon: 'rocket',
|
|
37
|
+
bodyHeaderText: 'Select methods',
|
|
38
|
+
bodyHeaderIcon: 'rocket'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const initialState: any = {
|
|
42
|
+
id: 'multipleEntries',
|
|
43
|
+
wizardConfig
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const modalOptions = { initialState };
|
|
47
|
+
|
|
48
|
+
const modalRef = this.wizardModalService.show(modalOptions);
|
|
49
|
+
|
|
50
|
+
modalRef.content.onSelect.pipe(takeUntil(this.destroy$)).subscribe(menuEntry => {
|
|
51
|
+
// handle menu entry
|
|
52
|
+
console.log(menuEntry);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
modalRef.content.onClose.pipe(takeUntil(this.destroy$)).subscribe(result => {
|
|
56
|
+
// handle result
|
|
57
|
+
console.log(result);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
modalRef.content.onReset.pipe(takeUntil(this.destroy$)).subscribe(result => {
|
|
61
|
+
// handle result
|
|
62
|
+
console.log(result);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
showStepperExample() {
|
|
67
|
+
const wizardConfig: WizardConfig = {
|
|
68
|
+
headerText: 'Stepper Example',
|
|
69
|
+
headerIcon: 'c8y-icon-modules',
|
|
70
|
+
bodyHeaderIcon: 'c8y-icon-modules'
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const initialState: any = {
|
|
74
|
+
id: 'stepperExample',
|
|
75
|
+
wizardConfig
|
|
76
|
+
};
|
|
77
|
+
const modalOptions = { initialState };
|
|
78
|
+
|
|
79
|
+
this.wizardModalService.show(modalOptions);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
ngOnDestroy() {
|
|
83
|
+
this.destroy$.next(true);
|
|
84
|
+
this.destroy$.unsubscribe();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { RouterModule, Routes } from '@angular/router';
|
|
4
|
+
import { CoreModule, hookNavigator, hookWizard, hookTab } from '@c8y/ngx-components';
|
|
5
|
+
import { MinimalSetupComponent } from './minimal-setup/minimal-setup.component';
|
|
6
|
+
import { MultipleEntriesOne } from './minimal-setup/multiple-entries-one.component';
|
|
7
|
+
import { MultipleEntriesTwo } from './minimal-setup/multiple-entries-two.component';
|
|
8
|
+
import { StepperExampleComponent } from './minimal-setup/stepper-example.component';
|
|
9
|
+
import { WizardTabs } from './wizard-tabs';
|
|
10
|
+
import { ContainerComponent } from './wizard.component';
|
|
11
|
+
|
|
12
|
+
const routes: Routes = [
|
|
13
|
+
{
|
|
14
|
+
path: 'wizard',
|
|
15
|
+
redirectTo: 'wizard/minimal-setup'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
path: 'wizard/minimal-setup',
|
|
19
|
+
component: ContainerComponent
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
@NgModule({
|
|
24
|
+
declarations: [MinimalSetupComponent, MultipleEntriesOne, MultipleEntriesTwo],
|
|
25
|
+
imports: [RouterModule.forChild(routes), CoreModule, FormsModule, ReactiveFormsModule],
|
|
26
|
+
/**
|
|
27
|
+
* Adding the hooks to the providers:
|
|
28
|
+
*/
|
|
29
|
+
providers: [
|
|
30
|
+
hookTab(WizardTabs),
|
|
31
|
+
hookNavigator({
|
|
32
|
+
label: 'Wizard',
|
|
33
|
+
icon: 'body',
|
|
34
|
+
priority: 0,
|
|
35
|
+
path: 'wizard/minimal-setup',
|
|
36
|
+
parent: 'Hooks',
|
|
37
|
+
// TODO: clarify why preventDuplicates is needed
|
|
38
|
+
preventDuplicates: true
|
|
39
|
+
}),
|
|
40
|
+
hookWizard({
|
|
41
|
+
wizardId: 'singleEntry',
|
|
42
|
+
// The container component is responsible for handling subsequent steps in the wizard.
|
|
43
|
+
component: MinimalSetupComponent,
|
|
44
|
+
// Menu entry name
|
|
45
|
+
name: "Doesn't matter as it won't be shown anyway since it is a single entry.",
|
|
46
|
+
// Menu entry icon
|
|
47
|
+
c8yIcon: 'upload'
|
|
48
|
+
}),
|
|
49
|
+
hookWizard({
|
|
50
|
+
// entry ID, observe that it shares the same ID as the entry below.
|
|
51
|
+
wizardId: 'multipleEntries',
|
|
52
|
+
// The container component is responsible for handling subsequent steps in the wizard.
|
|
53
|
+
component: MultipleEntriesOne,
|
|
54
|
+
// Menu entry name
|
|
55
|
+
name: 'Entry 1',
|
|
56
|
+
// Menu entry icon
|
|
57
|
+
c8yIcon: 'upload'
|
|
58
|
+
}),
|
|
59
|
+
hookWizard({
|
|
60
|
+
wizardId: 'multipleEntries',
|
|
61
|
+
// The container component is responsible for handling subsequent steps in the wizard.
|
|
62
|
+
component: MultipleEntriesTwo,
|
|
63
|
+
// Menu entry name
|
|
64
|
+
name: 'Entry 2',
|
|
65
|
+
// Menu entry icon
|
|
66
|
+
c8yIcon: 'upload'
|
|
67
|
+
}),
|
|
68
|
+
hookWizard({
|
|
69
|
+
wizardId: 'stepperExample',
|
|
70
|
+
// The container component is responsible for handling subsequent steps in the wizard.
|
|
71
|
+
component: StepperExampleComponent,
|
|
72
|
+
// Menu entry name
|
|
73
|
+
name: "Doesn't matter as it won't be shown anyway since it is a single entry.",
|
|
74
|
+
// Menu entry icon
|
|
75
|
+
c8yIcon: 'upload'
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
})
|
|
79
|
+
export class WizardModule {}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CoreModule, NavigatorNode, hookNavigator } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
imports: [CoreModule],
|
|
6
|
+
/**
|
|
7
|
+
* Adding the hooks to the providers:
|
|
8
|
+
*/
|
|
9
|
+
providers: [
|
|
10
|
+
hookNavigator(
|
|
11
|
+
new NavigatorNode({
|
|
12
|
+
priority: 90,
|
|
13
|
+
icon: 'u-turn',
|
|
14
|
+
label: 'Hooks'
|
|
15
|
+
})
|
|
16
|
+
)
|
|
17
|
+
]
|
|
18
|
+
})
|
|
19
|
+
export class HooksModule {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hooks.module';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './navigator.module';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { hookNavigator } from '@c8y/ngx-components';
|
|
3
|
+
import { ExampleNavigationFactory } from './navigator';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Use our predefined InjectionTokens and provide your own classes to extend behavior
|
|
7
|
+
* and functionality of existing ones. Implement your own NavigationNodes, Tabs, Actions and Breadcrumbs.
|
|
8
|
+
* Note: Hooks should always be implemented in the module where they are used, so that
|
|
9
|
+
* a module can act standalone and has no dependencies on other modules.
|
|
10
|
+
*/
|
|
11
|
+
export const hooks = [hookNavigator(ExampleNavigationFactory)];
|
|
12
|
+
|
|
13
|
+
@NgModule({
|
|
14
|
+
declarations: [],
|
|
15
|
+
imports: [],
|
|
16
|
+
/**
|
|
17
|
+
* Adding the hooks to the providers:
|
|
18
|
+
*/
|
|
19
|
+
providers: [...hooks]
|
|
20
|
+
})
|
|
21
|
+
export class NavigatorModule {}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, NavigatorNodeFactory } from '@c8y/ngx-components';
|
|
3
|
+
import { TimeNavigatorNodeComponent } from './time-navigator-node/time-navigator-node.component';
|
|
4
|
+
|
|
5
|
+
@Injectable()
|
|
6
|
+
export class ExampleNavigationFactory implements NavigatorNodeFactory {
|
|
7
|
+
// Implement the get()-method, otherwise the ExampleNavigationFactory
|
|
8
|
+
// implements the NavigatorNodeFactory interface incorrectly (!)
|
|
9
|
+
get() {
|
|
10
|
+
const navs: NavigatorNode[] = [];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* mandatory for a NavigatorNode is:
|
|
14
|
+
* - label (string)
|
|
15
|
+
* - path (string)
|
|
16
|
+
* A click on the NavigatorNode will load the given path. Therefore angular loads the
|
|
17
|
+
* component specified for the corresponding path
|
|
18
|
+
*/
|
|
19
|
+
navs.push(
|
|
20
|
+
new NavigatorNode({
|
|
21
|
+
label: 'Hello',
|
|
22
|
+
icon: 'rocket',
|
|
23
|
+
path: '/hello',
|
|
24
|
+
priority: 100
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
navs.push({
|
|
29
|
+
component: TimeNavigatorNodeComponent,
|
|
30
|
+
priority: -Infinity
|
|
31
|
+
} as NavigatorNode);
|
|
32
|
+
|
|
33
|
+
return navs;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
3
|
+
import { Observable, timer } from 'rxjs';
|
|
4
|
+
import { map } from 'rxjs/operators';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'app-time-navigator-node',
|
|
8
|
+
template: `<p class="text-center">Current time:</p>
|
|
9
|
+
<p class="text-center">{{ currentTime$ | async | date: 'medium' }}</p> `,
|
|
10
|
+
standalone: true,
|
|
11
|
+
imports: [CoreModule]
|
|
12
|
+
})
|
|
13
|
+
export class TimeNavigatorNodeComponent {
|
|
14
|
+
currentTime$: Observable<Date>;
|
|
15
|
+
|
|
16
|
+
constructor() {
|
|
17
|
+
this.currentTime$ = timer(0, 1000).pipe(map(() => new Date()));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<!-- The c8y-title component will display the given string (here: "Action hook example") in the header as title -->
|
|
2
|
+
<c8y-title>Navigator & route</c8y-title>
|
|
3
|
+
<div class="card">
|
|
4
|
+
<div class="card-block">
|
|
5
|
+
<p>This is the example of <code>hookNavigator</code> and <code>hookRoute</code>.</p>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This is a standard angular component.
|
|
6
|
+
* Obviously it does not do anything.
|
|
7
|
+
*/
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'tut-basic-action-hook-view',
|
|
10
|
+
templateUrl: './basic-view.component.html',
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [CoreModule]
|
|
13
|
+
})
|
|
14
|
+
export class BasicViewComponent {
|
|
15
|
+
/**
|
|
16
|
+
* Your content of the Basic View goes in here!
|
|
17
|
+
*/
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './navigator-route.module';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
export const hooks = [
|
|
5
|
+
hookRoute({
|
|
6
|
+
path: 'hooks/navigator-route',
|
|
7
|
+
loadComponent: () => import('./basic-view/basic-view.component').then(m => m.BasicViewComponent)
|
|
8
|
+
}),
|
|
9
|
+
hookNavigator(
|
|
10
|
+
new NavigatorNode({
|
|
11
|
+
priority: 60,
|
|
12
|
+
path: 'hooks/navigator-route',
|
|
13
|
+
icon: 'navigation',
|
|
14
|
+
label: 'Navigator-route',
|
|
15
|
+
parent: 'Hooks'
|
|
16
|
+
})
|
|
17
|
+
)
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
@NgModule({
|
|
21
|
+
imports: [],
|
|
22
|
+
/**
|
|
23
|
+
* Adding the hooks to the providers:
|
|
24
|
+
*/
|
|
25
|
+
providers: [...hooks]
|
|
26
|
+
})
|
|
27
|
+
export class NavigatorRouteModule {}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute } from '@angular/router';
|
|
3
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'device-info',
|
|
7
|
+
templateUrl: './device-info.component.html',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [CoreModule]
|
|
10
|
+
})
|
|
11
|
+
export class DeviceInfoComponent {
|
|
12
|
+
constructor(public route: ActivatedRoute) {}
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<c8y-title>Context for {{ route.snapshot.parent.data.contextData.name }}</c8y-title>
|
|
2
|
+
|
|
3
|
+
<strong>route.snapshot.parent.data.context:</strong>
|
|
4
|
+
<pre>
|
|
5
|
+
<code>
|
|
6
|
+
{{route.snapshot.parent.data.context | json}}
|
|
7
|
+
</code>
|
|
8
|
+
</pre>
|
|
9
|
+
|
|
10
|
+
<strong>route.snapshot.parent.data.contextData:</strong>
|
|
11
|
+
<pre>
|
|
12
|
+
<code>
|
|
13
|
+
{{route.snapshot.parent.data.contextData | json}}
|
|
14
|
+
</code>
|
|
15
|
+
</pre>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute } from '@angular/router';
|
|
3
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'device-tab-context',
|
|
7
|
+
templateUrl: './device-tab-context.component.html',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [CoreModule]
|
|
10
|
+
})
|
|
11
|
+
export class DeviceTabContextComponent {
|
|
12
|
+
constructor(public route: ActivatedRoute) {}
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './route.module';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { CanActivate } from '@angular/router';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
@Injectable({ providedIn: 'root' })
|
|
6
|
+
export class RandomGuard implements CanActivate {
|
|
7
|
+
private random = Math.random() > 0.1;
|
|
8
|
+
|
|
9
|
+
canActivate(): Observable<boolean> | Promise<boolean> | boolean {
|
|
10
|
+
return this.random;
|
|
11
|
+
}
|
|
12
|
+
}
|