@nocobase/plugin-comments 2.1.0-beta.46 → 2.1.0-beta.48

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/client-v2.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client-v2/index.js');
@@ -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_comments_client_v2=self.webpackChunk_nocobase_plugin_comments_client_v2||[]).push([["638"],{197:function(e,t,n){n.r(t),n.d(t,{CommentItemModel:function(){return Y},CommentsBlockModel:function(){return Z}});var r,o,l=n(485),a=n(694),c=n(59),u=n(155),i=n.n(u),s=n(488),f=n(768),d=n(375),p=(0,a.observer)(function(){var e=(0,a.useFlowModel)(),t=e.context.record;return i().createElement(a.DndProvider,null,i().createElement("div",{style:{textAlign:"right"}},i().createElement(c.Space,{size:0,style:{gap:0}},e.mapSubModels("actions",function(n,r){var o=n.createFork({},"".concat(t.id,"_").concat(r));return o.context.defineProperty("record",{get:function(){return t}}),o.context.defineMethod("setEditing",function(){e.context.setEditing()}),i().createElement(a.Droppable,{model:o,key:o.uid},i().createElement(a.FlowModelRenderer,{model:o,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:a.DragHandler,sort:1}]}))}),e.context.flowSettingsEnabled&&i().createElement(a.AddSubModelButton,{key:"comment-actions-add",model:e,subModelKey:"actions",subModelBaseClasses:["CommentActionGroupModel"]},i().createElement(a.FlowSettingsButton,{icon:i().createElement(d.SettingOutlined,null)},e.translate("Actions"))))))}),m=n(626);function y(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 b(e,t,n,r,o,l,a){try{var c=e[l](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function v(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var l=e.apply(t,n);function a(e){b(l,r,o,a,c,"next",e)}function c(e){b(l,r,o,a,c,"throw",e)}a(void 0)})}}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,c=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(l.push(n.value),!t||l.length!==t);a=!0);}catch(e){c=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(c)throw r}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return 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 g(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var i=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}var w={position:"relative"},S={position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0},x={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"42px"},k={backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6},E={marginRight:16,flexShrink:0},O={position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px"},j={marginTop:10,display:"flex",columnGap:5},P=function(e){var t=e.value,n=e.markdown,r=e.liquid,o=e.translate,l=e.context,a=h((0,u.useState)(null),2),c=a[0],s=a[1];return(0,u.useEffect)(function(){var e=!0;return v(function(){var a,c,u,f;return g(this,function(d){switch(d.label){case 0:if(!t)return s(null),[2];d.label=1;case 1:if(d.trys.push([1,5,,6]),!r)return[3,3];return[4,r.renderWithFullContext(t,l)];case 2:return c=d.sent(),[3,4];case 3:c=t,d.label=4;case 4:return a=c,u=(null==n?void 0:n.render)?n.render(o(a),{ellipsis:!1,textOnly:!1}):a,e&&s(u),[3,6];case 5:return f=d.sent(),e&&s(i().createElement("pre",{style:{color:"red"}},(0,m.u)(f,o("Render error")))),[3,6];case 6:return[2]}})})(),function(){e=!1}},[l,r,n,o,t]),i().createElement(i().Fragment,null,c)},C=(0,a.observer)(function(e){var t,n=e.value,r=e.resource,o=e.model,l=(0,s.kj)(),a=c.App.useApp().message,d=h((0,u.useState)(!1),2),y=d[0],b=d[1],C=h((0,u.useState)((null==n?void 0:n.content)||""),2),M=C[0],A=C[1],I=o.context.markdown;(0,u.useEffect)(function(){A((null==n?void 0:n.content)||"")},[null==n?void 0:n.content]),o.context.defineMethod("setEditing",function(){b(!0)});var z=(0,u.useCallback)(function(){return v(function(){var e;return g(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,r.update(n.id,{content:M})];case 1:return t.sent(),[4,r.refresh()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),a.error((0,m.u)(e,l("Failed to update comment"))),[3,4];case 4:return[2]}})})()},[a,r,l,M,n.id]);return i().createElement("div",{key:n.id},i().createElement("div",{style:w},i().createElement("div",{style:S}),i().createElement(c.Card,{size:"small",styles:{header:{padding:0,fontWeight:"normal",backgroundColor:"#f6f8fa"}},title:i().createElement("div",{style:x},i().createElement("div",{style:k},i().createElement("span",{style:{fontWeight:"bold",fontSize:14}},null==n||null==(t=n.createdBy)?void 0:t.nickname),i().createElement("span",{style:{fontSize:14}},l("commented")),i().createElement(c.Tooltip,{title:(0,f.dayjs)(null==n?void 0:n.createdAt).format("YYYY-MM-DD HH:mm:ss")},i().createElement("span",{style:{fontSize:14}},(0,f.dayjs)(null==n?void 0:n.createdAt).fromNow()))),i().createElement("div",{style:E},i().createElement(p,null)))},i().createElement("div",{style:O},y&&(null==I?void 0:I.edit)?I.edit({value:M,onChange:function(e){A(e)},enableContextSelect:!1}):i().createElement(P,{value:null==n?void 0:n.content,markdown:o.context.markdown,liquid:o.context.liquid,translate:l,context:o.context}),y&&i().createElement("div",{style:j},i().createElement(c.Button,{type:"primary",onClick:function(){b(!1),z()}},l("Update Comment")),i().createElement(c.Button,{onClick:function(){b(!1)}},l("Cancel")))))))});function M(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 A(e,t,n,r,o,l,a){try{var c=e[l](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}var I=(0,a.observer)(function(e){var t,n,r,o=e.createAble,l=e.defaultValue,f=void 0===l?"":l,d=(0,a.useFlowModel)(),p=d.context.markdown,y=d.resource,b=(0,s.kj)(),v=c.App.useApp().message,h=function(e){if(Array.isArray(e))return e}(t=(0,u.useState)(f))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],l=!0,a=!1;try{for(r=r.call(e);!(l=(t=r.next()).done)&&(o.push(t.value),2!==o.length);l=!0);}catch(e){a=!0,n=e}finally{try{l||null==r.return||r.return()}finally{if(a)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return M(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return M(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),g=h[0],w=h[1];(0,u.useEffect)(function(){w(f)},[f]);var S=(0,u.useMemo)(function(){return g.trim().length>0},[g]),x=(0,u.useMemo)(function(){var e,t,n;return null==(n=d.collection)||null==(t=n.getFields().find(function(e){return"content"===e.name}))||null==(e=t.uiSchema)?void 0:e["x-component-props"]},[d.collection]),k=(0,u.useCallback)(function(){var e;return(e=function(){var e,t,n;return function(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var i=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,y.create({content:g})];case 1:return r.sent(),w(""),e=y.getMeta("count")||0,t=y.getPageSize()||10,y.setPage(Math.max(Math.ceil((e+1)/t),1)),[4,y.refresh()];case 2:return r.sent(),[3,4];case 3:return n=r.sent(),v.error((0,m.u)(n,b("Failed to create comment"))),[3,4];case 4:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var l=e.apply(t,n);function a(e){A(l,r,o,a,c,"next",e)}function c(e){A(l,r,o,a,c,"throw",e)}a(void 0)})})()},[g,v,y,b]);return void 0===o||o?i().createElement("div",{style:{marginTop:10}},(null==p?void 0:p.edit)?p.edit((n=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}({},(void 0===x?"undefined":x&&"u">typeof Symbol&&x.constructor===Symbol?"symbol":typeof x)=="object"?x:{}),r=r={value:g,quoteFlag:!0,onChange:function(e){w(e)},enableContextSelect:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(r)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}),n)):i().createElement(c.Input.TextArea,{value:g,onChange:function(e){return w(e.target.value)},autoSize:!0}),i().createElement(c.Button,{disabled:!S,onClick:k,type:"primary",style:{marginTop:10}},b("Comment"))):null});function z(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}var _=(0,a.observer)(function(e){var t,n=e.resource,r=e.handlePageChange,o=e.dataSource,l=function(e){if(Array.isArray(e))return e}(t=(0,u.useState)(""))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],l=!0,a=!1;try{for(r=r.call(e);!(l=(t=r.next()).done)&&(o.push(t.value),2!==o.length);l=!0);}catch(e){a=!0,n=e}finally{try{l||null==r.return||r.return()}finally{if(a)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return z(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return z(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s=l[0],f=l[1],d=(0,a.useFlowModel)();return d.context.defineMethod("setQuoteContent",function(e){f(e)}),i().createElement("div",null,i().createElement(c.List,{pagination:(null==n?void 0:n.getMeta("count"))>0&&{onChange:r,total:(null==n?void 0:n.getMeta("count"))||0,pageSize:n.getPageSize()||10,current:n.getPage()||1}},i().createElement("div",{style:{display:"flex",flexDirection:"column"}},(null==o?void 0:o.length)?o.map(function(e,t){var n=t===o.length-1;return i().createElement("div",{key:e.id,style:{position:"relative",padding:"".concat(0===t?0:"10px"," 0 ").concat(n?0:"10px"," 0")}},d.mapSubModels("items",function(t){var n=t.createFork({},"".concat(e.id,"-").concat(e.content||""));return n.context.defineProperty("record",{get:function(){return e},cache:!1}),i().createElement(a.FlowModelRenderer,{key:n.uid,model:n})}))}):null)),i().createElement(I,{defaultValue:s}))});function F(e,t,n,r,o,l,a){try{var c=e[l](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function R(e,t,n){return t=q(t),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}(e,W()?Reflect.construct(t,n||[],q(e).constructor):t.apply(e,n))}function B(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function T(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)}}function D(e,t,n){return t&&T(e.prototype,t),n&&T(e,n),e}function G(e,t,n){return(G="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=q(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n||e):o.value}})(e,t,n||e)}function q(e){return(q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(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&&U(e,t)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(W=function(){return!!e})()}var Y=function(e){function t(){return B(this,t),R(this,t,arguments)}return H(t,e),D(t,[{key:"render",value:function(){return i().createElement(C,{value:this.context.record,resource:this.context.blockModel.resource,model:this})}}]),t}(a.FlowModel),Z=function(e){function t(){return B(this,t),R(this,t,arguments)}return H(t,e),D(t,[{key:"resource",get:function(){return G(q(t.prototype),"resource",this)}},{key:"createResource",value:function(){var e=this.context.createResource(a.MultiRecordResource);return e.setPageSize(this.props.pageSize||20),e.addAppends("createdBy"),e}},{key:"handlePageChange",value:function(e){var t;return(t=function(){return function(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var i=[c,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,r=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(t){switch(t.label){case 0:return this.resource.setPage(e),this.resource.loading=!0,[4,this.refresh()];case 1:return t.sent(),[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,o){var l=t.apply(e,n);function a(e){F(l,r,o,a,c,"next",e)}function c(e){F(l,r,o,a,c,"throw",e)}a(void 0)})}).call(this)}},{key:"renderComponent",value:function(){var e=this,t=this.resource.getData();return"comment"!==this.collection.template?i().createElement(c.Alert,{message:this.context.t("The current collection is not a comment collection, so the comment block cannot be used.",{ns:"comments"}),type:"warning",showIcon:!0}):i().createElement(_,{dataSource:Array.isArray(t)?t:[],resource:this.resource,handlePageChange:function(t){e.handlePageChange(t)}})}}],[{key:"filterCollection",value:function(e){return"comment"===e.template}}]),t}(l.CollectionBlockModel);r="scene",o=l.BlockSceneEnum.oam,r in Z?Object.defineProperty(Z,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):Z[r]=o,Z.registerFlow({key:"commentsSettings",title:(0,s.MZ)("Comments settings"),on:"beforeRender",sort:150,steps:{pageSize:{title:(0,s.MZ)("Page size"),uiSchema:{pageSize:{"x-component":"Select","x-decorator":"FormItem",enum:[{label:"5",value:5},{label:"10",value:10},{label:"20",value:20},{label:"50",value:50},{label:"100",value:100},{label:"200",value:200}]}},defaultParams:{pageSize:20},handler:function(e,t){e.model.props.pageSize=t.pageSize,e.model.resource.loading=!0,e.model.resource.setPage(1),e.model.resource.setPageSize(t.pageSize)}},dataScope:{use:"dataScope"}}}),Z.define({label:(0,s.MZ)("Comments"),searchable:!0,searchPlaceholder:(0,s.MZ)("Search"),createModelOptions:{use:"CommentsBlockModel",subModels:{items:[{use:"CommentItemModel"}]}},sort:550})},626:function(e,t,n){n.d(t,{u:function(){return r}});var r=function(e,t){var n,r,o,l,a,c;return e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"?(null==(l=e.response)||null==(o=l.data)||null==(r=o.errors)||null==(n=r[0])?void 0:n.message)||(null==(c=e.response)||null==(a=c.data)?void 0:a.message)||e.message||t:t}}}]);
@@ -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_comments_client_v2=self.webpackChunk_nocobase_plugin_comments_client_v2||[]).push([["716"],{519:function(e,t,r){r.r(t),r.d(t,{DeleteCommentActionModel:function(){return O},EditCommentActionModel:function(){return S},CommentActionGroupModel:function(){return y},QuoteReplyActionModel:function(){return C},CommentActionModel:function(){return p}});var n,o=r(485),u=r(488);function c(e,t,r){return t=l(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,s()?Reflect.construct(t,r||[],l(e).constructor):t.apply(e,r))}function i(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(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&&f(e,t)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(s=function(){return!!e})()}var p=function(e){function t(){return i(this,t),c(this,t,arguments)}return a(t,e),t}(o.ActionModel),y=function(e){function t(){return i(this,t),c(this,t,arguments)}return a(t,e),t}(o.ActionGroupModel);(n="baseClass")in y?Object.defineProperty(y,n,{value:p,enumerable:!0,configurable:!0,writable:!0}):y[n]=p,y.define({label:(0,u.MZ)("Comment action")});var b=r(626);function v(e,t,r,n,o,u,c){try{var i=e[u](c),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}var O=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=d(t),h(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,g()?Reflect.construct(t,n||[],d(this).constructor):t.apply(this,n)),"defaultProps",{type:"link",title:(0,u.MZ)("Delete")}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&m(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}(p);function w(e,t,r,n,o,u,c){try{var i=e[u](c),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}h(O,"scene",o.ActionSceneEnum.record),O.define({label:(0,u.MZ)("Delete"),toggleable:!0}),O.registerFlow({key:"deleteSettings",title:(0,u.MZ)("Delete settings"),on:"click",steps:{confirm:{use:"confirm",defaultParams:{enable:!0,title:(0,u.MZ)("Delete record"),content:(0,u.MZ)("Are you sure you want to delete it?")}},delete:{handler:function(e){var t;return(t=function(){var t;return function(e,t){var r,n,o,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(c,"next",{value:l(0)}),i(c,"throw",{value:l(1)}),i(c,"return",{value:l(2)}),"function"==typeof Symbol&&i(c,Symbol.iterator,{value:function(){return this}}),c;function l(i){return function(l){var a=[i,l];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,a[0]&&(u=0)),u;)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 u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}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(r){switch(r.label){case 0:if(r.trys.push([0,3,,4]),!e.resource||!e.record||!e.collection)return e.message.error(e.t("No resource or record selected for deletion")),[2];return[4,e.resource.destroy(e.record[e.collection.filterTargetKey||"id"])];case 1:return r.sent(),[4,e.resource.refresh()];case 2:return r.sent(),e.message.success(e.t("Record deleted successfully")),[3,4];case 3:return t=r.sent(),e.message.error((0,b.u)(t,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 u=t.apply(e,r);function c(e){v(u,n,o,c,i,"next",e)}function i(e){v(u,n,o,c,i,"throw",e)}c(void 0)})})()}}}});function _(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(k=function(){return!!e})()}var S=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=j(t),_(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,k()?Reflect.construct(t,n||[],j(this).constructor):t.apply(this,n)),"defaultProps",{type:"link",title:(0,u.MZ)("Edit")}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&P(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}(p);function E(e,t,r,n,o,u,c){try{var i=e[u](c),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}_(S,"scene",o.ActionSceneEnum.record),S.define({label:(0,u.MZ)("Edit"),toggleable:!0}),S.registerFlow({key:"editCommentSettings",on:"click",steps:{edit:{handler:function(e){var t;return(t=function(){return function(e,t){var r,n,o,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(c,"next",{value:l(0)}),i(c,"throw",{value:l(1)}),i(c,"return",{value:l(2)}),"function"==typeof Symbol&&i(c,Symbol.iterator,{value:function(){return this}}),c;function l(i){return function(l){var a=[i,l];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,a[0]&&(u=0)),u;)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 u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}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 u=t.apply(e,r);function c(e){w(u,n,o,c,i,"next",e)}function i(e){w(u,n,o,c,i,"throw",e)}c(void 0)})})()}}}});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 M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}var C=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=M(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,R()?Reflect.construct(t,n||[],M(this).constructor):t.apply(this,n)),"defaultProps",{type:"link",title:(0,u.MZ)("Quote reply")}),e}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&A(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}(p);x(C,"scene",o.ActionSceneEnum.record),C.define({label:(0,u.MZ)("Quote reply"),toggleable:!0}),C.registerFlow({key:"quoteReplySettings",on:"click",steps:{quoteReply:{handler:function(e){var t;return(t=function(){var t,r,n,o,u;return function(e,t){var r,n,o,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(c,"next",{value:l(0)}),i(c,"throw",{value:l(1)}),i(c,"return",{value:l(2)}),"function"==typeof Symbol&&i(c,Symbol.iterator,{value:function(){return this}}),c;function l(i){return function(l){var a=[i,l];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,a[0]&&(u=0)),u;)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 u.label++,{value:a[1],done:!1};case 5:u.label++,n=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}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(c){return n=e.model.context.blockModel,o=null!=(t=null==(r=e.record)?void 0:r.content)?t:"",u="".concat(o.split("\n").map(function(e){return"> ".concat(e)}).join("\n")),n.context.setQuoteContent(u),[2]})},function(){var e=this,r=arguments;return new Promise(function(n,o){var u=t.apply(e,r);function c(e){E(u,n,o,c,i,"next",e)}function i(e){E(u,n,o,c,i,"throw",e)}c(void 0)})})()}}}})},626:function(e,t,r){r.d(t,{u:function(){return n}});var n=function(e,t){var r,n,o,u,c,i;return e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"?(null==(u=e.response)||null==(o=u.data)||null==(n=o.errors)||null==(r=n[0])?void 0:r.message)||(null==(i=e.response)||null==(c=i.data)?void 0:c.message)||e.message||t:t}}}]);
@@ -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 { default } from './plugin';
10
+ export * 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("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-comments/client-v2",["@nocobase/client-v2","react","antd","@ant-design/icons","@nocobase/flow-engine","@nocobase/utils/client"],t):"object"==typeof exports?exports["@nocobase/plugin-comments/client-v2"]=t(require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client")):e["@nocobase/plugin-comments/client-v2"]=t(e["@nocobase/client-v2"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"],e["@nocobase/utils/client"])}(self,function(e,t,n,r,o,i){return function(){"use strict";var c,u,a,l={488:function(e,t,n){n.d(t,{MZ:function(){return c},kj:function(){return i}});var r=n(694),o="comments";function i(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(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}({ns:[o,"client"]},n))}}function c(e){return(0,r.tExpr)(e,{ns:[o,"client"]})}},375:function(e){e.exports=r},485:function(t){t.exports=e},694:function(e){e.exports=o},768:function(e){e.exports=i},59:function(e){e.exports=n},155:function(e){e.exports=t}},s={};function f(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return l[e](n,n.exports,f),n.exports}f.m=l,f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce(function(t,n){return f.f[n](e,t),t},[]))},f.u=function(e){return""+e+"."+({638:"c5152390d43e7475",716:"0fffbfd9f6f60ddd"})[e]+".js"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p={},f.l=function(e,t,n,r){if(p[e])return void p[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var a=c[u];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-comments/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,f.nc&&o.setAttribute("nonce",f.nc),o.setAttribute("data-rspack","@nocobase/plugin-comments/client-v2:"+n),o.src=e),p[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=p[e];if(delete p[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(d=f.g.location+"");var p,d,b=f.g.document;if(!d&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(d=b.currentScript.src),!d)){var m=b.getElementsByTagName("script");if(m.length)for(var v=m.length-1;v>-1&&(!d||!/^http(s?):/.test(d));)d=m[v--].src}if(!d)throw Error("Automatic publicPath is not supported in this browser");f.p=d.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c={889:0},f.f.j=function(e,t){var n=f.o(c,e)?c[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=c[e]=[t,r]});t.push(n[2]=r);var o=f.p+f.u(e),i=Error();f.l(o,function(t){if(f.o(c,e)&&(0!==(n=c[e])&&(c[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)}},u=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],a=0;if(o.some(function(e){return 0!==c[e]})){for(n in i)f.o(i,n)&&(f.m[n]=i[n]);u&&u(f)}for(e&&e(t);a<o.length;a++)r=o[a],f.o(c,r)&&c[r]&&c[r][0](),c[r]=0},(a=self.webpackChunk_nocobase_plugin_comments_client_v2=self.webpackChunk_nocobase_plugin_comments_client_v2||[]).forEach(u.bind(null,0)),a.push=u.bind(null,a.push.bind(a));var h={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-comments/dist/client-v2/")}if(!e){var r=window.__nocobase_modern_client_prefix__||"v",o="/"+(r=String(r).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",c=i.indexOf(o);e=c>=0?i.slice(0,c+1):"/"}e&&(e=e.replace(RegExp("/"+r+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-comments/dist/client-v2/"}f.p=e}(),!function(){f.r(h),f.d(h,{PluginCommentClientV2:function(){return a},default:function(){return l}});var e=f(485),t=f(488);function n(e,t,n,r,o,i,c){try{var u=e[i](c),a=u.value}catch(e){n(e);return}u.done?t(a):Promise.resolve(a).then(r,o)}function r(e,t,n){return(r=u()?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 c(e){var t="function"==typeof Map?new Map:void 0;return(c=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 u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var a=function(e){var r;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function c(){var e,t;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return e=c,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,u()?Reflect.construct(e,t||[],o(this).constructor):e.apply(this,t))}return c.prototype=Object.create(e&&e.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),e&&i(c,e),r=[{key:"load",value:function(){var e;return(e=function(){var e,n;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:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(r){return this.flowEngine.registerModelLoaders({CommentsBlockModel:{loader:function(){return f.e("638").then(f.bind(f,197))}},CommentItemModel:{loader:function(){return f.e("638").then(f.bind(f,197))}},CommentActionGroupModel:{loader:function(){return f.e("716").then(f.bind(f,519))}},EditCommentActionModel:{loader:function(){return f.e("716").then(f.bind(f,519))}},DeleteCommentActionModel:{loader:function(){return f.e("716").then(f.bind(f,519))}},QuoteReplyActionModel:{loader:function(){return f.e("716").then(f.bind(f,519))}}}),null==(n=this.app.pm.get("@nocobase/plugin-data-source-manager")||this.app.pm.get("data-source-manager"))||null==(e=n.registerCollectionTemplate)||e.call(n,{name:"comment",title:(0,t.MZ)("Comment Collection"),order:22,color:"orange",collection:{options:{template:"comment"},fields:[{name:"content",type:"text",length:"long",interface:"vditor",deletable:!1,uiSchema:{type:"string",title:(0,t.MZ)("Comment Content"),interface:"vditor","x-component":"MarkdownVditor"}}]},presetFields:{disabled:!0}}),[2]})},function(){var t=this,r=arguments;return new Promise(function(o,i){var c=e.apply(t,r);function u(e){n(c,o,i,u,a,"next",e)}function a(e){n(c,o,i,u,a,"throw",e)}u(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)}}(c.prototype,r),c}(c(e.Plugin)),l=a}(),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 = "comments";
10
+ export declare function useT(): (key: string, options?: Record<string, any>) => string;
11
+ export declare function tExpr(key: string): string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export declare const CommentActions: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<unknown>>;
@@ -0,0 +1,38 @@
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 MultiRecordResource } from '@nocobase/flow-engine';
10
+ import React from 'react';
11
+ type CommentRecord = {
12
+ id: string | number;
13
+ content?: string;
14
+ createdAt?: string;
15
+ createdBy?: {
16
+ nickname?: string;
17
+ };
18
+ };
19
+ type MarkdownRuntime = {
20
+ edit: (props: Record<string, unknown>) => React.ReactNode;
21
+ render: (value: string, options: Record<string, unknown>) => React.ReactNode;
22
+ };
23
+ type LiquidRuntime = {
24
+ renderWithFullContext: (value: string, context: unknown) => Promise<string>;
25
+ };
26
+ type CommentItemProps = {
27
+ value: CommentRecord;
28
+ resource: MultiRecordResource;
29
+ model: {
30
+ context: {
31
+ markdown?: MarkdownRuntime;
32
+ liquid?: LiquidRuntime;
33
+ defineMethod: (name: string, method: (...args: unknown[]) => unknown) => void;
34
+ };
35
+ };
36
+ };
37
+ export declare const CommentItem: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<CommentItemProps>>;
38
+ export {};
@@ -0,0 +1,21 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { type MultiRecordResource } from '@nocobase/flow-engine';
10
+ import React from 'react';
11
+ type CommentRecord = {
12
+ id: string | number;
13
+ content?: string;
14
+ };
15
+ type CommentListProps = {
16
+ resource: MultiRecordResource;
17
+ handlePageChange: (page: number) => void;
18
+ dataSource?: CommentRecord[];
19
+ };
20
+ export declare const CommentList: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<CommentListProps>>;
21
+ 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 React from 'react';
10
+ type CommentSubmitProps = {
11
+ createAble?: boolean;
12
+ defaultValue?: string;
13
+ };
14
+ export declare const CommentSubmit: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<CommentSubmitProps>>;
15
+ export {};
@@ -0,0 +1,28 @@
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 } from '@nocobase/client-v2';
10
+ import { FlowModel, MultiRecordResource, type Collection } from '@nocobase/flow-engine';
11
+ import React from 'react';
12
+ type CommentsBlockStructure = {
13
+ subModels: {
14
+ items: CommentItemModel[];
15
+ };
16
+ };
17
+ export declare class CommentItemModel extends FlowModel {
18
+ render(): React.JSX.Element;
19
+ }
20
+ export declare class CommentsBlockModel extends CollectionBlockModel<CommentsBlockStructure> {
21
+ static scene: import("@nocobase/client-v2").BlockSceneType;
22
+ static filterCollection(collection: Collection): boolean;
23
+ get resource(): MultiRecordResource<any>;
24
+ createResource(): MultiRecordResource<unknown>;
25
+ handlePageChange(page: number): Promise<void>;
26
+ renderComponent(): React.JSX.Element;
27
+ }
28
+ export {};
@@ -0,0 +1,14 @@
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
+ export declare class CommentActionModel extends ActionModel {
11
+ }
12
+ export declare class CommentActionGroupModel extends ActionGroupModel {
13
+ static baseClass: typeof CommentActionModel;
14
+ }
@@ -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 { CommentActionModel } from './CommentActionGroupModel';
11
+ export declare class DeleteCommentActionModel extends CommentActionModel {
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 { CommentActionModel } from './CommentActionGroupModel';
11
+ export declare class EditCommentActionModel extends CommentActionModel {
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 { CommentActionModel } from './CommentActionGroupModel';
11
+ export declare class QuoteReplyActionModel extends CommentActionModel {
12
+ static scene: import("@nocobase/client-v2").ActionSceneType;
13
+ defaultProps: ButtonProps;
14
+ getAclActionName(): string;
15
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export * from './CommentActionGroupModel';
10
+ export * from './DeleteCommentActionModel';
11
+ export * from './EditCommentActionModel';
12
+ export * from './QuoteReplyActionModel';
@@ -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,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Application, Plugin } from '@nocobase/client-v2';
10
+ export declare class PluginCommentClientV2 extends Plugin<any, Application> {
11
+ load(): Promise<void>;
12
+ }
13
+ export default PluginCommentClientV2;
@@ -8,17 +8,19 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-beta.46",
11
+ "@nocobase/client": "2.1.0-beta.48",
12
12
  "react": "18.2.0",
13
- "@nocobase/server": "2.1.0-beta.46",
13
+ "@nocobase/flow-engine": "2.1.0-beta.48",
14
+ "@nocobase/client-v2": "2.1.0-beta.48",
15
+ "@nocobase/plugin-data-source-manager": "2.1.0-beta.48",
16
+ "@nocobase/server": "2.1.0-beta.48",
14
17
  "@formily/core": "2.3.7",
15
18
  "@formily/react": "2.3.7",
16
19
  "antd": "5.24.2",
17
20
  "dayjs": "1.11.13",
18
21
  "lodash": "4.18.1",
19
- "@nocobase/utils": "2.1.0-beta.46",
22
+ "@nocobase/utils": "2.1.0-beta.48",
20
23
  "react-i18next": "11.18.6",
21
24
  "@ant-design/icons": "5.6.1",
22
- "@nocobase/flow-engine": "2.1.0-beta.46",
23
25
  "@formily/reactive-react": "2.3.7"
24
26
  };
@@ -8,8 +8,12 @@
8
8
  "Delete": "Delete",
9
9
  "Edit": "Edit",
10
10
  "Enable Create": "Allow adding comments",
11
+ "Failed to create comment": "Failed to create comment",
12
+ "Failed to delete comment": "Failed to delete comment",
13
+ "Failed to update comment": "Failed to update comment",
11
14
  "Quote Reply": "Quote reply",
12
15
  "Quote reply": "Quote reply",
16
+ "Render error": "Render error",
13
17
  "Update Comment": "Update comment",
14
18
  "commented": "commented"
15
- }
19
+ }
@@ -8,8 +8,12 @@
8
8
  "Delete": "删除",
9
9
  "Edit": "编辑",
10
10
  "Enable Create": "允许增加评论",
11
+ "Failed to create comment": "创建评论失败",
12
+ "Failed to delete comment": "删除评论失败",
13
+ "Failed to update comment": "更新评论失败",
11
14
  "Quote Reply": "引用并回复",
12
15
  "Quote reply": "引用并回复",
16
+ "Render error": "渲染错误",
13
17
  "Update Comment": "更新评论",
14
18
  "commented": "评论于",
15
19
  "The current collection is not a comment collection, so the comment block cannot be used.": "当前表不是评论表,无法使用评论区块。",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-comments",
3
- "version": "2.1.0-beta.46",
3
+ "version": "2.1.0-beta.48",
4
4
  "displayName": "Comments",
5
5
  "displayName.zh-CN": "评论",
6
6
  "description": "Provides comment collection template and block to add commenting functionality for any collection.",
@@ -25,8 +25,11 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@nocobase/client": "2.x",
28
+ "@nocobase/client-v2": "2.x",
29
+ "@nocobase/flow-engine": "2.x",
30
+ "@nocobase/plugin-data-source-manager": "2.x",
28
31
  "@nocobase/server": "2.x",
29
32
  "@nocobase/test": "2.x"
30
33
  },
31
- "gitHead": "91fd3ab238a5ff58735bbfca04a8cb05d233b0af"
34
+ "gitHead": "f8c27a286db015c5e433b48241f14c0412e50530"
32
35
  }