@mcurros2/microm 1.1.68-0 → 1.1.70-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
@@ -457,26 +457,46 @@ function $8b0c683387a5432f$export$f1f43a62560a15ec(props) {
457
457
  const removeValidation = (0, $b4te3$react.useCallback)((column)=>{
458
458
  delete validationObject.current[column.name];
459
459
  }, []);
460
- return {
461
- form: form,
462
- formMode: formMode,
463
- status: status,
464
- saveAndGet: saveAndGetOverride !== null && saveAndGetOverride !== void 0 ? saveAndGetOverride : saveAndGet,
465
- performGetData: performGetData,
466
- handleCancel: handleCancel,
467
- configureField: addValidation,
468
- removeValidation: removeValidation,
469
- handleSubmit: handleSubmit,
470
- notifyValidationErrorState: notifyValidationErrorState,
471
- showDescriptionState: showDescriptionState,
472
- entity: entity,
473
- asyncErrors: asyncErrors.current,
474
- setAsyncError: setAsyncError,
475
- clearAsyncError: clearAsyncError,
476
- clearAllAsyncErrors: clearAllAsyncErrors,
477
- isFormValid: isFormValid,
478
- isFormFieldValid: isFormFieldValid
479
- };
460
+ const result = (0, $b4te3$react.useMemo)(()=>({
461
+ form: form,
462
+ formMode: formMode,
463
+ status: status,
464
+ saveAndGet: saveAndGetOverride !== null && saveAndGetOverride !== void 0 ? saveAndGetOverride : saveAndGet,
465
+ performGetData: performGetData,
466
+ handleCancel: handleCancel,
467
+ configureField: addValidation,
468
+ removeValidation: removeValidation,
469
+ handleSubmit: handleSubmit,
470
+ notifyValidationErrorState: notifyValidationErrorState,
471
+ showDescriptionState: showDescriptionState,
472
+ entity: entity,
473
+ asyncErrors: asyncErrors.current,
474
+ setAsyncError: setAsyncError,
475
+ clearAsyncError: clearAsyncError,
476
+ clearAllAsyncErrors: clearAllAsyncErrors,
477
+ isFormValid: isFormValid,
478
+ isFormFieldValid: isFormFieldValid
479
+ }), [
480
+ addValidation,
481
+ clearAllAsyncErrors,
482
+ clearAsyncError,
483
+ entity,
484
+ form,
485
+ formMode,
486
+ handleCancel,
487
+ handleSubmit,
488
+ isFormFieldValid,
489
+ isFormValid,
490
+ notifyValidationErrorState,
491
+ performGetData,
492
+ removeValidation,
493
+ saveAndGet,
494
+ saveAndGetOverride,
495
+ setAsyncError,
496
+ showDescriptionState,
497
+ status
498
+ ]);
499
+ return result;
480
500
  }
481
501
 
482
502
  });
@@ -6028,7 +6048,7 @@ var $0dfeab93be213999$var$__awaiter = undefined && undefined.__awaiter || functi
6028
6048
  step((generator = generator.apply(thisArg, _arguments || [])).next());
6029
6049
  });
6030
6050
  };
6031
- function $0dfeab93be213999$export$79c3258edc7d1573({ client: client, useLocalLoggedInCheck: useLocalLoggedInCheck }) {
6051
+ function $0dfeab93be213999$export$79c3258edc7d1573({ client: client, useLocalLoggedInCheck: useLocalLoggedInCheck, userInitialsClientClaimsNames: userInitialsClientClaimsNames }) {
6032
6052
  const [isLoggedIn, setIsLoggedIn] = (0, $b4te3$react.useState)(undefined);
6033
6053
  const [loggedInInfo, setLoggedInInfo] = (0, $b4te3$react.useState)({});
6034
6054
  const checkIsLoggedIn = (0, $b4te3$react.useCallback)(()=>$0dfeab93be213999$var$__awaiter(this, void 0, void 0, function*() {
@@ -6057,7 +6077,11 @@ function $0dfeab93be213999$export$79c3258edc7d1573({ client: client, useLocalLog
6057
6077
  return $0dfeab93be213999$var$__awaiter(this, void 0, void 0, function*() {
6058
6078
  if (isLoggedIn) {
6059
6079
  const info = client.LOGGED_IN_USER;
6060
- if (info === null || info === void 0 ? void 0 : info.username) info.userinitials = (0, $j7hNv.getInitials)(info.username);
6080
+ // get intials from the client claims using userInitialsClientClaimsNames. Take the properties values from the client claims it those exist,
6081
+ // join them in a string separated with ' ' and use that as the input for the getInitials function
6082
+ // if not use the default client.userInitialsInput
6083
+ const userInitialsClientClaims = info ? (userInitialsClientClaimsNames === null || userInitialsClientClaimsNames === void 0 ? void 0 : userInitialsClientClaimsNames.map((name)=>info[name]).filter((value)=>value).join(" ")) || info.username || "" : "";
6084
+ if (info === null || info === void 0 ? void 0 : info.username) info.userinitials = (0, $j7hNv.getInitials)(userInitialsClientClaims);
6061
6085
  setLoggedInInfo(info !== null && info !== void 0 ? info : {});
6062
6086
  } else setLoggedInInfo({});
6063
6087
  });