fast-cocos 1.1.22 → 1.1.23
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/xlsx/template/xlsx.txt +13 -13
- package/package.json +1 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
/** 数字序列 */
|
|
2
2
|
type BuildNumbers<N extends number, Result extends number[] = []> = Result["length"] extends N
|
|
3
3
|
? never
|
|
4
4
|
: [...Result, Result["length"]] extends [infer _, ...infer Rest]
|
|
5
5
|
? Result["length"] | BuildNumbers<N, [...Result, Result["length"]]>
|
|
6
6
|
: never;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** 生成 1 到 10 的数字 */
|
|
9
9
|
type NumberRange = Exclude<BuildNumbers<11>, 0>;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/** Excel版本 */
|
|
12
12
|
type XlsxVersion = `v${NumberRange}`;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/** 整数 */
|
|
15
15
|
export type int = number;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/** 浮点数 */
|
|
18
18
|
export type float = number;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
/** Excel工作表数据 */
|
|
21
21
|
type XlsxData<T = unknown> = { [key: string]: T };
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
/** Excel工作表管理 */
|
|
24
24
|
class Xlsx {
|
|
25
25
|
private static _instance: Xlsx;
|
|
26
26
|
public static get instance(): Xlsx {
|
|
27
27
|
return Xlsx._instance ?? (Xlsx._instance = new Xlsx());
|
|
28
28
|
}
|
|
29
|
-
[key: string]: any;
|
|
29
|
+
// [key: string]: any;
|
|
30
30
|
private readonly sheetToKey: Map<string, string>;
|
|
31
31
|
{0}
|
|
32
32
|
private constructor() {
|
|
@@ -35,7 +35,7 @@ class Xlsx {
|
|
|
35
35
|
const keys = Object.keys(this).filter((it) => it != "sheetToKey");
|
|
36
36
|
const values = Object.values(this);
|
|
37
37
|
for (const value of values) {
|
|
38
|
-
const key = keys.find((key) => this[key] === value);
|
|
38
|
+
const key = keys.find((key) => (this as any)[key] === value);
|
|
39
39
|
key && this.sheetToKey.set(value, key);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -56,24 +56,24 @@ class Xlsx {
|
|
|
56
56
|
public updateSheet<T>(sheetName: string, data: T): void {
|
|
57
57
|
const key = this.sheetToKey.get(sheetName);
|
|
58
58
|
if (!key) {
|
|
59
|
-
this[sheetName] = data;
|
|
59
|
+
(this as any)[sheetName] = data;
|
|
60
60
|
console.warn(`强制更新表【${sheetName}】`);
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
if (sheetName.endsWith("KVMap") || (!sheetName.endsWith("VMap") && sheetName.endsWith("Map"))) {
|
|
65
|
-
this[key] = this.toMap(data as { [key: string]: unknown });
|
|
65
|
+
(this as any)[key] = this.toMap(data as { [key: string]: unknown });
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
this[key] = data;
|
|
69
|
+
(this as any)[key] = data;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* 检查没有的配置表
|
|
74
74
|
*/
|
|
75
75
|
public checkNotSheet(): string[] {
|
|
76
|
-
return [...this.sheetToKey.keys()].filter((sheetName) => typeof this[sheetName] == "string");
|
|
76
|
+
return [...this.sheetToKey.keys()].filter((sheetName) => typeof (this as any)[sheetName] == "string");
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|