@nocobase/plugin-block-template 1.6.0-alpha.29
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/LICENSE.txt +161 -0
- package/README.md +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/collections/blockTemplates.d.ts +46 -0
- package/dist/client/components/AddNewTemplate.d.ts +3 -0
- package/dist/client/components/BlockTemplateInfoContext.d.ts +11 -0
- package/dist/client/components/BlockTemplateList.d.ts +10 -0
- package/dist/client/components/BlockTemplateMenusProvider.d.ts +22 -0
- package/dist/client/components/BlockTemplateMobilePage.d.ts +10 -0
- package/dist/client/components/BlockTemplatePage.d.ts +10 -0
- package/dist/client/components/ConfigureLink.d.ts +10 -0
- package/dist/client/components/DisabledDeleteItem.d.ts +10 -0
- package/dist/client/components/RevertSetting.d.ts +10 -0
- package/dist/client/components/TemplateGridDecorator.d.ts +10 -0
- package/dist/client/components/index.d.ts +17 -0
- package/dist/client/constants.d.ts +11 -0
- package/dist/client/hooks/index.d.ts +14 -0
- package/dist/client/hooks/useBulkDestroyAction.d.ts +11 -0
- package/dist/client/hooks/useCreateActionProps.d.ts +12 -0
- package/dist/client/hooks/useDeleteAction.d.ts +11 -0
- package/dist/client/hooks/useDuplicateAction.d.ts +11 -0
- package/dist/client/hooks/useEditActionProps.d.ts +12 -0
- package/dist/client/hooks/useEditFormProps.d.ts +11 -0
- package/dist/client/hooks/useIsInTemplate.d.ts +16 -0
- package/dist/client/index.d.ts +25 -0
- package/dist/client/index.js +10 -0
- package/dist/client/initializers/TemplateBlockInitializer.d.ts +16 -0
- package/dist/client/initializers/index.d.ts +10 -0
- package/dist/client/initializers/templateBlockInitializerItem.d.ts +10 -0
- package/dist/client/locale.d.ts +10 -0
- package/dist/client/schemas/blockTemplates.d.ts +10 -0
- package/dist/client/schemas/bulkDestroySchema.d.ts +61 -0
- package/dist/client/schemas/createActionSchema.d.ts +70 -0
- package/dist/client/schemas/editActionSchema.d.ts +66 -0
- package/dist/client/schemas/index.d.ts +12 -0
- package/dist/client/settings/disabledDeleteSetting.d.ts +15 -0
- package/dist/client/settings/revertSetting.d.ts +15 -0
- package/dist/client/utils/interceptors.d.ts +15 -0
- package/dist/client/utils/schema.d.ts +21 -0
- package/dist/client/utils/setting.d.ts +13 -0
- package/dist/client/utils/template.d.ts +50 -0
- package/dist/externalVersion.js +30 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +37 -0
- package/dist/locale/zh-CN.json +37 -0
- package/dist/server/actions/destroy.d.ts +10 -0
- package/dist/server/actions/destroy.js +137 -0
- package/dist/server/actions/index.d.ts +11 -0
- package/dist/server/actions/index.js +34 -0
- package/dist/server/actions/link.d.ts +10 -0
- package/dist/server/actions/link.js +43 -0
- package/dist/server/actions/saveSchema.d.ts +10 -0
- package/dist/server/actions/saveSchema.js +46 -0
- package/dist/server/collections/blockTemplateLinks.d.ts +2 -0
- package/dist/server/collections/blockTemplateLinks.js +56 -0
- package/dist/server/collections/blockTemplates.d.ts +10 -0
- package/dist/server/collections/blockTemplates.js +91 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +42 -0
- package/dist/server/middlewares/templateData.d.ts +17 -0
- package/dist/server/middlewares/templateData.js +122 -0
- package/dist/server/plugin.d.ts +18 -0
- package/dist/server/plugin.js +59 -0
- package/dist/server/utils/index.d.ts +1 -0
- package/dist/server/utils/index.js +30 -0
- package/dist/server/utils/template.d.ts +13 -0
- package/dist/server/utils/template.js +392 -0
- package/package.json +23 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("react-router"),require("@nocobase/utils/client"),require("lodash"),require("@formily/core"),require("ahooks"),require("antd"),require("@formily/json-schema"),require("react-router-dom"),require("@nocobase/plugin-mobile/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-template",["@nocobase/client","@ant-design/icons","@formily/react","react","react-router","@nocobase/utils/client","lodash","@formily/core","ahooks","antd","@formily/json-schema","react-router-dom","@nocobase/plugin-mobile/client"],t):"object"==typeof exports?exports["@nocobase/plugin-block-template"]=t(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("react-router"),require("@nocobase/utils/client"),require("lodash"),require("@formily/core"),require("ahooks"),require("antd"),require("@formily/json-schema"),require("react-router-dom"),require("@nocobase/plugin-mobile/client")):e["@nocobase/plugin-block-template"]=t(e["@nocobase/client"],e["@ant-design/icons"],e["@formily/react"],e.react,e["react-router"],e["@nocobase/utils/client"],e.lodash,e["@formily/core"],e.ahooks,e.antd,e["@formily/json-schema"],e["react-router-dom"],e["@nocobase/plugin-mobile/client"])}(self,function(e,t,r,n,o,i,a,l,c,u,s,p,f){return function(){"use strict";var d={482:function(e){e.exports=t},563:function(e){e.exports=l},625:function(e){e.exports=s},505:function(e){e.exports=r},772:function(t){t.exports=e},58:function(e){e.exports=f},584:function(e){e.exports=i},749:function(e){e.exports=c},721:function(e){e.exports=u},467:function(e){e.exports=a},156:function(e){e.exports=n},432:function(e){e.exports=o},128:function(e){e.exports=p}},m={};function v(e){var t=m[e];if(void 0!==t)return t.exports;var r=m[e]={exports:{}};return d[e](r,r.exports,v),r.exports}v.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return v.d(t,{a:t}),t},v.d=function(e,t){for(var r in t)v.o(t,r)&&!v.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},v.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var y={};v.r(y),v.d(y,{PluginBlockTemplateClient:function(){return tt},default:function(){return tr}});var b=v("772"),h=v("156"),x=v.n(h),g=v("482"),S=v("721"),k=v("467"),w=v.n(k),O=v("584"),P=JSON.parse('{"u2":"@nocobase/plugin-block-template"}');function j(){var e=(0,b.useApp)();return function(t){return e.i18n.t(t,{ns:[P.u2,"client"]})}}function C(e){return"{{t(".concat(JSON.stringify(e),", { ns: ['").concat(P.u2,"', 'client'], nsMode: 'fallback' })}}")}var A=v("58"),E=v.n(A),T=function(e){if(!e)return null;if(["Grid","Grid.Row","Grid.Col"].includes(e["x-component"])){var t=null,r=!0,n=!1,o=void 0;try{for(var i,a=Object.values(e.properties||{})[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var l=i.value;if(t=T(l))break}}catch(e){n=!0,o=e}finally{try{!r&&null!=a.return&&a.return()}finally{if(n)throw o}}return t}return e},D=v("749"),F=v("128");function I(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function B(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){I(i,n,o,a,l,"next",e)}function l(e){I(i,n,o,a,l,"throw",e)}a(void 0)})}}function R(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}var M=(0,h.createContext)({loading:!1,templates:[],handleTemplateClick:B(function(){return R(this,function(e){return[2]})})}),q=function(e){var t,r=e.children,n=(0,b.useAPIClient)(),o=(0,b.usePlugin)(tr),i=(0,b.usePlugin)(E()),a=(0,b.useResource)("blockTemplates"),l=j(),c=window.location.pathname.startsWith(i.mobileBasename),u=(0,F.useLocation)(),s=x().useRef(u.pathname),p=(0,b.useCurrentUserContext)(),f=(0,b.useRequest)({url:"blockTemplates:list",method:"get",params:{filter:{configured:!0,type:c?"Mobile":{$ne:"Mobile"}},paginate:!1}},{cacheKey:"blockTemplates",manual:!0}),d=f.data,m=f.loading,v=f.refresh;(0,h.useEffect)(function(){s.current.includes("/settings/block-templates")&&!u.pathname.includes("/settings/block-templates")&&v(),s.current=u.pathname},[u.pathname,v]),(0,h.useEffect)(function(){(null==p?void 0:p.data)&&v()},[p,v]);var y=(0,D.useMemoizedFn)((t=B(function(e,t,r){var i,l,c,u,s,p,f,d,m,v,y,b,h,x,g,S,w,O,P,j;return R(this,function(C){switch(C.label){case 0:return c=(i=e.item).uid,[4,n.request({url:"uiSchemas:getProperties/".concat(c)})];case 1:p=function(e,t,r){var n=null==e?void 0:e.properties;n=k.get(Object.values(n),"0.properties");var o=[];for(var i in n){var a=_(n[i],!1,!0,void 0,t,r);a&&o.push(T(a))}return o}(s=null==(u=C.sent().data)?void 0:u.data,i.key,t),o.setTemplateCache(T(null===(l=s.properties)||void 0===l?void 0:l.blocks)),function(e){var t={},r=!0,n=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var l=i.value;k.merge(t,function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t["x-template-uid"]&&(r[t["x-template-uid"]]=t["x-uid"]),t.properties)for(var n in t.properties)e(t.properties[n],r);return r}(l))}}catch(e){n=!0,o=e}finally{try{!r&&null!=a.return&&a.return()}finally{if(n)throw o}}var c=!0,u=!1,s=void 0;try{for(var p,f=e[Symbol.iterator]();!(c=(p=f.next()).done);c=!0){var d=p.value;!function e(t,r){var n,o=["x-uid","x-template-uid","x-template-root-uid","x-custom-request-id"];for(var i in t)if(!o.includes(i)){;if(t[i]&&"string"==typeof t[i]&&(t[i]=r[t[i]]||t[i]),t[i]&&"object"==((n=t[i])&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n))e(t[i],r)}}(d,t)}}catch(e){u=!0,s=e}finally{try{!c&&null!=f.return&&f.return()}finally{if(u)throw s}}}(p),f=!0,d=!1,m=void 0;try{for(v=p[Symbol.iterator]();!(f=(y=v.next()).done);f=!0)b=y.value,null==r||r(b)}catch(e){d=!0,m=e}finally{try{!f&&null!=v.return&&v.return()}finally{if(d)throw m}}h=[],x=function(e){if(e["x-template-root-uid"]&&h.push({templateKey:i.key,templateBlockUid:e["x-template-root-uid"],blockUid:e["x-uid"]}),e.properties)for(var t in e.properties)x(e.properties[t])},g=!0,S=!1,w=void 0;try{for(O=p[Symbol.iterator]();!(g=(P=O.next()).done);g=!0)j=P.value,x(j)}catch(e){S=!0,w=e}finally{try{!g&&null!=O.return&&O.return()}finally{if(S)throw w}}return a.link({values:h}),[2]}})}),function(e,r,n){return t.apply(this,arguments)}));return(0,h.useEffect)(function(){var e;null==d||null===(e=d.data)||void 0===e||e.forEach(function(e){o.templateInfos.set(e.key,e)})},[null==d?void 0:d.data,o.templateInfos]),(0,h.useEffect)(function(){(0,b.registerInitializerMenusGenerator)("block_template",function(e){var t,r,n,i=e.collection,a=e.association,c=e.item,u=(e.index,e.field),s=e.componentName,p=e.dataSource,f=(e.keyPrefix,e.name),m=(null==i?void 0:i.name)||(null==c?void 0:null===(t=c.options)||void 0===t?void 0:t.name),v=p||(null==c?void 0:null===(r=c.options)||void 0===r?void 0:r.dataSource)||(null==i?void 0:i.dataSource),b=window.location.pathname.includes("/admin/workflow");if((null==s?void 0:s.startsWith("mobile-"))&&(s=s.replace("mobile-","")),o.isInBlockTemplateConfigPage()||b)return null;u&&(m=null==u?void 0:u.target);var h="details"===f||"ReadPrettyFormItem"===s,x=null==d?void 0:null===(n=d.data)||void 0===n?void 0:n.filter(function(e){return(e.componentType===s||f===e.menuName||h&&"details"===e.menuName)&&e.collection===m&&e.dataSource===v}).map(function(e){return{type:"item",name:e.key,item:e,title:e.title,schemaInsertor:function(e,t){var r=t.item,n=(t.fromOthersInPopup,t.name),o={dataSourceName:v};return a&&("editForm"===n||"currentRecord"===n)&&(o.association=a),u?(o.association="".concat(null==i?void 0:i.name,".").concat(u.name),o.associationType=u.type):o.collectionName=m,o.currentRecord="currentRecord"===n&&h,"editForm"===n&&(o.currentRecord=!0),y(r,o,e)}}});return(null==x?void 0:x.length)?[{type:"divider"},{type:"itemGroup",title:l("Block template"),children:x}]:null})},[null==d?void 0:d.data,o.isInBlockTemplateConfigPage,y,l,o]),x().createElement(M.Provider,{value:{loading:m,templates:(null==d?void 0:d.data)||[],handleTemplateClick:y}},r)};function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}q.displayName="BlockTemplateMenusProvider";function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,o,i;n=e,o=t,i=r[t],o in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i})}return e}function G(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw n}}return i}}(e,t)||V(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 V(e,t){if(e){if("string"==typeof e)return N(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return N(e,t)}}function _(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,i=arguments.length>5?arguments[5]:void 0;if(!n&&(n=(0,O.uid)()),"Grid"===e["x-component"]||"Grid.Row"===e["x-component"]||"Grid.Col"===e["x-component"]){var a,l,c=k.cloneDeep((a=z({},e),l=(l={"x-uid":(0,O.uid)(),properties:{}},l),Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(l)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(l,e))}),a));for(var u in t&&(c["x-virtual"]=!0),"TemplateGridDecorator"===c["x-decorator"]&&delete c["x-decorator"],e.properties){var s=_(e.properties[u],t,r,n,o,i);r&&(n=(0,O.uid)()),s&&(c.properties[u]=s)}return c}var p={"x-uid":"".concat(n,"-").concat(e["x-uid"]),"x-template-uid":e["x-uid"],properties:{}};for(var f in t&&(p["x-virtual"]=!0),e["x-settings"]&&(p["x-settings"]=e["x-settings"]),r&&(p["x-template-root-uid"]=e["x-uid"],p["x-uid"]=n,p["x-template-version"]="1.0"),U.forEach(function(t){k.hasIn(e,t)&&k.set(p,t,k.get(e,t))}),o&&(p["x-block-template-key"]=o),"CustomRequestAction"===e["x-component"]&&(p["x-custom-request-id"]=e["x-custom-request-id"]||e["x-uid"]),"Action"===e["x-component"]&&k.get(e,"x-action-settings.schemaUid")&&(p["x-action-settings"]={schemaUid:""}),!e["x-component"]&&(p["x-no-component"]=!0),k.get(e,"x-filter-targets")&&(p["x-filter-targets"]=e["x-filter-targets"]),e.properties)p.properties[f]=_(e.properties[f],t,!1,n,o);return r&&i&&function(e,t){var r,n,o,i,a,l,c,u=t.collectionName,s=t.dataSourceName,p=t.association,f=e["x-decorator"];if("DetailsBlockProvider"===f){;r=e,o=(n=t).collectionName,i=n.dataSourceName,a=n.association,l=n.currentRecord,c=n.associationType,r["x-decorator-props"]={action:"list",collection:a?null:o,association:a,dataSource:i,readPretty:!0,params:{pageSize:1}},r["x-acl-action"]="".concat(a||o,":view"),r["x-settings"]="blockSettings:detailsWithPagination",r["x-use-decorator-props"]="useDetailsWithPaginationDecoratorProps",(l||"hasOne"===c||"belongsTo"===c)&&(r["x-acl-action"]="".concat(a||o,":get"),r["x-decorator-props"].action="get",r["x-settings"]="blockSettings:details",r["x-use-decorator-props"]="useDetailsDecoratorProps"),l&&(r["x-is-current"]=!0)}else"FormBlockProvider"===f?K(e,t):f&&(e["x-decorator-props"]={action:"list",collection:u,association:p,dataSource:s});!function(e){var t;if(e.properties&&(null===(t=e["x-decorator-props"])||void 0===t?void 0:t.association)){var r=function(e,t){var n=e["x-decorator"];if(("DetailsBlockProvider"===n||"FormBlockProvider"===n)&&!(null===(o=e["x-decorator-props"])||void 0===o?void 0:o.association)&&t){var o,i,a=e["x-settings"];("blockSettings:editForm"===a||"blockSettings:details"===a)&&(e["x-decorator-props"].association=t,e["x-is-current"]=!0,e["x-acl-action"]="".concat(t,":").concat(null===(i=e["x-acl-action"])||void 0===i?void 0:i.split(":")[1]))}var l=e["x-decorator-props"];if(!l||!l.collection||!!l.association){var c=(null==l?void 0:l.association)||t;e.properties&&Object.values(e.properties).forEach(function(e){r(e,c)})}};Object.values(e.properties).forEach(function(t){var n;r(t,null===(n=e["x-decorator-props"])||void 0===n?void 0:n.association)})}}(e)}(p,i),p}var U=["x-decorator","x-decorator-props.collection","x-decorator-props.association","x-decorator-props.dataSource","x-decorator-props.action","x-decorator-props.params","x-acl-action","x-settings","x-use-decorator-props","x-is-current"];function K(e,t){var r=t.collectionName,n=t.dataSourceName,o=t.association;if(t.currentRecord){e["x-decorator-props"]={action:"get",collection:r,association:o,dataSource:n},e["x-data-templates"]={display:!1},e["x-acl-action"]="".concat(o||r,":update"),e["x-settings"]="blockSettings:editForm",e["x-use-decorator-props"]="useEditFormBlockDecoratorProps",e["x-is-current"]=!0;var i=Object.keys(e.properties)[0];if(i){var a=Object.keys(e.properties[i].properties).find(function(e){return"grid"!==e});if(a){k.set(e,"properties.".concat(i,".x-use-component-props"),"useEditFormBlockProps"),k.set(e,"properties.".concat(i,".properties.").concat(a,".x-initializer"),"editForm:configureActions");var l,c=k.get(e,"properties.".concat(i,".properties.").concat(a,".properties"),{});for(var u in c)(null===(l=c[u]["x-settings"])||void 0===l?void 0:l.includes("createSubmit"))&&(c[u]["x-settings"]="actionSettings:updateSubmit","useStepsFormSubmitActionProps"!==c[u]["x-use-component-props"]&&(c[u]["x-use-component-props"]="useUpdateActionProps"))}}}else e["x-decorator-props"]={collection:r,association:o,dataSource:n}}var L=function(e){var t=e.value,r=e.onChange,n=G((0,h.useState)(t),2),o=n[0],i=n[1],a=(0,h.useRef)(""),l=(0,h.useRef)(!1),c=j();(0,h.useEffect)(function(){i(t)},[t]),(0,h.useEffect)(function(){var e,t=function(){a.current&&a.current.focus()},r=new IntersectionObserver(function(e){e.some(function(e){return e.isIntersecting})&&t()});return(null===(e=a.current)||void 0===e?void 0:e.input)&&r.observe(a.current.input),function(){r.disconnect()}},[]);var u=function(e){!l.current&&(r(e.target.value),i(e.target.value))},s=function(e){"compositionend"===e.type?(l.current=!1,u(e)):l.current=!0};return x().createElement("div",{onClick:function(e){return e.stopPropagation()}},x().createElement(S.Input,{ref:a,allowClear:!0,style:{padding:"4px 8px",boxShadow:"none",borderRadius:0},bordered:!1,placeholder:c("Search and select template"),value:o,onClick:function(e){e.stopPropagation()},onChange:u,onCompositionStart:s,onCompositionEnd:s,onCompositionUpdate:s}),x().createElement(S.Divider,{style:{margin:0}}))},J={name:"templates",Component:function(){var e,t=(0,b.useSchemaInitializer)().insert,r=(0,b.usePlugin)(tr),n=G((0,h.useState)(""),2),o=n[0],i=n[1],a=j(),l=(0,h.useContext)(M),c=l.templates,u=l.handleTemplateClick,s=l.loading,p=null==c?void 0:c.filter(function(e){return!e.dataSource}).filter(function(e){return!o||e.title.toLowerCase().includes(o.toLowerCase())});var f=[{key:"search",label:x().createElement(L,{value:o,onChange:function(e){i(e)}}),onClick:function(e){e.domEvent.stopPropagation()}}].concat(function(e){if(Array.isArray(e))return N(e)}(e=(null==p?void 0:p.length)?p.map(function(e){return z({label:e.title},e)}):[{key:"empty",style:{height:150},label:x().createElement("div",{onClick:function(e){return e.stopPropagation()}},x().createElement(S.Empty,{image:S.Empty.PRESENTED_IMAGE_SIMPLE,description:a("No data")}))}])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||V(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.")}());(0,h.useEffect)(function(){null==c||c.forEach(function(e){r.templateInfos.set(e.key,e)})},[c,r.templateInfos]);var d=(0,D.useMemoizedFn)(function(e){u(e,{},t)});return s?x().createElement("div",null,x().createElement(g.LoadingOutlined,null)," ",a("Templates")):x().createElement(b.SchemaInitializerItem,{closeInitializerMenuWhenClick:!0,title:'{{t("Block template")}}',icon:x().createElement(g.CopyOutlined,{style:{marginRight:0}}),items:f,name:"templates",onClick:d})},title:'{{t("Block template")}}',icon:"TableOutlined",wrap:function(e){return e},useVisible:function(){return!1}},W="block-template",$={type:"object","x-component":"Action",title:'{{t("Add new", { ns: "'.concat(W,'" })}}'),"x-align":"right","x-component-props":{type:"primary",icon:"PlusOutlined",openMode:"drawer"},properties:{drawer:{type:"void","x-component":"Action.Drawer",title:'{{t("Add new", { ns: "'.concat(W,'" })}}'),"x-decorator":"FormV2","x-use-decorator-props":function(){return{form:(0,h.useContext)(Y)}},properties:{form:{type:"void",properties:{title:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"},key:{type:"string","x-decorator":"FormItem","x-component":"CollectionField","x-validator":"uid",description:"{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"},type:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"},description:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"}}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{submit:{title:"Submit","x-component":"Action","x-use-component-props":"useCreateActionProps"}}}}}}},H=v("563");function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Q(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.")}()}var Y=(0,h.createContext)(null),Z={name:"blockTemplates",filterTargetKey:"key",fields:[{type:"string",name:"title",interface:"input",uiSchema:{type:"string",title:"{{t('Title')}}",required:!0,"x-component":"Input"}},{type:"string",name:"key",interface:"input",uiSchema:{type:"string",title:"{{t('Name')}}",required:!0,"x-component":"Input"}},{type:"string",name:"type",interface:"radioGroup",uiSchema:{type:"string",title:C("Type"),"x-component":"Radio.Group",enum:"{{ typeOptions }}"}},{type:"string",name:"description",interface:"textarea",uiSchema:{type:"string",title:"{{t('Description')}}","x-component":"Input.TextArea"}}]},ee={type:"void",title:C("Edit"),"x-component":"Action.Link","x-component-props":{openMode:"drawer",icon:"EditOutlined"},properties:{drawer:{type:"void",title:C("Edit"),"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useEditFormProps",properties:{form:{type:"void",properties:{title:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"},key:{type:"string","x-decorator":"FormItem","x-component":"CollectionField","x-disabled":!0},type:{type:"string","x-decorator":"FormItem","x-component":"CollectionField","x-disabled":!0},description:{type:"string","x-decorator":"FormItem","x-component":"CollectionField"}}},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{submit:{title:C("Submit"),"x-component":"Action","x-use-component-props":"useEditActionProps"}}}}}}},et={name:"bulkDestroySchema",type:"void","x-component":"Action","x-component-props":{openSize:"small",icon:"DeleteOutlined"},title:'{{t("Delete")}}',properties:{modal:{type:"void","x-component":"Action.Modal","x-decorator":"FormV2","x-use-decorator-props":function(){return{form:(0,h.useMemo)(function(){return(0,H.createForm)()},[])}},title:'{{t("Delete")}}',properties:{keepBlocks:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":C("Keep the created blocks?"),default:!0},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useBulkDestroyAction }}"}}}}}}}},er={type:"void",name:(0,O.uid)(),"x-component":"CardItem","x-decorator":"TableBlockProvider","x-decorator-props":{collection:Z.name,action:"list",params:{sort:"-createdAt"},showIndex:!0,dragSort:!1,rowKey:"key"},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:20}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"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"}},bulkDestroySchema:et,addNew:{type:"void","x-component":function(){var e=X((0,h.useState)(!1),2),t=e[0],r=e[1],n=X((0,h.useState)(null),2),o=n[0],i=n[1],a=j();return x().createElement(b.ActionContextProvider,{value:{visible:t,setVisible:r}},x().createElement(S.Button,{icon:x().createElement(g.PlusOutlined,null),type:"primary",onClick:function(){i((0,H.createForm)({initialValues:{key:"t_".concat((0,O.uid)()),type:"Desktop"}})),r(!0)}},a("Add new")),x().createElement(Y.Provider,{value:o},x().createElement(b.SchemaComponent,{schema:$})))}}}},table:{type:"array","x-component":"TableV2","x-use-component-props":"useTableBlockProps","x-component-props":{rowKey:Z.filterTargetKey,rowSelection:{type:"checkbox"}},properties:{title:{type:"void",title:'{{ t("Title") }}',"x-component":"TableV2.Column","x-component-props":{width:150},properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},key:{type:"void",title:'{{ t("Name") }}',"x-component":"TableV2.Column","x-component-props":{width:80},properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},type:{type:"void",title:C("Type"),"x-component":"TableV2.Column","x-component-props":{width:80},properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},description:{type:"void",title:'{{ t("Description") }}',"x-component":"TableV2.Column",properties:{description:{type:"string","x-component":"CollectionField","x-read-pretty":!0,"x-component-props":{ellipsis:!0}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"TableV2.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void",title:C("Configure"),"x-component":function(){var e=(0,b.useFilterByTk)(),t=(0,b.useCollectionRecordData)(),r=j(),n="/admin/settings/block-templates/".concat(e);return"Mobile"===t.type&&(n="/m/block-templates/".concat(t.key,"/").concat(t.uid)),x().createElement(F.Link,{to:n},r("Configure"))}},editActionSchema:ee,duplicate:{type:"void",title:'{{t("Duplicate", { ns: "'.concat(W,'" })}}'),"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:'{{t("Duplicate to new template", { ns: "'.concat(W,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input",required:!0},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useDuplicateAction }}"}}}}}}}},delete:{type:"void",title:C("Delete"),"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:'{{t("Delete", { ns: "'.concat(W,'" })}}'),"x-decorator":"FormV2","x-component":"Action.Modal","x-component-props":{openSize:"small"},properties:{keepBlocks:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox",default:!0,"x-content":C("Keep the created blocks?")},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useDeleteAction }}"}}}}}}}}}}}}}}}},en=v("505");function eo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ei(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var ea=function(e){if(!e)return null;if("CustomRequestAction"===e["x-component"]&&(e["x-custom-request-id"]=e["x-custom-request-id"]||e["x-uid"]),e["x-uid"]=(0,O.uid)(),e.properties){var t=!0,r=!1,n=void 0;try{for(var o,i=Object.keys(e.properties)[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){var a=o.value;ea(e.properties[a])}}catch(e){r=!0,n=e}finally{try{!t&&null!=i.return&&i.return()}finally{if(r)throw n}}}return e};function el(){var e,t,r=S.App.useApp().message,n=(0,b.useAPIClient)(),o=(0,b.useCollectionRecordData)(),i=(0,b.useDataBlockResource)(),a=(0,b.useBlockRequestContext)().service,l=(0,b.useCollection)(),c=(0,en.useForm)(),u=(0,b.useActionContext)().setVisible;var s=(e=(0,h.useState)(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw n}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return eo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eo(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.")}()),p=s[0],f=s[1];return{run:function(){var e;return(e=function(){var e,t,s,d,m,v;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(y){switch(y.label){case 0:if(p)return[2];return[4,c.submit()];case 1:if(y.sent(),f(!0),e=c.values,!l)throw Error("collection does not exist");return t=o.uid,[4,n.request({url:"uiSchemas:getJsonSchema/".concat(t)})];case 2:return s=y.sent().data,m=(d=ea(w().cloneDeep(null==s?void 0:s.data)))["x-uid"],v="t_".concat((0,O.uid)()),[4,n.resource("uiSchemas").insert({values:{type:"void",name:v,"x-uid":"template-".concat(m),_isJSONSchemaObject:!0,properties:{template:d}}})];case 3:var b,h;return y.sent(),[4,i.create({values:(b=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,o,i;n=e,o=t,i=r[t],o in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i})}return e}({},o),h=null!=(h={title:"".concat(e.title),key:v,uid:m})?h:{},Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(h)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(h)).forEach(function(e){Object.defineProperty(b,e,Object.getOwnPropertyDescriptor(h,e))}),b)})];case 4:return y.sent(),[4,a.refresh()];case 5:return y.sent(),u(!1),f(!1),[4,c.reset()];case 6:return y.sent(),r.success("Duplicated!"),[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){ei(i,n,o,a,l,"next",e)}function l(e){ei(i,n,o,a,l,"throw",e)}a(void 0)})})()}}}function ec(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function eu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,o,i;n=e,o=t,i=r[t],o in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i})}return e}function es(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var ep=function(){var e=(0,b.useActionContext)().setVisible,t=S.App.useApp().message,r=(0,en.useForm)(),n=(0,b.useDataBlockResource)(),o=(0,b.useAPIClient)(),i=(0,b.useDataBlockRequest)().refresh,a=j();return{type:"primary",onClick:function(){var l;return(l=function(){var l,c,u,s,p;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(f){switch(f.label){case 0:return[4,r.submit()];case 1:return f.sent(),c=(l=r.values).key,u=(0,O.uid)(),s="Mobile"===l.type,p={type:"void",name:c,"x-uid":"template-".concat(u),_isJSONSchemaObject:!0,properties:{template:es(eu({_isJSONSchemaObject:!0,version:"2.0",type:"void","x-component":"div"},s?{"x-component-props":{style:{padding:"10px",maxHeight:"100%",overflow:"scroll"}}}:{}),{properties:{blocks:{_isJSONSchemaObject:!0,version:"2.0",type:"void","x-decorator":"TemplateGridDecorator","x-component":"Grid","x-initializer":s?"mobile:addBlock":"page:addBlock","x-uid":(0,O.uid)(),"x-async":!1,"x-index":1,properties:{}}},"x-uid":u,"x-async":!0,"x-index":1})}},[4,n.create({values:es(eu({},l),{uid:u})})];case 2:return f.sent(),[4,o.resource("uiSchemas").insert({values:p})];case 3:return f.sent(),r.reset(),i(),t.success(a("Saved successfully")),e(!1),r.values.key="t_".concat((0,O.uid)()),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,n){var o=l.apply(e,t);function i(e){ec(o,r,n,i,a,"next",e)}function a(e){ec(o,r,n,i,a,"throw",e)}i(void 0)})})()}}};function ef(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var ed=function(){var e=(0,b.useActionContext)().setVisible,t=S.App.useApp().message,r=(0,en.useForm)(),n=(0,b.useDataBlockResource)(),o=(0,b.useCollection)(),i=(0,b.usePlugin)(tt),a=j(),l=(0,b.useDataBlockRequest)().refresh;return{type:"primary",onClick:function(){var c;return(c=function(){var c;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(u){switch(u.label){case 0:return[4,r.submit()];case 1:return u.sent(),c=r.values,[4,n.update({values:c,filterByTk:c[o.filterTargetKey]})];case 2:return u.sent(),l(),t.success(a("Saved successfully")),i.templateInfos.set(c[o.filterTargetKey],c),e(!1),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,n){var o=c.apply(e,t);function i(e){ef(o,r,n,i,a,"next",e)}function a(e){ef(o,r,n,i,a,"throw",e)}i(void 0)})})()}}};function em(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function ev(){var e=S.App.useApp().message,t=(0,b.useCollectionRecordData)(),r=(0,b.useDataBlockResource)(),n=(0,b.useDataBlockRequest)(),o=n.data,i=n.refresh,a=n.run,l=(0,b.useCollection)(),c=j(),u=(0,en.useForm)();return{run:function(){var n;return(n=function(){var n,s,p,f,d,m,v;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(y){switch(y.label){case 0:if(!l)throw Error("collection does not exist");return[4,u.submit()];case 1:return y.sent(),f=u.values.keepBlocks,[4,r.destroy({filterByTk:t[l.filterTargetKey],removeSchema:!f})];case 2:return y.sent(),d=(null==o?void 0:null===(n=o.meta)||void 0===n?void 0:n.page)||1,m=(null==o?void 0:null===(s=o.meta)||void 0===s?void 0:s.pageSize)||20,d>(v=Math.max(Math.ceil((((null==o?void 0:null===(p=o.meta)||void 0===p?void 0:p.count)||0)-1)/m),1))?a({page:v,pageSize:m}):i(),e.success(c("Deleted successfully")),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){em(i,r,o,a,l,"next",e)}function l(e){em(i,r,o,a,l,"throw",e)}a(void 0)})})()}}}var ey=function(){var e=(0,b.useCollectionRecordData)();return{form:(0,h.useMemo)(function(){return(0,H.createForm)({initialValues:e})},[e])}};function eb(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var eh=function(){var e=(0,b.useAPIClient)(),t=(0,b.useActionContext)().setVisible,r=(0,b.useDataBlockRequest)(),n=r.data,o=r.refresh,i=r.run,a=(0,en.useField)(),l=j(),c=(0,en.useForm)(),u=S.App.useApp().message,s=(0,b.useTableBlockProps)().onRowSelectionChange;return{run:function(){var r;return(r=function(){var r,p,f,d,m,v,y,b;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(h){switch(h.label){case 0:if(!(null==(m=null===(r=a.data)||void 0===r?void 0:r.selectedRowKeys)?void 0:m.length))return u.error(l("Please select the records you want to delete")),[2];return[4,e.request({method:"POST",url:"/blockTemplates:destroy",params:{filterByTk:m,removeSchema:!c.values.keepBlocks}})];case 1:return h.sent(),s([],[]),c.reset(),v=(null==n?void 0:null===(p=n.meta)||void 0===p?void 0:p.page)||1,y=(null==n?void 0:null===(f=n.meta)||void 0===f?void 0:f.pageSize)||20,v>(b=Math.max(Math.ceil((((null==n?void 0:null===(d=n.meta)||void 0===d?void 0:d.count)||0)-m.length)/y),1))?i({page:b,pageSize:y}):o(),t(!1),u.success(l("Deleted successfully")),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){eb(i,n,o,a,l,"next",e)}function l(e){eb(i,n,o,a,l,"throw",e)}a(void 0)})})()}}},ex=function(){var e,t,r=(0,b.useSchemaComponentContext)(),n=j(),o=[{label:n("Desktop"),value:"Desktop"},{label:n("Mobile"),value:"Mobile"}];return x().createElement(b.ExtendCollectionsProvider,{collections:[Z]},x().createElement(b.SchemaComponentContext.Provider,{value:(e=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,o,i;n=e,o=t,i=r[t],o in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i})}return e}({},r),t=(t={designable:!1},t),Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e)},x().createElement(b.SchemaComponent,{schema:er,scope:{useCreateActionProps:ep,useEditActionProps:ed,useEditFormProps:ey,useDeleteAction:ev,useDuplicateAction:el,useBulkDestroyAction:eh,typeOptions:o}})))},eg=v("432"),eS=(0,h.createContext)({}),ek=function(){var e,t=(0,eg.useParams)(),r=S.theme.useToken().token,n=j(),o=(0,b.useRequest)({url:"blockTemplates:get/".concat(t.key)}),i=o.data,a=o.loading,l=((null==i?void 0:i.data)||{}).title;if(a)return x().createElement(S.Spin,null);var c=null==i?void 0:null===(e=i.data)||void 0===e?void 0:e.uid;return x().createElement("div",null,x().createElement("div",{style:{margin:-r.margin,padding:r.paddingSM,background:r.colorBgContainer,display:"flex",alignItems:"center",justifyContent:"space-between"}},x().createElement(S.Breadcrumb,{items:[{title:x().createElement(F.Link,{to:"/admin/settings/block-templates"},n("Block template"))},{title:l}]})),x().createElement("div",{style:{marginTop:r.marginXL,position:"relative",zIndex:0}},x().createElement(eS.Provider,{value:null==i?void 0:i.data},x().createElement(b.RemoteSchemaComponent,{uid:c}))))},ew=function(){var e=(0,F.useParams)().key,t=(0,b.useRequest)({url:"blockTemplates:get/".concat(e)}),r=t.data,n=t.loading;return((0,h.useEffect)(function(){var e,t=document.querySelector(".ant-nb-mobile-tab-bar"),r=null==t?void 0:null===(e=t.style)||void 0===e?void 0:e.display;return t&&(t.style.display="none"),function(){var e=document.querySelector(".ant-nb-mobile-tab-bar");e&&(e.style.display=r)}},[]),n)?x().createElement(S.Spin,null):x().createElement(eS.Provider,{value:null==r?void 0:r.data},x().createElement(A.MobilePage,null))},eO=v("625");function eP(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ej(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,o,i;n=e,o=t,i=r[t],o in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i})}return e}function eC(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){l=!0,n=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw n}}return i}}(e,t)||eE(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 eA(e){return function(e){if(Array.isArray(e))return eP(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||eE(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 eE(e,t){if(e){if("string"==typeof e)return eP(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return eP(e,t)}}function eT(e,t){if(!e)return null;if(e["x-uid"]===t)return e;if(e.properties)for(var r in e.properties){var n=eT(e.properties[r],t);if(n)return n}return null}function eD(e,t){var r=function(e,t){if(e["x-uid"]===t)return!0;for(var n in e.properties)if(r(e.properties[n],t))return!0;return!1};for(var n in e)if(r(e[n],t))return e[n];return null}function eF(e,t,r){if(!e)return null;if(e["x-uid"]===t&&e["x-virtual"])return{schema:e,insertTarget:null,insertPosition:"afterBegin"};for(var n=Object.values(e.properties||{}).sort(function(e,t){return e["x-index"]-t["x-index"]}),o=0;o<n.length;o++){var i=n[o],a=eF(i,t,r);if(a){var l=a.insertPosition,c=a.insertTarget;if(!e["x-virtual"]&&i["x-virtual"]){var u=function(e,t){for(var n=t+1;n<e.length;n++)if(!e[n]["x-virtual"]&&e[n]["x-uid"]!==(null==r?void 0:r["x-uid"]))return e[n]["x-uid"];return null}(n,o);u?(l="beforeBegin",c=u):(l="beforeEnd",c=e["x-uid"])}return{schema:e["x-virtual"]?e:a.schema,insertTarget:c,insertPosition:l}}}return null}function eI(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=function(e){if(t.includes(e["x-uid"]))return null;var n={type:e.type,name:e.name,"x-uid":e["x-uid"],"x-template-uid":e["x-template-uid"],"x-template-root-uid":e["x-template-root-uid"]};if(!e["x-template-uid"]&&(n=ej({},k.omit(e,["properties"]))),delete n["x-virtual"],e.properties)for(var o in n.properties={},e.properties){var i=r(e.properties[o]);i&&(n.properties[o]=i)}return n};return new eO.Schema(r(e)).toJSON()}function eB(e){if((e["x-toolbar"]||e["x-designer"])&&e["x-template-uid"]){var t,r="".concat((null===(t=e["x-toolbar-props"])||void 0===t?void 0:t.toolbarClassName)||"");k.merge(e,{"x-toolbar-props":{toolbarClassName:"".concat(r.includes("nb-in-template")?r:"".concat(r," nb-in-template"))}})}if(e.properties)for(var n in e.properties)eB(e.properties[n])}function eR(e,t,r){if(e["x-block-template-key"]){var n;e["x-template-title"]=null===(n=t.get(e["x-block-template-key"]))||void 0===n?void 0:n.title}if(r.has(e["x-uid"])&&(delete e["x-virtual"],r.delete(e["x-uid"])),e.properties)for(var o in e.properties)eR(e.properties[o],t,r)}var eM=["Grid","Grid.Row","Grid.Col"];function eq(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3?arguments[3]:void 0,o=e.properties||{},i=e["x-component"];eM.includes(i)&&(r=eA(r).concat([{schema:e,type:i,key:n||""}]));var a=!0,l=!1,c=void 0;try{for(var u,s=Object.entries(o)[Symbol.iterator]();!(a=(u=s.next()).done);a=!0){var p=eC(u.value,2),f=p[0],d=p[1];if(d){var m=d["x-component"];eM.includes(m)?eq(d,t,r,f):d["x-uid"]&&t.set(d["x-uid"],{schema:d,path:r,key:f})}}}catch(e){l=!0,c=e}finally{try{!a&&null!=s.return&&s.return()}finally{if(l)throw c}}}function eN(e){var t={properties:{}},r=!0,n=!1,o=void 0;try{for(var i,a=e.entries()[Symbol.iterator]();!(r=(i=a.next()).done);r=!0){var l=eC(i.value,2),c=(l[0],l[1]),u=t,s=!0,p=!1,f=void 0;try{for(var d,m=c.path.slice(1)[Symbol.iterator]();!(s=(d=m.next()).done);s=!0){var v=d.value;!u.properties&&(u.properties={}),!u.properties[v.key]&&(u.properties[v.key]=function(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}(ej({},v.schema),{properties:{}})),u=u.properties[v.key]}}catch(e){p=!0,f=e}finally{try{!s&&null!=m.return&&m.return()}finally{if(p)throw f}}u.properties=u.properties||{},u.properties[c.key]=c.schema}}catch(e){n=!0,o=e}finally{try{!r&&null!=a.return&&a.return()}finally{if(n)throw o}}return t.properties}function ez(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Set,o=e["x-uid"],i=e["x-template-root-uid"],a=e["x-block-template-key"],l=e;if(i)l=function e(t,r,n,o,i,a){return t.properties&&!r.properties&&(r.properties={}),k.mergeWith(t,r,function(r,l,c,u,s){if(null==l)return r;if("default"===c&&"actionSettings:filter"===u["x-settings"])return l||r;if(k.isObject(l)){if(k.isArray(l))return l||r;if("properties"===c){var p=Object.keys(l),f=Object.keys(r||{});if(eM.includes(s["x-component"])&&eM.includes(u["x-component"])){var d=new Map,m=new Map;eq(u,d),eq(s,m);var v=!0,y=!1,b=void 0;try{for(var h,x=m.entries()[Symbol.iterator]();!(v=(h=x.next()).done);v=!0){var g=eC(h.value,2),S=(g[0],g[1]);if(S.schema["x-template-uid"]){var w=d.get(S.schema["x-template-uid"]);if(w){var O=e(w.schema||{},S.schema,S.schema["x-template-root-uid"]||n,o,i,a);S.path[S.path.length-1].schema.properties[S.key]=O,S.schema=O,d.delete(S.schema["x-template-uid"])}}}}catch(e){y=!0,b=e}finally{try{!v&&null!=x.return&&x.return()}finally{if(y)throw b}}r=eN(d),u.properties=r,f=Object.keys(r)}if("CollectionField"===u["x-component"]){var P=!0,j=!1,C=void 0;try{for(var A,E=p[Symbol.iterator]();!(P=(A=E.next()).done);P=!0)!function(){var t,c=A.value,u=null===(t=l[c])||void 0===t?void 0:t["x-component"];if(["Action.Container","AssociationField.Viewer","AssociationField.Selector","AssociationField.Nester","AssociationField.SubTable"].includes(u)){var s=f.find(function(e){return r[e]["x-component"]===u});s&&(l[c]["x-template-uid"]=r[s]["x-uid"],l[c]=e(r[s]||{},l[c],n,o,i,a),f=f.filter(function(e){return e!==s}))}}()}catch(e){j=!0,C=e}finally{try{!P&&null!=E.return&&E.return()}finally{if(j)throw C}}}if(/:configure.*Actions/.test(u["x-initializer"])){var T=!0,D=!1,F=void 0;try{for(var I,B=p[Symbol.iterator]();!(T=(I=B.next()).done);T=!0)!function(){var e=I.value;if("filterForm:configureActions"===u["x-initializer"]){var t,n,o,i,a=null===(i=l[e])||void 0===i?void 0:i["x-use-component-props"];if(a&&["useFilterBlockActionProps","useResetBlockActionProps"].includes(a)){var c=k.remove(f,function(e){var t,n=null===(t=r[e])||void 0===t?void 0:t["x-use-component-props"];return a===n});c.length>0&&(l[e]["x-template-uid"]=r[c[0]]["x-uid"])}}if((null===(t=l[e])||void 0===t?void 0:t["x-component"])&&(null===(o=l[e])||void 0===o?void 0:null===(n=o["x-settings"])||void 0===n?void 0:n.includes("actionSettings"))){var s=l[e]["x-settings"].split(":")[1],p=["bulkDelete","filter","refresh","delete","print","stepsFormNext","stepsFormPrevious","disassociate","MailSend","MailRefresh","MailAccountSetting","MailMarkAsRead","MailMarkAsUnRead"].find(function(e){return e===s});if(p){var d=k.remove(f,function(e){var t;return(null===(t=r[e])||void 0===t?void 0:t["x-settings"])==="actionSettings:".concat(p)});d.length>0&&(l[e]["x-template-uid"]=r[d[0]]["x-uid"])}}}()}catch(e){D=!0,F=e}finally{try{!T&&null!=B.return&&B.return()}finally{if(D)throw F}}}var R=!0,M=!1,q=void 0;try{for(var N,z=p[Symbol.iterator]();!(R=(N=z.next()).done);R=!0)!function(){var e=N.value;if(null===(t=u["x-initializer"])||void 0===t?void 0:t.includes(":configureColumns")){if(l[e]["x-component"]&&"fieldSettings:TableColumn"===l[e]["x-settings"]){var t,n,o,i=Object.values((null===(o=l[e])||void 0===o?void 0:o.properties)||{})[0],a=k.get(i,"x-collection-field");if(a){var c=null,s=k.remove(f,function(e){c=Object.values((null===(t=r[e])||void 0===t?void 0:t.properties)||{})[0];var t,n=k.get(c,"x-collection-field");return a===n});s.length>0&&(l[e]["x-template-uid"]=r[s[0]]["x-uid"],i["x-template-uid"]=null==c?void 0:c["x-uid"])}}if(null===(n=l[e]["x-initializer"])||void 0===n?void 0:n.includes(":configureItemActions")){var p=k.remove(f,function(e){var t,n;return null===(n=r[e])||void 0===n?void 0:null===(t=n["x-initializer"])||void 0===t?void 0:t.includes(":configureItemActions")});p.length>0&&(l[e]["x-template-uid"]=r[p[0]]["x-uid"])}}}()}catch(e){M=!0,q=e}finally{try{!R&&null!=z.return&&z.return()}finally{if(M)throw q}}if(/:configureFields/.test(s["x-initializer"])){var G=new Map;eq(u,G);var V=Array.from(G.values()),U=!0,K=!1,L=void 0;try{for(var J,W=p[Symbol.iterator]();!(U=(J=W.next()).done);U=!0){var $=J.value,H=new Map;eq(l[$],H);var Q=!0,X=!1,Y=void 0;try{for(var Z,ee=H.entries()[Symbol.iterator]();!(Q=(Z=ee.next()).done);Q=!0)!function(){var t=eC(Z.value,2),r=(t[0],t[1]),l=k.get(r.schema,"x-collection-field");if(!l)return;var c=k.find(V,function(e){return e.schema["x-collection-field"]===l});c&&(G.delete(c.schema["x-uid"]),r.schema["x-template-uid"]=c.schema["x-uid"],r.schema=e(c.schema||{},r.schema,r.schema["x-template-root-uid"]||n,o,i,a))}()}catch(e){X=!0,Y=e}finally{try{!Q&&null!=ee.return&&ee.return()}finally{if(X)throw Y}}r=eN(G),u.properties=r,f=Object.keys(r)}}catch(e){K=!0,L=e}finally{try{!U&&null!=W.return&&W.return()}finally{if(K)throw L}}}if("DndContext"===t["x-decorator"]){var et=!0,er=!1,en=void 0;try{for(var eo,ei=p[Symbol.iterator]();!(et=(eo=ei.next()).done);et=!0)!function(){var e=eo.value,t=l[e]["x-settings"];if(l[e]["x-component"]&&["actionSettings:disassociate","actionSettings:delete"].includes(t)){var n=k.remove(f,function(e){var n;return(null===(n=r[e])||void 0===n?void 0:n["x-settings"])===t});n.length>0&&(l[e]["x-template-uid"]=r[n[0]]["x-uid"])}}()}catch(e){er=!0,en=e}finally{try{!et&&null!=ei.return&&ei.return()}finally{if(er)throw en}}}var ea=k.difference(f,p);if(ea.length>0){var el=k.cloneDeep(k.pick(r,ea)),ec=!0,eu=!1,es=void 0;try{for(var ep,ef=ea[Symbol.iterator]();!(ec=(ep=ef.next()).done);ec=!0)!function(){var t=ep.value,r=_(el[t],!0,!1,n,a),c=r["x-uid"],u=k.findKey(l,function(e){return e["x-uid"]===c});u?l[u]=e(el[t]||{},l[u],n,o,i,a):(r.name=t,l[t]=r)}()}catch(e){eu=!0,es=e}finally{try{!ec&&null!=ef.return&&ef.return()}finally{if(eu)throw es}}}for(var ed={},em=Object.keys(l),ev=0;ev<em.length;ev++){var ey=em[ev];ed[ey]=e((null==r?void 0:r[ey])||{},null==l?void 0:l[ey],n,o,i,a),ed[ey]["x-template-root-uid"]&&(ed[ey]=ez(ed[ey],o,i))}var eb=[];for(var eh in ed)if(ed[eh]["x-index"]){var ex,eg=ed[eh]["x-index"];eb.includes(eg)&&(ed[eh]["x-index"]=(ex=Math).max.apply(ex,eA(eb))+1),eb.push(ed[eh]["x-index"])}return ed}return e(r||{},l,n,o,i,a)}return l})}(k.cloneDeep(t[i])||{},e,o,t,r,a);else for(var c in e.properties){var u=e.properties[c];e.properties[c]=ez(u,t,r,n),void 0===e.properties[c]["x-component"]&&delete e.properties[c]}return eB(l),eR(l,r,n),!function e(t){var r=(null==t?void 0:t.properties)||{},n=!0,o=!1,i=void 0;try{for(var a,l=Object.keys(r)[Symbol.iterator]();!(n=(a=l.next()).done);n=!0){var c=a.value;if(void 0===t.properties[c]["x-component"]&&function(e){if(!e["x-no-component"])return!0;var t=null==e?void 0:e.properties;return t&&Object.values(t).some(function(e){return void 0===e["x-component"]})}(t.properties[c])&&delete t.properties[c],(null===(m=r[c])||void 0===m?void 0:m["x-component"])==="Grid.Row"){var u=!1,s=Object.values((null===(v=r[c])||void 0===v?void 0:v.properties)||{}),p=!0,f=!1,d=void 0;try{for(var m,v,y,b=s[Symbol.iterator]();!(p=(y=b.next()).done);p=!0){var h=y.value;"Grid.Col"===h["x-component"]&&!k.isEmpty(h.properties)&&(u=!0)}}catch(e){f=!0,d=e}finally{try{!p&&null!=b.return&&b.return()}finally{if(f)throw d}}!u&&delete r[c]}e(r[c])}}catch(e){o=!0,i=e}finally{try{!n&&null!=l.return&&l.return()}finally{if(o)throw i}}}(l),l}function eG(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function eV(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,o,i;n=e,o=t,i=r[t],o in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i})}return e}function e_(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var eU=function(e,t){for(var r={insertPosition:"beforeBegin",insertTarget:null},n=Object.values(e.properties||{}).sort(function(e,t){return e["x-index"]-t["x-index"]}),o=0;o<n.length;o++)n[o]["x-uid"]===t&&(r.insertPosition="beforeBegin",o===n.length-1?(r.insertPosition="beforeEnd",r.insertTarget=e["x-uid"]):(r.insertPosition="beforeBegin",r.insertTarget=n[o+1]["x-uid"]));return r},eK=function(e){return e?e["x-template-root-uid"]?e:eK(e.parent):null},eL=(0,en.observer)(function(e){var t,r=(0,en.useFieldSchema)(),n=(0,en.useField)(),o=(0,D.useUpdate)(),i=(0,h.useRef)("block"),a=(0,h.useRef)(null===(t=T(r))||void 0===t?void 0:t["x-uid"]),l=(0,b.useAPIClient)(),c=(0,h.useContext)(eS),u=(0,en.useForm)(),s=(0,h.useContext)(b.SchemaComponentOnChangeContext).onChange;(0,h.useEffect)(function(){var e=u.subscribe(function(e){var t=e.type,r=e.payload;"blockAdded"===t&&l.resource("blockTemplates").update({filter:{key:c.key},values:{collection:r.collection,dataSource:r.dataSource,componentType:r.componentType,menuName:r.menuName}})});return function(){u.unsubscribe(e)}},[u]),r["x-initializer-props"]={style:{display:i.current}};var p=(0,h.useCallback)(function(e){var t=0,n=function(r){if(r["x-toolbar"]||r["x-settings"]){var o,i;r["x-toolbar-props"]=(o=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n,o,i;n=e,o=t,i=r[t],o in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i})}return e}({},r["x-toolbar-props"]),i=(i={initializer:"block"===e&&void 0},i),Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(i)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(i)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(i,e))}),o),t++}if(!(t>0))r.properties&&Object.keys(r.properties).forEach(function(e){n(r.properties[e])})};n(r)},[r]),f=(0,h.useCallback)(function(e){var t=e?"none":"block";t!==i.current&&(i.current=t,n.decoratorProps.style={display:t},p(t),n.form.clearFormGraph(),o())},[o,n,p]),d=(0,h.useCallback)(function(e){if(c&&c.configured!==e){var t,n={configured:e};!e&&(n.dataSource=null,n.collection=null,n.componentType=null,n.menuName=null),l.resource("blockTemplates").update({filter:{key:c.key},values:n}),c.configured=e,!e&&a.current?l.request({url:"/uiSchemas:remove/".concat(a.current)}):a.current=null===(t=T(r))||void 0===t?void 0:t["x-uid"]}},[l,c,r]),m=(0,h.useCallback)(function(){var e=Object.keys(r.properties||{}).length>0;f(e),d(e)},[r,f,d]),v=(0,h.useCallback)(function(){m(),null==s||s(r)},[r,m,s]);return(0,en.useFormEffects)(function(){(0,H.onFieldReact)("blocks.*.*",function(){m()})}),(0,h.useEffect)(function(){m()},[m]),x().createElement(b.SchemaComponentOnChangeContext.Provider,{value:{onChange:v}},e.children)}),eJ=function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=(0,en.useFieldSchema)();return!!w().get(t,"x-template-uid")&&(e||!w().get(t,"x-template-root-uid"))},eW={name:"template-revertSettingItem",title:C("Revert to template"),Component:function(){var e=(0,b.useDesignable)(),t=e.refresh,r=e.remove,n=(0,b.usePlugin)(tr),o=j(),i=(0,b.useAPIClient)(),a=(0,en.useForm)(),l=(0,en.useField)(),c=(0,b.useFormBlockProps)().form,u=(0,en.useFieldSchema)(),s=S.App.useApp(),p=s.modal,f=s.message;return x().createElement(x().Fragment,null,x().createElement(b.SchemaSettingsDivider,null),x().createElement(b.SchemaSettingsItem,{title:o("Revert to template"),onClick:function(){p.confirm(e_(eV({title:o("Revert to template"),content:o("Are you sure you want to revert all changes from the template?")},confirm),{onOk:function(){var e;return(e=function(){var e,s,p,d,m,v,y,b,h,x,g,S,k,P,j,C,A;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(E){switch(E.label){case 0:return d=w().get(u,"x-template-uid"),[4,i.request({url:"/uiSchemas:getJsonSchema/".concat(d)})];case 1:if(!(null==(m=null===(e=E.sent().data)||void 0===e?void 0:e.data)?void 0:m["x-uid"]))return r(null,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}),t({refreshParentSchema:!0}),a.reset(),a.clearFormGraph(),null==c||c.clearFormGraph(),f.success(o("Reset successfully"),.2),[2];(y=(v=eK(u))===u)?n.setTemplateCache(m):(null===(b=u["x-settings"])||void 0===b?void 0:b.includes("updateSubmit"))&&(m["x-settings"]="actionSettings:updateSubmit",m["x-use-component-props"]="useUpdateActionProps"),u["x-filter-targets"]&&(m["x-filter-targets"]=u["x-filter-targets"]),(h=_(m,!1,y,null==v?void 0:v["x-uid"],null==v?void 0:v["x-block-template-key"]))["x-index"]=u["x-index"],x=!0,g=!1,S=void 0;try{for(k=U[Symbol.iterator]();!(x=(P=k.next()).done);x=!0)j=P.value,w().hasIn(u,j)&&w().set(h,j,w().get(u,j))}catch(e){g=!0,S=e}finally{try{!x&&null!=k.return&&k.return()}finally{if(g)throw S}}return"FormBlockProvider"===u["x-decorator"]&&"useEditFormBlockDecoratorProps"===u["x-use-decorator-props"]&&K(h,{collectionName:u["x-decorator-props"].collection,dataSourceName:u["x-decorator-props"].dataSource,association:u["x-decorator-props"].association,currentRecord:!0}),C=eU(u.parent,u["x-uid"]),[4,i.request({url:"/uiSchemas:remove/".concat(u["x-uid"])})];case 2:return E.sent(),(A=new eO.Schema(h)).name=u.name,[4,i.request({url:"/uiSchemas:insertAdjacent/".concat(C.insertTarget,"?position=").concat(C.insertPosition),method:"post",data:{schema:A}})];case 3:return E.sent(),u.toJSON=function(){if(A["x-template-root-uid"]||(null===(e=u.parent)||void 0===e?void 0:e["x-template-root-uid"]))t=A.toJSON();else{var e,t;t=w().merge(m,A.toJSON())}return eB(t),eR(t,n.templateInfos,n.savedSchemaUids),t},t({refreshParentSchema:!0}),l.componentProps=e_(eV({},m["x-component-props"]),{key:(0,O.uid)()}),(null===(s=l.parent)||void 0===s?void 0:s.componentProps)&&(l.parent.componentProps=e_(eV({},l.parent.componentProps),{key:(0,O.uid)()})),l.decoratorProps=e_(eV({},l.decoratorProps,m["x-decorator-props"]),{key:(0,O.uid)()}),(null===(p=l.parent)||void 0===p?void 0:p.decoratorProps)&&(l.parent.decoratorProps=e_(eV({},l.parent.decoratorProps),{key:(0,O.uid)()})),a.reset(),null==c||c.reset(),a.clearFormGraph("*",!1),null==c||c.clearFormGraph("*",!1),f.success(o("Reset successfully"),.2),[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){eG(i,n,o,a,l,"next",e)}function l(e){eG(i,n,o,a,l,"throw",e)}a(void 0)})})()}}))}},o("Revert to template")))},useVisible:function(){var e=(0,en.useFieldSchema)();return eJ()&&"settings:stepsFormStepTitleSettings"!==e["x-settings"]}};function e$(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}var eH=function(e,t,r){(e.Component===b.SchemaSettingsTemplate||e.Component===b.SchemaSettingsFormItemTemplate)&&(e.useVisible=function(){return!1},(null==t?void 0:t.type)==="divider"&&(t.useVisible=function(){return!1}),(null==r?void 0:r.type)==="divider"&&(r.useVisible=function(){return!1}))},eQ=function(e,t){if("delete"===e.name||"remove"===e.name||"SchemaSettingDeleteItem"===e.name){var r=e.useVisible||function(){return!0};e.useVisible=function(){return!eJ(!1)&&r()},(null==t?void 0:t.type)==="divider"&&(t.useVisible=function(){return!eJ(!1)&&r()})}var n=e.items||e.children;if(n)for(var o=0;o<n.length;o++)eQ(n[o],n[o-1])},eX=function(e,t){var r=["ChartV2BlockInitializer","WorkflowTodo.Initializer","ApprovalBlock.BlockInitializer"],n=!0,o=!1,i=void 0;try{for(var a,l=e[Symbol.iterator]();!(n=(a=l.next()).done);n=!0)!function(){var e=a.value,n=t.schemaInitializerManager.get(e);if(["page:addBlock","mobile:addBlock"].includes(e)){var o,i=null==n?void 0:null===(o=n.items)||void 0===o?void 0:o.find(function(e){return"otherBlocks"===e.name});if(i){var l=(null==i?void 0:i.useVisible)||function(){return!0};i.useVisible=function(){var e=(0,b.usePlugin)(tt);return l()&&!(null==e?void 0:e.isInBlockTemplateConfigPage())}}}if(n&&n.items){var c=!0,u=!1,s=void 0;try{for(var p,f=n.items[Symbol.iterator]();!(c=(p=f.next()).done);c=!0){var d=p.value,m=!0,v=!1,y=void 0;try{for(var h,x=(d.children||[])[Symbol.iterator]();!(m=(h=x.next()).done);m=!0)!function(){var e=h.value;if(r.includes(e.Component)){var t=e.useVisible||function(){return!0};e.useVisible=function(){var e=(0,b.usePlugin)(tt);return t()&&!(null==e?void 0:e.isInBlockTemplateConfigPage())}}}()}catch(e){v=!0,y=e}finally{try{!m&&null!=x.return&&x.return()}finally{if(v)throw y}}}}catch(e){u=!0,s=e}finally{try{!c&&null!=f.return&&f.return()}finally{if(u)throw s}}}}()}catch(e){o=!0,i=e}finally{try{!n&&null!=l.return&&l.return()}finally{if(o)throw i}}},eY=function(e){if(e.Component===b.SchemaSettingsConnectDataBlocks){var t=e.useVisible||function(){return!0};e.useVisible=function(){var e=(0,b.usePlugin)(tt);return t()&&!(null==e?void 0:e.isInBlockTemplateConfigPage())}}},eZ={name:"template-disabledDeleteItem",title:C("Delete"),Component:function(){var e=j();return x().createElement(x().Fragment,null,x().createElement(b.SchemaSettingsDivider,null),x().createElement(b.SchemaSettingsItem,{disabled:!0,title:e("Delete")},x().createElement(S.Space,null,e("Delete"),x().createElement(S.Tooltip,{title:e("This is part of a template, deletion is not allowed")},x().createElement(g.QuestionCircleOutlined,null)))))},useVisible:function(){return eJ(!1)}};function e0(e,t,r,n,o,i,a){try{var l=e[i](a),c=l.value}catch(e){r(e);return}l.done?t(c):Promise.resolve(c).then(n,o)}function e1(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function a(e){e0(i,n,o,a,l,"next",e)}function l(e){e0(i,n,o,a,l,"throw",e)}a(void 0)})}}function e2(e,t,r){return(e2=e7()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&e5(o,r.prototype),o}).apply(null,arguments)}function e3(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function e4(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function e6(e){return(e6=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function e5(e,t){return(e5=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function e8(e){var t="function"==typeof Map?new Map:void 0;return(e8=function(e){var r;if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return e2(e,arguments,e6(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e5(n,e)})(e)}function e7(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(e7=function(){return!!e})()}function e9(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}var te=new WeakMap,tt=function(e){var t,r,n;function o(){var e,t,r,n,i,a,l;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,r=o,n=arguments,r=e6(r),e4(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,e7()?Reflect.construct(r,n||[],e6(t).constructor):r.apply(t,n)),"templateInfos",new Map),e4(e,"templateschemacache",{}),e4(e,"pageBlocks",{}),e4(e,"savedSchemaUids",new Set),e4(e,"injectInitializers",["page:addBlock","popup:common:addBlock","popup:addNew:addBlock","mobile:addBlock","mobile:popup:common:addBlock"]),e4(e,"setTemplateCache",function(t){if(!!t)e.templateschemacache[t["x-uid"]]=t}),e4(e,"clearTemplateCache",function(t){delete e.templateschemacache[t]}),i=e,a=te,l={writable:!0,value:function(){var t=setInterval(function(){if(!e.app.loading){clearInterval(t),eX(e.injectInitializers,e.app);var r=e.app.schemaSettingsManager.getAll();for(var n in r)(function(t){var r=e.app.schemaSettingsManager.get(t);if(r&&!t.startsWith("fieldSettings:component:")){for(var n=0;n<r.items.length;n++)eH(r.items[n],r.items[n-1],r.items[n+1]),eY(r.items[n]),eQ(r.items[n],r.items[n-1]);var o=r.items.findIndex(function(e,t){var n=r.items[t+1];return"divider"===e.type&&((null==n?void 0:n.name)==="delete"||(null==n?void 0:n.name)==="remove")});-1===o||r.items.find(function(e){return"template-revertSettingItem"===e.name})?r.add("template-revertSettingItem",eW):r.items.splice(o,0,eW),r.add("template-disabledDeleteItem",eZ)}})(n)}},1e3)}},!function(e,t){if(t.has(e))throw TypeError("Cannot initialize the same private elements twice on an object")}(i,a),a.set(i,l),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&e5(e,t)}(o,e),t=o,r=[{key:"afterAdd",value:function(){return e1(function(){return e9(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return e1(function(){return e9(this,function(e){return[2]})})()}},{key:"load",value:function(){var e=this;return e1(function(){var t,r,n,o,i,a,l,c;return e9(this,function(u){var s,p,f,d;eO.Schema.registerPatches(function(t){if(t["x-template-infos"]){for(var r in t["x-template-infos"]){var n=t["x-template-infos"][r];e.templateInfos.set(r,n)}delete t["x-template-infos"]}if(t["x-template-schemas"]){for(var o in t["x-template-schemas"]){var i=t["x-template-schemas"][o];e.templateschemacache[o]=i}delete t["x-template-schemas"]}if(t["x-template-root-uid"]&&(t.version||t["x-template-root-ref"])){var a=ez(t,e.templateschemacache,e.templateInfos,e.savedSchemaUids);return e.pageBlocks[a["x-uid"]]=a,a}return t}),!function(e,t,r){var n,o,i=function(e){var n=eD(t,e),o=function(e){if((null==e?void 0:e["x-virtual"])&&r.add(e["x-uid"]),null==e?void 0:e.properties)for(var t in e.properties)o(e.properties[t])};o(eT(n,e))};e.axios.interceptors.request.use((o=(n=function(r){var n,o,a,l,c,u,s,p,f,d,m,v,y,b,h,x,g,S,k,w,O,P,j,C,A,E,T,D,F,I,B,R,M,q;return function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(N){switch(N.label){case 0:var z,G,V;if(!((null===(n=r.url)||void 0===n?void 0:n.includes("uiSchemas:patch"))||(null===(o=r.url)||void 0===o?void 0:o.includes("uiSchemas:initializeActionContext"))))return[3,8];z=eT(s=eD(t,u=null===(c=r.data)||void 0===c?void 0:c["x-uid"]),u),G=new Set,(V=function(e){if(!!e){if(e["x-virtual"]){G.add(e["x-uid"]);return}if(e.properties)for(var t in e.properties)V(e.properties[t])}})(z),p=G,f=!0,d=!1,m=void 0,N.label=1;case 1:N.trys.push([1,6,7,8]),v=p[Symbol.iterator](),N.label=2;case 2:if(f=(y=v.next()).done)return[3,5];if(b=y.value,!(h=eF(s,b)))return[3,4];return x=eI(h.schema),[4,e.request({url:"/blockTemplates:saveSchema/".concat(h.insertTarget,"?position=").concat(h.insertPosition),method:"post",data:{schema:x}})];case 3:N.sent(),i(h.schema["x-uid"]),N.label=4;case 4:return f=!0,[3,2];case 5:return[3,8];case 6:return g=N.sent(),d=!0,m=g,[3,8];case 7:try{!f&&null!=v.return&&v.return()}finally{if(d)throw m}return[7];case 8:if(!(null===(a=r.url)||void 0===a?void 0:a.includes("uiSchemas:batchPatch")))return[3,16];S=r.data,k=!0,w=!1,O=void 0,N.label=9;case 9:N.trys.push([9,14,15,16]),P=S[Symbol.iterator](),N.label=10;case 10:if(k=(j=P.next()).done)return[3,13];if(!(A=eF(eD(t,(C=j.value)["x-uid"]),C["x-uid"])))return[3,12];return[4,e.request({url:"/blockTemplates:saveSchema/".concat(A.insertTarget,"?position=").concat(A.insertPosition),method:"post",data:{schema:eI(A.schema)}})];case 11:N.sent(),i(A.schema["x-uid"]),N.label=12;case 12:return k=!0,[3,10];case 13:return[3,16];case 14:return g=N.sent(),w=!0,O=g,[3,16];case 15:try{!k&&null!=P.return&&P.return()}finally{if(w)throw O}return[7];case 16:if(!(null===(l=r.url)||void 0===l?void 0:l.includes("uiSchemas:insertAdjacent")))return[3,20];if(D=r.url.split("/").pop(),F=null===(E=r.data)||void 0===E?void 0:E.wrap,I=null===(T=r.data)||void 0===T?void 0:T.schema,B=null==D?void 0:D.split("?")[0],R=I["x-uid"]||I,!(M=eF(eD(t,B),B,F)))return[3,18];return[4,e.request({url:"/blockTemplates:saveSchema/".concat(M.insertTarget,"?position=").concat(M.insertPosition),method:"post",data:{schema:eI(M.schema,[R,null==F?void 0:F["x-uid"]].filter(Boolean))}})];case 17:N.sent(),i(M.schema["x-uid"]),N.label=18;case 18:if(!((q=eF(eD(t,R),R,F))&&q.insertTarget))return[3,20];return[4,e.request({url:"/blockTemplates:saveSchema/".concat(q.insertTarget,"?position=").concat(q.insertPosition),method:"post",data:{schema:eI(q.schema,[R,null==F?void 0:F["x-uid"]].filter(Boolean))}})];case 19:N.sent(),i(q.schema["x-uid"]),F&&i(F["x-uid"]),N.label=20;case 20:return[2,r]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){e$(i,r,o,a,l,"next",e)}function l(e){e$(i,r,o,a,l,"throw",e)}a(void 0)})}),function(e){return o.apply(this,arguments)}))}(e.app.apiClient,e.pageBlocks,e.savedSchemaUids),e.app.addComponents({TemplateGridDecorator:eL}),e.app.addProviders([q]),n=!0,o=!1,i=void 0;try{for(a=e.injectInitializers[Symbol.iterator]();!(n=(l=a.next()).done);n=!0)c=l.value,e.app.schemaInitializerManager.addItem(c,"otherBlocks.templates",J)}catch(e){o=!0,i=e}finally{try{!n&&null!=a.return&&a.return()}finally{if(o)throw i}}return(p=function(e,t,r){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}(s=e,te,"get"),f=s,(d=p).get?d.get.call(f):d.value).call(e),e.app.pluginSettingsManager.add("block-templates",{title:'{{t("Block templates", { ns: "'.concat(W,'" })}}'),icon:"ProfileOutlined",Component:ex}),e.app.pluginSettingsManager.add("block-templates/:key",{title:!1,pluginKey:"block-templates",isTopLevel:!1,Component:ek}),null===(r=e.app.pluginManager.get("mobile"))||void 0===r||null===(t=r.mobileRouter)||void 0===t||t.add("mobile.schema.blockTemplate",{path:"/block-templates/:key/:pageSchemaUid",Component:ew}),[2]})})()}},{key:"isInBlockTemplateConfigPage",value:function(){var e,t=(null===(e=this.app.pluginManager.get("mobile"))||void 0===e?void 0:e.mobileBasename)+"/block-templates";return window.location.pathname.includes("admin/settings/block-templates")||window.location.pathname.includes(t)}}],e3(t.prototype,r),o}(e8(b.Plugin)),tr=tt;return y}()});
|
|
@@ -0,0 +1,16 @@
|
|
|
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 '@nocobase/client';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
export declare function convertTplBlock(tpl: any, virtual?: boolean, isRoot?: boolean, newRootId?: string, templateKey?: string, options?: any): any;
|
|
12
|
+
export declare const blockKeepProps: string[];
|
|
13
|
+
export declare function formSchemaPatch(currentSchema: ISchema, options?: any): void;
|
|
14
|
+
export declare function correctIdReferences(schemas: any): void;
|
|
15
|
+
export declare function convertTemplateToBlock(data: any, templateKey?: string, options?: any): any[];
|
|
16
|
+
export declare const TemplateBlockInitializer: () => React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export * from './TemplateBlockInitializer';
|
|
10
|
+
export * from './templateBlockInitializerItem';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { SchemaInitializerItemTypeWithoutName } from '@nocobase/client';
|
|
10
|
+
export declare const templateBlockInitializerItem: SchemaInitializerItemTypeWithoutName;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useT(): (str: string) => string;
|
|
10
|
+
export declare function tStr(key: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import { ISchema } from '@nocobase/client';
|
|
10
|
+
export declare const blockTemplatesSchema: ISchema;
|
|
@@ -0,0 +1,61 @@
|
|
|
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 bulkDestroySchema: {
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
'x-component': string;
|
|
13
|
+
'x-component-props': {
|
|
14
|
+
openSize: string;
|
|
15
|
+
icon: string;
|
|
16
|
+
};
|
|
17
|
+
title: string;
|
|
18
|
+
properties: {
|
|
19
|
+
modal: {
|
|
20
|
+
type: string;
|
|
21
|
+
'x-component': string;
|
|
22
|
+
'x-decorator': string;
|
|
23
|
+
'x-use-decorator-props': () => {
|
|
24
|
+
form: import("@formily/core").Form<any>;
|
|
25
|
+
};
|
|
26
|
+
title: string;
|
|
27
|
+
properties: {
|
|
28
|
+
keepBlocks: {
|
|
29
|
+
type: string;
|
|
30
|
+
'x-decorator': string;
|
|
31
|
+
'x-component': string;
|
|
32
|
+
'x-content': string;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
footer: {
|
|
36
|
+
type: string;
|
|
37
|
+
'x-component': string;
|
|
38
|
+
properties: {
|
|
39
|
+
cancel: {
|
|
40
|
+
type: string;
|
|
41
|
+
title: string;
|
|
42
|
+
'x-component': string;
|
|
43
|
+
'x-component-props': {
|
|
44
|
+
useAction: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
submit: {
|
|
48
|
+
type: string;
|
|
49
|
+
title: string;
|
|
50
|
+
'x-component': string;
|
|
51
|
+
'x-component-props': {
|
|
52
|
+
type: string;
|
|
53
|
+
useAction: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
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 createActionSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
'x-component': string;
|
|
12
|
+
title: string;
|
|
13
|
+
'x-align': string;
|
|
14
|
+
'x-component-props': {
|
|
15
|
+
type: string;
|
|
16
|
+
icon: string;
|
|
17
|
+
openMode: string;
|
|
18
|
+
};
|
|
19
|
+
properties: {
|
|
20
|
+
drawer: {
|
|
21
|
+
type: string;
|
|
22
|
+
'x-component': string;
|
|
23
|
+
title: string;
|
|
24
|
+
'x-decorator': string;
|
|
25
|
+
'x-use-decorator-props': () => {
|
|
26
|
+
form: any;
|
|
27
|
+
};
|
|
28
|
+
properties: {
|
|
29
|
+
form: {
|
|
30
|
+
type: string;
|
|
31
|
+
properties: {
|
|
32
|
+
title: {
|
|
33
|
+
type: string;
|
|
34
|
+
'x-decorator': string;
|
|
35
|
+
'x-component': string;
|
|
36
|
+
};
|
|
37
|
+
key: {
|
|
38
|
+
type: string;
|
|
39
|
+
'x-decorator': string;
|
|
40
|
+
'x-component': string;
|
|
41
|
+
'x-validator': string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
type: {
|
|
45
|
+
type: string;
|
|
46
|
+
'x-decorator': string;
|
|
47
|
+
'x-component': string;
|
|
48
|
+
};
|
|
49
|
+
description: {
|
|
50
|
+
type: string;
|
|
51
|
+
'x-decorator': string;
|
|
52
|
+
'x-component': string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
footer: {
|
|
57
|
+
type: string;
|
|
58
|
+
'x-component': string;
|
|
59
|
+
properties: {
|
|
60
|
+
submit: {
|
|
61
|
+
title: string;
|
|
62
|
+
'x-component': string;
|
|
63
|
+
'x-use-component-props': string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
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 editActionSchema: {
|
|
10
|
+
type: string;
|
|
11
|
+
title: string;
|
|
12
|
+
'x-component': string;
|
|
13
|
+
'x-component-props': {
|
|
14
|
+
openMode: string;
|
|
15
|
+
icon: string;
|
|
16
|
+
};
|
|
17
|
+
properties: {
|
|
18
|
+
drawer: {
|
|
19
|
+
type: string;
|
|
20
|
+
title: string;
|
|
21
|
+
'x-component': string;
|
|
22
|
+
'x-decorator': string;
|
|
23
|
+
'x-use-decorator-props': string;
|
|
24
|
+
properties: {
|
|
25
|
+
form: {
|
|
26
|
+
type: string;
|
|
27
|
+
properties: {
|
|
28
|
+
title: {
|
|
29
|
+
type: string;
|
|
30
|
+
'x-decorator': string;
|
|
31
|
+
'x-component': string;
|
|
32
|
+
};
|
|
33
|
+
key: {
|
|
34
|
+
type: string;
|
|
35
|
+
'x-decorator': string;
|
|
36
|
+
'x-component': string;
|
|
37
|
+
'x-disabled': boolean;
|
|
38
|
+
};
|
|
39
|
+
type: {
|
|
40
|
+
type: string;
|
|
41
|
+
'x-decorator': string;
|
|
42
|
+
'x-component': string;
|
|
43
|
+
'x-disabled': boolean;
|
|
44
|
+
};
|
|
45
|
+
description: {
|
|
46
|
+
type: string;
|
|
47
|
+
'x-decorator': string;
|
|
48
|
+
'x-component': string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
footer: {
|
|
53
|
+
type: string;
|
|
54
|
+
'x-component': string;
|
|
55
|
+
properties: {
|
|
56
|
+
submit: {
|
|
57
|
+
title: string;
|
|
58
|
+
'x-component': string;
|
|
59
|
+
'x-use-component-props': string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export * from './blockTemplates';
|
|
10
|
+
export * from './createActionSchema';
|
|
11
|
+
export * from './editActionSchema';
|
|
12
|
+
export * from './bulkDestroySchema';
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
10
|
+
export declare const disabledDeleteSettingItem: {
|
|
11
|
+
name: string;
|
|
12
|
+
title: string;
|
|
13
|
+
Component: () => import("react").JSX.Element;
|
|
14
|
+
useVisible: () => boolean;
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
10
|
+
export declare const revertSettingItem: {
|
|
11
|
+
name: string;
|
|
12
|
+
title: string;
|
|
13
|
+
Component: () => import("react").JSX.Element;
|
|
14
|
+
useVisible: () => boolean;
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
* Register template block related interceptors for axios
|
|
11
|
+
* Handles schema removal and patching operations for template blocks
|
|
12
|
+
* @param apiClient The API client instance
|
|
13
|
+
* @param pageBlocks The template blocks cache
|
|
14
|
+
*/
|
|
15
|
+
export declare function registerTemplateBlockInterceptors(apiClient: any, pageBlocks: Record<string, any>, savedSchemaUids: Set<string>): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* Finds the root schema of a block by traversing through Grid components
|
|
12
|
+
*
|
|
13
|
+
* @param schema - The schema object to search through, implementing ISchema interface
|
|
14
|
+
* @returns The first non-Grid schema found in the tree, or null if no schema is provided
|
|
15
|
+
*
|
|
16
|
+
* This function:
|
|
17
|
+
* 1. Returns null if no schema is provided
|
|
18
|
+
* 2. For Grid/Grid.Row/Grid.Col components, recursively searches their properties
|
|
19
|
+
* 3. Returns the first non-Grid schema encountered
|
|
20
|
+
*/
|
|
21
|
+
export declare const findBlockRootSchema: (schema?: ISchema) => any;
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { Application, SchemaSettingsItemType } from '@nocobase/client';
|
|
10
|
+
export declare const hideConvertToBlockSettingItem: (settingItem: SchemaSettingsItemType, preSettingItem: SchemaSettingsItemType, nextSettingItem: SchemaSettingsItemType) => void;
|
|
11
|
+
export declare const hideDeleteSettingItem: (settingItem: SchemaSettingsItemType, preSettingItem: SchemaSettingsItemType) => void;
|
|
12
|
+
export declare const hideBlocksFromTemplate: (initializers: string[], app: Application) => void;
|
|
13
|
+
export declare const hideConnectDataBlocksFromTemplate: (settingItem: SchemaSettingsItemType) => void;
|
|
@@ -0,0 +1,50 @@
|
|
|
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, Schema } from '@formily/json-schema';
|
|
10
|
+
export declare function findSchemaByUid(schema: Schema, uid: string): any;
|
|
11
|
+
export declare function collectSchemaFirstVirtualUids(schema: Schema): Set<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Find a schema in the cache by its UID
|
|
14
|
+
* @param cache The cache object containing schemas
|
|
15
|
+
* @param uid The UID to search for
|
|
16
|
+
* @returns The found schema or null
|
|
17
|
+
*/
|
|
18
|
+
export declare function findSchemaCache(cache: Record<string, any>, uid: string): any;
|
|
19
|
+
/**
|
|
20
|
+
* Find the first virtual schema by UID
|
|
21
|
+
* @param schema The schema to search in
|
|
22
|
+
* @param uid The UID to search for
|
|
23
|
+
* @returns Object containing schema and insertion details, or null if not found
|
|
24
|
+
*/
|
|
25
|
+
export declare function findFirstVirtualSchema(schema: ISchema, uid: string, wrap?: ISchema): {
|
|
26
|
+
schema: any;
|
|
27
|
+
insertTarget: string;
|
|
28
|
+
insertPosition: string;
|
|
29
|
+
} | null;
|
|
30
|
+
/**
|
|
31
|
+
* Convert a schema to a create schema format
|
|
32
|
+
* @param schema The schema to convert
|
|
33
|
+
* @returns The converted schema
|
|
34
|
+
*/
|
|
35
|
+
export declare function convertToCreateSchema(schema: ISchema, skipUids?: string[]): any;
|
|
36
|
+
export declare function addToolbarClass(schema: any): void;
|
|
37
|
+
export declare function syncExtraTemplateInfo(schema: any, templateInfos: Map<string, any>, savedSchemaUids: Set<string>): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get the full schema by merging with template schema
|
|
40
|
+
* @param schema The schema to process
|
|
41
|
+
* @param templateschemacache The template schema cache
|
|
42
|
+
* @param templateInfos The template info cache
|
|
43
|
+
* @returns The full schema
|
|
44
|
+
*/
|
|
45
|
+
export declare function getFullSchema(schema: any, templateschemacache: Record<string, any>, templateInfos: Map<string, any>, savedSchemaUids?: Set<string>): any;
|
|
46
|
+
/**
|
|
47
|
+
* Set x-virtual to false for all virtual schemas
|
|
48
|
+
* @param schema The schema to set
|
|
49
|
+
*/
|
|
50
|
+
export declare function setToTrueSchema(schema: any): void;
|