@c8y/tutorial 1021.80.1 → 1022.3.2
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/cumulocity.config.ts +23 -1
- package/package.json +13 -12
- package/src/__mocks/index.ts +168 -1
- package/src/app/app.config.ts +59 -0
- package/src/bootstrap.ts +13 -9
- package/src/bottom-drawer/bottom-drawer-content-example.component.html +28 -0
- package/src/bottom-drawer/bottom-drawer-content-example.component.ts +33 -0
- package/src/bottom-drawer/bottom-drawer-example.component.html +7 -0
- package/src/bottom-drawer/bottom-drawer-example.component.ts +33 -0
- package/src/bottom-drawer/bottom-drawer.providers.ts +17 -0
- package/src/breadcrumbs/index.ts +13 -1
- package/src/client-interceptor/index.ts +16 -1
- package/src/component-styles/syntactically-awesome-style-sheets-example/syntactically-awesome-style-sheets-example.component.scss +4 -2
- package/src/countdown/countdown-example.module.ts +1 -1
- package/src/dashboard/widget-guide-context-dashboard/widget-guide-context-dashboard.component.ts +1 -9
- package/src/date-time-range/date-time-range-example.component.ts +0 -1
- package/src/dynamic-forms/index.ts +13 -1
- package/src/grids/index.ts +13 -1
- package/src/grids/server-grid-example/last-updated-data-grid-column/last-updated.cell-renderer.component.ts +2 -1
- package/src/grids/server-grid-example/server-grid-example.component.html +2 -1
- package/src/grids/tree-grid-example/client-tree-grid-example.component.html +18 -0
- package/src/grids/tree-grid-example/client-tree-grid-example.component.ts +169 -0
- package/src/grids/tree-grid-example/client-tree-grid.data.ts +147 -0
- package/src/grids/tree-grid-example/server-tree-grid-example.component.html +30 -0
- package/src/grids/tree-grid-example/server-tree-grid-example.component.ts +156 -0
- package/src/grids/tree-grid-example/server-tree-grid-example.service.ts +255 -0
- package/src/grids/tree-grid-example/tree-grid-example-tab.factory.ts +31 -0
- package/src/grids/tree-grid-example/tree-grid-example.module.ts +36 -0
- package/src/hello/index.ts +18 -1
- package/src/hooks/action/logout-action/logout-action.component.ts +3 -4
- package/src/hooks/generic-wizard/minimal-setup/minimal-setup.component.ts +4 -1
- package/src/hooks/generic-wizard/minimal-setup/multiple-entries-one.component.ts +9 -2
- package/src/hooks/generic-wizard/minimal-setup/multiple-entries-two.component.ts +9 -2
- package/src/hooks/generic-wizard/wizard.module.ts +9 -2
- package/src/hooks/index.ts +13 -1
- package/src/hooks/navigator/index.ts +12 -1
- package/src/hooks/route/index.ts +42 -1
- package/src/hooks/stepper/basic-view/basic-view.component.ts +11 -2
- package/src/hooks/stepper/stepper-hook.module.ts +7 -2
- package/src/hooks/stepper/steps/step1.component.ts +26 -3
- package/src/hooks/stepper/steps/step2.component.ts +4 -1
- package/src/hooks/widget-config/additional-config/additional-config.component.ts +16 -0
- package/src/hooks/widget-config/basic-view/basic-edit.component.html +18 -0
- package/src/hooks/widget-config/basic-view/basic-edit.component.ts +31 -0
- package/src/hooks/widget-config/widget-config.providers.ts +59 -0
- package/src/i18n.ts +3 -0
- package/src/lazy/index.ts +38 -1
- package/src/lazy-widget/index.ts +26 -1
- package/src/list/index.ts +13 -1
- package/src/main.ts +7 -10
- package/src/maps/{map-examples.module.ts → index.ts} +4 -9
- package/src/provider-configuration/index.ts +0 -2
- package/src/provider-configuration/introduction-example/{introduction.module.ts → index.ts} +5 -7
- package/src/redirect-to-last-route/index.ts +16 -1
- package/src/redirect-to-last-route/redirect-to-last-route-guard.service.ts +11 -2
- package/src/selector/alarm-event-selector-example/alarm-event-selector.module.ts +1 -1
- package/src/selector/asset-selector-example/general-example/asset-selector-example.component.ts +1 -2
- package/src/translations/index.ts +13 -1
- package/src/user-menu/index.ts +23 -1
- package/src/widget/demo-widget-config.component.ts +11 -3
- package/src/widget/demo-widget.component.ts +6 -2
- package/src/widget/index.ts +41 -1
- package/src/widget-resolvers/alternative-event.resolver.ts +8 -2
- package/src/widget-resolvers/index.ts +47 -1
- package/src/widget-resolvers/widget-resolvers-config/widget-resolvers-config.component.ts +7 -3
- package/src/widget-resolvers/widget-resolvers.component.ts +5 -1
- package/src/__mocks/mock.module.ts +0 -173
- package/src/app/app.module.ts +0 -76
- package/src/breadcrumbs/breadcrumbs.module.ts +0 -14
- package/src/client-interceptor/client-interceptor.module.ts +0 -12
- package/src/dynamic-forms/dynamic-forms.module.ts +0 -16
- package/src/grids/grids.module.ts +0 -17
- package/src/hello/hello.module.ts +0 -20
- package/src/hooks/hooks.module.ts +0 -19
- package/src/hooks/navigator/navigator.module.ts +0 -21
- package/src/hooks/route/route.module.ts +0 -51
- package/src/lazy/lazy-routing.module.ts +0 -21
- package/src/lazy/lazy.hooks.ts +0 -24
- package/src/lazy-widget/lazy-widget.module.ts +0 -30
- package/src/list/lists.module.ts +0 -17
- package/src/redirect-to-last-route/redirect-to-last-route.module.ts +0 -20
- package/src/translations/translations.module.ts +0 -18
- package/src/user-menu/user-menu.module.ts +0 -13
- package/src/user-menu/user-menu.ts +0 -26
- package/src/widget/demo-widget.module.ts +0 -55
- package/src/widget-resolvers/widget-resolvers.module.ts +0 -52
package/cumulocity.config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigurationOptions } from '@c8y/devkit';
|
|
2
2
|
import { DefinePlugin } from 'webpack';
|
|
3
|
-
import { author, description, name, version } from './package.json';
|
|
3
|
+
import { author, description, name, version, license } from './package.json';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
runTime: {
|
|
@@ -15,6 +15,7 @@ export default {
|
|
|
15
15
|
icon: {
|
|
16
16
|
class: 'c8y-icon-tools'
|
|
17
17
|
},
|
|
18
|
+
license,
|
|
18
19
|
docs: {
|
|
19
20
|
links: [
|
|
20
21
|
{
|
|
@@ -415,6 +416,13 @@ export default {
|
|
|
415
416
|
description: 'An example for a server data grid.',
|
|
416
417
|
scope: 'self'
|
|
417
418
|
},
|
|
419
|
+
{
|
|
420
|
+
name: 'Tree grid example',
|
|
421
|
+
module: 'TreeGridExampleModule',
|
|
422
|
+
path: './src/grids/tree-grid-example/tree-grid-example.module.ts',
|
|
423
|
+
description: 'An example for a tree data grid.',
|
|
424
|
+
scope: 'self'
|
|
425
|
+
},
|
|
418
426
|
{
|
|
419
427
|
name: 'Device grid example',
|
|
420
428
|
module: 'DeviceGridExampleModule',
|
|
@@ -778,6 +786,20 @@ export default {
|
|
|
778
786
|
path: './src/countdown/countdown-example.module.ts',
|
|
779
787
|
description: 'This is an example for the countdown component.',
|
|
780
788
|
scope: 'self'
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
name: 'Bottom drawer',
|
|
792
|
+
module: 'bottomDrawerExampleModuleProviders',
|
|
793
|
+
path: './src/bottom-drawer/bottom-drawer.providers.ts',
|
|
794
|
+
description: 'This is an example for the bottom drawer service.',
|
|
795
|
+
scope: 'self'
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
name: 'Widget Config Hook',
|
|
799
|
+
module: 'widgetConfigHookProviders',
|
|
800
|
+
path: './src/hooks/widget-config/widget-config.providers.ts',
|
|
801
|
+
description: 'This is an example for the bottom drawer service.',
|
|
802
|
+
scope: 'self'
|
|
781
803
|
}
|
|
782
804
|
]
|
|
783
805
|
},
|
package/package.json
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c8y/tutorial",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1022.3.2",
|
|
4
4
|
"description": "This package is used to scaffold a tutorial for Cumulocity IoT Web SDK which explains a lot of concepts.",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@c8y/style": "
|
|
7
|
-
"@c8y/ngx-components": "
|
|
8
|
-
"@c8y/client": "
|
|
9
|
-
"@c8y/bootstrap": "
|
|
10
|
-
"@angular/cdk": "^
|
|
11
|
-
"ngx-bootstrap": "
|
|
6
|
+
"@c8y/style": "1022.3.2",
|
|
7
|
+
"@c8y/ngx-components": "1022.3.2",
|
|
8
|
+
"@c8y/client": "1022.3.2",
|
|
9
|
+
"@c8y/bootstrap": "1022.3.2",
|
|
10
|
+
"@angular/cdk": "^19.2.18",
|
|
11
|
+
"ngx-bootstrap": "19.0.2",
|
|
12
12
|
"leaflet": "1.9.4",
|
|
13
|
-
"rxjs": "
|
|
13
|
+
"rxjs": "7.8.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@c8y/options": "
|
|
17
|
-
"@c8y/devkit": "
|
|
16
|
+
"@c8y/options": "1022.3.2",
|
|
17
|
+
"@c8y/devkit": "1022.3.2"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@angular/common": ">=
|
|
20
|
+
"@angular/common": ">=19 <20"
|
|
21
21
|
},
|
|
22
|
-
"author": "Cumulocity GmbH"
|
|
22
|
+
"author": "Cumulocity GmbH",
|
|
23
|
+
"license": "Apache-2.0"
|
|
23
24
|
}
|
package/src/__mocks/index.ts
CHANGED
|
@@ -1,5 +1,172 @@
|
|
|
1
|
-
export * from './mock.module';
|
|
2
1
|
export * from './mock.service';
|
|
3
2
|
export * from './mock.model';
|
|
4
3
|
export * from './mock.realtime';
|
|
5
4
|
export * from './mock.realtime-subject';
|
|
5
|
+
import { AppStateService, OptionsService, RealtimeSubjectService } from '@c8y/ngx-components';
|
|
6
|
+
import { InventoryInterceptor } from './global-mocks/inventory.interceptor';
|
|
7
|
+
import { MeasurementsInterceptor } from './global-mocks/measurements.interceptor';
|
|
8
|
+
import { API_MOCK_CONFIG, ApiMockConfig } from './mock.model';
|
|
9
|
+
import { RealtimeSubjectServiceWithMocking } from './mock.realtime';
|
|
10
|
+
import { ContextDashboardInterceptor } from './scoped-mocks/context-dashboard';
|
|
11
|
+
import { DeviceDataGridInterceptor } from './scoped-mocks/device-data-grid';
|
|
12
|
+
import { ListsInterceptor } from './scoped-mocks/lists';
|
|
13
|
+
import { NamedContextDashboardInterceptor } from './scoped-mocks/named-context-dashboard';
|
|
14
|
+
import { ServerSideDataGridInterceptor } from './scoped-mocks/server-side-data-grid';
|
|
15
|
+
import { ServiceDashboardInterceptor } from './scoped-mocks/service-dashboard';
|
|
16
|
+
import { TypeaheadInterceptor } from './scoped-mocks/typeahead';
|
|
17
|
+
import { MeasurementsSeriesInterceptor } from './scoped-mocks/measurement-series';
|
|
18
|
+
import { EnvironmentProviders, Provider, inject, provideAppInitializer } from '@angular/core';
|
|
19
|
+
import { MockService } from './mock.service';
|
|
20
|
+
import { IUser } from '@c8y/client';
|
|
21
|
+
|
|
22
|
+
export function provideAPIMock() {
|
|
23
|
+
return [
|
|
24
|
+
// TODO: ask Jan about mocking clusters maps/cluster
|
|
25
|
+
// {
|
|
26
|
+
// provide: API_MOCK_CONFIG,
|
|
27
|
+
// useValue: {
|
|
28
|
+
// id: 'a-cluster-map-interceptor',
|
|
29
|
+
// path: 'maps/cluster',
|
|
30
|
+
// mockService: BoilerplateInterceptor,
|
|
31
|
+
// debug: true
|
|
32
|
+
// } as ApiMockConfig,
|
|
33
|
+
// multi: true
|
|
34
|
+
// },
|
|
35
|
+
{
|
|
36
|
+
provide: API_MOCK_CONFIG,
|
|
37
|
+
useValue: {
|
|
38
|
+
id: 'a-datapoints-export-selector-interceptor',
|
|
39
|
+
path: 'datapoints-export-selector-example',
|
|
40
|
+
mockService: MeasurementsSeriesInterceptor,
|
|
41
|
+
debug: true
|
|
42
|
+
} as ApiMockConfig,
|
|
43
|
+
multi: true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
provide: API_MOCK_CONFIG,
|
|
47
|
+
useValue: {
|
|
48
|
+
id: 'a-service-dashboard-interceptor',
|
|
49
|
+
path: 'service-dashboard',
|
|
50
|
+
mockService: ServiceDashboardInterceptor,
|
|
51
|
+
debug: true
|
|
52
|
+
} as ApiMockConfig,
|
|
53
|
+
multi: true
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
provide: API_MOCK_CONFIG,
|
|
57
|
+
useValue: {
|
|
58
|
+
id: 'list-group-interceptor',
|
|
59
|
+
path: 'lists',
|
|
60
|
+
mockService: ListsInterceptor,
|
|
61
|
+
debug: true
|
|
62
|
+
} as ApiMockConfig,
|
|
63
|
+
multi: true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
provide: API_MOCK_CONFIG,
|
|
67
|
+
useValue: {
|
|
68
|
+
id: 'for-of-interceptor',
|
|
69
|
+
path: 'for-of',
|
|
70
|
+
mockService: ListsInterceptor,
|
|
71
|
+
debug: true
|
|
72
|
+
} as ApiMockConfig,
|
|
73
|
+
multi: true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
provide: API_MOCK_CONFIG,
|
|
77
|
+
useValue: {
|
|
78
|
+
id: 'typeahaed-interceptor',
|
|
79
|
+
path: 'typeahead',
|
|
80
|
+
mockService: TypeaheadInterceptor,
|
|
81
|
+
debug: true
|
|
82
|
+
} as ApiMockConfig,
|
|
83
|
+
multi: true
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
provide: API_MOCK_CONFIG,
|
|
87
|
+
useValue: {
|
|
88
|
+
id: 'server-side-data-grid-interceptor',
|
|
89
|
+
path: 'server-grid-example',
|
|
90
|
+
mockService: ServerSideDataGridInterceptor
|
|
91
|
+
} as ApiMockConfig,
|
|
92
|
+
multi: true
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
provide: API_MOCK_CONFIG,
|
|
96
|
+
useValue: {
|
|
97
|
+
id: 'device-data-grid-interceptor',
|
|
98
|
+
path: 'device-grid-example',
|
|
99
|
+
mockService: DeviceDataGridInterceptor
|
|
100
|
+
} as ApiMockConfig,
|
|
101
|
+
multi: true
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
provide: API_MOCK_CONFIG,
|
|
105
|
+
useValue: {
|
|
106
|
+
id: 'scoped-dashboard-context-interceptor',
|
|
107
|
+
path: 'dashboards/context',
|
|
108
|
+
mockService: ContextDashboardInterceptor
|
|
109
|
+
} as ApiMockConfig,
|
|
110
|
+
multi: true
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
provide: API_MOCK_CONFIG,
|
|
114
|
+
useValue: {
|
|
115
|
+
id: 'scoped-dashboard-context-interceptor-2',
|
|
116
|
+
path: 'dashboards/widget-guide-context-dashboard',
|
|
117
|
+
mockService: ContextDashboardInterceptor
|
|
118
|
+
} as ApiMockConfig,
|
|
119
|
+
multi: true
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
provide: API_MOCK_CONFIG,
|
|
123
|
+
useValue: {
|
|
124
|
+
path: 'named-context',
|
|
125
|
+
// The interceptors are sorted by their ID, so the scoped interceptors should be before the global ones.
|
|
126
|
+
id: 'named-context-interceptor-example',
|
|
127
|
+
mockService: NamedContextDashboardInterceptor
|
|
128
|
+
} as ApiMockConfig,
|
|
129
|
+
multi: true
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
provide: API_MOCK_CONFIG,
|
|
133
|
+
useValue: {
|
|
134
|
+
// The interceptors are sorted by their ID, so the scoped interceptors should be before the global ones.
|
|
135
|
+
id: 'z-global-inventory-interceptor',
|
|
136
|
+
mockService: InventoryInterceptor
|
|
137
|
+
} as ApiMockConfig,
|
|
138
|
+
multi: true
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
provide: API_MOCK_CONFIG,
|
|
142
|
+
useValue: {
|
|
143
|
+
// The interceptors are sorted by their ID, so the scoped interceptors should be before the global ones.
|
|
144
|
+
id: 'z-global-measurementsInterceptor-interceptor',
|
|
145
|
+
mockService: MeasurementsInterceptor
|
|
146
|
+
} as ApiMockConfig,
|
|
147
|
+
multi: true
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
provide: RealtimeSubjectService,
|
|
151
|
+
useExisting: RealtimeSubjectServiceWithMocking
|
|
152
|
+
},
|
|
153
|
+
provideAppInitializer(() => {
|
|
154
|
+
const initializerFn = ((
|
|
155
|
+
_service: MockService,
|
|
156
|
+
appStateService: AppStateService,
|
|
157
|
+
options: OptionsService
|
|
158
|
+
) => {
|
|
159
|
+
return () => {
|
|
160
|
+
if (options.get('noLogin', false)) {
|
|
161
|
+
appStateService.currentUser.next({
|
|
162
|
+
id: 'NO_LOGIN',
|
|
163
|
+
userName: 'noLogin',
|
|
164
|
+
displayName: 'noLogin'
|
|
165
|
+
} as IUser);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
})(inject(MockService), inject(AppStateService), inject(OptionsService));
|
|
169
|
+
return initializerFn();
|
|
170
|
+
})
|
|
171
|
+
] satisfies (Provider | EnvironmentProviders)[];
|
|
172
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
|
|
2
|
+
import { provideAnimations } from '@angular/platform-browser/animations';
|
|
3
|
+
import { CoreModule, hookWidget, RouterModule, VersionModule } from '@c8y/ngx-components';
|
|
4
|
+
import { provideHelloSample } from '../hello';
|
|
5
|
+
import { provideRouteSample } from '../hooks/route';
|
|
6
|
+
import { provideDemoWidget } from '../widget';
|
|
7
|
+
import { provideHooksSample } from '../hooks';
|
|
8
|
+
import { provideHooksNavigatorSample } from '../hooks/navigator';
|
|
9
|
+
import { provideListsSampleNavigator } from '../list';
|
|
10
|
+
import { provideGridSampleNode } from '../grids';
|
|
11
|
+
import { provideLazySample } from '../lazy';
|
|
12
|
+
import { provideProviderConfigurationIntroduction } from '../provider-configuration/introduction-example';
|
|
13
|
+
import { provideDynamicFormsNavigator } from '../dynamic-forms';
|
|
14
|
+
import { provideWidgetsResolverSample } from '../widget-resolvers';
|
|
15
|
+
import { provideMapExampleNavigator } from '../maps';
|
|
16
|
+
import { provideTranslationsNavigator } from '../translations';
|
|
17
|
+
import { provideLazyWidget } from '../lazy-widget';
|
|
18
|
+
import { provideBreadcrumbsNavigator } from '../breadcrumbs';
|
|
19
|
+
import { cockpitDefaultWidgets } from '@c8y/ngx-components/widgets/cockpit';
|
|
20
|
+
import { deviceManagementDefaultWidgets } from '@c8y/ngx-components/widgets/device-management';
|
|
21
|
+
import { provideClientInterceptorSample } from '../client-interceptor';
|
|
22
|
+
import { provideUserMenuSample } from '../user-menu';
|
|
23
|
+
import { AlarmsModule } from '@c8y/ngx-components/alarms';
|
|
24
|
+
import { BulkOperationSchedulerModule } from '@c8y/ngx-components/operations/bulk-operation-scheduler';
|
|
25
|
+
import { provideRedirectToLastRoute } from '../redirect-to-last-route';
|
|
26
|
+
import { provideAPIMock } from '../__mocks';
|
|
27
|
+
|
|
28
|
+
export const appConfig: ApplicationConfig = {
|
|
29
|
+
providers: [
|
|
30
|
+
provideAnimations(),
|
|
31
|
+
importProvidersFrom(RouterModule.forRoot()),
|
|
32
|
+
importProvidersFrom(CoreModule.forRoot()),
|
|
33
|
+
// The following modules show examples of how to
|
|
34
|
+
...provideHelloSample(),
|
|
35
|
+
...provideRouteSample(),
|
|
36
|
+
...provideDemoWidget(),
|
|
37
|
+
...provideHooksSample(),
|
|
38
|
+
...provideHooksNavigatorSample(),
|
|
39
|
+
...provideListsSampleNavigator(),
|
|
40
|
+
...provideGridSampleNode(),
|
|
41
|
+
...provideLazySample(),
|
|
42
|
+
importProvidersFrom(BulkOperationSchedulerModule),
|
|
43
|
+
...provideProviderConfigurationIntroduction(),
|
|
44
|
+
...provideDynamicFormsNavigator(),
|
|
45
|
+
...provideWidgetsResolverSample(),
|
|
46
|
+
...provideUserMenuSample(),
|
|
47
|
+
...provideClientInterceptorSample(),
|
|
48
|
+
...provideMapExampleNavigator(),
|
|
49
|
+
...provideTranslationsNavigator(),
|
|
50
|
+
// Get rid of a default version factory
|
|
51
|
+
importProvidersFrom(VersionModule.config({ disableWebSDKPluginVersionFactory: true })),
|
|
52
|
+
...provideLazyWidget(),
|
|
53
|
+
hookWidget([...cockpitDefaultWidgets, ...deviceManagementDefaultWidgets]),
|
|
54
|
+
...provideRedirectToLastRoute(),
|
|
55
|
+
...provideAPIMock(),
|
|
56
|
+
...provideBreadcrumbsNavigator(),
|
|
57
|
+
importProvidersFrom(AlarmsModule.config({ hybrid: false }))
|
|
58
|
+
]
|
|
59
|
+
};
|
package/src/bootstrap.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import './polyfills';
|
|
2
|
+
import '@angular/compiler';
|
|
2
3
|
|
|
3
4
|
import { enableProdMode } from '@angular/core';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import './
|
|
8
|
-
import './translations/locales/it.po';
|
|
5
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
6
|
+
import { BootstrapComponent, provideBootstrapMetadata } from '@c8y/ngx-components';
|
|
7
|
+
import { BootstrapMetaData } from '@c8y/bootstrap';
|
|
8
|
+
import { appConfig } from './app/app.config';
|
|
9
9
|
|
|
10
10
|
declare const __MODE__: string;
|
|
11
11
|
if (__MODE__ === 'production') {
|
|
12
12
|
enableProdMode();
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function bootstrap() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
export function bootstrap(metadata: BootstrapMetaData) {
|
|
16
|
+
appConfig.providers.push(...provideBootstrapMetadata(metadata));
|
|
17
|
+
/**
|
|
18
|
+
* Bootstrap your application with the BootstrapComponent which will use the `<c8y-bootstrap>`
|
|
19
|
+
* component to initialize the root application. Alternatively you can bootstrap
|
|
20
|
+
* a component of your choice and include that tag into its template or only reuse the given components
|
|
21
|
+
*/
|
|
22
|
+
return bootstrapApplication(BootstrapComponent, appConfig).catch(err => console.log(err));
|
|
19
23
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<div class="card-header separator">
|
|
2
|
+
<span class="h4 card-title">Bottom drawer title</span>
|
|
3
|
+
</div>
|
|
4
|
+
<div class="inner-scroll flex-grow">
|
|
5
|
+
<div class="card-block">
|
|
6
|
+
<p>Bottom drawer content</p>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="card-footer text-center p-24 separator flex-no-shrink">
|
|
10
|
+
<button
|
|
11
|
+
class="btn btn-default"
|
|
12
|
+
[disabled]="isDisabled"
|
|
13
|
+
>
|
|
14
|
+
This button is disabled, as the inital state defines it.
|
|
15
|
+
</button>
|
|
16
|
+
<button
|
|
17
|
+
class="btn btn-default"
|
|
18
|
+
(click)="cancel()"
|
|
19
|
+
>
|
|
20
|
+
Cancel
|
|
21
|
+
</button>
|
|
22
|
+
<button
|
|
23
|
+
class="btn btn-primary"
|
|
24
|
+
(click)="save()"
|
|
25
|
+
>
|
|
26
|
+
Save
|
|
27
|
+
</button>
|
|
28
|
+
</div>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component, inject } from '@angular/core';
|
|
2
|
+
import { BottomDrawerRef } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'tut-bottom-drawer-content-example',
|
|
6
|
+
templateUrl: './bottom-drawer-content-example.component.html',
|
|
7
|
+
standalone: true,
|
|
8
|
+
host: {
|
|
9
|
+
class: 'd-contents'
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
export class BottomDrawerContentExampleComponent {
|
|
13
|
+
bottomDrawerRef = inject(BottomDrawerRef);
|
|
14
|
+
isDisabled = false;
|
|
15
|
+
|
|
16
|
+
result: Promise<string> = new Promise((resolve, reject) => {
|
|
17
|
+
this._save = resolve;
|
|
18
|
+
this._cancel = reject;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
private _save: (value: string) => void;
|
|
22
|
+
private _cancel: (reason?: any) => void;
|
|
23
|
+
|
|
24
|
+
cancel() {
|
|
25
|
+
this._cancel('User canceled');
|
|
26
|
+
this.bottomDrawerRef.close();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
save() {
|
|
30
|
+
this._save('Value to pass back.');
|
|
31
|
+
this.bottomDrawerRef.close();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component, inject } from '@angular/core';
|
|
2
|
+
import { AlertService, BottomDrawerService, CoreModule } from '@c8y/ngx-components';
|
|
3
|
+
import { BottomDrawerContentExampleComponent } from './bottom-drawer-content-example.component';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'tut-bottom-drawer-example',
|
|
7
|
+
templateUrl: './bottom-drawer-example.component.html',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [CoreModule]
|
|
10
|
+
})
|
|
11
|
+
export class BottomDrawerExampleComponent {
|
|
12
|
+
bottomDrawerService = inject(BottomDrawerService);
|
|
13
|
+
alertService = inject(AlertService);
|
|
14
|
+
isOpen = false;
|
|
15
|
+
|
|
16
|
+
async openDrawer() {
|
|
17
|
+
this.isOpen = true;
|
|
18
|
+
const drawer = this.bottomDrawerService.openDrawer(BottomDrawerContentExampleComponent, {
|
|
19
|
+
initialState: {
|
|
20
|
+
// place here any content you want to pass to the component
|
|
21
|
+
isDisabled: true
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const resultOf = await drawer.instance.result;
|
|
27
|
+
this.alertService.success(resultOf);
|
|
28
|
+
} catch (ex) {
|
|
29
|
+
this.alertService.danger('Canceled as of: ' + ex);
|
|
30
|
+
}
|
|
31
|
+
this.isOpen = false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
2
|
+
|
|
3
|
+
export const bottomDrawerExampleModuleProviders = [
|
|
4
|
+
hookRoute({
|
|
5
|
+
path: 'bottom-drawer',
|
|
6
|
+
loadComponent: () =>
|
|
7
|
+
import('./bottom-drawer-example.component').then(m => m.BottomDrawerExampleComponent)
|
|
8
|
+
}),
|
|
9
|
+
hookNavigator(
|
|
10
|
+
new NavigatorNode({
|
|
11
|
+
label: 'Bottom drawer',
|
|
12
|
+
path: '/bottom-drawer',
|
|
13
|
+
icon: 'th-list',
|
|
14
|
+
priority: 0
|
|
15
|
+
})
|
|
16
|
+
)
|
|
17
|
+
];
|
package/src/breadcrumbs/index.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
import { hookNavigator, NavigatorNode } from '@c8y/ngx-components';
|
|
2
|
+
|
|
1
3
|
export * from './basic-example/breadcrumbs-example.module';
|
|
2
4
|
export * from './expand-example/breadcrumbs-expand-example.module';
|
|
3
5
|
export * from './outlet/breadcrumbs-outlet-example.module';
|
|
4
6
|
export * from './content-projection/breadcrumbs-content-projection-example.module';
|
|
5
|
-
|
|
7
|
+
|
|
8
|
+
export function provideBreadcrumbsNavigator() {
|
|
9
|
+
return [
|
|
10
|
+
hookNavigator(
|
|
11
|
+
new NavigatorNode({
|
|
12
|
+
icon: 'notification',
|
|
13
|
+
label: 'Breadcrumbs'
|
|
14
|
+
})
|
|
15
|
+
)
|
|
16
|
+
];
|
|
17
|
+
}
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { EnvironmentProviders, Provider, inject, provideAppInitializer } from '@angular/core';
|
|
2
|
+
import { ApiService } from '@c8y/ngx-components/api';
|
|
3
|
+
import { ClientInterceptorService } from './client-interceptor.service';
|
|
4
|
+
|
|
5
|
+
export function provideClientInterceptorSample() {
|
|
6
|
+
return [
|
|
7
|
+
provideAppInitializer(() => {
|
|
8
|
+
const initializerFn = ((apiService: ApiService, interceptor: ClientInterceptorService) => {
|
|
9
|
+
return () => {
|
|
10
|
+
apiService.addInterceptor(interceptor, 'tutorialAppDemoInterceptor');
|
|
11
|
+
};
|
|
12
|
+
})(inject(ApiService), inject(ClientInterceptorService));
|
|
13
|
+
return initializerFn();
|
|
14
|
+
})
|
|
15
|
+
] satisfies (Provider | EnvironmentProviders)[];
|
|
16
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use "sass:color";
|
|
2
|
+
|
|
1
3
|
$background-color: #f6ffed;
|
|
2
4
|
$border-color: #b7eb8f;
|
|
3
5
|
|
|
@@ -7,10 +9,10 @@ $border-color: #b7eb8f;
|
|
|
7
9
|
border: 1px solid $border-color;
|
|
8
10
|
|
|
9
11
|
h5 {
|
|
10
|
-
color:
|
|
12
|
+
color: color.adjust($border-color, $lightness: -30%)
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
p {
|
|
14
|
-
color:
|
|
16
|
+
color: color.adjust($border-color, $lightness: -30%)
|
|
15
17
|
}
|
|
16
18
|
}
|
|
@@ -4,7 +4,7 @@ import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
|
4
4
|
@NgModule({
|
|
5
5
|
providers: [
|
|
6
6
|
hookRoute({
|
|
7
|
-
path: '
|
|
7
|
+
path: 'countdown',
|
|
8
8
|
loadComponent: () =>
|
|
9
9
|
import('./countdown-example.component').then(m => m.CountdownExampleComponent)
|
|
10
10
|
}),
|
package/src/dashboard/widget-guide-context-dashboard/widget-guide-context-dashboard.component.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Component } from '@angular/core';
|
|
2
2
|
import { CoreModule, Widget } from '@c8y/ngx-components';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
|
-
import { AssetSelectorModule } from '@c8y/ngx-components/assets-navigator';
|
|
5
|
-
import { DatapointSelectorModule } from '@c8y/ngx-components/datapoint-selector';
|
|
6
4
|
import { ContextDashboardModule } from '@c8y/ngx-components/context-dashboard';
|
|
7
5
|
|
|
8
6
|
@Component({
|
|
@@ -16,13 +14,7 @@ import { ContextDashboardModule } from '@c8y/ngx-components/context-dashboard';
|
|
|
16
14
|
></c8y-context-dashboard>
|
|
17
15
|
`,
|
|
18
16
|
standalone: true,
|
|
19
|
-
imports: [
|
|
20
|
-
CommonModule,
|
|
21
|
-
CoreModule,
|
|
22
|
-
AssetSelectorModule,
|
|
23
|
-
DatapointSelectorModule,
|
|
24
|
-
ContextDashboardModule
|
|
25
|
-
]
|
|
17
|
+
imports: [ContextDashboardModule, CoreModule, CommonModule]
|
|
26
18
|
})
|
|
27
19
|
export class WidgetGuideContextDashboardComponent {
|
|
28
20
|
defaultWidgets: Widget[] = [
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { hookNavigator, NavigatorNode } from '@c8y/ngx-components';
|
|
2
|
+
|
|
2
3
|
export * from './custom-element-example/custom-element-example.module';
|
|
4
|
+
|
|
5
|
+
export function provideDynamicFormsNavigator() {
|
|
6
|
+
return [
|
|
7
|
+
hookNavigator(
|
|
8
|
+
new NavigatorNode({
|
|
9
|
+
label: 'Dynamic forms',
|
|
10
|
+
icon: 'file-text'
|
|
11
|
+
})
|
|
12
|
+
)
|
|
13
|
+
];
|
|
14
|
+
}
|
package/src/grids/index.ts
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { hookNavigator, NavigatorNode } from '@c8y/ngx-components';
|
|
2
|
+
|
|
3
|
+
export function provideGridSampleNode() {
|
|
4
|
+
return [
|
|
5
|
+
hookNavigator(
|
|
6
|
+
new NavigatorNode({
|
|
7
|
+
label: 'Data grid examples',
|
|
8
|
+
icon: 'table',
|
|
9
|
+
priority: 30
|
|
10
|
+
})
|
|
11
|
+
)
|
|
12
|
+
];
|
|
13
|
+
}
|
|
@@ -3,7 +3,8 @@ import { CellRendererContext } from '@c8y/ngx-components';
|
|
|
3
3
|
|
|
4
4
|
@Component({
|
|
5
5
|
template: ` {{ context.value | c8yDate }} `,
|
|
6
|
-
selector: 'c8y-last-updated-cell-renderer'
|
|
6
|
+
selector: 'c8y-last-updated-cell-renderer',
|
|
7
|
+
standalone: false
|
|
7
8
|
})
|
|
8
9
|
export class LastUpdatedCellRendererComponent {
|
|
9
10
|
constructor(public context: CellRendererContext) {}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<c8y-title>Data grid examples</c8y-title>
|
|
2
2
|
|
|
3
3
|
<c8y-data-grid
|
|
4
|
+
class="content-fullpage d-flex d-col border-top border-bottom"
|
|
4
5
|
[title]="title"
|
|
5
6
|
[loadMoreItemsLabel]="loadMoreItemsLabel"
|
|
6
7
|
[loadingItemsLabel]="loadingItemsLabel"
|
|
7
8
|
[displayOptions]="displayOptions"
|
|
8
9
|
[columns]="columns"
|
|
9
10
|
[pagination]="pagination"
|
|
11
|
+
[childNodePagination]="childNodePagination"
|
|
10
12
|
[infiniteScroll]="infiniteScroll"
|
|
11
13
|
[serverSideDataCallback]="serverSideDataCallback"
|
|
12
14
|
[refresh]="refresh"
|
|
@@ -16,7 +18,6 @@
|
|
|
16
18
|
(itemsSelect)="onItemsSelect($event)"
|
|
17
19
|
[bulkActionControls]="bulkActionControls"
|
|
18
20
|
(onConfigChange)="onConfigChange($event)"
|
|
19
|
-
class="content-fullpage d-flex d-col border-top border-bottom"
|
|
20
21
|
>
|
|
21
22
|
<c8y-ui-empty-state
|
|
22
23
|
[icon]="'search'"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<c8y-title>Data grid examples</c8y-title>
|
|
2
|
+
|
|
3
|
+
<c8y-data-grid
|
|
4
|
+
class="content-fullpage d-flex d-col border-top border-bottom"
|
|
5
|
+
[title]="title"
|
|
6
|
+
[columns]="columns"
|
|
7
|
+
[rows]="data"
|
|
8
|
+
[treeGrid]="true"
|
|
9
|
+
[pagination]="pagination"
|
|
10
|
+
[selectable]="selectable"
|
|
11
|
+
(itemsSelect)="onItemsSelect($event)"
|
|
12
|
+
[actionControls]="actionControls"
|
|
13
|
+
[bulkActionControls]="bulkActionControls"
|
|
14
|
+
(onConfigChange)="onConfigChange($event)"
|
|
15
|
+
(onFilter)="onFilter($event)"
|
|
16
|
+
(onAddCustomColumn)="onAddCustomColumn($event)"
|
|
17
|
+
(onRemoveCustomColumn)="onRemoveCustomColumn($event)"
|
|
18
|
+
></c8y-data-grid>
|