@epie/bi-crud 2.0.45 → 2.0.47

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.
@@ -8041,6 +8041,40 @@ 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
+ for (const i in b) {
8062
+ if (b[i] === undefined || b[i] === null) continue;
8063
+ if (!Object.prototype.hasOwnProperty.call(a, i)) continue;
8064
+ if (i !== b[i]) {
8065
+ a[`_${b[i]}`] = a[i];
8066
+ delete a[i];
8067
+ }
8068
+ }
8069
+ for (const i in a) {
8070
+ if (i[0] === "_") {
8071
+ a[i.substring(1)] = a[i];
8072
+ delete a[i];
8073
+ }
8074
+ }
8075
+ return a;
8076
+ }
8077
+
8044
8078
  function isArray$1(value) {
8045
8079
  if (typeof Array.isArray === "function") {
8046
8080
  return Array.isArray(value);
@@ -8449,36 +8483,7 @@ function useHelper({
8449
8483
  }
8450
8484
  // 根据字典替换请求参数
8451
8485
  function paramsReplace(params) {
8452
- const {
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;
8486
+ return replaceParamsByDict(params, crud.dict);
8482
8487
  }
8483
8488
  // 刷新请求
8484
8489
  function refresh(params) {
@@ -28477,7 +28482,7 @@ var Pagination = defineComponent({
28477
28482
  currentPage.value = res.currentPage || res.page || 1;
28478
28483
  pageSize.value = res.pageSize || res.size || 20;
28479
28484
  total.value = res.total | 0;
28480
- crud.params.size = pageSize.value;
28485
+ crud.params.pageSize = pageSize.value;
28481
28486
  }
28482
28487
  }
28483
28488
  mitt.on("crud.refresh", ({
@@ -28658,38 +28663,8 @@ var ExportBtn = defineComponent({
28658
28663
  } = useCore();
28659
28664
  const exportVisible = ref(false);
28660
28665
  const exportLoading = ref(false);
28661
- // 根据字典替换请求参数
28662
28666
  function paramsReplaceExport(params) {
28663
- const {
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;
28667
+ return replaceParamsByDict(params, crud.dict);
28693
28668
  }
28694
28669
  const onExport = () => {
28695
28670
  return new Promise(r1 => {
@@ -8044,6 +8044,40 @@
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
+ for (const i in b) {
8065
+ if (b[i] === undefined || b[i] === null) continue;
8066
+ if (!Object.prototype.hasOwnProperty.call(a, i)) continue;
8067
+ if (i !== b[i]) {
8068
+ a[`_${b[i]}`] = a[i];
8069
+ delete a[i];
8070
+ }
8071
+ }
8072
+ for (const i in a) {
8073
+ if (i[0] === "_") {
8074
+ a[i.substring(1)] = a[i];
8075
+ delete a[i];
8076
+ }
8077
+ }
8078
+ return a;
8079
+ }
8080
+
8047
8081
  function isArray$1(value) {
8048
8082
  if (typeof Array.isArray === "function") {
8049
8083
  return Array.isArray(value);
@@ -8452,36 +8486,7 @@
8452
8486
  }
8453
8487
  // 根据字典替换请求参数
8454
8488
  function paramsReplace(params) {
8455
- const {
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;
8489
+ return replaceParamsByDict(params, crud.dict);
8485
8490
  }
8486
8491
  // 刷新请求
8487
8492
  function refresh(params) {
@@ -28480,7 +28485,7 @@
28480
28485
  currentPage.value = res.currentPage || res.page || 1;
28481
28486
  pageSize.value = res.pageSize || res.size || 20;
28482
28487
  total.value = res.total | 0;
28483
- crud.params.size = pageSize.value;
28488
+ crud.params.pageSize = pageSize.value;
28484
28489
  }
28485
28490
  }
28486
28491
  mitt.on("crud.refresh", ({
@@ -28661,38 +28666,8 @@
28661
28666
  } = useCore();
28662
28667
  const exportVisible = vue.ref(false);
28663
28668
  const exportLoading = vue.ref(false);
28664
- // 根据字典替换请求参数
28665
28669
  function paramsReplaceExport(params) {
28666
- const {
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;
28670
+ return replaceParamsByDict(params, crud.dict);
28696
28671
  }
28697
28672
  const onExport = () => {
28698
28673
  return new Promise(r1 => {
@@ -14,7 +14,7 @@ export declare const epieDescriptionsProps: () => {
14
14
  default: string;
15
15
  };
16
16
  size: {
17
- type: PropType<"" | "default" | "small" | "large">;
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<"" | "default" | "small" | "large">;
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<"" | "default" | "small" | "large">;
78
+ type: PropType<"" | "small" | "default" | "large">;
79
79
  };
80
80
  title: {
81
81
  type: StringConstructor;
@@ -1,6 +1,6 @@
1
1
  import { EpieCrud, Emitter } from "../types";
2
2
  export declare function useRefs(): {
3
- refs: import("vue").Ref<any, any>;
3
+ refs: import("vue").Ref<any>;
4
4
  setRefs: (index: number) => (el: HTMLElement) => void;
5
5
  };
6
6
  export declare function useTools(): {
@@ -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 };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 将 crud.params 的内部键名映射为请求参数名(dict.pagination / search / sort 的「键」为内部名,「值」为请求名)
3
+ */
4
+ export declare function replaceParamsByDict(params: any, dict: {
5
+ pagination?: any;
6
+ search?: any;
7
+ sort?: any;
8
+ }): any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epie/bi-crud",
3
3
  "simpleName": "bi-crud",
4
- "version": "2.0.45",
4
+ "version": "2.0.47",
5
5
  "private": false,
6
6
  "main": "lib/bi-crud.umd.js",
7
7
  "module": "lib/bi-crud.esm.js",