@nocobase/plugin-field-china-region 1.0.0-alpha.2 → 1.0.0-alpha.3

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.
@@ -1,3 +1,11 @@
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
+ */
1
9
  export declare const useChinaRegionDataSource: (options: any) => import("@nocobase/client").UseRequestResult<{
2
10
  sort: string;
3
11
  paginate: boolean;
@@ -1,3 +1,11 @@
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
+ */
1
9
  import { Plugin } from '@nocobase/client';
2
10
  export declare class PluginFieldChinaRegionClient extends Plugin {
3
11
  load(): Promise<void>;
@@ -1 +1,10 @@
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
+
1
10
  (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-field-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((d,u)=>{var f=o=>{try{a(i.next(o))}catch(s){u(s)}},r=o=>{try{a(i.throw(o))}catch(s){u(s)}},a=o=>o.done?d(o.value):Promise.resolve(o.value).then(f,r);a((i=i.apply(n,e)).next())});const d=r=>{const o=i.useField().componentProps.maxLevel;return e.useRequest({resource:"chinaRegions",action:"list",params:{sort:"code",paginate:!1,filter:{level:1}}},C(v({},r),{onSuccess(s){var l;r==null||r.onSuccess({data:((l=s==null?void 0:s.data)==null?void 0:l.map(c=>(o!==1&&(c.isLeaf=!1),c)))||[]})},manual:!0}))},u=()=>{const r=e.useAPIClient(),a=i.useField(),o=a.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,r.resource("chinaRegions").list({sort:"code",paginate:!1,filter:{parentCode:l.code}}).then(({data:t})=>{var g;l.loading=!1,l.children=((g=t==null?void 0:t.data)==null?void 0:g.map(h=>(o>h.level&&(h.isLeaf=!1),h)))||[],a.dataSource=[...a.dataSource]}).catch(t=>{console.error(t)}))}};class f extends e.Plugin{load(){return S(this,null,function*(){this.app.addScopes({useChinaRegionDataSource:d,useChinaRegionLoadData:u})})}}n.PluginFieldChinaRegionClient=f,n.default=f,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,8 +1,17 @@
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
+
1
10
  module.exports = {
2
11
  "@formily/core": "2.3.0",
3
12
  "@formily/react": "2.3.0",
4
- "@nocobase/client": "1.0.0-alpha.2",
5
- "@nocobase/server": "1.0.0-alpha.2",
13
+ "@nocobase/client": "1.0.0-alpha.3",
14
+ "@nocobase/server": "1.0.0-alpha.3",
6
15
  "china-division": "2.7.0",
7
- "@nocobase/database": "1.0.0-alpha.2"
16
+ "@nocobase/database": "1.0.0-alpha.3"
8
17
  };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,10 @@
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
+ */
1
9
  export * from './server';
2
10
  export { default } from './server';
package/dist/index.js CHANGED
@@ -1,3 +1,12 @@
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
+
1
10
  var __create = Object.create;
2
11
  var __defProp = Object.defineProperty;
3
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,2 +1,10 @@
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
+ */
1
9
  declare const _default: import("@nocobase/database").CollectionOptions;
2
10
  export default _default;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,3 +1,11 @@
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
+ */
1
9
  import { Plugin } from '@nocobase/server';
2
10
  export declare class PluginFieldChinaRegionServer extends Plugin {
3
11
  install(): Promise<void>;
@@ -1,3 +1,12 @@
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
+
1
10
  var __defProp = Object.defineProperty;
2
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
12
  var __getOwnPropNames = Object.getOwnPropertyNames;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-field-china-region",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.3",
4
4
  "displayName": "Administrative divisions of China",
5
5
  "displayName.zh-CN": "中国行政区划",
6
6
  "description": "Provides data and field type for administrative divisions of China.",
@@ -22,7 +22,7 @@
22
22
  "@nocobase/server": "1.x",
23
23
  "@nocobase/test": "1.x"
24
24
  },
25
- "gitHead": "f89dbc9e67d58404a2e484a5e124f739f340dcf8",
25
+ "gitHead": "7ccb137c7616cba5d238f87368239640e1d9ace1",
26
26
  "keywords": [
27
27
  "Fields"
28
28
  ]