@spicainternational/ngx-sds-components 2.22.9 → 2.23.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.
- package/esm2020/public-api.mjs +3 -1
- package/esm2020/src/lib/date-picker/date-picker.component.mjs +27 -6
- package/esm2020/src/lib/duration-box/duration-box.component.mjs +144 -0
- package/esm2020/src/lib/duration-box/duration-box.module.mjs +43 -0
- package/esm2020/src/lib/duration-box/duration-input-resolver.service.mjs +49 -0
- package/esm2020/src/lib/duration-box/public-api.mjs +3 -0
- package/esm2020/src/lib/duration-box/spicainternational-ngx-sds-components-src-lib-duration-box.mjs +5 -0
- package/esm2020/src/lib/duration-pipe/duration-format.pipe.mjs +26 -0
- package/esm2020/src/lib/duration-pipe/duration-pipe.module.mjs +18 -0
- package/esm2020/src/lib/duration-pipe/public-api.mjs +3 -0
- package/esm2020/src/lib/duration-pipe/spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs +5 -0
- package/fesm2015/spicainternational-ngx-sds-components-src-lib-date-picker.mjs +27 -5
- package/fesm2015/spicainternational-ngx-sds-components-src-lib-date-picker.mjs.map +1 -1
- package/fesm2015/spicainternational-ngx-sds-components-src-lib-duration-box.mjs +237 -0
- package/fesm2015/spicainternational-ngx-sds-components-src-lib-duration-box.mjs.map +1 -0
- package/fesm2015/spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs +48 -0
- package/fesm2015/spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs.map +1 -0
- package/fesm2015/spicainternational-ngx-sds-components.mjs +2 -0
- package/fesm2015/spicainternational-ngx-sds-components.mjs.map +1 -1
- package/fesm2020/spicainternational-ngx-sds-components-src-lib-date-picker.mjs +26 -5
- package/fesm2020/spicainternational-ngx-sds-components-src-lib-date-picker.mjs.map +1 -1
- package/fesm2020/spicainternational-ngx-sds-components-src-lib-duration-box.mjs +237 -0
- package/fesm2020/spicainternational-ngx-sds-components-src-lib-duration-box.mjs.map +1 -0
- package/fesm2020/spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs +48 -0
- package/fesm2020/spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs.map +1 -0
- package/fesm2020/spicainternational-ngx-sds-components.mjs +2 -0
- package/fesm2020/spicainternational-ngx-sds-components.mjs.map +1 -1
- package/package.json +17 -1
- package/public-api.d.ts +2 -0
- package/src/lib/date-picker/date-picker.component.d.ts +2 -0
- package/src/lib/duration-box/duration-box.component.d.ts +39 -0
- package/src/lib/duration-box/duration-box.module.d.ts +10 -0
- package/src/lib/duration-box/duration-input-resolver.service.d.ts +7 -0
- package/src/lib/duration-box/package.json +10 -0
- package/src/lib/duration-box/public-api.d.ts +2 -0
- package/src/lib/duration-box/spicainternational-ngx-sds-components-src-lib-duration-box.d.ts +5 -0
- package/src/lib/duration-pipe/duration-format.pipe.d.ts +7 -0
- package/src/lib/duration-pipe/duration-pipe.module.d.ts +8 -0
- package/src/lib/duration-pipe/package.json +10 -0
- package/src/lib/duration-pipe/public-api.d.ts +2 -0
- package/src/lib/duration-pipe/spicainternational-ngx-sds-components-src-lib-duration-pipe.d.ts +5 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, EventEmitter, Component, Input, Output, ViewChild, NgModule } from '@angular/core';
|
|
3
|
+
import * as i4 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from 'devextreme-angular';
|
|
6
|
+
import { DxTextBoxModule, DxPopoverModule, DxScrollViewModule } from 'devextreme-angular';
|
|
7
|
+
import * as i3 from 'devextreme-angular/ui/nested';
|
|
8
|
+
import * as i5 from 'devextreme-angular/core';
|
|
9
|
+
import * as i6 from '@spicainternational/ngx-sds-components/src/lib/duration-pipe';
|
|
10
|
+
import { SdsDurationPipeModule } from '@spicainternational/ngx-sds-components/src/lib/duration-pipe';
|
|
11
|
+
|
|
12
|
+
class DurationInputResolverService {
|
|
13
|
+
constructor() { }
|
|
14
|
+
resolve(input) {
|
|
15
|
+
if (!input || input.length === 0) {
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
const inputSegments = input.split(':');
|
|
19
|
+
if (inputSegments.length > 2) {
|
|
20
|
+
//invalid input
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
else if (inputSegments.length == 2) {
|
|
24
|
+
// we have hrs and minutes
|
|
25
|
+
const hrs = parseInt(inputSegments[0] ? inputSegments[0] : '0');
|
|
26
|
+
const mins = parseInt(inputSegments[1] ? inputSegments[1] : '0');
|
|
27
|
+
const totalMins = (hrs * 60) + mins;
|
|
28
|
+
return totalMins;
|
|
29
|
+
}
|
|
30
|
+
else if (inputSegments.length == 1) {
|
|
31
|
+
// take last two digits as mins
|
|
32
|
+
const nonSeparated = inputSegments[0];
|
|
33
|
+
let totalMins = 0;
|
|
34
|
+
if (nonSeparated.length <= 2) {
|
|
35
|
+
totalMins = parseInt(nonSeparated);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const lastIndex = nonSeparated.length - 2;
|
|
39
|
+
const part1 = nonSeparated.slice(0, lastIndex);
|
|
40
|
+
const part2 = nonSeparated.slice(lastIndex);
|
|
41
|
+
const hrs = parseInt(part1);
|
|
42
|
+
const mins = parseInt(part2);
|
|
43
|
+
totalMins = (hrs * 60) + mins;
|
|
44
|
+
}
|
|
45
|
+
return totalMins;
|
|
46
|
+
}
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
DurationInputResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: DurationInputResolverService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
51
|
+
DurationInputResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: DurationInputResolverService, providedIn: 'root' });
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: DurationInputResolverService, decorators: [{
|
|
53
|
+
type: Injectable,
|
|
54
|
+
args: [{
|
|
55
|
+
providedIn: 'root',
|
|
56
|
+
}]
|
|
57
|
+
}], ctorParameters: function () { return []; } });
|
|
58
|
+
|
|
59
|
+
class SdsDurationBoxComponent {
|
|
60
|
+
constructor(_durationInputResolver) {
|
|
61
|
+
this._durationInputResolver = _durationInputResolver;
|
|
62
|
+
this.value = null;
|
|
63
|
+
this.valueChange = new EventEmitter();
|
|
64
|
+
this.allowEmptyValue = true;
|
|
65
|
+
this.emptyValueText = 'not set';
|
|
66
|
+
this.width = '10rem';
|
|
67
|
+
this.elementUUID = 'sds-db-' + crypto.randomUUID();
|
|
68
|
+
this.inputValue = '';
|
|
69
|
+
this.showOptions = false;
|
|
70
|
+
this.optionsDropdownButton = {
|
|
71
|
+
icon: 'spindown',
|
|
72
|
+
stylingMode: 'text',
|
|
73
|
+
onClick: () => {
|
|
74
|
+
this.showOptions = !this.showOptions;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
this.clearValueButton = {
|
|
78
|
+
icon: 'clear',
|
|
79
|
+
stylingMode: 'text',
|
|
80
|
+
onClick: () => {
|
|
81
|
+
this.applyOption(null);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
this.isValueEmpty = false;
|
|
85
|
+
this.isValueSetInternally = false;
|
|
86
|
+
}
|
|
87
|
+
ngOnChanges(changes) {
|
|
88
|
+
if (changes['value']) {
|
|
89
|
+
if (this.value === null) {
|
|
90
|
+
if (this.allowEmptyValue) {
|
|
91
|
+
this.isValueEmpty = true;
|
|
92
|
+
this.inputValue = this.emptyValueText;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.inputValue = '0:00'; // TO-DO: resolve this scenario
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.inputValue = this.minutesToDurationString(this.value);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
ngOnInit() { }
|
|
104
|
+
blockNonNumberOrSemicolon(e) {
|
|
105
|
+
this.isValueSetInternally = false;
|
|
106
|
+
if (!(e.event.key === 'Enter' ||
|
|
107
|
+
e.event.key === 'NumpadEnter' ||
|
|
108
|
+
e.event.key === 'Delete' ||
|
|
109
|
+
e.event.key === 'Tab' ||
|
|
110
|
+
e.event.key === 'Backspace' ||
|
|
111
|
+
e.event.key === 'ArrowLeft' ||
|
|
112
|
+
e.event.key === 'ArrowRight' ||
|
|
113
|
+
e.event.key === 'ArrowTop' ||
|
|
114
|
+
e.event.key === 'ArrowBottom')) {
|
|
115
|
+
const regexNumberOfSemicolon = /\d|:/;
|
|
116
|
+
if (!regexNumberOfSemicolon.test(e.event.key)) {
|
|
117
|
+
e.event.preventDefault();
|
|
118
|
+
console.log(`${e.event.key} is not valid`);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.isValueEmpty = false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
resolveInput(data) {
|
|
126
|
+
if (!this.isValueSetInternally) {
|
|
127
|
+
if (this.isValueEmpty || (data.value === '' && this.allowEmptyValue)) {
|
|
128
|
+
// this.inputValue = this.emptyValueTextthis
|
|
129
|
+
// this.applyOption(null);
|
|
130
|
+
this.setValue(null);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
const resolvedValue = this._durationInputResolver.resolve(data.value);
|
|
134
|
+
if (resolvedValue === null && this.allowEmptyValue) {
|
|
135
|
+
this.setValue(null);
|
|
136
|
+
}
|
|
137
|
+
else if (resolvedValue === null && !this.allowEmptyValue) {
|
|
138
|
+
this.setValue(resolvedValue);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
this.setValue(resolvedValue);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
applyOption(value) {
|
|
147
|
+
this.showOptions = false;
|
|
148
|
+
this.isValueSetInternally = false;
|
|
149
|
+
this.setValue(value);
|
|
150
|
+
}
|
|
151
|
+
setValue(value) {
|
|
152
|
+
if ((this.isValueEmpty && value != null) || (!this.isValueEmpty && this.value != value)) {
|
|
153
|
+
this.value = value;
|
|
154
|
+
this.valueChange.emit(this.value);
|
|
155
|
+
if (value === null) {
|
|
156
|
+
this.isValueEmpty = true;
|
|
157
|
+
this.isValueSetInternally = true;
|
|
158
|
+
this.inputValue = this.emptyValueText;
|
|
159
|
+
}
|
|
160
|
+
else if (typeof value === 'number') {
|
|
161
|
+
this.isValueEmpty = false;
|
|
162
|
+
this.isValueSetInternally = true;
|
|
163
|
+
this.inputValue = this.minutesToDurationString(this.value);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
minutesToDurationString(minutes) {
|
|
168
|
+
const hours = Math.floor(minutes / 60);
|
|
169
|
+
const mins = minutes % 60;
|
|
170
|
+
return `${hours.toString().padStart(1, "0")}:${mins.toString().padStart(2, "0")}`;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
SdsDurationBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxComponent, deps: [{ token: DurationInputResolverService }], target: i0.ɵɵFactoryTarget.Component });
|
|
174
|
+
SdsDurationBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.1", type: SdsDurationBoxComponent, selector: "sds-duration-box", inputs: { value: "value", allowEmptyValue: "allowEmptyValue", emptyValueText: "emptyValueText", options: "options", width: "width" }, outputs: { valueChange: "valueChange" }, viewQueries: [{ propertyName: "textbox", first: true, predicate: ["textbox"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<dx-text-box\n #textbox\n [id]=\"elementUUID\"\n [value]=\"inputValue\"\n (onKeyDown)=\"blockNonNumberOrSemicolon($event)\"\n (onValueChanged)=\"resolveInput($event)\"\n [width]=\"width\"\n >\n <dxi-button\n *ngIf=\"allowEmptyValue\"\n name=\"clearValue\"\n location=\"after\"\n [options]=\"clearValueButton\"\n ></dxi-button>\n <dxi-button\n \n *ngIf=\"options && options.length > 0\"\n name=\"optionsDropdown\"\n location=\"after\"\n [options]=\"optionsDropdownButton\"\n ></dxi-button>\n</dx-text-box>\n\n\n<dx-popover\n target=\"#{{elementUUID}}\"\n [(visible)]=\"showOptions\"\n [width]=\"width\"\n [closeOnOutsideClick]=\"true\"\n [wrapperAttr]=\"{ class: 'sds-durationbox-options-popover' }\"\n >\n\n <div *dxTemplate=\"let data of 'content'\">\n\n <button\n class=\"dropdown-item border-0\"\n [class.selected] = \"isValueEmpty\"\n (click)=\"applyOption(null)\"\n > {{ emptyValueText}}\n </button>\n\n <div *ngFor=\"let option of options\">\n <button\n class=\"dropdown-item border-0\"\n [class.selected] = \"option === value\"\n (click)=\"applyOption(option)\"\n > {{option | sdsDurationFormat}}\n </button>\n </div>\n </div>\n\n <!-- <div *ngFor=\"let option of options\"\n class=\"d-flex align-items-center p-1 my-1 mx-1 overflow-avatar-container\" >\n <div class=\"ml-2 pl-1\">\n {{option | sdsDurationFormat}}\n </div>\n </div> -->\n</dx-popover>", styles: [".duration-box-container{height:calc(1.5em + .75rem + 2px)}.duration-box-container .options-dropdown-button{box-shadow:none!important;border:1px solid white;flex:0;padding-top:.3rem!important;padding-bottom:.3rem!important}.duration-box-container input{border:0;min-width:0}.duration-box-container input:focus{outline:none}::ng-deep .sds-durationbox-options-popover .dx-popup-content{padding:.25rem;font-size:1rem}::ng-deep .sds-durationbox-options-popover .dropdown-item:focus{outline:none}::ng-deep .sds-durationbox-options-popover .dropdown-item .selected{background-color:#dee2e6}\n"], components: [{ type: i2.DxTextBoxComponent, selector: "dx-text-box", inputs: ["accessKey", "activeStateEnabled", "buttons", "disabled", "elementAttr", "focusStateEnabled", "height", "hint", "hoverStateEnabled", "inputAttr", "isValid", "label", "labelMode", "mask", "maskChar", "maskInvalidMessage", "maskRules", "maxLength", "mode", "name", "placeholder", "readOnly", "rtlEnabled", "showClearButton", "showMaskMode", "spellcheck", "stylingMode", "tabIndex", "text", "useMaskedValue", "validationError", "validationErrors", "validationMessageMode", "validationMessagePosition", "validationStatus", "value", "valueChangeEvent", "visible", "width"], outputs: ["onChange", "onContentReady", "onCopy", "onCut", "onDisposing", "onEnterKey", "onFocusIn", "onFocusOut", "onInitialized", "onInput", "onKeyDown", "onKeyUp", "onOptionChanged", "onPaste", "onValueChanged", "accessKeyChange", "activeStateEnabledChange", "buttonsChange", "disabledChange", "elementAttrChange", "focusStateEnabledChange", "heightChange", "hintChange", "hoverStateEnabledChange", "inputAttrChange", "isValidChange", "labelChange", "labelModeChange", "maskChange", "maskCharChange", "maskInvalidMessageChange", "maskRulesChange", "maxLengthChange", "modeChange", "nameChange", "placeholderChange", "readOnlyChange", "rtlEnabledChange", "showClearButtonChange", "showMaskModeChange", "spellcheckChange", "stylingModeChange", "tabIndexChange", "textChange", "useMaskedValueChange", "validationErrorChange", "validationErrorsChange", "validationMessageModeChange", "validationMessagePositionChange", "validationStatusChange", "valueChange", "valueChangeEventChange", "visibleChange", "widthChange", "onBlur"] }, { type: i3.DxiButtonComponent, selector: "dxi-button", inputs: ["location", "name", "options", "cssClass", "disabled", "hint", "icon", "onClick", "template", "text", "visible"] }, { type: i2.DxPopoverComponent, selector: "dx-popover", inputs: ["animation", "closeOnOutsideClick", "container", "contentTemplate", "copyRootClassesToWrapper", "deferRendering", "disabled", "elementAttr", "height", "hideEvent", "hideOnOutsideClick", "hideOnParentScroll", "hint", "hoverStateEnabled", "maxHeight", "maxWidth", "minHeight", "minWidth", "position", "rtlEnabled", "shading", "shadingColor", "showCloseButton", "showEvent", "showTitle", "target", "title", "titleTemplate", "toolbarItems", "visible", "width", "wrapperAttr"], outputs: ["onContentReady", "onDisposing", "onHidden", "onHiding", "onInitialized", "onOptionChanged", "onShowing", "onShown", "onTitleRendered", "animationChange", "closeOnOutsideClickChange", "containerChange", "contentTemplateChange", "copyRootClassesToWrapperChange", "deferRenderingChange", "disabledChange", "elementAttrChange", "heightChange", "hideEventChange", "hideOnOutsideClickChange", "hideOnParentScrollChange", "hintChange", "hoverStateEnabledChange", "maxHeightChange", "maxWidthChange", "minHeightChange", "minWidthChange", "positionChange", "rtlEnabledChange", "shadingChange", "shadingColorChange", "showCloseButtonChange", "showEventChange", "showTitleChange", "targetChange", "titleChange", "titleTemplateChange", "toolbarItemsChange", "visibleChange", "widthChange", "wrapperAttrChange"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.DxTemplateDirective, selector: "[dxTemplate]", inputs: ["dxTemplateOf"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "sdsDurationFormat": i6.SdsDurationFormatPipe } });
|
|
175
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxComponent, decorators: [{
|
|
176
|
+
type: Component,
|
|
177
|
+
args: [{ selector: 'sds-duration-box', template: "<dx-text-box\n #textbox\n [id]=\"elementUUID\"\n [value]=\"inputValue\"\n (onKeyDown)=\"blockNonNumberOrSemicolon($event)\"\n (onValueChanged)=\"resolveInput($event)\"\n [width]=\"width\"\n >\n <dxi-button\n *ngIf=\"allowEmptyValue\"\n name=\"clearValue\"\n location=\"after\"\n [options]=\"clearValueButton\"\n ></dxi-button>\n <dxi-button\n \n *ngIf=\"options && options.length > 0\"\n name=\"optionsDropdown\"\n location=\"after\"\n [options]=\"optionsDropdownButton\"\n ></dxi-button>\n</dx-text-box>\n\n\n<dx-popover\n target=\"#{{elementUUID}}\"\n [(visible)]=\"showOptions\"\n [width]=\"width\"\n [closeOnOutsideClick]=\"true\"\n [wrapperAttr]=\"{ class: 'sds-durationbox-options-popover' }\"\n >\n\n <div *dxTemplate=\"let data of 'content'\">\n\n <button\n class=\"dropdown-item border-0\"\n [class.selected] = \"isValueEmpty\"\n (click)=\"applyOption(null)\"\n > {{ emptyValueText}}\n </button>\n\n <div *ngFor=\"let option of options\">\n <button\n class=\"dropdown-item border-0\"\n [class.selected] = \"option === value\"\n (click)=\"applyOption(option)\"\n > {{option | sdsDurationFormat}}\n </button>\n </div>\n </div>\n\n <!-- <div *ngFor=\"let option of options\"\n class=\"d-flex align-items-center p-1 my-1 mx-1 overflow-avatar-container\" >\n <div class=\"ml-2 pl-1\">\n {{option | sdsDurationFormat}}\n </div>\n </div> -->\n</dx-popover>", styles: [".duration-box-container{height:calc(1.5em + .75rem + 2px)}.duration-box-container .options-dropdown-button{box-shadow:none!important;border:1px solid white;flex:0;padding-top:.3rem!important;padding-bottom:.3rem!important}.duration-box-container input{border:0;min-width:0}.duration-box-container input:focus{outline:none}::ng-deep .sds-durationbox-options-popover .dx-popup-content{padding:.25rem;font-size:1rem}::ng-deep .sds-durationbox-options-popover .dropdown-item:focus{outline:none}::ng-deep .sds-durationbox-options-popover .dropdown-item .selected{background-color:#dee2e6}\n"] }]
|
|
178
|
+
}], ctorParameters: function () { return [{ type: DurationInputResolverService }]; }, propDecorators: { value: [{
|
|
179
|
+
type: Input
|
|
180
|
+
}], valueChange: [{
|
|
181
|
+
type: Output
|
|
182
|
+
}], allowEmptyValue: [{
|
|
183
|
+
type: Input
|
|
184
|
+
}], emptyValueText: [{
|
|
185
|
+
type: Input
|
|
186
|
+
}], options: [{
|
|
187
|
+
type: Input
|
|
188
|
+
}], width: [{
|
|
189
|
+
type: Input
|
|
190
|
+
}], textbox: [{
|
|
191
|
+
type: ViewChild,
|
|
192
|
+
args: ['textbox', { static: true }]
|
|
193
|
+
}] } });
|
|
194
|
+
|
|
195
|
+
const components = [
|
|
196
|
+
SdsDurationBoxComponent
|
|
197
|
+
];
|
|
198
|
+
class SdsDurationBoxModule {
|
|
199
|
+
}
|
|
200
|
+
SdsDurationBoxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
201
|
+
SdsDurationBoxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxModule, declarations: [SdsDurationBoxComponent], imports: [CommonModule,
|
|
202
|
+
SdsDurationPipeModule,
|
|
203
|
+
DxTextBoxModule,
|
|
204
|
+
DxPopoverModule,
|
|
205
|
+
DxScrollViewModule], exports: [SdsDurationBoxComponent] });
|
|
206
|
+
SdsDurationBoxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxModule, imports: [[
|
|
207
|
+
CommonModule,
|
|
208
|
+
SdsDurationPipeModule,
|
|
209
|
+
DxTextBoxModule,
|
|
210
|
+
DxPopoverModule,
|
|
211
|
+
DxScrollViewModule,
|
|
212
|
+
]] });
|
|
213
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxModule, decorators: [{
|
|
214
|
+
type: NgModule,
|
|
215
|
+
args: [{
|
|
216
|
+
declarations: [
|
|
217
|
+
SdsDurationBoxComponent
|
|
218
|
+
],
|
|
219
|
+
imports: [
|
|
220
|
+
CommonModule,
|
|
221
|
+
SdsDurationPipeModule,
|
|
222
|
+
DxTextBoxModule,
|
|
223
|
+
DxPopoverModule,
|
|
224
|
+
DxScrollViewModule,
|
|
225
|
+
],
|
|
226
|
+
exports: [
|
|
227
|
+
...components
|
|
228
|
+
]
|
|
229
|
+
}]
|
|
230
|
+
}] });
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Generated bundle index. Do not edit.
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
export { SdsDurationBoxComponent, SdsDurationBoxModule };
|
|
237
|
+
//# sourceMappingURL=spicainternational-ngx-sds-components-src-lib-duration-box.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spicainternational-ngx-sds-components-src-lib-duration-box.mjs","sources":["../../../projects/ngx-sds-components/src/lib/duration-box/duration-input-resolver.service.ts","../../../projects/ngx-sds-components/src/lib/duration-box/duration-box.component.ts","../../../projects/ngx-sds-components/src/lib/duration-box/duration-box.component.html","../../../projects/ngx-sds-components/src/lib/duration-box/duration-box.module.ts","../../../projects/ngx-sds-components/src/lib/duration-box/spicainternational-ngx-sds-components-src-lib-duration-box.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class DurationInputResolverService {\n \n constructor() {}\n\n public resolve(input: string): number | null{\n if (!input || input.length === 0) {\n return 0;\n }\n\n const inputSegments = input.split(':');\n if (inputSegments.length > 2) {\n //invalid input\n return 0;\n } else if (inputSegments.length == 2){\n // we have hrs and minutes\n const hrs = parseInt(inputSegments[0] ? inputSegments[0] : '0');\n const mins = parseInt(inputSegments[1] ? inputSegments[1] : '0');\n const totalMins = (hrs * 60) + mins;\n\n return totalMins;\n } else if (inputSegments.length == 1) {\n // take last two digits as mins\n const nonSeparated = inputSegments[0];\n\n let totalMins = 0;\n if (nonSeparated.length <= 2) {\n totalMins = parseInt(nonSeparated)\n } else {\n const lastIndex = nonSeparated.length - 2;\n const part1 = nonSeparated.slice(0, lastIndex);\n const part2 = nonSeparated.slice(lastIndex);\n const hrs = parseInt(part1);\n const mins = parseInt(part2);\n totalMins = (hrs * 60) + mins; \n }\n return totalMins;\n }\n return 0; \n }\n}\n","import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';\nimport { DxTextBoxComponent } from 'devextreme-angular';\nimport { DurationInputResolverService } from './duration-input-resolver.service';\n\n@Component({\n selector: 'sds-duration-box',\n templateUrl: './duration-box.component.html',\n styleUrls: ['./duration-box.component.scss'],\n})\nexport class SdsDurationBoxComponent implements OnInit, OnChanges {\n\n @Input() value: number | null = null;\n @Output() valueChange = new EventEmitter<number | null>();\n\n @Input() allowEmptyValue: boolean = true;\n @Input() emptyValueText: string = 'not set';\n\n @Input() options?: number[];\n @Input() width: string = '10rem';\n\n @ViewChild('textbox', {static: true}) textbox?: DxTextBoxComponent;\n\n\n public elementUUID = 'sds-db-' + crypto.randomUUID();\n\n public inputValue: string = '';\n public showOptions: boolean = false;\n \n public optionsDropdownButton = {\n icon: 'spindown',\n stylingMode: 'text',\n onClick: () => {\n this.showOptions = !this.showOptions;\n }\n }\n\n public clearValueButton = {\n icon: 'clear',\n stylingMode: 'text',\n onClick: () => {\n this.applyOption(null);\n }\n }\n\n public isValueEmpty = false;\n\n private isValueSetInternally = false;\n\n constructor(\n private _durationInputResolver: DurationInputResolverService\n ) {}\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['value']) {\n if (this.value === null) {\n if (this.allowEmptyValue) {\n this.isValueEmpty = true;\n this.inputValue = this.emptyValueText;\n } else {\n this.inputValue = '0:00'; // TO-DO: resolve this scenario\n }\n\n } else {\n this.inputValue = this.minutesToDurationString(this.value)\n }\n }\n }\n\n ngOnInit(): void {}\n\n public blockNonNumberOrSemicolon(e: any) {\n this.isValueSetInternally = false;\n\n if (!(\n e.event.key === 'Enter' || \n e.event.key === 'NumpadEnter' || \n e.event.key === 'Delete' || \n e.event.key === 'Tab' ||\n e.event.key === 'Backspace' ||\n e.event.key === 'ArrowLeft' ||\n e.event.key === 'ArrowRight' ||\n e.event.key === 'ArrowTop' ||\n e.event.key === 'ArrowBottom'\n )) {\n const regexNumberOfSemicolon = /\\d|:/;\n if (!regexNumberOfSemicolon.test(e.event.key)) {\n e.event.preventDefault();\n console.log(`${e.event.key} is not valid`);\n } else {\n this.isValueEmpty = false;\n }\n }\n }\n\n public resolveInput(data: any) {\n if (!this.isValueSetInternally){\n if (this.isValueEmpty || (data.value === '' && this.allowEmptyValue)) {\n // this.inputValue = this.emptyValueTextthis\n // this.applyOption(null);\n this.setValue(null);\n } else { \n const resolvedValue = this._durationInputResolver.resolve(data.value);\n \n if (resolvedValue === null && this.allowEmptyValue) {\n this.setValue(null);\n } else if (resolvedValue === null && !this.allowEmptyValue) {\n this.setValue(resolvedValue);\n } else {\n this.setValue(resolvedValue);\n }\n }\n }\n }\n\n public applyOption(value: number | null){\n this.showOptions = false;\n this.isValueSetInternally = false;\n this.setValue(value);\n }\n\n private setValue(value: number | null){\n if ( (this.isValueEmpty && value != null) || (!this.isValueEmpty && this.value != value)) {\n this.value = value;\n this.valueChange.emit(this.value);\n if (value === null) {\n this.isValueEmpty = true;\n this.isValueSetInternally = true;\n this.inputValue = this.emptyValueText;\n } else if (typeof value === 'number') {\n this.isValueEmpty = false;\n this.isValueSetInternally = true;\n this.inputValue = this.minutesToDurationString(this.value as number);\n }\n }\n\n }\n\n private minutesToDurationString(minutes: number): string {\n const hours = Math.floor(minutes/60);\n const mins = minutes % 60;\n return `${hours.toString().padStart(1, \"0\")}:${mins.toString().padStart(2, \"0\")}`;\n }\n}\n","<dx-text-box\n #textbox\n [id]=\"elementUUID\"\n [value]=\"inputValue\"\n (onKeyDown)=\"blockNonNumberOrSemicolon($event)\"\n (onValueChanged)=\"resolveInput($event)\"\n [width]=\"width\"\n >\n <dxi-button\n *ngIf=\"allowEmptyValue\"\n name=\"clearValue\"\n location=\"after\"\n [options]=\"clearValueButton\"\n ></dxi-button>\n <dxi-button\n \n *ngIf=\"options && options.length > 0\"\n name=\"optionsDropdown\"\n location=\"after\"\n [options]=\"optionsDropdownButton\"\n ></dxi-button>\n</dx-text-box>\n\n\n<dx-popover\n target=\"#{{elementUUID}}\"\n [(visible)]=\"showOptions\"\n [width]=\"width\"\n [closeOnOutsideClick]=\"true\"\n [wrapperAttr]=\"{ class: 'sds-durationbox-options-popover' }\"\n >\n\n <div *dxTemplate=\"let data of 'content'\">\n\n <button\n class=\"dropdown-item border-0\"\n [class.selected] = \"isValueEmpty\"\n (click)=\"applyOption(null)\"\n > {{ emptyValueText}}\n </button>\n\n <div *ngFor=\"let option of options\">\n <button\n class=\"dropdown-item border-0\"\n [class.selected] = \"option === value\"\n (click)=\"applyOption(option)\"\n > {{option | sdsDurationFormat}}\n </button>\n </div>\n </div>\n\n <!-- <div *ngFor=\"let option of options\"\n class=\"d-flex align-items-center p-1 my-1 mx-1 overflow-avatar-container\" >\n <div class=\"ml-2 pl-1\">\n {{option | sdsDurationFormat}}\n </div>\n </div> -->\n</dx-popover>","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { SdsDurationBoxComponent } from './duration-box.component';\nimport { DxPopoverModule, DxScrollViewModule, DxTextBoxModule } from 'devextreme-angular';\nimport { SdsDurationPipeModule } from '@spicainternational/ngx-sds-components/src/lib/duration-pipe';\n\n\n\nconst components = [\n SdsDurationBoxComponent\n]\n\n@NgModule({\n declarations: [\n SdsDurationBoxComponent\n ],\n imports: [\n CommonModule,\n\n SdsDurationPipeModule,\n \n DxTextBoxModule,\n DxPopoverModule,\n DxScrollViewModule,\n ],\n exports: [\n ...components\n ]\n})\nexport class SdsDurationBoxModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.DurationInputResolverService"],"mappings":";;;;;;;;;;;MAKa,4BAA4B,CAAA;AAErC,IAAA,WAAA,GAAA,GAAgB;AAET,IAAA,OAAO,CAAC,KAAa,EAAA;QACxB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AAC9B,YAAA,OAAO,CAAC,CAAC;AACZ,SAAA;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACvC,QAAA,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;;AAE1B,YAAA,OAAO,CAAC,CAAC;AACZ,SAAA;AAAM,aAAA,IAAI,aAAa,CAAC,MAAM,IAAI,CAAC,EAAC;;YAEjC,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC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 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Pipe, NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
class SdsDurationFormatPipe {
|
|
6
|
+
transform(value, emptyValueText = '') {
|
|
7
|
+
if (value === null) {
|
|
8
|
+
return emptyValueText;
|
|
9
|
+
}
|
|
10
|
+
else if (typeof value === 'number') {
|
|
11
|
+
const sign = Math.sign(value);
|
|
12
|
+
value = Math.abs(value);
|
|
13
|
+
const hours = Math.floor(value / 60);
|
|
14
|
+
const mins = value % 60;
|
|
15
|
+
return `${sign === -1 ? '-' : ''}${hours.toString().padStart(1, '0')}:${mins.toString().padStart(2, '0')}`;
|
|
16
|
+
}
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
SdsDurationFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
21
|
+
SdsDurationFormatPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationFormatPipe, name: "sdsDurationFormat" });
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationFormatPipe, decorators: [{
|
|
23
|
+
type: Pipe,
|
|
24
|
+
args: [{
|
|
25
|
+
name: 'sdsDurationFormat',
|
|
26
|
+
}]
|
|
27
|
+
}] });
|
|
28
|
+
|
|
29
|
+
class SdsDurationPipeModule {
|
|
30
|
+
}
|
|
31
|
+
SdsDurationPipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
32
|
+
SdsDurationPipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationPipeModule, declarations: [SdsDurationFormatPipe], imports: [CommonModule], exports: [SdsDurationFormatPipe] });
|
|
33
|
+
SdsDurationPipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationPipeModule, imports: [[CommonModule]] });
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationPipeModule, decorators: [{
|
|
35
|
+
type: NgModule,
|
|
36
|
+
args: [{
|
|
37
|
+
declarations: [SdsDurationFormatPipe],
|
|
38
|
+
imports: [CommonModule],
|
|
39
|
+
exports: [SdsDurationFormatPipe],
|
|
40
|
+
}]
|
|
41
|
+
}] });
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Generated bundle index. Do not edit.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
export { SdsDurationFormatPipe, SdsDurationPipeModule };
|
|
48
|
+
//# sourceMappingURL=spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs","sources":["../../../projects/ngx-sds-components/src/lib/duration-pipe/duration-format.pipe.ts","../../../projects/ngx-sds-components/src/lib/duration-pipe/duration-pipe.module.ts","../../../projects/ngx-sds-components/src/lib/duration-pipe/spicainternational-ngx-sds-components-src-lib-duration-pipe.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'sdsDurationFormat',\r\n})\r\nexport class SdsDurationFormatPipe implements PipeTransform {\r\n transform(value: number | null, emptyValueText: string = ''): string {\r\n if (value === null) {\r\n return emptyValueText;\r\n } else if (typeof value === 'number') {\r\n const sign = Math.sign(value);\r\n value = Math.abs(value);\r\n const hours = Math.floor(value / 60);\r\n const mins = value % 60;\r\n return `${sign === -1 ? '-' : ''}${hours.toString().padStart(1, '0')}:${mins.toString().padStart(2, '0')}`;\r\n }\r\n return '';\r\n }\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { SdsDurationFormatPipe } from './duration-format.pipe';\r\n\r\n@NgModule({\r\n declarations: [SdsDurationFormatPipe],\r\n imports: [CommonModule],\r\n exports: [SdsDurationFormatPipe],\r\n})\r\nexport class SdsDurationPipeModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAKa,qBAAqB,CAAA;AAC9B,IAAA,SAAS,CAAC,KAAoB,EAAE,cAAA,GAAyB,EAAE,EAAA;QACvD,IAAI,KAAK,KAAK,IAAI,EAAE;AAChB,YAAA,OAAO,cAAc,CAAC;AACzB,SAAA;AAAM,aAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAClC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC9B,YAAA,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACxB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;AACrC,YAAA,MAAM,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;AACxB,YAAA,OAAO,GAAG,IAAI,KAAK,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA,CAAA,EAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AAC9G,SAAA;AACD,QAAA,OAAO,EAAE,CAAC;KACb;;kHAZQ,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;gHAArB,qBAAqB,EAAA,IAAA,EAAA,mBAAA,EAAA,CAAA,CAAA;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAHjC,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACF,oBAAA,IAAI,EAAE,mBAAmB;iBAC5B,CAAA;;;MCKY,qBAAqB,CAAA;;kHAArB,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAArB,qBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,qBAAqB,EAJf,YAAA,EAAA,CAAA,qBAAqB,CAC1B,EAAA,OAAA,EAAA,CAAA,YAAY,aACZ,qBAAqB,CAAA,EAAA,CAAA,CAAA;mHAEtB,qBAAqB,EAAA,OAAA,EAAA,CAHrB,CAAC,YAAY,CAAC,CAAA,EAAA,CAAA,CAAA;2FAGd,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBALjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,YAAY,EAAE,CAAC,qBAAqB,CAAC;oBACrC,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE,CAAC,qBAAqB,CAAC;iBACnC,CAAA;;;ACRD;;AAEG;;;;"}
|
|
@@ -4,6 +4,8 @@ export * from '@spicainternational/ngx-sds-components/src/lib/callout';
|
|
|
4
4
|
export * from '@spicainternational/ngx-sds-components/src/lib/color-picker';
|
|
5
5
|
export * from '@spicainternational/ngx-sds-components/src/lib/date-picker';
|
|
6
6
|
export * from '@spicainternational/ngx-sds-components/src/lib/date-pipes';
|
|
7
|
+
export * from '@spicainternational/ngx-sds-components/src/lib/duration-pipe';
|
|
8
|
+
export * from '@spicainternational/ngx-sds-components/src/lib/duration-box';
|
|
7
9
|
export * from '@spicainternational/ngx-sds-components/src/lib/layout';
|
|
8
10
|
export * from '@spicainternational/ngx-sds-components/src/lib/modal';
|
|
9
11
|
export * from '@spicainternational/ngx-sds-components/src/lib/navigation';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spicainternational-ngx-sds-components.mjs","sources":["../../../projects/ngx-sds-components/src/public-api.ts","../../../projects/ngx-sds-components/src/spicainternational-ngx-sds-components.ts"],"sourcesContent":["/*\r\n * Public API Surface of ngx-sds-components\r\n */\r\n\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/app-switcher';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/avatar';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/callout';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/color-picker';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/date-picker';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/date-pipes';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/layout';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/modal';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/navigation';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/page-header';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/pane';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/quick-info';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/segmented-control';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/side-bar';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/tooltip';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spicainternational-ngx-sds-components.mjs","sources":["../../../projects/ngx-sds-components/src/public-api.ts","../../../projects/ngx-sds-components/src/spicainternational-ngx-sds-components.ts"],"sourcesContent":["/*\r\n * Public API Surface of ngx-sds-components\r\n */\r\n\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/app-switcher';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/avatar';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/callout';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/color-picker';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/date-picker';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/date-pipes';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/duration-pipe';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/duration-box';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/layout';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/modal';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/navigation';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/page-header';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/pane';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/quick-info';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/segmented-control';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/side-bar';\r\nexport * from '@spicainternational/ngx-sds-components/src/lib/tooltip';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AAEG;;ACFH;;AAEG"}
|