@mcurros2/microm 1.1.259-0 → 1.1.261-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
@@ -33473,6 +33473,8 @@ $parcel$export(module.exports, "Lookup", function () { return $3c9a6257599b90ac$
33473
33473
 
33474
33474
  parcelRequire("2eyXi");
33475
33475
  var $4H7ea = parcelRequire("4H7ea");
33476
+ parcelRequire("7xGLy");
33477
+ var $OciKL = parcelRequire("OciKL");
33476
33478
  parcelRequire("17D0Z");
33477
33479
  var $2Zki2 = parcelRequire("2Zki2");
33478
33480
  const $3c9a6257599b90ac$export$9c2b2ccf03658905 = {
@@ -33487,12 +33489,19 @@ const $3c9a6257599b90ac$export$9c2b2ccf03658905 = {
33487
33489
  enableAdd: false,
33488
33490
  enableEdit: false,
33489
33491
  enableDelete: false,
33490
- enableView: true
33492
+ enableView: true,
33493
+ autoTrim: true
33491
33494
  };
33492
33495
  function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
33493
- const { entityForm: entityForm, entity: entity, lookupDefName: lookupDefName, autoFocus: autoFocus, label: label, parentKeys: parentKeys, column: column, required: required, readonly: readonly, disabled: disabled, idMaxWidth: idMaxWidth, icon: icon, iconVariant: iconVariant, requiredLabel: requiredLabel, description: description, size: size, onLookupPerformed: onLookupPerformed, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView } = (0, $b4te3$mantinecore.useComponentDefaultProps)('Lookup', $3c9a6257599b90ac$export$9c2b2ccf03658905, props);
33496
+ const { entityForm: entityForm, entity: entity, lookupDefName: lookupDefName, autoFocus: autoFocus, label: label, parentKeys: parentKeys, column: column, required: required, readonly: readonly, disabled: disabled, idMaxWidth: idMaxWidth, icon: icon, iconVariant: iconVariant, requiredLabel: requiredLabel, description: description, size: size, onLookupPerformed: onLookupPerformed, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, transform: transform, autoTrim: autoTrim } = (0, $b4te3$mantinecore.useComponentDefaultProps)('Lookup', $3c9a6257599b90ac$export$9c2b2ccf03658905, props);
33494
33497
  const theme = (0, $b4te3$mantinecore.useMantineTheme)();
33495
33498
  const HTMLDescriptionRef = (0, $b4te3$react.useRef)(null);
33499
+ const textTransform = (0, $OciKL.useTextTransform)({
33500
+ entityForm: entityForm,
33501
+ column: column,
33502
+ transform: transform,
33503
+ autoTrim: autoTrim
33504
+ });
33496
33505
  const lookupAPI = (0, $2Zki2.useLookup)({
33497
33506
  entityForm: entityForm,
33498
33507
  entity: entity,
@@ -33504,7 +33513,8 @@ function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
33504
33513
  enableAdd: enableAdd,
33505
33514
  enableEdit: enableEdit,
33506
33515
  enableDelete: enableDelete,
33507
- enableView: enableView
33516
+ enableView: enableView,
33517
+ transform: textTransform
33508
33518
  });
33509
33519
  (0, $b4te3$react.useEffect)(()=>{
33510
33520
  if (required ?? !column.hasFlag((0, $4H7ea.EntityColumnFlags).nullable)) entityForm.configureField(column, (0, $b4te3$mantineform.isNotEmpty)(requiredLabel));
@@ -33541,6 +33551,7 @@ function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
33541
33551
  const { formMode: formMode, status: status } = entityForm;
33542
33552
  const add_autofocus = formMode === 'add' ? true : undefined;
33543
33553
  const edit_autofocus = status.loading === false && formMode !== 'add' ? true : undefined;
33554
+ const readonly_condition = readonly === undefined ? column.hasFlag((0, $4H7ea.EntityColumnFlags).autoNum) || entityForm.formMode !== 'add' && column.hasFlag((0, $4H7ea.EntityColumnFlags).pk) : readonly;
33544
33555
  return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Stack), {
33545
33556
  style: {
33546
33557
  gap: "0.1rem",
@@ -33583,16 +33594,16 @@ function $3c9a6257599b90ac$export$710993ff54d9590c(props) {
33583
33594
  /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.TextInput), {
33584
33595
  size: size,
33585
33596
  maw: idMaxWidth,
33586
- readOnly: readonly || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading ? true : false,
33597
+ readOnly: readonly_condition || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading ? true : false,
33587
33598
  autoFocus: autoFocus === 'autoFocusOnAdd' ? add_autofocus : autoFocus === 'autoFocusOnEdit' ? edit_autofocus : autoFocus,
33588
33599
  "data-autofocus": autoFocus === 'autoFocusOnAdd' ? add_autofocus : autoFocus === 'autoFocusOnEdit' ? edit_autofocus : autoFocus,
33589
33600
  disabled: disabled,
33590
33601
  rightSection: /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.ActionIcon), {
33591
33602
  color: theme.primaryColor,
33592
- disabled: readonly || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading,
33603
+ disabled: readonly_condition || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading,
33593
33604
  onClick: async ()=>{
33594
33605
  // readonly, no lookup
33595
- if (readonly || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading) return;
33606
+ if (readonly_condition || entityForm.formMode === 'view' || lookupAPI.status.loading || entityForm.status.loading) return;
33596
33607
  await lookupAPI.onBlur(column.name, true);
33597
33608
  },
33598
33609
  variant: iconVariant,
@@ -33739,14 +33750,13 @@ var $98ddT = parcelRequire("98ddT");
33739
33750
  var $iKzSR = parcelRequire("iKzSR");
33740
33751
  parcelRequire("17D0Z");
33741
33752
  var $42GxC = parcelRequire("42GxC");
33742
- const $d296e9f4d3930bfd$export$4db9dd7eda56bf7b = ({ entityForm: entityForm, entity: entity, lookupDefName: lookupDefName, column: column, parentKeys: parentKeys, required: required, HTMLDescriptionRef: HTMLDescriptionRef, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView })=>{
33753
+ const $d296e9f4d3930bfd$export$4db9dd7eda56bf7b = ({ entityForm: entityForm, entity: entity, lookupDefName: lookupDefName, column: column, parentKeys: parentKeys, required: required, HTMLDescriptionRef: HTMLDescriptionRef, enableAdd: enableAdd, enableEdit: enableEdit, enableDelete: enableDelete, enableView: enableView, transform: transform })=>{
33743
33754
  const [status, setStatus] = (0, $b4te3$react.useState)({});
33744
33755
  const [previousLookupResult, setPreviousLookupResult] = (0, $b4te3$react.useState)();
33745
33756
  const [lookupResult, setLookupResult] = (0, $b4te3$react.useState)();
33746
33757
  const lookupForm = (0, $42GxC.useLookupForm)();
33747
33758
  const lookupEntity = (0, $b4te3$react.useRef)();
33748
33759
  const viewName = (0, $b4te3$react.useRef)('');
33749
- const procName = (0, $b4te3$react.useRef)('');
33750
33760
  const lookupDef = (0, $b4te3$react.useRef)();
33751
33761
  const isLooking = (0, $b4te3$react.useRef)(false);
33752
33762
  const lastFocusedElement = (0, $b4te3$react.useRef)();
@@ -33944,6 +33954,8 @@ const $d296e9f4d3930bfd$export$4db9dd7eda56bf7b = ({ entityForm: entityForm, ent
33944
33954
  //console.log(`OnBlur isLooking after: force: ${force} isLooking ${isLooking.current}`);
33945
33955
  isLooking.current = false;
33946
33956
  updateLookupType(result);
33957
+ const transformKey = result.key;
33958
+ if (transform) transform(transformKey);
33947
33959
  if (lastFocusedElement.current) //console.log(`Ref ${HTMLDescriptionRef.current}`)
33948
33960
  {
33949
33961
  if (HTMLDescriptionRef.current) HTMLDescriptionRef.current.focus({
@@ -33958,7 +33970,8 @@ const $d296e9f4d3930bfd$export$4db9dd7eda56bf7b = ({ entityForm: entityForm, ent
33958
33970
  previousLookupResult?.error,
33959
33971
  previousLookupResult?.key,
33960
33972
  required,
33961
- updateLookupType
33973
+ updateLookupType,
33974
+ transform
33962
33975
  ]);
33963
33976
  (0, $b4te3$react.useEffect)(()=>{
33964
33977
  // MMC: create the lookup entity