@epie/bi-crud 2.0.45 → 2.0.48
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/lib/bi-crud.esm.js
CHANGED
|
@@ -8041,6 +8041,52 @@ var src = {exports: {}};
|
|
|
8041
8041
|
})(src, src.exports);
|
|
8042
8042
|
var merge$1 = /*@__PURE__*/getDefaultExportFromCjs(src.exports);
|
|
8043
8043
|
|
|
8044
|
+
/**
|
|
8045
|
+
* 将 crud.params 的内部键名映射为请求参数名(dict.pagination / search / sort 的「键」为内部名,「值」为请求名)
|
|
8046
|
+
*/
|
|
8047
|
+
function replaceParamsByDict(params, dict) {
|
|
8048
|
+
const {
|
|
8049
|
+
pagination = {},
|
|
8050
|
+
search = {},
|
|
8051
|
+
sort = {}
|
|
8052
|
+
} = dict;
|
|
8053
|
+
const a = {
|
|
8054
|
+
...params
|
|
8055
|
+
};
|
|
8056
|
+
const b = {
|
|
8057
|
+
...pagination,
|
|
8058
|
+
...search,
|
|
8059
|
+
...sort
|
|
8060
|
+
};
|
|
8061
|
+
// 清理 null/undefined,避免 GET 序列化成字符串 "null"/"undefined"
|
|
8062
|
+
for (const k in a) {
|
|
8063
|
+
if (a[k] === null || a[k] === undefined) {
|
|
8064
|
+
delete a[k];
|
|
8065
|
+
}
|
|
8066
|
+
}
|
|
8067
|
+
for (const i in b) {
|
|
8068
|
+
if (b[i] === undefined || b[i] === null) continue;
|
|
8069
|
+
if (!Object.prototype.hasOwnProperty.call(a, i)) continue;
|
|
8070
|
+
if (i !== b[i]) {
|
|
8071
|
+
a[`_${b[i]}`] = a[i];
|
|
8072
|
+
delete a[i];
|
|
8073
|
+
}
|
|
8074
|
+
}
|
|
8075
|
+
for (const i in a) {
|
|
8076
|
+
if (i[0] === "_") {
|
|
8077
|
+
a[i.substring(1)] = a[i];
|
|
8078
|
+
delete a[i];
|
|
8079
|
+
}
|
|
8080
|
+
}
|
|
8081
|
+
// 再清理一次,覆盖映射后的键
|
|
8082
|
+
for (const k in a) {
|
|
8083
|
+
if (a[k] === null || a[k] === undefined) {
|
|
8084
|
+
delete a[k];
|
|
8085
|
+
}
|
|
8086
|
+
}
|
|
8087
|
+
return a;
|
|
8088
|
+
}
|
|
8089
|
+
|
|
8044
8090
|
function isArray$1(value) {
|
|
8045
8091
|
if (typeof Array.isArray === "function") {
|
|
8046
8092
|
return Array.isArray(value);
|
|
@@ -8449,36 +8495,7 @@ function useHelper({
|
|
|
8449
8495
|
}
|
|
8450
8496
|
// 根据字典替换请求参数
|
|
8451
8497
|
function paramsReplace(params) {
|
|
8452
|
-
|
|
8453
|
-
pagination,
|
|
8454
|
-
search,
|
|
8455
|
-
sort
|
|
8456
|
-
} = crud.dict;
|
|
8457
|
-
// 请求参数
|
|
8458
|
-
const a = {
|
|
8459
|
-
...params
|
|
8460
|
-
};
|
|
8461
|
-
// 字典
|
|
8462
|
-
const b = {
|
|
8463
|
-
...pagination,
|
|
8464
|
-
...search,
|
|
8465
|
-
...sort
|
|
8466
|
-
};
|
|
8467
|
-
for (const i in b) {
|
|
8468
|
-
if (a[i]) {
|
|
8469
|
-
if (i != b[i]) {
|
|
8470
|
-
a[`_${b[i]}`] = a[i];
|
|
8471
|
-
delete a[i];
|
|
8472
|
-
}
|
|
8473
|
-
}
|
|
8474
|
-
}
|
|
8475
|
-
for (const i in a) {
|
|
8476
|
-
if (i[0] === "_") {
|
|
8477
|
-
a[i.substr(1)] = a[i];
|
|
8478
|
-
delete a[i];
|
|
8479
|
-
}
|
|
8480
|
-
}
|
|
8481
|
-
return a;
|
|
8498
|
+
return replaceParamsByDict(params, crud.dict);
|
|
8482
8499
|
}
|
|
8483
8500
|
// 刷新请求
|
|
8484
8501
|
function refresh(params) {
|
|
@@ -28477,7 +28494,7 @@ var Pagination = defineComponent({
|
|
|
28477
28494
|
currentPage.value = res.currentPage || res.page || 1;
|
|
28478
28495
|
pageSize.value = res.pageSize || res.size || 20;
|
|
28479
28496
|
total.value = res.total | 0;
|
|
28480
|
-
crud.params.
|
|
28497
|
+
crud.params.pageSize = pageSize.value;
|
|
28481
28498
|
}
|
|
28482
28499
|
}
|
|
28483
28500
|
mitt.on("crud.refresh", ({
|
|
@@ -28658,38 +28675,8 @@ var ExportBtn = defineComponent({
|
|
|
28658
28675
|
} = useCore();
|
|
28659
28676
|
const exportVisible = ref(false);
|
|
28660
28677
|
const exportLoading = ref(false);
|
|
28661
|
-
// 根据字典替换请求参数
|
|
28662
28678
|
function paramsReplaceExport(params) {
|
|
28663
|
-
|
|
28664
|
-
pagination,
|
|
28665
|
-
search,
|
|
28666
|
-
sort
|
|
28667
|
-
} = crud.dict;
|
|
28668
|
-
// 请求参数
|
|
28669
|
-
const a = {
|
|
28670
|
-
...params
|
|
28671
|
-
};
|
|
28672
|
-
// 字典
|
|
28673
|
-
const b = {
|
|
28674
|
-
...pagination,
|
|
28675
|
-
...search,
|
|
28676
|
-
...sort
|
|
28677
|
-
};
|
|
28678
|
-
for (const i in b) {
|
|
28679
|
-
if (a[i]) {
|
|
28680
|
-
if (i != b[i]) {
|
|
28681
|
-
a[`_${b[i]}`] = a[i];
|
|
28682
|
-
delete a[i];
|
|
28683
|
-
}
|
|
28684
|
-
}
|
|
28685
|
-
}
|
|
28686
|
-
for (const i in a) {
|
|
28687
|
-
if (i[0] === "_") {
|
|
28688
|
-
a[i.substr(1)] = a[i];
|
|
28689
|
-
delete a[i];
|
|
28690
|
-
}
|
|
28691
|
-
}
|
|
28692
|
-
return a;
|
|
28679
|
+
return replaceParamsByDict(params, crud.dict);
|
|
28693
28680
|
}
|
|
28694
28681
|
const onExport = () => {
|
|
28695
28682
|
return new Promise(r1 => {
|
package/lib/bi-crud.umd.js
CHANGED
|
@@ -8044,6 +8044,52 @@
|
|
|
8044
8044
|
})(src, src.exports);
|
|
8045
8045
|
var merge$1 = /*@__PURE__*/getDefaultExportFromCjs(src.exports);
|
|
8046
8046
|
|
|
8047
|
+
/**
|
|
8048
|
+
* 将 crud.params 的内部键名映射为请求参数名(dict.pagination / search / sort 的「键」为内部名,「值」为请求名)
|
|
8049
|
+
*/
|
|
8050
|
+
function replaceParamsByDict(params, dict) {
|
|
8051
|
+
const {
|
|
8052
|
+
pagination = {},
|
|
8053
|
+
search = {},
|
|
8054
|
+
sort = {}
|
|
8055
|
+
} = dict;
|
|
8056
|
+
const a = {
|
|
8057
|
+
...params
|
|
8058
|
+
};
|
|
8059
|
+
const b = {
|
|
8060
|
+
...pagination,
|
|
8061
|
+
...search,
|
|
8062
|
+
...sort
|
|
8063
|
+
};
|
|
8064
|
+
// 清理 null/undefined,避免 GET 序列化成字符串 "null"/"undefined"
|
|
8065
|
+
for (const k in a) {
|
|
8066
|
+
if (a[k] === null || a[k] === undefined) {
|
|
8067
|
+
delete a[k];
|
|
8068
|
+
}
|
|
8069
|
+
}
|
|
8070
|
+
for (const i in b) {
|
|
8071
|
+
if (b[i] === undefined || b[i] === null) continue;
|
|
8072
|
+
if (!Object.prototype.hasOwnProperty.call(a, i)) continue;
|
|
8073
|
+
if (i !== b[i]) {
|
|
8074
|
+
a[`_${b[i]}`] = a[i];
|
|
8075
|
+
delete a[i];
|
|
8076
|
+
}
|
|
8077
|
+
}
|
|
8078
|
+
for (const i in a) {
|
|
8079
|
+
if (i[0] === "_") {
|
|
8080
|
+
a[i.substring(1)] = a[i];
|
|
8081
|
+
delete a[i];
|
|
8082
|
+
}
|
|
8083
|
+
}
|
|
8084
|
+
// 再清理一次,覆盖映射后的键
|
|
8085
|
+
for (const k in a) {
|
|
8086
|
+
if (a[k] === null || a[k] === undefined) {
|
|
8087
|
+
delete a[k];
|
|
8088
|
+
}
|
|
8089
|
+
}
|
|
8090
|
+
return a;
|
|
8091
|
+
}
|
|
8092
|
+
|
|
8047
8093
|
function isArray$1(value) {
|
|
8048
8094
|
if (typeof Array.isArray === "function") {
|
|
8049
8095
|
return Array.isArray(value);
|
|
@@ -8452,36 +8498,7 @@
|
|
|
8452
8498
|
}
|
|
8453
8499
|
// 根据字典替换请求参数
|
|
8454
8500
|
function paramsReplace(params) {
|
|
8455
|
-
|
|
8456
|
-
pagination,
|
|
8457
|
-
search,
|
|
8458
|
-
sort
|
|
8459
|
-
} = crud.dict;
|
|
8460
|
-
// 请求参数
|
|
8461
|
-
const a = {
|
|
8462
|
-
...params
|
|
8463
|
-
};
|
|
8464
|
-
// 字典
|
|
8465
|
-
const b = {
|
|
8466
|
-
...pagination,
|
|
8467
|
-
...search,
|
|
8468
|
-
...sort
|
|
8469
|
-
};
|
|
8470
|
-
for (const i in b) {
|
|
8471
|
-
if (a[i]) {
|
|
8472
|
-
if (i != b[i]) {
|
|
8473
|
-
a[`_${b[i]}`] = a[i];
|
|
8474
|
-
delete a[i];
|
|
8475
|
-
}
|
|
8476
|
-
}
|
|
8477
|
-
}
|
|
8478
|
-
for (const i in a) {
|
|
8479
|
-
if (i[0] === "_") {
|
|
8480
|
-
a[i.substr(1)] = a[i];
|
|
8481
|
-
delete a[i];
|
|
8482
|
-
}
|
|
8483
|
-
}
|
|
8484
|
-
return a;
|
|
8501
|
+
return replaceParamsByDict(params, crud.dict);
|
|
8485
8502
|
}
|
|
8486
8503
|
// 刷新请求
|
|
8487
8504
|
function refresh(params) {
|
|
@@ -28480,7 +28497,7 @@
|
|
|
28480
28497
|
currentPage.value = res.currentPage || res.page || 1;
|
|
28481
28498
|
pageSize.value = res.pageSize || res.size || 20;
|
|
28482
28499
|
total.value = res.total | 0;
|
|
28483
|
-
crud.params.
|
|
28500
|
+
crud.params.pageSize = pageSize.value;
|
|
28484
28501
|
}
|
|
28485
28502
|
}
|
|
28486
28503
|
mitt.on("crud.refresh", ({
|
|
@@ -28661,38 +28678,8 @@
|
|
|
28661
28678
|
} = useCore();
|
|
28662
28679
|
const exportVisible = vue.ref(false);
|
|
28663
28680
|
const exportLoading = vue.ref(false);
|
|
28664
|
-
// 根据字典替换请求参数
|
|
28665
28681
|
function paramsReplaceExport(params) {
|
|
28666
|
-
|
|
28667
|
-
pagination,
|
|
28668
|
-
search,
|
|
28669
|
-
sort
|
|
28670
|
-
} = crud.dict;
|
|
28671
|
-
// 请求参数
|
|
28672
|
-
const a = {
|
|
28673
|
-
...params
|
|
28674
|
-
};
|
|
28675
|
-
// 字典
|
|
28676
|
-
const b = {
|
|
28677
|
-
...pagination,
|
|
28678
|
-
...search,
|
|
28679
|
-
...sort
|
|
28680
|
-
};
|
|
28681
|
-
for (const i in b) {
|
|
28682
|
-
if (a[i]) {
|
|
28683
|
-
if (i != b[i]) {
|
|
28684
|
-
a[`_${b[i]}`] = a[i];
|
|
28685
|
-
delete a[i];
|
|
28686
|
-
}
|
|
28687
|
-
}
|
|
28688
|
-
}
|
|
28689
|
-
for (const i in a) {
|
|
28690
|
-
if (i[0] === "_") {
|
|
28691
|
-
a[i.substr(1)] = a[i];
|
|
28692
|
-
delete a[i];
|
|
28693
|
-
}
|
|
28694
|
-
}
|
|
28695
|
-
return a;
|
|
28682
|
+
return replaceParamsByDict(params, crud.dict);
|
|
28696
28683
|
}
|
|
28697
28684
|
const onExport = () => {
|
|
28698
28685
|
return new Promise(r1 => {
|
|
@@ -14,7 +14,7 @@ export declare const epieDescriptionsProps: () => {
|
|
|
14
14
|
default: string;
|
|
15
15
|
};
|
|
16
16
|
size: {
|
|
17
|
-
type: PropType<"" | "
|
|
17
|
+
type: PropType<"" | "small" | "default" | "large">;
|
|
18
18
|
};
|
|
19
19
|
title: {
|
|
20
20
|
type: StringConstructor;
|
|
@@ -44,7 +44,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
44
44
|
default: string;
|
|
45
45
|
};
|
|
46
46
|
size: {
|
|
47
|
-
type: PropType<"" | "
|
|
47
|
+
type: PropType<"" | "small" | "default" | "large">;
|
|
48
48
|
};
|
|
49
49
|
title: {
|
|
50
50
|
type: StringConstructor;
|
|
@@ -75,7 +75,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
75
75
|
default: string;
|
|
76
76
|
};
|
|
77
77
|
size: {
|
|
78
|
-
type: PropType<"" | "
|
|
78
|
+
type: PropType<"" | "small" | "default" | "large">;
|
|
79
79
|
};
|
|
80
80
|
title: {
|
|
81
81
|
type: StringConstructor;
|
package/lib/hooks/core.d.ts
CHANGED
package/lib/utils/index.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ export declare function contains(parent: any, node: any): any;
|
|
|
15
15
|
export declare function deepMerge(a: any, b: any): any;
|
|
16
16
|
export declare function addClass(el: Element, name: string): void;
|
|
17
17
|
export declare function removeClass(el: Element, name: string): void;
|
|
18
|
+
export { replaceParamsByDict } from "./paramsReplace";
|
|
18
19
|
export { cloneDeep, flat, merge };
|