@nocobase/plugin-china-region
Advanced tools
Comparing version 0.21.0-alpha.6 to 0.21.0-alpha.7
import { Plugin } from '@nocobase/client'; | ||
export declare class ChinaRegionPlugin extends Plugin { | ||
export declare class PluginChinaRegionClient extends Plugin { | ||
load(): Promise<void>; | ||
} | ||
export default ChinaRegionPlugin; | ||
export default PluginChinaRegionClient; |
@@ -1,1 +0,1 @@ | ||
(function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("@formily/react")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@formily/react"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n["@nocobase/plugin-china-region"]={},n["@nocobase/client"],n["@formily/react"]))})(this,function(n,e,i){"use strict";var L=Object.defineProperty,P=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var p=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var m=(n,e,i)=>e in n?L(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,v=(n,e)=>{for(var i in e||(e={}))x.call(e,i)&&m(n,i,e[i]);if(p)for(var i of p(e))C.call(e,i)&&m(n,i,e[i]);return n},S=(n,e)=>P(n,R(e));var y=(n,e,i)=>new Promise((f,u)=>{var t=o=>{try{r(i.next(o))}catch(s){u(s)}},l=o=>{try{r(i.throw(o))}catch(s){u(s)}},r=o=>o.done?f(o.value):Promise.resolve(o.value).then(t,l);r((i=i.apply(n,e)).next())});const f=l=>{const o=i.useField().componentProps.maxLevel;return e.useRequest({resource:"chinaRegions",action:"list",params:{sort:"code",paginate:!1,filter:{level:1}}},S(v({},l),{onSuccess(s){var a;l==null||l.onSuccess({data:((a=s==null?void 0:s.data)==null?void 0:a.map(c=>(o!==1&&(c.isLeaf=!1),c)))||[]})},manual:!0}))},u=()=>{const l=e.useAPIClient(),r=i.useField(),o=r.componentProps.maxLevel;return s=>{var c;const a=s[s.length-1];((c=a==null?void 0:a.children)==null?void 0:c.length)>0||(a.loading=!0,l.resource("chinaRegions").list({sort:"code",paginate:!1,filter:{parentCode:a.code}}).then(({data:d})=>{var h;a.loading=!1,a.children=((h=d==null?void 0:d.data)==null?void 0:h.map(g=>(o>g.level&&(g.isLeaf=!1),g)))||[],r.dataSource=[...r.dataSource]}))}};class t extends e.Plugin{load(){return y(this,null,function*(){this.app.addScopes({useChinaRegionDataSource:f,useChinaRegionLoadData:u})})}}n.ChinaRegionPlugin=t,n.default=t,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(n,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("@nocobase/client"),require("@formily/react")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@formily/react"],e):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n["@nocobase/plugin-china-region"]={},n["@nocobase/client"],n["@formily/react"]))})(this,function(n,e,i){"use strict";var y=Object.defineProperty,L=Object.defineProperties;var P=Object.getOwnPropertyDescriptors;var p=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var m=(n,e,i)=>e in n?y(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i,v=(n,e)=>{for(var i in e||(e={}))R.call(e,i)&&m(n,i,e[i]);if(p)for(var i of p(e))x.call(e,i)&&m(n,i,e[i]);return n},C=(n,e)=>L(n,P(e));var S=(n,e,i)=>new Promise((f,t)=>{var u=o=>{try{r(i.next(o))}catch(s){t(s)}},a=o=>{try{r(i.throw(o))}catch(s){t(s)}},r=o=>o.done?f(o.value):Promise.resolve(o.value).then(u,a);r((i=i.apply(n,e)).next())});const f=a=>{const o=i.useField().componentProps.maxLevel;return e.useRequest({resource:"chinaRegions",action:"list",params:{sort:"code",paginate:!1,filter:{level:1}}},C(v({},a),{onSuccess(s){var l;a==null||a.onSuccess({data:((l=s==null?void 0:s.data)==null?void 0:l.map(c=>(o!==1&&(c.isLeaf=!1),c)))||[]})},manual:!0}))},t=()=>{const a=e.useAPIClient(),r=i.useField(),o=r.componentProps.maxLevel;return s=>{var c;const l=s[s.length-1];((c=l==null?void 0:l.children)==null?void 0:c.length)>0||(l.loading=!0,a.resource("chinaRegions").list({sort:"code",paginate:!1,filter:{parentCode:l.code}}).then(({data:d})=>{var h;l.loading=!1,l.children=((h=d==null?void 0:d.data)==null?void 0:h.map(g=>(o>g.level&&(g.isLeaf=!1),g)))||[],r.dataSource=[...r.dataSource]}))}};class u extends e.Plugin{load(){return S(this,null,function*(){this.app.addScopes({useChinaRegionDataSource:f,useChinaRegionLoadData:t})})}}n.PluginChinaRegionClient=u,n.default=u,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
module.exports = { | ||
"@formily/core": "2.3.0", | ||
"@formily/react": "2.3.0", | ||
"@nocobase/client": "0.21.0-alpha.6", | ||
"@nocobase/server": "0.21.0-alpha.6", | ||
"@nocobase/client": "0.21.0-alpha.7", | ||
"@nocobase/server": "0.21.0-alpha.7", | ||
"china-division": "2.7.0", | ||
"@nocobase/database": "0.21.0-alpha.6" | ||
"@nocobase/database": "0.21.0-alpha.7" | ||
}; |
import { Plugin } from '@nocobase/server'; | ||
export declare class PluginChinaRegion extends Plugin { | ||
export declare class PluginChinaRegionServer extends Plugin { | ||
install(): Promise<void>; | ||
@@ -7,2 +7,2 @@ load(): Promise<void>; | ||
} | ||
export default PluginChinaRegion; | ||
export default PluginChinaRegionServer; |
@@ -20,3 +20,3 @@ var __defProp = Object.defineProperty; | ||
__export(server_exports, { | ||
PluginChinaRegion: () => PluginChinaRegion, | ||
PluginChinaRegionServer: () => PluginChinaRegionServer, | ||
default: () => server_default | ||
@@ -35,3 +35,3 @@ }); | ||
} | ||
class PluginChinaRegion extends import_server.Plugin { | ||
class PluginChinaRegionServer extends import_server.Plugin { | ||
async install() { | ||
@@ -84,6 +84,6 @@ await this.importData(); | ||
} | ||
var server_default = PluginChinaRegion; | ||
var server_default = PluginChinaRegionServer; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
PluginChinaRegion | ||
PluginChinaRegionServer | ||
}); |
{ | ||
"name": "@nocobase/plugin-china-region", | ||
"version": "0.21.0-alpha.6", | ||
"version": "0.21.0-alpha.7", | ||
"displayName": "Administrative divisions of China", | ||
@@ -25,3 +25,3 @@ "displayName.zh-CN": "中国行政区划", | ||
}, | ||
"gitHead": "25eaaf1bdf44d2b457a3a3742532db9d2008216b", | ||
"gitHead": "b1be3993f8aa81173d01bc390aa8e4c5adcc0e2d", | ||
"keywords": [ | ||
@@ -28,0 +28,0 @@ "Fields" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
295625