@mcurros2/microm 1.1.265-0 → 1.1.266-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.js CHANGED
@@ -34365,32 +34365,35 @@ const $900fa559ce35569a$export$4003d000af5d7585 = /*#__PURE__*/ (0, $b4te3$react
34365
34365
  required: resolvedSelectProps?.required,
34366
34366
  requiredMessage: requiredLabel
34367
34367
  });
34368
+ const bindingColumnValue = form.values[column.name];
34369
+ const resolvedBindingValue = typeof bindingColumnValue === 'string' ? selectData.find((item)=>typeof item.value === 'string' && item.value.localeCompare(bindingColumnValue, undefined, {
34370
+ sensitivity: 'base'
34371
+ }) === 0)?.value ?? bindingColumnValue : bindingColumnValue;
34372
+ const { onChange: mantineOnChange, value: _mantineValue, ...lookupInputProps } = lookupSelectAPI.inputProps;
34373
+ const handleSelectChange = (0, $b4te3$react.useCallback)((nextValue)=>{
34374
+ if (typeof nextValue === 'string') {
34375
+ const matchedValue = selectData.find((item)=>typeof item.value === 'string' && item.value.localeCompare(nextValue, undefined, {
34376
+ sensitivity: 'base'
34377
+ }) === 0)?.value ?? nextValue;
34378
+ mantineOnChange(matchedValue);
34379
+ return;
34380
+ }
34381
+ mantineOnChange(nextValue);
34382
+ }, [
34383
+ mantineOnChange,
34384
+ selectData
34385
+ ]);
34368
34386
  // MMC: Effect for setting the column valueDescription
34369
34387
  (0, $b4te3$react.useEffect)(()=>{
34370
- const value = entityForm.form.values[column.name];
34371
- if (value) {
34372
- const index = selectData.findIndex((item)=>item.value === value);
34388
+ if (typeof resolvedBindingValue !== 'string') console.error(`LookupSelect: Column.Value is not resolved to a string for column ${column.name}. This may cause unexpected behavior.`);
34389
+ if (resolvedBindingValue) {
34390
+ const index = selectData.findIndex((item)=>item.value === resolvedBindingValue);
34373
34391
  if (index >= 0) column.valueDescription = selectData[index].label;
34374
34392
  else column.valueDescription = '';
34375
34393
  } else column.valueDescription = '';
34376
34394
  }, [
34377
34395
  column,
34378
- entityForm.form.values,
34379
- selectData
34380
- ]);
34381
- // MMC: Effect for setting the key column value to the case of the selectData
34382
- const bindingColumnValue = form.values[column.name];
34383
- (0, $b4te3$react.useEffect)(()=>{
34384
- if (formMode === 'add') return;
34385
- const originalItem = selectData.find((item)=>item.value.localeCompare(bindingColumnValue, undefined, {
34386
- sensitivity: 'base'
34387
- }) === 0)?.value ?? null;
34388
- if (originalItem !== null) form.setFieldValue(column.name, originalItem);
34389
- }, [
34390
- bindingColumnValue,
34391
- column.name,
34392
- form,
34393
- formMode,
34396
+ resolvedBindingValue,
34394
34397
  selectData
34395
34398
  ]);
34396
34399
  const readoOnlyResult = resolvedSelectProps?.readOnly || entityForm.formMode === 'view' || lookupSelectAPI.status.loading || formStatus?.loading || column.hasFlag((0, $4H7ea.EntityColumnFlags).pk) && entityForm.formMode !== 'add' ? true : false;
@@ -34437,7 +34440,9 @@ const $900fa559ce35569a$export$4003d000af5d7585 = /*#__PURE__*/ (0, $b4te3$react
34437
34440
  ]
34438
34441
  }),
34439
34442
  rightSectionWidth: enableEdit ? "auto" : undefined,
34440
- ...lookupSelectAPI.inputProps,
34443
+ value: typeof resolvedBindingValue === 'string' ? resolvedBindingValue : null,
34444
+ onChange: handleSelectChange,
34445
+ ...lookupInputProps,
34441
34446
  ref: ref
34442
34447
  });
34443
34448
  });