@nocobase/plugin-field-sort 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.
@@ -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("antd"),require("react"),require("@nocobase/client"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-sort",["antd","react","@nocobase/client","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-field-sort"]=t(require("antd"),require("react"),require("@nocobase/client"),require("@nocobase/flow-engine")):e["@nocobase/plugin-field-sort"]=t(e.antd,e.react,e["@nocobase/client"],e["@nocobase/flow-engine"])}(self,function(e,t,r,n){return function(){"use strict";var o={342:function(e){e.exports=r},694:function(e){e.exports=n},59:function(t){t.exports=e},155:function(e){e.exports=t}},i={};function c(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,c),r.exports}c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,{a:t}),t},c.d=function(e,t){for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.g.importScripts&&(u=c.g.location+"");var u,a=c.g.document;if(!u&&a&&(a.currentScript&&"SCRIPT"===a.currentScript.tagName.toUpperCase()&&(u=a.currentScript.src),!u)){var l=a.getElementsByTagName("script");if(l.length)for(var f=l.length-1;f>-1&&(!u||!/^http(s?):/.test(u));)u=l[f--].src}if(!u)throw Error("Automatic publicPath is not supported in this browser");c.p=u.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var p={},s=window.__nocobase_public_path__||"";if(!s&&window.location&&window.location.pathname){var b=window.location.pathname||"/",y=b.indexOf("/v2/");s=y>=0?b.slice(0,y+1):"/"}return s&&(s=s.replace(/\/v2\/?$/,"/")),s||(s="/"),"/"!==s.charAt(s.length-1)&&(s+="/"),c.p=s+"static/plugins/@nocobase/plugin-field-sort/dist/client/",!function(){c.r(p),c.d(p,{default:function(){return S},PluginFieldSortClient:function(){return P}});var e=c(342);function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(o=function(){return!!e})()}var i=function(i){if("function"!=typeof i&&null!==i)throw TypeError("Super expression must either be null or a function");function c(){var n,i,u,a,l;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return i=c,u=arguments,i=r(i),t(n=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,o()?Reflect.construct(i,u||[],r(this).constructor):i.apply(this,u)),"name","sort"),t(n,"type","object"),t(n,"group","advanced"),t(n,"order",1),t(n,"title",'{{t("Sort")}}'),t(n,"sortable",!0),t(n,"titleUsable",!0),t(n,"description",'{{t("Used for drag and drop sorting scenarios, supporting grouping sorting")}}'),t(n,"default",{type:"sort",uiSchema:{type:"number","x-component":"InputNumber","x-component-props":{stringMode:!0,step:"1"},"x-validator":"integer"}}),t(n,"availableTypes",["sort"]),t(n,"hasDefaultValue",!1),t(n,"properties",(a=function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(r){t(e,r,n[r])})}return e}({},e.defaultProps),l=l={scopeKey:{type:"string",title:'{{t("Grouped sorting")}}',"x-disabled":"{{ !editMainOnly}}","x-decorator":"FormItem","x-component":"Select",enum:"{{scopeKeyOptions}}",description:"{{t('When a field is selected for grouping, it will be grouped first before sorting.')}}"}},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(l)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(l,e))}),a)),t(n,"filterable",{operators:e.operators.number}),t(n,"validateSchema",function(t){return{maximum:{type:"number",title:'{{ t("Maximum") }}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":"{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(e.i18n.t("Maximum must greater than minimum"),"' : ''\n }}}")},minimum:{type:"number",title:'{{ t("Minimum") }}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":{dependencies:[".maximum"],fulfill:{state:{selfErrors:"{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(e.i18n.t("Minimum must less than maximum"),"' : ''}}")}}}},format:{type:"string",title:'{{ t("Format") }}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!0},enum:[{label:'{{ t("Odd") }}',value:"odd"},{label:'{{ t("Even") }}',value:"even"}]},pattern:{type:"string",title:'{{ t("Regular expression") }}',"x-decorator":"FormItem","x-component":"Input","x-component-props":{prefix:"/",suffix:"/"}}}}),n}return c.prototype=Object.create(i&&i.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),i&&n(c,i),c}(e.CollectionFieldInterface),u=c(59),a=c(155),l=c.n(a),f=c(694);function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}var d=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=s(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,y()?Reflect.construct(e,t||[],s(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&b(r,e),t=[{key:"render",value:function(){var e,t;return l().createElement(u.InputNumber,(e=function(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){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},this.props),t=t={style:{width:"100%"}},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(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}(e.FieldModel);function m(e,t,r,n,o,i,c){try{var u=e[i](c),a=u.value}catch(e){r(e);return}u.done?t(a):Promise.resolve(a).then(n,o)}function h(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function c(e){m(i,n,o,c,u,"next",e)}function u(e){m(i,n,o,c,u,"throw",e)}c(void 0)})}}function v(e,t,r){return(v=j()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&O(o,r.prototype),o}).apply(null,arguments)}f.EditableItemModel.bindModelToInterface("SortFieldModel",["sort"],{isDefault:!0}),f.DisplayItemModel.bindModelToInterface("DisplayNumberFieldModel",["sort"],{isDefault:!0});function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t="function"==typeof Map?new Map:void 0;return(w=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 v(e,arguments,g(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),O(r,e)})(e)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function x(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var P=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=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,j()?Reflect.construct(e,t||[],g(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&O(r,e),t=[{key:"afterAdd",value:function(){return h(function(){return x(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return h(function(){return x(this,function(e){return[2]})})()}},{key:"load",value:function(){return h(function(){return x(this,function(e){return this.app.addFieldInterfaces([i]),this.flowEngine.registerModels({SortFieldModel:d}),[2]})}).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}(w(e.Plugin)),S=P}(),p}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("antd"),require("react"),require("@nocobase/client"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-field-sort",["antd","react","@nocobase/client","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-field-sort"]=t(require("antd"),require("react"),require("@nocobase/client"),require("@nocobase/flow-engine")):e["@nocobase/plugin-field-sort"]=t(e.antd,e.react,e["@nocobase/client"],e["@nocobase/flow-engine"])}(self,function(e,t,r,n){return function(){"use strict";var o={342:function(e){e.exports=r},694:function(e){e.exports=n},59:function(t){t.exports=e},155:function(e){e.exports=t}},i={};function c(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,c),r.exports}c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,{a:t}),t},c.d=function(e,t){for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.g.importScripts&&(u=c.g.location+"");var u,a=c.g.document;if(!u&&a&&(a.currentScript&&"SCRIPT"===a.currentScript.tagName.toUpperCase()&&(u=a.currentScript.src),!u)){var l=a.getElementsByTagName("script");if(l.length)for(var p=l.length-1;p>-1&&(!u||!/^http(s?):/.test(u));)u=l[p--].src}if(!u)throw Error("Automatic publicPath is not supported in this browser");c.p=u.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var f={};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 r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-field-sort/dist/client/")}if(!e){if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var n=window.location.pathname||"/",o=n.indexOf("/v2/");e=o>=0?n.slice(0,o+1):"/"}e&&(e=e.replace(/\/v2\/?$/,"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-field-sort/dist/client/"}c.p=e}(),!function(){c.r(f),c.d(f,{default:function(){return _},PluginFieldSortClient:function(){return P}});var e=c(342);function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(o=function(){return!!e})()}var i=function(i){if("function"!=typeof i&&null!==i)throw TypeError("Super expression must either be null or a function");function c(){var n,i,u,a,l;if(!(this instanceof c))throw TypeError("Cannot call a class as a function");return i=c,u=arguments,i=r(i),t(n=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,o()?Reflect.construct(i,u||[],r(this).constructor):i.apply(this,u)),"name","sort"),t(n,"type","object"),t(n,"group","advanced"),t(n,"order",1),t(n,"title",'{{t("Sort")}}'),t(n,"sortable",!0),t(n,"titleUsable",!0),t(n,"description",'{{t("Used for drag and drop sorting scenarios, supporting grouping sorting")}}'),t(n,"default",{type:"sort",uiSchema:{type:"number","x-component":"InputNumber","x-component-props":{stringMode:!0,step:"1"},"x-validator":"integer"}}),t(n,"availableTypes",["sort"]),t(n,"hasDefaultValue",!1),t(n,"properties",(a=function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(r){t(e,r,n[r])})}return e}({},e.defaultProps),l=l={scopeKey:{type:"string",title:'{{t("Grouped sorting")}}',"x-disabled":"{{ !editMainOnly}}","x-decorator":"FormItem","x-component":"Select",enum:"{{scopeKeyOptions}}",description:"{{t('When a field is selected for grouping, it will be grouped first before sorting.')}}"}},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(l)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(l)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(l,e))}),a)),t(n,"filterable",{operators:e.operators.number}),t(n,"validateSchema",function(t){return{maximum:{type:"number",title:'{{ t("Maximum") }}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":"{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(e.i18n.t("Maximum must greater than minimum"),"' : ''\n }}}")},minimum:{type:"number",title:'{{ t("Minimum") }}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{precision:0},"x-reactions":{dependencies:[".maximum"],fulfill:{state:{selfErrors:"{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(e.i18n.t("Minimum must less than maximum"),"' : ''}}")}}}},format:{type:"string",title:'{{ t("Format") }}',"x-decorator":"FormItem","x-component":"Select","x-component-props":{allowClear:!0},enum:[{label:'{{ t("Odd") }}',value:"odd"},{label:'{{ t("Even") }}',value:"even"}]},pattern:{type:"string",title:'{{ t("Regular expression") }}',"x-decorator":"FormItem","x-component":"Input","x-component-props":{prefix:"/",suffix:"/"}}}}),n}return c.prototype=Object.create(i&&i.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),i&&n(c,i),c}(e.CollectionFieldInterface),u=c(59),a=c(155),l=c.n(a),p=c(694);function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}var d=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=s(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,y()?Reflect.construct(e,t||[],s(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&b(r,e),t=[{key:"render",value:function(){var e,t;return l().createElement(u.InputNumber,(e=function(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){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},this.props),t=t={style:{width:"100%"}},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(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}(e.FieldModel);function m(e,t,r,n,o,i,c){try{var u=e[i](c),a=u.value}catch(e){r(e);return}u.done?t(a):Promise.resolve(a).then(n,o)}function h(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function c(e){m(i,n,o,c,u,"next",e)}function u(e){m(i,n,o,c,u,"throw",e)}c(void 0)})}}function v(e,t,r){return(v=j()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&O(o,r.prototype),o}).apply(null,arguments)}p.EditableItemModel.bindModelToInterface("SortFieldModel",["sort"],{isDefault:!0}),p.DisplayItemModel.bindModelToInterface("DisplayNumberFieldModel",["sort"],{isDefault:!0});function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t="function"==typeof Map?new Map:void 0;return(w=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 v(e,arguments,g(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),O(r,e)})(e)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function x(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(r)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,n=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var P=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=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,j()?Reflect.construct(e,t||[],g(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&O(r,e),t=[{key:"afterAdd",value:function(){return h(function(){return x(this,function(e){return[2]})})()}},{key:"beforeLoad",value:function(){return h(function(){return x(this,function(e){return[2]})})()}},{key:"load",value:function(){return h(function(){return x(this,function(e){return this.app.addFieldInterfaces([i]),this.flowEngine.registerModels({SortFieldModel:d}),[2]})}).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}(w(e.Plugin)),_=P}(),f}()});
@@ -10,13 +10,13 @@
10
10
  module.exports = {
11
11
  "antd": "5.24.2",
12
12
  "react": "18.2.0",
13
- "@nocobase/flow-engine": "2.1.0-alpha.12",
14
- "@nocobase/client": "2.1.0-alpha.12",
13
+ "@nocobase/flow-engine": "2.1.0-alpha.14",
14
+ "@nocobase/client": "2.1.0-alpha.14",
15
15
  "lodash": "4.17.21",
16
- "@nocobase/database": "2.1.0-alpha.12",
17
- "@nocobase/actions": "2.1.0-alpha.12",
18
- "@nocobase/server": "2.1.0-alpha.12",
19
- "@nocobase/data-source-manager": "2.1.0-alpha.12",
16
+ "@nocobase/database": "2.1.0-alpha.14",
17
+ "@nocobase/actions": "2.1.0-alpha.14",
18
+ "@nocobase/server": "2.1.0-alpha.14",
19
+ "@nocobase/data-source-manager": "2.1.0-alpha.14",
20
20
  "sequelize": "6.35.2",
21
- "@nocobase/lock-manager": "2.1.0-alpha.12"
21
+ "@nocobase/lock-manager": "2.1.0-alpha.14"
22
22
  };
@@ -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 PluginFieldSortServer 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>;
@@ -34,13 +34,9 @@ var import_server = require("@nocobase/server");
34
34
  var import_data_source_manager = require("@nocobase/data-source-manager");
35
35
  var import_sort_field = require("./sort-field");
36
36
  var import_action = require("./action");
37
- var import_flow_schema_contributions = require("./flow-schema-contributions");
38
37
  class PluginFieldSortServer extends import_server.Plugin {
39
38
  async afterAdd() {
40
39
  }
41
- getFlowSchemaContributions() {
42
- return import_flow_schema_contributions.flowSchemaContribution;
43
- }
44
40
  async beforeLoad() {
45
41
  const { lockManager } = this.app;
46
42
  class SortFieldClass extends import_sort_field.SortField {
@@ -168,7 +168,11 @@ class SortField extends import_database.Field {
168
168
  };
169
169
  const scopeKey = this.options.scopeKey;
170
170
  if (scopeKey) {
171
- const scopeKeyColumn = this.collection.model.rawAttributes[scopeKey].field;
171
+ const scopeKeyAttribute = this.collection.model.rawAttributes[scopeKey];
172
+ if (!scopeKeyAttribute || !scopeKeyAttribute.field) {
173
+ return;
174
+ }
175
+ const scopeKeyColumn = scopeKeyAttribute.field;
172
176
  const groups = await this.collection.model.findAll({
173
177
  attributes: [[import_sequelize.Sequelize.fn("DISTINCT", import_sequelize.Sequelize.col(scopeKeyColumn)), scopeKey]],
174
178
  raw: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-field-sort",
3
- "version": "2.1.0-alpha.12",
3
+ "version": "2.1.0-alpha.14",
4
4
  "license": "Apache-2.0",
5
5
  "displayName": "Collection field: Sort",
6
6
  "displayName.ru-RU": "Поле коллекции: Сортировка",
@@ -22,5 +22,5 @@
22
22
  "keywords": [
23
23
  "Collection fields"
24
24
  ],
25
- "gitHead": "f12c4a75470590b1670ce54510b96ef94c2cd7a2"
25
+ "gitHead": "d8735b541de0ff9557bba704de49c799b4962672"
26
26
  }
@@ -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,87 +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 sortFieldModelSchemaContribution = {
33
- use: "SortFieldModel",
34
- title: "Sort",
35
- source: "plugin",
36
- strict: false,
37
- exposure: "internal",
38
- stepParamsSchema: {
39
- type: "object",
40
- properties: {
41
- fieldSettings: {
42
- type: "object",
43
- properties: {
44
- init: {
45
- type: "object",
46
- properties: {
47
- dataSourceKey: { type: "string" },
48
- collectionName: { type: "string" },
49
- fieldPath: { type: "string" }
50
- },
51
- additionalProperties: true
52
- }
53
- },
54
- additionalProperties: true
55
- }
56
- },
57
- additionalProperties: true
58
- },
59
- skeleton: {
60
- uid: "todo-sort-field-model",
61
- use: "SortFieldModel"
62
- }
63
- };
64
- const flowSchemaContribution = {
65
- models: [sortFieldModelSchemaContribution],
66
- fieldBindings: [
67
- {
68
- context: "editable-field",
69
- use: "SortFieldModel",
70
- interfaces: ["sort"],
71
- isDefault: true
72
- },
73
- {
74
- context: "display-field",
75
- use: "DisplayNumberFieldModel",
76
- interfaces: ["sort"],
77
- isDefault: true
78
- }
79
- ],
80
- defaults: {
81
- source: "plugin"
82
- }
83
- };
84
- // Annotate the CommonJS export names for ESM import in node:
85
- 0 && (module.exports = {
86
- flowSchemaContribution
87
- });