@annalib/anna-core 4.2.21 → 4.2.23

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.
@@ -1257,6 +1257,13 @@ class AnnaFilterService {
1257
1257
  "udDeficitValue",
1258
1258
  "bookedValue",
1259
1259
  "bookedSpots",
1260
+ "userChanges",
1261
+ "UDGrp",
1262
+ "UDImps",
1263
+ "underDeliveryPercent",
1264
+ "ODGrp",
1265
+ "ODImps",
1266
+ "overDeliveryPercent",
1260
1267
  "userADUs",
1261
1268
  "buyerChanges",
1262
1269
  "userChanges",
@@ -1893,9 +1900,15 @@ class AnnaNonEditableGenericTableComponent {
1893
1900
  this.tooltipRadioTextMap.set("bookedCpmValue", "Booked CPM");
1894
1901
  this.tooltipRadioTextMap.set("bookedEffectiveCpmValue", "Effective CPM");
1895
1902
  this.tooltipRadioTextMap.set("orderSource", "Order Source");
1896
- this.tooltipRadioTextMap.set("orderCategory", "Rev Category");
1903
+ this.tooltipRadioTextMap.set("orderCategory", "Category");
1897
1904
  this.tooltipRadioTextMap.set("cashOrTrade", "C/T");
1898
1905
  this.tooltipRadioTextMap.set("revisionStartDate", "Revision Start Date");
1906
+ this.tooltipRadioTextMap.set("ODImps", "OD Imps");
1907
+ this.tooltipRadioTextMap.set("UDImps", "UD Imps");
1908
+ this.tooltipRadioTextMap.set("ODGrp", "OD Grp");
1909
+ this.tooltipRadioTextMap.set("UdGrp", "UD Grp");
1910
+ this.tooltipRadioTextMap.set("overDeliveryPercent", "OD Percent");
1911
+ this.tooltipRadioTextMap.set("underDeliveryPercent", "OD Percent");
1899
1912
  }
1900
1913
  generateTableDataWrapper() {
1901
1914
  this.showSkeletonLoading = true;
@@ -4154,286 +4167,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImpor
4154
4167
  }]
4155
4168
  }] });
4156
4169
 
4157
- class DigitOnlyDirective {
4158
- constructor(el) {
4159
- this.el = el;
4160
- this.hasDecimalPoint = false;
4161
- this.hasNegativeSign = false;
4162
- this.navigationKeys = [
4163
- 'Backspace',
4164
- 'Delete',
4165
- 'Tab',
4166
- 'Escape',
4167
- 'Enter',
4168
- 'Home',
4169
- 'End',
4170
- 'ArrowLeft',
4171
- 'ArrowRight',
4172
- 'Clear',
4173
- 'Copy',
4174
- 'Paste',
4175
- ];
4176
- this.decimal = false;
4177
- this.decimalSeparator = '.';
4178
- this.allowNegatives = false;
4179
- this.allowPaste = true;
4180
- this.negativeSign = '-';
4181
- this.min = -Infinity;
4182
- this.max = Infinity;
4183
- this.regex = null;
4184
- this.inputElement = el.nativeElement;
4185
- }
4186
- ngOnChanges(changes) {
4187
- if (changes['pattern']) {
4188
- this.regex = this.pattern ? RegExp(this.pattern) : null;
4189
- }
4190
- if (changes['min']) {
4191
- const maybeMin = Number(this.min);
4192
- this.min = isNaN(maybeMin) ? -Infinity : maybeMin;
4193
- }
4194
- if (changes['max']) {
4195
- const maybeMax = Number(this.max);
4196
- this.max = isNaN(maybeMax) ? Infinity : maybeMax;
4197
- }
4198
- }
4199
- onBeforeInput(e) {
4200
- if (isNaN(Number(e.data))) {
4201
- if (e.data === this.decimalSeparator ||
4202
- (e.data === this.negativeSign && this.allowNegatives)) {
4203
- return; // go on
4204
- }
4205
- e.preventDefault();
4206
- e.stopPropagation();
4207
- }
4208
- }
4209
- onKeyDown(e) {
4210
- console.log("called");
4211
- if (this.navigationKeys.indexOf(e.key) > -1 || // Allow: navigation keys: backspace, delete, arrows etc.
4212
- ((e.key === 'a' || e.code === 'KeyA') && e.ctrlKey === true) || // Allow: Ctrl+A
4213
- ((e.key === 'c' || e.code === 'KeyC') && e.ctrlKey === true) || // Allow: Ctrl+C
4214
- ((e.key === 'v' || e.code === 'KeyV') && e.ctrlKey === true) || // Allow: Ctrl+V
4215
- ((e.key === 'x' || e.code === 'KeyX') && e.ctrlKey === true) || // Allow: Ctrl+X
4216
- ((e.key === 'a' || e.code === 'KeyA') && e.metaKey === true) || // Allow: Cmd+A (Mac)
4217
- ((e.key === 'c' || e.code === 'KeyC') && e.metaKey === true) || // Allow: Cmd+C (Mac)
4218
- ((e.key === 'v' || e.code === 'KeyV') && e.metaKey === true) || // Allow: Cmd+V (Mac)
4219
- ((e.key === 'x' || e.code === 'KeyX') && e.metaKey === true) // Allow: Cmd+X (Mac)
4220
- ) {
4221
- // let it happen, don't do anything
4222
- return;
4223
- }
4224
- let newValue = '';
4225
- if (this.decimal && e.key === this.decimalSeparator) {
4226
- newValue = this.forecastValue(e.key);
4227
- if (newValue.split(this.decimalSeparator).length > 2) {
4228
- // has two or more decimal points
4229
- e.preventDefault();
4230
- return;
4231
- }
4232
- else {
4233
- this.hasDecimalPoint = newValue.indexOf(this.decimalSeparator) > -1;
4234
- return; // Allow: only one decimal point
4235
- }
4236
- }
4237
- if (e.key === this.negativeSign && this.allowNegatives) {
4238
- newValue = this.forecastValue(e.key);
4239
- if (newValue.charAt(0) !== this.negativeSign ||
4240
- newValue.split(this.negativeSign).length > 2) {
4241
- e.preventDefault();
4242
- return;
4243
- }
4244
- else {
4245
- this.hasNegativeSign = newValue.split(this.negativeSign).length > -1;
4246
- return;
4247
- }
4248
- }
4249
- // Ensure that it is a number and stop the keypress
4250
- if (e.key === ' ' || isNaN(Number(e.key))) {
4251
- e.preventDefault();
4252
- return;
4253
- }
4254
- newValue = newValue || this.forecastValue(e.key);
4255
- // check the input pattern RegExp
4256
- if (this.regex) {
4257
- if (!this.regex.test(newValue)) {
4258
- e.preventDefault();
4259
- return;
4260
- }
4261
- }
4262
- const newNumber = Number(newValue);
4263
- if (newNumber > this.max || newNumber < this.min) {
4264
- e.preventDefault();
4265
- }
4266
- }
4267
- onPaste(event) {
4268
- if (this.allowPaste === true) {
4269
- let pastedInput = '';
4270
- if (window['clipboardData']) {
4271
- // Browser is IE
4272
- pastedInput = window['clipboardData'].getData('text');
4273
- }
4274
- else if (event.clipboardData && event.clipboardData.getData) {
4275
- // Other browsers
4276
- pastedInput = event.clipboardData.getData('text/plain');
4277
- }
4278
- this.pasteData(pastedInput);
4279
- event.preventDefault();
4280
- }
4281
- else {
4282
- // this prevents the paste
4283
- event.preventDefault();
4284
- event.stopPropagation();
4285
- }
4286
- }
4287
- onDrop(event) {
4288
- const textData = event.dataTransfer?.getData('text') ?? '';
4289
- this.inputElement.focus();
4290
- this.pasteData(textData);
4291
- event.preventDefault();
4292
- }
4293
- pasteData(pastedContent) {
4294
- const sanitizedContent = this.sanitizeInput(pastedContent);
4295
- if (sanitizedContent.includes(this.negativeSign) &&
4296
- this.hasNegativeSign &&
4297
- !this.getSelection().includes(this.negativeSign)) {
4298
- return;
4299
- }
4300
- const pasted = document.execCommand('insertText', false, sanitizedContent);
4301
- if (!pasted) {
4302
- if (this.inputElement.setRangeText) {
4303
- const { selectionStart: start, selectionEnd: end } = this.inputElement;
4304
- this.inputElement.setRangeText(sanitizedContent, start ?? 0, end ?? 0, 'end');
4305
- // Angular's Reactive Form relies on "input" event, but on Firefox, the setRangeText method doesn't trigger it
4306
- // so we have to trigger it ourself.
4307
- if (typeof window['InstallTrigger'] !==
4308
- 'undefined') {
4309
- this.inputElement.dispatchEvent(new Event('input', { cancelable: true }));
4310
- }
4311
- }
4312
- else {
4313
- // Browser does not support setRangeText, e.g. IE
4314
- this.insertAtCursor(this.inputElement, sanitizedContent);
4315
- }
4316
- }
4317
- if (this.decimal) {
4318
- this.hasDecimalPoint =
4319
- this.inputElement.value.indexOf(this.decimalSeparator) > -1;
4320
- }
4321
- this.hasNegativeSign =
4322
- this.inputElement.value.indexOf(this.negativeSign) > -1;
4323
- }
4324
- // The following 2 methods were added from the below article for browsers that do not support setRangeText
4325
- // https://stackoverflow.com/questions/11076975/how-to-insert-text-into-the-textarea-at-the-current-cursor-position
4326
- insertAtCursor(myField, myValue) {
4327
- const startPos = myField.selectionStart ?? 0;
4328
- const endPos = myField.selectionEnd ?? 0;
4329
- myField.value =
4330
- myField.value.substring(0, startPos) +
4331
- myValue +
4332
- myField.value.substring(endPos, myField.value.length);
4333
- const pos = startPos + myValue.length;
4334
- myField.focus();
4335
- myField.setSelectionRange(pos, pos);
4336
- this.triggerEvent(myField, 'input');
4337
- }
4338
- triggerEvent(el, type) {
4339
- if ('createEvent' in document) {
4340
- // modern browsers, IE9+
4341
- const e = document.createEvent('HTMLEvents');
4342
- e.initEvent(type, false, true);
4343
- el.dispatchEvent(e);
4344
- }
4345
- }
4346
- // end stack overflow code
4347
- sanitizeInput(input) {
4348
- let result = '';
4349
- let regex;
4350
- if (this.decimal && this.isValidDecimal(input)) {
4351
- regex = new RegExp(`${this.getNegativeSignRegExp()}[^0-9${this.decimalSeparator}]`, 'g');
4352
- }
4353
- else {
4354
- regex = new RegExp(`${this.getNegativeSignRegExp()}[^0-9]`, 'g');
4355
- }
4356
- result = input.replace(regex, '');
4357
- const maxLength = this.inputElement.maxLength;
4358
- if (maxLength > 0) {
4359
- // the input element has maxLength limit
4360
- const allowedLength = maxLength -
4361
- this.inputElement.value.length +
4362
- (result.includes(`${this.negativeSign}`) ? 1 : 0);
4363
- result = allowedLength > 0 ? result.substring(0, allowedLength) : '';
4364
- }
4365
- return result;
4366
- }
4367
- getNegativeSignRegExp() {
4368
- return this.allowNegatives &&
4369
- (!this.hasNegativeSign || this.getSelection().includes(this.negativeSign))
4370
- ? `(?!^${this.negativeSign})`
4371
- : '';
4372
- }
4373
- isValidDecimal(string) {
4374
- if (!this.hasDecimalPoint) {
4375
- return string.split(this.decimalSeparator).length <= 2;
4376
- }
4377
- else {
4378
- // the input element already has a decimal separator
4379
- const selectedText = this.getSelection();
4380
- if (selectedText && selectedText.indexOf(this.decimalSeparator) > -1) {
4381
- return string.split(this.decimalSeparator).length <= 2;
4382
- }
4383
- else {
4384
- return string.indexOf(this.decimalSeparator) < 0;
4385
- }
4386
- }
4387
- }
4388
- getSelection() {
4389
- return this.inputElement.value.substring(this.inputElement.selectionStart ?? 0, this.inputElement.selectionEnd ?? 0);
4390
- }
4391
- forecastValue(key) {
4392
- const selectionStart = this.inputElement.selectionStart ?? 0;
4393
- const selectionEnd = this.inputElement.selectionEnd ?? 0;
4394
- const oldValue = this.inputElement.value;
4395
- return (oldValue.substring(0, selectionStart) +
4396
- key +
4397
- oldValue.substring(selectionEnd));
4398
- }
4399
- }
4400
- DigitOnlyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: DigitOnlyDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
4401
- DigitOnlyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.7", type: DigitOnlyDirective, selector: "[digitOnly]", inputs: { decimal: "decimal", decimalSeparator: "decimalSeparator", allowNegatives: "allowNegatives", allowPaste: "allowPaste", negativeSign: "negativeSign", min: "min", max: "max", pattern: "pattern" }, host: { listeners: { "beforeinput": "onBeforeInput($event)", "keydown": "onKeyDown($event)", "paste": "onPaste($event)", "drop": "onDrop($event)" } }, usesOnChanges: true, ngImport: i0 });
4402
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: DigitOnlyDirective, decorators: [{
4403
- type: Directive,
4404
- args: [{
4405
- selector: '[digitOnly]',
4406
- }]
4407
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { decimal: [{
4408
- type: Input
4409
- }], decimalSeparator: [{
4410
- type: Input
4411
- }], allowNegatives: [{
4412
- type: Input
4413
- }], allowPaste: [{
4414
- type: Input
4415
- }], negativeSign: [{
4416
- type: Input
4417
- }], min: [{
4418
- type: Input
4419
- }], max: [{
4420
- type: Input
4421
- }], pattern: [{
4422
- type: Input
4423
- }], onBeforeInput: [{
4424
- type: HostListener,
4425
- args: ['beforeinput', ['$event']]
4426
- }], onKeyDown: [{
4427
- type: HostListener,
4428
- args: ['keydown', ['$event']]
4429
- }], onPaste: [{
4430
- type: HostListener,
4431
- args: ['paste', ['$event']]
4432
- }], onDrop: [{
4433
- type: HostListener,
4434
- args: ['drop', ['$event']]
4435
- }] } });
4436
-
4437
4170
  // Angular import statements
4438
4171
  class AnnaCoreModule {
4439
4172
  }
@@ -4457,8 +4190,7 @@ AnnaCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
4457
4190
  AnnaVirtualTableDirective,
4458
4191
  AnnaNonEditableGenericTableComponent,
4459
4192
  AnnaTableVirtualScrollViewportComponent,
4460
- AnnaFixedRowSizeTableVirtualScrollStrategyDirective,
4461
- DigitOnlyDirective], imports: [CommonModule,
4193
+ AnnaFixedRowSizeTableVirtualScrollStrategyDirective], imports: [CommonModule,
4462
4194
  NgbModule,
4463
4195
  FormsModule,
4464
4196
  MatRadioModule,
@@ -4485,8 +4217,7 @@ AnnaCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version:
4485
4217
  AnnaVirtualTableDirective,
4486
4218
  AnnaNonEditableGenericTableComponent,
4487
4219
  AnnaTableVirtualScrollViewportComponent,
4488
- AnnaFixedRowSizeTableVirtualScrollStrategyDirective,
4489
- DigitOnlyDirective] });
4220
+ AnnaFixedRowSizeTableVirtualScrollStrategyDirective] });
4490
4221
  AnnaCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: AnnaCoreModule, imports: [[
4491
4222
  CommonModule,
4492
4223
  NgbModule,
@@ -4530,7 +4261,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImpor
4530
4261
  AnnaNonEditableGenericTableComponent,
4531
4262
  AnnaTableVirtualScrollViewportComponent,
4532
4263
  AnnaFixedRowSizeTableVirtualScrollStrategyDirective,
4533
- DigitOnlyDirective
4534
4264
  ],
4535
4265
  imports: [
4536
4266
  CommonModule,
@@ -4571,12 +4301,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImpor
4571
4301
  AnnaVirtualTableDirective,
4572
4302
  AnnaNonEditableGenericTableComponent,
4573
4303
  AnnaTableVirtualScrollViewportComponent,
4574
- AnnaFixedRowSizeTableVirtualScrollStrategyDirective,
4575
- DigitOnlyDirective
4304
+ AnnaFixedRowSizeTableVirtualScrollStrategyDirective
4576
4305
  ]
4577
4306
  }]
4578
4307
  }] });
4579
4308
 
4309
+ class AnnaNumberFormatService {
4310
+ static GetRoundedValueWithUnits(inputValue, digitsToRoundDecimalPoint = 2) {
4311
+ let [value, unit] = AnnaNumberFormatService.GetValueInUnits(Math.abs(inputValue));
4312
+ value = +((+value).toFixed(digitsToRoundDecimalPoint));
4313
+ if (inputValue < 0) {
4314
+ value = value * -1;
4315
+ }
4316
+ return value.toString() + unit;
4317
+ // return (Math.Round(value, digitsToRoundDecimalPoint, MidpointRounding.AwayFromZero) + unit);
4318
+ }
4319
+ static GetValueInUnits(inputValue) {
4320
+ let unit = "";
4321
+ let thousand = 1000;
4322
+ let million = 1000000;
4323
+ let billion = 1000000000;
4324
+ if (inputValue >= thousand && inputValue < million) {
4325
+ inputValue = inputValue / thousand;
4326
+ unit = "K";
4327
+ }
4328
+ else if (inputValue >= million && inputValue < billion) {
4329
+ inputValue = inputValue / million;
4330
+ unit = "M";
4331
+ }
4332
+ else if (inputValue >= billion) {
4333
+ inputValue = inputValue / billion;
4334
+ unit = "B";
4335
+ }
4336
+ return [inputValue, unit];
4337
+ }
4338
+ }
4339
+ AnnaNumberFormatService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: AnnaNumberFormatService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4340
+ AnnaNumberFormatService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: AnnaNumberFormatService, providedIn: "root" });
4341
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: AnnaNumberFormatService, decorators: [{
4342
+ type: Injectable,
4343
+ args: [{
4344
+ providedIn: "root",
4345
+ }]
4346
+ }] });
4347
+
4580
4348
  ;
4581
4349
 
4582
4350
  class Constants {
@@ -4621,5 +4389,5 @@ var Days;
4621
4389
  * Generated bundle index. Do not edit.
4622
4390
  */
4623
4391
 
4624
- export { AllSelectedStatus, AnnaBuyerApprovalIconTemplateComponent, AnnaCalendarFilterComponent, AnnaConvertZeroOrNullOrUndefinedPipe, AnnaCoreModule, AnnaDateTimeFormatService, AnnaFilterSearchedTextPipe, AnnaFilterService, AnnaFixedRowSizeTableVirtualScrollStrategy, AnnaFixedRowSizeTableVirtualScrollStrategyDirective, AnnaGenericTableService, AnnaGlobalConfigService, AnnaIconColumnComponent, AnnaLiveIconTemplateComponent, AnnaNoDataComponent, AnnaNonEditableGenericTableComponent, AnnaNotifyIconTemplateComponent, AnnaPayForPerformanceIconTemplateComponent, AnnaRejectedIconTemplateComponent, AnnaReplaceCharPipe, AnnaSortComponent, AnnaSortService, AnnaTableVirtualScrollViewportComponent, AnnaTypeofDataPipe, AnnaVirtualTableDirective, AnnaWeekCalendarComponent, Constants, Days, DigitOnlyDirective, ErrorCodes, TooltipModel, fixedSizeVirtualScrollStrategyFactory, radioButtonModel, showEllipsisTextOnHoverDirective, tooltipModelForColumnLevelFiltering };
4392
+ export { AllSelectedStatus, AnnaBuyerApprovalIconTemplateComponent, AnnaCalendarFilterComponent, AnnaConvertZeroOrNullOrUndefinedPipe, AnnaCoreModule, AnnaDateTimeFormatService, AnnaFilterSearchedTextPipe, AnnaFilterService, AnnaFixedRowSizeTableVirtualScrollStrategy, AnnaFixedRowSizeTableVirtualScrollStrategyDirective, AnnaGenericTableService, AnnaGlobalConfigService, AnnaIconColumnComponent, AnnaLiveIconTemplateComponent, AnnaNoDataComponent, AnnaNonEditableGenericTableComponent, AnnaNotifyIconTemplateComponent, AnnaNumberFormatService, AnnaPayForPerformanceIconTemplateComponent, AnnaRejectedIconTemplateComponent, AnnaReplaceCharPipe, AnnaSortComponent, AnnaSortService, AnnaTableVirtualScrollViewportComponent, AnnaTypeofDataPipe, AnnaVirtualTableDirective, AnnaWeekCalendarComponent, Constants, Days, ErrorCodes, TooltipModel, fixedSizeVirtualScrollStrategyFactory, radioButtonModel, showEllipsisTextOnHoverDirective, tooltipModelForColumnLevelFiltering };
4625
4393
  //# sourceMappingURL=annalib-anna-core.mjs.map