@factoringplus/pl-components-pack-v3 0.1.83 → 0.1.86

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.
@@ -22245,6 +22245,14 @@ const vLoading = {
22245
22245
  (_a2 = el[INSTANCE_KEY]) == null ? void 0 : _a2.instance.close();
22246
22246
  }
22247
22247
  };
22248
+ const ElLoading = {
22249
+ install(app) {
22250
+ app.directive("loading", vLoading);
22251
+ app.config.globalProperties.$loading = Loading;
22252
+ },
22253
+ directive: vLoading,
22254
+ service: Loading
22255
+ };
22248
22256
  const messageTypes = ["success", "info", "warning", "error"];
22249
22257
  const messageProps = buildProps({
22250
22258
  customClass: {
@@ -23262,7 +23270,7 @@ const _sfc_main$5 = {
23262
23270
  };
23263
23271
  }
23264
23272
  };
23265
- var PlButton = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-3993cad6"]]);
23273
+ var PlButton = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-3a43898d"]]);
23266
23274
  const PlButtonPlugin = {
23267
23275
  install(app) {
23268
23276
  app.component("PlButton", PlButton);
@@ -38144,7 +38152,7 @@ const formatDateObj = (parseObj, typeToString = false) => {
38144
38152
  recursiveDeep(obj);
38145
38153
  return obj;
38146
38154
  };
38147
- function ApiJs(optionsRequest, isGetResourse = false, token2) {
38155
+ const ApiJs = function(optionsRequest, isGetResourse = false, token2) {
38148
38156
  return new Promise((resolve, reject) => {
38149
38157
  const options = __spreadValues({}, optionsRequest);
38150
38158
  axios({
@@ -38175,6 +38183,49 @@ function ApiJs(optionsRequest, isGetResourse = false, token2) {
38175
38183
  });
38176
38184
  }
38177
38185
  });
38186
+ };
38187
+ const addGetSet = (addWord, method4) => {
38188
+ const arrStr = method4.split("/");
38189
+ const returnStr = arrStr[arrStr.length - 1][0].toUpperCase() + arrStr[arrStr.length - 1].slice(1);
38190
+ return arrStr.length === 1 ? addWord + returnStr : `${arrStr[0]}/${addWord}${returnStr}`;
38191
+ };
38192
+ const parseMessageAlert = (error2) => {
38193
+ let value = "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430";
38194
+ if (!(error2 == null ? void 0 : error2.message)) {
38195
+ if (error2.status === 401 || error2.status === 403) {
38196
+ value = "\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u043F\u0440\u0430\u0432 \u0434\u043B\u044F \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u044F \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438.";
38197
+ } else if (error2.status === 500) {
38198
+ value = "\u0421\u0435\u0440\u0432\u0435\u0440 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D.";
38199
+ }
38200
+ } else {
38201
+ value = error2.message;
38202
+ }
38203
+ ElMessage.error(value);
38204
+ };
38205
+ function loadingAndSetup(bindData, apiCall, apiParams, loadingArr, fastResponse = false, store) {
38206
+ let loadingInstanceArr = null;
38207
+ if (fastResponse) {
38208
+ bindData.value = store.getters[addGetSet("get", apiCall)];
38209
+ } else {
38210
+ loadingInstanceArr = loadingArr.map((element) => ElLoading.service({
38211
+ target: document.getElementById(element)
38212
+ }));
38213
+ }
38214
+ return store.dispatch(apiCall, apiParams).then((res) => {
38215
+ bindData.value = res.data ? res.data : res;
38216
+ store.commit(addGetSet("set", apiCall), bindData.value);
38217
+ return Promise.resolve(res, apiParams);
38218
+ }).catch((error2) => {
38219
+ var _a2;
38220
+ console.error(error2);
38221
+ if ((_a2 = error2.data) == null ? void 0 : _a2.message)
38222
+ parseMessageAlert(error2.data);
38223
+ return Promise.reject(error2, apiParams);
38224
+ }).finally(() => {
38225
+ if (loadingInstanceArr) {
38226
+ loadingInstanceArr.forEach((element) => element.close());
38227
+ }
38228
+ });
38178
38229
  }
38179
38230
  const PlPlugin = {
38180
38231
  install(app) {
@@ -38188,6 +38239,7 @@ const PlPlugin = {
38188
38239
  (_g = PlUploadPlugin.install) == null ? void 0 : _g.call(PlUploadPlugin, app);
38189
38240
  },
38190
38241
  apiJs: ApiJs,
38242
+ loader: loadingAndSetup,
38191
38243
  test: "test"
38192
38244
  };
38193
38245
  export { PlButton, PlButtonPlugin, _sfc_main$3 as PlCertDialog, PlCertDialogPlugin, _sfc_main$7 as PlCurrency, PlCurrencyPlugin, _sfc_main$4 as PlDatePickerRange, PlDatePickerRangePlugin, _sfc_main$2 as PlTable, _sfc_main$1 as PlTableColumn, PlTablePlugin, _sfc_main as PlUpload, PlUploadPlugin, _sfc_main$6 as TestViteNpmComponent, TestViteNpmComponentPlugin, PlPlugin as default };