@ngx-stoui/core 15.0.1 → 16.0.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.
Files changed (66) hide show
  1. package/README.md +7 -7
  2. package/{esm2020 → esm2022}/index.mjs +1 -1
  3. package/{esm2020 → esm2022}/lib/abstract-and-interfaces/keyPress.enum.mjs +1 -1
  4. package/esm2022/lib/sto-directives/context-menu.directive.mjs +36 -0
  5. package/esm2022/lib/sto-directives/date-form-field-click.directive.mjs +46 -0
  6. package/esm2022/lib/sto-directives/directives.module.mjs +64 -0
  7. package/{esm2020 → esm2022}/lib/sto-directives/index.mjs +1 -1
  8. package/esm2022/lib/sto-directives/menu-overlay.directive.mjs +48 -0
  9. package/{esm2020 → esm2022}/lib/sto-directives/quick-keys.directive.mjs +4 -4
  10. package/{esm2020 → esm2022}/lib/sto-directives/sto-grid.directive.mjs +10 -10
  11. package/{esm2020 → esm2022}/lib/sto-directives/sto-select-text-on-focus.directive.mjs +4 -4
  12. package/{esm2020 → esm2022}/lib/sto-pipes/currency-format.pipe.mjs +4 -4
  13. package/{esm2020 → esm2022}/lib/sto-pipes/date-format.pipe.mjs +4 -4
  14. package/{esm2020 → esm2022}/lib/sto-pipes/keys.pipe.mjs +4 -4
  15. package/{esm2020 → esm2022}/lib/sto-pipes/number-format.pipe.mjs +4 -4
  16. package/{esm2020 → esm2022}/lib/sto-pipes/sto-pipes.module.mjs +17 -17
  17. package/{esm2020 → esm2022}/lib/sto-pipes/with-unit.mjs +7 -7
  18. package/{esm2020 → esm2022}/lib/sto-pipes/yes-no.mjs +4 -4
  19. package/{fesm2020 → fesm2022}/ngx-stoui-core.mjs +83 -84
  20. package/fesm2022/ngx-stoui-core.mjs.map +1 -0
  21. package/lib/sto-directives/context-menu.directive.d.ts +2 -2
  22. package/lib/sto-directives/date-form-field-click.directive.d.ts +2 -2
  23. package/lib/sto-directives/menu-overlay.directive.d.ts +1 -1
  24. package/lib/sto-directives/quick-keys.directive.d.ts +1 -1
  25. package/lib/sto-directives/sto-grid.directive.d.ts +2 -2
  26. package/ngx-datatable.css +26 -9
  27. package/ngx-stoui.css +3289 -3554
  28. package/package.json +18 -18
  29. package/style/_fonts.scss +3 -3
  30. package/style/datatable/_ngx-datatable-compact.scss +144 -144
  31. package/style/datatable/_ngx-datatable-form.scss +94 -95
  32. package/style/datatable/_ngx-datatable-variables.scss +10 -10
  33. package/style/datatable/ngx-datatable.scss +404 -398
  34. package/style/form/sto-form.scss +348 -342
  35. package/style/grid.scss +20 -20
  36. package/style/sto-dialog.scss +73 -73
  37. package/style/sto-grid.scss +67 -67
  38. package/style/theme/_action-footer.scss +20 -20
  39. package/style/theme/_appheader.scss +121 -122
  40. package/style/theme/_card.scss +28 -26
  41. package/style/theme/_colors.scss +170 -170
  42. package/style/theme/_datatable.scss +231 -224
  43. package/style/theme/_daterange.scss +47 -51
  44. package/style/theme/_dialog.scss +25 -25
  45. package/style/theme/_filterpanel.scss +88 -88
  46. package/style/theme/_input-overrides.scss +119 -117
  47. package/style/theme/_message-panel.scss +89 -89
  48. package/style/theme/_number-input.scss +23 -23
  49. package/style/theme/_number-unit-input.scss +34 -34
  50. package/style/theme/_select-filter.scss +16 -16
  51. package/style/theme/_sto-indicators.scss +89 -89
  52. package/style/theme/_theme-variables.scss +63 -61
  53. package/style/theme/_theme.scss +22 -16
  54. package/style/theme/_typography.scss +44 -41
  55. package/style/theme/_wysiwyg.scss +38 -38
  56. package/style/theme/components.scss +16 -16
  57. package/style/theme/preference-manager.scss +50 -50
  58. package/style/theme.scss +41 -35
  59. package/esm2020/lib/sto-directives/context-menu.directive.mjs +0 -36
  60. package/esm2020/lib/sto-directives/date-form-field-click.directive.mjs +0 -46
  61. package/esm2020/lib/sto-directives/directives.module.mjs +0 -64
  62. package/esm2020/lib/sto-directives/menu-overlay.directive.mjs +0 -48
  63. package/fesm2015/ngx-stoui-core.mjs +0 -829
  64. package/fesm2015/ngx-stoui-core.mjs.map +0 -1
  65. package/fesm2020/ngx-stoui-core.mjs.map +0 -1
  66. /package/{esm2020 → esm2022}/ngx-stoui-core.mjs +0 -0
@@ -1,829 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { EventEmitter, Directive, Input, Output, HostListener, ContentChildren, HostBinding, ElementRef, Host, NgModule, Pipe } from '@angular/core';
3
- import { MatLegacyInput } from '@angular/material/legacy-input';
4
- import { Subject, fromEvent } from 'rxjs';
5
- import { takeUntil, switchMap, take } from 'rxjs/operators';
6
- import * as i1 from '@angular/material/legacy-menu';
7
- import { parseISO, isValid, format } from 'date-fns';
8
-
9
- /**
10
- MIT License
11
-
12
- Copyright (c) 2017 Nathan Friend
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- The above copyright notice and this permission notice shall be included in all
22
- copies or substantial portions of the Software.
23
-
24
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
- SOFTWARE. **/
31
- var Key;
32
- (function (Key) {
33
- Key[Key["Backspace"] = 8] = "Backspace";
34
- Key[Key["Tab"] = 9] = "Tab";
35
- Key[Key["Enter"] = 13] = "Enter";
36
- Key[Key["Shift"] = 16] = "Shift";
37
- Key[Key["Ctrl"] = 17] = "Ctrl";
38
- Key[Key["Alt"] = 18] = "Alt";
39
- Key[Key["PauseBreak"] = 19] = "PauseBreak";
40
- Key[Key["CapsLock"] = 20] = "CapsLock";
41
- Key[Key["Escape"] = 27] = "Escape";
42
- Key[Key["Space"] = 32] = "Space";
43
- Key[Key["PageUp"] = 33] = "PageUp";
44
- Key[Key["PageDown"] = 34] = "PageDown";
45
- Key[Key["End"] = 35] = "End";
46
- Key[Key["Home"] = 36] = "Home";
47
- Key[Key["LeftArrow"] = 37] = "LeftArrow";
48
- Key[Key["UpArrow"] = 38] = "UpArrow";
49
- Key[Key["RightArrow"] = 39] = "RightArrow";
50
- Key[Key["DownArrow"] = 40] = "DownArrow";
51
- Key[Key["Insert"] = 45] = "Insert";
52
- Key[Key["Delete"] = 46] = "Delete";
53
- Key[Key["Zero"] = 48] = "Zero";
54
- Key[Key["ClosedParen"] = 48] = "ClosedParen";
55
- Key[Key["One"] = 49] = "One";
56
- Key[Key["ExclamationMark"] = 49] = "ExclamationMark";
57
- Key[Key["Two"] = 50] = "Two";
58
- Key[Key["AtSign"] = 50] = "AtSign";
59
- Key[Key["Three"] = 51] = "Three";
60
- Key[Key["PoundSign"] = 51] = "PoundSign";
61
- Key[Key["Hash"] = 51] = "Hash";
62
- Key[Key["Four"] = 52] = "Four";
63
- Key[Key["DollarSign"] = 52] = "DollarSign";
64
- Key[Key["Five"] = 53] = "Five";
65
- Key[Key["PercentSign"] = 53] = "PercentSign";
66
- Key[Key["Six"] = 54] = "Six";
67
- Key[Key["Caret"] = 54] = "Caret";
68
- Key[Key["Hat"] = 54] = "Hat";
69
- Key[Key["Seven"] = 55] = "Seven";
70
- Key[Key["Ampersand"] = 55] = "Ampersand";
71
- Key[Key["Eight"] = 56] = "Eight";
72
- Key[Key["Star"] = 56] = "Star";
73
- Key[Key["Asterik"] = 56] = "Asterik";
74
- Key[Key["Nine"] = 57] = "Nine";
75
- Key[Key["OpenParen"] = 57] = "OpenParen";
76
- Key[Key["A"] = 65] = "A";
77
- Key[Key["B"] = 66] = "B";
78
- Key[Key["C"] = 67] = "C";
79
- Key[Key["D"] = 68] = "D";
80
- Key[Key["E"] = 69] = "E";
81
- Key[Key["F"] = 70] = "F";
82
- Key[Key["G"] = 71] = "G";
83
- Key[Key["H"] = 72] = "H";
84
- Key[Key["I"] = 73] = "I";
85
- Key[Key["J"] = 74] = "J";
86
- Key[Key["K"] = 75] = "K";
87
- Key[Key["L"] = 76] = "L";
88
- Key[Key["M"] = 77] = "M";
89
- Key[Key["N"] = 78] = "N";
90
- Key[Key["O"] = 79] = "O";
91
- Key[Key["P"] = 80] = "P";
92
- Key[Key["Q"] = 81] = "Q";
93
- Key[Key["R"] = 82] = "R";
94
- Key[Key["S"] = 83] = "S";
95
- Key[Key["T"] = 84] = "T";
96
- Key[Key["U"] = 85] = "U";
97
- Key[Key["V"] = 86] = "V";
98
- Key[Key["W"] = 87] = "W";
99
- Key[Key["X"] = 88] = "X";
100
- Key[Key["Y"] = 89] = "Y";
101
- Key[Key["Z"] = 90] = "Z";
102
- Key[Key["LeftWindowKey"] = 91] = "LeftWindowKey";
103
- Key[Key["RightWindowKey"] = 92] = "RightWindowKey";
104
- Key[Key["SelectKey"] = 93] = "SelectKey";
105
- Key[Key["Numpad0"] = 96] = "Numpad0";
106
- Key[Key["Numpad1"] = 97] = "Numpad1";
107
- Key[Key["Numpad2"] = 98] = "Numpad2";
108
- Key[Key["Numpad3"] = 99] = "Numpad3";
109
- Key[Key["Numpad4"] = 100] = "Numpad4";
110
- Key[Key["Numpad5"] = 101] = "Numpad5";
111
- Key[Key["Numpad6"] = 102] = "Numpad6";
112
- Key[Key["Numpad7"] = 103] = "Numpad7";
113
- Key[Key["Numpad8"] = 104] = "Numpad8";
114
- Key[Key["Numpad9"] = 105] = "Numpad9";
115
- Key[Key["Multiply"] = 106] = "Multiply";
116
- Key[Key["Add"] = 107] = "Add";
117
- Key[Key["Subtract"] = 109] = "Subtract";
118
- Key[Key["DecimalPoint"] = 110] = "DecimalPoint";
119
- Key[Key["Divide"] = 111] = "Divide";
120
- Key[Key["F1"] = 112] = "F1";
121
- Key[Key["F2"] = 113] = "F2";
122
- Key[Key["F3"] = 114] = "F3";
123
- Key[Key["F4"] = 115] = "F4";
124
- Key[Key["F5"] = 116] = "F5";
125
- Key[Key["F6"] = 117] = "F6";
126
- Key[Key["F7"] = 118] = "F7";
127
- Key[Key["F8"] = 119] = "F8";
128
- Key[Key["F9"] = 120] = "F9";
129
- Key[Key["F10"] = 121] = "F10";
130
- Key[Key["F11"] = 122] = "F11";
131
- Key[Key["F12"] = 123] = "F12";
132
- Key[Key["NumLock"] = 144] = "NumLock";
133
- Key[Key["ScrollLock"] = 145] = "ScrollLock";
134
- Key[Key["SemiColon"] = 186] = "SemiColon";
135
- Key[Key["Equals"] = 187] = "Equals";
136
- Key[Key["Comma"] = 188] = "Comma";
137
- Key[Key["Dash"] = 189] = "Dash";
138
- Key[Key["Period"] = 190] = "Period";
139
- Key[Key["UnderScore"] = 189] = "UnderScore";
140
- Key[Key["PlusSign"] = 187] = "PlusSign";
141
- Key[Key["ForwardSlash"] = 191] = "ForwardSlash";
142
- Key[Key["Tilde"] = 192] = "Tilde";
143
- Key[Key["GraveAccent"] = 192] = "GraveAccent";
144
- Key[Key["OpenBracket"] = 219] = "OpenBracket";
145
- Key[Key["ClosedBracket"] = 221] = "ClosedBracket";
146
- Key[Key["Quote"] = 222] = "Quote";
147
- })(Key || (Key = {}));
148
-
149
- /**
150
- * QuickKeysDirective is used to implement shortcut keys on DOM elements, e.g to submit or reset a form on enter/escape
151
- * <form quickKeys (quickSubmit)="save()" (quickCancel)="reset()">
152
- */
153
- class QuickKeysDirective {
154
- constructor() {
155
- /**
156
- * Emits when ctrl + enter is clicked in combination
157
- * <form (quickSubmit)="save()">
158
- */
159
- this.quickSubmit = new EventEmitter();
160
- /**
161
- * Emits when escape is clicked
162
- * <form (quickCancel)="cancel()">
163
- */
164
- this.quickCancel = new EventEmitter();
165
- }
166
- /**
167
- * Listens on the host element for any keyup events
168
- * @param e
169
- */
170
- onKeyUp(e) {
171
- if (this.formGroup) {
172
- this.handleFormKeys(e);
173
- }
174
- this.handleGenericKeydown(e);
175
- }
176
- /**
177
- * Handler for generic keydowns, such as cancel events to close drawers
178
- * @param e
179
- * void
180
- */
181
- handleGenericKeydown(e) {
182
- // Shortcuts that are useful outside of forms
183
- if (e.keyCode === Key.Escape) {
184
- this.quickCancel.emit();
185
- }
186
- if (!this.formGroup && e.keyCode === Key.Enter && e.ctrlKey) {
187
- this.quickSubmit.emit();
188
- }
189
- }
190
- /**
191
- * Handler for form specific shortcuts, such as saving the form
192
- * @param e
193
- */
194
- handleFormKeys(e) {
195
- if (this.formGroup.pristine) {
196
- return;
197
- }
198
- if (e.keyCode === Key.Enter && e.ctrlKey) {
199
- this.quickSubmit.emit();
200
- }
201
- }
202
- }
203
- QuickKeysDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: QuickKeysDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
204
- QuickKeysDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: QuickKeysDirective, isStandalone: true, selector: "[stoQuickKeys]", inputs: { quickKeys: "quickKeys", formGroup: "formGroup" }, outputs: { quickSubmit: "quickSubmit", quickCancel: "quickCancel" }, host: { listeners: { "keyup": "onKeyUp($event)" } }, ngImport: i0 });
205
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: QuickKeysDirective, decorators: [{
206
- type: Directive,
207
- args: [{
208
- selector: '[stoQuickKeys]',
209
- standalone: true
210
- }]
211
- }], propDecorators: { quickKeys: [{
212
- type: Input
213
- }], formGroup: [{
214
- type: Input
215
- }], quickSubmit: [{
216
- type: Output
217
- }], quickCancel: [{
218
- type: Output
219
- }], onKeyUp: [{
220
- type: HostListener,
221
- args: ['keyup', ['$event']]
222
- }] } });
223
-
224
- /**
225
- * Directive that can be placed on mat-form-fields that contains a mat-datepicker.
226
- * This directive has two tasks:
227
- * Clicking anywhere on the mat-form-field will open the datepicker dialog
228
- * When the datepicker is closed in any manner, we shift focus back to the datepicker input
229
- */
230
- class DateFormFieldClickDirective {
231
- constructor() {
232
- this.destroy$ = new Subject();
233
- }
234
- clickEvent() {
235
- this.stoDateFormFieldClick.open();
236
- }
237
- ngOnInit() {
238
- this.stoDateFormFieldClick.closedStream
239
- .pipe(takeUntil(this.destroy$)).subscribe(() => this.inputs.first.focus());
240
- }
241
- ngOnDestroy() {
242
- this.destroy$.next(true);
243
- this.destroy$.complete();
244
- }
245
- }
246
- DateFormFieldClickDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DateFormFieldClickDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
247
- DateFormFieldClickDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: DateFormFieldClickDirective, isStandalone: true, selector: "[stoDateFormFieldClick]", inputs: { stoDateFormFieldClick: "stoDateFormFieldClick" }, host: { listeners: { "click": "clickEvent()" } }, queries: [{ propertyName: "inputs", predicate: MatLegacyInput }], ngImport: i0 });
248
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DateFormFieldClickDirective, decorators: [{
249
- type: Directive,
250
- args: [{
251
- selector: '[stoDateFormFieldClick]',
252
- standalone: true
253
- }]
254
- }], propDecorators: { inputs: [{
255
- type: ContentChildren,
256
- args: [MatLegacyInput]
257
- }], stoDateFormFieldClick: [{
258
- type: Input
259
- }], clickEvent: [{
260
- type: HostListener,
261
- args: ['click']
262
- }] } });
263
-
264
- /**
265
- * stoSelectTextOnFocus listens for input focus events, and selects the contents of the input
266
- * A user service is established in {@link StoUserPreferenceService} that allows a user to toggle this feature
267
- */
268
- class StoSelectTextOnFocusDirective {
269
- constructor(elementRef) {
270
- this.elementRef = elementRef;
271
- this._el = this.elementRef.nativeElement;
272
- }
273
- /**
274
- * Listens for focus events on the host (input) element, and focuses if applicable
275
- */
276
- onFocus() {
277
- if (!this._el.readOnly) {
278
- this._el.select();
279
- }
280
- }
281
- }
282
- StoSelectTextOnFocusDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoSelectTextOnFocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
283
- StoSelectTextOnFocusDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: StoSelectTextOnFocusDirective, isStandalone: true, selector: "[stoSelectTextOnFocus]", host: { listeners: { "focus": "onFocus()", "dblclick": "onFocus()" } }, ngImport: i0 });
284
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoSelectTextOnFocusDirective, decorators: [{
285
- type: Directive,
286
- args: [{
287
- selector: '[stoSelectTextOnFocus]',
288
- standalone: true
289
- }]
290
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onFocus: [{
291
- type: HostListener,
292
- args: ['focus']
293
- }, {
294
- type: HostListener,
295
- args: ['dblclick']
296
- }] } });
297
-
298
- const getClass = (width, small = 400, large = 800) => {
299
- let cols = 1;
300
- if (width > small) {
301
- cols += 1;
302
- }
303
- if (width > large) {
304
- cols += 2;
305
- }
306
- return `sto-f-grid--${cols}`;
307
- };
308
- const ALL_GRIDS = ['sto-f-grid--1', 'sto-f-grid--2', 'sto-f-grid--4', 'sto-f-grid--6'];
309
- class StoGridSpacerDirective {
310
- constructor() {
311
- this.useClass = true;
312
- }
313
- }
314
- StoGridSpacerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoGridSpacerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
315
- StoGridSpacerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: StoGridSpacerDirective, isStandalone: true, selector: "[stoGridSpacer]", host: { properties: { "class.sto-f-grid__col": "this.useClass", "class.sto-f-grid__col--spacer": "this.useClass" } }, ngImport: i0 });
316
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoGridSpacerDirective, decorators: [{
317
- type: Directive,
318
- args: [{
319
- selector: '[stoGridSpacer]',
320
- standalone: true
321
- }]
322
- }], propDecorators: { useClass: [{
323
- type: HostBinding,
324
- args: ['class.sto-f-grid__col']
325
- }, {
326
- type: HostBinding,
327
- args: ['class.sto-f-grid__col--spacer']
328
- }] } });
329
- class StoGridColumnDirective {
330
- constructor() {
331
- this.useClass = true;
332
- }
333
- }
334
- StoGridColumnDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoGridColumnDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
335
- StoGridColumnDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: StoGridColumnDirective, isStandalone: true, selector: "[stoGridColumn]", inputs: { stoGridColumnDouble: "stoGridColumnDouble" }, host: { properties: { "class.sto-f-grid__col": "this.useClass", "class.sto-f-grid__col--2": "this.stoGridColumnDouble" } }, ngImport: i0 });
336
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoGridColumnDirective, decorators: [{
337
- type: Directive,
338
- args: [{
339
- selector: '[stoGridColumn]',
340
- standalone: true
341
- }]
342
- }], propDecorators: { useClass: [{
343
- type: HostBinding,
344
- args: ['class.sto-f-grid__col']
345
- }], stoGridColumnDouble: [{
346
- type: HostBinding,
347
- args: ['class.sto-f-grid__col--2']
348
- }, {
349
- type: Input
350
- }] } });
351
- class StoGridDirective {
352
- constructor(elRef) {
353
- this.elRef = elRef;
354
- this.maxWidth = 1000;
355
- this.minWidth = 250;
356
- this.baseClass = true;
357
- }
358
- ngAfterViewInit() {
359
- const el = this.elRef.nativeElement;
360
- this.observer = new ResizeObserver(entries => {
361
- for (const entry of entries) {
362
- const cr = entry.contentRect;
363
- const { width } = cr;
364
- const breakpoints = this.breakpoints || { 2: 400, 4: 800 };
365
- const gridType = getClass(width, breakpoints[2], breakpoints[4]);
366
- if (!el.classList.contains(gridType)) {
367
- el.classList.remove(...ALL_GRIDS);
368
- el.classList.add(gridType);
369
- }
370
- }
371
- });
372
- this.observer.observe(this.elRef.nativeElement);
373
- }
374
- ngOnDestroy() {
375
- if (this.observer) {
376
- this.observer.disconnect();
377
- }
378
- }
379
- }
380
- StoGridDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoGridDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
381
- StoGridDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: StoGridDirective, isStandalone: true, selector: "[stoGrid]", inputs: { maxWidth: "maxWidth", minWidth: "minWidth", breakpoints: "breakpoints" }, host: { properties: { "style.max-width.px": "this.maxWidth", "style.min-width.px": "this.minWidth", "class.sto-f-grid": "this.baseClass" } }, queries: [{ propertyName: "columns", predicate: StoGridColumnDirective, read: ElementRef }], exportAs: ["stoGrid"], ngImport: i0 });
382
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoGridDirective, decorators: [{
383
- type: Directive,
384
- args: [{
385
- selector: '[stoGrid]',
386
- exportAs: 'stoGrid',
387
- standalone: true
388
- }]
389
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { maxWidth: [{
390
- type: HostBinding,
391
- args: ['style.max-width.px']
392
- }, {
393
- type: Input
394
- }], minWidth: [{
395
- type: HostBinding,
396
- args: ['style.min-width.px']
397
- }, {
398
- type: Input
399
- }], baseClass: [{
400
- type: HostBinding,
401
- args: ['class.sto-f-grid']
402
- }], columns: [{
403
- type: ContentChildren,
404
- args: [StoGridColumnDirective, { read: ElementRef }]
405
- }], breakpoints: [{
406
- type: Input
407
- }] } });
408
-
409
- class MenuOverlayDirective {
410
- constructor(trigger, el) {
411
- this.trigger = trigger;
412
- this.left = 0;
413
- this.top = 0;
414
- this.menu = trigger.menu;
415
- this.trigger.menuOpened.pipe(switchMap(() => fromEvent(document, 'click')
416
- .pipe(take(1)))).subscribe(() => {
417
- this.trigger.closeMenu();
418
- });
419
- this.setStyle(el.nativeElement);
420
- }
421
- updatePosition(event) {
422
- this.left = event.x;
423
- this.top = event.y;
424
- }
425
- setStyle(element) {
426
- element.style.overflow = 'hidden';
427
- element.style.position = 'fixed';
428
- element.style.height = '1px';
429
- element.style.width = '1px';
430
- }
431
- }
432
- MenuOverlayDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: MenuOverlayDirective, deps: [{ token: i1.MatLegacyMenuTrigger, host: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
433
- MenuOverlayDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: MenuOverlayDirective, isStandalone: true, selector: "[stoMenuOverlay]", host: { properties: { "style.left.px": "this.left", "style.top.px": "this.top" } }, exportAs: ["stoMenuOverlay"], ngImport: i0 });
434
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: MenuOverlayDirective, decorators: [{
435
- type: Directive,
436
- args: [{
437
- selector: '[stoMenuOverlay]',
438
- exportAs: 'stoMenuOverlay',
439
- standalone: true
440
- }]
441
- }], ctorParameters: function () {
442
- return [{ type: i1.MatLegacyMenuTrigger, decorators: [{
443
- type: Host
444
- }] }, { type: i0.ElementRef }];
445
- }, propDecorators: { left: [{
446
- type: HostBinding,
447
- args: ['style.left.px']
448
- }], top: [{
449
- type: HostBinding,
450
- args: ['style.top.px']
451
- }] } });
452
-
453
- class ContextMenuDirective {
454
- contextMenu(event) {
455
- event.preventDefault();
456
- if (this.menuTrigger.menuOpen) {
457
- this.menuTrigger.closeMenu();
458
- }
459
- this.overlayDirective.updatePosition(event);
460
- setTimeout(() => {
461
- this.menuTrigger.menuData = this.menuContext;
462
- this.menuTrigger.openMenu();
463
- }, 150);
464
- }
465
- }
466
- ContextMenuDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContextMenuDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
467
- ContextMenuDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: ContextMenuDirective, isStandalone: true, selector: "[stoContextMenu]", inputs: { menuTrigger: "menuTrigger", overlayDirective: "overlayDirective", menuContext: "menuContext" }, host: { listeners: { "contextmenu": "contextMenu($event)" } }, ngImport: i0 });
468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ContextMenuDirective, decorators: [{
469
- type: Directive,
470
- args: [{
471
- selector: '[stoContextMenu]',
472
- standalone: true
473
- }]
474
- }], propDecorators: { menuTrigger: [{
475
- type: Input
476
- }], overlayDirective: [{
477
- type: Input
478
- }], menuContext: [{
479
- type: Input
480
- }], contextMenu: [{
481
- type: HostListener,
482
- args: ['contextmenu', ['$event']]
483
- }] } });
484
-
485
- class StoDirectivesModule {
486
- }
487
- StoDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
488
- StoDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: StoDirectivesModule, imports: [QuickKeysDirective,
489
- DateFormFieldClickDirective,
490
- StoSelectTextOnFocusDirective,
491
- StoGridDirective,
492
- StoGridColumnDirective,
493
- StoGridSpacerDirective,
494
- MenuOverlayDirective,
495
- ContextMenuDirective], exports: [QuickKeysDirective,
496
- DateFormFieldClickDirective,
497
- StoSelectTextOnFocusDirective,
498
- StoGridDirective,
499
- StoGridColumnDirective,
500
- StoGridSpacerDirective,
501
- MenuOverlayDirective,
502
- ContextMenuDirective] });
503
- StoDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoDirectivesModule });
504
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoDirectivesModule, decorators: [{
505
- type: NgModule,
506
- args: [{
507
- imports: [
508
- QuickKeysDirective,
509
- DateFormFieldClickDirective,
510
- StoSelectTextOnFocusDirective,
511
- StoGridDirective,
512
- StoGridColumnDirective,
513
- StoGridSpacerDirective,
514
- MenuOverlayDirective,
515
- ContextMenuDirective
516
- ],
517
- exports: [
518
- QuickKeysDirective,
519
- DateFormFieldClickDirective,
520
- StoSelectTextOnFocusDirective,
521
- StoGridDirective,
522
- StoGridColumnDirective,
523
- StoGridSpacerDirective,
524
- MenuOverlayDirective,
525
- ContextMenuDirective
526
- ]
527
- }]
528
- }] });
529
-
530
- /**
531
- * Formats numbers to use our standard formatting (d ddd,ddd)
532
- *
533
- * @example
534
- *
535
- * {{ 1234,32 | numberFormat }} -> 1 234,320
536
- * {{ 1234,32 | numberFormat:'M3' }} -> 1 234,320 M3
537
- * {{ -1234,32 | numberFormat:'M3':true }} -> 1 234,320 M3
538
- * {{ 1234,32 | numberFormat:'M3':false:false }} -> 1 234 M3
539
- * {{ 1234,32 | numberFormat:'M3':false:true:5 }} -> 1 234,32000 M3
540
- */
541
- class NumberFormatPipe {
542
- transform(value, unit = '', abs, appendDecimals = true, numberOfDecimals = 3) {
543
- if (value !== 0 && !value) {
544
- return '';
545
- }
546
- if (typeof value === 'string') {
547
- const newValue = parseFloat(value);
548
- if (isNaN(newValue)) {
549
- return null;
550
- }
551
- value = newValue;
552
- }
553
- if (abs) {
554
- value = Math.abs(value);
555
- }
556
- // We absolute the value to ensure that the rounding rules is always away from zero.
557
- // 1.5 => 2 and -1.5 => -2
558
- const isNegativeNumber = value < 0;
559
- value = Math.abs(value);
560
- if (!appendDecimals) {
561
- value = Math.round(value);
562
- }
563
- if (!isNaN(value) && appendDecimals) {
564
- value = parseFloat(this.toFixed(value, numberOfDecimals));
565
- }
566
- // Turn negative numbers back, but only if value is not -0
567
- // eslint-disable-next-line no-compare-neg-zero
568
- if (isNegativeNumber && value !== -0) {
569
- value = value * -1;
570
- }
571
- const localized = this.prettyPrintValue(value, appendDecimals, numberOfDecimals);
572
- return localized.replace(/,/g, ' ').replace('.', ',') + `${unit ? ' ' + unit : ''}`;
573
- }
574
- prettyPrintValue(value, appendDecimals, numberOfDecimals) {
575
- const intlOptions = { minimumFractionDigits: numberOfDecimals, maximumFractionDigits: numberOfDecimals };
576
- const intl = new Intl.NumberFormat('en-US', intlOptions).format(value);
577
- const split = intl.split('.');
578
- let localized = split[0];
579
- if (appendDecimals) {
580
- const decimals = split.length === 2 ? split[1] : '';
581
- split[1] = decimals.padEnd(numberOfDecimals, '0');
582
- localized = split.join('.');
583
- }
584
- return localized;
585
- }
586
- // Normal toFixed has some issues: https://stackoverflow.com/questions/10015027/javascript-tofixed-not-rounding
587
- toFixed(num, precision) {
588
- // This method also has some issues - namely, it's unable to parse negative numbers with huge floating points
589
- // -8.185452315956354e-12 becomes NaN
590
- let returnValue = (+(Math.round(+(num + 'e' + precision)) + 'e' + -precision));
591
- if (isNaN(returnValue)) {
592
- returnValue = parseFloat(num.toFixed(precision));
593
- }
594
- return returnValue.toFixed(precision);
595
- }
596
- }
597
- NumberFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NumberFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
598
- NumberFormatPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: NumberFormatPipe, isStandalone: true, name: "numberFormat" });
599
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NumberFormatPipe, decorators: [{
600
- type: Pipe,
601
- args: [{
602
- name: 'numberFormat',
603
- standalone: true
604
- }]
605
- }] });
606
-
607
- /**
608
- * Pipe used to transform numbers to a currency format
609
- *
610
- * @example
611
- *
612
- * <span>{{ 5000.5824 | currentFormat:'$':3 }}</span>
613
- * Results in
614
- * <span>5 000,582 $</span>
615
- */
616
- class CurrencyFormatPipe {
617
- transform(value, unit = '', maximumFractionDigits = 3) {
618
- if (!value) {
619
- return null;
620
- }
621
- if (typeof value === 'string') {
622
- value = parseFloat(value);
623
- if (isNaN(value)) {
624
- return '';
625
- }
626
- }
627
- const intl = new Intl.NumberFormat('en-US', { maximumFractionDigits }).format(value);
628
- return intl.replace(/,/g, ' ').replace('.', ',') + ` ${unit}`;
629
- }
630
- }
631
- CurrencyFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: CurrencyFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
632
- CurrencyFormatPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: CurrencyFormatPipe, isStandalone: true, name: "currencyFormat" });
633
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: CurrencyFormatPipe, decorators: [{
634
- type: Pipe,
635
- args: [{
636
- name: 'currencyFormat',
637
- standalone: true
638
- }]
639
- }] });
640
-
641
- /**
642
- * Transforms an Object to an Array.
643
- *
644
- * @example
645
- *
646
- * public obj = {a: 1, b: 2, c: 3};
647
- * <span *ngFor="let key of obj | keys "> {{ obj[key] }}, </span> -> 1, 2, 3,
648
- */
649
- class KeysPipe {
650
- transform(value) {
651
- if (value) {
652
- return Object.keys(value);
653
- }
654
- return [];
655
- }
656
- }
657
- KeysPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: KeysPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
658
- KeysPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: KeysPipe, isStandalone: true, name: "keys" });
659
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: KeysPipe, decorators: [{
660
- type: Pipe,
661
- args: [{
662
- name: 'keys',
663
- standalone: true
664
- }]
665
- }] });
666
-
667
- /**
668
- * Pipe used to transform dates, based on our default formats.
669
- *
670
- * @example
671
- *
672
- * public date = "2018-08-27 14:00:30"
673
- * <span>{{ date | dateFormat }}</span> -> Aug 27, 2018
674
- * <span>{{ date | dateFormat:'long' }}</span> -> Monday Aug 27, 2018
675
- */
676
- class DateFormatPipe {
677
- transform(value, format$1) {
678
- if (!value) {
679
- return null;
680
- }
681
- if (typeof value === 'string') {
682
- const originalValue = value;
683
- value = parseISO(value);
684
- if (!isValid(value)) {
685
- // If invalid ISO date (e.g single-digit day), fall back to new Date()
686
- console.warn(`${originalValue} is not a valid ISO date string, falling back to native date`);
687
- value = new Date(originalValue);
688
- }
689
- }
690
- switch (format$1) {
691
- case 'long':
692
- return format(value, 'EEEE MMM d, yyyy');
693
- case 'short':
694
- return format(value, 'yyyy-MM-dd');
695
- case 'datetime':
696
- return format(value, 'MMM d, yyyy, HH:mm');
697
- case 'datetimezone':
698
- return format(value, `MMM d, yyyy, HH:mm:ss ('UTC'xxx)`);
699
- case 'datetime-long':
700
- return format(value, 'EEEE MMM dd, yyyy, HH:mm');
701
- case 'datetime-short':
702
- return format(value, 'yyyy-MM-dd, HH:mm');
703
- default:
704
- return format(value, 'MMM d, yyyy');
705
- }
706
- }
707
- }
708
- DateFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DateFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
709
- DateFormatPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: DateFormatPipe, isStandalone: true, name: "formatDate" });
710
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DateFormatPipe, decorators: [{
711
- type: Pipe,
712
- args: [{
713
- name: 'formatDate',
714
- standalone: true
715
- }]
716
- }] });
717
-
718
- class GetUnit {
719
- transform(value, withParens) {
720
- if (value) {
721
- const arr = value.split('(');
722
- if (arr.length > 0) {
723
- if (withParens) {
724
- value = '(' + arr[1];
725
- }
726
- else {
727
- arr[1].slice(0, -1);
728
- value = arr[1].slice(0, -1);
729
- }
730
- }
731
- }
732
- return value;
733
- }
734
- }
735
- GetUnit.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: GetUnit, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
736
- GetUnit.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: GetUnit, isStandalone: true, name: "getUnit" });
737
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: GetUnit, decorators: [{
738
- type: Pipe,
739
- args: [{ name: 'getUnit', standalone: true }]
740
- }] });
741
- class ExcludeUnit {
742
- transform(value) {
743
- if (value) {
744
- const arr = value.split('(');
745
- if (arr.length > 0) {
746
- value = arr[0];
747
- }
748
- }
749
- return value;
750
- }
751
- }
752
- ExcludeUnit.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ExcludeUnit, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
753
- ExcludeUnit.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: ExcludeUnit, isStandalone: true, name: "excludeUnit" });
754
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ExcludeUnit, decorators: [{
755
- type: Pipe,
756
- args: [{ name: 'excludeUnit', standalone: true }]
757
- }] });
758
-
759
- class YesNoPipe {
760
- transform(value, ignoreNulls = false) {
761
- let valueStr = '';
762
- if (ignoreNulls) {
763
- valueStr = value ? 'Yes' : value === false ? 'No' : '';
764
- }
765
- else {
766
- valueStr = value ? 'Yes' : 'No';
767
- }
768
- return valueStr;
769
- }
770
- }
771
- YesNoPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: YesNoPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
772
- YesNoPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: YesNoPipe, isStandalone: true, name: "yesNo" });
773
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: YesNoPipe, decorators: [{
774
- type: Pipe,
775
- args: [{ name: 'yesNo', standalone: true }]
776
- }] });
777
-
778
- class StoPipesModule {
779
- }
780
- StoPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
781
- StoPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: StoPipesModule, imports: [DateFormatPipe,
782
- KeysPipe,
783
- NumberFormatPipe,
784
- CurrencyFormatPipe,
785
- GetUnit,
786
- ExcludeUnit,
787
- YesNoPipe], exports: [DateFormatPipe,
788
- KeysPipe,
789
- NumberFormatPipe,
790
- CurrencyFormatPipe,
791
- GetUnit,
792
- ExcludeUnit,
793
- YesNoPipe] });
794
- StoPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoPipesModule });
795
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: StoPipesModule, decorators: [{
796
- type: NgModule,
797
- args: [{
798
- imports: [
799
- DateFormatPipe,
800
- KeysPipe,
801
- NumberFormatPipe,
802
- CurrencyFormatPipe,
803
- GetUnit,
804
- ExcludeUnit,
805
- YesNoPipe
806
- ],
807
- exports: [
808
- DateFormatPipe,
809
- KeysPipe,
810
- NumberFormatPipe,
811
- CurrencyFormatPipe,
812
- GetUnit,
813
- ExcludeUnit,
814
- YesNoPipe
815
- ]
816
- }]
817
- }] });
818
-
819
- /*
820
- * Public API Surface of @ngx-stoui/core
821
- */
822
-
823
- /**
824
- * Generated bundle index. Do not edit.
825
- */
826
-
827
- export { ContextMenuDirective, CurrencyFormatPipe, DateFormFieldClickDirective, DateFormatPipe, ExcludeUnit, GetUnit, Key, KeysPipe, MenuOverlayDirective, NumberFormatPipe, QuickKeysDirective, StoDirectivesModule, StoGridColumnDirective, StoGridDirective, StoGridSpacerDirective, StoPipesModule, StoSelectTextOnFocusDirective, YesNoPipe };
828
- //# sourceMappingURL=ngx-stoui-core.mjs.map
829
- //# sourceMappingURL=ngx-stoui-core.mjs.map