@nocobase/plugin-field-china-region 1.3.51 → 1.3.53
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/client/chinaRegion.d.ts +110 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +4 -3
- package/package.json +5 -5
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { CollectionFieldInterface } from '@nocobase/client';
|
|
10
|
+
export declare class ChinaRegionFieldInterface extends CollectionFieldInterface {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
group: string;
|
|
14
|
+
order: number;
|
|
15
|
+
title: string;
|
|
16
|
+
isAssociation: boolean;
|
|
17
|
+
default: {
|
|
18
|
+
interface: string;
|
|
19
|
+
type: string;
|
|
20
|
+
target: string;
|
|
21
|
+
targetKey: string;
|
|
22
|
+
sortBy: string;
|
|
23
|
+
uiSchema: {
|
|
24
|
+
type: string;
|
|
25
|
+
'x-component': string;
|
|
26
|
+
'x-component-props': {
|
|
27
|
+
useDataSource: string;
|
|
28
|
+
useLoadData: string;
|
|
29
|
+
changeOnSelectLast: boolean;
|
|
30
|
+
labelInValue: boolean;
|
|
31
|
+
maxLevel: number;
|
|
32
|
+
fieldNames: {
|
|
33
|
+
label: string;
|
|
34
|
+
value: string;
|
|
35
|
+
children: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
availableTypes: string[];
|
|
41
|
+
initialize(values: any): void;
|
|
42
|
+
properties: {
|
|
43
|
+
'uiSchema.x-component-props.maxLevel': {
|
|
44
|
+
type: string;
|
|
45
|
+
'x-component': string;
|
|
46
|
+
'x-decorator': string;
|
|
47
|
+
title: string;
|
|
48
|
+
default: number;
|
|
49
|
+
enum: ({
|
|
50
|
+
value: number;
|
|
51
|
+
label: string;
|
|
52
|
+
disabled?: undefined;
|
|
53
|
+
} | {
|
|
54
|
+
value: number;
|
|
55
|
+
label: string;
|
|
56
|
+
disabled: boolean;
|
|
57
|
+
})[];
|
|
58
|
+
};
|
|
59
|
+
'uiSchema.x-component-props.changeOnSelectLast': {
|
|
60
|
+
type: string;
|
|
61
|
+
'x-component': string;
|
|
62
|
+
'x-content': string;
|
|
63
|
+
'x-decorator': string;
|
|
64
|
+
};
|
|
65
|
+
'uiSchema.title': {
|
|
66
|
+
type: string;
|
|
67
|
+
title: string;
|
|
68
|
+
required: boolean;
|
|
69
|
+
'x-decorator': string;
|
|
70
|
+
'x-component': string;
|
|
71
|
+
};
|
|
72
|
+
name: {
|
|
73
|
+
type: string;
|
|
74
|
+
title: string;
|
|
75
|
+
required: boolean;
|
|
76
|
+
'x-disabled': string;
|
|
77
|
+
'x-decorator': string;
|
|
78
|
+
'x-component': string;
|
|
79
|
+
'x-validator': string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
filterable: {
|
|
84
|
+
children: {
|
|
85
|
+
name: string;
|
|
86
|
+
title: string;
|
|
87
|
+
operators: ({
|
|
88
|
+
label: string;
|
|
89
|
+
value: string;
|
|
90
|
+
selected: boolean;
|
|
91
|
+
noValue?: undefined;
|
|
92
|
+
} | {
|
|
93
|
+
label: string;
|
|
94
|
+
value: string;
|
|
95
|
+
selected?: undefined;
|
|
96
|
+
noValue?: undefined;
|
|
97
|
+
} | {
|
|
98
|
+
label: string;
|
|
99
|
+
value: string;
|
|
100
|
+
noValue: boolean;
|
|
101
|
+
selected?: undefined;
|
|
102
|
+
})[];
|
|
103
|
+
schema: {
|
|
104
|
+
title: string;
|
|
105
|
+
type: string;
|
|
106
|
+
'x-component': string;
|
|
107
|
+
};
|
|
108
|
+
}[];
|
|
109
|
+
};
|
|
110
|
+
}
|
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
(function(
|
|
10
|
+
(function(t,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("@formily/react"),require("@formily/shared")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@formily/react","@formily/shared"],e):(t=typeof globalThis!="undefined"?globalThis:t||self,e(t["@nocobase/plugin-field-china-region"]={},t["@nocobase/client"],t["@formily/react"],t["@formily/shared"]))})(this,function(t,e,n,u){"use strict";var R=Object.defineProperty,L=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var C=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var y=(t,e,n)=>e in t?R(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,b=(t,e)=>{for(var n in e||(e={}))F.call(e,n)&&y(t,n,e[n]);if(C)for(var n of C(e))K.call(e,n)&&y(t,n,e[n]);return t},x=(t,e)=>L(t,P(e));var i=(t,e,n)=>(y(t,typeof e!="symbol"?e+"":e,n),n);var v=(t,e,n)=>new Promise((u,h)=>{var p=a=>{try{c(n.next(a))}catch(l){h(l)}},m=a=>{try{c(n.throw(a))}catch(l){h(l)}},c=a=>a.done?u(a.value):Promise.resolve(a.value).then(p,m);c((n=n.apply(t,e)).next())});const h=a=>{const o=n.useField().componentProps.maxLevel;return e.useRequest({resource:"chinaRegions",action:"list",params:{sort:"code",paginate:!1,filter:{level:1}}},x(b({},a),{onSuccess(s){var r;a==null||a.onSuccess({data:((r=s==null?void 0:s.data)==null?void 0:r.map(d=>(o!==1&&(d.isLeaf=!1),d)))||[]})},manual:!0}))},p=()=>{const a=e.useAPIClient(),l=n.useField(),o=l.componentProps.maxLevel;return s=>{var d;const r=s[s.length-1];((d=r==null?void 0:r.children)==null?void 0:d.length)>0||(r.loading=!0,a.resource("chinaRegions").list({sort:"code",paginate:!1,filter:{parentCode:r.code}}).then(({data:f})=>{var S;r.loading=!1,r.children=((S=f==null?void 0:f.data)==null?void 0:S.map(g=>(o>g.level&&(g.isLeaf=!1),g)))||[],l.dataSource=[...l.dataSource]}).catch(f=>{console.error(f)}))}};class m extends e.CollectionFieldInterface{constructor(){super(...arguments);i(this,"name","chinaRegion");i(this,"type","object");i(this,"group","choices");i(this,"order",7);i(this,"title",'{{t("China region")}}');i(this,"isAssociation",!0);i(this,"default",{interface:"chinaRegion",type:"belongsToMany",target:"chinaRegions",targetKey:"code",sortBy:"level",uiSchema:{type:"array","x-component":"Cascader","x-component-props":{useDataSource:"{{ useChinaRegionDataSource }}",useLoadData:"{{ useChinaRegionLoadData }}",changeOnSelectLast:!1,labelInValue:!0,maxLevel:3,fieldNames:{label:"name",value:"code",children:"children"}}}});i(this,"availableTypes",["belongsToMany"]);i(this,"properties",x(b({},e.defaultProps),{"uiSchema.x-component-props.maxLevel":{type:"number","x-component":"Radio.Group","x-decorator":"FormItem",title:'{{t("Select level")}}',default:3,enum:[{value:1,label:'{{t("Province")}}'},{value:2,label:'{{t("City")}}'},{value:3,label:'{{t("Area")}}'},{value:4,label:'{{t("Street")}}',disabled:!0},{value:5,label:'{{t("Village")}}',disabled:!0}]},"uiSchema.x-component-props.changeOnSelectLast":{type:"boolean","x-component":"Checkbox","x-content":'{{t("Must select to the last level")}}',"x-decorator":"FormItem"}}));i(this,"filterable",{children:[{name:"name",title:'{{t("Province/city/area name")}}',operators:e.operators.string,schema:{title:'{{t("Province/city/area name")}}',type:"string","x-component":"Input"}}]})}initialize(o){o.through||(o.through=`t_${u.uid()}`),o.foreignKey||(o.foreignKey=`f_${u.uid()}`),o.otherKey||(o.otherKey=`f_${u.uid()}`),o.sourceKey||(o.sourceKey="id"),o.targetKey||(o.targetKey="id")}}class c extends e.Plugin{load(){return v(this,null,function*(){this.app.addScopes({useChinaRegionDataSource:h,useChinaRegionLoadData:p}),this.app.dataSourceManager.addFieldInterfaces([m])})}}t.PluginFieldChinaRegionClient=c,t.default=c,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
module.exports = {
|
|
11
11
|
"@formily/core": "2.3.0",
|
|
12
12
|
"@formily/react": "2.3.0",
|
|
13
|
-
"@nocobase/client": "1.3.
|
|
14
|
-
"@
|
|
13
|
+
"@nocobase/client": "1.3.53",
|
|
14
|
+
"@formily/shared": "2.3.2",
|
|
15
|
+
"@nocobase/server": "1.3.53",
|
|
15
16
|
"china-division": "2.7.0",
|
|
16
|
-
"@nocobase/database": "1.3.
|
|
17
|
+
"@nocobase/database": "1.3.53"
|
|
17
18
|
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-field-china-region",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"displayName": "
|
|
5
|
-
"displayName.zh-CN": "
|
|
3
|
+
"version": "1.3.53",
|
|
4
|
+
"displayName": "Collection field: administrative divisions of China",
|
|
5
|
+
"displayName.zh-CN": "数据表字段:中国行政区划",
|
|
6
6
|
"description": "Provides data and field type for administrative divisions of China.",
|
|
7
7
|
"description.zh-CN": "提供中国行政区划数据和字段类型。",
|
|
8
8
|
"main": "./dist/server/index.js",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@nocobase/server": "1.x",
|
|
23
23
|
"@nocobase/test": "1.x"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "5abb7080c6788bc1efb37fa52d75282dd357dcab",
|
|
26
26
|
"keywords": [
|
|
27
|
-
"
|
|
27
|
+
"Collection fields"
|
|
28
28
|
]
|
|
29
29
|
}
|