@nocobase/plugin-block-list 2.1.0-alpha.40 → 2.1.0-alpha.45

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.
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
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("@nocobase/client"),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","@nocobase/client","@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("@nocobase/client"),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["@nocobase/client"],e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,l){return function(){"use strict";var a={375:function(e){e.exports=i},477:function(t){t.exports=e},342:function(e){e.exports=o},485:function(e){e.exports=t},694:function(e){e.exports=l},59:function(e){e.exports=r},155:function(e){e.exports=n}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return a[e](n,n.exports,u),n.exports}u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},u.d=function(e,t){for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.g.importScripts&&(s=u.g.location+"");var s,f=u.g.document;if(!s&&f&&(f.currentScript&&"SCRIPT"===f.currentScript.tagName.toUpperCase()&&(s=f.currentScript.src),!s)){var p=f.getElementsByTagName("script");if(p.length)for(var d=p.length-1;d>-1&&(!s||!/^http(s?):/.test(s));)s=p[d--].src}if(!s)throw Error("Automatic publicPath is not supported in this browser");u.p=s.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var b={};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/")}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/"}u.p=e}(),!function(){u.r(b),u.d(b,{default:function(){return V}});var e=u(342),t=u(694),n=u(375),r=u(485),o=u(155),i=u.n(o),l=u(59),a=u(477);function c(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 s(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(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 f(e,t){if(e){if("string"==typeof e)return c(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 c(e,t)}}var p=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},d=function(e){var t,n=e.heightMode,r=e.containerRef,i=e.actionsRef,l=e.listRef,a=e.deps,c=void 0===a?[]:a,u=function(e){if(Array.isArray(e))return e}(t=(0,o.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)||f(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.")}(),d=u[0],b=u[1],h=(0,o.useCallback)(function(){if("specifyValue"!==n&&"fullHeight"!==n)return void b(function(e){return void 0===e?e:void 0});var e,t=r.current;if(t){var o=t.getBoundingClientRect().height;if(o){var a=Math.max(0,Math.floor(o-p(i.current)-p(null==(e=l.current)?void 0:e.querySelector(".ant-list-pagination"))));b(function(e){return e===a?e:a})}}},[n,r,i,l]);return(0,o.useLayoutEffect)(function(){h()},[h].concat(s(c))),(0,o.useEffect)(function(){if(r.current&&"u">typeof ResizeObserver){var e,t=r.current,n=i.current,o=null==(e=l.current)?void 0:e.querySelector(".ant-list-pagination"),a=new ResizeObserver(function(){return h()});return a.observe(t),n&&a.observe(n),o&&a.observe(o),function(){return a.disconnect()}}},[h,r,i,l].concat(s(c))),d},h=JSON.parse('{"UU":"@nocobase/plugin-block-list"}');function y(e){return(0,t.tExpr)(e,{ns:[h.UU,"client"]})}function g(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 v(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){g(i,r,o,l,a,"next",e)}function a(e){g(i,r,o,l,a,"throw",e)}l(void 0)})}}function m(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=O(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 O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(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){m(e,t,n[t])})}return e}function x(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 P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function M(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}}}}function E(){var e=k(["\n .ant-pagination-simple-pager {\n display: none !important;\n }\n "]);return E=function(){return e},e}function R(){var e=k(["\n .ant-pagination-item-link {\n min-width: ","px;\n }\n "]);return R=function(){return e},e}function C(){var e=k(["\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 C=function(){return e},e}function _(){var e=k(["\n > div {\n width: 100%;\n }\n "]);return _=function(){return e},e}var T=function(e){var o;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function c(){var e,t,n;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return t=c,n=arguments,t=O(t),m(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,j()?Reflect.construct(t,n||[],O(this).constructor):t.apply(this,n)),"_defaultCustomModelClasses",{CollectionActionGroupModel:"CollectionActionGroupModel",RecordActionGroupModel:"RecordActionGroupModel",TableColumnModel:"TableColumnModel",TableAssociationFieldGroupModel:"TableAssociationFieldGroupModel",TableCustomColumnModel:"TableCustomColumnModel"}),e}return c.prototype=Object.create(e&&e.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),e&&P(c,e),o=[{key:"resource",get:function(){return w(O(c.prototype),"resource",this)}},{key:"createResource",value:function(e,n){return this.context.createResource(t.MultiRecordResource)}},{key:"renderConfigureActions",value:function(){return i().createElement(t.AddSubModelButton,{key:"table-column-add-actions",model:this,subModelBaseClass:this.getModelClassName("CollectionActionGroupModel"),subModelKey:"actions"},i().createElement(t.FlowSettingsButton,{icon:i().createElement(n.SettingOutlined,null)},this.translate("Actions")))}},{key:"pagination",value:function(){var e=this,t=this.resource.getMeta("count"),n=this.resource.getPageSize(),o=this.resource.getMeta("hasNext"),l=this.resource.getPage(),c=this.resource.getData();return t?{current:l,pageSize:n,total:t,showTotal:function(t){return e.translate("Total {{count}} items",{count:t})},showSizeChanger:!0,onChange:function(t,n){return v(function(){return M(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,r.dispatchEventDeep)(this,"paginationChange")];case 3:return e.sent(),[2]}})}).call(e)}}:{simple:!0,showTitle:!1,showSizeChanger:!0,hideOnSinglePage:!1,pageSize:n,total:(null==c?void 0:c.length)<n||!o?n*l:n*l+1,className:(0,a.css)(E()),itemRender:function(t,n,r){return"prev"===n?i().createElement("div",{style:{display:"flex"},className:(0,a.css)(R(),e.context.themeToken.controlHeight)},r," ",i().createElement("div",null,e.resource.getPage())):r}}}},{key:"renderActions",value:function(){var e=!!this.context.flowSettingsEnabled,n=this.context.themeToken;if(e||this.hasSubModel("actions"))return i().createElement(t.DndProvider,null,i().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:n.margin}},i().createElement(l.Space,null,this.mapSubModels("actions",function(e){return"left"===e.props.position?i().createElement(t.FlowModelRenderer,{key:e.uid,model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"}}):null}),i().createElement("span",null)),i().createElement(l.Space,{wrap:!0},this.mapSubModels("actions",function(n){if(!n.hidden||e)return"left"!==n.props.position?i().createElement(t.Droppable,{model:n,key:n.uid},i().createElement(t.FlowModelRenderer,{model:n,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:t.DragHandler,sort:1}]})):null}),this.renderConfigureActions())))}},{key:"renderComponent",value:function(){var e=this.decoratorProps,t=e.heightMode,n=e.height;return i().createElement(A,{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)}}(c.prototype,o),c}(r.CollectionBlockModel);m(T,"scene",r.BlockSceneEnum.many);var A=(0,t.observer)(function(e){var n,r,c,u=e.model,s=e.heightMode,f=e.height,p=(0,o.useRef)(null),b=(0,o.useRef)(null),h=(0,o.useRef)(null),y="specifyValue"===s||"fullHeight"===s,g=u.context.themeToken,v=d({heightMode:s,containerRef:p,actionsRef:b,listRef:h,deps:[f]}),w=(0,o.useMemo)(function(){return(0,a.css)(C(),g.marginLG,g.marginLG,g.marginLG,g.marginLG)},[]),O=(0,o.useMemo)(function(){var e,t;return null==v?null==(e=u.props)?void 0:e.style:x(S({},(null==(t=u.props)?void 0:t.style)||{}),m({},"--nb-list-height","".concat(v,"px")))},[v,null==(n=u.props)?void 0:n.style]);return i().createElement("div",{ref:p,style:y?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0},i().createElement("div",{ref:b},u.renderActions()),i().createElement("div",{ref:h,style:{flex:1,minHeight:0}},i().createElement(l.List,x(S({},u.props),{className:(null==(r=u.props)?void 0:r.className)?"".concat(u.props.className," ").concat(w):w,style:O,pagination:u.pagination(),loading:null==(c=u.resource)?void 0:c.loading,dataSource:u.resource.getData(),renderItem:function(e,n){var r=u.subModels.item.createFork({},"".concat(n));return r.context.defineProperty("record",{get:function(){return e},cache:!1}),r.context.defineProperty("index",{get:function(){return n},cache:!1}),i().createElement(l.List.Item,{key:n,className:(0,a.css)(_())},i().createElement(t.FlowModelRenderer,{model:r}))}}))))});function B(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)}T.registerFlow({key:"resourceSettings2",steps:{}}),T.registerFlow({key:"listSettings",sort:500,title:y("List settings"),steps:{pageSize:{title:y("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:y("Data scope")},defaultSorting:{use:"sortingRule",title:y("Default sorting")},layout:{use:"layout",title:y("Layout"),handler:function(e,t){e.model.setProps(x(S({},t),{labelWidth:"vertical"===t.layout?null:t.labelWidth})),e.model.subModels.item.setProps(x(S({},t),{labelWidth:"vertical"===t.layout?"100%":t.labelWidth,labelWrap:"vertical"===t.layout||t.labelWrap}))}},refreshData:{title:y("Refresh data"),handler:function(e,t){return v(function(){return M(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:y("List"),group:y("Content"),searchable:!0,searchPlaceholder:y("Search"),createModelOptions:{use:"ListBlockModel",subModels:{item:{use:"ListItemModel"}}},sort:500});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=I(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 I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function z(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(q=function(){return!!e})()}function G(){var e=z(["\n .ant-form-item {\n margin-bottom: ","px;\n }\n "]);return G=function(){return e},e}function L(){var e=z(["\n button {\n padding: ","px;\n padding-left: ","px;\n }\n "]);return L=function(){return e},e}var N=function(e){var o;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function c(){var e,t;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return e=c,t=arguments,e=I(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,q()?Reflect.construct(e,t||[],I(this).constructor):e.apply(this,t))}return c.prototype=Object.create(e&&e.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),e&&D(c,e),o=[{key:"onInit",value:function(e){F(I(c.prototype),"onInit",this).call(this,e)}},{key:"renderConfigureAction",value:function(){return i().createElement(t.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,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}}}}(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 i=t.apply(e,n);function l(e){B(i,r,o,l,a,"next",e)}function a(e){B(i,r,o,l,a,"throw",e)}l(void 0)})})()}},i().createElement(t.FlowSettingsButton,{icon:i().createElement(n.SettingOutlined,null)},this.translate("Actions")))}},{key:"render",value:function(){var e=this,n=this.context.index,o=this.context.record,c=this.subModels.grid.createFork({},"grid-".concat(n)),u=this.context.themeToken;c.gridContainerRef=i().createRef();var s=(0,t.createRecordMetaFactory)(function(){return c.context.collection},c.context.t("Current record"),function(e){var t,n=e.collection,r=e.record,o=null==n?void 0:n.name,i=null==n?void 0:n.dataSourceKey,l=null==n||null==(t=n.getFilterByTK)?void 0:t.call(n,r);if(o&&null!=l)return{collection:o,dataSourceKey:i,filterByTk:l}});c.context.defineProperty("fieldIndex",{get:function(){return n},cache:!1}),c.context.defineProperty("record",{get:function(){return o},cache:!1,resolveOnServer:!0,meta:s}),c.context.defineProperty("fieldKey",{get:function(){return n}});var f=this.props,p=f.colon,d=f.labelAlign,b=f.labelWidth,h=f.labelWrap,y=f.layout,g=!!this.context.flowSettingsEnabled;return i().createElement("div",{key:this.context.index,style:{width:"100%"},className:(0,a.css)(G(),u.marginXXS)},i().createElement(r.FormComponent,{model:this,layoutProps:{colon:p,labelAlign:d,labelWidth:b,labelWrap:h,layout:y}},i().createElement(t.FlowModelRenderer,{model:c,showFlowSettings:!1})),i().createElement("div",null,i().createElement(t.DndProvider,null,i().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},i().createElement(l.Space,{wrap:!0},this.mapSubModels("actions",function(r,o){var l=r.createFork({},"".concat(n));if(!l.hidden||g){var c=(0,t.createRecordMetaFactory)(function(){return l.context.collection},l.context.t("Current record"),function(e){var t,n=e.collection,r=e.record,o=null==n?void 0:n.name,i=null==n?void 0:n.dataSourceKey,l=null==n||null==(t=n.getFilterByTK)?void 0:t.call(n,r);if(o&&null!=l)return{collection:o,dataSourceKey:i,filterByTk:l}});return l.context.defineProperty("record",{get:function(){return e.context.record},resolveOnServer:!0,meta:c,cache:!1}),i().createElement(t.Droppable,{model:l,key:l.uid},i().createElement("div",{className:(0,a.css)(L(),u.paddingXXS,0===o?0:u.paddingXXS)},i().createElement(t.FlowModelRenderer,{model:l,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:t.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)}}(c.prototype,o),c}(t.FlowModel);function K(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 W(e,t,n){return(W=X()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&H(o,n.prototype),o}).apply(null,arguments)}N.define({createModelOptions:{use:"ListItemModel",subModels:{grid:{use:"DetailsGridModel"}}},sort:350});function $(e){return($=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function H(e,t){return(H=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 W(e,arguments,$(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),H(n,e)})(e)}function X(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(X=function(){return!!e})()}var V=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=$(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,X()?Reflect.construct(e,t||[],$(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&H(n,e),t=[{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:[]},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}}}}(this,function(e){return this.flowEngine.registerModels({ListBlockModel:T,ListItemModel:N}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){K(i,r,o,l,a,"next",e)}function a(e){K(i,r,o,l,a,"throw",e)}l(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)}}(n.prototype,t),n}(U(e.Plugin))}(),b}()});
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("@nocobase/client"),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","@nocobase/client","@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("@nocobase/client"),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["@nocobase/client"],e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,l){return function(){"use strict";var a={375:function(e){e.exports=i},477:function(t){t.exports=e},342:function(e){e.exports=o},485:function(e){e.exports=t},694:function(e){e.exports=l},59:function(e){e.exports=r},155:function(e){e.exports=n}},c={};function u(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return a[e](n,n.exports,u),n.exports}u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,{a:t}),t},u.d=function(e,t){for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.g.importScripts&&(s=u.g.location+"");var s,f=u.g.document;if(!s&&f&&(f.currentScript&&"SCRIPT"===f.currentScript.tagName.toUpperCase()&&(s=f.currentScript.src),!s)){var p=f.getElementsByTagName("script");if(p.length)for(var d=p.length-1;d>-1&&(!s||!/^http(s?):/.test(s));)s=p[d--].src}if(!s)throw Error("Automatic publicPath is not supported in this browser");u.p=s.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var b={};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/")}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/"}u.p=e}(),!function(){u.r(b),u.d(b,{default:function(){return J}});var e=u(342),t=u(694),n=u(375),r=u(485),o=u(155),i=u.n(o),l=u(59),a=u(477);function c(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 s(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||f(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 f(e,t){if(e){if("string"==typeof e)return c(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 c(e,t)}}var p=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},d=function(e){var t,n=e.heightMode,r=e.containerRef,i=e.actionsRef,l=e.listRef,a=e.deps,c=void 0===a?[]:a,u=function(e){if(Array.isArray(e))return e}(t=(0,o.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)||f(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.")}(),d=u[0],b=u[1],h=(0,o.useCallback)(function(){if("specifyValue"!==n&&"fullHeight"!==n)return void b(function(e){return void 0===e?e:void 0});var e,t=r.current;if(t){var o=t.getBoundingClientRect().height;if(o){var a=Math.max(0,Math.floor(o-p(i.current)-p(null==(e=l.current)?void 0:e.querySelector(".ant-list-pagination"))));b(function(e){return e===a?e:a})}}},[n,r,i,l]);return(0,o.useLayoutEffect)(function(){h()},[h].concat(s(c))),(0,o.useEffect)(function(){if(r.current&&"u">typeof ResizeObserver){var e,t=r.current,n=i.current,o=null==(e=l.current)?void 0:e.querySelector(".ant-list-pagination"),a=new ResizeObserver(function(){return h()});return a.observe(t),n&&a.observe(n),o&&a.observe(o),function(){return a.disconnect()}}},[h,r,i,l].concat(s(c))),d},h=JSON.parse('{"UU":"@nocobase/plugin-block-list"}');function y(e){return(0,t.tExpr)(e,{ns:[h.UU,"client"]})}function g(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 v(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){g(i,r,o,l,a,"next",e)}function a(e){g(i,r,o,l,a,"throw",e)}l(void 0)})}}function m(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=O(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 O(e){return(O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function S(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){m(e,t,n[t])})}return e}function x(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 P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=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: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}}}}function E(){var e=k(["\n .ant-pagination-simple-pager {\n display: none !important;\n }\n "]);return E=function(){return e},e}function R(){var e=k(["\n .ant-pagination-item-link {\n min-width: ","px;\n }\n "]);return R=function(){return e},e}function C(){var e=k(["\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 C=function(){return e},e}function _(){var e=k(["\n > div {\n width: 100%;\n }\n "]);return _=function(){return e},e}var T=new Set(["destroyMany","updateMany"]),A=function(e){var o;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function c(){var e,t,n;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return t=c,n=arguments,t=O(t),m(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,M()?Reflect.construct(t,n||[],O(this).constructor):t.apply(this,n)),"_defaultCustomModelClasses",{CollectionActionGroupModel:"CollectionActionGroupModel",RecordActionGroupModel:"RecordActionGroupModel",TableColumnModel:"TableColumnModel",TableAssociationFieldGroupModel:"TableAssociationFieldGroupModel",TableCustomColumnModel:"TableCustomColumnModel"}),e}return c.prototype=Object.create(e&&e.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),e&&P(c,e),o=[{key:"resource",get:function(){return w(O(c.prototype),"resource",this)}},{key:"createResource",value:function(e,n){return this.context.createResource(t.MultiRecordResource)}},{key:"getCollectionActionItems",value:function(e){return v(function(){return j(this,function(n){switch(n.label){case 0:return[4,(0,t.buildItems)(this.getModelClassName("CollectionActionGroupModel"))(e)];case 1:return[2,n.sent().filter(function(t){var n,r=null==(n=t.useModel?e.engine.getModelClass(t.useModel):void 0)?void 0:n.capabilityActionName;return!r||!T.has(r)})]}})}).call(this)}},{key:"renderConfigureActions",value:function(){var e=this;return i().createElement(t.AddSubModelButton,{key:"table-column-add-actions",model:this,items:function(t){return e.getCollectionActionItems(t)},subModelKey:"actions"},i().createElement(t.FlowSettingsButton,{icon:i().createElement(n.SettingOutlined,null)},this.translate("Actions")))}},{key:"pagination",value:function(){var e=this,t=this.resource.getMeta("count"),n=this.resource.getPageSize(),o=this.resource.getMeta("hasNext"),l=this.resource.getPage(),c=this.resource.getData();return t?{current:l,pageSize:n,total:t,showTotal:function(t){return e.translate("Total {{count}} items",{count:t})},showSizeChanger:!0,onChange:function(t,n){return v(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,r.dispatchEventDeep)(this,"paginationChange")];case 3:return e.sent(),[2]}})}).call(e)}}:{simple:!0,showTitle:!1,showSizeChanger:!0,hideOnSinglePage:!1,pageSize:n,total:(null==c?void 0:c.length)<n||!o?n*l:n*l+1,className:(0,a.css)(E()),itemRender:function(t,n,r){return"prev"===n?i().createElement("div",{style:{display:"flex"},className:(0,a.css)(R(),e.context.themeToken.controlHeight)},r," ",i().createElement("div",null,e.resource.getPage())):r}}}},{key:"renderActions",value:function(){var e=!!this.context.flowSettingsEnabled,n=this.context.themeToken;if(e||this.hasSubModel("actions"))return i().createElement(t.DndProvider,null,i().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:n.margin}},i().createElement(l.Space,null,this.mapSubModels("actions",function(e){return"left"===e.props.position?i().createElement(t.FlowModelRenderer,{key:e.uid,model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"}}):null}),i().createElement("span",null)),i().createElement(l.Space,{wrap:!0},this.mapSubModels("actions",function(n){if(!n.hidden||e)return"left"!==n.props.position?i().createElement(t.Droppable,{model:n,key:n.uid},i().createElement(t.FlowModelRenderer,{model:n,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:t.DragHandler,sort:1}]})):null}),this.renderConfigureActions())))}},{key:"renderComponent",value:function(){var e=this.decoratorProps,t=e.heightMode,n=e.height;return i().createElement(B,{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)}}(c.prototype,o),c}(r.CollectionBlockModel);m(A,"scene",r.BlockSceneEnum.many);var B=(0,t.observer)(function(e){var n,r,c,u=e.model,s=e.heightMode,f=e.height,p=(0,o.useRef)(null),b=(0,o.useRef)(null),h=(0,o.useRef)(null),y="specifyValue"===s||"fullHeight"===s,g=u.context.themeToken,v=d({heightMode:s,containerRef:p,actionsRef:b,listRef:h,deps:[f]}),w=(0,o.useMemo)(function(){return(0,a.css)(C(),g.marginLG,g.marginLG,g.marginLG,g.marginLG)},[g.marginLG]),O=(0,o.useMemo)(function(){var e,t;return null==v?null==(e=u.props)?void 0:e.style:x(S({},(null==(t=u.props)?void 0:t.style)||{}),m({},"--nb-list-height","".concat(v,"px")))},[v,null==(n=u.props)?void 0:n.style]);return i().createElement("div",{ref:p,style:y?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0},i().createElement("div",{ref:b},u.renderActions()),i().createElement("div",{ref:h,style:{flex:1,minHeight:0}},i().createElement(l.List,x(S({},u.props),{className:(null==(r=u.props)?void 0:r.className)?"".concat(u.props.className," ").concat(w):w,style:O,pagination:u.pagination(),loading:null==(c=u.resource)?void 0:c.loading,dataSource:u.resource.getData(),renderItem:function(e,n){var r=u.subModels.item.createFork({},"".concat(n));return r.context.defineProperty("record",{get:function(){return e},cache:!1}),r.context.defineProperty("index",{get:function(){return n},cache:!1}),i().createElement(l.List.Item,{key:n,className:(0,a.css)(_())},i().createElement(t.FlowModelRenderer,{model:r}))}}))))});function F(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)}A.registerFlow({key:"resourceSettings2",steps:{}}),A.registerFlow({key:"listSettings",sort:500,title:y("List settings"),steps:{pageSize:{title:y("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:y("Data scope")},defaultSorting:{use:"sortingRule",title:y("Default sorting")},layout:{use:"layout",title:y("Layout"),handler:function(e,t){e.model.setProps(x(S({},t),{labelWidth:"vertical"===t.layout?null:t.labelWidth})),e.model.subModels.item.setProps(x(S({},t),{labelWidth:"vertical"===t.layout?"100%":t.labelWidth,labelWrap:"vertical"===t.layout||t.labelWrap}))}},refreshData:{title:y("Refresh data"),handler:function(e,t){return v(function(){return j(this,function(e){return[2]})})()}}}}),A.registerFlow({key:"paginationChange",on:"paginationChange",steps:{linkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}}}}),A.define({label:y("List"),group:y("Content"),searchable:!0,searchPlaceholder:y("Search"),createModelOptions:{use:"ListBlockModel",subModels:{item:{use:"ListItemModel"}}},sort:500});function I(e,t,n){return(I="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 z(e,t){return(z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function L(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(L=function(){return!!e})()}function q(){var e=G(["\n .ant-form-item {\n margin-bottom: ","px;\n }\n "]);return q=function(){return e},e}function N(){var e=G(["\n button {\n padding: ","px;\n padding-left: ","px;\n }\n "]);return N=function(){return e},e}var K=function(e){var o;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function c(){var e,t;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return e=c,t=arguments,e=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,L()?Reflect.construct(e,t||[],D(this).constructor):e.apply(this,t))}return c.prototype=Object.create(e&&e.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),e&&z(c,e),o=[{key:"onInit",value:function(e){I(D(c.prototype),"onInit",this).call(this,e)}},{key:"renderConfigureAction",value:function(){return i().createElement(t.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,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}}}}(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 i=t.apply(e,n);function l(e){F(i,r,o,l,a,"next",e)}function a(e){F(i,r,o,l,a,"throw",e)}l(void 0)})})()}},i().createElement(t.FlowSettingsButton,{icon:i().createElement(n.SettingOutlined,null)},this.translate("Actions")))}},{key:"render",value:function(){var e=this,n=this.context.index,o=this.context.record,c=this.subModels.grid.createFork({},"grid-".concat(n)),u=this.context.themeToken;c.gridContainerRef=i().createRef();var s=(0,t.createRecordMetaFactory)(function(){return c.context.collection},c.context.t("Current record"),function(e){var t,n=e.collection,r=e.record,o=null==n?void 0:n.name,i=null==n?void 0:n.dataSourceKey,l=null==n||null==(t=n.getFilterByTK)?void 0:t.call(n,r);if(o&&null!=l)return{collection:o,dataSourceKey:i,filterByTk:l}});c.context.defineProperty("fieldIndex",{get:function(){return n},cache:!1}),c.context.defineProperty("record",{get:function(){return o},cache:!1,resolveOnServer:!0,meta:s}),c.context.defineProperty("fieldKey",{get:function(){return n}});var f=this.props,p=f.colon,d=f.labelAlign,b=f.labelWidth,h=f.labelWrap,y=f.layout,g=!!this.context.flowSettingsEnabled;return i().createElement("div",{key:this.context.index,style:{width:"100%"},className:(0,a.css)(q(),u.marginXXS)},i().createElement(r.FormComponent,{model:this,layoutProps:{colon:p,labelAlign:d,labelWidth:b,labelWrap:h,layout:y}},i().createElement(t.FlowModelRenderer,{model:c,showFlowSettings:!1})),i().createElement("div",null,i().createElement(t.DndProvider,null,i().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},i().createElement(l.Space,{wrap:!0},this.mapSubModels("actions",function(r,o){var l=r.createFork({},"".concat(n));if(!l.hidden||g){var c=(0,t.createRecordMetaFactory)(function(){return l.context.collection},l.context.t("Current record"),function(e){var t,n=e.collection,r=e.record,o=null==n?void 0:n.name,i=null==n?void 0:n.dataSourceKey,l=null==n||null==(t=n.getFilterByTK)?void 0:t.call(n,r);if(o&&null!=l)return{collection:o,dataSourceKey:i,filterByTk:l}});return l.context.defineProperty("record",{get:function(){return e.context.record},resolveOnServer:!0,meta:c,cache:!1}),i().createElement(t.Droppable,{model:l,key:l.uid},i().createElement("div",{className:(0,a.css)(N(),u.paddingXXS,0===o?0:u.paddingXXS)},i().createElement(t.FlowModelRenderer,{model:l,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:t.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)}}(c.prototype,o),c}(t.FlowModel);function W(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,t,n){return($=V()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&U(o,n.prototype),o}).apply(null,arguments)}K.define({createModelOptions:{use:"ListItemModel",subModels:{grid:{use:"DetailsGridModel"}}},sort:350});function H(e){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function X(e){var t="function"==typeof Map?new Map:void 0;return(X=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 $(e,arguments,H(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),U(n,e)})(e)}function V(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(V=function(){return!!e})()}var J=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=H(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,V()?Reflect.construct(e,t||[],H(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&U(n,e),t=[{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:[]},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}}}}(this,function(e){return this.flowEngine.registerModels({ListBlockModel:A,ListItemModel:K}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){W(i,r,o,l,a,"next",e)}function a(e){W(i,r,o,l,a,"throw",e)}l(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)}}(n.prototype,t),n}(X(e.Plugin))}(),b}()});
@@ -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_client_v2=self.webpackChunk_nocobase_plugin_block_list_client_v2||[]).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 y(e){return(0,r.tExpr)(e,{ns:[g.UU,"client"]})}function b(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){b(i,r,o,l,a,"next",e)}function a(e){b(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 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 k(e,t){return(k=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 C(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 j(){var e=P(["\n .ant-pagination-simple-pager {\n display: none !important;\n }\n "]);return j=function(){return e},e}function E(){var e=P(["\n .ant-pagination-item-link {\n min-width: ","px;\n }\n "]);return E=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 _=new Set(["destroyMany","updateMany"]),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&&k(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:"getCollectionActionItems",value:function(e){return m(function(){return C(this,function(t){switch(t.label){case 0:return[4,(0,r.buildItems)(this.getModelClassName("CollectionActionGroupModel"))(e)];case 1:return[2,t.sent().filter(function(t){var n,r=null==(n=t.useModel?e.engine.getModelClass(t.useModel):void 0)?void 0:n.capabilityActionName;return!r||!_.has(r)})]}})}).call(this)}},{key:"renderConfigureActions",value:function(){var e=this;return a().createElement(r.AddSubModelButton,{key:"table-column-add-actions",model:this,items:function(t){return e.getCollectionActionItems(t)},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 C(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)(j()),itemRender:function(t,n,r){return"prev"===n?a().createElement("div",{style:{display:"flex"},className:(0,c.css)(E(),e.context.themeToken.controlHeight)},r," ",a().createElement("div",null,e.resource.getPage())):r}}}},{key:"renderActions",value:function(){var e=!!this.context.flowSettingsEnabled,t=this.context.themeToken;if(e||this.hasSubModel("actions"))return a().createElement(r.DndProvider,null,a().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:t.margin}},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(z,{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 z=(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),y="specifyValue"===s||"fullHeight"===s,b=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(),b.marginLG,b.marginLG,b.marginLG,b.marginLG)},[b.marginLG]),S=(0,l.useMemo)(function(){var e,t;return null==m?null==(e=i.props)?void 0:e.style:M(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:y?{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,M(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:y("List settings"),steps:{pageSize:{title:y("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:y("Data scope")},defaultSorting:{use:"sortingRule",title:y("Default sorting")},layout:{use:"layout",title:y("Layout"),handler:function(e,t){e.model.setProps(M(O({},t),{labelWidth:"vertical"===t.layout?null:t.labelWidth})),e.model.subModels.item.setProps(M(O({},t),{labelWidth:"vertical"===t.layout?"100%":t.labelWidth,labelWrap:"vertical"===t.layout||t.labelWrap}))}},refreshData:{title:y("Refresh data"),handler:function(e,t){return m(function(){return C(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:y("List"),group:y("Content"),searchable:!0,searchPlaceholder:y("Search"),createModelOptions:{use:"ListBlockModel",subModels:{item:{use:"ListItemModel"}}},sort:500})}}]);
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
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/client-v2",["@emotion/css","@nocobase/client-v2","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-block-list/client-v2"]=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/client-v2"]=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:"70dc2f912fc30803",505:"2f8afb5c70d2b39b"})[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/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,f.nc&&o.setAttribute("nonce",f.nc),o.setAttribute("data-rspack","@nocobase/plugin-block-list/client-v2:"+n),o.src=e),p[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=p[e];if(delete p[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(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 v=d.getElementsByTagName("script");if(v.length)for(var h=v.length-1;h>-1&&(!b||!/^http(s?):/.test(b));)b=v[h--].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_client_v2=self.webpackChunk_nocobase_plugin_block_list_client_v2||[]).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}()});
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/client-v2",["@emotion/css","@nocobase/client-v2","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-block-list/client-v2"]=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/client-v2"]=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:"70dc2f912fc30803",505:"30f6da139025aa72"})[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/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,f.nc&&o.setAttribute("nonce",f.nc),o.setAttribute("data-rspack","@nocobase/plugin-block-list/client-v2:"+n),o.src=e),p[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=p[e];if(delete p[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(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 v=d.getElementsByTagName("script");if(v.length)for(var h=v.length-1;h>-1&&(!b||!/^http(s?):/.test(b));)b=v[h--].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_client_v2=self.webpackChunk_nocobase_plugin_block_list_client_v2||[]).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}()});
@@ -6,7 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- import { MultiRecordResource } from '@nocobase/flow-engine';
9
+ import { MultiRecordResource, FlowModelContext, SubModelItem } from '@nocobase/flow-engine';
10
10
  import { CollectionBlockModel, ActionModel } from '@nocobase/client-v2';
11
11
  import React from 'react';
12
12
  import { ListItemModel } from './ListItemModel';
@@ -27,6 +27,7 @@ export declare class ListBlockModel extends CollectionBlockModel<ListBlockModelS
27
27
  };
28
28
  get resource(): MultiRecordResource<any>;
29
29
  createResource(ctx: any, params: any): MultiRecordResource<unknown>;
30
+ getCollectionActionItems(ctx: FlowModelContext): Promise<SubModelItem[]>;
30
31
  renderConfigureActions(): React.JSX.Element;
31
32
  pagination(): {
32
33
  current: number;
@@ -8,10 +8,10 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/flow-engine": "2.1.0-alpha.40",
12
- "@nocobase/client": "2.1.0-alpha.40",
13
- "@nocobase/client-v2": "2.1.0-alpha.40",
14
- "@nocobase/server": "2.1.0-alpha.40",
11
+ "@nocobase/flow-engine": "2.1.0-alpha.45",
12
+ "@nocobase/client": "2.1.0-alpha.45",
13
+ "@nocobase/client-v2": "2.1.0-alpha.45",
14
+ "@nocobase/server": "2.1.0-alpha.45",
15
15
  "@ant-design/icons": "5.6.1",
16
16
  "react": "18.2.0",
17
17
  "antd": "5.24.2",
package/package.json CHANGED
@@ -4,7 +4,7 @@
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.40",
7
+ "version": "2.1.0-alpha.45",
8
8
  "license": "Apache-2.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/block-list",
@@ -18,5 +18,5 @@
18
18
  "keywords": [
19
19
  "Blocks"
20
20
  ],
21
- "gitHead": "e73f99dd0abefe847f2e50ff0fea1f41a82fd048"
21
+ "gitHead": "e9e24987e12d0ad10a5db8815b1e1b7b447f1938"
22
22
  }
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_block_list_client_v2=self.webpackChunk_nocobase_plugin_block_list_client_v2||[]).push([["505"],{24:function(e,t,n){n.r(t),n.d(t,{ListBlockModel:function(){return _}});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 _=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,t=this.context.themeToken;if(e||this.hasSubModel("actions"))return a().createElement(r.DndProvider,null,a().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:t.margin}},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(T,{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(_,"scene",i.BlockSceneEnum.many);var T=(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}))}}))))});_.registerFlow({key:"resourceSettings2",steps:{}}),_.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]})})()}}}}),_.registerFlow({key:"paginationChange",on:"paginationChange",steps:{linkageRulesRefresh:{use:"linkageRulesRefresh",defaultParams:{actionName:"blockLinkageRules",flowKey:"cardSettings",stepKey:"linkageRules"}}}}),_.define({label:b("List"),group:b("Content"),searchable:!0,searchPlaceholder:b("Search"),createModelOptions:{use:"ListBlockModel",subModels:{item:{use:"ListItemModel"}}},sort:500})}}]);