@nickaux/form-configurator 1.1.214 → 1.1.216

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.
@@ -39335,7 +39335,7 @@ const testValue = (operator, testFieldValue, expectedValue) => {
39335
39335
  }
39336
39336
  return true;
39337
39337
  default:
39338
- console.log(`Operator ${operator} is not recognized.`);
39338
+ console.log(`Operator ${operator} is not recognized.`, testFieldValue, expectedValue);
39339
39339
  return false;
39340
39340
  }
39341
39341
  };
@@ -40053,6 +40053,7 @@ class TypeDefault {
40053
40053
  return this.formManager.getFieldPath(this.id);
40054
40054
  }
40055
40055
  change(value) {
40056
+ this.executeListenenr(value);
40056
40057
  this.formManager.setFieldValueByPath(this.id, value);
40057
40058
  this.executeListenenr(value);
40058
40059
  this.executeActions(value);
@@ -40210,7 +40211,7 @@ class TypeGroup extends TypeDefault {
40210
40211
  break;
40211
40212
  }
40212
40213
  /* @__PURE__ */ jsx$2("label", { children: param.label });
40213
- outputHtml = /* @__PURE__ */ jsxs("div", { class: "group-content", children: [
40214
+ outputHtml = /* @__PURE__ */ jsxs("div", { className: "group-content", children: [
40214
40215
  param.customInfo ? /* @__PURE__ */ jsx$2("p", { children: param.customInfo }) : "",
40215
40216
  groupItems
40216
40217
  ] }, param);
@@ -75669,7 +75670,7 @@ function Listing({
75669
75670
  onSearch = (filter) => {
75670
75671
  }
75671
75672
  }) {
75672
- var _a, _b, _c, _d, _e2, _f;
75673
+ var _a, _b, _c, _d, _e2, _f, _g;
75673
75674
  if (!data2) {
75674
75675
  return "";
75675
75676
  }
@@ -75683,7 +75684,6 @@ function Listing({
75683
75684
  const [params, setParams] = useState(buildListingParam(listingParams));
75684
75685
  const [dataResult, setDataResult] = useState([]);
75685
75686
  useEffect(() => {
75686
- console.log("listing data", data2);
75687
75687
  onSearchHandler(formManager.formElements[0].id, searchParams);
75688
75688
  setDataResult(filter(searchParams == null ? void 0 : searchParams.text));
75689
75689
  if (params == null ? void 0 : params.defaultSort) {
@@ -75766,6 +75766,10 @@ function Listing({
75766
75766
  if (params === false) {
75767
75767
  return false;
75768
75768
  }
75769
+ const _pageCount = Math.ceil(Object.keys(dataResult).length / perPage);
75770
+ const _initialPage = ((_f = searchParams == null ? void 0 : searchParams.pagination) == null ? void 0 : _f.selected) > _pageCount ? 0 : (_g = searchParams == null ? void 0 : searchParams.pagination) == null ? void 0 : _g.selected;
75771
+ const pageCount = Math.max(_pageCount ?? 1, 1);
75772
+ const initialPage = Math.min(_initialPage ?? 0, pageCount - 1);
75769
75773
  return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
75770
75774
  /* @__PURE__ */ jsxs("div", { className: "search-bar", children: [
75771
75775
  /* @__PURE__ */ jsx$2(
@@ -75849,8 +75853,8 @@ function Listing({
75849
75853
  nextLabel: "Suivant",
75850
75854
  breakLabel: "...",
75851
75855
  breakClassName: "break-me",
75852
- pageCount: Math.ceil(Object.keys(dataResult).length / perPage),
75853
- initialPage: (_f = searchParams == null ? void 0 : searchParams.pagination) == null ? void 0 : _f.selected,
75856
+ pageCount,
75857
+ initialPage,
75854
75858
  marginPagesDisplayed: 1,
75855
75859
  pageRangeDisplayed: 2,
75856
75860
  onPageChange: handlePageClick,
@@ -81697,7 +81701,6 @@ class TypeSelect extends TypeDefault {
81697
81701
  className: "chips-item input-chip " + ((fieldValue2 == null ? void 0 : fieldValue2.includes(item.value)) ? "item-cheked" : ""),
81698
81702
  style: { backgroundColor: (item == null ? void 0 : item.color) ?? "transparent" },
81699
81703
  children: [
81700
- /* @__PURE__ */ jsx$2("div", { className: "icon-checked" }),
81701
81704
  /* @__PURE__ */ jsx$2(
81702
81705
  "input",
81703
81706
  {
@@ -81712,6 +81715,7 @@ class TypeSelect extends TypeDefault {
81712
81715
  }
81713
81716
  ),
81714
81717
  /* @__PURE__ */ jsxs("label", { htmlFor: props.id + "_" + i2, children: [
81718
+ /* @__PURE__ */ jsx$2("div", { className: "icon-checked" }),
81715
81719
  " ",
81716
81720
  item.label
81717
81721
  ] })
@@ -136349,7 +136353,7 @@ const getDisplayField = (fieldValue2, param, labelFields) => {
136349
136353
  detailDisplay,
136350
136354
  " "
136351
136355
  ] }),
136352
- /* @__PURE__ */ jsx$2("div", { class: "img-container", children: /* @__PURE__ */ jsx$2("img", { src: fileSrc }) })
136356
+ /* @__PURE__ */ jsx$2("div", { className: "img-container", children: /* @__PURE__ */ jsx$2("img", { src: fileSrc }) })
136353
136357
  ] });
136354
136358
  break;
136355
136359
  case "mp4":
@@ -149153,7 +149157,6 @@ class FormManager {
149153
149157
  for (let i2 = 0; i2 < formData.length; i2++) {
149154
149158
  formData[i2] = this.loadJsonFormNode(formData[i2], true);
149155
149159
  }
149156
- console.log(formData);
149157
149160
  return formData;
149158
149161
  }
149159
149162
  // getMaxContentLevel(p_item) {
@@ -149565,7 +149568,7 @@ function RootForm(props) {
149565
149568
  return /* @__PURE__ */ jsx$2(ChildComponent, {}, index2);
149566
149569
  }) }, "root-form") });
149567
149570
  }
149568
- function FormConfigurator({ form, data: data2, options: options2, parent = {}, routePath = "" }) {
149571
+ const FormConfigurator = forwardRef(({ form, data: data2, options: options2, parent = {}, routePath = "" }, ref2) => {
149569
149572
  const [formManager, setFormManager] = useState();
149570
149573
  useEffect(() => {
149571
149574
  const manager = new FormManager(form, data2, options2, routePath);
@@ -149574,6 +149577,9 @@ function FormConfigurator({ form, data: data2, options: options2, parent = {}, r
149574
149577
  parent.formManager = manager;
149575
149578
  }
149576
149579
  }, [form, data2, options2, routePath]);
149580
+ useImperativeHandle(ref2, () => ({
149581
+ formManager
149582
+ }), [formManager]);
149577
149583
  if (!formManager)
149578
149584
  return null;
149579
149585
  const LayoutComponent = formManager.layout;
@@ -149581,7 +149587,7 @@ function FormConfigurator({ form, data: data2, options: options2, parent = {}, r
149581
149587
  /* @__PURE__ */ jsx$2(FormContext.Provider, { value: formManager, children: /* @__PURE__ */ jsx$2(RootForm, {}) }),
149582
149588
  formManager.options.displayData && /* @__PURE__ */ jsx$2(DisplayData, {})
149583
149589
  ] }) });
149584
- }
149590
+ });
149585
149591
  export {
149586
149592
  TypeDefault,
149587
149593
  FormConfigurator as default