@nocobase/plugin-block-list 2.1.0-alpha.30 → 2.1.0-alpha.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client-v2.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client-v2';
2
+ export { default } from './dist/client-v2';
package/client-v2.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client-v2/index.js');
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ "use strict";(self.webpackChunk_nocobase_plugin_block_list=self.webpackChunk_nocobase_plugin_block_list||[]).push([["442"],{17:function(e,t,n){n.r(t),n.d(t,{ListItemModel:function(){return m}});var r=n(694),o=n(155),l=n.n(o),c=n(477),i=n(375),a=n(485),u=n(59);function s(e,t,n,r,o,l,c){try{var i=e[l](c),a=i.value}catch(e){n(e);return}i.done?t(a):Promise.resolve(a).then(r,o)}function f(e,t,n){return(f="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=d(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 d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function b(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(b=function(){return!!e})()}function v(){var e=y(["\n .ant-form-item {\n margin-bottom: 5px;\n }\n "]);return v=function(){return e},e}function h(){var e=y(["\n button {\n padding: 5px;\n padding-left: ",";\n }\n "]);return h=function(){return e},e}var m=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=d(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,b()?Reflect.construct(e,t||[],d(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&p(n,e),t=[{key:"onInit",value:function(e){f(d(n.prototype),"onInit",this).call(this,e)}},{key:"renderConfigureAction",value:function(){return l().createElement(r.AddSubModelButton,{key:"table-row-actions-add",model:this,subModelBaseClass:this.context.getModelClassName("RecordActionGroupModel"),subModelKey:"actions",afterSubModelInit:function(e){var t;return(t=function(){return function(e,t){var n,r,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(c,"next",{value:a(0)}),i(c,"throw",{value:a(1)}),i(c,"return",{value:a(2)}),"function"==typeof Symbol&&i(c,Symbol.iterator,{value:function(){return this}}),c;function a(i){return function(a){var u=[i,a];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(l=0)),l;)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 l.label++,{value:u[1],done:!1};case 5:l.label++,r=u[1],u=[0];continue;case 7:u=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){l=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){l.label=u[1];break}if(6===u[0]&&l.label<o[1]){l.label=o[1],o=u;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(u);break}o[2]&&l.ops.pop(),l.trys.pop();continue}u=t.call(e,l)}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}}}}(this,function(t){return e.setStepParams("buttonSettings","general",{type:"link",icon:null}),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var l=t.apply(e,n);function c(e){s(l,r,o,c,i,"next",e)}function i(e){s(l,r,o,c,i,"throw",e)}c(void 0)})})()}},l().createElement(r.FlowSettingsButton,{icon:l().createElement(i.SettingOutlined,null)},this.translate("Actions")))}},{key:"render",value:function(){var e=this,t=this.context.index,n=this.context.record,o=this.subModels.grid.createFork({},"grid-".concat(t));o.gridContainerRef=l().createRef();var i=(0,r.createRecordMetaFactory)(function(){return o.context.collection},o.context.t("Current record"),function(e){var t,n=e.collection,r=e.record,o=null==n?void 0:n.name,l=null==n?void 0:n.dataSourceKey,c=null==n||null==(t=n.getFilterByTK)?void 0:t.call(n,r);if(o&&null!=c)return{collection:o,dataSourceKey:l,filterByTk:c}});o.context.defineProperty("fieldIndex",{get:function(){return t},cache:!1}),o.context.defineProperty("record",{get:function(){return n},cache:!1,resolveOnServer:!0,meta:i}),o.context.defineProperty("fieldKey",{get:function(){return t}});var s=this.props,f=s.colon,d=s.labelAlign,p=s.labelWidth,y=s.labelWrap,b=s.layout,m=!!this.context.flowSettingsEnabled;return l().createElement("div",{key:this.context.index,style:{width:"100%"},className:(0,c.css)(v())},l().createElement(a.FormComponent,{model:this,layoutProps:{colon:f,labelAlign:d,labelWidth:p,labelWrap:y,layout:b}},l().createElement(r.FlowModelRenderer,{model:o,showFlowSettings:!1})),l().createElement("div",null,l().createElement(r.DndProvider,null,l().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},l().createElement(u.Space,{wrap:!0},this.mapSubModels("actions",function(n,o){var i=n.createFork({},"".concat(t));if(!i.hidden||m){var a=(0,r.createRecordMetaFactory)(function(){return i.context.collection},i.context.t("Current record"),function(e){var t,n=e.collection,r=e.record,o=null==n?void 0:n.name,l=null==n?void 0:n.dataSourceKey,c=null==n||null==(t=n.getFilterByTK)?void 0:t.call(n,r);if(o&&null!=c)return{collection:o,dataSourceKey:l,filterByTk:c}});return i.context.defineProperty("record",{get:function(){return e.context.record},resolveOnServer:!0,meta:a,cache:!1}),l().createElement(r.Droppable,{model:i,key:i.uid},l().createElement("div",{className:(0,c.css)(h(),0===o?"0px":null)},l().createElement(r.FlowModelRenderer,{model:i,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:r.DragHandler,sort:1}]})))}}),this.renderConfigureAction())))))}}],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)}}(n.prototype,t),n}(r.FlowModel);m.define({createModelOptions:{use:"ListItemModel",subModels:{grid:{use:"DetailsGridModel"}}},sort:350})}}]);
@@ -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_list=self.webpackChunk_nocobase_plugin_block_list||[]).push([["505"],{24:function(e,t,n){n.r(t),n.d(t,{ListBlockModel:function(){return T}});var r=n(694),o=n(375),i=n(485),l=n(155),a=n.n(l),u=n(59),c=n(477);function s(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 f(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||p(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){if(e){if("string"==typeof e)return s(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 s(e,t)}}var d=function(e){if(!e)return 0;var t=e.getBoundingClientRect(),n=window.getComputedStyle(e),r=parseFloat(n.marginTop)||0,o=parseFloat(n.marginBottom)||0;return t.height+r+o},h=function(e){var t,n=e.heightMode,r=e.containerRef,o=e.actionsRef,i=e.listRef,a=e.deps,u=void 0===a?[]:a,c=function(e){if(Array.isArray(e))return e}(t=(0,l.useState)())||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||p(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s=c[0],h=c[1],g=(0,l.useCallback)(function(){if("specifyValue"!==n&&"fullHeight"!==n)return void h(function(e){return void 0===e?e:void 0});var e,t=r.current;if(t){var l=t.getBoundingClientRect().height;if(l){var a=Math.max(0,Math.floor(l-d(o.current)-d(null==(e=i.current)?void 0:e.querySelector(".ant-list-pagination"))));h(function(e){return e===a?e:a})}}},[n,r,o,i]);return(0,l.useLayoutEffect)(function(){g()},[g].concat(f(u))),(0,l.useEffect)(function(){if(r.current&&"u">typeof ResizeObserver){var e,t=r.current,n=o.current,l=null==(e=i.current)?void 0:e.querySelector(".ant-list-pagination"),a=new ResizeObserver(function(){return g()});return a.observe(t),n&&a.observe(n),l&&a.observe(l),function(){return a.disconnect()}}},[g,r,o,i].concat(f(u))),s},g=JSON.parse('{"UU":"@nocobase/plugin-block-list"}');function b(e){return(0,r.tExpr)(e,{ns:[g.UU,"client"]})}function y(e,t,n,r,o,i,l){try{var a=e[i](l),u=a.value}catch(e){n(e);return}a.done?t(u):Promise.resolve(u).then(r,o)}function m(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){y(i,r,o,l,a,"next",e)}function a(e){y(i,r,o,l,a,"throw",e)}l(void 0)})}}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e,t,n){return(w="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=S(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 S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}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){v(e,t,n[t])})}return e}function k(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 M(e,t){return(M=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function P(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}function j(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:u(0)}),a(l,"throw",{value:u(1)}),a(l,"return",{value:u(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function u(a){return function(u){var c=[a,u];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function E(){var e=P(["\n .ant-pagination-simple-pager {\n display: none !important;\n }\n "]);return E=function(){return e},e}function C(){var e=P(["\n .ant-pagination-item-link {\n min-width: ","px;\n }\n "]);return C=function(){return e},e}function x(){var e=P(["\n .ant-spin-nested-loading {\n height: var(--nb-list-height);\n overflow: auto;\n margin-left: -","px;\n margin-right: -","px;\n padding-left: ","px;\n padding-right: ","px;\n }\n .ant-spin-nested-loading > .ant-spin-container {\n min-height: 100%;\n }\n "]);return x=function(){return e},e}function A(){var e=P(["\n > div {\n width: 100%;\n }\n "]);return A=function(){return e},e}var T=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=S(t),v(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,R()?Reflect.construct(t,r||[],S(this).constructor):t.apply(this,r)),"_defaultCustomModelClasses",{CollectionActionGroupModel:"CollectionActionGroupModel",RecordActionGroupModel:"RecordActionGroupModel",TableColumnModel:"TableColumnModel",TableAssociationFieldGroupModel:"TableAssociationFieldGroupModel",TableCustomColumnModel:"TableCustomColumnModel"}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&M(n,e),t=[{key:"resource",get:function(){return w(S(n.prototype),"resource",this)}},{key:"createResource",value:function(e,t){return this.context.createResource(r.MultiRecordResource)}},{key:"renderConfigureActions",value:function(){return a().createElement(r.AddSubModelButton,{key:"table-column-add-actions",model:this,subModelBaseClass:this.getModelClassName("CollectionActionGroupModel"),subModelKey:"actions"},a().createElement(r.FlowSettingsButton,{icon:a().createElement(o.SettingOutlined,null)},this.translate("Actions")))}},{key:"pagination",value:function(){var e=this,t=this.resource.getMeta("count"),n=this.resource.getPageSize(),r=this.resource.getMeta("hasNext"),o=this.resource.getPage(),l=this.resource.getData();return t?{current:o,pageSize:n,total:t,showTotal:function(t){return e.translate("Total {{count}} items",{count:t})},showSizeChanger:!0,onChange:function(t,n){return m(function(){return j(this,function(e){switch(e.label){case 0:return this.resource.loading=!0,this.resource.setPage(t),this.resource.setPageSize(n),[4,this.resource.refresh()];case 1:return e.sent(),[4,new Promise(function(e){return setTimeout(e,0)})];case 2:return e.sent(),[4,(0,i.dispatchEventDeep)(this,"paginationChange")];case 3:return e.sent(),[2]}})}).call(e)}}:{simple:!0,showTitle:!1,showSizeChanger:!0,hideOnSinglePage:!1,pageSize:n,total:(null==l?void 0:l.length)<n||!r?n*o:n*o+1,className:(0,c.css)(E()),itemRender:function(t,n,r){return"prev"===n?a().createElement("div",{style:{display:"flex"},className:(0,c.css)(C(),e.context.themeToken.controlHeight)},r," ",a().createElement("div",null,e.resource.getPage())):r}}}},{key:"renderActions",value:function(){var e=!!this.context.flowSettingsEnabled;if(e||this.hasSubModel("actions"))return a().createElement(r.DndProvider,null,a().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:16}},a().createElement(u.Space,null,this.mapSubModels("actions",function(e){return"left"===e.props.position?a().createElement(r.FlowModelRenderer,{key:e.uid,model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"}}):null}),a().createElement("span",null)),a().createElement(u.Space,{wrap:!0},this.mapSubModels("actions",function(t){if(!t.hidden||e)return"left"!==t.props.position?a().createElement(r.Droppable,{model:t,key:t.uid},a().createElement(r.FlowModelRenderer,{model:t,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:r.DragHandler,sort:1}]})):null}),this.renderConfigureActions())))}},{key:"renderComponent",value:function(){var e=this.decoratorProps,t=e.heightMode,n=e.height;return a().createElement(_,{model:this,heightMode:t,height:n})}}],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)}}(n.prototype,t),n}(i.CollectionBlockModel);v(T,"scene",i.BlockSceneEnum.many);var _=(0,r.observer)(function(e){var t,n,o,i=e.model,s=e.heightMode,f=e.height,p=(0,l.useRef)(null),d=(0,l.useRef)(null),g=(0,l.useRef)(null),b="specifyValue"===s||"fullHeight"===s,y=i.context.themeToken,m=h({heightMode:s,containerRef:p,actionsRef:d,listRef:g,deps:[f]}),w=(0,l.useMemo)(function(){return(0,c.css)(x(),y.marginLG,y.marginLG,y.marginLG,y.marginLG)},[]),S=(0,l.useMemo)(function(){var e,t;return null==m?null==(e=i.props)?void 0:e.style:k(O({},(null==(t=i.props)?void 0:t.style)||{}),v({},"--nb-list-height","".concat(m,"px")))},[m,null==(t=i.props)?void 0:t.style]);return a().createElement("div",{ref:p,style:b?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0},a().createElement("div",{ref:d},i.renderActions()),a().createElement("div",{ref:g,style:{flex:1,minHeight:0}},a().createElement(u.List,k(O({},i.props),{className:(null==(n=i.props)?void 0:n.className)?"".concat(i.props.className," ").concat(w):w,style:S,pagination:i.pagination(),loading:null==(o=i.resource)?void 0:o.loading,dataSource:i.resource.getData(),renderItem:function(e,t){var n=i.subModels.item.createFork({},"".concat(t));return n.context.defineProperty("record",{get:function(){return e},cache:!1}),n.context.defineProperty("index",{get:function(){return t},cache:!1}),a().createElement(u.List.Item,{key:t,className:(0,c.css)(A())},a().createElement(r.FlowModelRenderer,{model:n}))}}))))});T.registerFlow({key:"resourceSettings2",steps:{}}),T.registerFlow({key:"listSettings",sort:500,title:b("List settings"),steps:{pageSize:{title:b("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:20},handler:function(e,t){e.model.resource.loading=!0,e.model.resource.setPage(1),e.model.resource.setPageSize(t.pageSize)}},dataScope:{use:"dataScope",title:b("Data scope")},defaultSorting:{use:"sortingRule",title:b("Default sorting")},layout:{use:"layout",title:b("Layout"),handler:function(e,t){e.model.setProps(k(O({},t),{labelWidth:"vertical"===t.layout?null:t.labelWidth})),e.model.subModels.item.setProps(k(O({},t),{labelWidth:"vertical"===t.layout?"100%":t.labelWidth,labelWrap:"vertical"===t.layout||t.labelWrap}))}},refreshData:{title:b("Refresh data"),handler:function(e,t){return m(function(){return j(this,function(e){return[2]})})()}}}}),T.registerFlow({key:"paginationChange",on:"paginationChange",steps:{linkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}}}}),T.define({label:b("List"),group:b("Content"),searchable:!0,searchPlaceholder:b("Search"),createModelOptions:{use:"ListBlockModel",subModels:{item:{use:"ListItemModel"}}},sort:500})}}]);
@@ -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("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-list",["@emotion/css","@nocobase/client-v2","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-block-list"]=t(require("@emotion/css"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-block-list"]=t(e["@emotion/css"],e["@nocobase/client-v2"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i){return function(){"use strict";var c,u,a,l={375:function(e){e.exports=o},477:function(t){t.exports=e},485:function(e){e.exports=t},694:function(e){e.exports=i},59:function(e){e.exports=r},155:function(e){e.exports=n}},s={};function f(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}};return l[e](n,n.exports,f),n.exports}f.m=l,f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce(function(t,n){return f.f[n](e,t),t},[]))},f.u=function(e){return""+e+"."+({442:"2904d0f91c183ebc",505:"648e7d046128cee4"})[e]+".js"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p={},f.l=function(e,t,n,r){if(p[e])return void p[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var a=c[u];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-block-list:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,f.nc&&o.setAttribute("nonce",f.nc),o.setAttribute("data-rspack","@nocobase/plugin-block-list:"+n),o.src=e),p[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=p[e];if(delete p[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(b=f.g.location+"");var p,b,d=f.g.document;if(!b&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(b=d.currentScript.src),!b)){var h=d.getElementsByTagName("script");if(h.length)for(var v=h.length-1;v>-1&&(!b||!/^http(s?):/.test(b));)b=h[v--].src}if(!b)throw Error("Automatic publicPath is not supported in this browser");f.p=b.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c={889:0},f.f.j=function(e,t){var n=f.o(c,e)?c[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=c[e]=[t,r]});t.push(n[2]=r);var o=f.p+f.u(e),i=Error();f.l(o,function(t){if(f.o(c,e)&&(0!==(n=c[e])&&(c[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},u=function(e,t){var n,r,o=t[0],i=t[1],u=t[2],a=0;if(o.some(function(e){return 0!==c[e]})){for(n in i)f.o(i,n)&&(f.m[n]=i[n]);u&&u(f)}for(e&&e(t);a<o.length;a++)r=o[a],f.o(c,r)&&c[r]&&c[r][0](),c[r]=0},(a=self.webpackChunk_nocobase_plugin_block_list=self.webpackChunk_nocobase_plugin_block_list||[]).forEach(u.bind(null,0)),a.push=u.bind(null,a.push.bind(a));var y={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src&&(e=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-block-list/dist/client-v2/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var r=window.location.pathname||"/",o=r.indexOf("/v2/");e=o>=0?r.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-block-list/dist/client-v2/"}f.p=e}(),!function(){f.r(y),f.d(y,{default:function(){return u}});var e=f(485);function t(e,t,n,r,o,i,c){try{var u=e[i](c),a=u.value}catch(e){n(e);return}u.done?t(a):Promise.resolve(a).then(r,o)}function n(e,t,r){return(n=c()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&o(i,n.prototype),i}).apply(null,arguments)}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){var t="function"==typeof Map?new Map:void 0;return(i=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,i)}function i(){return n(e,arguments,r(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),o(i,e)})(e)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var u=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function i(){var e,t;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return e=i,t=arguments,e=r(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||[],r(this).constructor):e.apply(this,t))}return i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&o(i,e),n=[{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:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.flowEngine.registerModelLoaders({ListBlockModel:{loader:function(){return f.e("505").then(f.bind(f,24))}},ListItemModel:{loader:function(){return f.e("442").then(f.bind(f,17))}}}),[2]})},function(){var n=this,r=arguments;return new Promise(function(o,i){var c=e.apply(n,r);function u(e){t(c,o,i,u,a,"next",e)}function a(e){t(c,o,i,u,a,"throw",e)}u(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(i.prototype,n),i}(i(e.Plugin))}(),y}()});
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare function useT(): (str: string) => string;
10
+ export declare function tExpr(key: string): string;
@@ -0,0 +1,59 @@
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 { MultiRecordResource } from '@nocobase/flow-engine';
10
+ import { CollectionBlockModel, ActionModel } from '@nocobase/client-v2';
11
+ import React from 'react';
12
+ import { ListItemModel } from './ListItemModel';
13
+ type ListBlockModelStructure = {
14
+ subModels: {
15
+ item: ListItemModel;
16
+ actions: ActionModel[];
17
+ };
18
+ };
19
+ export declare class ListBlockModel extends CollectionBlockModel<ListBlockModelStructure> {
20
+ static scene: import("@nocobase/client-v2").BlockSceneType;
21
+ _defaultCustomModelClasses: {
22
+ CollectionActionGroupModel: string;
23
+ RecordActionGroupModel: string;
24
+ TableColumnModel: string;
25
+ TableAssociationFieldGroupModel: string;
26
+ TableCustomColumnModel: string;
27
+ };
28
+ get resource(): MultiRecordResource<any>;
29
+ createResource(ctx: any, params: any): MultiRecordResource<unknown>;
30
+ renderConfigureActions(): React.JSX.Element;
31
+ pagination(): {
32
+ current: number;
33
+ pageSize: number;
34
+ total: any;
35
+ showTotal: (total: any) => any;
36
+ showSizeChanger: boolean;
37
+ onChange: (page: any, pageSize: any) => Promise<void>;
38
+ simple?: undefined;
39
+ showTitle?: undefined;
40
+ hideOnSinglePage?: undefined;
41
+ className?: undefined;
42
+ itemRender?: undefined;
43
+ } | {
44
+ simple: boolean;
45
+ showTitle: boolean;
46
+ showSizeChanger: boolean;
47
+ hideOnSinglePage: boolean;
48
+ pageSize: number;
49
+ total: number;
50
+ className: string;
51
+ itemRender: (_: any, type: any, originalElement: any) => any;
52
+ current?: undefined;
53
+ showTotal?: undefined;
54
+ onChange?: undefined;
55
+ };
56
+ renderActions(): React.JSX.Element;
57
+ renderComponent(): React.JSX.Element;
58
+ }
59
+ export {};
@@ -0,0 +1,23 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { FlowModel } from '@nocobase/flow-engine';
10
+ import React from 'react';
11
+ import { DetailsGridModel, ActionModel } from '@nocobase/client-v2';
12
+ type ListItemModelStructure = {
13
+ subModels: {
14
+ grid: DetailsGridModel;
15
+ actions: ActionModel[];
16
+ };
17
+ };
18
+ export declare class ListItemModel extends FlowModel<ListItemModelStructure> {
19
+ onInit(options: any): void;
20
+ renderConfigureAction(): React.JSX.Element;
21
+ render(): React.JSX.Element;
22
+ }
23
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export { ListBlockModel } from './ListBlockModel';
10
+ export { ListItemModel } from './ListItemModel';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import React from 'react';
10
+ export declare const useListHeight: ({ heightMode, containerRef, actionsRef, listRef, deps, }: {
11
+ heightMode?: string;
12
+ containerRef: React.RefObject<HTMLDivElement>;
13
+ actionsRef: React.RefObject<HTMLDivElement>;
14
+ listRef: React.RefObject<HTMLDivElement>;
15
+ deps?: React.DependencyList;
16
+ }) => number;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import { Plugin } from '@nocobase/client-v2';
10
+ export declare class PluginBlockListClient extends Plugin {
11
+ load(): Promise<void>;
12
+ }
13
+ export default PluginBlockListClient;
@@ -8,9 +8,10 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/flow-engine": "2.1.0-alpha.30",
12
- "@nocobase/client": "2.1.0-alpha.30",
13
- "@nocobase/server": "2.1.0-alpha.30",
11
+ "@nocobase/flow-engine": "2.1.0-alpha.32",
12
+ "@nocobase/client": "2.1.0-alpha.32",
13
+ "@nocobase/client-v2": "2.1.0-alpha.32",
14
+ "@nocobase/server": "2.1.0-alpha.32",
14
15
  "@ant-design/icons": "5.6.1",
15
16
  "react": "18.2.0",
16
17
  "antd": "5.24.2",
package/package.json CHANGED
@@ -4,18 +4,19 @@
4
4
  "displayName.zh-CN": "区块:列表",
5
5
  "description": "Display data in a list with pagination support.",
6
6
  "description.zh-CN": "以列表形式展示数据,支持分页设置",
7
- "version": "2.1.0-alpha.30",
7
+ "version": "2.1.0-alpha.32",
8
8
  "license": "Apache-2.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/block-list",
11
11
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/block-list",
12
12
  "peerDependencies": {
13
13
  "@nocobase/client": "1.x",
14
+ "@nocobase/client-v2": "2.x",
14
15
  "@nocobase/server": "1.x",
15
16
  "@nocobase/test": "1.x"
16
17
  },
17
18
  "keywords": [
18
19
  "Blocks"
19
20
  ],
20
- "gitHead": "292ae0ad87f195ed201b274902d21ecd96f5ddd0"
21
+ "gitHead": "1ba7d717e156651db17c615f9b9c48edd669d19b"
21
22
  }