@pepperi-addons/ngx-lib 0.2.51-beta.1 → 0.2.51-beta.6

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.
@@ -2741,13 +2741,17 @@
2741
2741
  }))));
2742
2742
  // * 16 convert rem to pixel
2743
2743
  var cardRowsHeight = _this.customizationService.calculateCardRowsHeight(maxRow) * 16;
2744
+ // maxRow * 24 + 60 - 24 for each row in card + 60 for the padding of each card.
2745
+ // const rowSpanToAdd = Math.floor(childrenCount * ((cardRowsHeight + 56) / formRowHeight) + rowsToAdd);
2744
2746
  // + 16 is the 1rem margin outside card.
2745
- var rowSpanToAdd = (childrenCount * (cardRowsHeight + 16));
2746
- // formRowHeight +
2747
- // rowsToAdd;
2747
+ var rowSpanToAdd = (childrenCount * (cardRowsHeight + 16)) /
2748
+ formRowHeight +
2749
+ rowsToAdd;
2748
2750
  _this.field.rowSpan = rowSpanToAdd;
2749
2751
  }
2750
2752
  else {
2753
+ // const tableRowsHeight = this.customizationService.calculateTableRowsHeight(childrenCount) * 16;
2754
+ // this.field.rowSpan = Math.ceil((tableRowsHeight + (rowsToAdd * 40)) / formRowHeight);
2751
2755
  // * 16 convert rem to pixel
2752
2756
  var rowsToAddHeight = _this.customizationService.calculateTableRowsHeight(rowsToAdd, false) * 16;
2753
2757
  var tableRowsHeight = _this.customizationService.calculateTableRowsHeight(childrenCount) * 16;
@@ -3077,6 +3081,97 @@
3077
3081
  { type: ngxLib.PepHttpService }
3078
3082
  ]; };
3079
3083
 
3084
+ var PepInternalCaruselComponent = /** @class */ (function () {
3085
+ function PepInternalCaruselComponent(fb, layoutService, internalCaruselService) {
3086
+ this.fb = fb;
3087
+ this.layoutService = layoutService;
3088
+ this.internalCaruselService = internalCaruselService;
3089
+ this.layoutType = 'form';
3090
+ this.formValueChange = new core.EventEmitter();
3091
+ this.formFieldClick = new core.EventEmitter();
3092
+ this._items = null;
3093
+ this.layout = null;
3094
+ this.duration = 1000;
3095
+ this.itemsToMove = 3;
3096
+ this.prevDisabled = false;
3097
+ this.nextDisabled = false;
3098
+ this.PepScreenSizeType = ngxLib.PepScreenSizeType;
3099
+ }
3100
+ Object.defineProperty(PepInternalCaruselComponent.prototype, "items", {
3101
+ get: function () {
3102
+ return this._items;
3103
+ },
3104
+ set: function (value) {
3105
+ this._items = value;
3106
+ // this.moveTo(0);
3107
+ },
3108
+ enumerable: false,
3109
+ configurable: true
3110
+ });
3111
+ PepInternalCaruselComponent.prototype.ngOnInit = function () {
3112
+ // this.internalCaruselService.initCarusel(
3113
+ // this.field.objectId,
3114
+ // this.field.searchCode,
3115
+ // (caruselItems: any) => {
3116
+ this.layout = TempRelatedItems.UIControl;
3117
+ this.items = TempRelatedItems.Rows;
3118
+ // }
3119
+ // );
3120
+ };
3121
+ PepInternalCaruselComponent.prototype.ngAfterViewInit = function () {
3122
+ var _this = this;
3123
+ this.layoutService.onResize$.subscribe(function (size) {
3124
+ _this.screenSize = size;
3125
+ });
3126
+ };
3127
+ PepInternalCaruselComponent.prototype.onCustomizeObjectChanged = function (customizeObjectChangedData) {
3128
+ this.formValueChange.emit(customizeObjectChangedData);
3129
+ };
3130
+ PepInternalCaruselComponent.prototype.onCustomizeFieldClick = function (fieldClickEvent) {
3131
+ this.formFieldClick.emit(fieldClickEvent);
3132
+ };
3133
+ PepInternalCaruselComponent.prototype.moveLeft = function () {
3134
+ var indexToMove = Math.max(this.carousel.currIndex - this.itemsToMove, 0);
3135
+ this.moveTo(indexToMove);
3136
+ };
3137
+ PepInternalCaruselComponent.prototype.moveRight = function () {
3138
+ var indexToMove = Math.min(this.carousel.currIndex + this.itemsToMove, this.items.length);
3139
+ this.moveTo(indexToMove);
3140
+ };
3141
+ PepInternalCaruselComponent.prototype.moveTo = function (index) {
3142
+ if (this.carousel) {
3143
+ this.carousel.moveTo(index);
3144
+ }
3145
+ };
3146
+ PepInternalCaruselComponent.prototype.onReachesLeftBound = function (event) {
3147
+ this.prevDisabled = event;
3148
+ };
3149
+ PepInternalCaruselComponent.prototype.onReachesRightBound = function (event) {
3150
+ this.nextDisabled = event;
3151
+ };
3152
+ return PepInternalCaruselComponent;
3153
+ }());
3154
+ PepInternalCaruselComponent.decorators = [
3155
+ { type: core.Component, args: [{
3156
+ selector: 'pep-internal-carusel',
3157
+ template: "<div class=\"carousel-container\">\n <ng-container *ngIf=\"items?.length > 0; then carouselBlock; else emptyBlock\"></ng-container>\n <ng-template #emptyBlock>\n <!-- No items -->\n </ng-template>\n <ng-template #carouselBlock>\n <pep-button *ngIf=\"screenSize <= PepScreenSizeType.SM\" [iconName]=\"'arrow_left_alt'\" [styleType]=\"'regular'\"\n [disabled]=\"prevDisabled\" (click)=\"moveLeft()\" class=\"carousel-arrow start-arrow\">\n </pep-button>\n <pep-carousel #carousel [xWheelEnabled]=\"false\" [snapDuration]=\"duration\"\n (reachesLeftBound)=\"onReachesLeftBound($event)\" (reachesRightBound)=\"onReachesRightBound($event)\">\n <ng-container *ngFor=\"let item of items\">\n <pep-form pepCarouselItem [layout]=\"layout\" [data]=\"item\" [layoutType]=\"'card'\" class=\"card-view \"\n (valueChange)=\"onCustomizeObjectChanged($event)\" (fieldClick)=\"onCustomizeFieldClick($event)\">\n </pep-form>\n </ng-container>\n </pep-carousel>\n <pep-button *ngIf=\"screenSize <= PepScreenSizeType.SM\" [iconName]=\"'arrow_right_alt'\" [styleType]=\"'regular'\"\n [disabled]=\"nextDisabled\" (click)=\"moveRight()\" class=\"carousel-arrow end-arrow\">\n </pep-button>\n </ng-template>\n</div>",
3158
+ providers: [PepInternalCaruselService],
3159
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
3160
+ styles: [".carousel-container{position:relative;margin:0;display:grid}.carousel-container .carousel-arrow{position:absolute;top:50%;transform:translateY(-50%);z-index:1}.carousel-container .carousel-arrow.start-arrow{left:0}.carousel-container .carousel-arrow.end-arrow{right:0}.carousel-container ::ng-deep.carousel-content .card-view{padding:.5rem 0!important;padding:var(--pep-spacing-sm,.5rem) 0!important}.carousel-container ::ng-deep.carousel-content .card-view:first-child{-webkit-padding-start:.5rem!important;padding-inline-start:.5rem!important;-webkit-padding-start:var(--pep-spacing-sm,.5rem)!important;padding-inline-start:var(--pep-spacing-sm,.5rem)!important}.carousel-container ::ng-deep.carousel-content .card-view:last-child{-webkit-padding-end:.5rem!important;padding-inline-end:.5rem!important;-webkit-padding-end:var(--pep-spacing-sm,.5rem)!important;padding-inline-end:var(--pep-spacing-sm,.5rem)!important}"]
3161
+ },] }
3162
+ ];
3163
+ PepInternalCaruselComponent.ctorParameters = function () { return [
3164
+ { type: forms.FormBuilder },
3165
+ { type: ngxLib.PepLayoutService },
3166
+ { type: PepInternalCaruselService }
3167
+ ]; };
3168
+ PepInternalCaruselComponent.propDecorators = {
3169
+ carousel: [{ type: core.ViewChild, args: ['carousel', { read: carousel.PepCarouselComponent },] }],
3170
+ field: [{ type: core.Input }],
3171
+ layoutType: [{ type: core.Input }],
3172
+ formValueChange: [{ type: core.Output }],
3173
+ formFieldClick: [{ type: core.Output }]
3174
+ };
3080
3175
  var TempRelatedItems = {
3081
3176
  "Rows": [
3082
3177
  {
@@ -6206,194 +6301,6 @@
6206
6301
  }
6207
6302
  };
6208
6303
 
6209
- // type PepListCarouselSizeType = 'xs' | 'sm' | 'md';
6210
- var PepInternalCaruselComponent = /** @class */ (function () {
6211
- function PepInternalCaruselComponent(fb, layoutService, internalCaruselService, customizationService, elementRef, changeDetectorRef) {
6212
- this.fb = fb;
6213
- this.layoutService = layoutService;
6214
- this.internalCaruselService = internalCaruselService;
6215
- this.customizationService = customizationService;
6216
- this.elementRef = elementRef;
6217
- this.changeDetectorRef = changeDetectorRef;
6218
- this.controlType = 'internalCarusel';
6219
- this.layoutType = 'form';
6220
- this.formValueChange = new core.EventEmitter();
6221
- this.formFieldClick = new core.EventEmitter();
6222
- this._items = null;
6223
- this.duration = 1000;
6224
- this.layout = null;
6225
- this.itemsToMove = 3;
6226
- this.lockItemInnerEvents = true;
6227
- this.hideArrowsInSmallScreen = true;
6228
- this.prevDisabled = false;
6229
- this.nextDisabled = false;
6230
- this.PepScreenSizeType = ngxLib.PepScreenSizeType;
6231
- this.defaultRowSpan = -1;
6232
- }
6233
- Object.defineProperty(PepInternalCaruselComponent.prototype, "items", {
6234
- get: function () {
6235
- return this._items;
6236
- },
6237
- set: function (value) {
6238
- this._items = value;
6239
- this.moveTo(0);
6240
- },
6241
- enumerable: false,
6242
- configurable: true
6243
- });
6244
- PepInternalCaruselComponent.prototype.fillData = function () {
6245
- var _this = this;
6246
- setTimeout(function () {
6247
- // const childrenCount = this.items
6248
- // ? this.items.length
6249
- // : 0;
6250
- // convert rem to pixel
6251
- var formRowHeight = _this.customizationService.calculateFormFieldHeight() * 16;
6252
- // Set the default only if not set yet.
6253
- if (_this.defaultRowSpan === -1) {
6254
- _this.defaultRowSpan = _this.field.rowSpan;
6255
- }
6256
- var maxRow = Math.max.apply(Math, __spreadArray([], __read(_this.layout.ControlFields.map(function (f) {
6257
- return f.Layout.Y + f.Layout.Height;
6258
- }))));
6259
- // * 16 convert rem to pixel
6260
- var cardRowsHeight = _this.customizationService.calculateCardRowsHeight(maxRow) * 16;
6261
- // + 16 is the 1rem margin outside card.
6262
- var rowSpanToAdd = (cardRowsHeight + 16);
6263
- _this.field.rowSpan = rowSpanToAdd;
6264
- }, 0);
6265
- this.changeDetectorRef.markForCheck();
6266
- };
6267
- PepInternalCaruselComponent.prototype.ngOnInit = function () {
6268
- // this.internalCaruselService.initCarusel(
6269
- // this.field.objectId,
6270
- // this.field.searchCode,
6271
- // (caruselItems: any) => {
6272
- this.layout = TempRelatedItems.UIControl;
6273
- this.items = TempRelatedItems.Rows;
6274
- this.fillData();
6275
- // }
6276
- // );
6277
- };
6278
- PepInternalCaruselComponent.prototype.ngAfterViewInit = function () {
6279
- var _this = this;
6280
- this.layoutService.onResize$.subscribe(function (size) {
6281
- _this.screenSize = size;
6282
- });
6283
- };
6284
- PepInternalCaruselComponent.prototype.ngOnDestroy = function () {
6285
- //
6286
- };
6287
- // updateChanges(elementToUpdate: any): void {
6288
- // // Update memory data
6289
- // for (let index = 0; index < this.caruselData.Rows.length; index++) {
6290
- // if (this.caruselData.Rows[index].UID === elementToUpdate.UID) {
6291
- // this.caruselData.Rows[index] = elementToUpdate;
6292
- // }
6293
- // }
6294
- // }
6295
- // setValueCallback(id: any, res: any): void {
6296
- // if (res.Rows.length === 1) {
6297
- // const field = res.Rows[0].Fields.find((f) => f.ApiName === 'ObjectMenu');
6298
- // if (field) {
6299
- // // HACK : Until "Enabled" returns from the server, we set PepMenu to be
6300
- // // Disabled in cart on regular items and not campign items.
6301
- // field.Enabled = true;
6302
- // }
6303
- // this.updateChanges(res.Rows[0]);
6304
- // }
6305
- // this.valueChange.emit(res);
6306
- // this.changeDetectorRef.markForCheck();
6307
- // }
6308
- PepInternalCaruselComponent.prototype.onCustomizeObjectChanged = function (customizeObjectChangedData) {
6309
- // this.internalCaruselService.childValueChanged(
6310
- // customizeObjectChangedData.id,
6311
- // customizeObjectChangedData.key,
6312
- // customizeObjectChangedData.value,
6313
- // (res: any) => {
6314
- // this.setValueCallback(customizeObjectChangedData.id, res);
6315
- // }
6316
- // );
6317
- this.formValueChange.emit(customizeObjectChangedData);
6318
- };
6319
- PepInternalCaruselComponent.prototype.onCustomizeFieldClick = function (fieldClickEvent) {
6320
- var handledEvent = false;
6321
- // // For the new custom form, the plus and minus events transform in the IPepFormFieldValueChangeEvent
6322
- // if (fieldClickEvent.controlType === 'qs') {
6323
- // if (fieldClickEvent.value === PepQuantitySelectorComponent.PLUS) {
6324
- // handledEvent = true;
6325
- // this.internalCaruselService.childPlusClick(
6326
- // fieldClickEvent.id,
6327
- // fieldClickEvent.key,
6328
- // (res: any) => {
6329
- // this.setValueCallback(fieldClickEvent.id, res);
6330
- // }
6331
- // );
6332
- // } else if (
6333
- // fieldClickEvent.value === PepQuantitySelectorComponent.MINUS
6334
- // ) {
6335
- // handledEvent = true;
6336
- // this.internalCaruselService.childMinusClick(
6337
- // fieldClickEvent.id,
6338
- // fieldClickEvent.key,
6339
- // (res: any) => {
6340
- // this.setValueCallback(fieldClickEvent.id, res);
6341
- // }
6342
- // );
6343
- // }
6344
- // }
6345
- if (!handledEvent) {
6346
- this.formFieldClick.emit(fieldClickEvent);
6347
- }
6348
- };
6349
- PepInternalCaruselComponent.prototype.moveLeft = function () {
6350
- // this.carousel.moveLeft();
6351
- var indexToMove = Math.max(this.carousel.currIndex - this.itemsToMove, 0);
6352
- this.moveTo(indexToMove);
6353
- };
6354
- PepInternalCaruselComponent.prototype.moveRight = function () {
6355
- // this.carousel.moveRight();
6356
- var indexToMove = Math.min(this.carousel.currIndex + this.itemsToMove, this.items.length);
6357
- this.moveTo(indexToMove);
6358
- };
6359
- PepInternalCaruselComponent.prototype.moveTo = function (index) {
6360
- if (this.carousel) {
6361
- this.carousel.moveTo(index);
6362
- }
6363
- };
6364
- PepInternalCaruselComponent.prototype.onReachesLeftBound = function (event) {
6365
- this.prevDisabled = event;
6366
- };
6367
- PepInternalCaruselComponent.prototype.onReachesRightBound = function (event) {
6368
- this.nextDisabled = event;
6369
- };
6370
- return PepInternalCaruselComponent;
6371
- }());
6372
- PepInternalCaruselComponent.decorators = [
6373
- { type: core.Component, args: [{
6374
- selector: 'pep-internal-carusel',
6375
- template: "<div class=\"carousel-container\">\n <ng-container *ngIf=\"items?.length > 0; then carouselBlock; else emptyBlock\"></ng-container>\n <ng-template #emptyBlock>\n <!-- No items -->\n </ng-template>\n <ng-template #carouselBlock>\n <pep-button *ngIf=\"!(hideArrowsInSmallScreen && screenSize > PepScreenSizeType.SM)\"\n [iconName]=\"'arrow_left_alt'\" [styleType]=\"'regular'\" [disabled]=\"prevDisabled\" (click)=\"moveLeft()\"\n class=\"carousel-arrow start-arrow\">\n </pep-button>\n <pep-carousel #carousel [xWheelEnabled]=\"false\" [snapDuration]=\"duration\"\n (reachesLeftBound)=\"onReachesLeftBound($event)\" (reachesRightBound)=\"onReachesRightBound($event)\">\n <ng-container *ngFor=\"let item of items\">\n <pep-form pepCarouselItem [layout]=\"layout\" [data]=\"item\" [layoutType]=\"'card'\" class=\"card-view \"\n (valueChange)=\"onCustomizeObjectChanged($event)\" (fieldClick)=\"onCustomizeFieldClick($event)\">\n </pep-form>\n </ng-container>\n </pep-carousel>\n <pep-button *ngIf=\"!(hideArrowsInSmallScreen && screenSize > PepScreenSizeType.SM)\"\n [iconName]=\"'arrow_right_alt'\" [styleType]=\"'regular'\" [disabled]=\"nextDisabled\" (click)=\"moveRight()\"\n class=\"carousel-arrow end-arrow\">\n </pep-button>\n </ng-template>\n</div>",
6376
- providers: [PepInternalCaruselService],
6377
- changeDetection: core.ChangeDetectionStrategy.OnPush,
6378
- styles: [".carousel-container{position:relative;margin:0 calc(.5rem * -1);margin:0 calc(var(--pep-spacing-sm, .5rem) * -1);display:grid}.carousel-container .carousel-arrow{position:absolute;top:50%;transform:translateY(-50%);z-index:1}.carousel-container .carousel-arrow.start-arrow{left:0}.carousel-container .carousel-arrow.end-arrow{right:0}.carousel-container ::ng-deep.carousel-content .card-view{padding:.5rem 0!important;padding:var(--pep-spacing-sm,.5rem) 0!important}.carousel-container ::ng-deep.carousel-content .card-view:first-child{-webkit-padding-start:.5rem!important;padding-inline-start:.5rem!important;-webkit-padding-start:var(--pep-spacing-sm,.5rem)!important;padding-inline-start:var(--pep-spacing-sm,.5rem)!important}.carousel-container ::ng-deep.carousel-content .card-view:last-child{-webkit-padding-end:.5rem!important;padding-inline-end:.5rem!important;-webkit-padding-end:var(--pep-spacing-sm,.5rem)!important;padding-inline-end:var(--pep-spacing-sm,.5rem)!important}"]
6379
- },] }
6380
- ];
6381
- PepInternalCaruselComponent.ctorParameters = function () { return [
6382
- { type: forms.FormBuilder },
6383
- { type: ngxLib.PepLayoutService },
6384
- { type: PepInternalCaruselService },
6385
- { type: ngxLib.PepCustomizationService },
6386
- { type: core.ElementRef },
6387
- { type: core.ChangeDetectorRef }
6388
- ]; };
6389
- PepInternalCaruselComponent.propDecorators = {
6390
- field: [{ type: core.Input }],
6391
- layoutType: [{ type: core.Input }],
6392
- formValueChange: [{ type: core.Output }],
6393
- formFieldClick: [{ type: core.Output }],
6394
- carousel: [{ type: core.ViewChild, args: ['carousel', { read: carousel.PepCarouselComponent },] }]
6395
- };
6396
-
6397
6304
  var pepComponentsModules = [
6398
6305
  address.PepAddressModule,
6399
6306
  attachment.PepAttachmentModule,