@maxax/ui 1.1.24 → 1.1.26
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/dist/components/basic-button-import-preview/BasicButtonImportPreview.vue.d.ts.map +1 -1
- package/dist/components/basic-button-import-preview/interface.d.ts +1 -0
- package/dist/components/basic-button-import-preview/interface.d.ts.map +1 -1
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +18 -0
- package/dist/index.mjs.map +1 -1
- package/dist/theme-chalk/index.css +1 -1
- package/dist/theme-chalk/light.css +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -8394,6 +8394,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
8394
8394
|
previewTableProps: {},
|
|
8395
8395
|
previewTitle: {},
|
|
8396
8396
|
saveApi: {},
|
|
8397
|
+
beforeSaveInterceptor: {},
|
|
8397
8398
|
beforeFetchSave: {},
|
|
8398
8399
|
afterFetchSave: {}
|
|
8399
8400
|
},
|
|
@@ -8408,6 +8409,21 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
8408
8409
|
const attrs = useAttrs();
|
|
8409
8410
|
const currentFile = ref(null);
|
|
8410
8411
|
const currentChecked = ref(false);
|
|
8412
|
+
async function runBeforeSaveGuard(payload) {
|
|
8413
|
+
if (!props.beforeSaveInterceptor || !isFunction$1(props.beforeSaveInterceptor)) return true;
|
|
8414
|
+
try {
|
|
8415
|
+
const result = await props.beforeSaveInterceptor(payload);
|
|
8416
|
+
if (!result) return false;
|
|
8417
|
+
if (isString$1(result) && result) {
|
|
8418
|
+
XBasicNotification.error(result);
|
|
8419
|
+
return false;
|
|
8420
|
+
}
|
|
8421
|
+
return true;
|
|
8422
|
+
} catch (error) {
|
|
8423
|
+
console.error(error);
|
|
8424
|
+
return false;
|
|
8425
|
+
}
|
|
8426
|
+
}
|
|
8411
8427
|
async function onImport(file, checked, showPreview = false) {
|
|
8412
8428
|
var _a, _b, _c, _d;
|
|
8413
8429
|
const { importApi, beforeFetchImport, afterFetchImport } = props;
|
|
@@ -8473,6 +8489,8 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
8473
8489
|
async function onPreviewConfirm({ data, records }) {
|
|
8474
8490
|
var _a, _b;
|
|
8475
8491
|
if (!currentFile.value) return;
|
|
8492
|
+
const canSave = await runBeforeSaveGuard({ data, records, checked: currentChecked.value, file: currentFile.value });
|
|
8493
|
+
if (!canSave) return;
|
|
8476
8494
|
if (!props.saveApi) {
|
|
8477
8495
|
emit("preview", { data, checked: currentChecked.value, file: currentFile.value, records });
|
|
8478
8496
|
(_a = uploadModalRef.value) == null ? void 0 : _a.hide();
|