kui-crm_actions 0.0.123 → 0.0.125

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/index.d.ts CHANGED
@@ -971,7 +971,7 @@ type InspectionFeedbackProps = {
971
971
 
972
972
  declare const _default: (props: InspectionFeedbackProps) => JSX.Element | null;
973
973
 
974
- declare const useMetersValues: (formStore: MultistepForm<any>, metersStore: ApartmentMetersStoreInterface, onLoad?: (() => void) | undefined) => void;
974
+ declare const useMetersValues: (formStore: MultistepForm<any>, metersStore: ApartmentMetersStoreInterface, shouldBeLoad?: boolean | undefined, onLoad?: (() => void) | undefined) => void;
975
975
 
976
976
  declare class FillingListStore {
977
977
  fillingList: FillingCheckParams[];
@@ -981,7 +981,7 @@ declare class FillingListStore {
981
981
  updateFillingList: (fillingList: FillingListItemModel[]) => void;
982
982
  }
983
983
 
984
- declare const useFillingList: (apartmentId: number | null, formStore: MultistepForm<any>, fillingStore: FillingListStore, onLoad?: (() => void) | undefined) => void;
984
+ declare const useFillingList: (apartmentId: number | null, formStore: MultistepForm<any>, fillingStore: FillingListStore, shouldBeLoad?: boolean | undefined, onLoad?: (() => void) | undefined) => void;
985
985
 
986
986
  type AddedMetersBlockProps = {
987
987
  formStore: MultistepForm<any>
package/index.js CHANGED
@@ -1092,12 +1092,13 @@ var StyledCard$1 = styled(Grid)(templateObject_1$4 || (templateObject_1$4 = __ma
1092
1092
  var StyledCheckbox = styled(CheckboxWithController)(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"], ["\n .KUI-Label_checkbox {\n margin-left: 0;\n }\n"])));
1093
1093
  var templateObject_1$4, templateObject_2$3;
1094
1094
 
1095
- var useMetersValues = function (formStore, metersStore, onLoad) {
1095
+ var useMetersValues = function (formStore, metersStore, shouldBeLoad, onLoad) {
1096
1096
  var loadMeters = function () { return __awaiter(void 0, void 0, void 0, function () {
1097
1097
  var _a, _b;
1098
1098
  return __generator(this, function (_c) {
1099
1099
  switch (_c.label) {
1100
1100
  case 0:
1101
+ if (!shouldBeLoad) return [3 /*break*/, 3];
1101
1102
  if (!!((_b = (_a = formStore.fields) === null || _a === void 0 ? void 0 : _a.meters) === null || _b === void 0 ? void 0 : _b.length)) return [3 /*break*/, 2];
1102
1103
  return [4 /*yield*/, metersStore.fetchMeters()];
1103
1104
  case 1:
@@ -1105,13 +1106,18 @@ var useMetersValues = function (formStore, metersStore, onLoad) {
1105
1106
  if (onLoad)
1106
1107
  onLoad();
1107
1108
  _c.label = 2;
1108
- case 2: return [2 /*return*/];
1109
+ case 2: return [3 /*break*/, 4];
1110
+ case 3:
1111
+ if (shouldBeLoad === false && onLoad)
1112
+ onLoad();
1113
+ _c.label = 4;
1114
+ case 4: return [2 /*return*/];
1109
1115
  }
1110
1116
  });
1111
1117
  }); };
1112
1118
  useEffect(function () {
1113
1119
  loadMeters();
1114
- }, []);
1120
+ }, [shouldBeLoad]);
1115
1121
  useEffect(function () {
1116
1122
  if (!metersStore.loader.isLoading) {
1117
1123
  formStore.updateFormFields({ meters: metersStore.meters });
@@ -1154,12 +1160,13 @@ var FillingListStore = /** @class */ (function () {
1154
1160
  return FillingListStore;
1155
1161
  }());
1156
1162
 
1157
- var useFillingList = function (apartmentId, formStore, fillingStore, onLoad) {
1163
+ var useFillingList = function (apartmentId, formStore, fillingStore, shouldBeLoad, onLoad) {
1158
1164
  var loadFillingList = function () { return __awaiter(void 0, void 0, void 0, function () {
1159
1165
  var _a, _b;
1160
1166
  return __generator(this, function (_c) {
1161
1167
  switch (_c.label) {
1162
1168
  case 0:
1169
+ if (!shouldBeLoad) return [3 /*break*/, 3];
1163
1170
  if (!(!((_b = (_a = formStore.fields) === null || _a === void 0 ? void 0 : _a.filling) === null || _b === void 0 ? void 0 : _b.length) && apartmentId)) return [3 /*break*/, 2];
1164
1171
  return [4 /*yield*/, fillingStore.fetchFillingList(apartmentId, "appliance")];
1165
1172
  case 1:
@@ -1167,13 +1174,18 @@ var useFillingList = function (apartmentId, formStore, fillingStore, onLoad) {
1167
1174
  if (onLoad)
1168
1175
  onLoad();
1169
1176
  _c.label = 2;
1170
- case 2: return [2 /*return*/];
1177
+ case 2: return [3 /*break*/, 4];
1178
+ case 3:
1179
+ if (shouldBeLoad === false && onLoad)
1180
+ onLoad();
1181
+ _c.label = 4;
1182
+ case 4: return [2 /*return*/];
1171
1183
  }
1172
1184
  });
1173
1185
  }); };
1174
1186
  useEffect(function () {
1175
1187
  loadFillingList();
1176
- }, [apartmentId]);
1188
+ }, [apartmentId, shouldBeLoad]);
1177
1189
  useEffect(function () {
1178
1190
  var _a, _b;
1179
1191
  if (!fillingStore.loader.isLoading && !((_b = (_a = formStore.fields) === null || _a === void 0 ? void 0 : _a.filling) === null || _b === void 0 ? void 0 : _b.length)) {