jmash-region 0.0.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.
@@ -0,0 +1,63 @@
1
+ import { defineComponent as f, useModel as C, ref as i, watchEffect as g, resolveComponent as v, openBlock as _, createBlock as x } from "vue";
2
+ import { dictRegionApi as s } from "./index.mjs";
3
+ import { e as y } from "./index-S5ZXIciD.mjs";
4
+ const L = /* @__PURE__ */ f({
5
+ __name: "index",
6
+ props: {
7
+ modelValue: {},
8
+ modelModifiers: {}
9
+ },
10
+ emits: ["update:modelValue"],
11
+ setup(u) {
12
+ const l = C(u, "modelValue"), n = i([]), c = () => {
13
+ s.findByCode({ regionCode: l.value }).then(({ data: o }) => {
14
+ const e = y(o);
15
+ n.value = e.regionCodes;
16
+ });
17
+ };
18
+ g(
19
+ () => l.value && !n.value.length && c()
20
+ );
21
+ const d = i([]), p = (o) => {
22
+ s.findList({
23
+ likeRegionName: o
24
+ }).then(({ data: e }) => {
25
+ d.value = e.results.map((a) => (a.hasChildren = !a.hasChildren, a));
26
+ });
27
+ }, h = () => {
28
+ n.value = [];
29
+ }, m = (o, e) => {
30
+ s.findList({
31
+ parentId: o.data.regionId
32
+ }).then(({ data: a }) => {
33
+ const t = a.results.map((r) => (r.hasChildren = !r.hasChildren, r));
34
+ !o.data.regionId && (d.value = t), e(t);
35
+ });
36
+ };
37
+ return (o, e) => {
38
+ const a = v("el-tree-select");
39
+ return _(), x(a, {
40
+ lazy: "",
41
+ filterable: "",
42
+ "check-strictly": "",
43
+ modelValue: l.value,
44
+ "onUpdate:modelValue": e[0] || (e[0] = (t) => l.value = t),
45
+ "node-key": "regionCode",
46
+ load: m,
47
+ data: d.value,
48
+ "default-expanded-keys": n.value,
49
+ "filter-method": p,
50
+ onClear: h,
51
+ props: {
52
+ value: "regionCode",
53
+ label: "regionName",
54
+ isLeaf: "hasChildren",
55
+ children: "children"
56
+ }
57
+ }, null, 8, ["modelValue", "data", "default-expanded-keys"]);
58
+ };
59
+ }
60
+ });
61
+ export {
62
+ L as _
63
+ };
@@ -0,0 +1,58 @@
1
+ import { defineComponent as m, useModel as f, ref as g, resolveComponent as v, openBlock as h, createBlock as C } from "vue";
2
+ import { dictRegionApi as d } from "./index.mjs";
3
+ const V = /* @__PURE__ */ m({
4
+ __name: "index",
5
+ props: {
6
+ modelValue: {},
7
+ modelModifiers: {}
8
+ },
9
+ emits: ["update:modelValue"],
10
+ setup(s) {
11
+ const r = f(s, "modelValue"), i = {
12
+ lazy: !0,
13
+ // 开启懒加载
14
+ checkStrictly: !0,
15
+ // 选择任意一级选项
16
+ lazyLoad(l, o) {
17
+ var e;
18
+ d.findList({
19
+ parentId: (e = l.data) == null ? void 0 : e.regionId
20
+ }).then(({ data: t }) => {
21
+ const c = t.results.map((n) => ({
22
+ label: n.regionName,
23
+ value: n.regionCode,
24
+ regionId: n.regionId,
25
+ leaf: !n.hasChildren
26
+ }));
27
+ o(c);
28
+ });
29
+ }
30
+ }, u = () => {
31
+ r.value = [], a.value = [];
32
+ }, a = g([]), p = (l) => (d.findList({
33
+ likeRegionName: l
34
+ }).then(({ data: o }) => {
35
+ a.value = o.results.map((e) => ({
36
+ label: e.regionName,
37
+ value: e.regionCode,
38
+ regionId: e.regionId,
39
+ leaf: !e.hasChildren
40
+ }));
41
+ }), !1);
42
+ return (l, o) => {
43
+ const e = v("el-cascader");
44
+ return h(), C(e, {
45
+ modelValue: r.value,
46
+ "onUpdate:modelValue": o[0] || (o[0] = (t) => r.value = t),
47
+ props: i,
48
+ options: a.value,
49
+ filterable: "",
50
+ onClear: u,
51
+ "before-filter": p
52
+ }, null, 8, ["modelValue", "options"]);
53
+ };
54
+ }
55
+ });
56
+ export {
57
+ V as _
58
+ };
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "jmash-region",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "module": "dist/index.mjs",
6
+ "types": "dts/src/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "dts/src"
10
+ ],
11
+ "scripts": {
12
+ "dev": "vite",
13
+ "build": "vite build && pnpm build:dts",
14
+ "build:dts": "vue-tsc --declaration --emitDeclarationOnly",
15
+ "preview": "vite preview",
16
+ "build-only": "vite build",
17
+ "type-check": "vue-tsc --build --force",
18
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
19
+ "format": "prettier --write src/"
20
+ },
21
+ "peerDependencies": {
22
+ "axios": "^1.6.7",
23
+ "element-plus": "^2.7.5",
24
+ "jmash-core": "^0.0.95",
25
+ "jmash-dict": "^0.0.41",
26
+ "jmash-rbac": "^0.0.30",
27
+ "pinia": "^2.1.7",
28
+ "vue": "^3.4.21",
29
+ "vue-i18n": "^9.10.1",
30
+ "vue-router": "^4.3.0"
31
+ },
32
+ "devDependencies": {
33
+ "@rushstack/eslint-patch": "^1.3.3",
34
+ "@tsconfig/node20": "^20.1.2",
35
+ "@types/node": "^20.11.10",
36
+ "@vitejs/plugin-vue": "^5.0.3",
37
+ "@vue/eslint-config-prettier": "^8.0.0",
38
+ "@vue/eslint-config-typescript": "^12.0.0",
39
+ "@vue/tsconfig": "^0.5.1",
40
+ "eslint": "^8.49.0",
41
+ "eslint-plugin-vue": "^9.17.0",
42
+ "npm-run-all2": "^6.1.1",
43
+ "prettier": "^3.0.3",
44
+ "sass": "^1.72.0",
45
+ "typescript": "~5.3.0",
46
+ "unplugin-auto-import": "^0.17.5",
47
+ "unplugin-vue-components": "^0.26.0",
48
+ "vite": "^5.0.11",
49
+ "vue-tsc": "^1.8.27"
50
+ },
51
+ "dependencies": {
52
+ "@vueuse/core": "^10.9.0",
53
+ "file-saver": "^2.0.5",
54
+ "nprogress": "^0.2.0",
55
+ "pinyin-pro": "^3.25.0",
56
+ "qs": "^6.12.0"
57
+ }
58
+ }