@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,18 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"Project-Id-Version: c8yui.core\n"
|
|
4
|
+
"Report-Msgid-Bugs-To: \n"
|
|
5
|
+
"POT-Creation-Date: \n"
|
|
6
|
+
"PO-Revision-Date: \n"
|
|
7
|
+
"Last-Translator: \n"
|
|
8
|
+
"Language: it\n"
|
|
9
|
+
"Language-Team: \n"
|
|
10
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
11
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
12
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
msgid "Devices"
|
|
17
|
+
msgstr "Devices (it)"
|
|
18
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
4
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
5
|
+
"Project-Id-Version: \n"
|
|
6
|
+
"POT-Creation-Date: \n"
|
|
7
|
+
"PO-Revision-Date: \n"
|
|
8
|
+
"Language-Team: \n"
|
|
9
|
+
"X-Generator: Poedit 1.8.9\n"
|
|
10
|
+
"Last-Translator: \n"
|
|
11
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
12
|
+
"Language: pt_BR\n"
|
|
13
|
+
|
|
14
|
+
msgid "Awesome Tab"
|
|
15
|
+
msgstr "Separador Incrível"
|
|
16
|
+
|
|
17
|
+
msgid "Hello"
|
|
18
|
+
msgstr "Olá"
|
|
19
|
+
|
|
20
|
+
msgid "Mighty warrior with strength, stamina and agility"
|
|
21
|
+
msgstr "Guerreiro destemido com força, resistência e agilidade"
|
|
22
|
+
|
|
23
|
+
msgid "Remove Device"
|
|
24
|
+
msgstr "Remover dispositivo"
|
|
25
|
+
|
|
26
|
+
msgid "Device"
|
|
27
|
+
msgstr "Dispositivo"
|
|
28
|
+
|
|
29
|
+
msgid "{{ filteredItemsCount }} of {{ allItemsCount }} items."
|
|
30
|
+
msgstr "{{ filteredItemsCount }} de {{ allItemsCount }} itens."
|
|
31
|
+
|
|
32
|
+
msgid "Simple text input"
|
|
33
|
+
msgstr "Entrada de texto simples"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<c8y-title>How to add a new language</c8y-title>
|
|
2
|
+
<div class="card">
|
|
3
|
+
<div class="card-header separator">
|
|
4
|
+
<h4 class="card-title" title="Add a new language">Add a new language</h4>
|
|
5
|
+
</div>
|
|
6
|
+
<div class="card-block">
|
|
7
|
+
<ul>
|
|
8
|
+
<li>
|
|
9
|
+
Create a new <code>.po</code> file with the <code>Poedit</code> program or manually. If you
|
|
10
|
+
choose the second option, add the following metadata to it.
|
|
11
|
+
<pre class="m-t-16 m-b-16">
|
|
12
|
+
|
|
13
|
+
"Project-Id-Version: c8yui.core\n"
|
|
14
|
+
"Report-Msgid-Bugs-To: \n"
|
|
15
|
+
"POT-Creation-Date: \n"
|
|
16
|
+
"PO-Revision-Date: \n"
|
|
17
|
+
"Last-Translator: \n"
|
|
18
|
+
"Language: it\n"
|
|
19
|
+
"Language-Team: \n"
|
|
20
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
21
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
22
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
23
|
+
</pre>
|
|
24
|
+
</li>
|
|
25
|
+
<li>
|
|
26
|
+
Add translations to this file:
|
|
27
|
+
<pre class="m-t-16 m-b-16">
|
|
28
|
+
|
|
29
|
+
msgid "Devices"
|
|
30
|
+
msgstr "Dispositivi"
|
|
31
|
+
</pre>
|
|
32
|
+
</li>
|
|
33
|
+
<li>
|
|
34
|
+
In the <code>index.ts</code> file, add the following line:
|
|
35
|
+
<code>import "./locales/it.po";</code>
|
|
36
|
+
</li>
|
|
37
|
+
<li>
|
|
38
|
+
In the <code>package.json</code> file, under the <code>c8y</code> keys add:
|
|
39
|
+
<code>
|
|
40
|
+
{{ lang | json }}
|
|
41
|
+
</code>
|
|
42
|
+
</li>
|
|
43
|
+
</ul>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'new-language',
|
|
6
|
+
templateUrl: './new-language.component.html',
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [CoreModule]
|
|
9
|
+
})
|
|
10
|
+
export class NewLanguageComponent {
|
|
11
|
+
lang = {
|
|
12
|
+
languages: {
|
|
13
|
+
it: {
|
|
14
|
+
name: 'Italian',
|
|
15
|
+
nativeName: 'Italian'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookRoute({
|
|
7
|
+
path: 'translations/new-language',
|
|
8
|
+
loadComponent: () => import('./new-language.component').then(m => m.NewLanguageComponent)
|
|
9
|
+
}),
|
|
10
|
+
hookNavigator(
|
|
11
|
+
new NavigatorNode({
|
|
12
|
+
priority: 993,
|
|
13
|
+
path: 'translations/new-language',
|
|
14
|
+
icon: 'rocket',
|
|
15
|
+
label: 'New language',
|
|
16
|
+
parent: 'Translations'
|
|
17
|
+
})
|
|
18
|
+
)
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
export class NewLanguageModule {}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<c8y-title>New translations</c8y-title>
|
|
2
|
+
|
|
3
|
+
<div class="card">
|
|
4
|
+
<div class="card-header separator">
|
|
5
|
+
<h4 class="card-title">How to add new translations to an existing language</h4>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="card-block">
|
|
8
|
+
<ul>
|
|
9
|
+
<li>
|
|
10
|
+
Find the file that includes <code>.po</code> extension, you can find it in the
|
|
11
|
+
<code>./locales</code> folder or in the <code>node_modules/@c8y/locales</code>. Select the
|
|
12
|
+
language you want to update i.e. <code>pt_BR.po</code>
|
|
13
|
+
</li>
|
|
14
|
+
<li>
|
|
15
|
+
If desired language is already present under the <code>./locales</code> folder procceed to
|
|
16
|
+
the next step. If the <code>.po</code> file with the slected language is placed in the
|
|
17
|
+
<code>node_modules</code> copy it to the <code>./locales</code> folder. You can also use
|
|
18
|
+
this boilerplate to create <code>.po</code> file from scratch:
|
|
19
|
+
<pre class="m-t-16 m-b-16">
|
|
20
|
+
|
|
21
|
+
"Project-Id-Version: c8yui.core\n"
|
|
22
|
+
"Report-Msgid-Bugs-To: \n"
|
|
23
|
+
"POT-Creation-Date: \n"
|
|
24
|
+
"PO-Revision-Date: \n"
|
|
25
|
+
"Last-Translator: \n"
|
|
26
|
+
"Language: pt_BR\n"
|
|
27
|
+
"Language-Team: \n"
|
|
28
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
29
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
30
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
31
|
+
|
|
32
|
+
msgid ""
|
|
33
|
+
msgstr ""
|
|
34
|
+
</pre>
|
|
35
|
+
or create it with program like: <code>Poedit</code>.
|
|
36
|
+
</li>
|
|
37
|
+
<li>
|
|
38
|
+
Fill in the <code>msgid</code> field as follows:
|
|
39
|
+
<code>msgid "Awesome Tab"</code>
|
|
40
|
+
</li>
|
|
41
|
+
<li>
|
|
42
|
+
Fill in the <code>msgstr</code> field with your translation:
|
|
43
|
+
<code>msgstr "Separador Incrível"</code>
|
|
44
|
+
</li>
|
|
45
|
+
<li>
|
|
46
|
+
In the <code>index.ts</code> file, add the following line:
|
|
47
|
+
<code>import "./locales/pt_BR.po";</code>
|
|
48
|
+
</li>
|
|
49
|
+
<li>
|
|
50
|
+
Save your changes and restart your dev server. New translated string should be available.
|
|
51
|
+
</li>
|
|
52
|
+
</ul>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="card">
|
|
57
|
+
<div class="card-header separator">
|
|
58
|
+
<h4 class="card-title">How to edit existing translations</h4>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="card-block">
|
|
61
|
+
<ul>
|
|
62
|
+
<li>
|
|
63
|
+
The main difference between adding and editing an existing translation is to find the
|
|
64
|
+
existing translation and only modify the <code>msgstr</code> field in your new or copied
|
|
65
|
+
<code>.po</code> file. You can find all translated strings in the
|
|
66
|
+
<code>node_modules/@c8y/locales</code> or use <code>c8ycli locale-extract</code> command
|
|
67
|
+
described below.
|
|
68
|
+
</li>
|
|
69
|
+
</ul>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div class="card">
|
|
74
|
+
<div class="card-header separator">
|
|
75
|
+
<h4 class="card-title">
|
|
76
|
+
How to add new translations to an existing language with the c8ycli locale-extract
|
|
77
|
+
</h4>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="card-block">
|
|
80
|
+
<ul>
|
|
81
|
+
<li>
|
|
82
|
+
<code>c8ycli locale-extract</code> is the command that automatically copies all translations
|
|
83
|
+
from the <code>node_modules/@c8y/locales</code>. This makes it easier to edit and add new
|
|
84
|
+
translations.
|
|
85
|
+
</li>
|
|
86
|
+
<li>
|
|
87
|
+
After using this command, the folder <code>./locales</code> will contain all available
|
|
88
|
+
translations. The rest of the process is the same as above.
|
|
89
|
+
</li>
|
|
90
|
+
</ul>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'new-translate',
|
|
5
|
+
templateUrl: './new-translation.component.html',
|
|
6
|
+
standalone: true,
|
|
7
|
+
imports: [CoreModule]
|
|
8
|
+
})
|
|
9
|
+
export class NewTranslationComponent {}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookRoute({
|
|
7
|
+
path: 'translations/new-translate',
|
|
8
|
+
loadComponent: () =>
|
|
9
|
+
import('./new-translation.component').then(m => m.NewTranslationComponent)
|
|
10
|
+
}),
|
|
11
|
+
hookNavigator(
|
|
12
|
+
new NavigatorNode({
|
|
13
|
+
priority: 992,
|
|
14
|
+
path: 'translations/new-translate',
|
|
15
|
+
icon: 'rocket',
|
|
16
|
+
label: 'New translation',
|
|
17
|
+
parent: 'Translations'
|
|
18
|
+
})
|
|
19
|
+
)
|
|
20
|
+
]
|
|
21
|
+
})
|
|
22
|
+
export class NewTranslationModule {}
|
package/src/translations/text-translation/gettext-translation/text-translation-gettext.component.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule, gettext } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'text-translation-gettext',
|
|
6
|
+
template: ` <c8y-title>Text translation by gettext</c8y-title>
|
|
7
|
+
<div class="card">
|
|
8
|
+
<div class="card-header separator">
|
|
9
|
+
<h4 class="card-title">Gettext example (mark string for translation)</h4>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="card-block">This word will be translated: {{ getText | translate }}.</div>
|
|
12
|
+
</div>`,
|
|
13
|
+
standalone: true,
|
|
14
|
+
imports: [CoreModule]
|
|
15
|
+
})
|
|
16
|
+
export class TextTranslationGettextComponent {
|
|
17
|
+
getText = gettext('Device');
|
|
18
|
+
}
|
package/src/translations/text-translation/gettext-translation/text-translation-gettext.module.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookRoute({
|
|
7
|
+
path: 'translations/text-translation/gettext-translation',
|
|
8
|
+
loadComponent: () =>
|
|
9
|
+
import('./text-translation-gettext.component').then(m => m.TextTranslationGettextComponent)
|
|
10
|
+
}),
|
|
11
|
+
hookNavigator(
|
|
12
|
+
new NavigatorNode({
|
|
13
|
+
priority: 995,
|
|
14
|
+
path: 'translations/text-translation/gettext-translation',
|
|
15
|
+
icon: 'rocket',
|
|
16
|
+
label: 'Text translation by gettext',
|
|
17
|
+
parent: 'Translations'
|
|
18
|
+
})
|
|
19
|
+
)
|
|
20
|
+
]
|
|
21
|
+
})
|
|
22
|
+
export class TextTranslationGettextModule {}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'text-translation-ngnonbindable',
|
|
6
|
+
template: `<div class="card">
|
|
7
|
+
<div class="card-block">
|
|
8
|
+
This sentence will be translated:
|
|
9
|
+
<span class="m-r-4" ngNonBindable translate [translateParams]="ngNonBindableTranslate">
|
|
10
|
+
{{ filteredItemsCount }} of {{ allItemsCount }} items.
|
|
11
|
+
</span>
|
|
12
|
+
</div>
|
|
13
|
+
</div> `,
|
|
14
|
+
standalone: true,
|
|
15
|
+
imports: [CoreModule]
|
|
16
|
+
})
|
|
17
|
+
export class TextTranslationNgnonbindableComponent {
|
|
18
|
+
ngNonBindableTranslate = {
|
|
19
|
+
filteredItemsCount: 1,
|
|
20
|
+
allItemsCount: 8
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookRoute({
|
|
7
|
+
path: 'translations/text-translation/ngNonBindable-translation',
|
|
8
|
+
loadComponent: () =>
|
|
9
|
+
import('./text-translation-ngnonbindable.component').then(
|
|
10
|
+
m => m.TextTranslationNgnonbindableComponent
|
|
11
|
+
)
|
|
12
|
+
}),
|
|
13
|
+
hookNavigator(
|
|
14
|
+
new NavigatorNode({
|
|
15
|
+
priority: 997,
|
|
16
|
+
path: 'translations/text-translation/ngNonBindable-translation',
|
|
17
|
+
icon: 'rocket',
|
|
18
|
+
label: 'Text translation',
|
|
19
|
+
parent: 'Translations'
|
|
20
|
+
})
|
|
21
|
+
)
|
|
22
|
+
]
|
|
23
|
+
})
|
|
24
|
+
export class TextTranslationNgnonbindableModule {}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule, gettext } from '@c8y/ngx-components';
|
|
3
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'text-translation-by-service',
|
|
7
|
+
template: `
|
|
8
|
+
<c8y-title>Text translation by service</c8y-title>
|
|
9
|
+
<div class="card">
|
|
10
|
+
<div class="card-block">
|
|
11
|
+
<div class="card-block">This word will be translated: {{ translateInstant }}.</div>
|
|
12
|
+
<div class="card-block">
|
|
13
|
+
This sentence will be translated too: {{ deleteDeviceProfile() }}
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
`,
|
|
18
|
+
standalone: true,
|
|
19
|
+
imports: [CoreModule]
|
|
20
|
+
})
|
|
21
|
+
export class TextTranslationByServiceComponent {
|
|
22
|
+
translateInstant = '';
|
|
23
|
+
|
|
24
|
+
constructor(private translateService: TranslateService) {
|
|
25
|
+
// instant might fail, as it is sync and the language might not be loaded:
|
|
26
|
+
this.translateInstant = this.translateService.instant(gettext('Device'));
|
|
27
|
+
// alternative you can use the async get:
|
|
28
|
+
// this.translateService.get(gettext('Device'));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
deleteDeviceProfile() {
|
|
32
|
+
const deviceProfileName = 'Johny';
|
|
33
|
+
return this.translateService.instant(
|
|
34
|
+
gettext('You are about to delete a device profile "{{ deviceProfileName }}".'),
|
|
35
|
+
{ deviceProfileName }
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/translations/text-translation/service-translation/text-translation-by-service.module.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookRoute({
|
|
7
|
+
path: 'translations/text-translation/service-translation',
|
|
8
|
+
loadComponent: () =>
|
|
9
|
+
import('./text-translation-by-service.component').then(
|
|
10
|
+
m => m.TextTranslationByServiceComponent
|
|
11
|
+
)
|
|
12
|
+
}),
|
|
13
|
+
hookNavigator(
|
|
14
|
+
new NavigatorNode({
|
|
15
|
+
priority: 999,
|
|
16
|
+
path: 'translations/text-translation/service-translation',
|
|
17
|
+
icon: 'rocket',
|
|
18
|
+
label: 'Text translation by service',
|
|
19
|
+
parent: 'Translations'
|
|
20
|
+
})
|
|
21
|
+
)
|
|
22
|
+
]
|
|
23
|
+
})
|
|
24
|
+
export class TextTranslationByServiceModule {}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { TabFactory, Tab } from '@c8y/ngx-components';
|
|
3
|
+
import { Router } from '@angular/router';
|
|
4
|
+
|
|
5
|
+
@Injectable()
|
|
6
|
+
export class TranslationTabs implements TabFactory {
|
|
7
|
+
constructor(public router: Router) {}
|
|
8
|
+
|
|
9
|
+
get() {
|
|
10
|
+
const tabs: Tab[] = [];
|
|
11
|
+
|
|
12
|
+
if (this.router.url.match(/translations/g)) {
|
|
13
|
+
tabs.push({
|
|
14
|
+
icon: 'rocket',
|
|
15
|
+
priority: 1000,
|
|
16
|
+
label: 'Text translation',
|
|
17
|
+
path: 'translations/text-translation'
|
|
18
|
+
} as Tab);
|
|
19
|
+
|
|
20
|
+
tabs.push({
|
|
21
|
+
icon: 'rocket',
|
|
22
|
+
priority: 999,
|
|
23
|
+
label: 'Date translation',
|
|
24
|
+
path: 'translations/date-translation'
|
|
25
|
+
} as Tab);
|
|
26
|
+
|
|
27
|
+
tabs.push({
|
|
28
|
+
icon: 'rocket',
|
|
29
|
+
priority: 998,
|
|
30
|
+
label: 'Dynamic form translation',
|
|
31
|
+
path: 'translations/dynamic-form-translation'
|
|
32
|
+
} as Tab);
|
|
33
|
+
|
|
34
|
+
tabs.push({
|
|
35
|
+
icon: 'rocket',
|
|
36
|
+
priority: 997,
|
|
37
|
+
label: 'New language',
|
|
38
|
+
path: 'translations/new-language'
|
|
39
|
+
} as Tab);
|
|
40
|
+
|
|
41
|
+
tabs.push({
|
|
42
|
+
icon: 'rocket',
|
|
43
|
+
priority: 996,
|
|
44
|
+
label: 'Edit/add translation',
|
|
45
|
+
path: 'translations/new-translate'
|
|
46
|
+
} as Tab);
|
|
47
|
+
}
|
|
48
|
+
return tabs;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
declarations: [],
|
|
6
|
+
imports: [],
|
|
7
|
+
exports: [],
|
|
8
|
+
providers: [
|
|
9
|
+
hookNavigator(
|
|
10
|
+
new NavigatorNode({
|
|
11
|
+
priority: 20,
|
|
12
|
+
icon: 'rocket',
|
|
13
|
+
label: 'Translations'
|
|
14
|
+
})
|
|
15
|
+
)
|
|
16
|
+
]
|
|
17
|
+
})
|
|
18
|
+
export class TranslationsModule {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './user-menu.module';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
3
|
+
import { ExampleUserMenu } from './user-menu';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
declarations: [],
|
|
7
|
+
imports: [CoreModule],
|
|
8
|
+
providers: [ExampleUserMenu]
|
|
9
|
+
})
|
|
10
|
+
export class UserMenuModule {
|
|
11
|
+
// use dependency injection as otherwise ExampleUserMenu will never be instantiated
|
|
12
|
+
constructor(private userMenu: ExampleUserMenu) {}
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { AlertService, gettext, UserMenuService } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Injectable()
|
|
5
|
+
export class ExampleUserMenu {
|
|
6
|
+
// Inject the c8y UserMenuService
|
|
7
|
+
constructor(
|
|
8
|
+
private userMenu: UserMenuService,
|
|
9
|
+
private alert: AlertService
|
|
10
|
+
) {
|
|
11
|
+
// add an item to the user menu
|
|
12
|
+
this.userMenu.add({
|
|
13
|
+
icon: 'notification',
|
|
14
|
+
label: gettext('Notifications'),
|
|
15
|
+
priority: 0,
|
|
16
|
+
click: () => {
|
|
17
|
+
this.onClick();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// method to be called when button in user menu is clicked
|
|
23
|
+
private onClick() {
|
|
24
|
+
this.alert.info(gettext('Notification button clicked.'));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { ControlContainer, NgForm } from '@angular/forms';
|
|
3
|
+
import { DynamicComponent, OnBeforeSave, AlertService } from '@c8y/ngx-components';
|
|
4
|
+
import { omit } from 'lodash';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'c8y-widget-config-demo',
|
|
8
|
+
template: `
|
|
9
|
+
<div class="form-group">
|
|
10
|
+
<c8y-form-group>
|
|
11
|
+
<label>Text</label>
|
|
12
|
+
<textarea
|
|
13
|
+
style="width: 100%"
|
|
14
|
+
name="text"
|
|
15
|
+
[(ngModel)]="config.text"
|
|
16
|
+
[required]="true"
|
|
17
|
+
></textarea>
|
|
18
|
+
</c8y-form-group>
|
|
19
|
+
|
|
20
|
+
<label
|
|
21
|
+
>Configuration
|
|
22
|
+
<button class="btn btn-primary btn-xs" type="button" (click)="more = !more">
|
|
23
|
+
{{ more ? 'Hide' : 'Show' }} settings
|
|
24
|
+
</button></label
|
|
25
|
+
>
|
|
26
|
+
<pre><code>{{ clean(config, more) | json }}</code></pre>
|
|
27
|
+
</div>
|
|
28
|
+
`,
|
|
29
|
+
// We connect our parent Form to this form (for disabling the save button)
|
|
30
|
+
// you can also enable the button by using ContextServiceDashboard.formDisabled
|
|
31
|
+
// property instead (by default it is enabled).
|
|
32
|
+
viewProviders: [{ provide: ControlContainer, useExisting: NgForm }]
|
|
33
|
+
})
|
|
34
|
+
export class WidgetConfigDemo implements DynamicComponent, OnBeforeSave {
|
|
35
|
+
/**
|
|
36
|
+
* The configuration which is shared between configuration component and display component.
|
|
37
|
+
* Should be searilzabled to allow to save it to the API. The config is saved automatically
|
|
38
|
+
* to the API on "save"-button hit. The onBeforeSave handler can be used to change this behavior,
|
|
39
|
+
* or to manipulate the object.
|
|
40
|
+
*
|
|
41
|
+
* Note: The dashboard itself adds certain properties. As such, some properties are not allowed (e.g. device or settings)
|
|
42
|
+
*/
|
|
43
|
+
@Input() config: any = {};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* An internal component property used to hide/show settings.
|
|
47
|
+
*/
|
|
48
|
+
more = false;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Default Angular DI can be used, to use additional services.
|
|
52
|
+
*/
|
|
53
|
+
constructor(private alert: AlertService) {}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* This example onBeforeSave handler cancels the saving, if the text is only a white-space.
|
|
57
|
+
*/
|
|
58
|
+
onBeforeSave(config: any): boolean {
|
|
59
|
+
if (config.text.trim() === '') {
|
|
60
|
+
this.alert.warning('Please enter a valid text.');
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
this.config.widgetInstanceGlobalTimeContext = true;
|
|
64
|
+
this.config.canDecoupleGlobalTimeContext = true;
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Used to hide/show config settings on toggle.
|
|
70
|
+
*/
|
|
71
|
+
clean(config, more) {
|
|
72
|
+
if (more) {
|
|
73
|
+
return config;
|
|
74
|
+
}
|
|
75
|
+
return omit(config, 'settings');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
selectionChanged(e) {
|
|
79
|
+
console.log(e);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Component, Input, SimpleChanges } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'c8y-widget-demo',
|
|
5
|
+
template: `
|
|
6
|
+
<div class="p-16">
|
|
7
|
+
<h1>Hi I'm a widget from angular</h1>
|
|
8
|
+
<p class="text">{{ config?.text || 'No text' }}</p>
|
|
9
|
+
<small>My context is: {{ config?.device?.name || 'No context' }}</small
|
|
10
|
+
><br />
|
|
11
|
+
My time context is:
|
|
12
|
+
<ul *ngIf="config?.date?.length === 2">
|
|
13
|
+
<li>from: {{ (config?.date[0] | c8yDate) || 'No time context' }}</li>
|
|
14
|
+
<li>To: {{ (config?.date[1] | c8yDate) || 'No time context' }}</li>
|
|
15
|
+
</ul>
|
|
16
|
+
</div>
|
|
17
|
+
`,
|
|
18
|
+
styles: [
|
|
19
|
+
`
|
|
20
|
+
.text {
|
|
21
|
+
transform: scaleX(-1);
|
|
22
|
+
font-size: 3em;
|
|
23
|
+
}
|
|
24
|
+
`
|
|
25
|
+
]
|
|
26
|
+
})
|
|
27
|
+
export class WidgetDemo {
|
|
28
|
+
@Input() config;
|
|
29
|
+
|
|
30
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
31
|
+
if (!changes.config.firstChange && changes.config.currentValue.date) {
|
|
32
|
+
console.log('Global time context changed:', this.config.date);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|