@nocobase/plugin-data-source-manager 1.2.13-alpha → 1.3.0-alpha.20240710084543
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/package.json +2 -2
- package/dist/client/DatabaseConnectionProvider.d.ts +0 -11
- package/dist/client/ThridDataSource.d.ts +0 -12
- package/dist/client/component/BreadcumbTitle.d.ts +0 -10
- package/dist/client/component/CollectionsManager/AddFieldAction.d.ts +0 -13
- package/dist/client/component/CollectionsManager/CollectionFields.d.ts +0 -16
- package/dist/client/component/CollectionsManager/CollectionTitle.d.ts +0 -9
- package/dist/client/component/CollectionsManager/ConfigurationTable.d.ts +0 -10
- package/dist/client/component/CollectionsManager/ConfigurationTabs.d.ts +0 -10
- package/dist/client/component/CollectionsManager/EditCollectionAction.d.ts +0 -14
- package/dist/client/component/CollectionsManager/EditFieldAction.d.ts +0 -10
- package/dist/client/component/CollectionsManager/FilterTargetKeyAlert.d.ts +0 -12
- package/dist/client/component/CollectionsManager/SetFilterTargetKey.d.ts +0 -10
- package/dist/client/component/CollectionsManager/components/CollectionFieldInterfaceSelect.d.ts +0 -10
- package/dist/client/component/CollectionsManager/components/CollectionName.d.ts +0 -9
- package/dist/client/component/CollectionsManager/components/FieldTitleInput.d.ts +0 -10
- package/dist/client/component/CollectionsManager/components/FieldType.d.ts +0 -10
- package/dist/client/component/CollectionsManager/components/TitleField.d.ts +0 -10
- package/dist/client/component/CollectionsManager/components/UnSupportFields.d.ts +0 -10
- package/dist/client/component/CollectionsManager/components/index.d.ts +0 -14
- package/dist/client/component/CollectionsManager/hooks.d.ts +0 -20
- package/dist/client/component/CollectionsManager/index.d.ts +0 -10
- package/dist/client/component/CollectionsManager/schema/collectionFields.d.ts +0 -12
- package/dist/client/component/CollectionsManager/schema/collections.d.ts +0 -72
- package/dist/client/component/CreateDatabaseConnectAction.d.ts +0 -10
- package/dist/client/component/DatabaseConnectionManager.d.ts +0 -10
- package/dist/client/component/EditDatabaseConnectionAction.d.ts +0 -10
- package/dist/client/component/MainDataSourceManager/Configuration/AddCategoryAction.d.ts +0 -11
- package/dist/client/component/MainDataSourceManager/Configuration/CollectionFields.d.ts +0 -11
- package/dist/client/component/MainDataSourceManager/Configuration/ConfigurationTable.d.ts +0 -10
- package/dist/client/component/MainDataSourceManager/Configuration/ConfigurationTabs.d.ts +0 -10
- package/dist/client/component/MainDataSourceManager/Configuration/EditCategoryAction.d.ts +0 -11
- package/dist/client/component/MainDataSourceManager/Configuration/index.d.ts +0 -13
- package/dist/client/component/MainDataSourceManager/Configuration/interfaces.d.ts +0 -24
- package/dist/client/component/MainDataSourceManager/Configuration/schemas/collectionFields.d.ts +0 -10
- package/dist/client/component/MainDataSourceManager/Configuration/schemas/collections.d.ts +0 -15
- package/dist/client/component/MainDataSourceManager/index.d.ts +0 -10
- package/dist/client/component/PermissionManager/DataSourceTable.d.ts +0 -11
- package/dist/client/component/PermissionManager/PermisionProvider.d.ts +0 -13
- package/dist/client/component/PermissionManager/RoleConfigure.d.ts +0 -10
- package/dist/client/component/PermissionManager/RolesResourcesActions.d.ts +0 -11
- package/dist/client/component/PermissionManager/ScopeSelect.d.ts +0 -11
- package/dist/client/component/PermissionManager/StrategyActions.d.ts +0 -10
- package/dist/client/component/PermissionManager/index.d.ts +0 -11
- package/dist/client/component/PermissionManager/schemas/dataSourceTable.d.ts +0 -10
- package/dist/client/component/PermissionManager/schemas/roleCollections.d.ts +0 -10
- package/dist/client/component/PermissionManager/schemas/scopes.d.ts +0 -130
- package/dist/client/component/PermissionManager/schemas/useRoleResourceValues.d.ts +0 -16
- package/dist/client/component/PermissionManager/schemas/useSaveRoleResourceAction.d.ts +0 -11
- package/dist/client/component/PermissionManager/style.d.ts +0 -9
- package/dist/client/component/ViewDatabaseConnectionAction.d.ts +0 -10
- package/dist/client/constant.d.ts +0 -9
- package/dist/client/hooks/index.d.ts +0 -14
- package/dist/client/index.d.ts +0 -17
- package/dist/client/index.js +0 -59
- package/dist/client/locale/index.d.ts +0 -11
- package/dist/client/schema/index.d.ts +0 -15
- package/dist/externalVersion.js +0 -33
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -48
- package/dist/locale/zh-CN.json +0 -40
- package/dist/server/collections/data-sources-collections.d.ts +0 -10
- package/dist/server/collections/data-sources-collections.js +0 -75
- package/dist/server/collections/data-sources-fields.d.ts +0 -10
- package/dist/server/collections/data-sources-fields.js +0 -96
- package/dist/server/collections/data-sources-roles-resources-actions.d.ts +0 -10
- package/dist/server/collections/data-sources-roles-resources-actions.js +0 -61
- package/dist/server/collections/data-sources-roles-resources-scopes.d.ts +0 -10
- package/dist/server/collections/data-sources-roles-resources-scopes.js +0 -65
- package/dist/server/collections/data-sources-roles-resources.d.ts +0 -10
- package/dist/server/collections/data-sources-roles-resources.js +0 -71
- package/dist/server/collections/data-sources-roles.d.ts +0 -10
- package/dist/server/collections/data-sources-roles.js +0 -63
- package/dist/server/collections/data-sources.d.ts +0 -10
- package/dist/server/collections/data-sources.js +0 -80
- package/dist/server/errors/type-infer-error.d.ts +0 -10
- package/dist/server/errors/type-infer-error.js +0 -37
- package/dist/server/index.d.ts +0 -10
- package/dist/server/index.js +0 -48
- package/dist/server/migrations/20240301164024-migrate-acl-resources.d.ts +0 -15
- package/dist/server/migrations/20240301164024-migrate-acl-resources.js +0 -127
- package/dist/server/migrations/20240414103927-update-snippet-name.d.ts +0 -14
- package/dist/server/migrations/20240414103927-update-snippet-name.js +0 -60
- package/dist/server/models/connections-roles-resources-action.d.ts +0 -11
- package/dist/server/models/connections-roles-resources-action.js +0 -38
- package/dist/server/models/connections-roles-resources.d.ts +0 -11
- package/dist/server/models/connections-roles-resources.js +0 -38
- package/dist/server/models/data-source.d.ts +0 -25
- package/dist/server/models/data-source.js +0 -173
- package/dist/server/models/data-sources-collection-model.d.ts +0 -15
- package/dist/server/models/data-sources-collection-model.js +0 -46
- package/dist/server/models/data-sources-field-model.d.ts +0 -18
- package/dist/server/models/data-sources-field-model.js +0 -63
- package/dist/server/models/data-sources-roles-model.d.ts +0 -17
- package/dist/server/models/data-sources-roles-model.js +0 -64
- package/dist/server/plugin.d.ts +0 -21
- package/dist/server/plugin.js +0 -443
- package/dist/server/resourcers/data-sources-collections-fields.d.ts +0 -19
- package/dist/server/resourcers/data-sources-collections-fields.js +0 -140
- package/dist/server/resourcers/data-sources-collections.d.ts +0 -16
- package/dist/server/resourcers/data-sources-collections.js +0 -115
- package/dist/server/resourcers/data-sources-resources.d.ts +0 -17
- package/dist/server/resourcers/data-sources-resources.js +0 -97
- package/dist/server/resourcers/data-sources-roles.d.ts +0 -16
- package/dist/server/resourcers/data-sources-roles.js +0 -98
- package/dist/server/resourcers/roles-data-sources-collections.d.ts +0 -15
- package/dist/server/resourcers/roles-data-sources-collections.js +0 -111
- package/dist/server/services/full-data-repository.d.ts +0 -16
- package/dist/server/services/full-data-repository.js +0 -60
- package/dist/server/services/type-interface-map.d.ts +0 -191
- package/dist/server/services/type-interface-map.js +0 -253
- package/dist/server/utils.d.ts +0 -9
- package/dist/server/utils.js +0 -47
package/dist/client/index.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
(function(O,a){typeof exports=="object"&&typeof module!="undefined"?a(exports,require("react/jsx-runtime"),require("@nocobase/client"),require("react"),require("@formily/react"),require("antd"),require("react-i18next"),require("@ant-design/icons"),require("react-router-dom"),require("@formily/shared"),require("@formily/reactive"),require("@emotion/css"),require("@formily/core"),require("@formily/antd-v5"),require("lodash"),require("@nocobase/utils/client"),require("@dnd-kit/core"),require("antd-style")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@nocobase/client","react","@formily/react","antd","react-i18next","@ant-design/icons","react-router-dom","@formily/shared","@formily/reactive","@emotion/css","@formily/core","@formily/antd-v5","lodash","@nocobase/utils/client","@dnd-kit/core","antd-style"],a):(O=typeof globalThis!="undefined"?globalThis:O||self,a(O["@nocobase/plugin-data-source-manager"]={},O.jsxRuntime,O["@nocobase/client"],O.react,O["@formily/react"],O.antd,O["react-i18next"],O["@ant-design/icons"],O["react-router-dom"],O["@formily/shared"],O["@formily/reactive"],O["@emotion/css"],O["@formily/core"],O["@formily/antd-v5"],O.lodash,O["@nocobase/utils"],O["@dnd-kit/core"],O["antd-style"]))})(this,function(O,a,r,p,F,x,B,W,L,V,dt,ye,fe,ae,Y,Ro,Q,en){"use strict";var Yf=Object.defineProperty,Jf=Object.defineProperties;var Zf=Object.getOwnPropertyDescriptors;var Ne=Object.getOwnPropertySymbols;var Jo=Object.prototype.hasOwnProperty,Zo=Object.prototype.propertyIsEnumerable;var ut=(O,a,r)=>a in O?Yf(O,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):O[a]=r,T=(O,a)=>{for(var r in a||(a={}))Jo.call(a,r)&&ut(O,r,a[r]);if(Ne)for(var r of Ne(a))Zo.call(a,r)&&ut(O,r,a[r]);return O},K=(O,a)=>Jf(O,Zf(a));var pt=(O,a)=>{var r={};for(var p in O)Jo.call(O,p)&&a.indexOf(p)<0&&(r[p]=O[p]);if(O!=null&&Ne)for(var p of Ne(O))a.indexOf(p)<0&&Zo.call(O,p)&&(r[p]=O[p]);return r};var Xo=(O,a,r)=>(ut(O,typeof a!="symbol"?a+"":a,r),r);var P=(O,a,r)=>new Promise((p,F)=>{var x=L=>{try{W(r.next(L))}catch(V){F(V)}},B=L=>{try{W(r.throw(L))}catch(V){F(V)}},W=L=>L.done?p(L.value):Promise.resolve(L.value).then(x,B);W((r=r.apply(O,a)).next())});const j="data-source-manager";function tn(e,t={}){return r.i18n.t(e,K(T({},t),{ns:j}))}function on(){return B.useTranslation([j,"client"],{nsMode:"fallback"})}const nn=e=>{const t=F.useForm(),o=r.useActionContext(),n=r.useAPIClient(),{t:i}=B.useTranslation(),s=F.useField();return s.data=s.data||{},{run(){return P(this,null,function*(){yield t.submit();try{s.data.loading=!0;const{data:l}=yield n.resource("databaseServers").create({values:T({},t.values)});s.data.loading=!1,o.setVisible(!1),yield t.reset(),e==null||e(l==null?void 0:l.data),x.message.success(i("Saved successfully"))}catch(l){s.data.loading=!1,console.log(l)}})}}},mt=()=>{const e=F.useForm(),t=r.useAPIClient(),{t:o}=B.useTranslation(),n=F.useField();return n.data=n.data||{},{run(){return P(this,null,function*(){yield e.submit();try{n.data.loading=!0,yield t.resource("dataSources").testConnection({values:T({},e.values)}),n.data.loading=!1,x.message.success(o("Connection successful",{ns:j}))}catch(s){n.data.loading=!1,console.log(s)}})}}},rn=Object.freeze(Object.defineProperty({__proto__:null,useCreateDatabaseServer:nn,useTestConnectionAction:mt},Symbol.toStringTag,{value:"Module"})),Ae=p.createContext(null);Ae.displayName="DataSourceContext";const an=e=>{const[t,o]=p.useState(null);return a.jsx(Ae.Provider,{value:{dataSource:t,setDataSource:o},children:a.jsx(r.SchemaComponentOptions,{scope:rn,components:{},children:e.children})})};class yt extends r.DataSource{getDataSource(){return P(this,null,function*(){return(yield this.app.apiClient.request({url:`dataSources:get/${this.key}`,params:{appends:["collections"]}})).data.data})}}const ft=[{value:"loading",label:`{{t("Loading",{ns:"${j}"})}}`,color:"orange"},{value:"loading-failed",label:`{{t("Failed",{ns:"${j}"})}}`,color:"red"},{value:"loaded",label:`{{t("Loaded",{ns:"${j}"})}}`,color:"green"},{value:"reloading",label:`{{t("Reloading",{ns:"${j}"})}}`,color:"orange"}],gt={name:"collections-"+V.uid(),fields:[{type:"string",name:"key",interface:"input",uiSchema:{title:`{{t("Data source name",{ ns: "${j}" })}}`,type:"string","x-component":"Input",required:!0}},{type:"string",name:"displayName",interface:"input",uiSchema:{title:`{{t("Data source display name",{ ns: "${j}" })}}`,type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Type", { ns: "${j}" })}}`,type:"string","x-component":"Select",enum:"{{types}}"}},{type:"string",name:"status",interface:"select",uiSchema:{title:`{{t("Status", { ns: "${j}" })}}`,type:"string","x-component":"Select",enum:ft}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},sn={type:"object",properties:{[V.uid()]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:gt,resourceName:"dataSources",request:{resource:"dataSources",action:"list",params:{pageSize:50,appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:gt},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"},actionCallback:"{{ dataSourceDeleteCallback }}"}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"CreateDatabaseConnectAction","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"key",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{key:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},displayName:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{status:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{},properties:{view:{type:"void",title:'{{t("View")}}',"x-component":"ViewDatabaseConnectionAction","x-component-props":{type:"primary"}},update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditDatabaseConnectionAction","x-component-props":{type:"primary"},"x-reactions":["{{useIsAbleDelete($self)}}"]},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete it?")}}'},useAction:"{{useDestroyAction}}"},"x-reactions":["{{useIsAbleDelete($self)}}"]}}}}}}}}}}},ht=()=>{const e=r.useApp(),{name:t}=L.useParams(),o=r.useCompile(),n=r.useDataSourceManager(),{displayName:i}=n.getDataSource(t)||{},{dataSource:s}=p.useContext(Ae),c=p.useMemo(()=>s||n.getDataSource(t),[s,t]),l=p.useMemo(()=>{const y=c==null?void 0:c.status,u=ft.find(m=>m.value===y),f=[{title:a.jsx(L.Link,{to:e.pluginSettingsManager.getRoutePath(j),children:tn("Data source manager")})}];return c&&f.push({title:a.jsxs(x.Space,{children:[a.jsx("span",{children:o(i)}),y&&a.jsx(x.Tag,{color:u==null?void 0:u.color,children:o(u==null?void 0:u.label)},y)]})}),f},[c]);return a.jsx(x.Breadcrumb,{separator:a.jsx(W.RightOutlined,{}),items:l})},Ct=({collectionName:e})=>{const t=r.useApp(),{name:o="main"}=L.useParams(),n=p.useMemo(()=>t.getCollectionManager(o).getCollection(e),[t,o,e]);return!(n!=null&&n.filterTargetKey)&&a.jsx(x.Alert,{style:{marginBottom:16},type:"warning",message:a.jsx(xt,{})})},cn={association:{sourceKey:"name",targetKey:"name"},collection:{name:"fields",fields:[{type:"string",name:"type",interface:"input",uiSchema:{title:'{{ t("Storage type") }}',type:"string","x-component":"Select",enum:[{label:"String",value:"string"}],required:!0}},{type:"string",name:"interface",interface:"input",uiSchema:{title:'{{ t("Field interface") }}',type:"string","x-component":"Select",enum:"{{interfaces}}"}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{ t("Field display name") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Field name") }}',type:"string","x-component":"Input"}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input.TextArea"}}]},request:{resource:"collections.fields",action:"list",params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}}},$e=p.createContext(null),ln=e=>a.jsx($e.Provider,{value:r.useResourceActionContext(),children:a.jsx(r.ResourceActionProvider,K(T({},cn),{children:e.children}))}),un=ye.css`
|
|
11
|
-
.ant-table {
|
|
12
|
-
margin-left: -16px !important;
|
|
13
|
-
}
|
|
14
|
-
`,pn=ye.css`
|
|
15
|
-
tr {
|
|
16
|
-
display: flex;
|
|
17
|
-
}
|
|
18
|
-
td,
|
|
19
|
-
th {
|
|
20
|
-
flex: 2;
|
|
21
|
-
width: 0;
|
|
22
|
-
&:nth-child(5) {
|
|
23
|
-
flex: 1.2;
|
|
24
|
-
}
|
|
25
|
-
&:last-child {
|
|
26
|
-
flex: 1.8;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
.ant-table-selection-column,
|
|
30
|
-
.ant-table-row-expand-icon-cell {
|
|
31
|
-
flex-basis: 50px !important;
|
|
32
|
-
min-width: 50px;
|
|
33
|
-
flex: 0;
|
|
34
|
-
}
|
|
35
|
-
`,vt="Default title for each record",dn=e=>{const t=r.useCompile(),{getInterface:o}=r.useCollectionManager_deprecated(),{t:n}=B.useTranslation(),{setState:i}=r.useResourceActionContext(),{targetKey:s}=e.collectionResource||{},c=r.useRecord(),[l,y]=p.useState(null),{refreshCM:u,isTitleField:f,getTemplate:m}=r.useCollectionManager_deprecated(),{[s]:S,titleField:w,template:A}=c,C=m(A),v=r.useAPIClient(),d=p.useContext($e),h=[{dataIndex:["uiSchema","title"],title:n("Field display name"),render:g=>a.jsx("div",{style:{marginLeft:7},children:t(g)})},{dataIndex:"name",title:n("Field name")},{dataIndex:"interface",title:n("Field interface"),render:g=>{var b;return a.jsx(x.Tag,{children:t((b=o(g))==null?void 0:b.title)})}},{dataIndex:"titleField",title:n("Title field"),render:function(b,_){const N=E=>P(this,null,function*(){var D;y(_),yield v.request({url:`collections:update?filterByTk=${S}`,method:"post",data:{titleField:E?_.name:"id"}}),(D=d==null?void 0:d.refresh)==null||D.call(d),yield e.refreshAsync(),y(null),u(),x.message.success(n("Saved successfully"))});return f(_)?a.jsx(x.Tooltip,{title:n(vt),placement:"right",overlayInnerStyle:{textAlign:"center"},children:a.jsx(x.Switch,{"aria-label":`switch-title-field-${_.name}`,size:"small",loading:_.name===(l==null?void 0:l.name),checked:_.name===(w||"id"),onChange:N})}):null}},{dataIndex:"description",title:n("Descriptio "),render:g=>a.jsx(r.Input.ReadPretty,{value:g,ellipsis:!0})},{dataIndex:"actions",title:n("Actions"),render:(g,b)=>{const _={confirm:{title:n("Delete record"),content:n("Are you sure you want to delete it?")},useAction:r.useDestroyActionAndRefreshCM,disabled:r.isDeleteButtonDisabled(b)||(C==null?void 0:C.forbidDeletion),title:n("Delete")};return a.jsx(r.RecordProvider,{record:b,parent:c,children:a.jsxs(x.Space,{children:[a.jsx(r.EditCollectionField,{role:"button","aria-label":`edit-button-${b.name}`,type:"primary"}),a.jsx(r.Action.Link,T({},_))]})})}}];return a.jsx(x.Table,{rowKey:"name",columns:h,showHeader:!1,pagination:!1,dataSource:e.fields,rowSelection:{type:"checkbox",getCheckboxProps(g){return{"aria-label":`checkbox-${g.name}`}},onChange:g=>{i(b=>K(T({},b),{selectedRowKeys:g}))}},className:un})},mn=e=>{const t=r.useCompile(),{getInterface:o}=r.useCollectionManager_deprecated(),{targetKey:n}=e.collectionResource||{},i=r.useRecord(),[s,c]=p.useState(null),{t:l}=B.useTranslation(),{refreshCM:y,isTitleField:u}=r.useCollectionManager_deprecated(),{[n]:f,titleField:m,name:S}=i,w=p.useContext($e),A=r.useAPIClient(),C=[{dataIndex:["uiSchema","rawTitle"],title:l("Field display name"),render:v=>a.jsx("div",{style:{marginLeft:1},children:t(v)})},{dataIndex:"name",title:l("Field name")},{dataIndex:"interface",title:l("Field interface"),render:v=>{var d;return a.jsx(x.Tag,{children:t((d=o(v))==null?void 0:d.title)})}},{dataIndex:"titleField",title:l("Title field"),render(v,d){const h=g=>P(this,null,function*(){var b;c(d),yield A.request({url:`collections:update?filterByTk=${f}`,method:"post",data:{titleField:g?d.name:"id"}}),(b=w==null?void 0:w.refresh)==null||b.call(w),yield e.refreshAsync(),c(null),y(),x.message.success(l("Saved successfully"))});return u(d)?a.jsx(x.Tooltip,{title:l(vt),placement:"right",overlayInnerStyle:{textAlign:"center"},children:a.jsx(x.Switch,{size:"small",loading:d.name===(s==null?void 0:s.name),checked:d.name===(m||"id"),onChange:h})}):null}},{dataIndex:"actions",title:l("Actions"),render:function(d,h){const g={type:"primary",currentCollection:S},b={type:"primary"};return a.jsx(r.RecordProvider,{record:h,parent:i,children:a.jsxs(x.Space,{children:[a.jsx(r.OverridingCollectionField,T({},g)),a.jsx(r.ViewCollectionField,T({},b))]})})}}];return a.jsx(x.Table,{rowKey:"name",columns:C,showHeader:!1,pagination:!1,dataSource:e.fields.filter(v=>v.interface)})},yn=()=>{const e=r.useCompile(),t=F.useField(),{name:o,template:n}=r.useRecord(),{data:{database:i}}=r.useCurrentAppInfo(),{getInterface:s,getInheritCollections:c,getCollection:l,getTemplate:y}=r.useCollectionManager_deprecated(),u=p.useMemo(()=>fe.createForm(),[]),f=r.useAttach(u.createArrayField(K(T({},t.props),{basePath:""}))),{t:m}=B.useTranslation(),S=r.useResourceContext(),{refreshAsync:w,data:A}=p.useContext(r.ResourceActionContext),C=y(n),v=c(o),d=[{dataIndex:"title",title:m("Field display name"),render:D=>a.jsx("div",{className:ye.css`
|
|
36
|
-
font-weight: 500;
|
|
37
|
-
`,children:D})},{dataIndex:"name",title:m("Field name")},{dataIndex:"interface",title:m("Field interface")},{dataIndex:"titleField",title:m("Title field")},{dataIndex:"description",title:m("Description")},{dataIndex:"actions",title:m("Actions")}],h=(A==null?void 0:A.data)||[],g={pf:[],association:[],general:[],system:[]};h.forEach(D=>{if(D.primaryKey||D.isForeignKey)g.pf.push(D);else if(D.interface){const k=s(D.interface);(k==null?void 0:k.group)==="systemInfo"?g.system.push(D):(k==null?void 0:k.group)==="relation"?g.association.push(D):g.general.push(D)}});const b=[{key:"pf",title:m("PK & FK fields"),fields:g.pf},{key:"association",title:m("Association fields"),fields:g.association},{key:"general",title:m("General fields"),fields:g.general},{key:"system",title:m("System fields"),fields:g.system}];b.push(...v.map(D=>{const k=l(D);if(k)return{key:D,title:`${m("Inherited fields")} - `+e(k==null?void 0:k.title),inherit:!0,fields:(k==null?void 0:k.fields)||[]}}).filter(Boolean));const _=p.useMemo(()=>({useAction:()=>r.useBulkDestroyActionAndRefreshCM(!0),title:m("Delete"),icon:"DeleteOutlined",disabled:C==null?void 0:C.forbidDeletion,confirm:{title:m("Delete record"),content:m("Are you sure you want to delete it?")}}),[m]),N={type:"primary",database:i},E={type:"primary"};return a.jsx(F.FormContext.Provider,{value:u,children:a.jsxs(F.FieldContext.Provider,{value:f,children:[a.jsx(Ct,{collectionName:o}),a.jsxs(x.Space,{align:"end",className:ye.css`
|
|
38
|
-
justify-content: flex-end;
|
|
39
|
-
display: flex;
|
|
40
|
-
margin-bottom: 16px;
|
|
41
|
-
`,children:[a.jsx(r.Action,T({},_)),a.jsx(r.SyncFieldsAction,T({},E)),a.jsx(r.SyncSQLFieldsAction,{refreshCMList:w}),a.jsx(r.SchemaComponent,{schema:{type:"object",properties:T({},C.configureActions)}}),a.jsx(r.AddCollectionField,T({},N))]}),a.jsx(x.Table,{rowKey:"key",columns:d,dataSource:b.filter(D=>D.fields.length),pagination:!1,className:pn,expandable:{defaultExpandAllRows:!0,defaultExpandedRowKeys:b.map(D=>D.key),expandedRowRender:D=>D.inherit?a.jsx(mn,{fields:D.fields,collectionResource:S,refreshAsync:w}):a.jsx(dn,{fields:D.fields,collectionResource:S,refreshAsync:w})}})]})})},bt=()=>a.jsx(ln,{children:a.jsx(yn,{})}),xt=e=>{const{size:t,style:o}=e,n=r.useAPIClient(),{name:i="main"}=L.useParams(),s=r.useCollectionRecordData(),c=r.useApp(),[l,y]=p.useState(),[u,f]=p.useState(),m=r.useCompile(),S=p.useMemo(()=>c.getCollectionManager(i).getCollection(s.name),[c,i,s.name]),w=p.useMemo(()=>c.getCollectionManager(i).getCollectionFields(s.name).filter(g=>g.interface?!!c.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(g.interface).titleUsable:!1).map(g=>{var b;return{label:m((b=g.uiSchema)==null?void 0:b.title),value:g.name}}),[c,m,i,s.name]),{refresh:A}=r.useResourceActionContext(),C=p.useContext($e),{t:v}=on();return a.jsxs("div",{style:T({},o),children:[v("If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection."),t==="small"?a.jsx("br",{}):" ",a.jsxs(x.Space.Compact,{style:{marginTop:5},children:[a.jsx(x.Select,{onChange:(d,h)=>{y(d),f(h.label)},placeholder:v("Select field"),size:"small",options:w}),a.jsx(x.Popconfirm,{placement:"bottom",title:a.jsx("div",{style:{width:"15em"},children:u?v(`Are you sure you want to set the "{{title}}" field as a record unique key? This setting cannot be changed after it's been set.`,{title:u}):v("Please select a field.")}),onConfirm:()=>P(this,null,function*(){var d;l&&(i==="main"?yield n.request({url:`collections:update?filterByTk=${s.name}`,method:"post",data:{filterTargetKey:l}}):yield n.request({url:`dataSources/${i}/collections:update?filterByTk=${s.name}`,method:"post",data:{filterTargetKey:l}}),(d=C==null?void 0:C.refresh)==null||d.call(C),A(),S.setOption("filterTargetKey",l))}),children:a.jsx(x.Button,{type:"primary",size:"small",children:v("OK")})})]})]})},St=e=>{const t=r.useCollectionRecordData()||{},o=r.useCompile();return F.useField().editable?a.jsx(r.Input,T({},e)):t!=null&&t.filterTargetKey?o(t.title):a.jsxs("div",{style:{display:"inline"},children:[a.jsx(x.Popover,{trigger:["click"],content:a.jsx(xt,{size:"small",style:{width:"20em"}}),children:a.jsx(W.ExclamationCircleTwoTone,{style:{marginRight:"0.3em"},twoToneColor:"#faad14"})}),o(t.title)]})},At=e=>F.Schema.compile(e,{t:r.i18n.t}),fn={name:"database-"+V.uid(),filterTargetKey:"name",targetKey:"name",sortable:!0,fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{ t("Collection display name") }}',type:"number","x-component":St,required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Collection name") }}',type:"string","x-component":"CollectionName",description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'}},{type:"hasMany",name:"fields",target:"fields",collectionName:"collections",sourceKey:"name",targetKey:"name",uiSchema:{}},{type:"hasMany",name:"inherits",interface:"select",uiSchema:{title:'{{ t("Inherits") }}',type:"string","x-component":"Select","x-component-props":{mode:"multiple"}}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input"}}]},gn=e=>({type:"object",properties:{[V.uid()]:{type:"void","x-collection":"dataSources","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:fn,dragSort:!1,request:{url:`dataSources/${e}/collections:list`,params:{pageSize:50,sort:"sort",filter:{"hidden.$isFalsy":!0},appends:["category"]}}},properties:{tabs:{type:"void","x-component":"ConfigurationTabs"}}}}}),Be={type:"object",properties:{[V.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}},{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"DeleteCollection","x-component-props":{role:"button",isBulk:!0},"x-visible":!1},create:{type:"void",title:'{{ t("Create collection") }}',"x-component":"AddCollection","x-component-props":{type:"primary"},"x-visible":!1}}},[V.uid()]:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{cm.useDataSourceFromRAC }}",useAction(){const e=r.useAPIClient(),{t}=B.useTranslation();return{move(n,i){return P(this,null,function*(){yield e.resource("dataSources").move({sourceId:n.key,targetId:i.key}),x.message.success(t("Saved successfully"),.2)})}}}},properties:{column1:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{"x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column5:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{"x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},column6:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{ t("Configure fields") }}',"x-component":"Action.Link","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{destroyOnClose:!0,width:"70%"},"x-reactions":e=>{const t=e.path.segments[1],o=e.path.segments[0],n=e.form.getValuesIn(`${o}.${t}`);n&&(e.title=`${At(n.title||n.name)} - ${At('{{ t("Configure fields") }}')}`)},properties:{collectionFields:{type:"void","x-component":"CollectionFields"}}}}},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"EditCollection","x-component-props":{role:"button","aria-label":'{{ "edit-button-" + $record.name }}',type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-visible":!1,"x-component":"DeleteCollection","x-component-props":{role:"button","aria-label":'{{ "delete-button-" + $record.name }}',type:"primary",className:"nb-action-link"}}}}}}}}}},Te=["string","bigInt","integer","uuid","uid"],hn=F.observer(e=>{var u,f;const{name:t}=L.useParams(),{collectionName:o,sourceKey:n,name:i}=r.useRecord(),s=F.useField(),c=r.useCompile(),{getCollection:l}=r.useCollectionManager_deprecated(),y=(u=l(o||i,t).fields)==null?void 0:u.filter(m=>m.primaryKey||m.unique).map(m=>{var S;return{value:m.name,label:c(((S=m.uiSchema)==null?void 0:S.title)||m.title||m.name)}});return p.useEffect(()=>{var m;s.initialValue=((m=y==null?void 0:y[0])==null?void 0:m.value)||n},[]),a.jsx("div",{children:a.jsx(x.Select,{disabled:n,options:y,defaultValue:((f=y==null?void 0:y[0])==null?void 0:f.value)||n,onChange:e==null?void 0:e.onChange,showSearch:!0})})},{displayName:"SourceKey"}),$t=F.observer(e=>{const{disabled:t}=e,o=r.useAPIClient(),[n,i]=p.useState([]),{name:s}=L.useParams(),c=r.useRecord(),l=F.useField(),{collectionName:y,target:u,type:f,through:m,name:S}=c,w=c[l.props.name],{getCollection:A}=r.useCollectionManager_deprecated(),C=r.useCompile(),v=F.useForm(),[d,h]=p.useState(w);return p.useEffect(()=>{var _;l.initialValue=null;const g=["belongsTo"].includes(f)?y:["belongsToMany"].includes(f)?m:u,b=(_=A(g,s))==null?void 0:_.fields;if(b){const N=b==null?void 0:b.filter(E=>Te.includes(E.type)).map(E=>{var D;return{value:E.name,label:C(((D=E.uiSchema)==null?void 0:D.title)||E.title||E.name)}});if(i(N),w){const E=N.find(D=>D.value===w);h((E==null?void 0:E.label)||w)}}},[f]),p.useEffect(()=>{h(w)},[w]),a.jsx("div",{children:a.jsx(x.Select,{disabled:t,value:d,options:n,showSearch:!0,onDropdownVisibleChange:g=>P(this,null,function*(){var D;const{target:b,type:_,through:N}=v.values,E=["belongsTo"].includes(_)?y||S:["belongsToMany"].includes(_)?N:b;if(E&&g){const{data:k}=yield o.request({url:`dataSourcesCollections/${s}.${E}/fields:list`,params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}});i((D=k.data)==null?void 0:D.filter($=>Te.includes($.type)).map($=>{var M;return{value:$.name,label:C(((M=$.uiSchema)==null?void 0:M.title)||$.title||$.name)}}))}}),onChange:g=>{var b;(b=e==null?void 0:e.onChange)==null||b.call(e,g),h(g)}})})},{displayName:"ForeignKey"}),Cn=F.observer(e=>{const{value:t,disabled:o}=e,{targetKey:n,target:i,type:s}=r.useRecord(),{name:c}=L.useParams(),{getCollection:l}=r.useCollectionManager_deprecated(),y=r.useAPIClient(),[u,f]=p.useState([]),[m,S]=p.useState(t||n),w=F.useForm(),A=r.useCompile(),C=F.useField();return C.required=!0,p.useEffect(()=>{var v;i&&f((v=l(i,c).fields)==null?void 0:v.filter(d=>s!=="hasMany"?d.primaryKey||d.unique:Te.includes(d.type)).map(d=>{var h;return{value:d.name,label:A(((h=d==null?void 0:d.uiSchema)==null?void 0:h.title)||d.title||d.name)}}))},[]),a.jsx("div",{children:a.jsx(x.Select,{showSearch:!0,options:u,onDropdownVisibleChange:v=>P(this,null,function*(){var g;const{target:d,type:h}=w.values;if(d&&v){const{data:b}=yield y.request({url:`dataSourcesCollections/${c}.${d}/fields:list`,params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}});f((g=b.data)==null?void 0:g.filter(_=>h!=="hasMany"?_.primaryKey||_.unique:Te.includes(_.type)).map(_=>{var N;return{value:_.name,label:A(((N=_.uiSchema)==null?void 0:N.title)||_.title||_.name)}}))}}),onChange:v=>{var d;(d=e==null?void 0:e.onChange)==null||d.call(e,v),S(v)},value:m,disabled:o})})},{displayName:"TargetKey"}),vn=F.observer(()=>{const e=r.useCompile(),{targetCollection:t}=ct();return a.jsx("div",{children:a.jsx(x.Select,{disabled:!0,showSearch:!0,popupMatchSelectWidth:!1,value:t.name,options:[{value:t.name,label:e(t.title||t.name)}]})})},{displayName:"SourceCollection"}),bn=F.observer(e=>{const{disabled:t}=e,o=r.useCompile(),[n,i]=p.useState([]),{name:s}=L.useParams(),c=F.useField(),{getCollections:l}=r.useCollectionManager_deprecated(s),u=r.useRecord()[c.props.name],f=()=>l().filter(S=>!(S.autoCreate&&S.isThrough)).map(S=>({label:o(S.title||S.name),value:S.name}));return p.useEffect(()=>{const m=f();i(m)},[]),a.jsx("div",{children:a.jsx(x.Select,{disabled:t,showSearch:!0,popupMatchSelectWidth:!1,fieldNames:{label:"label",value:"value"},defaultValue:u,options:n,onChange:m=>{var S;(S=e==null?void 0:e.onChange)==null||S.call(e,m)}})})},{displayName:"ThroughCollection"}),xn=(e,t,o)=>{var s;if(!e)return;const n=Y.cloneDeep(e.properties);n!=null&&n.foreignKey&&(n.foreignKey["x-component"]=$t),e.hasDefaultValue===!0&&(n.defaultValue=Y.cloneDeep((s=e==null?void 0:e.default)==null?void 0:s.uiSchema),n.defaultValue.required=!1,n.defaultValue.title=o('{{ t("Default value") }}'),n.defaultValue["x-decorator"]="FormItem",n.defaultValue["x-reactions"]={dependencies:["uiSchema.x-component-props.gmt","uiSchema.x-component-props.showTime","uiSchema.x-component-props.dateFormat","uiSchema.x-component-props.timeFormat"],fulfill:{state:{componentProps:{gmt:"{{$deps[0]}}",showTime:"{{$deps[1]}}",dateFormat:"{{$deps[2]}}",timeFormat:"{{$deps[3]}}"}}}});const i=K(T({name:`f_${V.uid()}`},Y.cloneDeep(e.default)),{interface:e.name});return i.reverseField&&(i.reverseField.name=`f_${V.uid()}`),{type:"object",properties:{[V.uid()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues(c){return r.useRequest(()=>Promise.resolve({data:i}),c)}},title:`${o(t.title||t.name)} - ${o('{{ t("Add field") }}')}`,properties:K(T({summary:{type:"void","x-component":"FieldSummary","x-component-props":{schemaKey:e.name}}},n),{description:{type:"string",title:'{{t("Description")}}',"x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreateCollectionField }}"}}}}})}}}},Sn=()=>{const e=F.useForm(),t=r.useActionContext(),{refresh:o}=r.useResourceActionContext(),n=F.useField(),i=r.useAPIClient(),s=r.useRecord(),{name:c}=L.useParams(),l=r.useDataSourceManager();return{run(){return P(this,null,function*(){yield e.submit(),n.data=n.data||{},n.data.loading=!0;const u=Y.cloneDeep(e.values);u.autoCreateReverseField||delete u.reverseField,delete u.autoCreateReverseField;try{yield i.request({url:`dataSourcesCollections/${c}.${s.name}/fields:create`,method:"post",data:u}),t.setVisible(!1),l.getDataSource(c).reload(),yield e.reset(),n.data.loading=!1,o()}catch(f){n.data.loading=!1}})}}},An=e=>{const t=r.useRecord();return a.jsx($n,T({item:t},e))},$n=e=>{const{scope:t,getContainer:o,item:n,children:i,trigger:s,align:c,database:l}=e,{getInterface:y,getTemplate:u,collections:f}=r.useCollectionManager_deprecated(),[m,S]=p.useState(!1),[w,A]=p.useState(),[C,v]=p.useState({}),d=r.useCompile(),{t:h}=B.useTranslation(),{data:{database:g}}=r.useCurrentAppInfo(),b=$=>(g==null?void 0:g.dialect)===$,_=p.useMemo(()=>f.map($=>({label:d($.title),value:$.name})),[]),N=r.useFieldInterfaceOptions(),E=p.useCallback(()=>{const{availableFieldInterfaces:$}=u(n.template)||{},{exclude:M,include:I}=$||{},z=[];return N.forEach(U=>{var R;if(U.key==="relation"){let J=[];I!=null&&I.length?I.forEach(X=>{var H;const Se=(H=U==null?void 0:U.children)==null?void 0:H.find(Qo=>[X,X.interface].includes(Qo.value));Se&&J.push(K(T({},Se),{targetScope:X==null?void 0:X.targetScope}))}):M!=null&&M.length?J=(R=U==null?void 0:U.children)==null?void 0:R.filter(X=>!M.includes(X.value)):J=U==null?void 0:U.children,J!=null&&J.length&&z.push(K(T({},U),{children:J}))}}),z},[u,n]),D=p.useMemo(()=>E().map($=>{var M;return((M=$==null?void 0:$.children)==null?void 0:M.length)===0?null:n.template==="view"?{type:"group",label:d($.label),title:d($.label),key:$.label,children:$.children.filter(I=>["m2o"].includes(I.name)).map(I=>({label:d(I.title),title:d(I.title),key:I.name,dataTargetScope:I.targetScope}))}:{type:"group",label:d($.label),title:d($.label),key:$.label,children:$==null?void 0:$.children.filter(I=>!["o2o","subTable","linkTo"].includes(I.name)).map(I=>({label:d(I.title),title:d(I.title),key:I.name,dataTargetScope:I.targetScope}))}}).filter($=>{var M;return(M=$==null?void 0:$.children)==null?void 0:M.length}),[E]),k=p.useMemo(()=>({style:{maxHeight:"60vh",overflow:"auto"},onClick:$=>{const M=$.item.props["data-targetScope"];M&&A(M);const I=xn(y($.key),n,d);I&&(v(I),S(!0))},items:D}),[y,D,n]);return n.template!=="sql"&&a.jsx(r.RecordProvider,{record:n,children:a.jsxs(r.ActionContextProvider,{value:{visible:m,setVisible:S},children:[a.jsx(x.Dropdown,{getPopupContainer:o,trigger:s,align:c,menu:k,children:i||a.jsx(x.Button,{icon:a.jsx(W.PlusOutlined,{}),type:"primary",children:h("Add field")})}),a.jsx(r.SchemaComponent,{schema:C,components:{ArrayTable:ae.ArrayTable},scope:T({getContainer:o,useCancelAction:r.useCancelAction,createOnly:!0,isOverride:!1,override:!1,useCreateCollectionField:Sn,record:n,showReverseFieldConfig:!1,targetScope:w,collections:_,isDialect:b,disabledJSONB:!1,createMainOnly:!0},t)})]})})},Tt=(e,t)=>{const o=[];return e.forEach(n=>{const i=n.children.filter(s=>{var c;return(c=s==null?void 0:s.availableTypes)==null?void 0:c.includes(t)});o.push({label:n.label,key:n.key,children:i})}),o.filter(n=>t==="sort"?n.key==="advanced":n.children.length>0)},Tn=(e,t)=>t==null?void 0:t.some(o=>{var n,i;return(i=(n=o.children)==null?void 0:n.some)==null?void 0:i.call(n,s=>s.name===e)}),Fn=F.observer(e=>{var w;const{value:t,handleFieldChange:o}=e,{data:n}=r.useCollectionRecord(),{getInterface:i}=r.useCollectionManager_deprecated(),s=r.useCompile(),c=r.useFieldInterfaceOptions(),l=Tt(c,n.type),[y,u]=p.useState(t),[f,m]=p.useState(l),S=n.type;return p.useEffect(()=>{var A,C,v,d,h,g,b,_,N,E,D,k;if(f.length===1&&((C=(A=f[0])==null?void 0:A.children)==null?void 0:C.length)===1){const $=(h=(d=(v=f[0])==null?void 0:v.children)==null?void 0:d[0])==null?void 0:h.name;if($!==y){const M=i($);o({interface:$,uiSchema:T({title:(g=n==null?void 0:n.uiSchema)==null?void 0:g.title},(b=M==null?void 0:M.default)==null?void 0:b.uiSchema)},n.name,!1),u($)}}else if(y&&!Tn(y,f)){const $=(E=(N=(_=f[0])==null?void 0:_.children)==null?void 0:N[0])==null?void 0:E.name,M=i($);o({interface:$,uiSchema:T({title:(D=n==null?void 0:n.uiSchema)==null?void 0:D.title},(k=M==null?void 0:M.default)==null?void 0:k.uiSchema)},n.name,!1),u($)}},[f]),p.useEffect(()=>{if(n!=null&&n.possibleTypes){const A=Tt(c,S);m(A)}},[S]),["oho","obo","o2m","m2o","m2m"].includes(n.interface)?a.jsx(x.Tag,{children:s((w=c.find(A=>A.key==="relation").children.find(A=>A.name===t))==null?void 0:w.label)},t):a.jsx(x.Select,{"aria-label":`field-interface-${n==null?void 0:n.type}`,role:"button",value:y,style:{width:"100%"},popupMatchSelectWidth:!1,onChange:A=>{var v,d;const C=i(A);o({interface:A,uiSchema:T({title:(v=n==null?void 0:n.uiSchema)==null?void 0:v.title},(d=C==null?void 0:C.default)==null?void 0:d.uiSchema)},n.name),u(A)},children:f.map(A=>a.jsx(x.Select.OptGroup,{label:s(A.label),children:A.children.map(C=>a.jsx(x.Select.Option,{value:C.name,children:s(C.label)},C.name))},A.key))})},{displayName:"CollectionFieldInterfaceSelect"}),wn=F.observer(e=>{const{value:t,handleFieldChange:o}=e,n=r.useRecord(),[i,s]=p.useState(t),c=u=>{s(u)},l=p.useMemo(()=>Y.debounce(u=>{o({uiSchema:K(T({},n==null?void 0:n.uiSchema),{title:u})},n.name)},1e3),[o,n]),y=u=>{const f=u.target.value;c(f),l(f)};return p.useEffect(()=>{s(t)},[t]),a.jsx(x.Input,{value:i,onChange:y,style:{minWidth:"100px"},"aria-label":"field-title-input"})},{displayName:"FieldTitleInput"}),_n=F.observer(e=>{const{value:t,handleFieldChange:o,onChange:n}=e,i=r.useRecord(),s=i;return s!=null&&s.possibleTypes?a.jsx(x.Select,{"aria-label":`field-type-${t}`,role:"button",defaultValue:t,popupMatchSelectWidth:!1,style:{width:"100%"},options:(s==null?void 0:s.possibleTypes.map(c=>({label:c,value:c})))||[],onChange:c=>{n==null||n(c),o(K(T({},s),{type:c}),i.name)}}):a.jsx(x.Tag,{children:t})},{displayName:"FieldType"}),Pn=r.withDynamicSchemaProps(e=>{const{t}=B.useTranslation(),{isTitleField:o}=r.useCollectionManager_deprecated(),[n,i]=p.useState(null),s=r.useDataSourceManager(),{setTitleField:c,filterByTk:l,dataSourceKey:y}=r.useProps(e),u=r.useRecord(),f=r.useAPIClient(),{refreshRM:m,titleField:S}=ct(),w=A=>P(this,null,function*(){i(u),yield f.request({url:`dataSources/${y}/collections:update?filterByTk=${l}`,method:"post",data:{titleField:A?u.name:"id"}}),x.message.success(t("Saved successfully")),m(),c(A?u.name:"id"),yield s.getDataSource(y).reload(),i(null)});return o(u)?a.jsx(x.Tooltip,{title:t("Default title for each record"),placement:"right",overlayInnerStyle:{textAlign:"center"},children:a.jsx(x.Switch,{"aria-label":`switch-title-field-${u==null?void 0:u.name}`,size:"small",loading:(u==null?void 0:u.name)===(n==null?void 0:n.name),checked:(u==null?void 0:u.name)===(S||"id"),onChange:w})}):null},{displayName:"TitleField"}),Dn=()=>{const{t:e}=B.useTranslation(),{unsupportedFields:t}=r.useRecord(),o=[{title:e("Field name"),dataIndex:"name",key:"name"},{title:e("Field database type",{ns:j}),dataIndex:"rawType",key:"rawType"}];return(t==null?void 0:t.length)>0&&a.jsxs(a.Fragment,{children:[a.jsx(x.Divider,{plain:!0,orientation:"left",orientationMargin:"0",children:a.jsx("h3",{children:e("Unknown field type",{ns:j})})}),a.jsx("div",{style:{marginBottom:"15px"},children:e("The following field types are not compatible and do not support output and display",{ns:j})}),a.jsx(x.Table,{columns:o,dataSource:t,pagination:!1})]})};var Fe=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function we(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function In(){this.__data__=[],this.size=0}var On=In;function Mn(e,t){return e===t||e!==e&&t!==t}var Ft=Mn,kn=Ft;function En(e,t){for(var o=e.length;o--;)if(kn(e[o][0],t))return o;return-1}var _e=En,jn=_e,Kn=Array.prototype,Nn=Kn.splice;function Bn(e){var t=this.__data__,o=jn(t,e);if(o<0)return!1;var n=t.length-1;return o==n?t.pop():Nn.call(t,o,1),--this.size,!0}var Vn=Bn,Ln=_e;function qn(e){var t=this.__data__,o=Ln(t,e);return o<0?void 0:t[o][1]}var Gn=qn,zn=_e;function Un(e){return zn(this.__data__,e)>-1}var Hn=Un,Wn=_e;function Qn(e,t){var o=this.__data__,n=Wn(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this}var Yn=Qn,Jn=On,Zn=Vn,Xn=Gn,Rn=Hn,er=Yn;function se(e){var t=-1,o=e==null?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}se.prototype.clear=Jn,se.prototype.delete=Zn,se.prototype.get=Xn,se.prototype.has=Rn,se.prototype.set=er;var Pe=se,tr=Pe;function or(){this.__data__=new tr,this.size=0}var nr=or;function rr(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o}var ar=rr;function sr(e){return this.__data__.get(e)}var ir=sr;function cr(e){return this.__data__.has(e)}var lr=cr,ur=typeof Fe=="object"&&Fe&&Fe.Object===Object&&Fe,wt=ur,pr=wt,dr=typeof self=="object"&&self&&self.Object===Object&&self,mr=pr||dr||Function("return this")(),Z=mr,yr=Z,fr=yr.Symbol,ge=fr,_t=ge,Pt=Object.prototype,gr=Pt.hasOwnProperty,hr=Pt.toString,he=_t?_t.toStringTag:void 0;function Cr(e){var t=gr.call(e,he),o=e[he];try{e[he]=void 0;var n=!0}catch(s){}var i=hr.call(e);return n&&(t?e[he]=o:delete e[he]),i}var vr=Cr,br=Object.prototype,xr=br.toString;function Sr(e){return xr.call(e)}var Ar=Sr,Dt=ge,$r=vr,Tr=Ar,Fr="[object Null]",wr="[object Undefined]",It=Dt?Dt.toStringTag:void 0;function _r(e){return e==null?e===void 0?wr:Fr:It&&It in Object(e)?$r(e):Tr(e)}var ie=_r;function Pr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ce=Pr,Dr=ie,Ir=ce,Or="[object AsyncFunction]",Mr="[object Function]",kr="[object GeneratorFunction]",Er="[object Proxy]";function jr(e){if(!Ir(e))return!1;var t=Dr(e);return t==Mr||t==kr||t==Or||t==Er}var Ot=jr,Kr=Z,Nr=Kr["__core-js_shared__"],Br=Nr,Ve=Br,Mt=function(){var e=/[^.]+$/.exec(Ve&&Ve.keys&&Ve.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Vr(e){return!!Mt&&Mt in e}var Lr=Vr,qr=Function.prototype,Gr=qr.toString;function zr(e){if(e!=null){try{return Gr.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var kt=zr,Ur=Ot,Hr=Lr,Wr=ce,Qr=kt,Yr=/[\\^$.*+?()[\]{}|]/g,Jr=/^\[object .+?Constructor\]$/,Zr=Function.prototype,Xr=Object.prototype,Rr=Zr.toString,ea=Xr.hasOwnProperty,ta=RegExp("^"+Rr.call(ea).replace(Yr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function oa(e){if(!Wr(e)||Hr(e))return!1;var t=Ur(e)?ta:Jr;return t.test(Qr(e))}var na=oa;function ra(e,t){return e==null?void 0:e[t]}var aa=ra,sa=na,ia=aa;function ca(e,t){var o=ia(e,t);return sa(o)?o:void 0}var te=ca,la=te,ua=Z,pa=la(ua,"Map"),Le=pa,da=te,ma=da(Object,"create"),De=ma,Et=De;function ya(){this.__data__=Et?Et(null):{},this.size=0}var fa=ya;function ga(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var ha=ga,Ca=De,va="__lodash_hash_undefined__",ba=Object.prototype,xa=ba.hasOwnProperty;function Sa(e){var t=this.__data__;if(Ca){var o=t[e];return o===va?void 0:o}return xa.call(t,e)?t[e]:void 0}var Aa=Sa,$a=De,Ta=Object.prototype,Fa=Ta.hasOwnProperty;function wa(e){var t=this.__data__;return $a?t[e]!==void 0:Fa.call(t,e)}var _a=wa,Pa=De,Da="__lodash_hash_undefined__";function Ia(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=Pa&&t===void 0?Da:t,this}var Oa=Ia,Ma=fa,ka=ha,Ea=Aa,ja=_a,Ka=Oa;function le(e){var t=-1,o=e==null?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}le.prototype.clear=Ma,le.prototype.delete=ka,le.prototype.get=Ea,le.prototype.has=ja,le.prototype.set=Ka;var Na=le,jt=Na,Ba=Pe,Va=Le;function La(){this.size=0,this.__data__={hash:new jt,map:new(Va||Ba),string:new jt}}var qa=La;function Ga(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var za=Ga,Ua=za;function Ha(e,t){var o=e.__data__;return Ua(t)?o[typeof t=="string"?"string":"hash"]:o.map}var Ie=Ha,Wa=Ie;function Qa(e){var t=Wa(this,e).delete(e);return this.size-=t?1:0,t}var Ya=Qa,Ja=Ie;function Za(e){return Ja(this,e).get(e)}var Xa=Za,Ra=Ie;function es(e){return Ra(this,e).has(e)}var ts=es,os=Ie;function ns(e,t){var o=os(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this}var rs=ns,as=qa,ss=Ya,is=Xa,cs=ts,ls=rs;function ue(e){var t=-1,o=e==null?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}ue.prototype.clear=as,ue.prototype.delete=ss,ue.prototype.get=is,ue.prototype.has=cs,ue.prototype.set=ls;var Kt=ue,us=Pe,ps=Le,ds=Kt,ms=200;function ys(e,t){var o=this.__data__;if(o instanceof us){var n=o.__data__;if(!ps||n.length<ms-1)return n.push([e,t]),this.size=++o.size,this;o=this.__data__=new ds(n)}return o.set(e,t),this.size=o.size,this}var fs=ys,gs=Pe,hs=nr,Cs=ar,vs=ir,bs=lr,xs=fs;function pe(e){var t=this.__data__=new gs(e);this.size=t.size}pe.prototype.clear=hs,pe.prototype.delete=Cs,pe.prototype.get=vs,pe.prototype.has=bs,pe.prototype.set=xs;var Ss=pe;function As(e,t){for(var o=-1,n=e==null?0:e.length;++o<n&&t(e[o],o,e)!==!1;);return e}var $s=As,Ts=te,Fs=function(){try{var e=Ts(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Nt=Fs,Bt=Nt;function ws(e,t,o){t=="__proto__"&&Bt?Bt(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o}var Vt=ws,_s=Vt,Ps=Ft,Ds=Object.prototype,Is=Ds.hasOwnProperty;function Os(e,t,o){var n=e[t];(!(Is.call(e,t)&&Ps(n,o))||o===void 0&&!(t in e))&&_s(e,t,o)}var qe=Os,Ms=qe,ks=Vt;function Es(e,t,o,n){var i=!o;o||(o={});for(var s=-1,c=t.length;++s<c;){var l=t[s],y=n?n(o[l],e[l],l,o,e):void 0;y===void 0&&(y=e[l]),i?ks(o,l,y):Ms(o,l,y)}return o}var Ce=Es;function js(e,t){for(var o=-1,n=Array(e);++o<e;)n[o]=t(o);return n}var Ks=js;function Ns(e){return e!=null&&typeof e=="object"}var oe=Ns,Bs=ie,Vs=oe,Ls="[object Arguments]";function qs(e){return Vs(e)&&Bs(e)==Ls}var Gs=qs,Lt=Gs,zs=oe,qt=Object.prototype,Us=qt.hasOwnProperty,Hs=qt.propertyIsEnumerable,Ws=Lt(function(){return arguments}())?Lt:function(e){return zs(e)&&Us.call(e,"callee")&&!Hs.call(e,"callee")},Gt=Ws,Qs=Array.isArray,ne=Qs,Oe={exports:{}};function Ys(){return!1}var Js=Ys;Oe.exports,function(e,t){var o=Z,n=Js,i=t&&!t.nodeType&&t,s=i&&!0&&e&&!e.nodeType&&e,c=s&&s.exports===i,l=c?o.Buffer:void 0,y=l?l.isBuffer:void 0,u=y||n;e.exports=u}(Oe,Oe.exports);var zt=Oe.exports,Zs=9007199254740991,Xs=/^(?:0|[1-9]\d*)$/;function Rs(e,t){var o=typeof e;return t=t==null?Zs:t,!!t&&(o=="number"||o!="symbol"&&Xs.test(e))&&e>-1&&e%1==0&&e<t}var Ut=Rs,ei=9007199254740991;function ti(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ei}var Ht=ti,oi=ie,ni=Ht,ri=oe,ai="[object Arguments]",si="[object Array]",ii="[object Boolean]",ci="[object Date]",li="[object Error]",ui="[object Function]",pi="[object Map]",di="[object Number]",mi="[object Object]",yi="[object RegExp]",fi="[object Set]",gi="[object String]",hi="[object WeakMap]",Ci="[object ArrayBuffer]",vi="[object DataView]",bi="[object Float32Array]",xi="[object Float64Array]",Si="[object Int8Array]",Ai="[object Int16Array]",$i="[object Int32Array]",Ti="[object Uint8Array]",Fi="[object Uint8ClampedArray]",wi="[object Uint16Array]",_i="[object Uint32Array]",G={};G[bi]=G[xi]=G[Si]=G[Ai]=G[$i]=G[Ti]=G[Fi]=G[wi]=G[_i]=!0,G[ai]=G[si]=G[Ci]=G[ii]=G[vi]=G[ci]=G[li]=G[ui]=G[pi]=G[di]=G[mi]=G[yi]=G[fi]=G[gi]=G[hi]=!1;function Pi(e){return ri(e)&&ni(e.length)&&!!G[oi(e)]}var Di=Pi;function Ii(e){return function(t){return e(t)}}var Ge=Ii,Me={exports:{}};Me.exports,function(e,t){var o=wt,n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===n,c=s&&o.process,l=function(){try{var y=i&&i.require&&i.require("util").types;return y||c&&c.binding&&c.binding("util")}catch(u){}}();e.exports=l}(Me,Me.exports);var ze=Me.exports,Oi=Di,Mi=Ge,Wt=ze,Qt=Wt&&Wt.isTypedArray,ki=Qt?Mi(Qt):Oi,Ei=ki,ji=Ks,Ki=Gt,Ni=ne,Bi=zt,Vi=Ut,Li=Ei,qi=Object.prototype,Gi=qi.hasOwnProperty;function zi(e,t){var o=Ni(e),n=!o&&Ki(e),i=!o&&!n&&Bi(e),s=!o&&!n&&!i&&Li(e),c=o||n||i||s,l=c?ji(e.length,String):[],y=l.length;for(var u in e)(t||Gi.call(e,u))&&!(c&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Vi(u,y)))&&l.push(u);return l}var Yt=zi,Ui=Object.prototype;function Hi(e){var t=e&&e.constructor,o=typeof t=="function"&&t.prototype||Ui;return e===o}var Ue=Hi;function Wi(e,t){return function(o){return e(t(o))}}var Jt=Wi,Qi=Jt,Yi=Qi(Object.keys,Object),Ji=Yi,Zi=Ue,Xi=Ji,Ri=Object.prototype,ec=Ri.hasOwnProperty;function tc(e){if(!Zi(e))return Xi(e);var t=[];for(var o in Object(e))ec.call(e,o)&&o!="constructor"&&t.push(o);return t}var oc=tc,nc=Ot,rc=Ht;function ac(e){return e!=null&&rc(e.length)&&!nc(e)}var Zt=ac,sc=Yt,ic=oc,cc=Zt;function lc(e){return cc(e)?sc(e):ic(e)}var He=lc,uc=Ce,pc=He;function dc(e,t){return e&&uc(t,pc(t),e)}var mc=dc;function yc(e){var t=[];if(e!=null)for(var o in Object(e))t.push(o);return t}var fc=yc,gc=ce,hc=Ue,Cc=fc,vc=Object.prototype,bc=vc.hasOwnProperty;function xc(e){if(!gc(e))return Cc(e);var t=hc(e),o=[];for(var n in e)n=="constructor"&&(t||!bc.call(e,n))||o.push(n);return o}var Sc=xc,Ac=Yt,$c=Sc,Tc=Zt;function Fc(e){return Tc(e)?Ac(e,!0):$c(e)}var We=Fc,wc=Ce,_c=We;function Pc(e,t){return e&&wc(t,_c(t),e)}var Dc=Pc,ke={exports:{}};ke.exports,function(e,t){var o=Z,n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===n,c=s?o.Buffer:void 0,l=c?c.allocUnsafe:void 0;function y(u,f){if(f)return u.slice();var m=u.length,S=l?l(m):new u.constructor(m);return u.copy(S),S}e.exports=y}(ke,ke.exports);var Ic=ke.exports;function Oc(e,t){var o=-1,n=e.length;for(t||(t=Array(n));++o<n;)t[o]=e[o];return t}var Mc=Oc;function kc(e,t){for(var o=-1,n=e==null?0:e.length,i=0,s=[];++o<n;){var c=e[o];t(c,o,e)&&(s[i++]=c)}return s}var Ec=kc;function jc(){return[]}var Xt=jc,Kc=Ec,Nc=Xt,Bc=Object.prototype,Vc=Bc.propertyIsEnumerable,Rt=Object.getOwnPropertySymbols,Lc=Rt?function(e){return e==null?[]:(e=Object(e),Kc(Rt(e),function(t){return Vc.call(e,t)}))}:Nc,Qe=Lc,qc=Ce,Gc=Qe;function zc(e,t){return qc(e,Gc(e),t)}var Uc=zc;function Hc(e,t){for(var o=-1,n=t.length,i=e.length;++o<n;)e[i+o]=t[o];return e}var Ye=Hc,Wc=Jt,Qc=Wc(Object.getPrototypeOf,Object),Je=Qc,Yc=Ye,Jc=Je,Zc=Qe,Xc=Xt,Rc=Object.getOwnPropertySymbols,el=Rc?function(e){for(var t=[];e;)Yc(t,Zc(e)),e=Jc(e);return t}:Xc,eo=el,tl=Ce,ol=eo;function nl(e,t){return tl(e,ol(e),t)}var rl=nl,al=Ye,sl=ne;function il(e,t,o){var n=t(e);return sl(e)?n:al(n,o(e))}var to=il,cl=to,ll=Qe,ul=He;function pl(e){return cl(e,ul,ll)}var dl=pl,ml=to,yl=eo,fl=We;function gl(e){return ml(e,fl,yl)}var oo=gl,hl=te,Cl=Z,vl=hl(Cl,"DataView"),bl=vl,xl=te,Sl=Z,Al=xl(Sl,"Promise"),$l=Al,Tl=te,Fl=Z,wl=Tl(Fl,"Set"),_l=wl,Pl=te,Dl=Z,Il=Pl(Dl,"WeakMap"),Ol=Il,Ze=bl,Xe=Le,Re=$l,et=_l,tt=Ol,no=ie,de=kt,ro="[object Map]",Ml="[object Object]",ao="[object Promise]",so="[object Set]",io="[object WeakMap]",co="[object DataView]",kl=de(Ze),El=de(Xe),jl=de(Re),Kl=de(et),Nl=de(tt),re=no;(Ze&&re(new Ze(new ArrayBuffer(1)))!=co||Xe&&re(new Xe)!=ro||Re&&re(Re.resolve())!=ao||et&&re(new et)!=so||tt&&re(new tt)!=io)&&(re=function(e){var t=no(e),o=t==Ml?e.constructor:void 0,n=o?de(o):"";if(n)switch(n){case kl:return co;case El:return ro;case jl:return ao;case Kl:return so;case Nl:return io}return t});var ot=re,Bl=Object.prototype,Vl=Bl.hasOwnProperty;function Ll(e){var t=e.length,o=new e.constructor(t);return t&&typeof e[0]=="string"&&Vl.call(e,"index")&&(o.index=e.index,o.input=e.input),o}var ql=Ll,Gl=Z,zl=Gl.Uint8Array,Ul=zl,lo=Ul;function Hl(e){var t=new e.constructor(e.byteLength);return new lo(t).set(new lo(e)),t}var nt=Hl,Wl=nt;function Ql(e,t){var o=t?Wl(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.byteLength)}var Yl=Ql,Jl=/\w*$/;function Zl(e){var t=new e.constructor(e.source,Jl.exec(e));return t.lastIndex=e.lastIndex,t}var Xl=Zl,uo=ge,po=uo?uo.prototype:void 0,mo=po?po.valueOf:void 0;function Rl(e){return mo?Object(mo.call(e)):{}}var eu=Rl,tu=nt;function ou(e,t){var o=t?tu(e.buffer):e.buffer;return new e.constructor(o,e.byteOffset,e.length)}var nu=ou,ru=nt,au=Yl,su=Xl,iu=eu,cu=nu,lu="[object Boolean]",uu="[object Date]",pu="[object Map]",du="[object Number]",mu="[object RegExp]",yu="[object Set]",fu="[object String]",gu="[object Symbol]",hu="[object ArrayBuffer]",Cu="[object DataView]",vu="[object Float32Array]",bu="[object Float64Array]",xu="[object Int8Array]",Su="[object Int16Array]",Au="[object Int32Array]",$u="[object Uint8Array]",Tu="[object Uint8ClampedArray]",Fu="[object Uint16Array]",wu="[object Uint32Array]";function _u(e,t,o){var n=e.constructor;switch(t){case hu:return ru(e);case lu:case uu:return new n(+e);case Cu:return au(e,o);case vu:case bu:case xu:case Su:case Au:case $u:case Tu:case Fu:case wu:return cu(e,o);case pu:return new n;case du:case fu:return new n(e);case mu:return su(e);case yu:return new n;case gu:return iu(e)}}var Pu=_u,Du=ce,yo=Object.create,Iu=function(){function e(){}return function(t){if(!Du(t))return{};if(yo)return yo(t);e.prototype=t;var o=new e;return e.prototype=void 0,o}}(),Ou=Iu,Mu=Ou,ku=Je,Eu=Ue;function ju(e){return typeof e.constructor=="function"&&!Eu(e)?Mu(ku(e)):{}}var Ku=ju,Nu=ot,Bu=oe,Vu="[object Map]";function Lu(e){return Bu(e)&&Nu(e)==Vu}var qu=Lu,Gu=qu,zu=Ge,fo=ze,go=fo&&fo.isMap,Uu=go?zu(go):Gu,Hu=Uu,Wu=ot,Qu=oe,Yu="[object Set]";function Ju(e){return Qu(e)&&Wu(e)==Yu}var Zu=Ju,Xu=Zu,Ru=Ge,ho=ze,Co=ho&&ho.isSet,ep=Co?Ru(Co):Xu,tp=ep,op=Ss,np=$s,rp=qe,ap=mc,sp=Dc,ip=Ic,cp=Mc,lp=Uc,up=rl,pp=dl,dp=oo,mp=ot,yp=ql,fp=Pu,gp=Ku,hp=ne,Cp=zt,vp=Hu,bp=ce,xp=tp,Sp=He,Ap=We,$p=1,Tp=2,Fp=4,vo="[object Arguments]",wp="[object Array]",_p="[object Boolean]",Pp="[object Date]",Dp="[object Error]",bo="[object Function]",Ip="[object GeneratorFunction]",Op="[object Map]",Mp="[object Number]",xo="[object Object]",kp="[object RegExp]",Ep="[object Set]",jp="[object String]",Kp="[object Symbol]",Np="[object WeakMap]",Bp="[object ArrayBuffer]",Vp="[object DataView]",Lp="[object Float32Array]",qp="[object Float64Array]",Gp="[object Int8Array]",zp="[object Int16Array]",Up="[object Int32Array]",Hp="[object Uint8Array]",Wp="[object Uint8ClampedArray]",Qp="[object Uint16Array]",Yp="[object Uint32Array]",q={};q[vo]=q[wp]=q[Bp]=q[Vp]=q[_p]=q[Pp]=q[Lp]=q[qp]=q[Gp]=q[zp]=q[Up]=q[Op]=q[Mp]=q[xo]=q[kp]=q[Ep]=q[jp]=q[Kp]=q[Hp]=q[Wp]=q[Qp]=q[Yp]=!0,q[Dp]=q[bo]=q[Np]=!1;function Ee(e,t,o,n,i,s){var c,l=t&$p,y=t&Tp,u=t&Fp;if(o&&(c=i?o(e,n,i,s):o(e)),c!==void 0)return c;if(!bp(e))return e;var f=hp(e);if(f){if(c=yp(e),!l)return cp(e,c)}else{var m=mp(e),S=m==bo||m==Ip;if(Cp(e))return ip(e,l);if(m==xo||m==vo||S&&!i){if(c=y||S?{}:gp(e),!l)return y?up(e,sp(c,e)):lp(e,ap(c,e))}else{if(!q[m])return i?e:{};c=fp(e,m,l)}}s||(s=new op);var w=s.get(e);if(w)return w;s.set(e,c),xp(e)?e.forEach(function(v){c.add(Ee(v,t,o,v,e,s))}):vp(e)&&e.forEach(function(v,d){c.set(d,Ee(v,t,o,d,e,s))});var A=u?y?dp:pp:y?Ap:Sp,C=f?void 0:A(e);return np(C||e,function(v,d){C&&(d=v,v=e[d]),rp(c,d,Ee(v,t,o,d,e,s))}),c}var So=Ee,Jp=So,Zp=1,Xp=4;function Rp(e){return Jp(e,Zp|Xp)}var ed=Rp;const ee=we(ed);function td(e,t){for(var o=-1,n=e==null?0:e.length,i=Array(n);++o<n;)i[o]=t(e[o],o,e);return i}var Ao=td,od=ie,nd=oe,rd="[object Symbol]";function ad(e){return typeof e=="symbol"||nd(e)&&od(e)==rd}var rt=ad,sd=ne,id=rt,cd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ld=/^\w*$/;function ud(e,t){if(sd(e))return!1;var o=typeof e;return o=="number"||o=="symbol"||o=="boolean"||e==null||id(e)?!0:ld.test(e)||!cd.test(e)||t!=null&&e in Object(t)}var pd=ud,$o=Kt,dd="Expected a function";function at(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(dd);var o=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=o.cache;if(s.has(i))return s.get(i);var c=e.apply(this,n);return o.cache=s.set(i,c)||s,c};return o.cache=new(at.Cache||$o),o}at.Cache=$o;var md=at,yd=md,fd=500;function gd(e){var t=yd(e,function(n){return o.size===fd&&o.clear(),n}),o=t.cache;return t}var hd=gd,Cd=hd,vd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bd=/\\(\\)?/g,xd=Cd(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(vd,function(o,n,i,s){t.push(i?s.replace(bd,"$1"):n||o)}),t}),Sd=xd,To=ge,Ad=Ao,$d=ne,Td=rt,Fd=1/0,Fo=To?To.prototype:void 0,wo=Fo?Fo.toString:void 0;function _o(e){if(typeof e=="string")return e;if($d(e))return Ad(e,_o)+"";if(Td(e))return wo?wo.call(e):"";var t=e+"";return t=="0"&&1/e==-Fd?"-0":t}var wd=_o,_d=wd;function Pd(e){return e==null?"":_d(e)}var Dd=Pd,Id=ne,Od=pd,Md=Sd,kd=Dd;function Ed(e,t){return Id(e)?e:Od(e,t)?[e]:Md(kd(e))}var je=Ed;function jd(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Kd=jd,Nd=rt,Bd=1/0;function Vd(e){if(typeof e=="string"||Nd(e))return e;var t=e+"";return t=="0"&&1/e==-Bd?"-0":t}var st=Vd,Ld=je,qd=st;function Gd(e,t){t=Ld(t,e);for(var o=0,n=t.length;e!=null&&o<n;)e=e[qd(t[o++])];return o&&o==n?e:void 0}var zd=Gd;function Ud(e,t,o){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),o=o>i?i:o,o<0&&(o+=i),i=t>o?0:o-t>>>0,t>>>=0;for(var s=Array(i);++n<i;)s[n]=e[n+t];return s}var Hd=Ud,Wd=zd,Qd=Hd;function Yd(e,t){return t.length<2?e:Wd(e,Qd(t,0,-1))}var Jd=Yd,Zd=je,Xd=Kd,Rd=Jd,em=st;function tm(e,t){return t=Zd(t,e),e=Rd(e,t),e==null||delete e[em(Xd(t))]}var om=tm,nm=ie,rm=Je,am=oe,sm="[object Object]",im=Function.prototype,cm=Object.prototype,Po=im.toString,lm=cm.hasOwnProperty,um=Po.call(Object);function pm(e){if(!am(e)||nm(e)!=sm)return!1;var t=rm(e);if(t===null)return!0;var o=lm.call(t,"constructor")&&t.constructor;return typeof o=="function"&&o instanceof o&&Po.call(o)==um}var dm=pm,mm=dm;function ym(e){return mm(e)?void 0:e}var fm=ym,Do=ge,gm=Gt,hm=ne,Io=Do?Do.isConcatSpreadable:void 0;function Cm(e){return hm(e)||gm(e)||!!(Io&&e&&e[Io])}var vm=Cm,bm=Ye,xm=vm;function Oo(e,t,o,n,i){var s=-1,c=e.length;for(o||(o=xm),i||(i=[]);++s<c;){var l=e[s];t>0&&o(l)?t>1?Oo(l,t-1,o,n,i):bm(i,l):n||(i[i.length]=l)}return i}var Sm=Oo,Am=Sm;function $m(e){var t=e==null?0:e.length;return t?Am(e,1):[]}var Tm=$m;function Fm(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)}var wm=Fm,_m=wm,Mo=Math.max;function Pm(e,t,o){return t=Mo(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,s=Mo(n.length-t,0),c=Array(s);++i<s;)c[i]=n[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=n[i];return l[t]=o(c),_m(e,this,l)}}var Dm=Pm;function Im(e){return function(){return e}}var Om=Im;function Mm(e){return e}var km=Mm,Em=Om,ko=Nt,jm=km,Km=ko?function(e,t){return ko(e,"toString",{configurable:!0,enumerable:!1,value:Em(t),writable:!0})}:jm,Nm=Km,Bm=800,Vm=16,Lm=Date.now;function qm(e){var t=0,o=0;return function(){var n=Lm(),i=Vm-(n-o);if(o=n,i>0){if(++t>=Bm)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Gm=qm,zm=Nm,Um=Gm,Hm=Um(zm),Wm=Hm,Qm=Tm,Ym=Dm,Jm=Wm;function Zm(e){return Jm(Ym(e,void 0,Qm),e+"")}var Xm=Zm,Rm=Ao,ey=So,ty=om,oy=je,ny=Ce,ry=fm,ay=Xm,sy=oo,iy=1,cy=2,ly=4,uy=ay(function(e,t){var o={};if(e==null)return o;var n=!1;t=Rm(t,function(s){return s=oy(s,e),n||(n=s.length>1),s}),ny(e,sy(e),o),n&&(o=ey(o,iy|cy|ly,ry));for(var i=t.length;i--;)ty(o,t[i]);return o}),py=uy;const Ke=we(py);var dy=qe,my=je,yy=Ut,Eo=ce,fy=st;function gy(e,t,o,n){if(!Eo(e))return e;t=my(t,e);for(var i=-1,s=t.length,c=s-1,l=e;l!=null&&++i<s;){var y=fy(t[i]),u=o;if(y==="__proto__"||y==="constructor"||y==="prototype")return e;if(i!=c){var f=l[y];u=n?n(f,y,l):void 0,u===void 0&&(u=Eo(f)?f:yy(t[i+1])?[]:{})}dy(l,y,u),l=l[y]}return e}var hy=gy,Cy=hy;function vy(e,t,o){return e==null?e:Cy(e,t,o)}var by=vy;const jo=we(by),xy=({schema:e,record:t,parentRecord:o,compile:n,getContainer:i})=>{if(!e)return;const s=ee(e.properties);return s!=null&&s.name&&(s.name["x-disabled"]=!0),e.hasDefaultValue===!0&&(s.defaultValue=ee(e.default.uiSchema)||{},s.defaultValue.required=!1,s.defaultValue.title=n('{{ t("Default value") }}'),s.defaultValue["x-decorator"]="FormItem",s.defaultValue["x-reactions"]={dependencies:["uiSchema.x-component-props.gmt","uiSchema.x-component-props.showTime","uiSchema.x-component-props.dateFormat","uiSchema.x-component-props.timeFormat"],fulfill:{state:{componentProps:{gmt:"{{$deps[0]}}",showTime:"{{$deps[1]}}",dateFormat:"{{$deps[2]}}",timeFormat:"{{$deps[3]}}"}}}},s.defaultValue["x-disabled"]=!0),{type:"object",properties:{[V.uid()]:{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues(c){return r.useRequest(()=>{var l;return Promise.resolve({data:K(T({},ee(Ke(e.default,["uiSchema.rawTitle"]))),{autoFill:((l=e.default)==null?void 0:l.autoFill)!==!1})})},c)}},title:`${n((o==null?void 0:o.title)||(o==null?void 0:o.name))} - ${n('{{ t("Edit field") }}')}`,properties:K(T({summary:{type:"void","x-component":"FieldSummary","x-component-props":{schemaKey:e.name}}},s),{description:{type:"string",title:'{{t("Description")}}',"x-decorator":"FormItem","x-component":"Input.TextArea"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateCollectionField }}"}}}}})}}}},Sy=()=>{const e=F.useForm(),t=r.useAPIClient(),o=r.useActionContext(),{refresh:n}=r.useResourceActionContext(),{targetCollection:i}=ct(),{name:s}=L.useParams(),{name:c}=r.useRecord(),l=r.useDataSourceManager();return{run(){return P(this,null,function*(){yield e.submit();const u=ee(e.values);u.autoCreateReverseField||delete u.reverseField,delete u.autoCreateReverseField,yield t.request({url:`dataSourcesCollections/${s}.${i.name}/fields:update?filterByTk=${c}`,method:"post",data:u}),o.setVisible(!1),l.getDataSource(s).reload(),yield e.reset(),n()})}}},Ay=e=>{const t=r.useRecord(),o=r.useCollectionParentRecordData();return a.jsx($y,T({item:t,parentItem:o},e))},$y=e=>{var D,k;const E=e,{scope:t,getContainer:o,item:n,parentItem:i,children:s}=E,c=pt(E,["scope","getContainer","item","parentItem","children"]),{getInterface:l,collections:y,getCollection:u}=r.useCollectionManager_deprecated(),{data:{database:f}}=r.useCurrentAppInfo(),[m,S]=p.useState(!1),[w,A]=p.useState({}),C=r.useAPIClient(),{t:v}=B.useTranslation(),d=r.useCompile(),{name:h}=L.useParams(),g=$=>(f==null?void 0:f.dialect)===$,b=(n==null?void 0:n.fields)||((k=(D=u(n.collectionName,h))==null?void 0:D.options)==null?void 0:k.fields),_=p.useMemo(()=>y.map($=>({label:d($.title),value:$.name})),[]),N=p.useMemo(()=>{var $,M;return(n==null?void 0:n.fields)||((M=($=u(n.collectionName,h))==null?void 0:$.options)==null?void 0:M.fields.filter(I=>["string","bigInt","integer"].includes(I.type)).map(I=>{var z;return{value:I.name,label:d((z=I.uiSchema)==null?void 0:z.title)}}))},[n.name,b]);return a.jsx(r.RecordProvider,{record:n,parent:i,children:a.jsxs(r.ActionContextProvider,{value:{visible:m,setVisible:S},children:[a.jsx("a",K(T({},c),{onClick:()=>P(this,null,function*(){var U,R,J;const{data:$}=yield C.request({url:`dataSourcesCollections/${h}.${i.name}/fields:get?filterByTk=${n.name}`,params:{appends:["reverseField"]}}),M=l((U=$==null?void 0:$.data)==null?void 0:U.interface),I=ee($==null?void 0:$.data)||{};I!=null&&I.reverseField||(I.autoCreateReverseField=!1,I.reverseField=(R=M==null?void 0:M.default)==null?void 0:R.reverseField,jo(I.reverseField,"name",`f_${V.uid()}`),jo(I.reverseField,"uiSchema.title",(J=n.__parent)==null?void 0:J.title));const z=xy({schema:K(T({},M),{default:I}),record:n,parentRecord:i,compile:d,getContainer:o});A(z),S(!0)}),children:s||v("Edit")})),a.jsx(r.SchemaComponent,{schema:w,components:{ArrayTable:ae.ArrayTable},scope:K(T({getContainer:o,useUpdateCollectionField:Sy,useCancelAction:r.useCancelAction,showReverseFieldConfig:!1,collections:_,isDialect:g,scopeKeyOptions:N,disabledJSONB:!0},t),{createOnly:!1,createMainOnly:!1,editMainOnly:!0})})]})})},Ty=()=>{const{refresh:e}=r.useResourceActionContext(),{name:t}=L.useParams(),{name:o,collectionName:n}=r.useRecord(),i=r.useAPIClient();return{run(){return P(this,null,function*(){yield i.request({url:`dataSourcesCollections/${t}.${n}/fields:destroy?filterByTk=${o}`,method:"post"}),e()})}}},Fy=()=>{const{state:e,setState:t,refresh:o}=r.useResourceActionContext(),{t:n}=B.useTranslation(),{name:i}=L.useParams(),s=r.useAPIClient(),{name:c}=r.useRecord();return{run(){return P(this,null,function*(){var y;if(!((y=e==null?void 0:e.selectedRowKeys)!=null&&y.length))return x.message.error(n("Please select the records you want to delete"));yield s.request({url:`dataSourcesCollections/${i}.${c}/fields:destroy`,method:"post",params:{filterByTk:(e==null?void 0:e.selectedRowKeys)||[]}}),t==null||t({selectedRowKeys:[]}),o()})}}},wy=()=>{const{run:e}=Fy();return{run(){return P(this,null,function*(){yield e()})}}},_y=()=>{const{run:e}=Ty();return{run(){return P(this,null,function*(){yield e()})}}},Py={name:"fields",fields:[{type:"string",name:"type",interface:"input",uiSchema:{title:'{{ t("Storage type") }}',type:"string","x-component":"Select",enum:[{label:"String",value:"string"}],required:!0}},{type:"string",name:"interface",interface:"input",uiSchema:{title:`{{t("Field interface", { ns: "${j}" })}}`,type:"string","x-component":"Select",enum:"{{interfaces}}"}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{ t("Field display name") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Field name") }}',type:"string","x-component":"Input"}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input.TextArea"}}]},Dy={type:"object",properties:{[V.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-visible":!1,"x-component-props":{useAction:"{{ useBulkDestroyActionAndRefreshCM }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},syncfromDatabase:{type:"void",title:'{{ t("Sync from database") }}',"x-component":"SyncFieldsAction","x-component-props":{type:"primary"}},syncSQL:{type:"void",title:'{{ t("Sync from database") }}',"x-component":"SyncSQLFieldsAction","x-component-props":{type:"primary"}},create:{type:"void",title:'{{ t("Add new") }}',"x-component":"AddCollectionField","x-component-props":{type:"primary"}}}},[V.uid()]:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{pagination:!1,rowKey:"name",rowSelection:{type:"checkbox"},dragSort:!1,useDataSource:"{{ useDataSource }}"},properties:{column1:{type:"void",title:'{{ t("Field display name") }}',"x-component":"Table.Column",properties:{"uiSchema.title":{type:"string","x-component":"FieldTitleInput","x-component-props":{handleFieldChange:"{{enqueueChange}}"}}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{"x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Field type")}}',properties:{type:{"x-component":"FieldType","x-component-props":{handleFieldChange:"{{enqueueChange}}"}}}},column4:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:`{{t("Field interface", { ns: "${j}" })}}`,properties:{interface:{"x-component":"CollectionFieldInterfaceSelect","x-component-props":{handleFieldChange:"{{enqueueChange}}"}}}},column5:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Title field")}}',properties:{titleField:{"x-component":"TitleField","x-use-component-props":"useTitleFieldProps","x-read-pretty":!1}}},column6:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{ t("Description") }}',properties:{description:{"x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0,style:{width:100}}}}},column7:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{ t("Edit") }}',"x-component":"EditCollectionField","x-component-props":{role:"button","aria-label":'{{ "edit-button-" + $record.name }}',type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-disabled":"{{cm.useDeleteButtonDisabled()}}","x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ useDestroyActionAndRefreshCM }}"},"x-reactions":[{dependencies:[".interface"],fulfill:{state:{visible:"{{ ['obo','oho','m2m','o2m','m2o'].includes($deps[0]) }}"}}}]}}}}}}}}},it=p.createContext({refreshRM:()=>{},titleField:null,targetCollection:null});it.displayName="RemoteCollectionContext";const ct=()=>p.useContext(it),Ko=()=>{const e=F.useField(),t=p.useMemo(()=>fe.createForm(),[]),o=r.useAttach(t.createArrayField(K(T({},e.props),{basePath:""}))),{t:n}=B.useTranslation(),{name:i}=L.useParams(),s=r.useAPIClient(),c=r.useCompile(),l=p.useContext(r.ResourceActionContext),y=r.useResourceContext(),{targetKey:u}=y||{},f=r.useRecord(),{[u]:m,titleField:S,name:w}=f,[A,C]=p.useState(S),v=$=>{const M=p.useContext(r.ResourceActionContext),I=F.useField();return p.useEffect(()=>{M.loading||($==null||$.onSuccess(M.data),I.componentProps.dragSort=!!M.dragSort)},[M.loading]),M},d={association:{sourceKey:"name",targetKey:"name"},dragSort:!1,collection:Py,request:{url:`dataSourcesCollections/${i}.${w}/fields:list`,params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}}},h=r.useDataSourceManager();let g=!1;const b=[],_=()=>P(this,null,function*(){if(g||b.length===0)return;g=!0;const{value:$,filterByTk:M,flag:I}=b.shift();try{yield E($,M,I)}catch(z){console.error("Error processing handleFieldChange:",z)}finally{g=!1,_()}}),N=($,M,I)=>{b.push({value:$,filterByTk:M,flag:I}),_()},E=($,M,I=!0)=>P(this,null,function*(){yield s.request({url:`dataSourcesCollections/${i}.${w}/fields:update?filterByTk=${M}`,method:"post",data:$}),h.getDataSource(i).reload(),I&&x.message.success(n("Saved successfully"))}),D=()=>({filterByTk:m,titleField:A,dataSourceKey:i,setTitleField:C}),k=($,M,I)=>P(this,null,function*(){var X,Se;const{targetScope:z}=M,U=((X=$.props)==null?void 0:X.name)==="inherits",{data:R}=yield s.request({url:`dataSources/${i}/collections:list`,params:{paginate:!1,appends:["fields"],sort:["sort"]}});return((Se=R==null?void 0:R.data)==null?void 0:Se.filter(H=>{var Yo;if(I!=null&&I.includes(H.template)||H.autoCreate&&H.isThrough||U&&H.template==="view")return!1;const Wf=!(z!=null&&z.template)||z.template.includes(H.template),Qf=!(z!=null&&z[(Yo=$.props)==null?void 0:Yo.name])||z[$.props.name].includes(H.name);return Wf&&Qf})).map(H=>({label:c(H.title||H.name),value:H.name}))});return a.jsxs(it.Provider,{value:{refreshRM:()=>{l.refresh()},titleField:A,targetCollection:f},children:[a.jsx(Ct,{collectionName:w}),a.jsx(r.ResourceActionProvider,K(T({},d),{children:a.jsx(F.FormContext.Provider,{value:t,children:a.jsx(F.FieldContext.Provider,{value:o,children:a.jsx(r.SchemaComponentOptions,{components:{TitleField:Pn,CollectionFieldInterfaceSelect:Fn,AddCollectionField:An,SourceCollection:vn,TargetKey:Cn,SourceKey:hn,FieldTitleInput:wn,EditCollectionField:Ay,Select:r.Select,FieldType:_n,ForeignKey:$t,ThroughCollection:bn},inherit:!0,scope:{useDataSource:v,useTitleFieldProps:D,enqueueChange:N,useDestroyActionAndRefreshCM:_y,useBulkDestroyActionAndRefreshCM:wy,loadCollections:k},children:a.jsx(F.RecursionField,{schema:Dy,onlyRenderProperties:!0})})})})})),a.jsx(Dn,{})]})},Iy=(e,t,o,n)=>{if(!e)return;const i=ee(e.configurableProperties)||{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem"}};return e.hasDefaultValue===!0&&(i.defaultValue=ee(e.default.uiSchema),i.defaultValue.title=o('{{ t("Default value") }}'),i.defaultValue["x-decorator"]="FormItem"),{type:"object",properties:{[V.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ useValuesFromRecord }}"},title:'{{ t("Edit collection") }}',properties:K(T({},Ke(i,"category","inherits","moreOptions")),{filterTargetKey:{title:'{{ t("Record unique key") }}',type:"single",description:Ro.tval("If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.",{ns:j}),"x-decorator":"FormItem","x-component":"Select",enum:"{{filterTargetKeyOptions}}","x-visible":"{{!!isView}}"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateCollectionActionAndRefreshCM }}"}}}}})}}}},Oy=e=>{const t=r.useRecord(),o=r.useRequest(()=>{var i;return Promise.resolve({data:K(T({},Ke(ee(t),["__parent","__collectionName"])),{category:(i=t==null?void 0:t.category)==null?void 0:i.map(s=>s.id)})})},K(T({},e),{manual:!0})),n=r.useActionContext();return p.useEffect(()=>{n.visible&&o.run()},[n.visible]),o},My=e=>{const{refreshCM:t}=r.useCollectionManager_deprecated(),o=F.useForm(),n=r.useActionContext(),{name:i}=L.useParams(),{refresh:s}=r.useResourceActionContext(),{resource:c,targetKey:l}=r.useResourceContext(),{[l]:y}=r.useRecord(),u=r.useAPIClient(),f=r.useDataSourceManager();return{run(){return P(this,null,function*(){yield o.submit(),yield u.request({url:`dataSources/${i}/collections:update?filterByTk=${y}`,method:"post",data:T({},Ke(o.values,["fields","autoGenId","createdAt","updatedAt","createdBy","updatedBy","sortable"]))}),yield f.getDataSource(i).reload(),n.setVisible(!1),yield o.reset(),s(),yield t()})}}},ky=e=>{const t=r.useRecord();return a.jsx(Ey,T({item:t},e))},Ey=e=>{var C;const A=e,{scope:t,getContainer:o,item:n,children:i}=A,s=pt(A,["scope","getContainer","item","children"]),{getTemplate:c}=r.useCollectionManager_deprecated(),[l,y]=p.useState(!1),[u,f]=p.useState({}),{t:m}=B.useTranslation(),S=r.useCompile(),w=(C=n.fields)==null?void 0:C.map(v=>{var d;return{label:(d=v.uiSchema)!=null&&d.title?S(v.uiSchema.title):v.name,value:v.name}});return a.jsx(r.RecordProvider,{record:n,children:a.jsxs(r.ActionContextProvider,{value:{visible:l,setVisible:y},children:[a.jsx("a",K(T({},s),{onClick:()=>P(this,null,function*(){const v=c(n.template),d=Iy(T({},v),n,S);f(d),y(!0)}),children:i||m("Edit")})),a.jsx(r.SchemaComponent,{schema:u,components:{ArrayTable:ae.ArrayTable},scope:T({getContainer:o,useValuesFromRecord:Oy,useUpdateCollectionActionAndRefreshCM:My,useCancelAction:r.useCancelAction,createOnly:!1,filterTargetKeyOptions:w,isView:n.view,createMainOnly:!0},t)})]})})},jy=(e,t)=>(o,n)=>{o.loading=!0,e(o,n,t).then(dt.action.bound(i=>{o.dataSource=i,o.loading=!1})).catch(i=>console.log(i))},Ky=()=>{const[e,t]=p.useState([]);return[e,t]},Ny=()=>{const e=r.useRecord(),t=F.useForm();return{run(){return P(this,null,function*(){var i,s,c;const n=(c=(s=(i=t.values)==null?void 0:i.children)==null?void 0:s.slice)==null?void 0:c.call(s);t.setValuesIn("children",n.filter(l=>l.name!==e.name))})}}},By=()=>({run(){return P(this,null,function*(){})}}),Vy=e=>`${e||""}${V.uid()}`,Ly=()=>{const{t:e}=B.useTranslation(),{interfaces:t}=r.useCollectionManager_deprecated(),{data:{database:o}}=r.useCurrentAppInfo(),n=r.useDataSourceManager(),i=p.useContext(r.SchemaComponentContext),{name:s}=L.useParams(),c=p.useContext(r.CollectionCategroriesContext),l=r.useAPIClient(),y=l.resource("dbViews"),u=r.useCompile(),f=()=>P(this,null,function*(){return c.data.map(C=>({label:u(C.name),value:C.id}))}),m=()=>P(this,null,function*(){return y.list().then(({data:C})=>{var v;return(v=C==null?void 0:C.data)==null?void 0:v.map(d=>{const h=d.schema;return{label:h?`${h}.${u(d.name)}`:d.name,value:h?`${h}_${d.name}`:d.name}})})}),S=()=>P(this,null,function*(){return l.resource("storages").list().then(({data:C})=>{var v;return(v=C==null?void 0:C.data)==null?void 0:v.map(d=>({label:e(u(d.title)),value:d.name}))})}),w=()=>{const C=p.useContext(r.ResourceActionContext),v=r.useAPIClient(),d=F.useField(),{name:h}=L.useParams();d.data=d.data||{};const{setDataSource:g,dataSource:b}=p.useContext(Ae);return{onClick(){return P(this,null,function*(){var N,E,D;d.data.loading=!0;try{const{data:k}=yield v.request({url:`dataSources:refresh?filterByTk=${h}&clientStatus=${(b==null?void 0:b.status)||"loaded"}`,method:"post"});d.data.loading=!1,g(k==null?void 0:k.data),((N=k==null?void 0:k.data)==null?void 0:N.status)==="reloading"?x.message.warning(e("Data source synchronization in progress")):((E=k==null?void 0:k.data)==null?void 0:E.status)==="loaded"&&(x.message.success(e("Data source synchronization successful")),(D=C==null?void 0:C.refresh)==null||D.call(C)),yield n.getDataSource(h).reload()}catch(k){d.data.loading=!1}})}}},A=p.useMemo(()=>gn(s),[s]);return a.jsx(r.SchemaComponentContext.Provider,{value:K(T({},i),{designable:!1}),children:a.jsx(r.SchemaComponent,{schema:A,components:{EditCollection:ky,AddSubFieldAction:r.AddSubFieldAction,EditSubFieldAction:r.EditSubFieldAction,FieldSummary:r.FieldSummary,TemplateSummay:r.TemplateSummary,CollectionFields:Ko},scope:{useRefreshActionProps:w,useDestroySubField:Ny,useBulkDestroySubField:By,useSelectedRowKeys:Ky,useAsyncDataSource:jy,loadCategories:f,loadDBViews:m,loadStorages:S,useNewId:Vy,useCancelAction:r.useCancelAction,interfaces:t,enableInherits:(o==null?void 0:o.dialect)==="postgres",isPG:(o==null?void 0:o.dialect)==="postgres"}})})};var No={exports:{}};/*!
|
|
42
|
-
Copyright (c) 2018 Jed Watson.
|
|
43
|
-
Licensed under the MIT License (MIT), see
|
|
44
|
-
http://jedwatson.github.io/classnames
|
|
45
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function o(){for(var s="",c=0;c<arguments.length;c++){var l=arguments[c];l&&(s=i(s,n(l)))}return s}function n(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return o.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var c="";for(var l in s)t.call(s,l)&&s[l]&&(c=i(c,l));return c}function i(s,c){return c?s?s+" "+c:s+c:s}e.exports?(o.default=o,e.exports=o):window.classNames=o})()})(No);var qy=No.exports;const Gy=we(qy);var zy=function(e,t){var o;if("ConfigContext"in x.ConfigProvider){var n=p.useContext(x.ConfigProvider.ConfigContext).getPrefixCls;return n(e,t==null?void 0:t.prefixCls)}else{var i=(o=t==null?void 0:t.prefixCls)!==null&&o!==void 0?o:"ant-";return"".concat(i).concat(e!=null?e:"")}};const Uy=e=>{const t=zy("description-input",e),{data:{name:o,tableName:n}}=r.useCollectionRecord();return a.jsx("div",{className:Gy(t,e.className),style:e.style,children:o!==n?a.jsxs(a.Fragment,{children:[o," ",a.jsxs("span",{style:{color:"GrayText"},children:["(",n,")"]})]}):e.value})},Hy=Object.assign(F.connect(x.Input,F.mapProps((e,t)=>K(T({},e),{suffix:a.jsx("span",{children:t!=null&&t.loading||t!=null&&t.validating?a.jsx(W.LoadingOutlined,{}):e.suffix})})),F.mapReadPretty(Uy))),Wy=({item:e})=>{const{t}=B.useTranslation(),o=r.useCompile();return a.jsxs(x.Space,{children:[a.jsx(x.Badge,{color:e.color}),t(o(e.name))]})},Qy=F.observer(e=>{const[t,o]=p.useState(null),{refresh:n}=p.useContext(r.CollectionCategroriesContext),{refresh:i}=r.useResourceActionContext(),s=r.useAPIClient(),c=f=>P(this,null,function*(){const{active:m,over:S}=f;setTimeout(()=>{o(null)}),S&&S.id!==m.id&&(yield s.resource("collectionCategories").move({sourceId:m.id,targetId:S.id}),yield n(),yield i())});function l(f){var m;o((m=f.active)==null?void 0:m.data.current)}const y=Q.useSensor(Q.MouseSensor,{activationConstraint:{distance:10}}),u=Q.useSensors(y);return a.jsxs(Q.DndContext,{sensors:u,onDragEnd:c,onDragStart:l,children:[e.children,a.jsx(Q.DragOverlay,{children:t?a.jsx("span",{style:{whiteSpace:"nowrap"},children:a.jsx(Wy,{item:t})}):null})]})},{displayName:"DndProvider"}),Yy=()=>{const{t:e}=B.useTranslation(),{data:t}=p.useContext(r.CollectionCategroriesContext),o=r.useCompile();if(!t)return null;const n=t.sort((s,c)=>c.sort-s.sort).concat().map(s=>K(T({},s),{schema:Be}));!n.find(s=>s.id==="all")&&n.unshift({name:'{{t("All collections")}}',id:"all",sort:0,closable:!1,schema:Be});const i=()=>P(this,null,function*(){return t.map(s=>({label:e(o(s.name)),value:s.id}))});return a.jsx(Qy,{children:a.jsx(x.Card,{bordered:!1,children:a.jsx(r.SchemaComponentOptions,{components:{CollectionFields:Ko,CollectionName:Hy},inherit:!0,scope:{loadCategories:i},children:a.jsx(F.RecursionField,{schema:Be,onlyRenderProperties:!0})})})})},Jy={type:"object",properties:{[V.uid()]:{"x-component":"ConfigurationTable"}}},Zy=()=>a.jsx(r.SchemaComponent,{schema:Jy,components:{CollectionCategroriesProvider:r.CollectionCategroriesProvider,ConfigurationTable:Ly,ConfigurationTabs:Yy,AddFieldAction:r.AddFieldAction,AddCollectionField:r.AddCollectionField,AddCollection:r.AddCollection,AddCollectionAction:r.AddCollectionAction,EditCollection:r.EditCollection,EditCollectionAction:r.EditCollectionAction,DeleteCollection:r.DeleteCollection,DeleteCollectionAction:r.DeleteCollectionAction,EditFieldAction:r.EditFieldAction,EditCollectionField:r.EditCollectionField,OverridingCollectionField:r.OverridingCollectionField,OverridingFieldAction:r.OverridingFieldAction,ViewCollectionField:r.ViewCollectionField,ViewFieldAction:r.ViewFieldAction,SyncFieldsAction:r.SyncFieldsAction,SyncFieldsActionCom:r.SyncFieldsActionCom,SyncSQLFieldsAction:r.SyncSQLFieldsAction}}),Xy=()=>{const[e,t]=p.useState({}),o=r.usePlugin(xe),n=r.useCompile(),[i,s]=p.useState(!1),{t:c}=B.useTranslation(),[l,y]=p.useState(null),u=r.useAPIClient(),f=m=>{const S=[...o.types.keys()].map(w=>{const A=o.types.get(w);return{value:A.name,label:n(A.label)}});m.dataSource=S};return a.jsx("div",{children:a.jsxs(r.ActionContext.Provider,{value:{visible:i,setVisible:s},children:[a.jsx(x.Dropdown,{menu:{onClick(m){if(m.key==="__empty__")return;const S=o.types.get(m.key);y(m.key),s(!0),t({type:"object",properties:{[V.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:m.key}},title:n("{{t('Add new')}}")+" - "+n(S.label),properties:{body:{type:"void","x-component":S.DataSourceSettingsForm},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{testConnectiion:{title:`{{ t("Test Connection",{ ns: "${j}" }) }}`,"x-component":"Action","x-component-props":{useAction:"{{ useTestConnectionAction }}"}},cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}",actionCallback:"{{ dataSourceCreateCallback }}"}}}}}}}})},items:[o.types.size?null:{key:"__empty__",label:a.jsx(x.Empty,{image:x.Empty.PRESENTED_IMAGE_SIMPLE,description:a.jsxs(a.Fragment,{children:[c("No external data source plugin installed",{ns:j}),a.jsx("br",{})," ",a.jsx("a",{target:"_blank",href:u.auth.locale==="zh-CN"?"https://docs-cn.nocobase.com/handbook/data-source-manager":"https://docs.nocobase.com/handbook/data-source-manager",rel:"noreferrer",children:c("View documentation",{ns:j})})]})})}].filter(Boolean).concat([...o.types.keys()].map(m=>{const S=o.types.get(m);return{key:m,label:n(S==null?void 0:S.label)}}))},children:a.jsxs(x.Button,{type:"primary",icon:a.jsx(W.PlusOutlined,{}),children:[c("Add new")," ",a.jsx(W.DownOutlined,{})]})}),a.jsx(r.SchemaComponent,{scope:{createOnly:!1,useTestConnectionAction:mt,dialect:l,useDialectDataSource:f},schema:e})]})})},Ry=()=>{const e=r.useRecord(),[t,o]=p.useState({}),n=r.usePlugin(xe),i=r.useCompile(),[s,c]=p.useState(!1),{t:l}=B.useTranslation(),y=r.useDataSourceManager(),u=()=>{const f=F.useField(),m=F.useForm(),S=r.useActionContext(),{refresh:w}=r.useResourceActionContext(),{resource:A}=r.useResourceContext(),{key:C}=r.useRecord();return{run(){return P(this,null,function*(){yield m.submit(),f.data=f.data||{},f.data.loading=!0;try{yield A.update({filterByTk:C,values:m.values}),S.setVisible(!1),y.getDataSource(C).setOptions(m.values),y.getDataSource(C).reload(),yield m.reset(),w()}catch(d){console.log(d)}finally{f.data.loading=!1}})}}};return a.jsx("div",{children:a.jsxs(r.ActionContext.Provider,{value:{visible:s,setVisible:c},children:[e.key!=="main"&&a.jsx("a",{onClick:()=>{c(!0);const f=n.types.get(e.type);o({type:"object",properties:{[V.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:e},title:i("{{t('Edit')}}")+" - "+i(e.displayName),properties:{body:{type:"void","x-component":f.DataSourceSettingsForm},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},testConnectiion:{title:`{{ t("Test Connection",{ ns: "${j}" }) }}`,"x-component":"Action","x-component-props":{useAction:"{{ useTestConnectionAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}}}}}}})},children:l("Edit")}),a.jsx(r.SchemaComponent,{scope:{createOnly:!0,useUpdateAction:u},schema:t})]})})},ef=e=>`/admin/settings/data-source-manager/${e}/collections`,tf=()=>{const e=r.useRecord(),t=L.useNavigate(),{t:o}=B.useTranslation();return a.jsx("div",{className:e.enabled?void 0:ye.css`
|
|
46
|
-
.ant-btn-link {
|
|
47
|
-
&:hover {
|
|
48
|
-
color: rgba(0, 0, 0, 0.25) !important;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
`,children:a.jsx(x.Button,{type:"link",style:{padding:"0px"},disabled:!e.enabled,onClick:()=>{t(ef(e.key))},role:"button","aria-label":`${e==null?void 0:e.key}-Configure`,children:o("Configure")})})},of=()=>{const{t:e}=B.useTranslation(),t=r.usePlugin(xe),o=[...t.types.keys()].map(f=>{const m=t.types.get(f);return{value:f,label:e(m==null?void 0:m.label)}}).concat([{value:"main",label:e("Main")}]),n=r.useDataSourceManager(),i=p.useRef([]);p.useEffect(()=>()=>{n.getDataSources().forEach(f=>{i.current.includes(f.key)&&f.reload()})},[i]);const s=p.useCallback(f=>{n.removeDataSources(f)},[n]),c=p.useCallback(f=>{n.addDataSource(yt,f),i.current=[...i.current,f.key]},[]),l=()=>{const f=r.useResourceActionContext();return{onClick(){return P(this,null,function*(){var w,A;const S=(w=f==null?void 0:f.data)==null?void 0:w.data.filter(C=>C.status!=="loaded");if(S!=null&&S.length){const C=n.getDataSources(),v=S.map(h=>h.key),d=C.filter(h=>v.includes(h.key));yield Promise.all(d.map(h=>h.reload()))}(A=f==null?void 0:f.refresh)==null||A.call(f)})}}},y=()=>{const{refresh:f}=r.useResourceActionContext(),{resource:m}=r.useResourceContext(),{key:S}=r.useRecord();return{run(){return P(this,null,function*(){yield m.destroy({filterByTk:S}),s([S]),f()})}}},u=f=>{const{key:m}=r.useRecord();f.visible=m!=="main"};return a.jsx(x.Card,{bordered:!1,children:a.jsx(r.SchemaComponent,{components:{CreateDatabaseConnectAction:Xy,EditDatabaseConnectionAction:Ry,ViewDatabaseConnectionAction:tf},scope:{useNewId:f=>`${f}${V.uid()}`,types:o,useRefreshActionProps:l,useDestroyAction:y,dataSourceDeleteCallback:s,dataSourceCreateCallback:c,useIsAbleDelete:u},schema:sn})})},Bo=e=>F.Schema.compile(e,{t:r.i18n.t}),nf={type:"object",properties:{block1:{type:"void","x-collection":"collections","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"collections",filterTargetKey:"name",targetKey:"name",sortable:!0,fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{ t("Collection display name") }}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Collection name") }}',type:"string","x-component":"Input",description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'}},{type:"string",name:"template",interface:"input",uiSchema:{title:'{{ t("Collection Template") }}',type:"string","x-component":"Input"}},{type:"hasMany",name:"fields",target:"fields",collectionName:"collections",sourceKey:"name",targetKey:"name",uiSchema:{}},{type:"hasMany",name:"inherits",interface:"select",uiSchema:{title:'{{ t("Inherits") }}',type:"string","x-component":"Select","x-component-props":{mode:"multiple"}}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input"}}]},dragSort:!0,request:{resource:"collections",action:"list",params:{pageSize:50,sort:"sort",filter:{"hidden.$isFalsy":!0},appends:["category"]}}},properties:{tabs:{type:"void","x-component":"ConfigurationTabs"}}}}},Vo={type:"object",properties:{[V.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}},{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"DeleteCollection","x-component-props":{role:"button",isBulk:!0}},create:{type:"void",title:'{{ t("Create collection") }}',"x-component":"AddCollection","x-component-props":{type:"primary"}}}},[V.uid()]:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}",useAction(){const e=r.useAPIClient(),{t}=B.useTranslation();return{move(n,i){return P(this,null,function*(){yield e.resource("collections").move({sourceId:n.key,targetId:i.key}),x.message.success(t("Saved successfully"),.2)})}}}},properties:{column1:{type:"void",title:'{{t("Collection display name")}}',"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{"x-component":St,"x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Collection template")}}',properties:{template:{"x-component":r.CollectionTemplateTag,"x-read-pretty":!0}}},column4:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column","x-visible":"categoryVisible",title:'{{t("Collection category")}}',properties:{category:{"x-component":r.CollectionCategory,"x-read-pretty":!0}}},column5:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{description:{"x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},column6:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{ t("Configure fields") }}',"x-component":"Action.Link","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-component-props":{destroyOnClose:!0,width:"70%"},"x-reactions":e=>{const t=e.path.segments[1],o=e.path.segments[0],n=e.form.getValuesIn(`${o}.${t}`);n&&(e.title=`${Bo(n.title)} - ${Bo('{{ t("Configure fields") }}')}`)},properties:{collectionFieldSchema:{type:"void","x-component":"CollectionFields"}}}}},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"EditCollection","x-component-props":{role:"button","aria-label":'{{ "edit-button-" + $record.name }}',type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"DeleteCollection","x-component-props":{role:"button","aria-label":'{{ "delete-button-" + $record.name }}',type:"primary",className:"nb-action-link"}}}}}}}}}},rf={type:"object",properties:{form:{type:"void","x-decorator":"Form","x-component":"Action.Modal",title:'{{ t("Add category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreateCategry }}",style:{marginLeft:"8px"}}}}}}}}},af={type:"object",properties:{form:{type:"void","x-decorator":"Form","x-decorator-props":{useValues:"{{ useValuesFromRecord }}"},"x-component":"Action.Modal",title:'{{ t("Edit category") }}',"x-component-props":{width:520,getContainer:"{{ getContainer }}"},properties:{name:{type:"string",title:'{{t("Category name")}}',required:!0,"x-disabled":"{{ !createOnly }}","x-decorator":"FormItem","x-component":"Input"},color:{type:"string",title:'{{t("Color")}}',required:!1,"x-decorator":"FormItem","x-component":"ColorSelect"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{action1:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useEditCategry }}",style:{marginLeft:"8px"}}}}}}}}},sf=(e,t)=>(o,n)=>{o.loading=!0,e(o,n,t).then(dt.action.bound(i=>{o.dataSource=i,o.loading=!1})).catch(console.error)},cf=()=>{const[e,t]=p.useState([]);return[e,t]},lf=()=>{const e=r.useRecord(),t=F.useForm();return{run(){return P(this,null,function*(){var i,s,c;const n=(c=(s=(i=t.values)==null?void 0:i.children)==null?void 0:s.slice)==null?void 0:c.call(s);t.setValuesIn("children",n.filter(l=>l.name!==e.name))})}}},uf=()=>({run(){return P(this,null,function*(){})}}),pf=()=>{const e=r.useRecord(),{getCollectionFields:t}=r.useCollectionManager_deprecated();return e.__parent&&e.__parent.interface==="subTable"?p.useContext(r.DataSourceContext_deprecated).dataSource:t(e.collectionName||e.name)},df=e=>`${e||""}${V.uid()}`,mf=()=>{const{t:e}=B.useTranslation(),{interfaces:t,getCollections:o}=r.useCollectionManager_deprecated(),{data:{database:n}}=r.useCurrentAppInfo(),i=p.useContext(r.CollectionCategroriesContext),s=r.useAPIClient(),c=s.resource("dbViews"),l=r.useCompile();F.useForm();const y=(A,C,v)=>P(this,null,function*(){var b;const{targetScope:d}=C,h=((b=A.props)==null?void 0:b.name)==="inherits";return o().filter(_=>{var k;if(v!=null&&v.includes(_.template)||_.autoCreate&&_.isThrough||h&&_.template==="view")return!1;const E=!(d!=null&&d.template)||d.template.includes(_.template),D=!(d!=null&&d[(k=A.props)==null?void 0:k.name])||d[A.props.name].includes(_.name);return E&&D}).map(_=>({label:l(_.title),value:_.name}))}),u=()=>P(this,null,function*(){return i.data.map(A=>({label:l(A.name),value:A.id}))}),f=()=>P(this,null,function*(){return c.list().then(({data:A})=>{var C;return(C=A==null?void 0:A.data)==null?void 0:C.map(v=>{const d=v.schema;return{label:d?`${d}.${l(v.name)}`:v.name,value:d?`${d}_${v.name}`:v.name}})})}),m=A=>P(this,null,function*(){const{fields:C}=A.form.values;return Promise.resolve({data:C}).then(({data:v})=>v==null?void 0:v.map(d=>{var h;return{label:l((h=d.uiSchema)==null?void 0:h.title)||d.name,value:d.name}}))}),S=()=>P(this,null,function*(){return s.resource("storages").list().then(({data:A})=>{var C;return(C=A==null?void 0:A.data)==null?void 0:C.map(v=>({label:e(l(v.title)),value:v.name}))})}),w=p.useContext(r.SchemaComponentContext);return a.jsx(r.SchemaComponentContext.Provider,{value:K(T({},w),{designable:!1}),children:a.jsx(r.SchemaComponent,{schema:nf,components:{AddSubFieldAction:r.AddSubFieldAction,EditSubFieldAction:r.EditSubFieldAction,FieldSummary:r.FieldSummary,TemplateSummay:r.TemplateSummary,CollectionFields:bt},scope:{loadFilterTargetKeys:m,useDestroySubField:lf,useBulkDestroySubField:uf,useSelectedRowKeys:cf,useAsyncDataSource:sf,loadCollections:y,loadCategories:u,loadDBViews:f,loadStorages:S,useCurrentFields:pf,useNewId:df,useCancelAction:r.useCancelAction,interfaces:t,enableInherits:(n==null?void 0:n.dialect)==="postgres",isPG:(n==null?void 0:n.dialect)==="postgres"}})})};function yf(e){const{attributes:t,listeners:o,setNodeRef:n}=Q.useDraggable({id:e.id,data:e.data});return a.jsx("div",K(T(T({ref:n},o),t),{children:a.jsx("div",{children:e.children})}))}function ff(e){const{isOver:t,setNodeRef:o}=Q.useDroppable({id:e.id,data:e.data}),n=t?{color:"green"}:void 0;return a.jsx("div",{ref:o,style:n,children:e.children})}const gf=F.observer(({item:e})=>a.jsx(ff,{id:e.id.toString(),data:e,children:a.jsx("div",{children:a.jsx(yf,{id:e.id.toString(),data:e,children:a.jsx(Lo,{item:e})})})}),{displayName:"TabTitle"}),Lo=({item:e})=>{const{t}=B.useTranslation(),o=r.useCompile();return a.jsxs(x.Space,{children:[a.jsx(x.Badge,{color:e.color}),t(o(e.name))]})},hf=F.observer(e=>{const[t,o]=p.useState(null),{refresh:n}=p.useContext(r.CollectionCategroriesContext),{refresh:i}=r.useResourceActionContext(),s=r.useAPIClient(),c=f=>P(this,null,function*(){const{active:m,over:S}=f;setTimeout(()=>{o(null)}),S&&S.id!==m.id&&(yield s.resource("collectionCategories").move({sourceId:m.id,targetId:S.id}),yield n(),yield i())});function l(f){var m;o((m=f.active)==null?void 0:m.data.current)}const y=Q.useSensor(Q.MouseSensor,{activationConstraint:{distance:10}}),u=Q.useSensors(y);return a.jsxs(Q.DndContext,{sensors:u,onDragEnd:c,onDragStart:l,children:[e.children,a.jsx(Q.DragOverlay,{children:t?a.jsx("span",{style:{whiteSpace:"nowrap"},children:a.jsx(Lo,{item:t})}):null})]})},{displayName:"DndProvider"}),Cf=()=>{const{t:e}=B.useTranslation(),{data:t,refresh:o}=p.useContext(r.CollectionCategroriesContext),{refresh:n,run:i,defaultRequest:s,setState:c}=r.useResourceActionContext(),[l,y]=p.useState({tab:"all"}),[u,f]=p.useState(l.tab),m=r.useCompile(),S=r.useAPIClient(),{modal:w}=x.App.useApp(),A=p.useMemo(()=>{if(!t)return[];const g=t.sort((b,_)=>_.sort-b.sort).concat().map(b=>K(T({},b),{schema:Vo}));return!g.find(b=>b.id==="all")&&g.unshift({name:'{{t("All collections")}}',id:"all",sort:0,closable:!1,schema:Vo}),g},[t]);p.useEffect(()=>{l.tab!=="all"&&C(l.tab)},[]);const C=g=>{var b;if(y({tab:g}),f(V.uid()),g!=="all"){const N={$and:[(b=s==null?void 0:s.params)==null?void 0:b.filter,{"category.id":g}]};i({filter:N}),c==null||c({category:[+g],params:[{filter:N}]})}else i(),c==null||c({category:[],params:[]})},v=g=>{w.confirm({title:m("{{t('Delete category')}}"),content:m("{{t('Are you sure you want to delete it?')}}"),onOk:()=>P(this,null,function*(){yield S.resource("collectionCategories").destroy({filter:{id:g}}),g===+l.tab&&y({tab:"all"}),yield o(),yield n()})})},d=()=>P(this,null,function*(){return t.map(g=>({label:e(m(g.name)),value:g.id}))}),h=Y.memoize(g=>({items:[{key:"edit",label:a.jsx(r.SchemaComponent,{schema:{type:"void",properties:{[V.uid()]:{"x-component":"EditCategory","x-component-props":{item:g}}}}})},{key:"delete",label:m("{{t('Delete category')}}"),onClick:()=>v(g.id)}]}));return t?a.jsx(hf,{children:a.jsx(x.Tabs,{addIcon:a.jsx(r.SchemaComponent,{schema:{type:"void",properties:{addCategories:{type:"void",title:'{{ t("Add category") }}',"x-component":"AddCategory","x-component-props":{type:"primary"}}}}}),onChange:C,defaultActiveKey:l.tab||"all",type:"editable-card",destroyInactiveTabPane:!0,tabBarStyle:{marginBottom:"0px"},items:A.map(g=>({label:g.id!=="all"?a.jsx("div",{"data-no-dnd":"true",children:a.jsx(gf,{item:g})}):m(g.name),key:String(g.id),closable:g.closable,closeIcon:a.jsx(x.Dropdown,{menu:h(g),children:a.jsx(W.MenuOutlined,{role:"button","aria-label":m(g.name),style:{padding:8,margin:"-8px"}})}),children:a.jsx(x.Card,{bordered:!1,children:a.jsx(r.SchemaComponentOptions,{components:{CollectionFields:bt},inherit:!0,scope:{loadCategories:d,categoryVisible:g.id==="all",categoryId:g.id},children:a.jsx(F.RecursionField,{name:u,schema:g.schema,onlyRenderProperties:!0})})})}))})}):null},vf=()=>{const e=F.useForm(),t=r.useActionContext(),{refresh:o}=p.useContext(r.CollectionCategroriesContext),n=r.useAPIClient();return{run(){return P(this,null,function*(){yield e.submit();const s=Y.cloneDeep(e.values);yield n.resource("collectionCategories").create({values:T({},s)}),t.setVisible(!1),yield e.reset(),yield o()})}}},bf=e=>a.jsx(qo,T({},e)),qo=e=>{const{scope:t,getContainer:o,children:n}=e,[i,s]=p.useState(!1),{t:c}=B.useTranslation();return a.jsxs(r.ActionContextProvider,{value:{visible:i,setVisible:s},children:[a.jsx("div",{onClick:()=>s(!0),title:c("Add category"),children:n||a.jsx(W.PlusOutlined,{})}),a.jsx(r.SchemaComponent,{schema:rf,components:{CollectionCategory:r.CollectionCategory,CollectionTemplateTag:r.CollectionTemplateTag},scope:T({getContainer:o,useCancelAction:r.useCancelAction,createOnly:!0,useCreateCategry:vf},t)})]})},xf=()=>{const e=F.useForm(),t=r.useActionContext(),{refresh:o}=p.useContext(r.CollectionCategroriesContext),{refresh:n}=r.useResourceActionContext(),i=r.useAPIClient(),{id:s}=r.useRecord();return{run(){return P(this,null,function*(){yield e.submit();const l=Y.cloneDeep(e.values);yield i.resource("collectionCategories").update({filter:{id:s},values:T({},l)}),t.setVisible(!1),yield e.reset(),yield o(),yield n()})}}},Sf=e=>{const t=r.useRecord(),o=r.useRequest(()=>Promise.resolve({data:Y.cloneDeep(t)}),K(T({},e),{manual:!0})),n=r.useActionContext();return p.useEffect(()=>{n.visible&&o.run()},[n.visible]),o},Af=e=>a.jsx(Go,T({},e)),Go=e=>{const{scope:t,getContainer:o,item:n,children:i}=e,[s,c]=p.useState(!1),l=r.useCompile();return a.jsx(r.RecordProvider,{record:n,children:a.jsxs(r.ActionContextProvider,{value:{visible:s,setVisible:c},children:[a.jsx(a.Fragment,{children:i||a.jsx("span",{onClick:()=>c(!0),children:l('{{ t("Edit category") }}')})}),a.jsx(r.SchemaComponent,{schema:af,scope:T({getContainer:o,useCancelAction:r.useCancelAction,createOnly:!0,useEditCategry:xf,useValuesFromRecord:Sf},t)})]})})};fe.registerValidateFormats({uid:/^[a-zA-Z][a-zA-Z0-9_-]*$/});const $f={type:"object",properties:{[V.uid()]:{"x-component":"ConfigurationTable"}}},Tf=()=>a.jsx(r.SchemaComponent,{schema:$f,components:{CollectionCategroriesProvider:r.CollectionCategroriesProvider,ConfigurationTable:mf,ConfigurationTabs:Cf,AddFieldAction:r.AddFieldAction,AddCollectionField:r.AddCollectionField,AddCollection:r.AddCollection,AddCollectionAction:r.AddCollectionAction,AddCategoryAction:qo,AddCategory:bf,EditCollection:r.EditCollection,EditCollectionAction:r.EditCollectionAction,DeleteCollection:r.DeleteCollection,DeleteCollectionAction:r.DeleteCollectionAction,EditFieldAction:r.EditFieldAction,EditCollectionField:r.EditCollectionField,OverridingCollectionField:r.OverridingCollectionField,OverridingFieldAction:r.OverridingFieldAction,ViewCollectionField:r.ViewCollectionField,ViewFieldAction:r.ViewFieldAction,EditCategory:Af,EditCategoryAction:Go,SyncFieldsAction:r.SyncFieldsAction,SyncFieldsActionCom:r.SyncFieldsActionCom,SyncSQLFieldsAction:r.SyncSQLFieldsAction}}),ve=p.createContext(null);ve.displayName="PermissionContext";const Ff=e=>{const t=r.useAPIClient(),o=r.useRecord(),{t:n}=B.useTranslation(),i=p.useContext(be),{snippets:s}=i;s==null||s.forEach(y=>{i[y]=!0});const[c,l]=p.useState(i);return p.useEffect(()=>{l(i)},[i]),a.jsx(ve.Provider,{value:{currentDataSource:o,currentRecord:c,update:(y,u)=>P(this,null,function*(){yield t.request({url:`dataSources/${o.key}/roles:update`,data:u.values,method:"post",params:{filterByTk:u.values.roleName}}),l(T(T({},c),u.values)),x.message.success(n("Saved successfully"))})},children:e.children})},wf=e=>{const t=p.useContext(be),o=r.useRecord();return a.jsx(r.RecordContext_deprecated.Provider,{value:T({},t),children:a.jsx(r.SchemaComponentOptions,{scope:{dataSourceKey:o.key},children:e.children})})},_f=e=>{const t=r.useRecord(),{visible:o}=r.useActionContext(),{currentDataSource:n}=p.useContext(ve),i=r.useRequest({resource:"roles.dataSourceResources",resourceOf:t.roleName,action:"get",params:{appends:["actions","actions.scope"],filterByTk:t.name,filter:{dataSourceKey:n.key,name:t.name}}},K(T({},e),{manual:!0}));return p.useEffect(()=>{if(!t.exists){e.onSuccess({data:{}});return}o&&i.run()},[o,t.exists]),i},Pf=()=>{const e=F.useForm(),t=r.useAPIClient(),o=r.useRecord(),n=r.useActionContext(),{refresh:i}=r.useResourceActionContext(),{currentDataSource:s}=p.useContext(ve);return{run(){return P(this,null,function*(){yield t.resource("roles.dataSourceResources",o.roleName)[o.exists?"update":"create"]({filterByTk:o.name,filter:{dataSourceKey:s.key,name:o.name},values:K(T({},e.values),{name:o.name,dataSourceKey:s.key})}),n.setVisible(!1),i()})}}},Df={type:"void","x-decorator":"RoleRecordProvider",properties:{block:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"dataSourcesCollections",targetKey:"name",filterTargetKey:"name",fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{t("Collection display name")}}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Collection name")}}',type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"input",uiSchema:{title:'{{t("Resource type")}}',type:"string","x-component":"Select",enum:[{label:'{{t("Collection")}}',value:"collection",color:"green"},{label:'{{t("Association")}}',value:"association",color:"blue"}]}},{type:"string",name:"usingConfig",interface:"input",uiSchema:{title:'{{t("Permission policy")}}',type:"string","x-component":"Select",enum:[{label:'{{t("Individual")}}',value:"resourceAction",color:"orange"},{label:'{{t("General")}}',value:"strategy",color:"default"}]}},{type:"hasMany",name:"fields",target:"fields",collectionName:"collections",sourceKey:"name",targetKey:"name",uiSchema:{}}]},association:{sourceKey:"name",targetKey:"name"},resourceName:"roles.dataSourcesCollections",request:{resource:"roles.dataSourcesCollections",action:"list",params:{pageSize:20,filter:{hidden:{$isFalsy:!0},dataSourceKey:"{{dataSourceKey}}"},sort:["sort"],appends:["fields"]}}},properties:{[V.uid()]:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}},{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"}}},table1:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{column0:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{usingConfig:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:_f},title:'{{t("Configure permission")}}',properties:{usingActionsConfig:{title:'{{t("Permission policy")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:!1,enum:[{value:!1,label:'{{t("General")}}'},{value:!0,label:'{{t("Individual")}}'}],"x-reactions":{target:"actions",fulfill:{state:{hidden:"{{!$self.value}}"}}}},actions:{"x-component":"RolesResourcesActions","x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:Pf}}}}}}}}}}}}}}}}}},zo={name:"dataSources",filterTargetKey:"name",targetKey:"name",fields:[{type:"string",name:"displayName",interface:"input",uiSchema:{title:'{{t("Display name")}}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"key",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"number","x-component":"Input",required:!0}}]},If={type:"object",properties:{block1:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:zo,resourceName:"dataSources",request:{resource:"dataSources",action:"list",params:{pageSize:50,showAnonymous:!0,appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:zo},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{column1:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-decorator":"ACLActionProvider","x-acl-action":"roles:update","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"PermissionProvider",title:'{{t("Configure permissions")}}',properties:{tabs1:{type:"void","x-component":"Tabs","x-component-props":{},properties:{tab1:{type:"void",title:'{{t("General action permissions")}}',"x-component":"Tabs.TabPane","x-component-props":{},properties:{role:{"x-component":"RoleConfigure"}}},tab2:{type:"void",title:'{{t("Action permissions")}}',"x-component":"Tabs.TabPane","x-component-props":{},properties:{roleCollectionsSchema:Df}}}}}}}}}}}}}}}}}},lt=p.createContext([]);lt.displayName="AvailableActionsContext";const Of=e=>{const{data:t,loading:o}=r.useRequest({resource:"availableActions",action:"list"});return o?a.jsx(x.Spin,{}):a.jsx(lt.Provider,{value:t==null?void 0:t.data,children:e.children})},Uo=()=>p.useContext(lt),Mf=()=>{const e=r.useRecord();return a.jsx("div",{children:a.jsx(r.SchemaComponentContext.Provider,{value:{designable:!1},children:a.jsx(Of,{children:a.jsx(r.SchemaComponent,{schema:If,components:{SettingCenterPermissionProvider:r.SettingCenterPermissionProvider,PermissionProvider:Ff},scope:{dataSourceKey:e.key}})})})})},kf=()=>{const{update:e}=p.useContext(ve),{t}=B.useTranslation(),{key:o}=r.useRecord();return a.jsx(r.SchemaComponent,{schema:{type:"void",name:"form","x-component":"Form","x-component-props":{useValues:n=>{const i=r.useAPIClient(),s=p.useContext(be);return r.useRequest(()=>i.resource(`dataSources/${o}/roles`).get({filterByTk:s.name}).then(c=>{var y,u;const l=(y=c==null?void 0:c.data)==null?void 0:y.data;return(u=l.snippets)==null||u.forEach(f=>{l[f]=!0}),{data:l}}),n)},effects(){fe.onFieldChange("*",(n,i)=>P(this,null,function*(){i.modified&&(yield e(n,i))}))}},properties:{"strategy.actions":{description:t("All collections use general action permissions by default; permission configured individually will override the default one."),"x-component":"StrategyActions"}}}})},Ef=e=>{var o;if(!e)return{};const t={};return(o=e==null?void 0:e.forEach)==null||o.call(e,n=>{const[i,s]=n.split(":");t[i]=s||"all"}),t},Ho=e=>{const t=[];for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o)){const n=e[o];n==="all"?t.push(o):t.push(`${o}:${n}`)}return t},jf=F.connect(e=>{const{onChange:t}=e,o=Uo(),n=r.useCompile(),{t:i}=B.useTranslation(),s=F.useField(),c=Ef(s.value);return a.jsx("div",{children:a.jsx(x.Table,{size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:i("Action display name"),render:l=>n(l)},{dataIndex:"onNewRecord",title:i("Action type"),render:l=>l?a.jsx(x.Tag,{color:"green",children:i("Action on new records")}):a.jsx(x.Tag,{color:"geekblue",children:i("Action on existing records")})},{dataIndex:"enabled",title:i("Allow"),render:(l,y)=>a.jsx(x.Checkbox,{checked:l,onChange:u=>{l?delete c[y.name]:c[y.name]="all",t(Ho(c))}})},{dataIndex:"scope",title:i("Data scope"),render:(l,y)=>!y.onNewRecord&&a.jsx(x.Select,{"data-testid":"select-data-scope",popupMatchSelectWidth:!1,size:"small",value:l,options:[{label:i("All records"),value:"all"},{label:i("Own records"),value:"own"}],onChange:u=>{c[y.name]=u,t(Ho(c))}})}],dataSource:o==null?void 0:o.map(l=>{let y="all",u=!1;return c[l.name]&&(u=!0,y=c[l.name]),K(T({},l),{enabled:u,scope:y})})})})}),Kf=en.createStyles(({css:e})=>e`
|
|
52
|
-
.ant-table-cell {
|
|
53
|
-
> .ant-space-horizontal {
|
|
54
|
-
.ant-space-item-split:has(+ .ant-space-item:empty) {
|
|
55
|
-
display: none;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
`),Nf=(e="main")=>({name:`dataSources/${e}/rolesResourcesScopes`,fields:[{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Scope name")}}',type:"string","x-component":"Input",required:!0}}]}),Bf=()=>{const{name:e}=p.useContext(me),t=r.useFormBlockContext();return p.useEffect(()=>{t.form.setInitialValues({resourceName:e})},[e]),{form:t.form}},Vf=e=>{const t=Nf(e);return{type:"object",properties:{scope:{"x-component":"RecordPicker","x-component-props":{size:"small",fieldNames:{label:"name",value:"id"},multiple:!1,association:{target:"rolesResourcesScopes"},onChange:"{{ onChange }}"},properties:{selector:{type:"void",title:'{{ t("Select record") }}',"x-component":"RecordPicker.Selector","x-component-props":{className:"nb-record-picker-selector"},properties:{tableBlock:{type:"void","x-decorator":"TableSelectorProvider","x-decorator-props":{collection:t,resource:`dataSources/${e}/rolesResourcesScopes`,action:"list",params:{pageSize:20},useParams(){return{filter:{$or:[{resourceName:p.useContext(me).name},{resourceName:null}]}}},rowKey:"id"},"x-component":"BlockItem",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{create:{type:"void",title:'{{ t("Add new") }}',"x-action":"create","x-component":"Action","x-component-props":{icon:"PlusOutlined",openMode:"drawer",type:"primary"},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:`dataSources/${e}/rolesResourcesScopes`,collection:t},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":Bf,properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":r.withDynamicSchemaProps(o=>a.jsx(r.FlagProvider,{isVariableParsedInOtherContext:!0,children:a.jsx(r.Filter,T({},o))})),"x-use-component-props":()=>{const o=p.useContext(me);return{options:r.useFilterFieldOptions(o.fields)}},"x-component-props":{dynamicComponent:r.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{create:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}}}},value:{type:"array","x-component":"TableV2.Selector","x-use-component-props":"useTableSelectorProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-component":"TableV2.Column",properties:{actions:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{edit:{type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:`dataSources/${e}/rolesResourcesScopes`,collection:t,action:"get",useParams:"{{ useParamsFromRecord }}"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":r.withDynamicSchemaProps(o=>a.jsx(r.FlagProvider,{isVariableParsedInOtherContext:!0,children:a.jsx(r.Filter,T({},o))})),"x-use-component-props":()=>{const o=p.useContext(me);return{options:r.useFilterFieldOptions(o.fields)}},"x-component-props":{dynamicComponent:r.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{update:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}},destroy:{title:'{{ t("Delete") }}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component":"Action.Link","x-use-component-props":"useDestroyActionProps","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}}}}}}}}}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}}},Wo=p.createContext(null);Wo.displayName="RolesResourcesScopesSelectedRowKeysContext";const Lf=e=>{const[t,o]=p.useState([]);return a.jsx(Wo.Provider,{value:[t,o],children:e.children})},qf=e=>{const t=p.useMemo(()=>fe.createForm({values:{scope:e.value}}),[]),{key:o}=r.useRecord(),n=Vf(o);return a.jsx(r.FormProvider,{form:t,children:a.jsx(r.SchemaComponent,{components:{RolesResourcesScopesSelectedRowKeysProvider:Lf},scope:{onChange(i){var s;(s=e==null?void 0:e.onChange)==null||s.call(e,i)}},schema:n})})},Gf=e=>{var o;const t={};return(o=e==null?void 0:e.forEach)==null||o.call(e,n=>{n.name&&(t[n.name]=n,t[n.name].scope=Y.isEmpty(n.scope)?null:n.scope)}),t},me=p.createContext({});me.displayName="RoleResourceCollectionContext";const zf=F.connect(e=>{var v,d;const{styles:t}=Kf(),o=h=>{const g=h.map(b=>K(T({},b),{scope:Y.isEmpty(b.scope)?null:b.scope}));e.onChange(g)},n=r.useRecord(),i=Uo(),s=n.fields,c=r.useCompile(),{t:l}=B.useTranslation(),y=F.useField(),u=Gf(y.value||[]),f=(h,g)=>{var _;const b=u==null?void 0:u[h];return b?(_=b==null?void 0:b.fields)==null?void 0:_.includes(g):!1},m=i.filter(h=>h.allowConfigureFields),S=s==null?void 0:s.map(h=>{const g=T({},h);for(const b of m)g[b.name]=f(b.name,h.name);return g}),w=h=>{var g;u[h]?delete u[h]:u[h]={name:h,fields:(g=s==null?void 0:s.map)==null?void 0:g.call(s,b=>b.name)},o(Object.values(u))},A=(h,g)=>{u[h]?(u[h].scope=g,o(Object.values(u))):(w(h),u[h].scope=g,o(Object.values(u)))},C={};for(const h of m)C[h.name]=(s==null?void 0:s.length)===((d=(v=u==null?void 0:u[h.name])==null?void 0:v.fields)==null?void 0:d.length);return a.jsx("div",{children:a.jsx(me.Provider,{value:n,children:a.jsxs(ae.FormLayout,{layout:"vertical",children:[a.jsx(ae.FormItem,{label:l("Action permission"),children:a.jsx(x.Table,{className:t,size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:l("Action display name"),render:h=>c(h)},{dataIndex:"onNewRecord",title:l("Action type"),render:h=>h?a.jsx(x.Tag,{color:"green",children:l("Action on new records")}):a.jsx(x.Tag,{color:"geekblue",children:l("Action on existing records")})},{dataIndex:"enabled",title:l("Allow"),render:(h,g)=>a.jsx(x.Checkbox,{checked:h,onChange:()=>{w(g.name)}})},{dataIndex:"scope",title:l("Data scope"),render:(h,g)=>!g.onNewRecord&&a.jsx(qf,{value:h,onChange:b=>{A(g.name,b)}})}],dataSource:i==null?void 0:i.map(h=>{let g=!1,b=null;return u[h.name]&&(g=!0,h.onNewRecord||(b=u[h.name].scope)),K(T({},h),{enabled:g,scope:b})})})}),a.jsx(ae.FormItem,{label:l("Field permission"),children:a.jsx(x.Table,{className:t,pagination:!1,dataSource:S,columns:[{dataIndex:["uiSchema","title"],title:l("Field display name"),render:(h,g)=>c(h)||g.name},...m.map(h=>{const g=C==null?void 0:C[h.name];return{dataIndex:h.name,title:a.jsxs(a.Fragment,{children:[a.jsx(x.Checkbox,{checked:g,onChange:()=>{var _;const b=u[h.name]||{name:h.name};g?b.fields=[]:b.fields=(_=s==null?void 0:s.map)==null?void 0:_.call(s,N=>N.name),u[h.name]=b,o(Object.values(u))}}),c(h.displayName)]}),render:(b,_)=>a.jsx(x.Checkbox,{checked:b,onChange:()=>{const N=u[h.name]||{name:h.name},E=N.fields||[];if(b){const D=E.indexOf(_.name);E.splice(D,1)}else E.push(_.name);N.fields=E,u[h.name]=N,o(Object.values(u))}})}})]})})]})})})}),Uf={type:"object",properties:{[V.uid()]:{"x-component":"DataSourceTable"}}},be=p.createContext({});be.displayName="CurrentRolesContext";const Hf=({role:e})=>a.jsx(x.Card,{"data-testid":"acl-pane-card",bordered:!1,children:a.jsx(be.Provider,{value:e,children:a.jsx(r.SchemaComponent,{components:{MenuConfigure:r.MenuConfigure,RoleConfigure:kf,RolesResourcesActions:zf,DataSourceTable:Mf,StrategyActions:jf,SettingsCenterConfigure:r.SettingsCenterConfigure,SettingCenterProvider:r.SettingCenterProvider,ResourceActionProvider:r.ResourceActionProvider,RoleRecordProvider:wf},schema:Uf})})});class xe extends r.Plugin{constructor(){super(...arguments);Xo(this,"types",new Map)}load(){return P(this,null,function*(){this.app.addComponents({DataSourcePermissionManager:Hf}),this.app.use(an),this.app.pluginSettingsManager.add(j,{title:`{{t("Data sources", { ns: "${j}" })}}`,icon:"ClusterOutlined",showTabs:!1,aclSnippet:"pm.data-source-manager*"}),this.app.pluginSettingsManager.add(`${j}.list`,{title:`{{t("Data sources", { ns: "${j}" })}}`,Component:of,sort:1,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),this.app.pluginSettingsManager.add(`${j}/:name`,{title:a.jsx(ht,{}),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),this.app.pluginSettingsManager.add(`${j}/main`,{title:a.jsx(ht,{}),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.pluginSettingsManager.add(`${j}/main.collections`,{title:`{{t("Collections", { ns: "${j}" })}}`,Component:Tf,topLevelName:`${j}/main`,pluginKey:j,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.pluginSettingsManager.add(`${j}/:name.collections`,{title:`{{t("Collections", { ns: "${j}" })}}`,Component:Zy,topLevelName:`${j}/:name`,pluginKey:j,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.dataSourceManager.addDataSources(this.getThirdDataSource.bind(this),yt)})}setDataSources(){return P(this,null,function*(){var n;const o=yield this.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1}});return(n=o==null?void 0:o.data)==null?void 0:n.data})}getThirdDataSource(){return P(this,null,function*(){var n;const o=yield this.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1,appends:["collections"]}});return(n=o==null?void 0:o.data)==null?void 0:n.data})}registerType(o,n){this.types.set(o,n)}}O.PluginDataSourceManagerClient=xe,O.default=xe,Object.defineProperties(O,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
export declare const NAMESPACE = "data-source-manager";
|
|
10
|
-
export declare function lang(key: string, options?: {}): string;
|
|
11
|
-
export declare function useDSMTranslation(): import("react-i18next").UseTranslationResponse<("data-source-manager" | "client")[], undefined>;
|
|
@@ -1,15 +0,0 @@
|
|
|
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 { ISchema } from '@formily/react';
|
|
10
|
-
export declare const statusEnum: {
|
|
11
|
-
value: string;
|
|
12
|
-
label: string;
|
|
13
|
-
color: string;
|
|
14
|
-
}[];
|
|
15
|
-
export declare const databaseConnectionSchema: ISchema;
|
package/dist/externalVersion.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.2.13-alpha",
|
|
12
|
-
"react": "18.2.0",
|
|
13
|
-
"@nocobase/server": "1.2.13-alpha",
|
|
14
|
-
"lodash": "4.17.21",
|
|
15
|
-
"@ant-design/icons": "5.2.6",
|
|
16
|
-
"antd": "5.12.8",
|
|
17
|
-
"react-router-dom": "6.21.0",
|
|
18
|
-
"@formily/shared": "2.3.0",
|
|
19
|
-
"react-i18next": "11.18.6",
|
|
20
|
-
"@formily/react": "2.3.0",
|
|
21
|
-
"@emotion/css": "11.11.2",
|
|
22
|
-
"@nocobase/database": "1.2.13-alpha",
|
|
23
|
-
"@nocobase/utils": "1.2.13-alpha",
|
|
24
|
-
"@nocobase/plugin-acl": "1.2.13-alpha",
|
|
25
|
-
"@nocobase/acl": "1.2.13-alpha",
|
|
26
|
-
"sequelize": "6.35.2",
|
|
27
|
-
"@nocobase/test": "1.2.13-alpha",
|
|
28
|
-
"@formily/antd-v5": "1.1.9",
|
|
29
|
-
"@formily/core": "2.3.0",
|
|
30
|
-
"@formily/reactive": "2.3.0",
|
|
31
|
-
"@dnd-kit/core": "5.0.3",
|
|
32
|
-
"antd-style": "3.4.5"
|
|
33
|
-
};
|
package/dist/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
export * from './server';
|
|
10
|
-
export { default } from './server';
|
package/dist/index.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __export = (target, all) => {
|
|
17
|
-
for (var name in all)
|
|
18
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
-
};
|
|
20
|
-
var __copyProps = (to, from, except, desc) => {
|
|
21
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(from))
|
|
23
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
-
}
|
|
26
|
-
return to;
|
|
27
|
-
};
|
|
28
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var src_exports = {};
|
|
39
|
-
__export(src_exports, {
|
|
40
|
-
default: () => import_server.default
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(src_exports);
|
|
43
|
-
__reExport(src_exports, require("./server"), module.exports);
|
|
44
|
-
var import_server = __toESM(require("./server"));
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
...require("./server")
|
|
48
|
-
});
|
package/dist/locale/zh-CN.json
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Data source name": "数据源标识",
|
|
3
|
-
"Data source display name": "数据源名称",
|
|
4
|
-
"Host": "服务器地址",
|
|
5
|
-
"Port": "端口",
|
|
6
|
-
"Database": "数据库",
|
|
7
|
-
"Data source manager": "数据源管理",
|
|
8
|
-
"Data sources": "数据源",
|
|
9
|
-
"No external data source plugin installed": "未安装外部数据源",
|
|
10
|
-
"View documentation": "查看文档",
|
|
11
|
-
"Test Connection": "测试连接",
|
|
12
|
-
"Connection successful": "连接成功",
|
|
13
|
-
"Display name": "名称",
|
|
14
|
-
"Username": "用户名",
|
|
15
|
-
"Password": "密码",
|
|
16
|
-
"Type": "类型",
|
|
17
|
-
"Description": "描述",
|
|
18
|
-
"Storage": "文件地址",
|
|
19
|
-
"Collections": "数据表",
|
|
20
|
-
"Permissions": "权限",
|
|
21
|
-
"Allow adding and modifying collection": "允许添加和修改数据表结构",
|
|
22
|
-
"Unknown field type": "未知字段类型",
|
|
23
|
-
"The following field types are not compatible and do not support output and display": "以下字段类型未适配,不支持输出和显示",
|
|
24
|
-
"Field database type": "字段数据库类型",
|
|
25
|
-
"Field interface": "UI类型",
|
|
26
|
-
"Status": "状态",
|
|
27
|
-
"Loading": "加载中",
|
|
28
|
-
"Failed": "加载失败",
|
|
29
|
-
"Loaded": "已加载",
|
|
30
|
-
"Reloading": "加载中",
|
|
31
|
-
"Data source synchronization in progress": "数据源同步中",
|
|
32
|
-
"Data source synchronization successful": "数据源同步成功",
|
|
33
|
-
"Filter target key":"筛选目标键",
|
|
34
|
-
"Select field": "选择字段",
|
|
35
|
-
"OK": "确定",
|
|
36
|
-
"Please select a field.": "请选择一个字段。",
|
|
37
|
-
"Are you sure you want to set the \"{{title}}\" field as a record unique key? This setting cannot be changed after it's been set.": "你确定将 “{{title}}” 字段设置为主键吗?设置成功后不可修改。",
|
|
38
|
-
"If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.": "当数据表没有主键时,你需要配置记录唯一标识符,用于在区块中定位行记录,不配置将无法创建该表的数据区块。",
|
|
39
|
-
"Filter data based on the specific field, with the requirement that the field value must be unique.": "根据特定的字段筛选数据,字段值必须具备唯一性。"
|
|
40
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
-
export default _default;
|