@vant/area-data 1.3.1 → 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/LICENSE +10 -0
- package/README.md +13 -3
- package/dist/index.cjs.js +39 -5
- package/dist/index.d.ts +10 -3886
- package/dist/index.esm.mjs +38 -5
- package/package.json +8 -6
package/dist/index.esm.mjs
CHANGED
|
@@ -1151,10 +1151,10 @@ var areaList = {
|
|
|
1151
1151
|
232701: "漠河市",
|
|
1152
1152
|
232721: "呼玛县",
|
|
1153
1153
|
232722: "塔河县",
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1154
|
+
232761: "加格达奇区",
|
|
1155
|
+
232762: "松岭区",
|
|
1156
|
+
232763: "新林区",
|
|
1157
|
+
232764: "呼中区",
|
|
1158
1158
|
310101: "黄浦区",
|
|
1159
1159
|
310104: "徐汇区",
|
|
1160
1160
|
310105: "长宁区",
|
|
@@ -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
|
],
|
|
@@ -29,16 +30,17 @@
|
|
|
29
30
|
},
|
|
30
31
|
"repository": {
|
|
31
32
|
"type": "git",
|
|
32
|
-
"url": "https://github.com/
|
|
33
|
+
"url": "https://github.com/vant-ui/vant.git",
|
|
33
34
|
"directory": "packages/vant-area-data"
|
|
34
35
|
},
|
|
35
|
-
"bugs": "https://github.com/
|
|
36
|
+
"bugs": "https://github.com/vant-ui/vant/issues",
|
|
36
37
|
"author": "chenjiahan",
|
|
37
38
|
"license": "MIT",
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"esbuild": "^0.
|
|
40
|
-
"release-it": "^
|
|
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": {
|