@kcuf/helper-data 0.2.0 → 0.2.1
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/cjs/helper/normalize-paged-list-uncertain.js +2 -2
- package/dist/cjs/helper/normalize-paged-list.js +2 -2
- package/dist/esm/helper/normalize-paged-list-uncertain.js +2 -2
- package/dist/esm/helper/normalize-paged-list-uncertain.js.map +1 -1
- package/dist/esm/helper/normalize-paged-list.js +2 -2
- package/dist/esm/helper/normalize-paged-list.js.map +1 -1
- package/dist/esm/types/generic.js.map +1 -1
- package/dist/types/types/generic.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
function normalizePagedListUncertain(list0, page, pageSize, convert) {
|
|
8
8
|
return {
|
|
9
|
-
list: convert ? list0.map(convert) : list0,
|
|
10
9
|
page: page,
|
|
11
10
|
pageSize: pageSize,
|
|
12
|
-
hasMore: list0.length >= pageSize
|
|
11
|
+
hasMore: list0.length >= pageSize,
|
|
12
|
+
list: convert ? list0.map(convert) : list0
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
var _default = exports.default = normalizePagedListUncertain;
|
|
@@ -9,9 +9,9 @@ exports.default = normalizePagedList;
|
|
|
9
9
|
*/
|
|
10
10
|
function normalizePagedList(list0, total, page, pageSize, convert) {
|
|
11
11
|
return {
|
|
12
|
-
list: convert ? list0.map(convert) : list0,
|
|
13
12
|
total: total,
|
|
14
13
|
page: page,
|
|
15
|
-
pageSize: pageSize
|
|
14
|
+
pageSize: pageSize,
|
|
15
|
+
list: convert ? list0.map(convert) : list0
|
|
16
16
|
};
|
|
17
17
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
function normalizePagedListUncertain(list0, page, pageSize, convert) {
|
|
2
2
|
return {
|
|
3
|
-
list: convert ? list0.map(convert) : list0,
|
|
4
3
|
page: page,
|
|
5
4
|
pageSize: pageSize,
|
|
6
|
-
hasMore: list0.length >= pageSize
|
|
5
|
+
hasMore: list0.length >= pageSize,
|
|
6
|
+
list: convert ? list0.map(convert) : list0
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
export default normalizePagedListUncertain;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-paged-list-uncertain.js","names":["normalizePagedListUncertain","list0","page","pageSize","convert","
|
|
1
|
+
{"version":3,"file":"normalize-paged-list-uncertain.js","names":["normalizePagedListUncertain","list0","page","pageSize","convert","hasMore","length","list","map"],"sources":["../../../src/helper/normalize-paged-list-uncertain.ts"],"sourcesContent":["import {\n IPagedListUncertain\n} from '../types';\n\nfunction normalizePagedListUncertain<T>(list0: T[], page: number, pageSize: number): IPagedListUncertain<T>;\nfunction normalizePagedListUncertain<T0, T>(list0: T0[], page: number, pageSize: number, convert: (o: T0) => T): IPagedListUncertain<T>;\n\nfunction normalizePagedListUncertain<T0, T = T0>(list0: T0[], page: number, pageSize: number, convert?: (o: T0) => T): IPagedListUncertain<T> {\n return {\n page,\n pageSize,\n hasMore: list0.length >= pageSize,\n list: convert ? list0.map(convert) : list0 as unknown as T[]\n };\n}\n\nexport default normalizePagedListUncertain;\n"],"mappings":"AAOA,SAASA,2BAA2BA,CAAaC,KAAW,EAAEC,IAAY,EAAEC,QAAgB,EAAEC,OAAsB,EAA0B;EAC5I,OAAO;IACLF,IAAI,EAAJA,IAAI;IACJC,QAAQ,EAARA,QAAQ;IACRE,OAAO,EAAEJ,KAAK,CAACK,MAAM,IAAIH,QAAQ;IACjCI,IAAI,EAAEH,OAAO,GAAGH,KAAK,CAACO,GAAG,CAACJ,OAAO,CAAC,GAAGH;EACvC,CAAC;AACH;AAEA,eAAeD,2BAA2B","ignoreList":[]}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export default function normalizePagedList(list0, total, page, pageSize, convert) {
|
|
5
5
|
return {
|
|
6
|
-
list: convert ? list0.map(convert) : list0,
|
|
7
6
|
total: total,
|
|
8
7
|
page: page,
|
|
9
|
-
pageSize: pageSize
|
|
8
|
+
pageSize: pageSize,
|
|
9
|
+
list: convert ? list0.map(convert) : list0
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=normalize-paged-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-paged-list.js","names":["normalizePagedList","list0","total","page","pageSize","convert","list","map"],"sources":["../../../src/helper/normalize-paged-list.ts"],"sourcesContent":["import {\n IPagedList\n} from '../types';\n\n/**\n * 这里我们不知道后端给的数据究竟长什么样,这个方法相对比较普适,业务封装可以在此基础上,通过传入后端对象简化调用\n */\nexport default function normalizePagedList<T0, T = T0>(list0: T0[], total: number, page: number, pageSize: number, convert?: (o: T0) => T): IPagedList<T> {\n return {\n list: convert ? list0.map(convert) : list0 as unknown as T[]
|
|
1
|
+
{"version":3,"file":"normalize-paged-list.js","names":["normalizePagedList","list0","total","page","pageSize","convert","list","map"],"sources":["../../../src/helper/normalize-paged-list.ts"],"sourcesContent":["import {\n IPagedList\n} from '../types';\n\n/**\n * 这里我们不知道后端给的数据究竟长什么样,这个方法相对比较普适,业务封装可以在此基础上,通过传入后端对象简化调用\n */\nexport default function normalizePagedList<T0, T = T0>(list0: T0[], total: number, page: number, pageSize: number, convert?: (o: T0) => T): IPagedList<T> {\n return {\n total,\n page,\n pageSize,\n list: convert ? list0.map(convert) : list0 as unknown as T[]\n };\n}\n"],"mappings":"AAIA;AACA;AACA;AACA,eAAe,SAASA,kBAAkBA,CAAaC,KAAW,EAAEC,KAAa,EAAEC,IAAY,EAAEC,QAAgB,EAAEC,OAAsB,EAAiB;EACxJ,OAAO;IACLH,KAAK,EAALA,KAAK;IACLC,IAAI,EAAJA,IAAI;IACJC,QAAQ,EAARA,QAAQ;IACRE,IAAI,EAAED,OAAO,GAAGJ,KAAK,CAACM,GAAG,CAACF,OAAO,CAAC,GAAGJ;EACvC,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.js","names":[],"sources":["../../../src/types/generic.ts"],"sourcesContent":["/**\n * 分页数据标准化\n */\nexport interface IPagedList<T> {\n
|
|
1
|
+
{"version":3,"file":"generic.js","names":[],"sources":["../../../src/types/generic.ts"],"sourcesContent":["/**\n * 分页数据标准化\n */\nexport interface IPagedList<T> {\n total: number;\n page: number;\n pageSize: number;\n list: T[];\n}\n\n/**\n * 某些分页接口,后端给的数据只有列表,前端需根据返回转成非确定分页列表数据\n */\nexport interface IPagedListUncertain<T> extends Omit<IPagedList<T>, 'total'> {\n hasMore: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|