@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.
- package/LICENSE.txt +107 -0
- package/README.md +1 -0
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/41.6fb2aeb406824e12.js +10 -0
- package/dist/client/549.a88deaa9432f2fd7.js +10 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale.d.ts +11 -0
- package/dist/client/models/index.d.ts +11 -0
- package/dist/client/plugin.d.ts +13 -0
- package/dist/client-v2/41.53a11114c9f0edde.js +10 -0
- package/dist/client-v2/549.ecb8a67e5af9a534.js +10 -0
- package/dist/client-v2/index.d.ts +9 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +11 -0
- package/dist/client-v2/models/RecordCommentsBlockModel.d.ts +58 -0
- package/dist/client-v2/models/actions/DeleteRecordCommentActionModel.d.ts +15 -0
- package/dist/client-v2/models/actions/EditRecordCommentActionModel.d.ts +15 -0
- package/dist/client-v2/models/actions/QuoteReplyRecordCommentActionModel.d.ts +15 -0
- package/dist/client-v2/models/actions/RecordCommentActionGroupModel.d.ts +19 -0
- package/dist/client-v2/models/actions/RecordCommentSubmitActionModel.d.ts +23 -0
- package/dist/client-v2/models/actions/index.d.ts +13 -0
- package/dist/client-v2/models/components/RecordCommentActions.d.ts +20 -0
- package/dist/client-v2/models/components/RecordCommentFieldSelect.d.ts +15 -0
- package/dist/client-v2/models/components/RecordCommentsBlockView.d.ts +35 -0
- package/dist/client-v2/models/utils/errors.d.ts +9 -0
- package/dist/client-v2/models/utils.d.ts +131 -0
- package/dist/client-v2/plugin.d.ts +13 -0
- package/dist/externalVersion.js +22 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +49 -0
- package/dist/locale/zh-CN.json +49 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +42 -0
- package/dist/server/plugin.d.ts +19 -0
- package/dist/server/plugin.js +54 -0
- package/package.json +20 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Updated Date: February 24, 2026
|
|
2
|
+
|
|
3
|
+
NocoBase License Agreement
|
|
4
|
+
|
|
5
|
+
NOCOBASE PTE. LTD.,a Singaporean Exempt Private Company Limited by Shares with its principal place of business located at 112 ROBINSON ROAD, #03-01, SINGAPORE ("The Company") https://www.nocobase.com/ issues this License Agreement ("Agreement") to you. You, as an individual or a company ("The User"), will be deemed to voluntarily accept all terms of this Agreement by using NocoBase (including but not limited to obtaining NocoBase source code or installation package in any form, installing and using NocoBase, purchasing NocoBase commercial license and services, purchasing NocoBase commercial plugins). If the User does not agree to any term of this Agreement, or cannot accurately understand our interpretation of the relevant terms, please stop using it immediately.
|
|
6
|
+
|
|
7
|
+
This Agreement applies to any use, quotation, contract, invoice, and all software delivered by the Company. The User and the Company or NocoBase's agents can no longer sign a separate license agreement for the sale and delivery of the software.
|
|
8
|
+
|
|
9
|
+
The Company reserves the right to formulate and modify this Agreement from time to time as needed. If there are changes, the Company will announce them in the form of website announcements, without further individual notification. The changed Agreement will automatically take effect once it is announced, becoming part of this Agreement.
|
|
10
|
+
|
|
11
|
+
==============
|
|
12
|
+
1. Definitions
|
|
13
|
+
==============
|
|
14
|
+
|
|
15
|
+
1.1 "Software" refers to the NocoBase kernel and plugins placed in the same code repository as the kernel, including their source code, installation packages, images, and all their modifications, updates, and upgrades.
|
|
16
|
+
|
|
17
|
+
1.2 "Community Edition" refers to the free version of the Software provided to the User through public channels.
|
|
18
|
+
|
|
19
|
+
1.3 "Commercial Edition" refers to the paid version of the Software purchased by the User from the Company or its agents, downloaded through exclusive channels, and includes additional benefits. It consists of three versions: Standard Edition, Professional Edition, and Enterprise Edition.
|
|
20
|
+
|
|
21
|
+
1.4 "Upper Layer Application" refers to a specific business use case application serving internal or external customers of the User, developed based on Software and Commercial Plugins, such as ERP/CRM.
|
|
22
|
+
|
|
23
|
+
1.5 "Customer" refers to the clients who purchase the User's Upper Layer Application.
|
|
24
|
+
|
|
25
|
+
1.6 "Third-Party Open Source Software" refers to open source software provided with Software and Commercial Plugins. They are licensed through various published open source software licenses or copyright notices accompanying such software.
|
|
26
|
+
|
|
27
|
+
===================================
|
|
28
|
+
2. Intellectual Property Protection
|
|
29
|
+
===================================
|
|
30
|
+
|
|
31
|
+
Except for Third-Party Open Source Software, the Company owns all copyrights, trademark rights, patent rights, trade secrets, and other intellectual property rights of the Software, and has registered and protected them in relevant countries and regions according to the "Paris Convention" or "TRIPS Agreement", ensuring that the intellectual property rights of the Software and Commercial Plugins are internationally recognized and protected.
|
|
32
|
+
|
|
33
|
+
=============
|
|
34
|
+
3. Disclaimer
|
|
35
|
+
=============
|
|
36
|
+
|
|
37
|
+
3.1 The User shall not use the Software and Commercial Plugins to engage in activities that contravene applicable laws and regulations or offend against public order or religious prohibitions. All legal liabilities and consequences arising from the User’s use shall be borne by the User.
|
|
38
|
+
|
|
39
|
+
3.2 The Company shall not be liable for any direct, indirect, special, incidental, or consequential damages (including but not limited to loss of profits, business interruption, data loss, or business information disclosure) caused by the User's use of the Software and Commercial Plugins, even if it has been previously informed of the possibility of such damages.
|
|
40
|
+
|
|
41
|
+
===============
|
|
42
|
+
4. License Type
|
|
43
|
+
===============
|
|
44
|
+
|
|
45
|
+
4.1 This Agreement serves as the unified license agreement for NocoBase Software, applying to both the Community Edition and the Commercial Editions.
|
|
46
|
+
|
|
47
|
+
4.2 This Agreement incorporates and references the full text of the Apache License, Version 2.0 ("Apache-2.0", available at: https://www.apache.org/licenses/LICENSE-2.0 ). Users must comply with the Apache-2.0 License as well as the supplementary terms set forth in this Agreement. In case of any inconsistency between Apache-2.0 and this Agreement, the supplementary terms of this Agreement shall prevail.
|
|
48
|
+
|
|
49
|
+
================================================
|
|
50
|
+
5. Rights and Obligations of Open Source License
|
|
51
|
+
================================================
|
|
52
|
+
|
|
53
|
+
5.1 The Software can be used for commercial purposes.
|
|
54
|
+
|
|
55
|
+
5.2 It is not allowed to remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface, except for the main LOGO in the upper left corner of the page.
|
|
56
|
+
|
|
57
|
+
5.3 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
|
|
58
|
+
|
|
59
|
+
5.4 It is not allowed to provide to the public any form of no-code, zero-code, low-code, AI platform SaaS/PaaS products using the original or modified Software.
|
|
60
|
+
|
|
61
|
+
===============================
|
|
62
|
+
6. Rights of Commercial License
|
|
63
|
+
===============================
|
|
64
|
+
|
|
65
|
+
6.1 Obtain a permanent commercial license of the Software.
|
|
66
|
+
|
|
67
|
+
6.2 Get software upgrades and exclusive technical support during the upgrade validity period.
|
|
68
|
+
|
|
69
|
+
6.3 The licensed Software can be used for commercial purposes with no restrictions on the number of applications and users.
|
|
70
|
+
|
|
71
|
+
6.4 Can remove or change the brand, name, link, version number, license, and other information about NocoBase on the Software interface.
|
|
72
|
+
|
|
73
|
+
6.5 The User holding a Professional or Enterprise Edition License can sell Upper Layer Application to its Customers.
|
|
74
|
+
|
|
75
|
+
6.6 If there are other agreements in the contract for the above rights, the contract agreement shall prevail.
|
|
76
|
+
|
|
77
|
+
====================================
|
|
78
|
+
7. Obligations of Commercial License
|
|
79
|
+
====================================
|
|
80
|
+
|
|
81
|
+
7.1 It is not allowed to remove or change all intellectual property statements about NocoBase in the code.
|
|
82
|
+
|
|
83
|
+
7.2 It is not allowed to sell, transfer, lease, share, gift, or distribute the Commercial License.
|
|
84
|
+
|
|
85
|
+
7.3 It is not allowed to sell, transfer, lease, share, or distribute any form of no-code, zero-code, low-code, AI platform, or developer tools developed based on Software.
|
|
86
|
+
|
|
87
|
+
7.4 It is not allowed to provide any form of no-code, zero-code, low-code, AI platform SaaS/PaaS products to the public using the original or modified Software.
|
|
88
|
+
|
|
89
|
+
7.5 It is not allowed for the User holding a Standard Edition license to sell Upper Layer Application to Customers without a Commercial license.
|
|
90
|
+
|
|
91
|
+
7.6 It is not allowed for the User holding a Professional or Enterprise Edition license to sell Upper Layer Application to Customers without a Commercial license with access to further development and configuration.
|
|
92
|
+
|
|
93
|
+
7.7 If there is a violation of the above obligations or the terms of this Agreement, the rights owned by the User will be immediately terminated, the paid fees will not be refunded, and the Company reserves the right to pursue the User's legal responsibility.
|
|
94
|
+
|
|
95
|
+
7.8 If there are other agreements in the contract for the above obligations, the contract agreement shall prevail.
|
|
96
|
+
|
|
97
|
+
=============================================================
|
|
98
|
+
8. Legal Jurisdiction, Interpretation, and Dispute Resolution
|
|
99
|
+
=============================================================
|
|
100
|
+
|
|
101
|
+
8.1 Except for Mainland China, the interpretation, application, and all matters related to this agreement are subject to the jurisdiction of Singapore law.
|
|
102
|
+
|
|
103
|
+
8.2 Any dispute related to this Agreement should first be resolved through friendly negotiation. If the negotiation fails to resolve the dispute, the dispute should be submitted to the International Chamber of Commerce (ICC) for arbitration. The arbitration venue should be Singapore, conducted in English.
|
|
104
|
+
|
|
105
|
+
8.3 All terms and conditions of this Agreement shall be deemed enforceable to the maximum extent permitted by applicable law. If any term of this Agreement is deemed invalid by any applicable law, the invalidity of that term does not affect the validity of any other term of this Agreement, and it should be deemed that the invalid term has been modified as much as possible to make it valid and enforceable, or if the term cannot be modified, it should be deemed to have been deleted from this Agreement.
|
|
106
|
+
|
|
107
|
+
8.4 The arbitration award is final, binding on both parties, and can be enforced in any court with jurisdiction.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @nocobase/plugin-block-comment
|
package/client-v2.d.ts
ADDED
package/client-v2.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client-v2/index.js');
|
package/client.d.ts
ADDED
package/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client/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_block_comment=self.webpackChunk_nocobase_plugin_block_comment||[]).push([["41"],{672:function(e,t,n){n.r(t),n.d(t,{RecordCommentItemModel:function(){return em},RecordCommentsBlockModel:function(){return ef}});var r=n(992),o=n(485),i=n(694),l=n(59),a=n(155),c=n.n(a),u=n(488),s=n(375),d=n(768),m=n(394),f=n(626),p=n(477);function g(){var e,t,n=(e=["\n .ant-btn-link {\n height: auto;\n padding: 0;\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return g=function(){return n},n}var h=function(e){return String(null!=e?e:"").replace(/[^a-zA-Z0-9_-]+/g,"_")||"fork"},y=function(e,t){var n=e.forkId;return"".concat(e.uid,":").concat(null!=n?n:t)},b=(0,p.css)(g()),v=new Set(["QuoteReplyRecordCommentActionModel","EditRecordCommentActionModel","DeleteRecordCommentActionModel"]),w=(0,i.observer)(function(e){var t=e.blockModel,n=e.record,r=e.itemModel,o=e.actionSettingsModel,a=void 0===o?r:o,u=e.forkKeyPrefix,d=e.setEditing,m=(0,f.gX)(n,t.collection),p=new Set;return c().createElement(i.DndProvider,null,c().createElement(l.Space,{size:4,className:b},r.mapSubModels("actions",function(e,r){var o=e.constructor.name;if(v.has(o)){if(p.has(o))return null;p.add(o)}var l=[u,m||"record",e.uid,r].map(h).join("_"),a=e.createFork({},l);return a.context.defineProperty("record",{get:function(){return n}}),a.context.defineProperty("resource",{get:function(){return t.resource}}),a.context.defineProperty("collection",{get:function(){return t.collection}}),a.context.defineProperty("blockModel",{get:function(){return t}}),a.context.defineMethod("setEditing",d),c().createElement(i.Droppable,{model:a,key:y(a,l)},c().createElement(i.FlowModelRenderer,{model:a,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:i.DragHandler,sort:1}]}))}),r.context.flowSettingsEnabled?c().createElement(i.AddSubModelButton,{key:"record-comment-actions-add",model:a,subModelKey:"actions",subModelBaseClasses:["RecordCommentActionGroupModel"]},c().createElement(i.FlowSettingsButton,{icon:c().createElement(s.SettingOutlined,null)},a.translate("Actions"))):null))});function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function P(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function S(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){P(i,r,o,l,a,"next",e)}function a(e){P(i,r,o,l,a,"throw",e)}l(void 0)})}}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(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){k(e,t,n[t])})}return e}function M(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}function C(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 i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F(e,t)}}(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 E(e,t){var n,r,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),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var O={display:"flex",flexDirection:"column"},A={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"42px"},I={backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6},j={position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px",minHeight:24},V={marginTop:12},L={marginTop:10,display:"flex",columnGap:5},R={position:"relative",zIndex:1},T={position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0},_={marginRight:16,flexShrink:0},z={marginTop:10,display:"flex",alignItems:"center",columnGap:8,flexWrap:"wrap"},D=function(e){return String(null!=e?e:"").replace(/[^a-zA-Z0-9_-]+/g,"_")||"fork"},B=function(e,t){var n=e.forkId;return"".concat(e.uid,":").concat(null!=n?n:t)},J=function(e){var t,n=(0,f.Tf)(e.collection,e.mapping.contentField),r=null==n||null==(t=n.uiSchema)?void 0:t["x-component-props"];return r&&(void 0===r?"undefined":r&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)=="object"?r:{}},K=function(e){var t;return null==(t=e.context.user)?void 0:t.id},Z=function(e){var t=e.mapping.commenterField,n=(0,f.Tf)(e.collection,t),r=K(e);return t&&(null==n?void 0:n.interface)!=="createdBy"&&void 0!==r?k({},t,r):{}},G=function(e){var t=e.mapping.dateField,n=(0,f.Tf)(e.collection,t),r=(null==n?void 0:n.interface)||(null==n?void 0:n.type);return t&&"createdAt"!==t&&"updatedAt"!==t&&(null==n?void 0:n.interface)!=="createdAt"&&(null==n?void 0:n.interface)!=="updatedAt"?"unixTimestamp"===r?k({},t,(0,d.dayjs)().unix()):"dateOnly"===r?k({},t,(0,d.dayjs)().format("YYYY-MM-DD")):"time"===r?k({},t,(0,d.dayjs)().format("HH:mm:ss")):k({},t,(0,d.dayjs)().toISOString()):{}},H=(0,i.observer)(function(e){var t=e.value,n=e.model,r=(0,u.kj)(),o=C((0,a.useState)(null),2),i=o[0],l=o[1],s=n.context,d=(0,a.useRef)(r);return d.current=r,(0,a.useEffect)(function(){var e=!0;return S(function(){var r,o,i,a,u,f;return E(this,function(p){switch(p.label){case 0:if(null==t||""===t)return l(null),[2];p.label=1;case 1:if(p.trys.push([1,5,,6]),o=String(t),!s.liquid)return[3,3];return[4,s.liquid.renderWithFullContext(o,n.context)];case 2:return a=p.sent(),[3,4];case 3:a=o,p.label=4;case 4:return i=a,u=(null==(r=s.markdown)?void 0:r.render)?s.markdown.render(d.current(i),{ellipsis:!1,textOnly:!1}):i,e&&l(u),[3,6];case 5:return f=p.sent(),e&&l(c().createElement("pre",{style:{color:"red"}},(0,m.u)(f,d.current("Render error")))),[3,6];case 6:return[2]}})})().catch(function(t){e&&l(c().createElement("pre",{style:{color:"red"}},(0,m.u)(t,d.current("Render error"))))}),function(){e=!1}},[s.liquid,s.markdown,n,t]),c().createElement(c().Fragment,null,i)}),q=(0,i.observer)(function(e){var t,n=e.blockModel,r=e.itemModel,l=(e.actionSettingsModel,e.record),a=e.forkKeyPrefix,u=null==(t=r.subModels)?void 0:t.bodyFields,s=!!n.context.flowSettingsEnabled;if(!u||!s&&!u.hasSubModel("items"))return null;var d=u.createFork({},"".concat(a,"_body_fields"));return d.gridContainerRef=c().createRef(),d.context.defineProperty("record",{get:function(){return l},cache:!1}),d.context.defineProperty("currentObject",{get:function(){return l},cache:!1}),d.context.defineProperty("fieldIndex",{get:function(){return a},cache:!1}),d.context.defineProperty("fieldKey",{get:function(){return a}}),d.context.defineProperty("blockModel",{get:function(){return n}}),d.context.defineProperty("collection",{get:function(){return n.collection}}),d.context.defineProperty("resource",{get:function(){return n.resource}}),c().createElement("div",{style:V},c().createElement(o.FormComponent,{model:n,layoutProps:n.props},c().createElement(i.FlowModelRenderer,{model:d,showFlowSettings:!1})))}),N=(0,i.observer)(function(e){var t,n=e.model,r=e.forkKeyPrefix,o=(0,u.kj)(),i=l.App.useApp().message,s=C((0,a.useState)(""),2),d=s[0],f=s[1],p=C((0,a.useState)(!1),2),g=p[0],h=p[1],y=n.context,b=n.mapping,v=(0,a.useMemo)(function(){return d.trim().length>0},[d]);n.context.defineMethod("setQuoteContent",function(e){f(e)});var w=(0,a.useCallback)(function(e){return S(function(){var t,r,l,a,c,u;return E(this,function(s){switch(s.label){case 0:if(!b.contentField||!b.ownerField||void 0===n.ownerValue)return[2];h(!0),s.label=1;case 1:return s.trys.push([1,4,5,6]),r=x((k(t={},b.contentField,d),k(t,b.ownerField,n.ownerValue),t),Z(n),G(n),(null==e?void 0:e.assignedValues)||{}),[4,n.resource.create(r,M(x({},(null==e?void 0:e.requestConfig)||{}),{refresh:!1}))];case 2:return l=s.sent(),f(""),n.shouldAutoJumpToLastPage()&&(a=n.resource.getCount()||0,c=n.resource.getPageSize()||10,n.resource.setPage(Math.max(Math.ceil((a+1)/c),1))),[4,n.resource.refresh()];case 3:return s.sent(),[2,l];case 4:throw u=s.sent(),i.error((0,m.u)(u,o("Failed to create comment"))),u;case 5:return h(!1),[7];case 6:return[2]}})})()},[d,b.contentField,b.ownerField,i,n,o]),F=(0,a.useCallback)(function(){return S(function(){return E(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,w()];case 1:case 2:return e.sent(),[3,3];case 3:return[2]}})})()},[w]);return c().createElement("div",{style:{marginTop:10}},(null==(t=y.markdown)?void 0:t.edit)?y.markdown.edit(M(x({},J(n)),{value:d,quoteFlag:!0,onChange:function(e){f(e)},enableContextSelect:!1})):c().createElement(l.Input.TextArea,{"aria-label":o("Comment content"),value:d,onChange:function(e){return f(e.target.value)},autoSize:!0}),c().createElement("div",{style:z},c().createElement(Y,{model:n,content:d,canSubmit:v,submitting:g,setContent:f,handleFallbackSubmit:F,submit:w,forkKeyPrefix:r})))}),Y=(0,i.observer)(function(e){var t,n=e.model,r=e.content,o=e.canSubmit,a=e.submitting,d=e.setContent,m=e.handleFallbackSubmit,f=e.submit,p=e.forkKeyPrefix,g=(0,u.kj)(),h=((null==(t=n.subModels)?void 0:t.submitActions)||[]).some(function(e){return"RecordCommentSubmitActionModel"===e.constructor.name});return c().createElement(i.DndProvider,null,c().createElement(l.Space,{size:8,wrap:!0},h?null:c().createElement(l.Button,{disabled:!o,loading:a,onClick:m,type:"primary"},g("Comment")),n.mapSubModels("submitActions",function(e,t){var l=e.createFork({},"".concat(p,"_submit_").concat(D(e.uid),"_").concat(t));return l.context.defineProperty("resource",{get:function(){return n.resource}}),l.context.defineProperty("collection",{get:function(){return n.collection}}),l.context.defineProperty("blockModel",{get:function(){return n}}),l.context.defineProperty("commentContent",{get:function(){return r},cache:!1}),l.context.defineProperty("commentCanSubmit",{get:function(){return o},cache:!1}),l.context.defineProperty("commentSubmitting",{get:function(){return a},cache:!1}),l.context.defineMethod("setCommentContent",d),l.context.defineMethod("submitComment",f),c().createElement(i.Droppable,{model:l,key:B(l,"".concat(p,"_submit_").concat(t))},c().createElement(i.FlowModelRenderer,{model:l,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:i.DragHandler,sort:1}]}))}),n.context.flowSettingsEnabled?c().createElement(i.AddSubModelButton,{key:"record-comment-submit-actions-add",model:n,subModelKey:"submitActions",subModelBaseClasses:["RecordCommentSubmitActionGroupModel"]},c().createElement(i.FlowSettingsButton,{icon:c().createElement(s.SettingOutlined,null)},n.translate("Actions"))):null))}),Q=(0,i.observer)(function(e){var t,n,r=e.blockModel,o=e.itemModel,i=e.actionSettingsModel,s=e.record,p=e.forkKeyPrefix,g=(0,u.kj)(),h=l.App.useApp().message,y=r.context,b=r.mapping,v=String(s[b.contentField||""]||""),F=C((0,a.useState)(!1),2),P=F[0],O=F[1],V=C((0,a.useState)(v),2),T=V[0],z=V[1],D=C((0,a.useState)(!1),2),B=D[0],K=D[1],Z=(t=g("Comment"),b.commenterField?(0,f.O2)(s[b.commenterField]):t),G=b.dateField?s[b.dateField]:void 0,N=(0,f.gX)(s,r.collection);(0,a.useEffect)(function(){z(v)},[v]);var Y=(0,a.useCallback)(function(){z(v),O(!1)},[v]),Q=(0,a.useCallback)(function(){return S(function(){var e;return E(this,function(t){switch(t.label){case 0:if(!N||!b.contentField)return[2];K(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,r.resource.update(N,k({},b.contentField,T))];case 2:return t.sent(),O(!1),[3,5];case 3:return e=t.sent(),h.error((0,m.u)(e,g("Failed to update comment"))),[3,5];case 4:return K(!1),[7];case 5:return[2]}})})()},[r.resource,b.contentField,h,N,g,T]);return c().createElement("div",{style:R},c().createElement(l.Card,{size:"small",styles:{header:{padding:0,fontWeight:"normal",backgroundColor:"#f6f8fa"}},title:c().createElement("div",{style:A},c().createElement("div",{style:I},c().createElement("span",{style:{fontWeight:"bold",fontSize:14}},Z),G?c().createElement(l.Tooltip,{title:(0,d.dayjs)(G).format("YYYY-MM-DD HH:mm:ss")},c().createElement("span",{style:{fontSize:14}},(0,d.dayjs)(G).fromNow())):null),c().createElement("div",{style:_},c().createElement(w,{blockModel:r,record:s,itemModel:o,actionSettingsModel:i,forkKeyPrefix:p,setEditing:function(){O(!0)}})))},c().createElement("div",{style:j},P&&(null==(n=y.markdown)?void 0:n.edit)?y.markdown.edit(M(x({},J(r)),{value:T,onChange:function(e){z(e)},enableContextSelect:!1})):P?c().createElement(l.Input.TextArea,{"aria-label":g("Comment content"),value:T,onChange:function(e){return z(e.target.value)},autoSize:!0}):c().createElement(c().Fragment,null,c().createElement(H,{value:s[b.contentField||""],model:r}),c().createElement(q,{blockModel:r,itemModel:o,record:s,forkKeyPrefix:p})),P?c().createElement("div",{style:L},c().createElement(l.Button,{type:"primary",loading:B,onClick:Q},g("Update Comment")),c().createElement(l.Button,{onClick:Y},g("Cancel"))):null)))}),U=Object.assign((0,i.observer)(function(e){var t=e.model,n=e.dataSource,r=e.onPageChange,o=(0,u.kj)(),i=t.resource,s=i.getPage()||1,d=i.getPageSize()||20,m=i.getCount()||0,p=D((0,a.useId)()),g="".concat(D(t.uid),"_").concat(p),h=t.isPreparingLastPageLoad(),y=h?[]:n;return(0,a.useEffect)(function(){S(function(){return E(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,t.ensureLastPageLoaded()];case 1:case 2:return e.sent(),[3,3];case 3:return[2]}})})()},[m,t,s,d,i.loading]),c().createElement(l.Space,{direction:"vertical",size:16,style:{width:"100%"}},c().createElement(l.List,{loading:i.loading||h,pagination:m>0&&{current:s,pageSize:d,total:m,onChange:r,showSizeChanger:!1,size:"small"}},c().createElement("div",{style:O},y.length?y.map(function(e,n){var r=0===n,o=n===y.length-1,i=D((0,f.gX)(e,t.collection)||n),l=t.subModels.items[0].createFork({},"".concat(g,"_item_").concat(i));return l.context.defineProperty("record",{get:function(){return e}}),l.context.defineProperty("blockModel",{get:function(){return t}}),c().createElement("div",{key:B(l,"".concat(g,"_item_").concat(i)),style:{position:"relative",padding:"".concat(r?0:"10px"," 0 ").concat(o?0:"10px"," 0")}},c().createElement("div",{style:T}),c().createElement(Q,{blockModel:t,itemModel:l,actionSettingsModel:t.subModels.items[0],record:e,forkKeyPrefix:"".concat(g,"_item_").concat(i)}))}):h?null:c().createElement(l.Empty,{image:l.Empty.PRESENTED_IMAGE_SIMPLE,description:o("No comments")}))),c().createElement(N,{model:t,forkKeyPrefix:g}))}),{Item:Q}),W=n(376);function X(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function $(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){X(i,r,o,l,a,"next",e)}function a(e){X(i,r,o,l,a,"throw",e)}l(void 0)})}}function ee(e,t,n){return t=el(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,eu()?Reflect.construct(t,n||[],el(e).constructor):t.apply(e,n))}function et(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function en(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 er(e,t,n){return t&&en(e.prototype,t),n&&en(e,n),e}function eo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ei(e,t,n){return(ei="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=el(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 el(e){return(el=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ea(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&&ec(e,t)}function ec(e,t){return(ec=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eu=function(){return!!e})()}function es(e,t){var n,r,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),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var ed=function(e,t){var n,r,o,i,l=e&&"function"==typeof e.getResourceSettingsInitParams?e.getResourceSettingsInitParams():void 0,a=(null==l?void 0:l.associationName)||(null==(r=t.view)||null==(n=r.inputArgs)?void 0:n.associationName)||(null==(o=t.inputArgs)?void 0:o.associationName),c=null==l?void 0:l.sourceId,u=(null==e||null==(i=e.context)?void 0:i.association)||t.association,s=(0,f.Qg)({collection:(null==e?void 0:e.collection)||t.collection,association:u,associationName:a,sourceId:c});return s.ownerField?{defaultMapping:s,shouldHideOwnerMappingFields:!0}:{defaultMapping:{},shouldHideOwnerMappingFields:!1}},em=function(e){function t(){return et(this,t),ee(this,t,arguments)}return ea(t,e),er(t,[{key:"render",value:function(){return c().createElement(U.Item,{blockModel:this.context.blockModel,itemModel:this,record:this.context.record,forkKeyPrefix:this.uid})}}]),t}(i.FlowModel),ef=function(e){function t(){var e;return et(this,t),e=ee(this,t,arguments),eo(e,"_defaultCustomModelClasses",{DetailsItemModel:"DetailsItemModel",DetailsAssociationFieldGroupModel:"DetailsAssociationFieldGroupModel",DetailsCustomItemModel:"DetailsCustomItemModel"}),eo(e,"resolvedOwnerValue",r.observable.ref(void 0)),eo(e,"loadingLastPage",r.observable.ref(!1)),eo(e,"shouldLoadLastPage",!0),e}return ea(t,e),er(t,[{key:"resource",get:function(){return ei(el(t.prototype),"resource",this)}},{key:"mapping",get:function(){return{commenterField:this.props.commenterField,dateField:this.props.dateField,contentField:this.props.contentField,ownerField:this.props.ownerField,ownerValueField:this.props.ownerValueField}}},{key:"getOwnerValueFromRecord",value:function(){return(0,f.zi)((0,f.Em)(this.context.record,this.mapping.ownerValueField))}},{key:"currentViewInputArgs",get:function(){var e;return null==(e=this.context.view)?void 0:e.inputArgs}},{key:"currentViewCollection",get:function(){var e,t,n,r;return(null==(e=this.currentViewInputArgs)?void 0:e.dataSourceKey)&&(null==(t=this.currentViewInputArgs)?void 0:t.collectionName)?null==(r=this.context.dataSourceManager)||null==(n=r.getCollection)?void 0:n.call(r,this.currentViewInputArgs.dataSourceKey,this.currentViewInputArgs.collectionName):void 0}},{key:"getOwnerValueFromViewFilterByTk",value:function(){var e;return(0,f.IU)(this.mapping.ownerValueField,null==(e=this.currentViewInputArgs)?void 0:e.filterByTk,(0,f.tH)(this.currentViewCollection))}},{key:"rawOwnerValue",get:function(){var e,t;return(0,f.d_)(this.mapping.ownerValueField)?null!=(t=this.resolvedOwnerValue.value)?t:this.getOwnerValueFromViewFilterByTk():null!=(e=this.getOwnerValueFromRecord())?e:this.getOwnerValueFromViewFilterByTk()}},{key:"ownerFilterValueState",get:function(){var e=this.rawOwnerValue;return this.mapping.ownerField&&void 0!==e?(0,f.Mm)(this.collection,this.mapping.ownerField,e):{compatible:!0,value:e}}},{key:"ownerValue",get:function(){var e=this.ownerFilterValueState;return e.compatible?e.value:void 0}},{key:"resolveOwnerValue",value:function(){return $(function(){var e,t,n;return es(this,function(r){switch(r.label){case 0:return e=this,[4,(0,f.KY)({record:this.context.record,resolveJsonTemplate:function(t){return e.context.resolveJsonTemplate(t)}},this.mapping.ownerValueField)];case 1:return n=null!=(t=r.sent())?t:this.getOwnerValueFromViewFilterByTk(),this.resolvedOwnerValue.value=n,[2,n]}})}).call(this)}},{key:"applyOwnerFilter",value:function(){return $(function(){var e;return es(this,function(t){switch(t.label){case 0:return[4,this.resolveOwnerValue()];case 1:return t.sent(),e=this.ownerFilterValueState,this.resource.removeFilterGroup(f.Xo),this.mapping.ownerField&&e.compatible&&void 0!==e.value&&this.resource.addFilterGroup(f.Xo,(0,f.so)(this.collection,this.mapping.ownerField,e.value)),[2]}})}).call(this)}},{key:"createResource",value:function(){var e,t=this,n=this.context.createResource(i.MultiRecordResource),r=this.mapping,o=[r.commenterField].map(function(e){return(0,f.Tf)(t.collection,e)}).filter(function(e){return null==e?void 0:e.targetCollection}).map(function(e){return null==e?void 0:e.name}).filter(function(e){return!!e});n.setPageSize(this.props.pageSize||f.yQ);var l=(null==(e=this.props.globalSort)?void 0:e.length)?this.props.globalSort:r.dateField?[r.dateField]:[];if(l.length&&n.setSort(l),r.ownerField){var a=this.ownerFilterValueState;a.compatible&&void 0!==a.value&&n.addFilterGroup(f.Xo,(0,f.so)(this.collection,r.ownerField,a.value))}return o.length&&n.addAppends(o),n}},{key:"getLastPage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.resource.getPageSize()||this.props.pageSize||f.yQ;return Math.max(Math.ceil((this.resource.getCount()||0)/e),1)}},{key:"shouldAutoJumpToLastPage",value:function(){return!0===this.props.autoJumpToLastPage}},{key:"isPreparingLastPageLoad",value:function(){if(this.loadingLastPage.value)return!0;if(!this.shouldAutoJumpToLastPage())return!1;var e=this.resource.getCount()||0,t=this.resource.getPage()||1,n=this.getLastPage();return this.shouldLoadLastPage&&e>0&&t!==n}},{key:"ensureLastPageLoaded",value:function(){return $(function(){var e,t;return es(this,function(n){switch(n.label){case 0:if(this.resource.loading)return[2];if(e=this.resource.getPage()||1,t=this.getLastPage(),!(e>t))return[3,5];this.shouldLoadLastPage=!1,this.resource.setPage(t),this.resource.loading=!0,this.loadingLastPage.value=!0,n.label=1;case 1:return n.trys.push([1,,3,4]),[4,this.refresh()];case 2:return n.sent(),[3,4];case 3:return this.loadingLastPage.value=!1,[7];case 4:return[2];case 5:if(!this.shouldAutoJumpToLastPage()||!this.shouldLoadLastPage||(this.shouldLoadLastPage=!1,e===t))return[2];this.resource.setPage(t),this.resource.loading=!0,this.loadingLastPage.value=!0,n.label=6;case 6:return n.trys.push([6,,8,9]),[4,this.refresh()];case 7:return n.sent(),[3,9];case 8:return this.loadingLastPage.value=!1,[7];case 9:return[2]}})}).call(this)}},{key:"handlePageChange",value:function(e){return $(function(){return es(this,function(t){switch(t.label){case 0:return this.shouldLoadLastPage=!1,this.resource.setPage(e),this.resource.loading=!0,[4,this.refresh()];case 1:return t.sent(),[2]}})}).call(this)}},{key:"renderComponent",value:function(){var e=this,t=this.mapping;if(!t.contentField||!t.commenterField||!t.ownerField||!t.dateField)return c().createElement(l.Alert,{message:this.context.t("Please configure the comment content field, commenter field, comment owner field, and comment date field.",{ns:u.CU}),type:"warning",showIcon:!0});var n=this.ownerFilterValueState;return n.compatible?void 0===n.value?c().createElement(l.Alert,{message:this.context.t("The current record value is empty, so comments cannot be loaded.",{ns:u.CU}),type:"warning",showIcon:!0}):c().createElement(U,{model:this,dataSource:this.resource.getData(),onPageChange:function(t){e.handlePageChange(t)}}):c().createElement(l.Alert,{message:this.context.t("The comment owner field value type does not match the comment owner field. Please reconfigure the field mapping.",{ns:u.CU}),type:"warning",showIcon:!0})}}],[{key:"filterCollection",value:function(e){return!!((null==e?void 0:e.filterTargetKey)||(0,f.tH)(e))}}]),t}(o.CollectionBlockModel);eo(ef,"scene",o.BlockSceneEnum.many),ef.registerFlow({key:"recordCommentsSettings",title:(0,u.MZ)("Record comments settings"),on:"beforeRender",sort:520,steps:{fieldMapping:{title:(0,u.MZ)("Field mapping"),preset:!0,uiSchema:function(e){var t=ed(e.model,e).shouldHideOwnerMappingFields;return{contentField:{type:"string",title:(0,u.MZ)("Comment content field"),required:!0,"x-decorator":"FormItem","x-component":W.J,"x-component-props":{fieldFilter:"content"}},commenterField:{type:"string",title:(0,u.MZ)("Commenter field"),required:!0,"x-decorator":"FormItem","x-component":W.J,"x-component-props":{fieldFilter:"user"},description:(0,u.MZ)("Only many-to-one fields associated with the users collection can be selected.")},ownerField:t?void 0:{type:"string",title:(0,u.MZ)("Comment owner field"),required:!0,"x-decorator":"FormItem","x-component":W.J,"x-component-props":{fieldFilter:"owner"}},ownerValueField:t?void 0:{type:"string",title:(0,u.MZ)("Comment owner field value"),required:!0,"x-decorator":"FormItem","x-component":o.TextAreaWithContextSelector,"x-component-props":{rows:1,maxRows:3,placeholder:"ctx.record.id"},description:(0,u.MZ)("Specify the associated business record value, for example the current record ID.")},dateField:{type:"string",title:(0,u.MZ)("Comment date field"),required:!0,"x-decorator":"FormItem","x-component":W.J,"x-component-props":{fieldFilter:"date"}}}},defaultParams:function(e){var t,n,r=e.model,o=ed(r,e).defaultMapping;return{contentField:r.props.contentField,commenterField:r.props.commenterField,ownerField:null!=(t=r.props.ownerField)?t:o.ownerField,ownerValueField:null!=(n=r.props.ownerValueField)?n:o.ownerValueField,dateField:r.props.dateField}},handler:function(e,t){return $(function(){var n;return es(this,function(r){switch(r.label){case 0:return(n=e.model).setProps({contentField:t.contentField,commenterField:t.commenterField,ownerField:t.ownerField,ownerValueField:t.ownerValueField,dateField:t.dateField}),[4,n.applyOwnerFilter()];case 1:return r.sent(),[2]}})})()},beforeParamsSave:function(e,t){e.model.setProps({contentField:t.contentField,commenterField:t.commenterField,ownerField:t.ownerField,ownerValueField:t.ownerValueField,dateField:t.dateField})}},pageSize:{title:(0,u.MZ)("Page size"),uiMode:{type:"select",key:"pageSize",props:{options:[{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:f.yQ},handler:function(e,t){var n=e.model,r=t.pageSize||f.yQ;n.setProps({pageSize:r}),n.resource.setPageSize(r),n.resource.setPage(n.shouldAutoJumpToLastPage()?n.getLastPage(r):1)}},dataScope:{use:"dataScope",title:(0,u.MZ)("Data scope")},defaultSorting:{use:"sortingRule",title:(0,u.MZ)("Default sorting")},autoJumpToLastPage:{title:(0,u.MZ)("Jump to last page by default"),uiMode:{type:"switch",key:"autoJumpToLastPage"},defaultParams:{autoJumpToLastPage:!1},handler:function(e,t){var n=e.model;n.setProps({autoJumpToLastPage:!1!==t.autoJumpToLastPage}),n.resource.setPage(!1===t.autoJumpToLastPage?1:n.getLastPage())}}}}),ef.define({label:(0,u.MZ)("Comments"),searchable:!0,searchPlaceholder:(0,u.MZ)("Search"),createModelOptions:{use:"RecordCommentsBlockModel",subModels:{items:[{use:"RecordCommentItemModel",subModels:{actions:[{use:"QuoteReplyRecordCommentActionModel"},{use:"EditRecordCommentActionModel"},{use:"DeleteRecordCommentActionModel"}],bodyFields:{use:"DetailsGridModel"}}}],submitActions:[{use:"RecordCommentSubmitActionModel"}]}},sort:552})},394:function(e,t,n){n.d(t,{u:function(){return r}});var r=function(e,t){if((null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)&&e.message)return e.message;if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"){var n,r,o,i,l=e.response,a=null==l||null==(i=l.data)||null==(o=i.errors)||null==(r=o[0])?void 0:r.message;if(a)return a}return 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_block_comment=self.webpackChunk_nocobase_plugin_block_comment||[]).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("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-comment",["@emotion/css","@nocobase/client-v2","@formily/reactive","react","antd","@nocobase/client","@ant-design/icons","@nocobase/flow-engine","@nocobase/utils/client"],t):"object"==typeof exports?exports["@nocobase/plugin-block-comment"]=t(require("@emotion/css"),require("@nocobase/client-v2"),require("@formily/reactive"),require("react"),require("antd"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@nocobase/utils/client")):e["@nocobase/plugin-block-comment"]=t(e["@emotion/css"],e["@nocobase/client-v2"],e["@formily/reactive"],e.react,e.antd,e["@nocobase/client"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e["@nocobase/utils/client"])}(self,function(e,t,n,r,o,i,u,c,l){return function(){"use strict";var a,f,s,p={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,m=(null==y?void 0:y.collection)||(null==d?void 0:d.collection),v=(0,i.useMemo)(function(){return"owner"===s?(0,l.dy)(m):"content"===s?(0,l.p3)(m):"date"===s?(0,l.GZ)(m):"user"===s?(0,l.vt)(m):(0,l.TP)(m)},[m,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:v},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 M},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"]),m=new Set(["input","markdown","richText","text","textarea","vditor"]),v=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?m.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):v.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}},q=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}},M=function(e,t){var n=q(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=q(e);return!!t&&/^\{\{\s*ctx(?:\..+?)?\s*\}\}$/.test(t.trim())},I=function(e){var t=q(e);return!!t&&/^ctx(?:\..+?)?$/.test(t.trim())},$=function(e){return R(e)||I(e)},D=function(e){var t=q(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=q(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=q(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=M(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=u},477:function(t){t.exports=e},992:function(e){e.exports=n},342:function(e){e.exports=i},485:function(e){e.exports=t},694:function(e){e.exports=c},768:function(e){e.exports=l},59:function(e){e.exports=o},155:function(e){e.exports=r}},b={};function d(e){var t=b[e];if(void 0!==t)return t.exports;var n=b[e]={exports:{}};return p[e](n,n.exports,d),n.exports}d.m=p,d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return""+e+"."+({41:"6fb2aeb406824e12",549:"a88deaa9432f2fd7"})[e]+".js"},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y={},d.l=function(e,t,n,r){if(y[e])return void y[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:"+n){o=l;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,d.nc&&o.setAttribute("nonce",d.nc),o.setAttribute("data-rspack","@nocobase/plugin-block-comment:"+n),o.src=e),y[e]=[t];var a=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=y[e];if(delete y[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)},d.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.g.importScripts&&(m=d.g.location+"");var y,m,v=d.g.document;if(!m&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(m=v.currentScript.src),!m)){var g=v.getElementsByTagName("script");if(g.length)for(var h=g.length-1;h>-1&&(!m||!/^http(s?):/.test(m));)m=g[h--].src}if(!m)throw Error("Automatic publicPath is not supported in this browser");d.p=m.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a={889:0},d.f.j=function(e,t){var n=d.o(a,e)?a[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=a[e]=[t,r]});t.push(n[2]=r);var o=d.p+d.u(e),i=Error();d.l(o,function(t){if(d.o(a,e)&&(0!==(n=a[e])&&(a[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)}},f=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],c=0;if(o.some(function(e){return 0!==a[e]})){for(n in i)d.o(i,n)&&(d.m[n]=i[n]);u&&u(d)}for(e&&e(t);c<o.length;c++)r=o[c],d.o(a,r)&&a[r]&&a[r][0](),a[r]=0},(s=self.webpackChunk_nocobase_plugin_block_comment=self.webpackChunk_nocobase_plugin_block_comment||[]).forEach(f.bind(null,0)),s.push=f.bind(null,s.push.bind(s));var w={};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/")>=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/")}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/"}d.p=e}(),!function(){d.r(w),d.d(w,{default:function(){return l}});var e=d(342),t=d(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 d.e("41").then(d.bind(d,672))}},RecordCommentItemModel:{loader:function(){return d.e("41").then(d.bind(d,672))}},RecordCommentActionGroupModel:{loader:function(){return d.e("549").then(d.bind(d,236))}},RecordCommentSubmitActionGroupModel:{loader:function(){return d.e("549").then(d.bind(d,236))}},RecordCommentSubmitActionModel:{loader:function(){return d.e("549").then(d.bind(d,236))}},EditRecordCommentActionModel:{loader:function(){return d.e("549").then(d.bind(d,236))}},DeleteRecordCommentActionModel:{loader:function(){return d.e("549").then(d.bind(d,236))}},QuoteReplyRecordCommentActionModel:{loader:function(){return d.e("549").then(d.bind(d,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))}(),w}()});
|
|
@@ -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,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
|
+
import { ModelConstructor } from '@nocobase/flow-engine';
|
|
10
|
+
declare const _default: Record<string, ModelConstructor>;
|
|
11
|
+
export default _default;
|
|
@@ -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';
|
|
10
|
+
export declare class PluginRecordCommentsClient extends Plugin {
|
|
11
|
+
load(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export default PluginRecordCommentsClient;
|
|
@@ -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([["41"],{672:function(e,t,n){n.r(t),n.d(t,{RecordCommentItemModel:function(){return em},RecordCommentsBlockModel:function(){return ef}});var r=n(992),o=n(485),i=n(694),l=n(59),a=n(155),c=n.n(a),u=n(488),s=n(375),d=n(768),m=n(394),f=n(626),p=n(477);function g(){var e,t,n=(e=["\n .ant-btn-link {\n height: auto;\n padding: 0;\n }\n"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return g=function(){return n},n}var h=function(e){return String(null!=e?e:"").replace(/[^a-zA-Z0-9_-]+/g,"_")||"fork"},y=function(e,t){var n=e.forkId;return"".concat(e.uid,":").concat(null!=n?n:t)},v=(0,p.css)(g()),b=new Set(["QuoteReplyRecordCommentActionModel","EditRecordCommentActionModel","DeleteRecordCommentActionModel"]),w=(0,i.observer)(function(e){var t=e.blockModel,n=e.record,r=e.itemModel,o=e.actionSettingsModel,a=void 0===o?r:o,u=e.forkKeyPrefix,d=e.setEditing,m=(0,f.gX)(n,t.collection),p=new Set;return c().createElement(i.DndProvider,null,c().createElement(l.Space,{size:4,className:v},r.mapSubModels("actions",function(e,r){var o=e.constructor.name;if(b.has(o)){if(p.has(o))return null;p.add(o)}var l=[u,m||"record",e.uid,r].map(h).join("_"),a=e.createFork({},l);return a.context.defineProperty("record",{get:function(){return n}}),a.context.defineProperty("resource",{get:function(){return t.resource}}),a.context.defineProperty("collection",{get:function(){return t.collection}}),a.context.defineProperty("blockModel",{get:function(){return t}}),a.context.defineMethod("setEditing",d),c().createElement(i.Droppable,{model:a,key:y(a,l)},c().createElement(i.FlowModelRenderer,{model:a,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:i.DragHandler,sort:1}]}))}),r.context.flowSettingsEnabled?c().createElement(i.AddSubModelButton,{key:"record-comment-actions-add",model:a,subModelKey:"actions",subModelBaseClasses:["RecordCommentActionGroupModel"]},c().createElement(i.FlowSettingsButton,{icon:c().createElement(s.SettingOutlined,null)},a.translate("Actions"))):null))});function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function P(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function S(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){P(i,r,o,l,a,"next",e)}function a(e){P(i,r,o,l,a,"throw",e)}l(void 0)})}}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(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){k(e,t,n[t])})}return e}function M(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}function C(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 i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F(e,t)}}(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 E(e,t){var n,r,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),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var O={display:"flex",flexDirection:"column"},A={color:"#636c76",display:"flex",alignItems:"center",paddingLeft:16,borderRadius:"8px 8px 0 0",justifyContent:"space-between",flexWrap:"wrap",lineHeight:"42px"},I={backgroundColor:"#f6f8fa",color:"#636c76",display:"flex",alignItems:"center",columnGap:6},j={position:"relative",zIndex:2,backgroundColor:"white",borderRadius:"0 0 8px 8px",minHeight:24},V={marginTop:12},L={marginTop:10,display:"flex",columnGap:5},R={position:"relative",zIndex:1},_={position:"absolute",top:0,bottom:0,content:"",display:"block",width:2,left:16,backgroundColor:"#d0d7deb3",zIndex:0},T={marginRight:16,flexShrink:0},z={marginTop:10,display:"flex",alignItems:"center",columnGap:8,flexWrap:"wrap"},D=function(e){return String(null!=e?e:"").replace(/[^a-zA-Z0-9_-]+/g,"_")||"fork"},B=function(e,t){var n=e.forkId;return"".concat(e.uid,":").concat(null!=n?n:t)},J=function(e){var t,n=(0,f.Tf)(e.collection,e.mapping.contentField),r=null==n||null==(t=n.uiSchema)?void 0:t["x-component-props"];return r&&(void 0===r?"undefined":r&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)=="object"?r:{}},K=function(e){var t;return null==(t=e.context.user)?void 0:t.id},Z=function(e){var t=e.mapping.commenterField,n=(0,f.Tf)(e.collection,t),r=K(e);return t&&(null==n?void 0:n.interface)!=="createdBy"&&void 0!==r?k({},t,r):{}},G=function(e){var t=e.mapping.dateField,n=(0,f.Tf)(e.collection,t),r=(null==n?void 0:n.interface)||(null==n?void 0:n.type);return t&&"createdAt"!==t&&"updatedAt"!==t&&(null==n?void 0:n.interface)!=="createdAt"&&(null==n?void 0:n.interface)!=="updatedAt"?"unixTimestamp"===r?k({},t,(0,d.dayjs)().unix()):"dateOnly"===r?k({},t,(0,d.dayjs)().format("YYYY-MM-DD")):"time"===r?k({},t,(0,d.dayjs)().format("HH:mm:ss")):k({},t,(0,d.dayjs)().toISOString()):{}},H=(0,i.observer)(function(e){var t=e.value,n=e.model,r=(0,u.kj)(),o=C((0,a.useState)(null),2),i=o[0],l=o[1],s=n.context,d=(0,a.useRef)(r);return d.current=r,(0,a.useEffect)(function(){var e=!0;return S(function(){var r,o,i,a,u,f;return E(this,function(p){switch(p.label){case 0:if(null==t||""===t)return l(null),[2];p.label=1;case 1:if(p.trys.push([1,5,,6]),o=String(t),!s.liquid)return[3,3];return[4,s.liquid.renderWithFullContext(o,n.context)];case 2:return a=p.sent(),[3,4];case 3:a=o,p.label=4;case 4:return i=a,u=(null==(r=s.markdown)?void 0:r.render)?s.markdown.render(d.current(i),{ellipsis:!1,textOnly:!1}):i,e&&l(u),[3,6];case 5:return f=p.sent(),e&&l(c().createElement("pre",{style:{color:"red"}},(0,m.u)(f,d.current("Render error")))),[3,6];case 6:return[2]}})})().catch(function(t){e&&l(c().createElement("pre",{style:{color:"red"}},(0,m.u)(t,d.current("Render error"))))}),function(){e=!1}},[s.liquid,s.markdown,n,t]),c().createElement(c().Fragment,null,i)}),q=(0,i.observer)(function(e){var t,n=e.blockModel,r=e.itemModel,l=(e.actionSettingsModel,e.record),a=e.forkKeyPrefix,u=null==(t=r.subModels)?void 0:t.bodyFields,s=!!n.context.flowSettingsEnabled;if(!u||!s&&!u.hasSubModel("items"))return null;var d=u.createFork({},"".concat(a,"_body_fields"));return d.gridContainerRef=c().createRef(),d.context.defineProperty("record",{get:function(){return l},cache:!1}),d.context.defineProperty("currentObject",{get:function(){return l},cache:!1}),d.context.defineProperty("fieldIndex",{get:function(){return a},cache:!1}),d.context.defineProperty("fieldKey",{get:function(){return a}}),d.context.defineProperty("blockModel",{get:function(){return n}}),d.context.defineProperty("collection",{get:function(){return n.collection}}),d.context.defineProperty("resource",{get:function(){return n.resource}}),c().createElement("div",{style:V},c().createElement(o.FormComponent,{model:n,layoutProps:n.props},c().createElement(i.FlowModelRenderer,{model:d,showFlowSettings:!1})))}),N=(0,i.observer)(function(e){var t,n=e.model,r=e.forkKeyPrefix,o=(0,u.kj)(),i=l.App.useApp().message,s=C((0,a.useState)(""),2),d=s[0],f=s[1],p=C((0,a.useState)(!1),2),g=p[0],h=p[1],y=n.context,v=n.mapping,b=(0,a.useMemo)(function(){return d.trim().length>0},[d]);n.context.defineMethod("setQuoteContent",function(e){f(e)});var w=(0,a.useCallback)(function(e){return S(function(){var t,r,l,a,c,u;return E(this,function(s){switch(s.label){case 0:if(!v.contentField||!v.ownerField||void 0===n.ownerValue)return[2];h(!0),s.label=1;case 1:return s.trys.push([1,4,5,6]),r=x((k(t={},v.contentField,d),k(t,v.ownerField,n.ownerValue),t),Z(n),G(n),(null==e?void 0:e.assignedValues)||{}),[4,n.resource.create(r,M(x({},(null==e?void 0:e.requestConfig)||{}),{refresh:!1}))];case 2:return l=s.sent(),f(""),n.shouldAutoJumpToLastPage()&&(a=n.resource.getCount()||0,c=n.resource.getPageSize()||10,n.resource.setPage(Math.max(Math.ceil((a+1)/c),1))),[4,n.resource.refresh()];case 3:return s.sent(),[2,l];case 4:throw u=s.sent(),i.error((0,m.u)(u,o("Failed to create comment"))),u;case 5:return h(!1),[7];case 6:return[2]}})})()},[d,v.contentField,v.ownerField,i,n,o]),F=(0,a.useCallback)(function(){return S(function(){return E(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,w()];case 1:case 2:return e.sent(),[3,3];case 3:return[2]}})})()},[w]);return c().createElement("div",{style:{marginTop:10}},(null==(t=y.markdown)?void 0:t.edit)?y.markdown.edit(M(x({},J(n)),{value:d,quoteFlag:!0,onChange:function(e){f(e)},enableContextSelect:!1})):c().createElement(l.Input.TextArea,{"aria-label":o("Comment content"),value:d,onChange:function(e){return f(e.target.value)},autoSize:!0}),c().createElement("div",{style:z},c().createElement(Y,{model:n,content:d,canSubmit:b,submitting:g,setContent:f,handleFallbackSubmit:F,submit:w,forkKeyPrefix:r})))}),Y=(0,i.observer)(function(e){var t,n=e.model,r=e.content,o=e.canSubmit,a=e.submitting,d=e.setContent,m=e.handleFallbackSubmit,f=e.submit,p=e.forkKeyPrefix,g=(0,u.kj)(),h=((null==(t=n.subModels)?void 0:t.submitActions)||[]).some(function(e){return"RecordCommentSubmitActionModel"===e.constructor.name});return c().createElement(i.DndProvider,null,c().createElement(l.Space,{size:8,wrap:!0},h?null:c().createElement(l.Button,{disabled:!o,loading:a,onClick:m,type:"primary"},g("Comment")),n.mapSubModels("submitActions",function(e,t){var l=e.createFork({},"".concat(p,"_submit_").concat(D(e.uid),"_").concat(t));return l.context.defineProperty("resource",{get:function(){return n.resource}}),l.context.defineProperty("collection",{get:function(){return n.collection}}),l.context.defineProperty("blockModel",{get:function(){return n}}),l.context.defineProperty("commentContent",{get:function(){return r},cache:!1}),l.context.defineProperty("commentCanSubmit",{get:function(){return o},cache:!1}),l.context.defineProperty("commentSubmitting",{get:function(){return a},cache:!1}),l.context.defineMethod("setCommentContent",d),l.context.defineMethod("submitComment",f),c().createElement(i.Droppable,{model:l,key:B(l,"".concat(p,"_submit_").concat(t))},c().createElement(i.FlowModelRenderer,{model:l,showFlowSettings:{showBackground:!1,showBorder:!1},extraToolbarItems:[{key:"drag-handler",component:i.DragHandler,sort:1}]}))}),n.context.flowSettingsEnabled?c().createElement(i.AddSubModelButton,{key:"record-comment-submit-actions-add",model:n,subModelKey:"submitActions",subModelBaseClasses:["RecordCommentSubmitActionGroupModel"]},c().createElement(i.FlowSettingsButton,{icon:c().createElement(s.SettingOutlined,null)},n.translate("Actions"))):null))}),Q=(0,i.observer)(function(e){var t,n,r=e.blockModel,o=e.itemModel,i=e.actionSettingsModel,s=e.record,p=e.forkKeyPrefix,g=(0,u.kj)(),h=l.App.useApp().message,y=r.context,v=r.mapping,b=String(s[v.contentField||""]||""),F=C((0,a.useState)(!1),2),P=F[0],O=F[1],V=C((0,a.useState)(b),2),_=V[0],z=V[1],D=C((0,a.useState)(!1),2),B=D[0],K=D[1],Z=(t=g("Comment"),v.commenterField?(0,f.O2)(s[v.commenterField]):t),G=v.dateField?s[v.dateField]:void 0,N=(0,f.gX)(s,r.collection);(0,a.useEffect)(function(){z(b)},[b]);var Y=(0,a.useCallback)(function(){z(b),O(!1)},[b]),Q=(0,a.useCallback)(function(){return S(function(){var e;return E(this,function(t){switch(t.label){case 0:if(!N||!v.contentField)return[2];K(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,r.resource.update(N,k({},v.contentField,_))];case 2:return t.sent(),O(!1),[3,5];case 3:return e=t.sent(),h.error((0,m.u)(e,g("Failed to update comment"))),[3,5];case 4:return K(!1),[7];case 5:return[2]}})})()},[r.resource,v.contentField,h,N,g,_]);return c().createElement("div",{style:R},c().createElement(l.Card,{size:"small",styles:{header:{padding:0,fontWeight:"normal",backgroundColor:"#f6f8fa"}},title:c().createElement("div",{style:A},c().createElement("div",{style:I},c().createElement("span",{style:{fontWeight:"bold",fontSize:14}},Z),G?c().createElement(l.Tooltip,{title:(0,d.dayjs)(G).format("YYYY-MM-DD HH:mm:ss")},c().createElement("span",{style:{fontSize:14}},(0,d.dayjs)(G).fromNow())):null),c().createElement("div",{style:T},c().createElement(w,{blockModel:r,record:s,itemModel:o,actionSettingsModel:i,forkKeyPrefix:p,setEditing:function(){O(!0)}})))},c().createElement("div",{style:j},P&&(null==(n=y.markdown)?void 0:n.edit)?y.markdown.edit(M(x({},J(r)),{value:_,onChange:function(e){z(e)},enableContextSelect:!1})):P?c().createElement(l.Input.TextArea,{"aria-label":g("Comment content"),value:_,onChange:function(e){return z(e.target.value)},autoSize:!0}):c().createElement(c().Fragment,null,c().createElement(H,{value:s[v.contentField||""],model:r}),c().createElement(q,{blockModel:r,itemModel:o,record:s,forkKeyPrefix:p})),P?c().createElement("div",{style:L},c().createElement(l.Button,{type:"primary",loading:B,onClick:Q},g("Update Comment")),c().createElement(l.Button,{onClick:Y},g("Cancel"))):null)))}),U=Object.assign((0,i.observer)(function(e){var t=e.model,n=e.dataSource,r=e.onPageChange,o=(0,u.kj)(),i=t.resource,s=i.getPage()||1,d=i.getPageSize()||20,m=i.getCount()||0,p=D((0,a.useId)()),g="".concat(D(t.uid),"_").concat(p),h=t.isPreparingLastPageLoad(),y=h?[]:n;return(0,a.useEffect)(function(){S(function(){return E(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,t.ensureLastPageLoaded()];case 1:case 2:return e.sent(),[3,3];case 3:return[2]}})})()},[m,t,s,d,i.loading]),c().createElement(l.Space,{direction:"vertical",size:16,style:{width:"100%"}},c().createElement(l.List,{loading:i.loading||h,pagination:m>0&&{current:s,pageSize:d,total:m,onChange:r,showSizeChanger:!1,size:"small"}},c().createElement("div",{style:O},y.length?y.map(function(e,n){var r=0===n,o=n===y.length-1,i=D((0,f.gX)(e,t.collection)||n),l=t.subModels.items[0].createFork({},"".concat(g,"_item_").concat(i));return l.context.defineProperty("record",{get:function(){return e}}),l.context.defineProperty("blockModel",{get:function(){return t}}),c().createElement("div",{key:B(l,"".concat(g,"_item_").concat(i)),style:{position:"relative",padding:"".concat(r?0:"10px"," 0 ").concat(o?0:"10px"," 0")}},c().createElement("div",{style:_}),c().createElement(Q,{blockModel:t,itemModel:l,actionSettingsModel:t.subModels.items[0],record:e,forkKeyPrefix:"".concat(g,"_item_").concat(i)}))}):h?null:c().createElement(l.Empty,{image:l.Empty.PRESENTED_IMAGE_SIMPLE,description:o("No comments")}))),c().createElement(N,{model:t,forkKeyPrefix:g}))}),{Item:Q}),W=n(376);function X(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function $(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){X(i,r,o,l,a,"next",e)}function a(e){X(i,r,o,l,a,"throw",e)}l(void 0)})}}function ee(e,t,n){return t=el(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,eu()?Reflect.construct(t,n||[],el(e).constructor):t.apply(e,n))}function et(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function en(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 er(e,t,n){return t&&en(e.prototype,t),n&&en(e,n),e}function eo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ei(e,t,n){return(ei="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=el(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 el(e){return(el=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ea(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&&ec(e,t)}function ec(e,t){return(ec=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eu=function(){return!!e})()}function es(e,t){var n,r,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),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var ed=function(e,t){var n,r,o,i,l=e&&"function"==typeof e.getResourceSettingsInitParams?e.getResourceSettingsInitParams():void 0,a=(null==l?void 0:l.associationName)||(null==(r=t.view)||null==(n=r.inputArgs)?void 0:n.associationName)||(null==(o=t.inputArgs)?void 0:o.associationName),c=null==l?void 0:l.sourceId,u=(null==e||null==(i=e.context)?void 0:i.association)||t.association,s=(0,f.Qg)({collection:(null==e?void 0:e.collection)||t.collection,association:u,associationName:a,sourceId:c});return s.ownerField?{defaultMapping:s,shouldHideOwnerMappingFields:!0}:{defaultMapping:{},shouldHideOwnerMappingFields:!1}},em=function(e){function t(){return et(this,t),ee(this,t,arguments)}return ea(t,e),er(t,[{key:"render",value:function(){return c().createElement(U.Item,{blockModel:this.context.blockModel,itemModel:this,record:this.context.record,forkKeyPrefix:this.uid})}}]),t}(i.FlowModel),ef=function(e){function t(){var e;return et(this,t),e=ee(this,t,arguments),eo(e,"_defaultCustomModelClasses",{DetailsItemModel:"DetailsItemModel",DetailsAssociationFieldGroupModel:"DetailsAssociationFieldGroupModel",DetailsCustomItemModel:"DetailsCustomItemModel"}),eo(e,"resolvedOwnerValue",r.observable.ref(void 0)),eo(e,"loadingLastPage",r.observable.ref(!1)),eo(e,"shouldLoadLastPage",!0),e}return ea(t,e),er(t,[{key:"resource",get:function(){return ei(el(t.prototype),"resource",this)}},{key:"mapping",get:function(){return{commenterField:this.props.commenterField,dateField:this.props.dateField,contentField:this.props.contentField,ownerField:this.props.ownerField,ownerValueField:this.props.ownerValueField}}},{key:"getOwnerValueFromRecord",value:function(){return(0,f.zi)((0,f.Em)(this.context.record,this.mapping.ownerValueField))}},{key:"currentViewInputArgs",get:function(){var e;return null==(e=this.context.view)?void 0:e.inputArgs}},{key:"currentViewCollection",get:function(){var e,t,n,r;return(null==(e=this.currentViewInputArgs)?void 0:e.dataSourceKey)&&(null==(t=this.currentViewInputArgs)?void 0:t.collectionName)?null==(r=this.context.dataSourceManager)||null==(n=r.getCollection)?void 0:n.call(r,this.currentViewInputArgs.dataSourceKey,this.currentViewInputArgs.collectionName):void 0}},{key:"getOwnerValueFromViewFilterByTk",value:function(){var e;return(0,f.IU)(this.mapping.ownerValueField,null==(e=this.currentViewInputArgs)?void 0:e.filterByTk,(0,f.tH)(this.currentViewCollection))}},{key:"rawOwnerValue",get:function(){var e,t;return(0,f.d_)(this.mapping.ownerValueField)?null!=(t=this.resolvedOwnerValue.value)?t:this.getOwnerValueFromViewFilterByTk():null!=(e=this.getOwnerValueFromRecord())?e:this.getOwnerValueFromViewFilterByTk()}},{key:"ownerFilterValueState",get:function(){var e=this.rawOwnerValue;return this.mapping.ownerField&&void 0!==e?(0,f.Mm)(this.collection,this.mapping.ownerField,e):{compatible:!0,value:e}}},{key:"ownerValue",get:function(){var e=this.ownerFilterValueState;return e.compatible?e.value:void 0}},{key:"resolveOwnerValue",value:function(){return $(function(){var e,t,n;return es(this,function(r){switch(r.label){case 0:return e=this,[4,(0,f.KY)({record:this.context.record,resolveJsonTemplate:function(t){return e.context.resolveJsonTemplate(t)}},this.mapping.ownerValueField)];case 1:return n=null!=(t=r.sent())?t:this.getOwnerValueFromViewFilterByTk(),this.resolvedOwnerValue.value=n,[2,n]}})}).call(this)}},{key:"applyOwnerFilter",value:function(){return $(function(){var e;return es(this,function(t){switch(t.label){case 0:return[4,this.resolveOwnerValue()];case 1:return t.sent(),e=this.ownerFilterValueState,this.resource.removeFilterGroup(f.Xo),this.mapping.ownerField&&e.compatible&&void 0!==e.value&&this.resource.addFilterGroup(f.Xo,(0,f.so)(this.collection,this.mapping.ownerField,e.value)),[2]}})}).call(this)}},{key:"createResource",value:function(){var e,t=this,n=this.context.createResource(i.MultiRecordResource),r=this.mapping,o=[r.commenterField].map(function(e){return(0,f.Tf)(t.collection,e)}).filter(function(e){return null==e?void 0:e.targetCollection}).map(function(e){return null==e?void 0:e.name}).filter(function(e){return!!e});n.setPageSize(this.props.pageSize||f.yQ);var l=(null==(e=this.props.globalSort)?void 0:e.length)?this.props.globalSort:r.dateField?[r.dateField]:[];if(l.length&&n.setSort(l),r.ownerField){var a=this.ownerFilterValueState;a.compatible&&void 0!==a.value&&n.addFilterGroup(f.Xo,(0,f.so)(this.collection,r.ownerField,a.value))}return o.length&&n.addAppends(o),n}},{key:"getLastPage",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.resource.getPageSize()||this.props.pageSize||f.yQ;return Math.max(Math.ceil((this.resource.getCount()||0)/e),1)}},{key:"shouldAutoJumpToLastPage",value:function(){return!0===this.props.autoJumpToLastPage}},{key:"isPreparingLastPageLoad",value:function(){if(this.loadingLastPage.value)return!0;if(!this.shouldAutoJumpToLastPage())return!1;var e=this.resource.getCount()||0,t=this.resource.getPage()||1,n=this.getLastPage();return this.shouldLoadLastPage&&e>0&&t!==n}},{key:"ensureLastPageLoaded",value:function(){return $(function(){var e,t;return es(this,function(n){switch(n.label){case 0:if(this.resource.loading)return[2];if(e=this.resource.getPage()||1,t=this.getLastPage(),!(e>t))return[3,5];this.shouldLoadLastPage=!1,this.resource.setPage(t),this.resource.loading=!0,this.loadingLastPage.value=!0,n.label=1;case 1:return n.trys.push([1,,3,4]),[4,this.refresh()];case 2:return n.sent(),[3,4];case 3:return this.loadingLastPage.value=!1,[7];case 4:return[2];case 5:if(!this.shouldAutoJumpToLastPage()||!this.shouldLoadLastPage||(this.shouldLoadLastPage=!1,e===t))return[2];this.resource.setPage(t),this.resource.loading=!0,this.loadingLastPage.value=!0,n.label=6;case 6:return n.trys.push([6,,8,9]),[4,this.refresh()];case 7:return n.sent(),[3,9];case 8:return this.loadingLastPage.value=!1,[7];case 9:return[2]}})}).call(this)}},{key:"handlePageChange",value:function(e){return $(function(){return es(this,function(t){switch(t.label){case 0:return this.shouldLoadLastPage=!1,this.resource.setPage(e),this.resource.loading=!0,[4,this.refresh()];case 1:return t.sent(),[2]}})}).call(this)}},{key:"renderComponent",value:function(){var e=this,t=this.mapping;if(!t.contentField||!t.commenterField||!t.ownerField||!t.dateField)return c().createElement(l.Alert,{message:this.context.t("Please configure the comment content field, commenter field, comment owner field, and comment date field.",{ns:u.CU}),type:"warning",showIcon:!0});var n=this.ownerFilterValueState;return n.compatible?void 0===n.value?c().createElement(l.Alert,{message:this.context.t("The current record value is empty, so comments cannot be loaded.",{ns:u.CU}),type:"warning",showIcon:!0}):c().createElement(U,{model:this,dataSource:this.resource.getData(),onPageChange:function(t){e.handlePageChange(t)}}):c().createElement(l.Alert,{message:this.context.t("The comment owner field value type does not match the comment owner field. Please reconfigure the field mapping.",{ns:u.CU}),type:"warning",showIcon:!0})}}],[{key:"filterCollection",value:function(e){return!!((null==e?void 0:e.filterTargetKey)||(0,f.tH)(e))}}]),t}(o.CollectionBlockModel);eo(ef,"scene",o.BlockSceneEnum.many),ef.registerFlow({key:"recordCommentsSettings",title:(0,u.MZ)("Record comments settings"),on:"beforeRender",sort:520,steps:{fieldMapping:{title:(0,u.MZ)("Field mapping"),preset:!0,uiSchema:function(e){var t=ed(e.model,e).shouldHideOwnerMappingFields;return{contentField:{type:"string",title:(0,u.MZ)("Comment content field"),required:!0,"x-decorator":"FormItem","x-component":W.J,"x-component-props":{fieldFilter:"content"}},commenterField:{type:"string",title:(0,u.MZ)("Commenter field"),required:!0,"x-decorator":"FormItem","x-component":W.J,"x-component-props":{fieldFilter:"user"},description:(0,u.MZ)("Only many-to-one fields associated with the users collection can be selected.")},ownerField:t?void 0:{type:"string",title:(0,u.MZ)("Comment owner field"),required:!0,"x-decorator":"FormItem","x-component":W.J,"x-component-props":{fieldFilter:"owner"}},ownerValueField:t?void 0:{type:"string",title:(0,u.MZ)("Comment owner field value"),required:!0,"x-decorator":"FormItem","x-component":o.TextAreaWithContextSelector,"x-component-props":{rows:1,maxRows:3,placeholder:"ctx.record.id"},description:(0,u.MZ)("Specify the associated business record value, for example the current record ID.")},dateField:{type:"string",title:(0,u.MZ)("Comment date field"),required:!0,"x-decorator":"FormItem","x-component":W.J,"x-component-props":{fieldFilter:"date"}}}},defaultParams:function(e){var t,n,r=e.model,o=ed(r,e).defaultMapping;return{contentField:r.props.contentField,commenterField:r.props.commenterField,ownerField:null!=(t=r.props.ownerField)?t:o.ownerField,ownerValueField:null!=(n=r.props.ownerValueField)?n:o.ownerValueField,dateField:r.props.dateField}},handler:function(e,t){return $(function(){var n;return es(this,function(r){switch(r.label){case 0:return(n=e.model).setProps({contentField:t.contentField,commenterField:t.commenterField,ownerField:t.ownerField,ownerValueField:t.ownerValueField,dateField:t.dateField}),[4,n.applyOwnerFilter()];case 1:return r.sent(),[2]}})})()},beforeParamsSave:function(e,t){e.model.setProps({contentField:t.contentField,commenterField:t.commenterField,ownerField:t.ownerField,ownerValueField:t.ownerValueField,dateField:t.dateField})}},pageSize:{title:(0,u.MZ)("Page size"),uiMode:{type:"select",key:"pageSize",props:{options:[{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:f.yQ},handler:function(e,t){var n=e.model,r=t.pageSize||f.yQ;n.setProps({pageSize:r}),n.resource.setPageSize(r),n.resource.setPage(n.shouldAutoJumpToLastPage()?n.getLastPage(r):1)}},dataScope:{use:"dataScope",title:(0,u.MZ)("Data scope")},defaultSorting:{use:"sortingRule",title:(0,u.MZ)("Default sorting")},autoJumpToLastPage:{title:(0,u.MZ)("Jump to last page by default"),uiMode:{type:"switch",key:"autoJumpToLastPage"},defaultParams:{autoJumpToLastPage:!1},handler:function(e,t){var n=e.model;n.setProps({autoJumpToLastPage:!1!==t.autoJumpToLastPage}),n.resource.setPage(!1===t.autoJumpToLastPage?1:n.getLastPage())}}}}),ef.define({label:(0,u.MZ)("Comments"),searchable:!0,searchPlaceholder:(0,u.MZ)("Search"),createModelOptions:{use:"RecordCommentsBlockModel",subModels:{items:[{use:"RecordCommentItemModel",subModels:{actions:[{use:"QuoteReplyRecordCommentActionModel"},{use:"EditRecordCommentActionModel"},{use:"DeleteRecordCommentActionModel"}],bodyFields:{use:"DetailsGridModel"}}}],submitActions:[{use:"RecordCommentSubmitActionModel"}]}},sort:552})},394:function(e,t,n){n.d(t,{u:function(){return r}});var r=function(e,t){if((null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)&&e.message)return e.message;if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"){var n,r,o,i,l=e.response,a=null==l||null==(i=l.data)||null==(o=i.errors)||null==(r=o[0])?void 0:r.message;if(a)return a}return t}}}]);
|