@olenbetong/synergi-react 4.0.0 → 4.1.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/es/components/DateNavigator/index.js +1 -1
- package/es/components/FilePond.js +1 -1
- package/es/components/ImageEditor/ImageEditor.js +1 -1
- package/es/components/ImageEditor/plugins/cropPlugin/CropOverlay.js +1 -1
- package/es/components/ImageEditor/plugins/cropPlugin/CropToolbar.js +1 -1
- package/es/components/ImageEditor/plugins/redactPlugin/RedactToolbar.js +1 -1
- package/es/components/ImageEditor/plugins/zoomPlugin/ZoomControls.js +1 -1
- package/es/components/MergeProgressDialog/index.js +1 -1
- package/es/components/PdfViewer/PdfViewer.js +22 -3
- package/es/components/Toolbar/index.js +1 -1
- package/es/elements/ElementDamage/DamageFormButtons.js +1 -1
- package/es/elements/ElementDamage/DescriptionInput.js +1 -1
- package/es/elements/ElementDamage/DuplicateDamage/DesktopView.js +1 -1
- package/es/elements/ElementDamage/DuplicateDamage/DublicateElementDamageDialog.js +1 -1
- package/es/elements/ElementDamage/DuplicateDamage/PhoneView.js +1 -1
- package/es/elements/ElementDamage/ElementNumberTextField.js +1 -1
- package/es/elements/ElementDamage/RegisterFix.js +1 -1
- package/es/elements/ElementDamage/SubmitButtons.js +1 -1
- package/es/elements/ElementDamage/TransportElementSelect.js +1 -1
- package/es/elements/ElementLookup.js +1 -1
- package/es/elements/ElementLookupDialog/BarcodeScanner/decoders/native.js +1 -1
- package/es/elements/ElementLookupDialog/BarcodeScanner/index.js +1 -1
- package/es/elements/ElementLookupDialog/BarcodeScanner/useScanner.js +1 -1
- package/es/elements/ElementLookupDialog/HIDScanner/index.js +1 -1
- package/es/elements/ElementLookupDialog/Manual/ManualForm.js +1 -1
- package/es/elements/ElementLookupDialog/index.js +1 -1
- package/es/elements/ElementLookupDialog/utils/Giai.js +1 -1
- package/es/elements/ProjectSelect.js +1 -1
- package/es/i18n.d.ts +6 -0
- package/es/i18n.js +10 -0
- package/package.json +7 -7
- package/src/chrome/AppShell/index.tsx +29 -29
- package/src/chrome/openReport.ts +34 -34
- package/src/colorScheme.ts +81 -81
- package/src/components/DateNavigator/index.tsx +186 -186
- package/src/components/FilePond.tsx +312 -312
- package/src/components/ImageEditor/ImageEditor.tsx +343 -343
- package/src/components/ImageEditor/index.ts +9 -9
- package/src/components/ImageEditor/plugins/cropPlugin/CropOverlay.tsx +165 -165
- package/src/components/ImageEditor/plugins/cropPlugin/CropToolbar.tsx +48 -48
- package/src/components/ImageEditor/plugins/cropPlugin/useCropTool.ts +403 -403
- package/src/components/ImageEditor/plugins/redactPlugin/RedactToolbar.tsx +47 -47
- package/src/components/ImageEditor/plugins/zoomPlugin/ZoomContext.tsx +23 -23
- package/src/components/ImageEditor/plugins/zoomPlugin/ZoomControls.tsx +40 -40
- package/src/components/ImageEditor/useEdgeDetection.ts +127 -127
- package/src/components/ImageEditor/useImageHistory.ts +197 -197
- package/src/components/ImageEditor/useOpenCV.ts +184 -184
- package/src/components/LinkedCardList/index.scss +95 -95
- package/src/components/MergeProgressDialog/index.tsx +249 -249
- package/src/components/PageBanner/index.tsx +80 -80
- package/src/components/PdfViewer/PdfViewer.tsx +158 -139
- package/src/components/ProgressBar/index.scss +96 -96
- package/src/components/SplitContainer/index.tsx +333 -333
- package/src/components/Toolbar/index.tsx +212 -212
- package/src/designsystemet-web-types.d.ts +24 -24
- package/src/elements/ElementDamage/DamageFormButtons.tsx +35 -35
- package/src/elements/ElementDamage/DescriptionInput.tsx +120 -120
- package/src/elements/ElementDamage/DuplicateDamage/DesktopView.tsx +82 -82
- package/src/elements/ElementDamage/DuplicateDamage/DublicateElementDamageDialog.tsx +67 -67
- package/src/elements/ElementDamage/DuplicateDamage/PhoneView.tsx +45 -45
- package/src/elements/ElementDamage/ElementNumberTextField.tsx +41 -41
- package/src/elements/ElementDamage/RegisterFix.tsx +100 -100
- package/src/elements/ElementDamage/SubmitButtons.tsx +40 -40
- package/src/elements/ElementDamage/TransportElementSelect.tsx +52 -52
- package/src/elements/ElementLookup.tsx +123 -123
- package/src/elements/ElementLookupDialog/BarcodeScanner/decoder.ts +32 -32
- package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/dbr.ts +118 -118
- package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/native.ts +103 -103
- package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/zxing.ts +95 -95
- package/src/elements/ElementLookupDialog/BarcodeScanner/decoders.test.ts +118 -118
- package/src/elements/ElementLookupDialog/BarcodeScanner/duplicateFilter.ts +21 -21
- package/src/elements/ElementLookupDialog/BarcodeScanner/index.tsx +90 -90
- package/src/elements/ElementLookupDialog/BarcodeScanner/useScanner.ts +280 -280
- package/src/elements/ElementLookupDialog/HIDScanner/index.tsx +67 -67
- package/src/elements/ElementLookupDialog/Manual/ManualForm.tsx +141 -141
- package/src/elements/ElementLookupDialog/index.tsx +226 -226
- package/src/elements/ElementLookupDialog/utils/Giai.ts +209 -209
- package/src/elements/ProjectSelect.tsx +130 -130
- package/src/elements/index.ts +15 -15
- package/src/filter/index.ts +34 -34
- package/src/i18n.ts +13 -0
- package/src/index.ts +77 -77
- package/src/mui/MuiThemeProvider.tsx +174 -174
- package/src/mui/index.ts +1 -1
- package/src/test/setup.ts +8 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "./index.css";
|
|
3
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
4
3
|
import clsx from "clsx";
|
|
5
4
|
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { getLocalizedString } from "../../i18n.js";
|
|
6
6
|
function getUiCulture() {
|
|
7
7
|
return af?.userSession?.culture ?? "default";
|
|
8
8
|
}
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import "filepond-plugin-file-poster/dist/filepond-plugin-file-poster.css";
|
|
3
3
|
import "filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css";
|
|
4
4
|
import "filepond/dist/filepond.css";
|
|
5
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
6
5
|
import { useData, useFetchData } from "@olenbetong/appframe-react";
|
|
7
6
|
import { create, FileStatus, registerPlugin, } from "filepond";
|
|
8
7
|
import FilePondPluginImageExifOrientation from "filepond-plugin-image-exif-orientation";
|
|
@@ -10,6 +9,7 @@ import FilePondPluginImagePreview from "filepond-plugin-image-preview";
|
|
|
10
9
|
import FilePondPluginImageResize from "filepond-plugin-image-resize";
|
|
11
10
|
import FilePondPluginImageTransform from "filepond-plugin-image-transform";
|
|
12
11
|
import { useEffect, useMemo, useRef } from "react";
|
|
12
|
+
import { getLocalizedString } from "../i18n.js";
|
|
13
13
|
export { FileStatus, registerPlugin };
|
|
14
14
|
registerPlugin(FilePondPluginImageExifOrientation, FilePondPluginImageResize, FilePondPluginImagePreview, FilePondPluginImageTransform);
|
|
15
15
|
let isMostLikelyMobile = navigator.userAgent.match(/Android/i) ||
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Spinner, Tooltip } from "@digdir/designsystemet-react";
|
|
3
3
|
import { ArrowCirclepathIcon, ArrowLeftIcon, ArrowRedoIcon, ArrowUndoIcon, CheckmarkIcon } from "@navikt/aksel-icons";
|
|
4
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
4
|
import { forwardRef, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
6
5
|
import "./ImageEditor.css";
|
|
7
6
|
import { ResponsiveButton } from "./ResponsiveButton.js";
|
|
8
7
|
import { useActiveTool } from "./useActiveTool.js";
|
|
9
8
|
import { useImageHistory } from "./useImageHistory.js";
|
|
10
9
|
import { useIsSmall } from "./useIsSmall.js";
|
|
10
|
+
import { getLocalizedString } from "../../i18n.js";
|
|
11
11
|
/**
|
|
12
12
|
* Full-screen image editor shell.
|
|
13
13
|
* Does not know about specific tools — behaviour is entirely driven by the `plugins` prop.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Paragraph, Spinner } from "@digdir/designsystemet-react";
|
|
3
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
4
3
|
import { CropCanvas } from "../../CropCanvas.js";
|
|
5
4
|
import { DragHandle } from "../../DragHandle.js";
|
|
6
5
|
import { EdgeHandle } from "../../EdgeHandle.js";
|
|
7
6
|
import { useZoomLevel } from "../zoomPlugin/ZoomContext.js";
|
|
8
7
|
import { useCropContext } from "./CropContext.js";
|
|
8
|
+
import { getLocalizedString } from "../../../../i18n.js";
|
|
9
9
|
/** Canvas-area overlay for the crop tool. Reads all state from CropContext. */
|
|
10
10
|
export function CropOverlay() {
|
|
11
11
|
let { imageUrl, activeCorners, mode, hasSelection, scale, displaySize, canvasRef, cvReady, cvError, cropping, error, handleCanvasReady, updateCorner, startRectDraw, updateRectDraw, finishRectDraw, } = useCropContext();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Spinner } from "@digdir/designsystemet-react";
|
|
3
3
|
import { CheckmarkIcon, ExpandIcon, SquareIcon, XMarkIcon } from "@navikt/aksel-icons";
|
|
4
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
4
|
import { useCropContext } from "./CropContext.js";
|
|
5
|
+
import { getLocalizedString } from "../../../../i18n.js";
|
|
6
6
|
/** Toolbar shown while the crop tool is active. Reads state from CropContext. */
|
|
7
7
|
export function CropToolbar() {
|
|
8
8
|
let { applyCrop, cropping, mode, hasSelection, startRectMode, cancelRectMode, onApply, onCancel } = useCropContext();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Spinner } from "@digdir/designsystemet-react";
|
|
3
3
|
import { CheckmarkIcon, EraserIcon, XMarkIcon } from "@navikt/aksel-icons";
|
|
4
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
4
|
import { useState } from "react";
|
|
6
5
|
import { useRedactContext } from "./RedactContext.js";
|
|
6
|
+
import { getLocalizedString } from "../../../../i18n.js";
|
|
7
7
|
/** Toolbar shown while the redact tool is active. Reads state from RedactContext. */
|
|
8
8
|
export function RedactToolbar() {
|
|
9
9
|
let { rects, clearAll, applyRedact, onApply, onCancel } = useRedactContext();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ShrinkIcon, ZoomMinusIcon, ZoomPlusIcon } from "@navikt/aksel-icons";
|
|
3
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
4
3
|
import { ResponsiveButton } from "../../ResponsiveButton.js";
|
|
5
4
|
import { useZoom } from "./ZoomContext.js";
|
|
5
|
+
import { getLocalizedString } from "../../../../i18n.js";
|
|
6
6
|
export function ZoomControls({ disabled, isSmall = false }) {
|
|
7
7
|
let { zoom, zoomIn, zoomOut, resetZoom, canZoomIn, canZoomOut, isZoomed } = useZoom();
|
|
8
8
|
return (_jsxs(_Fragment, { children: [_jsx(ResponsiveButton, { icon: _jsx(ZoomMinusIcon, { "aria-hidden": true }), label: getLocalizedString("Zoom out"), onClick: zoomOut, disabled: disabled || !canZoomOut, isSmall: isSmall }), _jsxs("span", { className: "image-editor__zoom-level", children: [Math.round(zoom * 100), "%"] }), _jsx(ResponsiveButton, { icon: _jsx(ZoomPlusIcon, { "aria-hidden": true }), label: getLocalizedString("Zoom in"), onClick: zoomIn, disabled: disabled || !canZoomIn, isSmall: isSmall }), _jsx(ResponsiveButton, { disabled: !isZoomed, icon: _jsx(ShrinkIcon, { "aria-hidden": true }), label: getLocalizedString("Reset zoom"), onClick: resetZoom, isSmall: isSmall })] }));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Button, DialogActions, LinearProgress, Link, Typography } from "@mui/material";
|
|
3
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
4
3
|
import { ResponsiveDialog } from "@olenbetong/appframe-mui";
|
|
5
4
|
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { getLocalizedString } from "../../i18n.js";
|
|
6
6
|
function formatRemaining(ms) {
|
|
7
7
|
if (ms < 60_000)
|
|
8
8
|
return `~${Math.ceil(ms / 1000)}s`;
|
|
@@ -2,9 +2,28 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Document, Page, pdfjs } from "react-pdf";
|
|
4
4
|
import "./PdfViewer.css";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/*
|
|
6
|
+
* pdf.js parses in a Web Worker that must be loaded from a URL on the page's origin. On the
|
|
7
|
+
* 2026 templates pdfjs-dist comes from the platform bundle through the import map, and the
|
|
8
|
+
* platform serves the worker next to it - so resolve the specifier the way the browser does
|
|
9
|
+
* and step up one level. This makes the viewer platform-only: off the platform (a legacy
|
|
10
|
+
* template bundling this package) the specifier does not resolve, pdf.js logs a warning and
|
|
11
|
+
* parses on the main thread. A `new URL(..., import.meta.url)` fallback would make Vite emit
|
|
12
|
+
* the 1.2 MB worker into every consumer's build output without anything ever serving it.
|
|
13
|
+
*/
|
|
14
|
+
function platformWorkerUrl() {
|
|
15
|
+
try {
|
|
16
|
+
return new URL("../pdf.worker.min.js", import.meta.resolve("pdfjs-dist")).toString();
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
console.warn("PdfViewer: pdfjs-dist is not on the page's import map; pdf.js will parse on the main thread.");
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
let workerUrl = platformWorkerUrl();
|
|
24
|
+
if (workerUrl) {
|
|
25
|
+
pdfjs.GlobalWorkerOptions.workerSrc = workerUrl;
|
|
26
|
+
}
|
|
8
27
|
export function PdfViewer({ url, file }) {
|
|
9
28
|
let [numPages, setNumPages] = useState(0);
|
|
10
29
|
let [error, setError] = useState(null);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "./Toolbar.css";
|
|
3
3
|
import { MenuHamburgerIcon } from "@navikt/aksel-icons";
|
|
4
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
4
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
6
5
|
import { createPortal } from "react-dom";
|
|
7
6
|
import { Link } from "react-router";
|
|
7
|
+
import { getLocalizedString } from "../../i18n.js";
|
|
8
8
|
/*
|
|
9
9
|
* The site template (`ob.2026.application`) renders the toolbar and leaves two regions to the
|
|
10
10
|
* app. Both are filled through portals, so the app's React tree (router, contexts, state) is
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Add from "@mui/icons-material/Add";
|
|
3
3
|
import { Button } from "@mui/material";
|
|
4
|
-
import { getLocalizedString } from "
|
|
4
|
+
import { getLocalizedString } from "../../i18n.js";
|
|
5
5
|
export function DamageFormButtons({ isEdit, loading, uploadingFile, handleDelete, handleCancel, }) {
|
|
6
6
|
return (_jsxs(_Fragment, { children: [isEdit && _jsx(Button, { onClick: handleDelete, children: getLocalizedString("Delete") }), _jsx(Button, { onClick: handleCancel, children: getLocalizedString("Cancel") }), _jsx(Button, { loading: loading || uploadingFile, loadingPosition: "start", startIcon: _jsx(Add, {}), type: "submit", variant: "contained", children: isEdit ? getLocalizedString("Save changes") : getLocalizedString("Register damage") })] }));
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Autocomplete, Button, TextField } from "@mui/material";
|
|
3
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
4
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { getLocalizedString } from "../../i18n.js";
|
|
5
5
|
export function DescriptionInput({ value, defaultValue, descriptionOptions = [
|
|
6
6
|
getLocalizedString("Tear in element"),
|
|
7
7
|
getLocalizedString("Damage around lifting anchor"),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Grid, Typography } from "@mui/material";
|
|
3
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
4
3
|
import { Link } from "@olenbetong/appframe-mui";
|
|
4
|
+
import { getLocalizedString } from "../../../i18n.js";
|
|
5
5
|
function SummaryItem({ col, label, children, em, align, padding }) {
|
|
6
6
|
return (_jsxs(Grid, { size: col, sx: { p: padding ?? 2, borderBottom: (t) => `1px solid ${t.palette.divider}` }, children: [label && (_jsx(Typography, { variant: "body1", sx: { fontSize: "0.9rem", fontWeight: 500, mb: 1, textAlign: align }, children: getLocalizedString(label) })), children && (_jsx(Typography, { sx: {
|
|
7
7
|
fontSize: em ? "1.4rem" : "0.9rem",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Add from "@mui/icons-material/Add";
|
|
3
3
|
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Grid, useMediaQuery } from "@mui/material";
|
|
4
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
4
|
import { theme } from "@olenbetong/appframe-mui";
|
|
6
5
|
import { ElementDamagesHeader, ElementDamagesItem } from "./DesktopView";
|
|
7
6
|
import { DuplicatePhoneViewItem } from "./PhoneView";
|
|
7
|
+
import { getLocalizedString } from "../../../i18n.js";
|
|
8
8
|
export function DuplicateElementDamageDialog({ open, onClose, record, onRegisterAnyway, loading, linkToDamage, }) {
|
|
9
9
|
let matches = useMediaQuery(theme.breakpoints.up("lg"));
|
|
10
10
|
let backgroundColor = "#e9ebee";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Card, CardContent, Typography } from "@mui/material";
|
|
3
|
-
import { getLocalizedString } from "
|
|
3
|
+
import { getLocalizedString } from "../../../i18n.js";
|
|
4
4
|
export function DuplicatePhoneViewItem({ record, linkToDamage }) {
|
|
5
5
|
return (_jsx(Card, { variant: "outlined", onClick: () => {
|
|
6
6
|
if (linkToDamage) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { TextField } from "@mui/material";
|
|
3
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
4
3
|
import { useEffect, useState } from "react";
|
|
4
|
+
import { getLocalizedString } from "../../i18n.js";
|
|
5
5
|
export function ElementNumberTextField({ value, defaultValue, onChange, disabled, sx }) {
|
|
6
6
|
let [elementNumber, setElementNumber] = useState(defaultValue ?? "");
|
|
7
7
|
let elementNumberValue = value === undefined ? elementNumber : value;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import CheckIcon from "@mui/icons-material/Check";
|
|
3
3
|
import { Button, Checkbox, FormControlLabel, Typography } from "@mui/material";
|
|
4
|
-
import { getLocalizedString, localize } from "@olenbetong/appframe-core";
|
|
5
4
|
import { useEffect, useRef, useState } from "react";
|
|
6
5
|
import { procApproveDamage } from "../data";
|
|
6
|
+
import { getLocalizedString, localize } from "../../i18n.js";
|
|
7
7
|
const formatter = new Intl.DateTimeFormat(af.userSession.culture, {
|
|
8
8
|
day: "numeric",
|
|
9
9
|
month: "long",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Add from "@mui/icons-material/Add";
|
|
3
3
|
import { Box, Button } from "@mui/material";
|
|
4
|
-
import { getLocalizedString } from "
|
|
4
|
+
import { getLocalizedString } from "../../i18n.js";
|
|
5
5
|
export function SubmitButtons({ edit, loading, onDelete, onCancel, onSubmit, sx }) {
|
|
6
6
|
return (_jsxs(Box, { sx: { display: "flex", flexWrap: "wrap", gap: 2, justifyContent: "flex-end", ...sx }, children: [edit && _jsx(Button, { onClick: onDelete, children: getLocalizedString("Delete") }), _jsx(Button, { onClick: onCancel, children: getLocalizedString("Cancel") }), _jsx(Button, { loading: loading, loadingPosition: "start", startIcon: _jsx(Add, {}), type: "submit", variant: "contained", onClick: onSubmit, children: edit ? getLocalizedString("Save changes") : getLocalizedString("Register damage") })] }));
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import DropDownArrowIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
3
3
|
import { Button, ListItemText, Menu, MenuItem } from "@mui/material";
|
|
4
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
4
|
import { useState } from "react";
|
|
5
|
+
import { getLocalizedString } from "../../i18n.js";
|
|
6
6
|
export function TransportElementSelect({ elements, onSelect }) {
|
|
7
7
|
let [anchorEl, setAnchorEl] = useState(null);
|
|
8
8
|
let open = !!anchorEl;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import SearchIcon from "@mui/icons-material/Search";
|
|
3
3
|
import { IconButton, TextField } from "@mui/material";
|
|
4
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
4
|
import { useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
6
5
|
import { ElementLookupDialog } from "./ElementLookupDialog";
|
|
6
|
+
import { getLocalizedString } from "../i18n.js";
|
|
7
7
|
export function ElementLookup({ value, defaultValue, ref, elementIDRequired = false, openLookupDialogIcon, onChange, onDialogChange, decoder, scannerActions, }) {
|
|
8
8
|
let initializedRef = useRef(false);
|
|
9
9
|
let [openElementLookupDialog, setOpenElementLookupDialog] = useState(false);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import SwitchCameraOutlined from "@mui/icons-material/SwitchCameraOutlined";
|
|
3
3
|
import { Box, IconButton, Typography } from "@mui/material";
|
|
4
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
4
|
import { useRef } from "react";
|
|
6
5
|
import { ErrorIcon } from "./Error";
|
|
7
6
|
import { useScanner } from "./useScanner";
|
|
7
|
+
import { getLocalizedString } from "../../../i18n.js";
|
|
8
8
|
export { createDbrDecoder } from "./decoders/dbr";
|
|
9
9
|
export { createNativeDecoder, isNativeDecoderAvailable } from "./decoders/native";
|
|
10
10
|
export { createZxingDecoder } from "./decoders/zxing";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
2
1
|
import { useEffect, useRef, useState } from "react";
|
|
3
2
|
import { createZxingDecoder } from "./decoders/zxing";
|
|
4
3
|
import { createDuplicateFilter } from "./duplicateFilter";
|
|
4
|
+
import { getLocalizedString } from "../../../i18n.js";
|
|
5
5
|
/** Longest side of the frame handed to the decoder. Larger frames cost decode time without helping DataMatrix reads. */
|
|
6
6
|
const MAX_FRAME_SIDE = 720;
|
|
7
7
|
/** Minimum time between two decode attempts. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "./index.css";
|
|
3
3
|
import { Box, Button } from "@mui/material";
|
|
4
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
4
|
import { useEffect, useRef, useState } from "react";
|
|
6
5
|
import { useHIDScanner } from "./useHIDScanner";
|
|
6
|
+
import { getLocalizedString } from "../../../i18n.js";
|
|
7
7
|
export function AddElementHIDScanner({ onScan }) {
|
|
8
8
|
let [enabled, setEnabled] = useState(false);
|
|
9
9
|
let root = useRef(null);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Add from "@mui/icons-material/Add";
|
|
3
3
|
import { Alert, Button, TextField } from "@mui/material";
|
|
4
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
5
4
|
import { useId, useRef, useState } from "react";
|
|
6
5
|
import { ProjectSelect } from "../../ProjectSelect";
|
|
7
6
|
import { getElement } from "../getElement";
|
|
7
|
+
import { getLocalizedString } from "../../../i18n.js";
|
|
8
8
|
const isElementsOnly = /^([a-z]{2,4}[\s]*[0-9]{4,8}[\s,]*)+$/i;
|
|
9
9
|
const matchElements = /([a-z]{2,4}[\s]*[0-9]{4,8})/gi;
|
|
10
10
|
export function AddElementManualForm({ onAdd, mode, defaultProject, allowEmptyElement = false, }) {
|
|
@@ -5,7 +5,6 @@ import Edit from "@mui/icons-material/Edit";
|
|
|
5
5
|
import QrCodeScanner from "@mui/icons-material/QrCodeScanner";
|
|
6
6
|
import TapAndPlay from "@mui/icons-material/TapAndPlay";
|
|
7
7
|
import { Alert, Box, Button, DialogActions, List, ListItem, ListItemText, Tab, Tabs } from "@mui/material";
|
|
8
|
-
import { getLocalizedString, localize } from "@olenbetong/appframe-core";
|
|
9
8
|
import { ResponsiveDialog } from "@olenbetong/appframe-mui";
|
|
10
9
|
import { useEffect, useState } from "react";
|
|
11
10
|
import { flushSync } from "react-dom";
|
|
@@ -15,6 +14,7 @@ import { AddElementHIDScanner } from "./HIDScanner";
|
|
|
15
14
|
import { AddElementManualForm } from "./Manual/ManualForm";
|
|
16
15
|
import { useBeeper } from "./utils/beep";
|
|
17
16
|
import Giai from "./utils/Giai";
|
|
17
|
+
import { getLocalizedString, localize } from "../../i18n.js";
|
|
18
18
|
export function ElementLookupDialog(props) {
|
|
19
19
|
let { open, onClose, initialTab, decoder, scannerActions } = props;
|
|
20
20
|
let [tab, setTab] = useState("camera");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Autocomplete, ListItem, ListItemText, TextField } from "@mui/material";
|
|
3
|
-
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
4
3
|
import { useDataWithFilter, useDebounce } from "@olenbetong/appframe-react";
|
|
5
4
|
import { useMemo, useRef, useState } from "react";
|
|
6
5
|
import { dsProjects } from "./data/dsProjects";
|
|
7
6
|
import { dsReportProjects } from "./data/dsReportProjects";
|
|
7
|
+
import { getLocalizedString } from "../i18n.js";
|
|
8
8
|
export function ProjectSelect({ className, disabled, id, names, onChange, readOnly, required, defaultValue, value, label, sx, report, }) {
|
|
9
9
|
let [selected, setSelected] = useState(defaultValue ?? null);
|
|
10
10
|
let [query, setQuery] = useState("");
|
package/es/i18n.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PROJECT = "synergi-react";
|
|
2
|
+
export declare const getLocalizedString: {
|
|
3
|
+
(string: undefined | null): undefined | null;
|
|
4
|
+
(string: string): string;
|
|
5
|
+
(string: string, wait: true): Promise<string>;
|
|
6
|
+
}, localize: (stringParts: TemplateStringsArray, ...args: unknown[]) => string;
|
package/es/i18n.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The package's strings live in their own globalization project, `synergi-react`, so one
|
|
3
|
+
* translation covers every app and the package can word a term its own way. The templates
|
|
4
|
+
* render the dictionary as af.i18n["synergi-react"]; on a page that does not (a legacy
|
|
5
|
+
* template) the localizer falls back to the article's strings, exactly as before. See
|
|
6
|
+
* `createLocalizer` in @olenbetong/appframe-core.
|
|
7
|
+
*/
|
|
8
|
+
import { createLocalizer } from "@olenbetong/appframe-core";
|
|
9
|
+
export const PROJECT = "synergi-react";
|
|
10
|
+
export const { getLocalizedString, localize } = createLocalizer(PROJECT);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olenbetong/synergi-react",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "Standalone React component for SynergiWeb and Partner Portal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
"filepond-plugin-image-transform": "^3.8.8",
|
|
49
49
|
"localforage": "^1.10.0",
|
|
50
50
|
"mitt": "^3.0.1",
|
|
51
|
-
"pdf-lib": "
|
|
51
|
+
"pdf-lib": "1.17.1",
|
|
52
52
|
"pdfjs-dist": "5.7.284",
|
|
53
53
|
"react": "19.3.0",
|
|
54
54
|
"react-dom": "19.3.0",
|
|
55
|
-
"react-pdf": "
|
|
55
|
+
"react-pdf": "10.5.0",
|
|
56
56
|
"zxing-wasm": "3.1.4",
|
|
57
57
|
"@olenbetong/appframe-core": "2.14.0",
|
|
58
|
-
"@olenbetong/appframe-
|
|
58
|
+
"@olenbetong/appframe-react": "2.2.1",
|
|
59
59
|
"@olenbetong/appframe-data": "1.7.2",
|
|
60
60
|
"@olenbetong/appframe-mui": "7.0.3",
|
|
61
|
-
"@olenbetong/appframe-
|
|
61
|
+
"@olenbetong/appframe-ds": "1.2.0"
|
|
62
62
|
},
|
|
63
63
|
"repository": {
|
|
64
64
|
"type": "git",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
]
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@digdir/designsystemet-react": "1.
|
|
75
|
+
"@digdir/designsystemet-react": "1.22.0",
|
|
76
76
|
"@navikt/aksel-icons": "8.16.2",
|
|
77
|
-
"@testing-library/dom": "^10.4.
|
|
77
|
+
"@testing-library/dom": "^10.4.2",
|
|
78
78
|
"@testing-library/jest-dom": "^7.0.1",
|
|
79
79
|
"@testing-library/react": "16.3.3",
|
|
80
80
|
"@testing-library/user-event": "^14.6.7",
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { AppErrorBoundary } from "@olenbetong/appframe-ds";
|
|
2
|
-
import type { ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
export type AppShellProps = {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Standard Synergi app shell: the error boundary around the app.
|
|
10
|
-
*
|
|
11
|
-
* The site chrome (app menu, user menu, colour scheme, service worker update)
|
|
12
|
-
* is no longer part of the app. It is rendered by the `@olenbetong/synergi-chrome`
|
|
13
|
-
* bundle the `ob.2026.application` template loads, which marks the page with
|
|
14
|
-
* `<html data-ob-chrome="1">`. Toolbar slots stay app owned through
|
|
15
|
-
* `ToolbarPortal` and `ToolbarBreadcrumbs`.
|
|
16
|
-
*
|
|
17
|
-
* This component is Designsystemet-only. Apps that still render MUI components
|
|
18
|
-
* should additionally wrap it in `MuiThemeProvider` from
|
|
19
|
-
* `@olenbetong/synergi-react/mui`, which bridges the Designsystemet colour
|
|
20
|
-
* tokens into a MUI theme.
|
|
21
|
-
*/
|
|
22
|
-
export function AppShell({ children }: AppShellProps) {
|
|
23
|
-
return <AppErrorBoundary>{children}</AppErrorBoundary>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Whether the page's template loaded the site chrome (`<html data-ob-chrome="1">`). */
|
|
27
|
-
export function hasSiteChrome() {
|
|
28
|
-
return typeof document !== "undefined" && document.documentElement.dataset.obChrome !== undefined;
|
|
29
|
-
}
|
|
1
|
+
import { AppErrorBoundary } from "@olenbetong/appframe-ds";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export type AppShellProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Standard Synergi app shell: the error boundary around the app.
|
|
10
|
+
*
|
|
11
|
+
* The site chrome (app menu, user menu, colour scheme, service worker update)
|
|
12
|
+
* is no longer part of the app. It is rendered by the `@olenbetong/synergi-chrome`
|
|
13
|
+
* bundle the `ob.2026.application` template loads, which marks the page with
|
|
14
|
+
* `<html data-ob-chrome="1">`. Toolbar slots stay app owned through
|
|
15
|
+
* `ToolbarPortal` and `ToolbarBreadcrumbs`.
|
|
16
|
+
*
|
|
17
|
+
* This component is Designsystemet-only. Apps that still render MUI components
|
|
18
|
+
* should additionally wrap it in `MuiThemeProvider` from
|
|
19
|
+
* `@olenbetong/synergi-react/mui`, which bridges the Designsystemet colour
|
|
20
|
+
* tokens into a MUI theme.
|
|
21
|
+
*/
|
|
22
|
+
export function AppShell({ children }: AppShellProps) {
|
|
23
|
+
return <AppErrorBoundary>{children}</AppErrorBoundary>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Whether the page's template loaded the site chrome (`<html data-ob-chrome="1">`). */
|
|
27
|
+
export function hasSiteChrome() {
|
|
28
|
+
return typeof document !== "undefined" && document.documentElement.dataset.obChrome !== undefined;
|
|
29
|
+
}
|
package/src/chrome/openReport.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export type OpenReportOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* Overrides the filter the report was designed with, as a criteria string.
|
|
4
|
-
* An empty string starts the launcher with no filter at all.
|
|
5
|
-
*/
|
|
6
|
-
initialFilter?: string | null;
|
|
7
|
-
/** The tab shown first. */
|
|
8
|
-
defaultTab?: "parameters" | "filter";
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
type ChromeWithReports = {
|
|
12
|
-
openReport?: (reportId: string, options?: OpenReportOptions) => void;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Opens a report in the site chrome's report launcher, the way the app menu does.
|
|
17
|
-
*
|
|
18
|
-
* The launcher lives in the `@olenbetong/synergi-chrome` bundle the 2026 templates load,
|
|
19
|
-
* so an app never bundles it; this only forwards to `window.ob.chrome.openReport`.
|
|
20
|
-
* On a page without the chrome (a legacy template) the call is logged and ignored.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* openReport("arpt_Production_ElementsDaily", { initialFilter: `[ProjectID] = '${projectId}'` });
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export function openReport(reportId: string, options?: OpenReportOptions) {
|
|
28
|
-
let chrome = (globalThis as { ob?: { chrome?: ChromeWithReports } }).ob?.chrome;
|
|
29
|
-
if (chrome?.openReport) {
|
|
30
|
-
chrome.openReport(reportId, options);
|
|
31
|
-
} else {
|
|
32
|
-
console.warn(`openReport(${reportId}): the site chrome is not on this page, so there is no report launcher.`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
export type OpenReportOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Overrides the filter the report was designed with, as a criteria string.
|
|
4
|
+
* An empty string starts the launcher with no filter at all.
|
|
5
|
+
*/
|
|
6
|
+
initialFilter?: string | null;
|
|
7
|
+
/** The tab shown first. */
|
|
8
|
+
defaultTab?: "parameters" | "filter";
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type ChromeWithReports = {
|
|
12
|
+
openReport?: (reportId: string, options?: OpenReportOptions) => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Opens a report in the site chrome's report launcher, the way the app menu does.
|
|
17
|
+
*
|
|
18
|
+
* The launcher lives in the `@olenbetong/synergi-chrome` bundle the 2026 templates load,
|
|
19
|
+
* so an app never bundles it; this only forwards to `window.ob.chrome.openReport`.
|
|
20
|
+
* On a page without the chrome (a legacy template) the call is logged and ignored.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* openReport("arpt_Production_ElementsDaily", { initialFilter: `[ProjectID] = '${projectId}'` });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function openReport(reportId: string, options?: OpenReportOptions) {
|
|
28
|
+
let chrome = (globalThis as { ob?: { chrome?: ChromeWithReports } }).ob?.chrome;
|
|
29
|
+
if (chrome?.openReport) {
|
|
30
|
+
chrome.openReport(reportId, options);
|
|
31
|
+
} else {
|
|
32
|
+
console.warn(`openReport(${reportId}): the site chrome is not on this page, so there is no report launcher.`);
|
|
33
|
+
}
|
|
34
|
+
}
|