@olenbetong/synergi-react 2.3.2 → 2.3.3

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.
@@ -36,5 +36,8 @@ export const DuplicateElementDamage = forwardRef(function DuplicateElementDamage
36
36
  checkDuplicate: () => runDuplicateCheck(),
37
37
  record: record,
38
38
  }));
39
- return (_jsx(DuplicateElementDamageDialog, { open: open, onClose: () => handleOpenChange(false), record: record, onRegisterAnyway: onRegisterAnyway ?? (() => { }), loading: loading ?? false, linkToDamage: linkToDamage }));
39
+ return (_jsx(DuplicateElementDamageDialog, { open: open, onClose: () => {
40
+ setRecord([]);
41
+ handleOpenChange(false);
42
+ }, record: record, onRegisterAnyway: onRegisterAnyway ?? (() => { }), loading: loading ?? false, linkToDamage: linkToDamage }));
40
43
  });
@@ -31,7 +31,7 @@ export function ElementLookup({ value, defaultValue, ref, elementIDRequired = fa
31
31
  useEffect(() => {
32
32
  onDialogChange?.(openElementLookupDialog);
33
33
  }, [openElementLookupDialog]);
34
- return (_jsxs(_Fragment, { children: [_jsx(ElementLookupDialog, { open: openElementLookupDialog, mode: "single", onClose: () => setOpenElementLookupDialog(false), onAdd: handleAddElement, allowEmptyElement: true }), _jsx("input", { type: "hidden", name: "ProjectID", value: elementValue?.ProjectID ?? "" }), _jsx("input", { type: "hidden", name: "ElementRef", value: elementValue?.PrimKey ?? "" }), _jsx(TextField, { id: "NewElementDamge_Project", value: elementValue ? `${elementValue.ProjectID}: ${elementValue.ProjectName}` : "", label: getLocalizedString("Project"), fullWidth: true, required: true, autoComplete: "off", slotProps: { htmlInput: { readOnly: true } } }), _jsx(TextField, { name: "ElementID", id: "NewElementDamage_ElementID", value: elementValue ? elementValue.ElementID : "", label: getLocalizedString("Element ID"), fullWidth: true, required: elementIDRequired, autoComplete: "off", slotProps: {
34
+ return (_jsxs(_Fragment, { children: [_jsx(ElementLookupDialog, { open: openElementLookupDialog, mode: "single", onClose: () => setOpenElementLookupDialog(false), onAdd: handleAddElement, allowEmptyElement: !elementIDRequired }), _jsx("input", { type: "hidden", name: "ProjectID", value: elementValue?.ProjectID ?? "" }), _jsx("input", { type: "hidden", name: "ElementRef", value: elementValue?.PrimKey ?? "" }), _jsx(TextField, { id: "NewElementDamge_Project", value: elementValue ? `${elementValue.ProjectID}: ${elementValue.ProjectName}` : "", label: getLocalizedString("Project"), fullWidth: true, required: true, autoComplete: "off", slotProps: { htmlInput: { readOnly: true } } }), _jsx(TextField, { name: "ElementID", id: "NewElementDamage_ElementID", value: elementValue ? elementValue.ElementID : "", label: getLocalizedString("Element ID"), fullWidth: true, required: elementIDRequired, autoComplete: "off", slotProps: {
35
35
  htmlInput: { readOnly: true },
36
36
  input: {
37
37
  endAdornment: openLookupDialogIcon ? (_jsx(IconButton, { onClick: () => setOpenElementLookupDialog(true), children: _jsx(SearchIcon, {}) })) : undefined,
@@ -5,7 +5,7 @@ import { getLocalizedString } from "@olenbetong/appframe-core";
5
5
  import { useId, useRef, useState } from "react";
6
6
  import { ProjectSelect } from "../../ProjectSelect";
7
7
  import { getElement } from "../getElement";
8
- // const isElementsOnly = /^([a-z]{2,4}[\s]*[0-9]{4,8}[\s,]*)+$/i;
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, }) {
11
11
  let id = useId();
@@ -67,7 +67,5 @@ export function AddElementManualForm({ onAdd, mode, defaultProject, allowEmptyEl
67
67
  alert(error.message);
68
68
  }
69
69
  }
70
- return (_jsxs("form", { id: id, onSubmit: handleSubmit, method: "post", children: [_jsx(Alert, { severity: "warning", sx: { mb: 2 }, children: getLocalizedString("Manually entering elements is a major source of errors. Only use this as a last resort. If the camera or scanner is not working, please contact the IT department.") }), _jsx("input", { type: "hidden", name: "Project", value: project ? JSON.stringify(project) : "" }), _jsx(ProjectSelect, { onChange: (project) => (project ? setProject(project) : setProject(null)), value: project, id: "AddElement_Project" }), _jsx(TextField, { variant: "filled", fullWidth: true, autoComplete: "off", margin: "normal", name: "ElementID", id: "AddElement_ElementID", label: getLocalizedString("Element ID"), value: elementId, onChange: (evt) => setElementId(evt.target.value) }), _jsx(Button, { form: id, ref: buttonRef, color: "primary", variant: "contained", size: "large", type: "submit",
71
- // disabled={!isElementsOnly.test(elementId) || working}
72
- disabled: working, loading: working, loadingPosition: "end", endIcon: _jsx(Add, {}), children: getLocalizedString("Add") })] }));
70
+ return (_jsxs("form", { id: id, onSubmit: handleSubmit, method: "post", children: [_jsx(Alert, { severity: "warning", sx: { mb: 2 }, children: getLocalizedString("Manually entering elements is a major source of errors. Only use this as a last resort. If the camera or scanner is not working, please contact the IT department.") }), _jsx("input", { type: "hidden", name: "Project", value: project ? JSON.stringify(project) : "" }), _jsx(ProjectSelect, { onChange: (project) => (project ? setProject(project) : setProject(null)), value: project, id: "AddElement_Project" }), _jsx(TextField, { variant: "filled", fullWidth: true, autoComplete: "off", margin: "normal", name: "ElementID", id: "AddElement_ElementID", label: getLocalizedString("Element ID"), value: elementId, onChange: (evt) => setElementId(evt.target.value) }), _jsx(Button, { form: id, ref: buttonRef, color: "primary", variant: "contained", size: "large", type: "submit", disabled: (!allowEmptyElement && !isElementsOnly.test(elementId)) || working, loading: working, loadingPosition: "end", endIcon: _jsx(Add, {}), children: getLocalizedString("Add") })] }));
73
71
  }
@@ -7,3 +7,4 @@ export * from "./ElementDamage/RegisterFix.js";
7
7
  export * from "./ElementDamage/SubmitButtons.js";
8
8
  export * from "./ElementLookup.js";
9
9
  export * from "./ElementLookupDialog/index.js";
10
+ export * from "./ProjectSelect.js";
@@ -7,3 +7,4 @@ export * from "./ElementDamage/RegisterFix.js";
7
7
  export * from "./ElementDamage/SubmitButtons.js";
8
8
  export * from "./ElementLookup.js";
9
9
  export * from "./ElementLookupDialog/index.js";
10
+ export * from "./ProjectSelect.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/synergi-react",
3
- "version": "2.3.2",
3
+ "version": "2.3.3",
4
4
  "description": "Standalone React component for SynergiWeb and Partner Portal",
5
5
  "type": "module",
6
6
  "exports": {
@@ -38,7 +38,9 @@
38
38
  "filepond-plugin-image-transform": "^3.8.7",
39
39
  "localforage": "^1.10.0",
40
40
  "mitt": "^3.0.1",
41
- "@olenbetong/appframe-core": "2.11.10"
41
+ "@olenbetong/appframe-core": "2.11.10",
42
+ "@olenbetong/appframe-mui": "6.0.7",
43
+ "@olenbetong/appframe-react": "1.21.21"
42
44
  },
43
45
  "repository": {
44
46
  "type": "git",
@@ -100,7 +100,10 @@ export const DuplicateElementDamage = forwardRef<DuplicateElementDamageHandle, D
100
100
  return (
101
101
  <DuplicateElementDamageDialog
102
102
  open={open}
103
- onClose={() => handleOpenChange(false)}
103
+ onClose={() => {
104
+ setRecord([]);
105
+ handleOpenChange(false);
106
+ }}
104
107
  record={record}
105
108
  onRegisterAnyway={onRegisterAnyway ?? (() => {})}
106
109
  loading={loading ?? false}
@@ -76,7 +76,7 @@ export function ElementLookup({
76
76
  mode="single"
77
77
  onClose={() => setOpenElementLookupDialog(false)}
78
78
  onAdd={handleAddElement}
79
- allowEmptyElement={true}
79
+ allowEmptyElement={!elementIDRequired}
80
80
  />
81
81
 
82
82
  <input type="hidden" name="ProjectID" value={elementValue?.ProjectID ?? ""} />
@@ -6,7 +6,7 @@ import type { ProjectsRecord } from "../../data/dsProjects";
6
6
  import { ProjectSelect } from "../../ProjectSelect";
7
7
  import { type ElementDetails, getElement } from "../getElement";
8
8
 
9
- // const isElementsOnly = /^([a-z]{2,4}[\s]*[0-9]{4,8}[\s,]*)+$/i;
9
+ const isElementsOnly = /^([a-z]{2,4}[\s]*[0-9]{4,8}[\s,]*)+$/i;
10
10
  const matchElements = /([a-z]{2,4}[\s]*[0-9]{4,8})/gi;
11
11
 
12
12
  export type ProjectRecordBase = {
@@ -129,8 +129,7 @@ export function AddElementManualForm({
129
129
  variant="contained"
130
130
  size="large"
131
131
  type="submit"
132
- // disabled={!isElementsOnly.test(elementId) || working}
133
- disabled={working}
132
+ disabled={(!allowEmptyElement && !isElementsOnly.test(elementId)) || working}
134
133
  loading={working}
135
134
  loadingPosition="end"
136
135
  endIcon={<Add />}
@@ -7,3 +7,4 @@ export * from "./ElementDamage/RegisterFix.js";
7
7
  export * from "./ElementDamage/SubmitButtons.js";
8
8
  export * from "./ElementLookup.js";
9
9
  export * from "./ElementLookupDialog/index.js";
10
+ export * from "./ProjectSelect.js";
@@ -1,3 +0,0 @@
1
- export declare const MUI_X_LICENSE_KEY = "2e85521ad276a984ae23b0ff4f90d6f8Tz0xMTI3MjEsRT0xNzc4NDU3NjAwMDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI=";
2
- export declare const DYNAMSOFT_LICENSE_KEY = "f0068MgAAAANxSwGx926/p+panCB/t/lxxtrDYU0d2LFZhFiVZvQGh9fJ6+7AQ2S4w0KrYDE/+MHJO+GJ6I9EOPxRD40/CZE=";
3
- export declare const GOOGLE_MAPS_API_KEY: string;
@@ -1,5 +0,0 @@
1
- export const MUI_X_LICENSE_KEY = "2e85521ad276a984ae23b0ff4f90d6f8Tz0xMTI3MjEsRT0xNzc4NDU3NjAwMDAwLFM9cHJvLExNPXN1YnNjcmlwdGlvbixQVj1RMy0yMDI0LEtWPTI=";
2
- export const DYNAMSOFT_LICENSE_KEY = "f0068MgAAAANxSwGx926/p+panCB/t/lxxtrDYU0d2LFZhFiVZvQGh9fJ6+7AQ2S4w0KrYDE/+MHJO+GJ6I9EOPxRD40/CZE=";
3
- export const GOOGLE_MAPS_API_KEY = process.env.NODE_ENV === "development"
4
- ? "AIzaSyAe-z4UXfbPedkmuAeFtMIdOaeqqgVciQk"
5
- : "AIzaSyDn6aKrA5yoBEwmoRHRgXceMmtZbR2R2xc";