@vant/area-data 1.3.2 → 1.4.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.
@@ -1622,7 +1622,6 @@ var areaList = {
1622
1622
  360724: "上犹县",
1623
1623
  360725: "崇义县",
1624
1624
  360726: "安远县",
1625
- 360727: "龙南县",
1626
1625
  360728: "定南县",
1627
1626
  360729: "全南县",
1628
1627
  360730: "宁都县",
@@ -1632,6 +1631,7 @@ var areaList = {
1632
1631
  360734: "寻乌县",
1633
1632
  360735: "石城县",
1634
1633
  360781: "瑞金市",
1634
+ 360783: "龙南市",
1635
1635
  360802: "吉州区",
1636
1636
  360803: "青原区",
1637
1637
  360821: "吉安县",
@@ -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.2",
3
+ "version": "1.4.1",
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.14.29",
40
- "release-it": "^15.1.1",
41
- "typescript": "^4.7.4"
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": {