pge-front-common 14.0.21 → 14.0.22

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/lib/index.js CHANGED
@@ -20968,14 +20968,13 @@ var isWeb = typeof window !== 'undefined' &&
20968
20968
  function cloneObject(data) {
20969
20969
  let copy;
20970
20970
  const isArray = Array.isArray(data);
20971
- const isFileListInstance = typeof FileList !== 'undefined' ? data instanceof FileList : false;
20972
20971
  if (data instanceof Date) {
20973
20972
  copy = new Date(data);
20974
20973
  }
20975
20974
  else if (data instanceof Set) {
20976
20975
  copy = new Set(data);
20977
20976
  }
20978
- else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
20977
+ else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) &&
20979
20978
  (isArray || isObject(data))) {
20980
20979
  copy = isArray ? [] : {};
20981
20980
  if (!isArray && !isPlainObject(data)) {
@@ -21034,7 +21033,7 @@ var set = (object, path, value) => {
21034
21033
  ? []
21035
21034
  : {};
21036
21035
  }
21037
- if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
21036
+ if (key === '__proto__') {
21038
21037
  return;
21039
21038
  }
21040
21039
  object[key] = newValue;
@@ -21210,7 +21209,7 @@ function useFormState(props) {
21210
21209
  _mounted.current = false;
21211
21210
  };
21212
21211
  }, [control]);
21213
- return React.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
21212
+ return getProxyFormState(formState, control, _localProxyFormState.current, false);
21214
21213
  }
21215
21214
 
21216
21215
  var isString = (value) => typeof value === 'string';
@@ -21304,67 +21303,6 @@ function useController(props) {
21304
21303
  value,
21305
21304
  ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
21306
21305
  }));
21307
- const fieldState = React.useMemo(() => Object.defineProperties({}, {
21308
- invalid: {
21309
- enumerable: true,
21310
- get: () => !!get(formState.errors, name),
21311
- },
21312
- isDirty: {
21313
- enumerable: true,
21314
- get: () => !!get(formState.dirtyFields, name),
21315
- },
21316
- isTouched: {
21317
- enumerable: true,
21318
- get: () => !!get(formState.touchedFields, name),
21319
- },
21320
- isValidating: {
21321
- enumerable: true,
21322
- get: () => !!get(formState.validatingFields, name),
21323
- },
21324
- error: {
21325
- enumerable: true,
21326
- get: () => get(formState.errors, name),
21327
- },
21328
- }), [formState, name]);
21329
- const field = React.useMemo(() => ({
21330
- name,
21331
- value,
21332
- ...(isBoolean(disabled) || formState.disabled
21333
- ? { disabled: formState.disabled || disabled }
21334
- : {}),
21335
- onChange: (event) => _registerProps.current.onChange({
21336
- target: {
21337
- value: getEventValue(event),
21338
- name: name,
21339
- },
21340
- type: EVENTS.CHANGE,
21341
- }),
21342
- onBlur: () => _registerProps.current.onBlur({
21343
- target: {
21344
- value: get(control._formValues, name),
21345
- name: name,
21346
- },
21347
- type: EVENTS.BLUR,
21348
- }),
21349
- ref: (elm) => {
21350
- const field = get(control._fields, name);
21351
- if (field && elm) {
21352
- field._f.ref = {
21353
- focus: () => elm.focus(),
21354
- select: () => elm.select(),
21355
- setCustomValidity: (message) => elm.setCustomValidity(message),
21356
- reportValidity: () => elm.reportValidity(),
21357
- };
21358
- }
21359
- },
21360
- }), [
21361
- name,
21362
- control._formValues,
21363
- disabled,
21364
- formState.disabled,
21365
- value,
21366
- control._fields,
21367
- ]);
21368
21306
  React.useEffect(() => {
21369
21307
  const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
21370
21308
  const updateMounted = (name, value) => {
@@ -21381,7 +21319,6 @@ function useController(props) {
21381
21319
  set(control._formValues, name, value);
21382
21320
  }
21383
21321
  }
21384
- !isArrayField && control.register(name);
21385
21322
  return () => {
21386
21323
  (isArrayField
21387
21324
  ? _shouldUnregisterField && !control._state.action
@@ -21391,17 +21328,72 @@ function useController(props) {
21391
21328
  };
21392
21329
  }, [name, control, isArrayField, shouldUnregister]);
21393
21330
  React.useEffect(() => {
21394
- control._updateDisabledField({
21395
- disabled,
21396
- fields: control._fields,
21397
- name,
21398
- });
21331
+ if (get(control._fields, name)) {
21332
+ control._updateDisabledField({
21333
+ disabled,
21334
+ fields: control._fields,
21335
+ name,
21336
+ value: get(control._fields, name)._f.value,
21337
+ });
21338
+ }
21399
21339
  }, [disabled, name, control]);
21400
- return React.useMemo(() => ({
21401
- field,
21340
+ return {
21341
+ field: {
21342
+ name,
21343
+ value,
21344
+ ...(isBoolean(disabled) || formState.disabled
21345
+ ? { disabled: formState.disabled || disabled }
21346
+ : {}),
21347
+ onChange: React.useCallback((event) => _registerProps.current.onChange({
21348
+ target: {
21349
+ value: getEventValue(event),
21350
+ name: name,
21351
+ },
21352
+ type: EVENTS.CHANGE,
21353
+ }), [name]),
21354
+ onBlur: React.useCallback(() => _registerProps.current.onBlur({
21355
+ target: {
21356
+ value: get(control._formValues, name),
21357
+ name: name,
21358
+ },
21359
+ type: EVENTS.BLUR,
21360
+ }), [name, control]),
21361
+ ref: React.useCallback((elm) => {
21362
+ const field = get(control._fields, name);
21363
+ if (field && elm) {
21364
+ field._f.ref = {
21365
+ focus: () => elm.focus(),
21366
+ select: () => elm.select(),
21367
+ setCustomValidity: (message) => elm.setCustomValidity(message),
21368
+ reportValidity: () => elm.reportValidity(),
21369
+ };
21370
+ }
21371
+ }, [control._fields, name]),
21372
+ },
21402
21373
  formState,
21403
- fieldState,
21404
- }), [field, formState, fieldState]);
21374
+ fieldState: Object.defineProperties({}, {
21375
+ invalid: {
21376
+ enumerable: true,
21377
+ get: () => !!get(formState.errors, name),
21378
+ },
21379
+ isDirty: {
21380
+ enumerable: true,
21381
+ get: () => !!get(formState.dirtyFields, name),
21382
+ },
21383
+ isTouched: {
21384
+ enumerable: true,
21385
+ get: () => !!get(formState.touchedFields, name),
21386
+ },
21387
+ isValidating: {
21388
+ enumerable: true,
21389
+ get: () => !!get(formState.validatingFields, name),
21390
+ },
21391
+ error: {
21392
+ enumerable: true,
21393
+ get: () => get(formState.errors, name),
21394
+ },
21395
+ }),
21396
+ };
21405
21397
  }
21406
21398
 
21407
21399
  var selectColourStyles = function (isInvalid) { return ({
@@ -23589,7 +23581,7 @@ var ModalUI = function (_a) {
23589
23581
  React.createElement("div", { className: styles$3.childrenContainer }, children)))));
23590
23582
  };
23591
23583
 
23592
- var css_248z$4 = "@keyframes styles-module__fadeIn___09YGY {\r\n from {\r\n opacity: 0;\r\n }\r\n to {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n.styles-module__modalOverlay___zIq-T {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background: rgba(0, 0, 0, 0.5);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 1000;\r\n overflow-y: hidden;\r\n animation: styles-module__fadeIn___09YGY 0.3s ease-in-out;\r\n}\r\n\r\n.styles-module__modal___4vuMK {\r\n z-index: 10000;\r\n background: white;\r\n border-radius: 16px;\r\n position: relative;\r\n margin: auto;\r\n max-width: 500px;\r\n width: 100%;\r\n}\r\n\r\n.styles-module__modalHeader___P-TK7 {\r\n display: flex;\r\n text-align: justify;\r\n background-color: var(--modal-header-bg-color);\r\n color: rgba(255, 255, 255, 0.96);\r\n border-top-left-radius: 16px;\r\n border-top-right-radius: 16px;\r\n padding: 1rem 1.5rem;\r\n justify-content: space-between;\r\n}\r\n\r\n.styles-module__modalHeaderContent___i6CzG {\r\n display: flex;\r\n flex-direction: column;\r\n flex: 0 1 auto;\r\n font-family: Open Sans;\r\n font-weight: 700;\r\n font-size: 20px;\r\n line-height: 100%;\r\n letter-spacing: 0px;\r\n vertical-align: middle;\r\n}\r\n\r\n.styles-module__closeButton___F4c5B {\r\n vertical-align: middle;\r\n cursor: pointer;\r\n height: 20px;\r\n}\r\n\r\n.styles-module__closeButton___F4c5B:hover,\r\n.styles-module__closeButton___F4c5B:active {\r\n opacity: 0.8;\r\n}\r\n\r\n.styles-module__modalBody___jzSq1 {\r\n margin: 16px 0 16px 16px;\r\n max-height: 500px;\r\n padding-right: 16px;\r\n overflow-x: hidden;\r\n overflow-y: auto;\r\n}\r\n\r\n.styles-module__modalFooter___keSWl {\r\n display: flex;\r\n flex-direction: row;\r\n gap: 1rem;\r\n padding: 0 16px 16px;\r\n justify-content: flex-end;\r\n}\r\n";
23584
+ var css_248z$4 = "@keyframes styles-module__fadeIn___09YGY {\r\n from {\r\n opacity: 0;\r\n }\r\n to {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n.styles-module__modalOverlay___zIq-T {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n bottom: 0;\r\n background: rgba(0, 0, 0, 0.5);\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 1000;\r\n overflow-y: hidden;\r\n animation: styles-module__fadeIn___09YGY 0.3s ease-in-out;\r\n}\r\n\r\n.styles-module__modal___4vuMK {\r\n z-index: 10000;\r\n background: white;\r\n border-radius: 16px;\r\n position: relative;\r\n margin: auto;\r\n max-width: 500px;\r\n width: 100%;\r\n}\r\n\r\n@media screen and (max-width: 768px) {\r\n .styles-module__modal___4vuMK {\r\n max-width: 95vw;\r\n }\r\n}\r\n\r\n.styles-module__modalHeader___P-TK7 {\r\n display: flex;\r\n text-align: justify;\r\n background-color: var(--modal-header-bg-color);\r\n color: rgba(255, 255, 255, 0.96);\r\n border-top-left-radius: 16px;\r\n border-top-right-radius: 16px;\r\n padding: 1rem 1.5rem;\r\n justify-content: space-between;\r\n}\r\n\r\n.styles-module__modalHeaderContent___i6CzG {\r\n display: flex;\r\n flex-direction: column;\r\n flex: 0 1 auto;\r\n font-family: Open Sans;\r\n font-weight: 700;\r\n font-size: 20px;\r\n line-height: 100%;\r\n letter-spacing: 0px;\r\n vertical-align: middle;\r\n}\r\n\r\n.styles-module__closeButton___F4c5B {\r\n vertical-align: middle;\r\n cursor: pointer;\r\n height: 20px;\r\n}\r\n\r\n.styles-module__closeButton___F4c5B:hover,\r\n.styles-module__closeButton___F4c5B:active {\r\n opacity: 0.8;\r\n}\r\n\r\n.styles-module__modalBody___jzSq1 {\r\n margin: 16px 0 16px 16px;\r\n max-height: 500px;\r\n padding-right: 16px;\r\n overflow-x: hidden;\r\n overflow-y: auto;\r\n}\r\n\r\n.styles-module__modalFooter___keSWl {\r\n display: flex;\r\n flex-direction: row;\r\n gap: 1rem;\r\n padding: 0 16px 16px;\r\n justify-content: flex-end;\r\n}\r\n";
23593
23585
  var styl = {"modalOverlay":"styles-module__modalOverlay___zIq-T","fadeIn":"styles-module__fadeIn___09YGY","modal":"styles-module__modal___4vuMK","modalHeader":"styles-module__modalHeader___P-TK7","modalHeaderContent":"styles-module__modalHeaderContent___i6CzG","closeButton":"styles-module__closeButton___F4c5B","modalBody":"styles-module__modalBody___jzSq1","modalFooter":"styles-module__modalFooter___keSWl"};
23594
23586
  styleInject(css_248z$4);
23595
23587