Comparing version 1.0.1 to 1.0.2
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("classnames"),require("react-dnd"),require("react-dnd-html5-backend"),require("antd"),require("antd/es/date-picker/locale/zh_CN"),require("@ant-design/icons")):"function"==typeof define&&define.amd?define(["react","classnames","react-dnd","react-dnd-html5-backend","antd","antd/es/date-picker/locale/zh_CN","@ant-design/icons"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).bundle=t(e.react,e.cn,e.reactDnd,e.reactDndHtml5Backend,e.antd,e.locale,e["@ant-design/icons"])}(this,(function(e,t,r,a,n,l,o){"use strict";function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=d(e),u=d(t),c=d(l);function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){m(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(){return p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},p.apply(this,arguments)}function y(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},l=Object.keys(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,n,l=[],o=!0,d=!1;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(l.push(a.value),!t||l.length!==t);o=!0);}catch(e){d=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(d)throw n}}return l}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===r&&a.firstChild?a.insertBefore(n,a.firstChild):a.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".form_box .ant-form-item{margin-bottom:16px}.form_box .drag_box .drag_item{border:1px dashed transparent;background-color:#f5f5f5;padding:16px;transition:.3s}.form_box .drag_box .drag_item.active{border-color:#1890fc}.form_box .drag_box .drag_item .drag_header{display:flex;align-items:center;justify-content:space-between}.form_box .drag_box .drag_item .drag_header .drag_header_title{display:inline-flex;align-items:center}.form_box .drag_box .drag_item .drag_header .drag_header_title .require{color:#fa4f53}.form_box .drag_box .drag_item .drag_header .drag_header_title .anticon{margin-left:4px}.form_box .drag_box .drag_item .drag_header .drag_header_extend{display:flex;align-items:center;font-size:18px;color:#1890fc}.form_box .drag_box .drag_item .drag_header .drag_header_extend .anticon{margin:0 8px;cursor:pointer}.form_box .drag_box .drag_item .drag_body{display:flex;align-items:center;min-height:32px;margin-top:8px}.form_box .drag_box .drag_item .drag_body>div{width:100%}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9pbmRleC5sZXNzIiwiaW5kZXgubGVzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSx5QkFHSSxrQkNESixDREZBLCtCQWFNLDZCQUFBLENBQ0Esd0JBQUEsQ0FDQSxZQUFBLENBQ0EsY0NSTixDRFVNLHNDQUNFLG9CQ1JSLENEWEEsNENBdUJRLFlBQUEsQ0FDQSxrQkFBQSxDQUNBLDZCQ1RSLENEaEJBLCtEQTRCVSxtQkFBQSxDQUNBLGtCQ1RWLENEcEJBLHdFQWdDWSxhQ1RaLENEdkJBLHdFQW9DWSxlQ1ZaLENEMUJBLGdFQXlDVSxZQUFBLENBQ0Esa0JBQUEsQ0FDQSxjQUFBLENBQ0EsYUNaVixDRGhDQSx5RUErQ1ksWUFBQSxDQUNBLGNDWlosQ0RwQ0EsMENBc0RRLFlBQUEsQ0FDQSxrQkFBQSxDQUNBLGVBQUEsQ0FDQSxjQ2ZSLENEaUJRLDhDQUNFLFVDZlYiLCJmaWxlIjoiaW5kZXgubGVzcyJ9 */");var E=["readonly"],x=function(e){var t=s({placeholder:"请输入",disabled:e.readonly},y(e,E));return i.default.createElement(n.Input,t)},v=["readonly"],h=function(e){var t=s({placeholder:"请输入",disabled:e.readonly},y(e,v));return i.default.createElement(n.Input.TextArea,t)},_=["readonly","style"],Q=function(e){var t=e.readonly,r=e.style,a=y(e,_),l=s({placeholder:"请输入",disabled:t,style:s({width:"100%"},r)},a);return i.default.createElement(n.InputNumber,l)},C=["options","readonly"],N=function(e){var t=e.options,r=s({showSearch:!0,allowClear:!0,placeholder:"请选择",filterOption:function(e,t){return t.children.toLowerCase().indexOf(e.toLowerCase())>=0},disabled:e.readonly},y(e,C));return i.default.createElement(i.default.Fragment,null,i.default.createElement(n.Select,r,null==t?void 0:t.map((function(e){return i.default.createElement(n.Select.Option,{key:e.value,value:e.value,disabled:e.readonly},e.label)}))))},S=["options","readonly"],D=function(e){var t=e.options,r=s({disabled:e.readonly},y(e,S));return i.default.createElement(n.Radio.Group,r,i.default.createElement(n.Space,{wrap:!0},null==t?void 0:t.map((function(e){return i.default.createElement(n.Radio,{key:e.value,value:e.value},e.label)}))))},F=["options","readonly"],O=function(e){var t=e.options,r=s({disabled:e.readonly},y(e,F));return i.default.createElement(n.Checkbox.Group,r,i.default.createElement(n.Space,{wrap:!0},null==t?void 0:t.map((function(e){return i.default.createElement(n.Checkbox,{key:e.value,value:e.value},e.label)}))))},B=["readonly","type","dateType","style"],L=function(e){var t=e.readonly,r=e.type,a=void 0===r?"date":r,l=e.dateType,o=void 0===l?"date":l,d=e.style,u=y(e,B),f=s({disabled:t,style:s({width:"100%"},d),locale:c.default,picker:o},u);return i.default.createElement(i.default.Fragment,null,function(){switch(a){case"date":return i.default.createElement(n.DatePicker,f);case"range":return i.default.createElement(n.DatePicker.RangePicker,f)}}())},j=e.createContext(),w=function(){return e.useContext(j)},k=function(e){var t=w().valueMap,r=e.type,a=e.dateType,n=e.readonly,l=e.valueEnum,o=e.options;switch(r){case"input":return i.default.createElement(x,p({readonly:n},l));case"textarea":return i.default.createElement(h,p({readonly:n},l));case"number":return i.default.createElement(Q,p({readonly:n},l));case"select":return i.default.createElement(N,p({options:o,readonly:n},l));case"date":return i.default.createElement(L,p({type:"date",datetype:a,readonly:n},l));case"dateRange":return i.default.createElement(L,p({type:"range",datetype:a,readonly:n},l));case"checkbox":return i.default.createElement(O,p({options:o,readonly:n},l));case"radio":return i.default.createElement(D,p({options:o,readonly:n},l));default:return t[r](e)}},U=o.createFromIconfontCN({scriptUrl:"//at.alicdn.com/t/font_2966019_macdonzji9j.js"}),I=function(t){var a=w(),l=a.columns,d=a.onChange,c=a.state,f=a.onSetting,m=t.col,y=void 0===m?{xs:24,sm:12,xl:8,xxl:8}:m,b=t.name,E=t.required,x=t.label,v=t.tooltip,h=t.seq,_=k(t),Q=e.useRef(null),C=g(r.useDrop({accept:"editFormItem",collect:function(e){return{handlerId:e.getHandlerId()}},hover:function(e,t){var r;if(Q.current){var a=e.index,n=h;if(a!==n){var o=null===(r=Q.current)||void 0===r?void 0:r.getBoundingClientRect(),i=(o.bottom-o.top)/2,u=t.getClientOffset().y-o.top;a<n&&u<i||a>n&&u>i||(!function(e,t){var r=l.map((function(r){return s(s({},r),{},{seq:r.seq===e?t:r.seq===t?e:r.seq})}));d(r,"drop")}(a,n),e.index=n)}}}}),2),N=C[0].handlerId,S=C[1],D=g(r.useDrag({type:"editFormItem",item:function(){return{index:h}},collect:function(e){return{isDragging:e.isDragging()}}}),3),F=D[0].isDragging,O=D[1],B=D[2];return S(Q),i.default.createElement(i.default.Fragment,null,i.default.createElement(n.Col,p({ref:Q,"data-handler-id":N},y),i.default.createElement("div",{ref:B,className:u.default("drag_item",{active:F})},i.default.createElement("div",{className:"drag_header"},i.default.createElement("div",{className:"drag_header_title"},E&&i.default.createElement("span",{className:"require"},"*"),x,v&&i.default.createElement(n.Tooltip,{title:v},i.default.createElement(o.QuestionCircleOutlined,null))),i.default.createElement("div",{className:"drag_header_extend"},i.default.createElement(U,{type:"lmweb-setting",onClick:function(){return null==f?void 0:f(t)}}),i.default.createElement(U,{type:"lmweb-delete",onClick:function(){var e=c.columns.filter((function(e){return e.name!==b}));d(e,"delete")}}),i.default.createElement(U,{ref:O,type:"lmweb-drag"}))),i.default.createElement("div",{className:"drag_body"},_))))},R=["deauftLabel","type","options","readonly","dateType","dataType","valueEnum","col"],T=["columns","onChange","onValuesChange","onSetting","valueMap","isEdit"],q=function(e){e.deauftLabel,e.type,e.options,e.readonly,e.dateType,e.dataType,e.valueEnum;var t=e.col,r=void 0===t?{xs:24,sm:12,xl:8,xxl:8}:t,a=y(e,R),l=k(e);return console.log("props",e),i.default.createElement(i.default.Fragment,null,i.default.createElement(n.Col,r,i.default.createElement(n.Form.Item,a,l)))},P=function(e){var t=w().isEdit,r=e.hidden;return t?i.default.createElement(I,e):i.default.createElement(i.default.Fragment,null,!r&&i.default.createElement(q,e))};return function(e){var t,l=e.columns,o=void 0===l?[]:l,d=e.onChange,c=e.onValuesChange,f=e.onSetting,m=e.valueMap,b=void 0===m?{}:m,E=e.isEdit,x=y(e,T),v=g(n.Form.useForm(),1)[0],h=s({size:"default",labelCol:{flex:"0 0 140px"},wrapperCol:{flex:"1 1 0"}},x);return i.default.createElement(j.Provider,{value:{columns:o,onChange:function(e,t){null==d||d(e,t)},valueMap:b,isEdit:E,onSetting:f}},i.default.createElement("div",{className:"form_box"},i.default.createElement(r.DndProvider,{backend:a.HTML5Backend},i.default.createElement(n.Form,p({form:v},h,{onValuesChange:c}),i.default.createElement(n.Row,{gutter:[16,16],className:u.default({drag_box:E})},null==o||null===(t=o.sort((function(e,t){return(null==e?void 0:e.seq)-(null==t?void 0:t.seq)})))||void 0===t?void 0:t.map((function(e){return i.default.createElement(P,p({key:e.name},e))})))))))}})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("classnames"),require("react-dnd"),require("react-dnd-html5-backend"),require("antd"),require("antd/es/date-picker/locale/zh_CN"),require("@ant-design/icons")):"function"==typeof define&&define.amd?define(["react","classnames","react-dnd","react-dnd-html5-backend","antd","antd/es/date-picker/locale/zh_CN","@ant-design/icons"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).bundle=t(e.react,e.cn,e.reactDnd,e.reactDndHtml5Backend,e.antd,e.locale,e["@ant-design/icons"])}(this,(function(e,t,r,a,n,l,o){"use strict";function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=d(e),u=d(t),c=d(l);function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){m(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(){return p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},p.apply(this,arguments)}function y(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},l=Object.keys(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a<l.length;a++)r=l[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function g(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var a,n,l=[],o=!0,d=!1;try{for(r=r.call(e);!(o=(a=r.next()).done)&&(l.push(a.value),!t||l.length!==t);o=!0);}catch(e){d=!0,n=e}finally{try{o||null==r.return||r.return()}finally{if(d)throw n}}return l}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===r&&a.firstChild?a.insertBefore(n,a.firstChild):a.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}(".form_box .ant-form-item{margin-bottom:16px}.form_box .drag_box .drag_item{border:1px dashed transparent;background-color:#f5f5f5;padding:16px;transition:.3s}.form_box .drag_box .drag_item.active{border-color:#1890fc}.form_box .drag_box .drag_item .drag_header{display:flex;align-items:center;justify-content:space-between}.form_box .drag_box .drag_item .drag_header .drag_header_title{display:inline-flex;align-items:center}.form_box .drag_box .drag_item .drag_header .drag_header_title .require{color:#fa4f53}.form_box .drag_box .drag_item .drag_header .drag_header_title .anticon{margin-left:4px}.form_box .drag_box .drag_item .drag_header .drag_header_extend{display:flex;align-items:center;font-size:18px;color:#1890fc}.form_box .drag_box .drag_item .drag_header .drag_header_extend .anticon{margin:0 8px;cursor:pointer}.form_box .drag_box .drag_item .drag_body{display:flex;align-items:center;min-height:32px;margin-top:8px}.form_box .drag_box .drag_item .drag_body>div{width:100%}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9pbmRleC5sZXNzIiwiaW5kZXgubGVzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSx5QkFHSSxrQkNESixDREZBLCtCQWFNLDZCQUFBLENBQ0Esd0JBQUEsQ0FDQSxZQUFBLENBQ0EsY0NSTixDRFVNLHNDQUNFLG9CQ1JSLENEWEEsNENBdUJRLFlBQUEsQ0FDQSxrQkFBQSxDQUNBLDZCQ1RSLENEaEJBLCtEQTRCVSxtQkFBQSxDQUNBLGtCQ1RWLENEcEJBLHdFQWdDWSxhQ1RaLENEdkJBLHdFQW9DWSxlQ1ZaLENEMUJBLGdFQXlDVSxZQUFBLENBQ0Esa0JBQUEsQ0FDQSxjQUFBLENBQ0EsYUNaVixDRGhDQSx5RUErQ1ksWUFBQSxDQUNBLGNDWlosQ0RwQ0EsMENBc0RRLFlBQUEsQ0FDQSxrQkFBQSxDQUNBLGVBQUEsQ0FDQSxjQ2ZSLENEaUJRLDhDQUNFLFVDZlYiLCJmaWxlIjoiaW5kZXgubGVzcyJ9 */");var E=["readonly"],v=function(e){var t=s({placeholder:"请输入",disabled:e.readonly},y(e,E));return i.default.createElement(n.Input,t)},h=["readonly"],x=function(e){var t=s({placeholder:"请输入",disabled:e.readonly},y(e,h));return i.default.createElement(n.Input.TextArea,t)},_=["readonly","style"],Q=function(e){var t=e.readonly,r=e.style,a=y(e,_),l=s({placeholder:"请输入",disabled:t,style:s({width:"100%"},r)},a);return i.default.createElement(n.InputNumber,l)},C=["options","readonly"],N=function(e){var t=e.options,r=s({showSearch:!0,allowClear:!0,placeholder:"请选择",filterOption:function(e,t){return t.children.toLowerCase().indexOf(e.toLowerCase())>=0},disabled:e.readonly},y(e,C));return i.default.createElement(i.default.Fragment,null,i.default.createElement(n.Select,r,null==t?void 0:t.map((function(e){return i.default.createElement(n.Select.Option,{key:e.value,value:e.value,disabled:e.readonly},e.label)}))))},S=["options","readonly"],D=function(e){var t=e.options,r=s({disabled:e.readonly},y(e,S));return i.default.createElement(n.Radio.Group,r,i.default.createElement(n.Space,{wrap:!0},null==t?void 0:t.map((function(e){return i.default.createElement(n.Radio,{key:e.value,value:e.value},e.label)}))))},F=["options","readonly"],O=function(e){var t=e.options,r=s({disabled:e.readonly},y(e,F));return i.default.createElement(n.Checkbox.Group,r,i.default.createElement(n.Space,{wrap:!0},null==t?void 0:t.map((function(e){return i.default.createElement(n.Checkbox,{key:e.value,value:e.value},e.label)}))))},B=["readonly","type","dateType","style"],L=function(e){var t=e.readonly,r=e.type,a=void 0===r?"date":r,l=e.dateType,o=void 0===l?"date":l,d=e.style,u=y(e,B),f=s({disabled:t,style:s({width:"100%"},d),locale:c.default,picker:o},u);return i.default.createElement(i.default.Fragment,null,function(){switch(a){case"date":return i.default.createElement(n.DatePicker,f);case"range":return i.default.createElement(n.DatePicker.RangePicker,f)}}())},j=e.createContext(),w=function(){return e.useContext(j)},k=function(e){var t=w().valueMap,r=e.type,a=e.dateType,n=e.readonly,l=e.valueEnum,o=e.options;switch(r){case"input":return i.default.createElement(v,p({readonly:n},l));case"textarea":return i.default.createElement(x,p({readonly:n},l));case"number":return i.default.createElement(Q,p({readonly:n},l));case"select":return i.default.createElement(N,p({options:o,readonly:n},l));case"date":return i.default.createElement(L,p({type:"date",datetype:a,readonly:n},l));case"dateRange":return i.default.createElement(L,p({type:"range",datetype:a,readonly:n},l));case"checkbox":return i.default.createElement(O,p({options:o,readonly:n},l));case"radio":return i.default.createElement(D,p({options:o,readonly:n},l));default:return t[r](e)}},U=o.createFromIconfontCN({scriptUrl:"//at.alicdn.com/t/font_2966019_macdonzji9j.js"}),I=function(t){var a=w(),l=a.columns,d=a.onChange,c=a.state,f=a.onSetting,m=t.col,p=void 0===m?8:m,y=t.name,b=t.required,E=t.label,v=t.tooltip,h=t.seq,x=k(t),_=e.useRef(null),Q=g(r.useDrop({accept:"editFormItem",collect:function(e){return{handlerId:e.getHandlerId()}},hover:function(e,t){var r;if(_.current){var a=e.index,n=h;if(a!==n){var o=null===(r=_.current)||void 0===r?void 0:r.getBoundingClientRect(),i=(o.bottom-o.top)/2,u=t.getClientOffset().y-o.top;a<n&&u<i||a>n&&u>i||(!function(e,t){var r=l.map((function(r){return s(s({},r),{},{seq:r.seq===e?t:r.seq===t?e:r.seq})}));d(r,"drop")}(a,n),e.index=n)}}}}),2),C=Q[0].handlerId,N=Q[1],S=g(r.useDrag({type:"editFormItem",item:function(){return{index:h}},collect:function(e){return{isDragging:e.isDragging()}}}),3),D=S[0].isDragging,F=S[1],O=S[2];return N(_),i.default.createElement(i.default.Fragment,null,i.default.createElement(n.Col,{ref:_,"data-handler-id":C,span:p},i.default.createElement("div",{ref:O,className:u.default("drag_item",{active:D})},i.default.createElement("div",{className:"drag_header"},i.default.createElement("div",{className:"drag_header_title"},b&&i.default.createElement("span",{className:"require"},"*"),E,v&&i.default.createElement(n.Tooltip,{title:v},i.default.createElement(o.QuestionCircleOutlined,null))),i.default.createElement("div",{className:"drag_header_extend"},i.default.createElement(U,{type:"lmweb-setting",onClick:function(){return null==f?void 0:f(t)}}),i.default.createElement(U,{type:"lmweb-delete",onClick:function(){var e=c.columns.filter((function(e){return e.name!==y}));d(e,"delete")}}),i.default.createElement(U,{ref:F,type:"lmweb-drag"}))),i.default.createElement("div",{className:"drag_body"},x))))},R=["deauftLabel","type","options","readonly","dateType","dataType","valueEnum","col"],T=["columns","onChange","onValuesChange","onSetting","valueMap","isEdit"],q=function(e){e.deauftLabel,e.type,e.options,e.readonly,e.dateType,e.dataType,e.valueEnum;var t=e.col,r=void 0===t?8:t,a=y(e,R),l=k(e);return i.default.createElement(i.default.Fragment,null,i.default.createElement(n.Col,{span:r},i.default.createElement(n.Form.Item,a,l)))},P=function(e){var t=w().isEdit,r=e.hidden;return t?i.default.createElement(I,e):i.default.createElement(i.default.Fragment,null,!r&&i.default.createElement(q,e))};return function(e){var t,l=e.columns,o=void 0===l?[]:l,d=e.onChange,c=e.onValuesChange,f=e.onSetting,m=e.valueMap,b=void 0===m?{}:m,E=e.isEdit,v=y(e,T),h=g(n.Form.useForm(),1)[0],x=s({size:"default",labelCol:{flex:"0 0 140px"},wrapperCol:{flex:"1 1 0"}},v);return i.default.createElement(j.Provider,{value:{columns:o,onChange:function(e,t){null==d||d(e,t)},valueMap:b,isEdit:E,onSetting:f}},i.default.createElement("div",{className:"form_box"},i.default.createElement(r.DndProvider,{backend:a.HTML5Backend},i.default.createElement(n.Form,p({form:h},x,{onValuesChange:c}),i.default.createElement(n.Row,{gutter:[16,16],className:u.default({drag_box:E})},null==o||null===(t=o.sort((function(e,t){return(null==e?void 0:e.seq)-(null==t?void 0:t.seq)})))||void 0===t?void 0:t.map((function(e){return i.default.createElement(P,p({key:e.name},e))})))))))}})); |
{ | ||
"name": "ck-form", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "基于Antd表单Form的二次封装", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -17,3 +17,3 @@ import React, { useRef } from 'react'; | ||
const { columns, onChange, state, onSetting } = useStore(); | ||
const { col = { xs: 24, sm: 12, xl: 8, xxl: 8 }, name, required, label, tooltip, seq } = props; | ||
const { col = 8, name, required, label, tooltip, seq } = props; | ||
const Control = useControl(props); | ||
@@ -89,3 +89,3 @@ const ref = useRef(null); | ||
<> | ||
<Col ref={ref} data-handler-id={handlerId} {...col}> | ||
<Col ref={ref} data-handler-id={handlerId} span={col}> | ||
<div ref={preview} className={cn('drag_item', { active: isDragging })}> | ||
@@ -92,0 +92,0 @@ <div className="drag_header"> |
@@ -1,2 +0,2 @@ | ||
import React, { useEffect } from 'react'; | ||
import React from 'react'; | ||
import cn from 'classnames'; | ||
@@ -8,3 +8,3 @@ import { DndProvider } from 'react-dnd'; | ||
import EditConfig from './editConfig'; | ||
import { useCache, useStore, Context } from './context'; | ||
import { useStore, Context } from './context'; | ||
@@ -18,9 +18,8 @@ /* | ||
const ProFormItem = (props) => { | ||
const { deauftLabel, type, options, readonly, dateType, dataType, valueEnum, col = { xs: 24, sm: 12, xl: 8, xxl: 8 }, ...resetProps } = props; | ||
const { deauftLabel, type, options, readonly, dateType, dataType, valueEnum, col = 8, ...resetProps } = props; | ||
const Control = useControl(props); | ||
console.log('props', props) | ||
return ( | ||
<> | ||
<Col {...col}> | ||
<Col span={col}> | ||
<Form.Item {...resetProps}> | ||
@@ -39,11 +38,5 @@ {Control} | ||
if (isEdit) { | ||
return <EditConfig {...props} />; | ||
}; | ||
if (isEdit) { return <EditConfig {...props} /> }; | ||
return ( | ||
<> | ||
{!hidden && <ProFormItem {...props} />} | ||
</> | ||
) | ||
return (<>{!hidden && <ProFormItem {...props} />}</>) | ||
}; | ||
@@ -50,0 +43,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44910
695