@mcurros2/microm 1.1.294-0 → 1.1.296-0
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34558,6 +34558,7 @@ function $1e0694bb407199c5$export$cf48e8dd7daeb58f({ entityForm: entityForm, ent
|
|
|
34558
34558
|
const [rawValue, setRawValue] = (0, $b4te3$react.useState)('');
|
|
34559
34559
|
const dirty = (0, $b4te3$react.useRef)(false);
|
|
34560
34560
|
const looking = (0, $b4te3$react.useRef)(false);
|
|
34561
|
+
const lastValidLookup = (0, $b4te3$react.useRef)();
|
|
34561
34562
|
const significantColumn = bindingColumns[bindingColumns.length - 1];
|
|
34562
34563
|
const bindingColumnsKey = bindingColumns.join('\u0000');
|
|
34563
34564
|
const context = (0, $b4te3$react.useMemo)(()=>{
|
|
@@ -34647,6 +34648,19 @@ function $1e0694bb407199c5$export$cf48e8dd7daeb58f({ entityForm: entityForm, ent
|
|
|
34647
34648
|
significantColumn
|
|
34648
34649
|
]);
|
|
34649
34650
|
const executeDescriptionLookup = (0, $b4te3$react.useCallback)(async (values)=>{
|
|
34651
|
+
const normalizedValues = values.map((value)=>value?.toString() ?? '');
|
|
34652
|
+
const cached = lastValidLookup.current;
|
|
34653
|
+
if (cached && cached.values.length === normalizedValues.length && cached.values.every((value, index)=>value === normalizedValues[index])) {
|
|
34654
|
+
setStatus({
|
|
34655
|
+
data: {
|
|
34656
|
+
description: cached.description
|
|
34657
|
+
}
|
|
34658
|
+
});
|
|
34659
|
+
return {
|
|
34660
|
+
description: cached.description,
|
|
34661
|
+
errorDescription: undefined
|
|
34662
|
+
};
|
|
34663
|
+
}
|
|
34650
34664
|
try {
|
|
34651
34665
|
setStatus({
|
|
34652
34666
|
loading: true
|
|
@@ -34659,6 +34673,10 @@ function $1e0694bb407199c5$export$cf48e8dd7daeb58f({ entityForm: entityForm, ent
|
|
|
34659
34673
|
description: description
|
|
34660
34674
|
}
|
|
34661
34675
|
});
|
|
34676
|
+
if (description) lastValidLookup.current = {
|
|
34677
|
+
values: normalizedValues,
|
|
34678
|
+
description: description
|
|
34679
|
+
};
|
|
34662
34680
|
return {
|
|
34663
34681
|
description: description,
|
|
34664
34682
|
errorDescription: undefined
|
|
@@ -34740,6 +34758,11 @@ function $1e0694bb407199c5$export$cf48e8dd7daeb58f({ entityForm: entityForm, ent
|
|
|
34740
34758
|
looking.current = true;
|
|
34741
34759
|
const transformed = $1e0694bb407199c5$var$transformValue(rawValue, autoTrim, transform);
|
|
34742
34760
|
setRawValue(transformed);
|
|
34761
|
+
if (force) {
|
|
34762
|
+
await browse(transformed);
|
|
34763
|
+
looking.current = false;
|
|
34764
|
+
return;
|
|
34765
|
+
}
|
|
34743
34766
|
if (!transformed) {
|
|
34744
34767
|
bindingColumns.forEach((columnName)=>{
|
|
34745
34768
|
entityForm.form.setFieldValue(columnName, '');
|
|
@@ -34760,7 +34783,7 @@ function $1e0694bb407199c5$export$cf48e8dd7daeb58f({ entityForm: entityForm, ent
|
|
|
34760
34783
|
return;
|
|
34761
34784
|
}
|
|
34762
34785
|
const split = (0, $7qUhz.splitCompoundKey)(transformed, context.group);
|
|
34763
|
-
if (
|
|
34786
|
+
if (!split.complete) await browse(transformed);
|
|
34764
34787
|
else {
|
|
34765
34788
|
const lookup = await executeDescriptionLookup(split.values);
|
|
34766
34789
|
if (lookup.errorDescription) setInvalid(transformed, lookup.errorDescription);
|
|
@@ -35107,6 +35130,7 @@ const $d296e9f4d3930bfd$export$4db9dd7eda56bf7b = ({ entityForm: entityForm, ent
|
|
|
35107
35130
|
const lookupDef = (0, $b4te3$react.useRef)();
|
|
35108
35131
|
const isLooking = (0, $b4te3$react.useRef)(false);
|
|
35109
35132
|
const lastFocusedElement = (0, $b4te3$react.useRef)();
|
|
35133
|
+
const lastValidLookup = (0, $b4te3$react.useRef)();
|
|
35110
35134
|
const performLookup = (0, $b4te3$react.useCallback)((bindingColumn, keyValue, force = false)=>{
|
|
35111
35135
|
if (!lookupEntity.current) return Promise.resolve({
|
|
35112
35136
|
columnName: bindingColumn,
|
|
@@ -35120,7 +35144,22 @@ const $d296e9f4d3930bfd$export$4db9dd7eda56bf7b = ({ entityForm: entityForm, ent
|
|
|
35120
35144
|
lookupEntity.current.def.columns[mappedKeyColumnName].value = keyValue;
|
|
35121
35145
|
if (parentKeys) lookupEntity.current.parentKeys = parentKeys;
|
|
35122
35146
|
return new Promise(async (resolve, reject)=>{
|
|
35123
|
-
const doLookup = async ()=>{
|
|
35147
|
+
const doLookup = async (lookupKey = keyValue)=>{
|
|
35148
|
+
const cached = lastValidLookup.current;
|
|
35149
|
+
if (cached && cached.key?.toString() === lookupKey?.toString()) {
|
|
35150
|
+
const cachedStatus = {
|
|
35151
|
+
data: {
|
|
35152
|
+
key: lookupKey,
|
|
35153
|
+
description: cached.description
|
|
35154
|
+
}
|
|
35155
|
+
};
|
|
35156
|
+
setStatus(cachedStatus);
|
|
35157
|
+
return {
|
|
35158
|
+
description: cached.description,
|
|
35159
|
+
status: cachedStatus,
|
|
35160
|
+
errorDescription: ''
|
|
35161
|
+
};
|
|
35162
|
+
}
|
|
35124
35163
|
try {
|
|
35125
35164
|
setStatus({
|
|
35126
35165
|
loading: true
|
|
@@ -35135,6 +35174,10 @@ const $d296e9f4d3930bfd$export$4db9dd7eda56bf7b = ({ entityForm: entityForm, ent
|
|
|
35135
35174
|
}
|
|
35136
35175
|
};
|
|
35137
35176
|
setStatus(new_status);
|
|
35177
|
+
if (result) lastValidLookup.current = {
|
|
35178
|
+
key: lookupKey,
|
|
35179
|
+
description: result
|
|
35180
|
+
};
|
|
35138
35181
|
return {
|
|
35139
35182
|
description: result,
|
|
35140
35183
|
status: new_status,
|
|
@@ -35162,7 +35205,7 @@ const $d296e9f4d3930bfd$export$4db9dd7eda56bf7b = ({ entityForm: entityForm, ent
|
|
|
35162
35205
|
lookupEntity.current.def.columns[mappedKeyColumnName].value = selectedKeyValue;
|
|
35163
35206
|
entityForm.form.setFieldValue(column, selectedKeyValue);
|
|
35164
35207
|
//lookupEntity.current!.def.columns[bindingColumn].value = selectedKeys[0][bindingColumn];
|
|
35165
|
-
const result = await doLookup();
|
|
35208
|
+
const result = await doLookup(selectedKeyValue);
|
|
35166
35209
|
if (result.status.error) resolve({
|
|
35167
35210
|
columnName: bindingColumn,
|
|
35168
35211
|
key: keyValue,
|