@nocobase/plugin-ui-templates 2.2.1 → 2.2.2
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/dist/client/{285.4bc78a19e0774a30.js → 285.5eb4562bd2428b91.js} +1 -1
- package/dist/client/934.0cc4e03a5a8aad6a.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +8 -8
- package/package.json +2 -2
- package/dist/client/934.5dd36051e3d71be1.js +0 -10
package/dist/externalVersion.js
CHANGED
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.2.
|
|
12
|
-
"@nocobase/flow-engine": "2.2.
|
|
11
|
+
"@nocobase/client": "2.2.2",
|
|
12
|
+
"@nocobase/flow-engine": "2.2.2",
|
|
13
13
|
"react": "18.2.0",
|
|
14
14
|
"antd": "5.24.2",
|
|
15
15
|
"@ant-design/icons": "5.6.1",
|
|
16
16
|
"lodash": "4.18.1",
|
|
17
|
-
"@nocobase/client-v2": "2.2.
|
|
18
|
-
"@nocobase/server": "2.2.
|
|
19
|
-
"@nocobase/plugin-flow-engine": "2.2.
|
|
20
|
-
"@nocobase/utils": "2.2.
|
|
21
|
-
"@nocobase/database": "2.2.
|
|
22
|
-
"@nocobase/actions": "2.2.
|
|
17
|
+
"@nocobase/client-v2": "2.2.2",
|
|
18
|
+
"@nocobase/server": "2.2.2",
|
|
19
|
+
"@nocobase/plugin-flow-engine": "2.2.2",
|
|
20
|
+
"@nocobase/utils": "2.2.2",
|
|
21
|
+
"@nocobase/database": "2.2.2",
|
|
22
|
+
"@nocobase/actions": "2.2.2"
|
|
23
23
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "UI 模板",
|
|
5
5
|
"description": "Provides block templates and popup templates for UI reuse.",
|
|
6
6
|
"description.zh-CN": "提供区块模板和弹窗模板复用的能力。",
|
|
7
|
-
"version": "2.2.
|
|
7
|
+
"version": "2.2.2",
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"block",
|
|
34
34
|
"popup"
|
|
35
35
|
],
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "336230738dda76255e363a0a68fcbec775c81564"
|
|
37
37
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_ui_templates=self.webpackChunk_nocobase_plugin_ui_templates||[]).push([["934"],{869:function(t,e,r){r.r(e),r.d(e,{ReferenceFormGridModel:function(){return E}});var n=r(155),i=r.n(n),o=r(694),a=r(401),l=r(488),u=r(277);function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function c(t,e,r,n,i,o,a){try{var l=t[o](a),u=l.value}catch(t){r(t);return}l.done?e(u):Promise.resolve(u).then(n,i)}function d(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var o=t.apply(e,r);function a(t){c(o,n,i,a,l,"next",t)}function l(t){c(o,n,i,a,l,"throw",t)}a(void 0)})}}function f(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function v(t,e,r){return(v="u">typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r||t):i.value}})(t,e,r||t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function g(t,e){return null!=e&&"u">typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}function p(t,e){if(e&&("object"===m(e)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function b(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r,n,i=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var o=[],a=!0,l=!1;try{for(i=i.call(t);!(a=(r=i.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(t){l=!0,n=t}finally{try{a||null==i.return||i.return()}finally{if(l)throw n}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(t,e)}}(t,e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t){return t&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function _(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_=function(){return!!t})()}function S(t,e){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:u(0)}),l(a,"throw",{value:u(1)}),l(a,"return",{value:u(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function u(l){return function(u){var s=[l,u];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}var w="referenceSettings",P=Symbol.for("nocobase.refGridHostBridge"),E=function(t){var e;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function r(t){if(!(this instanceof r))throw TypeError("Cannot call a class as a function");e=r,n=[t],e=h(e),f(i=p(this,_()?Reflect.construct(e,n||[],h(this).constructor):e.apply(this,n)),"_scopedEngine",void 0),f(i,"_targetRoot",void 0),f(i,"_targetGrid",void 0),f(i,"_resolvedTargetUid",void 0),f(i,"_invalidTargetUid",void 0);var e,n,i,o=new Set(["mapSubModels","filterSubModels","findSubModel","hasSubModel"]),a=new Proxy(i,{get:function(t,e){var r=t._targetGrid;if(r){if("subModels"===e)return r.subModels;if("string"==typeof e&&o.has(e)){var n=Reflect.get(r,e,r);return"function"==typeof n?n.bind(r):n}}if(e in t){var i=Reflect.get(t,e,t);return"function"==typeof i&&"constructor"!==e?i.bind(t):i}if(r){var a=Reflect.get(r,e,r);if("function"==typeof a&&"constructor"!==e)return a.bind(r);if(void 0!==a)return a}},has:function(t,e){if(e in t)return!0;var r=t._targetGrid;return!!r&&e in r},ownKeys:function(t){var e=new Set(Reflect.ownKeys(t)),r=t._targetGrid;if(r){var n=!0,i=!1,o=void 0;try{for(var a,l=Reflect.ownKeys(r)[Symbol.iterator]();!(n=(a=l.next()).done);n=!0){var u=a.value;e.add(u)}}catch(t){i=!0,o=t}finally{try{n||null==l.return||l.return()}finally{if(i)throw o}}}return Array.from(e)},getOwnPropertyDescriptor:function(t,e){var r=Reflect.getOwnPropertyDescriptor(t,e);if(r)return r;var n=t._targetGrid;if(n)return Object.getOwnPropertyDescriptor(n,e)||void 0}});return p(i,a)}return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&y(r,t),e=[{key:"_syncHostResourceAppends",value:function(t,e){if(t.addAppends){var r=new Set,n=function(t){var e,n="string"==typeof t?t.trim():"";if(n){r.add(n);var i=null==(e=n.split(".")[0])?void 0:e.trim();i&&r.add(i)}},i=function(t){var e=null==(s=t.getStepParams)?void 0:s.call(t,"fieldSettings","init");e&&(n(e.fieldPath),n(e.associationPathName));var r=t.subModels||{},a=!0,l=!1,u=void 0;try{for(var s,c,d=Object.values(r)[Symbol.iterator]();!(a=(c=d.next()).done);a=!0){var f=c.value;Array.isArray(f)?f.forEach(function(t){return g(t,o.FlowModel)&&i(t)}):g(f,o.FlowModel)&&i(f)}}catch(t){l=!0,u=t}finally{try{a||null==d.return||d.return()}finally{if(l)throw u}}};if(i(e),0!==r.size){var a=!0,l=!1,u=void 0;try{for(var s,c=r[Symbol.iterator]();!(a=(s=c.next()).done);a=!0){var d,f=s.value;null==(d=t.addAppends)||d.call(t,f)}}catch(t){l=!0,u=t}finally{try{a||null==c.return||c.return()}finally{if(l)throw u}}}}}},{key:"_ensureScopedEngine",value:function(){return this._scopedEngine=(0,u.Ob)(this.flowEngine,this._scopedEngine),this._scopedEngine}},{key:"_getTargetSettings",value:function(){var t=this.getStepParams(w,"useTemplate");if(t&&(void 0===t?"undefined":m(t))==="object"){var e=String(t.templateUid||"").trim(),r=String(t.targetUid||"").trim();if(e&&r)return{templateUid:e,templateName:String(t.templateName||"").trim()||void 0,targetUid:r,targetPath:String(t.targetPath||"").trim()||void 0}}}},{key:"_syncHostExtraTitle",value:function(t){var e,r,n,i,a=this.parent;if(a){var u=(null==a?void 0:a.isFork)&&a.master||a,s=[a];if(u&&u!==a&&g(u,o.FlowModel)&&s.push(u),null==u||null==(r=u.forks)||null==(e=r.forEach)||e.call(r,function(t){return g(t,o.FlowModel)&&s.push(t)}),!t)return void s.forEach(function(t){return t.setExtraTitle("")});var c=a.context.t("Reference template",{ns:[l.CU,"client"],nsMode:"fallback"}),d=a.context.t("(Fields only)",{ns:[l.CU,"client"],nsMode:"fallback"}),f=(null==(n=t.templateName)?void 0:n.trim())||(null==(i=t.templateUid)?void 0:i.trim())||"",v=f?"".concat(c,": ").concat(f," ").concat(d):"".concat(c," ").concat(d);s.forEach(function(t){return t.setExtraTitle(v.trim())})}}},{key:"addSubModel",value:function(t,e){if(!this._targetGrid)throw Error("[block-reference] Target grid is not resolved yet.");return this._targetGrid.addSubModel(t,e)}},{key:"setSubModel",value:function(t,e){if(!this._targetGrid)throw Error("[block-reference] Target grid is not resolved yet.");return this._targetGrid.setSubModel(t,e)}},{key:"getStepParams",value:function(t,e){if(!t||t===w||!this._targetGrid)return v(h(r.prototype),"getStepParams",this).call(this,t,e);if(e){var n,i,o,a,l=this._targetGrid.getStepParams(t,e);return void 0!==l?l:null==(a=this._targetRoot)||null==(o=a.getStepParams)?void 0:o.call(a,t,e)}var u=this._targetGrid.getStepParams(t),s=null==(i=this._targetRoot)||null==(n=i.getStepParams)?void 0:n.call(i,t);return s&&(void 0===s?"undefined":m(s))==="object"?function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){f(t,e,r[e])})}return t}({},s,u||{}):u}},{key:"setStepParams",value:function(t,e,n){if("string"==typeof t)return t!==w&&this._targetGrid?"string"==typeof e&&void 0!==n?void this._targetGrid.setStepParams(t,e,n):void((void 0===e?"undefined":m(e))==="object"&&null!==e&&this._targetGrid.setStepParams(t,e)):void v(h(r.prototype),"setStepParams",this).call(this,t,e,n);if((void 0===t?"undefined":m(t))==="object"&&null!==t){var i={},o={},a=!0,l=!1,u=void 0;try{for(var s,c=Object.entries(t)[Symbol.iterator]();!(a=(s=c.next()).done);a=!0){var d=b(s.value,2),f=d[0],g=d[1];f!==w&&this._targetGrid?o[f]=g:i[f]=g}}catch(t){l=!0,u=t}finally{try{a||null==c.return||c.return()}finally{if(l)throw u}}Object.keys(i).length>0&&v(h(r.prototype),"setStepParams",this).call(this,i),Object.keys(o).length>0&&this._targetGrid&&this._targetGrid.setStepParams(o)}}},{key:"saveStepParams",value:function(){var t=this,e=this;return d(function(){var n,i,o,a,l,u,s,c,d;return S(this,function(f){switch(f.label){case 0:if(this._targetGrid)return[3,2];return[4,this.dispatchEvent("beforeRender")];case 1:f.sent(),f.label=2;case 2:if(this._targetGrid&&this.stepParams){n=!0,i=!1,o=void 0;try{for(a=Object.entries(this.stepParams)[Symbol.iterator]();!(n=(l=a.next()).done);n=!0)s=(u=b(l.value,2))[0],c=u[1],s!==w&&(void 0===c?"undefined":m(c))==="object"&&null!==c&&(this._targetGrid.setStepParams(s,c),delete this.stepParams[s])}catch(t){i=!0,o=t}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}}return[4,v(h(r.prototype),"saveStepParams",t).call(e)];case 3:if(d=f.sent(),!this._targetGrid)return[3,5];return[4,this._targetGrid.saveStepParams()];case 4:f.sent(),f.label=5;case 5:return[2,d]}})}).call(this)}},{key:"onDispatchEventStart",value:function(t){return d(function(){var e,r,n,i,l,s,c,f,v,h,p,y,b;return S(this,function(m){switch(m.label){case 0:if(e=this,"beforeRender"!==t)return[2];if(!(n=this._getTargetSettings()))return this._syncHostExtraTitle(void 0),this._targetRoot=void 0,this._targetGrid=void 0,this._resolvedTargetUid=void 0,this._invalidTargetUid=void 0,[2];if(this._syncHostExtraTitle(n),"subModels.grid"!==(i=(null==(r=n.targetPath)?void 0:r.trim())||"subModels.grid"))throw Error("[block-reference] Only 'subModels.grid' is supported for ReferenceFormGridModel (got '".concat(i,"')."));if(this._resolvedTargetUid===n.targetUid&&this._targetGrid)return this._invalidTargetUid=void 0,[2];return l=this._ensureScopedEngine(),s=this.parent,(0,u.YT)(l,(null==s?void 0:s.context)||this.context),c=n.targetUid,f=this._targetGrid,v=this._resolvedTargetUid,h=this._invalidTargetUid,this._invalidTargetUid=void 0,[4,(p=function(){return d(function(){var t,e,r,u,d,f,v;return S(this,function(h){switch(h.label){case 0:return[4,l.loadModel({uid:c})];case 1:if(!(e=h.sent())||(e.setParent(s),r={hostUid:null==s?void 0:s.uid,hostUse:null==s?void 0:s.use,ref:{templateUid:n.templateUid,templateName:n.templateName,targetUid:c,targetPath:i,mountSubKey:"grid",mode:"reference"}},e.context.defineProperty(a.v,{value:r}),g(u=null==(t=e.subModels)?void 0:t.grid,o.FlowModel)&&(d=u),f=null==d?void 0:d.context,d&&(null==s?void 0:s.context)&&!(null==f?void 0:f[P])&&((v=new o.FlowContext).defineProperty("engine",{value:l}),v.addDelegate(s.context),d.context.addDelegate(v),d.context[P]=!0),!d))return[2,void 0];return s&&this._syncHostResourceAppends(s,d),[2,{root:e,grid:d}]}})}).call(e)})()];case 1:if(y=m.sent())return[3,4];return[4,new Promise(function(t){return setTimeout(t,50)})];case 2:if(m.sent(),(null==(b=this._getTargetSettings())?void 0:b.targetUid)!==c)return[2];return[4,p()];case 3:y=m.sent(),m.label=4;case 4:if(!y)return this._targetRoot=void 0,this._targetGrid=void 0,this._resolvedTargetUid=void 0,this._invalidTargetUid=c,(f||v||h!==c)&&this.rerender(),[2];return this._targetRoot=y.root,this._targetGrid=y.grid,this._resolvedTargetUid=c,this._invalidTargetUid=void 0,(f!==y.grid||v!==c||h)&&this.rerender(),[2]}})}).call(this)}},{key:"clearForks",value:function(){try{this._syncHostExtraTitle(void 0),(0,u.KC)(this._scopedEngine)}finally{this._scopedEngine=void 0}v(h(r.prototype),"clearForks",this).call(this)}},{key:"destroy",value:function(){var t=this,e=this;return d(function(){return S(this,function(n){switch(n.label){case 0:try{(0,u.KC)(this._scopedEngine)}finally{this._scopedEngine=void 0}return[4,v(h(r.prototype),"destroy",t).call(e)];case 1:return[2,n.sent()]}})}).call(this)}},{key:"render",value:function(){var t=this._getTargetSettings();if(!t)return(0,u.Qj)(this,"unconfigured");var e=this._targetGrid;if(!e)return this._invalidTargetUid===t.targetUid?(0,u.Qj)(this,"invalid"):(0,u.Qj)(this,"resolving");var r=this._ensureScopedEngine();return i().createElement(u.vx,{engine:r,model:e})}}],function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(r.prototype,e),r}(o.FlowModel);E.define({hide:!0})},277:function(t,e,r){r.d(e,{KC:function(){return c},Ob:function(){return u},Qj:function(){return f},YT:function(){return s},vx:function(){return h}});var n=r(155),i=r.n(n),o=r(59),a=r(694),l=r(488);function u(t,e){return null!=e?e:(0,a.createBlockScopedEngine)(t)}function s(t,e){(null==t?void 0:t.context)&&e&&t.context.defineProperty("view",{cache:!1,get:function(){return e.view}})}function c(t){var e;null==t||null==(e=t.unlinkFromStack)||e.call(t)}function d(t,e){var r=null==t?void 0:t.translate;return"function"!=typeof r?e:r(e,{ns:[l.CU,"client"]})||e}function f(t,e){return"unconfigured"===e?i().createElement(o.Card,null,i().createElement(o.Empty,{image:o.Empty.PRESENTED_IMAGE_SIMPLE,description:d(t,"Please configure target block")})):"resolving"===e?i().createElement(o.Card,null,i().createElement(o.Skeleton,{active:!0,title:!1,paragraph:{rows:3}})):i().createElement(o.Card,null,i().createElement(o.Result,{status:"error",subTitle:d(t,"Target block is invalid")}))}var v=function(t){var e=t.engine,r=t.model,n=(0,a.useFlowViewContext)(),o=i().useMemo(function(){var t,r=new a.FlowContext;return r.defineProperty("engine",{value:e}),r.addDelegate(e.context),n&&(null!=(t=a.FlowContext)&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](n):n instanceof t)&&r.addDelegate(n),r},[e,n]);return i().createElement(a.FlowViewContextProvider,{context:o},i().createElement(a.FlowModelRenderer,{key:r.uid,model:r,showFlowSettings:!1,showErrorFallback:!0}))},h=function(t){var e=t.engine,r=t.model;return i().createElement(a.FlowEngineProvider,{engine:e},i().createElement(v,{engine:e,model:r}))}},401:function(t,e,r){r.d(e,{v:function(){return n}});var n="__subModelReferenceHost"}}]);
|