@spicainternational/ngx-sds-components 2.22.10 → 2.23.1

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.
Files changed (35) hide show
  1. package/esm2020/public-api.mjs +3 -1
  2. package/esm2020/src/lib/duration-box/duration-box.component.mjs +160 -0
  3. package/esm2020/src/lib/duration-box/duration-box.module.mjs +43 -0
  4. package/esm2020/src/lib/duration-box/duration-input-resolver.service.mjs +54 -0
  5. package/esm2020/src/lib/duration-box/public-api.mjs +3 -0
  6. package/esm2020/src/lib/duration-box/spicainternational-ngx-sds-components-src-lib-duration-box.mjs +5 -0
  7. package/esm2020/src/lib/duration-pipe/duration-format.pipe.mjs +26 -0
  8. package/esm2020/src/lib/duration-pipe/duration-pipe.module.mjs +18 -0
  9. package/esm2020/src/lib/duration-pipe/public-api.mjs +3 -0
  10. package/esm2020/src/lib/duration-pipe/spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs +5 -0
  11. package/fesm2015/spicainternational-ngx-sds-components-src-lib-duration-box.mjs +257 -0
  12. package/fesm2015/spicainternational-ngx-sds-components-src-lib-duration-box.mjs.map +1 -0
  13. package/fesm2015/spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs +48 -0
  14. package/fesm2015/spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs.map +1 -0
  15. package/fesm2015/spicainternational-ngx-sds-components.mjs +2 -0
  16. package/fesm2015/spicainternational-ngx-sds-components.mjs.map +1 -1
  17. package/fesm2020/spicainternational-ngx-sds-components-src-lib-duration-box.mjs +257 -0
  18. package/fesm2020/spicainternational-ngx-sds-components-src-lib-duration-box.mjs.map +1 -0
  19. package/fesm2020/spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs +48 -0
  20. package/fesm2020/spicainternational-ngx-sds-components-src-lib-duration-pipe.mjs.map +1 -0
  21. package/fesm2020/spicainternational-ngx-sds-components.mjs +2 -0
  22. package/fesm2020/spicainternational-ngx-sds-components.mjs.map +1 -1
  23. package/package.json +17 -1
  24. package/public-api.d.ts +2 -0
  25. package/src/lib/duration-box/duration-box.component.d.ts +85 -0
  26. package/src/lib/duration-box/duration-box.module.d.ts +10 -0
  27. package/src/lib/duration-box/duration-input-resolver.service.d.ts +8 -0
  28. package/src/lib/duration-box/package.json +10 -0
  29. package/src/lib/duration-box/public-api.d.ts +2 -0
  30. package/src/lib/duration-box/spicainternational-ngx-sds-components-src-lib-duration-box.d.ts +5 -0
  31. package/src/lib/duration-pipe/duration-format.pipe.d.ts +7 -0
  32. package/src/lib/duration-pipe/duration-pipe.module.d.ts +8 -0
  33. package/src/lib/duration-pipe/package.json +10 -0
  34. package/src/lib/duration-pipe/public-api.d.ts +2 -0
  35. package/src/lib/duration-pipe/spicainternational-ngx-sds-components-src-lib-duration-pipe.d.ts +5 -0
@@ -0,0 +1,257 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, EventEmitter, Component, Input, Output, NgModule } from '@angular/core';
3
+ import * as i4 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as i6 from '@spicainternational/ngx-sds-components/src/lib/duration-pipe';
6
+ import { SdsDurationFormatPipe, SdsDurationPipeModule } from '@spicainternational/ngx-sds-components/src/lib/duration-pipe';
7
+ import * as i2 from 'devextreme-angular';
8
+ import { DxTextBoxModule, DxPopoverModule, DxScrollViewModule } from 'devextreme-angular';
9
+ import * as i3 from 'devextreme-angular/ui/nested';
10
+ import * as i5 from 'devextreme-angular/core';
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
+ isValidInput(input) {
50
+ const regexNumbersOnly = /^[+-]?\d+$/;
51
+ const regexColonSeparated = /^[+-]?\d+:\d+$/;
52
+ return regexNumbersOnly.test(input) || regexColonSeparated.test(input);
53
+ }
54
+ }
55
+ DurationInputResolverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: DurationInputResolverService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
56
+ DurationInputResolverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: DurationInputResolverService, providedIn: 'root' });
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: DurationInputResolverService, decorators: [{
58
+ type: Injectable,
59
+ args: [{
60
+ providedIn: 'root',
61
+ }]
62
+ }], ctorParameters: function () { return []; } });
63
+
64
+ class SdsDurationBoxComponent {
65
+ constructor(_durationInputResolver) {
66
+ this._durationInputResolver = _durationInputResolver;
67
+ /**
68
+ * Duration length expressed in minutes; when we allow empty values this property can be null.
69
+ *
70
+ * @type {(number | null)}
71
+ * @memberof SdsDurationBoxComponent
72
+ */
73
+ this.value = null;
74
+ this.valueChange = new EventEmitter();
75
+ /**
76
+ * Allow user to select empty value. You should provide emptyValueText in this case.
77
+ *
78
+ * @type {boolean}
79
+ * @memberof SdsDurationBoxComponent
80
+ */
81
+ this.allowEmptyValue = true;
82
+ /**
83
+ * 'emptyValueText' - text to be displayed when value is cleared
84
+ *
85
+ * @type {string}
86
+ * @memberof SdsDurationBoxComponent
87
+ */
88
+ this.emptyValueText = 'not set';
89
+ /**
90
+ * Width of component
91
+ *
92
+ * @type {string}
93
+ * @memberof SdsDurationBoxComponent
94
+ */
95
+ this.width = '10rem';
96
+ /**
97
+ * Specifies whether the UI component responds to user interaction.
98
+ *
99
+ * @type {boolean}
100
+ * @memberof SdsDurationBoxComponent
101
+ */
102
+ this.disabled = false;
103
+ /**
104
+ * Specifies whether to display the Clear button in the UI component.
105
+ *
106
+ * @type {boolean}
107
+ * @memberof SdsDurationBoxComponent
108
+ */
109
+ this.showClearButton = false;
110
+ this.elementUUID = 'sds-db-' + crypto.randomUUID();
111
+ this.inputValue = '';
112
+ this.showOptions = false;
113
+ this.isValueEmpty = false;
114
+ this.isValueSetInternally = false;
115
+ this._durationPipe = new SdsDurationFormatPipe();
116
+ this.optionsDropdownButton = {
117
+ icon: 'spindown',
118
+ stylingMode: 'text',
119
+ onClick: () => {
120
+ this.showOptions = !this.showOptions;
121
+ }
122
+ };
123
+ this.clearValueButton = {
124
+ icon: 'clear',
125
+ stylingMode: 'text',
126
+ elementAttr: { class: 'sds-durationbox-clear-button' },
127
+ onClick: () => {
128
+ this.applyOption(null);
129
+ }
130
+ };
131
+ }
132
+ ngOnChanges(changes) {
133
+ if (changes['value']) {
134
+ if (this.value === null) {
135
+ if (this.allowEmptyValue) {
136
+ this.setValue(null);
137
+ // this.isValueEmpty = true;
138
+ // this.inputValue = this.emptyValueText;
139
+ }
140
+ else {
141
+ this.setValue(0);
142
+ this.inputValue = '0:00'; // TO-DO: resolve this scenario
143
+ }
144
+ }
145
+ else {
146
+ this.inputValue = this._durationPipe.transform(this.value, this.emptyValueText);
147
+ }
148
+ }
149
+ }
150
+ ngOnInit() { }
151
+ blockNonNumberOrSemicolon(e) {
152
+ this.isValueSetInternally = false;
153
+ }
154
+ resolveInput() {
155
+ if (!this.isValueSetInternally) {
156
+ if (!this._durationInputResolver.isValidInput(this.inputValue)) {
157
+ // we have invalid input. use old value
158
+ this.setInputValueInternally(this.value);
159
+ }
160
+ else {
161
+ const resolvedValue = this._durationInputResolver.resolve(this.inputValue);
162
+ if (resolvedValue === null && this.allowEmptyValue) {
163
+ this.setValue(null);
164
+ }
165
+ else if (resolvedValue === null && !this.allowEmptyValue) {
166
+ this.setValue(resolvedValue);
167
+ }
168
+ else {
169
+ this.setValue(resolvedValue);
170
+ }
171
+ }
172
+ }
173
+ }
174
+ applyOption(value) {
175
+ this.showOptions = false;
176
+ this.isValueSetInternally = false;
177
+ this.setValue(value);
178
+ }
179
+ setValue(value) {
180
+ this.isValueEmpty = (value === null);
181
+ this.value = value;
182
+ this.valueChange.emit(this.value);
183
+ this.setInputValueInternally(value);
184
+ }
185
+ setInputValueInternally(value) {
186
+ this.isValueSetInternally = true;
187
+ setTimeout(() => {
188
+ this.inputValue = this._durationPipe.transform(this.value, this.emptyValueText);
189
+ }, 0);
190
+ }
191
+ }
192
+ SdsDurationBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxComponent, deps: [{ token: DurationInputResolverService }], target: i0.ɵɵFactoryTarget.Component });
193
+ 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", disabled: "disabled", showClearButton: "showClearButton" }, outputs: { valueChange: "valueChange" }, usesOnChanges: true, ngImport: i0, template: "<dx-text-box\n #textbox\n [id]=\"elementUUID\"\n class=\"sds-durationbox\"\n [(value)]=\"inputValue\"\n (onKeyDown)=\"blockNonNumberOrSemicolon($event)\"\n (onChange)=\"resolveInput()\"\n [width]=\"width\"\n [disabled]=\"disabled\"\n >\n\n <!-- (onValueChanged)=\"resolveInput($event)\" -->\n\n <dxi-button\n *ngIf=\"allowEmptyValue && showClearButton\"\n name=\"clearValue\"\n location=\"after\"\n [options]=\"clearValueButton\"\n ></dxi-button>\n <dxi-button\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 [minWidth]=\"width\"\n [hideOnOutsideClick]=\"true\"\n [wrapperAttr]=\"{ class: 'sds-durationbox-options-popover' }\"\n >\n\n <div *dxTemplate=\"let data of 'content'\">\n <dx-scroll-view>\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 </dx-scroll-view>\n </div>\n</dx-popover>", styles: ["::ng-deep .sds-durationbox .sds-durationbox-clear-button .dx-icon{color:#999}::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"] }, { type: i2.DxScrollViewComponent, selector: "dx-scroll-view", inputs: ["bounceEnabled", "direction", "disabled", "elementAttr", "height", "pulledDownText", "pullingDownText", "reachBottomText", "refreshingText", "rtlEnabled", "scrollByContent", "scrollByThumb", "showScrollbar", "useNative", "width"], outputs: ["onDisposing", "onInitialized", "onOptionChanged", "onPullDown", "onReachBottom", "onScroll", "onUpdated", "bounceEnabledChange", "directionChange", "disabledChange", "elementAttrChange", "heightChange", "pulledDownTextChange", "pullingDownTextChange", "reachBottomTextChange", "refreshingTextChange", "rtlEnabledChange", "scrollByContentChange", "scrollByThumbChange", "showScrollbarChange", "useNativeChange", "widthChange"] }], 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 } });
194
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxComponent, decorators: [{
195
+ type: Component,
196
+ args: [{ selector: 'sds-duration-box', template: "<dx-text-box\n #textbox\n [id]=\"elementUUID\"\n class=\"sds-durationbox\"\n [(value)]=\"inputValue\"\n (onKeyDown)=\"blockNonNumberOrSemicolon($event)\"\n (onChange)=\"resolveInput()\"\n [width]=\"width\"\n [disabled]=\"disabled\"\n >\n\n <!-- (onValueChanged)=\"resolveInput($event)\" -->\n\n <dxi-button\n *ngIf=\"allowEmptyValue && showClearButton\"\n name=\"clearValue\"\n location=\"after\"\n [options]=\"clearValueButton\"\n ></dxi-button>\n <dxi-button\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 [minWidth]=\"width\"\n [hideOnOutsideClick]=\"true\"\n [wrapperAttr]=\"{ class: 'sds-durationbox-options-popover' }\"\n >\n\n <div *dxTemplate=\"let data of 'content'\">\n <dx-scroll-view>\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 </dx-scroll-view>\n </div>\n</dx-popover>", styles: ["::ng-deep .sds-durationbox .sds-durationbox-clear-button .dx-icon{color:#999}::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"] }]
197
+ }], ctorParameters: function () { return [{ type: DurationInputResolverService }]; }, propDecorators: { value: [{
198
+ type: Input
199
+ }], valueChange: [{
200
+ type: Output
201
+ }], allowEmptyValue: [{
202
+ type: Input
203
+ }], emptyValueText: [{
204
+ type: Input
205
+ }], options: [{
206
+ type: Input
207
+ }], width: [{
208
+ type: Input
209
+ }], disabled: [{
210
+ type: Input
211
+ }], showClearButton: [{
212
+ type: Input
213
+ }] } });
214
+
215
+ const components = [
216
+ SdsDurationBoxComponent
217
+ ];
218
+ class SdsDurationBoxModule {
219
+ }
220
+ SdsDurationBoxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
221
+ SdsDurationBoxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxModule, declarations: [SdsDurationBoxComponent], imports: [CommonModule,
222
+ SdsDurationPipeModule,
223
+ DxTextBoxModule,
224
+ DxPopoverModule,
225
+ DxScrollViewModule], exports: [SdsDurationBoxComponent] });
226
+ SdsDurationBoxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxModule, imports: [[
227
+ CommonModule,
228
+ SdsDurationPipeModule,
229
+ DxTextBoxModule,
230
+ DxPopoverModule,
231
+ DxScrollViewModule,
232
+ ]] });
233
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: SdsDurationBoxModule, decorators: [{
234
+ type: NgModule,
235
+ args: [{
236
+ declarations: [
237
+ SdsDurationBoxComponent
238
+ ],
239
+ imports: [
240
+ CommonModule,
241
+ SdsDurationPipeModule,
242
+ DxTextBoxModule,
243
+ DxPopoverModule,
244
+ DxScrollViewModule,
245
+ ],
246
+ exports: [
247
+ ...components
248
+ ]
249
+ }]
250
+ }] });
251
+
252
+ /**
253
+ * Generated bundle index. Do not edit.
254
+ */
255
+
256
+ export { SdsDurationBoxComponent, SdsDurationBoxModule };
257
+ //# 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 public isValidInput(input: string) {\n const regexNumbersOnly = /^[+-]?\\d+$/;\n const regexColonSeparated = /^[+-]?\\d+:\\d+$/;\n return regexNumbersOnly.test(input) || regexColonSeparated.test(input);\n }\n}\n","import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';\nimport { SdsDurationFormatPipe } from '@spicainternational/ngx-sds-components/src/lib/duration-pipe';\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 * Duration length expressed in minutes; when we allow empty values this property can be null.\n *\n * @type {(number | null)}\n * @memberof SdsDurationBoxComponent\n */\n @Input() value: number | null = null;\n @Output() valueChange = new EventEmitter<number | null>();\n\n /**\n * Allow user to select empty value. You should provide emptyValueText in this case.\n *\n * @type {boolean}\n * @memberof SdsDurationBoxComponent\n */\n @Input() allowEmptyValue: boolean = true;\n\n /**\n * 'emptyValueText' - text to be displayed when value is cleared\n *\n * @type {string}\n * @memberof SdsDurationBoxComponent\n */\n @Input() emptyValueText: string = 'not set';\n\n /**\n * Array of pre-defined durations that will be displayed in dropdown for easier selection.\n *\n * @type {number[]}\n * @memberof SdsDurationBoxComponent\n */\n @Input() options?: number[];\n \n /**\n * Width of component\n *\n * @type {string}\n * @memberof SdsDurationBoxComponent\n */\n @Input() width: string = '10rem';\n\n /**\n * Specifies whether the UI component responds to user interaction.\n *\n * @type {boolean}\n * @memberof SdsDurationBoxComponent\n */\n @Input() disabled: boolean = false;\n \n /**\n * Specifies whether to display the Clear button in the UI component.\n *\n * @type {boolean}\n * @memberof SdsDurationBoxComponent\n */\n @Input() showClearButton: boolean = false;\n\n public elementUUID = 'sds-db-' + crypto.randomUUID();\n\n public inputValue: string = '';\n public showOptions: boolean = false;\n \n public optionsDropdownButton;\n public clearValueButton;\n\n public isValueEmpty = false;\n\n private isValueSetInternally = false;\n private _durationPipe: SdsDurationFormatPipe;\n\n constructor(\n private _durationInputResolver: DurationInputResolverService,\n ) {\n this._durationPipe = new SdsDurationFormatPipe();\n \n this.optionsDropdownButton = {\n icon: 'spindown',\n stylingMode: 'text',\n \n onClick: () => {\n this.showOptions = !this.showOptions;\n }\n }\n\n this.clearValueButton = {\n icon: 'clear',\n stylingMode: 'text',\n elementAttr: { class: 'sds-durationbox-clear-button' },\n onClick: () => {\n this.applyOption(null);\n }\n } \n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['value']) {\n if (this.value === null) {\n if (this.allowEmptyValue) {\n this.setValue(null);\n // this.isValueEmpty = true;\n // this.inputValue = this.emptyValueText;\n } else {\n this.setValue(0);\n \n this.inputValue = '0:00'; // TO-DO: resolve this scenario\n }\n\n } else {\n this.inputValue = this._durationPipe.transform(this.value, this.emptyValueText);\n }\n }\n }\n\n ngOnInit(): void {}\n\n public blockNonNumberOrSemicolon(e: any) {\n this.isValueSetInternally = false;\n }\n\n\n public resolveInput() {\n if (!this.isValueSetInternally){\n if (!this._durationInputResolver.isValidInput(this.inputValue)) {\n // we have invalid input. use old value\n this.setInputValueInternally(this.value);\n } else {\n const resolvedValue = this._durationInputResolver.resolve(this.inputValue);\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 this.isValueEmpty = (value === null);\n this.value = value;\n this.valueChange.emit(this.value);\n this.setInputValueInternally(value);\n }\n\n private setInputValueInternally(value: number | null){\n this.isValueSetInternally = true;\n setTimeout(() => {\n this.inputValue = this._durationPipe.transform(this.value, this.emptyValueText);\n }, 0);\n }\n}\n","<dx-text-box\n #textbox\n [id]=\"elementUUID\"\n class=\"sds-durationbox\"\n [(value)]=\"inputValue\"\n (onKeyDown)=\"blockNonNumberOrSemicolon($event)\"\n (onChange)=\"resolveInput()\"\n [width]=\"width\"\n [disabled]=\"disabled\"\n >\n\n <!-- (onValueChanged)=\"resolveInput($event)\" -->\n\n <dxi-button\n *ngIf=\"allowEmptyValue && showClearButton\"\n name=\"clearValue\"\n location=\"after\"\n [options]=\"clearValueButton\"\n ></dxi-button>\n <dxi-button\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 [minWidth]=\"width\"\n [hideOnOutsideClick]=\"true\"\n [wrapperAttr]=\"{ class: 'sds-durationbox-options-popover' }\"\n >\n\n <div *dxTemplate=\"let data of 'content'\">\n <dx-scroll-view>\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 </dx-scroll-view>\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,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;YAChE,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CA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AAuB,CAAA,EAAA,OAAA,EAAA,CAGvB,YAAY;QAEZ,qBAAqB;QAErB,eAAe;QACf,eAAe;QACf,kBAAkB,aAdlB,uBAAuB,CAAA,EAAA,CAAA,CAAA;AAoBd,oBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,EAbtB,OAAA,EAAA,CAAA;YACP,YAAY;YAEZ,qBAAqB;YAErB,eAAe;YACf,eAAe;YACf,kBAAkB;SACnB,CAAA,EAAA,CAAA,CAAA;2FAKU,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAjBhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,YAAY,EAAE;wBACZ,uBAAuB;AACxB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,YAAY;wBAEZ,qBAAqB;wBAErB,eAAe;wBACf,eAAe;wBACf,kBAAkB;AACnB,qBAAA;AACD,oBAAA,OAAO,EAAE;AACP,wBAAA,GAAG,UAAU;AACd,qBAAA;iBACF,CAAA;;;AC5BD;;AAEG;;;;"}
@@ -0,0 +1,48 @@
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,GAA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AAY,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":";;;;;;;;;;;;;;;;AAAA;;AAEG;;ACFH;;AAEG"}
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"}