@nocobase/plugin-data-source-manager 2.2.0-alpha.1 → 2.2.0-alpha.11

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.
@@ -116,6 +116,7 @@ export interface CollectionTemplateOptions {
116
116
  order?: number;
117
117
  color?: string;
118
118
  divider?: boolean;
119
+ creatable?: boolean;
119
120
  collection?: {
120
121
  options?: Record<string, any> | (() => Record<string, any>);
121
122
  fields?: CollectionTemplateField[] | (() => CollectionTemplateField[]);
@@ -192,11 +193,12 @@ export interface CollectionTemplateOptions {
192
193
  */
193
194
  beforeSubmit?: (values: Record<string, any>) => void;
194
195
  }
195
- declare class CollectionTemplateRegistry {
196
+ export declare class CollectionTemplateRegistry {
196
197
  protected templates: Map<string, CollectionTemplateOptions>;
197
198
  register(nameOrOptions: string | CollectionTemplateOptions, options?: CollectionTemplateOptions): void;
198
199
  get(name?: string): CollectionTemplateOptions;
199
200
  getAll(): CollectionTemplateOptions[];
201
+ getCreatable(): CollectionTemplateOptions[];
200
202
  }
201
203
  declare class CollectionPresetFieldRegistry {
202
204
  protected fields: Map<string, CollectionPresetFieldOptions>;
@@ -237,6 +239,7 @@ export declare class PluginDataSourceManagerClientV2 extends Plugin<any, Applica
237
239
  getCollectionPresetFields(): CollectionPresetFieldOptions[];
238
240
  getCollectionTemplate(name?: string): CollectionTemplateOptions;
239
241
  getCollectionTemplates(): CollectionTemplateOptions[];
242
+ getCreatableCollectionTemplates(): CollectionTemplateOptions[];
240
243
  private registerBuiltInCollectionPresetFields;
241
244
  private registerBuiltInCollectionTemplates;
242
245
  }
@@ -8,18 +8,18 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.2.0-alpha.1",
11
+ "@nocobase/client": "2.2.0-alpha.11",
12
12
  "react": "18.2.0",
13
- "@nocobase/plugin-acl": "2.2.0-alpha.1",
14
- "@nocobase/utils": "2.2.0-alpha.1",
15
- "@nocobase/flow-engine": "2.2.0-alpha.1",
16
- "@nocobase/client-v2": "2.2.0-alpha.1",
17
- "@nocobase/ai": "2.2.0-alpha.1",
18
- "@nocobase/server": "2.2.0-alpha.1",
19
- "@nocobase/data-source-manager": "2.2.0-alpha.1",
13
+ "@nocobase/plugin-acl": "2.2.0-alpha.11",
14
+ "@nocobase/utils": "2.2.0-alpha.11",
15
+ "@nocobase/flow-engine": "2.2.0-alpha.11",
16
+ "@nocobase/client-v2": "2.2.0-alpha.11",
17
+ "@nocobase/ai": "2.2.0-alpha.11",
18
+ "@nocobase/server": "2.2.0-alpha.11",
19
+ "@nocobase/data-source-manager": "2.2.0-alpha.11",
20
20
  "lodash": "4.18.1",
21
- "@nocobase/acl": "2.2.0-alpha.1",
22
- "@nocobase/database": "2.2.0-alpha.1",
21
+ "@nocobase/acl": "2.2.0-alpha.11",
22
+ "@nocobase/database": "2.2.0-alpha.11",
23
23
  "@ant-design/icons": "5.6.1",
24
24
  "antd": "5.24.2",
25
25
  "react-router-dom": "6.30.1",
@@ -28,9 +28,9 @@ module.exports = {
28
28
  "react-i18next": "11.18.6",
29
29
  "@emotion/css": "11.13.0",
30
30
  "ahooks": "3.7.8",
31
- "@nocobase/actions": "2.2.0-alpha.1",
31
+ "@nocobase/actions": "2.2.0-alpha.11",
32
32
  "sequelize": "6.35.2",
33
- "@nocobase/test": "2.2.0-alpha.1",
33
+ "@nocobase/test": "2.2.0-alpha.11",
34
34
  "@formily/antd-v5": "1.2.3",
35
35
  "@formily/core": "2.3.7",
36
36
  "@formily/reactive": "2.3.7",
@@ -161,7 +161,7 @@
161
161
  "Primary": "Primary",
162
162
  "Primary key, distributed uniqueness, time-ordering": "Primary key, distributed uniqueness, time-ordering",
163
163
  "Quarter": "Quarter",
164
- "Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.": "Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.",
164
+ "Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.": "Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.",
165
165
  "Reloading": "Reloading",
166
166
  "Record unique key": "Record unique key",
167
167
  "References": "References",
@@ -205,7 +205,7 @@
205
205
  "Sync from database": "Sync from database",
206
206
  "Sync successfully": "Sync successfully",
207
207
  "SQL collection": "SQL collection",
208
- "Support letters, numbers and underscores, must start with an letter.": "Support letters, numbers and underscores, must start with an letter.",
208
+ "Support letters, numbers and underscores, must start with a letter.": "Support letters, numbers and underscores, must start with a letter.",
209
209
  "Table name": "Table name",
210
210
  "Tables loaded successfully": "Tables loaded successfully",
211
211
  "Collection display name": "Collection display name",
@@ -329,8 +329,8 @@
329
329
  "ai.tools.dataSourceCounting.about": "Use dataSource, collectionName, and collection fields to query data from the database, get total count of records",
330
330
  "ai.tools.dataQuery.args.datasource": "Data source key",
331
331
  "ai.tools.dataQuery.args.collectionName": "Collection name",
332
- "ai.tools.dataQuery.args.fields": "Fields to be queried",
333
- "ai.tools.dataQuery.args.appends": "Related collection to be queried",
332
+ "ai.tools.dataQuery.args.fields": "Fields to be returned. To return relation attributes, include dotted relation paths here, such as relation_field.display_field.",
333
+ "ai.tools.dataQuery.args.appends": "Relation fields to load. This only loads associations and does not select returned fields by itself. For relation attributes, also include dotted paths in fields; for example, use appends: [\"relation_field\"] with fields: [\"relation_field.display_field\"].",
334
334
  "ai.tools.dataQuery.args.sort": "Sort field names. By default, they are in ascending order. A minus sign before the field name indicates descending order",
335
335
  "ai.tools.dataQuery.args.offset": "Offset of records to be queried",
336
336
  "ai.tools.dataQuery.args.limit": "Maximum number of records to be queried",
@@ -161,7 +161,7 @@
161
161
  "Primary": "主键",
162
162
  "Primary key, distributed uniqueness, time-ordering": "主键,分布式唯一,按时间排序",
163
163
  "Quarter": "季度",
164
- "Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.": "随机生成,可修改。支持字母、数字和下划线,必须以字母开头。",
164
+ "Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.": "随机生成,可修改。支持字母、数字和下划线,必须以字母开头。",
165
165
  "Reloading": "加载中",
166
166
  "Record unique key": "记录唯一标识",
167
167
  "References": "参考",
@@ -205,7 +205,7 @@
205
205
  "Sync from database": "从数据库同步",
206
206
  "Sync successfully": "同步成功",
207
207
  "SQL collection": "SQL 数据表",
208
- "Support letters, numbers and underscores, must start with an letter.": "支持字母、数字和下划线,必须以字母开头。",
208
+ "Support letters, numbers and underscores, must start with a letter.": "支持字母、数字和下划线,必须以字母开头。",
209
209
  "Table name": "表名",
210
210
  "Tables loaded successfully": "数据表加载成功",
211
211
  "Collection display name": "数据表显示名称",
@@ -329,8 +329,8 @@
329
329
  "ai.tools.dataSourceCounting.about": "使用 dataSource、collectionName 和 collection fields 从数据库中获取记录总数",
330
330
  "ai.tools.dataQuery.args.datasource": "数据源标识",
331
331
  "ai.tools.dataQuery.args.collectionName": "数据表名称",
332
- "ai.tools.dataQuery.args.fields": "需要查询的字段",
333
- "ai.tools.dataQuery.args.appends": "需要查询的关联数据表",
332
+ "ai.tools.dataQuery.args.fields": "需要返回的字段。返回关联字段属性时,必须在这里填写点路径,例如 relation_field.display_field。",
333
+ "ai.tools.dataQuery.args.appends": "需要加载的关联字段。这里只负责加载关联数据,不会自动选择返回字段。返回关联字段属性时,还必须在 fields 中填写点路径;例如 appends: [\"relation_field\"] 要配合 fields: [\"relation_field.display_field\"]。",
334
334
  "ai.tools.dataQuery.args.sort": "排序字段名称,默认升序。字段名前加减号表示降序",
335
335
  "ai.tools.dataQuery.args.offset": "查询记录的偏移量",
336
336
  "ai.tools.dataQuery.args.limit": "查询记录的最大数量",
@@ -1 +1 @@
1
- {"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-06-10T18:12:12.137Z"}
1
+ {"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-07-28T07:40:23.663Z"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-data-source-manager",
3
- "version": "2.2.0-alpha.1",
3
+ "version": "2.2.0-alpha.11",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "Data source manager",
6
6
  "displayName.ru-RU": "Менеджер управления источниками данных",
@@ -22,6 +22,6 @@
22
22
  "keywords": [
23
23
  "Data model tools"
24
24
  ],
25
- "gitHead": "303663aba6c6eefa27e6a6435b4c0352074ec40f",
25
+ "gitHead": "c9ff1f51e5c33bc6437b64eb779212be71b78f58",
26
26
  "license": "Apache-2.0"
27
27
  }
@@ -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
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).push([["644"],{687:function(e,t,n){n.r(t),n.d(t,{MainDataSourceManager:function(){return eI}});var r,o,a,i,l=n(166),c=n(155),u=n.n(c),s=n(342),p=n(452),f=n(230),d=n(992),m=n(768),y=n(953),b=n(533),v=n(59),h=n(16);function g(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){return f.Schema.compile(e,{t:s.i18n.t})},S={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"},__aiCollector__:{type:"void","x-component":"AIResourceContextCollector","x-component-props":{uid:"collections:list"}}}}}},w={type:"object",properties:(C(i={},(0,l.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}},syncFromDatabase:{type:"void","x-component":"SyncFromDatabaseAction"},create:{type:"void",title:'{{ t("Create collection") }}',"x-component":"AddCollection","x-component-props":{type:"primary"}},extendable:{type:"void","x-component":"ExtendableActions"}}}),C(i,(0,l.uid)(),{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}",useAction:function(){var e=(0,s.useAPIClient)(),t=(0,y.useTranslation)().t;return{move:function(n,r){var o;return(o=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:return[4,e.resource("collections").move({sourceId:n.name,targetId:r.name})];case 1:return o.sent(),v.message.success(t("Saved successfully"),.2),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var a=o.apply(e,t);function i(e){g(a,n,r,i,l,"next",e)}function l(e){g(a,n,r,i,l,"throw",e)}i(void 0)})})()}}}},properties:{column1:{type:"void",title:'{{t("Collection display name")}}',"x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{"x-component":h.H,"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":s.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":s.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":function(e){var t=e.path.segments[1],n=e.path.segments[0],r=e.form.getValuesIn("".concat(n,".").concat(t));r&&(e.title="".concat(x(r.title)," - ").concat(x('{{ 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"}}}}}}}}),i)},A={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"}}}}}}}}},O={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"}}}}}}}}},E=n(691),j=n(375),P=n(872);function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function I(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){k(a,r,o,i,l,"next",e)}function l(e){k(a,r,o,i,l,"throw",e)}i(void 0)})}}function D(){return(D=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||M(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e){return function(e){if(Array.isArray(e))return F(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||M(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){if(e){if("string"==typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F(e,t)}}function _(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var V=function(e){var t=e;if(null==t)throw TypeError("Cannot destructure "+t);var n=D({},e),r=(0,P.VP)().t,o=T((0,c.useState)(!1),2),a=o[0],i=o[1],l=T((0,c.useState)(""),2),p=l[0],f=l[1],d=T((0,c.useState)([]),2),m=d[0],y=d[1],b=T((0,c.useState)([]),2),h=b[0],g=b[1],C=T((0,c.useState)(!1),2),x=C[0],S=C[1],w=T((0,c.useState)([]),2),A=w[0],O=w[1],E=(0,s.useAPIClient)();(0,s.useResourceContext)().resource;var j=(0,s.useResourceActionContext)().refresh,F=v.App.useApp().modal,k=(0,s.useDataSource)(),M=(0,c.useCallback)(function(){return I(function(){var e;return _(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,E.resource("dataSources").readTables({values:{dataSourceKey:"main"}})];case 1:return[2,((null==(e=t.sent().data)?void 0:e.data)||[]).map(function(e){return{key:e.name,name:e.name,title:e.title||e.name}})];case 2:return console.error("Failed to fetch selectable tables:",t.sent()),[2,[]];case 3:return[2]}})})()},[E]),V=(0,c.useCallback)(function(){return I(function(){return _(this,function(e){switch(e.label){case 0:S(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,M()];case 2:return O(e.sent()),y([]),[3,5];case 3:return e.sent(),v.message.error(r("Failed to initialize data")),[3,5];case 4:return S(!1),[7];case 5:return[2]}})})()},[M,r]),K=(0,c.useCallback)(function(e,t){f(t)},[]),L=(0,c.useCallback)(function(e){y(e)},[]),$=(0,c.useCallback)(function(e,t){g(R(e).concat(R(t)))},[]),B=(0,c.useCallback)(function(){return I(function(){return _(this,function(e){if(0===m.length)return v.message.warning(r("Please select at least one table")),[2];try{S(!0),F.confirm({title:r("Confirm load tables"),content:r("Are you sure you want to load {{count}} table(s)?",{count:m.length}),onOk:function(){return I(function(){var e;return _(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,E.resource("dataSources").loadTables({values:{dataSourceKey:"main",tables:m}})];case 1:return t.sent(),v.message.success(r("Tables loaded successfully")),i(!1),y([]),g([]),f(""),j(),k.reload(),[3,3];case 2:return e=t.sent(),console.error("Failed to load tables:",e),v.message.error(r("Failed to load tables")),[3,3];case 3:return[2]}})})()}})}catch(e){v.message.error(r("Failed to load tables"))}finally{S(!1)}return[2]})})()},[m,E,r,F,j]),N=(0,c.useCallback)(function(){i(!1),y([]),g([]),f("")},[]),q=(0,c.useCallback)(function(){i(!0),V()},[V]),G=(0,c.useMemo)(function(){return p?A.filter(function(e){return e.title.toLowerCase().includes(p.toLowerCase())||e.name.toLowerCase().includes(p.toLowerCase())||e.description&&e.description.toLowerCase().includes(p.toLowerCase())}):A},[A,p]);return u().createElement(u().Fragment,null,u().createElement("div",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({onClick:q},n),r("Load tables from database")),u().createElement(v.Drawer,{title:r("Load tables from database"),placement:"right",onClose:N,open:a,width:800,footer:u().createElement("div",{style:{textAlign:"right"}},u().createElement(v.Button,{onClick:N,style:{marginRight:8}},r("Cancel")),u().createElement(v.Button,{type:"primary",onClick:B,loading:x,disabled:0===m.length},r("Submit")))},u().createElement("div",{style:{height:"calc(100vh - 160px)",display:"flex",flexDirection:"column"}},u().createElement(v.Spin,{spinning:x,style:{height:"100%"}},u().createElement(v.Transfer,{dataSource:G,titles:[r("Available tables"),r("Selected tables")],targetKeys:m,selectedKeys:h,onChange:L,onSelectChange:$,onSearch:K,render:function(e){return e.title},showSearch:!0,style:{height:"100%"},listStyle:{width:350,height:"calc(100vh - 100px)"},locale:{itemUnit:r("item"),itemsUnit:r("items"),searchPlaceholder:r("Search collections...")}})))))};function K(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function L(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){K(a,r,o,i,l,"next",e)}function l(e){K(a,r,o,i,l,"throw",e)}i(void 0)})}}function $(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var B=function(){var e=(0,P.VP)().t,t=(0,s.useAPIClient)(),n=v.App.useApp().modal,r=(0,s.useDataSource)();return u().createElement(v.Dropdown,{menu:{items:[{key:"load-tables",label:u().createElement(V,null),icon:u().createElement(j.ImportOutlined,null)},{key:"sync-fields",label:e("Sync field changes from database"),icon:u().createElement(j.ReloadOutlined,null),onClick:function(){return L(function(){return $(this,function(o){return n.confirm({title:e("Sync field changes from database"),content:e("Field synchronization confirmation prompt"),onOk:function(){return L(function(){return $(this,function(n){switch(n.label){case 0:return[4,t.resource("mainDataSource").syncFields()];case 1:return n.sent(),r.reload(),v.message.success(e("Sync successfully")),[2]}})})()}}),[2]})})()}}]},placement:"bottomLeft"},u().createElement(v.Button,{icon:u().createElement(j.SyncOutlined,null)},e("Sync from database")))};function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function q(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function G(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){q(a,r,o,i,l,"next",e)}function l(e){q(a,r,o,i,l,"throw",e)}i(void 0)})}}function U(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var z=function(e,t){return function(n,r){n.loading=!0,e(n,r,t).then(d.action.bound(function(e){n.dataSource=e,n.loading=!1})).catch(console.error)}},Q=function(){var e,t=function(e){if(Array.isArray(e))return e}(e=(0,c.useState)([]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return N(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return N(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();return[t[0],t[1]]},Z=function(){var e=(0,s.useRecord)(),t=(0,f.useForm)();return{run:function(){return G(function(){var n,r,o,a;return U(this,function(i){return a=null==(o=t.values)||null==(r=o.children)||null==(n=r.slice)?void 0:n.call(r),t.setValuesIn("children",a.filter(function(t){return t.name!==e.name})),[2]})})()}}},H=function(){return{run:function(){return G(function(){return U(this,function(e){return[2]})})()}}},J=function(){var e=(0,s.useRecord)(),t=(0,s.useCollectionManager_deprecated)().getCollectionFields;return e.__parent&&"subTable"===e.__parent.interface?(0,c.useContext)(s.DataSourceContext_deprecated).dataSource:t(e.collectionName||e.name)},W=function(e){return"".concat(e||"").concat((0,l.uid)())},X=function(){var e=(0,y.useTranslation)().t,t=(0,s.useCollectionManager_deprecated)(),n=t.interfaces,r=t.getCollections,o=t.getCollection,a=((0,s.useCurrentAppInfo)()||{data:{database:{}}}).data.database,i=(0,c.useContext)(s.CollectionCategoriesContext),l=(0,s.useAPIClient)(),p=l.resource("dbViews"),d=(0,s.useCompile)();(0,f.useForm)();var v=(0,s.useApp)(),h=(0,c.useContext)(s.ResourceActionContext),g=(0,c.useContext)(s.SchemaComponentContext),C=(0,c.useMemo)(function(){var e,t;return e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},g),t=t={designable:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e},[g]);return u().createElement(s.SchemaComponentContext.Provider,{value:C},u().createElement(s.SchemaComponent,{schema:S,components:{AddSubFieldAction:s.AddSubFieldAction,EditSubFieldAction:s.EditSubFieldAction,FieldSummary:s.FieldSummary,TemplateSummay:s.TemplateSummary,CollectionFields:b.o,SyncFromDatabaseAction:B},scope:{loadFilterTargetKeys:function(e){return G(function(){var t,n,r;return U(this,function(a){return n=(t=e.form.values).name,r=t.fields,[2,Promise.resolve({data:(o(n)||{}).fields||r}).then(function(e){var t;return null==(t=e.data.filter(function(e){return!!e.interface&&!!v.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(e.interface).titleUsable}))?void 0:t.map(function(e){var t;return{label:d(null==(t=e.uiSchema)?void 0:t.title)||e.name,value:e.name}})})]})})()},useDestroySubField:Z,useBulkDestroySubField:H,useSelectedRowKeys:Q,useAsyncDataSource:z,loadCollections:function(e,t,n){return G(function(){var o,a,i;return U(this,function(l){return a=t.targetScope,i=(null==(o=e.props)?void 0:o.name)==="inherits",[2,r().filter(function(t){if((null==n?void 0:n.includes(t.template))||t.autoCreate&&t.isThrough||i&&"view"===t.template||"target"===e.props.name&&Array.isArray(t.filterTargetKey)&&t.filterTargetKey.length>1)return!1;var r,o=!(null==a?void 0:a.template)||a.template.includes(t.template),l=!(null==a?void 0:a[null==(r=e.props)?void 0:r.name])||a[e.props.name].includes(t.name);return o&&l}).map(function(e){return{label:d(e.title),value:e.name}})]})})()},loadCategories:function(){return G(function(){return U(this,function(e){return[2,i.data.map(function(e){return{label:d(e.name),value:e.id}})]})})()},loadDBViews:function(){return G(function(){return U(this,function(e){return[2,p.list().then(function(e){var t,n=e.data;return null==n||null==(t=n.data)?void 0:t.map(function(e){var t=e.schema;return{label:t?"".concat(t,".").concat(d(e.name)):e.name,value:t?"".concat(t,"@").concat(e.name):e.name}})})]})})()},loadStorages:function(){return G(function(){return U(this,function(t){return[2,l.resource("storages").list().then(function(t){var n,r=t.data;return null==r||null==(n=r.data)?void 0:n.map(function(t){return{label:e(d(t.title)),value:t.name}})})]})})()},useCurrentFields:J,useNewId:W,useCancelAction:s.useCancelAction,interfaces:n,enableInherits:(null==a?void 0:a.dialect)==="postgres",isPG:(null==a?void 0:a.dialect)==="postgres",getPickerFormat:m.getPickerFormat,useRefreshActionProps:function(){return(0,E.useDataSourceRefresh)({dataSourceName:"main",onSuccess:function(){var e;null==h||null==(e=h.refresh)||e.call(h)}})}}}))},Y=n(799),ee=n(773),et=n.n(ee),en=n(719);function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function eo(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function ea(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){eo(a,r,o,i,l,"next",e)}function l(e){eo(a,r,o,i,l,"throw",e)}i(void 0)})}}function ei(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function el(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){ei(e,t,n[t])})}return e}function ec(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return er(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return er(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eu(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function es(e){var t=(0,Y.useDraggable)({id:e.id,data:e.data}),n=t.attributes,r=t.listeners,o=t.setNodeRef;return u().createElement("div",el({ref:o},r,n),u().createElement("div",null,e.children))}function ep(e){var t=(0,Y.useDroppable)({id:e.id,data:e.data}),n=t.isOver,r=t.setNodeRef;return u().createElement("div",{ref:r,style:n?{color:"green"}:void 0},e.children)}var ef=(0,f.observer)(function(e){var t=e.item;return u().createElement(ep,{id:t.id.toString(),data:t},u().createElement("div",null,u().createElement(es,{id:t.id.toString(),data:t},u().createElement(ed,{item:t}))))},{displayName:"TabTitle"}),ed=function(e){var t=e.item,n=(0,y.useTranslation)().t,r=(0,s.useCompile)();return u().createElement(v.Space,null,u().createElement(v.Badge,{color:t.color}),n(r(t.name)))},em=(0,f.observer)(function(e){var t=ec((0,c.useState)(null),2),n=t[0],r=t[1],o=(0,c.useContext)(s.CollectionCategoriesContext).refresh,a=(0,s.useResourceActionContext)().refresh,i=(0,s.useAPIClient)(),l=(0,Y.useSensor)(Y.MouseSensor,{activationConstraint:{distance:10}}),p=(0,Y.useSensors)(l);return u().createElement(Y.DndContext,{sensors:p,onDragEnd:function(e){return ea(function(){var t,n;return eu(this,function(l){switch(l.label){case 0:if(t=e.active,n=e.over,setTimeout(function(){r(null)}),!(n&&n.id!==t.id))return[3,4];return[4,i.resource("collectionCategories").move({sourceId:t.id,targetId:n.id})];case 1:return l.sent(),[4,o()];case 2:return l.sent(),[4,a()];case 3:l.sent(),l.label=4;case 4:return[2]}})})()},onDragStart:function(e){var t;r(null==(t=e.active)?void 0:t.data.current)}},e.children,u().createElement(Y.DragOverlay,null,n?u().createElement("span",{style:{whiteSpace:"nowrap"}},u().createElement(ed,{item:n})):null))},{displayName:"DndProvider"}),ey=function(){var e=(0,y.useTranslation)().t,t=(0,c.useContext)(s.CollectionCategoriesContext),n=t.data,r=t.refresh,o=(0,s.useResourceActionContext)(),a=o.refresh,i=o.run,p=o.defaultRequest,d=o.setState,m=ec((0,c.useState)({tab:"all"}),2),h=m[0],g=m[1],C=ec((0,c.useState)(h.tab),2),x=C[0],S=C[1],A=(0,s.useCompile)(),O=(0,s.useAPIClient)(),E=v.App.useApp().modal,P=(0,c.useMemo)(function(){if(!n)return[];var e=n.sort(function(e,t){return t.sort-e.sort}).concat().map(function(e){var t,n;return t=el({},e),n=n={schema:w},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t});return e.find(function(e){return"all"===e.id})||e.unshift({name:'{{t("All collections")}}',id:"all",sort:0,closable:!1,schema:w}),e},[n]);(0,c.useEffect)(function(){"all"!==h.tab&&F(h.tab)},[]);var F=function(e){if(g({tab:e}),S((0,l.uid)()),"all"!==e){var t,n={$and:[null==p||null==(t=p.params)?void 0:t.filter,{"category.id":e}]};i({filter:n}),null==d||d({category:[+e],params:[{filter:n}]})}else i(),null==d||d({category:[],params:[]})},k=function(e){E.confirm({title:A("{{t('Delete category')}}"),content:A("{{t('Are you sure you want to delete it?')}}"),onOk:function(){return ea(function(){return eu(this,function(t){switch(t.label){case 0:return[4,O.resource("collectionCategories").destroy({filter:{id:e}})];case 1:return t.sent(),e===+h.tab&&g({tab:"all"}),[4,r()];case 2:return t.sent(),[4,a()];case 3:return t.sent(),[2]}})})()}})},I=function(){return ea(function(){return eu(this,function(t){return[2,n.map(function(t){return{label:e(A(t.name)),value:t.id}})]})})()},D=et().memoize(function(e){return{items:[{key:"edit",label:u().createElement(s.SchemaComponent,{schema:{type:"void",properties:ei({},(0,l.uid)(),{"x-component":"EditCategory","x-component-props":{item:e}})}})},{key:"delete",label:A("{{t('Delete category')}}"),onClick:function(){return k(e.id)}}]}});return n?u().createElement(em,null,u().createElement(v.Tabs,{addIcon:u().createElement(s.SchemaComponent,{schema:{type:"void",properties:{addCategories:{type:"void",title:'{{ t("Add category") }}',"x-component":"AddCategory","x-component-props":{type:"primary"}}}}}),onChange:F,defaultActiveKey:h.tab||"all",type:"editable-card",destroyInactiveTabPane:!0,tabBarStyle:{marginBottom:"0px"},items:P.map(function(e){return{label:"all"!==e.id?u().createElement("div",{"data-no-dnd":"true"},u().createElement(ef,{item:e})):A(e.name),key:String(e.id),closable:e.closable,closeIcon:u().createElement(v.Dropdown,{menu:D(e)},u().createElement(j.MenuOutlined,{role:"button","aria-label":A(e.name),style:{padding:8,margin:"-8px"}})),children:u().createElement(v.Card,{bordered:!1},u().createElement(s.SchemaComponentOptions,{components:{CollectionFields:b.o,ExtendableActions:eb},inherit:!0,scope:{loadCategories:I,categoryVisible:"all"===e.id,categoryId:e.id}},u().createElement(f.RecursionField,{name:x,schema:e.schema,onlyRenderProperties:!0})))}})})):null},eb=function(){var e=(0,s.usePlugin)(en.default).extensionManager.getManagerActions();return(null==e?void 0:e.length)?u().createElement("div",{style:{margin:"0px 8px"}},et().sortBy(e,"order").map(function(e,t){return u().createElement(e.component,{key:t})})):u().createElement(u().Fragment,null)};function ev(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function eh(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function eg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var eC=function(){var e=(0,f.useForm)(),t=(0,s.useActionContext)(),n=(0,c.useContext)(s.CollectionCategoriesContext).refresh,r=(0,s.useAPIClient)();return{run:function(){var o;return(o=function(){var o;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(a){switch(a.label){case 0:return[4,e.submit()];case 1:return a.sent(),o=(0,ee.cloneDeep)(e.values),[4,r.resource("collectionCategories").create({values:eg({},o)})];case 2:return a.sent(),t.setVisible(!1),[4,e.reset()];case 3:return a.sent(),[4,n()];case 4:return a.sent(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var a=o.apply(e,t);function i(e){eh(a,n,r,i,l,"next",e)}function l(e){eh(a,n,r,i,l,"throw",e)}i(void 0)})})()}}},ex=function(e){return u().createElement(eS,e)},eS=function(e){var t,n=e.scope,r=e.getContainer,o=e.children,a=function(e){if(Array.isArray(e))return e}(t=(0,c.useState)(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return ev(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ev(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=a[0],l=a[1],p=(0,y.useTranslation)().t;return u().createElement(s.ActionContextProvider,{value:{visible:i,setVisible:l}},u().createElement("div",{onClick:function(){return l(!0)},title:p("Add category")},o||u().createElement(j.PlusOutlined,null)),u().createElement(s.SchemaComponent,{schema:A,components:{CollectionCategory:s.CollectionCategory,CollectionTemplateTag:s.CollectionTemplateTag},scope:eg({getContainer:r,useCancelAction:s.useCancelAction,createOnly:!0,useCreateCategry:eC},n)}))};function ew(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function eA(e,t,n,r,o,a,i){try{var l=e[a](i),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function eO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var eE=function(){var e=(0,f.useForm)(),t=(0,s.useActionContext)(),n=(0,c.useContext)(s.CollectionCategoriesContext).refresh,r=(0,s.useResourceActionContext)().refresh,o=(0,s.useAPIClient)(),a=(0,s.useRecord)().id;return{run:function(){var i;return(i=function(){var i;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:c(0)}),l(i,"throw",{value:c(1)}),l(i,"return",{value:c(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function c(l){return function(c){var u=[l,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:return[4,e.submit()];case 1:return l.sent(),i=(0,ee.cloneDeep)(e.values),[4,o.resource("collectionCategories").update({filter:{id:a},values:eO({},i)})];case 2:return l.sent(),t.setVisible(!1),[4,e.reset()];case 3:return l.sent(),[4,n()];case 4:return l.sent(),[4,r()];case 5:return l.sent(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var o=i.apply(e,t);function a(e){eA(o,n,r,a,l,"next",e)}function l(e){eA(o,n,r,a,l,"throw",e)}a(void 0)})})()}}},ej=function(e){var t,n,r=(0,s.useRecord)(),o=(0,s.useRequest)(function(){return Promise.resolve({data:(0,ee.cloneDeep)(r)})},(t=eO({},e),n=n={manual:!0},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)),a=(0,s.useActionContext)();return(0,c.useEffect)(function(){a.visible&&o.run()},[a.visible]),o},eP=function(e){return u().createElement(eF,e)},eF=function(e){var t,n=e.scope,r=e.getContainer,o=e.item,a=e.children,i=function(e){if(Array.isArray(e))return e}(t=(0,c.useState)(!1))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return ew(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ew(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=i[0],p=i[1],f=(0,s.useCompile)();return u().createElement(s.RecordProvider,{record:o},u().createElement(s.ActionContextProvider,{value:{visible:l,setVisible:p}},u().createElement(u().Fragment,null,a||u().createElement("span",{onClick:function(){return p(!0)}},f('{{ t("Edit category") }}'))),u().createElement(s.SchemaComponent,{schema:O,scope:eO({getContainer:r,useCancelAction:s.useCancelAction,createOnly:!0,useEditCategry:eE,useValuesFromRecord:ej},n)})))};(0,p.registerValidateFormats)({uid:/^[a-zA-Z][a-zA-Z0-9_-]*$/});var ek={type:"object",properties:(r={},o=(0,l.uid)(),a={"x-component":"ConfigurationTable"},o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a,r)},eI=function(){return u().createElement(s.SchemaComponent,{schema:ek,components:{CollectionCategoriesProvider:s.CollectionCategoriesProvider,ConfigurationTable:X,ConfigurationTabs:ey,AddFieldAction:s.AddFieldAction,AddCollectionField:s.AddCollectionField,AddCollection:s.AddCollection,AddCollectionAction:s.AddCollectionAction,AddCategoryAction:eS,AddCategory:ex,EditCollection:s.EditCollection,EditCollectionAction:s.EditCollectionAction,DeleteCollection:s.DeleteCollection,DeleteCollectionAction:s.DeleteCollectionAction,EditFieldAction:s.EditFieldAction,EditCollectionField:s.EditCollectionField,OverridingCollectionField:s.OverridingCollectionField,OverridingFieldAction:s.OverridingFieldAction,ViewCollectionField:s.ViewCollectionField,ViewFieldAction:s.ViewFieldAction,EditCategory:eP,EditCategoryAction:eF,SyncFieldsAction:s.SyncFieldsAction,SyncFieldsActionCom:s.SyncFieldsActionCom,SyncSQLFieldsAction:s.SyncSQLFieldsAction}})}}}]);