@nickaux/form-configurator 1.1.213 → 1.1.215

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.
@@ -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);
@@ -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,
@@ -76118,11 +76122,6 @@ const RouteListing = ({
76118
76122
  }) => {
76119
76123
  const [listingData, setListingData] = useState(false);
76120
76124
  useEffect(() => {
76121
- console.log(dataHandler);
76122
- console.log(onEnterHandler);
76123
- console.log(onExitHandler);
76124
- console.log(param);
76125
- console.log(formManager);
76126
76125
  dataHandler(param.id, formManager, (result) => {
76127
76126
  setListingData(result);
76128
76127
  if (onEnterHandler) {
@@ -76227,7 +76226,7 @@ const RouteFormEdit = ({ dataHandler, param, formManager }) => {
76227
76226
  }
76228
76227
  const entityForm = newOptions["entity"].form ?? false;
76229
76228
  const entityData = newOptions["entity"].data;
76230
- const allFieldsRef = deepmerge$1(
76229
+ const allFieldsRef = _.merge(
76231
76230
  (entityForm == null ? void 0 : entityForm.fieldsRef) ?? {},
76232
76231
  (formManager == null ? void 0 : formManager.fieldsRef) ?? {}
76233
76232
  );
@@ -136662,8 +136661,6 @@ class TypeColorPicker extends TypeDefault {
136662
136661
  cursor: "pointer"
136663
136662
  };
136664
136663
  const cssPopover = {
136665
- position: "absolute",
136666
- zIndex: "30",
136667
136664
  position: "absolute",
136668
136665
  zIndex: "30",
136669
136666
  padding: "8px",
@@ -148875,7 +148872,7 @@ class FormManager {
148875
148872
  this.configData = {};
148876
148873
  this.formGen = {};
148877
148874
  this.dynamicPathPart = {};
148878
- this.formElements = this.loadJsonForm(p_form, p_data);
148875
+ this.formElements = this.loadJsonForm(_.cloneDeep(p_form));
148879
148876
  this.formData = p_data;
148880
148877
  this.displayOnChange = false;
148881
148878
  this.events = {}, this.options = options2;
@@ -149070,7 +149067,8 @@ class FormManager {
149070
149067
  var pathArray = fieldPath.split("__");
149071
149068
  var pointer = this.formData;
149072
149069
  for (var i2 = 0, len = pathArray.length; i2 < len; i2++) {
149073
- var path = typeof this.dynamicPathPart[pathArray[i2]] !== "undefined" ? this.dynamicPathPart[pathArray[i2]] : pathArray[i2];
149070
+ var iId = typeof this.dynamicPathPart[pathArray[i2]] !== "undefined" ? this.dynamicPathPart[pathArray[i2]] : null;
149071
+ var path = iId === null ? pathArray[i2] : iId;
149074
149072
  if (pointer[path]) {
149075
149073
  if (i2 === len - 1) {
149076
149074
  if (typeof value === "object") {
@@ -149145,14 +149143,16 @@ class FormManager {
149145
149143
  };
149146
149144
  return formJson.map((item) => resolveRefsInForm(item));
149147
149145
  }
149148
- loadJsonForm(p_data, p_data_value = null) {
149146
+ loadJsonForm(p_data) {
149149
149147
  if (!p_data) {
149150
149148
  return {};
149151
149149
  }
149152
149150
  this.fieldsRef = p_data.fieldsRef ?? p_data.fieldsRef;
149153
- Object.keys(p_data.fieldsRef).forEach((key3) => {
149154
- this.loadJsonFormNode(p_data.fieldsRef[key3]);
149155
- });
149151
+ if (p_data == null ? void 0 : p_data.fieldsRef) {
149152
+ Object.keys(p_data.fieldsRef).forEach((key3) => {
149153
+ this.loadJsonFormNode(p_data.fieldsRef[key3]);
149154
+ });
149155
+ }
149156
149156
  const formData = Array.isArray(p_data == null ? void 0 : p_data.form) ? p_data.form : Array.isArray(p_data == null ? void 0 : p_data.content) ? p_data.content : Array.isArray(p_data) ? p_data : [];
149157
149157
  for (let i2 = 0; i2 < formData.length; i2++) {
149158
149158
  formData[i2] = this.loadJsonFormNode(formData[i2], true);
@@ -149208,12 +149208,16 @@ class FormManager {
149208
149208
  * @returns {Object} - L'objet `p_item` potentiellement modifié après traitement.
149209
149209
  */
149210
149210
  loadJsonFormNode(p_item, test = false) {
149211
- var _a;
149211
+ var _a, _b, _c;
149212
+ if (p_item == null ? void 0 : p_item._fieldRefLinked) {
149213
+ return p_item;
149214
+ }
149212
149215
  if (p_item.fieldRef) {
149213
149216
  if ((_a = this.fieldsRef) == null ? void 0 : _a[p_item.fieldRef]) {
149214
149217
  p_item.id !== void 0 ? p_item.id : p_item.fieldRef;
149215
149218
  p_item = _.merge(p_item, this.fieldsRef[p_item.fieldRef], _.cloneDeep(p_item));
149216
149219
  p_item.content = this.fieldsRef[p_item.fieldRef].content;
149220
+ p_item._fieldRefLinked = true;
149217
149221
  } else {
149218
149222
  console.log("error fieldRef " + p_item.fieldRef + " not found");
149219
149223
  }
@@ -149228,6 +149232,12 @@ class FormManager {
149228
149232
  item
149229
149233
  );
149230
149234
  });
149235
+ } else {
149236
+ if (((_b = p_item == null ? void 0 : p_item.forms) == null ? void 0 : _b.content) && Array.isArray((_c = p_item == null ? void 0 : p_item.forms) == null ? void 0 : _c.content)) {
149237
+ p_item.forms.content = p_item.forms.content.map((item) => {
149238
+ return this.loadJsonFormNode(item);
149239
+ });
149240
+ }
149231
149241
  }
149232
149242
  return p_item;
149233
149243
  }
@@ -149579,3 +149589,4 @@ export {
149579
149589
  TypeDefault,
149580
149590
  FormConfigurator as default
149581
149591
  };
149592
+ //# sourceMappingURL=FormConfigurator.esm.js.map