blixify-ui-web 1.2.103 → 1.2.104

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KASN,MAAM,OAAO,CAAC;AA0Ff,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AA4D1B,eAAO,MAAM,YAAY,mFAusZvB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KASN,MAAM,OAAO,CAAC;AA0Ff,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AA4D1B,eAAO,MAAM,YAAY,mFAssZvB,CAAC"}
@@ -4887,10 +4887,9 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
4887
4887
  }); };
4888
4888
  var handleSubmit = function (isDraft) { return __awaiter(void 0, void 0, void 0, function () {
4889
4889
  var preComplete, res, updatedMarkdownData_1, uploadedData_2, uploadTypes_1, err_23;
4890
- var _a;
4891
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
4892
- return __generator(this, function (_p) {
4893
- switch (_p.label) {
4890
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4891
+ return __generator(this, function (_m) {
4892
+ switch (_m.label) {
4894
4893
  case 0:
4895
4894
  // INFO: re-entry guard — if a submit is already in-flight (double-click,
4896
4895
  // rapid Enter keypresses, or concurrent bareSaveOnTabChange calls), return
@@ -4899,134 +4898,134 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
4899
4898
  if (isSubmittingRef.current)
4900
4899
  return [2 /*return*/];
4901
4900
  isSubmittingRef.current = true;
4902
- _p.label = 1;
4901
+ _m.label = 1;
4903
4902
  case 1:
4904
- _p.trys.push([1, 10, , 11]);
4903
+ _m.trys.push([1, 8, , 9]);
4905
4904
  setLoading(true);
4906
4905
  setModalVisible(true);
4907
4906
  preComplete = true;
4908
- if (!((_b = props.bareSettings) === null || _b === void 0 ? void 0 : _b.bareUpdateHandlePreComplete)) return [3 /*break*/, 3];
4907
+ if (!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareUpdateHandlePreComplete)) return [3 /*break*/, 3];
4909
4908
  return [4 /*yield*/, props.bareSettings.bareUpdateHandlePreComplete(selectedData)];
4910
4909
  case 2:
4911
4910
  preComplete =
4912
- _p.sent();
4913
- _p.label = 3;
4911
+ _m.sent();
4912
+ _m.label = 3;
4914
4913
  case 3:
4915
4914
  if (!preComplete)
4916
4915
  throw "Error";
4917
- if (!((_c = props.bareSettings) === null || _c === void 0 ? void 0 : _c.bareUpdateHandleComplete)) return [3 /*break*/, 5];
4916
+ if (!((_b = props.bareSettings) === null || _b === void 0 ? void 0 : _b.bareUpdateHandleComplete)) return [3 /*break*/, 5];
4918
4917
  return [4 /*yield*/, props.bareSettings.bareUpdateHandleComplete(selectedData)];
4919
4918
  case 4:
4920
- _p.sent();
4921
- return [3 /*break*/, 9];
4919
+ _m.sent();
4920
+ return [3 /*break*/, 7];
4922
4921
  case 5: return [4 /*yield*/, handleSubmitData(undefined, undefined, undefined, undefined, undefined, undefined, isDraft)];
4923
4922
  case 6:
4924
- res = _p.sent();
4925
- if (!res) return [3 /*break*/, 9];
4926
- if (!(((_d = props.bareSettings) === null || _d === void 0 ? void 0 : _d.bareUpdateHandlePostComplete) && !isOffline)) return [3 /*break*/, 8];
4927
- return [4 /*yield*/, props.bareSettings.bareUpdateHandlePostComplete(__assign((_a = {}, _a[serverId] = res, _a), selectedData))];
4928
- case 7:
4929
- _p.sent();
4930
- _p.label = 8;
4931
- case 8:
4932
- handleCheckOfflineDataLength();
4933
- if (isDraft) {
4934
- // INFO: advance the baseline after a successful draft save so that
4935
- // subsequent saves only diff against what was just persisted.
4936
- // Without this, listObject edits saved in a previous draft would be
4937
- // re-sent on every subsequent save (harmless but wasteful), and the
4938
- // "skip write if nothing changed" short-circuit would never trigger.
4939
- if ((_e = props.bareSettings) === null || _e === void 0 ? void 0 : _e.bareUpsertPartialUpdate) {
4940
- loadedSelectedData.current = (0, updateModule_1.handleClonedDataAttribute)(selectedData, structure, props.devSettings.server, true, showId);
4941
- // INFO: Reset dirty tracking after successful save — the new baseline
4942
- // is the saved state, so all fields start "clean" again.
4943
- dirtyFieldsRef.current.clear();
4944
- }
4945
- updatedMarkdownData_1 = {};
4946
- structure.forEach(function (eachAttribute) {
4947
- var _a, _b;
4948
- if (eachAttribute.type === "markdown") {
4949
- var originalIndex = structure.findIndex(function (m) { return m.id === eachAttribute.id; });
4950
- var refIndex = (_a = eachAttribute.refIndex) !== null && _a !== void 0 ? _a : originalIndex;
4951
- var ref_1 = modalFormInputRefs[refIndex];
4952
- if ((_b = ref_1 === null || ref_1 === void 0 ? void 0 : ref_1.current) === null || _b === void 0 ? void 0 : _b.getMarkdown) {
4953
- updatedMarkdownData_1[eachAttribute.id] =
4954
- ref_1.current.getMarkdown();
4955
- }
4923
+ res = _m.sent();
4924
+ if (res) {
4925
+ // INFO: bareUpdateHandlePostComplete is deliberately not called here.
4926
+ // handleSubmitData already calls it once, right after the write, with
4927
+ // the processed record and only when the write reached the server.
4928
+ // A second call here ran every consumer side effect (emails, Drive
4929
+ // uploads, PDF generation) twice per save.
4930
+ handleCheckOfflineDataLength();
4931
+ if (isDraft) {
4932
+ // INFO: advance the baseline after a successful draft save so that
4933
+ // subsequent saves only diff against what was just persisted.
4934
+ // Without this, listObject edits saved in a previous draft would be
4935
+ // re-sent on every subsequent save (harmless but wasteful), and the
4936
+ // "skip write if nothing changed" short-circuit would never trigger.
4937
+ if ((_c = props.bareSettings) === null || _c === void 0 ? void 0 : _c.bareUpsertPartialUpdate) {
4938
+ loadedSelectedData.current = (0, updateModule_1.handleClonedDataAttribute)(selectedData, structure, props.devSettings.server, true, showId);
4939
+ // INFO: Reset dirty tracking after successful save — the new baseline
4940
+ // is the saved state, so all fields start "clean" again.
4941
+ dirtyFieldsRef.current.clear();
4956
4942
  }
4957
- });
4958
- uploadedData_2 = lastUploadedDataRef.current;
4959
- if (uploadedData_2) {
4960
- uploadTypes_1 = [
4961
- "image",
4962
- "file",
4963
- "multipleImage",
4964
- "multipleFile",
4965
- "canvas",
4966
- ];
4943
+ updatedMarkdownData_1 = {};
4967
4944
  structure.forEach(function (eachAttribute) {
4968
- if (uploadTypes_1.includes(eachAttribute.type)) {
4969
- if (eachAttribute.type === "canvas" &&
4970
- !eachAttribute.enableImageUpload)
4971
- return;
4972
- if (uploadedData_2[eachAttribute.id] !== undefined) {
4945
+ var _a, _b;
4946
+ if (eachAttribute.type === "markdown") {
4947
+ var originalIndex = structure.findIndex(function (m) { return m.id === eachAttribute.id; });
4948
+ var refIndex = (_a = eachAttribute.refIndex) !== null && _a !== void 0 ? _a : originalIndex;
4949
+ var ref_1 = modalFormInputRefs[refIndex];
4950
+ if ((_b = ref_1 === null || ref_1 === void 0 ? void 0 : ref_1.current) === null || _b === void 0 ? void 0 : _b.getMarkdown) {
4973
4951
  updatedMarkdownData_1[eachAttribute.id] =
4974
- uploadedData_2[eachAttribute.id];
4952
+ ref_1.current.getMarkdown();
4975
4953
  }
4976
4954
  }
4977
4955
  });
4978
- }
4979
- if (Object.keys(updatedMarkdownData_1).length > 0) {
4980
- // INFO: Post-save markdown/upload data sync is programmatic, not user-driven
4981
- programmaticUpdateRef.current = true;
4982
- setSelectedData(function (prev) { return (__assign(__assign({}, prev), updatedMarkdownData_1)); });
4983
- }
4984
- if (props.id === "new" || !props.id) {
4985
- (_g = (_f = props.organise) === null || _f === void 0 ? void 0 : _f.handleNavigate) === null || _g === void 0 ? void 0 : _g.call(_f, "update", res, (_h = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.id) !== null && _h !== void 0 ? _h : "general");
4986
- }
4987
- if (silentDraftRef.current) {
4988
- silentDraftRef.current = false;
4989
- }
4990
- else {
4991
- setNotification({
4992
- type: true,
4993
- title: "Draft Saved",
4994
- msg: "Your changes have been saved",
4995
- });
4996
- }
4997
- }
4998
- else {
4999
- // INFO: Non-draft (final submit) — reset dirty tracking and rebase baseline.
5000
- // Usually the component navigates away, but in case it doesn't (e.g. custom onComplete
5001
- // that stays on the same page), ensure clean state for subsequent interactions.
5002
- if ((_j = props.bareSettings) === null || _j === void 0 ? void 0 : _j.bareUpsertPartialUpdate) {
5003
- loadedSelectedData.current = (0, updateModule_1.handleClonedDataAttribute)(selectedData, structure, props.devSettings.server, true, showId);
5004
- dirtyFieldsRef.current.clear();
5005
- }
5006
- if (props.onComplete) {
5007
- props.onComplete(res);
4956
+ uploadedData_2 = lastUploadedDataRef.current;
4957
+ if (uploadedData_2) {
4958
+ uploadTypes_1 = [
4959
+ "image",
4960
+ "file",
4961
+ "multipleImage",
4962
+ "multipleFile",
4963
+ "canvas",
4964
+ ];
4965
+ structure.forEach(function (eachAttribute) {
4966
+ if (uploadTypes_1.includes(eachAttribute.type)) {
4967
+ if (eachAttribute.type === "canvas" &&
4968
+ !eachAttribute.enableImageUpload)
4969
+ return;
4970
+ if (uploadedData_2[eachAttribute.id] !== undefined) {
4971
+ updatedMarkdownData_1[eachAttribute.id] =
4972
+ uploadedData_2[eachAttribute.id];
4973
+ }
4974
+ }
4975
+ });
4976
+ }
4977
+ if (Object.keys(updatedMarkdownData_1).length > 0) {
4978
+ // INFO: Post-save markdown/upload data sync is programmatic, not user-driven
4979
+ programmaticUpdateRef.current = true;
4980
+ setSelectedData(function (prev) { return (__assign(__assign({}, prev), updatedMarkdownData_1)); });
4981
+ }
4982
+ if (props.id === "new" || !props.id) {
4983
+ (_e = (_d = props.organise) === null || _d === void 0 ? void 0 : _d.handleNavigate) === null || _e === void 0 ? void 0 : _e.call(_d, "update", res, (_f = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.id) !== null && _f !== void 0 ? _f : "general");
4984
+ }
4985
+ if (silentDraftRef.current) {
4986
+ silentDraftRef.current = false;
4987
+ }
4988
+ else {
4989
+ setNotification({
4990
+ type: true,
4991
+ title: "Draft Saved",
4992
+ msg: "Your changes have been saved",
4993
+ });
4994
+ }
5008
4995
  }
5009
4996
  else {
5010
- if (selectedTab) {
5011
- (_l = (_k = props.organise) === null || _k === void 0 ? void 0 : _k.handleNavigate) === null || _l === void 0 ? void 0 : _l.call(_k, "read", res, selectedTab.id);
4997
+ // INFO: Non-draft (final submit) — reset dirty tracking and rebase baseline.
4998
+ // Usually the component navigates away, but in case it doesn't (e.g. custom onComplete
4999
+ // that stays on the same page), ensure clean state for subsequent interactions.
5000
+ if ((_g = props.bareSettings) === null || _g === void 0 ? void 0 : _g.bareUpsertPartialUpdate) {
5001
+ loadedSelectedData.current = (0, updateModule_1.handleClonedDataAttribute)(selectedData, structure, props.devSettings.server, true, showId);
5002
+ dirtyFieldsRef.current.clear();
5003
+ }
5004
+ if (props.onComplete) {
5005
+ props.onComplete(res);
5006
+ }
5007
+ else {
5008
+ if (selectedTab) {
5009
+ (_j = (_h = props.organise) === null || _h === void 0 ? void 0 : _h.handleNavigate) === null || _j === void 0 ? void 0 : _j.call(_h, "read", res, selectedTab.id);
5010
+ }
5011
+ else
5012
+ (_l = (_k = props.organise) === null || _k === void 0 ? void 0 : _k.handleNavigate) === null || _l === void 0 ? void 0 : _l.call(_k, "read", res, "general");
5012
5013
  }
5013
- else
5014
- (_o = (_m = props.organise) === null || _m === void 0 ? void 0 : _m.handleNavigate) === null || _o === void 0 ? void 0 : _o.call(_m, "read", res, "general");
5015
5014
  }
5016
5015
  }
5017
- _p.label = 9;
5018
- case 9:
5016
+ _m.label = 7;
5017
+ case 7:
5019
5018
  setModalVisible(false);
5020
5019
  setLoading(false);
5021
5020
  isSubmittingRef.current = false;
5022
- return [3 /*break*/, 11];
5023
- case 10:
5024
- err_23 = _p.sent();
5021
+ return [3 /*break*/, 9];
5022
+ case 8:
5023
+ err_23 = _m.sent();
5025
5024
  setModalVisible(false);
5026
5025
  setLoading(false);
5027
5026
  isSubmittingRef.current = false;
5028
- return [3 /*break*/, 11];
5029
- case 11: return [2 /*return*/];
5027
+ return [3 /*break*/, 9];
5028
+ case 9: return [2 /*return*/];
5030
5029
  }
5031
5030
  });
5032
5031
  }); };