@kcuf/helper-data 0.1.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/CHANGELOG.md +12 -0
- package/dist/cjs/helper/index.js +1 -8
- package/dist/cjs/helper/normalize-paged-list-uncertain.js +2 -2
- package/dist/cjs/helper/normalize-paged-list.js +2 -2
- package/dist/cjs/index.js +1 -12
- package/dist/esm/helper/index.js +0 -1
- package/dist/esm/helper/index.js.map +1 -1
- 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/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/base-data.js.map +1 -1
- package/dist/esm/types/generic.js.map +1 -1
- package/dist/types/helper/index.d.ts +0 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/types/base-data.d.ts +16 -10
- package/dist/types/types/generic.d.ts +1 -7
- package/package.json +7 -7
- package/dist/cjs/enum/index.js +0 -16
- package/dist/cjs/helper/create-data-with-loading.js +0 -16
- package/dist/esm/enum/index.js +0 -11
- package/dist/esm/enum/index.js.map +0 -1
- package/dist/esm/helper/create-data-with-loading.js +0 -11
- package/dist/esm/helper/create-data-with-loading.js.map +0 -1
- package/dist/types/enum/index.d.ts +0 -9
- package/dist/types/helper/create-data-with-loading.d.ts +0 -3
package/CHANGELOG.md
ADDED
package/dist/cjs/helper/index.js
CHANGED
|
@@ -4,12 +4,6 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
Object.defineProperty(exports, "createDataWithLoading", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function get() {
|
|
10
|
-
return _createDataWithLoading.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
7
|
Object.defineProperty(exports, "normalizeBoolean", {
|
|
14
8
|
enumerable: true,
|
|
15
9
|
get: function get() {
|
|
@@ -58,5 +52,4 @@ var _normalizeNumber = _interopRequireDefault(require("./normalize-number"));
|
|
|
58
52
|
var _normalizeEnum = _interopRequireDefault(require("./normalize-enum"));
|
|
59
53
|
var _normalizeTime = _interopRequireDefault(require("./normalize-time"));
|
|
60
54
|
var _normalizePagedList = _interopRequireDefault(require("./normalize-paged-list"));
|
|
61
|
-
var _normalizePagedListUncertain = _interopRequireDefault(require("./normalize-paged-list-uncertain"));
|
|
62
|
-
var _createDataWithLoading = _interopRequireDefault(require("./create-data-with-loading"));
|
|
55
|
+
var _normalizePagedListUncertain = _interopRequireDefault(require("./normalize-paged-list-uncertain"));
|
|
@@ -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
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,19 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
LoadingStatus: true
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "LoadingStatus", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function get() {
|
|
12
|
-
return _enum.ELoadingStatus;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
6
|
var _helper = require("./helper");
|
|
16
7
|
Object.keys(_helper).forEach(function (key) {
|
|
17
8
|
if (key === "default" || key === "__esModule") return;
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
19
9
|
if (key in exports && exports[key] === _helper[key]) return;
|
|
20
10
|
Object.defineProperty(exports, key, {
|
|
21
11
|
enumerable: true,
|
|
@@ -23,5 +13,4 @@ Object.keys(_helper).forEach(function (key) {
|
|
|
23
13
|
return _helper[key];
|
|
24
14
|
}
|
|
25
15
|
});
|
|
26
|
-
});
|
|
27
|
-
var _enum = require("./enum");
|
|
16
|
+
});
|
package/dist/esm/helper/index.js
CHANGED
|
@@ -5,5 +5,4 @@ export { default as normalizeEnum } from './normalize-enum';
|
|
|
5
5
|
export { default as normalizeTime } from './normalize-time';
|
|
6
6
|
export { default as normalizePagedList } from './normalize-paged-list';
|
|
7
7
|
export { default as normalizePagedListUncertain } from './normalize-paged-list-uncertain';
|
|
8
|
-
export { default as createDataWithLoading } from './create-data-with-loading';
|
|
9
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","normalizeId","normalizeBoolean","normalizeNumber","normalizeEnum","normalizeTime","normalizePagedList","normalizePagedListUncertain"
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","normalizeId","normalizeBoolean","normalizeNumber","normalizeEnum","normalizeTime","normalizePagedList","normalizePagedListUncertain"],"sources":["../../../src/helper/index.ts"],"sourcesContent":["export { default as normalizeId } from './normalize-id';\nexport { default as normalizeBoolean } from './normalize-boolean';\nexport { default as normalizeNumber } from './normalize-number';\nexport { default as normalizeEnum } from './normalize-enum';\nexport { default as normalizeTime } from './normalize-time';\nexport { default as normalizePagedList } from './normalize-paged-list';\nexport { default as normalizePagedListUncertain } from './normalize-paged-list-uncertain';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,WAAW,QAAQ,gBAAgB;AACvD,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,qBAAqB;AACjE,SAASF,OAAO,IAAIG,eAAe,QAAQ,oBAAoB;AAC/D,SAASH,OAAO,IAAII,aAAa,QAAQ,kBAAkB;AAC3D,SAASJ,OAAO,IAAIK,aAAa,QAAQ,kBAAkB;AAC3D,SAASL,OAAO,IAAIM,kBAAkB,QAAQ,wBAAwB;AACtE,SAASN,OAAO,IAAIO,2BAA2B,QAAQ,kCAAkC","ignoreList":[]}
|
|
@@ -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":[]}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from './helper';\n\nexport type {\n IBaseParamsPage as BaseParamsPage,\n IBaseParamsPageWithQ as BaseParamsPageWithQ,\n \n IBaseDataId as BaseDataId,\n IBaseDataName as BaseDataName,\n IBaseDataIdName as BaseDataIdName,\n IBaseDataTitle as BaseDataTitle,\n IBaseDataDescription as BaseDataDescription,\n IBaseDataContent as BaseDataContent,\n IBaseDataTimeCreated as BaseDataTimeCreated,\n IBaseDataTimeUpdated as BaseDataTimeModified,\n IBaseDataTimes as BaseDataTimes,\n IBaseDataCreator as BaseDataCreator,\n IBaseDataUpdater as BaseDataUpdater,\n \n IPagedList as PagedList,\n IPagedListUncertain as PagedListUncertain\n} from './types';\n"],"mappings":"AAAA,cAAc,UAAU;AAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-data.js","names":[],"sources":["../../../src/types/base-data.ts"],"sourcesContent":["// 基础类型 mixin,用于继承,统一前缀 BaseData\n\n/**\n * 「ID」标准化\n */\nexport interface IBaseDataId {\n id: string;\n}\n\n/**\n * 「名称」标准化\n */\nexport interface IBaseDataName {\n name: string;\n}\n\n/**\n * 「标题」标准化\n */\nexport interface IBaseDataTitle {\n title: string;\n}\n\n/**\n * 「内容」标准化\n */\nexport interface IBaseDataContent {\n content: string;\n}\n\n/**\n * id + name\n */\nexport interface IBaseDataIdName extends IBaseDataId, IBaseDataName {}\n\n/**\n * 「创建时间」标准化\n */\nexport interface IBaseDataTimeCreated {\n timeCreated: Date;\n}\n\n/**\n * 「更新时间」标准化\n */\nexport interface
|
|
1
|
+
{"version":3,"file":"base-data.js","names":[],"sources":["../../../src/types/base-data.ts"],"sourcesContent":["// 基础类型 mixin,用于继承,统一前缀 BaseData\n\n/**\n * 「ID」标准化\n */\nexport interface IBaseDataId {\n id: string;\n}\n\n/**\n * 「名称」标准化\n */\nexport interface IBaseDataName {\n name: string;\n}\n\n/**\n * 「标题」标准化\n */\nexport interface IBaseDataTitle {\n title: string;\n}\n\n/**\n * 「内容」标准化\n */\nexport interface IBaseDataContent {\n content: string;\n}\n\n/**\n * 「描述」标准化\n */\nexport interface IBaseDataDescription {\n description: string;\n}\n\n/**\n * id + name\n */\nexport interface IBaseDataIdName extends IBaseDataId, IBaseDataName {}\n\n/**\n * 「创建时间」标准化\n */\nexport interface IBaseDataTimeCreated {\n timeCreated: Date;\n}\n\n/**\n * 「更新时间」标准化\n */\nexport interface IBaseDataTimeUpdated {\n timeUpdated: Date;\n}\n\n/**\n * timeCreated + timeUpdated\n */\nexport interface IBaseDataTimes extends IBaseDataTimeCreated, IBaseDataTimeUpdated {}\n\n/**\n * 「创建人」标准化\n */\nexport interface IBaseDataCreator {\n creator: IBaseDataIdName;\n}\n\n/**\n * 「更新人」标准化\n */\nexport interface IBaseDataUpdater {\n updater: IBaseDataIdName;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.js","names":[],"sources":["../../../src/types/generic.ts"],"sourcesContent":["
|
|
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":[]}
|
|
@@ -5,4 +5,3 @@ export { default as normalizeEnum } from './normalize-enum';
|
|
|
5
5
|
export { default as normalizeTime } from './normalize-time';
|
|
6
6
|
export { default as normalizePagedList } from './normalize-paged-list';
|
|
7
7
|
export { default as normalizePagedListUncertain } from './normalize-paged-list-uncertain';
|
|
8
|
-
export { default as createDataWithLoading } from './create-data-with-loading';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export * from './helper';
|
|
2
|
-
export {
|
|
3
|
-
export type { IBaseParamsPage as BaseParamsPage, IBaseParamsPageWithQ as BaseParamsPageWithQ, IBaseDataId as BaseDataId, IBaseDataName as BaseDataName, IBaseDataIdName as BaseDataIdName, IBaseDataTitle as BaseDataTitle, IBaseDataContent as BaseDataContent, IBaseDataTimeCreated as BaseDataTimeCreated, IBaseDataTimeModified as BaseDataTimeModified, IBaseDataTimes as BaseDataTimes, IBaseDataWhoCreated as BaseDataWhoCreated, IBaseDataWhoModified as BaseDataWhoModified, IPagedList as PagedList, IPagedListUncertain as PagedListUncertain, IDataWithLoading as DataWithLoading } from './types';
|
|
2
|
+
export type { IBaseParamsPage as BaseParamsPage, IBaseParamsPageWithQ as BaseParamsPageWithQ, IBaseDataId as BaseDataId, IBaseDataName as BaseDataName, IBaseDataIdName as BaseDataIdName, IBaseDataTitle as BaseDataTitle, IBaseDataDescription as BaseDataDescription, IBaseDataContent as BaseDataContent, IBaseDataTimeCreated as BaseDataTimeCreated, IBaseDataTimeUpdated as BaseDataTimeModified, IBaseDataTimes as BaseDataTimes, IBaseDataCreator as BaseDataCreator, IBaseDataUpdater as BaseDataUpdater, IPagedList as PagedList, IPagedListUncertain as PagedListUncertain } from './types';
|
|
@@ -22,6 +22,12 @@ export interface IBaseDataTitle {
|
|
|
22
22
|
export interface IBaseDataContent {
|
|
23
23
|
content: string;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* 「描述」标准化
|
|
27
|
+
*/
|
|
28
|
+
export interface IBaseDataDescription {
|
|
29
|
+
description: string;
|
|
30
|
+
}
|
|
25
31
|
/**
|
|
26
32
|
* id + name
|
|
27
33
|
*/
|
|
@@ -36,23 +42,23 @@ export interface IBaseDataTimeCreated {
|
|
|
36
42
|
/**
|
|
37
43
|
* 「更新时间」标准化
|
|
38
44
|
*/
|
|
39
|
-
export interface
|
|
40
|
-
|
|
45
|
+
export interface IBaseDataTimeUpdated {
|
|
46
|
+
timeUpdated: Date;
|
|
41
47
|
}
|
|
42
48
|
/**
|
|
43
|
-
* timeCreated +
|
|
49
|
+
* timeCreated + timeUpdated
|
|
44
50
|
*/
|
|
45
|
-
export interface IBaseDataTimes extends IBaseDataTimeCreated,
|
|
51
|
+
export interface IBaseDataTimes extends IBaseDataTimeCreated, IBaseDataTimeUpdated {
|
|
46
52
|
}
|
|
47
53
|
/**
|
|
48
|
-
*
|
|
54
|
+
* 「创建人」标准化
|
|
49
55
|
*/
|
|
50
|
-
export interface
|
|
51
|
-
|
|
56
|
+
export interface IBaseDataCreator {
|
|
57
|
+
creator: IBaseDataIdName;
|
|
52
58
|
}
|
|
53
59
|
/**
|
|
54
|
-
*
|
|
60
|
+
* 「更新人」标准化
|
|
55
61
|
*/
|
|
56
|
-
export interface
|
|
57
|
-
|
|
62
|
+
export interface IBaseDataUpdater {
|
|
63
|
+
updater: IBaseDataIdName;
|
|
58
64
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { ELoadingStatus } from '../enum';
|
|
2
1
|
/**
|
|
3
2
|
* 分页数据标准化
|
|
4
3
|
*/
|
|
5
4
|
export interface IPagedList<T> {
|
|
6
|
-
list: T[];
|
|
7
5
|
total: number;
|
|
8
6
|
page: number;
|
|
9
7
|
pageSize: number;
|
|
8
|
+
list: T[];
|
|
10
9
|
}
|
|
11
10
|
/**
|
|
12
11
|
* 某些分页接口,后端给的数据只有列表,前端需根据返回转成非确定分页列表数据
|
|
@@ -14,8 +13,3 @@ export interface IPagedList<T> {
|
|
|
14
13
|
export interface IPagedListUncertain<T> extends Omit<IPagedList<T>, 'total'> {
|
|
15
14
|
hasMore: boolean;
|
|
16
15
|
}
|
|
17
|
-
export interface IDataWithLoading<T> {
|
|
18
|
-
loading: ELoadingStatus;
|
|
19
|
-
data: T | null | undefined;
|
|
20
|
-
error: Error | null | undefined;
|
|
21
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kcuf/helper-data",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Data normalizer helpers and loading stuff to make all frontend data processing sane.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@babel/cli": "^7.
|
|
26
|
-
"@babel/core": "^7.
|
|
27
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
28
|
-
"@babel/preset-env": "^7.
|
|
29
|
-
"@babel/preset-typescript": "^7.
|
|
25
|
+
"@babel/cli": "^7.28.3",
|
|
26
|
+
"@babel/core": "^7.28.3",
|
|
27
|
+
"@babel/plugin-transform-runtime": "^7.28.3",
|
|
28
|
+
"@babel/preset-env": "^7.28.3",
|
|
29
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
30
30
|
"rimraf": "^6.0.1",
|
|
31
|
-
"typescript": "^5.
|
|
31
|
+
"typescript": "^5.9.2",
|
|
32
32
|
"@kcuf/ts-config": "^0.0.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
package/dist/cjs/enum/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ELoadingStatus = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* 数据加载状态
|
|
9
|
-
*/
|
|
10
|
-
var ELoadingStatus = exports.ELoadingStatus = /*#__PURE__*/function (ELoadingStatus) {
|
|
11
|
-
ELoadingStatus[ELoadingStatus["IDLE"] = 0] = "IDLE";
|
|
12
|
-
ELoadingStatus[ELoadingStatus["LOADING"] = 1] = "LOADING";
|
|
13
|
-
ELoadingStatus[ELoadingStatus["SUCCESS"] = 2] = "SUCCESS";
|
|
14
|
-
ELoadingStatus[ELoadingStatus["ERROR"] = 3] = "ERROR";
|
|
15
|
-
return ELoadingStatus;
|
|
16
|
-
}({});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = createDataWithLoading;
|
|
7
|
-
var _enum = require("../enum");
|
|
8
|
-
function createDataWithLoading(data) {
|
|
9
|
-
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _enum.ELoadingStatus.IDLE;
|
|
10
|
-
var error = arguments.length > 2 ? arguments[2] : undefined;
|
|
11
|
-
return {
|
|
12
|
-
loading: loading,
|
|
13
|
-
data: data,
|
|
14
|
-
error: error
|
|
15
|
-
};
|
|
16
|
-
}
|
package/dist/esm/enum/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 数据加载状态
|
|
3
|
-
*/
|
|
4
|
-
export var ELoadingStatus = /*#__PURE__*/function (ELoadingStatus) {
|
|
5
|
-
ELoadingStatus[ELoadingStatus["IDLE"] = 0] = "IDLE";
|
|
6
|
-
ELoadingStatus[ELoadingStatus["LOADING"] = 1] = "LOADING";
|
|
7
|
-
ELoadingStatus[ELoadingStatus["SUCCESS"] = 2] = "SUCCESS";
|
|
8
|
-
ELoadingStatus[ELoadingStatus["ERROR"] = 3] = "ERROR";
|
|
9
|
-
return ELoadingStatus;
|
|
10
|
-
}({});
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ELoadingStatus"],"sources":["../../../src/enum/index.ts"],"sourcesContent":["/**\n * 数据加载状态\n */\nexport enum ELoadingStatus {\n IDLE,\n LOADING,\n SUCCESS,\n ERROR\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,WAAYA,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ELoadingStatus } from '../enum';
|
|
2
|
-
export default function createDataWithLoading(data) {
|
|
3
|
-
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ELoadingStatus.IDLE;
|
|
4
|
-
var error = arguments.length > 2 ? arguments[2] : undefined;
|
|
5
|
-
return {
|
|
6
|
-
loading: loading,
|
|
7
|
-
data: data,
|
|
8
|
-
error: error
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=create-data-with-loading.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-data-with-loading.js","names":["ELoadingStatus","createDataWithLoading","data","loading","arguments","length","undefined","IDLE","error"],"sources":["../../../src/helper/create-data-with-loading.ts"],"sourcesContent":["import {\n ELoadingStatus\n} from '../enum';\nimport {\n IDataWithLoading\n} from '../types';\n\nexport default function createDataWithLoading<T>(data?: T | null, loading = ELoadingStatus.IDLE, error?: Error | null): IDataWithLoading<T> {\n return {\n loading,\n data,\n error\n };\n}\n"],"mappings":"AAAA,SACEA,cAAc,QACT,SAAS;AAKhB,eAAe,SAASC,qBAAqBA,CAAIC,IAAe,EAA4E;EAAA,IAA1EC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGJ,cAAc,CAACO,IAAI;EAAA,IAAEC,KAAoB,GAAAJ,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EACnH,OAAO;IACLH,OAAO,EAAPA,OAAO;IACPD,IAAI,EAAJA,IAAI;IACJM,KAAK,EAALA;EACF,CAAC;AACH","ignoreList":[]}
|