@skalfa/skalfa-component 1.0.51 → 1.0.52

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.
@@ -57,7 +57,7 @@ export type WatchAction = {
57
57
  hidden?: boolean;
58
58
  value?: any;
59
59
  required?: boolean;
60
- readonly?: boolean;
60
+ readOnly?: boolean;
61
61
  reset?: boolean;
62
62
  };
63
63
  export interface FormType<T extends TypeKeys = keyof ConstructionMap> {
@@ -197,7 +197,8 @@ function FormSupervisionComponent({ title, fields, submitControl, confirmation,
197
197
  if (form?.onHide?.(valMap, prefix))
198
198
  return null;
199
199
  const ws = watchState[name];
200
- if (ws?.hidden)
200
+ const isHidden = form.construction?.hidden ?? ws?.hidden;
201
+ if (isHidden)
201
202
  return null;
202
203
  if (inputType === "cluster") {
203
204
  const { name: mapName, fields: innerForms, label, tip, wrap, className, min } = form.construction;
@@ -247,7 +248,10 @@ function FormSupervisionComponent({ title, fields, submitControl, confirmation,
247
248
  return ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)(form.className, generateColClass(form.col || "12")), children: customRender?.({ formControl, values, setValues, errors, setErrors, setRegister, prefixName: prefix }) }, key));
248
249
  }
249
250
  const Component = inputMap[inputType] || __1.InputComponent;
250
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)(form.className, generateColClass(form.col || "12")), children: (0, jsx_runtime_1.jsx)(Component, { ...form.construction, ...formControl(name), disabled: ws?.disabled, readOnly: ws?.readonly, name: name }) }, key));
251
+ const construction = form.construction || {};
252
+ const disabled = construction.disabled ?? ws?.disabled;
253
+ const readOnly = construction.readOnly ?? ws?.readOnly;
254
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, _utils_1.cn)(form.className, generateColClass(form.col || "12")), children: (0, jsx_runtime_1.jsx)(Component, { ...construction, ...formControl(name), disabled: disabled, readOnly: readOnly, name: name }) }, key));
251
255
  };
252
256
  (0, react_1.useEffect)(() => {
253
257
  (modal == "failed") && setModal(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skalfa/skalfa-component",
3
- "version": "1.0.51",
3
+ "version": "1.0.52",
4
4
  "description": "Reusable UI components for Skalfa App.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -107,7 +107,7 @@ export type WatchAction = {
107
107
  hidden ?: boolean
108
108
  value ?: any
109
109
  required ?: boolean
110
- readonly ?: boolean
110
+ readOnly ?: boolean
111
111
  reset ?: boolean
112
112
  }
113
113
 
@@ -389,7 +389,8 @@ export function FormSupervisionComponent({
389
389
  if (form?.onHide?.(valMap, prefix)) return null;
390
390
 
391
391
  const ws = watchState[name];
392
- if (ws?.hidden) return null;
392
+ const isHidden = (form.construction as any)?.hidden ?? ws?.hidden;
393
+ if (isHidden) return null;
393
394
 
394
395
  if (inputType === "cluster") {
395
396
  const { name: mapName, fields: innerForms, label, tip, wrap, className, min } = form.construction as ClusterConstruction;
@@ -492,13 +493,17 @@ export function FormSupervisionComponent({
492
493
  }
493
494
 
494
495
  const Component = inputMap[inputType] || InputComponent;
496
+ const construction = (form.construction as any) || {};
497
+ const disabled = construction.disabled ?? ws?.disabled;
498
+ const readOnly = construction.readOnly ?? ws?.readOnly;
499
+
495
500
  return (
496
501
  <div key={key} className={cn(form.className, generateColClass(form.col || "12"))}>
497
502
  <Component
498
- {...(form.construction as any)}
503
+ {...construction}
499
504
  {...formControl(name)}
500
- disabled={ws?.disabled}
501
- readOnly={ws?.readonly}
505
+ disabled={disabled}
506
+ readOnly={readOnly}
502
507
  name={name}
503
508
  />
504
509
  </div>