@nocobase/plugin-block-grid-card 2.0.22 → 2.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +3 -3
- package/package.json +2 -2
package/dist/client/index.js
CHANGED
|
@@ -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("react"),require("@nocobase/flow-engine"),require("@emotion/css"),require("@nocobase/client"),require("@ant-design/icons"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-grid-card",["react","@nocobase/flow-engine","@emotion/css","@nocobase/client","@ant-design/icons","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-block-grid-card"]=t(require("react"),require("@nocobase/flow-engine"),require("@emotion/css"),require("@nocobase/client"),require("@ant-design/icons"),require("antd")):e["@nocobase/plugin-block-grid-card"]=t(e.react,e["@nocobase/flow-engine"],e["@emotion/css"],e["@nocobase/client"],e["@ant-design/icons"],e.antd)}(self,function(e,t,n,r,o,i){return function(){"use strict";var l={482:function(e){e.exports=o},964:function(e){e.exports=n},500:function(e){e.exports=r},667:function(e){e.exports=t},721:function(e){e.exports=i},156:function(t){t.exports=e}},c={};function a(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={exports:{}};return l[e](n,n.exports,a),n.exports}a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};return!function(){a.r(u),a.d(u,{default:function(){return J}});var e=a(500),t=a(667),n=a(482),r=a(156),o=a.n(r),i=a(721),l=a(964),c={xs:"Phone device",md:"Tablet device",lg:"Desktop device",xxl:"Large screen device"},s=["xs","md","lg","xxl"],f=[1,2,3,4,6,8,12,24].reduce(function(e,t){return e[t]=t,e},{}),d={xs:"< 768",md:"≥ 768",lg:"≥ 992",xxl:"≥ 1600"},p=JSON.parse('{"u2":"@nocobase/plugin-block-grid-card"}');function y(e){return(0,t.tExpr)(e,{ns:[p.u2,"client"]})}function b(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 h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t,n){return(g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=m(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 m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(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){h(e,t,n[t])})}return e}function w(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function O(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=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 b(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 b(e,t)}}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}function C(){var e=S(["\n .ant-spin-nested-loading {\n height: var(--nb-grid-card-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 j(){var e=S(["\n height: 100%;\n > div {\n height: 100%;\n }\n "]);return j=function(){return e},e}var k=function(r){var l;if("function"!=typeof r&&null!==r)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=m(t),h(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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||[],m(this).constructor):t.apply(this,n)),"_screens",void 0),h(e,"_defaultCustomModelClasses",{CollectionActionGroupModel:"CollectionActionGroupModel",RecordActionGroupModel:"RecordActionGroupModel",TableColumnModel:"TableColumnModel",TableAssociationFieldGroupModel:"TableAssociationFieldGroupModel",TableCustomColumnModel:"TableCustomColumnModel"}),e}return c.prototype=Object.create(r&&r.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),r&&x(c,r),l=[{key:"resource",get:function(){return g(m(c.prototype),"resource",this)}},{key:"useHooksBeforeRender",value:function(){var e=i.Grid.useBreakpoint();this._screens=["xxl","lg","md","xs"].find(function(t){return e[t]})||"lg"}},{key:"createResource",value:function(e,n){return this.context.createResource(t.MultiRecordResource)}},{key:"renderConfiguireActions",value:function(){return o().createElement(t.AddSubModelButton,{key:"table-column-add-actions",model:this,subModelBaseClass:this.getModelClassName("CollectionActionGroupModel"),subModelKey:"actions"},o().createElement(t.FlowSettingsButton,{icon:o().createElement(n.SettingOutlined,null)},this.translate("Actions")))}},{key:"pagination",value:function(){var t,n=this,r=this.resource.getMeta("count"),o=this.resource.getPageSize(),i=this.resource.getMeta("hasNext"),l=this.resource.getPage(),c=this.resource.getData(),a=(null==(t=this.props.columnCount)?void 0:t[this._screens])||1,u=this.props.rowCount||1,s=!!this.context.isMobileLayout,f=[1,2,3,5,10].map(function(e){return a*u*e});if(r)return(0,e.applyMobilePaginationProps)({current:l,pageSize:o,total:r,pageSizeOptions:f,showTotal:function(e){return n.translate("Total {{count}} items",{count:e})},showSizeChanger:!0,onChange:function(e,t){n.resource.loading=!0,n.resource.setPage(e),n.resource.setPageSize(t),n.resource.refresh()}},s);var d=o||10,p=l||1,y={simple:!0,showTitle:!1,showSizeChanger:!0,hideOnSinglePage:!1,pageSize:d,total:(0,e.getUnknownCountPaginationTotal)({dataLength:null==c?void 0:c.length,pageSize:d,current:p,hasNext:i}),className:(0,e.mergePaginationClassName)((0,e.getSimpleModePaginationClassName)(!0),void 0),itemRender:(0,e.createCompactSimpleItemRender)({current:p,controlHeight:this.context.themeToken.controlHeight})};return(0,e.applyMobilePaginationProps)(y,s)}},{key:"renderComponent",value:function(){var e=this.decoratorProps,t=e.heightMode,n=e.height;return o().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,l),c}(e.CollectionBlockModel);h(k,"scene",e.BlockSceneEnum.many);var E=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},R=function(e){var t,n=e.heightMode,o=e.containerRef,i=e.actionsRef,l=e.listRef,c=e.deps,a=void 0===c?[]:c,u=(t=(0,r.useState)(),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,c=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(c)throw r}}return i}}(t,2)||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=u[0],f=u[1],d=(0,r.useCallback)(function(){if("specifyValue"!==n&&"fullHeight"!==n)return void f(function(e){return void 0===e?e:void 0});var e,t=o.current;if(t){var r=t.getBoundingClientRect().height;if(r){var c=Math.max(0,Math.floor(r-E(i.current)-E(null==(e=l.current)?void 0:e.querySelector(".ant-list-pagination"))));f(function(e){return e===c?e:c})}}},[n,o,i,l]);return(0,r.useLayoutEffect)(function(){d()},[d].concat(O(a))),(0,r.useEffect)(function(){if(o.current&&"undefined"!=typeof ResizeObserver){var e,t=o.current,n=i.current,r=null==(e=l.current)?void 0:e.querySelector(".ant-list-pagination"),c=new ResizeObserver(function(){return d()});return c.observe(t),n&&c.observe(n),r&&c.observe(r),function(){return c.disconnect()}}},[d,o,i,l].concat(O(a))),s},B=(0,t.observer)(function(e){var n,c,a,u=e.model,s=e.heightMode,f=e.height,d=(0,r.useRef)(null),p=(0,r.useRef)(null),y=(0,r.useRef)(null),b="specifyValue"===s||"fullHeight"===s,g=u.context.themeToken,m=R({heightMode:s,containerRef:d,actionsRef:p,listRef:y,deps:[f]}),x=(0,r.useMemo)(function(){return(0,l.css)(C(),g.marginLG,g.marginLG,g.marginLG,g.marginLG)},[]),S=(0,r.useMemo)(function(){var e,t;return null==m?null==(e=u.props)?void 0:e.style:w(v({},(null==(t=u.props)?void 0:t.style)||{}),h({},"--nb-grid-card-height","".concat(m,"px")))},[m,null==(n=u.props)?void 0:n.style]),O=!!u.context.flowSettingsEnabled,P=u.props.columnCount;return o().createElement("div",{ref:d,style:b?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0},o().createElement("div",{ref:p},o().createElement(t.DndProvider,null,o().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:16}},o().createElement(i.Space,{wrap:!0},u.mapSubModels("actions",function(e){return"left"===e.props.position?o().createElement(t.FlowModelRenderer,{key:e.uid,model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"}}):null}),o().createElement("span",null)),o().createElement(i.Space,{wrap:!0},u.mapSubModels("actions",function(e){if(!e.hidden||O)return"left"!==e.props.position?o().createElement(t.Droppable,{model:e,key:e.uid},o().createElement(t.FlowModelRenderer,{model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:t.DragHandler,sort:1}]})):null}),u.renderConfiguireActions())))),o().createElement("div",{ref:y,style:{flex:1,minHeight:0}},o().createElement(i.List,w(v({},u.props),{className:(null==(c=u.props)?void 0:c.className)?"".concat(u.props.className," ").concat(x):x,style:S,pagination:u.pagination(),loading:null==(a=u.resource)?void 0:a.loading,dataSource:u.resource.getData(),grid:w(v({},P),{sm:P.xs,xl:P.lg,gutter:[g.marginBlock/2,g.marginBlock/2]}),renderItem:function(e,n){var r=u.subModels.item.createFork({},"".concat(n));return r.context.defineProperty("record",{get:function(){return e},cache:!1,resolveOnServer:!0}),r.context.defineProperty("index",{get:function(){return n},cache:!1,resolveOnServer:!0}),o().createElement(i.Col,{className:(0,l.css)(j())},o().createElement(t.FlowModelRenderer,{model:r}))}}))))});function T(e,t,n,r,o,i,l){try{var c=e[i](l),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}k.registerFlow({key:"resourceSettings2",steps:{}}),k.registerFlow({key:"GridCardSettings",sort:500,title:y("Grid card block settings"),steps:{columnCount:{title:y("Set the count of columns displayed in a row"),uiSchema:function(e){var t=e.t,n={"x-component":i.Slider,"x-decorator":"FormItem","x-component-props":{min:1,max:24,marks:f,tooltip:{formatter:function(e){return"".concat(e).concat(t("Column"))}},step:null}};return{columnCount:{type:"object",properties:s.reduce(function(e,r){return e[r]=w(v({},n),{title:t(c[r]),description:"".concat(t("Screen size")," ").concat(d[r]," ").concat(t("pixels"))}),e},{})}}},defaultParams:{columnCount:{xs:1,md:2,lg:3,xxl:4}},handler:function(e,t){e.model.setProps({columnCount:t.columnCount})}},rowCount:{title:y("Number of Rows"),uiSchema:{rowCount:{"x-component":i.InputNumber,"x-decorator":"FormItem"}},defaultParams:{rowCount:3},handler:function(e,t){e.model.resource.loading=!0,e.model.resource.setPage(1);var n=t.rowCount*e.model.props.columnCount[e.model._screens];e.model.resource.getPageSize()!==n&&e.model.resource.setPageSize(n)}},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(w(v({},t),{labelWidth:"vertical"===t.layout?null:t.labelWidth})),e.model.subModels.item.setProps(w(v({},t),{labelWidth:"vertical"===t.layout?"100%":t.labelWidth,labelWrap:"vertical"===t.layout||t.labelWrap}))}}}}),k.define({label:y("Grid card"),searchable:!0,searchPlaceholder:y("Search"),createModelOptions:{use:"GridCardBlockModel",subModels:{item:{use:"GridCardItemModel"}}},sort:500});function _(e,t,n){return(_="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=F(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 F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function G(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function I(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(I=function(){return!!e})()}function D(){var e=G(["\n height: 100%;\n .ant-card-body {\n height: 100%;\n }\n .ant-form-item {\n margin-bottom: 5px;\n }\n "]);return D=function(){return e},e}function z(){var e=G(["\n button {\n padding: 5px;\n }\n "]);return z=function(){return e},e}function N(){var e=G(["\n button {\n padding: 5px;\n padding-left: ",";\n }\n "]);return N=function(){return e},e}var q=function(r){var c;if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");function a(){var e,t;if(!(this instanceof a))throw TypeError("Cannot call a class as a function");return e=a,t=arguments,e=F(e),function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,I()?Reflect.construct(e,t||[],F(this).constructor):e.apply(this,t))}return a.prototype=Object.create(r&&r.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),r&&A(a,r),c=[{key:"onInit",value:function(e){_(F(a.prototype),"onInit",this).call(this,e)}},{key:"renderConfigureAction",value:function(){var e,r;return o().createElement(t.AddSubModelButton,{key:"table-row-actions-add",model:this,subModelBaseClass:this.context.getModelClassName("RecordActionGroupModel"),subModelKey:"actions",afterSubModelInit:(e=function(e){return function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var a=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(t){return e.setStepParams("buttonSettings","general",{type:"link",icon:null}),[2]})},r=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){T(i,r,o,l,c,"next",e)}function c(e){T(i,r,o,l,c,"throw",e)}l(void 0)})},function(e){return r.apply(this,arguments)})},o().createElement(t.FlowSettingsButton,{icon:o().createElement(n.SettingOutlined,null)},this.translate("Actions")))}},{key:"render",value:function(){var n=this,r=this.context.index,c=this.context.record,a=this.subModels.grid.createFork({},"grid-".concat(r));a.gridContainerRef=o().createRef();var u=(0,t.createRecordMetaFactory)(function(){return a.context.collection},a.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}});a.context.defineProperty("fieldIndex",{get:function(){return r},cache:!1}),a.context.defineProperty("record",{get:function(){return c},cache:!1,resolveOnServer:!0,meta:u}),a.context.defineProperty("fieldKey",{get:function(){return r}});var s=this.props,f=s.colon,d=s.labelAlign,p=s.labelWidth,y=s.labelWrap,b=s.layout,h=!!this.context.flowSettingsEnabled;return o().createElement(i.Card,{role:"button",className:(0,l.css)(D())},o().createElement("div",{style:{display:"flex",width:"100%",height:"100%",flexDirection:"column",justifyContent:"space-between",gap:"0px"}},o().createElement(e.FormComponent,{model:this,layoutProps:{colon:f,labelAlign:d,labelWidth:p,labelWrap:y,layout:b}},o().createElement(t.FlowModelRenderer,{model:a,showFlowSettings:!1})),o().createElement("div",null,o().createElement(t.DndProvider,null,o().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},o().createElement(i.Space,{className:(0,l.css)(z()),wrap:!0},this.mapSubModels("actions",function(e,i){var c=e.createFork({},"".concat(r));if(!c.hidden||h){var a=(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}});return c.context.defineProperty("record",{get:function(){return n.context.record},resolveOnServer:!0,meta:a,cache:!1}),o().createElement(t.Droppable,{model:c,key:c.uid},o().createElement("div",{className:(0,l.css)(N(),0===i?"0px":null)},o().createElement(t.FlowModelRenderer,{model:c,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)}}(a.prototype,c),a}(t.FlowModel);function L(e,t,n,r,o,i,l){try{var c=e[i](l),a=c.value}catch(e){n(e);return}c.done?t(a):Promise.resolve(a).then(r,o)}function W(e,t,n){return(W=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&&K(o,n.prototype),o}).apply(null,arguments)}q.define({createModelOptions:{use:"GridCardItemModel",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 K(e,t){return(K=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,H(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),K(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)&&"undefined"!=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&&K(n,e),t=[{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){var a=[i,c];if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}}(this,function(e){return t.flowEngine.registerModels({GridCardBlockModel:k,GridCardItemModel:q}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function l(e){L(i,r,o,l,c,"next",e)}function c(e){L(i,r,o,l,c,"throw",e)}l(void 0)})})()}}],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))}(),u}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@emotion/css"),require("react"),require("antd"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-block-grid-card",["@emotion/css","react","antd","@nocobase/client","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-block-grid-card"]=t(require("@emotion/css"),require("react"),require("antd"),require("@nocobase/client"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-block-grid-card"]=t(e["@emotion/css"],e.react,e.antd,e["@nocobase/client"],e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,r,n,o,i){return function(){"use strict";var l,c={375:function(e){e.exports=o},477:function(t){t.exports=e},342:function(e){e.exports=n},694:function(e){e.exports=i},59:function(e){e.exports=r},155:function(e){e.exports=t}},a={};function u(e){var t=a[e];if(void 0!==t)return t.exports;var r=a[e]={exports:{}};return c[e](r,r.exports,u),r.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 r in t)u.o(t,r)&&!u.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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"/"!==(l=window.__webpack_public_path__||"/").charAt(l.length-1)&&(l+="/"),u.p=l+"static/plugins/@nocobase/plugin-block-grid-card/dist/client/",!function(){u.r(b),u.d(b,{default:function(){return V}});var e=u(342),t=u(694),r=u(375),n=u(155),o=u.n(n),i=u(59),l=u(477),c={xs:"Phone device",md:"Tablet device",lg:"Desktop device",xxl:"Large screen device"},a=["xs","md","lg","xxl"],s=[1,2,3,4,6,8,12,24].reduce(function(e,t){return e[t]=t,e},{}),f={xs:"< 768",md:"≥ 768",lg:"≥ 992",xxl:"≥ 1600"},p=JSON.parse('{"UU":"@nocobase/plugin-block-grid-card"}');function d(e){return(0,t.tExpr)(e,{ns:[p.UU,"client"]})}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e,t,r){return(h="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=m(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r||e):o.value}})(e,t,r||e)}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){g(e,t,r[t])})}return e}function w(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function S(e){return function(e){if(Array.isArray(e))return y(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 y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(e,t)}}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}function j(){var e=O(["\n .ant-spin-nested-loading {\n height: var(--nb-grid-card-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 j=function(){return e},e}function C(){var e=O(["\n height: 100%;\n > div {\n height: 100%;\n }\n "]);return C=function(){return e},e}var k=function(n){var l;if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");function c(){var e,t,r;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return t=c,r=arguments,t=m(t),g(e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,M()?Reflect.construct(t,r||[],m(this).constructor):t.apply(this,r)),"_screens",void 0),g(e,"_defaultCustomModelClasses",{CollectionActionGroupModel:"CollectionActionGroupModel",RecordActionGroupModel:"RecordActionGroupModel",TableColumnModel:"TableColumnModel",TableAssociationFieldGroupModel:"TableAssociationFieldGroupModel",TableCustomColumnModel:"TableCustomColumnModel"}),e}return c.prototype=Object.create(n&&n.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),n&&x(c,n),l=[{key:"resource",get:function(){return h(m(c.prototype),"resource",this)}},{key:"useHooksBeforeRender",value:function(){var e=i.Grid.useBreakpoint();this._screens=["xxl","lg","md","xs"].find(function(t){return e[t]})||"lg"}},{key:"createResource",value:function(e,r){return this.context.createResource(t.MultiRecordResource)}},{key:"renderConfiguireActions",value:function(){return o().createElement(t.AddSubModelButton,{key:"table-column-add-actions",model:this,subModelBaseClass:this.getModelClassName("CollectionActionGroupModel"),subModelKey:"actions"},o().createElement(t.FlowSettingsButton,{icon:o().createElement(r.SettingOutlined,null)},this.translate("Actions")))}},{key:"pagination",value:function(){var t,r=this,n=this.resource.getMeta("count"),o=this.resource.getPageSize(),i=this.resource.getMeta("hasNext"),l=this.resource.getPage(),c=this.resource.getData(),a=(null==(t=this.props.columnCount)?void 0:t[this._screens])||1,u=this.props.rowCount||1,s=!!this.context.isMobileLayout,f=[1,2,3,5,10].map(function(e){return a*u*e});if(n)return(0,e.applyMobilePaginationProps)({current:l,pageSize:o,total:n,pageSizeOptions:f,showTotal:function(e){return r.translate("Total {{count}} items",{count:e})},showSizeChanger:!0,onChange:function(e,t){r.resource.loading=!0,r.resource.setPage(e),r.resource.setPageSize(t),r.resource.refresh()}},s);var p=o||10,d=l||1,b={simple:!0,showTitle:!1,showSizeChanger:!0,hideOnSinglePage:!1,pageSize:p,total:(0,e.getUnknownCountPaginationTotal)({dataLength:null==c?void 0:c.length,pageSize:p,current:d,hasNext:i}),className:(0,e.mergePaginationClassName)((0,e.getSimpleModePaginationClassName)(!0),void 0),itemRender:(0,e.createCompactSimpleItemRender)({current:d,controlHeight:this.context.themeToken.controlHeight})};return(0,e.applyMobilePaginationProps)(b,s)}},{key:"renderComponent",value:function(){var e=this.decoratorProps,t=e.heightMode,r=e.height;return o().createElement(_,{model:this,heightMode:t,height:r})}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(c.prototype,l),c}(e.CollectionBlockModel);g(k,"scene",e.BlockSceneEnum.many);var E=function(e){if(!e)return 0;var t=e.getBoundingClientRect(),r=window.getComputedStyle(e),n=parseFloat(r.marginTop)||0,o=parseFloat(r.marginBottom)||0;return t.height+n+o},R=function(e){var t,r=e.heightMode,o=e.containerRef,i=e.actionsRef,l=e.listRef,c=e.deps,a=void 0===c?[]:c,u=function(e){if(Array.isArray(e))return e}(t=(0,n.useState)())||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}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=u[0],f=u[1],p=(0,n.useCallback)(function(){if("specifyValue"!==r&&"fullHeight"!==r)return void f(function(e){return void 0===e?e:void 0});var e,t=o.current;if(t){var n=t.getBoundingClientRect().height;if(n){var c=Math.max(0,Math.floor(n-E(i.current)-E(null==(e=l.current)?void 0:e.querySelector(".ant-list-pagination"))));f(function(e){return e===c?e:c})}}},[r,o,i,l]);return(0,n.useLayoutEffect)(function(){p()},[p].concat(S(a))),(0,n.useEffect)(function(){if(o.current&&"u">typeof ResizeObserver){var e,t=o.current,r=i.current,n=null==(e=l.current)?void 0:e.querySelector(".ant-list-pagination"),c=new ResizeObserver(function(){return p()});return c.observe(t),r&&c.observe(r),n&&c.observe(n),function(){return c.disconnect()}}},[p,o,i,l].concat(S(a))),s},_=(0,t.observer)(function(e){var r,c,a,u=e.model,s=e.heightMode,f=e.height,p=(0,n.useRef)(null),d=(0,n.useRef)(null),b=(0,n.useRef)(null),y="specifyValue"===s||"fullHeight"===s,h=u.context.themeToken,m=R({heightMode:s,containerRef:p,actionsRef:d,listRef:b,deps:[f]}),x=(0,n.useMemo)(function(){return(0,l.css)(j(),h.marginLG,h.marginLG,h.marginLG,h.marginLG)},[]),O=(0,n.useMemo)(function(){var e,t;return null==m?null==(e=u.props)?void 0:e.style:w(v({},(null==(t=u.props)?void 0:t.style)||{}),g({},"--nb-grid-card-height","".concat(m,"px")))},[m,null==(r=u.props)?void 0:r.style]),S=!!u.context.flowSettingsEnabled,P=u.props.columnCount;return o().createElement("div",{ref:p,style:y?{display:"flex",flexDirection:"column",minHeight:0,height:"100%"}:void 0},o().createElement("div",{ref:d},o().createElement(t.DndProvider,null,o().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:16}},o().createElement(i.Space,{wrap:!0},u.mapSubModels("actions",function(e){return"left"===e.props.position?o().createElement(t.FlowModelRenderer,{key:e.uid,model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"}}):null}),o().createElement("span",null)),o().createElement(i.Space,{wrap:!0},u.mapSubModels("actions",function(e){if(!e.hidden||S)return"left"!==e.props.position?o().createElement(t.Droppable,{model:e,key:e.uid},o().createElement(t.FlowModelRenderer,{model:e,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:t.DragHandler,sort:1}]})):null}),u.renderConfiguireActions())))),o().createElement("div",{ref:b,style:{flex:1,minHeight:0}},o().createElement(i.List,w(v({},u.props),{className:(null==(c=u.props)?void 0:c.className)?"".concat(u.props.className," ").concat(x):x,style:O,pagination:u.pagination(),loading:null==(a=u.resource)?void 0:a.loading,dataSource:u.resource.getData(),grid:w(v({},P),{sm:P.xs,xl:P.lg,gutter:[h.marginBlock/2,h.marginBlock/2]}),renderItem:function(e,r){var n=u.subModels.item.createFork({},"".concat(r));return n.context.defineProperty("record",{get:function(){return e},cache:!1,resolveOnServer:!0}),n.context.defineProperty("index",{get:function(){return r},cache:!1,resolveOnServer:!0}),o().createElement(i.Col,{className:(0,l.css)(C())},o().createElement(t.FlowModelRenderer,{model:n}))}}))))});function T(e,t,r,n,o,i,l){try{var c=e[i](l),a=c.value}catch(e){r(e);return}c.done?t(a):Promise.resolve(a).then(n,o)}k.registerFlow({key:"resourceSettings2",steps:{}}),k.registerFlow({key:"GridCardSettings",sort:500,title:d("Grid card block settings"),steps:{columnCount:{title:d("Set the count of columns displayed in a row"),uiSchema:function(e){var t=e.t,r={"x-component":i.Slider,"x-decorator":"FormItem","x-component-props":{min:1,max:24,marks:s,tooltip:{formatter:function(e){return"".concat(e).concat(t("Column"))}},step:null}};return{columnCount:{type:"object",properties:a.reduce(function(e,n){return e[n]=w(v({},r),{title:t(c[n]),description:"".concat(t("Screen size")," ").concat(f[n]," ").concat(t("pixels"))}),e},{})}}},defaultParams:{columnCount:{xs:1,md:2,lg:3,xxl:4}},handler:function(e,t){e.model.setProps({columnCount:t.columnCount})}},rowCount:{title:d("Number of Rows"),uiSchema:{rowCount:{"x-component":i.InputNumber,"x-decorator":"FormItem"}},defaultParams:{rowCount:3},handler:function(e,t){e.model.resource.loading=!0,e.model.resource.setPage(1);var r=t.rowCount*e.model.props.columnCount[e.model._screens];e.model.resource.getPageSize()!==r&&e.model.resource.setPageSize(r)}},dataScope:{use:"dataScope",title:d("Data scope")},defaultSorting:{use:"sortingRule",title:d("Default sorting")},layout:{use:"layout",title:d("Layout"),handler:function(e,t){e.model.setProps(w(v({},t),{labelWidth:"vertical"===t.layout?null:t.labelWidth})),e.model.subModels.item.setProps(w(v({},t),{labelWidth:"vertical"===t.layout?"100%":t.labelWidth,labelWrap:"vertical"===t.layout||t.labelWrap}))}}}}),k.define({label:d("Grid card"),searchable:!0,searchPlaceholder:d("Search"),createModelOptions:{use:"GridCardBlockModel",subModels:{item:{use:"GridCardItemModel"}}},sort:500});function B(e,t,r){return(B="u">typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=F(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r||e):o.value}})(e,t,r||e)}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function G(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(G=function(){return!!e})()}function D(){var e=I(["\n height: 100%;\n .ant-card-body {\n height: 100%;\n }\n .ant-form-item {\n margin-bottom: 5px;\n }\n "]);return D=function(){return e},e}function N(){var e=I(["\n button {\n padding: 5px;\n }\n "]);return N=function(){return e},e}function z(){var e=I(["\n button {\n padding: 5px;\n padding-left: ",";\n }\n "]);return z=function(){return e},e}var q=function(n){var c;if("function"!=typeof n&&null!==n)throw TypeError("Super expression must either be null or a function");function a(){var e,t;if(!(this instanceof a))throw TypeError("Cannot call a class as a function");return e=a,t=arguments,e=F(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,G()?Reflect.construct(e,t||[],F(this).constructor):e.apply(this,t))}return a.prototype=Object.create(n&&n.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),n&&A(a,n),c=[{key:"onInit",value:function(e){B(F(a.prototype),"onInit",this).call(this,e)}},{key:"renderConfigureAction",value:function(){return o().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 r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(l,"next",{value:a(0)}),c(l,"throw",{value:a(1)}),c(l,"return",{value:a(2)}),"function"==typeof Symbol&&c(l,Symbol.iterator,{value:function(){return this}}),l;function a(c){return function(a){var u=[c,a];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=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++,n=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],n=0}finally{r=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,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function l(e){T(i,n,o,l,c,"next",e)}function c(e){T(i,n,o,l,c,"throw",e)}l(void 0)})})()}},o().createElement(t.FlowSettingsButton,{icon:o().createElement(r.SettingOutlined,null)},this.translate("Actions")))}},{key:"render",value:function(){var r=this,n=this.context.index,c=this.context.record,a=this.subModels.grid.createFork({},"grid-".concat(n));a.gridContainerRef=o().createRef();var u=(0,t.createRecordMetaFactory)(function(){return a.context.collection},a.context.t("Current record"),function(e){var t,r=e.collection,n=e.record,o=null==r?void 0:r.name,i=null==r?void 0:r.dataSourceKey,l=null==r||null==(t=r.getFilterByTK)?void 0:t.call(r,n);if(o&&null!=l)return{collection:o,dataSourceKey:i,filterByTk:l}});a.context.defineProperty("fieldIndex",{get:function(){return n},cache:!1}),a.context.defineProperty("record",{get:function(){return c},cache:!1,resolveOnServer:!0,meta:u}),a.context.defineProperty("fieldKey",{get:function(){return n}});var s=this.props,f=s.colon,p=s.labelAlign,d=s.labelWidth,b=s.labelWrap,y=s.layout,g=!!this.context.flowSettingsEnabled;return o().createElement(i.Card,{role:"button",className:(0,l.css)(D())},o().createElement("div",{style:{display:"flex",width:"100%",height:"100%",flexDirection:"column",justifyContent:"space-between",gap:"0px"}},o().createElement(e.FormComponent,{model:this,layoutProps:{colon:f,labelAlign:p,labelWidth:d,labelWrap:b,layout:y}},o().createElement(t.FlowModelRenderer,{model:a,showFlowSettings:!1})),o().createElement("div",null,o().createElement(t.DndProvider,null,o().createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},o().createElement(i.Space,{className:(0,l.css)(N()),wrap:!0},this.mapSubModels("actions",function(e,i){var c=e.createFork({},"".concat(n));if(!c.hidden||g){var a=(0,t.createRecordMetaFactory)(function(){return c.context.collection},c.context.t("Current record"),function(e){var t,r=e.collection,n=e.record,o=null==r?void 0:r.name,i=null==r?void 0:r.dataSourceKey,l=null==r||null==(t=r.getFilterByTK)?void 0:t.call(r,n);if(o&&null!=l)return{collection:o,dataSourceKey:i,filterByTk:l}});return c.context.defineProperty("record",{get:function(){return r.context.record},resolveOnServer:!0,meta:a,cache:!1}),o().createElement(t.Droppable,{model:c,key:c.uid},o().createElement("div",{className:(0,l.css)(z(),0===i?"0px":null)},o().createElement(t.FlowModelRenderer,{model:c,showFlowSettings:{showBackground:!1,showBorder:!1,toolbarPosition:"above"},extraToolbarItems:[{key:"drag-handler",component:t.DragHandler,sort:1}]})))}}),this.renderConfigureAction()))))))}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(a.prototype,c),a}(t.FlowModel);function L(e,t,r,n,o,i,l){try{var c=e[i](l),a=c.value}catch(e){r(e);return}c.done?t(a):Promise.resolve(a).then(n,o)}function W(e,t,r){return(W=$()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&K(o,r.prototype),o}).apply(null,arguments)}q.define({createModelOptions:{use:"GridCardItemModel",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 K(e,t){return(K=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,r)}function r(){return W(e,arguments,H(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),K(r,e)})(e)}function $(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return($=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 r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=H(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,$()?Reflect.construct(e,t||[],H(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&K(r,e),t=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(l,"next",{value:a(0)}),c(l,"throw",{value:a(1)}),c(l,"return",{value:a(2)}),"function"==typeof Symbol&&c(l,Symbol.iterator,{value:function(){return this}}),l;function a(c){return function(a){var u=[c,a];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=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++,n=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],n=0}finally{r=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({GridCardBlockModel:k,GridCardItemModel:q}),[2]})},function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function l(e){L(i,n,o,l,c,"next",e)}function c(e){L(i,n,o,l,c,"throw",e)}l(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(U(e.Plugin))}(),b}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/flow-engine": "2.0.
|
|
12
|
-
"@nocobase/client": "2.0.
|
|
13
|
-
"@nocobase/server": "2.0.
|
|
11
|
+
"@nocobase/flow-engine": "2.1.0-alpha.10",
|
|
12
|
+
"@nocobase/client": "2.1.0-alpha.10",
|
|
13
|
+
"@nocobase/server": "2.1.0-alpha.10",
|
|
14
14
|
"@ant-design/icons": "5.6.1",
|
|
15
15
|
"react": "18.2.0",
|
|
16
16
|
"antd": "5.24.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-block-grid-card",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0-alpha.10",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"displayName": "Block: GridCard",
|
|
6
6
|
"displayName.zh-CN": "区块:网格卡片",
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
"keywords": [
|
|
18
18
|
"Blocks"
|
|
19
19
|
],
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "ce790d46c0a5768ca9618c7d0d77ab8300de75c8"
|
|
21
21
|
}
|