@nocobase/plugin-block-comment 2.2.0-alpha.10

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.
Files changed (43) hide show
  1. package/LICENSE.txt +107 -0
  2. package/README.md +1 -0
  3. package/client-v2.d.ts +2 -0
  4. package/client-v2.js +1 -0
  5. package/client.d.ts +2 -0
  6. package/client.js +1 -0
  7. package/dist/client/41.6fb2aeb406824e12.js +10 -0
  8. package/dist/client/549.a88deaa9432f2fd7.js +10 -0
  9. package/dist/client/index.d.ts +9 -0
  10. package/dist/client/index.js +10 -0
  11. package/dist/client/locale.d.ts +11 -0
  12. package/dist/client/models/index.d.ts +11 -0
  13. package/dist/client/plugin.d.ts +13 -0
  14. package/dist/client-v2/41.53a11114c9f0edde.js +10 -0
  15. package/dist/client-v2/549.ecb8a67e5af9a534.js +10 -0
  16. package/dist/client-v2/index.d.ts +9 -0
  17. package/dist/client-v2/index.js +10 -0
  18. package/dist/client-v2/locale.d.ts +11 -0
  19. package/dist/client-v2/models/RecordCommentsBlockModel.d.ts +58 -0
  20. package/dist/client-v2/models/actions/DeleteRecordCommentActionModel.d.ts +15 -0
  21. package/dist/client-v2/models/actions/EditRecordCommentActionModel.d.ts +15 -0
  22. package/dist/client-v2/models/actions/QuoteReplyRecordCommentActionModel.d.ts +15 -0
  23. package/dist/client-v2/models/actions/RecordCommentActionGroupModel.d.ts +19 -0
  24. package/dist/client-v2/models/actions/RecordCommentSubmitActionModel.d.ts +23 -0
  25. package/dist/client-v2/models/actions/index.d.ts +13 -0
  26. package/dist/client-v2/models/components/RecordCommentActions.d.ts +20 -0
  27. package/dist/client-v2/models/components/RecordCommentFieldSelect.d.ts +15 -0
  28. package/dist/client-v2/models/components/RecordCommentsBlockView.d.ts +35 -0
  29. package/dist/client-v2/models/utils/errors.d.ts +9 -0
  30. package/dist/client-v2/models/utils.d.ts +131 -0
  31. package/dist/client-v2/plugin.d.ts +13 -0
  32. package/dist/externalVersion.js +22 -0
  33. package/dist/index.d.ts +10 -0
  34. package/dist/index.js +48 -0
  35. package/dist/locale/en-US.json +49 -0
  36. package/dist/locale/zh-CN.json +49 -0
  37. package/dist/server/index.d.ts +9 -0
  38. package/dist/server/index.js +42 -0
  39. package/dist/server/plugin.d.ts +19 -0
  40. package/dist/server/plugin.js +54 -0
  41. package/package.json +20 -0
  42. package/server.d.ts +2 -0
  43. 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
+ "use strict";(self.webpackChunk_nocobase_plugin_block_comment_client_v2=self.webpackChunk_nocobase_plugin_block_comment_client_v2||[]).push([["549"],{236:function(e,t,r){r.r(t),r.d(t,{RecordCommentSubmitActionModel:function(){return R},DeleteRecordCommentActionModel:function(){return ee},QuoteReplyRecordCommentActionModel:function(){return ep},RecordCommentSubmitActionGroupModel:function(){return U},RecordCommentActionGroupModel:function(){return L},RecordCommentActionModel:function(){return Q},EditRecordCommentActionModel:function(){return el}});var n,o,i=r(485),l=r(488),u=r(626),c=r(394),a=r(694),s=r(59),f=r(155),p=r.n(f);function y(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 b(e,t,r,n,o,i,l){try{var u=e[i](l),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function l(e){b(i,n,o,l,u,"next",e)}function u(e){b(i,n,o,l,u,"throw",e)}l(void 0)})}}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e,t,r){return(v="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=h(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r||e):o.value}})(e,t,r||e)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(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){m(e,t,r[t])})}return e}function w(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,u=!1;try{for(o=o.call(e);!(l=(r=o.next()).done)&&(i.push(r.value),!t||i.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{l||null==o.return||o.return()}finally{if(u)throw n}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(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 y(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function k(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(k=function(){return!!e})()}function P(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:c(0)}),u(l,"throw",{value:c(1)}),u(l,"return",{value:c(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function c(u){return function(c){var a=[u,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}var A="submitSettings";function M(e){var t;return(void 0===e?"undefined":j(e))==="object"&&null!==e&&("function"==typeof e.getTriggerOptions||"function"==typeof(null==(t=e.triggers)?void 0:t.get))}function x(e){return!1===e.commentCanSubmit}function _(e){var t,r,n,o,i,u,c,y,b=e.value,m=e.onChange,v=e.filter,h=function(e,t){if(null==e)return{};var r,n,o,i={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,r=Reflect.ownKeys(Object(e));o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}if(i=function(e,t){if(null==e)return{};var r,n,o={},i=Object.getOwnPropertyNames(e);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}(e,["value","onChange","filter"]),O=(0,a.useFlowContext)(),j=(0,l.kj)(),k=[(t=O.app.pm).get("workflow"),t.get("@nocobase/plugin-workflow")].find(M),A=(r=(0,a.useFlowContext)(),o=(n=S((0,f.useState)([]),2))[0],i=n[1],c=(u=S((0,f.useState)(!1),2))[0],y=u[1],(0,f.useEffect)(function(){var e=!0;return d(function(){var t,n;return P(this,function(o){switch(o.label){case 0:y(!0),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,r.api.request({url:"workflows:list",method:"get",params:{paginate:!1,filter:g({enabled:!0},v)}})];case 2:return t=o.sent(),e&&i((null==t||null==(n=t.data)?void 0:n.data)||[]),[3,5];case 3:return console.error("Error loading workflows:",o.sent()),[3,5];case 4:return e&&y(!1),[7];case 5:return[2]}})})(),function(){e=!1}},[r.api,v]),{options:o,loading:c}),x=A.options,_=A.loading,R=(0,f.useMemo)(function(){var e;return e=M(k)?k:void 0,function(t){if(t.key&&t.key===b)return!0;var r=function(e,t){var r,n,o;if(t)return null!=(r=null==e||null==(n=e.getTriggerOptions)?void 0:n.call(e,t))?r:null==e||null==(o=e.triggers)?void 0:o.get(t)}(e,t.type);return!!r&&(!0===r.actionTriggerableScope||"function"==typeof r.actionTriggerableScope&&r.actionTriggerableScope(t.config||{},"form"))}},[k,b]),C=(0,f.useMemo)(function(){return x.filter(function(e){return!!e.key&&R(e)}).map(function(e){var t=e.title?j(e.title):e.key;return{label:t,value:e.key,searchText:t}})},[R,x,j]);return p().createElement(s.Select,w(g({allowClear:!0,showSearch:!0,loading:_,placeholder:j("Select workflow")},h),{filterOption:function(e,t){return String((null==t?void 0:t.searchText)||"").toLowerCase().includes(e.toLowerCase())},value:b,options:C,onChange:m}))}var R=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=h(t),m(e=function(e,t){if(t&&("object"===j(t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,k()?Reflect.construct(t,n||[],h(this).constructor):t.apply(this,n)),"assignFormUid",void 0),m(e,"defaultProps",{title:(0,l.MZ)("Comment"),type:"primary"}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&O(r,e),t=[{key:"getAclActionName",value:function(){return"create"}},{key:"setSaveRequestConfig",value:function(e){this.setStepParams("submitSettings","saveResource",{requestConfig:e})}},{key:"renderButton",value:function(){var e=!this.context.commentCanSubmit,t=!!this.context.commentSubmitting,n=this.props.disabled,o=this.props.loading;this.props.disabled=n||e,this.props.loading=o||t;var i=v(h(r.prototype),"renderButton",this).call(this);return this.props.disabled=n,this.props.loading=o,i}}],function(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)}}(r.prototype,t),r}(i.ActionModel);function C(e,t,r,n,o,i,l){try{var u=e[i](l),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}function E(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function l(e){C(i,n,o,l,u,"next",e)}function u(e){C(i,n,o,l,u,"throw",e)}l(void 0)})}}function I(e,t,r){return t=D(t),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,V()?Reflect.construct(t,r||[],D(e).constructor):t.apply(e,r))}function T(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function F(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 Z(e,t,r){return t&&F(e.prototype,t),r&&F(e,r),e}function B(e,t,r){return(B="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=D(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r||e):o.value}})(e,t,r||e)}function D(e){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function G(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&&J(e,t)}function J(e,t){return(J=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function V(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(V=function(){return!!e})()}function q(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:c(0)}),u(l,"throw",{value:c(1)}),u(l,"return",{value:c(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function c(u){return function(c){var a=[u,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}R.define({label:(0,l.MZ)("Comment"),sort:10,createModelOptions:function(e){return{subModels:{assignForm:(0,i.createAssignFormSubModelOptions)(e)}}}}),R.registerFlow({key:A,on:"click",title:(0,l.MZ)("Submit action settings"),steps:{validateCommentContent:{hideInSettings:!0,handler:function(e){if(x(e)){var t;null==(t=e.exit)||t.call(e)}}},confirm:{use:"confirm",defaultParams:{enable:!1,title:(0,l.MZ)("Submit comment"),content:(0,l.MZ)("Are you sure you want to submit this comment?")}},assignFieldValues:(0,i.createAssignFieldValuesStep)({settingsFlowKey:A,title:(0,l.MZ)("Assign field values")}),saveResource:{defaultParams:function(e){return d(function(){return P(this,function(t){return[2,(0,i.getAssignFieldValuesDefaultParams)(e,A)]})})()},handler:function(e,t){return d(function(){var r,n,o,l,u,c;return P(this,function(a){switch(a.label){case 0:if(x(e))return null==(r=e.exit)||r.call(e),[2];return[4,(0,i.resolveAssignFieldValues)(e,null==t?void 0:t.assignedValues,"RecordCommentSubmitAction")];case 1:if(!(n=a.sent()))return null==(o=e.exit)||o.call(e),[2];if(!e.submitComment)return null==(u=e.message)||null==(l=u.error)||l.call(u,e.t("Failed to create comment")),[2];a.label=2;case 2:return a.trys.push([2,4,5,6]),e.model.setProps("loading",!0),[4,e.submitComment(w(g({},t),{assignedValues:n}))];case 3:return[2,a.sent()];case 4:return a.sent(),null==(c=e.exit)||c.call(e),[2];case 5:return e.model.setProps("loading",!1),[7];case 6:return[2]}})})()}},afterSuccess:{use:"afterSuccess",defaultParams:{successMessage:"",actionAfterSuccess:"stay"}}}}),R.registerFlow({key:"recordCommentTriggerWorkflowsActionSettings",title:(0,l.MZ)("Workflow"),steps:{setTriggerWorkflows:{title:(0,l.MZ)("Bind workflows"),uiSchema:(n=(0,l.MZ)("Support pre-action event (local mode), post-action event (local mode), and approval event here."),function(e){var t,r,o,i,u,c=(u=function(e){var t,r=(null==e?void 0:e.dataSourceKey)||(null==e||null==(t=e.dataSource)?void 0:t.key),n=null==e?void 0:e.name;if(n)return r&&"main"!==r?"".concat(r,":").concat(n):n}((null==(t=e.blockModel)?void 0:t.collection)||(null==(i=e.model)||null==(o=i.context)||null==(r=o.blockModel)?void 0:r.collection)))?{"config.collection":u}:void 0;return{description:{type:"void","x-component":s.Alert,"x-component-props":{type:"info",showIcon:!0,message:n,style:{marginBottom:"1em"}}},group:{type:"array","x-component":"ArrayItems","x-decorator":"FormItem",items:{type:"object",properties:{space:{type:"void","x-component":s.Space,"x-component-props":{align:"center",style:{display:"flex",width:"100%",gap:8}},properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},workflowKey:{type:"string","x-decorator":"FormItem","x-component":_,"x-component-props":{filter:c,placeholder:(0,l.MZ)("Select workflow"),style:{width:320,maxWidth:"100%"}},required:!0},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:(0,l.MZ)("Add workflow"),"x-component":"ArrayItems.Addition"}}}}}),handler:function(e,t){var r,n;e.model.setSaveRequestConfig({params:{triggerWorkflows:(null==(n=null==(r=t.group)?void 0:r.map(function(e){return e.workflowKey}).filter(function(e){return!!e}))?void 0:n.length)?n.join(","):void 0}})}}}});var K=["RecordCommentSubmitActionModel","AIEmployeeActionModel","JSItemActionModel","JSActionModel"],N=["AIEmployeeActionModel"],W=function(e,t,r){return t.engine.getModelClass(e)||r.models.get(e)||i.CollectionActionGroupModel.models.get(e)||i.RecordActionGroupModel.models.get(e)},Q=function(e){function t(){return T(this,t),I(this,t,arguments)}return G(t,e),t}(i.ActionModel),L=function(e){function t(){return T(this,t),I(this,t,arguments)}return G(t,e),Z(t,null,[{key:"defineChildren",value:function(e){var r=this,n=this;return E(function(){var o,l,u,c,s,f,p,y,b;return q(this,function(d){switch(d.label){case 0:return[4,B(D(t),"defineChildren",r).call(n,e)];case 1:o=d.sent(),l=!0,u=!1,c=void 0,d.label=2;case 2:d.trys.push([2,7,8,9]),f=function(){var t,r,n;return q(this,function(l){switch(l.label){case 0:if(!(r=W(y.value,e,s))||o.some(function(e){return e.useModel===r.name})||!s.isActionModelVisible(r,e)||!(null==(t=r._isScene)?void 0:t.call(r,i.ActionSceneEnum.record)))return[2,"continue"];return[4,(0,a.buildSubModelItem)(r,e)];case 1:return(n=l.sent())&&o.push(n),[2]}})},p=N[Symbol.iterator](),d.label=3;case 3:if(l=(y=p.next()).done)return[3,6];return s=this,[5,function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(f())];case 4:d.sent(),d.label=5;case 5:return l=!0,[3,3];case 6:return[3,9];case 7:return b=d.sent(),u=!0,c=b,[3,9];case 8:try{l||null==p.return||p.return()}finally{if(u)throw c}return[7];case 9:return[2,o.sort(function(e,t){var r,n;return(null!=(r=e.sort)?r:1e3)-(null!=(n=t.sort)?n:1e3)})]}})}).call(this)}}]),t}(i.ActionGroupModel);(o="baseClass")in L?Object.defineProperty(L,o,{value:Q,enumerable:!0,configurable:!0,writable:!0}):L[o]=Q;var U=function(e){function t(){return T(this,t),I(this,t,arguments)}return G(t,e),Z(t,null,[{key:"defineChildren",value:function(e){return E(function(){var t,r,n,o,i,l,u,c,s;return q(this,function(f){switch(f.label){case 0:t=[],r=!0,n=!1,o=void 0,f.label=1;case 1:f.trys.push([1,6,7,8]),i=K[Symbol.iterator](),f.label=2;case 2:if(r=(l=i.next()).done)return[3,5];if(!(u=W(l.value,e,this))||!this.isActionModelVisible(u,e))return[3,4];return[4,(0,a.buildSubModelItem)(u,e)];case 3:(c=f.sent())&&t.push(c),f.label=4;case 4:return r=!0,[3,2];case 5:return[3,8];case 6:return s=f.sent(),n=!0,o=s,[3,8];case 7:try{r||null==i.return||i.return()}finally{if(n)throw o}return[7];case 8:return[2,t]}})}).call(this)}}]),t}(i.ActionGroupModel);function H(e,t,r,n,o,i,l){try{var u=e[i](l),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}L.define({label:(0,l.MZ)("Record comment action")}),U.define({label:(0,l.MZ)("Record comment action")}),L.registerActionModels({JSActionModel:i.JSActionModel,JSItemActionModel:i.JSItemActionModel}),U.registerActionModels({RecordCommentSubmitActionModel:R,JSActionModel:i.JSActionModel,JSItemActionModel:i.JSItemActionModel});function X(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(e,t){return(z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Y=function(){return!!e})()}var ee=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=$(t),X(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,Y()?Reflect.construct(t,n||[],$(this).constructor):t.apply(this,n)),"defaultProps",{type:"link",style:{padding:0,height:"auto"},title:(0,l.MZ)("Delete")}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&z(r,e),t=[{key:"getAclActionName",value:function(){return"destroy"}}],function(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)}}(r.prototype,t),r}(Q);function et(e,t,r,n,o,i,l){try{var u=e[i](l),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}X(ee,"scene",i.ActionSceneEnum.record),ee.define({label:(0,l.MZ)("Delete"),toggleable:!0}),ee.registerFlow({key:"deleteRecordComment",title:(0,l.MZ)("Delete settings"),on:"click",steps:{confirm:{use:"confirm",defaultParams:{enable:!0,title:(0,l.MZ)("Delete record"),content:(0,l.MZ)("Are you sure you want to delete it?")}},delete:{handler:function(e){var t;return(t=function(){var t,r,n,o,i;return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:c(0)}),u(l,"throw",{value:c(1)}),u(l,"return",{value:c(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function c(u){return function(c){var a=[u,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:if(t=e.resource,r=e.record,n=e.collection,o=(0,u.gX)(r,n),!t||!o)return e.message.error(e.t("No resource or record selected for deletion")),[2];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,t.destroy(o)];case 2:return l.sent(),e.message.success(e.t("Record deleted successfully")),[3,4];case 3:return i=l.sent(),e.message.error((0,c.u)(i,e.t("Failed to delete comment"))),[3,4];case 4:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function l(e){H(i,n,o,l,u,"next",e)}function u(e){H(i,n,o,l,u,"throw",e)}l(void 0)})})()}}}});function er(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function en(e){return(en=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eo(e,t){return(eo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ei(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ei=function(){return!!e})()}var el=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=en(t),er(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,ei()?Reflect.construct(t,n||[],en(this).constructor):t.apply(this,n)),"defaultProps",{type:"link",style:{padding:0,height:"auto"},title:(0,l.MZ)("Edit")}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&eo(r,e),t=[{key:"getAclActionName",value:function(){return"update"}}],function(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)}}(r.prototype,t),r}(Q);function eu(e,t,r,n,o,i,l){try{var u=e[i](l),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}er(el,"scene",i.ActionSceneEnum.record),el.define({label:(0,l.MZ)("Edit"),toggleable:!0}),el.registerFlow({key:"editRecordComment",on:"click",steps:{edit:{handler:function(e){var t;return(t=function(){return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:c(0)}),u(l,"throw",{value:c(1)}),u(l,"return",{value:c(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function c(u){return function(c){var a=[u,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(t){return e.setEditing(),[2]})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function l(e){et(i,n,o,l,u,"next",e)}function u(e){et(i,n,o,l,u,"throw",e)}l(void 0)})})()}}}});function ec(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ea(e){return(ea=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function es(e,t){return(es=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ef(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ef=function(){return!!e})()}var ep=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t,n;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,n=arguments,t=ea(t),ec(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,ef()?Reflect.construct(t,n||[],ea(this).constructor):t.apply(this,n)),"defaultProps",{type:"link",style:{padding:0,height:"auto"},title:(0,l.MZ)("Quote reply")}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&es(r,e),t=[{key:"getAclActionName",value:function(){return"create"}}],function(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)}}(r.prototype,t),r}(Q);ec(ep,"scene",i.ActionSceneEnum.record),ep.define({label:(0,l.MZ)("Quote reply"),toggleable:!0}),ep.registerFlow({key:"quoteReplyRecordComment",on:"click",steps:{quoteReply:{handler:function(e){var t;return(t=function(){var t,r,n,o,i;return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:c(0)}),u(l,"throw",{value:c(1)}),u(l,"return",{value:c(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function c(u){return function(c){var a=[u,c];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(l){return r=e.blockModel,n=e.record,i=((o=null==r?void 0:r.mapping.contentField)?String(null!=(t=null==n?void 0:n[o])?t:""):"").split("\n").map(function(e){return"> ".concat(e)}).join("\n"),null==r||r.context.setQuoteContent(i),[2]})},function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function l(e){eu(i,n,o,l,u,"next",e)}function u(e){eu(i,n,o,l,u,"throw",e)}l(void 0)})})()}}}})},394:function(e,t,r){r.d(t,{u:function(){return n}});var n=function(e,t){if((null!=(r=Error)&&"u">typeof Symbol&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r)&&e.message)return e.message;if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"){var r,n,o,i,l=e.response,u=null==l||null==(i=l.data)||null==(o=i.errors)||null==(n=o[0])?void 0:n.message;if(u)return u}return t}}}]);
@@ -0,0 +1,9 @@
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 { default } from './plugin';
@@ -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("@emotion/css"),require("@nocobase/client-v2"),require("@formily/reactive"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-comment/client-v2",["@emotion/css","@nocobase/client-v2","@formily/reactive","react","antd","@ant-design/icons","@nocobase/flow-engine","@nocobase/utils/client"],t):"object"==typeof exports?exports["@nocobase/plugin-block-comment/client-v2"]=t(require("@emotion/css"),require("@nocobase/client-v2"),require("@formily/reactive"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client")):e["@nocobase/plugin-block-comment/client-v2"]=t(e["@emotion/css"],e["@nocobase/client-v2"],e["@formily/reactive"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"],e["@nocobase/utils/client"])}(self,function(e,t,n,r,o,i,u,c){return function(){"use strict";var l,a,f,s={376:function(e,t,n){n.d(t,{J:function(){return a}});var r=n(694),o=n(59),i=n(155),u=n.n(i),c=n(488),l=n(626),a=(0,r.observer)(function(e){var t,n,a=e.value,f=e.onChange,s=e.fieldFilter,p=function(e,t){if(null==e)return{};var n,r,o,i={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}if(i=function(e,t){if(null==e)return{};var n,r,o={},i=Object.getOwnPropertyNames(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}(e,["value","onChange","fieldFilter"]),b=(0,c.kj)(),d=(0,r.useFlowSettingsContext)(),y=null==d?void 0:d.model,v=(null==y?void 0:y.collection)||(null==d?void 0:d.collection),m=(0,i.useMemo)(function(){return"owner"===s?(0,l.dy)(v):"content"===s?(0,l.p3)(v):"date"===s?(0,l.GZ)(v):"user"===s?(0,l.vt)(v):(0,l.TP)(v)},[v,s]);return u().createElement(o.Select,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},p),n=n={showSearch:!0,allowClear:!0,optionFilterProp:"label",placeholder:b("Select field"),style:{width:"100%"},value:a,onChange:f,options:m},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))})},488:function(e,t,n){n.d(t,{CU:function(){return u},MZ:function(){return l},kj:function(){return c}});var r=n(694);function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function i(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var u="@nocobase/plugin-block-comment";function c(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,i(o({},n||{}),{ns:[u,"client"]}))}}function l(e,t){return(0,r.tExpr)(e,i(o({},t||{}),{ns:[u,"client"]}))}},626:function(e,t,n){function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t,n,r,o,i,u){try{var c=e[i](u),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}n.d(t,{Em:function(){return q},GZ:function(){return w},IU:function(){return X},KY:function(){return H},Mm:function(){return V},O2:function(){return W},Qg:function(){return C},TP:function(){return d},Tf:function(){return b},Xo:function(){return l},d_:function(){return $},dy:function(){return k},gX:function(){return F},p3:function(){return h},so:function(){return z},tH:function(){return E},vt:function(){return _},yQ:function(){return c},zi:function(){return N}});var c=20,l="record-comments-owner",a="{{ ctx.view.inputArgs.filterByTk }}",f=function(e){return!!(e&&(void 0===e?"undefined":u(e))==="object")},s=function(e){return"string"==typeof e?e:Array.isArray(e)&&1===e.length&&"string"==typeof e[0]?e[0]:void 0},p=function(e){var t,n,r;return f(e)?"function"==typeof(null==e?void 0:e.getFields)?e.getFields():(n=e.fields,null!=(r=Map)&&"u">typeof Symbol&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](n):n instanceof r)?Array.from(e.fields.values()):(null==e?void 0:e.fields)||(null==e||null==(t=e.options)?void 0:t.fields)||[]:[]},b=function(e,t){if(t)return f(e)&&"function"==typeof(null==e?void 0:e.getField)?e.getField(t):p(e).find(function(e){return e.name===t})},d=function(e){return p(e).filter(function(e){return e.name}).map(function(e){var t;return{label:e.title||(null==(t=e.uiSchema)?void 0:t.title)||e.name,value:e.name}})},y=new Set(["string","text"]),v=new Set(["input","markdown","richText","text","textarea","vditor"]),m=new Set(["date","dateOnly","datetime","time","unixTimestamp"]),g=new Set(["createdAt","date","dateOnly","datetime","time","unixTimestamp","updatedAt"]),h=function(e){return p(e).filter(function(e){return e.name&&!!e&&(e.interface?v.has(e.interface):y.has(e.type||""))}).map(function(e){var t;return{label:e.title||(null==(t=e.uiSchema)?void 0:t.title)||e.name,value:e.name}})},w=function(e){return p(e).filter(function(e){return e.name&&!!e&&(e.interface?g.has(e.interface):m.has(e.type||""))}).map(function(e){var t;return{label:e.title||(null==(t=e.uiSchema)?void 0:t.title)||e.name,value:e.name}})},O=function(e){return(null==e?void 0:e.type)==="belongsTo"||(null==e?void 0:e.interface)==="m2o"},j=new Set(["belongsToArray","belongsToMany","hasMany","hasOne"]),S=new Set(["m2m","o2m","oho","obo"]),x=function(e){return!(!(null==e?void 0:e.name)||e.type&&j.has(e.type)||e.interface&&S.has(e.interface)||O(e))},P=function(e){var t;return O(e)&&((null==e?void 0:e.target)==="users"||(null==e||null==(t=e.targetCollection)?void 0:t.name)==="users")},k=function(e){return p(e).filter(x).map(function(e){var t;return{label:e.title||(null==(t=e.uiSchema)?void 0:t.title)||e.name,value:e.name}})},_=function(e){return p(e).filter(function(e){return e.name&&P(e)}).map(function(e){var t;return{label:e.title||(null==(t=e.uiSchema)?void 0:t.title)||e.name,value:e.name}})},A=function(e){var t,n=e.collection,r=e.currentCollectionName;if(!r)return{};var o=null==(t=p(n).find(function(e){var t;return!!e.name&&!!O(e)&&(e.target===r||(null==(t=e.targetCollection)?void 0:t.name)===r)}))?void 0:t.name;return o?{ownerField:o,ownerValueField:a}:{}},T=function(e){var t,n,o=e.association,i=e.associationName;return(null==o||null==(n=o.collection)?void 0:n.name)?o.collection.name:i&&(function(e){if(Array.isArray(e))return e}(t=i.split("."))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),1!==o.length);i=!0);}catch(e){u=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return r(e,1);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(e,1)}}(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.")}())[0]||void 0},C=function(e){var t,n,r,o,u,c=null==(r=e.association)?void 0:r.foreignKey;if(c&&b(e.collection,c))return{ownerField:c,ownerValueField:null!=(o=e.sourceId)?o:a};var l=T(e),f=A({collection:e.collection,currentCollectionName:l});return f.ownerField?(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){i(e,t,n[t])})}return e}({},f),n=n={ownerValueField:null!=(u=e.sourceId)?u:f.ownerValueField},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t):{}},E=function(e){var t;return f(e)&&(s(null==e?void 0:e.filterTargetKey)||(null==(t=p(e).find(function(e){return e.primaryKey}))?void 0:t.name))||"id"},F=function(e,t){if(e){try{var n,r=f(t)?null==t||null==(n=t.getFilterByTK)?void 0:n.call(t,e):void 0;if("string"==typeof r||"number"==typeof r)return r}catch(e){}var o=E(t),i=o?e[o]:void 0;return"string"==typeof i||"number"==typeof i?i:void 0}},M=function(e){if("string"==typeof e)return e;if(!(!e||(void 0===e?"undefined":u(e))!=="object"||Array.isArray(e))){var t=e.value;return"string"==typeof t?t:void 0}},q=function(e,t){var n=M(t);if(e&&n)return n.split(".").reduce(function(e,t){if(e&&(void 0===e?"undefined":u(e))==="object")return e[t]},e)},R=function(e){var t=M(e);return!!t&&/^\{\{\s*ctx(?:\..+?)?\s*\}\}$/.test(t.trim())},I=function(e){var t=M(e);return!!t&&/^ctx(?:\..+?)?$/.test(t.trim())},$=function(e){return R(e)||I(e)},D=function(e){var t=M(e);if(t){var n=t.trim();if(R(n))return n;if(I(n))return"{{ ".concat(n," }}")}},N=function(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(e&&(void 0===e?"undefined":u(e))==="object"&&!Array.isArray(e)){var t,n,r=null!=(t=null!=(n=e.id)?n:e.value)?t:e.key;if("string"==typeof r||"number"==typeof r||"boolean"==typeof r)return r}},B=new Set(["integer","bigInt","double","float","decimal","real"]),K=new Set(["boolean"]),G=new Set(["string","text","uid","uuid","email","phone","url","password","radioGroup","select"]),L=function(e,t){if(!t)return{compatible:!0,value:e};if(t&&(B.has(t.type||"")||B.has(t.interface||""))){if("number"==typeof e)return Number.isFinite(e)?{compatible:!0,value:e}:{compatible:!1};if("string"==typeof e&&""!==e.trim()){var n=Number(e);return Number.isFinite(n)?{compatible:!0,value:n}:{compatible:!1}}return{compatible:!1}}if(t&&(K.has(t.type||"")||K.has(t.interface||""))){if("boolean"==typeof e)return{compatible:!0,value:e};if("string"==typeof e){var r=e.trim().toLowerCase();if("true"===r||"1"===r)return{compatible:!0,value:!0};if("false"===r||"0"===r)return{compatible:!0,value:!1}}return{compatible:!1}}return t&&(G.has(t.type||"")||G.has(t.interface||""))?{compatible:!0,value:String(e)}:{compatible:!0,value:e}},U=function(e,t){var n,r=b(e,t);if(!O(r))return r;var o=(null==r?void 0:r.targetKey)||s(null==r||null==(n=r.targetCollection)?void 0:n.filterTargetKey)||"id";return b(null==r?void 0:r.targetCollection,o)},V=function(e,t,n){return L(n,U(e,t))},J=function(e){var t=M(e);if(t){var n=t.trim(),r=n.match(/^\{\{\s*(ctx\.(?:record|popup\.record)(?:\..+?)?)\s*\}\}$/);if(r)return r[1];if(/^(?:ctx\.)?(?:record|popup\.record)(?:\..+?)?$/.test(n))return n.startsWith("ctx.")?n:"ctx.".concat(n)}},Q=function(e){var t=M(e);if(!t)return!1;var n=t.trim().replace(/\s+/g,"");return"ctx.view.inputArgs.filterByTk"===n||"ctx.inputArgs.filterByTk"===n||"{{ctx.view.inputArgs.filterByTk}}"===n||"{{ctx.inputArgs.filterByTk}}"===n},Z=function(e,t){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(!(!e||(void 0===e?"undefined":u(e))!=="object"||Array.isArray(e))){if(t){var n=e[t];if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)return n}return N(e)}},X=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"id";if(Q(e))return Z(t,n);var r=J(e);if(!r)return"number"!=typeof e&&"boolean"!=typeof e&&("string"!=typeof e||$(e))?void 0:e;if("ctx.record"===r||r==="ctx.record.".concat(n)||"ctx.popup.record"===r||r==="ctx.popup.record.".concat(n)){var o=Z(t,n);if(void 0!==o)return o}},z=function(e,t,n){var r,o=b(e,t);return O(o)?i({},t,i({},(null==o?void 0:o.targetKey)||s(null==o||null==(r=o.targetCollection)?void 0:r.filterTargetKey)||"id",{$eq:n})):i({},t,{$eq:n})},H=function(e,t){var n;return(n=function(){var n,r,o;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:l(0)}),c(u,"throw",{value:l(1)}),c(u,"return",{value:l(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function l(c){return function(l){var a=[c,l];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,a[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:if(!(r=D(t)))return[3,2];return[4,null==(n=e.resolveJsonTemplate)?void 0:n.call(e,r)];case 1:return o=i.sent(),[3,3];case 2:o=q(e.record,t),i.label=3;case 3:return[2,N(o)]}})},function(){var e=this,t=arguments;return new Promise(function(r,i){var u=n.apply(e,t);function c(e){o(u,r,i,c,l,"next",e)}function l(e){o(u,r,i,c,l,"throw",e)}c(void 0)})})()},W=function(e){if(null==e||""===e)return"-";if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return String(e);if(Array.isArray(e))return e.map(function(e){return W(e)}).join(", ");if((void 0===e?"undefined":u(e))==="object"){var t,n,r,o,i;return String(null!=(t=null!=(n=null!=(r=null!=(o=null!=(i=e.title)?i:e.name)?o:e.nickname)?r:e.username)?n:e.id)?t:"-")}return String(e)}},375:function(e){e.exports=i},477:function(t){t.exports=e},992:function(e){e.exports=n},485:function(e){e.exports=t},694:function(e){e.exports=u},768:function(e){e.exports=c},59:function(e){e.exports=o},155:function(e){e.exports=r}},p={};function b(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}};return s[e](n,n.exports,b),n.exports}b.m=s,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return""+e+"."+({41:"53a11114c9f0edde",549:"ecb8a67e5af9a534"})[e]+".js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},b.l=function(e,t,n,r){if(d[e])return void d[e].push(t);if(void 0!==n)for(var o,i,u=document.getElementsByTagName("script"),c=0;c<u.length;c++){var l=u[c];if(l.getAttribute("src")==e||l.getAttribute("data-rspack")=="@nocobase/plugin-block-comment/client-v2:"+n){o=l;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,b.nc&&o.setAttribute("nonce",b.nc),o.setAttribute("data-rspack","@nocobase/plugin-block-comment/client-v2:"+n),o.src=e),d[e]=[t];var a=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=d[e];if(delete d[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(a.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=a.bind(null,o.onerror),o.onload=a.bind(null,o.onload),i&&document.head.appendChild(o)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.g.importScripts&&(y=b.g.location+"");var d,y,v=b.g.document;if(!y&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(y=v.currentScript.src),!y)){var m=v.getElementsByTagName("script");if(m.length)for(var g=m.length-1;g>-1&&(!y||!/^http(s?):/.test(y));)y=m[g--].src}if(!y)throw Error("Automatic publicPath is not supported in this browser");b.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l={889:0},b.f.j=function(e,t){var n=b.o(l,e)?l[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=l[e]=[t,r]});t.push(n[2]=r);var o=b.p+b.u(e),i=Error();b.l(o,function(t){if(b.o(l,e)&&(0!==(n=l[e])&&(l[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},a=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==l[e]})){for(n in i)b.o(i,n)&&(b.m[n]=i[n]);u&&u(b)}for(e&&e(t);c<o.length;c++)r=o[c],b.o(l,r)&&l[r]&&l[r][0](),l[r]=0},(f=self.webpackChunk_nocobase_plugin_block_comment_client_v2=self.webpackChunk_nocobase_plugin_block_comment_client_v2||[]).forEach(a.bind(null,0)),f.push=a.bind(null,f.push.bind(f));var h={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-block-comment/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-block-comment/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var u=window.location.pathname||"/",c=u.indexOf(i);e=c>=0?u.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-block-comment/dist/client-v2/"}b.p=e}(),!function(){b.r(h),b.d(h,{default:function(){return l}});var e=b(485),t=b(376);function n(e,t,n,r,o,i,u){try{var c=e[i](u),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function r(e,t,n){return(r=c()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){var t="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||-1===Function.toString.call(e).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 r(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,e)})(e)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var l=function(e){var r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function u(){var e,t;if(!(this instanceof u))throw TypeError("Cannot call a class as a function");return e=u,t=arguments,e=o(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,c()?Reflect.construct(e,t||[],o(this).constructor):e.apply(this,t))}return u.prototype=Object.create(e&&e.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),e&&i(u,e),r=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(u,"next",{value:l(0)}),c(u,"throw",{value:l(1)}),c(u,"return",{value:l(2)}),"function"==typeof Symbol&&c(u,Symbol.iterator,{value:function(){return this}}),u;function l(c){return function(l){var a=[c,l];if(n)throw TypeError("Generator is already executing.");for(;u&&(u=0,a[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(e){return this.flowEngine.flowSettings.registerComponents({RecordCommentFieldSelect:t.J}),this.flowEngine.registerModelLoaders({RecordCommentsBlockModel:{loader:function(){return b.e("41").then(b.bind(b,672))}},RecordCommentItemModel:{loader:function(){return b.e("41").then(b.bind(b,672))}},RecordCommentActionGroupModel:{loader:function(){return b.e("549").then(b.bind(b,236))}},RecordCommentSubmitActionGroupModel:{loader:function(){return b.e("549").then(b.bind(b,236))}},RecordCommentSubmitActionModel:{loader:function(){return b.e("549").then(b.bind(b,236))}},EditRecordCommentActionModel:{loader:function(){return b.e("549").then(b.bind(b,236))}},DeleteRecordCommentActionModel:{loader:function(){return b.e("549").then(b.bind(b,236))}},QuoteReplyRecordCommentActionModel:{loader:function(){return b.e("549").then(b.bind(b,236))}}}),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,i){var u=e.apply(t,r);function c(e){n(u,o,i,c,l,"next",e)}function l(e){n(u,o,i,c,l,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(u.prototype,r),u}(u(e.Plugin))}(),h}()});
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const NAMESPACE = "@nocobase/plugin-block-comment";
10
+ export declare function useT(): (str: string, options?: Record<string, unknown>) => string;
11
+ export declare function tExpr(key: string, options?: Record<string, unknown>): string;
@@ -0,0 +1,58 @@
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 { CollectionBlockModel, type DetailsGridModel } from '@nocobase/client-v2';
10
+ import { FlowModel, MultiRecordResource, type Collection } from '@nocobase/flow-engine';
11
+ import React from 'react';
12
+ import { type RecordCommentFieldMapping, type RecordCommentRecord } from './utils';
13
+ type RecordCommentsBlockStructure = {
14
+ subModels: {
15
+ items: RecordCommentItemModel[];
16
+ submitActions?: FlowModel[];
17
+ };
18
+ };
19
+ type RecordCommentItemStructure = {
20
+ subModels: {
21
+ bodyFields: DetailsGridModel;
22
+ actions: FlowModel[];
23
+ };
24
+ };
25
+ export declare class RecordCommentItemModel extends FlowModel<RecordCommentItemStructure> {
26
+ render(): React.JSX.Element;
27
+ }
28
+ export declare class RecordCommentsBlockModel extends CollectionBlockModel<RecordCommentsBlockStructure> {
29
+ static scene: import("@nocobase/client-v2").BlockSceneType;
30
+ _defaultCustomModelClasses: {
31
+ DetailsItemModel: string;
32
+ DetailsAssociationFieldGroupModel: string;
33
+ DetailsCustomItemModel: string;
34
+ };
35
+ private readonly resolvedOwnerValue;
36
+ private readonly loadingLastPage;
37
+ private shouldLoadLastPage;
38
+ static filterCollection(collection: Collection): boolean;
39
+ get resource(): MultiRecordResource<RecordCommentRecord>;
40
+ get mapping(): RecordCommentFieldMapping;
41
+ private getOwnerValueFromRecord;
42
+ private get currentViewInputArgs();
43
+ private get currentViewCollection();
44
+ private getOwnerValueFromViewFilterByTk;
45
+ private get rawOwnerValue();
46
+ private get ownerFilterValueState();
47
+ get ownerValue(): string | number | boolean;
48
+ resolveOwnerValue(): Promise<string | number | boolean>;
49
+ applyOwnerFilter(): Promise<void>;
50
+ createResource(): MultiRecordResource<RecordCommentRecord>;
51
+ getLastPage(pageSize?: any): number;
52
+ shouldAutoJumpToLastPage(): boolean;
53
+ isPreparingLastPageLoad(): boolean;
54
+ ensureLastPageLoaded(): Promise<void>;
55
+ handlePageChange(page: number): Promise<void>;
56
+ renderComponent(): React.JSX.Element;
57
+ }
58
+ export {};
@@ -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
+ import type { ButtonProps } from 'antd/es/button';
10
+ import { RecordCommentActionModel } from './RecordCommentActionGroupModel';
11
+ export declare class DeleteRecordCommentActionModel extends RecordCommentActionModel {
12
+ static scene: import("@nocobase/client-v2").ActionSceneType;
13
+ defaultProps: ButtonProps;
14
+ getAclActionName(): string;
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
+ import type { ButtonProps } from 'antd/es/button';
10
+ import { RecordCommentActionModel } from './RecordCommentActionGroupModel';
11
+ export declare class EditRecordCommentActionModel extends RecordCommentActionModel {
12
+ static scene: import("@nocobase/client-v2").ActionSceneType;
13
+ defaultProps: ButtonProps;
14
+ getAclActionName(): string;
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
+ import type { ButtonProps } from 'antd/es/button';
10
+ import { RecordCommentActionModel } from './RecordCommentActionGroupModel';
11
+ export declare class QuoteReplyRecordCommentActionModel extends RecordCommentActionModel {
12
+ static scene: import("@nocobase/client-v2").ActionSceneType;
13
+ defaultProps: ButtonProps;
14
+ getAclActionName(): string;
15
+ }
@@ -0,0 +1,19 @@
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 { ActionGroupModel, ActionModel } from '@nocobase/client-v2';
10
+ import { type FlowModelContext } from '@nocobase/flow-engine';
11
+ export declare class RecordCommentActionModel extends ActionModel {
12
+ }
13
+ export declare class RecordCommentActionGroupModel extends ActionGroupModel {
14
+ static baseClass: typeof RecordCommentActionModel;
15
+ static defineChildren(ctx: FlowModelContext): Promise<any[]>;
16
+ }
17
+ export declare class RecordCommentSubmitActionGroupModel extends ActionGroupModel {
18
+ static defineChildren(ctx: FlowModelContext): Promise<any[]>;
19
+ }
@@ -0,0 +1,23 @@
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 { ActionModel, type AssignFormModel } from '@nocobase/client-v2';
10
+ import type { AxiosRequestConfig } from 'axios';
11
+ import type { ButtonProps } from 'antd/es/button';
12
+ import React from 'react';
13
+ export declare class RecordCommentSubmitActionModel extends ActionModel<{
14
+ subModels: {
15
+ assignForm: AssignFormModel;
16
+ };
17
+ }> {
18
+ assignFormUid?: string;
19
+ defaultProps: ButtonProps;
20
+ getAclActionName(): string;
21
+ setSaveRequestConfig(requestConfig?: AxiosRequestConfig): void;
22
+ renderButton(): React.JSX.Element;
23
+ }
@@ -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
+ export * from './DeleteRecordCommentActionModel';
10
+ export * from './EditRecordCommentActionModel';
11
+ export * from './RecordCommentActionGroupModel';
12
+ export * from './RecordCommentSubmitActionModel';
13
+ export * from './QuoteReplyRecordCommentActionModel';
@@ -0,0 +1,20 @@
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 { type FlowModel } from '@nocobase/flow-engine';
10
+ import React from 'react';
11
+ import type { RecordCommentsBlockModel } from '../RecordCommentsBlockModel';
12
+ import type { RecordCommentRecord } from '../utils';
13
+ export declare const RecordCommentActions: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<{
14
+ blockModel: RecordCommentsBlockModel;
15
+ record: RecordCommentRecord;
16
+ itemModel: FlowModel;
17
+ actionSettingsModel?: FlowModel;
18
+ forkKeyPrefix: string;
19
+ setEditing: () => void;
20
+ }>>;
@@ -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
+ import type { SelectProps } from 'antd';
10
+ import React from 'react';
11
+ export declare const RecordCommentFieldSelect: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<Omit<SelectProps<string | string[], import("rc-select/lib/Select").DefaultOptionType>, "options"> & {
12
+ value?: string | string[];
13
+ onChange?: (value: string | string[] | undefined) => void;
14
+ fieldFilter?: 'content' | 'date' | 'owner' | 'user';
15
+ }>>;
@@ -0,0 +1,35 @@
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 { type FlowModel } from '@nocobase/flow-engine';
10
+ import React from 'react';
11
+ import type { RecordCommentsBlockModel } from '../RecordCommentsBlockModel';
12
+ import { type RecordCommentRecord } from '../utils';
13
+ export declare const RecordCommentsBlockView: React.NamedExoticComponent<Omit<{
14
+ children?: React.ReactNode;
15
+ }, "model" | "dataSource" | "onPageChange"> & {
16
+ model: RecordCommentsBlockModel;
17
+ dataSource: RecordCommentRecord[];
18
+ onPageChange: (page: number) => void;
19
+ } & {
20
+ children?: any;
21
+ }> & {
22
+ readonly type: import("@formily/reactive-react").ReactFC<{
23
+ model: RecordCommentsBlockModel;
24
+ dataSource: RecordCommentRecord[];
25
+ onPageChange: (page: number) => void;
26
+ }>;
27
+ } & {
28
+ Item: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<{
29
+ blockModel: RecordCommentsBlockModel;
30
+ itemModel: FlowModel;
31
+ actionSettingsModel?: FlowModel;
32
+ record: RecordCommentRecord;
33
+ forkKeyPrefix: string;
34
+ }>>;
35
+ };
@@ -0,0 +1,9 @@
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 getErrorMessage: (error: unknown, fallback: string) => string;
@@ -0,0 +1,131 @@
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 type RecordCommentRecord = {
10
+ id?: string | number;
11
+ [key: string]: unknown;
12
+ };
13
+ export type RecordCommentFieldMapping = {
14
+ commenterField?: string;
15
+ dateField?: string;
16
+ contentField?: string;
17
+ ownerField?: string;
18
+ ownerValueField?: unknown;
19
+ };
20
+ export type DefaultRecordCommentFieldMapping = Pick<RecordCommentFieldMapping, 'ownerField' | 'ownerValueField'>;
21
+ export type RecordCommentAssociationLike = {
22
+ collection?: {
23
+ name?: string;
24
+ };
25
+ foreignKey?: string;
26
+ sourceKey?: string;
27
+ };
28
+ export type RecordCommentCollection = {
29
+ filterTargetKey?: string | string[];
30
+ getFilterByTK?: (record: RecordCommentRecord) => unknown;
31
+ getField?: (fieldName: string) => RecordCommentCollectionField | undefined;
32
+ getFields?: () => RecordCommentCollectionField[];
33
+ fields?: RecordCommentCollectionField[] | Map<string, RecordCommentCollectionField>;
34
+ options?: {
35
+ fields?: RecordCommentCollectionField[];
36
+ };
37
+ };
38
+ export type RecordCommentCollectionField = {
39
+ name?: string;
40
+ title?: string;
41
+ interface?: string;
42
+ type?: string;
43
+ target?: string;
44
+ primaryKey?: boolean;
45
+ targetKey?: string;
46
+ targetCollection?: RecordCommentCollection & {
47
+ name?: string;
48
+ };
49
+ uiSchema?: {
50
+ title?: string;
51
+ ['x-component-props']?: Record<string, unknown>;
52
+ };
53
+ };
54
+ export type RecordCommentOwnerValueContext = {
55
+ record?: RecordCommentRecord;
56
+ resolveJsonTemplate?: (template: string) => Promise<unknown>;
57
+ };
58
+ export declare const DEFAULT_PAGE_SIZE = 20;
59
+ export declare const OWNER_FILTER_GROUP_KEY = "record-comments-owner";
60
+ export declare const COMMENT_OWNER_VARIABLE_EXAMPLE = "{{ ctx.record.id }}";
61
+ export declare const COMMENT_OWNER_FILTER_BY_TK_VARIABLE = "{{ ctx.view.inputArgs.filterByTk }}";
62
+ export declare const getCollectionFields: (collection?: unknown) => RecordCommentCollectionField[];
63
+ export declare const getCollectionField: (collection: unknown, fieldName?: string) => RecordCommentCollectionField;
64
+ export declare const getCollectionFieldOptions: (collection?: unknown) => {
65
+ label: string;
66
+ value: string;
67
+ }[];
68
+ export declare const isCommentContentField: (field?: RecordCommentCollectionField) => boolean;
69
+ export declare const isCommentDateField: (field?: RecordCommentCollectionField) => boolean;
70
+ export declare const getCommentContentFieldOptions: (collection?: unknown) => {
71
+ label: string;
72
+ value: string;
73
+ }[];
74
+ export declare const getCommentDateFieldOptions: (collection?: unknown) => {
75
+ label: string;
76
+ value: string;
77
+ }[];
78
+ export declare const isBelongsToField: (field?: RecordCommentCollectionField) => boolean;
79
+ export declare const isCommentOwnerField: (field?: RecordCommentCollectionField) => boolean;
80
+ export declare const isUserField: (field?: RecordCommentCollectionField) => boolean;
81
+ export declare const getCommentOwnerFieldOptions: (collection?: unknown) => {
82
+ label: string;
83
+ value: string;
84
+ }[];
85
+ export declare const getCommentUserFieldOptions: (collection?: unknown) => {
86
+ label: string;
87
+ value: string;
88
+ }[];
89
+ export declare const getDefaultRecordCommentFieldMapping: (options: {
90
+ collection?: unknown;
91
+ currentCollectionName?: string;
92
+ }) => DefaultRecordCommentFieldMapping;
93
+ export declare const getAssociationSourceCollectionName: (options: {
94
+ association?: RecordCommentAssociationLike;
95
+ associationName?: string;
96
+ }) => string;
97
+ export declare const getAssociationRecordCommentFieldMapping: (options: {
98
+ collection?: unknown;
99
+ association?: RecordCommentAssociationLike;
100
+ associationName?: string;
101
+ sourceId?: unknown;
102
+ }) => DefaultRecordCommentFieldMapping;
103
+ export declare const getCollectionFilterTargetKey: (collection?: unknown) => string;
104
+ export declare const getRecordPrimaryKeyValue: (record?: RecordCommentRecord, collection?: unknown) => string | number | undefined;
105
+ export declare const getValueByPath: (record: RecordCommentRecord | undefined, path?: unknown) => unknown;
106
+ export declare const isContextVariableExpression: (value?: unknown) => boolean;
107
+ export declare const isContextVariablePath: (value?: unknown) => boolean;
108
+ export declare const isContextVariableValue: (value?: unknown) => boolean;
109
+ export declare const normalizeContextVariableTemplate: (value?: unknown) => string;
110
+ export declare const toScalarFilterValue: (value: unknown) => string | number | boolean | undefined;
111
+ export declare const normalizeOwnerFilterValue: (collection: unknown, ownerFieldName: string, ownerValue: string | number | boolean) => {
112
+ compatible: boolean;
113
+ value: string | number | boolean;
114
+ } | {
115
+ compatible: boolean;
116
+ value?: undefined;
117
+ };
118
+ export declare const resolveCommentOwnerValueFromFilterByTk: (ownerValueField: unknown, filterByTk: unknown, currentRecordTargetKey?: string) => string | number | boolean;
119
+ export declare const createOwnerFieldFilter: (collection: unknown, ownerFieldName: string, ownerValue: string | number | boolean) => {
120
+ [x: string]: {
121
+ [x: string]: {
122
+ $eq: string | number | boolean;
123
+ };
124
+ };
125
+ } | {
126
+ [x: string]: {
127
+ $eq: string | number | boolean;
128
+ };
129
+ };
130
+ export declare const resolveCommentOwnerValue: (context: RecordCommentOwnerValueContext, ownerValueField?: unknown) => Promise<string | number | boolean>;
131
+ export declare const getDisplayValue: (value: unknown) => string;
@@ -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 { Plugin } from '@nocobase/client-v2';
10
+ export declare class PluginRecordCommentsClientV2 extends Plugin {
11
+ load(): Promise<void>;
12
+ }
13
+ export default PluginRecordCommentsClientV2;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ module.exports = {
11
+ "@nocobase/flow-engine": "2.2.0-alpha.10",
12
+ "@nocobase/client": "2.2.0-alpha.10",
13
+ "@nocobase/client-v2": "2.2.0-alpha.10",
14
+ "@nocobase/server": "2.2.0-alpha.10",
15
+ "@formily/reactive": "2.3.7",
16
+ "antd": "5.24.2",
17
+ "react": "18.2.0",
18
+ "axios": "1.7.7",
19
+ "@ant-design/icons": "5.6.1",
20
+ "@emotion/css": "11.13.0",
21
+ "@nocobase/utils": "2.2.0-alpha.10"
22
+ };
@@ -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 './server';
10
+ export { default } from './server';