inviton-powerduck 0.0.331 → 0.0.333
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/app/powerduck-system-resources.ts +1 -0
- package/common/extensions/temporal-extensions.ts +1 -0
- package/common/utils/file-helper.ts +19 -3
- package/common/utils/temporal-utils.ts +1 -0
- package/common/utils/upload-image-helper.ts +8 -1
- package/components/datatable/css/datatable.css +5 -1
- package/components/dropdown/index.tsx +2107 -2106
- package/components/input/gps-bounding-box.tsx +5 -0
- package/components/input/gps-input.tsx +7 -0
- package/components/input/numeric-input.tsx +81 -0
- package/components/open-street-map/open-street-map.tsx +159 -38
- package/components/spreadsheet/spreadsheet-data.ts +53 -0
- package/components/spreadsheet/spreadsheet.tsx +29 -9
- package/package.json +2 -2
|
@@ -3,16 +3,32 @@ import PowerduckState from '../../app/powerduck-state';
|
|
|
3
3
|
import { AppHttpProvider } from '../api-http';
|
|
4
4
|
import { DomainHelper } from './domain-helper';
|
|
5
5
|
|
|
6
|
+
const ABSOLUTE_URL_RE = /^https?:\/\//i;
|
|
7
|
+
const LEADING_SLASH_ABSOLUTE_RE = /^\/https?:\/\//i;
|
|
8
|
+
|
|
6
9
|
export default class FileHelper {
|
|
7
10
|
static getFullPath(file: Photo) {
|
|
8
|
-
if (file == null) {
|
|
11
|
+
if (file == null || file.path == null) {
|
|
9
12
|
return null;
|
|
10
13
|
}
|
|
11
14
|
|
|
15
|
+
const rawPath = file.path.trim();
|
|
16
|
+
|
|
17
|
+
// 1. Already-absolute URL (Bunny CDN, S3, data:, protocol-relative) — return as-is.
|
|
18
|
+
if (ABSOLUTE_URL_RE.test(rawPath) || rawPath.startsWith('//') || rawPath.startsWith('data:')) {
|
|
19
|
+
return rawPath;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// 2. Stray leading-slash before scheme ("/https://..."): strip the slash.
|
|
23
|
+
if (LEADING_SLASH_ABSOLUTE_RE.test(rawPath)) {
|
|
24
|
+
return rawPath.slice(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 3. Legacy relative path (e.g. "/photos/resorts/file.png") — resolve against backend domain.
|
|
12
28
|
if (AppHttpProvider.enforceDomain == '/') {
|
|
13
|
-
return PowerduckState.getCdnPath() + PowerduckState.getFilesPath() +
|
|
29
|
+
return PowerduckState.getCdnPath() + PowerduckState.getFilesPath() + rawPath;
|
|
14
30
|
}
|
|
15
31
|
|
|
16
|
-
return DomainHelper.getDomainFromUrl(AppHttpProvider.enforceDomain, true) + PowerduckState.getFilesPath() +
|
|
32
|
+
return DomainHelper.getDomainFromUrl(AppHttpProvider.enforceDomain, true) + PowerduckState.getFilesPath() + rawPath;
|
|
17
33
|
}
|
|
18
34
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ImageResponse, OnUploadImageResponse } from '../../data/image';
|
|
2
2
|
import { globalState } from '../../app/global-state';
|
|
3
3
|
import PowerduckState from '../../app/powerduck-state';
|
|
4
|
+
import NotificationProvider from '../../components/ui/notification';
|
|
4
5
|
import { AppHttpProvider } from '../api-http';
|
|
5
6
|
import { BrowserImageCompression } from './broswer-image-compression';
|
|
6
7
|
import { isNullOrEmpty } from './is-null-or-empty';
|
|
@@ -25,7 +26,7 @@ export class UploadImageHelper {
|
|
|
25
26
|
disableCompression: boolean = false,
|
|
26
27
|
compressionMaxMb: number = 0.5,
|
|
27
28
|
url?: string,
|
|
28
|
-
): Promise<ImageResponse> {
|
|
29
|
+
): Promise<ImageResponse | null> {
|
|
29
30
|
if (!(disableCompression || file.type == 'image/svg+xml')) {
|
|
30
31
|
file = await BrowserImageCompression.compress(file, {
|
|
31
32
|
maxSizeMB: compressionMaxMb,
|
|
@@ -49,6 +50,12 @@ export class UploadImageHelper {
|
|
|
49
50
|
credentials: UploadImageHelperConfig.includeCredentials ? PowerduckState.getIsDebugMode() ? 'include' : 'same-origin' : 'omit',
|
|
50
51
|
});
|
|
51
52
|
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
NotificationProvider.showErrorMessage(PowerduckState.getResourceValue('uploadFailed'));
|
|
55
|
+
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
52
59
|
return (await response.json()) as ImageResponse;
|
|
53
60
|
}
|
|
54
61
|
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
position: relative;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
/* Direct-child selector — without `>`, this rule leaks into any nested
|
|
14
|
+
<table> inside a cell (e.g. the date-range picker's month tables), forcing
|
|
15
|
+
them to min-width: 100% of the DataTable container and breaking their
|
|
16
|
+
layout. Only the DataTable's own root <table> needs this styling. */
|
|
17
|
+
.dt-table.dt-table-mode > table {
|
|
14
18
|
position: relative;
|
|
15
19
|
border-collapse: collapse;
|
|
16
20
|
min-width: 100%;
|