@pdg/data 1.0.8 → 1.0.9
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/index.esm.js +3 -0
- package/dist/index.js +3 -0
- package/dist/makeConst.d.ts +6 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -52,6 +52,9 @@ function makeConst(items) {
|
|
|
52
52
|
},
|
|
53
53
|
getLvList(extraPreItems) {
|
|
54
54
|
return [...(extraPreItems || []), ...items.map((item) => ({ value: item[0], label: item[1] }))];
|
|
55
|
+
},
|
|
56
|
+
getKeyList() {
|
|
57
|
+
return Object.keys(aliasValueMap);
|
|
55
58
|
} });
|
|
56
59
|
}var index = {
|
|
57
60
|
copy,
|
package/dist/index.js
CHANGED
|
@@ -52,6 +52,9 @@ function makeConst(items) {
|
|
|
52
52
|
},
|
|
53
53
|
getLvList(extraPreItems) {
|
|
54
54
|
return [...(extraPreItems || []), ...items.map((item) => ({ value: item[0], label: item[1] }))];
|
|
55
|
+
},
|
|
56
|
+
getKeyList() {
|
|
57
|
+
return Object.keys(aliasValueMap);
|
|
55
58
|
} });
|
|
56
59
|
}var index = {
|
|
57
60
|
copy,
|
package/dist/makeConst.d.ts
CHANGED
|
@@ -12,11 +12,11 @@ type CamelCase<S extends PropertyKey> = S extends string ? S extends `${infer T}
|
|
|
12
12
|
type TItem = readonly [string, any];
|
|
13
13
|
type TItemWithAlias = readonly [string | number, any, string];
|
|
14
14
|
type TItems = readonly TItem[] | readonly TItemWithAlias[];
|
|
15
|
-
/**
|
|
15
|
+
/** MakeAliasValueMap */
|
|
16
16
|
type MakeAliasValueMap<Items extends TItems> = {
|
|
17
17
|
[K in Items[number] as K extends TItem ? CamelCase<K[0]> : K extends TItemWithAlias ? K[2] : never]: K[0];
|
|
18
18
|
};
|
|
19
|
-
/**
|
|
19
|
+
/** MakeValueLabelMap */
|
|
20
20
|
type MakeValueLabelMap<Items extends TItems> = {
|
|
21
21
|
[K in Items[number] as K[0]]: K[1];
|
|
22
22
|
};
|
|
@@ -36,11 +36,14 @@ declare function makeConst<StringValue extends string, NumberValue extends numbe
|
|
|
36
36
|
}[]>(items?: LvItems) => Writable<[
|
|
37
37
|
...(ValueLabelList extends readonly any[] ? ValueLabelList : []),
|
|
38
38
|
...(IsArray<LvItems> extends true ? LvItems : [])
|
|
39
|
-
]>,
|
|
39
|
+
]>, GetKeyList = () => {
|
|
40
|
+
[K in keyof Items]: Items[K] extends TItem ? CamelCase<Items[K][0]> : Items[K] extends TItemWithAlias ? Items[K][2] : never;
|
|
41
|
+
}, Result = AliasValueMap & {
|
|
40
42
|
Type: ValueType;
|
|
41
43
|
getLabel: GetLabel;
|
|
42
44
|
getList: GetList;
|
|
43
45
|
getLvList: GetLvList;
|
|
46
|
+
getKeyList: GetKeyList;
|
|
44
47
|
}>(items: Items): Result;
|
|
45
48
|
export { makeConst };
|
|
46
49
|
export default makeConst;
|