@filip.mazev/common-parts 0.0.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.
- package/README.md +63 -0
- package/fesm2022/filip.mazev-common-parts.mjs +339 -0
- package/fesm2022/filip.mazev-common-parts.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/constants/scroll-lock.constants.d.ts +1 -0
- package/lib/constants/ui-services-common.consants.d.ts +1 -0
- package/lib/enums/desktop-os.enum.d.ts +7 -0
- package/lib/enums/mobile-os.enum.d.ts +6 -0
- package/lib/helpers/uui4.d.ts +1 -0
- package/lib/interfaces/device-state.interface.d.ts +16 -0
- package/lib/interfaces/scroll-lock-config.interface.d.ts +8 -0
- package/lib/interfaces/window-dimensions.interface.d.ts +13 -0
- package/lib/services/device-type.service.d.ts +21 -0
- package/lib/services/scroll-lock.service.d.ts +18 -0
- package/lib/services/text-formatting.service.d.ts +8 -0
- package/lib/services/ui-actions.service.d.ts +6 -0
- package/lib/services/window-dimension.service.d.ts +12 -0
- package/lib/types/device.types.d.ts +5 -0
- package/package.json +23 -0
- package/public-api.d.ts +13 -0
- package/src/lib/styles/_mixins.scss +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# UiServices
|
|
2
|
+
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ng generate component component-name
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ng generate --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Building
|
|
20
|
+
|
|
21
|
+
To build the library, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ng build common-parts
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
+
|
|
29
|
+
### Publishing the Library
|
|
30
|
+
|
|
31
|
+
Once the project is built, you can publish your library by following these steps:
|
|
32
|
+
|
|
33
|
+
1. Navigate to the `dist` directory:
|
|
34
|
+
```bash
|
|
35
|
+
cd dist/common-parts
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
+
```bash
|
|
40
|
+
npm publish
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Running unit tests
|
|
44
|
+
|
|
45
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ng test
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Running end-to-end tests
|
|
52
|
+
|
|
53
|
+
For end-to-end (e2e) testing, run:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ng e2e
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
+
|
|
61
|
+
## Additional Resources
|
|
62
|
+
|
|
63
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, inject } from '@angular/core';
|
|
3
|
+
import { BehaviorSubject } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
var DesktopOS;
|
|
6
|
+
(function (DesktopOS) {
|
|
7
|
+
DesktopOS["Linux"] = "linux";
|
|
8
|
+
DesktopOS["MacOS"] = "mac_os";
|
|
9
|
+
DesktopOS["Unix"] = "unix";
|
|
10
|
+
DesktopOS["Unknown"] = "unknown";
|
|
11
|
+
DesktopOS["Windows"] = "windows";
|
|
12
|
+
})(DesktopOS || (DesktopOS = {}));
|
|
13
|
+
|
|
14
|
+
var MobileOS;
|
|
15
|
+
(function (MobileOS) {
|
|
16
|
+
MobileOS["Android"] = "android";
|
|
17
|
+
MobileOS["iOS"] = "ios";
|
|
18
|
+
MobileOS["Unknown"] = "unknown";
|
|
19
|
+
MobileOS["WindowsPhone"] = "Windows Phone";
|
|
20
|
+
})(MobileOS || (MobileOS = {}));
|
|
21
|
+
|
|
22
|
+
class DeviceTypeService {
|
|
23
|
+
userAgent = navigator.userAgent || navigator.vendor || window.opera || undefined;
|
|
24
|
+
isDesktopDevice = !this.isMobileDevice() && !this.isTabletDevice();
|
|
25
|
+
isMobileDevice() {
|
|
26
|
+
const regexs = [/(Android)(.+)(Mobile)/i, /BlackBerry/i, /iPhone|iPod/i, /Opera Mini/i, /IEMobile/i];
|
|
27
|
+
return regexs.some(b => this.userAgent.match(b) !== null);
|
|
28
|
+
}
|
|
29
|
+
isTabletDevice() {
|
|
30
|
+
const regex = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/;
|
|
31
|
+
return regex.test(this.userAgent.toLowerCase());
|
|
32
|
+
}
|
|
33
|
+
getMobileOS() {
|
|
34
|
+
if (this.isMobileDevice()) {
|
|
35
|
+
if (/windows phone/i.test(this.userAgent))
|
|
36
|
+
return MobileOS.WindowsPhone;
|
|
37
|
+
else if (/android/i.test(this.userAgent))
|
|
38
|
+
return MobileOS.Android;
|
|
39
|
+
else if (/iPad|iPhone|iPod/.test(this.userAgent) && !window.MSStream)
|
|
40
|
+
return MobileOS.iOS;
|
|
41
|
+
return MobileOS.Unknown;
|
|
42
|
+
}
|
|
43
|
+
else
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
getDesktopOS() {
|
|
47
|
+
if (this.isDesktopDevice) {
|
|
48
|
+
if (this.userAgent.indexOf('Win') !== -1)
|
|
49
|
+
return DesktopOS.Windows;
|
|
50
|
+
else if (this.userAgent.indexOf('Mac') !== -1)
|
|
51
|
+
return DesktopOS.MacOS;
|
|
52
|
+
else if (this.userAgent.indexOf('X11') !== -1)
|
|
53
|
+
return DesktopOS.Unix;
|
|
54
|
+
else if (this.userAgent.indexOf('Linux') !== -1)
|
|
55
|
+
return DesktopOS.Linux;
|
|
56
|
+
return DesktopOS.Unknown;
|
|
57
|
+
}
|
|
58
|
+
else
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
getDeviceOS() {
|
|
62
|
+
return this.getMobileOS() ?? this.getDesktopOS();
|
|
63
|
+
}
|
|
64
|
+
supportedScreenOrientation = (screen?.orientation || {}).type ?? screen.mozOrientation ?? screen.msOrientation;
|
|
65
|
+
safariScreenOrientation = !screen?.orientation && matchMedia('(orientation: portrait)').matches ? 'portrait-primary' : 'landscape-primary';
|
|
66
|
+
initialScreenOrientation = this.supportedScreenOrientation ?? this.safariScreenOrientation ?? 'portrait-primary';
|
|
67
|
+
screenOrientation = this.initialScreenOrientation;
|
|
68
|
+
constructor() {
|
|
69
|
+
if (screen.orientation) {
|
|
70
|
+
screen.orientation.addEventListener('change', (ev) => (this.screenOrientation = (ev.target ?? {}).type));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
isLandscapeOrientation() {
|
|
74
|
+
return ['landscape-primary', 'landscape-secondary'].includes(this.screenOrientation);
|
|
75
|
+
}
|
|
76
|
+
isPortraitOrientation() {
|
|
77
|
+
return ['portrait-primary', 'portrait-secondary'].includes(this.screenOrientation);
|
|
78
|
+
}
|
|
79
|
+
getDeviceState() {
|
|
80
|
+
const isDesktop = this.isDesktopDevice;
|
|
81
|
+
const isMobile = this.isMobileDevice();
|
|
82
|
+
const isTablet = this.isTabletDevice();
|
|
83
|
+
const mobileOS = this.getMobileOS();
|
|
84
|
+
const isAndroidDevice = this.getDeviceOS() === MobileOS.Android;
|
|
85
|
+
const isAppleDevice = this.getDeviceOS() === MobileOS.iOS || this.getDeviceOS() === DesktopOS.MacOS;
|
|
86
|
+
const isUnknownMobileDevice = this.getDeviceOS() === MobileOS.Unknown;
|
|
87
|
+
const desktopOS = this.getDesktopOS();
|
|
88
|
+
const isWindowsDesktop = this.getDeviceOS() === DesktopOS.Windows;
|
|
89
|
+
const isLinuxOrUnixDesktop = this.getDeviceOS() === DesktopOS.Linux || this.getDeviceOS() === DesktopOS.Unix;
|
|
90
|
+
return {
|
|
91
|
+
isDesktop,
|
|
92
|
+
desktopOS,
|
|
93
|
+
isWindowsDesktop,
|
|
94
|
+
isLinuxOrUnixDesktop,
|
|
95
|
+
isMobile,
|
|
96
|
+
mobileOS,
|
|
97
|
+
isAndroidDevice,
|
|
98
|
+
isAppleDevice,
|
|
99
|
+
isUnknownMobileDevice,
|
|
100
|
+
isTablet,
|
|
101
|
+
isLandscapeOrientation: () => this.isLandscapeOrientation(),
|
|
102
|
+
isPortraitOrientation: () => this.isPortraitOrientation()
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DeviceTypeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
106
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DeviceTypeService, providedIn: 'root' });
|
|
107
|
+
}
|
|
108
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DeviceTypeService, decorators: [{
|
|
109
|
+
type: Injectable,
|
|
110
|
+
args: [{
|
|
111
|
+
providedIn: 'root'
|
|
112
|
+
}]
|
|
113
|
+
}], ctorParameters: () => [] });
|
|
114
|
+
|
|
115
|
+
class WindowDimensionsService {
|
|
116
|
+
windowDimensionsSubject = new BehaviorSubject(this.getWindowDimensions());
|
|
117
|
+
constructor() {
|
|
118
|
+
this.handleResize();
|
|
119
|
+
window.addEventListener('resize', this.handleResize.bind(this));
|
|
120
|
+
}
|
|
121
|
+
getWindowDimensions() {
|
|
122
|
+
return {
|
|
123
|
+
width: window.innerWidth,
|
|
124
|
+
height: window.innerHeight,
|
|
125
|
+
threshold_xs: 360,
|
|
126
|
+
threshold_sm: 640,
|
|
127
|
+
threshold_md: 768,
|
|
128
|
+
threshold_lg: 1024,
|
|
129
|
+
threshold_xl: 1280,
|
|
130
|
+
threshold_2xl: 1536,
|
|
131
|
+
threshold_3xl: 1920,
|
|
132
|
+
threshold_4xl: 2560,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
handleResize() {
|
|
136
|
+
this.windowDimensionsSubject.next(this.getWindowDimensions());
|
|
137
|
+
}
|
|
138
|
+
getWindowDimensions$() {
|
|
139
|
+
return this.windowDimensionsSubject.asObservable();
|
|
140
|
+
}
|
|
141
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: WindowDimensionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
142
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: WindowDimensionsService, providedIn: 'root' });
|
|
143
|
+
}
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: WindowDimensionsService, decorators: [{
|
|
145
|
+
type: Injectable,
|
|
146
|
+
args: [{
|
|
147
|
+
providedIn: 'root',
|
|
148
|
+
}]
|
|
149
|
+
}], ctorParameters: () => [] });
|
|
150
|
+
|
|
151
|
+
const SCROLL_LOCK_INSTANCE_IDENTIFIER = 'scroll_lock_instance_';
|
|
152
|
+
|
|
153
|
+
class ScrollLockService {
|
|
154
|
+
deviceTypeService = inject(DeviceTypeService);
|
|
155
|
+
windowDimensionSerivce = inject(WindowDimensionsService);
|
|
156
|
+
instanceId;
|
|
157
|
+
configurationInstances = new Map();
|
|
158
|
+
windowDimensions = {};
|
|
159
|
+
constructor() {
|
|
160
|
+
this.instanceId = SCROLL_LOCK_INSTANCE_IDENTIFIER + Math.random().toString(36).substring(2, 9);
|
|
161
|
+
this.windowDimensionSerivce.getWindowDimensions$().subscribe((dimensions) => {
|
|
162
|
+
this.windowDimensions = dimensions;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
ngOnDestroy() {
|
|
166
|
+
this.enableScroll();
|
|
167
|
+
}
|
|
168
|
+
disableScroll(config) {
|
|
169
|
+
document.body.style.setProperty('overflow', 'hidden', 'important');
|
|
170
|
+
const documentWidth = document.documentElement.clientWidth;
|
|
171
|
+
const windowWidth = window.innerWidth;
|
|
172
|
+
const scrollBarWidth = windowWidth - documentWidth;
|
|
173
|
+
document.body.style.paddingRight = scrollBarWidth + 'px';
|
|
174
|
+
document.body.style.setProperty('padding-right', scrollBarWidth + 'px', 'important');
|
|
175
|
+
if (config.handleTouchInput !== false) {
|
|
176
|
+
document.body.style.setProperty('touch-action', 'none', 'important');
|
|
177
|
+
}
|
|
178
|
+
this.configurationInstances.set(this.instanceId, config);
|
|
179
|
+
if (config.mainContainer !== undefined && config.mainContainer.parentElement !== null) {
|
|
180
|
+
let currentNode = config.mainContainer.parentElement;
|
|
181
|
+
while (currentNode !== null) {
|
|
182
|
+
currentNode.style.setProperty('overflow', 'hidden', 'important');
|
|
183
|
+
if (config.handleTouchInput !== false) {
|
|
184
|
+
currentNode.addEventListener('touchmove', (event) => this.handleTouchMove(event), { passive: false });
|
|
185
|
+
currentNode.style.setProperty('touch-action', 'none', 'important');
|
|
186
|
+
}
|
|
187
|
+
currentNode = currentNode.parentElement;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
setTimeout(() => {
|
|
191
|
+
if (config.handleTouchInput !== false) {
|
|
192
|
+
document.body.addEventListener('touchmove', (event) => this.handleTouchMove(event), { passive: false });
|
|
193
|
+
}
|
|
194
|
+
if (config.handleExtremeOverflow !== false) {
|
|
195
|
+
const options = { passive: false };
|
|
196
|
+
window.addEventListener('wheel', this.preventDefault, options);
|
|
197
|
+
window.addEventListener('mousewheel', this.preventDefault, options);
|
|
198
|
+
window.addEventListener('scroll', this.preventDefault, options);
|
|
199
|
+
window.addEventListener('DOMMouseScroll', this.preventDefault, options);
|
|
200
|
+
}
|
|
201
|
+
}, (config.animationDuration ?? 0) + 10);
|
|
202
|
+
}
|
|
203
|
+
enableScroll(extreme_overflow) {
|
|
204
|
+
document.body.style.removeProperty('overflow');
|
|
205
|
+
document.body.style.removeProperty('padding-right');
|
|
206
|
+
let currentConfiguration = this.configurationInstances.get(this.instanceId);
|
|
207
|
+
if (currentConfiguration && currentConfiguration.handleTouchInput !== false) {
|
|
208
|
+
document.body.removeEventListener('touchmove', this.handleTouchMove);
|
|
209
|
+
document.body.style.removeProperty('touch-action');
|
|
210
|
+
}
|
|
211
|
+
if (currentConfiguration !== undefined && currentConfiguration.mainContainer !== undefined && currentConfiguration.mainContainer.parentElement !== null) {
|
|
212
|
+
let currentNode = currentConfiguration.mainContainer.parentElement;
|
|
213
|
+
while (currentNode !== null) {
|
|
214
|
+
currentNode.style.removeProperty('overflow');
|
|
215
|
+
if (currentConfiguration.handleTouchInput !== false) {
|
|
216
|
+
currentNode.removeEventListener('touchmove', this.preventDefault);
|
|
217
|
+
currentNode.style.removeProperty('touch-action');
|
|
218
|
+
}
|
|
219
|
+
currentNode = currentNode.parentElement;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
this.configurationInstances.delete(this.instanceId);
|
|
223
|
+
if (extreme_overflow !== false) {
|
|
224
|
+
window.removeEventListener('wheel', this.preventDefault);
|
|
225
|
+
window.removeEventListener('mousewheel', this.preventDefault);
|
|
226
|
+
window.removeEventListener('scroll', this.preventDefault);
|
|
227
|
+
window.removeEventListener('DOMMouseScroll', this.preventDefault);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
handleTouchMove(event) {
|
|
231
|
+
const targetNode = event.target;
|
|
232
|
+
const currentConfiguration = this.configurationInstances.get(this.instanceId);
|
|
233
|
+
if (!this.isAllowedToScroll(targetNode) && (currentConfiguration === null || currentConfiguration?.handleTouchInput !== false)) {
|
|
234
|
+
if (currentConfiguration === null || currentConfiguration?.mobileOnlyTouchPrevention !== true ||
|
|
235
|
+
(currentConfiguration?.mobileOnlyTouchPrevention === true && ((!this.deviceTypeService.getDeviceState().isMobile || !this.deviceTypeService.getDeviceState().isTablet)
|
|
236
|
+
&& (this.windowDimensions.width < this.windowDimensions.threshold_sm)))) {
|
|
237
|
+
event.preventDefault();
|
|
238
|
+
event.stopPropagation();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
isAllowedToScroll(targetNode) {
|
|
243
|
+
const currentConfiguration = this.configurationInstances.get(this.instanceId);
|
|
244
|
+
if (!currentConfiguration?.allowTouchInputOn || currentConfiguration.allowTouchInputOn.length === 0) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
if (currentConfiguration.allowTouchInputOn.length === undefined) {
|
|
248
|
+
return currentConfiguration.allowTouchInputOn.contains(targetNode);
|
|
249
|
+
}
|
|
250
|
+
for (const element of currentConfiguration.allowTouchInputOn) {
|
|
251
|
+
if (element.contains(targetNode)) {
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
preventDefault(event) {
|
|
258
|
+
event.preventDefault();
|
|
259
|
+
event.stopPropagation();
|
|
260
|
+
}
|
|
261
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ScrollLockService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
262
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ScrollLockService, providedIn: 'root' });
|
|
263
|
+
}
|
|
264
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ScrollLockService, decorators: [{
|
|
265
|
+
type: Injectable,
|
|
266
|
+
args: [{
|
|
267
|
+
providedIn: 'root'
|
|
268
|
+
}]
|
|
269
|
+
}], ctorParameters: () => [] });
|
|
270
|
+
|
|
271
|
+
const ITEM_COPY_DEFAULT_SUFFIX = "Copy";
|
|
272
|
+
|
|
273
|
+
class TextFormattingService {
|
|
274
|
+
constructor() { }
|
|
275
|
+
generateNameCopy(originalName, existingNames = undefined, copySuffix = ITEM_COPY_DEFAULT_SUFFIX) {
|
|
276
|
+
const existingNamesToLower = existingNames?.map(item => item.toLowerCase()) ?? [];
|
|
277
|
+
let newName = `${originalName} (Copy)`;
|
|
278
|
+
let copyIndex = 2;
|
|
279
|
+
while (existingNamesToLower.includes(newName.toLowerCase())) {
|
|
280
|
+
newName = `${originalName} (${copySuffix} ${copyIndex++})`;
|
|
281
|
+
}
|
|
282
|
+
return newName;
|
|
283
|
+
}
|
|
284
|
+
formattedDateString(date) {
|
|
285
|
+
if (!date)
|
|
286
|
+
return undefined;
|
|
287
|
+
const dateObj = (date instanceof Date) ? date : new Date(date);
|
|
288
|
+
return dateObj.toLocaleDateString(undefined, {
|
|
289
|
+
year: 'numeric',
|
|
290
|
+
month: 'short',
|
|
291
|
+
day: 'numeric',
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextFormattingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
295
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextFormattingService, providedIn: 'root' });
|
|
296
|
+
}
|
|
297
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: TextFormattingService, decorators: [{
|
|
298
|
+
type: Injectable,
|
|
299
|
+
args: [{
|
|
300
|
+
providedIn: 'root'
|
|
301
|
+
}]
|
|
302
|
+
}], ctorParameters: () => [] });
|
|
303
|
+
|
|
304
|
+
class UiActionsService {
|
|
305
|
+
downloadFile(data, filename, mimeType) {
|
|
306
|
+
const blob = new Blob([data], { type: mimeType });
|
|
307
|
+
const url = window.URL.createObjectURL(blob);
|
|
308
|
+
const a = document.createElement('a');
|
|
309
|
+
a.href = url;
|
|
310
|
+
a.download = filename;
|
|
311
|
+
document.body.appendChild(a);
|
|
312
|
+
a.click();
|
|
313
|
+
document.body.removeChild(a);
|
|
314
|
+
window.URL.revokeObjectURL(url);
|
|
315
|
+
}
|
|
316
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: UiActionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
317
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: UiActionsService, providedIn: 'root' });
|
|
318
|
+
}
|
|
319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: UiActionsService, decorators: [{
|
|
320
|
+
type: Injectable,
|
|
321
|
+
args: [{
|
|
322
|
+
providedIn: 'root'
|
|
323
|
+
}]
|
|
324
|
+
}] });
|
|
325
|
+
|
|
326
|
+
function uuidv4() {
|
|
327
|
+
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => (+c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))).toString(16));
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/*
|
|
331
|
+
* Public API Surface of common-parts
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Generated bundle index. Do not edit.
|
|
336
|
+
*/
|
|
337
|
+
|
|
338
|
+
export { DesktopOS, DeviceTypeService, ITEM_COPY_DEFAULT_SUFFIX, MobileOS, ScrollLockService, TextFormattingService, UiActionsService, WindowDimensionsService, uuidv4 };
|
|
339
|
+
//# sourceMappingURL=filip.mazev-common-parts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filip.mazev-common-parts.mjs","sources":["../../../projects/common-parts/src/lib/enums/desktop-os.enum.ts","../../../projects/common-parts/src/lib/enums/mobile-os.enum.ts","../../../projects/common-parts/src/lib/services/device-type.service.ts","../../../projects/common-parts/src/lib/services/window-dimension.service.ts","../../../projects/common-parts/src/lib/constants/scroll-lock.constants.ts","../../../projects/common-parts/src/lib/services/scroll-lock.service.ts","../../../projects/common-parts/src/lib/constants/ui-services-common.consants.ts","../../../projects/common-parts/src/lib/services/text-formatting.service.ts","../../../projects/common-parts/src/lib/services/ui-actions.service.ts","../../../projects/common-parts/src/lib/helpers/uui4.ts","../../../projects/common-parts/src/public-api.ts","../../../projects/common-parts/src/filip.mazev-common-parts.ts"],"sourcesContent":["export enum DesktopOS {\n Linux = 'linux',\n MacOS = 'mac_os',\n Unix = 'unix',\n Unknown = 'unknown',\n Windows = 'windows'\n}","export enum MobileOS {\n Android = 'android',\n iOS = 'ios',\n Unknown = 'unknown',\n WindowsPhone = 'Windows Phone'\n}","import { Injectable } from '@angular/core';\nimport { DesktopOS } from '../enums/desktop-os.enum';\nimport { MobileOS } from '../enums/mobile-os.enum';\nimport { DeviceState } from '../interfaces/device-state.interface';\nimport { DeviceOS, DeviceOrientationType } from '../types/device.types';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class DeviceTypeService {\n private userAgent: string = navigator.userAgent || navigator.vendor || (window as any).opera || undefined;\n private isDesktopDevice: boolean = !this.isMobileDevice() && !this.isTabletDevice();\n\n private isMobileDevice(): boolean {\n const regexs = [/(Android)(.+)(Mobile)/i, /BlackBerry/i, /iPhone|iPod/i, /Opera Mini/i, /IEMobile/i];\n return regexs.some(b => this.userAgent.match(b) !== null);\n }\n\n private isTabletDevice(): boolean {\n const regex = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/;\n return regex.test(this.userAgent.toLowerCase());\n }\n\n private getMobileOS(): MobileOS | undefined {\n if (this.isMobileDevice()) {\n if (/windows phone/i.test(this.userAgent)) return MobileOS.WindowsPhone;\n else if (/android/i.test(this.userAgent)) return MobileOS.Android;\n else if (/iPad|iPhone|iPod/.test(this.userAgent) && !(window as any).MSStream) return MobileOS.iOS;\n\n return MobileOS.Unknown;\n } else return undefined;\n }\n\n private getDesktopOS(): DesktopOS | undefined {\n if (this.isDesktopDevice) {\n if (this.userAgent.indexOf('Win') !== -1) return DesktopOS.Windows;\n else if (this.userAgent.indexOf('Mac') !== -1) return DesktopOS.MacOS;\n else if (this.userAgent.indexOf('X11') !== -1) return DesktopOS.Unix;\n else if (this.userAgent.indexOf('Linux') !== -1) return DesktopOS.Linux;\n\n return DesktopOS.Unknown;\n } else return undefined;\n }\n\n private getDeviceOS(): DeviceOS | undefined {\n return this.getMobileOS() ?? this.getDesktopOS();\n }\n\n private supportedScreenOrientation = (screen?.orientation || {}).type ?? (screen as any).mozOrientation ?? (screen as any).msOrientation;\n private safariScreenOrientation: DeviceOrientationType = !screen?.orientation && matchMedia('(orientation: portrait)').matches ? 'portrait-primary' : 'landscape-primary';\n private initialScreenOrientation: DeviceOrientationType = this.supportedScreenOrientation ?? this.safariScreenOrientation ?? 'portrait-primary';\n private screenOrientation: DeviceOrientationType = this.initialScreenOrientation;\n constructor() {\n if (screen.orientation) {\n screen.orientation.addEventListener(\n 'change',\n (ev: Event) => (this.screenOrientation = (ev.target ?? ({} as any)).type as OrientationType)\n );\n }\n }\n\n public isLandscapeOrientation(): boolean {\n return ['landscape-primary', 'landscape-secondary'].includes(this.screenOrientation);\n }\n\n public isPortraitOrientation(): boolean {\n return ['portrait-primary', 'portrait-secondary'].includes(this.screenOrientation);\n }\n\n public getDeviceState(): DeviceState {\n const isDesktop = this.isDesktopDevice;\n const isMobile = this.isMobileDevice();\n const isTablet = this.isTabletDevice();\n const mobileOS: MobileOS | undefined = this.getMobileOS();\n const isAndroidDevice = this.getDeviceOS() === MobileOS.Android;\n const isAppleDevice = this.getDeviceOS() === MobileOS.iOS || this.getDeviceOS() === DesktopOS.MacOS;\n const isUnknownMobileDevice = this.getDeviceOS() === MobileOS.Unknown;\n const desktopOS: DesktopOS | undefined = this.getDesktopOS();\n const isWindowsDesktop = this.getDeviceOS() === DesktopOS.Windows;\n const isLinuxOrUnixDesktop = this.getDeviceOS() === DesktopOS.Linux || this.getDeviceOS() === DesktopOS.Unix;\n\n return {\n isDesktop,\n desktopOS,\n isWindowsDesktop,\n isLinuxOrUnixDesktop,\n isMobile,\n mobileOS,\n isAndroidDevice,\n isAppleDevice,\n isUnknownMobileDevice,\n isTablet,\n isLandscapeOrientation: () => this.isLandscapeOrientation(),\n isPortraitOrientation: () => this.isPortraitOrientation()\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport { WindowDimensions } from '../interfaces/window-dimensions.interface';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class WindowDimensionsService {\n private windowDimensionsSubject = new BehaviorSubject<WindowDimensions>(\n this.getWindowDimensions()\n );\n constructor() {\n this.handleResize();\n window.addEventListener('resize', this.handleResize.bind(this));\n }\n\n public getWindowDimensions(): WindowDimensions {\n return {\n width: window.innerWidth,\n height: window.innerHeight,\n threshold_xs: 360,\n threshold_sm: 640,\n threshold_md: 768,\n threshold_lg: 1024,\n threshold_xl: 1280,\n threshold_2xl: 1536,\n threshold_3xl: 1920,\n threshold_4xl: 2560,\n };\n }\n\n private handleResize(): void {\n this.windowDimensionsSubject.next(this.getWindowDimensions());\n }\n\n public getWindowDimensions$(): Observable<WindowDimensions> {\n return this.windowDimensionsSubject.asObservable();\n }\n}\n","export const SCROLL_LOCK_INSTANCE_IDENTIFIER = 'scroll_lock_instance_';","import { Injectable, inject } from '@angular/core';\nimport { DeviceTypeService } from './device-type.service';\nimport { WindowDimensionsService } from './window-dimension.service';\nimport { IScrollLockConfig } from '../interfaces/scroll-lock-config.interface';\nimport { WindowDimensions } from '../interfaces/window-dimensions.interface';\nimport { SCROLL_LOCK_INSTANCE_IDENTIFIER } from '../constants/scroll-lock.constants';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ScrollLockService {\n private deviceTypeService = inject(DeviceTypeService);\n private windowDimensionSerivce = inject(WindowDimensionsService);\n\n private instanceId: string;\n\n private configurationInstances: Map<string, IScrollLockConfig> = new Map<string, IScrollLockConfig>();\n private windowDimensions: WindowDimensions = {} as WindowDimensions;\n\n constructor() {\n this.instanceId = SCROLL_LOCK_INSTANCE_IDENTIFIER + Math.random().toString(36).substring(2, 9);\n this.windowDimensionSerivce.getWindowDimensions$().subscribe((dimensions) => {\n this.windowDimensions = dimensions;\n });\n }\n\n public ngOnDestroy(): void {\n this.enableScroll();\n }\n\n public disableScroll(config: IScrollLockConfig): void {\n document.body.style.setProperty('overflow', 'hidden', 'important');\n\n const documentWidth = document.documentElement.clientWidth;\n const windowWidth = window.innerWidth;\n const scrollBarWidth = windowWidth - documentWidth;\n document.body.style.paddingRight = scrollBarWidth + 'px';\n document.body.style.setProperty('padding-right', scrollBarWidth + 'px', 'important');\n\n if (config.handleTouchInput !== false) { document.body.style.setProperty('touch-action', 'none', 'important'); }\n\n this.configurationInstances.set(this.instanceId, config);\n\n if (config.mainContainer !== undefined && config.mainContainer.parentElement !== null) {\n let currentNode = config.mainContainer.parentElement as HTMLElement | null;\n while (currentNode !== null) {\n currentNode.style.setProperty('overflow', 'hidden', 'important');\n\n if (config.handleTouchInput !== false) {\n currentNode.addEventListener('touchmove', (event) => this.handleTouchMove(event), { passive: false });\n currentNode.style.setProperty('touch-action', 'none', 'important');\n }\n\n currentNode = currentNode.parentElement;\n }\n }\n\n setTimeout(() => {\n if (config.handleTouchInput !== false) {\n document.body.addEventListener('touchmove', (event) => this.handleTouchMove(event), { passive: false });\n }\n\n if (config.handleExtremeOverflow !== false) {\n const options = { passive: false };\n\n window.addEventListener('wheel', this.preventDefault, options);\n window.addEventListener('mousewheel', this.preventDefault, options);\n window.addEventListener('scroll', this.preventDefault, options);\n window.addEventListener('DOMMouseScroll', this.preventDefault, options);\n }\n }, (config.animationDuration ?? 0) + 10);\n }\n\n public enableScroll(extreme_overflow?: boolean): void {\n document.body.style.removeProperty('overflow');\n document.body.style.removeProperty('padding-right');\n\n let currentConfiguration = this.configurationInstances.get(this.instanceId);\n\n if (currentConfiguration && currentConfiguration.handleTouchInput !== false) {\n document.body.removeEventListener('touchmove', this.handleTouchMove);\n document.body.style.removeProperty('touch-action');\n }\n\n if (currentConfiguration !== undefined && currentConfiguration.mainContainer !== undefined && currentConfiguration.mainContainer.parentElement !== null) {\n let currentNode = currentConfiguration.mainContainer.parentElement as HTMLElement | null;\n while (currentNode !== null) {\n currentNode.style.removeProperty('overflow');\n\n if (currentConfiguration.handleTouchInput !== false) {\n currentNode.removeEventListener('touchmove', this.preventDefault);\n currentNode.style.removeProperty('touch-action');\n }\n\n currentNode = currentNode.parentElement;\n }\n }\n\n this.configurationInstances.delete(this.instanceId);\n\n if (extreme_overflow !== false) {\n window.removeEventListener('wheel', this.preventDefault);\n window.removeEventListener('mousewheel', this.preventDefault);\n window.removeEventListener('scroll', this.preventDefault);\n window.removeEventListener('DOMMouseScroll', this.preventDefault);\n }\n }\n\n private handleTouchMove(event: Event): void {\n const targetNode = event.target as Node;\n const currentConfiguration = this.configurationInstances.get(this.instanceId);\n\n if (!this.isAllowedToScroll(targetNode) && (currentConfiguration === null || currentConfiguration?.handleTouchInput !== false)) {\n if (currentConfiguration === null || currentConfiguration?.mobileOnlyTouchPrevention !== true ||\n (currentConfiguration?.mobileOnlyTouchPrevention === true && ((!this.deviceTypeService.getDeviceState().isMobile || !this.deviceTypeService.getDeviceState().isTablet)\n && (this.windowDimensions.width < this.windowDimensions.threshold_sm)))) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n\n private isAllowedToScroll(targetNode: Node): boolean {\n const currentConfiguration = this.configurationInstances.get(this.instanceId);\n\n if (!currentConfiguration?.allowTouchInputOn || currentConfiguration.allowTouchInputOn.length === 0) { return true; }\n\n if (currentConfiguration.allowTouchInputOn.length === undefined) {\n return (currentConfiguration.allowTouchInputOn as unknown as Element).contains(targetNode);\n }\n\n for (const element of currentConfiguration.allowTouchInputOn) {\n if (element.contains(targetNode)) {\n return true;\n }\n }\n\n return false;\n }\n\n private preventDefault(event: Event): void {\n event.preventDefault();\n event.stopPropagation();\n }\n}\n","export const ITEM_COPY_DEFAULT_SUFFIX = \"Copy\";","import { Injectable } from \"@angular/core\";\nimport { ITEM_COPY_DEFAULT_SUFFIX } from \"../constants/ui-services-common.consants\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class TextFormattingService {\n\n constructor() { }\n\n public generateNameCopy(originalName: string, existingNames: string[] | undefined = undefined, copySuffix: string = ITEM_COPY_DEFAULT_SUFFIX): string {\n const existingNamesToLower = existingNames?.map(item => item.toLowerCase()) ?? [];\n\n let newName = `${originalName} (Copy)`;\n let copyIndex = 2;\n\n while (existingNamesToLower.includes(newName.toLowerCase())) {\n newName = `${originalName} (${copySuffix} ${copyIndex++})`;\n }\n\n return newName;\n }\n\n public formattedDateString(date: Date | string | undefined | null): string | undefined {\n if (!date) return undefined;\n\n const dateObj = (date instanceof Date) ? date : new Date(date);\n return dateObj.toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n }\n}","import { Injectable } from \"@angular/core\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class UiActionsService {\n\n public downloadFile(data: Blob, filename: string, mimeType: string): void {\n const blob = new Blob([data], { type: mimeType });\n const url = window.URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = filename;\n document.body.appendChild(a);\n a.click();\n document.body.removeChild(a);\n window.URL.revokeObjectURL(url);\n }\n}","export function uuidv4() {\n return \"10000000-1000-4000-8000-100000000000\".replace(/[018]/g, (c) => (+c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))).toString(16));\n}\n","/*\n * Public API Surface of common-parts\n */\n\nexport * from './lib/services/device-type.service';\nexport * from './lib/services/scroll-lock.service';\nexport * from './lib/services/text-formatting.service';\nexport * from './lib/services/ui-actions.service';\nexport * from './lib/services/window-dimension.service';\n\nexport * from './lib/constants/ui-services-common.consants';\n\nexport * from './lib/enums/desktop-os.enum';\nexport * from './lib/enums/mobile-os.enum';\n\nexport * from './lib/interfaces/device-state.interface';\nexport * from './lib/interfaces/scroll-lock-config.interface';\nexport * from './lib/interfaces/window-dimensions.interface';\n\nexport * from './lib/types/device.types';\n\nexport * from './lib/helpers/uui4';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;IAAY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACjB,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,SAAA,CAAA,OAAA,CAAA,GAAA,QAAgB;AAChB,IAAA,SAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACvB,CAAC,EANW,SAAS,KAAT,SAAS,GAMpB,EAAA,CAAA,CAAA;;ICNW;AAAZ,CAAA,UAAY,QAAQ,EAAA;AAChB,IAAA,QAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,QAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,QAAA,CAAA,cAAA,CAAA,GAAA,eAA8B;AAClC,CAAC,EALW,QAAQ,KAAR,QAAQ,GAKnB,EAAA,CAAA,CAAA;;MCIY,iBAAiB,CAAA;AACpB,IAAA,SAAS,GAAW,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,IAAK,MAAc,CAAC,KAAK,IAAI,SAAS;AACjG,IAA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AAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;AACjK;;ACFA;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SCROLL_LOCK_INSTANCE_IDENTIFIER = "scroll_lock_instance_";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ITEM_COPY_DEFAULT_SUFFIX = "Copy";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function uuidv4(): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DesktopOS } from "../enums/desktop-os.enum";
|
|
2
|
+
import { MobileOS } from "../enums/mobile-os.enum";
|
|
3
|
+
export interface DeviceState {
|
|
4
|
+
isDesktop: boolean;
|
|
5
|
+
desktopOS: DesktopOS | undefined;
|
|
6
|
+
isWindowsDesktop: boolean;
|
|
7
|
+
isLinuxOrUnixDesktop: boolean;
|
|
8
|
+
isMobile: boolean;
|
|
9
|
+
mobileOS: MobileOS | undefined;
|
|
10
|
+
isAndroidDevice: boolean;
|
|
11
|
+
isAppleDevice: boolean;
|
|
12
|
+
isUnknownMobileDevice: boolean;
|
|
13
|
+
isTablet: boolean;
|
|
14
|
+
isLandscapeOrientation: () => boolean;
|
|
15
|
+
isPortraitOrientation: () => boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface WindowDimensions {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
threshold_xs: number;
|
|
6
|
+
threshold_sm: number;
|
|
7
|
+
threshold_md: number;
|
|
8
|
+
threshold_lg: number;
|
|
9
|
+
threshold_xl: number;
|
|
10
|
+
threshold_2xl: number;
|
|
11
|
+
threshold_3xl: number;
|
|
12
|
+
threshold_4xl: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DeviceState } from '../interfaces/device-state.interface';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class DeviceTypeService {
|
|
4
|
+
private userAgent;
|
|
5
|
+
private isDesktopDevice;
|
|
6
|
+
private isMobileDevice;
|
|
7
|
+
private isTabletDevice;
|
|
8
|
+
private getMobileOS;
|
|
9
|
+
private getDesktopOS;
|
|
10
|
+
private getDeviceOS;
|
|
11
|
+
private supportedScreenOrientation;
|
|
12
|
+
private safariScreenOrientation;
|
|
13
|
+
private initialScreenOrientation;
|
|
14
|
+
private screenOrientation;
|
|
15
|
+
constructor();
|
|
16
|
+
isLandscapeOrientation(): boolean;
|
|
17
|
+
isPortraitOrientation(): boolean;
|
|
18
|
+
getDeviceState(): DeviceState;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DeviceTypeService, never>;
|
|
20
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DeviceTypeService>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IScrollLockConfig } from '../interfaces/scroll-lock-config.interface';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class ScrollLockService {
|
|
4
|
+
private deviceTypeService;
|
|
5
|
+
private windowDimensionSerivce;
|
|
6
|
+
private instanceId;
|
|
7
|
+
private configurationInstances;
|
|
8
|
+
private windowDimensions;
|
|
9
|
+
constructor();
|
|
10
|
+
ngOnDestroy(): void;
|
|
11
|
+
disableScroll(config: IScrollLockConfig): void;
|
|
12
|
+
enableScroll(extreme_overflow?: boolean): void;
|
|
13
|
+
private handleTouchMove;
|
|
14
|
+
private isAllowedToScroll;
|
|
15
|
+
private preventDefault;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScrollLockService, never>;
|
|
17
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ScrollLockService>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class TextFormattingService {
|
|
3
|
+
constructor();
|
|
4
|
+
generateNameCopy(originalName: string, existingNames?: string[] | undefined, copySuffix?: string): string;
|
|
5
|
+
formattedDateString(date: Date | string | undefined | null): string | undefined;
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TextFormattingService, never>;
|
|
7
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<TextFormattingService>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class UiActionsService {
|
|
3
|
+
downloadFile(data: Blob, filename: string, mimeType: string): void;
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UiActionsService, never>;
|
|
5
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<UiActionsService>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { WindowDimensions } from '../interfaces/window-dimensions.interface';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class WindowDimensionsService {
|
|
5
|
+
private windowDimensionsSubject;
|
|
6
|
+
constructor();
|
|
7
|
+
getWindowDimensions(): WindowDimensions;
|
|
8
|
+
private handleResize;
|
|
9
|
+
getWindowDimensions$(): Observable<WindowDimensions>;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WindowDimensionsService, never>;
|
|
11
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<WindowDimensionsService>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DesktopOS } from "../enums/desktop-os.enum";
|
|
2
|
+
import { MobileOS } from "../enums/mobile-os.enum";
|
|
3
|
+
export type DeviceTheme = "light" | "dark";
|
|
4
|
+
export type DeviceOS = DesktopOS | MobileOS;
|
|
5
|
+
export type DeviceOrientationType = 'portrait-primary' | 'landscape-primary' | 'portrait-secondary' | 'landscape-secondary';
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@filip.mazev/common-parts",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^21.1.1",
|
|
6
|
+
"@angular/core": "^21.1.1"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/filip.mazev-common-parts.mjs",
|
|
13
|
+
"typings": "index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./index.d.ts",
|
|
20
|
+
"default": "./fesm2022/filip.mazev-common-parts.mjs"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './lib/services/device-type.service';
|
|
2
|
+
export * from './lib/services/scroll-lock.service';
|
|
3
|
+
export * from './lib/services/text-formatting.service';
|
|
4
|
+
export * from './lib/services/ui-actions.service';
|
|
5
|
+
export * from './lib/services/window-dimension.service';
|
|
6
|
+
export * from './lib/constants/ui-services-common.consants';
|
|
7
|
+
export * from './lib/enums/desktop-os.enum';
|
|
8
|
+
export * from './lib/enums/mobile-os.enum';
|
|
9
|
+
export * from './lib/interfaces/device-state.interface';
|
|
10
|
+
export * from './lib/interfaces/scroll-lock-config.interface';
|
|
11
|
+
export * from './lib/interfaces/window-dimensions.interface';
|
|
12
|
+
export * from './lib/types/device.types';
|
|
13
|
+
export * from './lib/helpers/uui4';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
|
|
3
|
+
$breakpoints: (
|
|
4
|
+
xs: 360px,
|
|
5
|
+
|
|
6
|
+
sm: 640px,
|
|
7
|
+
md: 768px,
|
|
8
|
+
|
|
9
|
+
lg: 1024px,
|
|
10
|
+
xl: 1280px,
|
|
11
|
+
|
|
12
|
+
2xl: 1536px,
|
|
13
|
+
3xl: 1920px,
|
|
14
|
+
4xl: 2560px
|
|
15
|
+
) !default;
|
|
16
|
+
|
|
17
|
+
@mixin respond-up($size) {
|
|
18
|
+
@media (min-width: map.get($breakpoints, $size)) {
|
|
19
|
+
@content;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@mixin respond-down($size) {
|
|
24
|
+
@media (max-width: map.get($breakpoints, $size)) {
|
|
25
|
+
@content;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@mixin respond-between($min, $max) {
|
|
30
|
+
@media (min-width: map.get($breakpoints, $min)) and (max-width: map.get($breakpoints, $max)) {
|
|
31
|
+
@content;
|
|
32
|
+
}
|
|
33
|
+
}
|