@porscheinformatik/clr-addons 19.14.0 → 19.14.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { InputDateDisplayFormat } from '../daterange.constants';
|
|
2
2
|
import { NullableDaterange } from '../interfaces/daterange.interface';
|
|
3
3
|
import { NullableTimerange } from '../interfaces/timerange.interface';
|
|
4
|
+
import { NullableTimeModel } from '../models/time.model';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
/**
|
|
6
7
|
* Daterange parsing service.
|
|
@@ -42,12 +43,19 @@ export declare class DaterangeParsingService {
|
|
|
42
43
|
* @returns Daterange object.
|
|
43
44
|
*/
|
|
44
45
|
parse(daterangeString: string, separator?: string): NullableDaterange;
|
|
46
|
+
parseWithTime(daterangeString: string, separator?: string): NullableTimerange;
|
|
45
47
|
/**
|
|
46
48
|
* Get `DayModel` from date string.
|
|
47
49
|
* @param dateString - Date string.
|
|
48
50
|
* @returns DayModel.
|
|
49
51
|
*/
|
|
50
52
|
private getDayModelFromDateString;
|
|
53
|
+
/**
|
|
54
|
+
* Get `TimeModel` from time string.
|
|
55
|
+
* @param timeString - Time string in HH:mm:ss or HH:mm format.
|
|
56
|
+
* @returns TimeModel.
|
|
57
|
+
*/
|
|
58
|
+
getTimeModelFromDateString(timeString: string): NullableTimeModel;
|
|
51
59
|
/**
|
|
52
60
|
* Get `DayModel` from date string parts.
|
|
53
61
|
* @param yearString - Year string.
|
package/fesm2022/clr-addons.mjs
CHANGED
|
@@ -13331,6 +13331,88 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
13331
13331
|
type: Injectable
|
|
13332
13332
|
}] });
|
|
13333
13333
|
|
|
13334
|
+
/**
|
|
13335
|
+
* Time model.
|
|
13336
|
+
* Takes care of keeping records of full time.
|
|
13337
|
+
*/
|
|
13338
|
+
class TimeModel {
|
|
13339
|
+
constructor(...args) {
|
|
13340
|
+
if (args[0] instanceof Date) {
|
|
13341
|
+
const date = args[0];
|
|
13342
|
+
this.hours = date.getHours();
|
|
13343
|
+
this.minutes = date.getMinutes();
|
|
13344
|
+
this.seconds = date.getSeconds();
|
|
13345
|
+
}
|
|
13346
|
+
else if (typeof args[0] === 'string') {
|
|
13347
|
+
const [hours, minutes, seconds] = args[0].split(':').map(n => parseInt(n));
|
|
13348
|
+
this.hours = hours;
|
|
13349
|
+
this.minutes = minutes;
|
|
13350
|
+
this.seconds = seconds;
|
|
13351
|
+
}
|
|
13352
|
+
else {
|
|
13353
|
+
this.hours = args[0];
|
|
13354
|
+
this.minutes = args[1];
|
|
13355
|
+
this.seconds = args[2];
|
|
13356
|
+
}
|
|
13357
|
+
}
|
|
13358
|
+
/**
|
|
13359
|
+
* Checks if the passed value is equal to current time model.
|
|
13360
|
+
* @param value - Time model.
|
|
13361
|
+
* @returns Whether value is equal to current time model.
|
|
13362
|
+
*/
|
|
13363
|
+
isEqual(value) {
|
|
13364
|
+
if (value) {
|
|
13365
|
+
return this.hours === value.hours && this.minutes === value.minutes && this.seconds === value.seconds;
|
|
13366
|
+
}
|
|
13367
|
+
return false;
|
|
13368
|
+
}
|
|
13369
|
+
/**
|
|
13370
|
+
* Checks if current time model is after value.
|
|
13371
|
+
* @param value - time model.
|
|
13372
|
+
* @returns Whether current time model is after value.
|
|
13373
|
+
*/
|
|
13374
|
+
isAfter(value) {
|
|
13375
|
+
return this.toDate() > value.toDate();
|
|
13376
|
+
}
|
|
13377
|
+
/**
|
|
13378
|
+
* Checks if current time model is before value.
|
|
13379
|
+
* @param value - Time model.
|
|
13380
|
+
* @returns Whether current time model is before value.
|
|
13381
|
+
*/
|
|
13382
|
+
isBefore(value) {
|
|
13383
|
+
return this.toDate() < value.toDate();
|
|
13384
|
+
}
|
|
13385
|
+
/**
|
|
13386
|
+
* Clones the current odel.
|
|
13387
|
+
* @returns Cloned model.
|
|
13388
|
+
*/
|
|
13389
|
+
clone() {
|
|
13390
|
+
return new TimeModel(this.hours, this.minutes, this.seconds);
|
|
13391
|
+
}
|
|
13392
|
+
/**
|
|
13393
|
+
* Convert to Javascript Date object.
|
|
13394
|
+
* @returns Javascript Date object.
|
|
13395
|
+
*/
|
|
13396
|
+
toDate() {
|
|
13397
|
+
return new Date(new Date().setHours(this.hours, this.minutes, this.seconds ? this.seconds : 0));
|
|
13398
|
+
}
|
|
13399
|
+
/**
|
|
13400
|
+
* To HTML5 time spec string.
|
|
13401
|
+
* @returns Time as HTML5 spec string.
|
|
13402
|
+
*/
|
|
13403
|
+
toHTML5SpecTimeString() {
|
|
13404
|
+
// The clarity time picker uses the format 'hh:mm:ss'.
|
|
13405
|
+
if (this.seconds) {
|
|
13406
|
+
return this.pad(this.hours) + ':' + this.pad(this.minutes) + ':' + this.pad(this.seconds);
|
|
13407
|
+
}
|
|
13408
|
+
// The clarity time picker uses the format 'hh:mm'.
|
|
13409
|
+
return this.pad(this.hours) + ':' + this.pad(this.minutes);
|
|
13410
|
+
}
|
|
13411
|
+
pad(num) {
|
|
13412
|
+
return num < 10 ? `0${num}` : `${num}`;
|
|
13413
|
+
}
|
|
13414
|
+
}
|
|
13415
|
+
|
|
13334
13416
|
/**
|
|
13335
13417
|
* Daterange parsing service.
|
|
13336
13418
|
* Heavy inspired by `date-io.service.ts` from Clarity.
|
|
@@ -13456,6 +13538,20 @@ class DaterangeParsingService {
|
|
|
13456
13538
|
}
|
|
13457
13539
|
return { from, to };
|
|
13458
13540
|
}
|
|
13541
|
+
parseWithTime(daterangeString, separator = SEPARATOR_TEXT_DEFAULT) {
|
|
13542
|
+
if (daterangeString == null || daterangeString === '') {
|
|
13543
|
+
return null;
|
|
13544
|
+
}
|
|
13545
|
+
const [fromString, toString] = daterangeString.split(separator);
|
|
13546
|
+
const from = this.getDayModelFromDateString(fromString.split(' ')[0]);
|
|
13547
|
+
const to = this.getDayModelFromDateString(toString.split(' ')[0]);
|
|
13548
|
+
const fromTime = this.getTimeModelFromDateString(fromString.split(' ')[1]);
|
|
13549
|
+
const toTime = this.getTimeModelFromDateString(toString.split(' ')[1]);
|
|
13550
|
+
if (from == null && to == null) {
|
|
13551
|
+
return null;
|
|
13552
|
+
}
|
|
13553
|
+
return { from, to, fromTime, toTime };
|
|
13554
|
+
}
|
|
13459
13555
|
/**
|
|
13460
13556
|
* Get `DayModel` from date string.
|
|
13461
13557
|
* @param dateString - Date string.
|
|
@@ -13483,6 +13579,33 @@ class DaterangeParsingService {
|
|
|
13483
13579
|
return this.getDayModelFromDateParts(firstPart, secondPart, thirdPart);
|
|
13484
13580
|
}
|
|
13485
13581
|
}
|
|
13582
|
+
/**
|
|
13583
|
+
* Get `TimeModel` from time string.
|
|
13584
|
+
* @param timeString - Time string in HH:mm:ss or HH:mm format.
|
|
13585
|
+
* @returns TimeModel.
|
|
13586
|
+
*/
|
|
13587
|
+
getTimeModelFromDateString(timeString) {
|
|
13588
|
+
// If no time string provided, return null
|
|
13589
|
+
if (timeString == null || timeString === '') {
|
|
13590
|
+
return null;
|
|
13591
|
+
}
|
|
13592
|
+
// Parse the time string
|
|
13593
|
+
const timeParts = timeString.trim().split(':');
|
|
13594
|
+
if (timeParts.length < 1 || timeParts.length > 3) {
|
|
13595
|
+
return null;
|
|
13596
|
+
}
|
|
13597
|
+
const hours = parseInt(timeParts[0], 10);
|
|
13598
|
+
const minutes = parseInt(timeParts[1], 10);
|
|
13599
|
+
const seconds = timeParts.length === 3 ? parseInt(timeParts[2], 10) : 0;
|
|
13600
|
+
// Validate time values
|
|
13601
|
+
if (isNaN(hours) || isNaN(minutes) || isNaN(seconds)) {
|
|
13602
|
+
return null;
|
|
13603
|
+
}
|
|
13604
|
+
if (hours < 0 || hours > 23 || minutes < 0 || minutes > 59 || seconds < 0 || seconds > 59) {
|
|
13605
|
+
return null;
|
|
13606
|
+
}
|
|
13607
|
+
return new TimeModel(hours, minutes, seconds);
|
|
13608
|
+
}
|
|
13486
13609
|
/**
|
|
13487
13610
|
* Get `DayModel` from date string parts.
|
|
13488
13611
|
* @param yearString - Year string.
|
|
@@ -13717,88 +13840,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
13717
13840
|
args: [ClrControlSuccess]
|
|
13718
13841
|
}] } });
|
|
13719
13842
|
|
|
13720
|
-
/**
|
|
13721
|
-
* Time model.
|
|
13722
|
-
* Takes care of keeping records of full time.
|
|
13723
|
-
*/
|
|
13724
|
-
class TimeModel {
|
|
13725
|
-
constructor(...args) {
|
|
13726
|
-
if (args[0] instanceof Date) {
|
|
13727
|
-
const date = args[0];
|
|
13728
|
-
this.hours = date.getHours();
|
|
13729
|
-
this.minutes = date.getMinutes();
|
|
13730
|
-
this.seconds = date.getSeconds();
|
|
13731
|
-
}
|
|
13732
|
-
else if (typeof args[0] === 'string') {
|
|
13733
|
-
const [hours, minutes, seconds] = args[0].split(':').map(n => parseInt(n));
|
|
13734
|
-
this.hours = hours;
|
|
13735
|
-
this.minutes = minutes;
|
|
13736
|
-
this.seconds = seconds;
|
|
13737
|
-
}
|
|
13738
|
-
else {
|
|
13739
|
-
this.hours = args[0];
|
|
13740
|
-
this.minutes = args[1];
|
|
13741
|
-
this.seconds = args[2];
|
|
13742
|
-
}
|
|
13743
|
-
}
|
|
13744
|
-
/**
|
|
13745
|
-
* Checks if the passed value is equal to current time model.
|
|
13746
|
-
* @param value - Time model.
|
|
13747
|
-
* @returns Whether value is equal to current time model.
|
|
13748
|
-
*/
|
|
13749
|
-
isEqual(value) {
|
|
13750
|
-
if (value) {
|
|
13751
|
-
return this.hours === value.hours && this.minutes === value.minutes && this.seconds === value.seconds;
|
|
13752
|
-
}
|
|
13753
|
-
return false;
|
|
13754
|
-
}
|
|
13755
|
-
/**
|
|
13756
|
-
* Checks if current time model is after value.
|
|
13757
|
-
* @param value - time model.
|
|
13758
|
-
* @returns Whether current time model is after value.
|
|
13759
|
-
*/
|
|
13760
|
-
isAfter(value) {
|
|
13761
|
-
return this.toDate() > value.toDate();
|
|
13762
|
-
}
|
|
13763
|
-
/**
|
|
13764
|
-
* Checks if current time model is before value.
|
|
13765
|
-
* @param value - Time model.
|
|
13766
|
-
* @returns Whether current time model is before value.
|
|
13767
|
-
*/
|
|
13768
|
-
isBefore(value) {
|
|
13769
|
-
return this.toDate() < value.toDate();
|
|
13770
|
-
}
|
|
13771
|
-
/**
|
|
13772
|
-
* Clones the current odel.
|
|
13773
|
-
* @returns Cloned model.
|
|
13774
|
-
*/
|
|
13775
|
-
clone() {
|
|
13776
|
-
return new TimeModel(this.hours, this.minutes, this.seconds);
|
|
13777
|
-
}
|
|
13778
|
-
/**
|
|
13779
|
-
* Convert to Javascript Date object.
|
|
13780
|
-
* @returns Javascript Date object.
|
|
13781
|
-
*/
|
|
13782
|
-
toDate() {
|
|
13783
|
-
return new Date(new Date().setHours(this.hours, this.minutes, this.seconds ? this.seconds : 0));
|
|
13784
|
-
}
|
|
13785
|
-
/**
|
|
13786
|
-
* To HTML5 time spec string.
|
|
13787
|
-
* @returns Time as HTML5 spec string.
|
|
13788
|
-
*/
|
|
13789
|
-
toHTML5SpecTimeString() {
|
|
13790
|
-
// The clarity time picker uses the format 'hh:mm:ss'.
|
|
13791
|
-
if (this.seconds) {
|
|
13792
|
-
return this.pad(this.hours) + ':' + this.pad(this.minutes) + ':' + this.pad(this.seconds);
|
|
13793
|
-
}
|
|
13794
|
-
// The clarity time picker uses the format 'hh:mm'.
|
|
13795
|
-
return this.pad(this.hours) + ':' + this.pad(this.minutes);
|
|
13796
|
-
}
|
|
13797
|
-
pad(num) {
|
|
13798
|
-
return num < 10 ? `0${num}` : `${num}`;
|
|
13799
|
-
}
|
|
13800
|
-
}
|
|
13801
|
-
|
|
13802
13843
|
/**
|
|
13803
13844
|
* Daterangepicker.
|
|
13804
13845
|
*/
|
|
@@ -13932,7 +13973,13 @@ class ClrDaterangepickerDirective {
|
|
|
13932
13973
|
this.daterangeService.updateSelectedDaterange(null, true);
|
|
13933
13974
|
return;
|
|
13934
13975
|
}
|
|
13935
|
-
|
|
13976
|
+
let daterange;
|
|
13977
|
+
if (this.daterangeService.timeActive) {
|
|
13978
|
+
daterange = this.daterangeParsingService.parseWithTime(target.value, this.separatorText);
|
|
13979
|
+
}
|
|
13980
|
+
else {
|
|
13981
|
+
daterange = this.daterangeParsingService.parse(target.value, this.separatorText);
|
|
13982
|
+
}
|
|
13936
13983
|
const invalidDaterange = daterange == null || daterange.from == null || daterange.to == null;
|
|
13937
13984
|
// Invalid manual daterange specified.
|
|
13938
13985
|
if (invalidDaterange) {
|
|
@@ -15367,6 +15414,8 @@ class ClrSignpostAddonComponent {
|
|
|
15367
15414
|
this.open = false;
|
|
15368
15415
|
this.preventPropagationCall = (event) => this.preventPropagation(event);
|
|
15369
15416
|
this.position = 'right-bottom';
|
|
15417
|
+
this.iconShape = 'info-standard';
|
|
15418
|
+
this.openContent = new EventEmitter();
|
|
15370
15419
|
ClarityIcons.addIcons(infoStandardIcon);
|
|
15371
15420
|
}
|
|
15372
15421
|
ngOnInit() {
|
|
@@ -15385,6 +15434,7 @@ class ClrSignpostAddonComponent {
|
|
|
15385
15434
|
}
|
|
15386
15435
|
openChanged(isOpen) {
|
|
15387
15436
|
if (isOpen) {
|
|
15437
|
+
this.openContent.emit();
|
|
15388
15438
|
setTimeout(() => {
|
|
15389
15439
|
this.moveSignpostContentBelowTargetAnchor();
|
|
15390
15440
|
});
|
|
@@ -15402,11 +15452,11 @@ class ClrSignpostAddonComponent {
|
|
|
15402
15452
|
this.document.removeEventListener('click', this.preventPropagationCall, true);
|
|
15403
15453
|
}
|
|
15404
15454
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ClrSignpostAddonComponent, deps: [{ token: i0.Renderer2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
15405
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: ClrSignpostAddonComponent, isStandalone: false, selector: "clr-signpost-addon", inputs: { targetAnchor: "targetAnchor", position: "position" }, viewQueries: [{ propertyName: "signpostElement", first: true, predicate: ClrSignpostContent, descendants: true, read: ElementRef }], ngImport: i0, template: "<clr-signpost data-testid=\"clr-signpost-1599455073503533\">\n <button class=\"btn btn-icon btn-link btn-sm\" type=\"button\" clrSignpostTrigger>\n <cds-icon shape=\"
|
|
15455
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: ClrSignpostAddonComponent, isStandalone: false, selector: "clr-signpost-addon", inputs: { targetAnchor: "targetAnchor", position: "position", iconShape: "iconShape", iconClass: "iconClass" }, outputs: { openContent: "openContent" }, viewQueries: [{ propertyName: "signpostElement", first: true, predicate: ClrSignpostContent, descendants: true, read: ElementRef }], ngImport: i0, template: "<clr-signpost data-testid=\"clr-signpost-1599455073503533\">\n <button class=\"btn btn-icon btn-link btn-sm\" type=\"button\" clrSignpostTrigger>\n <cds-icon [attr.shape]=\"iconShape\" size=\"24\" class=\"{{ iconClass }}\" style=\"vertical-align: initial\"></cds-icon>\n </button>\n <ng-template [(clrIfOpen)]=\"open\" (clrIfOpenChange)=\"openChanged($event)\">\n <clr-signpost-content [clrPosition]=\"position\">\n <ng-content></ng-content>\n </clr-signpost-content>\n </ng-template>\n</clr-signpost>\n", styles: ["button{padding:0!important;min-width:1.2rem!important;height:.75rem!important;border-width:0!important}\n"], dependencies: [{ kind: "directive", type: i1$1.CdsIconCustomTag, selector: "cds-icon" }, { kind: "component", type: i1$1.ClrSignpost, selector: "clr-signpost", inputs: ["clrSignpostTriggerAriaLabel"] }, { kind: "component", type: i1$1.ClrSignpostContent, selector: "clr-signpost-content", inputs: ["clrSignpostCloseAriaLabel", "clrPosition"] }, { kind: "directive", type: i1$1.ClrSignpostTrigger, selector: "[clrSignpostTrigger]" }, { kind: "directive", type: i1$1.ClrIfOpen, selector: "[clrIfOpen]", inputs: ["clrIfOpen"], outputs: ["clrIfOpenChange"] }] }); }
|
|
15406
15456
|
}
|
|
15407
15457
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ClrSignpostAddonComponent, decorators: [{
|
|
15408
15458
|
type: Component,
|
|
15409
|
-
args: [{ selector: 'clr-signpost-addon', standalone: false, template: "<clr-signpost data-testid=\"clr-signpost-1599455073503533\">\n <button class=\"btn btn-icon btn-link btn-sm\" type=\"button\" clrSignpostTrigger>\n <cds-icon shape=\"
|
|
15459
|
+
args: [{ selector: 'clr-signpost-addon', standalone: false, template: "<clr-signpost data-testid=\"clr-signpost-1599455073503533\">\n <button class=\"btn btn-icon btn-link btn-sm\" type=\"button\" clrSignpostTrigger>\n <cds-icon [attr.shape]=\"iconShape\" size=\"24\" class=\"{{ iconClass }}\" style=\"vertical-align: initial\"></cds-icon>\n </button>\n <ng-template [(clrIfOpen)]=\"open\" (clrIfOpenChange)=\"openChanged($event)\">\n <clr-signpost-content [clrPosition]=\"position\">\n <ng-content></ng-content>\n </clr-signpost-content>\n </ng-template>\n</clr-signpost>\n", styles: ["button{padding:0!important;min-width:1.2rem!important;height:.75rem!important;border-width:0!important}\n"] }]
|
|
15410
15460
|
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: Document, decorators: [{
|
|
15411
15461
|
type: Inject,
|
|
15412
15462
|
args: [DOCUMENT]
|
|
@@ -15414,6 +15464,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
15414
15464
|
type: Input
|
|
15415
15465
|
}], position: [{
|
|
15416
15466
|
type: Input
|
|
15467
|
+
}], iconShape: [{
|
|
15468
|
+
type: Input
|
|
15469
|
+
}], iconClass: [{
|
|
15470
|
+
type: Input
|
|
15471
|
+
}], openContent: [{
|
|
15472
|
+
type: Output
|
|
15417
15473
|
}], signpostElement: [{
|
|
15418
15474
|
type: ViewChild,
|
|
15419
15475
|
args: [ClrSignpostContent, { read: ElementRef }]
|