@porscheinformatik/clr-addons 11.0.1 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/bundles/clr-addons.umd.js +248 -5
  2. package/bundles/clr-addons.umd.js.map +1 -1
  3. package/clr-addons.d.ts +2 -0
  4. package/clr-addons.metadata.json +1 -1
  5. package/esm2015/clr-addons.js +3 -1
  6. package/esm2015/clr-addons.module.js +3 -1
  7. package/esm2015/clr-addons.module.ngfactory.js +3 -2
  8. package/esm2015/clr-addons.module.ngsummary.json +1 -1
  9. package/esm2015/clr-addons.ngsummary.json +1 -1
  10. package/esm2015/index.js +3 -2
  11. package/esm2015/index.ngsummary.json +1 -1
  12. package/esm2015/location-bar/index.js +4 -0
  13. package/esm2015/location-bar/index.ngsummary.json +1 -0
  14. package/esm2015/location-bar/location-bar-node/location-bar-node.component.js +92 -0
  15. package/esm2015/location-bar/location-bar-node/location-bar-node.component.ngfactory.js +50 -0
  16. package/esm2015/location-bar/location-bar-node/location-bar-node.component.ngsummary.json +1 -0
  17. package/esm2015/location-bar/location-bar.component.js +38 -0
  18. package/esm2015/location-bar/location-bar.component.ngfactory.js +25 -0
  19. package/esm2015/location-bar/location-bar.component.ngsummary.json +1 -0
  20. package/esm2015/location-bar/location-bar.model.js +63 -0
  21. package/esm2015/location-bar/location-bar.model.ngsummary.json +1 -0
  22. package/esm2015/location-bar/location-bar.module.js +15 -0
  23. package/esm2015/location-bar/location-bar.module.ngfactory.js +13 -0
  24. package/esm2015/location-bar/location-bar.module.ngsummary.json +1 -0
  25. package/esm2015/location-bar/location-bar.provider.js +10 -0
  26. package/esm2015/location-bar/location-bar.provider.ngsummary.json +1 -0
  27. package/esm2015/public_api.ngsummary.json +1 -1
  28. package/fesm2015/clr-addons.js +209 -5
  29. package/fesm2015/clr-addons.js.map +1 -1
  30. package/index.d.ts +1 -0
  31. package/location-bar/index.d.ts +3 -0
  32. package/location-bar/location-bar-node/location-bar-node.component.d.ts +44 -0
  33. package/location-bar/location-bar-node/location-bar-node.component.ngfactory.d.ts +1 -0
  34. package/location-bar/location-bar.component.d.ts +12 -0
  35. package/location-bar/location-bar.component.ngfactory.d.ts +1 -0
  36. package/location-bar/location-bar.model.d.ts +54 -0
  37. package/location-bar/location-bar.module.d.ts +2 -0
  38. package/location-bar/location-bar.module.ngfactory.d.ts +3 -0
  39. package/location-bar/location-bar.provider.d.ts +18 -0
  40. package/package.json +1 -1
  41. package/src/components.clr-addons.scss +1 -0
  42. package/src/location-bar/location-bar-node/location-bar-node.component.scss +54 -0
  43. package/styles/clr-addons-phs.css +40 -0
  44. package/styles/clr-addons-phs.css.map +1 -1
  45. package/styles/clr-addons-phs.min.css +1 -1
  46. package/styles/clr-addons-phs.min.css.map +1 -1
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@clr/angular'), require('rxjs'), require('rxjs/operators'), require('@angular/router'), require('@angular/animations')) :
3
- typeof define === 'function' && define.amd ? define('@porscheinformatik/clr-addons', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@clr/angular', 'rxjs', 'rxjs/operators', '@angular/router', '@angular/animations'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.porscheinformatik = global.porscheinformatik || {}, global.porscheinformatik["clr-addons"] = {}), global.ng.core, global.ng.common, global.ng.forms, global["@clr/angular"], global.rxjs, global.rxjs.operators, global.ng.router, global.ng.animations));
5
- })(this, (function (exports, i0, common, forms, angular, rxjs, operators, router, animations) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@clr/angular'), require('rxjs'), require('rxjs/operators'), require('@angular/router'), require('@angular/animations'), require('@cds/core/icon'), require('@cds/core/icon/register.js')) :
3
+ typeof define === 'function' && define.amd ? define('@porscheinformatik/clr-addons', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@clr/angular', 'rxjs', 'rxjs/operators', '@angular/router', '@angular/animations', '@cds/core/icon', '@cds/core/icon/register.js'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.porscheinformatik = global.porscheinformatik || {}, global.porscheinformatik["clr-addons"] = {}), global.ng.core, global.ng.common, global.ng.forms, global["@clr/angular"], global.rxjs, global.rxjs.operators, global.ng.router, global.ng.animations, global.icon));
5
+ })(this, (function (exports, i0, common, forms, angular, rxjs, operators, router, animations, icon) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -4088,6 +4088,241 @@
4088
4088
  },] }
4089
4089
  ];
4090
4090
 
4091
+ /**
4092
+ * The abstract base class for all identifier types
4093
+ */
4094
+ var NodeId = /** @class */ (function () {
4095
+ function NodeId() {
4096
+ }
4097
+ return NodeId;
4098
+ }());
4099
+ /**
4100
+ * The data structure of the location bar component. A location bar node holds the data of
4101
+ * a single node of the location bar. The type of the nodes id is generic and is determined
4102
+ * by the user of the location bar component (e.g. can be a combined identifier). Each node
4103
+ * can have a parent node (except the root node) and an array of children (except leaf nodes).
4104
+ */
4105
+ var LocationBarNode = /** @class */ (function () {
4106
+ /**
4107
+ * @param id The generic identifier of the node
4108
+ * @param label The label to visualize the node
4109
+ * @param selectable Indicator whether the node is selectable
4110
+ * @param preSelected Indicator whether the node is pre-selected
4111
+ */
4112
+ function LocationBarNode(id, label, selectable, preSelected) {
4113
+ if (selectable === void 0) { selectable = true; }
4114
+ if (preSelected === void 0) { preSelected = false; }
4115
+ this.id = id;
4116
+ this.label = label;
4117
+ this.selectable = selectable;
4118
+ this.preSelected = preSelected;
4119
+ }
4120
+ /**
4121
+ * Returns the children of this node. If the children has not been determined so far, null will
4122
+ * be returned. If this node does not have any children, an empty array will be returned.
4123
+ */
4124
+ LocationBarNode.prototype.getChildren = function () {
4125
+ return this.children;
4126
+ };
4127
+ /**
4128
+ * Sets the children for this node
4129
+ * @param children The children to be set for this node
4130
+ * @return This node instance to support a fluent API
4131
+ */
4132
+ LocationBarNode.prototype.setChildren = function (children) {
4133
+ this.children = children || [];
4134
+ };
4135
+ /**
4136
+ * Sets the new selected child
4137
+ * @param selectedChild The child to be selected
4138
+ */
4139
+ LocationBarNode.prototype.setSelectedChild = function (selectedChild) {
4140
+ if (this.selectedChild && !selectedChild) {
4141
+ this.selectedChild.setSelectedChild(null);
4142
+ }
4143
+ this.selectedChild = selectedChild;
4144
+ };
4145
+ /**
4146
+ * @returns The currently selected child
4147
+ */
4148
+ LocationBarNode.prototype.getSelectedChild = function () {
4149
+ return this.selectedChild;
4150
+ };
4151
+ /**
4152
+ * @param other The other instance to check for equality
4153
+ */
4154
+ LocationBarNode.prototype.equals = function (other) {
4155
+ return this.id.equals(other.id);
4156
+ };
4157
+ return LocationBarNode;
4158
+ }());
4159
+
4160
+ icon.ClarityIcons.addIcons(icon.organizationIcon);
4161
+ var LocationBarComponent = /** @class */ (function () {
4162
+ function LocationBarComponent() {
4163
+ this.root$ = new rxjs.ReplaySubject();
4164
+ this.iconShape = 'organization';
4165
+ this.iconTitle = '';
4166
+ this.selectionChanged = new i0.EventEmitter();
4167
+ }
4168
+ Object.defineProperty(LocationBarComponent.prototype, "roots", {
4169
+ set: function (roots) {
4170
+ var internalRoot = new LocationBarNode(null, null, false);
4171
+ internalRoot.setChildren(roots);
4172
+ if (roots.length === 1) {
4173
+ internalRoot.setSelectedChild(roots[0]);
4174
+ }
4175
+ this.root$.next(internalRoot);
4176
+ },
4177
+ enumerable: false,
4178
+ configurable: true
4179
+ });
4180
+ LocationBarComponent.prototype.onSelectionChanged = function (selection) {
4181
+ this.selectionChanged.emit(selection);
4182
+ };
4183
+ return LocationBarComponent;
4184
+ }());
4185
+ LocationBarComponent.decorators = [
4186
+ { type: i0.Component, args: [{
4187
+ selector: 'clr-location-bar',
4188
+ template: "<cds-icon *ngIf=\"iconShape\" [attr.shape]=\"iconShape\" [title]=\"iconTitle\"></cds-icon>\n<clr-location-bar-node (selectionChanged)=\"onSelectionChanged($event)\" [parentNode]=\"root$ | async\">\n</clr-location-bar-node>\n"
4189
+ },] }
4190
+ ];
4191
+ LocationBarComponent.propDecorators = {
4192
+ iconShape: [{ type: i0.Input }],
4193
+ iconTitle: [{ type: i0.Input }],
4194
+ roots: [{ type: i0.Input }],
4195
+ selectionChanged: [{ type: i0.Output }]
4196
+ };
4197
+
4198
+ var CONTENT_PROVIDER = new i0.InjectionToken('CONTENT_PROVIDER');
4199
+ /**
4200
+ * Interface denoting the contract between the location bar component and
4201
+ * its users. The content provider offers callback methods for the location bar
4202
+ * component to gather the content to be displayed.
4203
+ */
4204
+ var LocationBarContentProvider = /** @class */ (function () {
4205
+ function LocationBarContentProvider() {
4206
+ }
4207
+ return LocationBarContentProvider;
4208
+ }());
4209
+
4210
+ icon.ClarityIcons.addIcons(icon.treeViewIcon, icon.angleIcon);
4211
+ /**
4212
+ * Component which renders a node of the location bar.
4213
+ */
4214
+ var LocationBarNodeComponent = /** @class */ (function () {
4215
+ function LocationBarNodeComponent(contentProvider) {
4216
+ this.contentProvider = contentProvider;
4217
+ /**
4218
+ * Emits selection changes
4219
+ */
4220
+ this.selectionChanged = new i0.EventEmitter();
4221
+ /**
4222
+ * The selectable nodes
4223
+ */
4224
+ this.selectableChilds = [];
4225
+ }
4226
+ Object.defineProperty(LocationBarNodeComponent.prototype, "parentNode", {
4227
+ get: function () {
4228
+ return this._parentNode;
4229
+ },
4230
+ set: function (parentNode) {
4231
+ var _this = this;
4232
+ this._parentNode = parentNode;
4233
+ if (this._parentNode) {
4234
+ var children$ = this._parentNode.getChildren() ? rxjs.of(this._parentNode.getChildren()) : this.getLazyChildren();
4235
+ children$.toPromise().then(function (nodes) { return _this.prepareChildren(nodes || []); });
4236
+ }
4237
+ },
4238
+ enumerable: false,
4239
+ configurable: true
4240
+ });
4241
+ LocationBarNodeComponent.prototype.getLazyChildren = function () {
4242
+ return this.contentProvider ? this.contentProvider.getLazyChildren(this._parentNode) : rxjs.of([]);
4243
+ };
4244
+ LocationBarNodeComponent.prototype.prepareChildren = function (nodes) {
4245
+ var e_1, _a;
4246
+ this._parentNode.setChildren(nodes);
4247
+ /* when no node is selected search within the children for the first child to be pre-selected */
4248
+ if (!this._parentNode.getSelectedChild()) {
4249
+ try {
4250
+ for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
4251
+ var node = nodes_1_1.value;
4252
+ if (node.preSelected) {
4253
+ this._parentNode.setSelectedChild(node);
4254
+ node.preSelected = false;
4255
+ break;
4256
+ }
4257
+ }
4258
+ }
4259
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4260
+ finally {
4261
+ try {
4262
+ if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
4263
+ }
4264
+ finally { if (e_1) throw e_1.error; }
4265
+ }
4266
+ }
4267
+ this.selectableChilds = nodes.filter(function (n) { return n.selectable; });
4268
+ };
4269
+ /**
4270
+ * Listens for selection changes of child components and re-emits the selection event.
4271
+ * @param selection The changed selection of child components
4272
+ */
4273
+ LocationBarNodeComponent.prototype.onSelectionChanged = function (selection) {
4274
+ selection.unshift(this._parentNode.getSelectedChild().id);
4275
+ this.selectionChanged.emit(selection);
4276
+ };
4277
+ /**
4278
+ * Selects the given node
4279
+ * node
4280
+ * @param selectedNode The selected child node.
4281
+ */
4282
+ LocationBarNodeComponent.prototype.selectNode = function (selectedNode) {
4283
+ if (selectedNode) {
4284
+ selectedNode.setSelectedChild(null);
4285
+ this._parentNode.setSelectedChild(selectedNode);
4286
+ this.notifySelectionChanged(selectedNode);
4287
+ }
4288
+ };
4289
+ /**
4290
+ * Method called internally to emit the selection event
4291
+ * @param selectedNode The node which has been selected
4292
+ */
4293
+ LocationBarNodeComponent.prototype.notifySelectionChanged = function (selectedNode) {
4294
+ this.selectionChanged.emit([selectedNode.id]);
4295
+ };
4296
+ return LocationBarNodeComponent;
4297
+ }());
4298
+ LocationBarNodeComponent.decorators = [
4299
+ { type: i0.Component, args: [{
4300
+ selector: 'clr-location-bar-node',
4301
+ template: "<ng-container *ngIf=\"parentNode\">\n <ng-content *ngIf=\"parentNode.getChildren()?.length > 0\"></ng-content>\n\n <ng-container\n *ngIf=\"\n (selectableChilds.length > 0 && !parentNode.getSelectedChild()) || selectableChilds.length > 1;\n else singleSelected\n \"\n >\n <clr-dropdown>\n <button class=\"btn btn-link btn-sm\" (blur)=\"focus = false\" (focus)=\"focus = true\" clrDropdownTrigger>\n <ng-container *ngIf=\"parentNode.getSelectedChild() as node; else unselected\">\n <span [class.last-level]=\"!parentNode.getSelectedChild().getSelectedChild()\" title=\"{{ node.label }}\">{{\n node.label\n }}</span>\n <cds-icon shape=\"angle\" direction=\"down\" size=\"xs\" class=\"caret-icon\"></cds-icon>\n </ng-container>\n <ng-template #unselected>\n <cds-icon class=\"unselected\" size=\"18\" [attr.solid]=\"focus\" shape=\"tree-view\"></cds-icon>&nbsp;...\n </ng-template>\n </button>\n <clr-dropdown-menu [clrPosition]=\"'bottom-left'\" *clrIfOpen>\n <button\n *ngFor=\"let item of selectableChilds\"\n type=\"button\"\n clrDropdownItem\n class=\"text-truncate\"\n [class.selected-child]=\"item.id === parentNode.getSelectedChild()?.id\"\n (click)=\"selectNode(item)\"\n title=\"{{ item.label }}\"\n >\n {{ item.label }}\n </button>\n </clr-dropdown-menu>\n </clr-dropdown>\n </ng-container>\n\n <ng-template #singleSelected>\n <ng-container *ngIf=\"parentNode.getSelectedChild()\">\n <ng-container *ngIf=\"parentNode.getSelectedChild().selectable; else unselectable\">\n <button\n class=\"btn btn-link btn-sm\"\n (click)=\"selectNode(parentNode.getSelectedChild())\"\n [class.last-level]=\"!parentNode.getSelectedChild().getSelectedChild()\"\n title=\"{{ parentNode.getSelectedChild().label }}\"\n >\n {{ parentNode.getSelectedChild().label }}\n </button>\n </ng-container>\n <ng-template #unselectable>\n <span\n class=\"unselectable-node\"\n [class.last-level]=\"!parentNode.getSelectedChild().getSelectedChild()\"\n title=\"{{ parentNode.getSelectedChild().label }}\"\n >\n {{ parentNode.getSelectedChild().label }}\n </span>\n </ng-template>\n </ng-container>\n </ng-template>\n\n <clr-location-bar-node\n *ngIf=\"parentNode.getSelectedChild() && parentNode.getChildren().length > 0\"\n [parentNode]=\"parentNode.getSelectedChild()\"\n (selectionChanged)=\"onSelectionChanged($event)\"\n >\n <span>/</span>\n </clr-location-bar-node>\n</ng-container>\n",
4302
+ host: { '[class.location-bar-node]': 'true' }
4303
+ },] }
4304
+ ];
4305
+ LocationBarNodeComponent.ctorParameters = function () { return [
4306
+ { type: LocationBarContentProvider, decorators: [{ type: i0.Inject, args: [CONTENT_PROVIDER,] }, { type: i0.Optional }] }
4307
+ ]; };
4308
+ LocationBarNodeComponent.propDecorators = {
4309
+ selectionChanged: [{ type: i0.Output }],
4310
+ parentNode: [{ type: i0.Input }]
4311
+ };
4312
+
4313
+ var ClrLocationBarModule = /** @class */ (function () {
4314
+ function ClrLocationBarModule() {
4315
+ }
4316
+ return ClrLocationBarModule;
4317
+ }());
4318
+ ClrLocationBarModule.decorators = [
4319
+ { type: i0.NgModule, args: [{
4320
+ declarations: [LocationBarComponent, LocationBarNodeComponent],
4321
+ imports: [common.CommonModule, angular.ClrIconModule, angular.ClrDropdownModule],
4322
+ exports: [LocationBarComponent],
4323
+ },] }
4324
+ ];
4325
+
4091
4326
  /*
4092
4327
  * Copyright (c) 2018-2022 Porsche Informatik. All Rights Reserved.
4093
4328
  * This software is released under MIT license.
@@ -4125,6 +4360,7 @@
4125
4360
  ClrHistoryModule,
4126
4361
  ClrAutocompleteOffModule,
4127
4362
  ClrBrandAvatarModule,
4363
+ ClrLocationBarModule,
4128
4364
  ],
4129
4365
  },] }
4130
4366
  ];
@@ -4669,7 +4905,7 @@
4669
4905
  */
4670
4906
 
4671
4907
  /*
4672
- * Copyright (c) 2018-2021 Porsche Informatik. All Rights Reserved.
4908
+ * Copyright (c) 2018-2022 Porsche Informatik. All Rights Reserved.
4673
4909
  * This software is released under MIT license.
4674
4910
  * The full license information can be found in LICENSE in the root directory of this project.
4675
4911
  */
@@ -4693,6 +4929,7 @@
4693
4929
  exports.BusinessCustomersCommercialShape = BusinessCustomersCommercialShape;
4694
4930
  exports.BusinessCustomersPrivateShape = BusinessCustomersPrivateShape;
4695
4931
  exports.CLR_BLANK_OPTION = CLR_BLANK_OPTION;
4932
+ exports.CONTENT_PROVIDER = CONTENT_PROVIDER;
4696
4933
  exports.CaliforniaServiceShape = CaliforniaServiceShape;
4697
4934
  exports.CaliforniaSpecialistShape = CaliforniaSpecialistShape;
4698
4935
  exports.CarPickupServiceShape = CarPickupServiceShape;
@@ -4734,6 +4971,7 @@
4734
4971
  exports.ClrHistoryService = ClrHistoryService;
4735
4972
  exports.ClrLetterAvatar = ClrLetterAvatar;
4736
4973
  exports.ClrLetterAvatarModule = ClrLetterAvatarModule;
4974
+ exports.ClrLocationBarModule = ClrLocationBarModule;
4737
4975
  exports.ClrMainNavGroup = ClrMainNavGroup;
4738
4976
  exports.ClrMainNavGroupItem = ClrMainNavGroupItem;
4739
4977
  exports.ClrMainNavGroupModule = ClrMainNavGroupModule;
@@ -4799,10 +5037,13 @@
4799
5037
  exports.HybridShape = HybridShape;
4800
5038
  exports.LoadingVolumeShape = LoadingVolumeShape;
4801
5039
  exports.LocateShape = LocateShape;
5040
+ exports.LocationBarContentProvider = LocationBarContentProvider;
5041
+ exports.LocationBarNode = LocationBarNode;
4802
5042
  exports.NewCarCommercialShape = NewCarCommercialShape;
4803
5043
  exports.NewCarPrivateShape = NewCarPrivateShape;
4804
5044
  exports.NewCarUtilityVehicleShape = NewCarUtilityVehicleShape;
4805
5045
  exports.NightServiceShape = NightServiceShape;
5046
+ exports.NodeId = NodeId;
4806
5047
  exports.OffersShape = OffersShape;
4807
5048
  exports.OnCallDutyShape = OnCallDutyShape;
4808
5049
  exports.OpenSatShape = OpenSatShape;
@@ -4853,6 +5094,8 @@
4853
5094
  exports["ɵg"] = ClrAbstractFormComponent;
4854
5095
  exports["ɵh"] = ClrAutocompleteOffModule;
4855
5096
  exports["ɵi"] = ClrAutocompleteOff;
5097
+ exports["ɵj"] = LocationBarComponent;
5098
+ exports["ɵk"] = LocationBarNodeComponent;
4856
5099
 
4857
5100
  Object.defineProperty(exports, '__esModule', { value: true });
4858
5101