@maxax/ui 1.1.23 → 1.1.25
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 +14 -2
- package/dist/components/basic-button-import-preview/BasicButtonImportPreview.vue.d.ts.map +1 -1
- package/dist/components/basic-button-import-preview/interface.d.ts +12 -3
- package/dist/components/basic-button-import-preview/interface.d.ts.map +1 -1
- package/dist/index.cjs +26 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +26 -11
- 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
|
@@ -8387,14 +8387,17 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
8387
8387
|
href: {},
|
|
8388
8388
|
importApi: {},
|
|
8389
8389
|
templateApi: {},
|
|
8390
|
-
|
|
8390
|
+
beforeFetchImport: {},
|
|
8391
|
+
afterFetchImport: {},
|
|
8391
8392
|
listField: { default: "resultList" },
|
|
8392
8393
|
previewColumns: {},
|
|
8393
8394
|
previewTableProps: {},
|
|
8394
8395
|
previewTitle: {},
|
|
8395
|
-
|
|
8396
|
+
saveApi: {},
|
|
8397
|
+
beforeFetchSave: {},
|
|
8398
|
+
afterFetchSave: {}
|
|
8396
8399
|
},
|
|
8397
|
-
emits: ["import", "preview"],
|
|
8400
|
+
emits: ["import", "preview", "save"],
|
|
8398
8401
|
setup(__props, { emit: __emit }) {
|
|
8399
8402
|
const props = __props;
|
|
8400
8403
|
const emit = __emit;
|
|
@@ -8407,19 +8410,19 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
8407
8410
|
const currentChecked = ref(false);
|
|
8408
8411
|
async function onImport(file, checked, showPreview = false) {
|
|
8409
8412
|
var _a, _b, _c, _d;
|
|
8410
|
-
const { importApi,
|
|
8413
|
+
const { importApi, beforeFetchImport, afterFetchImport } = props;
|
|
8411
8414
|
if (!importApi) return;
|
|
8412
8415
|
try {
|
|
8413
8416
|
(_a = uploadModalRef.value) == null ? void 0 : _a.showLoading();
|
|
8414
8417
|
const po = new FormData();
|
|
8415
8418
|
po.append("file", file);
|
|
8416
|
-
const params =
|
|
8419
|
+
const params = beforeFetchImport ? beforeFetchImport(po) : po;
|
|
8417
8420
|
const res = await importApi(params);
|
|
8418
8421
|
if (showPreview) {
|
|
8419
8422
|
const isArrayResult = Array.isArray(res.data);
|
|
8420
8423
|
let resultItems = isArrayResult ? res.data : get(res.data, props.listField);
|
|
8421
|
-
if (
|
|
8422
|
-
resultItems = await
|
|
8424
|
+
if (afterFetchImport && isFunction$1(afterFetchImport)) {
|
|
8425
|
+
resultItems = await afterFetchImport(resultItems) || resultItems;
|
|
8423
8426
|
}
|
|
8424
8427
|
currentFile.value = file;
|
|
8425
8428
|
currentChecked.value = checked;
|
|
@@ -8467,11 +8470,23 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
8467
8470
|
}).catch(() => {
|
|
8468
8471
|
});
|
|
8469
8472
|
}
|
|
8470
|
-
function onPreviewConfirm({ data, records }) {
|
|
8471
|
-
var _a;
|
|
8473
|
+
async function onPreviewConfirm({ data, records }) {
|
|
8474
|
+
var _a, _b;
|
|
8472
8475
|
if (!currentFile.value) return;
|
|
8473
|
-
|
|
8474
|
-
|
|
8476
|
+
if (!props.saveApi) {
|
|
8477
|
+
emit("preview", { data, checked: currentChecked.value, file: currentFile.value, records });
|
|
8478
|
+
(_a = uploadModalRef.value) == null ? void 0 : _a.hide();
|
|
8479
|
+
return;
|
|
8480
|
+
}
|
|
8481
|
+
try {
|
|
8482
|
+
const params = props.beforeFetchSave ? props.beforeFetchSave({ data, records }) : { dtoList: data };
|
|
8483
|
+
const res = await props.saveApi(params);
|
|
8484
|
+
emit("save", { data: res, checked: currentChecked.value, file: currentFile.value, records });
|
|
8485
|
+
} catch (error) {
|
|
8486
|
+
console.error(error);
|
|
8487
|
+
} finally {
|
|
8488
|
+
(_b = uploadModalRef.value) == null ? void 0 : _b.hide();
|
|
8489
|
+
}
|
|
8475
8490
|
}
|
|
8476
8491
|
function onClickHandler() {
|
|
8477
8492
|
var _a;
|