- Field Restriction:
- when a restriction has been set, the {lafi} is hidden, it shows
- only when the [Layer,Field,Value] got matched; if there are more
- than one setting, the {lafi} shows when one of them got matched.
-
-
- available field type:
- checkbox (true/false), select, text
+
+
+ Restriction:
+ When a restriction is set, the {lafi} is hidden and will be only
+ displayed when the [Layer,Field,Value] criteria are met.{' '}
+ Match [One of them], [All of them], or [None of them].
+
+ Restriction on Field: When a restriction is set to `Match
+ One`, an alternative display name can be set for the field via
+ `Display as`. Please note that `Display as` is only effective
+ when a restriction is `Match One`.
+
+ available field type:
+ Checkbox (true/false), Select, Text
+
+
+
+
+ Match One
+
+
+ Match All
+
+
+ Match None
+
+
+
layer,
fieldObject,
fnChange,
- label: 'Has its own line',
field: 'hasOwnRow',
});
@@ -171,7 +168,6 @@ export const renderRequired = ({ layer, fieldObject, fnChange }) =>
layer,
fieldObject,
fnChange,
- label: 'Required',
field: 'required',
})
: null;
@@ -182,7 +178,6 @@ export const renderReadonly = ({ layer, fieldObject, fnChange }) =>
layer,
fieldObject,
fnChange,
- label: 'Readonly',
field: 'readonly',
note: "When in 'Read-Only' mode, it displays as plain text with a placeholder if available.",
})
diff --git a/src/components/elements/GenericSubField.js b/src/components/elements/GenericSubField.js
index 49725cb..c60fd0d 100644
--- a/src/components/elements/GenericSubField.js
+++ b/src/components/elements/GenericSubField.js
@@ -3,8 +3,12 @@ import { v4 as uuid } from 'uuid';
export default class GenericSubField {
constructor(args) {
Object.assign(this, args);
- if (!this.id) { this.id = GenericSubField.buildID(); }
+ if (!this.id) {
+ this.id = GenericSubField.buildID();
+ }
}
- static buildID() { return uuid(); }
+ static buildID() {
+ return uuid();
+ }
}
diff --git a/src/components/elements/GroupFields.js b/src/components/elements/GroupFields.js
index 09cb57c..5c8b318 100644
--- a/src/components/elements/GroupFields.js
+++ b/src/components/elements/GroupFields.js
@@ -183,12 +183,12 @@ export default class GroupFields extends React.Component {
const sub = field.sub_fields || [];
return (
-
+ {/*
Input Group:
define the fields which are grouped together and display as one field;
note: 'System-Defined' represents the Unit field which
has one input field and one unit converter.
-
+
*/}
-
+ {/*
Table:
define a table with the column type as{' '}
drag_molecule, drag_sample(only available
@@ -246,7 +246,7 @@ export default class TableDef extends React.Component {
note: drag_sample stands for Sample and contains at least its
image and short label information; system-defined represents
the unit field, which has an input field and a unit converter.
-
+
*/}
-
+ {/*
Text-Formula:
select the text fields which are combined together with separator
-
{
{
+ // Find the index of the current unit in the units array
+ const currentIndex = units.findIndex(unit => unit.key === currentUnit);
+
+ // If the unit is not found, throw an error
+ if (currentIndex === -1) return null;
+
+ // Get the next index, wrapping around to 0 if we're at the end of the array
+ const nextIndex = (currentIndex + 1) % units.length;
+
+ // Return the object of the next unit
+ return units[nextIndex];
+};
+
+const convertUnits = (fromUnit, toUnit, value, units) => {
+ // Find the 'from' and 'to' units in the units array
+ const from = units.find(unit => unit.key === fromUnit);
+ const to = units.find(unit => unit.key === toUnit);
+
+ // If either unit is not found, throw an error
+ if (!from || !to) return null;
+
+ // Convert the value from the 'from' unit to the 'to' unit
+ const result = value * (from.nm / to.nm);
+ return parseFloat(result.toFixed(5));
+};
+
+const PopUnits = (si = []) => {
+ const tbl = si.units.map(e => (
+