@vant/area-data 1.3.2 → 1.4.0
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/README.md +13 -3
- package/dist/index.cjs.js +34 -1
- package/dist/index.d.ts +10 -3886
- package/dist/index.esm.mjs +34 -1
- package/package.json +6 -4
package/dist/index.esm.mjs
CHANGED
|
@@ -3887,6 +3887,39 @@ var areaList = {
|
|
|
3887
3887
|
820204: "圣方济各堂区"
|
|
3888
3888
|
}
|
|
3889
3889
|
};
|
|
3890
|
+
var makeOption = (text, value, children) => ({
|
|
3891
|
+
text,
|
|
3892
|
+
value,
|
|
3893
|
+
children
|
|
3894
|
+
});
|
|
3895
|
+
function useCascaderAreaData() {
|
|
3896
|
+
const {
|
|
3897
|
+
city_list: city,
|
|
3898
|
+
county_list: county,
|
|
3899
|
+
province_list: province
|
|
3900
|
+
} = areaList;
|
|
3901
|
+
const provinceMap = /* @__PURE__ */ new Map();
|
|
3902
|
+
Object.keys(province).forEach((code) => {
|
|
3903
|
+
provinceMap.set(code.slice(0, 2), makeOption(province[code], code, []));
|
|
3904
|
+
});
|
|
3905
|
+
const cityMap = /* @__PURE__ */ new Map();
|
|
3906
|
+
Object.keys(city).forEach((code) => {
|
|
3907
|
+
const option = makeOption(city[code], code, []);
|
|
3908
|
+
cityMap.set(code.slice(0, 4), option);
|
|
3909
|
+
const province2 = provinceMap.get(code.slice(0, 2));
|
|
3910
|
+
if (province2) {
|
|
3911
|
+
province2.children.push(option);
|
|
3912
|
+
}
|
|
3913
|
+
});
|
|
3914
|
+
Object.keys(county).forEach((code) => {
|
|
3915
|
+
const city2 = cityMap.get(code.slice(0, 4));
|
|
3916
|
+
if (city2) {
|
|
3917
|
+
city2.children.push(makeOption(county[code], code));
|
|
3918
|
+
}
|
|
3919
|
+
});
|
|
3920
|
+
return Array.from(provinceMap.values());
|
|
3921
|
+
}
|
|
3890
3922
|
export {
|
|
3891
|
-
areaList
|
|
3923
|
+
areaList,
|
|
3924
|
+
useCascaderAreaData
|
|
3892
3925
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vant/area-data",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Vant 省市区数据",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.mjs",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"require": "./dist/index.cjs.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
+
"sideEffects": false,
|
|
14
15
|
"files": [
|
|
15
16
|
"dist"
|
|
16
17
|
],
|
|
@@ -36,9 +37,10 @@
|
|
|
36
37
|
"author": "chenjiahan",
|
|
37
38
|
"license": "MIT",
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"esbuild": "^0.
|
|
40
|
-
"release-it": "^15.
|
|
41
|
-
"
|
|
40
|
+
"esbuild": "^0.16.10",
|
|
41
|
+
"release-it": "^15.4.1",
|
|
42
|
+
"rimraf": "^4.0.4",
|
|
43
|
+
"typescript": "^4.8.2"
|
|
42
44
|
},
|
|
43
45
|
"release-it": {
|
|
44
46
|
"git": {
|