ng-configcat-publicapi-ui 5.3.9 → 5.3.10
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OVERLAY_DEFAULT_CONFIG, Overlay } from '@angular/cdk/overlay';
|
|
2
|
+
import { DatePipe, NgClass, NgTemplateOutlet, SlicePipe, KeyValuePipe } from '@angular/common';
|
|
2
3
|
import * as i0 from '@angular/core';
|
|
3
4
|
import { inject, Injectable, Component, viewChild, DestroyRef, DOCUMENT, InjectionToken, HostListener, Directive, input, ElementRef, model, effect, output, forwardRef, ChangeDetectionStrategy, signal, linkedSignal, computed, ChangeDetectorRef, ViewEncapsulation } from '@angular/core';
|
|
4
5
|
import { MAT_AUTOCOMPLETE_SCROLL_STRATEGY, MatAutocompleteTrigger, MatAutocomplete } from '@angular/material/autocomplete';
|
|
@@ -17,7 +18,6 @@ import { FormArray, Validators, FormGroup, FormControl, FormBuilder, NonNullable
|
|
|
17
18
|
import { NativeDateAdapter, MatOption, MatRipple, DateAdapter, MatOptgroup } from '@angular/material/core';
|
|
18
19
|
import { CdkScrollable } from '@angular/cdk/scrolling';
|
|
19
20
|
import { MatButton, MatIconButton } from '@angular/material/button';
|
|
20
|
-
import { NgClass, NgTemplateOutlet, SlicePipe, KeyValuePipe } from '@angular/common';
|
|
21
21
|
import { MatIcon } from '@angular/material/icon';
|
|
22
22
|
import Papa from 'papaparse';
|
|
23
23
|
import { MatSnackBarRef, MAT_SNACK_BAR_DATA, MatSnackBarAction, MatSnackBarActions, MatSnackBarLabel, MatSnackBar } from '@angular/material/snack-bar';
|
|
@@ -394,72 +394,20 @@ var UserComparatorType;
|
|
|
394
394
|
UserComparatorType[UserComparatorType["DateTime"] = 5] = "DateTime";
|
|
395
395
|
})(UserComparatorType || (UserComparatorType = {}));
|
|
396
396
|
|
|
397
|
-
class DateHelper {
|
|
398
|
-
static addDays(date, value) {
|
|
399
|
-
// https://stackoverflow.com/a/3674550/8656352
|
|
400
|
-
date.setDate(date.getDate() + value);
|
|
401
|
-
}
|
|
402
|
-
static { this.daysBetweenDates = function (from, to) {
|
|
403
|
-
if (!from || !to) {
|
|
404
|
-
return 0;
|
|
405
|
-
}
|
|
406
|
-
return (new Date(to).getTime() - new Date(from).getTime()) / (1000 * 60 * 60 * 24);
|
|
407
|
-
}; }
|
|
408
|
-
static formatDate(date, formatString) {
|
|
409
|
-
if (!date) {
|
|
410
|
-
return "";
|
|
411
|
-
}
|
|
412
|
-
const dateObj = new Date(date);
|
|
413
|
-
return Object.entries({
|
|
414
|
-
YYYY: dateObj.getFullYear(),
|
|
415
|
-
YY: dateObj.getFullYear().toString().substring(2),
|
|
416
|
-
yyyy: dateObj.getFullYear(),
|
|
417
|
-
yy: dateObj.getFullYear().toString().substring(2),
|
|
418
|
-
MMMM: dateObj.toLocaleString("default", { month: "long" }),
|
|
419
|
-
MMM: dateObj.toLocaleString("default", { month: "short" }),
|
|
420
|
-
MM: (dateObj.getMonth() + 1).toString().padStart(2, "0"),
|
|
421
|
-
M: dateObj.getMonth() + 1,
|
|
422
|
-
DDDD: dateObj.toLocaleDateString("default", { weekday: "long" }),
|
|
423
|
-
DDD: dateObj.toLocaleDateString("default", { weekday: "short" }),
|
|
424
|
-
DD: dateObj.getDate().toString().padStart(2, "0"),
|
|
425
|
-
D: dateObj.getDate(),
|
|
426
|
-
dddd: dateObj.toLocaleDateString("default", { weekday: "long" }),
|
|
427
|
-
ddd: dateObj.toLocaleDateString("default", { weekday: "short" }),
|
|
428
|
-
dd: dateObj.getDate().toString().padStart(2, "0"),
|
|
429
|
-
d: dateObj.getDate(),
|
|
430
|
-
HH: dateObj.getHours().toString().padStart(2, "0"), // military
|
|
431
|
-
H: dateObj.getHours().toString(), // military
|
|
432
|
-
hh: (dateObj.getHours() % 12).toString().padStart(2, "0"),
|
|
433
|
-
h: (dateObj.getHours() % 12).toString(),
|
|
434
|
-
mm: dateObj.getMinutes().toString().padStart(2, "0"),
|
|
435
|
-
m: dateObj.getMinutes(),
|
|
436
|
-
SS: dateObj.getSeconds().toString().padStart(2, "0"),
|
|
437
|
-
S: dateObj.getSeconds(),
|
|
438
|
-
ss: dateObj.getSeconds().toString().padStart(2, "0"),
|
|
439
|
-
s: dateObj.getSeconds(),
|
|
440
|
-
TTT: dateObj.getMilliseconds().toString().padStart(3, "0"),
|
|
441
|
-
ttt: dateObj.getMilliseconds().toString().padStart(3, "0"),
|
|
442
|
-
AMPM: dateObj.getHours() < 13 ? "AM" : "PM",
|
|
443
|
-
ampm: dateObj.getHours() < 13 ? "am" : "pm",
|
|
444
|
-
}).reduce((acc, entry) => {
|
|
445
|
-
return acc.replace(entry[0], entry[1].toString());
|
|
446
|
-
}, formatString);
|
|
447
|
-
}
|
|
448
|
-
static offsetDate(date, offsetMins) {
|
|
449
|
-
return new Date(date.getTime() + offsetMins * 60000);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
|
|
453
397
|
class AppDateAdapter extends NativeDateAdapter {
|
|
398
|
+
constructor() {
|
|
399
|
+
super(...arguments);
|
|
400
|
+
this.datepipe = inject(DatePipe);
|
|
401
|
+
}
|
|
454
402
|
format(date, displayFormat) {
|
|
455
403
|
if (!displayFormat?.["hour"]) {
|
|
456
|
-
return
|
|
404
|
+
return this.datepipe.transform(date, "yyyy. MM. dd") ?? "";
|
|
457
405
|
}
|
|
458
406
|
else if (!displayFormat?.["year"]) {
|
|
459
|
-
return
|
|
407
|
+
return this.datepipe.transform(date, "HH:mm") ?? "";
|
|
460
408
|
}
|
|
461
409
|
else {
|
|
462
|
-
return
|
|
410
|
+
return this.datepipe.transform(date, "yyyy. MM. dd HH:mm") ?? "";
|
|
463
411
|
}
|
|
464
412
|
}
|
|
465
413
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: AppDateAdapter, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
@@ -1571,6 +1519,7 @@ function provideConfigCatPublicApiUi() {
|
|
|
1571
1519
|
provide: MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS,
|
|
1572
1520
|
useValue: { hideSingleSelectionIndicator: true, hideMultipleSelectionIndicator: true },
|
|
1573
1521
|
},
|
|
1522
|
+
{ provide: DatePipe },
|
|
1574
1523
|
AppDateAdapter,
|
|
1575
1524
|
FormGenerator,
|
|
1576
1525
|
ComparisonValueListHelper,
|
|
@@ -4181,6 +4130,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
4181
4130
|
], template: "<div class=\"targeting-rule-line\">\n <div class=\"explanation-wrapper\">\n <app-condition-chip [targetingRuleIndex]=\"targetingRuleIndex()\" [conditionIndex]=\"conditionIndex()\" />\n\n <div class=\"explanation\">\n <a\n href=\"https://configcat.com/docs/targeting/targeting-rule/segment-condition/\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"user-link\">\n user\n </a>\n </div>\n </div>\n\n <div class=\"targeting-rule-component pad-right\">\n <mat-form-field class=\"small-form-field select\" appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-select matTooltip=\"Comparator\" [formControl]=\"formGroup().controls.comparator\">\n @for (comparator of segmentComparators; track $index) {\n <mat-option [value]=\"comparator.value\">\n {{ comparator.label }}\n </mat-option>\n }\n </mat-select>\n @if (formGroup().controls.comparator.invalid) {\n <mat-error>\n {{ FormHelper.getErrorMessage(formGroup().controls.comparator) }}\n </mat-error>\n }\n </mat-form-field>\n </div>\n <div class=\"wrapper-group\">\n <div class=\"targeting-rule-component suffixed\">\n <mat-form-field\n class=\"small-form-field\"\n appearance=\"outline\"\n subscriptSizing=\"dynamic\"\n [class.select-suffixed]=\"canManageSegments()\">\n <mat-select\n matTooltip=\"Segment\"\n placeholder=\"Select segment ...\"\n [formControl]=\"formGroup().controls.segmentId\"\n (opened)=\"clearFilter()\"\n (closed)=\"clearFilter()\">\n <div class=\"menu-filter small-density-form-field\">\n <mat-form-field\n subscriptSizing=\"dynamic\"\n appearance=\"outline\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"$event.stopPropagation()\">\n <input matInput placeholder=\"Filter segments\" [(ngModel)]=\"filterText\" />\n <span matSuffix [hidden]=\"!filterText()\">\n <button\n type=\"button\"\n mat-icon-button\n class=\"clear-filter\"\n aria-label=\"Clear\"\n matTooltip=\"Clear search filters\"\n (click)=\"clearFilter()\">\n <mat-icon>close</mat-icon>\n </button>\n </span>\n </mat-form-field>\n </div>\n <mat-divider />\n\n @for (segment of filteredSegments(); track $index) {\n <mat-option\n [value]=\"segment.segmentId\"\n [matTooltip]=\"segment.description\"\n [ngClass]=\"{ hidden: segment.hidden }\">\n {{ segment.name }}\n </mat-option>\n } @empty {\n <mat-option disabled>No segments available.</mat-option>\n }\n @if (segments().length && !hasFilteredSegments()) {\n <mat-option disabled>No segments found.</mat-option>\n }\n </mat-select>\n @if (canManageSegments()) {\n <button\n matSuffix\n class=\"input-suffix-button\"\n type=\"button\"\n mat-icon-button\n matTooltip=\"Create and manage segments\"\n [matMenuTriggerFor]=\"segmentMenu\"\n [track]=\"['segment menu click', 'feature flags and settings']\"\n (click)=\"$event.stopPropagation()\">\n <mat-icon>more_vert</mat-icon>\n </button>\n }\n @if (formGroup().controls.segmentId.invalid) {\n <mat-error>\n {{ FormHelper.getErrorMessage(formGroup().controls.segmentId) }}\n </mat-error>\n }\n </mat-form-field>\n </div>\n </div>\n</div>\n\n<mat-menu #segmentMenu=\"matMenu\">\n <ng-template matMenuContent>\n <a\n mat-menu-item\n [track]=\"['create segment click', 'Feature flags & settings V2 page']\"\n (click)=\"createSegmentRequested.emit()\">\n <mat-icon>add</mat-icon>\n <span>Create new segment</span>\n </a>\n <a\n mat-menu-item\n [track]=\"['manage segment click', 'Feature flags & settings V2 page']\"\n (click)=\"manageSegmentsRequested.emit()\">\n <mat-icon class=\"icon-transform-rotate\">pie_chart</mat-icon>\n <span>Manage segments</span>\n </a>\n </ng-template>\n</mat-menu>\n", styles: [".targeting-rule-line{display:flex;flex-wrap:wrap;margin:2px 0}.targeting-rule-line .wrapper-group{display:flex;flex-wrap:wrap}.targeting-rule-line .wrapper-group.grow{flex-grow:1}.targeting-rule-component{margin:2px 0}.targeting-rule-component[hidden]{display:none}.targeting-rule-component{width:212px}.targeting-rule-component.small{width:102px}.targeting-rule-component.grow{flex-grow:1}.targeting-rule-component.pad-right{margin-right:8px}.targeting-rule-component mat-form-field{width:100%}.delete-button{display:flex;color:var(--flag-delete-btn);margin-top:4px;margin-left:4px}.delete-button button{display:flex;align-items:center;justify-content:center}.delete-button mat-icon{font-size:18px;height:18px;width:18px}.explanation-wrapper{display:flex;margin-top:2px;margin-bottom:3px}.explanation-wrapper .explanation{min-width:44px;margin-top:7px;margin-right:8px}@media(max-width:500px){.targeting-rule-component{max-width:calc(100% - 4px);width:160px}.targeting-rule-component.small{width:78px}.targeting-rule-component.pad-right{margin-right:4px}}\n", ".filter{display:flex;margin:0 8px 8px;justify-content:space-around}.filter mat-form-field{width:100%}.hidden{display:none}\n"] }]
|
|
4182
4131
|
}], propDecorators: { targetingRuleIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "targetingRuleIndex", required: true }] }], conditionIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "conditionIndex", required: true }] }], formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], segments: [{ type: i0.Input, args: [{ isSignal: true, alias: "segments", required: true }] }], canManageSegments: [{ type: i0.Input, args: [{ isSignal: true, alias: "canManageSegments", required: true }] }], createSegmentRequested: [{ type: i0.Output, args: ["createSegmentRequested"] }], manageSegmentsRequested: [{ type: i0.Output, args: ["manageSegmentsRequested"] }] } });
|
|
4183
4132
|
|
|
4133
|
+
class DateHelper {
|
|
4134
|
+
static addDays(date, value) {
|
|
4135
|
+
// https://stackoverflow.com/a/3674550/8656352
|
|
4136
|
+
date.setDate(date.getDate() + value);
|
|
4137
|
+
}
|
|
4138
|
+
static { this.daysBetweenDates = function (from, to) {
|
|
4139
|
+
if (!from || !to) {
|
|
4140
|
+
return 0;
|
|
4141
|
+
}
|
|
4142
|
+
return (new Date(to).getTime() - new Date(from).getTime()) / (1000 * 60 * 60 * 24);
|
|
4143
|
+
}; }
|
|
4144
|
+
static offsetDate(date, offsetMins) {
|
|
4145
|
+
return new Date(date.getTime() + offsetMins * 60000);
|
|
4146
|
+
}
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4184
4149
|
class DateTimePickerComponent {
|
|
4185
4150
|
constructor() {
|
|
4186
4151
|
this.FormHelper = FormHelper;
|