@nocobase/plugin-block-grid-card 2.1.0-alpha.12 → 2.1.0-alpha.14
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/dist/server/plugin.d.ts +0 -2
- package/dist/server/plugin.js +0 -4
- package/package.json +2 -2
- package/dist/server/flow-schema-contributions/index.d.ts +0 -10
- package/dist/server/flow-schema-contributions/index.js +0 -449
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("@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,n,r,o,i){return function(){"use strict";var l={375:function(e){e.exports=o},477:function(t){t.exports=e},342:function(e){e.exports=r},694:function(e){e.exports=i},59:function(e){e.exports=n},155:function(e){e.exports=t}},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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(u=a.g.location+"");var u,s=a.g.document;if(!u&&s&&(s.currentScript&&"SCRIPT"===s.currentScript.tagName.toUpperCase()&&(u=s.currentScript.src),!u)){var f=s.getElementsByTagName("script");if(f.length)for(var p=f.length-1;p>-1&&(!u||!/^http(s?):/.test(u));)u=f[p--].src}if(!u)throw Error("Automatic publicPath is not supported in this browser");a.p=u.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var d={},b=window.__nocobase_public_path__||"";if(!b&&window.location&&window.location.pathname){var y=window.location.pathname||"/",h=y.indexOf("/v2/");b=h>=0?y.slice(0,h+1):"/"}return b&&(b=b.replace(/\/v2\/?$/,"/")),b||(b="/"),"/"!==b.charAt(b.length-1)&&(b+="/"),a.p=b+"static/plugins/@nocobase/plugin-block-grid-card/dist/client/",!function(){a.r(d),a.d(d,{default:function(){return V}});var e=a(342),t=a(694),n=a(375),r=a(155),o=a.n(r),i=a(59),l=a(477),c={xs:"Phone device",md:"Tablet device",lg:"Desktop device",xxl:"Large screen device"},u=["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 b(e){return(0,t.tExpr)(e,{ns:[p.UU,"client"]})}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function 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="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=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){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 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 n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}}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(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)&&"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||[],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 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,n=e.height;return o().createElement(_,{model:this,heightMode:t,height:n})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(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=function(e){if(Array.isArray(e))return e}(t=(0,r.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=u[0],f=u[1],p=(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(){p()},[p].concat(S(a))),(0,r.useEffect)(function(){if(o.current&&"u">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 p()});return c.observe(t),n&&c.observe(n),r&&c.observe(r),function(){return c.disconnect()}}},[p,o,i,l].concat(S(a))),s},_=(0,t.observer)(function(e){var n,c,a,u=e.model,s=e.heightMode,f=e.height,p=(0,r.useRef)(null),d=(0,r.useRef)(null),b=(0,r.useRef)(null),y="specifyValue"===s||"fullHeight"===s,g=u.context.themeToken,m=R({heightMode:s,containerRef:p,actionsRef:d,listRef:b,deps:[f]}),x=(0,r.useMemo)(function(){return(0,l.css)(j(),g.marginLG,g.marginLG,g.marginLG,g.marginLG)},[]),O=(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]),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:[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)(C())},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:b("Grid card block settings"),steps:{columnCount:{title:b("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:s,tooltip:{formatter:function(e){return"".concat(e).concat(t("Column"))}},step:null}};return{columnCount:{type:"object",properties:u.reduce(function(e,r){return e[r]=w(v({},n),{title:t(c[r]),description:"".concat(t("Screen size")," ").concat(f[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:b("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:b("Data scope")},defaultSorting:{use:"sortingRule",title:b("Default sorting")},layout:{use:"layout",title:b("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:b("Grid card"),searchable:!0,searchPlaceholder:b("Search"),createModelOptions:{use:"GridCardBlockModel",subModels:{item:{use:"GridCardItemModel"}}},sort:500});function B(e,t,n){return(B="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=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 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(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)&&"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,G()?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){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 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),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(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){T(i,r,o,l,c,"next",e)}function c(e){T(i,r,o,l,c,"throw",e)}l(void 0)})})()}},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,p=s.labelAlign,d=s.labelWidth,b=s.labelWrap,y=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: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(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)(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 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=$()?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 $(){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 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,$()?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;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),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(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({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)})}).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))}(),d}()});
|
|
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,n,r,o,i){return function(){"use strict";var l={375:function(e){e.exports=o},477:function(t){t.exports=e},342:function(e){e.exports=r},694:function(e){e.exports=i},59:function(e){e.exports=n},155:function(e){e.exports=t}},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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(u=a.g.location+"");var u,s=a.g.document;if(!u&&s&&(s.currentScript&&"SCRIPT"===s.currentScript.tagName.toUpperCase()&&(u=s.currentScript.src),!u)){var f=s.getElementsByTagName("script");if(f.length)for(var p=f.length-1;p>-1&&(!u||!/^http(s?):/.test(u));)u=f[p--].src}if(!u)throw Error("Automatic publicPath is not supported in this browser");a.p=u.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var d={};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-grid-card/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-grid-card/dist/client/"}a.p=e}(),!function(){a.r(d),a.d(d,{default:function(){return J}});var e=a(342),t=a(694),n=a(375),r=a(155),o=a.n(r),i=a(59),l=a(477),c={xs:"Phone device",md:"Tablet device",lg:"Desktop device",xxl:"Large screen device"},u=["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 b(e){return(0,t.tExpr)(e,{ns:[p.UU,"client"]})}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t,n){return(h="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=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){g(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){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 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 n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}}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(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),g(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||[],m(this).constructor):t.apply(this,n)),"_screens",void 0),g(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 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,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 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,n=e.height;return o().createElement(_,{model:this,heightMode:t,height:n})}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(c.prototype,l),c}(e.CollectionBlockModel);g(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=function(e){if(Array.isArray(e))return e}(t=(0,r.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=u[0],f=u[1],p=(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(){p()},[p].concat(S(a))),(0,r.useEffect)(function(){if(o.current&&"u">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 p()});return c.observe(t),n&&c.observe(n),r&&c.observe(r),function(){return c.disconnect()}}},[p,o,i,l].concat(S(a))),s},_=(0,t.observer)(function(e){var n,c,a,u=e.model,s=e.heightMode,f=e.height,p=(0,r.useRef)(null),d=(0,r.useRef)(null),b=(0,r.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,r.useMemo)(function(){return(0,l.css)(j(),h.marginLG,h.marginLG,h.marginLG,h.marginLG)},[]),O=(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)||{}),g({},"--nb-grid-card-height","".concat(m,"px")))},[m,null==(n=u.props)?void 0:n.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,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)(C())},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:b("Grid card block settings"),steps:{columnCount:{title:b("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:s,tooltip:{formatter:function(e){return"".concat(e).concat(t("Column"))}},step:null}};return{columnCount:{type:"object",properties:u.reduce(function(e,r){return e[r]=w(v({},n),{title:t(c[r]),description:"".concat(t("Screen size")," ").concat(f[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:b("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:b("Data scope")},defaultSorting:{use:"sortingRule",title:b("Default sorting")},layout:{use:"layout",title:b("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:b("Grid card"),searchable:!0,searchPlaceholder:b("Search"),createModelOptions:{use:"GridCardBlockModel",subModels:{item:{use:"GridCardItemModel"}}},sort:500});function B(e,t,n){return(B="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=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 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=new WeakMap,W=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)&&"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,G()?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){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 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),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(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){T(i,r,o,l,c,"next",e)}function c(e){T(i,r,o,l,c,"throw",e)}l(void 0)})})()}},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,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 a,u,s,f="".concat(r),p=(null==(s=n.context.collection)||null==(u=s.getFilterByTK)?void 0:u.call(s,c))||"".concat(null!=(a=null==c?void 0:c.id)?a:"","-").concat(f),d=e.getFork(f);d&&q.get(d)!==p&&d.dispose();var b=e.createFork({},f);if(q.set(b,p),b.invalidateFlowCache("beforeRender"),!b.hidden||g){var y=(0,t.createRecordMetaFactory)(function(){return b.context.collection},b.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 b.context.defineProperty("record",{get:function(){return n.context.record},resolveOnServer:!0,meta:y,cache:!1}),o().createElement(t.Droppable,{model:b,key:b.uid},o().createElement("div",{className:(0,l.css)(z(),0===i?"0px":null)},o().createElement(t.FlowModelRenderer,{model:b,inputArgs: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 K(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 L(e,t,n){return(L=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&&$(o,n.prototype),o}).apply(null,arguments)}W.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 $(e,t){return($=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 L(e,arguments,H(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),$(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&&$(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),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(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({GridCardBlockModel:k,GridCardItemModel:W}),[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,c,"next",e)}function c(e){K(i,r,o,l,c,"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))}(),d}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/flow-engine": "2.1.0-alpha.
|
|
12
|
-
"@nocobase/client": "2.1.0-alpha.
|
|
13
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
11
|
+
"@nocobase/flow-engine": "2.1.0-alpha.14",
|
|
12
|
+
"@nocobase/client": "2.1.0-alpha.14",
|
|
13
|
+
"@nocobase/server": "2.1.0-alpha.14",
|
|
14
14
|
"@ant-design/icons": "5.6.1",
|
|
15
15
|
"react": "18.2.0",
|
|
16
16
|
"antd": "5.24.2",
|
package/dist/server/plugin.d.ts
CHANGED
|
@@ -6,11 +6,9 @@
|
|
|
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 type { FlowSchemaContribution } from '@nocobase/flow-engine';
|
|
10
9
|
import { Plugin } from '@nocobase/server';
|
|
11
10
|
export declare class PluginBlockGridCardServer extends Plugin {
|
|
12
11
|
afterAdd(): Promise<void>;
|
|
13
|
-
getFlowSchemaContributions(): FlowSchemaContribution;
|
|
14
12
|
beforeLoad(): Promise<void>;
|
|
15
13
|
load(): Promise<void>;
|
|
16
14
|
install(): Promise<void>;
|
package/dist/server/plugin.js
CHANGED
|
@@ -31,13 +31,9 @@ __export(plugin_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(plugin_exports);
|
|
33
33
|
var import_server = require("@nocobase/server");
|
|
34
|
-
var import_flow_schema_contributions = require("./flow-schema-contributions");
|
|
35
34
|
class PluginBlockGridCardServer extends import_server.Plugin {
|
|
36
35
|
async afterAdd() {
|
|
37
36
|
}
|
|
38
|
-
getFlowSchemaContributions() {
|
|
39
|
-
return import_flow_schema_contributions.flowSchemaContribution;
|
|
40
|
-
}
|
|
41
37
|
async beforeLoad() {
|
|
42
38
|
}
|
|
43
39
|
async load() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-block-grid-card",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.14",
|
|
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": "d8735b541de0ff9557bba704de49c799b4962672"
|
|
21
21
|
}
|
|
@@ -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
|
-
import type { FlowSchemaContribution } from '@nocobase/flow-engine';
|
|
10
|
-
export declare const flowSchemaContribution: FlowSchemaContribution;
|
|
@@ -1,449 +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
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __export = (target, all) => {
|
|
15
|
-
for (var name in all)
|
|
16
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
-
};
|
|
18
|
-
var __copyProps = (to, from, except, desc) => {
|
|
19
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
-
for (let key of __getOwnPropNames(from))
|
|
21
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
-
var flow_schema_contributions_exports = {};
|
|
28
|
-
__export(flow_schema_contributions_exports, {
|
|
29
|
-
flowSchemaContribution: () => flowSchemaContribution
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(flow_schema_contributions_exports);
|
|
32
|
-
const genericFilterSchemaId = "urn:nocobase:schema:plugin-block-grid-card:generic-filter";
|
|
33
|
-
const genericFilterSchema = {
|
|
34
|
-
$id: genericFilterSchemaId,
|
|
35
|
-
definitions: {
|
|
36
|
-
filterCondition: {
|
|
37
|
-
type: "object",
|
|
38
|
-
properties: {
|
|
39
|
-
path: {
|
|
40
|
-
type: "string"
|
|
41
|
-
},
|
|
42
|
-
operator: {
|
|
43
|
-
type: "string"
|
|
44
|
-
},
|
|
45
|
-
value: {},
|
|
46
|
-
noValue: {
|
|
47
|
-
type: "boolean"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
required: ["path"],
|
|
51
|
-
additionalProperties: true,
|
|
52
|
-
allOf: [
|
|
53
|
-
{
|
|
54
|
-
not: {
|
|
55
|
-
required: ["logic"]
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
not: {
|
|
60
|
-
required: ["items"]
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
filterGroup: {
|
|
66
|
-
type: "object",
|
|
67
|
-
properties: {
|
|
68
|
-
logic: {
|
|
69
|
-
type: "string",
|
|
70
|
-
enum: ["$and", "$or"]
|
|
71
|
-
},
|
|
72
|
-
items: {
|
|
73
|
-
type: "array",
|
|
74
|
-
items: {
|
|
75
|
-
oneOf: [
|
|
76
|
-
{ $ref: `${genericFilterSchemaId}#/definitions/filterCondition` },
|
|
77
|
-
{ $ref: `${genericFilterSchemaId}#/definitions/filterGroup` }
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
required: ["logic", "items"],
|
|
83
|
-
additionalProperties: true,
|
|
84
|
-
allOf: [
|
|
85
|
-
{
|
|
86
|
-
not: {
|
|
87
|
-
required: ["path"]
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
not: {
|
|
92
|
-
required: ["operator"]
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
not: {
|
|
97
|
-
required: ["value"]
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
not: {
|
|
102
|
-
required: ["noValue"]
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
type: "object",
|
|
109
|
-
properties: {
|
|
110
|
-
logic: {
|
|
111
|
-
type: "string",
|
|
112
|
-
enum: ["$and", "$or"]
|
|
113
|
-
},
|
|
114
|
-
items: {
|
|
115
|
-
type: "array",
|
|
116
|
-
items: {
|
|
117
|
-
oneOf: [
|
|
118
|
-
{ $ref: `${genericFilterSchemaId}#/definitions/filterCondition` },
|
|
119
|
-
{ $ref: `${genericFilterSchemaId}#/definitions/filterGroup` }
|
|
120
|
-
]
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
required: ["logic", "items"],
|
|
125
|
-
additionalProperties: true,
|
|
126
|
-
allOf: [
|
|
127
|
-
{
|
|
128
|
-
not: {
|
|
129
|
-
required: ["path"]
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
not: {
|
|
134
|
-
required: ["operator"]
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
not: {
|
|
139
|
-
required: ["value"]
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
not: {
|
|
144
|
-
required: ["noValue"]
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
};
|
|
149
|
-
const sortingRuleParamsSchema = {
|
|
150
|
-
type: "object",
|
|
151
|
-
properties: {
|
|
152
|
-
sort: {
|
|
153
|
-
type: "array",
|
|
154
|
-
items: {
|
|
155
|
-
type: "object",
|
|
156
|
-
properties: {
|
|
157
|
-
field: { type: "string" },
|
|
158
|
-
direction: { type: "string", enum: ["asc", "desc"] }
|
|
159
|
-
},
|
|
160
|
-
required: ["field", "direction"],
|
|
161
|
-
additionalProperties: false
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
additionalProperties: false
|
|
166
|
-
};
|
|
167
|
-
const layoutParamsSchema = {
|
|
168
|
-
type: "object",
|
|
169
|
-
properties: {
|
|
170
|
-
layout: {
|
|
171
|
-
type: "string",
|
|
172
|
-
enum: ["vertical", "horizontal"]
|
|
173
|
-
},
|
|
174
|
-
labelAlign: {
|
|
175
|
-
type: "string",
|
|
176
|
-
enum: ["left", "right"]
|
|
177
|
-
},
|
|
178
|
-
labelWidth: { type: ["number", "string", "null"] },
|
|
179
|
-
labelWrap: { type: "boolean" },
|
|
180
|
-
colon: { type: "boolean" }
|
|
181
|
-
},
|
|
182
|
-
required: ["layout"],
|
|
183
|
-
additionalProperties: false
|
|
184
|
-
};
|
|
185
|
-
const genericModelNodeSchema = {
|
|
186
|
-
type: "object",
|
|
187
|
-
required: ["uid", "use"],
|
|
188
|
-
properties: {
|
|
189
|
-
uid: { type: "string" },
|
|
190
|
-
use: { type: "string" }
|
|
191
|
-
},
|
|
192
|
-
additionalProperties: true
|
|
193
|
-
};
|
|
194
|
-
const collectionResourceInitSchema = {
|
|
195
|
-
type: "object",
|
|
196
|
-
properties: {
|
|
197
|
-
dataSourceKey: { type: "string" },
|
|
198
|
-
collectionName: { type: "string" },
|
|
199
|
-
associationName: { type: "string" },
|
|
200
|
-
sourceId: { type: ["string", "number"] },
|
|
201
|
-
filterByTk: { type: ["string", "number"] }
|
|
202
|
-
},
|
|
203
|
-
required: ["dataSourceKey", "collectionName"],
|
|
204
|
-
additionalProperties: true
|
|
205
|
-
};
|
|
206
|
-
const collectionResourceSettingsStepParamsSchema = {
|
|
207
|
-
type: "object",
|
|
208
|
-
properties: {
|
|
209
|
-
resourceSettings: {
|
|
210
|
-
type: "object",
|
|
211
|
-
properties: {
|
|
212
|
-
init: collectionResourceInitSchema
|
|
213
|
-
},
|
|
214
|
-
additionalProperties: true
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
additionalProperties: true
|
|
218
|
-
};
|
|
219
|
-
const createCollectionResourceStepParams = (init = {}, extraStepParams = {}) => ({
|
|
220
|
-
resourceSettings: {
|
|
221
|
-
init: {
|
|
222
|
-
dataSourceKey: "main",
|
|
223
|
-
collectionName: "users",
|
|
224
|
-
...init
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
...extraStepParams
|
|
228
|
-
});
|
|
229
|
-
const createAssociatedCollectionPattern = (use, extraStepParams = {}) => ({
|
|
230
|
-
title: "Associated records in popup/new scene",
|
|
231
|
-
description: "Use associationName + sourceId when the block should load records through a parent relation.",
|
|
232
|
-
snippet: {
|
|
233
|
-
use,
|
|
234
|
-
stepParams: createCollectionResourceStepParams(
|
|
235
|
-
{
|
|
236
|
-
collectionName: "roles",
|
|
237
|
-
associationName: "users.roles",
|
|
238
|
-
sourceId: "{{ctx.view.inputArgs.sourceId}}"
|
|
239
|
-
},
|
|
240
|
-
extraStepParams
|
|
241
|
-
)
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
const gridCardItemModelInternalSchemaContribution = {
|
|
245
|
-
use: "GridCardItemModel",
|
|
246
|
-
title: "Grid card item",
|
|
247
|
-
source: "plugin",
|
|
248
|
-
strict: false,
|
|
249
|
-
exposure: "internal",
|
|
250
|
-
subModelSlots: {
|
|
251
|
-
grid: {
|
|
252
|
-
type: "object",
|
|
253
|
-
use: "DetailsGridModel",
|
|
254
|
-
description: "Grid card details grid."
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
skeleton: {
|
|
258
|
-
uid: "todo-grid-card-item-uid",
|
|
259
|
-
use: "GridCardItemModel",
|
|
260
|
-
subModels: {
|
|
261
|
-
grid: {
|
|
262
|
-
uid: "todo-grid-card-item-grid-uid",
|
|
263
|
-
use: "DetailsGridModel"
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
const gridCardBlockModelSchemaContribution = {
|
|
269
|
-
use: "GridCardBlockModel",
|
|
270
|
-
title: "Grid card block",
|
|
271
|
-
source: "plugin",
|
|
272
|
-
strict: false,
|
|
273
|
-
stepParamsSchema: {
|
|
274
|
-
type: "object",
|
|
275
|
-
properties: {
|
|
276
|
-
...collectionResourceSettingsStepParamsSchema.properties || {},
|
|
277
|
-
resourceSettings2: {
|
|
278
|
-
type: "object",
|
|
279
|
-
additionalProperties: true
|
|
280
|
-
},
|
|
281
|
-
GridCardSettings: {
|
|
282
|
-
type: "object",
|
|
283
|
-
properties: {
|
|
284
|
-
columnCount: {
|
|
285
|
-
type: "object",
|
|
286
|
-
properties: {
|
|
287
|
-
xs: { type: "number" },
|
|
288
|
-
sm: { type: "number" },
|
|
289
|
-
md: { type: "number" },
|
|
290
|
-
lg: { type: "number" },
|
|
291
|
-
xl: { type: "number" },
|
|
292
|
-
xxl: { type: "number" }
|
|
293
|
-
},
|
|
294
|
-
additionalProperties: false
|
|
295
|
-
},
|
|
296
|
-
rowCount: {
|
|
297
|
-
type: "object",
|
|
298
|
-
properties: {
|
|
299
|
-
rowCount: { type: "number" }
|
|
300
|
-
},
|
|
301
|
-
additionalProperties: false
|
|
302
|
-
},
|
|
303
|
-
dataScope: {
|
|
304
|
-
type: "object",
|
|
305
|
-
properties: {
|
|
306
|
-
filter: genericFilterSchema
|
|
307
|
-
},
|
|
308
|
-
additionalProperties: false
|
|
309
|
-
},
|
|
310
|
-
defaultSorting: sortingRuleParamsSchema,
|
|
311
|
-
layout: layoutParamsSchema
|
|
312
|
-
},
|
|
313
|
-
additionalProperties: true
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
additionalProperties: true
|
|
317
|
-
},
|
|
318
|
-
subModelSlots: {
|
|
319
|
-
item: {
|
|
320
|
-
type: "object",
|
|
321
|
-
use: "GridCardItemModel",
|
|
322
|
-
description: "Grid card item layout."
|
|
323
|
-
},
|
|
324
|
-
actions: {
|
|
325
|
-
type: "array",
|
|
326
|
-
dynamic: true,
|
|
327
|
-
schema: genericModelNodeSchema,
|
|
328
|
-
description: "Grid card actions depend on runtime collection-action registries."
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
skeleton: {
|
|
332
|
-
uid: "todo-uid",
|
|
333
|
-
use: "GridCardBlockModel",
|
|
334
|
-
stepParams: createCollectionResourceStepParams(
|
|
335
|
-
{},
|
|
336
|
-
{
|
|
337
|
-
GridCardSettings: {
|
|
338
|
-
columnCount: {
|
|
339
|
-
xs: 1,
|
|
340
|
-
md: 2,
|
|
341
|
-
lg: 3,
|
|
342
|
-
xxl: 4
|
|
343
|
-
},
|
|
344
|
-
rowCount: {
|
|
345
|
-
rowCount: 3
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
),
|
|
350
|
-
subModels: {
|
|
351
|
-
item: {
|
|
352
|
-
uid: "todo-grid-card-item-uid",
|
|
353
|
-
use: "GridCardItemModel"
|
|
354
|
-
},
|
|
355
|
-
actions: []
|
|
356
|
-
}
|
|
357
|
-
},
|
|
358
|
-
docs: {
|
|
359
|
-
minimalExample: {
|
|
360
|
-
uid: "grid-card-users",
|
|
361
|
-
use: "GridCardBlockModel",
|
|
362
|
-
stepParams: createCollectionResourceStepParams(
|
|
363
|
-
{},
|
|
364
|
-
{
|
|
365
|
-
GridCardSettings: {
|
|
366
|
-
columnCount: {
|
|
367
|
-
xs: 1,
|
|
368
|
-
md: 2,
|
|
369
|
-
lg: 3,
|
|
370
|
-
xxl: 4
|
|
371
|
-
},
|
|
372
|
-
rowCount: {
|
|
373
|
-
rowCount: 3
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
),
|
|
378
|
-
subModels: {
|
|
379
|
-
item: {
|
|
380
|
-
uid: "grid-card-item-users",
|
|
381
|
-
use: "GridCardItemModel"
|
|
382
|
-
},
|
|
383
|
-
actions: []
|
|
384
|
-
}
|
|
385
|
-
},
|
|
386
|
-
commonPatterns: [
|
|
387
|
-
{
|
|
388
|
-
title: "Basic grid card block",
|
|
389
|
-
snippet: {
|
|
390
|
-
use: "GridCardBlockModel",
|
|
391
|
-
stepParams: createCollectionResourceStepParams(
|
|
392
|
-
{},
|
|
393
|
-
{
|
|
394
|
-
GridCardSettings: {
|
|
395
|
-
columnCount: {
|
|
396
|
-
xs: 1,
|
|
397
|
-
md: 2,
|
|
398
|
-
lg: 3,
|
|
399
|
-
xxl: 4
|
|
400
|
-
},
|
|
401
|
-
rowCount: {
|
|
402
|
-
rowCount: 3
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
)
|
|
407
|
-
}
|
|
408
|
-
},
|
|
409
|
-
createAssociatedCollectionPattern("GridCardBlockModel", {
|
|
410
|
-
GridCardSettings: {
|
|
411
|
-
columnCount: {
|
|
412
|
-
xs: 1,
|
|
413
|
-
md: 2,
|
|
414
|
-
lg: 3,
|
|
415
|
-
xxl: 4
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
})
|
|
419
|
-
],
|
|
420
|
-
dynamicHints: [
|
|
421
|
-
{
|
|
422
|
-
kind: "dynamic-children",
|
|
423
|
-
path: "GridCardBlockModel.subModels.actions",
|
|
424
|
-
message: "Grid card actions depend on runtime collection-action registries.",
|
|
425
|
-
"x-flow": {
|
|
426
|
-
slotRules: {
|
|
427
|
-
slotKey: "actions",
|
|
428
|
-
type: "array"
|
|
429
|
-
},
|
|
430
|
-
contextRequirements: ["collection action registry"],
|
|
431
|
-
unresolvedReason: "runtime-grid-card-actions"
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
]
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
const flowSchemaContribution = {
|
|
438
|
-
inventory: {
|
|
439
|
-
publicTreeRoots: ["GridCardBlockModel"]
|
|
440
|
-
},
|
|
441
|
-
models: [gridCardItemModelInternalSchemaContribution, gridCardBlockModelSchemaContribution],
|
|
442
|
-
defaults: {
|
|
443
|
-
source: "plugin"
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
447
|
-
0 && (module.exports = {
|
|
448
|
-
flowSchemaContribution
|
|
449
|
-
});
|